@grackle-ai/web 0.91.2 → 0.91.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,715 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-gigL5i5c.js","assets/dagview-tHPW3Rz3.js","assets/grpc-CbbuZL-C.js","assets/markdown-Yr3vTPLR.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
+ import{r as QS,a as eT,b as y,j as o,d as Z0,H as K0,P as Y0,i as tT,B as nT,c as sT,C as aT,M as iT,e as oT}from"./dagview-tHPW3Rz3.js";import{c as rT,a as lT,G as cT,f as dT,M as uT,A as o_,D as r_,W as fT,O as pT,b as mT,C as ol,d as hT,e as l_,w as gT,t as vT,p as Nc,g as yT,R as Ar,S as J0}from"./grpc-CbbuZL-C.js";import{v as bT,r as _T,t as Cc,i as xT,f as kT,M as pd,a as md}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 i(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(c){if(c.ep)return;c.ep=!0;const d=i(c);fetch(c.href,d)}})();var Bf={exports:{}},Dr={},zf={exports:{}},Uf={};/**
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 W0;function ST(){return W0||(W0=1,(function(t){function s(A,F){var oe=A.length;A.push(F);e:for(;0<oe;){var pe=oe-1>>>1,de=A[pe];if(0<c(de,F))A[pe]=F,A[oe]=de,oe=pe;else break e}}function i(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var F=A[0],oe=A.pop();if(oe!==F){A[0]=oe;e:for(var pe=0,de=A.length,Oe=de>>>1;pe<Oe;){var ke=2*(pe+1)-1,Ce=A[ke],ze=ke+1,ue=A[ze];if(0>c(Ce,oe))ze<de&&0>c(ue,Ce)?(A[pe]=ue,A[ze]=oe,pe=ze):(A[pe]=Ce,A[ke]=oe,pe=ke);else if(ze<de&&0>c(ue,oe))A[pe]=ue,A[ze]=oe,pe=ze;else break e}}return F}function c(A,F){var oe=A.sortIndex-F.sortIndex;return oe!==0?oe:A.id-F.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var u=Date,p=u.now();t.unstable_now=function(){return u.now()-p}}var m=[],g=[],v=1,b=null,_=3,S=!1,k=!1,w=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function L(A){for(var F=i(g);F!==null;){if(F.callback===null)r(g);else if(F.startTime<=A)r(g),F.sortIndex=F.expirationTime,s(m,F);else break;F=i(g)}}function E(A){if(w=!1,L(A),!k)if(i(m)!==null)k=!0,I||(I=!0,P());else{var F=i(g);F!==null&&re(E,F.startTime-A)}}var I=!1,O=-1,z=5,$=-1;function X(){return N?!0:!(t.unstable_now()-$<z)}function te(){if(N=!1,I){var A=t.unstable_now();$=A;var F=!0;try{e:{k=!1,w&&(w=!1,C(O),O=-1),S=!0;var oe=_;try{t:{for(L(A),b=i(m);b!==null&&!(b.expirationTime>A&&X());){var pe=b.callback;if(typeof pe=="function"){b.callback=null,_=b.priorityLevel;var de=pe(b.expirationTime<=A);if(A=t.unstable_now(),typeof de=="function"){b.callback=de,L(A),F=!0;break t}b===i(m)&&r(m),L(A)}else r(m);b=i(m)}if(b!==null)F=!0;else{var Oe=i(g);Oe!==null&&re(E,Oe.startTime-A),F=!1}}break e}finally{b=null,_=oe,S=!1}F=void 0}}finally{F?P():I=!1}}}var P;if(typeof D=="function")P=function(){D(te)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,K=ae.port2;ae.port1.onmessage=te,P=function(){K.postMessage(null)}}else P=function(){T(te,0)};function re(A,F){O=T(function(){A(t.unstable_now())},F)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(A){A.callback=null},t.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<A?Math.floor(1e3/A):5},t.unstable_getCurrentPriorityLevel=function(){return _},t.unstable_next=function(A){switch(_){case 1:case 2:case 3:var F=3;break;default:F=_}var oe=_;_=F;try{return A()}finally{_=oe}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(A,F){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var oe=_;_=A;try{return F()}finally{_=oe}},t.unstable_scheduleCallback=function(A,F,oe){var pe=t.unstable_now();switch(typeof oe=="object"&&oe!==null?(oe=oe.delay,oe=typeof oe=="number"&&0<oe?pe+oe:pe):oe=pe,A){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=oe+de,A={id:v++,callback:F,priorityLevel:A,startTime:oe,expirationTime:de,sortIndex:-1},oe>pe?(A.sortIndex=oe,s(g,A),i(m)===null&&A===i(g)&&(w?(C(O),O=-1):w=!0,re(E,oe-pe))):(A.sortIndex=de,s(m,A),k||S||(k=!0,I||(I=!0,P()))),A},t.unstable_shouldYield=X,t.unstable_wrapCallback=function(A){var F=_;return function(){var oe=_;_=F;try{return A.apply(this,arguments)}finally{_=oe}}}})(Uf)),Uf}var X0;function TT(){return X0||(X0=1,zf.exports=ST()),zf.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 Q0;function wT(){if(Q0)return Dr;Q0=1;var t=TT(),s=QS(),i=eT();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 x=!1,j=f.child;j;){if(j===a){x=!0,a=f,l=h;break}if(j===l){x=!0,l=f,a=h;break}j=j.sibling}if(!x){for(j=h.child;j;){if(j===a){x=!0,a=h,l=f;break}if(j===l){x=!0,l=h,a=f;break}j=j.sibling}if(!x)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),D=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),X=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function P(e){return e===null||typeof e!="object"?null:(e=te&&e[te]||e["@@iterator"],typeof e=="function"?e:null)}var ae=Symbol.for("react.client.reference");function K(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case T:return"Profiler";case N:return"StrictMode";case E:return"Suspense";case I:return"SuspenseList";case $:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case D:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case L:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return n=e.displayName||null,n!==null?n:K(e.type)||"Memo";case z:n=e._payload,e=e._init;try{return K(e(n))}catch{}}return null}var re=Array.isArray,A=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},pe=[],de=-1;function Oe(e){return{current:e}}function ke(e){0>de||(e.current=pe[de],pe[de]=null,de--)}function Ce(e,n){de++,pe[de]=e.current,e.current=n}var ze=Oe(null),ue=Oe(null),_e=Oe(null),me=Oe(null);function Be(e,n){switch(Ce(_e,n),Ce(ue,e),Ce(ze,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?g0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=g0(n),e=v0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ke(ze),Ce(ze,e)}function mt(){ke(ze),ke(ue),ke(_e)}function vn(e){e.memoizedState!==null&&Ce(me,e);var n=ze.current,a=v0(n,e.type);n!==a&&(Ce(ue,e),Ce(ze,a))}function se(e){ue.current===e&&(ke(ze),ke(ue)),me.current===e&&(ke(me),jr._currentValue=oe)}var qe,Nt;function Y(e){if(qe===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);qe=n&&n[1]||"",Nt=-1<a.stack.indexOf(`
19
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
+ `+qe+e+Nt}var wt=!1;function Vt(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 ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(Z){var G=Z}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(Z){G=Z}e.call(ee.prototype)}}else{try{throw Error()}catch(Z){G=Z}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(Z){if(Z&&G&&typeof Z.stack=="string")return[Z.stack,G.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),x=h[0],j=h[1];if(x&&j){var R=x.split(`
21
+ `),q=j.split(`
22
+ `);for(f=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;f<q.length&&!q[f].includes("DetermineComponentFrameRoot");)f++;if(l===R.length||f===q.length)for(l=R.length-1,f=q.length-1;1<=l&&0<=f&&R[l]!==q[f];)f--;for(;1<=l&&0<=f;l--,f--)if(R[l]!==q[f]){if(l!==1||f!==1)do if(l--,f--,0>f||R[l]!==q[f]){var W=`
23
+ `+R[l].replace(" at new "," at ");return e.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",e.displayName)),W}while(1<=l&&0<=f);break}}}finally{wt=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Y(a):""}function es(e,n){switch(e.tag){case 26:case 27:case 5:return Y(e.type);case 16:return Y("Lazy");case 13:return e.child!==n&&n!==null?Y("Suspense Fallback"):Y("Suspense");case 19:return Y("SuspenseList");case 0:case 15:return Vt(e.type,!1);case 11:return Vt(e.type.render,!1);case 1:return Vt(e.type,!0);case 31:return Y("Activity");default:return""}}function ft(e){try{var n="",a=null;do n+=es(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
24
+ Error generating stack: `+l.message+`
25
+ `+l.stack}}var hs=Object.prototype.hasOwnProperty,aa=t.unstable_scheduleCallback,ts=t.unstable_cancelCallback,Ga=t.unstable_shouldYield,ia=t.unstable_requestPaint,Kt=t.unstable_now,Ai=t.unstable_getCurrentPriorityLevel,oa=t.unstable_ImmediatePriority,Fa=t.unstable_UserBlockingPriority,ns=t.unstable_NormalPriority,Di=t.unstable_LowPriority,Bn=t.unstable_IdlePriority,Ae=t.log,Ke=t.unstable_setDisableYieldValue,Yt=null,kt=null;function un(e){if(typeof Ae=="function"&&Ke(e),kt&&typeof kt.setStrictMode=="function")try{kt.setStrictMode(Yt,e)}catch{}}var Jt=Math.clz32?Math.clz32:Ii,Ri=Math.log,Mi=Math.LN2;function Ii(e){return e>>>=0,e===0?32:31-(Ri(e)/Mi|0)|0}var Za=256,Ka=262144,Ya=4194304;function Ns(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 H(e,n,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var j=l&134217727;return j!==0?(l=j&~h,l!==0?f=Ns(l):(x&=j,x!==0?f=Ns(x):a||(a=j&~e,a!==0&&(f=Ns(a))))):(j=l&~h,j!==0?f=Ns(j):x!==0?f=Ns(x):a||(a=l&~e,a!==0&&(f=Ns(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 ne(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function le(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function fe(){var e=Ya;return Ya<<=1,(Ya&62914560)===0&&(Ya=4194304),e}function he(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Pe(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Se(e,n,a,l,f,h){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var j=e.entanglements,R=e.expirationTimes,q=e.hiddenUpdates;for(a=x&~a;0<a;){var W=31-Jt(a),ee=1<<W;j[W]=0,R[W]=-1;var G=q[W];if(G!==null)for(q[W]=null,W=0;W<G.length;W++){var Z=G[W];Z!==null&&(Z.lane&=-536870913)}a&=~ee}l!==0&&Me(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function Me(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Jt(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Ye(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-Jt(a),f=1<<l;f&n|e[l]&n&&(e[l]|=n),a&=~f}}function ct(e,n){var a=n&-n;return a=(a&42)!==0?1:Je(a),(a&(e.suspendedLanes|n))!==0?0:a}function Je(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 qt(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function tn(){var e=F.p;return e!==0?e:(e=window.event,e===void 0?32:$0(e.type))}function Mt(e,n){var a=F.p;try{return F.p=e,n()}finally{F.p=a}}var fn=Math.random().toString(36).slice(2),ht="__reactFiber$"+fn,Wt="__reactProps$"+fn,Oi="__reactContainer$"+fn,Nd="__reactEvents$"+fn,H1="__reactListeners$"+fn,V1="__reactHandles$"+fn,sh="__reactResources$"+fn,Po="__reactMarker$"+fn;function Cd(e){delete e[ht],delete e[Wt],delete e[Nd],delete e[H1],delete e[V1]}function Li(e){var n=e[ht];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Oi]||a[ht]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=T0(e);e!==null;){if(a=e[ht])return a;e=T0(e)}return n}e=a,a=e.parentNode}return null}function Bi(e){if(e=e[ht]||e[Oi]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Ho(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function zi(e){var n=e[sh];return n||(n=e[sh]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Xt(e){e[Po]=!0}var ah=new Set,ih={};function Ja(e,n){Ui(e,n),Ui(e+"Capture",n)}function Ui(e,n){for(ih[e]=n,e=0;e<n.length;e++)ah.add(n[e])}var q1=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]*$"),oh={},rh={};function G1(e){return hs.call(rh,e)?!0:hs.call(oh,e)?!1:q1.test(e)?rh[e]=!0:(oh[e]=!0,!1)}function hl(e,n,a){if(G1(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 gl(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 Cs(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 zn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function lh(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function F1(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(x){a=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Ed(e){if(!e._valueTracker){var n=lh(e)?"checked":"value";e._valueTracker=F1(e,n,""+e[n])}}function ch(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=lh(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function vl(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 Z1=/[\n"\\]/g;function Un(e){return e.replace(Z1,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Ad(e,n,a,l,f,h,x,j){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+zn(n)):e.value!==""+zn(n)&&(e.value=""+zn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Dd(e,x,zn(n)):a!=null?Dd(e,x,zn(a)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.name=""+zn(j):e.removeAttribute("name")}function dh(e,n,a,l,f,h,x,j){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)){Ed(e);return}a=a!=null?""+zn(a):"",n=n!=null?""+zn(n):a,j||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=j?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),Ed(e)}function Dd(e,n,a){n==="number"&&vl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function $i(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=""+zn(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 uh(e,n,a){if(n!=null&&(n=""+zn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+zn(a):""}function fh(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(r(92));if(re(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=zn(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Ed(e)}function Pi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var K1=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 ph(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||K1.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function mh(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&&ph(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&ph(e,h,n[h])}function Rd(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 Y1=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"]]),J1=/^[\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 yl(e){return J1.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Es(){}var Md=null;function Id(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Hi=null,Vi=null;function hh(e){var n=Bi(e);if(n&&(e=n.stateNode)){var a=e[Wt]||null;e:switch(e=n.stateNode,n.type){case"input":if(Ad(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[Wt]||null;if(!f)throw Error(r(90));Ad(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&&ch(l)}break e;case"textarea":uh(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&$i(e,!!a.multiple,n,!1)}}}var Od=!1;function gh(e,n,a){if(Od)return e(n,a);Od=!0;try{var l=e(n);return l}finally{if(Od=!1,(Hi!==null||Vi!==null)&&(ic(),Hi&&(n=Hi,e=Vi,Vi=Hi=null,hh(n),e)))for(n=0;n<e.length;n++)hh(e[n])}}function Vo(e,n){var a=e.stateNode;if(a===null)return null;var l=a[Wt]||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 As=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ld=!1;if(As)try{var qo={};Object.defineProperty(qo,"passive",{get:function(){Ld=!0}}),window.addEventListener("test",qo,qo),window.removeEventListener("test",qo,qo)}catch{Ld=!1}var ra=null,Bd=null,bl=null;function vh(){if(bl)return bl;var e,n=Bd,a=n.length,l,f="value"in ra?ra.value:ra.textContent,h=f.length;for(e=0;e<a&&n[e]===f[e];e++);var x=a-e;for(l=1;l<=x&&n[a-l]===f[h-l];l++);return bl=f.slice(e,1<l?1-l:void 0)}function _l(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 xl(){return!0}function yh(){return!1}function yn(e){function n(a,l,f,h,x){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var j in e)e.hasOwnProperty(j)&&(a=e[j],this[j]=a?a(h):h[j]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?xl:yh,this.isPropagationStopped=yh,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=xl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=xl)},persist:function(){},isPersistent:xl}),n}var Wa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},kl=yn(Wa),Go=b({},Wa,{view:0,detail:0}),W1=yn(Go),zd,Ud,Fo,Sl=b({},Go,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pd,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!==Fo&&(Fo&&e.type==="mousemove"?(zd=e.screenX-Fo.screenX,Ud=e.screenY-Fo.screenY):Ud=zd=0,Fo=e),zd)},movementY:function(e){return"movementY"in e?e.movementY:Ud}}),bh=yn(Sl),X1=b({},Sl,{dataTransfer:0}),Q1=yn(X1),ek=b({},Go,{relatedTarget:0}),$d=yn(ek),tk=b({},Wa,{animationName:0,elapsedTime:0,pseudoElement:0}),nk=yn(tk),sk=b({},Wa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ak=yn(sk),ik=b({},Wa,{data:0}),_h=yn(ik),ok={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rk={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"},lk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ck(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=lk[e])?!!n[e]:!1}function Pd(){return ck}var dk=b({},Go,{key:function(e){if(e.key){var n=ok[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=_l(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?rk[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pd,charCode:function(e){return e.type==="keypress"?_l(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?_l(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),uk=yn(dk),fk=b({},Sl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),xh=yn(fk),pk=b({},Go,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pd}),mk=yn(pk),hk=b({},Wa,{propertyName:0,elapsedTime:0,pseudoElement:0}),gk=yn(hk),vk=b({},Sl,{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}),yk=yn(vk),bk=b({},Wa,{newState:0,oldState:0}),_k=yn(bk),xk=[9,13,27,32],Hd=As&&"CompositionEvent"in window,Zo=null;As&&"documentMode"in document&&(Zo=document.documentMode);var kk=As&&"TextEvent"in window&&!Zo,kh=As&&(!Hd||Zo&&8<Zo&&11>=Zo),Sh=" ",Th=!1;function wh(e,n){switch(e){case"keyup":return xk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qi=!1;function Sk(e,n){switch(e){case"compositionend":return jh(n);case"keypress":return n.which!==32?null:(Th=!0,Sh);case"textInput":return e=n.data,e===Sh&&Th?null:e;default:return null}}function Tk(e,n){if(qi)return e==="compositionend"||!Hd&&wh(e,n)?(e=vh(),bl=Bd=ra=null,qi=!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 kh&&n.locale!=="ko"?null:n.data;default:return null}}var wk={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 Nh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!wk[e.type]:n==="textarea"}function Ch(e,n,a,l){Hi?Vi?Vi.push(l):Vi=[l]:Hi=l,n=fc(n,"onChange"),0<n.length&&(a=new kl("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Ko=null,Yo=null;function jk(e){d0(e,0)}function Tl(e){var n=Ho(e);if(ch(n))return e}function Eh(e,n){if(e==="change")return n}var Ah=!1;if(As){var Vd;if(As){var qd="oninput"in document;if(!qd){var Dh=document.createElement("div");Dh.setAttribute("oninput","return;"),qd=typeof Dh.oninput=="function"}Vd=qd}else Vd=!1;Ah=Vd&&(!document.documentMode||9<document.documentMode)}function Rh(){Ko&&(Ko.detachEvent("onpropertychange",Mh),Yo=Ko=null)}function Mh(e){if(e.propertyName==="value"&&Tl(Yo)){var n=[];Ch(n,Yo,e,Id(e)),gh(jk,n)}}function Nk(e,n,a){e==="focusin"?(Rh(),Ko=n,Yo=a,Ko.attachEvent("onpropertychange",Mh)):e==="focusout"&&Rh()}function Ck(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Tl(Yo)}function Ek(e,n){if(e==="click")return Tl(n)}function Ak(e,n){if(e==="input"||e==="change")return Tl(n)}function Dk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var wn=typeof Object.is=="function"?Object.is:Dk;function Jo(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(!hs.call(n,f)||!wn(e[f],n[f]))return!1}return!0}function Ih(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Oh(e,n){var a=Ih(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=Ih(a)}}function Lh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Lh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Bh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=vl(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=vl(e.document)}return n}function Gd(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 Rk=As&&"documentMode"in document&&11>=document.documentMode,Gi=null,Fd=null,Wo=null,Zd=!1;function zh(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Zd||Gi==null||Gi!==vl(l)||(l=Gi,"selectionStart"in l&&Gd(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}),Wo&&Jo(Wo,l)||(Wo=l,l=fc(Fd,"onSelect"),0<l.length&&(n=new kl("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=Gi)))}function Xa(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Fi={animationend:Xa("Animation","AnimationEnd"),animationiteration:Xa("Animation","AnimationIteration"),animationstart:Xa("Animation","AnimationStart"),transitionrun:Xa("Transition","TransitionRun"),transitionstart:Xa("Transition","TransitionStart"),transitioncancel:Xa("Transition","TransitionCancel"),transitionend:Xa("Transition","TransitionEnd")},Kd={},Uh={};As&&(Uh=document.createElement("div").style,"AnimationEvent"in window||(delete Fi.animationend.animation,delete Fi.animationiteration.animation,delete Fi.animationstart.animation),"TransitionEvent"in window||delete Fi.transitionend.transition);function Qa(e){if(Kd[e])return Kd[e];if(!Fi[e])return e;var n=Fi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Uh)return Kd[e]=n[a];return e}var $h=Qa("animationend"),Ph=Qa("animationiteration"),Hh=Qa("animationstart"),Mk=Qa("transitionrun"),Ik=Qa("transitionstart"),Ok=Qa("transitioncancel"),Vh=Qa("transitionend"),qh=new Map,Yd="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(" ");Yd.push("scrollEnd");function ss(e,n){qh.set(e,n),Ja(n,[e])}var wl=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)},$n=[],Zi=0,Jd=0;function jl(){for(var e=Zi,n=Jd=Zi=0;n<e;){var a=$n[n];$n[n++]=null;var l=$n[n];$n[n++]=null;var f=$n[n];$n[n++]=null;var h=$n[n];if($n[n++]=null,l!==null&&f!==null){var x=l.pending;x===null?f.next=f:(f.next=x.next,x.next=f),l.pending=f}h!==0&&Gh(a,f,h)}}function Nl(e,n,a,l){$n[Zi++]=e,$n[Zi++]=n,$n[Zi++]=a,$n[Zi++]=l,Jd|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Wd(e,n,a,l){return Nl(e,n,a,l),Cl(e)}function ei(e,n){return Nl(e,null,null,n),Cl(e)}function Gh(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-Jt(a),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),h):null}function Cl(e){if(50<br)throw br=0,rf=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ki={};function Lk(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 jn(e,n,a,l){return new Lk(e,n,a,l)}function Xd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ds(e,n){var a=e.alternate;return a===null?(a=jn(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 Fh(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 El(e,n,a,l,f,h){var x=0;if(l=e,typeof e=="function")Xd(e)&&(x=1);else if(typeof e=="string")x=PS(e,a,ze.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=jn(31,a,n,f),e.elementType=$,e.lanes=h,e;case w:return ti(a.children,f,h,n);case N:x=8,f|=24;break;case T:return e=jn(12,a,n,f|2),e.elementType=T,e.lanes=h,e;case E:return e=jn(13,a,n,f),e.elementType=E,e.lanes=h,e;case I:return e=jn(19,a,n,f),e.elementType=I,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:x=10;break e;case C:x=9;break e;case L:x=11;break e;case O:x=14;break e;case z:x=16,l=null;break e}x=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=jn(x,a,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function ti(e,n,a,l){return e=jn(7,e,l,n),e.lanes=a,e}function Qd(e,n,a){return e=jn(6,e,null,n),e.lanes=a,e}function Zh(e){var n=jn(18,null,null,0);return n.stateNode=e,n}function eu(e,n,a){return n=jn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Kh=new WeakMap;function Pn(e,n){if(typeof e=="object"&&e!==null){var a=Kh.get(e);return a!==void 0?a:(n={value:e,source:n,stack:ft(n)},Kh.set(e,n),n)}return{value:e,source:n,stack:ft(n)}}var Yi=[],Ji=0,Al=null,Xo=0,Hn=[],Vn=0,la=null,gs=1,vs="";function Rs(e,n){Yi[Ji++]=Xo,Yi[Ji++]=Al,Al=e,Xo=n}function Yh(e,n,a){Hn[Vn++]=gs,Hn[Vn++]=vs,Hn[Vn++]=la,la=e;var l=gs;e=vs;var f=32-Jt(l)-1;l&=~(1<<f),a+=1;var h=32-Jt(n)+f;if(30<h){var x=f-f%5;h=(l&(1<<x)-1).toString(32),l>>=x,f-=x,gs=1<<32-Jt(n)+f|a<<f|l,vs=h+e}else gs=1<<h|a<<f|l,vs=e}function tu(e){e.return!==null&&(Rs(e,1),Yh(e,1,0))}function nu(e){for(;e===Al;)Al=Yi[--Ji],Yi[Ji]=null,Xo=Yi[--Ji],Yi[Ji]=null;for(;e===la;)la=Hn[--Vn],Hn[Vn]=null,vs=Hn[--Vn],Hn[Vn]=null,gs=Hn[--Vn],Hn[Vn]=null}function Jh(e,n){Hn[Vn++]=gs,Hn[Vn++]=vs,Hn[Vn++]=la,gs=n.id,vs=n.overflow,la=e}var nn=null,gt=null,Ge=!1,ca=null,qn=!1,su=Error(r(519));function da(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Qo(Pn(n,e)),su}function Wh(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[ht]=e,n[Wt]=l,a){case"dialog":$e("cancel",n),$e("close",n);break;case"iframe":case"object":case"embed":$e("load",n);break;case"video":case"audio":for(a=0;a<xr.length;a++)$e(xr[a],n);break;case"source":$e("error",n);break;case"img":case"image":case"link":$e("error",n),$e("load",n);break;case"details":$e("toggle",n);break;case"input":$e("invalid",n),dh(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":$e("invalid",n);break;case"textarea":$e("invalid",n),fh(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||m0(n.textContent,a)?(l.popover!=null&&($e("beforetoggle",n),$e("toggle",n)),l.onScroll!=null&&$e("scroll",n),l.onScrollEnd!=null&&$e("scrollend",n),l.onClick!=null&&(n.onclick=Es),n=!0):n=!1,n||da(e,!0)}function Xh(e){for(nn=e.return;nn;)switch(nn.tag){case 5:case 31:case 13:qn=!1;return;case 27:case 3:qn=!0;return;default:nn=nn.return}}function Wi(e){if(e!==nn)return!1;if(!Ge)return Xh(e),Ge=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||kf(e.type,e.memoizedProps)),a=!a),a&&gt&&da(e),Xh(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));gt=S0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));gt=S0(e)}else n===27?(n=gt,Ta(e.type)?(e=Nf,Nf=null,gt=e):gt=n):gt=nn?Fn(e.stateNode.nextSibling):null;return!0}function ni(){gt=nn=null,Ge=!1}function au(){var e=ca;return e!==null&&(kn===null?kn=e:kn.push.apply(kn,e),ca=null),e}function Qo(e){ca===null?ca=[e]:ca.push(e)}var iu=Oe(null),si=null,Ms=null;function ua(e,n,a){Ce(iu,n._currentValue),n._currentValue=a}function Is(e){e._currentValue=iu.current,ke(iu)}function ou(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 ru(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var x=f.child;h=h.firstContext;e:for(;h!==null;){var j=h;h=f;for(var R=0;R<n.length;R++)if(j.context===n[R]){h.lanes|=a,j=h.alternate,j!==null&&(j.lanes|=a),ou(h.return,a,e),l||(x=null);break e}h=j.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(r(341));x.lanes|=a,h=x.alternate,h!==null&&(h.lanes|=a),ou(x,a,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function Xi(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 x=f.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var j=f.type;wn(f.pendingProps.value,x.value)||(e!==null?e.push(j):e=[j])}}else if(f===me.current){if(x=f.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(jr):e=[jr])}f=f.return}e!==null&&ru(n,e,a,l),n.flags|=262144}function Dl(e){for(e=e.firstContext;e!==null;){if(!wn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ai(e){si=e,Ms=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function sn(e){return Qh(si,e)}function Rl(e,n){return si===null&&ai(e),Qh(e,n)}function Qh(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Ms===null){if(e===null)throw Error(r(308));Ms=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Ms=Ms.next=n;return a}var Bk=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()})}},zk=t.unstable_scheduleCallback,Uk=t.unstable_NormalPriority,Ut={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lu(){return{controller:new Bk,data:new Map,refCount:0}}function er(e){e.refCount--,e.refCount===0&&zk(Uk,function(){e.controller.abort()})}var tr=null,cu=0,Qi=0,eo=null;function $k(e,n){if(tr===null){var a=tr=[];cu=0,Qi=pf(),eo={status:"pending",value:void 0,then:function(l){a.push(l)}}}return cu++,n.then(eg,eg),n}function eg(){if(--cu===0&&tr!==null){eo!==null&&(eo.status="fulfilled");var e=tr;tr=null,Qi=0,eo=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Pk(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 tg=A.S;A.S=function(e,n){zv=Kt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&$k(e,n),tg!==null&&tg(e,n)};var ii=Oe(null);function du(){var e=ii.current;return e!==null?e:dt.pooledCache}function Ml(e,n){n===null?Ce(ii,ii.current):Ce(ii,n.pool)}function ng(){var e=du();return e===null?null:{parent:Ut._currentValue,pool:e}}var to=Error(r(460)),uu=Error(r(474)),Il=Error(r(542)),Ol={then:function(){}};function sg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function ag(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(Es,Es),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,og(e),e;default:if(typeof n.status=="string")n.then(Es,Es);else{if(e=dt,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,og(e),e}throw ri=n,to}}function oi(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ri=a,to):a}}var ri=null;function ig(){if(ri===null)throw Error(r(459));var e=ri;return ri=null,e}function og(e){if(e===to||e===Il)throw Error(r(483))}var no=null,nr=0;function Ll(e){var n=nr;return nr+=1,no===null&&(no=[]),ag(no,e,n)}function sr(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Bl(e,n){throw n.$$typeof===_?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function rg(e){function n(U,B){if(e){var V=U.deletions;V===null?(U.deletions=[B],U.flags|=16):V.push(B)}}function a(U,B){if(!e)return null;for(;B!==null;)n(U,B),B=B.sibling;return null}function l(U){for(var B=new Map;U!==null;)U.key!==null?B.set(U.key,U):B.set(U.index,U),U=U.sibling;return B}function f(U,B){return U=Ds(U,B),U.index=0,U.sibling=null,U}function h(U,B,V){return U.index=V,e?(V=U.alternate,V!==null?(V=V.index,V<B?(U.flags|=67108866,B):V):(U.flags|=67108866,B)):(U.flags|=1048576,B)}function x(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function j(U,B,V,Q){return B===null||B.tag!==6?(B=Qd(V,U.mode,Q),B.return=U,B):(B=f(B,V),B.return=U,B)}function R(U,B,V,Q){var Te=V.type;return Te===w?W(U,B,V.props.children,Q,V.key):B!==null&&(B.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===z&&oi(Te)===B.type)?(B=f(B,V.props),sr(B,V),B.return=U,B):(B=El(V.type,V.key,V.props,null,U.mode,Q),sr(B,V),B.return=U,B)}function q(U,B,V,Q){return B===null||B.tag!==4||B.stateNode.containerInfo!==V.containerInfo||B.stateNode.implementation!==V.implementation?(B=eu(V,U.mode,Q),B.return=U,B):(B=f(B,V.children||[]),B.return=U,B)}function W(U,B,V,Q,Te){return B===null||B.tag!==7?(B=ti(V,U.mode,Q,Te),B.return=U,B):(B=f(B,V),B.return=U,B)}function ee(U,B,V){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=Qd(""+B,U.mode,V),B.return=U,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case S:return V=El(B.type,B.key,B.props,null,U.mode,V),sr(V,B),V.return=U,V;case k:return B=eu(B,U.mode,V),B.return=U,B;case z:return B=oi(B),ee(U,B,V)}if(re(B)||P(B))return B=ti(B,U.mode,V,null),B.return=U,B;if(typeof B.then=="function")return ee(U,Ll(B),V);if(B.$$typeof===D)return ee(U,Rl(U,B),V);Bl(U,B)}return null}function G(U,B,V,Q){var Te=B!==null?B.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return Te!==null?null:j(U,B,""+V,Q);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return V.key===Te?R(U,B,V,Q):null;case k:return V.key===Te?q(U,B,V,Q):null;case z:return V=oi(V),G(U,B,V,Q)}if(re(V)||P(V))return Te!==null?null:W(U,B,V,Q,null);if(typeof V.then=="function")return G(U,B,Ll(V),Q);if(V.$$typeof===D)return G(U,B,Rl(U,V),Q);Bl(U,V)}return null}function Z(U,B,V,Q,Te){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return U=U.get(V)||null,j(B,U,""+Q,Te);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case S:return U=U.get(Q.key===null?V:Q.key)||null,R(B,U,Q,Te);case k:return U=U.get(Q.key===null?V:Q.key)||null,q(B,U,Q,Te);case z:return Q=oi(Q),Z(U,B,V,Q,Te)}if(re(Q)||P(Q))return U=U.get(V)||null,W(B,U,Q,Te,null);if(typeof Q.then=="function")return Z(U,B,V,Ll(Q),Te);if(Q.$$typeof===D)return Z(U,B,V,Rl(B,Q),Te);Bl(B,Q)}return null}function ve(U,B,V,Q){for(var Te=null,We=null,be=B,Le=B=0,Ve=null;be!==null&&Le<V.length;Le++){be.index>Le?(Ve=be,be=null):Ve=be.sibling;var Xe=G(U,be,V[Le],Q);if(Xe===null){be===null&&(be=Ve);break}e&&be&&Xe.alternate===null&&n(U,be),B=h(Xe,B,Le),We===null?Te=Xe:We.sibling=Xe,We=Xe,be=Ve}if(Le===V.length)return a(U,be),Ge&&Rs(U,Le),Te;if(be===null){for(;Le<V.length;Le++)be=ee(U,V[Le],Q),be!==null&&(B=h(be,B,Le),We===null?Te=be:We.sibling=be,We=be);return Ge&&Rs(U,Le),Te}for(be=l(be);Le<V.length;Le++)Ve=Z(be,U,Le,V[Le],Q),Ve!==null&&(e&&Ve.alternate!==null&&be.delete(Ve.key===null?Le:Ve.key),B=h(Ve,B,Le),We===null?Te=Ve:We.sibling=Ve,We=Ve);return e&&be.forEach(function(Ea){return n(U,Ea)}),Ge&&Rs(U,Le),Te}function je(U,B,V,Q){if(V==null)throw Error(r(151));for(var Te=null,We=null,be=B,Le=B=0,Ve=null,Xe=V.next();be!==null&&!Xe.done;Le++,Xe=V.next()){be.index>Le?(Ve=be,be=null):Ve=be.sibling;var Ea=G(U,be,Xe.value,Q);if(Ea===null){be===null&&(be=Ve);break}e&&be&&Ea.alternate===null&&n(U,be),B=h(Ea,B,Le),We===null?Te=Ea:We.sibling=Ea,We=Ea,be=Ve}if(Xe.done)return a(U,be),Ge&&Rs(U,Le),Te;if(be===null){for(;!Xe.done;Le++,Xe=V.next())Xe=ee(U,Xe.value,Q),Xe!==null&&(B=h(Xe,B,Le),We===null?Te=Xe:We.sibling=Xe,We=Xe);return Ge&&Rs(U,Le),Te}for(be=l(be);!Xe.done;Le++,Xe=V.next())Xe=Z(be,U,Le,Xe.value,Q),Xe!==null&&(e&&Xe.alternate!==null&&be.delete(Xe.key===null?Le:Xe.key),B=h(Xe,B,Le),We===null?Te=Xe:We.sibling=Xe,We=Xe);return e&&be.forEach(function(XS){return n(U,XS)}),Ge&&Rs(U,Le),Te}function lt(U,B,V,Q){if(typeof V=="object"&&V!==null&&V.type===w&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case S:e:{for(var Te=V.key;B!==null;){if(B.key===Te){if(Te=V.type,Te===w){if(B.tag===7){a(U,B.sibling),Q=f(B,V.props.children),Q.return=U,U=Q;break e}}else if(B.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===z&&oi(Te)===B.type){a(U,B.sibling),Q=f(B,V.props),sr(Q,V),Q.return=U,U=Q;break e}a(U,B);break}else n(U,B);B=B.sibling}V.type===w?(Q=ti(V.props.children,U.mode,Q,V.key),Q.return=U,U=Q):(Q=El(V.type,V.key,V.props,null,U.mode,Q),sr(Q,V),Q.return=U,U=Q)}return x(U);case k:e:{for(Te=V.key;B!==null;){if(B.key===Te)if(B.tag===4&&B.stateNode.containerInfo===V.containerInfo&&B.stateNode.implementation===V.implementation){a(U,B.sibling),Q=f(B,V.children||[]),Q.return=U,U=Q;break e}else{a(U,B);break}else n(U,B);B=B.sibling}Q=eu(V,U.mode,Q),Q.return=U,U=Q}return x(U);case z:return V=oi(V),lt(U,B,V,Q)}if(re(V))return ve(U,B,V,Q);if(P(V)){if(Te=P(V),typeof Te!="function")throw Error(r(150));return V=Te.call(V),je(U,B,V,Q)}if(typeof V.then=="function")return lt(U,B,Ll(V),Q);if(V.$$typeof===D)return lt(U,B,Rl(U,V),Q);Bl(U,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,B!==null&&B.tag===6?(a(U,B.sibling),Q=f(B,V),Q.return=U,U=Q):(a(U,B),Q=Qd(V,U.mode,Q),Q.return=U,U=Q),x(U)):a(U,B)}return function(U,B,V,Q){try{nr=0;var Te=lt(U,B,V,Q);return no=null,Te}catch(be){if(be===to||be===Il)throw be;var We=jn(29,be,null,U.mode);return We.lanes=Q,We.return=U,We}finally{}}}var li=rg(!0),lg=rg(!1),fa=!1;function fu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function pu(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 pa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ma(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(tt&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=Cl(e),Gh(e,null,a),n}return Nl(e,l,n,a),Cl(e)}function ar(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,Ye(e,a)}}function mu(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 x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?f=h=x:h=h.next=x,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 hu=!1;function ir(){if(hu){var e=eo;if(e!==null)throw e}}function or(e,n,a,l){hu=!1;var f=e.updateQueue;fa=!1;var h=f.firstBaseUpdate,x=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var R=j,q=R.next;R.next=null,x===null?h=q:x.next=q,x=R;var W=e.alternate;W!==null&&(W=W.updateQueue,j=W.lastBaseUpdate,j!==x&&(j===null?W.firstBaseUpdate=q:j.next=q,W.lastBaseUpdate=R))}if(h!==null){var ee=f.baseState;x=0,W=q=R=null,j=h;do{var G=j.lane&-536870913,Z=G!==j.lane;if(Z?(He&G)===G:(l&G)===G){G!==0&&G===Qi&&(hu=!0),W!==null&&(W=W.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var ve=e,je=j;G=n;var lt=a;switch(je.tag){case 1:if(ve=je.payload,typeof ve=="function"){ee=ve.call(lt,ee,G);break e}ee=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=je.payload,G=typeof ve=="function"?ve.call(lt,ee,G):ve,G==null)break e;ee=b({},ee,G);break e;case 2:fa=!0}}G=j.callback,G!==null&&(e.flags|=64,Z&&(e.flags|=8192),Z=f.callbacks,Z===null?f.callbacks=[G]:Z.push(G))}else Z={lane:G,tag:j.tag,payload:j.payload,callback:j.callback,next:null},W===null?(q=W=Z,R=ee):W=W.next=Z,x|=G;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;Z=j,j=Z.next,Z.next=null,f.lastBaseUpdate=Z,f.shared.pending=null}}while(!0);W===null&&(R=ee),f.baseState=R,f.firstBaseUpdate=q,f.lastBaseUpdate=W,h===null&&(f.shared.lanes=0),ba|=x,e.lanes=x,e.memoizedState=ee}}function cg(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function dg(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)cg(a[e],n)}var so=Oe(null),zl=Oe(0);function ug(e,n){e=Vs,Ce(zl,e),Ce(so,n),Vs=e|n.baseLanes}function gu(){Ce(zl,Vs),Ce(so,so.current)}function vu(){Vs=zl.current,ke(so),ke(zl)}var Nn=Oe(null),Gn=null;function ha(e){var n=e.alternate;Ce(It,It.current&1),Ce(Nn,e),Gn===null&&(n===null||so.current!==null||n.memoizedState!==null)&&(Gn=e)}function yu(e){Ce(It,It.current),Ce(Nn,e),Gn===null&&(Gn=e)}function fg(e){e.tag===22?(Ce(It,It.current),Ce(Nn,e),Gn===null&&(Gn=e)):ga()}function ga(){Ce(It,It.current),Ce(Nn,Nn.current)}function Cn(e){ke(Nn),Gn===e&&(Gn=null),ke(It)}var It=Oe(0);function Ul(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||wf(a)||jf(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 Os=0,Ie=null,ot=null,$t=null,$l=!1,ao=!1,ci=!1,Pl=0,rr=0,io=null,Hk=0;function Ct(){throw Error(r(321))}function bu(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 _u(e,n,a,l,f,h){return Os=h,Ie=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,A.H=e===null||e.memoizedState===null?Yg:Ou,ci=!1,h=a(l,f),ci=!1,ao&&(h=mg(n,a,l,f)),pg(e),h}function pg(e){A.H=dr;var n=ot!==null&&ot.next!==null;if(Os=0,$t=ot=Ie=null,$l=!1,rr=0,io=null,n)throw Error(r(300));e===null||Pt||(e=e.dependencies,e!==null&&Dl(e)&&(Pt=!0))}function mg(e,n,a,l){Ie=e;var f=0;do{if(ao&&(io=null),rr=0,ao=!1,25<=f)throw Error(r(301));if(f+=1,$t=ot=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}A.H=Jg,h=n(a,l)}while(ao);return h}function Vk(){var e=A.H,n=e.useState()[0];return n=typeof n.then=="function"?lr(n):n,e=e.useState()[0],(ot!==null?ot.memoizedState:null)!==e&&(Ie.flags|=1024),n}function xu(){var e=Pl!==0;return Pl=0,e}function ku(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Su(e){if($l){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}$l=!1}Os=0,$t=ot=Ie=null,ao=!1,rr=Pl=0,io=null}function pn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $t===null?Ie.memoizedState=$t=e:$t=$t.next=e,$t}function Ot(){if(ot===null){var e=Ie.alternate;e=e!==null?e.memoizedState:null}else e=ot.next;var n=$t===null?Ie.memoizedState:$t.next;if(n!==null)$t=n,ot=e;else{if(e===null)throw Ie.alternate===null?Error(r(467)):Error(r(310));ot=e,e={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},$t===null?Ie.memoizedState=$t=e:$t=$t.next=e}return $t}function Hl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lr(e){var n=rr;return rr+=1,io===null&&(io=[]),e=ag(io,e,n),n=Ie,($t===null?n.memoizedState:$t.next)===null&&(n=n.alternate,A.H=n===null||n.memoizedState===null?Yg:Ou),e}function Vl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return lr(e);if(e.$$typeof===D)return sn(e)}throw Error(r(438,String(e)))}function Tu(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=Hl(),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 Ls(e,n){return typeof n=="function"?n(e):n}function ql(e){var n=Ot();return wu(n,ot,e)}function wu(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 x=f.next;f.next=h.next,h.next=x}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var j=x=null,R=null,q=n,W=!1;do{var ee=q.lane&-536870913;if(ee!==q.lane?(He&ee)===ee:(Os&ee)===ee){var G=q.revertLane;if(G===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null}),ee===Qi&&(W=!0);else if((Os&G)===G){q=q.next,G===Qi&&(W=!0);continue}else ee={lane:0,revertLane:q.revertLane,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},R===null?(j=R=ee,x=h):R=R.next=ee,Ie.lanes|=G,ba|=G;ee=q.action,ci&&a(h,ee),h=q.hasEagerState?q.eagerState:a(h,ee)}else G={lane:ee,revertLane:q.revertLane,gesture:q.gesture,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},R===null?(j=R=G,x=h):R=R.next=G,Ie.lanes|=ee,ba|=ee;q=q.next}while(q!==null&&q!==n);if(R===null?x=h:R.next=j,!wn(h,e.memoizedState)&&(Pt=!0,W&&(a=eo,a!==null)))throw a;e.memoizedState=h,e.baseState=x,e.baseQueue=R,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function ju(e){var n=Ot(),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 x=f=f.next;do h=e(h,x.action),x=x.next;while(x!==f);wn(h,n.memoizedState)||(Pt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,l]}function hg(e,n,a){var l=Ie,f=Ot(),h=Ge;if(h){if(a===void 0)throw Error(r(407));a=a()}else a=n();var x=!wn((ot||f).memoizedState,a);if(x&&(f.memoizedState=a,Pt=!0),f=f.queue,Eu(yg.bind(null,l,f,e),[e]),f.getSnapshot!==n||x||$t!==null&&$t.memoizedState.tag&1){if(l.flags|=2048,oo(9,{destroy:void 0},vg.bind(null,l,f,a,n),null),dt===null)throw Error(r(349));h||(Os&127)!==0||gg(l,n,a)}return a}function gg(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Ie.updateQueue,n===null?(n=Hl(),Ie.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function vg(e,n,a,l){n.value=a,n.getSnapshot=l,bg(n)&&_g(e)}function yg(e,n,a){return a(function(){bg(n)&&_g(e)})}function bg(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!wn(e,a)}catch{return!0}}function _g(e){var n=ei(e,2);n!==null&&Sn(n,e,2)}function Nu(e){var n=pn();if(typeof e=="function"){var a=e;if(e=a(),ci){un(!0);try{a()}finally{un(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ls,lastRenderedState:e},n}function xg(e,n,a,l){return e.baseState=a,wu(e,ot,typeof l=="function"?l:Ls)}function qk(e,n,a,l,f){if(Zl(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(x){h.listeners.push(x)}};A.T!==null?a(!0):h.isTransition=!1,l(h),a=n.pending,a===null?(h.next=n.pending=h,kg(n,h)):(h.next=a.next,n.pending=a.next=h)}}function kg(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=A.T,x={};A.T=x;try{var j=a(f,l),R=A.S;R!==null&&R(x,j),Sg(e,n,j)}catch(q){Cu(e,n,q)}finally{h!==null&&x.types!==null&&(h.types=x.types),A.T=h}}else try{h=a(f,l),Sg(e,n,h)}catch(q){Cu(e,n,q)}}function Sg(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){Tg(e,n,l)},function(l){return Cu(e,n,l)}):Tg(e,n,a)}function Tg(e,n,a){n.status="fulfilled",n.value=a,wg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,kg(e,a)))}function Cu(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,wg(n),n=n.next;while(n!==l)}e.action=null}function wg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function jg(e,n){return n}function Ng(e,n){if(Ge){var a=dt.formState;if(a!==null){e:{var l=Ie;if(Ge){if(gt){t:{for(var f=gt,h=qn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Fn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){gt=Fn(f.nextSibling),l=f.data==="F!";break e}}da(l)}l=!1}l&&(n=a[0])}}return a=pn(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jg,lastRenderedState:n},a.queue=l,a=Fg.bind(null,Ie,l),l.dispatch=a,l=Nu(!1),h=Iu.bind(null,Ie,!1,l.queue),l=pn(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=qk.bind(null,Ie,f,h,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function Cg(e){var n=Ot();return Eg(n,ot,e)}function Eg(e,n,a){if(n=wu(e,n,jg)[0],e=ql(Ls)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=lr(n)}catch(x){throw x===to?Il:x}else l=n;n=Ot();var f=n.queue,h=f.dispatch;return a!==n.memoizedState&&(Ie.flags|=2048,oo(9,{destroy:void 0},Gk.bind(null,f,a),null)),[l,h,e]}function Gk(e,n){e.action=n}function Ag(e){var n=Ot(),a=ot;if(a!==null)return Eg(n,a,e);Ot(),n=n.memoizedState,a=Ot();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function oo(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=Ie.updateQueue,n===null&&(n=Hl(),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 Dg(){return Ot().memoizedState}function Gl(e,n,a,l){var f=pn();Ie.flags|=e,f.memoizedState=oo(1|n,{destroy:void 0},a,l===void 0?null:l)}function Fl(e,n,a,l){var f=Ot();l=l===void 0?null:l;var h=f.memoizedState.inst;ot!==null&&l!==null&&bu(l,ot.memoizedState.deps)?f.memoizedState=oo(n,h,a,l):(Ie.flags|=e,f.memoizedState=oo(1|n,h,a,l))}function Rg(e,n){Gl(8390656,8,e,n)}function Eu(e,n){Fl(2048,8,e,n)}function Fk(e){Ie.flags|=4;var n=Ie.updateQueue;if(n===null)n=Hl(),Ie.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Mg(e){var n=Ot().memoizedState;return Fk({ref:n,nextImpl:e}),function(){if((tt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Ig(e,n){return Fl(4,2,e,n)}function Og(e,n){return Fl(4,4,e,n)}function Lg(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 Bg(e,n,a){a=a!=null?a.concat([e]):null,Fl(4,4,Lg.bind(null,n,e),a)}function Au(){}function zg(e,n){var a=Ot();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&bu(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Ug(e,n){var a=Ot();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&bu(n,l[1]))return l[0];if(l=e(),ci){un(!0);try{e()}finally{un(!1)}}return a.memoizedState=[l,n],l}function Du(e,n,a){return a===void 0||(Os&1073741824)!==0&&(He&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=$v(),Ie.lanes|=e,ba|=e,a)}function $g(e,n,a,l){return wn(a,n)?a:so.current!==null?(e=Du(e,a,l),wn(e,n)||(Pt=!0),e):(Os&42)===0||(Os&1073741824)!==0&&(He&261930)===0?(Pt=!0,e.memoizedState=a):(e=$v(),Ie.lanes|=e,ba|=e,n)}function Pg(e,n,a,l,f){var h=F.p;F.p=h!==0&&8>h?h:8;var x=A.T,j={};A.T=j,Iu(e,!1,n,a);try{var R=f(),q=A.S;if(q!==null&&q(j,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var W=Pk(R,l);cr(e,n,W,Dn(e))}else cr(e,n,l,Dn(e))}catch(ee){cr(e,n,{then:function(){},status:"rejected",reason:ee},Dn())}finally{F.p=h,x!==null&&j.types!==null&&(x.types=j.types),A.T=x}}function Zk(){}function Ru(e,n,a,l){if(e.tag!==5)throw Error(r(476));var f=Hg(e).queue;Pg(e,f,n,oe,a===null?Zk:function(){return Vg(e),a(l)})}function Hg(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ls,lastRenderedState:oe},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ls,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Vg(e){var n=Hg(e);n.next===null&&(n=e.alternate.memoizedState),cr(e,n.next.queue,{},Dn())}function Mu(){return sn(jr)}function qg(){return Ot().memoizedState}function Gg(){return Ot().memoizedState}function Kk(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Dn();e=pa(a);var l=ma(n,e,a);l!==null&&(Sn(l,n,a),ar(l,n,a)),n={cache:lu()},e.payload=n;return}n=n.return}}function Yk(e,n,a){var l=Dn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Zl(e)?Zg(n,a):(a=Wd(e,n,a,l),a!==null&&(Sn(a,e,l),Kg(a,n,l)))}function Fg(e,n,a){var l=Dn();cr(e,n,a,l)}function cr(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Zl(e))Zg(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,j=h(x,a);if(f.hasEagerState=!0,f.eagerState=j,wn(j,x))return Nl(e,n,f,0),dt===null&&jl(),!1}catch{}finally{}if(a=Wd(e,n,f,l),a!==null)return Sn(a,e,l),Kg(a,n,l),!0}return!1}function Iu(e,n,a,l){if(l={lane:2,revertLane:pf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Zl(e)){if(n)throw Error(r(479))}else n=Wd(e,a,l,2),n!==null&&Sn(n,e,2)}function Zl(e){var n=e.alternate;return e===Ie||n!==null&&n===Ie}function Zg(e,n){ao=$l=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Kg(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Ye(e,a)}}var dr={readContext:sn,use:Vl,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};dr.useEffectEvent=Ct;var Yg={readContext:sn,use:Vl,useCallback:function(e,n){return pn().memoizedState=[e,n===void 0?null:n],e},useContext:sn,useEffect:Rg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Gl(4194308,4,Lg.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Gl(4194308,4,e,n)},useInsertionEffect:function(e,n){Gl(4,2,e,n)},useMemo:function(e,n){var a=pn();n=n===void 0?null:n;var l=e();if(ci){un(!0);try{e()}finally{un(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=pn();if(a!==void 0){var f=a(n);if(ci){un(!0);try{a(n)}finally{un(!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=Yk.bind(null,Ie,e),[l.memoizedState,e]},useRef:function(e){var n=pn();return e={current:e},n.memoizedState=e},useState:function(e){e=Nu(e);var n=e.queue,a=Fg.bind(null,Ie,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Au,useDeferredValue:function(e,n){var a=pn();return Du(a,e,n)},useTransition:function(){var e=Nu(!1);return e=Pg.bind(null,Ie,e.queue,!0,!1),pn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=Ie,f=pn();if(Ge){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),dt===null)throw Error(r(349));(He&127)!==0||gg(l,n,a)}f.memoizedState=a;var h={value:a,getSnapshot:n};return f.queue=h,Rg(yg.bind(null,l,h,e),[e]),l.flags|=2048,oo(9,{destroy:void 0},vg.bind(null,l,h,a,n),null),a},useId:function(){var e=pn(),n=dt.identifierPrefix;if(Ge){var a=vs,l=gs;a=(l&~(1<<32-Jt(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Pl++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Hk++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Mu,useFormState:Ng,useActionState:Ng,useOptimistic:function(e){var n=pn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Iu.bind(null,Ie,!0,a),a.dispatch=n,[e,n]},useMemoCache:Tu,useCacheRefresh:function(){return pn().memoizedState=Kk.bind(null,Ie)},useEffectEvent:function(e){var n=pn(),a={impl:e};return n.memoizedState=a,function(){if((tt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Ou={readContext:sn,use:Vl,useCallback:zg,useContext:sn,useEffect:Eu,useImperativeHandle:Bg,useInsertionEffect:Ig,useLayoutEffect:Og,useMemo:Ug,useReducer:ql,useRef:Dg,useState:function(){return ql(Ls)},useDebugValue:Au,useDeferredValue:function(e,n){var a=Ot();return $g(a,ot.memoizedState,e,n)},useTransition:function(){var e=ql(Ls)[0],n=Ot().memoizedState;return[typeof e=="boolean"?e:lr(e),n]},useSyncExternalStore:hg,useId:qg,useHostTransitionStatus:Mu,useFormState:Cg,useActionState:Cg,useOptimistic:function(e,n){var a=Ot();return xg(a,ot,e,n)},useMemoCache:Tu,useCacheRefresh:Gg};Ou.useEffectEvent=Mg;var Jg={readContext:sn,use:Vl,useCallback:zg,useContext:sn,useEffect:Eu,useImperativeHandle:Bg,useInsertionEffect:Ig,useLayoutEffect:Og,useMemo:Ug,useReducer:ju,useRef:Dg,useState:function(){return ju(Ls)},useDebugValue:Au,useDeferredValue:function(e,n){var a=Ot();return ot===null?Du(a,e,n):$g(a,ot.memoizedState,e,n)},useTransition:function(){var e=ju(Ls)[0],n=Ot().memoizedState;return[typeof e=="boolean"?e:lr(e),n]},useSyncExternalStore:hg,useId:qg,useHostTransitionStatus:Mu,useFormState:Ag,useActionState:Ag,useOptimistic:function(e,n){var a=Ot();return ot!==null?xg(a,ot,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Tu,useCacheRefresh:Gg};Jg.useEffectEvent=Mg;function Lu(e,n,a,l){n=e.memoizedState,a=a(l,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Bu={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=Dn(),f=pa(l);f.payload=n,a!=null&&(f.callback=a),n=ma(e,f,l),n!==null&&(Sn(n,e,l),ar(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=Dn(),f=pa(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=ma(e,f,l),n!==null&&(Sn(n,e,l),ar(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Dn(),l=pa(a);l.tag=2,n!=null&&(l.callback=n),n=ma(e,l,a),n!==null&&(Sn(n,e,a),ar(n,e,a))}};function Wg(e,n,a,l,f,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,x):n.prototype&&n.prototype.isPureReactComponent?!Jo(a,l)||!Jo(f,h):!0}function Xg(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&&Bu.enqueueReplaceState(n,n.state,null)}function di(e,n){var a=n;if("ref"in n){a={};for(var l in n)l!=="ref"&&(a[l]=n[l])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function Qg(e){wl(e)}function ev(e){console.error(e)}function tv(e){wl(e)}function Kl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function nv(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 zu(e,n,a){return a=pa(a),a.tag=3,a.payload={element:null},a.callback=function(){Kl(e,n)},a}function sv(e){return e=pa(e),e.tag=3,e}function av(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(){nv(n,a,l)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){nv(n,a,l),typeof f!="function"&&(_a===null?_a=new Set([this]):_a.add(this));var j=l.stack;this.componentDidCatch(l.value,{componentStack:j!==null?j:""})})}function Jk(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&Xi(n,a,f,!0),a=Nn.current,a!==null){switch(a.tag){case 31:case 13:return Gn===null?oc():a.alternate===null&&Et===0&&(Et=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Ol?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),df(e,l,f)),!1;case 22:return a.flags|=65536,l===Ol?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)),df(e,l,f)),!1}throw Error(r(435,a.tag))}return df(e,l,f),oc(),!1}if(Ge)return n=Nn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==su&&(e=Error(r(422),{cause:l}),Qo(Pn(e,a)))):(l!==su&&(n=Error(r(423),{cause:l}),Qo(Pn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Pn(l,a),f=zu(e.stateNode,l,f),mu(e,f),Et!==4&&(Et=2)),!1;var h=Error(r(520),{cause:l});if(h=Pn(h,a),yr===null?yr=[h]:yr.push(h),Et!==4&&(Et=2),n===null)return!0;l=Pn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=zu(a.stateNode,l,e),mu(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"&&(_a===null||!_a.has(h))))return a.flags|=65536,f&=-f,a.lanes|=f,f=sv(f),av(f,e,a,l),mu(a,f),!1}a=a.return}while(a!==null);return!1}var Uu=Error(r(461)),Pt=!1;function an(e,n,a,l){n.child=e===null?lg(n,null,a,l):li(n,e.child,a,l)}function iv(e,n,a,l,f){a=a.render;var h=n.ref;if("ref"in l){var x={};for(var j in l)j!=="ref"&&(x[j]=l[j])}else x=l;return ai(n),l=_u(e,n,a,x,h,f),j=xu(),e!==null&&!Pt?(ku(e,n,f),Bs(e,n,f)):(Ge&&j&&tu(n),n.flags|=1,an(e,n,l,f),n.child)}function ov(e,n,a,l,f){if(e===null){var h=a.type;return typeof h=="function"&&!Xd(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,rv(e,n,h,l,f)):(e=El(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Zu(e,f)){var x=h.memoizedProps;if(a=a.compare,a=a!==null?a:Jo,a(x,l)&&e.ref===n.ref)return Bs(e,n,f)}return n.flags|=1,e=Ds(h,l),e.ref=n.ref,e.return=n,n.child=e}function rv(e,n,a,l,f){if(e!==null){var h=e.memoizedProps;if(Jo(h,l)&&e.ref===n.ref)if(Pt=!1,n.pendingProps=l=h,Zu(e,f))(e.flags&131072)!==0&&(Pt=!0);else return n.lanes=e.lanes,Bs(e,n,f)}return $u(e,n,a,l,f)}function lv(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 cv(e,n,h,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ml(n,h!==null?h.cachePool:null),h!==null?ug(n,h):gu(),fg(n);else return l=n.lanes=536870912,cv(e,n,h!==null?h.baseLanes|a:a,a,l)}else h!==null?(Ml(n,h.cachePool),ug(n,h),ga(),n.memoizedState=null):(e!==null&&Ml(n,null),gu(),ga());return an(e,n,f,a),n.child}function ur(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function cv(e,n,a,l,f){var h=du();return h=h===null?null:{parent:Ut._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&Ml(n,null),gu(),fg(n),e!==null&&Xi(e,n,l,!0),n.childLanes=f,null}function Yl(e,n){return n=Wl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function dv(e,n,a){return li(n,e.child,null,a),e=Yl(n,n.pendingProps),e.flags|=2,Cn(n),n.memoizedState=null,e}function Wk(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ge){if(l.mode==="hidden")return e=Yl(n,l),n.lanes=536870912,ur(null,e);if(yu(n),(e=gt)?(e=k0(e,qn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:la!==null?{id:gs,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},a=Zh(e),a.return=n,n.child=a,nn=n,gt=null)):e=null,e===null)throw da(n);return n.lanes=536870912,null}return Yl(n,l)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(yu(n),f)if(n.flags&256)n.flags&=-257,n=dv(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(Pt||Xi(e,n,a,!1),f=(a&e.childLanes)!==0,Pt||f){if(l=dt,l!==null&&(x=ct(l,a),x!==0&&x!==h.retryLane))throw h.retryLane=x,ei(e,x),Sn(l,e,x),Uu;oc(),n=dv(e,n,a)}else e=h.treeContext,gt=Fn(x.nextSibling),nn=n,Ge=!0,ca=null,qn=!1,e!==null&&Jh(n,e),n=Yl(n,l),n.flags|=4096;return n}return e=Ds(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Jl(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 $u(e,n,a,l,f){return ai(n),a=_u(e,n,a,l,void 0,f),l=xu(),e!==null&&!Pt?(ku(e,n,f),Bs(e,n,f)):(Ge&&l&&tu(n),n.flags|=1,an(e,n,a,f),n.child)}function uv(e,n,a,l,f,h){return ai(n),n.updateQueue=null,a=mg(n,l,a,f),pg(e),l=xu(),e!==null&&!Pt?(ku(e,n,h),Bs(e,n,h)):(Ge&&l&&tu(n),n.flags|=1,an(e,n,a,h),n.child)}function fv(e,n,a,l,f){if(ai(n),n.stateNode===null){var h=Ki,x=a.contextType;typeof x=="object"&&x!==null&&(h=sn(x)),h=new a(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Bu,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},fu(n),x=a.contextType,h.context=typeof x=="object"&&x!==null?sn(x):Ki,h.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Lu(n,a,x,l),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&Bu.enqueueReplaceState(h,h.state,null),or(n,l,h,f),ir(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){h=n.stateNode;var j=n.memoizedProps,R=di(a,j);h.props=R;var q=h.context,W=a.contextType;x=Ki,typeof W=="object"&&W!==null&&(x=sn(W));var ee=a.getDerivedStateFromProps;W=typeof ee=="function"||typeof h.getSnapshotBeforeUpdate=="function",j=n.pendingProps!==j,W||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(j||q!==x)&&Xg(n,h,l,x),fa=!1;var G=n.memoizedState;h.state=G,or(n,l,h,f),ir(),q=n.memoizedState,j||G!==q||fa?(typeof ee=="function"&&(Lu(n,a,ee,l),q=n.memoizedState),(R=fa||Wg(n,a,R,l,G,q,x))?(W||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=x,l=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,pu(e,n),x=n.memoizedProps,W=di(a,x),h.props=W,ee=n.pendingProps,G=h.context,q=a.contextType,R=Ki,typeof q=="object"&&q!==null&&(R=sn(q)),j=a.getDerivedStateFromProps,(q=typeof j=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==ee||G!==R)&&Xg(n,h,l,R),fa=!1,G=n.memoizedState,h.state=G,or(n,l,h,f),ir();var Z=n.memoizedState;x!==ee||G!==Z||fa||e!==null&&e.dependencies!==null&&Dl(e.dependencies)?(typeof j=="function"&&(Lu(n,a,j,l),Z=n.memoizedState),(W=fa||Wg(n,a,W,l,G,Z,R)||e!==null&&e.dependencies!==null&&Dl(e.dependencies))?(q||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,Z,R),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,Z,R)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=Z),h.props=l,h.state=Z,h.context=R,l=W):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,Jl(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=li(n,e.child,null,f),n.child=li(n,null,a,f)):an(e,n,a,f),n.memoizedState=h.state,e=n.child):e=Bs(e,n,f),e}function pv(e,n,a,l){return ni(),n.flags|=256,an(e,n,a,l),n.child}var Pu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hu(e){return{baseLanes:e,cachePool:ng()}}function Vu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=An),e}function mv(e,n,a){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(It.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(Ge){if(f?ha(n):ga(),(e=gt)?(e=k0(e,qn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:la!==null?{id:gs,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},a=Zh(e),a.return=n,n.child=a,nn=n,gt=null)):e=null,e===null)throw da(n);return jf(e)?n.lanes=32:n.lanes=536870912,null}var j=l.children;return l=l.fallback,f?(ga(),f=n.mode,j=Wl({mode:"hidden",children:j},f),l=ti(l,f,a,null),j.return=n,l.return=n,j.sibling=l,n.child=j,l=n.child,l.memoizedState=Hu(a),l.childLanes=Vu(e,x,a),n.memoizedState=Pu,ur(null,l)):(ha(n),qu(n,j))}var R=e.memoizedState;if(R!==null&&(j=R.dehydrated,j!==null)){if(h)n.flags&256?(ha(n),n.flags&=-257,n=Gu(e,n,a)):n.memoizedState!==null?(ga(),n.child=e.child,n.flags|=128,n=null):(ga(),j=l.fallback,f=n.mode,l=Wl({mode:"visible",children:l.children},f),j=ti(j,f,a,null),j.flags|=2,l.return=n,j.return=n,l.sibling=j,n.child=l,li(n,e.child,null,a),l=n.child,l.memoizedState=Hu(a),l.childLanes=Vu(e,x,a),n.memoizedState=Pu,n=ur(null,l));else if(ha(n),jf(j)){if(x=j.nextSibling&&j.nextSibling.dataset,x)var q=x.dgst;x=q,l=Error(r(419)),l.stack="",l.digest=x,Qo({value:l,source:null,stack:null}),n=Gu(e,n,a)}else if(Pt||Xi(e,n,a,!1),x=(a&e.childLanes)!==0,Pt||x){if(x=dt,x!==null&&(l=ct(x,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,ei(e,l),Sn(x,e,l),Uu;wf(j)||oc(),n=Gu(e,n,a)}else wf(j)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,gt=Fn(j.nextSibling),nn=n,Ge=!0,ca=null,qn=!1,e!==null&&Jh(n,e),n=qu(n,l.children),n.flags|=4096);return n}return f?(ga(),j=l.fallback,f=n.mode,R=e.child,q=R.sibling,l=Ds(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,q!==null?j=Ds(q,j):(j=ti(j,f,a,null),j.flags|=2),j.return=n,l.return=n,l.sibling=j,n.child=l,ur(null,l),l=n.child,j=e.child.memoizedState,j===null?j=Hu(a):(f=j.cachePool,f!==null?(R=Ut._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=ng(),j={baseLanes:j.baseLanes|a,cachePool:f}),l.memoizedState=j,l.childLanes=Vu(e,x,a),n.memoizedState=Pu,ur(e.child,l)):(ha(n),a=e.child,e=a.sibling,a=Ds(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function qu(e,n){return n=Wl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Wl(e,n){return e=jn(22,e,null,n),e.lanes=0,e}function Gu(e,n,a){return li(n,e.child,null,a),e=qu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function hv(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),ou(e.return,n,a)}function Fu(e,n,a,l,f,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=a,x.tailMode=f,x.treeForkCount=h)}function gv(e,n,a){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var x=It.current,j=(x&2)!==0;if(j?(x=x&1|2,n.flags|=128):x&=1,Ce(It,x),an(e,n,l,a),l=Ge?Xo:0,!j&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&hv(e,a,n);else if(e.tag===19)hv(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&&Ul(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Fu(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&&Ul(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Fu(n,!0,a,null,h,l);break;case"together":Fu(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Bs(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),ba|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Xi(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=Ds(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Ds(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Zu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Dl(e)))}function Xk(e,n,a){switch(n.tag){case 3:Be(n,n.stateNode.containerInfo),ua(n,Ut,e.memoizedState.cache),ni();break;case 27:case 5:vn(n);break;case 4:Be(n,n.stateNode.containerInfo);break;case 10:ua(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,yu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(ha(n),n.flags|=128,null):(a&n.child.childLanes)!==0?mv(e,n,a):(ha(n),e=Bs(e,n,a),e!==null?e.sibling:null);ha(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(Xi(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return gv(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Ce(It,It.current),l)break;return null;case 22:return n.lanes=0,lv(e,n,a,n.pendingProps);case 24:ua(n,Ut,e.memoizedState.cache)}return Bs(e,n,a)}function vv(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)Pt=!0;else{if(!Zu(e,a)&&(n.flags&128)===0)return Pt=!1,Xk(e,n,a);Pt=(e.flags&131072)!==0}else Pt=!1,Ge&&(n.flags&1048576)!==0&&Yh(n,Xo,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=oi(n.elementType),n.type=e,typeof e=="function")Xd(e)?(l=di(e,l),n.tag=1,n=fv(null,n,e,l,a)):(n.tag=0,n=$u(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===L){n.tag=11,n=iv(null,n,e,l,a);break e}else if(f===O){n.tag=14,n=ov(null,n,e,l,a);break e}}throw n=K(e)||e,Error(r(306,n,""))}}return n;case 0:return $u(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=di(l,n.pendingProps),fv(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,pu(e,n),or(n,l,null,a);var x=n.memoizedState;if(l=x.cache,ua(n,Ut,l),l!==h.cache&&ru(n,[Ut],a,!0),ir(),l=x.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=pv(e,n,l,a);break e}else if(l!==f){f=Pn(Error(r(424)),n),Qo(f),n=pv(e,n,l,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(gt=Fn(e.firstChild),nn=n,Ge=!0,ca=null,qn=!0,a=lg(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ni(),l===f){n=Bs(e,n,a);break e}an(e,n,l,a)}n=n.child}return n;case 26:return Jl(e,n),e===null?(a=C0(n.type,null,n.pendingProps,null))?n.memoizedState=a:Ge||(a=n.type,e=n.pendingProps,l=pc(_e.current).createElement(a),l[ht]=n,l[Wt]=e,on(l,a,e),Xt(l),n.stateNode=l):n.memoizedState=C0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return vn(n),e===null&&Ge&&(l=n.stateNode=w0(n.type,n.pendingProps,_e.current),nn=n,qn=!0,f=gt,Ta(n.type)?(Nf=f,gt=Fn(l.firstChild)):gt=f),an(e,n,n.pendingProps.children,a),Jl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ge&&((f=l=gt)&&(l=CS(l,n.type,n.pendingProps,qn),l!==null?(n.stateNode=l,nn=n,gt=Fn(l.firstChild),qn=!1,f=!0):f=!1),f||da(n)),vn(n),f=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,l=h.children,kf(f,h)?l=null:x!==null&&kf(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=_u(e,n,Vk,null,null,a),jr._currentValue=f),Jl(e,n),an(e,n,l,a),n.child;case 6:return e===null&&Ge&&((e=a=gt)&&(a=ES(a,n.pendingProps,qn),a!==null?(n.stateNode=a,nn=n,gt=null,e=!0):e=!1),e||da(n)),null;case 13:return mv(e,n,a);case 4:return Be(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=li(n,null,l,a):an(e,n,l,a),n.child;case 11:return iv(e,n,n.type,n.pendingProps,a);case 7:return an(e,n,n.pendingProps,a),n.child;case 8:return an(e,n,n.pendingProps.children,a),n.child;case 12:return an(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,ua(n,n.type,l.value),an(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,ai(n),f=sn(f),l=l(f),n.flags|=1,an(e,n,l,a),n.child;case 14:return ov(e,n,n.type,n.pendingProps,a);case 15:return rv(e,n,n.type,n.pendingProps,a);case 19:return gv(e,n,a);case 31:return Wk(e,n,a);case 22:return lv(e,n,a,n.pendingProps);case 24:return ai(n),l=sn(Ut),e===null?(f=du(),f===null&&(f=dt,h=lu(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=a),f=h),n.memoizedState={parent:l,cache:f},fu(n),ua(n,Ut,f)):((e.lanes&a)!==0&&(pu(e,n),or(n,null,null,a),ir()),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),ua(n,Ut,l)):(l=h.cache,ua(n,Ut,l),l!==f.cache&&ru(n,[Ut],a,!0))),an(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function zs(e){e.flags|=4}function Ku(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(qv())e.flags|=8192;else throw ri=Ol,uu}else e.flags&=-16777217}function yv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!M0(n))if(qv())e.flags|=8192;else throw ri=Ol,uu}function Xl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?fe():536870912,e.lanes|=n,uo|=n)}function fr(e,n){if(!Ge)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function vt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(n)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,n}function Qk(e,n,a){var l=n.pendingProps;switch(nu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(n),null;case 1:return vt(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Is(Ut),mt(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Wi(n)?zs(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,au())),vt(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(zs(n),h!==null?(vt(n),yv(n,h)):(vt(n),Ku(n,f,null,l,a))):h?h!==e.memoizedState?(zs(n),vt(n),yv(n,h)):(vt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&zs(n),vt(n),Ku(n,f,e,l,a)),null;case 27:if(se(n),a=_e.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&zs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return vt(n),null}e=ze.current,Wi(n)?Wh(n):(e=w0(f,l,a),n.stateNode=e,zs(n))}return vt(n),null;case 5:if(se(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&zs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return vt(n),null}if(h=ze.current,Wi(n))Wh(n);else{var x=pc(_e.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?x.createElement(f,{is:l.is}):x.createElement(f)}}h[ht]=n,h[Wt]=l;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(on(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&&zs(n)}}return vt(n),Ku(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&zs(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=_e.current,Wi(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=nn,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[ht]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||m0(e.nodeValue,a)),e||da(n,!0)}else e=pc(e).createTextNode(l),e[ht]=n,n.stateNode=e}return vt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=Wi(n),a!==null){if(e===null){if(!l)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[ht]=n}else ni(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;vt(n),e=!1}else a=au(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Cn(n),n):(Cn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return vt(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=Wi(n),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(r(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[ht]=n}else ni(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;vt(n),f=!1}else f=au(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Cn(n),n):(Cn(n),null)}return Cn(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),Xl(n,n.updateQueue),vt(n),null);case 4:return mt(),e===null&&vf(n.stateNode.containerInfo),vt(n),null;case 10:return Is(n.type),vt(n),null;case 19:if(ke(It),l=n.memoizedState,l===null)return vt(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)fr(l,!1);else{if(Et!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Ul(e),h!==null){for(n.flags|=128,fr(l,!1),e=h.updateQueue,n.updateQueue=e,Xl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Fh(a,e),a=a.sibling;return Ce(It,It.current&1|2),Ge&&Rs(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Kt()>sc&&(n.flags|=128,f=!0,fr(l,!1),n.lanes=4194304)}else{if(!f)if(e=Ul(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Xl(n,e),fr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Ge)return vt(n),null}else 2*Kt()-l.renderingStartTime>sc&&a!==536870912&&(n.flags|=128,f=!0,fr(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=Kt(),e.sibling=null,a=It.current,Ce(It,f?a&1|2:a&1),Ge&&Rs(n,l.treeForkCount),e):(vt(n),null);case 22:case 23:return Cn(n),vu(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(a&536870912)!==0&&(n.flags&128)===0&&(vt(n),n.subtreeFlags&6&&(n.flags|=8192)):vt(n),a=n.updateQueue,a!==null&&Xl(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&&ke(ii),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Is(Ut),vt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function eS(e,n){switch(nu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Is(Ut),mt(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return se(n),null;case 31:if(n.memoizedState!==null){if(Cn(n),n.alternate===null)throw Error(r(340));ni()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Cn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ni()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return ke(It),null;case 4:return mt(),null;case 10:return Is(n.type),null;case 22:case 23:return Cn(n),vu(),e!==null&&ke(ii),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Is(Ut),null;case 25:return null;default:return null}}function bv(e,n){switch(nu(n),n.tag){case 3:Is(Ut),mt();break;case 26:case 27:case 5:se(n);break;case 4:mt();break;case 31:n.memoizedState!==null&&Cn(n);break;case 13:Cn(n);break;case 19:ke(It);break;case 10:Is(n.type);break;case 22:case 23:Cn(n),vu(),e!==null&&ke(ii);break;case 24:Is(Ut)}}function pr(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,x=a.inst;l=h(),x.destroy=l}a=a.next}while(a!==f)}}catch(j){at(n,n.return,j)}}function va(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 x=l.inst,j=x.destroy;if(j!==void 0){x.destroy=void 0,f=n;var R=a,q=j;try{q()}catch(W){at(f,R,W)}}}l=l.next}while(l!==h)}}catch(W){at(n,n.return,W)}}function _v(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{dg(n,a)}catch(l){at(e,e.return,l)}}}function xv(e,n,a){a.props=di(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){at(e,n,l)}}function mr(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(f){at(e,n,f)}}function ys(e,n){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){at(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){at(e,n,f)}else a.current=null}function kv(e){var n=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){at(e,e.return,f)}}function Yu(e,n,a){try{var l=e.stateNode;kS(l,e.type,a,n),l[Wt]=n}catch(f){at(e,e.return,f)}}function Sv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ta(e.type)||e.tag===4}function Ju(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Sv(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&&Ta(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 Wu(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=Es));else if(l!==4&&(l===27&&Ta(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Wu(e,n,a),e=e.sibling;e!==null;)Wu(e,n,a),e=e.sibling}function Ql(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&&Ta(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Ql(e,n,a),e=e.sibling;e!==null;)Ql(e,n,a),e=e.sibling}function Tv(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);on(n,l,a),n[ht]=e,n[Wt]=a}catch(h){at(e,e.return,h)}}var Us=!1,Ht=!1,Xu=!1,wv=typeof WeakSet=="function"?WeakSet:Set,Qt=null;function tS(e,n){if(e=e.containerInfo,_f=_c,e=Bh(e),Gd(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 x=0,j=-1,R=-1,q=0,W=0,ee=e,G=null;t:for(;;){for(var Z;ee!==a||f!==0&&ee.nodeType!==3||(j=x+f),ee!==h||l!==0&&ee.nodeType!==3||(R=x+l),ee.nodeType===3&&(x+=ee.nodeValue.length),(Z=ee.firstChild)!==null;)G=ee,ee=Z;for(;;){if(ee===e)break t;if(G===a&&++q===f&&(j=x),G===h&&++W===l&&(R=x),(Z=ee.nextSibling)!==null)break;ee=G,G=ee.parentNode}ee=Z}a=j===-1||R===-1?null:{start:j,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(xf={focusedElem:e,selectionRange:a},_c=!1,Qt=n;Qt!==null;)if(n=Qt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Qt=e;else for(;Qt!==null;){switch(n=Qt,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 ve=di(a.type,f);e=l.getSnapshotBeforeUpdate(ve,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(je){at(a,a.return,je)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Tf(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Tf(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,Qt=e;break}Qt=n.return}}function jv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Ps(e,a),l&4&&pr(5,a);break;case 1:if(Ps(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){at(a,a.return,x)}else{var f=di(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){at(a,a.return,x)}}l&64&&_v(a),l&512&&mr(a,a.return);break;case 3:if(Ps(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{dg(e,n)}catch(x){at(a,a.return,x)}}break;case 27:n===null&&l&4&&Tv(a);case 26:case 5:Ps(e,a),n===null&&l&4&&kv(a),l&512&&mr(a,a.return);break;case 12:Ps(e,a);break;case 31:Ps(e,a),l&4&&Ev(e,a);break;case 13:Ps(e,a),l&4&&Av(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=dS.bind(null,a),AS(e,a))));break;case 22:if(l=a.memoizedState!==null||Us,!l){n=n!==null&&n.memoizedState!==null||Ht,f=Us;var h=Ht;Us=l,(Ht=n)&&!h?Hs(e,a,(a.subtreeFlags&8772)!==0):Ps(e,a),Us=f,Ht=h}break;case 30:break;default:Ps(e,a)}}function Nv(e){var n=e.alternate;n!==null&&(e.alternate=null,Nv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Cd(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 St=null,bn=!1;function $s(e,n,a){for(a=a.child;a!==null;)Cv(e,n,a),a=a.sibling}function Cv(e,n,a){if(kt&&typeof kt.onCommitFiberUnmount=="function")try{kt.onCommitFiberUnmount(Yt,a)}catch{}switch(a.tag){case 26:Ht||ys(a,n),$s(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ht||ys(a,n);var l=St,f=bn;Ta(a.type)&&(St=a.stateNode,bn=!1),$s(e,n,a),Sr(a.stateNode),St=l,bn=f;break;case 5:Ht||ys(a,n);case 6:if(l=St,f=bn,St=null,$s(e,n,a),St=l,bn=f,St!==null)if(bn)try{(St.nodeType===9?St.body:St.nodeName==="HTML"?St.ownerDocument.body:St).removeChild(a.stateNode)}catch(h){at(a,n,h)}else try{St.removeChild(a.stateNode)}catch(h){at(a,n,h)}break;case 18:St!==null&&(bn?(e=St,_0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),bo(e)):_0(St,a.stateNode));break;case 4:l=St,f=bn,St=a.stateNode.containerInfo,bn=!0,$s(e,n,a),St=l,bn=f;break;case 0:case 11:case 14:case 15:va(2,a,n),Ht||va(4,a,n),$s(e,n,a);break;case 1:Ht||(ys(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&xv(a,n,l)),$s(e,n,a);break;case 21:$s(e,n,a);break;case 22:Ht=(l=Ht)||a.memoizedState!==null,$s(e,n,a),Ht=l;break;default:$s(e,n,a)}}function Ev(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{bo(e)}catch(a){at(n,n.return,a)}}}function Av(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{bo(e)}catch(a){at(n,n.return,a)}}function nS(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new wv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new wv),n;default:throw Error(r(435,e.tag))}}function ec(e,n){var a=nS(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=uS.bind(null,e,l);l.then(f,f)}})}function _n(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],h=e,x=n,j=x;e:for(;j!==null;){switch(j.tag){case 27:if(Ta(j.type)){St=j.stateNode,bn=!1;break e}break;case 5:St=j.stateNode,bn=!1;break e;case 3:case 4:St=j.stateNode.containerInfo,bn=!0;break e}j=j.return}if(St===null)throw Error(r(160));Cv(h,x,f),St=null,bn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Dv(n,e),n=n.sibling}var as=null;function Dv(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:_n(n,e),xn(e),l&4&&(va(3,e,e.return),pr(3,e),va(5,e,e.return));break;case 1:_n(n,e),xn(e),l&512&&(Ht||a===null||ys(a,a.return)),l&64&&Us&&(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=as;if(_n(n,e),xn(e),l&512&&(Ht||a===null||ys(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[Po]||h[ht]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),on(h,l,a),h[ht]=e,Xt(h),l=h;break e;case"link":var x=D0("link","href",f).get(l+(a.href||""));if(x){for(var j=0;j<x.length;j++)if(h=x[j],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)){x.splice(j,1);break t}}h=f.createElement(l),on(h,l,a),f.head.appendChild(h);break;case"meta":if(x=D0("meta","content",f).get(l+(a.content||""))){for(j=0;j<x.length;j++)if(h=x[j],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)){x.splice(j,1);break t}}h=f.createElement(l),on(h,l,a),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[ht]=e,Xt(h),l=h}e.stateNode=l}else R0(f,e.type,e.stateNode);else e.stateNode=A0(f,l,e.memoizedProps);else h!==l?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,l===null?R0(f,e.type,e.stateNode):A0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Yu(e,e.memoizedProps,a.memoizedProps)}break;case 27:_n(n,e),xn(e),l&512&&(Ht||a===null||ys(a,a.return)),a!==null&&l&4&&Yu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(_n(n,e),xn(e),l&512&&(Ht||a===null||ys(a,a.return)),e.flags&32){f=e.stateNode;try{Pi(f,"")}catch(ve){at(e,e.return,ve)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,Yu(e,f,a!==null?a.memoizedProps:f)),l&1024&&(Xu=!0);break;case 6:if(_n(n,e),xn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(ve){at(e,e.return,ve)}}break;case 3:if(gc=null,f=as,as=mc(n.containerInfo),_n(n,e),as=f,xn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{bo(n.containerInfo)}catch(ve){at(e,e.return,ve)}Xu&&(Xu=!1,Rv(e));break;case 4:l=as,as=mc(e.stateNode.containerInfo),_n(n,e),xn(e),as=l;break;case 12:_n(n,e),xn(e);break;case 31:_n(n,e),xn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ec(e,l)));break;case 13:_n(n,e),xn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(nc=Kt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ec(e,l)));break;case 22:f=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,q=Us,W=Ht;if(Us=q||f,Ht=W||R,_n(n,e),Ht=W,Us=q,xn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||R||Us||Ht||ui(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(h=R.stateNode,f)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{j=R.stateNode;var ee=R.memoizedProps.style,G=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;j.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(ve){at(R,R.return,ve)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(ve){at(R,R.return,ve)}}}else if(n.tag===18){if(a===null){R=n;try{var Z=R.stateNode;f?x0(Z,!0):x0(R.stateNode,!1)}catch(ve){at(R,R.return,ve)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,ec(e,a))));break;case 19:_n(n,e),xn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ec(e,l)));break;case 30:break;case 21:break;default:_n(n,e),xn(e)}}function xn(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(Sv(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,h=Ju(e);Ql(e,h,f);break;case 5:var x=a.stateNode;a.flags&32&&(Pi(x,""),a.flags&=-33);var j=Ju(e);Ql(e,j,x);break;case 3:case 4:var R=a.stateNode.containerInfo,q=Ju(e);Wu(e,q,R);break;default:throw Error(r(161))}}catch(W){at(e,e.return,W)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Rv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Rv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Ps(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)jv(e,n.alternate,n),n=n.sibling}function ui(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:va(4,n,n.return),ui(n);break;case 1:ys(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&xv(n,n.return,a),ui(n);break;case 27:Sr(n.stateNode);case 26:case 5:ys(n,n.return),ui(n);break;case 22:n.memoizedState===null&&ui(n);break;case 30:ui(n);break;default:ui(n)}e=e.sibling}}function Hs(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:Hs(f,h,a),pr(4,h);break;case 1:if(Hs(f,h,a),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(q){at(l,l.return,q)}if(l=h,f=l.updateQueue,f!==null){var j=l.stateNode;try{var R=f.shared.hiddenCallbacks;if(R!==null)for(f.shared.hiddenCallbacks=null,f=0;f<R.length;f++)cg(R[f],j)}catch(q){at(l,l.return,q)}}a&&x&64&&_v(h),mr(h,h.return);break;case 27:Tv(h);case 26:case 5:Hs(f,h,a),a&&l===null&&x&4&&kv(h),mr(h,h.return);break;case 12:Hs(f,h,a);break;case 31:Hs(f,h,a),a&&x&4&&Ev(f,h);break;case 13:Hs(f,h,a),a&&x&4&&Av(f,h);break;case 22:h.memoizedState===null&&Hs(f,h,a),mr(h,h.return);break;case 30:break;default:Hs(f,h,a)}n=n.sibling}}function Qu(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&&er(a))}function ef(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&er(e))}function is(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Mv(e,n,a,l),n=n.sibling}function Mv(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:is(e,n,a,l),f&2048&&pr(9,n);break;case 1:is(e,n,a,l);break;case 3:is(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&&er(e)));break;case 12:if(f&2048){is(e,n,a,l),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,j=h.onPostCommit;typeof j=="function"&&j(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){at(n,n.return,R)}}else is(e,n,a,l);break;case 31:is(e,n,a,l);break;case 13:is(e,n,a,l);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?is(e,n,a,l):hr(e,n):h._visibility&2?is(e,n,a,l):(h._visibility|=2,ro(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Qu(x,n);break;case 24:is(e,n,a,l),f&2048&&ef(n.alternate,n);break;default:is(e,n,a,l)}}function ro(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,j=a,R=l,q=x.flags;switch(x.tag){case 0:case 11:case 15:ro(h,x,j,R,f),pr(8,x);break;case 23:break;case 22:var W=x.stateNode;x.memoizedState!==null?W._visibility&2?ro(h,x,j,R,f):hr(h,x):(W._visibility|=2,ro(h,x,j,R,f)),f&&q&2048&&Qu(x.alternate,x);break;case 24:ro(h,x,j,R,f),f&&q&2048&&ef(x.alternate,x);break;default:ro(h,x,j,R,f)}n=n.sibling}}function hr(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:hr(a,l),f&2048&&Qu(l.alternate,l);break;case 24:hr(a,l),f&2048&&ef(l.alternate,l);break;default:hr(a,l)}n=n.sibling}}var gr=8192;function lo(e,n,a){if(e.subtreeFlags&gr)for(e=e.child;e!==null;)Iv(e,n,a),e=e.sibling}function Iv(e,n,a){switch(e.tag){case 26:lo(e,n,a),e.flags&gr&&e.memoizedState!==null&&HS(a,as,e.memoizedState,e.memoizedProps);break;case 5:lo(e,n,a);break;case 3:case 4:var l=as;as=mc(e.stateNode.containerInfo),lo(e,n,a),as=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=gr,gr=16777216,lo(e,n,a),gr=l):lo(e,n,a));break;default:lo(e,n,a)}}function Ov(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 vr(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];Qt=l,Bv(l,e)}Ov(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Lv(e),e=e.sibling}function Lv(e){switch(e.tag){case 0:case 11:case 15:vr(e),e.flags&2048&&va(9,e,e.return);break;case 3:vr(e);break;case 12:vr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,tc(e)):vr(e);break;default:vr(e)}}function tc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];Qt=l,Bv(l,e)}Ov(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:va(8,n,n.return),tc(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,tc(n));break;default:tc(n)}e=e.sibling}}function Bv(e,n){for(;Qt!==null;){var a=Qt;switch(a.tag){case 0:case 11:case 15:va(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:er(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Qt=l;else e:for(a=e;Qt!==null;){l=Qt;var f=l.sibling,h=l.return;if(Nv(l),l===a){Qt=null;break e}if(f!==null){f.return=h,Qt=f;break e}Qt=h}}}var sS={getCacheForType:function(e){var n=sn(Ut),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return sn(Ut).controller.signal}},aS=typeof WeakMap=="function"?WeakMap:Map,tt=0,dt=null,Ue=null,He=0,st=0,En=null,ya=!1,co=!1,tf=!1,Vs=0,Et=0,ba=0,fi=0,nf=0,An=0,uo=0,yr=null,kn=null,sf=!1,nc=0,zv=0,sc=1/0,ac=null,_a=null,Gt=0,xa=null,fo=null,qs=0,af=0,of=null,Uv=null,br=0,rf=null;function Dn(){return(tt&2)!==0&&He!==0?He&-He:A.T!==null?pf():tn()}function $v(){if(An===0)if((He&536870912)===0||Ge){var e=Ka;Ka<<=1,(Ka&3932160)===0&&(Ka=262144),An=e}else An=536870912;return e=Nn.current,e!==null&&(e.flags|=32),An}function Sn(e,n,a){(e===dt&&(st===2||st===9)||e.cancelPendingCommit!==null)&&(po(e,0),ka(e,He,An,!1)),Pe(e,a),((tt&2)===0||e!==dt)&&(e===dt&&((tt&2)===0&&(fi|=a),Et===4&&ka(e,He,An,!1)),bs(e))}function Pv(e,n,a){if((tt&6)!==0)throw Error(r(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||ne(e,n),f=l?rS(e,n):cf(e,n,!0),h=l;do{if(f===0){co&&!l&&ka(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!iS(a)){f=cf(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var j=e;f=yr;var R=j.current.memoizedState.isDehydrated;if(R&&(po(j,x).flags|=256),x=cf(j,x,!1),x!==2){if(tf&&!R){j.errorRecoveryDisabledLanes|=h,fi|=h,f=4;break e}h=kn,kn=f,h!==null&&(kn===null?kn=h:kn.push.apply(kn,h))}f=x}if(h=!1,f!==2)continue}}if(f===1){po(e,0),ka(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:ka(l,n,An,!ya);break e;case 2:kn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=nc+300-Kt(),10<f)){if(ka(l,n,An,!ya),H(l,0,!0)!==0)break e;qs=n,l.timeoutHandle=y0(Hv.bind(null,l,a,kn,ac,sf,n,An,fi,uo,ya,h,"Throttled",-0,0),f);break e}Hv(l,a,kn,ac,sf,n,An,fi,uo,ya,h,null,-0,0)}}break}while(!0);bs(e)}function Hv(e,n,a,l,f,h,x,j,R,q,W,ee,G,Z){if(e.timeoutHandle=-1,ee=n.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Es},Iv(n,h,ee);var ve=(h&62914560)===h?nc-Kt():(h&4194048)===h?zv-Kt():0;if(ve=VS(ee,ve),ve!==null){qs=h,e.cancelPendingCommit=ve(Jv.bind(null,e,n,h,a,l,f,x,j,R,W,ee,null,G,Z)),ka(e,h,x,!q);return}}Jv(e,n,h,a,l,f,x,j,R)}function iS(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 ka(e,n,a,l){n&=~nf,n&=~fi,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-Jt(f),x=1<<h;l[h]=-1,f&=~x}a!==0&&Me(e,a,n)}function ic(){return(tt&6)===0?(_r(0),!1):!0}function lf(){if(Ue!==null){if(st===0)var e=Ue.return;else e=Ue,Ms=si=null,Su(e),no=null,nr=0,e=Ue;for(;e!==null;)bv(e.alternate,e),e=e.return;Ue=null}}function po(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,wS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),qs=0,lf(),dt=e,Ue=a=Ds(e.current,null),He=n,st=0,En=null,ya=!1,co=ne(e,n),tf=!1,uo=An=nf=fi=ba=Et=0,kn=yr=null,sf=!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-Jt(l),h=1<<f;n|=e[f],l&=~h}return Vs=n,jl(),a}function Vv(e,n){Ie=null,A.H=dr,n===to||n===Il?(n=ig(),st=3):n===uu?(n=ig(),st=4):st=n===Uu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,En=n,Ue===null&&(Et=1,Kl(e,Pn(n,e.current)))}function qv(){var e=Nn.current;return e===null?!0:(He&4194048)===He?Gn===null:(He&62914560)===He||(He&536870912)!==0?e===Gn:!1}function Gv(){var e=A.H;return A.H=dr,e===null?dr:e}function Fv(){var e=A.A;return A.A=sS,e}function oc(){Et=4,ya||(He&4194048)!==He&&Nn.current!==null||(co=!0),(ba&134217727)===0&&(fi&134217727)===0||dt===null||ka(dt,He,An,!1)}function cf(e,n,a){var l=tt;tt|=2;var f=Gv(),h=Fv();(dt!==e||He!==n)&&(ac=null,po(e,n)),n=!1;var x=Et;e:do try{if(st!==0&&Ue!==null){var j=Ue,R=En;switch(st){case 8:lf(),x=6;break e;case 3:case 2:case 9:case 6:Nn.current===null&&(n=!0);var q=st;if(st=0,En=null,mo(e,j,R,q),a&&co){x=0;break e}break;default:q=st,st=0,En=null,mo(e,j,R,q)}}oS(),x=Et;break}catch(W){Vv(e,W)}while(!0);return n&&e.shellSuspendCounter++,Ms=si=null,tt=l,A.H=f,A.A=h,Ue===null&&(dt=null,He=0,jl()),x}function oS(){for(;Ue!==null;)Zv(Ue)}function rS(e,n){var a=tt;tt|=2;var l=Gv(),f=Fv();dt!==e||He!==n?(ac=null,sc=Kt()+500,po(e,n)):co=ne(e,n);e:do try{if(st!==0&&Ue!==null){n=Ue;var h=En;t:switch(st){case 1:st=0,En=null,mo(e,n,h,1);break;case 2:case 9:if(sg(h)){st=0,En=null,Kv(n);break}n=function(){st!==2&&st!==9||dt!==e||(st=7),bs(e)},h.then(n,n);break e;case 3:st=7;break e;case 4:st=5;break e;case 7:sg(h)?(st=0,En=null,Kv(n)):(st=0,En=null,mo(e,n,h,7));break;case 5:var x=null;switch(Ue.tag){case 26:x=Ue.memoizedState;case 5:case 27:var j=Ue;if(x?M0(x):j.stateNode.complete){st=0,En=null;var R=j.sibling;if(R!==null)Ue=R;else{var q=j.return;q!==null?(Ue=q,rc(q)):Ue=null}break t}}st=0,En=null,mo(e,n,h,5);break;case 6:st=0,En=null,mo(e,n,h,6);break;case 8:lf(),Et=6;break e;default:throw Error(r(462))}}lS();break}catch(W){Vv(e,W)}while(!0);return Ms=si=null,A.H=l,A.A=f,tt=a,Ue!==null?0:(dt=null,He=0,jl(),Et)}function lS(){for(;Ue!==null&&!Ga();)Zv(Ue)}function Zv(e){var n=vv(e.alternate,e,Vs);e.memoizedProps=e.pendingProps,n===null?rc(e):Ue=n}function Kv(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=uv(a,n,n.pendingProps,n.type,void 0,He);break;case 11:n=uv(a,n,n.pendingProps,n.type.render,n.ref,He);break;case 5:Su(n);default:bv(a,n),n=Ue=Fh(n,Vs),n=vv(a,n,Vs)}e.memoizedProps=e.pendingProps,n===null?rc(e):Ue=n}function mo(e,n,a,l){Ms=si=null,Su(n),no=null,nr=0;var f=n.return;try{if(Jk(e,f,n,a,He)){Et=1,Kl(e,Pn(a,e.current)),Ue=null;return}}catch(h){if(f!==null)throw Ue=f,h;Et=1,Kl(e,Pn(a,e.current)),Ue=null;return}n.flags&32768?(Ge||l===1?e=!0:co||(He&536870912)!==0?e=!1:(ya=e=!0,(l===2||l===9||l===3||l===6)&&(l=Nn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Yv(n,e)):rc(n)}function rc(e){var n=e;do{if((n.flags&32768)!==0){Yv(n,ya);return}e=n.return;var a=Qk(n.alternate,n,Vs);if(a!==null){Ue=a;return}if(n=n.sibling,n!==null){Ue=n;return}Ue=n=e}while(n!==null);Et===0&&(Et=5)}function Yv(e,n){do{var a=eS(e.alternate,e);if(a!==null){a.flags&=32767,Ue=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Ue=e;return}Ue=e=a}while(e!==null);Et=6,Ue=null}function Jv(e,n,a,l,f,h,x,j,R){e.cancelPendingCommit=null;do lc();while(Gt!==0);if((tt&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(h=n.lanes|n.childLanes,h|=Jd,Se(e,a,h,x,j,R),e===dt&&(Ue=dt=null,He=0),fo=n,xa=e,qs=a,af=h,of=f,Uv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,fS(ns,function(){return t0(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=A.T,A.T=null,f=F.p,F.p=2,x=tt,tt|=4;try{tS(e,n,a)}finally{tt=x,F.p=f,A.T=l}}Gt=1,Wv(),Xv(),Qv()}}function Wv(){if(Gt===1){Gt=0;var e=xa,n=fo,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=A.T,A.T=null;var l=F.p;F.p=2;var f=tt;tt|=4;try{Dv(n,e);var h=xf,x=Bh(e.containerInfo),j=h.focusedElem,R=h.selectionRange;if(x!==j&&j&&j.ownerDocument&&Lh(j.ownerDocument.documentElement,j)){if(R!==null&&Gd(j)){var q=R.start,W=R.end;if(W===void 0&&(W=q),"selectionStart"in j)j.selectionStart=q,j.selectionEnd=Math.min(W,j.value.length);else{var ee=j.ownerDocument||document,G=ee&&ee.defaultView||window;if(G.getSelection){var Z=G.getSelection(),ve=j.textContent.length,je=Math.min(R.start,ve),lt=R.end===void 0?je:Math.min(R.end,ve);!Z.extend&&je>lt&&(x=lt,lt=je,je=x);var U=Oh(j,je),B=Oh(j,lt);if(U&&B&&(Z.rangeCount!==1||Z.anchorNode!==U.node||Z.anchorOffset!==U.offset||Z.focusNode!==B.node||Z.focusOffset!==B.offset)){var V=ee.createRange();V.setStart(U.node,U.offset),Z.removeAllRanges(),je>lt?(Z.addRange(V),Z.extend(B.node,B.offset)):(V.setEnd(B.node,B.offset),Z.addRange(V))}}}}for(ee=[],Z=j;Z=Z.parentNode;)Z.nodeType===1&&ee.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<ee.length;j++){var Q=ee[j];Q.element.scrollLeft=Q.left,Q.element.scrollTop=Q.top}}_c=!!_f,xf=_f=null}finally{tt=f,F.p=l,A.T=a}}e.current=n,Gt=2}}function Xv(){if(Gt===2){Gt=0;var e=xa,n=fo,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=A.T,A.T=null;var l=F.p;F.p=2;var f=tt;tt|=4;try{jv(e,n.alternate,n)}finally{tt=f,F.p=l,A.T=a}}Gt=3}}function Qv(){if(Gt===4||Gt===3){Gt=0,ia();var e=xa,n=fo,a=qs,l=Uv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Gt=5:(Gt=0,fo=xa=null,e0(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(_a=null),qt(a),n=n.stateNode,kt&&typeof kt.onCommitFiberRoot=="function")try{kt.onCommitFiberRoot(Yt,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=A.T,f=F.p,F.p=2,A.T=null;try{for(var h=e.onRecoverableError,x=0;x<l.length;x++){var j=l[x];h(j.value,{componentStack:j.stack})}}finally{A.T=n,F.p=f}}(qs&3)!==0&&lc(),bs(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===rf?br++:(br=0,rf=e):br=0,_r(0)}}function e0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,er(n)))}function lc(){return Wv(),Xv(),Qv(),t0()}function t0(){if(Gt!==5)return!1;var e=xa,n=af;af=0;var a=qt(qs),l=A.T,f=F.p;try{F.p=32>a?32:a,A.T=null,a=of,of=null;var h=xa,x=qs;if(Gt=0,fo=xa=null,qs=0,(tt&6)!==0)throw Error(r(331));var j=tt;if(tt|=4,Lv(h.current),Mv(h,h.current,x,a),tt=j,_r(0,!1),kt&&typeof kt.onPostCommitFiberRoot=="function")try{kt.onPostCommitFiberRoot(Yt,h)}catch{}return!0}finally{F.p=f,A.T=l,e0(e,n)}}function n0(e,n,a){n=Pn(a,n),n=zu(e.stateNode,n,2),e=ma(e,n,2),e!==null&&(Pe(e,2),bs(e))}function at(e,n,a){if(e.tag===3)n0(e,e,a);else for(;n!==null;){if(n.tag===3){n0(n,e,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(_a===null||!_a.has(l))){e=Pn(a,e),a=sv(2),l=ma(n,a,2),l!==null&&(av(a,l,n,e),Pe(l,2),bs(l));break}}n=n.return}}function df(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new aS;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)||(tf=!0,f.add(a),e=cS.bind(null,e,n,a),n.then(e,e))}function cS(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,dt===e&&(He&a)===a&&(Et===4||Et===3&&(He&62914560)===He&&300>Kt()-nc?(tt&2)===0&&po(e,0):nf|=a,uo===He&&(uo=0)),bs(e)}function s0(e,n){n===0&&(n=fe()),e=ei(e,n),e!==null&&(Pe(e,n),bs(e))}function dS(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),s0(e,a)}function uS(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),s0(e,a)}function fS(e,n){return aa(e,n)}var cc=null,ho=null,uf=!1,dc=!1,ff=!1,Sa=0;function bs(e){e!==ho&&e.next===null&&(ho===null?cc=ho=e:ho=ho.next=e),dc=!0,uf||(uf=!0,mS())}function _r(e,n){if(!ff&&dc){ff=!0;do for(var a=!1,l=cc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var x=l.suspendedLanes,j=l.pingedLanes;h=(1<<31-Jt(42|e)+1)-1,h&=f&~(x&~j),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,r0(l,h))}else h=He,h=H(l,l===dt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||ne(l,h)||(a=!0,r0(l,h));l=l.next}while(a);ff=!1}}function pS(){a0()}function a0(){dc=uf=!1;var e=0;Sa!==0&&TS()&&(e=Sa);for(var n=Kt(),a=null,l=cc;l!==null;){var f=l.next,h=i0(l,n);h===0?(l.next=null,a===null?cc=f:a.next=f,f===null&&(ho=a)):(a=l,(e!==0||(h&3)!==0)&&(dc=!0)),l=f}Gt!==0&&Gt!==5||_r(e),Sa!==0&&(Sa=0)}function i0(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-Jt(h),j=1<<x,R=f[x];R===-1?((j&a)===0||(j&l)!==0)&&(f[x]=le(j,n)):R<=n&&(e.expiredLanes|=j),h&=~j}if(n=dt,a=He,a=H(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(st===2||st===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&ts(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ne(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&ts(l),qt(a)){case 2:case 8:a=Fa;break;case 32:a=ns;break;case 268435456:a=Bn;break;default:a=ns}return l=o0.bind(null,e),a=aa(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&ts(l),e.callbackPriority=2,e.callbackNode=null,2}function o0(e,n){if(Gt!==0&&Gt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(lc()&&e.callbackNode!==a)return null;var l=He;return l=H(e,e===dt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Pv(e,l,n),i0(e,Kt()),e.callbackNode!=null&&e.callbackNode===a?o0.bind(null,e):null)}function r0(e,n){if(lc())return null;Pv(e,n,!0)}function mS(){jS(function(){(tt&6)!==0?aa(oa,pS):a0()})}function pf(){if(Sa===0){var e=Qi;e===0&&(e=Za,Za<<=1,(Za&261888)===0&&(Za=256)),Sa=e}return Sa}function l0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:yl(""+e)}function c0(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 hS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var h=l0((f[Wt]||null).action),x=l.submitter;x&&(n=(n=x[Wt]||null)?l0(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var j=new kl("action","action",null,l,f);e.push({event:j,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Sa!==0){var R=x?c0(f,x):new FormData(f);Ru(a,{pending:!0,data:R,method:f.method,action:h},null,R)}}else typeof h=="function"&&(j.preventDefault(),R=x?c0(f,x):new FormData(f),Ru(a,{pending:!0,data:R,method:f.method,action:h},h,R))},currentTarget:f}]})}}for(var mf=0;mf<Yd.length;mf++){var hf=Yd[mf],gS=hf.toLowerCase(),vS=hf[0].toUpperCase()+hf.slice(1);ss(gS,"on"+vS)}ss($h,"onAnimationEnd"),ss(Ph,"onAnimationIteration"),ss(Hh,"onAnimationStart"),ss("dblclick","onDoubleClick"),ss("focusin","onFocus"),ss("focusout","onBlur"),ss(Mk,"onTransitionRun"),ss(Ik,"onTransitionStart"),ss(Ok,"onTransitionCancel"),ss(Vh,"onTransitionEnd"),Ui("onMouseEnter",["mouseout","mouseover"]),Ui("onMouseLeave",["mouseout","mouseover"]),Ui("onPointerEnter",["pointerout","pointerover"]),Ui("onPointerLeave",["pointerout","pointerover"]),Ja("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ja("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ja("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ja("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xr="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(" "),yS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xr));function d0(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 x=l.length-1;0<=x;x--){var j=l[x],R=j.instance,q=j.currentTarget;if(j=j.listener,R!==h&&f.isPropagationStopped())break e;h=j,f.currentTarget=q;try{h(f)}catch(W){wl(W)}f.currentTarget=null,h=R}else for(x=0;x<l.length;x++){if(j=l[x],R=j.instance,q=j.currentTarget,j=j.listener,R!==h&&f.isPropagationStopped())break e;h=j,f.currentTarget=q;try{h(f)}catch(W){wl(W)}f.currentTarget=null,h=R}}}}function $e(e,n){var a=n[Nd];a===void 0&&(a=n[Nd]=new Set);var l=e+"__bubble";a.has(l)||(u0(n,e,2,!1),a.add(l))}function gf(e,n,a){var l=0;n&&(l|=4),u0(a,e,l,n)}var uc="_reactListening"+Math.random().toString(36).slice(2);function vf(e){if(!e[uc]){e[uc]=!0,ah.forEach(function(a){a!=="selectionchange"&&(yS.has(a)||gf(a,!1,e),gf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[uc]||(n[uc]=!0,gf("selectionchange",!1,n))}}function u0(e,n,a,l){switch($0(n)){case 2:var f=FS;break;case 8:f=ZS;break;default:f=Rf}a=f.bind(null,n,a,e),f=void 0,!Ld||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 yf(e,n,a,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var j=l.stateNode.containerInfo;if(j===f)break;if(x===4)for(x=l.return;x!==null;){var R=x.tag;if((R===3||R===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;j!==null;){if(x=Li(j),x===null)return;if(R=x.tag,R===5||R===6||R===26||R===27){l=h=x;continue e}j=j.parentNode}}l=l.return}gh(function(){var q=h,W=Id(a),ee=[];e:{var G=qh.get(e);if(G!==void 0){var Z=kl,ve=e;switch(e){case"keypress":if(_l(a)===0)break e;case"keydown":case"keyup":Z=uk;break;case"focusin":ve="focus",Z=$d;break;case"focusout":ve="blur",Z=$d;break;case"beforeblur":case"afterblur":Z=$d;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Z=bh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=Q1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=mk;break;case $h:case Ph:case Hh:Z=nk;break;case Vh:Z=gk;break;case"scroll":case"scrollend":Z=W1;break;case"wheel":Z=yk;break;case"copy":case"cut":case"paste":Z=ak;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=xh;break;case"toggle":case"beforetoggle":Z=_k}var je=(n&4)!==0,lt=!je&&(e==="scroll"||e==="scrollend"),U=je?G!==null?G+"Capture":null:G;je=[];for(var B=q,V;B!==null;){var Q=B;if(V=Q.stateNode,Q=Q.tag,Q!==5&&Q!==26&&Q!==27||V===null||U===null||(Q=Vo(B,U),Q!=null&&je.push(kr(B,Q,V))),lt)break;B=B.return}0<je.length&&(G=new Z(G,ve,null,a,W),ee.push({event:G,listeners:je}))}}if((n&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",Z=e==="mouseout"||e==="pointerout",G&&a!==Md&&(ve=a.relatedTarget||a.fromElement)&&(Li(ve)||ve[Oi]))break e;if((Z||G)&&(G=W.window===W?W:(G=W.ownerDocument)?G.defaultView||G.parentWindow:window,Z?(ve=a.relatedTarget||a.toElement,Z=q,ve=ve?Li(ve):null,ve!==null&&(lt=d(ve),je=ve.tag,ve!==lt||je!==5&&je!==27&&je!==6)&&(ve=null)):(Z=null,ve=q),Z!==ve)){if(je=bh,Q="onMouseLeave",U="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(je=xh,Q="onPointerLeave",U="onPointerEnter",B="pointer"),lt=Z==null?G:Ho(Z),V=ve==null?G:Ho(ve),G=new je(Q,B+"leave",Z,a,W),G.target=lt,G.relatedTarget=V,Q=null,Li(W)===q&&(je=new je(U,B+"enter",ve,a,W),je.target=V,je.relatedTarget=lt,Q=je),lt=Q,Z&&ve)t:{for(je=bS,U=Z,B=ve,V=0,Q=U;Q;Q=je(Q))V++;Q=0;for(var Te=B;Te;Te=je(Te))Q++;for(;0<V-Q;)U=je(U),V--;for(;0<Q-V;)B=je(B),Q--;for(;V--;){if(U===B||B!==null&&U===B.alternate){je=U;break t}U=je(U),B=je(B)}je=null}else je=null;Z!==null&&f0(ee,G,Z,je,!1),ve!==null&&lt!==null&&f0(ee,lt,ve,je,!0)}}e:{if(G=q?Ho(q):window,Z=G.nodeName&&G.nodeName.toLowerCase(),Z==="select"||Z==="input"&&G.type==="file")var We=Eh;else if(Nh(G))if(Ah)We=Ak;else{We=Ck;var be=Nk}else Z=G.nodeName,!Z||Z.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?q&&Rd(q.elementType)&&(We=Eh):We=Ek;if(We&&(We=We(e,q))){Ch(ee,We,a,W);break e}be&&be(e,G,q),e==="focusout"&&q&&G.type==="number"&&q.memoizedProps.value!=null&&Dd(G,"number",G.value)}switch(be=q?Ho(q):window,e){case"focusin":(Nh(be)||be.contentEditable==="true")&&(Gi=be,Fd=q,Wo=null);break;case"focusout":Wo=Fd=Gi=null;break;case"mousedown":Zd=!0;break;case"contextmenu":case"mouseup":case"dragend":Zd=!1,zh(ee,a,W);break;case"selectionchange":if(Rk)break;case"keydown":case"keyup":zh(ee,a,W)}var Le;if(Hd)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 qi?wh(e,a)&&(Ve="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ve="onCompositionStart");Ve&&(kh&&a.locale!=="ko"&&(qi||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&qi&&(Le=vh()):(ra=W,Bd="value"in ra?ra.value:ra.textContent,qi=!0)),be=fc(q,Ve),0<be.length&&(Ve=new _h(Ve,e,null,a,W),ee.push({event:Ve,listeners:be}),Le?Ve.data=Le:(Le=jh(a),Le!==null&&(Ve.data=Le)))),(Le=kk?Sk(e,a):Tk(e,a))&&(Ve=fc(q,"onBeforeInput"),0<Ve.length&&(be=new _h("onBeforeInput","beforeinput",null,a,W),ee.push({event:be,listeners:Ve}),be.data=Le)),hS(ee,e,q,a,W)}d0(ee,n)})}function kr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function fc(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=Vo(e,a),f!=null&&l.unshift(kr(e,f,h)),f=Vo(e,n),f!=null&&l.push(kr(e,f,h))),e.tag===3)return l;e=e.return}return[]}function bS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function f0(e,n,a,l,f){for(var h=n._reactName,x=[];a!==null&&a!==l;){var j=a,R=j.alternate,q=j.stateNode;if(j=j.tag,R!==null&&R===l)break;j!==5&&j!==26&&j!==27||q===null||(R=q,f?(q=Vo(a,h),q!=null&&x.unshift(kr(a,q,R))):f||(q=Vo(a,h),q!=null&&x.push(kr(a,q,R)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var _S=/\r\n?/g,xS=/\u0000|\uFFFD/g;function p0(e){return(typeof e=="string"?e:""+e).replace(_S,`
26
+ `).replace(xS,"")}function m0(e,n){return n=p0(n),p0(e)===n}function rt(e,n,a,l,f,h){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Pi(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Pi(e,""+l);break;case"className":gl(e,"class",l);break;case"tabIndex":gl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":gl(e,a,l);break;case"style":mh(e,l,h);break;case"data":if(n!=="object"){gl(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=yl(""+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"&&rt(e,n,"name",f.name,f,null),rt(e,n,"formEncType",f.formEncType,f,null),rt(e,n,"formMethod",f.formMethod,f,null),rt(e,n,"formTarget",f.formTarget,f,null)):(rt(e,n,"encType",f.encType,f,null),rt(e,n,"method",f.method,f,null),rt(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=yl(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=Es);break;case"onScroll":l!=null&&$e("scroll",e);break;case"onScrollEnd":l!=null&&$e("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=yl(""+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":$e("beforetoggle",e),$e("toggle",e),hl(e,"popover",l);break;case"xlinkActuate":Cs(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Cs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Cs(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Cs(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Cs(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Cs(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Cs(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Cs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Cs(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":hl(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=Y1.get(a)||a,hl(e,a,l))}}function bf(e,n,a,l,f,h){switch(a){case"style":mh(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"?Pi(e,l):(typeof l=="number"||typeof l=="bigint")&&Pi(e,""+l);break;case"onScroll":l!=null&&$e("scroll",e);break;case"onScrollEnd":l!=null&&$e("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Es);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ih.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[Wt]||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,""):hl(e,a,l)}}}function on(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":$e("error",e),$e("load",e);var l=!1,f=!1,h;for(h in a)if(a.hasOwnProperty(h)){var x=a[h];if(x!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:rt(e,n,h,x,a,null)}}f&&rt(e,n,"srcSet",a.srcSet,a,null),l&&rt(e,n,"src",a.src,a,null);return;case"input":$e("invalid",e);var j=h=x=f=null,R=null,q=null;for(l in a)if(a.hasOwnProperty(l)){var W=a[l];if(W!=null)switch(l){case"name":f=W;break;case"type":x=W;break;case"checked":R=W;break;case"defaultChecked":q=W;break;case"value":h=W;break;case"defaultValue":j=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,n));break;default:rt(e,n,l,W,a,null)}}dh(e,h,j,R,q,x,f,!1);return;case"select":$e("invalid",e),l=x=h=null;for(f in a)if(a.hasOwnProperty(f)&&(j=a[f],j!=null))switch(f){case"value":h=j;break;case"defaultValue":x=j;break;case"multiple":l=j;default:rt(e,n,f,j,a,null)}n=h,a=x,e.multiple=!!l,n!=null?$i(e,!!l,n,!1):a!=null&&$i(e,!!l,a,!0);return;case"textarea":$e("invalid",e),h=f=l=null;for(x in a)if(a.hasOwnProperty(x)&&(j=a[x],j!=null))switch(x){case"value":l=j;break;case"defaultValue":f=j;break;case"children":h=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(r(91));break;default:rt(e,n,x,j,a,null)}fh(e,l,f,h);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(l=a[R],l!=null))switch(R){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:rt(e,n,R,l,a,null)}return;case"dialog":$e("beforetoggle",e),$e("toggle",e),$e("cancel",e),$e("close",e);break;case"iframe":case"object":$e("load",e);break;case"video":case"audio":for(l=0;l<xr.length;l++)$e(xr[l],e);break;case"image":$e("error",e),$e("load",e);break;case"details":$e("toggle",e);break;case"embed":case"source":case"link":$e("error",e),$e("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:rt(e,n,q,l,a,null)}return;default:if(Rd(n)){for(W in a)a.hasOwnProperty(W)&&(l=a[W],l!==void 0&&bf(e,n,W,l,a,void 0));return}}for(j in a)a.hasOwnProperty(j)&&(l=a[j],l!=null&&rt(e,n,j,l,a,null))}function kS(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,x=null,j=null,R=null,q=null,W=null;for(Z in a){var ee=a[Z];if(a.hasOwnProperty(Z)&&ee!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":R=ee;default:l.hasOwnProperty(Z)||rt(e,n,Z,null,l,ee)}}for(var G in l){var Z=l[G];if(ee=a[G],l.hasOwnProperty(G)&&(Z!=null||ee!=null))switch(G){case"type":h=Z;break;case"name":f=Z;break;case"checked":q=Z;break;case"defaultChecked":W=Z;break;case"value":x=Z;break;case"defaultValue":j=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(r(137,n));break;default:Z!==ee&&rt(e,n,G,Z,l,ee)}}Ad(e,x,j,R,q,W,h,f);return;case"select":Z=x=j=G=null;for(h in a)if(R=a[h],a.hasOwnProperty(h)&&R!=null)switch(h){case"value":break;case"multiple":Z=R;default:l.hasOwnProperty(h)||rt(e,n,h,null,l,R)}for(f in l)if(h=l[f],R=a[f],l.hasOwnProperty(f)&&(h!=null||R!=null))switch(f){case"value":G=h;break;case"defaultValue":j=h;break;case"multiple":x=h;default:h!==R&&rt(e,n,f,h,l,R)}n=j,a=x,l=Z,G!=null?$i(e,!!a,G,!1):!!l!=!!a&&(n!=null?$i(e,!!a,n,!0):$i(e,!!a,a?[]:"",!1));return;case"textarea":Z=G=null;for(j in a)if(f=a[j],a.hasOwnProperty(j)&&f!=null&&!l.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:rt(e,n,j,null,l,f)}for(x in l)if(f=l[x],h=a[x],l.hasOwnProperty(x)&&(f!=null||h!=null))switch(x){case"value":G=f;break;case"defaultValue":Z=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==h&&rt(e,n,x,f,l,h)}uh(e,G,Z);return;case"option":for(var ve in a)if(G=a[ve],a.hasOwnProperty(ve)&&G!=null&&!l.hasOwnProperty(ve))switch(ve){case"selected":e.selected=!1;break;default:rt(e,n,ve,null,l,G)}for(R in l)if(G=l[R],Z=a[R],l.hasOwnProperty(R)&&G!==Z&&(G!=null||Z!=null))switch(R){case"selected":e.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:rt(e,n,R,G,l,Z)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var je in a)G=a[je],a.hasOwnProperty(je)&&G!=null&&!l.hasOwnProperty(je)&&rt(e,n,je,null,l,G);for(q in l)if(G=l[q],Z=a[q],l.hasOwnProperty(q)&&G!==Z&&(G!=null||Z!=null))switch(q){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,n));break;default:rt(e,n,q,G,l,Z)}return;default:if(Rd(n)){for(var lt in a)G=a[lt],a.hasOwnProperty(lt)&&G!==void 0&&!l.hasOwnProperty(lt)&&bf(e,n,lt,void 0,l,G);for(W in l)G=l[W],Z=a[W],!l.hasOwnProperty(W)||G===Z||G===void 0&&Z===void 0||bf(e,n,W,G,l,Z);return}}for(var U in a)G=a[U],a.hasOwnProperty(U)&&G!=null&&!l.hasOwnProperty(U)&&rt(e,n,U,null,l,G);for(ee in l)G=l[ee],Z=a[ee],!l.hasOwnProperty(ee)||G===Z||G==null&&Z==null||rt(e,n,ee,G,l,Z)}function h0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function SS(){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,x=f.initiatorType,j=f.duration;if(h&&j&&h0(x)){for(x=0,j=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],q=R.startTime;if(q>j)break;var W=R.transferSize,ee=R.initiatorType;W&&h0(ee)&&(R=R.responseEnd,x+=W*(R<j?1:(j-q)/(R-q)))}if(--l,n+=8*(h+x)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var _f=null,xf=null;function pc(e){return e.nodeType===9?e:e.ownerDocument}function g0(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 v0(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 kf(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 Sf=null;function TS(){var e=window.event;return e&&e.type==="popstate"?e===Sf?!1:(Sf=e,!0):(Sf=null,!1)}var y0=typeof setTimeout=="function"?setTimeout:void 0,wS=typeof clearTimeout=="function"?clearTimeout:void 0,b0=typeof Promise=="function"?Promise:void 0,jS=typeof queueMicrotask=="function"?queueMicrotask:typeof b0<"u"?function(e){return b0.resolve(null).then(e).catch(NS)}:y0;function NS(e){setTimeout(function(){throw e})}function Ta(e){return e==="head"}function _0(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),bo(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Sr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Sr(a);for(var h=a.firstChild;h;){var x=h.nextSibling,j=h.nodeName;h[Po]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=x}}else a==="body"&&Sr(e.ownerDocument.body);a=f}while(a);bo(n)}function x0(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 Tf(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":Tf(a),Cd(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function CS(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[Po])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=Fn(e.nextSibling),e===null)break}return null}function ES(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Fn(e.nextSibling),e===null))return null;return e}function k0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Fn(e.nextSibling),e===null))return null;return e}function wf(e){return e.data==="$?"||e.data==="$~"}function jf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function AS(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 Fn(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 Nf=null;function S0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Fn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function T0(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 w0(e,n,a){switch(n=pc(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 Sr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Cd(e)}var Zn=new Map,j0=new Set;function mc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Gs=F.d;F.d={f:DS,r:RS,D:MS,C:IS,L:OS,m:LS,X:zS,S:BS,M:US};function DS(){var e=Gs.f(),n=ic();return e||n}function RS(e){var n=Bi(e);n!==null&&n.tag===5&&n.type==="form"?Vg(n):Gs.r(e)}var go=typeof document>"u"?null:document;function N0(e,n,a){var l=go;if(l&&typeof n=="string"&&n){var f=Un(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),j0.has(f)||(j0.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),on(n,"link",e),Xt(n),l.head.appendChild(n)))}}function MS(e){Gs.D(e),N0("dns-prefetch",e,null)}function IS(e,n){Gs.C(e,n),N0("preconnect",e,n)}function OS(e,n,a){Gs.L(e,n,a);var l=go;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=vo(e);break;case"script":h=yo(e)}Zn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Zn.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(Tr(h))||n==="script"&&l.querySelector(wr(h))||(n=l.createElement("link"),on(n,"link",e),Xt(n),l.head.appendChild(n)))}}function LS(e,n){Gs.m(e,n);var a=go;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=yo(e)}if(!Zn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Zn.set(h,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(wr(h)))return}l=a.createElement("link"),on(l,"link",e),Xt(l),a.head.appendChild(l)}}}function BS(e,n,a){Gs.S(e,n,a);var l=go;if(l&&e){var f=zi(l).hoistableStyles,h=vo(e);n=n||"default";var x=f.get(h);if(!x){var j={loading:0,preload:null};if(x=l.querySelector(Tr(h)))j.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Zn.get(h))&&Cf(e,a);var R=x=l.createElement("link");Xt(R),on(R,"link",e),R._p=new Promise(function(q,W){R.onload=q,R.onerror=W}),R.addEventListener("load",function(){j.loading|=1}),R.addEventListener("error",function(){j.loading|=2}),j.loading|=4,hc(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:j},f.set(h,x)}}}function zS(e,n){Gs.X(e,n);var a=go;if(a&&e){var l=zi(a).hoistableScripts,f=yo(e),h=l.get(f);h||(h=a.querySelector(wr(f)),h||(e=b({src:e,async:!0},n),(n=Zn.get(f))&&Ef(e,n),h=a.createElement("script"),Xt(h),on(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function US(e,n){Gs.M(e,n);var a=go;if(a&&e){var l=zi(a).hoistableScripts,f=yo(e),h=l.get(f);h||(h=a.querySelector(wr(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Zn.get(f))&&Ef(e,n),h=a.createElement("script"),Xt(h),on(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function C0(e,n,a,l){var f=(f=_e.current)?mc(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=vo(a.href),a=zi(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=vo(a.href);var h=zi(f).hoistableStyles,x=h.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=f.querySelector(Tr(e)))&&!h._p&&(x.instance=h,x.state.loading=5),Zn.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},Zn.set(e,a),h||$S(f,e,a,x.state))),n&&l===null)throw Error(r(528,""));return x}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=yo(a),a=zi(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 vo(e){return'href="'+Un(e)+'"'}function Tr(e){return'link[rel="stylesheet"]['+e+"]"}function E0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function $S(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}),on(n,"link",a),Xt(n),e.head.appendChild(n))}function yo(e){return'[src="'+Un(e)+'"]'}function wr(e){return"script[async]"+e}function A0(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,Xt(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Xt(l),on(l,"style",f),hc(l,a.precedence,e),n.instance=l;case"stylesheet":f=vo(a.href);var h=e.querySelector(Tr(f));if(h)return n.state.loading|=4,n.instance=h,Xt(h),h;l=E0(a),(f=Zn.get(f))&&Cf(l,f),h=(e.ownerDocument||e).createElement("link"),Xt(h);var x=h;return x._p=new Promise(function(j,R){x.onload=j,x.onerror=R}),on(h,"link",l),n.state.loading|=4,hc(h,a.precedence,e),n.instance=h;case"script":return h=yo(a.src),(f=e.querySelector(wr(h)))?(n.instance=f,Xt(f),f):(l=a,(f=Zn.get(h))&&(l=b({},a),Ef(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),Xt(f),on(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,hc(l,a.precedence,e));return n.instance}function hc(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,x=0;x<l.length;x++){var j=l[x];if(j.dataset.precedence===n)h=j;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 Cf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Ef(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var gc=null;function D0(e,n,a){if(gc===null){var l=new Map,f=gc=new Map;f.set(a,l)}else f=gc,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[Po]||h[ht]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var j=l.get(x);j?j.push(h):l.set(x,[h])}}return l}function R0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function PS(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 M0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function HS(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=vo(l.href),h=n.querySelector(Tr(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=vc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,Xt(h);return}h=n.ownerDocument||n,l=E0(l),(f=Zn.get(f))&&Cf(l,f),h=h.createElement("link"),Xt(h);var x=h;x._p=new Promise(function(j,R){x.onload=j,x.onerror=R}),on(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=vc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Af=0;function VS(e,n){return e.stylesheets&&e.count===0&&bc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&bc(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Af===0&&(Af=62500*SS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&bc(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Af?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function vc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var yc=null;function bc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,yc=new Map,n.forEach(qS,e),yc=null,vc.call(e))}function qS(e,n){if(!(n.state.loading&4)){var a=yc.get(e);if(a)var l=a.get(null);else{a=new Map,yc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var x=f[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),l=x)}l&&a.set(null,l)}f=n.instance,x=f.getAttribute("data-precedence"),h=a.get(x)||l,h===l&&a.set(null,f),a.set(x,f),this.count++,l=vc.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 jr={$$typeof:D,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function GS(e,n,a,l,f,h,x,j,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=he(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=he(0),this.hiddenUpdates=he(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function I0(e,n,a,l,f,h,x,j,R,q,W,ee){return e=new GS(e,n,a,x,R,q,W,ee,j),n=1,h===!0&&(n|=24),h=jn(3,null,null,n),e.current=h,h.stateNode=e,n=lu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:a,cache:n},fu(h),e}function O0(e){return e?(e=Ki,e):Ki}function L0(e,n,a,l,f,h){f=O0(f),l.context===null?l.context=f:l.pendingContext=f,l=pa(n),l.payload={element:a},h=h===void 0?null:h,h!==null&&(l.callback=h),a=ma(e,l,n),a!==null&&(Sn(a,e,n),ar(a,e,n))}function B0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Df(e,n){B0(e,n),(e=e.alternate)&&B0(e,n)}function z0(e){if(e.tag===13||e.tag===31){var n=ei(e,67108864);n!==null&&Sn(n,e,67108864),Df(e,67108864)}}function U0(e){if(e.tag===13||e.tag===31){var n=Dn();n=Je(n);var a=ei(e,n);a!==null&&Sn(a,e,n),Df(e,n)}}var _c=!0;function FS(e,n,a,l){var f=A.T;A.T=null;var h=F.p;try{F.p=2,Rf(e,n,a,l)}finally{F.p=h,A.T=f}}function ZS(e,n,a,l){var f=A.T;A.T=null;var h=F.p;try{F.p=8,Rf(e,n,a,l)}finally{F.p=h,A.T=f}}function Rf(e,n,a,l){if(_c){var f=Mf(l);if(f===null)yf(e,n,l,xc,a),P0(e,l);else if(YS(f,e,n,a,l))l.stopPropagation();else if(P0(e,l),n&4&&-1<KS.indexOf(e)){for(;f!==null;){var h=Bi(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=Ns(h.pendingLanes);if(x!==0){var j=h;for(j.pendingLanes|=2,j.entangledLanes|=2;x;){var R=1<<31-Jt(x);j.entanglements[1]|=R,x&=~R}bs(h),(tt&6)===0&&(sc=Kt()+500,_r(0))}}break;case 31:case 13:j=ei(h,2),j!==null&&Sn(j,h,2),ic(),Df(h,2)}if(h=Mf(l),h===null&&yf(e,n,l,xc,a),h===f)break;f=h}f!==null&&l.stopPropagation()}else yf(e,n,l,null,a)}}function Mf(e){return e=Id(e),If(e)}var xc=null;function If(e){if(xc=null,e=Li(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 xc=e,null}function $0(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(Ai()){case oa:return 2;case Fa:return 8;case ns:case Di:return 32;case Bn:return 268435456;default:return 32}default:return 32}}var Of=!1,wa=null,ja=null,Na=null,Nr=new Map,Cr=new Map,Ca=[],KS="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 P0(e,n){switch(e){case"focusin":case"focusout":wa=null;break;case"dragenter":case"dragleave":ja=null;break;case"mouseover":case"mouseout":Na=null;break;case"pointerover":case"pointerout":Nr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cr.delete(n.pointerId)}}function Er(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=Bi(n),n!==null&&z0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function YS(e,n,a,l,f){switch(n){case"focusin":return wa=Er(wa,e,n,a,l,f),!0;case"dragenter":return ja=Er(ja,e,n,a,l,f),!0;case"mouseover":return Na=Er(Na,e,n,a,l,f),!0;case"pointerover":var h=f.pointerId;return Nr.set(h,Er(Nr.get(h)||null,e,n,a,l,f)),!0;case"gotpointercapture":return h=f.pointerId,Cr.set(h,Er(Cr.get(h)||null,e,n,a,l,f)),!0}return!1}function H0(e){var n=Li(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,Mt(e.priority,function(){U0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Mt(e.priority,function(){U0(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 kc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Mf(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Md=l,a.target.dispatchEvent(l),Md=null}else return n=Bi(a),n!==null&&z0(n),e.blockedOn=a,!1;n.shift()}return!0}function V0(e,n,a){kc(e)&&a.delete(n)}function JS(){Of=!1,wa!==null&&kc(wa)&&(wa=null),ja!==null&&kc(ja)&&(ja=null),Na!==null&&kc(Na)&&(Na=null),Nr.forEach(V0),Cr.forEach(V0)}function Sc(e,n){e.blockedOn===n&&(e.blockedOn=null,Of||(Of=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,JS)))}var Tc=null;function q0(e){Tc!==e&&(Tc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Tc===e&&(Tc=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(If(l||a)===null)continue;break}var h=Bi(a);h!==null&&(e.splice(n,3),n-=3,Ru(h,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function bo(e){function n(R){return Sc(R,e)}wa!==null&&Sc(wa,e),ja!==null&&Sc(ja,e),Na!==null&&Sc(Na,e),Nr.forEach(n),Cr.forEach(n);for(var a=0;a<Ca.length;a++){var l=Ca[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ca.length&&(a=Ca[0],a.blockedOn===null);)H0(a),a.blockedOn===null&&Ca.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],x=f[Wt]||null;if(typeof h=="function")x||q0(a);else if(x){var j=null;if(h&&h.hasAttribute("formAction")){if(f=h,x=h[Wt]||null)j=x.formAction;else if(If(f)!==null)continue}else j=x.action;typeof j=="function"?a[l+1]=j:(a.splice(l,3),l-=3),q0(a)}}}function G0(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var 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 Lf(e){this._internalRoot=e}wc.prototype.render=Lf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,l=Dn();L0(a,l,e,n,null,null)},wc.prototype.unmount=Lf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;L0(e.current,2,null,e,null,null),ic(),n[Oi]=null}};function wc(e){this._internalRoot=e}wc.prototype.unstable_scheduleHydration=function(e){if(e){var n=tn();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Ca.length&&n!==0&&n<Ca[a].priority;a++);Ca.splice(a,0,e),a===0&&H0(e)}};var F0=s.version;if(F0!=="19.2.4")throw Error(r(527,F0,"19.2.4"));F.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var WS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var jc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!jc.isDisabled&&jc.supportsFiber)try{Yt=jc.inject(WS),kt=jc}catch{}}return Dr.createRoot=function(e,n){if(!c(e))throw Error(r(299));var a=!1,l="",f=Qg,h=ev,x=tv;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&&(x=n.onRecoverableError)),n=I0(e,1,!1,null,null,a,l,null,f,h,x,G0),e[Oi]=n.current,vf(e),new Lf(n)},Dr.hydrateRoot=function(e,n,a){if(!c(e))throw Error(r(299));var l=!1,f="",h=Qg,x=ev,j=tv,R=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=I0(e,1,!0,n,a??null,l,f,R,h,x,j,G0),n.context=O0(null),a=n.current,l=Dn(),l=Je(l),f=pa(l),f.callback=null,ma(a,f,l),a=l,n.current.lanes=a,Pe(n,a),bs(n),e[Oi]=n.current,vf(e),new wc(n)},Dr.version="19.2.4",Dr}var ey;function jT(){if(ey)return Bf.exports;ey=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(),Bf.exports=wT(),Bf.exports}var NT=jT();const CT="modulepreload",ET=function(t){return"/"+t},ty={},AT=function(s,i,r){let c=Promise.resolve();if(i&&i.length>0){let u=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),m=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=u(i.map(g=>{if(g=ET(g),g in ty)return;ty[g]=!0;const v=g.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":CT,v||(_.as="script"),_.crossOrigin="",_.href=g,m&&_.setAttribute("nonce",m),document.head.appendChild(_),v)return new Promise((S,k)=>{_.addEventListener("load",S),_.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)})},DT=new Proxy(globalThis.fetch,{apply(t,s,i){return Reflect.apply(globalThis.fetch,s,i)}}),RT=rT({baseUrl:"/",fetch:DT}),we=lT(cT,RT),MT="_bar_1xhb4_1",IT="_input_1xhb4_32",OT="_select_1xhb4_67",LT="_btnPrimary_1xhb4_103",BT="_btnGhost_1xhb4_173",zT="_badge_1xhb4_195",UT="_disconnectHint_1xhb4_205",Rn={bar:MT,input:IT,select:OT,btnPrimary:LT,btnGhost:BT,badge:zT,disconnectHint:UT};function $T(t,s){if(!t)return!1;const i=s.find(r=>r.id===t);return i!==void 0&&(i.status==="disconnected"||i.status==="error")}function PT({environmentId:t,onReconnect:s}){return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:Rn.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),o.jsx("button",{type:"button",onClick:()=>s(t),className:Rn.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function Wr({mode:t,sessionId:s,environmentId:i,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:p,onSpawn:m,onStartTask:g,onProvisionEnvironment:v,onShowToast:b}){const[_,S]=y.useState(""),[k,w]=y.useState(""),N=$T(i,u),T=C=>{if(C.preventDefault(),!!_.trim())if(t==="send"){if(!s||N)return;p(s,_),S("")}else if(t==="spawn"){if(!i)return;m(i,_,k),b==null||b("Session started","success"),S(""),w("")}else{if(!r)return;g(r,void 0,i,_),S("")}};return t==="spawn"?o.jsxs("form",{onSubmit:T,className:Rn.bar,children:[o.jsx("span",{className:Rn.badge,children:"new chat"}),o.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:Rn.input,"aria-label":"Enter prompt"}),c&&o.jsxs("select",{value:k,onChange:C=>w(C.target.value),className:Rn.select,"aria-label":"Select persona",children:[o.jsx("option",{value:"",children:"(Default)"}),d.map(C=>o.jsx("option",{value:C.id,children:C.name},C.id))]}),o.jsx("button",{type:"submit",disabled:!_.trim()||!i,className:Rn.btnPrimary,children:"Go"})]}):t==="start"?o.jsxs("form",{onSubmit:T,className:Rn.bar,children:[o.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:Rn.input,"aria-label":"Type a message"}),o.jsx("button",{type:"submit",disabled:!_.trim(),className:Rn.btnPrimary,children:"Send"})]}):o.jsxs("form",{onSubmit:T,className:Rn.bar,children:[N&&i&&o.jsx(PT,{environmentId:i,onReconnect:v}),o.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!N,disabled:N,className:Rn.input,"aria-label":"Type a message"}),o.jsx("span",{title:N?"Environment is unavailable — reconnect first":void 0,children:o.jsx("button",{type:"submit",disabled:!_.trim()||N,className:Rn.btnPrimary,children:"Send"})})]})}const ny=220,sy=70,HT=40,VT=60,qT="hierarchy",GT="dependency";function FT(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new Z0.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:HT,ranksep:VT});const i=new Map(t.map(u=>[u.id,u])),r=new Map;for(const u of t)if(u.parentTaskId&&i.has(u.parentTaskId)){const p=r.get(u.parentTaskId)||[];p.push(u),r.set(u.parentTaskId,p)}for(const u of t)s.setNode(u.id,{width:ny,height:sy});const c=[];for(const u of t){if(u.parentTaskId&&i.has(u.parentTaskId)){const p=`hierarchy-${u.parentTaskId}-${u.id}`;s.setEdge(u.parentTaskId,u.id,{},p),c.push({id:p,source:u.parentTaskId,target:u.id,type:"smoothstep",data:{edgeType:qT},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of u.dependsOn)if(i.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:GT},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return Z0.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-ny/2,y:p.y-sy/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 ZT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),c_=(...t)=>t.filter((s,i,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===i).join(" ").trim();/**
32
+ * @license lucide-react v0.474.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */var KT={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 YT=y.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...p},m)=>y.createElement("svg",{ref:m,...KT,width:s,height:s,stroke:t,strokeWidth:r?Number(i)*24/Number(s):i,className:c_("lucide",c),...p},[...u.map(([g,v])=>y.createElement(g,v)),...Array.isArray(d)?d:[d]]));/**
42
+ * @license lucide-react v0.474.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const Ze=(t,s)=>{const i=y.forwardRef(({className:r,...c},d)=>y.createElement(YT,{ref:d,iconNode:s,className:c_(`lucide-${ZT(t)}`,r),...c}));return i.displayName=`${t}`,i};/**
47
+ * @license lucide-react v0.474.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const JT=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ay=Ze("ArrowDown",JT);/**
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 WT=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],iy=Ze("ArrowUp",WT);/**
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 XT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],QT=Ze("Ban",XT);/**
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 e2=[["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"}]],t2=Ze("Brain",e2);/**
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 n2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ji=Ze("Check",n2);/**
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 s2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],d_=Ze("ChevronDown",s2);/**
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 a2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],sa=Ze("ChevronRight",a2);/**
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 i2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ba=Ze("Circle",i2);/**
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 o2=[["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"}]],r2=Ze("ClipboardList",o2);/**
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 l2=[["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"}]],u_=Ze("Clipboard",l2);/**
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=[["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"}]],d2=Ze("Cog",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 u2=[["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"}]],f2=Ze("Copy",u2);/**
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 p2=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],m2=Ze("CornerDownRight",p2);/**
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 h2=[["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"}]],g2=Ze("FilePen",h2);/**
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 v2=[["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"}]],y2=Ze("FileText",v2);/**
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 b2=[["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"}]],_2=Ze("House",b2);/**
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 x2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],sm=Ze("Info",x2);/**
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 k2=[["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"}]],S2=Ze("Key",k2);/**
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 T2=[["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"}]],w2=Ze("Keyboard",T2);/**
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 j2=[["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"}]],N2=Ze("ListChecks",j2);/**
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 C2=[["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"}]],E2=Ze("List",C2);/**
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 A2=[["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"}]],D2=Ze("Loader",A2);/**
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 R2=[["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"}]],M2=Ze("Menu",R2);/**
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 I2=[["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"}]],O2=Ze("MessageSquare",I2);/**
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 L2=[["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"}]],B2=Ze("Monitor",L2);/**
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 z2=[["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"}]],U2=Ze("Palette",z2);/**
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 $2=[["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"}]],P2=Ze("Pause",$2);/**
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 H2=[["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"}]],V2=Ze("Pencil",H2);/**
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 q2=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],f_=Ze("Search",q2);/**
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 G2=[["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"}]],F2=Ze("Settings",G2);/**
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 Z2=[["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"}]],K2=Ze("SquareCheckBig",Z2);/**
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 Y2=[["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"}]],am=Ze("TriangleAlert",Y2);/**
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 J2=[["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"}]],W2=Ze("User",J2);/**
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 X2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Pa=Ze("X",X2),im=8,it=12,en=14,Bt=16,Cp={not_started:{color:"var(--text-tertiary)",icon:o.jsx(Ba,{size:it}),label:"Not Started"},working:{color:"var(--accent-green)",icon:o.jsx(Ba,{size:it,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:o.jsx(P2,{size:it}),label:"Paused"},complete:{color:"var(--accent-green)",icon:o.jsx(ji,{size:it}),label:"Complete"},failed:{color:"var(--accent-red)",icon:o.jsx(Pa,{size:it}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:o.jsx(QT,{size:it}),label:"Blocked"}};function za(t){return t==="blocked"?Cp.blocked:Cp[rl(t)]}const Q2={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function ew(t){return Q2[rl(t)]??"statusPending"}const tw=["working","paused","failed","not_started","blocked","complete"],oy=["not_started","working","paused","complete","failed"],nw={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function rl(t){return t in Cp&&t!=="blocked"?t:nw[t]??"not_started"}const sw={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"},aw="_dagContainer_js4w6_1",iw="_taskNode_js4w6_26",ow="_taskNodeBorder_js4w6_54",rw="_taskNodeContent_js4w6_60",lw="_taskNodeHeader_js4w6_70",cw="_taskNodeIcon_js4w6_77",dw="_taskNodeTitle_js4w6_82",uw="_taskNodeBadges_js4w6_90",fw="_childBadge_js4w6_95",pw="_depBadge_js4w6_107",mw="_handle_js4w6_119",hw="_emptyCta_js4w6_126",gw="_ctaDescription_js4w6_137",vw="_ctaButton_js4w6_144",gn={dagContainer:aw,taskNode:iw,taskNodeBorder:ow,taskNodeContent:rw,taskNodeHeader:lw,taskNodeIcon:cw,taskNodeTitle:dw,taskNodeBadges:uw,childBadge:fw,depBadge:pw,handle:mw,emptyCta:hw,ctaDescription:gw,ctaButton:vw};function yw({data:t}){const{task:s,childCount:i,doneChildCount:r,hasDependencies:c}=t,d=za(s.status);return o.jsxs("div",{className:gn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[o.jsx(K0,{type:"target",position:Y0.Top,className:gn.handle}),o.jsx("div",{className:gn.taskNodeBorder,style:{backgroundColor:d.color}}),o.jsxs("div",{className:gn.taskNodeContent,children:[o.jsxs("div",{className:gn.taskNodeHeader,children:[o.jsx("span",{className:gn.taskNodeIcon,style:{color:d.color},children:d.icon}),o.jsx("span",{className:gn.taskNodeTitle,children:s.title})]}),o.jsxs("div",{className:gn.taskNodeBadges,children:[i>0&&o.jsxs("span",{className:gn.childBadge,children:[r,"/",i]}),c&&o.jsx("span",{className:gn.depBadge,children:"dep"})]})]}),o.jsx(K0,{type:"source",position:Y0.Bottom,className:gn.handle})]})}/**
217
+ * react-router v7.13.2
218
+ *
219
+ * Copyright (c) Remix Software Inc.
220
+ *
221
+ * This source code is licensed under the MIT license found in the
222
+ * LICENSE.md file in the root directory of this source tree.
223
+ *
224
+ * @license MIT
225
+ */var ry="popstate";function ly(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function bw(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 Ep("",{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 i(r,c){return typeof c=="string"?c:Xr(c)}return xw(s,i,null,t)}function bt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Xn(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function _w(){return Math.random().toString(36).substring(2,10)}function cy(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 Ep(t,s,i=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?Lo(s):s,state:i,key:s&&s.key||r||_w(),unstable_mask:c}}function Xr({pathname:t="/",search:s="",hash:i=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),i&&i!=="#"&&(t+=i.charAt(0)==="#"?i:"#"+i),t}function Lo(t){let s={};if(t){let i=t.indexOf("#");i>=0&&(s.hash=t.substring(i),t=t.substring(0,i));let r=t.indexOf("?");r>=0&&(s.search=t.substring(r),t=t.substring(0,r)),t&&(s.pathname=t)}return s}function xw(t,s,i,r={}){let{window:c=document.defaultView,v5Compat:d=!1}=r,u=c.history,p="POP",m=null,g=v();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function v(){return(u.state||{idx:null}).idx}function b(){p="POP";let N=v(),T=N==null?null:N-g;g=N,m&&m({action:p,location:w.location,delta:T})}function _(N,T){p="PUSH";let C=ly(N)?N:Ep(w.location,N,T);g=v()+1;let D=cy(C,g),L=w.createHref(C.unstable_mask||C);try{u.pushState(D,"",L)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;c.location.assign(L)}d&&m&&m({action:p,location:w.location,delta:1})}function S(N,T){p="REPLACE";let C=ly(N)?N:Ep(w.location,N,T);g=v();let D=cy(C,g),L=w.createHref(C.unstable_mask||C);u.replaceState(D,"",L),d&&m&&m({action:p,location:w.location,delta:0})}function k(N){return kw(N)}let w={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(ry,b),m=N,()=>{c.removeEventListener(ry,b),m=null}},createHref(N){return s(c,N)},createURL:k,encodeLocation(N){let T=k(N);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:_,replace:S,go(N){return u.go(N)}};return w}function kw(t,s=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),bt(i,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:Xr(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function p_(t,s,i="/"){return Sw(t,s,i,!1)}function Sw(t,s,i,r){let c=typeof s=="string"?Lo(s):s,d=ea(c.pathname||"/",i);if(d==null)return null;let u=m_(t);Tw(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=g_(d);p=Mw(u[m],g,r)}return p}function m_(t,s=[],i=[],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;bt(v.relativePath.startsWith(r),`Absolute route path "${v.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(r.length)}let b=Ss([r,v.relativePath]),_=i.concat(v);u.children&&u.children.length>0&&(bt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),m_(u.children,s,_,b,m)),!(u.path==null&&!u.index)&&s.push({path:b,score:Dw(b,u.index),routesMeta:_})};return t.forEach((u,p)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))d(u,p);else for(let g of h_(u.path))d(u,p,!0,g)}),s}function h_(t){let s=t.split("/");if(s.length===0)return[];let[i,...r]=s,c=i.endsWith("?"),d=i.replace(/\?$/,"");if(r.length===0)return c?[d,""]:[d];let u=h_(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 Tw(t){t.sort((s,i)=>s.score!==i.score?i.score-s.score:Rw(s.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var ww=/^:[\w-]+$/,jw=3,Nw=2,Cw=1,Ew=10,Aw=-2,dy=t=>t==="*";function Dw(t,s){let i=t.split("/"),r=i.length;return i.some(dy)&&(r+=Aw),s&&(r+=Nw),i.filter(c=>!dy(c)).reduce((c,d)=>c+(ww.test(d)?jw:d===""?Cw:Ew),r)}function Rw(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 Mw(t,s,i=!1){let{routesMeta:r}=t,c={},d="/",u=[];for(let p=0;p<r.length;++p){let m=r[p],g=p===r.length-1,v=d==="/"?s:s.slice(d.length)||"/",b=Qr({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),_=m.route;if(!b&&g&&i&&!r[r.length-1].route.index&&(b=Qr({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),u.push({params:c,pathname:Ss([d,b.pathname]),pathnameBase:zw(Ss([d,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(d=Ss([d,b.pathnameBase]))}return u}function Qr(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[i,r]=Iw(t.path,t.caseSensitive,t.end),c=s.match(i);if(!c)return null;let d=c[0],u=d.replace(/(.)\/+$/,"$1"),p=c.slice(1);return{params:r.reduce((g,{paramName:v,isOptional:b},_)=>{if(v==="*"){let k=p[_]||"";u=d.slice(0,d.length-k.length).replace(/(.)\/+$/,"$1")}const S=p[_];return b&&!S?g[v]=void 0:g[v]=(S||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function Iw(t,s=!1,i=!0){Xn(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,p,m,g,v)=>{if(r.push({paramName:p,isOptional:m!=null}),m){let b=v.charAt(g+u.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),r]}function g_(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Xn(!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 ea(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let i=s.endsWith("/")?s.length-1:s.length,r=t.charAt(i);return r&&r!=="/"?null:t.slice(i)||"/"}var Ow=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Lw(t,s="/"){let{pathname:i,search:r="",hash:c=""}=typeof t=="string"?Lo(t):t,d;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?d=uy(i.substring(1),"/"):d=uy(i,s)):d=s,{pathname:d,search:Uw(r),hash:$w(c)}}function uy(t,s){let i=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?i.length>1&&i.pop():c!=="."&&i.push(c)}),i.length>1?i.join("/"):"/"}function $f(t,s,i,r){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Bw(t){return t.filter((s,i)=>i===0||s.route.path&&s.route.path.length>0)}function om(t){let s=Bw(t);return s.map((i,r)=>r===s.length-1?i.pathname:i.pathnameBase)}function hd(t,s,i,r=!1){let c;typeof t=="string"?c=Lo(t):(c={...t},bt(!c.pathname||!c.pathname.includes("?"),$f("?","pathname","search",c)),bt(!c.pathname||!c.pathname.includes("#"),$f("#","pathname","hash",c)),bt(!c.search||!c.search.includes("#"),$f("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,p;if(u==null)p=i;else{let b=s.length-1;if(!r&&u.startsWith("..")){let _=u.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}p=b>=0?s[b]:"/"}let m=Lw(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&i.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var Ss=t=>t.join("/").replace(/\/\/+/g,"/"),zw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Uw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,$w=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Pw=class{constructor(t,s,i,r=!1){this.status=t,this.statusText=s||"",this.internal=r,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function Hw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Vw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var v_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function y_(t,s){let i=t;if(typeof i!="string"||!Ow.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let r=i,c=!1;if(v_)try{let d=new URL(window.location.href),u=i.startsWith("//")?new URL(d.protocol+i):new URL(i),p=ea(u.pathname,s);u.origin===d.origin&&p!=null?i=p+u.search+u.hash:c=!0}catch{Xn(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:c,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var b_=["POST","PUT","PATCH","DELETE"];new Set(b_);var qw=["GET",...b_];new Set(qw);var Bo=y.createContext(null);Bo.displayName="DataRouter";var gd=y.createContext(null);gd.displayName="DataRouterState";var Gw=y.createContext(!1),__=y.createContext({isTransitioning:!1});__.displayName="ViewTransition";var Fw=y.createContext(new Map);Fw.displayName="Fetchers";var Zw=y.createContext(null);Zw.displayName="Await";var Ln=y.createContext(null);Ln.displayName="Navigation";var ll=y.createContext(null);ll.displayName="Location";var Qn=y.createContext({outlet:null,matches:[],isDataRoute:!1});Qn.displayName="Route";var rm=y.createContext(null);rm.displayName="RouteError";var x_="REACT_ROUTER_ERROR",Kw="REDIRECT",Yw="ROUTE_ERROR_RESPONSE";function Jw(t){if(t.startsWith(`${x_}:${Kw}:{`))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 Ww(t){if(t.startsWith(`${x_}:${Yw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Pw(s.status,s.statusText,s.data)}catch{}}function Xw(t,{relative:s}={}){bt(Ni(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:r}=y.useContext(Ln),{hash:c,pathname:d,search:u}=cl(t,{relative:s}),p=d;return i!=="/"&&(p=d==="/"?i:Ss([i,d])),r.createHref({pathname:p,search:u,hash:c})}function Ni(){return y.useContext(ll)!=null}function Zt(){return bt(Ni(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(ll).location}function At(t){bt(Ni(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Zt();return y.useMemo(()=>Qr(t,g_(s)),[s,t])}var k_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function S_(t){y.useContext(Ln).static||y.useLayoutEffect(t)}function vd(){let{isDataRoute:t}=y.useContext(Qn);return t?pj():Qw()}function Qw(){bt(Ni(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Bo),{basename:s,navigator:i}=y.useContext(Ln),{matches:r}=y.useContext(Qn),{pathname:c}=Zt(),d=JSON.stringify(om(r)),u=y.useRef(!1);return S_(()=>{u.current=!0}),y.useCallback((m,g={})=>{if(Xn(u.current,k_),!u.current)return;if(typeof m=="number"){i.go(m);return}let v=hd(m,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Ss([s,v.pathname])),(g.replace?i.replace:i.push)(v,g.state,g)},[s,i,d,c,t])}var ej=y.createContext(null);function tj(t){let s=y.useContext(Qn).outlet;return y.useMemo(()=>s&&y.createElement(ej.Provider,{value:t},s),[s,t])}function ms(){let{matches:t}=y.useContext(Qn),s=t[t.length-1];return s?s.params:{}}function cl(t,{relative:s}={}){let{matches:i}=y.useContext(Qn),{pathname:r}=Zt(),c=JSON.stringify(om(i));return y.useMemo(()=>hd(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function nj(t,s){return T_(t,s)}function T_(t,s,i){var N;bt(Ni(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Ln),{matches:c}=y.useContext(Qn),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||"";j_(p,!g||T.endsWith("*")||T.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${T}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
226
+
227
+ Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let v=Zt(),b;if(s){let T=typeof s=="string"?Lo(s):s;bt(m==="/"||((N=T.pathname)==null?void 0:N.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${T.pathname}" was given in the \`location\` prop.`),b=T}else b=v;let _=b.pathname||"/",S=_;if(m!=="/"){let T=m.replace(/^\//,"").split("/");S="/"+_.replace(/^\//,"").split("/").slice(T.length).join("/")}let k=p_(t,{pathname:S});Xn(g||k!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Xn(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=rj(k&&k.map(T=>Object.assign({},T,{params:Object.assign({},u,T.params),pathname:Ss([m,r.encodeLocation?r.encodeLocation(T.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?m:Ss([m,r.encodeLocation?r.encodeLocation(T.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),c,i);return s&&w?y.createElement(ll.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},w):w}function sj(){let t=fj(),s=Hw(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),i=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:r},d={padding:"2px 4px",backgroundColor:r},u=null;return console.error("Error handled by React Router default ErrorBoundary:",t),u=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:d},"ErrorBoundary")," or"," ",y.createElement("code",{style:d},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},s),i?y.createElement("pre",{style:c},i):null,u)}var aj=y.createElement(sj,null),w_=class extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){this.props.onError?this.props.onError(t,s):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const i=Ww(t.digest);i&&(t=i)}let s=t!==void 0?y.createElement(Qn.Provider,{value:this.props.routeContext},y.createElement(rm.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(ij,{error:t},s):s}};w_.contextType=Gw;var Pf=new WeakMap;function ij({children:t,error:s}){let{basename:i}=y.useContext(Ln);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=Jw(s.digest);if(r){let c=Pf.get(s);if(c)throw c;let d=y_(r.location,i);if(v_&&!Pf.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 Pf.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function oj({routeContext:t,match:s,children:i}){let r=y.useContext(Bo);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(Qn.Provider,{value:t},i)}function rj(t,s=[],i){let r=i==null?void 0:i.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(s.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let c=t,d=r==null?void 0:r.errors;if(d!=null){let v=c.findIndex(b=>b.route.id&&(d==null?void 0:d[b.route.id])!==void 0);bt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let u=!1,p=-1;if(i&&r){u=r.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=v),b.route.id){let{loaderData:_,errors:S}=r,k=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!S||S[b.route.id]===void 0);if(b.route.lazy||k){i.isStatic&&(u=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let m=i==null?void 0:i.onError,g=r&&m?(v,b)=>{var _,S;m(v,{location:r.location,params:((S=(_=r.matches)==null?void 0:_[0])==null?void 0:S.params)??{},unstable_pattern:Vw(r.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,_)=>{let S,k=!1,w=null,N=null;r&&(S=d&&b.route.id?d[b.route.id]:void 0,w=b.route.errorElement||aj,u&&(p<0&&_===0?(j_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,N=null):p===_&&(k=!0,N=b.route.hydrateFallbackElement||null)));let T=s.concat(c.slice(0,_+1)),C=()=>{let D;return S?D=w:k?D=N:b.route.Component?D=y.createElement(b.route.Component,null):b.route.element?D=b.route.element:D=v,y.createElement(oj,{match:b,routeContext:{outlet:v,matches:T,isDataRoute:r!=null},children:D})};return r&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement(w_,{location:r.location,revalidation:r.revalidation,component:w,error:S,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:g}):C()},null)}function lm(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lj(t){let s=y.useContext(Bo);return bt(s,lm(t)),s}function cj(t){let s=y.useContext(gd);return bt(s,lm(t)),s}function dj(t){let s=y.useContext(Qn);return bt(s,lm(t)),s}function cm(t){let s=dj(t),i=s.matches[s.matches.length-1];return bt(i.route.id,`${t} can only be used on routes that contain a unique "id"`),i.route.id}function uj(){return cm("useRouteId")}function fj(){var r;let t=y.useContext(rm),s=cj("useRouteError"),i=cm("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[i]}function pj(){let{router:t}=lj("useNavigate"),s=cm("useNavigate"),i=y.useRef(!1);return S_(()=>{i.current=!0}),y.useCallback(async(c,d={})=>{Xn(i.current,k_),i.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var fy={};function j_(t,s,i){!s&&!fy[t]&&(fy[t]=!0,Xn(!1,i))}y.memo(mj);function mj({routes:t,future:s,state:i,isStatic:r,onError:c}){return T_(t,void 0,{state:i,isStatic:r,onError:c})}function fs({to:t,replace:s,state:i,relative:r}){bt(Ni(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Ln);Xn(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=y.useContext(Qn),{pathname:u}=Zt(),p=vd(),m=hd(t,om(d),u,r==="path"),g=JSON.stringify(m);return y.useEffect(()=>{p(JSON.parse(g),{replace:s,state:i,relative:r})},[p,g,r,s,i]),null}function Ha(t){return tj(t.context)}function Ne(t){bt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function hj({basename:t="/",children:s=null,location:i,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){bt(!Ni(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=t.replace(/^\/*/,"/"),m=y.useMemo(()=>({basename:p,navigator:c,static:d,unstable_useTransitions:u,future:{}}),[p,c,d,u]);typeof i=="string"&&(i=Lo(i));let{pathname:g="/",search:v="",hash:b="",state:_=null,key:S="default",unstable_mask:k}=i,w=y.useMemo(()=>{let N=ea(g,p);return N==null?null:{location:{pathname:N,search:v,hash:b,state:_,key:S,unstable_mask:k},navigationType:r}},[p,g,v,b,_,S,r,k]);return Xn(w!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${b}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:y.createElement(Ln.Provider,{value:m},y.createElement(ll.Provider,{children:s,value:w}))}function gj({children:t,location:s}){return nj(Ap(t),s)}function Ap(t,s=[]){let i=[];return y.Children.forEach(t,(r,c)=>{if(!y.isValidElement(r))return;let d=[...s,c];if(r.type===y.Fragment){i.push.apply(i,Ap(r.props.children,d));return}bt(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>`),bt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let u={id:r.props.id||d.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(u.children=Ap(r.props.children,d)),i.push(u)}),i}var qc="get",Gc="application/x-www-form-urlencoded";function yd(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function vj(t){return yd(t)&&t.tagName.toLowerCase()==="button"}function yj(t){return yd(t)&&t.tagName.toLowerCase()==="form"}function bj(t){return yd(t)&&t.tagName.toLowerCase()==="input"}function _j(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function xj(t,s){return t.button===0&&(!s||s==="_self")&&!_j(t)}function Dp(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((s,i)=>{let r=t[i];return s.concat(Array.isArray(r)?r.map(c=>[i,c]):[[i,r]])},[]))}function kj(t,s){let i=Dp(t);return s&&s.forEach((r,c)=>{i.has(c)||s.getAll(c).forEach(d=>{i.append(c,d)})}),i}var Ec=null;function Sj(){if(Ec===null)try{new FormData(document.createElement("form"),0),Ec=!1}catch{Ec=!0}return Ec}var Tj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Hf(t){return t!=null&&!Tj.has(t)?(Xn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Gc}"`),null):t}function wj(t,s){let i,r,c,d,u;if(yj(t)){let p=t.getAttribute("action");r=p?ea(p,s):null,i=t.getAttribute("method")||qc,c=Hf(t.getAttribute("enctype"))||Gc,d=new FormData(t)}else if(vj(t)||bj(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?ea(m,s):null,i=t.getAttribute("formmethod")||p.getAttribute("method")||qc,c=Hf(t.getAttribute("formenctype"))||Hf(p.getAttribute("enctype"))||Gc,d=new FormData(p,t),!Sj()){let{name:g,type:v,value:b}=t;if(v==="image"){let _=g?`${g}.`:"";d.append(`${_}x`,"0"),d.append(`${_}y`,"0")}else g&&d.append(g,b)}}else{if(yd(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=qc,r=null,c=Gc,u=t}return d&&c==="text/plain"&&(u=d,d=void 0),{action:r,method:i.toLowerCase(),encType:c,formData:d,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function dm(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function jj(t,s,i,r){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return i?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${r}`:c.pathname=`${c.pathname}.${r}`:c.pathname==="/"?c.pathname=`_root.${r}`:s&&ea(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function Nj(t,s){if(t.id in s)return s[t.id];try{let i=await import(t.module);return s[t.id]=i,i}catch(i){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Cj(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 Ej(t,s,i){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await Nj(d,i);return u.links?u.links():[]}return[]}));return Mj(r.flat(1).filter(Cj).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function py(t,s,i,r,c,d){let u=(m,g)=>i[g]?m.route.id!==i[g].route.id:!0,p=(m,g)=>{var v;return i[g].pathname!==m.pathname||((v=i[g].route.path)==null?void 0:v.endsWith("*"))&&i[g].params["*"]!==m.params["*"]};return d==="assets"?s.filter((m,g)=>u(m,g)||p(m,g)):d==="data"?s.filter((m,g)=>{var b;let v=r.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(u(m,g)||p(m,g))return!0;if(m.route.shouldRevalidate){let _=m.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((b=i[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function Aj(t,s,{includeHydrateFallback:i}={}){return Dj(t.map(r=>{let c=s.routes[r.route.id];if(!c)return[];let d=[c.module];return c.clientActionModule&&(d=d.concat(c.clientActionModule)),c.clientLoaderModule&&(d=d.concat(c.clientLoaderModule)),i&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function Dj(t){return[...new Set(t)]}function Rj(t){let s={},i=Object.keys(t).sort();for(let r of i)s[r]=t[r];return s}function Mj(t,s){let i=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(Rj(c));return i.has(d)||(i.add(d),r.push({key:d,link:c})),r},[])}function N_(){let t=y.useContext(Bo);return dm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Ij(){let t=y.useContext(gd);return dm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var um=y.createContext(void 0);um.displayName="FrameworkContext";function C_(){let t=y.useContext(um);return dm(t,"You must render this element inside a <HydratedRouter> element"),t}function Oj(t,s){let i=y.useContext(um),[r,c]=y.useState(!1),[d,u]=y.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:v,onTouchStart:b}=s,_=y.useRef(null);y.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let w=T=>{T.forEach(C=>{u(C.isIntersecting)})},N=new IntersectionObserver(w,{threshold:.5});return _.current&&N.observe(_.current),()=>{N.disconnect()}}},[t]),y.useEffect(()=>{if(r){let w=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(w)}}},[r]);let S=()=>{c(!0)},k=()=>{c(!1),u(!1)};return i?t!=="intent"?[d,_,{}]:[d,_,{onFocus:Rr(p,S),onBlur:Rr(m,k),onMouseEnter:Rr(g,S),onMouseLeave:Rr(v,k),onTouchStart:Rr(b,S)}]:[!1,_,{}]}function Rr(t,s){return i=>{t&&t(i),i.defaultPrevented||s(i)}}function Lj({page:t,...s}){let{router:i}=N_(),r=y.useMemo(()=>p_(i.routes,t,i.basename),[i.routes,t,i.basename]);return r?y.createElement(zj,{page:t,matches:r,...s}):null}function Bj(t){let{manifest:s,routeModules:i}=C_(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return Ej(t,s,i).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,i]),r}function zj({page:t,matches:s,...i}){let r=Zt(),{future:c,manifest:d,routeModules:u}=C_(),{basename:p}=N_(),{loaderData:m,matches:g}=Ij(),v=y.useMemo(()=>py(t,s,g,d,r,"data"),[t,s,g,d,r]),b=y.useMemo(()=>py(t,s,g,d,r,"assets"),[t,s,g,d,r]),_=y.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let w=new Set,N=!1;if(s.forEach(C=>{var L;let D=d.routes[C.route.id];!D||!D.hasLoader||(!v.some(E=>E.route.id===C.route.id)&&C.route.id in m&&((L=u[C.route.id])!=null&&L.shouldRevalidate)||D.hasClientLoader?N=!0:w.add(C.route.id))}),w.size===0)return[];let T=jj(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return N&&w.size>0&&T.searchParams.set("_routes",s.filter(C=>w.has(C.route.id)).map(C=>C.route.id).join(",")),[T.pathname+T.search]},[p,c.unstable_trailingSlashAwareDataRequests,m,r,d,v,s,t,u]),S=y.useMemo(()=>Aj(b,d),[b,d]),k=Bj(b);return y.createElement(y.Fragment,null,_.map(w=>y.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...i})),S.map(w=>y.createElement("link",{key:w,rel:"modulepreload",href:w,...i})),k.map(({key:w,link:N})=>y.createElement("link",{key:w,nonce:i.nonce,...N,crossOrigin:N.crossOrigin??i.crossOrigin})))}function Uj(...t){return s=>{t.forEach(i=>{typeof i=="function"?i(s):i!=null&&(i.current=s)})}}var $j=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{$j&&(window.__reactRouterVersion="7.13.2")}catch{}function Pj({basename:t,children:s,unstable_useTransitions:i,window:r}){let c=y.useRef();c.current==null&&(c.current=bw({window:r,v5Compat:!0}));let d=c.current,[u,p]=y.useState({action:d.action,location:d.location}),m=y.useCallback(g=>{i===!1?p(g):y.startTransition(()=>p(g))},[i]);return y.useLayoutEffect(()=>d.listen(m),[d,m]),y.createElement(hj,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:i})}var E_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fm=y.forwardRef(function({onClick:s,discover:i="render",prefetch:r="none",relative:c,reloadDocument:d,replace:u,unstable_mask:p,state:m,target:g,to:v,preventScrollReset:b,viewTransition:_,unstable_defaultShouldRevalidate:S,...k},w){let{basename:N,navigator:T,unstable_useTransitions:C}=y.useContext(Ln),D=typeof v=="string"&&E_.test(v),L=y_(v,N);v=L.to;let E=Xw(v,{relative:c}),I=Zt(),O=null;if(p){let re=hd(p,[],I.unstable_mask?I.unstable_mask.pathname:"/",!0);N!=="/"&&(re.pathname=re.pathname==="/"?N:Ss([N,re.pathname])),O=T.createHref(re)}let[z,$,X]=Oj(r,k),te=Gj(v,{replace:u,unstable_mask:p,state:m,target:g,preventScrollReset:b,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:S,unstable_useTransitions:C});function P(re){s&&s(re),re.defaultPrevented||te(re)}let ae=!(L.isExternal||d),K=y.createElement("a",{...k,...X,href:(ae?O:void 0)||L.absoluteURL||E,onClick:ae?P:s,ref:Uj(w,$),target:g,"data-discover":!D&&i==="render"?"true":void 0});return z&&!D?y.createElement(y.Fragment,null,K,y.createElement(Lj,{page:E})):K});fm.displayName="Link";var Hj=y.forwardRef(function({"aria-current":s="page",caseSensitive:i=!1,className:r="",end:c=!1,style:d,to:u,viewTransition:p,children:m,...g},v){let b=cl(u,{relative:g.relative}),_=Zt(),S=y.useContext(gd),{navigator:k,basename:w}=y.useContext(Ln),N=S!=null&&Jj(b)&&p===!0,T=k.encodeLocation?k.encodeLocation(b).pathname:b.pathname,C=_.pathname,D=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;i||(C=C.toLowerCase(),D=D?D.toLowerCase():null,T=T.toLowerCase()),D&&w&&(D=ea(D,w)||D);const L=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let E=C===T||!c&&C.startsWith(T)&&C.charAt(L)==="/",I=D!=null&&(D===T||!c&&D.startsWith(T)&&D.charAt(T.length)==="/"),O={isActive:E,isPending:I,isTransitioning:N},z=E?s:void 0,$;typeof r=="function"?$=r(O):$=[r,E?"active":null,I?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let X=typeof d=="function"?d(O):d;return y.createElement(fm,{...g,"aria-current":z,className:$,ref:v,style:X,to:u,viewTransition:p},typeof m=="function"?m(O):m)});Hj.displayName="NavLink";var Vj=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:i,reloadDocument:r,replace:c,state:d,method:u=qc,action:p,onSubmit:m,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_,...S},k)=>{let{unstable_useTransitions:w}=y.useContext(Ln),N=Kj(),T=Yj(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",D=typeof p=="string"&&E_.test(p),L=E=>{if(m&&m(E),E.defaultPrevented)return;E.preventDefault();let I=E.nativeEvent.submitter,O=(I==null?void 0:I.getAttribute("formmethod"))||u,z=()=>N(I||E.currentTarget,{fetcherKey:s,method:O,navigate:i,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_});w&&i!==!1?y.startTransition(()=>z()):z()};return y.createElement("form",{ref:k,method:C,action:T,onSubmit:r?m:L,...S,"data-discover":!D&&t==="render"?"true":void 0})});Vj.displayName="Form";function qj(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function A_(t){let s=y.useContext(Bo);return bt(s,qj(t)),s}function Gj(t,{target:s,replace:i,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:g}={}){let v=vd(),b=Zt(),_=cl(t,{relative:u});return y.useCallback(S=>{if(xj(S,s)){S.preventDefault();let k=i!==void 0?i:Xr(b)===Xr(_),w=()=>v(t,{replace:k,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m});g?y.startTransition(()=>w()):w()}},[b,v,_,i,r,c,s,t,d,u,p,m,g])}function pm(t){Xn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let s=y.useRef(Dp(t)),i=y.useRef(!1),r=Zt(),c=y.useMemo(()=>kj(r.search,i.current?null:s.current),[r.search]),d=vd(),u=y.useCallback((p,m)=>{const g=Dp(typeof p=="function"?p(new URLSearchParams(c)):p);i.current=!0,d("?"+g,m)},[d,c]);return[c,u]}var Fj=0,Zj=()=>`__${String(++Fj)}__`;function Kj(){let{router:t}=A_("useSubmit"),{basename:s}=y.useContext(Ln),i=uj(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:b}=wj(d,s);if(u.navigate===!1){let _=u.fetcherKey||Zj();await r(_,i,u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||g,flushSync:u.flushSync})}else await c(u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||g,replace:u.replace,state:u.state,fromRouteId:i,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,c,s,i])}function Yj(t,{relative:s}={}){let{basename:i}=y.useContext(Ln),r=y.useContext(Qn);bt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...cl(t||".",{relative:s})},u=Zt();if(t==null){d.search=u.search;let p=new URLSearchParams(d.search),m=p.getAll("index");if(m.some(v=>v==="")){p.delete("index"),m.filter(b=>b).forEach(b=>p.append("index",b));let v=p.toString();d.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(d.pathname=d.pathname==="/"?i:Ss([i,d.pathname])),Xr(d)}function Jj(t,{relative:s}={}){let i=y.useContext(__);bt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=A_("useViewTransitionState"),c=cl(t,{relative:s});if(!i.isTransitioning)return!1;let d=ea(i.currentLocation.pathname,r)||i.currentLocation.pathname,u=ea(i.nextLocation.pathname,r)||i.nextLocation.pathname;return Qr(c.pathname,u)!=null||Qr(c.pathname,d)!=null}function xt(){const t=vd();return y.useCallback((s,i)=>{typeof s=="number"?t(s):t(s,i)},[t])}function mm(t){return`/sessions/${encodeURIComponent(t)}`}function ki(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function In(t,s,i,r){const c=encodeURIComponent(t);let d;return i&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(i)}/tasks/${c}`:i?d=`/workspaces/${encodeURIComponent(i)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function Ci(t,s,i){const r=new URLSearchParams;t&&r.set("workspace",t),s&&r.set("parent",s);const c=r.toString();if(t&&i){const d=`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${d}?parent=${encodeURIComponent(s)}`:d}return c?`/tasks/new?${c}`:"/tasks/new"}function D_(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const Ao="/environments",Wj="/environments/new";function Si(t){return`/environments/${encodeURIComponent(t)}`}function Xj(t){return`/environments/${encodeURIComponent(t)}/edit`}const Eo="/settings",Qj="/settings/credentials",Vf="/settings/personas",eN="/settings/personas/new";function R_(t){return`/settings/personas/${encodeURIComponent(t)}`}const tN="/settings/shortcuts",nN="/pair",sN="/chat",Ti="/",aN="/tasks",M_="/workspaces/new",I_="/knowledge",bd="/findings";function iN(t,s){return t&&s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}/findings`:bd}function Rp(t,s,i){const r=encodeURIComponent(t);return s&&i?`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(s)}/findings/${r}`:`/findings/${r}`}const oN=sw,rN={task:yw};function lN({workspaceId:t,environmentId:s,tasks:i,resolvedThemeId:r}){const c=xt(),d=y.useMemo(()=>i.filter(b=>b.workspaceId===t),[i,t]),{nodes:u,edges:p}=FT(d),m=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[S,k]of Object.entries(oN))_[S]=b.getPropertyValue(k).trim()||"#6b7a8d";return _},[r]),g=y.useCallback((b,_)=>{c(In(_.id,void 0,t,s))},[c,t,s]),v=y.useCallback(b=>{const _=b.data;return m[_.task.status]||m.pending},[m]);return d.length===0?o.jsxs("div",{className:gn.emptyCta,children:[o.jsx("button",{className:gn.ctaButton,onClick:()=>c(Ci(t,void 0,s)),children:"Create Task"}),o.jsx("div",{className:gn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):o.jsx("div",{className:gn.dagContainer,children:o.jsxs(tT,{nodes:u,edges:p,nodeTypes:rN,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[o.jsx(nT,{variant:sT.Dots,gap:24,size:1,color:"var(--text-disabled)"}),o.jsx(aT,{showInteractive:!1}),o.jsx(iT,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const cN="_breadcrumbs_17or2_1",dN="_list_17or2_11",uN="_item_17or2_21",fN="_separator_17or2_28",pN="_link_17or2_34",mN="_current_17or2_57",_o={breadcrumbs:cN,list:dN,item:uN,separator:fN,link:pN,current:mN};function js({segments:t}){return o.jsx("nav",{className:_o.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:o.jsx("ol",{className:_o.list,children:t.map((s,i)=>{const r=i===t.length-1;return o.jsxs("li",{className:_o.item,children:[i>0&&o.jsx("span",{className:_o.separator,"aria-hidden":"true",children:o.jsx(sa,{size:it})}),s.url&&!r?o.jsx(fm,{className:_o.link,to:s.url,title:s.label,children:s.label}):o.jsx("span",{className:_o.current,"aria-current":"page",title:s.label,children:s.label})]},i)})})})}const hN="_btn_dwk2o_1",gN="_sm_dwk2o_22",vN="_md_dwk2o_28",yN="_lg_dwk2o_34",bN="_primary_dwk2o_40",_N="_danger_dwk2o_55",xN="_outline_dwk2o_70",kN="_ghost_dwk2o_80",qf={btn:hN,sm:gN,md:vN,lg:yN,primary:bN,danger:_N,outline:xN,ghost:kN},Js=y.forwardRef(function({variant:s="primary",size:i="md",className:r,children:c,...d},u){const p=[qf.btn,qf[s],qf[i],r].filter(Boolean).join(" ");return o.jsx("button",{ref:u,className:p,...d,children:c})}),SN="_copyButton_1bqk0_1",TN={copyButton:SN},wN=2e3;function jN({text:t,className:s,"data-testid":i}){const[r,c]=y.useState(!1),d=y.useRef(void 0);y.useEffect(()=>()=>{d.current!==void 0&&clearTimeout(d.current)},[]);const u=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),c(!0),d.current!==void 0&&clearTimeout(d.current),d.current=setTimeout(()=>{c(!1),d.current=void 0},wN)}catch{}},[t]);return o.jsx("button",{type:"button",className:`${TN.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":i??"copy-button",children:r?o.jsx(ji,{size:en,"aria-hidden":"true"}):o.jsx(u_,{size:en,"aria-hidden":"true"})})}const NN="_banner_bxqlh_1",CN="_label_bxqlh_15",EN="_text_bxqlh_25",AN="_link_bxqlh_29",Ac={banner:NN,label:CN,text:EN,link:AN};function DN(){return o.jsxs("div",{className:Ac.banner,"data-testid":"demo-banner",children:[o.jsx("span",{className:Ac.label,children:"DEMO"}),o.jsxs("span",{className:Ac.text,children:["This is an interactive demo with mock data."," ",o.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:Ac.link,children:"Install Grackle"})," ","to use it for real."]})]})}const RN="_container_og0yp_1",MN="_chevronButton_og0yp_6",IN="_mainButton_og0yp_6",ON="_sm_og0yp_34",LN="_md_og0yp_34",BN="_lg_og0yp_34",zN="_primary_og0yp_57",UN="_danger_og0yp_70",$N="_outline_og0yp_83",PN="_ghost_og0yp_92",HN="_dropdown_og0yp_100",VN="_option_og0yp_113",qN="_optionLabel_og0yp_130",GN="_optionDesc_og0yp_135",Fs={container:RN,chevronButton:MN,mainButton:IN,sm:ON,md:LN,lg:BN,primary:zN,danger:UN,outline:$N,ghost:PN,dropdown:HN,option:VN,optionLabel:qN,optionDesc:GN};function O_({label:t,onClick:s,options:i,variant:r="primary",size:c="md","data-testid":d}){const[u,p]=y.useState(!1),m=y.useRef(null);y.useEffect(()=>{if(!u)return;function _(S){m.current&&S.target instanceof Node&&!m.current.contains(S.target)&&p(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[u]),y.useEffect(()=>{if(!u)return;function _(S){S.key==="Escape"&&p(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]);const g=Fs[r]||"",v=Fs[c]||"",b=()=>{u&&p(!1),s()};return o.jsxs("div",{ref:m,className:Fs.container,"data-testid":d,children:[o.jsx("button",{type:"button",className:`${Fs.mainButton} ${g} ${v}`,onClick:b,"data-testid":d?`${d}-main`:void 0,children:t}),o.jsx("button",{type:"button",className:`${Fs.chevronButton} ${g} ${v}`,onClick:()=>p(_=>!_),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:o.jsx(d_,{size:en,"aria-hidden":"true"})}),u&&o.jsx("div",{className:Fs.dropdown,"data-testid":d?`${d}-menu`:void 0,children:i.map((_,S)=>o.jsxs("button",{type:"button",className:Fs.option,onClick:()=>{_.onClick(),p(!1)},children:[o.jsx("span",{className:Fs.optionLabel,children:_.label}),_.description&&o.jsx("span",{className:Fs.optionDesc,children:_.description})]},S))})]})}function Mp(){Mp=function(c,d){return new i(c,void 0,d)};var t=RegExp.prototype,s=new WeakMap;function i(c,d,u){var p=new RegExp(c,d);return s.set(p,u||s.get(c)),Xc(p,i.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&&Xc(c,d)})(i,RegExp),i.prototype.exec=function(c){var d=t.exec.call(this,c);if(d){d.groups=r(d,this);var u=d.indices;u&&(u.groups=r(u,this))}return d},i.prototype[Symbol.replace]=function(c,d){if(typeof d=="string"){var u=s.get(this);return t[Symbol.replace].call(this,c,d.replace(/\$<([^>]+)>/g,function(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)},Mp.apply(this,arguments)}function Xc(t,s){return Xc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,r){return i.__proto__=r,i},Xc(t,s)}function my(t,s){(s==null||s>t.length)&&(s=t.length);for(var i=0,r=new Array(s);i<s;i++)r[i]=t[i];return r}function Gf(t,s){var i=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=(function(c,d){if(c){if(typeof c=="string")return my(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)?my(c,d):void 0}})(t))||s){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
228
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var FN=(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){bT(r,"element",i)};function i(r,c,d){var u,p;if(d&&d.tagName==="pre"&&r.tagName==="code"){var m=(r==null||(u=r.data)==null?void 0:u.meta)||(r==null||(p=r.properties)==null?void 0:p.metastring)||"";r.properties.className?typeof r.properties.className=="boolean"?r.properties.className=[]:Array.isArray(r.properties.className)||(r.properties.className=[r.properties.className]):r.properties.className=[];var g,v,b=(function(E){for(var I,O=Gf(E.properties.className);!(I=O()).done;){var z=I.value;if(z.slice(0,9)==="language-")return z.slice(9).toLowerCase()}return null})(r);if(!b&&s.defaultLanguage&&r.properties.className.push("language-"+(b=s.defaultLanguage)),r.properties.className.push("code-highlight"),b)try{var _,S;S=(_=b)!=null&&_.includes("diff-")?b.split("-")[1]:b,g=t.highlight(Cc(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(I){return I.reduce(function(O,z){if(z.type==="text"){var $=z.value,X=($.match(/\n/g)||"").length;if(X===0)z.position={start:{line:v,column:1},end:{line:v,column:1}},O.push(z);else for(var te,P=$.split(`
229
+ `),ae=Gf(P.entries());!(te=ae()).done;){var K=te.value,re=K[0],A=K[1];O.push({type:"text",value:re===P.length-1?A:A+`
230
+ `,position:{start:{line:v+re,column:1},end:{line:v+re,column:1}}})}return v+=X,O}if(Object.prototype.hasOwnProperty.call(z,"children")){var F=v;return z.children=E(z.children),O.push(z),z.position={start:{line:F,column:1},end:{line:v,column:1}},O}return O.push(z),O},[])})(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,w=(function(E){var I=/{([\d,-]+)}/,O=E.split(",").map(function(X){return X.trim()}).join();if(I.test(O)){var z=I.exec(O)[1],$=xT(z);return function(X){return $.includes(X+1)}}return function(){return!1}})(m),N=(function(E){var I=Mp(/showLineNumbers=(\d+)/i,{lines:1});if(I.test(E)){var O=I.exec(E);return Number(O.groups.lines)}return 1})(m),T=(function(E){for(var I=new Array(E),O=0;O<E;O++)I[O]={type:"element",tagName:"span",properties:{className:[]},children:[]};return I})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],D=function(){var E,I,O=k.value,z=O[0],$=O[1];$.properties.className=["code-line"];var X=kT(g,function(te){return te.position.start.line<=z+1&&te.position.end.line>=z+1});$.children=X.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!C.some(function(te){return m.toLowerCase().includes(te)})&&($.properties.line=[(z+N).toString()],$.properties.className.push("line-number")),w(z)&&$.properties.className.push("highlight-line"),(b==="diff"||(E=b)!=null&&E.includes("diff-"))&&Cc($).substring(0,1)==="-"?$.properties.className.push("deleted"):(b==="diff"||(I=b)!=null&&I.includes("diff-"))&&Cc($).substring(0,1)==="+"&&$.properties.className.push("inserted")},L=Gf(T.entries());!(k=L()).done;)D();T.length>0&&Cc(T[T.length-1]).trim()===""&&T.pop(),r.children=T}}}})(_T);function L_(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 Do(t){return t===0?"-":t<.01?`$${t.toFixed(4)}`:`$${t.toFixed(2)}`}const hy=new Set(["grackle"]);function zo(t){if(t.startsWith("mcp__")){const i=t.indexOf("__",5);if(i>5){const r=t.slice(5,i);if(hy.has(r))return t.slice(i+2)}}const s=t.indexOf("-");if(s>0){const i=t.slice(0,s);if(hy.has(i))return t.slice(s+1)}return t}const ZN={read:"file-read",view:"file-read",edit:"file-edit",file_change:"file-edit",write:"file-write",bash:"shell",powershell:"shell",command_execution:"shell",grep:"search",glob:"search",todowrite:"todo",update_plan:"todo",todo_write:"todo",report_intent:"metadata",finding_post:"finding",finding_list:"finding",task_list:"task",task_create:"task",task_show:"task",task_update:"task",task_start:"task",task_complete:"task",task_resume:"task",task_delete:"task",workpad_write:"workpad",workpad_read:"workpad",knowledge_search:"knowledge",knowledge_get_node:"knowledge",knowledge_create_node:"knowledge",ipc_spawn:"ipc",ipc_write:"ipc",ipc_close:"ipc",ipc_list_fds:"ipc",ipc_terminate:"ipc",ipc_create_stream:"ipc",ipc_attach:"ipc",toolsearch:"tool-search",agent:"agent",task:"agent",read_agent:"agent"};function KN(t){const s=zo(t);return ZN[s.toLowerCase()]??"generic"}const YN="_card_qkm9i_2",JN="_cardBlue_qkm9i_20",WN="_cardOrange_qkm9i_24",XN="_cardGreen_qkm9i_28",QN="_cardPurple_qkm9i_32",eC="_cardNeutral_qkm9i_36",tC="_cardRed_qkm9i_40",nC="_cardTeal_qkm9i_44",sC="_header_qkm9i_48",aC="_icon_qkm9i_55",iC="_toolName_qkm9i_64",oC="_fileName_qkm9i_71",rC="_badge_qkm9i_80",lC="_spacer_qkm9i_87",cC="_bodyToggle_qkm9i_91",dC="_chevron_qkm9i_109",uC="_chevronExpanded_qkm9i_115",fC="_pre_qkm9i_119",pC="_diffAdd_qkm9i_143",mC="_diffRemove_qkm9i_155",hC="_diffContext_qkm9i_167",gC="_diffHeader_qkm9i_176",vC="_diffLine_qkm9i_182",yC="_exitOk_qkm9i_188",bC="_exitError_qkm9i_194",_C="_exitPending_qkm9i_200",xC="_inProgress_qkm9i_228",kC="_metadata_qkm9i_232",SC="_metadataPrefix_qkm9i_239",M={card:YN,cardBlue:JN,cardOrange:WN,cardGreen:XN,cardPurple:QN,cardNeutral:eC,cardRed:tC,cardTeal:nC,header:sC,icon:aC,toolName:iC,fileName:oC,badge:rC,spacer:lC,bodyToggle:cC,chevron:dC,chevronExpanded:uC,pre:fC,diffAdd:pC,diffRemove:mC,diffContext:hC,diffHeader:gC,diffLine:vC,exitOk:yC,exitError:bC,exitPending:_C,inProgress:xC,metadata:kC,metadataPrefix:SC};function TC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.file_path=="string"?s.file_path:typeof s.path=="string"?s.path:""}function wC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const Ff=5;function gy({tool:t,args:s,result:i,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),p=TC(s),m=wC(p),g=i===void 0,v=r?M.cardRed:c?M.cardGreen:M.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?o.jsx(g2,{size:en}):o.jsx(y2,{size:en}),S=c?"tool-card-file-write":"tool-card-file-read",k=(i==null?void 0:i.split(`
231
+ `))??[],w=k.length>Ff,N=d?k:k.slice(0,Ff);return o.jsxs("div",{className:`${M.card} ${v} ${g?M.inProgress:""}`,"data-testid":S,children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,children:_}),o.jsx("span",{className:M.toolName,style:{color:b},children:t}),m&&o.jsx("span",{className:M.fileName,title:p,children:m}),!g&&k.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,children:[k.length," lines"]})]})]}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&!g&&k.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-content",children:N.map((T,C)=>o.jsxs("span",{className:M.diffLine,children:[o.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),T]},C))}),w&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(T=>!T)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${d?M.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(sa,{size:it})}),d?"collapse":`${k.length-Ff} more lines`]})]})]})}function jC(t){const s=t.split(`
232
+ `),i=[];for(const r of s)r.startsWith("diff --git")||r.startsWith("index ")||(r.startsWith("--- ")||r.startsWith("+++ "))&&!r.startsWith("---- ")&&!r.startsWith("++++ ")||(r.startsWith("@@")?i.push({type:"header",content:r}):r.startsWith("+")?i.push({type:"add",content:r.slice(1)}):r.startsWith("-")?i.push({type:"remove",content:r.slice(1)}):r.startsWith(" ")?i.push({type:"context",content:r.slice(1)}):r===""&&i.push({type:"context",content:""}));return i}function NC(t,s){const i=t.split(`
233
+ `),r=s.split(`
234
+ `),c=[];for(const d of i)c.push({type:"remove",content:d});for(const d of r)c.push({type:"add",content:d});return c}function CC(t){let s=0,i=0;for(const r of t)r.type==="add"&&s++,r.type==="remove"&&i++;return{added:s,removed:i}}function EC(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 AC(t){if(t===void 0||typeof t!="object"||t===null)return;const s=t,i=(typeof s.old_string=="string"?s.old_string:void 0)??(typeof s.old_str=="string"?s.old_str:void 0),r=(typeof s.new_string=="string"?s.new_string:void 0)??(typeof s.new_str=="string"?s.new_str:void 0);if(i!==void 0&&r!==void 0)return{oldStr:i,newStr:r}}function DC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function RC(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=jC(r);if(c.length>0)return c}}const i=AC(t);if(i)return NC(i.oldStr,i.newStr)}const Zf=5;function MC({tool:t,args:s,result:i,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),p=EC(s),m=DC(p),g=i===void 0,v=RC(s,c),b=v?CC(v):null,_=((v==null?void 0:v.length)??0)>Zf,S=d?v:v==null?void 0:v.slice(0,Zf);return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardOrange} ${g?M.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,children:o.jsx(V2,{size:en})}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&o.jsx("span",{className:M.fileName,title:p,children:m}),b&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-diff-stats",children:[o.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",o.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]})]}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&S&&S.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-diff",children:S.map((k,w)=>{let N=M.diffContext;return k.type==="add"&&(N=M.diffAdd),k.type==="remove"&&(N=M.diffRemove),k.type==="header"&&(N=M.diffHeader),o.jsx("span",{className:`${M.diffLine} ${N}`,children:k.content},w)})}),_&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(k=>!k)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${d?M.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(sa,{size:it})}),d?"collapse":`${((v==null?void 0:v.length)??0)-Zf} more lines`]})]}),!r&&!v&&!g&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-content",children:i})]})}const IC=/^\[exit (\d+)\]\s*/;function OC(t){const s=IC.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function LC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function BC(t){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'([^']*)'\s*$/i.exec(t);if(s)return s[1];const i=/pwsh(?:\.exe)?["']?\s+-Command\s+"([^"]*)"\s*$/i.exec(t);return i?i[1]:t}const Kf=3;function zC({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=LC(s),p=BC(u),m=i===void 0,g=i?OC(i):null,v=(g==null?void 0:g.output.split(`
235
+ `))??[],b=v.length>Kf,_=c?v:v.slice(0,Kf),S=g==null?void 0:g.exitCode,k=r||S!==void 0&&S!==0;return o.jsxs("div",{className:`${M.card} ${k?M.cardRed:M.cardNeutral}`,"data-testid":"tool-card-shell",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),o.jsx("span",{className:M.fileName,style:{flex:1,color:"var(--text-primary)"},title:u!==p?u:void 0,"data-testid":"tool-card-command",children:p}),S!==void 0&&o.jsxs("span",{className:S===0?M.exitOk:M.exitError,"data-testid":"tool-card-exit-code",children:[S===0?o.jsx(ji,{size:it,"aria-hidden":"true"}):o.jsx(Pa,{size:it,"aria-hidden":"true"})," ","exit ",S]}),m&&o.jsx("span",{className:M.exitPending,"data-testid":"tool-card-pending",children:o.jsx(D2,{size:it,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-output",children:_.join(`
236
+ `)}),b&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(w=>!w)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(sa,{size:it})}),c?"collapse":`${v.length-Kf} more lines`]})]})]})}function UC(t){if(t==null||typeof t!="object")return{pattern:"",path:""};const s=t,i=typeof s.pattern=="string"?s.pattern:"",r=typeof s.path=="string"?s.path:"";return{pattern:i,path:r}}const Yf=5;function $C({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:p}=UC(s),m=i===void 0,g=(i==null?void 0:i.split(`
237
+ `).filter(_=>_.length>0))??[],v=g.length>Yf,b=c?g:g.slice(0,Yf);return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-search",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,children:o.jsx(f_,{size:en})}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&o.jsxs("span",{className:M.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),p&&o.jsxs("span",{className:M.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",p]}),!m&&!r&&g.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&!m&&b.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-results",children:b.join(`
238
+ `)}),v&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(sa,{size:it})}),c?"collapse":`${g.length-Yf} more matches`]})]})]})}const PC="_progressBar_14f5c_1",HC="_progressFill_14f5c_9",VC="_activeTask_14f5c_16",qC="_activeIcon_14f5c_27",GC="_todoPulse_14f5c_1",FC="_activeText_14f5c_34",ZC="_checklist_14f5c_48",KC="_item_14f5c_55",YC="_itemIcon_14f5c_65",JC="_itemText_14f5c_73",WC="_pending_14f5c_78",XC="_in_progress_14f5c_85",QC="_completed_14f5c_97",eE="_emptyMessage_14f5c_108",os={progressBar:PC,progressFill:HC,activeTask:VC,activeIcon:qC,todoPulse:GC,activeText:FC,checklist:ZC,item:KC,itemIcon:YC,itemText:JC,pending:WC,in_progress:XC,completed:QC,emptyMessage:eE},tE=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function nE(t){if(t===void 0||typeof t!="object"||t===null)return[];const s=t;return Array.isArray(s.todos)?s.todos.filter(i=>typeof i=="object"&&i!==null&&typeof i.content=="string"&&typeof i.status=="string").map(i=>({content:i.content,activeForm:typeof i.activeForm=="string"?i.activeForm:void 0,status:vy(i.status)})):Array.isArray(s.plan)?s.plan.filter(i=>typeof i=="object"&&i!==null&&typeof i.step=="string"&&typeof i.status=="string").map(i=>({content:i.step,status:vy(i.status)})):typeof s.content=="string"?sE(s.content):[]}function vy(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 sE(t){const s=t.split(`
239
+ `),i=[];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"),i.push({content:u,status:p})}}return i}function aE(t){switch(t){case"completed":return o.jsx(ji,{size:it});case"in_progress":return o.jsx(Ba,{size:it,fill:"currentColor"});default:return o.jsx(Ba,{size:it})}}function iE({args:t}){const s=nE(t),i=s.filter(d=>d.status==="completed").length,r=s.find(d=>d.status==="in_progress"),c=s.length===0;return o.jsxs("div",{className:`${M.card} ${M.cardBlue}`,"data-testid":"tool-card-todo",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,children:o.jsx(N2,{size:en})}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-todo-progress",children:[i,"/",s.length]})]})]}),!c&&o.jsx("div",{className:os.progressBar,"data-testid":"tool-card-todo-bar",children:o.jsx("div",{className:os.progressFill,style:{width:`${i/s.length*100}%`}})}),r&&o.jsxs("div",{className:os.activeTask,"data-testid":"tool-card-todo-active",children:[o.jsx("span",{className:os.activeIcon,children:o.jsx(Ba,{size:it,fill:"currentColor"})}),o.jsx("span",{className:os.activeText,children:r.activeForm||r.content})]}),!c&&o.jsx("div",{className:os.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>o.jsxs("div",{className:`${os.item} ${os[d.status]}`,"data-testid":"tool-card-todo-item",children:[o.jsx("span",{className:os.itemIcon,children:aE(d.status)}),o.jsx("span",{className:os.itemText,children:d.content})]},u))}),c&&o.jsx("div",{className:os.emptyMessage,children:"All items completed and cleared."})]})}function oE(t,s){if(s==null||typeof s!="object")return"";const i=s;if(typeof i.intent=="string")return i.intent;for(const r of Object.values(i))if(typeof r=="string")return r;return t}function rE({tool:t,args:s}){const i=oE(t,s);return o.jsxs("div",{className:M.metadata,"data-testid":"tool-card-metadata",children:[o.jsx("span",{className:M.metadataPrefix,children:o.jsx(m2,{size:it})}),i]})}function lE(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 cE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(i=>i!==null&&typeof i=="object")};if(typeof s=="object"&&s!==null)return{single:s}}catch{}return{}}const Jf=5,Wf=5;function dE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=zo(t),p=lE(s),m=i===void 0,{single:g,list:v}=cE(i),b=(g==null?void 0:g.title)??p.title,_=v?void 0:(g==null?void 0:g.category)??p.category,S=v?void 0:(g==null?void 0:g.tags)??p.tags;return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-finding",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"💡"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),b&&o.jsxs("span",{className:M.fileName,"data-testid":"tool-card-finding-title",children:['"',b,'"']}),_&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsx("span",{className:M.badge,"data-testid":"tool-card-finding-category",children:_})]}),v&&!_&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-finding-count",children:[v.length," ",v.length===1?"finding":"findings"]})]})]}),S&&S.length>0&&o.jsx("div",{className:M.pre,style:{padding:"4px 8px",whiteSpace:"normal"},"data-testid":"tool-card-finding-tags",children:S.map((k,w)=>o.jsxs("span",{style:{display:"inline-block",marginRight:"6px",opacity:.7,fontSize:"0.85em"},children:["#",k]},w))}),m&&!b&&s!==null&&s!==void 0&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&(g==null?void 0:g.content)&&o.jsx(o.Fragment,{children:(()=>{const k=g.content.split(`
240
+ `),w=k.length>Wf,N=c?g.content:k.slice(0,Wf).join(`
241
+ `);return o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-finding-content",children:N}),w&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${k.length-Wf} more lines`]})]})})()}),!r&&v&&v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-finding-list",children:(c?v:v.slice(0,Jf)).map((k,w)=>`${k.category?`[${k.category}] `:""}${k.title??k.id??`Finding ${w+1}`}`).join(`
242
+ `)}),v.length>Jf&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Jf} more findings`]})]})]})}function uE(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 fE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(i=>i!==null&&typeof i=="object")};if(typeof s=="object"&&s!==null){const i=s;return typeof i.sessionId=="string"?{sessionId:i.sessionId,single:i}:{single:i}}}catch{}return{}}function yy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function pE(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 Xf=5;function mE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=zo(t),p=uE(s),m=i===void 0,{single:g,list:v,sessionId:b}=fE(i),_=(g==null?void 0:g.title)??p.title,S=(g==null?void 0:g.status)??p.status;return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardBlue} ${m?M.inProgress:""}`,"data-testid":"tool-card-task",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"📋"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:u}),_&&o.jsxs("span",{className:M.fileName,"data-testid":"tool-card-task-title",children:['"',_,'"']}),!_&&p.taskId&&o.jsx("span",{className:M.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),S&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,style:{color:pE(S)},"data-testid":"tool-card-task-status",children:[yy(S)," ",S]})]}),v&&!S&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),m&&!_&&!p.taskId&&s!==null&&s!==void 0&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&b&&o.jsxs("div",{className:M.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",b]}),!r&&g&&!v&&!b&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-task-detail",children:[g.id?`id: ${g.id}`:null,g.status?`status: ${g.status}`:null,g.branch?`branch: ${g.branch}`:null,g.latestSessionId?`session: ${g.latestSessionId}`:null].filter(Boolean).join(`
243
+ `)}),!r&&v&&v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,Xf)).map(k=>{const w=yy(k.status),N=k.title??k.id??"untitled";return`${w} ${N}`}).join(`
244
+ `)}),v.length>Xf&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Xf} more tasks`]})]})]})}function hE(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 gE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s,r=typeof i.workpad=="object"&&i.workpad!==null?i.workpad:i;return{status:typeof r.status=="string"?r.status:void 0,summary:typeof r.summary=="string"?r.summary:void 0,extra:typeof r.extra=="object"&&r.extra!==null?r.extra:void 0}}catch{}return{}}function vE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=zo(t),p=hE(s),m=i===void 0,g=gE(i),v=g.status??p.status,b=g.summary??p.summary;return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardGreen} ${m?M.inProgress:""}`,"data-testid":"tool-card-workpad",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"📓"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsx("span",{className:M.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),b&&o.jsx("pre",{className:M.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:b}),m&&!b&&s!==null&&s!==void 0&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&!m&&i&&!b&&!v&&!g.extra&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:i}),!r&&g.extra&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function yE(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 bE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s;if(Array.isArray(i.results))return{results:i.results.filter(r=>r!==null&&typeof r=="object")};if(typeof i.node=="object"&&i.node!==null){const r=Array.isArray(i.edges)?i.edges.length:0;return{node:i.node,edgeCount:r}}if(typeof i.id=="string")return{node:i}}catch{}return{}}const Qf=5;function _E({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=zo(t),p=yE(s),m=i===void 0,g=bE(i);return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardPurple} ${m?M.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🧠"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&o.jsxs("span",{className:M.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&o.jsx("span",{className:M.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-knowledge-count",children:[g.results.length," ",g.results.length===1?"result":"results"]})]}),g.node&&g.edgeCount!==void 0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-knowledge-edges",children:[g.edgeCount," ",g.edgeCount===1?"edge":"edges"]})]})]}),m&&s!==null&&s!==void 0&&!p.query&&!p.id&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&g.results&&g.results.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,Qf)).map(v=>{var S,k,w;const b=((S=v.node)==null?void 0:S.title)??((k=v.node)==null?void 0:k.label)??((w=v.node)==null?void 0:w.id)??"node",_=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${b}${_}`}).join(`
245
+ `)}),g.results.length>Qf&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-Qf} more results`]})]}),!r&&g.node&&!g.results&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-knowledge-node",children:[g.node.id?`id: ${g.node.id}`:null,g.node.title?`title: ${g.node.title}`:null,g.node.category?`category: ${g.node.category}`:null,g.node.kind?`kind: ${g.node.kind}`:null,g.node.content?`content: ${g.node.content.length>100?g.node.content.slice(0,100)+"...":g.node.content}`:null].filter(Boolean).join(`
246
+ `)})]})}function xE(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 kE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s;return{sessionId:typeof i.sessionId=="string"?i.sessionId:void 0,fd:typeof i.fd=="number"?i.fd:void 0,fds:Array.isArray(i.fds)?i.fds.filter(r=>r!==null&&typeof r=="object"):void 0,success:typeof i.success=="boolean"?i.success:void 0,output:typeof i.output=="string"?i.output:void 0}}catch{}return{}}function SE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=zo(t),p=xE(s),m=i===void 0,g=kE(i);let v="";p.pipe?v=`[${p.pipe}]`:p.fd!==void 0?v=`fd:${p.fd}`:p.name&&(v=`"${p.name}"`);const b=p.prompt?p.prompt.length>60?`${p.prompt.slice(0,60)}...`:p.prompt:void 0;return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardOrange} ${m?M.inProgress:""}`,"data-testid":"tool-card-ipc",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🔀"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&o.jsx("span",{className:M.fileName,"data-testid":"tool-card-ipc-info",children:v}),b&&o.jsx("span",{className:M.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:b}),g.fds&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-ipc-fd-count",children:[g.fds.length," ",g.fds.length===1?"fd":"fds"]})]}),g.success!==void 0&&!g.fds&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsx("span",{className:M.badge,style:{color:g.success?"var(--accent-green, #4ade80)":"var(--accent-red, #f87171)"},"data-testid":"tool-card-ipc-success",children:g.success?"✓ ok":"✗ failed"})]})]}),m&&!b&&!v&&s!==null&&s!==void 0&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&g.sessionId&&o.jsxs("div",{className:M.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-ipc-session",children:["session: ",g.sessionId,g.fd!==void 0&&` | fd: ${g.fd}`]}),!r&&g.output&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!r&&g.fds&&g.fds.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(_=>{const S=[`fd:${_.fd??"?"}`,_.permission??"",_.deliveryMode??""];return _.streamName&&S.push(_.streamName),_.owned&&S.push("(owned)"),S.filter(Boolean).join(" ")}).join(`
247
+ `)}),g.fds.length>5&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function TE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const ep=8;function wE({args:t,result:s,isError:i}){const[r,c]=y.useState(!1),d=TE(t),u=s===void 0,p=(s==null?void 0:s.split(`
248
+ `))??[],m=p.length>ep,g=r?s:p.slice(0,ep).join(`
249
+ `);return o.jsxs("div",{className:`${M.card} ${i?M.cardRed:M.cardNeutral} ${u?M.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🔧"}),o.jsx("span",{className:M.toolName,children:"ToolSearch"}),d&&o.jsxs("span",{className:M.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!i&&s&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:M.spacer}),o.jsxs("span",{className:M.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),i&&s&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:s}),!i&&!u&&s&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-tool-search-result",children:g}),m&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${r?M.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${p.length-ep} more lines`]})]})]})}function jE(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function NE(t){if(t==null)return"";if(typeof t!="object")return String(t);const s=t;if(typeof s.command=="string")return s.command;if(typeof s.file_path=="string")return s.file_path;if(typeof s.path=="string")return s.path;if(typeof s.query=="string")return s.query;if(typeof s.url=="string")return s.url;try{const i=JSON.stringify(t);return i.length>120?`${i.slice(0,120)}…`:i}catch{return""}}const tp=5;function CE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),{display:u}=jE(t),p=NE(s),m=i===void 0,g=(i==null?void 0:i.split(`
250
+ `))??[],v=g.length>tp,b=c?i:g.slice(0,tp).join(`
251
+ `);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardBlue} ${m?M.inProgress:""}`,"data-testid":"tool-card-generic",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,children:o.jsx(d2,{size:en,"aria-hidden":"true"})}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&o.jsx("span",{className:M.fileName,children:p})]}),m&&_&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:_}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&!m&&i&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:b}),v&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(sa,{size:it})}),c?"collapse":`${g.length-tp} more lines`]})]})]})}const EE="_badgePill_o7eqc_1",AE="_modelBadge_o7eqc_14",DE="_backgroundBadge_o7eqc_26",RE="_backgroundDot_o7eqc_36",ME="_backgroundDotPulsing_o7eqc_41",IE="_description_o7eqc_55",OE="_statusLine_o7eqc_62",LE="_statusCompleted_o7eqc_72",BE="_statusRunning_o7eqc_77",zE="_statusError_o7eqc_83",UE="_promptToggle_o7eqc_88",rs={badgePill:EE,modelBadge:AE,backgroundBadge:DE,backgroundDot:RE,backgroundDotPulsing:ME,description:IE,statusLine:OE,statusCompleted:LE,statusRunning:BE,statusError:zE,promptToggle:UE};function $E(t,s){if(s==null||typeof s!="object")return{};const i=s;return t.toLowerCase()==="read_agent"?{agentId:typeof i.agent_id=="string"?i.agent_id:void 0,isPoll:!0}:typeof i.agent_type=="string"||typeof i.name=="string"?{agentType:typeof i.agent_type=="string"?i.agent_type:void 0,description:typeof i.description=="string"?i.description:void 0,prompt:typeof i.prompt=="string"?i.prompt:void 0,isBackground:i.mode==="background",agentName:typeof i.name=="string"?i.name:void 0}:{agentType:typeof i.subagent_type=="string"?i.subagent_type:void 0,description:typeof i.description=="string"?i.description:void 0,prompt:typeof i.prompt=="string"?i.prompt:void 0,isBackground:i.run_in_background===!0,model:typeof i.model=="string"?i.model:void 0,isResume:typeof i.resume=="string"&&i.resume.length>0}}const PE=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function HE(t){const s=PE.exec(t);if(!s)return;const i=s[4];return{status:s[1].toLowerCase(),agentId:s[2].replace(/,$/,""),metadata:s[3].trim(),content:i?i.trim():void 0}}const np=5;function VE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),[u,p]=y.useState(!1),m=$E(t,s),g=i===void 0,v=m.isPoll&&i?HE(i):void 0,b=(v==null?void 0:v.content)??i,_=(b==null?void 0:b.split(`
252
+ `))??[],S=_.length>np,k=c?b:_.slice(0,np).join(`
253
+ `),w=m.isPoll?"Subagent":"Agent";return o.jsxs("div",{className:`${M.card} ${r?M.cardRed:M.cardTeal} ${g?M.inProgress:""}`,"data-testid":"tool-card-agent",children:[o.jsxs("div",{className:M.header,children:[o.jsx("span",{className:M.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),o.jsx("span",{className:M.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:w}),m.agentType&&o.jsx("span",{className:rs.badgePill,"data-testid":"tool-card-agent-type",children:m.agentType}),m.model&&o.jsx("span",{className:rs.modelBadge,"data-testid":"tool-card-agent-model",children:m.model}),m.isBackground&&o.jsxs("span",{className:rs.backgroundBadge,"data-testid":"tool-card-agent-background",children:[o.jsx("span",{className:g?rs.backgroundDotPulsing:rs.backgroundDot,children:"●"}),"BG"]}),m.agentName&&o.jsx("span",{className:M.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&o.jsx("span",{className:M.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),o.jsx("span",{className:M.spacer}),g&&!m.isBackground&&o.jsx("span",{className:M.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),m.description&&o.jsx("div",{className:rs.description,"data-testid":"tool-card-agent-description",children:m.isResume?`Resuming: ${m.description}`:m.description}),v&&o.jsxs("div",{className:rs.statusLine,"data-testid":"tool-card-agent-status",children:[o.jsx("span",{className:v.status==="completed"?rs.statusCompleted:v.status==="running"?rs.statusRunning:rs.statusError,children:v.status}),v.metadata&&o.jsx("span",{children:v.metadata})]}),m.prompt&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:rs.promptToggle,onClick:()=>{p(N=>!N)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[o.jsx("span",{className:`${M.chevron} ${u?M.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&i&&o.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!r&&!g&&b&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:k}),S&&o.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${_.length-np} more lines`]})]})]})}function sp(t){switch(KN(t.tool)){case"file-read":return o.jsx(gy,{...t});case"file-edit":return o.jsx(MC,{...t});case"file-write":return o.jsx(gy,{...t,writeVariant:!0});case"shell":return o.jsx(zC,{...t});case"search":return o.jsx($C,{...t});case"todo":return o.jsx(iE,{...t});case"metadata":return o.jsx(rE,{...t});case"finding":return o.jsx(dE,{...t});case"task":return o.jsx(mE,{...t});case"workpad":return o.jsx(vE,{...t});case"knowledge":return o.jsx(_E,{...t});case"ipc":return o.jsx(SE,{...t});case"tool-search":return o.jsx(wE,{...t});case"agent":return o.jsx(VE,{...t});default:return o.jsx(CE,{...t})}}const qE="_systemContextEvent_hmqlm_1",GE="_systemContextHeader_hmqlm_7",FE="_systemContextBadge_hmqlm_28",ZE="_systemContextToggle_hmqlm_37",KE="_systemContextPre_hmqlm_43",YE="_systemContextEllipsis_hmqlm_54",JE="_systemEvent_hmqlm_58",WE="_systemTimestamp_hmqlm_65",XE="_textEvent_hmqlm_69",QE="_codeBlockWrapper_hmqlm_156",eA="_codeBlockCopyButton_hmqlm_159",tA="_errorEvent_hmqlm_163",nA="_statusEvent_hmqlm_171",sA="_userInputEvent_hmqlm_180",aA="_userInputContent_hmqlm_186",iA="_signalEvent_hmqlm_203",oA="_signalBadge_hmqlm_214",rA="_signalContent_hmqlm_223",lA="_usageEvent_hmqlm_228",cA="_usageBadge_hmqlm_235",dA="_defaultEvent_hmqlm_244",zt={systemContextEvent:qE,systemContextHeader:GE,systemContextBadge:FE,systemContextToggle:ZE,systemContextPre:KE,systemContextEllipsis:YE,systemEvent:JE,systemTimestamp:WE,textEvent:XE,codeBlockWrapper:QE,codeBlockCopyButton:eA,errorEvent:tA,statusEvent:nA,userInputEvent:sA,userInputContent:aA,signalEvent:iA,signalBadge:oA,signalContent:rA,usageEvent:lA,usageBadge:cA,defaultEvent:dA},by=3;function uA({content:t}){const[s,i]=y.useState(!1),r=t.split(`
254
+ `),c=r.length>by,d=s?t:r.slice(0,by).join(`
255
+ `);return o.jsxs("div",{className:zt.systemContextEvent,"data-testid":"system-context-event",children:[o.jsxs("button",{type:"button",className:zt.systemContextHeader,onClick:()=>{i(u=>!u)},"aria-expanded":s,children:[o.jsx("span",{className:zt.systemContextBadge,children:"SYSTEM PROMPT"}),c&&o.jsx("span",{className:zt.systemContextToggle,"aria-hidden":"true",children:s?o.jsx(d_,{size:it}):o.jsx(sa,{size:it})})]}),o.jsxs("pre",{className:zt.systemContextPre,children:[d,!s&&c&&o.jsx("span",{className:zt.systemContextEllipsis,children:"…"})]})]})}function fA({time:t,content:s}){return o.jsxs("div",{className:zt.systemEvent,children:[o.jsxs("span",{className:zt.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Ip(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Ip).join(""):t!=null&&typeof t=="object"&&"props"in t?Ip(t.props.children):""}function pA({children:t,node:s,...i}){const r=Ip(t);return o.jsxs("div",{className:zt.codeBlockWrapper,children:[o.jsx("pre",{...i,children:t}),o.jsx(jN,{text:r,"data-testid":"copy-code-block",className:zt.codeBlockCopyButton})]})}const mA={pre:pA};function hA({content:t}){return o.jsx("div",{className:zt.textEvent,children:o.jsx(pd,{remarkPlugins:[md],rehypePlugins:[FN],components:mA,children:t})})}function gA({content:t}){return o.jsxs("div",{className:zt.errorEvent,children:["Error: ",t]})}function vA({content:t}){return o.jsxs("div",{className:zt.statusEvent,children:["--- ",t," ---"]})}function yA({content:t}){return o.jsx("div",{className:zt.userInputEvent,children:o.jsx("span",{className:zt.userInputContent,children:t})})}function bA({content:t}){return o.jsxs("div",{className:zt.signalEvent,"data-testid":"signal-event",children:[o.jsx("span",{className:zt.signalBadge,children:"SIGNAL"}),o.jsx("span",{className:zt.signalContent,children:t})]})}function _A({content:t}){let s=t;try{const i=JSON.parse(t),r=Number(i.input_tokens)||0,c=Number(i.output_tokens)||0,d=L_(r+c),u=Do(Number(i.cost_usd)||0);s=`${d} tokens · ${u}`}catch{}return o.jsx("div",{className:zt.usageEvent,"data-testid":"usage-event",children:o.jsx("span",{className:zt.usageBadge,children:s})})}function xA({content:t}){return o.jsx("div",{className:zt.defaultEvent,children:t})}function kA({event:t,toolUseCtx:s,settled:i}){const r=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return o.jsx(uA,{content:t.content})}catch{}return o.jsx(fA,{time:r,content:t.content})}case"text":case"output":return o.jsx(hA,{content:t.content});case"tool_use":{let c="",d={};try{const u=JSON.parse(t.content);c=u.tool||"",d=u.args}catch{}return o.jsx(sp,{tool:c,args:d,result:i?"":void 0})}case"tool_result":{let c=!1;if(t.raw)try{c=JSON.parse(t.raw).is_error===!0}catch{}let d=t.content;if(t.content.trimStart().startsWith("{"))try{const u=JSON.parse(t.content);typeof u.content=="string"&&(d=u.content)}catch{}return s?o.jsx(sp,{tool:s.tool,args:s.args,result:d,isError:c,detailedResult:s.detailedResult}):o.jsx(sp,{tool:"Tool output",args:void 0,result:d,isError:c})}case"error":return o.jsx(gA,{content:t.content});case"status":return o.jsx(vA,{content:t.content});case"user_input":return o.jsx(yA,{content:t.content});case"signal":return o.jsx(bA,{content:t.content});case"usage":return o.jsx(_A,{content:t.content});default:return o.jsx(xA,{content:t.content})}}const hm=y.createContext({});function gm(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const _d=y.createContext(null),vm=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class SA extends y.Component{getSnapshotBeforeUpdate(s){const i=this.props.childRef.current;if(i&&s.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=i.offsetHeight||0,r.width=i.offsetWidth||0,r.top=i.offsetTop,r.left=i.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function TA({children:t,isPresent:s}){const i=y.useId(),r=y.useRef(null),c=y.useRef({width:0,height:0,top:0,left:0}),{nonce:d}=y.useContext(vm);return y.useInsertionEffect(()=>{const{width:u,height:p,top:m,left:g}=c.current;if(s||!r.current||!u||!p)return;r.current.dataset.motionPopId=i;const v=document.createElement("style");return d&&(v.nonce=d),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
256
+ [data-motion-pop-id="${i}"] {
257
+ position: absolute !important;
258
+ width: ${u}px !important;
259
+ height: ${p}px !important;
260
+ top: ${m}px !important;
261
+ left: ${g}px !important;
262
+ }
263
+ `),()=>{document.head.removeChild(v)}},[s]),o.jsx(SA,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const wA=({children:t,initial:s,isPresent:i,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=gm(jA),m=y.useId(),g=y.useCallback(b=>{p.set(b,!0);for(const _ of p.values())if(!_)return;r&&r()},[p,r]),v=y.useMemo(()=>({id:m,initial:s,isPresent:i,custom:c,onExitComplete:g,register:b=>(p.set(b,!1),()=>p.delete(b))}),d?[Math.random(),g]:[i,g]);return y.useMemo(()=>{p.forEach((b,_)=>p.set(_,!1))},[i]),y.useEffect(()=>{!i&&!p.size&&r&&r()},[i]),u==="popLayout"&&(t=o.jsx(TA,{isPresent:i,children:t})),o.jsx(_d.Provider,{value:v,children:t})};function jA(){return new Map}function B_(t=!0){const s=y.useContext(_d);if(s===null)return[!0,null];const{isPresent:i,onExitComplete:r,register:c}=s,d=y.useId();y.useEffect(()=>{t&&c(d)},[t]);const u=y.useCallback(()=>t&&r&&r(d),[d,r,t]);return!i&&r?[!1,u]:[!0]}const Dc=t=>t.key||"";function _y(t){const s=[];return y.Children.forEach(t,i=>{y.isValidElement(i)&&s.push(i)}),s}const ym=typeof window<"u",z_=ym?y.useLayoutEffect:y.useEffect,ps=({children:t,custom:s,initial:i=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,m]=B_(u),g=y.useMemo(()=>_y(t),[t]),v=u&&!p?[]:g.map(Dc),b=y.useRef(!0),_=y.useRef(g),S=gm(()=>new Map),[k,w]=y.useState(g),[N,T]=y.useState(g);z_(()=>{b.current=!1,_.current=g;for(let L=0;L<N.length;L++){const E=Dc(N[L]);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 L=[...g];for(let E=0;E<N.length;E++){const I=N[E],O=Dc(I);v.includes(O)||(L.splice(E,0,I),C.push(I))}d==="wait"&&C.length&&(L=C),T(_y(L)),w(g);return}const{forceRender:D}=y.useContext(hm);return o.jsx(o.Fragment,{children:N.map(L=>{const E=Dc(L),I=u&&!p?!1:g===N||v.includes(E),O=()=>{if(S.has(E))S.set(E,!0);else return;let z=!0;S.forEach($=>{$||(z=!1)}),z&&(D==null||D(),T(_.current),u&&(m==null||m()),r&&r())};return o.jsx(wA,{isPresent:I,initial:!b.current||i?void 0:!1,custom:I?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:I?void 0:O,children:L},E)})})},Mn=t=>t;let U_=Mn;const NA={useManualTiming:!1};function CA(t){let s=new Set,i=new Set,r=!1,c=!1;const d=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function p(g){d.has(g)&&(m.schedule(g),t()),g(u)}const m={schedule:(g,v=!1,b=!1)=>{const S=b&&r?s:i;return v&&d.add(g),S.has(g)||S.add(g),g},cancel:g=>{i.delete(g),d.delete(g)},process:g=>{if(u=g,r){c=!0;return}r=!0,[s,i]=[i,s],s.forEach(p),s.clear(),r=!1,c&&(c=!1,m.process(g))}};return m}const Rc=["read","resolveKeyframes","update","preRender","render","postRender"],EA=40;function $_(t,s){let i=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>i=!0,u=Rc.reduce((T,C)=>(T[C]=CA(d),T),{}),{read:p,resolveKeyframes:m,update:g,preRender:v,render:b,postRender:_}=u,S=()=>{const T=performance.now();i=!1,c.delta=r?1e3/60:Math.max(Math.min(T-c.timestamp,EA),1),c.timestamp=T,c.isProcessing=!0,p.process(c),m.process(c),g.process(c),v.process(c),b.process(c),_.process(c),c.isProcessing=!1,i&&s&&(r=!1,t(S))},k=()=>{i=!0,r=!0,c.isProcessing||t(S)};return{schedule:Rc.reduce((T,C)=>{const D=u[C];return T[C]=(L,E=!1,I=!1)=>(i||k(),D.schedule(L,E,I)),T},{}),cancel:T=>{for(let C=0;C<Rc.length;C++)u[Rc[C]].cancel(T)},state:c,steps:u}}const{schedule:_t,cancel:Ua,state:rn,steps:ap}=$_(typeof requestAnimationFrame<"u"?requestAnimationFrame:Mn,!0),P_=y.createContext({strict:!1}),xy={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"]},Ro={};for(const t in xy)Ro[t]={isEnabled:s=>xy[t].some(i=>!!s[i])};function AA(t){for(const s in t)Ro[s]={...Ro[s],...t[s]}}const DA=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Qc(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||DA.has(t)}let H_=t=>!Qc(t);function RA(t){t&&(H_=s=>s.startsWith("on")?!Qc(s):t(s))}try{RA(require("@emotion/is-prop-valid").default)}catch{}function MA(t,s,i){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(H_(c)||i===!0&&Qc(c)||!s&&!Qc(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function IA(t){if(typeof Proxy>"u")return t;const s=new Map,i=(...r)=>t(...r);return new Proxy(i,{get:(r,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const xd=y.createContext({});function el(t){return typeof t=="string"||Array.isArray(t)}function kd(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const bm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],_m=["initial",...bm];function Sd(t){return kd(t.animate)||_m.some(s=>el(t[s]))}function V_(t){return!!(Sd(t)||t.variants)}function OA(t,s){if(Sd(t)){const{initial:i,animate:r}=t;return{initial:i===!1||el(i)?i:void 0,animate:el(r)?r:void 0}}return t.inherit!==!1?s:{}}function LA(t){const{initial:s,animate:i}=OA(t,y.useContext(xd));return y.useMemo(()=>({initial:s,animate:i}),[ky(s),ky(i)])}function ky(t){return Array.isArray(t)?t.join(" "):t}const BA=Symbol.for("motionComponentSymbol");function So(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function zA(t,s,i){return y.useCallback(r=>{r&&t.onMount&&t.onMount(r),s&&(r?s.mount(r):s.unmount()),i&&(typeof i=="function"?i(r):So(i)&&(i.current=r))},[s])}const xm=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),UA="framerAppearId",q_="data-"+xm(UA),{schedule:km}=$_(queueMicrotask,!1),G_=y.createContext({});function $A(t,s,i,r,c){var d,u;const{visualElement:p}=y.useContext(xd),m=y.useContext(P_),g=y.useContext(_d),v=y.useContext(vm).reducedMotion,b=y.useRef(null);r=r||m.renderer,!b.current&&r&&(b.current=r(t,{visualState:s,parent:p,props:i,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const _=b.current,S=y.useContext(G_);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&PA(b.current,i,c,S);const k=y.useRef(!1);y.useInsertionEffect(()=>{_&&k.current&&_.update(i,g)});const w=i[q_],N=y.useRef(!!w&&!(!((d=window.MotionHandoffIsComplete)===null||d===void 0)&&d.call(window,w))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,w)));return z_(()=>{_&&(k.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),km.render(_.render),N.current&&_.animationState&&_.animationState.animateChanges())}),y.useEffect(()=>{_&&(!N.current&&_.animationState&&_.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)===null||T===void 0||T.call(window,w)}),N.current=!1))}),_}function PA(t,s,i,r){const{layoutId:c,layout:d,drag:u,dragConstraints:p,layoutScroll:m,layoutRoot:g}=s;t.projection=new i(t.latestValues,s["data-framer-portal-id"]?void 0:F_(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||p&&So(p),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:g})}function F_(t){if(t)return t.options.allowProjection!==!1?t.projection:F_(t.parent)}function HA({preloadedFeatures:t,createVisualElement:s,useRender:i,useVisualState:r,Component:c}){var d,u;t&&AA(t);function p(g,v){let b;const _={...y.useContext(vm),...g,layoutId:VA(g)},{isStatic:S}=_,k=LA(g),w=r(g,S);if(!S&&ym){qA();const N=GA(_);b=N.MeasureLayout,k.visualElement=$A(c,w,_,s,N.ProjectionNode)}return o.jsxs(xd.Provider,{value:k,children:[b&&k.visualElement?o.jsx(b,{visualElement:k.visualElement,..._}):null,i(c,g,zA(w,k.visualElement,v),w,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=y.forwardRef(p);return m[BA]=c,m}function VA({layoutId:t}){const s=y.useContext(hm).id;return s&&t!==void 0?s+"-"+t:t}function qA(t,s){y.useContext(P_).strict}function GA(t){const{drag:s,layout:i}=Ro;if(!s&&!i)return{};const r={...s,...i};return{MeasureLayout:s!=null&&s.isEnabled(t)||i!=null&&i.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const FA=["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 Sm(t){return typeof t!="string"||t.includes("-")?!1:!!(FA.indexOf(t)>-1||/[A-Z]/u.test(t))}function Sy(t){const s=[{},{}];return t==null||t.values.forEach((i,r)=>{s[0][r]=i.get(),s[1][r]=i.getVelocity()}),s}function Tm(t,s,i,r){if(typeof s=="function"){const[c,d]=Sy(r);s=s(i!==void 0?i:t.custom,c,d)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,d]=Sy(r);s=s(i!==void 0?i:t.custom,c,d)}return s}const Op=t=>Array.isArray(t),ZA=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),KA=t=>Op(t)?t[t.length-1]||0:t,dn=t=>!!(t&&t.getVelocity);function Fc(t){const s=dn(t)?t.get():t;return ZA(s)?s.toValue():s}function YA({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:i},r,c,d){const u={latestValues:JA(r,c,d,t),renderState:s()};return i&&(u.onMount=p=>i({props:r,current:p,...u}),u.onUpdate=p=>i(p)),u}const Z_=t=>(s,i)=>{const r=y.useContext(xd),c=y.useContext(_d),d=()=>YA(t,s,r,c);return i?d():gm(d)};function JA(t,s,i,r){const c={},d=r(t,{});for(const _ in d)c[_]=Fc(d[_]);let{initial:u,animate:p}=t;const m=Sd(t),g=V_(t);s&&g&&!m&&t.inherit!==!1&&(u===void 0&&(u=s.initial),p===void 0&&(p=s.animate));let v=i?i.initial===!1:!1;v=v||u===!1;const b=v?p:u;if(b&&typeof b!="boolean"&&!kd(b)){const _=Array.isArray(b)?b:[b];for(let S=0;S<_.length;S++){const k=Tm(t,_[S]);if(k){const{transitionEnd:w,transition:N,...T}=k;for(const C in T){let D=T[C];if(Array.isArray(D)){const L=v?D.length-1:0;D=D[L]}D!==null&&(c[C]=D)}for(const C in w)c[C]=w[C]}}}return c}const Uo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ei=new Set(Uo),K_=t=>s=>typeof s=="string"&&s.startsWith(t),Y_=K_("--"),WA=K_("var(--"),wm=t=>WA(t)?XA.test(t.split("/*")[0].trim()):!1,XA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,J_=(t,s)=>s&&typeof t=="number"?s.transform(t):t,ta=(t,s,i)=>i>s?s:i<t?t:i,$o={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},tl={...$o,transform:t=>ta(0,1,t)},Mc={...$o,default:1},dl=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Oa=dl("deg"),Ts=dl("%"),Ee=dl("px"),QA=dl("vh"),eD=dl("vw"),Ty={...Ts,parse:t=>Ts.parse(t)/100,transform:t=>Ts.transform(t*100)},tD={borderWidth:Ee,borderTopWidth:Ee,borderRightWidth:Ee,borderBottomWidth:Ee,borderLeftWidth:Ee,borderRadius:Ee,radius:Ee,borderTopLeftRadius:Ee,borderTopRightRadius:Ee,borderBottomRightRadius:Ee,borderBottomLeftRadius:Ee,width:Ee,maxWidth:Ee,height:Ee,maxHeight:Ee,top:Ee,right:Ee,bottom:Ee,left:Ee,padding:Ee,paddingTop:Ee,paddingRight:Ee,paddingBottom:Ee,paddingLeft:Ee,margin:Ee,marginTop:Ee,marginRight:Ee,marginBottom:Ee,marginLeft:Ee,backgroundPositionX:Ee,backgroundPositionY:Ee},nD={rotate:Oa,rotateX:Oa,rotateY:Oa,rotateZ:Oa,scale:Mc,scaleX:Mc,scaleY:Mc,scaleZ:Mc,skew:Oa,skewX:Oa,skewY:Oa,distance:Ee,translateX:Ee,translateY:Ee,translateZ:Ee,x:Ee,y:Ee,z:Ee,perspective:Ee,transformPerspective:Ee,opacity:tl,originX:Ty,originY:Ty,originZ:Ee},wy={...$o,transform:Math.round},jm={...tD,...nD,zIndex:wy,size:Ee,fillOpacity:tl,strokeOpacity:tl,numOctaves:wy},sD={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},aD=Uo.length;function iD(t,s,i){let r="",c=!0;for(let d=0;d<aD;d++){const u=Uo[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||i){const g=J_(p,jm[u]);if(!m){c=!1;const v=sD[u]||u;r+=`${v}(${g}) `}i&&(s[u]=g)}}return r=r.trim(),i?r=i(s,c?"":r):c&&(r="none"),r}function Nm(t,s,i){const{style:r,vars:c,transformOrigin:d}=t;let u=!1,p=!1;for(const m in s){const g=s[m];if(Ei.has(m)){u=!0;continue}else if(Y_(m)){c[m]=g;continue}else{const v=J_(g,jm[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||i?r.transform=iD(s,t.transform,i):r.transform&&(r.transform="none")),p){const{originX:m="50%",originY:g="50%",originZ:v=0}=d;r.transformOrigin=`${m} ${g} ${v}`}}const oD={offset:"stroke-dashoffset",array:"stroke-dasharray"},rD={offset:"strokeDashoffset",array:"strokeDasharray"};function lD(t,s,i=1,r=0,c=!0){t.pathLength=1;const d=c?oD:rD;t[d.offset]=Ee.transform(-r);const u=Ee.transform(s),p=Ee.transform(i);t[d.array]=`${u} ${p}`}function jy(t,s,i){return typeof t=="string"?t:Ee.transform(s+i*t)}function cD(t,s,i){const r=jy(s,t.x,t.width),c=jy(i,t.y,t.height);return`${r} ${c}`}function Cm(t,{attrX:s,attrY:i,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:m=0,...g},v,b){if(Nm(t,g,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:_,style:S,dimensions:k}=t;_.transform&&(k&&(S.transform=_.transform),delete _.transform),k&&(c!==void 0||d!==void 0||S.transform)&&(S.transformOrigin=cD(k,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(_.x=s),i!==void 0&&(_.y=i),r!==void 0&&(_.scale=r),u!==void 0&&lD(_,u,p,m,!1)}const Em=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),W_=()=>({...Em(),attrs:{}}),Am=t=>typeof t=="string"&&t.toLowerCase()==="svg";function X_(t,{style:s,vars:i},r,c){Object.assign(t.style,s,c&&c.getProjectionStyles(r));for(const d in i)t.style.setProperty(d,i[d])}const Q_=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 ex(t,s,i,r){X_(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(Q_.has(c)?c:xm(c),s.attrs[c])}const ed={};function dD(t){Object.assign(ed,t)}function tx(t,{layout:s,layoutId:i}){return Ei.has(t)||t.startsWith("origin")||(s||i!==void 0)&&(!!ed[t]||t==="opacity")}function Dm(t,s,i){var r;const{style:c}=t,d={};for(const u in c)(dn(c[u])||s.style&&dn(s.style[u])||tx(u,t)||((r=i==null?void 0:i.getValue(u))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(d[u]=c[u]);return d}function nx(t,s,i){const r=Dm(t,s,i);for(const c in t)if(dn(t[c])||dn(s[c])){const d=Uo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function uD(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 Ny=["x","y","width","height","cx","cy","r"],fD={useVisualState:Z_({scrapeMotionValuesFromProps:nx,createRenderState:W_,onUpdate:({props:t,prevProps:s,current:i,renderState:r,latestValues:c})=>{if(!i)return;let d=!!t.drag;if(!d){for(const p in c)if(Ei.has(p)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let p=0;p<Ny.length;p++){const m=Ny[p];t[m]!==s[m]&&(u=!0)}u&&_t.read(()=>{uD(i,r),_t.render(()=>{Cm(r,c,Am(i.tagName),t.transformTemplate),ex(i,r)})})}})},pD={useVisualState:Z_({scrapeMotionValuesFromProps:Dm,createRenderState:Em})};function sx(t,s,i){for(const r in s)!dn(s[r])&&!tx(r,i)&&(t[r]=s[r])}function mD({transformTemplate:t},s){return y.useMemo(()=>{const i=Em();return Nm(i,s,t),Object.assign({},i.vars,i.style)},[s])}function hD(t,s){const i=t.style||{},r={};return sx(r,i,t),Object.assign(r,mD(t,s)),r}function gD(t,s){const i={},r=hD(t,s);return t.drag&&t.dragListener!==!1&&(i.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(i.tabIndex=0),i.style=r,i}function vD(t,s,i,r){const c=y.useMemo(()=>{const d=W_();return Cm(d,s,Am(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};sx(d,t.style,t),c.style={...d,...c.style}}return c}function yD(t=!1){return(i,r,c,{latestValues:d},u)=>{const m=(Sm(i)?vD:gD)(r,d,u,i),g=MA(r,typeof i=="string",t),v=i!==y.Fragment?{...g,...m,ref:c}:{},{children:b}=r,_=y.useMemo(()=>dn(b)?b.get():b,[b]);return y.createElement(i,{...v,children:_})}}function bD(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Sm(r)?fD:pD,preloadedFeatures:t,useRender:yD(c),createVisualElement:s,Component:r};return HA(u)}}function ax(t,s){if(!Array.isArray(s))return!1;const i=s.length;if(i!==t.length)return!1;for(let r=0;r<i;r++)if(s[r]!==t[r])return!1;return!0}function Td(t,s,i){const r=t.getProps();return Tm(r,s,i!==void 0?i:r.custom,t)}function Rm(t,s){return t?t[s]||t.default||t:void 0}const ix=new Set(["width","height","top","left","right","bottom",...Uo]);let Zc;function _D(){Zc=void 0}const ws={now:()=>(Zc===void 0&&ws.set(rn.isProcessing||NA.useManualTiming?rn.timestamp:performance.now()),Zc),set:t=>{Zc=t,queueMicrotask(_D)}};function Mm(t,s){t.indexOf(s)===-1&&t.push(s)}function Im(t,s){const i=t.indexOf(s);i>-1&&t.splice(i,1)}class Om{constructor(){this.subscriptions=[]}add(s){return Mm(this.subscriptions,s),()=>Im(this.subscriptions,s)}notify(s,i,r){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,i,r);else for(let d=0;d<c;d++){const u=this.subscriptions[d];u&&u(s,i,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function ox(t,s){return s?t*(1e3/s):0}const Cy=30,xD=t=>!isNaN(parseFloat(t));class kD{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=ws.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=i.owner}setCurrent(s){this.current=s,this.updatedAt=ws.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=xD(this.current))}setPrevFrameValue(s=this.current){this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt}onChange(s){return this.on("change",s)}on(s,i){this.events[s]||(this.events[s]=new Om);const r=this.events[s].add(i);return s==="change"?()=>{r(),_t.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,i){this.passiveEffect=s,this.stopPassiveEffect=i}set(s,i=!0){!i||!this.passiveEffect?this.updateAndNotify(s,i):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,i,r){this.set(i),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-r}jump(s,i=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,i&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=ws.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Cy)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,Cy);return ox(parseFloat(this.current)-parseFloat(this.prevFrameValue),i)}start(s){return this.stop(),new Promise(i=>{this.hasAnimated=!0,this.animation=s(i),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function nl(t,s){return new kD(t,s)}function SD(t,s,i){t.hasValue(s)?t.getValue(s).set(i):t.addValue(s,nl(i))}function TD(t,s){const i=Td(t,s);let{transitionEnd:r={},transition:c={},...d}=i||{};d={...d,...r};for(const u in d){const p=KA(d[u]);SD(t,u,p)}}function wD(t){return!!(dn(t)&&t.add)}function Lp(t,s){const i=t.getValue("willChange");if(wD(i))return i.add(s)}function rx(t){return t.props[q_]}function Lm(t){let s;return()=>(s===void 0&&(s=t()),s)}const jD=Lm(()=>window.ScrollTimeline!==void 0);class ND{constructor(s){this.stop=()=>this.runAll("stop"),this.animations=s.filter(Boolean)}get finished(){return Promise.all(this.animations.map(s=>"finished"in s?s.finished:s))}getAll(s){return this.animations[0][s]}setAll(s,i){for(let r=0;r<this.animations.length;r++)this.animations[r][s]=i}attachTimeline(s,i){const r=this.animations.map(c=>{if(jD()&&c.attachTimeline)return c.attachTimeline(s);if(typeof i=="function")return i(c)});return()=>{r.forEach((c,d)=>{c&&c(),this.animations[d].stop()})}}get time(){return this.getAll("time")}set time(s){this.setAll("time",s)}get speed(){return this.getAll("speed")}set speed(s){this.setAll("speed",s)}get startTime(){return this.getAll("startTime")}get duration(){let s=0;for(let i=0;i<this.animations.length;i++)s=Math.max(s,this.animations[i].duration);return s}runAll(s){this.animations.forEach(i=>i[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class CD extends ND{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Ws=t=>t*1e3,Xs=t=>t/1e3;function Bm(t){return typeof t=="function"}function Ey(t,s){t.timeline=s,t.onfinish=null}const zm=t=>Array.isArray(t)&&typeof t[0]=="number",ED={linearEasing:void 0};function AD(t,s){const i=Lm(t);return()=>{var r;return(r=ED[s])!==null&&r!==void 0?r:i()}}const td=AD(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Mo=(t,s,i)=>{const r=s-t;return r===0?1:(i-t)/r},lx=(t,s,i=10)=>{let r="";const c=Math.max(Math.round(s/i),2);for(let d=0;d<c;d++)r+=t(Mo(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function cx(t){return!!(typeof t=="function"&&td()||!t||typeof t=="string"&&(t in Bp||td())||zm(t)||Array.isArray(t)&&t.every(cx))}const $r=([t,s,i,r])=>`cubic-bezier(${t}, ${s}, ${i}, ${r})`,Bp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:$r([0,.65,.55,1]),circOut:$r([.55,0,1,.45]),backIn:$r([.31,.01,.66,-.59]),backOut:$r([.33,1.53,.69,.99])};function dx(t,s){if(t)return typeof t=="function"&&td()?lx(t,s):zm(t)?$r(t):Array.isArray(t)?t.map(i=>dx(i,s)||Bp.easeOut):Bp[t]}const ux=(t,s,i)=>(((1-3*i+3*s)*t+(3*i-6*s))*t+3*s)*t,DD=1e-7,RD=12;function MD(t,s,i,r,c){let d,u,p=0;do u=s+(i-s)/2,d=ux(u,r,c)-t,d>0?i=u:s=u;while(Math.abs(d)>DD&&++p<RD);return u}function ul(t,s,i,r){if(t===s&&i===r)return Mn;const c=d=>MD(d,0,1,t,i);return d=>d===0||d===1?d:ux(c(d),s,r)}const fx=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,px=t=>s=>1-t(1-s),mx=ul(.33,1.53,.69,.99),Um=px(mx),hx=fx(Um),gx=t=>(t*=2)<1?.5*Um(t):.5*(2-Math.pow(2,-10*(t-1))),$m=t=>1-Math.sin(Math.acos(t)),vx=px($m),yx=fx($m),bx=t=>/^0[^.\s]+$/u.test(t);function ID(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||bx(t):!0}const Gr=t=>Math.round(t*1e5)/1e5,Pm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function OD(t){return t==null}const LD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Hm=(t,s)=>i=>!!(typeof i=="string"&&LD.test(i)&&i.startsWith(t)||s&&!OD(i)&&Object.prototype.hasOwnProperty.call(i,s)),_x=(t,s,i)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(Pm);return{[t]:parseFloat(c),[s]:parseFloat(d),[i]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},BD=t=>ta(0,255,t),ip={...$o,transform:t=>Math.round(BD(t))},_i={test:Hm("rgb","red"),parse:_x("red","green","blue"),transform:({red:t,green:s,blue:i,alpha:r=1})=>"rgba("+ip.transform(t)+", "+ip.transform(s)+", "+ip.transform(i)+", "+Gr(tl.transform(r))+")"};function zD(t){let s="",i="",r="",c="";return t.length>5?(s=t.substring(1,3),i=t.substring(3,5),r=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),i=t.substring(2,3),r=t.substring(3,4),c=t.substring(4,5),s+=s,i+=i,r+=r,c+=c),{red:parseInt(s,16),green:parseInt(i,16),blue:parseInt(r,16),alpha:c?parseInt(c,16)/255:1}}const zp={test:Hm("#"),parse:zD,transform:_i.transform},To={test:Hm("hsl","hue"),parse:_x("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:i,alpha:r=1})=>"hsla("+Math.round(t)+", "+Ts.transform(Gr(s))+", "+Ts.transform(Gr(i))+", "+Gr(tl.transform(r))+")"},cn={test:t=>_i.test(t)||zp.test(t)||To.test(t),parse:t=>_i.test(t)?_i.parse(t):To.test(t)?To.parse(t):zp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?_i.transform(t):To.transform(t)},UD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function $D(t){var s,i;return isNaN(t)&&typeof t=="string"&&(((s=t.match(Pm))===null||s===void 0?void 0:s.length)||0)+(((i=t.match(UD))===null||i===void 0?void 0:i.length)||0)>0}const xx="number",kx="color",PD="var",HD="var(",Ay="${}",VD=/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 sl(t){const s=t.toString(),i=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace(VD,m=>(cn.test(m)?(r.color.push(d),c.push(kx),i.push(cn.parse(m))):m.startsWith(HD)?(r.var.push(d),c.push(PD),i.push(m)):(r.number.push(d),c.push(xx),i.push(parseFloat(m))),++d,Ay)).split(Ay);return{values:i,split:p,indexes:r,types:c}}function Sx(t){return sl(t).values}function Tx(t){const{split:s,types:i}=sl(t),r=s.length;return c=>{let d="";for(let u=0;u<r;u++)if(d+=s[u],c[u]!==void 0){const p=i[u];p===xx?d+=Gr(c[u]):p===kx?d+=cn.transform(c[u]):d+=c[u]}return d}}const qD=t=>typeof t=="number"?0:t;function GD(t){const s=Sx(t);return Tx(t)(s.map(qD))}const $a={test:$D,parse:Sx,createTransformer:Tx,getAnimatableNone:GD},FD=new Set(["brightness","contrast","saturate","opacity"]);function ZD(t){const[s,i]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=i.match(Pm)||[];if(!r)return t;const c=i.replace(r,"");let d=FD.has(s)?1:0;return r!==i&&(d*=100),s+"("+d+c+")"}const KD=/\b([a-z-]*)\(.*?\)/gu,Up={...$a,getAnimatableNone:t=>{const s=t.match(KD);return s?s.map(ZD).join(" "):t}},YD={...jm,color:cn,backgroundColor:cn,outlineColor:cn,fill:cn,stroke:cn,borderColor:cn,borderTopColor:cn,borderRightColor:cn,borderBottomColor:cn,borderLeftColor:cn,filter:Up,WebkitFilter:Up},Vm=t=>YD[t];function wx(t,s){let i=Vm(t);return i!==Up&&(i=$a),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const JD=new Set(["auto","none","0"]);function WD(t,s,i){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!JD.has(d)&&sl(d).values.length&&(c=t[r]),r++}if(c&&i)for(const d of s)t[d]=wx(i,c)}const Dy=t=>t===$o||t===Ee,Ry=(t,s)=>parseFloat(t.split(", ")[s]),My=(t,s)=>(i,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return Ry(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?Ry(d[1],t):0}},XD=new Set(["x","y","z"]),QD=Uo.filter(t=>!XD.has(t));function eR(t){const s=[];return QD.forEach(i=>{const r=t.getValue(i);r!==void 0&&(s.push([i,r.get()]),r.set(i.startsWith("scale")?1:0))}),s}const Io={width:({x:t},{paddingLeft:s="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),height:({y:t},{paddingTop:s="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),top:(t,{top:s})=>parseFloat(s),left:(t,{left:s})=>parseFloat(s),bottom:({y:t},{top:s})=>parseFloat(s)+(t.max-t.min),right:({x:t},{left:s})=>parseFloat(s)+(t.max-t.min),x:My(4,13),y:My(5,14)};Io.translateX=Io.x;Io.translateY=Io.y;const xi=new Set;let $p=!1,Pp=!1;function jx(){if(Pp){const t=Array.from(xi).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),i=new Map;s.forEach(r=>{const c=eR(r);c.length&&(i.set(r,c),r.render())}),t.forEach(r=>r.measureInitialState()),s.forEach(r=>{r.render();const c=i.get(r);c&&c.forEach(([d,u])=>{var p;(p=r.getValue(d))===null||p===void 0||p.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Pp=!1,$p=!1,xi.forEach(t=>t.complete()),xi.clear()}function Nx(){xi.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pp=!0)})}function tR(){Nx(),jx()}class qm{constructor(s,i,r,c,d,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=i,this.name=r,this.motionValue=c,this.element=d,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(xi.add(this),$p||($p=!0,_t.read(Nx),_t.resolveKeyframes(jx))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:i,element:r,motionValue:c}=this;for(let d=0;d<s.length;d++)if(s[d]===null)if(d===0){const u=c==null?void 0:c.get(),p=s[s.length-1];if(u!==void 0)s[0]=u;else if(r&&i){const m=r.readValue(i,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),xi.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,xi.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Cx=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),nR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function sR(t){const s=nR.exec(t);if(!s)return[,];const[,i,r,c]=s;return[`--${i??r}`,c]}function Ex(t,s,i=1){const[r,c]=sR(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return Cx(u)?parseFloat(u):u}return wm(c)?Ex(c,s,i+1):c}const Ax=t=>s=>s.test(t),aR={test:t=>t==="auto",parse:t=>t},Dx=[$o,Ee,Ts,Oa,eD,QA,aR],Iy=t=>Dx.find(Ax(t));class Rx extends qm{constructor(s,i,r,c,d){super(s,i,r,c,d,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:i,name:r}=this;if(!i||!i.current)return;super.readKeyframes();for(let m=0;m<s.length;m++){let g=s[m];if(typeof g=="string"&&(g=g.trim(),wm(g))){const v=Ex(g,i.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!ix.has(r)||s.length!==2)return;const[c,d]=s,u=Iy(c),p=Iy(d);if(u!==p)if(Dy(u)&&Dy(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:i}=this,r=[];for(let c=0;c<s.length;c++)ID(s[c])&&r.push(c);r.length&&WD(s,r,i)}measureInitialState(){const{element:s,unresolvedKeyframes:i,name:r}=this;if(!s||!s.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Io[r](s.measureViewportBox(),window.getComputedStyle(s.current)),i[0]=this.measuredOrigin;const c=i[i.length-1];c!==void 0&&s.getValue(r,c).jump(c,!1)}measureEndState(){var s;const{element:i,name:r,unresolvedKeyframes:c}=this;if(!i||!i.current)return;const d=i.getValue(r);d&&d.jump(this.measuredOrigin,!1);const u=c.length-1,p=c[u];c[u]=Io[r](i.measureViewportBox(),window.getComputedStyle(i.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([m,g])=>{i.getValue(m).set(g)}),this.resolveNoneKeyframes()}}const Oy=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&($a.test(t)||t==="0")&&!t.startsWith("url("));function iR(t){const s=t[0];if(t.length===1)return!0;for(let i=0;i<t.length;i++)if(t[i]!==s)return!0}function oR(t,s,i,r){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const d=t[t.length-1],u=Oy(c,s),p=Oy(d,s);return!u||!p?!1:iR(t)||(i==="spring"||Bm(i))&&r}const rR=t=>t!==null;function wd(t,{repeat:s,repeatType:i="loop"},r){const c=t.filter(rR),d=s&&i!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const lR=40;class Mx{constructor({autoplay:s=!0,delay:i=0,type:r="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:u="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=ws.now(),this.options={autoplay:s,delay:i,type:r,repeat:c,repeatDelay:d,repeatType:u,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>lR?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&tR(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=ws.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:m,isGenerator:g}=this.options;if(!g&&!oR(s,r,c,d))if(u)this.options.duration=0;else{m&&m(wd(s,this.options,i)),p&&p(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,i);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:i,...v},this.onPostResolved())}onPostResolved(){}then(s,i){return this.currentFinishedPromise.then(s,i)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const Hp=2e4;function Ix(t){let s=0;const i=50;let r=t.next(s);for(;!r.done&&s<Hp;)s+=i,r=t.next(s);return s>=Hp?1/0:s}const jt=(t,s,i)=>t+(s-t)*i;function op(t,s,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+(s-t)*6*i:i<1/2?s:i<2/3?t+(s-t)*(2/3-i)*6:t}function cR({hue:t,saturation:s,lightness:i,alpha:r}){t/=360,s/=100,i/=100;let c=0,d=0,u=0;if(!s)c=d=u=i;else{const p=i<.5?i*(1+s):i+s-i*s,m=2*i-p;c=op(m,p,t+1/3),d=op(m,p,t),u=op(m,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function nd(t,s){return i=>i>0?s:t}const rp=(t,s,i)=>{const r=t*t,c=i*(s*s-r)+r;return c<0?0:Math.sqrt(c)},dR=[zp,_i,To],uR=t=>dR.find(s=>s.test(t));function Ly(t){const s=uR(t);if(!s)return!1;let i=s.parse(t);return s===To&&(i=cR(i)),i}const By=(t,s)=>{const i=Ly(t),r=Ly(s);if(!i||!r)return nd(t,s);const c={...i};return d=>(c.red=rp(i.red,r.red,d),c.green=rp(i.green,r.green,d),c.blue=rp(i.blue,r.blue,d),c.alpha=jt(i.alpha,r.alpha,d),_i.transform(c))},fR=(t,s)=>i=>s(t(i)),fl=(...t)=>t.reduce(fR),Vp=new Set(["none","hidden"]);function pR(t,s){return Vp.has(t)?i=>i<=0?t:s:i=>i>=1?s:t}function mR(t,s){return i=>jt(t,s,i)}function Gm(t){return typeof t=="number"?mR:typeof t=="string"?wm(t)?nd:cn.test(t)?By:vR:Array.isArray(t)?Ox:typeof t=="object"?cn.test(t)?By:hR:nd}function Ox(t,s){const i=[...t],r=i.length,c=t.map((d,u)=>Gm(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)i[u]=c[u](d);return i}}function hR(t,s){const i={...t,...s},r={};for(const c in i)t[c]!==void 0&&s[c]!==void 0&&(r[c]=Gm(t[c])(t[c],s[c]));return c=>{for(const d in r)i[d]=r[d](c);return i}}function gR(t,s){var i;const r=[],c={color:0,var:0,number:0};for(let d=0;d<s.values.length;d++){const u=s.types[d],p=t.indexes[u][c[u]],m=(i=t.values[p])!==null&&i!==void 0?i:0;r[d]=m,c[u]++}return r}const vR=(t,s)=>{const i=$a.createTransformer(s),r=sl(t),c=sl(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?Vp.has(t)&&!c.values.length||Vp.has(s)&&!r.values.length?pR(t,s):fl(Ox(gR(r,c),c.values),i):nd(t,s)};function Lx(t,s,i){return typeof t=="number"&&typeof s=="number"&&typeof i=="number"?jt(t,s,i):Gm(t)(t,s)}const yR=5;function Bx(t,s,i){const r=Math.max(s-yR,0);return ox(i-t(r),s-r)}const Dt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},lp=.001;function bR({duration:t=Dt.duration,bounce:s=Dt.bounce,velocity:i=Dt.velocity,mass:r=Dt.mass}){let c,d,u=1-s;u=ta(Dt.minDamping,Dt.maxDamping,u),t=ta(Dt.minDuration,Dt.maxDuration,Xs(t)),u<1?(c=g=>{const v=g*u,b=v*t,_=v-i,S=qp(g,u),k=Math.exp(-b);return lp-_/S*k},d=g=>{const b=g*u*t,_=b*i+i,S=Math.pow(u,2)*Math.pow(g,2)*t,k=Math.exp(-b),w=qp(Math.pow(g,2),u);return(-c(g)+lp>0?-1:1)*((_-S)*k)/w}):(c=g=>{const v=Math.exp(-g*t),b=(g-i)*t+1;return-lp+v*b},d=g=>{const v=Math.exp(-g*t),b=(i-g)*(t*t);return v*b});const p=5/t,m=xR(c,d,p);if(t=Ws(t),isNaN(m))return{stiffness:Dt.stiffness,damping:Dt.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const _R=12;function xR(t,s,i){let r=i;for(let c=1;c<_R;c++)r=r-t(r)/s(r);return r}function qp(t,s){return t*Math.sqrt(1-s*s)}const kR=["duration","bounce"],SR=["stiffness","damping","mass"];function zy(t,s){return s.some(i=>t[i]!==void 0)}function TR(t){let s={velocity:Dt.velocity,stiffness:Dt.stiffness,damping:Dt.damping,mass:Dt.mass,isResolvedFromDuration:!1,...t};if(!zy(t,SR)&&zy(t,kR))if(t.visualDuration){const i=t.visualDuration,r=2*Math.PI/(i*1.2),c=r*r,d=2*ta(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:Dt.mass,stiffness:c,damping:d}}else{const i=bR(t);s={...s,...i,mass:Dt.mass},s.isResolvedFromDuration=!0}return s}function zx(t=Dt.visualDuration,s=Dt.bounce){const i=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:r,restDelta:c}=i;const d=i.keyframes[0],u=i.keyframes[i.keyframes.length-1],p={done:!1,value:d},{stiffness:m,damping:g,mass:v,duration:b,velocity:_,isResolvedFromDuration:S}=TR({...i,velocity:-Xs(i.velocity||0)}),k=_||0,w=g/(2*Math.sqrt(m*v)),N=u-d,T=Xs(Math.sqrt(m/v)),C=Math.abs(N)<5;r||(r=C?Dt.restSpeed.granular:Dt.restSpeed.default),c||(c=C?Dt.restDelta.granular:Dt.restDelta.default);let D;if(w<1){const E=qp(T,w);D=I=>{const O=Math.exp(-w*T*I);return u-O*((k+w*T*N)/E*Math.sin(E*I)+N*Math.cos(E*I))}}else if(w===1)D=E=>u-Math.exp(-T*E)*(N+(k+T*N)*E);else{const E=T*Math.sqrt(w*w-1);D=I=>{const O=Math.exp(-w*T*I),z=Math.min(E*I,300);return u-O*((k+w*T*N)*Math.sinh(z)+E*N*Math.cosh(z))/E}}const L={calculatedDuration:S&&b||null,next:E=>{const I=D(E);if(S)p.done=E>=b;else{let O=0;w<1&&(O=E===0?Ws(k):Bx(D,E,I));const z=Math.abs(O)<=r,$=Math.abs(u-I)<=c;p.done=z&&$}return p.value=p.done?u:I,p},toString:()=>{const E=Math.min(Ix(L),Hp),I=lx(O=>L.next(E*O).value,E,30);return E+"ms "+I}};return L}function Uy({keyframes:t,velocity:s=0,power:i=.8,timeConstant:r=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:u,min:p,max:m,restDelta:g=.5,restSpeed:v}){const b=t[0],_={done:!1,value:b},S=z=>p!==void 0&&z<p||m!==void 0&&z>m,k=z=>p===void 0?m:m===void 0||Math.abs(p-z)<Math.abs(m-z)?p:m;let w=i*s;const N=b+w,T=u===void 0?N:u(N);T!==N&&(w=T-b);const C=z=>-w*Math.exp(-z/r),D=z=>T+C(z),L=z=>{const $=C(z),X=D(z);_.done=Math.abs($)<=g,_.value=_.done?T:X};let E,I;const O=z=>{S(_.value)&&(E=z,I=zx({keyframes:[_.value,k(_.value)],velocity:Bx(D,z,_.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return O(0),{calculatedDuration:null,next:z=>{let $=!1;return!I&&E===void 0&&($=!0,L(z),O(z)),E!==void 0&&z>=E?I.next(z-E):(!$&&L(z),_)}}}const wR=ul(.42,0,1,1),jR=ul(0,0,.58,1),Ux=ul(.42,0,.58,1),NR=t=>Array.isArray(t)&&typeof t[0]!="number",CR={linear:Mn,easeIn:wR,easeInOut:Ux,easeOut:jR,circIn:$m,circInOut:yx,circOut:vx,backIn:Um,backInOut:hx,backOut:mx,anticipate:gx},$y=t=>{if(zm(t)){U_(t.length===4);const[s,i,r,c]=t;return ul(s,i,r,c)}else if(typeof t=="string")return CR[t];return t};function ER(t,s,i){const r=[],c=i||Lx,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]||Mn:s;p=fl(m,p)}r.push(p)}return r}function AR(t,s,{clamp:i=!0,ease:r,mixer:c}={}){const d=t.length;if(U_(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=ER(s,r,c),m=p.length,g=v=>{if(u&&v<t[0])return s[0];let b=0;if(m>1)for(;b<t.length-2&&!(v<t[b+1]);b++);const _=Mo(t[b],t[b+1],v);return p[b](_)};return i?v=>g(ta(t[0],t[d-1],v)):g}function DR(t,s){const i=t[t.length-1];for(let r=1;r<=s;r++){const c=Mo(0,s,r);t.push(jt(i,1,c))}}function RR(t){const s=[0];return DR(s,t.length-1),s}function MR(t,s){return t.map(i=>i*s)}function IR(t,s){return t.map(()=>s||Ux).splice(0,t.length-1)}function sd({duration:t=300,keyframes:s,times:i,ease:r="easeInOut"}){const c=NR(r)?r.map($y):$y(r),d={done:!1,value:s[0]},u=MR(i&&i.length===s.length?i:RR(s),t),p=AR(u,s,{ease:Array.isArray(c)?c:IR(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const OR=t=>{const s=({timestamp:i})=>t(i);return{start:()=>_t.update(s,!0),stop:()=>Ua(s),now:()=>rn.isProcessing?rn.timestamp:ws.now()}},LR={decay:Uy,inertia:Uy,tween:sd,keyframes:sd,spring:zx},BR=t=>t/100;class Fm extends Mx{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:i,motionValue:r,element:c,keyframes:d}=this.options,u=(c==null?void 0:c.KeyframeResolver)||qm,p=(m,g)=>this.onKeyframesResolved(m,g);this.resolver=new u(d,p,i,r,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:i="keyframes",repeat:r=0,repeatDelay:c=0,repeatType:d,velocity:u=0}=this.options,p=Bm(i)?i:LR[i]||sd;let m,g;p!==sd&&typeof s[0]!="number"&&(m=fl(BR,Lx(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=Ix(v));const{calculatedDuration:b}=v,_=b+c,S=_*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:m,calculatedDuration:b,resolvedDuration:_,totalDuration:S}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,i=!1){const{resolved:r}=this;if(!r){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:u,mapPercentToKeyframes:p,keyframes:m,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=r;if(this.startTime===null)return d.next(0);const{delay:_,repeat:S,repeatType:k,repeatDelay:w,onUpdate:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),i?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const T=this.currentTime-_*(this.speed>=0?1:-1),C=this.speed>=0?T<0:T>v;this.currentTime=Math.max(T,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let D=this.currentTime,L=d;if(S){const z=Math.min(this.currentTime,v)/b;let $=Math.floor(z),X=z%1;!X&&z>=1&&(X=1),X===1&&$--,$=Math.min($,S+1),!!($%2)&&(k==="reverse"?(X=1-X,w&&(X-=w/b)):k==="mirror"&&(L=u)),D=ta(0,1,X)*b}const E=C?{done:!1,value:m[0]}:L.next(D);p&&(E.value=p(E.value));let{done:I}=E;!C&&g!==null&&(I=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&I);return O&&c!==void 0&&(E.value=wd(m,this.options,c)),N&&N(E.value),O&&this.finish(),E}get duration(){const{resolved:s}=this;return s?Xs(s.calculatedDuration):0}get time(){return Xs(this.currentTime)}set time(s){s=Ws(s),this.currentTime=s,this.holdTime!==null||this.speed===0?this.holdTime=s:this.driver&&(this.startTime=this.driver.now()-s/this.speed)}get speed(){return this.playbackSpeed}set speed(s){const i=this.playbackSpeed!==s;this.playbackSpeed=s,i&&(this.time=Xs(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=OR,onPlay:i,startTime:r}=this.options;this.driver||(this.driver=s(d=>this.tick(d))),i&&i();const c=this.driver.now();this.holdTime!==null?this.startTime=c-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=c):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var s;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(s=this.currentTime)!==null&&s!==void 0?s:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:s}=this.options;s&&s()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(s){return this.startTime=0,this.tick(s,!0)}}const zR=new Set(["opacity","clipPath","filter","transform"]);function UR(t,s,i,{delay:r=0,duration:c=300,repeat:d=0,repeatType:u="loop",ease:p="easeInOut",times:m}={}){const g={[s]:i};m&&(g.offset=m);const v=dx(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 $R=Lm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ad=10,PR=2e4;function HR(t){return Bm(t.type)||t.type==="spring"||!cx(t.ease)}function VR(t,s){const i=new Fm({...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<PR;)r=i.sample(d),c.push(r.value),d+=ad;return{times:void 0,keyframes:c,duration:d-ad,ease:"linear"}}const $x={anticipate:gx,backInOut:hx,circInOut:yx};function qR(t){return t in $x}class Py extends Mx{constructor(s){super(s);const{name:i,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new Rx(d,(u,p)=>this.onKeyframesResolved(u,p),i,r,c),this.resolver.scheduleResolve()}initPlayback(s,i){let{duration:r=300,times:c,ease:d,type:u,motionValue:p,name:m,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof d=="string"&&td()&&qR(d)&&(d=$x[d]),HR(this.options)){const{onComplete:b,onUpdate:_,motionValue:S,element:k,...w}=this.options,N=VR(s,w);s=N.keyframes,s.length===1&&(s[1]=s[0]),r=N.duration,c=N.times,d=N.ease,u="keyframes"}const v=UR(p.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(Ey(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(wd(s,this.options,i)),b&&b(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:r,times:c,type:u,ease:d,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:i}=s;return Xs(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Xs(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:r}=i;r.currentTime=Ws(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:i}=s;return i.playbackRate}set speed(s){const{resolved:i}=this;if(!i)return;const{animation:r}=i;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:i}=s;return i.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:i}=s;return i.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:i}=this;if(!i)return Mn;const{animation:r}=i;Ey(r,s)}return Mn}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.playState==="finished"&&this.updateFinishedPromise(),i.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:i,keyframes:r,duration:c,type:d,ease:u,times:p}=s;if(i.playState==="idle"||i.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:_,...S}=this.options,k=new Fm({...S,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),w=Ws(this.time);g.setWithVelocity(k.sample(w-ad).value,k.sample(w).value,ad)}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:i,name:r,repeatDelay:c,repeatType:d,damping:u,type:p}=s;if(!i||!i.owner||!(i.owner.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:g}=i.owner.getProps();return $R()&&r&&zR.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const GR={type:"spring",stiffness:500,damping:25,restSpeed:10},FR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),ZR={type:"keyframes",duration:.8},KR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},YR=(t,{keyframes:s})=>s.length>2?ZR:Ei.has(t)?t.startsWith("scale")?FR(s[1]):GR:KR;function JR({when:t,delay:s,delayChildren:i,staggerChildren:r,staggerDirection:c,repeat:d,repeatType:u,repeatDelay:p,from:m,elapsed:g,...v}){return!!Object.keys(v).length}const Zm=(t,s,i,r={},c,d)=>u=>{const p=Rm(r,t)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-Ws(m);let v={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:_=>{s.set(_),p.onUpdate&&p.onUpdate(_)},onComplete:()=>{u(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:d?void 0:c};JR(p)||(v={...v,...YR(t,v)}),v.duration&&(v.duration=Ws(v.duration)),v.repeatDelay&&(v.repeatDelay=Ws(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let b=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(b=!0)),b&&!d&&s.get()!==void 0){const _=wd(v.keyframes,p);if(_!==void 0)return _t.update(()=>{v.onUpdate(_),v.onComplete()}),new CD([])}return!d&&Py.supports(v)?new Py(v):new Fm(v)};function WR({protectedKeys:t,needsAnimating:s},i){const r=t.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,r}function Px(t,s,{delay:i=0,transitionOverride:r,type:c}={}){var d;let{transition:u=t.getDefaultTransition(),transitionEnd:p,...m}=s;r&&(u=r);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const b in m){const _=t.getValue(b,(d=t.latestValues[b])!==null&&d!==void 0?d:null),S=m[b];if(S===void 0||v&&WR(v,b))continue;const k={delay:i,...Rm(u||{},b)};let w=!1;if(window.MotionHandoffAnimation){const T=rx(t);if(T){const C=window.MotionHandoffAnimation(T,b,_t);C!==null&&(k.startTime=C,w=!0)}}Lp(t,b),_.start(Zm(b,_,S,t.shouldReduceMotion&&ix.has(b)?{type:!1}:k,t,w));const N=_.animation;N&&g.push(N)}return p&&Promise.all(g).then(()=>{_t.update(()=>{p&&TD(t,p)})}),g}function Gp(t,s,i={}){var r;const c=Td(t,s,i.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};i.transitionOverride&&(d=i.transitionOverride);const u=c?()=>Promise.all(Px(t,c,i)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=d;return XR(t,s,v+g,b,_,i)}:()=>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(i.delay)])}function XR(t,s,i=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(QR).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(Gp(g,s,{...d,delay:i+m(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function QR(t,s){return t.sortNodePosition(s)}function e3(t,s,i={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>Gp(t,d,i));r=Promise.all(c)}else if(typeof s=="string")r=Gp(t,s,i);else{const c=typeof s=="function"?Td(t,s,i.custom):s;r=Promise.all(Px(t,c,i))}return r.then(()=>{t.notify("AnimationComplete",s)})}const t3=_m.length;function Hx(t){if(!t)return;if(!t.isControllingVariants){const i=t.parent?Hx(t.parent)||{}:{};return t.props.initial!==void 0&&(i.initial=t.props.initial),i}const s={};for(let i=0;i<t3;i++){const r=_m[i],c=t.props[r];(el(c)||c===!1)&&(s[r]=c)}return s}const n3=[...bm].reverse(),s3=bm.length;function a3(t){return s=>Promise.all(s.map(({animation:i,options:r})=>e3(t,i,r)))}function i3(t){let s=a3(t),i=Hy(),r=!0;const c=m=>(g,v)=>{var b;const _=Td(t,v,m==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(_){const{transition:S,transitionEnd:k,...w}=_;g={...g,...w,...k}}return g};function d(m){s=m(t)}function u(m){const{props:g}=t,v=Hx(t.parent)||{},b=[],_=new Set;let S={},k=1/0;for(let N=0;N<s3;N++){const T=n3[N],C=i[T],D=g[T]!==void 0?g[T]:v[T],L=el(D),E=T===m?C.isActive:null;E===!1&&(k=N);let I=D===v[T]&&D!==g[T]&&L;if(I&&r&&t.manuallyAnimateOnMount&&(I=!1),C.protectedKeys={...S},!C.isActive&&E===null||!D&&!C.prevProp||kd(D)||typeof D=="boolean")continue;const O=o3(C.prevProp,D);let z=O||T===m&&C.isActive&&!I&&L||N>k&&L,$=!1;const X=Array.isArray(D)?D:[D];let te=X.reduce(c(T),{});E===!1&&(te={});const{prevResolvedValues:P={}}=C,ae={...P,...te},K=F=>{z=!0,_.has(F)&&($=!0,_.delete(F)),C.needsAnimating[F]=!0;const oe=t.getValue(F);oe&&(oe.liveStyle=!1)};for(const F in ae){const oe=te[F],pe=P[F];if(S.hasOwnProperty(F))continue;let de=!1;Op(oe)&&Op(pe)?de=!ax(oe,pe):de=oe!==pe,de?oe!=null?K(F):_.add(F):oe!==void 0&&_.has(F)?K(F):C.protectedKeys[F]=!0}C.prevProp=D,C.prevResolvedValues=te,C.isActive&&(S={...S,...te}),r&&t.blockInitialAnimation&&(z=!1),z&&(!(I&&O)||$)&&b.push(...X.map(F=>({animation:F,options:{type:T}})))}if(_.size){const N={};_.forEach(T=>{const C=t.getBaseTarget(T),D=t.getValue(T);D&&(D.liveStyle=!0),N[T]=C??null}),b.push({animation:N})}let w=!!b.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(w=!1),r=!1,w?s(b):Promise.resolve()}function p(m,g){var v;if(i[m].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(_=>{var S;return(S=_.animationState)===null||S===void 0?void 0:S.setActive(m,g)}),i[m].isActive=g;const b=u(m);for(const _ in i)i[_].protectedKeys={};return b}return{animateChanges:u,setActive:p,setAnimateFunction:d,getState:()=>i,reset:()=>{i=Hy(),r=!0}}}function o3(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!ax(s,t):!1}function pi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Hy(){return{animate:pi(!0),whileInView:pi(),whileHover:pi(),whileTap:pi(),whileDrag:pi(),whileFocus:pi(),exit:pi()}}class Va{constructor(s){this.isMounted=!1,this.node=s}update(){}}class r3 extends Va{constructor(s){super(s),s.animationState||(s.animationState=i3(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();kd(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:i}=this.node.prevProps||{};s!==i&&this.updateAnimationControlsSubscription()}unmount(){var s;this.node.animationState.reset(),(s=this.unmountControls)===null||s===void 0||s.call(this)}}let l3=0;class c3 extends Va{constructor(){super(...arguments),this.id=l3++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:i}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===r)return;const c=this.node.animationState.setActive("exit",!s);i&&!s&&c.then(()=>i(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const d3={animation:{Feature:r3},exit:{Feature:c3}},us={x:!1,y:!1};function Vx(){return us.x||us.y}function u3(t){return t==="x"||t==="y"?us[t]?null:(us[t]=!0,()=>{us[t]=!1}):us.x||us.y?null:(us.x=us.y=!0,()=>{us.x=us.y=!1})}const Km=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function al(t,s,i,r={passive:!0}){return t.addEventListener(s,i,r),()=>t.removeEventListener(s,i)}function pl(t){return{point:{x:t.pageX,y:t.pageY}}}const f3=t=>s=>Km(s)&&t(s,pl(s));function Fr(t,s,i,r){return al(t,s,f3(i),r)}const Vy=(t,s)=>Math.abs(t-s);function p3(t,s){const i=Vy(t.x,s.x),r=Vy(t.y,s.y);return Math.sqrt(i**2+r**2)}class qx{constructor(s,i,{transformPagePoint:r,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=dp(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,S=p3(b.offset,{x:0,y:0})>=3;if(!_&&!S)return;const{point:k}=b,{timestamp:w}=rn;this.history.push({...k,timestamp:w});const{onStart:N,onMove:T}=this.handlers;_||(N&&N(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=cp(_,this.transformPagePoint),_t.update(this.updatePoint,!0)},this.handlePointerUp=(b,_)=>{this.end();const{onEnd:S,onSessionEnd:k,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=dp(b.type==="pointercancel"?this.lastMoveEventInfo:cp(_,this.transformPagePoint),this.history);this.startEvent&&S&&S(b,N),k&&k(b,N)},!Km(s))return;this.dragSnapToOrigin=d,this.handlers=i,this.transformPagePoint=r,this.contextWindow=c||window;const u=pl(s),p=cp(u,this.transformPagePoint),{point:m}=p,{timestamp:g}=rn;this.history=[{...m,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,dp(p,this.history)),this.removeListeners=fl(Fr(this.contextWindow,"pointermove",this.handlePointerMove),Fr(this.contextWindow,"pointerup",this.handlePointerUp),Fr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Ua(this.updatePoint)}}function cp(t,s){return s?{point:s(t.point)}:t}function qy(t,s){return{x:t.x-s.x,y:t.y-s.y}}function dp({point:t},s){return{point:t,delta:qy(t,Gx(s)),offset:qy(t,m3(s)),velocity:h3(s,.1)}}function m3(t){return t[0]}function Gx(t){return t[t.length-1]}function h3(t,s){if(t.length<2)return{x:0,y:0};let i=t.length-1,r=null;const c=Gx(t);for(;i>=0&&(r=t[i],!(c.timestamp-r.timestamp>Ws(s)));)i--;if(!r)return{x:0,y:0};const d=Xs(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 Fx=1e-4,g3=1-Fx,v3=1+Fx,Zx=.01,y3=0-Zx,b3=0+Zx;function On(t){return t.max-t.min}function _3(t,s,i){return Math.abs(t-s)<=i}function Gy(t,s,i,r=.5){t.origin=r,t.originPoint=jt(s.min,s.max,t.origin),t.scale=On(i)/On(s),t.translate=jt(i.min,i.max,t.origin)-t.originPoint,(t.scale>=g3&&t.scale<=v3||isNaN(t.scale))&&(t.scale=1),(t.translate>=y3&&t.translate<=b3||isNaN(t.translate))&&(t.translate=0)}function Zr(t,s,i,r){Gy(t.x,s.x,i.x,r?r.originX:void 0),Gy(t.y,s.y,i.y,r?r.originY:void 0)}function Fy(t,s,i){t.min=i.min+s.min,t.max=t.min+On(s)}function x3(t,s,i){Fy(t.x,s.x,i.x),Fy(t.y,s.y,i.y)}function Zy(t,s,i){t.min=s.min-i.min,t.max=t.min+On(s)}function Kr(t,s,i){Zy(t.x,s.x,i.x),Zy(t.y,s.y,i.y)}function k3(t,{min:s,max:i},r){return s!==void 0&&t<s?t=r?jt(s,t,r.min):Math.max(t,s):i!==void 0&&t>i&&(t=r?jt(i,t,r.max):Math.min(t,i)),t}function Ky(t,s,i){return{min:s!==void 0?t.min+s:void 0,max:i!==void 0?t.max+i-(t.max-t.min):void 0}}function S3(t,{top:s,left:i,bottom:r,right:c}){return{x:Ky(t.x,i,c),y:Ky(t.y,s,r)}}function Yy(t,s){let i=s.min-t.min,r=s.max-t.max;return s.max-s.min<t.max-t.min&&([i,r]=[r,i]),{min:i,max:r}}function T3(t,s){return{x:Yy(t.x,s.x),y:Yy(t.y,s.y)}}function w3(t,s){let i=.5;const r=On(t),c=On(s);return c>r?i=Mo(s.min,s.max-r,t.min):r>c&&(i=Mo(t.min,t.max-c,s.min)),ta(0,1,i)}function j3(t,s){const i={};return s.min!==void 0&&(i.min=s.min-t.min),s.max!==void 0&&(i.max=s.max-t.min),i}const Fp=.35;function N3(t=Fp){return t===!1?t=0:t===!0&&(t=Fp),{x:Jy(t,"left","right"),y:Jy(t,"top","bottom")}}function Jy(t,s,i){return{min:Wy(t,s),max:Wy(t,i)}}function Wy(t,s){return typeof t=="number"?t:t[s]||0}const Xy=()=>({translate:0,scale:1,origin:0,originPoint:0}),wo=()=>({x:Xy(),y:Xy()}),Qy=()=>({min:0,max:0}),Lt=()=>({x:Qy(),y:Qy()});function Wn(t){return[t("x"),t("y")]}function Kx({top:t,left:s,right:i,bottom:r}){return{x:{min:s,max:i},y:{min:t,max:r}}}function C3({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function E3(t,s){if(!s)return t;const i=s({x:t.left,y:t.top}),r=s({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:r.y,right:r.x}}function up(t){return t===void 0||t===1}function Zp({scale:t,scaleX:s,scaleY:i}){return!up(t)||!up(s)||!up(i)}function yi(t){return Zp(t)||Yx(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Yx(t){return eb(t.x)||eb(t.y)}function eb(t){return t&&t!=="0%"}function id(t,s,i){const r=t-i,c=s*r;return i+c}function tb(t,s,i,r,c){return c!==void 0&&(t=id(t,c,r)),id(t,i,r)+s}function Kp(t,s=0,i=1,r,c){t.min=tb(t.min,s,i,r,c),t.max=tb(t.max,s,i,r,c)}function Jx(t,{x:s,y:i}){Kp(t.x,s.translate,s.scale,s.originPoint),Kp(t.y,i.translate,i.scale,i.originPoint)}const nb=.999999999999,sb=1.0000000000001;function A3(t,s,i,r=!1){const c=i.length;if(!c)return;s.x=s.y=1;let d,u;for(let p=0;p<c;p++){d=i[p],u=d.projectionDelta;const{visualElement:m}=d.options;m&&m.props.style&&m.props.style.display==="contents"||(r&&d.options.layoutScroll&&d.scroll&&d!==d.root&&No(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,Jx(t,u)),r&&yi(d.latestValues)&&No(t,d.latestValues))}s.x<sb&&s.x>nb&&(s.x=1),s.y<sb&&s.y>nb&&(s.y=1)}function jo(t,s){t.min=t.min+s,t.max=t.max+s}function ab(t,s,i,r,c=.5){const d=jt(t.min,t.max,c);Kp(t,s,i,d,r)}function No(t,s){ab(t.x,s.x,s.scaleX,s.scale,s.originX),ab(t.y,s.y,s.scaleY,s.scale,s.originY)}function Wx(t,s){return Kx(E3(t.getBoundingClientRect(),s))}function D3(t,s,i){const r=Wx(t,i),{scroll:c}=s;return c&&(jo(r.x,c.offset.x),jo(r.y,c.offset.y)),r}const Xx=({current:t})=>t?t.ownerDocument.defaultView:null,R3=new WeakMap;class M3{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=Lt(),this.visualElement=s}start(s,{snapToCursor:i=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(pl(v).point)},d=(v,b)=>{const{drag:_,dragPropagation:S,onDragStart:k}=this.getProps();if(_&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=u3(_),!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),Wn(N=>{let T=this.getAxisMotionValue(N).get()||0;if(Ts.test(T)){const{projection:C}=this.visualElement;if(C&&C.layout){const D=C.layout.layoutBox[N];D&&(T=On(D)*(parseFloat(T)/100))}}this.originPoint[N]=T}),k&&_t.postRender(()=>k(v,b)),Lp(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},u=(v,b)=>{const{dragPropagation:_,dragDirectionLock:S,onDirectionLock:k,onDrag:w}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:N}=b;if(S&&this.currentDirection===null){this.currentDirection=I3(N),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",b.point,N),this.updateAxis("y",b.point,N),this.visualElement.render(),w&&w(v,b)},p=(v,b)=>this.stop(v,b),m=()=>Wn(v=>{var b;return this.getAnimationState(v)==="paused"&&((b=this.getAxisMotionValue(v).animation)===null||b===void 0?void 0:b.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new qx(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:p,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:Xx(this.visualElement)})}stop(s,i){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:c}=i;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&_t.postRender(()=>d(s,i))}cancel(){this.isDragging=!1;const{projection:s,animationState:i}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),i&&i.setActive("whileDrag",!1)}updateAxis(s,i,r){const{drag:c}=this.getProps();if(!r||!Ic(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=k3(u,this.constraints[s],this.elastic[s])),d.set(u)}resolveConstraints(){var s;const{dragConstraints:i,dragElastic:r}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)===null||s===void 0?void 0:s.layout,d=this.constraints;i&&So(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=S3(c.layoutBox,i):this.constraints=!1,this.elastic=N3(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Wn(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=j3(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!So(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=D3(r,c.root,this.visualElement.getTransformPagePoint());let u=T3(c.layout.layoutBox,d);if(i){const p=i(C3(u));this.hasMutatedConstraints=!!p,p&&(u=Kx(p))}return u}startAnimation(s){const{drag:i,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=Wn(v=>{if(!Ic(v,i,this.currentDirection))return;let b=m&&m[v]||{};u&&(b={min:0,max:0});const _=c?200:1e6,S=c?40:1e7,k={type:"inertia",velocity:r?s[v]:0,bounceStiffness:_,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...d,...b};return this.startAxisValueAnimation(v,k)});return Promise.all(g).then(p)}startAxisValueAnimation(s,i){const r=this.getAxisMotionValue(s);return Lp(this.visualElement,s),r.start(Zm(s,r,0,i,this.visualElement,!1))}stopAnimation(){Wn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){Wn(s=>{var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.pause()})}getAnimationState(s){var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.state}getAxisMotionValue(s){const i=`_drag${s.toUpperCase()}`,r=this.visualElement.getProps(),c=r[i];return c||this.visualElement.getValue(s,(r.initial?r.initial[s]:void 0)||0)}snapToCursor(s){Wn(i=>{const{drag:r}=this.getProps();if(!Ic(i,r,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(i);if(c&&c.layout){const{min:u,max:p}=c.layout.layoutBox[i];d.set(s[i]-jt(u,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:r}=this.visualElement;if(!So(i)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Wn(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const m=p.get();c[u]=w3({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(),Wn(u=>{if(!Ic(u,s,null))return;const p=this.getAxisMotionValue(u),{min:m,max:g}=this.constraints[u];p.set(jt(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;R3.set(this.visualElement,this);const s=this.visualElement.current,i=Fr(s,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();So(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()),_t.read(r);const u=al(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(Wn(v=>{const b=this.getAxisMotionValue(v);b&&(this.originPoint[v]+=m[v].translate,b.set(b.get()+m[v].translate))}),this.visualElement.render())}));return()=>{u(),i(),d(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:u=Fp,dragMomentum:p=!0}=s;return{...s,drag:i,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function Ic(t,s,i){return(s===!0||s===t)&&(i===null||i===t)}function I3(t,s=10){let i=null;return Math.abs(t.y)>s?i="y":Math.abs(t.x)>s&&(i="x"),i}class O3 extends Va{constructor(s){super(s),this.removeGroupControls=Mn,this.removeListeners=Mn,this.controls=new M3(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Mn}unmount(){this.removeGroupControls(),this.removeListeners()}}const ib=t=>(s,i)=>{t&&_t.postRender(()=>t(s,i))};class L3 extends Va{constructor(){super(...arguments),this.removePointerDownListener=Mn}onPointerDown(s){this.session=new qx(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Xx(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:ib(s),onStart:ib(i),onMove:r,onEnd:(d,u)=>{delete this.session,c&&_t.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=Fr(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 Kc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ob(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Mr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ee.test(t))t=parseFloat(t);else return t;const i=ob(t,s.target.x),r=ob(t,s.target.y);return`${i}% ${r}%`}},B3={correct:(t,{treeScale:s,projectionDelta:i})=>{const r=t,c=$a.parse(t);if(c.length>5)return r;const d=$a.createTransformer(t),u=typeof c[0]!="number"?1:0,p=i.x.scale*s.x,m=i.y.scale*s.y;c[0+u]/=p,c[1+u]/=m;const g=jt(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 z3 extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;dD(U3),d&&(i.group&&i.group.add(d),r&&r.register&&c&&r.register(d),d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,onExitComplete:()=>this.safeToRemove()})),Kc.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:i,visualElement:r,drag:c,isPresent:d}=this.props,u=r.projection;return u&&(u.isPresent=d,c||s.layoutDependency!==i||i===void 0?u.willUpdate():this.safeToRemove(),s.isPresent!==d&&(d?u.promote():u.relegate()||_t.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),km.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:r}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(c),r&&r.deregister&&r.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function Qx(t){const[s,i]=B_(),r=y.useContext(hm);return o.jsx(z3,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(G_),isPresent:s,safeToRemove:i})}const U3={borderRadius:{...Mr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Mr,borderTopRightRadius:Mr,borderBottomLeftRadius:Mr,borderBottomRightRadius:Mr,boxShadow:B3};function $3(t,s,i){const r=dn(t)?t:nl(t);return r.start(Zm("",r,s,i)),r.animation}function P3(t){return t instanceof SVGElement&&t.tagName!=="svg"}const H3=(t,s)=>t.depth-s.depth;class V3{constructor(){this.children=[],this.isDirty=!1}add(s){Mm(this.children,s),this.isDirty=!0}remove(s){Im(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(H3),this.isDirty=!1,this.children.forEach(s)}}function q3(t,s){const i=ws.now(),r=({timestamp:c})=>{const d=c-i;d>=s&&(Ua(r),t(d-s))};return _t.read(r,!0),()=>Ua(r)}const e1=["TopLeft","TopRight","BottomLeft","BottomRight"],G3=e1.length,rb=t=>typeof t=="string"?parseFloat(t):t,lb=t=>typeof t=="number"||Ee.test(t);function F3(t,s,i,r,c,d){c?(t.opacity=jt(0,i.opacity!==void 0?i.opacity:1,Z3(r)),t.opacityExit=jt(s.opacity!==void 0?s.opacity:1,0,K3(r))):d&&(t.opacity=jt(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,r));for(let u=0;u<G3;u++){const p=`border${e1[u]}Radius`;let m=cb(s,p),g=cb(i,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||lb(m)===lb(g)?(t[p]=Math.max(jt(rb(m),rb(g),r),0),(Ts.test(g)||Ts.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||i.rotate)&&(t.rotate=jt(s.rotate||0,i.rotate||0,r))}function cb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const Z3=t1(0,.5,vx),K3=t1(.5,.95,Mn);function t1(t,s,i){return r=>r<t?0:r>s?1:i(Mo(t,s,r))}function db(t,s){t.min=s.min,t.max=s.max}function Kn(t,s){db(t.x,s.x),db(t.y,s.y)}function ub(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function fb(t,s,i,r,c){return t-=s,t=id(t,1/i,r),c!==void 0&&(t=id(t,1/c,r)),t}function Y3(t,s=0,i=1,r=.5,c,d=t,u=t){if(Ts.test(s)&&(s=parseFloat(s),s=jt(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=jt(d.min,d.max,r);t===d&&(p-=s),t.min=fb(t.min,s,i,p,c),t.max=fb(t.max,s,i,p,c)}function pb(t,s,[i,r,c],d,u){Y3(t,s[i],s[r],s[c],s.scale,d,u)}const J3=["x","scaleX","originX"],W3=["y","scaleY","originY"];function mb(t,s,i,r){pb(t.x,s,J3,i?i.x:void 0,r?r.x:void 0),pb(t.y,s,W3,i?i.y:void 0,r?r.y:void 0)}function hb(t){return t.translate===0&&t.scale===1}function n1(t){return hb(t.x)&&hb(t.y)}function gb(t,s){return t.min===s.min&&t.max===s.max}function X3(t,s){return gb(t.x,s.x)&&gb(t.y,s.y)}function vb(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function s1(t,s){return vb(t.x,s.x)&&vb(t.y,s.y)}function yb(t){return On(t.x)/On(t.y)}function bb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class Q3{constructor(){this.members=[]}add(s){Mm(this.members,s),s.scheduleRender()}remove(s){if(Im(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(s){const i=this.members.findIndex(c=>s===c);if(i===0)return!1;let r;for(let c=i;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){r=d;break}}return r?(this.promote(r),!0):!1}promote(s,i){const r=this.lead;if(s!==r&&(this.prevLead=r,this.lead=s,s.show(),r)){r.instance&&r.scheduleRender(),s.scheduleRender(),s.resumeFrom=r,i&&(s.resumeFrom.preserveOpacity=!0),r.snapshot&&(s.snapshot=r.snapshot,s.snapshot.latestValues=r.animationValues||r.latestValues),s.root&&s.root.isUpdating&&(s.isLayoutDirty=!0);const{crossfade:c}=s.options;c===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(s=>{const{options:i,resumingFrom:r}=s;i.onExitComplete&&i.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(s=>{s.instance&&s.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function eM(t,s,i){let r="";const c=t.x.translate/s.x,d=t.y.translate/s.y,u=(i==null?void 0:i.z)||0;if((c||d||u)&&(r=`translate3d(${c}px, ${d}px, ${u}px) `),(s.x!==1||s.y!==1)&&(r+=`scale(${1/s.x}, ${1/s.y}) `),i){const{transformPerspective:g,rotate:v,rotateX:b,rotateY:_,skewX:S,skewY:k}=i;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),b&&(r+=`rotateX(${b}deg) `),_&&(r+=`rotateY(${_}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 bi={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Pr=typeof window<"u"&&window.MotionDebug!==void 0,fp=["","X","Y","Z"],tM={visibility:"hidden"},_b=1e3;let nM=0;function pp(t,s,i,r){const{latestValues:c}=s;c[t]&&(i[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function a1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const i=rx(s);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",_t,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&a1(r)}function i1({attachResizeListener:t,defaultParent:s,measureScroll:i,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=nM++,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,Pr&&(bi.totalNodes=bi.resolvedTargetDeltas=bi.recalculatedProjection=0),this.nodes.forEach(iM),this.nodes.forEach(dM),this.nodes.forEach(uM),this.nodes.forEach(oM),Pr&&window.MotionDebug.record(bi)},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 V3)}addEventListener(u,p){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Om),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=P3(u),this.instance=u;const{layoutId:m,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(g||m)&&(this.isLayoutDirty=!0),t){let b;const _=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=q3(_,250),Kc.hasAnimatedSinceResize&&(Kc.hasAnimatedSinceResize=!1,this.nodes.forEach(kb))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&v&&(m||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:_,hasRelativeTargetChanged:S,layout:k})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||v.getDefaultTransition()||gM,{onLayoutAnimationStart:N,onLayoutAnimationComplete:T}=v.getProps(),C=!this.targetLayout||!s1(this.targetLayout,k)||S,D=!_&&S;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||D||_&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,D);const L={...Rm(w,"layout"),onPlay:N,onComplete:T};(v.shouldReduceMotion||this.options.layoutRoot)&&(L.delay=0,L.type=!1),this.startAnimation(L)}else _||kb(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,Ua(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(fM),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&&a1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const b=this.path[v];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}const{layoutId:p,layout:m}=this.options;if(p===void 0&&!m)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(xb);return}this.isUpdating||this.nodes.forEach(lM),this.isUpdating=!1,this.nodes.forEach(cM),this.nodes.forEach(sM),this.nodes.forEach(aM),this.clearAllSnapshots();const p=ws.now();rn.delta=ta(0,1e3/60,p-rn.timestamp),rn.timestamp=p,rn.isProcessing=!0,ap.update.process(rn),ap.preRender.process(rn),ap.render.process(rn),rn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,km.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(rM),this.sharedNodes.forEach(pM)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,_t.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){_t.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=Lt(),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:i(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&&!n1(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(p||yi(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)),vM(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return Lt();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(yM))){const{scroll:v}=this.root;v&&(jo(m.x,v.offset.x),jo(m.y,v.offset.y))}return m}removeElementScroll(u){var p;const m=Lt();if(Kn(m,u),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return m;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:b,options:_}=v;v!==this.root&&b&&_.layoutScroll&&(b.wasRoot&&Kn(m,u),jo(m.x,b.offset.x),jo(m.y,b.offset.y))}return m}applyTransform(u,p=!1){const m=Lt();Kn(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&&No(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),yi(v.latestValues)&&No(m,v.latestValues)}return yi(this.latestValues)&&No(m,this.latestValues),m}removeTransform(u){const p=Lt();Kn(p,u);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!yi(g.latestValues))continue;Zp(g.latestValues)&&g.updateSnapshot();const v=Lt(),b=g.measurePageBox();Kn(v,b),mb(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return yi(this.latestValues)&&mb(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!==rn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var p;const m=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=m.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=m.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=m.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==m;if(!(u||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:_}=this.options;if(!(!this.layout||!(b||_))){if(this.resolvedRelativeTargetAt=rn.timestamp,!this.targetDelta&&!this.relativeTarget){const S=this.getClosestProjectingParent();S&&S.layout&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Lt(),this.relativeTargetOrigin=Lt(),Kr(this.relativeTargetOrigin,this.layout.layoutBox,S.layout.layoutBox),Kn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Lt(),this.targetWithTransforms=Lt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),x3(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Kn(this.target,this.layout.layoutBox),Jx(this.target,this.targetDelta)):Kn(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=Lt(),this.relativeTargetOrigin=Lt(),Kr(this.relativeTargetOrigin,this.target,S.target),Kn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Pr&&bi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Zp(this.parent.latestValues)||Yx(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===rn.timestamp&&(g=!1),g)return;const{layout:v,layoutId:b}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(v||b))return;Kn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,S=this.treeScale.y;A3(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=Lt());const{target:k}=p;if(!k){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ub(this.prevProjectionDelta.x,this.projectionDelta.x),ub(this.prevProjectionDelta.y,this.projectionDelta.y)),Zr(this.projectionDelta,this.layoutCorrected,k,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==S||!bb(this.projectionDelta.x,this.prevProjectionDelta.x)||!bb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",k)),Pr&&bi.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=wo(),this.projectionDelta=wo(),this.projectionDeltaWithTransform=wo()}setAnimationOrigin(u,p=!1){const m=this.snapshot,g=m?m.latestValues:{},v={...this.latestValues},b=wo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const _=Lt(),S=m?m.source:void 0,k=this.layout?this.layout.source:void 0,w=S!==k,N=this.getStack(),T=!N||N.members.length<=1,C=!!(w&&!T&&this.options.crossfade===!0&&!this.path.some(hM));this.animationProgress=0;let D;this.mixTargetDelta=L=>{const E=L/1e3;Sb(b.x,u.x,E),Sb(b.y,u.y,E),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Kr(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mM(this.relativeTarget,this.relativeTargetOrigin,_,E),D&&X3(this.relativeTarget,D)&&(this.isProjectionDirty=!1),D||(D=Lt()),Kn(D,this.relativeTarget)),w&&(this.animationValues=v,F3(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&&(Ua(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=_t.update(()=>{Kc.hasAnimatedSinceResize=!0,this.currentAnimation=$3(0,_b,{...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(_b),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&&o1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||Lt();const b=On(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+b;const _=On(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+_}Kn(p,m),No(p,v),Zr(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new Q3),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&&pp("z",u,g,this.animationValues);for(let v=0;v<fp.length;v++)pp(`rotate${fp[v]}`,u,g,this.animationValues),pp(`skew${fp[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=Fc(u==null?void 0:u.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const b=this.getLead();if(!this.projectionDelta||!this.layout||!b.target){const w={};return this.options.layoutId&&(w.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,w.pointerEvents=Fc(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!yi(this.latestValues)&&(w.transform=v?v({},""):"none",this.hasProjected=!1),w}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=eM(this.projectionDeltaWithTransform,this.treeScale,_),v&&(g.transform=v(_,g.transform));const{x:S,y:k}=this.projectionDelta;g.transformOrigin=`${S.origin*100}% ${k.origin*100}% 0`,b.animationValues?g.opacity=b===this?(m=(p=_.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&m!==void 0?m:1:this.preserveOpacity?this.latestValues.opacity:_.opacityExit:g.opacity=b===this?_.opacity!==void 0?_.opacity:"":_.opacityExit!==void 0?_.opacityExit:0;for(const w in ed){if(_[w]===void 0)continue;const{correct:N,applyTo:T}=ed[w],C=g.transform==="none"?_[w]:N(_[w],b);if(T){const D=T.length;for(let L=0;L<D;L++)g[T[L]]=C}else g[w]=C}return this.options.layoutId&&(g.pointerEvents=b===this?Fc(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(xb),this.root.sharedNodes.clear()}}}function sM(t){t.updateLayout()}function aM(t){var s;const i=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&i&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:c}=t.layout,{animationType:d}=t.options,u=i.source!==t.layout.source;d==="size"?Wn(b=>{const _=u?i.measuredBox[b]:i.layoutBox[b],S=On(_);_.min=r[b].min,_.max=_.min+S}):o1(d,i.layoutBox,r)&&Wn(b=>{const _=u?i.measuredBox[b]:i.layoutBox[b],S=On(r[b]);_.max=_.min+S,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+S)});const p=wo();Zr(p,r,i.layoutBox);const m=wo();u?Zr(m,t.applyTransform(c,!0),i.measuredBox):Zr(m,r,i.layoutBox);const g=!n1(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:S}=b;if(_&&S){const k=Lt();Kr(k,i.layoutBox,_.layoutBox);const w=Lt();Kr(w,r,S.layoutBox),s1(k,w)||(v=!0),b.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=k,t.relativeParent=b)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:i,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 iM(t){Pr&&bi.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 oM(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function rM(t){t.clearSnapshot()}function xb(t){t.clearMeasurements()}function lM(t){t.isLayoutDirty=!1}function cM(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function kb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function dM(t){t.resolveTargetDelta()}function uM(t){t.calcProjection()}function fM(t){t.resetSkewAndRotation()}function pM(t){t.removeLeadSnapshot()}function Sb(t,s,i){t.translate=jt(s.translate,0,i),t.scale=jt(s.scale,1,i),t.origin=s.origin,t.originPoint=s.originPoint}function Tb(t,s,i,r){t.min=jt(s.min,i.min,r),t.max=jt(s.max,i.max,r)}function mM(t,s,i,r){Tb(t.x,s.x,i.x,r),Tb(t.y,s.y,i.y,r)}function hM(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const gM={duration:.45,ease:[.4,0,.1,1]},wb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),jb=wb("applewebkit/")&&!wb("chrome/")?Math.round:Mn;function Nb(t){t.min=jb(t.min),t.max=jb(t.max)}function vM(t){Nb(t.x),Nb(t.y)}function o1(t,s,i){return t==="position"||t==="preserve-aspect"&&!_3(yb(s),yb(i),.2)}function yM(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const bM=i1({attachResizeListener:(t,s)=>al(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),mp={current:void 0},r1=i1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!mp.current){const t=new bM({});t.mount(window),t.setOptions({layoutScroll:!0}),mp.current=t}return mp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),_M={pan:{Feature:L3},drag:{Feature:O3,ProjectionNode:r1,MeasureLayout:Qx}};function xM(t,s,i){var r;if(t instanceof Element)return[t];if(typeof t=="string"){let c=document;const d=(r=void 0)!==null&&r!==void 0?r:c.querySelectorAll(t);return d?Array.from(d):[]}return Array.from(t)}function l1(t,s){const i=xM(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[i,c,()=>r.abort()]}function Cb(t){return s=>{s.pointerType==="touch"||Vx()||t(s)}}function kM(t,s,i={}){const[r,c,d]=l1(t,i),u=Cb(p=>{const{target:m}=p,g=s(p);if(typeof g!="function"||!m)return;const v=Cb(b=>{g(b),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function Eb(t,s,i){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",i==="Start");const c="onHover"+i,d=r[c];d&&_t.postRender(()=>d(s,pl(s)))}class SM extends Va{mount(){const{current:s}=this.node;s&&(this.unmount=kM(s,i=>(Eb(this.node,i,"Start"),r=>Eb(this.node,r,"End"))))}unmount(){}}class TM extends Va{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=fl(al(this.node.current,"focus",()=>this.onFocus()),al(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const c1=(t,s)=>s?t===s?!0:c1(t,s.parentElement):!1,wM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function jM(t){return wM.has(t.tagName)||t.tabIndex!==-1}const Hr=new WeakSet;function Ab(t){return s=>{s.key==="Enter"&&t(s)}}function hp(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const NM=(t,s)=>{const i=t.currentTarget;if(!i)return;const r=Ab(()=>{if(Hr.has(i))return;hp(i,"down");const c=Ab(()=>{hp(i,"up")}),d=()=>hp(i,"cancel");i.addEventListener("keyup",c,s),i.addEventListener("blur",d,s)});i.addEventListener("keydown",r,s),i.addEventListener("blur",()=>i.removeEventListener("keydown",r),s)};function Db(t){return Km(t)&&!Vx()}function CM(t,s,i={}){const[r,c,d]=l1(t,i),u=p=>{const m=p.currentTarget;if(!Db(p)||Hr.has(m))return;Hr.add(m);const g=s(p),v=(S,k)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!Db(S)||!Hr.has(m))&&(Hr.delete(m),typeof g=="function"&&g(S,{success:k}))},b=S=>{v(S,i.useGlobalTarget||c1(m,S.target))},_=S=>{v(S,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return r.forEach(p=>{!jM(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(i.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>NM(g,c),c)}),d}function Rb(t,s,i){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",i==="Start");const c="onTap"+(i==="End"?"":i),d=r[c];d&&_t.postRender(()=>d(s,pl(s)))}class EM extends Va{mount(){const{current:s}=this.node;s&&(this.unmount=CM(s,i=>(Rb(this.node,i,"Start"),(r,{success:c})=>Rb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Yp=new WeakMap,gp=new WeakMap,AM=t=>{const s=Yp.get(t.target);s&&s(t)},DM=t=>{t.forEach(AM)};function RM({root:t,...s}){const i=t||document;gp.has(i)||gp.set(i,{});const r=gp.get(i),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(DM,{root:t,...s})),r[c]}function MM(t,s,i){const r=RM(s);return Yp.set(t,i),r.observe(t),()=>{Yp.delete(t),r.unobserve(t)}}const IM={some:0,all:1};class OM extends Va{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:i,margin:r,amount:c="some",once:d}=s,u={root:i?i.current:void 0,rootMargin:r,threshold:typeof c=="number"?c:IM[c]},p=m=>{const{isIntersecting:g}=m;if(this.isInView===g||(this.isInView=g,d&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:b}=this.node.getProps(),_=g?v:b;_&&_(m)};return MM(this.node.current,u,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:i}=this.node;["amount","margin","root"].some(LM(s,i))&&this.startObserver()}unmount(){}}function LM({viewport:t={}},{viewport:s={}}={}){return i=>t[i]!==s[i]}const BM={inView:{Feature:OM},tap:{Feature:EM},focus:{Feature:TM},hover:{Feature:SM}},zM={layout:{ProjectionNode:r1,MeasureLayout:Qx}},od={current:null},Ym={current:!1};function d1(){if(Ym.current=!0,!!ym)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>od.current=t.matches;t.addListener(s),s()}else od.current=!1}const UM=[...Dx,cn,$a],$M=t=>UM.find(Ax(t)),Mb=new WeakMap;function PM(t,s,i){for(const r in s){const c=s[r],d=i[r];if(dn(c))t.addValue(r,c);else if(dn(d))t.addValue(r,nl(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,nl(u!==void 0?u:c,{owner:t}))}}for(const r in i)s[r]===void 0&&t.removeValue(r);return s}const Ib=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class HM{scrapeMotionValuesFromProps(s,i,r){return{}}constructor({parent:s,props:i,presenceContext:r,reducedMotionConfig:c,blockInitialAnimation:d,visualState:u},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=qm,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=ws.now();this.renderScheduledAt<S&&(this.renderScheduledAt=S,_t.render(this.render,!1,!0))};const{latestValues:m,renderState:g,onUpdate:v}=u;this.onUpdate=v,this.latestValues=m,this.baseTarget={...m},this.initialValues=i.initial?{...m}:{},this.renderState=g,this.parent=s,this.props=i,this.presenceContext=r,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=Sd(i),this.isVariantNode=V_(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,..._}=this.scrapeMotionValuesFromProps(i,{},this);for(const S in _){const k=_[S];m[S]!==void 0&&dn(k)&&k.set(m[S],!1)}}mount(s){this.current=s,Mb.set(s,this),this.projection&&!this.projection.instance&&this.projection.mount(s),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,r)=>this.bindToMotionValue(r,i)),Ym.current||d1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:od.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Mb.delete(this.current),this.projection&&this.projection.unmount(),Ua(this.notifyUpdate),Ua(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const i=this.features[s];i&&(i.unmount(),i.isMounted=!1)}this.current=null}bindToMotionValue(s,i){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const r=Ei.has(s),c=i.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&_t.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),d=i.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,s,i)),this.valueSubscriptions.set(s,()=>{c(),d(),u&&u(),i.owner&&i.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in Ro){const i=Ro[s];if(!i)continue;const{isEnabled:r,Feature:c}=i;if(!this.features[s]&&c&&r(this.props)&&(this.features[s]=new c(this)),this.features[s]){const d=this.features[s];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Lt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,i){this.latestValues[s]=i}update(s,i){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let r=0;r<Ib.length;r++){const c=Ib[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=PM(this,this.scrapeMotionValuesFromProps(s,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(s){return this.props.variants?this.props.variants[s]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(s){const i=this.getClosestVariantNode();if(i)return i.variantChildren&&i.variantChildren.add(s),()=>i.variantChildren.delete(s)}addValue(s,i){const r=this.values.get(s);i!==r&&(r&&this.removeValue(s),this.bindToMotionValue(s,i),this.values.set(s,i),this.latestValues[s]=i.get())}removeValue(s){this.values.delete(s);const i=this.valueSubscriptions.get(s);i&&(i(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,i){if(this.props.values&&this.props.values[s])return this.props.values[s];let r=this.values.get(s);return r===void 0&&i!==void 0&&(r=nl(i===null?void 0:i,{owner:this}),this.addValue(s,r)),r}readValue(s,i){var r;let c=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:(r=this.getBaseTargetFromProps(this.props,s))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,s,this.options);return c!=null&&(typeof c=="string"&&(Cx(c)||bx(c))?c=parseFloat(c):!$M(c)&&$a.test(i)&&(c=wx(s,i)),this.setBaseTarget(s,dn(c)?c.get():c)),dn(c)?c.get():c}setBaseTarget(s,i){this.baseTarget[s]=i}getBaseTarget(s){var i;const{initial:r}=this.props;let c;if(typeof r=="string"||typeof r=="object"){const u=Tm(this.props,r,(i=this.presenceContext)===null||i===void 0?void 0:i.custom);u&&(c=u[s])}if(r&&c!==void 0)return c;const d=this.getBaseTargetFromProps(this.props,s);return d!==void 0&&!dn(d)?d:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,i){return this.events[s]||(this.events[s]=new Om),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class u1 extends HM{constructor(){super(...arguments),this.KeyframeResolver=Rx}sortInstanceNodePosition(s,i){return s.compareDocumentPosition(i)&2?1:-1}getBaseTargetFromProps(s,i){return s.style?s.style[i]:void 0}removeValueFromRenderState(s,{vars:i,style:r}){delete i[s],delete r[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;dn(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function VM(t){return window.getComputedStyle(t)}class qM extends u1{constructor(){super(...arguments),this.type="html",this.renderInstance=X_}readValueFromInstance(s,i){if(Ei.has(i)){const r=Vm(i);return r&&r.default||0}else{const r=VM(s),c=(Y_(i)?r.getPropertyValue(i):r[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return Wx(s,i)}build(s,i,r){Nm(s,i,r.transformTemplate)}scrapeMotionValuesFromProps(s,i,r){return Dm(s,i,r)}}class GM extends u1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Lt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(Ei.has(i)){const r=Vm(i);return r&&r.default||0}return i=Q_.has(i)?i:xm(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,r){return nx(s,i,r)}build(s,i,r){Cm(s,i,this.isSVGTag,r.transformTemplate)}renderInstance(s,i,r,c){ex(s,i,r,c)}mount(s){this.isSVGTag=Am(s.tagName),super.mount(s)}}const FM=(t,s)=>Sm(t)?new GM(s):new qM(s,{allowProjection:t!==y.Fragment}),ZM=bD({...d3,...BM,..._M,...zM},FM),Rt=IA(ZM);function KM(){!Ym.current&&d1();const[t]=y.useState(od.current);return t}const YM="_overlay_cmicx_1",JM="_dialog_cmicx_11",WM="_title_cmicx_30",XM="_description_cmicx_38",QM="_actions_cmicx_45",e4="_cancelButton_cmicx_52",t4="_confirmButton_cmicx_79",mi={overlay:YM,dialog:JM,title:WM,description:XM,actions:QM,cancelButton:e4,confirmButton:t4};function wi({isOpen:t,title:s,description:i,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),p=y.useId();return o.jsx(ps,{children:t&&o.jsx(Rt.div,{className:mi.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":i?p:void 0,children:o.jsxs(Rt.div,{className:mi.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:[o.jsx("h3",{id:u,className:mi.title,children:s}),i&&o.jsx("p",{id:p,className:mi.description,children:i}),o.jsxs("div",{className:mi.actions,children:[o.jsx("button",{type:"button",className:mi.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),o.jsx("button",{type:"button",className:mi.confirmButton,onClick:c,children:r})]})]})})})}const n4="_skeleton_1gqp4_9",s4="_circular_1gqp4_17",a4="_textContainer_1gqp4_26",i4="_card_1gqp4_31",rd={skeleton:n4,circular:s4,textContainer:a4,card:i4};function xe({width:t="100%",height:s="1rem",borderRadius:i,variant:r="rectangular",className:c}){const d=[rd.skeleton,r==="circular"?rd.circular:"",c??""].filter(Boolean).join(" ");return o.jsx("div",{className:d,style:{width:t,height:s,...i&&r!=="circular"?{borderRadius:i}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function Jp({lines:t=3,lastLineWidth:s="60%",lineHeight:i="0.75rem",gap:r="var(--space-sm)",className:c}){return o.jsx("div",{className:`${rd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>o.jsx(xe,{width:u===t-1&&t>1?s:"100%",height:i},u))})}function ld({lines:t=2,className:s}){return o.jsxs("div",{className:`${rd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[o.jsx(xe,{width:"40%",height:"1.25rem"}),o.jsx(Jp,{lines:t})]})}const o4="_spinner_1uyt1_1",r4="_spin_1uyt1_1",l4="_sm_1uyt1_14",c4="_md_1uyt1_20",d4="_lg_1uyt1_26",u4="_xl_1uyt1_32",Ob={spinner:o4,spin:r4,sm:l4,md:c4,lg:d4,xl:u4};function f1({size:t="md",className:s,label:i="Loading",liveRegion:r=!1}){return o.jsx("span",{className:`${Ob.spinner} ${Ob[t]} ${s??""}`,role:r?"status":void 0,"aria-label":i,"aria-hidden":r?void 0:!0})}const f4="_splash_1bn1g_1",p4="_logo_1bn1g_11",Lb={splash:f4,logo:p4};function p1(){return o.jsxs("div",{className:Lb.splash,"data-testid":"splash-screen",children:[o.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Lb.logo}),o.jsx(f1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const m4="_wrapper_4e5yt_1",h4="_wrapperBlock_4e5yt_6",g4="_tooltip_4e5yt_11",v4="_visible_4e5yt_31",y4="_top_4e5yt_41",b4="_bottom_4e5yt_48",_4="_left_4e5yt_55",x4="_right_4e5yt_62",Ir={wrapper:m4,wrapperBlock:h4,tooltip:g4,visible:v4,top:y4,bottom:b4,left:_4,right:x4},k4=300,Oc=6;function Oo({text:t,placement:s="top",delayMs:i=k4,inline:r=!0,children:c,className:d,"data-testid":u}){const[p,m]=y.useState(!1),[g,v]=y.useState({top:0,left:0}),b=y.useRef(null),_=y.useRef(null),S=y.useRef(void 0),k=y.useId(),w=typeof document<"u",N=y.useCallback(()=>{if(!b.current||!_.current)return;const $=b.current.getBoundingClientRect(),X=_.current.getBoundingClientRect();let te=0,P=0;switch(s){case"top":te=$.top-X.height-Oc,P=$.left+$.width/2-X.width/2;break;case"bottom":te=$.bottom+Oc,P=$.left+$.width/2-X.width/2;break;case"left":te=$.top+$.height/2-X.height/2,P=$.left-X.width-Oc;break;case"right":te=$.top+$.height/2-X.height/2,P=$.right+Oc;break}v({top:te,left:P})},[s]),T=y.useCallback($=>{S.current!==void 0&&clearTimeout(S.current),S.current=setTimeout(()=>{N(),m(!0),S.current=void 0},$)},[N]),C=y.useCallback(()=>{T(i)},[i,T]),D=y.useCallback(()=>{T(0)},[T]),L=y.useCallback(()=>{S.current!==void 0&&(clearTimeout(S.current),S.current=void 0),m(!1)},[]);y.useEffect(()=>{if(!p)return;const $=X=>{X.key==="Escape"&&L()};return document.addEventListener("keydown",$),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{document.removeEventListener("keydown",$),window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[p,L,N]),y.useEffect(()=>()=>{S.current!==void 0&&clearTimeout(S.current)},[]);const E=r?"span":"div",I=[r?Ir.wrapper:Ir.wrapperBlock,d].filter(Boolean).join(" ");let O=c;if(y.isValidElement(c)){const $=c,X=$.props["aria-describedby"],te=p?X?`${X} ${k}`:k:X;O=y.cloneElement($,{"aria-describedby":te})}const z=o.jsx("div",{ref:_,id:k,role:"tooltip",className:`${Ir.tooltip} ${Ir[s]} ${p?Ir.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return o.jsxs(E,{ref:b,className:I,onMouseEnter:C,onMouseLeave:L,onFocus:D,onBlur:L,children:[O,w?oT.createPortal(z,document.body):null]})}const S4="_attemptSelector_ggigl_1",T4="_attemptLabel_ggigl_17",w4="_attemptButton_ggigl_21",j4="_attemptActive_ggigl_38",N4="_attemptStatus_ggigl_44",Or={attemptSelector:S4,attemptLabel:T4,attemptButton:w4,attemptActive:j4,attemptStatus:N4};function C4({taskSessions:t,selectedSessionId:s,onSelect:i}){if(!(t.length<2))return o.jsxs("div",{className:Or.attemptSelector,"data-testid":"attempt-selector",children:[o.jsx("span",{className:Or.attemptLabel,children:"Attempts:"}),t.map((r,c)=>{const d=r.id===s,u=r.status==="stopped"&&r.endReason==="completed"?"✓":r.status==="stopped"?"✗":r.status==="running"||r.status==="idle"?"●":"";return o.jsxs("button",{className:`${Or.attemptButton} ${d?Or.attemptActive:""}`,onClick:()=>i(r.id),title:`Attempt #${c+1} — ${r.status}`,"aria-label":`Attempt #${c+1}, ${r.status}`,"aria-pressed":d,"data-testid":`attempt-${c+1}`,children:["#",c+1,u&&o.jsx("span",{className:Or.attemptStatus,children:u})]},r.id)})]})}const E4="_row_ldkru_1",A4="_hoverActions_ldkru_5",D4="_hoverButton_ldkru_31",R4="_selectingRow_ldkru_72",M4="_selected_ldkru_83",I4="_checkboxArea_ldkru_90",O4="_checkbox_ldkru_90",L4="_contentArea_ldkru_106",ls={row:E4,hoverActions:A4,hoverButton:D4,selectingRow:R4,selected:M4,checkboxArea:I4,checkbox:O4,contentArea:L4};function B4({copyText:t,isContentBearing:s,isSelecting:i,isSelected:r,checkboxLabel:c,onSelect:d,onToggle:u,onCopied:p,children:m}){const[g,v]=y.useState(!1),b=y.useRef(void 0);y.useEffect(()=>()=>{b.current!==void 0&&clearTimeout(b.current)},[]);const _=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),v(!0),p==null||p(),b.current!==void 0&&clearTimeout(b.current),b.current=setTimeout(()=>{v(!1)},2e3)}catch{}},[t,p]),S=y.useCallback(k=>{!i||k.target.closest("a, button, input, textarea, select, [role=button]")||(k.preventDefault(),u(k.shiftKey))},[i,u]);return s?i?o.jsxs("div",{className:`${ls.row} ${ls.selectingRow} ${r?ls.selected:""}`,onClick:S,"data-testid":"event-selectable-row",children:[o.jsx("div",{className:ls.checkboxArea,children:o.jsx("input",{type:"checkbox",checked:r,onChange:k=>{u(k.nativeEvent.shiftKey)},onClick:k=>{k.stopPropagation()},className:ls.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),o.jsx("div",{className:ls.contentArea,children:m})]}):o.jsxs("div",{className:ls.row,"data-testid":"event-hover-row",children:[o.jsxs("div",{className:ls.hoverActions,"data-testid":"event-hover-actions",children:[o.jsx("button",{type:"button",className:ls.hoverButton,onClick:()=>{_().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?o.jsx(ji,{size:it,"aria-hidden":"true"}):o.jsx(u_,{size:it,"aria-hidden":"true"})}),o.jsx("button",{type:"button",className:ls.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:o.jsx(K2,{size:it,"aria-hidden":"true"})})]}),m]}):o.jsx("div",{className:ls.row,children:m})}const z4="_bar_1vah7_1",U4="_left_1vah7_21",$4="_right_1vah7_27",P4="_count_1vah7_33",H4="_toggleButton_1vah7_40",V4="_copyButton_1vah7_68",q4="_cancelButton_1vah7_108",hi={bar:z4,left:U4,right:$4,count:P4,toggleButton:H4,copyButton:V4,cancelButton:q4};function G4({selectedCount:t,totalSelectable:s,onSelectAll:i,onDeselectAll:r,onCopy:c,onCancel:d}){const u=t>0&&t>=s;return o.jsxs(Rt.div,{className:hi.bar,initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.15},"data-testid":"floating-action-bar",children:[o.jsxs("div",{className:hi.left,children:[o.jsxs("span",{className:hi.count,"data-testid":"floating-bar-count",children:[t," selected"]}),o.jsx("button",{type:"button",className:hi.toggleButton,onClick:u?r:i,"data-testid":"floating-bar-select-all",children:u?"Deselect all":"Select all"})]}),o.jsxs("div",{className:hi.right,children:[o.jsxs("button",{type:"button",className:hi.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[o.jsx(f2,{size:it,"aria-hidden":"true"}),"Copy"]}),o.jsx("button",{type:"button",className:hi.cancelButton,onClick:d,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:o.jsx(Pa,{size:it,"aria-hidden":"true"})})]})]})}const m1=50;function F4(t,s,i,r,c=m1){return r?t<c:s-t-i<c}function Z4(t,s){const i=s-t;return i>0?i:0}function K4({scrollRef:t,contentLength:s,isReversed:i,paused:r}){const[c,d]=y.useState(!0),u=y.useRef(0),p=y.useRef(!1),m=y.useRef(0);y.useEffect(()=>{const v=t.current;if(!v)return;let b=!0;const _=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const S=F4(v.scrollTop,v.scrollHeight,v.clientHeight,i,m1);S!==b&&(b=S,d(S))}))};return v.addEventListener("scroll",_,{passive:!0}),()=>{v.removeEventListener("scroll",_),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[t,i]),y.useLayoutEffect(()=>{const v=t.current;!v||p.current||(p.current=!0,i?v.scrollTop=0:v.scrollTop=v.scrollHeight,d(!0))},[t,i]),y.useLayoutEffect(()=>{const v=t.current;if(v){if(r){u.current=v.scrollHeight;return}if(i&&!c){const b=Z4(u.current,v.scrollHeight);b>0&&(v.scrollTop+=b)}c&&(i?v.scrollTo({top:0,behavior:"smooth"}):v.scrollTo({top:v.scrollHeight,behavior:"smooth"})),u.current=v.scrollHeight}},[s,c,i,r,t]);const g=y.useCallback(()=>{const v=t.current;if(!v)return;const b=i?0:v.scrollHeight;v.scrollTo({top:b,behavior:"smooth"}),d(!0)},[t,i]);return{isAtAnchor:c,scrollToAnchor:g}}const Y4=new Set(["text","output","user_input","tool_use","tool_result","error"]);function il(t){return Y4.has(t.eventType)}function J4(t){var s;switch(t.eventType){case"tool_result":{if((s=t.toolUseCtx)!=null&&s.detailedResult)return t.toolUseCtx.detailedResult;let i=t.content;if(t.content.trimStart().startsWith("{"))try{const r=JSON.parse(t.content);typeof r.content=="string"&&(i=r.content)}catch{}return i}case"tool_use":try{const i=JSON.parse(t.content),r=i.tool??"tool",c=i.args!==void 0?JSON.stringify(i.args,void 0,2):"";return`${r}
264
+ ${c}`}catch{return t.content}default:return t.content}}function Bb(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 W4(t){var i;const s=[];for(const r of t){if(!il(r))continue;const c=new Date(r.timestamp).toLocaleTimeString();switch(r.eventType){case"text":case"output":{s.push(`**Assistant** (${c}):
265
+ ${r.content}`);break}case"user_input":{s.push(`**User** (${c}):
266
+ ${r.content}`);break}case"tool_result":{let d=((i=r.toolUseCtx)==null?void 0:i.detailedResult)??void 0;if(!d&&(d=r.content,r.content.trimStart().startsWith("{")))try{const u=JSON.parse(r.content);typeof u.content=="string"&&(d=u.content)}catch{}if(r.toolUseCtx){const u=Bb(r.toolUseCtx.args),p=u?`**Tool: ${r.toolUseCtx.tool}** ${u}`:`**Tool: ${r.toolUseCtx.tool}**`;s.push(`${p} (${c}):
267
+ ${d}`)}else s.push(`**Tool output** (${c}):
268
+ ${d}`);break}case"tool_use":{let d="tool",u;try{const g=JSON.parse(r.content);d=g.tool??"tool",u=g.args}catch{}const p=Bb(u),m=p?`**Tool: ${d}** ${p}`:`**Tool: ${d}**`;u!==void 0?s.push(`${m} (${c}):
269
+ \`\`\`json
270
+ ${JSON.stringify(u,void 0,2)}
271
+ \`\`\``):s.push(`${m} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
272
+ ${r.content}`);break}}}return s.join(`
273
+
274
+ `)}function X4({events:t,formatForClipboard:s}){const[i,r]=y.useState(!1),[c,d]=y.useState(new Set),u=y.useRef(void 0),p=y.useMemo(()=>c.size,[c]),m=y.useCallback(k=>{r(!0),k!==void 0?(d(new Set([k])),u.current=k):(d(new Set),u.current=void 0)},[]),g=y.useCallback(()=>{r(!1),d(new Set),u.current=void 0},[]),v=y.useCallback((k,w)=>{if(w&&u.current!==void 0){const N=Math.min(u.current,k),T=Math.max(u.current,k);d(C=>{const D=new Set(C);for(let L=N;L<=T;L++)L<t.length&&il(t[L])&&D.add(L);return D})}else d(N=>{const T=new Set(N);return T.has(k)?T.delete(k):T.add(k),T.size===0?(r(!1),u.current=void 0):u.current=k,T})},[t]),b=y.useCallback(()=>{const k=new Set;for(let w=0;w<t.length;w++)il(t[w])&&k.add(w);d(k)},[t]),_=y.useCallback(()=>{d(new Set)},[]),S=y.useCallback(async()=>{const w=[...c].sort((T,C)=>T-C).filter(T=>T<t.length).map(T=>t[T]);if(w.length===0)return!1;const N=s(w);try{return await navigator.clipboard.writeText(N),!0}catch{return!1}},[c,t,s]);return{isSelecting:i,selectedIndices:c,selectedCount:p,enterSelectionMode:m,cancelSelection:g,toggleEvent:v,selectAll:b,deselectAll:_,copySelected:S}}const Q4="_wrapper_1cdza_1",e6="_scrollContainer_1cdza_9",t6="_selectingPadding_1cdza_16",n6="_toolbar_1cdza_20",s6="_directionToggle_1cdza_27",a6="_scrollToAnchor_1cdza_65",i6="_scrollToAnchorBottom_1cdza_89",o6="_scrollToAnchorTop_1cdza_93",r6="_eventOverflowWarning_1cdza_97",Ys={wrapper:Q4,scrollContainer:e6,selectingPadding:t6,toolbar:n6,directionToggle:s6,scrollToAnchor:a6,scrollToAnchorBottom:i6,scrollToAnchorTop:o6,eventOverflowWarning:r6};function l6(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 h1="grackle-stream-direction";function c6(){try{return localStorage.getItem(h1)==="reversed"}catch{return!1}}function d6({eventsDropped:t}){return t<=0?o.jsx(o.Fragment,{}):o.jsxs("div",{className:Ys.eventOverflowWarning,role:"alert",children:[o.jsx(am,{size:en,"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 Jm({events:t,eventsDropped:s,emptyState:i,onShowToast:r}){const c=y.useRef(null),[d,u]=y.useState(c6),p=KM(),m=X4({events:t,formatForClipboard:W4}),g=y.useMemo(()=>t.filter(il).length,[t]),v=y.useMemo(()=>d?[...t].reverse():t,[t,d]),{isAtAnchor:b,scrollToAnchor:_}=K4({scrollRef:c,contentLength:t.length,isReversed:d,paused:m.isSelecting}),S=()=>{const T=!d;u(T);try{localStorage.setItem(h1,T?"reversed":"default")}catch{}};y.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=y.useCallback(async()=>{await m.copySelected()&&(r==null||r(`Copied ${m.selectedCount} message${m.selectedCount===1?"":"s"} to clipboard`,"success"))},[m,r]),w=p?0:.2,N=d?-8:8;return o.jsxs("div",{className:Ys.wrapper,children:[o.jsx("div",{className:Ys.toolbar,children:o.jsx(Oo,{text:d?"Showing newest first":"Showing oldest first",children:o.jsx("button",{className:Ys.directionToggle,onClick:S,"aria-label":d?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:d?o.jsx(ay,{size:en,"aria-hidden":"true"}):o.jsx(iy,{size:en,"aria-hidden":"true"})})})}),o.jsxs("div",{ref:c,className:`${Ys.scrollContainer} ${m.isSelecting?Ys.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&i,o.jsx(d6,{eventsDropped:s}),o.jsx(ps,{initial:!1,children:v.map((T,C)=>{const D=d?t.length-1-C:C;return o.jsx(Rt.div,{initial:{opacity:0,y:N},animate:{opacity:1,y:0},transition:{duration:w,ease:"easeOut"},children:o.jsx(B4,{copyText:J4(T),isContentBearing:il(T),isSelecting:m.isSelecting,isSelected:m.selectedIndices.has(D),checkboxLabel:l6(T),onSelect:()=>{m.enterSelectionMode(D)},onToggle:L=>{m.toggleEvent(D,L)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:o.jsx(kA,{event:T,toolUseCtx:T.toolUseCtx,settled:T.settled})})},`${T.sessionId}-${T.timestamp}-${D}`)})})]}),o.jsx(ps,{children:m.isSelecting&&o.jsx(G4,{selectedCount:m.selectedCount,totalSelectable:g,onSelectAll:m.selectAll,onDeselectAll:m.deselectAll,onCopy:()=>{k().catch(()=>{})},onCancel:m.cancelSelection})}),o.jsx(ps,{children:!b&&o.jsxs(Rt.button,{className:`${Ys.scrollToAnchor} ${d?Ys.scrollToAnchorTop:Ys.scrollToAnchorBottom}`,onClick:_,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},"aria-label":"Scroll to latest","data-testid":"scroll-to-anchor",children:[d?o.jsx(iy,{size:en,"aria-hidden":"true"}):o.jsx(ay,{size:en,"aria-hidden":"true"})," New events"]})})]})}function Wm(t){const{value:s,onSave:i,validate:r,fieldId:c,activeFieldId:d,onActivate:u,enterToSave:p=!0,trimOnSave:m=!0}=t,[g,v]=y.useState(""),[b,_]=y.useState(""),S=y.useRef(!1),k=d===c,w=y.useCallback(O=>{v(O),_("")},[]),N=y.useCallback(()=>{_("")},[]),T=y.useCallback(()=>{S.current=!1,u==null||u(null),v(""),_("")},[u]),C=y.useCallback(()=>{const O=m?g.trim():g;if(r){const $=r(g);if($){_($);return}}const z=m?s.trim():s;if(O===z){T();return}i(O),T()},[g,s,m,r,i,T]),D=y.useCallback(()=>{S.current=!0,u==null||u(c),v(s),_("")},[c,s,u]),L=y.useCallback(O=>{if(S.current){S.current=!1;return}O.relatedTarget instanceof HTMLElement&&O.relatedTarget.dataset.editAction===c||C()},[c,C]),E=y.useCallback(O=>{O.key==="Escape"?T():O.key==="Enter"&&p&&C()},[T,p,C]),I=(()=>{if(!k)return!1;const O=m?s.trim():s;return(m?g.trim():g)!==O})();return y.useEffect(()=>{!k&&(g!==""||b!=="")&&(v(""),_(""))},[k,g,b]),{isEditing:k,draft:g,error:b,isDirty:I,startEdit:D,cancelEdit:T,save:C,setDraft:w,clearError:N,handleBlur:L,handleKeyDown:E,ignoreInitialBlurRef:S}}const u6="_editFieldWrapper_yuzty_1",f6="_editInput_yuzty_10",p6="_editTextarea_yuzty_42",m6="_editSelect_yuzty_78",h6="_editError_yuzty_111",g6="_editInputInvalid_yuzty_118",v6="_editHint_yuzty_123",y6="_unsavedDot_yuzty_132",b6="_metaValueClickable_yuzty_140",_6="_editButton_yuzty_159",x6="_metaPlaceholder_yuzty_175",k6="_worktreeToggle_yuzty_180",et={editFieldWrapper:u6,editInput:f6,editTextarea:p6,editSelect:m6,editError:h6,editInputInvalid:g6,editHint:v6,unsavedDot:y6,metaValueClickable:b6,editButton:_6,metaPlaceholder:x6,worktreeToggle:k6};function ln(t){const{value:s,onSave:i,validate:r,mode:c="edit",fieldId:d="text",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:_,"data-testid":S}=t,k=y.useRef(null),w=Wm({value:s,onSave:i,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(w.isEditing){const T=window.setTimeout(()=>{var C;(C=k.current)==null||C.focus()},0);return()=>window.clearTimeout(T)}},[w.isEditing]),c==="create"){const T=D=>{m==null||m(D.target.value)},C=r==null?void 0:r(s);return o.jsxs("div",{className:et.editFieldWrapper,children:[o.jsx("input",{className:`${et.editInput} ${C?et.editInputInvalid:""}`,value:s,onChange:T,maxLength:b,placeholder:v,"aria-label":_,"data-testid":S?`${S}-input`:void 0}),C&&o.jsx("span",{className:et.editError,"data-testid":"edit-error",children:C})]})}if(w.isEditing)return o.jsxs("div",{className:et.editFieldWrapper,children:[o.jsx("input",{ref:k,className:`${et.editInput} ${w.error?et.editInputInvalid:""}`,value:w.draft,onChange:T=>w.setDraft(T.target.value),onBlur:w.handleBlur,onKeyDown:w.handleKeyDown,maxLength:b,placeholder:v,"aria-label":_,"data-testid":S?`${S}-input`:void 0}),w.isDirty&&o.jsx("span",{className:et.unsavedDot,title:"Unsaved changes"}),w.error&&o.jsx("span",{className:et.editError,"data-testid":"edit-error",children:w.error}),o.jsx("span",{className:et.editHint,children:"Enter to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return o.jsxs("span",{role:"button",tabIndex:0,className:et.metaValueClickable,onClick:()=>w.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),w.startEdit())},title:"Click to edit","aria-label":_,"data-testid":S?`${S}-button`:void 0,children:[N!==void 0?N:s?o.jsx("span",{children:s}):o.jsx("span",{className:et.metaPlaceholder,children:v||"None"}),o.jsx("span",{className:et.editButton,"aria-hidden":"true",children:"✏️"})]})}function Wp(t){const{value:s,onSave:i,validate:r,mode:c="edit",fieldId:d="textarea",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=t,S=y.useRef(null),k=Wm({value:s,onSave:i,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});if(y.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 o.jsxs("div",{className:et.editFieldWrapper,children:[o.jsx("textarea",{className:`${et.editTextarea} ${T?et.editInputInvalid:""}`,value:s,onChange:N,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),T&&o.jsx("span",{className:et.editError,"data-testid":"edit-error",children:T})]})}if(k.isEditing)return o.jsxs("div",{className:et.editFieldWrapper,children:[o.jsx("textarea",{ref:S,className:`${et.editTextarea} ${k.error?et.editInputInvalid:""}`,value:k.draft,onChange:N=>k.setDraft(N.target.value),onBlur:k.handleBlur,onKeyDown:k.handleKeyDown,title:b,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),k.isDirty&&o.jsx("span",{className:et.unsavedDot,title:"Unsaved changes"}),k.error&&o.jsx("span",{className:et.editError,"data-testid":"edit-error",children:k.error}),o.jsx("span",{className:et.editHint,children:"Tab to save · Esc to cancel"})]});const w=g==null?void 0:g(s);return o.jsxs("span",{role:"button",tabIndex:0,className:et.metaValueClickable,onClick:()=>k.startEdit(),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),k.startEdit())},title:"Click to edit","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[w!==void 0?w:s?o.jsx("span",{children:s}):o.jsx("span",{className:et.metaPlaceholder,children:v||"None"}),o.jsx("span",{className:et.editButton,"aria-hidden":"true",children:"✏️"})]})}function cd(t){var D;const{value:s,onSave:i,mode:r="edit",options:c,fieldId:d="select",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=t,S=y.useRef(null),k=Wm({value:s,onSave:i,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(k.isEditing){const L=window.setTimeout(()=>{var E;(E=S.current)==null||E.focus()},0);return()=>window.clearTimeout(L)}},[k.isEditing]);const w=y.useCallback(L=>{const E=L.target.value;k.ignoreInitialBlurRef.current=!1,E!==s&&i(E),k.cancelEdit()},[s,i,k]),N=y.useCallback(L=>{if(k.ignoreInitialBlurRef.current){k.ignoreInitialBlurRef.current=!1;return}L.relatedTarget instanceof HTMLElement&&L.relatedTarget.dataset.editAction===d||k.cancelEdit()},[d,k]);if(r==="create")return o.jsx("select",{className:et.editSelect,value:s,onChange:L=>m==null?void 0:m(L.target.value),"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(L=>o.jsx("option",{value:L.value,children:L.label},L.value))});if(k.isEditing)return o.jsx("select",{ref:S,className:et.editSelect,value:k.draft,onChange:w,onBlur:N,title:b,"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(L=>o.jsx("option",{value:L.value,children:L.label},L.value))});const T=g==null?void 0:g(s),C=(D=c.find(L=>L.value===s))==null?void 0:D.label;return o.jsxs("button",{type:"button",className:et.metaValueClickable,onClick:()=>k.startEdit(),title:"Click to change","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[T!==void 0?T:C?o.jsx("span",{children:C}):o.jsx("span",{className:et.metaPlaceholder,children:v||"None"}),o.jsx("span",{className:et.editButton,"aria-hidden":"true",children:"✏️"})]})}function S6(t){const{checked:s,onChange:i,label:r,ariaLabel:c,"data-testid":d}=t;return o.jsxs("label",{className:et.worktreeToggle,"data-testid":d,children:[o.jsx("input",{type:"checkbox",checked:s,onChange:u=>i(u.target.checked),"aria-label":c}),o.jsx("span",{children:r})]})}const T6="_envRow_1e1r5_1",w6="_envDot_1e1r5_7",j6="_envDotGreen_1e1r5_14",N6="_envDotYellow_1e1r5_18",C6="_envDotRed_1e1r5_22",E6="_envDotGray_1e1r5_26",Co={envRow:T6,envDot:w6,envDotGreen:j6,envDotYellow:N6,envDotRed:C6,envDotGray:E6};function A6(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?Co.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?Co.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?Co.envDotRed:Co.envDotGray}function D6(t){const{value:s,onSave:i,environments:r,allowNone:c=!1,fieldId:d="environment",activeFieldId:u,onActivate:p,placeholder:m="No environment",ariaLabel:g="Environment","data-testid":v}=t,b=r.find(k=>k.id===s),_=[...c?[{value:"",label:"None"}]:[],...r.map(k=>({value:k.id,label:k.displayName}))],S=()=>{if(b)return o.jsxs("span",{className:Co.envRow,children:[o.jsx("span",{className:`${Co.envDot} ${A6(b.status)}`}),b.displayName]})};return o.jsx(cd,{value:s,onSave:i,options:_,fieldId:d,activeFieldId:u,onActivate:p,renderDisplay:S,placeholder:m,ariaLabel:g,"data-testid":v})}const R6="_nav_1snmp_1",M6="_searchForm_1snmp_8",I6="_searchInput_1snmp_15",O6="_searchButton_1snmp_33",L6="_clearButton_1snmp_68",B6="_workspaceSelect_1snmp_85",z6="_listHeader_1snmp_99",U6="_nodeList_1snmp_108",$6="_nodeItem_1snmp_116",P6="_indicator_1snmp_129",H6="_label_1snmp_136",V6="_badge_1snmp_145",Yn={nav:R6,searchForm:M6,searchInput:I6,searchButton:O6,clearButton:L6,workspaceSelect:B6,listHeader:z6,nodeList:U6,nodeItem:$6,indicator:P6,label:H6,badge:V6};function q6({nodes:t,workspaces:s,loading:i,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:p}){const[m,g]=y.useState(""),v=y.useCallback(k=>{k.preventDefault(),m.trim()&&c(m.trim())},[m,c]),b=y.useCallback(()=>{g(""),d()},[d]),_=y.useCallback(k=>{u(k)},[u]),S=y.useCallback(k=>{g(""),p(k)},[p]);return o.jsxs("div",{className:Yn.nav,"data-testid":"knowledge-nav",children:[o.jsxs("form",{className:Yn.searchForm,onSubmit:v,children:[o.jsx("input",{className:Yn.searchInput,type:"text",placeholder:"Search...",value:m,onChange:k=>{g(k.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),o.jsx("button",{type:"submit",className:Yn.searchButton,disabled:i,children:"Go"})]}),r&&o.jsx("button",{type:"button",className:Yn.clearButton,onClick:b,children:"Clear search"}),o.jsxs("select",{className:Yn.workspaceSelect,onChange:k=>{S(k.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[o.jsx("option",{value:"",children:"All workspaces"}),s.map(k=>o.jsx("option",{value:k.id,children:k.name},k.id))]}),o.jsxs("div",{className:Yn.listHeader,children:["Nodes (",t.length,")"]}),o.jsx("ul",{className:Yn.nodeList,children:t.map(k=>o.jsxs("li",{className:Yn.nodeItem,onClick:()=>{_(k.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),_(k.id))},role:"button",tabIndex:0,children:[o.jsx("span",{className:Yn.indicator,style:{backgroundColor:k.kind==="reference"?"#4A9EFF":k.category==="decision"?"#22C55E":k.category==="concept"?"#A855F7":k.category==="snippet"?"#6B7280":"#EAB308"}}),o.jsx("span",{className:Yn.label,children:k.label}),o.jsx("span",{className:Yn.badge,children:k.kind==="reference"?k.sourceType:k.category})]},k.id))})]})}const G6="_container_1mq5u_1",F6="_hamburger_1mq5u_33",Z6="_brand_1mq5u_49",K6="_brandLogo_1mq5u_68",Y6="_info_1mq5u_75",J6="_connectionLabel_1mq5u_90",W6="_connectionDot_1mq5u_103",X6="_connected_1mq5u_106",Q6="_disconnected_1mq5u_110",Zs={container:G6,hamburger:F6,brand:Z6,brandLogo:K6,info:Y6,connectionLabel:J6,connectionDot:W6,connected:X6,disconnected:Q6};function e5({connected:t,environments:s,sessions:i,onToggleSidebar:r,sidebarOpen:c}){const d=xt(),u=s.length,p=s.filter(g=>g.status==="connected").length,m=i.filter(g=>["running","idle"].includes(g.status)).length;return o.jsxs("div",{className:Zs.container,children:[r&&o.jsx("button",{type:"button",className:Zs.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:o.jsx(M2,{size:Bt,"aria-hidden":"true"})}),o.jsx(Oo,{text:"Home",placement:"bottom",children:o.jsxs("button",{type:"button",className:Zs.brand,onClick:()=>d(Ti),"data-testid":"statusbar-brand",children:[o.jsx("img",{src:"/icon-192x192.png",alt:"",className:Zs.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),o.jsxs("div",{className:Zs.info,children:[o.jsxs("span",{"aria-label":t?"Connected":"Disconnected",children:[o.jsx("span",{className:`${Zs.connectionDot} ${t?Zs.connected:Zs.disconnected}`,"aria-hidden":"true",children:o.jsx(Ba,{size:im,fill:"currentColor"})})," ",o.jsx("span",{className:Zs.connectionLabel,"aria-hidden":"true",children:t?"Connected":"Disconnected"})]}),o.jsxs("span",{children:[p,"/",u," env",u!==1?"s":""]}),o.jsxs("span",{children:[m," active"]})]})]})}const t5="_nav_13gkc_1",n5="_tab_13gkc_35",s5="_tabIcon_13gkc_68",a5="_tabLabel_13gkc_79",i5="_tabActive_13gkc_84",Lr={nav:t5,tab:n5,tabIcon:s5,tabLabel:a5,tabActive:i5},gi=[{view:"dashboard",label:"Dashboard",icon:o.jsx(_2,{size:Bt}),route:Ti,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:o.jsx(O2,{size:Bt}),route:sN,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:o.jsx(r2,{size:Bt}),route:aN,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:o.jsx(B2,{size:Bt}),route:Ao,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:o.jsx(t2,{size:Bt}),route:I_,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:o.jsx(f_,{size:Bt}),route:bd,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:o.jsx(F2,{size:Bt}),route:Qj,testId:"sidebar-tab-settings"}];function o5(t){return t===Ti||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(I_)?"knowledge":t.startsWith(bd)?"findings":t.startsWith(Eo)?"settings":"tasks"}function r5(){const t=Zt(),s=xt(),i=y.useRef(null),r=o5(t.pathname),c=y.useCallback(u=>{s(u.route)},[s]),d=y.useCallback(u=>{var b,_;const p=(b=i.current)==null?void 0:b.querySelectorAll('[role="tab"]');if(!p)return;const m=Array.from(p).findIndex(S=>S===document.activeElement),g=m>=0?m:gi.findIndex(S=>S.view===r);let v=g;if(u.key==="ArrowRight"||u.key==="j"||u.key==="J")u.preventDefault(),v=(g+1)%gi.length;else if(u.key==="ArrowLeft"||u.key==="k"||u.key==="K")u.preventDefault(),v=(g-1+gi.length)%gi.length;else if(u.key==="Home")u.preventDefault(),v=0;else if(u.key==="End")u.preventDefault(),v=gi.length-1;else return;s(gi[v].route),(_=p[v])==null||_.focus()},[r,s]);return o.jsx("nav",{className:Lr.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:d,"data-testid":"sidebar-nav",children:gi.map(u=>{const p=u.view===r;return o.jsx(Oo,{text:u.label,placement:"bottom",children:o.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${Lr.tab} ${p?Lr.tabActive:""}`,onClick:()=>c(u),"data-testid":u.testId,"aria-label":u.label,children:[o.jsx("span",{className:Lr.tabIcon,"aria-hidden":"true",children:u.icon}),o.jsx("span",{className:Lr.tabLabel,children:u.label})]})},u.view)})})}const l5="_container_pi6ii_1",c5="_content_pi6ii_66",zb={container:l5,content:c5},d5=320,g1=220,v1=600,y1="grackle-sidebar-width";function u5(){try{const t=localStorage.getItem(y1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=g1&&s<=v1)return s}}catch{}return d5}function f5(t){try{localStorage.setItem(y1,String(t))}catch{}}function p5({content:t}){const[s]=y.useState(u5),i=y.useRef(null);if(y.useEffect(()=>{const r=i.current;if(!r)return;const c=new ResizeObserver(d=>{for(const u of d){const p=u.borderBoxSize[0];if(p){const m=Math.round(p.inlineSize);m>=g1&&m<=v1&&f5(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return o.jsx("div",{className:zb.container,ref:i,"data-testid":"sidebar",style:{width:s},children:o.jsx("div",{className:zb.content,children:t})})}const m5="_bar_tnfsh_1",h5="_btnPrimary_tnfsh_32",g5="_statusText_tnfsh_85",v5="_statusCompleted_tnfsh_90",y5="_statusFailed_tnfsh_94",b5="_statusBlocked_tnfsh_98",_5="_hintText_tnfsh_103",Tt={bar:m5,btnPrimary:h5,statusText:g5,statusCompleted:v5,statusFailed:y5,statusBlocked:b5,hintText:_5};function x5({sessions:t,tasks:s,environments:i}){const r=xt(),c=Zt(),d=At("/sessions/:sessionId"),u=At("/tasks/:taskId"),p=At("/tasks/:taskId/stream"),m=At("/tasks/:taskId/findings"),g=At("/tasks/:taskId/edit"),v=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),_=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),S=At("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),k=At("/sessions/new"),w=At("/environments/:environmentId/workspaces/:workspaceId"),N=At("/tasks/new"),T=At("/chat"),C=At("/"),D=At("/settings/*"),L=d==null?void 0:d.params.sessionId,E=(u==null?void 0:u.params.taskId)??(p==null?void 0:p.params.taskId)??(m==null?void 0:m.params.taskId)??(v==null?void 0:v.params.taskId)??(b==null?void 0:b.params.taskId)??(_==null?void 0:_.params.taskId)??(S==null?void 0:S.params.taskId),I=v??b??_??S,O=(I==null?void 0:I.params.environmentId)??(w==null?void 0:w.params.environmentId),z=c.pathname.startsWith("/environments")&&!w&&!I,$=!!T,X=!!k,te=!!w&&!v&&!b&&!_&&!S,P=!!N;if(!!C&&!X&&!te&&!P||!!D||(!!g||!!S)||P||z||X)return o.jsx(o.Fragment,{});if($)return i.find(F=>F.adapterType==="local"&&F.status==="connected")?o.jsx(o.Fragment,{}):o.jsx("div",{className:Tt.bar,children:o.jsx("span",{className:Tt.hintText,children:"Add a local environment to start chatting"})});if(te)return o.jsx("div",{className:Tt.bar,children:o.jsx("span",{className:Tt.hintText,children:"Select a task or click + to create one"})});if(E){const A=s.find(pe=>pe.id===E);if(!A)return o.jsx("div",{className:Tt.bar,children:o.jsx("span",{className:Tt.hintText,children:"Loading..."})});const F=new Map(s.map(pe=>[pe.id,pe])),oe=A.dependsOn.some(pe=>{const de=F.get(pe);return de!==void 0&&de.status!=="complete"});if(A.status==="not_started"){const pe=oe?A.dependsOn.map(de=>F.get(de)).filter(de=>de&&de.status!=="complete").map(de=>de.title):[];return o.jsx("div",{className:Tt.bar,children:oe?o.jsxs("span",{className:Tt.statusBlocked,children:["Blocked by: ",pe.join(", ")]}):o.jsx("span",{className:Tt.hintText,children:"Use the buttons above to start or manage this task"})})}if(A.status==="working"||A.status==="paused"){const pe=A.latestSessionId||void 0,de=pe?t.find(ke=>ke.id===pe):void 0;return de&&de.status!=="stopped"?o.jsx(o.Fragment,{}):o.jsx("div",{className:Tt.bar,children:o.jsx("span",{className:Tt.hintText,children:"Waiting for agent..."})})}if(A.status==="complete")return o.jsxs("div",{className:Tt.bar,children:[o.jsx("span",{className:`${Tt.statusText} ${Tt.statusCompleted}`,children:"Task completed"}),o.jsx("button",{onClick:()=>r(Ci(A.workspaceId,void 0,O)),className:Tt.btnPrimary,children:"+ New Task"})]});if(A.status==="failed")return o.jsx("div",{className:Tt.bar,children:o.jsx("span",{className:`${Tt.statusText} ${Tt.statusFailed}`,children:"Task failed"})})}if(L){const A=t.find(pe=>pe.id===L),F=(A==null?void 0:A.status)==="stopped";if(A!==void 0&&!F)return o.jsx(o.Fragment,{});if(F)return o.jsxs("div",{className:Tt.bar,children:[o.jsxs("span",{className:`${Tt.statusText} ${Tt.hintText}`,children:["Session ",A.endReason||A.status]}),o.jsx("button",{onClick:()=>r(D_(A.environmentId)),className:Tt.btnPrimary,children:"+ New Chat"})]})}return o.jsx("div",{className:Tt.bar,children:o.jsx("span",{className:Tt.hintText,children:"Loading..."})})}const k5="_nav_14i94_1",S5="_tab_14i94_24",T5="_tabActive_14i94_62",w5="_tabLabel_14i94_75",j5="_statusDot_14i94_81",N5="_pulse_14i94_87",C5="_addButton_14i94_99",E5="_empty_14i94_132",Aa={nav:k5,tab:S5,tabActive:T5,tabLabel:w5,statusDot:j5,pulse:N5,addButton:C5,empty:E5},A5={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function D5({environments:t}){const s=xt(),i=y.useRef(null),r=At("/environments/:environmentId"),c=At("/environments/:environmentId/edit"),d=At("/environments/:environmentId/workspaces/:workspaceId"),u=At("/environments/:environmentId/workspaces/:workspaceId/*"),p=(r==null?void 0:r.params.environmentId)??(c==null?void 0:c.params.environmentId)??(d==null?void 0:d.params.environmentId)??(u==null?void 0:u.params.environmentId),m=p==="new"?void 0:p,g=y.useCallback(_=>{s(Si(_))},[s]),v=y.useCallback(_=>{var T;const S=(T=i.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!S||S.length===0)return;const k=Array.from(S).findIndex(C=>C===document.activeElement),w=k>=0?k:t.findIndex(C=>C.id===m);let N=w;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),N=(w+1)%S.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),N=(w-1+S.length)%S.length;else if(_.key==="Home")_.preventDefault(),N=0;else if(_.key==="End")_.preventDefault(),N=S.length-1;else return;N<t.length&&s(Si(t[N].id)),S[N].focus()},[m,t,s]),b=m??(t.length>0?t[0].id:void 0);return o.jsxs("div",{className:Aa.nav,"data-testid":"environment-nav",children:[o.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(_=>{const S=_.id===m,k=_.id===b,w=A5[_.status]||"var(--text-tertiary)",N=_.status==="connected";return o.jsxs("button",{role:"tab",type:"button","aria-selected":S,tabIndex:k?0:-1,className:`${Aa.tab} ${S?Aa.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[o.jsx("span",{className:`${Aa.statusDot} ${N?Aa.pulse:""}`,style:{color:w},"aria-hidden":"true",children:o.jsx(Ba,{size:im,fill:"currentColor"})}),o.jsx("span",{className:Aa.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),o.jsx("button",{type:"button",className:Aa.addButton,onClick:()=>s(Wj),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&o.jsx("div",{className:Aa.empty,children:"No environments yet."})]})}function Xm(t){const s=new Date(t),i=new Date,r=i.getTime()-s.getTime(),c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return"just now";if(d<60)return`${d}m ago`;if(u<24)return`${u}h ago`;if(p===1)return"yesterday";if(p<7)return`${p} days ago`;const m=s.getFullYear()===i.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Ub={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 dd(t){return Ub[t]||Ub.general}const R5="_nav_dlm8m_1",M5="_categoryPills_dlm8m_24",I5="_categoryPill_dlm8m_24",O5="_tab_dlm8m_42",L5="_tabActive_dlm8m_80",B5="_tabContent_dlm8m_93",z5="_tabLabel_dlm8m_100",U5="_tabMeta_dlm8m_106",$5="_categoryDot_dlm8m_111",P5="_empty_dlm8m_118",_s={nav:R5,categoryPills:M5,categoryPill:I5,tab:O5,tabActive:L5,tabContent:B5,tabLabel:z5,tabMeta:U5,categoryDot:$5,empty:P5};function H5({findings:t,workspaceId:s,environmentId:i}){const r=xt(),c=y.useRef(null),d=At("/findings/:findingId"),u=At("/environments/:environmentId/workspaces/:workspaceId/findings/:findingId"),p=(d==null?void 0:d.params.findingId)??(u==null?void 0:u.params.findingId),m=y.useMemo(()=>{const _=new Set(t.map(S=>S.category).filter(Boolean));return Array.from(_).sort()},[t]),g=y.useCallback(_=>{r(Rp(_,s,i))},[r,s,i]),v=y.useCallback(_=>{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),w=k>=0?k:t.findIndex(C=>C.id===p);let N=w;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),N=(w+1)%S.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),N=(w-1+S.length)%S.length;else if(_.key==="Home")_.preventDefault(),N=0;else if(_.key==="End")_.preventDefault(),N=S.length-1;else return;N<t.length&&r(Rp(t[N].id,s,i)),S[N].focus()},[p,t,r,s,i]),b=p??(t.length>0?t[0].id:void 0);return o.jsxs("div",{className:_s.nav,"data-testid":"findings-nav",children:[m.length>1&&o.jsx("div",{className:_s.categoryPills,"data-testid":"findings-nav-categories",children:m.map(_=>o.jsx("span",{className:_s.categoryPill,style:{color:dd(_).text},children:_},_))}),o.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(_=>{const S=_.id===p,k=_.id===b;return o.jsxs("button",{role:"tab",type:"button","aria-selected":S,tabIndex:k?0:-1,className:`${_s.tab} ${S?_s.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"finding-nav-item",children:[o.jsx("span",{className:_s.categoryDot,style:{color:dd(_.category).text},"aria-hidden":"true",children:o.jsx(Ba,{size:im,fill:"currentColor"})}),o.jsxs("span",{className:_s.tabContent,children:[o.jsx("span",{className:_s.tabLabel,title:_.title,children:_.title}),o.jsx("span",{className:_s.tabMeta,title:_.createdAt,children:Xm(_.createdAt)})]})]},_.id)})}),t.length===0&&o.jsx("div",{className:_s.empty,children:"No findings yet. Agents will post discoveries here."})]})}function V5(t){if(t.length===0)return[];const s=[...t].sort((r,c)=>r[0]-c[0]),i=[[s[0][0],s[0][1]]];for(let r=1;r<s.length;r++){const c=i[i.length-1],[d,u]=s[r];d<=c[1]+1?c[1]=Math.max(c[1],u):i.push([d,u])}return i}function b1({text:t,indices:s,highlightClass:i}){if(!s||s.length===0)return o.jsx(o.Fragment,{children:t});const r=V5(s),c=[];let d=0;for(const[u,p]of r)u>d&&c.push(o.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(o.jsx("mark",{className:i,children:t.slice(u,p+1)},`m${u}`)),d=p+1;return d<t.length&&c.push(o.jsx("span",{children:t.slice(d)},`p${d}`)),o.jsx(o.Fragment,{children:c})}function q5(t){const s=new Map(t.map(r=>[r.id,{...r,children:[]}])),i=[];for(const r of s.values())r.parentTaskId&&s.has(r.parentTaskId)?s.get(r.parentTaskId).children.push(r):i.push(r);for(const r of s.values())r.children.sort((c,d)=>c.sortOrder-d.sortOrder);return i.sort((r,c)=>r.sortOrder-c.sortOrder)}function G5(t,s){const i=new Map;for(const d of t){const p=d.dependsOn.length>0&&d.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":d.status,m=i.get(p);m?m.push(d):i.set(p,[d])}const r=[],c=new Set;for(const d of tw){c.add(d);const u=i.get(d);if(u&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=za(d);r.push({status:d,label:p.label,style:p,tasks:u})}}for(const[d,u]of i)if(!c.has(d)&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=za(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const F5="_container_z4i38_1",Z5="_header_z4i38_5",K5="_headerActions_z4i38_17",Y5="_searchInput_z4i38_23",J5="_searchHighlight_z4i38_56",W5="_groupToggle_z4i38_62",X5="_groupToggleActive_z4i38_89",Q5="_addButton_z4i38_93",eI="_taskRow_z4i38_120",tI="_selected_z4i38_140",nI="_expandArrow_z4i38_150",sI="_expanded_z4i38_157",aI="_leafSpacer_z4i38_161",iI="_taskStatusIcon_z4i38_166",oI="_taskTitle_z4i38_170",rI="_workspaceBadge_z4i38_177",lI="_childCountBadge_z4i38_195",cI="_dependencyBadge_z4i38_208",dI="_blockedBadge_z4i38_220",uI="_addChildButton_z4i38_225",fI="_emptyState_z4i38_268",pI="_statusGroupHeader_z4i38_275",mI="_statusGroupIcon_z4i38_294",hI="_statusGroupLabel_z4i38_298",gI="_statusGroupCount_z4i38_303",Fe={container:F5,header:Z5,headerActions:K5,searchInput:Y5,searchHighlight:J5,groupToggle:W5,groupToggleActive:X5,addButton:Q5,taskRow:eI,selected:tI,expandArrow:nI,expanded:sI,leafSpacer:aI,taskStatusIcon:iI,taskTitle:oI,workspaceBadge:rI,childCountBadge:lI,dependencyBadge:cI,blockedBadge:dI,addChildButton:uI,emptyState:fI,statusGroupHeader:pI,statusGroupIcon:mI,statusGroupLabel:hI,statusGroupCount:gI},vI=[{name:"title",weight:2},{name:"description",weight:1}],_1=16,yI=16,x1="grackle-task-group-by-status";function $b(){try{return localStorage.getItem(x1)==="true"}catch{return!1}}function bI(t){try{localStorage.setItem(x1,String(t))}catch{}}function _I({group:t,isExpanded:s,onToggle:i,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return o.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[o.jsxs("div",{className:Fe.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:i,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i())},children:[o.jsx("span",{className:`${Fe.expandArrow} ${s?Fe.expanded:""}`,"aria-hidden":"true",children:o.jsx(sa,{size:it})}),o.jsx("span",{className:Fe.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),o.jsx("span",{className:Fe.statusGroupLabel,children:t.label}),o.jsx("span",{className:Fe.statusGroupCount,children:t.tasks.length})]}),o.jsx(ps,{children:s&&o.jsx(Rt.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=za(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return o.jsxs("div",{onClick:()=>c(In(p.id)),role:"button",tabIndex:0,"aria-label":p.title,onKeyDown:b=>{b.currentTarget===b.target&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c(In(p.id)))},className:`${Fe.taskRow} ${g?Fe.selected:""}`,style:{"--task-indent":`${_1}px`},"data-task-id":p.id,children:[o.jsx("span",{className:Fe.leafSpacer}),o.jsx("span",{className:Fe.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${rl(p.status)}`,children:m.icon}),o.jsx("span",{className:Fe.taskTitle,title:p.title,children:o.jsx(b1,{text:p.title,indices:d.get(p.id),highlightClass:Fe.searchHighlight})}),v&&o.jsx("span",{className:Fe.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function k1({node:t,depth:s,expandedTasks:i,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m}){const g=za(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(T=>u.get(T)!=="complete"),b=i.has(t.id),_=t.children.length>0,S=c===t.id,k=_1+s*yI,N=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{onClick:()=>d(In(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:T=>{T.currentTarget===T.target&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),d(In(t.id)))},className:`${Fe.taskRow} ${S?Fe.selected:""}`,style:{"--task-indent":`${k}px`},"data-task-id":t.id,children:[_&&o.jsx("span",{className:`${Fe.expandArrow} ${b?Fe.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:T=>{T.stopPropagation(),r(t.id)},onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),r(t.id))},children:o.jsx(sa,{size:it,"aria-hidden":"true"})}),!_&&o.jsx("span",{className:Fe.leafSpacer}),o.jsx("span",{className:Fe.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${rl(t.status)}`,children:g.icon}),o.jsx("span",{className:Fe.taskTitle,title:t.title,children:o.jsx(b1,{text:t.title,indices:p.get(t.id),highlightClass:Fe.searchHighlight})}),N&&o.jsx("span",{className:Fe.workspaceBadge,title:N,children:N}),_&&o.jsxs("span",{className:Fe.childCountBadge,children:[t.children.filter(T=>T.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&o.jsx("span",{className:`${Fe.dependencyBadge} ${v?Fe.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<uT&&o.jsx(Oo,{text:"Add child task",children:o.jsx("button",{onClick:T=>{T.stopPropagation(),d(Ci(t.workspaceId,t.id))},"aria-label":"Add child task",className:Fe.addChildButton,children:"+"})})]}),o.jsx(ps,{children:_&&b&&o.jsx(Rt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:t.children.map(T=>o.jsx(k1,{node:T,depth:s+1,expandedTasks:i,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},T.id))})})]})}function xI({workspaces:t,tasks:s}){const i=xt(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[p,m]=y.useState($b),[g,v]=y.useState($b),[b,_]=y.useState(new Map),S=At("/tasks/:taskId/*"),k=(S==null?void 0:S.params.taskId)!=="new"?S==null?void 0:S.params.taskId:void 0,w=y.useMemo(()=>new Map(s.map(K=>[K.id,K.status])),[s]),N=y.useMemo(()=>new Map(t.map(K=>[K.id,K.name])),[t]),T=()=>{const K=!p;bI(K),m(K),K&&(v(!0),_(new Map))},C=K=>{_(re=>{const A=new Map(re),F=A.has(K)?A.get(K):g;return A.set(K,!F),A})},D=K=>b.has(K)?b.get(K):g,L=K=>{c(re=>{const A=new Set(re);return A.has(K)?(A.delete(K),u(F=>new Set(F).add(K))):(A.add(K),u(F=>{const oe=new Set(F);return oe.delete(K),oe})),A})};y.useEffect(()=>{const K=new Set(s.filter(re=>re.parentTaskId).map(re=>re.parentTaskId));K.size>0&&c(re=>{const A=new Set(re);for(const F of K)d.has(F)||A.add(F);return A})},[s,d]);const[E,I]=y.useState(""),{directMatchTaskIds:O,treeMatchTaskIds:z,titleHighlights:$}=y.useMemo(()=>{if(!E.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const K=dT(s,E,vI),re=new Set(K.map(pe=>pe.item.id)),A=new Map;for(const pe of K){const de=pe.matches.find(Oe=>Oe.key==="title");de&&A.set(pe.item.id,de.indices)}const F=new Set(re),oe=new Map(s.map(pe=>[pe.id,pe]));for(const pe of[...re]){let de=oe.get(pe);for(;de!=null&&de.parentTaskId;)F.add(de.parentTaskId),de=oe.get(de.parentTaskId)}return{directMatchTaskIds:re,treeMatchTaskIds:F,titleHighlights:A}},[E,s]),X=O!==null,te=X?p?O:z:null,P=te?s.filter(K=>te.has(K.id)):s,ae=p?[]:q5(P);return o.jsxs("div",{className:Fe.container,children:[o.jsxs("div",{className:Fe.header,children:[o.jsx("span",{children:"Tasks"}),o.jsxs("div",{className:Fe.headerActions,children:[o.jsx(Oo,{text:p?"Switch to tree view":"Group tasks by status",children:o.jsx("button",{className:`${Fe.groupToggle} ${p?Fe.groupToggleActive:""}`,onClick:T,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,"data-testid":"task-group-by-status-toggle",children:o.jsx(E2,{size:en})})}),o.jsx(Oo,{text:"New task",children:o.jsx("button",{className:Fe.addButton,onClick:()=>i(Ci()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&o.jsx("input",{type:"text",value:E,onChange:K=>I(K.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Fe.searchInput,"data-testid":"sidebar-search"}),p?G5(P,w).map(K=>o.jsx(_I,{group:K,isExpanded:D(K.status),onToggle:()=>C(K.status),selectedTaskId:k,navigate:i,titleHighlights:$,workspaceNames:N},K.status)):ae.map(K=>o.jsx(k1,{node:K,depth:0,expandedTasks:r,toggleTask:L,selectedTaskId:k,navigate:i,taskStatusById:w,titleHighlights:$,workspaceNames:N},K.id)),P.length===0&&!X&&o.jsx("div",{className:Fe.emptyState,children:"No tasks yet. Click + to create one."}),P.length===0&&X&&o.jsx("div",{className:Fe.emptyState,children:"No matching tasks"})]})}const kI="_toast_ed2dk_1",SI="_success_ed2dk_18",TI="_icon_ed2dk_22",wI="_error_ed2dk_25",jI="_warning_ed2dk_32",NI="_info_ed2dk_38",CI="_message_ed2dk_53",EI="_close_ed2dk_60",Br={toast:kI,success:SI,icon:TI,error:wI,warning:jI,info:NI,message:CI,close:EI},AI={success:o.jsx(ji,{size:Bt}),error:o.jsx(Pa,{size:Bt}),warning:o.jsx(am,{size:Bt}),info:o.jsx(sm,{size:Bt})};function DI({toast:t,onDismiss:s}){return y.useEffect(()=>{const i=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(i)},[t.id,t.duration,s]),o.jsxs(Rt.div,{className:`${Br.toast} ${Br[t.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[o.jsx("span",{className:Br.icon,"aria-hidden":"true",children:AI[t.variant]}),o.jsx("span",{className:Br.message,children:t.message}),o.jsx("button",{type:"button",className:Br.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:o.jsx(Pa,{size:en,"aria-hidden":"true"})})]})}const RI="_container_qqse2_1",MI={container:RI};function II({toasts:t,onDismiss:s}){return o.jsx("div",{className:MI.container,"data-testid":"toast-container",children:o.jsx(ps,{children:t.map(i=>o.jsx(DI,{toast:i,onDismiss:s},i.id))})})}const OI="_callout_e5awm_1",LI="_success_e5awm_11",BI="_icon_e5awm_15",zI="_error_e5awm_18",UI="_warning_e5awm_25",$I="_info_e5awm_32",PI="_content_e5awm_48",HI="_close_e5awm_53",zr={callout:OI,success:LI,icon:BI,error:zI,warning:UI,info:$I,content:PI,close:HI},VI={success:o.jsx(ji,{size:Bt}),error:o.jsx(Pa,{size:Bt}),warning:o.jsx(am,{size:Bt}),info:o.jsx(sm,{size:Bt})};function qI({variant:t="info",children:s,dismissible:i=!1,className:r}){const[c,d]=y.useState(!1);return o.jsx(o.Fragment,{children:!c&&o.jsxs("div",{className:[zr.callout,zr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[o.jsx("span",{className:zr.icon,"aria-hidden":"true",children:VI[t]}),o.jsx("span",{className:zr.content,children:s}),i&&o.jsx("button",{type:"button",className:zr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:o.jsx(Pa,{size:en,"aria-hidden":"true"})})]})})}function GI({currentVersion:t,latestVersion:s,updateAvailable:i,isDocker:r}){if(!i)return o.jsx(o.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return o.jsx("div",{"data-testid":"update-banner",children:o.jsxs(qI,{variant:"info",dismissible:!0,children:[o.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",o.jsx("code",{children:c})]})})}const FI="_container_de44x_1",ZI="_emptyState_de44x_8",KI="_card_de44x_14",YI="_cardClickable_de44x_34",JI="_cardHeader_de44x_42",WI="_categoryBadge_de44x_54",XI="_findingTitle_de44x_62",QI="_findingDate_de44x_68",eO="_findingContent_de44x_80",tO="_tags_de44x_86",nO="_tag_de44x_86",cs={container:FI,emptyState:ZI,card:KI,cardClickable:YI,cardHeader:JI,categoryBadge:WI,findingTitle:XI,findingDate:QI,findingContent:eO,tags:tO,tag:nO};function S1({findings:t,onFindingClick:s}){return t.length===0?o.jsx("div",{className:cs.emptyState,children:"No findings yet. Agents will post discoveries here."}):o.jsx("div",{className:cs.container,children:t.map((i,r)=>{const c=dd(i.category),d=s?Rt.button:Rt.div;return o.jsxs(d,{type:s?"button":void 0,className:`${cs.card} ${s?cs.cardClickable:""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:r*.05,duration:.2},onClick:s?()=>{s(i.id)}:void 0,children:[o.jsxs("div",{className:cs.cardHeader,children:[o.jsx("span",{className:cs.categoryBadge,style:{background:c.bg,color:c.text},children:i.category}),o.jsx("span",{className:cs.findingTitle,children:i.title}),o.jsx("span",{className:cs.findingDate,title:i.createdAt,children:Xm(i.createdAt)})]}),o.jsx("div",{className:cs.findingContent,children:i.content.length>300?i.content.slice(0,300)+"...":i.content}),i.tags.length>0&&o.jsx("div",{className:cs.tags,children:i.tags.map(u=>o.jsx("span",{className:cs.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:u},u))})]},i.id)})})}const sO="_section_1ingb_14",aO="_sectionTitle_1ingb_26",iO="_sectionDescription_1ingb_35",oO="_tokenList_1ingb_48",rO="_tokenRow_1ingb_55",lO="_tokenBadge_1ingb_68",cO="_tokenName_1ingb_83",dO="_tokenTarget_1ingb_90",uO="_deleteButton_1ingb_99",fO="_addForm_1ingb_113",pO="_formRow_1ingb_119",mO="_input_1ingb_125",hO="_select_1ingb_155",gO="_addButton_1ingb_187",vO="_emptyStateInfo_1ingb_221",yO="_themeOptions_1ingb_229",bO="_themeOption_1ingb_229",_O="_themeOptionSelected_1ingb_254",xO="_themeOptionHeader_1ingb_259",kO="_themeOptionLabel_1ingb_266",SO="_themeOptionDesc_1ingb_273",TO="_variantToggle_1ingb_279",wO="_variantButton_1ingb_286",jO="_variantActive_1ingb_305",NO="_themeSwatches_1ingb_311",CO="_themeSwatch_1ingb_311",EO="_systemToggle_1ingb_325",AO="_systemToggleHint_1ingb_341",DO="_themeActive_1ingb_348",RO="_aboutGrid_1ingb_354",MO="_aboutItem_1ingb_360",IO="_aboutLabel_1ingb_373",OO="_aboutValue_1ingb_379",LO="_aboutDot_1ingb_387",BO="_aboutDotConnected_1ingb_394",zO="_aboutDotDisconnected_1ingb_398",ge={section:sO,sectionTitle:aO,sectionDescription:iO,tokenList:oO,tokenRow:rO,tokenBadge:lO,tokenName:cO,tokenTarget:dO,deleteButton:uO,addForm:fO,formRow:pO,input:mO,select:hO,addButton:gO,emptyStateInfo:vO,themeOptions:yO,themeOption:bO,themeOptionSelected:_O,themeOptionHeader:xO,themeOptionLabel:kO,themeOptionDesc:SO,variantToggle:TO,variantButton:wO,variantActive:jO,themeSwatches:NO,themeSwatch:CO,systemToggle:EO,systemToggleHint:AO,themeActive:DO,aboutGrid:RO,aboutItem:MO,aboutLabel:IO,aboutValue:OO,aboutDot:LO,aboutDotConnected:BO,aboutDotDisconnected:zO},UO=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function $O({tokens:t,onSetToken:s,onDeleteToken:i,onShowToast:r}){const[c,d]=y.useState(""),[u,p]=y.useState(""),[m,g]=y.useState("env_var"),[v,b]=y.useState(""),[_,S]=y.useState(null),k=T=>{if(T.preventDefault(),!c||!u)return;const C=m==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,u,m,C,m==="file"?v:""),r==null||r("Token saved successfully","success"),d(""),p(""),b("")},w=T=>{S(T)},N=()=>{_&&(i(_),r==null||r("Token deleted","info")),S(null)};return o.jsxs(o.Fragment,{children:[o.jsx(wi,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:N,onCancel:()=>S(null)}),o.jsxs("section",{className:ge.section,children:[o.jsx("h3",{className:ge.sectionTitle,children:"Tokens"}),o.jsx("p",{className:ge.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?o.jsx("div",{className:ge.emptyStateInfo,children:"Add your first API token to enable service integrations."}):o.jsx("div",{className:ge.tokenList,children:t.map(T=>o.jsxs("div",{className:ge.tokenRow,children:[o.jsx("span",{className:ge.tokenBadge,children:T.tokenType}),o.jsx("span",{className:ge.tokenName,children:T.name}),o.jsx("span",{className:ge.tokenTarget,children:T.tokenType==="env_var"?T.envVar:T.filePath}),o.jsx("button",{className:ge.deleteButton,onClick:()=>w(T.name),title:`Delete ${T.name}`,"aria-label":`Delete ${T.name}`,children:o.jsx(Pa,{size:en,"aria-hidden":"true"})})]},T.name))}),o.jsxs("form",{className:ge.addForm,onSubmit:k,children:[o.jsxs("div",{className:ge.formRow,children:[o.jsx("input",{className:ge.input,type:"text",placeholder:"Token name",value:c,onChange:T=>d(T.target.value)}),o.jsx("input",{className:ge.input,type:"password",placeholder:"Value",value:u,onChange:T=>p(T.target.value)})]}),o.jsxs("div",{className:ge.formRow,children:[o.jsx("select",{className:ge.select,value:m,onChange:T=>g(T.target.value),children:UO.map(T=>o.jsx("option",{value:T.value,children:T.label},T.value))}),o.jsx("input",{className:ge.input,type:"text",placeholder:m==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:T=>b(T.target.value)}),o.jsx("button",{className:ge.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const jd=[{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"]}],T1=new Set(jd.map(t=>t.id)),Pb="grackle";function Xp(t){return jd.find(s=>s.id===t)}function PO({themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:r,onSetPreferSystem:c}){return o.jsxs("section",{className:ge.section,children:[o.jsx("h3",{className:ge.sectionTitle,children:"Appearance"}),o.jsx("p",{className:ge.sectionDescription,children:"Choose how Grackle looks across the app."}),o.jsx("div",{className:ge.themeOptions,children:jd.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 o.jsxs("button",{type:"button",className:`${ge.themeOption} ${p?ge.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>i(d.id),children:[o.jsxs("span",{className:ge.themeOptionHeader,children:[o.jsxs("span",{children:[o.jsx("span",{className:ge.themeOptionLabel,children:d.label}),o.jsx("span",{className:ge.themeOptionDesc,children:d.description})]}),u&&o.jsxs("span",{className:ge.variantToggle,children:[o.jsx("span",{role:"button",tabIndex:0,className:`${ge.variantButton} ${p&&m?ge.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(d.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(d.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&m,children:"☼"}),o.jsx("span",{role:"button",tabIndex:0,className:`${ge.variantButton} ${p&&!m?ge.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(d.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(d.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!m,children:"☾"})]})]}),d.swatches&&o.jsx("span",{className:ge.themeSwatches,children:d.swatches.map((g,v)=>o.jsx("span",{className:ge.themeSwatch,style:{background:g}},v))})]},d.id)})}),o.jsxs("label",{className:ge.systemToggle,children:[o.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),o.jsx("span",{children:"Match system light/dark preference"})]}),o.jsx("p",{className:ge.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),o.jsxs("p",{className:ge.themeActive,children:["Active theme: ",o.jsx("strong",{children:s})]})]})}function HO({connected:t,environments:s,sessions:i}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=i.filter(u=>["running","idle"].includes(u.status)).length;return o.jsxs("section",{className:ge.section,"data-testid":"about-panel",children:[o.jsx("h3",{className:ge.sectionTitle,children:"About"}),o.jsx("p",{className:ge.sectionDescription,children:"Connection status and application information."}),o.jsxs("div",{className:ge.aboutGrid,children:[o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Connection"}),o.jsxs("span",{className:ge.aboutValue,children:[o.jsx("span",{className:`${ge.aboutDot} ${t?ge.aboutDotConnected:ge.aboutDotDisconnected}`}),t?"Connected":"Disconnected"]})]}),o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Environments"}),o.jsxs("span",{className:ge.aboutValue,children:[r,"/",c," connected"]})]}),o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Active Sessions"}),o.jsx("span",{className:ge.aboutValue,children:d})]}),o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Version"}),o.jsx("span",{className:ge.aboutValue,children:"0.91.3"})]})]})]})}const VO="_container_cddyd_1",qO="_header_cddyd_8",GO="_headerTitle_cddyd_35",FO="_badge_cddyd_44",ZO="_headerActions_cddyd_54",KO="_body_cddyd_61",YO="_formContent_cddyd_73",JO="_section_cddyd_85",WO="_label_cddyd_91",XO="_titleInput_cddyd_98",QO="_descriptionTextarea_cddyd_131",eL="_parentContext_cddyd_167",tL="_parentLabel_cddyd_175",nL="_parentName_cddyd_182",sL="_personaSelect_cddyd_186",aL="_depList_cddyd_220",iL="_depItem_cddyd_226",oL="_depItemSelected_cddyd_248",rL="_noDeps_cddyd_252",lL="_btnPrimary_cddyd_258",cL="_btnGhost_cddyd_289",Qe={container:VO,header:qO,headerTitle:GO,badge:FO,headerActions:ZO,body:KO,formContent:YO,section:JO,label:WO,titleInput:XO,descriptionTextarea:QO,parentContext:eL,parentLabel:tL,parentName:nL,personaSelect:sL,depList:aL,depItem:iL,depItemSelected:oL,noDeps:rL,btnPrimary:lL,btnGhost:cL};function w1({mode:t,taskId:s,workspaceId:i,parentTaskId:r,environmentId:c,tasks:d,workspaces:u,personas:p,onCreateTask:m,onUpdateTask:g,onEditDone:v,onShowToast:b}){const _=xt(),S=t==="edit",k=S&&s?d.find(me=>me.id===s):void 0,w=S?(k==null?void 0:k.workspaceId)??"":i??"",[N,T]=y.useState(w),C=w||N,D=u.find(me=>me.id===C),L=c??(D==null?void 0:D.environmentId),E=!S&&!i,I=S?(k==null?void 0:k.parentTaskId)??"":r??"",O=I?d.find(me=>me.id===I):void 0,[z,$]=y.useState((k==null?void 0:k.title)??""),[X,te]=y.useState((k==null?void 0:k.description)??""),[P,ae]=y.useState((k==null?void 0:k.dependsOn)??[]),[K,re]=y.useState((k==null?void 0:k.defaultPersonaId)??""),[A,F]=y.useState((k==null?void 0:k.canDecompose)??!1),[oe,pe]=y.useState(!1),de=y.useRef(!1);y.useEffect(()=>{S&&k&&!de.current&&(de.current=!0,$(k.title),te(k.description),ae(k.dependsOn),re(k.defaultPersonaId),F(k.canDecompose))},[S,k]);const Oe=d.filter(me=>me.workspaceId===C&&(!S||me.id!==s)&&me.id!==I),ke=z.trim().length>0&&(!S||k!==void 0)&&C.length>0,Ce=me=>{ae(Be=>Be.includes(me)?Be.filter(mt=>mt!==me):[...Be,me])},ze=()=>{!ke||oe||S&&k===void 0||(S&&s?(g(s,z.trim(),X,P,K),b==null||b("Task updated","success"),v?v():_(In(s,void 0,C,L),{replace:!0})):(pe(!0),m(C,z.trim(),X,P.length>0?P:void 0,I||void 0,K,A,()=>{b==null||b("Task created","success"),_(i?ki(i,L):"/tasks",{replace:!0})},me=>{b==null||b(me,"error"),pe(!1)})))},ue=()=>{if(v){v();return}_(S&&s?In(s,void 0,C,L):i?ki(i,L):"/tasks")},_e=S?"edit task":I?"child task":"new task";return o.jsxs("div",{className:Qe.container,children:[o.jsxs("div",{className:Qe.header,children:[o.jsxs("div",{className:Qe.headerTitle,children:[o.jsx("span",{className:Qe.badge,children:_e}),O&&o.jsxs("span",{className:Qe.parentContext,children:[o.jsx("span",{className:Qe.parentLabel,children:"Child of"}),o.jsx("span",{className:Qe.parentName,children:O.title})]})]}),o.jsxs("div",{className:Qe.headerActions,children:[o.jsx("button",{onClick:ze,disabled:!ke||oe,className:Qe.btnPrimary,"data-testid":"task-edit-save",children:oe?"Creating…":S?"Save Changes":"Create"}),o.jsx("button",{onClick:ue,className:Qe.btnGhost,children:"Cancel"})]})]}),o.jsx("div",{className:Qe.body,children:o.jsxs("div",{className:Qe.formContent,children:[E&&o.jsxs("div",{className:Qe.section,children:[o.jsx("label",{className:Qe.label,htmlFor:"task-edit-workspace",children:"Workspace"}),o.jsxs("select",{id:"task-edit-workspace",value:N,onChange:me=>T(me.target.value),className:Qe.personaSelect,"data-testid":"task-edit-workspace",children:[o.jsx("option",{value:"",children:"Select a workspace..."}),u.map(me=>o.jsx("option",{value:me.id,children:me.name},me.id))]})]}),o.jsxs("div",{className:Qe.section,children:[o.jsx("label",{className:Qe.label,htmlFor:"task-edit-title",children:"Title"}),o.jsx("input",{id:"task-edit-title",type:"text",value:z,onChange:me=>$(me.target.value),placeholder:"Task title...",autoFocus:!0,className:Qe.titleInput,"data-testid":"task-edit-title",onKeyDown:me=>{me.key==="Enter"&&ke&&ze()}})]}),o.jsxs("div",{className:Qe.section,children:[o.jsx("label",{className:Qe.label,htmlFor:"task-edit-description",children:"Description"}),o.jsx("textarea",{id:"task-edit-description",value:X,onChange:me=>te(me.target.value),placeholder:"Describe the task... (markdown supported)",className:Qe.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),o.jsxs("div",{className:Qe.section,children:[o.jsx("label",{className:Qe.label,htmlFor:"task-edit-persona",children:"Default Persona"}),o.jsxs("select",{id:"task-edit-persona",value:K,onChange:me=>re(me.target.value),className:Qe.personaSelect,"data-testid":"task-edit-persona",children:[o.jsx("option",{value:"",children:"(Inherit)"}),p.map(me=>o.jsx("option",{value:me.id,children:me.name},me.id))]})]}),!S&&o.jsx("div",{className:Qe.section,children:o.jsxs("label",{className:Qe.depItem,"data-testid":"task-edit-can-decompose",children:[o.jsx("input",{type:"checkbox",checked:A,onChange:me=>F(me.target.checked)}),"Can spawn subtasks"]})}),o.jsxs("div",{className:Qe.section,children:[o.jsx("div",{className:Qe.label,children:"Dependencies"}),Oe.length===0?o.jsx("div",{className:Qe.noDeps,children:"No other tasks in this workspace"}):o.jsx("div",{className:Qe.depList,children:Oe.map(me=>{const Be=P.includes(me.id);return o.jsxs("label",{className:`${Qe.depItem} ${Be?Qe.depItemSelected:""}`,"data-testid":`dep-option-${me.id}`,children:[o.jsx("input",{type:"checkbox",checked:Be,onChange:()=>Ce(me.id)}),me.title,o.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",me.status,")"]})]},me.id)})})]})]})})]})}const dL="_actionButtons_1rjka_1",uL="_btnPrimary_1rjka_8",fL="_btnDanger_1rjka_39",pL="_btnGhost_1rjka_78",Ft={actionButtons:dL,btnPrimary:uL,btnDanger:fL,btnGhost:pL};function mL({task:t,sessionId:s,isBlocked:i,onStart:r,onResume:c,onStop:d,onPause:u,onDelete:p,onEdit:m}){if(t.status==="not_started")return i?o.jsxs("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:[o.jsx("button",{onClick:m,className:Ft.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),o.jsx("button",{onClick:p,className:Ft.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]}):o.jsxs("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:[o.jsx("button",{"data-testid":"task-header-start",onClick:r,className:Ft.btnPrimary,children:"Start"}),o.jsx("button",{onClick:m,className:Ft.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),o.jsx("button",{onClick:p,className:Ft.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="working")return o.jsxs("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:[o.jsx("button",{onClick:d,className:Ft.btnDanger,"data-testid":"task-action-stop",children:"Stop"}),o.jsx("button",{onClick:u,disabled:!s,className:Ft.btnGhost,"data-testid":"task-action-pause",children:"Pause"})]});if(t.status==="paused")return o.jsxs("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:[o.jsx("button",{onClick:d,className:Ft.btnPrimary,"data-testid":"task-action-stop",children:"Stop"}),o.jsx("button",{onClick:c,className:Ft.btnGhost,"data-testid":"task-action-resume",children:"Resume"}),o.jsx("button",{onClick:p,className:Ft.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="complete")return o.jsx("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:o.jsx("button",{onClick:p,className:Ft.btnDanger,"data-testid":"task-action-delete",children:"Delete"})});if(t.status==="failed")return o.jsxs("div",{className:Ft.actionButtons,"data-testid":"task-action-buttons",children:[o.jsx("button",{onClick:r,className:Ft.btnPrimary,"data-testid":"task-header-start",children:"Retry"}),o.jsx("button",{onClick:p,className:Ft.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}const hL="_workpadSection_y8nj9_1",gL="_workpadLabel_y8nj9_9",vL="_workpadStatus_y8nj9_17",yL="_workpadSummary_y8nj9_23",bL="_workpadExtra_y8nj9_29",Da={workpadSection:hL,workpadLabel:gL,workpadStatus:vL,workpadSummary:yL,workpadExtra:bL};function _L({workpad:t}){if(!t)return;let s;try{const i=JSON.parse(t);if(i==null||typeof i!="object"||Array.isArray(i))return;s=i}catch{return o.jsxs("div",{className:Da.workpadSection,"data-testid":"workpad-panel",children:[o.jsx("div",{className:Da.workpadLabel,children:"Workpad"}),o.jsx("div",{className:Da.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return o.jsxs("div",{className:Da.workpadSection,"data-testid":"workpad-panel",children:[o.jsx("div",{className:Da.workpadLabel,children:"Workpad"}),s.status&&o.jsx("div",{className:Da.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&o.jsx("div",{className:Da.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&o.jsx("div",{className:Da.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const xL="_overviewDashboard_r05qm_1",kL="_overviewHero_r05qm_7",SL="_statusBadge_r05qm_14",TL="_statusPending_r05qm_26",wL="_statusAssigned_r05qm_31",jL="_statusInProgress_r05qm_36",NL="_statusReview_r05qm_41",CL="_statusDone_r05qm_46",EL="_statusFailed_r05qm_51",AL="_statusWaitingInput_r05qm_56",DL="_overviewBranchPill_r05qm_61",RL="_branchLink_r05qm_76",ML="_overviewSection_r05qm_87",IL="_overviewLabel_r05qm_93",OL="_overviewValue_r05qm_100",LL="_overviewMuted_r05qm_105",BL="_overviewMarkdown_r05qm_111",zL="_envRow_r05qm_180",UL="_envDot_r05qm_186",$L="_envDotGreen_r05qm_193",PL="_envDotYellow_r05qm_197",HL="_envDotRed_r05qm_201",VL="_envDotGray_r05qm_205",qL="_depList_r05qm_209",GL="_depItem_r05qm_215",FL="_depBlocked_r05qm_222",ZL="_depDone_r05qm_226",KL="_timeline_r05qm_230",YL="_timelineRow_r05qm_236",JL="_timelineKey_r05qm_243",WL="_timelineValue_r05qm_249",XL="_timelineDelta_r05qm_253",QL="_reviewNotes_r05qm_264",ye={overviewDashboard:xL,overviewHero:kL,statusBadge:SL,statusPending:TL,statusAssigned:wL,statusInProgress:jL,statusReview:NL,statusDone:CL,statusFailed:EL,statusWaitingInput:AL,overviewBranchPill:DL,branchLink:RL,overviewSection:ML,overviewLabel:IL,overviewValue:OL,overviewMuted:LL,overviewMarkdown:BL,envRow:zL,envDot:UL,envDotGreen:$L,envDotYellow:PL,envDotRed:HL,envDotGray:VL,depList:qL,depItem:GL,depBlocked:FL,depDone:ZL,timeline:KL,timelineRow:YL,timelineKey:JL,timelineValue:WL,timelineDelta:XL,reviewNotes:QL};function Lc(t){if(!t)return"—";const s=new Date(t);return isNaN(s.getTime())?"—":s.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function vp(t,s){if(!t||!s)return;const i=new Date(s).getTime()-new Date(t).getTime();if(isNaN(i)||i<0)return;const r=Math.floor(i/6e4),c=Math.floor(i%6e4/1e3);if(r===0)return`${c}s`;const d=Math.floor(r/60),u=r%60;return d===0?`${r}m ${c}s`:`${d}h ${u}m`}function Hb(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 eB({status:t}){const s=za(t),i=ew(t);return o.jsx("span",{className:`${ye.statusBadge} ${ye[i]??ye.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function tB({task:t,tasksById:s,environments:i,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?i.find(k=>k.id===g):void 0,b=r.find(k=>k.id===t.workspaceId),_=i.find(k=>k.id===d),S=t.branch&&(b!=null&&b.repoUrl)?`${b.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return o.jsxs("div",{className:ye.overviewDashboard,"data-testid":"task-overview-panel",children:[o.jsxs("div",{className:ye.overviewHero,children:[o.jsx(eB,{status:t.status}),t.branch&&o.jsx("span",{className:ye.overviewBranchPill,"data-testid":"task-overview-branch",children:S?o.jsxs("a",{href:S,target:"_blank",rel:"noreferrer noopener",className:ye.branchLink,children:["🔗"," ",t.branch]}):o.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&o.jsxs("div",{className:ye.overviewSection,"data-testid":"task-overview-description",children:[o.jsx("div",{className:ye.overviewLabel,children:"Description"}),o.jsx("div",{className:ye.overviewMarkdown,children:o.jsx(pd,{remarkPlugins:[md],children:t.description})})]}),t.workpad&&o.jsx(_L,{workpad:t.workpad}),o.jsxs("div",{className:ye.overviewSection,children:[o.jsx("div",{className:ye.overviewLabel,children:"Environment"}),g&&v?o.jsxs("div",{className:ye.envRow,"data-testid":"task-overview-environment",children:[o.jsx("span",{className:`${ye.envDot} ${Hb(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),o.jsx("span",{className:ye.overviewValue,children:v.displayName})]}):_?o.jsxs("div",{className:ye.envRow,"data-testid":"task-overview-environment",children:[o.jsx("span",{className:`${ye.envDot} ${Hb(_.status)}`,title:_.status,"aria-label":`Status: ${_.status}`,role:"img"}),o.jsx("span",{className:ye.overviewValue,children:_.displayName}),o.jsx("span",{className:ye.overviewMuted,children:"(workspace default)"})]}):o.jsx("div",{className:ye.overviewMuted,children:"Set in workspace settings"})]}),o.jsxs("div",{className:ye.overviewSection,"data-testid":"task-overview-dependencies",children:[o.jsx("div",{className:ye.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?o.jsx("div",{className:ye.overviewMuted,children:"None"}):o.jsx("div",{className:ye.depList,children:t.dependsOn.map(k=>{const w=s.get(k),N=(w==null?void 0:w.status)==="complete";return o.jsxs("div",{className:`${ye.depItem} ${N?ye.depDone:ye.depBlocked}`,children:[o.jsx("span",{children:N?"✓":"○"}),o.jsx("span",{children:(w==null?void 0:w.title)??k})]},k)})})]}),o.jsxs("div",{className:ye.overviewSection,"data-testid":"task-overview-timeline",children:[o.jsx("div",{className:ye.overviewLabel,children:"Timeline"}),o.jsxs("div",{className:ye.timeline,children:[t.createdAt&&o.jsxs("div",{className:ye.timelineRow,children:[o.jsx("span",{className:ye.timelineKey,children:"Created"}),o.jsx("span",{className:ye.timelineValue,children:Lc(t.createdAt)})]}),t.assignedAt&&(()=>{const k=vp(t.createdAt,t.assignedAt);return o.jsxs("div",{className:ye.timelineRow,children:[o.jsx("span",{className:ye.timelineKey,children:"Assigned"}),o.jsx("span",{className:ye.timelineValue,children:Lc(t.assignedAt)}),k!==void 0&&o.jsx("span",{className:ye.timelineDelta,children:k})]})})(),t.startedAt&&(()=>{const k=vp(t.assignedAt??t.createdAt,t.startedAt);return o.jsxs("div",{className:ye.timelineRow,children:[o.jsx("span",{className:ye.timelineKey,children:"Started"}),o.jsx("span",{className:ye.timelineValue,children:Lc(t.startedAt)}),k!==void 0&&o.jsx("span",{className:ye.timelineDelta,children:k})]})})(),t.completedAt&&(()=>{const k=vp(t.startedAt,t.completedAt);return o.jsxs("div",{className:ye.timelineRow,children:[o.jsx("span",{className:ye.timelineKey,children:"Completed"}),o.jsx("span",{className:ye.timelineValue,children:Lc(t.completedAt)}),k!==void 0&&o.jsx("span",{className:ye.timelineDelta,children:k})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&o.jsx("div",{className:ye.overviewMuted,children:"No timing data"})]})]}),u&&u.costUsd>0&&o.jsxs("div",{className:ye.overviewSection,"data-testid":"task-overview-usage",children:[o.jsx("div",{className:ye.overviewLabel,children:"Usage"}),o.jsxs("div",{className:ye.timeline,children:[o.jsxs("div",{className:ye.timelineRow,children:[o.jsx("span",{className:ye.timelineKey,children:"Cost"}),o.jsx("span",{className:ye.timelineValue,children:Do(u.costUsd)}),o.jsxs("span",{className:ye.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),p&&p.costUsd>u.costUsd&&o.jsxs("div",{className:ye.timelineRow,children:[o.jsx("span",{className:ye.timelineKey,children:"Total (incl. subtasks)"}),o.jsx("span",{className:ye.timelineValue,children:Do(p.costUsd)}),o.jsxs("span",{className:ye.timelineDelta,children:[p.sessionCount," session",p.sessionCount!==1?"s":""]})]})]})]}),t.reviewNotes&&o.jsxs("div",{className:ye.overviewSection,"data-testid":"task-overview-review-notes",children:[o.jsx("div",{className:ye.overviewLabel,children:"Review Notes"}),o.jsx("div",{className:ye.reviewNotes,children:t.reviewNotes})]})]})}const nB="_container_legrg_1",sB="_header_legrg_8",aB="_headerTitle_legrg_35",iB="_badge_legrg_44",oB="_headerActions_legrg_54",rB="_body_legrg_61",lB="_formContent_legrg_73",cB="_section_legrg_85",dB="_label_legrg_91",uB="_nameInput_legrg_98",fB="_fieldInput_legrg_131",pB="_adapterSelect_legrg_164",mB="_readOnlyValue_legrg_198",hB="_codespaceSection_legrg_204",gB="_codespaceActions_legrg_210",vB="_creatingHint_legrg_216",yB="_errorHint_legrg_222",bB="_btnPrimary_legrg_235",_B="_btnGhost_legrg_266",ie={container:nB,header:sB,headerTitle:aB,badge:iB,headerActions:oB,body:rB,formContent:lB,section:cB,label:dB,nameInput:uB,fieldInput:fB,adapterSelect:pB,readOnlyValue:mB,codespaceSection:hB,codespaceActions:gB,creatingHint:vB,errorHint:yB,btnPrimary:bB,btnGhost:_B},Yc=1,Jc=65535;function yp(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=Yc&&s<=Jc}function bp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function xB({codespaceName:t,onCodespaceNameChange:s,envName:i,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:m}){const[g,v]=y.useState("pick"),[b,_]=y.useState(""),[S,k]=y.useState("");return g==="create"?o.jsxs("div",{className:ie.codespaceSection,children:[o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Repository"}),o.jsx("input",{type:"text",value:b,onChange:w=>_(w.target.value),placeholder:"owner/repo",className:ie.fieldInput,"data-testid":"env-codespace-repo"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Machine Type"}),o.jsx("input",{type:"text",value:S,onChange:w=>k(w.target.value),placeholder:"Machine type (optional)...",className:ie.fieldInput,"data-testid":"env-codespace-machine"})]}),o.jsxs("div",{className:ie.codespaceActions,children:[o.jsx("button",{onClick:()=>{b.trim()&&(m(b.trim(),S.trim()||void 0),v("pick"),_(""),k(""))},disabled:!b.trim(),className:ie.btnPrimary,children:"Create"}),o.jsx("button",{onClick:()=>{v("pick"),_(""),k("")},className:ie.btnGhost,children:"Cancel"})]})]}):o.jsx("div",{className:ie.codespaceSection,children:o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Codespace"}),!u&&o.jsxs("select",{value:t,onChange:w=>{w.target.value==="__create__"?(v("create"),s("")):(s(w.target.value),w.target.value&&!i.trim()&&r(w.target.value))},disabled:p,className:ie.adapterSelect,"data-testid":"env-codespace-select",children:[o.jsx("option",{value:"",children:"Select a codespace..."}),c.map(w=>o.jsxs("option",{value:w.name,children:[w.name," (",w.repository,") — ",w.state]},w.name)),o.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&o.jsx("span",{className:ie.creatingHint,children:"Creating codespace..."}),u&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:ie.errorHint,children:u}),o.jsx("input",{type:"text",value:t,onChange:w=>s(w.target.value),placeholder:"Or enter codespace name manually...",className:ie.fieldInput,"data-testid":"env-codespace-manual"})]}),d&&!u&&o.jsx("span",{className:ie.errorHint,children:d})]})})}function j1({mode:t,environmentId:s,environments:i,onAddEnvironment:r,onUpdateEnvironment:c,onListCodespaces:d,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v,onShowToast:b}){const _=xt(),S=t==="edit",k=S&&s?i.find(ue=>ue.id===s):void 0,[w,N]=y.useState(""),[T,C]=y.useState("local"),[D,L]=y.useState(""),[E,I]=y.useState(""),[O,z]=y.useState(""),[$,X]=y.useState(""),[te,P]=y.useState(""),[ae,K]=y.useState(""),[re,A]=y.useState(""),[F,oe]=y.useState(null),pe=y.useCallback(()=>{const ue={};if(T==="local"){if(D.trim()&&(ue.host=D.trim()),E.trim()){const _e=Number(E);Number.isInteger(_e)&&(ue.port=_e)}}else if(T==="ssh"){if(ue.host=D.trim(),O.trim()&&(ue.user=O.trim()),E.trim()){const _e=Number(E);Number.isInteger(_e)&&(ue.sshPort=_e)}$.trim()&&(ue.identityFile=$.trim())}else T==="docker"?(te.trim()&&(ue.image=te.trim()),ae.trim()&&(ue.repo=ae.trim())):T==="codespace"&&(ue.codespaceName=re.trim());return ue},[T,D,E,O,$,te,ae,re]),de=()=>!(!w.trim()||T==="ssh"&&!D.trim()||T==="codespace"&&!re.trim()||(T==="local"||T==="ssh")&&!yp(E)),Oe=()=>{de()&&(r(w.trim(),T,pe()),b==null||b("Environment added successfully","success"),_(Ao,{replace:!0}))},ke=()=>{_(s?Si(s):Ao)},Ce=y.useCallback((ue,_e)=>{if(!k||!s)return;const me=bp(k.adapterConfig),Be=_e.trim();Be?me[ue]=Be:delete me[ue],c(s,{adapterConfig:me})},[k,s,c]),ze=y.useCallback((ue,_e)=>{if(!k||!s)return;const me=bp(k.adapterConfig);if(_e.trim()){const Be=Number(_e);Number.isInteger(Be)&&Be>=Yc&&Be<=Jc&&(me[ue]=Be)}else delete me[ue];c(s,{adapterConfig:me})},[k,s,c]);if(S){if(!k)return o.jsxs("div",{className:ie.container,children:[o.jsxs("div",{className:ie.header,children:[o.jsx("div",{className:ie.headerTitle,children:o.jsx("span",{className:ie.badge,children:"edit environment"})}),o.jsx("div",{className:ie.headerActions,children:o.jsx("button",{onClick:ke,className:ie.btnGhost,children:"Back"})})]}),o.jsx("div",{className:ie.body,children:o.jsx("div",{className:ie.formContent,children:o.jsx("span",{className:ie.readOnlyValue,children:"Environment not found"})})})]});const ue=bp(k.adapterConfig);return o.jsxs("div",{className:ie.container,"data-testid":"env-edit-panel",children:[o.jsxs("div",{className:ie.header,children:[o.jsx("div",{className:ie.headerTitle,children:o.jsx("span",{className:ie.badge,children:"edit environment"})}),o.jsx("div",{className:ie.headerActions,children:o.jsx("button",{onClick:ke,className:ie.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),o.jsx("div",{className:ie.body,children:o.jsxs("div",{className:ie.formContent,children:[o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Name"}),o.jsx(ln,{value:k.displayName,onSave:_e=>{s&&c(s,{displayName:_e})},validate:_e=>_e.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:F,onActivate:oe,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Adapter Type"}),o.jsx("span",{className:ie.readOnlyValue,"data-testid":"env-edit-adapter-type",children:k.adapterType})]}),k.adapterType==="local"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Host"}),o.jsx(ln,{value:String(ue.host??""),onSave:_e=>Ce("host",_e),mode:"edit",fieldId:"host",activeFieldId:F,onActivate:oe,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Port"}),o.jsx(ln,{value:String(ue.port??""),onSave:_e=>ze("port",_e),validate:_e=>yp(_e)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:F,onActivate:oe,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),k.adapterType==="ssh"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Host"}),o.jsx(ln,{value:String(ue.host??""),onSave:_e=>Ce("host",_e),validate:_e=>_e.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:F,onActivate:oe,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"User"}),o.jsx(ln,{value:String(ue.user??""),onSave:_e=>Ce("user",_e),mode:"edit",fieldId:"user",activeFieldId:F,onActivate:oe,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"SSH Port"}),o.jsx(ln,{value:String(ue.sshPort??""),onSave:_e=>ze("sshPort",_e),validate:_e=>yp(_e)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:F,onActivate:oe,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Identity File"}),o.jsx(ln,{value:String(ue.identityFile??""),onSave:_e=>Ce("identityFile",_e),mode:"edit",fieldId:"identityFile",activeFieldId:F,onActivate:oe,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),k.adapterType==="docker"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Image"}),o.jsx(ln,{value:String(ue.image??""),onSave:_e=>Ce("image",_e),mode:"edit",fieldId:"image",activeFieldId:F,onActivate:oe,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Repo"}),o.jsx(ln,{value:String(ue.repo??""),onSave:_e=>Ce("repo",_e),mode:"edit",fieldId:"repo",activeFieldId:F,onActivate:oe,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),k.adapterType==="codespace"&&o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,children:"Codespace Name"}),o.jsx(ln,{value:String(ue.codespaceName??""),onSave:_e=>Ce("codespaceName",_e),validate:_e=>_e.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:F,onActivate:oe,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return o.jsxs("div",{className:ie.container,"data-testid":"env-create-panel",children:[o.jsxs("div",{className:ie.header,children:[o.jsx("div",{className:ie.headerTitle,children:o.jsx("span",{className:ie.badge,children:"new environment"})}),o.jsxs("div",{className:ie.headerActions,children:[o.jsx("button",{onClick:Oe,disabled:!de(),className:ie.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),o.jsx("button",{onClick:ke,className:ie.btnGhost,children:"Cancel"})]})]}),o.jsx("div",{className:ie.body,children:o.jsxs("div",{className:ie.formContent,children:[o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,htmlFor:"env-create-name",children:"Name"}),o.jsx("input",{id:"env-create-name",type:"text",value:w,onChange:ue=>N(ue.target.value),placeholder:"Environment name...",autoFocus:!0,className:ie.nameInput,"data-testid":"env-create-name",onKeyDown:ue=>{ue.key==="Enter"&&de()&&Oe()}})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),o.jsxs("select",{id:"env-create-adapter",value:T,onChange:ue=>{C(ue.target.value),ue.target.value==="codespace"&&d()},className:ie.adapterSelect,"data-testid":"env-create-adapter",children:[o.jsx("option",{value:"local",children:"local"}),o.jsx("option",{value:"ssh",children:"ssh"}),o.jsx("option",{value:"docker",children:"docker"}),o.jsx("option",{value:"codespace",children:"codespace"})]})]}),T==="local"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,htmlFor:"env-create-host",children:"Host"}),o.jsx("input",{id:"env-create-host",type:"text",value:D,onChange:ue=>L(ue.target.value),placeholder:"Host (optional)...",className:ie.fieldInput,"data-testid":"env-create-host"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,htmlFor:"env-create-port",children:"Port"}),o.jsx("input",{id:"env-create-port",type:"number",min:Yc,max:Jc,value:E,onChange:ue=>I(ue.target.value),placeholder:"Port (optional)...",className:ie.fieldInput,"data-testid":"env-create-port"})]})]}),T==="ssh"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,htmlFor:"env-create-host",children:"Host"}),o.jsx("input",{id:"env-create-host",type:"text",value:D,onChange:ue=>L(ue.target.value),placeholder:"Host (required)...",className:ie.fieldInput,"data-testid":"env-create-host"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,htmlFor:"env-create-user",children:"User"}),o.jsx("input",{id:"env-create-user",type:"text",value:O,onChange:ue=>z(ue.target.value),placeholder:"User (optional)...",className:ie.fieldInput,"data-testid":"env-create-user"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,htmlFor:"env-create-port",children:"SSH Port"}),o.jsx("input",{id:"env-create-port",type:"number",min:Yc,max:Jc,value:E,onChange:ue=>I(ue.target.value),placeholder:"SSH port (optional)...",className:ie.fieldInput,"data-testid":"env-create-port"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,htmlFor:"env-create-identity",children:"Identity File"}),o.jsx("input",{id:"env-create-identity",type:"text",value:$,onChange:ue=>X(ue.target.value),placeholder:"Identity file (optional)...",className:ie.fieldInput,"data-testid":"env-create-identity"})]})]}),T==="docker"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,htmlFor:"env-create-image",children:"Image"}),o.jsx("input",{id:"env-create-image",type:"text",value:te,onChange:ue=>P(ue.target.value),placeholder:"Image (optional)...",className:ie.fieldInput,"data-testid":"env-create-image"})]}),o.jsxs("div",{className:ie.section,children:[o.jsx("label",{className:ie.label,htmlFor:"env-create-repo",children:"Repo"}),o.jsx("input",{id:"env-create-repo",type:"text",value:ae,onChange:ue=>K(ue.target.value),placeholder:"Repo (optional)...",className:ie.fieldInput,"data-testid":"env-create-repo"})]})]}),T==="codespace"&&o.jsx(xB,{codespaceName:re,onCodespaceNameChange:A,envName:w,onEnvNameChange:N,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v})]})})]})}const kB="_group_1iprv_1",SB="_groupTitle_1iprv_8",TB="_shortcutList_1iprv_17",wB="_shortcutRow_1iprv_23",jB="_keys_1iprv_36",NB="_kbd_1iprv_43",CB="_description_1iprv_60",vi={group:kB,groupTitle:SB,shortcutList:TB,shortcutRow:wB,keys:jB,kbd:NB,description:CB},EB=[{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 AB(){return o.jsxs("section",{className:ge.section,"data-testid":"keyboard-shortcuts-panel",children:[o.jsx("h3",{className:ge.sectionTitle,children:"Keyboard Shortcuts"}),o.jsx("p",{className:ge.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),EB.map(t=>o.jsxs("div",{className:vi.group,children:[o.jsx("h4",{className:vi.groupTitle,children:t.title}),o.jsx("div",{className:vi.shortcutList,children:t.shortcuts.map(s=>o.jsxs("div",{className:vi.shortcutRow,children:[o.jsx("span",{className:vi.keys,children:s.keys.map(i=>o.jsx("kbd",{className:vi.kbd,children:i},i))}),o.jsx("span",{className:vi.description,children:s.description})]},s.description))})]},t.title))]})}const DB=[{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 RB({credentialProviders:t,onUpdateCredentialProviders:s}){const i=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return o.jsxs("section",{className:ge.section,children:[o.jsx("h3",{className:ge.sectionTitle,children:"Credential Providers"}),o.jsx("p",{className:ge.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),o.jsx("div",{className:ge.tokenList,children:DB.map(r=>o.jsxs("div",{className:ge.tokenRow,children:[o.jsx("span",{className:ge.tokenName,children:r.label}),o.jsx("span",{className:ge.tokenTarget,children:r.description}),o.jsx("select",{className:ge.select,value:t[r.key],onChange:c=>i(r.key,c.target.value),children:r.options.map(c=>o.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const MB="_container_10efq_1",IB="_header_10efq_7",OB="_list_10efq_105",LB="_card_10efq_111",BB="_cardHeader_10efq_125",zB="_cardTitle_10efq_135",UB="_defaultBadge_10efq_141",$B="_cardActions_10efq_155",PB="_description_10efq_160",HB="_meta_10efq_166",VB="_empty_10efq_212",qB="_typeBadge_10efq_362",Jn={container:MB,header:IB,list:OB,card:LB,cardHeader:BB,cardTitle:zB,defaultBadge:UB,cardActions:$B,description:PB,meta:HB,empty:VB,typeBadge:qB};function GB({personas:t,appDefaultPersonaId:s,onDeletePersona:i,onSetAppDefaultPersonaId:r,onNavigateToNew:c,onNavigateToPersona:d}){const[u,p]=y.useState(null),m=u?t.find(v=>v.id===u):void 0,g=async v=>{await i(v),p(null)};return o.jsxs("div",{className:Jn.container,children:[o.jsxs("div",{className:Jn.header,children:[o.jsx("h2",{children:"Personas"}),o.jsx(Js,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?o.jsx("p",{className:Jn.empty,children:"No personas yet. Create one to get started."}):o.jsx("div",{className:Jn.list,children:t.map(v=>{const b=s===v.id,_=v.type==="script";return o.jsxs("div",{className:Jn.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:[o.jsxs("div",{className:Jn.cardHeader,children:[o.jsxs("span",{className:Jn.cardTitle,children:[o.jsx("strong",{children:v.name}),o.jsx("span",{className:Jn.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&o.jsx("span",{className:Jn.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),o.jsxs("div",{className:Jn.cardActions,onClick:S=>S.stopPropagation(),children:[!b&&o.jsx(Js,{variant:"ghost",size:"sm",onClick:()=>{r(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),o.jsx(Js,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),o.jsx(Js,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&o.jsx("p",{className:Jn.description,children:v.description}),o.jsxs("div",{className:Jn.meta,children:[v.runtime&&o.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&o.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&o.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),o.jsx(wi,{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 FB="_container_uy08i_1",ZB="_header_uy08i_7",KB="_count_uy08i_13",YB="_presets_uy08i_18",JB="_presetButton_uy08i_24",WB="_filterInput_uy08i_41",XB="_groups_uy08i_53",QB="_group_uy08i_53",e8="_groupHeader_uy08i_68",t8="_groupName_uy08i_77",n8="_groupCount_uy08i_81",s8="_toolList_uy08i_87",a8="_toolItem_uy08i_95",i8="_toolName_uy08i_103",mn={container:FB,header:ZB,count:KB,presets:YB,presetButton:JB,filterInput:WB,groups:XB,group:QB,groupHeader:e8,groupName:t8,groupCount:n8,toolList:s8,toolItem:a8,toolName:i8},o8=(()=>{const t=new Map;for(const s of o_){const i=s==="get_version_status"?"version":s.split("_")[0];t.has(i)||t.set(i,[]),t.get(i).push(s)}return[...t.entries()].sort(([s],[i])=>s.localeCompare(i)).map(([s,i])=>({group:s,tools:i.sort()}))})(),r8=[{name:"default",label:"Default",tools:r_},{name:"worker",label:"Worker",tools:fT},{name:"orchestrator",label:"Orchestrator",tools:pT},{name:"admin",label:"Admin",tools:mT}];function Vb({selectedTools:t,onChange:s,disabled:i}){const[r,c]=y.useState(""),d=y.useMemo(()=>new Set(t),[t]),u=y.useCallback(v=>{if(i)return;const b=new Set(d);b.has(v)?b.delete(v):b.add(v),s([...b].sort())},[d,s,i]),p=y.useCallback((v,b)=>{if(i)return;const _=new Set(d);for(const S of v)b?_.delete(S):_.add(S);s([..._].sort())},[d,s,i]),m=y.useCallback(v=>{i||s([...v].sort())},[s,i]),g=r.toLowerCase();return o.jsxs("div",{className:mn.container,"data-testid":"mcp-tool-selector",children:[o.jsx("div",{className:mn.header,children:o.jsx("span",{className:mn.count,children:t.length===0?`Using default (${r_.length} tools)`:`${t.length} of ${o_.size} tools selected`})}),o.jsxs("div",{className:mn.presets,"data-testid":"mcp-tool-presets",children:[r8.map(v=>o.jsx("button",{type:"button",className:mn.presetButton,disabled:i,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),o.jsx("button",{type:"button",className:mn.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),o.jsx("input",{type:"text",className:mn.filterInput,placeholder:"Filter tools...",value:r,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),o.jsx("div",{className:mn.groups,children:o8.map(({group:v,tools:b})=>{const _=g?b.filter(k=>k.toLowerCase().includes(g)):b;if(_.length===0)return null;const S=_.every(k=>d.has(k));return o.jsxs("div",{className:mn.group,"data-testid":`tool-group-${v}`,children:[o.jsxs("label",{className:mn.groupHeader,children:[o.jsx("input",{type:"checkbox",checked:S,onChange:()=>p(_,S),disabled:i,"data-testid":`group-toggle-${v}`}),o.jsx("span",{className:mn.groupName,children:v}),o.jsxs("span",{className:mn.groupCount,children:["(",_.filter(k=>d.has(k)).length,"/",_.length,")"]})]}),o.jsx("div",{className:mn.toolList,children:_.map(k=>o.jsxs("label",{className:mn.toolItem,children:[o.jsx("input",{type:"checkbox",checked:d.has(k),onChange:()=>u(k),disabled:i,"data-testid":`tool-${k}`}),o.jsx("span",{className:mn.toolName,children:k})]},k))})]},v)})})]})}const l8="_nav_1bhou_1",c8="_tab_1bhou_24",d8="_tabIcon_1bhou_62",u8="_tabActive_1bhou_68",Bc={nav:l8,tab:c8,tabIcon:d8,tabActive:u8},Ks=[{path:"credentials",label:"Credentials",icon:o.jsx(S2,{size:Bt})},{path:"personas",label:"Personas",icon:o.jsx(W2,{size:Bt})},{path:"appearance",label:"Appearance",icon:o.jsx(U2,{size:Bt})},{path:"shortcuts",label:"Shortcuts",icon:o.jsx(w2,{size:Bt})},{path:"about",label:"About",icon:o.jsx(sm,{size:Bt})}];function f8(){var u;const t=Zt(),s=xt(),i=y.useRef(null),r=((u=Ks.find(p=>{const m=`${Eo}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??Ks[0].path,c=y.useCallback(p=>{s(`${Eo}/${p}`)},[s]),d=y.useCallback(p=>{var S,k;const m=(S=i.current)==null?void 0:S.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(w=>w===document.activeElement),v=g>=0?g:Ks.findIndex(w=>w.path===r);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%Ks.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+Ks.length)%Ks.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=Ks.length-1;else return;const _=Ks[b].path;s(`${Eo}/${_}`),(k=m[b])==null||k.focus()},[r,s]);return o.jsx("nav",{className:Bc.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:Ks.map(p=>{const m=p.path===r;return o.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Bc.tab} ${m?Bc.tabActive:""}`,onClick:()=>c(p.path),children:[o.jsx("span",{className:Bc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function p8({tasks:t,taskStatusById:s,sessionStatusByTaskId:i}){const r=new Map;for(const d of t)if(d.parentTaskId){const u=r.get(d.parentTaskId);u?u.push(d):r.set(d.parentTaskId,[d])}const c=new Map(oy.map(d=>[d,[]]));for(const d of t){const u=rl(d.status),p=d.dependsOn.length>0&&d.dependsOn.some(k=>s.get(k)!=="complete"),m=r.get(d.id)??[],g=m.length,v=m.filter(k=>k.status==="complete").length;let b;if(u==="paused"&&i){const k=i.get(d.id);k==="idle"?b="Needs input":k==="completed"&&(b="Ready to complete")}const _={task:d,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:b},S=c.get(u);S?S.push(_):c.get("not_started").push(_)}for(const d of c.values())d.sort((u,p)=>u.task.sortOrder-p.task.sortOrder);return oy.map(d=>{const u=za(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const m8="_boardContainer_1c4y1_1",h8="_column_1c4y1_17",g8="_columnHeader_1c4y1_34",v8="_columnIcon_1c4y1_47",y8="_columnLabel_1c4y1_52",b8="_columnCount_1c4y1_57",_8="_cardList_1c4y1_67",x8="_emptyPlaceholder_1c4y1_76",k8="_card_1c4y1_67",S8="_cardHeader_1c4y1_107",T8="_cardStatusIcon_1c4y1_113",w8="_cardTitle_1c4y1_119",j8="_cardBadges_1c4y1_127",N8="_badge_1c4y1_134",C8="_blockedBadge_1c4y1_146",E8="_childBadge_1c4y1_151",A8="_depBadge_1c4y1_155",D8="_parentBadge_1c4y1_159",R8="_pausedSubBadge_1c4y1_166",M8="_personaBadge_1c4y1_170",I8="_envBadge_1c4y1_174",O8="_emptyCta_1c4y1_178",L8="_ctaButton_1c4y1_188",B8="_ctaDescription_1c4y1_204",nt={boardContainer:m8,column:h8,columnHeader:g8,columnIcon:v8,columnLabel:y8,columnCount:b8,cardList:_8,emptyPlaceholder:x8,card:k8,cardHeader:S8,cardStatusIcon:T8,cardTitle:w8,cardBadges:j8,badge:N8,blockedBadge:C8,childBadge:E8,depBadge:A8,parentBadge:D8,pausedSubBadge:R8,personaBadge:M8,envBadge:I8,emptyCta:O8,ctaButton:L8,ctaDescription:B8};function z8({workspaceId:t,environmentId:s,tasks:i,sessions:r,personas:c,environments:d}){const u=xt(),p=y.useMemo(()=>i.filter(_=>_.workspaceId===t),[i,t]),m=y.useMemo(()=>new Map(i.map(_=>[_.id,_.status])),[i]),g=y.useMemo(()=>new Map(p.map(_=>[_.id,_])),[p]),v=y.useMemo(()=>{const _=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])),w=new Map,N=new Map,T=new Map;for(const C of p)if(C.latestSessionId){const D=_.get(C.latestSessionId);if(D){if(w.set(C.id,D.endReason||D.status),D.personaId){const L=S.get(D.personaId);L&&N.set(C.id,L.name)}if(D.environmentId){const L=k.get(D.environmentId);L&&T.set(C.id,L.displayName)}}}return{sessionStatusByTaskId:w,personaNameByTaskId:N,environmentNameByTaskId:T}},[p,r,c,d]),b=y.useMemo(()=>p8({tasks:p,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,m,v]);return p.length===0?o.jsxs("div",{className:nt.emptyCta,"data-testid":"board-empty-cta",children:[o.jsx("button",{className:nt.ctaButton,onClick:()=>u(Ci(t,void 0,s)),children:"Create Task"}),o.jsx("div",{className:nt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):o.jsx("div",{className:nt.boardContainer,"data-testid":"board-container",children:b.map(_=>o.jsxs("section",{className:nt.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[o.jsxs("div",{className:nt.columnHeader,children:[o.jsx("span",{className:nt.columnIcon,style:{color:_.style.color},children:_.style.icon}),o.jsx("span",{className:nt.columnLabel,children:_.label}),o.jsx("span",{className:nt.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),o.jsx("div",{className:nt.cardList,children:_.tasks.length===0?o.jsx("div",{className:nt.emptyPlaceholder,children:"No tasks"}):o.jsx(ps,{mode:"popLayout",children:_.tasks.map(S=>o.jsx(Rt.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:o.jsx(U8,{boardTask:S,tasksById:g,personaName:v.personaNameByTaskId.get(S.task.id),envName:v.environmentNameByTaskId.get(S.task.id),onClick:()=>u(In(S.task.id,void 0,t,s))})},S.task.id))})})]},_.status))})}function U8({boardTask:t,tasksById:s,personaName:i,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:m,pausedSubBadge:g}=t,v=za(d.status),b=d.parentTaskId?s.get(d.parentTaskId):void 0;return o.jsxs("div",{className:nt.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[o.jsxs("div",{className:nt.cardHeader,children:[o.jsx("span",{className:nt.cardStatusIcon,style:{color:v.color},children:v.icon}),o.jsx("span",{className:nt.cardTitle,children:d.title})]}),o.jsxs("div",{className:nt.cardBadges,children:[b&&o.jsx("span",{className:`${nt.badge} ${nt.parentBadge}`,title:b.title,children:b.title}),p>0&&o.jsxs("span",{className:`${nt.badge} ${nt.childBadge}`,children:[m,"/",p]}),u&&o.jsx("span",{className:`${nt.badge} ${nt.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&o.jsx("span",{className:`${nt.badge} ${nt.depBadge}`,children:"dep"}),g&&o.jsx("span",{className:`${nt.badge} ${nt.pausedSubBadge}`,children:g}),i&&o.jsx("span",{className:`${nt.badge} ${nt.personaBadge}`,children:i}),r&&o.jsx("span",{className:`${nt.badge} ${nt.envBadge}`,children:r})]})]})}const $8="_formContent_ymnez_1",P8="_section_ymnez_13",H8="_label_ymnez_19",V8="_titleInput_ymnez_26",q8="_descriptionTextarea_ymnez_58",G8="_selectField_ymnez_94",F8="_checkboxRow_ymnez_128",Z8="_checkboxLabel_ymnez_141",K8="_fieldError_ymnez_146",yt={formContent:$8,section:P8,label:H8,titleInput:V8,descriptionTextarea:q8,selectField:G8,checkboxRow:F8,checkboxLabel:Z8,fieldError:K8};function Y8(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 J8=100;function W8({values:t,onChange:s,environments:i,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(m,g)=>{s({...t,[m]:g})};return o.jsxs("div",{className:yt.formContent,children:[o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-name",children:"Name"}),o.jsx("input",{id:"ws-name",className:yt.titleInput,type:"text",value:t.name,onChange:m=>p("name",m.target.value),placeholder:"Workspace name",maxLength:J8,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&o.jsx("span",{className:yt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-description",children:"Description"}),o.jsx("textarea",{id:"ws-description",className:yt.descriptionTextarea,value:t.description,onChange:m=>p("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-repo",children:"Repository URL"}),o.jsx("input",{id:"ws-repo",className:yt.titleInput,type:"text",value:t.repoUrl,onChange: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)&&o.jsx("span",{className:yt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-environment",children:"Environment"}),o.jsxs("select",{id:"ws-environment",className:yt.selectField,value:t.environmentId,onChange:m=>p("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[o.jsx("option",{value:"",children:"Select environment…"}),i.map(m=>o.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&o.jsx("span",{className:yt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-persona",children:"Default Persona"}),o.jsxs("select",{id:"ws-persona",className:yt.selectField,value:t.defaultPersonaId,onChange:m=>p("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[o.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>o.jsx("option",{value:m.id,children:m.name},m.id))]})]}),o.jsx("div",{className:yt.section,children:o.jsxs("label",{className:yt.checkboxRow,children:[o.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>p("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),o.jsx("span",{className:yt.checkboxLabel,children:"Enable worktree isolation"})]})}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-workdir",children:"Working Directory"}),o.jsx("input",{id:"ws-workdir",className:yt.titleInput,type:"text",value:t.workingDirectory,onChange:m=>p("workingDirectory",m.target.value),placeholder:"Default (server default)",disabled:d,"data-testid":"workspace-form-workdir"})]})]})}const N1=y.createContext(void 0),X8=4e3;function Q8({children:t}){const[s,i]=y.useState([]),r=y.useRef(0),c=y.useCallback(u=>{i(p=>p.filter(m=>m.id!==u))},[]),d=y.useCallback((u,p="info",m=X8)=>{const g=`toast-${++r.current}`;i(v=>[...v,{id:g,message:u,variant:p,duration:m}])},[]);return o.jsx(N1.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function Tn(){const t=y.useContext(N1);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const Qp="grackle-theme",C1="grackle-prefer-system",E1="(prefers-color-scheme: dark)";let Vr=[],Wc;function _p(){Wc=void 0;for(const t of Vr)t()}function em(){return typeof window>"u"?!1:window.matchMedia(E1).matches}function Yr(){if(typeof localStorage>"u")return Pb;try{const t=localStorage.getItem(Qp);if(t!==null&&T1.has(t))return t}catch{}return Pb}function ud(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(C1)==="true"}catch{return!1}}function tm(t){return jd.find(s=>s.variantLightId===t||s.variantDarkId===t)}function A1(t,s){const i=Xp(t);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?em()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const r=tm(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return em()?r.variantDarkId:r.variantLightId}return t}function ko(t,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=A1(t,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&ko(Yr(),ud());function ez(){return Wc===void 0&&(Wc={themeId:Yr(),systemDark:em(),preferSystem:ud()}),Wc}function tz(t){return Vr=[...Vr,t],()=>{Vr=Vr.filter(s=>s!==t)}}function nz(){const t=y.useSyncExternalStore(tz,ez),{themeId:s,preferSystem:i}=t,r=A1(s,i),c=y.useCallback(u=>{if(T1.has(u)){try{localStorage.setItem(Qp,u)}catch{}ko(u,ud(),!0),_p()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(C1,u?"true":"false")}catch{}if(u){const p=Yr(),m=Xp(p);if(m!=null&&m.hidden){const g=tm(p);if(g)try{localStorage.setItem(Qp,g.id)}catch{}}}ko(Yr(),u,!0),_p()},[]);return y.useEffect(()=>{ko(s,i)},[s,i]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(E1),p=()=>{const m=Yr(),g=ud();if(g){const v=Xp(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&ko(m,g),v!=null&&v.hidden){const b=tm(m);b!=null&&b.variantDarkId&&b.variantLightId&&ko(m,g)}}_p()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:i,setPreferSystem:d}}const D1=y.createContext(void 0);function sz({children:t}){const s=nz();return o.jsx(D1.Provider,{value:s,children:t})}function R1(){const t=y.useContext(D1);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const M1=y.createContext(void 0),I1=y.createContext(void 0);function az({children:t}){const[s,i]=y.useState(void 0),r=y.useCallback(c=>{i(c)},[]);return o.jsx(I1.Provider,{value:r,children:o.jsx(M1.Provider,{value:s,children:t})})}function iz(){return y.useContext(M1)}function oz(){const t=y.useContext(I1);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const Qm=y.createContext(void 0);function ut(){const t=y.useContext(Qm);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function O1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function L1(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function rz(t){return O1(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 lz=new Set(["off","subscription","api_key"]),zc=new Set(["off","on"]);function cz(t){return O1(t)&&lz.has(t.claude)&&zc.has(t.github)&&zc.has(t.copilot)&&zc.has(t.codex)&&zc.has(t.goose)}function B1(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 z1(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 xo=5e3;function dz(t,s){const i=[];let r=t;const c=new Set;for(;r&&s.has(r)&&!c.has(r);){c.add(r);const d=s.get(r);i.unshift(d),r=d.parentTaskId||void 0}return i}const na={label:"Home",url:Ti};function uz(t){return t?[na,{label:"Settings",url:Eo},{label:t,url:void 0}]:[na,{label:"Settings",url:void 0}]}const eh={label:"Environments",url:Ao};function fz(){return[na,{label:"Environments",url:void 0}]}function pz(){return[na,{label:"New Chat",url:void 0}]}function mz(t){return[na,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function hz(t,s,i,r){const c=i.find(u=>u.id===t),d=r.find(u=>u.id===s);return[na,eh,{label:(d==null?void 0:d.displayName)??"Environment",url:Si(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function gz(t,s,i,r,c){const d=dz(t,c),u=c.get(t),p=u==null?void 0:u.workspaceId,m=p?i.find(S=>S.id===p):void 0,g=s??(m==null?void 0:m.environmentId),v=g?r.find(S=>S.id===g):void 0,b=[na];v&&g&&(b.push(eh),b.push({label:v.displayName,url:Si(g)})),m&&g&&b.push({label:m.name,url:ki(m.id,g)});for(let S=0;S<d.length-1;S++)b.push({label:d[S].title,url:In(d[S].id,void 0,p,g)});const _=d[d.length-1];return b.push({label:(_==null?void 0:_.title)??t,url:void 0}),b}const vz={label:"Findings",url:bd};function yz(){return[na,{label:"Findings",url:void 0}]}function U1(t,s,i,r,c){const d=[na];if(s&&i){const u=r.find(m=>m.id===s),p=c.find(m=>m.id===i);d.push(eh),p&&d.push({label:p.displayName,url:Si(i)}),u&&d.push({label:u.name,url:ki(s,i)}),d.push({label:"Findings",url:iN(s,i)})}else d.push(vz);return d.push({label:t,url:void 0}),d}function th(t){const s=[];for(const i of t){const r=s[s.length-1];i.eventType==="text"&&(r==null?void 0:r.eventType)==="text"?s[s.length-1]={...r,content:r.content+i.content}:s.push(i)}return s}function Uc(t){if(typeof t.id=="string")return t.id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const i=t.item;if(i&&typeof i.id=="string")return i.id}function bz(t){if(typeof t.tool_use_id=="string")return t.tool_use_id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const i=t.item;if(i&&typeof i.id=="string")return i.id}function nh(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const i=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const b=s.get(v),_=b?Uc(b):void 0;if(_)try{const S=JSON.parse(v.content);i.set(_,{tool:S.tool,args:S.args})}catch{}}const r=new Set,c=new Set,d=t.map((v,b)=>{if(v.eventType!=="tool_result")return v;const _=s.get(v),S=_?bz(_):void 0;if(!S)return v;const k=i.get(S);if(!k)return v;r.add(S),c.add(b);let w;const N=v.content.trim();if(N.startsWith("{"))try{const T=JSON.parse(N);typeof T.detailedContent=="string"&&(w=T.detailedContent)}catch{}return{...v,toolUseCtx:{...k,detailedResult:w}}}),u=[];for(let v=0;v<d.length;v++){if(d[v].eventType!=="tool_use")continue;const b=s.get(d[v]),_=b?Uc(b):void 0;_&&r.has(_)||u.push(v)}const p=[];for(let v=0;v<d.length;v++)d[v].eventType!=="tool_result"||c.has(v)||p.push(v);let m=0;for(const v of u){for(;m<p.length&&p[m]<v;)m++;if(m>=p.length)break;const b=p[m];if(b!==v+1)continue;const _=d[v],S=d[b];let k;try{const w=JSON.parse(_.content);k={tool:w.tool,args:w.args}}catch{}if(k){let w;const N=S.content.trim();if(N.startsWith("{"))try{const D=JSON.parse(N);typeof D.detailedContent=="string"&&(w=D.detailedContent)}catch{}d[b]={...S,toolUseCtx:{...k,detailedResult:w}},c.add(b);const T=s.get(_),C=T?Uc(T):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(_,{...T??{},__seqId:`__seq_${v}`})),m++}}const g=d.filter(v=>{if(v.eventType!=="tool_use")return!0;const b=s.get(v);if(!b)return!0;const _=Uc(b);if(_&&r.has(_))return!1;const S=b.__seqId;return!(S&&r.has(S))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let b=!1;for(let _=v+1;_<g.length;_++)if(g[_].eventType!=="tool_use"){b=!0;break}b&&(g[v]={...g[v],settled:!0})}return g}function _z(t,s,i){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=$1(s),d=s.filter(m=>nm(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||nm(m,c)).length,p=i.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function $1(t){const s=new Map;for(const i of t)s.set(i.id,i.status);return s}function nm(t,s){return t.dependsOn.some(i=>s.get(i)!=="complete")}function xz(t,s){var u;const i=new Map;for(const p of s)i.set(p.id,p);const r=$1(t),c=[];for(const p of t){const m=p.workspaceId?((u=i.get(p.workspaceId))==null?void 0:u.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:m}):nm(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 kz(t,s){const i=new Map;for(const r of s)i.set(r.id,r);return t.filter(r=>r.status==="running"||r.status==="idle"||r.status==="waiting").map(r=>{var c;return{session:r,environmentName:((c=i.get(r.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function Sz(t,s,i){const r=new Map;for(const c of s){if(!c.workspaceId)continue;let d=r.get(c.workspaceId);d||(d={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},r.set(c.workspaceId,d)),d.totalTasks+=1,c.status==="complete"?d.completedTasks+=1:c.status==="working"?d.workingTasks+=1:c.status==="failed"&&(d.failedTasks+=1)}return t.map(c=>{const d=r.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:d.totalTasks,completedTasks:d.completedTasks,workingTasks:d.workingTasks,failedTasks:d.failedTasks}})}const ks=[{id:"kn-auth-flow",label:"Authentication Flow",kind:"knowledge",category:"concept",content:"The application uses JWT Bearer tokens for stateless authentication. Access tokens expire after 24h. Refresh tokens are stored in the database and rotated on use. The auth middleware verifies tokens and attaches the decoded payload to req.user.",tags:["auth","jwt","security"],workspaceId:"proj-alpha",createdAt:"2026-02-25T10:30:00Z",updatedAt:"2026-02-27T08:15:00Z",val:5},{id:"kn-db-schema",label:"Database Schema",kind:"knowledge",category:"concept",content:"PostgreSQL database with tables: users, sessions, refresh_tokens, audit_log. Uses UUID primary keys, TIMESTAMPTZ for all timestamps, and JSONB for flexible metadata columns. Connection pooling via pg-pool with per-tenant isolation.",tags:["database","postgres","schema"],workspaceId:"proj-alpha",createdAt:"2026-02-23T11:00:00Z",updatedAt:"2026-02-26T22:45:00Z",val:4},{id:"kn-error-handling",label:"Error Response Pattern",kind:"knowledge",category:"concept",content:"All API errors follow the shape { error: string, code: string, details?: unknown }. HTTP status codes map to: 400 (validation), 401 (unauthenticated), 403 (forbidden), 404 (not found), 409 (conflict), 429 (rate limited), 500 (internal).",tags:["api","errors","patterns"],workspaceId:"proj-alpha",createdAt:"2026-02-27T08:17:00Z",updatedAt:"2026-02-27T08:17:00Z",val:3},{id:"kn-rate-limiting",label:"Rate Limiting Strategy",kind:"knowledge",category:"concept",content:"Token-bucket algorithm with in-memory state per client IP. Default rate: 100 requests/minute, burst: 20. Returns 429 with Retry-After header. Redis adapter available for multi-instance deployments.",tags:["api","rate-limiting","infrastructure"],workspaceId:"proj-alpha",createdAt:"2026-02-27T09:00:00Z",updatedAt:"2026-02-27T09:00:00Z",val:2},{id:"kn-etl-pipeline",label:"ETL Pipeline Architecture",kind:"knowledge",category:"concept",content:"Data pipelines follow an Extract-Transform-Load pattern with pluggable stages. Each stage reads from a source (Postgres, S3, API), transforms via configurable mappers, and loads into a target (Parquet, BigQuery, S3). Incremental loads use high-watermark tracking.",tags:["etl","pipeline","architecture"],workspaceId:"proj-beta",createdAt:"2026-02-26T08:00:00Z",updatedAt:"2026-02-27T09:05:00Z",val:4},{id:"kn-parquet-format",label:"Parquet Output Format",kind:"knowledge",category:"concept",content:"Parquet files are written with row-group buffering (configurable batch size, default 10000 rows). Supports Snappy, ZSTD, and GZIP compression. Schema is derived from the internal column type system using Arrow type mapping.",tags:["parquet","data-format","compression"],workspaceId:"proj-beta",createdAt:"2026-02-26T08:05:00Z",updatedAt:"2026-02-26T08:15:00Z",val:3},{id:"kn-jwt-over-session",label:"JWT over Session Auth",kind:"knowledge",category:"decision",content:"Chose JWT tokens over server-side sessions for stateless auth. Rationale: (1) no session store needed, (2) works across microservices without shared state, (3) supports mobile clients natively. Trade-off: tokens can't be revoked instantly (mitigated by short expiry + refresh rotation).",tags:["auth","decision","jwt"],workspaceId:"proj-alpha",createdAt:"2026-02-25T10:00:00Z",updatedAt:"2026-02-25T10:00:00Z",val:3},{id:"kn-pg-pool-decision",label:"pg-pool over Knex",kind:"knowledge",category:"decision",content:"Chose pg-pool over Knex for connection pooling. pg-pool gives direct control over idle timeout, max connections, and health check queries. Knex wraps pg-pool and adds query-building overhead we don't need since we write raw SQL with parameterized queries.",tags:["database","decision","postgres"],workspaceId:"proj-alpha",createdAt:"2026-02-23T11:30:00Z",updatedAt:"2026-02-23T11:30:00Z",val:2},{id:"kn-watermark-decision",label:"Local Watermark Storage",kind:"knowledge",category:"decision",content:"Currently using local SQLite for watermark storage. This works for single-worker pipelines but needs to move to a shared store (Redis or Postgres) for production multi-worker scenarios. Tracked as a follow-up task.",tags:["pipeline","decision","watermarks"],workspaceId:"proj-beta",createdAt:"2026-02-27T09:05:00Z",updatedAt:"2026-02-27T09:05:00Z",val:2},{id:"kn-jwt-middleware",label:"JWT Verify Middleware",kind:"knowledge",category:"snippet",content:`\`\`\`typescript
275
+ export function verifyToken(req: Request, res: Response, next: NextFunction): void {
276
+ const header = req.headers.authorization;
277
+ if (!header?.startsWith("Bearer ")) {
278
+ res.status(401).json({ error: "Missing token" });
279
+ return;
280
+ }
281
+ const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
282
+ req.user = decoded;
283
+ next();
284
+ }
285
+ \`\`\``,tags:["auth","jwt","middleware","typescript"],workspaceId:"proj-alpha",createdAt:"2026-02-27T08:15:14Z",updatedAt:"2026-02-27T08:15:14Z",val:2},{id:"kn-audit-schema",label:"Audit Log Schema",kind:"knowledge",category:"snippet",content:`\`\`\`sql
286
+ CREATE TABLE audit_log (
287
+ id BIGSERIAL PRIMARY KEY,
288
+ user_id UUID REFERENCES users(id),
289
+ action TEXT NOT NULL,
290
+ entity_type TEXT NOT NULL,
291
+ entity_id TEXT NOT NULL,
292
+ old_value JSONB,
293
+ new_value JSONB,
294
+ ip_address INET,
295
+ created_at TIMESTAMPTZ DEFAULT now()
296
+ );
297
+ \`\`\``,tags:["database","audit","schema","sql"],workspaceId:"proj-alpha",createdAt:"2026-02-26T22:45:15Z",updatedAt:"2026-02-26T22:45:15Z",val:2},{id:"kn-n1-query",label:"N+1 Query in User List",kind:"knowledge",category:"insight",content:"GET /api/users performs a separate query for each user's role metadata, resulting in N+1 queries. For 500 users this adds ~2 seconds of latency. Solution: use a JOIN or batch lookup to fetch all role data in a single query.",tags:["performance","database","n+1"],workspaceId:"proj-alpha",createdAt:"2026-02-22T09:30:00Z",updatedAt:"2026-02-22T09:30:00Z",val:2},{id:"kn-session-race",label:"Session Cleanup Race Condition",kind:"knowledge",category:"insight",content:"When two concurrent requests hit /api/logout, the second call throws a 500 because the session row has already been deleted. Fix: use DELETE ... RETURNING or add IF EXISTS guard to make the operation idempotent.",tags:["bug","concurrency","sessions"],workspaceId:"proj-alpha",createdAt:"2026-02-26T22:50:00Z",updatedAt:"2026-02-26T22:50:00Z",val:2},{id:"kn-ref-task-001",label:"JWT Auth Task",kind:"reference",sourceType:"task",sourceId:"task-001",content:"Implement JWT authentication across all protected routes, replacing session-based auth.",workspaceId:"proj-alpha",createdAt:"2026-02-25T10:00:00Z",updatedAt:"2026-02-27T08:15:00Z",val:3},{id:"kn-ref-task-006",label:"Parquet Export Task",kind:"reference",sourceType:"task",sourceId:"task-006",content:"Add Parquet export support for pipeline outputs, enabling downstream Spark consumption.",workspaceId:"proj-beta",createdAt:"2026-02-26T08:00:00Z",updatedAt:"2026-02-27T09:00:00Z",val:3},{id:"kn-ref-sess-001",label:"Auth Middleware Session",kind:"reference",sourceType:"session",sourceId:"sess-001",content:"Active session implementing JWT auth middleware, rewrote auth.ts, login.ts, and test suite.",workspaceId:"proj-alpha",createdAt:"2026-02-27T08:15:00Z",updatedAt:"2026-02-27T08:15:42Z",val:2}],Ra=[{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"}],Tz=new Map(ks.map(t=>[t.id,t]));function xp(t){const s=Tz.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const qb={"kn-auth-flow":{node:xp("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:xp("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:xp("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"}]}},wz=[{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}],jz=[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z",endedAt:"2026-02-26T15:12:00Z",error:"Context window exceeded before completing implementation",inputTokens:84200,outputTokens:12750,costUsd:.41},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Refactor the authentication middleware to use JWT tokens",startedAt:"2026-02-27T08:15:00Z",inputTokens:42600,outputTokens:8100,costUsd:.22},{id:"sess-002",environmentId:"env-docker-01",runtime:"copilot",status:"stopped",endReason:"completed",prompt:"Write unit tests for the user registration endpoint",startedAt:"2026-02-27T07:30:00Z",endedAt:"2026-02-27T07:33:00Z",inputTokens:31400,outputTokens:9800,costUsd:.18},{id:"sess-003",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Migrate database schema to add audit_log table",startedAt:"2026-02-26T22:45:00Z",endedAt:"2026-02-26T23:10:00Z",inputTokens:56300,outputTokens:14200,costUsd:.31},{id:"sess-004",environmentId:"env-docker-01",runtime:"codex",status:"running",prompt:"Implement rate limiting for the public API",startedAt:"2026-02-27T09:00:00Z",inputTokens:18900,outputTokens:4500,costUsd:.1},{id:"sess-005",environmentId:"env-cs-01",runtime:"claude-code",status:"suspended",prompt:"Refactor database connection pooling for multi-tenant isolation",startedAt:"2026-02-27T06:00:00Z",inputTokens:67800,outputTokens:19300,costUsd:.38}],Nz=[{sessionId:"sess-001-prev",eventType:"status",timestamp:"2026-02-26T14:00:01Z",content:"running"},{sessionId:"sess-001-prev",eventType:"system",timestamp:"2026-02-26T14:00:02Z",content:`You are a senior backend engineer. Focus on security best practices and thorough testing.
298
+ Project: acme/alpha — Node.js + Express REST API
299
+ Task: Implement auth middleware using JWT tokens`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:00:05Z",content:"I'll start by reading the current authentication middleware to understand what needs to change."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:00:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/middleware/auth.ts"}}),raw:JSON.stringify({id:"tu-prev-001",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:00:07Z",content:`import session from "express-session";
300
+ import type { Request, Response, NextFunction } from "express";
301
+
302
+ export function requireAuth(req: Request, res: Response, next: NextFunction): void {
303
+ if (!req.session?.userId) {
304
+ res.status(401).json({ error: "Not authenticated" });
305
+ return;
306
+ }
307
+ next();
308
+ }`,raw:JSON.stringify({tool_use_id:"tu-prev-001"})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:00:10Z",content:"The current auth uses express-session with server-side session storage. Let me find all files that depend on this pattern."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:00:11Z",content:JSON.stringify({tool:"Grep",args:{pattern:"req\\.session",path:"src/"}}),raw:JSON.stringify({id:"tu-prev-002",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:00:12Z",content:`src/middleware/auth.ts:4: if (!req.session?.userId) {
309
+ src/routes/login.ts:18: req.session.userId = user.id;
310
+ src/routes/login.ts:19: req.session.role = user.role;
311
+ src/routes/protected.ts:7: const userId = req.session.userId;`,raw:JSON.stringify({tool_use_id:"tu-prev-002"})},{sessionId:"sess-001-prev",eventType:"usage",timestamp:"2026-02-26T14:30:00Z",content:JSON.stringify({input_tokens:42100,output_tokens:6350,cost_usd:.21})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:30:02Z",content:"Found 3 files using session-based auth. Now let me read the login route and the protected route to understand the full flow before making changes."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:30:03Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/login.ts"}}),raw:JSON.stringify({id:"tu-prev-003",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:30:04Z",content:`import { Router } from "express";
312
+ import bcrypt from "bcrypt";
313
+ import { db } from "../db.js";
314
+
315
+ const router = Router();
316
+
317
+ router.post("/login", async (req, res) => {
318
+ const { email, password } = req.body;
319
+ const user = await db.users.findByEmail(email);
320
+ if (!user || !await bcrypt.compare(password, user.passwordHash)) {
321
+ return res.status(401).json({ error: "Invalid credentials" });
322
+ }
323
+ req.session.userId = user.id;
324
+ req.session.role = user.role;
325
+ res.json({ ok: true });
326
+ });
327
+
328
+ export default router;`,raw:JSON.stringify({tool_use_id:"tu-prev-003"})},{sessionId:"sess-001-prev",eventType:"error",timestamp:"2026-02-26T15:12:00Z",content:"Context window exceeded before completing implementation"},{sessionId:"sess-001-prev",eventType:"status",timestamp:"2026-02-26T15:12:01Z",content:"interrupted"},{sessionId:"sess-001",eventType:"status",timestamp:"2026-02-27T08:15:01Z",content:"running"},{sessionId:"sess-001",eventType:"system",timestamp:"2026-02-27T08:15:02Z",content:`You are a senior backend engineer. Focus on security best practices and thorough testing.
329
+ Project: acme/alpha — Node.js + Express REST API
330
+ Task: Implement auth middleware using JWT tokens
331
+
332
+ Note: A previous session attempted this task but was interrupted. Pick up where it left off.`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:04Z",content:"I'll pick up the JWT auth migration. The previous session identified 3 files that need updating. Let me verify the current state and start implementing."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:04.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Install jsonwebtoken package",activeForm:"Installing jsonwebtoken",status:"pending"},{content:"Rewrite auth middleware for JWT",activeForm:"Rewriting auth middleware",status:"pending"},{content:"Update login route to issue tokens",activeForm:"Updating login route",status:"pending"},{content:"Update protected routes",activeForm:"Updating protected routes",status:"pending"},{content:"Fix and update tests",activeForm:"Fixing tests",status:"pending"},{content:"Run full test suite",activeForm:"Running tests",status:"pending"}]}})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:05Z",content:JSON.stringify({tool:"Grep",args:{pattern:"express-session|req\\.session",path:"src/",output_mode:"files_with_matches"}}),raw:JSON.stringify({id:"tu-001-01",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:06Z",content:`src/middleware/auth.ts
333
+ src/routes/login.ts
334
+ src/routes/protected.ts`,raw:JSON.stringify({tool_use_id:"tu-001-01"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:08Z",content:"Good, same 3 files. Let me install the JWT library first, then rewrite the middleware."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:09Z",content:JSON.stringify({tool:"Bash",args:{command:"npm install jsonwebtoken && npm install -D @types/jsonwebtoken"}}),raw:JSON.stringify({id:"tu-001-02",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:11Z",content:`added 12 packages in 3.2s
335
+
336
+ added 1 package in 0.8s`,raw:JSON.stringify({tool_use_id:"tu-001-02"})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:11.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Install jsonwebtoken package",activeForm:"Installing jsonwebtoken",status:"completed"},{content:"Rewrite auth middleware for JWT",activeForm:"Rewriting auth middleware",status:"in_progress"},{content:"Update login route to issue tokens",activeForm:"Updating login route",status:"pending"},{content:"Update protected routes",activeForm:"Updating protected routes",status:"pending"},{content:"Fix and update tests",activeForm:"Fixing tests",status:"pending"},{content:"Run full test suite",activeForm:"Running tests",status:"pending"}]}})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:12Z",content:"Now I'll rewrite the auth middleware to use JWT verification instead of session checks."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:13Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/auth.ts",content:`import jwt from "jsonwebtoken";
337
+ import type { Request, Response, NextFunction } from "express";
338
+
339
+ const JWT_SECRET = process.env.JWT_SECRET || "change-me";
340
+
341
+ export interface JwtPayload {
342
+ userId: string;
343
+ role: string;
344
+ iat: number;
345
+ exp: number;
346
+ }
347
+
348
+ export function verifyToken(req: Request, res: Response, next: NextFunction): void {
349
+ const header = req.headers.authorization;
350
+ if (!header?.startsWith("Bearer ")) {
351
+ res.status(401).json({ error: "Missing or malformed token" });
352
+ return;
353
+ }
354
+ try {
355
+ const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
356
+ req.user = decoded;
357
+ next();
358
+ } catch (err) {
359
+ if (err instanceof jwt.TokenExpiredError) {
360
+ res.status(401).json({ error: "Token expired" });
361
+ } else {
362
+ res.status(403).json({ error: "Invalid token" });
363
+ }
364
+ }
365
+ }
366
+ `}}),raw:JSON.stringify({id:"tu-001-03",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:14Z",content:"File written: src/middleware/auth.ts (32 lines)",raw:JSON.stringify({tool_use_id:"tu-001-03"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:16Z",content:`Now I need to update the login route to issue JWT tokens instead of setting session data.
367
+
368
+ The new login flow will:
369
+ 1. Validate credentials (unchanged)
370
+ 2. Generate a JWT with \`userId\` and \`role\` claims
371
+ 3. Return the token in the response body
372
+ 4. Include a refresh token for long-lived sessions`},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:17Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/routes/login.ts",content:`import { Router } from "express";
373
+ import bcrypt from "bcrypt";
374
+ import jwt from "jsonwebtoken";
375
+ import crypto from "node:crypto";
376
+ import { db } from "../db.js";
377
+
378
+ const JWT_SECRET = process.env.JWT_SECRET || "change-me";
379
+ const ACCESS_TOKEN_EXPIRY = "24h";
380
+ const REFRESH_TOKEN_BYTES = 48;
381
+
382
+ const router = Router();
383
+
384
+ router.post("/login", async (req, res) => {
385
+ const { email, password } = req.body;
386
+ const user = await db.users.findByEmail(email);
387
+ if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
388
+ return res.status(401).json({ error: "Invalid credentials" });
389
+ }
390
+
391
+ const accessToken = jwt.sign(
392
+ { userId: user.id, role: user.role },
393
+ JWT_SECRET,
394
+ { expiresIn: ACCESS_TOKEN_EXPIRY },
395
+ );
396
+
397
+ const refreshToken = crypto.randomBytes(REFRESH_TOKEN_BYTES).toString("hex");
398
+ await db.refreshTokens.create({ userId: user.id, token: refreshToken });
399
+
400
+ res.json({ accessToken, refreshToken, expiresIn: ACCESS_TOKEN_EXPIRY });
401
+ });
402
+
403
+ export default router;
404
+ `}}),raw:JSON.stringify({id:"tu-001-04",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:18Z",content:"File written: src/routes/login.ts (33 lines)",raw:JSON.stringify({tool_use_id:"tu-001-04"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:20Z",content:"Let me update the protected route to use the new `req.user` shape from the JWT payload."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:21Z",content:JSON.stringify({tool:"Edit",args:{file_path:"src/routes/protected.ts",old_string:"const userId = req.session.userId;",new_string:"const { userId } = req.user as JwtPayload;"}}),raw:JSON.stringify({id:"tu-001-05",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:22Z",content:"Updated src/routes/protected.ts",raw:JSON.stringify({tool_use_id:"tu-001-05"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:24Z",content:"Now let me run the existing tests to make sure nothing is broken, then I'll add new JWT-specific tests."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:25Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test"}}),raw:JSON.stringify({id:"tu-001-06",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:30Z",content:` PASS src/routes/__tests__/login.test.ts
405
+ PASS src/routes/__tests__/protected.test.ts
406
+ FAIL src/middleware/__tests__/auth.test.ts
407
+ x should reject missing session (12ms)
408
+ x should allow valid session (8ms)
409
+
410
+ 2 failed, 12 passed, 14 total
411
+
412
+ Test Suites: 1 failed, 2 passed, 3 total`,raw:JSON.stringify({tool_use_id:"tu-001-06",is_error:!0})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:32Z",content:`Two tests failed because they still test the old session-based auth. I need to rewrite those tests for JWT.
413
+
414
+ Let me update the auth middleware tests:`},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:33Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/__tests__/auth.test.ts",content:`import { describe, it, expect } from "vitest";
415
+ import jwt from "jsonwebtoken";
416
+ import { verifyToken } from "../auth.js";
417
+ import { createMockReqRes } from "../../test-utils/mock-express.js";
418
+
419
+ const SECRET = "test-secret";
420
+ process.env.JWT_SECRET = SECRET;
421
+
422
+ describe("verifyToken", () => {
423
+ it("should reject requests without Authorization header", () => {
424
+ const { req, res, next } = createMockReqRes();
425
+ verifyToken(req, res, next);
426
+ expect(res.status).toHaveBeenCalledWith(401);
427
+ });
428
+
429
+ it("should reject expired tokens", () => {
430
+ const token = jwt.sign({ userId: "u1", role: "user" }, SECRET, { expiresIn: "-1h" });
431
+ const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
432
+ verifyToken(req, res, next);
433
+ expect(res.status).toHaveBeenCalledWith(401);
434
+ });
435
+
436
+ it("should accept valid tokens and attach user to request", () => {
437
+ const token = jwt.sign({ userId: "u1", role: "admin" }, SECRET, { expiresIn: "1h" });
438
+ const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
439
+ verifyToken(req, res, next);
440
+ expect(next).toHaveBeenCalled();
441
+ expect(req.user).toMatchObject({ userId: "u1", role: "admin" });
442
+ });
443
+ });
444
+ `}}),raw:JSON.stringify({id:"tu-001-07",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:34Z",content:"File written: src/middleware/__tests__/auth.test.ts (32 lines)",raw:JSON.stringify({tool_use_id:"tu-001-07"})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:35Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test"}}),raw:JSON.stringify({id:"tu-001-08",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:40Z",content:` PASS src/routes/__tests__/login.test.ts
445
+ PASS src/routes/__tests__/protected.test.ts
446
+ PASS src/middleware/__tests__/auth.test.ts
447
+
448
+ Test Suites: 3 passed, 3 total
449
+ Tests: 14 passed, 14 total`,raw:JSON.stringify({tool_use_id:"tu-001-08"})},{sessionId:"sess-001",eventType:"usage",timestamp:"2026-02-27T08:15:41Z",content:JSON.stringify({input_tokens:42600,output_tokens:8100,cost_usd:.22})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:42Z",content:`All 14 tests pass. Here's a summary of the changes:
450
+
451
+ ### Changes made
452
+
453
+ | File | Action |
454
+ |------|--------|
455
+ | \`src/middleware/auth.ts\` | Rewrote to verify JWT Bearer tokens |
456
+ | \`src/routes/login.ts\` | Now issues JWT access + refresh tokens |
457
+ | \`src/routes/protected.ts\` | Updated to read \`req.user\` from JWT payload |
458
+ | \`src/middleware/__tests__/auth.test.ts\` | Updated tests for JWT verification |
459
+
460
+ ### Key decisions
461
+ - **Access token expiry**: 24 hours (configurable via \`JWT_SECRET\` env var)
462
+ - **Refresh tokens**: 48-byte random hex, stored in DB
463
+ - **Error handling**: Distinguishes expired tokens (401) from invalid tokens (403)`},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:30:01Z",content:"running"},{sessionId:"sess-002",eventType:"system",timestamp:"2026-02-27T07:30:02Z",content:`You are a QA engineer. Write comprehensive tests covering happy paths, edge cases, error scenarios, and security.
464
+ Project: acme/alpha — Node.js + Express REST API
465
+ Task: Write unit tests for the user registration endpoint`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:30:04Z",content:"I'll write thorough tests for `POST /api/register`. Let me first read the registration endpoint to understand its behavior."},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:30:05Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/register.ts"}}),raw:JSON.stringify({id:"tu-002-01",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:30:06Z",content:`import { Router } from "express";
466
+ import bcrypt from "bcrypt";
467
+ import { db } from "../db.js";
468
+ import { validateEmail, validatePassword } from "../utils/validators.js";
469
+
470
+ const SALT_ROUNDS = 12;
471
+ const router = Router();
472
+
473
+ router.post("/register", async (req, res) => {
474
+ const { name, email, password } = req.body;
475
+
476
+ if (!name || !email || !password) {
477
+ return res.status(400).json({ error: "Missing required fields" });
478
+ }
479
+ if (!validateEmail(email)) {
480
+ return res.status(400).json({ error: "Invalid email format" });
481
+ }
482
+ if (!validatePassword(password)) {
483
+ return res.status(400).json({ error: "Password too weak" });
484
+ }
485
+
486
+ const existing = await db.users.findByEmail(email);
487
+ if (existing) {
488
+ return res.status(409).json({ error: "Email already registered" });
489
+ }
490
+
491
+ const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
492
+ const user = await db.users.create({ name, email, passwordHash });
493
+ res.status(201).json({ id: user.id, name: user.name, email: user.email });
494
+ });
495
+
496
+ export default router;`,raw:JSON.stringify({tool_use_id:"tu-002-01"})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:30:10Z",content:`Good. The endpoint validates input, checks for duplicates, hashes the password, and creates the user. I'll write tests covering:
497
+
498
+ 1. **Happy path** - valid registration
499
+ 2. **Missing fields** - each required field missing
500
+ 3. **Invalid email** - malformed email format
501
+ 4. **Weak password** - password validation failure
502
+ 5. **Duplicate email** - conflict with existing user
503
+ 6. **SQL injection** - malicious email input
504
+ 7. **XSS payload** - HTML in the name field
505
+ 8. **Response shape** - correct status codes and body structure`},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:30:12Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/routes/__tests__/register.test.ts",content:"// [test content - 8 test cases as described above]"}}),raw:JSON.stringify({id:"tu-002-02",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:30:13Z",content:"File written: src/routes/__tests__/register.test.ts (142 lines)",raw:JSON.stringify({tool_use_id:"tu-002-02"})},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:31:00Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --testPathPattern=register"}}),raw:JSON.stringify({id:"tu-002-03",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:31:30Z",content:` PASS src/routes/__tests__/register.test.ts
506
+ POST /api/register
507
+ ✓ should register a valid user (28ms)
508
+ ✓ should reject missing name (4ms)
509
+ ✓ should reject missing email (3ms)
510
+ ✓ should reject missing password (3ms)
511
+ ✓ should reject invalid email format (5ms)
512
+ ✓ should reject weak password (4ms)
513
+ ✓ should reject duplicate email (12ms)
514
+ ✓ should sanitize HTML in name field (6ms)
515
+
516
+ Tests: 8 passed, 8 total`,raw:JSON.stringify({tool_use_id:"tu-002-03"})},{sessionId:"sess-002",eventType:"usage",timestamp:"2026-02-27T07:32:00Z",content:JSON.stringify({input_tokens:31400,output_tokens:9800,cost_usd:.18})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:32:30Z",content:"All 8 test cases pass. Created `src/routes/__tests__/register.test.ts` with comprehensive coverage for the registration endpoint including input validation, duplicate detection, and security edge cases."},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:33:00Z",content:"completed"},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T22:45:01Z",content:"running"},{sessionId:"sess-003",eventType:"system",timestamp:"2026-02-26T22:45:02Z",content:`You are a database engineer. Focus on safe migrations, zero-downtime deployments, and data integrity.
517
+ Project: acme/alpha — Node.js + Express + PostgreSQL
518
+ Task: Add audit_log table and migrate schema`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:45:05Z",content:"I need to add an `audit_log` table for tracking all write operations. Let me review the current schema first."},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:45:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"migrations/001_initial.sql"}}),raw:JSON.stringify({id:"tu-003-01",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:45:07Z",content:`CREATE TABLE users (
519
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
520
+ name TEXT NOT NULL,
521
+ email TEXT UNIQUE NOT NULL,
522
+ password_hash TEXT NOT NULL,
523
+ role TEXT DEFAULT 'user',
524
+ created_at TIMESTAMPTZ DEFAULT now(),
525
+ updated_at TIMESTAMPTZ DEFAULT now()
526
+ );
527
+
528
+ CREATE TABLE sessions (
529
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
530
+ user_id UUID REFERENCES users(id),
531
+ expires_at TIMESTAMPTZ NOT NULL,
532
+ created_at TIMESTAMPTZ DEFAULT now()
533
+ );`,raw:JSON.stringify({tool_use_id:"tu-003-01"})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:45:12Z",content:"I see the schema. I'll create a migration that:\n1. Adds a `last_login_at` column to `users`\n2. Adds an index on `sessions.expires_at` for efficient cleanup queries\n3. Creates the `audit_log` table\n\nLet me write the migration file:"},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:45:14Z",content:JSON.stringify({tool:"Write",args:{file_path:"migrations/002_audit_log.sql",content:`-- Migration: 002_audit_log
534
+ -- Add audit logging and user activity tracking
535
+
536
+ BEGIN;
537
+
538
+ -- 1. Add last_login_at to users
539
+ ALTER TABLE users ADD COLUMN last_login_at TIMESTAMPTZ;
540
+
541
+ -- 2. Index for session cleanup queries
542
+ CREATE INDEX CONCURRENTLY idx_sessions_expires_at ON sessions (expires_at);
543
+
544
+ -- 3. Audit log table
545
+ CREATE TABLE audit_log (
546
+ id BIGSERIAL PRIMARY KEY,
547
+ user_id UUID REFERENCES users(id),
548
+ action TEXT NOT NULL,
549
+ entity_type TEXT NOT NULL,
550
+ entity_id TEXT NOT NULL,
551
+ old_value JSONB,
552
+ new_value JSONB,
553
+ ip_address INET,
554
+ created_at TIMESTAMPTZ DEFAULT now()
555
+ );
556
+
557
+ CREATE INDEX idx_audit_log_user ON audit_log (user_id);
558
+ CREATE INDEX idx_audit_log_entity ON audit_log (entity_type, entity_id);
559
+ CREATE INDEX idx_audit_log_created ON audit_log (created_at);
560
+
561
+ COMMIT;
562
+ `}}),raw:JSON.stringify({id:"tu-003-02",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:45:15Z",content:"File written: migrations/002_audit_log.sql (29 lines)",raw:JSON.stringify({tool_use_id:"tu-003-02"})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:00Z",content:"Now I need to implement the audit middleware that logs write operations. This will intercept POST, PUT, PATCH, and DELETE requests."},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:46:02Z",content:JSON.stringify({tool:"Bash",args:{command:"npm run migrate -- --dry-run"}}),raw:JSON.stringify({id:"tu-003-03",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:46:10Z",content:`Dry run: would apply 002_audit_log.sql
563
+ - ALTER TABLE users ADD COLUMN last_login_at
564
+ - CREATE INDEX CONCURRENTLY idx_sessions_expires_at
565
+ - CREATE TABLE audit_log
566
+ - 3 indexes on audit_log
567
+
568
+ WARNING: CREATE INDEX CONCURRENTLY cannot run inside a transaction block.
569
+ Please split this into a separate migration step.`,raw:JSON.stringify({tool_use_id:"tu-003-03",is_error:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:15Z",content:"Good catch from the dry run! `CREATE INDEX CONCURRENTLY` can't run inside a transaction. I need to split the migration into two files: one for the transactional DDL and another for the concurrent index creation."},{sessionId:"sess-003",eventType:"usage",timestamp:"2026-02-26T23:00:00Z",content:JSON.stringify({input_tokens:56300,output_tokens:14200,cost_usd:.31})},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T23:10:00Z",content:"interrupted"},{sessionId:"sess-004",eventType:"status",timestamp:"2026-02-27T09:00:01Z",content:"running"},{sessionId:"sess-004",eventType:"system",timestamp:"2026-02-27T09:00:02Z",content:`You are a backend engineer specializing in API infrastructure.
570
+ Project: acme/data-pipeline — ETL pipelines for analytics
571
+ Task: Implement rate limiting for the public API using a token-bucket algorithm`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:05Z",content:"I'll implement rate limiting using a token-bucket algorithm. Let me first survey the existing API infrastructure to find the right integration point."},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:05.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Survey middleware structure",activeForm:"Surveying middleware",status:"in_progress"},{content:"Implement token-bucket algorithm",activeForm:"Implementing token bucket",status:"pending"},{content:"Add rate limit middleware to app",activeForm:"Adding middleware",status:"pending"},{content:"Write tests for rate limiting",activeForm:"Writing tests",status:"pending"},{content:"Add Redis adapter for multi-instance",activeForm:"Adding Redis adapter",status:"pending"}]}})},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:06Z",content:JSON.stringify({tool:"Glob",args:{pattern:"src/middleware/**/*.ts"}}),raw:JSON.stringify({id:"tu-004-01",type:"tool_use"})},{sessionId:"sess-004",eventType:"tool_result",timestamp:"2026-02-27T09:00:07Z",content:`src/middleware/cors.ts
572
+ src/middleware/error-handler.ts
573
+ src/middleware/logger.ts
574
+ src/middleware/request-id.ts`,raw:JSON.stringify({tool_use_id:"tu-004-01"})},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:09Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Survey middleware structure",activeForm:"Surveying middleware",status:"completed"},{content:"Implement token-bucket algorithm",activeForm:"Implementing token bucket",status:"in_progress"},{content:"Add rate limit middleware to app",activeForm:"Adding middleware",status:"pending"},{content:"Write tests for rate limiting",activeForm:"Writing tests",status:"pending"},{content:"Add Redis adapter for multi-instance",activeForm:"Adding Redis adapter",status:"pending"}]}})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:10Z",content:`Good middleware structure already in place. I'll add a \`rate-limiter.ts\` module that:
575
+
576
+ - Uses an **in-memory token bucket** per client IP
577
+ - Supports configurable rate (requests/second) and burst size
578
+ - Returns \`429 Too Many Requests\` with \`Retry-After\` header
579
+ - Has a Redis adapter option for multi-instance deployments
580
+
581
+ Let me implement it:`},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:12Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/rate-limiter.ts",content:"// Token bucket rate limiter implementation"}}),raw:JSON.stringify({id:"tu-004-02",type:"tool_use"})},{sessionId:"sess-004",eventType:"tool_result",timestamp:"2026-02-27T09:00:13Z",content:"File written: src/middleware/rate-limiter.ts (87 lines)",raw:JSON.stringify({tool_use_id:"tu-004-02"})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:18Z",content:"Now I need to wire the rate limiter into the Express middleware stack. It should go after the request-ID middleware but before route handlers."},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:00:01Z",content:"running"},{sessionId:"sess-005",eventType:"system",timestamp:"2026-02-27T06:00:02Z",content:`You are a database specialist. Focus on connection management, performance, and multi-tenant isolation.
582
+ Project: acme/alpha — Node.js + Express + PostgreSQL
583
+ Task: Refactor database connection pooling for multi-tenant isolation`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:05Z",content:"I'll refactor the DB layer to support per-tenant connection pools. This is needed because the current single-pool design means one slow tenant can exhaust connections for everyone."},{sessionId:"sess-005",eventType:"tool_use",timestamp:"2026-02-27T06:00:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/db/pool.ts"}}),raw:JSON.stringify({id:"tu-005-01",type:"tool_use"})},{sessionId:"sess-005",eventType:"tool_result",timestamp:"2026-02-27T06:00:07Z",content:`import pg from "pg";
584
+
585
+ const pool = new pg.Pool({
586
+ connectionString: process.env.DATABASE_URL,
587
+ max: 20,
588
+ idleTimeoutMillis: 30000,
589
+ });
590
+
591
+ export { pool };`,raw:JSON.stringify({tool_use_id:"tu-005-01"})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:12Z",content:`The current pool is a single shared instance with \`max: 20\`. For multi-tenant isolation, I need:
592
+
593
+ 1. **A \`PoolManager\` class** that creates and caches per-tenant pools
594
+ 2. **Configurable limits** per tenant (max connections, idle timeout)
595
+ 3. **Health checks** with automatic pool eviction for unhealthy connections
596
+ 4. **Graceful shutdown** that drains all pools`},{sessionId:"sess-005",eventType:"tool_use",timestamp:"2026-02-27T06:00:14Z",content:JSON.stringify({tool:"Grep",args:{pattern:"import.*pool|from.*pool",path:"src/",output_mode:"content"}}),raw:JSON.stringify({id:"tu-005-02",type:"tool_use"})},{sessionId:"sess-005",eventType:"tool_result",timestamp:"2026-02-27T06:00:15Z",content:`src/db/index.ts:1:import { pool } from "./pool.js";
597
+ src/routes/users.ts:2:import { pool } from "../db/pool.js";
598
+ src/routes/register.ts:3:import { pool } from "../db/pool.js";
599
+ src/routes/admin.ts:4:import { pool } from "../db/pool.js";
600
+ src/services/billing.ts:2:import { pool } from "../db/pool.js";
601
+ src/services/analytics.ts:1:import { pool } from "../db/pool.js";`,raw:JSON.stringify({tool_use_id:"tu-005-02"})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:20Z",content:`Six files import the pool directly. I'll need to:
602
+ 1. Create a new \`PoolManager\` abstraction
603
+ 2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
604
+ 3. Add middleware to extract tenant ID from the request
605
+
606
+ This is a significant refactor. Let me start with the PoolManager class.`},{sessionId:"sess-005",eventType:"usage",timestamp:"2026-02-27T06:30:00Z",content:JSON.stringify({input_tokens:67800,output_tokens:19300,cost_usd:.38})},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:30:01Z",content:"suspended"}],Cz=[{id:"proj-alpha",name:"Workspace Alpha",description:"Core platform API and authentication services",repoUrl:"https://github.com/acme/alpha",environmentId:"env-local-01",status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",createdAt:"2026-01-15T10:00:00Z",updatedAt:"2026-01-15T10:00:00Z"},{id:"proj-beta",name:"Data Pipeline",description:"ETL pipelines for analytics and reporting",repoUrl:"https://github.com/acme/data-pipeline",environmentId:"env-docker-01",status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",createdAt:"2026-02-01T14:30:00Z",updatedAt:"2026-02-01T14:30:00Z"},{id:"proj-gamma",name:"Mobile App",description:"React Native cross-platform mobile application",repoUrl:"",environmentId:"env-local-01",status:"archived",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",createdAt:"2025-11-20T09:00:00Z",updatedAt:"2025-11-20T09:00:00Z"}],Ez=[{id:"task-001",workspaceId:"proj-alpha",title:"Implement JWT authentication",description:"Replace session-based auth with JWT tokens across all protected routes",status:"working",branch:"feat/jwt-auth",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-001a","task-001b","task-001c"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Design and implement JWT-based authentication with access/refresh tokens, replacing session-based auth.",extra:{approach:"Replace express-session with JWT Bearer tokens. Access tokens expire in 24h, refresh tokens stored in DB.",files_changed:["src/middleware/auth.ts","src/routes/login.ts","src/routes/protected.ts"],decisions:["Chose jsonwebtoken over jose for consistency with existing codebase","24h access token expiry — long enough for dev sessions, short enough for security","Refresh tokens are 48-byte random hex stored in DB with user association"],blockers:"Need to verify token rotation strategy with security team before merging"}})},{id:"task-001a",workspaceId:"proj-alpha",title:"Design token schema",description:"Define JWT payload structure, expiry, and refresh token strategy",status:"complete",branch:"feat/jwt-auth/design-token-schema",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:10:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-001b",workspaceId:"proj-alpha",title:"Implement auth middleware",description:"Build Express middleware that verifies JWT Bearer tokens",status:"working",branch:"feat/jwt-auth/implement-auth-middleware",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:15:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-001c",workspaceId:"proj-alpha",title:"Write auth integration tests",description:"End-to-end tests for login flow, token refresh, and protected route access",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-25T10:20:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-002",workspaceId:"proj-alpha",title:"Add rate limiting",description:"Implement token-bucket rate limiting for public API endpoints",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:05:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-003",workspaceId:"proj-alpha",title:"Set up OpenAPI documentation",description:"Generate Swagger docs from route decorators and serve at /api/docs",status:"paused",branch:"feat/openapi-docs",latestSessionId:"sess-002",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-24T16:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-004",workspaceId:"proj-alpha",title:"Database connection pooling",description:"Switch from single connection to a connection pool with health checks",status:"complete",branch:"feat/db-pool",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-23T11:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-005",workspaceId:"proj-alpha",title:"Fix N+1 query in user list",description:"Use a JOIN instead of per-row lookups in GET /api/users",status:"not_started",branch:"fix/user-list-n1",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:5,createdAt:"2026-02-22T09:30:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006",workspaceId:"proj-beta",title:"Add Parquet export support",description:"Allow pipeline outputs to be written as Parquet files for Spark consumption",status:"working",branch:"feat/parquet-export",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-006a","task-006b","task-006c","task-006d"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Plan for adding Parquet export support, including compression options and performance benchmarks.",extra:{approach:"Use apache-arrow npm package for Parquet write support. Map internal column types to Arrow type system.",compression:{supported:["snappy","zstd","gzip"],default:"snappy"},benchmarks:{"1M rows snappy":"2.3s","1M rows zstd":"3.1s","1M rows gzip":"4.8s"}}})},{id:"task-006a",workspaceId:"proj-beta",title:"Define Parquet schema mapping",description:"Map internal column types to Arrow/Parquet type system",status:"complete",branch:"feat/parquet-export/define-parquet-schema-mapping",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:05:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006b",workspaceId:"proj-beta",title:"Implement row-group writer",description:"Write buffered row groups with configurable batch size",status:"complete",branch:"feat/parquet-export/implement-row-group-writer",latestSessionId:"",dependsOn:["task-006a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:10:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006c",workspaceId:"proj-beta",title:"Add compression options",description:"Support Snappy, ZSTD, and GZIP compression for Parquet output",status:"working",branch:"feat/parquet-export/add-compression-options",latestSessionId:"sess-004",dependsOn:["task-006b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T08:15:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006d",workspaceId:"proj-beta",title:"Write Parquet integration tests",description:"Round-trip tests: write Parquet, read back with pyarrow, verify data integrity",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-006c"],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-26T08:20:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-007",workspaceId:"proj-beta",title:"Implement incremental loads",description:"Track watermarks so pipelines only process new/changed rows",status:"working",branch:"feat/incremental",latestSessionId:"sess-004",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:30:00Z",parentTaskId:"",depth:0,childTaskIds:["task-007a","task-007b"],canDecompose:!0,defaultPersonaId:"",workpad:""},{id:"task-007a",workspaceId:"proj-beta",title:"Design watermark storage",description:"Define schema for per-pipeline high-watermark tracking",status:"complete",branch:"feat/incremental/design-watermark-storage",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:35:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-007b",workspaceId:"proj-beta",title:"Implement change detection query",description:"Generate WHERE clauses from watermarks to fetch only changed rows",status:"failed",branch:"feat/incremental/implement-change-detection-query",latestSessionId:"",dependsOn:["task-007a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:40:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-008",workspaceId:"proj-beta",title:"Add pipeline monitoring dashboard",description:"Real-time metrics for pipeline throughput, latency, and error rates",status:"paused",branch:"feat/monitoring",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T09:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""}],$c=[{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"}],Az=[{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:""}],Dz=[{id:"persona-arch",name:"Software Architect",description:"Designs system architecture, defines interfaces, and decomposes large features into implementable tasks.",systemPrompt:"You are a senior software architect. Focus on clean interfaces, separation of concerns, and scalable patterns. When decomposing work, create concrete subtasks with clear acceptance criteria.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:50,mcpServers:"[]",createdAt:"2026-02-20T10:00:00Z",updatedAt:"2026-02-20T10:00:00Z",type:"agent",script:"",allowedMcpTools:["task_create","task_update","task_list","finding_post","finding_list","knowledge_search","knowledge_create_node","session_spawn"]},{id:"persona-fe",name:"Frontend Engineer",description:"React specialist — builds UI components, writes CSS, implements routing, and creates Playwright tests.",systemPrompt:"You are a frontend engineer specializing in React, TypeScript, and modern CSS. Follow component composition patterns, use semantic HTML, and write accessible markup.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:100,mcpServers:"[]",createdAt:"2026-02-20T10:05:00Z",updatedAt:"2026-02-20T10:05:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-reviewer",name:"Code Reviewer",description:"Reviews diffs for correctness, security, and style. Posts findings for issues discovered.",systemPrompt:"You are a meticulous code reviewer. Check for security vulnerabilities, performance issues, and style consistency. Post findings for anything noteworthy.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:30,mcpServers:"[]",createdAt:"2026-02-20T10:10:00Z",updatedAt:"2026-02-20T10:10:00Z",type:"agent",script:"",allowedMcpTools:["finding_post","finding_list","knowledge_search"]},{id:"persona-tester",name:"QA Engineer",description:"Writes comprehensive test suites — unit tests, integration tests, and E2E Playwright specs.",systemPrompt:"You are a QA engineer focused on test coverage. Write tests that cover happy paths, edge cases, error scenarios, and accessibility. Use Playwright for E2E tests.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:80,mcpServers:"[]",createdAt:"2026-02-20T10:15:00Z",updatedAt:"2026-02-20T10:15:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-lint",name:"Lint & Format",description:"Scripted persona — runs ESLint and Prettier on changed files, auto-fixes violations, and posts a findings summary.",systemPrompt:"",toolConfig:"{}",runtime:"genaiscript",model:"",maxTurns:1,mcpServers:"[]",createdAt:"2026-02-21T09:00:00Z",updatedAt:"2026-02-21T09:00:00Z",type:"script",script:`const files = env.files.filter(f => /\\.(ts|tsx|js)$/.test(f.filename));
607
+ for (const f of files) {
608
+ const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);
609
+ if (eslintResult.exitCode !== 0) {
610
+ env.findings.push({ category: "lint", title: \`Lint issues in \${f.filename}\`, content: eslintResult.stderr });
611
+ }
612
+ const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);
613
+ if (prettierResult.exitCode !== 0) {
614
+ env.findings.push({ category: "format", title: \`Prettier issues in \${f.filename}\`, content: prettierResult.stderr });
615
+ }
616
+ }
617
+ env.findings.push({ category: "summary", title: "Lint & format pass complete", content: \`Ran ESLint and Prettier on \${files.length} files\` });`,allowedMcpTools:[]}],Rz={"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 De(t){return new Date(Date.now()+t).toISOString()}const Gb=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:De(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:De(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:De(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:De(1600),content:`src/routes/users.ts
618
+ src/routes/auth.ts
619
+ src/routes/billing.ts
620
+ src/routes/admin.ts
621
+ src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:De(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
622
+
623
+ \`\`\`typescript
624
+ const router = Router();
625
+ router.use(authenticate);
626
+ router.use(validateBody);
627
+
628
+ router.get("/", listUsers);
629
+ router.post("/", createUser);
630
+ router.get("/:id", getUser);
631
+ router.put("/:id", updateUser);
632
+ router.delete("/:id", deleteUser);
633
+ \`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:De(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:De(4e3),content:` PASS src/routes/__tests__/users.test.ts
634
+ PASS src/routes/__tests__/auth.test.ts
635
+ PASS src/routes/__tests__/billing.test.ts
636
+
637
+ Test Suites: 3 passed, 3 total
638
+ Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:De(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_usd:.15})}},{delayMs:5e3,event:{eventType:"text",timestamp:De(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:De(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:De(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:De(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:De(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:De(1800),content:`CREATE TABLE users (
639
+ id UUID PRIMARY KEY,
640
+ name TEXT NOT NULL,
641
+ email TEXT UNIQUE NOT NULL,
642
+ created_at TIMESTAMPTZ DEFAULT now()
643
+ );
644
+
645
+ CREATE TABLE sessions (
646
+ id UUID PRIMARY KEY,
647
+ user_id UUID REFERENCES users(id),
648
+ expires_at TIMESTAMPTZ NOT NULL
649
+ );`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:De(2600),content:`I found the tables to modify:
650
+ - **users**: add column \`last_login_at\`
651
+ - **sessions**: add index on \`expires_at\`
652
+ - **audit_log**: new table
653
+
654
+ This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
655
+
656
+ Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:De(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:De(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:De(1700),content:`Applying 002_add_last_login.sql... done
657
+ Applying 003_sessions_index.sql... done
658
+ Applying 004_audit_log.sql... done
659
+
660
+ 3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:De(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:De(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:De(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:De(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:De(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:De(1800),content:`import { StripeClient } from "./stripe-client.js";
661
+ import type { Invoice, LineItem } from "../types/billing.js";
662
+
663
+ export class BillingService {
664
+ constructor(private stripe: StripeClient) {}
665
+
666
+ async calculateMonthlyTotal(userId: string): Promise<number> {
667
+ const invoices = await this.stripe.listInvoices(userId);
668
+ return invoices.reduce((sum, inv) => sum + inv.total, 0);
669
+ }
670
+ }`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:De(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:De(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:De(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:De(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:De(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:De(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:De(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:De(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:De(1800),content:`import jwt from "jsonwebtoken";
671
+ import type { Request, Response, NextFunction } from "express";
672
+
673
+ const JWT_SECRET = process.env.JWT_SECRET || "change-me";
674
+
675
+ export function verifyToken(req: Request, res: Response, next: NextFunction): void {
676
+ const header = req.headers.authorization;
677
+ if (!header?.startsWith("Bearer ")) {
678
+ res.status(401).json({ error: "Missing token" });
679
+ return;
680
+ }
681
+ try {
682
+ const decoded = jwt.verify(header.slice(7), JWT_SECRET);
683
+ if (decoded.exp > Date.now() / 1000) {
684
+ res.status(403).json({ error: "Token expired" });
685
+ return;
686
+ }
687
+ req.user = decoded;
688
+ next();
689
+ } catch {
690
+ res.status(403).json({ error: "Invalid token" });
691
+ }
692
+ }`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:De(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:De(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:De(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:De(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:De(5800),content:`[exit 0] > jest --grep auth
693
+
694
+ PASS src/auth.test.ts
695
+ ✓ validates JWT token (12ms)
696
+ ✓ rejects expired token (3ms)
697
+ ✓ handles missing header (1ms)
698
+
699
+ Tests: 3 passed, 3 total
700
+ Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:De(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:De(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
701
+ src/utils/token-refresh.ts:28: const remaining = decoded.exp - Date.now() / 1000;`,raw:JSON.stringify({tool_use_id:"tool-mock-004",is_error:!1})}},{delayMs:7800,event:{eventType:"text",timestamp:De(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:De(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_usd:.12})}},{delayMs:8800,event:{eventType:"status",timestamp:De(8800),content:"completed"}}]}],xs={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1},Fb=400;function Mz({children:t}){const[s,i]=y.useState(wz),[r,c]=y.useState(jz),[d,u]=y.useState(Nz),[p,m]=y.useState(void 0),[g,v]=y.useState(Cz),[b,_]=y.useState(Ez),[S,k]=y.useState($c),[w,N]=y.useState(void 0),T=!1,[C,D]=y.useState(Az),[L,E]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[I,O]=y.useState(Dz),[z]=y.useState(Rz),[$,X]=y.useState(""),[te,P]=y.useState(ks),[ae,K]=y.useState(Ra),[re,A]=y.useState(void 0),[F,oe]=y.useState(void 0),[pe,de]=y.useState(""),Oe=y.useRef(void 0),ke=y.useRef(0),Ce=y.useRef(0),ze=y.useRef(new Set),ue=y.useRef(new Map),_e=y.useRef(b);_e.current=b;const me=y.useRef(new Map),Be=y.useRef(new Map),mt=y.useCallback(H=>(ke.current+=1,`mock-${H}-${String(ke.current).padStart(3,"0")}`),[]),vn=y.useCallback(()=>{const H=Gb[Ce.current%Gb.length];return Ce.current+=1,H},[]),se=y.useCallback((H,ne,le)=>{const fe=setTimeout(()=>{var he;ze.current.delete(fe),le&&((he=ue.current.get(le))==null||he.delete(fe)),H()},ne);ze.current.add(fe),le&&(ue.current.has(le)||ue.current.set(le,new Set),ue.current.get(le).add(fe))},[]),qe=y.useCallback(H=>{const ne=ue.current.get(H);ne&&(ne.forEach(le=>{clearTimeout(le),ze.current.delete(le)}),ue.current.delete(H))},[]),Nt=y.useCallback((H,ne,le)=>{c(fe=>fe.map(he=>he.id===H?{...he,status:ne,...le!==void 0?{endReason:le}:{}}:he))},[]),Y=y.useCallback(H=>{u(ne=>[...ne,H])},[]),wt=y.useCallback((H,ne,le)=>{ne.forEach((fe,he)=>{se(()=>{const Pe={sessionId:H,...fe.event,timestamp:new Date().toISOString()};if(Y(Pe),fe.event.eventType==="status"){const Se=B1(fe.event.content),Me=z1(fe.event.content);Nt(H,Se,Me)}he===ne.length-1&&le&&le()},fe.delayMs,H)})},[se,Y,Nt]),Vt=y.useCallback(async(H,ne,le,fe)=>{console.log("[MockGrackle] spawn",{environmentId:H,prompt:ne,runtime:fe});const he=mt("sess"),Pe={id:he,environmentId:H,runtime:fe||"claude-code",status:"running",prompt:ne,startedAt:new Date().toISOString()};c(Me=>[...Me,Pe]),m(he);const Se=vn();if(console.log(`[MockGrackle] Playing scenario: ${Se.label}`),Se.pauseForInput){const Me=Se.pauseAfterStep??Se.steps.length-1,Ye=Se.steps.slice(0,Me+1),ct=Ye.length>0?Ye[Ye.length-1].delayMs:0;wt(he,Ye),se(()=>{Nt(he,"idle"),Y({sessionId:he,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ct+Fb,he),Se.resumeSteps&&me.current.set(he,Se.resumeSteps)}else wt(he,Se.steps)},[mt,vn,wt,se,Nt,Y]),es=y.useCallback(async H=>{console.log("[MockGrackle] kill",H),qe(H),me.current.delete(H),Nt(H,"stopped","killed"),Y({sessionId:H,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),_(ne=>ne.map(le=>le.latestSessionId===H&&le.status==="working"?{...le,status:"not_started"}:le))},[qe,Nt,Y]),ft=y.useCallback(async H=>{console.log("[MockGrackle] stopGraceful",H),qe(H),me.current.delete(H),Nt(H,"stopped","terminated"),Y({sessionId:H,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),_(ne=>ne.map(le=>le.latestSessionId===H&&le.status==="working"?{...le,status:"not_started"}:le))},[qe,Nt,Y]),hs=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),aa=y.useCallback(async H=>{console.log("[MockGrackle] loadSessionEvents",H)},[]),ts=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),u([])},[]),Ga=y.useCallback(async(H,ne,le,fe,he,Pe,Se,Me,Ye)=>{console.log("[MockGrackle] createWorkspace",{name:H,description:ne});const ct={id:mt("proj"),name:H,description:ne||"",repoUrl:le||"",environmentId:fe||"",status:"active",workingDirectory:Se||"",useWorktrees:Pe??!0,defaultPersonaId:he||"",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Je=>[...Je,ct]),Me&&Me()},[mt]),ia=y.useCallback(async H=>{console.log("[MockGrackle] archiveWorkspace",H),v(ne=>ne.map(le=>le.id===H?{...le,status:"archived"}:le))},[]),Kt=y.useCallback(async H=>{console.log("[MockGrackle] loadTasks",H)},[]),Ai=y.useCallback(async(H,ne,le,fe,he,Pe,Se,Me,Ye)=>{console.log("[MockGrackle] createTask",{workspaceId:H,title:ne,parentTaskId:he}),_(ct=>{const qt=ct.filter(ht=>ht.workspaceId===H).reduce((ht,Wt)=>Math.max(ht,Wt.sortOrder),0),tn=he?ct.find(ht=>ht.id===he):void 0;if(he&&!tn)return console.warn("[MockGrackle] Parent task not found:",he),ct;if(tn&&!tn.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",he),ct;const Mt=tn?tn.depth+1:0,fn={id:mt("task"),workspaceId:H,title:ne,description:le||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:fe||[],reviewNotes:void 0,sortOrder:qt+1,createdAt:new Date().toISOString(),parentTaskId:he||"",depth:Mt,childTaskIds:[],canDecompose:Se??!he,defaultPersonaId:Pe||"",workpad:""};return[...ct,fn]}),Me&&Me()},[mt]),oa=y.useCallback(async(H,ne,le,fe)=>{var ct;console.log("[MockGrackle] startTask",{taskId:H});const he=_e.current.find(Je=>Je.id===H),Pe=(he==null?void 0:he.title)??"",Se=mt("sess"),Me={id:Se,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:Pe||H,startedAt:new Date().toISOString()};c(Je=>[...Je,Me]),_(Je=>Je.map(qt=>qt.id===H?{...qt,status:"working",latestSessionId:Se,branch:`mock/${H.slice(0,8)}`}:qt));const Ye=vn();if(console.log(`[MockGrackle] Playing task scenario: ${Ye.label}`),Ye.pauseForInput){const Je=Ye.pauseAfterStep??Ye.steps.length-1,qt=Ye.steps.slice(0,Je+1),tn=qt.length>0?qt[qt.length-1].delayMs:0;if(wt(Se,qt),se(()=>{Nt(Se,"idle"),Y({sessionId:Se,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},tn+Fb,Se),Ye.resumeSteps){const Mt=[...Ye.resumeSteps];me.current.set(Se,Mt);const fn=Mt.reduce((ht,Wt)=>Math.max(ht,Wt.delayMs),0);Be.current.set(Se,{taskId:H,delayAfterResume:fn+200})}}else{const Je=Ye.steps.length>0?Ye.steps[Ye.steps.length-1].delayMs:0;wt(Se,Ye.steps);const qt=(ct=Ye.steps[Ye.steps.length-1])==null?void 0:ct.event.content;se(()=>{qt==="completed"?_(tn=>tn.map(Mt=>Mt.id===H&&Mt.status==="working"?{...Mt,status:"paused"}:Mt)):qt==="failed"&&_(tn=>tn.map(Mt=>Mt.id===H&&Mt.status==="working"?{...Mt,status:"failed"}:Mt))},Je+100,Se)}},[mt,vn,wt,se,Nt,Y]),Fa=y.useCallback(async(H,ne)=>{console.log("[MockGrackle] sendInput",{sessionId:H,text:ne}),Y({sessionId:H,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ne}`}),Nt(H,"running"),Y({sessionId:H,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const le=me.current.get(H);if(le)me.current.delete(H),wt(H,le);else{const he=[{delayMs:500,event:{eventType:"output",timestamp:new Date().toISOString(),content:"I received your input, continuing..."}},{delayMs:1500,event:{eventType:"status",timestamp:new Date().toISOString(),content:"completed"}}];wt(H,he)}const fe=Be.current.get(H);fe&&(Be.current.delete(H),se(()=>{_(he=>he.map(Pe=>Pe.id===fe.taskId&&Pe.status==="working"?{...Pe,status:"paused"}:Pe))},fe.delayAfterResume,H))},[Y,Nt,wt,se]),ns=y.useCallback(async H=>{console.log("[MockGrackle] completeTask",H),_(ne=>ne.map(le=>le.id===H?{...le,status:"complete"}:le))},[]),Di=y.useCallback(async H=>{console.log("[MockGrackle] resumeTask",H)},[]),Bn=y.useCallback(async(H,ne,le,fe,he)=>{console.log("[MockGrackle] updateTask",{taskId:H,title:ne}),_(Pe=>Pe.map(Se=>Se.id===H?{...Se,title:ne.trim()||Se.title,description:le,dependsOn:fe,...he!==void 0?{defaultPersonaId:he}:{}}:Se))},[]),Ae=y.useCallback(async H=>{console.log("[MockGrackle] deleteTask",H),_(ne=>ne.filter(le=>le.id!==H))},[]),Ke=y.useCallback(async H=>{console.log("[MockGrackle] loadFindings",H),k($c.filter(ne=>ne.workspaceId===H))},[]),Yt=y.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),k([...$c])},[]),kt=y.useCallback(async H=>{console.log("[MockGrackle] loadFinding",H);const ne=$c.find(le=>le.id===H);N(ne)},[]),un=y.useCallback(async(H,ne,le,fe,he)=>{console.log("[MockGrackle] postFinding",{workspaceId:H,title:ne});const Pe={id:mt("find"),workspaceId:H,taskId:"",sessionId:"",category:fe||"general",title:ne,content:le,tags:he||[],createdAt:new Date().toISOString()};k(Se=>[...Se,Pe])},[mt]),Jt=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),Ri=y.useCallback(async(H,ne,le)=>{console.log("[MockGrackle] addEnvironment",{displayName:H,adapterType:ne,adapterConfig:le})},[]),Mi=y.useCallback(async(H,ne)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:H,...ne}),i(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)}:{}}))},[]),Ii=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),Za=y.useCallback(async(H,ne,le,fe,he)=>{console.log("[MockGrackle] setToken",{name:H,tokenType:le}),D(Pe=>[...Pe.filter(Me=>Me.name!==H),{name:H,tokenType:le,envVar:fe,filePath:he,expiresAt:""}])},[]),Ka=y.useCallback(async H=>{console.log("[MockGrackle] deleteToken",H),D(ne=>ne.filter(le=>le.name!==H))},[]),Ya=y.useCallback(async H=>{console.log("[MockGrackle] updateCredentialProviders",H),E(H)},[]);y.useEffect(()=>()=>{ze.current.forEach(clearTimeout),ze.current.clear()},[]);const Ns=y.useMemo(()=>({connected:!0,environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:Jt,addEnvironment:Ri,updateEnvironment:Mi,provisionEnvironment:async(H,ne)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:xs},sessions:{sessions:r,sessionsLoading:!1,events:d,eventsDropped:0,lastSpawnedId:p,taskSessions:z,spawn:Vt,sendInput:Fa,kill:es,stopGraceful:ft,loadSessionEvents:aa,clearEvents:ts,loadTaskSessions:async H=>{console.log("[MockGrackle] loadTaskSessions",H)},domainHook:xs},workspaces:{workspaces:g,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:Ga,archiveWorkspace:ia,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()}))},domainHook:xs},tasks:{tasks:b,tasksLoading:!1,taskStartingId:void 0,loadTasks:Kt,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Ai,startTask:oa,stopTask:async H=>{console.log("[MockGrackle] stopTask",{taskId:H}),await ns(H)},completeTask:ns,resumeTask:Di,updateTask:Bn,deleteTask:Ae,domainHook:xs},findings:{findings:S,selectedFinding:w,findingLoading:T,findingsLoading:!1,loadFindings:Ke,loadAllFindings:Yt,loadFinding:kt,postFinding:un,domainHook:xs},tokens:{tokens:C,tokensLoading:!1,loadTokens:Ii,setToken:Za,deleteToken:Ka,domainHook:xs},credentials:{credentialProviders:L,credentialsLoading:!1,updateCredentialProviders:Ya,domainHook:xs},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:xs},personas:{personas:I,personasLoading:!1,createPersona:async(H,ne,le,fe,he,Pe,Se,Me,Ye)=>{console.log("[MockGrackle] createPersona",{name:H});const ct={id:`mock-persona-${Date.now()}`,name:H,description:ne,systemPrompt:le,toolConfig:"{}",runtime:fe??"claude-code",model:he||"",maxTurns:Pe||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:Se||"agent",script:Me||"",allowedMcpTools:Ye||[]};return O(Je=>[...Je,ct]),ct},updatePersona:async(H,ne,le,fe,he,Pe,Se,Me,Ye,ct)=>{console.log("[MockGrackle] updatePersona",{personaId:H,name:ne});const Je=I.find(Mt=>Mt.id===H);if(!Je)throw new Error(`Persona not found: ${H}`);const qt=new Date().toISOString(),tn={...Je,...ne!==void 0?{name:ne}:{},...le!==void 0?{description:le}:{},...fe!==void 0?{systemPrompt:fe}:{},...he!==void 0?{runtime:he}:{},...Pe!==void 0?{model:Pe}:{},...Se!==void 0?{maxTurns:Se}:{},...Me!==void 0?{type:Me}:{},...Ye!==void 0?{script:Ye}:{},...ct!==void 0?{allowedMcpTools:ct}:{},updatedAt:qt};return O(Mt=>Mt.map(fn=>fn.id===H?tn:fn)),tn},deletePersona:async H=>{console.log("[MockGrackle] deletePersona",H),O(ne=>ne.filter(le=>le.id!==H))},domainHook:xs},knowledge:{graphData:{nodes:te,links:ae},selectedNode:re,loading:!1,selectedId:F,searchQuery:pe,search:async H=>{if(console.log("[MockGrackle] knowledge.search",H),!H.trim()){de(H);return}de(H);const ne=Oe.current,le=ne?ks.filter(Se=>!Se.workspaceId||Se.workspaceId===ne):ks,fe=H.toLowerCase(),he=le.filter(Se=>{var Me,Ye,ct;return Se.label.toLowerCase().includes(fe)||((Me=Se.content)==null?void 0:Me.toLowerCase().includes(fe))||((Ye=Se.tags)==null?void 0:Ye.some(Je=>Je.toLowerCase().includes(fe)))||((ct=Se.category)==null?void 0:ct.toLowerCase().includes(fe))});P(he);const Pe=new Set(he.map(Se=>Se.id));K(Ra.filter(Se=>Pe.has(Se.source)&&Pe.has(Se.target))),oe(void 0),A(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),de("");const H=Oe.current,ne=H?ks.filter(fe=>!fe.workspaceId||fe.workspaceId===H):ks;P(ne);const le=new Set(ne.map(fe=>fe.id));K(Ra.filter(fe=>le.has(fe.source)&&le.has(fe.target)))},selectNode:async H=>{console.log("[MockGrackle] knowledge.selectNode",H),oe(H);const ne=H in qb?qb[H]:void 0;if(ne)A(ne);else{const le=ks.find(fe=>fe.id===H);if(le){const fe=Ra.filter(he=>he.source===H||he.target===H).map(he=>({fromId:he.source,toId:he.target,type:he.type}));A({node:le,edges:fe})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),oe(void 0),A(void 0)},expandNode:async H=>{console.log("[MockGrackle] knowledge.expandNode",H),P(ne=>{const le=new Set(ne.map(Me=>Me.id)),fe=Ra.filter(Me=>Me.source===H||Me.target===H),he=new Set;for(const Me of fe)le.has(Me.source)||he.add(Me.source),le.has(Me.target)||he.add(Me.target);if(he.size===0)return ne;const Pe=ks.filter(Me=>he.has(Me.id)),Se=new Set([...le,...he]);return K(Me=>{const Ye=new Set(Me.map(Je=>`${Je.source}|${Je.target}|${Je.type}`)),ct=Ra.filter(Je=>Se.has(Je.source)&&Se.has(Je.target)&&!Ye.has(`${Je.source}|${Je.target}|${Je.type}`));return ct.length>0?[...Me,...ct]:Me}),[...ne,...Pe]})},loadRecent:async H=>{if(console.log("[MockGrackle] knowledge.loadRecent",H),Oe.current=H,H){const ne=ks.filter(fe=>!fe.workspaceId||fe.workspaceId===H);P(ne);const le=new Set(ne.map(fe=>fe.id));K(Ra.filter(fe=>le.has(fe.source)&&le.has(fe.target)))}else P(ks),K(Ra);de("")},handleEvent:()=>!1,domainHook:xs},appDefaultPersonaId:$,setAppDefaultPersonaId:async H=>{console.log("[MockGrackle] setAppDefaultPersonaId",H),X(H)},onboardingCompleted:!0,completeOnboarding:async()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costUsd:1.12,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costUsd:.48,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costUsd:.63,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costUsd:.1,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costUsd:.63,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costUsd:.1,sessionCount:1}},loadUsage:async(H,ne)=>{console.log(`[MockGrackle] loadUsage(${H}, ${ne})`)},refresh:hs}),[s,r,d,p,z,g,b,S,w,C,L,I,$,te,ae,re,F,pe,Vt,Fa,es,ft,aa,ts,Ga,ia,Kt,Ai,oa,ns,Di,Bn,Ae,Ke,Yt,kt,un,Jt,Ri,Mi,Ii,Za,Ka,Ya,hs]);return o.jsx(Qm.Provider,{value:Ns,children:t})}const Iz=3e3;function Oz(t){const[s,i]=y.useState(!1),r=y.useRef(t.onSessionEvent);r.current=t.onSessionEvent;const c=y.useRef(t.onDomainEvent);c.current=t.onDomainEvent;const d=y.useRef(t.onConnect);d.current=t.onConnect;const u=y.useRef(t.onDisconnect);return u.current=t.onDisconnect,y.useEffect(()=>{let p=!1,m;async function g(){var v,b;if(!p){try{const _=we.streamEvents({});i(!0),Promise.resolve((v=d.current)==null?void 0:v.call(d)).catch(()=>{});for await(const S of _){if(p)break;const k=S.event;if(k.case==="sessionEvent"){const w=k.value;r.current({sessionId:w.sessionId,type:w.type,timestamp:w.timestamp,content:w.content,raw:w.raw})}else if(k.case==="domainEvent"){const w=k.value;c.current({id:w.id,type:w.type,timestamp:w.timestamp,payloadJson:w.payloadJson})}}}catch(_){if(_ instanceof ol&&_.code===hT.Unauthenticated){window.location.href=nN;return}}p||(i(!1),(b=u.current)==null||b.call(u),m=setTimeout(()=>{g().catch(()=>{})},Iz))}}return g().catch(()=>{}),()=>{p=!0,clearTimeout(m),i(!1)}},[]),{connected:s}}function Lz(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped}}function Zb(t){return{id:t.id,environmentId:t.environmentId,runtime:t.runtime,status:t.status,prompt:t.prompt,startedAt:t.startedAt,endedAt:t.endedAt||void 0,error:t.error||void 0,endReason:t.endReason||void 0,personaId:t.personaId||void 0,inputTokens:t.inputTokens,outputTokens:t.outputTokens,costUsd:t.costUsd}}function Bz(t){return{sessionId:t.sessionId,eventType:l_(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function zz(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,environmentId:t.environmentId,status:gT(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,createdAt:t.createdAt,updatedAt:t.updatedAt}}function Kb(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:vT(t.status),branch:t.branch,latestSessionId:t.latestSessionId,dependsOn:[...t.dependsOn],sortOrder:t.sortOrder,createdAt:t.createdAt,startedAt:t.startedAt||void 0,completedAt:t.completedAt||void 0,parentTaskId:t.parentTaskId,depth:t.depth,childTaskIds:[...t.childTaskIds],canDecompose:t.canDecompose,defaultPersonaId:t.defaultPersonaId,workpad:t.workpad}}function kp(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 Uz(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function $z(t){return{claude:yT(t.claude),github:Nc(t.github),copilot:Nc(t.copilot),codex:Nc(t.codex),goose:Nc(t.goose)}}function Pz(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function Sp(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 Hz(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costUsd:t.costUsd,sessionCount:t.sessionCount}}function Pc(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 Tp(t){return{source:t.fromId,target:t.toId,type:t.type}}function qa(){const[t,s]=y.useState(!1),i=y.useRef(0),r=y.useCallback(c=>(i.current++,i.current===1&&s(!0),c.finally(()=>{i.current--,i.current===0&&s(!1)})),[]);return{loading:t,track:r}}const Yb=5e3;function Ur(t){return t instanceof ol?t.message:"Operation failed"}function Vz(){const[t,s]=y.useState([]),{loading:i,track:r}=qa(),[c,d]=y.useState({}),[u,p]=y.useState(""),m=y.useCallback(()=>{p("")},[]),g=y.useCallback(async()=>{try{const C=await r(we.listEnvironments({}));s(C.environments.map(Lz))}catch{}},[r]),v=y.useCallback(C=>{switch(C.type){case"environment.added":return!0;case"environment.removed":{const D=C.payload.environmentId;return D&&(s(L=>L.filter(E=>E.id!==D)),d(L=>{const E={...L};return delete E[D],E})),!0}case"environment.changed":return g().catch(()=>{}),!0;case"environment.provision_progress":{const D=C.payload;if(typeof D.environmentId!="string"||typeof D.stage!="string"||typeof D.message!="string"||typeof D.progress!="number")return L1("environment.provision_progress","invalid payload"),!0;if(d(L=>({...L,[D.environmentId]:{stage:D.stage,message:D.message,progress:D.progress}})),D.stage==="ready"){const L=D.environmentId;setTimeout(()=>{d(E=>{const I={...E};return delete I[L],I})},Yb)}return!0}default:return!1}},[g]),b=y.useCallback(C=>{var D;if(C.type==="environments"){const L=Array.isArray((D=C.payload)==null?void 0:D.environments)?C.payload.environments:[];return s(L),!0}return!1},[]),_=y.useCallback(async(C,D,L)=>{p("");try{await we.addEnvironment({displayName:C,adapterType:D,adapterConfig:JSON.stringify(L??{})})}catch(E){p(Ur(E))}},[]),S=y.useCallback(async(C,D)=>{p("");try{await we.updateEnvironment({id:C,displayName:D.displayName,adapterConfig:D.adapterConfig?JSON.stringify(D.adapterConfig):void 0})}catch(L){p(Ur(L))}},[]),k=y.useCallback(async(C,D)=>{p("");try{const L=we.provisionEnvironment({id:C,force:D??!1});for await(const E of L)d(I=>({...I,[C]:{stage:E.stage,message:E.message,progress:E.progress}})),E.stage==="ready"&&setTimeout(()=>{d(I=>{const O={...I};return delete O[C],O})},Yb)}catch(L){d(E=>{const I={...E};return delete I[C],I}),p(Ur(L))}},[]),w=y.useCallback(async C=>{p("");try{await we.stopEnvironment({id:C})}catch(D){p(Ur(D))}},[]),N=y.useCallback(async C=>{p("");try{await we.removeEnvironment({id:C})}catch(D){p(Ur(D))}},[]);return{environments:t,environmentsLoading:i,provisionStatus:c,operationError:u,clearOperationError:m,loadEnvironments:g,addEnvironment:_,updateEnvironment:S,provisionEnvironment:k,stopEnvironment:w,removeEnvironment:N,handleEvent:v,handleLegacyMessage:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:v}}}const wp=new Set(["pending","running","idle"]),qz=new Set(["completed","failed","interrupted","hibernating","suspended"]),Jb=["pending","running","idle"];function Gz(){const[t,s]=y.useState([]),{loading:i,track:r}=qa(),[c,d]=y.useState([]),[u,p]=y.useState(0),[m,g]=y.useState(void 0),[v,b]=y.useState({}),_=y.useCallback(async()=>{try{const $=(await r(we.listSessions({}))).sessions.map(Zb);s(X=>{const te=new Map(X.map(P=>[P.id,P]));return $.map(P=>{const ae=te.get(P.id),K=ae==null?void 0:ae.status;return!K||K===P.status?P:qz.has(K)&&wp.has(P.status)?{...P,status:K,...ae.endReason!==void 0?{endReason:ae.endReason}:{}}:wp.has(K)&&wp.has(P.status)&&Jb.indexOf(K)>Jb.indexOf(P.status)?{...P,status:K}:P})})}catch{}},[r]),S=y.useCallback(z=>{if(z.type!=="session_event")return!1;if(!rz(z.payload))return L1("session_event","payload is not a valid SessionEvent"),!0;const $=z.payload;let X=0;if(d(te=>{const P=[...te,$];return P.length>xo?(X=P.length-xo,P.slice(-xo)):P}),X>0&&p(te=>te+X),$.eventType==="usage")try{const te=JSON.parse($.content),P=Number(te.input_tokens)||0,ae=Number(te.output_tokens)||0,K=Number(te.cost_usd)||0;(P>0||ae>0||K>0)&&s(re=>re.map(A=>A.id===$.sessionId?{...A,inputTokens:(A.inputTokens??0)+P,outputTokens:(A.outputTokens??0)+ae,costUsd:(A.costUsd??0)+K}:A))}catch{}if($.eventType==="status"){const te=B1($.content),P=z1($.content);s(ae=>ae.some(re=>re.id===$.sessionId)?ae.map(re=>re.id===$.sessionId?{...re,status:te,...P!==void 0?{endReason:P}:{}}:re):[...ae,{id:$.sessionId,environmentId:"",runtime:"",status:te,prompt:"",startedAt:$.timestamp,...P!==void 0?{endReason:P}:{}}])}return!0},[]),k=y.useCallback(z=>{S({type:"session_event",payload:z})},[S]),w=y.useCallback(z=>{var $,X,te,P,ae;switch(z.type){case"sessions":{const K=Array.isArray(($=z.payload)==null?void 0:$.sessions)?z.payload.sessions:[];return s(K),!0}case"spawned":{const K=(X=z.payload)==null?void 0:X.sessionId;return typeof K=="string"&&K&&g(K),_().catch(()=>{}),!0}case"session_events":{const K=Array.isArray((te=z.payload)==null?void 0:te.events)?z.payload.events:[];return K.length>0&&d(K),!0}case"task_sessions":{const K=(P=z.payload)==null?void 0:P.taskId;if(typeof K=="string"&&K){const re=Array.isArray((ae=z.payload)==null?void 0:ae.sessions)?z.payload.sessions:[];b(A=>({...A,[K]:re}))}return!0}default:return!1}},[_]),N=y.useCallback(async(z,$,X,te)=>{try{const P=await we.spawnAgent({environmentId:z,prompt:$,personaId:X||"",workingDirectory:te||""});g(P.id),await _()}catch{}},[_]),T=y.useCallback(async(z,$)=>{try{await we.sendInput({sessionId:z,text:$})}catch{}},[]),C=y.useCallback(async z=>{try{await we.killAgent({id:z,graceful:!1})}catch{}},[]),D=y.useCallback(async z=>{try{await we.killAgent({id:z,graceful:!0})}catch{}},[]),L=y.useCallback(async z=>{try{const X=(await we.getSessionEvents({id:z})).events.map(Bz);if(X.length>0){let te=0;d(P=>{const ae=new Set;for(const A of P)A.sessionId===z&&ae.add(`${A.timestamp}|${A.eventType}`);const K=X.filter(A=>!ae.has(`${A.timestamp}|${A.eventType}`)),re=[...P,...K].sort((A,F)=>A.sessionId!==F.sessionId?0:A.timestamp.localeCompare(F.timestamp));return re.length>xo?(te=re.length-xo,re.slice(-xo)):re}),te>0&&p(P=>P+te)}}catch{}},[]),E=y.useCallback(()=>{d([]),p(0)},[]),I=y.useCallback(async z=>{try{const X=(await we.getTaskSessions({id:z})).sessions.map(Zb);b(te=>({...te,[z]:X}))}catch{}},[]);return{sessions:t,sessionsLoading:i,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:_,spawn:N,sendInput:T,kill:C,stopGraceful:D,loadSessionEvents:L,clearEvents:E,loadTaskSessions:I,handleMessage:S,handleSessionEvent:k,handleLegacyMessage:w,domainHook:{onConnect:()=>_(),onDisconnect:()=>{E()},handleEvent:()=>!1}}}function Fz(){const[t,s]=y.useState([]),{loading:i,track:r}=qa(),[c,d]=y.useState(!1),u=y.useCallback(async()=>{try{const S=await r(we.listWorkspaces({}));s(S.workspaces.map(zz))}catch{}},[r]),p=y.useCallback(S=>{switch(S.type){case"workspace.created":return d(!1),u().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return u().catch(()=>{}),!0;default:return!1}},[u]),m=y.useCallback(()=>{d(!1)},[]),g=y.useCallback(async(S,k,w,N,T,C,D,L,E)=>{d(!0);try{await we.createWorkspace({name:S,description:k||"",repoUrl:w||"",environmentId:N||"",defaultPersonaId:T||void 0,useWorktrees:C??!0,workingDirectory:D||void 0}),d(!1),L==null||L()}catch(I){d(!1);const O=I instanceof ol?I.message:"Failed to create workspace";E==null||E(O)}},[]),v=y.useCallback(async S=>{try{await we.archiveWorkspace({id:S})}catch{}},[]),b=y.useCallback(async(S,k)=>{try{await we.updateWorkspace({id:S,...k})}catch{}},[]);return{workspaces:t,workspacesLoading:i,workspaceCreating:c,loadWorkspaces:u,createWorkspace:g,archiveWorkspace:v,updateWorkspace:b,handleEvent:p,onDisconnect:m,domainHook:{onConnect:()=>u(),onDisconnect:m,handleEvent:p}}}function Zz(){const[t,s]=y.useState([]),{loading:i,track:r}=qa(),[c,d]=y.useState(void 0),u=y.useRef({}),p=y.useCallback(async E=>{try{const O=(await we.listTasks({workspaceId:E})).tasks.map(Kb);s(z=>[...z.filter($=>$.workspaceId!==E),...O])}catch{}},[]),m=y.useCallback(async()=>{try{const I=(await r(we.listTasks({}))).tasks.map(Kb);s(O=>{const z=new Set(I.map($=>$.id));return[...O.filter($=>!z.has($.id)),...I]})}catch{}},[r]),g=y.useCallback((E,I)=>{const O=z=>{clearTimeout(u.current[z]),u.current[z]=setTimeout(()=>{delete u.current[z],p(z).catch(()=>{})},200)};E?O(E):I&&s(z=>{const $=z.find(X=>X.id===I);return $!=null&&$.workspaceId?O($.workspaceId):m().catch(()=>{}),z})},[p,m]),v=y.useCallback(E=>{const I=E.payload;switch(E.type){case"task.created":{const O=typeof I.workspaceId=="string"?I.workspaceId:"";return O&&p(O).catch(()=>{}),!0}case"task.started":{const O=typeof I.taskId=="string"?I.taskId:"",z=typeof I.sessionId=="string"?I.sessionId:"",$=typeof I.workspaceId=="string"?I.workspaceId:"";return d(X=>O&&X===O?void 0:X),z&&O&&s(X=>X.map(te=>te.id===O?{...te,latestSessionId:z}:te)),g($,O),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const O=typeof I.workspaceId=="string"?I.workspaceId:"",z=typeof I.taskId=="string"?I.taskId:"";return g(O,z),!0}default:return!1}},[p,g]),b=y.useCallback(()=>{d(void 0)},[]),_=y.useCallback(E=>{var I,O;if(E.type==="tasks"){const z=Array.isArray((I=E.payload)==null?void 0:I.tasks)?E.payload.tasks:[],$=typeof((O=E.payload)==null?void 0:O.workspaceId)=="string"&&E.payload.workspaceId?E.payload.workspaceId:"";return s($?X=>[...X.filter(te=>te.workspaceId!==$),...z]:X=>{const te=new Set(z.map(P=>P.id));return[...X.filter(P=>!te.has(P.id)),...z]}),!0}return!1},[]),S=y.useCallback(async(E,I,O,z,$,X,te,P,ae)=>{try{await we.createTask({workspaceId:E,title:I,description:O||"",dependsOn:z||[],parentTaskId:$||"",defaultPersonaId:X||void 0,canDecompose:te??void 0}),P==null||P()}catch(K){const re=K instanceof ol?K.message:"Failed to create task";ae==null||ae(re)}},[]),k=y.useCallback(async(E,I,O,z)=>{d(E);try{await we.startTask({taskId:E,personaId:I||"",environmentId:O||"",notes:z||""})}catch{d(void 0)}},[]),w=y.useCallback(async E=>{try{await we.stopTask({id:E})}catch{}},[]),N=y.useCallback(async E=>{try{await we.completeTask({id:E})}catch{}},[]),T=y.useCallback(async E=>{try{await we.resumeTask({id:E})}catch{}},[]),C=y.useCallback(async(E,I,O,z,$)=>{try{await we.updateTask({id:E,title:I,description:O,dependsOn:z,...$!==void 0?{defaultPersonaId:$}:{}})}catch{}},[]),D=y.useCallback(async E=>{try{await we.deleteTask({id:E})}catch{}},[]);return{tasks:t,tasksLoading:i,taskStartingId:c,loadTasks:p,loadAllTasks:m,createTask:S,startTask:k,stopTask:w,completeTask:N,resumeTask:T,updateTask:C,deleteTask:D,handleEvent:v,onDisconnect:b,handleLegacyMessage:_,domainHook:{onConnect:()=>m(),onDisconnect:b,handleEvent:v}}}function Kz(){const[t,s]=y.useState([]),[i,r]=y.useState(void 0),[c,d]=y.useState(!1),{loading:u,track:p}=qa(),m=y.useCallback(async k=>{try{const w=await p(we.queryFindings({workspaceId:k}));s(w.findings.map(kp))}catch{}},[p]),g=y.useCallback(async()=>{try{const k=await p(we.queryFindings({workspaceId:""}));s(k.findings.map(kp))}catch{}},[p]),v=y.useCallback(async k=>{r(void 0),d(!0);try{const w=await we.getFinding({id:k});r(kp(w))}catch{r(void 0)}finally{d(!1)}},[]),b=y.useCallback(k=>{if(k.type==="finding.posted"){const w=typeof k.payload.workspaceId=="string"?k.payload.workspaceId:"";return w&&m(w).catch(()=>{}),!0}return!1},[m]),_=y.useCallback(async(k,w,N,T,C)=>{try{await we.postFinding({workspaceId:k,title:w,content:N,category:T??"general",tags:C??[]})}catch{}},[]);return{findings:t,selectedFinding:i,findingLoading:c,findingsLoading:u,loadFindings:m,loadAllFindings:g,loadFinding:v,postFinding:_,handleEvent:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:b}}}function Yz(){const[t,s]=y.useState([]),{loading:i,track:r}=qa(),c=y.useCallback(async()=>{try{const g=await r(we.listTokens({}));s(g.tokens.map(Uz))}catch{}},[r]),d=y.useCallback(g=>g.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(g,v,b,_,S)=>{try{await we.setToken({name:g,value:v,type:b,envVar:_,filePath:S})}catch{}},[]),p=y.useCallback(async g=>{try{await we.deleteToken({name:g})}catch{}},[]);return{tokens:t,tokensLoading:i,loadTokens:c,setToken:u,deleteToken:p,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Jz(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:i,track:r}=qa(),c=y.useCallback(async()=>{try{const m=await r(we.getCredentialProviders({}));s($z(m))}catch{}},[r]),d=y.useCallback(m=>m.type==="credential.providers_changed"?(cz(m.payload)&&s(m.payload),!0):!1,[]),u=y.useCallback(async m=>{const g=[{provider:"claude",value:m.claude},{provider:"github",value:m.github},{provider:"copilot",value:m.copilot},{provider:"codex",value:m.codex},{provider:"goose",value:m.goose}];await Promise.allSettled(g.map(({provider:v,value:b})=>we.setCredentialProvider({provider:v,value:b})))},[]);return{credentialProviders:t,credentialsLoading:i,loadCredentials:c,updateCredentialProviders:u,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Wz(){const[t,s]=y.useState([]),[i,r]=y.useState(""),[c,d]=y.useState(""),[u,p]=y.useState(!1),m=y.useCallback(async()=>{try{const b=await we.listCodespaces({});s(b.codespaces.map(Pz)),d(b.error)}catch{}},[]),g=y.useCallback(async(b,_)=>{p(!0),r("");try{await we.createCodespace({repo:b,machine:_??""}),p(!1),await m()}catch(S){p(!1);const k=S instanceof ol?S.message:"Failed to create codespace";r(k)}},[m]);return{codespaces:t,codespaceError:i,codespaceListError:c,codespaceCreating:u,listCodespaces:m,createCodespace:g,domainHook:{onConnect:()=>m(),onDisconnect:()=>{},handleEvent:()=>!1}}}function Xz(){const[t,s]=y.useState([]),{loading:i,track:r}=qa(),c=y.useCallback(async()=>{try{const v=await r(we.listPersonas({}));s(v.personas.map(Sp))}catch{}},[r]),d=y.useCallback(v=>{switch(v.type){case"persona.created":case"persona.updated":case"persona.deleted":return c().catch(()=>{}),!0;default:return!1}},[c]),u=y.useCallback(async(v,b,_,S,k,w,N,T,C)=>{const D=await we.createPersona({name:v,description:b,systemPrompt:_,runtime:S||"",model:k||"",maxTurns:w||0,type:N||"agent",script:T||"",allowedMcpTools:C||[]}),L=Sp(D);return s(E=>[...E.filter(I=>I.id!==L.id),L]),L},[]),p=y.useCallback(async(v,b,_,S,k,w,N,T,C,D)=>{const L={id:v};b!==void 0&&(L.name=b),_!==void 0&&(L.description=_),S!==void 0&&(L.systemPrompt=S),k!==void 0&&(L.runtime=k),w!==void 0&&(L.model=w),N!==void 0&&(L.maxTurns=N),T!==void 0&&(L.type=T),C!==void 0&&(L.script=C),D!==void 0&&(L.allowedMcpTools={tools:D});const E=await we.updatePersona(L),I=Sp(E);return s(O=>O.map(z=>z.id===I.id?I:z)),I},[]),m=y.useCallback(async v=>{await we.deletePersona({id:v}),s(b=>b.filter(_=>_.id!==v))},[]);return{personas:t,personasLoading:i,loadPersonas:c,createPersona:u,updatePersona:p,deletePersona:m,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function Qz(t){if(t)try{return JSON.parse(t)}catch{return}}function e7(){const[t,s]=y.useState(new Map),[i,r]=y.useState([]),[c,d]=y.useState(void 0),[u,p]=y.useState(void 0),[m,g]=y.useState(!1),[v,b]=y.useState(""),_=y.useRef(""),S=y.useCallback(async E=>{const I=E??"";_.current=I,b(""),g(!0);try{const O=await we.listRecentKnowledgeNodes({limit:30,workspaceId:I}),z=new Map,$=[];for(const X of O.nodes)z.set(X.id,Pc(X));for(const X of O.edges)$.push(Tp(X));for(const X of $){const te=z.get(X.source);te&&(te.val+=1);const P=z.get(X.target);P&&(P.val+=1)}s(z),r($)}catch{}finally{g(!1)}},[]),k=y.useCallback(async E=>{if(E.trim()){b(E),p(void 0),d(void 0),g(!0);try{const I=await we.searchKnowledge({query:E,limit:20,workspaceId:_.current}),O=new Map,z=[];for(const $ of I.results){$.node&&O.set($.node.id,Pc($.node,$.edges.length));for(const X of $.edges)z.push(Tp(X))}s(O),r(z)}catch{}finally{g(!1)}}},[]),w=y.useCallback(()=>{S(_.current).catch(()=>{})},[S]),N=y.useCallback(async E=>{p(E);try{const I=await we.getKnowledgeNode({id:E});if(!I.node){d(void 0);return}d({node:Pc(I.node,I.edges.length),edges:I.edges.map(O=>({fromId:O.fromId,toId:O.toId,type:O.type,metadata:Qz(O.metadataJson)}))})}catch{d(void 0)}},[]),T=y.useCallback(()=>{p(void 0),d(void 0)},[]),C=y.useCallback(async E=>{try{const I=await we.expandKnowledgeNode({id:E,depth:1});s(O=>{const z=new Map(O);for(const $ of I.nodes)z.has($.id)||z.set($.id,Pc($));return z}),r(O=>{const z=new Set(O.map(X=>`${X.source}:${X.target}:${X.type}`)),$=[];for(const X of I.edges){const te=Tp(X),P=`${te.source}:${te.target}:${te.type}`;z.has(P)||$.push(te)}return[...O,...$]})}catch{}},[]),D=y.useCallback(E=>!1,[]),L={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:D};return{graphData:{nodes:[...t.values()],links:i},selectedNode:c,selectedId:u,loading:m,searchQuery:v,search:k,clearSearch:w,selectNode:N,clearSelection:T,expandNode:C,loadRecent:S,handleEvent:D,domainHook:L}}function t7(){const t=y.useRef("default");y.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 n7(){const[t,s]=y.useState(""),[i,r]=y.useState(void 0),[c,d]=y.useState({}),u=Vz(),p=Gz(),m=Fz(),g=Zz(),v=Kz(),b=Yz(),_=Jz(),S=Wz(),k=Xz(),w=e7(),N=t7(),T=[u.domainHook,p.domainHook,m.domainHook,g.domainHook,v.domainHook,b.domainHook,_.domainHook,S.domainHook,k.domainHook,w.domainHook,N.domainHook],{connected:C}=Oz({onSessionEvent:P=>{p.handleSessionEvent({sessionId:P.sessionId,eventType:l_(P.type),timestamp:P.timestamp,content:P.content,raw:P.raw||void 0})},onDomainEvent:P=>{try{const ae=JSON.parse(P.payloadJson);z({id:P.id,type:P.type,timestamp:P.timestamp,payload:ae})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",P.payloadJson)}},onConnect:$,onDisconnect:X}),D="default_persona_id",L="onboarding_completed",E=y.useCallback(async P=>{const ae=await we.setSetting({key:D,value:P});s(ae.value)},[]),I=y.useCallback(async()=>{r(!0);try{await we.setSetting({key:L,value:"true"})}catch{}},[]),O=y.useCallback(async(P,ae)=>{try{const K=await we.getUsage({scope:P,id:ae}),re=`${P}:${ae}`;d(A=>({...A,[re]:Hz(K)}))}catch{}},[]);function z(P){const ae=P.payload.key,K=P.payload.value;if(P.type==="setting.changed"){ae===D&&s(K??""),ae===L&&r(K==="true");return}for(const re of T)if(re.handleEvent(P))break;(P.type==="environment.removed"||P.type==="environment.changed"||P.type==="task.started")&&p.loadSessions().catch(()=>{})}async function $(){for(const P of T)P.onConnect().catch(()=>{});try{const P=await we.getSetting({key:D});s(P.value)}catch{}try{const P=await we.getSetting({key:L});r(P.value==="true")}catch{}}function X(){T.forEach(P=>P.onDisconnect())}const te=y.useCallback(()=>{u.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),m.loadWorkspaces().catch(()=>{}),b.loadTokens().catch(()=>{})},[u.loadEnvironments,p.loadSessions,m.loadWorkspaces,b.loadTokens]);return{connected:C,environments:{environments:u.environments,environmentsLoading:u.environmentsLoading,provisionStatus:u.provisionStatus,operationError:u.operationError,clearOperationError:u.clearOperationError,loadEnvironments:u.loadEnvironments,addEnvironment:u.addEnvironment,updateEnvironment:u.updateEnvironment,provisionEnvironment:u.provisionEnvironment,stopEnvironment:u.stopEnvironment,removeEnvironment:u.removeEnvironment,domainHook:u.domainHook},sessions:{sessions:p.sessions,sessionsLoading:p.sessionsLoading,events:p.events,eventsDropped:p.eventsDropped,lastSpawnedId:p.lastSpawnedId,taskSessions:p.taskSessions,spawn:p.spawn,sendInput:p.sendInput,kill:p.kill,stopGraceful:p.stopGraceful,loadSessionEvents:p.loadSessionEvents,clearEvents:p.clearEvents,loadTaskSessions:p.loadTaskSessions,domainHook:p.domainHook},workspaces:{workspaces:m.workspaces,workspacesLoading:m.workspacesLoading,workspaceCreating:m.workspaceCreating,loadWorkspaces:m.loadWorkspaces,createWorkspace:m.createWorkspace,archiveWorkspace:m.archiveWorkspace,updateWorkspace:m.updateWorkspace,domainHook:m.domainHook},tasks:{tasks:g.tasks,tasksLoading:g.tasksLoading,taskStartingId:g.taskStartingId,loadTasks:g.loadTasks,loadAllTasks:g.loadAllTasks,createTask:g.createTask,startTask:g.startTask,stopTask:g.stopTask,completeTask:g.completeTask,resumeTask:g.resumeTask,updateTask:g.updateTask,deleteTask:g.deleteTask,domainHook:g.domainHook},findings:{findings:v.findings,selectedFinding:v.selectedFinding,findingLoading:v.findingLoading,findingsLoading:v.findingsLoading,loadFindings:v.loadFindings,loadAllFindings:v.loadAllFindings,loadFinding:v.loadFinding,postFinding:v.postFinding,domainHook:v.domainHook},tokens:{tokens:b.tokens,tokensLoading:b.tokensLoading,loadTokens:b.loadTokens,setToken:b.setToken,deleteToken:b.deleteToken,domainHook:b.domainHook},credentials:{credentialProviders:_.credentialProviders,credentialsLoading:_.credentialsLoading,updateCredentialProviders:_.updateCredentialProviders,domainHook:_.domainHook},codespaces:{codespaces:S.codespaces,codespaceError:S.codespaceError,codespaceListError:S.codespaceListError,codespaceCreating:S.codespaceCreating,listCodespaces:S.listCodespaces,createCodespace:S.createCodespace,domainHook:S.domainHook},personas:{personas:k.personas,personasLoading:k.personasLoading,createPersona:k.createPersona,updatePersona:k.updatePersona,deletePersona:k.deletePersona,domainHook:k.domainHook},knowledge:w,appDefaultPersonaId:t,setAppDefaultPersonaId:E,onboardingCompleted:i,completeOnboarding:I,usageCache:c,loadUsage:O,refresh:te}}function s7({children:t}){const s=n7();return o.jsx(Qm.Provider,{value:s,children:t})}function a7(t,s){const i=y.useRef(null);y.useEffect(()=>{const r=i.current;if(i.current=t,r===null)return;const c=new Map;for(const u of r)c.set(u.id,u);const d=new Set;for(const u of t){d.add(u.id);const p=c.get(u.id);if(p&&p.status!==u.status&&u.status!=="sleeping"){if(u.status==="connecting"){s("Provisioning environment…","info");continue}u.status==="connected"?s("Environment connected","success"):u.status==="error"?s("Environment provision failed","error"):u.status==="disconnected"&&(p.status==="connected"?s("Environment disconnected","warning"):s("Environment stopped","info"))}}for(const u of r)d.has(u.id)||s("Environment removed","info")},[t,s])}function i7(t,s,i){const r=y.useRef(t);y.useEffect(()=>{t&&t!==r.current&&(i(t,"error"),s()),r.current=t},[t,s,i])}const o7={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 r7(t){return o7[t]}function l7(t,s){if(t===void 0)return[];const i=[],r=new Map;for(const d of t)r.set(d.id,d);const c=new Set;for(const d of s){c.add(d.id);const u=r.get(d.id);if(!u||u.status===d.status)continue;const p=r7(d.status);p&&i.push(p)}for(const d of t)c.has(d.id)||i.push({message:"Task deleted",variant:"info"});return i}function c7(t,s){const i=y.useRef(void 0);y.useEffect(()=>{const r=i.current;i.current=t;const c=l7(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const d7="_dashboard_16pzm_1",u7="_kpiStrip_16pzm_11",f7="_kpiCard_16pzm_23",p7="_kpiValue_16pzm_68",m7="_kpiLabel_16pzm_76",h7="_bodyGrid_16pzm_84",g7="_section_16pzm_96",v7="_sectionHeader_16pzm_109",y7="_sectionIcon_16pzm_118",b7="_sectionTitle_16pzm_123",_7="_sectionCount_16pzm_131",x7="_sectionBody_16pzm_138",k7="_emptyHint_16pzm_143",S7="_sessionRow_16pzm_150",T7="_sessionPrompt_16pzm_177",w7="_sessionEnv_16pzm_186",j7="_sessionRuntime_16pzm_192",N7="_sessionStatus_16pzm_198",C7="_statusDot_16pzm_207",E7="_attentionRow_16pzm_233",A7="_attentionTitle_16pzm_259",D7="_attentionMeta_16pzm_267",R7="_reasonBadge_16pzm_274",M7="_bottomGrid_16pzm_301",I7="_envRow_16pzm_312",O7="_envName_16pzm_323",L7="_envStatusBadge_16pzm_333",B7="_workspaceRow_16pzm_369",z7="_workspaceTop_16pzm_395",U7="_workspaceName_16pzm_401",$7="_workspaceCounts_16pzm_407",P7="_progressBar_16pzm_415",H7="_progressFill_16pzm_422",ce={dashboard:d7,kpiStrip:u7,kpiCard:f7,kpiValue:p7,kpiLabel:m7,bodyGrid:h7,section:g7,sectionHeader:v7,sectionIcon:y7,sectionTitle:b7,sectionCount:_7,sectionBody:x7,emptyHint:k7,sessionRow:S7,sessionPrompt:T7,sessionEnv:w7,sessionRuntime:j7,sessionStatus:N7,statusDot:C7,attentionRow:E7,attentionTitle:A7,attentionMeta:D7,reasonBadge:R7,bottomGrid:M7,envRow:I7,envName:O7,envStatusBadge:L7,workspaceRow:B7,workspaceTop:z7,workspaceName:U7,workspaceCounts:$7,progressBar:P7,progressFill:H7};function V7(){return o.jsxs("div",{className:ce.dashboard,"aria-hidden":"true",children:[o.jsx("div",{className:ce.kpiStrip,children:Array.from({length:4},(t,s)=>o.jsxs("div",{className:ce.kpiCard,children:[o.jsx(xe,{width:"3rem",height:"2rem"}),o.jsx(xe,{width:"80%",height:"0.75rem"})]},s))}),o.jsxs("div",{className:ce.bodyGrid,children:[o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"8rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:3},(t,s)=>o.jsxs("div",{className:ce.sessionRow,style:{cursor:"default"},children:[o.jsx(xe,{width:"60%",height:"0.875rem"}),o.jsx(xe,{width:"4rem",height:"0.75rem"}),o.jsx(xe,{width:"3rem",height:"0.75rem"}),o.jsx(xe,{width:"3rem",height:"0.75rem"})]},s))})]}),o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"8rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:2},(t,s)=>o.jsxs("div",{className:ce.attentionRow,style:{cursor:"default"},children:[o.jsxs("div",{className:ce.attentionTitle,children:[o.jsx(xe,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"70%",height:"0.875rem"})]}),o.jsx("div",{className:ce.attentionMeta,children:o.jsx(xe,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),o.jsxs("div",{className:ce.bottomGrid,children:[o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"9rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:2},(t,s)=>o.jsxs("div",{className:ce.envRow,children:[o.jsx(xe,{width:"60%",height:"0.875rem"}),o.jsx(xe,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"6rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:2},(t,s)=>o.jsxs("div",{className:ce.workspaceRow,style:{cursor:"default"},children:[o.jsxs("div",{className:ce.workspaceTop,children:[o.jsx(xe,{width:"50%",height:"0.875rem"}),o.jsx(xe,{width:"2rem",height:"0.75rem"})]}),o.jsx("div",{className:ce.progressBar,children:o.jsx("div",{className:ce.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const q7={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Hc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function G7(t,s,i,r){const c=[`${t} of ${s} tasks completed`];return i>0&&c.push(`${i} in progress`),r>0&&c.push(`${r} failed`),c.join(", ")}function Vc({value:t,label:s,accent:i,index:r,testId:c}){return o.jsxs(Rt.div,{className:ce.kpiCard,"data-accent":i,"data-testid":c,variants:q7,initial:"hidden",animate:"visible",custom:r,children:[o.jsx("span",{className:ce.kpiValue,children:t}),o.jsx("span",{className:ce.kpiLabel,children:s})]})}function F7(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:i,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:p,environmentsLoading:m}}=ut(),g=xt(),v=y.useRef(new Set);y.useEffect(()=>{for(const N of t)v.current.has(N.id)||(v.current.add(N.id),c(N.id).catch(()=>{}))},[t,c]);const b=y.useMemo(()=>_z(d,i,p),[d,i,p]),_=y.useMemo(()=>kz(d,p),[d,p]),S=y.useMemo(()=>xz(i,t),[i,t]),k=y.useMemo(()=>Sz(t,i),[t,i,p]);return d.length===0&&i.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?o.jsx(V7,{}):o.jsxs("div",{className:ce.dashboard,"data-testid":"dashboard",children:[o.jsxs("div",{className:ce.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[o.jsx(Vc,{value:b.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),o.jsx(Vc,{value:b.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),o.jsx(Vc,{value:b.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),o.jsx(Vc,{value:b.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),o.jsxs("div",{className:ce.bodyGrid,children:[o.jsxs(Rt.div,{className:ce.section,variants:Hc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"●"}),o.jsx("span",{className:ce.sectionTitle,children:"Active Sessions"}),o.jsx("span",{className:ce.sectionCount,children:_.length})]}),o.jsx("div",{className:ce.sectionBody,children:_.length===0?o.jsx("div",{className:ce.emptyHint,children:"No active sessions"}):_.map(({session:N,environmentName:T})=>o.jsxs("button",{type:"button",className:ce.sessionRow,onClick:()=>g(mm(N.id)),"data-testid":"session-row",children:[o.jsx("span",{className:ce.sessionPrompt,title:N.prompt,children:N.prompt||"—"}),o.jsx("span",{className:ce.sessionEnv,children:T}),o.jsx("span",{className:ce.sessionRuntime,children:N.runtime}),o.jsxs("span",{className:ce.sessionStatus,children:[o.jsx("span",{className:ce.statusDot,"data-status":N.status}),N.status]})]},N.id))})]}),o.jsxs(Rt.div,{className:ce.section,variants:Hc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"⚑"}),o.jsx("span",{className:ce.sectionTitle,children:"Needs Attention"}),o.jsx("span",{className:ce.sectionCount,children:S.length})]}),o.jsx("div",{className:ce.sectionBody,children:S.length===0?o.jsx("div",{className:ce.emptyHint,children:"All clear"}):S.map(({task:N,reason:T,workspaceName:C})=>o.jsxs("button",{type:"button",className:ce.attentionRow,onClick:()=>g(In(N.id)),"data-testid":"attention-row",children:[o.jsxs("div",{className:ce.attentionTitle,children:[o.jsx("span",{className:ce.reasonBadge,"data-reason":T,children:T}),N.title]}),o.jsx("div",{className:ce.attentionMeta,children:o.jsx("span",{children:C})})]},N.id))})]})]}),o.jsxs("div",{className:ce.bottomGrid,children:[o.jsxs(Rt.div,{className:ce.section,variants:Hc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"◈"}),o.jsx("span",{className:ce.sectionTitle,children:"Environment Health"}),o.jsx("span",{className:ce.sectionCount,children:p.length})]}),o.jsx("div",{className:ce.sectionBody,children:p.length===0?o.jsx("div",{className:ce.emptyHint,children:"No environments configured"}):p.map(N=>o.jsxs("div",{className:ce.envRow,"data-testid":"dashboard-env-row",children:[o.jsx("span",{className:ce.envName,children:N.displayName}),o.jsx("span",{className:ce.envStatusBadge,"data-status":N.status,children:N.status})]},N.id))})]}),o.jsxs(Rt.div,{className:ce.section,variants:Hc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"▦"}),o.jsx("span",{className:ce.sectionTitle,children:"Workspaces"}),o.jsx("span",{className:ce.sectionCount,children:t.length})]}),o.jsx("div",{className:ce.sectionBody,children:k.length===0?o.jsx("div",{className:ce.emptyHint,children:"No workspaces yet"}):k.map(({workspace:N,totalTasks:T,completedTasks:C,workingTasks:D,failedTasks:L})=>{const E=T>0?Math.round(C/T*100):0;return o.jsxs("button",{type:"button",className:ce.workspaceRow,onClick:()=>g(ki(N.id,N.environmentId)),"data-testid":"workspace-row",children:[o.jsxs("div",{className:ce.workspaceTop,children:[o.jsx("span",{className:ce.workspaceName,children:N.name}),o.jsxs("span",{className:ce.workspaceCounts,"aria-label":G7(C,T,D,L),children:[C,"/",T,D>0&&o.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",D]}),L>0&&o.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",L]})]})]}),T>0&&o.jsx("div",{className:ce.progressBar,children:o.jsx("div",{className:ce.progressFill,style:{width:`${E}%`}})})]},N.id)})})]})]})]})}const Z7="_panelContainer_msib4_1",K7="_emptyState_msib4_8",Y7="_workspaceSummary_msib4_17",J7="_workspaceSummaryTitle_msib4_28",W7="_workspaceSummarySubtitle_msib4_32",X7="_header_msib4_36",Q7="_headerInfo_msib4_71",eU="_headerTitle_msib4_106",tU="_taskStatusBadge_msib4_128",nU="_taskBranch_msib4_137",sU="_taskBlockedBadge_msib4_143",aU="_tabBar_msib4_277",iU="_tab_msib4_277",oU="_active_msib4_303",rU="_eventScroll_msib4_308",lU="_tabContent_msib4_314",cU="_noContext_msib4_319",dU="_overviewContent_msib4_325",uU="_overviewDashboard_msib4_334",fU="_overviewHero_msib4_340",pU="_overviewSection_msib4_347",mU="_overviewLabel_msib4_353",hU="_envRow_msib4_360",gU="_timeline_msib4_366",vU="_timelineRow_msib4_372",yU="_waitingMessage_msib4_379",bU="_errorMessage_msib4_383",_U="_emptyCta_msib4_387",xU="_ctaTitle_msib4_399",kU="_ctaDescription_msib4_405",SU="_ctaButton_msib4_412",TU="_workspaceHeader_msib4_533",wU="_workspaceName_msib4_558",jU="_workspaceMeta_msib4_571",NU="_metaRow_msib4_579",CU="_metaLabel_msib4_592",EU="_metaValue_msib4_607",AU="_archiveButton_msib4_617",DU="_repoLink_msib4_647",RU="_metaToggle_msib4_657",MU="_metaToggleArrow_msib4_678",IU="_metaToggleArrowOpen_msib4_683",OU="_progressBarContainer_msib4_687",LU="_progressBar_msib4_687",BU="_progressFill_msib4_703",zU="_progressLabel_msib4_710",UU="_metaTimestamps_msib4_717",$U="_metaTimestamp_msib4_717",J={panelContainer:Z7,emptyState:K7,workspaceSummary:Y7,workspaceSummaryTitle:J7,workspaceSummarySubtitle:W7,header:X7,headerInfo:Q7,headerTitle:eU,taskStatusBadge:tU,taskBranch:nU,taskBlockedBadge:sU,tabBar:aU,tab:iU,active:oU,eventScroll:rU,tabContent:lU,noContext:cU,overviewContent:dU,overviewDashboard:uU,overviewHero:fU,overviewSection:pU,overviewLabel:mU,envRow:hU,timeline:gU,timelineRow:vU,waitingMessage:yU,errorMessage:bU,emptyCta:_U,ctaTitle:xU,ctaDescription:kU,ctaButton:SU,workspaceHeader:TU,workspaceName:wU,workspaceMeta:jU,metaRow:NU,metaLabel:CU,metaValue:EU,archiveButton:AU,repoLink:DU,metaToggle:RU,metaToggleArrow:MU,metaToggleArrowOpen:IU,progressBarContainer:OU,progressBar:LU,progressFill:BU,progressLabel:zU,metaTimestamps:UU,metaTimestamp:$U};function PU(){return o.jsx("div",{className:J.emptyState,children:"Select a task or click + to create one"})}function HU(){return o.jsx("div",{className:J.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function VU(){const{workspaces:{workspaces:t},environments:{environments:s}}=ut(),i=xt(),r=s.length>0;return t.length>0?o.jsx(F7,{}):o.jsxs("div",{className:J.emptyCta,"data-testid":"welcome-cta",children:[o.jsx("div",{className:J.ctaTitle,children:"Welcome to Grackle"}),o.jsx("div",{className:J.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),o.jsx("button",{className:J.ctaButton,onClick:()=>i(M_),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&o.jsx("div",{className:J.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const qU="_panelContainer_19poq_1",GU="_chatHeader_19poq_8",FU="_chatHeaderInfo_19poq_37",ZU="_emptyState_19poq_43",KU="_emptyTitle_19poq_55",YU="_emptyDescription_19poq_61",JU="_emptyHint_19poq_67",La={panelContainer:qU,chatHeader:GU,chatHeaderInfo:FU,emptyState:ZU,emptyTitle:KU,emptyDescription:YU,emptyHint:JU};function WU(){return o.jsx("div",{className:La.panelContainer,"aria-hidden":"true",children:o.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[o.jsx(xe,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function XU({hasLocalEnvironment:t}){return o.jsxs("div",{className:La.emptyState,"data-testid":"chat-empty-state",children:[o.jsx("div",{className:La.emptyTitle,children:"Welcome to Grackle"}),o.jsx("div",{className:La.emptyDescription,children:t?"Type a message below to start chatting with the System agent. It can help you plan work, create tasks, and coordinate agents.":"Add a local environment in Settings to start chatting."}),!t&&o.jsx("div",{className:La.emptyHint,children:"Go to Settings → Environments to add one."})]})}function QU(){const{tasks:{tasks:t,tasksLoading:s,startTask:i},sessions:{sessions:r,sessionsLoading:c,events:d,eventsDropped:u,taskSessions:p,loadTaskSessions:m,loadSessionEvents:g,kill:v,stopGraceful:b,sendInput:_,spawn:S},environments:{environments:k,provisionEnvironment:w},personas:{personas:N}}=ut(),{showToast:T}=Tn(),C=y.useRef(void 0),[D,L]=y.useState(),E=t.find(P=>P.id===Ar),I=E!=null&&E.latestSessionId?r.find(P=>P.id===E.latestSessionId)??(p[Ar]??[]).find(P=>P.id===E.latestSessionId):void 0;y.useEffect(()=>{m(Ar).catch(()=>{})},[m]),y.useEffect(()=>{E!=null&&E.latestSessionId&&m(Ar).catch(()=>{})},[E==null?void 0:E.latestSessionId,m]),y.useEffect(()=>{I&&I.id!==C.current&&(C.current=I.id,g(I.id).catch(()=>{}))},[I==null?void 0:I.id,g]);const O=y.useMemo(()=>{if(!I)return[];const P=d.filter(ae=>ae.sessionId===I.id);return nh(th(P))},[d,I==null?void 0:I.id]),z=k.find(P=>P.adapterType==="local"&&P.status==="connected"),$=I!==void 0&&I.status!=="stopped"&&I.status!=="suspended",X=(I==null?void 0:I.status)==="idle";y.useEffect(()=>{D&&I&&X&&(_(I.id,D).catch(()=>{}),L(void 0))},[D,X,I==null?void 0:I.id,_]);const te=y.useCallback((P,ae,K,re)=>{re&&L(re),i(P,ae,K).catch(()=>{})},[i]);return!E&&(c||s)?o.jsx(WU,{}):o.jsxs("div",{className:La.panelContainer,"data-testid":"chat-page",children:[$&&o.jsxs("div",{className:La.chatHeader,children:[o.jsxs("span",{className:La.chatHeaderInfo,children:["Session: ",I.id.slice(0,8)," | ",I.runtime," | ",I.status]}),o.jsx(O_,{label:"Stop",onClick:()=>{b(I.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{b(I.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{v(I.id).catch(()=>{})}}]})]}),o.jsx(Jm,{events:O,eventsDropped:u,emptyState:o.jsx(XU,{hasLocalEnvironment:!!z}),onShowToast:T}),z&&$&&o.jsx(Wr,{mode:"send",sessionId:I.id,environmentId:I.environmentId,personas:N,environments:k,onSendInput:(P,ae)=>{_(P,ae).catch(()=>{})},onSpawn:(P,ae,K)=>{S(P,ae,K).catch(()=>{})},onStartTask:(P,ae,K)=>{i(P,ae,K).catch(()=>{})},onProvisionEnvironment:P=>{w(P).catch(()=>{})},onShowToast:T}),z&&!$&&o.jsx(Wr,{mode:"start",taskId:Ar,environmentId:z.id,personas:N,environments:k,onSendInput:(P,ae)=>{_(P,ae).catch(()=>{})},onSpawn:(P,ae,K)=>{S(P,ae,K).catch(()=>{})},onStartTask:te,onProvisionEnvironment:P=>{w(P).catch(()=>{})},onShowToast:T})]})}function e$(){const t=pz(),[s]=pm(),i=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=ut(),{showToast:g}=Tn();return o.jsxs("div",{className:J.panelContainer,children:[o.jsx(js,{segments:t}),o.jsx("div",{className:J.emptyState,children:"Enter a prompt below to start a new session"}),o.jsx(Wr,{mode:"spawn",environmentId:i,showPersonaSelect:!0,personas:u,environments:p,onSendInput:(v,b)=>{r(v,b).catch(()=>{})},onSpawn:(v,b,_)=>{c(v,b,_).catch(()=>{})},onStartTask:(v,b,_)=>{d(v,b,_).catch(()=>{})},onProvisionEnvironment:v=>{m(v).catch(()=>{})},onShowToast:g})]})}function t$(){return o.jsxs("div",{className:J.panelContainer,"aria-hidden":"true",children:[o.jsxs("div",{className:J.header,children:[o.jsx("span",{children:o.jsx(xe,{width:"10rem",height:"0.875rem"})}),o.jsx("span",{className:J.headerInfo,children:o.jsx(xe,{width:"16rem",height:"0.875rem"})})]}),o.jsx("div",{className:J.eventScroll,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[o.jsx(xe,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function n$({sessionId:t,session:s,isActive:i,onStop:r,onKill:c}){return o.jsxs("div",{className:J.header,children:[o.jsxs("span",{children:["Session: ",t.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costUsd?` | ${L_((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${Do(s.costUsd??0)}`:""]}),o.jsxs("span",{className:J.headerInfo,children:[s&&o.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),i&&o.jsx(O_,{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 s$({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),i=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return o.jsx("div",{className:s?J.errorMessage:J.waitingMessage,children:i})}function a$(){const{sessionId:t}=ms(),{sessions:{events:s,eventsDropped:i,sessions:r,sessionsLoading:c,kill:d,stopGraceful:u,loadSessionEvents:p,sendInput:m,spawn:g},tasks:{startTask:v},personas:{personas:b},environments:{environments:_,provisionEnvironment:S}}=ut(),{showToast:k}=Tn(),w=y.useRef(void 0),N=mz(t),T=r.find(L=>L.id===t)??void 0,C=y.useMemo(()=>{const L=t?s.filter(E=>E.sessionId===t):[];return nh(th(L))},[s,t]);if(y.useEffect(()=>{t&&t!==w.current&&(w.current=t,p(t).catch(()=>{}))},[t,p]),!T&&c)return o.jsx(t$,{});if(!t)return o.jsx("div",{className:J.emptyState,children:"No session selected"});const D=(T==null?void 0:T.status)==="running"||(T==null?void 0:T.status)==="idle";return o.jsxs("div",{className:J.panelContainer,children:[o.jsx(js,{segments:N}),o.jsx(n$,{sessionId:t,session:T,isActive:D,onStop:()=>{u(t).catch(()=>{})},onKill:()=>{d(t).catch(()=>{})}}),o.jsx(Jm,{events:C,eventsDropped:i,emptyState:o.jsx(s$,{session:T}),onShowToast:k}),D&&o.jsx(Wr,{mode:"send",sessionId:t,environmentId:T.environmentId,personas:b,environments:_,onSendInput:(L,E)=>{m(L,E).catch(()=>{})},onSpawn:(L,E,I)=>{g(L,E,I).catch(()=>{})},onStartTask:(L,E,I)=>{v(L,E,I).catch(()=>{})},onProvisionEnvironment:L=>{S(L).catch(()=>{})},onShowToast:k})]})}function i$(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Qs(t,s){const i=y.useRef(s);i.current=s;const{key:r,ctrl:c=!1,shift:d=!1,suppressInInputs:u=!0,enabled:p=!0}=t;y.useEffect(()=>{if(!p)return;const m=g=>{if(u&&i$(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(d&&!g.shiftKey||g.key===r&&i.current())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[r,c,d,u,p])}function o$(){return o.jsxs("div",{className:J.panelContainer,"aria-hidden":"true",children:[o.jsx("div",{className:J.workspaceHeader,children:o.jsx("span",{className:J.workspaceName,children:o.jsx(xe,{width:"12rem",height:"1.25rem"})})}),o.jsx("div",{className:J.metaToggle,style:{cursor:"default"},children:o.jsx(xe,{width:"4rem",height:"0.625rem"})}),o.jsxs("div",{className:J.progressBarContainer,children:[o.jsx("div",{className:J.progressBar,children:o.jsx("div",{className:J.progressFill,style:{width:"0%"}})}),o.jsx(xe,{width:"2rem",height:"0.625rem"})]}),o.jsxs("div",{className:J.tabBar,role:"tablist","aria-label":"Workspace view",children:[o.jsx("span",{className:`${J.tab} ${J.active}`,children:"Graph"}),o.jsx("span",{className:J.tab,children:"Board"}),o.jsx("span",{className:J.tab,children:"Tasks"})]}),o.jsx("div",{className:J.overviewContent,children:Array.from({length:3},(t,s)=>o.jsx(ld,{lines:2},s))})]})}function Wb(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 jp=100;function r$(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function l$(){const{workspaceId:t,environmentId:s}=ms(),i=xt(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:p,updateWorkspace:m},personas:{personas:g},sessions:{sessions:v},usageCache:b,loadUsage:_}=ut(),{resolvedThemeId:S}=R1(),[k,w]=y.useState("tasks"),[N,T]=y.useState(!1),[C,D]=y.useState(null),[L,E]=y.useState(!1),I=y.useRef(void 0),O=d.find(A=>A.id===t),z=s??(O==null?void 0:O.environmentId)??"",$=hz(t,z,d,c);Qs({key:"1"},()=>w("graph")),Qs({key:"2"},()=>w("board")),Qs({key:"3"},()=>w("tasks")),y.useEffect(()=>{const A=I.current;I.current=t,!(A===void 0||A===t)&&C!==null&&D(null)},[t,C]);const X=v.reduce((A,F)=>A+(F.costUsd??0),0);y.useEffect(()=>{t&&_("workspace",t).catch(()=>{})},[t,_,X]);const te=t?b[`workspace:${t}`]:void 0,P=r.filter(A=>A.workspaceId===t),ae=P.filter(A=>A.status==="complete").length,K=P.length,re=K>0?Math.round(ae/K*100):0;return!O&&u?o.jsx(o$,{}):o.jsxs("div",{className:J.panelContainer,children:[o.jsx(js,{segments:$}),o.jsxs("div",{className:J.workspaceHeader,children:[o.jsx("span",{className:J.workspaceName,"data-testid":"workspace-name",children:o.jsx(ln,{value:(O==null?void 0:O.name)||"",onSave:A=>{O&&m(O.id,{name:A}).catch(()=>{})},validate:A=>{const F=A.trim();if(!F)return"Name is required";if(F.length>jp)return`Max ${jp} characters`},maxLength:jp,fieldId:"name",activeFieldId:C,onActivate:D,ariaLabel:"Workspace name",renderDisplay:A=>A||t||void 0,"data-testid":"edit-name"})}),o.jsx("button",{className:J.archiveButton,onClick:()=>T(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),o.jsxs("button",{className:J.metaToggle,onClick:()=>E(!L),"aria-expanded":!L,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[o.jsx("span",{className:`${J.metaToggleArrow} ${L?"":J.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!L&&o.jsxs("div",{className:J.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[o.jsxs("div",{className:J.metaRow,children:[o.jsx("span",{className:J.metaLabel,children:"Description"}),o.jsx("div",{className:J.metaValue,children:o.jsx(Wp,{value:(O==null?void 0:O.description)||"",onSave:A=>{O&&m(O.id,{description:A}).catch(()=>{})},fieldId:"description",activeFieldId:C,onActivate:D,renderDisplay:A=>A?o.jsx("span",{className:J.overviewMarkdown,children:o.jsx(pd,{remarkPlugins:[md],children:A})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),o.jsxs("div",{className:J.metaRow,children:[o.jsx("span",{className:J.metaLabel,children:"Repository"}),o.jsx("div",{className:J.metaValue,children:o.jsx(ln,{value:(O==null?void 0:O.repoUrl)||"",onSave:A=>{O&&m(O.id,{repoUrl:A}).catch(()=>{})},validate:A=>{const F=A.trim();if(F&&!/^https?:\/\/.+/.test(F))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:C,onActivate:D,renderDisplay:A=>{const F=r$(A);return F?o.jsx("a",{className:J.repoLink,href:F,target:"_blank",rel:"noopener noreferrer",onClick:oe=>oe.stopPropagation(),children:A}):A?o.jsx("span",{children:A}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),o.jsxs("div",{className:J.metaRow,children:[o.jsx("span",{className:J.metaLabel,children:"Environment"}),o.jsx("div",{className:J.metaValue,children:o.jsx(D6,{value:(O==null?void 0:O.environmentId)||"",onSave:A=>{O&&A&&m(O.id,{environmentId:A}).catch(()=>{})},environments:c,fieldId:"environmentId",activeFieldId:C,onActivate:D,placeholder:"Select environment",ariaLabel:"Workspace environment","data-testid":"edit-env"})})]}),o.jsxs("div",{className:J.metaRow,children:[o.jsx("span",{className:J.metaLabel,children:"Persona"}),o.jsx("div",{className:J.metaValue,children:o.jsx(cd,{value:(O==null?void 0:O.defaultPersonaId)||"",onSave:A=>{O&&m(O.id,{defaultPersonaId:A}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...g.map(A=>({value:A.id,label:A.name}))],fieldId:"defaultPersonaId",activeFieldId:C,onActivate:D,renderDisplay:A=>{const F=g.find(oe=>oe.id===A);if(F)return o.jsx("span",{children:F.name})},placeholder:(O==null?void 0:O.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),o.jsxs("div",{className:J.metaRow,children:[o.jsx("span",{className:J.metaLabel,children:"Worktrees"}),o.jsx("div",{className:J.metaValue,children:o.jsx(S6,{checked:(O==null?void 0:O.useWorktrees)??!0,onChange:A=>{O&&m(O.id,{useWorktrees:A}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),o.jsxs("div",{className:J.metaRow,children:[o.jsx("span",{className:J.metaLabel,children:"Working Dir"}),o.jsx("div",{className:J.metaValue,children:o.jsx(ln,{value:(O==null?void 0:O.workingDirectory)||"",onSave:A=>{O&&m(O.id,{workingDirectory:A}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:C,onActivate:D,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),O&&o.jsxs("div",{className:J.metaTimestamps,children:[o.jsxs("span",{className:J.metaTimestamp,children:["Created ",Wb(O.createdAt)]}),O.updatedAt&&O.updatedAt!==O.createdAt&&o.jsxs("span",{className:J.metaTimestamp,children:["· Updated ",Wb(O.updatedAt)]})]})]}),K>0&&o.jsxs("div",{className:J.progressBarContainer,"data-testid":"progress-bar",children:[o.jsx("div",{className:J.progressBar,children:o.jsx("div",{className:J.progressFill,style:{width:`${re}%`}})}),o.jsxs("span",{className:J.progressLabel,children:[ae,"/",K]})]}),te&&te.costUsd>0&&o.jsx("div",{className:J.progressBarContainer,children:o.jsxs("span",{className:J.progressLabel,children:["Usage: ",Do(te.costUsd)," (",te.sessionCount," session",te.sessionCount!==1?"s":"",")"]})}),o.jsxs("div",{className:J.tabBar,role:"tablist","aria-label":"Workspace view",children:[o.jsx("button",{role:"tab","aria-selected":k==="graph",className:`${J.tab} ${k==="graph"?J.active:""}`,onClick:()=>w("graph"),children:"Graph"}),o.jsx("button",{role:"tab","aria-selected":k==="board",className:`${J.tab} ${k==="board"?J.active:""}`,onClick:()=>w("board"),"data-testid":"board-tab",children:"Board"}),o.jsx("button",{role:"tab","aria-selected":k==="tasks",className:`${J.tab} ${k==="tasks"?J.active:""}`,onClick:()=>w("tasks"),children:"Tasks"})]}),k==="tasks"&&K>0&&o.jsxs("div",{className:J.workspaceSummary,children:[o.jsx("span",{className:J.workspaceSummaryTitle,children:`${ae}/${K} tasks complete`}),o.jsx("span",{className:J.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),k==="tasks"&&K===0&&o.jsxs("div",{className:J.emptyCta,children:[o.jsx("button",{className:J.ctaButton,onClick:()=>i(Ci(t,void 0,z)),children:"Create Task"}),o.jsx("div",{className:J.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),k==="board"&&o.jsx(z8,{workspaceId:t,environmentId:z,tasks:r,sessions:v,personas:g,environments:c}),k==="graph"&&o.jsx(lN,{workspaceId:t,environmentId:z,tasks:r,resolvedThemeId:S}),o.jsx(wi,{isOpen:N,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{O&&(p(O.id).catch(()=>{}),i("/",{replace:!0})),T(!1)},onCancel:()=>T(!1)})]})}const c$="_container_3pgew_1",d$="_header_3pgew_8",u$="_headerTitle_3pgew_35",f$="_headerActions_3pgew_44",p$="_body_3pgew_51",m$="_btnPrimary_3pgew_63",h$="_btnGhost_3pgew_94",g$="_error_3pgew_116",Ma={container:c$,header:d$,headerTitle:u$,headerActions:f$,body:p$,btnPrimary:m$,btnGhost:h$,error:g$};function v$(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 y$=[{label:"Home",url:Ti},{label:"New Workspace",url:void 0}];function b$(){const[t]=pm(),s=t.get("environment")??void 0,{environments:{environments:i},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=ut(),{showToast:u}=Tn(),p=xt(),[m,g]=y.useState(()=>{var N;return Y8(void 0,s||((N=i[0])==null?void 0:N.id))}),[v,b]=y.useState(),[_,S]=y.useState();y.useEffect(()=>{s||m.environmentId||i.length===0||g(N=>{var T;return N.environmentId?N:{...N,environmentId:((T=i[0])==null?void 0:T.id)??""}})},[i,s,m.environmentId]);const k=()=>{const N=v$(m);if(N){b(N),S(void 0);return}b(void 0),S(void 0),c(m.name.trim(),m.description,m.repoUrl.trim(),m.environmentId,m.defaultPersonaId,m.useWorktrees,m.workingDirectory,()=>{u("Workspace created","success"),p(Ti,{replace:!0})},T=>{S(T)}).catch(()=>{})},w=()=>{p(s?Si(s):Ti,{replace:!0})};return o.jsxs("div",{className:Ma.container,children:[o.jsxs("div",{className:Ma.header,children:[o.jsx("div",{className:Ma.headerTitle,children:o.jsx(js,{segments:y$})}),o.jsxs("div",{className:Ma.headerActions,children:[o.jsx("button",{className:Ma.btnGhost,onClick:w,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),o.jsx("button",{className:Ma.btnPrimary,onClick:k,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?o.jsx(f1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),o.jsxs("div",{className:Ma.body,children:[o.jsx(W8,{values:m,onChange:N=>{g(N),b(void 0),S(void 0)},environments:i,personas:r,errors:v,disabled:d,autoFocusName:!0}),_&&o.jsx("div",{className:Ma.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function Xb(){const{workspaceId:t,environmentId:s}=ms(),[i]=pm(),r=t??i.get("workspace")??"",c=i.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:p},workspaces:{workspaces:m},personas:{personas:g}}=ut(),{showToast:v}=Tn();return o.jsx(w1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(b,_,S,k,w,N,T,C,D)=>{u(b,_,S,k,w,N,T,C,D).catch(()=>{})},onUpdateTask:(b,_,S,k,w)=>{p(b,_,S,k,w).catch(()=>{})},onShowToast:v})}function _$(){return o.jsxs("div",{className:J.panelContainer,"aria-hidden":"true",children:[o.jsx("div",{className:J.header,children:o.jsxs("span",{className:J.headerTitle,children:[o.jsx(xe,{width:"12rem",height:"1rem"}),o.jsx(xe,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),o.jsxs("div",{className:J.tabBar,role:"tablist","aria-label":"Task view",children:[o.jsx("span",{className:`${J.tab} ${J.active}`,children:"Overview"}),o.jsx("span",{className:J.tab,children:"Stream"}),o.jsx("span",{className:J.tab,children:"Findings"})]}),o.jsx("div",{className:J.overviewContent,children:o.jsxs("div",{className:J.overviewDashboard,children:[o.jsx("div",{className:J.overviewHero,children:o.jsx(xe,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),o.jsxs("div",{className:J.overviewSection,children:[o.jsx("div",{className:J.overviewLabel,children:"Description"}),o.jsx(Jp,{lines:2})]}),o.jsxs("div",{className:J.overviewSection,children:[o.jsx("div",{className:J.overviewLabel,children:"Environment"}),o.jsxs("div",{className:J.envRow,children:[o.jsx(xe,{width:"0.5rem",height:"0.5rem",variant:"circular"}),o.jsx(xe,{width:"8rem",height:"0.875rem"})]})]}),o.jsxs("div",{className:J.overviewSection,children:[o.jsx("div",{className:J.overviewLabel,children:"Dependencies"}),o.jsx(Jp,{lines:2})]}),o.jsxs("div",{className:J.overviewSection,children:[o.jsx("div",{className:J.overviewLabel,children:"Timeline"}),o.jsx("div",{className:J.timeline,children:Array.from({length:4},(t,s)=>o.jsxs("div",{className:J.timelineRow,children:[o.jsx(xe,{width:"4rem",height:"0.75rem"}),o.jsx(xe,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function Ia(){const{taskId:t,workspaceId:s,environmentId:i}=ms(),r=Zt(),c=xt(),{showToast:d}=Tn(),{sessions:{events:u,eventsDropped:p,sessions:m,loadSessionEvents:g,taskSessions:v,loadTaskSessions:b,sendInput:_,spawn:S,kill:k},tasks:{tasks:w,tasksLoading:N,startTask:T,stopTask:C,resumeTask:D,deleteTask:L,createTask:E,updateTask:I},environments:{environments:O,provisionEnvironment:z},findings:{findings:$,loadFindings:X},workspaces:{workspaces:te},personas:{personas:P},usageCache:ae,loadUsage:K}=ut(),re=y.useRef(void 0),A=y.useRef(void 0),F=y.useRef(void 0),oe=y.useRef(void 0),pe=y.useRef(void 0),de=r.pathname.endsWith("/stream")?"stream":r.pathname.endsWith("/findings")?"findings":"overview",Oe=r.pathname.endsWith("/edit"),[ke,Ce]=y.useState(de),[ze,ue]=y.useState(!1),[_e,me]=y.useState(void 0),[Be,mt]=y.useState(""),[vn,se]=y.useState(Oe),qe=y.useRef(de),Nt=y.useRef(Oe),Y=w.find(Ae=>Ae.id===t),wt=(Y==null?void 0:Y.workspaceId)||void 0,Vt=te.find(Ae=>Ae.id===wt);y.useEffect(()=>{de!==qe.current&&(qe.current=de,de!==ke&&Ce(de))},[de,ke]),y.useEffect(()=>{Oe!==Nt.current&&(Nt.current=Oe,Oe!==vn&&se(Oe))},[Oe,vn]),y.useEffect(()=>{if(Be===""){if(Vt!=null&&Vt.environmentId)mt(Vt.environmentId);else if(O.length>0){const Ae=O.find(Ke=>Ke.status==="connected");mt((Ae==null?void 0:Ae.id)??O[0].id)}}},[Be,Vt==null?void 0:Vt.environmentId,O]);const es=Y?v[Y.id]??[]:[];let ft;_e&&es.some(Ae=>Ae.id===_e)?ft=_e:ft=(Y==null?void 0:Y.latestSessionId)||void 0;const hs=()=>{ue(!0)},aa=()=>{if(!Y)return;L(Y.id).catch(()=>{}),ue(!1);const Ae=i??(Vt==null?void 0:Vt.environmentId);c(Y.workspaceId&&Ae?ki(Y.workspaceId,Ae):"/",{replace:!0})};y.useEffect(()=>{(Y==null?void 0:Y.id)!==A.current&&(A.current=Y==null?void 0:Y.id,me(void 0),mt(""),se(Oe))},[Y==null?void 0:Y.id,Oe]),y.useEffect(()=>{if(!(Y!=null&&Y.id))return;const Ae=Y.id!==oe.current,Ke=Y.latestSessionId!==pe.current;(Ae||Ke)&&(oe.current=Y.id,pe.current=Y.latestSessionId,b(Y.id).catch(()=>{}))},[Y==null?void 0:Y.id,Y==null?void 0:Y.latestSessionId,b]),y.useEffect(()=>{if((Y==null?void 0:Y.status)!==F.current){const Ae=F.current===void 0;F.current=Y==null?void 0:Y.status;const Ke=(Y==null?void 0:Y.status)==="not_started"?"overview":(Y==null?void 0:Y.status)==="working"||(Y==null?void 0:Y.status)==="paused"?"stream":(Y==null?void 0:Y.status)==="complete"?"findings":void 0;Ke&&Ke!==ke&&!(Ae&&de!=="overview")&&Ce(Ke)}},[Y==null?void 0:Y.status,ke,de]);const ts=y.useMemo(()=>new Map(w.map(Ae=>[Ae.id,Ae])),[w]),Ga=y.useMemo(()=>{const Ae=ft?u.filter(Ke=>Ke.sessionId===ft):[];return nh(th(Ae))},[u,ft]),ia=Y?Y.dependsOn.some(Ae=>{const Ke=ts.get(Ae);return Ke!==void 0&&Ke.status!=="complete"}):!1,Kt=y.useMemo(()=>gz(t,i,te,O,ts),[t,i,te,O,ts]);y.useEffect(()=>{ft&&ft!==re.current&&(re.current=ft,g(ft).catch(()=>{}))},[ft,g]),y.useEffect(()=>{ke==="findings"&&wt&&X(wt).catch(()=>{})},[ke,wt,X]);const Ai=es.reduce((Ae,Ke)=>Ae+(Ke.costUsd??0),0);y.useEffect(()=>{Y&&(K("task",Y.id).catch(()=>{}),Y.childTaskIds.length>0&&K("task_tree",Y.id).catch(()=>{}))},[Y==null?void 0:Y.id,Y==null?void 0:Y.childTaskIds.length,K,Ai]);const oa=Y?`task:${Y.id}`:"",Fa=oa in ae?ae[oa]:void 0,ns=Y?`task_tree:${Y.id}`:"",Di=Y&&Y.childTaskIds.length>0&&ns in ae?ae[ns]:void 0,Bn=Ae=>{Ce(Ae),c(In(t,Ae==="overview"?void 0:Ae,s,i))};return Qs({key:"1"},()=>Bn("overview")),Qs({key:"2"},()=>Bn("stream")),Qs({key:"3"},()=>Bn("findings")),!Y&&N?o.jsx(_$,{}):o.jsxs("div",{className:J.panelContainer,children:[o.jsx(js,{segments:Kt}),o.jsxs("div",{className:J.header,children:[o.jsxs("span",{className:J.headerTitle,children:[o.jsx("span",{"data-testid":"task-title",children:(Y==null?void 0:Y.title)||t}),Y&&o.jsx("span",{className:J.taskStatusBadge,"data-testid":"task-status",children:Y.status}),(Y==null?void 0:Y.branch)&&o.jsx("span",{className:J.taskBranch,children:Y.branch}),ia&&o.jsx("span",{className:J.taskBlockedBadge,children:"blocked"})]}),Y&&o.jsx(mL,{task:Y,sessionId:ft,isBlocked:ia,onStart:()=>{T(Y.id,void 0,Be).catch(()=>{})},onResume:()=>{D(Y.id).catch(()=>{})},onStop:()=>{C(Y.id).catch(()=>{})},onPause:()=>{ft&&k(ft).catch(()=>{})},onDelete:hs,onEdit:()=>se(!0)})]}),o.jsxs("div",{className:J.tabBar,role:"tablist","aria-label":"Task view",children:[o.jsx("button",{role:"tab","aria-selected":ke==="overview",className:`${J.tab} ${ke==="overview"?J.active:""}`,onClick:()=>Bn("overview"),children:"Overview"}),o.jsx("button",{role:"tab","aria-selected":ke==="stream",className:`${J.tab} ${ke==="stream"?J.active:""}`,onClick:()=>Bn("stream"),children:"Stream"}),o.jsx("button",{role:"tab","aria-selected":ke==="findings",className:`${J.tab} ${ke==="findings"?J.active:""}`,onClick:()=>Bn("findings"),children:"Findings"})]}),o.jsxs(ps,{mode:"wait",children:[ke==="overview"&&o.jsx(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:J.overviewContent,"data-testid":"task-overview",children:vn&&Y?o.jsx(w1,{mode:"edit",taskId:Y.id,workspaceId:wt,environmentId:i,tasks:w,workspaces:te,personas:P,onCreateTask:(Ae,Ke,Yt,kt,un,Jt,Ri,Mi,Ii)=>{E(Ae,Ke,Yt,kt,un,Jt,Ri,Mi,Ii).catch(()=>{})},onUpdateTask:(Ae,Ke,Yt,kt,un)=>{I(Ae,Ke,Yt,kt,un).catch(()=>{})},onEditDone:()=>{Oe?c(In(Y.id,void 0,s,i),{replace:!0}):se(!1)},onShowToast:d}):Y?o.jsx(tB,{task:Y,tasksById:ts,environments:O,workspaces:te,taskSessions:es,selectedEnvId:Be,taskUsage:Fa,treeUsage:Di}):o.jsx("div",{className:J.waitingMessage,children:"No additional details"})},"overview"),ke==="stream"&&o.jsxs(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[o.jsx(C4,{taskSessions:es,selectedSessionId:ft,onSelect:Ae=>me(Ae)}),o.jsx(Jm,{events:Ga,eventsDropped:p,emptyState:!ft&&Y?ia?o.jsx("div",{className:J.emptyCta,"data-testid":"stream-blocked-message",children:o.jsx("div",{className:J.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):o.jsxs("div",{className:J.emptyCta,children:[o.jsx("button",{"data-testid":"stream-start-cta",className:J.ctaButton,onClick:()=>{T(Y.id,void 0,Be).catch(()=>{})},children:"Start Task"}),o.jsx("div",{className:J.ctaDescription,children:"Click to begin agent execution"})]}):ft&&Ga.length===0?o.jsx("div",{className:J.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:d})]},"stream"),ke==="findings"&&o.jsx(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:J.tabContent,children:wt?o.jsx(S1,{findings:$.filter(Ae=>Ae.workspaceId===wt)}):o.jsx("div",{className:J.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!Y||Y.status!=="working"&&Y.status!=="paused")return;const Ae=ft?m.find(Ke=>Ke.id===ft):void 0;if(!(!Ae||Ae.status==="stopped"))return o.jsx(Wr,{mode:"send",sessionId:Ae.id,environmentId:Ae.environmentId,personas:P,environments:O,onSendInput:(Ke,Yt)=>{_(Ke,Yt).catch(()=>{})},onSpawn:(Ke,Yt,kt)=>{S(Ke,Yt,kt).catch(()=>{})},onStartTask:(Ke,Yt,kt)=>{T(Ke,Yt,kt).catch(()=>{})},onProvisionEnvironment:Ke=>{z(Ke).catch(()=>{})},onShowToast:d})})(),Y&&o.jsx(wi,{isOpen:ze,title:"Delete Task?",description:`"${Y.title}" will be permanently removed.`,onConfirm:aa,onCancel:()=>ue(!1)})]})}function x$(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:i},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:p,createCodespace:m}}=ut(),{showToast:g}=Tn();return o.jsx(j1,{mode:"new",environments:t,onAddEnvironment:(v,b,_)=>{s(v,b,_).catch(()=>{})},onUpdateEnvironment:(v,b)=>{i(v,b).catch(()=>{})},onListCodespaces:()=>{p().catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(v,b)=>{m(v,b).catch(()=>{})},onShowToast:g})}function k$(){const{environmentId:t}=ms(),{environments:{environments:s,addEnvironment:i,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,listCodespaces:m,createCodespace:g}}=ut(),{showToast:v}=Tn();return o.jsx(j1,{mode:"edit",environmentId:t,environments:s,onAddEnvironment:(b,_,S)=>{i(b,_,S).catch(()=>{})},onUpdateEnvironment:(b,_)=>{r(b,_).catch(()=>{})},onListCodespaces:()=>{m().catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:(b,_)=>{g(b,_).catch(()=>{})},onShowToast:v})}const S$="_layout_11u79_1",T$="_content_11u79_8",w$="_tabPanel_11u79_14",Jr={layout:S$,content:T$,tabPanel:w$};function j$(){const t=fz();return o.jsxs("div",{className:Jr.layout,children:[o.jsx(js,{segments:t}),o.jsx("div",{className:Jr.content,children:o.jsx(Ha,{})})]})}const N$="_container_13sb6_1",C$="_envHeader_13sb6_6",E$="_envTitleRow_13sb6_10",A$="_statusDot_13sb6_16",D$="_envName_13sb6_21",R$="_statusBadge_13sb6_27",M$="_envMeta_13sb6_33",I$="_metaTag_13sb6_39",O$="_actions_13sb6_51",L$="_provisionMessage_13sb6_59",B$="_errorMessage_13sb6_64",z$="_section_13sb6_69",U$="_sectionHeader_13sb6_73",$$="_cardList_13sb6_121",P$="_card_13sb6_121",H$="_cardHeader_13sb6_138",V$="_cardName_13sb6_144",q$="_cardActions_13sb6_149",G$="_cardDescription_13sb6_154",F$="_cardMeta_13sb6_160",Z$="_repoLink_13sb6_166",K$="_empty_13sb6_174",Y$="_btnPrimary_13sb6_180",J$="_btnOutline_13sb6_214",W$="_btnSmall_13sb6_241",X$="_btnDanger_13sb6_267",Re={container:N$,envHeader:C$,envTitleRow:E$,statusDot:A$,envName:D$,statusBadge:R$,envMeta:M$,metaTag:I$,actions:O$,provisionMessage:L$,errorMessage:B$,section:z$,sectionHeader:U$,cardList:$$,card:P$,cardHeader:H$,cardName:V$,cardActions:q$,cardDescription:G$,cardMeta:F$,repoLink:Z$,empty:K$,btnPrimary:Y$,btnOutline:J$,btnSmall:W$,btnDanger:X$};function Q$(){return o.jsxs("div",{className:Re.container,"aria-hidden":"true",children:[o.jsxs("div",{className:Re.envHeader,children:[o.jsxs("div",{className:Re.envTitleRow,children:[o.jsx(xe,{width:"0.875rem",height:"0.875rem",variant:"circular"}),o.jsx(xe,{width:"12rem",height:"1.5rem"}),o.jsx(xe,{width:"4rem",height:"0.875rem"})]}),o.jsxs("div",{className:Re.envMeta,children:[o.jsx(xe,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),o.jsxs("div",{className:Re.actions,children:[o.jsx(xe,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),o.jsxs("div",{className:Re.section,children:[o.jsx("div",{className:Re.sectionHeader,children:o.jsx("h3",{style:{margin:0},children:"Workspaces"})}),o.jsxs("div",{className:Re.cardList,children:[o.jsx(ld,{lines:2}),o.jsx(ld,{lines:2})]})]})]})}const e9={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function t9(){const{environmentId:t}=ms(),s=xt(),{environments:{environments:i,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:p},workspaces:{workspaces:m,archiveWorkspace:g},sessions:{sessions:v}}=ut(),[b,_]=y.useState(!1),[S,k]=y.useState(!1),[w,N]=y.useState(void 0),T=i.find(ae=>ae.id===t);if(!T&&r)return o.jsx(Q$,{});if(!t||!T)return o.jsx(fs,{to:Ao,replace:!0});const C=m.filter(ae=>ae.environmentId===T.id),D=v.filter(ae=>ae.environmentId===T.id),L=D.reduce((ae,K)=>ae+(K.costUsd??0),0),E=e9[T.status]||"var(--text-tertiary)",I=T.status==="connected",O=T.status==="connecting",z=T.status==="disconnected"||T.status==="error"||T.status==="sleeping",$=T.id in c?c[T.id]:void 0,X=()=>{p(T.id).catch(()=>{}),_(!1),s(Ao,{replace:!0})},te=()=>{k(!1),d(T.id,!0).catch(()=>{})},P=ae=>{g(ae).catch(()=>{}),N(void 0)};return o.jsxs("div",{className:Re.container,children:[o.jsx(wi,{isOpen:b,title:"Delete Environment?",description:`"${T.displayName||T.id}" will be permanently removed along with all its data.`,onConfirm:X,onCancel:()=>_(!1)}),o.jsx(wi,{isOpen:S,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:te,onCancel:()=>k(!1)}),o.jsxs("div",{className:Re.envHeader,children:[o.jsxs("div",{className:Re.envTitleRow,children:[o.jsx("span",{className:Re.statusDot,style:{color:E},children:"●"}),o.jsx("h2",{className:Re.envName,children:T.displayName||T.id}),o.jsx("span",{className:Re.statusBadge,style:{color:E},children:T.status})]}),o.jsxs("div",{className:Re.envMeta,children:[o.jsxs("span",{className:Re.metaTag,children:["Adapter: ",T.adapterType]}),D.length>0&&o.jsxs("span",{className:Re.metaTag,children:[D.length," session",D.length!==1?"s":""]}),L>0&&o.jsxs("span",{className:Re.metaTag,children:["Cost: ",Do(L)]})]})]}),o.jsxs("div",{className:Re.actions,children:[I&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:Re.btnPrimary,onClick:()=>s(D_(T.id)),children:"New Chat"}),o.jsx("button",{className:Re.btnOutline,onClick:()=>{u(T.id).catch(()=>{})},children:"Stop"}),o.jsx("button",{className:Re.btnOutline,onClick:()=>k(!0),disabled:$!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),z&&o.jsx("button",{className:Re.btnPrimary,onClick:()=>{d(T.id).catch(()=>{})},children:T.status==="error"?"Retry":T.status==="sleeping"?"Wake":"Connect"}),O&&$!==void 0&&o.jsx("span",{className:Re.provisionMessage,children:$.message}),T.status==="error"&&($==null?void 0:$.stage)==="error"&&o.jsx("span",{className:Re.errorMessage,children:$.message}),o.jsx("button",{className:Re.btnOutline,onClick:()=>s(Xj(T.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),o.jsx("button",{className:Re.btnDanger,onClick:()=>_(!0),children:"Delete"})]}),o.jsxs("div",{className:Re.section,children:[o.jsxs("div",{className:Re.sectionHeader,children:[o.jsx("h3",{children:"Workspaces"}),o.jsx("button",{className:Re.btnPrimary,onClick:()=>s(`${M_}?environment=${encodeURIComponent(T.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"})]}),C.length===0&&o.jsx("p",{className:Re.empty,children:"No workspaces yet. Create one to get started."}),o.jsx("div",{className:Re.cardList,children:C.map(ae=>o.jsx(n9,{workspace:ae,confirmArchiveId:w,onOpen:()=>s(ki(ae.id,T.id)),onArchive:()=>N(ae.id),onConfirmArchive:()=>P(ae.id),onCancelArchive:()=>N(void 0)},ae.id))})]})]})}function n9({workspace:t,confirmArchiveId:s,onOpen:i,onArchive:r,onConfirmArchive:c,onCancelArchive:d}){const u=s===t.id,p=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return o.jsxs("div",{className:Re.card,"data-testid":"workspace-card",children:[o.jsxs("div",{className:Re.cardHeader,children:[o.jsx("strong",{className:Re.cardName,children:t.name}),o.jsxs("div",{className:Re.cardActions,children:[o.jsx("button",{className:Re.btnSmall,onClick:i,children:"Open"}),u?o.jsxs(o.Fragment,{children:[o.jsx("button",{className:Re.btnDanger,onClick:c,children:"Confirm"}),o.jsx("button",{className:Re.btnSmall,onClick:d,children:"Cancel"})]}):o.jsx("button",{className:Re.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&o.jsx("p",{className:Re.cardDescription,children:t.description}),t.repoUrl&&o.jsx("div",{className:Re.cardMeta,children:p?o.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Re.repoLink,children:t.repoUrl}):o.jsx("span",{children:t.repoUrl})})]})}const s9={credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function a9(){const s=Zt().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=s9[s],r=uz(i);return o.jsxs("div",{className:Jr.layout,children:[o.jsx(js,{segments:r}),o.jsx("div",{className:Jr.content,children:o.jsx("div",{className:Jr.tabPanel,children:o.jsx(Ha,{})},s)})]})}function i9(){const{tokens:{tokens:t,setToken:s,deleteToken:i},credentials:{credentialProviders:r,updateCredentialProviders:c}}=ut(),{showToast:d}=Tn();return o.jsxs(o.Fragment,{children:[o.jsx(RB,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),o.jsx($O,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{i(u).catch(()=>{})},onShowToast:d})]})}function o9(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:i,setAppDefaultPersonaId:r}=ut(),{showToast:c}=Tn(),d=xt();return o.jsx(GB,{personas:t,appDefaultPersonaId:i,onDeletePersona:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete persona",{personaId:u,error:p}),c("Failed to delete persona","error"),p}},onSetAppDefaultPersonaId:async u=>{try{await r(u)}catch(p){console.error("Failed to set app default persona ID",{personaId:u,error:p}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>d(eN),onNavigateToPersona:u=>d(R_(u))})}const r9="_container_1ooin_1",l9="_form_1ooin_7",c9="_formActions_1ooin_75",d9="_editableSection_1ooin_82",u9="_defaultBadge_1ooin_93",f9="_typeToggle_1ooin_107",p9="_scriptEditor_1ooin_121",m9="_optional_1ooin_128",ds={container:r9,form:l9,formActions:c9,editableSection:d9,defaultBadge:u9,typeToggle:f9,scriptEditor:p9,optional:m9},Qb=[{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)"}],e_=[{value:"genaiscript",label:"genaiscript"}],h9="0";function t_(){const{personaId:t}=ms(),s=xt(),{showToast:i}=Tn(),{personas:{personas:r,createPersona:c,updatePersona:d,deletePersona:u},appDefaultPersonaId:p,setAppDefaultPersonaId:m}=ut(),g=t===void 0,v=g?void 0:r.find(_=>_.id===t);if(!g&&r.length>0&&!v)return o.jsx(fs,{to:Vf,replace:!0});const b=[{label:"Settings",url:Eo},{label:"Personas",url:Vf},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return o.jsxs("div",{className:ds.container,children:[o.jsx(js,{segments:b}),o.jsx(g9,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(Vf)},showToast:i})]})}function g9({existing:t,isNew:s,appDefaultPersonaId:i,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=xt(),[v,b]=y.useState((t==null?void 0:t.name)??""),[_,S]=y.useState((t==null?void 0:t.description)??""),[k,w]=y.useState((t==null?void 0:t.systemPrompt)??""),[N,T]=y.useState((t==null?void 0:t.runtime)??"claude-code"),[C,D]=y.useState((t==null?void 0:t.model)??"sonnet"),[L,E]=y.useState((t==null?void 0:t.maxTurns)??0),[I,O]=y.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[z,$]=y.useState((t==null?void 0:t.script)??""),[X,te]=y.useState((t==null?void 0:t.allowedMcpTools)??[]),[P,ae]=y.useState(!1),[K,re]=y.useState(null),[A,F]=y.useState(!!s);y.useEffect(()=>{if(!s&&t&&!A){F(!0),b(t.name),S(t.description),w(t.systemPrompt);const se=t.type==="script"?"script":"agent";T(se==="script"?t.runtime||"genaiscript":t.runtime),D(t.model),E(t.maxTurns),O(se),$(t.script||""),te(t.allowedMcpTools)}},[s,t,A]);const oe=se=>{O(se),se==="script"?T("genaiscript"):N==="genaiscript"&&T("claude-code")},pe=!s&&t===void 0,de=v.trim().length>0&&!pe&&k.trim().length>0&&(I==="script"?z.trim().length>0:!!N&&!!C),Oe=s&&de,ke=!s&&i===(t==null?void 0:t.id),Ce=!s&&t&&!ke&&I==="agent"&&!!N&&!!C,ze=(se,qe)=>{if(!se.trim())return`${qe} is required`},ue=se=>{if(se.preventDefault(),!(pe||!de)){if(t){c(t.id,v,_,k,N,C,L,I,z).then(()=>{m("Persona updated","success"),p()},()=>{m("Failed to save persona","error")});return}r(v,_,k,N,C,L,I,z,X).then(qe=>{m("Persona created","success"),g(R_(qe.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},_e=()=>{t&&d(t.id).then(()=>{m("Persona deleted","success"),p()},()=>{m("Failed to delete persona","error")})},me=async(se,qe,Nt,Y)=>se().then(()=>{qe(),m(Nt,"success")},()=>{m(Y,"error")}),Be=(se,qe)=>{if(!t)return;const Nt=se==="type"?String(qe):I,Y=se==="runtime"?String(qe):se==="type"?String(qe)==="script"?"genaiscript":N==="genaiscript"?"claude-code":N:N,wt=se==="model"?String(qe):C,Vt=se==="maxTurns"?Number(qe):L,es=se==="systemPrompt"?String(qe):k,ft=se==="script"?String(qe):z;me(()=>c(t.id,se==="name"?String(qe):v,se==="description"?String(qe):_,es,Y,wt,Vt,Nt,ft),()=>{if(se==="type"){const hs=String(qe)==="script"?"script":"agent";O(hs),T(Y)}se==="runtime"&&T(String(qe)),se==="name"&&b(String(qe)),se==="description"&&S(String(qe)),se==="systemPrompt"&&w(String(qe)),se==="model"&&D(String(qe)),se==="maxTurns"&&E(Number(qe)),se==="script"&&$(String(qe))},"Persona updated","Failed to update persona").catch(()=>{})},mt=se=>{ue(se)},vn=()=>{t&&u(t.id).then(()=>{m("Set as app default","success")},()=>{m("Failed to set app default","error")})};return o.jsxs(o.Fragment,{children:[pe?o.jsxs("div",{className:ds.form,children:[o.jsx("h3",{children:"Edit Persona"}),o.jsx("p",{children:"Loading persona..."})]}):s?o.jsxs("form",{onSubmit:mt,className:ds.form,children:[o.jsx("h3",{children:"Create Persona"}),o.jsxs("div",{className:ds.typeToggle,"data-testid":"persona-type-toggle",children:[o.jsxs("label",{children:[o.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:I==="agent",onChange:()=>oe("agent")}),"Agent"]}),o.jsxs("label",{children:[o.jsx("input",{type:"radio",name:"personaType",value:"script",checked:I==="script",onChange:()=>oe("script")}),"Script"]})]}),o.jsxs("label",{children:["Name",o.jsx("input",{type:"text",value:v,onChange:se=>b(se.target.value),placeholder:I==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),o.jsxs("label",{children:["Description",o.jsx("input",{type:"text",value:_,onChange:se=>S(se.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),o.jsxs("label",{children:["Runtime",o.jsx("select",{value:N,onChange:se=>T(se.target.value),"data-testid":"persona-runtime-select",children:(I==="script"?e_:Qb).map(se=>o.jsx("option",{value:se.value,children:se.label},se.value))})]}),I==="agent"&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Model",o.jsx("input",{type:"text",value:C,onChange:se=>D(se.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),o.jsxs("label",{children:["Max Turns",o.jsx("input",{type:"number",value:L,onChange:se=>E(parseInt(se.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),o.jsxs("label",{children:["System Prompt",o.jsx("textarea",{value:k,onChange:se=>w(se.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),I==="script"&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Model ",o.jsx("span",{className:ds.optional,children:"(optional)"}),o.jsx("input",{type:"text",value:C,onChange:se=>D(se.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),o.jsxs("label",{children:["System Prompt",o.jsx("textarea",{value:k,onChange:se=>w(se.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),o.jsxs("label",{children:["Script",o.jsx("textarea",{value:z,onChange:se=>$(se.target.value),placeholder:`script({ model: "openai:gpt-4o" });
702
+
703
+ const grackle = await host.mcpServer({
704
+ id: "grackle",
705
+ url: env.vars.GRACKLE_MCP_URL,
706
+ });
707
+
708
+ $\`Summarize the current tasks.\`;`,rows:20,className:ds.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),I==="agent"&&o.jsxs("div",{children:[o.jsx("label",{children:"Allowed MCP Tools"}),o.jsx(Vb,{selectedTools:X,onChange:te})]}),o.jsxs("div",{className:ds.formActions,children:[o.jsx(Js,{type:"submit",variant:"primary",size:"md",disabled:!Oe,"data-testid":"persona-detail-save",children:"Create"}),o.jsx(Js,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?o.jsxs("div",{className:ds.form,children:[o.jsx("h3",{children:"Edit Persona"}),o.jsxs("div",{className:ds.formActions,children:[o.jsx(Js,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),Ce&&o.jsx(Js,{type:"button",variant:"ghost",size:"md",onClick:vn,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),ke&&o.jsx("span",{className:ds.defaultBadge,children:"App Default"}),o.jsx(Js,{type:"button",variant:"danger",size:"md",onClick:()=>ae(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),o.jsxs("div",{className:ds.editableSection,children:[o.jsxs("label",{children:["Name",o.jsx(ln,{value:v,onSave:se=>{Be("name",se)},validate:se=>ze(se,"Name"),fieldId:"persona-name",activeFieldId:K,onActivate:re,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),o.jsxs("label",{children:["Description",o.jsx(ln,{value:_,onSave:se=>{Be("description",se)},fieldId:"persona-description",activeFieldId:K,onActivate:re,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),o.jsxs("label",{children:["Type",o.jsx(cd,{value:I,onSave:se=>{Be("type",se)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:K,onActivate:re,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),o.jsxs("label",{children:["Runtime",o.jsx(cd,{value:N,onSave:se=>{Be("runtime",se)},options:I==="script"?e_:Qb,fieldId:"persona-runtime",activeFieldId:K,onActivate:re,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),o.jsxs("label",{children:["Model",I==="script"?" (optional)":"",o.jsx(ln,{value:C,onSave:se=>{Be("model",se)},validate:I==="agent"?se=>ze(se,"Model"):void 0,fieldId:"persona-model",activeFieldId:K,onActivate:re,placeholder:I==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),o.jsxs("label",{children:["Max Turns",o.jsx(ln,{value:String(L),onSave:se=>{Be("maxTurns",parseInt(se,10)||0)},validate:se=>/^\d+$/.test(se.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:K,onActivate:re,placeholder:h9,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),o.jsxs("label",{children:["System Prompt",o.jsx(Wp,{value:k,onSave:se=>{Be("systemPrompt",se)},validate:se=>ze(se,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:K,onActivate:re,placeholder:I==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),I==="script"&&o.jsxs("label",{children:["Script",o.jsx(Wp,{value:z,onSave:se=>{Be("script",se)},validate:se=>ze(se,"Script"),fieldId:"persona-script",activeFieldId:K,onActivate:re,placeholder:`script({ model: "openai:gpt-4o" });
709
+
710
+ const grackle = await host.mcpServer({
711
+ id: "grackle",
712
+ url: env.vars.GRACKLE_MCP_URL,
713
+ });
714
+
715
+ $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),I==="agent"&&o.jsxs("div",{children:[o.jsx("label",{children:"Allowed MCP Tools"}),o.jsx(Vb,{selectedTools:X,onChange:se=>{te(se),me(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,se),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Ce&&!ke&&o.jsx("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-tertiary)",marginTop:"var(--space-xs)"},children:"Only agent personas with a runtime and model can be set as app default."})]}):null,o.jsx(wi,{isOpen:P,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:_e,onCancel:()=>ae(!1)})]})}function v9(){const{themeId:t,resolvedThemeId:s,setTheme:i,preferSystem:r,setPreferSystem:c}=R1();return o.jsx(PO,{themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:r,onSetPreferSystem:c})}function y9(){const[t,s]=y.useState(void 0);return y.useEffect(()=>{let i=!1;return(async()=>{try{const c=await we.getVersionStatus({});i||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{i=!0}},[]),t}function b9(){const{connected:t,environments:{environments:s},sessions:{sessions:i}}=ut(),r=y9();return o.jsxs(o.Fragment,{children:[r&&o.jsx(GI,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),o.jsx(HO,{connected:t,environments:s,sessions:i})]})}function _9(){return o.jsx(AB,{})}const n_=Ci();function x9(){const t=xt();return Qs({key:"?"},()=>{t(tN)}),Qs({key:"n"},()=>{t(n_)}),Qs({key:"N"},()=>{t(n_)}),o.jsx(o.Fragment,{})}function ml(t){const s=oz();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function k9(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=ut(),i=y.useMemo(()=>o.jsx(xI,{workspaces:t,tasks:s}),[t,s]);return ml(i),o.jsx(Ha,{})}function S9(){const{environments:{environments:t}}=ut(),s=y.useMemo(()=>o.jsx(D5,{environments:t}),[t]);return ml(s),o.jsx(Ha,{})}function T9(){const t=y.useMemo(()=>o.jsx(f8,{}),[]);return ml(t),o.jsx(Ha,{})}function w9(){const{findings:{findings:t,loadFindings:s,loadAllFindings:i}}=ut(),{workspaceId:r,environmentId:c}=ms();y.useEffect(()=>{r?s(r).catch(()=>{}):i().catch(()=>{})},[r,s,i]);const d=y.useMemo(()=>o.jsx(H5,{findings:t,workspaceId:r,environmentId:c}),[t,r,c]);return ml(d),o.jsx(Ha,{})}function j9(){const{knowledge:t,workspaces:{workspaces:s}}=ut(),i=y.useCallback(p=>{t.search(p).catch(()=>{})},[t]),r=y.useCallback(()=>{t.clearSearch()},[t]),c=y.useCallback(p=>{t.selectNode(p).catch(()=>{})},[t]),d=y.useCallback(p=>{t.loadRecent(p||void 0).catch(()=>{})},[t]),u=y.useMemo(()=>o.jsx(q6,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:i,onClearSearch:r,onSelectNode:c,onWorkspaceChange:d}),[t,s,i,r,c,d]);return ml(u),o.jsx(Ha,{})}const N9="_container_ce571_1",C9="_title_ce571_6",fd={container:N9,title:C9};function E9(){return o.jsxs("div",{className:fd.container,"aria-hidden":"true",children:[o.jsx("h1",{className:fd.title,children:"Findings"}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:Array.from({length:4},(t,s)=>o.jsx(ld,{lines:3},s))})]})}function s_(){const{environmentId:t,workspaceId:s}=ms(),{findings:{findings:i,findingsLoading:r,loadFindings:c},workspaces:{workspaces:d},environments:{environments:u}}=ut(),p=xt();y.useEffect(()=>{s&&c(s).catch(()=>{})},[s,c]);const m=y.useCallback(v=>{p(Rp(v,s,t))},[p,s,t]);if(r)return o.jsx(E9,{});const g=s&&t?U1("Findings",s,t,d,u).slice(0,-1):yz();return o.jsxs("div",{className:fd.container,"data-testid":"findings-list-page",children:[o.jsx(js,{segments:g}),o.jsx("h1",{className:fd.title,children:"Findings"}),o.jsx(S1,{findings:i,onFindingClick:m})]})}const A9="_container_1wwpb_1",D9="_notFound_1wwpb_6",R9="_header_1wwpb_12",M9="_categoryBadge_1wwpb_19",I9="_title_1wwpb_28",O9="_content_1wwpb_35",L9="_tags_1wwpb_77",B9="_tag_1wwpb_77",z9="_meta_1wwpb_92",U9="_metaTimestamp_1wwpb_100",$9="_metaLink_1wwpb_105",hn={container:A9,notFound:D9,header:R9,categoryBadge:M9,title:I9,content:O9,tags:L9,tag:B9,meta:z9,metaTimestamp:U9,metaLink:$9};function a_(){const{findingId:t,environmentId:s,workspaceId:i}=ms(),{findings:{selectedFinding:r,findingLoading:c,loadFinding:d},workspaces:{workspaces:u},environments:{environments:p}}=ut(),m=xt();if(y.useEffect(()=>{t&&d(t).catch(()=>{})},[t,d]),c)return o.jsx("div",{className:hn.container,"data-testid":"finding-detail-page",children:o.jsx("div",{className:hn.notFound,children:"Loading..."})});if(!r)return o.jsx("div",{className:hn.container,"data-testid":"finding-detail-page",children:o.jsx("div",{className:hn.notFound,children:"Finding not found."})});const g=U1(r.title,i,s,u,p),v=dd(r.category);return o.jsxs("div",{className:hn.container,"data-testid":"finding-detail-page",children:[o.jsx(js,{segments:g}),o.jsxs("div",{className:hn.header,children:[o.jsx("span",{className:hn.categoryBadge,style:{background:v.bg,color:v.text},children:r.category}),o.jsx("h1",{className:hn.title,children:r.title})]}),r.content&&o.jsx("div",{className:hn.content,children:o.jsx(pd,{remarkPlugins:[md],children:r.content})}),r.tags.length>0&&o.jsx("div",{className:hn.tags,children:r.tags.map(b=>o.jsx("span",{className:hn.tag,children:b},b))}),o.jsxs("div",{className:hn.meta,children:[o.jsx("span",{className:hn.metaTimestamp,title:r.createdAt,children:Xm(r.createdAt)}),r.taskId&&o.jsx("button",{type:"button",className:hn.metaLink,onClick:()=>{m(In(r.taskId))},children:"View Task"}),r.sessionId&&o.jsx("button",{type:"button",className:hn.metaLink,onClick:()=>{m(mm(r.sessionId))},children:"View Session"})]})]})}const P9="_wizard_1260s_1",H9="_container_1260s_10",V9="_stepContent_1260s_19",q9="_logoArea_1260s_28",G9="_logoImage_1260s_32",F9="_heading_1260s_41",Z9="_tagline_1260s_49",K9="_subtitle_1260s_56",Y9="_featureList_1260s_64",J9="_runtimeGrid_1260s_89",W9="_runtimeCard_1260s_101",X9="_runtimeName_1260s_133",Q9="_runtimeDescription_1260s_139",eP="_buttonRow_1260s_144",tP="_primaryButton_1260s_151",nP="_ghostButton_1260s_185",sP="_dots_1260s_213",aP="_dot_1260s_213",pt={wizard:P9,container:H9,stepContent:V9,logoArea:q9,logoImage:G9,heading:F9,tagline:Z9,subtitle:K9,featureList:Y9,runtimeGrid:J9,runtimeCard:W9,runtimeName:X9,runtimeDescription:Q9,buttonRow:eP,primaryButton:tP,ghostButton:nP,dots:sP,dot:aP};function iP({onNext:t}){return o.jsxs("div",{className:pt.stepContent,"data-testid":"setup-welcome",children:[o.jsx("div",{className:pt.logoArea,children:o.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:pt.logoImage})}),o.jsx("h1",{className:pt.heading,children:"Welcome to Grackle"}),o.jsx("p",{className:pt.tagline,children:"Multi-agent orchestration for software teams"}),o.jsx("button",{type:"button",className:pt.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function oP({onNext:t,onBack:s}){return o.jsxs("div",{className:pt.stepContent,"data-testid":"setup-about",children:[o.jsx("h2",{className:pt.heading,children:"What is Grackle?"}),o.jsxs("ul",{className:pt.featureList,children:[o.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),o.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),o.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),o.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),o.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),o.jsxs("div",{className:pt.buttonRow,children:[o.jsx("button",{type:"button",className:pt.ghostButton,onClick:s,children:"Back"}),o.jsx("button",{type:"button",className:pt.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const rP=[{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 lP({currentRuntime:t,onFinish:s,onBack:i,finishDisabled:r}){const[c,d]=y.useState(t||"claude-code");return y.useEffect(()=>{t&&d(t)},[t]),o.jsxs("div",{className:pt.stepContent,"data-testid":"setup-runtime",children:[o.jsx("h2",{className:pt.heading,children:"Choose Your Runtime"}),o.jsx("p",{className:pt.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),o.jsx("div",{className:pt.runtimeGrid,children:rP.map(u=>o.jsxs("button",{type:"button",className:pt.runtimeCard,"data-selected":c===u.id,"aria-pressed":c===u.id,"data-testid":`runtime-card-${u.id}`,onClick:()=>d(u.id),children:[o.jsx("span",{className:pt.runtimeName,children:u.name}),o.jsx("span",{className:pt.runtimeDescription,children:u.description})]},u.id))}),o.jsxs("div",{className:pt.buttonRow,children:[o.jsx("button",{type:"button",className:pt.ghostButton,onClick:i,children:"Back"}),o.jsx("button",{type:"button",className:pt.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-finish",children:"Finish"})]})]})}const cP=3,i_={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function dP(){const{personas:{personas:t,updatePersona:s},completeOnboarding:i,onboardingCompleted:r}=ut(),{showToast:c}=Tn(),d=xt(),[u,p]=y.useState(0),[m,g]=y.useState(!1),v=t.find(_=>_.id==="claude-code"),b=y.useCallback(_=>{g(!0);const S=[];if(v&&_!==v.runtime){const w=i_[_]??"sonnet";S.push(s(v.id,void 0,void 0,void 0,_,w))}const k=t.find(w=>w.id===J0);if(k&&_!==k.runtime){const w=i_[_]??"sonnet";S.push(s(J0,void 0,void 0,void 0,_,w))}Promise.all(S).then(()=>i()).then(()=>{d("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),g(!1)})},[v,t,s,i,d,c]);return r===!0?o.jsx(fs,{to:"/",replace:!0}):o.jsx("div",{className:pt.wizard,"data-testid":"setup-wizard",children:o.jsxs("div",{className:pt.container,children:[o.jsx(ps,{mode:"wait",children:o.jsxs(Rt.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&o.jsx(iP,{onNext:()=>p(1)}),u===1&&o.jsx(oP,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&o.jsx(lP,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:b,onBack:()=>p(1),finishDisabled:!v||m})]},u)}),o.jsx("div",{className:pt.dots,children:Array.from({length:cP},(_,S)=>o.jsx("span",{className:pt.dot,"data-active":S===u},S))})]})})}const uP="_root_zndgp_1",fP="_body_zndgp_7",pP="_main_zndgp_19",mP="_sidebarWrapper_zndgp_26",hP="_overlay_zndgp_51",qr={root:uP,body:fP,main:pP,sidebarWrapper:mP,overlay:hP},gP=y.lazy(()=>AT(()=>import("./KnowledgePage-gigL5i5c.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),P1=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function vP(){const{connected:t,environments:{environments:s},sessions:{sessions:i},tasks:{tasks:r}}=ut(),{toasts:c,dismissToast:d}=Tn(),u=Zt(),p=iz(),m=p!==void 0,[g,v]=y.useState(!1),b=y.useCallback(()=>v(_=>!_),[]);return y.useEffect(()=>{v(!1)},[u.pathname]),y.useEffect(()=>{if(!g)return;const _=S=>{S.key==="Escape"&&v(!1)};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[g]),o.jsxs(o.Fragment,{children:[o.jsx(e5,{connected:t,environments:s,sessions:i,onToggleSidebar:m?b:void 0,sidebarOpen:g}),o.jsx(r5,{}),o.jsxs("div",{className:qr.body,children:[m&&o.jsx("div",{className:qr.sidebarWrapper,"data-sidebar-open":g,children:o.jsx(p5,{content:p})}),m&&g&&o.jsx("div",{className:qr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),o.jsxs("div",{className:qr.main,children:[o.jsx(Ha,{}),o.jsx(x5,{sessions:i,tasks:r,environments:s})]})]}),o.jsx(II,{toasts:c,onDismiss:d}),o.jsx(x9,{})]})}function yP(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:i,clearOperationError:r},tasks:{tasks:c},connected:d,onboardingCompleted:u}=ut(),{showToast:p}=Tn();a7(s,p),c7(c,p),i7(i,r,p);const m=xt(),g=Zt();return y.useEffect(()=>{t&&!g.pathname.includes("/tasks/")&&m(mm(t),{replace:!0})},[t,m,g.pathname]),d&&u===!1?o.jsx(fs,{to:"/setup",replace:!0}):o.jsx(az,{children:o.jsxs("div",{className:qr.root,children:[P1&&o.jsx(DN,{}),o.jsx(vP,{})]})})}function Np(){const{workspaceId:t}=ms(),{workspaces:{workspaces:s}}=ut(),i=Zt(),r=s.find(m=>m.id===t);if(!(r!=null&&r.environmentId))return s.length===0?void 0:o.jsx(fs,{to:"/environments",replace:!0});const c=encodeURIComponent(t),d=`/workspaces/${c}`,u=i.pathname.startsWith(d)?i.pathname.slice(d.length):"",p=`/environments/${encodeURIComponent(r.environmentId)}/workspaces/${c}${u}${i.search}${i.hash}`;return o.jsx(fs,{to:p,replace:!0})}function bP(){return o.jsxs(gj,{children:[o.jsx(Ne,{path:"setup",element:o.jsx(dP,{})}),o.jsxs(Ne,{element:o.jsx(yP,{}),children:[o.jsx(Ne,{index:!0,element:o.jsx(VU,{})}),o.jsx(Ne,{path:"chat",element:o.jsx(QU,{})}),o.jsx(Ne,{path:"sessions/new",element:o.jsx(e$,{})}),o.jsx(Ne,{path:"sessions/:sessionId",element:o.jsx(a$,{})}),o.jsx(Ne,{element:o.jsx(j9,{}),children:o.jsx(Ne,{path:"knowledge",element:o.jsx(y.Suspense,{fallback:o.jsx(p1,{}),children:o.jsx(gP,{})})})}),o.jsxs(Ne,{element:o.jsx(k9,{}),children:[o.jsx(Ne,{path:"tasks",element:o.jsx(PU,{})}),o.jsx(Ne,{path:"tasks/new",element:o.jsx(Xb,{})}),o.jsx(Ne,{path:"tasks/:taskId",element:o.jsx(Ia,{})}),o.jsx(Ne,{path:"tasks/:taskId/edit",element:o.jsx(Ia,{})}),o.jsx(Ne,{path:"tasks/:taskId/stream",element:o.jsx(Ia,{})}),o.jsx(Ne,{path:"tasks/:taskId/findings",element:o.jsx(Ia,{})})]}),o.jsxs(Ne,{element:o.jsx(w9,{}),children:[o.jsx(Ne,{path:"findings",element:o.jsx(s_,{})}),o.jsx(Ne,{path:"findings/:findingId",element:o.jsx(a_,{})}),o.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:o.jsx(s_,{})}),o.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:o.jsx(a_,{})})]}),o.jsxs(Ne,{element:o.jsx(S9,{}),children:[o.jsx(Ne,{path:"workspaces",element:o.jsx(fs,{to:"/environments",replace:!0})}),o.jsx(Ne,{path:"workspaces/new",element:o.jsx(b$,{})}),o.jsx(Ne,{path:"workspaces/:workspaceId",element:o.jsx(Np,{})}),o.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId",element:o.jsx(Np,{})}),o.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:o.jsx(Np,{})}),o.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId",element:o.jsx(l$,{})}),o.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:o.jsx(Xb,{})}),o.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:o.jsx(Ia,{})}),o.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:o.jsx(Ia,{})}),o.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:o.jsx(Ia,{})}),o.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:o.jsx(Ia,{})}),o.jsxs(Ne,{path:"environments",element:o.jsx(j$,{}),children:[o.jsx(Ne,{index:!0,element:o.jsx(HU,{})}),o.jsx(Ne,{path:"new",element:o.jsx(x$,{})}),o.jsx(Ne,{path:":environmentId",element:o.jsx(t9,{})}),o.jsx(Ne,{path:":environmentId/edit",element:o.jsx(k$,{})})]})]}),o.jsx(Ne,{element:o.jsx(T9,{}),children:o.jsxs(Ne,{path:"settings",element:o.jsx(a9,{}),children:[o.jsx(Ne,{index:!0,element:o.jsx(fs,{to:"credentials",replace:!0})}),o.jsx(Ne,{path:"environments",element:o.jsx(fs,{to:"/environments",replace:!0})}),o.jsx(Ne,{path:"credentials",element:o.jsx(i9,{})}),o.jsx(Ne,{path:"tokens",element:o.jsx(fs,{to:"../credentials",replace:!0})}),o.jsx(Ne,{path:"personas",element:o.jsx(o9,{})}),o.jsx(Ne,{path:"personas/new",element:o.jsx(t_,{})}),o.jsx(Ne,{path:"personas/:personaId",element:o.jsx(t_,{})}),o.jsx(Ne,{path:"appearance",element:o.jsx(v9,{})}),o.jsx(Ne,{path:"shortcuts",element:o.jsx(_9,{})}),o.jsx(Ne,{path:"about",element:o.jsx(b9,{})})]})}),o.jsx(Ne,{path:"*",element:o.jsx(fs,{to:"/",replace:!0})})]})]})}const _P=1e4;function xP(){const{onboardingCompleted:t}=ut(),[s,i]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>i(!0),_P);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return o.jsx(ps,{mode:"wait",children:r?o.jsx(Rt.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:o.jsx(p1,{})},"splash"):o.jsx(Rt.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:o.jsx(Pj,{basename:"/".replace(/\/$/,""),children:o.jsx(bP,{})})},"app")})}function kP(){const t=P1?Mz:s7;return o.jsx(sz,{children:o.jsx(Q8,{children:o.jsx(t,{children:o.jsx(xP,{})})})})}NT.createRoot(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(kP,{})}));export{js as B,I_ as K,ut as a,Rp as f,mm as s,In as t,xt as u};