@grackle-ai/web 0.103.0 → 0.104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{KnowledgePage-UWFPbEn4.js → KnowledgePage-BuQIog9j.js} +1 -1
- package/dist/assets/grpc-BFfuHYns.js +2 -0
- package/dist/assets/index-B3lvUgOG.js +725 -0
- package/dist/index.html +2 -2
- package/package.json +3 -3
- package/dist/assets/grpc-BAFIlDeq.js +0 -2
- package/dist/assets/index-BrQ3ksRP.js +0 -720
|
@@ -1,720 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-UWFPbEn4.js","assets/dagview-tHPW3Rz3.js","assets/grpc-BAFIlDeq.js","assets/markdown-Yr3vTPLR.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as vT,a as yT,b as x,j as i,d as ry,H as ly,P as cy,i as bT,B as xT,c as _T,C as kT,M as ST,e as TT}from"./dagview-tHPW3Rz3.js";import{c as jT,a as Sd,G as wT,b as NT,d as CT,e as ET,f as AT,M as DT,A as kx,D as Sx,W as RT,O as MT,g as IT,C as Ei,h as Tx,i as jx,w as OT,t as BT,p as Oc,j as LT,R as Lr,S as dy}from"./grpc-BAFIlDeq.js";import{v as zT,r as $T,t as Bc,i as UT,f as PT,M as Td,a as jd}from"./markdown-Yr3vTPLR.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const u of d.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function o(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(c){if(c.ep)return;c.ep=!0;const d=o(c);fetch(c.href,d)}})();var Kf={exports:{}},zr={},Yf={exports:{}},Jf={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* scheduler.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var uy;function HT(){return uy||(uy=1,(function(t){function s(B,F){var Z=B.length;B.push(F);e:for(;0<Z;){var de=Z-1>>>1,W=B[de];if(0<c(W,F))B[de]=F,B[Z]=W,Z=de;else break e}}function o(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var F=B[0],Z=B.pop();if(Z!==F){B[0]=Z;e:for(var de=0,W=B.length,ee=W>>>1;de<ee;){var ue=2*(de+1)-1,Ce=B[ue],Pe=ue+1,ge=B[Pe];if(0>c(Ce,Z))Pe<W&&0>c(ge,Ce)?(B[de]=ge,B[Pe]=Z,de=Pe):(B[de]=Ce,B[ue]=Z,de=ue);else if(Pe<W&&0>c(ge,Z))B[de]=ge,B[Pe]=Z,de=Pe;else break e}}return F}function c(B,F){var Z=B.sortIndex-F.sortIndex;return Z!==0?Z:B.id-F.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var u=Date,p=u.now();t.unstable_now=function(){return u.now()-p}}var m=[],g=[],v=1,b=null,y=3,S=!1,k=!1,j=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function I(B){for(var F=o(g);F!==null;){if(F.callback===null)r(g);else if(F.startTime<=B)r(g),F.sortIndex=F.expirationTime,s(m,F);else break;F=o(g)}}function E(B){if(j=!1,I(B),!k)if(o(m)!==null)k=!0,D||(D=!0,J());else{var F=o(g);F!==null&&X(E,F.startTime-B)}}var D=!1,P=-1,O=5,z=-1;function Q(){return N?!0:!(t.unstable_now()-z<O)}function $(){if(N=!1,D){var B=t.unstable_now();z=B;var F=!0;try{e:{k=!1,j&&(j=!1,C(P),P=-1),S=!0;var Z=y;try{t:{for(I(B),b=o(m);b!==null&&!(b.expirationTime>B&&Q());){var de=b.callback;if(typeof de=="function"){b.callback=null,y=b.priorityLevel;var W=de(b.expirationTime<=B);if(B=t.unstable_now(),typeof W=="function"){b.callback=W,I(B),F=!0;break t}b===o(m)&&r(m),I(B)}else r(m);b=o(m)}if(b!==null)F=!0;else{var ee=o(g);ee!==null&&X(E,ee.startTime-B),F=!1}}break e}finally{b=null,y=Z,S=!1}F=void 0}}finally{F?J():D=!1}}}var J;if(typeof A=="function")J=function(){A($)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,te=me.port2;me.port1.onmessage=$,J=function(){te.postMessage(null)}}else J=function(){T($,0)};function X(B,F){P=T(function(){B(t.unstable_now())},F)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_next=function(B){switch(y){case 1:case 2:case 3:var F=3;break;default:F=y}var Z=y;y=F;try{return B()}finally{y=Z}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(B,F){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Z=y;y=B;try{return F()}finally{y=Z}},t.unstable_scheduleCallback=function(B,F,Z){var de=t.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?de+Z:de):Z=de,B){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=Z+W,B={id:v++,callback:F,priorityLevel:B,startTime:Z,expirationTime:W,sortIndex:-1},Z>de?(B.sortIndex=Z,s(g,B),o(m)===null&&B===o(g)&&(j?(C(P),P=-1):j=!0,X(E,Z-de))):(B.sortIndex=W,s(m,B),k||S||(k=!0,D||(D=!0,J()))),B},t.unstable_shouldYield=Q,t.unstable_wrapCallback=function(B){var F=y;return function(){var Z=y;y=F;try{return B.apply(this,arguments)}finally{y=Z}}}})(Jf)),Jf}var fy;function VT(){return fy||(fy=1,Yf.exports=HT()),Yf.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 py;function qT(){if(py)return zr;py=1;var t=VT(),s=vT(),o=yT();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(d(e)!==e)throw Error(r(188))}function g(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(r(188));return n!==e?null:e}for(var a=e,l=n;;){var f=a.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===a)return m(f),e;if(h===l)return m(f),n;h=h.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=h;else{for(var _=!1,w=f.child;w;){if(w===a){_=!0,a=f,l=h;break}if(w===l){_=!0,l=f,a=h;break}w=w.sibling}if(!_){for(w=h.child;w;){if(w===a){_=!0,a=h,l=f;break}if(w===l){_=!0,l=h,a=f;break}w=w.sibling}if(!_)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,y=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),A=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function J(e){return e===null||typeof e!="object"?null:(e=$&&e[$]||e["@@iterator"],typeof e=="function"?e:null)}var me=Symbol.for("react.client.reference");function te(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===me?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case T:return"Profiler";case N:return"StrictMode";case E:return"Suspense";case D:return"SuspenseList";case z:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case A:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case I:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return n=e.displayName||null,n!==null?n:te(e.type)||"Memo";case O:n=e._payload,e=e._init;try{return te(e(n))}catch{}}return null}var X=Array.isArray,B=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},de=[],W=-1;function ee(e){return{current:e}}function ue(e){0>W||(e.current=de[W],de[W]=null,W--)}function Ce(e,n){W++,de[W]=e.current,e.current=n}var Pe=ee(null),ge=ee(null),Se=ee(null),xe=ee(null);function Be(e,n){switch(Ce(Se,n),Ce(ge,e),Ce(Pe,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=D0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ue(Pe),Ce(Pe,e)}function It(){ue(Pe),ue(ge),ue(Se)}function zn(e){e.memoizedState!==null&&Ce(xe,e);var n=Pe.current,a=D0(n,e.type);n!==a&&(Ce(ge,e),Ce(Pe,a))}function re(e){ge.current===e&&(ue(Pe),ue(ge)),xe.current===e&&(ue(xe),Mr._currentValue=Z)}var Ye,Pt;function ae(e){if(Ye===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Ye=n&&n[1]||"",Pt=-1<a.stack.indexOf(`
|
|
19
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
-
`+Ye+e+Pt}var wt=!1;function Ot(e,n){if(!e||wt)return"";wt=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(K){var G=K}Reflect.construct(e,[],oe)}else{try{oe.call()}catch(K){G=K}e.call(oe.prototype)}}else{try{throw Error()}catch(K){G=K}(oe=e())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(K){if(K&&G&&typeof K.stack=="string")return[K.stack,G.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),_=h[0],w=h[1];if(_&&w){var R=_.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 ne=`
|
|
23
|
-
`+R[l].replace(" at new "," at ");return e.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",e.displayName)),ne}while(1<=l&&0<=f);break}}}finally{wt=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ae(a):""}function Bt(e,n){switch(e.tag){case 26:case 27:case 5:return ae(e.type);case 16:return ae("Lazy");case 13:return e.child!==n&&n!==null?ae("Suspense Fallback"):ae("Suspense");case 19:return ae("SuspenseList");case 0:case 15:return Ot(e.type,!1);case 11:return Ot(e.type.render,!1);case 1:return Ot(e.type,!0);case 31:return ae("Activity");default:return""}}function ze(e){try{var n="",a=null;do n+=Bt(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
|
|
24
|
-
Error generating stack: `+l.message+`
|
|
25
|
-
`+l.stack}}var sn=Object.prototype.hasOwnProperty,ca=t.unstable_scheduleCallback,is=t.unstable_cancelCallback,Wa=t.unstable_shouldYield,da=t.unstable_requestPaint,Jt=t.unstable_now,Bi=t.unstable_getCurrentPriorityLevel,ua=t.unstable_ImmediatePriority,Xa=t.unstable_UserBlockingPriority,ys=t.unstable_NormalPriority,Li=t.unstable_LowPriority,$n=t.unstable_IdlePriority,De=t.log,Je=t.unstable_setDisableYieldValue,Wt=null,St=null;function mn(e){if(typeof De=="function"&&Je(e),St&&typeof St.setStrictMode=="function")try{St.setStrictMode(Wt,e)}catch{}}var Xt=Math.clz32?Math.clz32:Ui,zi=Math.log,$i=Math.LN2;function Ui(e){return e>>>=0,e===0?32:31-(zi(e)/$i|0)|0}var Qa=256,ei=262144,ti=4194304;function bs(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 ni(e,n,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var w=l&134217727;return w!==0?(l=w&~h,l!==0?f=bs(l):(_&=w,_!==0?f=bs(_):a||(a=w&~e,a!==0&&(f=bs(a))))):(w=l&~h,w!==0?f=bs(w):_!==0?f=bs(_):a||(a=l&~e,a!==0&&(f=bs(a)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:f}function fa(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function _l(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 kl(){var e=ti;return ti<<=1,(ti&62914560)===0&&(ti=4194304),e}function H(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function se(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function le(e,n,a,l,f,h){var _=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var w=e.entanglements,R=e.expirationTimes,q=e.hiddenUpdates;for(a=_&~a;0<a;){var ne=31-Xt(a),oe=1<<ne;w[ne]=0,R[ne]=-1;var G=q[ne];if(G!==null)for(q[ne]=null,ne=0;ne<G.length;ne++){var K=G[ne];K!==null&&(K.lane&=-536870913)}a&=~oe}l!==0&&fe(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(_&~n))}function fe(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Xt(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function he(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-Xt(a),f=1<<l;f&n|e[l]&n&&(e[l]|=n),a&=~f}}function qe(e,n){var a=n&-n;return a=(a&42)!==0?1:_e(a),(a&(e.suspendedLanes|n))!==0?0:a}function _e(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 Re(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function We(){var e=F.p;return e!==0?e:(e=window.event,e===void 0?32:ey(e.type))}function ht(e,n){var a=F.p;try{return F.p=e,n()}finally{F.p=a}}var Le=Math.random().toString(36).slice(2),Xe="__reactFiber$"+Le,ot="__reactProps$"+Le,vt="__reactContainer$"+Le,xs="__reactEvents$"+Le,Ds="__reactListeners$"+Le,Zo="__reactHandles$"+Le,vh="__reactResources$"+Le,Ko="__reactMarker$"+Le;function $d(e){delete e[Xe],delete e[ot],delete e[xs],delete e[Ds],delete e[Zo]}function Pi(e){var n=e[Xe];if(n)return n;for(var a=e.parentNode;a;){if(n=a[vt]||a[Xe]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=z0(e);e!==null;){if(a=e[Xe])return a;e=z0(e)}return n}e=a,a=e.parentNode}return null}function Hi(e){if(e=e[Xe]||e[vt]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Yo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function Vi(e){var n=e[vh];return n||(n=e[vh]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Qt(e){e[Ko]=!0}var yh=new Set,bh={};function si(e,n){qi(e,n),qi(e+"Capture",n)}function qi(e,n){for(bh[e]=n,e=0;e<n.length;e++)yh.add(n[e])}var lk=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]*$"),xh={},_h={};function ck(e){return sn.call(_h,e)?!0:sn.call(xh,e)?!1:lk.test(e)?_h[e]=!0:(xh[e]=!0,!1)}function Sl(e,n,a){if(ck(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 Tl(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 Rs(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 Un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function kh(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function dk(e,n,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(_){a=""+_,h.call(this,_)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Ud(e){if(!e._valueTracker){var n=kh(e)?"checked":"value";e._valueTracker=dk(e,n,""+e[n])}}function Sh(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=kh(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function jl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var uk=/[\n"\\]/g;function Pn(e){return e.replace(uk,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Pd(e,n,a,l,f,h,_,w){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),n!=null?_==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Un(n)):e.value!==""+Un(n)&&(e.value=""+Un(n)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),n!=null?Hd(e,_,Un(n)):a!=null?Hd(e,_,Un(a)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Un(w):e.removeAttribute("name")}function Th(e,n,a,l,f,h,_,w){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){Ud(e);return}a=a!=null?""+Un(a):"",n=n!=null?""+Un(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,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),Ud(e)}function Hd(e,n,a){n==="number"&&jl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Gi(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=""+Un(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 jh(e,n,a){if(n!=null&&(n=""+Un(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+Un(a):""}function wh(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(r(92));if(X(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=Un(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Ud(e)}function Fi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var fk=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 Nh(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||fk.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function Ch(e,n,a){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&a[f]!==l&&Nh(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&Nh(e,h,n[h])}function Vd(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 pk=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"]]),mk=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function wl(e){return mk.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ms(){}var qd=null;function Gd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zi=null,Ki=null;function Eh(e){var n=Hi(e);if(n&&(e=n.stateNode)){var a=e[ot]||null;e:switch(e=n.stateNode,n.type){case"input":if(Pd(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="'+Pn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[ot]||null;if(!f)throw Error(r(90));Pd(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&&Sh(l)}break e;case"textarea":jh(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Gi(e,!!a.multiple,n,!1)}}}var Fd=!1;function Ah(e,n,a){if(Fd)return e(n,a);Fd=!0;try{var l=e(n);return l}finally{if(Fd=!1,(Zi!==null||Ki!==null)&&(pc(),Zi&&(n=Zi,e=Ki,Ki=Zi=null,Eh(n),e)))for(n=0;n<e.length;n++)Eh(e[n])}}function Jo(e,n){var a=e.stateNode;if(a===null)return null;var l=a[ot]||null;if(l===null)return null;a=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(r(231,n,typeof a));return a}var Is=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zd=!1;if(Is)try{var Wo={};Object.defineProperty(Wo,"passive",{get:function(){Zd=!0}}),window.addEventListener("test",Wo,Wo),window.removeEventListener("test",Wo,Wo)}catch{Zd=!1}var pa=null,Kd=null,Nl=null;function Dh(){if(Nl)return Nl;var e,n=Kd,a=n.length,l,f="value"in pa?pa.value:pa.textContent,h=f.length;for(e=0;e<a&&n[e]===f[e];e++);var _=a-e;for(l=1;l<=_&&n[a-l]===f[h-l];l++);return Nl=f.slice(e,1<l?1-l:void 0)}function Cl(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 El(){return!0}function Rh(){return!1}function xn(e){function n(a,l,f,h,_){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=_,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(a=e[w],this[w]=a?a(h):h[w]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?El:Rh,this.isPropagationStopped=Rh,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=El)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=El)},persist:function(){},isPersistent:El}),n}var ai={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Al=xn(ai),Xo=b({},ai,{view:0,detail:0}),hk=xn(Xo),Yd,Jd,Qo,Dl=b({},Xo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xd,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!==Qo&&(Qo&&e.type==="mousemove"?(Yd=e.screenX-Qo.screenX,Jd=e.screenY-Qo.screenY):Jd=Yd=0,Qo=e),Yd)},movementY:function(e){return"movementY"in e?e.movementY:Jd}}),Mh=xn(Dl),gk=b({},Dl,{dataTransfer:0}),vk=xn(gk),yk=b({},Xo,{relatedTarget:0}),Wd=xn(yk),bk=b({},ai,{animationName:0,elapsedTime:0,pseudoElement:0}),xk=xn(bk),_k=b({},ai,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kk=xn(_k),Sk=b({},ai,{data:0}),Ih=xn(Sk),Tk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jk={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"},wk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nk(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=wk[e])?!!n[e]:!1}function Xd(){return Nk}var Ck=b({},Xo,{key:function(e){if(e.key){var n=Tk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Cl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?jk[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xd,charCode:function(e){return e.type==="keypress"?Cl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Cl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ek=xn(Ck),Ak=b({},Dl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oh=xn(Ak),Dk=b({},Xo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xd}),Rk=xn(Dk),Mk=b({},ai,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ik=xn(Mk),Ok=b({},Dl,{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}),Bk=xn(Ok),Lk=b({},ai,{newState:0,oldState:0}),zk=xn(Lk),$k=[9,13,27,32],Qd=Is&&"CompositionEvent"in window,er=null;Is&&"documentMode"in document&&(er=document.documentMode);var Uk=Is&&"TextEvent"in window&&!er,Bh=Is&&(!Qd||er&&8<er&&11>=er),Lh=" ",zh=!1;function $h(e,n){switch(e){case"keyup":return $k.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yi=!1;function Pk(e,n){switch(e){case"compositionend":return Uh(n);case"keypress":return n.which!==32?null:(zh=!0,Lh);case"textInput":return e=n.data,e===Lh&&zh?null:e;default:return null}}function Hk(e,n){if(Yi)return e==="compositionend"||!Qd&&$h(e,n)?(e=Dh(),Nl=Kd=pa=null,Yi=!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 Bh&&n.locale!=="ko"?null:n.data;default:return null}}var Vk={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 Ph(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Vk[e.type]:n==="textarea"}function Hh(e,n,a,l){Zi?Ki?Ki.push(l):Ki=[l]:Zi=l,n=xc(n,"onChange"),0<n.length&&(a=new Al("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var tr=null,nr=null;function qk(e){T0(e,0)}function Rl(e){var n=Yo(e);if(Sh(n))return e}function Vh(e,n){if(e==="change")return n}var qh=!1;if(Is){var eu;if(Is){var tu="oninput"in document;if(!tu){var Gh=document.createElement("div");Gh.setAttribute("oninput","return;"),tu=typeof Gh.oninput=="function"}eu=tu}else eu=!1;qh=eu&&(!document.documentMode||9<document.documentMode)}function Fh(){tr&&(tr.detachEvent("onpropertychange",Zh),nr=tr=null)}function Zh(e){if(e.propertyName==="value"&&Rl(nr)){var n=[];Hh(n,nr,e,Gd(e)),Ah(qk,n)}}function Gk(e,n,a){e==="focusin"?(Fh(),tr=n,nr=a,tr.attachEvent("onpropertychange",Zh)):e==="focusout"&&Fh()}function Fk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rl(nr)}function Zk(e,n){if(e==="click")return Rl(n)}function Kk(e,n){if(e==="input"||e==="change")return Rl(n)}function Yk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var wn=typeof Object.is=="function"?Object.is:Yk;function sr(e,n){if(wn(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(!sn.call(n,f)||!wn(e[f],n[f]))return!1}return!0}function Kh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Yh(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 Jh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Jh(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=jl(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=jl(e.document)}return n}function nu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var Jk=Is&&"documentMode"in document&&11>=document.documentMode,Ji=null,su=null,ar=null,au=!1;function Xh(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;au||Ji==null||Ji!==jl(l)||(l=Ji,"selectionStart"in l&&nu(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}),ar&&sr(ar,l)||(ar=l,l=xc(su,"onSelect"),0<l.length&&(n=new Al("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=Ji)))}function ii(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Wi={animationend:ii("Animation","AnimationEnd"),animationiteration:ii("Animation","AnimationIteration"),animationstart:ii("Animation","AnimationStart"),transitionrun:ii("Transition","TransitionRun"),transitionstart:ii("Transition","TransitionStart"),transitioncancel:ii("Transition","TransitionCancel"),transitionend:ii("Transition","TransitionEnd")},iu={},Qh={};Is&&(Qh=document.createElement("div").style,"AnimationEvent"in window||(delete Wi.animationend.animation,delete Wi.animationiteration.animation,delete Wi.animationstart.animation),"TransitionEvent"in window||delete Wi.transitionend.transition);function oi(e){if(iu[e])return iu[e];if(!Wi[e])return e;var n=Wi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Qh)return iu[e]=n[a];return e}var eg=oi("animationend"),tg=oi("animationiteration"),ng=oi("animationstart"),Wk=oi("transitionrun"),Xk=oi("transitionstart"),Qk=oi("transitioncancel"),sg=oi("transitionend"),ag=new Map,ou="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(" ");ou.push("scrollEnd");function os(e,n){ag.set(e,n),si(n,[e])}var Ml=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)},Hn=[],Xi=0,ru=0;function Il(){for(var e=Xi,n=ru=Xi=0;n<e;){var a=Hn[n];Hn[n++]=null;var l=Hn[n];Hn[n++]=null;var f=Hn[n];Hn[n++]=null;var h=Hn[n];if(Hn[n++]=null,l!==null&&f!==null){var _=l.pending;_===null?f.next=f:(f.next=_.next,_.next=f),l.pending=f}h!==0&&ig(a,f,h)}}function Ol(e,n,a,l){Hn[Xi++]=e,Hn[Xi++]=n,Hn[Xi++]=a,Hn[Xi++]=l,ru|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function lu(e,n,a,l){return Ol(e,n,a,l),Bl(e)}function ri(e,n){return Ol(e,null,null,n),Bl(e)}function ig(e,n,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,h=e.return;h!==null;)h.childLanes|=a,l=h.alternate,l!==null&&(l.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-Xt(a),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),h):null}function Bl(e){if(50<wr)throw wr=0,yf=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Qi={};function eS(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 Nn(e,n,a,l){return new eS(e,n,a,l)}function cu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Os(e,n){var a=e.alternate;return a===null?(a=Nn(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 og(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 Ll(e,n,a,l,f,h){var _=0;if(l=e,typeof e=="function")cu(e)&&(_=1);else if(typeof e=="string")_=iT(e,a,Pe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case z:return e=Nn(31,a,n,f),e.elementType=z,e.lanes=h,e;case j:return li(a.children,f,h,n);case N:_=8,f|=24;break;case T:return e=Nn(12,a,n,f|2),e.elementType=T,e.lanes=h,e;case E:return e=Nn(13,a,n,f),e.elementType=E,e.lanes=h,e;case D:return e=Nn(19,a,n,f),e.elementType=D,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case A:_=10;break e;case C:_=9;break e;case I:_=11;break e;case P:_=14;break e;case O:_=16,l=null;break e}_=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=Nn(_,a,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function li(e,n,a,l){return e=Nn(7,e,l,n),e.lanes=a,e}function du(e,n,a){return e=Nn(6,e,null,n),e.lanes=a,e}function rg(e){var n=Nn(18,null,null,0);return n.stateNode=e,n}function uu(e,n,a){return n=Nn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var lg=new WeakMap;function Vn(e,n){if(typeof e=="object"&&e!==null){var a=lg.get(e);return a!==void 0?a:(n={value:e,source:n,stack:ze(n)},lg.set(e,n),n)}return{value:e,source:n,stack:ze(n)}}var eo=[],to=0,zl=null,ir=0,qn=[],Gn=0,ma=null,_s=1,ks="";function Bs(e,n){eo[to++]=ir,eo[to++]=zl,zl=e,ir=n}function cg(e,n,a){qn[Gn++]=_s,qn[Gn++]=ks,qn[Gn++]=ma,ma=e;var l=_s;e=ks;var f=32-Xt(l)-1;l&=~(1<<f),a+=1;var h=32-Xt(n)+f;if(30<h){var _=f-f%5;h=(l&(1<<_)-1).toString(32),l>>=_,f-=_,_s=1<<32-Xt(n)+f|a<<f|l,ks=h+e}else _s=1<<h|a<<f|l,ks=e}function fu(e){e.return!==null&&(Bs(e,1),cg(e,1,0))}function pu(e){for(;e===zl;)zl=eo[--to],eo[to]=null,ir=eo[--to],eo[to]=null;for(;e===ma;)ma=qn[--Gn],qn[Gn]=null,ks=qn[--Gn],qn[Gn]=null,_s=qn[--Gn],qn[Gn]=null}function dg(e,n){qn[Gn++]=_s,qn[Gn++]=ks,qn[Gn++]=ma,_s=n.id,ks=n.overflow,ma=e}var an=null,yt=null,Ge=!1,ha=null,Fn=!1,mu=Error(r(519));function ga(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw or(Vn(n,e)),mu}function ug(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[Xe]=e,n[ot]=l,a){case"dialog":Ue("cancel",n),Ue("close",n);break;case"iframe":case"object":case"embed":Ue("load",n);break;case"video":case"audio":for(a=0;a<Cr.length;a++)Ue(Cr[a],n);break;case"source":Ue("error",n);break;case"img":case"image":case"link":Ue("error",n),Ue("load",n);break;case"details":Ue("toggle",n);break;case"input":Ue("invalid",n),Th(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ue("invalid",n);break;case"textarea":Ue("invalid",n),wh(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||C0(n.textContent,a)?(l.popover!=null&&(Ue("beforetoggle",n),Ue("toggle",n)),l.onScroll!=null&&Ue("scroll",n),l.onScrollEnd!=null&&Ue("scrollend",n),l.onClick!=null&&(n.onclick=Ms),n=!0):n=!1,n||ga(e,!0)}function fg(e){for(an=e.return;an;)switch(an.tag){case 5:case 31:case 13:Fn=!1;return;case 27:case 3:Fn=!0;return;default:an=an.return}}function no(e){if(e!==an)return!1;if(!Ge)return fg(e),Ge=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Mf(e.type,e.memoizedProps)),a=!a),a&&yt&&ga(e),fg(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));yt=L0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));yt=L0(e)}else n===27?(n=yt,Aa(e.type)?(e=zf,zf=null,yt=e):yt=n):yt=an?Kn(e.stateNode.nextSibling):null;return!0}function ci(){yt=an=null,Ge=!1}function hu(){var e=ha;return e!==null&&(Tn===null?Tn=e:Tn.push.apply(Tn,e),ha=null),e}function or(e){ha===null?ha=[e]:ha.push(e)}var gu=ee(null),di=null,Ls=null;function va(e,n,a){Ce(gu,n._currentValue),n._currentValue=a}function zs(e){e._currentValue=gu.current,ue(gu)}function vu(e,n,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===a)break;e=e.return}}function yu(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var _=f.child;h=h.firstContext;e:for(;h!==null;){var w=h;h=f;for(var R=0;R<n.length;R++)if(w.context===n[R]){h.lanes|=a,w=h.alternate,w!==null&&(w.lanes|=a),vu(h.return,a,e),l||(_=null);break e}h=w.next}}else if(f.tag===18){if(_=f.return,_===null)throw Error(r(341));_.lanes|=a,h=_.alternate,h!==null&&(h.lanes|=a),vu(_,a,e),_=null}else _=f.child;if(_!==null)_.return=f;else for(_=f;_!==null;){if(_===e){_=null;break}if(f=_.sibling,f!==null){f.return=_.return,_=f;break}_=_.return}f=_}}function so(e,n,a,l){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var _=f.alternate;if(_===null)throw Error(r(387));if(_=_.memoizedProps,_!==null){var w=f.type;wn(f.pendingProps.value,_.value)||(e!==null?e.push(w):e=[w])}}else if(f===xe.current){if(_=f.alternate,_===null)throw Error(r(387));_.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Mr):e=[Mr])}f=f.return}e!==null&&yu(n,e,a,l),n.flags|=262144}function $l(e){for(e=e.firstContext;e!==null;){if(!wn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ui(e){di=e,Ls=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function on(e){return pg(di,e)}function Ul(e,n){return di===null&&ui(e),pg(e,n)}function pg(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Ls===null){if(e===null)throw Error(r(308));Ls=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Ls=Ls.next=n;return a}var tS=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()})}},nS=t.unstable_scheduleCallback,sS=t.unstable_NormalPriority,Ht={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bu(){return{controller:new tS,data:new Map,refCount:0}}function rr(e){e.refCount--,e.refCount===0&&nS(sS,function(){e.controller.abort()})}var lr=null,xu=0,ao=0,io=null;function aS(e,n){if(lr===null){var a=lr=[];xu=0,ao=Tf(),io={status:"pending",value:void 0,then:function(l){a.push(l)}}}return xu++,n.then(mg,mg),n}function mg(){if(--xu===0&&lr!==null){io!==null&&(io.status="fulfilled");var e=lr;lr=null,ao=0,io=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function iS(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 hg=B.S;B.S=function(e,n){Xv=Jt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&aS(e,n),hg!==null&&hg(e,n)};var fi=ee(null);function _u(){var e=fi.current;return e!==null?e:gt.pooledCache}function Pl(e,n){n===null?Ce(fi,fi.current):Ce(fi,n.pool)}function gg(){var e=_u();return e===null?null:{parent:Ht._currentValue,pool:e}}var oo=Error(r(460)),ku=Error(r(474)),Hl=Error(r(542)),Vl={then:function(){}};function vg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function yg(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(Ms,Ms),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,xg(e),e;default:if(typeof n.status=="string")n.then(Ms,Ms);else{if(e=gt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(l){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=l}},function(l){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,xg(e),e}throw mi=n,oo}}function pi(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(mi=a,oo):a}}var mi=null;function bg(){if(mi===null)throw Error(r(459));var e=mi;return mi=null,e}function xg(e){if(e===oo||e===Hl)throw Error(r(483))}var ro=null,cr=0;function ql(e){var n=cr;return cr+=1,ro===null&&(ro=[]),yg(ro,e,n)}function dr(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Gl(e,n){throw n.$$typeof===y?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function _g(e){function n(U,L){if(e){var V=U.deletions;V===null?(U.deletions=[L],U.flags|=16):V.push(L)}}function a(U,L){if(!e)return null;for(;L!==null;)n(U,L),L=L.sibling;return null}function l(U){for(var L=new Map;U!==null;)U.key!==null?L.set(U.key,U):L.set(U.index,U),U=U.sibling;return L}function f(U,L){return U=Os(U,L),U.index=0,U.sibling=null,U}function h(U,L,V){return U.index=V,e?(V=U.alternate,V!==null?(V=V.index,V<L?(U.flags|=67108866,L):V):(U.flags|=67108866,L)):(U.flags|=1048576,L)}function _(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function w(U,L,V,ie){return L===null||L.tag!==6?(L=du(V,U.mode,ie),L.return=U,L):(L=f(L,V),L.return=U,L)}function R(U,L,V,ie){var we=V.type;return we===j?ne(U,L,V.props.children,ie,V.key):L!==null&&(L.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===O&&pi(we)===L.type)?(L=f(L,V.props),dr(L,V),L.return=U,L):(L=Ll(V.type,V.key,V.props,null,U.mode,ie),dr(L,V),L.return=U,L)}function q(U,L,V,ie){return L===null||L.tag!==4||L.stateNode.containerInfo!==V.containerInfo||L.stateNode.implementation!==V.implementation?(L=uu(V,U.mode,ie),L.return=U,L):(L=f(L,V.children||[]),L.return=U,L)}function ne(U,L,V,ie,we){return L===null||L.tag!==7?(L=li(V,U.mode,ie,we),L.return=U,L):(L=f(L,V),L.return=U,L)}function oe(U,L,V){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=du(""+L,U.mode,V),L.return=U,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case S:return V=Ll(L.type,L.key,L.props,null,U.mode,V),dr(V,L),V.return=U,V;case k:return L=uu(L,U.mode,V),L.return=U,L;case O:return L=pi(L),oe(U,L,V)}if(X(L)||J(L))return L=li(L,U.mode,V,null),L.return=U,L;if(typeof L.then=="function")return oe(U,ql(L),V);if(L.$$typeof===A)return oe(U,Ul(U,L),V);Gl(U,L)}return null}function G(U,L,V,ie){var we=L!==null?L.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return we!==null?null:w(U,L,""+V,ie);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return V.key===we?R(U,L,V,ie):null;case k:return V.key===we?q(U,L,V,ie):null;case O:return V=pi(V),G(U,L,V,ie)}if(X(V)||J(V))return we!==null?null:ne(U,L,V,ie,null);if(typeof V.then=="function")return G(U,L,ql(V),ie);if(V.$$typeof===A)return G(U,L,Ul(U,V),ie);Gl(U,V)}return null}function K(U,L,V,ie,we){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return U=U.get(V)||null,w(L,U,""+ie,we);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case S:return U=U.get(ie.key===null?V:ie.key)||null,R(L,U,ie,we);case k:return U=U.get(ie.key===null?V:ie.key)||null,q(L,U,ie,we);case O:return ie=pi(ie),K(U,L,V,ie,we)}if(X(ie)||J(ie))return U=U.get(V)||null,ne(L,U,ie,we,null);if(typeof ie.then=="function")return K(U,L,V,ql(ie),we);if(ie.$$typeof===A)return K(U,L,V,Ul(L,ie),we);Gl(L,ie)}return null}function be(U,L,V,ie){for(var we=null,et=null,ke=L,Oe=L=0,Ve=null;ke!==null&&Oe<V.length;Oe++){ke.index>Oe?(Ve=ke,ke=null):Ve=ke.sibling;var tt=G(U,ke,V[Oe],ie);if(tt===null){ke===null&&(ke=Ve);break}e&&ke&&tt.alternate===null&&n(U,ke),L=h(tt,L,Oe),et===null?we=tt:et.sibling=tt,et=tt,ke=Ve}if(Oe===V.length)return a(U,ke),Ge&&Bs(U,Oe),we;if(ke===null){for(;Oe<V.length;Oe++)ke=oe(U,V[Oe],ie),ke!==null&&(L=h(ke,L,Oe),et===null?we=ke:et.sibling=ke,et=ke);return Ge&&Bs(U,Oe),we}for(ke=l(ke);Oe<V.length;Oe++)Ve=K(ke,U,Oe,V[Oe],ie),Ve!==null&&(e&&Ve.alternate!==null&&ke.delete(Ve.key===null?Oe:Ve.key),L=h(Ve,L,Oe),et===null?we=Ve:et.sibling=Ve,et=Ve);return e&&ke.forEach(function(Oa){return n(U,Oa)}),Ge&&Bs(U,Oe),we}function Ee(U,L,V,ie){if(V==null)throw Error(r(151));for(var we=null,et=null,ke=L,Oe=L=0,Ve=null,tt=V.next();ke!==null&&!tt.done;Oe++,tt=V.next()){ke.index>Oe?(Ve=ke,ke=null):Ve=ke.sibling;var Oa=G(U,ke,tt.value,ie);if(Oa===null){ke===null&&(ke=Ve);break}e&&ke&&Oa.alternate===null&&n(U,ke),L=h(Oa,L,Oe),et===null?we=Oa:et.sibling=Oa,et=Oa,ke=Ve}if(tt.done)return a(U,ke),Ge&&Bs(U,Oe),we;if(ke===null){for(;!tt.done;Oe++,tt=V.next())tt=oe(U,tt.value,ie),tt!==null&&(L=h(tt,L,Oe),et===null?we=tt:et.sibling=tt,et=tt);return Ge&&Bs(U,Oe),we}for(ke=l(ke);!tt.done;Oe++,tt=V.next())tt=K(ke,U,Oe,tt.value,ie),tt!==null&&(e&&tt.alternate!==null&&ke.delete(tt.key===null?Oe:tt.key),L=h(tt,L,Oe),et===null?we=tt:et.sibling=tt,et=tt);return e&&ke.forEach(function(gT){return n(U,gT)}),Ge&&Bs(U,Oe),we}function pt(U,L,V,ie){if(typeof V=="object"&&V!==null&&V.type===j&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case S:e:{for(var we=V.key;L!==null;){if(L.key===we){if(we=V.type,we===j){if(L.tag===7){a(U,L.sibling),ie=f(L,V.props.children),ie.return=U,U=ie;break e}}else if(L.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===O&&pi(we)===L.type){a(U,L.sibling),ie=f(L,V.props),dr(ie,V),ie.return=U,U=ie;break e}a(U,L);break}else n(U,L);L=L.sibling}V.type===j?(ie=li(V.props.children,U.mode,ie,V.key),ie.return=U,U=ie):(ie=Ll(V.type,V.key,V.props,null,U.mode,ie),dr(ie,V),ie.return=U,U=ie)}return _(U);case k:e:{for(we=V.key;L!==null;){if(L.key===we)if(L.tag===4&&L.stateNode.containerInfo===V.containerInfo&&L.stateNode.implementation===V.implementation){a(U,L.sibling),ie=f(L,V.children||[]),ie.return=U,U=ie;break e}else{a(U,L);break}else n(U,L);L=L.sibling}ie=uu(V,U.mode,ie),ie.return=U,U=ie}return _(U);case O:return V=pi(V),pt(U,L,V,ie)}if(X(V))return be(U,L,V,ie);if(J(V)){if(we=J(V),typeof we!="function")throw Error(r(150));return V=we.call(V),Ee(U,L,V,ie)}if(typeof V.then=="function")return pt(U,L,ql(V),ie);if(V.$$typeof===A)return pt(U,L,Ul(U,V),ie);Gl(U,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,L!==null&&L.tag===6?(a(U,L.sibling),ie=f(L,V),ie.return=U,U=ie):(a(U,L),ie=du(V,U.mode,ie),ie.return=U,U=ie),_(U)):a(U,L)}return function(U,L,V,ie){try{cr=0;var we=pt(U,L,V,ie);return ro=null,we}catch(ke){if(ke===oo||ke===Hl)throw ke;var et=Nn(29,ke,null,U.mode);return et.lanes=ie,et.return=U,et}finally{}}}var hi=_g(!0),kg=_g(!1),ya=!1;function Su(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Tu(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 ba(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xa(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(at&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=Bl(e),ig(e,null,a),n}return Ol(e,l,n,a),Bl(e)}function ur(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,he(e,a)}}function ju(e,n){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var _={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?f=h=_:h=h.next=_,a=a.next}while(a!==null);h===null?f=h=n:h=h.next=n}else f=h=n;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var wu=!1;function fr(){if(wu){var e=io;if(e!==null)throw e}}function pr(e,n,a,l){wu=!1;var f=e.updateQueue;ya=!1;var h=f.firstBaseUpdate,_=f.lastBaseUpdate,w=f.shared.pending;if(w!==null){f.shared.pending=null;var R=w,q=R.next;R.next=null,_===null?h=q:_.next=q,_=R;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,w=ne.lastBaseUpdate,w!==_&&(w===null?ne.firstBaseUpdate=q:w.next=q,ne.lastBaseUpdate=R))}if(h!==null){var oe=f.baseState;_=0,ne=q=R=null,w=h;do{var G=w.lane&-536870913,K=G!==w.lane;if(K?(He&G)===G:(l&G)===G){G!==0&&G===ao&&(wu=!0),ne!==null&&(ne=ne.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var be=e,Ee=w;G=n;var pt=a;switch(Ee.tag){case 1:if(be=Ee.payload,typeof be=="function"){oe=be.call(pt,oe,G);break e}oe=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ee.payload,G=typeof be=="function"?be.call(pt,oe,G):be,G==null)break e;oe=b({},oe,G);break e;case 2:ya=!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},ne===null?(q=ne=K,R=oe):ne=ne.next=K,_|=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);ne===null&&(R=oe),f.baseState=R,f.firstBaseUpdate=q,f.lastBaseUpdate=ne,h===null&&(f.shared.lanes=0),ja|=_,e.lanes=_,e.memoizedState=oe}}function Sg(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function Tg(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Sg(a[e],n)}var lo=ee(null),Fl=ee(0);function jg(e,n){e=Zs,Ce(Fl,e),Ce(lo,n),Zs=e|n.baseLanes}function Nu(){Ce(Fl,Zs),Ce(lo,lo.current)}function Cu(){Zs=Fl.current,ue(lo),ue(Fl)}var Cn=ee(null),Zn=null;function _a(e){var n=e.alternate;Ce(Lt,Lt.current&1),Ce(Cn,e),Zn===null&&(n===null||lo.current!==null||n.memoizedState!==null)&&(Zn=e)}function Eu(e){Ce(Lt,Lt.current),Ce(Cn,e),Zn===null&&(Zn=e)}function wg(e){e.tag===22?(Ce(Lt,Lt.current),Ce(Cn,e),Zn===null&&(Zn=e)):ka()}function ka(){Ce(Lt,Lt.current),Ce(Cn,Cn.current)}function En(e){ue(Cn),Zn===e&&(Zn=null),ue(Lt)}var Lt=ee(0);function Zl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Bf(a)||Lf(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 $s=0,Ie=null,ut=null,Vt=null,Kl=!1,co=!1,gi=!1,Yl=0,mr=0,uo=null,oS=0;function Ct(){throw Error(r(321))}function Au(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!wn(e[a],n[a]))return!1;return!0}function Du(e,n,a,l,f,h){return $s=h,Ie=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,B.H=e===null||e.memoizedState===null?cv:Fu,gi=!1,h=a(l,f),gi=!1,co&&(h=Cg(n,a,l,f)),Ng(e),h}function Ng(e){B.H=vr;var n=ut!==null&&ut.next!==null;if($s=0,Vt=ut=Ie=null,Kl=!1,mr=0,uo=null,n)throw Error(r(300));e===null||qt||(e=e.dependencies,e!==null&&$l(e)&&(qt=!0))}function Cg(e,n,a,l){Ie=e;var f=0;do{if(co&&(uo=null),mr=0,co=!1,25<=f)throw Error(r(301));if(f+=1,Vt=ut=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}B.H=dv,h=n(a,l)}while(co);return h}function rS(){var e=B.H,n=e.useState()[0];return n=typeof n.then=="function"?hr(n):n,e=e.useState()[0],(ut!==null?ut.memoizedState:null)!==e&&(Ie.flags|=1024),n}function Ru(){var e=Yl!==0;return Yl=0,e}function Mu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Iu(e){if(Kl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Kl=!1}$s=0,Vt=ut=Ie=null,co=!1,mr=Yl=0,uo=null}function hn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?Ie.memoizedState=Vt=e:Vt=Vt.next=e,Vt}function zt(){if(ut===null){var e=Ie.alternate;e=e!==null?e.memoizedState:null}else e=ut.next;var n=Vt===null?Ie.memoizedState:Vt.next;if(n!==null)Vt=n,ut=e;else{if(e===null)throw Ie.alternate===null?Error(r(467)):Error(r(310));ut=e,e={memoizedState:ut.memoizedState,baseState:ut.baseState,baseQueue:ut.baseQueue,queue:ut.queue,next:null},Vt===null?Ie.memoizedState=Vt=e:Vt=Vt.next=e}return Vt}function Jl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function hr(e){var n=mr;return mr+=1,uo===null&&(uo=[]),e=yg(uo,e,n),n=Ie,(Vt===null?n.memoizedState:Vt.next)===null&&(n=n.alternate,B.H=n===null||n.memoizedState===null?cv:Fu),e}function Wl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return hr(e);if(e.$$typeof===A)return on(e)}throw Error(r(438,String(e)))}function Ou(e){var n=null,a=Ie.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=Ie.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=Jl(),Ie.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]=Q;return n.index++,a}function Us(e,n){return typeof n=="function"?n(e):n}function Xl(e){var n=zt();return Bu(n,ut,e)}function Bu(e,n,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var _=f.next;f.next=h.next,h.next=_}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var w=_=null,R=null,q=n,ne=!1;do{var oe=q.lane&-536870913;if(oe!==q.lane?(He&oe)===oe:($s&oe)===oe){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}),oe===ao&&(ne=!0);else if(($s&G)===G){q=q.next,G===ao&&(ne=!0);continue}else oe={lane:0,revertLane:q.revertLane,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},R===null?(w=R=oe,_=h):R=R.next=oe,Ie.lanes|=G,ja|=G;oe=q.action,gi&&a(h,oe),h=q.hasEagerState?q.eagerState:a(h,oe)}else G={lane:oe,revertLane:q.revertLane,gesture:q.gesture,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},R===null?(w=R=G,_=h):R=R.next=G,Ie.lanes|=oe,ja|=oe;q=q.next}while(q!==null&&q!==n);if(R===null?_=h:R.next=w,!wn(h,e.memoizedState)&&(qt=!0,ne&&(a=io,a!==null)))throw a;e.memoizedState=h,e.baseState=_,e.baseQueue=R,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Lu(e){var n=zt(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,h=n.memoizedState;if(f!==null){a.pending=null;var _=f=f.next;do h=e(h,_.action),_=_.next;while(_!==f);wn(h,n.memoizedState)||(qt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,l]}function Eg(e,n,a){var l=Ie,f=zt(),h=Ge;if(h){if(a===void 0)throw Error(r(407));a=a()}else a=n();var _=!wn((ut||f).memoizedState,a);if(_&&(f.memoizedState=a,qt=!0),f=f.queue,Uu(Rg.bind(null,l,f,e),[e]),f.getSnapshot!==n||_||Vt!==null&&Vt.memoizedState.tag&1){if(l.flags|=2048,fo(9,{destroy:void 0},Dg.bind(null,l,f,a,n),null),gt===null)throw Error(r(349));h||($s&127)!==0||Ag(l,n,a)}return a}function Ag(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ie.updateQueue,n===null?(n=Jl(),Ie.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Dg(e,n,a,l){n.value=a,n.getSnapshot=l,Mg(n)&&Ig(e)}function Rg(e,n,a){return a(function(){Mg(n)&&Ig(e)})}function Mg(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!wn(e,a)}catch{return!0}}function Ig(e){var n=ri(e,2);n!==null&&jn(n,e,2)}function zu(e){var n=hn();if(typeof e=="function"){var a=e;if(e=a(),gi){mn(!0);try{a()}finally{mn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Us,lastRenderedState:e},n}function Og(e,n,a,l){return e.baseState=a,Bu(e,ut,typeof l=="function"?l:Us)}function lS(e,n,a,l,f){if(tc(e))throw Error(r(485));if(e=n.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){h.listeners.push(_)}};B.T!==null?a(!0):h.isTransition=!1,l(h),a=n.pending,a===null?(h.next=n.pending=h,Bg(n,h)):(h.next=a.next,n.pending=a.next=h)}}function Bg(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=B.T,_={};B.T=_;try{var w=a(f,l),R=B.S;R!==null&&R(_,w),Lg(e,n,w)}catch(q){$u(e,n,q)}finally{h!==null&&_.types!==null&&(h.types=_.types),B.T=h}}else try{h=a(f,l),Lg(e,n,h)}catch(q){$u(e,n,q)}}function Lg(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){zg(e,n,l)},function(l){return $u(e,n,l)}):zg(e,n,a)}function zg(e,n,a){n.status="fulfilled",n.value=a,$g(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Bg(e,a)))}function $u(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,$g(n),n=n.next;while(n!==l)}e.action=null}function $g(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Ug(e,n){return n}function Pg(e,n){if(Ge){var a=gt.formState;if(a!==null){e:{var l=Ie;if(Ge){if(yt){t:{for(var f=yt,h=Fn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Kn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){yt=Kn(f.nextSibling),l=f.data==="F!";break e}}ga(l)}l=!1}l&&(n=a[0])}}return a=hn(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ug,lastRenderedState:n},a.queue=l,a=ov.bind(null,Ie,l),l.dispatch=a,l=zu(!1),h=Gu.bind(null,Ie,!1,l.queue),l=hn(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=lS.bind(null,Ie,f,h,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function Hg(e){var n=zt();return Vg(n,ut,e)}function Vg(e,n,a){if(n=Bu(e,n,Ug)[0],e=Xl(Us)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=hr(n)}catch(_){throw _===oo?Hl:_}else l=n;n=zt();var f=n.queue,h=f.dispatch;return a!==n.memoizedState&&(Ie.flags|=2048,fo(9,{destroy:void 0},cS.bind(null,f,a),null)),[l,h,e]}function cS(e,n){e.action=n}function qg(e){var n=zt(),a=ut;if(a!==null)return Vg(n,a,e);zt(),n=n.memoizedState,a=zt();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function fo(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=Ie.updateQueue,n===null&&(n=Jl(),Ie.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 Gg(){return zt().memoizedState}function Ql(e,n,a,l){var f=hn();Ie.flags|=e,f.memoizedState=fo(1|n,{destroy:void 0},a,l===void 0?null:l)}function ec(e,n,a,l){var f=zt();l=l===void 0?null:l;var h=f.memoizedState.inst;ut!==null&&l!==null&&Au(l,ut.memoizedState.deps)?f.memoizedState=fo(n,h,a,l):(Ie.flags|=e,f.memoizedState=fo(1|n,h,a,l))}function Fg(e,n){Ql(8390656,8,e,n)}function Uu(e,n){ec(2048,8,e,n)}function dS(e){Ie.flags|=4;var n=Ie.updateQueue;if(n===null)n=Jl(),Ie.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Zg(e){var n=zt().memoizedState;return dS({ref:n,nextImpl:e}),function(){if((at&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Kg(e,n){return ec(4,2,e,n)}function Yg(e,n){return ec(4,4,e,n)}function Jg(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,ec(4,4,Jg.bind(null,n,e),a)}function Pu(){}function Xg(e,n){var a=zt();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&Au(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Qg(e,n){var a=zt();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&Au(n,l[1]))return l[0];if(l=e(),gi){mn(!0);try{e()}finally{mn(!1)}}return a.memoizedState=[l,n],l}function Hu(e,n,a){return a===void 0||($s&1073741824)!==0&&(He&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=e0(),Ie.lanes|=e,ja|=e,a)}function ev(e,n,a,l){return wn(a,n)?a:lo.current!==null?(e=Hu(e,a,l),wn(e,n)||(qt=!0),e):($s&42)===0||($s&1073741824)!==0&&(He&261930)===0?(qt=!0,e.memoizedState=a):(e=e0(),Ie.lanes|=e,ja|=e,n)}function tv(e,n,a,l,f){var h=F.p;F.p=h!==0&&8>h?h:8;var _=B.T,w={};B.T=w,Gu(e,!1,n,a);try{var R=f(),q=B.S;if(q!==null&&q(w,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var ne=iS(R,l);gr(e,n,ne,Rn(e))}else gr(e,n,l,Rn(e))}catch(oe){gr(e,n,{then:function(){},status:"rejected",reason:oe},Rn())}finally{F.p=h,_!==null&&w.types!==null&&(_.types=w.types),B.T=_}}function uS(){}function Vu(e,n,a,l){if(e.tag!==5)throw Error(r(476));var f=nv(e).queue;tv(e,f,n,Z,a===null?uS:function(){return sv(e),a(l)})}function nv(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Us,lastRenderedState:Z},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Us,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function sv(e){var n=nv(e);n.next===null&&(n=e.alternate.memoizedState),gr(e,n.next.queue,{},Rn())}function qu(){return on(Mr)}function av(){return zt().memoizedState}function iv(){return zt().memoizedState}function fS(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Rn();e=ba(a);var l=xa(n,e,a);l!==null&&(jn(l,n,a),ur(l,n,a)),n={cache:bu()},e.payload=n;return}n=n.return}}function pS(e,n,a){var l=Rn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},tc(e)?rv(n,a):(a=lu(e,n,a,l),a!==null&&(jn(a,e,l),lv(a,n,l)))}function ov(e,n,a){var l=Rn();gr(e,n,a,l)}function gr(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(tc(e))rv(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var _=n.lastRenderedState,w=h(_,a);if(f.hasEagerState=!0,f.eagerState=w,wn(w,_))return Ol(e,n,f,0),gt===null&&Il(),!1}catch{}finally{}if(a=lu(e,n,f,l),a!==null)return jn(a,e,l),lv(a,n,l),!0}return!1}function Gu(e,n,a,l){if(l={lane:2,revertLane:Tf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},tc(e)){if(n)throw Error(r(479))}else n=lu(e,a,l,2),n!==null&&jn(n,e,2)}function tc(e){var n=e.alternate;return e===Ie||n!==null&&n===Ie}function rv(e,n){co=Kl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function lv(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,he(e,a)}}var vr={readContext:on,use:Wl,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};vr.useEffectEvent=Ct;var cv={readContext:on,use:Wl,useCallback:function(e,n){return hn().memoizedState=[e,n===void 0?null:n],e},useContext:on,useEffect:Fg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Ql(4194308,4,Jg.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Ql(4194308,4,e,n)},useInsertionEffect:function(e,n){Ql(4,2,e,n)},useMemo:function(e,n){var a=hn();n=n===void 0?null:n;var l=e();if(gi){mn(!0);try{e()}finally{mn(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=hn();if(a!==void 0){var f=a(n);if(gi){mn(!0);try{a(n)}finally{mn(!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=pS.bind(null,Ie,e),[l.memoizedState,e]},useRef:function(e){var n=hn();return e={current:e},n.memoizedState=e},useState:function(e){e=zu(e);var n=e.queue,a=ov.bind(null,Ie,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Pu,useDeferredValue:function(e,n){var a=hn();return Hu(a,e,n)},useTransition:function(){var e=zu(!1);return e=tv.bind(null,Ie,e.queue,!0,!1),hn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=Ie,f=hn();if(Ge){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),gt===null)throw Error(r(349));(He&127)!==0||Ag(l,n,a)}f.memoizedState=a;var h={value:a,getSnapshot:n};return f.queue=h,Fg(Rg.bind(null,l,h,e),[e]),l.flags|=2048,fo(9,{destroy:void 0},Dg.bind(null,l,h,a,n),null),a},useId:function(){var e=hn(),n=gt.identifierPrefix;if(Ge){var a=ks,l=_s;a=(l&~(1<<32-Xt(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Yl++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=oS++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:qu,useFormState:Pg,useActionState:Pg,useOptimistic:function(e){var n=hn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Gu.bind(null,Ie,!0,a),a.dispatch=n,[e,n]},useMemoCache:Ou,useCacheRefresh:function(){return hn().memoizedState=fS.bind(null,Ie)},useEffectEvent:function(e){var n=hn(),a={impl:e};return n.memoizedState=a,function(){if((at&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Fu={readContext:on,use:Wl,useCallback:Xg,useContext:on,useEffect:Uu,useImperativeHandle:Wg,useInsertionEffect:Kg,useLayoutEffect:Yg,useMemo:Qg,useReducer:Xl,useRef:Gg,useState:function(){return Xl(Us)},useDebugValue:Pu,useDeferredValue:function(e,n){var a=zt();return ev(a,ut.memoizedState,e,n)},useTransition:function(){var e=Xl(Us)[0],n=zt().memoizedState;return[typeof e=="boolean"?e:hr(e),n]},useSyncExternalStore:Eg,useId:av,useHostTransitionStatus:qu,useFormState:Hg,useActionState:Hg,useOptimistic:function(e,n){var a=zt();return Og(a,ut,e,n)},useMemoCache:Ou,useCacheRefresh:iv};Fu.useEffectEvent=Zg;var dv={readContext:on,use:Wl,useCallback:Xg,useContext:on,useEffect:Uu,useImperativeHandle:Wg,useInsertionEffect:Kg,useLayoutEffect:Yg,useMemo:Qg,useReducer:Lu,useRef:Gg,useState:function(){return Lu(Us)},useDebugValue:Pu,useDeferredValue:function(e,n){var a=zt();return ut===null?Hu(a,e,n):ev(a,ut.memoizedState,e,n)},useTransition:function(){var e=Lu(Us)[0],n=zt().memoizedState;return[typeof e=="boolean"?e:hr(e),n]},useSyncExternalStore:Eg,useId:av,useHostTransitionStatus:qu,useFormState:qg,useActionState:qg,useOptimistic:function(e,n){var a=zt();return ut!==null?Og(a,ut,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Ou,useCacheRefresh:iv};dv.useEffectEvent=Zg;function Zu(e,n,a,l){n=e.memoizedState,a=a(l,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Ku={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=Rn(),f=ba(l);f.payload=n,a!=null&&(f.callback=a),n=xa(e,f,l),n!==null&&(jn(n,e,l),ur(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=Rn(),f=ba(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=xa(e,f,l),n!==null&&(jn(n,e,l),ur(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Rn(),l=ba(a);l.tag=2,n!=null&&(l.callback=n),n=xa(e,l,a),n!==null&&(jn(n,e,a),ur(n,e,a))}};function uv(e,n,a,l,f,h,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,_):n.prototype&&n.prototype.isPureReactComponent?!sr(a,l)||!sr(f,h):!0}function fv(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&&Ku.enqueueReplaceState(n,n.state,null)}function vi(e,n){var a=n;if("ref"in n){a={};for(var l in n)l!=="ref"&&(a[l]=n[l])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function pv(e){Ml(e)}function mv(e){console.error(e)}function hv(e){Ml(e)}function nc(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function gv(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 Yu(e,n,a){return a=ba(a),a.tag=3,a.payload={element:null},a.callback=function(){nc(e,n)},a}function vv(e){return e=ba(e),e.tag=3,e}function yv(e,n,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var h=l.value;e.payload=function(){return f(h)},e.callback=function(){gv(n,a,l)}}var _=a.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){gv(n,a,l),typeof f!="function"&&(wa===null?wa=new Set([this]):wa.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function mS(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&so(n,a,f,!0),a=Cn.current,a!==null){switch(a.tag){case 31:case 13:return Zn===null?mc():a.alternate===null&&Et===0&&(Et=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Vl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),_f(e,l,f)),!1;case 22:return a.flags|=65536,l===Vl?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)),_f(e,l,f)),!1}throw Error(r(435,a.tag))}return _f(e,l,f),mc(),!1}if(Ge)return n=Cn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==mu&&(e=Error(r(422),{cause:l}),or(Vn(e,a)))):(l!==mu&&(n=Error(r(423),{cause:l}),or(Vn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Vn(l,a),f=Yu(e.stateNode,l,f),ju(e,f),Et!==4&&(Et=2)),!1;var h=Error(r(520),{cause:l});if(h=Vn(h,a),jr===null?jr=[h]:jr.push(h),Et!==4&&(Et=2),n===null)return!0;l=Vn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Yu(a.stateNode,l,e),ju(a,e),!1;case 1:if(n=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(wa===null||!wa.has(h))))return a.flags|=65536,f&=-f,a.lanes|=f,f=vv(f),yv(f,e,a,l),ju(a,f),!1}a=a.return}while(a!==null);return!1}var Ju=Error(r(461)),qt=!1;function rn(e,n,a,l){n.child=e===null?kg(n,null,a,l):hi(n,e.child,a,l)}function bv(e,n,a,l,f){a=a.render;var h=n.ref;if("ref"in l){var _={};for(var w in l)w!=="ref"&&(_[w]=l[w])}else _=l;return ui(n),l=Du(e,n,a,_,h,f),w=Ru(),e!==null&&!qt?(Mu(e,n,f),Ps(e,n,f)):(Ge&&w&&fu(n),n.flags|=1,rn(e,n,l,f),n.child)}function xv(e,n,a,l,f){if(e===null){var h=a.type;return typeof h=="function"&&!cu(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,_v(e,n,h,l,f)):(e=Ll(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!af(e,f)){var _=h.memoizedProps;if(a=a.compare,a=a!==null?a:sr,a(_,l)&&e.ref===n.ref)return Ps(e,n,f)}return n.flags|=1,e=Os(h,l),e.ref=n.ref,e.return=n,n.child=e}function _v(e,n,a,l,f){if(e!==null){var h=e.memoizedProps;if(sr(h,l)&&e.ref===n.ref)if(qt=!1,n.pendingProps=l=h,af(e,f))(e.flags&131072)!==0&&(qt=!0);else return n.lanes=e.lanes,Ps(e,n,f)}return Wu(e,n,a,l,f)}function kv(e,n,a,l){var f=l.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|a:a,e!==null){for(l=n.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~h}else l=0,n.child=null;return Sv(e,n,h,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Pl(n,h!==null?h.cachePool:null),h!==null?jg(n,h):Nu(),wg(n);else return l=n.lanes=536870912,Sv(e,n,h!==null?h.baseLanes|a:a,a,l)}else h!==null?(Pl(n,h.cachePool),jg(n,h),ka(),n.memoizedState=null):(e!==null&&Pl(n,null),Nu(),ka());return rn(e,n,f,a),n.child}function yr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Sv(e,n,a,l,f){var h=_u();return h=h===null?null:{parent:Ht._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&Pl(n,null),Nu(),wg(n),e!==null&&so(e,n,l,!0),n.childLanes=f,null}function sc(e,n){return n=ic({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Tv(e,n,a){return hi(n,e.child,null,a),e=sc(n,n.pendingProps),e.flags|=2,En(n),n.memoizedState=null,e}function hS(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ge){if(l.mode==="hidden")return e=sc(n,l),n.lanes=536870912,yr(null,e);if(Eu(n),(e=yt)?(e=B0(e,Fn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ma!==null?{id:_s,overflow:ks}:null,retryLane:536870912,hydrationErrors:null},a=rg(e),a.return=n,n.child=a,an=n,yt=null)):e=null,e===null)throw ga(n);return n.lanes=536870912,null}return sc(n,l)}var h=e.memoizedState;if(h!==null){var _=h.dehydrated;if(Eu(n),f)if(n.flags&256)n.flags&=-257,n=Tv(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(qt||so(e,n,a,!1),f=(a&e.childLanes)!==0,qt||f){if(l=gt,l!==null&&(_=qe(l,a),_!==0&&_!==h.retryLane))throw h.retryLane=_,ri(e,_),jn(l,e,_),Ju;mc(),n=Tv(e,n,a)}else e=h.treeContext,yt=Kn(_.nextSibling),an=n,Ge=!0,ha=null,Fn=!1,e!==null&&dg(n,e),n=sc(n,l),n.flags|=4096;return n}return e=Os(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function ac(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Wu(e,n,a,l,f){return ui(n),a=Du(e,n,a,l,void 0,f),l=Ru(),e!==null&&!qt?(Mu(e,n,f),Ps(e,n,f)):(Ge&&l&&fu(n),n.flags|=1,rn(e,n,a,f),n.child)}function jv(e,n,a,l,f,h){return ui(n),n.updateQueue=null,a=Cg(n,l,a,f),Ng(e),l=Ru(),e!==null&&!qt?(Mu(e,n,h),Ps(e,n,h)):(Ge&&l&&fu(n),n.flags|=1,rn(e,n,a,h),n.child)}function wv(e,n,a,l,f){if(ui(n),n.stateNode===null){var h=Qi,_=a.contextType;typeof _=="object"&&_!==null&&(h=on(_)),h=new a(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Ku,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},Su(n),_=a.contextType,h.context=typeof _=="object"&&_!==null?on(_):Qi,h.state=n.memoizedState,_=a.getDerivedStateFromProps,typeof _=="function"&&(Zu(n,a,_,l),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(_=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),_!==h.state&&Ku.enqueueReplaceState(h,h.state,null),pr(n,l,h,f),fr(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){h=n.stateNode;var w=n.memoizedProps,R=vi(a,w);h.props=R;var q=h.context,ne=a.contextType;_=Qi,typeof ne=="object"&&ne!==null&&(_=on(ne));var oe=a.getDerivedStateFromProps;ne=typeof oe=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,ne||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||q!==_)&&fv(n,h,l,_),ya=!1;var G=n.memoizedState;h.state=G,pr(n,l,h,f),fr(),q=n.memoizedState,w||G!==q||ya?(typeof oe=="function"&&(Zu(n,a,oe,l),q=n.memoizedState),(R=ya||uv(n,a,R,l,G,q,_))?(ne||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=q),h.props=l,h.state=q,h.context=_,l=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,Tu(e,n),_=n.memoizedProps,ne=vi(a,_),h.props=ne,oe=n.pendingProps,G=h.context,q=a.contextType,R=Qi,typeof q=="object"&&q!==null&&(R=on(q)),w=a.getDerivedStateFromProps,(q=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(_!==oe||G!==R)&&fv(n,h,l,R),ya=!1,G=n.memoizedState,h.state=G,pr(n,l,h,f),fr();var K=n.memoizedState;_!==oe||G!==K||ya||e!==null&&e.dependencies!==null&&$l(e.dependencies)?(typeof w=="function"&&(Zu(n,a,w,l),K=n.memoizedState),(ne=ya||uv(n,a,ne,l,G,K,R)||e!==null&&e.dependencies!==null&&$l(e.dependencies))?(q||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,K,R),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,K,R)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=K),h.props=l,h.state=K,h.context=R,l=ne):(typeof h.componentDidUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,ac(e,n),l=(n.flags&128)!==0,h||l?(h=n.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&l?(n.child=hi(n,e.child,null,f),n.child=hi(n,null,a,f)):rn(e,n,a,f),n.memoizedState=h.state,e=n.child):e=Ps(e,n,f),e}function Nv(e,n,a,l){return ci(),n.flags|=256,rn(e,n,a,l),n.child}var Xu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qu(e){return{baseLanes:e,cachePool:gg()}}function ef(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Dn),e}function Cv(e,n,a){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,_;if((_=h)||(_=e!==null&&e.memoizedState===null?!1:(Lt.current&2)!==0),_&&(f=!0,n.flags&=-129),_=(n.flags&32)!==0,n.flags&=-33,e===null){if(Ge){if(f?_a(n):ka(),(e=yt)?(e=B0(e,Fn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ma!==null?{id:_s,overflow:ks}:null,retryLane:536870912,hydrationErrors:null},a=rg(e),a.return=n,n.child=a,an=n,yt=null)):e=null,e===null)throw ga(n);return Lf(e)?n.lanes=32:n.lanes=536870912,null}var w=l.children;return l=l.fallback,f?(ka(),f=n.mode,w=ic({mode:"hidden",children:w},f),l=li(l,f,a,null),w.return=n,l.return=n,w.sibling=l,n.child=w,l=n.child,l.memoizedState=Qu(a),l.childLanes=ef(e,_,a),n.memoizedState=Xu,yr(null,l)):(_a(n),tf(n,w))}var R=e.memoizedState;if(R!==null&&(w=R.dehydrated,w!==null)){if(h)n.flags&256?(_a(n),n.flags&=-257,n=nf(e,n,a)):n.memoizedState!==null?(ka(),n.child=e.child,n.flags|=128,n=null):(ka(),w=l.fallback,f=n.mode,l=ic({mode:"visible",children:l.children},f),w=li(w,f,a,null),w.flags|=2,l.return=n,w.return=n,l.sibling=w,n.child=l,hi(n,e.child,null,a),l=n.child,l.memoizedState=Qu(a),l.childLanes=ef(e,_,a),n.memoizedState=Xu,n=yr(null,l));else if(_a(n),Lf(w)){if(_=w.nextSibling&&w.nextSibling.dataset,_)var q=_.dgst;_=q,l=Error(r(419)),l.stack="",l.digest=_,or({value:l,source:null,stack:null}),n=nf(e,n,a)}else if(qt||so(e,n,a,!1),_=(a&e.childLanes)!==0,qt||_){if(_=gt,_!==null&&(l=qe(_,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,ri(e,l),jn(_,e,l),Ju;Bf(w)||mc(),n=nf(e,n,a)}else Bf(w)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,yt=Kn(w.nextSibling),an=n,Ge=!0,ha=null,Fn=!1,e!==null&&dg(n,e),n=tf(n,l.children),n.flags|=4096);return n}return f?(ka(),w=l.fallback,f=n.mode,R=e.child,q=R.sibling,l=Os(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,q!==null?w=Os(q,w):(w=li(w,f,a,null),w.flags|=2),w.return=n,l.return=n,l.sibling=w,n.child=l,yr(null,l),l=n.child,w=e.child.memoizedState,w===null?w=Qu(a):(f=w.cachePool,f!==null?(R=Ht._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=gg(),w={baseLanes:w.baseLanes|a,cachePool:f}),l.memoizedState=w,l.childLanes=ef(e,_,a),n.memoizedState=Xu,yr(e.child,l)):(_a(n),a=e.child,e=a.sibling,a=Os(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(_=n.deletions,_===null?(n.deletions=[e],n.flags|=16):_.push(e)),n.child=a,n.memoizedState=null,a)}function tf(e,n){return n=ic({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function ic(e,n){return e=Nn(22,e,null,n),e.lanes=0,e}function nf(e,n,a){return hi(n,e.child,null,a),e=tf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Ev(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),vu(e.return,n,a)}function sf(e,n,a,l,f,h){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:h}:(_.isBackwards=n,_.rendering=null,_.renderingStartTime=0,_.last=l,_.tail=a,_.tailMode=f,_.treeForkCount=h)}function Av(e,n,a){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var _=Lt.current,w=(_&2)!==0;if(w?(_=_&1|2,n.flags|=128):_&=1,Ce(Lt,_),rn(e,n,l,a),l=Ge?ir:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ev(e,a,n);else if(e.tag===19)Ev(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&&Zl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),sf(n,!1,f,a,h,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Zl(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}sf(n,!0,a,null,h,l);break;case"together":sf(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Ps(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),ja|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(so(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,a=Os(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Os(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function af(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&$l(e)))}function gS(e,n,a){switch(n.tag){case 3:Be(n,n.stateNode.containerInfo),va(n,Ht,e.memoizedState.cache),ci();break;case 27:case 5:zn(n);break;case 4:Be(n,n.stateNode.containerInfo);break;case 10:va(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Eu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(_a(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Cv(e,n,a):(_a(n),e=Ps(e,n,a),e!==null?e.sibling:null);_a(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(so(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),Ce(Lt,Lt.current),l)break;return null;case 22:return n.lanes=0,kv(e,n,a,n.pendingProps);case 24:va(n,Ht,e.memoizedState.cache)}return Ps(e,n,a)}function Dv(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)qt=!0;else{if(!af(e,a)&&(n.flags&128)===0)return qt=!1,gS(e,n,a);qt=(e.flags&131072)!==0}else qt=!1,Ge&&(n.flags&1048576)!==0&&cg(n,ir,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=pi(n.elementType),n.type=e,typeof e=="function")cu(e)?(l=vi(e,l),n.tag=1,n=wv(null,n,e,l,a)):(n.tag=0,n=Wu(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===I){n.tag=11,n=bv(null,n,e,l,a);break e}else if(f===P){n.tag=14,n=xv(null,n,e,l,a);break e}}throw n=te(e)||e,Error(r(306,n,""))}}return n;case 0:return Wu(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=vi(l,n.pendingProps),wv(e,n,l,f,a);case 3:e:{if(Be(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var h=n.memoizedState;f=h.element,Tu(e,n),pr(n,l,null,a);var _=n.memoizedState;if(l=_.cache,va(n,Ht,l),l!==h.cache&&yu(n,[Ht],a,!0),fr(),l=_.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:_.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=Nv(e,n,l,a);break e}else if(l!==f){f=Vn(Error(r(424)),n),or(f),n=Nv(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(yt=Kn(e.firstChild),an=n,Ge=!0,ha=null,Fn=!0,a=kg(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ci(),l===f){n=Ps(e,n,a);break e}rn(e,n,l,a)}n=n.child}return n;case 26:return ac(e,n),e===null?(a=H0(n.type,null,n.pendingProps,null))?n.memoizedState=a:Ge||(a=n.type,e=n.pendingProps,l=_c(Se.current).createElement(a),l[Xe]=n,l[ot]=e,ln(l,a,e),Qt(l),n.stateNode=l):n.memoizedState=H0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return zn(n),e===null&&Ge&&(l=n.stateNode=$0(n.type,n.pendingProps,Se.current),an=n,Fn=!0,f=yt,Aa(n.type)?(zf=f,yt=Kn(l.firstChild)):yt=f),rn(e,n,n.pendingProps.children,a),ac(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ge&&((f=l=yt)&&(l=FS(l,n.type,n.pendingProps,Fn),l!==null?(n.stateNode=l,an=n,yt=Kn(l.firstChild),Fn=!1,f=!0):f=!1),f||ga(n)),zn(n),f=n.type,h=n.pendingProps,_=e!==null?e.memoizedProps:null,l=h.children,Mf(f,h)?l=null:_!==null&&Mf(f,_)&&(n.flags|=32),n.memoizedState!==null&&(f=Du(e,n,rS,null,null,a),Mr._currentValue=f),ac(e,n),rn(e,n,l,a),n.child;case 6:return e===null&&Ge&&((e=a=yt)&&(a=ZS(a,n.pendingProps,Fn),a!==null?(n.stateNode=a,an=n,yt=null,e=!0):e=!1),e||ga(n)),null;case 13:return Cv(e,n,a);case 4:return Be(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=hi(n,null,l,a):rn(e,n,l,a),n.child;case 11:return bv(e,n,n.type,n.pendingProps,a);case 7:return rn(e,n,n.pendingProps,a),n.child;case 8:return rn(e,n,n.pendingProps.children,a),n.child;case 12:return rn(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,va(n,n.type,l.value),rn(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,ui(n),f=on(f),l=l(f),n.flags|=1,rn(e,n,l,a),n.child;case 14:return xv(e,n,n.type,n.pendingProps,a);case 15:return _v(e,n,n.type,n.pendingProps,a);case 19:return Av(e,n,a);case 31:return hS(e,n,a);case 22:return kv(e,n,a,n.pendingProps);case 24:return ui(n),l=on(Ht),e===null?(f=_u(),f===null&&(f=gt,h=bu(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=a),f=h),n.memoizedState={parent:l,cache:f},Su(n),va(n,Ht,f)):((e.lanes&a)!==0&&(Tu(e,n),pr(n,null,null,a),fr()),f=e.memoizedState,h=n.memoizedState,f.parent!==l?(f={parent:l,cache:l},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),va(n,Ht,l)):(l=h.cache,va(n,Ht,l),l!==f.cache&&yu(n,[Ht],a,!0))),rn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Hs(e){e.flags|=4}function of(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(a0())e.flags|=8192;else throw mi=Vl,ku}else e.flags&=-16777217}function Rv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Z0(n))if(a0())e.flags|=8192;else throw mi=Vl,ku}function oc(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?kl():536870912,e.lanes|=n,go|=n)}function br(e,n){if(!Ge)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 bt(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 vS(e,n,a){var l=n.pendingProps;switch(pu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bt(n),null;case 1:return bt(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),zs(Ht),It(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(no(n)?Hs(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,hu())),bt(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(Hs(n),h!==null?(bt(n),Rv(n,h)):(bt(n),of(n,f,null,l,a))):h?h!==e.memoizedState?(Hs(n),bt(n),Rv(n,h)):(bt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Hs(n),bt(n),of(n,f,e,l,a)),null;case 27:if(re(n),a=Se.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Hs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return bt(n),null}e=Pe.current,no(n)?ug(n):(e=$0(f,l,a),n.stateNode=e,Hs(n))}return bt(n),null;case 5:if(re(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Hs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return bt(n),null}if(h=Pe.current,no(n))ug(n);else{var _=_c(Se.current);switch(h){case 1:h=_.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=_.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=_.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?_.createElement("select",{is:l.is}):_.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?_.createElement(f,{is:l.is}):_.createElement(f)}}h[Xe]=n,h[ot]=l;e:for(_=n.child;_!==null;){if(_.tag===5||_.tag===6)h.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===n)break e;for(;_.sibling===null;){if(_.return===null||_.return===n)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}n.stateNode=h;e:switch(ln(h,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Hs(n)}}return bt(n),of(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Hs(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=Se.current,no(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=an,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[Xe]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||C0(e.nodeValue,a)),e||ga(n,!0)}else e=_c(e).createTextNode(l),e[Xe]=n,n.stateNode=e}return bt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=no(n),a!==null){if(e===null){if(!l)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[Xe]=n}else ci(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;bt(n),e=!1}else a=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(En(n),n):(En(n),null);if((n.flags&128)!==0)throw Error(r(558))}return bt(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=no(n),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(r(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[Xe]=n}else ci(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;bt(n),f=!1}else f=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(En(n),n):(En(n),null)}return En(n),(n.flags&128)!==0?(n.lanes=a,n):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==f&&(l.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),oc(n,n.updateQueue),bt(n),null);case 4:return It(),e===null&&Cf(n.stateNode.containerInfo),bt(n),null;case 10:return zs(n.type),bt(n),null;case 19:if(ue(Lt),l=n.memoizedState,l===null)return bt(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)br(l,!1);else{if(Et!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Zl(e),h!==null){for(n.flags|=128,br(l,!1),e=h.updateQueue,n.updateQueue=e,oc(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)og(a,e),a=a.sibling;return Ce(Lt,Lt.current&1|2),Ge&&Bs(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Jt()>uc&&(n.flags|=128,f=!0,br(l,!1),n.lanes=4194304)}else{if(!f)if(e=Zl(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,oc(n,e),br(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Ge)return bt(n),null}else 2*Jt()-l.renderingStartTime>uc&&a!==536870912&&(n.flags|=128,f=!0,br(l,!1),n.lanes=4194304);l.isBackwards?(h.sibling=n.child,n.child=h):(e=l.last,e!==null?e.sibling=h:n.child=h,l.last=h)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Jt(),e.sibling=null,a=Lt.current,Ce(Lt,f?a&1|2:a&1),Ge&&Bs(n,l.treeForkCount),e):(bt(n),null);case 22:case 23:return En(n),Cu(),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&&(bt(n),n.subtreeFlags&6&&(n.flags|=8192)):bt(n),a=n.updateQueue,a!==null&&oc(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&&ue(fi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),zs(Ht),bt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function yS(e,n){switch(pu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return zs(Ht),It(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return re(n),null;case 31:if(n.memoizedState!==null){if(En(n),n.alternate===null)throw Error(r(340));ci()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(En(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ci()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return ue(Lt),null;case 4:return It(),null;case 10:return zs(n.type),null;case 22:case 23:return En(n),Cu(),e!==null&&ue(fi),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return zs(Ht),null;case 25:return null;default:return null}}function Mv(e,n){switch(pu(n),n.tag){case 3:zs(Ht),It();break;case 26:case 27:case 5:re(n);break;case 4:It();break;case 31:n.memoizedState!==null&&En(n);break;case 13:En(n);break;case 19:ue(Lt);break;case 10:zs(n.type);break;case 22:case 23:En(n),Cu(),e!==null&&ue(fi);break;case 24:zs(Ht)}}function xr(e,n){try{var a=n.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var h=a.create,_=a.inst;l=h(),_.destroy=l}a=a.next}while(a!==f)}}catch(w){lt(n,n.return,w)}}function Sa(e,n,a){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var _=l.inst,w=_.destroy;if(w!==void 0){_.destroy=void 0,f=n;var R=a,q=w;try{q()}catch(ne){lt(f,R,ne)}}}l=l.next}while(l!==h)}}catch(ne){lt(n,n.return,ne)}}function Iv(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{Tg(n,a)}catch(l){lt(e,e.return,l)}}}function Ov(e,n,a){a.props=vi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){lt(e,n,l)}}function _r(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){lt(e,n,f)}}function Ss(e,n){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){lt(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){lt(e,n,f)}else a.current=null}function Bv(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){lt(e,e.return,f)}}function rf(e,n,a){try{var l=e.stateNode;US(l,e.type,a,n),l[ot]=n}catch(f){lt(e,e.return,f)}}function Lv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Aa(e.type)||e.tag===4}function lf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Lv(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&&Aa(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 cf(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=Ms));else if(l!==4&&(l===27&&Aa(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(cf(e,n,a),e=e.sibling;e!==null;)cf(e,n,a),e=e.sibling}function rc(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&&Aa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(rc(e,n,a),e=e.sibling;e!==null;)rc(e,n,a),e=e.sibling}function zv(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);ln(n,l,a),n[Xe]=e,n[ot]=a}catch(h){lt(e,e.return,h)}}var Vs=!1,Gt=!1,df=!1,$v=typeof WeakSet=="function"?WeakSet:Set,en=null;function bS(e,n){if(e=e.containerInfo,Df=Cc,e=Wh(e),nu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var _=0,w=-1,R=-1,q=0,ne=0,oe=e,G=null;t:for(;;){for(var K;oe!==a||f!==0&&oe.nodeType!==3||(w=_+f),oe!==h||l!==0&&oe.nodeType!==3||(R=_+l),oe.nodeType===3&&(_+=oe.nodeValue.length),(K=oe.firstChild)!==null;)G=oe,oe=K;for(;;){if(oe===e)break t;if(G===a&&++q===f&&(w=_),G===h&&++ne===l&&(R=_),(K=oe.nextSibling)!==null)break;oe=G,G=oe.parentNode}oe=K}a=w===-1||R===-1?null:{start:w,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Rf={focusedElem:e,selectionRange:a},Cc=!1,en=n;en!==null;)if(n=en,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,en=e;else for(;en!==null;){switch(n=en,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,f=h.memoizedProps,h=h.memoizedState,l=a.stateNode;try{var be=vi(a.type,f);e=l.getSnapshotBeforeUpdate(be,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){lt(a,a.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Of(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Of(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=n.sibling,e!==null){e.return=n.return,en=e;break}en=n.return}}function Uv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Gs(e,a),l&4&&xr(5,a);break;case 1:if(Gs(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(_){lt(a,a.return,_)}else{var f=vi(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(_){lt(a,a.return,_)}}l&64&&Iv(a),l&512&&_r(a,a.return);break;case 3:if(Gs(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{Tg(e,n)}catch(_){lt(a,a.return,_)}}break;case 27:n===null&&l&4&&zv(a);case 26:case 5:Gs(e,a),n===null&&l&4&&Bv(a),l&512&&_r(a,a.return);break;case 12:Gs(e,a);break;case 31:Gs(e,a),l&4&&Vv(e,a);break;case 13:Gs(e,a),l&4&&qv(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=CS.bind(null,a),KS(e,a))));break;case 22:if(l=a.memoizedState!==null||Vs,!l){n=n!==null&&n.memoizedState!==null||Gt,f=Vs;var h=Gt;Vs=l,(Gt=n)&&!h?Fs(e,a,(a.subtreeFlags&8772)!==0):Gs(e,a),Vs=f,Gt=h}break;case 30:break;default:Gs(e,a)}}function Pv(e){var n=e.alternate;n!==null&&(e.alternate=null,Pv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&$d(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Tt=null,_n=!1;function qs(e,n,a){for(a=a.child;a!==null;)Hv(e,n,a),a=a.sibling}function Hv(e,n,a){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(Wt,a)}catch{}switch(a.tag){case 26:Gt||Ss(a,n),qs(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Gt||Ss(a,n);var l=Tt,f=_n;Aa(a.type)&&(Tt=a.stateNode,_n=!1),qs(e,n,a),Ar(a.stateNode),Tt=l,_n=f;break;case 5:Gt||Ss(a,n);case 6:if(l=Tt,f=_n,Tt=null,qs(e,n,a),Tt=l,_n=f,Tt!==null)if(_n)try{(Tt.nodeType===9?Tt.body:Tt.nodeName==="HTML"?Tt.ownerDocument.body:Tt).removeChild(a.stateNode)}catch(h){lt(a,n,h)}else try{Tt.removeChild(a.stateNode)}catch(h){lt(a,n,h)}break;case 18:Tt!==null&&(_n?(e=Tt,I0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),To(e)):I0(Tt,a.stateNode));break;case 4:l=Tt,f=_n,Tt=a.stateNode.containerInfo,_n=!0,qs(e,n,a),Tt=l,_n=f;break;case 0:case 11:case 14:case 15:Sa(2,a,n),Gt||Sa(4,a,n),qs(e,n,a);break;case 1:Gt||(Ss(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Ov(a,n,l)),qs(e,n,a);break;case 21:qs(e,n,a);break;case 22:Gt=(l=Gt)||a.memoizedState!==null,qs(e,n,a),Gt=l;break;default:qs(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{To(e)}catch(a){lt(n,n.return,a)}}}function qv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{To(e)}catch(a){lt(n,n.return,a)}}function xS(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new $v),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new $v),n;default:throw Error(r(435,e.tag))}}function lc(e,n){var a=xS(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=ES.bind(null,e,l);l.then(f,f)}})}function kn(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],h=e,_=n,w=_;e:for(;w!==null;){switch(w.tag){case 27:if(Aa(w.type)){Tt=w.stateNode,_n=!1;break e}break;case 5:Tt=w.stateNode,_n=!1;break e;case 3:case 4:Tt=w.stateNode.containerInfo,_n=!0;break e}w=w.return}if(Tt===null)throw Error(r(160));Hv(h,_,f),Tt=null,_n=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Gv(n,e),n=n.sibling}var rs=null;function Gv(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:kn(n,e),Sn(e),l&4&&(Sa(3,e,e.return),xr(3,e),Sa(5,e,e.return));break;case 1:kn(n,e),Sn(e),l&512&&(Gt||a===null||Ss(a,a.return)),l&64&&Vs&&(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=rs;if(kn(n,e),Sn(e),l&512&&(Gt||a===null||Ss(a,a.return)),l&4){var h=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":h=f.getElementsByTagName("title")[0],(!h||h[Ko]||h[Xe]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),ln(h,l,a),h[Xe]=e,Qt(h),l=h;break e;case"link":var _=G0("link","href",f).get(l+(a.href||""));if(_){for(var w=0;w<_.length;w++)if(h=_[w],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){_.splice(w,1);break t}}h=f.createElement(l),ln(h,l,a),f.head.appendChild(h);break;case"meta":if(_=G0("meta","content",f).get(l+(a.content||""))){for(w=0;w<_.length;w++)if(h=_[w],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){_.splice(w,1);break t}}h=f.createElement(l),ln(h,l,a),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[Xe]=e,Qt(h),l=h}e.stateNode=l}else F0(f,e.type,e.stateNode);else e.stateNode=q0(f,l,e.memoizedProps);else h!==l?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,l===null?F0(f,e.type,e.stateNode):q0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&rf(e,e.memoizedProps,a.memoizedProps)}break;case 27:kn(n,e),Sn(e),l&512&&(Gt||a===null||Ss(a,a.return)),a!==null&&l&4&&rf(e,e.memoizedProps,a.memoizedProps);break;case 5:if(kn(n,e),Sn(e),l&512&&(Gt||a===null||Ss(a,a.return)),e.flags&32){f=e.stateNode;try{Fi(f,"")}catch(be){lt(e,e.return,be)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,rf(e,f,a!==null?a.memoizedProps:f)),l&1024&&(df=!0);break;case 6:if(kn(n,e),Sn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(be){lt(e,e.return,be)}}break;case 3:if(Tc=null,f=rs,rs=kc(n.containerInfo),kn(n,e),rs=f,Sn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{To(n.containerInfo)}catch(be){lt(e,e.return,be)}df&&(df=!1,Fv(e));break;case 4:l=rs,rs=kc(e.stateNode.containerInfo),kn(n,e),Sn(e),rs=l;break;case 12:kn(n,e),Sn(e);break;case 31:kn(n,e),Sn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,lc(e,l)));break;case 13:kn(n,e),Sn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(dc=Jt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,lc(e,l)));break;case 22:f=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,q=Vs,ne=Gt;if(Vs=q||f,Gt=ne||R,kn(n,e),Gt=ne,Vs=q,Sn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||R||Vs||Gt||yi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(h=R.stateNode,f)_=h.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{w=R.stateNode;var oe=R.memoizedProps.style,G=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;w.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(be){lt(R,R.return,be)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(be){lt(R,R.return,be)}}}else if(n.tag===18){if(a===null){R=n;try{var K=R.stateNode;f?O0(K,!0):O0(R.stateNode,!1)}catch(be){lt(R,R.return,be)}}}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,lc(e,a))));break;case 19:kn(n,e),Sn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,lc(e,l)));break;case 30:break;case 21:break;default:kn(n,e),Sn(e)}}function Sn(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(Lv(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,h=lf(e);rc(e,h,f);break;case 5:var _=a.stateNode;a.flags&32&&(Fi(_,""),a.flags&=-33);var w=lf(e);rc(e,w,_);break;case 3:case 4:var R=a.stateNode.containerInfo,q=lf(e);cf(e,q,R);break;default:throw Error(r(161))}}catch(ne){lt(e,e.return,ne)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Fv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Fv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Gs(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Uv(e,n.alternate,n),n=n.sibling}function yi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Sa(4,n,n.return),yi(n);break;case 1:Ss(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Ov(n,n.return,a),yi(n);break;case 27:Ar(n.stateNode);case 26:case 5:Ss(n,n.return),yi(n);break;case 22:n.memoizedState===null&&yi(n);break;case 30:yi(n);break;default:yi(n)}e=e.sibling}}function Fs(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,_=h.flags;switch(h.tag){case 0:case 11:case 15:Fs(f,h,a),xr(4,h);break;case 1:if(Fs(f,h,a),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(q){lt(l,l.return,q)}if(l=h,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++)Sg(R[f],w)}catch(q){lt(l,l.return,q)}}a&&_&64&&Iv(h),_r(h,h.return);break;case 27:zv(h);case 26:case 5:Fs(f,h,a),a&&l===null&&_&4&&Bv(h),_r(h,h.return);break;case 12:Fs(f,h,a);break;case 31:Fs(f,h,a),a&&_&4&&Vv(f,h);break;case 13:Fs(f,h,a),a&&_&4&&qv(f,h);break;case 22:h.memoizedState===null&&Fs(f,h,a),_r(h,h.return);break;case 30:break;default:Fs(f,h,a)}n=n.sibling}}function uf(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&&rr(a))}function ff(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&rr(e))}function ls(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Zv(e,n,a,l),n=n.sibling}function Zv(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:ls(e,n,a,l),f&2048&&xr(9,n);break;case 1:ls(e,n,a,l);break;case 3:ls(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&&rr(e)));break;case 12:if(f&2048){ls(e,n,a,l),e=n.stateNode;try{var h=n.memoizedProps,_=h.id,w=h.onPostCommit;typeof w=="function"&&w(_,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){lt(n,n.return,R)}}else ls(e,n,a,l);break;case 31:ls(e,n,a,l);break;case 13:ls(e,n,a,l);break;case 23:break;case 22:h=n.stateNode,_=n.alternate,n.memoizedState!==null?h._visibility&2?ls(e,n,a,l):kr(e,n):h._visibility&2?ls(e,n,a,l):(h._visibility|=2,po(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&uf(_,n);break;case 24:ls(e,n,a,l),f&2048&&ff(n.alternate,n);break;default:ls(e,n,a,l)}}function po(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,_=n,w=a,R=l,q=_.flags;switch(_.tag){case 0:case 11:case 15:po(h,_,w,R,f),xr(8,_);break;case 23:break;case 22:var ne=_.stateNode;_.memoizedState!==null?ne._visibility&2?po(h,_,w,R,f):kr(h,_):(ne._visibility|=2,po(h,_,w,R,f)),f&&q&2048&&uf(_.alternate,_);break;case 24:po(h,_,w,R,f),f&&q&2048&&ff(_.alternate,_);break;default:po(h,_,w,R,f)}n=n.sibling}}function kr(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:kr(a,l),f&2048&&uf(l.alternate,l);break;case 24:kr(a,l),f&2048&&ff(l.alternate,l);break;default:kr(a,l)}n=n.sibling}}var Sr=8192;function mo(e,n,a){if(e.subtreeFlags&Sr)for(e=e.child;e!==null;)Kv(e,n,a),e=e.sibling}function Kv(e,n,a){switch(e.tag){case 26:mo(e,n,a),e.flags&Sr&&e.memoizedState!==null&&oT(a,rs,e.memoizedState,e.memoizedProps);break;case 5:mo(e,n,a);break;case 3:case 4:var l=rs;rs=kc(e.stateNode.containerInfo),mo(e,n,a),rs=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Sr,Sr=16777216,mo(e,n,a),Sr=l):mo(e,n,a));break;default:mo(e,n,a)}}function Yv(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 Tr(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];en=l,Wv(l,e)}Yv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Jv(e),e=e.sibling}function Jv(e){switch(e.tag){case 0:case 11:case 15:Tr(e),e.flags&2048&&Sa(9,e,e.return);break;case 3:Tr(e);break;case 12:Tr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,cc(e)):Tr(e);break;default:Tr(e)}}function cc(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];en=l,Wv(l,e)}Yv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Sa(8,n,n.return),cc(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,cc(n));break;default:cc(n)}e=e.sibling}}function Wv(e,n){for(;en!==null;){var a=en;switch(a.tag){case 0:case 11:case 15:Sa(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:rr(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,en=l;else e:for(a=e;en!==null;){l=en;var f=l.sibling,h=l.return;if(Pv(l),l===a){en=null;break e}if(f!==null){f.return=h,en=f;break e}en=h}}}var _S={getCacheForType:function(e){var n=on(Ht),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return on(Ht).controller.signal}},kS=typeof WeakMap=="function"?WeakMap:Map,at=0,gt=null,$e=null,He=0,rt=0,An=null,Ta=!1,ho=!1,pf=!1,Zs=0,Et=0,ja=0,bi=0,mf=0,Dn=0,go=0,jr=null,Tn=null,hf=!1,dc=0,Xv=0,uc=1/0,fc=null,wa=null,Zt=0,Na=null,vo=null,Ks=0,gf=0,vf=null,Qv=null,wr=0,yf=null;function Rn(){return(at&2)!==0&&He!==0?He&-He:B.T!==null?Tf():We()}function e0(){if(Dn===0)if((He&536870912)===0||Ge){var e=ei;ei<<=1,(ei&3932160)===0&&(ei=262144),Dn=e}else Dn=536870912;return e=Cn.current,e!==null&&(e.flags|=32),Dn}function jn(e,n,a){(e===gt&&(rt===2||rt===9)||e.cancelPendingCommit!==null)&&(yo(e,0),Ca(e,He,Dn,!1)),se(e,a),((at&2)===0||e!==gt)&&(e===gt&&((at&2)===0&&(bi|=a),Et===4&&Ca(e,He,Dn,!1)),Ts(e))}function t0(e,n,a){if((at&6)!==0)throw Error(r(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||fa(e,n),f=l?jS(e,n):xf(e,n,!0),h=l;do{if(f===0){ho&&!l&&Ca(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!SS(a)){f=xf(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){n=_;e:{var w=e;f=jr;var R=w.current.memoizedState.isDehydrated;if(R&&(yo(w,_).flags|=256),_=xf(w,_,!1),_!==2){if(pf&&!R){w.errorRecoveryDisabledLanes|=h,bi|=h,f=4;break e}h=Tn,Tn=f,h!==null&&(Tn===null?Tn=h:Tn.push.apply(Tn,h))}f=_}if(h=!1,f!==2)continue}}if(f===1){yo(e,0),Ca(e,n,0,!0);break}e:{switch(l=e,h=f,h){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:Ca(l,n,Dn,!Ta);break e;case 2:Tn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=dc+300-Jt(),10<f)){if(Ca(l,n,Dn,!Ta),ni(l,0,!0)!==0)break e;Ks=n,l.timeoutHandle=R0(n0.bind(null,l,a,Tn,fc,hf,n,Dn,bi,go,Ta,h,"Throttled",-0,0),f);break e}n0(l,a,Tn,fc,hf,n,Dn,bi,go,Ta,h,null,-0,0)}}break}while(!0);Ts(e)}function n0(e,n,a,l,f,h,_,w,R,q,ne,oe,G,K){if(e.timeoutHandle=-1,oe=n.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ms},Kv(n,h,oe);var be=(h&62914560)===h?dc-Jt():(h&4194048)===h?Xv-Jt():0;if(be=rT(oe,be),be!==null){Ks=h,e.cancelPendingCommit=be(d0.bind(null,e,n,h,a,l,f,_,w,R,ne,oe,null,G,K)),Ca(e,h,_,!q);return}}d0(e,n,h,a,l,f,_,w,R)}function SS(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],h=f.getSnapshot;f=f.value;try{if(!wn(h(),f))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Ca(e,n,a,l){n&=~mf,n&=~bi,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-Xt(f),_=1<<h;l[h]=-1,f&=~_}a!==0&&fe(e,a,n)}function pc(){return(at&6)===0?(Nr(0),!1):!0}function bf(){if($e!==null){if(rt===0)var e=$e.return;else e=$e,Ls=di=null,Iu(e),ro=null,cr=0,e=$e;for(;e!==null;)Mv(e.alternate,e),e=e.return;$e=null}}function yo(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,VS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Ks=0,bf(),gt=e,$e=a=Os(e.current,null),He=n,rt=0,An=null,Ta=!1,ho=fa(e,n),pf=!1,go=Dn=mf=bi=ja=Et=0,Tn=jr=null,hf=!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-Xt(l),h=1<<f;n|=e[f],l&=~h}return Zs=n,Il(),a}function s0(e,n){Ie=null,B.H=vr,n===oo||n===Hl?(n=bg(),rt=3):n===ku?(n=bg(),rt=4):rt=n===Ju?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,An=n,$e===null&&(Et=1,nc(e,Vn(n,e.current)))}function a0(){var e=Cn.current;return e===null?!0:(He&4194048)===He?Zn===null:(He&62914560)===He||(He&536870912)!==0?e===Zn:!1}function i0(){var e=B.H;return B.H=vr,e===null?vr:e}function o0(){var e=B.A;return B.A=_S,e}function mc(){Et=4,Ta||(He&4194048)!==He&&Cn.current!==null||(ho=!0),(ja&134217727)===0&&(bi&134217727)===0||gt===null||Ca(gt,He,Dn,!1)}function xf(e,n,a){var l=at;at|=2;var f=i0(),h=o0();(gt!==e||He!==n)&&(fc=null,yo(e,n)),n=!1;var _=Et;e:do try{if(rt!==0&&$e!==null){var w=$e,R=An;switch(rt){case 8:bf(),_=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(n=!0);var q=rt;if(rt=0,An=null,bo(e,w,R,q),a&&ho){_=0;break e}break;default:q=rt,rt=0,An=null,bo(e,w,R,q)}}TS(),_=Et;break}catch(ne){s0(e,ne)}while(!0);return n&&e.shellSuspendCounter++,Ls=di=null,at=l,B.H=f,B.A=h,$e===null&&(gt=null,He=0,Il()),_}function TS(){for(;$e!==null;)r0($e)}function jS(e,n){var a=at;at|=2;var l=i0(),f=o0();gt!==e||He!==n?(fc=null,uc=Jt()+500,yo(e,n)):ho=fa(e,n);e:do try{if(rt!==0&&$e!==null){n=$e;var h=An;t:switch(rt){case 1:rt=0,An=null,bo(e,n,h,1);break;case 2:case 9:if(vg(h)){rt=0,An=null,l0(n);break}n=function(){rt!==2&&rt!==9||gt!==e||(rt=7),Ts(e)},h.then(n,n);break e;case 3:rt=7;break e;case 4:rt=5;break e;case 7:vg(h)?(rt=0,An=null,l0(n)):(rt=0,An=null,bo(e,n,h,7));break;case 5:var _=null;switch($e.tag){case 26:_=$e.memoizedState;case 5:case 27:var w=$e;if(_?Z0(_):w.stateNode.complete){rt=0,An=null;var R=w.sibling;if(R!==null)$e=R;else{var q=w.return;q!==null?($e=q,hc(q)):$e=null}break t}}rt=0,An=null,bo(e,n,h,5);break;case 6:rt=0,An=null,bo(e,n,h,6);break;case 8:bf(),Et=6;break e;default:throw Error(r(462))}}wS();break}catch(ne){s0(e,ne)}while(!0);return Ls=di=null,B.H=l,B.A=f,at=a,$e!==null?0:(gt=null,He=0,Il(),Et)}function wS(){for(;$e!==null&&!Wa();)r0($e)}function r0(e){var n=Dv(e.alternate,e,Zs);e.memoizedProps=e.pendingProps,n===null?hc(e):$e=n}function l0(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=jv(a,n,n.pendingProps,n.type,void 0,He);break;case 11:n=jv(a,n,n.pendingProps,n.type.render,n.ref,He);break;case 5:Iu(n);default:Mv(a,n),n=$e=og(n,Zs),n=Dv(a,n,Zs)}e.memoizedProps=e.pendingProps,n===null?hc(e):$e=n}function bo(e,n,a,l){Ls=di=null,Iu(n),ro=null,cr=0;var f=n.return;try{if(mS(e,f,n,a,He)){Et=1,nc(e,Vn(a,e.current)),$e=null;return}}catch(h){if(f!==null)throw $e=f,h;Et=1,nc(e,Vn(a,e.current)),$e=null;return}n.flags&32768?(Ge||l===1?e=!0:ho||(He&536870912)!==0?e=!1:(Ta=e=!0,(l===2||l===9||l===3||l===6)&&(l=Cn.current,l!==null&&l.tag===13&&(l.flags|=16384))),c0(n,e)):hc(n)}function hc(e){var n=e;do{if((n.flags&32768)!==0){c0(n,Ta);return}e=n.return;var a=vS(n.alternate,n,Zs);if(a!==null){$e=a;return}if(n=n.sibling,n!==null){$e=n;return}$e=n=e}while(n!==null);Et===0&&(Et=5)}function c0(e,n){do{var a=yS(e.alternate,e);if(a!==null){a.flags&=32767,$e=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){$e=e;return}$e=e=a}while(e!==null);Et=6,$e=null}function d0(e,n,a,l,f,h,_,w,R){e.cancelPendingCommit=null;do gc();while(Zt!==0);if((at&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(h=n.lanes|n.childLanes,h|=ru,le(e,a,h,_,w,R),e===gt&&($e=gt=null,He=0),vo=n,Na=e,Ks=a,gf=h,vf=f,Qv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,AS(ys,function(){return h0(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=B.T,B.T=null,f=F.p,F.p=2,_=at,at|=4;try{bS(e,n,a)}finally{at=_,F.p=f,B.T=l}}Zt=1,u0(),f0(),p0()}}function u0(){if(Zt===1){Zt=0;var e=Na,n=vo,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=B.T,B.T=null;var l=F.p;F.p=2;var f=at;at|=4;try{Gv(n,e);var h=Rf,_=Wh(e.containerInfo),w=h.focusedElem,R=h.selectionRange;if(_!==w&&w&&w.ownerDocument&&Jh(w.ownerDocument.documentElement,w)){if(R!==null&&nu(w)){var q=R.start,ne=R.end;if(ne===void 0&&(ne=q),"selectionStart"in w)w.selectionStart=q,w.selectionEnd=Math.min(ne,w.value.length);else{var oe=w.ownerDocument||document,G=oe&&oe.defaultView||window;if(G.getSelection){var K=G.getSelection(),be=w.textContent.length,Ee=Math.min(R.start,be),pt=R.end===void 0?Ee:Math.min(R.end,be);!K.extend&&Ee>pt&&(_=pt,pt=Ee,Ee=_);var U=Yh(w,Ee),L=Yh(w,pt);if(U&&L&&(K.rangeCount!==1||K.anchorNode!==U.node||K.anchorOffset!==U.offset||K.focusNode!==L.node||K.focusOffset!==L.offset)){var V=oe.createRange();V.setStart(U.node,U.offset),K.removeAllRanges(),Ee>pt?(K.addRange(V),K.extend(L.node,L.offset)):(V.setEnd(L.node,L.offset),K.addRange(V))}}}}for(oe=[],K=w;K=K.parentNode;)K.nodeType===1&&oe.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<oe.length;w++){var ie=oe[w];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}Cc=!!Df,Rf=Df=null}finally{at=f,F.p=l,B.T=a}}e.current=n,Zt=2}}function f0(){if(Zt===2){Zt=0;var e=Na,n=vo,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=B.T,B.T=null;var l=F.p;F.p=2;var f=at;at|=4;try{Uv(e,n.alternate,n)}finally{at=f,F.p=l,B.T=a}}Zt=3}}function p0(){if(Zt===4||Zt===3){Zt=0,da();var e=Na,n=vo,a=Ks,l=Qv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Zt=5:(Zt=0,vo=Na=null,m0(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(wa=null),Re(a),n=n.stateNode,St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(Wt,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=B.T,f=F.p,F.p=2,B.T=null;try{for(var h=e.onRecoverableError,_=0;_<l.length;_++){var w=l[_];h(w.value,{componentStack:w.stack})}}finally{B.T=n,F.p=f}}(Ks&3)!==0&&gc(),Ts(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===yf?wr++:(wr=0,yf=e):wr=0,Nr(0)}}function m0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,rr(n)))}function gc(){return u0(),f0(),p0(),h0()}function h0(){if(Zt!==5)return!1;var e=Na,n=gf;gf=0;var a=Re(Ks),l=B.T,f=F.p;try{F.p=32>a?32:a,B.T=null,a=vf,vf=null;var h=Na,_=Ks;if(Zt=0,vo=Na=null,Ks=0,(at&6)!==0)throw Error(r(331));var w=at;if(at|=4,Jv(h.current),Zv(h,h.current,_,a),at=w,Nr(0,!1),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(Wt,h)}catch{}return!0}finally{F.p=f,B.T=l,m0(e,n)}}function g0(e,n,a){n=Vn(a,n),n=Yu(e.stateNode,n,2),e=xa(e,n,2),e!==null&&(se(e,2),Ts(e))}function lt(e,n,a){if(e.tag===3)g0(e,e,a);else for(;n!==null;){if(n.tag===3){g0(n,e,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(wa===null||!wa.has(l))){e=Vn(a,e),a=vv(2),l=xa(n,a,2),l!==null&&(yv(a,l,n,e),se(l,2),Ts(l));break}}n=n.return}}function _f(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new kS;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)||(pf=!0,f.add(a),e=NS.bind(null,e,n,a),n.then(e,e))}function NS(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,gt===e&&(He&a)===a&&(Et===4||Et===3&&(He&62914560)===He&&300>Jt()-dc?(at&2)===0&&yo(e,0):mf|=a,go===He&&(go=0)),Ts(e)}function v0(e,n){n===0&&(n=kl()),e=ri(e,n),e!==null&&(se(e,n),Ts(e))}function CS(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),v0(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(r(314))}l!==null&&l.delete(n),v0(e,a)}function AS(e,n){return ca(e,n)}var vc=null,xo=null,kf=!1,yc=!1,Sf=!1,Ea=0;function Ts(e){e!==xo&&e.next===null&&(xo===null?vc=xo=e:xo=xo.next=e),yc=!0,kf||(kf=!0,RS())}function Nr(e,n){if(!Sf&&yc){Sf=!0;do for(var a=!1,l=vc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var _=l.suspendedLanes,w=l.pingedLanes;h=(1<<31-Xt(42|e)+1)-1,h&=f&~(_&~w),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,_0(l,h))}else h=He,h=ni(l,l===gt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||fa(l,h)||(a=!0,_0(l,h));l=l.next}while(a);Sf=!1}}function DS(){y0()}function y0(){yc=kf=!1;var e=0;Ea!==0&&HS()&&(e=Ea);for(var n=Jt(),a=null,l=vc;l!==null;){var f=l.next,h=b0(l,n);h===0?(l.next=null,a===null?vc=f:a.next=f,f===null&&(xo=a)):(a=l,(e!==0||(h&3)!==0)&&(yc=!0)),l=f}Zt!==0&&Zt!==5||Nr(e),Ea!==0&&(Ea=0)}function b0(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var _=31-Xt(h),w=1<<_,R=f[_];R===-1?((w&a)===0||(w&l)!==0)&&(f[_]=_l(w,n)):R<=n&&(e.expiredLanes|=w),h&=~w}if(n=gt,a=He,a=ni(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(rt===2||rt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&is(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||fa(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&is(l),Re(a)){case 2:case 8:a=Xa;break;case 32:a=ys;break;case 268435456:a=$n;break;default:a=ys}return l=x0.bind(null,e),a=ca(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&is(l),e.callbackPriority=2,e.callbackNode=null,2}function x0(e,n){if(Zt!==0&&Zt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(gc()&&e.callbackNode!==a)return null;var l=He;return l=ni(e,e===gt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(t0(e,l,n),b0(e,Jt()),e.callbackNode!=null&&e.callbackNode===a?x0.bind(null,e):null)}function _0(e,n){if(gc())return null;t0(e,n,!0)}function RS(){qS(function(){(at&6)!==0?ca(ua,DS):y0()})}function Tf(){if(Ea===0){var e=ao;e===0&&(e=Qa,Qa<<=1,(Qa&261888)===0&&(Qa=256)),Ea=e}return Ea}function k0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:wl(""+e)}function S0(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 MS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var h=k0((f[ot]||null).action),_=l.submitter;_&&(n=(n=_[ot]||null)?k0(n.formAction):_.getAttribute("formAction"),n!==null&&(h=n,_=null));var w=new Al("action","action",null,l,f);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ea!==0){var R=_?S0(f,_):new FormData(f);Vu(a,{pending:!0,data:R,method:f.method,action:h},null,R)}}else typeof h=="function"&&(w.preventDefault(),R=_?S0(f,_):new FormData(f),Vu(a,{pending:!0,data:R,method:f.method,action:h},h,R))},currentTarget:f}]})}}for(var jf=0;jf<ou.length;jf++){var wf=ou[jf],IS=wf.toLowerCase(),OS=wf[0].toUpperCase()+wf.slice(1);os(IS,"on"+OS)}os(eg,"onAnimationEnd"),os(tg,"onAnimationIteration"),os(ng,"onAnimationStart"),os("dblclick","onDoubleClick"),os("focusin","onFocus"),os("focusout","onBlur"),os(Wk,"onTransitionRun"),os(Xk,"onTransitionStart"),os(Qk,"onTransitionCancel"),os(sg,"onTransitionEnd"),qi("onMouseEnter",["mouseout","mouseover"]),qi("onMouseLeave",["mouseout","mouseover"]),qi("onPointerEnter",["pointerout","pointerover"]),qi("onPointerLeave",["pointerout","pointerover"]),si("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),si("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),si("onBeforeInput",["compositionend","keypress","textInput","paste"]),si("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),si("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),si("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Cr="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(" "),BS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Cr));function T0(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var h=void 0;if(n)for(var _=l.length-1;0<=_;_--){var w=l[_],R=w.instance,q=w.currentTarget;if(w=w.listener,R!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=q;try{h(f)}catch(ne){Ml(ne)}f.currentTarget=null,h=R}else for(_=0;_<l.length;_++){if(w=l[_],R=w.instance,q=w.currentTarget,w=w.listener,R!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=q;try{h(f)}catch(ne){Ml(ne)}f.currentTarget=null,h=R}}}}function Ue(e,n){var a=n[xs];a===void 0&&(a=n[xs]=new Set);var l=e+"__bubble";a.has(l)||(j0(n,e,2,!1),a.add(l))}function Nf(e,n,a){var l=0;n&&(l|=4),j0(a,e,l,n)}var bc="_reactListening"+Math.random().toString(36).slice(2);function Cf(e){if(!e[bc]){e[bc]=!0,yh.forEach(function(a){a!=="selectionchange"&&(BS.has(a)||Nf(a,!1,e),Nf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[bc]||(n[bc]=!0,Nf("selectionchange",!1,n))}}function j0(e,n,a,l){switch(ey(n)){case 2:var f=dT;break;case 8:f=uT;break;default:f=Vf}a=f.bind(null,n,a,e),f=void 0,!Zd||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 Ef(e,n,a,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var _=l.tag;if(_===3||_===4){var w=l.stateNode.containerInfo;if(w===f)break;if(_===4)for(_=l.return;_!==null;){var R=_.tag;if((R===3||R===4)&&_.stateNode.containerInfo===f)return;_=_.return}for(;w!==null;){if(_=Pi(w),_===null)return;if(R=_.tag,R===5||R===6||R===26||R===27){l=h=_;continue e}w=w.parentNode}}l=l.return}Ah(function(){var q=h,ne=Gd(a),oe=[];e:{var G=ag.get(e);if(G!==void 0){var K=Al,be=e;switch(e){case"keypress":if(Cl(a)===0)break e;case"keydown":case"keyup":K=Ek;break;case"focusin":be="focus",K=Wd;break;case"focusout":be="blur",K=Wd;break;case"beforeblur":case"afterblur":K=Wd;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=Mh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=vk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Rk;break;case eg:case tg:case ng:K=xk;break;case sg:K=Ik;break;case"scroll":case"scrollend":K=hk;break;case"wheel":K=Bk;break;case"copy":case"cut":case"paste":K=kk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=Oh;break;case"toggle":case"beforetoggle":K=zk}var Ee=(n&4)!==0,pt=!Ee&&(e==="scroll"||e==="scrollend"),U=Ee?G!==null?G+"Capture":null:G;Ee=[];for(var L=q,V;L!==null;){var ie=L;if(V=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||V===null||U===null||(ie=Jo(L,U),ie!=null&&Ee.push(Er(L,ie,V))),pt)break;L=L.return}0<Ee.length&&(G=new K(G,be,null,a,ne),oe.push({event:G,listeners:Ee}))}}if((n&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",G&&a!==qd&&(be=a.relatedTarget||a.fromElement)&&(Pi(be)||be[vt]))break e;if((K||G)&&(G=ne.window===ne?ne:(G=ne.ownerDocument)?G.defaultView||G.parentWindow:window,K?(be=a.relatedTarget||a.toElement,K=q,be=be?Pi(be):null,be!==null&&(pt=d(be),Ee=be.tag,be!==pt||Ee!==5&&Ee!==27&&Ee!==6)&&(be=null)):(K=null,be=q),K!==be)){if(Ee=Mh,ie="onMouseLeave",U="onMouseEnter",L="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=Oh,ie="onPointerLeave",U="onPointerEnter",L="pointer"),pt=K==null?G:Yo(K),V=be==null?G:Yo(be),G=new Ee(ie,L+"leave",K,a,ne),G.target=pt,G.relatedTarget=V,ie=null,Pi(ne)===q&&(Ee=new Ee(U,L+"enter",be,a,ne),Ee.target=V,Ee.relatedTarget=pt,ie=Ee),pt=ie,K&&be)t:{for(Ee=LS,U=K,L=be,V=0,ie=U;ie;ie=Ee(ie))V++;ie=0;for(var we=L;we;we=Ee(we))ie++;for(;0<V-ie;)U=Ee(U),V--;for(;0<ie-V;)L=Ee(L),ie--;for(;V--;){if(U===L||L!==null&&U===L.alternate){Ee=U;break t}U=Ee(U),L=Ee(L)}Ee=null}else Ee=null;K!==null&&w0(oe,G,K,Ee,!1),be!==null&&pt!==null&&w0(oe,pt,be,Ee,!0)}}e:{if(G=q?Yo(q):window,K=G.nodeName&&G.nodeName.toLowerCase(),K==="select"||K==="input"&&G.type==="file")var et=Vh;else if(Ph(G))if(qh)et=Kk;else{et=Fk;var ke=Gk}else K=G.nodeName,!K||K.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?q&&Vd(q.elementType)&&(et=Vh):et=Zk;if(et&&(et=et(e,q))){Hh(oe,et,a,ne);break e}ke&&ke(e,G,q),e==="focusout"&&q&&G.type==="number"&&q.memoizedProps.value!=null&&Hd(G,"number",G.value)}switch(ke=q?Yo(q):window,e){case"focusin":(Ph(ke)||ke.contentEditable==="true")&&(Ji=ke,su=q,ar=null);break;case"focusout":ar=su=Ji=null;break;case"mousedown":au=!0;break;case"contextmenu":case"mouseup":case"dragend":au=!1,Xh(oe,a,ne);break;case"selectionchange":if(Jk)break;case"keydown":case"keyup":Xh(oe,a,ne)}var Oe;if(Qd)e:{switch(e){case"compositionstart":var Ve="onCompositionStart";break e;case"compositionend":Ve="onCompositionEnd";break e;case"compositionupdate":Ve="onCompositionUpdate";break e}Ve=void 0}else Yi?$h(e,a)&&(Ve="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ve="onCompositionStart");Ve&&(Bh&&a.locale!=="ko"&&(Yi||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&Yi&&(Oe=Dh()):(pa=ne,Kd="value"in pa?pa.value:pa.textContent,Yi=!0)),ke=xc(q,Ve),0<ke.length&&(Ve=new Ih(Ve,e,null,a,ne),oe.push({event:Ve,listeners:ke}),Oe?Ve.data=Oe:(Oe=Uh(a),Oe!==null&&(Ve.data=Oe)))),(Oe=Uk?Pk(e,a):Hk(e,a))&&(Ve=xc(q,"onBeforeInput"),0<Ve.length&&(ke=new Ih("onBeforeInput","beforeinput",null,a,ne),oe.push({event:ke,listeners:Ve}),ke.data=Oe)),MS(oe,e,q,a,ne)}T0(oe,n)})}function Er(e,n,a){return{instance:e,listener:n,currentTarget:a}}function xc(e,n){for(var a=n+"Capture",l=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=Jo(e,a),f!=null&&l.unshift(Er(e,f,h)),f=Jo(e,n),f!=null&&l.push(Er(e,f,h))),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 w0(e,n,a,l,f){for(var h=n._reactName,_=[];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=Jo(a,h),q!=null&&_.unshift(Er(a,q,R))):f||(q=Jo(a,h),q!=null&&_.push(Er(a,q,R)))),a=a.return}_.length!==0&&e.push({event:n,listeners:_})}var zS=/\r\n?/g,$S=/\u0000|\uFFFD/g;function N0(e){return(typeof e=="string"?e:""+e).replace(zS,`
|
|
26
|
-
`).replace($S,"")}function C0(e,n){return n=N0(n),N0(e)===n}function ft(e,n,a,l,f,h){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Fi(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Fi(e,""+l);break;case"className":Tl(e,"class",l);break;case"tabIndex":Tl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Tl(e,a,l);break;case"style":Ch(e,l,h);break;case"data":if(n!=="object"){Tl(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=wl(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(a==="formAction"?(n!=="input"&&ft(e,n,"name",f.name,f,null),ft(e,n,"formEncType",f.formEncType,f,null),ft(e,n,"formMethod",f.formMethod,f,null),ft(e,n,"formTarget",f.formTarget,f,null)):(ft(e,n,"encType",f.encType,f,null),ft(e,n,"method",f.method,f,null),ft(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=wl(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=Ms);break;case"onScroll":l!=null&&Ue("scroll",e);break;case"onScrollEnd":l!=null&&Ue("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=wl(""+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":Ue("beforetoggle",e),Ue("toggle",e),Sl(e,"popover",l);break;case"xlinkActuate":Rs(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Rs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Rs(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Rs(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Rs(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Rs(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Rs(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Rs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Rs(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Sl(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=pk.get(a)||a,Sl(e,a,l))}}function Af(e,n,a,l,f,h){switch(a){case"style":Ch(e,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof l=="string"?Fi(e,l):(typeof l=="number"||typeof l=="bigint")&&Fi(e,""+l);break;case"onScroll":l!=null&&Ue("scroll",e);break;case"onScrollEnd":l!=null&&Ue("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Ms);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!bh.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),n=a.slice(2,f?a.length-7:void 0),h=e[ot]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(n,h,f),typeof l=="function")){typeof h!="function"&&h!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,l,f);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):Sl(e,a,l)}}}function ln(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ue("error",e),Ue("load",e);var l=!1,f=!1,h;for(h in a)if(a.hasOwnProperty(h)){var _=a[h];if(_!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ft(e,n,h,_,a,null)}}f&&ft(e,n,"srcSet",a.srcSet,a,null),l&&ft(e,n,"src",a.src,a,null);return;case"input":Ue("invalid",e);var w=h=_=f=null,R=null,q=null;for(l in a)if(a.hasOwnProperty(l)){var ne=a[l];if(ne!=null)switch(l){case"name":f=ne;break;case"type":_=ne;break;case"checked":R=ne;break;case"defaultChecked":q=ne;break;case"value":h=ne;break;case"defaultValue":w=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(r(137,n));break;default:ft(e,n,l,ne,a,null)}}Th(e,h,w,R,q,_,f,!1);return;case"select":Ue("invalid",e),l=_=h=null;for(f in a)if(a.hasOwnProperty(f)&&(w=a[f],w!=null))switch(f){case"value":h=w;break;case"defaultValue":_=w;break;case"multiple":l=w;default:ft(e,n,f,w,a,null)}n=h,a=_,e.multiple=!!l,n!=null?Gi(e,!!l,n,!1):a!=null&&Gi(e,!!l,a,!0);return;case"textarea":Ue("invalid",e),h=f=l=null;for(_ in a)if(a.hasOwnProperty(_)&&(w=a[_],w!=null))switch(_){case"value":l=w;break;case"defaultValue":f=w;break;case"children":h=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:ft(e,n,_,w,a,null)}wh(e,l,f,h);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:ft(e,n,R,l,a,null)}return;case"dialog":Ue("beforetoggle",e),Ue("toggle",e),Ue("cancel",e),Ue("close",e);break;case"iframe":case"object":Ue("load",e);break;case"video":case"audio":for(l=0;l<Cr.length;l++)Ue(Cr[l],e);break;case"image":Ue("error",e),Ue("load",e);break;case"details":Ue("toggle",e);break;case"embed":case"source":case"link":Ue("error",e),Ue("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(r(137,n));default:ft(e,n,q,l,a,null)}return;default:if(Vd(n)){for(ne in a)a.hasOwnProperty(ne)&&(l=a[ne],l!==void 0&&Af(e,n,ne,l,a,void 0));return}}for(w in a)a.hasOwnProperty(w)&&(l=a[w],l!=null&&ft(e,n,w,l,a,null))}function US(e,n,a,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,_=null,w=null,R=null,q=null,ne=null;for(K in a){var oe=a[K];if(a.hasOwnProperty(K)&&oe!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":R=oe;default:l.hasOwnProperty(K)||ft(e,n,K,null,l,oe)}}for(var G in l){var K=l[G];if(oe=a[G],l.hasOwnProperty(G)&&(K!=null||oe!=null))switch(G){case"type":h=K;break;case"name":f=K;break;case"checked":q=K;break;case"defaultChecked":ne=K;break;case"value":_=K;break;case"defaultValue":w=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,n));break;default:K!==oe&&ft(e,n,G,K,l,oe)}}Pd(e,_,w,R,q,ne,h,f);return;case"select":K=_=w=G=null;for(h in a)if(R=a[h],a.hasOwnProperty(h)&&R!=null)switch(h){case"value":break;case"multiple":K=R;default:l.hasOwnProperty(h)||ft(e,n,h,null,l,R)}for(f in l)if(h=l[f],R=a[f],l.hasOwnProperty(f)&&(h!=null||R!=null))switch(f){case"value":G=h;break;case"defaultValue":w=h;break;case"multiple":_=h;default:h!==R&&ft(e,n,f,h,l,R)}n=w,a=_,l=K,G!=null?Gi(e,!!a,G,!1):!!l!=!!a&&(n!=null?Gi(e,!!a,n,!0):Gi(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:ft(e,n,w,null,l,f)}for(_ in l)if(f=l[_],h=a[_],l.hasOwnProperty(_)&&(f!=null||h!=null))switch(_){case"value":G=f;break;case"defaultValue":K=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==h&&ft(e,n,_,f,l,h)}jh(e,G,K);return;case"option":for(var be in a)if(G=a[be],a.hasOwnProperty(be)&&G!=null&&!l.hasOwnProperty(be))switch(be){case"selected":e.selected=!1;break;default:ft(e,n,be,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:ft(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 Ee in a)G=a[Ee],a.hasOwnProperty(Ee)&&G!=null&&!l.hasOwnProperty(Ee)&&ft(e,n,Ee,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(r(137,n));break;default:ft(e,n,q,G,l,K)}return;default:if(Vd(n)){for(var pt in a)G=a[pt],a.hasOwnProperty(pt)&&G!==void 0&&!l.hasOwnProperty(pt)&&Af(e,n,pt,void 0,l,G);for(ne in l)G=l[ne],K=a[ne],!l.hasOwnProperty(ne)||G===K||G===void 0&&K===void 0||Af(e,n,ne,G,l,K);return}}for(var U in a)G=a[U],a.hasOwnProperty(U)&&G!=null&&!l.hasOwnProperty(U)&&ft(e,n,U,null,l,G);for(oe in l)G=l[oe],K=a[oe],!l.hasOwnProperty(oe)||G===K||G==null&&K==null||ft(e,n,oe,G,l,K)}function E0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function PS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],h=f.transferSize,_=f.initiatorType,w=f.duration;if(h&&w&&E0(_)){for(_=0,w=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],q=R.startTime;if(q>w)break;var ne=R.transferSize,oe=R.initiatorType;ne&&E0(oe)&&(R=R.responseEnd,_+=ne*(R<w?1:(w-q)/(R-q)))}if(--l,n+=8*(h+_)/(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 Df=null,Rf=null;function _c(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 D0(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Mf(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 If=null;function HS(){var e=window.event;return e&&e.type==="popstate"?e===If?!1:(If=e,!0):(If=null,!1)}var R0=typeof setTimeout=="function"?setTimeout:void 0,VS=typeof clearTimeout=="function"?clearTimeout:void 0,M0=typeof Promise=="function"?Promise:void 0,qS=typeof queueMicrotask=="function"?queueMicrotask:typeof M0<"u"?function(e){return M0.resolve(null).then(e).catch(GS)}:R0;function GS(e){setTimeout(function(){throw e})}function Aa(e){return e==="head"}function I0(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),To(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Ar(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ar(a);for(var h=a.firstChild;h;){var _=h.nextSibling,w=h.nodeName;h[Ko]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=_}}else a==="body"&&Ar(e.ownerDocument.body);a=f}while(a);To(n)}function O0(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 Of(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":Of(a),$d(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function FS(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[Ko])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Kn(e.nextSibling),e===null)break}return null}function ZS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Kn(e.nextSibling),e===null))return null;return e}function B0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Kn(e.nextSibling),e===null))return null;return e}function Bf(e){return e.data==="$?"||e.data==="$~"}function Lf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function KS(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 Kn(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 zf=null;function L0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Kn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function z0(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 $0(e,n,a){switch(n=_c(a),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Ar(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);$d(e)}var Yn=new Map,U0=new Set;function kc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ys=F.d;F.d={f:YS,r:JS,D:WS,C:XS,L:QS,m:eT,X:nT,S:tT,M:sT};function YS(){var e=Ys.f(),n=pc();return e||n}function JS(e){var n=Hi(e);n!==null&&n.tag===5&&n.type==="form"?sv(n):Ys.r(e)}var _o=typeof document>"u"?null:document;function P0(e,n,a){var l=_o;if(l&&typeof n=="string"&&n){var f=Pn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),U0.has(f)||(U0.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),ln(n,"link",e),Qt(n),l.head.appendChild(n)))}}function WS(e){Ys.D(e),P0("dns-prefetch",e,null)}function XS(e,n){Ys.C(e,n),P0("preconnect",e,n)}function QS(e,n,a){Ys.L(e,n,a);var l=_o;if(l&&e&&n){var f='link[rel="preload"][as="'+Pn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Pn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Pn(a.imageSizes)+'"]')):f+='[href="'+Pn(e)+'"]';var h=f;switch(n){case"style":h=ko(e);break;case"script":h=So(e)}Yn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Yn.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(Dr(h))||n==="script"&&l.querySelector(Rr(h))||(n=l.createElement("link"),ln(n,"link",e),Qt(n),l.head.appendChild(n)))}}function eT(e,n){Ys.m(e,n);var a=_o;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Pn(l)+'"][href="'+Pn(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=So(e)}if(!Yn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Yn.set(h,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Rr(h)))return}l=a.createElement("link"),ln(l,"link",e),Qt(l),a.head.appendChild(l)}}}function tT(e,n,a){Ys.S(e,n,a);var l=_o;if(l&&e){var f=Vi(l).hoistableStyles,h=ko(e);n=n||"default";var _=f.get(h);if(!_){var w={loading:0,preload:null};if(_=l.querySelector(Dr(h)))w.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Yn.get(h))&&$f(e,a);var R=_=l.createElement("link");Qt(R),ln(R,"link",e),R._p=new Promise(function(q,ne){R.onload=q,R.onerror=ne}),R.addEventListener("load",function(){w.loading|=1}),R.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Sc(_,n,l)}_={type:"stylesheet",instance:_,count:1,state:w},f.set(h,_)}}}function nT(e,n){Ys.X(e,n);var a=_o;if(a&&e){var l=Vi(a).hoistableScripts,f=So(e),h=l.get(f);h||(h=a.querySelector(Rr(f)),h||(e=b({src:e,async:!0},n),(n=Yn.get(f))&&Uf(e,n),h=a.createElement("script"),Qt(h),ln(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function sT(e,n){Ys.M(e,n);var a=_o;if(a&&e){var l=Vi(a).hoistableScripts,f=So(e),h=l.get(f);h||(h=a.querySelector(Rr(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Yn.get(f))&&Uf(e,n),h=a.createElement("script"),Qt(h),ln(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function H0(e,n,a,l){var f=(f=Se.current)?kc(f):null;if(!f)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ko(a.href),a=Vi(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=ko(a.href);var h=Vi(f).hoistableStyles,_=h.get(e);if(_||(f=f.ownerDocument||f,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,_),(h=f.querySelector(Dr(e)))&&!h._p&&(_.instance=h,_.state.loading=5),Yn.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},Yn.set(e,a),h||aT(f,e,a,_.state))),n&&l===null)throw Error(r(528,""));return _}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=So(a),a=Vi(f).hoistableScripts,l=a.get(n),l||(l={type:"script",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function ko(e){return'href="'+Pn(e)+'"'}function Dr(e){return'link[rel="stylesheet"]['+e+"]"}function V0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function aT(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}),ln(n,"link",a),Qt(n),e.head.appendChild(n))}function So(e){return'[src="'+Pn(e)+'"]'}function Rr(e){return"script[async]"+e}function q0(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Pn(a.href)+'"]');if(l)return n.instance=l,Qt(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Qt(l),ln(l,"style",f),Sc(l,a.precedence,e),n.instance=l;case"stylesheet":f=ko(a.href);var h=e.querySelector(Dr(f));if(h)return n.state.loading|=4,n.instance=h,Qt(h),h;l=V0(a),(f=Yn.get(f))&&$f(l,f),h=(e.ownerDocument||e).createElement("link"),Qt(h);var _=h;return _._p=new Promise(function(w,R){_.onload=w,_.onerror=R}),ln(h,"link",l),n.state.loading|=4,Sc(h,a.precedence,e),n.instance=h;case"script":return h=So(a.src),(f=e.querySelector(Rr(h)))?(n.instance=f,Qt(f),f):(l=a,(f=Yn.get(h))&&(l=b({},a),Uf(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),Qt(f),ln(f,"link",l),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,Sc(l,a.precedence,e));return n.instance}function Sc(e,n,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,_=0;_<l.length;_++){var w=l[_];if(w.dataset.precedence===n)h=w;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function $f(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Uf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Tc=null;function G0(e,n,a){if(Tc===null){var l=new Map,f=Tc=new Map;f.set(a,l)}else f=Tc,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var h=a[f];if(!(h[Ko]||h[Xe]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var _=h.getAttribute(n)||"";_=e+_;var w=l.get(_);w?w.push(h):l.set(_,[h])}}return l}function F0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function iT(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 Z0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function oT(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=ko(l.href),h=n.querySelector(Dr(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=jc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,Qt(h);return}h=n.ownerDocument||n,l=V0(l),(f=Yn.get(f))&&$f(l,f),h=h.createElement("link"),Qt(h);var _=h;_._p=new Promise(function(w,R){_.onload=w,_.onerror=R}),ln(h,"link",l),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=jc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Pf=0;function rT(e,n){return e.stylesheets&&e.count===0&&Nc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&Nc(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Pf===0&&(Pf=62500*PS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Nc(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Pf?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function jc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Nc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var wc=null;function Nc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,wc=new Map,n.forEach(lT,e),wc=null,jc.call(e))}function lT(e,n){if(!(n.state.loading&4)){var a=wc.get(e);if(a)var l=a.get(null);else{a=new Map,wc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var _=f[h];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(a.set(_.dataset.precedence,_),l=_)}l&&a.set(null,l)}f=n.instance,_=f.getAttribute("data-precedence"),h=a.get(_)||l,h===l&&a.set(null,f),a.set(_,f),this.count++,l=jc.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),h?h.parentNode.insertBefore(f,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var Mr={$$typeof:A,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function cT(e,n,a,l,f,h,_,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=H(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=H(0),this.hiddenUpdates=H(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function K0(e,n,a,l,f,h,_,w,R,q,ne,oe){return e=new cT(e,n,a,_,R,q,ne,oe,w),n=1,h===!0&&(n|=24),h=Nn(3,null,null,n),e.current=h,h.stateNode=e,n=bu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:a,cache:n},Su(h),e}function Y0(e){return e?(e=Qi,e):Qi}function J0(e,n,a,l,f,h){f=Y0(f),l.context===null?l.context=f:l.pendingContext=f,l=ba(n),l.payload={element:a},h=h===void 0?null:h,h!==null&&(l.callback=h),a=xa(e,l,n),a!==null&&(jn(a,e,n),ur(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 Hf(e,n){W0(e,n),(e=e.alternate)&&W0(e,n)}function X0(e){if(e.tag===13||e.tag===31){var n=ri(e,67108864);n!==null&&jn(n,e,67108864),Hf(e,67108864)}}function Q0(e){if(e.tag===13||e.tag===31){var n=Rn();n=_e(n);var a=ri(e,n);a!==null&&jn(a,e,n),Hf(e,n)}}var Cc=!0;function dT(e,n,a,l){var f=B.T;B.T=null;var h=F.p;try{F.p=2,Vf(e,n,a,l)}finally{F.p=h,B.T=f}}function uT(e,n,a,l){var f=B.T;B.T=null;var h=F.p;try{F.p=8,Vf(e,n,a,l)}finally{F.p=h,B.T=f}}function Vf(e,n,a,l){if(Cc){var f=qf(l);if(f===null)Ef(e,n,l,Ec,a),ty(e,l);else if(pT(f,e,n,a,l))l.stopPropagation();else if(ty(e,l),n&4&&-1<fT.indexOf(e)){for(;f!==null;){var h=Hi(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var _=bs(h.pendingLanes);if(_!==0){var w=h;for(w.pendingLanes|=2,w.entangledLanes|=2;_;){var R=1<<31-Xt(_);w.entanglements[1]|=R,_&=~R}Ts(h),(at&6)===0&&(uc=Jt()+500,Nr(0))}}break;case 31:case 13:w=ri(h,2),w!==null&&jn(w,h,2),pc(),Hf(h,2)}if(h=qf(l),h===null&&Ef(e,n,l,Ec,a),h===f)break;f=h}f!==null&&l.stopPropagation()}else Ef(e,n,l,null,a)}}function qf(e){return e=Gd(e),Gf(e)}var Ec=null;function Gf(e){if(Ec=null,e=Pi(e),e!==null){var n=d(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=u(n),e!==null)return e;e=null}else if(a===31){if(e=p(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Ec=e,null}function ey(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(Bi()){case ua:return 2;case Xa:return 8;case ys:case Li:return 32;case $n:return 268435456;default:return 32}default:return 32}}var Ff=!1,Da=null,Ra=null,Ma=null,Ir=new Map,Or=new Map,Ia=[],fT="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 ty(e,n){switch(e){case"focusin":case"focusout":Da=null;break;case"dragenter":case"dragleave":Ra=null;break;case"mouseover":case"mouseout":Ma=null;break;case"pointerover":case"pointerout":Ir.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Or.delete(n.pointerId)}}function Br(e,n,a,l,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:a,eventSystemFlags:l,nativeEvent:h,targetContainers:[f]},n!==null&&(n=Hi(n),n!==null&&X0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function pT(e,n,a,l,f){switch(n){case"focusin":return Da=Br(Da,e,n,a,l,f),!0;case"dragenter":return Ra=Br(Ra,e,n,a,l,f),!0;case"mouseover":return Ma=Br(Ma,e,n,a,l,f),!0;case"pointerover":var h=f.pointerId;return Ir.set(h,Br(Ir.get(h)||null,e,n,a,l,f)),!0;case"gotpointercapture":return h=f.pointerId,Or.set(h,Br(Or.get(h)||null,e,n,a,l,f)),!0}return!1}function ny(e){var n=Pi(e.target);if(n!==null){var a=d(n);if(a!==null){if(n=a.tag,n===13){if(n=u(a),n!==null){e.blockedOn=n,ht(e.priority,function(){Q0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,ht(e.priority,function(){Q0(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 Ac(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=qf(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);qd=l,a.target.dispatchEvent(l),qd=null}else return n=Hi(a),n!==null&&X0(n),e.blockedOn=a,!1;n.shift()}return!0}function sy(e,n,a){Ac(e)&&a.delete(n)}function mT(){Ff=!1,Da!==null&&Ac(Da)&&(Da=null),Ra!==null&&Ac(Ra)&&(Ra=null),Ma!==null&&Ac(Ma)&&(Ma=null),Ir.forEach(sy),Or.forEach(sy)}function Dc(e,n){e.blockedOn===n&&(e.blockedOn=null,Ff||(Ff=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,mT)))}var Rc=null;function ay(e){Rc!==e&&(Rc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Rc===e&&(Rc=null);for(var n=0;n<e.length;n+=3){var a=e[n],l=e[n+1],f=e[n+2];if(typeof l!="function"){if(Gf(l||a)===null)continue;break}var h=Hi(a);h!==null&&(e.splice(n,3),n-=3,Vu(h,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function To(e){function n(R){return Dc(R,e)}Da!==null&&Dc(Da,e),Ra!==null&&Dc(Ra,e),Ma!==null&&Dc(Ma,e),Ir.forEach(n),Or.forEach(n);for(var a=0;a<Ia.length;a++){var l=Ia[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ia.length&&(a=Ia[0],a.blockedOn===null);)ny(a),a.blockedOn===null&&Ia.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],h=a[l+1],_=f[ot]||null;if(typeof h=="function")_||ay(a);else if(_){var w=null;if(h&&h.hasAttribute("formAction")){if(f=h,_=h[ot]||null)w=_.formAction;else if(Gf(f)!==null)continue}else w=_.action;typeof w=="function"?a[l+1]=w:(a.splice(l,3),l-=3),ay(a)}}}function iy(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(_){return f=_})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Zf(e){this._internalRoot=e}Mc.prototype.render=Zf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,l=Rn();J0(a,l,e,n,null,null)},Mc.prototype.unmount=Zf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;J0(e.current,2,null,e,null,null),pc(),n[vt]=null}};function Mc(e){this._internalRoot=e}Mc.prototype.unstable_scheduleHydration=function(e){if(e){var n=We();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Ia.length&&n!==0&&n<Ia[a].priority;a++);Ia.splice(a,0,e),a===0&&ny(e)}};var oy=s.version;if(oy!=="19.2.4")throw Error(r(527,oy,"19.2.4"));F.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var hT={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ic=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ic.isDisabled&&Ic.supportsFiber)try{Wt=Ic.inject(hT),St=Ic}catch{}}return zr.createRoot=function(e,n){if(!c(e))throw Error(r(299));var a=!1,l="",f=pv,h=mv,_=hv;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(_=n.onRecoverableError)),n=K0(e,1,!1,null,null,a,l,null,f,h,_,iy),e[vt]=n.current,Cf(e),new Zf(n)},zr.hydrateRoot=function(e,n,a){if(!c(e))throw Error(r(299));var l=!1,f="",h=pv,_=mv,w=hv,R=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(_=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,h,_,w,iy),n.context=Y0(null),a=n.current,l=Rn(),l=_e(l),f=ba(l),f.callback=null,xa(a,f,l),a=l,n.current.lanes=a,se(n,a),Ts(n),e[vt]=n.current,Cf(e),new Mc(n)},zr.version="19.2.4",zr}var my;function GT(){if(my)return Kf.exports;my=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(),Kf.exports=qT(),Kf.exports}var FT=GT();const ZT="modulepreload",KT=function(t){return"/"+t},hy={},YT=function(s,o,r){let c=Promise.resolve();if(o&&o.length>0){let u=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),m=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=u(o.map(g=>{if(g=KT(g),g in hy)return;hy[g]=!0;const v=g.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const y=document.createElement("link");if(y.rel=v?"stylesheet":ZT,v||(y.as="script"),y.crossOrigin="",y.href=g,m&&y.setAttribute("nonce",m),document.head.appendChild(y),v)return new Promise((S,k)=>{y.addEventListener("load",S),y.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(u){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=u,window.dispatchEvent(p),!p.defaultPrevented)throw u}return c.then(u=>{for(const p of u||[])p.status==="rejected"&&d(p.reason);return s().catch(d)})},JT=new Proxy(globalThis.fetch,{apply(t,s,o){return Reflect.apply(globalThis.fetch,s,o)}}),wd=jT({baseUrl:"/",fetch:JT}),Qe=Sd(wT,wd),dn=Sd(NT,wd),Lc=Sd(CT,wd),zc=Sd(ET,wd),WT="_bar_1xhb4_1",XT="_input_1xhb4_32",QT="_select_1xhb4_67",e2="_btnPrimary_1xhb4_103",t2="_btnGhost_1xhb4_173",n2="_badge_1xhb4_195",s2="_disconnectHint_1xhb4_205",Mn={bar:WT,input:XT,select:QT,btnPrimary:e2,btnGhost:t2,badge:n2,disconnectHint:s2};function a2(t,s){if(!t)return!1;const o=s.find(r=>r.id===t);return o!==void 0&&(o.status==="disconnected"||o.status==="error")}function i2({environmentId:t,onReconnect:s}){return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:Mn.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),i.jsx("button",{type:"button",onClick:()=>s(t),className:Mn.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function al({mode:t,sessionId:s,environmentId:o,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:p,onSpawn:m,onStartTask:g,onProvisionEnvironment:v,onShowToast:b}){const[y,S]=x.useState(""),[k,j]=x.useState(""),N=a2(o,u),T=C=>{if(C.preventDefault(),!!y.trim())if(t==="send"){if(!s||N)return;p(s,y),S("")}else if(t==="spawn"){if(!o)return;m(o,y,k),b==null||b("Session started","success"),S(""),j("")}else{if(!r)return;g(r,void 0,o,y),S("")}};return t==="spawn"?i.jsxs("form",{onSubmit:T,className:Mn.bar,children:[i.jsx("span",{className:Mn.badge,children:"new chat"}),i.jsx("input",{type:"text",value:y,onChange:C=>S(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:Mn.input,"aria-label":"Enter prompt"}),c&&i.jsxs("select",{value:k,onChange:C=>j(C.target.value),className:Mn.select,"aria-label":"Select persona",children:[i.jsx("option",{value:"",children:"(Default)"}),d.map(C=>i.jsx("option",{value:C.id,children:C.name},C.id))]}),i.jsx("button",{type:"submit",disabled:!y.trim()||!o,className:Mn.btnPrimary,children:"Go"})]}):t==="start"?i.jsxs("form",{onSubmit:T,className:Mn.bar,children:[i.jsx("input",{type:"text",value:y,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:Mn.input,"aria-label":"Type a message"}),i.jsx("button",{type:"submit",disabled:!y.trim(),className:Mn.btnPrimary,children:"Send"})]}):i.jsxs("form",{onSubmit:T,className:Mn.bar,children:[N&&o&&i.jsx(i2,{environmentId:o,onReconnect:v}),i.jsx("input",{type:"text",value:y,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!N,disabled:N,className:Mn.input,"aria-label":"Type a message"}),i.jsx("span",{title:N?"Environment is unavailable — reconnect first":void 0,children:i.jsx("button",{type:"submit",disabled:!y.trim()||N,className:Mn.btnPrimary,children:"Send"})})]})}const gy=220,vy=70,o2=40,r2=60,l2="hierarchy",c2="dependency";function d2(t){return x.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new ry.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:o2,ranksep:r2});const o=new Map(t.map(u=>[u.id,u])),r=new Map;for(const u of t)if(u.parentTaskId&&o.has(u.parentTaskId)){const p=r.get(u.parentTaskId)||[];p.push(u),r.set(u.parentTaskId,p)}for(const u of t)s.setNode(u.id,{width:gy,height:vy});const c=[];for(const u of t){if(u.parentTaskId&&o.has(u.parentTaskId)){const p=`hierarchy-${u.parentTaskId}-${u.id}`;s.setEdge(u.parentTaskId,u.id,{},p),c.push({id:p,source:u.parentTaskId,target:u.id,type:"smoothstep",data:{edgeType:l2},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of u.dependsOn)if(o.has(p)){const m=`dependency-${p}-${u.id}`;s.setEdge(p,u.id,{},m),c.push({id:m,source:p,target:u.id,type:"smoothstep",data:{edgeType:c2},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return ry.layout(s),{nodes:t.map(u=>{const p=s.node(u.id),m=r.get(u.id)||[];return{id:u.id,type:"task",position:{x:p.x-gy/2,y:p.y-vy/2},data:{task:u,childCount:m.length,doneChildCount:m.filter(g=>g.status==="complete").length,hasDependencies:u.dependsOn.length>0}}}),edges:c}},[t])}/**
|
|
27
|
-
* @license lucide-react v0.474.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const u2=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),wx=(...t)=>t.filter((s,o,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===o).join(" ").trim();/**
|
|
32
|
-
* @license lucide-react v0.474.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/var f2={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 p2=x.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...p},m)=>x.createElement("svg",{ref:m,...f2,width:s,height:s,stroke:t,strokeWidth:r?Number(o)*24/Number(s):o,className:wx("lucide",c),...p},[...u.map(([g,v])=>x.createElement(g,v)),...Array.isArray(d)?d:[d]]));/**
|
|
42
|
-
* @license lucide-react v0.474.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const Ke=(t,s)=>{const o=x.forwardRef(({className:r,...c},d)=>x.createElement(p2,{ref:d,iconNode:s,className:wx(`lucide-${u2(t)}`,r),...c}));return o.displayName=`${t}`,o};/**
|
|
47
|
-
* @license lucide-react v0.474.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const m2=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],yy=Ke("ArrowDown",m2);/**
|
|
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 h2=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],by=Ke("ArrowUp",h2);/**
|
|
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 g2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],v2=Ke("Ban",g2);/**
|
|
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 y2=[["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"}]],b2=Ke("Brain",y2);/**
|
|
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 x2=[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],_2=Ke("CalendarClock",x2);/**
|
|
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 k2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ri=Ke("Check",k2);/**
|
|
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 S2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Nx=Ke("ChevronDown",S2);/**
|
|
82
|
-
* @license lucide-react v0.474.0 - ISC
|
|
83
|
-
*
|
|
84
|
-
* This source code is licensed under the ISC license.
|
|
85
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const T2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ra=Ke("ChevronRight",T2);/**
|
|
87
|
-
* @license lucide-react v0.474.0 - ISC
|
|
88
|
-
*
|
|
89
|
-
* This source code is licensed under the ISC license.
|
|
90
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const j2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Va=Ke("Circle",j2);/**
|
|
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 w2=[["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"}]],N2=Ke("ClipboardList",w2);/**
|
|
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 C2=[["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"}]],Cx=Ke("Clipboard",C2);/**
|
|
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 E2=[["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"}]],A2=Ke("Cog",E2);/**
|
|
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 D2=[["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"}]],R2=Ke("Copy",D2);/**
|
|
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 M2=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],I2=Ke("CornerDownRight",M2);/**
|
|
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 O2=[["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"}]],B2=Ke("FilePen",O2);/**
|
|
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 L2=[["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"}]],z2=Ke("FileText",L2);/**
|
|
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 $2=[["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"}]],U2=Ke("House",$2);/**
|
|
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 P2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],vm=Ke("Info",P2);/**
|
|
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 H2=[["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"}]],V2=Ke("Key",H2);/**
|
|
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 q2=[["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"}]],G2=Ke("Keyboard",q2);/**
|
|
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 F2=[["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"}]],Z2=Ke("ListChecks",F2);/**
|
|
152
|
-
* @license lucide-react v0.474.0 - ISC
|
|
153
|
-
*
|
|
154
|
-
* This source code is licensed under the ISC license.
|
|
155
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
-
*/const K2=[["path",{d:"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"}]],Y2=Ke("List",K2);/**
|
|
157
|
-
* @license lucide-react v0.474.0 - ISC
|
|
158
|
-
*
|
|
159
|
-
* This source code is licensed under the ISC license.
|
|
160
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
-
*/const J2=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],W2=Ke("Loader",J2);/**
|
|
162
|
-
* @license lucide-react v0.474.0 - ISC
|
|
163
|
-
*
|
|
164
|
-
* This source code is licensed under the ISC license.
|
|
165
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
-
*/const X2=[["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"}]],Q2=Ke("Menu",X2);/**
|
|
167
|
-
* @license lucide-react v0.474.0 - ISC
|
|
168
|
-
*
|
|
169
|
-
* This source code is licensed under the ISC license.
|
|
170
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
-
*/const ej=[["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"}]],tj=Ke("MessageSquare",ej);/**
|
|
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 nj=[["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"}]],sj=Ke("Monitor",nj);/**
|
|
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 aj=[["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"}]],ij=Ke("Palette",aj);/**
|
|
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 oj=[["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"}]],rj=Ke("Pause",oj);/**
|
|
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 lj=[["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"}]],cj=Ke("Pencil",lj);/**
|
|
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 dj=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Ex=Ke("Search",dj);/**
|
|
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 uj=[["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"}]],fj=Ke("Settings",uj);/**
|
|
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 pj=[["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"}]],mj=Ke("SquareCheckBig",pj);/**
|
|
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 hj=[["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"}]],ym=Ke("TriangleAlert",hj);/**
|
|
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 gj=[["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"}]],vj=Ke("User",gj);/**
|
|
217
|
-
* @license lucide-react v0.474.0 - ISC
|
|
218
|
-
*
|
|
219
|
-
* This source code is licensed under the ISC license.
|
|
220
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
-
*/const yj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ka=Ke("X",yj),bm=8,ct=12,nn=14,Rt=16,Pp={not_started:{color:"var(--text-tertiary)",icon:i.jsx(Va,{size:ct}),label:"Not Started"},working:{color:"var(--accent-green)",icon:i.jsx(Va,{size:ct,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:i.jsx(rj,{size:ct}),label:"Paused"},complete:{color:"var(--accent-green)",icon:i.jsx(Ri,{size:ct}),label:"Complete"},failed:{color:"var(--accent-red)",icon:i.jsx(Ka,{size:ct}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:i.jsx(v2,{size:ct}),label:"Blocked"}};function qa(t){return t==="blocked"?Pp.blocked:Pp[pl(t)]}const bj={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function xj(t){return bj[pl(t)]??"statusPending"}const _j=["working","paused","failed","not_started","blocked","complete"],xy=["not_started","working","paused","complete","failed"],kj={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function pl(t){return t in Pp&&t!=="blocked"?t:kj[t]??"not_started"}const Sj={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"},Tj="_dagContainer_js4w6_1",jj="_taskNode_js4w6_26",wj="_taskNodeBorder_js4w6_54",Nj="_taskNodeContent_js4w6_60",Cj="_taskNodeHeader_js4w6_70",Ej="_taskNodeIcon_js4w6_77",Aj="_taskNodeTitle_js4w6_82",Dj="_taskNodeBadges_js4w6_90",Rj="_childBadge_js4w6_95",Mj="_depBadge_js4w6_107",Ij="_handle_js4w6_119",Oj="_emptyCta_js4w6_126",Bj="_ctaDescription_js4w6_137",Lj="_ctaButton_js4w6_144",bn={dagContainer:Tj,taskNode:jj,taskNodeBorder:wj,taskNodeContent:Nj,taskNodeHeader:Cj,taskNodeIcon:Ej,taskNodeTitle:Aj,taskNodeBadges:Dj,childBadge:Rj,depBadge:Mj,handle:Ij,emptyCta:Oj,ctaDescription:Bj,ctaButton:Lj};function zj({data:t}){const{task:s,childCount:o,doneChildCount:r,hasDependencies:c}=t,d=qa(s.status);return i.jsxs("div",{className:bn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[i.jsx(ly,{type:"target",position:cy.Top,className:bn.handle}),i.jsx("div",{className:bn.taskNodeBorder,style:{backgroundColor:d.color}}),i.jsxs("div",{className:bn.taskNodeContent,children:[i.jsxs("div",{className:bn.taskNodeHeader,children:[i.jsx("span",{className:bn.taskNodeIcon,style:{color:d.color},children:d.icon}),i.jsx("span",{className:bn.taskNodeTitle,children:s.title})]}),i.jsxs("div",{className:bn.taskNodeBadges,children:[o>0&&i.jsxs("span",{className:bn.childBadge,children:[r,"/",o]}),c&&i.jsx("span",{className:bn.depBadge,children:"dep"})]})]}),i.jsx(ly,{type:"source",position:cy.Bottom,className:bn.handle})]})}/**
|
|
222
|
-
* react-router v7.13.2
|
|
223
|
-
*
|
|
224
|
-
* Copyright (c) Remix Software Inc.
|
|
225
|
-
*
|
|
226
|
-
* This source code is licensed under the MIT license found in the
|
|
227
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
228
|
-
*
|
|
229
|
-
* @license MIT
|
|
230
|
-
*/var _y="popstate";function ky(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function $j(t={}){function s(r,c){var g;let d=(g=c.state)==null?void 0:g.masked,{pathname:u,search:p,hash:m}=d||r.location;return Hp("",{pathname:u,search:p,hash:m},c.state&&c.state.usr||null,c.state&&c.state.key||"default",d?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function o(r,c){return typeof c=="string"?c:il(c)}return Pj(s,o,null,t)}function _t(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function ns(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function Uj(){return Math.random().toString(36).substring(2,10)}function Sy(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 Hp(t,s,o=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?Ho(s):s,state:o,key:s&&s.key||r||Uj(),unstable_mask:c}}function il({pathname:t="/",search:s="",hash:o=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),o&&o!=="#"&&(t+=o.charAt(0)==="#"?o:"#"+o),t}function Ho(t){let s={};if(t){let o=t.indexOf("#");o>=0&&(s.hash=t.substring(o),t=t.substring(0,o));let r=t.indexOf("?");r>=0&&(s.search=t.substring(r),t=t.substring(0,r)),t&&(s.pathname=t)}return s}function Pj(t,s,o,r={}){let{window:c=document.defaultView,v5Compat:d=!1}=r,u=c.history,p="POP",m=null,g=v();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function v(){return(u.state||{idx:null}).idx}function b(){p="POP";let N=v(),T=N==null?null:N-g;g=N,m&&m({action:p,location:j.location,delta:T})}function y(N,T){p="PUSH";let C=ky(N)?N:Hp(j.location,N,T);g=v()+1;let A=Sy(C,g),I=j.createHref(C.unstable_mask||C);try{u.pushState(A,"",I)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;c.location.assign(I)}d&&m&&m({action:p,location:j.location,delta:1})}function S(N,T){p="REPLACE";let C=ky(N)?N:Hp(j.location,N,T);g=v();let A=Sy(C,g),I=j.createHref(C.unstable_mask||C);u.replaceState(A,"",I),d&&m&&m({action:p,location:j.location,delta:0})}function k(N){return Hj(N)}let j={get action(){return p},get location(){return t(c,u)},listen(N){if(m)throw new Error("A history only accepts one active listener");return c.addEventListener(_y,b),m=N,()=>{c.removeEventListener(_y,b),m=null}},createHref(N){return s(c,N)},createURL:k,encodeLocation(N){let T=k(N);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:y,replace:S,go(N){return u.go(N)}};return j}function Hj(t,s=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),_t(o,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:il(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=o+r),new URL(r,o)}function Ax(t,s,o="/"){return Vj(t,s,o,!1)}function Vj(t,s,o,r){let c=typeof s=="string"?Ho(s):s,d=sa(c.pathname||"/",o);if(d==null)return null;let u=Dx(t);qj(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=Mx(d);p=Qj(u[m],g,r)}return p}function Dx(t,s=[],o=[],r="",c=!1){let d=(u,p,m=c,g)=>{let v={relativePath:g===void 0?u.path||"":g,caseSensitive:u.caseSensitive===!0,childrenIndex:p,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(r)&&m)return;_t(v.relativePath.startsWith(r),`Absolute route path "${v.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(r.length)}let b=Cs([r,v.relativePath]),y=o.concat(v);u.children&&u.children.length>0&&(_t(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),Dx(u.children,s,y,b,m)),!(u.path==null&&!u.index)&&s.push({path:b,score:Wj(b,u.index),routesMeta:y})};return t.forEach((u,p)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))d(u,p);else for(let g of Rx(u.path))d(u,p,!0,g)}),s}function Rx(t){let s=t.split("/");if(s.length===0)return[];let[o,...r]=s,c=o.endsWith("?"),d=o.replace(/\?$/,"");if(r.length===0)return c?[d,""]:[d];let u=Rx(r.join("/")),p=[];return p.push(...u.map(m=>m===""?d:[d,m].join("/"))),c&&p.push(...u),p.map(m=>t.startsWith("/")&&m===""?"/":m)}function qj(t){t.sort((s,o)=>s.score!==o.score?o.score-s.score:Xj(s.routesMeta.map(r=>r.childrenIndex),o.routesMeta.map(r=>r.childrenIndex)))}var Gj=/^:[\w-]+$/,Fj=3,Zj=2,Kj=1,Yj=10,Jj=-2,Ty=t=>t==="*";function Wj(t,s){let o=t.split("/"),r=o.length;return o.some(Ty)&&(r+=Jj),s&&(r+=Zj),o.filter(c=>!Ty(c)).reduce((c,d)=>c+(Gj.test(d)?Fj:d===""?Kj:Yj),r)}function Xj(t,s){return t.length===s.length&&t.slice(0,-1).every((r,c)=>r===s[c])?t[t.length-1]-s[s.length-1]:0}function Qj(t,s,o=!1){let{routesMeta:r}=t,c={},d="/",u=[];for(let p=0;p<r.length;++p){let m=r[p],g=p===r.length-1,v=d==="/"?s:s.slice(d.length)||"/",b=ol({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),y=m.route;if(!b&&g&&o&&!r[r.length-1].route.index&&(b=ol({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),u.push({params:c,pathname:Cs([d,b.pathname]),pathnameBase:aw(Cs([d,b.pathnameBase])),route:y}),b.pathnameBase!=="/"&&(d=Cs([d,b.pathnameBase]))}return u}function ol(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[o,r]=ew(t.path,t.caseSensitive,t.end),c=s.match(o);if(!c)return null;let d=c[0],u=d.replace(/(.)\/+$/,"$1"),p=c.slice(1);return{params:r.reduce((g,{paramName:v,isOptional:b},y)=>{if(v==="*"){let k=p[y]||"";u=d.slice(0,d.length-k.length).replace(/(.)\/+$/,"$1")}const S=p[y];return b&&!S?g[v]=void 0:g[v]=(S||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function ew(t,s=!1,o=!0){ns(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,p,m,g,v)=>{if(r.push({paramName:p,isOptional:m!=null}),m){let b=v.charAt(g+u.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),r]}function Mx(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return ns(!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 sa(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let o=s.endsWith("/")?s.length-1:s.length,r=t.charAt(o);return r&&r!=="/"?null:t.slice(o)||"/"}var tw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function nw(t,s="/"){let{pathname:o,search:r="",hash:c=""}=typeof t=="string"?Ho(t):t,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=jy(o.substring(1),"/"):d=jy(o,s)):d=s,{pathname:d,search:iw(r),hash:ow(c)}}function jy(t,s){let o=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?o.length>1&&o.pop():c!=="."&&o.push(c)}),o.length>1?o.join("/"):"/"}function Wf(t,s,o,r){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function sw(t){return t.filter((s,o)=>o===0||s.route.path&&s.route.path.length>0)}function xm(t){let s=sw(t);return s.map((o,r)=>r===s.length-1?o.pathname:o.pathnameBase)}function Nd(t,s,o,r=!1){let c;typeof t=="string"?c=Ho(t):(c={...t},_t(!c.pathname||!c.pathname.includes("?"),Wf("?","pathname","search",c)),_t(!c.pathname||!c.pathname.includes("#"),Wf("#","pathname","hash",c)),_t(!c.search||!c.search.includes("#"),Wf("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,p;if(u==null)p=o;else{let b=s.length-1;if(!r&&u.startsWith("..")){let y=u.split("/");for(;y[0]==="..";)y.shift(),b-=1;c.pathname=y.join("/")}p=b>=0?s[b]:"/"}let m=nw(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&o.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var Cs=t=>t.join("/").replace(/\/\/+/g,"/"),aw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),iw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,ow=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,rw=class{constructor(t,s,o,r=!1){this.status=t,this.statusText=s||"",this.internal=r,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function lw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function cw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Ix=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ox(t,s){let o=t;if(typeof o!="string"||!tw.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let r=o,c=!1;if(Ix)try{let d=new URL(window.location.href),u=o.startsWith("//")?new URL(d.protocol+o):new URL(o),p=sa(u.pathname,s);u.origin===d.origin&&p!=null?o=p+u.search+u.hash:c=!0}catch{ns(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:c,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Bx=["POST","PUT","PATCH","DELETE"];new Set(Bx);var dw=["GET",...Bx];new Set(dw);var Vo=x.createContext(null);Vo.displayName="DataRouter";var Cd=x.createContext(null);Cd.displayName="DataRouterState";var uw=x.createContext(!1),Lx=x.createContext({isTransitioning:!1});Lx.displayName="ViewTransition";var fw=x.createContext(new Map);fw.displayName="Fetchers";var pw=x.createContext(null);pw.displayName="Await";var Ln=x.createContext(null);Ln.displayName="Navigation";var ml=x.createContext(null);ml.displayName="Location";var ss=x.createContext({outlet:null,matches:[],isDataRoute:!1});ss.displayName="Route";var _m=x.createContext(null);_m.displayName="RouteError";var zx="REACT_ROUTER_ERROR",mw="REDIRECT",hw="ROUTE_ERROR_RESPONSE";function gw(t){if(t.startsWith(`${zx}:${mw}:{`))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 vw(t){if(t.startsWith(`${zx}:${hw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new rw(s.status,s.statusText,s.data)}catch{}}function yw(t,{relative:s}={}){_t(Mi(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:r}=x.useContext(Ln),{hash:c,pathname:d,search:u}=hl(t,{relative:s}),p=d;return o!=="/"&&(p=d==="/"?o:Cs([o,d])),r.createHref({pathname:p,search:u,hash:c})}function Mi(){return x.useContext(ml)!=null}function Yt(){return _t(Mi(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(ml).location}function At(t){_t(Mi(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Yt();return x.useMemo(()=>ol(t,Mx(s)),[s,t])}var $x="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ux(t){x.useContext(Ln).static||x.useLayoutEffect(t)}function Ed(){let{isDataRoute:t}=x.useContext(ss);return t?Mw():bw()}function bw(){_t(Mi(),"useNavigate() may be used only in the context of a <Router> component.");let t=x.useContext(Vo),{basename:s,navigator:o}=x.useContext(Ln),{matches:r}=x.useContext(ss),{pathname:c}=Yt(),d=JSON.stringify(xm(r)),u=x.useRef(!1);return Ux(()=>{u.current=!0}),x.useCallback((m,g={})=>{if(ns(u.current,$x),!u.current)return;if(typeof m=="number"){o.go(m);return}let v=Nd(m,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Cs([s,v.pathname])),(g.replace?o.replace:o.push)(v,g.state,g)},[s,o,d,c,t])}var xw=x.createContext(null);function _w(t){let s=x.useContext(ss).outlet;return x.useMemo(()=>s&&x.createElement(xw.Provider,{value:t},s),[s,t])}function as(){let{matches:t}=x.useContext(ss),s=t[t.length-1];return s?s.params:{}}function hl(t,{relative:s}={}){let{matches:o}=x.useContext(ss),{pathname:r}=Yt(),c=JSON.stringify(xm(o));return x.useMemo(()=>Nd(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function kw(t,s){return Px(t,s)}function Px(t,s,o){var N;_t(Mi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=x.useContext(Ln),{matches:c}=x.useContext(ss),d=c[c.length-1],u=d?d.params:{},p=d?d.pathname:"/",m=d?d.pathnameBase:"/",g=d&&d.route;{let T=g&&g.path||"";Vx(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.
|
|
231
|
-
|
|
232
|
-
Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let v=Yt(),b;if(s){let T=typeof s=="string"?Ho(s):s;_t(m==="/"||((N=T.pathname)==null?void 0:N.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${T.pathname}" was given in the \`location\` prop.`),b=T}else b=v;let y=b.pathname||"/",S=y;if(m!=="/"){let T=m.replace(/^\//,"").split("/");S="/"+y.replace(/^\//,"").split("/").slice(T.length).join("/")}let k=Ax(t,{pathname:S});ns(g||k!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),ns(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=Nw(k&&k.map(T=>Object.assign({},T,{params:Object.assign({},u,T.params),pathname:Cs([m,r.encodeLocation?r.encodeLocation(T.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?m:Cs([m,r.encodeLocation?r.encodeLocation(T.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),c,o);return s&&j?x.createElement(ml.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},j):j}function Sw(){let t=Rw(),s=lw(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),o=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:r},d={padding:"2px 4px",backgroundColor:r},u=null;return console.error("Error handled by React Router default ErrorBoundary:",t),u=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:d},"ErrorBoundary")," or"," ",x.createElement("code",{style:d},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},s),o?x.createElement("pre",{style:c},o):null,u)}var Tw=x.createElement(Sw,null),Hx=class extends x.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){this.props.onError?this.props.onError(t,s):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const o=vw(t.digest);o&&(t=o)}let s=t!==void 0?x.createElement(ss.Provider,{value:this.props.routeContext},x.createElement(_m.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?x.createElement(jw,{error:t},s):s}};Hx.contextType=uw;var Xf=new WeakMap;function jw({children:t,error:s}){let{basename:o}=x.useContext(Ln);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=gw(s.digest);if(r){let c=Xf.get(s);if(c)throw c;let d=Ox(r.location,o);if(Ix&&!Xf.get(s))if(d.isExternal||r.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:r.replace}));throw Xf.set(s,u),u}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function ww({routeContext:t,match:s,children:o}){let r=x.useContext(Vo);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),x.createElement(ss.Provider,{value:t},o)}function Nw(t,s=[],o){let r=o==null?void 0:o.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(s.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let c=t,d=r==null?void 0:r.errors;if(d!=null){let v=c.findIndex(b=>b.route.id&&(d==null?void 0:d[b.route.id])!==void 0);_t(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let u=!1,p=-1;if(o&&r){u=r.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=v),b.route.id){let{loaderData:y,errors:S}=r,k=b.route.loader&&!y.hasOwnProperty(b.route.id)&&(!S||S[b.route.id]===void 0);if(b.route.lazy||k){o.isStatic&&(u=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let m=o==null?void 0:o.onError,g=r&&m?(v,b)=>{var y,S;m(v,{location:r.location,params:((S=(y=r.matches)==null?void 0:y[0])==null?void 0:S.params)??{},unstable_pattern:cw(r.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,y)=>{let S,k=!1,j=null,N=null;r&&(S=d&&b.route.id?d[b.route.id]:void 0,j=b.route.errorElement||Tw,u&&(p<0&&y===0?(Vx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,N=null):p===y&&(k=!0,N=b.route.hydrateFallbackElement||null)));let T=s.concat(c.slice(0,y+1)),C=()=>{let A;return S?A=j:k?A=N:b.route.Component?A=x.createElement(b.route.Component,null):b.route.element?A=b.route.element:A=v,x.createElement(ww,{match:b,routeContext:{outlet:v,matches:T,isDataRoute:r!=null},children:A})};return r&&(b.route.ErrorBoundary||b.route.errorElement||y===0)?x.createElement(Hx,{location:r.location,revalidation:r.revalidation,component:j,error:S,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:g}):C()},null)}function km(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Cw(t){let s=x.useContext(Vo);return _t(s,km(t)),s}function Ew(t){let s=x.useContext(Cd);return _t(s,km(t)),s}function Aw(t){let s=x.useContext(ss);return _t(s,km(t)),s}function Sm(t){let s=Aw(t),o=s.matches[s.matches.length-1];return _t(o.route.id,`${t} can only be used on routes that contain a unique "id"`),o.route.id}function Dw(){return Sm("useRouteId")}function Rw(){var r;let t=x.useContext(_m),s=Ew("useRouteError"),o=Sm("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[o]}function Mw(){let{router:t}=Cw("useNavigate"),s=Sm("useNavigate"),o=x.useRef(!1);return Ux(()=>{o.current=!0}),x.useCallback(async(c,d={})=>{ns(o.current,$x),o.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var wy={};function Vx(t,s,o){!s&&!wy[t]&&(wy[t]=!0,ns(!1,o))}x.memo(Iw);function Iw({routes:t,future:s,state:o,isStatic:r,onError:c}){return Px(t,void 0,{state:o,isStatic:r,onError:c})}function ts({to:t,replace:s,state:o,relative:r}){_t(Mi(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=x.useContext(Ln);ns(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=x.useContext(ss),{pathname:u}=Yt(),p=Ed(),m=Nd(t,xm(d),u,r==="path"),g=JSON.stringify(m);return x.useEffect(()=>{p(JSON.parse(g),{replace:s,state:o,relative:r})},[p,g,r,s,o]),null}function Ya(t){return _w(t.context)}function Ne(t){_t(!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 Ow({basename:t="/",children:s=null,location:o,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){_t(!Mi(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=t.replace(/^\/*/,"/"),m=x.useMemo(()=>({basename:p,navigator:c,static:d,unstable_useTransitions:u,future:{}}),[p,c,d,u]);typeof o=="string"&&(o=Ho(o));let{pathname:g="/",search:v="",hash:b="",state:y=null,key:S="default",unstable_mask:k}=o,j=x.useMemo(()=>{let N=sa(g,p);return N==null?null:{location:{pathname:N,search:v,hash:b,state:y,key:S,unstable_mask:k},navigationType:r}},[p,g,v,b,y,S,r,k]);return ns(j!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${b}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:x.createElement(Ln.Provider,{value:m},x.createElement(ml.Provider,{children:s,value:j}))}function Bw({children:t,location:s}){return kw(Vp(t),s)}function Vp(t,s=[]){let o=[];return x.Children.forEach(t,(r,c)=>{if(!x.isValidElement(r))return;let d=[...s,c];if(r.type===x.Fragment){o.push.apply(o,Vp(r.props.children,d));return}_t(r.type===Ne,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),_t(!r.props.index||!r.props.children,"An index route cannot have child routes.");let u={id:r.props.id||d.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(u.children=Vp(r.props.children,d)),o.push(u)}),o}var ed="get",td="application/x-www-form-urlencoded";function Ad(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function Lw(t){return Ad(t)&&t.tagName.toLowerCase()==="button"}function zw(t){return Ad(t)&&t.tagName.toLowerCase()==="form"}function $w(t){return Ad(t)&&t.tagName.toLowerCase()==="input"}function Uw(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Pw(t,s){return t.button===0&&(!s||s==="_self")&&!Uw(t)}function qp(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((s,o)=>{let r=t[o];return s.concat(Array.isArray(r)?r.map(c=>[o,c]):[[o,r]])},[]))}function Hw(t,s){let o=qp(t);return s&&s.forEach((r,c)=>{o.has(c)||s.getAll(c).forEach(d=>{o.append(c,d)})}),o}var $c=null;function Vw(){if($c===null)try{new FormData(document.createElement("form"),0),$c=!1}catch{$c=!0}return $c}var qw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Qf(t){return t!=null&&!qw.has(t)?(ns(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${td}"`),null):t}function Gw(t,s){let o,r,c,d,u;if(zw(t)){let p=t.getAttribute("action");r=p?sa(p,s):null,o=t.getAttribute("method")||ed,c=Qf(t.getAttribute("enctype"))||td,d=new FormData(t)}else if(Lw(t)||$w(t)&&(t.type==="submit"||t.type==="image")){let p=t.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=t.getAttribute("formaction")||p.getAttribute("action");if(r=m?sa(m,s):null,o=t.getAttribute("formmethod")||p.getAttribute("method")||ed,c=Qf(t.getAttribute("formenctype"))||Qf(p.getAttribute("enctype"))||td,d=new FormData(p,t),!Vw()){let{name:g,type:v,value:b}=t;if(v==="image"){let y=g?`${g}.`:"";d.append(`${y}x`,"0"),d.append(`${y}y`,"0")}else g&&d.append(g,b)}}else{if(Ad(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=ed,r=null,c=td,u=t}return d&&c==="text/plain"&&(u=d,d=void 0),{action:r,method:o.toLowerCase(),encType:c,formData:d,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Tm(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Fw(t,s,o,r){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return o?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${r}`:c.pathname=`${c.pathname}.${r}`:c.pathname==="/"?c.pathname=`_root.${r}`:s&&sa(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function Zw(t,s){if(t.id in s)return s[t.id];try{let o=await import(t.module);return s[t.id]=o,o}catch(o){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Kw(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 Yw(t,s,o){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await Zw(d,o);return u.links?u.links():[]}return[]}));return Qw(r.flat(1).filter(Kw).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Ny(t,s,o,r,c,d){let u=(m,g)=>o[g]?m.route.id!==o[g].route.id:!0,p=(m,g)=>{var v;return o[g].pathname!==m.pathname||((v=o[g].route.path)==null?void 0:v.endsWith("*"))&&o[g].params["*"]!==m.params["*"]};return d==="assets"?s.filter((m,g)=>u(m,g)||p(m,g)):d==="data"?s.filter((m,g)=>{var b;let v=r.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(u(m,g)||p(m,g))return!0;if(m.route.shouldRevalidate){let y=m.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((b=o[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function Jw(t,s,{includeHydrateFallback:o}={}){return Ww(t.map(r=>{let c=s.routes[r.route.id];if(!c)return[];let d=[c.module];return c.clientActionModule&&(d=d.concat(c.clientActionModule)),c.clientLoaderModule&&(d=d.concat(c.clientLoaderModule)),o&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function Ww(t){return[...new Set(t)]}function Xw(t){let s={},o=Object.keys(t).sort();for(let r of o)s[r]=t[r];return s}function Qw(t,s){let o=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(Xw(c));return o.has(d)||(o.add(d),r.push({key:d,link:c})),r},[])}function qx(){let t=x.useContext(Vo);return Tm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function eN(){let t=x.useContext(Cd);return Tm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var jm=x.createContext(void 0);jm.displayName="FrameworkContext";function Gx(){let t=x.useContext(jm);return Tm(t,"You must render this element inside a <HydratedRouter> element"),t}function tN(t,s){let o=x.useContext(jm),[r,c]=x.useState(!1),[d,u]=x.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:v,onTouchStart:b}=s,y=x.useRef(null);x.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let j=T=>{T.forEach(C=>{u(C.isIntersecting)})},N=new IntersectionObserver(j,{threshold:.5});return y.current&&N.observe(y.current),()=>{N.disconnect()}}},[t]),x.useEffect(()=>{if(r){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[r]);let S=()=>{c(!0)},k=()=>{c(!1),u(!1)};return o?t!=="intent"?[d,y,{}]:[d,y,{onFocus:$r(p,S),onBlur:$r(m,k),onMouseEnter:$r(g,S),onMouseLeave:$r(v,k),onTouchStart:$r(b,S)}]:[!1,y,{}]}function $r(t,s){return o=>{t&&t(o),o.defaultPrevented||s(o)}}function nN({page:t,...s}){let{router:o}=qx(),r=x.useMemo(()=>Ax(o.routes,t,o.basename),[o.routes,t,o.basename]);return r?x.createElement(aN,{page:t,matches:r,...s}):null}function sN(t){let{manifest:s,routeModules:o}=Gx(),[r,c]=x.useState([]);return x.useEffect(()=>{let d=!1;return Yw(t,s,o).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,o]),r}function aN({page:t,matches:s,...o}){let r=Yt(),{future:c,manifest:d,routeModules:u}=Gx(),{basename:p}=qx(),{loaderData:m,matches:g}=eN(),v=x.useMemo(()=>Ny(t,s,g,d,r,"data"),[t,s,g,d,r]),b=x.useMemo(()=>Ny(t,s,g,d,r,"assets"),[t,s,g,d,r]),y=x.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let j=new Set,N=!1;if(s.forEach(C=>{var I;let A=d.routes[C.route.id];!A||!A.hasLoader||(!v.some(E=>E.route.id===C.route.id)&&C.route.id in m&&((I=u[C.route.id])!=null&&I.shouldRevalidate)||A.hasClientLoader?N=!0:j.add(C.route.id))}),j.size===0)return[];let T=Fw(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return N&&j.size>0&&T.searchParams.set("_routes",s.filter(C=>j.has(C.route.id)).map(C=>C.route.id).join(",")),[T.pathname+T.search]},[p,c.unstable_trailingSlashAwareDataRequests,m,r,d,v,s,t,u]),S=x.useMemo(()=>Jw(b,d),[b,d]),k=sN(b);return x.createElement(x.Fragment,null,y.map(j=>x.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...o})),S.map(j=>x.createElement("link",{key:j,rel:"modulepreload",href:j,...o})),k.map(({key:j,link:N})=>x.createElement("link",{key:j,nonce:o.nonce,...N,crossOrigin:N.crossOrigin??o.crossOrigin})))}function iN(...t){return s=>{t.forEach(o=>{typeof o=="function"?o(s):o!=null&&(o.current=s)})}}var oN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{oN&&(window.__reactRouterVersion="7.13.2")}catch{}function rN({basename:t,children:s,unstable_useTransitions:o,window:r}){let c=x.useRef();c.current==null&&(c.current=$j({window:r,v5Compat:!0}));let d=c.current,[u,p]=x.useState({action:d.action,location:d.location}),m=x.useCallback(g=>{o===!1?p(g):x.startTransition(()=>p(g))},[o]);return x.useLayoutEffect(()=>d.listen(m),[d,m]),x.createElement(Ow,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:o})}var Fx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wm=x.forwardRef(function({onClick:s,discover:o="render",prefetch:r="none",relative:c,reloadDocument:d,replace:u,unstable_mask:p,state:m,target:g,to:v,preventScrollReset:b,viewTransition:y,unstable_defaultShouldRevalidate:S,...k},j){let{basename:N,navigator:T,unstable_useTransitions:C}=x.useContext(Ln),A=typeof v=="string"&&Fx.test(v),I=Ox(v,N);v=I.to;let E=yw(v,{relative:c}),D=Yt(),P=null;if(p){let X=Nd(p,[],D.unstable_mask?D.unstable_mask.pathname:"/",!0);N!=="/"&&(X.pathname=X.pathname==="/"?N:Cs([N,X.pathname])),P=T.createHref(X)}let[O,z,Q]=tN(r,k),$=uN(v,{replace:u,unstable_mask:p,state:m,target:g,preventScrollReset:b,relative:c,viewTransition:y,unstable_defaultShouldRevalidate:S,unstable_useTransitions:C});function J(X){s&&s(X),X.defaultPrevented||$(X)}let me=!(I.isExternal||d),te=x.createElement("a",{...k,...Q,href:(me?P:void 0)||I.absoluteURL||E,onClick:me?J:s,ref:iN(j,z),target:g,"data-discover":!A&&o==="render"?"true":void 0});return O&&!A?x.createElement(x.Fragment,null,te,x.createElement(nN,{page:E})):te});wm.displayName="Link";var lN=x.forwardRef(function({"aria-current":s="page",caseSensitive:o=!1,className:r="",end:c=!1,style:d,to:u,viewTransition:p,children:m,...g},v){let b=hl(u,{relative:g.relative}),y=Yt(),S=x.useContext(Cd),{navigator:k,basename:j}=x.useContext(Ln),N=S!=null&&gN(b)&&p===!0,T=k.encodeLocation?k.encodeLocation(b).pathname:b.pathname,C=y.pathname,A=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;o||(C=C.toLowerCase(),A=A?A.toLowerCase():null,T=T.toLowerCase()),A&&j&&(A=sa(A,j)||A);const I=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let E=C===T||!c&&C.startsWith(T)&&C.charAt(I)==="/",D=A!=null&&(A===T||!c&&A.startsWith(T)&&A.charAt(T.length)==="/"),P={isActive:E,isPending:D,isTransitioning:N},O=E?s:void 0,z;typeof r=="function"?z=r(P):z=[r,E?"active":null,D?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let Q=typeof d=="function"?d(P):d;return x.createElement(wm,{...g,"aria-current":O,className:z,ref:v,style:Q,to:u,viewTransition:p},typeof m=="function"?m(P):m)});lN.displayName="NavLink";var cN=x.forwardRef(({discover:t="render",fetcherKey:s,navigate:o,reloadDocument:r,replace:c,state:d,method:u=ed,action:p,onSubmit:m,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:y,...S},k)=>{let{unstable_useTransitions:j}=x.useContext(Ln),N=mN(),T=hN(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",A=typeof p=="string"&&Fx.test(p),I=E=>{if(m&&m(E),E.defaultPrevented)return;E.preventDefault();let D=E.nativeEvent.submitter,P=(D==null?void 0:D.getAttribute("formmethod"))||u,O=()=>N(D||E.currentTarget,{fetcherKey:s,method:P,navigate:o,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:y});j&&o!==!1?x.startTransition(()=>O()):O()};return x.createElement("form",{ref:k,method:C,action:T,onSubmit:r?m:I,...S,"data-discover":!A&&t==="render"?"true":void 0})});cN.displayName="Form";function dN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Zx(t){let s=x.useContext(Vo);return _t(s,dN(t)),s}function uN(t,{target:s,replace:o,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:g}={}){let v=Ed(),b=Yt(),y=hl(t,{relative:u});return x.useCallback(S=>{if(Pw(S,s)){S.preventDefault();let k=o!==void 0?o:il(b)===il(y),j=()=>v(t,{replace:k,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m});g?x.startTransition(()=>j()):j()}},[b,v,y,o,r,c,s,t,d,u,p,m,g])}function Nm(t){ns(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=x.useRef(qp(t)),o=x.useRef(!1),r=Yt(),c=x.useMemo(()=>Hw(r.search,o.current?null:s.current),[r.search]),d=Ed(),u=x.useCallback((p,m)=>{const g=qp(typeof p=="function"?p(new URLSearchParams(c)):p);o.current=!0,d("?"+g,m)},[d,c]);return[c,u]}var fN=0,pN=()=>`__${String(++fN)}__`;function mN(){let{router:t}=Zx("useSubmit"),{basename:s}=x.useContext(Ln),o=Dw(),r=t.fetch,c=t.navigate;return x.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:b}=Gw(d,s);if(u.navigate===!1){let y=u.fetcherKey||pN();await r(y,o,u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||g,flushSync:u.flushSync})}else await c(u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||g,replace:u.replace,state:u.state,fromRouteId:o,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,c,s,o])}function hN(t,{relative:s}={}){let{basename:o}=x.useContext(Ln),r=x.useContext(ss);_t(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...hl(t||".",{relative:s})},u=Yt();if(t==null){d.search=u.search;let p=new URLSearchParams(d.search),m=p.getAll("index");if(m.some(v=>v==="")){p.delete("index"),m.filter(b=>b).forEach(b=>p.append("index",b));let v=p.toString();d.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(d.pathname=d.pathname==="/"?o:Cs([o,d.pathname])),il(d)}function gN(t,{relative:s}={}){let o=x.useContext(Lx);_t(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Zx("useViewTransitionState"),c=hl(t,{relative:s});if(!o.isTransitioning)return!1;let d=sa(o.currentLocation.pathname,r)||o.currentLocation.pathname,u=sa(o.nextLocation.pathname,r)||o.nextLocation.pathname;return ol(c.pathname,u)!=null||ol(c.pathname,d)!=null}function mt(){const t=Ed();return x.useCallback((s,o)=>{typeof s=="number"?t(s):t(s,o)},[t])}function Cm(t){return`/sessions/${encodeURIComponent(t)}`}function Ga(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function On(t,s,o,r){const c=encodeURIComponent(t);let d;return o&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(o)}/tasks/${c}`:o?d=`/workspaces/${encodeURIComponent(o)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function Ii(t,s,o){const r=new URLSearchParams;t&&r.set("workspace",t),s&&r.set("parent",s);const c=r.toString();if(t&&o){const d=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${d}?parent=${encodeURIComponent(s)}`:d}return c?`/tasks/new?${c}`:"/tasks/new"}function Kx(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const Io="/environments",vN="/environments/new";function Ai(t){return`/environments/${encodeURIComponent(t)}`}function yN(t){return`/environments/${encodeURIComponent(t)}/edit`}const Ni="/settings",bN="/settings/credentials",ep="/settings/personas",xN="/settings/personas/new";function Yx(t){return`/settings/personas/${encodeURIComponent(t)}`}const tp="/settings/schedules",_N="/settings/schedules/new";function Jx(t){return`/settings/schedules/${encodeURIComponent(t)}`}const kN="/settings/shortcuts",SN="/pair",TN="/chat",Di="/",jN="/tasks",Wx="/workspaces/new",Xx="/knowledge",Dd="/findings";function wN(t,s){return t&&s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}/findings`:Dd}function Gp(t,s,o){const r=encodeURIComponent(t);return s&&o?`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(s)}/findings/${r}`:`/findings/${r}`}const NN=Sj,CN={task:zj};function EN({workspaceId:t,environmentId:s,tasks:o,resolvedThemeId:r}){const c=mt(),d=x.useMemo(()=>o.filter(b=>b.workspaceId===t),[o,t]),{nodes:u,edges:p}=d2(d),m=x.useMemo(()=>{const b=getComputedStyle(document.documentElement),y={};for(const[S,k]of Object.entries(NN))y[S]=b.getPropertyValue(k).trim()||"#6b7a8d";return y},[r]),g=x.useCallback((b,y)=>{c(On(y.id,void 0,t,s))},[c,t,s]),v=x.useCallback(b=>{const y=b.data;return m[y.task.status]||m.pending},[m]);return d.length===0?i.jsxs("div",{className:bn.emptyCta,children:[i.jsx("button",{className:bn.ctaButton,onClick:()=>c(Ii(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:bn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):i.jsx("div",{className:bn.dagContainer,children:i.jsxs(bT,{nodes:u,edges:p,nodeTypes:CN,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[i.jsx(xT,{variant:_T.Dots,gap:24,size:1,color:"var(--text-disabled)"}),i.jsx(kT,{showInteractive:!1}),i.jsx(ST,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const AN="_breadcrumbs_17or2_1",DN="_list_17or2_11",RN="_item_17or2_21",MN="_separator_17or2_28",IN="_link_17or2_34",ON="_current_17or2_57",jo={breadcrumbs:AN,list:DN,item:RN,separator:MN,link:IN,current:ON};function vs({segments:t}){return i.jsx("nav",{className:jo.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:i.jsx("ol",{className:jo.list,children:t.map((s,o)=>{const r=o===t.length-1;return i.jsxs("li",{className:jo.item,children:[o>0&&i.jsx("span",{className:jo.separator,"aria-hidden":"true",children:i.jsx(ra,{size:ct})}),s.url&&!r?i.jsx(wm,{className:jo.link,to:s.url,title:s.label,children:s.label}):i.jsx("span",{className:jo.current,"aria-current":"page",title:s.label,children:s.label})]},o)})})})}const BN="_btn_dwk2o_1",LN="_sm_dwk2o_22",zN="_md_dwk2o_28",$N="_lg_dwk2o_34",UN="_primary_dwk2o_40",PN="_danger_dwk2o_55",HN="_outline_dwk2o_70",VN="_ghost_dwk2o_80",np={btn:BN,sm:LN,md:zN,lg:$N,primary:UN,danger:PN,outline:HN,ghost:VN},tn=x.forwardRef(function({variant:s="primary",size:o="md",className:r,children:c,...d},u){const p=[np.btn,np[s],np[o],r].filter(Boolean).join(" ");return i.jsx("button",{ref:u,className:p,...d,children:c})}),qN="_copyButton_1bqk0_1",GN={copyButton:qN},FN=2e3;function ZN({text:t,className:s,"data-testid":o}){const[r,c]=x.useState(!1),d=x.useRef(void 0);x.useEffect(()=>()=>{d.current!==void 0&&clearTimeout(d.current)},[]);const u=x.useCallback(async()=>{try{await navigator.clipboard.writeText(t),c(!0),d.current!==void 0&&clearTimeout(d.current),d.current=setTimeout(()=>{c(!1),d.current=void 0},FN)}catch{}},[t]);return i.jsx("button",{type:"button",className:`${GN.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":o??"copy-button",children:r?i.jsx(Ri,{size:nn,"aria-hidden":"true"}):i.jsx(Cx,{size:nn,"aria-hidden":"true"})})}const KN="_banner_bxqlh_1",YN="_label_bxqlh_15",JN="_text_bxqlh_25",WN="_link_bxqlh_29",Uc={banner:KN,label:YN,text:JN,link:WN};function XN(){return i.jsxs("div",{className:Uc.banner,"data-testid":"demo-banner",children:[i.jsx("span",{className:Uc.label,children:"DEMO"}),i.jsxs("span",{className:Uc.text,children:["This is an interactive demo with mock data."," ",i.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:Uc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const QN="_container_og0yp_1",eC="_chevronButton_og0yp_6",tC="_mainButton_og0yp_6",nC="_sm_og0yp_34",sC="_md_og0yp_34",aC="_lg_og0yp_34",iC="_primary_og0yp_57",oC="_danger_og0yp_70",rC="_outline_og0yp_83",lC="_ghost_og0yp_92",cC="_dropdown_og0yp_100",dC="_option_og0yp_113",uC="_optionLabel_og0yp_130",fC="_optionDesc_og0yp_135",Js={container:QN,chevronButton:eC,mainButton:tC,sm:nC,md:sC,lg:aC,primary:iC,danger:oC,outline:rC,ghost:lC,dropdown:cC,option:dC,optionLabel:uC,optionDesc:fC};function Qx({label:t,onClick:s,options:o,variant:r="primary",size:c="md","data-testid":d}){const[u,p]=x.useState(!1),m=x.useRef(null);x.useEffect(()=>{if(!u)return;function y(S){m.current&&S.target instanceof Node&&!m.current.contains(S.target)&&p(!1)}return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[u]),x.useEffect(()=>{if(!u)return;function y(S){S.key==="Escape"&&p(!1)}return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[u]);const g=Js[r]||"",v=Js[c]||"",b=()=>{u&&p(!1),s()};return i.jsxs("div",{ref:m,className:Js.container,"data-testid":d,children:[i.jsx("button",{type:"button",className:`${Js.mainButton} ${g} ${v}`,onClick:b,"data-testid":d?`${d}-main`:void 0,children:t}),i.jsx("button",{type:"button",className:`${Js.chevronButton} ${g} ${v}`,onClick:()=>p(y=>!y),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:i.jsx(Nx,{size:nn,"aria-hidden":"true"})}),u&&i.jsx("div",{className:Js.dropdown,"data-testid":d?`${d}-menu`:void 0,children:o.map((y,S)=>i.jsxs("button",{type:"button",className:Js.option,onClick:()=>{y.onClick(),p(!1)},children:[i.jsx("span",{className:Js.optionLabel,children:y.label}),y.description&&i.jsx("span",{className:Js.optionDesc,children:y.description})]},S))})]})}function Fp(){Fp=function(c,d){return new o(c,void 0,d)};var t=RegExp.prototype,s=new WeakMap;function o(c,d,u){var p=new RegExp(c,d);return s.set(p,u||s.get(c)),cd(p,o.prototype)}function r(c,d){var u=s.get(d);return Object.keys(u).reduce(function(p,m){var g=u[m];if(typeof g=="number")p[m]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;p[m]=c[g[v]]}return p},Object.create(null))}return(function(c,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(d&&d.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),d&&cd(c,d)})(o,RegExp),o.prototype.exec=function(c){var d=t.exec.call(this,c);if(d){d.groups=r(d,this);var u=d.indices;u&&(u.groups=r(u,this))}return d},o.prototype[Symbol.replace]=function(c,d){if(typeof d=="string"){var u=s.get(this);return t[Symbol.replace].call(this,c,d.replace(/\$<([^>]+)>/g,function(m,g){var v=u[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof d=="function"){var p=this;return t[Symbol.replace].call(this,c,function(){var m=arguments;return typeof m[m.length-1]!="object"&&(m=[].slice.call(m)).push(r(m,p)),d.apply(this,m)})}return t[Symbol.replace].call(this,c,d)},Fp.apply(this,arguments)}function cd(t,s){return cd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},cd(t,s)}function Cy(t,s){(s==null||s>t.length)&&(s=t.length);for(var o=0,r=new Array(s);o<s;o++)r[o]=t[o];return r}function sp(t,s){var o=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(o)return(o=o.call(t)).next.bind(o);if(Array.isArray(t)||(o=(function(c,d){if(c){if(typeof c=="string")return Cy(c,d);var u=Object.prototype.toString.call(c).slice(8,-1);return u==="Object"&&c.constructor&&(u=c.constructor.name),u==="Map"||u==="Set"?Array.from(c):u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?Cy(c,d):void 0}})(t))||s){o&&(t=o);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
233
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var pC=(function(t){return function(s){return s===void 0&&(s={}),(function(r,c){if(c&&!r.registered(c))throw new Error('The default language "'+c+'" is not registered with refractor.')})(t,s.defaultLanguage),function(r){zT(r,"element",o)};function o(r,c,d){var u,p;if(d&&d.tagName==="pre"&&r.tagName==="code"){var m=(r==null||(u=r.data)==null?void 0:u.meta)||(r==null||(p=r.properties)==null?void 0:p.metastring)||"";r.properties.className?typeof r.properties.className=="boolean"?r.properties.className=[]:Array.isArray(r.properties.className)||(r.properties.className=[r.properties.className]):r.properties.className=[];var g,v,b=(function(E){for(var D,P=sp(E.properties.className);!(D=P()).done;){var O=D.value;if(O.slice(0,9)==="language-")return O.slice(9).toLowerCase()}return null})(r);if(!b&&s.defaultLanguage&&r.properties.className.push("language-"+(b=s.defaultLanguage)),r.properties.className.push("code-highlight"),b)try{var y,S;S=(y=b)!=null&&y.includes("diff-")?b.split("-")[1]:b,g=t.highlight(Bc(r),S),d.properties.className=(d.properties.className||[]).concat("language-"+S)}catch(E){if(!s.ignoreMissing||!/Unknown language/.test(E.message))throw E;g=r}else g=r;g.children=(v=1,function E(D){return D.reduce(function(P,O){if(O.type==="text"){var z=O.value,Q=(z.match(/\n/g)||"").length;if(Q===0)O.position={start:{line:v,column:1},end:{line:v,column:1}},P.push(O);else for(var $,J=z.split(`
|
|
234
|
-
`),me=sp(J.entries());!($=me()).done;){var te=$.value,X=te[0],B=te[1];P.push({type:"text",value:X===J.length-1?B:B+`
|
|
235
|
-
`,position:{start:{line:v+X,column:1},end:{line:v+X,column:1}}})}return v+=Q,P}if(Object.prototype.hasOwnProperty.call(O,"children")){var F=v;return O.children=E(O.children),P.push(O),O.position={start:{line:F,column:1},end:{line:v,column:1}},P}return P.push(O),P},[])})(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 k,j=(function(E){var D=/{([\d,-]+)}/,P=E.split(",").map(function(Q){return Q.trim()}).join();if(D.test(P)){var O=D.exec(P)[1],z=UT(O);return function(Q){return z.includes(Q+1)}}return function(){return!1}})(m),N=(function(E){var D=Fp(/showLineNumbers=(\d+)/i,{lines:1});if(D.test(E)){var P=D.exec(E);return Number(P.groups.lines)}return 1})(m),T=(function(E){for(var D=new Array(E),P=0;P<E;P++)D[P]={type:"element",tagName:"span",properties:{className:[]},children:[]};return D})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],A=function(){var E,D,P=k.value,O=P[0],z=P[1];z.properties.className=["code-line"];var Q=PT(g,function($){return $.position.start.line<=O+1&&$.position.end.line>=O+1});z.children=Q.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!C.some(function($){return m.toLowerCase().includes($)})&&(z.properties.line=[(O+N).toString()],z.properties.className.push("line-number")),j(O)&&z.properties.className.push("highlight-line"),(b==="diff"||(E=b)!=null&&E.includes("diff-"))&&Bc(z).substring(0,1)==="-"?z.properties.className.push("deleted"):(b==="diff"||(D=b)!=null&&D.includes("diff-"))&&Bc(z).substring(0,1)==="+"&&z.properties.className.push("inserted")},I=sp(T.entries());!(k=I()).done;)A();T.length>0&&Bc(T[T.length-1]).trim()===""&&T.pop(),r.children=T}}}})($T);function Oo(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 Ns(t){if(t===0)return"-";const s=t/1e5;if(s<.01){const o=t<5?5:4;return`$${s.toFixed(o)}`}return`$${s.toFixed(2)}`}const Ey=new Set(["grackle"]);function qo(t){if(t.startsWith("mcp__")){const o=t.indexOf("__",5);if(o>5){const r=t.slice(5,o);if(Ey.has(r))return t.slice(o+2)}}const s=t.indexOf("-");if(s>0){const o=t.slice(0,s);if(Ey.has(o))return t.slice(s+1)}return t}const mC={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 hC(t){const s=qo(t);return mC[s.toLowerCase()]??"generic"}const gC="_card_qkm9i_2",vC="_cardBlue_qkm9i_20",yC="_cardOrange_qkm9i_24",bC="_cardGreen_qkm9i_28",xC="_cardPurple_qkm9i_32",_C="_cardNeutral_qkm9i_36",kC="_cardRed_qkm9i_40",SC="_cardTeal_qkm9i_44",TC="_header_qkm9i_48",jC="_icon_qkm9i_55",wC="_toolName_qkm9i_64",NC="_fileName_qkm9i_71",CC="_badge_qkm9i_80",EC="_spacer_qkm9i_87",AC="_bodyToggle_qkm9i_91",DC="_chevron_qkm9i_109",RC="_chevronExpanded_qkm9i_115",MC="_pre_qkm9i_119",IC="_diffAdd_qkm9i_143",OC="_diffRemove_qkm9i_155",BC="_diffContext_qkm9i_167",LC="_diffHeader_qkm9i_176",zC="_diffLine_qkm9i_182",$C="_exitOk_qkm9i_188",UC="_exitError_qkm9i_194",PC="_exitPending_qkm9i_200",HC="_inProgress_qkm9i_228",VC="_metadata_qkm9i_232",qC="_metadataPrefix_qkm9i_239",M={card:gC,cardBlue:vC,cardOrange:yC,cardGreen:bC,cardPurple:xC,cardNeutral:_C,cardRed:kC,cardTeal:SC,header:TC,icon:jC,toolName:wC,fileName:NC,badge:CC,spacer:EC,bodyToggle:AC,chevron:DC,chevronExpanded:RC,pre:MC,diffAdd:IC,diffRemove:OC,diffContext:BC,diffHeader:LC,diffLine:zC,exitOk:$C,exitError:UC,exitPending:PC,inProgress:HC,metadata:VC,metadataPrefix:qC};function GC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.file_path=="string"?s.file_path:typeof s.path=="string"?s.path:""}function FC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const ap=5;function Ay({tool:t,args:s,result:o,isError:r,writeVariant:c}){const[d,u]=x.useState(!1),p=GC(s),m=FC(p),g=o===void 0,v=r?M.cardRed:c?M.cardGreen:M.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",y=c?i.jsx(B2,{size:nn}):i.jsx(z2,{size:nn}),S=c?"tool-card-file-write":"tool-card-file-read",k=(o==null?void 0:o.split(`
|
|
236
|
-
`))??[],j=k.length>ap,N=d?k:k.slice(0,ap);return i.jsxs("div",{className:`${M.card} ${v} ${g?M.inProgress:""}`,"data-testid":S,children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,children:y}),i.jsx("span",{className:M.toolName,style:{color:b},children:t}),m&&i.jsx("span",{className:M.fileName,title:p,children:m}),!g&&k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,children:[k.length," lines"]})]})]}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-content",children:N.map((T,C)=>i.jsxs("span",{className:M.diffLine,children:[i.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),T]},C))}),j&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(T=>!T)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${d?M.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(ra,{size:ct})}),d?"collapse":`${k.length-ap} more lines`]})]})]})}function ZC(t){const s=t.split(`
|
|
237
|
-
`),o=[];for(const r of s)r.startsWith("diff --git")||r.startsWith("index ")||(r.startsWith("--- ")||r.startsWith("+++ "))&&!r.startsWith("---- ")&&!r.startsWith("++++ ")||(r.startsWith("@@")?o.push({type:"header",content:r}):r.startsWith("+")?o.push({type:"add",content:r.slice(1)}):r.startsWith("-")?o.push({type:"remove",content:r.slice(1)}):r.startsWith(" ")?o.push({type:"context",content:r.slice(1)}):r===""&&o.push({type:"context",content:""}));return o}function KC(t,s){const o=t.split(`
|
|
238
|
-
`),r=s.split(`
|
|
239
|
-
`),c=[];for(const d of o)c.push({type:"remove",content:d});for(const d of r)c.push({type:"add",content:d});return c}function YC(t){let s=0,o=0;for(const r of t)r.type==="add"&&s++,r.type==="remove"&&o++;return{added:s,removed:o}}function JC(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 WC(t){if(t===void 0||typeof t!="object"||t===null)return;const s=t,o=(typeof s.old_string=="string"?s.old_string:void 0)??(typeof s.old_str=="string"?s.old_str:void 0),r=(typeof s.new_string=="string"?s.new_string:void 0)??(typeof s.new_str=="string"?s.new_str:void 0);if(o!==void 0&&r!==void 0)return{oldStr:o,newStr:r}}function XC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function QC(t,s){if(s){let r=s;if(s.trimStart().startsWith("{"))try{const c=JSON.parse(s);typeof c.detailedContent=="string"&&(r=c.detailedContent)}catch{}if(r.includes("@@")||r.startsWith("diff ")){const c=ZC(r);if(c.length>0)return c}}const o=WC(t);if(o)return KC(o.oldStr,o.newStr)}const ip=5;function eE({tool:t,args:s,result:o,isError:r,detailedResult:c}){const[d,u]=x.useState(!1),p=JC(s),m=XC(p),g=o===void 0,v=QC(s,c),b=v?YC(v):null,y=((v==null?void 0:v.length)??0)>ip,S=d?v:v==null?void 0:v.slice(0,ip);return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardOrange} ${g?M.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,children:i.jsx(cj,{size:nn})}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&i.jsx("span",{className:M.fileName,title:p,children:m}),b&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-diff-stats",children:[i.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",i.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]})]}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&S&&S.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-diff",children:S.map((k,j)=>{let N=M.diffContext;return k.type==="add"&&(N=M.diffAdd),k.type==="remove"&&(N=M.diffRemove),k.type==="header"&&(N=M.diffHeader),i.jsx("span",{className:`${M.diffLine} ${N}`,children:k.content},j)})}),y&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(k=>!k)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${d?M.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(ra,{size:ct})}),d?"collapse":`${((v==null?void 0:v.length)??0)-ip} more lines`]})]}),!r&&!v&&!g&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-content",children:o})]})}const tE=/^\[exit (\d+)\]\s*/;function nE(t){const s=tE.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function sE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function aE(t){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'([^']*)'\s*$/i.exec(t);if(s)return s[1];const o=/pwsh(?:\.exe)?["']?\s+-Command\s+"([^"]*)"\s*$/i.exec(t);return o?o[1]:t}const op=3;function iE({tool:t,args:s,result:o,isError:r}){const[c,d]=x.useState(!1),u=sE(s),p=aE(u),m=o===void 0,g=o?nE(o):null,v=(g==null?void 0:g.output.split(`
|
|
240
|
-
`))??[],b=v.length>op,y=c?v:v.slice(0,op),S=g==null?void 0:g.exitCode,k=r||S!==void 0&&S!==0;return i.jsxs("div",{className:`${M.card} ${k?M.cardRed:M.cardNeutral}`,"data-testid":"tool-card-shell",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),i.jsx("span",{className:M.fileName,style:{flex:1,color:"var(--text-primary)"},title:u!==p?u:void 0,"data-testid":"tool-card-command",children:p}),S!==void 0&&i.jsxs("span",{className:S===0?M.exitOk:M.exitError,"data-testid":"tool-card-exit-code",children:[S===0?i.jsx(Ri,{size:ct,"aria-hidden":"true"}):i.jsx(Ka,{size:ct,"aria-hidden":"true"})," ","exit ",S]}),m&&i.jsx("span",{className:M.exitPending,"data-testid":"tool-card-pending",children:i.jsx(W2,{size:ct,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-output",children:y.join(`
|
|
241
|
-
`)}),b&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(ra,{size:ct})}),c?"collapse":`${v.length-op} more lines`]})]})]})}function oE(t){if(t==null||typeof t!="object")return{pattern:"",path:""};const s=t,o=typeof s.pattern=="string"?s.pattern:"",r=typeof s.path=="string"?s.path:"";return{pattern:o,path:r}}const rp=5;function rE({tool:t,args:s,result:o,isError:r}){const[c,d]=x.useState(!1),{pattern:u,path:p}=oE(s),m=o===void 0,g=(o==null?void 0:o.split(`
|
|
242
|
-
`).filter(y=>y.length>0))??[],v=g.length>rp,b=c?g:g.slice(0,rp);return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-search",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,children:i.jsx(Ex,{size:nn})}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&i.jsxs("span",{className:M.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),p&&i.jsxs("span",{className:M.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",p]}),!m&&!r&&g.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&b.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-results",children:b.join(`
|
|
243
|
-
`)}),v&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(y=>!y)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(ra,{size:ct})}),c?"collapse":`${g.length-rp} more matches`]})]})]})}const lE="_progressBar_14f5c_1",cE="_progressFill_14f5c_9",dE="_activeTask_14f5c_16",uE="_activeIcon_14f5c_27",fE="_todoPulse_14f5c_1",pE="_activeText_14f5c_34",mE="_checklist_14f5c_48",hE="_item_14f5c_55",gE="_itemIcon_14f5c_65",vE="_itemText_14f5c_73",yE="_pending_14f5c_78",bE="_in_progress_14f5c_85",xE="_completed_14f5c_97",_E="_emptyMessage_14f5c_108",cs={progressBar:lE,progressFill:cE,activeTask:dE,activeIcon:uE,todoPulse:fE,activeText:pE,checklist:mE,item:hE,itemIcon:gE,itemText:vE,pending:yE,in_progress:bE,completed:xE,emptyMessage:_E},kE=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function SE(t){if(t===void 0||typeof t!="object"||t===null)return[];const s=t;return Array.isArray(s.todos)?s.todos.filter(o=>typeof o=="object"&&o!==null&&typeof o.content=="string"&&typeof o.status=="string").map(o=>({content:o.content,activeForm:typeof o.activeForm=="string"?o.activeForm:void 0,status:Dy(o.status)})):Array.isArray(s.plan)?s.plan.filter(o=>typeof o=="object"&&o!==null&&typeof o.step=="string"&&typeof o.status=="string").map(o=>({content:o.step,status:Dy(o.status)})):typeof s.content=="string"?TE(s.content):[]}function Dy(t){switch(t.toLowerCase()){case"completed":case"done":case"complete":return"completed";case"in_progress":case"in-progress":case"working":case"active":return"in_progress";default:return"pending"}}function TE(t){const s=t.split(`
|
|
244
|
-
`),o=[];for(const r of s){const c=kE.exec(r.trim());if(c){const d=c[1],u=c[2].trim();let p="pending";d==="x"||d==="X"?p="completed":(d==="~"||d==="/"||d==="!")&&(p="in_progress"),o.push({content:u,status:p})}}return o}function jE(t){switch(t){case"completed":return i.jsx(Ri,{size:ct});case"in_progress":return i.jsx(Va,{size:ct,fill:"currentColor"});default:return i.jsx(Va,{size:ct})}}function wE({args:t}){const s=SE(t),o=s.filter(d=>d.status==="completed").length,r=s.find(d=>d.status==="in_progress"),c=s.length===0;return i.jsxs("div",{className:`${M.card} ${M.cardBlue}`,"data-testid":"tool-card-todo",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,children:i.jsx(Z2,{size:nn})}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-todo-progress",children:[o,"/",s.length]})]})]}),!c&&i.jsx("div",{className:cs.progressBar,"data-testid":"tool-card-todo-bar",children:i.jsx("div",{className:cs.progressFill,style:{width:`${o/s.length*100}%`}})}),r&&i.jsxs("div",{className:cs.activeTask,"data-testid":"tool-card-todo-active",children:[i.jsx("span",{className:cs.activeIcon,children:i.jsx(Va,{size:ct,fill:"currentColor"})}),i.jsx("span",{className:cs.activeText,children:r.activeForm||r.content})]}),!c&&i.jsx("div",{className:cs.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>i.jsxs("div",{className:`${cs.item} ${cs[d.status]}`,"data-testid":"tool-card-todo-item",children:[i.jsx("span",{className:cs.itemIcon,children:jE(d.status)}),i.jsx("span",{className:cs.itemText,children:d.content})]},u))}),c&&i.jsx("div",{className:cs.emptyMessage,children:"All items completed and cleared."})]})}function NE(t,s){if(s==null||typeof s!="object")return"";const o=s;if(typeof o.intent=="string")return o.intent;for(const r of Object.values(o))if(typeof r=="string")return r;return t}function CE({tool:t,args:s}){const o=NE(t,s);return i.jsxs("div",{className:M.metadata,"data-testid":"tool-card-metadata",children:[i.jsx("span",{className:M.metadataPrefix,children:i.jsx(I2,{size:ct})}),o]})}function EE(t){if(t==null||typeof t!="object")return{};const s=t;return{title:typeof s.title=="string"?s.title:void 0,category:typeof s.category=="string"?s.category:void 0,tags:Array.isArray(s.tags)?s.tags:void 0}}function AE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(o=>o!==null&&typeof o=="object")};if(typeof s=="object"&&s!==null)return{single:s}}catch{}return{}}const lp=5,cp=5;function DE({tool:t,args:s,result:o,isError:r}){const[c,d]=x.useState(!1),u=qo(t),p=EE(s),m=o===void 0,{single:g,list:v}=AE(o),b=(g==null?void 0:g.title)??p.title,y=v?void 0:(g==null?void 0:g.category)??p.category,S=v?void 0:(g==null?void 0:g.tags)??p.tags;return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-finding",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"💡"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),b&&i.jsxs("span",{className:M.fileName,"data-testid":"tool-card-finding-title",children:['"',b,'"']}),y&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsx("span",{className:M.badge,"data-testid":"tool-card-finding-category",children:y})]}),v&&!y&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-finding-count",children:[v.length," ",v.length===1?"finding":"findings"]})]})]}),S&&S.length>0&&i.jsx("div",{className:M.pre,style:{padding:"4px 8px",whiteSpace:"normal"},"data-testid":"tool-card-finding-tags",children:S.map((k,j)=>i.jsxs("span",{style:{display:"inline-block",marginRight:"6px",opacity:.7,fontSize:"0.85em"},children:["#",k]},j))}),m&&!b&&s!==null&&s!==void 0&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&(g==null?void 0:g.content)&&i.jsx(i.Fragment,{children:(()=>{const k=g.content.split(`
|
|
245
|
-
`),j=k.length>cp,N=c?g.content:k.slice(0,cp).join(`
|
|
246
|
-
`);return i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-finding-content",children:N}),j&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${k.length-cp} more lines`]})]})})()}),!r&&v&&v.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-finding-list",children:(c?v:v.slice(0,lp)).map((k,j)=>`${k.category?`[${k.category}] `:""}${k.title??k.id??`Finding ${j+1}`}`).join(`
|
|
247
|
-
`)}),v.length>lp&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-lp} more findings`]})]})]})}function RE(t){if(t==null||typeof t!="object")return{};const s=t;return{taskId:typeof s.taskId=="string"?s.taskId:void 0,title:typeof s.title=="string"?s.title:void 0,status:typeof s.status=="string"?s.status:void 0}}function ME(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(o=>o!==null&&typeof o=="object")};if(typeof s=="object"&&s!==null){const o=s;return typeof o.sessionId=="string"?{sessionId:o.sessionId,single:o}:{single:o}}}catch{}return{}}function Ry(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function IE(t){switch(t){case"complete":case"completed":return"var(--accent-green, #4ade80)";case"working":case"in_progress":return"var(--accent-blue, #60a5fa)";case"failed":return"var(--accent-red, #f87171)";case"paused":return"var(--text-tertiary, #888)";default:return"var(--text-secondary, #aaa)"}}const dp=5;function OE({tool:t,args:s,result:o,isError:r}){const[c,d]=x.useState(!1),u=qo(t),p=RE(s),m=o===void 0,{single:g,list:v,sessionId:b}=ME(o),y=(g==null?void 0:g.title)??p.title,S=(g==null?void 0:g.status)??p.status;return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardBlue} ${m?M.inProgress:""}`,"data-testid":"tool-card-task",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"📋"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:u}),y&&i.jsxs("span",{className:M.fileName,"data-testid":"tool-card-task-title",children:['"',y,'"']}),!y&&p.taskId&&i.jsx("span",{className:M.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),S&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,style:{color:IE(S)},"data-testid":"tool-card-task-status",children:[Ry(S)," ",S]})]}),v&&!S&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),m&&!y&&!p.taskId&&s!==null&&s!==void 0&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&b&&i.jsxs("div",{className:M.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",b]}),!r&&g&&!v&&!b&&i.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(`
|
|
248
|
-
`)}),!r&&v&&v.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,dp)).map(k=>{const j=Ry(k.status),N=k.title??k.id??"untitled";return`${j} ${N}`}).join(`
|
|
249
|
-
`)}),v.length>dp&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-dp} more tasks`]})]})]})}function BE(t){if(t==null||typeof t!="object")return{};const s=t;return{status:typeof s.status=="string"?s.status:void 0,summary:typeof s.summary=="string"?s.summary:void 0}}function LE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s,r=typeof o.workpad=="object"&&o.workpad!==null?o.workpad:o;return{status:typeof r.status=="string"?r.status:void 0,summary:typeof r.summary=="string"?r.summary:void 0,extra:typeof r.extra=="object"&&r.extra!==null?r.extra:void 0}}catch{}return{}}function zE({tool:t,args:s,result:o,isError:r}){const[c,d]=x.useState(!1),u=qo(t),p=BE(s),m=o===void 0,g=LE(o),v=g.status??p.status,b=g.summary??p.summary;return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardGreen} ${m?M.inProgress:""}`,"data-testid":"tool-card-workpad",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"📓"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsx("span",{className:M.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),b&&i.jsx("pre",{className:M.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:b}),m&&!b&&s!==null&&s!==void 0&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&!b&&!v&&!g.extra&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:o}),!r&&g.extra&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(y=>!y)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function $E(t){if(t==null||typeof t!="object")return{};const s=t;return{query:typeof s.query=="string"?s.query:void 0,id:typeof s.id=="string"?s.id:void 0}}function UE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s;if(Array.isArray(o.results))return{results:o.results.filter(r=>r!==null&&typeof r=="object")};if(typeof o.node=="object"&&o.node!==null){const r=Array.isArray(o.edges)?o.edges.length:0;return{node:o.node,edgeCount:r}}if(typeof o.id=="string")return{node:o}}catch{}return{}}const up=5;function PE({tool:t,args:s,result:o,isError:r}){const[c,d]=x.useState(!1),u=qo(t),p=$E(s),m=o===void 0,g=UE(o);return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🧠"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&i.jsxs("span",{className:M.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&i.jsx("span",{className:M.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.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&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-knowledge-edges",children:[g.edgeCount," ",g.edgeCount===1?"edge":"edges"]})]})]}),m&&s!==null&&s!==void 0&&!p.query&&!p.id&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&g.results&&g.results.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,up)).map(v=>{var S,k,j;const b=((S=v.node)==null?void 0:S.title)??((k=v.node)==null?void 0:k.label)??((j=v.node)==null?void 0:j.id)??"node",y=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${b}${y}`}).join(`
|
|
250
|
-
`)}),g.results.length>up&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-up} more results`]})]}),!r&&g.node&&!g.results&&i.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(`
|
|
251
|
-
`)})]})}function HE(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 VE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s;return{sessionId:typeof o.sessionId=="string"?o.sessionId:void 0,fd:typeof o.fd=="number"?o.fd:void 0,fds:Array.isArray(o.fds)?o.fds.filter(r=>r!==null&&typeof r=="object"):void 0,success:typeof o.success=="boolean"?o.success:void 0,output:typeof o.output=="string"?o.output:void 0}}catch{}return{}}function qE({tool:t,args:s,result:o,isError:r}){const[c,d]=x.useState(!1),u=qo(t),p=HE(s),m=o===void 0,g=VE(o);let v="";p.pipe?v=`[${p.pipe}]`:p.fd!==void 0?v=`fd:${p.fd}`:p.name&&(v=`"${p.name}"`);const b=p.prompt?p.prompt.length>60?`${p.prompt.slice(0,60)}...`:p.prompt:void 0;return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardOrange} ${m?M.inProgress:""}`,"data-testid":"tool-card-ipc",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🔀"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&i.jsx("span",{className:M.fileName,"data-testid":"tool-card-ipc-info",children:v}),b&&i.jsx("span",{className:M.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:b}),g.fds&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.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&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.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"})]})]}),m&&!b&&!v&&s!==null&&s!==void 0&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&g.sessionId&&i.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}`]}),!r&&g.output&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!r&&g.fds&&g.fds.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(y=>{const S=[`fd:${y.fd??"?"}`,y.permission??"",y.deliveryMode??""];return y.streamName&&S.push(y.streamName),y.owned&&S.push("(owned)"),S.filter(Boolean).join(" ")}).join(`
|
|
252
|
-
`)}),g.fds.length>5&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(y=>!y)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function GE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const fp=8;function FE({args:t,result:s,isError:o}){const[r,c]=x.useState(!1),d=GE(t),u=s===void 0,p=(s==null?void 0:s.split(`
|
|
253
|
-
`))??[],m=p.length>fp,g=r?s:p.slice(0,fp).join(`
|
|
254
|
-
`);return i.jsxs("div",{className:`${M.card} ${o?M.cardRed:M.cardNeutral} ${u?M.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🔧"}),i.jsx("span",{className:M.toolName,children:"ToolSearch"}),d&&i.jsxs("span",{className:M.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!o&&s&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:M.spacer}),i.jsxs("span",{className:M.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),o&&s&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:s}),!o&&!u&&s&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-tool-search-result",children:g}),m&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${r?M.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${p.length-fp} more lines`]})]})]})}function ZE(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function KE(t){if(t==null)return"";if(typeof t!="object")return String(t);const s=t;if(typeof s.command=="string")return s.command;if(typeof s.file_path=="string")return s.file_path;if(typeof s.path=="string")return s.path;if(typeof s.query=="string")return s.query;if(typeof s.url=="string")return s.url;try{const o=JSON.stringify(t);return o.length>120?`${o.slice(0,120)}…`:o}catch{return""}}const pp=5;function YE({tool:t,args:s,result:o,isError:r}){const[c,d]=x.useState(!1),{display:u}=ZE(t),p=KE(s),m=o===void 0,g=(o==null?void 0:o.split(`
|
|
255
|
-
`))??[],v=g.length>pp,b=c?o:g.slice(0,pp).join(`
|
|
256
|
-
`);let y="";if(s!=null)try{y=JSON.stringify(s,null,2)}catch{y=String(s)}return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardBlue} ${m?M.inProgress:""}`,"data-testid":"tool-card-generic",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,children:i.jsx(A2,{size:nn,"aria-hidden":"true"})}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&i.jsx("span",{className:M.fileName,children:p})]}),m&&y&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:y}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:b}),v&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(ra,{size:ct})}),c?"collapse":`${g.length-pp} more lines`]})]})]})}const JE="_badgePill_o7eqc_1",WE="_modelBadge_o7eqc_14",XE="_backgroundBadge_o7eqc_26",QE="_backgroundDot_o7eqc_36",eA="_backgroundDotPulsing_o7eqc_41",tA="_description_o7eqc_55",nA="_statusLine_o7eqc_62",sA="_statusCompleted_o7eqc_72",aA="_statusRunning_o7eqc_77",iA="_statusError_o7eqc_83",oA="_promptToggle_o7eqc_88",ds={badgePill:JE,modelBadge:WE,backgroundBadge:XE,backgroundDot:QE,backgroundDotPulsing:eA,description:tA,statusLine:nA,statusCompleted:sA,statusRunning:aA,statusError:iA,promptToggle:oA};function rA(t,s){if(s==null||typeof s!="object")return{};const o=s;return t.toLowerCase()==="read_agent"?{agentId:typeof o.agent_id=="string"?o.agent_id:void 0,isPoll:!0}:typeof o.agent_type=="string"||typeof o.name=="string"?{agentType:typeof o.agent_type=="string"?o.agent_type:void 0,description:typeof o.description=="string"?o.description:void 0,prompt:typeof o.prompt=="string"?o.prompt:void 0,isBackground:o.mode==="background",agentName:typeof o.name=="string"?o.name:void 0}:{agentType:typeof o.subagent_type=="string"?o.subagent_type:void 0,description:typeof o.description=="string"?o.description:void 0,prompt:typeof o.prompt=="string"?o.prompt:void 0,isBackground:o.run_in_background===!0,model:typeof o.model=="string"?o.model:void 0,isResume:typeof o.resume=="string"&&o.resume.length>0}}const lA=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function cA(t){const s=lA.exec(t);if(!s)return;const o=s[4];return{status:s[1].toLowerCase(),agentId:s[2].replace(/,$/,""),metadata:s[3].trim(),content:o?o.trim():void 0}}const mp=5;function dA({tool:t,args:s,result:o,isError:r}){const[c,d]=x.useState(!1),[u,p]=x.useState(!1),m=rA(t,s),g=o===void 0,v=m.isPoll&&o?cA(o):void 0,b=(v==null?void 0:v.content)??o,y=(b==null?void 0:b.split(`
|
|
257
|
-
`))??[],S=y.length>mp,k=c?b:y.slice(0,mp).join(`
|
|
258
|
-
`),j=m.isPoll?"Subagent":"Agent";return i.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardTeal} ${g?M.inProgress:""}`,"data-testid":"tool-card-agent",children:[i.jsxs("div",{className:M.header,children:[i.jsx("span",{className:M.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),i.jsx("span",{className:M.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:j}),m.agentType&&i.jsx("span",{className:ds.badgePill,"data-testid":"tool-card-agent-type",children:m.agentType}),m.model&&i.jsx("span",{className:ds.modelBadge,"data-testid":"tool-card-agent-model",children:m.model}),m.isBackground&&i.jsxs("span",{className:ds.backgroundBadge,"data-testid":"tool-card-agent-background",children:[i.jsx("span",{className:g?ds.backgroundDotPulsing:ds.backgroundDot,children:"●"}),"BG"]}),m.agentName&&i.jsx("span",{className:M.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&i.jsx("span",{className:M.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),i.jsx("span",{className:M.spacer}),g&&!m.isBackground&&i.jsx("span",{className:M.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),m.description&&i.jsx("div",{className:ds.description,"data-testid":"tool-card-agent-description",children:m.isResume?`Resuming: ${m.description}`:m.description}),v&&i.jsxs("div",{className:ds.statusLine,"data-testid":"tool-card-agent-status",children:[i.jsx("span",{className:v.status==="completed"?ds.statusCompleted:v.status==="running"?ds.statusRunning:ds.statusError,children:v.status}),v.metadata&&i.jsx("span",{children:v.metadata})]}),m.prompt&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:ds.promptToggle,onClick:()=>{p(N=>!N)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[i.jsx("span",{className:`${M.chevron} ${u?M.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&o&&i.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&b&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:k}),S&&i.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${y.length-mp} more lines`]})]})]})}function hp(t){switch(hC(t.tool)){case"file-read":return i.jsx(Ay,{...t});case"file-edit":return i.jsx(eE,{...t});case"file-write":return i.jsx(Ay,{...t,writeVariant:!0});case"shell":return i.jsx(iE,{...t});case"search":return i.jsx(rE,{...t});case"todo":return i.jsx(wE,{...t});case"metadata":return i.jsx(CE,{...t});case"finding":return i.jsx(DE,{...t});case"task":return i.jsx(OE,{...t});case"workpad":return i.jsx(zE,{...t});case"knowledge":return i.jsx(PE,{...t});case"ipc":return i.jsx(qE,{...t});case"tool-search":return i.jsx(FE,{...t});case"agent":return i.jsx(dA,{...t});default:return i.jsx(YE,{...t})}}const uA="_systemContextEvent_hmqlm_1",fA="_systemContextHeader_hmqlm_7",pA="_systemContextBadge_hmqlm_28",mA="_systemContextToggle_hmqlm_37",hA="_systemContextPre_hmqlm_43",gA="_systemContextEllipsis_hmqlm_54",vA="_systemEvent_hmqlm_58",yA="_systemTimestamp_hmqlm_65",bA="_textEvent_hmqlm_69",xA="_codeBlockWrapper_hmqlm_156",_A="_codeBlockCopyButton_hmqlm_159",kA="_errorEvent_hmqlm_163",SA="_statusEvent_hmqlm_171",TA="_userInputEvent_hmqlm_180",jA="_userInputContent_hmqlm_186",wA="_signalEvent_hmqlm_203",NA="_signalBadge_hmqlm_214",CA="_signalContent_hmqlm_223",EA="_usageEvent_hmqlm_228",AA="_usageBadge_hmqlm_235",DA="_defaultEvent_hmqlm_244",Ut={systemContextEvent:uA,systemContextHeader:fA,systemContextBadge:pA,systemContextToggle:mA,systemContextPre:hA,systemContextEllipsis:gA,systemEvent:vA,systemTimestamp:yA,textEvent:bA,codeBlockWrapper:xA,codeBlockCopyButton:_A,errorEvent:kA,statusEvent:SA,userInputEvent:TA,userInputContent:jA,signalEvent:wA,signalBadge:NA,signalContent:CA,usageEvent:EA,usageBadge:AA,defaultEvent:DA},My=3;function RA({content:t}){const[s,o]=x.useState(!1),r=t.split(`
|
|
259
|
-
`),c=r.length>My,d=s?t:r.slice(0,My).join(`
|
|
260
|
-
`);return i.jsxs("div",{className:Ut.systemContextEvent,"data-testid":"system-context-event",children:[i.jsxs("button",{type:"button",className:Ut.systemContextHeader,onClick:()=>{o(u=>!u)},"aria-expanded":s,children:[i.jsx("span",{className:Ut.systemContextBadge,children:"SYSTEM PROMPT"}),c&&i.jsx("span",{className:Ut.systemContextToggle,"aria-hidden":"true",children:s?i.jsx(Nx,{size:ct}):i.jsx(ra,{size:ct})})]}),i.jsxs("pre",{className:Ut.systemContextPre,children:[d,!s&&c&&i.jsx("span",{className:Ut.systemContextEllipsis,children:"…"})]})]})}function MA({time:t,content:s}){return i.jsxs("div",{className:Ut.systemEvent,children:[i.jsxs("span",{className:Ut.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Zp(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Zp).join(""):t!=null&&typeof t=="object"&&"props"in t?Zp(t.props.children):""}function IA({children:t,node:s,...o}){const r=Zp(t);return i.jsxs("div",{className:Ut.codeBlockWrapper,children:[i.jsx("pre",{...o,children:t}),i.jsx(ZN,{text:r,"data-testid":"copy-code-block",className:Ut.codeBlockCopyButton})]})}const OA={pre:IA};function BA({content:t}){return i.jsx("div",{className:Ut.textEvent,children:i.jsx(Td,{remarkPlugins:[jd],rehypePlugins:[pC],components:OA,children:t})})}function LA({content:t}){return i.jsxs("div",{className:Ut.errorEvent,children:["Error: ",t]})}function zA({content:t}){return i.jsxs("div",{className:Ut.statusEvent,children:["--- ",t," ---"]})}function $A({content:t}){return i.jsx("div",{className:Ut.userInputEvent,children:i.jsx("span",{className:Ut.userInputContent,children:t})})}function UA({content:t}){return i.jsxs("div",{className:Ut.signalEvent,"data-testid":"signal-event",children:[i.jsx("span",{className:Ut.signalBadge,children:"SIGNAL"}),i.jsx("span",{className:Ut.signalContent,children:t})]})}function PA({content:t}){let s=t;try{const o=JSON.parse(t),r=Number(o.input_tokens)||0,c=Number(o.output_tokens)||0,d=Oo(r+c),u=Ns(Number(o.cost_millicents)||0);s=`${d} tokens · ${u}`}catch{}return i.jsx("div",{className:Ut.usageEvent,"data-testid":"usage-event",children:i.jsx("span",{className:Ut.usageBadge,children:s})})}function HA({content:t}){return i.jsx("div",{className:Ut.defaultEvent,children:t})}function VA({event:t,toolUseCtx:s,settled:o}){const r=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return i.jsx(RA,{content:t.content})}catch{}return i.jsx(MA,{time:r,content:t.content})}case"text":case"output":return i.jsx(BA,{content:t.content});case"tool_use":{let c="",d={};try{const u=JSON.parse(t.content);c=u.tool||"",d=u.args}catch{}return i.jsx(hp,{tool:c,args:d,result:o?"":void 0})}case"tool_result":{let c=!1;if(t.raw)try{c=JSON.parse(t.raw).is_error===!0}catch{}let d=t.content;if(t.content.trimStart().startsWith("{"))try{const u=JSON.parse(t.content);typeof u.content=="string"&&(d=u.content)}catch{}return s?i.jsx(hp,{tool:s.tool,args:s.args,result:d,isError:c,detailedResult:s.detailedResult}):i.jsx(hp,{tool:"Tool output",args:void 0,result:d,isError:c})}case"error":return i.jsx(LA,{content:t.content});case"status":return i.jsx(zA,{content:t.content});case"user_input":return i.jsx($A,{content:t.content});case"signal":return i.jsx(UA,{content:t.content});case"usage":return i.jsx(PA,{content:t.content});default:return i.jsx(HA,{content:t.content})}}const Em=x.createContext({});function Am(t){const s=x.useRef(null);return s.current===null&&(s.current=t()),s.current}const Rd=x.createContext(null),Dm=x.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class qA extends x.Component{getSnapshotBeforeUpdate(s){const o=this.props.childRef.current;if(o&&s.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=o.offsetHeight||0,r.width=o.offsetWidth||0,r.top=o.offsetTop,r.left=o.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function GA({children:t,isPresent:s}){const o=x.useId(),r=x.useRef(null),c=x.useRef({width:0,height:0,top:0,left:0}),{nonce:d}=x.useContext(Dm);return x.useInsertionEffect(()=>{const{width:u,height:p,top:m,left:g}=c.current;if(s||!r.current||!u||!p)return;r.current.dataset.motionPopId=o;const v=document.createElement("style");return d&&(v.nonce=d),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
|
|
261
|
-
[data-motion-pop-id="${o}"] {
|
|
262
|
-
position: absolute !important;
|
|
263
|
-
width: ${u}px !important;
|
|
264
|
-
height: ${p}px !important;
|
|
265
|
-
top: ${m}px !important;
|
|
266
|
-
left: ${g}px !important;
|
|
267
|
-
}
|
|
268
|
-
`),()=>{document.head.removeChild(v)}},[s]),i.jsx(qA,{isPresent:s,childRef:r,sizeRef:c,children:x.cloneElement(t,{ref:r})})}const FA=({children:t,initial:s,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=Am(ZA),m=x.useId(),g=x.useCallback(b=>{p.set(b,!0);for(const y of p.values())if(!y)return;r&&r()},[p,r]),v=x.useMemo(()=>({id:m,initial:s,isPresent:o,custom:c,onExitComplete:g,register:b=>(p.set(b,!1),()=>p.delete(b))}),d?[Math.random(),g]:[o,g]);return x.useMemo(()=>{p.forEach((b,y)=>p.set(y,!1))},[o]),x.useEffect(()=>{!o&&!p.size&&r&&r()},[o]),u==="popLayout"&&(t=i.jsx(GA,{isPresent:o,children:t})),i.jsx(Rd.Provider,{value:v,children:t})};function ZA(){return new Map}function e_(t=!0){const s=x.useContext(Rd);if(s===null)return[!0,null];const{isPresent:o,onExitComplete:r,register:c}=s,d=x.useId();x.useEffect(()=>{t&&c(d)},[t]);const u=x.useCallback(()=>t&&r&&r(d),[d,r,t]);return!o&&r?[!1,u]:[!0]}const Pc=t=>t.key||"";function Iy(t){const s=[];return x.Children.forEach(t,o=>{x.isValidElement(o)&&s.push(o)}),s}const Rm=typeof window<"u",t_=Rm?x.useLayoutEffect:x.useEffect,gs=({children:t,custom:s,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,m]=e_(u),g=x.useMemo(()=>Iy(t),[t]),v=u&&!p?[]:g.map(Pc),b=x.useRef(!0),y=x.useRef(g),S=Am(()=>new Map),[k,j]=x.useState(g),[N,T]=x.useState(g);t_(()=>{b.current=!1,y.current=g;for(let I=0;I<N.length;I++){const E=Pc(N[I]);v.includes(E)?S.delete(E):S.get(E)!==!0&&S.set(E,!1)}},[N,v.length,v.join("-")]);const C=[];if(g!==k){let I=[...g];for(let E=0;E<N.length;E++){const D=N[E],P=Pc(D);v.includes(P)||(I.splice(E,0,D),C.push(D))}d==="wait"&&C.length&&(I=C),T(Iy(I)),j(g);return}const{forceRender:A}=x.useContext(Em);return i.jsx(i.Fragment,{children:N.map(I=>{const E=Pc(I),D=u&&!p?!1:g===N||v.includes(E),P=()=>{if(S.has(E))S.set(E,!0);else return;let O=!0;S.forEach(z=>{z||(O=!1)}),O&&(A==null||A(),T(y.current),u&&(m==null||m()),r&&r())};return i.jsx(FA,{isPresent:D,initial:!b.current||o?void 0:!1,custom:D?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:D?void 0:P,children:I},E)})})},In=t=>t;let n_=In;const KA={useManualTiming:!1};function YA(t){let s=new Set,o=new Set,r=!1,c=!1;const d=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function p(g){d.has(g)&&(m.schedule(g),t()),g(u)}const m={schedule:(g,v=!1,b=!1)=>{const S=b&&r?s:o;return v&&d.add(g),S.has(g)||S.add(g),g},cancel:g=>{o.delete(g),d.delete(g)},process:g=>{if(u=g,r){c=!0;return}r=!0,[s,o]=[o,s],s.forEach(p),s.clear(),r=!1,c&&(c=!1,m.process(g))}};return m}const Hc=["read","resolveKeyframes","update","preRender","render","postRender"],JA=40;function s_(t,s){let o=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>o=!0,u=Hc.reduce((T,C)=>(T[C]=YA(d),T),{}),{read:p,resolveKeyframes:m,update:g,preRender:v,render:b,postRender:y}=u,S=()=>{const T=performance.now();o=!1,c.delta=r?1e3/60:Math.max(Math.min(T-c.timestamp,JA),1),c.timestamp=T,c.isProcessing=!0,p.process(c),m.process(c),g.process(c),v.process(c),b.process(c),y.process(c),c.isProcessing=!1,o&&s&&(r=!1,t(S))},k=()=>{o=!0,r=!0,c.isProcessing||t(S)};return{schedule:Hc.reduce((T,C)=>{const A=u[C];return T[C]=(I,E=!1,D=!1)=>(o||k(),A.schedule(I,E,D)),T},{}),cancel:T=>{for(let C=0;C<Hc.length;C++)u[Hc[C]].cancel(T)},state:c,steps:u}}const{schedule:kt,cancel:Fa,state:cn,steps:gp}=s_(typeof requestAnimationFrame<"u"?requestAnimationFrame:In,!0),a_=x.createContext({strict:!1}),Oy={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"]},Bo={};for(const t in Oy)Bo[t]={isEnabled:s=>Oy[t].some(o=>!!s[o])};function WA(t){for(const s in t)Bo[s]={...Bo[s],...t[s]}}const XA=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 dd(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||XA.has(t)}let i_=t=>!dd(t);function QA(t){t&&(i_=s=>s.startsWith("on")?!dd(s):t(s))}try{QA(require("@emotion/is-prop-valid").default)}catch{}function eD(t,s,o){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(i_(c)||o===!0&&dd(c)||!s&&!dd(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function tD(t){if(typeof Proxy>"u")return t;const s=new Map,o=(...r)=>t(...r);return new Proxy(o,{get:(r,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const Md=x.createContext({});function rl(t){return typeof t=="string"||Array.isArray(t)}function Id(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Mm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Im=["initial",...Mm];function Od(t){return Id(t.animate)||Im.some(s=>rl(t[s]))}function o_(t){return!!(Od(t)||t.variants)}function nD(t,s){if(Od(t)){const{initial:o,animate:r}=t;return{initial:o===!1||rl(o)?o:void 0,animate:rl(r)?r:void 0}}return t.inherit!==!1?s:{}}function sD(t){const{initial:s,animate:o}=nD(t,x.useContext(Md));return x.useMemo(()=>({initial:s,animate:o}),[By(s),By(o)])}function By(t){return Array.isArray(t)?t.join(" "):t}const aD=Symbol.for("motionComponentSymbol");function Co(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function iD(t,s,o){return x.useCallback(r=>{r&&t.onMount&&t.onMount(r),s&&(r?s.mount(r):s.unmount()),o&&(typeof o=="function"?o(r):Co(o)&&(o.current=r))},[s])}const Om=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),oD="framerAppearId",r_="data-"+Om(oD),{schedule:Bm}=s_(queueMicrotask,!1),l_=x.createContext({});function rD(t,s,o,r,c){var d,u;const{visualElement:p}=x.useContext(Md),m=x.useContext(a_),g=x.useContext(Rd),v=x.useContext(Dm).reducedMotion,b=x.useRef(null);r=r||m.renderer,!b.current&&r&&(b.current=r(t,{visualState:s,parent:p,props:o,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const y=b.current,S=x.useContext(l_);y&&!y.projection&&c&&(y.type==="html"||y.type==="svg")&&lD(b.current,o,c,S);const k=x.useRef(!1);x.useInsertionEffect(()=>{y&&k.current&&y.update(o,g)});const j=o[r_],N=x.useRef(!!j&&!(!((d=window.MotionHandoffIsComplete)===null||d===void 0)&&d.call(window,j))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,j)));return t_(()=>{y&&(k.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),Bm.render(y.render),N.current&&y.animationState&&y.animationState.animateChanges())}),x.useEffect(()=>{y&&(!N.current&&y.animationState&&y.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)===null||T===void 0||T.call(window,j)}),N.current=!1))}),y}function lD(t,s,o,r){const{layoutId:c,layout:d,drag:u,dragConstraints:p,layoutScroll:m,layoutRoot:g}=s;t.projection=new o(t.latestValues,s["data-framer-portal-id"]?void 0:c_(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||p&&Co(p),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:g})}function c_(t){if(t)return t.options.allowProjection!==!1?t.projection:c_(t.parent)}function cD({preloadedFeatures:t,createVisualElement:s,useRender:o,useVisualState:r,Component:c}){var d,u;t&&WA(t);function p(g,v){let b;const y={...x.useContext(Dm),...g,layoutId:dD(g)},{isStatic:S}=y,k=sD(g),j=r(g,S);if(!S&&Rm){uD();const N=fD(y);b=N.MeasureLayout,k.visualElement=rD(c,j,y,s,N.ProjectionNode)}return i.jsxs(Md.Provider,{value:k,children:[b&&k.visualElement?i.jsx(b,{visualElement:k.visualElement,...y}):null,o(c,g,iD(j,k.visualElement,v),j,S,k.visualElement)]})}p.displayName=`motion.${typeof c=="string"?c:`create(${(u=(d=c.displayName)!==null&&d!==void 0?d:c.name)!==null&&u!==void 0?u:""})`}`;const m=x.forwardRef(p);return m[aD]=c,m}function dD({layoutId:t}){const s=x.useContext(Em).id;return s&&t!==void 0?s+"-"+t:t}function uD(t,s){x.useContext(a_).strict}function fD(t){const{drag:s,layout:o}=Bo;if(!s&&!o)return{};const r={...s,...o};return{MeasureLayout:s!=null&&s.isEnabled(t)||o!=null&&o.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const pD=["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 Lm(t){return typeof t!="string"||t.includes("-")?!1:!!(pD.indexOf(t)>-1||/[A-Z]/u.test(t))}function Ly(t){const s=[{},{}];return t==null||t.values.forEach((o,r)=>{s[0][r]=o.get(),s[1][r]=o.getVelocity()}),s}function zm(t,s,o,r){if(typeof s=="function"){const[c,d]=Ly(r);s=s(o!==void 0?o:t.custom,c,d)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,d]=Ly(r);s=s(o!==void 0?o:t.custom,c,d)}return s}const Kp=t=>Array.isArray(t),mD=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),hD=t=>Kp(t)?t[t.length-1]||0:t,fn=t=>!!(t&&t.getVelocity);function nd(t){const s=fn(t)?t.get():t;return mD(s)?s.toValue():s}function gD({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:o},r,c,d){const u={latestValues:vD(r,c,d,t),renderState:s()};return o&&(u.onMount=p=>o({props:r,current:p,...u}),u.onUpdate=p=>o(p)),u}const d_=t=>(s,o)=>{const r=x.useContext(Md),c=x.useContext(Rd),d=()=>gD(t,s,r,c);return o?d():Am(d)};function vD(t,s,o,r){const c={},d=r(t,{});for(const y in d)c[y]=nd(d[y]);let{initial:u,animate:p}=t;const m=Od(t),g=o_(t);s&&g&&!m&&t.inherit!==!1&&(u===void 0&&(u=s.initial),p===void 0&&(p=s.animate));let v=o?o.initial===!1:!1;v=v||u===!1;const b=v?p:u;if(b&&typeof b!="boolean"&&!Id(b)){const y=Array.isArray(b)?b:[b];for(let S=0;S<y.length;S++){const k=zm(t,y[S]);if(k){const{transitionEnd:j,transition:N,...T}=k;for(const C in T){let A=T[C];if(Array.isArray(A)){const I=v?A.length-1:0;A=A[I]}A!==null&&(c[C]=A)}for(const C in j)c[C]=j[C]}}}return c}const Go=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Oi=new Set(Go),u_=t=>s=>typeof s=="string"&&s.startsWith(t),f_=u_("--"),yD=u_("var(--"),$m=t=>yD(t)?bD.test(t.split("/*")[0].trim()):!1,bD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,p_=(t,s)=>s&&typeof t=="number"?s.transform(t):t,aa=(t,s,o)=>o>s?s:o<t?t:o,Fo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},ll={...Fo,transform:t=>aa(0,1,t)},Vc={...Fo,default:1},gl=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Pa=gl("deg"),Es=gl("%"),Ae=gl("px"),xD=gl("vh"),_D=gl("vw"),zy={...Es,parse:t=>Es.parse(t)/100,transform:t=>Es.transform(t*100)},kD={borderWidth:Ae,borderTopWidth:Ae,borderRightWidth:Ae,borderBottomWidth:Ae,borderLeftWidth:Ae,borderRadius:Ae,radius:Ae,borderTopLeftRadius:Ae,borderTopRightRadius:Ae,borderBottomRightRadius:Ae,borderBottomLeftRadius:Ae,width:Ae,maxWidth:Ae,height:Ae,maxHeight:Ae,top:Ae,right:Ae,bottom:Ae,left:Ae,padding:Ae,paddingTop:Ae,paddingRight:Ae,paddingBottom:Ae,paddingLeft:Ae,margin:Ae,marginTop:Ae,marginRight:Ae,marginBottom:Ae,marginLeft:Ae,backgroundPositionX:Ae,backgroundPositionY:Ae},SD={rotate:Pa,rotateX:Pa,rotateY:Pa,rotateZ:Pa,scale:Vc,scaleX:Vc,scaleY:Vc,scaleZ:Vc,skew:Pa,skewX:Pa,skewY:Pa,distance:Ae,translateX:Ae,translateY:Ae,translateZ:Ae,x:Ae,y:Ae,z:Ae,perspective:Ae,transformPerspective:Ae,opacity:ll,originX:zy,originY:zy,originZ:Ae},$y={...Fo,transform:Math.round},Um={...kD,...SD,zIndex:$y,size:Ae,fillOpacity:ll,strokeOpacity:ll,numOctaves:$y},TD={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},jD=Go.length;function wD(t,s,o){let r="",c=!0;for(let d=0;d<jD;d++){const u=Go[d],p=t[u];if(p===void 0)continue;let m=!0;if(typeof p=="number"?m=p===(u.startsWith("scale")?1:0):m=parseFloat(p)===0,!m||o){const g=p_(p,Um[u]);if(!m){c=!1;const v=TD[u]||u;r+=`${v}(${g}) `}o&&(s[u]=g)}}return r=r.trim(),o?r=o(s,c?"":r):c&&(r="none"),r}function Pm(t,s,o){const{style:r,vars:c,transformOrigin:d}=t;let u=!1,p=!1;for(const m in s){const g=s[m];if(Oi.has(m)){u=!0;continue}else if(f_(m)){c[m]=g;continue}else{const v=p_(g,Um[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||o?r.transform=wD(s,t.transform,o):r.transform&&(r.transform="none")),p){const{originX:m="50%",originY:g="50%",originZ:v=0}=d;r.transformOrigin=`${m} ${g} ${v}`}}const ND={offset:"stroke-dashoffset",array:"stroke-dasharray"},CD={offset:"strokeDashoffset",array:"strokeDasharray"};function ED(t,s,o=1,r=0,c=!0){t.pathLength=1;const d=c?ND:CD;t[d.offset]=Ae.transform(-r);const u=Ae.transform(s),p=Ae.transform(o);t[d.array]=`${u} ${p}`}function Uy(t,s,o){return typeof t=="string"?t:Ae.transform(s+o*t)}function AD(t,s,o){const r=Uy(s,t.x,t.width),c=Uy(o,t.y,t.height);return`${r} ${c}`}function Hm(t,{attrX:s,attrY:o,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:m=0,...g},v,b){if(Pm(t,g,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:y,style:S,dimensions:k}=t;y.transform&&(k&&(S.transform=y.transform),delete y.transform),k&&(c!==void 0||d!==void 0||S.transform)&&(S.transformOrigin=AD(k,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(y.x=s),o!==void 0&&(y.y=o),r!==void 0&&(y.scale=r),u!==void 0&&ED(y,u,p,m,!1)}const Vm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),m_=()=>({...Vm(),attrs:{}}),qm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function h_(t,{style:s,vars:o},r,c){Object.assign(t.style,s,c&&c.getProjectionStyles(r));for(const d in o)t.style.setProperty(d,o[d])}const g_=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function v_(t,s,o,r){h_(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(g_.has(c)?c:Om(c),s.attrs[c])}const ud={};function DD(t){Object.assign(ud,t)}function y_(t,{layout:s,layoutId:o}){return Oi.has(t)||t.startsWith("origin")||(s||o!==void 0)&&(!!ud[t]||t==="opacity")}function Gm(t,s,o){var r;const{style:c}=t,d={};for(const u in c)(fn(c[u])||s.style&&fn(s.style[u])||y_(u,t)||((r=o==null?void 0:o.getValue(u))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(d[u]=c[u]);return d}function b_(t,s,o){const r=Gm(t,s,o);for(const c in t)if(fn(t[c])||fn(s[c])){const d=Go.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function RD(t,s){try{s.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{s.dimensions={x:0,y:0,width:0,height:0}}}const Py=["x","y","width","height","cx","cy","r"],MD={useVisualState:d_({scrapeMotionValuesFromProps:b_,createRenderState:m_,onUpdate:({props:t,prevProps:s,current:o,renderState:r,latestValues:c})=>{if(!o)return;let d=!!t.drag;if(!d){for(const p in c)if(Oi.has(p)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let p=0;p<Py.length;p++){const m=Py[p];t[m]!==s[m]&&(u=!0)}u&&kt.read(()=>{RD(o,r),kt.render(()=>{Hm(r,c,qm(o.tagName),t.transformTemplate),v_(o,r)})})}})},ID={useVisualState:d_({scrapeMotionValuesFromProps:Gm,createRenderState:Vm})};function x_(t,s,o){for(const r in s)!fn(s[r])&&!y_(r,o)&&(t[r]=s[r])}function OD({transformTemplate:t},s){return x.useMemo(()=>{const o=Vm();return Pm(o,s,t),Object.assign({},o.vars,o.style)},[s])}function BD(t,s){const o=t.style||{},r={};return x_(r,o,t),Object.assign(r,OD(t,s)),r}function LD(t,s){const o={},r=BD(t,s);return t.drag&&t.dragListener!==!1&&(o.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(o.tabIndex=0),o.style=r,o}function zD(t,s,o,r){const c=x.useMemo(()=>{const d=m_();return Hm(d,s,qm(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};x_(d,t.style,t),c.style={...d,...c.style}}return c}function $D(t=!1){return(o,r,c,{latestValues:d},u)=>{const m=(Lm(o)?zD:LD)(r,d,u,o),g=eD(r,typeof o=="string",t),v=o!==x.Fragment?{...g,...m,ref:c}:{},{children:b}=r,y=x.useMemo(()=>fn(b)?b.get():b,[b]);return x.createElement(o,{...v,children:y})}}function UD(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Lm(r)?MD:ID,preloadedFeatures:t,useRender:$D(c),createVisualElement:s,Component:r};return cD(u)}}function __(t,s){if(!Array.isArray(s))return!1;const o=s.length;if(o!==t.length)return!1;for(let r=0;r<o;r++)if(s[r]!==t[r])return!1;return!0}function Bd(t,s,o){const r=t.getProps();return zm(r,s,o!==void 0?o:r.custom,t)}function Fm(t,s){return t?t[s]||t.default||t:void 0}const k_=new Set(["width","height","top","left","right","bottom",...Go]);let sd;function PD(){sd=void 0}const As={now:()=>(sd===void 0&&As.set(cn.isProcessing||KA.useManualTiming?cn.timestamp:performance.now()),sd),set:t=>{sd=t,queueMicrotask(PD)}};function Zm(t,s){t.indexOf(s)===-1&&t.push(s)}function Km(t,s){const o=t.indexOf(s);o>-1&&t.splice(o,1)}class Ym{constructor(){this.subscriptions=[]}add(s){return Zm(this.subscriptions,s),()=>Km(this.subscriptions,s)}notify(s,o,r){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,o,r);else for(let d=0;d<c;d++){const u=this.subscriptions[d];u&&u(s,o,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function S_(t,s){return s?t*(1e3/s):0}const Hy=30,HD=t=>!isNaN(parseFloat(t));class VD{constructor(s,o={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=As.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=o.owner}setCurrent(s){this.current=s,this.updatedAt=As.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=HD(this.current))}setPrevFrameValue(s=this.current){this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt}onChange(s){return this.on("change",s)}on(s,o){this.events[s]||(this.events[s]=new Ym);const r=this.events[s].add(o);return s==="change"?()=>{r(),kt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,o){this.passiveEffect=s,this.stopPassiveEffect=o}set(s,o=!0){!o||!this.passiveEffect?this.updateAndNotify(s,o):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,o,r){this.set(o),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-r}jump(s,o=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=As.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Hy)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,Hy);return S_(parseFloat(this.current)-parseFloat(this.prevFrameValue),o)}start(s){return this.stop(),new Promise(o=>{this.hasAnimated=!0,this.animation=s(o),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function cl(t,s){return new VD(t,s)}function qD(t,s,o){t.hasValue(s)?t.getValue(s).set(o):t.addValue(s,cl(o))}function GD(t,s){const o=Bd(t,s);let{transitionEnd:r={},transition:c={},...d}=o||{};d={...d,...r};for(const u in d){const p=hD(d[u]);qD(t,u,p)}}function FD(t){return!!(fn(t)&&t.add)}function Yp(t,s){const o=t.getValue("willChange");if(FD(o))return o.add(s)}function T_(t){return t.props[r_]}function Jm(t){let s;return()=>(s===void 0&&(s=t()),s)}const ZD=Jm(()=>window.ScrollTimeline!==void 0);class KD{constructor(s){this.stop=()=>this.runAll("stop"),this.animations=s.filter(Boolean)}get finished(){return Promise.all(this.animations.map(s=>"finished"in s?s.finished:s))}getAll(s){return this.animations[0][s]}setAll(s,o){for(let r=0;r<this.animations.length;r++)this.animations[r][s]=o}attachTimeline(s,o){const r=this.animations.map(c=>{if(ZD()&&c.attachTimeline)return c.attachTimeline(s);if(typeof o=="function")return o(c)});return()=>{r.forEach((c,d)=>{c&&c(),this.animations[d].stop()})}}get time(){return this.getAll("time")}set time(s){this.setAll("time",s)}get speed(){return this.getAll("speed")}set speed(s){this.setAll("speed",s)}get startTime(){return this.getAll("startTime")}get duration(){let s=0;for(let o=0;o<this.animations.length;o++)s=Math.max(s,this.animations[o].duration);return s}runAll(s){this.animations.forEach(o=>o[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class YD extends KD{then(s,o){return Promise.all(this.animations).then(s).catch(o)}}const ea=t=>t*1e3,ta=t=>t/1e3;function Wm(t){return typeof t=="function"}function Vy(t,s){t.timeline=s,t.onfinish=null}const Xm=t=>Array.isArray(t)&&typeof t[0]=="number",JD={linearEasing:void 0};function WD(t,s){const o=Jm(t);return()=>{var r;return(r=JD[s])!==null&&r!==void 0?r:o()}}const fd=WD(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Lo=(t,s,o)=>{const r=s-t;return r===0?1:(o-t)/r},j_=(t,s,o=10)=>{let r="";const c=Math.max(Math.round(s/o),2);for(let d=0;d<c;d++)r+=t(Lo(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function w_(t){return!!(typeof t=="function"&&fd()||!t||typeof t=="string"&&(t in Jp||fd())||Xm(t)||Array.isArray(t)&&t.every(w_))}const Zr=([t,s,o,r])=>`cubic-bezier(${t}, ${s}, ${o}, ${r})`,Jp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Zr([0,.65,.55,1]),circOut:Zr([.55,0,1,.45]),backIn:Zr([.31,.01,.66,-.59]),backOut:Zr([.33,1.53,.69,.99])};function N_(t,s){if(t)return typeof t=="function"&&fd()?j_(t,s):Xm(t)?Zr(t):Array.isArray(t)?t.map(o=>N_(o,s)||Jp.easeOut):Jp[t]}const C_=(t,s,o)=>(((1-3*o+3*s)*t+(3*o-6*s))*t+3*s)*t,XD=1e-7,QD=12;function eR(t,s,o,r,c){let d,u,p=0;do u=s+(o-s)/2,d=C_(u,r,c)-t,d>0?o=u:s=u;while(Math.abs(d)>XD&&++p<QD);return u}function vl(t,s,o,r){if(t===s&&o===r)return In;const c=d=>eR(d,0,1,t,o);return d=>d===0||d===1?d:C_(c(d),s,r)}const E_=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,A_=t=>s=>1-t(1-s),D_=vl(.33,1.53,.69,.99),Qm=A_(D_),R_=E_(Qm),M_=t=>(t*=2)<1?.5*Qm(t):.5*(2-Math.pow(2,-10*(t-1))),eh=t=>1-Math.sin(Math.acos(t)),I_=A_(eh),O_=E_(eh),B_=t=>/^0[^.\s]+$/u.test(t);function tR(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||B_(t):!0}const Xr=t=>Math.round(t*1e5)/1e5,th=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function nR(t){return t==null}const sR=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,nh=(t,s)=>o=>!!(typeof o=="string"&&sR.test(o)&&o.startsWith(t)||s&&!nR(o)&&Object.prototype.hasOwnProperty.call(o,s)),L_=(t,s,o)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(th);return{[t]:parseFloat(c),[s]:parseFloat(d),[o]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},aR=t=>aa(0,255,t),vp={...Fo,transform:t=>Math.round(aR(t))},wi={test:nh("rgb","red"),parse:L_("red","green","blue"),transform:({red:t,green:s,blue:o,alpha:r=1})=>"rgba("+vp.transform(t)+", "+vp.transform(s)+", "+vp.transform(o)+", "+Xr(ll.transform(r))+")"};function iR(t){let s="",o="",r="",c="";return t.length>5?(s=t.substring(1,3),o=t.substring(3,5),r=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),o=t.substring(2,3),r=t.substring(3,4),c=t.substring(4,5),s+=s,o+=o,r+=r,c+=c),{red:parseInt(s,16),green:parseInt(o,16),blue:parseInt(r,16),alpha:c?parseInt(c,16)/255:1}}const Wp={test:nh("#"),parse:iR,transform:wi.transform},Eo={test:nh("hsl","hue"),parse:L_("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:o,alpha:r=1})=>"hsla("+Math.round(t)+", "+Es.transform(Xr(s))+", "+Es.transform(Xr(o))+", "+Xr(ll.transform(r))+")"},un={test:t=>wi.test(t)||Wp.test(t)||Eo.test(t),parse:t=>wi.test(t)?wi.parse(t):Eo.test(t)?Eo.parse(t):Wp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?wi.transform(t):Eo.transform(t)},oR=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function rR(t){var s,o;return isNaN(t)&&typeof t=="string"&&(((s=t.match(th))===null||s===void 0?void 0:s.length)||0)+(((o=t.match(oR))===null||o===void 0?void 0:o.length)||0)>0}const z_="number",$_="color",lR="var",cR="var(",qy="${}",dR=/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 dl(t){const s=t.toString(),o=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace(dR,m=>(un.test(m)?(r.color.push(d),c.push($_),o.push(un.parse(m))):m.startsWith(cR)?(r.var.push(d),c.push(lR),o.push(m)):(r.number.push(d),c.push(z_),o.push(parseFloat(m))),++d,qy)).split(qy);return{values:o,split:p,indexes:r,types:c}}function U_(t){return dl(t).values}function P_(t){const{split:s,types:o}=dl(t),r=s.length;return c=>{let d="";for(let u=0;u<r;u++)if(d+=s[u],c[u]!==void 0){const p=o[u];p===z_?d+=Xr(c[u]):p===$_?d+=un.transform(c[u]):d+=c[u]}return d}}const uR=t=>typeof t=="number"?0:t;function fR(t){const s=U_(t);return P_(t)(s.map(uR))}const Za={test:rR,parse:U_,createTransformer:P_,getAnimatableNone:fR},pR=new Set(["brightness","contrast","saturate","opacity"]);function mR(t){const[s,o]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=o.match(th)||[];if(!r)return t;const c=o.replace(r,"");let d=pR.has(s)?1:0;return r!==o&&(d*=100),s+"("+d+c+")"}const hR=/\b([a-z-]*)\(.*?\)/gu,Xp={...Za,getAnimatableNone:t=>{const s=t.match(hR);return s?s.map(mR).join(" "):t}},gR={...Um,color:un,backgroundColor:un,outlineColor:un,fill:un,stroke:un,borderColor:un,borderTopColor:un,borderRightColor:un,borderBottomColor:un,borderLeftColor:un,filter:Xp,WebkitFilter:Xp},sh=t=>gR[t];function H_(t,s){let o=sh(t);return o!==Xp&&(o=Za),o.getAnimatableNone?o.getAnimatableNone(s):void 0}const vR=new Set(["auto","none","0"]);function yR(t,s,o){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!vR.has(d)&&dl(d).values.length&&(c=t[r]),r++}if(c&&o)for(const d of s)t[d]=H_(o,c)}const Gy=t=>t===Fo||t===Ae,Fy=(t,s)=>parseFloat(t.split(", ")[s]),Zy=(t,s)=>(o,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return Fy(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?Fy(d[1],t):0}},bR=new Set(["x","y","z"]),xR=Go.filter(t=>!bR.has(t));function _R(t){const s=[];return xR.forEach(o=>{const r=t.getValue(o);r!==void 0&&(s.push([o,r.get()]),r.set(o.startsWith("scale")?1:0))}),s}const zo={width:({x:t},{paddingLeft:s="0",paddingRight:o="0"})=>t.max-t.min-parseFloat(s)-parseFloat(o),height:({y:t},{paddingTop:s="0",paddingBottom:o="0"})=>t.max-t.min-parseFloat(s)-parseFloat(o),top:(t,{top:s})=>parseFloat(s),left:(t,{left:s})=>parseFloat(s),bottom:({y:t},{top:s})=>parseFloat(s)+(t.max-t.min),right:({x:t},{left:s})=>parseFloat(s)+(t.max-t.min),x:Zy(4,13),y:Zy(5,14)};zo.translateX=zo.x;zo.translateY=zo.y;const Ci=new Set;let Qp=!1,em=!1;function V_(){if(em){const t=Array.from(Ci).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),o=new Map;s.forEach(r=>{const c=_R(r);c.length&&(o.set(r,c),r.render())}),t.forEach(r=>r.measureInitialState()),s.forEach(r=>{r.render();const c=o.get(r);c&&c.forEach(([d,u])=>{var p;(p=r.getValue(d))===null||p===void 0||p.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}em=!1,Qp=!1,Ci.forEach(t=>t.complete()),Ci.clear()}function q_(){Ci.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(em=!0)})}function kR(){q_(),V_()}class ah{constructor(s,o,r,c,d,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=o,this.name=r,this.motionValue=c,this.element=d,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ci.add(this),Qp||(Qp=!0,kt.read(q_),kt.resolveKeyframes(V_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:o,element:r,motionValue:c}=this;for(let d=0;d<s.length;d++)if(s[d]===null)if(d===0){const u=c==null?void 0:c.get(),p=s[s.length-1];if(u!==void 0)s[0]=u;else if(r&&o){const m=r.readValue(o,p);m!=null&&(s[0]=m)}s[0]===void 0&&(s[0]=p),c&&u===void 0&&c.set(s[0])}else s[d]=s[d-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ci.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ci.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const G_=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),SR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function TR(t){const s=SR.exec(t);if(!s)return[,];const[,o,r,c]=s;return[`--${o??r}`,c]}function F_(t,s,o=1){const[r,c]=TR(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return G_(u)?parseFloat(u):u}return $m(c)?F_(c,s,o+1):c}const Z_=t=>s=>s.test(t),jR={test:t=>t==="auto",parse:t=>t},K_=[Fo,Ae,Es,Pa,_D,xD,jR],Ky=t=>K_.find(Z_(t));class Y_ extends ah{constructor(s,o,r,c,d){super(s,o,r,c,d,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:o,name:r}=this;if(!o||!o.current)return;super.readKeyframes();for(let m=0;m<s.length;m++){let g=s[m];if(typeof g=="string"&&(g=g.trim(),$m(g))){const v=F_(g,o.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!k_.has(r)||s.length!==2)return;const[c,d]=s,u=Ky(c),p=Ky(d);if(u!==p)if(Gy(u)&&Gy(p))for(let m=0;m<s.length;m++){const g=s[m];typeof g=="string"&&(s[m]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:o}=this,r=[];for(let c=0;c<s.length;c++)tR(s[c])&&r.push(c);r.length&&yR(s,r,o)}measureInitialState(){const{element:s,unresolvedKeyframes:o,name:r}=this;if(!s||!s.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=zo[r](s.measureViewportBox(),window.getComputedStyle(s.current)),o[0]=this.measuredOrigin;const c=o[o.length-1];c!==void 0&&s.getValue(r,c).jump(c,!1)}measureEndState(){var s;const{element:o,name:r,unresolvedKeyframes:c}=this;if(!o||!o.current)return;const d=o.getValue(r);d&&d.jump(this.measuredOrigin,!1);const u=c.length-1,p=c[u];c[u]=zo[r](o.measureViewportBox(),window.getComputedStyle(o.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([m,g])=>{o.getValue(m).set(g)}),this.resolveNoneKeyframes()}}const Yy=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Za.test(t)||t==="0")&&!t.startsWith("url("));function wR(t){const s=t[0];if(t.length===1)return!0;for(let o=0;o<t.length;o++)if(t[o]!==s)return!0}function NR(t,s,o,r){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const d=t[t.length-1],u=Yy(c,s),p=Yy(d,s);return!u||!p?!1:wR(t)||(o==="spring"||Wm(o))&&r}const CR=t=>t!==null;function Ld(t,{repeat:s,repeatType:o="loop"},r){const c=t.filter(CR),d=s&&o!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const ER=40;class J_{constructor({autoplay:s=!0,delay:o=0,type:r="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:u="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=As.now(),this.options={autoplay:s,delay:o,type:r,repeat:c,repeatDelay:d,repeatType:u,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>ER?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&kR(),this._resolved}onKeyframesResolved(s,o){this.resolvedAt=As.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:m,isGenerator:g}=this.options;if(!g&&!NR(s,r,c,d))if(u)this.options.duration=0;else{m&&m(Ld(s,this.options,o)),p&&p(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,o);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:o,...v},this.onPostResolved())}onPostResolved(){}then(s,o){return this.currentFinishedPromise.then(s,o)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const tm=2e4;function W_(t){let s=0;const o=50;let r=t.next(s);for(;!r.done&&s<tm;)s+=o,r=t.next(s);return s>=tm?1/0:s}const Nt=(t,s,o)=>t+(s-t)*o;function yp(t,s,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+(s-t)*6*o:o<1/2?s:o<2/3?t+(s-t)*(2/3-o)*6:t}function AR({hue:t,saturation:s,lightness:o,alpha:r}){t/=360,s/=100,o/=100;let c=0,d=0,u=0;if(!s)c=d=u=o;else{const p=o<.5?o*(1+s):o+s-o*s,m=2*o-p;c=yp(m,p,t+1/3),d=yp(m,p,t),u=yp(m,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function pd(t,s){return o=>o>0?s:t}const bp=(t,s,o)=>{const r=t*t,c=o*(s*s-r)+r;return c<0?0:Math.sqrt(c)},DR=[Wp,wi,Eo],RR=t=>DR.find(s=>s.test(t));function Jy(t){const s=RR(t);if(!s)return!1;let o=s.parse(t);return s===Eo&&(o=AR(o)),o}const Wy=(t,s)=>{const o=Jy(t),r=Jy(s);if(!o||!r)return pd(t,s);const c={...o};return d=>(c.red=bp(o.red,r.red,d),c.green=bp(o.green,r.green,d),c.blue=bp(o.blue,r.blue,d),c.alpha=Nt(o.alpha,r.alpha,d),wi.transform(c))},MR=(t,s)=>o=>s(t(o)),yl=(...t)=>t.reduce(MR),nm=new Set(["none","hidden"]);function IR(t,s){return nm.has(t)?o=>o<=0?t:s:o=>o>=1?s:t}function OR(t,s){return o=>Nt(t,s,o)}function ih(t){return typeof t=="number"?OR:typeof t=="string"?$m(t)?pd:un.test(t)?Wy:zR:Array.isArray(t)?X_:typeof t=="object"?un.test(t)?Wy:BR:pd}function X_(t,s){const o=[...t],r=o.length,c=t.map((d,u)=>ih(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)o[u]=c[u](d);return o}}function BR(t,s){const o={...t,...s},r={};for(const c in o)t[c]!==void 0&&s[c]!==void 0&&(r[c]=ih(t[c])(t[c],s[c]));return c=>{for(const d in r)o[d]=r[d](c);return o}}function LR(t,s){var o;const r=[],c={color:0,var:0,number:0};for(let d=0;d<s.values.length;d++){const u=s.types[d],p=t.indexes[u][c[u]],m=(o=t.values[p])!==null&&o!==void 0?o:0;r[d]=m,c[u]++}return r}const zR=(t,s)=>{const o=Za.createTransformer(s),r=dl(t),c=dl(s);return r.indexes.var.length===c.indexes.var.length&&r.indexes.color.length===c.indexes.color.length&&r.indexes.number.length>=c.indexes.number.length?nm.has(t)&&!c.values.length||nm.has(s)&&!r.values.length?IR(t,s):yl(X_(LR(r,c),c.values),o):pd(t,s)};function Q_(t,s,o){return typeof t=="number"&&typeof s=="number"&&typeof o=="number"?Nt(t,s,o):ih(t)(t,s)}const $R=5;function e1(t,s,o){const r=Math.max(s-$R,0);return S_(o-t(r),s-r)}const Dt={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},xp=.001;function UR({duration:t=Dt.duration,bounce:s=Dt.bounce,velocity:o=Dt.velocity,mass:r=Dt.mass}){let c,d,u=1-s;u=aa(Dt.minDamping,Dt.maxDamping,u),t=aa(Dt.minDuration,Dt.maxDuration,ta(t)),u<1?(c=g=>{const v=g*u,b=v*t,y=v-o,S=sm(g,u),k=Math.exp(-b);return xp-y/S*k},d=g=>{const b=g*u*t,y=b*o+o,S=Math.pow(u,2)*Math.pow(g,2)*t,k=Math.exp(-b),j=sm(Math.pow(g,2),u);return(-c(g)+xp>0?-1:1)*((y-S)*k)/j}):(c=g=>{const v=Math.exp(-g*t),b=(g-o)*t+1;return-xp+v*b},d=g=>{const v=Math.exp(-g*t),b=(o-g)*(t*t);return v*b});const p=5/t,m=HR(c,d,p);if(t=ea(t),isNaN(m))return{stiffness:Dt.stiffness,damping:Dt.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const PR=12;function HR(t,s,o){let r=o;for(let c=1;c<PR;c++)r=r-t(r)/s(r);return r}function sm(t,s){return t*Math.sqrt(1-s*s)}const VR=["duration","bounce"],qR=["stiffness","damping","mass"];function Xy(t,s){return s.some(o=>t[o]!==void 0)}function GR(t){let s={velocity:Dt.velocity,stiffness:Dt.stiffness,damping:Dt.damping,mass:Dt.mass,isResolvedFromDuration:!1,...t};if(!Xy(t,qR)&&Xy(t,VR))if(t.visualDuration){const o=t.visualDuration,r=2*Math.PI/(o*1.2),c=r*r,d=2*aa(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:Dt.mass,stiffness:c,damping:d}}else{const o=UR(t);s={...s,...o,mass:Dt.mass},s.isResolvedFromDuration=!0}return s}function t1(t=Dt.visualDuration,s=Dt.bounce){const o=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:r,restDelta:c}=o;const d=o.keyframes[0],u=o.keyframes[o.keyframes.length-1],p={done:!1,value:d},{stiffness:m,damping:g,mass:v,duration:b,velocity:y,isResolvedFromDuration:S}=GR({...o,velocity:-ta(o.velocity||0)}),k=y||0,j=g/(2*Math.sqrt(m*v)),N=u-d,T=ta(Math.sqrt(m/v)),C=Math.abs(N)<5;r||(r=C?Dt.restSpeed.granular:Dt.restSpeed.default),c||(c=C?Dt.restDelta.granular:Dt.restDelta.default);let A;if(j<1){const E=sm(T,j);A=D=>{const P=Math.exp(-j*T*D);return u-P*((k+j*T*N)/E*Math.sin(E*D)+N*Math.cos(E*D))}}else if(j===1)A=E=>u-Math.exp(-T*E)*(N+(k+T*N)*E);else{const E=T*Math.sqrt(j*j-1);A=D=>{const P=Math.exp(-j*T*D),O=Math.min(E*D,300);return u-P*((k+j*T*N)*Math.sinh(O)+E*N*Math.cosh(O))/E}}const I={calculatedDuration:S&&b||null,next:E=>{const D=A(E);if(S)p.done=E>=b;else{let P=0;j<1&&(P=E===0?ea(k):e1(A,E,D));const O=Math.abs(P)<=r,z=Math.abs(u-D)<=c;p.done=O&&z}return p.value=p.done?u:D,p},toString:()=>{const E=Math.min(W_(I),tm),D=j_(P=>I.next(E*P).value,E,30);return E+"ms "+D}};return I}function Qy({keyframes:t,velocity:s=0,power:o=.8,timeConstant:r=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:u,min:p,max:m,restDelta:g=.5,restSpeed:v}){const b=t[0],y={done:!1,value:b},S=O=>p!==void 0&&O<p||m!==void 0&&O>m,k=O=>p===void 0?m:m===void 0||Math.abs(p-O)<Math.abs(m-O)?p:m;let j=o*s;const N=b+j,T=u===void 0?N:u(N);T!==N&&(j=T-b);const C=O=>-j*Math.exp(-O/r),A=O=>T+C(O),I=O=>{const z=C(O),Q=A(O);y.done=Math.abs(z)<=g,y.value=y.done?T:Q};let E,D;const P=O=>{S(y.value)&&(E=O,D=t1({keyframes:[y.value,k(y.value)],velocity:e1(A,O,y.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return P(0),{calculatedDuration:null,next:O=>{let z=!1;return!D&&E===void 0&&(z=!0,I(O),P(O)),E!==void 0&&O>=E?D.next(O-E):(!z&&I(O),y)}}}const FR=vl(.42,0,1,1),ZR=vl(0,0,.58,1),n1=vl(.42,0,.58,1),KR=t=>Array.isArray(t)&&typeof t[0]!="number",YR={linear:In,easeIn:FR,easeInOut:n1,easeOut:ZR,circIn:eh,circInOut:O_,circOut:I_,backIn:Qm,backInOut:R_,backOut:D_,anticipate:M_},eb=t=>{if(Xm(t)){n_(t.length===4);const[s,o,r,c]=t;return vl(s,o,r,c)}else if(typeof t=="string")return YR[t];return t};function JR(t,s,o){const r=[],c=o||Q_,d=t.length-1;for(let u=0;u<d;u++){let p=c(t[u],t[u+1]);if(s){const m=Array.isArray(s)?s[u]||In:s;p=yl(m,p)}r.push(p)}return r}function WR(t,s,{clamp:o=!0,ease:r,mixer:c}={}){const d=t.length;if(n_(d===s.length),d===1)return()=>s[0];if(d===2&&s[0]===s[1])return()=>s[1];const u=t[0]===t[1];t[0]>t[d-1]&&(t=[...t].reverse(),s=[...s].reverse());const p=JR(s,r,c),m=p.length,g=v=>{if(u&&v<t[0])return s[0];let b=0;if(m>1)for(;b<t.length-2&&!(v<t[b+1]);b++);const y=Lo(t[b],t[b+1],v);return p[b](y)};return o?v=>g(aa(t[0],t[d-1],v)):g}function XR(t,s){const o=t[t.length-1];for(let r=1;r<=s;r++){const c=Lo(0,s,r);t.push(Nt(o,1,c))}}function QR(t){const s=[0];return XR(s,t.length-1),s}function eM(t,s){return t.map(o=>o*s)}function tM(t,s){return t.map(()=>s||n1).splice(0,t.length-1)}function md({duration:t=300,keyframes:s,times:o,ease:r="easeInOut"}){const c=KR(r)?r.map(eb):eb(r),d={done:!1,value:s[0]},u=eM(o&&o.length===s.length?o:QR(s),t),p=WR(u,s,{ease:Array.isArray(c)?c:tM(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const nM=t=>{const s=({timestamp:o})=>t(o);return{start:()=>kt.update(s,!0),stop:()=>Fa(s),now:()=>cn.isProcessing?cn.timestamp:As.now()}},sM={decay:Qy,inertia:Qy,tween:md,keyframes:md,spring:t1},aM=t=>t/100;class oh extends J_{constructor(s){super(s),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:m}=this.options;m&&m()};const{name:o,motionValue:r,element:c,keyframes:d}=this.options,u=(c==null?void 0:c.KeyframeResolver)||ah,p=(m,g)=>this.onKeyframesResolved(m,g);this.resolver=new u(d,p,o,r,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:o="keyframes",repeat:r=0,repeatDelay:c=0,repeatType:d,velocity:u=0}=this.options,p=Wm(o)?o:sM[o]||md;let m,g;p!==md&&typeof s[0]!="number"&&(m=yl(aM,Q_(s[0],s[1])),s=[0,100]);const v=p({...this.options,keyframes:s});d==="mirror"&&(g=p({...this.options,keyframes:[...s].reverse(),velocity:-u})),v.calculatedDuration===null&&(v.calculatedDuration=W_(v));const{calculatedDuration:b}=v,y=b+c,S=y*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:m,calculatedDuration:b,resolvedDuration:y,totalDuration:S}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,o=!1){const{resolved:r}=this;if(!r){const{keyframes:O}=this.options;return{done:!0,value:O[O.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:u,mapPercentToKeyframes:p,keyframes:m,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=r;if(this.startTime===null)return d.next(0);const{delay:y,repeat:S,repeatType:k,repeatDelay:j,onUpdate:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),o?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const T=this.currentTime-y*(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 A=this.currentTime,I=d;if(S){const O=Math.min(this.currentTime,v)/b;let z=Math.floor(O),Q=O%1;!Q&&O>=1&&(Q=1),Q===1&&z--,z=Math.min(z,S+1),!!(z%2)&&(k==="reverse"?(Q=1-Q,j&&(Q-=j/b)):k==="mirror"&&(I=u)),A=aa(0,1,Q)*b}const E=C?{done:!1,value:m[0]}:I.next(A);p&&(E.value=p(E.value));let{done:D}=E;!C&&g!==null&&(D=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const P=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&D);return P&&c!==void 0&&(E.value=Ld(m,this.options,c)),N&&N(E.value),P&&this.finish(),E}get duration(){const{resolved:s}=this;return s?ta(s.calculatedDuration):0}get time(){return ta(this.currentTime)}set time(s){s=ea(s),this.currentTime=s,this.holdTime!==null||this.speed===0?this.holdTime=s:this.driver&&(this.startTime=this.driver.now()-s/this.speed)}get speed(){return this.playbackSpeed}set speed(s){const o=this.playbackSpeed!==s;this.playbackSpeed=s,o&&(this.time=ta(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=nM,onPlay:o,startTime:r}=this.options;this.driver||(this.driver=s(d=>this.tick(d))),o&&o();const c=this.driver.now();this.holdTime!==null?this.startTime=c-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=c):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var s;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(s=this.currentTime)!==null&&s!==void 0?s:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:s}=this.options;s&&s()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(s){return this.startTime=0,this.tick(s,!0)}}const iM=new Set(["opacity","clipPath","filter","transform"]);function oM(t,s,o,{delay:r=0,duration:c=300,repeat:d=0,repeatType:u="loop",ease:p="easeInOut",times:m}={}){const g={[s]:o};m&&(g.offset=m);const v=N_(p,c);return Array.isArray(v)&&(g.easing=v),t.animate(g,{delay:r,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:d+1,direction:u==="reverse"?"alternate":"normal"})}const rM=Jm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),hd=10,lM=2e4;function cM(t){return Wm(t.type)||t.type==="spring"||!w_(t.ease)}function dM(t,s){const o=new oh({...s,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const c=[];let d=0;for(;!r.done&&d<lM;)r=o.sample(d),c.push(r.value),d+=hd;return{times:void 0,keyframes:c,duration:d-hd,ease:"linear"}}const s1={anticipate:M_,backInOut:R_,circInOut:O_};function uM(t){return t in s1}class tb extends J_{constructor(s){super(s);const{name:o,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new Y_(d,(u,p)=>this.onKeyframesResolved(u,p),o,r,c),this.resolver.scheduleResolve()}initPlayback(s,o){let{duration:r=300,times:c,ease:d,type:u,motionValue:p,name:m,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof d=="string"&&fd()&&uM(d)&&(d=s1[d]),cM(this.options)){const{onComplete:b,onUpdate:y,motionValue:S,element:k,...j}=this.options,N=dM(s,j);s=N.keyframes,s.length===1&&(s[1]=s[0]),r=N.duration,c=N.times,d=N.ease,u="keyframes"}const v=oM(p.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(Vy(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(Ld(s,this.options,o)),b&&b(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:r,times:c,type:u,ease:d,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:o}=s;return ta(o)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:o}=s;return ta(o.currentTime||0)}set time(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.currentTime=ea(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:o}=s;return o.playbackRate}set speed(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:o}=s;return o.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:o}=s;return o.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:o}=this;if(!o)return In;const{animation:r}=o;Vy(r,s)}return In}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:o,keyframes:r,duration:c,type:d,ease:u,times:p}=s;if(o.playState==="idle"||o.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:y,...S}=this.options,k=new oh({...S,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),j=ea(this.time);g.setWithVelocity(k.sample(j-hd).value,k.sample(j).value,hd)}const{onStop:m}=this.options;m&&m(),this.cancel()}complete(){const{resolved:s}=this;s&&s.animation.finish()}cancel(){const{resolved:s}=this;s&&s.animation.cancel()}static supports(s){const{motionValue:o,name:r,repeatDelay:c,repeatType:d,damping:u,type:p}=s;if(!o||!o.owner||!(o.owner.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:g}=o.owner.getProps();return rM()&&r&&iM.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const fM={type:"spring",stiffness:500,damping:25,restSpeed:10},pM=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),mM={type:"keyframes",duration:.8},hM={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},gM=(t,{keyframes:s})=>s.length>2?mM:Oi.has(t)?t.startsWith("scale")?pM(s[1]):fM:hM;function vM({when:t,delay:s,delayChildren:o,staggerChildren:r,staggerDirection:c,repeat:d,repeatType:u,repeatDelay:p,from:m,elapsed:g,...v}){return!!Object.keys(v).length}const rh=(t,s,o,r={},c,d)=>u=>{const p=Fm(r,t)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-ea(m);let v={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:y=>{s.set(y),p.onUpdate&&p.onUpdate(y)},onComplete:()=>{u(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:d?void 0:c};vM(p)||(v={...v,...gM(t,v)}),v.duration&&(v.duration=ea(v.duration)),v.repeatDelay&&(v.repeatDelay=ea(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let b=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(b=!0)),b&&!d&&s.get()!==void 0){const y=Ld(v.keyframes,p);if(y!==void 0)return kt.update(()=>{v.onUpdate(y),v.onComplete()}),new YD([])}return!d&&tb.supports(v)?new tb(v):new oh(v)};function yM({protectedKeys:t,needsAnimating:s},o){const r=t.hasOwnProperty(o)&&s[o]!==!0;return s[o]=!1,r}function a1(t,s,{delay:o=0,transitionOverride:r,type:c}={}){var d;let{transition:u=t.getDefaultTransition(),transitionEnd:p,...m}=s;r&&(u=r);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const b in m){const y=t.getValue(b,(d=t.latestValues[b])!==null&&d!==void 0?d:null),S=m[b];if(S===void 0||v&&yM(v,b))continue;const k={delay:o,...Fm(u||{},b)};let j=!1;if(window.MotionHandoffAnimation){const T=T_(t);if(T){const C=window.MotionHandoffAnimation(T,b,kt);C!==null&&(k.startTime=C,j=!0)}}Yp(t,b),y.start(rh(b,y,S,t.shouldReduceMotion&&k_.has(b)?{type:!1}:k,t,j));const N=y.animation;N&&g.push(N)}return p&&Promise.all(g).then(()=>{kt.update(()=>{p&&GD(t,p)})}),g}function am(t,s,o={}){var r;const c=Bd(t,s,o.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};o.transitionOverride&&(d=o.transitionOverride);const u=c?()=>Promise.all(a1(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:y}=d;return bM(t,s,v+g,b,y,o)}:()=>Promise.resolve(),{when:m}=d;if(m){const[g,v]=m==="beforeChildren"?[u,p]:[p,u];return g().then(()=>v())}else return Promise.all([u(),p(o.delay)])}function bM(t,s,o=0,r=0,c=1,d){const u=[],p=(t.variantChildren.size-1)*r,m=c===1?(g=0)=>g*r:(g=0)=>p-g*r;return Array.from(t.variantChildren).sort(xM).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(am(g,s,{...d,delay:o+m(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function xM(t,s){return t.sortNodePosition(s)}function _M(t,s,o={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>am(t,d,o));r=Promise.all(c)}else if(typeof s=="string")r=am(t,s,o);else{const c=typeof s=="function"?Bd(t,s,o.custom):s;r=Promise.all(a1(t,c,o))}return r.then(()=>{t.notify("AnimationComplete",s)})}const kM=Im.length;function i1(t){if(!t)return;if(!t.isControllingVariants){const o=t.parent?i1(t.parent)||{}:{};return t.props.initial!==void 0&&(o.initial=t.props.initial),o}const s={};for(let o=0;o<kM;o++){const r=Im[o],c=t.props[r];(rl(c)||c===!1)&&(s[r]=c)}return s}const SM=[...Mm].reverse(),TM=Mm.length;function jM(t){return s=>Promise.all(s.map(({animation:o,options:r})=>_M(t,o,r)))}function wM(t){let s=jM(t),o=nb(),r=!0;const c=m=>(g,v)=>{var b;const y=Bd(t,v,m==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(y){const{transition:S,transitionEnd:k,...j}=y;g={...g,...j,...k}}return g};function d(m){s=m(t)}function u(m){const{props:g}=t,v=i1(t.parent)||{},b=[],y=new Set;let S={},k=1/0;for(let N=0;N<TM;N++){const T=SM[N],C=o[T],A=g[T]!==void 0?g[T]:v[T],I=rl(A),E=T===m?C.isActive:null;E===!1&&(k=N);let D=A===v[T]&&A!==g[T]&&I;if(D&&r&&t.manuallyAnimateOnMount&&(D=!1),C.protectedKeys={...S},!C.isActive&&E===null||!A&&!C.prevProp||Id(A)||typeof A=="boolean")continue;const P=NM(C.prevProp,A);let O=P||T===m&&C.isActive&&!D&&I||N>k&&I,z=!1;const Q=Array.isArray(A)?A:[A];let $=Q.reduce(c(T),{});E===!1&&($={});const{prevResolvedValues:J={}}=C,me={...J,...$},te=F=>{O=!0,y.has(F)&&(z=!0,y.delete(F)),C.needsAnimating[F]=!0;const Z=t.getValue(F);Z&&(Z.liveStyle=!1)};for(const F in me){const Z=$[F],de=J[F];if(S.hasOwnProperty(F))continue;let W=!1;Kp(Z)&&Kp(de)?W=!__(Z,de):W=Z!==de,W?Z!=null?te(F):y.add(F):Z!==void 0&&y.has(F)?te(F):C.protectedKeys[F]=!0}C.prevProp=A,C.prevResolvedValues=$,C.isActive&&(S={...S,...$}),r&&t.blockInitialAnimation&&(O=!1),O&&(!(D&&P)||z)&&b.push(...Q.map(F=>({animation:F,options:{type:T}})))}if(y.size){const N={};y.forEach(T=>{const C=t.getBaseTarget(T),A=t.getValue(T);A&&(A.liveStyle=!0),N[T]=C??null}),b.push({animation:N})}let j=!!b.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(j=!1),r=!1,j?s(b):Promise.resolve()}function p(m,g){var v;if(o[m].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(y=>{var S;return(S=y.animationState)===null||S===void 0?void 0:S.setActive(m,g)}),o[m].isActive=g;const b=u(m);for(const y in o)o[y].protectedKeys={};return b}return{animateChanges:u,setActive:p,setAnimateFunction:d,getState:()=>o,reset:()=>{o=nb(),r=!0}}}function NM(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!__(s,t):!1}function xi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nb(){return{animate:xi(!0),whileInView:xi(),whileHover:xi(),whileTap:xi(),whileDrag:xi(),whileFocus:xi(),exit:xi()}}class Ja{constructor(s){this.isMounted=!1,this.node=s}update(){}}class CM extends Ja{constructor(s){super(s),s.animationState||(s.animationState=wM(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Id(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:o}=this.node.prevProps||{};s!==o&&this.updateAnimationControlsSubscription()}unmount(){var s;this.node.animationState.reset(),(s=this.unmountControls)===null||s===void 0||s.call(this)}}let EM=0;class AM extends Ja{constructor(){super(...arguments),this.id=EM++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:o}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===r)return;const c=this.node.animationState.setActive("exit",!s);o&&!s&&c.then(()=>o(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const DM={animation:{Feature:CM},exit:{Feature:AM}},hs={x:!1,y:!1};function o1(){return hs.x||hs.y}function RM(t){return t==="x"||t==="y"?hs[t]?null:(hs[t]=!0,()=>{hs[t]=!1}):hs.x||hs.y?null:(hs.x=hs.y=!0,()=>{hs.x=hs.y=!1})}const lh=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function ul(t,s,o,r={passive:!0}){return t.addEventListener(s,o,r),()=>t.removeEventListener(s,o)}function bl(t){return{point:{x:t.pageX,y:t.pageY}}}const MM=t=>s=>lh(s)&&t(s,bl(s));function Qr(t,s,o,r){return ul(t,s,MM(o),r)}const sb=(t,s)=>Math.abs(t-s);function IM(t,s){const o=sb(t.x,s.x),r=sb(t.y,s.y);return Math.sqrt(o**2+r**2)}class r1{constructor(s,o,{transformPagePoint:r,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=kp(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,S=IM(b.offset,{x:0,y:0})>=3;if(!y&&!S)return;const{point:k}=b,{timestamp:j}=cn;this.history.push({...k,timestamp:j});const{onStart:N,onMove:T}=this.handlers;y||(N&&N(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,b)},this.handlePointerMove=(b,y)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=_p(y,this.transformPagePoint),kt.update(this.updatePoint,!0)},this.handlePointerUp=(b,y)=>{this.end();const{onEnd:S,onSessionEnd:k,resumeAnimation:j}=this.handlers;if(this.dragSnapToOrigin&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=kp(b.type==="pointercancel"?this.lastMoveEventInfo:_p(y,this.transformPagePoint),this.history);this.startEvent&&S&&S(b,N),k&&k(b,N)},!lh(s))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=r,this.contextWindow=c||window;const u=bl(s),p=_p(u,this.transformPagePoint),{point:m}=p,{timestamp:g}=cn;this.history=[{...m,timestamp:g}];const{onSessionStart:v}=o;v&&v(s,kp(p,this.history)),this.removeListeners=yl(Qr(this.contextWindow,"pointermove",this.handlePointerMove),Qr(this.contextWindow,"pointerup",this.handlePointerUp),Qr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Fa(this.updatePoint)}}function _p(t,s){return s?{point:s(t.point)}:t}function ab(t,s){return{x:t.x-s.x,y:t.y-s.y}}function kp({point:t},s){return{point:t,delta:ab(t,l1(s)),offset:ab(t,OM(s)),velocity:BM(s,.1)}}function OM(t){return t[0]}function l1(t){return t[t.length-1]}function BM(t,s){if(t.length<2)return{x:0,y:0};let o=t.length-1,r=null;const c=l1(t);for(;o>=0&&(r=t[o],!(c.timestamp-r.timestamp>ea(s)));)o--;if(!r)return{x:0,y:0};const d=ta(c.timestamp-r.timestamp);if(d===0)return{x:0,y:0};const u={x:(c.x-r.x)/d,y:(c.y-r.y)/d};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}const c1=1e-4,LM=1-c1,zM=1+c1,d1=.01,$M=0-d1,UM=0+d1;function Bn(t){return t.max-t.min}function PM(t,s,o){return Math.abs(t-s)<=o}function ib(t,s,o,r=.5){t.origin=r,t.originPoint=Nt(s.min,s.max,t.origin),t.scale=Bn(o)/Bn(s),t.translate=Nt(o.min,o.max,t.origin)-t.originPoint,(t.scale>=LM&&t.scale<=zM||isNaN(t.scale))&&(t.scale=1),(t.translate>=$M&&t.translate<=UM||isNaN(t.translate))&&(t.translate=0)}function el(t,s,o,r){ib(t.x,s.x,o.x,r?r.originX:void 0),ib(t.y,s.y,o.y,r?r.originY:void 0)}function ob(t,s,o){t.min=o.min+s.min,t.max=t.min+Bn(s)}function HM(t,s,o){ob(t.x,s.x,o.x),ob(t.y,s.y,o.y)}function rb(t,s,o){t.min=s.min-o.min,t.max=t.min+Bn(s)}function tl(t,s,o){rb(t.x,s.x,o.x),rb(t.y,s.y,o.y)}function VM(t,{min:s,max:o},r){return s!==void 0&&t<s?t=r?Nt(s,t,r.min):Math.max(t,s):o!==void 0&&t>o&&(t=r?Nt(o,t,r.max):Math.min(t,o)),t}function lb(t,s,o){return{min:s!==void 0?t.min+s:void 0,max:o!==void 0?t.max+o-(t.max-t.min):void 0}}function qM(t,{top:s,left:o,bottom:r,right:c}){return{x:lb(t.x,o,c),y:lb(t.y,s,r)}}function cb(t,s){let o=s.min-t.min,r=s.max-t.max;return s.max-s.min<t.max-t.min&&([o,r]=[r,o]),{min:o,max:r}}function GM(t,s){return{x:cb(t.x,s.x),y:cb(t.y,s.y)}}function FM(t,s){let o=.5;const r=Bn(t),c=Bn(s);return c>r?o=Lo(s.min,s.max-r,t.min):r>c&&(o=Lo(t.min,t.max-c,s.min)),aa(0,1,o)}function ZM(t,s){const o={};return s.min!==void 0&&(o.min=s.min-t.min),s.max!==void 0&&(o.max=s.max-t.min),o}const im=.35;function KM(t=im){return t===!1?t=0:t===!0&&(t=im),{x:db(t,"left","right"),y:db(t,"top","bottom")}}function db(t,s,o){return{min:ub(t,s),max:ub(t,o)}}function ub(t,s){return typeof t=="number"?t:t[s]||0}const fb=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ao=()=>({x:fb(),y:fb()}),pb=()=>({min:0,max:0}),$t=()=>({x:pb(),y:pb()});function es(t){return[t("x"),t("y")]}function u1({top:t,left:s,right:o,bottom:r}){return{x:{min:s,max:o},y:{min:t,max:r}}}function YM({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function JM(t,s){if(!s)return t;const o=s({x:t.left,y:t.top}),r=s({x:t.right,y:t.bottom});return{top:o.y,left:o.x,bottom:r.y,right:r.x}}function Sp(t){return t===void 0||t===1}function om({scale:t,scaleX:s,scaleY:o}){return!Sp(t)||!Sp(s)||!Sp(o)}function Ti(t){return om(t)||f1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function f1(t){return mb(t.x)||mb(t.y)}function mb(t){return t&&t!=="0%"}function gd(t,s,o){const r=t-o,c=s*r;return o+c}function hb(t,s,o,r,c){return c!==void 0&&(t=gd(t,c,r)),gd(t,o,r)+s}function rm(t,s=0,o=1,r,c){t.min=hb(t.min,s,o,r,c),t.max=hb(t.max,s,o,r,c)}function p1(t,{x:s,y:o}){rm(t.x,s.translate,s.scale,s.originPoint),rm(t.y,o.translate,o.scale,o.originPoint)}const gb=.999999999999,vb=1.0000000000001;function WM(t,s,o,r=!1){const c=o.length;if(!c)return;s.x=s.y=1;let d,u;for(let p=0;p<c;p++){d=o[p],u=d.projectionDelta;const{visualElement:m}=d.options;m&&m.props.style&&m.props.style.display==="contents"||(r&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Ro(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,p1(t,u)),r&&Ti(d.latestValues)&&Ro(t,d.latestValues))}s.x<vb&&s.x>gb&&(s.x=1),s.y<vb&&s.y>gb&&(s.y=1)}function Do(t,s){t.min=t.min+s,t.max=t.max+s}function yb(t,s,o,r,c=.5){const d=Nt(t.min,t.max,c);rm(t,s,o,d,r)}function Ro(t,s){yb(t.x,s.x,s.scaleX,s.scale,s.originX),yb(t.y,s.y,s.scaleY,s.scale,s.originY)}function m1(t,s){return u1(JM(t.getBoundingClientRect(),s))}function XM(t,s,o){const r=m1(t,o),{scroll:c}=s;return c&&(Do(r.x,c.offset.x),Do(r.y,c.offset.y)),r}const h1=({current:t})=>t?t.ownerDocument.defaultView:null,QM=new WeakMap;class e4{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=$t(),this.visualElement=s}start(s,{snapToCursor:o=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(bl(v).point)},d=(v,b)=>{const{drag:y,dragPropagation:S,onDragStart:k}=this.getProps();if(y&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=RM(y),!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),es(N=>{let T=this.getAxisMotionValue(N).get()||0;if(Es.test(T)){const{projection:C}=this.visualElement;if(C&&C.layout){const A=C.layout.layoutBox[N];A&&(T=Bn(A)*(parseFloat(T)/100))}}this.originPoint[N]=T}),k&&kt.postRender(()=>k(v,b)),Yp(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},u=(v,b)=>{const{dragPropagation:y,dragDirectionLock:S,onDirectionLock:k,onDrag:j}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:N}=b;if(S&&this.currentDirection===null){this.currentDirection=t4(N),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",b.point,N),this.updateAxis("y",b.point,N),this.visualElement.render(),j&&j(v,b)},p=(v,b)=>this.stop(v,b),m=()=>es(v=>{var b;return this.getAnimationState(v)==="paused"&&((b=this.getAxisMotionValue(v).animation)===null||b===void 0?void 0:b.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new r1(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:p,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:h1(this.visualElement)})}stop(s,o){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&kt.postRender(()=>d(s,o))}cancel(){this.isDragging=!1;const{projection:s,animationState:o}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),o&&o.setActive("whileDrag",!1)}updateAxis(s,o,r){const{drag:c}=this.getProps();if(!r||!qc(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=VM(u,this.constraints[s],this.elastic[s])),d.set(u)}resolveConstraints(){var s;const{dragConstraints:o,dragElastic:r}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)===null||s===void 0?void 0:s.layout,d=this.constraints;o&&Co(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=qM(c.layoutBox,o):this.constraints=!1,this.elastic=KM(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&es(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=ZM(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:o}=this.getProps();if(!s||!Co(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=XM(r,c.root,this.visualElement.getTransformPagePoint());let u=GM(c.layout.layoutBox,d);if(o){const p=o(YM(u));this.hasMutatedConstraints=!!p,p&&(u=u1(p))}return u}startAnimation(s){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=es(v=>{if(!qc(v,o,this.currentDirection))return;let b=m&&m[v]||{};u&&(b={min:0,max:0});const y=c?200:1e6,S=c?40:1e7,k={type:"inertia",velocity:r?s[v]:0,bounceStiffness:y,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...d,...b};return this.startAxisValueAnimation(v,k)});return Promise.all(g).then(p)}startAxisValueAnimation(s,o){const r=this.getAxisMotionValue(s);return Yp(this.visualElement,s),r.start(rh(s,r,0,o,this.visualElement,!1))}stopAnimation(){es(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){es(s=>{var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.pause()})}getAnimationState(s){var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.state}getAxisMotionValue(s){const o=`_drag${s.toUpperCase()}`,r=this.visualElement.getProps(),c=r[o];return c||this.visualElement.getValue(s,(r.initial?r.initial[s]:void 0)||0)}snapToCursor(s){es(o=>{const{drag:r}=this.getProps();if(!qc(o,r,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:u,max:p}=c.layout.layoutBox[o];d.set(s[o]-Nt(u,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!Co(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};es(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const m=p.get();c[u]=FM({min:m,max:m},this.constraints[u])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),es(u=>{if(!qc(u,s,null))return;const p=this.getAxisMotionValue(u),{min:m,max:g}=this.constraints[u];p.set(Nt(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;QM.set(this.visualElement,this);const s=this.visualElement.current,o=Qr(s,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();Co(m)&&m.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,d=c.addEventListener("measure",r);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),kt.read(r);const u=ul(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(es(v=>{const b=this.getAxisMotionValue(v);b&&(this.originPoint[v]+=m[v].translate,b.set(b.get()+m[v].translate))}),this.visualElement.render())}));return()=>{u(),o(),d(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:u=im,dragMomentum:p=!0}=s;return{...s,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function qc(t,s,o){return(s===!0||s===t)&&(o===null||o===t)}function t4(t,s=10){let o=null;return Math.abs(t.y)>s?o="y":Math.abs(t.x)>s&&(o="x"),o}class n4 extends Ja{constructor(s){super(s),this.removeGroupControls=In,this.removeListeners=In,this.controls=new e4(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||In}unmount(){this.removeGroupControls(),this.removeListeners()}}const bb=t=>(s,o)=>{t&&kt.postRender(()=>t(s,o))};class s4 extends Ja{constructor(){super(...arguments),this.removePointerDownListener=In}onPointerDown(s){this.session=new r1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:h1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:o,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:bb(s),onStart:bb(o),onMove:r,onEnd:(d,u)=>{delete this.session,c&&kt.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=Qr(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 ad={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function xb(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Ur={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ae.test(t))t=parseFloat(t);else return t;const o=xb(t,s.target.x),r=xb(t,s.target.y);return`${o}% ${r}%`}},a4={correct:(t,{treeScale:s,projectionDelta:o})=>{const r=t,c=Za.parse(t);if(c.length>5)return r;const d=Za.createTransformer(t),u=typeof c[0]!="number"?1:0,p=o.x.scale*s.x,m=o.y.scale*s.y;c[0+u]/=p,c[1+u]/=m;const g=Nt(p,m,.5);return typeof c[2+u]=="number"&&(c[2+u]/=g),typeof c[3+u]=="number"&&(c[3+u]/=g),d(c)}};class i4 extends x.Component{componentDidMount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;DD(o4),d&&(o.group&&o.group.add(d),r&&r.register&&c&&r.register(d),d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,onExitComplete:()=>this.safeToRemove()})),ad.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:o,visualElement:r,drag:c,isPresent:d}=this.props,u=r.projection;return u&&(u.isPresent=d,c||s.layoutDependency!==o||o===void 0?u.willUpdate():this.safeToRemove(),s.isPresent!==d&&(d?u.promote():u.relegate()||kt.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Bm.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),o&&o.group&&o.group.remove(c),r&&r.deregister&&r.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function g1(t){const[s,o]=e_(),r=x.useContext(Em);return i.jsx(i4,{...t,layoutGroup:r,switchLayoutGroup:x.useContext(l_),isPresent:s,safeToRemove:o})}const o4={borderRadius:{...Ur,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ur,borderTopRightRadius:Ur,borderBottomLeftRadius:Ur,borderBottomRightRadius:Ur,boxShadow:a4};function r4(t,s,o){const r=fn(t)?t:cl(t);return r.start(rh("",r,s,o)),r.animation}function l4(t){return t instanceof SVGElement&&t.tagName!=="svg"}const c4=(t,s)=>t.depth-s.depth;class d4{constructor(){this.children=[],this.isDirty=!1}add(s){Zm(this.children,s),this.isDirty=!0}remove(s){Km(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(c4),this.isDirty=!1,this.children.forEach(s)}}function u4(t,s){const o=As.now(),r=({timestamp:c})=>{const d=c-o;d>=s&&(Fa(r),t(d-s))};return kt.read(r,!0),()=>Fa(r)}const v1=["TopLeft","TopRight","BottomLeft","BottomRight"],f4=v1.length,_b=t=>typeof t=="string"?parseFloat(t):t,kb=t=>typeof t=="number"||Ae.test(t);function p4(t,s,o,r,c,d){c?(t.opacity=Nt(0,o.opacity!==void 0?o.opacity:1,m4(r)),t.opacityExit=Nt(s.opacity!==void 0?s.opacity:1,0,h4(r))):d&&(t.opacity=Nt(s.opacity!==void 0?s.opacity:1,o.opacity!==void 0?o.opacity:1,r));for(let u=0;u<f4;u++){const p=`border${v1[u]}Radius`;let m=Sb(s,p),g=Sb(o,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||kb(m)===kb(g)?(t[p]=Math.max(Nt(_b(m),_b(g),r),0),(Es.test(g)||Es.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||o.rotate)&&(t.rotate=Nt(s.rotate||0,o.rotate||0,r))}function Sb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const m4=y1(0,.5,I_),h4=y1(.5,.95,In);function y1(t,s,o){return r=>r<t?0:r>s?1:o(Lo(t,s,r))}function Tb(t,s){t.min=s.min,t.max=s.max}function Jn(t,s){Tb(t.x,s.x),Tb(t.y,s.y)}function jb(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function wb(t,s,o,r,c){return t-=s,t=gd(t,1/o,r),c!==void 0&&(t=gd(t,1/c,r)),t}function g4(t,s=0,o=1,r=.5,c,d=t,u=t){if(Es.test(s)&&(s=parseFloat(s),s=Nt(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=Nt(d.min,d.max,r);t===d&&(p-=s),t.min=wb(t.min,s,o,p,c),t.max=wb(t.max,s,o,p,c)}function Nb(t,s,[o,r,c],d,u){g4(t,s[o],s[r],s[c],s.scale,d,u)}const v4=["x","scaleX","originX"],y4=["y","scaleY","originY"];function Cb(t,s,o,r){Nb(t.x,s,v4,o?o.x:void 0,r?r.x:void 0),Nb(t.y,s,y4,o?o.y:void 0,r?r.y:void 0)}function Eb(t){return t.translate===0&&t.scale===1}function b1(t){return Eb(t.x)&&Eb(t.y)}function Ab(t,s){return t.min===s.min&&t.max===s.max}function b4(t,s){return Ab(t.x,s.x)&&Ab(t.y,s.y)}function Db(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function x1(t,s){return Db(t.x,s.x)&&Db(t.y,s.y)}function Rb(t){return Bn(t.x)/Bn(t.y)}function Mb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class x4{constructor(){this.members=[]}add(s){Zm(this.members,s),s.scheduleRender()}remove(s){if(Km(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const o=this.members[this.members.length-1];o&&this.promote(o)}}relegate(s){const o=this.members.findIndex(c=>s===c);if(o===0)return!1;let r;for(let c=o;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){r=d;break}}return r?(this.promote(r),!0):!1}promote(s,o){const r=this.lead;if(s!==r&&(this.prevLead=r,this.lead=s,s.show(),r)){r.instance&&r.scheduleRender(),s.scheduleRender(),s.resumeFrom=r,o&&(s.resumeFrom.preserveOpacity=!0),r.snapshot&&(s.snapshot=r.snapshot,s.snapshot.latestValues=r.animationValues||r.latestValues),s.root&&s.root.isUpdating&&(s.isLayoutDirty=!0);const{crossfade:c}=s.options;c===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(s=>{const{options:o,resumingFrom:r}=s;o.onExitComplete&&o.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(s=>{s.instance&&s.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function _4(t,s,o){let r="";const c=t.x.translate/s.x,d=t.y.translate/s.y,u=(o==null?void 0:o.z)||0;if((c||d||u)&&(r=`translate3d(${c}px, ${d}px, ${u}px) `),(s.x!==1||s.y!==1)&&(r+=`scale(${1/s.x}, ${1/s.y}) `),o){const{transformPerspective:g,rotate:v,rotateX:b,rotateY:y,skewX:S,skewY:k}=o;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),b&&(r+=`rotateX(${b}deg) `),y&&(r+=`rotateY(${y}deg) `),S&&(r+=`skewX(${S}deg) `),k&&(r+=`skewY(${k}deg) `)}const p=t.x.scale*s.x,m=t.y.scale*s.y;return(p!==1||m!==1)&&(r+=`scale(${p}, ${m})`),r||"none"}const ji={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Kr=typeof window<"u"&&window.MotionDebug!==void 0,Tp=["","X","Y","Z"],k4={visibility:"hidden"},Ib=1e3;let S4=0;function jp(t,s,o,r){const{latestValues:c}=s;c[t]&&(o[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function _1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const o=T_(s);if(window.MotionHasOptimisedAnimation(o,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(o,"transform",kt,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&_1(r)}function k1({attachResizeListener:t,defaultParent:s,measureScroll:o,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=S4++,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,Kr&&(ji.totalNodes=ji.resolvedTargetDeltas=ji.recalculatedProjection=0),this.nodes.forEach(w4),this.nodes.forEach(D4),this.nodes.forEach(R4),this.nodes.forEach(N4),Kr&&window.MotionDebug.record(ji)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new d4)}addEventListener(u,p){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Ym),this.eventHandlers.get(u).add(p)}notifyListeners(u,...p){const m=this.eventHandlers.get(u);m&&m.notify(...p)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=l4(u),this.instance=u;const{layoutId:m,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(g||m)&&(this.isLayoutDirty=!0),t){let b;const y=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=u4(y,250),ad.hasAnimatedSinceResize&&(ad.hasAnimatedSinceResize=!1,this.nodes.forEach(Bb))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&v&&(m||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:y,hasRelativeTargetChanged:S,layout:k})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||v.getDefaultTransition()||L4,{onLayoutAnimationStart:N,onLayoutAnimationComplete:T}=v.getProps(),C=!this.targetLayout||!x1(this.targetLayout,k)||S,A=!y&&S;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||A||y&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,A);const I={...Fm(j,"layout"),onPlay:N,onComplete:T};(v.shouldReduceMotion||this.options.layoutRoot)&&(I.delay=0,I.type=!1),this.startAnimation(I)}else y||Bb(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=k})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Fa(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(M4),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&_1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const b=this.path[v];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}const{layoutId:p,layout:m}=this.options;if(p===void 0&&!m)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ob);return}this.isUpdating||this.nodes.forEach(E4),this.isUpdating=!1,this.nodes.forEach(A4),this.nodes.forEach(T4),this.nodes.forEach(j4),this.clearAllSnapshots();const p=As.now();cn.delta=aa(0,1e3/60,p-cn.timestamp),cn.timestamp=p,cn.isProcessing=!0,gp.update.process(cn),gp.preRender.process(cn),gp.render.process(cn),cn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Bm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(C4),this.sharedNodes.forEach(I4)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,kt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){kt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=$t(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(p=!1),p){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:o(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!c)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!b1(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(p||Ti(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const p=this.measurePageBox();let m=this.removeElementScroll(p);return u&&(m=this.removeTransform(m)),z4(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return $t();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some($4))){const{scroll:v}=this.root;v&&(Do(m.x,v.offset.x),Do(m.y,v.offset.y))}return m}removeElementScroll(u){var p;const m=$t();if(Jn(m,u),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return m;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:b,options:y}=v;v!==this.root&&b&&y.layoutScroll&&(b.wasRoot&&Jn(m,u),Do(m.x,b.offset.x),Do(m.y,b.offset.y))}return m}applyTransform(u,p=!1){const m=$t();Jn(m,u);for(let g=0;g<this.path.length;g++){const v=this.path[g];!p&&v.options.layoutScroll&&v.scroll&&v!==v.root&&Ro(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),Ti(v.latestValues)&&Ro(m,v.latestValues)}return Ti(this.latestValues)&&Ro(m,this.latestValues),m}removeTransform(u){const p=$t();Jn(p,u);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!Ti(g.latestValues))continue;om(g.latestValues)&&g.updateSnapshot();const v=$t(),b=g.measurePageBox();Jn(v,b),Cb(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return Ti(this.latestValues)&&Cb(p,this.latestValues),p}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==cn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var p;const m=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=m.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=m.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=m.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==m;if(!(u||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:y}=this.options;if(!(!this.layout||!(b||y))){if(this.resolvedRelativeTargetAt=cn.timestamp,!this.targetDelta&&!this.relativeTarget){const S=this.getClosestProjectingParent();S&&S.layout&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=$t(),this.relativeTargetOrigin=$t(),tl(this.relativeTargetOrigin,this.layout.layoutBox,S.layout.layoutBox),Jn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=$t(),this.targetWithTransforms=$t()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),HM(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Jn(this.target,this.layout.layoutBox),p1(this.target,this.targetDelta)):Jn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const S=this.getClosestProjectingParent();S&&!!S.resumingFrom==!!this.resumingFrom&&!S.options.layoutScroll&&S.target&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=$t(),this.relativeTargetOrigin=$t(),tl(this.relativeTargetOrigin,this.target,S.target),Jn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Kr&&ji.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||om(this.parent.latestValues)||f1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var u;const p=this.getLead(),m=!!this.resumingFrom||this!==p;let g=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(g=!1),m&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===cn.timestamp&&(g=!1),g)return;const{layout:v,layoutId:b}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(v||b))return;Jn(this.layoutCorrected,this.layout.layoutBox);const y=this.treeScale.x,S=this.treeScale.y;WM(this.layoutCorrected,this.treeScale,this.path,m),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=$t());const{target:k}=p;if(!k){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(jb(this.prevProjectionDelta.x,this.projectionDelta.x),jb(this.prevProjectionDelta.y,this.projectionDelta.y)),el(this.projectionDelta,this.layoutCorrected,k,this.latestValues),(this.treeScale.x!==y||this.treeScale.y!==S||!Mb(this.projectionDelta.x,this.prevProjectionDelta.x)||!Mb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",k)),Kr&&ji.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var p;if((p=this.options.visualElement)===null||p===void 0||p.scheduleRender(),u){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ao(),this.projectionDelta=Ao(),this.projectionDeltaWithTransform=Ao()}setAnimationOrigin(u,p=!1){const m=this.snapshot,g=m?m.latestValues:{},v={...this.latestValues},b=Ao();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const y=$t(),S=m?m.source:void 0,k=this.layout?this.layout.source:void 0,j=S!==k,N=this.getStack(),T=!N||N.members.length<=1,C=!!(j&&!T&&this.options.crossfade===!0&&!this.path.some(B4));this.animationProgress=0;let A;this.mixTargetDelta=I=>{const E=I/1e3;Lb(b.x,u.x,E),Lb(b.y,u.y,E),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(tl(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),O4(this.relativeTarget,this.relativeTargetOrigin,y,E),A&&b4(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=$t()),Jn(A,this.relativeTarget)),j&&(this.animationValues=v,p4(v,g,this.latestValues,E,C,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Fa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=kt.update(()=>{ad.hasAnimatedSinceResize=!0,this.currentAnimation=r4(0,Ib,{...u,onUpdate:p=>{this.mixTargetDelta(p),u.onUpdate&&u.onUpdate(p)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Ib),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:p,target:m,layout:g,latestValues:v}=u;if(!(!p||!m||!g)){if(this!==u&&this.layout&&g&&S1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||$t();const b=Bn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+b;const y=Bn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+y}Jn(p,m),Ro(p,v),el(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new x4),this.sharedNodes.get(u).add(p);const g=p.options.initialPromotionConfig;p.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(p):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var u;const{layoutId:p}=this.options;return p?((u=this.getStack())===null||u===void 0?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:p}=this.options;return p?(u=this.getStack())===null||u===void 0?void 0:u.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:p,preserveFollowOpacity:m}={}){const g=this.getStack();g&&g.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let p=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(p=!0),!p)return;const g={};m.z&&jp("z",u,g,this.animationValues);for(let v=0;v<Tp.length;v++)jp(`rotate${Tp[v]}`,u,g,this.animationValues),jp(`skew${Tp[v]}`,u,g,this.animationValues);u.render();for(const v in g)u.setStaticValue(v,g[v]),this.animationValues&&(this.animationValues[v]=g[v]);u.scheduleRender()}getProjectionStyles(u){var p,m;if(!this.instance||this.isSVG)return;if(!this.isVisible)return k4;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=nd(u==null?void 0:u.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const b=this.getLead();if(!this.projectionDelta||!this.layout||!b.target){const j={};return this.options.layoutId&&(j.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,j.pointerEvents=nd(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!Ti(this.latestValues)&&(j.transform=v?v({},""):"none",this.hasProjected=!1),j}const y=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=_4(this.projectionDeltaWithTransform,this.treeScale,y),v&&(g.transform=v(y,g.transform));const{x:S,y:k}=this.projectionDelta;g.transformOrigin=`${S.origin*100}% ${k.origin*100}% 0`,b.animationValues?g.opacity=b===this?(m=(p=y.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&m!==void 0?m:1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:g.opacity=b===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const j in ud){if(y[j]===void 0)continue;const{correct:N,applyTo:T}=ud[j],C=g.transform==="none"?y[j]:N(y[j],b);if(T){const A=T.length;for(let I=0;I<A;I++)g[T[I]]=C}else g[j]=C}return this.options.layoutId&&(g.pointerEvents=b===this?nd(u==null?void 0:u.pointerEvents)||"":"none"),g}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var p;return(p=u.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(Ob),this.root.sharedNodes.clear()}}}function T4(t){t.updateLayout()}function j4(t){var s;const o=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&o&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:c}=t.layout,{animationType:d}=t.options,u=o.source!==t.layout.source;d==="size"?es(b=>{const y=u?o.measuredBox[b]:o.layoutBox[b],S=Bn(y);y.min=r[b].min,y.max=y.min+S}):S1(d,o.layoutBox,r)&&es(b=>{const y=u?o.measuredBox[b]:o.layoutBox[b],S=Bn(r[b]);y.max=y.min+S,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+S)});const p=Ao();el(p,r,o.layoutBox);const m=Ao();u?el(m,t.applyTransform(c,!0),o.measuredBox):el(m,r,o.layoutBox);const g=!b1(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:y,layout:S}=b;if(y&&S){const k=$t();tl(k,o.layoutBox,y.layoutBox);const j=$t();tl(j,r,S.layoutBox),x1(k,j)||(v=!0),b.options.layoutRoot&&(t.relativeTarget=j,t.relativeTargetOrigin=k,t.relativeParent=b)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:o,delta:m,layoutDelta:p,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function w4(t){Kr&&ji.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 N4(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function C4(t){t.clearSnapshot()}function Ob(t){t.clearMeasurements()}function E4(t){t.isLayoutDirty=!1}function A4(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function Bb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function D4(t){t.resolveTargetDelta()}function R4(t){t.calcProjection()}function M4(t){t.resetSkewAndRotation()}function I4(t){t.removeLeadSnapshot()}function Lb(t,s,o){t.translate=Nt(s.translate,0,o),t.scale=Nt(s.scale,1,o),t.origin=s.origin,t.originPoint=s.originPoint}function zb(t,s,o,r){t.min=Nt(s.min,o.min,r),t.max=Nt(s.max,o.max,r)}function O4(t,s,o,r){zb(t.x,s.x,o.x,r),zb(t.y,s.y,o.y,r)}function B4(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const L4={duration:.45,ease:[.4,0,.1,1]},$b=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Ub=$b("applewebkit/")&&!$b("chrome/")?Math.round:In;function Pb(t){t.min=Ub(t.min),t.max=Ub(t.max)}function z4(t){Pb(t.x),Pb(t.y)}function S1(t,s,o){return t==="position"||t==="preserve-aspect"&&!PM(Rb(s),Rb(o),.2)}function $4(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const U4=k1({attachResizeListener:(t,s)=>ul(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),wp={current:void 0},T1=k1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!wp.current){const t=new U4({});t.mount(window),t.setOptions({layoutScroll:!0}),wp.current=t}return wp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),P4={pan:{Feature:s4},drag:{Feature:n4,ProjectionNode:T1,MeasureLayout:g1}};function H4(t,s,o){var r;if(t instanceof Element)return[t];if(typeof t=="string"){let c=document;const d=(r=void 0)!==null&&r!==void 0?r:c.querySelectorAll(t);return d?Array.from(d):[]}return Array.from(t)}function j1(t,s){const o=H4(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[o,c,()=>r.abort()]}function Hb(t){return s=>{s.pointerType==="touch"||o1()||t(s)}}function V4(t,s,o={}){const[r,c,d]=j1(t,o),u=Hb(p=>{const{target:m}=p,g=s(p);if(typeof g!="function"||!m)return;const v=Hb(b=>{g(b),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function Vb(t,s,o){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",o==="Start");const c="onHover"+o,d=r[c];d&&kt.postRender(()=>d(s,bl(s)))}class q4 extends Ja{mount(){const{current:s}=this.node;s&&(this.unmount=V4(s,o=>(Vb(this.node,o,"Start"),r=>Vb(this.node,r,"End"))))}unmount(){}}class G4 extends Ja{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=yl(ul(this.node.current,"focus",()=>this.onFocus()),ul(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const w1=(t,s)=>s?t===s?!0:w1(t,s.parentElement):!1,F4=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Z4(t){return F4.has(t.tagName)||t.tabIndex!==-1}const Yr=new WeakSet;function qb(t){return s=>{s.key==="Enter"&&t(s)}}function Np(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const K4=(t,s)=>{const o=t.currentTarget;if(!o)return;const r=qb(()=>{if(Yr.has(o))return;Np(o,"down");const c=qb(()=>{Np(o,"up")}),d=()=>Np(o,"cancel");o.addEventListener("keyup",c,s),o.addEventListener("blur",d,s)});o.addEventListener("keydown",r,s),o.addEventListener("blur",()=>o.removeEventListener("keydown",r),s)};function Gb(t){return lh(t)&&!o1()}function Y4(t,s,o={}){const[r,c,d]=j1(t,o),u=p=>{const m=p.currentTarget;if(!Gb(p)||Yr.has(m))return;Yr.add(m);const g=s(p),v=(S,k)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",y),!(!Gb(S)||!Yr.has(m))&&(Yr.delete(m),typeof g=="function"&&g(S,{success:k}))},b=S=>{v(S,o.useGlobalTarget||w1(m,S.target))},y=S=>{v(S,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",y,c)};return r.forEach(p=>{!Z4(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(o.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>K4(g,c),c)}),d}function Fb(t,s,o){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",o==="Start");const c="onTap"+(o==="End"?"":o),d=r[c];d&&kt.postRender(()=>d(s,bl(s)))}class J4 extends Ja{mount(){const{current:s}=this.node;s&&(this.unmount=Y4(s,o=>(Fb(this.node,o,"Start"),(r,{success:c})=>Fb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const lm=new WeakMap,Cp=new WeakMap,W4=t=>{const s=lm.get(t.target);s&&s(t)},X4=t=>{t.forEach(W4)};function Q4({root:t,...s}){const o=t||document;Cp.has(o)||Cp.set(o,{});const r=Cp.get(o),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(X4,{root:t,...s})),r[c]}function e3(t,s,o){const r=Q4(s);return lm.set(t,o),r.observe(t),()=>{lm.delete(t),r.unobserve(t)}}const t3={some:0,all:1};class n3 extends Ja{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:o,margin:r,amount:c="some",once:d}=s,u={root:o?o.current:void 0,rootMargin:r,threshold:typeof c=="number"?c:t3[c]},p=m=>{const{isIntersecting:g}=m;if(this.isInView===g||(this.isInView=g,d&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:b}=this.node.getProps(),y=g?v:b;y&&y(m)};return e3(this.node.current,u,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:o}=this.node;["amount","margin","root"].some(s3(s,o))&&this.startObserver()}unmount(){}}function s3({viewport:t={}},{viewport:s={}}={}){return o=>t[o]!==s[o]}const a3={inView:{Feature:n3},tap:{Feature:J4},focus:{Feature:G4},hover:{Feature:q4}},i3={layout:{ProjectionNode:T1,MeasureLayout:g1}},vd={current:null},ch={current:!1};function N1(){if(ch.current=!0,!!Rm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>vd.current=t.matches;t.addListener(s),s()}else vd.current=!1}const o3=[...K_,un,Za],r3=t=>o3.find(Z_(t)),Zb=new WeakMap;function l3(t,s,o){for(const r in s){const c=s[r],d=o[r];if(fn(c))t.addValue(r,c);else if(fn(d))t.addValue(r,cl(c,{owner:t}));else if(d!==c)if(t.hasValue(r)){const u=t.getValue(r);u.liveStyle===!0?u.jump(c):u.hasAnimated||u.set(c)}else{const u=t.getStaticValue(r);t.addValue(r,cl(u!==void 0?u:c,{owner:t}))}}for(const r in o)s[r]===void 0&&t.removeValue(r);return s}const Kb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class c3{scrapeMotionValuesFromProps(s,o,r){return{}}constructor({parent:s,props:o,presenceContext:r,reducedMotionConfig:c,blockInitialAnimation:d,visualState:u},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ah,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 S=As.now();this.renderScheduledAt<S&&(this.renderScheduledAt=S,kt.render(this.render,!1,!0))};const{latestValues:m,renderState:g,onUpdate:v}=u;this.onUpdate=v,this.latestValues=m,this.baseTarget={...m},this.initialValues=o.initial?{...m}:{},this.renderState=g,this.parent=s,this.props=o,this.presenceContext=r,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=Od(o),this.isVariantNode=o_(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,...y}=this.scrapeMotionValuesFromProps(o,{},this);for(const S in y){const k=y[S];m[S]!==void 0&&fn(k)&&k.set(m[S],!1)}}mount(s){this.current=s,Zb.set(s,this),this.projection&&!this.projection.instance&&this.projection.mount(s),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,r)=>this.bindToMotionValue(r,o)),ch.current||N1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:vd.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Zb.delete(this.current),this.projection&&this.projection.unmount(),Fa(this.notifyUpdate),Fa(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const o=this.features[s];o&&(o.unmount(),o.isMounted=!1)}this.current=null}bindToMotionValue(s,o){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const r=Oi.has(s),c=o.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&kt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),d=o.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,s,o)),this.valueSubscriptions.set(s,()=>{c(),d(),u&&u(),o.owner&&o.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in Bo){const o=Bo[s];if(!o)continue;const{isEnabled:r,Feature:c}=o;if(!this.features[s]&&c&&r(this.props)&&(this.features[s]=new c(this)),this.features[s]){const d=this.features[s];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):$t()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,o){this.latestValues[s]=o}update(s,o){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let r=0;r<Kb.length;r++){const c=Kb[r];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const d="on"+c,u=s[d];u&&(this.propEventSubscriptions[c]=this.on(c,u))}this.prevMotionValues=l3(this,this.scrapeMotionValuesFromProps(s,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(s){return this.props.variants?this.props.variants[s]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(s){const o=this.getClosestVariantNode();if(o)return o.variantChildren&&o.variantChildren.add(s),()=>o.variantChildren.delete(s)}addValue(s,o){const r=this.values.get(s);o!==r&&(r&&this.removeValue(s),this.bindToMotionValue(s,o),this.values.set(s,o),this.latestValues[s]=o.get())}removeValue(s){this.values.delete(s);const o=this.valueSubscriptions.get(s);o&&(o(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,o){if(this.props.values&&this.props.values[s])return this.props.values[s];let r=this.values.get(s);return r===void 0&&o!==void 0&&(r=cl(o===null?void 0:o,{owner:this}),this.addValue(s,r)),r}readValue(s,o){var r;let c=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:(r=this.getBaseTargetFromProps(this.props,s))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,s,this.options);return c!=null&&(typeof c=="string"&&(G_(c)||B_(c))?c=parseFloat(c):!r3(c)&&Za.test(o)&&(c=H_(s,o)),this.setBaseTarget(s,fn(c)?c.get():c)),fn(c)?c.get():c}setBaseTarget(s,o){this.baseTarget[s]=o}getBaseTarget(s){var o;const{initial:r}=this.props;let c;if(typeof r=="string"||typeof r=="object"){const u=zm(this.props,r,(o=this.presenceContext)===null||o===void 0?void 0:o.custom);u&&(c=u[s])}if(r&&c!==void 0)return c;const d=this.getBaseTargetFromProps(this.props,s);return d!==void 0&&!fn(d)?d:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,o){return this.events[s]||(this.events[s]=new Ym),this.events[s].add(o)}notify(s,...o){this.events[s]&&this.events[s].notify(...o)}}class C1 extends c3{constructor(){super(...arguments),this.KeyframeResolver=Y_}sortInstanceNodePosition(s,o){return s.compareDocumentPosition(o)&2?1:-1}getBaseTargetFromProps(s,o){return s.style?s.style[o]:void 0}removeValueFromRenderState(s,{vars:o,style:r}){delete o[s],delete r[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;fn(s)&&(this.childSubscription=s.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}}function d3(t){return window.getComputedStyle(t)}class u3 extends C1{constructor(){super(...arguments),this.type="html",this.renderInstance=h_}readValueFromInstance(s,o){if(Oi.has(o)){const r=sh(o);return r&&r.default||0}else{const r=d3(s),c=(f_(o)?r.getPropertyValue(o):r[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:o}){return m1(s,o)}build(s,o,r){Pm(s,o,r.transformTemplate)}scrapeMotionValuesFromProps(s,o,r){return Gm(s,o,r)}}class f3 extends C1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=$t}getBaseTargetFromProps(s,o){return s[o]}readValueFromInstance(s,o){if(Oi.has(o)){const r=sh(o);return r&&r.default||0}return o=g_.has(o)?o:Om(o),s.getAttribute(o)}scrapeMotionValuesFromProps(s,o,r){return b_(s,o,r)}build(s,o,r){Hm(s,o,this.isSVGTag,r.transformTemplate)}renderInstance(s,o,r,c){v_(s,o,r,c)}mount(s){this.isSVGTag=qm(s.tagName),super.mount(s)}}const p3=(t,s)=>Lm(t)?new f3(s):new u3(s,{allowProjection:t!==x.Fragment}),m3=UD({...DM,...a3,...P4,...i3},p3),Mt=tD(m3);function h3(){!ch.current&&N1();const[t]=x.useState(vd.current);return t}const g3="_overlay_cmicx_1",v3="_dialog_cmicx_11",y3="_title_cmicx_30",b3="_description_cmicx_38",x3="_actions_cmicx_45",_3="_cancelButton_cmicx_52",k3="_confirmButton_cmicx_79",_i={overlay:g3,dialog:v3,title:y3,description:b3,actions:x3,cancelButton:_3,confirmButton:k3};function ia({isOpen:t,title:s,description:o,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=x.useId(),p=x.useId();return i.jsx(gs,{children:t&&i.jsx(Mt.div,{className:_i.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:m=>{m.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":o?p:void 0,children:i.jsxs(Mt.div,{className:_i.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:m=>m.stopPropagation(),children:[i.jsx("h3",{id:u,className:_i.title,children:s}),o&&i.jsx("p",{id:p,className:_i.description,children:o}),i.jsxs("div",{className:_i.actions,children:[i.jsx("button",{type:"button",className:_i.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),i.jsx("button",{type:"button",className:_i.confirmButton,onClick:c,children:r})]})]})})})}const S3="_skeleton_1gqp4_9",T3="_circular_1gqp4_17",j3="_textContainer_1gqp4_26",w3="_card_1gqp4_31",yd={skeleton:S3,circular:T3,textContainer:j3,card:w3};function je({width:t="100%",height:s="1rem",borderRadius:o,variant:r="rectangular",className:c}){const d=[yd.skeleton,r==="circular"?yd.circular:"",c??""].filter(Boolean).join(" ");return i.jsx("div",{className:d,style:{width:t,height:s,...o&&r!=="circular"?{borderRadius:o}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function cm({lines:t=3,lastLineWidth:s="60%",lineHeight:o="0.75rem",gap:r="var(--space-sm)",className:c}){return i.jsx("div",{className:`${yd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>i.jsx(je,{width:u===t-1&&t>1?s:"100%",height:o},u))})}function bd({lines:t=2,className:s}){return i.jsxs("div",{className:`${yd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[i.jsx(je,{width:"40%",height:"1.25rem"}),i.jsx(cm,{lines:t})]})}const N3="_spinner_1uyt1_1",C3="_spin_1uyt1_1",E3="_sm_1uyt1_14",A3="_md_1uyt1_20",D3="_lg_1uyt1_26",R3="_xl_1uyt1_32",Yb={spinner:N3,spin:C3,sm:E3,md:A3,lg:D3,xl:R3};function E1({size:t="md",className:s,label:o="Loading",liveRegion:r=!1}){return i.jsx("span",{className:`${Yb.spinner} ${Yb[t]} ${s??""}`,role:r?"status":void 0,"aria-label":o,"aria-hidden":r?void 0:!0})}const M3="_splash_1bn1g_1",I3="_logo_1bn1g_11",Jb={splash:M3,logo:I3};function A1(){return i.jsxs("div",{className:Jb.splash,"data-testid":"splash-screen",children:[i.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Jb.logo}),i.jsx(E1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const O3="_wrapper_4e5yt_1",B3="_wrapperBlock_4e5yt_6",L3="_tooltip_4e5yt_11",z3="_visible_4e5yt_31",$3="_top_4e5yt_41",U3="_bottom_4e5yt_48",P3="_left_4e5yt_55",H3="_right_4e5yt_62",Pr={wrapper:O3,wrapperBlock:B3,tooltip:L3,visible:z3,top:$3,bottom:U3,left:P3,right:H3},V3=300,Gc=6;function $o({text:t,placement:s="top",delayMs:o=V3,inline:r=!0,children:c,className:d,"data-testid":u}){const[p,m]=x.useState(!1),[g,v]=x.useState({top:0,left:0}),b=x.useRef(null),y=x.useRef(null),S=x.useRef(void 0),k=x.useId(),j=typeof document<"u",N=x.useCallback(()=>{if(!b.current||!y.current)return;const z=b.current.getBoundingClientRect(),Q=y.current.getBoundingClientRect();let $=0,J=0;switch(s){case"top":$=z.top-Q.height-Gc,J=z.left+z.width/2-Q.width/2;break;case"bottom":$=z.bottom+Gc,J=z.left+z.width/2-Q.width/2;break;case"left":$=z.top+z.height/2-Q.height/2,J=z.left-Q.width-Gc;break;case"right":$=z.top+z.height/2-Q.height/2,J=z.right+Gc;break}v({top:$,left:J})},[s]),T=x.useCallback(z=>{S.current!==void 0&&clearTimeout(S.current),S.current=setTimeout(()=>{N(),m(!0),S.current=void 0},z)},[N]),C=x.useCallback(()=>{T(o)},[o,T]),A=x.useCallback(()=>{T(0)},[T]),I=x.useCallback(()=>{S.current!==void 0&&(clearTimeout(S.current),S.current=void 0),m(!1)},[]);x.useEffect(()=>{if(!p)return;const z=Q=>{Q.key==="Escape"&&I()};return document.addEventListener("keydown",z),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{document.removeEventListener("keydown",z),window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[p,I,N]),x.useEffect(()=>()=>{S.current!==void 0&&clearTimeout(S.current)},[]);const E=r?"span":"div",D=[r?Pr.wrapper:Pr.wrapperBlock,d].filter(Boolean).join(" ");let P=c;if(x.isValidElement(c)){const z=c,Q=z.props["aria-describedby"],$=p?Q?`${Q} ${k}`:k:Q;P=x.cloneElement(z,{"aria-describedby":$})}const O=i.jsx("div",{ref:y,id:k,role:"tooltip",className:`${Pr.tooltip} ${Pr[s]} ${p?Pr.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return i.jsxs(E,{ref:b,className:D,onMouseEnter:C,onMouseLeave:I,onFocus:A,onBlur:I,children:[P,j?TT.createPortal(O,document.body):null]})}const q3="_attemptSelector_ggigl_1",G3="_attemptLabel_ggigl_17",F3="_attemptButton_ggigl_21",Z3="_attemptActive_ggigl_38",K3="_attemptStatus_ggigl_44",Hr={attemptSelector:q3,attemptLabel:G3,attemptButton:F3,attemptActive:Z3,attemptStatus:K3};function Y3({taskSessions:t,selectedSessionId:s,onSelect:o}){if(!(t.length<2))return i.jsxs("div",{className:Hr.attemptSelector,"data-testid":"attempt-selector",children:[i.jsx("span",{className:Hr.attemptLabel,children:"Attempts:"}),t.map((r,c)=>{const d=r.id===s,u=r.status==="stopped"&&r.endReason==="completed"?"✓":r.status==="stopped"?"✗":r.status==="running"||r.status==="idle"?"●":"";return i.jsxs("button",{className:`${Hr.attemptButton} ${d?Hr.attemptActive:""}`,onClick:()=>o(r.id),title:`Attempt #${c+1} — ${r.status}`,"aria-label":`Attempt #${c+1}, ${r.status}`,"aria-pressed":d,"data-testid":`attempt-${c+1}`,children:["#",c+1,u&&i.jsx("span",{className:Hr.attemptStatus,children:u})]},r.id)})]})}const J3="_row_ldkru_1",W3="_hoverActions_ldkru_5",X3="_hoverButton_ldkru_31",Q3="_selectingRow_ldkru_72",e6="_selected_ldkru_83",t6="_checkboxArea_ldkru_90",n6="_checkbox_ldkru_90",s6="_contentArea_ldkru_106",us={row:J3,hoverActions:W3,hoverButton:X3,selectingRow:Q3,selected:e6,checkboxArea:t6,checkbox:n6,contentArea:s6};function a6({copyText:t,isContentBearing:s,isSelecting:o,isSelected:r,checkboxLabel:c,onSelect:d,onToggle:u,onCopied:p,children:m}){const[g,v]=x.useState(!1),b=x.useRef(void 0);x.useEffect(()=>()=>{b.current!==void 0&&clearTimeout(b.current)},[]);const y=x.useCallback(async()=>{try{await navigator.clipboard.writeText(t),v(!0),p==null||p(),b.current!==void 0&&clearTimeout(b.current),b.current=setTimeout(()=>{v(!1)},2e3)}catch{}},[t,p]),S=x.useCallback(k=>{!o||k.target.closest("a, button, input, textarea, select, [role=button]")||(k.preventDefault(),u(k.shiftKey))},[o,u]);return s?o?i.jsxs("div",{className:`${us.row} ${us.selectingRow} ${r?us.selected:""}`,onClick:S,"data-testid":"event-selectable-row",children:[i.jsx("div",{className:us.checkboxArea,children:i.jsx("input",{type:"checkbox",checked:r,onChange:k=>{u(k.nativeEvent.shiftKey)},onClick:k=>{k.stopPropagation()},className:us.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),i.jsx("div",{className:us.contentArea,children:m})]}):i.jsxs("div",{className:us.row,"data-testid":"event-hover-row",children:[i.jsxs("div",{className:us.hoverActions,"data-testid":"event-hover-actions",children:[i.jsx("button",{type:"button",className:us.hoverButton,onClick:()=>{y().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?i.jsx(Ri,{size:ct,"aria-hidden":"true"}):i.jsx(Cx,{size:ct,"aria-hidden":"true"})}),i.jsx("button",{type:"button",className:us.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:i.jsx(mj,{size:ct,"aria-hidden":"true"})})]}),m]}):i.jsx("div",{className:us.row,children:m})}const i6="_bar_1vah7_1",o6="_left_1vah7_21",r6="_right_1vah7_27",l6="_count_1vah7_33",c6="_toggleButton_1vah7_40",d6="_copyButton_1vah7_68",u6="_cancelButton_1vah7_108",ki={bar:i6,left:o6,right:r6,count:l6,toggleButton:c6,copyButton:d6,cancelButton:u6};function f6({selectedCount:t,totalSelectable:s,onSelectAll:o,onDeselectAll:r,onCopy:c,onCancel:d}){const u=t>0&&t>=s;return i.jsxs(Mt.div,{className:ki.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:[i.jsxs("div",{className:ki.left,children:[i.jsxs("span",{className:ki.count,"data-testid":"floating-bar-count",children:[t," selected"]}),i.jsx("button",{type:"button",className:ki.toggleButton,onClick:u?r:o,"data-testid":"floating-bar-select-all",children:u?"Deselect all":"Select all"})]}),i.jsxs("div",{className:ki.right,children:[i.jsxs("button",{type:"button",className:ki.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[i.jsx(R2,{size:ct,"aria-hidden":"true"}),"Copy"]}),i.jsx("button",{type:"button",className:ki.cancelButton,onClick:d,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:i.jsx(Ka,{size:ct,"aria-hidden":"true"})})]})]})}const D1=50;function p6(t,s,o,r,c=D1){return r?t<c:s-t-o<c}function m6(t,s){const o=s-t;return o>0?o:0}function h6({scrollRef:t,contentLength:s,isReversed:o,paused:r}){const[c,d]=x.useState(!0),u=x.useRef(0),p=x.useRef(!1),m=x.useRef(0);x.useEffect(()=>{const v=t.current;if(!v)return;let b=!0;const y=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const S=p6(v.scrollTop,v.scrollHeight,v.clientHeight,o,D1);S!==b&&(b=S,d(S))}))};return v.addEventListener("scroll",y,{passive:!0}),()=>{v.removeEventListener("scroll",y),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[t,o]),x.useLayoutEffect(()=>{const v=t.current;!v||p.current||(p.current=!0,o?v.scrollTop=0:v.scrollTop=v.scrollHeight,d(!0))},[t,o]),x.useLayoutEffect(()=>{const v=t.current;if(v){if(r){u.current=v.scrollHeight;return}if(o&&!c){const b=m6(u.current,v.scrollHeight);b>0&&(v.scrollTop+=b)}c&&(o?v.scrollTo({top:0,behavior:"smooth"}):v.scrollTo({top:v.scrollHeight,behavior:"smooth"})),u.current=v.scrollHeight}},[s,c,o,r,t]);const g=x.useCallback(()=>{const v=t.current;if(!v)return;const b=o?0:v.scrollHeight;v.scrollTo({top:b,behavior:"smooth"}),d(!0)},[t,o]);return{isAtAnchor:c,scrollToAnchor:g}}const g6=new Set(["text","output","user_input","tool_use","tool_result","error"]);function fl(t){return g6.has(t.eventType)}function v6(t){var s;switch(t.eventType){case"tool_result":{if((s=t.toolUseCtx)!=null&&s.detailedResult)return t.toolUseCtx.detailedResult;let o=t.content;if(t.content.trimStart().startsWith("{"))try{const r=JSON.parse(t.content);typeof r.content=="string"&&(o=r.content)}catch{}return o}case"tool_use":try{const o=JSON.parse(t.content),r=o.tool??"tool",c=o.args!==void 0?JSON.stringify(o.args,void 0,2):"";return`${r}
|
|
269
|
-
${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 y6(t){var o;const s=[];for(const r of t){if(!fl(r))continue;const c=new Date(r.timestamp).toLocaleTimeString();switch(r.eventType){case"text":case"output":{s.push(`**Assistant** (${c}):
|
|
270
|
-
${r.content}`);break}case"user_input":{s.push(`**User** (${c}):
|
|
271
|
-
${r.content}`);break}case"tool_result":{let d=((o=r.toolUseCtx)==null?void 0:o.detailedResult)??void 0;if(!d&&(d=r.content,r.content.trimStart().startsWith("{")))try{const u=JSON.parse(r.content);typeof u.content=="string"&&(d=u.content)}catch{}if(r.toolUseCtx){const u=Wb(r.toolUseCtx.args),p=u?`**Tool: ${r.toolUseCtx.tool}** ${u}`:`**Tool: ${r.toolUseCtx.tool}**`;s.push(`${p} (${c}):
|
|
272
|
-
${d}`)}else s.push(`**Tool output** (${c}):
|
|
273
|
-
${d}`);break}case"tool_use":{let d="tool",u;try{const g=JSON.parse(r.content);d=g.tool??"tool",u=g.args}catch{}const p=Wb(u),m=p?`**Tool: ${d}** ${p}`:`**Tool: ${d}**`;u!==void 0?s.push(`${m} (${c}):
|
|
274
|
-
\`\`\`json
|
|
275
|
-
${JSON.stringify(u,void 0,2)}
|
|
276
|
-
\`\`\``):s.push(`${m} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
|
|
277
|
-
${r.content}`);break}}}return s.join(`
|
|
278
|
-
|
|
279
|
-
`)}function b6({events:t,formatForClipboard:s}){const[o,r]=x.useState(!1),[c,d]=x.useState(new Set),u=x.useRef(void 0),p=x.useMemo(()=>c.size,[c]),m=x.useCallback(k=>{r(!0),k!==void 0?(d(new Set([k])),u.current=k):(d(new Set),u.current=void 0)},[]),g=x.useCallback(()=>{r(!1),d(new Set),u.current=void 0},[]),v=x.useCallback((k,j)=>{if(j&&u.current!==void 0){const N=Math.min(u.current,k),T=Math.max(u.current,k);d(C=>{const A=new Set(C);for(let I=N;I<=T;I++)I<t.length&&fl(t[I])&&A.add(I);return A})}else d(N=>{const T=new Set(N);return T.has(k)?T.delete(k):T.add(k),T.size===0?(r(!1),u.current=void 0):u.current=k,T})},[t]),b=x.useCallback(()=>{const k=new Set;for(let j=0;j<t.length;j++)fl(t[j])&&k.add(j);d(k)},[t]),y=x.useCallback(()=>{d(new Set)},[]),S=x.useCallback(async()=>{const j=[...c].sort((T,C)=>T-C).filter(T=>T<t.length).map(T=>t[T]);if(j.length===0)return!1;const N=s(j);try{return await navigator.clipboard.writeText(N),!0}catch{return!1}},[c,t,s]);return{isSelecting:o,selectedIndices:c,selectedCount:p,enterSelectionMode:m,cancelSelection:g,toggleEvent:v,selectAll:b,deselectAll:y,copySelected:S}}const x6="_wrapper_1cdza_1",_6="_scrollContainer_1cdza_9",k6="_selectingPadding_1cdza_16",S6="_toolbar_1cdza_20",T6="_directionToggle_1cdza_27",j6="_scrollToAnchor_1cdza_65",w6="_scrollToAnchorBottom_1cdza_89",N6="_scrollToAnchorTop_1cdza_93",C6="_eventOverflowWarning_1cdza_97",Qs={wrapper:x6,scrollContainer:_6,selectingPadding:k6,toolbar:S6,directionToggle:T6,scrollToAnchor:j6,scrollToAnchorBottom:w6,scrollToAnchorTop:N6,eventOverflowWarning:C6};function E6(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 R1="grackle-stream-direction";function A6(){try{return localStorage.getItem(R1)==="reversed"}catch{return!1}}function D6({eventsDropped:t}){return t<=0?i.jsx(i.Fragment,{}):i.jsxs("div",{className:Qs.eventOverflowWarning,role:"alert",children:[i.jsx(ym,{size:nn,"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 dh({events:t,eventsDropped:s,emptyState:o,onShowToast:r}){const c=x.useRef(null),[d,u]=x.useState(A6),p=h3(),m=b6({events:t,formatForClipboard:y6}),g=x.useMemo(()=>t.filter(fl).length,[t]),v=x.useMemo(()=>d?[...t].reverse():t,[t,d]),{isAtAnchor:b,scrollToAnchor:y}=h6({scrollRef:c,contentLength:t.length,isReversed:d,paused:m.isSelecting}),S=()=>{const T=!d;u(T);try{localStorage.setItem(R1,T?"reversed":"default")}catch{}};x.useEffect(()=>{if(!m.isSelecting)return;const T=C=>{C.key==="Escape"&&m.cancelSelection()};return window.addEventListener("keydown",T),()=>{window.removeEventListener("keydown",T)}},[m.isSelecting,m.cancelSelection]);const k=x.useCallback(async()=>{await m.copySelected()&&(r==null||r(`Copied ${m.selectedCount} message${m.selectedCount===1?"":"s"} to clipboard`,"success"))},[m,r]),j=p?0:.2,N=d?-8:8;return i.jsxs("div",{className:Qs.wrapper,children:[i.jsx("div",{className:Qs.toolbar,children:i.jsx($o,{text:d?"Showing newest first":"Showing oldest first",children:i.jsx("button",{className:Qs.directionToggle,onClick:S,"aria-label":d?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:d?i.jsx(yy,{size:nn,"aria-hidden":"true"}):i.jsx(by,{size:nn,"aria-hidden":"true"})})})}),i.jsxs("div",{ref:c,className:`${Qs.scrollContainer} ${m.isSelecting?Qs.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&o,i.jsx(D6,{eventsDropped:s}),i.jsx(gs,{initial:!1,children:v.map((T,C)=>{const A=d?t.length-1-C:C;return i.jsx(Mt.div,{initial:{opacity:0,y:N},animate:{opacity:1,y:0},transition:{duration:j,ease:"easeOut"},children:i.jsx(a6,{copyText:v6(T),isContentBearing:fl(T),isSelecting:m.isSelecting,isSelected:m.selectedIndices.has(A),checkboxLabel:E6(T),onSelect:()=>{m.enterSelectionMode(A)},onToggle:I=>{m.toggleEvent(A,I)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:i.jsx(VA,{event:T,toolUseCtx:T.toolUseCtx,settled:T.settled})})},`${T.sessionId}-${T.timestamp}-${A}`)})})]}),i.jsx(gs,{children:m.isSelecting&&i.jsx(f6,{selectedCount:m.selectedCount,totalSelectable:g,onSelectAll:m.selectAll,onDeselectAll:m.deselectAll,onCopy:()=>{k().catch(()=>{})},onCancel:m.cancelSelection})}),i.jsx(gs,{children:!b&&i.jsxs(Mt.button,{className:`${Qs.scrollToAnchor} ${d?Qs.scrollToAnchorTop:Qs.scrollToAnchorBottom}`,onClick:y,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},"aria-label":"Scroll to latest","data-testid":"scroll-to-anchor",children:[d?i.jsx(by,{size:nn,"aria-hidden":"true"}):i.jsx(yy,{size:nn,"aria-hidden":"true"})," New events"]})})]})}function uh(t){const{value:s,onSave:o,validate:r,fieldId:c,activeFieldId:d,onActivate:u,enterToSave:p=!0,trimOnSave:m=!0}=t,[g,v]=x.useState(""),[b,y]=x.useState(""),S=x.useRef(!1),k=d===c,j=x.useCallback(P=>{v(P),y("")},[]),N=x.useCallback(()=>{y("")},[]),T=x.useCallback(()=>{S.current=!1,u==null||u(null),v(""),y("")},[u]),C=x.useCallback(()=>{const P=m?g.trim():g;if(r){const z=r(g);if(z){y(z);return}}const O=m?s.trim():s;if(P===O){T();return}o(P),T()},[g,s,m,r,o,T]),A=x.useCallback(()=>{S.current=!0,u==null||u(c),v(s),y("")},[c,s,u]),I=x.useCallback(P=>{if(S.current){S.current=!1;return}P.relatedTarget instanceof HTMLElement&&P.relatedTarget.dataset.editAction===c||C()},[c,C]),E=x.useCallback(P=>{P.key==="Escape"?T():P.key==="Enter"&&p&&C()},[T,p,C]),D=(()=>{if(!k)return!1;const P=m?s.trim():s;return(m?g.trim():g)!==P})();return x.useEffect(()=>{!k&&(g!==""||b!=="")&&(v(""),y(""))},[k,g,b]),{isEditing:k,draft:g,error:b,isDirty:D,startEdit:A,cancelEdit:T,save:C,setDraft:j,clearError:N,handleBlur:I,handleKeyDown:E,ignoreInitialBlurRef:S}}const R6="_editFieldWrapper_yuzty_1",M6="_editInput_yuzty_10",I6="_editTextarea_yuzty_42",O6="_editSelect_yuzty_78",B6="_editError_yuzty_111",L6="_editInputInvalid_yuzty_118",z6="_editHint_yuzty_123",$6="_unsavedDot_yuzty_132",U6="_metaValueClickable_yuzty_140",P6="_editButton_yuzty_159",H6="_metaPlaceholder_yuzty_175",V6="_worktreeToggle_yuzty_180",st={editFieldWrapper:R6,editInput:M6,editTextarea:I6,editSelect:O6,editError:B6,editInputInvalid:L6,editHint:z6,unsavedDot:$6,metaValueClickable:U6,editButton:P6,metaPlaceholder:H6,worktreeToggle:V6};function Ft(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="text",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:y,"data-testid":S}=t,k=x.useRef(null),j=uh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!0,trimOnSave:!0});if(x.useEffect(()=>{if(j.isEditing){const T=window.setTimeout(()=>{var C;(C=k.current)==null||C.focus()},0);return()=>window.clearTimeout(T)}},[j.isEditing]),c==="create"){const T=A=>{m==null||m(A.target.value)},C=r==null?void 0:r(s);return i.jsxs("div",{className:st.editFieldWrapper,children:[i.jsx("input",{className:`${st.editInput} ${C?st.editInputInvalid:""}`,value:s,onChange:T,maxLength:b,placeholder:v,"aria-label":y,"data-testid":S?`${S}-input`:void 0}),C&&i.jsx("span",{className:st.editError,"data-testid":"edit-error",children:C})]})}if(j.isEditing)return i.jsxs("div",{className:st.editFieldWrapper,children:[i.jsx("input",{ref:k,className:`${st.editInput} ${j.error?st.editInputInvalid:""}`,value:j.draft,onChange:T=>j.setDraft(T.target.value),onBlur:j.handleBlur,onKeyDown:j.handleKeyDown,maxLength:b,placeholder:v,"aria-label":y,"data-testid":S?`${S}-input`:void 0}),j.isDirty&&i.jsx("span",{className:st.unsavedDot,title:"Unsaved changes"}),j.error&&i.jsx("span",{className:st.editError,"data-testid":"edit-error",children:j.error}),i.jsx("span",{className:st.editHint,children:"Enter to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:st.metaValueClickable,onClick:()=>j.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),j.startEdit())},title:"Click to edit","aria-label":y,"data-testid":S?`${S}-button`:void 0,children:[N!==void 0?N:s?i.jsx("span",{children:s}):i.jsx("span",{className:st.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:st.editButton,"aria-hidden":"true",children:"✏️"})]})}function dm(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="textarea",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":y}=t,S=x.useRef(null),k=uh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});if(x.useEffect(()=>{if(k.isEditing){const N=window.setTimeout(()=>{var T;(T=S.current)==null||T.focus()},0);return()=>window.clearTimeout(N)}},[k.isEditing]),c==="create"){const N=C=>{m==null||m(C.target.value)},T=r==null?void 0:r(s);return i.jsxs("div",{className:st.editFieldWrapper,children:[i.jsx("textarea",{className:`${st.editTextarea} ${T?st.editInputInvalid:""}`,value:s,onChange:N,placeholder:v,"aria-label":b,"data-testid":y?`${y}-input`:void 0}),T&&i.jsx("span",{className:st.editError,"data-testid":"edit-error",children:T})]})}if(k.isEditing)return i.jsxs("div",{className:st.editFieldWrapper,children:[i.jsx("textarea",{ref:S,className:`${st.editTextarea} ${k.error?st.editInputInvalid:""}`,value:k.draft,onChange:N=>k.setDraft(N.target.value),onBlur:k.handleBlur,onKeyDown:k.handleKeyDown,title:b,"aria-label":b,"data-testid":y?`${y}-input`:void 0}),k.isDirty&&i.jsx("span",{className:st.unsavedDot,title:"Unsaved changes"}),k.error&&i.jsx("span",{className:st.editError,"data-testid":"edit-error",children:k.error}),i.jsx("span",{className:st.editHint,children:"Tab to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:st.metaValueClickable,onClick:()=>k.startEdit(),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),k.startEdit())},title:"Click to edit","aria-label":b,"data-testid":y?`${y}-button`:void 0,children:[j!==void 0?j:s?i.jsx("span",{children:s}):i.jsx("span",{className:st.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:st.editButton,"aria-hidden":"true",children:"✏️"})]})}function Uo(t){var A;const{value:s,onSave:o,mode:r="edit",options:c,fieldId:d="select",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":y}=t,S=x.useRef(null),k=uh({value:s,onSave:o,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});x.useEffect(()=>{if(k.isEditing){const I=window.setTimeout(()=>{var E;(E=S.current)==null||E.focus()},0);return()=>window.clearTimeout(I)}},[k.isEditing]);const j=x.useCallback(I=>{const E=I.target.value;k.ignoreInitialBlurRef.current=!1,E!==s&&o(E),k.cancelEdit()},[s,o,k]),N=x.useCallback(I=>{if(k.ignoreInitialBlurRef.current){k.ignoreInitialBlurRef.current=!1;return}I.relatedTarget instanceof HTMLElement&&I.relatedTarget.dataset.editAction===d||k.cancelEdit()},[d,k]);if(r==="create")return i.jsx("select",{className:st.editSelect,value:s,onChange:I=>m==null?void 0:m(I.target.value),"aria-label":b,"data-testid":y?`${y}-select`:void 0,children:c.map(I=>i.jsx("option",{value:I.value,children:I.label},I.value))});if(k.isEditing)return i.jsx("select",{ref:S,className:st.editSelect,value:k.draft,onChange:j,onBlur:N,title:b,"aria-label":b,"data-testid":y?`${y}-select`:void 0,children:c.map(I=>i.jsx("option",{value:I.value,children:I.label},I.value))});const T=g==null?void 0:g(s),C=(A=c.find(I=>I.value===s))==null?void 0:A.label;return i.jsxs("button",{type:"button",className:st.metaValueClickable,onClick:()=>k.startEdit(),title:"Click to change","aria-label":b,"data-testid":y?`${y}-button`:void 0,children:[T!==void 0?T:C?i.jsx("span",{children:C}):i.jsx("span",{className:st.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:st.editButton,"aria-hidden":"true",children:"✏️"})]})}function q6(t){const{checked:s,onChange:o,label:r,ariaLabel:c,"data-testid":d}=t;return i.jsxs("label",{className:st.worktreeToggle,"data-testid":d,children:[i.jsx("input",{type:"checkbox",checked:s,onChange:u=>o(u.target.checked),"aria-label":c}),i.jsx("span",{children:r})]})}const G6="_envRow_1e1r5_1",F6="_envDot_1e1r5_7",Z6="_envDotGreen_1e1r5_14",K6="_envDotYellow_1e1r5_18",Y6="_envDotRed_1e1r5_22",J6="_envDotGray_1e1r5_26",Mo={envRow:G6,envDot:F6,envDotGreen:Z6,envDotYellow:K6,envDotRed:Y6,envDotGray:J6};function W6(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?Mo.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?Mo.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?Mo.envDotRed:Mo.envDotGray}function X6(t){const{value:s,onSave:o,environments:r,allowNone:c=!1,fieldId:d="environment",activeFieldId:u,onActivate:p,placeholder:m="No environment",ariaLabel:g="Environment","data-testid":v}=t,b=r.find(k=>k.id===s),y=[...c?[{value:"",label:"None"}]:[],...r.map(k=>({value:k.id,label:k.displayName}))],S=()=>{if(b)return i.jsxs("span",{className:Mo.envRow,children:[i.jsx("span",{className:`${Mo.envDot} ${W6(b.status)}`}),b.displayName]})};return i.jsx(Uo,{value:s,onSave:o,options:y,fieldId:d,activeFieldId:u,onActivate:p,renderDisplay:S,placeholder:m,ariaLabel:g,"data-testid":v})}const Q6="_nav_1snmp_1",eI="_searchForm_1snmp_8",tI="_searchInput_1snmp_15",nI="_searchButton_1snmp_33",sI="_clearButton_1snmp_68",aI="_workspaceSelect_1snmp_85",iI="_listHeader_1snmp_99",oI="_nodeList_1snmp_108",rI="_nodeItem_1snmp_116",lI="_indicator_1snmp_129",cI="_label_1snmp_136",dI="_badge_1snmp_145",Wn={nav:Q6,searchForm:eI,searchInput:tI,searchButton:nI,clearButton:sI,workspaceSelect:aI,listHeader:iI,nodeList:oI,nodeItem:rI,indicator:lI,label:cI,badge:dI};function uI({nodes:t,workspaces:s,loading:o,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:p}){const[m,g]=x.useState(""),v=x.useCallback(k=>{k.preventDefault(),m.trim()&&c(m.trim())},[m,c]),b=x.useCallback(()=>{g(""),d()},[d]),y=x.useCallback(k=>{u(k)},[u]),S=x.useCallback(k=>{g(""),p(k)},[p]);return i.jsxs("div",{className:Wn.nav,"data-testid":"knowledge-nav",children:[i.jsxs("form",{className:Wn.searchForm,onSubmit:v,children:[i.jsx("input",{className:Wn.searchInput,type:"text",placeholder:"Search...",value:m,onChange:k=>{g(k.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),i.jsx("button",{type:"submit",className:Wn.searchButton,disabled:o,children:"Go"})]}),r&&i.jsx("button",{type:"button",className:Wn.clearButton,onClick:b,children:"Clear search"}),i.jsxs("select",{className:Wn.workspaceSelect,onChange:k=>{S(k.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[i.jsx("option",{value:"",children:"All workspaces"}),s.map(k=>i.jsx("option",{value:k.id,children:k.name},k.id))]}),i.jsxs("div",{className:Wn.listHeader,children:["Nodes (",t.length,")"]}),i.jsx("ul",{className:Wn.nodeList,children:t.map(k=>i.jsxs("li",{className:Wn.nodeItem,onClick:()=>{y(k.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),y(k.id))},role:"button",tabIndex:0,children:[i.jsx("span",{className:Wn.indicator,style:{backgroundColor:k.kind==="reference"?"#4A9EFF":k.category==="decision"?"#22C55E":k.category==="concept"?"#A855F7":k.category==="snippet"?"#6B7280":"#EAB308"}}),i.jsx("span",{className:Wn.label,children:k.label}),i.jsx("span",{className:Wn.badge,children:k.kind==="reference"?k.sourceType:k.category})]},k.id))})]})}const fI="_container_1mq5u_1",pI="_hamburger_1mq5u_33",mI="_brand_1mq5u_49",hI="_brandLogo_1mq5u_68",gI="_info_1mq5u_75",vI="_connectionLabel_1mq5u_90",yI="_connectionDot_1mq5u_103",bI="_connected_1mq5u_106",xI="_disconnected_1mq5u_110",Ws={container:fI,hamburger:pI,brand:mI,brandLogo:hI,info:gI,connectionLabel:vI,connectionDot:yI,connected:bI,disconnected:xI};function _I({connected:t,environments:s,sessions:o,onToggleSidebar:r,sidebarOpen:c}){const d=mt(),u=s.length,p=s.filter(g=>g.status==="connected").length,m=o.filter(g=>["running","idle"].includes(g.status)).length;return i.jsxs("div",{className:Ws.container,children:[r&&i.jsx("button",{type:"button",className:Ws.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:i.jsx(Q2,{size:Rt,"aria-hidden":"true"})}),i.jsx($o,{text:"Home",placement:"bottom",children:i.jsxs("button",{type:"button",className:Ws.brand,onClick:()=>d(Di),"data-testid":"statusbar-brand",children:[i.jsx("img",{src:"/icon-192x192.png",alt:"",className:Ws.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),i.jsxs("div",{className:Ws.info,children:[i.jsxs("span",{"aria-label":t?"Connected":"Disconnected",children:[i.jsx("span",{className:`${Ws.connectionDot} ${t?Ws.connected:Ws.disconnected}`,"aria-hidden":"true",children:i.jsx(Va,{size:bm,fill:"currentColor"})})," ",i.jsx("span",{className:Ws.connectionLabel,"aria-hidden":"true",children:t?"Connected":"Disconnected"})]}),i.jsxs("span",{children:[p,"/",u," env",u!==1?"s":""]}),i.jsxs("span",{children:[m," active"]})]})]})}const kI="_nav_13gkc_1",SI="_tab_13gkc_35",TI="_tabIcon_13gkc_68",jI="_tabLabel_13gkc_79",wI="_tabActive_13gkc_84",Vr={nav:kI,tab:SI,tabIcon:TI,tabLabel:jI,tabActive:wI},id=[{view:"dashboard",label:"Dashboard",icon:i.jsx(U2,{size:Rt}),route:Di,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:i.jsx(tj,{size:Rt}),route:TN,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:i.jsx(N2,{size:Rt}),route:jN,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:i.jsx(sj,{size:Rt}),route:Io,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:i.jsx(b2,{size:Rt}),route:Xx,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:i.jsx(Ex,{size:Rt}),route:Dd,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:i.jsx(fj,{size:Rt}),route:bN,testId:"sidebar-tab-settings"}];function NI(t){return t===Di||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(Xx)?"knowledge":t.startsWith(Dd)?"findings":t.startsWith(Ni)?"settings":"tasks"}function CI({tabs:t=id}){const s=Yt(),o=mt(),r=x.useRef(null),c=NI(s.pathname),d=x.useCallback(p=>{o(p.route)},[o]),u=x.useCallback(p=>{var y,S;const m=(y=r.current)==null?void 0:y.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(k=>k===document.activeElement),v=g>=0?g:t.findIndex(k=>k.view===c);let b=v;if(p.key==="ArrowRight"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%t.length;else if(p.key==="ArrowLeft"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+t.length)%t.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=t.length-1;else return;o(t[b].route),(S=m[b])==null||S.focus()},[c,o,t]);return i.jsx("nav",{className:Vr.nav,ref:r,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:u,"data-testid":"sidebar-nav",children:t.map(p=>{const m=p.view===c;return i.jsx($o,{text:p.label,placement:"bottom",children:i.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Vr.tab} ${m?Vr.tabActive:""}`,onClick:()=>d(p),"data-testid":p.testId,"aria-label":p.label,children:[i.jsx("span",{className:Vr.tabIcon,"aria-hidden":"true",children:p.icon}),i.jsx("span",{className:Vr.tabLabel,children:p.label})]})},p.view)})})}const EI="_container_pi6ii_1",AI="_content_pi6ii_66",Xb={container:EI,content:AI},DI=320,M1=220,I1=600,O1="grackle-sidebar-width";function RI(){try{const t=localStorage.getItem(O1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=M1&&s<=I1)return s}}catch{}return DI}function MI(t){try{localStorage.setItem(O1,String(t))}catch{}}function II({content:t}){const[s]=x.useState(RI),o=x.useRef(null);if(x.useEffect(()=>{const r=o.current;if(!r)return;const c=new ResizeObserver(d=>{for(const u of d){const p=u.borderBoxSize[0];if(p){const m=Math.round(p.inlineSize);m>=M1&&m<=I1&&MI(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return i.jsx("div",{className:Xb.container,ref:o,"data-testid":"sidebar",style:{width:s},children:i.jsx("div",{className:Xb.content,children:t})})}const OI="_bar_tnfsh_1",BI="_btnPrimary_tnfsh_32",LI="_statusText_tnfsh_85",zI="_statusCompleted_tnfsh_90",$I="_statusFailed_tnfsh_94",UI="_statusBlocked_tnfsh_98",PI="_hintText_tnfsh_103",jt={bar:OI,btnPrimary:BI,statusText:LI,statusCompleted:zI,statusFailed:$I,statusBlocked:UI,hintText:PI};function HI({sessions:t,tasks:s,environments:o}){const r=mt(),c=Yt(),d=At("/sessions/:sessionId"),u=At("/tasks/:taskId"),p=At("/tasks/:taskId/stream"),m=At("/tasks/:taskId/findings"),g=At("/tasks/:taskId/edit"),v=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),y=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),S=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),k=At("/sessions/new"),j=At("/environments/:environmentId/workspaces/:workspaceId"),N=At("/tasks/new"),T=At("/chat"),C=At("/"),A=At("/settings/*"),I=d==null?void 0:d.params.sessionId,E=(u==null?void 0:u.params.taskId)??(p==null?void 0:p.params.taskId)??(m==null?void 0:m.params.taskId)??(v==null?void 0:v.params.taskId)??(b==null?void 0:b.params.taskId)??(y==null?void 0:y.params.taskId)??(S==null?void 0:S.params.taskId),D=v??b??y??S,P=(D==null?void 0:D.params.environmentId)??(j==null?void 0:j.params.environmentId),O=c.pathname.startsWith("/environments")&&!j&&!D,z=!!T,Q=!!k,$=!!j&&!v&&!b&&!y&&!S,J=!!N;if(!!C&&!Q&&!$&&!J||!!A||(!!g||!!S)||J||O||Q)return i.jsx(i.Fragment,{});if(z)return o.find(F=>F.adapterType==="local"&&F.status==="connected")?i.jsx(i.Fragment,{}):i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Add a local environment to start chatting"})});if($)return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Select a task or click + to create one"})});if(E){const B=s.find(de=>de.id===E);if(!B)return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Loading..."})});const F=new Map(s.map(de=>[de.id,de])),Z=B.dependsOn.some(de=>{const W=F.get(de);return W!==void 0&&W.status!=="complete"});if(B.status==="not_started"){const de=Z?B.dependsOn.map(W=>F.get(W)).filter(W=>W&&W.status!=="complete").map(W=>W.title):[];return i.jsx("div",{className:jt.bar,children:Z?i.jsxs("span",{className:jt.statusBlocked,children:["Blocked by: ",de.join(", ")]}):i.jsx("span",{className:jt.hintText,children:"Use the buttons above to start or manage this task"})})}if(B.status==="working"||B.status==="paused"){const de=B.latestSessionId||void 0,W=de?t.find(ue=>ue.id===de):void 0;return W&&W.status!=="stopped"?i.jsx(i.Fragment,{}):i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Waiting for agent..."})})}if(B.status==="complete")return i.jsxs("div",{className:jt.bar,children:[i.jsx("span",{className:`${jt.statusText} ${jt.statusCompleted}`,children:"Task completed"}),i.jsx("button",{onClick:()=>r(Ii(B.workspaceId,void 0,P)),className:jt.btnPrimary,children:"+ New Task"})]});if(B.status==="failed")return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:`${jt.statusText} ${jt.statusFailed}`,children:"Task failed"})})}if(I){const B=t.find(de=>de.id===I),F=(B==null?void 0:B.status)==="stopped";if(B!==void 0&&!F)return i.jsx(i.Fragment,{});if(F)return i.jsxs("div",{className:jt.bar,children:[i.jsxs("span",{className:`${jt.statusText} ${jt.hintText}`,children:["Session ",B.endReason||B.status]}),i.jsx("button",{onClick:()=>r(Kx(B.environmentId)),className:jt.btnPrimary,children:"+ New Chat"})]})}return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Loading..."})})}const VI="_nav_14i94_1",qI="_tab_14i94_24",GI="_tabActive_14i94_62",FI="_tabLabel_14i94_75",ZI="_statusDot_14i94_81",KI="_pulse_14i94_87",YI="_addButton_14i94_99",JI="_empty_14i94_132",Ba={nav:VI,tab:qI,tabActive:GI,tabLabel:FI,statusDot:ZI,pulse:KI,addButton:YI,empty:JI},WI={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function XI({environments:t}){const s=mt(),o=x.useRef(null),r=At("/environments/:environmentId"),c=At("/environments/:environmentId/edit"),d=At("/environments/:environmentId/workspaces/:workspaceId"),u=At("/environments/:environmentId/workspaces/:workspaceId/*"),p=(r==null?void 0:r.params.environmentId)??(c==null?void 0:c.params.environmentId)??(d==null?void 0:d.params.environmentId)??(u==null?void 0:u.params.environmentId),m=p==="new"?void 0:p,g=x.useCallback(y=>{s(Ai(y))},[s]),v=x.useCallback(y=>{var T;const S=(T=o.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!S||S.length===0)return;const k=Array.from(S).findIndex(C=>C===document.activeElement),j=k>=0?k:t.findIndex(C=>C.id===m);let N=j;if(y.key==="ArrowDown"||y.key==="j"||y.key==="J")y.preventDefault(),N=(j+1)%S.length;else if(y.key==="ArrowUp"||y.key==="k"||y.key==="K")y.preventDefault(),N=(j-1+S.length)%S.length;else if(y.key==="Home")y.preventDefault(),N=0;else if(y.key==="End")y.preventDefault(),N=S.length-1;else return;N<t.length&&s(Ai(t[N].id)),S[N].focus()},[m,t,s]),b=m??(t.length>0?t[0].id:void 0);return i.jsxs("div",{className:Ba.nav,"data-testid":"environment-nav",children:[i.jsx("nav",{ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(y=>{const S=y.id===m,k=y.id===b,j=WI[y.status]||"var(--text-tertiary)",N=y.status==="connected";return i.jsxs("button",{role:"tab",type:"button","aria-selected":S,tabIndex:k?0:-1,className:`${Ba.tab} ${S?Ba.tabActive:""}`,onClick:()=>g(y.id),"data-testid":"env-nav-item",children:[i.jsx("span",{className:`${Ba.statusDot} ${N?Ba.pulse:""}`,style:{color:j},"aria-hidden":"true",children:i.jsx(Va,{size:bm,fill:"currentColor"})}),i.jsx("span",{className:Ba.tabLabel,title:y.displayName||y.id,children:y.displayName||y.id})]},y.id)})}),i.jsx("button",{type:"button",className:Ba.addButton,onClick:()=>s(vN),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&i.jsx("div",{className:Ba.empty,children:"No environments yet."})]})}function Po(t){const s=new Date(t),o=new Date,r=o.getTime()-s.getTime(),c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return"just now";if(d<60)return`${d}m ago`;if(u<24)return`${u}h ago`;if(p===1)return"yesterday";if(p<7)return`${p} days ago`;const m=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}function B1(t){const s=new Date(t);if(Number.isNaN(s.getTime()))return"—";const o=new Date,r=s.getTime()-o.getTime();if(r<=0)return"overdue";const c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return`in ${c}s`;if(d<60)return`in ${d}m`;if(u<24)return`in ${u}h`;if(p<7)return`in ${p} day${p===1?"":"s"}`;const m=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Qb={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 xd(t){return Qb[t]||Qb.general}const QI="_nav_dlm8m_1",e5="_categoryPills_dlm8m_24",t5="_categoryPill_dlm8m_24",n5="_tab_dlm8m_42",s5="_tabActive_dlm8m_80",a5="_tabContent_dlm8m_93",i5="_tabLabel_dlm8m_100",o5="_tabMeta_dlm8m_106",r5="_categoryDot_dlm8m_111",l5="_empty_dlm8m_118",js={nav:QI,categoryPills:e5,categoryPill:t5,tab:n5,tabActive:s5,tabContent:a5,tabLabel:i5,tabMeta:o5,categoryDot:r5,empty:l5};function c5({findings:t,workspaceId:s,environmentId:o}){const r=mt(),c=x.useRef(null),d=At("/findings/:findingId"),u=At("/environments/:environmentId/workspaces/:workspaceId/findings/:findingId"),p=(d==null?void 0:d.params.findingId)??(u==null?void 0:u.params.findingId),m=x.useMemo(()=>{const y=new Set(t.map(S=>S.category).filter(Boolean));return Array.from(y).sort()},[t]),g=x.useCallback(y=>{r(Gp(y,s,o))},[r,s,o]),v=x.useCallback(y=>{var T;const S=(T=c.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!S||S.length===0)return;const k=Array.from(S).findIndex(C=>C===document.activeElement),j=k>=0?k:t.findIndex(C=>C.id===p);let N=j;if(y.key==="ArrowDown"||y.key==="j"||y.key==="J")y.preventDefault(),N=(j+1)%S.length;else if(y.key==="ArrowUp"||y.key==="k"||y.key==="K")y.preventDefault(),N=(j-1+S.length)%S.length;else if(y.key==="Home")y.preventDefault(),N=0;else if(y.key==="End")y.preventDefault(),N=S.length-1;else return;N<t.length&&r(Gp(t[N].id,s,o)),S[N].focus()},[p,t,r,s,o]),b=p??(t.length>0?t[0].id:void 0);return i.jsxs("div",{className:js.nav,"data-testid":"findings-nav",children:[m.length>1&&i.jsx("div",{className:js.categoryPills,"data-testid":"findings-nav-categories",children:m.map(y=>i.jsx("span",{className:js.categoryPill,style:{color:xd(y).text},children:y},y))}),i.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(y=>{const S=y.id===p,k=y.id===b;return i.jsxs("button",{role:"tab",type:"button","aria-selected":S,tabIndex:k?0:-1,className:`${js.tab} ${S?js.tabActive:""}`,onClick:()=>g(y.id),"data-testid":"finding-nav-item",children:[i.jsx("span",{className:js.categoryDot,style:{color:xd(y.category).text},"aria-hidden":"true",children:i.jsx(Va,{size:bm,fill:"currentColor"})}),i.jsxs("span",{className:js.tabContent,children:[i.jsx("span",{className:js.tabLabel,title:y.title,children:y.title}),i.jsx("span",{className:js.tabMeta,title:y.createdAt,children:Po(y.createdAt)})]})]},y.id)})}),t.length===0&&i.jsx("div",{className:js.empty,children:"No findings yet. Agents will post discoveries here."})]})}function d5(t){if(t.length===0)return[];const s=[...t].sort((r,c)=>r[0]-c[0]),o=[[s[0][0],s[0][1]]];for(let r=1;r<s.length;r++){const c=o[o.length-1],[d,u]=s[r];d<=c[1]+1?c[1]=Math.max(c[1],u):o.push([d,u])}return o}function L1({text:t,indices:s,highlightClass:o}){if(!s||s.length===0)return i.jsx(i.Fragment,{children:t});const r=d5(s),c=[];let d=0;for(const[u,p]of r)u>d&&c.push(i.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(i.jsx("mark",{className:o,children:t.slice(u,p+1)},`m${u}`)),d=p+1;return d<t.length&&c.push(i.jsx("span",{children:t.slice(d)},`p${d}`)),i.jsx(i.Fragment,{children:c})}function u5(t){const s=new Map(t.map(r=>[r.id,{...r,children:[]}])),o=[];for(const r of s.values())r.parentTaskId&&s.has(r.parentTaskId)?s.get(r.parentTaskId).children.push(r):o.push(r);for(const r of s.values())r.children.sort((c,d)=>c.sortOrder-d.sortOrder);return o.sort((r,c)=>r.sortOrder-c.sortOrder)}function f5(t,s){const o=new Map;for(const d of t){const p=d.dependsOn.length>0&&d.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":d.status,m=o.get(p);m?m.push(d):o.set(p,[d])}const r=[],c=new Set;for(const d of _j){c.add(d);const u=o.get(d);if(u&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=qa(d);r.push({status:d,label:p.label,style:p,tasks:u})}}for(const[d,u]of o)if(!c.has(d)&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=qa(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const p5="_container_z4i38_1",m5="_header_z4i38_5",h5="_headerActions_z4i38_17",g5="_searchInput_z4i38_23",v5="_searchHighlight_z4i38_56",y5="_groupToggle_z4i38_62",b5="_groupToggleActive_z4i38_89",x5="_addButton_z4i38_93",_5="_taskRow_z4i38_120",k5="_selected_z4i38_140",S5="_expandArrow_z4i38_150",T5="_expanded_z4i38_157",j5="_leafSpacer_z4i38_161",w5="_taskStatusIcon_z4i38_166",N5="_taskTitle_z4i38_170",C5="_workspaceBadge_z4i38_177",E5="_childCountBadge_z4i38_195",A5="_dependencyBadge_z4i38_208",D5="_blockedBadge_z4i38_220",R5="_addChildButton_z4i38_225",M5="_emptyState_z4i38_268",I5="_statusGroupHeader_z4i38_275",O5="_statusGroupIcon_z4i38_294",B5="_statusGroupLabel_z4i38_298",L5="_statusGroupCount_z4i38_303",Fe={container:p5,header:m5,headerActions:h5,searchInput:g5,searchHighlight:v5,groupToggle:y5,groupToggleActive:b5,addButton:x5,taskRow:_5,selected:k5,expandArrow:S5,expanded:T5,leafSpacer:j5,taskStatusIcon:w5,taskTitle:N5,workspaceBadge:C5,childCountBadge:E5,dependencyBadge:A5,blockedBadge:D5,addChildButton:R5,emptyState:M5,statusGroupHeader:I5,statusGroupIcon:O5,statusGroupLabel:B5,statusGroupCount:L5},z5=[{name:"title",weight:2},{name:"description",weight:1}],z1=16,$5=16,$1="grackle-task-group-by-status";function ex(){try{return localStorage.getItem($1)==="true"}catch{return!1}}function U5(t){try{localStorage.setItem($1,String(t))}catch{}}function P5({group:t,isExpanded:s,onToggle:o,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return i.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[i.jsxs("div",{className:Fe.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:o,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),o())},children:[i.jsx("span",{className:`${Fe.expandArrow} ${s?Fe.expanded:""}`,"aria-hidden":"true",children:i.jsx(ra,{size:ct})}),i.jsx("span",{className:Fe.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),i.jsx("span",{className:Fe.statusGroupLabel,children:t.label}),i.jsx("span",{className:Fe.statusGroupCount,children:t.tasks.length})]}),i.jsx(gs,{children:s&&i.jsx(Mt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:t.tasks.map(p=>{const m=qa(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return i.jsxs("div",{onClick:()=>c(On(p.id)),role:"button",tabIndex:0,"aria-label":p.title,onKeyDown:b=>{b.currentTarget===b.target&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c(On(p.id)))},className:`${Fe.taskRow} ${g?Fe.selected:""}`,style:{"--task-indent":`${z1}px`},"data-task-id":p.id,children:[i.jsx("span",{className:Fe.leafSpacer}),i.jsx("span",{className:Fe.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${pl(p.status)}`,children:m.icon}),i.jsx("span",{className:Fe.taskTitle,title:p.title,children:i.jsx(L1,{text:p.title,indices:d.get(p.id),highlightClass:Fe.searchHighlight})}),v&&i.jsx("span",{className:Fe.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function U1({node:t,depth:s,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m}){const g=qa(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(T=>u.get(T)!=="complete"),b=o.has(t.id),y=t.children.length>0,S=c===t.id,k=z1+s*$5,N=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{onClick:()=>d(On(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:T=>{T.currentTarget===T.target&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),d(On(t.id)))},className:`${Fe.taskRow} ${S?Fe.selected:""}`,style:{"--task-indent":`${k}px`},"data-task-id":t.id,children:[y&&i.jsx("span",{className:`${Fe.expandArrow} ${b?Fe.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:T=>{T.stopPropagation(),r(t.id)},onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),r(t.id))},children:i.jsx(ra,{size:ct,"aria-hidden":"true"})}),!y&&i.jsx("span",{className:Fe.leafSpacer}),i.jsx("span",{className:Fe.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${pl(t.status)}`,children:g.icon}),i.jsx("span",{className:Fe.taskTitle,title:t.title,children:i.jsx(L1,{text:t.title,indices:p.get(t.id),highlightClass:Fe.searchHighlight})}),N&&i.jsx("span",{className:Fe.workspaceBadge,title:N,children:N}),y&&i.jsxs("span",{className:Fe.childCountBadge,children:[t.children.filter(T=>T.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&i.jsx("span",{className:`${Fe.dependencyBadge} ${v?Fe.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<DT&&i.jsx($o,{text:"Add child task",children:i.jsx("button",{onClick:T=>{T.stopPropagation(),d(Ii(t.workspaceId,t.id))},"aria-label":"Add child task",className:Fe.addChildButton,children:"+"})})]}),i.jsx(gs,{children:y&&b&&i.jsx(Mt.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=>i.jsx(U1,{node:T,depth:s+1,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},T.id))})})]})}function H5({workspaces:t,tasks:s}){const o=mt(),[r,c]=x.useState(new Set),[d,u]=x.useState(new Set),[p,m]=x.useState(ex),[g,v]=x.useState(ex),[b,y]=x.useState(new Map),S=At("/tasks/:taskId/*"),k=(S==null?void 0:S.params.taskId)!=="new"?S==null?void 0:S.params.taskId:void 0,j=x.useMemo(()=>new Map(s.map(te=>[te.id,te.status])),[s]),N=x.useMemo(()=>new Map(t.map(te=>[te.id,te.name])),[t]),T=()=>{const te=!p;U5(te),m(te),te&&(v(!0),y(new Map))},C=te=>{y(X=>{const B=new Map(X),F=B.has(te)?B.get(te):g;return B.set(te,!F),B})},A=te=>b.has(te)?b.get(te):g,I=te=>{c(X=>{const B=new Set(X);return B.has(te)?(B.delete(te),u(F=>new Set(F).add(te))):(B.add(te),u(F=>{const Z=new Set(F);return Z.delete(te),Z})),B})};x.useEffect(()=>{const te=new Set(s.filter(X=>X.parentTaskId).map(X=>X.parentTaskId));te.size>0&&c(X=>{const B=new Set(X);for(const F of te)d.has(F)||B.add(F);return B})},[s,d]);const[E,D]=x.useState(""),{directMatchTaskIds:P,treeMatchTaskIds:O,titleHighlights:z}=x.useMemo(()=>{if(!E.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const te=AT(s,E,z5),X=new Set(te.map(de=>de.item.id)),B=new Map;for(const de of te){const W=de.matches.find(ee=>ee.key==="title");W&&B.set(de.item.id,W.indices)}const F=new Set(X),Z=new Map(s.map(de=>[de.id,de]));for(const de of[...X]){let W=Z.get(de);for(;W!=null&&W.parentTaskId;)F.add(W.parentTaskId),W=Z.get(W.parentTaskId)}return{directMatchTaskIds:X,treeMatchTaskIds:F,titleHighlights:B}},[E,s]),Q=P!==null,$=Q?p?P:O:null,J=$?s.filter(te=>$.has(te.id)):s,me=p?[]:u5(J);return i.jsxs("div",{className:Fe.container,children:[i.jsxs("div",{className:Fe.header,children:[i.jsx("span",{children:"Tasks"}),i.jsxs("div",{className:Fe.headerActions,children:[i.jsx($o,{text:p?"Switch to tree view":"Group tasks by status",children:i.jsx("button",{className:`${Fe.groupToggle} ${p?Fe.groupToggleActive:""}`,onClick:T,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,"data-testid":"task-group-by-status-toggle",children:i.jsx(Y2,{size:nn})})}),i.jsx($o,{text:"New task",children:i.jsx("button",{className:Fe.addButton,onClick:()=>o(Ii()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&i.jsx("input",{type:"text",value:E,onChange:te=>D(te.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Fe.searchInput,"data-testid":"sidebar-search"}),p?f5(J,j).map(te=>i.jsx(P5,{group:te,isExpanded:A(te.status),onToggle:()=>C(te.status),selectedTaskId:k,navigate:o,titleHighlights:z,workspaceNames:N},te.status)):me.map(te=>i.jsx(U1,{node:te,depth:0,expandedTasks:r,toggleTask:I,selectedTaskId:k,navigate:o,taskStatusById:j,titleHighlights:z,workspaceNames:N},te.id)),J.length===0&&!Q&&i.jsx("div",{className:Fe.emptyState,children:"No tasks yet. Click + to create one."}),J.length===0&&Q&&i.jsx("div",{className:Fe.emptyState,children:"No matching tasks"})]})}const V5="_toast_ed2dk_1",q5="_success_ed2dk_18",G5="_icon_ed2dk_22",F5="_error_ed2dk_25",Z5="_warning_ed2dk_32",K5="_info_ed2dk_38",Y5="_message_ed2dk_53",J5="_close_ed2dk_60",qr={toast:V5,success:q5,icon:G5,error:F5,warning:Z5,info:K5,message:Y5,close:J5},W5={success:i.jsx(Ri,{size:Rt}),error:i.jsx(Ka,{size:Rt}),warning:i.jsx(ym,{size:Rt}),info:i.jsx(vm,{size:Rt})};function X5({toast:t,onDismiss:s}){return x.useEffect(()=>{const o=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(o)},[t.id,t.duration,s]),i.jsxs(Mt.div,{className:`${qr.toast} ${qr[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:[i.jsx("span",{className:qr.icon,"aria-hidden":"true",children:W5[t.variant]}),i.jsx("span",{className:qr.message,children:t.message}),i.jsx("button",{type:"button",className:qr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:i.jsx(Ka,{size:nn,"aria-hidden":"true"})})]})}const Q5="_container_qqse2_1",eO={container:Q5};function tO({toasts:t,onDismiss:s}){return i.jsx("div",{className:eO.container,"data-testid":"toast-container",children:i.jsx(gs,{children:t.map(o=>i.jsx(X5,{toast:o,onDismiss:s},o.id))})})}const nO="_callout_e5awm_1",sO="_success_e5awm_11",aO="_icon_e5awm_15",iO="_error_e5awm_18",oO="_warning_e5awm_25",rO="_info_e5awm_32",lO="_content_e5awm_48",cO="_close_e5awm_53",Gr={callout:nO,success:sO,icon:aO,error:iO,warning:oO,info:rO,content:lO,close:cO},dO={success:i.jsx(Ri,{size:Rt}),error:i.jsx(Ka,{size:Rt}),warning:i.jsx(ym,{size:Rt}),info:i.jsx(vm,{size:Rt})};function uO({variant:t="info",children:s,dismissible:o=!1,className:r}){const[c,d]=x.useState(!1);return i.jsx(i.Fragment,{children:!c&&i.jsxs("div",{className:[Gr.callout,Gr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[i.jsx("span",{className:Gr.icon,"aria-hidden":"true",children:dO[t]}),i.jsx("span",{className:Gr.content,children:s}),o&&i.jsx("button",{type:"button",className:Gr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:i.jsx(Ka,{size:nn,"aria-hidden":"true"})})]})})}function fO({currentVersion:t,latestVersion:s,updateAvailable:o,isDocker:r}){if(!o)return i.jsx(i.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return i.jsx("div",{"data-testid":"update-banner",children:i.jsxs(uO,{variant:"info",dismissible:!0,children:[i.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",i.jsx("code",{children:c})]})})}const pO="_container_de44x_1",mO="_emptyState_de44x_8",hO="_card_de44x_14",gO="_cardClickable_de44x_34",vO="_cardHeader_de44x_42",yO="_categoryBadge_de44x_54",bO="_findingTitle_de44x_62",xO="_findingDate_de44x_68",_O="_findingContent_de44x_80",kO="_tags_de44x_86",SO="_tag_de44x_86",fs={container:pO,emptyState:mO,card:hO,cardClickable:gO,cardHeader:vO,categoryBadge:yO,findingTitle:bO,findingDate:xO,findingContent:_O,tags:kO,tag:SO};function P1({findings:t,onFindingClick:s}){return t.length===0?i.jsx("div",{className:fs.emptyState,children:"No findings yet. Agents will post discoveries here."}):i.jsx("div",{className:fs.container,children:t.map((o,r)=>{const c=xd(o.category),d=s?Mt.button:Mt.div;return i.jsxs(d,{type:s?"button":void 0,className:`${fs.card} ${s?fs.cardClickable:""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:r*.05,duration:.2},onClick:s?()=>{s(o.id)}:void 0,children:[i.jsxs("div",{className:fs.cardHeader,children:[i.jsx("span",{className:fs.categoryBadge,style:{background:c.bg,color:c.text},children:o.category}),i.jsx("span",{className:fs.findingTitle,children:o.title}),i.jsx("span",{className:fs.findingDate,title:o.createdAt,children:Po(o.createdAt)})]}),i.jsx("div",{className:fs.findingContent,children:o.content.length>300?o.content.slice(0,300)+"...":o.content}),o.tags.length>0&&i.jsx("div",{className:fs.tags,children:o.tags.map(u=>i.jsx("span",{className:fs.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:u},u))})]},o.id)})})}const TO="_section_1ingb_14",jO="_sectionTitle_1ingb_26",wO="_sectionDescription_1ingb_35",NO="_tokenList_1ingb_48",CO="_tokenRow_1ingb_55",EO="_tokenBadge_1ingb_68",AO="_tokenName_1ingb_83",DO="_tokenTarget_1ingb_90",RO="_deleteButton_1ingb_99",MO="_addForm_1ingb_113",IO="_formRow_1ingb_119",OO="_input_1ingb_125",BO="_select_1ingb_155",LO="_addButton_1ingb_187",zO="_emptyStateInfo_1ingb_221",$O="_themeOptions_1ingb_229",UO="_themeOption_1ingb_229",PO="_themeOptionSelected_1ingb_254",HO="_themeOptionHeader_1ingb_259",VO="_themeOptionLabel_1ingb_266",qO="_themeOptionDesc_1ingb_273",GO="_variantToggle_1ingb_279",FO="_variantButton_1ingb_286",ZO="_variantActive_1ingb_305",KO="_themeSwatches_1ingb_311",YO="_themeSwatch_1ingb_311",JO="_systemToggle_1ingb_325",WO="_systemToggleHint_1ingb_341",XO="_themeActive_1ingb_348",QO="_aboutGrid_1ingb_354",eB="_aboutItem_1ingb_360",tB="_aboutLabel_1ingb_373",nB="_aboutValue_1ingb_379",sB="_aboutDot_1ingb_387",aB="_aboutDotConnected_1ingb_394",iB="_aboutDotDisconnected_1ingb_398",ye={section:TO,sectionTitle:jO,sectionDescription:wO,tokenList:NO,tokenRow:CO,tokenBadge:EO,tokenName:AO,tokenTarget:DO,deleteButton:RO,addForm:MO,formRow:IO,input:OO,select:BO,addButton:LO,emptyStateInfo:zO,themeOptions:$O,themeOption:UO,themeOptionSelected:PO,themeOptionHeader:HO,themeOptionLabel:VO,themeOptionDesc:qO,variantToggle:GO,variantButton:FO,variantActive:ZO,themeSwatches:KO,themeSwatch:YO,systemToggle:JO,systemToggleHint:WO,themeActive:XO,aboutGrid:QO,aboutItem:eB,aboutLabel:tB,aboutValue:nB,aboutDot:sB,aboutDotConnected:aB,aboutDotDisconnected:iB},oB=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function rB({tokens:t,onSetToken:s,onDeleteToken:o,onShowToast:r}){const[c,d]=x.useState(""),[u,p]=x.useState(""),[m,g]=x.useState("env_var"),[v,b]=x.useState(""),[y,S]=x.useState(null),k=T=>{if(T.preventDefault(),!c||!u)return;const C=m==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,u,m,C,m==="file"?v:""),r==null||r("Token saved successfully","success"),d(""),p(""),b("")},j=T=>{S(T)},N=()=>{y&&(o(y),r==null||r("Token deleted","info")),S(null)};return i.jsxs(i.Fragment,{children:[i.jsx(ia,{isOpen:y!==null,title:"Delete Token?",description:y?`"${y}" will be permanently removed.`:void 0,onConfirm:N,onCancel:()=>S(null)}),i.jsxs("section",{className:ye.section,children:[i.jsx("h3",{className:ye.sectionTitle,children:"Tokens"}),i.jsx("p",{className:ye.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?i.jsx("div",{className:ye.emptyStateInfo,children:"Add your first API token to enable service integrations."}):i.jsx("div",{className:ye.tokenList,children:t.map(T=>i.jsxs("div",{className:ye.tokenRow,children:[i.jsx("span",{className:ye.tokenBadge,children:T.tokenType}),i.jsx("span",{className:ye.tokenName,children:T.name}),i.jsx("span",{className:ye.tokenTarget,children:T.tokenType==="env_var"?T.envVar:T.filePath}),i.jsx("button",{className:ye.deleteButton,onClick:()=>j(T.name),title:`Delete ${T.name}`,"aria-label":`Delete ${T.name}`,children:i.jsx(Ka,{size:nn,"aria-hidden":"true"})})]},T.name))}),i.jsxs("form",{className:ye.addForm,onSubmit:k,children:[i.jsxs("div",{className:ye.formRow,children:[i.jsx("input",{className:ye.input,type:"text",placeholder:"Token name",value:c,onChange:T=>d(T.target.value)}),i.jsx("input",{className:ye.input,type:"password",placeholder:"Value",value:u,onChange:T=>p(T.target.value)})]}),i.jsxs("div",{className:ye.formRow,children:[i.jsx("select",{className:ye.select,value:m,onChange:T=>g(T.target.value),children:oB.map(T=>i.jsx("option",{value:T.value,children:T.label},T.value))}),i.jsx("input",{className:ye.input,type:"text",placeholder:m==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:T=>b(T.target.value)}),i.jsx("button",{className:ye.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const zd=[{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"]}],H1=new Set(zd.map(t=>t.id)),tx="grackle";function um(t){return zd.find(s=>s.id===t)}function lB({themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c}){return i.jsxs("section",{className:ye.section,children:[i.jsx("h3",{className:ye.sectionTitle,children:"Appearance"}),i.jsx("p",{className:ye.sectionDescription,children:"Choose how Grackle looks across the app."}),i.jsx("div",{className:ye.themeOptions,children:zd.filter(d=>!d.hidden).map(d=>{const u=!!(d.variantLightId&&d.variantDarkId),p=u?t===d.id||t===d.variantLightId||t===d.variantDarkId:t===d.id,m=u&&s===d.variantLightId;return i.jsxs("button",{type:"button",className:`${ye.themeOption} ${p?ye.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>o(d.id),children:[i.jsxs("span",{className:ye.themeOptionHeader,children:[i.jsxs("span",{children:[i.jsx("span",{className:ye.themeOptionLabel,children:d.label}),i.jsx("span",{className:ye.themeOptionDesc,children:d.description})]}),u&&i.jsxs("span",{className:ye.variantToggle,children:[i.jsx("span",{role:"button",tabIndex:0,className:`${ye.variantButton} ${p&&m?ye.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&m,children:"☼"}),i.jsx("span",{role:"button",tabIndex:0,className:`${ye.variantButton} ${p&&!m?ye.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!m,children:"☾"})]})]}),d.swatches&&i.jsx("span",{className:ye.themeSwatches,children:d.swatches.map((g,v)=>i.jsx("span",{className:ye.themeSwatch,style:{background:g}},v))})]},d.id)})}),i.jsxs("label",{className:ye.systemToggle,children:[i.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),i.jsx("span",{children:"Match system light/dark preference"})]}),i.jsx("p",{className:ye.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),i.jsxs("p",{className:ye.themeActive,children:["Active theme: ",i.jsx("strong",{children:s})]})]})}function cB({connected:t,environments:s,sessions:o}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=o.filter(u=>["running","idle"].includes(u.status)).length;return i.jsxs("section",{className:ye.section,"data-testid":"about-panel",children:[i.jsx("h3",{className:ye.sectionTitle,children:"About"}),i.jsx("p",{className:ye.sectionDescription,children:"Connection status and application information."}),i.jsxs("div",{className:ye.aboutGrid,children:[i.jsxs("div",{className:ye.aboutItem,children:[i.jsx("span",{className:ye.aboutLabel,children:"Connection"}),i.jsxs("span",{className:ye.aboutValue,children:[i.jsx("span",{className:`${ye.aboutDot} ${t?ye.aboutDotConnected:ye.aboutDotDisconnected}`}),t?"Connected":"Disconnected"]})]}),i.jsxs("div",{className:ye.aboutItem,children:[i.jsx("span",{className:ye.aboutLabel,children:"Environments"}),i.jsxs("span",{className:ye.aboutValue,children:[r,"/",c," connected"]})]}),i.jsxs("div",{className:ye.aboutItem,children:[i.jsx("span",{className:ye.aboutLabel,children:"Active Sessions"}),i.jsx("span",{className:ye.aboutValue,children:d})]}),i.jsxs("div",{className:ye.aboutItem,children:[i.jsx("span",{className:ye.aboutLabel,children:"Version"}),i.jsx("span",{className:ye.aboutValue,children:"0.102.0"})]})]})]})}const dB="_container_cddyd_1",uB="_header_cddyd_8",fB="_headerTitle_cddyd_35",pB="_badge_cddyd_44",mB="_headerActions_cddyd_54",hB="_body_cddyd_61",gB="_formContent_cddyd_73",vB="_section_cddyd_85",yB="_label_cddyd_91",bB="_titleInput_cddyd_98",xB="_descriptionTextarea_cddyd_131",_B="_parentContext_cddyd_167",kB="_parentLabel_cddyd_175",SB="_parentName_cddyd_182",TB="_personaSelect_cddyd_186",jB="_depList_cddyd_220",wB="_depItem_cddyd_226",NB="_depItemSelected_cddyd_248",CB="_noDeps_cddyd_252",EB="_btnPrimary_cddyd_258",AB="_btnGhost_cddyd_289",nt={container:dB,header:uB,headerTitle:fB,badge:pB,headerActions:mB,body:hB,formContent:gB,section:vB,label:yB,titleInput:bB,descriptionTextarea:xB,parentContext:_B,parentLabel:kB,parentName:SB,personaSelect:TB,depList:jB,depItem:wB,depItemSelected:NB,noDeps:CB,btnPrimary:EB,btnGhost:AB};function V1({mode:t,taskId:s,workspaceId:o,parentTaskId:r,environmentId:c,tasks:d,workspaces:u,personas:p,onCreateTask:m,onUpdateTask:g,onEditDone:v,onShowToast:b}){const y=mt(),S=t==="edit",k=S&&s?d.find(xe=>xe.id===s):void 0,j=S?(k==null?void 0:k.workspaceId)??"":o??"",[N,T]=x.useState(j),C=j||N,A=u.find(xe=>xe.id===C),I=c??(A==null?void 0:A.environmentId),E=!S&&!o,D=S?(k==null?void 0:k.parentTaskId)??"":r??"",P=D?d.find(xe=>xe.id===D):void 0,[O,z]=x.useState((k==null?void 0:k.title)??""),[Q,$]=x.useState((k==null?void 0:k.description)??""),[J,me]=x.useState((k==null?void 0:k.dependsOn)??[]),[te,X]=x.useState((k==null?void 0:k.defaultPersonaId)??""),[B,F]=x.useState((k==null?void 0:k.canDecompose)??!1),[Z,de]=x.useState(!1),W=x.useRef(!1);x.useEffect(()=>{S&&k&&!W.current&&(W.current=!0,z(k.title),$(k.description),me(k.dependsOn),X(k.defaultPersonaId),F(k.canDecompose))},[S,k]);const ee=d.filter(xe=>xe.workspaceId===C&&(!S||xe.id!==s)&&xe.id!==D),ue=O.trim().length>0&&(!S||k!==void 0)&&C.length>0,Ce=xe=>{me(Be=>Be.includes(xe)?Be.filter(It=>It!==xe):[...Be,xe])},Pe=()=>{!ue||Z||S&&k===void 0||(S&&s?(g(s,O.trim(),Q,J,te),b==null||b("Task updated","success"),v?v():y(On(s,void 0,C,I),{replace:!0})):(de(!0),m(C,O.trim(),Q,J.length>0?J:void 0,D||void 0,te,B,()=>{b==null||b("Task created","success"),y(o?Ga(o,I):"/tasks",{replace:!0})},xe=>{b==null||b(xe,"error"),de(!1)})))},ge=()=>{if(v){v();return}y(S&&s?On(s,void 0,C,I):o?Ga(o,I):"/tasks")},Se=S?"edit task":D?"child task":"new task";return i.jsxs("div",{className:nt.container,children:[i.jsxs("div",{className:nt.header,children:[i.jsxs("div",{className:nt.headerTitle,children:[i.jsx("span",{className:nt.badge,children:Se}),P&&i.jsxs("span",{className:nt.parentContext,children:[i.jsx("span",{className:nt.parentLabel,children:"Child of"}),i.jsx("span",{className:nt.parentName,children:P.title})]})]}),i.jsxs("div",{className:nt.headerActions,children:[i.jsx("button",{onClick:Pe,disabled:!ue||Z,className:nt.btnPrimary,"data-testid":"task-edit-save",children:Z?"Creating…":S?"Save Changes":"Create"}),i.jsx("button",{onClick:ge,className:nt.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:nt.body,children:i.jsxs("div",{className:nt.formContent,children:[E&&i.jsxs("div",{className:nt.section,children:[i.jsx("label",{className:nt.label,htmlFor:"task-edit-workspace",children:"Workspace"}),i.jsxs("select",{id:"task-edit-workspace",value:N,onChange:xe=>T(xe.target.value),className:nt.personaSelect,"data-testid":"task-edit-workspace",children:[i.jsx("option",{value:"",children:"Select a workspace..."}),u.map(xe=>i.jsx("option",{value:xe.id,children:xe.name},xe.id))]})]}),i.jsxs("div",{className:nt.section,children:[i.jsx("label",{className:nt.label,htmlFor:"task-edit-title",children:"Title"}),i.jsx("input",{id:"task-edit-title",type:"text",value:O,onChange:xe=>z(xe.target.value),placeholder:"Task title...",autoFocus:!0,className:nt.titleInput,"data-testid":"task-edit-title",onKeyDown:xe=>{xe.key==="Enter"&&ue&&Pe()}})]}),i.jsxs("div",{className:nt.section,children:[i.jsx("label",{className:nt.label,htmlFor:"task-edit-description",children:"Description"}),i.jsx("textarea",{id:"task-edit-description",value:Q,onChange:xe=>$(xe.target.value),placeholder:"Describe the task... (markdown supported)",className:nt.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),i.jsxs("div",{className:nt.section,children:[i.jsx("label",{className:nt.label,htmlFor:"task-edit-persona",children:"Default Persona"}),i.jsxs("select",{id:"task-edit-persona",value:te,onChange:xe=>X(xe.target.value),className:nt.personaSelect,"data-testid":"task-edit-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),p.map(xe=>i.jsx("option",{value:xe.id,children:xe.name},xe.id))]})]}),!S&&i.jsx("div",{className:nt.section,children:i.jsxs("label",{className:nt.depItem,"data-testid":"task-edit-can-decompose",children:[i.jsx("input",{type:"checkbox",checked:B,onChange:xe=>F(xe.target.checked)}),"Can spawn subtasks"]})}),i.jsxs("div",{className:nt.section,children:[i.jsx("div",{className:nt.label,children:"Dependencies"}),ee.length===0?i.jsx("div",{className:nt.noDeps,children:"No other tasks in this workspace"}):i.jsx("div",{className:nt.depList,children:ee.map(xe=>{const Be=J.includes(xe.id);return i.jsxs("label",{className:`${nt.depItem} ${Be?nt.depItemSelected:""}`,"data-testid":`dep-option-${xe.id}`,children:[i.jsx("input",{type:"checkbox",checked:Be,onChange:()=>Ce(xe.id)}),xe.title,i.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",xe.status,")"]})]},xe.id)})})]})]})})]})}const DB="_actionButtons_1rjka_1",RB="_btnPrimary_1rjka_8",MB="_btnDanger_1rjka_39",IB="_btnGhost_1rjka_78",Kt={actionButtons:DB,btnPrimary:RB,btnDanger:MB,btnGhost:IB};function OB({task:t,sessionId:s,isBlocked:o,onStart:r,onResume:c,onStop:d,onPause:u,onDelete:p,onEdit:m}){if(t.status==="not_started")return o?i.jsxs("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:m,className:Kt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Kt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]}):i.jsxs("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{"data-testid":"task-header-start",onClick:r,className:Kt.btnPrimary,children:"Start"}),i.jsx("button",{onClick:m,className:Kt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Kt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="working")return i.jsxs("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Kt.btnDanger,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:u,disabled:!s,className:Kt.btnGhost,"data-testid":"task-action-pause",children:"Pause"})]});if(t.status==="paused")return i.jsxs("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Kt.btnPrimary,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:c,className:Kt.btnGhost,"data-testid":"task-action-resume",children:"Resume"}),i.jsx("button",{onClick:p,className:Kt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="complete")return i.jsx("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:i.jsx("button",{onClick:p,className:Kt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})});if(t.status==="failed")return i.jsxs("div",{className:Kt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:r,className:Kt.btnPrimary,"data-testid":"task-header-start",children:"Retry"}),i.jsx("button",{onClick:p,className:Kt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}const BB="_workpadSection_y8nj9_1",LB="_workpadLabel_y8nj9_9",zB="_workpadStatus_y8nj9_17",$B="_workpadSummary_y8nj9_23",UB="_workpadExtra_y8nj9_29",La={workpadSection:BB,workpadLabel:LB,workpadStatus:zB,workpadSummary:$B,workpadExtra:UB};function PB({workpad:t}){if(!t)return;let s;try{const o=JSON.parse(t);if(o==null||typeof o!="object"||Array.isArray(o))return;s=o}catch{return i.jsxs("div",{className:La.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:La.workpadLabel,children:"Workpad"}),i.jsx("div",{className:La.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return i.jsxs("div",{className:La.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:La.workpadLabel,children:"Workpad"}),s.status&&i.jsx("div",{className:La.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&i.jsx("div",{className:La.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&i.jsx("div",{className:La.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const HB="_overviewDashboard_r05qm_1",VB="_overviewHero_r05qm_7",qB="_statusBadge_r05qm_14",GB="_statusPending_r05qm_26",FB="_statusAssigned_r05qm_31",ZB="_statusInProgress_r05qm_36",KB="_statusReview_r05qm_41",YB="_statusDone_r05qm_46",JB="_statusFailed_r05qm_51",WB="_statusWaitingInput_r05qm_56",XB="_overviewBranchPill_r05qm_61",QB="_branchLink_r05qm_76",eL="_overviewSection_r05qm_87",tL="_overviewLabel_r05qm_93",nL="_overviewValue_r05qm_100",sL="_overviewMuted_r05qm_105",aL="_overviewMarkdown_r05qm_111",iL="_envRow_r05qm_180",oL="_envDot_r05qm_186",rL="_envDotGreen_r05qm_193",lL="_envDotYellow_r05qm_197",cL="_envDotRed_r05qm_201",dL="_envDotGray_r05qm_205",uL="_depList_r05qm_209",fL="_depItem_r05qm_215",pL="_depBlocked_r05qm_222",mL="_depDone_r05qm_226",hL="_timeline_r05qm_230",gL="_timelineRow_r05qm_236",vL="_timelineKey_r05qm_243",yL="_timelineValue_r05qm_249",bL="_timelineDelta_r05qm_253",xL="_reviewNotes_r05qm_264",ve={overviewDashboard:HB,overviewHero:VB,statusBadge:qB,statusPending:GB,statusAssigned:FB,statusInProgress:ZB,statusReview:KB,statusDone:YB,statusFailed:JB,statusWaitingInput:WB,overviewBranchPill:XB,branchLink:QB,overviewSection:eL,overviewLabel:tL,overviewValue:nL,overviewMuted:sL,overviewMarkdown:aL,envRow:iL,envDot:oL,envDotGreen:rL,envDotYellow:lL,envDotRed:cL,envDotGray:dL,depList:uL,depItem:fL,depBlocked:pL,depDone:mL,timeline:hL,timelineRow:gL,timelineKey:vL,timelineValue:yL,timelineDelta:bL,reviewNotes:xL};function Fc(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 Ep(t,s){if(!t||!s)return;const o=new Date(s).getTime()-new Date(t).getTime();if(isNaN(o)||o<0)return;const r=Math.floor(o/6e4),c=Math.floor(o%6e4/1e3);if(r===0)return`${c}s`;const d=Math.floor(r/60),u=r%60;return d===0?`${r}m ${c}s`:`${d}h ${u}m`}function nx(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?ve.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?ve.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?ve.envDotRed:ve.envDotGray}function _L({status:t}){const s=qa(t),o=xj(t);return i.jsx("span",{className:`${ve.statusBadge} ${ve[o]??ve.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function kL({task:t,tasksById:s,environments:o,workspaces:r,taskSessions:c,selectedEnvId:d,taskUsage:u,treeUsage:p}){const m=c.length>0?c[c.length-1]:void 0,g=(m==null?void 0:m.environmentId)??"",v=g?o.find(k=>k.id===g):void 0,b=r.find(k=>k.id===t.workspaceId),y=o.find(k=>k.id===d),S=t.branch&&(b!=null&&b.repoUrl)?`${b.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return i.jsxs("div",{className:ve.overviewDashboard,"data-testid":"task-overview-panel",children:[i.jsxs("div",{className:ve.overviewHero,children:[i.jsx(_L,{status:t.status}),t.branch&&i.jsx("span",{className:ve.overviewBranchPill,"data-testid":"task-overview-branch",children:S?i.jsxs("a",{href:S,target:"_blank",rel:"noreferrer noopener",className:ve.branchLink,children:["🔗"," ",t.branch]}):i.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-description",children:[i.jsx("div",{className:ve.overviewLabel,children:"Description"}),i.jsx("div",{className:ve.overviewMarkdown,children:i.jsx(Td,{remarkPlugins:[jd],children:t.description})})]}),t.workpad&&i.jsx(PB,{workpad:t.workpad}),i.jsxs("div",{className:ve.overviewSection,children:[i.jsx("div",{className:ve.overviewLabel,children:"Environment"}),g&&v?i.jsxs("div",{className:ve.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${ve.envDot} ${nx(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),i.jsx("span",{className:ve.overviewValue,children:v.displayName})]}):y?i.jsxs("div",{className:ve.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${ve.envDot} ${nx(y.status)}`,title:y.status,"aria-label":`Status: ${y.status}`,role:"img"}),i.jsx("span",{className:ve.overviewValue,children:y.displayName}),i.jsx("span",{className:ve.overviewMuted,children:"(workspace default)"})]}):i.jsx("div",{className:ve.overviewMuted,children:"Set in workspace settings"})]}),i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-dependencies",children:[i.jsx("div",{className:ve.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?i.jsx("div",{className:ve.overviewMuted,children:"None"}):i.jsx("div",{className:ve.depList,children:t.dependsOn.map(k=>{const j=s.get(k),N=(j==null?void 0:j.status)==="complete";return i.jsxs("div",{className:`${ve.depItem} ${N?ve.depDone:ve.depBlocked}`,children:[i.jsx("span",{children:N?"✓":"○"}),i.jsx("span",{children:(j==null?void 0:j.title)??k})]},k)})})]}),i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-timeline",children:[i.jsx("div",{className:ve.overviewLabel,children:"Timeline"}),i.jsxs("div",{className:ve.timeline,children:[t.createdAt&&i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Created"}),i.jsx("span",{className:ve.timelineValue,children:Fc(t.createdAt)})]}),t.assignedAt&&(()=>{const k=Ep(t.createdAt,t.assignedAt);return i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Assigned"}),i.jsx("span",{className:ve.timelineValue,children:Fc(t.assignedAt)}),k!==void 0&&i.jsx("span",{className:ve.timelineDelta,children:k})]})})(),t.startedAt&&(()=>{const k=Ep(t.assignedAt??t.createdAt,t.startedAt);return i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Started"}),i.jsx("span",{className:ve.timelineValue,children:Fc(t.startedAt)}),k!==void 0&&i.jsx("span",{className:ve.timelineDelta,children:k})]})})(),t.completedAt&&(()=>{const k=Ep(t.startedAt,t.completedAt);return i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Completed"}),i.jsx("span",{className:ve.timelineValue,children:Fc(t.completedAt)}),k!==void 0&&i.jsx("span",{className:ve.timelineDelta,children:k})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&i.jsx("div",{className:ve.overviewMuted,children:"No timing data"})]})]}),u&&u.costMillicents>0&&i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-usage",children:[i.jsx("div",{className:ve.overviewLabel,children:"Usage"}),i.jsxs("div",{className:ve.timeline,children:[i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Cost"}),i.jsx("span",{className:ve.timelineValue,children:Ns(u.costMillicents)}),i.jsxs("span",{className:ve.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),p&&p.costMillicents>u.costMillicents&&i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Total (incl. subtasks)"}),i.jsx("span",{className:ve.timelineValue,children:Ns(p.costMillicents)}),i.jsxs("span",{className:ve.timelineDelta,children:[p.sessionCount," session",p.sessionCount!==1?"s":""]})]})]})]}),(t.tokenBudget>0||t.costBudgetMillicents>0)&&i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-budget",children:[i.jsx("div",{className:ve.overviewLabel,children:"Budget"}),i.jsxs("div",{className:ve.timeline,children:[t.tokenBudget>0&&i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Tokens"}),i.jsxs("span",{className:ve.timelineValue,children:[Oo(((u==null?void 0:u.inputTokens)??0)+((u==null?void 0:u.outputTokens)??0))," / ",Oo(t.tokenBudget)]})]}),t.costBudgetMillicents>0&&i.jsxs("div",{className:ve.timelineRow,children:[i.jsx("span",{className:ve.timelineKey,children:"Cost"}),i.jsxs("span",{className:ve.timelineValue,children:[Ns((u==null?void 0:u.costMillicents)??0)," / ",Ns(t.costBudgetMillicents)]})]})]})]}),t.reviewNotes&&i.jsxs("div",{className:ve.overviewSection,"data-testid":"task-overview-review-notes",children:[i.jsx("div",{className:ve.overviewLabel,children:"Review Notes"}),i.jsx("div",{className:ve.reviewNotes,children:t.reviewNotes})]})]})}const SL="_container_legrg_1",TL="_header_legrg_8",jL="_headerTitle_legrg_35",wL="_badge_legrg_44",NL="_headerActions_legrg_54",CL="_body_legrg_61",EL="_formContent_legrg_73",AL="_section_legrg_85",DL="_label_legrg_91",RL="_nameInput_legrg_98",ML="_fieldInput_legrg_131",IL="_adapterSelect_legrg_164",OL="_readOnlyValue_legrg_198",BL="_codespaceSection_legrg_204",LL="_codespaceActions_legrg_210",zL="_creatingHint_legrg_216",$L="_errorHint_legrg_222",UL="_btnPrimary_legrg_235",PL="_btnGhost_legrg_266",ce={container:SL,header:TL,headerTitle:jL,badge:wL,headerActions:NL,body:CL,formContent:EL,section:AL,label:DL,nameInput:RL,fieldInput:ML,adapterSelect:IL,readOnlyValue:OL,codespaceSection:BL,codespaceActions:LL,creatingHint:zL,errorHint:$L,btnPrimary:UL,btnGhost:PL},od=1,rd=65535;function Ap(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=od&&s<=rd}function Dp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function HL({codespaceName:t,onCodespaceNameChange:s,envName:o,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:m}){const[g,v]=x.useState("pick"),[b,y]=x.useState(""),[S,k]=x.useState("");return g==="create"?i.jsxs("div",{className:ce.codespaceSection,children:[i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Repository"}),i.jsx("input",{type:"text",value:b,onChange:j=>y(j.target.value),placeholder:"owner/repo",className:ce.fieldInput,"data-testid":"env-codespace-repo"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Machine Type"}),i.jsx("input",{type:"text",value:S,onChange:j=>k(j.target.value),placeholder:"Machine type (optional)...",className:ce.fieldInput,"data-testid":"env-codespace-machine"})]}),i.jsxs("div",{className:ce.codespaceActions,children:[i.jsx("button",{onClick:()=>{b.trim()&&(m(b.trim(),S.trim()||void 0),v("pick"),y(""),k(""))},disabled:!b.trim(),className:ce.btnPrimary,children:"Create"}),i.jsx("button",{onClick:()=>{v("pick"),y(""),k("")},className:ce.btnGhost,children:"Cancel"})]})]}):i.jsx("div",{className:ce.codespaceSection,children:i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Codespace"}),!u&&i.jsxs("select",{value:t,onChange:j=>{j.target.value==="__create__"?(v("create"),s("")):(s(j.target.value),j.target.value&&!o.trim()&&r(j.target.value))},disabled:p,className:ce.adapterSelect,"data-testid":"env-codespace-select",children:[i.jsx("option",{value:"",children:"Select a codespace..."}),c.map(j=>i.jsxs("option",{value:j.name,children:[j.name," (",j.repository,") — ",j.state]},j.name)),i.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&i.jsx("span",{className:ce.creatingHint,children:"Creating codespace..."}),u&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:ce.errorHint,children:u}),i.jsx("input",{type:"text",value:t,onChange:j=>s(j.target.value),placeholder:"Or enter codespace name manually...",className:ce.fieldInput,"data-testid":"env-codespace-manual"})]}),d&&!u&&i.jsx("span",{className:ce.errorHint,children:d})]})})}function q1({mode:t,environmentId:s,environments:o,onAddEnvironment:r,onUpdateEnvironment:c,onListCodespaces:d,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v,onShowToast:b}){const y=mt(),S=t==="edit",k=S&&s?o.find(ge=>ge.id===s):void 0,[j,N]=x.useState(""),[T,C]=x.useState("local"),[A,I]=x.useState(""),[E,D]=x.useState(""),[P,O]=x.useState(""),[z,Q]=x.useState(""),[$,J]=x.useState(""),[me,te]=x.useState(""),[X,B]=x.useState(""),[F,Z]=x.useState(null),de=x.useCallback(()=>{const ge={};if(T==="local"){if(A.trim()&&(ge.host=A.trim()),E.trim()){const Se=Number(E);Number.isInteger(Se)&&(ge.port=Se)}}else if(T==="ssh"){if(ge.host=A.trim(),P.trim()&&(ge.user=P.trim()),E.trim()){const Se=Number(E);Number.isInteger(Se)&&(ge.sshPort=Se)}z.trim()&&(ge.identityFile=z.trim())}else T==="docker"?($.trim()&&(ge.image=$.trim()),me.trim()&&(ge.repo=me.trim())):T==="codespace"&&(ge.codespaceName=X.trim());return ge},[T,A,E,P,z,$,me,X]),W=()=>!(!j.trim()||T==="ssh"&&!A.trim()||T==="codespace"&&!X.trim()||(T==="local"||T==="ssh")&&!Ap(E)),ee=()=>{W()&&(r(j.trim(),T,de()),b==null||b("Environment added successfully","success"),y(Io,{replace:!0}))},ue=()=>{y(s?Ai(s):Io)},Ce=x.useCallback((ge,Se)=>{if(!k||!s)return;const xe=Dp(k.adapterConfig),Be=Se.trim();Be?xe[ge]=Be:delete xe[ge],c(s,{adapterConfig:xe})},[k,s,c]),Pe=x.useCallback((ge,Se)=>{if(!k||!s)return;const xe=Dp(k.adapterConfig);if(Se.trim()){const Be=Number(Se);Number.isInteger(Be)&&Be>=od&&Be<=rd&&(xe[ge]=Be)}else delete xe[ge];c(s,{adapterConfig:xe})},[k,s,c]);if(S){if(!k)return i.jsxs("div",{className:ce.container,children:[i.jsxs("div",{className:ce.header,children:[i.jsx("div",{className:ce.headerTitle,children:i.jsx("span",{className:ce.badge,children:"edit environment"})}),i.jsx("div",{className:ce.headerActions,children:i.jsx("button",{onClick:ue,className:ce.btnGhost,children:"Back"})})]}),i.jsx("div",{className:ce.body,children:i.jsx("div",{className:ce.formContent,children:i.jsx("span",{className:ce.readOnlyValue,children:"Environment not found"})})})]});const ge=Dp(k.adapterConfig);return i.jsxs("div",{className:ce.container,"data-testid":"env-edit-panel",children:[i.jsxs("div",{className:ce.header,children:[i.jsx("div",{className:ce.headerTitle,children:i.jsx("span",{className:ce.badge,children:"edit environment"})}),i.jsx("div",{className:ce.headerActions,children:i.jsx("button",{onClick:ue,className:ce.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),i.jsx("div",{className:ce.body,children:i.jsxs("div",{className:ce.formContent,children:[i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Name"}),i.jsx(Ft,{value:k.displayName,onSave:Se=>{s&&c(s,{displayName:Se})},validate:Se=>Se.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:F,onActivate:Z,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Adapter Type"}),i.jsx("span",{className:ce.readOnlyValue,"data-testid":"env-edit-adapter-type",children:k.adapterType})]}),k.adapterType==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Host"}),i.jsx(Ft,{value:String(ge.host??""),onSave:Se=>Ce("host",Se),mode:"edit",fieldId:"host",activeFieldId:F,onActivate:Z,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Port"}),i.jsx(Ft,{value:String(ge.port??""),onSave:Se=>Pe("port",Se),validate:Se=>Ap(Se)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:F,onActivate:Z,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),k.adapterType==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Host"}),i.jsx(Ft,{value:String(ge.host??""),onSave:Se=>Ce("host",Se),validate:Se=>Se.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:F,onActivate:Z,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"User"}),i.jsx(Ft,{value:String(ge.user??""),onSave:Se=>Ce("user",Se),mode:"edit",fieldId:"user",activeFieldId:F,onActivate:Z,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"SSH Port"}),i.jsx(Ft,{value:String(ge.sshPort??""),onSave:Se=>Pe("sshPort",Se),validate:Se=>Ap(Se)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:F,onActivate:Z,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Identity File"}),i.jsx(Ft,{value:String(ge.identityFile??""),onSave:Se=>Ce("identityFile",Se),mode:"edit",fieldId:"identityFile",activeFieldId:F,onActivate:Z,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),k.adapterType==="docker"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Image"}),i.jsx(Ft,{value:String(ge.image??""),onSave:Se=>Ce("image",Se),mode:"edit",fieldId:"image",activeFieldId:F,onActivate:Z,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Repo"}),i.jsx(Ft,{value:String(ge.repo??""),onSave:Se=>Ce("repo",Se),mode:"edit",fieldId:"repo",activeFieldId:F,onActivate:Z,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),k.adapterType==="codespace"&&i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,children:"Codespace Name"}),i.jsx(Ft,{value:String(ge.codespaceName??""),onSave:Se=>Ce("codespaceName",Se),validate:Se=>Se.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:F,onActivate:Z,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return i.jsxs("div",{className:ce.container,"data-testid":"env-create-panel",children:[i.jsxs("div",{className:ce.header,children:[i.jsx("div",{className:ce.headerTitle,children:i.jsx("span",{className:ce.badge,children:"new environment"})}),i.jsxs("div",{className:ce.headerActions,children:[i.jsx("button",{onClick:ee,disabled:!W(),className:ce.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),i.jsx("button",{onClick:ue,className:ce.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:ce.body,children:i.jsxs("div",{className:ce.formContent,children:[i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,htmlFor:"env-create-name",children:"Name"}),i.jsx("input",{id:"env-create-name",type:"text",value:j,onChange:ge=>N(ge.target.value),placeholder:"Environment name...",autoFocus:!0,className:ce.nameInput,"data-testid":"env-create-name",onKeyDown:ge=>{ge.key==="Enter"&&W()&&ee()}})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),i.jsxs("select",{id:"env-create-adapter",value:T,onChange:ge=>{C(ge.target.value),ge.target.value==="codespace"&&d()},className:ce.adapterSelect,"data-testid":"env-create-adapter",children:[i.jsx("option",{value:"local",children:"local"}),i.jsx("option",{value:"ssh",children:"ssh"}),i.jsx("option",{value:"docker",children:"docker"}),i.jsx("option",{value:"codespace",children:"codespace"})]})]}),T==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:A,onChange:ge=>I(ge.target.value),placeholder:"Host (optional)...",className:ce.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,htmlFor:"env-create-port",children:"Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:od,max:rd,value:E,onChange:ge=>D(ge.target.value),placeholder:"Port (optional)...",className:ce.fieldInput,"data-testid":"env-create-port"})]})]}),T==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:A,onChange:ge=>I(ge.target.value),placeholder:"Host (required)...",className:ce.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,htmlFor:"env-create-user",children:"User"}),i.jsx("input",{id:"env-create-user",type:"text",value:P,onChange:ge=>O(ge.target.value),placeholder:"User (optional)...",className:ce.fieldInput,"data-testid":"env-create-user"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,htmlFor:"env-create-port",children:"SSH Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:od,max:rd,value:E,onChange:ge=>D(ge.target.value),placeholder:"SSH port (optional)...",className:ce.fieldInput,"data-testid":"env-create-port"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,htmlFor:"env-create-identity",children:"Identity File"}),i.jsx("input",{id:"env-create-identity",type:"text",value:z,onChange:ge=>Q(ge.target.value),placeholder:"Identity file (optional)...",className:ce.fieldInput,"data-testid":"env-create-identity"})]})]}),T==="docker"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,htmlFor:"env-create-image",children:"Image"}),i.jsx("input",{id:"env-create-image",type:"text",value:$,onChange:ge=>J(ge.target.value),placeholder:"Image (optional)...",className:ce.fieldInput,"data-testid":"env-create-image"})]}),i.jsxs("div",{className:ce.section,children:[i.jsx("label",{className:ce.label,htmlFor:"env-create-repo",children:"Repo"}),i.jsx("input",{id:"env-create-repo",type:"text",value:me,onChange:ge=>te(ge.target.value),placeholder:"Repo (optional)...",className:ce.fieldInput,"data-testid":"env-create-repo"})]})]}),T==="codespace"&&i.jsx(HL,{codespaceName:X,onCodespaceNameChange:B,envName:j,onEnvNameChange:N,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v})]})})]})}const VL="_group_1iprv_1",qL="_groupTitle_1iprv_8",GL="_shortcutList_1iprv_17",FL="_shortcutRow_1iprv_23",ZL="_keys_1iprv_36",KL="_kbd_1iprv_43",YL="_description_1iprv_60",Si={group:VL,groupTitle:qL,shortcutList:GL,shortcutRow:FL,keys:ZL,kbd:KL,description:YL},JL=[{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 WL(){return i.jsxs("section",{className:ye.section,"data-testid":"keyboard-shortcuts-panel",children:[i.jsx("h3",{className:ye.sectionTitle,children:"Keyboard Shortcuts"}),i.jsx("p",{className:ye.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),JL.map(t=>i.jsxs("div",{className:Si.group,children:[i.jsx("h4",{className:Si.groupTitle,children:t.title}),i.jsx("div",{className:Si.shortcutList,children:t.shortcuts.map(s=>i.jsxs("div",{className:Si.shortcutRow,children:[i.jsx("span",{className:Si.keys,children:s.keys.map(o=>i.jsx("kbd",{className:Si.kbd,children:o},o))}),i.jsx("span",{className:Si.description,children:s.description})]},s.description))})]},t.title))]})}const XL=[{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 QL({credentialProviders:t,onUpdateCredentialProviders:s}){const o=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return i.jsxs("section",{className:ye.section,children:[i.jsx("h3",{className:ye.sectionTitle,children:"Credential Providers"}),i.jsx("p",{className:ye.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),i.jsx("div",{className:ye.tokenList,children:XL.map(r=>i.jsxs("div",{className:ye.tokenRow,children:[i.jsx("span",{className:ye.tokenName,children:r.label}),i.jsx("span",{className:ye.tokenTarget,children:r.description}),i.jsx("select",{className:ye.select,value:t[r.key],onChange:c=>o(r.key,c.target.value),children:r.options.map(c=>i.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const e8="_container_10efq_1",t8="_header_10efq_7",n8="_list_10efq_105",s8="_card_10efq_111",a8="_cardHeader_10efq_125",i8="_cardTitle_10efq_135",o8="_defaultBadge_10efq_141",r8="_cardActions_10efq_155",l8="_description_10efq_160",c8="_meta_10efq_166",d8="_empty_10efq_212",u8="_typeBadge_10efq_362",Xn={container:e8,header:t8,list:n8,card:s8,cardHeader:a8,cardTitle:i8,defaultBadge:o8,cardActions:r8,description:l8,meta:c8,empty:d8,typeBadge:u8};function f8({personas:t,appDefaultPersonaId:s,onDeletePersona:o,onSetAppDefaultPersonaId:r,onNavigateToNew:c,onNavigateToPersona:d}){const[u,p]=x.useState(null),m=u?t.find(v=>v.id===u):void 0,g=async v=>{await o(v),p(null)};return i.jsxs("div",{className:Xn.container,children:[i.jsxs("div",{className:Xn.header,children:[i.jsx("h2",{children:"Personas"}),i.jsx(tn,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?i.jsx("p",{className:Xn.empty,children:"No personas yet. Create one to get started."}):i.jsx("div",{className:Xn.list,children:t.map(v=>{const b=s===v.id,y=v.type==="script";return i.jsxs("div",{className:Xn.card,"data-testid":`persona-card-${v.id}`,onClick:()=>d(v.id),role:"button",tabIndex:0,onKeyDown:S=>{S.currentTarget===S.target&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),d(v.id))},children:[i.jsxs("div",{className:Xn.cardHeader,children:[i.jsxs("span",{className:Xn.cardTitle,children:[i.jsx("strong",{children:v.name}),i.jsx("span",{className:Xn.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:y?"Script":"Agent"}),b&&i.jsx("span",{className:Xn.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),i.jsxs("div",{className:Xn.cardActions,onClick:S=>S.stopPropagation(),children:[!b&&i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>{r(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&i.jsx("p",{className:Xn.description,children:v.description}),i.jsxs("div",{className:Xn.meta,children:[v.runtime&&i.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&i.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&i.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),i.jsx(ia,{isOpen:u!==null,title:"Delete Persona?",description:`"${(m==null?void 0:m.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>p(null)})]})}const p8="_container_uy08i_1",m8="_header_uy08i_7",h8="_count_uy08i_13",g8="_presets_uy08i_18",v8="_presetButton_uy08i_24",y8="_filterInput_uy08i_41",b8="_groups_uy08i_53",x8="_group_uy08i_53",_8="_groupHeader_uy08i_68",k8="_groupName_uy08i_77",S8="_groupCount_uy08i_81",T8="_toolList_uy08i_87",j8="_toolItem_uy08i_95",w8="_toolName_uy08i_103",gn={container:p8,header:m8,count:h8,presets:g8,presetButton:v8,filterInput:y8,groups:b8,group:x8,groupHeader:_8,groupName:k8,groupCount:S8,toolList:T8,toolItem:j8,toolName:w8},N8=(()=>{const t=new Map;for(const s of kx){const o=s==="get_version_status"?"version":s.split("_")[0];t.has(o)||t.set(o,[]),t.get(o).push(s)}return[...t.entries()].sort(([s],[o])=>s.localeCompare(o)).map(([s,o])=>({group:s,tools:o.sort()}))})(),C8=[{name:"default",label:"Default",tools:Sx},{name:"worker",label:"Worker",tools:RT},{name:"orchestrator",label:"Orchestrator",tools:MT},{name:"admin",label:"Admin",tools:IT}];function sx({selectedTools:t,onChange:s,disabled:o}){const[r,c]=x.useState(""),d=x.useMemo(()=>new Set(t),[t]),u=x.useCallback(v=>{if(o)return;const b=new Set(d);b.has(v)?b.delete(v):b.add(v),s([...b].sort())},[d,s,o]),p=x.useCallback((v,b)=>{if(o)return;const y=new Set(d);for(const S of v)b?y.delete(S):y.add(S);s([...y].sort())},[d,s,o]),m=x.useCallback(v=>{o||s([...v].sort())},[s,o]),g=r.toLowerCase();return i.jsxs("div",{className:gn.container,"data-testid":"mcp-tool-selector",children:[i.jsx("div",{className:gn.header,children:i.jsx("span",{className:gn.count,children:t.length===0?`Using default (${Sx.length} tools)`:`${t.length} of ${kx.size} tools selected`})}),i.jsxs("div",{className:gn.presets,"data-testid":"mcp-tool-presets",children:[C8.map(v=>i.jsx("button",{type:"button",className:gn.presetButton,disabled:o,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),i.jsx("button",{type:"button",className:gn.presetButton,disabled:o,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),i.jsx("input",{type:"text",className:gn.filterInput,placeholder:"Filter tools...",value:r,onChange:v=>c(v.target.value),disabled:o,"data-testid":"mcp-tool-filter"}),i.jsx("div",{className:gn.groups,children:N8.map(({group:v,tools:b})=>{const y=g?b.filter(k=>k.toLowerCase().includes(g)):b;if(y.length===0)return null;const S=y.every(k=>d.has(k));return i.jsxs("div",{className:gn.group,"data-testid":`tool-group-${v}`,children:[i.jsxs("label",{className:gn.groupHeader,children:[i.jsx("input",{type:"checkbox",checked:S,onChange:()=>p(y,S),disabled:o,"data-testid":`group-toggle-${v}`}),i.jsx("span",{className:gn.groupName,children:v}),i.jsxs("span",{className:gn.groupCount,children:["(",y.filter(k=>d.has(k)).length,"/",y.length,")"]})]}),i.jsx("div",{className:gn.toolList,children:y.map(k=>i.jsxs("label",{className:gn.toolItem,children:[i.jsx("input",{type:"checkbox",checked:d.has(k),onChange:()=>u(k),disabled:o,"data-testid":`tool-${k}`}),i.jsx("span",{className:gn.toolName,children:k})]},k))})]},v)})})]})}const E8="_container_1gfuq_1",A8="_header_1gfuq_7",D8="_list_1gfuq_19",R8="_card_1gfuq_25",M8="_cardHeader_1gfuq_40",I8="_cardTitle_1gfuq_46",O8="_statusBadge_1gfuq_56",B8="_enabled_1gfuq_68",L8="_disabled_1gfuq_71",z8="_cardActions_1gfuq_75",$8="_cardMeta_1gfuq_80",U8="_empty_1gfuq_98",Qn={container:E8,header:A8,list:D8,card:R8,cardHeader:M8,cardTitle:I8,statusBadge:O8,enabled:B8,disabled:L8,cardActions:z8,cardMeta:$8,empty:U8};function P8({schedules:t,personas:s,onDeleteSchedule:o,onToggleEnabled:r,onNavigateToNew:c,onNavigateToSchedule:d}){const[u,p]=x.useState(null),m=u?t.find(y=>y.id===u):void 0,g=async y=>{await o(y),p(null)},v=x.useMemo(()=>{const y=new Map;for(const S of s)y.set(S.id,S.name);return y},[s]),b=y=>v.get(y)??y;return i.jsxs("div",{className:Qn.container,children:[i.jsxs("div",{className:Qn.header,children:[i.jsx("h2",{children:"Schedules"}),i.jsx(tn,{variant:"primary",size:"md",onClick:c,"data-testid":"schedule-new-button",children:"+ New Schedule"})]}),t.length===0?i.jsx("p",{className:Qn.empty,"data-testid":"schedule-empty-state",children:"No schedules yet. Create one to run tasks on a recurring cadence."}):i.jsx("div",{className:Qn.list,children:t.map(y=>i.jsxs("div",{className:Qn.card,"data-testid":`schedule-card-${y.id}`,onClick:()=>d(y.id),role:"button",tabIndex:0,onKeyDown:S=>{S.currentTarget===S.target&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),d(y.id))},children:[i.jsxs("div",{className:Qn.cardHeader,children:[i.jsxs("span",{className:Qn.cardTitle,children:[i.jsx("strong",{children:y.title}),i.jsx("span",{className:`${Qn.statusBadge} ${y.enabled?Qn.enabled:Qn.disabled}`,"data-testid":`schedule-status-badge-${y.id}`,children:y.enabled?"Enabled":"Disabled"})]}),i.jsxs("div",{className:Qn.cardActions,onClick:S=>S.stopPropagation(),children:[i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>{(async()=>{await r(y.id,{enabled:!y.enabled})})().catch(()=>{})},"data-testid":`schedule-toggle-${y.id}`,title:y.enabled?"Disable schedule":"Enable schedule",children:y.enabled?"Disable":"Enable"}),i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>d(y.id),"data-testid":`schedule-edit-${y.id}`,children:"Edit"}),i.jsx(tn,{variant:"ghost",size:"sm",onClick:()=>p(y.id),"data-testid":`schedule-delete-${y.id}`,children:"Delete"})]})]}),i.jsxs("div",{className:Qn.cardMeta,children:[i.jsx("span",{"data-testid":`schedule-expression-${y.id}`,children:y.scheduleExpression}),y.personaId&&i.jsxs("span",{"data-testid":`schedule-persona-${y.id}`,children:["Persona: ",b(y.personaId)]}),i.jsxs("span",{"data-testid":`schedule-last-run-${y.id}`,children:["Last run: ",y.lastRunAt?Po(y.lastRunAt):"Never"]}),y.enabled&&y.nextRunAt?i.jsxs("span",{"data-testid":`schedule-next-run-${y.id}`,children:["Next run: ",B1(y.nextRunAt)]}):null,y.runCount>0&&i.jsxs("span",{"data-testid":`schedule-run-count-${y.id}`,children:["Runs: ",y.runCount]})]})]},y.id))}),i.jsx(ia,{isOpen:u!==null,title:"Delete Schedule?",description:`"${(m==null?void 0:m.title)??""}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>p(null)})]})}const H8="_nav_1bhou_1",V8="_tab_1bhou_24",q8="_tabIcon_1bhou_62",G8="_tabActive_1bhou_68",Zc={nav:H8,tab:V8,tabIcon:q8,tabActive:G8},Xs=[{path:"credentials",label:"Credentials",icon:i.jsx(V2,{size:Rt})},{path:"personas",label:"Personas",icon:i.jsx(vj,{size:Rt})},{path:"schedules",label:"Schedules",icon:i.jsx(_2,{size:Rt})},{path:"appearance",label:"Appearance",icon:i.jsx(ij,{size:Rt})},{path:"shortcuts",label:"Shortcuts",icon:i.jsx(G2,{size:Rt})},{path:"about",label:"About",icon:i.jsx(vm,{size:Rt})}];function F8(){var u;const t=Yt(),s=mt(),o=x.useRef(null),r=((u=Xs.find(p=>{const m=`${Ni}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??Xs[0].path,c=x.useCallback(p=>{s(`${Ni}/${p}`)},[s]),d=x.useCallback(p=>{var S,k;const m=(S=o.current)==null?void 0:S.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(j=>j===document.activeElement),v=g>=0?g:Xs.findIndex(j=>j.path===r);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%Xs.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+Xs.length)%Xs.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=Xs.length-1;else return;const y=Xs[b].path;s(`${Ni}/${y}`),(k=m[b])==null||k.focus()},[r,s]);return i.jsx("nav",{className:Zc.nav,ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:Xs.map(p=>{const m=p.path===r;return i.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Zc.tab} ${m?Zc.tabActive:""}`,onClick:()=>c(p.path),children:[i.jsx("span",{className:Zc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function Z8({tasks:t,taskStatusById:s,sessionStatusByTaskId:o}){const r=new Map;for(const d of t)if(d.parentTaskId){const u=r.get(d.parentTaskId);u?u.push(d):r.set(d.parentTaskId,[d])}const c=new Map(xy.map(d=>[d,[]]));for(const d of t){const u=pl(d.status),p=d.dependsOn.length>0&&d.dependsOn.some(k=>s.get(k)!=="complete"),m=r.get(d.id)??[],g=m.length,v=m.filter(k=>k.status==="complete").length;let b;if(u==="paused"&&o){const k=o.get(d.id);k==="idle"?b="Needs input":k==="completed"&&(b="Ready to complete")}const y={task:d,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:b},S=c.get(u);S?S.push(y):c.get("not_started").push(y)}for(const d of c.values())d.sort((u,p)=>u.task.sortOrder-p.task.sortOrder);return xy.map(d=>{const u=qa(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const K8="_boardContainer_1c4y1_1",Y8="_column_1c4y1_17",J8="_columnHeader_1c4y1_34",W8="_columnIcon_1c4y1_47",X8="_columnLabel_1c4y1_52",Q8="_columnCount_1c4y1_57",e7="_cardList_1c4y1_67",t7="_emptyPlaceholder_1c4y1_76",n7="_card_1c4y1_67",s7="_cardHeader_1c4y1_107",a7="_cardStatusIcon_1c4y1_113",i7="_cardTitle_1c4y1_119",o7="_cardBadges_1c4y1_127",r7="_badge_1c4y1_134",l7="_blockedBadge_1c4y1_146",c7="_childBadge_1c4y1_151",d7="_depBadge_1c4y1_155",u7="_parentBadge_1c4y1_159",f7="_pausedSubBadge_1c4y1_166",p7="_personaBadge_1c4y1_170",m7="_envBadge_1c4y1_174",h7="_emptyCta_1c4y1_178",g7="_ctaButton_1c4y1_188",v7="_ctaDescription_1c4y1_204",it={boardContainer:K8,column:Y8,columnHeader:J8,columnIcon:W8,columnLabel:X8,columnCount:Q8,cardList:e7,emptyPlaceholder:t7,card:n7,cardHeader:s7,cardStatusIcon:a7,cardTitle:i7,cardBadges:o7,badge:r7,blockedBadge:l7,childBadge:c7,depBadge:d7,parentBadge:u7,pausedSubBadge:f7,personaBadge:p7,envBadge:m7,emptyCta:h7,ctaButton:g7,ctaDescription:v7};function y7({workspaceId:t,environmentId:s,tasks:o,sessions:r,personas:c,environments:d}){const u=mt(),p=x.useMemo(()=>o.filter(y=>y.workspaceId===t),[o,t]),m=x.useMemo(()=>new Map(o.map(y=>[y.id,y.status])),[o]),g=x.useMemo(()=>new Map(p.map(y=>[y.id,y])),[p]),v=x.useMemo(()=>{const y=new Map(r.map(C=>[C.id,C])),S=new Map(c.map(C=>[C.id,C])),k=new Map(d.map(C=>[C.id,C])),j=new Map,N=new Map,T=new Map;for(const C of p)if(C.latestSessionId){const A=y.get(C.latestSessionId);if(A){if(j.set(C.id,A.endReason||A.status),A.personaId){const I=S.get(A.personaId);I&&N.set(C.id,I.name)}if(A.environmentId){const I=k.get(A.environmentId);I&&T.set(C.id,I.displayName)}}}return{sessionStatusByTaskId:j,personaNameByTaskId:N,environmentNameByTaskId:T}},[p,r,c,d]),b=x.useMemo(()=>Z8({tasks:p,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,m,v]);return p.length===0?i.jsxs("div",{className:it.emptyCta,"data-testid":"board-empty-cta",children:[i.jsx("button",{className:it.ctaButton,onClick:()=>u(Ii(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:it.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):i.jsx("div",{className:it.boardContainer,"data-testid":"board-container",children:b.map(y=>i.jsxs("section",{className:it.column,"data-testid":`board-column-${y.status}`,"aria-label":`${y.label}, ${y.tasks.length} ${y.tasks.length===1?"task":"tasks"}`,children:[i.jsxs("div",{className:it.columnHeader,children:[i.jsx("span",{className:it.columnIcon,style:{color:y.style.color},children:y.style.icon}),i.jsx("span",{className:it.columnLabel,children:y.label}),i.jsx("span",{className:it.columnCount,"data-testid":`board-count-${y.status}`,children:y.tasks.length})]}),i.jsx("div",{className:it.cardList,children:y.tasks.length===0?i.jsx("div",{className:it.emptyPlaceholder,children:"No tasks"}):i.jsx(gs,{mode:"popLayout",children:y.tasks.map(S=>i.jsx(Mt.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:i.jsx(b7,{boardTask:S,tasksById:g,personaName:v.personaNameByTaskId.get(S.task.id),envName:v.environmentNameByTaskId.get(S.task.id),onClick:()=>u(On(S.task.id,void 0,t,s))})},S.task.id))})})]},y.status))})}function b7({boardTask:t,tasksById:s,personaName:o,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:m,pausedSubBadge:g}=t,v=qa(d.status),b=d.parentTaskId?s.get(d.parentTaskId):void 0;return i.jsxs("div",{className:it.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),c())},children:[i.jsxs("div",{className:it.cardHeader,children:[i.jsx("span",{className:it.cardStatusIcon,style:{color:v.color},children:v.icon}),i.jsx("span",{className:it.cardTitle,children:d.title})]}),i.jsxs("div",{className:it.cardBadges,children:[b&&i.jsx("span",{className:`${it.badge} ${it.parentBadge}`,title:b.title,children:b.title}),p>0&&i.jsxs("span",{className:`${it.badge} ${it.childBadge}`,children:[m,"/",p]}),u&&i.jsx("span",{className:`${it.badge} ${it.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&i.jsx("span",{className:`${it.badge} ${it.depBadge}`,children:"dep"}),g&&i.jsx("span",{className:`${it.badge} ${it.pausedSubBadge}`,children:g}),o&&i.jsx("span",{className:`${it.badge} ${it.personaBadge}`,children:o}),r&&i.jsx("span",{className:`${it.badge} ${it.envBadge}`,children:r})]})]})}const x7="_formContent_ymnez_1",_7="_section_ymnez_13",k7="_label_ymnez_19",S7="_titleInput_ymnez_26",T7="_descriptionTextarea_ymnez_58",j7="_selectField_ymnez_94",w7="_checkboxRow_ymnez_128",N7="_checkboxLabel_ymnez_141",C7="_fieldError_ymnez_146",xt={formContent:x7,section:_7,label:k7,titleInput:S7,descriptionTextarea:T7,selectField:j7,checkboxRow:w7,checkboxLabel:N7,fieldError:C7};function E7(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 A7=100;function D7({values:t,onChange:s,environments:o,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(m,g)=>{s({...t,[m]:g})};return i.jsxs("div",{className:xt.formContent,children:[i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-name",children:"Name"}),i.jsx("input",{id:"ws-name",className:xt.titleInput,type:"text",value:t.name,onChange:m=>p("name",m.target.value),placeholder:"Workspace name",maxLength:A7,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-description",children:"Description"}),i.jsx("textarea",{id:"ws-description",className:xt.descriptionTextarea,value:t.description,onChange:m=>p("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-repo",children:"Repository URL"}),i.jsx("input",{id:"ws-repo",className:xt.titleInput,type:"text",value:t.repoUrl,onChange:m=>p("repoUrl",m.target.value),placeholder:"https://github.com/org/repo",disabled:d,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-environment",children:"Environment"}),i.jsxs("select",{id:"ws-environment",className:xt.selectField,value:t.environmentId,onChange:m=>p("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[i.jsx("option",{value:"",children:"Select environment…"}),o.map(m=>i.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-persona",children:"Default Persona"}),i.jsxs("select",{id:"ws-persona",className:xt.selectField,value:t.defaultPersonaId,onChange:m=>p("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>i.jsx("option",{value:m.id,children:m.name},m.id))]})]}),i.jsx("div",{className:xt.section,children:i.jsxs("label",{className:xt.checkboxRow,children:[i.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>p("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),i.jsx("span",{className:xt.checkboxLabel,children:"Enable worktree isolation"})]})}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-workdir",children:"Working Directory"}),i.jsx("input",{id:"ws-workdir",className:xt.titleInput,type:"text",value:t.workingDirectory,onChange:m=>p("workingDirectory",m.target.value),placeholder:"Default (server default)",disabled:d,"data-testid":"workspace-form-workdir"})]})]})}const G1=x.createContext(void 0),R7=4e3;function M7({children:t}){const[s,o]=x.useState([]),r=x.useRef(0),c=x.useCallback(u=>{o(p=>p.filter(m=>m.id!==u))},[]),d=x.useCallback((u,p="info",m=R7)=>{const g=`toast-${++r.current}`;o(v=>[...v,{id:g,message:u,variant:p,duration:m}])},[]);return i.jsx(G1.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function pn(){const t=x.useContext(G1);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const fm="grackle-theme",F1="grackle-prefer-system",Z1="(prefers-color-scheme: dark)";let Jr=[],ld;function Rp(){ld=void 0;for(const t of Jr)t()}function pm(){return typeof window>"u"?!1:window.matchMedia(Z1).matches}function nl(){if(typeof localStorage>"u")return tx;try{const t=localStorage.getItem(fm);if(t!==null&&H1.has(t))return t}catch{}return tx}function _d(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(F1)==="true"}catch{return!1}}function mm(t){return zd.find(s=>s.variantLightId===t||s.variantDarkId===t)}function K1(t,s){const o=um(t);if(o!=null&&o.variantDarkId)return s&&o.variantLightId?pm()?o.variantDarkId:o.variantLightId:o.variantDarkId;if(o!=null&&o.hidden&&s){const r=mm(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return pm()?r.variantDarkId:r.variantLightId}return t}function No(t,s,o=!1){o&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=K1(t,s),o&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&No(nl(),_d());function I7(){return ld===void 0&&(ld={themeId:nl(),systemDark:pm(),preferSystem:_d()}),ld}function O7(t){return Jr=[...Jr,t],()=>{Jr=Jr.filter(s=>s!==t)}}function B7(){const t=x.useSyncExternalStore(O7,I7),{themeId:s,preferSystem:o}=t,r=K1(s,o),c=x.useCallback(u=>{if(H1.has(u)){try{localStorage.setItem(fm,u)}catch{}No(u,_d(),!0),Rp()}},[]),d=x.useCallback(u=>{try{localStorage.setItem(F1,u?"true":"false")}catch{}if(u){const p=nl(),m=um(p);if(m!=null&&m.hidden){const g=mm(p);if(g)try{localStorage.setItem(fm,g.id)}catch{}}}No(nl(),u,!0),Rp()},[]);return x.useEffect(()=>{No(s,o)},[s,o]),x.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(Z1),p=()=>{const m=nl(),g=_d();if(g){const v=um(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&No(m,g),v!=null&&v.hidden){const b=mm(m);b!=null&&b.variantDarkId&&b.variantLightId&&No(m,g)}}Rp()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:o,setPreferSystem:d}}const Y1=x.createContext(void 0);function L7({children:t}){const s=B7();return i.jsx(Y1.Provider,{value:s,children:t})}function J1(){const t=x.useContext(Y1);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const W1=x.createContext(void 0),X1=x.createContext(void 0);function z7({children:t}){const[s,o]=x.useState(void 0),r=x.useCallback(c=>{o(c)},[]);return i.jsx(X1.Provider,{value:r,children:i.jsx(W1.Provider,{value:s,children:t})})}function $7(){return x.useContext(W1)}function U7(){const t=x.useContext(X1);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const fh=x.createContext(void 0);function dt(){const t=x.useContext(fh);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function Q1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ek(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function P7(t){return Q1(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 H7=new Set(["off","subscription","api_key"]),Kc=new Set(["off","on"]);function V7(t){return Q1(t)&&H7.has(t.claude)&&Kc.has(t.github)&&Kc.has(t.copilot)&&Kc.has(t.codex)&&Kc.has(t.goose)}function tk(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 nk(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 wo=5e3;function q7(t,s){const o=[];let r=t;const c=new Set;for(;r&&s.has(r)&&!c.has(r);){c.add(r);const d=s.get(r);o.unshift(d),r=d.parentTaskId||void 0}return o}const oa={label:"Home",url:Di};function G7(t){return t?[oa,{label:"Settings",url:Ni},{label:t,url:void 0}]:[oa,{label:"Settings",url:void 0}]}const ph={label:"Environments",url:Io};function F7(){return[oa,{label:"Environments",url:void 0}]}function Z7(){return[oa,{label:"New Chat",url:void 0}]}function K7(t){return[oa,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function Y7(t,s,o,r){const c=o.find(u=>u.id===t),d=r.find(u=>u.id===s);return[oa,ph,{label:(d==null?void 0:d.displayName)??"Environment",url:Ai(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function J7(t,s,o,r,c){const d=q7(t,c),u=c.get(t),p=u==null?void 0:u.workspaceId,m=p?o.find(S=>S.id===p):void 0,g=s??(m==null?void 0:m.environmentId),v=g?r.find(S=>S.id===g):void 0,b=[oa];v&&g&&(b.push(ph),b.push({label:v.displayName,url:Ai(g)})),m&&g&&b.push({label:m.name,url:Ga(m.id,g)});for(let S=0;S<d.length-1;S++)b.push({label:d[S].title,url:On(d[S].id,void 0,p,g)});const y=d[d.length-1];return b.push({label:(y==null?void 0:y.title)??t,url:void 0}),b}const W7={label:"Findings",url:Dd};function X7(){return[oa,{label:"Findings",url:void 0}]}function sk(t,s,o,r,c){const d=[oa];if(s&&o){const u=r.find(m=>m.id===s),p=c.find(m=>m.id===o);d.push(ph),p&&d.push({label:p.displayName,url:Ai(o)}),u&&d.push({label:u.name,url:Ga(s,o)}),d.push({label:"Findings",url:wN(s,o)})}else d.push(W7);return d.push({label:t,url:void 0}),d}function mh(t){const s=[];for(const o of t){const r=s[s.length-1];o.eventType==="text"&&(r==null?void 0:r.eventType)==="text"?s[s.length-1]={...r,content:r.content+o.content}:s.push(o)}return s}function Yc(t){if(typeof t.id=="string")return t.id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const o=t.item;if(o&&typeof o.id=="string")return o.id}function Q7(t){if(typeof t.tool_use_id=="string")return t.tool_use_id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const o=t.item;if(o&&typeof o.id=="string")return o.id}function hh(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const o=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const b=s.get(v),y=b?Yc(b):void 0;if(y)try{const S=JSON.parse(v.content);o.set(y,{tool:S.tool,args:S.args})}catch{}}const r=new Set,c=new Set,d=t.map((v,b)=>{if(v.eventType!=="tool_result")return v;const y=s.get(v),S=y?Q7(y):void 0;if(!S)return v;const k=o.get(S);if(!k)return v;r.add(S),c.add(b);let j;const N=v.content.trim();if(N.startsWith("{"))try{const T=JSON.parse(N);typeof T.detailedContent=="string"&&(j=T.detailedContent)}catch{}return{...v,toolUseCtx:{...k,detailedResult:j}}}),u=[];for(let v=0;v<d.length;v++){if(d[v].eventType!=="tool_use")continue;const b=s.get(d[v]),y=b?Yc(b):void 0;y&&r.has(y)||u.push(v)}const p=[];for(let v=0;v<d.length;v++)d[v].eventType!=="tool_result"||c.has(v)||p.push(v);let m=0;for(const v of u){for(;m<p.length&&p[m]<v;)m++;if(m>=p.length)break;const b=p[m];if(b!==v+1)continue;const y=d[v],S=d[b];let k;try{const j=JSON.parse(y.content);k={tool:j.tool,args:j.args}}catch{}if(k){let j;const N=S.content.trim();if(N.startsWith("{"))try{const A=JSON.parse(N);typeof A.detailedContent=="string"&&(j=A.detailedContent)}catch{}d[b]={...S,toolUseCtx:{...k,detailedResult:j}},c.add(b);const T=s.get(y),C=T?Yc(T):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(y,{...T??{},__seqId:`__seq_${v}`})),m++}}const g=d.filter(v=>{if(v.eventType!=="tool_use")return!0;const b=s.get(v);if(!b)return!0;const y=Yc(b);if(y&&r.has(y))return!1;const S=b.__seqId;return!(S&&r.has(S))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let b=!1;for(let y=v+1;y<g.length;y++)if(g[y].eventType!=="tool_use"){b=!0;break}b&&(g[v]={...g[v],settled:!0})}return g}function ez(t,s,o){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=ak(s),d=s.filter(m=>hm(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||hm(m,c)).length,p=o.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function ak(t){const s=new Map;for(const o of t)s.set(o.id,o.status);return s}function hm(t,s){return t.dependsOn.some(o=>s.get(o)!=="complete")}function tz(t,s){var u;const o=new Map;for(const p of s)o.set(p.id,p);const r=ak(t),c=[];for(const p of t){const m=p.workspaceId?((u=o.get(p.workspaceId))==null?void 0:u.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:m}):hm(p,r)?c.push({task:p,reason:"blocked",workspaceName:m}):p.status==="paused"&&c.push({task:p,reason:"paused",workspaceName:m})}const d={failed:0,blocked:1,paused:2};return c.sort((p,m)=>(d[p.reason]??3)-(d[m.reason]??3)),c}function nz(t,s){const o=new Map;for(const r of s)o.set(r.id,r);return t.filter(r=>r.status==="running"||r.status==="idle"||r.status==="waiting").map(r=>{var c;return{session:r,environmentName:((c=o.get(r.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function sz(t,s,o){const r=new Map;for(const c of s){if(!c.workspaceId)continue;let d=r.get(c.workspaceId);d||(d={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},r.set(c.workspaceId,d)),d.totalTasks+=1,c.status==="complete"?d.completedTasks+=1:c.status==="working"?d.workingTasks+=1:c.status==="failed"&&(d.failedTasks+=1)}return t.map(c=>{const d=r.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:d.totalTasks,completedTasks:d.completedTasks,workingTasks:d.workingTasks,failedTasks:d.failedTasks}})}const ws=[{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
|
|
280
|
-
export function verifyToken(req: Request, res: Response, next: NextFunction): void {
|
|
281
|
-
const header = req.headers.authorization;
|
|
282
|
-
if (!header?.startsWith("Bearer ")) {
|
|
283
|
-
res.status(401).json({ error: "Missing token" });
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
|
|
287
|
-
req.user = decoded;
|
|
288
|
-
next();
|
|
289
|
-
}
|
|
290
|
-
\`\`\``,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
|
|
291
|
-
CREATE TABLE audit_log (
|
|
292
|
-
id BIGSERIAL PRIMARY KEY,
|
|
293
|
-
user_id UUID REFERENCES users(id),
|
|
294
|
-
action TEXT NOT NULL,
|
|
295
|
-
entity_type TEXT NOT NULL,
|
|
296
|
-
entity_id TEXT NOT NULL,
|
|
297
|
-
old_value JSONB,
|
|
298
|
-
new_value JSONB,
|
|
299
|
-
ip_address INET,
|
|
300
|
-
created_at TIMESTAMPTZ DEFAULT now()
|
|
301
|
-
);
|
|
302
|
-
\`\`\``,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}],za=[{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"}],az=new Map(ws.map(t=>[t.id,t]));function Mp(t){const s=az.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const ax={"kn-auth-flow":{node:Mp("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:Mp("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:Mp("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"}]}},iz=[{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},{id:"error-env",displayName:"Error Test",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0}],oz=[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z",endedAt:"2026-02-26T15:12:00Z",error:"Context window exceeded before completing implementation",inputTokens:84200,outputTokens:12750,costMillicents:41e3},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Refactor the authentication middleware to use JWT tokens",startedAt:"2026-02-27T08:15:00Z",inputTokens:42600,outputTokens:8100,costMillicents:22e3},{id:"sess-002",environmentId:"env-docker-01",runtime:"copilot",status:"stopped",endReason:"completed",prompt:"Write unit tests for the user registration endpoint",startedAt:"2026-02-27T07:30:00Z",endedAt:"2026-02-27T07:33:00Z",inputTokens:31400,outputTokens:9800,costMillicents:18e3},{id:"sess-003",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Migrate database schema to add audit_log table",startedAt:"2026-02-26T22:45:00Z",endedAt:"2026-02-26T23:10:00Z",inputTokens:56300,outputTokens:14200,costMillicents:31e3},{id:"sess-004",environmentId:"env-docker-01",runtime:"codex",status:"running",prompt:"Implement rate limiting for the public API",startedAt:"2026-02-27T09:00:00Z",inputTokens:18900,outputTokens:4500,costMillicents:1e4},{id:"sess-005",environmentId:"env-cs-01",runtime:"claude-code",status:"suspended",prompt:"Refactor database connection pooling for multi-tenant isolation",startedAt:"2026-02-27T06:00:00Z",inputTokens:67800,outputTokens:19300,costMillicents:38e3}],rz=[{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.
|
|
303
|
-
Project: acme/alpha — Node.js + Express REST API
|
|
304
|
-
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";
|
|
305
|
-
import type { Request, Response, NextFunction } from "express";
|
|
306
|
-
|
|
307
|
-
export function requireAuth(req: Request, res: Response, next: NextFunction): void {
|
|
308
|
-
if (!req.session?.userId) {
|
|
309
|
-
res.status(401).json({ error: "Not authenticated" });
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
next();
|
|
313
|
-
}`,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) {
|
|
314
|
-
src/routes/login.ts:18: req.session.userId = user.id;
|
|
315
|
-
src/routes/login.ts:19: req.session.role = user.role;
|
|
316
|
-
src/routes/protected.ts:7: const userId = req.session.userId;`,raw:JSON.stringify({tool_use_id:"tu-prev-002"})},{sessionId:"sess-001-prev",eventType:"usage",timestamp:"2026-02-26T14:30:00Z",content:JSON.stringify({input_tokens:42100,output_tokens:6350,cost_millicents:21e3})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:30:02Z",content:"Found 3 files using session-based auth. Now let me read the login route and the protected route to understand the full flow before making changes."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:30:03Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/login.ts"}}),raw:JSON.stringify({id:"tu-prev-003",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:30:04Z",content:`import { Router } from "express";
|
|
317
|
-
import bcrypt from "bcrypt";
|
|
318
|
-
import { db } from "../db.js";
|
|
319
|
-
|
|
320
|
-
const router = Router();
|
|
321
|
-
|
|
322
|
-
router.post("/login", async (req, res) => {
|
|
323
|
-
const { email, password } = req.body;
|
|
324
|
-
const user = await db.users.findByEmail(email);
|
|
325
|
-
if (!user || !await bcrypt.compare(password, user.passwordHash)) {
|
|
326
|
-
return res.status(401).json({ error: "Invalid credentials" });
|
|
327
|
-
}
|
|
328
|
-
req.session.userId = user.id;
|
|
329
|
-
req.session.role = user.role;
|
|
330
|
-
res.json({ ok: true });
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
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.
|
|
334
|
-
Project: acme/alpha — Node.js + Express REST API
|
|
335
|
-
Task: Implement auth middleware using JWT tokens
|
|
336
|
-
|
|
337
|
-
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
|
|
338
|
-
src/routes/login.ts
|
|
339
|
-
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
|
|
340
|
-
|
|
341
|
-
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";
|
|
342
|
-
import type { Request, Response, NextFunction } from "express";
|
|
343
|
-
|
|
344
|
-
const JWT_SECRET = process.env.JWT_SECRET || "change-me";
|
|
345
|
-
|
|
346
|
-
export interface JwtPayload {
|
|
347
|
-
userId: string;
|
|
348
|
-
role: string;
|
|
349
|
-
iat: number;
|
|
350
|
-
exp: number;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
export function verifyToken(req: Request, res: Response, next: NextFunction): void {
|
|
354
|
-
const header = req.headers.authorization;
|
|
355
|
-
if (!header?.startsWith("Bearer ")) {
|
|
356
|
-
res.status(401).json({ error: "Missing or malformed token" });
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
try {
|
|
360
|
-
const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
|
|
361
|
-
req.user = decoded;
|
|
362
|
-
next();
|
|
363
|
-
} catch (err) {
|
|
364
|
-
if (err instanceof jwt.TokenExpiredError) {
|
|
365
|
-
res.status(401).json({ error: "Token expired" });
|
|
366
|
-
} else {
|
|
367
|
-
res.status(403).json({ error: "Invalid token" });
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
`}}),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.
|
|
372
|
-
|
|
373
|
-
The new login flow will:
|
|
374
|
-
1. Validate credentials (unchanged)
|
|
375
|
-
2. Generate a JWT with \`userId\` and \`role\` claims
|
|
376
|
-
3. Return the token in the response body
|
|
377
|
-
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";
|
|
378
|
-
import bcrypt from "bcrypt";
|
|
379
|
-
import jwt from "jsonwebtoken";
|
|
380
|
-
import crypto from "node:crypto";
|
|
381
|
-
import { db } from "../db.js";
|
|
382
|
-
|
|
383
|
-
const JWT_SECRET = process.env.JWT_SECRET || "change-me";
|
|
384
|
-
const ACCESS_TOKEN_EXPIRY = "24h";
|
|
385
|
-
const REFRESH_TOKEN_BYTES = 48;
|
|
386
|
-
|
|
387
|
-
const router = Router();
|
|
388
|
-
|
|
389
|
-
router.post("/login", async (req, res) => {
|
|
390
|
-
const { email, password } = req.body;
|
|
391
|
-
const user = await db.users.findByEmail(email);
|
|
392
|
-
if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
|
|
393
|
-
return res.status(401).json({ error: "Invalid credentials" });
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
const accessToken = jwt.sign(
|
|
397
|
-
{ userId: user.id, role: user.role },
|
|
398
|
-
JWT_SECRET,
|
|
399
|
-
{ expiresIn: ACCESS_TOKEN_EXPIRY },
|
|
400
|
-
);
|
|
401
|
-
|
|
402
|
-
const refreshToken = crypto.randomBytes(REFRESH_TOKEN_BYTES).toString("hex");
|
|
403
|
-
await db.refreshTokens.create({ userId: user.id, token: refreshToken });
|
|
404
|
-
|
|
405
|
-
res.json({ accessToken, refreshToken, expiresIn: ACCESS_TOKEN_EXPIRY });
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
export default router;
|
|
409
|
-
`}}),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
|
|
410
|
-
PASS src/routes/__tests__/protected.test.ts
|
|
411
|
-
FAIL src/middleware/__tests__/auth.test.ts
|
|
412
|
-
x should reject missing session (12ms)
|
|
413
|
-
x should allow valid session (8ms)
|
|
414
|
-
|
|
415
|
-
2 failed, 12 passed, 14 total
|
|
416
|
-
|
|
417
|
-
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.
|
|
418
|
-
|
|
419
|
-
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";
|
|
420
|
-
import jwt from "jsonwebtoken";
|
|
421
|
-
import { verifyToken } from "../auth.js";
|
|
422
|
-
import { createMockReqRes } from "../../test-utils/mock-express.js";
|
|
423
|
-
|
|
424
|
-
const SECRET = "test-secret";
|
|
425
|
-
process.env.JWT_SECRET = SECRET;
|
|
426
|
-
|
|
427
|
-
describe("verifyToken", () => {
|
|
428
|
-
it("should reject requests without Authorization header", () => {
|
|
429
|
-
const { req, res, next } = createMockReqRes();
|
|
430
|
-
verifyToken(req, res, next);
|
|
431
|
-
expect(res.status).toHaveBeenCalledWith(401);
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
it("should reject expired tokens", () => {
|
|
435
|
-
const token = jwt.sign({ userId: "u1", role: "user" }, SECRET, { expiresIn: "-1h" });
|
|
436
|
-
const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
|
|
437
|
-
verifyToken(req, res, next);
|
|
438
|
-
expect(res.status).toHaveBeenCalledWith(401);
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
it("should accept valid tokens and attach user to request", () => {
|
|
442
|
-
const token = jwt.sign({ userId: "u1", role: "admin" }, SECRET, { expiresIn: "1h" });
|
|
443
|
-
const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
|
|
444
|
-
verifyToken(req, res, next);
|
|
445
|
-
expect(next).toHaveBeenCalled();
|
|
446
|
-
expect(req.user).toMatchObject({ userId: "u1", role: "admin" });
|
|
447
|
-
});
|
|
448
|
-
});
|
|
449
|
-
`}}),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
|
|
450
|
-
PASS src/routes/__tests__/protected.test.ts
|
|
451
|
-
PASS src/middleware/__tests__/auth.test.ts
|
|
452
|
-
|
|
453
|
-
Test Suites: 3 passed, 3 total
|
|
454
|
-
Tests: 14 passed, 14 total`,raw:JSON.stringify({tool_use_id:"tu-001-08"})},{sessionId:"sess-001",eventType:"usage",timestamp:"2026-02-27T08:15:41Z",content:JSON.stringify({input_tokens:42600,output_tokens:8100,cost_millicents:22e3})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:42Z",content:`All 14 tests pass. Here's a summary of the changes:
|
|
455
|
-
|
|
456
|
-
### Changes made
|
|
457
|
-
|
|
458
|
-
| File | Action |
|
|
459
|
-
|------|--------|
|
|
460
|
-
| \`src/middleware/auth.ts\` | Rewrote to verify JWT Bearer tokens |
|
|
461
|
-
| \`src/routes/login.ts\` | Now issues JWT access + refresh tokens |
|
|
462
|
-
| \`src/routes/protected.ts\` | Updated to read \`req.user\` from JWT payload |
|
|
463
|
-
| \`src/middleware/__tests__/auth.test.ts\` | Updated tests for JWT verification |
|
|
464
|
-
|
|
465
|
-
### Key decisions
|
|
466
|
-
- **Access token expiry**: 24 hours (configurable via \`JWT_SECRET\` env var)
|
|
467
|
-
- **Refresh tokens**: 48-byte random hex, stored in DB
|
|
468
|
-
- **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.
|
|
469
|
-
Project: acme/alpha — Node.js + Express REST API
|
|
470
|
-
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";
|
|
471
|
-
import bcrypt from "bcrypt";
|
|
472
|
-
import { db } from "../db.js";
|
|
473
|
-
import { validateEmail, validatePassword } from "../utils/validators.js";
|
|
474
|
-
|
|
475
|
-
const SALT_ROUNDS = 12;
|
|
476
|
-
const router = Router();
|
|
477
|
-
|
|
478
|
-
router.post("/register", async (req, res) => {
|
|
479
|
-
const { name, email, password } = req.body;
|
|
480
|
-
|
|
481
|
-
if (!name || !email || !password) {
|
|
482
|
-
return res.status(400).json({ error: "Missing required fields" });
|
|
483
|
-
}
|
|
484
|
-
if (!validateEmail(email)) {
|
|
485
|
-
return res.status(400).json({ error: "Invalid email format" });
|
|
486
|
-
}
|
|
487
|
-
if (!validatePassword(password)) {
|
|
488
|
-
return res.status(400).json({ error: "Password too weak" });
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
const existing = await db.users.findByEmail(email);
|
|
492
|
-
if (existing) {
|
|
493
|
-
return res.status(409).json({ error: "Email already registered" });
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
|
|
497
|
-
const user = await db.users.create({ name, email, passwordHash });
|
|
498
|
-
res.status(201).json({ id: user.id, name: user.name, email: user.email });
|
|
499
|
-
});
|
|
500
|
-
|
|
501
|
-
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:
|
|
502
|
-
|
|
503
|
-
1. **Happy path** - valid registration
|
|
504
|
-
2. **Missing fields** - each required field missing
|
|
505
|
-
3. **Invalid email** - malformed email format
|
|
506
|
-
4. **Weak password** - password validation failure
|
|
507
|
-
5. **Duplicate email** - conflict with existing user
|
|
508
|
-
6. **SQL injection** - malicious email input
|
|
509
|
-
7. **XSS payload** - HTML in the name field
|
|
510
|
-
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
|
|
511
|
-
POST /api/register
|
|
512
|
-
✓ should register a valid user (28ms)
|
|
513
|
-
✓ should reject missing name (4ms)
|
|
514
|
-
✓ should reject missing email (3ms)
|
|
515
|
-
✓ should reject missing password (3ms)
|
|
516
|
-
✓ should reject invalid email format (5ms)
|
|
517
|
-
✓ should reject weak password (4ms)
|
|
518
|
-
✓ should reject duplicate email (12ms)
|
|
519
|
-
✓ should sanitize HTML in name field (6ms)
|
|
520
|
-
|
|
521
|
-
Tests: 8 passed, 8 total`,raw:JSON.stringify({tool_use_id:"tu-002-03"})},{sessionId:"sess-002",eventType:"usage",timestamp:"2026-02-27T07:32:00Z",content:JSON.stringify({input_tokens:31400,output_tokens:9800,cost_millicents:18e3})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:32:30Z",content:"All 8 test cases pass. Created `src/routes/__tests__/register.test.ts` with comprehensive coverage for the registration endpoint including input validation, duplicate detection, and security edge cases."},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:33:00Z",content:"completed"},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T22:45:01Z",content:"running"},{sessionId:"sess-003",eventType:"system",timestamp:"2026-02-26T22:45:02Z",content:`You are a database engineer. Focus on safe migrations, zero-downtime deployments, and data integrity.
|
|
522
|
-
Project: acme/alpha — Node.js + Express + PostgreSQL
|
|
523
|
-
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 (
|
|
524
|
-
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
525
|
-
name TEXT NOT NULL,
|
|
526
|
-
email TEXT UNIQUE NOT NULL,
|
|
527
|
-
password_hash TEXT NOT NULL,
|
|
528
|
-
role TEXT DEFAULT 'user',
|
|
529
|
-
created_at TIMESTAMPTZ DEFAULT now(),
|
|
530
|
-
updated_at TIMESTAMPTZ DEFAULT now()
|
|
531
|
-
);
|
|
532
|
-
|
|
533
|
-
CREATE TABLE sessions (
|
|
534
|
-
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
535
|
-
user_id UUID REFERENCES users(id),
|
|
536
|
-
expires_at TIMESTAMPTZ NOT NULL,
|
|
537
|
-
created_at TIMESTAMPTZ DEFAULT now()
|
|
538
|
-
);`,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
|
|
539
|
-
-- Add audit logging and user activity tracking
|
|
540
|
-
|
|
541
|
-
BEGIN;
|
|
542
|
-
|
|
543
|
-
-- 1. Add last_login_at to users
|
|
544
|
-
ALTER TABLE users ADD COLUMN last_login_at TIMESTAMPTZ;
|
|
545
|
-
|
|
546
|
-
-- 2. Index for session cleanup queries
|
|
547
|
-
CREATE INDEX CONCURRENTLY idx_sessions_expires_at ON sessions (expires_at);
|
|
548
|
-
|
|
549
|
-
-- 3. Audit log table
|
|
550
|
-
CREATE TABLE audit_log (
|
|
551
|
-
id BIGSERIAL PRIMARY KEY,
|
|
552
|
-
user_id UUID REFERENCES users(id),
|
|
553
|
-
action TEXT NOT NULL,
|
|
554
|
-
entity_type TEXT NOT NULL,
|
|
555
|
-
entity_id TEXT NOT NULL,
|
|
556
|
-
old_value JSONB,
|
|
557
|
-
new_value JSONB,
|
|
558
|
-
ip_address INET,
|
|
559
|
-
created_at TIMESTAMPTZ DEFAULT now()
|
|
560
|
-
);
|
|
561
|
-
|
|
562
|
-
CREATE INDEX idx_audit_log_user ON audit_log (user_id);
|
|
563
|
-
CREATE INDEX idx_audit_log_entity ON audit_log (entity_type, entity_id);
|
|
564
|
-
CREATE INDEX idx_audit_log_created ON audit_log (created_at);
|
|
565
|
-
|
|
566
|
-
COMMIT;
|
|
567
|
-
`}}),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
|
|
568
|
-
- ALTER TABLE users ADD COLUMN last_login_at
|
|
569
|
-
- CREATE INDEX CONCURRENTLY idx_sessions_expires_at
|
|
570
|
-
- CREATE TABLE audit_log
|
|
571
|
-
- 3 indexes on audit_log
|
|
572
|
-
|
|
573
|
-
WARNING: CREATE INDEX CONCURRENTLY cannot run inside a transaction block.
|
|
574
|
-
Please split this into a separate migration step.`,raw:JSON.stringify({tool_use_id:"tu-003-03",is_error:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:15Z",content:"Good catch from the dry run! `CREATE INDEX CONCURRENTLY` can't run inside a transaction. I need to split the migration into two files: one for the transactional DDL and another for the concurrent index creation."},{sessionId:"sess-003",eventType:"usage",timestamp:"2026-02-26T23:00:00Z",content:JSON.stringify({input_tokens:56300,output_tokens:14200,cost_millicents:31e3})},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T23:10:00Z",content:"interrupted"},{sessionId:"sess-004",eventType:"status",timestamp:"2026-02-27T09:00:01Z",content:"running"},{sessionId:"sess-004",eventType:"system",timestamp:"2026-02-27T09:00:02Z",content:`You are a backend engineer specializing in API infrastructure.
|
|
575
|
-
Project: acme/data-pipeline — ETL pipelines for analytics
|
|
576
|
-
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
|
|
577
|
-
src/middleware/error-handler.ts
|
|
578
|
-
src/middleware/logger.ts
|
|
579
|
-
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:
|
|
580
|
-
|
|
581
|
-
- Uses an **in-memory token bucket** per client IP
|
|
582
|
-
- Supports configurable rate (requests/second) and burst size
|
|
583
|
-
- Returns \`429 Too Many Requests\` with \`Retry-After\` header
|
|
584
|
-
- Has a Redis adapter option for multi-instance deployments
|
|
585
|
-
|
|
586
|
-
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.
|
|
587
|
-
Project: acme/alpha — Node.js + Express + PostgreSQL
|
|
588
|
-
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";
|
|
589
|
-
|
|
590
|
-
const pool = new pg.Pool({
|
|
591
|
-
connectionString: process.env.DATABASE_URL,
|
|
592
|
-
max: 20,
|
|
593
|
-
idleTimeoutMillis: 30000,
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
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:
|
|
597
|
-
|
|
598
|
-
1. **A \`PoolManager\` class** that creates and caches per-tenant pools
|
|
599
|
-
2. **Configurable limits** per tenant (max connections, idle timeout)
|
|
600
|
-
3. **Health checks** with automatic pool eviction for unhealthy connections
|
|
601
|
-
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";
|
|
602
|
-
src/routes/users.ts:2:import { pool } from "../db/pool.js";
|
|
603
|
-
src/routes/register.ts:3:import { pool } from "../db/pool.js";
|
|
604
|
-
src/routes/admin.ts:4:import { pool } from "../db/pool.js";
|
|
605
|
-
src/services/billing.ts:2:import { pool } from "../db/pool.js";
|
|
606
|
-
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:
|
|
607
|
-
1. Create a new \`PoolManager\` abstraction
|
|
608
|
-
2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
|
|
609
|
-
3. Add middleware to extract tenant ID from the request
|
|
610
|
-
|
|
611
|
-
This is a significant refactor. Let me start with the PoolManager class.`},{sessionId:"sess-005",eventType:"usage",timestamp:"2026-02-27T06:30:00Z",content:JSON.stringify({input_tokens:67800,output_tokens:19300,cost_millicents:38e3})},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:30:01Z",content:"suspended"}],lz=[{id:"proj-alpha",name:"Workspace Alpha",description:"Core platform API and authentication services",repoUrl:"https://github.com/acme/alpha",environmentId:"env-local-01",linkedEnvironmentIds:["env-docker-01"],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-01-15T10:00:00Z",updatedAt:"2026-01-15T10:00:00Z"},{id:"proj-beta",name:"Data Pipeline",description:"ETL pipelines for analytics and reporting",repoUrl:"https://github.com/acme/data-pipeline",environmentId:"env-docker-01",linkedEnvironmentIds:[],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-02-01T14:30:00Z",updatedAt:"2026-02-01T14:30:00Z"},{id:"proj-gamma",name:"Mobile App",description:"React Native cross-platform mobile application",repoUrl:"",environmentId:"env-local-01",linkedEnvironmentIds:[],status:"archived",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2025-11-20T09:00:00Z",updatedAt:"2025-11-20T09:00:00Z"}],cz=[{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"}}),tokenBudget:0,costBudgetMillicents:0},{id:"task-001a",workspaceId:"proj-alpha",title:"Design token schema",description:"Define JWT payload structure, expiry, and refresh token strategy",status:"complete",branch:"feat/jwt-auth/design-token-schema",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:10:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-001b",workspaceId:"proj-alpha",title:"Implement auth middleware",description:"Build Express middleware that verifies JWT Bearer tokens",status:"working",branch:"feat/jwt-auth/implement-auth-middleware",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:15:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-001c",workspaceId:"proj-alpha",title:"Write auth integration tests",description:"End-to-end tests for login flow, token refresh, and protected route access",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-25T10:20:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-002",workspaceId:"proj-alpha",title:"Add rate limiting",description:"Implement token-bucket rate limiting for public API endpoints",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:05:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-003",workspaceId:"proj-alpha",title:"Set up OpenAPI documentation",description:"Generate Swagger docs from route decorators and serve at /api/docs",status:"paused",branch:"feat/openapi-docs",latestSessionId:"sess-002",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-24T16:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-004",workspaceId:"proj-alpha",title:"Database connection pooling",description:"Switch from single connection to a connection pool with health checks",status:"complete",branch:"feat/db-pool",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-23T11:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-005",workspaceId:"proj-alpha",title:"Fix N+1 query in user list",description:"Use a JOIN instead of per-row lookups in GET /api/users",status:"not_started",branch:"fix/user-list-n1",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:5,createdAt:"2026-02-22T09:30:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006",workspaceId:"proj-beta",title:"Add Parquet export support",description:"Allow pipeline outputs to be written as Parquet files for Spark consumption",status:"working",branch:"feat/parquet-export",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-006a","task-006b","task-006c","task-006d"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Plan for adding Parquet export support, including compression options and performance benchmarks.",extra:{approach:"Use apache-arrow npm package for Parquet write support. Map internal column types to Arrow type system.",compression:{supported:["snappy","zstd","gzip"],default:"snappy"},benchmarks:{"1M rows snappy":"2.3s","1M rows zstd":"3.1s","1M rows gzip":"4.8s"}}}),tokenBudget:0,costBudgetMillicents:0},{id:"task-006a",workspaceId:"proj-beta",title:"Define Parquet schema mapping",description:"Map internal column types to Arrow/Parquet type system",status:"complete",branch:"feat/parquet-export/define-parquet-schema-mapping",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:05:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006b",workspaceId:"proj-beta",title:"Implement row-group writer",description:"Write buffered row groups with configurable batch size",status:"complete",branch:"feat/parquet-export/implement-row-group-writer",latestSessionId:"",dependsOn:["task-006a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:10:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006c",workspaceId:"proj-beta",title:"Add compression options",description:"Support Snappy, ZSTD, and GZIP compression for Parquet output",status:"working",branch:"feat/parquet-export/add-compression-options",latestSessionId:"sess-004",dependsOn:["task-006b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T08:15:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006d",workspaceId:"proj-beta",title:"Write Parquet integration tests",description:"Round-trip tests: write Parquet, read back with pyarrow, verify data integrity",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-006c"],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-26T08:20:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007",workspaceId:"proj-beta",title:"Implement incremental loads",description:"Track watermarks so pipelines only process new/changed rows",status:"working",branch:"feat/incremental",latestSessionId:"sess-004",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:30:00Z",parentTaskId:"",depth:0,childTaskIds:["task-007a","task-007b"],canDecompose:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007a",workspaceId:"proj-beta",title:"Design watermark storage",description:"Define schema for per-pipeline high-watermark tracking",status:"complete",branch:"feat/incremental/design-watermark-storage",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:35:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007b",workspaceId:"proj-beta",title:"Implement change detection query",description:"Generate WHERE clauses from watermarks to fetch only changed rows",status:"failed",branch:"feat/incremental/implement-change-detection-query",latestSessionId:"",dependsOn:["task-007a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:40:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-008",workspaceId:"proj-beta",title:"Add pipeline monitoring dashboard",description:"Real-time metrics for pipeline throughput, latency, and error rates",status:"paused",branch:"feat/monitoring",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T09:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0}],Jc=[{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"}],dz=[{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:""}],uz=[{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));
|
|
612
|
-
for (const f of files) {
|
|
613
|
-
const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);
|
|
614
|
-
if (eslintResult.exitCode !== 0) {
|
|
615
|
-
env.findings.push({ category: "lint", title: \`Lint issues in \${f.filename}\`, content: eslintResult.stderr });
|
|
616
|
-
}
|
|
617
|
-
const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);
|
|
618
|
-
if (prettierResult.exitCode !== 0) {
|
|
619
|
-
env.findings.push({ category: "format", title: \`Prettier issues in \${f.filename}\`, content: prettierResult.stderr });
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
env.findings.push({ category: "summary", title: "Lint & format pass complete", content: \`Ran ESLint and Prettier on \${files.length} files\` });`,allowedMcpTools:[]}],fz={"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 Me(t){return new Date(Date.now()+t).toISOString()}const ix=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Me(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Me(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Me(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:Me(1600),content:`src/routes/users.ts
|
|
623
|
-
src/routes/auth.ts
|
|
624
|
-
src/routes/billing.ts
|
|
625
|
-
src/routes/admin.ts
|
|
626
|
-
src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:Me(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
|
|
627
|
-
|
|
628
|
-
\`\`\`typescript
|
|
629
|
-
const router = Router();
|
|
630
|
-
router.use(authenticate);
|
|
631
|
-
router.use(validateBody);
|
|
632
|
-
|
|
633
|
-
router.get("/", listUsers);
|
|
634
|
-
router.post("/", createUser);
|
|
635
|
-
router.get("/:id", getUser);
|
|
636
|
-
router.put("/:id", updateUser);
|
|
637
|
-
router.delete("/:id", deleteUser);
|
|
638
|
-
\`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:Me(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:Me(4e3),content:` PASS src/routes/__tests__/users.test.ts
|
|
639
|
-
PASS src/routes/__tests__/auth.test.ts
|
|
640
|
-
PASS src/routes/__tests__/billing.test.ts
|
|
641
|
-
|
|
642
|
-
Test Suites: 3 passed, 3 total
|
|
643
|
-
Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:Me(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_millicents:15e3})}},{delayMs:5e3,event:{eventType:"text",timestamp:Me(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Me(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Me(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Me(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Me(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:Me(1800),content:`CREATE TABLE users (
|
|
644
|
-
id UUID PRIMARY KEY,
|
|
645
|
-
name TEXT NOT NULL,
|
|
646
|
-
email TEXT UNIQUE NOT NULL,
|
|
647
|
-
created_at TIMESTAMPTZ DEFAULT now()
|
|
648
|
-
);
|
|
649
|
-
|
|
650
|
-
CREATE TABLE sessions (
|
|
651
|
-
id UUID PRIMARY KEY,
|
|
652
|
-
user_id UUID REFERENCES users(id),
|
|
653
|
-
expires_at TIMESTAMPTZ NOT NULL
|
|
654
|
-
);`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Me(2600),content:`I found the tables to modify:
|
|
655
|
-
- **users**: add column \`last_login_at\`
|
|
656
|
-
- **sessions**: add index on \`expires_at\`
|
|
657
|
-
- **audit_log**: new table
|
|
658
|
-
|
|
659
|
-
This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
|
|
660
|
-
|
|
661
|
-
Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:Me(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Me(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:Me(1700),content:`Applying 002_add_last_login.sql... done
|
|
662
|
-
Applying 003_sessions_index.sql... done
|
|
663
|
-
Applying 004_audit_log.sql... done
|
|
664
|
-
|
|
665
|
-
3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:Me(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Me(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Me(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Me(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Me(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:Me(1800),content:`import { StripeClient } from "./stripe-client.js";
|
|
666
|
-
import type { Invoice, LineItem } from "../types/billing.js";
|
|
667
|
-
|
|
668
|
-
export class BillingService {
|
|
669
|
-
constructor(private stripe: StripeClient) {}
|
|
670
|
-
|
|
671
|
-
async calculateMonthlyTotal(userId: string): Promise<number> {
|
|
672
|
-
const invoices = await this.stripe.listInvoices(userId);
|
|
673
|
-
return invoices.reduce((sum, inv) => sum + inv.total, 0);
|
|
674
|
-
}
|
|
675
|
-
}`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:Me(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Me(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:Me(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:Me(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:Me(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Me(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Me(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Me(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:Me(1800),content:`import jwt from "jsonwebtoken";
|
|
676
|
-
import type { Request, Response, NextFunction } from "express";
|
|
677
|
-
|
|
678
|
-
const JWT_SECRET = process.env.JWT_SECRET || "change-me";
|
|
679
|
-
|
|
680
|
-
export function verifyToken(req: Request, res: Response, next: NextFunction): void {
|
|
681
|
-
const header = req.headers.authorization;
|
|
682
|
-
if (!header?.startsWith("Bearer ")) {
|
|
683
|
-
res.status(401).json({ error: "Missing token" });
|
|
684
|
-
return;
|
|
685
|
-
}
|
|
686
|
-
try {
|
|
687
|
-
const decoded = jwt.verify(header.slice(7), JWT_SECRET);
|
|
688
|
-
if (decoded.exp > Date.now() / 1000) {
|
|
689
|
-
res.status(403).json({ error: "Token expired" });
|
|
690
|
-
return;
|
|
691
|
-
}
|
|
692
|
-
req.user = decoded;
|
|
693
|
-
next();
|
|
694
|
-
} catch {
|
|
695
|
-
res.status(403).json({ error: "Invalid token" });
|
|
696
|
-
}
|
|
697
|
-
}`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:Me(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:Me(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:Me(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Me(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:Me(5800),content:`[exit 0] > jest --grep auth
|
|
698
|
-
|
|
699
|
-
PASS src/auth.test.ts
|
|
700
|
-
✓ validates JWT token (12ms)
|
|
701
|
-
✓ rejects expired token (3ms)
|
|
702
|
-
✓ handles missing header (1ms)
|
|
703
|
-
|
|
704
|
-
Tests: 3 passed, 3 total
|
|
705
|
-
Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Me(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:Me(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
|
|
706
|
-
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:Me(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:Me(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_millicents:12e3})}},{delayMs:8800,event:{eventType:"status",timestamp:Me(8800),content:"completed"}}]}],ps={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1},ox=400;function pz({children:t}){const[s,o]=x.useState(iz),[r,c]=x.useState(oz),[d,u]=x.useState(rz),[p,m]=x.useState(void 0),[g,v]=x.useState(lz),[b,y]=x.useState(""),[S,k]=x.useState(cz),[j,N]=x.useState(Jc),[T,C]=x.useState(void 0),A=!1,[I,E]=x.useState(dz),[D,P]=x.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[O,z]=x.useState(uz),[Q,$]=x.useState([]),[J]=x.useState(fz),[me,te]=x.useState(""),[X,B]=x.useState(ws),[F,Z]=x.useState(za),[de,W]=x.useState(void 0),[ee,ue]=x.useState(void 0),[Ce,Pe]=x.useState(""),ge=x.useRef(void 0),Se=x.useRef(0),xe=x.useRef(0),Be=x.useRef(new Set),It=x.useRef(new Map),zn=x.useRef(S);zn.current=S;const re=x.useRef(new Map),Ye=x.useRef(new Map),Pt=x.useCallback(H=>(Se.current+=1,`mock-${H}-${String(Se.current).padStart(3,"0")}`),[]),ae=x.useCallback(()=>{const H=ix[xe.current%ix.length];return xe.current+=1,H},[]),wt=x.useCallback((H,se,le)=>{const fe=setTimeout(()=>{var he;Be.current.delete(fe),le&&((he=It.current.get(le))==null||he.delete(fe)),H()},se);Be.current.add(fe),le&&(It.current.has(le)||It.current.set(le,new Set),It.current.get(le).add(fe))},[]),Ot=x.useCallback(H=>{const se=It.current.get(H);se&&(se.forEach(le=>{clearTimeout(le),Be.current.delete(le)}),It.current.delete(H))},[]),Bt=x.useCallback((H,se,le)=>{c(fe=>fe.map(he=>he.id===H?{...he,status:se,...le!==void 0?{endReason:le}:{}}:he))},[]),ze=x.useCallback(H=>{u(se=>[...se,H])},[]),sn=x.useCallback((H,se,le)=>{se.forEach((fe,he)=>{wt(()=>{const qe={sessionId:H,...fe.event,timestamp:new Date().toISOString()};if(ze(qe),fe.event.eventType==="status"){const _e=tk(fe.event.content),Re=nk(fe.event.content);Bt(H,_e,Re)}he===se.length-1&&le&&le()},fe.delayMs,H)})},[wt,ze,Bt]),ca=x.useCallback(async(H,se,le,fe)=>{console.log("[MockGrackle] spawn",{environmentId:H,prompt:se,runtime:fe});const he=Pt("sess"),qe={id:he,environmentId:H,runtime:fe||"claude-code",status:"running",prompt:se,startedAt:new Date().toISOString()};c(Re=>[...Re,qe]),m(he);const _e=ae();if(console.log(`[MockGrackle] Playing scenario: ${_e.label}`),_e.pauseForInput){const Re=_e.pauseAfterStep??_e.steps.length-1,We=_e.steps.slice(0,Re+1),ht=We.length>0?We[We.length-1].delayMs:0;sn(he,We),wt(()=>{Bt(he,"idle"),ze({sessionId:he,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ht+ox,he),_e.resumeSteps&&re.current.set(he,_e.resumeSteps)}else sn(he,_e.steps)},[Pt,ae,sn,wt,Bt,ze]),is=x.useCallback(async H=>{console.log("[MockGrackle] kill",H),Ot(H),re.current.delete(H),Bt(H,"stopped","killed"),ze({sessionId:H,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),k(se=>se.map(le=>le.latestSessionId===H&&le.status==="working"?{...le,status:"not_started"}:le))},[Ot,Bt,ze]),Wa=x.useCallback(async H=>{console.log("[MockGrackle] stopGraceful",H),Ot(H),re.current.delete(H),Bt(H,"stopped","terminated"),ze({sessionId:H,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),k(se=>se.map(le=>le.latestSessionId===H&&le.status==="working"?{...le,status:"not_started"}:le))},[Ot,Bt,ze]),da=x.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Jt=x.useCallback(async H=>{console.log("[MockGrackle] loadSessionEvents",H)},[]),Bi=x.useCallback(()=>{console.log("[MockGrackle] clearEvents"),u([])},[]),ua=x.useCallback(async(H,se,le,fe,he,qe,_e,Re,We)=>{console.log("[MockGrackle] createWorkspace",{name:H,description:se});const ht={id:Pt("proj"),name:H,description:se||"",repoUrl:le||"",environmentId:fe||"",linkedEnvironmentIds:[],status:"active",workingDirectory:_e||"",useWorktrees:qe??!0,defaultPersonaId:he||"",tokenBudget:0,costBudgetMillicents:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Le=>[...Le,ht]),Re&&Re()},[Pt]),Xa=x.useCallback(async H=>{console.log("[MockGrackle] archiveWorkspace",H),v(se=>se.map(le=>le.id===H?{...le,status:"archived"}:le))},[]),ys=x.useCallback(async H=>{console.log("[MockGrackle] loadTasks",H)},[]),Li=x.useCallback(async(H,se,le,fe,he,qe,_e,Re,We)=>{console.log("[MockGrackle] createTask",{workspaceId:H,title:se,parentTaskId:he}),k(ht=>{const Xe=ht.filter(Ds=>Ds.workspaceId===H).reduce((Ds,Zo)=>Math.max(Ds,Zo.sortOrder),0),ot=he?ht.find(Ds=>Ds.id===he):void 0;if(he&&!ot)return console.warn("[MockGrackle] Parent task not found:",he),ht;if(ot&&!ot.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",he),ht;const vt=ot?ot.depth+1:0,xs={id:Pt("task"),workspaceId:H,title:se,description:le||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:fe||[],reviewNotes:void 0,sortOrder:Xe+1,createdAt:new Date().toISOString(),parentTaskId:he||"",depth:vt,childTaskIds:[],canDecompose:_e??!he,defaultPersonaId:qe||"",workpad:"",tokenBudget:0,costBudgetMillicents:0};return[...ht,xs]}),Re&&Re()},[Pt]),$n=x.useCallback(async(H,se,le,fe)=>{var ht;console.log("[MockGrackle] startTask",{taskId:H});const he=zn.current.find(Le=>Le.id===H),qe=(he==null?void 0:he.title)??"",_e=Pt("sess"),Re={id:_e,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:qe||H,startedAt:new Date().toISOString()};c(Le=>[...Le,Re]),k(Le=>Le.map(Xe=>Xe.id===H?{...Xe,status:"working",latestSessionId:_e,branch:`mock/${H.slice(0,8)}`}:Xe));const We=ae();if(console.log(`[MockGrackle] Playing task scenario: ${We.label}`),We.pauseForInput){const Le=We.pauseAfterStep??We.steps.length-1,Xe=We.steps.slice(0,Le+1),ot=Xe.length>0?Xe[Xe.length-1].delayMs:0;if(sn(_e,Xe),wt(()=>{Bt(_e,"idle"),ze({sessionId:_e,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ot+ox,_e),We.resumeSteps){const vt=[...We.resumeSteps];re.current.set(_e,vt);const xs=vt.reduce((Ds,Zo)=>Math.max(Ds,Zo.delayMs),0);Ye.current.set(_e,{taskId:H,delayAfterResume:xs+200})}}else{const Le=We.steps.length>0?We.steps[We.steps.length-1].delayMs:0;sn(_e,We.steps);const Xe=(ht=We.steps[We.steps.length-1])==null?void 0:ht.event.content;wt(()=>{Xe==="completed"?k(ot=>ot.map(vt=>vt.id===H&&vt.status==="working"?{...vt,status:"paused"}:vt)):Xe==="failed"&&k(ot=>ot.map(vt=>vt.id===H&&vt.status==="working"?{...vt,status:"failed"}:vt))},Le+100,_e)}},[Pt,ae,sn,wt,Bt,ze]),De=x.useCallback(async(H,se)=>{console.log("[MockGrackle] sendInput",{sessionId:H,text:se}),ze({sessionId:H,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${se}`}),Bt(H,"running"),ze({sessionId:H,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const le=re.current.get(H);if(le)re.current.delete(H),sn(H,le);else{const he=[{delayMs:500,event:{eventType:"output",timestamp:new Date().toISOString(),content:"I received your input, continuing..."}},{delayMs:1500,event:{eventType:"status",timestamp:new Date().toISOString(),content:"completed"}}];sn(H,he)}const fe=Ye.current.get(H);fe&&(Ye.current.delete(H),wt(()=>{k(he=>he.map(qe=>qe.id===fe.taskId&&qe.status==="working"?{...qe,status:"paused"}:qe))},fe.delayAfterResume,H))},[ze,Bt,sn,wt]),Je=x.useCallback(async H=>{console.log("[MockGrackle] completeTask",H),k(se=>se.map(le=>le.id===H?{...le,status:"complete"}:le))},[]),Wt=x.useCallback(async H=>{console.log("[MockGrackle] resumeTask",H)},[]),St=x.useCallback(async(H,se,le,fe,he)=>{console.log("[MockGrackle] updateTask",{taskId:H,title:se}),k(qe=>qe.map(_e=>_e.id===H?{..._e,title:se.trim()||_e.title,description:le,dependsOn:fe,...he!==void 0?{defaultPersonaId:he}:{}}:_e))},[]),mn=x.useCallback(async H=>{console.log("[MockGrackle] deleteTask",H),k(se=>se.filter(le=>le.id!==H))},[]),Xt=x.useCallback(async H=>{console.log("[MockGrackle] loadFindings",H),N(Jc.filter(se=>se.workspaceId===H))},[]),zi=x.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),N([...Jc])},[]),$i=x.useCallback(async H=>{console.log("[MockGrackle] loadFinding",H);const se=Jc.find(le=>le.id===H);C(se)},[]),Ui=x.useCallback(async(H,se,le,fe,he)=>{console.log("[MockGrackle] postFinding",{workspaceId:H,title:se});const qe={id:Pt("find"),workspaceId:H,taskId:"",sessionId:"",category:fe||"general",title:se,content:le,tags:he||[],createdAt:new Date().toISOString()};N(_e=>[..._e,qe])},[Pt]),Qa=x.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),ei=x.useCallback(async(H,se,le)=>{console.log("[MockGrackle] addEnvironment",{displayName:H,adapterType:se,adapterConfig:le})},[]),ti=x.useCallback(async(H,se)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:H,...se}),o(le=>le.map(fe=>fe.id!==H?fe:{...fe,...se.displayName!==void 0?{displayName:se.displayName}:{},...se.adapterConfig!==void 0?{adapterConfig:JSON.stringify(se.adapterConfig)}:{}}))},[]),bs=x.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),ni=x.useCallback(async(H,se,le,fe,he)=>{console.log("[MockGrackle] setToken",{name:H,tokenType:le}),E(qe=>[...qe.filter(Re=>Re.name!==H),{name:H,tokenType:le,envVar:fe,filePath:he,expiresAt:""}])},[]),fa=x.useCallback(async H=>{console.log("[MockGrackle] deleteToken",H),E(se=>se.filter(le=>le.name!==H))},[]),_l=x.useCallback(async H=>{console.log("[MockGrackle] updateCredentialProviders",H),P(H)},[]);x.useEffect(()=>()=>{Be.current.forEach(clearTimeout),Be.current.clear()},[]);const kl=x.useMemo(()=>({connected:!0,environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:Qa,addEnvironment:ei,updateEnvironment:ti,provisionEnvironment:async(H,se)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:ps},sessions:{sessions:r,sessionsLoading:!1,events:d,eventsDropped:0,lastSpawnedId:p,taskSessions:J,spawn:ca,sendInput:De,kill:is,stopGraceful:Wa,loadSessionEvents:Jt,clearEvents:Bi,loadTaskSessions:async H=>{console.log("[MockGrackle] loadTaskSessions",H)},domainHook:ps},workspaces:{workspaces:g,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:ua,archiveWorkspace:Xa,updateWorkspace:async(H,se)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:H,...se}),v(le=>le.map(fe=>fe.id!==H?fe:{...fe,...se.name!==void 0?{name:se.name}:{},...se.description!==void 0?{description:se.description}:{},...se.repoUrl!==void 0?{repoUrl:se.repoUrl}:{},...se.environmentId!==void 0?{environmentId:se.environmentId}:{},...se.workingDirectory!==void 0?{workingDirectory:se.workingDirectory}:{},...se.useWorktrees!==void 0?{useWorktrees:se.useWorktrees}:{},...se.defaultPersonaId!==void 0?{defaultPersonaId:se.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},linkEnvironment:async(H,se)=>{if(console.log("[MockGrackle] linkEnvironment",{workspaceId:H,environmentId:se}),se==="error-env"){y("Failed to link environment");return}y(""),v(le=>le.map(fe=>fe.id!==H||fe.linkedEnvironmentIds.includes(se)?fe:{...fe,linkedEnvironmentIds:[...fe.linkedEnvironmentIds,se]}))},unlinkEnvironment:async(H,se)=>{if(console.log("[MockGrackle] unlinkEnvironment",{workspaceId:H,environmentId:se}),se==="error-env"){y("Failed to unlink environment");return}y(""),v(le=>le.map(fe=>fe.id!==H?fe:{...fe,linkedEnvironmentIds:fe.linkedEnvironmentIds.filter(he=>he!==se)}))},linkOperationError:b,clearLinkOperationError:()=>{y("")},domainHook:ps},tasks:{tasks:S,tasksLoading:!1,taskStartingId:void 0,loadTasks:ys,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Li,startTask:$n,stopTask:async H=>{console.log("[MockGrackle] stopTask",{taskId:H}),await Je(H)},completeTask:Je,resumeTask:Wt,updateTask:St,deleteTask:mn,domainHook:ps},findings:{findings:j,selectedFinding:T,findingLoading:A,findingsLoading:!1,loadFindings:Xt,loadAllFindings:zi,loadFinding:$i,postFinding:Ui,domainHook:ps},tokens:{tokens:I,tokensLoading:!1,loadTokens:bs,setToken:ni,deleteToken:fa,domainHook:ps},credentials:{credentialProviders:D,credentialsLoading:!1,updateCredentialProviders:_l,domainHook:ps},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:ps},personas:{personas:O,personasLoading:!1,createPersona:async(H,se,le,fe,he,qe,_e,Re,We)=>{console.log("[MockGrackle] createPersona",{name:H});const ht={id:`mock-persona-${Date.now()}`,name:H,description:se,systemPrompt:le,toolConfig:"{}",runtime:fe??"claude-code",model:he||"",maxTurns:qe||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:_e||"agent",script:Re||"",allowedMcpTools:We||[]};return z(Le=>[...Le,ht]),ht},updatePersona:async(H,se,le,fe,he,qe,_e,Re,We,ht)=>{console.log("[MockGrackle] updatePersona",{personaId:H,name:se});const Le=O.find(vt=>vt.id===H);if(!Le)throw new Error(`Persona not found: ${H}`);const Xe=new Date().toISOString(),ot={...Le,...se!==void 0?{name:se}:{},...le!==void 0?{description:le}:{},...fe!==void 0?{systemPrompt:fe}:{},...he!==void 0?{runtime:he}:{},...qe!==void 0?{model:qe}:{},..._e!==void 0?{maxTurns:_e}:{},...Re!==void 0?{type:Re}:{},...We!==void 0?{script:We}:{},...ht!==void 0?{allowedMcpTools:ht}:{},updatedAt:Xe};return z(vt=>vt.map(xs=>xs.id===H?ot:xs)),ot},deletePersona:async H=>{console.log("[MockGrackle] deletePersona",H),z(se=>se.filter(le=>le.id!==H))},domainHook:ps},schedules:{schedules:Q,schedulesLoading:!1,createSchedule:async(H,se,le,fe,he,qe)=>{console.log("[MockGrackle] createSchedule",{title:H});const _e={id:`mock-schedule-${Date.now()}`,title:H,description:se,scheduleExpression:le,personaId:fe,environmentId:he??"",workspaceId:qe??"",parentTaskId:"",enabled:!0,lastRunAt:"",nextRunAt:new Date(Date.now()+6e4).toISOString(),runCount:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};return $(Re=>[...Re,_e]),_e},updateSchedule:async(H,se)=>{console.log("[MockGrackle] updateSchedule",{scheduleId:H,fields:se});let le;if($(fe=>fe.map(he=>he.id!==H?he:(le={...he,...se,updatedAt:new Date().toISOString()},le))),!le)throw new Error(`Schedule not found: ${H}`);return le},deleteSchedule:async H=>{console.log("[MockGrackle] deleteSchedule",H),$(se=>se.filter(le=>le.id!==H))},domainHook:ps},knowledge:{graphData:{nodes:X,links:F},selectedNode:de,loading:!1,selectedId:ee,searchQuery:Ce,search:async H=>{if(console.log("[MockGrackle] knowledge.search",H),!H.trim()){Pe(H);return}Pe(H);const se=ge.current,le=se?ws.filter(_e=>!_e.workspaceId||_e.workspaceId===se):ws,fe=H.toLowerCase(),he=le.filter(_e=>{var Re,We,ht;return _e.label.toLowerCase().includes(fe)||((Re=_e.content)==null?void 0:Re.toLowerCase().includes(fe))||((We=_e.tags)==null?void 0:We.some(Le=>Le.toLowerCase().includes(fe)))||((ht=_e.category)==null?void 0:ht.toLowerCase().includes(fe))});B(he);const qe=new Set(he.map(_e=>_e.id));Z(za.filter(_e=>qe.has(_e.source)&&qe.has(_e.target))),ue(void 0),W(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),Pe("");const H=ge.current,se=H?ws.filter(fe=>!fe.workspaceId||fe.workspaceId===H):ws;B(se);const le=new Set(se.map(fe=>fe.id));Z(za.filter(fe=>le.has(fe.source)&&le.has(fe.target)))},selectNode:async H=>{console.log("[MockGrackle] knowledge.selectNode",H),ue(H);const se=H in ax?ax[H]:void 0;if(se)W(se);else{const le=ws.find(fe=>fe.id===H);if(le){const fe=za.filter(he=>he.source===H||he.target===H).map(he=>({fromId:he.source,toId:he.target,type:he.type}));W({node:le,edges:fe})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),ue(void 0),W(void 0)},expandNode:async H=>{console.log("[MockGrackle] knowledge.expandNode",H),B(se=>{const le=new Set(se.map(Re=>Re.id)),fe=za.filter(Re=>Re.source===H||Re.target===H),he=new Set;for(const Re of fe)le.has(Re.source)||he.add(Re.source),le.has(Re.target)||he.add(Re.target);if(he.size===0)return se;const qe=ws.filter(Re=>he.has(Re.id)),_e=new Set([...le,...he]);return Z(Re=>{const We=new Set(Re.map(Le=>`${Le.source}|${Le.target}|${Le.type}`)),ht=za.filter(Le=>_e.has(Le.source)&&_e.has(Le.target)&&!We.has(`${Le.source}|${Le.target}|${Le.type}`));return ht.length>0?[...Re,...ht]:Re}),[...se,...qe]})},loadRecent:async H=>{if(console.log("[MockGrackle] knowledge.loadRecent",H),ge.current=H,H){const se=ws.filter(fe=>!fe.workspaceId||fe.workspaceId===H);B(se);const le=new Set(se.map(fe=>fe.id));Z(za.filter(fe=>le.has(fe.source)&&le.has(fe.target)))}else B(ws),Z(za);Pe("")},handleEvent:()=>!1,domainHook:ps},appDefaultPersonaId:me,setAppDefaultPersonaId:async H=>{console.log("[MockGrackle] setAppDefaultPersonaId",H),te(H)},onboardingCompleted:!0,completeOnboarding:async()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costMillicents:112e3,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costMillicents:48e3,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1}},loadUsage:async(H,se)=>{console.log(`[MockGrackle] loadUsage(${H}, ${se})`)},refresh:da}),[s,r,d,p,J,g,b,S,j,T,I,D,O,Q,me,X,F,de,ee,Ce,ca,De,is,Wa,Jt,Bi,ua,Xa,ys,Li,$n,Je,Wt,St,mn,Xt,zi,$i,Ui,Qa,ei,ti,bs,ni,fa,_l,da]);return i.jsx(fh.Provider,{value:kl,children:t})}const mz=3e3;function hz(t){const[s,o]=x.useState(!1),r=x.useRef(t.onSessionEvent);r.current=t.onSessionEvent;const c=x.useRef(t.onDomainEvent);c.current=t.onDomainEvent;const d=x.useRef(t.onConnect);d.current=t.onConnect;const u=x.useRef(t.onDisconnect);return u.current=t.onDisconnect,x.useEffect(()=>{let p=!1,m;async function g(){var v,b;if(!p){try{const y=Qe.streamEvents({});o(!0),Promise.resolve((v=d.current)==null?void 0:v.call(d)).catch(()=>{});for await(const S of y){if(p)break;const k=S.event;if(k.case==="sessionEvent"){const j=k.value;r.current({sessionId:j.sessionId,type:j.type,timestamp:j.timestamp,content:j.content,raw:j.raw})}else if(k.case==="domainEvent"){const j=k.value;c.current({id:j.id,type:j.type,timestamp:j.timestamp,payloadJson:j.payloadJson})}}}catch(y){if(y instanceof Ei&&y.code===Tx.Unauthenticated){window.location.href=SN;return}}p||(o(!1),(b=u.current)==null||b.call(u),m=setTimeout(()=>{g().catch(()=>{})},mz))}}return g().catch(()=>{}),()=>{p=!0,clearTimeout(m),o(!1)}},[]),{connected:s}}const gm=["core","orchestration","scheduling"],ik=x.createContext({pluginNames:[...gm],loading:!1,error:void 0});function gz({children:t}){const[s,o]=x.useState([...gm]),[r,c]=x.useState(!0),[d,u]=x.useState(void 0);return x.useEffect(()=>{let p=!1;return fetch("/api/manifest").then(async m=>{if(!m.ok)throw new Error(`Manifest fetch returned ${m.status}`);return m.json()}).then(m=>{p||(o(m.plugins.map(g=>g.name)),c(!1))}).catch(m=>{p||(o([...gm]),u(m instanceof Error?m:new Error(String(m))),c(!1))}),()=>{p=!0}},[]),i.jsx(ik.Provider,{value:{pluginNames:s,loading:r,error:d},children:t})}function gh(){return x.useContext(ik)}const vz=new Set(["dashboard","chat","environments","settings"]),yz=new Set(["tasks","findings"]),bz=new Set(["knowledge"]),ok={core:{navItems:id.filter(t=>vz.has(t.view)),domainHookKeys:["environments","sessions","workspaces","tokens","credentials","codespaces"]},orchestration:{navItems:id.filter(t=>yz.has(t.view)),domainHookKeys:["tasks","findings","personas","notifications"]},scheduling:{navItems:[],domainHookKeys:["schedules"]},knowledge:{navItems:id.filter(t=>bz.has(t.view)),domainHookKeys:["knowledge"]}};function xz(t){return t.flatMap(s=>{var o;return((o=ok[s])==null?void 0:o.navItems)??[]})}function _z(t){return new Set(t.flatMap(s=>{var o;return((o=ok[s])==null?void 0:o.domainHookKeys)??[]}))}function kz(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped}}function rx(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,costMillicents:t.costMillicents}}function Sz(t){return{sessionId:t.sessionId,eventType:jx(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function Tz(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,environmentId:t.environmentId,linkedEnvironmentIds:[...t.linkedEnvironmentIds],status:OT(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents,createdAt:t.createdAt,updatedAt:t.updatedAt}}function lx(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:BT(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,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents}}function Ip(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 jz(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function wz(t){return{claude:LT(t.claude),github:Oc(t.github),copilot:Oc(t.copilot),codex:Oc(t.codex),goose:Oc(t.goose)}}function Nz(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function Op(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 Cz(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents,sessionCount:t.sessionCount}}function Bp(t){return{id:t.id,title:t.title,description:t.description,scheduleExpression:t.scheduleExpression,personaId:t.personaId,environmentId:t.environmentId,workspaceId:t.workspaceId,parentTaskId:t.parentTaskId,enabled:t.enabled,lastRunAt:t.lastRunAt,nextRunAt:t.nextRunAt,runCount:t.runCount,createdAt:t.createdAt,updatedAt:t.updatedAt}}function Wc(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 Lp(t){return{source:t.fromId,target:t.toId,type:t.type}}function la(){const[t,s]=x.useState(!1),o=x.useRef(0),r=x.useCallback(c=>(o.current++,o.current===1&&s(!0),c.finally(()=>{o.current--,o.current===0&&s(!1)})),[]);return{loading:t,track:r}}const cx=5e3;function Fr(t){return t instanceof Ei?t.message:"Operation failed"}function Ez(){const[t,s]=x.useState([]),{loading:o,track:r}=la(),[c,d]=x.useState({}),[u,p]=x.useState(""),m=x.useCallback(()=>{p("")},[]),g=x.useCallback(async()=>{try{const C=await r(Qe.listEnvironments({}));s(C.environments.map(kz))}catch{}},[r]),v=x.useCallback(C=>{switch(C.type){case"environment.added":return!0;case"environment.removed":{const A=C.payload.environmentId;return A&&(s(I=>I.filter(E=>E.id!==A)),d(I=>{const E={...I};return delete E[A],E})),!0}case"environment.changed":return g().catch(()=>{}),!0;case"environment.provision_progress":{const A=C.payload;if(typeof A.environmentId!="string"||typeof A.stage!="string"||typeof A.message!="string"||typeof A.progress!="number")return ek("environment.provision_progress","invalid payload"),!0;if(d(I=>({...I,[A.environmentId]:{stage:A.stage,message:A.message,progress:A.progress}})),A.stage==="ready"){const I=A.environmentId;setTimeout(()=>{d(E=>{const D={...E};return delete D[I],D})},cx)}return!0}default:return!1}},[g]),b=x.useCallback(C=>{var A;if(C.type==="environments"){const I=Array.isArray((A=C.payload)==null?void 0:A.environments)?C.payload.environments:[];return s(I),!0}return!1},[]),y=x.useCallback(async(C,A,I)=>{p("");try{await Qe.addEnvironment({displayName:C,adapterType:A,adapterConfig:JSON.stringify(I??{})})}catch(E){p(Fr(E))}},[]),S=x.useCallback(async(C,A)=>{p("");try{await Qe.updateEnvironment({id:C,displayName:A.displayName,adapterConfig:A.adapterConfig?JSON.stringify(A.adapterConfig):void 0})}catch(I){p(Fr(I))}},[]),k=x.useCallback(async(C,A)=>{p("");try{const I=Qe.provisionEnvironment({id:C,force:A??!1});for await(const E of I)d(D=>({...D,[C]:{stage:E.stage,message:E.message,progress:E.progress}})),E.stage==="ready"&&setTimeout(()=>{d(D=>{const P={...D};return delete P[C],P})},cx)}catch(I){d(E=>{const D={...E};return delete D[C],D}),p(Fr(I))}},[]),j=x.useCallback(async C=>{p("");try{await Qe.stopEnvironment({id:C})}catch(A){p(Fr(A))}},[]),N=x.useCallback(async C=>{p("");try{await Qe.removeEnvironment({id:C})}catch(A){p(Fr(A))}},[]);return{environments:t,environmentsLoading:o,provisionStatus:c,operationError:u,clearOperationError:m,loadEnvironments:g,addEnvironment:y,updateEnvironment:S,provisionEnvironment:k,stopEnvironment:j,removeEnvironment:N,handleEvent:v,handleLegacyMessage:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:v}}}const zp=new Set(["pending","running","idle"]),Az=new Set(["completed","failed","interrupted","hibernating","suspended"]),dx=["pending","running","idle"];function Dz(){const[t,s]=x.useState([]),{loading:o,track:r}=la(),[c,d]=x.useState([]),[u,p]=x.useState(0),[m,g]=x.useState(void 0),[v,b]=x.useState({}),y=x.useCallback(async()=>{try{const z=(await r(Qe.listSessions({}))).sessions.map(rx);s(Q=>{const $=new Map(Q.map(J=>[J.id,J]));return z.map(J=>{const me=$.get(J.id),te=me==null?void 0:me.status;return!te||te===J.status?J:Az.has(te)&&zp.has(J.status)?{...J,status:te,...me.endReason!==void 0?{endReason:me.endReason}:{}}:zp.has(te)&&zp.has(J.status)&&dx.indexOf(te)>dx.indexOf(J.status)?{...J,status:te}:J})})}catch{}},[r]),S=x.useCallback(O=>{if(O.type!=="session_event")return!1;if(!P7(O.payload))return ek("session_event","payload is not a valid SessionEvent"),!0;const z=O.payload;let Q=0;if(d($=>{const J=[...$,z];return J.length>wo?(Q=J.length-wo,J.slice(-wo)):J}),Q>0&&p($=>$+Q),z.eventType==="usage")try{const $=JSON.parse(z.content),J=Number($.input_tokens)||0,me=Number($.output_tokens)||0,te=Number($.cost_millicents)||0;(J>0||me>0||te>0)&&s(X=>X.map(B=>B.id===z.sessionId?{...B,inputTokens:(B.inputTokens??0)+J,outputTokens:(B.outputTokens??0)+me,costMillicents:(B.costMillicents??0)+te}:B))}catch{}if(z.eventType==="status"){const $=tk(z.content),J=nk(z.content);s(me=>me.some(X=>X.id===z.sessionId)?me.map(X=>X.id===z.sessionId?{...X,status:$,...J!==void 0?{endReason:J}:{}}:X):[...me,{id:z.sessionId,environmentId:"",runtime:"",status:$,prompt:"",startedAt:z.timestamp,...J!==void 0?{endReason:J}:{}}])}return!0},[]),k=x.useCallback(O=>{S({type:"session_event",payload:O})},[S]),j=x.useCallback(O=>{var z,Q,$,J,me;switch(O.type){case"sessions":{const te=Array.isArray((z=O.payload)==null?void 0:z.sessions)?O.payload.sessions:[];return s(te),!0}case"spawned":{const te=(Q=O.payload)==null?void 0:Q.sessionId;return typeof te=="string"&&te&&g(te),y().catch(()=>{}),!0}case"session_events":{const te=Array.isArray(($=O.payload)==null?void 0:$.events)?O.payload.events:[];return te.length>0&&d(te),!0}case"task_sessions":{const te=(J=O.payload)==null?void 0:J.taskId;if(typeof te=="string"&&te){const X=Array.isArray((me=O.payload)==null?void 0:me.sessions)?O.payload.sessions:[];b(B=>({...B,[te]:X}))}return!0}default:return!1}},[y]),N=x.useCallback(async(O,z,Q,$)=>{try{const J=await Qe.spawnAgent({environmentId:O,prompt:z,personaId:Q||"",workingDirectory:$||""});g(J.id),await y()}catch{}},[y]),T=x.useCallback(async(O,z)=>{try{await Qe.sendInput({sessionId:O,text:z})}catch{}},[]),C=x.useCallback(async O=>{try{await Qe.killAgent({id:O,graceful:!1})}catch{}},[]),A=x.useCallback(async O=>{try{await Qe.killAgent({id:O,graceful:!0})}catch{}},[]),I=x.useCallback(async O=>{try{const Q=(await Qe.getSessionEvents({id:O})).events.map(Sz);if(Q.length>0){let $=0;d(J=>{const me=new Set;for(const B of J)B.sessionId===O&&me.add(`${B.timestamp}|${B.eventType}`);const te=Q.filter(B=>!me.has(`${B.timestamp}|${B.eventType}`)),X=[...J,...te].sort((B,F)=>B.sessionId!==F.sessionId?0:B.timestamp.localeCompare(F.timestamp));return X.length>wo?($=X.length-wo,X.slice(-wo)):X}),$>0&&p(J=>J+$)}}catch{}},[]),E=x.useCallback(()=>{d([]),p(0)},[]),D=x.useCallback(async O=>{try{const Q=(await Qe.getTaskSessions({id:O})).sessions.map(rx);b($=>({...$,[O]:Q}))}catch{}},[]);return{sessions:t,sessionsLoading:o,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:y,spawn:N,sendInput:T,kill:C,stopGraceful:A,loadSessionEvents:I,clearEvents:E,loadTaskSessions:D,handleMessage:S,handleSessionEvent:k,handleLegacyMessage:j,domainHook:{onConnect:()=>y(),onDisconnect:()=>{E()},handleEvent:()=>!1}}}function ux(t){return t instanceof Ei?t.message:"Operation failed"}function Rz(){const[t,s]=x.useState([]),{loading:o,track:r}=la(),[c,d]=x.useState(!1),[u,p]=x.useState(""),m=x.useCallback(async()=>{try{const C=await r(Qe.listWorkspaces({}));s(C.workspaces.map(Tz))}catch{}},[r]),g=x.useCallback(C=>{switch(C.type){case"workspace.created":return d(!1),m().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return m().catch(()=>{}),!0;default:return!1}},[m]),v=x.useCallback(()=>{d(!1)},[]),b=x.useCallback(async(C,A,I,E,D,P,O,z,Q)=>{d(!0);try{await Qe.createWorkspace({name:C,description:A||"",repoUrl:I||"",environmentId:E||"",defaultPersonaId:D||void 0,useWorktrees:P??!0,workingDirectory:O||void 0}),d(!1),z==null||z()}catch($){d(!1);const J=$ instanceof Ei?$.message:"Failed to create workspace";Q==null||Q(J)}},[]),y=x.useCallback(async C=>{try{await Qe.archiveWorkspace({id:C})}catch{}},[]),S=x.useCallback(async(C,A)=>{try{await Qe.updateWorkspace({id:C,...A})}catch{}},[]),k=x.useCallback(()=>{p("")},[]),j=x.useCallback(async(C,A)=>{try{p(""),await Qe.linkEnvironment({workspaceId:C,environmentId:A}),await m().catch(()=>{})}catch(I){p(ux(I))}},[m]),N=x.useCallback(async(C,A)=>{try{p(""),await Qe.unlinkEnvironment({workspaceId:C,environmentId:A}),await m().catch(()=>{})}catch(I){p(ux(I))}},[m]);return{workspaces:t,workspacesLoading:o,workspaceCreating:c,loadWorkspaces:m,createWorkspace:b,archiveWorkspace:y,updateWorkspace:S,linkEnvironment:j,unlinkEnvironment:N,linkOperationError:u,clearLinkOperationError:k,handleEvent:g,onDisconnect:v,domainHook:{onConnect:()=>m(),onDisconnect:v,handleEvent:g}}}function Mz(){const[t,s]=x.useState([]),{loading:o,track:r}=la(),[c,d]=x.useState(void 0),u=x.useRef({}),p=x.useCallback(async E=>{try{const P=(await dn.listTasks({workspaceId:E})).tasks.map(lx);s(O=>[...O.filter(z=>z.workspaceId!==E),...P])}catch{}},[]),m=x.useCallback(async()=>{try{const D=(await r(dn.listTasks({}))).tasks.map(lx);s(P=>{const O=new Set(D.map(z=>z.id));return[...P.filter(z=>!O.has(z.id)),...D]})}catch{}},[r]),g=x.useCallback((E,D)=>{const P=O=>{clearTimeout(u.current[O]),u.current[O]=setTimeout(()=>{delete u.current[O],p(O).catch(()=>{})},200)};E?P(E):D&&s(O=>{const z=O.find(Q=>Q.id===D);return z!=null&&z.workspaceId?P(z.workspaceId):m().catch(()=>{}),O})},[p,m]),v=x.useCallback(E=>{const D=E.payload;switch(E.type){case"task.created":{const P=typeof D.workspaceId=="string"?D.workspaceId:"";return P&&p(P).catch(()=>{}),!0}case"task.started":{const P=typeof D.taskId=="string"?D.taskId:"",O=typeof D.sessionId=="string"?D.sessionId:"",z=typeof D.workspaceId=="string"?D.workspaceId:"";return d(Q=>P&&Q===P?void 0:Q),O&&P&&s(Q=>Q.map($=>$.id===P?{...$,latestSessionId:O}:$)),g(z,P),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const P=typeof D.workspaceId=="string"?D.workspaceId:"",O=typeof D.taskId=="string"?D.taskId:"";return d(z=>O&&z===O?void 0:z),g(P,O),!0}default:return!1}},[p,g]),b=x.useCallback(()=>{d(void 0)},[]),y=x.useCallback(E=>{var D,P;if(E.type==="tasks"){const O=Array.isArray((D=E.payload)==null?void 0:D.tasks)?E.payload.tasks:[],z=typeof((P=E.payload)==null?void 0:P.workspaceId)=="string"&&E.payload.workspaceId?E.payload.workspaceId:"";return s(z?Q=>[...Q.filter($=>$.workspaceId!==z),...O]:Q=>{const $=new Set(O.map(J=>J.id));return[...Q.filter(J=>!$.has(J.id)),...O]}),!0}return!1},[]),S=x.useCallback(async(E,D,P,O,z,Q,$,J,me)=>{try{await dn.createTask({workspaceId:E,title:D,description:P||"",dependsOn:O||[],parentTaskId:z||"",defaultPersonaId:Q||void 0,canDecompose:$??void 0}),J==null||J()}catch(te){const X=te instanceof Ei?te.message:"Failed to create task";me==null||me(X)}},[]),k=x.useCallback(async(E,D,P,O)=>{d(E);try{await dn.startTask({taskId:E,personaId:D||"",environmentId:P||"",notes:O||""})}catch(z){if(z instanceof Ei&&z.code===Tx.ResourceExhausted)return;d(void 0)}},[]),j=x.useCallback(async E=>{try{await dn.stopTask({id:E})}catch{}},[]),N=x.useCallback(async E=>{try{await dn.completeTask({id:E})}catch{}},[]),T=x.useCallback(async E=>{try{await dn.resumeTask({id:E})}catch{}},[]),C=x.useCallback(async(E,D,P,O,z)=>{try{await dn.updateTask({id:E,title:D,description:P,dependsOn:O,...z!==void 0?{defaultPersonaId:z}:{}})}catch{}},[]),A=x.useCallback(async E=>{try{await dn.deleteTask({id:E})}catch{}},[]);return{tasks:t,tasksLoading:o,taskStartingId:c,loadTasks:p,loadAllTasks:m,createTask:S,startTask:k,stopTask:j,completeTask:N,resumeTask:T,updateTask:C,deleteTask:A,handleEvent:v,onDisconnect:b,handleLegacyMessage:y,domainHook:{onConnect:()=>m(),onDisconnect:b,handleEvent:v}}}function Iz(){const[t,s]=x.useState([]),[o,r]=x.useState(void 0),[c,d]=x.useState(!1),{loading:u,track:p}=la(),m=x.useCallback(async k=>{try{const j=await p(dn.queryFindings({workspaceId:k}));s(j.findings.map(Ip))}catch{}},[p]),g=x.useCallback(async()=>{try{const k=await p(dn.queryFindings({workspaceId:""}));s(k.findings.map(Ip))}catch{}},[p]),v=x.useCallback(async k=>{r(void 0),d(!0);try{const j=await dn.getFinding({id:k});r(Ip(j))}catch{r(void 0)}finally{d(!1)}},[]),b=x.useCallback(k=>{if(k.type==="finding.posted"){const j=typeof k.payload.workspaceId=="string"?k.payload.workspaceId:"";return j&&m(j).catch(()=>{}),!0}return!1},[m]),y=x.useCallback(async(k,j,N,T,C)=>{try{await dn.postFinding({workspaceId:k,title:j,content:N,category:T??"general",tags:C??[]})}catch{}},[]);return{findings:t,selectedFinding:o,findingLoading:c,findingsLoading:u,loadFindings:m,loadAllFindings:g,loadFinding:v,postFinding:y,handleEvent:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:b}}}function Oz(){const[t,s]=x.useState([]),{loading:o,track:r}=la(),c=x.useCallback(async()=>{try{const g=await r(Qe.listTokens({}));s(g.tokens.map(jz))}catch{}},[r]),d=x.useCallback(g=>g.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=x.useCallback(async(g,v,b,y,S)=>{try{await Qe.setToken({name:g,value:v,type:b,envVar:y,filePath:S})}catch{}},[]),p=x.useCallback(async g=>{try{await Qe.deleteToken({name:g})}catch{}},[]);return{tokens:t,tokensLoading:o,loadTokens:c,setToken:u,deleteToken:p,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Bz(){const[t,s]=x.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:o,track:r}=la(),c=x.useCallback(async()=>{try{const m=await r(Qe.getCredentialProviders({}));s(wz(m))}catch{}},[r]),d=x.useCallback(m=>m.type==="credential.providers_changed"?(V7(m.payload)&&s(m.payload),!0):!1,[]),u=x.useCallback(async m=>{const g=[{provider:"claude",value:m.claude},{provider:"github",value:m.github},{provider:"copilot",value:m.copilot},{provider:"codex",value:m.codex},{provider:"goose",value:m.goose}];await Promise.allSettled(g.map(({provider:v,value:b})=>Qe.setCredentialProvider({provider:v,value:b})))},[]);return{credentialProviders:t,credentialsLoading:o,loadCredentials:c,updateCredentialProviders:u,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Lz(){const[t,s]=x.useState([]),[o,r]=x.useState(""),[c,d]=x.useState(""),[u,p]=x.useState(!1),m=x.useCallback(async()=>{try{const b=await Qe.listCodespaces({});s(b.codespaces.map(Nz)),d(b.error)}catch{}},[]),g=x.useCallback(async(b,y)=>{p(!0),r("");try{await Qe.createCodespace({repo:b,machine:y??""}),p(!1),await m()}catch(S){p(!1);const k=S instanceof Ei?S.message:"Failed to create codespace";r(k)}},[m]);return{codespaces:t,codespaceError:o,codespaceListError:c,codespaceCreating:u,listCodespaces:m,createCodespace:g,domainHook:{onConnect:()=>m(),onDisconnect:()=>{},handleEvent:()=>!1}}}function zz(){const[t,s]=x.useState([]),{loading:o,track:r}=la(),c=x.useCallback(async()=>{try{const v=await r(dn.listPersonas({}));s(v.personas.map(Op))}catch{}},[r]),d=x.useCallback(v=>{switch(v.type){case"persona.created":case"persona.updated":case"persona.deleted":return c().catch(()=>{}),!0;default:return!1}},[c]),u=x.useCallback(async(v,b,y,S,k,j,N,T,C)=>{const A=await dn.createPersona({name:v,description:b,systemPrompt:y,runtime:S||"",model:k||"",maxTurns:j||0,type:N||"agent",script:T||"",allowedMcpTools:C||[]}),I=Op(A);return s(E=>[...E.filter(D=>D.id!==I.id),I]),I},[]),p=x.useCallback(async(v,b,y,S,k,j,N,T,C,A)=>{const I={id:v};b!==void 0&&(I.name=b),y!==void 0&&(I.description=y),S!==void 0&&(I.systemPrompt=S),k!==void 0&&(I.runtime=k),j!==void 0&&(I.model=j),N!==void 0&&(I.maxTurns=N),T!==void 0&&(I.type=T),C!==void 0&&(I.script=C),A!==void 0&&(I.allowedMcpTools={tools:A});const E=await dn.updatePersona(I),D=Op(E);return s(P=>P.map(O=>O.id===D.id?D:O)),D},[]),m=x.useCallback(async v=>{await dn.deletePersona({id:v}),s(b=>b.filter(y=>y.id!==v))},[]);return{personas:t,personasLoading:o,loadPersonas:c,createPersona:u,updatePersona:p,deletePersona:m,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function $z(){const[t,s]=x.useState([]),{loading:o,track:r}=la(),c=x.useRef(void 0),d=x.useCallback(async()=>{try{const b=await r(Lc.listSchedules({}));s(b.schedules.map(Bp))}catch{}},[r]),u=x.useCallback(b=>{switch(b.type){case"schedule.created":case"schedule.updated":case"schedule.deleted":return d().catch(()=>{}),!0;case"schedule.fired":return clearTimeout(c.current),c.current=setTimeout(()=>{d().catch(()=>{})},500),!0;default:return!1}},[d]),p=x.useCallback(async(b,y,S,k,j,N,T)=>{const C=await Lc.createSchedule({title:b,description:y,scheduleExpression:S,personaId:k,environmentId:j||"",workspaceId:N||"",parentTaskId:T||""}),A=Bp(C);return s(I=>[...I.filter(E=>E.id!==A.id),A]),A},[]),m=x.useCallback(async(b,y)=>{const S={id:b};y.title!==void 0&&(S.title=y.title),y.description!==void 0&&(S.description=y.description),y.scheduleExpression!==void 0&&(S.scheduleExpression=y.scheduleExpression),y.personaId!==void 0&&(S.personaId=y.personaId),y.environmentId!==void 0&&(S.environmentId=y.environmentId),y.enabled!==void 0&&(S.enabled=y.enabled);const k=await Lc.updateSchedule(S),j=Bp(k);return s(N=>N.map(T=>T.id===j.id?j:T)),j},[]),g=x.useCallback(async b=>{await Lc.deleteSchedule({id:b}),s(y=>y.filter(S=>S.id!==b))},[]);return{schedules:t,schedulesLoading:o,loadSchedules:d,createSchedule:p,updateSchedule:m,deleteSchedule:g,handleEvent:u,domainHook:{onConnect:()=>d(),onDisconnect:()=>{clearTimeout(c.current)},handleEvent:u}}}function Uz(t){if(t)try{return JSON.parse(t)}catch{return}}function Pz(){const[t,s]=x.useState(new Map),[o,r]=x.useState([]),[c,d]=x.useState(void 0),[u,p]=x.useState(void 0),[m,g]=x.useState(!1),[v,b]=x.useState(""),y=x.useRef(""),S=x.useCallback(async E=>{const D=E??"";y.current=D,b(""),g(!0);try{const P=await zc.listRecentKnowledgeNodes({limit:30,workspaceId:D}),O=new Map,z=[];for(const Q of P.nodes)O.set(Q.id,Wc(Q));for(const Q of P.edges)z.push(Lp(Q));for(const Q of z){const $=O.get(Q.source);$&&($.val+=1);const J=O.get(Q.target);J&&(J.val+=1)}s(O),r(z)}catch{}finally{g(!1)}},[]),k=x.useCallback(async E=>{if(E.trim()){b(E),p(void 0),d(void 0),g(!0);try{const D=await zc.searchKnowledge({query:E,limit:20,workspaceId:y.current}),P=new Map,O=[];for(const z of D.results){z.node&&P.set(z.node.id,Wc(z.node,z.edges.length));for(const Q of z.edges)O.push(Lp(Q))}s(P),r(O)}catch{}finally{g(!1)}}},[]),j=x.useCallback(()=>{S(y.current).catch(()=>{})},[S]),N=x.useCallback(async E=>{p(E);try{const D=await zc.getKnowledgeNode({id:E});if(!D.node){d(void 0);return}d({node:Wc(D.node,D.edges.length),edges:D.edges.map(P=>({fromId:P.fromId,toId:P.toId,type:P.type,metadata:Uz(P.metadataJson)}))})}catch{d(void 0)}},[]),T=x.useCallback(()=>{p(void 0),d(void 0)},[]),C=x.useCallback(async E=>{try{const D=await zc.expandKnowledgeNode({id:E,depth:1});s(P=>{const O=new Map(P);for(const z of D.nodes)O.has(z.id)||O.set(z.id,Wc(z));return O}),r(P=>{const O=new Set(P.map(Q=>`${Q.source}:${Q.target}:${Q.type}`)),z=[];for(const Q of D.edges){const $=Lp(Q),J=`${$.source}:${$.target}:${$.type}`;O.has(J)||z.push($)}return[...P,...z]})}catch{}},[]),A=x.useCallback(E=>!1,[]),I={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:A};return{graphData:{nodes:[...t.values()],links:o},selectedNode:c,selectedId:u,loading:m,searchQuery:v,search:k,clearSearch:j,selectNode:N,clearSelection:T,expandNode:C,loadRecent:S,handleEvent:A,domainHook:I}}function Hz(){const t=x.useRef("default");x.useEffect(()=>{typeof Notification>"u"||(t.current=Notification.permission)},[]);function s(r){if(r.type!=="notification.escalated")return!1;if(typeof Notification>"u")return!0;if(t.current==="default")return Notification.requestPermission().then(u=>{t.current=u}).catch(()=>{}),!0;if(t.current!=="granted")return!0;const c=r.payload,d=new Notification(c.title||"Agent needs input",{body:c.message||"An agent is waiting for your input.",tag:c.escalationId,icon:"/icon-192x192.png"});return d.onclick=()=>{window.focus(),c.taskUrl&&(window.location.href=c.taskUrl),d.close()},!0}return{handleEvent:s,domainHook:{onConnect:async()=>{},onDisconnect:()=>{},handleEvent:s}}}function Vz(){const[t,s]=x.useState(""),[o,r]=x.useState(void 0),[c,d]=x.useState({}),{pluginNames:u}=gh(),p=_z(u),m=Ez(),g=Dz(),v=Rz(),b=Mz(),y=Iz(),S=Oz(),k=Bz(),j=Lz(),N=zz(),T=$z(),C=Pz(),A=Hz(),I=[...p.has("environments")?[m.domainHook]:[],...p.has("sessions")?[g.domainHook]:[],...p.has("workspaces")?[v.domainHook]:[],...p.has("tasks")?[b.domainHook]:[],...p.has("findings")?[y.domainHook]:[],...p.has("tokens")?[S.domainHook]:[],...p.has("credentials")?[k.domainHook]:[],...p.has("codespaces")?[j.domainHook]:[],...p.has("personas")?[N.domainHook]:[],...p.has("schedules")?[T.domainHook]:[],...p.has("knowledge")?[C.domainHook]:[],...p.has("notifications")?[A.domainHook]:[]],{connected:E}=hz({onSessionEvent:X=>{g.handleSessionEvent({sessionId:X.sessionId,eventType:jx(X.type),timestamp:X.timestamp,content:X.content,raw:X.raw||void 0})},onDomainEvent:X=>{try{const B=JSON.parse(X.payloadJson);$({id:X.id,type:X.type,timestamp:X.timestamp,payload:B})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",X.payloadJson)}},onConnect:J,onDisconnect:me}),D="default_persona_id",P="onboarding_completed",O=x.useCallback(async X=>{const B=await Qe.setSetting({key:D,value:X});s(B.value)},[]),z=x.useCallback(async()=>{r(!0);try{await Qe.setSetting({key:P,value:"true"})}catch{}},[]),Q=x.useCallback(async(X,B)=>{try{const F=await Qe.getUsage({scope:X,id:B}),Z=`${X}:${B}`;d(de=>({...de,[Z]:Cz(F)}))}catch{}},[]);function $(X){const B=X.payload.key,F=X.payload.value;if(X.type==="setting.changed"){B===D&&s(F??""),B===P&&r(F==="true");return}for(const Z of I)if(Z.handleEvent(X))break;(X.type==="environment.removed"||X.type==="environment.changed"||X.type==="task.started")&&g.loadSessions().catch(()=>{})}async function J(){for(const X of I)X.onConnect().catch(()=>{});try{const X=await Qe.getSetting({key:D});s(X.value)}catch{}try{const X=await Qe.getSetting({key:P});r(X.value==="true")}catch{}}function me(){I.forEach(X=>X.onDisconnect())}const te=x.useCallback(()=>{m.loadEnvironments().catch(()=>{}),g.loadSessions().catch(()=>{}),v.loadWorkspaces().catch(()=>{}),S.loadTokens().catch(()=>{})},[m.loadEnvironments,g.loadSessions,v.loadWorkspaces,S.loadTokens]);return{connected:E,environments:{environments:m.environments,environmentsLoading:m.environmentsLoading,provisionStatus:m.provisionStatus,operationError:m.operationError,clearOperationError:m.clearOperationError,loadEnvironments:m.loadEnvironments,addEnvironment:m.addEnvironment,updateEnvironment:m.updateEnvironment,provisionEnvironment:m.provisionEnvironment,stopEnvironment:m.stopEnvironment,removeEnvironment:m.removeEnvironment,domainHook:m.domainHook},sessions:{sessions:g.sessions,sessionsLoading:g.sessionsLoading,events:g.events,eventsDropped:g.eventsDropped,lastSpawnedId:g.lastSpawnedId,taskSessions:g.taskSessions,spawn:g.spawn,sendInput:g.sendInput,kill:g.kill,stopGraceful:g.stopGraceful,loadSessionEvents:g.loadSessionEvents,clearEvents:g.clearEvents,loadTaskSessions:g.loadTaskSessions,domainHook:g.domainHook},workspaces:{workspaces:v.workspaces,workspacesLoading:v.workspacesLoading,workspaceCreating:v.workspaceCreating,loadWorkspaces:v.loadWorkspaces,createWorkspace:v.createWorkspace,archiveWorkspace:v.archiveWorkspace,updateWorkspace:v.updateWorkspace,linkEnvironment:v.linkEnvironment,unlinkEnvironment:v.unlinkEnvironment,linkOperationError:v.linkOperationError,clearLinkOperationError:v.clearLinkOperationError,domainHook:v.domainHook},tasks:{tasks:b.tasks,tasksLoading:b.tasksLoading,taskStartingId:b.taskStartingId,loadTasks:b.loadTasks,loadAllTasks:b.loadAllTasks,createTask:b.createTask,startTask:b.startTask,stopTask:b.stopTask,completeTask:b.completeTask,resumeTask:b.resumeTask,updateTask:b.updateTask,deleteTask:b.deleteTask,domainHook:b.domainHook},findings:{findings:y.findings,selectedFinding:y.selectedFinding,findingLoading:y.findingLoading,findingsLoading:y.findingsLoading,loadFindings:y.loadFindings,loadAllFindings:y.loadAllFindings,loadFinding:y.loadFinding,postFinding:y.postFinding,domainHook:y.domainHook},tokens:{tokens:S.tokens,tokensLoading:S.tokensLoading,loadTokens:S.loadTokens,setToken:S.setToken,deleteToken:S.deleteToken,domainHook:S.domainHook},credentials:{credentialProviders:k.credentialProviders,credentialsLoading:k.credentialsLoading,updateCredentialProviders:k.updateCredentialProviders,domainHook:k.domainHook},codespaces:{codespaces:j.codespaces,codespaceError:j.codespaceError,codespaceListError:j.codespaceListError,codespaceCreating:j.codespaceCreating,listCodespaces:j.listCodespaces,createCodespace:j.createCodespace,domainHook:j.domainHook},personas:{personas:N.personas,personasLoading:N.personasLoading,createPersona:N.createPersona,updatePersona:N.updatePersona,deletePersona:N.deletePersona,domainHook:N.domainHook},schedules:{schedules:T.schedules,schedulesLoading:T.schedulesLoading,createSchedule:T.createSchedule,updateSchedule:T.updateSchedule,deleteSchedule:T.deleteSchedule,domainHook:T.domainHook},knowledge:C,appDefaultPersonaId:t,setAppDefaultPersonaId:O,onboardingCompleted:o,completeOnboarding:z,usageCache:c,loadUsage:Q,refresh:te}}function qz({children:t}){const s=Vz();return i.jsx(fh.Provider,{value:s,children:t})}function Gz(t,s){const o=x.useRef(null);x.useEffect(()=>{const r=o.current;if(o.current=t,r===null)return;const c=new Map;for(const u of r)c.set(u.id,u);const d=new Set;for(const u of t){d.add(u.id);const p=c.get(u.id);if(p&&p.status!==u.status&&u.status!=="sleeping"){if(u.status==="connecting"){s("Provisioning environment…","info");continue}u.status==="connected"?s("Environment connected","success"):u.status==="error"?s("Environment provision failed","error"):u.status==="disconnected"&&(p.status==="connected"?s("Environment disconnected","warning"):s("Environment stopped","info"))}}for(const u of r)d.has(u.id)||s("Environment removed","info")},[t,s])}function Fz(t,s,o){const r=x.useRef(t);x.useEffect(()=>{t&&t!==r.current&&(o(t,"error"),s()),r.current=t},[t,s,o])}const Zz={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 Kz(t){return Zz[t]}function Yz(t,s){if(t===void 0)return[];const o=[],r=new Map;for(const d of t)r.set(d.id,d);const c=new Set;for(const d of s){c.add(d.id);const u=r.get(d.id);if(!u||u.status===d.status)continue;const p=Kz(d.status);p&&o.push(p)}for(const d of t)c.has(d.id)||o.push({message:"Task deleted",variant:"info"});return o}function Jz(t,s){const o=x.useRef(void 0);x.useEffect(()=>{const r=o.current;o.current=t;const c=Yz(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const Wz="_dashboard_16pzm_1",Xz="_kpiStrip_16pzm_11",Qz="_kpiCard_16pzm_23",e$="_kpiValue_16pzm_68",t$="_kpiLabel_16pzm_76",n$="_bodyGrid_16pzm_84",s$="_section_16pzm_96",a$="_sectionHeader_16pzm_109",i$="_sectionIcon_16pzm_118",o$="_sectionTitle_16pzm_123",r$="_sectionCount_16pzm_131",l$="_sectionBody_16pzm_138",c$="_emptyHint_16pzm_143",d$="_sessionRow_16pzm_150",u$="_sessionPrompt_16pzm_177",f$="_sessionEnv_16pzm_186",p$="_sessionRuntime_16pzm_192",m$="_sessionStatus_16pzm_198",h$="_statusDot_16pzm_207",g$="_attentionRow_16pzm_233",v$="_attentionTitle_16pzm_259",y$="_attentionMeta_16pzm_267",b$="_reasonBadge_16pzm_274",x$="_bottomGrid_16pzm_301",_$="_envRow_16pzm_312",k$="_envName_16pzm_323",S$="_envStatusBadge_16pzm_333",T$="_workspaceRow_16pzm_369",j$="_workspaceTop_16pzm_395",w$="_workspaceName_16pzm_401",N$="_workspaceCounts_16pzm_407",C$="_progressBar_16pzm_415",E$="_progressFill_16pzm_422",pe={dashboard:Wz,kpiStrip:Xz,kpiCard:Qz,kpiValue:e$,kpiLabel:t$,bodyGrid:n$,section:s$,sectionHeader:a$,sectionIcon:i$,sectionTitle:o$,sectionCount:r$,sectionBody:l$,emptyHint:c$,sessionRow:d$,sessionPrompt:u$,sessionEnv:f$,sessionRuntime:p$,sessionStatus:m$,statusDot:h$,attentionRow:g$,attentionTitle:v$,attentionMeta:y$,reasonBadge:b$,bottomGrid:x$,envRow:_$,envName:k$,envStatusBadge:S$,workspaceRow:T$,workspaceTop:j$,workspaceName:w$,workspaceCounts:N$,progressBar:C$,progressFill:E$};function A$(){return i.jsxs("div",{className:pe.dashboard,"aria-hidden":"true",children:[i.jsx("div",{className:pe.kpiStrip,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:pe.kpiCard,children:[i.jsx(je,{width:"3rem",height:"2rem"}),i.jsx(je,{width:"80%",height:"0.75rem"})]},s))}),i.jsxs("div",{className:pe.bodyGrid,children:[i.jsxs("div",{className:pe.section,children:[i.jsxs("div",{className:pe.sectionHeader,children:[i.jsx(je,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(je,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:pe.sectionCount,children:i.jsx(je,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:pe.sectionBody,children:Array.from({length:3},(t,s)=>i.jsxs("div",{className:pe.sessionRow,style:{cursor:"default"},children:[i.jsx(je,{width:"60%",height:"0.875rem"}),i.jsx(je,{width:"4rem",height:"0.75rem"}),i.jsx(je,{width:"3rem",height:"0.75rem"}),i.jsx(je,{width:"3rem",height:"0.75rem"})]},s))})]}),i.jsxs("div",{className:pe.section,children:[i.jsxs("div",{className:pe.sectionHeader,children:[i.jsx(je,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(je,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:pe.sectionCount,children:i.jsx(je,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:pe.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:pe.attentionRow,style:{cursor:"default"},children:[i.jsxs("div",{className:pe.attentionTitle,children:[i.jsx(je,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"70%",height:"0.875rem"})]}),i.jsx("div",{className:pe.attentionMeta,children:i.jsx(je,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),i.jsxs("div",{className:pe.bottomGrid,children:[i.jsxs("div",{className:pe.section,children:[i.jsxs("div",{className:pe.sectionHeader,children:[i.jsx(je,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(je,{width:"9rem",height:"0.75rem"}),i.jsx("span",{className:pe.sectionCount,children:i.jsx(je,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:pe.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:pe.envRow,children:[i.jsx(je,{width:"60%",height:"0.875rem"}),i.jsx(je,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),i.jsxs("div",{className:pe.section,children:[i.jsxs("div",{className:pe.sectionHeader,children:[i.jsx(je,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(je,{width:"6rem",height:"0.75rem"}),i.jsx("span",{className:pe.sectionCount,children:i.jsx(je,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:pe.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:pe.workspaceRow,style:{cursor:"default"},children:[i.jsxs("div",{className:pe.workspaceTop,children:[i.jsx(je,{width:"50%",height:"0.875rem"}),i.jsx(je,{width:"2rem",height:"0.75rem"})]}),i.jsx("div",{className:pe.progressBar,children:i.jsx("div",{className:pe.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const D$={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Xc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function R$(t,s,o,r){const c=[`${t} of ${s} tasks completed`];return o>0&&c.push(`${o} in progress`),r>0&&c.push(`${r} failed`),c.join(", ")}function Qc({value:t,label:s,accent:o,index:r,testId:c}){return i.jsxs(Mt.div,{className:pe.kpiCard,"data-accent":o,"data-testid":c,variants:D$,initial:"hidden",animate:"visible",custom:r,children:[i.jsx("span",{className:pe.kpiValue,children:t}),i.jsx("span",{className:pe.kpiLabel,children:s})]})}function M$(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:o,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:p,environmentsLoading:m}}=dt(),g=mt(),v=x.useRef(new Set);x.useEffect(()=>{for(const N of t)v.current.has(N.id)||(v.current.add(N.id),c(N.id).catch(()=>{}))},[t,c]);const b=x.useMemo(()=>ez(d,o,p),[d,o,p]),y=x.useMemo(()=>nz(d,p),[d,p]),S=x.useMemo(()=>tz(o,t),[o,t]),k=x.useMemo(()=>sz(t,o),[t,o,p]);return d.length===0&&o.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?i.jsx(A$,{}):i.jsxs("div",{className:pe.dashboard,"data-testid":"dashboard",children:[i.jsxs("div",{className:pe.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[i.jsx(Qc,{value:b.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),i.jsx(Qc,{value:b.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),i.jsx(Qc,{value:b.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),i.jsx(Qc,{value:b.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),i.jsxs("div",{className:pe.bodyGrid,children:[i.jsxs(Mt.div,{className:pe.section,variants:Xc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[i.jsxs("div",{className:pe.sectionHeader,children:[i.jsx("span",{className:pe.sectionIcon,"aria-hidden":"true",children:"●"}),i.jsx("span",{className:pe.sectionTitle,children:"Active Sessions"}),i.jsx("span",{className:pe.sectionCount,children:y.length})]}),i.jsx("div",{className:pe.sectionBody,children:y.length===0?i.jsx("div",{className:pe.emptyHint,children:"No active sessions"}):y.map(({session:N,environmentName:T})=>i.jsxs("button",{type:"button",className:pe.sessionRow,onClick:()=>g(Cm(N.id)),"data-testid":"session-row",children:[i.jsx("span",{className:pe.sessionPrompt,title:N.prompt,children:N.prompt||"—"}),i.jsx("span",{className:pe.sessionEnv,children:T}),i.jsx("span",{className:pe.sessionRuntime,children:N.runtime}),i.jsxs("span",{className:pe.sessionStatus,children:[i.jsx("span",{className:pe.statusDot,"data-status":N.status}),N.status]})]},N.id))})]}),i.jsxs(Mt.div,{className:pe.section,variants:Xc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[i.jsxs("div",{className:pe.sectionHeader,children:[i.jsx("span",{className:pe.sectionIcon,"aria-hidden":"true",children:"⚑"}),i.jsx("span",{className:pe.sectionTitle,children:"Needs Attention"}),i.jsx("span",{className:pe.sectionCount,children:S.length})]}),i.jsx("div",{className:pe.sectionBody,children:S.length===0?i.jsx("div",{className:pe.emptyHint,children:"All clear"}):S.map(({task:N,reason:T,workspaceName:C})=>i.jsxs("button",{type:"button",className:pe.attentionRow,onClick:()=>g(On(N.id)),"data-testid":"attention-row",children:[i.jsxs("div",{className:pe.attentionTitle,children:[i.jsx("span",{className:pe.reasonBadge,"data-reason":T,children:T}),N.title]}),i.jsx("div",{className:pe.attentionMeta,children:i.jsx("span",{children:C})})]},N.id))})]})]}),i.jsxs("div",{className:pe.bottomGrid,children:[i.jsxs(Mt.div,{className:pe.section,variants:Xc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[i.jsxs("div",{className:pe.sectionHeader,children:[i.jsx("span",{className:pe.sectionIcon,"aria-hidden":"true",children:"◈"}),i.jsx("span",{className:pe.sectionTitle,children:"Environment Health"}),i.jsx("span",{className:pe.sectionCount,children:p.length})]}),i.jsx("div",{className:pe.sectionBody,children:p.length===0?i.jsx("div",{className:pe.emptyHint,children:"No environments configured"}):p.map(N=>i.jsxs("div",{className:pe.envRow,"data-testid":"dashboard-env-row",children:[i.jsx("span",{className:pe.envName,children:N.displayName}),i.jsx("span",{className:pe.envStatusBadge,"data-status":N.status,children:N.status})]},N.id))})]}),i.jsxs(Mt.div,{className:pe.section,variants:Xc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[i.jsxs("div",{className:pe.sectionHeader,children:[i.jsx("span",{className:pe.sectionIcon,"aria-hidden":"true",children:"▦"}),i.jsx("span",{className:pe.sectionTitle,children:"Workspaces"}),i.jsx("span",{className:pe.sectionCount,children:t.length})]}),i.jsx("div",{className:pe.sectionBody,children:k.length===0?i.jsx("div",{className:pe.emptyHint,children:"No workspaces yet"}):k.map(({workspace:N,totalTasks:T,completedTasks:C,workingTasks:A,failedTasks:I})=>{const E=T>0?Math.round(C/T*100):0;return i.jsxs("button",{type:"button",className:pe.workspaceRow,onClick:()=>g(Ga(N.id,N.environmentId)),"data-testid":"workspace-row",children:[i.jsxs("div",{className:pe.workspaceTop,children:[i.jsx("span",{className:pe.workspaceName,children:N.name}),i.jsxs("span",{className:pe.workspaceCounts,"aria-label":R$(C,T,A,I),children:[C,"/",T,A>0&&i.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",A]}),I>0&&i.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",I]})]})]}),T>0&&i.jsx("div",{className:pe.progressBar,children:i.jsx("div",{className:pe.progressFill,style:{width:`${E}%`}})})]},N.id)})})]})]})]})}const I$="_panelContainer_1udy7_1",O$="_emptyState_1udy7_8",B$="_workspaceSummary_1udy7_17",L$="_workspaceSummaryTitle_1udy7_28",z$="_workspaceSummarySubtitle_1udy7_32",$$="_header_1udy7_36",U$="_headerInfo_1udy7_71",P$="_headerTitle_1udy7_106",H$="_taskStatusBadge_1udy7_128",V$="_taskBranch_1udy7_137",q$="_taskBlockedBadge_1udy7_143",G$="_tabBar_1udy7_277",F$="_tab_1udy7_277",Z$="_active_1udy7_303",K$="_eventScroll_1udy7_308",Y$="_tabContent_1udy7_314",J$="_noContext_1udy7_319",W$="_overviewContent_1udy7_325",X$="_overviewDashboard_1udy7_334",Q$="_overviewHero_1udy7_340",eU="_overviewSection_1udy7_347",tU="_overviewLabel_1udy7_353",nU="_envRow_1udy7_360",sU="_timeline_1udy7_366",aU="_timelineRow_1udy7_372",iU="_waitingMessage_1udy7_379",oU="_errorMessage_1udy7_383",rU="_emptyCta_1udy7_387",lU="_ctaTitle_1udy7_399",cU="_ctaDescription_1udy7_405",dU="_ctaButton_1udy7_412",uU="_workspaceHeader_1udy7_533",fU="_workspaceName_1udy7_558",pU="_workspaceMeta_1udy7_571",mU="_metaRow_1udy7_579",hU="_metaLabel_1udy7_592",gU="_metaValue_1udy7_607",vU="_archiveButton_1udy7_617",yU="_repoLink_1udy7_647",bU="_metaToggle_1udy7_657",xU="_metaToggleArrow_1udy7_678",_U="_metaToggleArrowOpen_1udy7_683",kU="_progressBarContainer_1udy7_687",SU="_progressBar_1udy7_687",TU="_progressFill_1udy7_703",jU="_progressLabel_1udy7_710",wU="_metaTimestamps_1udy7_717",NU="_metaTimestamp_1udy7_717",CU="_metaPlaceholder_1udy7_739",EU="_linkedEnvList_1udy7_744",AU="_linkedEnvChip_1udy7_750",DU="_chipDismiss_1udy7_762",RU="_linkError_1udy7_777",MU="_linkEnvSelect_1udy7_782",Y={panelContainer:I$,emptyState:O$,workspaceSummary:B$,workspaceSummaryTitle:L$,workspaceSummarySubtitle:z$,header:$$,headerInfo:U$,headerTitle:P$,taskStatusBadge:H$,taskBranch:V$,taskBlockedBadge:q$,tabBar:G$,tab:F$,active:Z$,eventScroll:K$,tabContent:Y$,noContext:J$,overviewContent:W$,overviewDashboard:X$,overviewHero:Q$,overviewSection:eU,overviewLabel:tU,envRow:nU,timeline:sU,timelineRow:aU,waitingMessage:iU,errorMessage:oU,emptyCta:rU,ctaTitle:lU,ctaDescription:cU,ctaButton:dU,workspaceHeader:uU,workspaceName:fU,workspaceMeta:pU,metaRow:mU,metaLabel:hU,metaValue:gU,archiveButton:vU,repoLink:yU,metaToggle:bU,metaToggleArrow:xU,metaToggleArrowOpen:_U,progressBarContainer:kU,progressBar:SU,progressFill:TU,progressLabel:jU,metaTimestamps:wU,metaTimestamp:NU,metaPlaceholder:CU,linkedEnvList:EU,linkedEnvChip:AU,chipDismiss:DU,linkError:RU,linkEnvSelect:MU};function IU(){return i.jsx("div",{className:Y.emptyState,children:"Select a task or click + to create one"})}function OU(){return i.jsx("div",{className:Y.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function BU(){const{workspaces:{workspaces:t},environments:{environments:s}}=dt(),o=mt(),r=s.length>0;return t.length>0?i.jsx(M$,{}):i.jsxs("div",{className:Y.emptyCta,"data-testid":"welcome-cta",children:[i.jsx("div",{className:Y.ctaTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:Y.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),i.jsx("button",{className:Y.ctaButton,onClick:()=>o(Wx),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&i.jsx("div",{className:Y.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const LU="_panelContainer_19poq_1",zU="_chatHeader_19poq_8",$U="_chatHeaderInfo_19poq_37",UU="_emptyState_19poq_43",PU="_emptyTitle_19poq_55",HU="_emptyDescription_19poq_61",VU="_emptyHint_19poq_67",Ha={panelContainer:LU,chatHeader:zU,chatHeaderInfo:$U,emptyState:UU,emptyTitle:PU,emptyDescription:HU,emptyHint:VU};function qU(){return i.jsx("div",{className:Ha.panelContainer,"aria-hidden":"true",children:i.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(je,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function GU({hasLocalEnvironment:t}){return i.jsxs("div",{className:Ha.emptyState,"data-testid":"chat-empty-state",children:[i.jsx("div",{className:Ha.emptyTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:Ha.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&&i.jsx("div",{className:Ha.emptyHint,children:"Go to Settings → Environments to add one."})]})}function FU(){const{tasks:{tasks:t,tasksLoading:s,startTask:o},sessions:{sessions:r,sessionsLoading:c,events:d,eventsDropped:u,taskSessions:p,loadTaskSessions:m,loadSessionEvents:g,kill:v,stopGraceful:b,sendInput:y,spawn:S},environments:{environments:k,provisionEnvironment:j},personas:{personas:N}}=dt(),{showToast:T}=pn(),C=x.useRef(void 0),[A,I]=x.useState(),E=t.find(J=>J.id===Lr),D=E!=null&&E.latestSessionId?r.find(J=>J.id===E.latestSessionId)??(p[Lr]??[]).find(J=>J.id===E.latestSessionId):void 0;x.useEffect(()=>{m(Lr).catch(()=>{})},[m]),x.useEffect(()=>{E!=null&&E.latestSessionId&&m(Lr).catch(()=>{})},[E==null?void 0:E.latestSessionId,m]),x.useEffect(()=>{D&&D.id!==C.current&&(C.current=D.id,g(D.id).catch(()=>{}))},[D==null?void 0:D.id,g]);const P=x.useMemo(()=>{if(!D)return[];const J=d.filter(me=>me.sessionId===D.id);return hh(mh(J))},[d,D==null?void 0:D.id]),O=k.find(J=>J.adapterType==="local"&&J.status==="connected"),z=D!==void 0&&D.status!=="stopped"&&D.status!=="suspended",Q=(D==null?void 0:D.status)==="idle";x.useEffect(()=>{A&&D&&Q&&(y(D.id,A).catch(()=>{}),I(void 0))},[A,Q,D==null?void 0:D.id,y]);const $=x.useCallback((J,me,te,X)=>{X&&I(X),o(J,me,te).catch(()=>{})},[o]);return!E&&(c||s)?i.jsx(qU,{}):i.jsxs("div",{className:Ha.panelContainer,"data-testid":"chat-page",children:[z&&i.jsxs("div",{className:Ha.chatHeader,children:[i.jsxs("span",{className:Ha.chatHeaderInfo,children:["Session: ",D.id.slice(0,8)," | ",D.runtime," | ",D.status]}),i.jsx(Qx,{label:"Stop",onClick:()=>{b(D.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{b(D.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{v(D.id).catch(()=>{})}}]})]}),i.jsx(dh,{events:P,eventsDropped:u,emptyState:i.jsx(GU,{hasLocalEnvironment:!!O}),onShowToast:T}),O&&z&&i.jsx(al,{mode:"send",sessionId:D.id,environmentId:D.environmentId,personas:N,environments:k,onSendInput:(J,me)=>{y(J,me).catch(()=>{})},onSpawn:(J,me,te)=>{S(J,me,te).catch(()=>{})},onStartTask:(J,me,te)=>{o(J,me,te).catch(()=>{})},onProvisionEnvironment:J=>{j(J).catch(()=>{})},onShowToast:T}),O&&!z&&i.jsx(al,{mode:"start",taskId:Lr,environmentId:O.id,personas:N,environments:k,onSendInput:(J,me)=>{y(J,me).catch(()=>{})},onSpawn:(J,me,te)=>{S(J,me,te).catch(()=>{})},onStartTask:$,onProvisionEnvironment:J=>{j(J).catch(()=>{})},onShowToast:T})]})}function ZU(){const t=Z7(),[s]=Nm(),o=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=dt(),{showToast:g}=pn();return i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(vs,{segments:t}),i.jsx("div",{className:Y.emptyState,children:"Enter a prompt below to start a new session"}),i.jsx(al,{mode:"spawn",environmentId:o,showPersonaSelect:!0,personas:u,environments:p,onSendInput:(v,b)=>{r(v,b).catch(()=>{})},onSpawn:(v,b,y)=>{c(v,b,y).catch(()=>{})},onStartTask:(v,b,y)=>{d(v,b,y).catch(()=>{})},onProvisionEnvironment:v=>{m(v).catch(()=>{})},onShowToast:g})]})}function KU(){return i.jsxs("div",{className:Y.panelContainer,"aria-hidden":"true",children:[i.jsxs("div",{className:Y.header,children:[i.jsx("span",{children:i.jsx(je,{width:"10rem",height:"0.875rem"})}),i.jsx("span",{className:Y.headerInfo,children:i.jsx(je,{width:"16rem",height:"0.875rem"})})]}),i.jsx("div",{className:Y.eventScroll,children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(je,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function YU({sessionId:t,session:s,isActive:o,onStop:r,onKill:c}){return i.jsxs("div",{className:Y.header,children:[i.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.costMillicents?` | ${Oo((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${Ns(s.costMillicents??0)}`:""]}),i.jsxs("span",{className:Y.headerInfo,children:[s&&i.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),o&&i.jsx(Qx,{label:"Stop",onClick:r,variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:r},{label:"Kill",description:"Force kill",onClick:c}]})]})]})}function JU({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),o=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return i.jsx("div",{className:s?Y.errorMessage:Y.waitingMessage,children:o})}function WU(){const{sessionId:t}=as(),{sessions:{events:s,eventsDropped:o,sessions:r,sessionsLoading:c,kill:d,stopGraceful:u,loadSessionEvents:p,sendInput:m,spawn:g},tasks:{startTask:v},personas:{personas:b},environments:{environments:y,provisionEnvironment:S}}=dt(),{showToast:k}=pn(),j=x.useRef(void 0),N=K7(t),T=r.find(I=>I.id===t)??void 0,C=x.useMemo(()=>{const I=t?s.filter(E=>E.sessionId===t):[];return hh(mh(I))},[s,t]);if(x.useEffect(()=>{t&&t!==j.current&&(j.current=t,p(t).catch(()=>{}))},[t,p]),!T&&c)return i.jsx(KU,{});if(!t)return i.jsx("div",{className:Y.emptyState,children:"No session selected"});const A=(T==null?void 0:T.status)==="running"||(T==null?void 0:T.status)==="idle";return i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(vs,{segments:N}),i.jsx(YU,{sessionId:t,session:T,isActive:A,onStop:()=>{u(t).catch(()=>{})},onKill:()=>{d(t).catch(()=>{})}}),i.jsx(dh,{events:C,eventsDropped:o,emptyState:i.jsx(JU,{session:T}),onShowToast:k}),A&&i.jsx(al,{mode:"send",sessionId:t,environmentId:T.environmentId,personas:b,environments:y,onSendInput:(I,E)=>{m(I,E).catch(()=>{})},onSpawn:(I,E,D)=>{g(I,E,D).catch(()=>{})},onStartTask:(I,E,D)=>{v(I,E,D).catch(()=>{})},onProvisionEnvironment:I=>{S(I).catch(()=>{})},onShowToast:k})]})}function XU(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function na(t,s){const o=x.useRef(s);o.current=s;const{key:r,ctrl:c=!1,shift:d=!1,suppressInInputs:u=!0,enabled:p=!0}=t;x.useEffect(()=>{if(!p)return;const m=g=>{if(u&&XU(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(d&&!g.shiftKey||g.key===r&&o.current())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[r,c,d,u,p])}function QU(){return i.jsxs("div",{className:Y.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:Y.workspaceHeader,children:i.jsx("span",{className:Y.workspaceName,children:i.jsx(je,{width:"12rem",height:"1.25rem"})})}),i.jsx("div",{className:Y.metaToggle,style:{cursor:"default"},children:i.jsx(je,{width:"4rem",height:"0.625rem"})}),i.jsxs("div",{className:Y.progressBarContainer,children:[i.jsx("div",{className:Y.progressBar,children:i.jsx("div",{className:Y.progressFill,style:{width:"0%"}})}),i.jsx(je,{width:"2rem",height:"0.625rem"})]}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("span",{className:`${Y.tab} ${Y.active}`,children:"Graph"}),i.jsx("span",{className:Y.tab,children:"Board"}),i.jsx("span",{className:Y.tab,children:"Tasks"})]}),i.jsx("div",{className:Y.overviewContent,children:Array.from({length:3},(t,s)=>i.jsx(bd,{lines:2},s))})]})}function fx(t){if(!t)return"";const s=new Date(t);if(isNaN(s.getTime()))return"";const r=Date.now()-s.getTime();if(r<0)return"just now";const c=Math.floor(r/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const d=Math.floor(c/60);if(d<24)return`${d}h ago`;const u=Math.floor(d/24);return u<30?`${u}d ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const $p=100;function eP(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function tP(){const{workspaceId:t,environmentId:s}=as(),o=mt(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:p,updateWorkspace:m,linkEnvironment:g,unlinkEnvironment:v,linkOperationError:b,clearLinkOperationError:y},personas:{personas:S},sessions:{sessions:k},usageCache:j,loadUsage:N}=dt(),{resolvedThemeId:T}=J1(),[C,A]=x.useState("tasks"),[I,E]=x.useState(!1),[D,P]=x.useState(null),[O,z]=x.useState(!1),Q=x.useRef(void 0),$=d.find(W=>W.id===t),J=s??($==null?void 0:$.environmentId)??"",me=Y7(t,J,d,c);na({key:"1"},()=>A("graph")),na({key:"2"},()=>A("board")),na({key:"3"},()=>A("tasks")),x.useEffect(()=>{const W=Q.current;Q.current=t,!(W===void 0||W===t)&&D!==null&&P(null)},[t,D]);const te=k.reduce((W,ee)=>W+(ee.costMillicents??0),0);x.useEffect(()=>{t&&N("workspace",t).catch(()=>{})},[t,N,te]);const X=t?j[`workspace:${t}`]:void 0,B=r.filter(W=>W.workspaceId===t),F=B.filter(W=>W.status==="complete").length,Z=B.length,de=Z>0?Math.round(F/Z*100):0;return!$&&u?i.jsx(QU,{}):i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(vs,{segments:me}),i.jsxs("div",{className:Y.workspaceHeader,children:[i.jsx("span",{className:Y.workspaceName,"data-testid":"workspace-name",children:i.jsx(Ft,{value:($==null?void 0:$.name)||"",onSave:W=>{$&&m($.id,{name:W}).catch(()=>{})},validate:W=>{const ee=W.trim();if(!ee)return"Name is required";if(ee.length>$p)return`Max ${$p} characters`},maxLength:$p,fieldId:"name",activeFieldId:D,onActivate:P,ariaLabel:"Workspace name",renderDisplay:W=>W||t||void 0,"data-testid":"edit-name"})}),i.jsx("button",{className:Y.archiveButton,onClick:()=>E(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),i.jsxs("button",{className:Y.metaToggle,onClick:()=>z(!O),"aria-expanded":!O,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[i.jsx("span",{className:`${Y.metaToggleArrow} ${O?"":Y.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!O&&i.jsxs("div",{className:Y.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Description"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(dm,{value:($==null?void 0:$.description)||"",onSave:W=>{$&&m($.id,{description:W}).catch(()=>{})},fieldId:"description",activeFieldId:D,onActivate:P,renderDisplay:W=>W?i.jsx("span",{className:Y.overviewMarkdown,children:i.jsx(Td,{remarkPlugins:[jd],children:W})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Repository"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(Ft,{value:($==null?void 0:$.repoUrl)||"",onSave:W=>{$&&m($.id,{repoUrl:W}).catch(()=>{})},validate:W=>{const ee=W.trim();if(ee&&!/^https?:\/\/.+/.test(ee))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:D,onActivate:P,renderDisplay:W=>{const ee=eP(W);return ee?i.jsx("a",{className:Y.repoLink,href:ee,target:"_blank",rel:"noopener noreferrer",onClick:ue=>ue.stopPropagation(),children:W}):W?i.jsx("span",{children:W}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Environment"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(X6,{value:($==null?void 0:$.environmentId)||"",onSave:W=>{$&&W&&m($.id,{environmentId:W}).catch(()=>{})},environments:c,fieldId:"environmentId",activeFieldId:D,onActivate:P,placeholder:"Select environment",ariaLabel:"Workspace environment","data-testid":"edit-env"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Linked Envs"}),i.jsx("div",{className:Y.metaValue,"data-testid":"linked-environments",children:$?i.jsxs("span",{className:Y.linkedEnvList,children:[(()=>{const W=[...new Set($.linkedEnvironmentIds.filter(ee=>ee!==$.environmentId))];return W.length===0?i.jsx("span",{className:Y.metaPlaceholder,children:"None"}):W.map(ee=>{const ue=c.find(Ce=>Ce.id===ee);return i.jsxs("span",{className:Y.linkedEnvChip,"data-testid":`linked-env-${ee}`,children:[(ue==null?void 0:ue.displayName)||ee,i.jsx("button",{className:Y.chipDismiss,onClick:()=>{v($.id,ee).catch(()=>{})},title:`Unlink ${(ue==null?void 0:ue.displayName)||ee}`,"aria-label":`Unlink ${(ue==null?void 0:ue.displayName)||ee}`,"data-testid":`unlink-env-${ee}`,children:"x"})]},ee)})})(),(()=>{const W=new Set($.linkedEnvironmentIds),ee=c.filter(ue=>ue.id!==$.environmentId&&!W.has(ue.id));return ee.length===0?null:i.jsxs("select",{className:Y.linkEnvSelect,value:"",onChange:ue=>{ue.target.value&&g($.id,ue.target.value).catch(()=>{})},"aria-label":"Link environment","data-testid":"link-env-select",children:[i.jsx("option",{value:"",children:"+ Link"}),ee.map(ue=>i.jsx("option",{value:ue.id,children:ue.displayName||ue.id},ue.id))]})})(),b&&i.jsxs("span",{className:Y.linkError,"data-testid":"link-operation-error",role:"alert",children:[b,i.jsx("button",{className:Y.chipDismiss,onClick:y,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"x"})]})]}):i.jsx("span",{className:Y.metaPlaceholder,children:"None"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Persona"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(Uo,{value:($==null?void 0:$.defaultPersonaId)||"",onSave:W=>{$&&m($.id,{defaultPersonaId:W}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...S.map(W=>({value:W.id,label:W.name}))],fieldId:"defaultPersonaId",activeFieldId:D,onActivate:P,renderDisplay:W=>{const ee=S.find(ue=>ue.id===W);if(ee)return i.jsx("span",{children:ee.name})},placeholder:($==null?void 0:$.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Worktrees"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(q6,{checked:($==null?void 0:$.useWorktrees)??!0,onChange:W=>{$&&m($.id,{useWorktrees:W}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),i.jsxs("div",{className:Y.metaRow,children:[i.jsx("span",{className:Y.metaLabel,children:"Working Dir"}),i.jsx("div",{className:Y.metaValue,children:i.jsx(Ft,{value:($==null?void 0:$.workingDirectory)||"",onSave:W=>{$&&m($.id,{workingDirectory:W}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:D,onActivate:P,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),$&&i.jsxs("div",{className:Y.metaTimestamps,children:[i.jsxs("span",{className:Y.metaTimestamp,children:["Created ",fx($.createdAt)]}),$.updatedAt&&$.updatedAt!==$.createdAt&&i.jsxs("span",{className:Y.metaTimestamp,children:["· Updated ",fx($.updatedAt)]})]})]}),Z>0&&i.jsxs("div",{className:Y.progressBarContainer,"data-testid":"progress-bar",children:[i.jsx("div",{className:Y.progressBar,children:i.jsx("div",{className:Y.progressFill,style:{width:`${de}%`}})}),i.jsxs("span",{className:Y.progressLabel,children:[F,"/",Z]})]}),X&&X.costMillicents>0&&i.jsx("div",{className:Y.progressBarContainer,children:i.jsxs("span",{className:Y.progressLabel,children:["Usage: ",Ns(X.costMillicents)," (",X.sessionCount," session",X.sessionCount!==1?"s":"",")"]})}),$&&($.tokenBudget>0||$.costBudgetMillicents>0)&&i.jsx("div",{className:Y.progressBarContainer,children:i.jsxs("span",{className:Y.progressLabel,children:["Budget:"," ",$.tokenBudget>0&&i.jsxs(i.Fragment,{children:["Tokens: ",Oo(((X==null?void 0:X.inputTokens)??0)+((X==null?void 0:X.outputTokens)??0))," / ",Oo($.tokenBudget)]}),$.tokenBudget>0&&$.costBudgetMillicents>0&&" | ",$.costBudgetMillicents>0&&i.jsxs(i.Fragment,{children:["Cost: ",Ns((X==null?void 0:X.costMillicents)??0)," / ",Ns($.costBudgetMillicents)]})]})}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("button",{role:"tab","aria-selected":C==="graph",className:`${Y.tab} ${C==="graph"?Y.active:""}`,onClick:()=>A("graph"),children:"Graph"}),i.jsx("button",{role:"tab","aria-selected":C==="board",className:`${Y.tab} ${C==="board"?Y.active:""}`,onClick:()=>A("board"),"data-testid":"board-tab",children:"Board"}),i.jsx("button",{role:"tab","aria-selected":C==="tasks",className:`${Y.tab} ${C==="tasks"?Y.active:""}`,onClick:()=>A("tasks"),children:"Tasks"})]}),C==="tasks"&&Z>0&&i.jsxs("div",{className:Y.workspaceSummary,children:[i.jsx("span",{className:Y.workspaceSummaryTitle,children:`${F}/${Z} tasks complete`}),i.jsx("span",{className:Y.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),C==="tasks"&&Z===0&&i.jsxs("div",{className:Y.emptyCta,children:[i.jsx("button",{className:Y.ctaButton,onClick:()=>o(Ii(t,void 0,J)),children:"Create Task"}),i.jsx("div",{className:Y.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),C==="board"&&i.jsx(y7,{workspaceId:t,environmentId:J,tasks:r,sessions:k,personas:S,environments:c}),C==="graph"&&i.jsx(EN,{workspaceId:t,environmentId:J,tasks:r,resolvedThemeId:T}),i.jsx(ia,{isOpen:I,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{$&&(p($.id).catch(()=>{}),o("/",{replace:!0})),E(!1)},onCancel:()=>E(!1)})]})}const nP="_container_3pgew_1",sP="_header_3pgew_8",aP="_headerTitle_3pgew_35",iP="_headerActions_3pgew_44",oP="_body_3pgew_51",rP="_btnPrimary_3pgew_63",lP="_btnGhost_3pgew_94",cP="_error_3pgew_116",$a={container:nP,header:sP,headerTitle:aP,headerActions:iP,body:oP,btnPrimary:rP,btnGhost:lP,error:cP};function dP(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 uP=[{label:"Home",url:Di},{label:"New Workspace",url:void 0}];function fP(){const[t]=Nm(),s=t.get("environment")??void 0,{environments:{environments:o},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=dt(),{showToast:u}=pn(),p=mt(),[m,g]=x.useState(()=>{var N;return E7(void 0,s||((N=o[0])==null?void 0:N.id))}),[v,b]=x.useState(),[y,S]=x.useState();x.useEffect(()=>{s||m.environmentId||o.length===0||g(N=>{var T;return N.environmentId?N:{...N,environmentId:((T=o[0])==null?void 0:T.id)??""}})},[o,s,m.environmentId]);const k=()=>{const N=dP(m);if(N){b(N),S(void 0);return}b(void 0),S(void 0),c(m.name.trim(),m.description,m.repoUrl.trim(),m.environmentId,m.defaultPersonaId,m.useWorktrees,m.workingDirectory,()=>{u("Workspace created","success"),p(Di,{replace:!0})},T=>{S(T)}).catch(()=>{})},j=()=>{p(s?Ai(s):Di,{replace:!0})};return i.jsxs("div",{className:$a.container,children:[i.jsxs("div",{className:$a.header,children:[i.jsx("div",{className:$a.headerTitle,children:i.jsx(vs,{segments:uP})}),i.jsxs("div",{className:$a.headerActions,children:[i.jsx("button",{className:$a.btnGhost,onClick:j,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),i.jsx("button",{className:$a.btnPrimary,onClick:k,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?i.jsx(E1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),i.jsxs("div",{className:$a.body,children:[i.jsx(D7,{values:m,onChange:N=>{g(N),b(void 0),S(void 0)},environments:o,personas:r,errors:v,disabled:d,autoFocusName:!0}),y&&i.jsx("div",{className:$a.error,"data-testid":"workspace-create-submit-error",children:y})]})]})}function px(){const{workspaceId:t,environmentId:s}=as(),[o]=Nm(),r=t??o.get("workspace")??"",c=o.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:p},workspaces:{workspaces:m},personas:{personas:g}}=dt(),{showToast:v}=pn();return i.jsx(V1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(b,y,S,k,j,N,T,C,A)=>{u(b,y,S,k,j,N,T,C,A).catch(()=>{})},onUpdateTask:(b,y,S,k,j)=>{p(b,y,S,k,j).catch(()=>{})},onShowToast:v})}function pP(){return i.jsxs("div",{className:Y.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:Y.header,children:i.jsxs("span",{className:Y.headerTitle,children:[i.jsx(je,{width:"12rem",height:"1rem"}),i.jsx(je,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("span",{className:`${Y.tab} ${Y.active}`,children:"Overview"}),i.jsx("span",{className:Y.tab,children:"Stream"}),i.jsx("span",{className:Y.tab,children:"Findings"})]}),i.jsx("div",{className:Y.overviewContent,children:i.jsxs("div",{className:Y.overviewDashboard,children:[i.jsx("div",{className:Y.overviewHero,children:i.jsx(je,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Description"}),i.jsx(cm,{lines:2})]}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Environment"}),i.jsxs("div",{className:Y.envRow,children:[i.jsx(je,{width:"0.5rem",height:"0.5rem",variant:"circular"}),i.jsx(je,{width:"8rem",height:"0.875rem"})]})]}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Dependencies"}),i.jsx(cm,{lines:2})]}),i.jsxs("div",{className:Y.overviewSection,children:[i.jsx("div",{className:Y.overviewLabel,children:"Timeline"}),i.jsx("div",{className:Y.timeline,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:Y.timelineRow,children:[i.jsx(je,{width:"4rem",height:"0.75rem"}),i.jsx(je,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function Ua(){const{taskId:t,workspaceId:s,environmentId:o}=as(),r=Yt(),c=mt(),{showToast:d}=pn(),{sessions:{events:u,eventsDropped:p,sessions:m,loadSessionEvents:g,taskSessions:v,loadTaskSessions:b,sendInput:y,spawn:S,kill:k},tasks:{tasks:j,tasksLoading:N,startTask:T,stopTask:C,resumeTask:A,deleteTask:I,createTask:E,updateTask:D},environments:{environments:P,provisionEnvironment:O},findings:{findings:z,loadFindings:Q},workspaces:{workspaces:$},personas:{personas:J},usageCache:me,loadUsage:te}=dt(),X=x.useRef(void 0),B=x.useRef(void 0),F=x.useRef(void 0),Z=x.useRef(void 0),de=x.useRef(void 0),W=r.pathname.endsWith("/stream")?"stream":r.pathname.endsWith("/findings")?"findings":"overview",ee=r.pathname.endsWith("/edit"),[ue,Ce]=x.useState(W),[Pe,ge]=x.useState(!1),[Se,xe]=x.useState(void 0),[Be,It]=x.useState(""),[zn,re]=x.useState(ee),Ye=x.useRef(W),Pt=x.useRef(ee),ae=j.find(De=>De.id===t),wt=(ae==null?void 0:ae.workspaceId)||void 0,Ot=$.find(De=>De.id===wt);x.useEffect(()=>{W!==Ye.current&&(Ye.current=W,W!==ue&&Ce(W))},[W,ue]),x.useEffect(()=>{ee!==Pt.current&&(Pt.current=ee,ee!==zn&&re(ee))},[ee,zn]),x.useEffect(()=>{if(Be===""){if(Ot!=null&&Ot.environmentId)It(Ot.environmentId);else if(P.length>0){const De=P.find(Je=>Je.status==="connected");It((De==null?void 0:De.id)??P[0].id)}}},[Be,Ot==null?void 0:Ot.environmentId,P]);const Bt=ae?v[ae.id]??[]:[];let ze;Se&&Bt.some(De=>De.id===Se)?ze=Se:ze=(ae==null?void 0:ae.latestSessionId)||void 0;const sn=()=>{ge(!0)},ca=()=>{if(!ae)return;I(ae.id).catch(()=>{}),ge(!1);const De=o??(Ot==null?void 0:Ot.environmentId);c(ae.workspaceId&&De?Ga(ae.workspaceId,De):"/",{replace:!0})};x.useEffect(()=>{(ae==null?void 0:ae.id)!==B.current&&(B.current=ae==null?void 0:ae.id,xe(void 0),It(""),re(ee))},[ae==null?void 0:ae.id,ee]),x.useEffect(()=>{if(!(ae!=null&&ae.id))return;const De=ae.id!==Z.current,Je=ae.latestSessionId!==de.current;(De||Je)&&(Z.current=ae.id,de.current=ae.latestSessionId,b(ae.id).catch(()=>{}))},[ae==null?void 0:ae.id,ae==null?void 0:ae.latestSessionId,b]),x.useEffect(()=>{if((ae==null?void 0:ae.status)!==F.current){const De=F.current===void 0;F.current=ae==null?void 0:ae.status;const Je=(ae==null?void 0:ae.status)==="not_started"?"overview":(ae==null?void 0:ae.status)==="working"||(ae==null?void 0:ae.status)==="paused"?"stream":(ae==null?void 0:ae.status)==="complete"?"findings":void 0;Je&&Je!==ue&&!(De&&W!=="overview")&&Ce(Je)}},[ae==null?void 0:ae.status,ue,W]);const is=x.useMemo(()=>new Map(j.map(De=>[De.id,De])),[j]),Wa=x.useMemo(()=>{const De=ze?u.filter(Je=>Je.sessionId===ze):[];return hh(mh(De))},[u,ze]),da=ae?ae.dependsOn.some(De=>{const Je=is.get(De);return Je!==void 0&&Je.status!=="complete"}):!1,Jt=x.useMemo(()=>J7(t,o,$,P,is),[t,o,$,P,is]);x.useEffect(()=>{ze&&ze!==X.current&&(X.current=ze,g(ze).catch(()=>{}))},[ze,g]),x.useEffect(()=>{ue==="findings"&&wt&&Q(wt).catch(()=>{})},[ue,wt,Q]);const Bi=Bt.reduce((De,Je)=>De+(Je.costMillicents??0),0);x.useEffect(()=>{ae&&(te("task",ae.id).catch(()=>{}),ae.childTaskIds.length>0&&te("task_tree",ae.id).catch(()=>{}))},[ae==null?void 0:ae.id,ae==null?void 0:ae.childTaskIds.length,te,Bi]);const ua=ae?`task:${ae.id}`:"",Xa=ua in me?me[ua]:void 0,ys=ae?`task_tree:${ae.id}`:"",Li=ae&&ae.childTaskIds.length>0&&ys in me?me[ys]:void 0,$n=De=>{Ce(De),c(On(t,De==="overview"?void 0:De,s,o))};return na({key:"1"},()=>$n("overview")),na({key:"2"},()=>$n("stream")),na({key:"3"},()=>$n("findings")),!ae&&N?i.jsx(pP,{}):i.jsxs("div",{className:Y.panelContainer,children:[i.jsx(vs,{segments:Jt}),i.jsxs("div",{className:Y.header,children:[i.jsxs("span",{className:Y.headerTitle,children:[i.jsx("span",{"data-testid":"task-title",children:(ae==null?void 0:ae.title)||t}),ae&&i.jsx("span",{className:Y.taskStatusBadge,"data-testid":"task-status",children:ae.status}),(ae==null?void 0:ae.branch)&&i.jsx("span",{className:Y.taskBranch,children:ae.branch}),da&&i.jsx("span",{className:Y.taskBlockedBadge,children:"blocked"})]}),ae&&i.jsx(OB,{task:ae,sessionId:ze,isBlocked:da,onStart:()=>{T(ae.id,void 0,Be).catch(()=>{})},onResume:()=>{A(ae.id).catch(()=>{})},onStop:()=>{C(ae.id).catch(()=>{})},onPause:()=>{ze&&k(ze).catch(()=>{})},onDelete:sn,onEdit:()=>re(!0)})]}),i.jsxs("div",{className:Y.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("button",{role:"tab","aria-selected":ue==="overview",className:`${Y.tab} ${ue==="overview"?Y.active:""}`,onClick:()=>$n("overview"),children:"Overview"}),i.jsx("button",{role:"tab","aria-selected":ue==="stream",className:`${Y.tab} ${ue==="stream"?Y.active:""}`,onClick:()=>$n("stream"),children:"Stream"}),i.jsx("button",{role:"tab","aria-selected":ue==="findings",className:`${Y.tab} ${ue==="findings"?Y.active:""}`,onClick:()=>$n("findings"),children:"Findings"})]}),i.jsxs(gs,{mode:"wait",children:[ue==="overview"&&i.jsx(Mt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:Y.overviewContent,"data-testid":"task-overview",children:zn&&ae?i.jsx(V1,{mode:"edit",taskId:ae.id,workspaceId:wt,environmentId:o,tasks:j,workspaces:$,personas:J,onCreateTask:(De,Je,Wt,St,mn,Xt,zi,$i,Ui)=>{E(De,Je,Wt,St,mn,Xt,zi,$i,Ui).catch(()=>{})},onUpdateTask:(De,Je,Wt,St,mn)=>{D(De,Je,Wt,St,mn).catch(()=>{})},onEditDone:()=>{ee?c(On(ae.id,void 0,s,o),{replace:!0}):re(!1)},onShowToast:d}):ae?i.jsx(kL,{task:ae,tasksById:is,environments:P,workspaces:$,taskSessions:Bt,selectedEnvId:Be,taskUsage:Xa,treeUsage:Li}):i.jsx("div",{className:Y.waitingMessage,children:"No additional details"})},"overview"),ue==="stream"&&i.jsxs(Mt.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:[i.jsx(Y3,{taskSessions:Bt,selectedSessionId:ze,onSelect:De=>xe(De)}),i.jsx(dh,{events:Wa,eventsDropped:p,emptyState:!ze&&ae?da?i.jsx("div",{className:Y.emptyCta,"data-testid":"stream-blocked-message",children:i.jsx("div",{className:Y.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):i.jsxs("div",{className:Y.emptyCta,children:[i.jsx("button",{"data-testid":"stream-start-cta",className:Y.ctaButton,onClick:()=>{T(ae.id,void 0,Be).catch(()=>{})},children:"Start Task"}),i.jsx("div",{className:Y.ctaDescription,children:"Click to begin agent execution"})]}):ze&&Wa.length===0?i.jsx("div",{className:Y.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:d})]},"stream"),ue==="findings"&&i.jsx(Mt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:Y.tabContent,children:wt?i.jsx(P1,{findings:z.filter(De=>De.workspaceId===wt)}):i.jsx("div",{className:Y.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!ae||ae.status!=="working"&&ae.status!=="paused")return;const De=ze?m.find(Je=>Je.id===ze):void 0;if(!(!De||De.status==="stopped"))return i.jsx(al,{mode:"send",sessionId:De.id,environmentId:De.environmentId,personas:J,environments:P,onSendInput:(Je,Wt)=>{y(Je,Wt).catch(()=>{})},onSpawn:(Je,Wt,St)=>{S(Je,Wt,St).catch(()=>{})},onStartTask:(Je,Wt,St)=>{T(Je,Wt,St).catch(()=>{})},onProvisionEnvironment:Je=>{O(Je).catch(()=>{})},onShowToast:d})})(),ae&&i.jsx(ia,{isOpen:Pe,title:"Delete Task?",description:`"${ae.title}" will be permanently removed.`,onConfirm:ca,onCancel:()=>ge(!1)})]})}function mP(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:o},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:p,createCodespace:m}}=dt(),{showToast:g}=pn();return i.jsx(q1,{mode:"new",environments:t,onAddEnvironment:(v,b,y)=>{s(v,b,y).catch(()=>{})},onUpdateEnvironment:(v,b)=>{o(v,b).catch(()=>{})},onListCodespaces:()=>{p().catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(v,b)=>{m(v,b).catch(()=>{})},onShowToast:g})}function hP(){const{environmentId:t}=as(),{environments:{environments:s,addEnvironment:o,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,listCodespaces:m,createCodespace:g}}=dt(),{showToast:v}=pn();return i.jsx(q1,{mode:"edit",environmentId:t,environments:s,onAddEnvironment:(b,y,S)=>{o(b,y,S).catch(()=>{})},onUpdateEnvironment:(b,y)=>{r(b,y).catch(()=>{})},onListCodespaces:()=>{m().catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:(b,y)=>{g(b,y).catch(()=>{})},onShowToast:v})}const gP="_layout_11u79_1",vP="_content_11u79_8",yP="_tabPanel_11u79_14",sl={layout:gP,content:vP,tabPanel:yP};function bP(){const t=F7();return i.jsxs("div",{className:sl.layout,children:[i.jsx(vs,{segments:t}),i.jsx("div",{className:sl.content,children:i.jsx(Ya,{})})]})}const xP="_container_144a4_1",_P="_envHeader_144a4_6",kP="_envTitleRow_144a4_10",SP="_statusDot_144a4_16",TP="_envName_144a4_21",jP="_statusBadge_144a4_27",wP="_envMeta_144a4_33",NP="_metaTag_144a4_39",CP="_actions_144a4_51",EP="_provisionMessage_144a4_59",AP="_errorMessage_144a4_64",DP="_section_144a4_69",RP="_sectionHeader_144a4_73",MP="_cardList_144a4_121",IP="_card_144a4_121",OP="_cardHeader_144a4_138",BP="_cardName_144a4_144",LP="_cardActions_144a4_149",zP="_cardDescription_144a4_154",$P="_cardMeta_144a4_160",UP="_repoLink_144a4_166",PP="_empty_144a4_174",HP="_errorHint_144a4_180",VP="_btnPrimary_144a4_186",qP="_btnOutline_144a4_220",GP="_btnSmall_144a4_247",FP="_btnDanger_144a4_273",Te={container:xP,envHeader:_P,envTitleRow:kP,statusDot:SP,envName:TP,statusBadge:jP,envMeta:wP,metaTag:NP,actions:CP,provisionMessage:EP,errorMessage:AP,section:DP,sectionHeader:RP,cardList:MP,card:IP,cardHeader:OP,cardName:BP,cardActions:LP,cardDescription:zP,cardMeta:$P,repoLink:UP,empty:PP,errorHint:HP,btnPrimary:VP,btnOutline:qP,btnSmall:GP,btnDanger:FP};function ZP(){return i.jsxs("div",{className:Te.container,"aria-hidden":"true",children:[i.jsxs("div",{className:Te.envHeader,children:[i.jsxs("div",{className:Te.envTitleRow,children:[i.jsx(je,{width:"0.875rem",height:"0.875rem",variant:"circular"}),i.jsx(je,{width:"12rem",height:"1.5rem"}),i.jsx(je,{width:"4rem",height:"0.875rem"})]}),i.jsxs("div",{className:Te.envMeta,children:[i.jsx(je,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),i.jsxs("div",{className:Te.actions,children:[i.jsx(je,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),i.jsxs("div",{className:Te.section,children:[i.jsx("div",{className:Te.sectionHeader,children:i.jsx("h3",{style:{margin:0},children:"Workspaces"})}),i.jsxs("div",{className:Te.cardList,children:[i.jsx(bd,{lines:2}),i.jsx(bd,{lines:2})]})]})]})}const KP={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function YP(){const{environmentId:t}=as(),s=mt(),{environments:{environments:o,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:p},workspaces:{workspaces:m,archiveWorkspace:g,linkEnvironment:v,unlinkEnvironment:b,linkOperationError:y,clearLinkOperationError:S},sessions:{sessions:k}}=dt(),[j,N]=x.useState(!1),[T,C]=x.useState(!1),[A,I]=x.useState(void 0),E=o.find(Z=>Z.id===t);if(!E&&r)return i.jsx(ZP,{});if(!t||!E)return i.jsx(ts,{to:Io,replace:!0});const D=m.filter(Z=>Z.environmentId===E.id),P=m.filter(Z=>Z.linkedEnvironmentIds.includes(E.id)&&Z.environmentId!==E.id).filter((Z,de,W)=>W.findIndex(ee=>ee.id===Z.id)===de),O=k.filter(Z=>Z.environmentId===E.id),z=O.reduce((Z,de)=>Z+(de.costMillicents??0),0),Q=KP[E.status]||"var(--text-tertiary)",$=E.status==="connected",J=E.status==="connecting",me=E.status==="disconnected"||E.status==="error"||E.status==="sleeping",te=E.id in c?c[E.id]:void 0,X=()=>{p(E.id).catch(()=>{}),N(!1),s(Io,{replace:!0})},B=()=>{C(!1),d(E.id,!0).catch(()=>{})},F=Z=>{g(Z).catch(()=>{}),I(void 0)};return i.jsxs("div",{className:Te.container,children:[i.jsx(ia,{isOpen:j,title:"Delete Environment?",description:`"${E.displayName||E.id}" will be permanently removed along with all its data.`,onConfirm:X,onCancel:()=>N(!1)}),i.jsx(ia,{isOpen:T,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:B,onCancel:()=>C(!1)}),i.jsxs("div",{className:Te.envHeader,children:[i.jsxs("div",{className:Te.envTitleRow,children:[i.jsx("span",{className:Te.statusDot,style:{color:Q},children:"●"}),i.jsx("h2",{className:Te.envName,children:E.displayName||E.id}),i.jsx("span",{className:Te.statusBadge,style:{color:Q},children:E.status})]}),i.jsxs("div",{className:Te.envMeta,children:[i.jsxs("span",{className:Te.metaTag,children:["Adapter: ",E.adapterType]}),O.length>0&&i.jsxs("span",{className:Te.metaTag,children:[O.length," session",O.length!==1?"s":""]}),z>0&&i.jsxs("span",{className:Te.metaTag,children:["Cost: ",Ns(z)]})]})]}),i.jsxs("div",{className:Te.actions,children:[$&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:Te.btnPrimary,onClick:()=>s(Kx(E.id)),children:"New Chat"}),i.jsx("button",{className:Te.btnOutline,onClick:()=>{u(E.id).catch(()=>{})},children:"Stop"}),i.jsx("button",{className:Te.btnOutline,onClick:()=>C(!0),disabled:te!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),me&&i.jsx("button",{className:Te.btnPrimary,onClick:()=>{d(E.id).catch(()=>{})},children:E.status==="error"?"Retry":E.status==="sleeping"?"Wake":"Connect"}),J&&te!==void 0&&i.jsx("span",{className:Te.provisionMessage,children:te.message}),E.status==="error"&&(te==null?void 0:te.stage)==="error"&&i.jsx("span",{className:Te.errorMessage,children:te.message}),i.jsx("button",{className:Te.btnOutline,onClick:()=>s(yN(E.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),i.jsx("button",{className:Te.btnDanger,onClick:()=>N(!0),children:"Delete"})]}),i.jsxs("div",{className:Te.section,children:[i.jsxs("div",{className:Te.sectionHeader,children:[i.jsx("h3",{children:"Workspaces"}),i.jsx("button",{className:Te.btnPrimary,onClick:()=>s(`${Wx}?environment=${encodeURIComponent(E.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"})]}),D.length===0&&i.jsx("p",{className:Te.empty,children:"No workspaces yet. Create one to get started."}),i.jsx("div",{className:Te.cardList,children:D.map(Z=>i.jsx(JP,{workspace:Z,confirmArchiveId:A,onOpen:()=>s(Ga(Z.id,E.id)),onArchive:()=>I(Z.id),onConfirmArchive:()=>F(Z.id),onCancelArchive:()=>I(void 0)},Z.id))})]}),i.jsxs("div",{className:Te.section,children:[i.jsxs("div",{className:Te.sectionHeader,children:[i.jsx("h3",{children:"Linked Workspaces"}),(()=>{const Z=m.filter(de=>de.environmentId!==E.id&&!de.linkedEnvironmentIds.includes(E.id)&&de.status==="active");return Z.length===0?null:i.jsxs("select",{className:Te.btnPrimary,value:"",onChange:de=>{de.target.value&&v(de.target.value,E.id).catch(()=>{})},"aria-label":"Link a workspace","data-testid":"link-workspace-select",children:[i.jsx("option",{value:"",children:"+ Link Workspace"}),Z.map(de=>i.jsx("option",{value:de.id,children:de.name},de.id))]})})()]}),P.length===0&&i.jsx("p",{className:Te.empty,"data-testid":"linked-workspaces-empty",children:"No workspaces are linked to this environment."}),y&&i.jsxs("p",{className:Te.errorHint,"data-testid":"link-operation-error",role:"alert",children:[y,i.jsx("button",{className:Te.btnSmall,onClick:S,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"Dismiss"})]}),i.jsx("div",{className:Te.cardList,"data-testid":"linked-workspaces-list",children:P.map(Z=>{var de;return i.jsxs("div",{className:Te.card,"data-testid":`linked-workspace-card-${Z.id}`,children:[i.jsxs("div",{className:Te.cardHeader,children:[i.jsx("strong",{className:Te.cardName,children:Z.name}),i.jsxs("div",{className:Te.cardActions,children:[i.jsx("button",{className:Te.btnSmall,onClick:()=>s(Ga(Z.id,Z.environmentId)),children:"Open"}),i.jsx("button",{className:Te.btnSmall,onClick:()=>{b(Z.id,E.id).catch(()=>{})},"data-testid":`unlink-workspace-${Z.id}`,children:"Unlink"})]})]}),Z.description&&i.jsx("p",{className:Te.cardDescription,children:Z.description}),i.jsxs("div",{className:Te.cardMeta,children:["Primary: ",((de=o.find(W=>W.id===Z.environmentId))==null?void 0:de.displayName)||Z.environmentId]})]},Z.id)})})]})]})}function JP({workspace:t,confirmArchiveId:s,onOpen:o,onArchive:r,onConfirmArchive:c,onCancelArchive:d}){const u=s===t.id,p=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return i.jsxs("div",{className:Te.card,"data-testid":"workspace-card",children:[i.jsxs("div",{className:Te.cardHeader,children:[i.jsx("strong",{className:Te.cardName,children:t.name}),i.jsxs("div",{className:Te.cardActions,children:[i.jsx("button",{className:Te.btnSmall,onClick:o,children:"Open"}),u?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:Te.btnDanger,onClick:c,children:"Confirm"}),i.jsx("button",{className:Te.btnSmall,onClick:d,children:"Cancel"})]}):i.jsx("button",{className:Te.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&i.jsx("p",{className:Te.cardDescription,children:t.description}),t.repoUrl&&i.jsx("div",{className:Te.cardMeta,children:p?i.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Te.repoLink,children:t.repoUrl}):i.jsx("span",{children:t.repoUrl})})]})}const WP={credentials:"Credentials",personas:"Personas",schedules:"Schedules",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function XP(){const s=Yt().pathname.replace(/^\/settings\/?/,"").split("/")[0],o=WP[s],r=G7(o);return i.jsxs("div",{className:sl.layout,children:[i.jsx(vs,{segments:r}),i.jsx("div",{className:sl.content,children:i.jsx("div",{className:sl.tabPanel,children:i.jsx(Ya,{})},s)})]})}function QP(){const{tokens:{tokens:t,setToken:s,deleteToken:o},credentials:{credentialProviders:r,updateCredentialProviders:c}}=dt(),{showToast:d}=pn();return i.jsxs(i.Fragment,{children:[i.jsx(QL,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),i.jsx(rB,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{o(u).catch(()=>{})},onShowToast:d})]})}function e9(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:o,setAppDefaultPersonaId:r}=dt(),{showToast:c}=pn(),d=mt();return i.jsx(f8,{personas:t,appDefaultPersonaId:o,onDeletePersona:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete persona",{personaId:u,error:p}),c("Failed to delete persona","error"),p}},onSetAppDefaultPersonaId:async u=>{try{await r(u)}catch(p){console.error("Failed to set app default persona ID",{personaId:u,error:p}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>d(xN),onNavigateToPersona:u=>d(Yx(u))})}const t9="_container_1ooin_1",n9="_form_1ooin_7",s9="_formActions_1ooin_75",a9="_editableSection_1ooin_82",i9="_defaultBadge_1ooin_93",o9="_typeToggle_1ooin_107",r9="_scriptEditor_1ooin_121",l9="_optional_1ooin_128",ms={container:t9,form:n9,formActions:s9,editableSection:a9,defaultBadge:i9,typeToggle:o9,scriptEditor:r9,optional:l9},mx=[{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)"}],hx=[{value:"genaiscript",label:"genaiscript"}],c9="0";function gx(){const{personaId:t}=as(),s=mt(),{showToast:o}=pn(),{personas:{personas:r,createPersona:c,updatePersona:d,deletePersona:u},appDefaultPersonaId:p,setAppDefaultPersonaId:m}=dt(),g=t===void 0,v=g?void 0:r.find(y=>y.id===t);if(!g&&r.length>0&&!v)return i.jsx(ts,{to:ep,replace:!0});const b=[{label:"Settings",url:Ni},{label:"Personas",url:ep},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return i.jsxs("div",{className:ms.container,children:[i.jsx(vs,{segments:b}),i.jsx(d9,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(ep)},showToast:o})]})}function d9({existing:t,isNew:s,appDefaultPersonaId:o,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=mt(),[v,b]=x.useState((t==null?void 0:t.name)??""),[y,S]=x.useState((t==null?void 0:t.description)??""),[k,j]=x.useState((t==null?void 0:t.systemPrompt)??""),[N,T]=x.useState((t==null?void 0:t.runtime)??"claude-code"),[C,A]=x.useState((t==null?void 0:t.model)??"sonnet"),[I,E]=x.useState((t==null?void 0:t.maxTurns)??0),[D,P]=x.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[O,z]=x.useState((t==null?void 0:t.script)??""),[Q,$]=x.useState((t==null?void 0:t.allowedMcpTools)??[]),[J,me]=x.useState(!1),[te,X]=x.useState(null),[B,F]=x.useState(!!s);x.useEffect(()=>{if(!s&&t&&!B){F(!0),b(t.name),S(t.description),j(t.systemPrompt);const re=t.type==="script"?"script":"agent";T(re==="script"?t.runtime||"genaiscript":t.runtime),A(t.model),E(t.maxTurns),P(re),z(t.script||""),$(t.allowedMcpTools)}},[s,t,B]);const Z=re=>{P(re),re==="script"?T("genaiscript"):N==="genaiscript"&&T("claude-code")},de=!s&&t===void 0,W=v.trim().length>0&&!de&&k.trim().length>0&&(D==="script"?O.trim().length>0:!!N&&!!C),ee=s&&W,ue=!s&&o===(t==null?void 0:t.id),Ce=!s&&t&&!ue&&D==="agent"&&!!N&&!!C,Pe=(re,Ye)=>{if(!re.trim())return`${Ye} is required`},ge=re=>{if(re.preventDefault(),!(de||!W)){if(t){c(t.id,v,y,k,N,C,I,D,O).then(()=>{m("Persona updated","success"),p()},()=>{m("Failed to save persona","error")});return}r(v,y,k,N,C,I,D,O,Q).then(Ye=>{m("Persona created","success"),g(Yx(Ye.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},Se=()=>{t&&d(t.id).then(()=>{m("Persona deleted","success"),p()},()=>{m("Failed to delete persona","error")})},xe=async(re,Ye,Pt,ae)=>re().then(()=>{Ye(),m(Pt,"success")},()=>{m(ae,"error")}),Be=(re,Ye)=>{if(!t)return;const Pt=re==="type"?String(Ye):D,ae=re==="runtime"?String(Ye):re==="type"?String(Ye)==="script"?"genaiscript":N==="genaiscript"?"claude-code":N:N,wt=re==="model"?String(Ye):C,Ot=re==="maxTurns"?Number(Ye):I,Bt=re==="systemPrompt"?String(Ye):k,ze=re==="script"?String(Ye):O;xe(()=>c(t.id,re==="name"?String(Ye):v,re==="description"?String(Ye):y,Bt,ae,wt,Ot,Pt,ze),()=>{if(re==="type"){const sn=String(Ye)==="script"?"script":"agent";P(sn),T(ae)}re==="runtime"&&T(String(Ye)),re==="name"&&b(String(Ye)),re==="description"&&S(String(Ye)),re==="systemPrompt"&&j(String(Ye)),re==="model"&&A(String(Ye)),re==="maxTurns"&&E(Number(Ye)),re==="script"&&z(String(Ye))},"Persona updated","Failed to update persona").catch(()=>{})},It=re=>{ge(re)},zn=()=>{t&&u(t.id).then(()=>{m("Set as app default","success")},()=>{m("Failed to set app default","error")})};return i.jsxs(i.Fragment,{children:[de?i.jsxs("div",{className:ms.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsx("p",{children:"Loading persona..."})]}):s?i.jsxs("form",{onSubmit:It,className:ms.form,children:[i.jsx("h3",{children:"Create Persona"}),i.jsxs("div",{className:ms.typeToggle,"data-testid":"persona-type-toggle",children:[i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:D==="agent",onChange:()=>Z("agent")}),"Agent"]}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"script",checked:D==="script",onChange:()=>Z("script")}),"Script"]})]}),i.jsxs("label",{children:["Name",i.jsx("input",{type:"text",value:v,onChange:re=>b(re.target.value),placeholder:D==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),i.jsxs("label",{children:["Description",i.jsx("input",{type:"text",value:y,onChange:re=>S(re.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Runtime",i.jsx("select",{value:N,onChange:re=>T(re.target.value),"data-testid":"persona-runtime-select",children:(D==="script"?hx:mx).map(re=>i.jsx("option",{value:re.value,children:re.label},re.value))})]}),D==="agent"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model",i.jsx("input",{type:"text",value:C,onChange:re=>A(re.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["Max Turns",i.jsx("input",{type:"number",value:I,onChange:re=>E(parseInt(re.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:k,onChange:re=>j(re.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),D==="script"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model ",i.jsx("span",{className:ms.optional,children:"(optional)"}),i.jsx("input",{type:"text",value:C,onChange:re=>A(re.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:k,onChange:re=>j(re.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),i.jsxs("label",{children:["Script",i.jsx("textarea",{value:O,onChange:re=>z(re.target.value),placeholder:`script({ model: "openai:gpt-4o" });
|
|
707
|
-
|
|
708
|
-
const grackle = await host.mcpServer({
|
|
709
|
-
id: "grackle",
|
|
710
|
-
url: env.vars.GRACKLE_MCP_URL,
|
|
711
|
-
});
|
|
712
|
-
|
|
713
|
-
$\`Summarize the current tasks.\`;`,rows:20,className:ms.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),D==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(sx,{selectedTools:Q,onChange:$})]}),i.jsxs("div",{className:ms.formActions,children:[i.jsx(tn,{type:"submit",variant:"primary",size:"md",disabled:!ee,"data-testid":"persona-detail-save",children:"Create"}),i.jsx(tn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?i.jsxs("div",{className:ms.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsxs("div",{className:ms.formActions,children:[i.jsx(tn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),Ce&&i.jsx(tn,{type:"button",variant:"ghost",size:"md",onClick:zn,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),ue&&i.jsx("span",{className:ms.defaultBadge,children:"App Default"}),i.jsx(tn,{type:"button",variant:"danger",size:"md",onClick:()=>me(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:ms.editableSection,children:[i.jsxs("label",{children:["Name",i.jsx(Ft,{value:v,onSave:re=>{Be("name",re)},validate:re=>Pe(re,"Name"),fieldId:"persona-name",activeFieldId:te,onActivate:X,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),i.jsxs("label",{children:["Description",i.jsx(Ft,{value:y,onSave:re=>{Be("description",re)},fieldId:"persona-description",activeFieldId:te,onActivate:X,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Type",i.jsx(Uo,{value:D,onSave:re=>{Be("type",re)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:te,onActivate:X,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),i.jsxs("label",{children:["Runtime",i.jsx(Uo,{value:N,onSave:re=>{Be("runtime",re)},options:D==="script"?hx:mx,fieldId:"persona-runtime",activeFieldId:te,onActivate:X,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),i.jsxs("label",{children:["Model",D==="script"?" (optional)":"",i.jsx(Ft,{value:C,onSave:re=>{Be("model",re)},validate:D==="agent"?re=>Pe(re,"Model"):void 0,fieldId:"persona-model",activeFieldId:te,onActivate:X,placeholder:D==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["Max Turns",i.jsx(Ft,{value:String(I),onSave:re=>{Be("maxTurns",parseInt(re,10)||0)},validate:re=>/^\d+$/.test(re.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:te,onActivate:X,placeholder:c9,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx(dm,{value:k,onSave:re=>{Be("systemPrompt",re)},validate:re=>Pe(re,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:te,onActivate:X,placeholder:D==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),D==="script"&&i.jsxs("label",{children:["Script",i.jsx(dm,{value:O,onSave:re=>{Be("script",re)},validate:re=>Pe(re,"Script"),fieldId:"persona-script",activeFieldId:te,onActivate:X,placeholder:`script({ model: "openai:gpt-4o" });
|
|
714
|
-
|
|
715
|
-
const grackle = await host.mcpServer({
|
|
716
|
-
id: "grackle",
|
|
717
|
-
url: env.vars.GRACKLE_MCP_URL,
|
|
718
|
-
});
|
|
719
|
-
|
|
720
|
-
$\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),D==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(sx,{selectedTools:Q,onChange:re=>{$(re),xe(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,re),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Ce&&!ue&&i.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,i.jsx(ia,{isOpen:J,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:Se,onCancel:()=>me(!1)})]})}function u9(){const{schedules:{schedules:t,deleteSchedule:s,updateSchedule:o},personas:{personas:r}}=dt(),{showToast:c}=pn(),d=mt();return i.jsx(P8,{schedules:t,personas:r,onDeleteSchedule:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete schedule",{scheduleId:u,error:p}),c("Failed to delete schedule","error"),p}},onToggleEnabled:async(u,p)=>{try{return await o(u,p)}catch(m){throw console.error("Failed to update schedule",{scheduleId:u,error:m}),c("Failed to update schedule","error"),m}},onNavigateToNew:()=>d(_N),onNavigateToSchedule:u=>d(Jx(u))})}const f9="_container_1g4qh_1",p9="_form_1g4qh_7",m9="_formActions_1g4qh_66",h9="_editableSection_1g4qh_73",g9="_helperText_1g4qh_84",v9="_metaSection_1g4qh_90",y9="_optional_1g4qh_108",b9="_readonlyValue_1g4qh_113",yn={container:f9,form:p9,formActions:m9,editableSection:h9,helperText:g9,metaSection:v9,optional:y9,readonlyValue:b9};function vx(){const{scheduleId:t}=as(),s=mt(),{showToast:o}=pn(),{schedules:{schedules:r,schedulesLoading:c,createSchedule:d,updateSchedule:u,deleteSchedule:p},personas:{personas:m},environments:{environments:g},workspaces:{workspaces:v}}=dt(),b=t===void 0,y=b?void 0:r.find(k=>k.id===t);if(!b&&!c&&r.length>0&&!y)return i.jsx(ts,{to:tp,replace:!0});const S=[{label:"Settings",url:Ni},{label:"Schedules",url:tp},{label:b?"New Schedule":(y==null?void 0:y.title)??"Schedule",url:void 0}];return i.jsxs("div",{className:yn.container,children:[i.jsx(vs,{segments:S}),i.jsx(x9,{existing:y,isNew:b,personas:m,environments:g,workspaces:v,onCreateSchedule:d,onUpdateSchedule:u,onDeleteSchedule:p,onDone:()=>{s(tp)},showToast:o})]})}function x9({existing:t,isNew:s,personas:o,environments:r,workspaces:c,onCreateSchedule:d,onUpdateSchedule:u,onDeleteSchedule:p,onDone:m,showToast:g}){var W;const v=mt(),[b,y]=x.useState((t==null?void 0:t.title)??""),[S,k]=x.useState((t==null?void 0:t.description)??""),[j,N]=x.useState((t==null?void 0:t.scheduleExpression)??""),[T,C]=x.useState((t==null?void 0:t.personaId)??""),[A,I]=x.useState((t==null?void 0:t.environmentId)??""),[E,D]=x.useState((t==null?void 0:t.workspaceId)??""),[P,O]=x.useState(!1),[z,Q]=x.useState(null);x.useEffect(()=>{s||t&&z===null&&(y(t.title),k(t.description),N(t.scheduleExpression),C(t.personaId),I(t.environmentId),D(t.workspaceId))},[s,t,z]);const $=!s&&t===void 0,J=s&&b.trim().length>0&&j.trim().length>0&&T.length>0,me=o.map(ee=>({value:ee.id,label:ee.name})),te=[{value:"",label:"Auto-select (first connected)"},...r.map(ee=>({value:ee.id,label:ee.displayName}))],X=[{value:"",label:"System-level (no workspace)"},...c.map(ee=>({value:ee.id,label:ee.name}))],B=ee=>{ee.preventDefault(),J&&d(b,S,j,T,A||void 0,E||void 0).then(ue=>{g("Schedule created","success"),v(Jx(ue.id),{replace:!0})},()=>{g("Failed to create schedule","error")})},F=(ee,ue)=>{t&&u(t.id,{[ee]:ue}).then(()=>{g("Schedule updated","success"),ee==="title"&&y(String(ue)),ee==="description"&&k(String(ue)),ee==="scheduleExpression"&&N(String(ue)),ee==="personaId"&&C(String(ue)),ee==="environmentId"&&I(String(ue))},()=>{g("Failed to update schedule","error")})},Z=()=>{if(!t)return;const ee=!t.enabled;u(t.id,{enabled:ee}).then(()=>{g(ee?"Schedule enabled":"Schedule disabled","success")},()=>{g("Failed to update schedule","error")})},de=()=>{t&&p(t.id).then(()=>{g("Schedule deleted","success"),m()},()=>{g("Failed to delete schedule","error")})};return i.jsxs(i.Fragment,{children:[$?i.jsxs("div",{className:yn.form,children:[i.jsx("h3",{children:"Edit Schedule"}),i.jsx("p",{children:"Loading schedule..."})]}):s?i.jsxs("form",{onSubmit:B,className:yn.form,children:[i.jsx("h3",{children:"Create Schedule"}),i.jsxs("label",{children:["Title",i.jsx("input",{type:"text",value:b,onChange:ee=>y(ee.target.value),placeholder:"e.g. Nightly Review",required:!0,"data-testid":"schedule-detail-title"})]}),i.jsxs("label",{children:["Description ",i.jsx("span",{className:yn.optional,children:"(optional)"}),i.jsx("input",{type:"text",value:S,onChange:ee=>k(ee.target.value),placeholder:"Brief description...","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx("input",{type:"text",value:j,onChange:ee=>N(ee.target.value),placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",required:!0,"data-testid":"schedule-detail-expression"}),i.jsxs("p",{className:yn.helperText,children:["Interval: ",i.jsx("code",{children:"30s"}),", ",i.jsx("code",{children:"5m"}),", ",i.jsx("code",{children:"1h"}),", ",i.jsx("code",{children:"1d"})," (min 10s) | Cron: ",i.jsx("code",{children:"0 9 * * MON"})," (standard 5-field cron syntax)"]})]}),i.jsxs("label",{children:["Persona",i.jsxs("select",{value:T,onChange:ee=>C(ee.target.value),required:!0,"data-testid":"schedule-detail-persona",children:[i.jsx("option",{value:"",children:"Select a persona..."}),me.map(ee=>i.jsx("option",{value:ee.value,children:ee.label},ee.value))]})]}),i.jsxs("label",{children:["Environment ",i.jsx("span",{className:yn.optional,children:"(optional)"}),i.jsx("select",{value:A,onChange:ee=>I(ee.target.value),"data-testid":"schedule-detail-environment",children:te.map(ee=>i.jsx("option",{value:ee.value,children:ee.label},ee.value))})]}),i.jsxs("label",{children:["Workspace ",i.jsx("span",{className:yn.optional,children:"(optional)"}),i.jsx("select",{value:E,onChange:ee=>D(ee.target.value),"data-testid":"schedule-detail-workspace",children:X.map(ee=>i.jsx("option",{value:ee.value,children:ee.label},ee.value))})]}),i.jsxs("div",{className:yn.formActions,children:[i.jsx(tn,{type:"submit",variant:"primary",size:"md",disabled:!J,"data-testid":"schedule-detail-save",children:"Create"}),i.jsx(tn,{type:"button",variant:"outline",size:"md",onClick:m,"data-testid":"schedule-detail-cancel",children:"Cancel"})]})]}):t?i.jsxs("div",{className:yn.form,children:[i.jsx("h3",{children:"Edit Schedule"}),i.jsxs("div",{className:yn.formActions,children:[i.jsx(tn,{type:"button",variant:"outline",size:"md",onClick:m,"data-testid":"schedule-detail-cancel",children:"Back to Schedules"}),i.jsx(tn,{type:"button",variant:t.enabled?"ghost":"primary",size:"md",onClick:Z,"data-testid":"schedule-detail-toggle",children:t.enabled?"Disable":"Enable"}),i.jsx(tn,{type:"button",variant:"danger",size:"md",onClick:()=>O(!0),"data-testid":"schedule-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:yn.editableSection,children:[i.jsxs("label",{children:["Title",i.jsx(Ft,{value:b,onSave:ee=>{F("title",ee)},validate:ee=>ee.trim()?void 0:"Title is required",fieldId:"schedule-title",activeFieldId:z,onActivate:Q,ariaLabel:"Schedule title","data-testid":"schedule-detail-title"})]}),i.jsxs("label",{children:["Description",i.jsx(Ft,{value:S,onSave:ee=>{F("description",ee)},fieldId:"schedule-description",activeFieldId:z,onActivate:Q,placeholder:"Brief description...",ariaLabel:"Schedule description","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx(Ft,{value:j,onSave:ee=>{F("scheduleExpression",ee)},validate:ee=>ee.trim()?void 0:"Schedule expression is required",fieldId:"schedule-expression",activeFieldId:z,onActivate:Q,placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",ariaLabel:"Schedule expression","data-testid":"schedule-detail-expression"})]}),i.jsxs("label",{children:["Persona",i.jsx(Uo,{value:T,onSave:ee=>{F("personaId",ee)},options:me,fieldId:"schedule-persona",activeFieldId:z,onActivate:Q,ariaLabel:"Schedule persona","data-testid":"schedule-detail-persona"})]}),i.jsxs("label",{children:["Environment ",i.jsx("span",{className:yn.optional,children:"(optional — empty = auto-select)"}),i.jsx(Uo,{value:A,onSave:ee=>{F("environmentId",ee)},options:te,fieldId:"schedule-environment",activeFieldId:z,onActivate:Q,ariaLabel:"Schedule environment","data-testid":"schedule-detail-environment"})]}),i.jsxs("label",{children:["Workspace ",i.jsx("span",{className:yn.optional,children:"(optional — set at creation)"}),i.jsx("span",{className:yn.readonlyValue,"data-testid":"schedule-detail-workspace",children:((W=c.find(ee=>ee.id===t.workspaceId))==null?void 0:W.name)??"System-level (no workspace)"})]})]}),i.jsxs("div",{className:yn.metaSection,children:[t.lastRunAt?i.jsxs("span",{children:["Last run: ",Po(t.lastRunAt)]}):i.jsx("span",{children:"Last run: Never"}),t.enabled&&t.nextRunAt?i.jsxs("span",{children:["Next run: ",B1(t.nextRunAt)]}):null,t.runCount>0&&i.jsxs("span",{children:["Total runs: ",t.runCount]}),i.jsxs("span",{children:["Created: ",Po(t.createdAt)]})]})]}):null,i.jsx(ia,{isOpen:P,title:"Delete Schedule?",description:`"${t==null?void 0:t.title}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:de,onCancel:()=>O(!1)})]})}function _9(){const{themeId:t,resolvedThemeId:s,setTheme:o,preferSystem:r,setPreferSystem:c}=J1();return i.jsx(lB,{themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c})}function k9(){const[t,s]=x.useState(void 0);return x.useEffect(()=>{let o=!1;return(async()=>{try{const c=await Qe.getVersionStatus({});o||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{o=!0}},[]),t}function S9(){const{connected:t,environments:{environments:s},sessions:{sessions:o}}=dt(),r=k9();return i.jsxs(i.Fragment,{children:[r&&i.jsx(fO,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),i.jsx(cB,{connected:t,environments:s,sessions:o})]})}function T9(){return i.jsx(WL,{})}const yx=Ii();function j9(){const t=mt();return na({key:"?"},()=>{t(kN)}),na({key:"n"},()=>{t(yx)}),na({key:"N"},()=>{t(yx)}),i.jsx(i.Fragment,{})}function xl(t){const s=U7();x.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function w9(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=dt(),o=x.useMemo(()=>i.jsx(H5,{workspaces:t,tasks:s}),[t,s]);return xl(o),i.jsx(Ya,{})}function N9(){const{environments:{environments:t}}=dt(),s=x.useMemo(()=>i.jsx(XI,{environments:t}),[t]);return xl(s),i.jsx(Ya,{})}function C9(){const t=x.useMemo(()=>i.jsx(F8,{}),[]);return xl(t),i.jsx(Ya,{})}function E9(){const{findings:{findings:t,loadFindings:s,loadAllFindings:o}}=dt(),{workspaceId:r,environmentId:c}=as();x.useEffect(()=>{r?s(r).catch(()=>{}):o().catch(()=>{})},[r,s,o]);const d=x.useMemo(()=>i.jsx(c5,{findings:t,workspaceId:r,environmentId:c}),[t,r,c]);return xl(d),i.jsx(Ya,{})}function A9(){const{knowledge:t,workspaces:{workspaces:s}}=dt(),o=x.useCallback(p=>{t.search(p).catch(()=>{})},[t]),r=x.useCallback(()=>{t.clearSearch()},[t]),c=x.useCallback(p=>{t.selectNode(p).catch(()=>{})},[t]),d=x.useCallback(p=>{t.loadRecent(p||void 0).catch(()=>{})},[t]),u=x.useMemo(()=>i.jsx(uI,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:o,onClearSearch:r,onSelectNode:c,onWorkspaceChange:d}),[t,s,o,r,c,d]);return xl(u),i.jsx(Ya,{})}const D9="_container_ce571_1",R9="_title_ce571_6",kd={container:D9,title:R9};function M9(){return i.jsxs("div",{className:kd.container,"aria-hidden":"true",children:[i.jsx("h1",{className:kd.title,children:"Findings"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:Array.from({length:4},(t,s)=>i.jsx(bd,{lines:3},s))})]})}function bx(){const{environmentId:t,workspaceId:s}=as(),{findings:{findings:o,findingsLoading:r,loadFindings:c},workspaces:{workspaces:d},environments:{environments:u}}=dt(),p=mt();x.useEffect(()=>{s&&c(s).catch(()=>{})},[s,c]);const m=x.useCallback(v=>{p(Gp(v,s,t))},[p,s,t]);if(r)return i.jsx(M9,{});const g=s&&t?sk("Findings",s,t,d,u).slice(0,-1):X7();return i.jsxs("div",{className:kd.container,"data-testid":"findings-list-page",children:[i.jsx(vs,{segments:g}),i.jsx("h1",{className:kd.title,children:"Findings"}),i.jsx(P1,{findings:o,onFindingClick:m})]})}const I9="_container_1wwpb_1",O9="_notFound_1wwpb_6",B9="_header_1wwpb_12",L9="_categoryBadge_1wwpb_19",z9="_title_1wwpb_28",$9="_content_1wwpb_35",U9="_tags_1wwpb_77",P9="_tag_1wwpb_77",H9="_meta_1wwpb_92",V9="_metaTimestamp_1wwpb_100",q9="_metaLink_1wwpb_105",vn={container:I9,notFound:O9,header:B9,categoryBadge:L9,title:z9,content:$9,tags:U9,tag:P9,meta:H9,metaTimestamp:V9,metaLink:q9};function xx(){const{findingId:t,environmentId:s,workspaceId:o}=as(),{findings:{selectedFinding:r,findingLoading:c,loadFinding:d},workspaces:{workspaces:u},environments:{environments:p}}=dt(),m=mt();if(x.useEffect(()=>{t&&d(t).catch(()=>{})},[t,d]),c)return i.jsx("div",{className:vn.container,"data-testid":"finding-detail-page",children:i.jsx("div",{className:vn.notFound,children:"Loading..."})});if(!r)return i.jsx("div",{className:vn.container,"data-testid":"finding-detail-page",children:i.jsx("div",{className:vn.notFound,children:"Finding not found."})});const g=sk(r.title,o,s,u,p),v=xd(r.category);return i.jsxs("div",{className:vn.container,"data-testid":"finding-detail-page",children:[i.jsx(vs,{segments:g}),i.jsxs("div",{className:vn.header,children:[i.jsx("span",{className:vn.categoryBadge,style:{background:v.bg,color:v.text},children:r.category}),i.jsx("h1",{className:vn.title,children:r.title})]}),r.content&&i.jsx("div",{className:vn.content,children:i.jsx(Td,{remarkPlugins:[jd],children:r.content})}),r.tags.length>0&&i.jsx("div",{className:vn.tags,children:r.tags.map(b=>i.jsx("span",{className:vn.tag,children:b},b))}),i.jsxs("div",{className:vn.meta,children:[i.jsx("span",{className:vn.metaTimestamp,title:r.createdAt,children:Po(r.createdAt)}),r.taskId&&i.jsx("button",{type:"button",className:vn.metaLink,onClick:()=>{m(On(r.taskId))},children:"View Task"}),r.sessionId&&i.jsx("button",{type:"button",className:vn.metaLink,onClick:()=>{m(Cm(r.sessionId))},children:"View Session"})]})]})}const G9="_wizard_1260s_1",F9="_container_1260s_10",Z9="_stepContent_1260s_19",K9="_logoArea_1260s_28",Y9="_logoImage_1260s_32",J9="_heading_1260s_41",W9="_tagline_1260s_49",X9="_subtitle_1260s_56",Q9="_featureList_1260s_64",eH="_runtimeGrid_1260s_89",tH="_runtimeCard_1260s_101",nH="_runtimeName_1260s_133",sH="_runtimeDescription_1260s_139",aH="_buttonRow_1260s_144",iH="_primaryButton_1260s_151",oH="_ghostButton_1260s_185",rH="_dots_1260s_213",lH="_dot_1260s_213",Ze={wizard:G9,container:F9,stepContent:Z9,logoArea:K9,logoImage:Y9,heading:J9,tagline:W9,subtitle:X9,featureList:Q9,runtimeGrid:eH,runtimeCard:tH,runtimeName:nH,runtimeDescription:sH,buttonRow:aH,primaryButton:iH,ghostButton:oH,dots:rH,dot:lH};function cH({onNext:t}){return i.jsxs("div",{className:Ze.stepContent,"data-testid":"setup-welcome",children:[i.jsx("div",{className:Ze.logoArea,children:i.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Ze.logoImage})}),i.jsx("h1",{className:Ze.heading,children:"Welcome to Grackle"}),i.jsx("p",{className:Ze.tagline,children:"Multi-agent orchestration for software teams"}),i.jsx("button",{type:"button",className:Ze.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function dH({onNext:t,onBack:s}){return i.jsxs("div",{className:Ze.stepContent,"data-testid":"setup-about",children:[i.jsx("h2",{className:Ze.heading,children:"What is Grackle?"}),i.jsxs("ul",{className:Ze.featureList,children:[i.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),i.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),i.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),i.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),i.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),i.jsxs("div",{className:Ze.buttonRow,children:[i.jsx("button",{type:"button",className:Ze.ghostButton,onClick:s,children:"Back"}),i.jsx("button",{type:"button",className:Ze.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const uH=[{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 fH({currentRuntime:t,onFinish:s,onBack:o,finishDisabled:r}){const[c,d]=x.useState(t||"claude-code");return x.useEffect(()=>{t&&d(t)},[t]),i.jsxs("div",{className:Ze.stepContent,"data-testid":"setup-runtime",children:[i.jsx("h2",{className:Ze.heading,children:"Choose Your Runtime"}),i.jsx("p",{className:Ze.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),i.jsx("div",{className:Ze.runtimeGrid,children:uH.map(u=>i.jsxs("button",{type:"button",className:Ze.runtimeCard,"data-selected":c===u.id,"aria-pressed":c===u.id,"data-testid":`runtime-card-${u.id}`,onClick:()=>d(u.id),children:[i.jsx("span",{className:Ze.runtimeName,children:u.name}),i.jsx("span",{className:Ze.runtimeDescription,children:u.description})]},u.id))}),i.jsxs("div",{className:Ze.buttonRow,children:[i.jsx("button",{type:"button",className:Ze.ghostButton,onClick:o,children:"Back"}),i.jsx("button",{type:"button",className:Ze.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-runtime-next",children:"Next"})]})]})}function pH(){return typeof Notification<"u"}function mH({onFinish:t,onBack:s,finishDisabled:o}){const r=pH(),c=r&&Notification.permission!=="default";function d(){r&&Notification.requestPermission().catch(()=>{}),t()}return i.jsxs("div",{className:Ze.stepContent,"data-testid":"setup-notifications",children:[i.jsx("h2",{className:Ze.heading,children:"Stay in the Loop"}),i.jsx("p",{className:Ze.subtitle,children:"Grackle can send you a browser notification when an agent needs your input, so you never miss an important moment."}),c?i.jsx("p",{className:Ze.subtitle,children:Notification.permission==="granted"?"Notifications are already enabled.":"Notifications have been blocked. You can change this in your browser settings."}):null,i.jsxs("div",{className:Ze.buttonRow,children:[i.jsx("button",{type:"button",className:Ze.ghostButton,onClick:s,disabled:o,children:"Back"}),!c&&r?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:Ze.ghostButton,onClick:t,disabled:o,"data-testid":"setup-notifications-skip",children:"Skip"}),i.jsx("button",{type:"button",className:Ze.primaryButton,onClick:d,disabled:o,"data-testid":"setup-notifications-enable",children:"Enable Notifications"})]}):i.jsx("button",{type:"button",className:Ze.primaryButton,onClick:t,disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const hH=4,_x={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function gH(){const{personas:{personas:t,updatePersona:s},completeOnboarding:o,onboardingCompleted:r}=dt(),{showToast:c}=pn(),d=mt(),[u,p]=x.useState(0),[m,g]=x.useState("claude-code"),[v,b]=x.useState(!1),y=t.find(j=>j.id==="claude-code"),S=x.useCallback(j=>{g(j),p(3)},[]),k=x.useCallback(()=>{const j=m;b(!0);const N=[];if(y&&j!==y.runtime){const C=_x[j]??"sonnet";N.push(s(y.id,void 0,void 0,void 0,j,C))}const T=t.find(C=>C.id===dy);if(T&&j!==T.runtime){const C=_x[j]??"sonnet";N.push(s(dy,void 0,void 0,void 0,j,C))}Promise.all(N).then(()=>o()).then(()=>{d("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),b(!1)})},[m,y,t,s,o,d,c]);return r===!0?i.jsx(ts,{to:"/",replace:!0}):i.jsx("div",{className:Ze.wizard,"data-testid":"setup-wizard",children:i.jsxs("div",{className:Ze.container,children:[i.jsx(gs,{mode:"wait",children:i.jsxs(Mt.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&i.jsx(cH,{onNext:()=>p(1)}),u===1&&i.jsx(dH,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&i.jsx(fH,{currentRuntime:m,onFinish:S,onBack:()=>p(1),finishDisabled:!y}),u===3&&i.jsx(mH,{onFinish:k,onBack:()=>p(2),finishDisabled:v})]},u)}),i.jsx("div",{className:Ze.dots,children:Array.from({length:hH},(j,N)=>i.jsx("span",{className:Ze.dot,"data-active":N===u},N))})]})})}const vH="_root_zndgp_1",yH="_body_zndgp_7",bH="_main_zndgp_19",xH="_sidebarWrapper_zndgp_26",_H="_overlay_zndgp_51",Wr={root:vH,body:yH,main:bH,sidebarWrapper:xH,overlay:_H},kH=x.lazy(()=>YT(()=>import("./KnowledgePage-UWFPbEn4.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),rk=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function SH({tabs:t}){const{connected:s,environments:{environments:o},sessions:{sessions:r},tasks:{tasks:c}}=dt(),{toasts:d,dismissToast:u}=pn(),p=Yt(),m=$7(),g=m!==void 0,[v,b]=x.useState(!1),y=x.useCallback(()=>b(S=>!S),[]);return x.useEffect(()=>{b(!1)},[p.pathname]),x.useEffect(()=>{if(!v)return;const S=k=>{k.key==="Escape"&&b(!1)};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[v]),i.jsxs(i.Fragment,{children:[i.jsx(_I,{connected:s,environments:o,sessions:r,onToggleSidebar:g?y:void 0,sidebarOpen:v}),i.jsx(CI,{tabs:t}),i.jsxs("div",{className:Wr.body,children:[g&&i.jsx("div",{className:Wr.sidebarWrapper,"data-sidebar-open":v,children:i.jsx(II,{content:m})}),g&&v&&i.jsx("div",{className:Wr.overlay,"data-testid":"drawer-overlay",onClick:()=>b(!1)}),i.jsxs("div",{className:Wr.main,children:[i.jsx(Ya,{}),i.jsx(HI,{sessions:r,tasks:c,environments:o})]})]}),i.jsx(tO,{toasts:d,onDismiss:u}),i.jsx(j9,{})]})}function TH(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:o,clearOperationError:r},tasks:{tasks:c},connected:d,onboardingCompleted:u}=dt(),{pluginNames:p}=gh(),{showToast:m}=pn();Gz(s,m),Jz(c,m),Fz(o,r,m);const g=mt(),v=Yt();if(x.useEffect(()=>{t&&!v.pathname.includes("/tasks/")&&g(Cm(t),{replace:!0})},[t,g,v.pathname]),d&&u===!1)return i.jsx(ts,{to:"/setup",replace:!0});const b=xz(p);return i.jsx(z7,{children:i.jsxs("div",{className:Wr.root,children:[rk&&i.jsx(XN,{}),i.jsx(SH,{tabs:b})]})})}function Up(){const{workspaceId:t}=as(),{workspaces:{workspaces:s}}=dt(),o=Yt(),r=s.find(m=>m.id===t);if(!(r!=null&&r.environmentId))return s.length===0?void 0:i.jsx(ts,{to:"/environments",replace:!0});const c=encodeURIComponent(t),d=`/workspaces/${c}`,u=o.pathname.startsWith(d)?o.pathname.slice(d.length):"",p=`/environments/${encodeURIComponent(r.environmentId)}/workspaces/${c}${u}${o.search}${o.hash}`;return i.jsx(ts,{to:p,replace:!0})}function jH(){const{pluginNames:t}=gh(),s=t.includes("orchestration"),o=t.includes("knowledge");return i.jsxs(Bw,{children:[i.jsx(Ne,{path:"setup",element:i.jsx(gH,{})}),i.jsxs(Ne,{element:i.jsx(TH,{}),children:[i.jsx(Ne,{index:!0,element:i.jsx(BU,{})}),i.jsx(Ne,{path:"chat",element:i.jsx(FU,{})}),i.jsx(Ne,{path:"sessions/new",element:i.jsx(ZU,{})}),i.jsx(Ne,{path:"sessions/:sessionId",element:i.jsx(WU,{})}),o&&i.jsx(Ne,{element:i.jsx(A9,{}),children:i.jsx(Ne,{path:"knowledge",element:i.jsx(x.Suspense,{fallback:i.jsx(A1,{}),children:i.jsx(kH,{})})})}),s&&i.jsxs(Ne,{element:i.jsx(w9,{}),children:[i.jsx(Ne,{path:"tasks",element:i.jsx(IU,{})}),i.jsx(Ne,{path:"tasks/new",element:i.jsx(px,{})}),i.jsx(Ne,{path:"tasks/:taskId",element:i.jsx(Ua,{})}),i.jsx(Ne,{path:"tasks/:taskId/edit",element:i.jsx(Ua,{})}),i.jsx(Ne,{path:"tasks/:taskId/stream",element:i.jsx(Ua,{})}),i.jsx(Ne,{path:"tasks/:taskId/findings",element:i.jsx(Ua,{})})]}),s&&i.jsxs(Ne,{element:i.jsx(E9,{}),children:[i.jsx(Ne,{path:"findings",element:i.jsx(bx,{})}),i.jsx(Ne,{path:"findings/:findingId",element:i.jsx(xx,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:i.jsx(bx,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:i.jsx(xx,{})})]}),i.jsxs(Ne,{element:i.jsx(N9,{}),children:[i.jsx(Ne,{path:"workspaces",element:i.jsx(ts,{to:"/environments",replace:!0})}),i.jsx(Ne,{path:"workspaces/new",element:i.jsx(fP,{})}),i.jsx(Ne,{path:"workspaces/:workspaceId",element:i.jsx(Up,{})}),i.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId",element:i.jsx(Up,{})}),i.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:i.jsx(Up,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId",element:i.jsx(tP,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:i.jsx(px,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:i.jsx(Ua,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:i.jsx(Ua,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:i.jsx(Ua,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:i.jsx(Ua,{})}),i.jsxs(Ne,{path:"environments",element:i.jsx(bP,{}),children:[i.jsx(Ne,{index:!0,element:i.jsx(OU,{})}),i.jsx(Ne,{path:"new",element:i.jsx(mP,{})}),i.jsx(Ne,{path:":environmentId",element:i.jsx(YP,{})}),i.jsx(Ne,{path:":environmentId/edit",element:i.jsx(hP,{})})]})]}),i.jsx(Ne,{element:i.jsx(C9,{}),children:i.jsxs(Ne,{path:"settings",element:i.jsx(XP,{}),children:[i.jsx(Ne,{index:!0,element:i.jsx(ts,{to:"credentials",replace:!0})}),i.jsx(Ne,{path:"environments",element:i.jsx(ts,{to:"/environments",replace:!0})}),i.jsx(Ne,{path:"credentials",element:i.jsx(QP,{})}),i.jsx(Ne,{path:"tokens",element:i.jsx(ts,{to:"../credentials",replace:!0})}),i.jsx(Ne,{path:"personas",element:i.jsx(e9,{})}),i.jsx(Ne,{path:"personas/new",element:i.jsx(gx,{})}),i.jsx(Ne,{path:"personas/:personaId",element:i.jsx(gx,{})}),i.jsx(Ne,{path:"schedules",element:i.jsx(u9,{})}),i.jsx(Ne,{path:"schedules/new",element:i.jsx(vx,{})}),i.jsx(Ne,{path:"schedules/:scheduleId",element:i.jsx(vx,{})}),i.jsx(Ne,{path:"appearance",element:i.jsx(_9,{})}),i.jsx(Ne,{path:"shortcuts",element:i.jsx(T9,{})}),i.jsx(Ne,{path:"about",element:i.jsx(S9,{})})]})}),i.jsx(Ne,{path:"*",element:i.jsx(ts,{to:"/",replace:!0})})]})]})}const wH=1e4;function NH(){const{onboardingCompleted:t}=dt(),[s,o]=x.useState(!1);x.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>o(!0),wH);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return i.jsx(gs,{mode:"wait",children:r?i.jsx(Mt.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:i.jsx(A1,{})},"splash"):i.jsx(Mt.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:i.jsx(rN,{basename:"/".replace(/\/$/,""),children:i.jsx(jH,{})})},"app")})}function CH(){const t=rk?pz:qz;return i.jsx(gz,{children:i.jsx(L7,{children:i.jsx(M7,{children:i.jsx(t,{children:i.jsx(NH,{})})})})})}FT.createRoot(document.getElementById("root")).render(i.jsx(x.StrictMode,{children:i.jsx(CH,{})}));export{vs as B,Xx as K,dt as a,Gp as f,Cm as s,On as t,mt as u};
|