@grackle-ai/web 0.105.0 → 0.106.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,725 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-Dx7P15XQ.js","assets/dagview-tHPW3Rz3.js","assets/grpc-DTzuoFMa.js","assets/markdown-Yr3vTPLR.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
- import{r as vT,a as yT,b,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-DTzuoFMa.js";import{v as zT,r as $T,t as Bc,i as PT,f as UT,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(R,G){var Z=R.length;R.push(G);e:for(;0<Z;){var de=Z-1>>>1,W=R[de];if(0<c(W,G))R[de]=G,R[Z]=W,Z=de;else break e}}function o(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var G=R[0],Z=R.pop();if(Z!==G){R[0]=Z;e:for(var de=0,W=R.length,Q=W>>>1;de<Q;){var ue=2*(de+1)-1,Ce=R[ue],Ue=ue+1,ve=R[Ue];if(0>c(Ce,Z))Ue<W&&0>c(ve,Ce)?(R[de]=ve,R[Ue]=Z,de=Ue):(R[de]=Ce,R[ue]=Z,de=ue);else if(Ue<W&&0>c(ve,Z))R[de]=ve,R[Ue]=Z,de=Ue;else break e}}return G}function c(R,G){var Z=R.sortIndex-G.sortIndex;return Z!==0?Z:R.id-G.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var u=Date,p=u.now();t.unstable_now=function(){return u.now()-p}}var m=[],g=[],v=1,x=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 O(R){for(var G=o(g);G!==null;){if(G.callback===null)r(g);else if(G.startTime<=R)r(g),G.sortIndex=G.expirationTime,s(m,G);else break;G=o(g)}}function E(R){if(j=!1,O(R),!k)if(o(m)!==null)k=!0,D||(D=!0,J());else{var G=o(g);G!==null&&oe(E,G.startTime-R)}}var D=!1,U=-1,B=5,z=-1;function X(){return N?!0:!(t.unstable_now()-z<B)}function $(){if(N=!1,D){var R=t.unstable_now();z=R;var G=!0;try{e:{k=!1,j&&(j=!1,C(U),U=-1),S=!0;var Z=y;try{t:{for(O(R),x=o(m);x!==null&&!(x.expirationTime>R&&X());){var de=x.callback;if(typeof de=="function"){x.callback=null,y=x.priorityLevel;var W=de(x.expirationTime<=R);if(R=t.unstable_now(),typeof W=="function"){x.callback=W,O(R),G=!0;break t}x===o(m)&&r(m),O(R)}else r(m);x=o(m)}if(x!==null)G=!0;else{var Q=o(g);Q!==null&&oe(E,Q.startTime-R),G=!1}}break e}finally{x=null,y=Z,S=!1}G=void 0}}finally{G?J():D=!1}}}var J;if(typeof A=="function")J=function(){A($)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,ee=me.port2;me.port1.onmessage=$,J=function(){ee.postMessage(null)}}else J=function(){T($,0)};function oe(R,G){U=T(function(){R(t.unstable_now())},G)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(R){R.callback=null},t.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<R?Math.floor(1e3/R):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_next=function(R){switch(y){case 1:case 2:case 3:var G=3;break;default:G=y}var Z=y;y=G;try{return R()}finally{y=Z}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(R,G){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var Z=y;y=R;try{return G()}finally{y=Z}},t.unstable_scheduleCallback=function(R,G,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,R){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,R={id:v++,callback:G,priorityLevel:R,startTime:Z,expirationTime:W,sortIndex:-1},Z>de?(R.sortIndex=Z,s(g,R),o(m)===null&&R===o(g)&&(j?(C(U),U=-1):j=!0,oe(E,Z-de))):(R.sortIndex=W,s(m,R),k||S||(k=!0,D||(D=!0,J()))),R},t.unstable_shouldYield=X,t.unstable_wrapCallback=function(R){var G=y;return function(){var Z=y;y=G;try{return R.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 x=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"),O=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),X=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 ee(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 O:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case U:return n=e.displayName||null,n!==null?n:ee(e.type)||"Memo";case B:n=e._payload,e=e._init;try{return ee(e(n))}catch{}}return null}var oe=Array.isArray,R=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=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 Q(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 Ue=Q(null),ve=Q(null),Se=Q(null),xe=Q(null);function Be(e,n){switch(Ce(Se,n),Ce(ve,e),Ce(Ue,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(Ue),Ce(Ue,e)}function It(){ue(Ue),ue(ve),ue(Se)}function zn(e){e.memoizedState!==null&&Ce(xe,e);var n=Ue.current,a=D0(n,e.type);n!==a&&(Ce(ve,e),Ce(Ue,a))}function re(e){ve.current===e&&(ue(Ue),ue(ve)),xe.current===e&&(ue(xe),Mr._currentValue=Z)}var Je,Ut;function se(e){if(Je===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Je=n&&n[1]||"",Ut=-1<a.stack.indexOf(`
19
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+Je+e+Ut}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 ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(K){var F=K}Reflect.construct(e,[],ie)}else{try{ie.call()}catch(K){F=K}e.call(ie.prototype)}}else{try{throw Error()}catch(K){F=K}(ie=e())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(K){if(K&&F&&typeof K.stack=="string")return[K.stack,F.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),_=h[0],w=h[1];if(_&&w){var M=_.split(`
21
- `),q=w.split(`
22
- `);for(f=l=0;l<M.length&&!M[l].includes("DetermineComponentFrameRoot");)l++;for(;f<q.length&&!q[f].includes("DetermineComponentFrameRoot");)f++;if(l===M.length||f===q.length)for(l=M.length-1,f=q.length-1;1<=l&&0<=f&&M[l]!==q[f];)f--;for(;1<=l&&0<=f;l--,f--)if(M[l]!==q[f]){if(l!==1||f!==1)do if(l--,f--,0>f||M[l]!==q[f]){var te=`
23
- `+M[l].replace(" at new "," at ");return e.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",e.displayName)),te}while(1<=l&&0<=f);break}}}finally{wt=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?se(a):""}function Bt(e,n){switch(e.tag){case 26:case 27:case 5:return se(e.type);case 16:return se("Lazy");case 13:return e.child!==n&&n!==null?se("Suspense Fallback"):se("Suspense");case 19:return se("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 se("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,We=t.unstable_setDisableYieldValue,Wt=null,St=null;function mn(e){if(typeof De=="function"&&We(e),St&&typeof St.setStrictMode=="function")try{St.setStrictMode(Wt,e)}catch{}}var Xt=Math.clz32?Math.clz32:Pi,zi=Math.log,$i=Math.LN2;function Pi(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 ne(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,M=e.expirationTimes,q=e.hiddenUpdates;for(a=_&~a;0<a;){var te=31-Xt(a),ie=1<<te;w[te]=0,M[te]=-1;var F=q[te];if(F!==null)for(q[te]=null,te=0;te<F.length;te++){var K=F[te];K!==null&&(K.lane&=-536870913)}a&=~ie}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 ge(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 Ge(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 Xe(){var e=G.p;return e!==0?e:(e=window.event,e===void 0?32:ey(e.type))}function ht(e,n){var a=G.p;try{return G.p=e,n()}finally{G.p=a}}var Le=Math.random().toString(36).slice(2),Qe="__reactFiber$"+Le,rt="__reactProps$"+Le,vt="__reactContainer$"+Le,xs="__reactEvents$"+Le,Rs="__reactListeners$"+Le,Zo="__reactHandles$"+Le,vh="__reactResources$"+Le,Ko="__reactMarker$"+Le;function $d(e){delete e[Qe],delete e[rt],delete e[xs],delete e[Rs],delete e[Zo]}function Ui(e){var n=e[Qe];if(n)return n;for(var a=e.parentNode;a;){if(n=a[vt]||a[Qe]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=z0(e);e!==null;){if(a=e[Qe])return a;e=z0(e)}return n}e=a,a=e.parentNode}return null}function Hi(e){if(e=e[Qe]||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 Ms(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 Pn(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 Pd(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 Un(e){return e.replace(uk,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Ud(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=""+Pn(n)):e.value!==""+Pn(n)&&(e.value=""+Pn(n)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),n!=null?Hd(e,_,Pn(n)):a!=null?Hd(e,_,Pn(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=""+Pn(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)){Pd(e);return}a=a!=null?""+Pn(a):"",n=n!=null?""+Pn(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=_),Pd(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=""+Pn(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=""+Pn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+Pn(a):""}function wh(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(r(92));if(oe(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=Pn(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Pd(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 Is(){}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[rt]||null;e:switch(e=n.stateNode,n.type){case"input":if(Ud(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="'+Un(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[rt]||null;if(!f)throw Error(r(90));Ud(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[rt]||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 Os=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zd=!1;if(Os)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 x(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=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=x({},ai,{view:0,detail:0}),hk=xn(Xo),Yd,Jd,Qo,Dl=x({},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=x({},Dl,{dataTransfer:0}),vk=xn(gk),yk=x({},Xo,{relatedTarget:0}),Wd=xn(yk),bk=x({},ai,{animationName:0,elapsedTime:0,pseudoElement:0}),xk=xn(bk),_k=x({},ai,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kk=xn(_k),Sk=x({},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=x({},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=x({},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=x({},Xo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xd}),Rk=xn(Dk),Mk=x({},ai,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ik=xn(Mk),Ok=x({},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=x({},ai,{newState:0,oldState:0}),zk=xn(Lk),$k=[9,13,27,32],Qd=Os&&"CompositionEvent"in window,er=null;Os&&"documentMode"in document&&(er=document.documentMode);var Pk=Os&&"TextEvent"in window&&!er,Bh=Os&&(!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 Ph(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yi=!1;function Uk(e,n){switch(e){case"compositionend":return Ph(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 Uh(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(Os){var eu;if(Os){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=Os&&"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={};Os&&(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 Bs(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,Ue.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 O:_=11;break e;case U:_=14;break e;case B:_=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 Ls(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&&(Ls(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,Fe=!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[Qe]=e,n[rt]=l,a){case"dialog":Pe("cancel",n),Pe("close",n);break;case"iframe":case"object":case"embed":Pe("load",n);break;case"video":case"audio":for(a=0;a<Cr.length;a++)Pe(Cr[a],n);break;case"source":Pe("error",n);break;case"img":case"image":case"link":Pe("error",n),Pe("load",n);break;case"details":Pe("toggle",n);break;case"input":Pe("invalid",n),Th(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Pe("invalid",n);break;case"textarea":Pe("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&&(Pe("beforetoggle",n),Pe("toggle",n)),l.onScroll!=null&&Pe("scroll",n),l.onScrollEnd!=null&&Pe("scrollend",n),l.onClick!=null&&(n.onclick=Is),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(!Fe)return fg(e),Fe=!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,Fe=!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=Q(null),di=null,zs=null;function va(e,n,a){Ce(gu,n._currentValue),n._currentValue=a}function $s(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 M=0;M<n.length;M++)if(w.context===n[M]){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,zs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function on(e){return pg(di,e)}function Pl(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},zs===null){if(e===null)throw Error(r(308));zs=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else zs=zs.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=R.S;R.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=Q(null);function _u(){var e=fi.current;return e!==null?e:gt.pooledCache}function Ul(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(Is,Is),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(Is,Is);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(P,L){if(e){var V=P.deletions;V===null?(P.deletions=[L],P.flags|=16):V.push(L)}}function a(P,L){if(!e)return null;for(;L!==null;)n(P,L),L=L.sibling;return null}function l(P){for(var L=new Map;P!==null;)P.key!==null?L.set(P.key,P):L.set(P.index,P),P=P.sibling;return L}function f(P,L){return P=Bs(P,L),P.index=0,P.sibling=null,P}function h(P,L,V){return P.index=V,e?(V=P.alternate,V!==null?(V=V.index,V<L?(P.flags|=67108866,L):V):(P.flags|=67108866,L)):(P.flags|=1048576,L)}function _(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function w(P,L,V,ae){return L===null||L.tag!==6?(L=du(V,P.mode,ae),L.return=P,L):(L=f(L,V),L.return=P,L)}function M(P,L,V,ae){var we=V.type;return we===j?te(P,L,V.props.children,ae,V.key):L!==null&&(L.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===B&&pi(we)===L.type)?(L=f(L,V.props),dr(L,V),L.return=P,L):(L=Ll(V.type,V.key,V.props,null,P.mode,ae),dr(L,V),L.return=P,L)}function q(P,L,V,ae){return L===null||L.tag!==4||L.stateNode.containerInfo!==V.containerInfo||L.stateNode.implementation!==V.implementation?(L=uu(V,P.mode,ae),L.return=P,L):(L=f(L,V.children||[]),L.return=P,L)}function te(P,L,V,ae,we){return L===null||L.tag!==7?(L=li(V,P.mode,ae,we),L.return=P,L):(L=f(L,V),L.return=P,L)}function ie(P,L,V){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=du(""+L,P.mode,V),L.return=P,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case S:return V=Ll(L.type,L.key,L.props,null,P.mode,V),dr(V,L),V.return=P,V;case k:return L=uu(L,P.mode,V),L.return=P,L;case B:return L=pi(L),ie(P,L,V)}if(oe(L)||J(L))return L=li(L,P.mode,V,null),L.return=P,L;if(typeof L.then=="function")return ie(P,ql(L),V);if(L.$$typeof===A)return ie(P,Pl(P,L),V);Gl(P,L)}return null}function F(P,L,V,ae){var we=L!==null?L.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return we!==null?null:w(P,L,""+V,ae);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return V.key===we?M(P,L,V,ae):null;case k:return V.key===we?q(P,L,V,ae):null;case B:return V=pi(V),F(P,L,V,ae)}if(oe(V)||J(V))return we!==null?null:te(P,L,V,ae,null);if(typeof V.then=="function")return F(P,L,ql(V),ae);if(V.$$typeof===A)return F(P,L,Pl(P,V),ae);Gl(P,V)}return null}function K(P,L,V,ae,we){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return P=P.get(V)||null,w(L,P,""+ae,we);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case S:return P=P.get(ae.key===null?V:ae.key)||null,M(L,P,ae,we);case k:return P=P.get(ae.key===null?V:ae.key)||null,q(L,P,ae,we);case B:return ae=pi(ae),K(P,L,V,ae,we)}if(oe(ae)||J(ae))return P=P.get(V)||null,te(L,P,ae,we,null);if(typeof ae.then=="function")return K(P,L,V,ql(ae),we);if(ae.$$typeof===A)return K(P,L,V,Pl(L,ae),we);Gl(L,ae)}return null}function be(P,L,V,ae){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=F(P,ke,V[Oe],ae);if(tt===null){ke===null&&(ke=Ve);break}e&&ke&&tt.alternate===null&&n(P,ke),L=h(tt,L,Oe),et===null?we=tt:et.sibling=tt,et=tt,ke=Ve}if(Oe===V.length)return a(P,ke),Fe&&Ls(P,Oe),we;if(ke===null){for(;Oe<V.length;Oe++)ke=ie(P,V[Oe],ae),ke!==null&&(L=h(ke,L,Oe),et===null?we=ke:et.sibling=ke,et=ke);return Fe&&Ls(P,Oe),we}for(ke=l(ke);Oe<V.length;Oe++)Ve=K(ke,P,Oe,V[Oe],ae),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(P,Oa)}),Fe&&Ls(P,Oe),we}function Ee(P,L,V,ae){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=F(P,ke,tt.value,ae);if(Oa===null){ke===null&&(ke=Ve);break}e&&ke&&Oa.alternate===null&&n(P,ke),L=h(Oa,L,Oe),et===null?we=Oa:et.sibling=Oa,et=Oa,ke=Ve}if(tt.done)return a(P,ke),Fe&&Ls(P,Oe),we;if(ke===null){for(;!tt.done;Oe++,tt=V.next())tt=ie(P,tt.value,ae),tt!==null&&(L=h(tt,L,Oe),et===null?we=tt:et.sibling=tt,et=tt);return Fe&&Ls(P,Oe),we}for(ke=l(ke);!tt.done;Oe++,tt=V.next())tt=K(ke,P,Oe,tt.value,ae),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(P,gT)}),Fe&&Ls(P,Oe),we}function pt(P,L,V,ae){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(P,L.sibling),ae=f(L,V.props.children),ae.return=P,P=ae;break e}}else if(L.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===B&&pi(we)===L.type){a(P,L.sibling),ae=f(L,V.props),dr(ae,V),ae.return=P,P=ae;break e}a(P,L);break}else n(P,L);L=L.sibling}V.type===j?(ae=li(V.props.children,P.mode,ae,V.key),ae.return=P,P=ae):(ae=Ll(V.type,V.key,V.props,null,P.mode,ae),dr(ae,V),ae.return=P,P=ae)}return _(P);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(P,L.sibling),ae=f(L,V.children||[]),ae.return=P,P=ae;break e}else{a(P,L);break}else n(P,L);L=L.sibling}ae=uu(V,P.mode,ae),ae.return=P,P=ae}return _(P);case B:return V=pi(V),pt(P,L,V,ae)}if(oe(V))return be(P,L,V,ae);if(J(V)){if(we=J(V),typeof we!="function")throw Error(r(150));return V=we.call(V),Ee(P,L,V,ae)}if(typeof V.then=="function")return pt(P,L,ql(V),ae);if(V.$$typeof===A)return pt(P,L,Pl(P,V),ae);Gl(P,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,L!==null&&L.tag===6?(a(P,L.sibling),ae=f(L,V),ae.return=P,P=ae):(a(P,L),ae=du(V,P.mode,ae),ae.return=P,P=ae),_(P)):a(P,L)}return function(P,L,V,ae){try{cr=0;var we=pt(P,L,V,ae);return ro=null,we}catch(ke){if(ke===oo||ke===Hl)throw ke;var et=Nn(29,ke,null,P.mode);return et.lanes=ae,et.return=P,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,ge(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 M=w,q=M.next;M.next=null,_===null?h=q:_.next=q,_=M;var te=e.alternate;te!==null&&(te=te.updateQueue,w=te.lastBaseUpdate,w!==_&&(w===null?te.firstBaseUpdate=q:w.next=q,te.lastBaseUpdate=M))}if(h!==null){var ie=f.baseState;_=0,te=q=M=null,w=h;do{var F=w.lane&-536870913,K=F!==w.lane;if(K?(He&F)===F:(l&F)===F){F!==0&&F===ao&&(wu=!0),te!==null&&(te=te.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var be=e,Ee=w;F=n;var pt=a;switch(Ee.tag){case 1:if(be=Ee.payload,typeof be=="function"){ie=be.call(pt,ie,F);break e}ie=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ee.payload,F=typeof be=="function"?be.call(pt,ie,F):be,F==null)break e;ie=x({},ie,F);break e;case 2:ya=!0}}F=w.callback,F!==null&&(e.flags|=64,K&&(e.flags|=8192),K=f.callbacks,K===null?f.callbacks=[F]:K.push(F))}else K={lane:F,tag:w.tag,payload:w.payload,callback:w.callback,next:null},te===null?(q=te=K,M=ie):te=te.next=K,_|=F;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);te===null&&(M=ie),f.baseState=M,f.firstBaseUpdate=q,f.lastBaseUpdate=te,h===null&&(f.shared.lanes=0),ja|=_,e.lanes=_,e.memoizedState=ie}}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=Q(null),Fl=Q(0);function jg(e,n){e=Ks,Ce(Fl,e),Ce(lo,n),Ks=e|n.baseLanes}function Nu(){Ce(Fl,Ks),Ce(lo,lo.current)}function Cu(){Ks=Fl.current,ue(lo),ue(Fl)}var Cn=Q(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=Q(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 Ps=0,Ie=null,ut=null,Vt=null,Kl=!1,co=!1,gi=!1,Yl=0,mr=0,uo=null,oS=0;function Et(){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 Ps=h,Ie=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,R.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){R.H=vr;var n=ut!==null&&ut.next!==null;if(Ps=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)}R.H=dv,h=n(a,l)}while(co);return h}function rS(){var e=R.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}Ps=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,R.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]=X;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,M=null,q=n,te=!1;do{var ie=q.lane&-536870913;if(ie!==q.lane?(He&ie)===ie:(Ps&ie)===ie){var F=q.revertLane;if(F===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null}),ie===ao&&(te=!0);else if((Ps&F)===F){q=q.next,F===ao&&(te=!0);continue}else ie={lane:0,revertLane:q.revertLane,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},M===null?(w=M=ie,_=h):M=M.next=ie,Ie.lanes|=F,ja|=F;ie=q.action,gi&&a(h,ie),h=q.hasEagerState?q.eagerState:a(h,ie)}else F={lane:ie,revertLane:q.revertLane,gesture:q.gesture,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},M===null?(w=M=F,_=h):M=M.next=F,Ie.lanes|=ie,ja|=ie;q=q.next}while(q!==null&&q!==n);if(M===null?_=h:M.next=w,!wn(h,e.memoizedState)&&(qt=!0,te&&(a=io,a!==null)))throw a;e.memoizedState=h,e.baseState=_,e.baseQueue=M,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=Fe;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,Pu(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||(Ps&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(_)}};R.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=R.T,_={};R.T=_;try{var w=a(f,l),M=R.S;M!==null&&M(_,w),Lg(e,n,w)}catch(q){$u(e,n,q)}finally{h!==null&&_.types!==null&&(h.types=_.types),R.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 Pg(e,n){return n}function Ug(e,n){if(Fe){var a=gt.formState;if(a!==null){e:{var l=Ie;if(Fe){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:Pg,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,Pg)[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 Pu(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 Uu(){}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||(Ps&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):(Ps&42)===0||(Ps&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=G.p;G.p=h!==0&&8>h?h:8;var _=R.T,w={};R.T=w,Gu(e,!1,n,a);try{var M=f(),q=R.S;if(q!==null&&q(w,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var te=iS(M,l);gr(e,n,te,Rn(e))}else gr(e,n,l,Rn(e))}catch(ie){gr(e,n,{then:function(){},status:"rejected",reason:ie},Rn())}finally{G.p=h,_!==null&&w.types!==null&&(_.types=w.types),R.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,ge(e,a)}}var vr={readContext:on,use:Wl,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};vr.useEffectEvent=Et;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:Uu,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(Fe){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(Fe){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:Ug,useActionState:Ug,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:Pu,useImperativeHandle:Wg,useInsertionEffect:Kg,useLayoutEffect:Yg,useMemo:Qg,useReducer:Xl,useRef:Gg,useState:function(){return Xl(Us)},useDebugValue:Uu,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:Pu,useImperativeHandle:Wg,useInsertionEffect:Kg,useLayoutEffect:Yg,useMemo:Qg,useReducer:Lu,useRef:Gg,useState:function(){return Lu(Us)},useDebugValue:Uu,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:x({},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=x({},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&&At===0&&(At=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(Fe)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),At!==4&&(At=2)),!1;var h=Error(r(520),{cause:l});if(h=Vn(h,a),jr===null?jr=[h]:jr.push(h),At!==4&&(At=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),Hs(e,n,f)):(Fe&&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 Hs(e,n,f)}return n.flags|=1,e=Bs(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,Hs(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&&Ul(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?(Ul(n,h.cachePool),jg(n,h),ka(),n.memoizedState=null):(e!==null&&Ul(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&&Ul(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(Fe){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&&(_=Ge(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,Fe=!0,ha=null,Fn=!1,e!==null&&dg(n,e),n=sc(n,l),n.flags|=4096;return n}return e=Bs(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),Hs(e,n,f)):(Fe&&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),Hs(e,n,h)):(Fe&&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,M=vi(a,w);h.props=M;var q=h.context,te=a.contextType;_=Qi,typeof te=="object"&&te!==null&&(_=on(te));var ie=a.getDerivedStateFromProps;te=typeof ie=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,te||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||q!==_)&&fv(n,h,l,_),ya=!1;var F=n.memoizedState;h.state=F,pr(n,l,h,f),fr(),q=n.memoizedState,w||F!==q||ya?(typeof ie=="function"&&(Zu(n,a,ie,l),q=n.memoizedState),(M=ya||uv(n,a,M,l,F,q,_))?(te||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=M):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,Tu(e,n),_=n.memoizedProps,te=vi(a,_),h.props=te,ie=n.pendingProps,F=h.context,q=a.contextType,M=Qi,typeof q=="object"&&q!==null&&(M=on(q)),w=a.getDerivedStateFromProps,(q=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(_!==ie||F!==M)&&fv(n,h,l,M),ya=!1,F=n.memoizedState,h.state=F,pr(n,l,h,f),fr();var K=n.memoizedState;_!==ie||F!==K||ya||e!==null&&e.dependencies!==null&&$l(e.dependencies)?(typeof w=="function"&&(Zu(n,a,w,l),K=n.memoizedState),(te=ya||uv(n,a,te,l,F,K,M)||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,M),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,K,M)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=K),h.props=l,h.state=K,h.context=M,l=te):(typeof h.componentDidUpdate!="function"||_===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&F===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=Hs(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(Fe){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 M=e.memoizedState;if(M!==null&&(w=M.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=Ge(_,a),l!==0&&l!==M.retryLane))throw M.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=M.treeContext,yt=Kn(w.nextSibling),an=n,Fe=!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,M=e.child,q=M.sibling,l=Bs(M,{mode:"hidden",children:l.children}),l.subtreeFlags=M.subtreeFlags&65011712,q!==null?w=Bs(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?(M=Ht._currentValue,f=f.parent!==M?{parent:M,pool:M}: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=Bs(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=Fe?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 Hs(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=Bs(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Bs(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=Hs(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 Hs(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,Fe&&(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===O){n.tag=11,n=bv(null,n,e,l,a);break e}else if(f===U){n.tag=14,n=xv(null,n,e,l,a);break e}}throw n=ee(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,Fe=!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=Hs(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:Fe||(a=n.type,e=n.pendingProps,l=_c(Se.current).createElement(a),l[Qe]=n,l[rt]=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&&Fe&&(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&&Fe&&((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&&Fe&&((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 Vs(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(!Fe)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),$s(Ht),It(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(no(n)?Vs(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?(Vs(n),h!==null?(bt(n),Rv(n,h)):(bt(n),of(n,f,null,l,a))):h?h!==e.memoizedState?(Vs(n),bt(n),Rv(n,h)):(bt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Vs(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&&Vs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return bt(n),null}e=Ue.current,no(n)?ug(n):(e=$0(f,l,a),n.stateNode=e,Vs(n))}return bt(n),null;case 5:if(re(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Vs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return bt(n),null}if(h=Ue.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[Qe]=n,h[rt]=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&&Vs(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&&Vs(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[Qe]=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[Qe]=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[Qe]=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[Qe]=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 $s(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(At!==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),Fe&&Ls(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&&!Fe)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),Fe&&Ls(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),$s(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 $s(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 $s(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 $s(Ht),null;case 25:return null;default:return null}}function Mv(e,n){switch(pu(n),n.tag){case 3:$s(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:$s(n.type);break;case 22:case 23:En(n),Cu(),e!==null&&ue(fi);break;case 24:$s(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){ct(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 M=a,q=w;try{q()}catch(te){ct(f,M,te)}}}l=l.next}while(l!==h)}}catch(te){ct(n,n.return,te)}}function Iv(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{Tg(n,a)}catch(l){ct(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){ct(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){ct(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){ct(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){ct(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){ct(e,e.return,f)}}function rf(e,n,a){try{var l=e.stateNode;PS(l,e.type,a,n),l[rt]=n}catch(f){ct(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=Is));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[Qe]=e,n[rt]=a}catch(h){ct(e,e.return,h)}}var qs=!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,M=-1,q=0,te=0,ie=e,F=null;t:for(;;){for(var K;ie!==a||f!==0&&ie.nodeType!==3||(w=_+f),ie!==h||l!==0&&ie.nodeType!==3||(M=_+l),ie.nodeType===3&&(_+=ie.nodeValue.length),(K=ie.firstChild)!==null;)F=ie,ie=K;for(;;){if(ie===e)break t;if(F===a&&++q===f&&(w=_),F===h&&++te===l&&(M=_),(K=ie.nextSibling)!==null)break;ie=F,F=ie.parentNode}ie=K}a=w===-1||M===-1?null:{start:w,end:M}}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){ct(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 Pv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Fs(e,a),l&4&&xr(5,a);break;case 1:if(Fs(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(_){ct(a,a.return,_)}else{var f=vi(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(_){ct(a,a.return,_)}}l&64&&Iv(a),l&512&&_r(a,a.return);break;case 3:if(Fs(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(_){ct(a,a.return,_)}}break;case 27:n===null&&l&4&&zv(a);case 26:case 5:Fs(e,a),n===null&&l&4&&Bv(a),l&512&&_r(a,a.return);break;case 12:Fs(e,a);break;case 31:Fs(e,a),l&4&&Vv(e,a);break;case 13:Fs(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||qs,!l){n=n!==null&&n.memoizedState!==null||Gt,f=qs;var h=Gt;qs=l,(Gt=n)&&!h?Zs(e,a,(a.subtreeFlags&8772)!==0):Fs(e,a),qs=f,Gt=h}break;case 30:break;default:Fs(e,a)}}function Uv(e){var n=e.alternate;n!==null&&(e.alternate=null,Uv(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 Gs(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),Gs(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),Gs(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,Gs(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){ct(a,n,h)}else try{Tt.removeChild(a.stateNode)}catch(h){ct(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,Gs(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),Gs(e,n,a);break;case 1:Gt||(Ss(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Ov(a,n,l)),Gs(e,n,a);break;case 21:Gs(e,n,a);break;case 22:Gt=(l=Gt)||a.memoizedState!==null,Gs(e,n,a),Gt=l;break;default:Gs(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){ct(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){ct(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&&qs&&(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[Qe]||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[Qe]=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[Qe]=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){ct(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){ct(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){ct(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 M=a!==null&&a.memoizedState!==null,q=qs,te=Gt;if(qs=q||f,Gt=te||M,kn(n,e),Gt=te,qs=q,Sn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||M||qs||Gt||yi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){M=a=n;try{if(h=M.stateNode,f)_=h.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{w=M.stateNode;var ie=M.memoizedProps.style,F=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;w.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(be){ct(M,M.return,be)}}}else if(n.tag===6){if(a===null){M=n;try{M.stateNode.nodeValue=f?"":M.memoizedProps}catch(be){ct(M,M.return,be)}}}else if(n.tag===18){if(a===null){M=n;try{var K=M.stateNode;f?O0(K,!0):O0(M.stateNode,!1)}catch(be){ct(M,M.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 M=a.stateNode.containerInfo,q=lf(e);cf(e,q,M);break;default:throw Error(r(161))}}catch(te){ct(e,e.return,te)}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 Fs(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Pv(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 Zs(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:Zs(f,h,a),xr(4,h);break;case 1:if(Zs(f,h,a),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(q){ct(l,l.return,q)}if(l=h,f=l.updateQueue,f!==null){var w=l.stateNode;try{var M=f.shared.hiddenCallbacks;if(M!==null)for(f.shared.hiddenCallbacks=null,f=0;f<M.length;f++)Sg(M[f],w)}catch(q){ct(l,l.return,q)}}a&&_&64&&Iv(h),_r(h,h.return);break;case 27:zv(h);case 26:case 5:Zs(f,h,a),a&&l===null&&_&4&&Bv(h),_r(h,h.return);break;case 12:Zs(f,h,a);break;case 31:Zs(f,h,a),a&&_&4&&Vv(f,h);break;case 13:Zs(f,h,a),a&&_&4&&qv(f,h);break;case 22:h.memoizedState===null&&Zs(f,h,a),_r(h,h.return);break;case 30:break;default:Zs(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(M){ct(n,n.return,M)}}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,M=l,q=_.flags;switch(_.tag){case 0:case 11:case 15:po(h,_,w,M,f),xr(8,_);break;case 23:break;case 22:var te=_.stateNode;_.memoizedState!==null?te._visibility&2?po(h,_,w,M,f):kr(h,_):(te._visibility|=2,po(h,_,w,M,f)),f&&q&2048&&uf(_.alternate,_);break;case 24:po(h,_,w,M,f),f&&q&2048&&ff(_.alternate,_);break;default:po(h,_,w,M,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(Uv(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,lt=0,An=null,Ta=!1,ho=!1,pf=!1,Ks=0,At=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,Ys=0,gf=0,vf=null,Qv=null,wr=0,yf=null;function Rn(){return(at&2)!==0&&He!==0?He&-He:R.T!==null?Tf():Xe()}function e0(){if(Dn===0)if((He&536870912)===0||Fe){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&&(lt===2||lt===9)||e.cancelPendingCommit!==null)&&(yo(e,0),Ca(e,He,Dn,!1)),ne(e,a),((at&2)===0||e!==gt)&&(e===gt&&((at&2)===0&&(bi|=a),At===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 M=w.current.memoizedState.isDehydrated;if(M&&(yo(w,_).flags|=256),_=xf(w,_,!1),_!==2){if(pf&&!M){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;Ys=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,M,q,te,ie,F,K){if(e.timeoutHandle=-1,ie=n.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Is},Kv(n,h,ie);var be=(h&62914560)===h?dc-Jt():(h&4194048)===h?Xv-Jt():0;if(be=rT(ie,be),be!==null){Ys=h,e.cancelPendingCommit=be(d0.bind(null,e,n,h,a,l,f,_,w,M,te,ie,null,F,K)),Ca(e,h,_,!q);return}}d0(e,n,h,a,l,f,_,w,M)}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(lt===0)var e=$e.return;else e=$e,zs=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()),Ys=0,bf(),gt=e,$e=a=Bs(e.current,null),He=n,lt=0,An=null,Ta=!1,ho=fa(e,n),pf=!1,go=Dn=mf=bi=ja=At=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 Ks=n,Il(),a}function s0(e,n){Ie=null,R.H=vr,n===oo||n===Hl?(n=bg(),lt=3):n===ku?(n=bg(),lt=4):lt=n===Ju?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,An=n,$e===null&&(At=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=R.H;return R.H=vr,e===null?vr:e}function o0(){var e=R.A;return R.A=_S,e}function mc(){At=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 _=At;e:do try{if(lt!==0&&$e!==null){var w=$e,M=An;switch(lt){case 8:bf(),_=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(n=!0);var q=lt;if(lt=0,An=null,bo(e,w,M,q),a&&ho){_=0;break e}break;default:q=lt,lt=0,An=null,bo(e,w,M,q)}}TS(),_=At;break}catch(te){s0(e,te)}while(!0);return n&&e.shellSuspendCounter++,zs=di=null,at=l,R.H=f,R.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(lt!==0&&$e!==null){n=$e;var h=An;t:switch(lt){case 1:lt=0,An=null,bo(e,n,h,1);break;case 2:case 9:if(vg(h)){lt=0,An=null,l0(n);break}n=function(){lt!==2&&lt!==9||gt!==e||(lt=7),Ts(e)},h.then(n,n);break e;case 3:lt=7;break e;case 4:lt=5;break e;case 7:vg(h)?(lt=0,An=null,l0(n)):(lt=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){lt=0,An=null;var M=w.sibling;if(M!==null)$e=M;else{var q=w.return;q!==null?($e=q,hc(q)):$e=null}break t}}lt=0,An=null,bo(e,n,h,5);break;case 6:lt=0,An=null,bo(e,n,h,6);break;case 8:bf(),At=6;break e;default:throw Error(r(462))}}wS();break}catch(te){s0(e,te)}while(!0);return zs=di=null,R.H=l,R.A=f,at=a,$e!==null?0:(gt=null,He=0,Il(),At)}function wS(){for(;$e!==null&&!Wa();)r0($e)}function r0(e){var n=Dv(e.alternate,e,Ks);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,Ks),n=Dv(a,n,Ks)}e.memoizedProps=e.pendingProps,n===null?hc(e):$e=n}function bo(e,n,a,l){zs=di=null,Iu(n),ro=null,cr=0;var f=n.return;try{if(mS(e,f,n,a,He)){At=1,nc(e,Vn(a,e.current)),$e=null;return}}catch(h){if(f!==null)throw $e=f,h;At=1,nc(e,Vn(a,e.current)),$e=null;return}n.flags&32768?(Fe||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,Ks);if(a!==null){$e=a;return}if(n=n.sibling,n!==null){$e=n;return}$e=n=e}while(n!==null);At===0&&(At=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);At=6,$e=null}function d0(e,n,a,l,f,h,_,w,M){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,M),e===gt&&($e=gt=null,He=0),vo=n,Na=e,Ys=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=R.T,R.T=null,f=G.p,G.p=2,_=at,at|=4;try{bS(e,n,a)}finally{at=_,G.p=f,R.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=R.T,R.T=null;var l=G.p;G.p=2;var f=at;at|=4;try{Gv(n,e);var h=Rf,_=Wh(e.containerInfo),w=h.focusedElem,M=h.selectionRange;if(_!==w&&w&&w.ownerDocument&&Jh(w.ownerDocument.documentElement,w)){if(M!==null&&nu(w)){var q=M.start,te=M.end;if(te===void 0&&(te=q),"selectionStart"in w)w.selectionStart=q,w.selectionEnd=Math.min(te,w.value.length);else{var ie=w.ownerDocument||document,F=ie&&ie.defaultView||window;if(F.getSelection){var K=F.getSelection(),be=w.textContent.length,Ee=Math.min(M.start,be),pt=M.end===void 0?Ee:Math.min(M.end,be);!K.extend&&Ee>pt&&(_=pt,pt=Ee,Ee=_);var P=Yh(w,Ee),L=Yh(w,pt);if(P&&L&&(K.rangeCount!==1||K.anchorNode!==P.node||K.anchorOffset!==P.offset||K.focusNode!==L.node||K.focusOffset!==L.offset)){var V=ie.createRange();V.setStart(P.node,P.offset),K.removeAllRanges(),Ee>pt?(K.addRange(V),K.extend(L.node,L.offset)):(V.setEnd(L.node,L.offset),K.addRange(V))}}}}for(ie=[],K=w;K=K.parentNode;)K.nodeType===1&&ie.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<ie.length;w++){var ae=ie[w];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}Cc=!!Df,Rf=Df=null}finally{at=f,G.p=l,R.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=R.T,R.T=null;var l=G.p;G.p=2;var f=at;at|=4;try{Pv(e,n.alternate,n)}finally{at=f,G.p=l,R.T=a}}Zt=3}}function p0(){if(Zt===4||Zt===3){Zt=0,da();var e=Na,n=vo,a=Ys,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=R.T,f=G.p,G.p=2,R.T=null;try{for(var h=e.onRecoverableError,_=0;_<l.length;_++){var w=l[_];h(w.value,{componentStack:w.stack})}}finally{R.T=n,G.p=f}}(Ys&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(Ys),l=R.T,f=G.p;try{G.p=32>a?32:a,R.T=null,a=vf,vf=null;var h=Na,_=Ys;if(Zt=0,vo=Na=null,Ys=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{G.p=f,R.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&&(ne(e,2),Ts(e))}function ct(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),ne(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&&(At===4||At===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&&(ne(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<<_,M=f[_];M===-1?((w&a)===0||(w&l)!==0)&&(f[_]=_l(w,n)):M<=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&&(lt===2||lt===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[rt]||null).action),_=l.submitter;_&&(n=(n=_[rt]||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 M=_?S0(f,_):new FormData(f);Vu(a,{pending:!0,data:M,method:f.method,action:h},null,M)}}else typeof h=="function"&&(w.preventDefault(),M=_?S0(f,_):new FormData(f),Vu(a,{pending:!0,data:M,method:f.method,action:h},h,M))},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[_],M=w.instance,q=w.currentTarget;if(w=w.listener,M!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=q;try{h(f)}catch(te){Ml(te)}f.currentTarget=null,h=M}else for(_=0;_<l.length;_++){if(w=l[_],M=w.instance,q=w.currentTarget,w=w.listener,M!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=q;try{h(f)}catch(te){Ml(te)}f.currentTarget=null,h=M}}}}function Pe(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 M=_.tag;if((M===3||M===4)&&_.stateNode.containerInfo===f)return;_=_.return}for(;w!==null;){if(_=Ui(w),_===null)return;if(M=_.tag,M===5||M===6||M===26||M===27){l=h=_;continue e}w=w.parentNode}}l=l.return}Ah(function(){var q=h,te=Gd(a),ie=[];e:{var F=ag.get(e);if(F!==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"),P=Ee?F!==null?F+"Capture":null:F;Ee=[];for(var L=q,V;L!==null;){var ae=L;if(V=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||V===null||P===null||(ae=Jo(L,P),ae!=null&&Ee.push(Er(L,ae,V))),pt)break;L=L.return}0<Ee.length&&(F=new K(F,be,null,a,te),ie.push({event:F,listeners:Ee}))}}if((n&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",F&&a!==qd&&(be=a.relatedTarget||a.fromElement)&&(Ui(be)||be[vt]))break e;if((K||F)&&(F=te.window===te?te:(F=te.ownerDocument)?F.defaultView||F.parentWindow:window,K?(be=a.relatedTarget||a.toElement,K=q,be=be?Ui(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,ae="onMouseLeave",P="onMouseEnter",L="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=Oh,ae="onPointerLeave",P="onPointerEnter",L="pointer"),pt=K==null?F:Yo(K),V=be==null?F:Yo(be),F=new Ee(ae,L+"leave",K,a,te),F.target=pt,F.relatedTarget=V,ae=null,Ui(te)===q&&(Ee=new Ee(P,L+"enter",be,a,te),Ee.target=V,Ee.relatedTarget=pt,ae=Ee),pt=ae,K&&be)t:{for(Ee=LS,P=K,L=be,V=0,ae=P;ae;ae=Ee(ae))V++;ae=0;for(var we=L;we;we=Ee(we))ae++;for(;0<V-ae;)P=Ee(P),V--;for(;0<ae-V;)L=Ee(L),ae--;for(;V--;){if(P===L||L!==null&&P===L.alternate){Ee=P;break t}P=Ee(P),L=Ee(L)}Ee=null}else Ee=null;K!==null&&w0(ie,F,K,Ee,!1),be!==null&&pt!==null&&w0(ie,pt,be,Ee,!0)}}e:{if(F=q?Yo(q):window,K=F.nodeName&&F.nodeName.toLowerCase(),K==="select"||K==="input"&&F.type==="file")var et=Vh;else if(Uh(F))if(qh)et=Kk;else{et=Fk;var ke=Gk}else K=F.nodeName,!K||K.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?q&&Vd(q.elementType)&&(et=Vh):et=Zk;if(et&&(et=et(e,q))){Hh(ie,et,a,te);break e}ke&&ke(e,F,q),e==="focusout"&&q&&F.type==="number"&&q.memoizedProps.value!=null&&Hd(F,"number",F.value)}switch(ke=q?Yo(q):window,e){case"focusin":(Uh(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(ie,a,te);break;case"selectionchange":if(Jk)break;case"keydown":case"keyup":Xh(ie,a,te)}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=te,Kd="value"in pa?pa.value:pa.textContent,Yi=!0)),ke=xc(q,Ve),0<ke.length&&(Ve=new Ih(Ve,e,null,a,te),ie.push({event:Ve,listeners:ke}),Oe?Ve.data=Oe:(Oe=Ph(a),Oe!==null&&(Ve.data=Oe)))),(Oe=Pk?Uk(e,a):Hk(e,a))&&(Ve=xc(q,"onBeforeInput"),0<Ve.length&&(ke=new Ih("onBeforeInput","beforeinput",null,a,te),ie.push({event:ke,listeners:Ve}),ke.data=Oe)),MS(ie,e,q,a,te)}T0(ie,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,M=w.alternate,q=w.stateNode;if(w=w.tag,M!==null&&M===l)break;w!==5&&w!==26&&w!==27||q===null||(M=q,f?(q=Jo(a,h),q!=null&&_.unshift(Er(a,q,M))):f||(q=Jo(a,h),q!=null&&_.push(Er(a,q,M)))),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=Is);break;case"onScroll":l!=null&&Pe("scroll",e);break;case"onScrollEnd":l!=null&&Pe("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":Pe("beforetoggle",e),Pe("toggle",e),Sl(e,"popover",l);break;case"xlinkActuate":Ms(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ms(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ms(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ms(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ms(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ms(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ms(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ms(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ms(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&&Pe("scroll",e);break;case"onScrollEnd":l!=null&&Pe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Is);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[rt]||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":Pe("error",e),Pe("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":Pe("invalid",e);var w=h=_=f=null,M=null,q=null;for(l in a)if(a.hasOwnProperty(l)){var te=a[l];if(te!=null)switch(l){case"name":f=te;break;case"type":_=te;break;case"checked":M=te;break;case"defaultChecked":q=te;break;case"value":h=te;break;case"defaultValue":w=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(r(137,n));break;default:ft(e,n,l,te,a,null)}}Th(e,h,w,M,q,_,f,!1);return;case"select":Pe("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":Pe("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(M in a)if(a.hasOwnProperty(M)&&(l=a[M],l!=null))switch(M){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ft(e,n,M,l,a,null)}return;case"dialog":Pe("beforetoggle",e),Pe("toggle",e),Pe("cancel",e),Pe("close",e);break;case"iframe":case"object":Pe("load",e);break;case"video":case"audio":for(l=0;l<Cr.length;l++)Pe(Cr[l],e);break;case"image":Pe("error",e),Pe("load",e);break;case"details":Pe("toggle",e);break;case"embed":case"source":case"link":Pe("error",e),Pe("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(te in a)a.hasOwnProperty(te)&&(l=a[te],l!==void 0&&Af(e,n,te,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 PS(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,M=null,q=null,te=null;for(K in a){var ie=a[K];if(a.hasOwnProperty(K)&&ie!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":M=ie;default:l.hasOwnProperty(K)||ft(e,n,K,null,l,ie)}}for(var F in l){var K=l[F];if(ie=a[F],l.hasOwnProperty(F)&&(K!=null||ie!=null))switch(F){case"type":h=K;break;case"name":f=K;break;case"checked":q=K;break;case"defaultChecked":te=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!==ie&&ft(e,n,F,K,l,ie)}}Ud(e,_,w,M,q,te,h,f);return;case"select":K=_=w=F=null;for(h in a)if(M=a[h],a.hasOwnProperty(h)&&M!=null)switch(h){case"value":break;case"multiple":K=M;default:l.hasOwnProperty(h)||ft(e,n,h,null,l,M)}for(f in l)if(h=l[f],M=a[f],l.hasOwnProperty(f)&&(h!=null||M!=null))switch(f){case"value":F=h;break;case"defaultValue":w=h;break;case"multiple":_=h;default:h!==M&&ft(e,n,f,h,l,M)}n=w,a=_,l=K,F!=null?Gi(e,!!a,F,!1):!!l!=!!a&&(n!=null?Gi(e,!!a,n,!0):Gi(e,!!a,a?[]:"",!1));return;case"textarea":K=F=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":F=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,F,K);return;case"option":for(var be in a)if(F=a[be],a.hasOwnProperty(be)&&F!=null&&!l.hasOwnProperty(be))switch(be){case"selected":e.selected=!1;break;default:ft(e,n,be,null,l,F)}for(M in l)if(F=l[M],K=a[M],l.hasOwnProperty(M)&&F!==K&&(F!=null||K!=null))switch(M){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:ft(e,n,M,F,l,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in a)F=a[Ee],a.hasOwnProperty(Ee)&&F!=null&&!l.hasOwnProperty(Ee)&&ft(e,n,Ee,null,l,F);for(q in l)if(F=l[q],K=a[q],l.hasOwnProperty(q)&&F!==K&&(F!=null||K!=null))switch(q){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(r(137,n));break;default:ft(e,n,q,F,l,K)}return;default:if(Vd(n)){for(var pt in a)F=a[pt],a.hasOwnProperty(pt)&&F!==void 0&&!l.hasOwnProperty(pt)&&Af(e,n,pt,void 0,l,F);for(te in l)F=l[te],K=a[te],!l.hasOwnProperty(te)||F===K||F===void 0&&K===void 0||Af(e,n,te,F,l,K);return}}for(var P in a)F=a[P],a.hasOwnProperty(P)&&F!=null&&!l.hasOwnProperty(P)&&ft(e,n,P,null,l,F);for(ie in l)F=l[ie],K=a[ie],!l.hasOwnProperty(ie)||F===K||F==null&&K==null||ft(e,n,ie,F,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 US(){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 M=a[l],q=M.startTime;if(q>w)break;var te=M.transferSize,ie=M.initiatorType;te&&E0(ie)&&(M=M.responseEnd,_+=te*(M<w?1:(w-q)/(M-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,P0=new Set;function kc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Js=G.d;G.d={f:YS,r:JS,D:WS,C:XS,L:QS,m:eT,X:nT,S:tT,M:sT};function YS(){var e=Js.f(),n=pc();return e||n}function JS(e){var n=Hi(e);n!==null&&n.tag===5&&n.type==="form"?sv(n):Js.r(e)}var _o=typeof document>"u"?null:document;function U0(e,n,a){var l=_o;if(l&&typeof n=="string"&&n){var f=Un(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),P0.has(f)||(P0.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),ln(n,"link",e),Qt(n),l.head.appendChild(n)))}}function WS(e){Js.D(e),U0("dns-prefetch",e,null)}function XS(e,n){Js.C(e,n),U0("preconnect",e,n)}function QS(e,n,a){Js.L(e,n,a);var l=_o;if(l&&e&&n){var f='link[rel="preload"][as="'+Un(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Un(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Un(a.imageSizes)+'"]')):f+='[href="'+Un(e)+'"]';var h=f;switch(n){case"style":h=ko(e);break;case"script":h=So(e)}Yn.has(h)||(e=x({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){Js.m(e,n);var a=_o;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Un(l)+'"][href="'+Un(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=x({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){Js.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=x({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Yn.get(h))&&$f(e,a);var M=_=l.createElement("link");Qt(M),ln(M,"link",e),M._p=new Promise(function(q,te){M.onload=q,M.onerror=te}),M.addEventListener("load",function(){w.loading|=1}),M.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){Js.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=x({src:e,async:!0},n),(n=Yn.get(f))&&Pf(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){Js.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=x({src:e,async:!0,type:"module"},n),(n=Yn.get(f))&&Pf(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="'+Un(e)+'"'}function Dr(e){return'link[rel="stylesheet"]['+e+"]"}function V0(e){return x({},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="'+Un(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~="'+Un(a.href)+'"]');if(l)return n.instance=l,Qt(l),l;var f=x({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),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,M){_.onload=w,_.onerror=M}),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=x({},a),Pf(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 Pf(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[Qe]||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,M){_.onload=w,_.onerror=M}),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 Uf=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&&Uf===0&&(Uf=62500*US());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>Uf?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,M){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=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=M,this.incompleteTransitions=new Map}function K0(e,n,a,l,f,h,_,w,M,q,te,ie){return e=new cT(e,n,a,_,M,q,te,ie,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=R.T;R.T=null;var h=G.p;try{G.p=2,Vf(e,n,a,l)}finally{G.p=h,R.T=f}}function uT(e,n,a,l){var f=R.T;R.T=null;var h=G.p;try{G.p=8,Vf(e,n,a,l)}finally{G.p=h,R.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 M=1<<31-Xt(_);w.entanglements[1]|=M,_&=~M}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=Ui(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=Ui(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(M){return Dc(M,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[rt]||null;if(typeof h=="function")_||ay(a);else if(_){var w=null;if(h&&h.hasAttribute("formAction")){if(f=h,_=h[rt]||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=Xe();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"));G.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var hT={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:R,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,M=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError),a.formState!==void 0&&(M=a.formState)),n=K0(e,1,!0,n,a??null,l,f,M,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,ne(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(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};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"),x=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${x}`))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}),Ye=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:x}){const[y,S]=b.useState(""),[k,j]=b.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),x==null||x("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 b.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=b.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...p},m)=>b.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])=>b.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 qe=(t,s)=>{const o=b.forwardRef(({className:r,...c},d)=>b.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=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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"}]],la=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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"}]],P2=qe("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 U2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],vm=qe("Info",U2);/**
137
- * @license lucide-react v0.474.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */const 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=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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=qe("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=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],uj=qe("Puzzle",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 fj=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Ex=qe("Search",fj);/**
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:"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"}]],mj=qe("Settings",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 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"}]],gj=qe("SquareCheckBig",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 vj=[["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=qe("TriangleAlert",vj);/**
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:"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"}]],bj=qe("User",yj);/**
222
- * @license lucide-react v0.474.0 - ISC
223
- *
224
- * This source code is licensed under the ISC license.
225
- * See the LICENSE file in the root directory of this source tree.
226
- */const xj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ka=qe("X",xj),bm=8,dt=12,nn=14,Nt=16,Up={not_started:{color:"var(--text-tertiary)",icon:i.jsx(Va,{size:dt}),label:"Not Started"},working:{color:"var(--accent-green)",icon:i.jsx(Va,{size:dt,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:i.jsx(rj,{size:dt}),label:"Paused"},complete:{color:"var(--accent-green)",icon:i.jsx(Ri,{size:dt}),label:"Complete"},failed:{color:"var(--accent-red)",icon:i.jsx(Ka,{size:dt}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:i.jsx(v2,{size:dt}),label:"Blocked"}};function qa(t){return t==="blocked"?Up.blocked:Up[pl(t)]}const _j={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function kj(t){return _j[pl(t)]??"statusPending"}const Sj=["working","paused","failed","not_started","blocked","complete"],xy=["not_started","working","paused","complete","failed"],Tj={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function pl(t){return t in Up&&t!=="blocked"?t:Tj[t]??"not_started"}const jj={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"},wj="_dagContainer_js4w6_1",Nj="_taskNode_js4w6_26",Cj="_taskNodeBorder_js4w6_54",Ej="_taskNodeContent_js4w6_60",Aj="_taskNodeHeader_js4w6_70",Dj="_taskNodeIcon_js4w6_77",Rj="_taskNodeTitle_js4w6_82",Mj="_taskNodeBadges_js4w6_90",Ij="_childBadge_js4w6_95",Oj="_depBadge_js4w6_107",Bj="_handle_js4w6_119",Lj="_emptyCta_js4w6_126",zj="_ctaDescription_js4w6_137",$j="_ctaButton_js4w6_144",bn={dagContainer:wj,taskNode:Nj,taskNodeBorder:Cj,taskNodeContent:Ej,taskNodeHeader:Aj,taskNodeIcon:Dj,taskNodeTitle:Rj,taskNodeBadges:Mj,childBadge:Ij,depBadge:Oj,handle:Bj,emptyCta:Lj,ctaDescription:zj,ctaButton:$j};function Pj({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})]})}/**
227
- * react-router v7.13.2
228
- *
229
- * Copyright (c) Remix Software Inc.
230
- *
231
- * This source code is licensed under the MIT license found in the
232
- * LICENSE.md file in the root directory of this source tree.
233
- *
234
- * @license MIT
235
- */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 Uj(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 Vj(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 Hj(){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||Hj(),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 Vj(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 x(){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),O=j.createHref(C.unstable_mask||C);try{u.pushState(A,"",O)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;c.location.assign(O)}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),O=j.createHref(C.unstable_mask||C);u.replaceState(A,"",O),d&&m&&m({action:p,location:j.location,delta:0})}function k(N){return qj(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,x),m=N,()=>{c.removeEventListener(_y,x),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 qj(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 Gj(t,s,o,!1)}function Gj(t,s,o,r){let c=typeof s=="string"?Ho(s):s,d=aa(c.pathname||"/",o);if(d==null)return null;let u=Dx(t);Fj(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=Mx(d);p=tw(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 x=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 "${x}".`),Dx(u.children,s,y,x,m)),!(u.path==null&&!u.index)&&s.push({path:x,score:Qj(x,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 Fj(t){t.sort((s,o)=>s.score!==o.score?o.score-s.score:ew(s.routesMeta.map(r=>r.childrenIndex),o.routesMeta.map(r=>r.childrenIndex)))}var Zj=/^:[\w-]+$/,Kj=3,Yj=2,Jj=1,Wj=10,Xj=-2,Ty=t=>t==="*";function Qj(t,s){let o=t.split("/"),r=o.length;return o.some(Ty)&&(r+=Xj),s&&(r+=Yj),o.filter(c=>!Ty(c)).reduce((c,d)=>c+(Zj.test(d)?Kj:d===""?Jj:Wj),r)}function ew(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 tw(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)||"/",x=ol({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),y=m.route;if(!x&&g&&o&&!r[r.length-1].route.index&&(x=ol({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!x)return null;Object.assign(c,x.params),u.push({params:c,pathname:Cs([d,x.pathname]),pathnameBase:ow(Cs([d,x.pathnameBase])),route:y}),x.pathnameBase!=="/"&&(d=Cs([d,x.pathnameBase]))}return u}function ol(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[o,r]=nw(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:x},y)=>{if(v==="*"){let k=p[y]||"";u=d.slice(0,d.length-k.length).replace(/(.)\/+$/,"$1")}const S=p[y];return x&&!S?g[v]=void 0:g[v]=(S||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function nw(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 x=v.charAt(g+u.length);return x&&x!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 aa(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 sw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function aw(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:rw(r),hash:lw(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 iw(t){return t.filter((s,o)=>o===0||s.route.path&&s.route.path.length>0)}function xm(t){let s=iw(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 x=s.length-1;if(!r&&u.startsWith("..")){let y=u.split("/");for(;y[0]==="..";)y.shift(),x-=1;c.pathname=y.join("/")}p=x>=0?s[x]:"/"}let m=aw(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,"/"),ow=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),rw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,lw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,cw=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 dw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function uw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Ix=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ox(t,s){let o=t;if(typeof o!="string"||!sw.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=aa(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 fw=["GET",...Bx];new Set(fw);var Vo=b.createContext(null);Vo.displayName="DataRouter";var Cd=b.createContext(null);Cd.displayName="DataRouterState";var pw=b.createContext(!1),Lx=b.createContext({isTransitioning:!1});Lx.displayName="ViewTransition";var mw=b.createContext(new Map);mw.displayName="Fetchers";var hw=b.createContext(null);hw.displayName="Await";var Ln=b.createContext(null);Ln.displayName="Navigation";var ml=b.createContext(null);ml.displayName="Location";var ss=b.createContext({outlet:null,matches:[],isDataRoute:!1});ss.displayName="Route";var _m=b.createContext(null);_m.displayName="RouteError";var zx="REACT_ROUTER_ERROR",gw="REDIRECT",vw="ROUTE_ERROR_RESPONSE";function yw(t){if(t.startsWith(`${zx}:${gw}:{`))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 bw(t){if(t.startsWith(`${zx}:${vw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new cw(s.status,s.statusText,s.data)}catch{}}function xw(t,{relative:s}={}){_t(Mi(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:r}=b.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 b.useContext(ml)!=null}function Yt(){return _t(Mi(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(ml).location}function Dt(t){_t(Mi(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Yt();return b.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 Px(t){b.useContext(Ln).static||b.useLayoutEffect(t)}function Ed(){let{isDataRoute:t}=b.useContext(ss);return t?Ow():_w()}function _w(){_t(Mi(),"useNavigate() may be used only in the context of a <Router> component.");let t=b.useContext(Vo),{basename:s,navigator:o}=b.useContext(Ln),{matches:r}=b.useContext(ss),{pathname:c}=Yt(),d=JSON.stringify(xm(r)),u=b.useRef(!1);return Px(()=>{u.current=!0}),b.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 kw=b.createContext(null);function Sw(t){let s=b.useContext(ss).outlet;return b.useMemo(()=>s&&b.createElement(kw.Provider,{value:t},s),[s,t])}function as(){let{matches:t}=b.useContext(ss),s=t[t.length-1];return s?s.params:{}}function hl(t,{relative:s}={}){let{matches:o}=b.useContext(ss),{pathname:r}=Yt(),c=JSON.stringify(xm(o));return b.useMemo(()=>Nd(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function Tw(t,s){return Ux(t,s)}function Ux(t,s,o){var N;_t(Mi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=b.useContext(Ln),{matches:c}=b.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.
236
-
237
- Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let v=Yt(),x;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.`),x=T}else x=v;let y=x.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 "${x.pathname}${x.search}${x.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 "${x.pathname}${x.search}${x.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=Ew(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?b.createElement(ml.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...x},navigationType:"POP"}},j):j}function jw(){let t=Iw(),s=dw(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=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:d},"ErrorBoundary")," or"," ",b.createElement("code",{style:d},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},s),o?b.createElement("pre",{style:c},o):null,u)}var ww=b.createElement(jw,null),Hx=class extends b.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){this.props.onError?this.props.onError(t,s):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const o=bw(t.digest);o&&(t=o)}let s=t!==void 0?b.createElement(ss.Provider,{value:this.props.routeContext},b.createElement(_m.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?b.createElement(Nw,{error:t},s):s}};Hx.contextType=pw;var Xf=new WeakMap;function Nw({children:t,error:s}){let{basename:o}=b.useContext(Ln);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=yw(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 b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function Cw({routeContext:t,match:s,children:o}){let r=b.useContext(Vo);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),b.createElement(ss.Provider,{value:t},o)}function Ew(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(x=>x.route.id&&(d==null?void 0:d[x.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 x=c[v];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(p=v),x.route.id){let{loaderData:y,errors:S}=r,k=x.route.loader&&!y.hasOwnProperty(x.route.id)&&(!S||S[x.route.id]===void 0);if(x.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,x)=>{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:uw(r.matches),errorInfo:x})}:void 0;return c.reduceRight((v,x,y)=>{let S,k=!1,j=null,N=null;r&&(S=d&&x.route.id?d[x.route.id]:void 0,j=x.route.errorElement||ww,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=x.route.hydrateFallbackElement||null)));let T=s.concat(c.slice(0,y+1)),C=()=>{let A;return S?A=j:k?A=N:x.route.Component?A=b.createElement(x.route.Component,null):x.route.element?A=x.route.element:A=v,b.createElement(Cw,{match:x,routeContext:{outlet:v,matches:T,isDataRoute:r!=null},children:A})};return r&&(x.route.ErrorBoundary||x.route.errorElement||y===0)?b.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 Aw(t){let s=b.useContext(Vo);return _t(s,km(t)),s}function Dw(t){let s=b.useContext(Cd);return _t(s,km(t)),s}function Rw(t){let s=b.useContext(ss);return _t(s,km(t)),s}function Sm(t){let s=Rw(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 Mw(){return Sm("useRouteId")}function Iw(){var r;let t=b.useContext(_m),s=Dw("useRouteError"),o=Sm("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[o]}function Ow(){let{router:t}=Aw("useNavigate"),s=Sm("useNavigate"),o=b.useRef(!1);return Px(()=>{o.current=!0}),b.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))}b.memo(Bw);function Bw({routes:t,future:s,state:o,isStatic:r,onError:c}){return Ux(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}=b.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}=b.useContext(ss),{pathname:u}=Yt(),p=Ed(),m=Nd(t,xm(d),u,r==="path"),g=JSON.stringify(m);return b.useEffect(()=>{p(JSON.parse(g),{replace:s,state:o,relative:r})},[p,g,r,s,o]),null}function Ya(t){return Sw(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 Lw({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=b.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:x="",state:y=null,key:S="default",unstable_mask:k}=o,j=b.useMemo(()=>{let N=aa(g,p);return N==null?null:{location:{pathname:N,search:v,hash:x,state:y,key:S,unstable_mask:k},navigationType:r}},[p,g,v,x,y,S,r,k]);return ns(j!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${x}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:b.createElement(Ln.Provider,{value:m},b.createElement(ml.Provider,{children:s,value:j}))}function zw({children:t,location:s}){return Tw(Vp(t),s)}function Vp(t,s=[]){let o=[];return b.Children.forEach(t,(r,c)=>{if(!b.isValidElement(r))return;let d=[...s,c];if(r.type===b.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 $w(t){return Ad(t)&&t.tagName.toLowerCase()==="button"}function Pw(t){return Ad(t)&&t.tagName.toLowerCase()==="form"}function Uw(t){return Ad(t)&&t.tagName.toLowerCase()==="input"}function Hw(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Vw(t,s){return t.button===0&&(!s||s==="_self")&&!Hw(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 qw(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 Gw(){if($c===null)try{new FormData(document.createElement("form"),0),$c=!1}catch{$c=!0}return $c}var Fw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Qf(t){return t!=null&&!Fw.has(t)?(ns(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${td}"`),null):t}function Zw(t,s){let o,r,c,d,u;if(Pw(t)){let p=t.getAttribute("action");r=p?aa(p,s):null,o=t.getAttribute("method")||ed,c=Qf(t.getAttribute("enctype"))||td,d=new FormData(t)}else if($w(t)||Uw(t)&&(t.type==="submit"||t.type==="image")){let p=t.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=t.getAttribute("formaction")||p.getAttribute("action");if(r=m?aa(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),!Gw()){let{name:g,type:v,value:x}=t;if(v==="image"){let y=g?`${g}.`:"";d.append(`${y}x`,"0"),d.append(`${y}y`,"0")}else g&&d.append(g,x)}}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 Kw(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&&aa(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function Yw(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 Jw(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 Ww(t,s,o){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await Yw(d,o);return u.links?u.links():[]}return[]}));return tN(r.flat(1).filter(Jw).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 x;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:((x=o[0])==null?void 0:x.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function Xw(t,s,{includeHydrateFallback:o}={}){return Qw(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 Qw(t){return[...new Set(t)]}function eN(t){let s={},o=Object.keys(t).sort();for(let r of o)s[r]=t[r];return s}function tN(t,s){let o=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(eN(c));return o.has(d)||(o.add(d),r.push({key:d,link:c})),r},[])}function qx(){let t=b.useContext(Vo);return Tm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function nN(){let t=b.useContext(Cd);return Tm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var jm=b.createContext(void 0);jm.displayName="FrameworkContext";function Gx(){let t=b.useContext(jm);return Tm(t,"You must render this element inside a <HydratedRouter> element"),t}function sN(t,s){let o=b.useContext(jm),[r,c]=b.useState(!1),[d,u]=b.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:v,onTouchStart:x}=s,y=b.useRef(null);b.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]),b.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(x,S)}]:[!1,y,{}]}function $r(t,s){return o=>{t&&t(o),o.defaultPrevented||s(o)}}function aN({page:t,...s}){let{router:o}=qx(),r=b.useMemo(()=>Ax(o.routes,t,o.basename),[o.routes,t,o.basename]);return r?b.createElement(oN,{page:t,matches:r,...s}):null}function iN(t){let{manifest:s,routeModules:o}=Gx(),[r,c]=b.useState([]);return b.useEffect(()=>{let d=!1;return Ww(t,s,o).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,o]),r}function oN({page:t,matches:s,...o}){let r=Yt(),{future:c,manifest:d,routeModules:u}=Gx(),{basename:p}=qx(),{loaderData:m,matches:g}=nN(),v=b.useMemo(()=>Ny(t,s,g,d,r,"data"),[t,s,g,d,r]),x=b.useMemo(()=>Ny(t,s,g,d,r,"assets"),[t,s,g,d,r]),y=b.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let j=new Set,N=!1;if(s.forEach(C=>{var O;let A=d.routes[C.route.id];!A||!A.hasLoader||(!v.some(E=>E.route.id===C.route.id)&&C.route.id in m&&((O=u[C.route.id])!=null&&O.shouldRevalidate)||A.hasClientLoader?N=!0:j.add(C.route.id))}),j.size===0)return[];let T=Kw(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=b.useMemo(()=>Xw(x,d),[x,d]),k=iN(x);return b.createElement(b.Fragment,null,y.map(j=>b.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...o})),S.map(j=>b.createElement("link",{key:j,rel:"modulepreload",href:j,...o})),k.map(({key:j,link:N})=>b.createElement("link",{key:j,nonce:o.nonce,...N,crossOrigin:N.crossOrigin??o.crossOrigin})))}function rN(...t){return s=>{t.forEach(o=>{typeof o=="function"?o(s):o!=null&&(o.current=s)})}}var lN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{lN&&(window.__reactRouterVersion="7.13.2")}catch{}function cN({basename:t,children:s,unstable_useTransitions:o,window:r}){let c=b.useRef();c.current==null&&(c.current=Uj({window:r,v5Compat:!0}));let d=c.current,[u,p]=b.useState({action:d.action,location:d.location}),m=b.useCallback(g=>{o===!1?p(g):b.startTransition(()=>p(g))},[o]);return b.useLayoutEffect(()=>d.listen(m),[d,m]),b.createElement(Lw,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:o})}var Fx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wm=b.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:x,viewTransition:y,unstable_defaultShouldRevalidate:S,...k},j){let{basename:N,navigator:T,unstable_useTransitions:C}=b.useContext(Ln),A=typeof v=="string"&&Fx.test(v),O=Ox(v,N);v=O.to;let E=xw(v,{relative:c}),D=Yt(),U=null;if(p){let oe=Nd(p,[],D.unstable_mask?D.unstable_mask.pathname:"/",!0);N!=="/"&&(oe.pathname=oe.pathname==="/"?N:Cs([N,oe.pathname])),U=T.createHref(oe)}let[B,z,X]=sN(r,k),$=pN(v,{replace:u,unstable_mask:p,state:m,target:g,preventScrollReset:x,relative:c,viewTransition:y,unstable_defaultShouldRevalidate:S,unstable_useTransitions:C});function J(oe){s&&s(oe),oe.defaultPrevented||$(oe)}let me=!(O.isExternal||d),ee=b.createElement("a",{...k,...X,href:(me?U:void 0)||O.absoluteURL||E,onClick:me?J:s,ref:rN(j,z),target:g,"data-discover":!A&&o==="render"?"true":void 0});return B&&!A?b.createElement(b.Fragment,null,ee,b.createElement(aN,{page:E})):ee});wm.displayName="Link";var dN=b.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 x=hl(u,{relative:g.relative}),y=Yt(),S=b.useContext(Cd),{navigator:k,basename:j}=b.useContext(Ln),N=S!=null&&yN(x)&&p===!0,T=k.encodeLocation?k.encodeLocation(x).pathname:x.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=aa(A,j)||A);const O=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let E=C===T||!c&&C.startsWith(T)&&C.charAt(O)==="/",D=A!=null&&(A===T||!c&&A.startsWith(T)&&A.charAt(T.length)==="/"),U={isActive:E,isPending:D,isTransitioning:N},B=E?s:void 0,z;typeof r=="function"?z=r(U):z=[r,E?"active":null,D?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let X=typeof d=="function"?d(U):d;return b.createElement(wm,{...g,"aria-current":B,className:z,ref:v,style:X,to:u,viewTransition:p},typeof m=="function"?m(U):m)});dN.displayName="NavLink";var uN=b.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:x,unstable_defaultShouldRevalidate:y,...S},k)=>{let{unstable_useTransitions:j}=b.useContext(Ln),N=gN(),T=vN(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",A=typeof p=="string"&&Fx.test(p),O=E=>{if(m&&m(E),E.defaultPrevented)return;E.preventDefault();let D=E.nativeEvent.submitter,U=(D==null?void 0:D.getAttribute("formmethod"))||u,B=()=>N(D||E.currentTarget,{fetcherKey:s,method:U,navigate:o,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:x,unstable_defaultShouldRevalidate:y});j&&o!==!1?b.startTransition(()=>B()):B()};return b.createElement("form",{ref:k,method:C,action:T,onSubmit:r?m:O,...S,"data-discover":!A&&t==="render"?"true":void 0})});uN.displayName="Form";function fN(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=b.useContext(Vo);return _t(s,fN(t)),s}function pN(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(),x=Yt(),y=hl(t,{relative:u});return b.useCallback(S=>{if(Vw(S,s)){S.preventDefault();let k=o!==void 0?o:il(x)===il(y),j=()=>v(t,{replace:k,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m});g?b.startTransition(()=>j()):j()}},[x,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=b.useRef(qp(t)),o=b.useRef(!1),r=Yt(),c=b.useMemo(()=>qw(r.search,o.current?null:s.current),[r.search]),d=Ed(),u=b.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 mN=0,hN=()=>`__${String(++mN)}__`;function gN(){let{router:t}=Zx("useSubmit"),{basename:s}=b.useContext(Ln),o=Mw(),r=t.fetch,c=t.navigate;return b.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:x}=Zw(d,s);if(u.navigate===!1){let y=u.fetcherKey||hN();await r(y,o,u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:x,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:x,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 vN(t,{relative:s}={}){let{basename:o}=b.useContext(Ln),r=b.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(x=>x).forEach(x=>p.append("index",x));let v=p.toString();d.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(d.pathname=d.pathname==="/"?o:Cs([o,d.pathname])),il(d)}function yN(t,{relative:s}={}){let o=b.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=aa(o.currentLocation.pathname,r)||o.currentLocation.pathname,u=aa(o.nextLocation.pathname,r)||o.nextLocation.pathname;return ol(c.pathname,u)!=null||ol(c.pathname,d)!=null}function mt(){const t=Ed();return b.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",bN="/environments/new";function Ai(t){return`/environments/${encodeURIComponent(t)}`}function xN(t){return`/environments/${encodeURIComponent(t)}/edit`}const Ni="/settings",_N="/settings/credentials",ep="/settings/personas",kN="/settings/personas/new";function Yx(t){return`/settings/personas/${encodeURIComponent(t)}`}const tp="/settings/schedules",SN="/settings/schedules/new";function Jx(t){return`/settings/schedules/${encodeURIComponent(t)}`}const TN="/settings/shortcuts",jN="/pair",wN="/chat",Di="/",NN="/tasks",Wx="/workspaces/new",Xx="/knowledge",Dd="/findings";function CN(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 EN=jj,AN={task:Pj};function DN({workspaceId:t,environmentId:s,tasks:o,resolvedThemeId:r}){const c=mt(),d=b.useMemo(()=>o.filter(x=>x.workspaceId===t),[o,t]),{nodes:u,edges:p}=d2(d),m=b.useMemo(()=>{const x=getComputedStyle(document.documentElement),y={};for(const[S,k]of Object.entries(EN))y[S]=x.getPropertyValue(k).trim()||"#6b7a8d";return y},[r]),g=b.useCallback((x,y)=>{c(On(y.id,void 0,t,s))},[c,t,s]),v=b.useCallback(x=>{const y=x.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:AN,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 RN="_breadcrumbs_17or2_1",MN="_list_17or2_11",IN="_item_17or2_21",ON="_separator_17or2_28",BN="_link_17or2_34",LN="_current_17or2_57",jo={breadcrumbs:RN,list:MN,item:IN,separator:ON,link:BN,current:LN};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(la,{size:dt})}),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 zN="_btn_dwk2o_1",$N="_sm_dwk2o_22",PN="_md_dwk2o_28",UN="_lg_dwk2o_34",HN="_primary_dwk2o_40",VN="_danger_dwk2o_55",qN="_outline_dwk2o_70",GN="_ghost_dwk2o_80",np={btn:zN,sm:$N,md:PN,lg:UN,primary:HN,danger:VN,outline:qN,ghost:GN},tn=b.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})}),FN="_copyButton_1bqk0_1",ZN={copyButton:FN},KN=2e3;function YN({text:t,className:s,"data-testid":o}){const[r,c]=b.useState(!1),d=b.useRef(void 0);b.useEffect(()=>()=>{d.current!==void 0&&clearTimeout(d.current)},[]);const u=b.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},KN)}catch{}},[t]);return i.jsx("button",{type:"button",className:`${ZN.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 JN="_banner_bxqlh_1",WN="_label_bxqlh_15",XN="_text_bxqlh_25",QN="_link_bxqlh_29",Pc={banner:JN,label:WN,text:XN,link:QN};function eC(){return i.jsxs("div",{className:Pc.banner,"data-testid":"demo-banner",children:[i.jsx("span",{className:Pc.label,children:"DEMO"}),i.jsxs("span",{className:Pc.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:Pc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const tC="_container_og0yp_1",nC="_chevronButton_og0yp_6",sC="_mainButton_og0yp_6",aC="_sm_og0yp_34",iC="_md_og0yp_34",oC="_lg_og0yp_34",rC="_primary_og0yp_57",lC="_danger_og0yp_70",cC="_outline_og0yp_83",dC="_ghost_og0yp_92",uC="_dropdown_og0yp_100",fC="_option_og0yp_113",pC="_optionLabel_og0yp_130",mC="_optionDesc_og0yp_135",Ws={container:tC,chevronButton:nC,mainButton:sC,sm:aC,md:iC,lg:oC,primary:rC,danger:lC,outline:cC,ghost:dC,dropdown:uC,option:fC,optionLabel:pC,optionDesc:mC};function Qx({label:t,onClick:s,options:o,variant:r="primary",size:c="md","data-testid":d}){const[u,p]=b.useState(!1),m=b.useRef(null);b.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]),b.useEffect(()=>{if(!u)return;function y(S){S.key==="Escape"&&p(!1)}return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[u]);const g=Ws[r]||"",v=Ws[c]||"",x=()=>{u&&p(!1),s()};return i.jsxs("div",{ref:m,className:Ws.container,"data-testid":d,children:[i.jsx("button",{type:"button",className:`${Ws.mainButton} ${g} ${v}`,onClick:x,"data-testid":d?`${d}-main`:void 0,children:t}),i.jsx("button",{type:"button",className:`${Ws.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:Ws.dropdown,"data-testid":d?`${d}-menu`:void 0,children:o.map((y,S)=>i.jsxs("button",{type:"button",className:Ws.option,onClick:()=>{y.onClick(),p(!1)},children:[i.jsx("span",{className:Ws.optionLabel,children:y.label}),y.description&&i.jsx("span",{className:Ws.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.
238
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var hC=(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,x=(function(E){for(var D,U=sp(E.properties.className);!(D=U()).done;){var B=D.value;if(B.slice(0,9)==="language-")return B.slice(9).toLowerCase()}return null})(r);if(!x&&s.defaultLanguage&&r.properties.className.push("language-"+(x=s.defaultLanguage)),r.properties.className.push("code-highlight"),x)try{var y,S;S=(y=x)!=null&&y.includes("diff-")?x.split("-")[1]:x,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(U,B){if(B.type==="text"){var z=B.value,X=(z.match(/\n/g)||"").length;if(X===0)B.position={start:{line:v,column:1},end:{line:v,column:1}},U.push(B);else for(var $,J=z.split(`
239
- `),me=sp(J.entries());!($=me()).done;){var ee=$.value,oe=ee[0],R=ee[1];U.push({type:"text",value:oe===J.length-1?R:R+`
240
- `,position:{start:{line:v+oe,column:1},end:{line:v+oe,column:1}}})}return v+=X,U}if(Object.prototype.hasOwnProperty.call(B,"children")){var G=v;return B.children=E(B.children),U.push(B),B.position={start:{line:G,column:1},end:{line:v,column:1}},U}return U.push(B),U},[])})(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,-]+)}/,U=E.split(",").map(function(X){return X.trim()}).join();if(D.test(U)){var B=D.exec(U)[1],z=PT(B);return function(X){return z.includes(X+1)}}return function(){return!1}})(m),N=(function(E){var D=Fp(/showLineNumbers=(\d+)/i,{lines:1});if(D.test(E)){var U=D.exec(E);return Number(U.groups.lines)}return 1})(m),T=(function(E){for(var D=new Array(E),U=0;U<E;U++)D[U]={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,U=k.value,B=U[0],z=U[1];z.properties.className=["code-line"];var X=UT(g,function($){return $.position.start.line<=B+1&&$.position.end.line>=B+1});z.children=X.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(x))&&!C.some(function($){return m.toLowerCase().includes($)})&&(z.properties.line=[(B+N).toString()],z.properties.className.push("line-number")),j(B)&&z.properties.className.push("highlight-line"),(x==="diff"||(E=x)!=null&&E.includes("diff-"))&&Bc(z).substring(0,1)==="-"?z.properties.className.push("deleted"):(x==="diff"||(D=x)!=null&&D.includes("diff-"))&&Bc(z).substring(0,1)==="+"&&z.properties.className.push("inserted")},O=sp(T.entries());!(k=O()).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 gC={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",ipc_share_stream:"ipc",ipc_list_streams:"ipc",toolsearch:"tool-search",agent:"agent",task:"agent",read_agent:"agent"};function vC(t){const s=qo(t);return gC[s.toLowerCase()]??"generic"}const yC="_card_qkm9i_2",bC="_cardBlue_qkm9i_20",xC="_cardOrange_qkm9i_24",_C="_cardGreen_qkm9i_28",kC="_cardPurple_qkm9i_32",SC="_cardNeutral_qkm9i_36",TC="_cardRed_qkm9i_40",jC="_cardTeal_qkm9i_44",wC="_header_qkm9i_48",NC="_icon_qkm9i_55",CC="_toolName_qkm9i_64",EC="_fileName_qkm9i_71",AC="_badge_qkm9i_80",DC="_spacer_qkm9i_87",RC="_bodyToggle_qkm9i_91",MC="_chevron_qkm9i_109",IC="_chevronExpanded_qkm9i_115",OC="_pre_qkm9i_119",BC="_diffAdd_qkm9i_143",LC="_diffRemove_qkm9i_155",zC="_diffContext_qkm9i_167",$C="_diffHeader_qkm9i_176",PC="_diffLine_qkm9i_182",UC="_exitOk_qkm9i_188",HC="_exitError_qkm9i_194",VC="_exitPending_qkm9i_200",qC="_inProgress_qkm9i_228",GC="_metadata_qkm9i_232",FC="_metadataPrefix_qkm9i_239",I={card:yC,cardBlue:bC,cardOrange:xC,cardGreen:_C,cardPurple:kC,cardNeutral:SC,cardRed:TC,cardTeal:jC,header:wC,icon:NC,toolName:CC,fileName:EC,badge:AC,spacer:DC,bodyToggle:RC,chevron:MC,chevronExpanded:IC,pre:OC,diffAdd:BC,diffRemove:LC,diffContext:zC,diffHeader:$C,diffLine:PC,exitOk:UC,exitError:HC,exitPending:VC,inProgress:qC,metadata:GC,metadataPrefix:FC};function ZC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.file_path=="string"?s.file_path:typeof s.path=="string"?s.path:""}function KC(t){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]=b.useState(!1),p=ZC(s),m=KC(p),g=o===void 0,v=r?I.cardRed:c?I.cardGreen:I.cardBlue,x=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(`
241
- `))??[],j=k.length>ap,N=d?k:k.slice(0,ap);return i.jsxs("div",{className:`${I.card} ${v} ${g?I.inProgress:""}`,"data-testid":S,children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,children:y}),i.jsx("span",{className:I.toolName,style:{color:x},children:t}),m&&i.jsx("span",{className:I.fileName,title:p,children:m}),!g&&k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,children:[k.length," lines"]})]})]}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-content",children:N.map((T,C)=>i.jsxs("span",{className:I.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:I.bodyToggle,onClick:()=>{u(T=>!T)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${d?I.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),d?"collapse":`${k.length-ap} more lines`]})]})]})}function YC(t){const s=t.split(`
242
- `),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 JC(t,s){const o=t.split(`
243
- `),r=s.split(`
244
- `),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 WC(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 XC(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 QC(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 eE(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function tE(t,s){if(s){let r=s;if(s.trimStart().startsWith("{"))try{const c=JSON.parse(s);typeof c.detailedContent=="string"&&(r=c.detailedContent)}catch{}if(r.includes("@@")||r.startsWith("diff ")){const c=YC(r);if(c.length>0)return c}}const o=QC(t);if(o)return JC(o.oldStr,o.newStr)}const ip=5;function nE({tool:t,args:s,result:o,isError:r,detailedResult:c}){const[d,u]=b.useState(!1),p=XC(s),m=eE(p),g=o===void 0,v=tE(s,c),x=v?WC(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:`${I.card} ${r?I.cardRed:I.cardOrange} ${g?I.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,children:i.jsx(cj,{size:nn})}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&i.jsx("span",{className:I.fileName,title:p,children:m}),x&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-diff-stats",children:[i.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",x.added]})," ",i.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",x.removed]})]})]})]}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&S&&S.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-diff",children:S.map((k,j)=>{let N=I.diffContext;return k.type==="add"&&(N=I.diffAdd),k.type==="remove"&&(N=I.diffRemove),k.type==="header"&&(N=I.diffHeader),i.jsx("span",{className:`${I.diffLine} ${N}`,children:k.content},j)})}),y&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(k=>!k)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${d?I.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),d?"collapse":`${((v==null?void 0:v.length)??0)-ip} more lines`]})]}),!r&&!v&&!g&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-content",children:o})]})}const sE=/^\[exit (\d+)\]\s*/;function aE(t){const s=sE.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function iE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function oE(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 rE({tool:t,args:s,result:o,isError:r}){const[c,d]=b.useState(!1),u=iE(s),p=oE(u),m=o===void 0,g=o?aE(o):null,v=(g==null?void 0:g.output.split(`
245
- `))??[],x=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:`${I.card} ${k?I.cardRed:I.cardNeutral}`,"data-testid":"tool-card-shell",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),i.jsx("span",{className:I.fileName,style:{flex:1,color:"var(--text-primary)"},title:u!==p?u:void 0,"data-testid":"tool-card-command",children:p}),S!==void 0&&i.jsxs("span",{className:S===0?I.exitOk:I.exitError,"data-testid":"tool-card-exit-code",children:[S===0?i.jsx(Ri,{size:dt,"aria-hidden":"true"}):i.jsx(Ka,{size:dt,"aria-hidden":"true"})," ","exit ",S]}),m&&i.jsx("span",{className:I.exitPending,"data-testid":"tool-card-pending",children:i.jsx(W2,{size:dt,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-output",children:y.join(`
246
- `)}),x&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),c?"collapse":`${v.length-op} more lines`]})]})]})}function lE(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 cE({tool:t,args:s,result:o,isError:r}){const[c,d]=b.useState(!1),{pattern:u,path:p}=lE(s),m=o===void 0,g=(o==null?void 0:o.split(`
247
- `).filter(y=>y.length>0))??[],v=g.length>rp,x=c?g:g.slice(0,rp);return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${m?I.inProgress:""}`,"data-testid":"tool-card-search",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,children:i.jsx(Ex,{size:nn})}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&i.jsxs("span",{className:I.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),p&&i.jsxs("span",{className:I.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:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&x.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-results",children:x.join(`
248
- `)}),v&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(y=>!y)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),c?"collapse":`${g.length-rp} more matches`]})]})]})}const dE="_progressBar_14f5c_1",uE="_progressFill_14f5c_9",fE="_activeTask_14f5c_16",pE="_activeIcon_14f5c_27",mE="_todoPulse_14f5c_1",hE="_activeText_14f5c_34",gE="_checklist_14f5c_48",vE="_item_14f5c_55",yE="_itemIcon_14f5c_65",bE="_itemText_14f5c_73",xE="_pending_14f5c_78",_E="_in_progress_14f5c_85",kE="_completed_14f5c_97",SE="_emptyMessage_14f5c_108",cs={progressBar:dE,progressFill:uE,activeTask:fE,activeIcon:pE,todoPulse:mE,activeText:hE,checklist:gE,item:vE,itemIcon:yE,itemText:bE,pending:xE,in_progress:_E,completed:kE,emptyMessage:SE},TE=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function jE(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"?wE(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 wE(t){const s=t.split(`
249
- `),o=[];for(const r of s){const c=TE.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 NE(t){switch(t){case"completed":return i.jsx(Ri,{size:dt});case"in_progress":return i.jsx(Va,{size:dt,fill:"currentColor"});default:return i.jsx(Va,{size:dt})}}function CE({args:t}){const s=jE(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:`${I.card} ${I.cardBlue}`,"data-testid":"tool-card-todo",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,children:i.jsx(Z2,{size:nn})}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.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:dt,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:NE(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 EE(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 AE({tool:t,args:s}){const o=EE(t,s);return i.jsxs("div",{className:I.metadata,"data-testid":"tool-card-metadata",children:[i.jsx("span",{className:I.metadataPrefix,children:i.jsx(I2,{size:dt})}),o]})}function DE(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 RE(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 ME({tool:t,args:s,result:o,isError:r}){const[c,d]=b.useState(!1),u=qo(t),p=DE(s),m=o===void 0,{single:g,list:v}=RE(o),x=(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:`${I.card} ${r?I.cardRed:I.cardPurple} ${m?I.inProgress:""}`,"data-testid":"tool-card-finding",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"💡"}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),x&&i.jsxs("span",{className:I.fileName,"data-testid":"tool-card-finding-title",children:['"',x,'"']}),y&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsx("span",{className:I.badge,"data-testid":"tool-card-finding-category",children:y})]}),v&&!y&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-finding-count",children:[v.length," ",v.length===1?"finding":"findings"]})]})]}),S&&S.length>0&&i.jsx("div",{className:I.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&&!x&&s!==null&&s!==void 0&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:I.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(`
250
- `),j=k.length>cp,N=c?g.content:k.slice(0,cp).join(`
251
- `);return i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-finding-content",children:N}),j&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${k.length-cp} more lines`]})]})})()}),!r&&v&&v.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.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(`
252
- `)}),v.length>lp&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-lp} more findings`]})]})]})}function IE(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 OE(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 BE(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 LE({tool:t,args:s,result:o,isError:r}){const[c,d]=b.useState(!1),u=qo(t),p=IE(s),m=o===void 0,{single:g,list:v,sessionId:x}=OE(o),y=(g==null?void 0:g.title)??p.title,S=(g==null?void 0:g.status)??p.status;return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardBlue} ${m?I.inProgress:""}`,"data-testid":"tool-card-task",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"📋"}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:u}),y&&i.jsxs("span",{className:I.fileName,"data-testid":"tool-card-task-title",children:['"',y,'"']}),!y&&p.taskId&&i.jsx("span",{className:I.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),S&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,style:{color:BE(S)},"data-testid":"tool-card-task-status",children:[Ry(S)," ",S]})]}),v&&!S&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.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:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&x&&i.jsxs("div",{className:I.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",x]}),!r&&g&&!v&&!x&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-task-detail",children:[g.id?`id: ${g.id}`:null,g.status?`status: ${g.status}`:null,g.branch?`branch: ${g.branch}`:null,g.latestSessionId?`session: ${g.latestSessionId}`:null].filter(Boolean).join(`
253
- `)}),!r&&v&&v.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.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(`
254
- `)}),v.length>dp&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-dp} more tasks`]})]})]})}function zE(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 $E(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 PE({tool:t,args:s,result:o,isError:r}){const[c,d]=b.useState(!1),u=qo(t),p=zE(s),m=o===void 0,g=$E(o),v=g.status??p.status,x=g.summary??p.summary;return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardGreen} ${m?I.inProgress:""}`,"data-testid":"tool-card-workpad",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"📓"}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsx("span",{className:I.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),x&&i.jsx("pre",{className:I.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:x}),m&&!x&&s!==null&&s!==void 0&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&!x&&!v&&!g.extra&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:o}),!r&&g.extra&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(y=>!y)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function UE(t){if(t==null||typeof t!="object")return{};const s=t;return{query:typeof s.query=="string"?s.query:void 0,id:typeof s.id=="string"?s.id:void 0}}function HE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const 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 VE({tool:t,args:s,result:o,isError:r}){const[c,d]=b.useState(!1),u=qo(t),p=UE(s),m=o===void 0,g=HE(o);return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${m?I.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🧠"}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&i.jsxs("span",{className:I.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&i.jsx("span",{className:I.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-knowledge-count",children:[g.results.length," ",g.results.length===1?"result":"results"]})]}),g.node&&g.edgeCount!==void 0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-knowledge-edges",children:[g.edgeCount," ",g.edgeCount===1?"edge":"edges"]})]})]}),m&&s!==null&&s!==void 0&&!p.query&&!p.id&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&g.results&&g.results.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,up)).map(v=>{var S,k,j;const x=((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`${x}${y}`}).join(`
255
- `)}),g.results.length>up&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-up} more results`]})]}),!r&&g.node&&!g.results&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-knowledge-node",children:[g.node.id?`id: ${g.node.id}`:null,g.node.title?`title: ${g.node.title}`:null,g.node.category?`category: ${g.node.category}`:null,g.node.kind?`kind: ${g.node.kind}`:null,g.node.content?`content: ${g.node.content.length>100?g.node.content.slice(0,100)+"...":g.node.content}`:null].filter(Boolean).join(`
256
- `)})]})}function qE(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 GE(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 FE({tool:t,args:s,result:o,isError:r}){const[c,d]=b.useState(!1),u=qo(t),p=qE(s),m=o===void 0,g=GE(o);let v="";p.pipe?v=`[${p.pipe}]`:p.fd!==void 0?v=`fd:${p.fd}`:p.name&&(v=`"${p.name}"`);const x=p.prompt?p.prompt.length>60?`${p.prompt.slice(0,60)}...`:p.prompt:void 0;return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardOrange} ${m?I.inProgress:""}`,"data-testid":"tool-card-ipc",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🔀"}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&i.jsx("span",{className:I.fileName,"data-testid":"tool-card-ipc-info",children:v}),x&&i.jsx("span",{className:I.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:x}),g.fds&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-ipc-fd-count",children:[g.fds.length," ",g.fds.length===1?"fd":"fds"]})]}),g.success!==void 0&&!g.fds&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsx("span",{className:I.badge,style:{color:g.success?"var(--accent-green, #4ade80)":"var(--accent-red, #f87171)"},"data-testid":"tool-card-ipc-success",children:g.success?"✓ ok":"✗ failed"})]})]}),m&&!x&&!v&&s!==null&&s!==void 0&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&g.sessionId&&i.jsxs("div",{className:I.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-ipc-session",children:["session: ",g.sessionId,g.fd!==void 0&&` | fd: ${g.fd}`]}),!r&&g.output&&i.jsx("pre",{className:I.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:I.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(`
257
- `)}),g.fds.length>5&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(y=>!y)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function ZE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const fp=8;function KE({args:t,result:s,isError:o}){const[r,c]=b.useState(!1),d=ZE(t),u=s===void 0,p=(s==null?void 0:s.split(`
258
- `))??[],m=p.length>fp,g=r?s:p.slice(0,fp).join(`
259
- `);return i.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardNeutral} ${u?I.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🔧"}),i.jsx("span",{className:I.toolName,children:"ToolSearch"}),d&&i.jsxs("span",{className:I.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!o&&s&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:I.spacer}),i.jsxs("span",{className:I.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),o&&s&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:s}),!o&&!u&&s&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-tool-search-result",children:g}),m&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${r?I.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${p.length-fp} more lines`]})]})]})}function YE(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function JE(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 WE({tool:t,args:s,result:o,isError:r}){const[c,d]=b.useState(!1),{display:u}=YE(t),p=JE(s),m=o===void 0,g=(o==null?void 0:o.split(`
260
- `))??[],v=g.length>pp,x=c?o:g.slice(0,pp).join(`
261
- `);let y="";if(s!=null)try{y=JSON.stringify(s,null,2)}catch{y=String(s)}return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardBlue} ${m?I.inProgress:""}`,"data-testid":"tool-card-generic",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,children:i.jsx(A2,{size:nn,"aria-hidden":"true"})}),i.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&i.jsx("span",{className:I.fileName,children:p})]}),m&&y&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:y}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:x}),v&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),c?"collapse":`${g.length-pp} more lines`]})]})]})}const XE="_badgePill_o7eqc_1",QE="_modelBadge_o7eqc_14",eA="_backgroundBadge_o7eqc_26",tA="_backgroundDot_o7eqc_36",nA="_backgroundDotPulsing_o7eqc_41",sA="_description_o7eqc_55",aA="_statusLine_o7eqc_62",iA="_statusCompleted_o7eqc_72",oA="_statusRunning_o7eqc_77",rA="_statusError_o7eqc_83",lA="_promptToggle_o7eqc_88",ds={badgePill:XE,modelBadge:QE,backgroundBadge:eA,backgroundDot:tA,backgroundDotPulsing:nA,description:sA,statusLine:aA,statusCompleted:iA,statusRunning:oA,statusError:rA,promptToggle:lA};function cA(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 dA=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function uA(t){const s=dA.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 fA({tool:t,args:s,result:o,isError:r}){const[c,d]=b.useState(!1),[u,p]=b.useState(!1),m=cA(t,s),g=o===void 0,v=m.isPoll&&o?uA(o):void 0,x=(v==null?void 0:v.content)??o,y=(x==null?void 0:x.split(`
262
- `))??[],S=y.length>mp,k=c?x:y.slice(0,mp).join(`
263
- `),j=m.isPoll?"Subagent":"Agent";return i.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardTeal} ${g?I.inProgress:""}`,"data-testid":"tool-card-agent",children:[i.jsxs("div",{className:I.header,children:[i.jsx("span",{className:I.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),i.jsx("span",{className:I.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:I.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&i.jsx("span",{className:I.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),i.jsx("span",{className:I.spacer}),g&&!m.isBackground&&i.jsx("span",{className:I.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:`${I.chevron} ${u?I.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&o&&i.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&x&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:k}),S&&i.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${y.length-mp} more lines`]})]})]})}function hp(t){switch(vC(t.tool)){case"file-read":return i.jsx(Ay,{...t});case"file-edit":return i.jsx(nE,{...t});case"file-write":return i.jsx(Ay,{...t,writeVariant:!0});case"shell":return i.jsx(rE,{...t});case"search":return i.jsx(cE,{...t});case"todo":return i.jsx(CE,{...t});case"metadata":return i.jsx(AE,{...t});case"finding":return i.jsx(ME,{...t});case"task":return i.jsx(LE,{...t});case"workpad":return i.jsx(PE,{...t});case"knowledge":return i.jsx(VE,{...t});case"ipc":return i.jsx(FE,{...t});case"tool-search":return i.jsx(KE,{...t});case"agent":return i.jsx(fA,{...t});default:return i.jsx(WE,{...t})}}const pA="_systemContextEvent_hmqlm_1",mA="_systemContextHeader_hmqlm_7",hA="_systemContextBadge_hmqlm_28",gA="_systemContextToggle_hmqlm_37",vA="_systemContextPre_hmqlm_43",yA="_systemContextEllipsis_hmqlm_54",bA="_systemEvent_hmqlm_58",xA="_systemTimestamp_hmqlm_65",_A="_textEvent_hmqlm_69",kA="_codeBlockWrapper_hmqlm_156",SA="_codeBlockCopyButton_hmqlm_159",TA="_errorEvent_hmqlm_163",jA="_statusEvent_hmqlm_171",wA="_userInputEvent_hmqlm_180",NA="_userInputContent_hmqlm_186",CA="_signalEvent_hmqlm_203",EA="_signalBadge_hmqlm_214",AA="_signalContent_hmqlm_223",DA="_usageEvent_hmqlm_228",RA="_usageBadge_hmqlm_235",MA="_defaultEvent_hmqlm_244",Pt={systemContextEvent:pA,systemContextHeader:mA,systemContextBadge:hA,systemContextToggle:gA,systemContextPre:vA,systemContextEllipsis:yA,systemEvent:bA,systemTimestamp:xA,textEvent:_A,codeBlockWrapper:kA,codeBlockCopyButton:SA,errorEvent:TA,statusEvent:jA,userInputEvent:wA,userInputContent:NA,signalEvent:CA,signalBadge:EA,signalContent:AA,usageEvent:DA,usageBadge:RA,defaultEvent:MA},My=3;function IA({content:t}){const[s,o]=b.useState(!1),r=t.split(`
264
- `),c=r.length>My,d=s?t:r.slice(0,My).join(`
265
- `);return i.jsxs("div",{className:Pt.systemContextEvent,"data-testid":"system-context-event",children:[i.jsxs("button",{type:"button",className:Pt.systemContextHeader,onClick:()=>{o(u=>!u)},"aria-expanded":s,children:[i.jsx("span",{className:Pt.systemContextBadge,children:"SYSTEM PROMPT"}),c&&i.jsx("span",{className:Pt.systemContextToggle,"aria-hidden":"true",children:s?i.jsx(Nx,{size:dt}):i.jsx(la,{size:dt})})]}),i.jsxs("pre",{className:Pt.systemContextPre,children:[d,!s&&c&&i.jsx("span",{className:Pt.systemContextEllipsis,children:"…"})]})]})}function OA({time:t,content:s}){return i.jsxs("div",{className:Pt.systemEvent,children:[i.jsxs("span",{className:Pt.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 BA({children:t,node:s,...o}){const r=Zp(t);return i.jsxs("div",{className:Pt.codeBlockWrapper,children:[i.jsx("pre",{...o,children:t}),i.jsx(YN,{text:r,"data-testid":"copy-code-block",className:Pt.codeBlockCopyButton})]})}const LA={pre:BA};function zA({content:t}){return i.jsx("div",{className:Pt.textEvent,children:i.jsx(Td,{remarkPlugins:[jd],rehypePlugins:[hC],components:LA,children:t})})}function $A({content:t}){return i.jsxs("div",{className:Pt.errorEvent,children:["Error: ",t]})}function PA({content:t}){return i.jsxs("div",{className:Pt.statusEvent,children:["--- ",t," ---"]})}function UA({content:t}){return i.jsx("div",{className:Pt.userInputEvent,children:i.jsx("span",{className:Pt.userInputContent,children:t})})}function HA({content:t}){return i.jsxs("div",{className:Pt.signalEvent,"data-testid":"signal-event",children:[i.jsx("span",{className:Pt.signalBadge,children:"SIGNAL"}),i.jsx("span",{className:Pt.signalContent,children:t})]})}function VA({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:Pt.usageEvent,"data-testid":"usage-event",children:i.jsx("span",{className:Pt.usageBadge,children:s})})}function qA({content:t}){return i.jsx("div",{className:Pt.defaultEvent,children:t})}function GA({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(IA,{content:t.content})}catch{}return i.jsx(OA,{time:r,content:t.content})}case"text":case"output":return i.jsx(zA,{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($A,{content:t.content});case"status":return i.jsx(PA,{content:t.content});case"user_input":return i.jsx(UA,{content:t.content});case"signal":return i.jsx(HA,{content:t.content});case"usage":return i.jsx(VA,{content:t.content});default:return i.jsx(qA,{content:t.content})}}const Em=b.createContext({});function Am(t){const s=b.useRef(null);return s.current===null&&(s.current=t()),s.current}const Rd=b.createContext(null),Dm=b.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class FA extends b.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 ZA({children:t,isPresent:s}){const o=b.useId(),r=b.useRef(null),c=b.useRef({width:0,height:0,top:0,left:0}),{nonce:d}=b.useContext(Dm);return b.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(`
266
- [data-motion-pop-id="${o}"] {
267
- position: absolute !important;
268
- width: ${u}px !important;
269
- height: ${p}px !important;
270
- top: ${m}px !important;
271
- left: ${g}px !important;
272
- }
273
- `),()=>{document.head.removeChild(v)}},[s]),i.jsx(FA,{isPresent:s,childRef:r,sizeRef:c,children:b.cloneElement(t,{ref:r})})}const KA=({children:t,initial:s,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=Am(YA),m=b.useId(),g=b.useCallback(x=>{p.set(x,!0);for(const y of p.values())if(!y)return;r&&r()},[p,r]),v=b.useMemo(()=>({id:m,initial:s,isPresent:o,custom:c,onExitComplete:g,register:x=>(p.set(x,!1),()=>p.delete(x))}),d?[Math.random(),g]:[o,g]);return b.useMemo(()=>{p.forEach((x,y)=>p.set(y,!1))},[o]),b.useEffect(()=>{!o&&!p.size&&r&&r()},[o]),u==="popLayout"&&(t=i.jsx(ZA,{isPresent:o,children:t})),i.jsx(Rd.Provider,{value:v,children:t})};function YA(){return new Map}function e_(t=!0){const s=b.useContext(Rd);if(s===null)return[!0,null];const{isPresent:o,onExitComplete:r,register:c}=s,d=b.useId();b.useEffect(()=>{t&&c(d)},[t]);const u=b.useCallback(()=>t&&r&&r(d),[d,r,t]);return!o&&r?[!1,u]:[!0]}const Uc=t=>t.key||"";function Iy(t){const s=[];return b.Children.forEach(t,o=>{b.isValidElement(o)&&s.push(o)}),s}const Rm=typeof window<"u",t_=Rm?b.useLayoutEffect:b.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=b.useMemo(()=>Iy(t),[t]),v=u&&!p?[]:g.map(Uc),x=b.useRef(!0),y=b.useRef(g),S=Am(()=>new Map),[k,j]=b.useState(g),[N,T]=b.useState(g);t_(()=>{x.current=!1,y.current=g;for(let O=0;O<N.length;O++){const E=Uc(N[O]);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 O=[...g];for(let E=0;E<N.length;E++){const D=N[E],U=Uc(D);v.includes(U)||(O.splice(E,0,D),C.push(D))}d==="wait"&&C.length&&(O=C),T(Iy(O)),j(g);return}const{forceRender:A}=b.useContext(Em);return i.jsx(i.Fragment,{children:N.map(O=>{const E=Uc(O),D=u&&!p?!1:g===N||v.includes(E),U=()=>{if(S.has(E))S.set(E,!0);else return;let B=!0;S.forEach(z=>{z||(B=!1)}),B&&(A==null||A(),T(y.current),u&&(m==null||m()),r&&r())};return i.jsx(KA,{isPresent:D,initial:!x.current||o?void 0:!1,custom:D?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:D?void 0:U,children:O},E)})})},In=t=>t;let n_=In;const JA={useManualTiming:!1};function WA(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,x=!1)=>{const S=x&&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"],XA=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]=WA(d),T),{}),{read:p,resolveKeyframes:m,update:g,preRender:v,render:x,postRender:y}=u,S=()=>{const T=performance.now();o=!1,c.delta=r?1e3/60:Math.max(Math.min(T-c.timestamp,XA),1),c.timestamp=T,c.isProcessing=!0,p.process(c),m.process(c),g.process(c),v.process(c),x.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]=(O,E=!1,D=!1)=>(o||k(),A.schedule(O,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_=b.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 QA(t){for(const s in t)Bo[s]={...Bo[s],...t[s]}}const eD=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")||eD.has(t)}let i_=t=>!dd(t);function tD(t){t&&(i_=s=>s.startsWith("on")?!dd(s):t(s))}try{tD(require("@emotion/is-prop-valid").default)}catch{}function nD(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 sD(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=b.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 aD(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 iD(t){const{initial:s,animate:o}=aD(t,b.useContext(Md));return b.useMemo(()=>({initial:s,animate:o}),[By(s),By(o)])}function By(t){return Array.isArray(t)?t.join(" "):t}const oD=Symbol.for("motionComponentSymbol");function Co(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function rD(t,s,o){return b.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(),lD="framerAppearId",r_="data-"+Om(lD),{schedule:Bm}=s_(queueMicrotask,!1),l_=b.createContext({});function cD(t,s,o,r,c){var d,u;const{visualElement:p}=b.useContext(Md),m=b.useContext(a_),g=b.useContext(Rd),v=b.useContext(Dm).reducedMotion,x=b.useRef(null);r=r||m.renderer,!x.current&&r&&(x.current=r(t,{visualState:s,parent:p,props:o,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const y=x.current,S=b.useContext(l_);y&&!y.projection&&c&&(y.type==="html"||y.type==="svg")&&dD(x.current,o,c,S);const k=b.useRef(!1);b.useInsertionEffect(()=>{y&&k.current&&y.update(o,g)});const j=o[r_],N=b.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())}),b.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 dD(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 uD({preloadedFeatures:t,createVisualElement:s,useRender:o,useVisualState:r,Component:c}){var d,u;t&&QA(t);function p(g,v){let x;const y={...b.useContext(Dm),...g,layoutId:fD(g)},{isStatic:S}=y,k=iD(g),j=r(g,S);if(!S&&Rm){pD();const N=mD(y);x=N.MeasureLayout,k.visualElement=cD(c,j,y,s,N.ProjectionNode)}return i.jsxs(Md.Provider,{value:k,children:[x&&k.visualElement?i.jsx(x,{visualElement:k.visualElement,...y}):null,o(c,g,rD(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=b.forwardRef(p);return m[oD]=c,m}function fD({layoutId:t}){const s=b.useContext(Em).id;return s&&t!==void 0?s+"-"+t:t}function pD(t,s){b.useContext(a_).strict}function mD(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 hD=["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:!!(hD.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),gD=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),vD=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 gD(s)?s.toValue():s}function yD({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:o},r,c,d){const u={latestValues:bD(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=b.useContext(Md),c=b.useContext(Rd),d=()=>yD(t,s,r,c);return o?d():Am(d)};function bD(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 x=v?p:u;if(x&&typeof x!="boolean"&&!Id(x)){const y=Array.isArray(x)?x:[x];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 O=v?A.length-1:0;A=A[O]}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_("--"),xD=u_("var(--"),$m=t=>xD(t)?_D.test(t.split("/*")[0].trim()):!1,_D=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,p_=(t,s)=>s&&typeof t=="number"?s.transform(t):t,ia=(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=>ia(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}`}),Ua=gl("deg"),Es=gl("%"),Ae=gl("px"),kD=gl("vh"),SD=gl("vw"),zy={...Es,parse:t=>Es.parse(t)/100,transform:t=>Es.transform(t*100)},TD={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},jD={rotate:Ua,rotateX:Ua,rotateY:Ua,rotateZ:Ua,scale:Vc,scaleX:Vc,scaleY:Vc,scaleZ:Vc,skew:Ua,skewX:Ua,skewY:Ua,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},Pm={...TD,...jD,zIndex:$y,size:Ae,fillOpacity:ll,strokeOpacity:ll,numOctaves:$y},wD={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ND=Go.length;function CD(t,s,o){let r="",c=!0;for(let d=0;d<ND;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,Pm[u]);if(!m){c=!1;const v=wD[u]||u;r+=`${v}(${g}) `}o&&(s[u]=g)}}return r=r.trim(),o?r=o(s,c?"":r):c&&(r="none"),r}function Um(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,Pm[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||o?r.transform=CD(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 ED={offset:"stroke-dashoffset",array:"stroke-dasharray"},AD={offset:"strokeDashoffset",array:"strokeDasharray"};function DD(t,s,o=1,r=0,c=!0){t.pathLength=1;const d=c?ED:AD;t[d.offset]=Ae.transform(-r);const u=Ae.transform(s),p=Ae.transform(o);t[d.array]=`${u} ${p}`}function Py(t,s,o){return typeof t=="string"?t:Ae.transform(s+o*t)}function RD(t,s,o){const r=Py(s,t.x,t.width),c=Py(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,x){if(Um(t,g,x),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=RD(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&&DD(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 MD(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 ID(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 Uy=["x","y","width","height","cx","cy","r"],OD={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<Uy.length;p++){const m=Uy[p];t[m]!==s[m]&&(u=!0)}u&&kt.read(()=>{ID(o,r),kt.render(()=>{Hm(r,c,qm(o.tagName),t.transformTemplate),v_(o,r)})})}})},BD={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 LD({transformTemplate:t},s){return b.useMemo(()=>{const o=Vm();return Um(o,s,t),Object.assign({},o.vars,o.style)},[s])}function zD(t,s){const o=t.style||{},r={};return x_(r,o,t),Object.assign(r,LD(t,s)),r}function $D(t,s){const o={},r=zD(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 PD(t,s,o,r){const c=b.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 UD(t=!1){return(o,r,c,{latestValues:d},u)=>{const m=(Lm(o)?PD:$D)(r,d,u,o),g=nD(r,typeof o=="string",t),v=o!==b.Fragment?{...g,...m,ref:c}:{},{children:x}=r,y=b.useMemo(()=>fn(x)?x.get():x,[x]);return b.createElement(o,{...v,children:y})}}function HD(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Lm(r)?OD:BD,preloadedFeatures:t,useRender:UD(c),createVisualElement:s,Component:r};return uD(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 VD(){sd=void 0}const As={now:()=>(sd===void 0&&As.set(cn.isProcessing||JA.useManualTiming?cn.timestamp:performance.now()),sd),set:t=>{sd=t,queueMicrotask(VD)}};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,qD=t=>!isNaN(parseFloat(t));class GD{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=qD(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 GD(t,s)}function FD(t,s,o){t.hasValue(s)?t.getValue(s).set(o):t.addValue(s,cl(o))}function ZD(t,s){const o=Bd(t,s);let{transitionEnd:r={},transition:c={},...d}=o||{};d={...d,...r};for(const u in d){const p=vD(d[u]);FD(t,u,p)}}function KD(t){return!!(fn(t)&&t.add)}function Yp(t,s){const o=t.getValue("willChange");if(KD(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 YD=Jm(()=>window.ScrollTimeline!==void 0);class JD{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(YD()&&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 WD extends JD{then(s,o){return Promise.all(this.animations).then(s).catch(o)}}const ta=t=>t*1e3,na=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",XD={linearEasing:void 0};function QD(t,s){const o=Jm(t);return()=>{var r;return(r=XD[s])!==null&&r!==void 0?r:o()}}const fd=QD(()=>{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,eR=1e-7,tR=12;function nR(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)>eR&&++p<tR);return u}function vl(t,s,o,r){if(t===s&&o===r)return In;const c=d=>nR(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 sR(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 aR(t){return t==null}const iR=/^(?:#[\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"&&iR.test(o)&&o.startsWith(t)||s&&!aR(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}},oR=t=>ia(0,255,t),vp={...Fo,transform:t=>Math.round(oR(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 rR(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:rR,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)},lR=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function cR(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(lR))===null||o===void 0?void 0:o.length)||0)>0}const z_="number",$_="color",dR="var",uR="var(",qy="${}",fR=/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(fR,m=>(un.test(m)?(r.color.push(d),c.push($_),o.push(un.parse(m))):m.startsWith(uR)?(r.var.push(d),c.push(dR),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 P_(t){return dl(t).values}function U_(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 pR=t=>typeof t=="number"?0:t;function mR(t){const s=P_(t);return U_(t)(s.map(pR))}const Za={test:cR,parse:P_,createTransformer:U_,getAnimatableNone:mR},hR=new Set(["brightness","contrast","saturate","opacity"]);function gR(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=hR.has(s)?1:0;return r!==o&&(d*=100),s+"("+d+c+")"}const vR=/\b([a-z-]*)\(.*?\)/gu,Xp={...Za,getAnimatableNone:t=>{const s=t.match(vR);return s?s.map(gR).join(" "):t}},yR={...Pm,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=>yR[t];function H_(t,s){let o=sh(t);return o!==Xp&&(o=Za),o.getAnimatableNone?o.getAnimatableNone(s):void 0}const bR=new Set(["auto","none","0"]);function xR(t,s,o){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!bR.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}},_R=new Set(["x","y","z"]),kR=Go.filter(t=>!_R.has(t));function SR(t){const s=[];return kR.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=SR(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 TR(){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),jR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function wR(t){const s=jR.exec(t);if(!s)return[,];const[,o,r,c]=s;return[`--${o??r}`,c]}function F_(t,s,o=1){const[r,c]=wR(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),NR={test:t=>t==="auto",parse:t=>t},K_=[Fo,Ae,Es,Ua,SD,kD,NR],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++)sR(s[c])&&r.push(c);r.length&&xR(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 CR(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 ER(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:CR(t)||(o==="spring"||Wm(o))&&r}const AR=t=>t!==null;function Ld(t,{repeat:s,repeatType:o="loop"},r){const c=t.filter(AR),d=s&&o!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const DR=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>DR?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&TR(),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&&!ER(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 Ct=(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 RR({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)},MR=[Wp,wi,Eo],IR=t=>MR.find(s=>s.test(t));function Jy(t){const s=IR(t);if(!s)return!1;let o=s.parse(t);return s===Eo&&(o=RR(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=Ct(o.alpha,r.alpha,d),wi.transform(c))},OR=(t,s)=>o=>s(t(o)),yl=(...t)=>t.reduce(OR),nm=new Set(["none","hidden"]);function BR(t,s){return nm.has(t)?o=>o<=0?t:s:o=>o>=1?s:t}function LR(t,s){return o=>Ct(t,s,o)}function ih(t){return typeof t=="number"?LR:typeof t=="string"?$m(t)?pd:un.test(t)?Wy:PR:Array.isArray(t)?X_:typeof t=="object"?un.test(t)?Wy:zR: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 zR(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 $R(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 PR=(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?BR(t,s):yl(X_($R(r,c),c.values),o):pd(t,s)};function Q_(t,s,o){return typeof t=="number"&&typeof s=="number"&&typeof o=="number"?Ct(t,s,o):ih(t)(t,s)}const UR=5;function e1(t,s,o){const r=Math.max(s-UR,0);return S_(o-t(r),s-r)}const Rt={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 HR({duration:t=Rt.duration,bounce:s=Rt.bounce,velocity:o=Rt.velocity,mass:r=Rt.mass}){let c,d,u=1-s;u=ia(Rt.minDamping,Rt.maxDamping,u),t=ia(Rt.minDuration,Rt.maxDuration,na(t)),u<1?(c=g=>{const v=g*u,x=v*t,y=v-o,S=sm(g,u),k=Math.exp(-x);return xp-y/S*k},d=g=>{const x=g*u*t,y=x*o+o,S=Math.pow(u,2)*Math.pow(g,2)*t,k=Math.exp(-x),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),x=(g-o)*t+1;return-xp+v*x},d=g=>{const v=Math.exp(-g*t),x=(o-g)*(t*t);return v*x});const p=5/t,m=qR(c,d,p);if(t=ta(t),isNaN(m))return{stiffness:Rt.stiffness,damping:Rt.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const VR=12;function qR(t,s,o){let r=o;for(let c=1;c<VR;c++)r=r-t(r)/s(r);return r}function sm(t,s){return t*Math.sqrt(1-s*s)}const GR=["duration","bounce"],FR=["stiffness","damping","mass"];function Xy(t,s){return s.some(o=>t[o]!==void 0)}function ZR(t){let s={velocity:Rt.velocity,stiffness:Rt.stiffness,damping:Rt.damping,mass:Rt.mass,isResolvedFromDuration:!1,...t};if(!Xy(t,FR)&&Xy(t,GR))if(t.visualDuration){const o=t.visualDuration,r=2*Math.PI/(o*1.2),c=r*r,d=2*ia(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:Rt.mass,stiffness:c,damping:d}}else{const o=HR(t);s={...s,...o,mass:Rt.mass},s.isResolvedFromDuration=!0}return s}function t1(t=Rt.visualDuration,s=Rt.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:x,velocity:y,isResolvedFromDuration:S}=ZR({...o,velocity:-na(o.velocity||0)}),k=y||0,j=g/(2*Math.sqrt(m*v)),N=u-d,T=na(Math.sqrt(m/v)),C=Math.abs(N)<5;r||(r=C?Rt.restSpeed.granular:Rt.restSpeed.default),c||(c=C?Rt.restDelta.granular:Rt.restDelta.default);let A;if(j<1){const E=sm(T,j);A=D=>{const U=Math.exp(-j*T*D);return u-U*((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 U=Math.exp(-j*T*D),B=Math.min(E*D,300);return u-U*((k+j*T*N)*Math.sinh(B)+E*N*Math.cosh(B))/E}}const O={calculatedDuration:S&&x||null,next:E=>{const D=A(E);if(S)p.done=E>=x;else{let U=0;j<1&&(U=E===0?ta(k):e1(A,E,D));const B=Math.abs(U)<=r,z=Math.abs(u-D)<=c;p.done=B&&z}return p.value=p.done?u:D,p},toString:()=>{const E=Math.min(W_(O),tm),D=j_(U=>O.next(E*U).value,E,30);return E+"ms "+D}};return O}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 x=t[0],y={done:!1,value:x},S=B=>p!==void 0&&B<p||m!==void 0&&B>m,k=B=>p===void 0?m:m===void 0||Math.abs(p-B)<Math.abs(m-B)?p:m;let j=o*s;const N=x+j,T=u===void 0?N:u(N);T!==N&&(j=T-x);const C=B=>-j*Math.exp(-B/r),A=B=>T+C(B),O=B=>{const z=C(B),X=A(B);y.done=Math.abs(z)<=g,y.value=y.done?T:X};let E,D;const U=B=>{S(y.value)&&(E=B,D=t1({keyframes:[y.value,k(y.value)],velocity:e1(A,B,y.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return U(0),{calculatedDuration:null,next:B=>{let z=!1;return!D&&E===void 0&&(z=!0,O(B),U(B)),E!==void 0&&B>=E?D.next(B-E):(!z&&O(B),y)}}}const KR=vl(.42,0,1,1),YR=vl(0,0,.58,1),n1=vl(.42,0,.58,1),JR=t=>Array.isArray(t)&&typeof t[0]!="number",WR={linear:In,easeIn:KR,easeInOut:n1,easeOut:YR,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 WR[t];return t};function XR(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 QR(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=XR(s,r,c),m=p.length,g=v=>{if(u&&v<t[0])return s[0];let x=0;if(m>1)for(;x<t.length-2&&!(v<t[x+1]);x++);const y=Lo(t[x],t[x+1],v);return p[x](y)};return o?v=>g(ia(t[0],t[d-1],v)):g}function e4(t,s){const o=t[t.length-1];for(let r=1;r<=s;r++){const c=Lo(0,s,r);t.push(Ct(o,1,c))}}function t4(t){const s=[0];return e4(s,t.length-1),s}function n4(t,s){return t.map(o=>o*s)}function s4(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=JR(r)?r.map(eb):eb(r),d={done:!1,value:s[0]},u=n4(o&&o.length===s.length?o:t4(s),t),p=QR(u,s,{ease:Array.isArray(c)?c:s4(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const a4=t=>{const s=({timestamp:o})=>t(o);return{start:()=>kt.update(s,!0),stop:()=>Fa(s),now:()=>cn.isProcessing?cn.timestamp:As.now()}},i4={decay:Qy,inertia:Qy,tween:md,keyframes:md,spring:t1},o4=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:i4[o]||md;let m,g;p!==md&&typeof s[0]!="number"&&(m=yl(o4,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:x}=v,y=x+c,S=y*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:m,calculatedDuration:x,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:B}=this.options;return{done:!0,value:B[B.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:u,mapPercentToKeyframes:p,keyframes:m,calculatedDuration:g,totalDuration:v,resolvedDuration:x}=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,O=d;if(S){const B=Math.min(this.currentTime,v)/x;let z=Math.floor(B),X=B%1;!X&&B>=1&&(X=1),X===1&&z--,z=Math.min(z,S+1),!!(z%2)&&(k==="reverse"?(X=1-X,j&&(X-=j/x)):k==="mirror"&&(O=u)),A=ia(0,1,X)*x}const E=C?{done:!1,value:m[0]}:O.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 U=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&D);return U&&c!==void 0&&(E.value=Ld(m,this.options,c)),N&&N(E.value),U&&this.finish(),E}get duration(){const{resolved:s}=this;return s?na(s.calculatedDuration):0}get time(){return na(this.currentTime)}set time(s){s=ta(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=na(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=a4,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 r4=new Set(["opacity","clipPath","filter","transform"]);function l4(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 c4=Jm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),hd=10,d4=2e4;function u4(t){return Wm(t.type)||t.type==="spring"||!w_(t.ease)}function f4(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<d4;)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 p4(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()&&p4(d)&&(d=s1[d]),u4(this.options)){const{onComplete:x,onUpdate:y,motionValue:S,element:k,...j}=this.options,N=f4(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=l4(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:x}=this.options;p.set(Ld(s,this.options,o)),x&&x(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:r,times:c,type:u,ease:d,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:o}=s;return na(o)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:o}=s;return na(o.currentTime||0)}set time(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.currentTime=ta(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:x,element:y,...S}=this.options,k=new oh({...S,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),j=ta(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 c4()&&r&&r4.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const m4={type:"spring",stiffness:500,damping:25,restSpeed:10},h4=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),g4={type:"keyframes",duration:.8},v4={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},y4=(t,{keyframes:s})=>s.length>2?g4:Oi.has(t)?t.startsWith("scale")?h4(s[1]):m4:v4;function b4({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-ta(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};b4(p)||(v={...v,...y4(t,v)}),v.duration&&(v.duration=ta(v.duration)),v.repeatDelay&&(v.repeatDelay=ta(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let x=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(x=!0)),x&&!d&&s.get()!==void 0){const y=Ld(v.keyframes,p);if(y!==void 0)return kt.update(()=>{v.onUpdate(y),v.onComplete()}),new WD([])}return!d&&tb.supports(v)?new tb(v):new oh(v)};function x4({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 x in m){const y=t.getValue(x,(d=t.latestValues[x])!==null&&d!==void 0?d:null),S=m[x];if(S===void 0||v&&x4(v,x))continue;const k={delay:o,...Fm(u||{},x)};let j=!1;if(window.MotionHandoffAnimation){const T=T_(t);if(T){const C=window.MotionHandoffAnimation(T,x,kt);C!==null&&(k.startTime=C,j=!0)}}Yp(t,x),y.start(rh(x,y,S,t.shouldReduceMotion&&k_.has(x)?{type:!1}:k,t,j));const N=y.animation;N&&g.push(N)}return p&&Promise.all(g).then(()=>{kt.update(()=>{p&&ZD(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:x,staggerDirection:y}=d;return _4(t,s,v+g,x,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 _4(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(k4).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 k4(t,s){return t.sortNodePosition(s)}function S4(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 T4=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<T4;o++){const r=Im[o],c=t.props[r];(rl(c)||c===!1)&&(s[r]=c)}return s}const j4=[...Mm].reverse(),w4=Mm.length;function N4(t){return s=>Promise.all(s.map(({animation:o,options:r})=>S4(t,o,r)))}function C4(t){let s=N4(t),o=nb(),r=!0;const c=m=>(g,v)=>{var x;const y=Bd(t,v,m==="exit"?(x=t.presenceContext)===null||x===void 0?void 0:x.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)||{},x=[],y=new Set;let S={},k=1/0;for(let N=0;N<w4;N++){const T=j4[N],C=o[T],A=g[T]!==void 0?g[T]:v[T],O=rl(A),E=T===m?C.isActive:null;E===!1&&(k=N);let D=A===v[T]&&A!==g[T]&&O;if(D&&r&&t.manuallyAnimateOnMount&&(D=!1),C.protectedKeys={...S},!C.isActive&&E===null||!A&&!C.prevProp||Id(A)||typeof A=="boolean")continue;const U=E4(C.prevProp,A);let B=U||T===m&&C.isActive&&!D&&O||N>k&&O,z=!1;const X=Array.isArray(A)?A:[A];let $=X.reduce(c(T),{});E===!1&&($={});const{prevResolvedValues:J={}}=C,me={...J,...$},ee=G=>{B=!0,y.has(G)&&(z=!0,y.delete(G)),C.needsAnimating[G]=!0;const Z=t.getValue(G);Z&&(Z.liveStyle=!1)};for(const G in me){const Z=$[G],de=J[G];if(S.hasOwnProperty(G))continue;let W=!1;Kp(Z)&&Kp(de)?W=!__(Z,de):W=Z!==de,W?Z!=null?ee(G):y.add(G):Z!==void 0&&y.has(G)?ee(G):C.protectedKeys[G]=!0}C.prevProp=A,C.prevResolvedValues=$,C.isActive&&(S={...S,...$}),r&&t.blockInitialAnimation&&(B=!1),B&&(!(D&&U)||z)&&x.push(...X.map(G=>({animation:G,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}),x.push({animation:N})}let j=!!x.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(j=!1),r=!1,j?s(x):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 x=u(m);for(const y in o)o[y].protectedKeys={};return x}return{animateChanges:u,setActive:p,setAnimateFunction:d,getState:()=>o,reset:()=>{o=nb(),r=!0}}}function E4(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 A4 extends Ja{constructor(s){super(s),s.animationState||(s.animationState=C4(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 D4=0;class R4 extends Ja{constructor(){super(...arguments),this.id=D4++}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 M4={animation:{Feature:A4},exit:{Feature:R4}},hs={x:!1,y:!1};function o1(){return hs.x||hs.y}function I4(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 O4=t=>s=>lh(s)&&t(s,bl(s));function Qr(t,s,o,r){return ul(t,s,O4(o),r)}const sb=(t,s)=>Math.abs(t-s);function B4(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 x=kp(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,S=B4(x.offset,{x:0,y:0})>=3;if(!y&&!S)return;const{point:k}=x,{timestamp:j}=cn;this.history.push({...k,timestamp:j});const{onStart:N,onMove:T}=this.handlers;y||(N&&N(this.lastMoveEvent,x),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,x)},this.handlePointerMove=(x,y)=>{this.lastMoveEvent=x,this.lastMoveEventInfo=_p(y,this.transformPagePoint),kt.update(this.updatePoint,!0)},this.handlePointerUp=(x,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(x.type==="pointercancel"?this.lastMoveEventInfo:_p(y,this.transformPagePoint),this.history);this.startEvent&&S&&S(x,N),k&&k(x,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,L4(s)),velocity:z4(s,.1)}}function L4(t){return t[0]}function l1(t){return t[t.length-1]}function z4(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>ta(s)));)o--;if(!r)return{x:0,y:0};const d=na(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,$4=1-c1,P4=1+c1,d1=.01,U4=0-d1,H4=0+d1;function Bn(t){return t.max-t.min}function V4(t,s,o){return Math.abs(t-s)<=o}function ib(t,s,o,r=.5){t.origin=r,t.originPoint=Ct(s.min,s.max,t.origin),t.scale=Bn(o)/Bn(s),t.translate=Ct(o.min,o.max,t.origin)-t.originPoint,(t.scale>=$4&&t.scale<=P4||isNaN(t.scale))&&(t.scale=1),(t.translate>=U4&&t.translate<=H4||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 q4(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 G4(t,{min:s,max:o},r){return s!==void 0&&t<s?t=r?Ct(s,t,r.min):Math.max(t,s):o!==void 0&&t>o&&(t=r?Ct(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 F4(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 Z4(t,s){return{x:cb(t.x,s.x),y:cb(t.y,s.y)}}function K4(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)),ia(0,1,o)}function Y4(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 J4(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 W4({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function X4(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 Q4(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=Ct(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(X4(t.getBoundingClientRect(),s))}function eM(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,tM=new WeakMap;class nM{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:x}=this.getProps();x?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(bl(v).point)},d=(v,x)=>{const{drag:y,dragPropagation:S,onDragStart:k}=this.getProps();if(y&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=I4(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,x)),Yp(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},u=(v,x)=>{const{dragPropagation:y,dragDirectionLock:S,onDirectionLock:k,onDrag:j}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:N}=x;if(S&&this.currentDirection===null){this.currentDirection=sM(N),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",x.point,N),this.updateAxis("y",x.point,N),this.visualElement.render(),j&&j(v,x)},p=(v,x)=>this.stop(v,x),m=()=>es(v=>{var x;return this.getAnimationState(v)==="paused"&&((x=this.getAxisMotionValue(v).animation)===null||x===void 0?void 0:x.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new 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=G4(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=F4(c.layoutBox,o):this.constraints=!1,this.elastic=J4(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&es(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=Y4(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=eM(r,c.root,this.visualElement.getTransformPagePoint());let u=Z4(c.layout.layoutBox,d);if(o){const p=o(W4(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 x=m&&m[v]||{};u&&(x={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,...x};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]-Ct(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]=K4({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(Ct(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;tM.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 x=this.getAxisMotionValue(v);x&&(this.originPoint[v]+=m[v].translate,x.set(x.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 sM(t,s=10){let o=null;return Math.abs(t.y)>s?o="y":Math.abs(t.x)>s&&(o="x"),o}class aM extends Ja{constructor(s){super(s),this.removeGroupControls=In,this.removeListeners=In,this.controls=new nM(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 iM 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 Pr={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}%`}},oM={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=Ct(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 rM extends b.Component{componentDidMount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;MD(lM),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=b.useContext(Em);return i.jsx(rM,{...t,layoutGroup:r,switchLayoutGroup:b.useContext(l_),isPresent:s,safeToRemove:o})}const lM={borderRadius:{...Pr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Pr,borderTopRightRadius:Pr,borderBottomLeftRadius:Pr,borderBottomRightRadius:Pr,boxShadow:oM};function cM(t,s,o){const r=fn(t)?t:cl(t);return r.start(rh("",r,s,o)),r.animation}function dM(t){return t instanceof SVGElement&&t.tagName!=="svg"}const uM=(t,s)=>t.depth-s.depth;class fM{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(uM),this.isDirty=!1,this.children.forEach(s)}}function pM(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"],mM=v1.length,_b=t=>typeof t=="string"?parseFloat(t):t,kb=t=>typeof t=="number"||Ae.test(t);function hM(t,s,o,r,c,d){c?(t.opacity=Ct(0,o.opacity!==void 0?o.opacity:1,gM(r)),t.opacityExit=Ct(s.opacity!==void 0?s.opacity:1,0,vM(r))):d&&(t.opacity=Ct(s.opacity!==void 0?s.opacity:1,o.opacity!==void 0?o.opacity:1,r));for(let u=0;u<mM;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(Ct(_b(m),_b(g),r),0),(Es.test(g)||Es.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||o.rotate)&&(t.rotate=Ct(s.rotate||0,o.rotate||0,r))}function Sb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const gM=y1(0,.5,I_),vM=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 yM(t,s=0,o=1,r=.5,c,d=t,u=t){if(Es.test(s)&&(s=parseFloat(s),s=Ct(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=Ct(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){yM(t,s[o],s[r],s[c],s.scale,d,u)}const bM=["x","scaleX","originX"],xM=["y","scaleY","originY"];function Cb(t,s,o,r){Nb(t.x,s,bM,o?o.x:void 0,r?r.x:void 0),Nb(t.y,s,xM,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 _M(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 kM{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 SM(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:x,rotateY:y,skewX:S,skewY:k}=o;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),x&&(r+=`rotateX(${x}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"],TM={visibility:"hidden"},Ib=1e3;let jM=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=jM++,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(CM),this.nodes.forEach(MM),this.nodes.forEach(IM),this.nodes.forEach(EM),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 fM)}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=dM(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 x;const y=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,x&&x(),x=pM(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:x,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()||$M,{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(x,A);const O={...Fm(j,"layout"),onPlay:N,onComplete:T};(v.shouldReduceMotion||this.options.layoutRoot)&&(O.delay=0,O.type=!1),this.startAnimation(O)}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(OM),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 x=this.path[v];x.shouldResetTransform=!0,x.updateScroll("snapshot"),x.options.layoutRoot&&x.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(DM),this.isUpdating=!1,this.nodes.forEach(RM),this.nodes.forEach(wM),this.nodes.forEach(NM),this.clearAllSnapshots();const p=As.now();cn.delta=ia(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(AM),this.sharedNodes.forEach(BM)}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)),PM(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return $t();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(UM))){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:x,options:y}=v;v!==this.root&&x&&y.layoutScroll&&(x.wasRoot&&Jn(m,u),Do(m.x,x.offset.x),Do(m.y,x.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(),x=g.measurePageBox();Jn(v,x),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:x,layoutId:y}=this.options;if(!(!this.layout||!(x||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(),q4(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:x}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(v||x))return;Jn(this.layoutCorrected,this.layout.layoutBox);const y=this.treeScale.x,S=this.treeScale.y;Q4(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},x=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(zM));this.animationProgress=0;let A;this.mixTargetDelta=O=>{const E=O/1e3;Lb(x.x,u.x,E),Lb(x.y,u.y,E),this.setTargetDelta(x),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(tl(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),LM(this.relativeTarget,this.relativeTargetOrigin,y,E),A&&_M(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=$t()),Jn(A,this.relativeTarget)),j&&(this.animationValues=v,hM(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=cM(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 x=Bn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+x;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 kM),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 TM;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 x=this.getLead();if(!this.projectionDelta||!this.layout||!x.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=x.animationValues||x.latestValues;this.applyTransformsToTarget(),g.transform=SM(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`,x.animationValues?g.opacity=x===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=x===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],x);if(T){const A=T.length;for(let O=0;O<A;O++)g[T[O]]=C}else g[j]=C}return this.options.layoutId&&(g.pointerEvents=x===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 wM(t){t.updateLayout()}function NM(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(x=>{const y=u?o.measuredBox[x]:o.layoutBox[x],S=Bn(y);y.min=r[x].min,y.max=y.min+S}):S1(d,o.layoutBox,r)&&es(x=>{const y=u?o.measuredBox[x]:o.layoutBox[x],S=Bn(r[x]);y.max=y.min+S,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[x].max=t.relativeTarget[x].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 x=t.getClosestProjectingParent();if(x&&!x.resumeFrom){const{snapshot:y,layout:S}=x;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),x.options.layoutRoot&&(t.relativeTarget=j,t.relativeTargetOrigin=k,t.relativeParent=x)}}}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 CM(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 EM(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function AM(t){t.clearSnapshot()}function Ob(t){t.clearMeasurements()}function DM(t){t.isLayoutDirty=!1}function RM(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 MM(t){t.resolveTargetDelta()}function IM(t){t.calcProjection()}function OM(t){t.resetSkewAndRotation()}function BM(t){t.removeLeadSnapshot()}function Lb(t,s,o){t.translate=Ct(s.translate,0,o),t.scale=Ct(s.scale,1,o),t.origin=s.origin,t.originPoint=s.originPoint}function zb(t,s,o,r){t.min=Ct(s.min,o.min,r),t.max=Ct(s.max,o.max,r)}function LM(t,s,o,r){zb(t.x,s.x,o.x,r),zb(t.y,s.y,o.y,r)}function zM(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const $M={duration:.45,ease:[.4,0,.1,1]},$b=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Pb=$b("applewebkit/")&&!$b("chrome/")?Math.round:In;function Ub(t){t.min=Pb(t.min),t.max=Pb(t.max)}function PM(t){Ub(t.x),Ub(t.y)}function S1(t,s,o){return t==="position"||t==="preserve-aspect"&&!V4(Rb(s),Rb(o),.2)}function UM(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const HM=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 HM({});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"}),VM={pan:{Feature:iM},drag:{Feature:aM,ProjectionNode:T1,MeasureLayout:g1}};function qM(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=qM(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 GM(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(x=>{g(x),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 FM extends Ja{mount(){const{current:s}=this.node;s&&(this.unmount=GM(s,o=>(Vb(this.node,o,"Start"),r=>Vb(this.node,r,"End"))))}unmount(){}}class ZM 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,KM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function YM(t){return KM.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 JM=(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 WM(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",x),window.removeEventListener("pointercancel",y),!(!Gb(S)||!Yr.has(m))&&(Yr.delete(m),typeof g=="function"&&g(S,{success:k}))},x=S=>{v(S,o.useGlobalTarget||w1(m,S.target))},y=S=>{v(S,!1)};window.addEventListener("pointerup",x,c),window.addEventListener("pointercancel",y,c)};return r.forEach(p=>{!YM(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(o.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>JM(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 XM extends Ja{mount(){const{current:s}=this.node;s&&(this.unmount=WM(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,QM=t=>{const s=lm.get(t.target);s&&s(t)},e3=t=>{t.forEach(QM)};function t3({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(e3,{root:t,...s})),r[c]}function n3(t,s,o){const r=t3(s);return lm.set(t,o),r.observe(t),()=>{lm.delete(t),r.unobserve(t)}}const s3={some:0,all:1};class a3 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:s3[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:x}=this.node.getProps(),y=g?v:x;y&&y(m)};return n3(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(i3(s,o))&&this.startObserver()}unmount(){}}function i3({viewport:t={}},{viewport:s={}}={}){return o=>t[o]!==s[o]}const o3={inView:{Feature:a3},tap:{Feature:XM},focus:{Feature:ZM},hover:{Feature:FM}},r3={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 l3=[...K_,un,Za],c3=t=>l3.find(Z_(t)),Zb=new WeakMap;function d3(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 u3{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:x,...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=d3(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):!c3(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 u3{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 f3(t){return window.getComputedStyle(t)}class p3 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=f3(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){Um(s,o,r.transformTemplate)}scrapeMotionValuesFromProps(s,o,r){return Gm(s,o,r)}}class m3 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 h3=(t,s)=>Lm(t)?new m3(s):new p3(s,{allowProjection:t!==b.Fragment}),g3=HD({...M4,...o3,...VM,...r3},h3),Mt=sD(g3);function v3(){!ch.current&&N1();const[t]=b.useState(vd.current);return t}const y3="_overlay_cmicx_1",b3="_dialog_cmicx_11",x3="_title_cmicx_30",_3="_description_cmicx_38",k3="_actions_cmicx_45",S3="_cancelButton_cmicx_52",T3="_confirmButton_cmicx_79",_i={overlay:y3,dialog:b3,title:x3,description:_3,actions:k3,cancelButton:S3,confirmButton:T3};function oa({isOpen:t,title:s,description:o,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=b.useId(),p=b.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 j3="_skeleton_1gqp4_9",w3="_circular_1gqp4_17",N3="_textContainer_1gqp4_26",C3="_card_1gqp4_31",yd={skeleton:j3,circular:w3,textContainer:N3,card:C3};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 E3="_spinner_1uyt1_1",A3="_spin_1uyt1_1",D3="_sm_1uyt1_14",R3="_md_1uyt1_20",M3="_lg_1uyt1_26",I3="_xl_1uyt1_32",Yb={spinner:E3,spin:A3,sm:D3,md:R3,lg:M3,xl:I3};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 O3="_splash_1bn1g_1",B3="_logo_1bn1g_11",Jb={splash:O3,logo:B3};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 L3="_wrapper_4e5yt_1",z3="_wrapperBlock_4e5yt_6",$3="_tooltip_4e5yt_11",P3="_visible_4e5yt_31",U3="_top_4e5yt_41",H3="_bottom_4e5yt_48",V3="_left_4e5yt_55",q3="_right_4e5yt_62",Ur={wrapper:L3,wrapperBlock:z3,tooltip:$3,visible:P3,top:U3,bottom:H3,left:V3,right:q3},G3=300,Gc=6;function $o({text:t,placement:s="top",delayMs:o=G3,inline:r=!0,children:c,className:d,"data-testid":u}){const[p,m]=b.useState(!1),[g,v]=b.useState({top:0,left:0}),x=b.useRef(null),y=b.useRef(null),S=b.useRef(void 0),k=b.useId(),j=typeof document<"u",N=b.useCallback(()=>{if(!x.current||!y.current)return;const z=x.current.getBoundingClientRect(),X=y.current.getBoundingClientRect();let $=0,J=0;switch(s){case"top":$=z.top-X.height-Gc,J=z.left+z.width/2-X.width/2;break;case"bottom":$=z.bottom+Gc,J=z.left+z.width/2-X.width/2;break;case"left":$=z.top+z.height/2-X.height/2,J=z.left-X.width-Gc;break;case"right":$=z.top+z.height/2-X.height/2,J=z.right+Gc;break}v({top:$,left:J})},[s]),T=b.useCallback(z=>{S.current!==void 0&&clearTimeout(S.current),S.current=setTimeout(()=>{N(),m(!0),S.current=void 0},z)},[N]),C=b.useCallback(()=>{T(o)},[o,T]),A=b.useCallback(()=>{T(0)},[T]),O=b.useCallback(()=>{S.current!==void 0&&(clearTimeout(S.current),S.current=void 0),m(!1)},[]);b.useEffect(()=>{if(!p)return;const z=X=>{X.key==="Escape"&&O()};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,O,N]),b.useEffect(()=>()=>{S.current!==void 0&&clearTimeout(S.current)},[]);const E=r?"span":"div",D=[r?Ur.wrapper:Ur.wrapperBlock,d].filter(Boolean).join(" ");let U=c;if(b.isValidElement(c)){const z=c,X=z.props["aria-describedby"],$=p?X?`${X} ${k}`:k:X;U=b.cloneElement(z,{"aria-describedby":$})}const B=i.jsx("div",{ref:y,id:k,role:"tooltip",className:`${Ur.tooltip} ${Ur[s]} ${p?Ur.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return i.jsxs(E,{ref:x,className:D,onMouseEnter:C,onMouseLeave:O,onFocus:A,onBlur:O,children:[U,j?TT.createPortal(B,document.body):null]})}const F3="_attemptSelector_ggigl_1",Z3="_attemptLabel_ggigl_17",K3="_attemptButton_ggigl_21",Y3="_attemptActive_ggigl_38",J3="_attemptStatus_ggigl_44",Hr={attemptSelector:F3,attemptLabel:Z3,attemptButton:K3,attemptActive:Y3,attemptStatus:J3};function W3({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 X3="_row_ldkru_1",Q3="_hoverActions_ldkru_5",e6="_hoverButton_ldkru_31",t6="_selectingRow_ldkru_72",n6="_selected_ldkru_83",s6="_checkboxArea_ldkru_90",a6="_checkbox_ldkru_90",i6="_contentArea_ldkru_106",us={row:X3,hoverActions:Q3,hoverButton:e6,selectingRow:t6,selected:n6,checkboxArea:s6,checkbox:a6,contentArea:i6};function o6({copyText:t,isContentBearing:s,isSelecting:o,isSelected:r,checkboxLabel:c,onSelect:d,onToggle:u,onCopied:p,children:m}){const[g,v]=b.useState(!1),x=b.useRef(void 0);b.useEffect(()=>()=>{x.current!==void 0&&clearTimeout(x.current)},[]);const y=b.useCallback(async()=>{try{await navigator.clipboard.writeText(t),v(!0),p==null||p(),x.current!==void 0&&clearTimeout(x.current),x.current=setTimeout(()=>{v(!1)},2e3)}catch{}},[t,p]),S=b.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:dt,"aria-hidden":"true"}):i.jsx(Cx,{size:dt,"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(gj,{size:dt,"aria-hidden":"true"})})]}),m]}):i.jsx("div",{className:us.row,children:m})}const r6="_bar_1vah7_1",l6="_left_1vah7_21",c6="_right_1vah7_27",d6="_count_1vah7_33",u6="_toggleButton_1vah7_40",f6="_copyButton_1vah7_68",p6="_cancelButton_1vah7_108",ki={bar:r6,left:l6,right:c6,count:d6,toggleButton:u6,copyButton:f6,cancelButton:p6};function m6({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:dt,"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:dt,"aria-hidden":"true"})})]})]})}const D1=50;function h6(t,s,o,r,c=D1){return r?t<c:s-t-o<c}function g6(t,s){const o=s-t;return o>0?o:0}function v6({scrollRef:t,contentLength:s,isReversed:o,paused:r}){const[c,d]=b.useState(!0),u=b.useRef(0),p=b.useRef(!1),m=b.useRef(0);b.useEffect(()=>{const v=t.current;if(!v)return;let x=!0;const y=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const S=h6(v.scrollTop,v.scrollHeight,v.clientHeight,o,D1);S!==x&&(x=S,d(S))}))};return v.addEventListener("scroll",y,{passive:!0}),()=>{v.removeEventListener("scroll",y),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[t,o]),b.useLayoutEffect(()=>{const v=t.current;!v||p.current||(p.current=!0,o?v.scrollTop=0:v.scrollTop=v.scrollHeight,d(!0))},[t,o]),b.useLayoutEffect(()=>{const v=t.current;if(v){if(r){u.current=v.scrollHeight;return}if(o&&!c){const x=g6(u.current,v.scrollHeight);x>0&&(v.scrollTop+=x)}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=b.useCallback(()=>{const v=t.current;if(!v)return;const x=o?0:v.scrollHeight;v.scrollTo({top:x,behavior:"smooth"}),d(!0)},[t,o]);return{isAtAnchor:c,scrollToAnchor:g}}const y6=new Set(["text","output","user_input","tool_use","tool_result","error"]);function fl(t){return y6.has(t.eventType)}function b6(t){var s;switch(t.eventType){case"tool_result":{if((s=t.toolUseCtx)!=null&&s.detailedResult)return t.toolUseCtx.detailedResult;let 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}
274
- ${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 x6(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}):
275
- ${r.content}`);break}case"user_input":{s.push(`**User** (${c}):
276
- ${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}):
277
- ${d}`)}else s.push(`**Tool output** (${c}):
278
- ${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}):
279
- \`\`\`json
280
- ${JSON.stringify(u,void 0,2)}
281
- \`\`\``):s.push(`${m} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
282
- ${r.content}`);break}}}return s.join(`
283
-
284
- `)}function _6({events:t,formatForClipboard:s}){const[o,r]=b.useState(!1),[c,d]=b.useState(new Set),u=b.useRef(void 0),p=b.useMemo(()=>c.size,[c]),m=b.useCallback(k=>{r(!0),k!==void 0?(d(new Set([k])),u.current=k):(d(new Set),u.current=void 0)},[]),g=b.useCallback(()=>{r(!1),d(new Set),u.current=void 0},[]),v=b.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 O=N;O<=T;O++)O<t.length&&fl(t[O])&&A.add(O);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]),x=b.useCallback(()=>{const k=new Set;for(let j=0;j<t.length;j++)fl(t[j])&&k.add(j);d(k)},[t]),y=b.useCallback(()=>{d(new Set)},[]),S=b.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:x,deselectAll:y,copySelected:S}}const k6="_wrapper_1cdza_1",S6="_scrollContainer_1cdza_9",T6="_selectingPadding_1cdza_16",j6="_toolbar_1cdza_20",w6="_directionToggle_1cdza_27",N6="_scrollToAnchor_1cdza_65",C6="_scrollToAnchorBottom_1cdza_89",E6="_scrollToAnchorTop_1cdza_93",A6="_eventOverflowWarning_1cdza_97",ea={wrapper:k6,scrollContainer:S6,selectingPadding:T6,toolbar:j6,directionToggle:w6,scrollToAnchor:N6,scrollToAnchorBottom:C6,scrollToAnchorTop:E6,eventOverflowWarning:A6};function D6(t){const s=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"text":case"output":return`Select message from assistant at ${s}`;case"user_input":return`Select message from user at ${s}`;case"tool_result":case"tool_use":return`Select tool event at ${s}`;case"error":return`Select error at ${s}`;default:return`Select event at ${s}`}}const R1="grackle-stream-direction";function R6(){try{return localStorage.getItem(R1)==="reversed"}catch{return!1}}function M6({eventsDropped:t}){return t<=0?i.jsx(i.Fragment,{}):i.jsxs("div",{className:ea.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=b.useRef(null),[d,u]=b.useState(R6),p=v3(),m=_6({events:t,formatForClipboard:x6}),g=b.useMemo(()=>t.filter(fl).length,[t]),v=b.useMemo(()=>d?[...t].reverse():t,[t,d]),{isAtAnchor:x,scrollToAnchor:y}=v6({scrollRef:c,contentLength:t.length,isReversed:d,paused:m.isSelecting}),S=()=>{const T=!d;u(T);try{localStorage.setItem(R1,T?"reversed":"default")}catch{}};b.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=b.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:ea.wrapper,children:[i.jsx("div",{className:ea.toolbar,children:i.jsx($o,{text:d?"Showing newest first":"Showing oldest first",children:i.jsx("button",{className:ea.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:`${ea.scrollContainer} ${m.isSelecting?ea.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&o,i.jsx(M6,{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(o6,{copyText:b6(T),isContentBearing:fl(T),isSelecting:m.isSelecting,isSelected:m.selectedIndices.has(A),checkboxLabel:D6(T),onSelect:()=>{m.enterSelectionMode(A)},onToggle:O=>{m.toggleEvent(A,O)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:i.jsx(GA,{event:T,toolUseCtx:T.toolUseCtx,settled:T.settled})})},`${T.sessionId}-${T.timestamp}-${A}`)})})]}),i.jsx(gs,{children:m.isSelecting&&i.jsx(m6,{selectedCount:m.selectedCount,totalSelectable:g,onSelectAll:m.selectAll,onDeselectAll:m.deselectAll,onCopy:()=>{k().catch(()=>{})},onCancel:m.cancelSelection})}),i.jsx(gs,{children:!x&&i.jsxs(Mt.button,{className:`${ea.scrollToAnchor} ${d?ea.scrollToAnchorTop:ea.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]=b.useState(""),[x,y]=b.useState(""),S=b.useRef(!1),k=d===c,j=b.useCallback(U=>{v(U),y("")},[]),N=b.useCallback(()=>{y("")},[]),T=b.useCallback(()=>{S.current=!1,u==null||u(null),v(""),y("")},[u]),C=b.useCallback(()=>{const U=m?g.trim():g;if(r){const z=r(g);if(z){y(z);return}}const B=m?s.trim():s;if(U===B){T();return}o(U),T()},[g,s,m,r,o,T]),A=b.useCallback(()=>{S.current=!0,u==null||u(c),v(s),y("")},[c,s,u]),O=b.useCallback(U=>{if(S.current){S.current=!1;return}U.relatedTarget instanceof HTMLElement&&U.relatedTarget.dataset.editAction===c||C()},[c,C]),E=b.useCallback(U=>{U.key==="Escape"?T():U.key==="Enter"&&p&&C()},[T,p,C]),D=(()=>{if(!k)return!1;const U=m?s.trim():s;return(m?g.trim():g)!==U})();return b.useEffect(()=>{!k&&(g!==""||x!=="")&&(v(""),y(""))},[k,g,x]),{isEditing:k,draft:g,error:x,isDirty:D,startEdit:A,cancelEdit:T,save:C,setDraft:j,clearError:N,handleBlur:O,handleKeyDown:E,ignoreInitialBlurRef:S}}const I6="_editFieldWrapper_yuzty_1",O6="_editInput_yuzty_10",B6="_editTextarea_yuzty_42",L6="_editSelect_yuzty_78",z6="_editError_yuzty_111",$6="_editInputInvalid_yuzty_118",P6="_editHint_yuzty_123",U6="_unsavedDot_yuzty_132",H6="_metaValueClickable_yuzty_140",V6="_editButton_yuzty_159",q6="_metaPlaceholder_yuzty_175",G6="_worktreeToggle_yuzty_180",st={editFieldWrapper:I6,editInput:O6,editTextarea:B6,editSelect:L6,editError:z6,editInputInvalid:$6,editHint:P6,unsavedDot:U6,metaValueClickable:H6,editButton:V6,metaPlaceholder:q6,worktreeToggle:G6};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:x,ariaLabel:y,"data-testid":S}=t,k=b.useRef(null),j=uh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!0,trimOnSave:!0});if(b.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:x,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:x,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:x,"data-testid":y}=t,S=b.useRef(null),k=uh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});if(b.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":x,"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:x,"aria-label":x,"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":x,"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 Po(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:x,"data-testid":y}=t,S=b.useRef(null),k=uh({value:s,onSave:o,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});b.useEffect(()=>{if(k.isEditing){const O=window.setTimeout(()=>{var E;(E=S.current)==null||E.focus()},0);return()=>window.clearTimeout(O)}},[k.isEditing]);const j=b.useCallback(O=>{const E=O.target.value;k.ignoreInitialBlurRef.current=!1,E!==s&&o(E),k.cancelEdit()},[s,o,k]),N=b.useCallback(O=>{if(k.ignoreInitialBlurRef.current){k.ignoreInitialBlurRef.current=!1;return}O.relatedTarget instanceof HTMLElement&&O.relatedTarget.dataset.editAction===d||k.cancelEdit()},[d,k]);if(r==="create")return i.jsx("select",{className:st.editSelect,value:s,onChange:O=>m==null?void 0:m(O.target.value),"aria-label":x,"data-testid":y?`${y}-select`:void 0,children:c.map(O=>i.jsx("option",{value:O.value,children:O.label},O.value))});if(k.isEditing)return i.jsx("select",{ref:S,className:st.editSelect,value:k.draft,onChange:j,onBlur:N,title:x,"aria-label":x,"data-testid":y?`${y}-select`:void 0,children:c.map(O=>i.jsx("option",{value:O.value,children:O.label},O.value))});const T=g==null?void 0:g(s),C=(A=c.find(O=>O.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":x,"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 F6(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 Z6="_envRow_1e1r5_1",K6="_envDot_1e1r5_7",Y6="_envDotGreen_1e1r5_14",J6="_envDotYellow_1e1r5_18",W6="_envDotRed_1e1r5_22",X6="_envDotGray_1e1r5_26",Mo={envRow:Z6,envDot:K6,envDotGreen:Y6,envDotYellow:J6,envDotRed:W6,envDotGray:X6};function Q6(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?Mo.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?Mo.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?Mo.envDotRed:Mo.envDotGray}function eI(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,x=r.find(k=>k.id===s),y=[...c?[{value:"",label:"None"}]:[],...r.map(k=>({value:k.id,label:k.displayName}))],S=()=>{if(x)return i.jsxs("span",{className:Mo.envRow,children:[i.jsx("span",{className:`${Mo.envDot} ${Q6(x.status)}`}),x.displayName]})};return i.jsx(Po,{value:s,onSave:o,options:y,fieldId:d,activeFieldId:u,onActivate:p,renderDisplay:S,placeholder:m,ariaLabel:g,"data-testid":v})}const tI="_nav_1snmp_1",nI="_searchForm_1snmp_8",sI="_searchInput_1snmp_15",aI="_searchButton_1snmp_33",iI="_clearButton_1snmp_68",oI="_workspaceSelect_1snmp_85",rI="_listHeader_1snmp_99",lI="_nodeList_1snmp_108",cI="_nodeItem_1snmp_116",dI="_indicator_1snmp_129",uI="_label_1snmp_136",fI="_badge_1snmp_145",Wn={nav:tI,searchForm:nI,searchInput:sI,searchButton:aI,clearButton:iI,workspaceSelect:oI,listHeader:rI,nodeList:lI,nodeItem:cI,indicator:dI,label:uI,badge:fI};function pI({nodes:t,workspaces:s,loading:o,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:p}){const[m,g]=b.useState(""),v=b.useCallback(k=>{k.preventDefault(),m.trim()&&c(m.trim())},[m,c]),x=b.useCallback(()=>{g(""),d()},[d]),y=b.useCallback(k=>{u(k)},[u]),S=b.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:x,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 mI="_container_1mq5u_1",hI="_hamburger_1mq5u_33",gI="_brand_1mq5u_49",vI="_brandLogo_1mq5u_68",yI="_info_1mq5u_75",bI="_connectionLabel_1mq5u_90",xI="_connectionDot_1mq5u_103",_I="_connected_1mq5u_106",kI="_disconnected_1mq5u_110",Xs={container:mI,hamburger:hI,brand:gI,brandLogo:vI,info:yI,connectionLabel:bI,connectionDot:xI,connected:_I,disconnected:kI};function SI({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:Xs.container,children:[r&&i.jsx("button",{type:"button",className:Xs.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:i.jsx(Q2,{size:Nt,"aria-hidden":"true"})}),i.jsx($o,{text:"Home",placement:"bottom",children:i.jsxs("button",{type:"button",className:Xs.brand,onClick:()=>d(Di),"data-testid":"statusbar-brand",children:[i.jsx("img",{src:"/icon-192x192.png",alt:"",className:Xs.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),i.jsxs("div",{className:Xs.info,children:[i.jsxs("span",{"aria-label":t?"Connected":"Disconnected",children:[i.jsx("span",{className:`${Xs.connectionDot} ${t?Xs.connected:Xs.disconnected}`,"aria-hidden":"true",children:i.jsx(Va,{size:bm,fill:"currentColor"})})," ",i.jsx("span",{className:Xs.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 TI="_nav_13gkc_1",jI="_tab_13gkc_35",wI="_tabIcon_13gkc_68",NI="_tabLabel_13gkc_79",CI="_tabActive_13gkc_84",Vr={nav:TI,tab:jI,tabIcon:wI,tabLabel:NI,tabActive:CI},id=[{view:"dashboard",label:"Dashboard",icon:i.jsx(P2,{size:Nt}),route:Di,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:i.jsx(tj,{size:Nt}),route:wN,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:i.jsx(N2,{size:Nt}),route:NN,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:i.jsx(sj,{size:Nt}),route:Io,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:i.jsx(b2,{size:Nt}),route:Xx,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:i.jsx(Ex,{size:Nt}),route:Dd,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:i.jsx(mj,{size:Nt}),route:_N,testId:"sidebar-tab-settings"}];function EI(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 AI({tabs:t=id}){const s=Yt(),o=mt(),r=b.useRef(null),c=EI(s.pathname),d=b.useCallback(p=>{o(p.route)},[o]),u=b.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 x=v;if(p.key==="ArrowRight"||p.key==="j"||p.key==="J")p.preventDefault(),x=(v+1)%t.length;else if(p.key==="ArrowLeft"||p.key==="k"||p.key==="K")p.preventDefault(),x=(v-1+t.length)%t.length;else if(p.key==="Home")p.preventDefault(),x=0;else if(p.key==="End")p.preventDefault(),x=t.length-1;else return;o(t[x].route),(S=m[x])==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 DI="_container_pi6ii_1",RI="_content_pi6ii_66",Xb={container:DI,content:RI},MI=320,M1=220,I1=600,O1="grackle-sidebar-width";function II(){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 MI}function OI(t){try{localStorage.setItem(O1,String(t))}catch{}}function BI({content:t}){const[s]=b.useState(II),o=b.useRef(null);if(b.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&&OI(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 LI="_bar_tnfsh_1",zI="_btnPrimary_tnfsh_32",$I="_statusText_tnfsh_85",PI="_statusCompleted_tnfsh_90",UI="_statusFailed_tnfsh_94",HI="_statusBlocked_tnfsh_98",VI="_hintText_tnfsh_103",jt={bar:LI,btnPrimary:zI,statusText:$I,statusCompleted:PI,statusFailed:UI,statusBlocked:HI,hintText:VI};function qI({sessions:t,tasks:s,environments:o}){const r=mt(),c=Yt(),d=Dt("/sessions/:sessionId"),u=Dt("/tasks/:taskId"),p=Dt("/tasks/:taskId/stream"),m=Dt("/tasks/:taskId/findings"),g=Dt("/tasks/:taskId/edit"),v=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),x=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),y=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),S=Dt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),k=Dt("/sessions/new"),j=Dt("/environments/:environmentId/workspaces/:workspaceId"),N=Dt("/tasks/new"),T=Dt("/chat"),C=Dt("/"),A=Dt("/settings/*"),O=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)??(x==null?void 0:x.params.taskId)??(y==null?void 0:y.params.taskId)??(S==null?void 0:S.params.taskId),D=v??x??y??S,U=(D==null?void 0:D.params.environmentId)??(j==null?void 0:j.params.environmentId),B=c.pathname.startsWith("/environments")&&!j&&!D,z=!!T,X=!!k,$=!!j&&!v&&!x&&!y&&!S,J=!!N;if(!!C&&!X&&!$&&!J||!!A||(!!g||!!S)||J||B||X)return i.jsx(i.Fragment,{});if(z)return o.find(G=>G.adapterType==="local"&&G.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 R=s.find(de=>de.id===E);if(!R)return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Loading..."})});const G=new Map(s.map(de=>[de.id,de])),Z=R.dependsOn.some(de=>{const W=G.get(de);return W!==void 0&&W.status!=="complete"});if(R.status==="not_started"){const de=Z?R.dependsOn.map(W=>G.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(R.status==="working"||R.status==="paused"){const de=R.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(R.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(R.workspaceId,void 0,U)),className:jt.btnPrimary,children:"+ New Task"})]});if(R.status==="failed")return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:`${jt.statusText} ${jt.statusFailed}`,children:"Task failed"})})}if(O){const R=t.find(de=>de.id===O),G=(R==null?void 0:R.status)==="stopped";if(R!==void 0&&!G)return i.jsx(i.Fragment,{});if(G)return i.jsxs("div",{className:jt.bar,children:[i.jsxs("span",{className:`${jt.statusText} ${jt.hintText}`,children:["Session ",R.endReason||R.status]}),i.jsx("button",{onClick:()=>r(Kx(R.environmentId)),className:jt.btnPrimary,children:"+ New Chat"})]})}return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Loading..."})})}const GI="_nav_14i94_1",FI="_tab_14i94_24",ZI="_tabActive_14i94_62",KI="_tabLabel_14i94_75",YI="_statusDot_14i94_81",JI="_pulse_14i94_87",WI="_addButton_14i94_99",XI="_empty_14i94_132",Ba={nav:GI,tab:FI,tabActive:ZI,tabLabel:KI,statusDot:YI,pulse:JI,addButton:WI,empty:XI},QI={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function e5({environments:t}){const s=mt(),o=b.useRef(null),r=Dt("/environments/:environmentId"),c=Dt("/environments/:environmentId/edit"),d=Dt("/environments/:environmentId/workspaces/:workspaceId"),u=Dt("/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=b.useCallback(y=>{s(Ai(y))},[s]),v=b.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]),x=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===x,j=QI[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(bN),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 Uo(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 t5="_nav_dlm8m_1",n5="_categoryPills_dlm8m_24",s5="_categoryPill_dlm8m_24",a5="_tab_dlm8m_42",i5="_tabActive_dlm8m_80",o5="_tabContent_dlm8m_93",r5="_tabLabel_dlm8m_100",l5="_tabMeta_dlm8m_106",c5="_categoryDot_dlm8m_111",d5="_empty_dlm8m_118",js={nav:t5,categoryPills:n5,categoryPill:s5,tab:a5,tabActive:i5,tabContent:o5,tabLabel:r5,tabMeta:l5,categoryDot:c5,empty:d5};function u5({findings:t,workspaceId:s,environmentId:o}){const r=mt(),c=b.useRef(null),d=Dt("/findings/:findingId"),u=Dt("/environments/:environmentId/workspaces/:workspaceId/findings/:findingId"),p=(d==null?void 0:d.params.findingId)??(u==null?void 0:u.params.findingId),m=b.useMemo(()=>{const y=new Set(t.map(S=>S.category).filter(Boolean));return Array.from(y).sort()},[t]),g=b.useCallback(y=>{r(Gp(y,s,o))},[r,s,o]),v=b.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]),x=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===x;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:Uo(y.createdAt)})]})]},y.id)})}),t.length===0&&i.jsx("div",{className:js.empty,children:"No findings yet. Agents will post discoveries here."})]})}function f5(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=f5(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 p5(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 m5(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 Sj){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 h5="_container_z4i38_1",g5="_header_z4i38_5",v5="_headerActions_z4i38_17",y5="_searchInput_z4i38_23",b5="_searchHighlight_z4i38_56",x5="_groupToggle_z4i38_62",_5="_groupToggleActive_z4i38_89",k5="_addButton_z4i38_93",S5="_taskRow_z4i38_120",T5="_selected_z4i38_140",j5="_expandArrow_z4i38_150",w5="_expanded_z4i38_157",N5="_leafSpacer_z4i38_161",C5="_taskStatusIcon_z4i38_166",E5="_taskTitle_z4i38_170",A5="_workspaceBadge_z4i38_177",D5="_childCountBadge_z4i38_195",R5="_dependencyBadge_z4i38_208",M5="_blockedBadge_z4i38_220",I5="_addChildButton_z4i38_225",O5="_emptyState_z4i38_268",B5="_statusGroupHeader_z4i38_275",L5="_statusGroupIcon_z4i38_294",z5="_statusGroupLabel_z4i38_298",$5="_statusGroupCount_z4i38_303",Ze={container:h5,header:g5,headerActions:v5,searchInput:y5,searchHighlight:b5,groupToggle:x5,groupToggleActive:_5,addButton:k5,taskRow:S5,selected:T5,expandArrow:j5,expanded:w5,leafSpacer:N5,taskStatusIcon:C5,taskTitle:E5,workspaceBadge:A5,childCountBadge:D5,dependencyBadge:R5,blockedBadge:M5,addChildButton:I5,emptyState:O5,statusGroupHeader:B5,statusGroupIcon:L5,statusGroupLabel:z5,statusGroupCount:$5},P5=[{name:"title",weight:2},{name:"description",weight:1}],z1=16,U5=16,$1="grackle-task-group-by-status";function ex(){try{return localStorage.getItem($1)==="true"}catch{return!1}}function H5(t){try{localStorage.setItem($1,String(t))}catch{}}function V5({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:Ze.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:`${Ze.expandArrow} ${s?Ze.expanded:""}`,"aria-hidden":"true",children:i.jsx(la,{size:dt})}),i.jsx("span",{className:Ze.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),i.jsx("span",{className:Ze.statusGroupLabel,children:t.label}),i.jsx("span",{className:Ze.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:x=>{x.currentTarget===x.target&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),c(On(p.id)))},className:`${Ze.taskRow} ${g?Ze.selected:""}`,style:{"--task-indent":`${z1}px`},"data-task-id":p.id,children:[i.jsx("span",{className:Ze.leafSpacer}),i.jsx("span",{className:Ze.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${pl(p.status)}`,children:m.icon}),i.jsx("span",{className:Ze.taskTitle,title:p.title,children:i.jsx(L1,{text:p.title,indices:d.get(p.id),highlightClass:Ze.searchHighlight})}),v&&i.jsx("span",{className:Ze.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function P1({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"),x=o.has(t.id),y=t.children.length>0,S=c===t.id,k=z1+s*U5,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:`${Ze.taskRow} ${S?Ze.selected:""}`,style:{"--task-indent":`${k}px`},"data-task-id":t.id,children:[y&&i.jsx("span",{className:`${Ze.expandArrow} ${x?Ze.expanded:""}`,role:"button",tabIndex:0,"aria-label":x?"Collapse task":"Expand task",onClick:T=>{T.stopPropagation(),r(t.id)},onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),r(t.id))},children:i.jsx(la,{size:dt,"aria-hidden":"true"})}),!y&&i.jsx("span",{className:Ze.leafSpacer}),i.jsx("span",{className:Ze.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${pl(t.status)}`,children:g.icon}),i.jsx("span",{className:Ze.taskTitle,title:t.title,children:i.jsx(L1,{text:t.title,indices:p.get(t.id),highlightClass:Ze.searchHighlight})}),N&&i.jsx("span",{className:Ze.workspaceBadge,title:N,children:N}),y&&i.jsxs("span",{className:Ze.childCountBadge,children:[t.children.filter(T=>T.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&i.jsx("span",{className:`${Ze.dependencyBadge} ${v?Ze.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:Ze.addChildButton,children:"+"})})]}),i.jsx(gs,{children:y&&x&&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(P1,{node:T,depth:s+1,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},T.id))})})]})}function q5({workspaces:t,tasks:s}){const o=mt(),[r,c]=b.useState(new Set),[d,u]=b.useState(new Set),[p,m]=b.useState(ex),[g,v]=b.useState(ex),[x,y]=b.useState(new Map),S=Dt("/tasks/:taskId/*"),k=(S==null?void 0:S.params.taskId)!=="new"?S==null?void 0:S.params.taskId:void 0,j=b.useMemo(()=>new Map(s.map(ee=>[ee.id,ee.status])),[s]),N=b.useMemo(()=>new Map(t.map(ee=>[ee.id,ee.name])),[t]),T=()=>{const ee=!p;H5(ee),m(ee),ee&&(v(!0),y(new Map))},C=ee=>{y(oe=>{const R=new Map(oe),G=R.has(ee)?R.get(ee):g;return R.set(ee,!G),R})},A=ee=>x.has(ee)?x.get(ee):g,O=ee=>{c(oe=>{const R=new Set(oe);return R.has(ee)?(R.delete(ee),u(G=>new Set(G).add(ee))):(R.add(ee),u(G=>{const Z=new Set(G);return Z.delete(ee),Z})),R})};b.useEffect(()=>{const ee=new Set(s.filter(oe=>oe.parentTaskId).map(oe=>oe.parentTaskId));ee.size>0&&c(oe=>{const R=new Set(oe);for(const G of ee)d.has(G)||R.add(G);return R})},[s,d]);const[E,D]=b.useState(""),{directMatchTaskIds:U,treeMatchTaskIds:B,titleHighlights:z}=b.useMemo(()=>{if(!E.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const ee=AT(s,E,P5),oe=new Set(ee.map(de=>de.item.id)),R=new Map;for(const de of ee){const W=de.matches.find(Q=>Q.key==="title");W&&R.set(de.item.id,W.indices)}const G=new Set(oe),Z=new Map(s.map(de=>[de.id,de]));for(const de of[...oe]){let W=Z.get(de);for(;W!=null&&W.parentTaskId;)G.add(W.parentTaskId),W=Z.get(W.parentTaskId)}return{directMatchTaskIds:oe,treeMatchTaskIds:G,titleHighlights:R}},[E,s]),X=U!==null,$=X?p?U:B:null,J=$?s.filter(ee=>$.has(ee.id)):s,me=p?[]:p5(J);return i.jsxs("div",{className:Ze.container,children:[i.jsxs("div",{className:Ze.header,children:[i.jsx("span",{children:"Tasks"}),i.jsxs("div",{className:Ze.headerActions,children:[i.jsx($o,{text:p?"Switch to tree view":"Group tasks by status",children:i.jsx("button",{className:`${Ze.groupToggle} ${p?Ze.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:Ze.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:ee=>D(ee.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Ze.searchInput,"data-testid":"sidebar-search"}),p?m5(J,j).map(ee=>i.jsx(V5,{group:ee,isExpanded:A(ee.status),onToggle:()=>C(ee.status),selectedTaskId:k,navigate:o,titleHighlights:z,workspaceNames:N},ee.status)):me.map(ee=>i.jsx(P1,{node:ee,depth:0,expandedTasks:r,toggleTask:O,selectedTaskId:k,navigate:o,taskStatusById:j,titleHighlights:z,workspaceNames:N},ee.id)),J.length===0&&!X&&i.jsx("div",{className:Ze.emptyState,children:"No tasks yet. Click + to create one."}),J.length===0&&X&&i.jsx("div",{className:Ze.emptyState,children:"No matching tasks"})]})}const G5="_toast_ed2dk_1",F5="_success_ed2dk_18",Z5="_icon_ed2dk_22",K5="_error_ed2dk_25",Y5="_warning_ed2dk_32",J5="_info_ed2dk_38",W5="_message_ed2dk_53",X5="_close_ed2dk_60",qr={toast:G5,success:F5,icon:Z5,error:K5,warning:Y5,info:J5,message:W5,close:X5},Q5={success:i.jsx(Ri,{size:Nt}),error:i.jsx(Ka,{size:Nt}),warning:i.jsx(ym,{size:Nt}),info:i.jsx(vm,{size:Nt})};function eO({toast:t,onDismiss:s}){return b.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:Q5[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 tO="_container_qqse2_1",nO={container:tO};function sO({toasts:t,onDismiss:s}){return i.jsx("div",{className:nO.container,"data-testid":"toast-container",children:i.jsx(gs,{children:t.map(o=>i.jsx(eO,{toast:o,onDismiss:s},o.id))})})}const aO="_callout_e5awm_1",iO="_success_e5awm_11",oO="_icon_e5awm_15",rO="_error_e5awm_18",lO="_warning_e5awm_25",cO="_info_e5awm_32",dO="_content_e5awm_48",uO="_close_e5awm_53",Gr={callout:aO,success:iO,icon:oO,error:rO,warning:lO,info:cO,content:dO,close:uO},fO={success:i.jsx(Ri,{size:Nt}),error:i.jsx(Ka,{size:Nt}),warning:i.jsx(ym,{size:Nt}),info:i.jsx(vm,{size:Nt})};function pO({variant:t="info",children:s,dismissible:o=!1,className:r}){const[c,d]=b.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:fO[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 mO({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(pO,{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 hO="_container_de44x_1",gO="_emptyState_de44x_8",vO="_card_de44x_14",yO="_cardClickable_de44x_34",bO="_cardHeader_de44x_42",xO="_categoryBadge_de44x_54",_O="_findingTitle_de44x_62",kO="_findingDate_de44x_68",SO="_findingContent_de44x_80",TO="_tags_de44x_86",jO="_tag_de44x_86",fs={container:hO,emptyState:gO,card:vO,cardClickable:yO,cardHeader:bO,categoryBadge:xO,findingTitle:_O,findingDate:kO,findingContent:SO,tags:TO,tag:jO};function U1({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:Uo(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 wO="_container_1ingb_1",NO="_heading_1ingb_7",CO="_section_1ingb_14",EO="_sectionTitle_1ingb_26",AO="_sectionDescription_1ingb_35",DO="_emptyState_1ingb_41",RO="_tokenList_1ingb_48",MO="_tokenRow_1ingb_55",IO="_tokenBadge_1ingb_68",OO="_tokenName_1ingb_83",BO="_tokenTarget_1ingb_90",LO="_deleteButton_1ingb_99",zO="_addForm_1ingb_113",$O="_formRow_1ingb_119",PO="_input_1ingb_125",UO="_select_1ingb_155",HO="_addButton_1ingb_187",VO="_emptyStateInfo_1ingb_221",qO="_themeOptions_1ingb_229",GO="_themeOption_1ingb_229",FO="_themeOptionSelected_1ingb_254",ZO="_themeOptionHeader_1ingb_259",KO="_themeOptionLabel_1ingb_266",YO="_themeOptionDesc_1ingb_273",JO="_variantToggle_1ingb_279",WO="_variantButton_1ingb_286",XO="_variantActive_1ingb_305",QO="_themeSwatches_1ingb_311",eB="_themeSwatch_1ingb_311",tB="_systemToggle_1ingb_325",nB="_systemToggleHint_1ingb_341",sB="_themeActive_1ingb_348",aB="_aboutGrid_1ingb_354",iB="_aboutItem_1ingb_360",oB="_aboutLabel_1ingb_373",rB="_aboutValue_1ingb_379",lB="_aboutDot_1ingb_387",cB="_aboutDotConnected_1ingb_394",dB="_aboutDotDisconnected_1ingb_398",he={container:wO,heading:NO,section:CO,sectionTitle:EO,sectionDescription:AO,emptyState:DO,tokenList:RO,tokenRow:MO,tokenBadge:IO,tokenName:OO,tokenTarget:BO,deleteButton:LO,addForm:zO,formRow:$O,input:PO,select:UO,addButton:HO,emptyStateInfo:VO,themeOptions:qO,themeOption:GO,themeOptionSelected:FO,themeOptionHeader:ZO,themeOptionLabel:KO,themeOptionDesc:YO,variantToggle:JO,variantButton:WO,variantActive:XO,themeSwatches:QO,themeSwatch:eB,systemToggle:tB,systemToggleHint:nB,themeActive:sB,aboutGrid:aB,aboutItem:iB,aboutLabel:oB,aboutValue:rB,aboutDot:lB,aboutDotConnected:cB,aboutDotDisconnected:dB},uB=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function fB({tokens:t,onSetToken:s,onDeleteToken:o,onShowToast:r}){const[c,d]=b.useState(""),[u,p]=b.useState(""),[m,g]=b.useState("env_var"),[v,x]=b.useState(""),[y,S]=b.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(""),x("")},j=T=>{S(T)},N=()=>{y&&(o(y),r==null||r("Token deleted","info")),S(null)};return i.jsxs(i.Fragment,{children:[i.jsx(oa,{isOpen:y!==null,title:"Delete Token?",description:y?`"${y}" will be permanently removed.`:void 0,onConfirm:N,onCancel:()=>S(null)}),i.jsxs("section",{className:he.section,children:[i.jsx("h3",{className:he.sectionTitle,children:"Tokens"}),i.jsx("p",{className:he.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?i.jsx("div",{className:he.emptyStateInfo,children:"Add your first API token to enable service integrations."}):i.jsx("div",{className:he.tokenList,children:t.map(T=>i.jsxs("div",{className:he.tokenRow,children:[i.jsx("span",{className:he.tokenBadge,children:T.tokenType}),i.jsx("span",{className:he.tokenName,children:T.name}),i.jsx("span",{className:he.tokenTarget,children:T.tokenType==="env_var"?T.envVar:T.filePath}),i.jsx("button",{className:he.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:he.addForm,onSubmit:k,children:[i.jsxs("div",{className:he.formRow,children:[i.jsx("input",{className:he.input,type:"text",placeholder:"Token name",value:c,onChange:T=>d(T.target.value)}),i.jsx("input",{className:he.input,type:"password",placeholder:"Value",value:u,onChange:T=>p(T.target.value)})]}),i.jsxs("div",{className:he.formRow,children:[i.jsx("select",{className:he.select,value:m,onChange:T=>g(T.target.value),children:uB.map(T=>i.jsx("option",{value:T.value,children:T.label},T.value))}),i.jsx("input",{className:he.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=>x(T.target.value)}),i.jsx("button",{className:he.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 pB({themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c}){return i.jsxs("section",{className:he.section,children:[i.jsx("h3",{className:he.sectionTitle,children:"Appearance"}),i.jsx("p",{className:he.sectionDescription,children:"Choose how Grackle looks across the app."}),i.jsx("div",{className:he.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:`${he.themeOption} ${p?he.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>o(d.id),children:[i.jsxs("span",{className:he.themeOptionHeader,children:[i.jsxs("span",{children:[i.jsx("span",{className:he.themeOptionLabel,children:d.label}),i.jsx("span",{className:he.themeOptionDesc,children:d.description})]}),u&&i.jsxs("span",{className:he.variantToggle,children:[i.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${p&&m?he.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:`${he.variantButton} ${p&&!m?he.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:he.themeSwatches,children:d.swatches.map((g,v)=>i.jsx("span",{className:he.themeSwatch,style:{background:g}},v))})]},d.id)})}),i.jsxs("label",{className:he.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:he.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),i.jsxs("p",{className:he.themeActive,children:["Active theme: ",i.jsx("strong",{children:s})]})]})}function mB({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:he.section,"data-testid":"about-panel",children:[i.jsx("h3",{className:he.sectionTitle,children:"About"}),i.jsx("p",{className:he.sectionDescription,children:"Connection status and application information."}),i.jsxs("div",{className:he.aboutGrid,children:[i.jsxs("div",{className:he.aboutItem,children:[i.jsx("span",{className:he.aboutLabel,children:"Connection"}),i.jsxs("span",{className:he.aboutValue,children:[i.jsx("span",{className:`${he.aboutDot} ${t?he.aboutDotConnected:he.aboutDotDisconnected}`}),t?"Connected":"Disconnected"]})]}),i.jsxs("div",{className:he.aboutItem,children:[i.jsx("span",{className:he.aboutLabel,children:"Environments"}),i.jsxs("span",{className:he.aboutValue,children:[r,"/",c," connected"]})]}),i.jsxs("div",{className:he.aboutItem,children:[i.jsx("span",{className:he.aboutLabel,children:"Active Sessions"}),i.jsx("span",{className:he.aboutValue,children:d})]}),i.jsxs("div",{className:he.aboutItem,children:[i.jsx("span",{className:he.aboutLabel,children:"Version"}),i.jsx("span",{className:he.aboutValue,children:"0.104.0"})]})]})]})}const hB="_container_cddyd_1",gB="_header_cddyd_8",vB="_headerTitle_cddyd_35",yB="_badge_cddyd_44",bB="_headerActions_cddyd_54",xB="_body_cddyd_61",_B="_formContent_cddyd_73",kB="_section_cddyd_85",SB="_label_cddyd_91",TB="_titleInput_cddyd_98",jB="_descriptionTextarea_cddyd_131",wB="_parentContext_cddyd_167",NB="_parentLabel_cddyd_175",CB="_parentName_cddyd_182",EB="_personaSelect_cddyd_186",AB="_depList_cddyd_220",DB="_depItem_cddyd_226",RB="_depItemSelected_cddyd_248",MB="_noDeps_cddyd_252",IB="_btnPrimary_cddyd_258",OB="_btnGhost_cddyd_289",nt={container:hB,header:gB,headerTitle:vB,badge:yB,headerActions:bB,body:xB,formContent:_B,section:kB,label:SB,titleInput:TB,descriptionTextarea:jB,parentContext:wB,parentLabel:NB,parentName:CB,personaSelect:EB,depList:AB,depItem:DB,depItemSelected:RB,noDeps:MB,btnPrimary:IB,btnGhost:OB};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:x}){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]=b.useState(j),C=j||N,A=u.find(xe=>xe.id===C),O=c??(A==null?void 0:A.environmentId),E=!S&&!o,D=S?(k==null?void 0:k.parentTaskId)??"":r??"",U=D?d.find(xe=>xe.id===D):void 0,[B,z]=b.useState((k==null?void 0:k.title)??""),[X,$]=b.useState((k==null?void 0:k.description)??""),[J,me]=b.useState((k==null?void 0:k.dependsOn)??[]),[ee,oe]=b.useState((k==null?void 0:k.defaultPersonaId)??""),[R,G]=b.useState((k==null?void 0:k.canDecompose)??!1),[Z,de]=b.useState(!1),W=b.useRef(!1);b.useEffect(()=>{S&&k&&!W.current&&(W.current=!0,z(k.title),$(k.description),me(k.dependsOn),oe(k.defaultPersonaId),G(k.canDecompose))},[S,k]);const Q=d.filter(xe=>xe.workspaceId===C&&(!S||xe.id!==s)&&xe.id!==D),ue=B.trim().length>0&&(!S||k!==void 0)&&C.length>0,Ce=xe=>{me(Be=>Be.includes(xe)?Be.filter(It=>It!==xe):[...Be,xe])},Ue=()=>{!ue||Z||S&&k===void 0||(S&&s?(g(s,B.trim(),X,J,ee),x==null||x("Task updated","success"),v?v():y(On(s,void 0,C,O),{replace:!0})):(de(!0),m(C,B.trim(),X,J.length>0?J:void 0,D||void 0,ee,R,()=>{x==null||x("Task created","success"),y(o?Ga(o,O):"/tasks",{replace:!0})},xe=>{x==null||x(xe,"error"),de(!1)})))},ve=()=>{if(v){v();return}y(S&&s?On(s,void 0,C,O):o?Ga(o,O):"/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}),U&&i.jsxs("span",{className:nt.parentContext,children:[i.jsx("span",{className:nt.parentLabel,children:"Child of"}),i.jsx("span",{className:nt.parentName,children:U.title})]})]}),i.jsxs("div",{className:nt.headerActions,children:[i.jsx("button",{onClick:Ue,disabled:!ue||Z,className:nt.btnPrimary,"data-testid":"task-edit-save",children:Z?"Creating…":S?"Save Changes":"Create"}),i.jsx("button",{onClick:ve,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:B,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&&Ue()}})]}),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:X,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:ee,onChange:xe=>oe(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:R,onChange:xe=>G(xe.target.checked)}),"Can spawn subtasks"]})}),i.jsxs("div",{className:nt.section,children:[i.jsx("div",{className:nt.label,children:"Dependencies"}),Q.length===0?i.jsx("div",{className:nt.noDeps,children:"No other tasks in this workspace"}):i.jsx("div",{className:nt.depList,children:Q.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 BB="_actionButtons_1rjka_1",LB="_btnPrimary_1rjka_8",zB="_btnDanger_1rjka_39",$B="_btnGhost_1rjka_78",Kt={actionButtons:BB,btnPrimary:LB,btnDanger:zB,btnGhost:$B};function PB({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 UB="_workpadSection_y8nj9_1",HB="_workpadLabel_y8nj9_9",VB="_workpadStatus_y8nj9_17",qB="_workpadSummary_y8nj9_23",GB="_workpadExtra_y8nj9_29",La={workpadSection:UB,workpadLabel:HB,workpadStatus:VB,workpadSummary:qB,workpadExtra:GB};function FB({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 ZB="_overviewDashboard_r05qm_1",KB="_overviewHero_r05qm_7",YB="_statusBadge_r05qm_14",JB="_statusPending_r05qm_26",WB="_statusAssigned_r05qm_31",XB="_statusInProgress_r05qm_36",QB="_statusReview_r05qm_41",eL="_statusDone_r05qm_46",tL="_statusFailed_r05qm_51",nL="_statusWaitingInput_r05qm_56",sL="_overviewBranchPill_r05qm_61",aL="_branchLink_r05qm_76",iL="_overviewSection_r05qm_87",oL="_overviewLabel_r05qm_93",rL="_overviewValue_r05qm_100",lL="_overviewMuted_r05qm_105",cL="_overviewMarkdown_r05qm_111",dL="_envRow_r05qm_180",uL="_envDot_r05qm_186",fL="_envDotGreen_r05qm_193",pL="_envDotYellow_r05qm_197",mL="_envDotRed_r05qm_201",hL="_envDotGray_r05qm_205",gL="_depList_r05qm_209",vL="_depItem_r05qm_215",yL="_depBlocked_r05qm_222",bL="_depDone_r05qm_226",xL="_timeline_r05qm_230",_L="_timelineRow_r05qm_236",kL="_timelineKey_r05qm_243",SL="_timelineValue_r05qm_249",TL="_timelineDelta_r05qm_253",jL="_reviewNotes_r05qm_264",ye={overviewDashboard:ZB,overviewHero:KB,statusBadge:YB,statusPending:JB,statusAssigned:WB,statusInProgress:XB,statusReview:QB,statusDone:eL,statusFailed:tL,statusWaitingInput:nL,overviewBranchPill:sL,branchLink:aL,overviewSection:iL,overviewLabel:oL,overviewValue:rL,overviewMuted:lL,overviewMarkdown:cL,envRow:dL,envDot:uL,envDotGreen:fL,envDotYellow:pL,envDotRed:mL,envDotGray:hL,depList:gL,depItem:vL,depBlocked:yL,depDone:bL,timeline:xL,timelineRow:_L,timelineKey:kL,timelineValue:SL,timelineDelta:TL,reviewNotes:jL};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"?ye.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?ye.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?ye.envDotRed:ye.envDotGray}function wL({status:t}){const s=qa(t),o=kj(t);return i.jsx("span",{className:`${ye.statusBadge} ${ye[o]??ye.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function NL({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,x=r.find(k=>k.id===t.workspaceId),y=o.find(k=>k.id===d),S=t.branch&&(x!=null&&x.repoUrl)?`${x.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return i.jsxs("div",{className:ye.overviewDashboard,"data-testid":"task-overview-panel",children:[i.jsxs("div",{className:ye.overviewHero,children:[i.jsx(wL,{status:t.status}),t.branch&&i.jsx("span",{className:ye.overviewBranchPill,"data-testid":"task-overview-branch",children:S?i.jsxs("a",{href:S,target:"_blank",rel:"noreferrer noopener",className:ye.branchLink,children:["🔗"," ",t.branch]}):i.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&i.jsxs("div",{className:ye.overviewSection,"data-testid":"task-overview-description",children:[i.jsx("div",{className:ye.overviewLabel,children:"Description"}),i.jsx("div",{className:ye.overviewMarkdown,children:i.jsx(Td,{remarkPlugins:[jd],children:t.description})})]}),t.workpad&&i.jsx(FB,{workpad:t.workpad}),i.jsxs("div",{className:ye.overviewSection,children:[i.jsx("div",{className:ye.overviewLabel,children:"Environment"}),g&&v?i.jsxs("div",{className:ye.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${ye.envDot} ${nx(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),i.jsx("span",{className:ye.overviewValue,children:v.displayName})]}):y?i.jsxs("div",{className:ye.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${ye.envDot} ${nx(y.status)}`,title:y.status,"aria-label":`Status: ${y.status}`,role:"img"}),i.jsx("span",{className:ye.overviewValue,children:y.displayName}),i.jsx("span",{className:ye.overviewMuted,children:"(workspace default)"})]}):i.jsx("div",{className:ye.overviewMuted,children:"Set in workspace settings"})]}),i.jsxs("div",{className:ye.overviewSection,"data-testid":"task-overview-dependencies",children:[i.jsx("div",{className:ye.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?i.jsx("div",{className:ye.overviewMuted,children:"None"}):i.jsx("div",{className:ye.depList,children:t.dependsOn.map(k=>{const j=s.get(k),N=(j==null?void 0:j.status)==="complete";return i.jsxs("div",{className:`${ye.depItem} ${N?ye.depDone:ye.depBlocked}`,children:[i.jsx("span",{children:N?"✓":"○"}),i.jsx("span",{children:(j==null?void 0:j.title)??k})]},k)})})]}),i.jsxs("div",{className:ye.overviewSection,"data-testid":"task-overview-timeline",children:[i.jsx("div",{className:ye.overviewLabel,children:"Timeline"}),i.jsxs("div",{className:ye.timeline,children:[t.createdAt&&i.jsxs("div",{className:ye.timelineRow,children:[i.jsx("span",{className:ye.timelineKey,children:"Created"}),i.jsx("span",{className:ye.timelineValue,children:Fc(t.createdAt)})]}),t.assignedAt&&(()=>{const k=Ep(t.createdAt,t.assignedAt);return i.jsxs("div",{className:ye.timelineRow,children:[i.jsx("span",{className:ye.timelineKey,children:"Assigned"}),i.jsx("span",{className:ye.timelineValue,children:Fc(t.assignedAt)}),k!==void 0&&i.jsx("span",{className:ye.timelineDelta,children:k})]})})(),t.startedAt&&(()=>{const k=Ep(t.assignedAt??t.createdAt,t.startedAt);return i.jsxs("div",{className:ye.timelineRow,children:[i.jsx("span",{className:ye.timelineKey,children:"Started"}),i.jsx("span",{className:ye.timelineValue,children:Fc(t.startedAt)}),k!==void 0&&i.jsx("span",{className:ye.timelineDelta,children:k})]})})(),t.completedAt&&(()=>{const k=Ep(t.startedAt,t.completedAt);return i.jsxs("div",{className:ye.timelineRow,children:[i.jsx("span",{className:ye.timelineKey,children:"Completed"}),i.jsx("span",{className:ye.timelineValue,children:Fc(t.completedAt)}),k!==void 0&&i.jsx("span",{className:ye.timelineDelta,children:k})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&i.jsx("div",{className:ye.overviewMuted,children:"No timing data"})]})]}),u&&u.costMillicents>0&&i.jsxs("div",{className:ye.overviewSection,"data-testid":"task-overview-usage",children:[i.jsx("div",{className:ye.overviewLabel,children:"Usage"}),i.jsxs("div",{className:ye.timeline,children:[i.jsxs("div",{className:ye.timelineRow,children:[i.jsx("span",{className:ye.timelineKey,children:"Cost"}),i.jsx("span",{className:ye.timelineValue,children:Ns(u.costMillicents)}),i.jsxs("span",{className:ye.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),p&&p.costMillicents>u.costMillicents&&i.jsxs("div",{className:ye.timelineRow,children:[i.jsx("span",{className:ye.timelineKey,children:"Total (incl. subtasks)"}),i.jsx("span",{className:ye.timelineValue,children:Ns(p.costMillicents)}),i.jsxs("span",{className:ye.timelineDelta,children:[p.sessionCount," session",p.sessionCount!==1?"s":""]})]})]})]}),(t.tokenBudget>0||t.costBudgetMillicents>0)&&i.jsxs("div",{className:ye.overviewSection,"data-testid":"task-overview-budget",children:[i.jsx("div",{className:ye.overviewLabel,children:"Budget"}),i.jsxs("div",{className:ye.timeline,children:[t.tokenBudget>0&&i.jsxs("div",{className:ye.timelineRow,children:[i.jsx("span",{className:ye.timelineKey,children:"Tokens"}),i.jsxs("span",{className:ye.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:ye.timelineRow,children:[i.jsx("span",{className:ye.timelineKey,children:"Cost"}),i.jsxs("span",{className:ye.timelineValue,children:[Ns((u==null?void 0:u.costMillicents)??0)," / ",Ns(t.costBudgetMillicents)]})]})]})]}),t.reviewNotes&&i.jsxs("div",{className:ye.overviewSection,"data-testid":"task-overview-review-notes",children:[i.jsx("div",{className:ye.overviewLabel,children:"Review Notes"}),i.jsx("div",{className:ye.reviewNotes,children:t.reviewNotes})]})]})}function CL({plugins:t,loading:s,onSetPluginEnabled:o}){return i.jsxs("div",{className:he.container,"data-testid":"plugins-panel",children:[i.jsx("h2",{className:he.heading,children:"Plugins"}),i.jsxs("div",{className:he.section,children:[i.jsx("p",{className:he.sectionDescription,children:"Enable or disable optional Grackle plugins. A server restart is required for changes to take effect."}),s&&i.jsx("p",{className:he.emptyState,children:"Loading plugins..."}),!s&&t.length===0&&i.jsx("p",{className:he.emptyState,children:"No plugins found."}),!s&&t.map(r=>{const c=r.enabled!==r.loaded;return i.jsxs("div",{className:he.tokenRow,"data-testid":`plugin-row-${r.name}`,children:[i.jsxs("div",{style:{flex:1},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("span",{className:he.tokenName,children:r.name}),r.required&&i.jsx("span",{className:he.tokenBadge,title:"Required — cannot be disabled",children:"required"})]}),i.jsx("div",{className:he.tokenTarget,children:r.description}),c&&i.jsx("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--accent-yellow)",marginTop:"2px"},"data-testid":`plugin-restart-notice-${r.name}`,children:"Restart Grackle to apply changes"})]}),i.jsx("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:r.required?"not-allowed":"pointer"},title:r.required?"Core is required and cannot be disabled":void 0,children:i.jsx("input",{type:"checkbox",checked:r.enabled,disabled:r.required,onChange:d=>o(r.name,d.target.checked),"data-testid":`plugin-toggle-${r.name}`,"aria-label":`Enable or disable ${r.name} plugin`,style:{accentColor:"var(--accent-green)",width:"16px",height:"16px"}})})]},r.name)})]})]})}const EL="_container_legrg_1",AL="_header_legrg_8",DL="_headerTitle_legrg_35",RL="_badge_legrg_44",ML="_headerActions_legrg_54",IL="_body_legrg_61",OL="_formContent_legrg_73",BL="_section_legrg_85",LL="_label_legrg_91",zL="_nameInput_legrg_98",$L="_fieldInput_legrg_131",PL="_adapterSelect_legrg_164",UL="_readOnlyValue_legrg_198",HL="_codespaceSection_legrg_204",VL="_codespaceActions_legrg_210",qL="_creatingHint_legrg_216",GL="_errorHint_legrg_222",FL="_btnPrimary_legrg_235",ZL="_btnGhost_legrg_266",ce={container:EL,header:AL,headerTitle:DL,badge:RL,headerActions:ML,body:IL,formContent:OL,section:BL,label:LL,nameInput:zL,fieldInput:$L,adapterSelect:PL,readOnlyValue:UL,codespaceSection:HL,codespaceActions:VL,creatingHint:qL,errorHint:GL,btnPrimary:FL,btnGhost:ZL},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 KL({codespaceName:t,onCodespaceNameChange:s,envName:o,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:m}){const[g,v]=b.useState("pick"),[x,y]=b.useState(""),[S,k]=b.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:x,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:()=>{x.trim()&&(m(x.trim(),S.trim()||void 0),v("pick"),y(""),k(""))},disabled:!x.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:x}){const y=mt(),S=t==="edit",k=S&&s?o.find(ve=>ve.id===s):void 0,[j,N]=b.useState(""),[T,C]=b.useState("local"),[A,O]=b.useState(""),[E,D]=b.useState(""),[U,B]=b.useState(""),[z,X]=b.useState(""),[$,J]=b.useState(""),[me,ee]=b.useState(""),[oe,R]=b.useState(""),[G,Z]=b.useState(null),de=b.useCallback(()=>{const ve={};if(T==="local"){if(A.trim()&&(ve.host=A.trim()),E.trim()){const Se=Number(E);Number.isInteger(Se)&&(ve.port=Se)}}else if(T==="ssh"){if(ve.host=A.trim(),U.trim()&&(ve.user=U.trim()),E.trim()){const Se=Number(E);Number.isInteger(Se)&&(ve.sshPort=Se)}z.trim()&&(ve.identityFile=z.trim())}else T==="docker"?($.trim()&&(ve.image=$.trim()),me.trim()&&(ve.repo=me.trim())):T==="codespace"&&(ve.codespaceName=oe.trim());return ve},[T,A,E,U,z,$,me,oe]),W=()=>!(!j.trim()||T==="ssh"&&!A.trim()||T==="codespace"&&!oe.trim()||(T==="local"||T==="ssh")&&!Ap(E)),Q=()=>{W()&&(r(j.trim(),T,de()),x==null||x("Environment added successfully","success"),y(Io,{replace:!0}))},ue=()=>{y(s?Ai(s):Io)},Ce=b.useCallback((ve,Se)=>{if(!k||!s)return;const xe=Dp(k.adapterConfig),Be=Se.trim();Be?xe[ve]=Be:delete xe[ve],c(s,{adapterConfig:xe})},[k,s,c]),Ue=b.useCallback((ve,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[ve]=Be)}else delete xe[ve];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 ve=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:G,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(ve.host??""),onSave:Se=>Ce("host",Se),mode:"edit",fieldId:"host",activeFieldId:G,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(ve.port??""),onSave:Se=>Ue("port",Se),validate:Se=>Ap(Se)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:G,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(ve.host??""),onSave:Se=>Ce("host",Se),validate:Se=>Se.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:G,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(ve.user??""),onSave:Se=>Ce("user",Se),mode:"edit",fieldId:"user",activeFieldId:G,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(ve.sshPort??""),onSave:Se=>Ue("sshPort",Se),validate:Se=>Ap(Se)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:G,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(ve.identityFile??""),onSave:Se=>Ce("identityFile",Se),mode:"edit",fieldId:"identityFile",activeFieldId:G,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(ve.image??""),onSave:Se=>Ce("image",Se),mode:"edit",fieldId:"image",activeFieldId:G,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(ve.repo??""),onSave:Se=>Ce("repo",Se),mode:"edit",fieldId:"repo",activeFieldId:G,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(ve.codespaceName??""),onSave:Se=>Ce("codespaceName",Se),validate:Se=>Se.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:G,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:Q,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:ve=>N(ve.target.value),placeholder:"Environment name...",autoFocus:!0,className:ce.nameInput,"data-testid":"env-create-name",onKeyDown:ve=>{ve.key==="Enter"&&W()&&Q()}})]}),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:ve=>{C(ve.target.value),ve.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:ve=>O(ve.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:ve=>D(ve.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:ve=>O(ve.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:U,onChange:ve=>B(ve.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:ve=>D(ve.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:ve=>X(ve.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:ve=>J(ve.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:ve=>ee(ve.target.value),placeholder:"Repo (optional)...",className:ce.fieldInput,"data-testid":"env-create-repo"})]})]}),T==="codespace"&&i.jsx(KL,{codespaceName:oe,onCodespaceNameChange:R,envName:j,onEnvNameChange:N,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v})]})})]})}const YL="_group_1iprv_1",JL="_groupTitle_1iprv_8",WL="_shortcutList_1iprv_17",XL="_shortcutRow_1iprv_23",QL="_keys_1iprv_36",e8="_kbd_1iprv_43",t8="_description_1iprv_60",Si={group:YL,groupTitle:JL,shortcutList:WL,shortcutRow:XL,keys:QL,kbd:e8,description:t8},n8=[{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 s8(){return i.jsxs("section",{className:he.section,"data-testid":"keyboard-shortcuts-panel",children:[i.jsx("h3",{className:he.sectionTitle,children:"Keyboard Shortcuts"}),i.jsx("p",{className:he.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),n8.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 a8=[{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 i8({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:he.section,children:[i.jsx("h3",{className:he.sectionTitle,children:"Credential Providers"}),i.jsx("p",{className:he.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:he.tokenList,children:a8.map(r=>i.jsxs("div",{className:he.tokenRow,children:[i.jsx("span",{className:he.tokenName,children:r.label}),i.jsx("span",{className:he.tokenTarget,children:r.description}),i.jsx("select",{className:he.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 o8="_container_10efq_1",r8="_header_10efq_7",l8="_list_10efq_105",c8="_card_10efq_111",d8="_cardHeader_10efq_125",u8="_cardTitle_10efq_135",f8="_defaultBadge_10efq_141",p8="_cardActions_10efq_155",m8="_description_10efq_160",h8="_meta_10efq_166",g8="_empty_10efq_212",v8="_typeBadge_10efq_362",Xn={container:o8,header:r8,list:l8,card:c8,cardHeader:d8,cardTitle:u8,defaultBadge:f8,cardActions:p8,description:m8,meta:h8,empty:g8,typeBadge:v8};function y8({personas:t,appDefaultPersonaId:s,onDeletePersona:o,onSetAppDefaultPersonaId:r,onNavigateToNew:c,onNavigateToPersona:d}){const[u,p]=b.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 x=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"}),x&&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:[!x&&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(oa,{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 b8="_container_uy08i_1",x8="_header_uy08i_7",_8="_count_uy08i_13",k8="_presets_uy08i_18",S8="_presetButton_uy08i_24",T8="_filterInput_uy08i_41",j8="_groups_uy08i_53",w8="_group_uy08i_53",N8="_groupHeader_uy08i_68",C8="_groupName_uy08i_77",E8="_groupCount_uy08i_81",A8="_toolList_uy08i_87",D8="_toolItem_uy08i_95",R8="_toolName_uy08i_103",gn={container:b8,header:x8,count:_8,presets:k8,presetButton:S8,filterInput:T8,groups:j8,group:w8,groupHeader:N8,groupName:C8,groupCount:E8,toolList:A8,toolItem:D8,toolName:R8},M8=(()=>{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()}))})(),I8=[{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]=b.useState(""),d=b.useMemo(()=>new Set(t),[t]),u=b.useCallback(v=>{if(o)return;const x=new Set(d);x.has(v)?x.delete(v):x.add(v),s([...x].sort())},[d,s,o]),p=b.useCallback((v,x)=>{if(o)return;const y=new Set(d);for(const S of v)x?y.delete(S):y.add(S);s([...y].sort())},[d,s,o]),m=b.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:[I8.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:M8.map(({group:v,tools:x})=>{const y=g?x.filter(k=>k.toLowerCase().includes(g)):x;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 O8="_container_1gfuq_1",B8="_header_1gfuq_7",L8="_list_1gfuq_19",z8="_card_1gfuq_25",$8="_cardHeader_1gfuq_40",P8="_cardTitle_1gfuq_46",U8="_statusBadge_1gfuq_56",H8="_enabled_1gfuq_68",V8="_disabled_1gfuq_71",q8="_cardActions_1gfuq_75",G8="_cardMeta_1gfuq_80",F8="_empty_1gfuq_98",Qn={container:O8,header:B8,list:L8,card:z8,cardHeader:$8,cardTitle:P8,statusBadge:U8,enabled:H8,disabled:V8,cardActions:q8,cardMeta:G8,empty:F8};function Z8({schedules:t,personas:s,onDeleteSchedule:o,onToggleEnabled:r,onNavigateToNew:c,onNavigateToSchedule:d}){const[u,p]=b.useState(null),m=u?t.find(y=>y.id===u):void 0,g=async y=>{await o(y),p(null)},v=b.useMemo(()=>{const y=new Map;for(const S of s)y.set(S.id,S.name);return y},[s]),x=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: ",x(y.personaId)]}),i.jsxs("span",{"data-testid":`schedule-last-run-${y.id}`,children:["Last run: ",y.lastRunAt?Uo(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(oa,{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 K8="_nav_1bhou_1",Y8="_tab_1bhou_24",J8="_tabIcon_1bhou_62",W8="_tabActive_1bhou_68",Zc={nav:K8,tab:Y8,tabIcon:J8,tabActive:W8},Qs=[{path:"credentials",label:"Credentials",icon:i.jsx(V2,{size:Nt})},{path:"personas",label:"Personas",icon:i.jsx(bj,{size:Nt})},{path:"schedules",label:"Schedules",icon:i.jsx(_2,{size:Nt})},{path:"appearance",label:"Appearance",icon:i.jsx(ij,{size:Nt})},{path:"shortcuts",label:"Shortcuts",icon:i.jsx(G2,{size:Nt})},{path:"plugins",label:"Plugins",icon:i.jsx(uj,{size:Nt})},{path:"about",label:"About",icon:i.jsx(vm,{size:Nt})}];function X8(){var u;const t=Yt(),s=mt(),o=b.useRef(null),r=((u=Qs.find(p=>{const m=`${Ni}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??Qs[0].path,c=b.useCallback(p=>{s(`${Ni}/${p}`)},[s]),d=b.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:Qs.findIndex(j=>j.path===r);let x=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),x=(v+1)%Qs.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),x=(v-1+Qs.length)%Qs.length;else if(p.key==="Home")p.preventDefault(),x=0;else if(p.key==="End")p.preventDefault(),x=Qs.length-1;else return;const y=Qs[x].path;s(`${Ni}/${y}`),(k=m[x])==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:Qs.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 Q8({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 x;if(u==="paused"&&o){const k=o.get(d.id);k==="idle"?x="Needs input":k==="completed"&&(x="Ready to complete")}const y={task:d,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:x},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 e7="_boardContainer_1c4y1_1",t7="_column_1c4y1_17",n7="_columnHeader_1c4y1_34",s7="_columnIcon_1c4y1_47",a7="_columnLabel_1c4y1_52",i7="_columnCount_1c4y1_57",o7="_cardList_1c4y1_67",r7="_emptyPlaceholder_1c4y1_76",l7="_card_1c4y1_67",c7="_cardHeader_1c4y1_107",d7="_cardStatusIcon_1c4y1_113",u7="_cardTitle_1c4y1_119",f7="_cardBadges_1c4y1_127",p7="_badge_1c4y1_134",m7="_blockedBadge_1c4y1_146",h7="_childBadge_1c4y1_151",g7="_depBadge_1c4y1_155",v7="_parentBadge_1c4y1_159",y7="_pausedSubBadge_1c4y1_166",b7="_personaBadge_1c4y1_170",x7="_envBadge_1c4y1_174",_7="_emptyCta_1c4y1_178",k7="_ctaButton_1c4y1_188",S7="_ctaDescription_1c4y1_204",it={boardContainer:e7,column:t7,columnHeader:n7,columnIcon:s7,columnLabel:a7,columnCount:i7,cardList:o7,emptyPlaceholder:r7,card:l7,cardHeader:c7,cardStatusIcon:d7,cardTitle:u7,cardBadges:f7,badge:p7,blockedBadge:m7,childBadge:h7,depBadge:g7,parentBadge:v7,pausedSubBadge:y7,personaBadge:b7,envBadge:x7,emptyCta:_7,ctaButton:k7,ctaDescription:S7};function T7({workspaceId:t,environmentId:s,tasks:o,sessions:r,personas:c,environments:d}){const u=mt(),p=b.useMemo(()=>o.filter(y=>y.workspaceId===t),[o,t]),m=b.useMemo(()=>new Map(o.map(y=>[y.id,y.status])),[o]),g=b.useMemo(()=>new Map(p.map(y=>[y.id,y])),[p]),v=b.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 O=S.get(A.personaId);O&&N.set(C.id,O.name)}if(A.environmentId){const O=k.get(A.environmentId);O&&T.set(C.id,O.displayName)}}}return{sessionStatusByTaskId:j,personaNameByTaskId:N,environmentNameByTaskId:T}},[p,r,c,d]),x=b.useMemo(()=>Q8({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:x.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(j7,{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 j7({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),x=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:[x&&i.jsx("span",{className:`${it.badge} ${it.parentBadge}`,title:x.title,children:x.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 w7="_formContent_ymnez_1",N7="_section_ymnez_13",C7="_label_ymnez_19",E7="_titleInput_ymnez_26",A7="_descriptionTextarea_ymnez_58",D7="_selectField_ymnez_94",R7="_checkboxRow_ymnez_128",M7="_checkboxLabel_ymnez_141",I7="_fieldError_ymnez_146",xt={formContent:w7,section:N7,label:C7,titleInput:E7,descriptionTextarea:A7,selectField:D7,checkboxRow:R7,checkboxLabel:M7,fieldError:I7};function O7(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 B7=100;function L7({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:B7,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=b.createContext(void 0),z7=4e3;function $7({children:t}){const[s,o]=b.useState([]),r=b.useRef(0),c=b.useCallback(u=>{o(p=>p.filter(m=>m.id!==u))},[]),d=b.useCallback((u,p="info",m=z7)=>{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=b.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 P7(){return ld===void 0&&(ld={themeId:nl(),systemDark:pm(),preferSystem:_d()}),ld}function U7(t){return Jr=[...Jr,t],()=>{Jr=Jr.filter(s=>s!==t)}}function H7(){const t=b.useSyncExternalStore(U7,P7),{themeId:s,preferSystem:o}=t,r=K1(s,o),c=b.useCallback(u=>{if(H1.has(u)){try{localStorage.setItem(fm,u)}catch{}No(u,_d(),!0),Rp()}},[]),d=b.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 b.useEffect(()=>{No(s,o)},[s,o]),b.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 x=mm(m);x!=null&&x.variantDarkId&&x.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=b.createContext(void 0);function V7({children:t}){const s=H7();return i.jsx(Y1.Provider,{value:s,children:t})}function J1(){const t=b.useContext(Y1);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const W1=b.createContext(void 0),X1=b.createContext(void 0);function q7({children:t}){const[s,o]=b.useState(void 0),r=b.useCallback(c=>{o(c)},[]);return i.jsx(X1.Provider,{value:r,children:i.jsx(W1.Provider,{value:s,children:t})})}function G7(){return b.useContext(W1)}function F7(){const t=b.useContext(X1);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const fh=b.createContext(void 0);function ot(){const t=b.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 Z7(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 K7=new Set(["off","subscription","api_key"]),Kc=new Set(["off","on"]);function Y7(t){return Q1(t)&&K7.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 J7(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 ra={label:"Home",url:Di};function W7(t){return t?[ra,{label:"Settings",url:Ni},{label:t,url:void 0}]:[ra,{label:"Settings",url:void 0}]}const ph={label:"Environments",url:Io};function X7(){return[ra,{label:"Environments",url:void 0}]}function Q7(){return[ra,{label:"New Chat",url:void 0}]}function ez(t){return[ra,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function tz(t,s,o,r){const c=o.find(u=>u.id===t),d=r.find(u=>u.id===s);return[ra,ph,{label:(d==null?void 0:d.displayName)??"Environment",url:Ai(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function nz(t,s,o,r,c){const d=J7(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,x=[ra];v&&g&&(x.push(ph),x.push({label:v.displayName,url:Ai(g)})),m&&g&&x.push({label:m.name,url:Ga(m.id,g)});for(let S=0;S<d.length-1;S++)x.push({label:d[S].title,url:On(d[S].id,void 0,p,g)});const y=d[d.length-1];return x.push({label:(y==null?void 0:y.title)??t,url:void 0}),x}const sz={label:"Findings",url:Dd};function az(){return[ra,{label:"Findings",url:void 0}]}function sk(t,s,o,r,c){const d=[ra];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:CN(s,o)})}else d.push(sz);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 iz(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 x=s.get(v),y=x?Yc(x):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,x)=>{if(v.eventType!=="tool_result")return v;const y=s.get(v),S=y?iz(y):void 0;if(!S)return v;const k=o.get(S);if(!k)return v;r.add(S),c.add(x);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 x=s.get(d[v]),y=x?Yc(x):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 x=p[m];if(x!==v+1)continue;const y=d[v],S=d[x];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[x]={...S,toolUseCtx:{...k,detailedResult:j}},c.add(x);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 x=s.get(v);if(!x)return!0;const y=Yc(x);if(y&&r.has(y))return!1;const S=x.__seqId;return!(S&&r.has(S))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let x=!1;for(let y=v+1;y<g.length;y++)if(g[y].eventType!=="tool_use"){x=!0;break}x&&(g[v]={...g[v],settled:!0})}return g}function oz(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 rz(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 lz(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 cz(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
285
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
286
- const header = req.headers.authorization;
287
- if (!header?.startsWith("Bearer ")) {
288
- res.status(401).json({ error: "Missing token" });
289
- return;
290
- }
291
- const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
292
- req.user = decoded;
293
- next();
294
- }
295
- \`\`\``,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
296
- CREATE TABLE audit_log (
297
- id BIGSERIAL PRIMARY KEY,
298
- user_id UUID REFERENCES users(id),
299
- action TEXT NOT NULL,
300
- entity_type TEXT NOT NULL,
301
- entity_id TEXT NOT NULL,
302
- old_value JSONB,
303
- new_value JSONB,
304
- ip_address INET,
305
- created_at TIMESTAMPTZ DEFAULT now()
306
- );
307
- \`\`\``,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"}],dz=new Map(ws.map(t=>[t.id,t]));function Mp(t){const s=dz.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"}]}},uz=[{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}],fz=[{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}],pz=[{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.
308
- Project: acme/alpha — Node.js + Express REST API
309
- 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";
310
- import type { Request, Response, NextFunction } from "express";
311
-
312
- export function requireAuth(req: Request, res: Response, next: NextFunction): void {
313
- if (!req.session?.userId) {
314
- res.status(401).json({ error: "Not authenticated" });
315
- return;
316
- }
317
- next();
318
- }`,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) {
319
- src/routes/login.ts:18: req.session.userId = user.id;
320
- src/routes/login.ts:19: req.session.role = user.role;
321
- 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";
322
- import bcrypt from "bcrypt";
323
- import { db } from "../db.js";
324
-
325
- const router = Router();
326
-
327
- router.post("/login", async (req, res) => {
328
- const { email, password } = req.body;
329
- const user = await db.users.findByEmail(email);
330
- if (!user || !await bcrypt.compare(password, user.passwordHash)) {
331
- return res.status(401).json({ error: "Invalid credentials" });
332
- }
333
- req.session.userId = user.id;
334
- req.session.role = user.role;
335
- res.json({ ok: true });
336
- });
337
-
338
- 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.
339
- Project: acme/alpha — Node.js + Express REST API
340
- Task: Implement auth middleware using JWT tokens
341
-
342
- 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
343
- src/routes/login.ts
344
- 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
345
-
346
- 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";
347
- import type { Request, Response, NextFunction } from "express";
348
-
349
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
350
-
351
- export interface JwtPayload {
352
- userId: string;
353
- role: string;
354
- iat: number;
355
- exp: number;
356
- }
357
-
358
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
359
- const header = req.headers.authorization;
360
- if (!header?.startsWith("Bearer ")) {
361
- res.status(401).json({ error: "Missing or malformed token" });
362
- return;
363
- }
364
- try {
365
- const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
366
- req.user = decoded;
367
- next();
368
- } catch (err) {
369
- if (err instanceof jwt.TokenExpiredError) {
370
- res.status(401).json({ error: "Token expired" });
371
- } else {
372
- res.status(403).json({ error: "Invalid token" });
373
- }
374
- }
375
- }
376
- `}}),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.
377
-
378
- The new login flow will:
379
- 1. Validate credentials (unchanged)
380
- 2. Generate a JWT with \`userId\` and \`role\` claims
381
- 3. Return the token in the response body
382
- 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";
383
- import bcrypt from "bcrypt";
384
- import jwt from "jsonwebtoken";
385
- import crypto from "node:crypto";
386
- import { db } from "../db.js";
387
-
388
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
389
- const ACCESS_TOKEN_EXPIRY = "24h";
390
- const REFRESH_TOKEN_BYTES = 48;
391
-
392
- const router = Router();
393
-
394
- router.post("/login", async (req, res) => {
395
- const { email, password } = req.body;
396
- const user = await db.users.findByEmail(email);
397
- if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
398
- return res.status(401).json({ error: "Invalid credentials" });
399
- }
400
-
401
- const accessToken = jwt.sign(
402
- { userId: user.id, role: user.role },
403
- JWT_SECRET,
404
- { expiresIn: ACCESS_TOKEN_EXPIRY },
405
- );
406
-
407
- const refreshToken = crypto.randomBytes(REFRESH_TOKEN_BYTES).toString("hex");
408
- await db.refreshTokens.create({ userId: user.id, token: refreshToken });
409
-
410
- res.json({ accessToken, refreshToken, expiresIn: ACCESS_TOKEN_EXPIRY });
411
- });
412
-
413
- export default router;
414
- `}}),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
415
- PASS src/routes/__tests__/protected.test.ts
416
- FAIL src/middleware/__tests__/auth.test.ts
417
- x should reject missing session (12ms)
418
- x should allow valid session (8ms)
419
-
420
- 2 failed, 12 passed, 14 total
421
-
422
- 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.
423
-
424
- 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";
425
- import jwt from "jsonwebtoken";
426
- import { verifyToken } from "../auth.js";
427
- import { createMockReqRes } from "../../test-utils/mock-express.js";
428
-
429
- const SECRET = "test-secret";
430
- process.env.JWT_SECRET = SECRET;
431
-
432
- describe("verifyToken", () => {
433
- it("should reject requests without Authorization header", () => {
434
- const { req, res, next } = createMockReqRes();
435
- verifyToken(req, res, next);
436
- expect(res.status).toHaveBeenCalledWith(401);
437
- });
438
-
439
- it("should reject expired tokens", () => {
440
- const token = jwt.sign({ userId: "u1", role: "user" }, SECRET, { expiresIn: "-1h" });
441
- const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
442
- verifyToken(req, res, next);
443
- expect(res.status).toHaveBeenCalledWith(401);
444
- });
445
-
446
- it("should accept valid tokens and attach user to request", () => {
447
- const token = jwt.sign({ userId: "u1", role: "admin" }, SECRET, { expiresIn: "1h" });
448
- const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
449
- verifyToken(req, res, next);
450
- expect(next).toHaveBeenCalled();
451
- expect(req.user).toMatchObject({ userId: "u1", role: "admin" });
452
- });
453
- });
454
- `}}),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
455
- PASS src/routes/__tests__/protected.test.ts
456
- PASS src/middleware/__tests__/auth.test.ts
457
-
458
- Test Suites: 3 passed, 3 total
459
- 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:
460
-
461
- ### Changes made
462
-
463
- | File | Action |
464
- |------|--------|
465
- | \`src/middleware/auth.ts\` | Rewrote to verify JWT Bearer tokens |
466
- | \`src/routes/login.ts\` | Now issues JWT access + refresh tokens |
467
- | \`src/routes/protected.ts\` | Updated to read \`req.user\` from JWT payload |
468
- | \`src/middleware/__tests__/auth.test.ts\` | Updated tests for JWT verification |
469
-
470
- ### Key decisions
471
- - **Access token expiry**: 24 hours (configurable via \`JWT_SECRET\` env var)
472
- - **Refresh tokens**: 48-byte random hex, stored in DB
473
- - **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.
474
- Project: acme/alpha — Node.js + Express REST API
475
- 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";
476
- import bcrypt from "bcrypt";
477
- import { db } from "../db.js";
478
- import { validateEmail, validatePassword } from "../utils/validators.js";
479
-
480
- const SALT_ROUNDS = 12;
481
- const router = Router();
482
-
483
- router.post("/register", async (req, res) => {
484
- const { name, email, password } = req.body;
485
-
486
- if (!name || !email || !password) {
487
- return res.status(400).json({ error: "Missing required fields" });
488
- }
489
- if (!validateEmail(email)) {
490
- return res.status(400).json({ error: "Invalid email format" });
491
- }
492
- if (!validatePassword(password)) {
493
- return res.status(400).json({ error: "Password too weak" });
494
- }
495
-
496
- const existing = await db.users.findByEmail(email);
497
- if (existing) {
498
- return res.status(409).json({ error: "Email already registered" });
499
- }
500
-
501
- const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
502
- const user = await db.users.create({ name, email, passwordHash });
503
- res.status(201).json({ id: user.id, name: user.name, email: user.email });
504
- });
505
-
506
- 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:
507
-
508
- 1. **Happy path** - valid registration
509
- 2. **Missing fields** - each required field missing
510
- 3. **Invalid email** - malformed email format
511
- 4. **Weak password** - password validation failure
512
- 5. **Duplicate email** - conflict with existing user
513
- 6. **SQL injection** - malicious email input
514
- 7. **XSS payload** - HTML in the name field
515
- 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
516
- POST /api/register
517
- ✓ should register a valid user (28ms)
518
- ✓ should reject missing name (4ms)
519
- ✓ should reject missing email (3ms)
520
- ✓ should reject missing password (3ms)
521
- ✓ should reject invalid email format (5ms)
522
- ✓ should reject weak password (4ms)
523
- ✓ should reject duplicate email (12ms)
524
- ✓ should sanitize HTML in name field (6ms)
525
-
526
- 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.
527
- Project: acme/alpha — Node.js + Express + PostgreSQL
528
- 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 (
529
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
530
- name TEXT NOT NULL,
531
- email TEXT UNIQUE NOT NULL,
532
- password_hash TEXT NOT NULL,
533
- role TEXT DEFAULT 'user',
534
- created_at TIMESTAMPTZ DEFAULT now(),
535
- updated_at TIMESTAMPTZ DEFAULT now()
536
- );
537
-
538
- CREATE TABLE sessions (
539
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
540
- user_id UUID REFERENCES users(id),
541
- expires_at TIMESTAMPTZ NOT NULL,
542
- created_at TIMESTAMPTZ DEFAULT now()
543
- );`,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
544
- -- Add audit logging and user activity tracking
545
-
546
- BEGIN;
547
-
548
- -- 1. Add last_login_at to users
549
- ALTER TABLE users ADD COLUMN last_login_at TIMESTAMPTZ;
550
-
551
- -- 2. Index for session cleanup queries
552
- CREATE INDEX CONCURRENTLY idx_sessions_expires_at ON sessions (expires_at);
553
-
554
- -- 3. Audit log table
555
- CREATE TABLE audit_log (
556
- id BIGSERIAL PRIMARY KEY,
557
- user_id UUID REFERENCES users(id),
558
- action TEXT NOT NULL,
559
- entity_type TEXT NOT NULL,
560
- entity_id TEXT NOT NULL,
561
- old_value JSONB,
562
- new_value JSONB,
563
- ip_address INET,
564
- created_at TIMESTAMPTZ DEFAULT now()
565
- );
566
-
567
- CREATE INDEX idx_audit_log_user ON audit_log (user_id);
568
- CREATE INDEX idx_audit_log_entity ON audit_log (entity_type, entity_id);
569
- CREATE INDEX idx_audit_log_created ON audit_log (created_at);
570
-
571
- COMMIT;
572
- `}}),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
573
- - ALTER TABLE users ADD COLUMN last_login_at
574
- - CREATE INDEX CONCURRENTLY idx_sessions_expires_at
575
- - CREATE TABLE audit_log
576
- - 3 indexes on audit_log
577
-
578
- WARNING: CREATE INDEX CONCURRENTLY cannot run inside a transaction block.
579
- 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.
580
- Project: acme/data-pipeline — ETL pipelines for analytics
581
- 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
582
- src/middleware/error-handler.ts
583
- src/middleware/logger.ts
584
- 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:
585
-
586
- - Uses an **in-memory token bucket** per client IP
587
- - Supports configurable rate (requests/second) and burst size
588
- - Returns \`429 Too Many Requests\` with \`Retry-After\` header
589
- - Has a Redis adapter option for multi-instance deployments
590
-
591
- 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.
592
- Project: acme/alpha — Node.js + Express + PostgreSQL
593
- 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";
594
-
595
- const pool = new pg.Pool({
596
- connectionString: process.env.DATABASE_URL,
597
- max: 20,
598
- idleTimeoutMillis: 30000,
599
- });
600
-
601
- 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:
602
-
603
- 1. **A \`PoolManager\` class** that creates and caches per-tenant pools
604
- 2. **Configurable limits** per tenant (max connections, idle timeout)
605
- 3. **Health checks** with automatic pool eviction for unhealthy connections
606
- 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";
607
- src/routes/users.ts:2:import { pool } from "../db/pool.js";
608
- src/routes/register.ts:3:import { pool } from "../db/pool.js";
609
- src/routes/admin.ts:4:import { pool } from "../db/pool.js";
610
- src/services/billing.ts:2:import { pool } from "../db/pool.js";
611
- 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:
612
- 1. Create a new \`PoolManager\` abstraction
613
- 2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
614
- 3. Add middleware to extract tenant ID from the request
615
-
616
- 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"}],mz=[{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"}],hz=[{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"}],gz=[{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:""}],vz=[{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));
617
- for (const f of files) {
618
- const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);
619
- if (eslintResult.exitCode !== 0) {
620
- env.findings.push({ category: "lint", title: \`Lint issues in \${f.filename}\`, content: eslintResult.stderr });
621
- }
622
- const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);
623
- if (prettierResult.exitCode !== 0) {
624
- env.findings.push({ category: "format", title: \`Prettier issues in \${f.filename}\`, content: prettierResult.stderr });
625
- }
626
- }
627
- env.findings.push({ category: "summary", title: "Lint & format pass complete", content: \`Ran ESLint and Prettier on \${files.length} files\` });`,allowedMcpTools:[]}],yz={"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
628
- src/routes/auth.ts
629
- src/routes/billing.ts
630
- src/routes/admin.ts
631
- 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.
632
-
633
- \`\`\`typescript
634
- const router = Router();
635
- router.use(authenticate);
636
- router.use(validateBody);
637
-
638
- router.get("/", listUsers);
639
- router.post("/", createUser);
640
- router.get("/:id", getUser);
641
- router.put("/:id", updateUser);
642
- router.delete("/:id", deleteUser);
643
- \`\`\``}},{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
644
- PASS src/routes/__tests__/auth.test.ts
645
- PASS src/routes/__tests__/billing.test.ts
646
-
647
- Test Suites: 3 passed, 3 total
648
- 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 (
649
- id UUID PRIMARY KEY,
650
- name TEXT NOT NULL,
651
- email TEXT UNIQUE NOT NULL,
652
- created_at TIMESTAMPTZ DEFAULT now()
653
- );
654
-
655
- CREATE TABLE sessions (
656
- id UUID PRIMARY KEY,
657
- user_id UUID REFERENCES users(id),
658
- expires_at TIMESTAMPTZ NOT NULL
659
- );`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Me(2600),content:`I found the tables to modify:
660
- - **users**: add column \`last_login_at\`
661
- - **sessions**: add index on \`expires_at\`
662
- - **audit_log**: new table
663
-
664
- This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
665
-
666
- 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
667
- Applying 003_sessions_index.sql... done
668
- Applying 004_audit_log.sql... done
669
-
670
- 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";
671
- import type { Invoice, LineItem } from "../types/billing.js";
672
-
673
- export class BillingService {
674
- constructor(private stripe: StripeClient) {}
675
-
676
- async calculateMonthlyTotal(userId: string): Promise<number> {
677
- const invoices = await this.stripe.listInvoices(userId);
678
- return invoices.reduce((sum, inv) => sum + inv.total, 0);
679
- }
680
- }`,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";
681
- import type { Request, Response, NextFunction } from "express";
682
-
683
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
684
-
685
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
686
- const header = req.headers.authorization;
687
- if (!header?.startsWith("Bearer ")) {
688
- res.status(401).json({ error: "Missing token" });
689
- return;
690
- }
691
- try {
692
- const decoded = jwt.verify(header.slice(7), JWT_SECRET);
693
- if (decoded.exp > Date.now() / 1000) {
694
- res.status(403).json({ error: "Token expired" });
695
- return;
696
- }
697
- req.user = decoded;
698
- next();
699
- } catch {
700
- res.status(403).json({ error: "Invalid token" });
701
- }
702
- }`,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
703
-
704
- PASS src/auth.test.ts
705
- ✓ validates JWT token (12ms)
706
- ✓ rejects expired token (3ms)
707
- ✓ handles missing header (1ms)
708
-
709
- Tests: 3 passed, 3 total
710
- 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) {
711
- 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 bz({children:t}){const[s,o]=b.useState(uz),[r,c]=b.useState(fz),[d,u]=b.useState(pz),[p,m]=b.useState(void 0),[g,v]=b.useState(mz),[x,y]=b.useState(""),[S,k]=b.useState(hz),[j,N]=b.useState(Jc),[T,C]=b.useState(void 0),A=!1,[O,E]=b.useState(gz),[D,U]=b.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[B,z]=b.useState(vz),[X,$]=b.useState([]),[J]=b.useState(yz),[me,ee]=b.useState(""),[oe,R]=b.useState(ws),[G,Z]=b.useState(za),[de,W]=b.useState(void 0),[Q,ue]=b.useState(void 0),[Ce,Ue]=b.useState(""),ve=b.useRef(void 0),Se=b.useRef(0),xe=b.useRef(0),Be=b.useRef(new Set),It=b.useRef(new Map),zn=b.useRef(S);zn.current=S;const re=b.useRef(new Map),Je=b.useRef(new Map),Ut=b.useCallback(H=>(Se.current+=1,`mock-${H}-${String(Se.current).padStart(3,"0")}`),[]),se=b.useCallback(()=>{const H=ix[xe.current%ix.length];return xe.current+=1,H},[]),wt=b.useCallback((H,ne,le)=>{const fe=setTimeout(()=>{var ge;Be.current.delete(fe),le&&((ge=It.current.get(le))==null||ge.delete(fe)),H()},ne);Be.current.add(fe),le&&(It.current.has(le)||It.current.set(le,new Set),It.current.get(le).add(fe))},[]),Ot=b.useCallback(H=>{const ne=It.current.get(H);ne&&(ne.forEach(le=>{clearTimeout(le),Be.current.delete(le)}),It.current.delete(H))},[]),Bt=b.useCallback((H,ne,le)=>{c(fe=>fe.map(ge=>ge.id===H?{...ge,status:ne,...le!==void 0?{endReason:le}:{}}:ge))},[]),ze=b.useCallback(H=>{u(ne=>[...ne,H])},[]),sn=b.useCallback((H,ne,le)=>{ne.forEach((fe,ge)=>{wt(()=>{const Ge={sessionId:H,...fe.event,timestamp:new Date().toISOString()};if(ze(Ge),fe.event.eventType==="status"){const _e=tk(fe.event.content),Re=nk(fe.event.content);Bt(H,_e,Re)}ge===ne.length-1&&le&&le()},fe.delayMs,H)})},[wt,ze,Bt]),ca=b.useCallback(async(H,ne,le,fe)=>{console.log("[MockGrackle] spawn",{environmentId:H,prompt:ne,runtime:fe});const ge=Ut("sess"),Ge={id:ge,environmentId:H,runtime:fe||"claude-code",status:"running",prompt:ne,startedAt:new Date().toISOString()};c(Re=>[...Re,Ge]),m(ge);const _e=se();if(console.log(`[MockGrackle] Playing scenario: ${_e.label}`),_e.pauseForInput){const Re=_e.pauseAfterStep??_e.steps.length-1,Xe=_e.steps.slice(0,Re+1),ht=Xe.length>0?Xe[Xe.length-1].delayMs:0;sn(ge,Xe),wt(()=>{Bt(ge,"idle"),ze({sessionId:ge,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ht+ox,ge),_e.resumeSteps&&re.current.set(ge,_e.resumeSteps)}else sn(ge,_e.steps)},[Ut,se,sn,wt,Bt,ze]),is=b.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(ne=>ne.map(le=>le.latestSessionId===H&&le.status==="working"?{...le,status:"not_started"}:le))},[Ot,Bt,ze]),Wa=b.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(ne=>ne.map(le=>le.latestSessionId===H&&le.status==="working"?{...le,status:"not_started"}:le))},[Ot,Bt,ze]),da=b.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Jt=b.useCallback(async H=>{console.log("[MockGrackle] loadSessionEvents",H)},[]),Bi=b.useCallback(()=>{console.log("[MockGrackle] clearEvents"),u([])},[]),ua=b.useCallback(async(H,ne,le,fe,ge,Ge,_e,Re,Xe)=>{console.log("[MockGrackle] createWorkspace",{name:H,description:ne});const ht={id:Ut("proj"),name:H,description:ne||"",repoUrl:le||"",environmentId:fe||"",linkedEnvironmentIds:[],status:"active",workingDirectory:_e||"",useWorktrees:Ge??!0,defaultPersonaId:ge||"",tokenBudget:0,costBudgetMillicents:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Le=>[...Le,ht]),Re&&Re()},[Ut]),Xa=b.useCallback(async H=>{console.log("[MockGrackle] archiveWorkspace",H),v(ne=>ne.map(le=>le.id===H?{...le,status:"archived"}:le))},[]),ys=b.useCallback(async H=>{console.log("[MockGrackle] loadTasks",H)},[]),Li=b.useCallback(async(H,ne,le,fe,ge,Ge,_e,Re,Xe)=>{console.log("[MockGrackle] createTask",{workspaceId:H,title:ne,parentTaskId:ge}),k(ht=>{const Qe=ht.filter(Rs=>Rs.workspaceId===H).reduce((Rs,Zo)=>Math.max(Rs,Zo.sortOrder),0),rt=ge?ht.find(Rs=>Rs.id===ge):void 0;if(ge&&!rt)return console.warn("[MockGrackle] Parent task not found:",ge),ht;if(rt&&!rt.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ge),ht;const vt=rt?rt.depth+1:0,xs={id:Ut("task"),workspaceId:H,title:ne,description:le||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:fe||[],reviewNotes:void 0,sortOrder:Qe+1,createdAt:new Date().toISOString(),parentTaskId:ge||"",depth:vt,childTaskIds:[],canDecompose:_e??!ge,defaultPersonaId:Ge||"",workpad:"",tokenBudget:0,costBudgetMillicents:0};return[...ht,xs]}),Re&&Re()},[Ut]),$n=b.useCallback(async(H,ne,le,fe)=>{var ht;console.log("[MockGrackle] startTask",{taskId:H});const ge=zn.current.find(Le=>Le.id===H),Ge=(ge==null?void 0:ge.title)??"",_e=Ut("sess"),Re={id:_e,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:Ge||H,startedAt:new Date().toISOString()};c(Le=>[...Le,Re]),k(Le=>Le.map(Qe=>Qe.id===H?{...Qe,status:"working",latestSessionId:_e,branch:`mock/${H.slice(0,8)}`}:Qe));const Xe=se();if(console.log(`[MockGrackle] Playing task scenario: ${Xe.label}`),Xe.pauseForInput){const Le=Xe.pauseAfterStep??Xe.steps.length-1,Qe=Xe.steps.slice(0,Le+1),rt=Qe.length>0?Qe[Qe.length-1].delayMs:0;if(sn(_e,Qe),wt(()=>{Bt(_e,"idle"),ze({sessionId:_e,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},rt+ox,_e),Xe.resumeSteps){const vt=[...Xe.resumeSteps];re.current.set(_e,vt);const xs=vt.reduce((Rs,Zo)=>Math.max(Rs,Zo.delayMs),0);Je.current.set(_e,{taskId:H,delayAfterResume:xs+200})}}else{const Le=Xe.steps.length>0?Xe.steps[Xe.steps.length-1].delayMs:0;sn(_e,Xe.steps);const Qe=(ht=Xe.steps[Xe.steps.length-1])==null?void 0:ht.event.content;wt(()=>{Qe==="completed"?k(rt=>rt.map(vt=>vt.id===H&&vt.status==="working"?{...vt,status:"paused"}:vt)):Qe==="failed"&&k(rt=>rt.map(vt=>vt.id===H&&vt.status==="working"?{...vt,status:"failed"}:vt))},Le+100,_e)}},[Ut,se,sn,wt,Bt,ze]),De=b.useCallback(async(H,ne)=>{console.log("[MockGrackle] sendInput",{sessionId:H,text:ne}),ze({sessionId:H,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ne}`}),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 ge=[{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,ge)}const fe=Je.current.get(H);fe&&(Je.current.delete(H),wt(()=>{k(ge=>ge.map(Ge=>Ge.id===fe.taskId&&Ge.status==="working"?{...Ge,status:"paused"}:Ge))},fe.delayAfterResume,H))},[ze,Bt,sn,wt]),We=b.useCallback(async H=>{console.log("[MockGrackle] completeTask",H),k(ne=>ne.map(le=>le.id===H?{...le,status:"complete"}:le))},[]),Wt=b.useCallback(async H=>{console.log("[MockGrackle] resumeTask",H)},[]),St=b.useCallback(async(H,ne,le,fe,ge)=>{console.log("[MockGrackle] updateTask",{taskId:H,title:ne}),k(Ge=>Ge.map(_e=>_e.id===H?{..._e,title:ne.trim()||_e.title,description:le,dependsOn:fe,...ge!==void 0?{defaultPersonaId:ge}:{}}:_e))},[]),mn=b.useCallback(async H=>{console.log("[MockGrackle] deleteTask",H),k(ne=>ne.filter(le=>le.id!==H))},[]),Xt=b.useCallback(async H=>{console.log("[MockGrackle] loadFindings",H),N(Jc.filter(ne=>ne.workspaceId===H))},[]),zi=b.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),N([...Jc])},[]),$i=b.useCallback(async H=>{console.log("[MockGrackle] loadFinding",H);const ne=Jc.find(le=>le.id===H);C(ne)},[]),Pi=b.useCallback(async(H,ne,le,fe,ge)=>{console.log("[MockGrackle] postFinding",{workspaceId:H,title:ne});const Ge={id:Ut("find"),workspaceId:H,taskId:"",sessionId:"",category:fe||"general",title:ne,content:le,tags:ge||[],createdAt:new Date().toISOString()};N(_e=>[..._e,Ge])},[Ut]),Qa=b.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),ei=b.useCallback(async(H,ne,le)=>{console.log("[MockGrackle] addEnvironment",{displayName:H,adapterType:ne,adapterConfig:le})},[]),ti=b.useCallback(async(H,ne)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:H,...ne}),o(le=>le.map(fe=>fe.id!==H?fe:{...fe,...ne.displayName!==void 0?{displayName:ne.displayName}:{},...ne.adapterConfig!==void 0?{adapterConfig:JSON.stringify(ne.adapterConfig)}:{}}))},[]),bs=b.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),ni=b.useCallback(async(H,ne,le,fe,ge)=>{console.log("[MockGrackle] setToken",{name:H,tokenType:le}),E(Ge=>[...Ge.filter(Re=>Re.name!==H),{name:H,tokenType:le,envVar:fe,filePath:ge,expiresAt:""}])},[]),fa=b.useCallback(async H=>{console.log("[MockGrackle] deleteToken",H),E(ne=>ne.filter(le=>le.name!==H))},[]),_l=b.useCallback(async H=>{console.log("[MockGrackle] updateCredentialProviders",H),U(H)},[]);b.useEffect(()=>()=>{Be.current.forEach(clearTimeout),Be.current.clear()},[]);const kl=b.useMemo(()=>({connected:!0,environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:Qa,addEnvironment:ei,updateEnvironment:ti,provisionEnvironment:async(H,ne)=>{},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,ne)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:H,...ne}),v(le=>le.map(fe=>fe.id!==H?fe:{...fe,...ne.name!==void 0?{name:ne.name}:{},...ne.description!==void 0?{description:ne.description}:{},...ne.repoUrl!==void 0?{repoUrl:ne.repoUrl}:{},...ne.environmentId!==void 0?{environmentId:ne.environmentId}:{},...ne.workingDirectory!==void 0?{workingDirectory:ne.workingDirectory}:{},...ne.useWorktrees!==void 0?{useWorktrees:ne.useWorktrees}:{},...ne.defaultPersonaId!==void 0?{defaultPersonaId:ne.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},linkEnvironment:async(H,ne)=>{if(console.log("[MockGrackle] linkEnvironment",{workspaceId:H,environmentId:ne}),ne==="error-env"){y("Failed to link environment");return}y(""),v(le=>le.map(fe=>fe.id!==H||fe.linkedEnvironmentIds.includes(ne)?fe:{...fe,linkedEnvironmentIds:[...fe.linkedEnvironmentIds,ne]}))},unlinkEnvironment:async(H,ne)=>{if(console.log("[MockGrackle] unlinkEnvironment",{workspaceId:H,environmentId:ne}),ne==="error-env"){y("Failed to unlink environment");return}y(""),v(le=>le.map(fe=>fe.id!==H?fe:{...fe,linkedEnvironmentIds:fe.linkedEnvironmentIds.filter(ge=>ge!==ne)}))},linkOperationError:x,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 We(H)},completeTask:We,resumeTask:Wt,updateTask:St,deleteTask:mn,domainHook:ps},findings:{findings:j,selectedFinding:T,findingLoading:A,findingsLoading:!1,loadFindings:Xt,loadAllFindings:zi,loadFinding:$i,postFinding:Pi,domainHook:ps},tokens:{tokens:O,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:B,personasLoading:!1,createPersona:async(H,ne,le,fe,ge,Ge,_e,Re,Xe)=>{console.log("[MockGrackle] createPersona",{name:H});const ht={id:`mock-persona-${Date.now()}`,name:H,description:ne,systemPrompt:le,toolConfig:"{}",runtime:fe??"claude-code",model:ge||"",maxTurns:Ge||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:_e||"agent",script:Re||"",allowedMcpTools:Xe||[]};return z(Le=>[...Le,ht]),ht},updatePersona:async(H,ne,le,fe,ge,Ge,_e,Re,Xe,ht)=>{console.log("[MockGrackle] updatePersona",{personaId:H,name:ne});const Le=B.find(vt=>vt.id===H);if(!Le)throw new Error(`Persona not found: ${H}`);const Qe=new Date().toISOString(),rt={...Le,...ne!==void 0?{name:ne}:{},...le!==void 0?{description:le}:{},...fe!==void 0?{systemPrompt:fe}:{},...ge!==void 0?{runtime:ge}:{},...Ge!==void 0?{model:Ge}:{},..._e!==void 0?{maxTurns:_e}:{},...Re!==void 0?{type:Re}:{},...Xe!==void 0?{script:Xe}:{},...ht!==void 0?{allowedMcpTools:ht}:{},updatedAt:Qe};return z(vt=>vt.map(xs=>xs.id===H?rt:xs)),rt},deletePersona:async H=>{console.log("[MockGrackle] deletePersona",H),z(ne=>ne.filter(le=>le.id!==H))},domainHook:ps},schedules:{schedules:X,schedulesLoading:!1,createSchedule:async(H,ne,le,fe,ge,Ge)=>{console.log("[MockGrackle] createSchedule",{title:H});const _e={id:`mock-schedule-${Date.now()}`,title:H,description:ne,scheduleExpression:le,personaId:fe,environmentId:ge??"",workspaceId:Ge??"",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,ne)=>{console.log("[MockGrackle] updateSchedule",{scheduleId:H,fields:ne});let le;if($(fe=>fe.map(ge=>ge.id!==H?ge:(le={...ge,...ne,updatedAt:new Date().toISOString()},le))),!le)throw new Error(`Schedule not found: ${H}`);return le},deleteSchedule:async H=>{console.log("[MockGrackle] deleteSchedule",H),$(ne=>ne.filter(le=>le.id!==H))},domainHook:ps},knowledge:{graphData:{nodes:oe,links:G},selectedNode:de,loading:!1,selectedId:Q,searchQuery:Ce,search:async H=>{if(console.log("[MockGrackle] knowledge.search",H),!H.trim()){Ue(H);return}Ue(H);const ne=ve.current,le=ne?ws.filter(_e=>!_e.workspaceId||_e.workspaceId===ne):ws,fe=H.toLowerCase(),ge=le.filter(_e=>{var Re,Xe,ht;return _e.label.toLowerCase().includes(fe)||((Re=_e.content)==null?void 0:Re.toLowerCase().includes(fe))||((Xe=_e.tags)==null?void 0:Xe.some(Le=>Le.toLowerCase().includes(fe)))||((ht=_e.category)==null?void 0:ht.toLowerCase().includes(fe))});R(ge);const Ge=new Set(ge.map(_e=>_e.id));Z(za.filter(_e=>Ge.has(_e.source)&&Ge.has(_e.target))),ue(void 0),W(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),Ue("");const H=ve.current,ne=H?ws.filter(fe=>!fe.workspaceId||fe.workspaceId===H):ws;R(ne);const le=new Set(ne.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 ne=H in ax?ax[H]:void 0;if(ne)W(ne);else{const le=ws.find(fe=>fe.id===H);if(le){const fe=za.filter(ge=>ge.source===H||ge.target===H).map(ge=>({fromId:ge.source,toId:ge.target,type:ge.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),R(ne=>{const le=new Set(ne.map(Re=>Re.id)),fe=za.filter(Re=>Re.source===H||Re.target===H),ge=new Set;for(const Re of fe)le.has(Re.source)||ge.add(Re.source),le.has(Re.target)||ge.add(Re.target);if(ge.size===0)return ne;const Ge=ws.filter(Re=>ge.has(Re.id)),_e=new Set([...le,...ge]);return Z(Re=>{const Xe=new Set(Re.map(Le=>`${Le.source}|${Le.target}|${Le.type}`)),ht=za.filter(Le=>_e.has(Le.source)&&_e.has(Le.target)&&!Xe.has(`${Le.source}|${Le.target}|${Le.type}`));return ht.length>0?[...Re,...ht]:Re}),[...ne,...Ge]})},loadRecent:async H=>{if(console.log("[MockGrackle] knowledge.loadRecent",H),ve.current=H,H){const ne=ws.filter(fe=>!fe.workspaceId||fe.workspaceId===H);R(ne);const le=new Set(ne.map(fe=>fe.id));Z(za.filter(fe=>le.has(fe.source)&&le.has(fe.target)))}else R(ws),Z(za);Ue("")},handleEvent:()=>!1,domainHook:ps},plugins:{plugins:[{name:"core",description:"Core infrastructure",enabled:!0,required:!0,loaded:!0},{name:"orchestration",description:"Task orchestration",enabled:!0,required:!1,loaded:!0},{name:"scheduling",description:"Scheduled triggers",enabled:!0,required:!1,loaded:!0},{name:"knowledge",description:"Knowledge graph",enabled:!1,required:!1,loaded:!1}],pluginsLoading:!1,loadPlugins:async()=>{console.log("[MockGrackle] loadPlugins")},setPluginEnabled:async(H,ne)=>{console.log("[MockGrackle] setPluginEnabled",H,ne)}},appDefaultPersonaId:me,setAppDefaultPersonaId:async H=>{console.log("[MockGrackle] setAppDefaultPersonaId",H),ee(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,ne)=>{console.log(`[MockGrackle] loadUsage(${H}, ${ne})`)},refresh:da}),[s,r,d,p,J,g,x,S,j,T,O,D,B,X,me,oe,G,de,Q,Ce,ca,De,is,Wa,Jt,Bi,ua,Xa,ys,Li,$n,We,Wt,St,mn,Xt,zi,$i,Pi,Qa,ei,ti,bs,ni,fa,_l,da]);return i.jsx(fh.Provider,{value:kl,children:t})}const xz=3e3;function _z(t){const[s,o]=b.useState(!1),r=b.useRef(t.onSessionEvent);r.current=t.onSessionEvent;const c=b.useRef(t.onDomainEvent);c.current=t.onDomainEvent;const d=b.useRef(t.onConnect);d.current=t.onConnect;const u=b.useRef(t.onDisconnect);return u.current=t.onDisconnect,b.useEffect(()=>{let p=!1,m;async function g(){var v,x;if(!p){try{const y=Ye.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=jN;return}}p||(o(!1),(x=u.current)==null||x.call(u),m=setTimeout(()=>{g().catch(()=>{})},xz))}}return g().catch(()=>{}),()=>{p=!0,clearTimeout(m),o(!1)}},[]),{connected:s}}const gm=["core","orchestration","scheduling"],ik=b.createContext({pluginNames:[...gm],loading:!1,error:void 0});function kz({children:t}){const[s,o]=b.useState([...gm]),[r,c]=b.useState(!0),[d,u]=b.useState(void 0);return b.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 b.useContext(ik)}const Sz=new Set(["dashboard","chat","environments","settings"]),Tz=new Set(["tasks","findings"]),jz=new Set(["knowledge"]),ok={core:{navItems:id.filter(t=>Sz.has(t.view)),domainHookKeys:["environments","sessions","workspaces","tokens","credentials","codespaces","plugins"]},orchestration:{navItems:id.filter(t=>Tz.has(t.view)),domainHookKeys:["tasks","findings","personas","notifications"]},scheduling:{navItems:[],domainHookKeys:["schedules"]},knowledge:{navItems:id.filter(t=>jz.has(t.view)),domainHookKeys:["knowledge"]}};function wz(t){return t.flatMap(s=>{var o;return((o=ok[s])==null?void 0:o.navItems)??[]})}function Nz(t){return new Set(t.flatMap(s=>{var o;return((o=ok[s])==null?void 0:o.domainHookKeys)??[]}))}function Cz(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 Ez(t){return{sessionId:t.sessionId,eventType:jx(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function Az(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 Dz(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function Rz(t){return{claude:LT(t.claude),github:Oc(t.github),copilot:Oc(t.copilot),codex:Oc(t.codex),goose:Oc(t.goose)}}function Mz(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 Iz(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 Ds(){const[t,s]=b.useState(!1),o=b.useRef(0),r=b.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 Oz(){const[t,s]=b.useState([]),{loading:o,track:r}=Ds(),[c,d]=b.useState({}),[u,p]=b.useState(""),m=b.useCallback(()=>{p("")},[]),g=b.useCallback(async()=>{try{const C=await r(Ye.listEnvironments({}));s(C.environments.map(Cz))}catch{}},[r]),v=b.useCallback(C=>{switch(C.type){case"environment.added":return!0;case"environment.removed":{const A=C.payload.environmentId;return A&&(s(O=>O.filter(E=>E.id!==A)),d(O=>{const E={...O};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(O=>({...O,[A.environmentId]:{stage:A.stage,message:A.message,progress:A.progress}})),A.stage==="ready"){const O=A.environmentId;setTimeout(()=>{d(E=>{const D={...E};return delete D[O],D})},cx)}return!0}default:return!1}},[g]),x=b.useCallback(C=>{var A;if(C.type==="environments"){const O=Array.isArray((A=C.payload)==null?void 0:A.environments)?C.payload.environments:[];return s(O),!0}return!1},[]),y=b.useCallback(async(C,A,O)=>{p("");try{await Ye.addEnvironment({displayName:C,adapterType:A,adapterConfig:JSON.stringify(O??{})})}catch(E){p(Fr(E))}},[]),S=b.useCallback(async(C,A)=>{p("");try{await Ye.updateEnvironment({id:C,displayName:A.displayName,adapterConfig:A.adapterConfig?JSON.stringify(A.adapterConfig):void 0})}catch(O){p(Fr(O))}},[]),k=b.useCallback(async(C,A)=>{p("");try{const O=Ye.provisionEnvironment({id:C,force:A??!1});for await(const E of O)d(D=>({...D,[C]:{stage:E.stage,message:E.message,progress:E.progress}})),E.stage==="ready"&&setTimeout(()=>{d(D=>{const U={...D};return delete U[C],U})},cx)}catch(O){d(E=>{const D={...E};return delete D[C],D}),p(Fr(O))}},[]),j=b.useCallback(async C=>{p("");try{await Ye.stopEnvironment({id:C})}catch(A){p(Fr(A))}},[]),N=b.useCallback(async C=>{p("");try{await Ye.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:x,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:v}}}const zp=new Set(["pending","running","idle"]),Bz=new Set(["completed","failed","interrupted","hibernating","suspended"]),dx=["pending","running","idle"];function Lz(){const[t,s]=b.useState([]),{loading:o,track:r}=Ds(),[c,d]=b.useState([]),[u,p]=b.useState(0),[m,g]=b.useState(void 0),[v,x]=b.useState({}),y=b.useCallback(async()=>{try{const z=(await r(Ye.listSessions({}))).sessions.map(rx);s(X=>{const $=new Map(X.map(J=>[J.id,J]));return z.map(J=>{const me=$.get(J.id),ee=me==null?void 0:me.status;return!ee||ee===J.status?J:Bz.has(ee)&&zp.has(J.status)?{...J,status:ee,...me.endReason!==void 0?{endReason:me.endReason}:{}}:zp.has(ee)&&zp.has(J.status)&&dx.indexOf(ee)>dx.indexOf(J.status)?{...J,status:ee}:J})})}catch{}},[r]),S=b.useCallback(B=>{if(B.type!=="session_event")return!1;if(!Z7(B.payload))return ek("session_event","payload is not a valid SessionEvent"),!0;const z=B.payload;let X=0;if(d($=>{const J=[...$,z];return J.length>wo?(X=J.length-wo,J.slice(-wo)):J}),X>0&&p($=>$+X),z.eventType==="usage")try{const $=JSON.parse(z.content),J=Number($.input_tokens)||0,me=Number($.output_tokens)||0,ee=Number($.cost_millicents)||0;(J>0||me>0||ee>0)&&s(oe=>oe.map(R=>R.id===z.sessionId?{...R,inputTokens:(R.inputTokens??0)+J,outputTokens:(R.outputTokens??0)+me,costMillicents:(R.costMillicents??0)+ee}:R))}catch{}if(z.eventType==="status"){const $=tk(z.content),J=nk(z.content);s(me=>me.some(oe=>oe.id===z.sessionId)?me.map(oe=>oe.id===z.sessionId?{...oe,status:$,...J!==void 0?{endReason:J}:{}}:oe):[...me,{id:z.sessionId,environmentId:"",runtime:"",status:$,prompt:"",startedAt:z.timestamp,...J!==void 0?{endReason:J}:{}}])}return!0},[]),k=b.useCallback(B=>{S({type:"session_event",payload:B})},[S]),j=b.useCallback(B=>{var z,X,$,J,me;switch(B.type){case"sessions":{const ee=Array.isArray((z=B.payload)==null?void 0:z.sessions)?B.payload.sessions:[];return s(ee),!0}case"spawned":{const ee=(X=B.payload)==null?void 0:X.sessionId;return typeof ee=="string"&&ee&&g(ee),y().catch(()=>{}),!0}case"session_events":{const ee=Array.isArray(($=B.payload)==null?void 0:$.events)?B.payload.events:[];return ee.length>0&&d(ee),!0}case"task_sessions":{const ee=(J=B.payload)==null?void 0:J.taskId;if(typeof ee=="string"&&ee){const oe=Array.isArray((me=B.payload)==null?void 0:me.sessions)?B.payload.sessions:[];x(R=>({...R,[ee]:oe}))}return!0}default:return!1}},[y]),N=b.useCallback(async(B,z,X,$)=>{try{const J=await Ye.spawnAgent({environmentId:B,prompt:z,personaId:X||"",workingDirectory:$||""});g(J.id),await y()}catch{}},[y]),T=b.useCallback(async(B,z)=>{try{await Ye.sendInput({sessionId:B,text:z})}catch{}},[]),C=b.useCallback(async B=>{try{await Ye.killAgent({id:B,graceful:!1})}catch{}},[]),A=b.useCallback(async B=>{try{await Ye.killAgent({id:B,graceful:!0})}catch{}},[]),O=b.useCallback(async B=>{try{const X=(await Ye.getSessionEvents({id:B})).events.map(Ez);if(X.length>0){let $=0;d(J=>{const me=new Set;for(const R of J)R.sessionId===B&&me.add(`${R.timestamp}|${R.eventType}`);const ee=X.filter(R=>!me.has(`${R.timestamp}|${R.eventType}`)),oe=[...J,...ee].sort((R,G)=>R.sessionId!==G.sessionId?0:R.timestamp.localeCompare(G.timestamp));return oe.length>wo?($=oe.length-wo,oe.slice(-wo)):oe}),$>0&&p(J=>J+$)}}catch{}},[]),E=b.useCallback(()=>{d([]),p(0)},[]),D=b.useCallback(async B=>{try{const X=(await Ye.getTaskSessions({id:B})).sessions.map(rx);x($=>({...$,[B]:X}))}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:O,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 zz(){const[t,s]=b.useState([]),{loading:o,track:r}=Ds(),[c,d]=b.useState(!1),[u,p]=b.useState(""),m=b.useCallback(async()=>{try{const C=await r(Ye.listWorkspaces({}));s(C.workspaces.map(Az))}catch{}},[r]),g=b.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=b.useCallback(()=>{d(!1)},[]),x=b.useCallback(async(C,A,O,E,D,U,B,z,X)=>{d(!0);try{await Ye.createWorkspace({name:C,description:A||"",repoUrl:O||"",environmentId:E||"",defaultPersonaId:D||void 0,useWorktrees:U??!0,workingDirectory:B||void 0}),d(!1),z==null||z()}catch($){d(!1);const J=$ instanceof Ei?$.message:"Failed to create workspace";X==null||X(J)}},[]),y=b.useCallback(async C=>{try{await Ye.archiveWorkspace({id:C})}catch{}},[]),S=b.useCallback(async(C,A)=>{try{await Ye.updateWorkspace({id:C,...A})}catch{}},[]),k=b.useCallback(()=>{p("")},[]),j=b.useCallback(async(C,A)=>{try{p(""),await Ye.linkEnvironment({workspaceId:C,environmentId:A}),await m().catch(()=>{})}catch(O){p(ux(O))}},[m]),N=b.useCallback(async(C,A)=>{try{p(""),await Ye.unlinkEnvironment({workspaceId:C,environmentId:A}),await m().catch(()=>{})}catch(O){p(ux(O))}},[m]);return{workspaces:t,workspacesLoading:o,workspaceCreating:c,loadWorkspaces:m,createWorkspace:x,archiveWorkspace:y,updateWorkspace:S,linkEnvironment:j,unlinkEnvironment:N,linkOperationError:u,clearLinkOperationError:k,handleEvent:g,onDisconnect:v,domainHook:{onConnect:()=>m(),onDisconnect:v,handleEvent:g}}}function $z(){const[t,s]=b.useState([]),{loading:o,track:r}=Ds(),[c,d]=b.useState(void 0),u=b.useRef({}),p=b.useCallback(async E=>{try{const U=(await dn.listTasks({workspaceId:E})).tasks.map(lx);s(B=>[...B.filter(z=>z.workspaceId!==E),...U])}catch{}},[]),m=b.useCallback(async()=>{try{const D=(await r(dn.listTasks({}))).tasks.map(lx);s(U=>{const B=new Set(D.map(z=>z.id));return[...U.filter(z=>!B.has(z.id)),...D]})}catch{}},[r]),g=b.useCallback((E,D)=>{const U=B=>{clearTimeout(u.current[B]),u.current[B]=setTimeout(()=>{delete u.current[B],p(B).catch(()=>{})},200)};E?U(E):D&&s(B=>{const z=B.find(X=>X.id===D);return z!=null&&z.workspaceId?U(z.workspaceId):m().catch(()=>{}),B})},[p,m]),v=b.useCallback(E=>{const D=E.payload;switch(E.type){case"task.created":{const U=typeof D.workspaceId=="string"?D.workspaceId:"";return U&&p(U).catch(()=>{}),!0}case"task.started":{const U=typeof D.taskId=="string"?D.taskId:"",B=typeof D.sessionId=="string"?D.sessionId:"",z=typeof D.workspaceId=="string"?D.workspaceId:"";return d(X=>U&&X===U?void 0:X),B&&U&&s(X=>X.map($=>$.id===U?{...$,latestSessionId:B}:$)),g(z,U),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const U=typeof D.workspaceId=="string"?D.workspaceId:"",B=typeof D.taskId=="string"?D.taskId:"";return d(z=>B&&z===B?void 0:z),g(U,B),!0}default:return!1}},[p,g]),x=b.useCallback(()=>{d(void 0)},[]),y=b.useCallback(E=>{var D,U;if(E.type==="tasks"){const B=Array.isArray((D=E.payload)==null?void 0:D.tasks)?E.payload.tasks:[],z=typeof((U=E.payload)==null?void 0:U.workspaceId)=="string"&&E.payload.workspaceId?E.payload.workspaceId:"";return s(z?X=>[...X.filter($=>$.workspaceId!==z),...B]:X=>{const $=new Set(B.map(J=>J.id));return[...X.filter(J=>!$.has(J.id)),...B]}),!0}return!1},[]),S=b.useCallback(async(E,D,U,B,z,X,$,J,me)=>{try{await dn.createTask({workspaceId:E,title:D,description:U||"",dependsOn:B||[],parentTaskId:z||"",defaultPersonaId:X||void 0,canDecompose:$??void 0}),J==null||J()}catch(ee){const oe=ee instanceof Ei?ee.message:"Failed to create task";me==null||me(oe)}},[]),k=b.useCallback(async(E,D,U,B)=>{d(E);try{await dn.startTask({taskId:E,personaId:D||"",environmentId:U||"",notes:B||""})}catch(z){if(z instanceof Ei&&z.code===Tx.ResourceExhausted)return;d(void 0)}},[]),j=b.useCallback(async E=>{try{await dn.stopTask({id:E})}catch{}},[]),N=b.useCallback(async E=>{try{await dn.completeTask({id:E})}catch{}},[]),T=b.useCallback(async E=>{try{await dn.resumeTask({id:E})}catch{}},[]),C=b.useCallback(async(E,D,U,B,z)=>{try{await dn.updateTask({id:E,title:D,description:U,dependsOn:B,...z!==void 0?{defaultPersonaId:z}:{}})}catch{}},[]),A=b.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:x,handleLegacyMessage:y,domainHook:{onConnect:()=>m(),onDisconnect:x,handleEvent:v}}}function Pz(){const[t,s]=b.useState([]),[o,r]=b.useState(void 0),[c,d]=b.useState(!1),{loading:u,track:p}=Ds(),m=b.useCallback(async k=>{try{const j=await p(dn.queryFindings({workspaceId:k}));s(j.findings.map(Ip))}catch{}},[p]),g=b.useCallback(async()=>{try{const k=await p(dn.queryFindings({workspaceId:""}));s(k.findings.map(Ip))}catch{}},[p]),v=b.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)}},[]),x=b.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=b.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:x,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:x}}}function Uz(){const[t,s]=b.useState([]),{loading:o,track:r}=Ds(),c=b.useCallback(async()=>{try{const g=await r(Ye.listTokens({}));s(g.tokens.map(Dz))}catch{}},[r]),d=b.useCallback(g=>g.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=b.useCallback(async(g,v,x,y,S)=>{try{await Ye.setToken({name:g,value:v,type:x,envVar:y,filePath:S})}catch{}},[]),p=b.useCallback(async g=>{try{await Ye.deleteToken({name:g})}catch{}},[]);return{tokens:t,tokensLoading:o,loadTokens:c,setToken:u,deleteToken:p,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Hz(){const[t,s]=b.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:o,track:r}=Ds(),c=b.useCallback(async()=>{try{const m=await r(Ye.getCredentialProviders({}));s(Rz(m))}catch{}},[r]),d=b.useCallback(m=>m.type==="credential.providers_changed"?(Y7(m.payload)&&s(m.payload),!0):!1,[]),u=b.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:x})=>Ye.setCredentialProvider({provider:v,value:x})))},[]);return{credentialProviders:t,credentialsLoading:o,loadCredentials:c,updateCredentialProviders:u,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Vz(){const[t,s]=b.useState([]),[o,r]=b.useState(""),[c,d]=b.useState(""),[u,p]=b.useState(!1),m=b.useCallback(async()=>{try{const x=await Ye.listCodespaces({});s(x.codespaces.map(Mz)),d(x.error)}catch{}},[]),g=b.useCallback(async(x,y)=>{p(!0),r("");try{await Ye.createCodespace({repo:x,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 qz(){const[t,s]=b.useState([]),{loading:o,track:r}=Ds(),c=b.useCallback(async()=>{try{const v=await r(dn.listPersonas({}));s(v.personas.map(Op))}catch{}},[r]),d=b.useCallback(v=>{switch(v.type){case"persona.created":case"persona.updated":case"persona.deleted":return c().catch(()=>{}),!0;default:return!1}},[c]),u=b.useCallback(async(v,x,y,S,k,j,N,T,C)=>{const A=await dn.createPersona({name:v,description:x,systemPrompt:y,runtime:S||"",model:k||"",maxTurns:j||0,type:N||"agent",script:T||"",allowedMcpTools:C||[]}),O=Op(A);return s(E=>[...E.filter(D=>D.id!==O.id),O]),O},[]),p=b.useCallback(async(v,x,y,S,k,j,N,T,C,A)=>{const O={id:v};x!==void 0&&(O.name=x),y!==void 0&&(O.description=y),S!==void 0&&(O.systemPrompt=S),k!==void 0&&(O.runtime=k),j!==void 0&&(O.model=j),N!==void 0&&(O.maxTurns=N),T!==void 0&&(O.type=T),C!==void 0&&(O.script=C),A!==void 0&&(O.allowedMcpTools={tools:A});const E=await dn.updatePersona(O),D=Op(E);return s(U=>U.map(B=>B.id===D.id?D:B)),D},[]),m=b.useCallback(async v=>{await dn.deletePersona({id:v}),s(x=>x.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 Gz(){const[t,s]=b.useState([]),{loading:o,track:r}=Ds(),c=b.useRef(void 0),d=b.useCallback(async()=>{try{const x=await r(Lc.listSchedules({}));s(x.schedules.map(Bp))}catch{}},[r]),u=b.useCallback(x=>{switch(x.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=b.useCallback(async(x,y,S,k,j,N,T)=>{const C=await Lc.createSchedule({title:x,description:y,scheduleExpression:S,personaId:k,environmentId:j||"",workspaceId:N||"",parentTaskId:T||""}),A=Bp(C);return s(O=>[...O.filter(E=>E.id!==A.id),A]),A},[]),m=b.useCallback(async(x,y)=>{const S={id:x};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=b.useCallback(async x=>{await Lc.deleteSchedule({id:x}),s(y=>y.filter(S=>S.id!==x))},[]);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 Fz(t){if(t)try{return JSON.parse(t)}catch{return}}function Zz(){const[t,s]=b.useState(new Map),[o,r]=b.useState([]),[c,d]=b.useState(void 0),[u,p]=b.useState(void 0),[m,g]=b.useState(!1),[v,x]=b.useState(""),y=b.useRef(""),S=b.useCallback(async E=>{const D=E??"";y.current=D,x(""),g(!0);try{const U=await zc.listRecentKnowledgeNodes({limit:30,workspaceId:D}),B=new Map,z=[];for(const X of U.nodes)B.set(X.id,Wc(X));for(const X of U.edges)z.push(Lp(X));for(const X of z){const $=B.get(X.source);$&&($.val+=1);const J=B.get(X.target);J&&(J.val+=1)}s(B),r(z)}catch{}finally{g(!1)}},[]),k=b.useCallback(async E=>{if(E.trim()){x(E),p(void 0),d(void 0),g(!0);try{const D=await zc.searchKnowledge({query:E,limit:20,workspaceId:y.current}),U=new Map,B=[];for(const z of D.results){z.node&&U.set(z.node.id,Wc(z.node,z.edges.length));for(const X of z.edges)B.push(Lp(X))}s(U),r(B)}catch{}finally{g(!1)}}},[]),j=b.useCallback(()=>{S(y.current).catch(()=>{})},[S]),N=b.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(U=>({fromId:U.fromId,toId:U.toId,type:U.type,metadata:Fz(U.metadataJson)}))})}catch{d(void 0)}},[]),T=b.useCallback(()=>{p(void 0),d(void 0)},[]),C=b.useCallback(async E=>{try{const D=await zc.expandKnowledgeNode({id:E,depth:1});s(U=>{const B=new Map(U);for(const z of D.nodes)B.has(z.id)||B.set(z.id,Wc(z));return B}),r(U=>{const B=new Set(U.map(X=>`${X.source}:${X.target}:${X.type}`)),z=[];for(const X of D.edges){const $=Lp(X),J=`${$.source}:${$.target}:${$.type}`;B.has(J)||z.push($)}return[...U,...z]})}catch{}},[]),A=b.useCallback(E=>!1,[]),O={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:O}}function Kz(){const t=b.useRef("default");b.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 Yz(){const[t,s]=b.useState([]),{loading:o,track:r}=Ds(),c=b.useCallback(async()=>{try{const m=await r(Ye.listPlugins({}));s(m.plugins.map(g=>({name:g.name,description:g.description,enabled:g.enabled,required:g.required,loaded:g.loaded})))}catch{}},[r]),d=b.useCallback(m=>m.type==="plugin.changed"?(c().catch(()=>{}),!0):!1,[c]),u=b.useCallback(async(m,g)=>{try{const v=await Ye.setPluginEnabled({name:m,enabled:g});s(x=>x.map(y=>y.name===v.name?{...y,enabled:v.enabled}:y))}catch{}},[]);return{plugins:t,pluginsLoading:o,loadPlugins:c,setPluginEnabled:u,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Jz(){const[t,s]=b.useState(""),[o,r]=b.useState(void 0),[c,d]=b.useState({}),{pluginNames:u}=gh(),p=Nz(u),m=Oz(),g=Lz(),v=zz(),x=$z(),y=Pz(),S=Uz(),k=Hz(),j=Vz(),N=qz(),T=Gz(),C=Zz(),A=Kz(),O=Yz(),E=[...p.has("environments")?[m.domainHook]:[],...p.has("sessions")?[g.domainHook]:[],...p.has("workspaces")?[v.domainHook]:[],...p.has("tasks")?[x.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]:[],...p.has("plugins")?[O.domainHook]:[]],{connected:D}=_z({onSessionEvent:R=>{g.handleSessionEvent({sessionId:R.sessionId,eventType:jx(R.type),timestamp:R.timestamp,content:R.content,raw:R.raw||void 0})},onDomainEvent:R=>{try{const G=JSON.parse(R.payloadJson);J({id:R.id,type:R.type,timestamp:R.timestamp,payload:G})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",R.payloadJson)}},onConnect:me,onDisconnect:ee}),U="default_persona_id",B="onboarding_completed",z=b.useCallback(async R=>{const G=await Ye.setSetting({key:U,value:R});s(G.value)},[]),X=b.useCallback(async()=>{r(!0);try{await Ye.setSetting({key:B,value:"true"})}catch{}},[]),$=b.useCallback(async(R,G)=>{try{const Z=await Ye.getUsage({scope:R,id:G}),de=`${R}:${G}`;d(W=>({...W,[de]:Iz(Z)}))}catch{}},[]);function J(R){const G=R.payload.key,Z=R.payload.value;if(R.type==="setting.changed"){G===U&&s(Z??""),G===B&&r(Z==="true");return}for(const de of E)if(de.handleEvent(R))break;(R.type==="environment.removed"||R.type==="environment.changed"||R.type==="task.started")&&g.loadSessions().catch(()=>{})}async function me(){for(const R of E)R.onConnect().catch(()=>{});try{const R=await Ye.getSetting({key:U});s(R.value)}catch{}try{const R=await Ye.getSetting({key:B});r(R.value==="true")}catch{}}function ee(){E.forEach(R=>R.onDisconnect())}const oe=b.useCallback(()=>{m.loadEnvironments().catch(()=>{}),g.loadSessions().catch(()=>{}),v.loadWorkspaces().catch(()=>{}),S.loadTokens().catch(()=>{})},[m.loadEnvironments,g.loadSessions,v.loadWorkspaces,S.loadTokens]);return{connected:D,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:x.tasks,tasksLoading:x.tasksLoading,taskStartingId:x.taskStartingId,loadTasks:x.loadTasks,loadAllTasks:x.loadAllTasks,createTask:x.createTask,startTask:x.startTask,stopTask:x.stopTask,completeTask:x.completeTask,resumeTask:x.resumeTask,updateTask:x.updateTask,deleteTask:x.deleteTask,domainHook:x.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,plugins:{plugins:O.plugins,pluginsLoading:O.pluginsLoading,loadPlugins:O.loadPlugins,setPluginEnabled:O.setPluginEnabled},appDefaultPersonaId:t,setAppDefaultPersonaId:z,onboardingCompleted:o,completeOnboarding:X,usageCache:c,loadUsage:$,refresh:oe}}function Wz({children:t}){const s=Jz();return i.jsx(fh.Provider,{value:s,children:t})}function Xz(t,s){const o=b.useRef(null);b.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 Qz(t,s,o){const r=b.useRef(t);b.useEffect(()=>{t&&t!==r.current&&(o(t,"error"),s()),r.current=t},[t,s,o])}const e$={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 t$(t){return e$[t]}function n$(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=t$(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 s$(t,s){const o=b.useRef(void 0);b.useEffect(()=>{const r=o.current;o.current=t;const c=n$(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const a$="_dashboard_16pzm_1",i$="_kpiStrip_16pzm_11",o$="_kpiCard_16pzm_23",r$="_kpiValue_16pzm_68",l$="_kpiLabel_16pzm_76",c$="_bodyGrid_16pzm_84",d$="_section_16pzm_96",u$="_sectionHeader_16pzm_109",f$="_sectionIcon_16pzm_118",p$="_sectionTitle_16pzm_123",m$="_sectionCount_16pzm_131",h$="_sectionBody_16pzm_138",g$="_emptyHint_16pzm_143",v$="_sessionRow_16pzm_150",y$="_sessionPrompt_16pzm_177",b$="_sessionEnv_16pzm_186",x$="_sessionRuntime_16pzm_192",_$="_sessionStatus_16pzm_198",k$="_statusDot_16pzm_207",S$="_attentionRow_16pzm_233",T$="_attentionTitle_16pzm_259",j$="_attentionMeta_16pzm_267",w$="_reasonBadge_16pzm_274",N$="_bottomGrid_16pzm_301",C$="_envRow_16pzm_312",E$="_envName_16pzm_323",A$="_envStatusBadge_16pzm_333",D$="_workspaceRow_16pzm_369",R$="_workspaceTop_16pzm_395",M$="_workspaceName_16pzm_401",I$="_workspaceCounts_16pzm_407",O$="_progressBar_16pzm_415",B$="_progressFill_16pzm_422",pe={dashboard:a$,kpiStrip:i$,kpiCard:o$,kpiValue:r$,kpiLabel:l$,bodyGrid:c$,section:d$,sectionHeader:u$,sectionIcon:f$,sectionTitle:p$,sectionCount:m$,sectionBody:h$,emptyHint:g$,sessionRow:v$,sessionPrompt:y$,sessionEnv:b$,sessionRuntime:x$,sessionStatus:_$,statusDot:k$,attentionRow:S$,attentionTitle:T$,attentionMeta:j$,reasonBadge:w$,bottomGrid:N$,envRow:C$,envName:E$,envStatusBadge:A$,workspaceRow:D$,workspaceTop:R$,workspaceName:M$,workspaceCounts:I$,progressBar:O$,progressFill:B$};function L$(){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 z$={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 $$(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:z$,initial:"hidden",animate:"visible",custom:r,children:[i.jsx("span",{className:pe.kpiValue,children:t}),i.jsx("span",{className:pe.kpiLabel,children:s})]})}function P$(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:o,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:p,environmentsLoading:m}}=ot(),g=mt(),v=b.useRef(new Set);b.useEffect(()=>{for(const N of t)v.current.has(N.id)||(v.current.add(N.id),c(N.id).catch(()=>{}))},[t,c]);const x=b.useMemo(()=>oz(d,o,p),[d,o,p]),y=b.useMemo(()=>lz(d,p),[d,p]),S=b.useMemo(()=>rz(o,t),[o,t]),k=b.useMemo(()=>cz(t,o),[t,o,p]);return d.length===0&&o.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?i.jsx(L$,{}):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:x.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),i.jsx(Qc,{value:x.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),i.jsx(Qc,{value:x.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),i.jsx(Qc,{value:x.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:O})=>{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":$$(C,T,A,O),children:[C,"/",T,A>0&&i.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",A]}),O>0&&i.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",O]})]})]}),T>0&&i.jsx("div",{className:pe.progressBar,children:i.jsx("div",{className:pe.progressFill,style:{width:`${E}%`}})})]},N.id)})})]})]})]})}const U$="_panelContainer_1udy7_1",H$="_emptyState_1udy7_8",V$="_workspaceSummary_1udy7_17",q$="_workspaceSummaryTitle_1udy7_28",G$="_workspaceSummarySubtitle_1udy7_32",F$="_header_1udy7_36",Z$="_headerInfo_1udy7_71",K$="_headerTitle_1udy7_106",Y$="_taskStatusBadge_1udy7_128",J$="_taskBranch_1udy7_137",W$="_taskBlockedBadge_1udy7_143",X$="_tabBar_1udy7_277",Q$="_tab_1udy7_277",eP="_active_1udy7_303",tP="_eventScroll_1udy7_308",nP="_tabContent_1udy7_314",sP="_noContext_1udy7_319",aP="_overviewContent_1udy7_325",iP="_overviewDashboard_1udy7_334",oP="_overviewHero_1udy7_340",rP="_overviewSection_1udy7_347",lP="_overviewLabel_1udy7_353",cP="_envRow_1udy7_360",dP="_timeline_1udy7_366",uP="_timelineRow_1udy7_372",fP="_waitingMessage_1udy7_379",pP="_errorMessage_1udy7_383",mP="_emptyCta_1udy7_387",hP="_ctaTitle_1udy7_399",gP="_ctaDescription_1udy7_405",vP="_ctaButton_1udy7_412",yP="_workspaceHeader_1udy7_533",bP="_workspaceName_1udy7_558",xP="_workspaceMeta_1udy7_571",_P="_metaRow_1udy7_579",kP="_metaLabel_1udy7_592",SP="_metaValue_1udy7_607",TP="_archiveButton_1udy7_617",jP="_repoLink_1udy7_647",wP="_metaToggle_1udy7_657",NP="_metaToggleArrow_1udy7_678",CP="_metaToggleArrowOpen_1udy7_683",EP="_progressBarContainer_1udy7_687",AP="_progressBar_1udy7_687",DP="_progressFill_1udy7_703",RP="_progressLabel_1udy7_710",MP="_metaTimestamps_1udy7_717",IP="_metaTimestamp_1udy7_717",OP="_metaPlaceholder_1udy7_739",BP="_linkedEnvList_1udy7_744",LP="_linkedEnvChip_1udy7_750",zP="_chipDismiss_1udy7_762",$P="_linkError_1udy7_777",PP="_linkEnvSelect_1udy7_782",Y={panelContainer:U$,emptyState:H$,workspaceSummary:V$,workspaceSummaryTitle:q$,workspaceSummarySubtitle:G$,header:F$,headerInfo:Z$,headerTitle:K$,taskStatusBadge:Y$,taskBranch:J$,taskBlockedBadge:W$,tabBar:X$,tab:Q$,active:eP,eventScroll:tP,tabContent:nP,noContext:sP,overviewContent:aP,overviewDashboard:iP,overviewHero:oP,overviewSection:rP,overviewLabel:lP,envRow:cP,timeline:dP,timelineRow:uP,waitingMessage:fP,errorMessage:pP,emptyCta:mP,ctaTitle:hP,ctaDescription:gP,ctaButton:vP,workspaceHeader:yP,workspaceName:bP,workspaceMeta:xP,metaRow:_P,metaLabel:kP,metaValue:SP,archiveButton:TP,repoLink:jP,metaToggle:wP,metaToggleArrow:NP,metaToggleArrowOpen:CP,progressBarContainer:EP,progressBar:AP,progressFill:DP,progressLabel:RP,metaTimestamps:MP,metaTimestamp:IP,metaPlaceholder:OP,linkedEnvList:BP,linkedEnvChip:LP,chipDismiss:zP,linkError:$P,linkEnvSelect:PP};function UP(){return i.jsx("div",{className:Y.emptyState,children:"Select a task or click + to create one"})}function HP(){return i.jsx("div",{className:Y.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function VP(){const{workspaces:{workspaces:t},environments:{environments:s}}=ot(),o=mt(),r=s.length>0;return t.length>0?i.jsx(P$,{}):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 qP="_panelContainer_19poq_1",GP="_chatHeader_19poq_8",FP="_chatHeaderInfo_19poq_37",ZP="_emptyState_19poq_43",KP="_emptyTitle_19poq_55",YP="_emptyDescription_19poq_61",JP="_emptyHint_19poq_67",Ha={panelContainer:qP,chatHeader:GP,chatHeaderInfo:FP,emptyState:ZP,emptyTitle:KP,emptyDescription:YP,emptyHint:JP};function WP(){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 XP({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 QP(){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:x,sendInput:y,spawn:S},environments:{environments:k,provisionEnvironment:j},personas:{personas:N}}=ot(),{showToast:T}=pn(),C=b.useRef(void 0),[A,O]=b.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;b.useEffect(()=>{m(Lr).catch(()=>{})},[m]),b.useEffect(()=>{E!=null&&E.latestSessionId&&m(Lr).catch(()=>{})},[E==null?void 0:E.latestSessionId,m]),b.useEffect(()=>{D&&D.id!==C.current&&(C.current=D.id,g(D.id).catch(()=>{}))},[D==null?void 0:D.id,g]);const U=b.useMemo(()=>{if(!D)return[];const J=d.filter(me=>me.sessionId===D.id);return hh(mh(J))},[d,D==null?void 0:D.id]),B=k.find(J=>J.adapterType==="local"&&J.status==="connected"),z=D!==void 0&&D.status!=="stopped"&&D.status!=="suspended",X=(D==null?void 0:D.status)==="idle";b.useEffect(()=>{A&&D&&X&&(y(D.id,A).catch(()=>{}),O(void 0))},[A,X,D==null?void 0:D.id,y]);const $=b.useCallback((J,me,ee,oe)=>{oe&&O(oe),o(J,me,ee).catch(()=>{})},[o]);return!E&&(c||s)?i.jsx(WP,{}):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:()=>{x(D.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{x(D.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{v(D.id).catch(()=>{})}}]})]}),i.jsx(dh,{events:U,eventsDropped:u,emptyState:i.jsx(XP,{hasLocalEnvironment:!!B}),onShowToast:T}),B&&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,ee)=>{S(J,me,ee).catch(()=>{})},onStartTask:(J,me,ee)=>{o(J,me,ee).catch(()=>{})},onProvisionEnvironment:J=>{j(J).catch(()=>{})},onShowToast:T}),B&&!z&&i.jsx(al,{mode:"start",taskId:Lr,environmentId:B.id,personas:N,environments:k,onSendInput:(J,me)=>{y(J,me).catch(()=>{})},onSpawn:(J,me,ee)=>{S(J,me,ee).catch(()=>{})},onStartTask:$,onProvisionEnvironment:J=>{j(J).catch(()=>{})},onShowToast:T})]})}function eU(){const t=Q7(),[s]=Nm(),o=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=ot(),{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,x)=>{r(v,x).catch(()=>{})},onSpawn:(v,x,y)=>{c(v,x,y).catch(()=>{})},onStartTask:(v,x,y)=>{d(v,x,y).catch(()=>{})},onProvisionEnvironment:v=>{m(v).catch(()=>{})},onShowToast:g})]})}function tU(){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 nU({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 sU({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 aU(){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:x},environments:{environments:y,provisionEnvironment:S}}=ot(),{showToast:k}=pn(),j=b.useRef(void 0),N=ez(t),T=r.find(O=>O.id===t)??void 0,C=b.useMemo(()=>{const O=t?s.filter(E=>E.sessionId===t):[];return hh(mh(O))},[s,t]);if(b.useEffect(()=>{t&&t!==j.current&&(j.current=t,p(t).catch(()=>{}))},[t,p]),!T&&c)return i.jsx(tU,{});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(nU,{sessionId:t,session:T,isActive:A,onStop:()=>{u(t).catch(()=>{})},onKill:()=>{d(t).catch(()=>{})}}),i.jsx(dh,{events:C,eventsDropped:o,emptyState:i.jsx(sU,{session:T}),onShowToast:k}),A&&i.jsx(al,{mode:"send",sessionId:t,environmentId:T.environmentId,personas:x,environments:y,onSendInput:(O,E)=>{m(O,E).catch(()=>{})},onSpawn:(O,E,D)=>{g(O,E,D).catch(()=>{})},onStartTask:(O,E,D)=>{v(O,E,D).catch(()=>{})},onProvisionEnvironment:O=>{S(O).catch(()=>{})},onShowToast:k})]})}function iU(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function sa(t,s){const o=b.useRef(s);o.current=s;const{key:r,ctrl:c=!1,shift:d=!1,suppressInInputs:u=!0,enabled:p=!0}=t;b.useEffect(()=>{if(!p)return;const m=g=>{if(u&&iU(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 oU(){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 rU(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function lU(){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:x,clearLinkOperationError:y},personas:{personas:S},sessions:{sessions:k},usageCache:j,loadUsage:N}=ot(),{resolvedThemeId:T}=J1(),[C,A]=b.useState("tasks"),[O,E]=b.useState(!1),[D,U]=b.useState(null),[B,z]=b.useState(!1),X=b.useRef(void 0),$=d.find(W=>W.id===t),J=s??($==null?void 0:$.environmentId)??"",me=tz(t,J,d,c);sa({key:"1"},()=>A("graph")),sa({key:"2"},()=>A("board")),sa({key:"3"},()=>A("tasks")),b.useEffect(()=>{const W=X.current;X.current=t,!(W===void 0||W===t)&&D!==null&&U(null)},[t,D]);const ee=k.reduce((W,Q)=>W+(Q.costMillicents??0),0);b.useEffect(()=>{t&&N("workspace",t).catch(()=>{})},[t,N,ee]);const oe=t?j[`workspace:${t}`]:void 0,R=r.filter(W=>W.workspaceId===t),G=R.filter(W=>W.status==="complete").length,Z=R.length,de=Z>0?Math.round(G/Z*100):0;return!$&&u?i.jsx(oU,{}):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 Q=W.trim();if(!Q)return"Name is required";if(Q.length>$p)return`Max ${$p} characters`},maxLength:$p,fieldId:"name",activeFieldId:D,onActivate:U,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(!B),"aria-expanded":!B,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[i.jsx("span",{className:`${Y.metaToggleArrow} ${B?"":Y.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!B&&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:U,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 Q=W.trim();if(Q&&!/^https?:\/\/.+/.test(Q))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:D,onActivate:U,renderDisplay:W=>{const Q=rU(W);return Q?i.jsx("a",{className:Y.repoLink,href:Q,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(eI,{value:($==null?void 0:$.environmentId)||"",onSave:W=>{$&&W&&m($.id,{environmentId:W}).catch(()=>{})},environments:c,fieldId:"environmentId",activeFieldId:D,onActivate:U,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(Q=>Q!==$.environmentId))];return W.length===0?i.jsx("span",{className:Y.metaPlaceholder,children:"None"}):W.map(Q=>{const ue=c.find(Ce=>Ce.id===Q);return i.jsxs("span",{className:Y.linkedEnvChip,"data-testid":`linked-env-${Q}`,children:[(ue==null?void 0:ue.displayName)||Q,i.jsx("button",{className:Y.chipDismiss,onClick:()=>{v($.id,Q).catch(()=>{})},title:`Unlink ${(ue==null?void 0:ue.displayName)||Q}`,"aria-label":`Unlink ${(ue==null?void 0:ue.displayName)||Q}`,"data-testid":`unlink-env-${Q}`,children:"x"})]},Q)})})(),(()=>{const W=new Set($.linkedEnvironmentIds),Q=c.filter(ue=>ue.id!==$.environmentId&&!W.has(ue.id));return Q.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"}),Q.map(ue=>i.jsx("option",{value:ue.id,children:ue.displayName||ue.id},ue.id))]})})(),x&&i.jsxs("span",{className:Y.linkError,"data-testid":"link-operation-error",role:"alert",children:[x,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(Po,{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:U,renderDisplay:W=>{const Q=S.find(ue=>ue.id===W);if(Q)return i.jsx("span",{children:Q.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(F6,{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:U,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:[G,"/",Z]})]}),oe&&oe.costMillicents>0&&i.jsx("div",{className:Y.progressBarContainer,children:i.jsxs("span",{className:Y.progressLabel,children:["Usage: ",Ns(oe.costMillicents)," (",oe.sessionCount," session",oe.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(((oe==null?void 0:oe.inputTokens)??0)+((oe==null?void 0:oe.outputTokens)??0))," / ",Oo($.tokenBudget)]}),$.tokenBudget>0&&$.costBudgetMillicents>0&&" | ",$.costBudgetMillicents>0&&i.jsxs(i.Fragment,{children:["Cost: ",Ns((oe==null?void 0:oe.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:`${G}/${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(T7,{workspaceId:t,environmentId:J,tasks:r,sessions:k,personas:S,environments:c}),C==="graph"&&i.jsx(DN,{workspaceId:t,environmentId:J,tasks:r,resolvedThemeId:T}),i.jsx(oa,{isOpen:O,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 cU="_container_3pgew_1",dU="_header_3pgew_8",uU="_headerTitle_3pgew_35",fU="_headerActions_3pgew_44",pU="_body_3pgew_51",mU="_btnPrimary_3pgew_63",hU="_btnGhost_3pgew_94",gU="_error_3pgew_116",$a={container:cU,header:dU,headerTitle:uU,headerActions:fU,body:pU,btnPrimary:mU,btnGhost:hU,error:gU};function vU(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 yU=[{label:"Home",url:Di},{label:"New Workspace",url:void 0}];function bU(){const[t]=Nm(),s=t.get("environment")??void 0,{environments:{environments:o},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=ot(),{showToast:u}=pn(),p=mt(),[m,g]=b.useState(()=>{var N;return O7(void 0,s||((N=o[0])==null?void 0:N.id))}),[v,x]=b.useState(),[y,S]=b.useState();b.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=vU(m);if(N){x(N),S(void 0);return}x(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:yU})}),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(L7,{values:m,onChange:N=>{g(N),x(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}}=ot(),{showToast:v}=pn();return i.jsx(V1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(x,y,S,k,j,N,T,C,A)=>{u(x,y,S,k,j,N,T,C,A).catch(()=>{})},onUpdateTask:(x,y,S,k,j)=>{p(x,y,S,k,j).catch(()=>{})},onShowToast:v})}function xU(){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 Pa(){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:x,sendInput:y,spawn:S,kill:k},tasks:{tasks:j,tasksLoading:N,startTask:T,stopTask:C,resumeTask:A,deleteTask:O,createTask:E,updateTask:D},environments:{environments:U,provisionEnvironment:B},findings:{findings:z,loadFindings:X},workspaces:{workspaces:$},personas:{personas:J},usageCache:me,loadUsage:ee}=ot(),oe=b.useRef(void 0),R=b.useRef(void 0),G=b.useRef(void 0),Z=b.useRef(void 0),de=b.useRef(void 0),W=r.pathname.endsWith("/stream")?"stream":r.pathname.endsWith("/findings")?"findings":"overview",Q=r.pathname.endsWith("/edit"),[ue,Ce]=b.useState(W),[Ue,ve]=b.useState(!1),[Se,xe]=b.useState(void 0),[Be,It]=b.useState(""),[zn,re]=b.useState(Q),Je=b.useRef(W),Ut=b.useRef(Q),se=j.find(De=>De.id===t),wt=(se==null?void 0:se.workspaceId)||void 0,Ot=$.find(De=>De.id===wt);b.useEffect(()=>{W!==Je.current&&(Je.current=W,W!==ue&&Ce(W))},[W,ue]),b.useEffect(()=>{Q!==Ut.current&&(Ut.current=Q,Q!==zn&&re(Q))},[Q,zn]),b.useEffect(()=>{if(Be===""){if(Ot!=null&&Ot.environmentId)It(Ot.environmentId);else if(U.length>0){const De=U.find(We=>We.status==="connected");It((De==null?void 0:De.id)??U[0].id)}}},[Be,Ot==null?void 0:Ot.environmentId,U]);const Bt=se?v[se.id]??[]:[];let ze;Se&&Bt.some(De=>De.id===Se)?ze=Se:ze=(se==null?void 0:se.latestSessionId)||void 0;const sn=()=>{ve(!0)},ca=()=>{if(!se)return;O(se.id).catch(()=>{}),ve(!1);const De=o??(Ot==null?void 0:Ot.environmentId);c(se.workspaceId&&De?Ga(se.workspaceId,De):"/",{replace:!0})};b.useEffect(()=>{(se==null?void 0:se.id)!==R.current&&(R.current=se==null?void 0:se.id,xe(void 0),It(""),re(Q))},[se==null?void 0:se.id,Q]),b.useEffect(()=>{if(!(se!=null&&se.id))return;const De=se.id!==Z.current,We=se.latestSessionId!==de.current;(De||We)&&(Z.current=se.id,de.current=se.latestSessionId,x(se.id).catch(()=>{}))},[se==null?void 0:se.id,se==null?void 0:se.latestSessionId,x]),b.useEffect(()=>{if((se==null?void 0:se.status)!==G.current){const De=G.current===void 0;G.current=se==null?void 0:se.status;const We=(se==null?void 0:se.status)==="not_started"?"overview":(se==null?void 0:se.status)==="working"||(se==null?void 0:se.status)==="paused"?"stream":(se==null?void 0:se.status)==="complete"?"findings":void 0;We&&We!==ue&&!(De&&W!=="overview")&&Ce(We)}},[se==null?void 0:se.status,ue,W]);const is=b.useMemo(()=>new Map(j.map(De=>[De.id,De])),[j]),Wa=b.useMemo(()=>{const De=ze?u.filter(We=>We.sessionId===ze):[];return hh(mh(De))},[u,ze]),da=se?se.dependsOn.some(De=>{const We=is.get(De);return We!==void 0&&We.status!=="complete"}):!1,Jt=b.useMemo(()=>nz(t,o,$,U,is),[t,o,$,U,is]);b.useEffect(()=>{ze&&ze!==oe.current&&(oe.current=ze,g(ze).catch(()=>{}))},[ze,g]),b.useEffect(()=>{ue==="findings"&&wt&&X(wt).catch(()=>{})},[ue,wt,X]);const Bi=Bt.reduce((De,We)=>De+(We.costMillicents??0),0);b.useEffect(()=>{se&&(ee("task",se.id).catch(()=>{}),se.childTaskIds.length>0&&ee("task_tree",se.id).catch(()=>{}))},[se==null?void 0:se.id,se==null?void 0:se.childTaskIds.length,ee,Bi]);const ua=se?`task:${se.id}`:"",Xa=ua in me?me[ua]:void 0,ys=se?`task_tree:${se.id}`:"",Li=se&&se.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 sa({key:"1"},()=>$n("overview")),sa({key:"2"},()=>$n("stream")),sa({key:"3"},()=>$n("findings")),!se&&N?i.jsx(xU,{}):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:(se==null?void 0:se.title)||t}),se&&i.jsx("span",{className:Y.taskStatusBadge,"data-testid":"task-status",children:se.status}),(se==null?void 0:se.branch)&&i.jsx("span",{className:Y.taskBranch,children:se.branch}),da&&i.jsx("span",{className:Y.taskBlockedBadge,children:"blocked"})]}),se&&i.jsx(PB,{task:se,sessionId:ze,isBlocked:da,onStart:()=>{T(se.id,void 0,Be).catch(()=>{})},onResume:()=>{A(se.id).catch(()=>{})},onStop:()=>{C(se.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&&se?i.jsx(V1,{mode:"edit",taskId:se.id,workspaceId:wt,environmentId:o,tasks:j,workspaces:$,personas:J,onCreateTask:(De,We,Wt,St,mn,Xt,zi,$i,Pi)=>{E(De,We,Wt,St,mn,Xt,zi,$i,Pi).catch(()=>{})},onUpdateTask:(De,We,Wt,St,mn)=>{D(De,We,Wt,St,mn).catch(()=>{})},onEditDone:()=>{Q?c(On(se.id,void 0,s,o),{replace:!0}):re(!1)},onShowToast:d}):se?i.jsx(NL,{task:se,tasksById:is,environments:U,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(W3,{taskSessions:Bt,selectedSessionId:ze,onSelect:De=>xe(De)}),i.jsx(dh,{events:Wa,eventsDropped:p,emptyState:!ze&&se?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(se.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(U1,{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(!se||se.status!=="working"&&se.status!=="paused")return;const De=ze?m.find(We=>We.id===ze):void 0;if(!(!De||De.status==="stopped"))return i.jsx(al,{mode:"send",sessionId:De.id,environmentId:De.environmentId,personas:J,environments:U,onSendInput:(We,Wt)=>{y(We,Wt).catch(()=>{})},onSpawn:(We,Wt,St)=>{S(We,Wt,St).catch(()=>{})},onStartTask:(We,Wt,St)=>{T(We,Wt,St).catch(()=>{})},onProvisionEnvironment:We=>{B(We).catch(()=>{})},onShowToast:d})})(),se&&i.jsx(oa,{isOpen:Ue,title:"Delete Task?",description:`"${se.title}" will be permanently removed.`,onConfirm:ca,onCancel:()=>ve(!1)})]})}function _U(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:o},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:p,createCodespace:m}}=ot(),{showToast:g}=pn();return i.jsx(q1,{mode:"new",environments:t,onAddEnvironment:(v,x,y)=>{s(v,x,y).catch(()=>{})},onUpdateEnvironment:(v,x)=>{o(v,x).catch(()=>{})},onListCodespaces:()=>{p().catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(v,x)=>{m(v,x).catch(()=>{})},onShowToast:g})}function kU(){const{environmentId:t}=as(),{environments:{environments:s,addEnvironment:o,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,listCodespaces:m,createCodespace:g}}=ot(),{showToast:v}=pn();return i.jsx(q1,{mode:"edit",environmentId:t,environments:s,onAddEnvironment:(x,y,S)=>{o(x,y,S).catch(()=>{})},onUpdateEnvironment:(x,y)=>{r(x,y).catch(()=>{})},onListCodespaces:()=>{m().catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:(x,y)=>{g(x,y).catch(()=>{})},onShowToast:v})}const SU="_layout_11u79_1",TU="_content_11u79_8",jU="_tabPanel_11u79_14",sl={layout:SU,content:TU,tabPanel:jU};function wU(){const t=X7();return i.jsxs("div",{className:sl.layout,children:[i.jsx(vs,{segments:t}),i.jsx("div",{className:sl.content,children:i.jsx(Ya,{})})]})}const NU="_container_144a4_1",CU="_envHeader_144a4_6",EU="_envTitleRow_144a4_10",AU="_statusDot_144a4_16",DU="_envName_144a4_21",RU="_statusBadge_144a4_27",MU="_envMeta_144a4_33",IU="_metaTag_144a4_39",OU="_actions_144a4_51",BU="_provisionMessage_144a4_59",LU="_errorMessage_144a4_64",zU="_section_144a4_69",$U="_sectionHeader_144a4_73",PU="_cardList_144a4_121",UU="_card_144a4_121",HU="_cardHeader_144a4_138",VU="_cardName_144a4_144",qU="_cardActions_144a4_149",GU="_cardDescription_144a4_154",FU="_cardMeta_144a4_160",ZU="_repoLink_144a4_166",KU="_empty_144a4_174",YU="_errorHint_144a4_180",JU="_btnPrimary_144a4_186",WU="_btnOutline_144a4_220",XU="_btnSmall_144a4_247",QU="_btnDanger_144a4_273",Te={container:NU,envHeader:CU,envTitleRow:EU,statusDot:AU,envName:DU,statusBadge:RU,envMeta:MU,metaTag:IU,actions:OU,provisionMessage:BU,errorMessage:LU,section:zU,sectionHeader:$U,cardList:PU,card:UU,cardHeader:HU,cardName:VU,cardActions:qU,cardDescription:GU,cardMeta:FU,repoLink:ZU,empty:KU,errorHint:YU,btnPrimary:JU,btnOutline:WU,btnSmall:XU,btnDanger:QU};function e9(){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 t9={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function n9(){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:x,linkOperationError:y,clearLinkOperationError:S},sessions:{sessions:k}}=ot(),[j,N]=b.useState(!1),[T,C]=b.useState(!1),[A,O]=b.useState(void 0),E=o.find(Z=>Z.id===t);if(!E&&r)return i.jsx(e9,{});if(!t||!E)return i.jsx(ts,{to:Io,replace:!0});const D=m.filter(Z=>Z.environmentId===E.id),U=m.filter(Z=>Z.linkedEnvironmentIds.includes(E.id)&&Z.environmentId!==E.id).filter((Z,de,W)=>W.findIndex(Q=>Q.id===Z.id)===de),B=k.filter(Z=>Z.environmentId===E.id),z=B.reduce((Z,de)=>Z+(de.costMillicents??0),0),X=t9[E.status]||"var(--text-tertiary)",$=E.status==="connected",J=E.status==="connecting",me=E.status==="disconnected"||E.status==="error"||E.status==="sleeping",ee=E.id in c?c[E.id]:void 0,oe=()=>{p(E.id).catch(()=>{}),N(!1),s(Io,{replace:!0})},R=()=>{C(!1),d(E.id,!0).catch(()=>{})},G=Z=>{g(Z).catch(()=>{}),O(void 0)};return i.jsxs("div",{className:Te.container,children:[i.jsx(oa,{isOpen:j,title:"Delete Environment?",description:`"${E.displayName||E.id}" will be permanently removed along with all its data.`,onConfirm:oe,onCancel:()=>N(!1)}),i.jsx(oa,{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:R,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:X},children:"●"}),i.jsx("h2",{className:Te.envName,children:E.displayName||E.id}),i.jsx("span",{className:Te.statusBadge,style:{color:X},children:E.status})]}),i.jsxs("div",{className:Te.envMeta,children:[i.jsxs("span",{className:Te.metaTag,children:["Adapter: ",E.adapterType]}),B.length>0&&i.jsxs("span",{className:Te.metaTag,children:[B.length," session",B.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:ee!==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&&ee!==void 0&&i.jsx("span",{className:Te.provisionMessage,children:ee.message}),E.status==="error"&&(ee==null?void 0:ee.stage)==="error"&&i.jsx("span",{className:Te.errorMessage,children:ee.message}),i.jsx("button",{className:Te.btnOutline,onClick:()=>s(xN(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(s9,{workspace:Z,confirmArchiveId:A,onOpen:()=>s(Ga(Z.id,E.id)),onArchive:()=>O(Z.id),onConfirmArchive:()=>G(Z.id),onCancelArchive:()=>O(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))]})})()]}),U.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:U.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:()=>{x(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 s9({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 a9={credentials:"Credentials",personas:"Personas",schedules:"Schedules",appearance:"Appearance",about:"About",shortcuts:"Shortcuts",plugins:"Plugins"};function i9(){const s=Yt().pathname.replace(/^\/settings\/?/,"").split("/")[0],o=a9[s],r=W7(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 o9(){const{tokens:{tokens:t,setToken:s,deleteToken:o},credentials:{credentialProviders:r,updateCredentialProviders:c}}=ot(),{showToast:d}=pn();return i.jsxs(i.Fragment,{children:[i.jsx(i8,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),i.jsx(fB,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{o(u).catch(()=>{})},onShowToast:d})]})}function r9(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:o,setAppDefaultPersonaId:r}=ot(),{showToast:c}=pn(),d=mt();return i.jsx(y8,{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(kN),onNavigateToPersona:u=>d(Yx(u))})}const l9="_container_1ooin_1",c9="_form_1ooin_7",d9="_formActions_1ooin_75",u9="_editableSection_1ooin_82",f9="_defaultBadge_1ooin_93",p9="_typeToggle_1ooin_107",m9="_scriptEditor_1ooin_121",h9="_optional_1ooin_128",ms={container:l9,form:c9,formActions:d9,editableSection:u9,defaultBadge:f9,typeToggle:p9,scriptEditor:m9,optional:h9},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"}],g9="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}=ot(),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 x=[{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:x}),i.jsx(v9,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(ep)},showToast:o})]})}function v9({existing:t,isNew:s,appDefaultPersonaId:o,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=mt(),[v,x]=b.useState((t==null?void 0:t.name)??""),[y,S]=b.useState((t==null?void 0:t.description)??""),[k,j]=b.useState((t==null?void 0:t.systemPrompt)??""),[N,T]=b.useState((t==null?void 0:t.runtime)??"claude-code"),[C,A]=b.useState((t==null?void 0:t.model)??"sonnet"),[O,E]=b.useState((t==null?void 0:t.maxTurns)??0),[D,U]=b.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[B,z]=b.useState((t==null?void 0:t.script)??""),[X,$]=b.useState((t==null?void 0:t.allowedMcpTools)??[]),[J,me]=b.useState(!1),[ee,oe]=b.useState(null),[R,G]=b.useState(!!s);b.useEffect(()=>{if(!s&&t&&!R){G(!0),x(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),U(re),z(t.script||""),$(t.allowedMcpTools)}},[s,t,R]);const Z=re=>{U(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"?B.trim().length>0:!!N&&!!C),Q=s&&W,ue=!s&&o===(t==null?void 0:t.id),Ce=!s&&t&&!ue&&D==="agent"&&!!N&&!!C,Ue=(re,Je)=>{if(!re.trim())return`${Je} is required`},ve=re=>{if(re.preventDefault(),!(de||!W)){if(t){c(t.id,v,y,k,N,C,O,D,B).then(()=>{m("Persona updated","success"),p()},()=>{m("Failed to save persona","error")});return}r(v,y,k,N,C,O,D,B,X).then(Je=>{m("Persona created","success"),g(Yx(Je.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,Je,Ut,se)=>re().then(()=>{Je(),m(Ut,"success")},()=>{m(se,"error")}),Be=(re,Je)=>{if(!t)return;const Ut=re==="type"?String(Je):D,se=re==="runtime"?String(Je):re==="type"?String(Je)==="script"?"genaiscript":N==="genaiscript"?"claude-code":N:N,wt=re==="model"?String(Je):C,Ot=re==="maxTurns"?Number(Je):O,Bt=re==="systemPrompt"?String(Je):k,ze=re==="script"?String(Je):B;xe(()=>c(t.id,re==="name"?String(Je):v,re==="description"?String(Je):y,Bt,se,wt,Ot,Ut,ze),()=>{if(re==="type"){const sn=String(Je)==="script"?"script":"agent";U(sn),T(se)}re==="runtime"&&T(String(Je)),re==="name"&&x(String(Je)),re==="description"&&S(String(Je)),re==="systemPrompt"&&j(String(Je)),re==="model"&&A(String(Je)),re==="maxTurns"&&E(Number(Je)),re==="script"&&z(String(Je))},"Persona updated","Failed to update persona").catch(()=>{})},It=re=>{ve(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=>x(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:O,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:B,onChange:re=>z(re.target.value),placeholder:`script({ model: "openai:gpt-4o" });
712
-
713
- const grackle = await host.mcpServer({
714
- id: "grackle",
715
- url: env.vars.GRACKLE_MCP_URL,
716
- });
717
-
718
- $\`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:X,onChange:$})]}),i.jsxs("div",{className:ms.formActions,children:[i.jsx(tn,{type:"submit",variant:"primary",size:"md",disabled:!Q,"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=>Ue(re,"Name"),fieldId:"persona-name",activeFieldId:ee,onActivate:oe,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:ee,onActivate:oe,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Type",i.jsx(Po,{value:D,onSave:re=>{Be("type",re)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:ee,onActivate:oe,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),i.jsxs("label",{children:["Runtime",i.jsx(Po,{value:N,onSave:re=>{Be("runtime",re)},options:D==="script"?hx:mx,fieldId:"persona-runtime",activeFieldId:ee,onActivate:oe,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=>Ue(re,"Model"):void 0,fieldId:"persona-model",activeFieldId:ee,onActivate:oe,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(O),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:ee,onActivate:oe,placeholder:g9,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=>Ue(re,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:ee,onActivate:oe,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:B,onSave:re=>{Be("script",re)},validate:re=>Ue(re,"Script"),fieldId:"persona-script",activeFieldId:ee,onActivate:oe,placeholder:`script({ model: "openai:gpt-4o" });
719
-
720
- const grackle = await host.mcpServer({
721
- id: "grackle",
722
- url: env.vars.GRACKLE_MCP_URL,
723
- });
724
-
725
- $\`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:X,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(oa,{isOpen:J,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:Se,onCancel:()=>me(!1)})]})}function y9(){const{schedules:{schedules:t,deleteSchedule:s,updateSchedule:o},personas:{personas:r}}=ot(),{showToast:c}=pn(),d=mt();return i.jsx(Z8,{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(SN),onNavigateToSchedule:u=>d(Jx(u))})}const b9="_container_1g4qh_1",x9="_form_1g4qh_7",_9="_formActions_1g4qh_66",k9="_editableSection_1g4qh_73",S9="_helperText_1g4qh_84",T9="_metaSection_1g4qh_90",j9="_optional_1g4qh_108",w9="_readonlyValue_1g4qh_113",yn={container:b9,form:x9,formActions:_9,editableSection:k9,helperText:S9,metaSection:T9,optional:j9,readonlyValue:w9};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}}=ot(),x=t===void 0,y=x?void 0:r.find(k=>k.id===t);if(!x&&!c&&r.length>0&&!y)return i.jsx(ts,{to:tp,replace:!0});const S=[{label:"Settings",url:Ni},{label:"Schedules",url:tp},{label:x?"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(N9,{existing:y,isNew:x,personas:m,environments:g,workspaces:v,onCreateSchedule:d,onUpdateSchedule:u,onDeleteSchedule:p,onDone:()=>{s(tp)},showToast:o})]})}function N9({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(),[x,y]=b.useState((t==null?void 0:t.title)??""),[S,k]=b.useState((t==null?void 0:t.description)??""),[j,N]=b.useState((t==null?void 0:t.scheduleExpression)??""),[T,C]=b.useState((t==null?void 0:t.personaId)??""),[A,O]=b.useState((t==null?void 0:t.environmentId)??""),[E,D]=b.useState((t==null?void 0:t.workspaceId)??""),[U,B]=b.useState(!1),[z,X]=b.useState(null);b.useEffect(()=>{s||t&&z===null&&(y(t.title),k(t.description),N(t.scheduleExpression),C(t.personaId),O(t.environmentId),D(t.workspaceId))},[s,t,z]);const $=!s&&t===void 0,J=s&&x.trim().length>0&&j.trim().length>0&&T.length>0,me=o.map(Q=>({value:Q.id,label:Q.name})),ee=[{value:"",label:"Auto-select (first connected)"},...r.map(Q=>({value:Q.id,label:Q.displayName}))],oe=[{value:"",label:"System-level (no workspace)"},...c.map(Q=>({value:Q.id,label:Q.name}))],R=Q=>{Q.preventDefault(),J&&d(x,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")})},G=(Q,ue)=>{t&&u(t.id,{[Q]:ue}).then(()=>{g("Schedule updated","success"),Q==="title"&&y(String(ue)),Q==="description"&&k(String(ue)),Q==="scheduleExpression"&&N(String(ue)),Q==="personaId"&&C(String(ue)),Q==="environmentId"&&O(String(ue))},()=>{g("Failed to update schedule","error")})},Z=()=>{if(!t)return;const Q=!t.enabled;u(t.id,{enabled:Q}).then(()=>{g(Q?"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:R,className:yn.form,children:[i.jsx("h3",{children:"Create Schedule"}),i.jsxs("label",{children:["Title",i.jsx("input",{type:"text",value:x,onChange:Q=>y(Q.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:Q=>k(Q.target.value),placeholder:"Brief description...","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx("input",{type:"text",value:j,onChange:Q=>N(Q.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:Q=>C(Q.target.value),required:!0,"data-testid":"schedule-detail-persona",children:[i.jsx("option",{value:"",children:"Select a persona..."}),me.map(Q=>i.jsx("option",{value:Q.value,children:Q.label},Q.value))]})]}),i.jsxs("label",{children:["Environment ",i.jsx("span",{className:yn.optional,children:"(optional)"}),i.jsx("select",{value:A,onChange:Q=>O(Q.target.value),"data-testid":"schedule-detail-environment",children:ee.map(Q=>i.jsx("option",{value:Q.value,children:Q.label},Q.value))})]}),i.jsxs("label",{children:["Workspace ",i.jsx("span",{className:yn.optional,children:"(optional)"}),i.jsx("select",{value:E,onChange:Q=>D(Q.target.value),"data-testid":"schedule-detail-workspace",children:oe.map(Q=>i.jsx("option",{value:Q.value,children:Q.label},Q.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:()=>B(!0),"data-testid":"schedule-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:yn.editableSection,children:[i.jsxs("label",{children:["Title",i.jsx(Ft,{value:x,onSave:Q=>{G("title",Q)},validate:Q=>Q.trim()?void 0:"Title is required",fieldId:"schedule-title",activeFieldId:z,onActivate:X,ariaLabel:"Schedule title","data-testid":"schedule-detail-title"})]}),i.jsxs("label",{children:["Description",i.jsx(Ft,{value:S,onSave:Q=>{G("description",Q)},fieldId:"schedule-description",activeFieldId:z,onActivate:X,placeholder:"Brief description...",ariaLabel:"Schedule description","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx(Ft,{value:j,onSave:Q=>{G("scheduleExpression",Q)},validate:Q=>Q.trim()?void 0:"Schedule expression is required",fieldId:"schedule-expression",activeFieldId:z,onActivate:X,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(Po,{value:T,onSave:Q=>{G("personaId",Q)},options:me,fieldId:"schedule-persona",activeFieldId:z,onActivate:X,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(Po,{value:A,onSave:Q=>{G("environmentId",Q)},options:ee,fieldId:"schedule-environment",activeFieldId:z,onActivate:X,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(Q=>Q.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: ",Uo(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: ",Uo(t.createdAt)]})]})]}):null,i.jsx(oa,{isOpen:U,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:()=>B(!1)})]})}function C9(){const{themeId:t,resolvedThemeId:s,setTheme:o,preferSystem:r,setPreferSystem:c}=J1();return i.jsx(pB,{themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c})}function E9(){const[t,s]=b.useState(void 0);return b.useEffect(()=>{let o=!1;return(async()=>{try{const c=await Ye.getVersionStatus({});o||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{o=!0}},[]),t}function A9(){const{connected:t,environments:{environments:s},sessions:{sessions:o}}=ot(),r=E9();return i.jsxs(i.Fragment,{children:[r&&i.jsx(mO,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),i.jsx(mB,{connected:t,environments:s,sessions:o})]})}function D9(){return i.jsx(s8,{})}function R9(){const{plugins:{plugins:t,pluginsLoading:s,setPluginEnabled:o}}=ot();return i.jsx(CL,{plugins:t,loading:s,onSetPluginEnabled:(r,c)=>{o(r,c).catch(()=>{})}})}const yx=Ii();function M9(){const t=mt();return sa({key:"?"},()=>{t(TN)}),sa({key:"n"},()=>{t(yx)}),sa({key:"N"},()=>{t(yx)}),i.jsx(i.Fragment,{})}function xl(t){const s=F7();b.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function I9(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=ot(),o=b.useMemo(()=>i.jsx(q5,{workspaces:t,tasks:s}),[t,s]);return xl(o),i.jsx(Ya,{})}function O9(){const{environments:{environments:t}}=ot(),s=b.useMemo(()=>i.jsx(e5,{environments:t}),[t]);return xl(s),i.jsx(Ya,{})}function B9(){const t=b.useMemo(()=>i.jsx(X8,{}),[]);return xl(t),i.jsx(Ya,{})}function L9(){const{findings:{findings:t,loadFindings:s,loadAllFindings:o}}=ot(),{workspaceId:r,environmentId:c}=as();b.useEffect(()=>{r?s(r).catch(()=>{}):o().catch(()=>{})},[r,s,o]);const d=b.useMemo(()=>i.jsx(u5,{findings:t,workspaceId:r,environmentId:c}),[t,r,c]);return xl(d),i.jsx(Ya,{})}function z9(){const{knowledge:t,workspaces:{workspaces:s}}=ot(),o=b.useCallback(p=>{t.search(p).catch(()=>{})},[t]),r=b.useCallback(()=>{t.clearSearch()},[t]),c=b.useCallback(p=>{t.selectNode(p).catch(()=>{})},[t]),d=b.useCallback(p=>{t.loadRecent(p||void 0).catch(()=>{})},[t]),u=b.useMemo(()=>i.jsx(pI,{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 $9="_container_ce571_1",P9="_title_ce571_6",kd={container:$9,title:P9};function U9(){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}}=ot(),p=mt();b.useEffect(()=>{s&&c(s).catch(()=>{})},[s,c]);const m=b.useCallback(v=>{p(Gp(v,s,t))},[p,s,t]);if(r)return i.jsx(U9,{});const g=s&&t?sk("Findings",s,t,d,u).slice(0,-1):az();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(U1,{findings:o,onFindingClick:m})]})}const H9="_container_1wwpb_1",V9="_notFound_1wwpb_6",q9="_header_1wwpb_12",G9="_categoryBadge_1wwpb_19",F9="_title_1wwpb_28",Z9="_content_1wwpb_35",K9="_tags_1wwpb_77",Y9="_tag_1wwpb_77",J9="_meta_1wwpb_92",W9="_metaTimestamp_1wwpb_100",X9="_metaLink_1wwpb_105",vn={container:H9,notFound:V9,header:q9,categoryBadge:G9,title:F9,content:Z9,tags:K9,tag:Y9,meta:J9,metaTimestamp:W9,metaLink:X9};function xx(){const{findingId:t,environmentId:s,workspaceId:o}=as(),{findings:{selectedFinding:r,findingLoading:c,loadFinding:d},workspaces:{workspaces:u},environments:{environments:p}}=ot(),m=mt();if(b.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(x=>i.jsx("span",{className:vn.tag,children:x},x))}),i.jsxs("div",{className:vn.meta,children:[i.jsx("span",{className:vn.metaTimestamp,title:r.createdAt,children:Uo(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 Q9="_wizard_1260s_1",eH="_container_1260s_10",tH="_stepContent_1260s_19",nH="_logoArea_1260s_28",sH="_logoImage_1260s_32",aH="_heading_1260s_41",iH="_tagline_1260s_49",oH="_subtitle_1260s_56",rH="_featureList_1260s_64",lH="_runtimeGrid_1260s_89",cH="_runtimeCard_1260s_101",dH="_runtimeName_1260s_133",uH="_runtimeDescription_1260s_139",fH="_buttonRow_1260s_144",pH="_primaryButton_1260s_151",mH="_ghostButton_1260s_185",hH="_dots_1260s_213",gH="_dot_1260s_213",Ke={wizard:Q9,container:eH,stepContent:tH,logoArea:nH,logoImage:sH,heading:aH,tagline:iH,subtitle:oH,featureList:rH,runtimeGrid:lH,runtimeCard:cH,runtimeName:dH,runtimeDescription:uH,buttonRow:fH,primaryButton:pH,ghostButton:mH,dots:hH,dot:gH};function vH({onNext:t}){return i.jsxs("div",{className:Ke.stepContent,"data-testid":"setup-welcome",children:[i.jsx("div",{className:Ke.logoArea,children:i.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Ke.logoImage})}),i.jsx("h1",{className:Ke.heading,children:"Welcome to Grackle"}),i.jsx("p",{className:Ke.tagline,children:"Multi-agent orchestration for software teams"}),i.jsx("button",{type:"button",className:Ke.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function yH({onNext:t,onBack:s}){return i.jsxs("div",{className:Ke.stepContent,"data-testid":"setup-about",children:[i.jsx("h2",{className:Ke.heading,children:"What is Grackle?"}),i.jsxs("ul",{className:Ke.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:Ke.buttonRow,children:[i.jsx("button",{type:"button",className:Ke.ghostButton,onClick:s,children:"Back"}),i.jsx("button",{type:"button",className:Ke.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const bH=[{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 xH({currentRuntime:t,onFinish:s,onBack:o,finishDisabled:r}){const[c,d]=b.useState(t||"claude-code");return b.useEffect(()=>{t&&d(t)},[t]),i.jsxs("div",{className:Ke.stepContent,"data-testid":"setup-runtime",children:[i.jsx("h2",{className:Ke.heading,children:"Choose Your Runtime"}),i.jsx("p",{className:Ke.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),i.jsx("div",{className:Ke.runtimeGrid,children:bH.map(u=>i.jsxs("button",{type:"button",className:Ke.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:Ke.runtimeName,children:u.name}),i.jsx("span",{className:Ke.runtimeDescription,children:u.description})]},u.id))}),i.jsxs("div",{className:Ke.buttonRow,children:[i.jsx("button",{type:"button",className:Ke.ghostButton,onClick:o,children:"Back"}),i.jsx("button",{type:"button",className:Ke.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-runtime-next",children:"Next"})]})]})}function _H(){return typeof Notification<"u"}function kH({onFinish:t,onBack:s,finishDisabled:o}){const r=_H(),c=r&&Notification.permission!=="default";function d(){r&&Notification.requestPermission().catch(()=>{}),t()}return i.jsxs("div",{className:Ke.stepContent,"data-testid":"setup-notifications",children:[i.jsx("h2",{className:Ke.heading,children:"Stay in the Loop"}),i.jsx("p",{className:Ke.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:Ke.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:Ke.buttonRow,children:[i.jsx("button",{type:"button",className:Ke.ghostButton,onClick:s,disabled:o,children:"Back"}),!c&&r?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:Ke.ghostButton,onClick:t,disabled:o,"data-testid":"setup-notifications-skip",children:"Skip"}),i.jsx("button",{type:"button",className:Ke.primaryButton,onClick:d,disabled:o,"data-testid":"setup-notifications-enable",children:"Enable Notifications"})]}):i.jsx("button",{type:"button",className:Ke.primaryButton,onClick:t,disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const SH=4,_x={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function TH(){const{personas:{personas:t,updatePersona:s},completeOnboarding:o,onboardingCompleted:r}=ot(),{showToast:c}=pn(),d=mt(),[u,p]=b.useState(0),[m,g]=b.useState("claude-code"),[v,x]=b.useState(!1),y=t.find(j=>j.id==="claude-code"),S=b.useCallback(j=>{g(j),p(3)},[]),k=b.useCallback(()=>{const j=m;x(!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"),x(!1)})},[m,y,t,s,o,d,c]);return r===!0?i.jsx(ts,{to:"/",replace:!0}):i.jsx("div",{className:Ke.wizard,"data-testid":"setup-wizard",children:i.jsxs("div",{className:Ke.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(vH,{onNext:()=>p(1)}),u===1&&i.jsx(yH,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&i.jsx(xH,{currentRuntime:m,onFinish:S,onBack:()=>p(1),finishDisabled:!y}),u===3&&i.jsx(kH,{onFinish:k,onBack:()=>p(2),finishDisabled:v})]},u)}),i.jsx("div",{className:Ke.dots,children:Array.from({length:SH},(j,N)=>i.jsx("span",{className:Ke.dot,"data-active":N===u},N))})]})})}const jH="_root_zndgp_1",wH="_body_zndgp_7",NH="_main_zndgp_19",CH="_sidebarWrapper_zndgp_26",EH="_overlay_zndgp_51",Wr={root:jH,body:wH,main:NH,sidebarWrapper:CH,overlay:EH},AH=b.lazy(()=>YT(()=>import("./KnowledgePage-Dx7P15XQ.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 DH({tabs:t}){const{connected:s,environments:{environments:o},sessions:{sessions:r},tasks:{tasks:c}}=ot(),{toasts:d,dismissToast:u}=pn(),p=Yt(),m=G7(),g=m!==void 0,[v,x]=b.useState(!1),y=b.useCallback(()=>x(S=>!S),[]);return b.useEffect(()=>{x(!1)},[p.pathname]),b.useEffect(()=>{if(!v)return;const S=k=>{k.key==="Escape"&&x(!1)};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[v]),i.jsxs(i.Fragment,{children:[i.jsx(SI,{connected:s,environments:o,sessions:r,onToggleSidebar:g?y:void 0,sidebarOpen:v}),i.jsx(AI,{tabs:t}),i.jsxs("div",{className:Wr.body,children:[g&&i.jsx("div",{className:Wr.sidebarWrapper,"data-sidebar-open":v,children:i.jsx(BI,{content:m})}),g&&v&&i.jsx("div",{className:Wr.overlay,"data-testid":"drawer-overlay",onClick:()=>x(!1)}),i.jsxs("div",{className:Wr.main,children:[i.jsx(Ya,{}),i.jsx(qI,{sessions:r,tasks:c,environments:o})]})]}),i.jsx(sO,{toasts:d,onDismiss:u}),i.jsx(M9,{})]})}function RH(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:o,clearOperationError:r},tasks:{tasks:c},connected:d,onboardingCompleted:u}=ot(),{pluginNames:p}=gh(),{showToast:m}=pn();Xz(s,m),s$(c,m),Qz(o,r,m);const g=mt(),v=Yt();if(b.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 x=wz(p);return i.jsx(q7,{children:i.jsxs("div",{className:Wr.root,children:[rk&&i.jsx(eC,{}),i.jsx(DH,{tabs:x})]})})}function Pp(){const{workspaceId:t}=as(),{workspaces:{workspaces:s}}=ot(),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 MH(){const{pluginNames:t}=gh(),s=t.includes("orchestration"),o=t.includes("knowledge");return i.jsxs(zw,{children:[i.jsx(Ne,{path:"setup",element:i.jsx(TH,{})}),i.jsxs(Ne,{element:i.jsx(RH,{}),children:[i.jsx(Ne,{index:!0,element:i.jsx(VP,{})}),i.jsx(Ne,{path:"chat",element:i.jsx(QP,{})}),i.jsx(Ne,{path:"sessions/new",element:i.jsx(eU,{})}),i.jsx(Ne,{path:"sessions/:sessionId",element:i.jsx(aU,{})}),o&&i.jsx(Ne,{element:i.jsx(z9,{}),children:i.jsx(Ne,{path:"knowledge",element:i.jsx(b.Suspense,{fallback:i.jsx(A1,{}),children:i.jsx(AH,{})})})}),s&&i.jsxs(Ne,{element:i.jsx(I9,{}),children:[i.jsx(Ne,{path:"tasks",element:i.jsx(UP,{})}),i.jsx(Ne,{path:"tasks/new",element:i.jsx(px,{})}),i.jsx(Ne,{path:"tasks/:taskId",element:i.jsx(Pa,{})}),i.jsx(Ne,{path:"tasks/:taskId/edit",element:i.jsx(Pa,{})}),i.jsx(Ne,{path:"tasks/:taskId/stream",element:i.jsx(Pa,{})}),i.jsx(Ne,{path:"tasks/:taskId/findings",element:i.jsx(Pa,{})})]}),s&&i.jsxs(Ne,{element:i.jsx(L9,{}),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(O9,{}),children:[i.jsx(Ne,{path:"workspaces",element:i.jsx(ts,{to:"/environments",replace:!0})}),i.jsx(Ne,{path:"workspaces/new",element:i.jsx(bU,{})}),i.jsx(Ne,{path:"workspaces/:workspaceId",element:i.jsx(Pp,{})}),i.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId",element:i.jsx(Pp,{})}),i.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:i.jsx(Pp,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId",element:i.jsx(lU,{})}),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(Pa,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:i.jsx(Pa,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:i.jsx(Pa,{})}),i.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:i.jsx(Pa,{})}),i.jsxs(Ne,{path:"environments",element:i.jsx(wU,{}),children:[i.jsx(Ne,{index:!0,element:i.jsx(HP,{})}),i.jsx(Ne,{path:"new",element:i.jsx(_U,{})}),i.jsx(Ne,{path:":environmentId",element:i.jsx(n9,{})}),i.jsx(Ne,{path:":environmentId/edit",element:i.jsx(kU,{})})]})]}),i.jsx(Ne,{element:i.jsx(B9,{}),children:i.jsxs(Ne,{path:"settings",element:i.jsx(i9,{}),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(o9,{})}),i.jsx(Ne,{path:"tokens",element:i.jsx(ts,{to:"../credentials",replace:!0})}),i.jsx(Ne,{path:"personas",element:i.jsx(r9,{})}),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(y9,{})}),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(C9,{})}),i.jsx(Ne,{path:"shortcuts",element:i.jsx(D9,{})}),i.jsx(Ne,{path:"plugins",element:i.jsx(R9,{})}),i.jsx(Ne,{path:"about",element:i.jsx(A9,{})})]})}),i.jsx(Ne,{path:"*",element:i.jsx(ts,{to:"/",replace:!0})})]})]})}const IH=1e4;function OH(){const{onboardingCompleted:t}=ot(),[s,o]=b.useState(!1);b.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>o(!0),IH);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(cN,{basename:"/".replace(/\/$/,""),children:i.jsx(MH,{})})},"app")})}function BH(){const t=rk?bz:Wz;return i.jsx(kz,{children:i.jsx(V7,{children:i.jsx($7,{children:i.jsx(t,{children:i.jsx(OH,{})})})})})}FT.createRoot(document.getElementById("root")).render(i.jsx(b.StrictMode,{children:i.jsx(BH,{})}));export{vs as B,Xx as K,ot as a,Gp as f,Cm as s,On as t,mt as u};