@grackle-ai/web 0.85.1 → 0.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/KnowledgePage-BIcDgOZa.js +1 -0
- package/dist/assets/dagview-CzJGOIoX.js +47 -0
- package/dist/assets/{grpc-DU5jMhZD.js → grpc-DT6vMFm5.js} +1 -1
- package/dist/assets/index-BtJLKpAw.css +1 -0
- package/dist/assets/{index-CAQikL1U.js → index-HhR5AvUh.js} +38 -38
- package/dist/assets/markdown-DH3wQq0i.js +31 -0
- package/dist/index.html +5 -5
- package/package.json +4 -11
- package/dist/assets/KnowledgePage-4d_6DFDB.js +0 -1
- package/dist/assets/dagview-BA5TtMAQ.js +0 -31
- package/dist/assets/index-pFJWXkif.css +0 -1
- package/dist/assets/markdown-gcy1Jmzi.js +0 -47
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-
|
|
2
|
-
import{r as YS,a as y,j as l,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-BIcDgOZa.js","assets/dagview-CzJGOIoX.js","assets/grpc-DT6vMFm5.js","assets/markdown-DH3wQq0i.js","assets/KnowledgePage-DMqJ4jlP.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as YS,a as JS,b as y,j as l,d as Qv,H as e0,P as t0,i as WS,B as XS,c as QS,C as eT,M as tT}from"./dagview-CzJGOIoX.js";import{c as nT,a as sT,G as aT,f as iT,M as oT,A as ob,D as rb,W as rT,O as lT,b as cT,C as Ec,d as uT,e as lb,w as dT,t as fT,p as Jl,g as pT,R as nr,S as n0}from"./grpc-DT6vMFm5.js";import{v as mT,r as hT,t as Wl,i as gT,f as vT,M as up,a as dp}from"./markdown-DH3wQq0i.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();var Xd={exports:{}},sr={},Qd={exports:{}},ef={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* scheduler.production.js
|
|
5
5
|
*
|
|
@@ -15,7 +15,7 @@ import{r as YS,a as y,j as l,v as JS,b as WS,t as Jl,i as XS,f as QS,M as up,c a
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var i0;function _T(){if(i0)return sr;i0=1;var n=bT(),s=YS(),i=
|
|
18
|
+
*/var i0;function _T(){if(i0)return sr;i0=1;var n=bT(),s=YS(),i=JS();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(u(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(o(188));return t!==e?null:e}for(var a=e,r=t;;){var f=a.return;if(f===null)break;var p=f.alternate;if(p===null){if(r=f.return,r!==null){a=r;continue}break}if(f.child===p.child){for(p=f.child;p;){if(p===a)return h(f),e;if(p===r)return h(f),t;p=p.sibling}throw Error(o(188))}if(a.return!==r.return)a=f,r=p;else{for(var x=!1,k=f.child;k;){if(k===a){x=!0,a=f,r=p;break}if(k===r){x=!0,r=f,a=p;break}k=k.sibling}if(!x){for(k=p.child;k;){if(k===a){x=!0,a=p,r=f;break}if(k===r){x=!0,r=p,a=f;break}k=k.sibling}if(!x)throw Error(o(189))}}if(a.alternate!==r)throw Error(o(190))}if(a.tag!==3)throw Error(o(188));return a.stateNode.current===a?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),A=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function ae(e){return e===null||typeof e!="object"?null:(e=Q&&e[Q]||e["@@iterator"],typeof e=="function"?e:null)}var pe=Symbol.for("react.client.reference");function oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===pe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case N:return"Fragment";case w:return"Profiler";case j:return"StrictMode";case D:return"Suspense";case E:return"SuspenseList";case Z:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case A:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case M:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case H:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case z:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var X=Array.isArray,B=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},re=[],de=-1;function $e(e){return{current:e}}function we(e){0>de||(e.current=re[de],re[de]=null,de--)}function Se(e,t){de++,re[de]=e.current,e.current=t}var Ie=$e(null),le=$e(null),fe=$e(null),me=$e(null);function Ce(e,t){switch(Se(fe,t),Se(le,e),Se(Ie,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Sv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Sv(t),e=Tv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}we(Ie),Se(Ie,e)}function Ut(){we(Ie),we(le),we(fe)}function Tt(e){e.memoizedState!==null&&Se(me,e);var t=Ie.current,a=Tv(t,e.type);t!==a&&(Se(le,e),Se(Ie,a))}function I(e){le.current===e&&(we(Ie),we(le)),me.current===e&&(we(me),Xo._currentValue=te)}var Ne,Ct;function It(e){if(Ne===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Ne=t&&t[1]||"",Ct=-1<a.stack.indexOf(`
|
|
19
19
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
20
|
`+Ne+e+Ct}var it=!1;function Yn(e,t){if(!e||it)return"";it=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var W=function(){throw Error()};if(Object.defineProperty(W.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(W,[])}catch(K){var G=K}Reflect.construct(e,[],W)}else{try{W.call()}catch(K){G=K}e.call(W.prototype)}}else{try{throw Error()}catch(K){G=K}(W=e())&&typeof W.catch=="function"&&W.catch(function(){})}}catch(K){if(K&&G&&typeof K.stack=="string")return[K.stack,G.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=r.DetermineComponentFrameRoot(),x=p[0],k=p[1];if(x&&k){var R=x.split(`
|
|
21
21
|
`),V=k.split(`
|
|
@@ -23,7 +23,7 @@ import{r as YS,a as y,j as l,v as JS,b as WS,t as Jl,i as XS,f as QS,M as up,c a
|
|
|
23
23
|
`+R[r].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=r&&0<=f);break}}}finally{it=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?It(a):""}function Bs(e,t){switch(e.tag){case 26:case 27:case 5:return It(e.type);case 16:return It("Lazy");case 13:return e.child!==t&&t!==null?It("Suspense Fallback"):It("Suspense");case 19:return It("SuspenseList");case 0:case 15:return Yn(e.type,!1);case 11:return Yn(e.type.render,!1);case 1:return Yn(e.type,!0);case 31:return It("Activity");default:return""}}function Tn(e){try{var t="",a=null;do t+=Bs(e,a),a=e,e=e.return;while(e);return t}catch(r){return`
|
|
24
24
|
Error generating stack: `+r.message+`
|
|
25
25
|
`+r.stack}}var zn=Object.prototype.hasOwnProperty,Jn=n.unstable_scheduleCallback,Ls=n.unstable_cancelCallback,Pn=n.unstable_shouldYield,De=n.unstable_requestPaint,Je=n.unstable_now,lo=n.unstable_getCurrentPriorityLevel,co=n.unstable_ImmediatePriority,uo=n.unstable_UserBlockingPriority,_a=n.unstable_NormalPriority,Or=n.unstable_LowPriority,fo=n.unstable_IdlePriority,Ir=n.log,Br=n.unstable_setDisableYieldValue,Us=null,Jt=null;function Vn(e){if(typeof Ir=="function"&&Br(e),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(Us,e)}catch{}}var Wt=Math.clz32?Math.clz32:q,Lr=Math.log,Hc=Math.LN2;function q(e){return e>>>=0,e===0?32:31-(Lr(e)/Hc|0)|0}var ee=256,ie=262144,ce=4194304;function ue(e){var t=e&42;if(t!==0)return t;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 Pe(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var f=0,p=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var k=r&134217727;return k!==0?(r=k&~p,r!==0?f=ue(r):(x&=k,x!==0?f=ue(x):a||(a=k&~e,a!==0&&(f=ue(a))))):(k=r&~p,k!==0?f=ue(k):x!==0?f=ue(x):a||(a=r&~e,a!==0&&(f=ue(a)))),f===0?0:t!==0&&t!==f&&(t&p)===0&&(p=f&-f,a=t&-t,p>=a||p===32&&(a&4194048)!==0)?t:f}function ye(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Re(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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=ce;return ce<<=1,(ce&62914560)===0&&(ce=4194304),e}function tt(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Ve(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Vt(e,t,a,r,f,p){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 k=e.entanglements,R=e.expirationTimes,V=e.hiddenUpdates;for(a=x&~a;0<a;){var Y=31-Wt(a),W=1<<Y;k[Y]=0,R[Y]=-1;var G=V[Y];if(G!==null)for(V[Y]=null,Y=0;Y<G.length;Y++){var K=G[Y];K!==null&&(K.lane&=-536870913)}a&=~W}r!==0&&Ht(e,r,0),p!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=p&~(x&~t))}function Ht(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Wt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function kt(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-Wt(a),f=1<<r;f&t|e[r]&t&&(e[r]|=t),a&=~f}}function ls(e,t){var a=t&-t;return a=(a&42)!==0?1:Hn(a),(a&(e.suspendedLanes|t))!==0?0:a}function Hn(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 xa(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function rm(){var e=$.p;return e!==0?e:(e=window.event,e===void 0?32:Fv(e.type))}function lm(e,t){var a=$.p;try{return $.p=e,t()}finally{$.p=a}}var zs=Math.random().toString(36).slice(2),qt="__reactFiber$"+zs,sn="__reactProps$"+zs,si="__reactContainer$"+zs,qc="__reactEvents$"+zs,Ux="__reactListeners$"+zs,zx="__reactHandles$"+zs,cm="__reactResources$"+zs,po="__reactMarker$"+zs;function Gc(e){delete e[qt],delete e[sn],delete e[qc],delete e[Ux],delete e[zx]}function ai(e){var t=e[qt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[si]||a[qt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Av(e);e!==null;){if(a=e[qt])return a;e=Av(e)}return t}e=a,a=e.parentNode}return null}function ii(e){if(e=e[qt]||e[si]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function mo(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function oi(e){var t=e[cm];return t||(t=e[cm]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function zt(e){e[po]=!0}var um=new Set,dm={};function Sa(e,t){ri(e,t),ri(e+"Capture",t)}function ri(e,t){for(dm[e]=t,e=0;e<t.length;e++)um.add(t[e])}var Px=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]*$"),fm={},pm={};function Vx(e){return zn.call(pm,e)?!0:zn.call(fm,e)?!1:Px.test(e)?pm[e]=!0:(fm[e]=!0,!1)}function Ur(e,t,a){if(Vx(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function zr(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function cs(e,t,a,r){if(r===null)e.removeAttribute(a);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+r)}}function kn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Hx(e,t,a){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var f=r.get,p=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return f.call(this)},set:function(x){a=""+x,p.call(this,x)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function $c(e){if(!e._valueTracker){var t=mm(e)?"checked":"value";e._valueTracker=Hx(e,t,""+e[t])}}function hm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=mm(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function Pr(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 qx=/[\n"\\]/g;function wn(e){return e.replace(qx,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Fc(e,t,a,r,f,p,x,k){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),t!=null?x==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+kn(t)):e.value!==""+kn(t)&&(e.value=""+kn(t)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),t!=null?Zc(e,x,kn(t)):a!=null?Zc(e,x,kn(a)):r!=null&&e.removeAttribute("value"),f==null&&p!=null&&(e.defaultChecked=!!p),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?e.name=""+kn(k):e.removeAttribute("name")}function gm(e,t,a,r,f,p,x,k){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),t!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||t!=null)){$c(e);return}a=a!=null?""+kn(a):"",t=t!=null?""+kn(t):a,k||t===e.value||(e.value=t),e.defaultValue=t}r=r??f,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=k?e.checked:!!r,e.defaultChecked=!!r,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),$c(e)}function Zc(e,t,a){t==="number"&&Pr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function li(e,t,a,r){if(e=e.options,t){t={};for(var f=0;f<a.length;f++)t["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=t.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&r&&(e[a].defaultSelected=!0)}else{for(a=""+kn(a),t=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,r&&(e[f].defaultSelected=!0);return}t!==null||e[f].disabled||(t=e[f])}t!==null&&(t.selected=!0)}}function vm(e,t,a){if(t!=null&&(t=""+kn(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+kn(a):""}function ym(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(o(92));if(X(r)){if(1<r.length)throw Error(o(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=kn(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),$c(e)}function ci(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var Gx=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 bm(e,t,a){var r=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,a):typeof a!="number"||a===0||Gx.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function _m(e,t,a){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var f in t)r=t[f],t.hasOwnProperty(f)&&a[f]!==r&&bm(e,f,r)}else for(var p in t)t.hasOwnProperty(p)&&bm(e,p,t[p])}function Kc(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 $x=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"]]),Fx=/^[\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 Vr(e){return Fx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function us(){}var Yc=null;function Jc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ui=null,di=null;function xm(e){var t=ii(e);if(t&&(e=t.stateNode)){var a=e[sn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Fc(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+wn(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var f=r[sn]||null;if(!f)throw Error(o(90));Fc(r,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&hm(r)}break e;case"textarea":vm(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&li(e,!!a.multiple,t,!1)}}}var Wc=!1;function Sm(e,t,a){if(Wc)return e(t,a);Wc=!0;try{var r=e(t);return r}finally{if(Wc=!1,(ui!==null||di!==null)&&(Cl(),ui&&(t=ui,e=di,di=ui=null,xm(t),e)))for(t=0;t<e.length;t++)xm(e[t])}}function ho(e,t){var a=e.stateNode;if(a===null)return null;var r=a[sn]||null;if(r===null)return null;a=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(o(231,t,typeof a));return a}var ds=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xc=!1;if(ds)try{var go={};Object.defineProperty(go,"passive",{get:function(){Xc=!0}}),window.addEventListener("test",go,go),window.removeEventListener("test",go,go)}catch{Xc=!1}var Ps=null,Qc=null,Hr=null;function Tm(){if(Hr)return Hr;var e,t=Qc,a=t.length,r,f="value"in Ps?Ps.value:Ps.textContent,p=f.length;for(e=0;e<a&&t[e]===f[e];e++);var x=a-e;for(r=1;r<=x&&t[a-r]===f[p-r];r++);return Hr=f.slice(e,1<r?1-r:void 0)}function qr(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Gr(){return!0}function km(){return!1}function an(e){function t(a,r,f,p,x){this._reactName=a,this._targetInst=f,this.type=r,this.nativeEvent=p,this.target=x,this.currentTarget=null;for(var k in e)e.hasOwnProperty(k)&&(a=e[k],this[k]=a?a(p):p[k]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Gr:km,this.isPropagationStopped=km,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Gr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Gr)},persist:function(){},isPersistent:Gr}),t}var Ta={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$r=an(Ta),vo=b({},Ta,{view:0,detail:0}),Zx=an(vo),eu,tu,yo,Fr=b({},vo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:su,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!==yo&&(yo&&e.type==="mousemove"?(eu=e.screenX-yo.screenX,tu=e.screenY-yo.screenY):tu=eu=0,yo=e),eu)},movementY:function(e){return"movementY"in e?e.movementY:tu}}),wm=an(Fr),Kx=b({},Fr,{dataTransfer:0}),Yx=an(Kx),Jx=b({},vo,{relatedTarget:0}),nu=an(Jx),Wx=b({},Ta,{animationName:0,elapsedTime:0,pseudoElement:0}),Xx=an(Wx),Qx=b({},Ta,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),e1=an(Qx),t1=b({},Ta,{data:0}),Nm=an(t1),n1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},s1={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"},a1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function i1(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=a1[e])?!!t[e]:!1}function su(){return i1}var o1=b({},vo,{key:function(e){if(e.key){var t=n1[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=qr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?s1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:su,charCode:function(e){return e.type==="keypress"?qr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?qr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),r1=an(o1),l1=b({},Fr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jm=an(l1),c1=b({},vo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:su}),u1=an(c1),d1=b({},Ta,{propertyName:0,elapsedTime:0,pseudoElement:0}),f1=an(d1),p1=b({},Fr,{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}),m1=an(p1),h1=b({},Ta,{newState:0,oldState:0}),g1=an(h1),v1=[9,13,27,32],au=ds&&"CompositionEvent"in window,bo=null;ds&&"documentMode"in document&&(bo=document.documentMode);var y1=ds&&"TextEvent"in window&&!bo,Cm=ds&&(!au||bo&&8<bo&&11>=bo),Em=" ",Am=!1;function Dm(e,t){switch(e){case"keyup":return v1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fi=!1;function b1(e,t){switch(e){case"compositionend":return Rm(t);case"keypress":return t.which!==32?null:(Am=!0,Em);case"textInput":return e=t.data,e===Em&&Am?null:e;default:return null}}function _1(e,t){if(fi)return e==="compositionend"||!au&&Dm(e,t)?(e=Tm(),Hr=Qc=Ps=null,fi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Cm&&t.locale!=="ko"?null:t.data;default:return null}}var x1={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 Mm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!x1[e.type]:t==="textarea"}function Om(e,t,a,r){ui?di?di.push(r):di=[r]:ui=r,t=Il(t,"onChange"),0<t.length&&(a=new $r("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var _o=null,xo=null;function S1(e){gv(e,0)}function Zr(e){var t=mo(e);if(hm(t))return e}function Im(e,t){if(e==="change")return t}var Bm=!1;if(ds){var iu;if(ds){var ou="oninput"in document;if(!ou){var Lm=document.createElement("div");Lm.setAttribute("oninput","return;"),ou=typeof Lm.oninput=="function"}iu=ou}else iu=!1;Bm=iu&&(!document.documentMode||9<document.documentMode)}function Um(){_o&&(_o.detachEvent("onpropertychange",zm),xo=_o=null)}function zm(e){if(e.propertyName==="value"&&Zr(xo)){var t=[];Om(t,xo,e,Jc(e)),Sm(S1,t)}}function T1(e,t,a){e==="focusin"?(Um(),_o=t,xo=a,_o.attachEvent("onpropertychange",zm)):e==="focusout"&&Um()}function k1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zr(xo)}function w1(e,t){if(e==="click")return Zr(t)}function N1(e,t){if(e==="input"||e==="change")return Zr(t)}function j1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fn=typeof Object.is=="function"?Object.is:j1;function So(e,t){if(fn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var f=a[r];if(!zn.call(t,f)||!fn(e[f],t[f]))return!1}return!0}function Pm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vm(e,t){var a=Pm(e);e=0;for(var r;a;){if(a.nodeType===3){if(r=e+a.textContent.length,e<=t&&r>=t)return{node:a,offset:t-e};e=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Pm(a)}}function Hm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Hm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function qm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pr(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Pr(e.document)}return t}function ru(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var C1=ds&&"documentMode"in document&&11>=document.documentMode,pi=null,lu=null,To=null,cu=!1;function Gm(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;cu||pi==null||pi!==Pr(r)||(r=pi,"selectionStart"in r&&ru(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),To&&So(To,r)||(To=r,r=Il(lu,"onSelect"),0<r.length&&(t=new $r("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=pi)))}function ka(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var mi={animationend:ka("Animation","AnimationEnd"),animationiteration:ka("Animation","AnimationIteration"),animationstart:ka("Animation","AnimationStart"),transitionrun:ka("Transition","TransitionRun"),transitionstart:ka("Transition","TransitionStart"),transitioncancel:ka("Transition","TransitionCancel"),transitionend:ka("Transition","TransitionEnd")},uu={},$m={};ds&&($m=document.createElement("div").style,"AnimationEvent"in window||(delete mi.animationend.animation,delete mi.animationiteration.animation,delete mi.animationstart.animation),"TransitionEvent"in window||delete mi.transitionend.transition);function wa(e){if(uu[e])return uu[e];if(!mi[e])return e;var t=mi[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in $m)return uu[e]=t[a];return e}var Fm=wa("animationend"),Zm=wa("animationiteration"),Km=wa("animationstart"),E1=wa("transitionrun"),A1=wa("transitionstart"),D1=wa("transitioncancel"),Ym=wa("transitionend"),Jm=new Map,du="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(" ");du.push("scrollEnd");function qn(e,t){Jm.set(e,t),Sa(t,[e])}var Kr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=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(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Nn=[],hi=0,fu=0;function Yr(){for(var e=hi,t=fu=hi=0;t<e;){var a=Nn[t];Nn[t++]=null;var r=Nn[t];Nn[t++]=null;var f=Nn[t];Nn[t++]=null;var p=Nn[t];if(Nn[t++]=null,r!==null&&f!==null){var x=r.pending;x===null?f.next=f:(f.next=x.next,x.next=f),r.pending=f}p!==0&&Wm(a,f,p)}}function Jr(e,t,a,r){Nn[hi++]=e,Nn[hi++]=t,Nn[hi++]=a,Nn[hi++]=r,fu|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function pu(e,t,a,r){return Jr(e,t,a,r),Wr(e)}function Na(e,t){return Jr(e,null,null,t),Wr(e)}function Wm(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var f=!1,p=e.return;p!==null;)p.childLanes|=a,r=p.alternate,r!==null&&(r.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(f=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,f&&t!==null&&(f=31-Wt(a),e=p.hiddenUpdates,r=e[f],r===null?e[f]=[t]:r.push(t),t.lane=a|536870912),p):null}function Wr(e){if(50<$o)throw $o=0,Sd=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var gi={};function R1(e,t,a,r){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=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pn(e,t,a,r){return new R1(e,t,a,r)}function mu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function fs(e,t){var a=e.alternate;return a===null?(a=pn(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,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,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Xm(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,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,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Xr(e,t,a,r,f,p){var x=0;if(r=e,typeof e=="function")mu(e)&&(x=1);else if(typeof e=="string")x=LS(e,a,Ie.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Z:return e=pn(31,a,t,f),e.elementType=Z,e.lanes=p,e;case N:return ja(a.children,f,p,t);case j:x=8,f|=24;break;case w:return e=pn(12,a,t,f|2),e.elementType=w,e.lanes=p,e;case D:return e=pn(13,a,t,f),e.elementType=D,e.lanes=p,e;case E:return e=pn(19,a,t,f),e.elementType=E,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case A:x=10;break e;case C:x=9;break e;case M:x=11;break e;case H:x=14;break e;case z:x=16,r=null;break e}x=29,a=Error(o(130,e===null?"null":typeof e,"")),r=null}return t=pn(x,a,t,f),t.elementType=e,t.type=r,t.lanes=p,t}function ja(e,t,a,r){return e=pn(7,e,r,t),e.lanes=a,e}function hu(e,t,a){return e=pn(6,e,null,t),e.lanes=a,e}function Qm(e){var t=pn(18,null,null,0);return t.stateNode=e,t}function gu(e,t,a){return t=pn(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var eh=new WeakMap;function jn(e,t){if(typeof e=="object"&&e!==null){var a=eh.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Tn(t)},eh.set(e,t),t)}return{value:e,source:t,stack:Tn(t)}}var vi=[],yi=0,Qr=null,ko=0,Cn=[],En=0,Vs=null,Wn=1,Xn="";function ps(e,t){vi[yi++]=ko,vi[yi++]=Qr,Qr=e,ko=t}function th(e,t,a){Cn[En++]=Wn,Cn[En++]=Xn,Cn[En++]=Vs,Vs=e;var r=Wn;e=Xn;var f=32-Wt(r)-1;r&=~(1<<f),a+=1;var p=32-Wt(t)+f;if(30<p){var x=f-f%5;p=(r&(1<<x)-1).toString(32),r>>=x,f-=x,Wn=1<<32-Wt(t)+f|a<<f|r,Xn=p+e}else Wn=1<<p|a<<f|r,Xn=e}function vu(e){e.return!==null&&(ps(e,1),th(e,1,0))}function yu(e){for(;e===Qr;)Qr=vi[--yi],vi[yi]=null,ko=vi[--yi],vi[yi]=null;for(;e===Vs;)Vs=Cn[--En],Cn[En]=null,Xn=Cn[--En],Cn[En]=null,Wn=Cn[--En],Cn[En]=null}function nh(e,t){Cn[En++]=Wn,Cn[En++]=Xn,Cn[En++]=Vs,Wn=t.id,Xn=t.overflow,Vs=e}var Gt=null,lt=null,He=!1,Hs=null,An=!1,bu=Error(o(519));function qs(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wo(jn(t,e)),bu}function sh(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[qt]=e,t[sn]=r,a){case"dialog":Le("cancel",t),Le("close",t);break;case"iframe":case"object":case"embed":Le("load",t);break;case"video":case"audio":for(a=0;a<Zo.length;a++)Le(Zo[a],t);break;case"source":Le("error",t);break;case"img":case"image":case"link":Le("error",t),Le("load",t);break;case"details":Le("toggle",t);break;case"input":Le("invalid",t),gm(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Le("invalid",t);break;case"textarea":Le("invalid",t),ym(t,r.value,r.defaultValue,r.children)}a=r.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||r.suppressHydrationWarning===!0||_v(t.textContent,a)?(r.popover!=null&&(Le("beforetoggle",t),Le("toggle",t)),r.onScroll!=null&&Le("scroll",t),r.onScrollEnd!=null&&Le("scrollend",t),r.onClick!=null&&(t.onclick=us),t=!0):t=!1,t||qs(e,!0)}function ah(e){for(Gt=e.return;Gt;)switch(Gt.tag){case 5:case 31:case 13:An=!1;return;case 27:case 3:An=!0;return;default:Gt=Gt.return}}function bi(e){if(e!==Gt)return!1;if(!He)return ah(e),He=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Ld(e.type,e.memoizedProps)),a=!a),a&<&&qs(e),ah(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));lt=Ev(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));lt=Ev(e)}else t===27?(t=lt,sa(e.type)?(e=Hd,Hd=null,lt=e):lt=t):lt=Gt?Rn(e.stateNode.nextSibling):null;return!0}function Ca(){lt=Gt=null,He=!1}function _u(){var e=Hs;return e!==null&&(cn===null?cn=e:cn.push.apply(cn,e),Hs=null),e}function wo(e){Hs===null?Hs=[e]:Hs.push(e)}var xu=$e(null),Ea=null,ms=null;function Gs(e,t,a){Se(xu,t._currentValue),t._currentValue=a}function hs(e){e._currentValue=xu.current,we(xu)}function Su(e,t,a){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===a)break;e=e.return}}function Tu(e,t,a,r){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var p=f.dependencies;if(p!==null){var x=f.child;p=p.firstContext;e:for(;p!==null;){var k=p;p=f;for(var R=0;R<t.length;R++)if(k.context===t[R]){p.lanes|=a,k=p.alternate,k!==null&&(k.lanes|=a),Su(p.return,a,e),r||(x=null);break e}p=k.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(o(341));x.lanes|=a,p=x.alternate,p!==null&&(p.lanes|=a),Su(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 _i(e,t,a,r){e=null;for(var f=t,p=!1;f!==null;){if(!p){if((f.flags&524288)!==0)p=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(o(387));if(x=x.memoizedProps,x!==null){var k=f.type;fn(f.pendingProps.value,x.value)||(e!==null?e.push(k):e=[k])}}else if(f===me.current){if(x=f.alternate,x===null)throw Error(o(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Xo):e=[Xo])}f=f.return}e!==null&&Tu(t,e,a,r),t.flags|=262144}function el(e){for(e=e.firstContext;e!==null;){if(!fn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Aa(e){Ea=e,ms=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function $t(e){return ih(Ea,e)}function tl(e,t){return Ea===null&&Aa(e),ih(e,t)}function ih(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},ms===null){if(e===null)throw Error(o(308));ms=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ms=ms.next=t;return a}var M1=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},O1=n.unstable_scheduleCallback,I1=n.unstable_NormalPriority,Et={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ku(){return{controller:new M1,data:new Map,refCount:0}}function No(e){e.refCount--,e.refCount===0&&O1(I1,function(){e.controller.abort()})}var jo=null,wu=0,xi=0,Si=null;function B1(e,t){if(jo===null){var a=jo=[];wu=0,xi=Cd(),Si={status:"pending",value:void 0,then:function(r){a.push(r)}}}return wu++,t.then(oh,oh),t}function oh(){if(--wu===0&&jo!==null){Si!==null&&(Si.status="fulfilled");var e=jo;jo=null,xi=0,Si=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function L1(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var f=0;f<a.length;f++)(0,a[f])(t)},function(f){for(r.status="rejected",r.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),r}var rh=B.S;B.S=function(e,t){Gg=Je(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&B1(e,t),rh!==null&&rh(e,t)};var Da=$e(null);function Nu(){var e=Da.current;return e!==null?e:ot.pooledCache}function nl(e,t){t===null?Se(Da,Da.current):Se(Da,t.pool)}function lh(){var e=Nu();return e===null?null:{parent:Et._currentValue,pool:e}}var Ti=Error(o(460)),ju=Error(o(474)),sl=Error(o(542)),al={then:function(){}};function ch(e){return e=e.status,e==="fulfilled"||e==="rejected"}function uh(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(us,us),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fh(e),e;default:if(typeof t.status=="string")t.then(us,us);else{if(e=ot,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var f=t;f.status="fulfilled",f.value=r}},function(r){if(t.status==="pending"){var f=t;f.status="rejected",f.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fh(e),e}throw Ma=t,Ti}}function Ra(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Ma=a,Ti):a}}var Ma=null;function dh(){if(Ma===null)throw Error(o(459));var e=Ma;return Ma=null,e}function fh(e){if(e===Ti||e===sl)throw Error(o(483))}var ki=null,Co=0;function il(e){var t=Co;return Co+=1,ki===null&&(ki=[]),uh(ki,e,t)}function Eo(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ol(e,t){throw t.$$typeof===_?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function ph(e){function t(L,O){if(e){var P=L.deletions;P===null?(L.deletions=[O],L.flags|=16):P.push(O)}}function a(L,O){if(!e)return null;for(;O!==null;)t(L,O),O=O.sibling;return null}function r(L){for(var O=new Map;L!==null;)L.key!==null?O.set(L.key,L):O.set(L.index,L),L=L.sibling;return O}function f(L,O){return L=fs(L,O),L.index=0,L.sibling=null,L}function p(L,O,P){return L.index=P,e?(P=L.alternate,P!==null?(P=P.index,P<O?(L.flags|=67108866,O):P):(L.flags|=67108866,O)):(L.flags|=1048576,O)}function x(L){return e&&L.alternate===null&&(L.flags|=67108866),L}function k(L,O,P,J){return O===null||O.tag!==6?(O=hu(P,L.mode,J),O.return=L,O):(O=f(O,P),O.return=L,O)}function R(L,O,P,J){var be=P.type;return be===N?Y(L,O,P.props.children,J,P.key):O!==null&&(O.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===z&&Ra(be)===O.type)?(O=f(O,P.props),Eo(O,P),O.return=L,O):(O=Xr(P.type,P.key,P.props,null,L.mode,J),Eo(O,P),O.return=L,O)}function V(L,O,P,J){return O===null||O.tag!==4||O.stateNode.containerInfo!==P.containerInfo||O.stateNode.implementation!==P.implementation?(O=gu(P,L.mode,J),O.return=L,O):(O=f(O,P.children||[]),O.return=L,O)}function Y(L,O,P,J,be){return O===null||O.tag!==7?(O=ja(P,L.mode,J,be),O.return=L,O):(O=f(O,P),O.return=L,O)}function W(L,O,P){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=hu(""+O,L.mode,P),O.return=L,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case S:return P=Xr(O.type,O.key,O.props,null,L.mode,P),Eo(P,O),P.return=L,P;case T:return O=gu(O,L.mode,P),O.return=L,O;case z:return O=Ra(O),W(L,O,P)}if(X(O)||ae(O))return O=ja(O,L.mode,P,null),O.return=L,O;if(typeof O.then=="function")return W(L,il(O),P);if(O.$$typeof===A)return W(L,tl(L,O),P);ol(L,O)}return null}function G(L,O,P,J){var be=O!==null?O.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return be!==null?null:k(L,O,""+P,J);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case S:return P.key===be?R(L,O,P,J):null;case T:return P.key===be?V(L,O,P,J):null;case z:return P=Ra(P),G(L,O,P,J)}if(X(P)||ae(P))return be!==null?null:Y(L,O,P,J,null);if(typeof P.then=="function")return G(L,O,il(P),J);if(P.$$typeof===A)return G(L,O,tl(L,P),J);ol(L,P)}return null}function K(L,O,P,J,be){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return L=L.get(P)||null,k(O,L,""+J,be);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case S:return L=L.get(J.key===null?P:J.key)||null,R(O,L,J,be);case T:return L=L.get(J.key===null?P:J.key)||null,V(O,L,J,be);case z:return J=Ra(J),K(L,O,P,J,be)}if(X(J)||ae(J))return L=L.get(P)||null,Y(O,L,J,be,null);if(typeof J.then=="function")return K(L,O,P,il(J),be);if(J.$$typeof===A)return K(L,O,P,tl(O,J),be);ol(O,J)}return null}function ge(L,O,P,J){for(var be=null,Ze=null,ve=O,Me=O=0,ze=null;ve!==null&&Me<P.length;Me++){ve.index>Me?(ze=ve,ve=null):ze=ve.sibling;var Ke=G(L,ve,P[Me],J);if(Ke===null){ve===null&&(ve=ze);break}e&&ve&&Ke.alternate===null&&t(L,ve),O=p(Ke,O,Me),Ze===null?be=Ke:Ze.sibling=Ke,Ze=Ke,ve=ze}if(Me===P.length)return a(L,ve),He&&ps(L,Me),be;if(ve===null){for(;Me<P.length;Me++)ve=W(L,P[Me],J),ve!==null&&(O=p(ve,O,Me),Ze===null?be=ve:Ze.sibling=ve,Ze=ve);return He&&ps(L,Me),be}for(ve=r(ve);Me<P.length;Me++)ze=K(ve,L,Me,P[Me],J),ze!==null&&(e&&ze.alternate!==null&&ve.delete(ze.key===null?Me:ze.key),O=p(ze,O,Me),Ze===null?be=ze:Ze.sibling=ze,Ze=ze);return e&&ve.forEach(function(la){return t(L,la)}),He&&ps(L,Me),be}function xe(L,O,P,J){if(P==null)throw Error(o(151));for(var be=null,Ze=null,ve=O,Me=O=0,ze=null,Ke=P.next();ve!==null&&!Ke.done;Me++,Ke=P.next()){ve.index>Me?(ze=ve,ve=null):ze=ve.sibling;var la=G(L,ve,Ke.value,J);if(la===null){ve===null&&(ve=ze);break}e&&ve&&la.alternate===null&&t(L,ve),O=p(la,O,Me),Ze===null?be=la:Ze.sibling=la,Ze=la,ve=ze}if(Ke.done)return a(L,ve),He&&ps(L,Me),be;if(ve===null){for(;!Ke.done;Me++,Ke=P.next())Ke=W(L,Ke.value,J),Ke!==null&&(O=p(Ke,O,Me),Ze===null?be=Ke:Ze.sibling=Ke,Ze=Ke);return He&&ps(L,Me),be}for(ve=r(ve);!Ke.done;Me++,Ke=P.next())Ke=K(ve,L,Me,Ke.value,J),Ke!==null&&(e&&Ke.alternate!==null&&ve.delete(Ke.key===null?Me:Ke.key),O=p(Ke,O,Me),Ze===null?be=Ke:Ze.sibling=Ke,Ze=Ke);return e&&ve.forEach(function(KS){return t(L,KS)}),He&&ps(L,Me),be}function at(L,O,P,J){if(typeof P=="object"&&P!==null&&P.type===N&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case S:e:{for(var be=P.key;O!==null;){if(O.key===be){if(be=P.type,be===N){if(O.tag===7){a(L,O.sibling),J=f(O,P.props.children),J.return=L,L=J;break e}}else if(O.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===z&&Ra(be)===O.type){a(L,O.sibling),J=f(O,P.props),Eo(J,P),J.return=L,L=J;break e}a(L,O);break}else t(L,O);O=O.sibling}P.type===N?(J=ja(P.props.children,L.mode,J,P.key),J.return=L,L=J):(J=Xr(P.type,P.key,P.props,null,L.mode,J),Eo(J,P),J.return=L,L=J)}return x(L);case T:e:{for(be=P.key;O!==null;){if(O.key===be)if(O.tag===4&&O.stateNode.containerInfo===P.containerInfo&&O.stateNode.implementation===P.implementation){a(L,O.sibling),J=f(O,P.children||[]),J.return=L,L=J;break e}else{a(L,O);break}else t(L,O);O=O.sibling}J=gu(P,L.mode,J),J.return=L,L=J}return x(L);case z:return P=Ra(P),at(L,O,P,J)}if(X(P))return ge(L,O,P,J);if(ae(P)){if(be=ae(P),typeof be!="function")throw Error(o(150));return P=be.call(P),xe(L,O,P,J)}if(typeof P.then=="function")return at(L,O,il(P),J);if(P.$$typeof===A)return at(L,O,tl(L,P),J);ol(L,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,O!==null&&O.tag===6?(a(L,O.sibling),J=f(O,P),J.return=L,L=J):(a(L,O),J=hu(P,L.mode,J),J.return=L,L=J),x(L)):a(L,O)}return function(L,O,P,J){try{Co=0;var be=at(L,O,P,J);return ki=null,be}catch(ve){if(ve===Ti||ve===sl)throw ve;var Ze=pn(29,ve,null,L.mode);return Ze.lanes=J,Ze.return=L,Ze}finally{}}}var Oa=ph(!0),mh=ph(!1),$s=!1;function Cu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Eu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Fs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Zs(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(We&2)!==0){var f=r.pending;return f===null?t.next=t:(t.next=f.next,f.next=t),r.pending=t,t=Wr(e),Wm(e,null,a),t}return Jr(e,r,t,a),Wr(e)}function Ao(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,kt(e,a)}}function Au(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var f=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?f=p=x:p=p.next=x,a=a.next}while(a!==null);p===null?f=p=t:p=p.next=t}else f=p=t;a={baseState:r.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:r.shared,callbacks:r.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Du=!1;function Do(){if(Du){var e=Si;if(e!==null)throw e}}function Ro(e,t,a,r){Du=!1;var f=e.updateQueue;$s=!1;var p=f.firstBaseUpdate,x=f.lastBaseUpdate,k=f.shared.pending;if(k!==null){f.shared.pending=null;var R=k,V=R.next;R.next=null,x===null?p=V:x.next=V,x=R;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,k=Y.lastBaseUpdate,k!==x&&(k===null?Y.firstBaseUpdate=V:k.next=V,Y.lastBaseUpdate=R))}if(p!==null){var W=f.baseState;x=0,Y=V=R=null,k=p;do{var G=k.lane&-536870913,K=G!==k.lane;if(K?(Ue&G)===G:(r&G)===G){G!==0&&G===xi&&(Du=!0),Y!==null&&(Y=Y.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var ge=e,xe=k;G=t;var at=a;switch(xe.tag){case 1:if(ge=xe.payload,typeof ge=="function"){W=ge.call(at,W,G);break e}W=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=xe.payload,G=typeof ge=="function"?ge.call(at,W,G):ge,G==null)break e;W=b({},W,G);break e;case 2:$s=!0}}G=k.callback,G!==null&&(e.flags|=64,K&&(e.flags|=8192),K=f.callbacks,K===null?f.callbacks=[G]:K.push(G))}else K={lane:G,tag:k.tag,payload:k.payload,callback:k.callback,next:null},Y===null?(V=Y=K,R=W):Y=Y.next=K,x|=G;if(k=k.next,k===null){if(k=f.shared.pending,k===null)break;K=k,k=K.next,K.next=null,f.lastBaseUpdate=K,f.shared.pending=null}}while(!0);Y===null&&(R=W),f.baseState=R,f.firstBaseUpdate=V,f.lastBaseUpdate=Y,p===null&&(f.shared.lanes=0),Xs|=x,e.lanes=x,e.memoizedState=W}}function hh(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function gh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)hh(a[e],t)}var wi=$e(null),rl=$e(0);function vh(e,t){e=ks,Se(rl,e),Se(wi,t),ks=e|t.baseLanes}function Ru(){Se(rl,ks),Se(wi,wi.current)}function Mu(){ks=rl.current,we(wi),we(rl)}var mn=$e(null),Dn=null;function Ks(e){var t=e.alternate;Se(wt,wt.current&1),Se(mn,e),Dn===null&&(t===null||wi.current!==null||t.memoizedState!==null)&&(Dn=e)}function Ou(e){Se(wt,wt.current),Se(mn,e),Dn===null&&(Dn=e)}function yh(e){e.tag===22?(Se(wt,wt.current),Se(mn,e),Dn===null&&(Dn=e)):Ys()}function Ys(){Se(wt,wt.current),Se(mn,mn.current)}function hn(e){we(mn),Dn===e&&(Dn=null),we(wt)}var wt=$e(0);function ll(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Pd(a)||Vd(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var gs=0,Ae=null,nt=null,At=null,cl=!1,Ni=!1,Ia=!1,ul=0,Mo=0,ji=null,U1=0;function yt(){throw Error(o(321))}function Iu(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!fn(e[a],t[a]))return!1;return!0}function Bu(e,t,a,r,f,p){return gs=p,Ae=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,B.H=e===null||e.memoizedState===null?tg:Wu,Ia=!1,p=a(r,f),Ia=!1,Ni&&(p=_h(t,a,r,f)),bh(e),p}function bh(e){B.H=Bo;var t=nt!==null&&nt.next!==null;if(gs=0,At=nt=Ae=null,cl=!1,Mo=0,ji=null,t)throw Error(o(300));e===null||Dt||(e=e.dependencies,e!==null&&el(e)&&(Dt=!0))}function _h(e,t,a,r){Ae=e;var f=0;do{if(Ni&&(ji=null),Mo=0,Ni=!1,25<=f)throw Error(o(301));if(f+=1,At=nt=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}B.H=ng,p=t(a,r)}while(Ni);return p}function z1(){var e=B.H,t=e.useState()[0];return t=typeof t.then=="function"?Oo(t):t,e=e.useState()[0],(nt!==null?nt.memoizedState:null)!==e&&(Ae.flags|=1024),t}function Lu(){var e=ul!==0;return ul=0,e}function Uu(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function zu(e){if(cl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}cl=!1}gs=0,At=nt=Ae=null,Ni=!1,Mo=ul=0,ji=null}function en(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return At===null?Ae.memoizedState=At=e:At=At.next=e,At}function Nt(){if(nt===null){var e=Ae.alternate;e=e!==null?e.memoizedState:null}else e=nt.next;var t=At===null?Ae.memoizedState:At.next;if(t!==null)At=t,nt=e;else{if(e===null)throw Ae.alternate===null?Error(o(467)):Error(o(310));nt=e,e={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},At===null?Ae.memoizedState=At=e:At=At.next=e}return At}function dl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Oo(e){var t=Mo;return Mo+=1,ji===null&&(ji=[]),e=uh(ji,e,t),t=Ae,(At===null?t.memoizedState:At.next)===null&&(t=t.alternate,B.H=t===null||t.memoizedState===null?tg:Wu),e}function fl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Oo(e);if(e.$$typeof===A)return $t(e)}throw Error(o(438,String(e)))}function Pu(e){var t=null,a=Ae.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=Ae.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(f){return f.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=dl(),Ae.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),r=0;r<e;r++)a[r]=F;return t.index++,a}function vs(e,t){return typeof t=="function"?t(e):t}function pl(e){var t=Nt();return Vu(t,nt,e)}function Vu(e,t,a){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=a;var f=e.baseQueue,p=r.pending;if(p!==null){if(f!==null){var x=f.next;f.next=p.next,p.next=x}t.baseQueue=f=p,r.pending=null}if(p=e.baseState,f===null)e.memoizedState=p;else{t=f.next;var k=x=null,R=null,V=t,Y=!1;do{var W=V.lane&-536870913;if(W!==V.lane?(Ue&W)===W:(gs&W)===W){var G=V.revertLane;if(G===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),W===xi&&(Y=!0);else if((gs&G)===G){V=V.next,G===xi&&(Y=!0);continue}else W={lane:0,revertLane:V.revertLane,gesture:null,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(k=R=W,x=p):R=R.next=W,Ae.lanes|=G,Xs|=G;W=V.action,Ia&&a(p,W),p=V.hasEagerState?V.eagerState:a(p,W)}else G={lane:W,revertLane:V.revertLane,gesture:V.gesture,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null},R===null?(k=R=G,x=p):R=R.next=G,Ae.lanes|=W,Xs|=W;V=V.next}while(V!==null&&V!==t);if(R===null?x=p:R.next=k,!fn(p,e.memoizedState)&&(Dt=!0,Y&&(a=Si,a!==null)))throw a;e.memoizedState=p,e.baseState=x,e.baseQueue=R,r.lastRenderedState=p}return f===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Hu(e){var t=Nt(),a=t.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=e;var r=a.dispatch,f=a.pending,p=t.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do p=e(p,x.action),x=x.next;while(x!==f);fn(p,t.memoizedState)||(Dt=!0),t.memoizedState=p,t.baseQueue===null&&(t.baseState=p),a.lastRenderedState=p}return[p,r]}function xh(e,t,a){var r=Ae,f=Nt(),p=He;if(p){if(a===void 0)throw Error(o(407));a=a()}else a=t();var x=!fn((nt||f).memoizedState,a);if(x&&(f.memoizedState=a,Dt=!0),f=f.queue,$u(kh.bind(null,r,f,e),[e]),f.getSnapshot!==t||x||At!==null&&At.memoizedState.tag&1){if(r.flags|=2048,Ci(9,{destroy:void 0},Th.bind(null,r,f,a,t),null),ot===null)throw Error(o(349));p||(gs&127)!==0||Sh(r,t,a)}return a}function Sh(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Ae.updateQueue,t===null?(t=dl(),Ae.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Th(e,t,a,r){t.value=a,t.getSnapshot=r,wh(t)&&Nh(e)}function kh(e,t,a){return a(function(){wh(t)&&Nh(e)})}function wh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!fn(e,a)}catch{return!0}}function Nh(e){var t=Na(e,2);t!==null&&un(t,e,2)}function qu(e){var t=en();if(typeof e=="function"){var a=e;if(e=a(),Ia){Vn(!0);try{a()}finally{Vn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:e},t}function jh(e,t,a,r){return e.baseState=a,Vu(e,nt,typeof r=="function"?r:vs)}function P1(e,t,a,r,f){if(gl(e))throw Error(o(485));if(e=t.action,e!==null){var p={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){p.listeners.push(x)}};B.T!==null?a(!0):p.isTransition=!1,r(p),a=t.pending,a===null?(p.next=t.pending=p,Ch(t,p)):(p.next=a.next,t.pending=a.next=p)}}function Ch(e,t){var a=t.action,r=t.payload,f=e.state;if(t.isTransition){var p=B.T,x={};B.T=x;try{var k=a(f,r),R=B.S;R!==null&&R(x,k),Eh(e,t,k)}catch(V){Gu(e,t,V)}finally{p!==null&&x.types!==null&&(p.types=x.types),B.T=p}}else try{p=a(f,r),Eh(e,t,p)}catch(V){Gu(e,t,V)}}function Eh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){Ah(e,t,r)},function(r){return Gu(e,t,r)}):Ah(e,t,a)}function Ah(e,t,a){t.status="fulfilled",t.value=a,Dh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Ch(e,a)))}function Gu(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,Dh(t),t=t.next;while(t!==r)}e.action=null}function Dh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Rh(e,t){return t}function Mh(e,t){if(He){var a=ot.formState;if(a!==null){e:{var r=Ae;if(He){if(lt){t:{for(var f=lt,p=An;f.nodeType!==8;){if(!p){f=null;break t}if(f=Rn(f.nextSibling),f===null){f=null;break t}}p=f.data,f=p==="F!"||p==="F"?f:null}if(f){lt=Rn(f.nextSibling),r=f.data==="F!";break e}}qs(r)}r=!1}r&&(t=a[0])}}return a=en(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rh,lastRenderedState:t},a.queue=r,a=Xh.bind(null,Ae,r),r.dispatch=a,r=qu(!1),p=Ju.bind(null,Ae,!1,r.queue),r=en(),f={state:t,dispatch:null,action:e,pending:null},r.queue=f,a=P1.bind(null,Ae,f,p,a),f.dispatch=a,r.memoizedState=e,[t,a,!1]}function Oh(e){var t=Nt();return Ih(t,nt,e)}function Ih(e,t,a){if(t=Vu(e,t,Rh)[0],e=pl(vs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Oo(t)}catch(x){throw x===Ti?sl:x}else r=t;t=Nt();var f=t.queue,p=f.dispatch;return a!==t.memoizedState&&(Ae.flags|=2048,Ci(9,{destroy:void 0},V1.bind(null,f,a),null)),[r,p,e]}function V1(e,t){e.action=t}function Bh(e){var t=Nt(),a=nt;if(a!==null)return Ih(t,a,e);Nt(),t=t.memoizedState,a=Nt();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function Ci(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=Ae.updateQueue,t===null&&(t=dl(),Ae.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(r=a.next,a.next=e,e.next=r,t.lastEffect=e),e}function Lh(){return Nt().memoizedState}function ml(e,t,a,r){var f=en();Ae.flags|=e,f.memoizedState=Ci(1|t,{destroy:void 0},a,r===void 0?null:r)}function hl(e,t,a,r){var f=Nt();r=r===void 0?null:r;var p=f.memoizedState.inst;nt!==null&&r!==null&&Iu(r,nt.memoizedState.deps)?f.memoizedState=Ci(t,p,a,r):(Ae.flags|=e,f.memoizedState=Ci(1|t,p,a,r))}function Uh(e,t){ml(8390656,8,e,t)}function $u(e,t){hl(2048,8,e,t)}function H1(e){Ae.flags|=4;var t=Ae.updateQueue;if(t===null)t=dl(),Ae.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function zh(e){var t=Nt().memoizedState;return H1({ref:t,nextImpl:e}),function(){if((We&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Ph(e,t){return hl(4,2,e,t)}function Vh(e,t){return hl(4,4,e,t)}function Hh(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function qh(e,t,a){a=a!=null?a.concat([e]):null,hl(4,4,Hh.bind(null,t,e),a)}function Fu(){}function Gh(e,t){var a=Nt();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&Iu(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function $h(e,t){var a=Nt();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&Iu(t,r[1]))return r[0];if(r=e(),Ia){Vn(!0);try{e()}finally{Vn(!1)}}return a.memoizedState=[r,t],r}function Zu(e,t,a){return a===void 0||(gs&1073741824)!==0&&(Ue&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Fg(),Ae.lanes|=e,Xs|=e,a)}function Fh(e,t,a,r){return fn(a,t)?a:wi.current!==null?(e=Zu(e,a,r),fn(e,t)||(Dt=!0),e):(gs&42)===0||(gs&1073741824)!==0&&(Ue&261930)===0?(Dt=!0,e.memoizedState=a):(e=Fg(),Ae.lanes|=e,Xs|=e,t)}function Zh(e,t,a,r,f){var p=$.p;$.p=p!==0&&8>p?p:8;var x=B.T,k={};B.T=k,Ju(e,!1,t,a);try{var R=f(),V=B.S;if(V!==null&&V(k,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Y=L1(R,r);Io(e,t,Y,yn(e))}else Io(e,t,r,yn(e))}catch(W){Io(e,t,{then:function(){},status:"rejected",reason:W},yn())}finally{$.p=p,x!==null&&k.types!==null&&(x.types=k.types),B.T=x}}function q1(){}function Ku(e,t,a,r){if(e.tag!==5)throw Error(o(476));var f=Kh(e).queue;Zh(e,f,t,te,a===null?q1:function(){return Yh(e),a(r)})}function Kh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:te},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Yh(e){var t=Kh(e);t.next===null&&(t=e.alternate.memoizedState),Io(e,t.next.queue,{},yn())}function Yu(){return $t(Xo)}function Jh(){return Nt().memoizedState}function Wh(){return Nt().memoizedState}function G1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=yn();e=Fs(a);var r=Zs(t,e,a);r!==null&&(un(r,t,a),Ao(r,t,a)),t={cache:ku()},e.payload=t;return}t=t.return}}function $1(e,t,a){var r=yn();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},gl(e)?Qh(t,a):(a=pu(e,t,a,r),a!==null&&(un(a,e,r),eg(a,t,r)))}function Xh(e,t,a){var r=yn();Io(e,t,a,r)}function Io(e,t,a,r){var f={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(gl(e))Qh(t,f);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=t.lastRenderedReducer,p!==null))try{var x=t.lastRenderedState,k=p(x,a);if(f.hasEagerState=!0,f.eagerState=k,fn(k,x))return Jr(e,t,f,0),ot===null&&Yr(),!1}catch{}finally{}if(a=pu(e,t,f,r),a!==null)return un(a,e,r),eg(a,t,r),!0}return!1}function Ju(e,t,a,r){if(r={lane:2,revertLane:Cd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},gl(e)){if(t)throw Error(o(479))}else t=pu(e,a,r,2),t!==null&&un(t,e,2)}function gl(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function Qh(e,t){Ni=cl=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function eg(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,kt(e,a)}}var Bo={readContext:$t,use:fl,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useLayoutEffect:yt,useInsertionEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useSyncExternalStore:yt,useId:yt,useHostTransitionStatus:yt,useFormState:yt,useActionState:yt,useOptimistic:yt,useMemoCache:yt,useCacheRefresh:yt};Bo.useEffectEvent=yt;var tg={readContext:$t,use:fl,useCallback:function(e,t){return en().memoizedState=[e,t===void 0?null:t],e},useContext:$t,useEffect:Uh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,ml(4194308,4,Hh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return ml(4194308,4,e,t)},useInsertionEffect:function(e,t){ml(4,2,e,t)},useMemo:function(e,t){var a=en();t=t===void 0?null:t;var r=e();if(Ia){Vn(!0);try{e()}finally{Vn(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=en();if(a!==void 0){var f=a(t);if(Ia){Vn(!0);try{a(t)}finally{Vn(!1)}}}else f=t;return r.memoizedState=r.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},r.queue=e,e=e.dispatch=$1.bind(null,Ae,e),[r.memoizedState,e]},useRef:function(e){var t=en();return e={current:e},t.memoizedState=e},useState:function(e){e=qu(e);var t=e.queue,a=Xh.bind(null,Ae,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Fu,useDeferredValue:function(e,t){var a=en();return Zu(a,e,t)},useTransition:function(){var e=qu(!1);return e=Zh.bind(null,Ae,e.queue,!0,!1),en().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=Ae,f=en();if(He){if(a===void 0)throw Error(o(407));a=a()}else{if(a=t(),ot===null)throw Error(o(349));(Ue&127)!==0||Sh(r,t,a)}f.memoizedState=a;var p={value:a,getSnapshot:t};return f.queue=p,Uh(kh.bind(null,r,p,e),[e]),r.flags|=2048,Ci(9,{destroy:void 0},Th.bind(null,r,p,a,t),null),a},useId:function(){var e=en(),t=ot.identifierPrefix;if(He){var a=Xn,r=Wn;a=(r&~(1<<32-Wt(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=ul++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=U1++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Yu,useFormState:Mh,useActionState:Mh,useOptimistic:function(e){var t=en();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Ju.bind(null,Ae,!0,a),a.dispatch=t,[e,t]},useMemoCache:Pu,useCacheRefresh:function(){return en().memoizedState=G1.bind(null,Ae)},useEffectEvent:function(e){var t=en(),a={impl:e};return t.memoizedState=a,function(){if((We&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}},Wu={readContext:$t,use:fl,useCallback:Gh,useContext:$t,useEffect:$u,useImperativeHandle:qh,useInsertionEffect:Ph,useLayoutEffect:Vh,useMemo:$h,useReducer:pl,useRef:Lh,useState:function(){return pl(vs)},useDebugValue:Fu,useDeferredValue:function(e,t){var a=Nt();return Fh(a,nt.memoizedState,e,t)},useTransition:function(){var e=pl(vs)[0],t=Nt().memoizedState;return[typeof e=="boolean"?e:Oo(e),t]},useSyncExternalStore:xh,useId:Jh,useHostTransitionStatus:Yu,useFormState:Oh,useActionState:Oh,useOptimistic:function(e,t){var a=Nt();return jh(a,nt,e,t)},useMemoCache:Pu,useCacheRefresh:Wh};Wu.useEffectEvent=zh;var ng={readContext:$t,use:fl,useCallback:Gh,useContext:$t,useEffect:$u,useImperativeHandle:qh,useInsertionEffect:Ph,useLayoutEffect:Vh,useMemo:$h,useReducer:Hu,useRef:Lh,useState:function(){return Hu(vs)},useDebugValue:Fu,useDeferredValue:function(e,t){var a=Nt();return nt===null?Zu(a,e,t):Fh(a,nt.memoizedState,e,t)},useTransition:function(){var e=Hu(vs)[0],t=Nt().memoizedState;return[typeof e=="boolean"?e:Oo(e),t]},useSyncExternalStore:xh,useId:Jh,useHostTransitionStatus:Yu,useFormState:Bh,useActionState:Bh,useOptimistic:function(e,t){var a=Nt();return nt!==null?jh(a,nt,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Pu,useCacheRefresh:Wh};ng.useEffectEvent=zh;function Xu(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Qu={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=yn(),f=Fs(r);f.payload=t,a!=null&&(f.callback=a),t=Zs(e,f,r),t!==null&&(un(t,e,r),Ao(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=yn(),f=Fs(r);f.tag=1,f.payload=t,a!=null&&(f.callback=a),t=Zs(e,f,r),t!==null&&(un(t,e,r),Ao(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=yn(),r=Fs(a);r.tag=2,t!=null&&(r.callback=t),t=Zs(e,r,a),t!==null&&(un(t,e,a),Ao(t,e,a))}};function sg(e,t,a,r,f,p,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,p,x):t.prototype&&t.prototype.isPureReactComponent?!So(a,r)||!So(f,p):!0}function ag(e,t,a,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,r),t.state!==e&&Qu.enqueueReplaceState(t,t.state,null)}function Ba(e,t){var a=t;if("ref"in t){a={};for(var r in t)r!=="ref"&&(a[r]=t[r])}if(e=e.defaultProps){a===t&&(a=b({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function ig(e){Kr(e)}function og(e){console.error(e)}function rg(e){Kr(e)}function vl(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function lg(e,t,a){try{var r=e.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function ed(e,t,a){return a=Fs(a),a.tag=3,a.payload={element:null},a.callback=function(){vl(e,t)},a}function cg(e){return e=Fs(e),e.tag=3,e}function ug(e,t,a,r){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var p=r.value;e.payload=function(){return f(p)},e.callback=function(){lg(t,a,r)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){lg(t,a,r),typeof f!="function"&&(Qs===null?Qs=new Set([this]):Qs.add(this));var k=r.stack;this.componentDidCatch(r.value,{componentStack:k!==null?k:""})})}function F1(e,t,a,r,f){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&_i(t,a,f,!0),a=mn.current,a!==null){switch(a.tag){case 31:case 13:return Dn===null?El():a.alternate===null&&bt===0&&(bt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,r===al?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),wd(e,r,f)),!1;case 22:return a.flags|=65536,r===al?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([r]):a.add(r)),wd(e,r,f)),!1}throw Error(o(435,a.tag))}return wd(e,r,f),El(),!1}if(He)return t=mn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=f,r!==bu&&(e=Error(o(422),{cause:r}),wo(jn(e,a)))):(r!==bu&&(t=Error(o(423),{cause:r}),wo(jn(t,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,r=jn(r,a),f=ed(e.stateNode,r,f),Au(e,f),bt!==4&&(bt=2)),!1;var p=Error(o(520),{cause:r});if(p=jn(p,a),Go===null?Go=[p]:Go.push(p),bt!==4&&(bt=2),t===null)return!0;r=jn(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=ed(a.stateNode,r,e),Au(a,e),!1;case 1:if(t=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Qs===null||!Qs.has(p))))return a.flags|=65536,f&=-f,a.lanes|=f,f=cg(f),ug(f,e,a,r),Au(a,f),!1}a=a.return}while(a!==null);return!1}var td=Error(o(461)),Dt=!1;function Ft(e,t,a,r){t.child=e===null?mh(t,null,a,r):Oa(t,e.child,a,r)}function dg(e,t,a,r,f){a=a.render;var p=t.ref;if("ref"in r){var x={};for(var k in r)k!=="ref"&&(x[k]=r[k])}else x=r;return Aa(t),r=Bu(e,t,a,x,p,f),k=Lu(),e!==null&&!Dt?(Uu(e,t,f),ys(e,t,f)):(He&&k&&vu(t),t.flags|=1,Ft(e,t,r,f),t.child)}function fg(e,t,a,r,f){if(e===null){var p=a.type;return typeof p=="function"&&!mu(p)&&p.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=p,pg(e,t,p,r,f)):(e=Xr(a.type,null,r,t,t.mode,f),e.ref=t.ref,e.return=t,t.child=e)}if(p=e.child,!cd(e,f)){var x=p.memoizedProps;if(a=a.compare,a=a!==null?a:So,a(x,r)&&e.ref===t.ref)return ys(e,t,f)}return t.flags|=1,e=fs(p,r),e.ref=t.ref,e.return=t,t.child=e}function pg(e,t,a,r,f){if(e!==null){var p=e.memoizedProps;if(So(p,r)&&e.ref===t.ref)if(Dt=!1,t.pendingProps=r=p,cd(e,f))(e.flags&131072)!==0&&(Dt=!0);else return t.lanes=e.lanes,ys(e,t,f)}return nd(e,t,a,r,f)}function mg(e,t,a,r){var f=r.children,p=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,e!==null){for(r=t.child=e.child,f=0;r!==null;)f=f|r.lanes|r.childLanes,r=r.sibling;r=f&~p}else r=0,t.child=null;return hg(e,t,p,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&nl(t,p!==null?p.cachePool:null),p!==null?vh(t,p):Ru(),yh(t);else return r=t.lanes=536870912,hg(e,t,p!==null?p.baseLanes|a:a,a,r)}else p!==null?(nl(t,p.cachePool),vh(t,p),Ys(),t.memoizedState=null):(e!==null&&nl(t,null),Ru(),Ys());return Ft(e,t,f,a),t.child}function Lo(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function hg(e,t,a,r,f){var p=Nu();return p=p===null?null:{parent:Et._currentValue,pool:p},t.memoizedState={baseLanes:a,cachePool:p},e!==null&&nl(t,null),Ru(),yh(t),e!==null&&_i(e,t,r,!0),t.childLanes=f,null}function yl(e,t){return t=_l({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function gg(e,t,a){return Oa(t,e.child,null,a),e=yl(t,t.pendingProps),e.flags|=2,hn(t),t.memoizedState=null,e}function Z1(e,t,a){var r=t.pendingProps,f=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(He){if(r.mode==="hidden")return e=yl(t,r),t.lanes=536870912,Lo(null,e);if(Ou(t),(e=lt)?(e=Cv(e,An),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Vs!==null?{id:Wn,overflow:Xn}:null,retryLane:536870912,hydrationErrors:null},a=Qm(e),a.return=t,t.child=a,Gt=t,lt=null)):e=null,e===null)throw qs(t);return t.lanes=536870912,null}return yl(t,r)}var p=e.memoizedState;if(p!==null){var x=p.dehydrated;if(Ou(t),f)if(t.flags&256)t.flags&=-257,t=gg(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Dt||_i(e,t,a,!1),f=(a&e.childLanes)!==0,Dt||f){if(r=ot,r!==null&&(x=ls(r,a),x!==0&&x!==p.retryLane))throw p.retryLane=x,Na(e,x),un(r,e,x),td;El(),t=gg(e,t,a)}else e=p.treeContext,lt=Rn(x.nextSibling),Gt=t,He=!0,Hs=null,An=!1,e!==null&&nh(t,e),t=yl(t,r),t.flags|=4096;return t}return e=fs(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function bl(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(o(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function nd(e,t,a,r,f){return Aa(t),a=Bu(e,t,a,r,void 0,f),r=Lu(),e!==null&&!Dt?(Uu(e,t,f),ys(e,t,f)):(He&&r&&vu(t),t.flags|=1,Ft(e,t,a,f),t.child)}function vg(e,t,a,r,f,p){return Aa(t),t.updateQueue=null,a=_h(t,r,a,f),bh(e),r=Lu(),e!==null&&!Dt?(Uu(e,t,p),ys(e,t,p)):(He&&r&&vu(t),t.flags|=1,Ft(e,t,a,p),t.child)}function yg(e,t,a,r,f){if(Aa(t),t.stateNode===null){var p=gi,x=a.contextType;typeof x=="object"&&x!==null&&(p=$t(x)),p=new a(r,p),t.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Qu,t.stateNode=p,p._reactInternals=t,p=t.stateNode,p.props=r,p.state=t.memoizedState,p.refs={},Cu(t),x=a.contextType,p.context=typeof x=="object"&&x!==null?$t(x):gi,p.state=t.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Xu(t,a,x,r),p.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(x=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),x!==p.state&&Qu.enqueueReplaceState(p,p.state,null),Ro(t,r,p,f),Do(),p.state=t.memoizedState),typeof p.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){p=t.stateNode;var k=t.memoizedProps,R=Ba(a,k);p.props=R;var V=p.context,Y=a.contextType;x=gi,typeof Y=="object"&&Y!==null&&(x=$t(Y));var W=a.getDerivedStateFromProps;Y=typeof W=="function"||typeof p.getSnapshotBeforeUpdate=="function",k=t.pendingProps!==k,Y||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(k||V!==x)&&ag(t,p,r,x),$s=!1;var G=t.memoizedState;p.state=G,Ro(t,r,p,f),Do(),V=t.memoizedState,k||G!==V||$s?(typeof W=="function"&&(Xu(t,a,W,r),V=t.memoizedState),(R=$s||sg(t,a,R,r,G,V,x))?(Y||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(t.flags|=4194308)):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=V),p.props=r,p.state=V,p.context=x,r=R):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{p=t.stateNode,Eu(e,t),x=t.memoizedProps,Y=Ba(a,x),p.props=Y,W=t.pendingProps,G=p.context,V=a.contextType,R=gi,typeof V=="object"&&V!==null&&(R=$t(V)),k=a.getDerivedStateFromProps,(V=typeof k=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==W||G!==R)&&ag(t,p,r,R),$s=!1,G=t.memoizedState,p.state=G,Ro(t,r,p,f),Do();var K=t.memoizedState;x!==W||G!==K||$s||e!==null&&e.dependencies!==null&&el(e.dependencies)?(typeof k=="function"&&(Xu(t,a,k,r),K=t.memoizedState),(Y=$s||sg(t,a,Y,r,G,K,R)||e!==null&&e.dependencies!==null&&el(e.dependencies))?(V||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(r,K,R),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(r,K,R)),typeof p.componentDidUpdate=="function"&&(t.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof p.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=K),p.props=r,p.state=K,p.context=R,r=Y):(typeof p.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(t.flags|=1024),r=!1)}return p=r,bl(e,t),r=(t.flags&128)!==0,p||r?(p=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:p.render(),t.flags|=1,e!==null&&r?(t.child=Oa(t,e.child,null,f),t.child=Oa(t,null,a,f)):Ft(e,t,a,f),t.memoizedState=p.state,e=t.child):e=ys(e,t,f),e}function bg(e,t,a,r){return Ca(),t.flags|=256,Ft(e,t,a,r),t.child}var sd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ad(e){return{baseLanes:e,cachePool:lh()}}function id(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=vn),e}function _g(e,t,a){var r=t.pendingProps,f=!1,p=(t.flags&128)!==0,x;if((x=p)||(x=e!==null&&e.memoizedState===null?!1:(wt.current&2)!==0),x&&(f=!0,t.flags&=-129),x=(t.flags&32)!==0,t.flags&=-33,e===null){if(He){if(f?Ks(t):Ys(),(e=lt)?(e=Cv(e,An),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Vs!==null?{id:Wn,overflow:Xn}:null,retryLane:536870912,hydrationErrors:null},a=Qm(e),a.return=t,t.child=a,Gt=t,lt=null)):e=null,e===null)throw qs(t);return Vd(e)?t.lanes=32:t.lanes=536870912,null}var k=r.children;return r=r.fallback,f?(Ys(),f=t.mode,k=_l({mode:"hidden",children:k},f),r=ja(r,f,a,null),k.return=t,r.return=t,k.sibling=r,t.child=k,r=t.child,r.memoizedState=ad(a),r.childLanes=id(e,x,a),t.memoizedState=sd,Lo(null,r)):(Ks(t),od(t,k))}var R=e.memoizedState;if(R!==null&&(k=R.dehydrated,k!==null)){if(p)t.flags&256?(Ks(t),t.flags&=-257,t=rd(e,t,a)):t.memoizedState!==null?(Ys(),t.child=e.child,t.flags|=128,t=null):(Ys(),k=r.fallback,f=t.mode,r=_l({mode:"visible",children:r.children},f),k=ja(k,f,a,null),k.flags|=2,r.return=t,k.return=t,r.sibling=k,t.child=r,Oa(t,e.child,null,a),r=t.child,r.memoizedState=ad(a),r.childLanes=id(e,x,a),t.memoizedState=sd,t=Lo(null,r));else if(Ks(t),Vd(k)){if(x=k.nextSibling&&k.nextSibling.dataset,x)var V=x.dgst;x=V,r=Error(o(419)),r.stack="",r.digest=x,wo({value:r,source:null,stack:null}),t=rd(e,t,a)}else if(Dt||_i(e,t,a,!1),x=(a&e.childLanes)!==0,Dt||x){if(x=ot,x!==null&&(r=ls(x,a),r!==0&&r!==R.retryLane))throw R.retryLane=r,Na(e,r),un(x,e,r),td;Pd(k)||El(),t=rd(e,t,a)}else Pd(k)?(t.flags|=192,t.child=e.child,t=null):(e=R.treeContext,lt=Rn(k.nextSibling),Gt=t,He=!0,Hs=null,An=!1,e!==null&&nh(t,e),t=od(t,r.children),t.flags|=4096);return t}return f?(Ys(),k=r.fallback,f=t.mode,R=e.child,V=R.sibling,r=fs(R,{mode:"hidden",children:r.children}),r.subtreeFlags=R.subtreeFlags&65011712,V!==null?k=fs(V,k):(k=ja(k,f,a,null),k.flags|=2),k.return=t,r.return=t,r.sibling=k,t.child=r,Lo(null,r),r=t.child,k=e.child.memoizedState,k===null?k=ad(a):(f=k.cachePool,f!==null?(R=Et._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=lh(),k={baseLanes:k.baseLanes|a,cachePool:f}),r.memoizedState=k,r.childLanes=id(e,x,a),t.memoizedState=sd,Lo(e.child,r)):(Ks(t),a=e.child,e=a.sibling,a=fs(a,{mode:"visible",children:r.children}),a.return=t,a.sibling=null,e!==null&&(x=t.deletions,x===null?(t.deletions=[e],t.flags|=16):x.push(e)),t.child=a,t.memoizedState=null,a)}function od(e,t){return t=_l({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function _l(e,t){return e=pn(22,e,null,t),e.lanes=0,e}function rd(e,t,a){return Oa(t,e.child,null,a),e=od(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xg(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Su(e.return,t,a)}function ld(e,t,a,r,f,p){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:f,treeForkCount:p}:(x.isBackwards=t,x.rendering=null,x.renderingStartTime=0,x.last=r,x.tail=a,x.tailMode=f,x.treeForkCount=p)}function Sg(e,t,a){var r=t.pendingProps,f=r.revealOrder,p=r.tail;r=r.children;var x=wt.current,k=(x&2)!==0;if(k?(x=x&1|2,t.flags|=128):x&=1,Se(wt,x),Ft(e,t,r,a),r=He?ko:0,!k&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xg(e,a,t);else if(e.tag===19)xg(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(a=t.child,f=null;a!==null;)e=a.alternate,e!==null&&ll(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=t.child,t.child=null):(f=a.sibling,a.sibling=null),ld(t,!1,f,a,p,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=t.child,t.child=null;f!==null;){if(e=f.alternate,e!==null&&ll(e)===null){t.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}ld(t,!0,a,null,p,r);break;case"together":ld(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function ys(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Xs|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(_i(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,a=fs(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=fs(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function cd(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&el(e)))}function K1(e,t,a){switch(t.tag){case 3:Ce(t,t.stateNode.containerInfo),Gs(t,Et,e.memoizedState.cache),Ca();break;case 27:case 5:Tt(t);break;case 4:Ce(t,t.stateNode.containerInfo);break;case 10:Gs(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ou(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Ks(t),t.flags|=128,null):(a&t.child.childLanes)!==0?_g(e,t,a):(Ks(t),e=ys(e,t,a),e!==null?e.sibling:null);Ks(t);break;case 19:var f=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(_i(e,t,a,!1),r=(a&t.childLanes)!==0),f){if(r)return Sg(e,t,a);t.flags|=128}if(f=t.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Se(wt,wt.current),r)break;return null;case 22:return t.lanes=0,mg(e,t,a,t.pendingProps);case 24:Gs(t,Et,e.memoizedState.cache)}return ys(e,t,a)}function Tg(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Dt=!0;else{if(!cd(e,a)&&(t.flags&128)===0)return Dt=!1,K1(e,t,a);Dt=(e.flags&131072)!==0}else Dt=!1,He&&(t.flags&1048576)!==0&&th(t,ko,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Ra(t.elementType),t.type=e,typeof e=="function")mu(e)?(r=Ba(e,r),t.tag=1,t=yg(null,t,e,r,a)):(t.tag=0,t=nd(null,t,e,r,a));else{if(e!=null){var f=e.$$typeof;if(f===M){t.tag=11,t=dg(null,t,e,r,a);break e}else if(f===H){t.tag=14,t=fg(null,t,e,r,a);break e}}throw t=oe(e)||e,Error(o(306,t,""))}}return t;case 0:return nd(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,f=Ba(r,t.pendingProps),yg(e,t,r,f,a);case 3:e:{if(Ce(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var p=t.memoizedState;f=p.element,Eu(e,t),Ro(t,r,null,a);var x=t.memoizedState;if(r=x.cache,Gs(t,Et,r),r!==p.cache&&Tu(t,[Et],a,!0),Do(),r=x.element,p.isDehydrated)if(p={element:r,isDehydrated:!1,cache:x.cache},t.updateQueue.baseState=p,t.memoizedState=p,t.flags&256){t=bg(e,t,r,a);break e}else if(r!==f){f=jn(Error(o(424)),t),wo(f),t=bg(e,t,r,a);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(lt=Rn(e.firstChild),Gt=t,He=!0,Hs=null,An=!0,a=mh(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ca(),r===f){t=ys(e,t,a);break e}Ft(e,t,r,a)}t=t.child}return t;case 26:return bl(e,t),e===null?(a=Ov(t.type,null,t.pendingProps,null))?t.memoizedState=a:He||(a=t.type,e=t.pendingProps,r=Bl(fe.current).createElement(a),r[qt]=t,r[sn]=e,Zt(r,a,e),zt(r),t.stateNode=r):t.memoizedState=Ov(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&He&&(r=t.stateNode=Dv(t.type,t.pendingProps,fe.current),Gt=t,An=!0,f=lt,sa(t.type)?(Hd=f,lt=Rn(r.firstChild)):lt=f),Ft(e,t,t.pendingProps.children,a),bl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&He&&((f=r=lt)&&(r=kS(r,t.type,t.pendingProps,An),r!==null?(t.stateNode=r,Gt=t,lt=Rn(r.firstChild),An=!1,f=!0):f=!1),f||qs(t)),Tt(t),f=t.type,p=t.pendingProps,x=e!==null?e.memoizedProps:null,r=p.children,Ld(f,p)?r=null:x!==null&&Ld(f,x)&&(t.flags|=32),t.memoizedState!==null&&(f=Bu(e,t,z1,null,null,a),Xo._currentValue=f),bl(e,t),Ft(e,t,r,a),t.child;case 6:return e===null&&He&&((e=a=lt)&&(a=wS(a,t.pendingProps,An),a!==null?(t.stateNode=a,Gt=t,lt=null,e=!0):e=!1),e||qs(t)),null;case 13:return _g(e,t,a);case 4:return Ce(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Oa(t,null,r,a):Ft(e,t,r,a),t.child;case 11:return dg(e,t,t.type,t.pendingProps,a);case 7:return Ft(e,t,t.pendingProps,a),t.child;case 8:return Ft(e,t,t.pendingProps.children,a),t.child;case 12:return Ft(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,Gs(t,t.type,r.value),Ft(e,t,r.children,a),t.child;case 9:return f=t.type._context,r=t.pendingProps.children,Aa(t),f=$t(f),r=r(f),t.flags|=1,Ft(e,t,r,a),t.child;case 14:return fg(e,t,t.type,t.pendingProps,a);case 15:return pg(e,t,t.type,t.pendingProps,a);case 19:return Sg(e,t,a);case 31:return Z1(e,t,a);case 22:return mg(e,t,a,t.pendingProps);case 24:return Aa(t),r=$t(Et),e===null?(f=Nu(),f===null&&(f=ot,p=ku(),f.pooledCache=p,p.refCount++,p!==null&&(f.pooledCacheLanes|=a),f=p),t.memoizedState={parent:r,cache:f},Cu(t),Gs(t,Et,f)):((e.lanes&a)!==0&&(Eu(e,t),Ro(t,null,null,a),Do()),f=e.memoizedState,p=t.memoizedState,f.parent!==r?(f={parent:r,cache:r},t.memoizedState=f,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=f),Gs(t,Et,r)):(r=p.cache,Gs(t,Et,r),r!==f.cache&&Tu(t,[Et],a,!0))),Ft(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function bs(e){e.flags|=4}function ud(e,t,a,r,f){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(Jg())e.flags|=8192;else throw Ma=al,ju}else e.flags&=-16777217}function kg(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!zv(t))if(Jg())e.flags|=8192;else throw Ma=al,ju}function xl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Fe():536870912,e.lanes|=t,Ri|=t)}function Uo(e,t){if(!He)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var r=null;a!==null;)a.alternate!==null&&(r=a),a=a.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ct(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,r|=f.subtreeFlags&65011712,r|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,r|=f.subtreeFlags,r|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function Y1(e,t,a){var r=t.pendingProps;switch(yu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(t),null;case 1:return ct(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),hs(Et),Ut(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(bi(t)?bs(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,_u())),ct(t),null;case 26:var f=t.type,p=t.memoizedState;return e===null?(bs(t),p!==null?(ct(t),kg(t,p)):(ct(t),ud(t,f,null,r,a))):p?p!==e.memoizedState?(bs(t),ct(t),kg(t,p)):(ct(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&bs(t),ct(t),ud(t,f,e,r,a)),null;case 27:if(I(t),a=fe.current,f=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&bs(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return ct(t),null}e=Ie.current,bi(t)?sh(t):(e=Dv(f,r,a),t.stateNode=e,bs(t))}return ct(t),null;case 5:if(I(t),f=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&bs(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return ct(t),null}if(p=Ie.current,bi(t))sh(t);else{var x=Bl(fe.current);switch(p){case 1:p=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:p=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":p=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":p=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":p=x.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof r.is=="string"?x.createElement("select",{is:r.is}):x.createElement("select"),r.multiple?p.multiple=!0:r.size&&(p.size=r.size);break;default:p=typeof r.is=="string"?x.createElement(f,{is:r.is}):x.createElement(f)}}p[qt]=t,p[sn]=r;e:for(x=t.child;x!==null;){if(x.tag===5||x.tag===6)p.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===t)break e;for(;x.sibling===null;){if(x.return===null||x.return===t)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}t.stateNode=p;e:switch(Zt(p,f,r),f){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&bs(t)}}return ct(t),ud(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&bs(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(o(166));if(e=fe.current,bi(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,f=Gt,f!==null)switch(f.tag){case 27:case 5:r=f.memoizedProps}e[qt]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||_v(e.nodeValue,a)),e||qs(t,!0)}else e=Bl(e).createTextNode(r),e[qt]=t,t.stateNode=e}return ct(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=bi(t),a!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[qt]=t}else Ca(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ct(t),e=!1}else a=_u(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(hn(t),t):(hn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return ct(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=bi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!f)throw Error(o(318));if(f=t.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(o(317));f[qt]=t}else Ca(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ct(t),f=!1}else f=_u(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return t.flags&256?(hn(t),t):(hn(t),null)}return hn(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,f=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(f=r.alternate.memoizedState.cachePool.pool),p=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(p=r.memoizedState.cachePool.pool),p!==f&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),xl(t,t.updateQueue),ct(t),null);case 4:return Ut(),e===null&&Rd(t.stateNode.containerInfo),ct(t),null;case 10:return hs(t.type),ct(t),null;case 19:if(we(wt),r=t.memoizedState,r===null)return ct(t),null;if(f=(t.flags&128)!==0,p=r.rendering,p===null)if(f)Uo(r,!1);else{if(bt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(p=ll(e),p!==null){for(t.flags|=128,Uo(r,!1),e=p.updateQueue,t.updateQueue=e,xl(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Xm(a,e),a=a.sibling;return Se(wt,wt.current&1|2),He&&ps(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Je()>Nl&&(t.flags|=128,f=!0,Uo(r,!1),t.lanes=4194304)}else{if(!f)if(e=ll(p),e!==null){if(t.flags|=128,f=!0,e=e.updateQueue,t.updateQueue=e,xl(t,e),Uo(r,!0),r.tail===null&&r.tailMode==="hidden"&&!p.alternate&&!He)return ct(t),null}else 2*Je()-r.renderingStartTime>Nl&&a!==536870912&&(t.flags|=128,f=!0,Uo(r,!1),t.lanes=4194304);r.isBackwards?(p.sibling=t.child,t.child=p):(e=r.last,e!==null?e.sibling=p:t.child=p,r.last=p)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Je(),e.sibling=null,a=wt.current,Se(wt,f?a&1|2:a&1),He&&ps(t,r.treeForkCount),e):(ct(t),null);case 22:case 23:return hn(t),Mu(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(ct(t),t.subtreeFlags&6&&(t.flags|=8192)):ct(t),a=t.updateQueue,a!==null&&xl(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),e!==null&&we(Da),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),hs(Et),ct(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function J1(e,t){switch(yu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return hs(Et),Ut(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return I(t),null;case 31:if(t.memoizedState!==null){if(hn(t),t.alternate===null)throw Error(o(340));Ca()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(hn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ca()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return we(wt),null;case 4:return Ut(),null;case 10:return hs(t.type),null;case 22:case 23:return hn(t),Mu(),e!==null&&we(Da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return hs(Et),null;case 25:return null;default:return null}}function wg(e,t){switch(yu(t),t.tag){case 3:hs(Et),Ut();break;case 26:case 27:case 5:I(t);break;case 4:Ut();break;case 31:t.memoizedState!==null&&hn(t);break;case 13:hn(t);break;case 19:we(wt);break;case 10:hs(t.type);break;case 22:case 23:hn(t),Mu(),e!==null&&we(Da);break;case 24:hs(Et)}}function zo(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var f=r.next;a=f;do{if((a.tag&e)===e){r=void 0;var p=a.create,x=a.inst;r=p(),x.destroy=r}a=a.next}while(a!==f)}}catch(k){et(t,t.return,k)}}function Js(e,t,a){try{var r=t.updateQueue,f=r!==null?r.lastEffect:null;if(f!==null){var p=f.next;r=p;do{if((r.tag&e)===e){var x=r.inst,k=x.destroy;if(k!==void 0){x.destroy=void 0,f=t;var R=a,V=k;try{V()}catch(Y){et(f,R,Y)}}}r=r.next}while(r!==p)}}catch(Y){et(t,t.return,Y)}}function Ng(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{gh(t,a)}catch(r){et(e,e.return,r)}}}function jg(e,t,a){a.props=Ba(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){et(e,t,r)}}function Po(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof a=="function"?e.refCleanup=a(r):a.current=r}}catch(f){et(e,t,f)}}function Qn(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(f){et(e,t,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){et(e,t,f)}else a.current=null}function Cg(e){var t=e.type,a=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(f){et(e,e.return,f)}}function dd(e,t,a){try{var r=e.stateNode;yS(r,e.type,a,t),r[sn]=t}catch(f){et(e,e.return,f)}}function Eg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&sa(e.type)||e.tag===4}function fd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Eg(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&&sa(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 pd(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=us));else if(r!==4&&(r===27&&sa(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(pd(e,t,a),e=e.sibling;e!==null;)pd(e,t,a),e=e.sibling}function Sl(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(r!==4&&(r===27&&sa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Sl(e,t,a),e=e.sibling;e!==null;)Sl(e,t,a),e=e.sibling}function Ag(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,f=t.attributes;f.length;)t.removeAttributeNode(f[0]);Zt(t,r,a),t[qt]=e,t[sn]=a}catch(p){et(e,e.return,p)}}var _s=!1,Rt=!1,md=!1,Dg=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function W1(e,t){if(e=e.containerInfo,Id=ql,e=qm(e),ru(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var f=r.anchorOffset,p=r.focusNode;r=r.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var x=0,k=-1,R=-1,V=0,Y=0,W=e,G=null;t:for(;;){for(var K;W!==a||f!==0&&W.nodeType!==3||(k=x+f),W!==p||r!==0&&W.nodeType!==3||(R=x+r),W.nodeType===3&&(x+=W.nodeValue.length),(K=W.firstChild)!==null;)G=W,W=K;for(;;){if(W===e)break t;if(G===a&&++V===f&&(k=x),G===p&&++Y===r&&(R=x),(K=W.nextSibling)!==null)break;W=G,G=W.parentNode}W=K}a=k===-1||R===-1?null:{start:k,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Bd={focusedElem:e,selectionRange:a},ql=!1,Pt=t;Pt!==null;)if(t=Pt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Pt=e;else for(;Pt!==null;){switch(t=Pt,p=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.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&&p!==null){e=void 0,a=t,f=p.memoizedProps,p=p.memoizedState,r=a.stateNode;try{var ge=Ba(a.type,f);e=r.getSnapshotBeforeUpdate(ge,p),r.__reactInternalSnapshotBeforeUpdate=e}catch(xe){et(a,a.return,xe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)zd(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":zd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Pt=e;break}Pt=t.return}}function Rg(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Ss(e,a),r&4&&zo(5,a);break;case 1:if(Ss(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(x){et(a,a.return,x)}else{var f=Ba(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(f,t,e.__reactInternalSnapshotBeforeUpdate)}catch(x){et(a,a.return,x)}}r&64&&Ng(a),r&512&&Po(a,a.return);break;case 3:if(Ss(e,a),r&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{gh(e,t)}catch(x){et(a,a.return,x)}}break;case 27:t===null&&r&4&&Ag(a);case 26:case 5:Ss(e,a),t===null&&r&4&&Cg(a),r&512&&Po(a,a.return);break;case 12:Ss(e,a);break;case 31:Ss(e,a),r&4&&Ig(e,a);break;case 13:Ss(e,a),r&4&&Bg(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=oS.bind(null,a),NS(e,a))));break;case 22:if(r=a.memoizedState!==null||_s,!r){t=t!==null&&t.memoizedState!==null||Rt,f=_s;var p=Rt;_s=r,(Rt=t)&&!p?Ts(e,a,(a.subtreeFlags&8772)!==0):Ss(e,a),_s=f,Rt=p}break;case 30:break;default:Ss(e,a)}}function Mg(e){var t=e.alternate;t!==null&&(e.alternate=null,Mg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Gc(t)),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 mt=null,on=!1;function xs(e,t,a){for(a=a.child;a!==null;)Og(e,t,a),a=a.sibling}function Og(e,t,a){if(Jt&&typeof Jt.onCommitFiberUnmount=="function")try{Jt.onCommitFiberUnmount(Us,a)}catch{}switch(a.tag){case 26:Rt||Qn(a,t),xs(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Rt||Qn(a,t);var r=mt,f=on;sa(a.type)&&(mt=a.stateNode,on=!1),xs(e,t,a),Yo(a.stateNode),mt=r,on=f;break;case 5:Rt||Qn(a,t);case 6:if(r=mt,f=on,mt=null,xs(e,t,a),mt=r,on=f,mt!==null)if(on)try{(mt.nodeType===9?mt.body:mt.nodeName==="HTML"?mt.ownerDocument.body:mt).removeChild(a.stateNode)}catch(p){et(a,t,p)}else try{mt.removeChild(a.stateNode)}catch(p){et(a,t,p)}break;case 18:mt!==null&&(on?(e=mt,Nv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Pi(e)):Nv(mt,a.stateNode));break;case 4:r=mt,f=on,mt=a.stateNode.containerInfo,on=!0,xs(e,t,a),mt=r,on=f;break;case 0:case 11:case 14:case 15:Js(2,a,t),Rt||Js(4,a,t),xs(e,t,a);break;case 1:Rt||(Qn(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&jg(a,t,r)),xs(e,t,a);break;case 21:xs(e,t,a);break;case 22:Rt=(r=Rt)||a.memoizedState!==null,xs(e,t,a),Rt=r;break;default:xs(e,t,a)}}function Ig(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Pi(e)}catch(a){et(t,t.return,a)}}}function Bg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Pi(e)}catch(a){et(t,t.return,a)}}function X1(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Dg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Dg),t;default:throw Error(o(435,e.tag))}}function Tl(e,t){var a=X1(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var f=rS.bind(null,e,r);r.then(f,f)}})}function rn(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var f=a[r],p=e,x=t,k=x;e:for(;k!==null;){switch(k.tag){case 27:if(sa(k.type)){mt=k.stateNode,on=!1;break e}break;case 5:mt=k.stateNode,on=!1;break e;case 3:case 4:mt=k.stateNode.containerInfo,on=!0;break e}k=k.return}if(mt===null)throw Error(o(160));Og(p,x,f),mt=null,on=!1,p=f.alternate,p!==null&&(p.return=null),f.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Lg(t,e),t=t.sibling}var Gn=null;function Lg(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:rn(t,e),ln(e),r&4&&(Js(3,e,e.return),zo(3,e),Js(5,e,e.return));break;case 1:rn(t,e),ln(e),r&512&&(Rt||a===null||Qn(a,a.return)),r&64&&_s&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?r:a.concat(r))));break;case 26:var f=Gn;if(rn(t,e),ln(e),r&512&&(Rt||a===null||Qn(a,a.return)),r&4){var p=a!==null?a.memoizedState:null;if(r=e.memoizedState,a===null)if(r===null)if(e.stateNode===null){e:{r=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(r){case"title":p=f.getElementsByTagName("title")[0],(!p||p[po]||p[qt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=f.createElement(r),f.head.insertBefore(p,f.querySelector("head > title"))),Zt(p,r,a),p[qt]=e,zt(p),r=p;break e;case"link":var x=Lv("link","href",f).get(r+(a.href||""));if(x){for(var k=0;k<x.length;k++)if(p=x[k],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(k,1);break t}}p=f.createElement(r),Zt(p,r,a),f.head.appendChild(p);break;case"meta":if(x=Lv("meta","content",f).get(r+(a.content||""))){for(k=0;k<x.length;k++)if(p=x[k],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(k,1);break t}}p=f.createElement(r),Zt(p,r,a),f.head.appendChild(p);break;default:throw Error(o(468,r))}p[qt]=e,zt(p),r=p}e.stateNode=r}else Uv(f,e.type,e.stateNode);else e.stateNode=Bv(f,r,e.memoizedProps);else p!==r?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,r===null?Uv(f,e.type,e.stateNode):Bv(f,r,e.memoizedProps)):r===null&&e.stateNode!==null&&dd(e,e.memoizedProps,a.memoizedProps)}break;case 27:rn(t,e),ln(e),r&512&&(Rt||a===null||Qn(a,a.return)),a!==null&&r&4&&dd(e,e.memoizedProps,a.memoizedProps);break;case 5:if(rn(t,e),ln(e),r&512&&(Rt||a===null||Qn(a,a.return)),e.flags&32){f=e.stateNode;try{ci(f,"")}catch(ge){et(e,e.return,ge)}}r&4&&e.stateNode!=null&&(f=e.memoizedProps,dd(e,f,a!==null?a.memoizedProps:f)),r&1024&&(md=!0);break;case 6:if(rn(t,e),ln(e),r&4){if(e.stateNode===null)throw Error(o(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(ge){et(e,e.return,ge)}}break;case 3:if(zl=null,f=Gn,Gn=Ll(t.containerInfo),rn(t,e),Gn=f,ln(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{Pi(t.containerInfo)}catch(ge){et(e,e.return,ge)}md&&(md=!1,Ug(e));break;case 4:r=Gn,Gn=Ll(e.stateNode.containerInfo),rn(t,e),ln(e),Gn=r;break;case 12:rn(t,e),ln(e);break;case 31:rn(t,e),ln(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 13:rn(t,e),ln(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(wl=Je()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 22:f=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,V=_s,Y=Rt;if(_s=V||f,Rt=Y||R,rn(t,e),Rt=Y,_s=V,ln(e),r&8192)e:for(t=e.stateNode,t._visibility=f?t._visibility&-2:t._visibility|1,f&&(a===null||R||_s||Rt||La(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){R=a=t;try{if(p=R.stateNode,f)x=p.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{k=R.stateNode;var W=R.memoizedProps.style,G=W!=null&&W.hasOwnProperty("display")?W.display:null;k.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(ge){et(R,R.return,ge)}}}else if(t.tag===6){if(a===null){R=t;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(ge){et(R,R.return,ge)}}}else if(t.tag===18){if(a===null){R=t;try{var K=R.stateNode;f?jv(K,!0):jv(R.stateNode,!1)}catch(ge){et(R,R.return,ge)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(a=r.retryQueue,a!==null&&(r.retryQueue=null,Tl(e,a))));break;case 19:rn(t,e),ln(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Tl(e,r)));break;case 30:break;case 21:break;default:rn(t,e),ln(e)}}function ln(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(Eg(r)){a=r;break}r=r.return}if(a==null)throw Error(o(160));switch(a.tag){case 27:var f=a.stateNode,p=fd(e);Sl(e,p,f);break;case 5:var x=a.stateNode;a.flags&32&&(ci(x,""),a.flags&=-33);var k=fd(e);Sl(e,k,x);break;case 3:case 4:var R=a.stateNode.containerInfo,V=fd(e);pd(e,V,R);break;default:throw Error(o(161))}}catch(Y){et(e,e.return,Y)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ug(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ug(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ss(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Rg(e,t.alternate,t),t=t.sibling}function La(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Js(4,t,t.return),La(t);break;case 1:Qn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&jg(t,t.return,a),La(t);break;case 27:Yo(t.stateNode);case 26:case 5:Qn(t,t.return),La(t);break;case 22:t.memoizedState===null&&La(t);break;case 30:La(t);break;default:La(t)}e=e.sibling}}function Ts(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,f=e,p=t,x=p.flags;switch(p.tag){case 0:case 11:case 15:Ts(f,p,a),zo(4,p);break;case 1:if(Ts(f,p,a),r=p,f=r.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(V){et(r,r.return,V)}if(r=p,f=r.updateQueue,f!==null){var k=r.stateNode;try{var R=f.shared.hiddenCallbacks;if(R!==null)for(f.shared.hiddenCallbacks=null,f=0;f<R.length;f++)hh(R[f],k)}catch(V){et(r,r.return,V)}}a&&x&64&&Ng(p),Po(p,p.return);break;case 27:Ag(p);case 26:case 5:Ts(f,p,a),a&&r===null&&x&4&&Cg(p),Po(p,p.return);break;case 12:Ts(f,p,a);break;case 31:Ts(f,p,a),a&&x&4&&Ig(f,p);break;case 13:Ts(f,p,a),a&&x&4&&Bg(f,p);break;case 22:p.memoizedState===null&&Ts(f,p,a),Po(p,p.return);break;case 30:break;default:Ts(f,p,a)}t=t.sibling}}function hd(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&No(a))}function gd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&No(e))}function $n(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)zg(e,t,a,r),t=t.sibling}function zg(e,t,a,r){var f=t.flags;switch(t.tag){case 0:case 11:case 15:$n(e,t,a,r),f&2048&&zo(9,t);break;case 1:$n(e,t,a,r);break;case 3:$n(e,t,a,r),f&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&No(e)));break;case 12:if(f&2048){$n(e,t,a,r),e=t.stateNode;try{var p=t.memoizedProps,x=p.id,k=p.onPostCommit;typeof k=="function"&&k(x,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){et(t,t.return,R)}}else $n(e,t,a,r);break;case 31:$n(e,t,a,r);break;case 13:$n(e,t,a,r);break;case 23:break;case 22:p=t.stateNode,x=t.alternate,t.memoizedState!==null?p._visibility&2?$n(e,t,a,r):Vo(e,t):p._visibility&2?$n(e,t,a,r):(p._visibility|=2,Ei(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),f&2048&&hd(x,t);break;case 24:$n(e,t,a,r),f&2048&&gd(t.alternate,t);break;default:$n(e,t,a,r)}}function Ei(e,t,a,r,f){for(f=f&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var p=e,x=t,k=a,R=r,V=x.flags;switch(x.tag){case 0:case 11:case 15:Ei(p,x,k,R,f),zo(8,x);break;case 23:break;case 22:var Y=x.stateNode;x.memoizedState!==null?Y._visibility&2?Ei(p,x,k,R,f):Vo(p,x):(Y._visibility|=2,Ei(p,x,k,R,f)),f&&V&2048&&hd(x.alternate,x);break;case 24:Ei(p,x,k,R,f),f&&V&2048&&gd(x.alternate,x);break;default:Ei(p,x,k,R,f)}t=t.sibling}}function Vo(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,f=r.flags;switch(r.tag){case 22:Vo(a,r),f&2048&&hd(r.alternate,r);break;case 24:Vo(a,r),f&2048&&gd(r.alternate,r);break;default:Vo(a,r)}t=t.sibling}}var Ho=8192;function Ai(e,t,a){if(e.subtreeFlags&Ho)for(e=e.child;e!==null;)Pg(e,t,a),e=e.sibling}function Pg(e,t,a){switch(e.tag){case 26:Ai(e,t,a),e.flags&Ho&&e.memoizedState!==null&&US(a,Gn,e.memoizedState,e.memoizedProps);break;case 5:Ai(e,t,a);break;case 3:case 4:var r=Gn;Gn=Ll(e.stateNode.containerInfo),Ai(e,t,a),Gn=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ho,Ho=16777216,Ai(e,t,a),Ho=r):Ai(e,t,a));break;default:Ai(e,t,a)}}function Vg(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function qo(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];Pt=r,qg(r,e)}Vg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Hg(e),e=e.sibling}function Hg(e){switch(e.tag){case 0:case 11:case 15:qo(e),e.flags&2048&&Js(9,e,e.return);break;case 3:qo(e);break;case 12:qo(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,kl(e)):qo(e);break;default:qo(e)}}function kl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];Pt=r,qg(r,e)}Vg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Js(8,t,t.return),kl(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,kl(t));break;default:kl(t)}e=e.sibling}}function qg(e,t){for(;Pt!==null;){var a=Pt;switch(a.tag){case 0:case 11:case 15:Js(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var r=a.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:No(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,Pt=r;else e:for(a=e;Pt!==null;){r=Pt;var f=r.sibling,p=r.return;if(Mg(r),r===a){Pt=null;break e}if(f!==null){f.return=p,Pt=f;break e}Pt=p}}}var Q1={getCacheForType:function(e){var t=$t(Et),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return $t(Et).controller.signal}},eS=typeof WeakMap=="function"?WeakMap:Map,We=0,ot=null,Be=null,Ue=0,Qe=0,gn=null,Ws=!1,Di=!1,vd=!1,ks=0,bt=0,Xs=0,Ua=0,yd=0,vn=0,Ri=0,Go=null,cn=null,bd=!1,wl=0,Gg=0,Nl=1/0,jl=null,Qs=null,Bt=0,ea=null,Mi=null,ws=0,_d=0,xd=null,$g=null,$o=0,Sd=null;function yn(){return(We&2)!==0&&Ue!==0?Ue&-Ue:B.T!==null?Cd():rm()}function Fg(){if(vn===0)if((Ue&536870912)===0||He){var e=ie;ie<<=1,(ie&3932160)===0&&(ie=262144),vn=e}else vn=536870912;return e=mn.current,e!==null&&(e.flags|=32),vn}function un(e,t,a){(e===ot&&(Qe===2||Qe===9)||e.cancelPendingCommit!==null)&&(Oi(e,0),ta(e,Ue,vn,!1)),Ve(e,a),((We&2)===0||e!==ot)&&(e===ot&&((We&2)===0&&(Ua|=a),bt===4&&ta(e,Ue,vn,!1)),es(e))}function Zg(e,t,a){if((We&6)!==0)throw Error(o(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||ye(e,t),f=r?sS(e,t):kd(e,t,!0),p=r;do{if(f===0){Di&&!r&&ta(e,t,0,!1);break}else{if(a=e.current.alternate,p&&!tS(a)){f=kd(e,t,!1),p=!1;continue}if(f===2){if(p=t,e.errorRecoveryDisabledLanes&p)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){t=x;e:{var k=e;f=Go;var R=k.current.memoizedState.isDehydrated;if(R&&(Oi(k,x).flags|=256),x=kd(k,x,!1),x!==2){if(vd&&!R){k.errorRecoveryDisabledLanes|=p,Ua|=p,f=4;break e}p=cn,cn=f,p!==null&&(cn===null?cn=p:cn.push.apply(cn,p))}f=x}if(p=!1,f!==2)continue}}if(f===1){Oi(e,0),ta(e,t,0,!0);break}e:{switch(r=e,p=f,p){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:ta(r,t,vn,!Ws);break e;case 2:cn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(f=wl+300-Je(),10<f)){if(ta(r,t,vn,!Ws),Pe(r,0,!0)!==0)break e;ws=t,r.timeoutHandle=kv(Kg.bind(null,r,a,cn,jl,bd,t,vn,Ua,Ri,Ws,p,"Throttled",-0,0),f);break e}Kg(r,a,cn,jl,bd,t,vn,Ua,Ri,Ws,p,null,-0,0)}}break}while(!0);es(e)}function Kg(e,t,a,r,f,p,x,k,R,V,Y,W,G,K){if(e.timeoutHandle=-1,W=t.subtreeFlags,W&8192||(W&16785408)===16785408){W={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:us},Pg(t,p,W);var ge=(p&62914560)===p?wl-Je():(p&4194048)===p?Gg-Je():0;if(ge=zS(W,ge),ge!==null){ws=p,e.cancelPendingCommit=ge(nv.bind(null,e,t,p,a,r,f,x,k,R,Y,W,null,G,K)),ta(e,p,x,!V);return}}nv(e,t,p,a,r,f,x,k,R)}function tS(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var f=a[r],p=f.getSnapshot;f=f.value;try{if(!fn(p(),f))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ta(e,t,a,r){t&=~yd,t&=~Ua,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var f=t;0<f;){var p=31-Wt(f),x=1<<p;r[p]=-1,f&=~x}a!==0&&Ht(e,a,t)}function Cl(){return(We&6)===0?(Fo(0),!1):!0}function Td(){if(Be!==null){if(Qe===0)var e=Be.return;else e=Be,ms=Ea=null,zu(e),ki=null,Co=0,e=Be;for(;e!==null;)wg(e.alternate,e),e=e.return;Be=null}}function Oi(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,xS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),ws=0,Td(),ot=e,Be=a=fs(e.current,null),Ue=t,Qe=0,gn=null,Ws=!1,Di=ye(e,t),vd=!1,Ri=vn=yd=Ua=Xs=bt=0,cn=Go=null,bd=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var f=31-Wt(r),p=1<<f;t|=e[f],r&=~p}return ks=t,Yr(),a}function Yg(e,t){Ae=null,B.H=Bo,t===Ti||t===sl?(t=dh(),Qe=3):t===ju?(t=dh(),Qe=4):Qe=t===td?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,gn=t,Be===null&&(bt=1,vl(e,jn(t,e.current)))}function Jg(){var e=mn.current;return e===null?!0:(Ue&4194048)===Ue?Dn===null:(Ue&62914560)===Ue||(Ue&536870912)!==0?e===Dn:!1}function Wg(){var e=B.H;return B.H=Bo,e===null?Bo:e}function Xg(){var e=B.A;return B.A=Q1,e}function El(){bt=4,Ws||(Ue&4194048)!==Ue&&mn.current!==null||(Di=!0),(Xs&134217727)===0&&(Ua&134217727)===0||ot===null||ta(ot,Ue,vn,!1)}function kd(e,t,a){var r=We;We|=2;var f=Wg(),p=Xg();(ot!==e||Ue!==t)&&(jl=null,Oi(e,t)),t=!1;var x=bt;e:do try{if(Qe!==0&&Be!==null){var k=Be,R=gn;switch(Qe){case 8:Td(),x=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(t=!0);var V=Qe;if(Qe=0,gn=null,Ii(e,k,R,V),a&&Di){x=0;break e}break;default:V=Qe,Qe=0,gn=null,Ii(e,k,R,V)}}nS(),x=bt;break}catch(Y){Yg(e,Y)}while(!0);return t&&e.shellSuspendCounter++,ms=Ea=null,We=r,B.H=f,B.A=p,Be===null&&(ot=null,Ue=0,Yr()),x}function nS(){for(;Be!==null;)Qg(Be)}function sS(e,t){var a=We;We|=2;var r=Wg(),f=Xg();ot!==e||Ue!==t?(jl=null,Nl=Je()+500,Oi(e,t)):Di=ye(e,t);e:do try{if(Qe!==0&&Be!==null){t=Be;var p=gn;t:switch(Qe){case 1:Qe=0,gn=null,Ii(e,t,p,1);break;case 2:case 9:if(ch(p)){Qe=0,gn=null,ev(t);break}t=function(){Qe!==2&&Qe!==9||ot!==e||(Qe=7),es(e)},p.then(t,t);break e;case 3:Qe=7;break e;case 4:Qe=5;break e;case 7:ch(p)?(Qe=0,gn=null,ev(t)):(Qe=0,gn=null,Ii(e,t,p,7));break;case 5:var x=null;switch(Be.tag){case 26:x=Be.memoizedState;case 5:case 27:var k=Be;if(x?zv(x):k.stateNode.complete){Qe=0,gn=null;var R=k.sibling;if(R!==null)Be=R;else{var V=k.return;V!==null?(Be=V,Al(V)):Be=null}break t}}Qe=0,gn=null,Ii(e,t,p,5);break;case 6:Qe=0,gn=null,Ii(e,t,p,6);break;case 8:Td(),bt=6;break e;default:throw Error(o(462))}}aS();break}catch(Y){Yg(e,Y)}while(!0);return ms=Ea=null,B.H=r,B.A=f,We=a,Be!==null?0:(ot=null,Ue=0,Yr(),bt)}function aS(){for(;Be!==null&&!Pn();)Qg(Be)}function Qg(e){var t=Tg(e.alternate,e,ks);e.memoizedProps=e.pendingProps,t===null?Al(e):Be=t}function ev(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=vg(a,t,t.pendingProps,t.type,void 0,Ue);break;case 11:t=vg(a,t,t.pendingProps,t.type.render,t.ref,Ue);break;case 5:zu(t);default:wg(a,t),t=Be=Xm(t,ks),t=Tg(a,t,ks)}e.memoizedProps=e.pendingProps,t===null?Al(e):Be=t}function Ii(e,t,a,r){ms=Ea=null,zu(t),ki=null,Co=0;var f=t.return;try{if(F1(e,f,t,a,Ue)){bt=1,vl(e,jn(a,e.current)),Be=null;return}}catch(p){if(f!==null)throw Be=f,p;bt=1,vl(e,jn(a,e.current)),Be=null;return}t.flags&32768?(He||r===1?e=!0:Di||(Ue&536870912)!==0?e=!1:(Ws=e=!0,(r===2||r===9||r===3||r===6)&&(r=mn.current,r!==null&&r.tag===13&&(r.flags|=16384))),tv(t,e)):Al(t)}function Al(e){var t=e;do{if((t.flags&32768)!==0){tv(t,Ws);return}e=t.return;var a=Y1(t.alternate,t,ks);if(a!==null){Be=a;return}if(t=t.sibling,t!==null){Be=t;return}Be=t=e}while(t!==null);bt===0&&(bt=5)}function tv(e,t){do{var a=J1(e.alternate,e);if(a!==null){a.flags&=32767,Be=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Be=e;return}Be=e=a}while(e!==null);bt=6,Be=null}function nv(e,t,a,r,f,p,x,k,R){e.cancelPendingCommit=null;do Dl();while(Bt!==0);if((We&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(p=t.lanes|t.childLanes,p|=fu,Vt(e,a,p,x,k,R),e===ot&&(Be=ot=null,Ue=0),Mi=t,ea=e,ws=a,_d=p,xd=f,$g=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,lS(_a,function(){return rv(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=B.T,B.T=null,f=$.p,$.p=2,x=We,We|=4;try{W1(e,t,a)}finally{We=x,$.p=f,B.T=r}}Bt=1,sv(),av(),iv()}}function sv(){if(Bt===1){Bt=0;var e=ea,t=Mi,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=B.T,B.T=null;var r=$.p;$.p=2;var f=We;We|=4;try{Lg(t,e);var p=Bd,x=qm(e.containerInfo),k=p.focusedElem,R=p.selectionRange;if(x!==k&&k&&k.ownerDocument&&Hm(k.ownerDocument.documentElement,k)){if(R!==null&&ru(k)){var V=R.start,Y=R.end;if(Y===void 0&&(Y=V),"selectionStart"in k)k.selectionStart=V,k.selectionEnd=Math.min(Y,k.value.length);else{var W=k.ownerDocument||document,G=W&&W.defaultView||window;if(G.getSelection){var K=G.getSelection(),ge=k.textContent.length,xe=Math.min(R.start,ge),at=R.end===void 0?xe:Math.min(R.end,ge);!K.extend&&xe>at&&(x=at,at=xe,xe=x);var L=Vm(k,xe),O=Vm(k,at);if(L&&O&&(K.rangeCount!==1||K.anchorNode!==L.node||K.anchorOffset!==L.offset||K.focusNode!==O.node||K.focusOffset!==O.offset)){var P=W.createRange();P.setStart(L.node,L.offset),K.removeAllRanges(),xe>at?(K.addRange(P),K.extend(O.node,O.offset)):(P.setEnd(O.node,O.offset),K.addRange(P))}}}}for(W=[],K=k;K=K.parentNode;)K.nodeType===1&&W.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<W.length;k++){var J=W[k];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}ql=!!Id,Bd=Id=null}finally{We=f,$.p=r,B.T=a}}e.current=t,Bt=2}}function av(){if(Bt===2){Bt=0;var e=ea,t=Mi,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=B.T,B.T=null;var r=$.p;$.p=2;var f=We;We|=4;try{Rg(e,t.alternate,t)}finally{We=f,$.p=r,B.T=a}}Bt=3}}function iv(){if(Bt===4||Bt===3){Bt=0,De();var e=ea,t=Mi,a=ws,r=$g;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Bt=5:(Bt=0,Mi=ea=null,ov(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Qs=null),xa(a),t=t.stateNode,Jt&&typeof Jt.onCommitFiberRoot=="function")try{Jt.onCommitFiberRoot(Us,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=B.T,f=$.p,$.p=2,B.T=null;try{for(var p=e.onRecoverableError,x=0;x<r.length;x++){var k=r[x];p(k.value,{componentStack:k.stack})}}finally{B.T=t,$.p=f}}(ws&3)!==0&&Dl(),es(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===Sd?$o++:($o=0,Sd=e):$o=0,Fo(0)}}function ov(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,No(t)))}function Dl(){return sv(),av(),iv(),rv()}function rv(){if(Bt!==5)return!1;var e=ea,t=_d;_d=0;var a=xa(ws),r=B.T,f=$.p;try{$.p=32>a?32:a,B.T=null,a=xd,xd=null;var p=ea,x=ws;if(Bt=0,Mi=ea=null,ws=0,(We&6)!==0)throw Error(o(331));var k=We;if(We|=4,Hg(p.current),zg(p,p.current,x,a),We=k,Fo(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(Us,p)}catch{}return!0}finally{$.p=f,B.T=r,ov(e,t)}}function lv(e,t,a){t=jn(a,t),t=ed(e.stateNode,t,2),e=Zs(e,t,2),e!==null&&(Ve(e,2),es(e))}function et(e,t,a){if(e.tag===3)lv(e,e,a);else for(;t!==null;){if(t.tag===3){lv(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Qs===null||!Qs.has(r))){e=jn(a,e),a=cg(2),r=Zs(t,a,2),r!==null&&(ug(a,r,t,e),Ve(r,2),es(r));break}}t=t.return}}function wd(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new eS;var f=new Set;r.set(t,f)}else f=r.get(t),f===void 0&&(f=new Set,r.set(t,f));f.has(a)||(vd=!0,f.add(a),e=iS.bind(null,e,t,a),t.then(e,e))}function iS(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,ot===e&&(Ue&a)===a&&(bt===4||bt===3&&(Ue&62914560)===Ue&&300>Je()-wl?(We&2)===0&&Oi(e,0):yd|=a,Ri===Ue&&(Ri=0)),es(e)}function cv(e,t){t===0&&(t=Fe()),e=Na(e,t),e!==null&&(Ve(e,t),es(e))}function oS(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),cv(e,a)}function rS(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),cv(e,a)}function lS(e,t){return Jn(e,t)}var Rl=null,Bi=null,Nd=!1,Ml=!1,jd=!1,na=0;function es(e){e!==Bi&&e.next===null&&(Bi===null?Rl=Bi=e:Bi=Bi.next=e),Ml=!0,Nd||(Nd=!0,uS())}function Fo(e,t){if(!jd&&Ml){jd=!0;do for(var a=!1,r=Rl;r!==null;){if(e!==0){var f=r.pendingLanes;if(f===0)var p=0;else{var x=r.suspendedLanes,k=r.pingedLanes;p=(1<<31-Wt(42|e)+1)-1,p&=f&~(x&~k),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,pv(r,p))}else p=Ue,p=Pe(r,r===ot?p:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(p&3)===0||ye(r,p)||(a=!0,pv(r,p));r=r.next}while(a);jd=!1}}function cS(){uv()}function uv(){Ml=Nd=!1;var e=0;na!==0&&_S()&&(e=na);for(var t=Je(),a=null,r=Rl;r!==null;){var f=r.next,p=dv(r,t);p===0?(r.next=null,a===null?Rl=f:a.next=f,f===null&&(Bi=a)):(a=r,(e!==0||(p&3)!==0)&&(Ml=!0)),r=f}Bt!==0&&Bt!==5||Fo(e),na!==0&&(na=0)}function dv(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,f=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var x=31-Wt(p),k=1<<x,R=f[x];R===-1?((k&a)===0||(k&r)!==0)&&(f[x]=Re(k,t)):R<=t&&(e.expiredLanes|=k),p&=~k}if(t=ot,a=Ue,a=Pe(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(Qe===2||Qe===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ls(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ye(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Ls(r),xa(a)){case 2:case 8:a=uo;break;case 32:a=_a;break;case 268435456:a=fo;break;default:a=_a}return r=fv.bind(null,e),a=Jn(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Ls(r),e.callbackPriority=2,e.callbackNode=null,2}function fv(e,t){if(Bt!==0&&Bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Dl()&&e.callbackNode!==a)return null;var r=Ue;return r=Pe(e,e===ot?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Zg(e,r,t),dv(e,Je()),e.callbackNode!=null&&e.callbackNode===a?fv.bind(null,e):null)}function pv(e,t){if(Dl())return null;Zg(e,t,!0)}function uS(){SS(function(){(We&6)!==0?Jn(co,cS):uv()})}function Cd(){if(na===0){var e=xi;e===0&&(e=ee,ee<<=1,(ee&261888)===0&&(ee=256)),na=e}return na}function mv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Vr(""+e)}function hv(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function dS(e,t,a,r,f){if(t==="submit"&&a&&a.stateNode===f){var p=mv((f[sn]||null).action),x=r.submitter;x&&(t=(t=x[sn]||null)?mv(t.formAction):x.getAttribute("formAction"),t!==null&&(p=t,x=null));var k=new $r("action","action",null,r,f);e.push({event:k,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(na!==0){var R=x?hv(f,x):new FormData(f);Ku(a,{pending:!0,data:R,method:f.method,action:p},null,R)}}else typeof p=="function"&&(k.preventDefault(),R=x?hv(f,x):new FormData(f),Ku(a,{pending:!0,data:R,method:f.method,action:p},p,R))},currentTarget:f}]})}}for(var Ed=0;Ed<du.length;Ed++){var Ad=du[Ed],fS=Ad.toLowerCase(),pS=Ad[0].toUpperCase()+Ad.slice(1);qn(fS,"on"+pS)}qn(Fm,"onAnimationEnd"),qn(Zm,"onAnimationIteration"),qn(Km,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(E1,"onTransitionRun"),qn(A1,"onTransitionStart"),qn(D1,"onTransitionCancel"),qn(Ym,"onTransitionEnd"),ri("onMouseEnter",["mouseout","mouseover"]),ri("onMouseLeave",["mouseout","mouseover"]),ri("onPointerEnter",["pointerout","pointerover"]),ri("onPointerLeave",["pointerout","pointerover"]),Sa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Sa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Sa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Sa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zo="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(" "),mS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Zo));function gv(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],f=r.event;r=r.listeners;e:{var p=void 0;if(t)for(var x=r.length-1;0<=x;x--){var k=r[x],R=k.instance,V=k.currentTarget;if(k=k.listener,R!==p&&f.isPropagationStopped())break e;p=k,f.currentTarget=V;try{p(f)}catch(Y){Kr(Y)}f.currentTarget=null,p=R}else for(x=0;x<r.length;x++){if(k=r[x],R=k.instance,V=k.currentTarget,k=k.listener,R!==p&&f.isPropagationStopped())break e;p=k,f.currentTarget=V;try{p(f)}catch(Y){Kr(Y)}f.currentTarget=null,p=R}}}}function Le(e,t){var a=t[qc];a===void 0&&(a=t[qc]=new Set);var r=e+"__bubble";a.has(r)||(vv(t,e,2,!1),a.add(r))}function Dd(e,t,a){var r=0;t&&(r|=4),vv(a,e,r,t)}var Ol="_reactListening"+Math.random().toString(36).slice(2);function Rd(e){if(!e[Ol]){e[Ol]=!0,um.forEach(function(a){a!=="selectionchange"&&(mS.has(a)||Dd(a,!1,e),Dd(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ol]||(t[Ol]=!0,Dd("selectionchange",!1,t))}}function vv(e,t,a,r){switch(Fv(t)){case 2:var f=HS;break;case 8:f=qS;break;default:f=Zd}a=f.bind(null,t,a,e),f=void 0,!Xc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(f=!0),r?f!==void 0?e.addEventListener(t,a,{capture:!0,passive:f}):e.addEventListener(t,a,!0):f!==void 0?e.addEventListener(t,a,{passive:f}):e.addEventListener(t,a,!1)}function Md(e,t,a,r,f){var p=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var x=r.tag;if(x===3||x===4){var k=r.stateNode.containerInfo;if(k===f)break;if(x===4)for(x=r.return;x!==null;){var R=x.tag;if((R===3||R===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;k!==null;){if(x=ai(k),x===null)return;if(R=x.tag,R===5||R===6||R===26||R===27){r=p=x;continue e}k=k.parentNode}}r=r.return}Sm(function(){var V=p,Y=Jc(a),W=[];e:{var G=Jm.get(e);if(G!==void 0){var K=$r,ge=e;switch(e){case"keypress":if(qr(a)===0)break e;case"keydown":case"keyup":K=r1;break;case"focusin":ge="focus",K=nu;break;case"focusout":ge="blur",K=nu;break;case"beforeblur":case"afterblur":K=nu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=wm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Yx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=u1;break;case Fm:case Zm:case Km:K=Xx;break;case Ym:K=f1;break;case"scroll":case"scrollend":K=Zx;break;case"wheel":K=m1;break;case"copy":case"cut":case"paste":K=e1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=jm;break;case"toggle":case"beforetoggle":K=g1}var xe=(t&4)!==0,at=!xe&&(e==="scroll"||e==="scrollend"),L=xe?G!==null?G+"Capture":null:G;xe=[];for(var O=V,P;O!==null;){var J=O;if(P=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||P===null||L===null||(J=ho(O,L),J!=null&&xe.push(Ko(O,J,P))),at)break;O=O.return}0<xe.length&&(G=new K(G,ge,null,a,Y),W.push({event:G,listeners:xe}))}}if((t&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",G&&a!==Yc&&(ge=a.relatedTarget||a.fromElement)&&(ai(ge)||ge[si]))break e;if((K||G)&&(G=Y.window===Y?Y:(G=Y.ownerDocument)?G.defaultView||G.parentWindow:window,K?(ge=a.relatedTarget||a.toElement,K=V,ge=ge?ai(ge):null,ge!==null&&(at=u(ge),xe=ge.tag,ge!==at||xe!==5&&xe!==27&&xe!==6)&&(ge=null)):(K=null,ge=V),K!==ge)){if(xe=wm,J="onMouseLeave",L="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(xe=jm,J="onPointerLeave",L="onPointerEnter",O="pointer"),at=K==null?G:mo(K),P=ge==null?G:mo(ge),G=new xe(J,O+"leave",K,a,Y),G.target=at,G.relatedTarget=P,J=null,ai(Y)===V&&(xe=new xe(L,O+"enter",ge,a,Y),xe.target=P,xe.relatedTarget=at,J=xe),at=J,K&&ge)t:{for(xe=hS,L=K,O=ge,P=0,J=L;J;J=xe(J))P++;J=0;for(var be=O;be;be=xe(be))J++;for(;0<P-J;)L=xe(L),P--;for(;0<J-P;)O=xe(O),J--;for(;P--;){if(L===O||O!==null&&L===O.alternate){xe=L;break t}L=xe(L),O=xe(O)}xe=null}else xe=null;K!==null&&yv(W,G,K,xe,!1),ge!==null&&at!==null&&yv(W,at,ge,xe,!0)}}e:{if(G=V?mo(V):window,K=G.nodeName&&G.nodeName.toLowerCase(),K==="select"||K==="input"&&G.type==="file")var Ze=Im;else if(Mm(G))if(Bm)Ze=N1;else{Ze=k1;var ve=T1}else K=G.nodeName,!K||K.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?V&&Kc(V.elementType)&&(Ze=Im):Ze=w1;if(Ze&&(Ze=Ze(e,V))){Om(W,Ze,a,Y);break e}ve&&ve(e,G,V),e==="focusout"&&V&&G.type==="number"&&V.memoizedProps.value!=null&&Zc(G,"number",G.value)}switch(ve=V?mo(V):window,e){case"focusin":(Mm(ve)||ve.contentEditable==="true")&&(pi=ve,lu=V,To=null);break;case"focusout":To=lu=pi=null;break;case"mousedown":cu=!0;break;case"contextmenu":case"mouseup":case"dragend":cu=!1,Gm(W,a,Y);break;case"selectionchange":if(C1)break;case"keydown":case"keyup":Gm(W,a,Y)}var Me;if(au)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else fi?Dm(e,a)&&(ze="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ze="onCompositionStart");ze&&(Cm&&a.locale!=="ko"&&(fi||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&fi&&(Me=Tm()):(Ps=Y,Qc="value"in Ps?Ps.value:Ps.textContent,fi=!0)),ve=Il(V,ze),0<ve.length&&(ze=new Nm(ze,e,null,a,Y),W.push({event:ze,listeners:ve}),Me?ze.data=Me:(Me=Rm(a),Me!==null&&(ze.data=Me)))),(Me=y1?b1(e,a):_1(e,a))&&(ze=Il(V,"onBeforeInput"),0<ze.length&&(ve=new Nm("onBeforeInput","beforeinput",null,a,Y),W.push({event:ve,listeners:ze}),ve.data=Me)),dS(W,e,V,a,Y)}gv(W,t)})}function Ko(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Il(e,t){for(var a=t+"Capture",r=[];e!==null;){var f=e,p=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||p===null||(f=ho(e,a),f!=null&&r.unshift(Ko(e,f,p)),f=ho(e,t),f!=null&&r.push(Ko(e,f,p))),e.tag===3)return r;e=e.return}return[]}function hS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function yv(e,t,a,r,f){for(var p=t._reactName,x=[];a!==null&&a!==r;){var k=a,R=k.alternate,V=k.stateNode;if(k=k.tag,R!==null&&R===r)break;k!==5&&k!==26&&k!==27||V===null||(R=V,f?(V=ho(a,p),V!=null&&x.unshift(Ko(a,V,R))):f||(V=ho(a,p),V!=null&&x.push(Ko(a,V,R)))),a=a.return}x.length!==0&&e.push({event:t,listeners:x})}var gS=/\r\n?/g,vS=/\u0000|\uFFFD/g;function bv(e){return(typeof e=="string"?e:""+e).replace(gS,`
|
|
26
|
-
`).replace(vS,"")}function _v(e,t){return t=bv(t),bv(e)===t}function st(e,t,a,r,f,p){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||ci(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&ci(e,""+r);break;case"className":zr(e,"class",r);break;case"tabIndex":zr(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":zr(e,a,r);break;case"style":_m(e,r,p);break;case"data":if(t!=="object"){zr(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Vr(""+r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="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 p=="function"&&(a==="formAction"?(t!=="input"&&st(e,t,"name",f.name,f,null),st(e,t,"formEncType",f.formEncType,f,null),st(e,t,"formMethod",f.formMethod,f,null),st(e,t,"formTarget",f.formTarget,f,null)):(st(e,t,"encType",f.encType,f,null),st(e,t,"method",f.method,f,null),st(e,t,"target",f.target,f,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Vr(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=us);break;case"onScroll":r!=null&&Le("scroll",e);break;case"onScrollEnd":r!=null&&Le("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(o(61));if(a=r.__html,a!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=a}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}a=Vr(""+r),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":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""+r):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":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":r===!0?e.setAttribute(a,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,r):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(a,r):e.removeAttribute(a);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(a):e.setAttribute(a,r);break;case"popover":Le("beforetoggle",e),Le("toggle",e),Ur(e,"popover",r);break;case"xlinkActuate":cs(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":cs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":cs(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":cs(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":cs(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":cs(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":cs(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":cs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":cs(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Ur(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=$x.get(a)||a,Ur(e,a,r))}}function Od(e,t,a,r,f,p){switch(a){case"style":_m(e,r,p);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(o(61));if(a=r.__html,a!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=a}}break;case"children":typeof r=="string"?ci(e,r):(typeof r=="number"||typeof r=="bigint")&&ci(e,""+r);break;case"onScroll":r!=null&&Le("scroll",e);break;case"onScrollEnd":r!=null&&Le("scrollend",e);break;case"onClick":r!=null&&(e.onclick=us);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!dm.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),t=a.slice(2,f?a.length-7:void 0),p=e[sn]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(t,p,f),typeof r=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,f);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):Ur(e,a,r)}}}function Zt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Le("error",e),Le("load",e);var r=!1,f=!1,p;for(p in a)if(a.hasOwnProperty(p)){var x=a[p];if(x!=null)switch(p){case"src":r=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,p,x,a,null)}}f&&st(e,t,"srcSet",a.srcSet,a,null),r&&st(e,t,"src",a.src,a,null);return;case"input":Le("invalid",e);var k=p=x=f=null,R=null,V=null;for(r in a)if(a.hasOwnProperty(r)){var Y=a[r];if(Y!=null)switch(r){case"name":f=Y;break;case"type":x=Y;break;case"checked":R=Y;break;case"defaultChecked":V=Y;break;case"value":p=Y;break;case"defaultValue":k=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:st(e,t,r,Y,a,null)}}gm(e,p,k,R,V,x,f,!1);return;case"select":Le("invalid",e),r=x=p=null;for(f in a)if(a.hasOwnProperty(f)&&(k=a[f],k!=null))switch(f){case"value":p=k;break;case"defaultValue":x=k;break;case"multiple":r=k;default:st(e,t,f,k,a,null)}t=p,a=x,e.multiple=!!r,t!=null?li(e,!!r,t,!1):a!=null&&li(e,!!r,a,!0);return;case"textarea":Le("invalid",e),p=f=r=null;for(x in a)if(a.hasOwnProperty(x)&&(k=a[x],k!=null))switch(x){case"value":r=k;break;case"defaultValue":f=k;break;case"children":p=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(o(91));break;default:st(e,t,x,k,a,null)}ym(e,r,f,p);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(r=a[R],r!=null))switch(R){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:st(e,t,R,r,a,null)}return;case"dialog":Le("beforetoggle",e),Le("toggle",e),Le("cancel",e),Le("close",e);break;case"iframe":case"object":Le("load",e);break;case"video":case"audio":for(r=0;r<Zo.length;r++)Le(Zo[r],e);break;case"image":Le("error",e),Le("load",e);break;case"details":Le("toggle",e);break;case"embed":case"source":case"link":Le("error",e),Le("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(V in a)if(a.hasOwnProperty(V)&&(r=a[V],r!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,V,r,a,null)}return;default:if(Kc(t)){for(Y in a)a.hasOwnProperty(Y)&&(r=a[Y],r!==void 0&&Od(e,t,Y,r,a,void 0));return}}for(k in a)a.hasOwnProperty(k)&&(r=a[k],r!=null&&st(e,t,k,r,a,null))}function yS(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,p=null,x=null,k=null,R=null,V=null,Y=null;for(K in a){var W=a[K];if(a.hasOwnProperty(K)&&W!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":R=W;default:r.hasOwnProperty(K)||st(e,t,K,null,r,W)}}for(var G in r){var K=r[G];if(W=a[G],r.hasOwnProperty(G)&&(K!=null||W!=null))switch(G){case"type":p=K;break;case"name":f=K;break;case"checked":V=K;break;case"defaultChecked":Y=K;break;case"value":x=K;break;case"defaultValue":k=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(o(137,t));break;default:K!==W&&st(e,t,G,K,r,W)}}Fc(e,x,k,R,V,Y,p,f);return;case"select":K=x=k=G=null;for(p in a)if(R=a[p],a.hasOwnProperty(p)&&R!=null)switch(p){case"value":break;case"multiple":K=R;default:r.hasOwnProperty(p)||st(e,t,p,null,r,R)}for(f in r)if(p=r[f],R=a[f],r.hasOwnProperty(f)&&(p!=null||R!=null))switch(f){case"value":G=p;break;case"defaultValue":k=p;break;case"multiple":x=p;default:p!==R&&st(e,t,f,p,r,R)}t=k,a=x,r=K,G!=null?li(e,!!a,G,!1):!!r!=!!a&&(t!=null?li(e,!!a,t,!0):li(e,!!a,a?[]:"",!1));return;case"textarea":K=G=null;for(k in a)if(f=a[k],a.hasOwnProperty(k)&&f!=null&&!r.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:st(e,t,k,null,r,f)}for(x in r)if(f=r[x],p=a[x],r.hasOwnProperty(x)&&(f!=null||p!=null))switch(x){case"value":G=f;break;case"defaultValue":K=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(o(91));break;default:f!==p&&st(e,t,x,f,r,p)}vm(e,G,K);return;case"option":for(var ge in a)if(G=a[ge],a.hasOwnProperty(ge)&&G!=null&&!r.hasOwnProperty(ge))switch(ge){case"selected":e.selected=!1;break;default:st(e,t,ge,null,r,G)}for(R in r)if(G=r[R],K=a[R],r.hasOwnProperty(R)&&G!==K&&(G!=null||K!=null))switch(R){case"selected":e.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:st(e,t,R,G,r,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var xe in a)G=a[xe],a.hasOwnProperty(xe)&&G!=null&&!r.hasOwnProperty(xe)&&st(e,t,xe,null,r,G);for(V in r)if(G=r[V],K=a[V],r.hasOwnProperty(V)&&G!==K&&(G!=null||K!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(o(137,t));break;default:st(e,t,V,G,r,K)}return;default:if(Kc(t)){for(var at in a)G=a[at],a.hasOwnProperty(at)&&G!==void 0&&!r.hasOwnProperty(at)&&Od(e,t,at,void 0,r,G);for(Y in r)G=r[Y],K=a[Y],!r.hasOwnProperty(Y)||G===K||G===void 0&&K===void 0||Od(e,t,Y,G,r,K);return}}for(var L in a)G=a[L],a.hasOwnProperty(L)&&G!=null&&!r.hasOwnProperty(L)&&st(e,t,L,null,r,G);for(W in r)G=r[W],K=a[W],!r.hasOwnProperty(W)||G===K||G==null&&K==null||st(e,t,W,G,r,K)}function xv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function bS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var f=a[r],p=f.transferSize,x=f.initiatorType,k=f.duration;if(p&&k&&xv(x)){for(x=0,k=f.responseEnd,r+=1;r<a.length;r++){var R=a[r],V=R.startTime;if(V>k)break;var Y=R.transferSize,W=R.initiatorType;Y&&xv(W)&&(R=R.responseEnd,x+=Y*(R<k?1:(k-V)/(R-V)))}if(--r,t+=8*(p+x)/(f.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Id=null,Bd=null;function Bl(e){return e.nodeType===9?e:e.ownerDocument}function Sv(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 Tv(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Ld(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ud=null;function _S(){var e=window.event;return e&&e.type==="popstate"?e===Ud?!1:(Ud=e,!0):(Ud=null,!1)}var kv=typeof setTimeout=="function"?setTimeout:void 0,xS=typeof clearTimeout=="function"?clearTimeout:void 0,wv=typeof Promise=="function"?Promise:void 0,SS=typeof queueMicrotask=="function"?queueMicrotask:typeof wv<"u"?function(e){return wv.resolve(null).then(e).catch(TS)}:kv;function TS(e){setTimeout(function(){throw e})}function sa(e){return e==="head"}function Nv(e,t){var a=t,r=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(f),Pi(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")Yo(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Yo(a);for(var p=a.firstChild;p;){var x=p.nextSibling,k=p.nodeName;p[po]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=x}}else a==="body"&&Yo(e.ownerDocument.body);a=f}while(a);Pi(t)}function jv(e,t){var a=e;e=0;do{var r=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),r&&r.nodeType===8)if(a=r.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=r}while(a)}function zd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":zd(a),Gc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function kS(e,t,a,r){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[po])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==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(p=e.getAttribute("src"),(p!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var p=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=Rn(e.nextSibling),e===null)break}return null}function wS(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Rn(e.nextSibling),e===null))return null;return e}function Cv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Rn(e.nextSibling),e===null))return null;return e}function Pd(e){return e.data==="$?"||e.data==="$~"}function Vd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function NS(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function Rn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Hd=null;function Ev(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return Rn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Av(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Dv(e,t,a){switch(t=Bl(a),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function Yo(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Gc(e)}var Mn=new Map,Rv=new Set;function Ll(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ns=$.d;$.d={f:jS,r:CS,D:ES,C:AS,L:DS,m:RS,X:OS,S:MS,M:IS};function jS(){var e=Ns.f(),t=Cl();return e||t}function CS(e){var t=ii(e);t!==null&&t.tag===5&&t.type==="form"?Yh(t):Ns.r(e)}var Li=typeof document>"u"?null:document;function Mv(e,t,a){var r=Li;if(r&&typeof t=="string"&&t){var f=wn(t);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),Rv.has(f)||(Rv.add(f),e={rel:e,crossOrigin:a,href:t},r.querySelector(f)===null&&(t=r.createElement("link"),Zt(t,"link",e),zt(t),r.head.appendChild(t)))}}function ES(e){Ns.D(e),Mv("dns-prefetch",e,null)}function AS(e,t){Ns.C(e,t),Mv("preconnect",e,t)}function DS(e,t,a){Ns.L(e,t,a);var r=Li;if(r&&e&&t){var f='link[rel="preload"][as="'+wn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+wn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+wn(a.imageSizes)+'"]')):f+='[href="'+wn(e)+'"]';var p=f;switch(t){case"style":p=Ui(e);break;case"script":p=zi(e)}Mn.has(p)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Mn.set(p,e),r.querySelector(f)!==null||t==="style"&&r.querySelector(Jo(p))||t==="script"&&r.querySelector(Wo(p))||(t=r.createElement("link"),Zt(t,"link",e),zt(t),r.head.appendChild(t)))}}function RS(e,t){Ns.m(e,t);var a=Li;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",f='link[rel="modulepreload"][as="'+wn(r)+'"][href="'+wn(e)+'"]',p=f;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=zi(e)}if(!Mn.has(p)&&(e=b({rel:"modulepreload",href:e},t),Mn.set(p,e),a.querySelector(f)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Wo(p)))return}r=a.createElement("link"),Zt(r,"link",e),zt(r),a.head.appendChild(r)}}}function MS(e,t,a){Ns.S(e,t,a);var r=Li;if(r&&e){var f=oi(r).hoistableStyles,p=Ui(e);t=t||"default";var x=f.get(p);if(!x){var k={loading:0,preload:null};if(x=r.querySelector(Jo(p)))k.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Mn.get(p))&&qd(e,a);var R=x=r.createElement("link");zt(R),Zt(R,"link",e),R._p=new Promise(function(V,Y){R.onload=V,R.onerror=Y}),R.addEventListener("load",function(){k.loading|=1}),R.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Ul(x,t,r)}x={type:"stylesheet",instance:x,count:1,state:k},f.set(p,x)}}}function OS(e,t){Ns.X(e,t);var a=Li;if(a&&e){var r=oi(a).hoistableScripts,f=zi(e),p=r.get(f);p||(p=a.querySelector(Wo(f)),p||(e=b({src:e,async:!0},t),(t=Mn.get(f))&&Gd(e,t),p=a.createElement("script"),zt(p),Zt(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},r.set(f,p))}}function IS(e,t){Ns.M(e,t);var a=Li;if(a&&e){var r=oi(a).hoistableScripts,f=zi(e),p=r.get(f);p||(p=a.querySelector(Wo(f)),p||(e=b({src:e,async:!0,type:"module"},t),(t=Mn.get(f))&&Gd(e,t),p=a.createElement("script"),zt(p),Zt(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},r.set(f,p))}}function Ov(e,t,a,r){var f=(f=fe.current)?Ll(f):null;if(!f)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Ui(a.href),a=oi(f).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Ui(a.href);var p=oi(f).hoistableStyles,x=p.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,x),(p=f.querySelector(Jo(e)))&&!p._p&&(x.instance=p,x.state.loading=5),Mn.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},Mn.set(e,a),p||BS(f,e,a,x.state))),t&&r===null)throw Error(o(528,""));return x}if(t&&r!==null)throw Error(o(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=zi(a),a=oi(f).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Ui(e){return'href="'+wn(e)+'"'}function Jo(e){return'link[rel="stylesheet"]['+e+"]"}function Iv(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function BS(e,t,a,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Zt(t,"link",a),zt(t),e.head.appendChild(t))}function zi(e){return'[src="'+wn(e)+'"]'}function Wo(e){return"script[async]"+e}function Bv(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+wn(a.href)+'"]');if(r)return t.instance=r,zt(r),r;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),zt(r),Zt(r,"style",f),Ul(r,a.precedence,e),t.instance=r;case"stylesheet":f=Ui(a.href);var p=e.querySelector(Jo(f));if(p)return t.state.loading|=4,t.instance=p,zt(p),p;r=Iv(a),(f=Mn.get(f))&&qd(r,f),p=(e.ownerDocument||e).createElement("link"),zt(p);var x=p;return x._p=new Promise(function(k,R){x.onload=k,x.onerror=R}),Zt(p,"link",r),t.state.loading|=4,Ul(p,a.precedence,e),t.instance=p;case"script":return p=zi(a.src),(f=e.querySelector(Wo(p)))?(t.instance=f,zt(f),f):(r=a,(f=Mn.get(p))&&(r=b({},a),Gd(r,f)),e=e.ownerDocument||e,f=e.createElement("script"),zt(f),Zt(f,"link",r),e.head.appendChild(f),t.instance=f);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Ul(r,a.precedence,e));return t.instance}function Ul(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=r.length?r[r.length-1]:null,p=f,x=0;x<r.length;x++){var k=r[x];if(k.dataset.precedence===t)p=k;else if(p!==f)break}p?p.parentNode.insertBefore(e,p.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function qd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Gd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var zl=null;function Lv(e,t,a){if(zl===null){var r=new Map,f=zl=new Map;f.set(a,r)}else f=zl,r=f.get(a),r||(r=new Map,f.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var p=a[f];if(!(p[po]||p[qt]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var x=p.getAttribute(t)||"";x=e+x;var k=r.get(x);k?k.push(p):r.set(x,[p])}}return r}function Uv(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function LS(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function zv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function US(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=Ui(r.href),p=t.querySelector(Jo(f));if(p){t=p._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Pl.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=p,zt(p);return}p=t.ownerDocument||t,r=Iv(r),(f=Mn.get(f))&&qd(r,f),p=p.createElement("link"),zt(p);var x=p;x._p=new Promise(function(k,R){x.onload=k,x.onerror=R}),Zt(p,"link",r),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Pl.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var $d=0;function zS(e,t){return e.stylesheets&&e.count===0&&Hl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Hl(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+t);0<e.imgBytes&&$d===0&&($d=62500*bS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Hl(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>$d?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(f)}}:null}function Pl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Vl=null;function Hl(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Vl=new Map,t.forEach(PS,e),Vl=null,Pl.call(e))}function PS(e,t){if(!(t.state.loading&4)){var a=Vl.get(e);if(a)var r=a.get(null);else{a=new Map,Vl.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<f.length;p++){var x=f[p];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),r=x)}r&&a.set(null,r)}f=t.instance,x=f.getAttribute("data-precedence"),p=a.get(x)||r,p===r&&a.set(null,f),a.set(x,f),this.count++,r=Pl.bind(this),f.addEventListener("load",r),f.addEventListener("error",r),p?p.parentNode.insertBefore(f,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),t.state.loading|=4}}var Xo={$$typeof:A,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function VS(e,t,a,r,f,p,x,k,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=tt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tt(0),this.hiddenUpdates=tt(null),this.identifierPrefix=r,this.onUncaughtError=f,this.onCaughtError=p,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Pv(e,t,a,r,f,p,x,k,R,V,Y,W){return e=new VS(e,t,a,x,R,V,Y,W,k),t=1,p===!0&&(t|=24),p=pn(3,null,null,t),e.current=p,p.stateNode=e,t=ku(),t.refCount++,e.pooledCache=t,t.refCount++,p.memoizedState={element:r,isDehydrated:a,cache:t},Cu(p),e}function Vv(e){return e?(e=gi,e):gi}function Hv(e,t,a,r,f,p){f=Vv(f),r.context===null?r.context=f:r.pendingContext=f,r=Fs(t),r.payload={element:a},p=p===void 0?null:p,p!==null&&(r.callback=p),a=Zs(e,r,t),a!==null&&(un(a,e,t),Ao(a,e,t))}function qv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Fd(e,t){qv(e,t),(e=e.alternate)&&qv(e,t)}function Gv(e){if(e.tag===13||e.tag===31){var t=Na(e,67108864);t!==null&&un(t,e,67108864),Fd(e,67108864)}}function $v(e){if(e.tag===13||e.tag===31){var t=yn();t=Hn(t);var a=Na(e,t);a!==null&&un(a,e,t),Fd(e,t)}}var ql=!0;function HS(e,t,a,r){var f=B.T;B.T=null;var p=$.p;try{$.p=2,Zd(e,t,a,r)}finally{$.p=p,B.T=f}}function qS(e,t,a,r){var f=B.T;B.T=null;var p=$.p;try{$.p=8,Zd(e,t,a,r)}finally{$.p=p,B.T=f}}function Zd(e,t,a,r){if(ql){var f=Kd(r);if(f===null)Md(e,t,r,Gl,a),Zv(e,r);else if($S(f,e,t,a,r))r.stopPropagation();else if(Zv(e,r),t&4&&-1<GS.indexOf(e)){for(;f!==null;){var p=ii(f);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var x=ue(p.pendingLanes);if(x!==0){var k=p;for(k.pendingLanes|=2,k.entangledLanes|=2;x;){var R=1<<31-Wt(x);k.entanglements[1]|=R,x&=~R}es(p),(We&6)===0&&(Nl=Je()+500,Fo(0))}}break;case 31:case 13:k=Na(p,2),k!==null&&un(k,p,2),Cl(),Fd(p,2)}if(p=Kd(r),p===null&&Md(e,t,r,Gl,a),p===f)break;f=p}f!==null&&r.stopPropagation()}else Md(e,t,r,null,a)}}function Kd(e){return e=Jc(e),Yd(e)}var Gl=null;function Yd(e){if(Gl=null,e=ai(e),e!==null){var t=u(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=d(t),e!==null)return e;e=null}else if(a===31){if(e=m(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Gl=e,null}function Fv(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(lo()){case co:return 2;case uo:return 8;case _a:case Or:return 32;case fo:return 268435456;default:return 32}default:return 32}}var Jd=!1,aa=null,ia=null,oa=null,Qo=new Map,er=new Map,ra=[],GS="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 Zv(e,t){switch(e){case"focusin":case"focusout":aa=null;break;case"dragenter":case"dragleave":ia=null;break;case"mouseover":case"mouseout":oa=null;break;case"pointerover":case"pointerout":Qo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":er.delete(t.pointerId)}}function tr(e,t,a,r,f,p){return e===null||e.nativeEvent!==p?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:p,targetContainers:[f]},t!==null&&(t=ii(t),t!==null&&Gv(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,f!==null&&t.indexOf(f)===-1&&t.push(f),e)}function $S(e,t,a,r,f){switch(t){case"focusin":return aa=tr(aa,e,t,a,r,f),!0;case"dragenter":return ia=tr(ia,e,t,a,r,f),!0;case"mouseover":return oa=tr(oa,e,t,a,r,f),!0;case"pointerover":var p=f.pointerId;return Qo.set(p,tr(Qo.get(p)||null,e,t,a,r,f)),!0;case"gotpointercapture":return p=f.pointerId,er.set(p,tr(er.get(p)||null,e,t,a,r,f)),!0}return!1}function Kv(e){var t=ai(e.target);if(t!==null){var a=u(t);if(a!==null){if(t=a.tag,t===13){if(t=d(a),t!==null){e.blockedOn=t,lm(e.priority,function(){$v(a)});return}}else if(t===31){if(t=m(a),t!==null){e.blockedOn=t,lm(e.priority,function(){$v(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function $l(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Kd(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);Yc=r,a.target.dispatchEvent(r),Yc=null}else return t=ii(a),t!==null&&Gv(t),e.blockedOn=a,!1;t.shift()}return!0}function Yv(e,t,a){$l(e)&&a.delete(t)}function FS(){Jd=!1,aa!==null&&$l(aa)&&(aa=null),ia!==null&&$l(ia)&&(ia=null),oa!==null&&$l(oa)&&(oa=null),Qo.forEach(Yv),er.forEach(Yv)}function Fl(e,t){e.blockedOn===t&&(e.blockedOn=null,Jd||(Jd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,FS)))}var Zl=null;function Jv(e){Zl!==e&&(Zl=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Zl===e&&(Zl=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],f=e[t+2];if(typeof r!="function"){if(Yd(r||a)===null)continue;break}var p=ii(a);p!==null&&(e.splice(t,3),t-=3,Ku(p,{pending:!0,data:f,method:a.method,action:r},r,f))}}))}function Pi(e){function t(R){return Fl(R,e)}aa!==null&&Fl(aa,e),ia!==null&&Fl(ia,e),oa!==null&&Fl(oa,e),Qo.forEach(t),er.forEach(t);for(var a=0;a<ra.length;a++){var r=ra[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<ra.length&&(a=ra[0],a.blockedOn===null);)Kv(a),a.blockedOn===null&&ra.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var f=a[r],p=a[r+1],x=f[sn]||null;if(typeof p=="function")x||Jv(a);else if(x){var k=null;if(p&&p.hasAttribute("formAction")){if(f=p,x=p[sn]||null)k=x.formAction;else if(Yd(f)!==null)continue}else k=x.action;typeof k=="function"?a[r+1]=k:(a.splice(r,3),r-=3),Jv(a)}}}function Wv(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function t(){f!==null&&(f(),f=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),f!==null&&(f(),f=null)}}}function Wd(e){this._internalRoot=e}Kl.prototype.render=Wd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var a=t.current,r=yn();Hv(a,r,e,t,null,null)},Kl.prototype.unmount=Wd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Hv(e.current,2,null,e,null,null),Cl(),t[si]=null}};function Kl(e){this._internalRoot=e}Kl.prototype.unstable_scheduleHydration=function(e){if(e){var t=rm();e={blockedOn:null,target:e,priority:t};for(var a=0;a<ra.length&&t!==0&&t<ra[a].priority;a++);ra.splice(a,0,e),a===0&&Kv(e)}};var Xv=s.version;if(Xv!=="19.2.4")throw Error(o(527,Xv,"19.2.4"));$.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var ZS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yl.isDisabled&&Yl.supportsFiber)try{Us=Yl.inject(ZS),Jt=Yl}catch{}}return sr.createRoot=function(e,t){if(!c(e))throw Error(o(299));var a=!1,r="",f=ig,p=og,x=rg;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(f=t.onUncaughtError),t.onCaughtError!==void 0&&(p=t.onCaughtError),t.onRecoverableError!==void 0&&(x=t.onRecoverableError)),t=Pv(e,1,!1,null,null,a,r,null,f,p,x,Wv),e[si]=t.current,Rd(e),new Wd(t)},sr.hydrateRoot=function(e,t,a){if(!c(e))throw Error(o(299));var r=!1,f="",p=ig,x=og,k=rg,R=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(k=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),t=Pv(e,1,!0,t,a??null,r,f,R,p,x,k,Wv),t.context=Vv(null),a=t.current,r=yn(),r=Hn(r),f=Fs(r),f.callback=null,Zs(a,f,r),a=r,t.current.lanes=a,Ve(t,a),es(t),e[si]=t.current,Rd(e),new Kl(t)},sr.version="19.2.4",sr}var o0;function xT(){if(o0)return Xd.exports;o0=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(s){console.error(s)}}return n(),Xd.exports=_T(),Xd.exports}var ST=xT();const TT="modulepreload",kT=function(n){return"/"+n},r0={},wT=function(s,i,o){let c=Promise.resolve();if(i&&i.length>0){let d=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),h=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=d(i.map(g=>{if(g=kT(g),g in r0)return;r0[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":TT,v||(_.as="script"),_.crossOrigin="",_.href=g,h&&_.setAttribute("nonce",h),document.head.appendChild(_),v)return new Promise((S,T)=>{_.addEventListener("load",S),_.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${g}`)))})}))}function u(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return c.then(d=>{for(const m of d||[])m.status==="rejected"&&u(m.reason);return s().catch(u)})},NT=new Proxy(globalThis.fetch,{apply(n,s,i){return Reflect.apply(globalThis.fetch,s,i)}}),jT=oT({baseUrl:"/",fetch:NT}),ke=rT(lT,jT);/**
|
|
26
|
+
`).replace(vS,"")}function _v(e,t){return t=bv(t),bv(e)===t}function st(e,t,a,r,f,p){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||ci(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&ci(e,""+r);break;case"className":zr(e,"class",r);break;case"tabIndex":zr(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":zr(e,a,r);break;case"style":_m(e,r,p);break;case"data":if(t!=="object"){zr(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Vr(""+r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="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 p=="function"&&(a==="formAction"?(t!=="input"&&st(e,t,"name",f.name,f,null),st(e,t,"formEncType",f.formEncType,f,null),st(e,t,"formMethod",f.formMethod,f,null),st(e,t,"formTarget",f.formTarget,f,null)):(st(e,t,"encType",f.encType,f,null),st(e,t,"method",f.method,f,null),st(e,t,"target",f.target,f,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Vr(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=us);break;case"onScroll":r!=null&&Le("scroll",e);break;case"onScrollEnd":r!=null&&Le("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(o(61));if(a=r.__html,a!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=a}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}a=Vr(""+r),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":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""+r):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":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":r===!0?e.setAttribute(a,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,r):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(a,r):e.removeAttribute(a);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(a):e.setAttribute(a,r);break;case"popover":Le("beforetoggle",e),Le("toggle",e),Ur(e,"popover",r);break;case"xlinkActuate":cs(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":cs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":cs(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":cs(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":cs(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":cs(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":cs(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":cs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":cs(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Ur(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=$x.get(a)||a,Ur(e,a,r))}}function Od(e,t,a,r,f,p){switch(a){case"style":_m(e,r,p);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(o(61));if(a=r.__html,a!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=a}}break;case"children":typeof r=="string"?ci(e,r):(typeof r=="number"||typeof r=="bigint")&&ci(e,""+r);break;case"onScroll":r!=null&&Le("scroll",e);break;case"onScrollEnd":r!=null&&Le("scrollend",e);break;case"onClick":r!=null&&(e.onclick=us);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!dm.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),t=a.slice(2,f?a.length-7:void 0),p=e[sn]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(t,p,f),typeof r=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,f);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):Ur(e,a,r)}}}function Zt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Le("error",e),Le("load",e);var r=!1,f=!1,p;for(p in a)if(a.hasOwnProperty(p)){var x=a[p];if(x!=null)switch(p){case"src":r=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,p,x,a,null)}}f&&st(e,t,"srcSet",a.srcSet,a,null),r&&st(e,t,"src",a.src,a,null);return;case"input":Le("invalid",e);var k=p=x=f=null,R=null,V=null;for(r in a)if(a.hasOwnProperty(r)){var Y=a[r];if(Y!=null)switch(r){case"name":f=Y;break;case"type":x=Y;break;case"checked":R=Y;break;case"defaultChecked":V=Y;break;case"value":p=Y;break;case"defaultValue":k=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:st(e,t,r,Y,a,null)}}gm(e,p,k,R,V,x,f,!1);return;case"select":Le("invalid",e),r=x=p=null;for(f in a)if(a.hasOwnProperty(f)&&(k=a[f],k!=null))switch(f){case"value":p=k;break;case"defaultValue":x=k;break;case"multiple":r=k;default:st(e,t,f,k,a,null)}t=p,a=x,e.multiple=!!r,t!=null?li(e,!!r,t,!1):a!=null&&li(e,!!r,a,!0);return;case"textarea":Le("invalid",e),p=f=r=null;for(x in a)if(a.hasOwnProperty(x)&&(k=a[x],k!=null))switch(x){case"value":r=k;break;case"defaultValue":f=k;break;case"children":p=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(o(91));break;default:st(e,t,x,k,a,null)}ym(e,r,f,p);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(r=a[R],r!=null))switch(R){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:st(e,t,R,r,a,null)}return;case"dialog":Le("beforetoggle",e),Le("toggle",e),Le("cancel",e),Le("close",e);break;case"iframe":case"object":Le("load",e);break;case"video":case"audio":for(r=0;r<Zo.length;r++)Le(Zo[r],e);break;case"image":Le("error",e),Le("load",e);break;case"details":Le("toggle",e);break;case"embed":case"source":case"link":Le("error",e),Le("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(V in a)if(a.hasOwnProperty(V)&&(r=a[V],r!=null))switch(V){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,V,r,a,null)}return;default:if(Kc(t)){for(Y in a)a.hasOwnProperty(Y)&&(r=a[Y],r!==void 0&&Od(e,t,Y,r,a,void 0));return}}for(k in a)a.hasOwnProperty(k)&&(r=a[k],r!=null&&st(e,t,k,r,a,null))}function yS(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,p=null,x=null,k=null,R=null,V=null,Y=null;for(K in a){var W=a[K];if(a.hasOwnProperty(K)&&W!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":R=W;default:r.hasOwnProperty(K)||st(e,t,K,null,r,W)}}for(var G in r){var K=r[G];if(W=a[G],r.hasOwnProperty(G)&&(K!=null||W!=null))switch(G){case"type":p=K;break;case"name":f=K;break;case"checked":V=K;break;case"defaultChecked":Y=K;break;case"value":x=K;break;case"defaultValue":k=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(o(137,t));break;default:K!==W&&st(e,t,G,K,r,W)}}Fc(e,x,k,R,V,Y,p,f);return;case"select":K=x=k=G=null;for(p in a)if(R=a[p],a.hasOwnProperty(p)&&R!=null)switch(p){case"value":break;case"multiple":K=R;default:r.hasOwnProperty(p)||st(e,t,p,null,r,R)}for(f in r)if(p=r[f],R=a[f],r.hasOwnProperty(f)&&(p!=null||R!=null))switch(f){case"value":G=p;break;case"defaultValue":k=p;break;case"multiple":x=p;default:p!==R&&st(e,t,f,p,r,R)}t=k,a=x,r=K,G!=null?li(e,!!a,G,!1):!!r!=!!a&&(t!=null?li(e,!!a,t,!0):li(e,!!a,a?[]:"",!1));return;case"textarea":K=G=null;for(k in a)if(f=a[k],a.hasOwnProperty(k)&&f!=null&&!r.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:st(e,t,k,null,r,f)}for(x in r)if(f=r[x],p=a[x],r.hasOwnProperty(x)&&(f!=null||p!=null))switch(x){case"value":G=f;break;case"defaultValue":K=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(o(91));break;default:f!==p&&st(e,t,x,f,r,p)}vm(e,G,K);return;case"option":for(var ge in a)if(G=a[ge],a.hasOwnProperty(ge)&&G!=null&&!r.hasOwnProperty(ge))switch(ge){case"selected":e.selected=!1;break;default:st(e,t,ge,null,r,G)}for(R in r)if(G=r[R],K=a[R],r.hasOwnProperty(R)&&G!==K&&(G!=null||K!=null))switch(R){case"selected":e.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:st(e,t,R,G,r,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var xe in a)G=a[xe],a.hasOwnProperty(xe)&&G!=null&&!r.hasOwnProperty(xe)&&st(e,t,xe,null,r,G);for(V in r)if(G=r[V],K=a[V],r.hasOwnProperty(V)&&G!==K&&(G!=null||K!=null))switch(V){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(o(137,t));break;default:st(e,t,V,G,r,K)}return;default:if(Kc(t)){for(var at in a)G=a[at],a.hasOwnProperty(at)&&G!==void 0&&!r.hasOwnProperty(at)&&Od(e,t,at,void 0,r,G);for(Y in r)G=r[Y],K=a[Y],!r.hasOwnProperty(Y)||G===K||G===void 0&&K===void 0||Od(e,t,Y,G,r,K);return}}for(var L in a)G=a[L],a.hasOwnProperty(L)&&G!=null&&!r.hasOwnProperty(L)&&st(e,t,L,null,r,G);for(W in r)G=r[W],K=a[W],!r.hasOwnProperty(W)||G===K||G==null&&K==null||st(e,t,W,G,r,K)}function xv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function bS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var f=a[r],p=f.transferSize,x=f.initiatorType,k=f.duration;if(p&&k&&xv(x)){for(x=0,k=f.responseEnd,r+=1;r<a.length;r++){var R=a[r],V=R.startTime;if(V>k)break;var Y=R.transferSize,W=R.initiatorType;Y&&xv(W)&&(R=R.responseEnd,x+=Y*(R<k?1:(k-V)/(R-V)))}if(--r,t+=8*(p+x)/(f.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Id=null,Bd=null;function Bl(e){return e.nodeType===9?e:e.ownerDocument}function Sv(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 Tv(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Ld(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ud=null;function _S(){var e=window.event;return e&&e.type==="popstate"?e===Ud?!1:(Ud=e,!0):(Ud=null,!1)}var kv=typeof setTimeout=="function"?setTimeout:void 0,xS=typeof clearTimeout=="function"?clearTimeout:void 0,wv=typeof Promise=="function"?Promise:void 0,SS=typeof queueMicrotask=="function"?queueMicrotask:typeof wv<"u"?function(e){return wv.resolve(null).then(e).catch(TS)}:kv;function TS(e){setTimeout(function(){throw e})}function sa(e){return e==="head"}function Nv(e,t){var a=t,r=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(f),Pi(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")Yo(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Yo(a);for(var p=a.firstChild;p;){var x=p.nextSibling,k=p.nodeName;p[po]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=x}}else a==="body"&&Yo(e.ownerDocument.body);a=f}while(a);Pi(t)}function jv(e,t){var a=e;e=0;do{var r=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),r&&r.nodeType===8)if(a=r.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=r}while(a)}function zd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":zd(a),Gc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function kS(e,t,a,r){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[po])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==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(p=e.getAttribute("src"),(p!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var p=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=Rn(e.nextSibling),e===null)break}return null}function wS(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Rn(e.nextSibling),e===null))return null;return e}function Cv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Rn(e.nextSibling),e===null))return null;return e}function Pd(e){return e.data==="$?"||e.data==="$~"}function Vd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function NS(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function Rn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Hd=null;function Ev(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return Rn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Av(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Dv(e,t,a){switch(t=Bl(a),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function Yo(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Gc(e)}var Mn=new Map,Rv=new Set;function Ll(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ns=$.d;$.d={f:jS,r:CS,D:ES,C:AS,L:DS,m:RS,X:OS,S:MS,M:IS};function jS(){var e=Ns.f(),t=Cl();return e||t}function CS(e){var t=ii(e);t!==null&&t.tag===5&&t.type==="form"?Yh(t):Ns.r(e)}var Li=typeof document>"u"?null:document;function Mv(e,t,a){var r=Li;if(r&&typeof t=="string"&&t){var f=wn(t);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),Rv.has(f)||(Rv.add(f),e={rel:e,crossOrigin:a,href:t},r.querySelector(f)===null&&(t=r.createElement("link"),Zt(t,"link",e),zt(t),r.head.appendChild(t)))}}function ES(e){Ns.D(e),Mv("dns-prefetch",e,null)}function AS(e,t){Ns.C(e,t),Mv("preconnect",e,t)}function DS(e,t,a){Ns.L(e,t,a);var r=Li;if(r&&e&&t){var f='link[rel="preload"][as="'+wn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+wn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+wn(a.imageSizes)+'"]')):f+='[href="'+wn(e)+'"]';var p=f;switch(t){case"style":p=Ui(e);break;case"script":p=zi(e)}Mn.has(p)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Mn.set(p,e),r.querySelector(f)!==null||t==="style"&&r.querySelector(Jo(p))||t==="script"&&r.querySelector(Wo(p))||(t=r.createElement("link"),Zt(t,"link",e),zt(t),r.head.appendChild(t)))}}function RS(e,t){Ns.m(e,t);var a=Li;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",f='link[rel="modulepreload"][as="'+wn(r)+'"][href="'+wn(e)+'"]',p=f;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=zi(e)}if(!Mn.has(p)&&(e=b({rel:"modulepreload",href:e},t),Mn.set(p,e),a.querySelector(f)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Wo(p)))return}r=a.createElement("link"),Zt(r,"link",e),zt(r),a.head.appendChild(r)}}}function MS(e,t,a){Ns.S(e,t,a);var r=Li;if(r&&e){var f=oi(r).hoistableStyles,p=Ui(e);t=t||"default";var x=f.get(p);if(!x){var k={loading:0,preload:null};if(x=r.querySelector(Jo(p)))k.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Mn.get(p))&&qd(e,a);var R=x=r.createElement("link");zt(R),Zt(R,"link",e),R._p=new Promise(function(V,Y){R.onload=V,R.onerror=Y}),R.addEventListener("load",function(){k.loading|=1}),R.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Ul(x,t,r)}x={type:"stylesheet",instance:x,count:1,state:k},f.set(p,x)}}}function OS(e,t){Ns.X(e,t);var a=Li;if(a&&e){var r=oi(a).hoistableScripts,f=zi(e),p=r.get(f);p||(p=a.querySelector(Wo(f)),p||(e=b({src:e,async:!0},t),(t=Mn.get(f))&&Gd(e,t),p=a.createElement("script"),zt(p),Zt(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},r.set(f,p))}}function IS(e,t){Ns.M(e,t);var a=Li;if(a&&e){var r=oi(a).hoistableScripts,f=zi(e),p=r.get(f);p||(p=a.querySelector(Wo(f)),p||(e=b({src:e,async:!0,type:"module"},t),(t=Mn.get(f))&&Gd(e,t),p=a.createElement("script"),zt(p),Zt(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},r.set(f,p))}}function Ov(e,t,a,r){var f=(f=fe.current)?Ll(f):null;if(!f)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Ui(a.href),a=oi(f).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Ui(a.href);var p=oi(f).hoistableStyles,x=p.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,x),(p=f.querySelector(Jo(e)))&&!p._p&&(x.instance=p,x.state.loading=5),Mn.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},Mn.set(e,a),p||BS(f,e,a,x.state))),t&&r===null)throw Error(o(528,""));return x}if(t&&r!==null)throw Error(o(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=zi(a),a=oi(f).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Ui(e){return'href="'+wn(e)+'"'}function Jo(e){return'link[rel="stylesheet"]['+e+"]"}function Iv(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function BS(e,t,a,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Zt(t,"link",a),zt(t),e.head.appendChild(t))}function zi(e){return'[src="'+wn(e)+'"]'}function Wo(e){return"script[async]"+e}function Bv(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+wn(a.href)+'"]');if(r)return t.instance=r,zt(r),r;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),zt(r),Zt(r,"style",f),Ul(r,a.precedence,e),t.instance=r;case"stylesheet":f=Ui(a.href);var p=e.querySelector(Jo(f));if(p)return t.state.loading|=4,t.instance=p,zt(p),p;r=Iv(a),(f=Mn.get(f))&&qd(r,f),p=(e.ownerDocument||e).createElement("link"),zt(p);var x=p;return x._p=new Promise(function(k,R){x.onload=k,x.onerror=R}),Zt(p,"link",r),t.state.loading|=4,Ul(p,a.precedence,e),t.instance=p;case"script":return p=zi(a.src),(f=e.querySelector(Wo(p)))?(t.instance=f,zt(f),f):(r=a,(f=Mn.get(p))&&(r=b({},a),Gd(r,f)),e=e.ownerDocument||e,f=e.createElement("script"),zt(f),Zt(f,"link",r),e.head.appendChild(f),t.instance=f);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Ul(r,a.precedence,e));return t.instance}function Ul(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=r.length?r[r.length-1]:null,p=f,x=0;x<r.length;x++){var k=r[x];if(k.dataset.precedence===t)p=k;else if(p!==f)break}p?p.parentNode.insertBefore(e,p.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function qd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Gd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var zl=null;function Lv(e,t,a){if(zl===null){var r=new Map,f=zl=new Map;f.set(a,r)}else f=zl,r=f.get(a),r||(r=new Map,f.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var p=a[f];if(!(p[po]||p[qt]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var x=p.getAttribute(t)||"";x=e+x;var k=r.get(x);k?k.push(p):r.set(x,[p])}}return r}function Uv(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function LS(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function zv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function US(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=Ui(r.href),p=t.querySelector(Jo(f));if(p){t=p._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Pl.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=p,zt(p);return}p=t.ownerDocument||t,r=Iv(r),(f=Mn.get(f))&&qd(r,f),p=p.createElement("link"),zt(p);var x=p;x._p=new Promise(function(k,R){x.onload=k,x.onerror=R}),Zt(p,"link",r),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Pl.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var $d=0;function zS(e,t){return e.stylesheets&&e.count===0&&Hl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Hl(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+t);0<e.imgBytes&&$d===0&&($d=62500*bS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Hl(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>$d?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(f)}}:null}function Pl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Vl=null;function Hl(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Vl=new Map,t.forEach(PS,e),Vl=null,Pl.call(e))}function PS(e,t){if(!(t.state.loading&4)){var a=Vl.get(e);if(a)var r=a.get(null);else{a=new Map,Vl.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<f.length;p++){var x=f[p];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),r=x)}r&&a.set(null,r)}f=t.instance,x=f.getAttribute("data-precedence"),p=a.get(x)||r,p===r&&a.set(null,f),a.set(x,f),this.count++,r=Pl.bind(this),f.addEventListener("load",r),f.addEventListener("error",r),p?p.parentNode.insertBefore(f,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),t.state.loading|=4}}var Xo={$$typeof:A,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function VS(e,t,a,r,f,p,x,k,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=tt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tt(0),this.hiddenUpdates=tt(null),this.identifierPrefix=r,this.onUncaughtError=f,this.onCaughtError=p,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Pv(e,t,a,r,f,p,x,k,R,V,Y,W){return e=new VS(e,t,a,x,R,V,Y,W,k),t=1,p===!0&&(t|=24),p=pn(3,null,null,t),e.current=p,p.stateNode=e,t=ku(),t.refCount++,e.pooledCache=t,t.refCount++,p.memoizedState={element:r,isDehydrated:a,cache:t},Cu(p),e}function Vv(e){return e?(e=gi,e):gi}function Hv(e,t,a,r,f,p){f=Vv(f),r.context===null?r.context=f:r.pendingContext=f,r=Fs(t),r.payload={element:a},p=p===void 0?null:p,p!==null&&(r.callback=p),a=Zs(e,r,t),a!==null&&(un(a,e,t),Ao(a,e,t))}function qv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Fd(e,t){qv(e,t),(e=e.alternate)&&qv(e,t)}function Gv(e){if(e.tag===13||e.tag===31){var t=Na(e,67108864);t!==null&&un(t,e,67108864),Fd(e,67108864)}}function $v(e){if(e.tag===13||e.tag===31){var t=yn();t=Hn(t);var a=Na(e,t);a!==null&&un(a,e,t),Fd(e,t)}}var ql=!0;function HS(e,t,a,r){var f=B.T;B.T=null;var p=$.p;try{$.p=2,Zd(e,t,a,r)}finally{$.p=p,B.T=f}}function qS(e,t,a,r){var f=B.T;B.T=null;var p=$.p;try{$.p=8,Zd(e,t,a,r)}finally{$.p=p,B.T=f}}function Zd(e,t,a,r){if(ql){var f=Kd(r);if(f===null)Md(e,t,r,Gl,a),Zv(e,r);else if($S(f,e,t,a,r))r.stopPropagation();else if(Zv(e,r),t&4&&-1<GS.indexOf(e)){for(;f!==null;){var p=ii(f);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var x=ue(p.pendingLanes);if(x!==0){var k=p;for(k.pendingLanes|=2,k.entangledLanes|=2;x;){var R=1<<31-Wt(x);k.entanglements[1]|=R,x&=~R}es(p),(We&6)===0&&(Nl=Je()+500,Fo(0))}}break;case 31:case 13:k=Na(p,2),k!==null&&un(k,p,2),Cl(),Fd(p,2)}if(p=Kd(r),p===null&&Md(e,t,r,Gl,a),p===f)break;f=p}f!==null&&r.stopPropagation()}else Md(e,t,r,null,a)}}function Kd(e){return e=Jc(e),Yd(e)}var Gl=null;function Yd(e){if(Gl=null,e=ai(e),e!==null){var t=u(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=d(t),e!==null)return e;e=null}else if(a===31){if(e=m(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Gl=e,null}function Fv(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(lo()){case co:return 2;case uo:return 8;case _a:case Or:return 32;case fo:return 268435456;default:return 32}default:return 32}}var Jd=!1,aa=null,ia=null,oa=null,Qo=new Map,er=new Map,ra=[],GS="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 Zv(e,t){switch(e){case"focusin":case"focusout":aa=null;break;case"dragenter":case"dragleave":ia=null;break;case"mouseover":case"mouseout":oa=null;break;case"pointerover":case"pointerout":Qo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":er.delete(t.pointerId)}}function tr(e,t,a,r,f,p){return e===null||e.nativeEvent!==p?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:p,targetContainers:[f]},t!==null&&(t=ii(t),t!==null&&Gv(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,f!==null&&t.indexOf(f)===-1&&t.push(f),e)}function $S(e,t,a,r,f){switch(t){case"focusin":return aa=tr(aa,e,t,a,r,f),!0;case"dragenter":return ia=tr(ia,e,t,a,r,f),!0;case"mouseover":return oa=tr(oa,e,t,a,r,f),!0;case"pointerover":var p=f.pointerId;return Qo.set(p,tr(Qo.get(p)||null,e,t,a,r,f)),!0;case"gotpointercapture":return p=f.pointerId,er.set(p,tr(er.get(p)||null,e,t,a,r,f)),!0}return!1}function Kv(e){var t=ai(e.target);if(t!==null){var a=u(t);if(a!==null){if(t=a.tag,t===13){if(t=d(a),t!==null){e.blockedOn=t,lm(e.priority,function(){$v(a)});return}}else if(t===31){if(t=m(a),t!==null){e.blockedOn=t,lm(e.priority,function(){$v(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function $l(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Kd(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);Yc=r,a.target.dispatchEvent(r),Yc=null}else return t=ii(a),t!==null&&Gv(t),e.blockedOn=a,!1;t.shift()}return!0}function Yv(e,t,a){$l(e)&&a.delete(t)}function FS(){Jd=!1,aa!==null&&$l(aa)&&(aa=null),ia!==null&&$l(ia)&&(ia=null),oa!==null&&$l(oa)&&(oa=null),Qo.forEach(Yv),er.forEach(Yv)}function Fl(e,t){e.blockedOn===t&&(e.blockedOn=null,Jd||(Jd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,FS)))}var Zl=null;function Jv(e){Zl!==e&&(Zl=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Zl===e&&(Zl=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],f=e[t+2];if(typeof r!="function"){if(Yd(r||a)===null)continue;break}var p=ii(a);p!==null&&(e.splice(t,3),t-=3,Ku(p,{pending:!0,data:f,method:a.method,action:r},r,f))}}))}function Pi(e){function t(R){return Fl(R,e)}aa!==null&&Fl(aa,e),ia!==null&&Fl(ia,e),oa!==null&&Fl(oa,e),Qo.forEach(t),er.forEach(t);for(var a=0;a<ra.length;a++){var r=ra[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<ra.length&&(a=ra[0],a.blockedOn===null);)Kv(a),a.blockedOn===null&&ra.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var f=a[r],p=a[r+1],x=f[sn]||null;if(typeof p=="function")x||Jv(a);else if(x){var k=null;if(p&&p.hasAttribute("formAction")){if(f=p,x=p[sn]||null)k=x.formAction;else if(Yd(f)!==null)continue}else k=x.action;typeof k=="function"?a[r+1]=k:(a.splice(r,3),r-=3),Jv(a)}}}function Wv(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function t(){f!==null&&(f(),f=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),f!==null&&(f(),f=null)}}}function Wd(e){this._internalRoot=e}Kl.prototype.render=Wd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var a=t.current,r=yn();Hv(a,r,e,t,null,null)},Kl.prototype.unmount=Wd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Hv(e.current,2,null,e,null,null),Cl(),t[si]=null}};function Kl(e){this._internalRoot=e}Kl.prototype.unstable_scheduleHydration=function(e){if(e){var t=rm();e={blockedOn:null,target:e,priority:t};for(var a=0;a<ra.length&&t!==0&&t<ra[a].priority;a++);ra.splice(a,0,e),a===0&&Kv(e)}};var Xv=s.version;if(Xv!=="19.2.4")throw Error(o(527,Xv,"19.2.4"));$.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var ZS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yl.isDisabled&&Yl.supportsFiber)try{Us=Yl.inject(ZS),Jt=Yl}catch{}}return sr.createRoot=function(e,t){if(!c(e))throw Error(o(299));var a=!1,r="",f=ig,p=og,x=rg;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(f=t.onUncaughtError),t.onCaughtError!==void 0&&(p=t.onCaughtError),t.onRecoverableError!==void 0&&(x=t.onRecoverableError)),t=Pv(e,1,!1,null,null,a,r,null,f,p,x,Wv),e[si]=t.current,Rd(e),new Wd(t)},sr.hydrateRoot=function(e,t,a){if(!c(e))throw Error(o(299));var r=!1,f="",p=ig,x=og,k=rg,R=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(k=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),t=Pv(e,1,!0,t,a??null,r,f,R,p,x,k,Wv),t.context=Vv(null),a=t.current,r=yn(),r=Hn(r),f=Fs(r),f.callback=null,Zs(a,f,r),a=r,t.current.lanes=a,Ve(t,a),es(t),e[si]=t.current,Rd(e),new Kl(t)},sr.version="19.2.4",sr}var o0;function xT(){if(o0)return Xd.exports;o0=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(s){console.error(s)}}return n(),Xd.exports=_T(),Xd.exports}var ST=xT();const TT="modulepreload",kT=function(n){return"/"+n},r0={},wT=function(s,i,o){let c=Promise.resolve();if(i&&i.length>0){let d=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),h=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=d(i.map(g=>{if(g=kT(g),g in r0)return;r0[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":TT,v||(_.as="script"),_.crossOrigin="",_.href=g,h&&_.setAttribute("nonce",h),document.head.appendChild(_),v)return new Promise((S,T)=>{_.addEventListener("load",S),_.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${g}`)))})}))}function u(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return c.then(d=>{for(const m of d||[])m.status==="rejected"&&u(m.reason);return s().catch(u)})},NT=new Proxy(globalThis.fetch,{apply(n,s,i){return Reflect.apply(globalThis.fetch,s,i)}}),jT=nT({baseUrl:"/",fetch:NT}),ke=sT(aT,jT),CT="_bar_1xhb4_1",ET="_input_1xhb4_32",AT="_select_1xhb4_67",DT="_btnPrimary_1xhb4_103",RT="_btnGhost_1xhb4_173",MT="_badge_1xhb4_195",OT="_disconnectHint_1xhb4_205",bn={bar:CT,input:ET,select:AT,btnPrimary:DT,btnGhost:RT,badge:MT,disconnectHint:OT};function IT(n,s){if(!n)return!1;const i=s.find(o=>o.id===n);return i!==void 0&&(i.status==="disconnected"||i.status==="error")}function BT({environmentId:n,onReconnect:s}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:bn.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),l.jsx("button",{type:"button",onClick:()=>s(n),className:bn.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function _r({mode:n,sessionId:s,environmentId:i,taskId:o,showPersonaSelect:c,personas:u,environments:d,onSendInput:m,onSpawn:h,onStartTask:g,onProvisionEnvironment:v,onShowToast:b}){const[_,S]=y.useState(""),[T,N]=y.useState(""),j=IT(i,d),w=C=>{if(C.preventDefault(),!!_.trim())if(n==="send"){if(!s||j)return;m(s,_),S("")}else if(n==="spawn"){if(!i)return;h(i,_,T),b==null||b("Session started","success"),S(""),N("")}else{if(!o)return;g(o,void 0,i,_),S("")}};return n==="spawn"?l.jsxs("form",{onSubmit:w,className:bn.bar,children:[l.jsx("span",{className:bn.badge,children:"new chat"}),l.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:bn.input}),c&&l.jsxs("select",{value:T,onChange:C=>N(C.target.value),className:bn.select,children:[l.jsx("option",{value:"",children:"(Default)"}),u.map(C=>l.jsx("option",{value:C.id,children:C.name},C.id))]}),l.jsx("button",{type:"submit",disabled:!_.trim()||!i,className:bn.btnPrimary,children:"Go"})]}):n==="start"?l.jsxs("form",{onSubmit:w,className:bn.bar,children:[l.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:bn.input}),l.jsx("button",{type:"submit",disabled:!_.trim(),className:bn.btnPrimary,children:"Send"})]}):l.jsxs("form",{onSubmit:w,className:bn.bar,children:[j&&i&&l.jsx(BT,{environmentId:i,onReconnect:v}),l.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!j,disabled:j,className:bn.input}),l.jsx("span",{title:j?"Environment is unavailable — reconnect first":void 0,children:l.jsx("button",{type:"submit",disabled:!_.trim()||j,className:bn.btnPrimary,children:"Send"})})]})}const l0=220,c0=70,LT=40,UT=60,zT="hierarchy",PT="dependency";function VT(n){return y.useMemo(()=>{if(n.length===0)return{nodes:[],edges:[]};const s=new Qv.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:LT,ranksep:UT});const i=new Map(n.map(d=>[d.id,d])),o=new Map;for(const d of n)if(d.parentTaskId&&i.has(d.parentTaskId)){const m=o.get(d.parentTaskId)||[];m.push(d),o.set(d.parentTaskId,m)}for(const d of n)s.setNode(d.id,{width:l0,height:c0});const c=[];for(const d of n){if(d.parentTaskId&&i.has(d.parentTaskId)){const m=`hierarchy-${d.parentTaskId}-${d.id}`;s.setEdge(d.parentTaskId,d.id,{},m),c.push({id:m,source:d.parentTaskId,target:d.id,type:"smoothstep",data:{edgeType:zT},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const m of d.dependsOn)if(i.has(m)){const h=`dependency-${m}-${d.id}`;s.setEdge(m,d.id,{},h),c.push({id:h,source:m,target:d.id,type:"smoothstep",data:{edgeType:PT},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return Qv.layout(s),{nodes:n.map(d=>{const m=s.node(d.id),h=o.get(d.id)||[];return{id:d.id,type:"task",position:{x:m.x-l0/2,y:m.y-c0/2},data:{task:d,childCount:h.length,doneChildCount:h.filter(g=>g.status==="complete").length,hasDependencies:d.dependsOn.length>0}}}),edges:c}},[n])}const Lf={not_started:{color:"var(--text-tertiary)",icon:"○",label:"Not Started"},working:{color:"var(--accent-green)",icon:"●",label:"Working"},paused:{color:"var(--accent-yellow)",icon:"◉",label:"Paused"},complete:{color:"var(--accent-green)",icon:"✓",label:"Complete"},failed:{color:"var(--accent-red)",icon:"✗",label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:"⦸",label:"Blocked"}};function ma(n){return n==="blocked"?Lf.blocked:Lf[fp(n)]}const HT={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function qT(n){return HT[fp(n)]??"statusPending"}const GT=["working","paused","failed","not_started","blocked","complete"],u0=["not_started","working","paused","complete","failed"],$T={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function fp(n){return n in Lf&&n!=="blocked"?n:$T[n]??"not_started"}const FT={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"},ZT="_dagContainer_js4w6_1",KT="_taskNode_js4w6_26",YT="_taskNodeBorder_js4w6_54",JT="_taskNodeContent_js4w6_60",WT="_taskNodeHeader_js4w6_70",XT="_taskNodeIcon_js4w6_77",QT="_taskNodeTitle_js4w6_82",ek="_taskNodeBadges_js4w6_90",tk="_childBadge_js4w6_95",nk="_depBadge_js4w6_107",sk="_handle_js4w6_119",ak="_emptyCta_js4w6_126",ik="_ctaDescription_js4w6_137",ok="_ctaButton_js4w6_144",nn={dagContainer:ZT,taskNode:KT,taskNodeBorder:YT,taskNodeContent:JT,taskNodeHeader:WT,taskNodeIcon:XT,taskNodeTitle:QT,taskNodeBadges:ek,childBadge:tk,depBadge:nk,handle:sk,emptyCta:ak,ctaDescription:ik,ctaButton:ok};function rk({data:n}){const{task:s,childCount:i,doneChildCount:o,hasDependencies:c}=n,u=ma(s.status);return l.jsxs("div",{className:nn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[l.jsx(e0,{type:"target",position:t0.Top,className:nn.handle}),l.jsx("div",{className:nn.taskNodeBorder,style:{backgroundColor:u.color}}),l.jsxs("div",{className:nn.taskNodeContent,children:[l.jsxs("div",{className:nn.taskNodeHeader,children:[l.jsx("span",{className:nn.taskNodeIcon,style:{color:u.color},children:u.icon}),l.jsx("span",{className:nn.taskNodeTitle,children:s.title})]}),l.jsxs("div",{className:nn.taskNodeBadges,children:[i>0&&l.jsxs("span",{className:nn.childBadge,children:[o,"/",i]}),c&&l.jsx("span",{className:nn.depBadge,children:"dep"})]})]}),l.jsx(e0,{type:"source",position:t0.Bottom,className:nn.handle})]})}/**
|
|
27
27
|
* react-router v7.13.2
|
|
28
28
|
*
|
|
29
29
|
* Copyright (c) Remix Software Inc.
|
|
@@ -32,9 +32,34 @@ Error generating stack: `+r.message+`
|
|
|
32
32
|
* LICENSE.md file in the root directory of this source tree.
|
|
33
33
|
*
|
|
34
34
|
* @license MIT
|
|
35
|
-
*/var l0="popstate";function c0(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function CT(n={}){function s(o,c){var g;let u=(g=c.state)==null?void 0:g.masked,{pathname:d,search:m,hash:h}=u||o.location;return Lf("",{pathname:d,search:m,hash:h},c.state&&c.state.usr||null,c.state&&c.state.key||"default",u?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function i(o,c){return typeof c=="string"?c:_r(c)}return AT(s,i,null,n)}function dt(n,s){if(n===!1||n===null||typeof n>"u")throw new Error(s)}function Ln(n,s){if(!n){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function ET(){return Math.random().toString(36).substring(2,10)}function u0(n,s){return{usr:n.state,key:n.key,idx:s,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Lf(n,s,i=null,o,c){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof s=="string"?ao(s):s,state:i,key:s&&s.key||o||ET(),unstable_mask:c}}function _r({pathname:n="/",search:s="",hash:i=""}){return s&&s!=="?"&&(n+=s.charAt(0)==="?"?s:"?"+s),i&&i!=="#"&&(n+=i.charAt(0)==="#"?i:"#"+i),n}function ao(n){let s={};if(n){let i=n.indexOf("#");i>=0&&(s.hash=n.substring(i),n=n.substring(0,i));let o=n.indexOf("?");o>=0&&(s.search=n.substring(o),n=n.substring(0,o)),n&&(s.pathname=n)}return s}function AT(n,s,i,o={}){let{window:c=document.defaultView,v5Compat:u=!1}=o,d=c.history,m="POP",h=null,g=v();g==null&&(g=0,d.replaceState({...d.state,idx:g},""));function v(){return(d.state||{idx:null}).idx}function b(){m="POP";let j=v(),w=j==null?null:j-g;g=j,h&&h({action:m,location:N.location,delta:w})}function _(j,w){m="PUSH";let C=c0(j)?j:Lf(N.location,j,w);g=v()+1;let A=u0(C,g),M=N.createHref(C.unstable_mask||C);try{d.pushState(A,"",M)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;c.location.assign(M)}u&&h&&h({action:m,location:N.location,delta:1})}function S(j,w){m="REPLACE";let C=c0(j)?j:Lf(N.location,j,w);g=v();let A=u0(C,g),M=N.createHref(C.unstable_mask||C);d.replaceState(A,"",M),u&&h&&h({action:m,location:N.location,delta:0})}function T(j){return DT(j)}let N={get action(){return m},get location(){return n(c,d)},listen(j){if(h)throw new Error("A history only accepts one active listener");return c.addEventListener(l0,b),h=j,()=>{c.removeEventListener(l0,b),h=null}},createHref(j){return s(c,j)},createURL:T,encodeLocation(j){let w=T(j);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:_,replace:S,go(j){return d.go(j)}};return N}function DT(n,s=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),dt(i,"No window.location.(origin|href) available to create URL");let o=typeof n=="string"?n:_r(n);return o=o.replace(/ $/,"%20"),!s&&o.startsWith("//")&&(o=i+o),new URL(o,i)}function cb(n,s,i="/"){return RT(n,s,i,!1)}function RT(n,s,i,o){let c=typeof s=="string"?ao(s):s,u=Os(c.pathname||"/",i);if(u==null)return null;let d=ub(n);MT(d);let m=null;for(let h=0;m==null&&h<d.length;++h){let g=fb(u);m=HT(d[h],g,o)}return m}function ub(n,s=[],i=[],o="",c=!1){let u=(d,m,h=c,g)=>{let v={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:m,route:d};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(o)&&h)return;dt(v.relativePath.startsWith(o),`Absolute route path "${v.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(o.length)}let b=ss([o,v.relativePath]),_=i.concat(v);d.children&&d.children.length>0&&(dt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),ub(d.children,s,_,b,h)),!(d.path==null&&!d.index)&&s.push({path:b,score:PT(b,d.index),routesMeta:_})};return n.forEach((d,m)=>{var h;if(d.path===""||!((h=d.path)!=null&&h.includes("?")))u(d,m);else for(let g of db(d.path))u(d,m,!0,g)}),s}function db(n){let s=n.split("/");if(s.length===0)return[];let[i,...o]=s,c=i.endsWith("?"),u=i.replace(/\?$/,"");if(o.length===0)return c?[u,""]:[u];let d=db(o.join("/")),m=[];return m.push(...d.map(h=>h===""?u:[u,h].join("/"))),c&&m.push(...d),m.map(h=>n.startsWith("/")&&h===""?"/":h)}function MT(n){n.sort((s,i)=>s.score!==i.score?i.score-s.score:VT(s.routesMeta.map(o=>o.childrenIndex),i.routesMeta.map(o=>o.childrenIndex)))}var OT=/^:[\w-]+$/,IT=3,BT=2,LT=1,UT=10,zT=-2,d0=n=>n==="*";function PT(n,s){let i=n.split("/"),o=i.length;return i.some(d0)&&(o+=zT),s&&(o+=BT),i.filter(c=>!d0(c)).reduce((c,u)=>c+(OT.test(u)?IT:u===""?LT:UT),o)}function VT(n,s){return n.length===s.length&&n.slice(0,-1).every((o,c)=>o===s[c])?n[n.length-1]-s[s.length-1]:0}function HT(n,s,i=!1){let{routesMeta:o}=n,c={},u="/",d=[];for(let m=0;m<o.length;++m){let h=o[m],g=m===o.length-1,v=u==="/"?s:s.slice(u.length)||"/",b=xr({path:h.relativePath,caseSensitive:h.caseSensitive,end:g},v),_=h.route;if(!b&&g&&i&&!o[o.length-1].route.index&&(b=xr({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),d.push({params:c,pathname:ss([u,b.pathname]),pathnameBase:ZT(ss([u,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(u=ss([u,b.pathnameBase]))}return d}function xr(n,s){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[i,o]=qT(n.path,n.caseSensitive,n.end),c=s.match(i);if(!c)return null;let u=c[0],d=u.replace(/(.)\/+$/,"$1"),m=c.slice(1);return{params:o.reduce((g,{paramName:v,isOptional:b},_)=>{if(v==="*"){let T=m[_]||"";d=u.slice(0,u.length-T.length).replace(/(.)\/+$/,"$1")}const S=m[_];return b&&!S?g[v]=void 0:g[v]=(S||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:d,pattern:n}}function qT(n,s=!1,i=!0){Ln(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let o=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,m,h,g,v)=>{if(o.push({paramName:m,isOptional:h!=null}),h){let b=v.charAt(g+d.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(o.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),o]}function fb(n){try{return n.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Ln(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),n}}function Os(n,s){if(s==="/")return n;if(!n.toLowerCase().startsWith(s.toLowerCase()))return null;let i=s.endsWith("/")?s.length-1:s.length,o=n.charAt(i);return o&&o!=="/"?null:n.slice(i)||"/"}var GT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function $T(n,s="/"){let{pathname:i,search:o="",hash:c=""}=typeof n=="string"?ao(n):n,u;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?u=f0(i.substring(1),"/"):u=f0(i,s)):u=s,{pathname:u,search:KT(o),hash:YT(c)}}function f0(n,s){let i=s.replace(/\/+$/,"").split("/");return n.split("/").forEach(c=>{c===".."?i.length>1&&i.pop():c!=="."&&i.push(c)}),i.length>1?i.join("/"):"/"}function tf(n,s,i,o){return`Cannot include a '${n}' character in a manually specified \`to.${s}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function FT(n){return n.filter((s,i)=>i===0||s.route.path&&s.route.path.length>0)}function fp(n){let s=FT(n);return s.map((i,o)=>o===s.length-1?i.pathname:i.pathnameBase)}function Ac(n,s,i,o=!1){let c;typeof n=="string"?c=ao(n):(c={...n},dt(!c.pathname||!c.pathname.includes("?"),tf("?","pathname","search",c)),dt(!c.pathname||!c.pathname.includes("#"),tf("#","pathname","hash",c)),dt(!c.search||!c.search.includes("#"),tf("#","search","hash",c)));let u=n===""||c.pathname==="",d=u?"/":c.pathname,m;if(d==null)m=i;else{let b=s.length-1;if(!o&&d.startsWith("..")){let _=d.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}m=b>=0?s[b]:"/"}let h=$T(c,m),g=d&&d!=="/"&&d.endsWith("/"),v=(u||d===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(g||v)&&(h.pathname+="/"),h}var ss=n=>n.join("/").replace(/\/\/+/g,"/"),ZT=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),KT=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,YT=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,JT=class{constructor(n,s,i,o=!1){this.status=n,this.statusText=s||"",this.internal=o,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function WT(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function XT(n){return n.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var pb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function mb(n,s){let i=n;if(typeof i!="string"||!GT.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let o=i,c=!1;if(pb)try{let u=new URL(window.location.href),d=i.startsWith("//")?new URL(u.protocol+i):new URL(i),m=Os(d.pathname,s);d.origin===u.origin&&m!=null?i=m+d.search+d.hash:c=!0}catch{Ln(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var hb=["POST","PUT","PATCH","DELETE"];new Set(hb);var QT=["GET",...hb];new Set(QT);var io=y.createContext(null);io.displayName="DataRouter";var Dc=y.createContext(null);Dc.displayName="DataRouterState";var ek=y.createContext(!1),gb=y.createContext({isTransitioning:!1});gb.displayName="ViewTransition";var tk=y.createContext(new Map);tk.displayName="Fetchers";var nk=y.createContext(null);nk.displayName="Await";var Sn=y.createContext(null);Sn.displayName="Navigation";var Cr=y.createContext(null);Cr.displayName="Location";var Un=y.createContext({outlet:null,matches:[],isDataRoute:!1});Un.displayName="Route";var pp=y.createContext(null);pp.displayName="RouteError";var vb="REACT_ROUTER_ERROR",sk="REDIRECT",ak="ROUTE_ERROR_RESPONSE";function ik(n){if(n.startsWith(`${vb}:${sk}:{`))try{let s=JSON.parse(n.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 ok(n){if(n.startsWith(`${vb}:${ak}:{`))try{let s=JSON.parse(n.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new JT(s.status,s.statusText,s.data)}catch{}}function rk(n,{relative:s}={}){dt(Xa(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:o}=y.useContext(Sn),{hash:c,pathname:u,search:d}=Er(n,{relative:s}),m=u;return i!=="/"&&(m=u==="/"?i:ss([i,u])),o.createHref({pathname:m,search:d,hash:c})}function Xa(){return y.useContext(Cr)!=null}function Lt(){return dt(Xa(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(Cr).location}function Mt(n){dt(Xa(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Lt();return y.useMemo(()=>xr(n,fb(s)),[s,n])}var yb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function bb(n){y.useContext(Sn).static||y.useLayoutEffect(n)}function Rc(){let{isDataRoute:n}=y.useContext(Un);return n?Sk():lk()}function lk(){dt(Xa(),"useNavigate() may be used only in the context of a <Router> component.");let n=y.useContext(io),{basename:s,navigator:i}=y.useContext(Sn),{matches:o}=y.useContext(Un),{pathname:c}=Lt(),u=JSON.stringify(fp(o)),d=y.useRef(!1);return bb(()=>{d.current=!0}),y.useCallback((h,g={})=>{if(Ln(d.current,yb),!d.current)return;if(typeof h=="number"){i.go(h);return}let v=Ac(h,JSON.parse(u),c,g.relative==="path");n==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:ss([s,v.pathname])),(g.replace?i.replace:i.push)(v,g.state,g)},[s,i,u,c,n])}var ck=y.createContext(null);function uk(n){let s=y.useContext(Un).outlet;return y.useMemo(()=>s&&y.createElement(ck.Provider,{value:n},s),[s,n])}function va(){let{matches:n}=y.useContext(Un),s=n[n.length-1];return s?s.params:{}}function Er(n,{relative:s}={}){let{matches:i}=y.useContext(Un),{pathname:o}=Lt(),c=JSON.stringify(fp(i));return y.useMemo(()=>Ac(n,JSON.parse(c),o,s==="path"),[n,c,o,s])}function dk(n,s){return _b(n,s)}function _b(n,s,i){var j;dt(Xa(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=y.useContext(Sn),{matches:c}=y.useContext(Un),u=c[c.length-1],d=u?u.params:{},m=u?u.pathname:"/",h=u?u.pathnameBase:"/",g=u&&u.route;{let w=g&&g.path||"";Sb(m,!g||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${w}">) 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.
|
|
36
|
-
|
|
37
|
-
Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let v=Lt(),b;if(s){let w=typeof s=="string"?ao(s):s;dt(h==="/"||((j=w.pathname)==null?void 0:j.startsWith(h)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${w.pathname}" was given in the \`location\` prop.`),b=w}else b=v;let _=b.pathname||"/",S=_;if(h!=="/"){let w=h.replace(/^\//,"").split("/");S="/"+_.replace(/^\//,"").split("/").slice(w.length).join("/")}let T=cb(n,{pathname:S});Ln(g||T!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Ln(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.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 N=gk(T&&T.map(w=>Object.assign({},w,{params:Object.assign({},d,w.params),pathname:ss([h,o.encodeLocation?o.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?h:ss([h,o.encodeLocation?o.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),c,i);return s&&N?y.createElement(Cr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},N):N}function fk(){let n=xk(),s=WT(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),i=n instanceof Error?n.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},u={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",n),d=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:u},"ErrorBoundary")," or"," ",y.createElement("code",{style:u},"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,d)}var pk=y.createElement(fk,null),xb=class extends y.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,s){return s.location!==n.location||s.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:s.error,location:s.location,revalidation:n.revalidation||s.revalidation}}componentDidCatch(n,s){this.props.onError?this.props.onError(n,s):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const i=ok(n.digest);i&&(n=i)}let s=n!==void 0?y.createElement(Un.Provider,{value:this.props.routeContext},y.createElement(pp.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?y.createElement(mk,{error:n},s):s}};xb.contextType=ek;var nf=new WeakMap;function mk({children:n,error:s}){let{basename:i}=y.useContext(Sn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let o=ik(s.digest);if(o){let c=nf.get(s);if(c)throw c;let u=mb(o.location,i);if(pb&&!nf.get(s))if(u.isExternal||o.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:o.replace}));throw nf.set(s,d),d}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return n}function hk({routeContext:n,match:s,children:i}){let o=y.useContext(io);return o&&o.static&&o.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(Un.Provider,{value:n},i)}function gk(n,s=[],i){let o=i==null?void 0:i.state;if(n==null){if(!o)return null;if(o.errors)n=o.matches;else if(s.length===0&&!o.initialized&&o.matches.length>0)n=o.matches;else return null}let c=n,u=o==null?void 0:o.errors;if(u!=null){let v=c.findIndex(b=>b.route.id&&(u==null?void 0:u[b.route.id])!==void 0);dt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let d=!1,m=-1;if(i&&o){d=o.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(m=v),b.route.id){let{loaderData:_,errors:S}=o,T=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!S||S[b.route.id]===void 0);if(b.route.lazy||T){i.isStatic&&(d=!0),m>=0?c=c.slice(0,m+1):c=[c[0]];break}}}}let h=i==null?void 0:i.onError,g=o&&h?(v,b)=>{var _,S;h(v,{location:o.location,params:((S=(_=o.matches)==null?void 0:_[0])==null?void 0:S.params)??{},unstable_pattern:XT(o.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,_)=>{let S,T=!1,N=null,j=null;o&&(S=u&&b.route.id?u[b.route.id]:void 0,N=b.route.errorElement||pk,d&&(m<0&&_===0?(Sb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,j=null):m===_&&(T=!0,j=b.route.hydrateFallbackElement||null)));let w=s.concat(c.slice(0,_+1)),C=()=>{let A;return S?A=N:T?A=j:b.route.Component?A=y.createElement(b.route.Component,null):b.route.element?A=b.route.element:A=v,y.createElement(hk,{match:b,routeContext:{outlet:v,matches:w,isDataRoute:o!=null},children:A})};return o&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement(xb,{location:o.location,revalidation:o.revalidation,component:N,error:S,children:C(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:g}):C()},null)}function mp(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vk(n){let s=y.useContext(io);return dt(s,mp(n)),s}function yk(n){let s=y.useContext(Dc);return dt(s,mp(n)),s}function bk(n){let s=y.useContext(Un);return dt(s,mp(n)),s}function hp(n){let s=bk(n),i=s.matches[s.matches.length-1];return dt(i.route.id,`${n} can only be used on routes that contain a unique "id"`),i.route.id}function _k(){return hp("useRouteId")}function xk(){var o;let n=y.useContext(pp),s=yk("useRouteError"),i=hp("useRouteError");return n!==void 0?n:(o=s.errors)==null?void 0:o[i]}function Sk(){let{router:n}=vk("useNavigate"),s=hp("useNavigate"),i=y.useRef(!1);return bb(()=>{i.current=!0}),y.useCallback(async(c,u={})=>{Ln(i.current,yb),i.current&&(typeof c=="number"?await n.navigate(c):await n.navigate(c,{fromRouteId:s,...u}))},[n,s])}var p0={};function Sb(n,s,i){!s&&!p0[n]&&(p0[n]=!0,Ln(!1,i))}y.memo(Tk);function Tk({routes:n,future:s,state:i,isStatic:o,onError:c}){return _b(n,void 0,{state:i,isStatic:o,onError:c})}function Kn({to:n,replace:s,state:i,relative:o}){dt(Xa(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Sn);Ln(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:u}=y.useContext(Un),{pathname:d}=Lt(),m=Rc(),h=Ac(n,fp(u),d,o==="path"),g=JSON.stringify(h);return y.useEffect(()=>{m(JSON.parse(g),{replace:s,state:i,relative:o})},[m,g,o,s,i]),null}function Qa(n){return uk(n.context)}function je(n){dt(!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 kk({basename:n="/",children:s=null,location:i,navigationType:o="POP",navigator:c,static:u=!1,unstable_useTransitions:d}){dt(!Xa(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let m=n.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:m,navigator:c,static:u,unstable_useTransitions:d,future:{}}),[m,c,u,d]);typeof i=="string"&&(i=ao(i));let{pathname:g="/",search:v="",hash:b="",state:_=null,key:S="default",unstable_mask:T}=i,N=y.useMemo(()=>{let j=Os(g,m);return j==null?null:{location:{pathname:j,search:v,hash:b,state:_,key:S,unstable_mask:T},navigationType:o}},[m,g,v,b,_,S,o,T]);return Ln(N!=null,`<Router basename="${m}"> 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.`),N==null?null:y.createElement(Sn.Provider,{value:h},y.createElement(Cr.Provider,{children:s,value:N}))}function wk({children:n,location:s}){return dk(Uf(n),s)}function Uf(n,s=[]){let i=[];return y.Children.forEach(n,(o,c)=>{if(!y.isValidElement(o))return;let u=[...s,c];if(o.type===y.Fragment){i.push.apply(i,Uf(o.props.children,u));return}dt(o.type===je,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),dt(!o.props.index||!o.props.children,"An index route cannot have child routes.");let d={id:o.props.id||u.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(d.children=Uf(o.props.children,u)),i.push(d)}),i}var uc="get",dc="application/x-www-form-urlencoded";function Mc(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function Nk(n){return Mc(n)&&n.tagName.toLowerCase()==="button"}function jk(n){return Mc(n)&&n.tagName.toLowerCase()==="form"}function Ck(n){return Mc(n)&&n.tagName.toLowerCase()==="input"}function Ek(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Ak(n,s){return n.button===0&&(!s||s==="_self")&&!Ek(n)}function zf(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((s,i)=>{let o=n[i];return s.concat(Array.isArray(o)?o.map(c=>[i,c]):[[i,o]])},[]))}function Dk(n,s){let i=zf(n);return s&&s.forEach((o,c)=>{i.has(c)||s.getAll(c).forEach(u=>{i.append(c,u)})}),i}var Xl=null;function Rk(){if(Xl===null)try{new FormData(document.createElement("form"),0),Xl=!1}catch{Xl=!0}return Xl}var Mk=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function sf(n){return n!=null&&!Mk.has(n)?(Ln(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${dc}"`),null):n}function Ok(n,s){let i,o,c,u,d;if(jk(n)){let m=n.getAttribute("action");o=m?Os(m,s):null,i=n.getAttribute("method")||uc,c=sf(n.getAttribute("enctype"))||dc,u=new FormData(n)}else if(Nk(n)||Ck(n)&&(n.type==="submit"||n.type==="image")){let m=n.form;if(m==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=n.getAttribute("formaction")||m.getAttribute("action");if(o=h?Os(h,s):null,i=n.getAttribute("formmethod")||m.getAttribute("method")||uc,c=sf(n.getAttribute("formenctype"))||sf(m.getAttribute("enctype"))||dc,u=new FormData(m,n),!Rk()){let{name:g,type:v,value:b}=n;if(v==="image"){let _=g?`${g}.`:"";u.append(`${_}x`,"0"),u.append(`${_}y`,"0")}else g&&u.append(g,b)}}else{if(Mc(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=uc,o=null,c=dc,d=n}return u&&c==="text/plain"&&(d=u,u=void 0),{action:o,method:i.toLowerCase(),encType:c,formData:u,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function gp(n,s){if(n===!1||n===null||typeof n>"u")throw new Error(s)}function Ik(n,s,i,o){let c=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return i?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:s&&Os(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function Bk(n,s){if(n.id in s)return s[n.id];try{let i=await import(n.module);return s[n.id]=i,i}catch(i){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Lk(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function Uk(n,s,i){let o=await Promise.all(n.map(async c=>{let u=s.routes[c.route.id];if(u){let d=await Bk(u,i);return d.links?d.links():[]}return[]}));return Hk(o.flat(1).filter(Lk).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function m0(n,s,i,o,c,u){let d=(h,g)=>i[g]?h.route.id!==i[g].route.id:!0,m=(h,g)=>{var v;return i[g].pathname!==h.pathname||((v=i[g].route.path)==null?void 0:v.endsWith("*"))&&i[g].params["*"]!==h.params["*"]};return u==="assets"?s.filter((h,g)=>d(h,g)||m(h,g)):u==="data"?s.filter((h,g)=>{var b;let v=o.routes[h.route.id];if(!v||!v.hasLoader)return!1;if(d(h,g)||m(h,g))return!0;if(h.route.shouldRevalidate){let _=h.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(n,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function zk(n,s,{includeHydrateFallback:i}={}){return Pk(n.map(o=>{let c=s.routes[o.route.id];if(!c)return[];let u=[c.module];return c.clientActionModule&&(u=u.concat(c.clientActionModule)),c.clientLoaderModule&&(u=u.concat(c.clientLoaderModule)),i&&c.hydrateFallbackModule&&(u=u.concat(c.hydrateFallbackModule)),c.imports&&(u=u.concat(c.imports)),u}).flat(1))}function Pk(n){return[...new Set(n)]}function Vk(n){let s={},i=Object.keys(n).sort();for(let o of i)s[o]=n[o];return s}function Hk(n,s){let i=new Set;return new Set(s),n.reduce((o,c)=>{let u=JSON.stringify(Vk(c));return i.has(u)||(i.add(u),o.push({key:u,link:c})),o},[])}function Tb(){let n=y.useContext(io);return gp(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function qk(){let n=y.useContext(Dc);return gp(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var vp=y.createContext(void 0);vp.displayName="FrameworkContext";function kb(){let n=y.useContext(vp);return gp(n,"You must render this element inside a <HydratedRouter> element"),n}function Gk(n,s){let i=y.useContext(vp),[o,c]=y.useState(!1),[u,d]=y.useState(!1),{onFocus:m,onBlur:h,onMouseEnter:g,onMouseLeave:v,onTouchStart:b}=s,_=y.useRef(null);y.useEffect(()=>{if(n==="render"&&d(!0),n==="viewport"){let N=w=>{w.forEach(C=>{d(C.isIntersecting)})},j=new IntersectionObserver(N,{threshold:.5});return _.current&&j.observe(_.current),()=>{j.disconnect()}}},[n]),y.useEffect(()=>{if(o){let N=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(N)}}},[o]);let S=()=>{c(!0)},T=()=>{c(!1),d(!1)};return i?n!=="intent"?[u,_,{}]:[u,_,{onFocus:ar(m,S),onBlur:ar(h,T),onMouseEnter:ar(g,S),onMouseLeave:ar(v,T),onTouchStart:ar(b,S)}]:[!1,_,{}]}function ar(n,s){return i=>{n&&n(i),i.defaultPrevented||s(i)}}function $k({page:n,...s}){let{router:i}=Tb(),o=y.useMemo(()=>cb(i.routes,n,i.basename),[i.routes,n,i.basename]);return o?y.createElement(Zk,{page:n,matches:o,...s}):null}function Fk(n){let{manifest:s,routeModules:i}=kb(),[o,c]=y.useState([]);return y.useEffect(()=>{let u=!1;return Uk(n,s,i).then(d=>{u||c(d)}),()=>{u=!0}},[n,s,i]),o}function Zk({page:n,matches:s,...i}){let o=Lt(),{future:c,manifest:u,routeModules:d}=kb(),{basename:m}=Tb(),{loaderData:h,matches:g}=qk(),v=y.useMemo(()=>m0(n,s,g,u,o,"data"),[n,s,g,u,o]),b=y.useMemo(()=>m0(n,s,g,u,o,"assets"),[n,s,g,u,o]),_=y.useMemo(()=>{if(n===o.pathname+o.search+o.hash)return[];let N=new Set,j=!1;if(s.forEach(C=>{var M;let A=u.routes[C.route.id];!A||!A.hasLoader||(!v.some(D=>D.route.id===C.route.id)&&C.route.id in h&&((M=d[C.route.id])!=null&&M.shouldRevalidate)||A.hasClientLoader?j=!0:N.add(C.route.id))}),N.size===0)return[];let w=Ik(n,m,c.unstable_trailingSlashAwareDataRequests,"data");return j&&N.size>0&&w.searchParams.set("_routes",s.filter(C=>N.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[m,c.unstable_trailingSlashAwareDataRequests,h,o,u,v,s,n,d]),S=y.useMemo(()=>zk(b,u),[b,u]),T=Fk(b);return y.createElement(y.Fragment,null,_.map(N=>y.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...i})),S.map(N=>y.createElement("link",{key:N,rel:"modulepreload",href:N,...i})),T.map(({key:N,link:j})=>y.createElement("link",{key:N,nonce:i.nonce,...j,crossOrigin:j.crossOrigin??i.crossOrigin})))}function Kk(...n){return s=>{n.forEach(i=>{typeof i=="function"?i(s):i!=null&&(i.current=s)})}}var Yk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Yk&&(window.__reactRouterVersion="7.13.2")}catch{}function Jk({basename:n,children:s,unstable_useTransitions:i,window:o}){let c=y.useRef();c.current==null&&(c.current=CT({window:o,v5Compat:!0}));let u=c.current,[d,m]=y.useState({action:u.action,location:u.location}),h=y.useCallback(g=>{i===!1?m(g):y.startTransition(()=>m(g))},[i]);return y.useLayoutEffect(()=>u.listen(h),[u,h]),y.createElement(kk,{basename:n,children:s,location:d.location,navigationType:d.action,navigator:u,unstable_useTransitions:i})}var wb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yp=y.forwardRef(function({onClick:s,discover:i="render",prefetch:o="none",relative:c,reloadDocument:u,replace:d,unstable_mask:m,state:h,target:g,to:v,preventScrollReset:b,viewTransition:_,unstable_defaultShouldRevalidate:S,...T},N){let{basename:j,navigator:w,unstable_useTransitions:C}=y.useContext(Sn),A=typeof v=="string"&&wb.test(v),M=mb(v,j);v=M.to;let D=rk(v,{relative:c}),E=Lt(),H=null;if(m){let X=Ac(m,[],E.unstable_mask?E.unstable_mask.pathname:"/",!0);j!=="/"&&(X.pathname=X.pathname==="/"?j:ss([j,X.pathname])),H=w.createHref(X)}let[z,Z,F]=Gk(o,T),Q=e2(v,{replace:d,unstable_mask:m,state:h,target:g,preventScrollReset:b,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:S,unstable_useTransitions:C});function ae(X){s&&s(X),X.defaultPrevented||Q(X)}let pe=!(M.isExternal||u),oe=y.createElement("a",{...T,...F,href:(pe?H:void 0)||M.absoluteURL||D,onClick:pe?ae:s,ref:Kk(N,Z),target:g,"data-discover":!A&&i==="render"?"true":void 0});return z&&!A?y.createElement(y.Fragment,null,oe,y.createElement($k,{page:D})):oe});yp.displayName="Link";var Wk=y.forwardRef(function({"aria-current":s="page",caseSensitive:i=!1,className:o="",end:c=!1,style:u,to:d,viewTransition:m,children:h,...g},v){let b=Er(d,{relative:g.relative}),_=Lt(),S=y.useContext(Dc),{navigator:T,basename:N}=y.useContext(Sn),j=S!=null&&i2(b)&&m===!0,w=T.encodeLocation?T.encodeLocation(b).pathname:b.pathname,C=_.pathname,A=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;i||(C=C.toLowerCase(),A=A?A.toLowerCase():null,w=w.toLowerCase()),A&&N&&(A=Os(A,N)||A);const M=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let D=C===w||!c&&C.startsWith(w)&&C.charAt(M)==="/",E=A!=null&&(A===w||!c&&A.startsWith(w)&&A.charAt(w.length)==="/"),H={isActive:D,isPending:E,isTransitioning:j},z=D?s:void 0,Z;typeof o=="function"?Z=o(H):Z=[o,D?"active":null,E?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let F=typeof u=="function"?u(H):u;return y.createElement(yp,{...g,"aria-current":z,className:Z,ref:v,style:F,to:d,viewTransition:m},typeof h=="function"?h(H):h)});Wk.displayName="NavLink";var Xk=y.forwardRef(({discover:n="render",fetcherKey:s,navigate:i,reloadDocument:o,replace:c,state:u,method:d=uc,action:m,onSubmit:h,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_,...S},T)=>{let{unstable_useTransitions:N}=y.useContext(Sn),j=s2(),w=a2(m,{relative:g}),C=d.toLowerCase()==="get"?"get":"post",A=typeof m=="string"&&wb.test(m),M=D=>{if(h&&h(D),D.defaultPrevented)return;D.preventDefault();let E=D.nativeEvent.submitter,H=(E==null?void 0:E.getAttribute("formmethod"))||d,z=()=>j(E||D.currentTarget,{fetcherKey:s,method:H,navigate:i,replace:c,state:u,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_});N&&i!==!1?y.startTransition(()=>z()):z()};return y.createElement("form",{ref:T,method:C,action:w,onSubmit:o?h:M,...S,"data-discover":!A&&n==="render"?"true":void 0})});Xk.displayName="Form";function Qk(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Nb(n){let s=y.useContext(io);return dt(s,Qk(n)),s}function e2(n,{target:s,replace:i,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:m,unstable_defaultShouldRevalidate:h,unstable_useTransitions:g}={}){let v=Rc(),b=Lt(),_=Er(n,{relative:d});return y.useCallback(S=>{if(Ak(S,s)){S.preventDefault();let T=i!==void 0?i:_r(b)===_r(_),N=()=>v(n,{replace:T,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:m,unstable_defaultShouldRevalidate:h});g?y.startTransition(()=>N()):N()}},[b,v,_,i,o,c,s,n,u,d,m,h,g])}function bp(n){Ln(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(zf(n)),i=y.useRef(!1),o=Lt(),c=y.useMemo(()=>Dk(o.search,i.current?null:s.current),[o.search]),u=Rc(),d=y.useCallback((m,h)=>{const g=zf(typeof m=="function"?m(new URLSearchParams(c)):m);i.current=!0,u("?"+g,h)},[u,c]);return[c,d]}var t2=0,n2=()=>`__${String(++t2)}__`;function s2(){let{router:n}=Nb("useSubmit"),{basename:s}=y.useContext(Sn),i=_k(),o=n.fetch,c=n.navigate;return y.useCallback(async(u,d={})=>{let{action:m,method:h,encType:g,formData:v,body:b}=Ok(u,s);if(d.navigate===!1){let _=d.fetcherKey||n2();await o(_,i,d.action||m,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:b,formMethod:d.method||h,formEncType:d.encType||g,flushSync:d.flushSync})}else await c(d.action||m,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:b,formMethod:d.method||h,formEncType:d.encType||g,replace:d.replace,state:d.state,fromRouteId:i,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,c,s,i])}function a2(n,{relative:s}={}){let{basename:i}=y.useContext(Sn),o=y.useContext(Un);dt(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),u={...Er(n||".",{relative:s})},d=Lt();if(n==null){u.search=d.search;let m=new URLSearchParams(u.search),h=m.getAll("index");if(h.some(v=>v==="")){m.delete("index"),h.filter(b=>b).forEach(b=>m.append("index",b));let v=m.toString();u.search=v?`?${v}`:""}}return(!n||n===".")&&c.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(u.pathname=u.pathname==="/"?i:ss([i,u.pathname])),_r(u)}function i2(n,{relative:s}={}){let i=y.useContext(gb);dt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=Nb("useViewTransitionState"),c=Er(n,{relative:s});if(!i.isTransitioning)return!1;let u=Os(i.currentLocation.pathname,o)||i.currentLocation.pathname,d=Os(i.nextLocation.pathname,o)||i.nextLocation.pathname;return xr(c.pathname,d)!=null||xr(c.pathname,u)!=null}function St(){const n=Rc();return y.useCallback((s,i)=>{typeof s=="number"?n(s):n(s,i)},[n])}function jb(n){return`/sessions/${encodeURIComponent(n)}`}function Wi(n,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(n)}`:`/workspaces/${encodeURIComponent(n)}`}function os(n,s,i,o){const c=encodeURIComponent(n);let u;return i&&o?u=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(i)}/tasks/${c}`:i?u=`/workspaces/${encodeURIComponent(i)}/tasks/${c}`:u=`/tasks/${c}`,s?`${u}/${s}`:u}function ei(n,s,i){const o=new URLSearchParams;n&&o.set("workspace",n),s&&o.set("parent",s);const c=o.toString();if(n&&i){const u=`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(n)}/tasks/new`;return s?`${u}?parent=${encodeURIComponent(s)}`:u}return c?`/tasks/new?${c}`:"/tasks/new"}function Cb(n){return`/sessions/new?${new URLSearchParams({env:n}).toString()}`}const Xi="/environments",o2="/environments/new";function Qi(n){return`/environments/${encodeURIComponent(n)}`}function r2(n){return`/environments/${encodeURIComponent(n)}/edit`}const Ji="/settings",l2="/settings/credentials",af="/settings/personas",c2="/settings/personas/new";function Eb(n){return`/settings/personas/${encodeURIComponent(n)}`}const u2="/settings/shortcuts",d2="/pair",f2="/chat",Ya="/",p2="/tasks",Ab="/workspaces/new",Db="/knowledge",m2=3e3;function h2(n){const[s,i]=y.useState(!1),o=y.useRef(n.onSessionEvent);o.current=n.onSessionEvent;const c=y.useRef(n.onDomainEvent);c.current=n.onDomainEvent;const u=y.useRef(n.onConnect);u.current=n.onConnect;const d=y.useRef(n.onDisconnect);return d.current=n.onDisconnect,y.useEffect(()=>{let m=!1,h;async function g(){var v,b;if(!m){try{const _=ke.streamEvents({});i(!0),(v=u.current)==null||v.call(u);for await(const S of _){if(m)break;const T=S.event;if(T.case==="sessionEvent"){const N=T.value;o.current({sessionId:N.sessionId,type:N.type,timestamp:N.timestamp,content:N.content,raw:N.raw})}else if(T.case==="domainEvent"){const N=T.value;c.current({id:N.id,type:N.type,timestamp:N.timestamp,payloadJson:N.payloadJson})}}}catch(_){if(_ instanceof Ec&&_.code===cT.Unauthenticated){window.location.href=d2;return}}m||(i(!1),(b=d.current)==null||b.call(d),h=setTimeout(()=>{g().catch(()=>{})},m2))}}return g().catch(()=>{}),()=>{m=!0,clearTimeout(h),i(!1)}},[]),{connected:s}}function Rb(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function Mb(n,s){return console.warn(`[ws] Malformed "${n}" message: ${s}`),!1}function g2(n){return Rb(n)&&typeof n.sessionId=="string"&&typeof n.eventType=="string"&&typeof n.timestamp=="string"&&typeof n.content=="string"&&(n.raw===void 0||typeof n.raw=="string")}const v2=new Set(["off","subscription","api_key"]),Ql=new Set(["off","on"]);function y2(n){return Rb(n)&&v2.has(n.claude)&&Ql.has(n.github)&&Ql.has(n.copilot)&&Ql.has(n.codex)&&Ql.has(n.goose)}function Ob(n){switch(n){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 n}}function Ib(n){switch(n){case"completed":return"completed";case"killed":return"killed";case"failed":return"interrupted";case"interrupted":return"interrupted";case"terminated":return"terminated";default:return}}const Vi=5e3;function b2(n){return{id:n.id,displayName:n.displayName,adapterType:n.adapterType,adapterConfig:n.adapterConfig||"{}",status:n.status,bootstrapped:n.bootstrapped}}function h0(n){return{id:n.id,environmentId:n.environmentId,runtime:n.runtime,status:n.status,prompt:n.prompt,startedAt:n.startedAt,endedAt:n.endedAt||void 0,error:n.error||void 0,endReason:n.endReason||void 0,personaId:n.personaId||void 0,inputTokens:n.inputTokens,outputTokens:n.outputTokens,costUsd:n.costUsd}}function _2(n){return{sessionId:n.sessionId,eventType:ob(n.type),timestamp:n.timestamp,content:n.content,raw:n.raw||void 0}}function x2(n){return{id:n.id,name:n.name,description:n.description,repoUrl:n.repoUrl,environmentId:n.environmentId,status:uT(n.status),workingDirectory:n.workingDirectory,useWorktrees:n.useWorktrees,defaultPersonaId:n.defaultPersonaId,createdAt:n.createdAt,updatedAt:n.updatedAt}}function g0(n){return{id:n.id,workspaceId:n.workspaceId??void 0,title:n.title,description:n.description,status:dT(n.status),branch:n.branch,latestSessionId:n.latestSessionId,dependsOn:[...n.dependsOn],sortOrder:n.sortOrder,createdAt:n.createdAt,startedAt:n.startedAt||void 0,completedAt:n.completedAt||void 0,parentTaskId:n.parentTaskId,depth:n.depth,childTaskIds:[...n.childTaskIds],canDecompose:n.canDecompose,defaultPersonaId:n.defaultPersonaId,workpad:n.workpad}}function S2(n){return{id:n.id,workspaceId:n.workspaceId,taskId:n.taskId,sessionId:n.sessionId,category:n.category,title:n.title,content:n.content,tags:[...n.tags],createdAt:n.createdAt}}function T2(n){return{name:n.name,tokenType:n.type,envVar:n.envVar,filePath:n.filePath,expiresAt:n.expiresAt}}function k2(n){return{claude:fT(n.claude),github:Wl(n.github),copilot:Wl(n.copilot),codex:Wl(n.codex),goose:Wl(n.goose)}}function w2(n){return{name:n.name,repository:n.repository,state:n.state,gitStatus:n.gitStatus}}function of(n){return{id:n.id,name:n.name,description:n.description,systemPrompt:n.systemPrompt,toolConfig:n.toolConfig?JSON.stringify({allowedTools:[...n.toolConfig.allowedTools],disallowedTools:[...n.toolConfig.disallowedTools]}):"{}",runtime:n.runtime,model:n.model,maxTurns:n.maxTurns,mcpServers:JSON.stringify(n.mcpServers.map(s=>({name:s.name,command:s.command,args:[...s.args],tools:[...s.tools]}))),createdAt:n.createdAt,updatedAt:n.updatedAt,type:n.type||"agent",script:n.script,allowedMcpTools:[...n.allowedMcpTools]}}function N2(n){return{inputTokens:n.inputTokens,outputTokens:n.outputTokens,costUsd:n.costUsd,sessionCount:n.sessionCount}}function ec(n,s=0){return{id:n.id,label:n.title||n.label||n.id,kind:n.kind,category:n.category||void 0,sourceType:n.sourceType||void 0,sourceId:n.sourceId||void 0,content:n.content||void 0,tags:n.tags.length>0?[...n.tags]:void 0,workspaceId:n.workspaceId||void 0,createdAt:n.createdAt||void 0,updatedAt:n.updatedAt||void 0,val:s}}function rf(n){return{source:n.fromId,target:n.toId,type:n.type}}const v0=5e3;function j2(){const[n,s]=y.useState([]),[i,o]=y.useState({}),c=y.useCallback(()=>{ke.listEnvironments({}).then(_=>{s(_.environments.map(b2))},()=>{})},[]),u=y.useCallback(_=>{switch(_.type){case"environment.added":return!0;case"environment.removed":{const S=_.payload.environmentId;return S&&(s(T=>T.filter(N=>N.id!==S)),o(T=>{const N={...T};return delete N[S],N})),!0}case"environment.changed":return c(),!0;case"environment.provision_progress":{const S=_.payload;if(typeof S.environmentId!="string"||typeof S.stage!="string"||typeof S.message!="string"||typeof S.progress!="number")return Mb("environment.provision_progress","invalid payload"),!0;if(o(T=>({...T,[S.environmentId]:{stage:S.stage,message:S.message,progress:S.progress}})),S.stage==="ready"){const T=S.environmentId;setTimeout(()=>{o(N=>{const j={...N};return delete j[T],j})},v0)}return!0}default:return!1}},[c]),d=y.useCallback(_=>{var S;if(_.type==="environments"){const T=Array.isArray((S=_.payload)==null?void 0:S.environments)?_.payload.environments:[];return s(T),!0}return!1},[]),m=y.useCallback((_,S,T)=>{ke.addEnvironment({displayName:_,adapterType:S,adapterConfig:JSON.stringify(T??{})}).catch(()=>{})},[]),h=y.useCallback((_,S)=>{ke.updateEnvironment({id:_,displayName:S.displayName,adapterConfig:S.adapterConfig?JSON.stringify(S.adapterConfig):void 0}).catch(()=>{})},[]),g=y.useCallback((_,S)=>{(async()=>{try{const N=ke.provisionEnvironment({id:_,force:S??!1});for await(const j of N)o(w=>({...w,[_]:{stage:j.stage,message:j.message,progress:j.progress}})),j.stage==="ready"&&setTimeout(()=>{o(w=>{const C={...w};return delete C[_],C})},v0)}catch{o(N=>{const j={...N};return delete j[_],j})}})().catch(()=>{})},[]),v=y.useCallback(_=>{ke.stopEnvironment({id:_}).catch(()=>{})},[]),b=y.useCallback(_=>{ke.removeEnvironment({id:_}).catch(()=>{})},[]);return{environments:n,provisionStatus:i,loadEnvironments:c,addEnvironment:m,updateEnvironment:h,provisionEnvironment:g,stopEnvironment:v,removeEnvironment:b,handleEvent:u,handleLegacyMessage:d}}const lf=new Set(["pending","running","idle"]),C2=new Set(["completed","failed","interrupted","hibernating","suspended"]),y0=["pending","running","idle"];function E2(){const[n,s]=y.useState([]),[i,o]=y.useState([]),[c,u]=y.useState(0),[d,m]=y.useState(void 0),[h,g]=y.useState({}),v=y.useCallback(()=>{ke.listSessions({}).then(D=>{const E=D.sessions.map(h0);s(H=>{const z=new Map(H.map(Z=>[Z.id,Z]));return E.map(Z=>{const F=z.get(Z.id),Q=F==null?void 0:F.status;return!Q||Q===Z.status?Z:C2.has(Q)&&lf.has(Z.status)?{...Z,status:Q,...F.endReason!==void 0?{endReason:F.endReason}:{}}:lf.has(Q)&&lf.has(Z.status)&&y0.indexOf(Q)>y0.indexOf(Z.status)?{...Z,status:Q}:Z})})},()=>{})},[]),b=y.useCallback(D=>{if(D.type!=="session_event")return!1;if(!g2(D.payload))return Mb("session_event","payload is not a valid SessionEvent"),!0;const E=D.payload;let H=0;if(o(z=>{const Z=[...z,E];return Z.length>Vi?(H=Z.length-Vi,Z.slice(-Vi)):Z}),H>0&&u(z=>z+H),E.eventType==="usage")try{const z=JSON.parse(E.content),Z=Number(z.input_tokens)||0,F=Number(z.output_tokens)||0,Q=Number(z.cost_usd)||0;(Z>0||F>0||Q>0)&&s(ae=>ae.map(pe=>pe.id===E.sessionId?{...pe,inputTokens:(pe.inputTokens??0)+Z,outputTokens:(pe.outputTokens??0)+F,costUsd:(pe.costUsd??0)+Q}:pe))}catch{}if(E.eventType==="status"){const z=Ob(E.content),Z=Ib(E.content);s(F=>F.some(ae=>ae.id===E.sessionId)?F.map(ae=>ae.id===E.sessionId?{...ae,status:z,...Z!==void 0?{endReason:Z}:{}}:ae):[...F,{id:E.sessionId,environmentId:"",runtime:"",status:z,prompt:"",startedAt:E.timestamp,...Z!==void 0?{endReason:Z}:{}}])}return!0},[]),_=y.useCallback(D=>{b({type:"session_event",payload:D})},[b]),S=y.useCallback(D=>{var E,H,z,Z,F;switch(D.type){case"sessions":{const Q=Array.isArray((E=D.payload)==null?void 0:E.sessions)?D.payload.sessions:[];return s(Q),!0}case"spawned":{const Q=(H=D.payload)==null?void 0:H.sessionId;return typeof Q=="string"&&Q&&m(Q),v(),!0}case"session_events":{const Q=Array.isArray((z=D.payload)==null?void 0:z.events)?D.payload.events:[];return Q.length>0&&o(Q),!0}case"task_sessions":{const Q=(Z=D.payload)==null?void 0:Z.taskId;if(typeof Q=="string"&&Q){const ae=Array.isArray((F=D.payload)==null?void 0:F.sessions)?D.payload.sessions:[];g(pe=>({...pe,[Q]:ae}))}return!0}default:return!1}},[v]),T=y.useCallback((D,E,H,z)=>{ke.spawnAgent({environmentId:D,prompt:E,personaId:H||"",workingDirectory:z||""}).then(Z=>{m(Z.id),v()},()=>{})},[v]),N=y.useCallback((D,E)=>{ke.sendInput({sessionId:D,text:E}).catch(()=>{})},[]),j=y.useCallback(D=>{ke.killAgent({id:D,graceful:!1}).catch(()=>{})},[]),w=y.useCallback(D=>{ke.killAgent({id:D,graceful:!0}).catch(()=>{})},[]),C=y.useCallback(D=>{ke.getSessionEvents({id:D}).then(E=>{const H=E.events.map(_2);if(H.length>0){let z=0;o(Z=>{const F=new Set;for(const pe of Z)pe.sessionId===D&&F.add(`${pe.timestamp}|${pe.eventType}`);const Q=H.filter(pe=>!F.has(`${pe.timestamp}|${pe.eventType}`)),ae=[...Z,...Q].sort((pe,oe)=>pe.sessionId!==oe.sessionId?0:pe.timestamp.localeCompare(oe.timestamp));return ae.length>Vi?(z=ae.length-Vi,ae.slice(-Vi)):ae}),z>0&&u(Z=>Z+z)}},()=>{})},[]),A=y.useCallback(()=>{o([]),u(0)},[]),M=y.useCallback(D=>{ke.getTaskSessions({id:D}).then(E=>{const H=E.sessions.map(h0);g(z=>({...z,[D]:H}))},()=>{})},[]);return{sessions:n,events:i,eventsDropped:c,lastSpawnedId:d,taskSessions:h,loadSessions:v,spawn:T,sendInput:N,kill:j,stopGraceful:w,loadSessionEvents:C,clearEvents:A,loadTaskSessions:M,handleMessage:b,handleSessionEvent:_,handleLegacyMessage:S}}function A2(){const[n,s]=y.useState([]),[i,o]=y.useState(!1),c=y.useCallback(()=>{ke.listWorkspaces({}).then(v=>{s(v.workspaces.map(x2))},()=>{})},[]),u=y.useCallback(v=>{switch(v.type){case"workspace.created":return o(!1),c(),!0;case"workspace.archived":case"workspace.updated":return c(),!0;default:return!1}},[c]),d=y.useCallback(()=>{o(!1)},[]),m=y.useCallback((v,b,_,S,T,N,j,w,C)=>{o(!0),ke.createWorkspace({name:v,description:b||"",repoUrl:_||"",environmentId:S||"",defaultPersonaId:T||void 0,useWorktrees:N??!0,workingDirectory:j||void 0}).then(()=>{o(!1),w==null||w()},A=>{o(!1);const M=A instanceof Ec?A.message:"Failed to create workspace";C==null||C(M)})},[]),h=y.useCallback(v=>{ke.archiveWorkspace({id:v}).catch(()=>{})},[]),g=y.useCallback((v,b)=>{ke.updateWorkspace({id:v,...b}).catch(()=>{})},[]);return{workspaces:n,workspaceCreating:i,loadWorkspaces:c,createWorkspace:m,archiveWorkspace:h,updateWorkspace:g,handleEvent:u,onDisconnect:d}}function D2(){const[n,s]=y.useState([]),[i,o]=y.useState(void 0),c=y.useRef({}),u=y.useCallback(C=>{ke.listTasks({workspaceId:C}).then(A=>{const M=A.tasks.map(g0);s(D=>[...D.filter(E=>E.workspaceId!==C),...M])},()=>{})},[]),d=y.useCallback(()=>{ke.listTasks({}).then(C=>{const A=C.tasks.map(g0);s(M=>{const D=new Set(A.map(E=>E.id));return[...M.filter(E=>!D.has(E.id)),...A]})},()=>{})},[]),m=y.useCallback((C,A)=>{const M=D=>{clearTimeout(c.current[D]),c.current[D]=setTimeout(()=>{delete c.current[D],u(D)},200)};C?M(C):A&&s(D=>{const E=D.find(H=>H.id===A);return E!=null&&E.workspaceId?M(E.workspaceId):d(),D})},[u,d]),h=y.useCallback(C=>{const A=C.payload;switch(C.type){case"task.created":{const M=typeof A.workspaceId=="string"?A.workspaceId:"";return M&&u(M),!0}case"task.started":{const M=typeof A.taskId=="string"?A.taskId:"",D=typeof A.sessionId=="string"?A.sessionId:"",E=typeof A.workspaceId=="string"?A.workspaceId:"";return o(H=>M&&H===M?void 0:H),D&&M&&s(H=>H.map(z=>z.id===M?{...z,latestSessionId:D}:z)),m(E,M),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const M=typeof A.workspaceId=="string"?A.workspaceId:"",D=typeof A.taskId=="string"?A.taskId:"";return m(M,D),!0}default:return!1}},[u,m]),g=y.useCallback(()=>{o(void 0)},[]),v=y.useCallback(C=>{var A,M;if(C.type==="tasks"){const D=Array.isArray((A=C.payload)==null?void 0:A.tasks)?C.payload.tasks:[],E=typeof((M=C.payload)==null?void 0:M.workspaceId)=="string"&&C.payload.workspaceId?C.payload.workspaceId:"";return s(E?H=>[...H.filter(z=>z.workspaceId!==E),...D]:H=>{const z=new Set(D.map(Z=>Z.id));return[...H.filter(Z=>!z.has(Z.id)),...D]}),!0}return!1},[]),b=y.useCallback((C,A,M,D,E,H,z,Z,F)=>{ke.createTask({workspaceId:C,title:A,description:M||"",dependsOn:D||[],parentTaskId:E||"",defaultPersonaId:H||void 0,canDecompose:z??void 0}).then(()=>{Z==null||Z()},Q=>{const ae=Q instanceof Ec?Q.message:"Failed to create task";F==null||F(ae)})},[]),_=y.useCallback((C,A,M,D)=>{o(C),ke.startTask({taskId:C,personaId:A||"",environmentId:M||"",notes:D||""}).catch(()=>{o(void 0)})},[]),S=y.useCallback(C=>{ke.stopTask({id:C}).catch(()=>{})},[]),T=y.useCallback(C=>{ke.completeTask({id:C}).catch(()=>{})},[]),N=y.useCallback(C=>{ke.resumeTask({id:C}).catch(()=>{})},[]),j=y.useCallback((C,A,M,D,E)=>{ke.updateTask({id:C,title:A,description:M,dependsOn:D,...E!==void 0?{defaultPersonaId:E}:{}}).catch(()=>{})},[]),w=y.useCallback(C=>{ke.deleteTask({id:C}).catch(()=>{})},[]);return{tasks:n,taskStartingId:i,loadTasks:u,loadAllTasks:d,createTask:b,startTask:_,stopTask:S,completeTask:T,resumeTask:N,updateTask:j,deleteTask:w,handleEvent:h,onDisconnect:g,handleLegacyMessage:v}}function R2(){const[n,s]=y.useState([]),i=y.useCallback(u=>{ke.queryFindings({workspaceId:u}).then(d=>{s(d.findings.map(S2))},()=>{})},[]),o=y.useCallback(u=>{if(u.type==="finding.posted"){const d=typeof u.payload.workspaceId=="string"?u.payload.workspaceId:"";return d&&i(d),!0}return!1},[i]),c=y.useCallback((u,d,m,h,g)=>{ke.postFinding({workspaceId:u,title:d,content:m,category:h??"general",tags:g??[]}).catch(()=>{})},[]);return{findings:n,loadFindings:i,postFinding:c,handleEvent:o}}function M2(){const[n,s]=y.useState([]),i=y.useCallback(()=>{ke.listTokens({}).then(d=>{s(d.tokens.map(T2))},()=>{})},[]),o=y.useCallback(d=>d.type==="token.changed"?(i(),!0):!1,[i]),c=y.useCallback((d,m,h,g,v)=>{ke.setToken({name:d,value:m,type:h,envVar:g,filePath:v}).catch(()=>{})},[]),u=y.useCallback(d=>{ke.deleteToken({name:d}).catch(()=>{})},[]);return{tokens:n,loadTokens:i,setToken:c,deleteToken:u,handleEvent:o}}function O2(){const[n,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),i=y.useCallback(()=>{ke.getCredentialProviders({}).then(u=>{s(k2(u))},()=>{})},[]),o=y.useCallback(u=>u.type==="credential.providers_changed"?(y2(u.payload)&&s(u.payload),!0):!1,[]),c=y.useCallback(u=>{const d=[{provider:"claude",value:u.claude},{provider:"github",value:u.github},{provider:"copilot",value:u.copilot},{provider:"codex",value:u.codex},{provider:"goose",value:u.goose}];for(const{provider:m,value:h}of d)ke.setCredentialProvider({provider:m,value:h}).catch(()=>{})},[]);return{credentialProviders:n,loadCredentials:i,updateCredentialProviders:c,handleEvent:o}}function I2(){const[n,s]=y.useState([]),[i,o]=y.useState(""),[c,u]=y.useState(""),[d,m]=y.useState(!1),h=y.useCallback(()=>{ke.listCodespaces({}).then(v=>{s(v.codespaces.map(w2)),u(v.error)},()=>{})},[]),g=y.useCallback((v,b)=>{m(!0),o(""),ke.createCodespace({repo:v,machine:b??""}).then(()=>{m(!1),h()},_=>{m(!1);const S=_ instanceof Ec?_.message:"Failed to create codespace";o(S)})},[h]);return{codespaces:n,codespaceError:i,codespaceListError:c,codespaceCreating:d,listCodespaces:h,createCodespace:g}}function B2(){const[n,s]=y.useState([]),i=y.useCallback(()=>{ke.listPersonas({}).then(m=>{s(m.personas.map(of))},()=>{})},[]),o=y.useCallback(m=>{switch(m.type){case"persona.created":case"persona.updated":case"persona.deleted":return i(),!0;default:return!1}},[i]),c=y.useCallback((m,h,g,v,b,_,S,T,N)=>ke.createPersona({name:m,description:h,systemPrompt:g,runtime:v||"",model:b||"",maxTurns:_||0,type:S||"agent",script:T||"",allowedMcpTools:N||[]}).then(j=>{const w=of(j);return s(C=>[...C.filter(A=>A.id!==w.id),w]),w}),[]),u=y.useCallback((m,h,g,v,b,_,S,T,N,j)=>{const w={id:m};return h!==void 0&&(w.name=h),g!==void 0&&(w.description=g),v!==void 0&&(w.systemPrompt=v),b!==void 0&&(w.runtime=b),_!==void 0&&(w.model=_),S!==void 0&&(w.maxTurns=S),T!==void 0&&(w.type=T),N!==void 0&&(w.script=N),j!==void 0&&(w.allowedMcpTools=j),ke.updatePersona(w).then(C=>{const A=of(C);return s(M=>M.map(D=>D.id===A.id?A:D)),A})},[]),d=y.useCallback(async m=>{await ke.deletePersona({id:m}),s(h=>h.filter(g=>g.id!==m))},[]);return{personas:n,loadPersonas:i,createPersona:c,updatePersona:u,deletePersona:d,handleEvent:o}}function L2(n){if(n)try{return JSON.parse(n)}catch{return}}function U2(){const[n,s]=y.useState(new Map),[i,o]=y.useState([]),[c,u]=y.useState(void 0),[d,m]=y.useState(void 0),[h,g]=y.useState(!1),[v,b]=y.useState(""),_=y.useRef(""),S=y.useCallback(M=>{const D=M??"";_.current=D,b(""),g(!0),ke.listRecentKnowledgeNodes({limit:30,workspaceId:D}).then(E=>{const H=new Map,z=[];for(const Z of E.nodes)H.set(Z.id,ec(Z));for(const Z of E.edges)z.push(rf(Z));for(const Z of z){const F=H.get(Z.source);F&&(F.val+=1);const Q=H.get(Z.target);Q&&(Q.val+=1)}s(H),o(z),g(!1)},()=>{g(!1)})},[]),T=y.useCallback(M=>{M.trim()&&(b(M),m(void 0),u(void 0),g(!0),ke.searchKnowledge({query:M,limit:20,workspaceId:_.current}).then(D=>{const E=new Map,H=[];for(const z of D.results){z.node&&E.set(z.node.id,ec(z.node,z.edges.length));for(const Z of z.edges)H.push(rf(Z))}s(E),o(H),g(!1)},()=>{g(!1)}))},[]),N=y.useCallback(()=>{S(_.current)},[S]),j=y.useCallback(M=>{m(M),ke.getKnowledgeNode({id:M}).then(D=>{if(!D.node){u(void 0);return}u({node:ec(D.node,D.edges.length),edges:D.edges.map(E=>({fromId:E.fromId,toId:E.toId,type:E.type,metadata:L2(E.metadataJson)}))})},()=>{u(void 0)})},[]),w=y.useCallback(()=>{m(void 0),u(void 0)},[]),C=y.useCallback(M=>{ke.expandKnowledgeNode({id:M,depth:1}).then(D=>{s(E=>{const H=new Map(E);for(const z of D.nodes)H.has(z.id)||H.set(z.id,ec(z));return H}),o(E=>{const H=new Set(E.map(Z=>`${Z.source}:${Z.target}:${Z.type}`)),z=[];for(const Z of D.edges){const F=rf(Z),Q=`${F.source}:${F.target}:${F.type}`;H.has(Q)||z.push(F)}return[...E,...z]})},()=>{})},[]),A=y.useCallback(M=>!1,[]);return{graphData:{nodes:[...n.values()],links:i},selectedNode:c,selectedId:d,loading:h,searchQuery:v,search:T,clearSearch:N,selectNode:j,clearSelection:w,expandNode:C,loadRecent:S,handleEvent:A}}function z2(){const[n,s]=y.useState(""),[i,o]=y.useState(void 0),[c,u]=y.useState({}),d=j2(),m=E2(),h=A2(),g=D2(),v=R2(),b=M2(),_=O2(),S=I2(),T=B2(),N=U2(),{connected:j}=h2({onSessionEvent:F=>{m.handleSessionEvent({sessionId:F.sessionId,eventType:ob(F.type),timestamp:F.timestamp,content:F.content,raw:F.raw||void 0})},onDomainEvent:F=>{try{const Q=JSON.parse(F.payloadJson);E({id:F.id,type:F.type,timestamp:F.timestamp,payload:Q})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",F.payloadJson)}},onConnect:H,onDisconnect:z}),w="default_persona_id",C="onboarding_completed",A=y.useCallback(async F=>{const Q=await ke.setSetting({key:w,value:F});s(Q.value)},[]),M=y.useCallback(async()=>{await ke.setSetting({key:C,value:"true"}),o(!0)},[]),D=y.useCallback((F,Q)=>{ke.getUsage({scope:F,id:Q}).then(ae=>{const pe=`${F}:${Q}`;u(oe=>({...oe,[pe]:N2(ae)}))},()=>{})},[]);function E(F){const Q=F.payload.key,ae=F.payload.value;if(F.type==="setting.changed"){Q===w&&s(ae??""),Q===C&&o(ae==="true");return}if(d.handleEvent(F)){(F.type==="environment.removed"||F.type==="environment.changed")&&m.loadSessions();return}if(!h.handleEvent(F)){if(g.handleEvent(F)){F.type==="task.started"&&m.loadSessions();return}v.handleEvent(F)||b.handleEvent(F)||_.handleEvent(F)||T.handleEvent(F)||N.handleEvent(F)}}function H(){d.loadEnvironments(),m.loadSessions(),h.loadWorkspaces(),b.loadTokens(),_.loadCredentials(),T.loadPersonas(),ke.getSetting({key:w}).then(F=>{s(F.value)},()=>{}),ke.getSetting({key:C}).then(F=>{o(F.value==="true")},()=>{}),g.loadAllTasks()}function z(){h.onDisconnect(),g.onDisconnect()}const Z=y.useCallback(()=>{d.loadEnvironments(),m.loadSessions(),h.loadWorkspaces(),b.loadTokens()},[d.loadEnvironments,m.loadSessions,h.loadWorkspaces,b.loadTokens]);return{connected:j,environments:d.environments,sessions:m.sessions,events:m.events,eventsDropped:m.eventsDropped,lastSpawnedId:m.lastSpawnedId,workspaces:h.workspaces,tasks:g.tasks,findings:v.findings,tokens:b.tokens,spawn:m.spawn,sendInput:m.sendInput,kill:m.kill,stopGraceful:m.stopGraceful,refresh:Z,loadSessionEvents:m.loadSessionEvents,clearEvents:m.clearEvents,loadWorkspaces:h.loadWorkspaces,createWorkspace:h.createWorkspace,archiveWorkspace:h.archiveWorkspace,updateWorkspace:h.updateWorkspace,loadTasks:g.loadTasks,loadAllTasks:g.loadAllTasks,createTask:g.createTask,startTask:g.startTask,stopTask:g.stopTask,completeTask:g.completeTask,resumeTask:g.resumeTask,updateTask:g.updateTask,deleteTask:g.deleteTask,loadFindings:v.loadFindings,postFinding:v.postFinding,loadEnvironments:d.loadEnvironments,addEnvironment:d.addEnvironment,updateEnvironment:d.updateEnvironment,loadTokens:b.loadTokens,setToken:b.setToken,deleteToken:b.deleteToken,credentialProviders:_.credentialProviders,updateCredentialProviders:_.updateCredentialProviders,provisionStatus:d.provisionStatus,provisionEnvironment:d.provisionEnvironment,stopEnvironment:d.stopEnvironment,removeEnvironment:d.removeEnvironment,codespaces:S.codespaces,codespaceError:S.codespaceError,codespaceListError:S.codespaceListError,codespaceCreating:S.codespaceCreating,listCodespaces:S.listCodespaces,createCodespace:S.createCodespace,workspaceCreating:h.workspaceCreating,taskStartingId:g.taskStartingId,personas:T.personas,createPersona:T.createPersona,updatePersona:T.updatePersona,deletePersona:T.deletePersona,taskSessions:m.taskSessions,loadTaskSessions:m.loadTaskSessions,appDefaultPersonaId:n,setAppDefaultPersonaId:A,onboardingCompleted:i,completeOnboarding:M,usageCache:c,loadUsage:D,knowledge:N}}const _p=y.createContext(void 0);function P2({children:n}){const s=z2();return l.jsx(_p.Provider,{value:s,children:n})}function pt(){const n=y.useContext(_p);if(!n)throw new Error("useGrackle must be used within GrackleProvider");return n}const ns=[{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
|
|
35
|
+
*/var d0="popstate";function f0(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function lk(n={}){function s(o,c){var g;let u=(g=c.state)==null?void 0:g.masked,{pathname:d,search:m,hash:h}=u||o.location;return Uf("",{pathname:d,search:m,hash:h},c.state&&c.state.usr||null,c.state&&c.state.key||"default",u?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function i(o,c){return typeof c=="string"?c:xr(c)}return uk(s,i,null,n)}function dt(n,s){if(n===!1||n===null||typeof n>"u")throw new Error(s)}function Ln(n,s){if(!n){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function ck(){return Math.random().toString(36).substring(2,10)}function p0(n,s){return{usr:n.state,key:n.key,idx:s,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Uf(n,s,i=null,o,c){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof s=="string"?ao(s):s,state:i,key:s&&s.key||o||ck(),unstable_mask:c}}function xr({pathname:n="/",search:s="",hash:i=""}){return s&&s!=="?"&&(n+=s.charAt(0)==="?"?s:"?"+s),i&&i!=="#"&&(n+=i.charAt(0)==="#"?i:"#"+i),n}function ao(n){let s={};if(n){let i=n.indexOf("#");i>=0&&(s.hash=n.substring(i),n=n.substring(0,i));let o=n.indexOf("?");o>=0&&(s.search=n.substring(o),n=n.substring(0,o)),n&&(s.pathname=n)}return s}function uk(n,s,i,o={}){let{window:c=document.defaultView,v5Compat:u=!1}=o,d=c.history,m="POP",h=null,g=v();g==null&&(g=0,d.replaceState({...d.state,idx:g},""));function v(){return(d.state||{idx:null}).idx}function b(){m="POP";let j=v(),w=j==null?null:j-g;g=j,h&&h({action:m,location:N.location,delta:w})}function _(j,w){m="PUSH";let C=f0(j)?j:Uf(N.location,j,w);g=v()+1;let A=p0(C,g),M=N.createHref(C.unstable_mask||C);try{d.pushState(A,"",M)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;c.location.assign(M)}u&&h&&h({action:m,location:N.location,delta:1})}function S(j,w){m="REPLACE";let C=f0(j)?j:Uf(N.location,j,w);g=v();let A=p0(C,g),M=N.createHref(C.unstable_mask||C);d.replaceState(A,"",M),u&&h&&h({action:m,location:N.location,delta:0})}function T(j){return dk(j)}let N={get action(){return m},get location(){return n(c,d)},listen(j){if(h)throw new Error("A history only accepts one active listener");return c.addEventListener(d0,b),h=j,()=>{c.removeEventListener(d0,b),h=null}},createHref(j){return s(c,j)},createURL:T,encodeLocation(j){let w=T(j);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:_,replace:S,go(j){return d.go(j)}};return N}function dk(n,s=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),dt(i,"No window.location.(origin|href) available to create URL");let o=typeof n=="string"?n:xr(n);return o=o.replace(/ $/,"%20"),!s&&o.startsWith("//")&&(o=i+o),new URL(o,i)}function cb(n,s,i="/"){return fk(n,s,i,!1)}function fk(n,s,i,o){let c=typeof s=="string"?ao(s):s,u=Os(c.pathname||"/",i);if(u==null)return null;let d=ub(n);pk(d);let m=null;for(let h=0;m==null&&h<d.length;++h){let g=fb(u);m=Sk(d[h],g,o)}return m}function ub(n,s=[],i=[],o="",c=!1){let u=(d,m,h=c,g)=>{let v={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:m,route:d};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(o)&&h)return;dt(v.relativePath.startsWith(o),`Absolute route path "${v.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(o.length)}let b=ss([o,v.relativePath]),_=i.concat(v);d.children&&d.children.length>0&&(dt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),ub(d.children,s,_,b,h)),!(d.path==null&&!d.index)&&s.push({path:b,score:_k(b,d.index),routesMeta:_})};return n.forEach((d,m)=>{var h;if(d.path===""||!((h=d.path)!=null&&h.includes("?")))u(d,m);else for(let g of db(d.path))u(d,m,!0,g)}),s}function db(n){let s=n.split("/");if(s.length===0)return[];let[i,...o]=s,c=i.endsWith("?"),u=i.replace(/\?$/,"");if(o.length===0)return c?[u,""]:[u];let d=db(o.join("/")),m=[];return m.push(...d.map(h=>h===""?u:[u,h].join("/"))),c&&m.push(...d),m.map(h=>n.startsWith("/")&&h===""?"/":h)}function pk(n){n.sort((s,i)=>s.score!==i.score?i.score-s.score:xk(s.routesMeta.map(o=>o.childrenIndex),i.routesMeta.map(o=>o.childrenIndex)))}var mk=/^:[\w-]+$/,hk=3,gk=2,vk=1,yk=10,bk=-2,m0=n=>n==="*";function _k(n,s){let i=n.split("/"),o=i.length;return i.some(m0)&&(o+=bk),s&&(o+=gk),i.filter(c=>!m0(c)).reduce((c,u)=>c+(mk.test(u)?hk:u===""?vk:yk),o)}function xk(n,s){return n.length===s.length&&n.slice(0,-1).every((o,c)=>o===s[c])?n[n.length-1]-s[s.length-1]:0}function Sk(n,s,i=!1){let{routesMeta:o}=n,c={},u="/",d=[];for(let m=0;m<o.length;++m){let h=o[m],g=m===o.length-1,v=u==="/"?s:s.slice(u.length)||"/",b=Sr({path:h.relativePath,caseSensitive:h.caseSensitive,end:g},v),_=h.route;if(!b&&g&&i&&!o[o.length-1].route.index&&(b=Sr({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),d.push({params:c,pathname:ss([u,b.pathname]),pathnameBase:jk(ss([u,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(u=ss([u,b.pathnameBase]))}return d}function Sr(n,s){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[i,o]=Tk(n.path,n.caseSensitive,n.end),c=s.match(i);if(!c)return null;let u=c[0],d=u.replace(/(.)\/+$/,"$1"),m=c.slice(1);return{params:o.reduce((g,{paramName:v,isOptional:b},_)=>{if(v==="*"){let T=m[_]||"";d=u.slice(0,u.length-T.length).replace(/(.)\/+$/,"$1")}const S=m[_];return b&&!S?g[v]=void 0:g[v]=(S||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:d,pattern:n}}function Tk(n,s=!1,i=!0){Ln(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let o=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,m,h,g,v)=>{if(o.push({paramName:m,isOptional:h!=null}),h){let b=v.charAt(g+d.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(o.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),o]}function fb(n){try{return n.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Ln(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),n}}function Os(n,s){if(s==="/")return n;if(!n.toLowerCase().startsWith(s.toLowerCase()))return null;let i=s.endsWith("/")?s.length-1:s.length,o=n.charAt(i);return o&&o!=="/"?null:n.slice(i)||"/"}var kk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function wk(n,s="/"){let{pathname:i,search:o="",hash:c=""}=typeof n=="string"?ao(n):n,u;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?u=h0(i.substring(1),"/"):u=h0(i,s)):u=s,{pathname:u,search:Ck(o),hash:Ek(c)}}function h0(n,s){let i=s.replace(/\/+$/,"").split("/");return n.split("/").forEach(c=>{c===".."?i.length>1&&i.pop():c!=="."&&i.push(c)}),i.length>1?i.join("/"):"/"}function tf(n,s,i,o){return`Cannot include a '${n}' character in a manually specified \`to.${s}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Nk(n){return n.filter((s,i)=>i===0||s.route.path&&s.route.path.length>0)}function pp(n){let s=Nk(n);return s.map((i,o)=>o===s.length-1?i.pathname:i.pathnameBase)}function Ac(n,s,i,o=!1){let c;typeof n=="string"?c=ao(n):(c={...n},dt(!c.pathname||!c.pathname.includes("?"),tf("?","pathname","search",c)),dt(!c.pathname||!c.pathname.includes("#"),tf("#","pathname","hash",c)),dt(!c.search||!c.search.includes("#"),tf("#","search","hash",c)));let u=n===""||c.pathname==="",d=u?"/":c.pathname,m;if(d==null)m=i;else{let b=s.length-1;if(!o&&d.startsWith("..")){let _=d.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}m=b>=0?s[b]:"/"}let h=wk(c,m),g=d&&d!=="/"&&d.endsWith("/"),v=(u||d===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(g||v)&&(h.pathname+="/"),h}var ss=n=>n.join("/").replace(/\/\/+/g,"/"),jk=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),Ck=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,Ek=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,Ak=class{constructor(n,s,i,o=!1){this.status=n,this.statusText=s||"",this.internal=o,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function Dk(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function Rk(n){return n.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var pb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function mb(n,s){let i=n;if(typeof i!="string"||!kk.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let o=i,c=!1;if(pb)try{let u=new URL(window.location.href),d=i.startsWith("//")?new URL(u.protocol+i):new URL(i),m=Os(d.pathname,s);d.origin===u.origin&&m!=null?i=m+d.search+d.hash:c=!0}catch{Ln(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var hb=["POST","PUT","PATCH","DELETE"];new Set(hb);var Mk=["GET",...hb];new Set(Mk);var io=y.createContext(null);io.displayName="DataRouter";var Dc=y.createContext(null);Dc.displayName="DataRouterState";var Ok=y.createContext(!1),gb=y.createContext({isTransitioning:!1});gb.displayName="ViewTransition";var Ik=y.createContext(new Map);Ik.displayName="Fetchers";var Bk=y.createContext(null);Bk.displayName="Await";var Sn=y.createContext(null);Sn.displayName="Navigation";var Cr=y.createContext(null);Cr.displayName="Location";var Un=y.createContext({outlet:null,matches:[],isDataRoute:!1});Un.displayName="Route";var mp=y.createContext(null);mp.displayName="RouteError";var vb="REACT_ROUTER_ERROR",Lk="REDIRECT",Uk="ROUTE_ERROR_RESPONSE";function zk(n){if(n.startsWith(`${vb}:${Lk}:{`))try{let s=JSON.parse(n.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 Pk(n){if(n.startsWith(`${vb}:${Uk}:{`))try{let s=JSON.parse(n.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Ak(s.status,s.statusText,s.data)}catch{}}function Vk(n,{relative:s}={}){dt(Xa(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:o}=y.useContext(Sn),{hash:c,pathname:u,search:d}=Er(n,{relative:s}),m=u;return i!=="/"&&(m=u==="/"?i:ss([i,u])),o.createHref({pathname:m,search:d,hash:c})}function Xa(){return y.useContext(Cr)!=null}function Lt(){return dt(Xa(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(Cr).location}function Mt(n){dt(Xa(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Lt();return y.useMemo(()=>Sr(n,fb(s)),[s,n])}var yb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function bb(n){y.useContext(Sn).static||y.useLayoutEffect(n)}function Rc(){let{isDataRoute:n}=y.useContext(Un);return n?n2():Hk()}function Hk(){dt(Xa(),"useNavigate() may be used only in the context of a <Router> component.");let n=y.useContext(io),{basename:s,navigator:i}=y.useContext(Sn),{matches:o}=y.useContext(Un),{pathname:c}=Lt(),u=JSON.stringify(pp(o)),d=y.useRef(!1);return bb(()=>{d.current=!0}),y.useCallback((h,g={})=>{if(Ln(d.current,yb),!d.current)return;if(typeof h=="number"){i.go(h);return}let v=Ac(h,JSON.parse(u),c,g.relative==="path");n==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:ss([s,v.pathname])),(g.replace?i.replace:i.push)(v,g.state,g)},[s,i,u,c,n])}var qk=y.createContext(null);function Gk(n){let s=y.useContext(Un).outlet;return y.useMemo(()=>s&&y.createElement(qk.Provider,{value:n},s),[s,n])}function va(){let{matches:n}=y.useContext(Un),s=n[n.length-1];return s?s.params:{}}function Er(n,{relative:s}={}){let{matches:i}=y.useContext(Un),{pathname:o}=Lt(),c=JSON.stringify(pp(i));return y.useMemo(()=>Ac(n,JSON.parse(c),o,s==="path"),[n,c,o,s])}function $k(n,s){return _b(n,s)}function _b(n,s,i){var j;dt(Xa(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=y.useContext(Sn),{matches:c}=y.useContext(Un),u=c[c.length-1],d=u?u.params:{},m=u?u.pathname:"/",h=u?u.pathnameBase:"/",g=u&&u.route;{let w=g&&g.path||"";Sb(m,!g||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${w}">) 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.
|
|
36
|
+
|
|
37
|
+
Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let v=Lt(),b;if(s){let w=typeof s=="string"?ao(s):s;dt(h==="/"||((j=w.pathname)==null?void 0:j.startsWith(h)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${w.pathname}" was given in the \`location\` prop.`),b=w}else b=v;let _=b.pathname||"/",S=_;if(h!=="/"){let w=h.replace(/^\//,"").split("/");S="/"+_.replace(/^\//,"").split("/").slice(w.length).join("/")}let T=cb(n,{pathname:S});Ln(g||T!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Ln(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.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 N=Jk(T&&T.map(w=>Object.assign({},w,{params:Object.assign({},d,w.params),pathname:ss([h,o.encodeLocation?o.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?h:ss([h,o.encodeLocation?o.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),c,i);return s&&N?y.createElement(Cr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},N):N}function Fk(){let n=t2(),s=Dk(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),i=n instanceof Error?n.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},u={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",n),d=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:u},"ErrorBoundary")," or"," ",y.createElement("code",{style:u},"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,d)}var Zk=y.createElement(Fk,null),xb=class extends y.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,s){return s.location!==n.location||s.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:s.error,location:s.location,revalidation:n.revalidation||s.revalidation}}componentDidCatch(n,s){this.props.onError?this.props.onError(n,s):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const i=Pk(n.digest);i&&(n=i)}let s=n!==void 0?y.createElement(Un.Provider,{value:this.props.routeContext},y.createElement(mp.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?y.createElement(Kk,{error:n},s):s}};xb.contextType=Ok;var nf=new WeakMap;function Kk({children:n,error:s}){let{basename:i}=y.useContext(Sn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let o=zk(s.digest);if(o){let c=nf.get(s);if(c)throw c;let u=mb(o.location,i);if(pb&&!nf.get(s))if(u.isExternal||o.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:o.replace}));throw nf.set(s,d),d}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return n}function Yk({routeContext:n,match:s,children:i}){let o=y.useContext(io);return o&&o.static&&o.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(Un.Provider,{value:n},i)}function Jk(n,s=[],i){let o=i==null?void 0:i.state;if(n==null){if(!o)return null;if(o.errors)n=o.matches;else if(s.length===0&&!o.initialized&&o.matches.length>0)n=o.matches;else return null}let c=n,u=o==null?void 0:o.errors;if(u!=null){let v=c.findIndex(b=>b.route.id&&(u==null?void 0:u[b.route.id])!==void 0);dt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let d=!1,m=-1;if(i&&o){d=o.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(m=v),b.route.id){let{loaderData:_,errors:S}=o,T=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!S||S[b.route.id]===void 0);if(b.route.lazy||T){i.isStatic&&(d=!0),m>=0?c=c.slice(0,m+1):c=[c[0]];break}}}}let h=i==null?void 0:i.onError,g=o&&h?(v,b)=>{var _,S;h(v,{location:o.location,params:((S=(_=o.matches)==null?void 0:_[0])==null?void 0:S.params)??{},unstable_pattern:Rk(o.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,_)=>{let S,T=!1,N=null,j=null;o&&(S=u&&b.route.id?u[b.route.id]:void 0,N=b.route.errorElement||Zk,d&&(m<0&&_===0?(Sb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,j=null):m===_&&(T=!0,j=b.route.hydrateFallbackElement||null)));let w=s.concat(c.slice(0,_+1)),C=()=>{let A;return S?A=N:T?A=j:b.route.Component?A=y.createElement(b.route.Component,null):b.route.element?A=b.route.element:A=v,y.createElement(Yk,{match:b,routeContext:{outlet:v,matches:w,isDataRoute:o!=null},children:A})};return o&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement(xb,{location:o.location,revalidation:o.revalidation,component:N,error:S,children:C(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:g}):C()},null)}function hp(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Wk(n){let s=y.useContext(io);return dt(s,hp(n)),s}function Xk(n){let s=y.useContext(Dc);return dt(s,hp(n)),s}function Qk(n){let s=y.useContext(Un);return dt(s,hp(n)),s}function gp(n){let s=Qk(n),i=s.matches[s.matches.length-1];return dt(i.route.id,`${n} can only be used on routes that contain a unique "id"`),i.route.id}function e2(){return gp("useRouteId")}function t2(){var o;let n=y.useContext(mp),s=Xk("useRouteError"),i=gp("useRouteError");return n!==void 0?n:(o=s.errors)==null?void 0:o[i]}function n2(){let{router:n}=Wk("useNavigate"),s=gp("useNavigate"),i=y.useRef(!1);return bb(()=>{i.current=!0}),y.useCallback(async(c,u={})=>{Ln(i.current,yb),i.current&&(typeof c=="number"?await n.navigate(c):await n.navigate(c,{fromRouteId:s,...u}))},[n,s])}var g0={};function Sb(n,s,i){!s&&!g0[n]&&(g0[n]=!0,Ln(!1,i))}y.memo(s2);function s2({routes:n,future:s,state:i,isStatic:o,onError:c}){return _b(n,void 0,{state:i,isStatic:o,onError:c})}function Kn({to:n,replace:s,state:i,relative:o}){dt(Xa(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Sn);Ln(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:u}=y.useContext(Un),{pathname:d}=Lt(),m=Rc(),h=Ac(n,pp(u),d,o==="path"),g=JSON.stringify(h);return y.useEffect(()=>{m(JSON.parse(g),{replace:s,state:i,relative:o})},[m,g,o,s,i]),null}function Qa(n){return Gk(n.context)}function je(n){dt(!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 a2({basename:n="/",children:s=null,location:i,navigationType:o="POP",navigator:c,static:u=!1,unstable_useTransitions:d}){dt(!Xa(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let m=n.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:m,navigator:c,static:u,unstable_useTransitions:d,future:{}}),[m,c,u,d]);typeof i=="string"&&(i=ao(i));let{pathname:g="/",search:v="",hash:b="",state:_=null,key:S="default",unstable_mask:T}=i,N=y.useMemo(()=>{let j=Os(g,m);return j==null?null:{location:{pathname:j,search:v,hash:b,state:_,key:S,unstable_mask:T},navigationType:o}},[m,g,v,b,_,S,o,T]);return Ln(N!=null,`<Router basename="${m}"> 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.`),N==null?null:y.createElement(Sn.Provider,{value:h},y.createElement(Cr.Provider,{children:s,value:N}))}function i2({children:n,location:s}){return $k(zf(n),s)}function zf(n,s=[]){let i=[];return y.Children.forEach(n,(o,c)=>{if(!y.isValidElement(o))return;let u=[...s,c];if(o.type===y.Fragment){i.push.apply(i,zf(o.props.children,u));return}dt(o.type===je,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),dt(!o.props.index||!o.props.children,"An index route cannot have child routes.");let d={id:o.props.id||u.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(d.children=zf(o.props.children,u)),i.push(d)}),i}var uc="get",dc="application/x-www-form-urlencoded";function Mc(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function o2(n){return Mc(n)&&n.tagName.toLowerCase()==="button"}function r2(n){return Mc(n)&&n.tagName.toLowerCase()==="form"}function l2(n){return Mc(n)&&n.tagName.toLowerCase()==="input"}function c2(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function u2(n,s){return n.button===0&&(!s||s==="_self")&&!c2(n)}function Pf(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((s,i)=>{let o=n[i];return s.concat(Array.isArray(o)?o.map(c=>[i,c]):[[i,o]])},[]))}function d2(n,s){let i=Pf(n);return s&&s.forEach((o,c)=>{i.has(c)||s.getAll(c).forEach(u=>{i.append(c,u)})}),i}var Xl=null;function f2(){if(Xl===null)try{new FormData(document.createElement("form"),0),Xl=!1}catch{Xl=!0}return Xl}var p2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function sf(n){return n!=null&&!p2.has(n)?(Ln(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${dc}"`),null):n}function m2(n,s){let i,o,c,u,d;if(r2(n)){let m=n.getAttribute("action");o=m?Os(m,s):null,i=n.getAttribute("method")||uc,c=sf(n.getAttribute("enctype"))||dc,u=new FormData(n)}else if(o2(n)||l2(n)&&(n.type==="submit"||n.type==="image")){let m=n.form;if(m==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=n.getAttribute("formaction")||m.getAttribute("action");if(o=h?Os(h,s):null,i=n.getAttribute("formmethod")||m.getAttribute("method")||uc,c=sf(n.getAttribute("formenctype"))||sf(m.getAttribute("enctype"))||dc,u=new FormData(m,n),!f2()){let{name:g,type:v,value:b}=n;if(v==="image"){let _=g?`${g}.`:"";u.append(`${_}x`,"0"),u.append(`${_}y`,"0")}else g&&u.append(g,b)}}else{if(Mc(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=uc,o=null,c=dc,d=n}return u&&c==="text/plain"&&(d=u,u=void 0),{action:o,method:i.toLowerCase(),encType:c,formData:u,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vp(n,s){if(n===!1||n===null||typeof n>"u")throw new Error(s)}function h2(n,s,i,o){let c=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return i?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:s&&Os(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function g2(n,s){if(n.id in s)return s[n.id];try{let i=await import(n.module);return s[n.id]=i,i}catch(i){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function v2(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function y2(n,s,i){let o=await Promise.all(n.map(async c=>{let u=s.routes[c.route.id];if(u){let d=await g2(u,i);return d.links?d.links():[]}return[]}));return S2(o.flat(1).filter(v2).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function v0(n,s,i,o,c,u){let d=(h,g)=>i[g]?h.route.id!==i[g].route.id:!0,m=(h,g)=>{var v;return i[g].pathname!==h.pathname||((v=i[g].route.path)==null?void 0:v.endsWith("*"))&&i[g].params["*"]!==h.params["*"]};return u==="assets"?s.filter((h,g)=>d(h,g)||m(h,g)):u==="data"?s.filter((h,g)=>{var b;let v=o.routes[h.route.id];if(!v||!v.hasLoader)return!1;if(d(h,g)||m(h,g))return!0;if(h.route.shouldRevalidate){let _=h.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(n,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function b2(n,s,{includeHydrateFallback:i}={}){return _2(n.map(o=>{let c=s.routes[o.route.id];if(!c)return[];let u=[c.module];return c.clientActionModule&&(u=u.concat(c.clientActionModule)),c.clientLoaderModule&&(u=u.concat(c.clientLoaderModule)),i&&c.hydrateFallbackModule&&(u=u.concat(c.hydrateFallbackModule)),c.imports&&(u=u.concat(c.imports)),u}).flat(1))}function _2(n){return[...new Set(n)]}function x2(n){let s={},i=Object.keys(n).sort();for(let o of i)s[o]=n[o];return s}function S2(n,s){let i=new Set;return new Set(s),n.reduce((o,c)=>{let u=JSON.stringify(x2(c));return i.has(u)||(i.add(u),o.push({key:u,link:c})),o},[])}function Tb(){let n=y.useContext(io);return vp(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function T2(){let n=y.useContext(Dc);return vp(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var yp=y.createContext(void 0);yp.displayName="FrameworkContext";function kb(){let n=y.useContext(yp);return vp(n,"You must render this element inside a <HydratedRouter> element"),n}function k2(n,s){let i=y.useContext(yp),[o,c]=y.useState(!1),[u,d]=y.useState(!1),{onFocus:m,onBlur:h,onMouseEnter:g,onMouseLeave:v,onTouchStart:b}=s,_=y.useRef(null);y.useEffect(()=>{if(n==="render"&&d(!0),n==="viewport"){let N=w=>{w.forEach(C=>{d(C.isIntersecting)})},j=new IntersectionObserver(N,{threshold:.5});return _.current&&j.observe(_.current),()=>{j.disconnect()}}},[n]),y.useEffect(()=>{if(o){let N=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(N)}}},[o]);let S=()=>{c(!0)},T=()=>{c(!1),d(!1)};return i?n!=="intent"?[u,_,{}]:[u,_,{onFocus:ar(m,S),onBlur:ar(h,T),onMouseEnter:ar(g,S),onMouseLeave:ar(v,T),onTouchStart:ar(b,S)}]:[!1,_,{}]}function ar(n,s){return i=>{n&&n(i),i.defaultPrevented||s(i)}}function w2({page:n,...s}){let{router:i}=Tb(),o=y.useMemo(()=>cb(i.routes,n,i.basename),[i.routes,n,i.basename]);return o?y.createElement(j2,{page:n,matches:o,...s}):null}function N2(n){let{manifest:s,routeModules:i}=kb(),[o,c]=y.useState([]);return y.useEffect(()=>{let u=!1;return y2(n,s,i).then(d=>{u||c(d)}),()=>{u=!0}},[n,s,i]),o}function j2({page:n,matches:s,...i}){let o=Lt(),{future:c,manifest:u,routeModules:d}=kb(),{basename:m}=Tb(),{loaderData:h,matches:g}=T2(),v=y.useMemo(()=>v0(n,s,g,u,o,"data"),[n,s,g,u,o]),b=y.useMemo(()=>v0(n,s,g,u,o,"assets"),[n,s,g,u,o]),_=y.useMemo(()=>{if(n===o.pathname+o.search+o.hash)return[];let N=new Set,j=!1;if(s.forEach(C=>{var M;let A=u.routes[C.route.id];!A||!A.hasLoader||(!v.some(D=>D.route.id===C.route.id)&&C.route.id in h&&((M=d[C.route.id])!=null&&M.shouldRevalidate)||A.hasClientLoader?j=!0:N.add(C.route.id))}),N.size===0)return[];let w=h2(n,m,c.unstable_trailingSlashAwareDataRequests,"data");return j&&N.size>0&&w.searchParams.set("_routes",s.filter(C=>N.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[m,c.unstable_trailingSlashAwareDataRequests,h,o,u,v,s,n,d]),S=y.useMemo(()=>b2(b,u),[b,u]),T=N2(b);return y.createElement(y.Fragment,null,_.map(N=>y.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...i})),S.map(N=>y.createElement("link",{key:N,rel:"modulepreload",href:N,...i})),T.map(({key:N,link:j})=>y.createElement("link",{key:N,nonce:i.nonce,...j,crossOrigin:j.crossOrigin??i.crossOrigin})))}function C2(...n){return s=>{n.forEach(i=>{typeof i=="function"?i(s):i!=null&&(i.current=s)})}}var E2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{E2&&(window.__reactRouterVersion="7.13.2")}catch{}function A2({basename:n,children:s,unstable_useTransitions:i,window:o}){let c=y.useRef();c.current==null&&(c.current=lk({window:o,v5Compat:!0}));let u=c.current,[d,m]=y.useState({action:u.action,location:u.location}),h=y.useCallback(g=>{i===!1?m(g):y.startTransition(()=>m(g))},[i]);return y.useLayoutEffect(()=>u.listen(h),[u,h]),y.createElement(a2,{basename:n,children:s,location:d.location,navigationType:d.action,navigator:u,unstable_useTransitions:i})}var wb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bp=y.forwardRef(function({onClick:s,discover:i="render",prefetch:o="none",relative:c,reloadDocument:u,replace:d,unstable_mask:m,state:h,target:g,to:v,preventScrollReset:b,viewTransition:_,unstable_defaultShouldRevalidate:S,...T},N){let{basename:j,navigator:w,unstable_useTransitions:C}=y.useContext(Sn),A=typeof v=="string"&&wb.test(v),M=mb(v,j);v=M.to;let D=Vk(v,{relative:c}),E=Lt(),H=null;if(m){let X=Ac(m,[],E.unstable_mask?E.unstable_mask.pathname:"/",!0);j!=="/"&&(X.pathname=X.pathname==="/"?j:ss([j,X.pathname])),H=w.createHref(X)}let[z,Z,F]=k2(o,T),Q=O2(v,{replace:d,unstable_mask:m,state:h,target:g,preventScrollReset:b,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:S,unstable_useTransitions:C});function ae(X){s&&s(X),X.defaultPrevented||Q(X)}let pe=!(M.isExternal||u),oe=y.createElement("a",{...T,...F,href:(pe?H:void 0)||M.absoluteURL||D,onClick:pe?ae:s,ref:C2(N,Z),target:g,"data-discover":!A&&i==="render"?"true":void 0});return z&&!A?y.createElement(y.Fragment,null,oe,y.createElement(w2,{page:D})):oe});bp.displayName="Link";var D2=y.forwardRef(function({"aria-current":s="page",caseSensitive:i=!1,className:o="",end:c=!1,style:u,to:d,viewTransition:m,children:h,...g},v){let b=Er(d,{relative:g.relative}),_=Lt(),S=y.useContext(Dc),{navigator:T,basename:N}=y.useContext(Sn),j=S!=null&&z2(b)&&m===!0,w=T.encodeLocation?T.encodeLocation(b).pathname:b.pathname,C=_.pathname,A=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;i||(C=C.toLowerCase(),A=A?A.toLowerCase():null,w=w.toLowerCase()),A&&N&&(A=Os(A,N)||A);const M=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let D=C===w||!c&&C.startsWith(w)&&C.charAt(M)==="/",E=A!=null&&(A===w||!c&&A.startsWith(w)&&A.charAt(w.length)==="/"),H={isActive:D,isPending:E,isTransitioning:j},z=D?s:void 0,Z;typeof o=="function"?Z=o(H):Z=[o,D?"active":null,E?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let F=typeof u=="function"?u(H):u;return y.createElement(bp,{...g,"aria-current":z,className:Z,ref:v,style:F,to:d,viewTransition:m},typeof h=="function"?h(H):h)});D2.displayName="NavLink";var R2=y.forwardRef(({discover:n="render",fetcherKey:s,navigate:i,reloadDocument:o,replace:c,state:u,method:d=uc,action:m,onSubmit:h,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_,...S},T)=>{let{unstable_useTransitions:N}=y.useContext(Sn),j=L2(),w=U2(m,{relative:g}),C=d.toLowerCase()==="get"?"get":"post",A=typeof m=="string"&&wb.test(m),M=D=>{if(h&&h(D),D.defaultPrevented)return;D.preventDefault();let E=D.nativeEvent.submitter,H=(E==null?void 0:E.getAttribute("formmethod"))||d,z=()=>j(E||D.currentTarget,{fetcherKey:s,method:H,navigate:i,replace:c,state:u,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_});N&&i!==!1?y.startTransition(()=>z()):z()};return y.createElement("form",{ref:T,method:C,action:w,onSubmit:o?h:M,...S,"data-discover":!A&&n==="render"?"true":void 0})});R2.displayName="Form";function M2(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Nb(n){let s=y.useContext(io);return dt(s,M2(n)),s}function O2(n,{target:s,replace:i,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:m,unstable_defaultShouldRevalidate:h,unstable_useTransitions:g}={}){let v=Rc(),b=Lt(),_=Er(n,{relative:d});return y.useCallback(S=>{if(u2(S,s)){S.preventDefault();let T=i!==void 0?i:xr(b)===xr(_),N=()=>v(n,{replace:T,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:m,unstable_defaultShouldRevalidate:h});g?y.startTransition(()=>N()):N()}},[b,v,_,i,o,c,s,n,u,d,m,h,g])}function _p(n){Ln(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(Pf(n)),i=y.useRef(!1),o=Lt(),c=y.useMemo(()=>d2(o.search,i.current?null:s.current),[o.search]),u=Rc(),d=y.useCallback((m,h)=>{const g=Pf(typeof m=="function"?m(new URLSearchParams(c)):m);i.current=!0,u("?"+g,h)},[u,c]);return[c,d]}var I2=0,B2=()=>`__${String(++I2)}__`;function L2(){let{router:n}=Nb("useSubmit"),{basename:s}=y.useContext(Sn),i=e2(),o=n.fetch,c=n.navigate;return y.useCallback(async(u,d={})=>{let{action:m,method:h,encType:g,formData:v,body:b}=m2(u,s);if(d.navigate===!1){let _=d.fetcherKey||B2();await o(_,i,d.action||m,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:b,formMethod:d.method||h,formEncType:d.encType||g,flushSync:d.flushSync})}else await c(d.action||m,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:b,formMethod:d.method||h,formEncType:d.encType||g,replace:d.replace,state:d.state,fromRouteId:i,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,c,s,i])}function U2(n,{relative:s}={}){let{basename:i}=y.useContext(Sn),o=y.useContext(Un);dt(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),u={...Er(n||".",{relative:s})},d=Lt();if(n==null){u.search=d.search;let m=new URLSearchParams(u.search),h=m.getAll("index");if(h.some(v=>v==="")){m.delete("index"),h.filter(b=>b).forEach(b=>m.append("index",b));let v=m.toString();u.search=v?`?${v}`:""}}return(!n||n===".")&&c.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(u.pathname=u.pathname==="/"?i:ss([i,u.pathname])),xr(u)}function z2(n,{relative:s}={}){let i=y.useContext(gb);dt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=Nb("useViewTransitionState"),c=Er(n,{relative:s});if(!i.isTransitioning)return!1;let u=Os(i.currentLocation.pathname,o)||i.currentLocation.pathname,d=Os(i.nextLocation.pathname,o)||i.nextLocation.pathname;return Sr(c.pathname,d)!=null||Sr(c.pathname,u)!=null}function St(){const n=Rc();return y.useCallback((s,i)=>{typeof s=="number"?n(s):n(s,i)},[n])}function jb(n){return`/sessions/${encodeURIComponent(n)}`}function Wi(n,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(n)}`:`/workspaces/${encodeURIComponent(n)}`}function os(n,s,i,o){const c=encodeURIComponent(n);let u;return i&&o?u=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(i)}/tasks/${c}`:i?u=`/workspaces/${encodeURIComponent(i)}/tasks/${c}`:u=`/tasks/${c}`,s?`${u}/${s}`:u}function ei(n,s,i){const o=new URLSearchParams;n&&o.set("workspace",n),s&&o.set("parent",s);const c=o.toString();if(n&&i){const u=`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(n)}/tasks/new`;return s?`${u}?parent=${encodeURIComponent(s)}`:u}return c?`/tasks/new?${c}`:"/tasks/new"}function Cb(n){return`/sessions/new?${new URLSearchParams({env:n}).toString()}`}const Xi="/environments",P2="/environments/new";function Qi(n){return`/environments/${encodeURIComponent(n)}`}function V2(n){return`/environments/${encodeURIComponent(n)}/edit`}const Ji="/settings",H2="/settings/credentials",af="/settings/personas",q2="/settings/personas/new";function Eb(n){return`/settings/personas/${encodeURIComponent(n)}`}const G2="/settings/shortcuts",$2="/pair",F2="/chat",Ya="/",Z2="/tasks",Ab="/workspaces/new",Db="/knowledge",K2=FT,Y2={task:rk};function J2({workspaceId:n,environmentId:s,tasks:i,resolvedThemeId:o}){const c=St(),u=y.useMemo(()=>i.filter(b=>b.workspaceId===n),[i,n]),{nodes:d,edges:m}=VT(u),h=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[S,T]of Object.entries(K2))_[S]=b.getPropertyValue(T).trim()||"#6b7a8d";return _},[o]),g=y.useCallback((b,_)=>{c(os(_.id,void 0,n,s))},[c,n,s]),v=y.useCallback(b=>{const _=b.data;return h[_.task.status]||h.pending},[h]);return u.length===0?l.jsxs("div",{className:nn.emptyCta,children:[l.jsx("button",{className:nn.ctaButton,onClick:()=>c(ei(n,void 0,s)),children:"Create Task"}),l.jsx("div",{className:nn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):l.jsx("div",{className:nn.dagContainer,children:l.jsxs(WS,{nodes:d,edges:m,nodeTypes:Y2,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[l.jsx(XS,{variant:QS.Dots,gap:24,size:1,color:"var(--text-disabled)"}),l.jsx(eT,{showInteractive:!1}),l.jsx(tT,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const W2="_breadcrumbs_17or2_1",X2="_list_17or2_11",Q2="_item_17or2_21",ew="_separator_17or2_28",tw="_link_17or2_34",nw="_current_17or2_57",Vi={breadcrumbs:W2,list:X2,item:Q2,separator:ew,link:tw,current:nw},sw="›";function ya({segments:n}){return l.jsx("nav",{className:Vi.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:l.jsx("ol",{className:Vi.list,children:n.map((s,i)=>{const o=i===n.length-1;return l.jsxs("li",{className:Vi.item,children:[i>0&&l.jsx("span",{className:Vi.separator,"aria-hidden":"true",children:sw}),s.url&&!o?l.jsx(bp,{className:Vi.link,to:s.url,title:s.label,children:s.label}):l.jsx("span",{className:Vi.current,"aria-current":"page",title:s.label,children:s.label})]},i)})})})}const aw="_btn_dwk2o_1",iw="_sm_dwk2o_22",ow="_md_dwk2o_28",rw="_lg_dwk2o_34",lw="_primary_dwk2o_40",cw="_danger_dwk2o_55",uw="_outline_dwk2o_70",dw="_ghost_dwk2o_80",of={btn:aw,sm:iw,md:ow,lg:rw,primary:lw,danger:cw,outline:uw,ghost:dw},As=y.forwardRef(function({variant:s="primary",size:i="md",className:o,children:c,...u},d){const m=[of.btn,of[s],of[i],o].filter(Boolean).join(" ");return l.jsx("button",{ref:d,className:m,...u,children:c})}),fw="_copyButton_1bqk0_1",pw={copyButton:fw},mw=2e3;function ti({text:n,className:s,"data-testid":i}){const[o,c]=y.useState(!1),u=y.useRef(void 0);y.useEffect(()=>()=>{u.current!==void 0&&clearTimeout(u.current)},[]);const d=y.useCallback(async()=>{try{await navigator.clipboard.writeText(n),c(!0),u.current!==void 0&&clearTimeout(u.current),u.current=setTimeout(()=>{c(!1),u.current=void 0},mw)}catch{}},[n]);return l.jsx("button",{type:"button",className:`${pw.copyButton} ${s??""}`,onClick:()=>{d().catch(()=>{})},"aria-label":o?"Copied":"Copy to clipboard","data-testid":i??"copy-button",children:o?"✓":"📋"})}const hw="_banner_bxqlh_1",gw="_label_bxqlh_15",vw="_text_bxqlh_25",yw="_link_bxqlh_29",Ql={banner:hw,label:gw,text:vw,link:yw};function bw(){return l.jsxs("div",{className:Ql.banner,"data-testid":"demo-banner",children:[l.jsx("span",{className:Ql.label,children:"DEMO"}),l.jsxs("span",{className:Ql.text,children:["This is an interactive demo with mock data."," ",l.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:Ql.link,children:"Install Grackle"})," ","to use it for real."]})]})}const _w="_container_og0yp_1",xw="_chevronButton_og0yp_6",Sw="_mainButton_og0yp_6",Tw="_sm_og0yp_34",kw="_md_og0yp_34",ww="_lg_og0yp_34",Nw="_primary_og0yp_57",jw="_danger_og0yp_70",Cw="_outline_og0yp_83",Ew="_ghost_og0yp_92",Aw="_dropdown_og0yp_100",Dw="_option_og0yp_113",Rw="_optionLabel_og0yp_130",Mw="_optionDesc_og0yp_135",js={container:_w,chevronButton:xw,mainButton:Sw,sm:Tw,md:kw,lg:ww,primary:Nw,danger:jw,outline:Cw,ghost:Ew,dropdown:Aw,option:Dw,optionLabel:Rw,optionDesc:Mw};function Rb({label:n,onClick:s,options:i,variant:o="primary",size:c="md","data-testid":u}){const[d,m]=y.useState(!1),h=y.useRef(null);y.useEffect(()=>{if(!d)return;function _(S){h.current&&S.target instanceof Node&&!h.current.contains(S.target)&&m(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[d]),y.useEffect(()=>{if(!d)return;function _(S){S.key==="Escape"&&m(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[d]);const g=js[o]||"",v=js[c]||"",b=()=>{d&&m(!1),s()};return l.jsxs("div",{ref:h,className:js.container,"data-testid":u,children:[l.jsx("button",{type:"button",className:`${js.mainButton} ${g} ${v}`,onClick:b,"data-testid":u?`${u}-main`:void 0,children:n}),l.jsx("button",{type:"button",className:`${js.chevronButton} ${g} ${v}`,onClick:()=>m(_=>!_),"aria-label":`More options for ${n}`,"aria-haspopup":"menu","aria-expanded":d,"data-testid":u?`${u}-chevron`:void 0,children:"▾"}),d&&l.jsx("div",{className:js.dropdown,"data-testid":u?`${u}-menu`:void 0,children:i.map((_,S)=>l.jsxs("button",{type:"button",className:js.option,onClick:()=>{_.onClick(),m(!1)},children:[l.jsx("span",{className:js.optionLabel,children:_.label}),_.description&&l.jsx("span",{className:js.optionDesc,children:_.description})]},S))})]})}function Vf(){Vf=function(c,u){return new i(c,void 0,u)};var n=RegExp.prototype,s=new WeakMap;function i(c,u,d){var m=new RegExp(c,u);return s.set(m,d||s.get(c)),yc(m,i.prototype)}function o(c,u){var d=s.get(u);return Object.keys(d).reduce(function(m,h){var g=d[h];if(typeof g=="number")m[h]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;m[h]=c[g[v]]}return m},Object.create(null))}return(function(c,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(u&&u.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),u&&yc(c,u)})(i,RegExp),i.prototype.exec=function(c){var u=n.exec.call(this,c);if(u){u.groups=o(u,this);var d=u.indices;d&&(d.groups=o(d,this))}return u},i.prototype[Symbol.replace]=function(c,u){if(typeof u=="string"){var d=s.get(this);return n[Symbol.replace].call(this,c,u.replace(/\$<([^>]+)>/g,function(h,g){var v=d[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof u=="function"){var m=this;return n[Symbol.replace].call(this,c,function(){var h=arguments;return typeof h[h.length-1]!="object"&&(h=[].slice.call(h)).push(o(h,m)),u.apply(this,h)})}return n[Symbol.replace].call(this,c,u)},Vf.apply(this,arguments)}function yc(n,s){return yc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},yc(n,s)}function y0(n,s){(s==null||s>n.length)&&(s=n.length);for(var i=0,o=new Array(s);i<s;i++)o[i]=n[i];return o}function rf(n,s){var i=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i)return(i=i.call(n)).next.bind(i);if(Array.isArray(n)||(i=(function(c,u){if(c){if(typeof c=="string")return y0(c,u);var d=Object.prototype.toString.call(c).slice(8,-1);return d==="Object"&&c.constructor&&(d=c.constructor.name),d==="Map"||d==="Set"?Array.from(c):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?y0(c,u):void 0}})(n))||s){i&&(n=i);var o=0;return function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
38
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Ow=(function(n){return function(s){return s===void 0&&(s={}),(function(o,c){if(c&&!o.registered(c))throw new Error('The default language "'+c+'" is not registered with refractor.')})(n,s.defaultLanguage),function(o){mT(o,"element",i)};function i(o,c,u){var d,m;if(u&&u.tagName==="pre"&&o.tagName==="code"){var h=(o==null||(d=o.data)==null?void 0:d.meta)||(o==null||(m=o.properties)==null?void 0:m.metastring)||"";o.properties.className?typeof o.properties.className=="boolean"?o.properties.className=[]:Array.isArray(o.properties.className)||(o.properties.className=[o.properties.className]):o.properties.className=[];var g,v,b=(function(D){for(var E,H=rf(D.properties.className);!(E=H()).done;){var z=E.value;if(z.slice(0,9)==="language-")return z.slice(9).toLowerCase()}return null})(o);if(!b&&s.defaultLanguage&&o.properties.className.push("language-"+(b=s.defaultLanguage)),o.properties.className.push("code-highlight"),b)try{var _,S;S=(_=b)!=null&&_.includes("diff-")?b.split("-")[1]:b,g=n.highlight(Wl(o),S),u.properties.className=(u.properties.className||[]).concat("language-"+S)}catch(D){if(!s.ignoreMissing||!/Unknown language/.test(D.message))throw D;g=o}else g=o;g.children=(v=1,function D(E){return E.reduce(function(H,z){if(z.type==="text"){var Z=z.value,F=(Z.match(/\n/g)||"").length;if(F===0)z.position={start:{line:v,column:1},end:{line:v,column:1}},H.push(z);else for(var Q,ae=Z.split(`
|
|
39
|
+
`),pe=rf(ae.entries());!(Q=pe()).done;){var oe=Q.value,X=oe[0],B=oe[1];H.push({type:"text",value:X===ae.length-1?B:B+`
|
|
40
|
+
`,position:{start:{line:v+X,column:1},end:{line:v+X,column:1}}})}return v+=F,H}if(Object.prototype.hasOwnProperty.call(z,"children")){var $=v;return z.children=D(z.children),H.push(z),z.position={start:{line:$,column:1},end:{line:v,column:1}},H}return H.push(z),H},[])})(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 T,N=(function(D){var E=/{([\d,-]+)}/,H=D.split(",").map(function(F){return F.trim()}).join();if(E.test(H)){var z=E.exec(H)[1],Z=gT(z);return function(F){return Z.includes(F+1)}}return function(){return!1}})(h),j=(function(D){var E=Vf(/showLineNumbers=(\d+)/i,{lines:1});if(E.test(D)){var H=E.exec(D);return Number(H.groups.lines)}return 1})(h),w=(function(D){for(var E=new Array(D),H=0;H<D;H++)E[H]={type:"element",tagName:"span",properties:{className:[]},children:[]};return E})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],A=function(){var D,E,H=T.value,z=H[0],Z=H[1];Z.properties.className=["code-line"];var F=vT(g,function(Q){return Q.position.start.line<=z+1&&Q.position.end.line>=z+1});Z.children=F.children,(h.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!C.some(function(Q){return h.toLowerCase().includes(Q)})&&(Z.properties.line=[(z+j).toString()],Z.properties.className.push("line-number")),N(z)&&Z.properties.className.push("highlight-line"),(b==="diff"||(D=b)!=null&&D.includes("diff-"))&&Wl(Z).substring(0,1)==="-"?Z.properties.className.push("deleted"):(b==="diff"||(E=b)!=null&&E.includes("diff-"))&&Wl(Z).substring(0,1)==="+"&&Z.properties.className.push("inserted")},M=rf(w.entries());!(T=M()).done;)A();w.length>0&&Wl(w[w.length-1]).trim()===""&&w.pop(),o.children=w}}}})(hT);function Mb(n){if(n>=1e6)return`${(n/1e6).toFixed(1)}M`;if(n>=1e3){const s=Number((n/1e3).toFixed(1));return s>=1e3?`${(n/1e6).toFixed(1)}M`:`${s.toFixed(1)}k`}return String(n)}function eo(n){return n===0?"-":n<.01?`$${n.toFixed(4)}`:`$${n.toFixed(2)}`}const Iw={read:"file-read",view:"file-read",edit:"file-edit",file_change:"file-edit",write:"file-write",bash:"shell",command_execution:"shell",grep:"search",glob:"search",todowrite:"todo",update_plan:"todo",todo_write:"todo",report_intent:"metadata"};function Bw(n){return Iw[n.toLowerCase()]??"generic"}const Lw="_card_17a7m_2",Uw="_cardBlue_17a7m_20",zw="_cardOrange_17a7m_24",Pw="_cardGreen_17a7m_28",Vw="_cardPurple_17a7m_32",Hw="_cardNeutral_17a7m_36",qw="_cardRed_17a7m_40",Gw="_header_17a7m_44",$w="_icon_17a7m_51",Fw="_toolName_17a7m_58",Zw="_fileName_17a7m_65",Kw="_badge_17a7m_74",Yw="_spacer_17a7m_81",Jw="_bodyToggle_17a7m_85",Ww="_chevron_17a7m_103",Xw="_chevronExpanded_17a7m_108",Qw="_pre_17a7m_112",eN="_diffAdd_17a7m_136",tN="_diffRemove_17a7m_148",nN="_diffContext_17a7m_160",sN="_diffHeader_17a7m_169",aN="_diffLine_17a7m_175",iN="_exitOk_17a7m_181",oN="_exitError_17a7m_187",rN="_exitPending_17a7m_193",lN="_copyButtonInline_17a7m_207",cN="_inProgress_17a7m_221",uN="_metadata_17a7m_225",dN="_metadataPrefix_17a7m_232",se={card:Lw,cardBlue:Uw,cardOrange:zw,cardGreen:Pw,cardPurple:Vw,cardNeutral:Hw,cardRed:qw,header:Gw,icon:$w,toolName:Fw,fileName:Zw,badge:Kw,spacer:Yw,bodyToggle:Jw,chevron:Ww,chevronExpanded:Xw,pre:Qw,diffAdd:eN,diffRemove:tN,diffContext:nN,diffHeader:sN,diffLine:aN,exitOk:iN,exitError:oN,exitPending:rN,copyButtonInline:lN,inProgress:cN,metadata:uN,metadataPrefix:dN};function fN(n){if(n==null||typeof n!="object")return"";const s=n;return typeof s.file_path=="string"?s.file_path:typeof s.path=="string"?s.path:""}function pN(n){const s=n.split(/[/\\]/);return s[s.length-1]||n}const lf=5;function b0({tool:n,args:s,result:i,isError:o,writeVariant:c}){const[u,d]=y.useState(!1),m=fN(s),h=pN(m),g=i===void 0,v=o?se.cardRed:c?se.cardGreen:se.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?"📝":"📄",S=c?"tool-card-file-write":"tool-card-file-read",T=(i==null?void 0:i.split(`
|
|
41
|
+
`))??[],N=T.length>lf,j=u?T:T.slice(0,lf);return l.jsxs("div",{className:`${se.card} ${v} ${g?se.inProgress:""}`,"data-testid":S,children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,children:_}),l.jsx("span",{className:se.toolName,style:{color:b},children:n}),h&&l.jsx("span",{className:se.fileName,title:m,children:h}),!g&&T.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:se.spacer}),l.jsxs("span",{className:se.badge,children:[T.length," lines"]})]}),!g&&!o&&i&&l.jsx(ti,{text:i,"data-testid":"tool-card-copy",className:se.copyButtonInline})]}),o&&i&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-error",children:i}),!o&&!g&&T.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:se.pre,"data-testid":"tool-card-content",children:j.map((w,C)=>l.jsxs("span",{className:se.diffLine,children:[l.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),w]},C))}),N&&l.jsxs("button",{type:"button",className:se.bodyToggle,onClick:()=>{d(w=>!w)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${se.chevron} ${u?se.chevronExpanded:""}`,children:"▸"}),u?"collapse":`${T.length-lf} more lines`]})]})]})}function mN(n){const s=n.split(`
|
|
42
|
+
`),i=[];for(const o of s)o.startsWith("diff --git")||o.startsWith("index ")||(o.startsWith("--- ")||o.startsWith("+++ "))&&!o.startsWith("---- ")&&!o.startsWith("++++ ")||(o.startsWith("@@")?i.push({type:"header",content:o}):o.startsWith("+")?i.push({type:"add",content:o.slice(1)}):o.startsWith("-")?i.push({type:"remove",content:o.slice(1)}):o.startsWith(" ")?i.push({type:"context",content:o.slice(1)}):o===""&&i.push({type:"context",content:""}));return i}function hN(n,s){const i=n.split(`
|
|
43
|
+
`),o=s.split(`
|
|
44
|
+
`),c=[];for(const u of i)c.push({type:"remove",content:u});for(const u of o)c.push({type:"add",content:u});return c}function gN(n){let s=0,i=0;for(const o of n)o.type==="add"&&s++,o.type==="remove"&&i++;return{added:s,removed:i}}function vN(n){if(n==null||typeof n!="object")return"";const s=n;return typeof s.file_path=="string"&&s.file_path||typeof s.path=="string"&&s.path||""}function yN(n){if(n===void 0||typeof n!="object"||n===null)return;const s=n,i=(typeof s.old_string=="string"?s.old_string:void 0)??(typeof s.old_str=="string"?s.old_str:void 0),o=(typeof s.new_string=="string"?s.new_string:void 0)??(typeof s.new_str=="string"?s.new_str:void 0);if(i!==void 0&&o!==void 0)return{oldStr:i,newStr:o}}function bN(n){const s=n.split(/[/\\]/);return s[s.length-1]||n}function _N(n,s){if(s){let o=s;if(s.trimStart().startsWith("{"))try{const c=JSON.parse(s);typeof c.detailedContent=="string"&&(o=c.detailedContent)}catch{}if(o.includes("@@")||o.startsWith("diff ")){const c=mN(o);if(c.length>0)return c}}const i=yN(n);if(i)return hN(i.oldStr,i.newStr)}const cf=5;function xN({tool:n,args:s,result:i,isError:o,detailedResult:c}){const[u,d]=y.useState(!1),m=vN(s),h=bN(m),g=i===void 0,v=_N(s,c),b=v?gN(v):null,_=((v==null?void 0:v.length)??0)>cf,S=u?v:v==null?void 0:v.slice(0,cf);return l.jsxs("div",{className:`${se.card} ${o?se.cardRed:se.cardOrange} ${g?se.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,children:"✏️"}),l.jsx("span",{className:se.toolName,style:{color:"var(--accent-yellow)"},children:n}),h&&l.jsx("span",{className:se.fileName,title:m,children:h}),b&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:se.spacer}),l.jsxs("span",{className:se.badge,"data-testid":"tool-card-diff-stats",children:[l.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",l.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]}),!g&&!o&&(v||i)&&l.jsx(ti,{text:v?v.map(T=>`${T.type==="add"?"+":T.type==="remove"?"-":T.type==="header"?"":" "}${T.content}`).join(`
|
|
45
|
+
`):i,"data-testid":"tool-card-copy",className:se.copyButtonInline})]}),o&&i&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-error",children:i}),!o&&S&&S.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:se.pre,"data-testid":"tool-card-diff",children:S.map((T,N)=>{let j=se.diffContext;return T.type==="add"&&(j=se.diffAdd),T.type==="remove"&&(j=se.diffRemove),T.type==="header"&&(j=se.diffHeader),l.jsx("span",{className:`${se.diffLine} ${j}`,children:T.content},N)})}),_&&l.jsxs("button",{type:"button",className:se.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${se.chevron} ${u?se.chevronExpanded:""}`,children:"▸"}),u?"collapse":`${((v==null?void 0:v.length)??0)-cf} more lines`]})]}),!o&&!v&&!g&&i&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-content",children:i})]})}const SN=/^\[exit (\d+)\]\s*/;function TN(n){const s=SN.exec(n);return s?{exitCode:Number(s[1]),output:n.slice(s[0].length)}:{exitCode:void 0,output:n}}function kN(n){if(n==null||typeof n!="object")return"";const s=n;return typeof s.command=="string"?s.command:""}function wN(n){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'(.+?)'\s*$/i.exec(n);if(s)return s[1];const i=/pwsh(?:\.exe)?["']?\s+-Command\s+"(.+?)"\s*$/i.exec(n);return i?i[1]:n}const uf=3;function NN({tool:n,args:s,result:i,isError:o}){const[c,u]=y.useState(!1),d=kN(s),m=wN(d),h=i===void 0,g=i?TN(i):null,v=(g==null?void 0:g.output.split(`
|
|
46
|
+
`))??[],b=v.length>uf,_=c?v:v.slice(0,uf),S=g==null?void 0:g.exitCode,T=o||S!==void 0&&S!==0;return l.jsxs("div",{className:`${se.card} ${T?se.cardRed:se.cardNeutral}`,"data-testid":"tool-card-shell",children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),l.jsx("span",{className:se.fileName,style:{flex:1,color:"var(--text-primary)"},title:d!==m?d:void 0,"data-testid":"tool-card-command",children:m}),S!==void 0&&l.jsxs("span",{className:S===0?se.exitOk:se.exitError,"data-testid":"tool-card-exit-code",children:[S===0?"✓":"✗"," exit ",S]}),!h&&g&&g.output.length>0&&l.jsx(ti,{text:g.output,"data-testid":"tool-card-copy",className:se.copyButtonInline}),h&&l.jsx("span",{className:se.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),!h&&g&&g.output.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:se.pre,"data-testid":"tool-card-output",children:_.join(`
|
|
47
|
+
`)}),b&&l.jsxs("button",{type:"button",className:se.bodyToggle,onClick:()=>{u(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${se.chevron} ${c?se.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-uf} more lines`]})]})]})}function jN(n){if(n==null||typeof n!="object")return{pattern:"",path:""};const s=n,i=typeof s.pattern=="string"?s.pattern:"",o=typeof s.path=="string"?s.path:"";return{pattern:i,path:o}}const df=5;function CN({tool:n,args:s,result:i,isError:o}){const[c,u]=y.useState(!1),{pattern:d,path:m}=jN(s),h=i===void 0,g=(i==null?void 0:i.split(`
|
|
48
|
+
`).filter(_=>_.length>0))??[],v=g.length>df,b=c?g:g.slice(0,df);return l.jsxs("div",{className:`${se.card} ${o?se.cardRed:se.cardPurple} ${h?se.inProgress:""}`,"data-testid":"tool-card-search",children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,children:"🔍"}),l.jsx("span",{className:se.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:n}),d&&l.jsxs("span",{className:se.fileName,"data-testid":"tool-card-pattern",children:['"',d,'"']}),m&&l.jsxs("span",{className:se.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",m]}),!h&&!o&&g.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:se.spacer}),l.jsxs("span",{className:se.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]}),!h&&!o&&i&&l.jsx(ti,{text:i,"data-testid":"tool-card-copy",className:se.copyButtonInline})]}),o&&i&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&b.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:se.pre,"data-testid":"tool-card-results",children:b.join(`
|
|
49
|
+
`)}),v&&l.jsxs("button",{type:"button",className:se.bodyToggle,onClick:()=>{u(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${se.chevron} ${c?se.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.length-df} more matches`]})]})]})}const EN="_progressBar_14f5c_1",AN="_progressFill_14f5c_9",DN="_activeTask_14f5c_16",RN="_activeIcon_14f5c_27",MN="_todoPulse_14f5c_1",ON="_activeText_14f5c_34",IN="_checklist_14f5c_48",BN="_item_14f5c_55",LN="_itemIcon_14f5c_65",UN="_itemText_14f5c_73",zN="_pending_14f5c_78",PN="_in_progress_14f5c_85",VN="_completed_14f5c_97",HN="_emptyMessage_14f5c_108",Fn={progressBar:EN,progressFill:AN,activeTask:DN,activeIcon:RN,todoPulse:MN,activeText:ON,checklist:IN,item:BN,itemIcon:LN,itemText:UN,pending:zN,in_progress:PN,completed:VN,emptyMessage:HN},qN=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function GN(n){if(n===void 0||typeof n!="object"||n===null)return[];const s=n;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:_0(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:_0(i.status)})):typeof s.content=="string"?$N(s.content):[]}function _0(n){switch(n.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 $N(n){const s=n.split(`
|
|
50
|
+
`),i=[];for(const o of s){const c=qN.exec(o.trim());if(c){const u=c[1],d=c[2].trim();let m="pending";u==="x"||u==="X"?m="completed":(u==="~"||u==="/"||u==="!")&&(m="in_progress"),i.push({content:d,status:m})}}return i}function FN(n){switch(n){case"completed":return"✓";case"in_progress":return"●";default:return"○"}}function ZN({args:n}){const s=GN(n),i=s.filter(u=>u.status==="completed").length,o=s.find(u=>u.status==="in_progress"),c=s.length===0;return l.jsxs("div",{className:`${se.card} ${se.cardBlue}`,"data-testid":"tool-card-todo",children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,children:"☑"}),l.jsx("span",{className:se.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:se.spacer}),l.jsxs("span",{className:se.badge,"data-testid":"tool-card-todo-progress",children:[i,"/",s.length]})]})]}),!c&&l.jsx("div",{className:Fn.progressBar,"data-testid":"tool-card-todo-bar",children:l.jsx("div",{className:Fn.progressFill,style:{width:`${i/s.length*100}%`}})}),o&&l.jsxs("div",{className:Fn.activeTask,"data-testid":"tool-card-todo-active",children:[l.jsx("span",{className:Fn.activeIcon,children:"●"}),l.jsx("span",{className:Fn.activeText,children:o.activeForm||o.content})]}),!c&&l.jsx("div",{className:Fn.checklist,"data-testid":"tool-card-todo-list",children:s.map((u,d)=>l.jsxs("div",{className:`${Fn.item} ${Fn[u.status]}`,"data-testid":"tool-card-todo-item",children:[l.jsx("span",{className:Fn.itemIcon,children:FN(u.status)}),l.jsx("span",{className:Fn.itemText,children:u.content})]},d))}),c&&l.jsx("div",{className:Fn.emptyMessage,children:"All items completed and cleared."})]})}function KN(n,s){if(s==null||typeof s!="object")return"";const i=s;if(typeof i.intent=="string")return i.intent;for(const o of Object.values(i))if(typeof o=="string")return o;return n}function YN({tool:n,args:s}){const i=KN(n,s);return l.jsxs("div",{className:se.metadata,"data-testid":"tool-card-metadata",children:[l.jsx("span",{className:se.metadataPrefix,children:"↳"}),i]})}function JN(n){const s=/^mcp__(.+?)__(.+)$/.exec(n);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:n,isMcp:!1}}function WN(n){if(n==null)return"";if(typeof n!="object")return String(n);const s=n;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(n);return i.length>120?`${i.slice(0,120)}…`:i}catch{return""}}const ff=5;function XN({tool:n,args:s,result:i,isError:o}){const[c,u]=y.useState(!1),{display:d}=JN(n),m=WN(s),h=i===void 0,g=(i==null?void 0:i.split(`
|
|
51
|
+
`))??[],v=g.length>ff,b=c?i:g.slice(0,ff).join(`
|
|
52
|
+
`);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return l.jsxs("div",{className:`${se.card} ${o?se.cardRed:se.cardBlue} ${h?se.inProgress:""}`,"data-testid":"tool-card-generic",children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,children:"⚙"}),l.jsx("span",{className:se.toolName,style:{color:"var(--accent-blue)"},children:d}),m&&l.jsx("span",{className:se.fileName,children:m}),!h&&!o&&i&&l.jsx(ti,{text:i,"data-testid":"tool-card-copy",className:se.copyButtonInline})]}),h&&_&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-args",children:_}),o&&i&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&i&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:se.pre,"data-testid":"tool-card-result",children:b}),v&&l.jsxs("button",{type:"button",className:se.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${se.chevron} ${c?se.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.length-ff} more lines`]})]})]})}function pf(n){switch(Bw(n.tool)){case"file-read":return l.jsx(b0,{...n});case"file-edit":return l.jsx(xN,{...n});case"file-write":return l.jsx(b0,{...n,writeVariant:!0});case"shell":return l.jsx(NN,{...n});case"search":return l.jsx(CN,{...n});case"todo":return l.jsx(ZN,{...n});case"metadata":return l.jsx(YN,{...n});default:return l.jsx(XN,{...n})}}const QN="_systemContextEvent_8n7q0_1",ej="_systemContextHeader_8n7q0_7",tj="_systemContextBadge_8n7q0_28",nj="_systemContextToggle_8n7q0_37",sj="_systemContextPre_8n7q0_43",aj="_systemContextEllipsis_8n7q0_54",ij="_systemEvent_8n7q0_58",oj="_systemTimestamp_8n7q0_65",rj="_textEvent_8n7q0_69",lj="_messageCopyButton_8n7q0_75",cj="_codeBlockWrapper_8n7q0_159",uj="_codeBlockCopyButton_8n7q0_162",dj="_errorEvent_8n7q0_166",fj="_statusEvent_8n7q0_174",pj="_userInputEvent_8n7q0_183",mj="_userInputContent_8n7q0_189",hj="_signalEvent_8n7q0_206",gj="_signalBadge_8n7q0_217",vj="_signalContent_8n7q0_226",yj="_usageEvent_8n7q0_231",bj="_usageBadge_8n7q0_238",_j="_defaultEvent_8n7q0_247",xt={systemContextEvent:QN,systemContextHeader:ej,systemContextBadge:tj,systemContextToggle:nj,systemContextPre:sj,systemContextEllipsis:aj,systemEvent:ij,systemTimestamp:oj,textEvent:rj,messageCopyButton:lj,codeBlockWrapper:cj,codeBlockCopyButton:uj,errorEvent:dj,statusEvent:fj,userInputEvent:pj,userInputContent:mj,signalEvent:hj,signalBadge:gj,signalContent:vj,usageEvent:yj,usageBadge:bj,defaultEvent:_j},x0=3;function xj({content:n}){const[s,i]=y.useState(!1),o=n.split(`
|
|
53
|
+
`),c=o.length>x0,u=s?n:o.slice(0,x0).join(`
|
|
54
|
+
`);return l.jsxs("div",{className:xt.systemContextEvent,"data-testid":"system-context-event",children:[l.jsxs("button",{type:"button",className:xt.systemContextHeader,onClick:()=>{i(d=>!d)},"aria-expanded":s,children:[l.jsx("span",{className:xt.systemContextBadge,children:"SYSTEM PROMPT"}),c&&l.jsx("span",{className:xt.systemContextToggle,"aria-hidden":"true",children:s?"▾":"▸"})]}),l.jsxs("pre",{className:xt.systemContextPre,children:[u,!s&&c&&l.jsx("span",{className:xt.systemContextEllipsis,children:"…"})]})]})}function Sj({time:n,content:s}){return l.jsxs("div",{className:xt.systemEvent,children:[l.jsxs("span",{className:xt.systemTimestamp,children:["[",n,"]"]})," ",s]})}function Hf(n){return typeof n=="string"?n:typeof n=="number"?String(n):Array.isArray(n)?n.map(Hf).join(""):n!=null&&typeof n=="object"&&"props"in n?Hf(n.props.children):""}function Tj({children:n,node:s,...i}){const o=Hf(n);return l.jsxs("div",{className:xt.codeBlockWrapper,children:[l.jsx("pre",{...i,children:n}),l.jsx(ti,{text:o,"data-testid":"copy-code-block",className:xt.codeBlockCopyButton})]})}const kj={pre:Tj};function wj({content:n}){return l.jsxs("div",{className:xt.textEvent,children:[l.jsx(ti,{text:n,"data-testid":"copy-message",className:xt.messageCopyButton}),l.jsx(up,{remarkPlugins:[dp],rehypePlugins:[Ow],components:kj,children:n})]})}function Nj({content:n}){return l.jsxs("div",{className:xt.errorEvent,children:["Error: ",n]})}function jj({content:n}){return l.jsxs("div",{className:xt.statusEvent,children:["--- ",n," ---"]})}function Cj({content:n}){return l.jsx("div",{className:xt.userInputEvent,children:l.jsx("span",{className:xt.userInputContent,children:n})})}function Ej({content:n}){return l.jsxs("div",{className:xt.signalEvent,"data-testid":"signal-event",children:[l.jsx("span",{className:xt.signalBadge,children:"SIGNAL"}),l.jsx("span",{className:xt.signalContent,children:n})]})}function Aj({content:n}){let s=n;try{const i=JSON.parse(n),o=Number(i.input_tokens)||0,c=Number(i.output_tokens)||0,u=Mb(o+c),d=eo(Number(i.cost_usd)||0);s=`${u} tokens · ${d}`}catch{}return l.jsx("div",{className:xt.usageEvent,"data-testid":"usage-event",children:l.jsx("span",{className:xt.usageBadge,children:s})})}function Dj({content:n}){return l.jsx("div",{className:xt.defaultEvent,children:n})}function Rj({event:n,toolUseCtx:s}){const i=new Date(n.timestamp).toLocaleTimeString();switch(n.eventType){case"system":{if(n.raw)try{if(JSON.parse(n.raw).systemContext===!0)return l.jsx(xj,{content:n.content})}catch{}return l.jsx(Sj,{time:i,content:n.content})}case"text":case"output":return l.jsx(wj,{content:n.content});case"tool_use":{let o="",c={};try{const u=JSON.parse(n.content);o=u.tool||"",c=u.args}catch{}return l.jsx(pf,{tool:o,args:c})}case"tool_result":{let o=!1;if(n.raw)try{o=JSON.parse(n.raw).is_error===!0}catch{}let c=n.content;if(n.content.trimStart().startsWith("{"))try{const u=JSON.parse(n.content);typeof u.content=="string"&&(c=u.content)}catch{}return s?l.jsx(pf,{tool:s.tool,args:s.args,result:c,isError:o,detailedResult:s.detailedResult}):l.jsx(pf,{tool:"Tool output",args:void 0,result:c,isError:o})}case"error":return l.jsx(Nj,{content:n.content});case"status":return l.jsx(jj,{content:n.content});case"user_input":return l.jsx(Cj,{content:n.content});case"signal":return l.jsx(Ej,{content:n.content});case"usage":return l.jsx(Aj,{content:n.content});default:return l.jsx(Dj,{content:n.content})}}const xp=y.createContext({});function Sp(n){const s=y.useRef(null);return s.current===null&&(s.current=n()),s.current}const Oc=y.createContext(null),Tp=y.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});class Mj extends y.Component{getSnapshotBeforeUpdate(s){const i=this.props.childRef.current;if(i&&s.isPresent&&!this.props.isPresent){const o=this.props.sizeRef.current;o.height=i.offsetHeight||0,o.width=i.offsetWidth||0,o.top=i.offsetTop,o.left=i.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Oj({children:n,isPresent:s}){const i=y.useId(),o=y.useRef(null),c=y.useRef({width:0,height:0,top:0,left:0}),{nonce:u}=y.useContext(Tp);return y.useInsertionEffect(()=>{const{width:d,height:m,top:h,left:g}=c.current;if(s||!o.current||!d||!m)return;o.current.dataset.motionPopId=i;const v=document.createElement("style");return u&&(v.nonce=u),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
|
|
55
|
+
[data-motion-pop-id="${i}"] {
|
|
56
|
+
position: absolute !important;
|
|
57
|
+
width: ${d}px !important;
|
|
58
|
+
height: ${m}px !important;
|
|
59
|
+
top: ${h}px !important;
|
|
60
|
+
left: ${g}px !important;
|
|
61
|
+
}
|
|
62
|
+
`),()=>{document.head.removeChild(v)}},[s]),l.jsx(Mj,{isPresent:s,childRef:o,sizeRef:c,children:y.cloneElement(n,{ref:o})})}const Ij=({children:n,initial:s,isPresent:i,onExitComplete:o,custom:c,presenceAffectsLayout:u,mode:d})=>{const m=Sp(Bj),h=y.useId(),g=y.useCallback(b=>{m.set(b,!0);for(const _ of m.values())if(!_)return;o&&o()},[m,o]),v=y.useMemo(()=>({id:h,initial:s,isPresent:i,custom:c,onExitComplete:g,register:b=>(m.set(b,!1),()=>m.delete(b))}),u?[Math.random(),g]:[i,g]);return y.useMemo(()=>{m.forEach((b,_)=>m.set(_,!1))},[i]),y.useEffect(()=>{!i&&!m.size&&o&&o()},[i]),d==="popLayout"&&(n=l.jsx(Oj,{isPresent:i,children:n})),l.jsx(Oc.Provider,{value:v,children:n})};function Bj(){return new Map}function Ob(n=!0){const s=y.useContext(Oc);if(s===null)return[!0,null];const{isPresent:i,onExitComplete:o,register:c}=s,u=y.useId();y.useEffect(()=>{n&&c(u)},[n]);const d=y.useCallback(()=>n&&o&&o(u),[u,o,n]);return!i&&o?[!1,d]:[!0]}const ec=n=>n.key||"";function S0(n){const s=[];return y.Children.forEach(n,i=>{y.isValidElement(i)&&s.push(i)}),s}const kp=typeof window<"u",Ib=kp?y.useLayoutEffect:y.useEffect,rs=({children:n,custom:s,initial:i=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:u="sync",propagate:d=!1})=>{const[m,h]=Ob(d),g=y.useMemo(()=>S0(n),[n]),v=d&&!m?[]:g.map(ec),b=y.useRef(!0),_=y.useRef(g),S=Sp(()=>new Map),[T,N]=y.useState(g),[j,w]=y.useState(g);Ib(()=>{b.current=!1,_.current=g;for(let M=0;M<j.length;M++){const D=ec(j[M]);v.includes(D)?S.delete(D):S.get(D)!==!0&&S.set(D,!1)}},[j,v.length,v.join("-")]);const C=[];if(g!==T){let M=[...g];for(let D=0;D<j.length;D++){const E=j[D],H=ec(E);v.includes(H)||(M.splice(D,0,E),C.push(E))}u==="wait"&&C.length&&(M=C),w(S0(M)),N(g);return}const{forceRender:A}=y.useContext(xp);return l.jsx(l.Fragment,{children:j.map(M=>{const D=ec(M),E=d&&!m?!1:g===j||v.includes(D),H=()=>{if(S.has(D))S.set(D,!0);else return;let z=!0;S.forEach(Z=>{Z||(z=!1)}),z&&(A==null||A(),w(_.current),d&&(h==null||h()),o&&o())};return l.jsx(Ij,{isPresent:E,initial:!b.current||i?void 0:!1,custom:E?void 0:s,presenceAffectsLayout:c,mode:u,onExitComplete:E?void 0:H,children:M},D)})})},_n=n=>n;let Bb=_n;const Lj={useManualTiming:!1};function Uj(n){let s=new Set,i=new Set,o=!1,c=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function m(g){u.has(g)&&(h.schedule(g),n()),g(d)}const h={schedule:(g,v=!1,b=!1)=>{const S=b&&o?s:i;return v&&u.add(g),S.has(g)||S.add(g),g},cancel:g=>{i.delete(g),u.delete(g)},process:g=>{if(d=g,o){c=!0;return}o=!0,[s,i]=[i,s],s.forEach(m),s.clear(),o=!1,c&&(c=!1,h.process(g))}};return h}const tc=["read","resolveKeyframes","update","preRender","render","postRender"],zj=40;function Lb(n,s){let i=!1,o=!0;const c={delta:0,timestamp:0,isProcessing:!1},u=()=>i=!0,d=tc.reduce((w,C)=>(w[C]=Uj(u),w),{}),{read:m,resolveKeyframes:h,update:g,preRender:v,render:b,postRender:_}=d,S=()=>{const w=performance.now();i=!1,c.delta=o?1e3/60:Math.max(Math.min(w-c.timestamp,zj),1),c.timestamp=w,c.isProcessing=!0,m.process(c),h.process(c),g.process(c),v.process(c),b.process(c),_.process(c),c.isProcessing=!1,i&&s&&(o=!1,n(S))},T=()=>{i=!0,o=!0,c.isProcessing||n(S)};return{schedule:tc.reduce((w,C)=>{const A=d[C];return w[C]=(M,D=!1,E=!1)=>(i||T(),A.schedule(M,D,E)),w},{}),cancel:w=>{for(let C=0;C<tc.length;C++)d[tc[C]].cancel(w)},state:c,steps:d}}const{schedule:ft,cancel:ha,state:Kt,steps:mf}=Lb(typeof requestAnimationFrame<"u"?requestAnimationFrame:_n,!0),Ub=y.createContext({strict:!1}),T0={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},to={};for(const n in T0)to[n]={isEnabled:s=>T0[n].some(i=>!!s[i])};function Pj(n){for(const s in n)to[s]={...to[s],...n[s]}}const Vj=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 bc(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||Vj.has(n)}let zb=n=>!bc(n);function Hj(n){n&&(zb=s=>s.startsWith("on")?!bc(s):n(s))}try{Hj(require("@emotion/is-prop-valid").default)}catch{}function qj(n,s,i){const o={};for(const c in n)c==="values"&&typeof n.values=="object"||(zb(c)||i===!0&&bc(c)||!s&&!bc(c)||n.draggable&&c.startsWith("onDrag"))&&(o[c]=n[c]);return o}function Gj(n){if(typeof Proxy>"u")return n;const s=new Map,i=(...o)=>n(...o);return new Proxy(i,{get:(o,c)=>c==="create"?n:(s.has(c)||s.set(c,n(c)),s.get(c))})}const Ic=y.createContext({});function Tr(n){return typeof n=="string"||Array.isArray(n)}function Bc(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const wp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Np=["initial",...wp];function Lc(n){return Bc(n.animate)||Np.some(s=>Tr(n[s]))}function Pb(n){return!!(Lc(n)||n.variants)}function $j(n,s){if(Lc(n)){const{initial:i,animate:o}=n;return{initial:i===!1||Tr(i)?i:void 0,animate:Tr(o)?o:void 0}}return n.inherit!==!1?s:{}}function Fj(n){const{initial:s,animate:i}=$j(n,y.useContext(Ic));return y.useMemo(()=>({initial:s,animate:i}),[k0(s),k0(i)])}function k0(n){return Array.isArray(n)?n.join(" "):n}const Zj=Symbol.for("motionComponentSymbol");function Gi(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function Kj(n,s,i){return y.useCallback(o=>{o&&n.onMount&&n.onMount(o),s&&(o?s.mount(o):s.unmount()),i&&(typeof i=="function"?i(o):Gi(i)&&(i.current=o))},[s])}const jp=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Yj="framerAppearId",Vb="data-"+jp(Yj),{schedule:Cp}=Lb(queueMicrotask,!1),Hb=y.createContext({});function Jj(n,s,i,o,c){var u,d;const{visualElement:m}=y.useContext(Ic),h=y.useContext(Ub),g=y.useContext(Oc),v=y.useContext(Tp).reducedMotion,b=y.useRef(null);o=o||h.renderer,!b.current&&o&&(b.current=o(n,{visualState:s,parent:m,props:i,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const _=b.current,S=y.useContext(Hb);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&Wj(b.current,i,c,S);const T=y.useRef(!1);y.useInsertionEffect(()=>{_&&T.current&&_.update(i,g)});const N=i[Vb],j=y.useRef(!!N&&!(!((u=window.MotionHandoffIsComplete)===null||u===void 0)&&u.call(window,N))&&((d=window.MotionHasOptimisedAnimation)===null||d===void 0?void 0:d.call(window,N)));return Ib(()=>{_&&(T.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),Cp.render(_.render),j.current&&_.animationState&&_.animationState.animateChanges())}),y.useEffect(()=>{_&&(!j.current&&_.animationState&&_.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{var w;(w=window.MotionHandoffMarkAsComplete)===null||w===void 0||w.call(window,N)}),j.current=!1))}),_}function Wj(n,s,i,o){const{layoutId:c,layout:u,drag:d,dragConstraints:m,layoutScroll:h,layoutRoot:g}=s;n.projection=new i(n.latestValues,s["data-framer-portal-id"]?void 0:qb(n.parent)),n.projection.setOptions({layoutId:c,layout:u,alwaysMeasureLayout:!!d||m&&Gi(m),visualElement:n,animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:h,layoutRoot:g})}function qb(n){if(n)return n.options.allowProjection!==!1?n.projection:qb(n.parent)}function Xj({preloadedFeatures:n,createVisualElement:s,useRender:i,useVisualState:o,Component:c}){var u,d;n&&Pj(n);function m(g,v){let b;const _={...y.useContext(Tp),...g,layoutId:Qj(g)},{isStatic:S}=_,T=Fj(g),N=o(g,S);if(!S&&kp){eC();const j=tC(_);b=j.MeasureLayout,T.visualElement=Jj(c,N,_,s,j.ProjectionNode)}return l.jsxs(Ic.Provider,{value:T,children:[b&&T.visualElement?l.jsx(b,{visualElement:T.visualElement,..._}):null,i(c,g,Kj(N,T.visualElement,v),N,S,T.visualElement)]})}m.displayName=`motion.${typeof c=="string"?c:`create(${(d=(u=c.displayName)!==null&&u!==void 0?u:c.name)!==null&&d!==void 0?d:""})`}`;const h=y.forwardRef(m);return h[Zj]=c,h}function Qj({layoutId:n}){const s=y.useContext(xp).id;return s&&n!==void 0?s+"-"+n:n}function eC(n,s){y.useContext(Ub).strict}function tC(n){const{drag:s,layout:i}=to;if(!s&&!i)return{};const o={...s,...i};return{MeasureLayout:s!=null&&s.isEnabled(n)||i!=null&&i.isEnabled(n)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}const nC=["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 Ep(n){return typeof n!="string"||n.includes("-")?!1:!!(nC.indexOf(n)>-1||/[A-Z]/u.test(n))}function w0(n){const s=[{},{}];return n==null||n.values.forEach((i,o)=>{s[0][o]=i.get(),s[1][o]=i.getVelocity()}),s}function Ap(n,s,i,o){if(typeof s=="function"){const[c,u]=w0(o);s=s(i!==void 0?i:n.custom,c,u)}if(typeof s=="string"&&(s=n.variants&&n.variants[s]),typeof s=="function"){const[c,u]=w0(o);s=s(i!==void 0?i:n.custom,c,u)}return s}const qf=n=>Array.isArray(n),sC=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),aC=n=>qf(n)?n[n.length-1]||0:n,Qt=n=>!!(n&&n.getVelocity);function fc(n){const s=Qt(n)?n.get():n;return sC(s)?s.toValue():s}function iC({scrapeMotionValuesFromProps:n,createRenderState:s,onUpdate:i},o,c,u){const d={latestValues:oC(o,c,u,n),renderState:s()};return i&&(d.onMount=m=>i({props:o,current:m,...d}),d.onUpdate=m=>i(m)),d}const Gb=n=>(s,i)=>{const o=y.useContext(Ic),c=y.useContext(Oc),u=()=>iC(n,s,o,c);return i?u():Sp(u)};function oC(n,s,i,o){const c={},u=o(n,{});for(const _ in u)c[_]=fc(u[_]);let{initial:d,animate:m}=n;const h=Lc(n),g=Pb(n);s&&g&&!h&&n.inherit!==!1&&(d===void 0&&(d=s.initial),m===void 0&&(m=s.animate));let v=i?i.initial===!1:!1;v=v||d===!1;const b=v?m:d;if(b&&typeof b!="boolean"&&!Bc(b)){const _=Array.isArray(b)?b:[b];for(let S=0;S<_.length;S++){const T=Ap(n,_[S]);if(T){const{transitionEnd:N,transition:j,...w}=T;for(const C in w){let A=w[C];if(Array.isArray(A)){const M=v?A.length-1:0;A=A[M]}A!==null&&(c[C]=A)}for(const C in N)c[C]=N[C]}}}return c}const oo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ni=new Set(oo),$b=n=>s=>typeof s=="string"&&s.startsWith(n),Fb=$b("--"),rC=$b("var(--"),Dp=n=>rC(n)?lC.test(n.split("/*")[0].trim()):!1,lC=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Zb=(n,s)=>s&&typeof n=="number"?s.transform(n):n,Is=(n,s,i)=>i>s?s:i<n?n:i,ro={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},kr={...ro,transform:n=>Is(0,1,n)},nc={...ro,default:1},Ar=n=>({test:s=>typeof s=="string"&&s.endsWith(n)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${n}`}),pa=Ar("deg"),as=Ar("%"),Te=Ar("px"),cC=Ar("vh"),uC=Ar("vw"),N0={...as,parse:n=>as.parse(n)/100,transform:n=>as.transform(n*100)},dC={borderWidth:Te,borderTopWidth:Te,borderRightWidth:Te,borderBottomWidth:Te,borderLeftWidth:Te,borderRadius:Te,radius:Te,borderTopLeftRadius:Te,borderTopRightRadius:Te,borderBottomRightRadius:Te,borderBottomLeftRadius:Te,width:Te,maxWidth:Te,height:Te,maxHeight:Te,top:Te,right:Te,bottom:Te,left:Te,padding:Te,paddingTop:Te,paddingRight:Te,paddingBottom:Te,paddingLeft:Te,margin:Te,marginTop:Te,marginRight:Te,marginBottom:Te,marginLeft:Te,backgroundPositionX:Te,backgroundPositionY:Te},fC={rotate:pa,rotateX:pa,rotateY:pa,rotateZ:pa,scale:nc,scaleX:nc,scaleY:nc,scaleZ:nc,skew:pa,skewX:pa,skewY:pa,distance:Te,translateX:Te,translateY:Te,translateZ:Te,x:Te,y:Te,z:Te,perspective:Te,transformPerspective:Te,opacity:kr,originX:N0,originY:N0,originZ:Te},j0={...ro,transform:Math.round},Rp={...dC,...fC,zIndex:j0,size:Te,fillOpacity:kr,strokeOpacity:kr,numOctaves:j0},pC={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},mC=oo.length;function hC(n,s,i){let o="",c=!0;for(let u=0;u<mC;u++){const d=oo[u],m=n[d];if(m===void 0)continue;let h=!0;if(typeof m=="number"?h=m===(d.startsWith("scale")?1:0):h=parseFloat(m)===0,!h||i){const g=Zb(m,Rp[d]);if(!h){c=!1;const v=pC[d]||d;o+=`${v}(${g}) `}i&&(s[d]=g)}}return o=o.trim(),i?o=i(s,c?"":o):c&&(o="none"),o}function Mp(n,s,i){const{style:o,vars:c,transformOrigin:u}=n;let d=!1,m=!1;for(const h in s){const g=s[h];if(ni.has(h)){d=!0;continue}else if(Fb(h)){c[h]=g;continue}else{const v=Zb(g,Rp[h]);h.startsWith("origin")?(m=!0,u[h]=v):o[h]=v}}if(s.transform||(d||i?o.transform=hC(s,n.transform,i):o.transform&&(o.transform="none")),m){const{originX:h="50%",originY:g="50%",originZ:v=0}=u;o.transformOrigin=`${h} ${g} ${v}`}}const gC={offset:"stroke-dashoffset",array:"stroke-dasharray"},vC={offset:"strokeDashoffset",array:"strokeDasharray"};function yC(n,s,i=1,o=0,c=!0){n.pathLength=1;const u=c?gC:vC;n[u.offset]=Te.transform(-o);const d=Te.transform(s),m=Te.transform(i);n[u.array]=`${d} ${m}`}function C0(n,s,i){return typeof n=="string"?n:Te.transform(s+i*n)}function bC(n,s,i){const o=C0(s,n.x,n.width),c=C0(i,n.y,n.height);return`${o} ${c}`}function Op(n,{attrX:s,attrY:i,attrScale:o,originX:c,originY:u,pathLength:d,pathSpacing:m=1,pathOffset:h=0,...g},v,b){if(Mp(n,g,b),v){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:_,style:S,dimensions:T}=n;_.transform&&(T&&(S.transform=_.transform),delete _.transform),T&&(c!==void 0||u!==void 0||S.transform)&&(S.transformOrigin=bC(T,c!==void 0?c:.5,u!==void 0?u:.5)),s!==void 0&&(_.x=s),i!==void 0&&(_.y=i),o!==void 0&&(_.scale=o),d!==void 0&&yC(_,d,m,h,!1)}const Ip=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Kb=()=>({...Ip(),attrs:{}}),Bp=n=>typeof n=="string"&&n.toLowerCase()==="svg";function Yb(n,{style:s,vars:i},o,c){Object.assign(n.style,s,c&&c.getProjectionStyles(o));for(const u in i)n.style.setProperty(u,i[u])}const Jb=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 Wb(n,s,i,o){Yb(n,s,void 0,o);for(const c in s.attrs)n.setAttribute(Jb.has(c)?c:jp(c),s.attrs[c])}const _c={};function _C(n){Object.assign(_c,n)}function Xb(n,{layout:s,layoutId:i}){return ni.has(n)||n.startsWith("origin")||(s||i!==void 0)&&(!!_c[n]||n==="opacity")}function Lp(n,s,i){var o;const{style:c}=n,u={};for(const d in c)(Qt(c[d])||s.style&&Qt(s.style[d])||Xb(d,n)||((o=i==null?void 0:i.getValue(d))===null||o===void 0?void 0:o.liveStyle)!==void 0)&&(u[d]=c[d]);return u}function Qb(n,s,i){const o=Lp(n,s,i);for(const c in n)if(Qt(n[c])||Qt(s[c])){const u=oo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;o[u]=n[c]}return o}function xC(n,s){try{s.dimensions=typeof n.getBBox=="function"?n.getBBox():n.getBoundingClientRect()}catch{s.dimensions={x:0,y:0,width:0,height:0}}}const E0=["x","y","width","height","cx","cy","r"],SC={useVisualState:Gb({scrapeMotionValuesFromProps:Qb,createRenderState:Kb,onUpdate:({props:n,prevProps:s,current:i,renderState:o,latestValues:c})=>{if(!i)return;let u=!!n.drag;if(!u){for(const m in c)if(ni.has(m)){u=!0;break}}if(!u)return;let d=!s;if(s)for(let m=0;m<E0.length;m++){const h=E0[m];n[h]!==s[h]&&(d=!0)}d&&ft.read(()=>{xC(i,o),ft.render(()=>{Op(o,c,Bp(i.tagName),n.transformTemplate),Wb(i,o)})})}})},TC={useVisualState:Gb({scrapeMotionValuesFromProps:Lp,createRenderState:Ip})};function e_(n,s,i){for(const o in s)!Qt(s[o])&&!Xb(o,i)&&(n[o]=s[o])}function kC({transformTemplate:n},s){return y.useMemo(()=>{const i=Ip();return Mp(i,s,n),Object.assign({},i.vars,i.style)},[s])}function wC(n,s){const i=n.style||{},o={};return e_(o,i,n),Object.assign(o,kC(n,s)),o}function NC(n,s){const i={},o=wC(n,s);return n.drag&&n.dragListener!==!1&&(i.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(i.tabIndex=0),i.style=o,i}function jC(n,s,i,o){const c=y.useMemo(()=>{const u=Kb();return Op(u,s,Bp(o),n.transformTemplate),{...u.attrs,style:{...u.style}}},[s]);if(n.style){const u={};e_(u,n.style,n),c.style={...u,...c.style}}return c}function CC(n=!1){return(i,o,c,{latestValues:u},d)=>{const h=(Ep(i)?jC:NC)(o,u,d,i),g=qj(o,typeof i=="string",n),v=i!==y.Fragment?{...g,...h,ref:c}:{},{children:b}=o,_=y.useMemo(()=>Qt(b)?b.get():b,[b]);return y.createElement(i,{...v,children:_})}}function EC(n,s){return function(o,{forwardMotionProps:c}={forwardMotionProps:!1}){const d={...Ep(o)?SC:TC,preloadedFeatures:n,useRender:CC(c),createVisualElement:s,Component:o};return Xj(d)}}function t_(n,s){if(!Array.isArray(s))return!1;const i=s.length;if(i!==n.length)return!1;for(let o=0;o<i;o++)if(s[o]!==n[o])return!1;return!0}function Uc(n,s,i){const o=n.getProps();return Ap(o,s,i!==void 0?i:o.custom,n)}function Up(n,s){return n?n[s]||n.default||n:void 0}const n_=new Set(["width","height","top","left","right","bottom",...oo]);let pc;function AC(){pc=void 0}const is={now:()=>(pc===void 0&&is.set(Kt.isProcessing||Lj.useManualTiming?Kt.timestamp:performance.now()),pc),set:n=>{pc=n,queueMicrotask(AC)}};function zp(n,s){n.indexOf(s)===-1&&n.push(s)}function Pp(n,s){const i=n.indexOf(s);i>-1&&n.splice(i,1)}class Vp{constructor(){this.subscriptions=[]}add(s){return zp(this.subscriptions,s),()=>Pp(this.subscriptions,s)}notify(s,i,o){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,i,o);else for(let u=0;u<c;u++){const d=this.subscriptions[u];d&&d(s,i,o)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function s_(n,s){return s?n*(1e3/s):0}const A0=30,DC=n=>!isNaN(parseFloat(n));class RC{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(o,c=!0)=>{const u=is.now();this.updatedAt!==u&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(o),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=i.owner}setCurrent(s){this.current=s,this.updatedAt=is.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=DC(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 Vp);const o=this.events[s].add(i);return s==="change"?()=>{o(),ft.read(()=>{this.events.change.getSize()||this.stop()})}:o}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,i){this.passiveEffect=s,this.stopPassiveEffect=i}set(s,i=!0){!i||!this.passiveEffect?this.updateAndNotify(s,i):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,i,o){this.set(i),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-o}jump(s,i=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,i&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=is.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>A0)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,A0);return s_(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 wr(n,s){return new RC(n,s)}function MC(n,s,i){n.hasValue(s)?n.getValue(s).set(i):n.addValue(s,wr(i))}function OC(n,s){const i=Uc(n,s);let{transitionEnd:o={},transition:c={},...u}=i||{};u={...u,...o};for(const d in u){const m=aC(u[d]);MC(n,d,m)}}function IC(n){return!!(Qt(n)&&n.add)}function Gf(n,s){const i=n.getValue("willChange");if(IC(i))return i.add(s)}function a_(n){return n.props[Vb]}function Hp(n){let s;return()=>(s===void 0&&(s=n()),s)}const BC=Hp(()=>window.ScrollTimeline!==void 0);class LC{constructor(s){this.stop=()=>this.runAll("stop"),this.animations=s.filter(Boolean)}get finished(){return Promise.all(this.animations.map(s=>"finished"in s?s.finished:s))}getAll(s){return this.animations[0][s]}setAll(s,i){for(let o=0;o<this.animations.length;o++)this.animations[o][s]=i}attachTimeline(s,i){const o=this.animations.map(c=>{if(BC()&&c.attachTimeline)return c.attachTimeline(s);if(typeof i=="function")return i(c)});return()=>{o.forEach((c,u)=>{c&&c(),this.animations[u].stop()})}}get time(){return this.getAll("time")}set time(s){this.setAll("time",s)}get speed(){return this.getAll("speed")}set speed(s){this.setAll("speed",s)}get startTime(){return this.getAll("startTime")}get duration(){let s=0;for(let i=0;i<this.animations.length;i++)s=Math.max(s,this.animations[i].duration);return s}runAll(s){this.animations.forEach(i=>i[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class UC extends LC{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Ds=n=>n*1e3,Rs=n=>n/1e3;function qp(n){return typeof n=="function"}function D0(n,s){n.timeline=s,n.onfinish=null}const Gp=n=>Array.isArray(n)&&typeof n[0]=="number",zC={linearEasing:void 0};function PC(n,s){const i=Hp(n);return()=>{var o;return(o=zC[s])!==null&&o!==void 0?o:i()}}const xc=PC(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),no=(n,s,i)=>{const o=s-n;return o===0?1:(i-n)/o},i_=(n,s,i=10)=>{let o="";const c=Math.max(Math.round(s/i),2);for(let u=0;u<c;u++)o+=n(no(0,c-1,u))+", ";return`linear(${o.substring(0,o.length-2)})`};function o_(n){return!!(typeof n=="function"&&xc()||!n||typeof n=="string"&&(n in $f||xc())||Gp(n)||Array.isArray(n)&&n.every(o_))}const cr=([n,s,i,o])=>`cubic-bezier(${n}, ${s}, ${i}, ${o})`,$f={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cr([0,.65,.55,1]),circOut:cr([.55,0,1,.45]),backIn:cr([.31,.01,.66,-.59]),backOut:cr([.33,1.53,.69,.99])};function r_(n,s){if(n)return typeof n=="function"&&xc()?i_(n,s):Gp(n)?cr(n):Array.isArray(n)?n.map(i=>r_(i,s)||$f.easeOut):$f[n]}const l_=(n,s,i)=>(((1-3*i+3*s)*n+(3*i-6*s))*n+3*s)*n,VC=1e-7,HC=12;function qC(n,s,i,o,c){let u,d,m=0;do d=s+(i-s)/2,u=l_(d,o,c)-n,u>0?i=d:s=d;while(Math.abs(u)>VC&&++m<HC);return d}function Dr(n,s,i,o){if(n===s&&i===o)return _n;const c=u=>qC(u,0,1,n,i);return u=>u===0||u===1?u:l_(c(u),s,o)}const c_=n=>s=>s<=.5?n(2*s)/2:(2-n(2*(1-s)))/2,u_=n=>s=>1-n(1-s),d_=Dr(.33,1.53,.69,.99),$p=u_(d_),f_=c_($p),p_=n=>(n*=2)<1?.5*$p(n):.5*(2-Math.pow(2,-10*(n-1))),Fp=n=>1-Math.sin(Math.acos(n)),m_=u_(Fp),h_=c_(Fp),g_=n=>/^0[^.\s]+$/u.test(n);function GC(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||g_(n):!0}const mr=n=>Math.round(n*1e5)/1e5,Zp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function $C(n){return n==null}const FC=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Kp=(n,s)=>i=>!!(typeof i=="string"&&FC.test(i)&&i.startsWith(n)||s&&!$C(i)&&Object.prototype.hasOwnProperty.call(i,s)),v_=(n,s,i)=>o=>{if(typeof o!="string")return o;const[c,u,d,m]=o.match(Zp);return{[n]:parseFloat(c),[s]:parseFloat(u),[i]:parseFloat(d),alpha:m!==void 0?parseFloat(m):1}},ZC=n=>Is(0,255,n),hf={...ro,transform:n=>Math.round(ZC(n))},Fa={test:Kp("rgb","red"),parse:v_("red","green","blue"),transform:({red:n,green:s,blue:i,alpha:o=1})=>"rgba("+hf.transform(n)+", "+hf.transform(s)+", "+hf.transform(i)+", "+mr(kr.transform(o))+")"};function KC(n){let s="",i="",o="",c="";return n.length>5?(s=n.substring(1,3),i=n.substring(3,5),o=n.substring(5,7),c=n.substring(7,9)):(s=n.substring(1,2),i=n.substring(2,3),o=n.substring(3,4),c=n.substring(4,5),s+=s,i+=i,o+=o,c+=c),{red:parseInt(s,16),green:parseInt(i,16),blue:parseInt(o,16),alpha:c?parseInt(c,16)/255:1}}const Ff={test:Kp("#"),parse:KC,transform:Fa.transform},$i={test:Kp("hsl","hue"),parse:v_("hue","saturation","lightness"),transform:({hue:n,saturation:s,lightness:i,alpha:o=1})=>"hsla("+Math.round(n)+", "+as.transform(mr(s))+", "+as.transform(mr(i))+", "+mr(kr.transform(o))+")"},Xt={test:n=>Fa.test(n)||Ff.test(n)||$i.test(n),parse:n=>Fa.test(n)?Fa.parse(n):$i.test(n)?$i.parse(n):Ff.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Fa.transform(n):$i.transform(n)},YC=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function JC(n){var s,i;return isNaN(n)&&typeof n=="string"&&(((s=n.match(Zp))===null||s===void 0?void 0:s.length)||0)+(((i=n.match(YC))===null||i===void 0?void 0:i.length)||0)>0}const y_="number",b_="color",WC="var",XC="var(",R0="${}",QC=/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 Nr(n){const s=n.toString(),i=[],o={color:[],number:[],var:[]},c=[];let u=0;const m=s.replace(QC,h=>(Xt.test(h)?(o.color.push(u),c.push(b_),i.push(Xt.parse(h))):h.startsWith(XC)?(o.var.push(u),c.push(WC),i.push(h)):(o.number.push(u),c.push(y_),i.push(parseFloat(h))),++u,R0)).split(R0);return{values:i,split:m,indexes:o,types:c}}function __(n){return Nr(n).values}function x_(n){const{split:s,types:i}=Nr(n),o=s.length;return c=>{let u="";for(let d=0;d<o;d++)if(u+=s[d],c[d]!==void 0){const m=i[d];m===y_?u+=mr(c[d]):m===b_?u+=Xt.transform(c[d]):u+=c[d]}return u}}const eE=n=>typeof n=="number"?0:n;function tE(n){const s=__(n);return x_(n)(s.map(eE))}const ga={test:JC,parse:__,createTransformer:x_,getAnimatableNone:tE},nE=new Set(["brightness","contrast","saturate","opacity"]);function sE(n){const[s,i]=n.slice(0,-1).split("(");if(s==="drop-shadow")return n;const[o]=i.match(Zp)||[];if(!o)return n;const c=i.replace(o,"");let u=nE.has(s)?1:0;return o!==i&&(u*=100),s+"("+u+c+")"}const aE=/\b([a-z-]*)\(.*?\)/gu,Zf={...ga,getAnimatableNone:n=>{const s=n.match(aE);return s?s.map(sE).join(" "):n}},iE={...Rp,color:Xt,backgroundColor:Xt,outlineColor:Xt,fill:Xt,stroke:Xt,borderColor:Xt,borderTopColor:Xt,borderRightColor:Xt,borderBottomColor:Xt,borderLeftColor:Xt,filter:Zf,WebkitFilter:Zf},Yp=n=>iE[n];function S_(n,s){let i=Yp(n);return i!==Zf&&(i=ga),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const oE=new Set(["auto","none","0"]);function rE(n,s,i){let o=0,c;for(;o<n.length&&!c;){const u=n[o];typeof u=="string"&&!oE.has(u)&&Nr(u).values.length&&(c=n[o]),o++}if(c&&i)for(const u of s)n[u]=S_(i,c)}const M0=n=>n===ro||n===Te,O0=(n,s)=>parseFloat(n.split(", ")[s]),I0=(n,s)=>(i,{transform:o})=>{if(o==="none"||!o)return 0;const c=o.match(/^matrix3d\((.+)\)$/u);if(c)return O0(c[1],s);{const u=o.match(/^matrix\((.+)\)$/u);return u?O0(u[1],n):0}},lE=new Set(["x","y","z"]),cE=oo.filter(n=>!lE.has(n));function uE(n){const s=[];return cE.forEach(i=>{const o=n.getValue(i);o!==void 0&&(s.push([i,o.get()]),o.set(i.startsWith("scale")?1:0))}),s}const so={width:({x:n},{paddingLeft:s="0",paddingRight:i="0"})=>n.max-n.min-parseFloat(s)-parseFloat(i),height:({y:n},{paddingTop:s="0",paddingBottom:i="0"})=>n.max-n.min-parseFloat(s)-parseFloat(i),top:(n,{top:s})=>parseFloat(s),left:(n,{left:s})=>parseFloat(s),bottom:({y:n},{top:s})=>parseFloat(s)+(n.max-n.min),right:({x:n},{left:s})=>parseFloat(s)+(n.max-n.min),x:I0(4,13),y:I0(5,14)};so.translateX=so.x;so.translateY=so.y;const Ka=new Set;let Kf=!1,Yf=!1;function T_(){if(Yf){const n=Array.from(Ka).filter(o=>o.needsMeasurement),s=new Set(n.map(o=>o.element)),i=new Map;s.forEach(o=>{const c=uE(o);c.length&&(i.set(o,c),o.render())}),n.forEach(o=>o.measureInitialState()),s.forEach(o=>{o.render();const c=i.get(o);c&&c.forEach(([u,d])=>{var m;(m=o.getValue(u))===null||m===void 0||m.set(d)})}),n.forEach(o=>o.measureEndState()),n.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}Yf=!1,Kf=!1,Ka.forEach(n=>n.complete()),Ka.clear()}function k_(){Ka.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(Yf=!0)})}function dE(){k_(),T_()}class Jp{constructor(s,i,o,c,u,d=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=i,this.name=o,this.motionValue=c,this.element=u,this.isAsync=d}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ka.add(this),Kf||(Kf=!0,ft.read(k_),ft.resolveKeyframes(T_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:i,element:o,motionValue:c}=this;for(let u=0;u<s.length;u++)if(s[u]===null)if(u===0){const d=c==null?void 0:c.get(),m=s[s.length-1];if(d!==void 0)s[0]=d;else if(o&&i){const h=o.readValue(i,m);h!=null&&(s[0]=h)}s[0]===void 0&&(s[0]=m),c&&d===void 0&&c.set(s[0])}else s[u]=s[u-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ka.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ka.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const w_=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),fE=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function pE(n){const s=fE.exec(n);if(!s)return[,];const[,i,o,c]=s;return[`--${i??o}`,c]}function N_(n,s,i=1){const[o,c]=pE(n);if(!o)return;const u=window.getComputedStyle(s).getPropertyValue(o);if(u){const d=u.trim();return w_(d)?parseFloat(d):d}return Dp(c)?N_(c,s,i+1):c}const j_=n=>s=>s.test(n),mE={test:n=>n==="auto",parse:n=>n},C_=[ro,Te,as,pa,uC,cC,mE],B0=n=>C_.find(j_(n));class E_ extends Jp{constructor(s,i,o,c,u){super(s,i,o,c,u,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:i,name:o}=this;if(!i||!i.current)return;super.readKeyframes();for(let h=0;h<s.length;h++){let g=s[h];if(typeof g=="string"&&(g=g.trim(),Dp(g))){const v=N_(g,i.current);v!==void 0&&(s[h]=v),h===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!n_.has(o)||s.length!==2)return;const[c,u]=s,d=B0(c),m=B0(u);if(d!==m)if(M0(d)&&M0(m))for(let h=0;h<s.length;h++){const g=s[h];typeof g=="string"&&(s[h]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:i}=this,o=[];for(let c=0;c<s.length;c++)GC(s[c])&&o.push(c);o.length&&rE(s,o,i)}measureInitialState(){const{element:s,unresolvedKeyframes:i,name:o}=this;if(!s||!s.current)return;o==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=so[o](s.measureViewportBox(),window.getComputedStyle(s.current)),i[0]=this.measuredOrigin;const c=i[i.length-1];c!==void 0&&s.getValue(o,c).jump(c,!1)}measureEndState(){var s;const{element:i,name:o,unresolvedKeyframes:c}=this;if(!i||!i.current)return;const u=i.getValue(o);u&&u.jump(this.measuredOrigin,!1);const d=c.length-1,m=c[d];c[d]=so[o](i.measureViewportBox(),window.getComputedStyle(i.current)),m!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=m),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([h,g])=>{i.getValue(h).set(g)}),this.resolveNoneKeyframes()}}const L0=(n,s)=>s==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(ga.test(n)||n==="0")&&!n.startsWith("url("));function hE(n){const s=n[0];if(n.length===1)return!0;for(let i=0;i<n.length;i++)if(n[i]!==s)return!0}function gE(n,s,i,o){const c=n[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const u=n[n.length-1],d=L0(c,s),m=L0(u,s);return!d||!m?!1:hE(n)||(i==="spring"||qp(i))&&o}const vE=n=>n!==null;function zc(n,{repeat:s,repeatType:i="loop"},o){const c=n.filter(vE),u=s&&i!=="loop"&&s%2===1?0:c.length-1;return!u||o===void 0?c[u]:o}const yE=40;class A_{constructor({autoplay:s=!0,delay:i=0,type:o="keyframes",repeat:c=0,repeatDelay:u=0,repeatType:d="loop",...m}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=is.now(),this.options={autoplay:s,delay:i,type:o,repeat:c,repeatDelay:u,repeatType:d,...m},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>yE?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&dE(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=is.now(),this.hasAttemptedResolve=!0;const{name:o,type:c,velocity:u,delay:d,onComplete:m,onUpdate:h,isGenerator:g}=this.options;if(!g&&!gE(s,o,c,u))if(d)this.options.duration=0;else{h&&h(zc(s,this.options,i)),m&&m(),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 Jf=2e4;function D_(n){let s=0;const i=50;let o=n.next(s);for(;!o.done&&s<Jf;)s+=i,o=n.next(s);return s>=Jf?1/0:s}const vt=(n,s,i)=>n+(s-n)*i;function gf(n,s,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?n+(s-n)*6*i:i<1/2?s:i<2/3?n+(s-n)*(2/3-i)*6:n}function bE({hue:n,saturation:s,lightness:i,alpha:o}){n/=360,s/=100,i/=100;let c=0,u=0,d=0;if(!s)c=u=d=i;else{const m=i<.5?i*(1+s):i+s-i*s,h=2*i-m;c=gf(h,m,n+1/3),u=gf(h,m,n),d=gf(h,m,n-1/3)}return{red:Math.round(c*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:o}}function Sc(n,s){return i=>i>0?s:n}const vf=(n,s,i)=>{const o=n*n,c=i*(s*s-o)+o;return c<0?0:Math.sqrt(c)},_E=[Ff,Fa,$i],xE=n=>_E.find(s=>s.test(n));function U0(n){const s=xE(n);if(!s)return!1;let i=s.parse(n);return s===$i&&(i=bE(i)),i}const z0=(n,s)=>{const i=U0(n),o=U0(s);if(!i||!o)return Sc(n,s);const c={...i};return u=>(c.red=vf(i.red,o.red,u),c.green=vf(i.green,o.green,u),c.blue=vf(i.blue,o.blue,u),c.alpha=vt(i.alpha,o.alpha,u),Fa.transform(c))},SE=(n,s)=>i=>s(n(i)),Rr=(...n)=>n.reduce(SE),Wf=new Set(["none","hidden"]);function TE(n,s){return Wf.has(n)?i=>i<=0?n:s:i=>i>=1?s:n}function kE(n,s){return i=>vt(n,s,i)}function Wp(n){return typeof n=="number"?kE:typeof n=="string"?Dp(n)?Sc:Xt.test(n)?z0:jE:Array.isArray(n)?R_:typeof n=="object"?Xt.test(n)?z0:wE:Sc}function R_(n,s){const i=[...n],o=i.length,c=n.map((u,d)=>Wp(u)(u,s[d]));return u=>{for(let d=0;d<o;d++)i[d]=c[d](u);return i}}function wE(n,s){const i={...n,...s},o={};for(const c in i)n[c]!==void 0&&s[c]!==void 0&&(o[c]=Wp(n[c])(n[c],s[c]));return c=>{for(const u in o)i[u]=o[u](c);return i}}function NE(n,s){var i;const o=[],c={color:0,var:0,number:0};for(let u=0;u<s.values.length;u++){const d=s.types[u],m=n.indexes[d][c[d]],h=(i=n.values[m])!==null&&i!==void 0?i:0;o[u]=h,c[d]++}return o}const jE=(n,s)=>{const i=ga.createTransformer(s),o=Nr(n),c=Nr(s);return o.indexes.var.length===c.indexes.var.length&&o.indexes.color.length===c.indexes.color.length&&o.indexes.number.length>=c.indexes.number.length?Wf.has(n)&&!c.values.length||Wf.has(s)&&!o.values.length?TE(n,s):Rr(R_(NE(o,c),c.values),i):Sc(n,s)};function M_(n,s,i){return typeof n=="number"&&typeof s=="number"&&typeof i=="number"?vt(n,s,i):Wp(n)(n,s)}const CE=5;function O_(n,s,i){const o=Math.max(s-CE,0);return s_(i-n(o),s-o)}const _t={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},yf=.001;function EE({duration:n=_t.duration,bounce:s=_t.bounce,velocity:i=_t.velocity,mass:o=_t.mass}){let c,u,d=1-s;d=Is(_t.minDamping,_t.maxDamping,d),n=Is(_t.minDuration,_t.maxDuration,Rs(n)),d<1?(c=g=>{const v=g*d,b=v*n,_=v-i,S=Xf(g,d),T=Math.exp(-b);return yf-_/S*T},u=g=>{const b=g*d*n,_=b*i+i,S=Math.pow(d,2)*Math.pow(g,2)*n,T=Math.exp(-b),N=Xf(Math.pow(g,2),d);return(-c(g)+yf>0?-1:1)*((_-S)*T)/N}):(c=g=>{const v=Math.exp(-g*n),b=(g-i)*n+1;return-yf+v*b},u=g=>{const v=Math.exp(-g*n),b=(i-g)*(n*n);return v*b});const m=5/n,h=DE(c,u,m);if(n=Ds(n),isNaN(h))return{stiffness:_t.stiffness,damping:_t.damping,duration:n};{const g=Math.pow(h,2)*o;return{stiffness:g,damping:d*2*Math.sqrt(o*g),duration:n}}}const AE=12;function DE(n,s,i){let o=i;for(let c=1;c<AE;c++)o=o-n(o)/s(o);return o}function Xf(n,s){return n*Math.sqrt(1-s*s)}const RE=["duration","bounce"],ME=["stiffness","damping","mass"];function P0(n,s){return s.some(i=>n[i]!==void 0)}function OE(n){let s={velocity:_t.velocity,stiffness:_t.stiffness,damping:_t.damping,mass:_t.mass,isResolvedFromDuration:!1,...n};if(!P0(n,ME)&&P0(n,RE))if(n.visualDuration){const i=n.visualDuration,o=2*Math.PI/(i*1.2),c=o*o,u=2*Is(.05,1,1-(n.bounce||0))*Math.sqrt(c);s={...s,mass:_t.mass,stiffness:c,damping:u}}else{const i=EE(n);s={...s,...i,mass:_t.mass},s.isResolvedFromDuration=!0}return s}function I_(n=_t.visualDuration,s=_t.bounce){const i=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:s}:n;let{restSpeed:o,restDelta:c}=i;const u=i.keyframes[0],d=i.keyframes[i.keyframes.length-1],m={done:!1,value:u},{stiffness:h,damping:g,mass:v,duration:b,velocity:_,isResolvedFromDuration:S}=OE({...i,velocity:-Rs(i.velocity||0)}),T=_||0,N=g/(2*Math.sqrt(h*v)),j=d-u,w=Rs(Math.sqrt(h/v)),C=Math.abs(j)<5;o||(o=C?_t.restSpeed.granular:_t.restSpeed.default),c||(c=C?_t.restDelta.granular:_t.restDelta.default);let A;if(N<1){const D=Xf(w,N);A=E=>{const H=Math.exp(-N*w*E);return d-H*((T+N*w*j)/D*Math.sin(D*E)+j*Math.cos(D*E))}}else if(N===1)A=D=>d-Math.exp(-w*D)*(j+(T+w*j)*D);else{const D=w*Math.sqrt(N*N-1);A=E=>{const H=Math.exp(-N*w*E),z=Math.min(D*E,300);return d-H*((T+N*w*j)*Math.sinh(z)+D*j*Math.cosh(z))/D}}const M={calculatedDuration:S&&b||null,next:D=>{const E=A(D);if(S)m.done=D>=b;else{let H=0;N<1&&(H=D===0?Ds(T):O_(A,D,E));const z=Math.abs(H)<=o,Z=Math.abs(d-E)<=c;m.done=z&&Z}return m.value=m.done?d:E,m},toString:()=>{const D=Math.min(D_(M),Jf),E=i_(H=>M.next(D*H).value,D,30);return D+"ms "+E}};return M}function V0({keyframes:n,velocity:s=0,power:i=.8,timeConstant:o=325,bounceDamping:c=10,bounceStiffness:u=500,modifyTarget:d,min:m,max:h,restDelta:g=.5,restSpeed:v}){const b=n[0],_={done:!1,value:b},S=z=>m!==void 0&&z<m||h!==void 0&&z>h,T=z=>m===void 0?h:h===void 0||Math.abs(m-z)<Math.abs(h-z)?m:h;let N=i*s;const j=b+N,w=d===void 0?j:d(j);w!==j&&(N=w-b);const C=z=>-N*Math.exp(-z/o),A=z=>w+C(z),M=z=>{const Z=C(z),F=A(z);_.done=Math.abs(Z)<=g,_.value=_.done?w:F};let D,E;const H=z=>{S(_.value)&&(D=z,E=I_({keyframes:[_.value,T(_.value)],velocity:O_(A,z,_.value),damping:c,stiffness:u,restDelta:g,restSpeed:v}))};return H(0),{calculatedDuration:null,next:z=>{let Z=!1;return!E&&D===void 0&&(Z=!0,M(z),H(z)),D!==void 0&&z>=D?E.next(z-D):(!Z&&M(z),_)}}}const IE=Dr(.42,0,1,1),BE=Dr(0,0,.58,1),B_=Dr(.42,0,.58,1),LE=n=>Array.isArray(n)&&typeof n[0]!="number",UE={linear:_n,easeIn:IE,easeInOut:B_,easeOut:BE,circIn:Fp,circInOut:h_,circOut:m_,backIn:$p,backInOut:f_,backOut:d_,anticipate:p_},H0=n=>{if(Gp(n)){Bb(n.length===4);const[s,i,o,c]=n;return Dr(s,i,o,c)}else if(typeof n=="string")return UE[n];return n};function zE(n,s,i){const o=[],c=i||M_,u=n.length-1;for(let d=0;d<u;d++){let m=c(n[d],n[d+1]);if(s){const h=Array.isArray(s)?s[d]||_n:s;m=Rr(h,m)}o.push(m)}return o}function PE(n,s,{clamp:i=!0,ease:o,mixer:c}={}){const u=n.length;if(Bb(u===s.length),u===1)return()=>s[0];if(u===2&&s[0]===s[1])return()=>s[1];const d=n[0]===n[1];n[0]>n[u-1]&&(n=[...n].reverse(),s=[...s].reverse());const m=zE(s,o,c),h=m.length,g=v=>{if(d&&v<n[0])return s[0];let b=0;if(h>1)for(;b<n.length-2&&!(v<n[b+1]);b++);const _=no(n[b],n[b+1],v);return m[b](_)};return i?v=>g(Is(n[0],n[u-1],v)):g}function VE(n,s){const i=n[n.length-1];for(let o=1;o<=s;o++){const c=no(0,s,o);n.push(vt(i,1,c))}}function HE(n){const s=[0];return VE(s,n.length-1),s}function qE(n,s){return n.map(i=>i*s)}function GE(n,s){return n.map(()=>s||B_).splice(0,n.length-1)}function Tc({duration:n=300,keyframes:s,times:i,ease:o="easeInOut"}){const c=LE(o)?o.map(H0):H0(o),u={done:!1,value:s[0]},d=qE(i&&i.length===s.length?i:HE(s),n),m=PE(d,s,{ease:Array.isArray(c)?c:GE(s,c)});return{calculatedDuration:n,next:h=>(u.value=m(h),u.done=h>=n,u)}}const $E=n=>{const s=({timestamp:i})=>n(i);return{start:()=>ft.update(s,!0),stop:()=>ha(s),now:()=>Kt.isProcessing?Kt.timestamp:is.now()}},FE={decay:V0,inertia:V0,tween:Tc,keyframes:Tc,spring:I_},ZE=n=>n/100;class Xp extends A_{constructor(s){super(s),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:h}=this.options;h&&h()};const{name:i,motionValue:o,element:c,keyframes:u}=this.options,d=(c==null?void 0:c.KeyframeResolver)||Jp,m=(h,g)=>this.onKeyframesResolved(h,g);this.resolver=new d(u,m,i,o,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:i="keyframes",repeat:o=0,repeatDelay:c=0,repeatType:u,velocity:d=0}=this.options,m=qp(i)?i:FE[i]||Tc;let h,g;m!==Tc&&typeof s[0]!="number"&&(h=Rr(ZE,M_(s[0],s[1])),s=[0,100]);const v=m({...this.options,keyframes:s});u==="mirror"&&(g=m({...this.options,keyframes:[...s].reverse(),velocity:-d})),v.calculatedDuration===null&&(v.calculatedDuration=D_(v));const{calculatedDuration:b}=v,_=b+c,S=_*(o+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:h,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:o}=this;if(!o){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:c,generator:u,mirroredGenerator:d,mapPercentToKeyframes:m,keyframes:h,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=o;if(this.startTime===null)return u.next(0);const{delay:_,repeat:S,repeatType:T,repeatDelay:N,onUpdate:j}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),i?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const w=this.currentTime-_*(this.speed>=0?1:-1),C=this.speed>=0?w<0:w>v;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let A=this.currentTime,M=u;if(S){const z=Math.min(this.currentTime,v)/b;let Z=Math.floor(z),F=z%1;!F&&z>=1&&(F=1),F===1&&Z--,Z=Math.min(Z,S+1),!!(Z%2)&&(T==="reverse"?(F=1-F,N&&(F-=N/b)):T==="mirror"&&(M=d)),A=Is(0,1,F)*b}const D=C?{done:!1,value:h[0]}:M.next(A);m&&(D.value=m(D.value));let{done:E}=D;!C&&g!==null&&(E=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const H=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return H&&c!==void 0&&(D.value=zc(h,this.options,c)),j&&j(D.value),H&&this.finish(),D}get duration(){const{resolved:s}=this;return s?Rs(s.calculatedDuration):0}get time(){return Rs(this.currentTime)}set time(s){s=Ds(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=Rs(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=$E,onPlay:i,startTime:o}=this.options;this.driver||(this.driver=s(u=>this.tick(u))),i&&i();const c=this.driver.now();this.holdTime!==null?this.startTime=c-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=c):this.startTime=o??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var s;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(s=this.currentTime)!==null&&s!==void 0?s:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:s}=this.options;s&&s()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(s){return this.startTime=0,this.tick(s,!0)}}const KE=new Set(["opacity","clipPath","filter","transform"]);function YE(n,s,i,{delay:o=0,duration:c=300,repeat:u=0,repeatType:d="loop",ease:m="easeInOut",times:h}={}){const g={[s]:i};h&&(g.offset=h);const v=r_(m,c);return Array.isArray(v)&&(g.easing=v),n.animate(g,{delay:o,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:u+1,direction:d==="reverse"?"alternate":"normal"})}const JE=Hp(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),kc=10,WE=2e4;function XE(n){return qp(n.type)||n.type==="spring"||!o_(n.ease)}function QE(n,s){const i=new Xp({...s,keyframes:n,repeat:0,delay:0,isGenerator:!0});let o={done:!1,value:n[0]};const c=[];let u=0;for(;!o.done&&u<WE;)o=i.sample(u),c.push(o.value),u+=kc;return{times:void 0,keyframes:c,duration:u-kc,ease:"linear"}}const L_={anticipate:p_,backInOut:f_,circInOut:h_};function eA(n){return n in L_}class q0 extends A_{constructor(s){super(s);const{name:i,motionValue:o,element:c,keyframes:u}=this.options;this.resolver=new E_(u,(d,m)=>this.onKeyframesResolved(d,m),i,o,c),this.resolver.scheduleResolve()}initPlayback(s,i){let{duration:o=300,times:c,ease:u,type:d,motionValue:m,name:h,startTime:g}=this.options;if(!m.owner||!m.owner.current)return!1;if(typeof u=="string"&&xc()&&eA(u)&&(u=L_[u]),XE(this.options)){const{onComplete:b,onUpdate:_,motionValue:S,element:T,...N}=this.options,j=QE(s,N);s=j.keyframes,s.length===1&&(s[1]=s[0]),o=j.duration,c=j.times,u=j.ease,d="keyframes"}const v=YE(m.owner.current,h,s,{...this.options,duration:o,times:c,ease:u});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(D0(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;m.set(zc(s,this.options,i)),b&&b(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:o,times:c,type:d,ease:u,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:i}=s;return Rs(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Rs(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.currentTime=Ds(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:i}=s;return i.playbackRate}set speed(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:i}=s;return i.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:i}=s;return i.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:i}=this;if(!i)return _n;const{animation:o}=i;D0(o,s)}return _n}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.playState==="finished"&&this.updateFinishedPromise(),i.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:i,keyframes:o,duration:c,type:u,ease:d,times:m}=s;if(i.playState==="idle"||i.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:_,...S}=this.options,T=new Xp({...S,keyframes:o,duration:c,type:u,ease:d,times:m,isGenerator:!0}),N=Ds(this.time);g.setWithVelocity(T.sample(N-kc).value,T.sample(N).value,kc)}const{onStop:h}=this.options;h&&h(),this.cancel()}complete(){const{resolved:s}=this;s&&s.animation.finish()}cancel(){const{resolved:s}=this;s&&s.animation.cancel()}static supports(s){const{motionValue:i,name:o,repeatDelay:c,repeatType:u,damping:d,type:m}=s;if(!i||!i.owner||!(i.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:g}=i.owner.getProps();return JE()&&o&&KE.has(o)&&!h&&!g&&!c&&u!=="mirror"&&d!==0&&m!=="inertia"}}const tA={type:"spring",stiffness:500,damping:25,restSpeed:10},nA=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),sA={type:"keyframes",duration:.8},aA={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},iA=(n,{keyframes:s})=>s.length>2?sA:ni.has(n)?n.startsWith("scale")?nA(s[1]):tA:aA;function oA({when:n,delay:s,delayChildren:i,staggerChildren:o,staggerDirection:c,repeat:u,repeatType:d,repeatDelay:m,from:h,elapsed:g,...v}){return!!Object.keys(v).length}const Qp=(n,s,i,o={},c,u)=>d=>{const m=Up(o,n)||{},h=m.delay||o.delay||0;let{elapsed:g=0}=o;g=g-Ds(h);let v={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...m,delay:-g,onUpdate:_=>{s.set(_),m.onUpdate&&m.onUpdate(_)},onComplete:()=>{d(),m.onComplete&&m.onComplete()},name:n,motionValue:s,element:u?void 0:c};oA(m)||(v={...v,...iA(n,v)}),v.duration&&(v.duration=Ds(v.duration)),v.repeatDelay&&(v.repeatDelay=Ds(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&&!u&&s.get()!==void 0){const _=zc(v.keyframes,m);if(_!==void 0)return ft.update(()=>{v.onUpdate(_),v.onComplete()}),new UC([])}return!u&&q0.supports(v)?new q0(v):new Xp(v)};function rA({protectedKeys:n,needsAnimating:s},i){const o=n.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,o}function U_(n,s,{delay:i=0,transitionOverride:o,type:c}={}){var u;let{transition:d=n.getDefaultTransition(),transitionEnd:m,...h}=s;o&&(d=o);const g=[],v=c&&n.animationState&&n.animationState.getState()[c];for(const b in h){const _=n.getValue(b,(u=n.latestValues[b])!==null&&u!==void 0?u:null),S=h[b];if(S===void 0||v&&rA(v,b))continue;const T={delay:i,...Up(d||{},b)};let N=!1;if(window.MotionHandoffAnimation){const w=a_(n);if(w){const C=window.MotionHandoffAnimation(w,b,ft);C!==null&&(T.startTime=C,N=!0)}}Gf(n,b),_.start(Qp(b,_,S,n.shouldReduceMotion&&n_.has(b)?{type:!1}:T,n,N));const j=_.animation;j&&g.push(j)}return m&&Promise.all(g).then(()=>{ft.update(()=>{m&&OC(n,m)})}),g}function Qf(n,s,i={}){var o;const c=Uc(n,s,i.type==="exit"?(o=n.presenceContext)===null||o===void 0?void 0:o.custom:void 0);let{transition:u=n.getDefaultTransition()||{}}=c||{};i.transitionOverride&&(u=i.transitionOverride);const d=c?()=>Promise.all(U_(n,c,i)):()=>Promise.resolve(),m=n.variantChildren&&n.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=u;return lA(n,s,v+g,b,_,i)}:()=>Promise.resolve(),{when:h}=u;if(h){const[g,v]=h==="beforeChildren"?[d,m]:[m,d];return g().then(()=>v())}else return Promise.all([d(),m(i.delay)])}function lA(n,s,i=0,o=0,c=1,u){const d=[],m=(n.variantChildren.size-1)*o,h=c===1?(g=0)=>g*o:(g=0)=>m-g*o;return Array.from(n.variantChildren).sort(cA).forEach((g,v)=>{g.notify("AnimationStart",s),d.push(Qf(g,s,{...u,delay:i+h(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(d)}function cA(n,s){return n.sortNodePosition(s)}function uA(n,s,i={}){n.notify("AnimationStart",s);let o;if(Array.isArray(s)){const c=s.map(u=>Qf(n,u,i));o=Promise.all(c)}else if(typeof s=="string")o=Qf(n,s,i);else{const c=typeof s=="function"?Uc(n,s,i.custom):s;o=Promise.all(U_(n,c,i))}return o.then(()=>{n.notify("AnimationComplete",s)})}const dA=Np.length;function z_(n){if(!n)return;if(!n.isControllingVariants){const i=n.parent?z_(n.parent)||{}:{};return n.props.initial!==void 0&&(i.initial=n.props.initial),i}const s={};for(let i=0;i<dA;i++){const o=Np[i],c=n.props[o];(Tr(c)||c===!1)&&(s[o]=c)}return s}const fA=[...wp].reverse(),pA=wp.length;function mA(n){return s=>Promise.all(s.map(({animation:i,options:o})=>uA(n,i,o)))}function hA(n){let s=mA(n),i=G0(),o=!0;const c=h=>(g,v)=>{var b;const _=Uc(n,v,h==="exit"?(b=n.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(_){const{transition:S,transitionEnd:T,...N}=_;g={...g,...N,...T}}return g};function u(h){s=h(n)}function d(h){const{props:g}=n,v=z_(n.parent)||{},b=[],_=new Set;let S={},T=1/0;for(let j=0;j<pA;j++){const w=fA[j],C=i[w],A=g[w]!==void 0?g[w]:v[w],M=Tr(A),D=w===h?C.isActive:null;D===!1&&(T=j);let E=A===v[w]&&A!==g[w]&&M;if(E&&o&&n.manuallyAnimateOnMount&&(E=!1),C.protectedKeys={...S},!C.isActive&&D===null||!A&&!C.prevProp||Bc(A)||typeof A=="boolean")continue;const H=gA(C.prevProp,A);let z=H||w===h&&C.isActive&&!E&&M||j>T&&M,Z=!1;const F=Array.isArray(A)?A:[A];let Q=F.reduce(c(w),{});D===!1&&(Q={});const{prevResolvedValues:ae={}}=C,pe={...ae,...Q},oe=$=>{z=!0,_.has($)&&(Z=!0,_.delete($)),C.needsAnimating[$]=!0;const te=n.getValue($);te&&(te.liveStyle=!1)};for(const $ in pe){const te=Q[$],re=ae[$];if(S.hasOwnProperty($))continue;let de=!1;qf(te)&&qf(re)?de=!t_(te,re):de=te!==re,de?te!=null?oe($):_.add($):te!==void 0&&_.has($)?oe($):C.protectedKeys[$]=!0}C.prevProp=A,C.prevResolvedValues=Q,C.isActive&&(S={...S,...Q}),o&&n.blockInitialAnimation&&(z=!1),z&&(!(E&&H)||Z)&&b.push(...F.map($=>({animation:$,options:{type:w}})))}if(_.size){const j={};_.forEach(w=>{const C=n.getBaseTarget(w),A=n.getValue(w);A&&(A.liveStyle=!0),j[w]=C??null}),b.push({animation:j})}let N=!!b.length;return o&&(g.initial===!1||g.initial===g.animate)&&!n.manuallyAnimateOnMount&&(N=!1),o=!1,N?s(b):Promise.resolve()}function m(h,g){var v;if(i[h].isActive===g)return Promise.resolve();(v=n.variantChildren)===null||v===void 0||v.forEach(_=>{var S;return(S=_.animationState)===null||S===void 0?void 0:S.setActive(h,g)}),i[h].isActive=g;const b=d(h);for(const _ in i)i[_].protectedKeys={};return b}return{animateChanges:d,setActive:m,setAnimateFunction:u,getState:()=>i,reset:()=>{i=G0(),o=!0}}}function gA(n,s){return typeof s=="string"?s!==n:Array.isArray(s)?!t_(s,n):!1}function za(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function G0(){return{animate:za(!0),whileInView:za(),whileHover:za(),whileTap:za(),whileDrag:za(),whileFocus:za(),exit:za()}}class ba{constructor(s){this.isMounted=!1,this.node=s}update(){}}class vA extends ba{constructor(s){super(s),s.animationState||(s.animationState=hA(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Bc(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 yA=0;class bA extends ba{constructor(){super(...arguments),this.id=yA++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:i}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===o)return;const c=this.node.animationState.setActive("exit",!s);i&&!s&&c.then(()=>i(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const _A={animation:{Feature:vA},exit:{Feature:bA}},Zn={x:!1,y:!1};function P_(){return Zn.x||Zn.y}function xA(n){return n==="x"||n==="y"?Zn[n]?null:(Zn[n]=!0,()=>{Zn[n]=!1}):Zn.x||Zn.y?null:(Zn.x=Zn.y=!0,()=>{Zn.x=Zn.y=!1})}const em=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1;function jr(n,s,i,o={passive:!0}){return n.addEventListener(s,i,o),()=>n.removeEventListener(s,i)}function Mr(n){return{point:{x:n.pageX,y:n.pageY}}}const SA=n=>s=>em(s)&&n(s,Mr(s));function hr(n,s,i,o){return jr(n,s,SA(i),o)}const $0=(n,s)=>Math.abs(n-s);function TA(n,s){const i=$0(n.x,s.x),o=$0(n.y,s.y);return Math.sqrt(i**2+o**2)}class V_{constructor(s,i,{transformPagePoint:o,contextWindow:c,dragSnapToOrigin:u=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=_f(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,S=TA(b.offset,{x:0,y:0})>=3;if(!_&&!S)return;const{point:T}=b,{timestamp:N}=Kt;this.history.push({...T,timestamp:N});const{onStart:j,onMove:w}=this.handlers;_||(j&&j(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=bf(_,this.transformPagePoint),ft.update(this.updatePoint,!0)},this.handlePointerUp=(b,_)=>{this.end();const{onEnd:S,onSessionEnd:T,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=_f(b.type==="pointercancel"?this.lastMoveEventInfo:bf(_,this.transformPagePoint),this.history);this.startEvent&&S&&S(b,j),T&&T(b,j)},!em(s))return;this.dragSnapToOrigin=u,this.handlers=i,this.transformPagePoint=o,this.contextWindow=c||window;const d=Mr(s),m=bf(d,this.transformPagePoint),{point:h}=m,{timestamp:g}=Kt;this.history=[{...h,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,_f(m,this.history)),this.removeListeners=Rr(hr(this.contextWindow,"pointermove",this.handlePointerMove),hr(this.contextWindow,"pointerup",this.handlePointerUp),hr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),ha(this.updatePoint)}}function bf(n,s){return s?{point:s(n.point)}:n}function F0(n,s){return{x:n.x-s.x,y:n.y-s.y}}function _f({point:n},s){return{point:n,delta:F0(n,H_(s)),offset:F0(n,kA(s)),velocity:wA(s,.1)}}function kA(n){return n[0]}function H_(n){return n[n.length-1]}function wA(n,s){if(n.length<2)return{x:0,y:0};let i=n.length-1,o=null;const c=H_(n);for(;i>=0&&(o=n[i],!(c.timestamp-o.timestamp>Ds(s)));)i--;if(!o)return{x:0,y:0};const u=Rs(c.timestamp-o.timestamp);if(u===0)return{x:0,y:0};const d={x:(c.x-o.x)/u,y:(c.y-o.y)/u};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}const q_=1e-4,NA=1-q_,jA=1+q_,G_=.01,CA=0-G_,EA=0+G_;function xn(n){return n.max-n.min}function AA(n,s,i){return Math.abs(n-s)<=i}function Z0(n,s,i,o=.5){n.origin=o,n.originPoint=vt(s.min,s.max,n.origin),n.scale=xn(i)/xn(s),n.translate=vt(i.min,i.max,n.origin)-n.originPoint,(n.scale>=NA&&n.scale<=jA||isNaN(n.scale))&&(n.scale=1),(n.translate>=CA&&n.translate<=EA||isNaN(n.translate))&&(n.translate=0)}function gr(n,s,i,o){Z0(n.x,s.x,i.x,o?o.originX:void 0),Z0(n.y,s.y,i.y,o?o.originY:void 0)}function K0(n,s,i){n.min=i.min+s.min,n.max=n.min+xn(s)}function DA(n,s,i){K0(n.x,s.x,i.x),K0(n.y,s.y,i.y)}function Y0(n,s,i){n.min=s.min-i.min,n.max=n.min+xn(s)}function vr(n,s,i){Y0(n.x,s.x,i.x),Y0(n.y,s.y,i.y)}function RA(n,{min:s,max:i},o){return s!==void 0&&n<s?n=o?vt(s,n,o.min):Math.max(n,s):i!==void 0&&n>i&&(n=o?vt(i,n,o.max):Math.min(n,i)),n}function J0(n,s,i){return{min:s!==void 0?n.min+s:void 0,max:i!==void 0?n.max+i-(n.max-n.min):void 0}}function MA(n,{top:s,left:i,bottom:o,right:c}){return{x:J0(n.x,i,c),y:J0(n.y,s,o)}}function W0(n,s){let i=s.min-n.min,o=s.max-n.max;return s.max-s.min<n.max-n.min&&([i,o]=[o,i]),{min:i,max:o}}function OA(n,s){return{x:W0(n.x,s.x),y:W0(n.y,s.y)}}function IA(n,s){let i=.5;const o=xn(n),c=xn(s);return c>o?i=no(s.min,s.max-o,n.min):o>c&&(i=no(n.min,n.max-c,s.min)),Is(0,1,i)}function BA(n,s){const i={};return s.min!==void 0&&(i.min=s.min-n.min),s.max!==void 0&&(i.max=s.max-n.min),i}const ep=.35;function LA(n=ep){return n===!1?n=0:n===!0&&(n=ep),{x:X0(n,"left","right"),y:X0(n,"top","bottom")}}function X0(n,s,i){return{min:Q0(n,s),max:Q0(n,i)}}function Q0(n,s){return typeof n=="number"?n:n[s]||0}const ey=()=>({translate:0,scale:1,origin:0,originPoint:0}),Fi=()=>({x:ey(),y:ey()}),ty=()=>({min:0,max:0}),jt=()=>({x:ty(),y:ty()});function Bn(n){return[n("x"),n("y")]}function $_({top:n,left:s,right:i,bottom:o}){return{x:{min:s,max:i},y:{min:n,max:o}}}function UA({x:n,y:s}){return{top:s.min,right:n.max,bottom:s.max,left:n.min}}function zA(n,s){if(!s)return n;const i=s({x:n.left,y:n.top}),o=s({x:n.right,y:n.bottom});return{top:i.y,left:i.x,bottom:o.y,right:o.x}}function xf(n){return n===void 0||n===1}function tp({scale:n,scaleX:s,scaleY:i}){return!xf(n)||!xf(s)||!xf(i)}function Ga(n){return tp(n)||F_(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function F_(n){return ny(n.x)||ny(n.y)}function ny(n){return n&&n!=="0%"}function wc(n,s,i){const o=n-i,c=s*o;return i+c}function sy(n,s,i,o,c){return c!==void 0&&(n=wc(n,c,o)),wc(n,i,o)+s}function np(n,s=0,i=1,o,c){n.min=sy(n.min,s,i,o,c),n.max=sy(n.max,s,i,o,c)}function Z_(n,{x:s,y:i}){np(n.x,s.translate,s.scale,s.originPoint),np(n.y,i.translate,i.scale,i.originPoint)}const ay=.999999999999,iy=1.0000000000001;function PA(n,s,i,o=!1){const c=i.length;if(!c)return;s.x=s.y=1;let u,d;for(let m=0;m<c;m++){u=i[m],d=u.projectionDelta;const{visualElement:h}=u.options;h&&h.props.style&&h.props.style.display==="contents"||(o&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Ki(n,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(s.x*=d.x.scale,s.y*=d.y.scale,Z_(n,d)),o&&Ga(u.latestValues)&&Ki(n,u.latestValues))}s.x<iy&&s.x>ay&&(s.x=1),s.y<iy&&s.y>ay&&(s.y=1)}function Zi(n,s){n.min=n.min+s,n.max=n.max+s}function oy(n,s,i,o,c=.5){const u=vt(n.min,n.max,c);np(n,s,i,u,o)}function Ki(n,s){oy(n.x,s.x,s.scaleX,s.scale,s.originX),oy(n.y,s.y,s.scaleY,s.scale,s.originY)}function K_(n,s){return $_(zA(n.getBoundingClientRect(),s))}function VA(n,s,i){const o=K_(n,i),{scroll:c}=s;return c&&(Zi(o.x,c.offset.x),Zi(o.y,c.offset.y)),o}const Y_=({current:n})=>n?n.ownerDocument.defaultView:null,HA=new WeakMap;class qA{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=jt(),this.visualElement=s}start(s,{snapToCursor:i=!1}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(Mr(v).point)},u=(v,b)=>{const{drag:_,dragPropagation:S,onDragStart:T}=this.getProps();if(_&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xA(_),!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),Bn(j=>{let w=this.getAxisMotionValue(j).get()||0;if(as.test(w)){const{projection:C}=this.visualElement;if(C&&C.layout){const A=C.layout.layoutBox[j];A&&(w=xn(A)*(parseFloat(w)/100))}}this.originPoint[j]=w}),T&&ft.postRender(()=>T(v,b)),Gf(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},d=(v,b)=>{const{dragPropagation:_,dragDirectionLock:S,onDirectionLock:T,onDrag:N}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:j}=b;if(S&&this.currentDirection===null){this.currentDirection=GA(j),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",b.point,j),this.updateAxis("y",b.point,j),this.visualElement.render(),N&&N(v,b)},m=(v,b)=>this.stop(v,b),h=()=>Bn(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 V_(s,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:m,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:Y_(this.visualElement)})}stop(s,i){const o=this.isDragging;if(this.cancel(),!o)return;const{velocity:c}=i;this.startAnimation(c);const{onDragEnd:u}=this.getProps();u&&ft.postRender(()=>u(s,i))}cancel(){this.isDragging=!1;const{projection:s,animationState:i}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:o}=this.getProps();!o&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),i&&i.setActive("whileDrag",!1)}updateAxis(s,i,o){const{drag:c}=this.getProps();if(!o||!sc(s,c,this.currentDirection))return;const u=this.getAxisMotionValue(s);let d=this.originPoint[s]+o[s];this.constraints&&this.constraints[s]&&(d=RA(d,this.constraints[s],this.elastic[s])),u.set(d)}resolveConstraints(){var s;const{dragConstraints:i,dragElastic:o}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)===null||s===void 0?void 0:s.layout,u=this.constraints;i&&Gi(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=MA(c.layoutBox,i):this.constraints=!1,this.elastic=LA(o),u!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Bn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=BA(c.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!Gi(s))return!1;const o=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const u=VA(o,c.root,this.visualElement.getTransformPagePoint());let d=OA(c.layout.layoutBox,u);if(i){const m=i(UA(d));this.hasMutatedConstraints=!!m,m&&(d=$_(m))}return d}startAnimation(s){const{drag:i,dragMomentum:o,dragElastic:c,dragTransition:u,dragSnapToOrigin:d,onDragTransitionEnd:m}=this.getProps(),h=this.constraints||{},g=Bn(v=>{if(!sc(v,i,this.currentDirection))return;let b=h&&h[v]||{};d&&(b={min:0,max:0});const _=c?200:1e6,S=c?40:1e7,T={type:"inertia",velocity:o?s[v]:0,bounceStiffness:_,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...u,...b};return this.startAxisValueAnimation(v,T)});return Promise.all(g).then(m)}startAxisValueAnimation(s,i){const o=this.getAxisMotionValue(s);return Gf(this.visualElement,s),o.start(Qp(s,o,0,i,this.visualElement,!1))}stopAnimation(){Bn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){Bn(s=>{var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.pause()})}getAnimationState(s){var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.state}getAxisMotionValue(s){const i=`_drag${s.toUpperCase()}`,o=this.visualElement.getProps(),c=o[i];return c||this.visualElement.getValue(s,(o.initial?o.initial[s]:void 0)||0)}snapToCursor(s){Bn(i=>{const{drag:o}=this.getProps();if(!sc(i,o,this.currentDirection))return;const{projection:c}=this.visualElement,u=this.getAxisMotionValue(i);if(c&&c.layout){const{min:d,max:m}=c.layout.layoutBox[i];u.set(s[i]-vt(d,m,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:o}=this.visualElement;if(!Gi(i)||!o||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Bn(d=>{const m=this.getAxisMotionValue(d);if(m&&this.constraints!==!1){const h=m.get();c[d]=IA({min:h,max:h},this.constraints[d])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.resolveConstraints(),Bn(d=>{if(!sc(d,s,null))return;const m=this.getAxisMotionValue(d),{min:h,max:g}=this.constraints[d];m.set(vt(h,g,c[d]))})}addListeners(){if(!this.visualElement.current)return;HA.set(this.visualElement,this);const s=this.visualElement.current,i=hr(s,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(h)}),o=()=>{const{dragConstraints:h}=this.getProps();Gi(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,u=c.addEventListener("measure",o);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),ft.read(o);const d=jr(window,"resize",()=>this.scalePositionWithinConstraints()),m=c.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(Bn(v=>{const b=this.getAxisMotionValue(v);b&&(this.originPoint[v]+=h[v].translate,b.set(b.get()+h[v].translate))}),this.visualElement.render())}));return()=>{d(),i(),u(),m&&m()}}getProps(){const s=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:o=!1,dragPropagation:c=!1,dragConstraints:u=!1,dragElastic:d=ep,dragMomentum:m=!0}=s;return{...s,drag:i,dragDirectionLock:o,dragPropagation:c,dragConstraints:u,dragElastic:d,dragMomentum:m}}}function sc(n,s,i){return(s===!0||s===n)&&(i===null||i===n)}function GA(n,s=10){let i=null;return Math.abs(n.y)>s?i="y":Math.abs(n.x)>s&&(i="x"),i}class $A extends ba{constructor(s){super(s),this.removeGroupControls=_n,this.removeListeners=_n,this.controls=new qA(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||_n}unmount(){this.removeGroupControls(),this.removeListeners()}}const ry=n=>(s,i)=>{n&&ft.postRender(()=>n(s,i))};class FA extends ba{constructor(){super(...arguments),this.removePointerDownListener=_n}onPointerDown(s){this.session=new V_(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Y_(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:ry(s),onStart:ry(i),onMove:o,onEnd:(u,d)=>{delete this.session,c&&ft.postRender(()=>c(u,d))}}}mount(){this.removePointerDownListener=hr(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 mc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ly(n,s){return s.max===s.min?0:n/(s.max-s.min)*100}const ir={correct:(n,s)=>{if(!s.target)return n;if(typeof n=="string")if(Te.test(n))n=parseFloat(n);else return n;const i=ly(n,s.target.x),o=ly(n,s.target.y);return`${i}% ${o}%`}},ZA={correct:(n,{treeScale:s,projectionDelta:i})=>{const o=n,c=ga.parse(n);if(c.length>5)return o;const u=ga.createTransformer(n),d=typeof c[0]!="number"?1:0,m=i.x.scale*s.x,h=i.y.scale*s.y;c[0+d]/=m,c[1+d]/=h;const g=vt(m,h,.5);return typeof c[2+d]=="number"&&(c[2+d]/=g),typeof c[3+d]=="number"&&(c[3+d]/=g),u(c)}};class KA extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o,layoutId:c}=this.props,{projection:u}=s;_C(YA),u&&(i.group&&i.group.add(u),o&&o.register&&c&&o.register(u),u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),mc.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:i,visualElement:o,drag:c,isPresent:u}=this.props,d=o.projection;return d&&(d.isPresent=u,c||s.layoutDependency!==i||i===void 0?d.willUpdate():this.safeToRemove(),s.isPresent!==u&&(u?d.promote():d.relegate()||ft.postRender(()=>{const m=d.getStack();(!m||!m.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Cp.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(c),o&&o.deregister&&o.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function J_(n){const[s,i]=Ob(),o=y.useContext(xp);return l.jsx(KA,{...n,layoutGroup:o,switchLayoutGroup:y.useContext(Hb),isPresent:s,safeToRemove:i})}const YA={borderRadius:{...ir,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ir,borderTopRightRadius:ir,borderBottomLeftRadius:ir,borderBottomRightRadius:ir,boxShadow:ZA};function JA(n,s,i){const o=Qt(n)?n:wr(n);return o.start(Qp("",o,s,i)),o.animation}function WA(n){return n instanceof SVGElement&&n.tagName!=="svg"}const XA=(n,s)=>n.depth-s.depth;class QA{constructor(){this.children=[],this.isDirty=!1}add(s){zp(this.children,s),this.isDirty=!0}remove(s){Pp(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(XA),this.isDirty=!1,this.children.forEach(s)}}function eD(n,s){const i=is.now(),o=({timestamp:c})=>{const u=c-i;u>=s&&(ha(o),n(u-s))};return ft.read(o,!0),()=>ha(o)}const W_=["TopLeft","TopRight","BottomLeft","BottomRight"],tD=W_.length,cy=n=>typeof n=="string"?parseFloat(n):n,uy=n=>typeof n=="number"||Te.test(n);function nD(n,s,i,o,c,u){c?(n.opacity=vt(0,i.opacity!==void 0?i.opacity:1,sD(o)),n.opacityExit=vt(s.opacity!==void 0?s.opacity:1,0,aD(o))):u&&(n.opacity=vt(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,o));for(let d=0;d<tD;d++){const m=`border${W_[d]}Radius`;let h=dy(s,m),g=dy(i,m);if(h===void 0&&g===void 0)continue;h||(h=0),g||(g=0),h===0||g===0||uy(h)===uy(g)?(n[m]=Math.max(vt(cy(h),cy(g),o),0),(as.test(g)||as.test(h))&&(n[m]+="%")):n[m]=g}(s.rotate||i.rotate)&&(n.rotate=vt(s.rotate||0,i.rotate||0,o))}function dy(n,s){return n[s]!==void 0?n[s]:n.borderRadius}const sD=X_(0,.5,m_),aD=X_(.5,.95,_n);function X_(n,s,i){return o=>o<n?0:o>s?1:i(no(n,s,o))}function fy(n,s){n.min=s.min,n.max=s.max}function On(n,s){fy(n.x,s.x),fy(n.y,s.y)}function py(n,s){n.translate=s.translate,n.scale=s.scale,n.originPoint=s.originPoint,n.origin=s.origin}function my(n,s,i,o,c){return n-=s,n=wc(n,1/i,o),c!==void 0&&(n=wc(n,1/c,o)),n}function iD(n,s=0,i=1,o=.5,c,u=n,d=n){if(as.test(s)&&(s=parseFloat(s),s=vt(d.min,d.max,s/100)-d.min),typeof s!="number")return;let m=vt(u.min,u.max,o);n===u&&(m-=s),n.min=my(n.min,s,i,m,c),n.max=my(n.max,s,i,m,c)}function hy(n,s,[i,o,c],u,d){iD(n,s[i],s[o],s[c],s.scale,u,d)}const oD=["x","scaleX","originX"],rD=["y","scaleY","originY"];function gy(n,s,i,o){hy(n.x,s,oD,i?i.x:void 0,o?o.x:void 0),hy(n.y,s,rD,i?i.y:void 0,o?o.y:void 0)}function vy(n){return n.translate===0&&n.scale===1}function Q_(n){return vy(n.x)&&vy(n.y)}function yy(n,s){return n.min===s.min&&n.max===s.max}function lD(n,s){return yy(n.x,s.x)&&yy(n.y,s.y)}function by(n,s){return Math.round(n.min)===Math.round(s.min)&&Math.round(n.max)===Math.round(s.max)}function ex(n,s){return by(n.x,s.x)&&by(n.y,s.y)}function _y(n){return xn(n.x)/xn(n.y)}function xy(n,s){return n.translate===s.translate&&n.scale===s.scale&&n.originPoint===s.originPoint}class cD{constructor(){this.members=[]}add(s){zp(this.members,s),s.scheduleRender()}remove(s){if(Pp(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(s){const i=this.members.findIndex(c=>s===c);if(i===0)return!1;let o;for(let c=i;c>=0;c--){const u=this.members[c];if(u.isPresent!==!1){o=u;break}}return o?(this.promote(o),!0):!1}promote(s,i){const o=this.lead;if(s!==o&&(this.prevLead=o,this.lead=s,s.show(),o)){o.instance&&o.scheduleRender(),s.scheduleRender(),s.resumeFrom=o,i&&(s.resumeFrom.preserveOpacity=!0),o.snapshot&&(s.snapshot=o.snapshot,s.snapshot.latestValues=o.animationValues||o.latestValues),s.root&&s.root.isUpdating&&(s.isLayoutDirty=!0);const{crossfade:c}=s.options;c===!1&&o.hide()}}exitAnimationComplete(){this.members.forEach(s=>{const{options:i,resumingFrom:o}=s;i.onExitComplete&&i.onExitComplete(),o&&o.options.onExitComplete&&o.options.onExitComplete()})}scheduleRender(){this.members.forEach(s=>{s.instance&&s.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function uD(n,s,i){let o="";const c=n.x.translate/s.x,u=n.y.translate/s.y,d=(i==null?void 0:i.z)||0;if((c||u||d)&&(o=`translate3d(${c}px, ${u}px, ${d}px) `),(s.x!==1||s.y!==1)&&(o+=`scale(${1/s.x}, ${1/s.y}) `),i){const{transformPerspective:g,rotate:v,rotateX:b,rotateY:_,skewX:S,skewY:T}=i;g&&(o=`perspective(${g}px) ${o}`),v&&(o+=`rotate(${v}deg) `),b&&(o+=`rotateX(${b}deg) `),_&&(o+=`rotateY(${_}deg) `),S&&(o+=`skewX(${S}deg) `),T&&(o+=`skewY(${T}deg) `)}const m=n.x.scale*s.x,h=n.y.scale*s.y;return(m!==1||h!==1)&&(o+=`scale(${m}, ${h})`),o||"none"}const $a={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},ur=typeof window<"u"&&window.MotionDebug!==void 0,Sf=["","X","Y","Z"],dD={visibility:"hidden"},Sy=1e3;let fD=0;function Tf(n,s,i,o){const{latestValues:c}=s;c[n]&&(i[n]=c[n],s.setStaticValue(n,0),o&&(o[n]=0))}function tx(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:s}=n.options;if(!s)return;const i=a_(s);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:c,layoutId:u}=n.options;window.MotionCancelOptimisedAnimation(i,"transform",ft,!(c||u))}const{parent:o}=n;o&&!o.hasCheckedOptimisedAppear&&tx(o)}function nx({attachResizeListener:n,defaultParent:s,measureScroll:i,checkIsScrollRoot:o,resetTransform:c}){return class{constructor(d={},m=s==null?void 0:s()){this.id=fD++,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,ur&&($a.totalNodes=$a.resolvedTargetDeltas=$a.recalculatedProjection=0),this.nodes.forEach(hD),this.nodes.forEach(_D),this.nodes.forEach(xD),this.nodes.forEach(gD),ur&&window.MotionDebug.record($a)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,this.root=m?m.root||m:this,this.path=m?[...m.path,m]:[],this.parent=m,this.depth=m?m.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new QA)}addEventListener(d,m){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new Vp),this.eventHandlers.get(d).add(m)}notifyListeners(d,...m){const h=this.eventHandlers.get(d);h&&h.notify(...m)}hasListeners(d){return this.eventHandlers.has(d)}mount(d,m=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=WA(d),this.instance=d;const{layoutId:h,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),m&&(g||h)&&(this.isLayoutDirty=!0),n){let b;const _=()=>this.root.updateBlockedByResize=!1;n(d,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=eD(_,250),mc.hasAnimatedSinceResize&&(mc.hasAnimatedSinceResize=!1,this.nodes.forEach(ky))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&v&&(h||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:_,hasRelativeTargetChanged:S,layout:T})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||v.getDefaultTransition()||ND,{onLayoutAnimationStart:j,onLayoutAnimationComplete:w}=v.getProps(),C=!this.targetLayout||!ex(this.targetLayout,T)||S,A=!_&&S;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||A||_&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,A);const M={...Up(N,"layout"),onPlay:j,onComplete:w};(v.shouldReduceMotion||this.options.layoutRoot)&&(M.delay=0,M.type=!1),this.startAnimation(M)}else _||ky(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=T})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const d=this.getStack();d&&d.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ha(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(SD),this.animationId++)}getTransformTemplate(){const{visualElement:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&tx(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:m,layout:h}=this.options;if(m===void 0&&!h)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),d&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ty);return}this.isUpdating||this.nodes.forEach(yD),this.isUpdating=!1,this.nodes.forEach(bD),this.nodes.forEach(pD),this.nodes.forEach(mD),this.clearAllSnapshots();const m=is.now();Kt.delta=Is(0,1e3/60,m-Kt.timestamp),Kt.timestamp=m,Kt.isProcessing=!0,mf.update.process(Kt),mf.preRender.process(Kt),mf.render.process(Kt),Kt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Cp.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(vD),this.sharedNodes.forEach(TD)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ft.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ft.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const d=this.layout;this.layout=this.measure(!1),this.layoutCorrected=jt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:m}=this.options;m&&m.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let m=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(m=!1),m){const h=o(this.instance);this.scroll={animationId:this.root.animationId,phase:d,isRoot:h,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!c)return;const d=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,m=this.projectionDelta&&!Q_(this.projectionDelta),h=this.getTransformTemplate(),g=h?h(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;d&&(m||Ga(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const m=this.measurePageBox();let h=this.removeElementScroll(m);return d&&(h=this.removeTransform(h)),jD(h),{animationId:this.root.animationId,measuredBox:m,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:m}=this.options;if(!m)return jt();const h=m.measureViewportBox();if(!(((d=this.scroll)===null||d===void 0?void 0:d.wasRoot)||this.path.some(CD))){const{scroll:v}=this.root;v&&(Zi(h.x,v.offset.x),Zi(h.y,v.offset.y))}return h}removeElementScroll(d){var m;const h=jt();if(On(h,d),!((m=this.scroll)===null||m===void 0)&&m.wasRoot)return h;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&&On(h,d),Zi(h.x,b.offset.x),Zi(h.y,b.offset.y))}return h}applyTransform(d,m=!1){const h=jt();On(h,d);for(let g=0;g<this.path.length;g++){const v=this.path[g];!m&&v.options.layoutScroll&&v.scroll&&v!==v.root&&Ki(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),Ga(v.latestValues)&&Ki(h,v.latestValues)}return Ga(this.latestValues)&&Ki(h,this.latestValues),h}removeTransform(d){const m=jt();On(m,d);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!g.instance||!Ga(g.latestValues))continue;tp(g.latestValues)&&g.updateSnapshot();const v=jt(),b=g.measurePageBox();On(v,b),gy(m,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return Ga(this.latestValues)&&gy(m,this.latestValues),m}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Kt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!1){var m;const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==h;if(!(d||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((m=this.parent)===null||m===void 0)&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:_}=this.options;if(!(!this.layout||!(b||_))){if(this.resolvedRelativeTargetAt=Kt.timestamp,!this.targetDelta&&!this.relativeTarget){const S=this.getClosestProjectingParent();S&&S.layout&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=jt(),this.relativeTargetOrigin=jt(),vr(this.relativeTargetOrigin,this.layout.layoutBox,S.layout.layoutBox),On(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=jt(),this.targetWithTransforms=jt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),DA(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):On(this.target,this.layout.layoutBox),Z_(this.target,this.targetDelta)):On(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=jt(),this.relativeTargetOrigin=jt(),vr(this.relativeTargetOrigin,this.target,S.target),On(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}ur&&$a.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||tp(this.parent.latestValues)||F_(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var d;const m=this.getLead(),h=!!this.resumingFrom||this!==m;let g=!0;if((this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty)&&(g=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===Kt.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;On(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,S=this.treeScale.y;PA(this.layoutCorrected,this.treeScale,this.path,h),m.layout&&!m.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(m.target=m.layout.layoutBox,m.targetWithTransforms=jt());const{target:T}=m;if(!T){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(py(this.prevProjectionDelta.x,this.projectionDelta.x),py(this.prevProjectionDelta.y,this.projectionDelta.y)),gr(this.projectionDelta,this.layoutCorrected,T,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==S||!xy(this.projectionDelta.x,this.prevProjectionDelta.x)||!xy(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",T)),ur&&$a.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){var m;if((m=this.options.visualElement)===null||m===void 0||m.scheduleRender(),d){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Fi(),this.projectionDelta=Fi(),this.projectionDeltaWithTransform=Fi()}setAnimationOrigin(d,m=!1){const h=this.snapshot,g=h?h.latestValues:{},v={...this.latestValues},b=Fi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!m;const _=jt(),S=h?h.source:void 0,T=this.layout?this.layout.source:void 0,N=S!==T,j=this.getStack(),w=!j||j.members.length<=1,C=!!(N&&!w&&this.options.crossfade===!0&&!this.path.some(wD));this.animationProgress=0;let A;this.mixTargetDelta=M=>{const D=M/1e3;wy(b.x,d.x,D),wy(b.y,d.y,D),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(vr(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),kD(this.relativeTarget,this.relativeTargetOrigin,_,D),A&&lD(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=jt()),On(A,this.relativeTarget)),N&&(this.animationValues=v,nD(v,g,this.latestValues,D,C,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=D},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ha(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ft.update(()=>{mc.hasAnimatedSinceResize=!0,this.currentAnimation=JA(0,Sy,{...d,onUpdate:m=>{this.mixTargetDelta(m),d.onUpdate&&d.onUpdate(m)},onComplete:()=>{d.onComplete&&d.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const d=this.getStack();d&&d.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Sy),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:m,target:h,layout:g,latestValues:v}=d;if(!(!m||!h||!g)){if(this!==d&&this.layout&&g&&sx(this.options.animationType,this.layout.layoutBox,g.layoutBox)){h=this.target||jt();const b=xn(this.layout.layoutBox.x);h.x.min=d.target.x.min,h.x.max=h.x.min+b;const _=xn(this.layout.layoutBox.y);h.y.min=d.target.y.min,h.y.max=h.y.min+_}On(m,h),Ki(m,v),gr(this.projectionDeltaWithTransform,this.layoutCorrected,m,v)}}registerSharedNode(d,m){this.sharedNodes.has(d)||this.sharedNodes.set(d,new cD),this.sharedNodes.get(d).add(m);const g=m.options.initialPromotionConfig;m.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(m):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){var d;const{layoutId:m}=this.options;return m?((d=this.getStack())===null||d===void 0?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:m}=this.options;return m?(d=this.getStack())===null||d===void 0?void 0:d.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:m,preserveFollowOpacity:h}={}){const g=this.getStack();g&&g.promote(this,h),d&&(this.projectionDelta=void 0,this.needsReset=!0),m&&this.setOptions({transition:m})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let m=!1;const{latestValues:h}=d;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(m=!0),!m)return;const g={};h.z&&Tf("z",d,g,this.animationValues);for(let v=0;v<Sf.length;v++)Tf(`rotate${Sf[v]}`,d,g,this.animationValues),Tf(`skew${Sf[v]}`,d,g,this.animationValues);d.render();for(const v in g)d.setStaticValue(v,g[v]),this.animationValues&&(this.animationValues[v]=g[v]);d.scheduleRender()}getProjectionStyles(d){var m,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return dD;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=fc(d==null?void 0:d.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const b=this.getLead();if(!this.projectionDelta||!this.layout||!b.target){const N={};return this.options.layoutId&&(N.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,N.pointerEvents=fc(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!Ga(this.latestValues)&&(N.transform=v?v({},""):"none",this.hasProjected=!1),N}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=uD(this.projectionDeltaWithTransform,this.treeScale,_),v&&(g.transform=v(_,g.transform));const{x:S,y:T}=this.projectionDelta;g.transformOrigin=`${S.origin*100}% ${T.origin*100}% 0`,b.animationValues?g.opacity=b===this?(h=(m=_.opacity)!==null&&m!==void 0?m:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:_.opacityExit:g.opacity=b===this?_.opacity!==void 0?_.opacity:"":_.opacityExit!==void 0?_.opacityExit:0;for(const N in _c){if(_[N]===void 0)continue;const{correct:j,applyTo:w}=_c[N],C=g.transform==="none"?_[N]:j(_[N],b);if(w){const A=w.length;for(let M=0;M<A;M++)g[w[M]]=C}else g[N]=C}return this.options.layoutId&&(g.pointerEvents=b===this?fc(d==null?void 0:d.pointerEvents)||"":"none"),g}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>{var m;return(m=d.currentAnimation)===null||m===void 0?void 0:m.stop()}),this.root.nodes.forEach(Ty),this.root.sharedNodes.clear()}}}function pD(n){n.updateLayout()}function mD(n){var s;const i=((s=n.resumeFrom)===null||s===void 0?void 0:s.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&i&&n.hasListeners("didUpdate")){const{layoutBox:o,measuredBox:c}=n.layout,{animationType:u}=n.options,d=i.source!==n.layout.source;u==="size"?Bn(b=>{const _=d?i.measuredBox[b]:i.layoutBox[b],S=xn(_);_.min=o[b].min,_.max=_.min+S}):sx(u,i.layoutBox,o)&&Bn(b=>{const _=d?i.measuredBox[b]:i.layoutBox[b],S=xn(o[b]);_.max=_.min+S,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[b].max=n.relativeTarget[b].min+S)});const m=Fi();gr(m,o,i.layoutBox);const h=Fi();d?gr(h,n.applyTransform(c,!0),i.measuredBox):gr(h,o,i.layoutBox);const g=!Q_(m);let v=!1;if(!n.resumeFrom){const b=n.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:S}=b;if(_&&S){const T=jt();vr(T,i.layoutBox,_.layoutBox);const N=jt();vr(N,o,S.layoutBox),ex(T,N)||(v=!0),b.options.layoutRoot&&(n.relativeTarget=N,n.relativeTargetOrigin=T,n.relativeParent=b)}}}n.notifyListeners("didUpdate",{layout:o,snapshot:i,delta:h,layoutDelta:m,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(n.isLead()){const{onExitComplete:o}=n.options;o&&o()}n.options.transition=void 0}function hD(n){ur&&$a.totalNodes++,n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function gD(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function vD(n){n.clearSnapshot()}function Ty(n){n.clearMeasurements()}function yD(n){n.isLayoutDirty=!1}function bD(n){const{visualElement:s}=n.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),n.resetTransform()}function ky(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function _D(n){n.resolveTargetDelta()}function xD(n){n.calcProjection()}function SD(n){n.resetSkewAndRotation()}function TD(n){n.removeLeadSnapshot()}function wy(n,s,i){n.translate=vt(s.translate,0,i),n.scale=vt(s.scale,1,i),n.origin=s.origin,n.originPoint=s.originPoint}function Ny(n,s,i,o){n.min=vt(s.min,i.min,o),n.max=vt(s.max,i.max,o)}function kD(n,s,i,o){Ny(n.x,s.x,i.x,o),Ny(n.y,s.y,i.y,o)}function wD(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const ND={duration:.45,ease:[.4,0,.1,1]},jy=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),Cy=jy("applewebkit/")&&!jy("chrome/")?Math.round:_n;function Ey(n){n.min=Cy(n.min),n.max=Cy(n.max)}function jD(n){Ey(n.x),Ey(n.y)}function sx(n,s,i){return n==="position"||n==="preserve-aspect"&&!AA(_y(s),_y(i),.2)}function CD(n){var s;return n!==n.root&&((s=n.scroll)===null||s===void 0?void 0:s.wasRoot)}const ED=nx({attachResizeListener:(n,s)=>jr(n,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),kf={current:void 0},ax=nx({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!kf.current){const n=new ED({});n.mount(window),n.setOptions({layoutScroll:!0}),kf.current=n}return kf.current},resetTransform:(n,s)=>{n.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),AD={pan:{Feature:FA},drag:{Feature:$A,ProjectionNode:ax,MeasureLayout:J_}};function DD(n,s,i){var o;if(n instanceof Element)return[n];if(typeof n=="string"){let c=document;const u=(o=void 0)!==null&&o!==void 0?o:c.querySelectorAll(n);return u?Array.from(u):[]}return Array.from(n)}function ix(n,s){const i=DD(n),o=new AbortController,c={passive:!0,...s,signal:o.signal};return[i,c,()=>o.abort()]}function Ay(n){return s=>{s.pointerType==="touch"||P_()||n(s)}}function RD(n,s,i={}){const[o,c,u]=ix(n,i),d=Ay(m=>{const{target:h}=m,g=s(m);if(typeof g!="function"||!h)return;const v=Ay(b=>{g(b),h.removeEventListener("pointerleave",v)});h.addEventListener("pointerleave",v,c)});return o.forEach(m=>{m.addEventListener("pointerenter",d,c)}),u}function Dy(n,s,i){const{props:o}=n;n.animationState&&o.whileHover&&n.animationState.setActive("whileHover",i==="Start");const c="onHover"+i,u=o[c];u&&ft.postRender(()=>u(s,Mr(s)))}class MD extends ba{mount(){const{current:s}=this.node;s&&(this.unmount=RD(s,i=>(Dy(this.node,i,"Start"),o=>Dy(this.node,o,"End"))))}unmount(){}}class OD extends ba{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=Rr(jr(this.node.current,"focus",()=>this.onFocus()),jr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const ox=(n,s)=>s?n===s?!0:ox(n,s.parentElement):!1,ID=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function BD(n){return ID.has(n.tagName)||n.tabIndex!==-1}const dr=new WeakSet;function Ry(n){return s=>{s.key==="Enter"&&n(s)}}function wf(n,s){n.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const LD=(n,s)=>{const i=n.currentTarget;if(!i)return;const o=Ry(()=>{if(dr.has(i))return;wf(i,"down");const c=Ry(()=>{wf(i,"up")}),u=()=>wf(i,"cancel");i.addEventListener("keyup",c,s),i.addEventListener("blur",u,s)});i.addEventListener("keydown",o,s),i.addEventListener("blur",()=>i.removeEventListener("keydown",o),s)};function My(n){return em(n)&&!P_()}function UD(n,s,i={}){const[o,c,u]=ix(n,i),d=m=>{const h=m.currentTarget;if(!My(m)||dr.has(h))return;dr.add(h);const g=s(m),v=(S,T)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!My(S)||!dr.has(h))&&(dr.delete(h),typeof g=="function"&&g(S,{success:T}))},b=S=>{v(S,i.useGlobalTarget||ox(h,S.target))},_=S=>{v(S,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return o.forEach(m=>{!BD(m)&&m.getAttribute("tabindex")===null&&(m.tabIndex=0),(i.useGlobalTarget?window:m).addEventListener("pointerdown",d,c),m.addEventListener("focus",g=>LD(g,c),c)}),u}function Oy(n,s,i){const{props:o}=n;n.animationState&&o.whileTap&&n.animationState.setActive("whileTap",i==="Start");const c="onTap"+(i==="End"?"":i),u=o[c];u&&ft.postRender(()=>u(s,Mr(s)))}class zD extends ba{mount(){const{current:s}=this.node;s&&(this.unmount=UD(s,i=>(Oy(this.node,i,"Start"),(o,{success:c})=>Oy(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const sp=new WeakMap,Nf=new WeakMap,PD=n=>{const s=sp.get(n.target);s&&s(n)},VD=n=>{n.forEach(PD)};function HD({root:n,...s}){const i=n||document;Nf.has(i)||Nf.set(i,{});const o=Nf.get(i),c=JSON.stringify(s);return o[c]||(o[c]=new IntersectionObserver(VD,{root:n,...s})),o[c]}function qD(n,s,i){const o=HD(s);return sp.set(n,i),o.observe(n),()=>{sp.delete(n),o.unobserve(n)}}const GD={some:0,all:1};class $D extends ba{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:i,margin:o,amount:c="some",once:u}=s,d={root:i?i.current:void 0,rootMargin:o,threshold:typeof c=="number"?c:GD[c]},m=h=>{const{isIntersecting:g}=h;if(this.isInView===g||(this.isInView=g,u&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:b}=this.node.getProps(),_=g?v:b;_&&_(h)};return qD(this.node.current,d,m)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:i}=this.node;["amount","margin","root"].some(FD(s,i))&&this.startObserver()}unmount(){}}function FD({viewport:n={}},{viewport:s={}}={}){return i=>n[i]!==s[i]}const ZD={inView:{Feature:$D},tap:{Feature:zD},focus:{Feature:OD},hover:{Feature:MD}},KD={layout:{ProjectionNode:ax,MeasureLayout:J_}},Nc={current:null},tm={current:!1};function rx(){if(tm.current=!0,!!kp)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),s=()=>Nc.current=n.matches;n.addListener(s),s()}else Nc.current=!1}const YD=[...C_,Xt,ga],JD=n=>YD.find(j_(n)),Iy=new WeakMap;function WD(n,s,i){for(const o in s){const c=s[o],u=i[o];if(Qt(c))n.addValue(o,c);else if(Qt(u))n.addValue(o,wr(c,{owner:n}));else if(u!==c)if(n.hasValue(o)){const d=n.getValue(o);d.liveStyle===!0?d.jump(c):d.hasAnimated||d.set(c)}else{const d=n.getStaticValue(o);n.addValue(o,wr(d!==void 0?d:c,{owner:n}))}}for(const o in i)s[o]===void 0&&n.removeValue(o);return s}const By=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class XD{scrapeMotionValuesFromProps(s,i,o){return{}}constructor({parent:s,props:i,presenceContext:o,reducedMotionConfig:c,blockInitialAnimation:u,visualState:d},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Jp,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=is.now();this.renderScheduledAt<S&&(this.renderScheduledAt=S,ft.render(this.render,!1,!0))};const{latestValues:h,renderState:g,onUpdate:v}=d;this.onUpdate=v,this.latestValues=h,this.baseTarget={...h},this.initialValues=i.initial?{...h}:{},this.renderState=g,this.parent=s,this.props=i,this.presenceContext=o,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=m,this.blockInitialAnimation=!!u,this.isControllingVariants=Lc(i),this.isVariantNode=Pb(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,..._}=this.scrapeMotionValuesFromProps(i,{},this);for(const S in _){const T=_[S];h[S]!==void 0&&Qt(T)&&T.set(h[S],!1)}}mount(s){this.current=s,Iy.set(s,this),this.projection&&!this.projection.instance&&this.projection.mount(s),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,o)=>this.bindToMotionValue(o,i)),tm.current||rx(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Nc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Iy.delete(this.current),this.projection&&this.projection.unmount(),ha(this.notifyUpdate),ha(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const i=this.features[s];i&&(i.unmount(),i.isMounted=!1)}this.current=null}bindToMotionValue(s,i){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const o=ni.has(s),c=i.on("change",m=>{this.latestValues[s]=m,this.props.onUpdate&&ft.preRender(this.notifyUpdate),o&&this.projection&&(this.projection.isTransformDirty=!0)}),u=i.on("renderRequest",this.scheduleRender);let d;window.MotionCheckAppearSync&&(d=window.MotionCheckAppearSync(this,s,i)),this.valueSubscriptions.set(s,()=>{c(),u(),d&&d(),i.owner&&i.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in to){const i=to[s];if(!i)continue;const{isEnabled:o,Feature:c}=i;if(!this.features[s]&&c&&o(this.props)&&(this.features[s]=new c(this)),this.features[s]){const u=this.features[s];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):jt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,i){this.latestValues[s]=i}update(s,i){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let o=0;o<By.length;o++){const c=By[o];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const u="on"+c,d=s[u];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=WD(this,this.scrapeMotionValuesFromProps(s,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(s){return this.props.variants?this.props.variants[s]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(s){const i=this.getClosestVariantNode();if(i)return i.variantChildren&&i.variantChildren.add(s),()=>i.variantChildren.delete(s)}addValue(s,i){const o=this.values.get(s);i!==o&&(o&&this.removeValue(s),this.bindToMotionValue(s,i),this.values.set(s,i),this.latestValues[s]=i.get())}removeValue(s){this.values.delete(s);const i=this.valueSubscriptions.get(s);i&&(i(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,i){if(this.props.values&&this.props.values[s])return this.props.values[s];let o=this.values.get(s);return o===void 0&&i!==void 0&&(o=wr(i===null?void 0:i,{owner:this}),this.addValue(s,o)),o}readValue(s,i){var o;let c=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:(o=this.getBaseTargetFromProps(this.props,s))!==null&&o!==void 0?o:this.readValueFromInstance(this.current,s,this.options);return c!=null&&(typeof c=="string"&&(w_(c)||g_(c))?c=parseFloat(c):!JD(c)&&ga.test(i)&&(c=S_(s,i)),this.setBaseTarget(s,Qt(c)?c.get():c)),Qt(c)?c.get():c}setBaseTarget(s,i){this.baseTarget[s]=i}getBaseTarget(s){var i;const{initial:o}=this.props;let c;if(typeof o=="string"||typeof o=="object"){const d=Ap(this.props,o,(i=this.presenceContext)===null||i===void 0?void 0:i.custom);d&&(c=d[s])}if(o&&c!==void 0)return c;const u=this.getBaseTargetFromProps(this.props,s);return u!==void 0&&!Qt(u)?u:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,i){return this.events[s]||(this.events[s]=new Vp),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class lx extends XD{constructor(){super(...arguments),this.KeyframeResolver=E_}sortInstanceNodePosition(s,i){return s.compareDocumentPosition(i)&2?1:-1}getBaseTargetFromProps(s,i){return s.style?s.style[i]:void 0}removeValueFromRenderState(s,{vars:i,style:o}){delete i[s],delete o[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;Qt(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function QD(n){return window.getComputedStyle(n)}class eR extends lx{constructor(){super(...arguments),this.type="html",this.renderInstance=Yb}readValueFromInstance(s,i){if(ni.has(i)){const o=Yp(i);return o&&o.default||0}else{const o=QD(s),c=(Fb(i)?o.getPropertyValue(i):o[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return K_(s,i)}build(s,i,o){Mp(s,i,o.transformTemplate)}scrapeMotionValuesFromProps(s,i,o){return Lp(s,i,o)}}class tR extends lx{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=jt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(ni.has(i)){const o=Yp(i);return o&&o.default||0}return i=Jb.has(i)?i:jp(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,o){return Qb(s,i,o)}build(s,i,o){Op(s,i,this.isSVGTag,o.transformTemplate)}renderInstance(s,i,o,c){Wb(s,i,o,c)}mount(s){this.isSVGTag=Bp(s.tagName),super.mount(s)}}const nR=(n,s)=>Ep(n)?new tR(s):new eR(s,{allowProjection:n!==y.Fragment}),sR=EC({..._A,...ZD,...AD,...KD},nR),Ot=Gj(sR);function aR(){!tm.current&&rx();const[n]=y.useState(Nc.current);return n}const iR="_overlay_cmicx_1",oR="_dialog_cmicx_11",rR="_title_cmicx_30",lR="_description_cmicx_38",cR="_actions_cmicx_45",uR="_cancelButton_cmicx_52",dR="_confirmButton_cmicx_79",Pa={overlay:iR,dialog:oR,title:rR,description:lR,actions:cR,cancelButton:uR,confirmButton:dR};function Ja({isOpen:n,title:s,description:i,confirmLabel:o="Delete",onConfirm:c,onCancel:u}){const d=y.useId(),m=y.useId();return l.jsx(rs,{children:n&&l.jsx(Ot.div,{className:Pa.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:u,onKeyDown:h=>{h.key==="Escape"&&u()},role:"dialog","aria-modal":"true","aria-labelledby":d,"aria-describedby":i?m:void 0,children:l.jsxs(Ot.div,{className:Pa.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:h=>h.stopPropagation(),children:[l.jsx("h3",{id:d,className:Pa.title,children:s}),i&&l.jsx("p",{id:m,className:Pa.description,children:i}),l.jsxs("div",{className:Pa.actions,children:[l.jsx("button",{type:"button",className:Pa.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),l.jsx("button",{type:"button",className:Pa.confirmButton,onClick:c,children:o})]})]})})})}const fR="_spinner_1uyt1_1",pR="_spin_1uyt1_1",mR="_sm_1uyt1_14",hR="_md_1uyt1_20",gR="_lg_1uyt1_26",vR="_xl_1uyt1_32",Ly={spinner:fR,spin:pR,sm:mR,md:hR,lg:gR,xl:vR};function cx({size:n="md",className:s,label:i="Loading",liveRegion:o=!1}){return l.jsx("span",{className:`${Ly.spinner} ${Ly[n]} ${s??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const yR="_splash_1bn1g_1",bR="_logo_1bn1g_11",Uy={splash:yR,logo:bR};function ux(){return l.jsxs("div",{className:Uy.splash,"data-testid":"splash-screen",children:[l.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Uy.logo}),l.jsx(cx,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const dx=50;function _R(n,s,i,o,c=dx){return o?n<c:s-n-i<c}function xR(n,s){const i=s-n;return i>0?i:0}function SR({scrollRef:n,contentLength:s,isReversed:i}){const[o,c]=y.useState(!0),u=y.useRef(0),d=y.useRef(!1),m=y.useRef(0);y.useEffect(()=>{const g=n.current;if(!g)return;let v=!0;const b=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const _=_R(g.scrollTop,g.scrollHeight,g.clientHeight,i,dx);_!==v&&(v=_,c(_))}))};return g.addEventListener("scroll",b,{passive:!0}),()=>{g.removeEventListener("scroll",b),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[n,i]),y.useLayoutEffect(()=>{const g=n.current;!g||d.current||(d.current=!0,i?g.scrollTop=0:g.scrollTop=g.scrollHeight,c(!0))},[n,i]),y.useLayoutEffect(()=>{const g=n.current;if(g){if(i&&!o){const v=xR(u.current,g.scrollHeight);v>0&&(g.scrollTop+=v)}o&&(i?g.scrollTo({top:0,behavior:"smooth"}):g.scrollTo({top:g.scrollHeight,behavior:"smooth"})),u.current=g.scrollHeight}},[s,o,i,n]);const h=y.useCallback(()=>{const g=n.current;if(!g)return;const v=i?0:g.scrollHeight;g.scrollTo({top:v,behavior:"smooth"}),c(!0)},[n,i]);return{isAtAnchor:o,scrollToAnchor:h}}const TR="_panelContainer_1h5qd_1",kR="_emptyState_1h5qd_8",wR="_fadeIn_1h5qd_1",NR="_workspaceSummary_1h5qd_17",jR="_workspaceSummaryTitle_1h5qd_28",CR="_workspaceSummarySubtitle_1h5qd_32",ER="_header_1h5qd_36",AR="_headerInfo_1h5qd_71",DR="_killButton_1h5qd_77",RR="_headerTitle_1h5qd_106",MR="_headerActions_1h5qd_121",OR="_taskStatusBadge_1h5qd_128",IR="_taskBranch_1h5qd_137",BR="_taskBlockedBadge_1h5qd_143",LR="_btnPrimary_1h5qd_151",UR="_btnDanger_1h5qd_182",zR="_btnGhost_1h5qd_221",PR="_rejectInput_1h5qd_247",VR="_tabBar_1h5qd_277",HR="_tab_1h5qd_277",qR="_active_1h5qd_303",GR="_eventScroll_1h5qd_308",$R="_tabContent_1h5qd_314",FR="_noContext_1h5qd_319",ZR="_overviewContent_1h5qd_325",KR="_overviewDashboard_1h5qd_334",YR="_overviewHero_1h5qd_340",JR="_statusBadge_1h5qd_347",WR="_statusPending_1h5qd_359",XR="_statusAssigned_1h5qd_364",QR="_statusInProgress_1h5qd_369",eM="_statusReview_1h5qd_374",tM="_statusDone_1h5qd_379",nM="_statusFailed_1h5qd_384",sM="_statusWaitingInput_1h5qd_389",aM="_overviewBranchPill_1h5qd_394",iM="_branchLink_1h5qd_409",oM="_overviewSection_1h5qd_420",rM="_overviewLabel_1h5qd_426",lM="_overviewValue_1h5qd_433",cM="_overviewMuted_1h5qd_438",uM="_overviewMarkdown_1h5qd_444",dM="_envRow_1h5qd_513",fM="_envDot_1h5qd_519",pM="_envDotGreen_1h5qd_526",mM="_envDotYellow_1h5qd_530",hM="_envDotRed_1h5qd_534",gM="_envDotGray_1h5qd_538",vM="_depList_1h5qd_542",yM="_depItem_1h5qd_548",bM="_depBlocked_1h5qd_555",_M="_depDone_1h5qd_559",xM="_timeline_1h5qd_563",SM="_timelineRow_1h5qd_569",TM="_timelineKey_1h5qd_576",kM="_timelineValue_1h5qd_582",wM="_timelineDelta_1h5qd_586",NM="_reviewNotes_1h5qd_597",jM="_overviewDescription_1h5qd_608",CM="_waitingMessage_1h5qd_614",EM="_errorMessage_1h5qd_618",AM="_eventOverflowWarning_1h5qd_622",DM="_attemptSelector_1h5qd_636",RM="_attemptLabel_1h5qd_652",MM="_attemptButton_1h5qd_656",OM="_attemptActive_1h5qd_673",IM="_attemptStatus_1h5qd_679",BM="_emptyCta_1h5qd_685",LM="_ctaTitle_1h5qd_697",UM="_ctaDescription_1h5qd_703",zM="_ctaButton_1h5qd_710",PM="_ctaCreateForm_1h5qd_745",VM="_ctaCreateInput_1h5qd_751",HM="_ctaCreateOk_1h5qd_782",qM="_ctaLink_1h5qd_817",GM="_workspaceHeader_1h5qd_831",$M="_workspaceName_1h5qd_856",FM="_workspaceMeta_1h5qd_869",ZM="_metaRow_1h5qd_877",KM="_metaLabel_1h5qd_890",YM="_metaValue_1h5qd_905",JM="_archiveButton_1h5qd_915",WM="_repoLink_1h5qd_945",XM="_metaToggle_1h5qd_955",QM="_metaToggleArrow_1h5qd_976",e3="_metaToggleArrowOpen_1h5qd_981",t3="_progressBarContainer_1h5qd_985",n3="_progressBar_1h5qd_985",s3="_progressFill_1h5qd_1001",a3="_progressLabel_1h5qd_1008",i3="_metaTimestamps_1h5qd_1015",o3="_metaTimestamp_1h5qd_1015",U={panelContainer:TR,emptyState:kR,fadeIn:wR,workspaceSummary:NR,workspaceSummaryTitle:jR,workspaceSummarySubtitle:CR,header:ER,headerInfo:AR,killButton:DR,headerTitle:RR,headerActions:MR,taskStatusBadge:OR,taskBranch:IR,taskBlockedBadge:BR,btnPrimary:LR,btnDanger:UR,btnGhost:zR,rejectInput:PR,tabBar:VR,tab:HR,active:qR,eventScroll:GR,tabContent:$R,noContext:FR,overviewContent:ZR,overviewDashboard:KR,overviewHero:YR,statusBadge:JR,statusPending:WR,statusAssigned:XR,statusInProgress:QR,statusReview:eM,statusDone:tM,statusFailed:nM,statusWaitingInput:sM,overviewBranchPill:aM,branchLink:iM,overviewSection:oM,overviewLabel:rM,overviewValue:lM,overviewMuted:cM,overviewMarkdown:uM,envRow:dM,envDot:fM,envDotGreen:pM,envDotYellow:mM,envDotRed:hM,envDotGray:gM,depList:vM,depItem:yM,depBlocked:bM,depDone:_M,timeline:xM,timelineRow:SM,timelineKey:TM,timelineValue:kM,timelineDelta:wM,reviewNotes:NM,overviewDescription:jM,waitingMessage:CM,errorMessage:EM,eventOverflowWarning:AM,attemptSelector:DM,attemptLabel:RM,attemptButton:MM,attemptActive:OM,attemptStatus:IM,emptyCta:BM,ctaTitle:LM,ctaDescription:UM,ctaButton:zM,ctaCreateForm:PM,ctaCreateInput:VM,ctaCreateOk:HM,ctaLink:qM,workspaceHeader:GM,workspaceName:$M,workspaceMeta:FM,metaRow:ZM,metaLabel:KM,metaValue:YM,archiveButton:JM,repoLink:WM,metaToggle:XM,metaToggleArrow:QM,metaToggleArrowOpen:e3,progressBarContainer:t3,progressBar:n3,progressFill:s3,progressLabel:a3,metaTimestamps:i3,metaTimestamp:o3},r3="_wrapper_p24zt_1",l3="_scrollContainer_p24zt_9",c3="_toolbar_p24zt_15",u3="_directionToggle_p24zt_22",d3="_scrollToAnchor_p24zt_60",f3="_scrollToAnchorBottom_p24zt_84",p3="_scrollToAnchorTop_p24zt_88",Va={wrapper:r3,scrollContainer:l3,toolbar:c3,directionToggle:u3,scrollToAnchor:d3,scrollToAnchorBottom:f3,scrollToAnchorTop:p3},fx="grackle-stream-direction";function m3(){try{return localStorage.getItem(fx)==="reversed"}catch{return!1}}function h3({eventsDropped:n}){return n<=0?l.jsx(l.Fragment,{}):l.jsxs("div",{className:U.eventOverflowWarning,role:"alert",children:["⚠"," ",n.toLocaleString()," older event",n===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function nm({events:n,eventsDropped:s,emptyState:i}){const o=y.useRef(null),[c,u]=y.useState(m3),d=aR(),m=y.useMemo(()=>c?[...n].reverse():n,[n,c]),{isAtAnchor:h,scrollToAnchor:g}=SR({scrollRef:o,contentLength:n.length,isReversed:c}),v=()=>{const S=!c;u(S);try{localStorage.setItem(fx,S?"reversed":"default")}catch{}},b=d?0:.2,_=c?-8:8;return l.jsxs("div",{className:Va.wrapper,children:[l.jsx("div",{className:Va.toolbar,children:l.jsx("button",{className:Va.directionToggle,onClick:v,title:c?"Showing newest first":"Showing oldest first","aria-label":c?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:c?"↓":"↑"})}),l.jsxs("div",{ref:o,className:Va.scrollContainer,"data-testid":"event-stream-scroll",children:[n.length===0&&i,l.jsx(h3,{eventsDropped:s}),l.jsx(rs,{initial:!1,children:m.map((S,T)=>{const N=c?n.length-1-T:T;return l.jsx(Ot.div,{initial:{opacity:0,y:_},animate:{opacity:1,y:0},transition:{duration:b,ease:"easeOut"},children:l.jsx(Rj,{event:S,toolUseCtx:S.toolUseCtx})},`${S.sessionId}-${S.timestamp}-${N}`)})})]}),l.jsx(rs,{children:!h&&l.jsxs(Ot.button,{className:`${Va.scrollToAnchor} ${c?Va.scrollToAnchorTop:Va.scrollToAnchorBottom}`,onClick:g,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:[c?"↑":"↓"," New events"]})})]})}function sm(n){const{value:s,onSave:i,validate:o,fieldId:c,activeFieldId:u,onActivate:d,enterToSave:m=!0,trimOnSave:h=!0}=n,[g,v]=y.useState(""),[b,_]=y.useState(""),S=y.useRef(!1),T=u===c,N=y.useCallback(H=>{v(H),_("")},[]),j=y.useCallback(()=>{_("")},[]),w=y.useCallback(()=>{S.current=!1,d==null||d(null),v(""),_("")},[d]),C=y.useCallback(()=>{const H=h?g.trim():g;if(o){const Z=o(g);if(Z){_(Z);return}}const z=h?s.trim():s;if(H===z){w();return}i(H),w()},[g,s,h,o,i,w]),A=y.useCallback(()=>{S.current=!0,d==null||d(c),v(s),_("")},[c,s,d]),M=y.useCallback(H=>{if(S.current){S.current=!1;return}H.relatedTarget instanceof HTMLElement&&H.relatedTarget.dataset.editAction===c||C()},[c,C]),D=y.useCallback(H=>{H.key==="Escape"?w():H.key==="Enter"&&m&&C()},[w,m,C]),E=(()=>{if(!T)return!1;const H=h?s.trim():s;return(h?g.trim():g)!==H})();return y.useEffect(()=>{!T&&(g!==""||b!=="")&&(v(""),_(""))},[T,g,b]),{isEditing:T,draft:g,error:b,isDirty:E,startEdit:A,cancelEdit:w,save:C,setDraft:N,clearError:j,handleBlur:M,handleKeyDown:D,ignoreInitialBlurRef:S}}const g3="_editFieldWrapper_yuzty_1",v3="_editInput_yuzty_10",y3="_editTextarea_yuzty_42",b3="_editSelect_yuzty_78",_3="_editError_yuzty_111",x3="_editInputInvalid_yuzty_118",S3="_editHint_yuzty_123",T3="_unsavedDot_yuzty_132",k3="_metaValueClickable_yuzty_140",w3="_editButton_yuzty_159",N3="_metaPlaceholder_yuzty_175",j3="_worktreeToggle_yuzty_180",Ye={editFieldWrapper:g3,editInput:v3,editTextarea:y3,editSelect:b3,editError:_3,editInputInvalid:x3,editHint:S3,unsavedDot:T3,metaValueClickable:k3,editButton:w3,metaPlaceholder:N3,worktreeToggle:j3};function Yt(n){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="text",activeFieldId:d,onActivate:m,onChange:h,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:_,"data-testid":S}=n,T=y.useRef(null),N=sm({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:m,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(N.isEditing){const w=window.setTimeout(()=>{var C;(C=T.current)==null||C.focus()},0);return()=>window.clearTimeout(w)}},[N.isEditing]),c==="create"){const w=A=>{h==null||h(A.target.value)},C=o==null?void 0:o(s);return l.jsxs("div",{className:Ye.editFieldWrapper,children:[l.jsx("input",{className:`${Ye.editInput} ${C?Ye.editInputInvalid:""}`,value:s,onChange:w,maxLength:b,placeholder:v,"aria-label":_,"data-testid":S?`${S}-input`:void 0}),C&&l.jsx("span",{className:Ye.editError,"data-testid":"edit-error",children:C})]})}if(N.isEditing)return l.jsxs("div",{className:Ye.editFieldWrapper,children:[l.jsx("input",{ref:T,className:`${Ye.editInput} ${N.error?Ye.editInputInvalid:""}`,value:N.draft,onChange:w=>N.setDraft(w.target.value),onBlur:N.handleBlur,onKeyDown:N.handleKeyDown,maxLength:b,placeholder:v,"aria-label":_,"data-testid":S?`${S}-input`:void 0}),N.isDirty&&l.jsx("span",{className:Ye.unsavedDot,title:"Unsaved changes"}),N.error&&l.jsx("span",{className:Ye.editError,"data-testid":"edit-error",children:N.error}),l.jsx("span",{className:Ye.editHint,children:"Enter to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return l.jsxs("span",{role:"button",tabIndex:0,className:Ye.metaValueClickable,onClick:()=>N.startEdit(),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),N.startEdit())},title:"Click to edit","aria-label":_,"data-testid":S?`${S}-button`:void 0,children:[j!==void 0?j:s?l.jsx("span",{children:s}):l.jsx("span",{className:Ye.metaPlaceholder,children:v||"None"}),l.jsx("span",{className:Ye.editButton,"aria-hidden":"true",children:"✏️"})]})}function ap(n){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="textarea",activeFieldId:d,onActivate:m,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=n,S=y.useRef(null),T=sm({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:m,enterToSave:!1,trimOnSave:!1});if(y.useEffect(()=>{if(T.isEditing){const j=window.setTimeout(()=>{var w;(w=S.current)==null||w.focus()},0);return()=>window.clearTimeout(j)}},[T.isEditing]),c==="create"){const j=C=>{h==null||h(C.target.value)},w=o==null?void 0:o(s);return l.jsxs("div",{className:Ye.editFieldWrapper,children:[l.jsx("textarea",{className:`${Ye.editTextarea} ${w?Ye.editInputInvalid:""}`,value:s,onChange:j,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),w&&l.jsx("span",{className:Ye.editError,"data-testid":"edit-error",children:w})]})}if(T.isEditing)return l.jsxs("div",{className:Ye.editFieldWrapper,children:[l.jsx("textarea",{ref:S,className:`${Ye.editTextarea} ${T.error?Ye.editInputInvalid:""}`,value:T.draft,onChange:j=>T.setDraft(j.target.value),onBlur:T.handleBlur,onKeyDown:T.handleKeyDown,title:b,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),T.isDirty&&l.jsx("span",{className:Ye.unsavedDot,title:"Unsaved changes"}),T.error&&l.jsx("span",{className:Ye.editError,"data-testid":"edit-error",children:T.error}),l.jsx("span",{className:Ye.editHint,children:"Tab to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return l.jsxs("span",{role:"button",tabIndex:0,className:Ye.metaValueClickable,onClick:()=>T.startEdit(),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),T.startEdit())},title:"Click to edit","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[N!==void 0?N:s?l.jsx("span",{children:s}):l.jsx("span",{className:Ye.metaPlaceholder,children:v||"None"}),l.jsx("span",{className:Ye.editButton,"aria-hidden":"true",children:"✏️"})]})}function jc(n){var A;const{value:s,onSave:i,mode:o="edit",options:c,fieldId:u="select",activeFieldId:d,onActivate:m,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=n,S=y.useRef(null),T=sm({value:s,onSave:i,fieldId:u,activeFieldId:d,onActivate:m,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(T.isEditing){const M=window.setTimeout(()=>{var D;(D=S.current)==null||D.focus()},0);return()=>window.clearTimeout(M)}},[T.isEditing]);const N=y.useCallback(M=>{const D=M.target.value;T.ignoreInitialBlurRef.current=!1,D!==s&&i(D),T.cancelEdit()},[s,i,T]),j=y.useCallback(M=>{if(T.ignoreInitialBlurRef.current){T.ignoreInitialBlurRef.current=!1;return}M.relatedTarget instanceof HTMLElement&&M.relatedTarget.dataset.editAction===u||T.cancelEdit()},[u,T]);if(o==="create")return l.jsx("select",{className:Ye.editSelect,value:s,onChange:M=>h==null?void 0:h(M.target.value),"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(M=>l.jsx("option",{value:M.value,children:M.label},M.value))});if(T.isEditing)return l.jsx("select",{ref:S,className:Ye.editSelect,value:T.draft,onChange:N,onBlur:j,title:b,"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(M=>l.jsx("option",{value:M.value,children:M.label},M.value))});const w=g==null?void 0:g(s),C=(A=c.find(M=>M.value===s))==null?void 0:A.label;return l.jsxs("button",{type:"button",className:Ye.metaValueClickable,onClick:()=>T.startEdit(),title:"Click to change","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[w!==void 0?w:C?l.jsx("span",{children:C}):l.jsx("span",{className:Ye.metaPlaceholder,children:v||"None"}),l.jsx("span",{className:Ye.editButton,"aria-hidden":"true",children:"✏️"})]})}function C3(n){const{checked:s,onChange:i,label:o,ariaLabel:c,"data-testid":u}=n;return l.jsxs("label",{className:Ye.worktreeToggle,"data-testid":u,children:[l.jsx("input",{type:"checkbox",checked:s,onChange:d=>i(d.target.checked),"aria-label":c}),l.jsx("span",{children:o})]})}const E3="_envRow_1e1r5_1",A3="_envDot_1e1r5_7",D3="_envDotGreen_1e1r5_14",R3="_envDotYellow_1e1r5_18",M3="_envDotRed_1e1r5_22",O3="_envDotGray_1e1r5_26",Yi={envRow:E3,envDot:A3,envDotGreen:D3,envDotYellow:R3,envDotRed:M3,envDotGray:O3};function I3(n){const s=n.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?Yi.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?Yi.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?Yi.envDotRed:Yi.envDotGray}function B3(n){const{value:s,onSave:i,environments:o,allowNone:c=!1,fieldId:u="environment",activeFieldId:d,onActivate:m,placeholder:h="No environment",ariaLabel:g="Environment","data-testid":v}=n,b=o.find(T=>T.id===s),_=[...c?[{value:"",label:"None"}]:[],...o.map(T=>({value:T.id,label:T.displayName}))],S=()=>{if(b)return l.jsxs("span",{className:Yi.envRow,children:[l.jsx("span",{className:`${Yi.envDot} ${I3(b.status)}`}),b.displayName]})};return l.jsx(jc,{value:s,onSave:i,options:_,fieldId:u,activeFieldId:d,onActivate:m,renderDisplay:S,placeholder:h,ariaLabel:g,"data-testid":v})}const L3="_nav_1snmp_1",U3="_searchForm_1snmp_8",z3="_searchInput_1snmp_15",P3="_searchButton_1snmp_33",V3="_clearButton_1snmp_68",H3="_workspaceSelect_1snmp_85",q3="_listHeader_1snmp_99",G3="_nodeList_1snmp_108",$3="_nodeItem_1snmp_116",F3="_indicator_1snmp_129",Z3="_label_1snmp_136",K3="_badge_1snmp_145",In={nav:L3,searchForm:U3,searchInput:z3,searchButton:P3,clearButton:V3,workspaceSelect:H3,listHeader:q3,nodeList:G3,nodeItem:$3,indicator:F3,label:Z3,badge:K3};function Y3({nodes:n,workspaces:s,loading:i,searchQuery:o,onSearch:c,onClearSearch:u,onSelectNode:d,onWorkspaceChange:m}){const[h,g]=y.useState(""),v=y.useCallback(T=>{T.preventDefault(),h.trim()&&c(h.trim())},[h,c]),b=y.useCallback(()=>{g(""),u()},[u]),_=y.useCallback(T=>{d(T)},[d]),S=y.useCallback(T=>{g(""),m(T)},[m]);return l.jsxs("div",{className:In.nav,"data-testid":"knowledge-nav",children:[l.jsxs("form",{className:In.searchForm,onSubmit:v,children:[l.jsx("input",{className:In.searchInput,type:"text",placeholder:"Search...",value:h,onChange:T=>{g(T.target.value)},"data-testid":"knowledge-search-input"}),l.jsx("button",{type:"submit",className:In.searchButton,disabled:i,children:"Go"})]}),o&&l.jsx("button",{type:"button",className:In.clearButton,onClick:b,children:"Clear search"}),l.jsxs("select",{className:In.workspaceSelect,onChange:T=>{S(T.target.value)},"data-testid":"knowledge-workspace-filter",children:[l.jsx("option",{value:"",children:"All workspaces"}),s.map(T=>l.jsx("option",{value:T.id,children:T.name},T.id))]}),l.jsxs("div",{className:In.listHeader,children:["Nodes (",n.length,")"]}),l.jsx("ul",{className:In.nodeList,children:n.map(T=>l.jsxs("li",{className:In.nodeItem,onClick:()=>{_(T.id)},onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),_(T.id))},role:"button",tabIndex:0,children:[l.jsx("span",{className:In.indicator,style:{backgroundColor:T.kind==="reference"?"#4A9EFF":T.category==="decision"?"#22C55E":T.category==="concept"?"#A855F7":T.category==="snippet"?"#6B7280":"#EAB308"}}),l.jsx("span",{className:In.label,children:T.label}),l.jsx("span",{className:In.badge,children:T.kind==="reference"?T.sourceType:T.category})]},T.id))})]})}const J3="_container_1mq5u_1",W3="_hamburger_1mq5u_33",X3="_brand_1mq5u_49",Q3="_brandLogo_1mq5u_68",e6="_info_1mq5u_75",t6="_connectionLabel_1mq5u_90",n6="_connectionDot_1mq5u_103",s6="_connected_1mq5u_106",a6="_disconnected_1mq5u_110",Cs={container:J3,hamburger:W3,brand:X3,brandLogo:Q3,info:e6,connectionLabel:t6,connectionDot:n6,connected:s6,disconnected:a6};function i6({connected:n,environments:s,sessions:i,onToggleSidebar:o,sidebarOpen:c}){const u=St(),d=s.length,m=s.filter(g=>g.status==="connected").length,h=i.filter(g=>["running","idle"].includes(g.status)).length;return l.jsxs("div",{className:Cs.container,children:[o&&l.jsx("button",{type:"button",className:Cs.hamburger,onClick:o,"aria-label":"Toggle sidebar","aria-expanded":c,children:"☰"}),l.jsxs("button",{type:"button",className:Cs.brand,onClick:()=>u(Ya),title:"Home",children:[l.jsx("img",{src:"/icon-192x192.png",alt:"",className:Cs.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]}),l.jsxs("div",{className:Cs.info,children:[l.jsxs("span",{"aria-label":n?"Connected":"Disconnected",children:[l.jsx("span",{className:`${Cs.connectionDot} ${n?Cs.connected:Cs.disconnected}`,"aria-hidden":"true",children:"●"})," ",l.jsx("span",{className:Cs.connectionLabel,"aria-hidden":"true",children:n?"Connected":"Disconnected"})]}),l.jsxs("span",{children:[m,"/",d," env",d!==1?"s":""]}),l.jsxs("span",{children:[h," active"]})]})]})}const o6="_nav_13gkc_1",r6="_tab_13gkc_35",l6="_tabIcon_13gkc_68",c6="_tabLabel_13gkc_79",u6="_tabActive_13gkc_84",or={nav:o6,tab:r6,tabIcon:l6,tabLabel:c6,tabActive:u6},Ha=[{view:"dashboard",label:"Dashboard",icon:"🏠",route:Ya,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:"💬",route:F2,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:"📋",route:Z2,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:"🖥️",route:Xi,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:"🧠",route:Db,testId:"sidebar-tab-knowledge"},{view:"settings",label:"Settings",icon:"⚙️",route:H2,testId:"sidebar-tab-settings"}];function d6(n){return n===Ya||n==="/"?"dashboard":n.startsWith("/chat")||n.startsWith("/sessions")?"chat":n.startsWith("/workspaces")||n.startsWith("/environments")?"environments":n.startsWith(Db)?"knowledge":n.startsWith(Ji)?"settings":"tasks"}function f6(){const n=Lt(),s=St(),i=y.useRef(null),o=d6(n.pathname),c=y.useCallback(d=>{s(d.route)},[s]),u=y.useCallback(d=>{var b,_;const m=(b=i.current)==null?void 0:b.querySelectorAll('[role="tab"]');if(!m)return;const h=Array.from(m).findIndex(S=>S===document.activeElement),g=h>=0?h:Ha.findIndex(S=>S.view===o);let v=g;if(d.key==="ArrowRight"||d.key==="j"||d.key==="J")d.preventDefault(),v=(g+1)%Ha.length;else if(d.key==="ArrowLeft"||d.key==="k"||d.key==="K")d.preventDefault(),v=(g-1+Ha.length)%Ha.length;else if(d.key==="Home")d.preventDefault(),v=0;else if(d.key==="End")d.preventDefault(),v=Ha.length-1;else return;s(Ha[v].route),(_=m[v])==null||_.focus()},[o,s]);return l.jsx("nav",{className:or.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:u,"data-testid":"sidebar-nav",children:Ha.map(d=>{const m=d.view===o;return l.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${or.tab} ${m?or.tabActive:""}`,onClick:()=>c(d),"data-testid":d.testId,title:d.label,"aria-label":d.label,children:[l.jsx("span",{className:or.tabIcon,"aria-hidden":"true",children:d.icon}),l.jsx("span",{className:or.tabLabel,children:d.label})]},d.view)})})}const p6="_container_pi6ii_1",m6="_content_pi6ii_66",zy={container:p6,content:m6},h6=320,px=220,mx=600,hx="grackle-sidebar-width";function g6(){try{const n=localStorage.getItem(hx);if(n!==null){const s=Number(n);if(Number.isFinite(s)&&s>=px&&s<=mx)return s}}catch{}return h6}function v6(n){try{localStorage.setItem(hx,String(n))}catch{}}function y6({content:n}){const[s]=y.useState(g6),i=y.useRef(null);if(y.useEffect(()=>{const o=i.current;if(!o)return;const c=new ResizeObserver(u=>{for(const d of u){const m=d.borderBoxSize[0];if(m){const h=Math.round(m.inlineSize);h>=px&&h<=mx&&v6(h)}}});return c.observe(o),()=>{c.disconnect()}},[]),n!==void 0)return l.jsx("div",{className:zy.container,ref:i,"data-testid":"sidebar",style:{width:s},children:l.jsx("div",{className:zy.content,children:n})})}const b6="_bar_tnfsh_1",_6="_btnPrimary_tnfsh_32",x6="_statusText_tnfsh_85",S6="_statusCompleted_tnfsh_90",T6="_statusFailed_tnfsh_94",k6="_statusBlocked_tnfsh_98",w6="_hintText_tnfsh_103",ht={bar:b6,btnPrimary:_6,statusText:x6,statusCompleted:S6,statusFailed:T6,statusBlocked:k6,hintText:w6};function N6({sessions:n,tasks:s,environments:i}){const o=St(),c=Lt(),u=Mt("/sessions/:sessionId"),d=Mt("/tasks/:taskId"),m=Mt("/tasks/:taskId/stream"),h=Mt("/tasks/:taskId/findings"),g=Mt("/tasks/:taskId/edit"),v=Mt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=Mt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),_=Mt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),S=Mt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),T=Mt("/sessions/new"),N=Mt("/environments/:environmentId/workspaces/:workspaceId"),j=Mt("/tasks/new"),w=Mt("/chat"),C=Mt("/"),A=Mt("/settings/*"),M=u==null?void 0:u.params.sessionId,D=(d==null?void 0:d.params.taskId)??(m==null?void 0:m.params.taskId)??(h==null?void 0:h.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),E=v??b??_??S,H=(E==null?void 0:E.params.environmentId)??(N==null?void 0:N.params.environmentId),z=c.pathname.startsWith("/environments")&&!N&&!E,Z=!!w,F=!!T,Q=!!N&&!v&&!b&&!_&&!S,ae=!!j;if(!!C&&!F&&!Q&&!ae||!!A||(!!g||!!S)||ae||z||F)return l.jsx(l.Fragment,{});if(Z)return i.find($=>$.adapterType==="local"&&$.status==="connected")?l.jsx(l.Fragment,{}):l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Add a local environment to start chatting"})});if(Q)return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Select a task or click + to create one"})});if(D){const B=s.find(re=>re.id===D);if(!B)return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Loading..."})});const $=new Map(s.map(re=>[re.id,re])),te=B.dependsOn.some(re=>{const de=$.get(re);return de!==void 0&&de.status!=="complete"});if(B.status==="not_started"){const re=te?B.dependsOn.map(de=>$.get(de)).filter(de=>de&&de.status!=="complete").map(de=>de.title):[];return l.jsx("div",{className:ht.bar,children:te?l.jsxs("span",{className:ht.statusBlocked,children:["Blocked by: ",re.join(", ")]}):l.jsx("span",{className:ht.hintText,children:"Use the buttons above to start or manage this task"})})}if(B.status==="working"||B.status==="paused"){const re=B.latestSessionId||void 0,de=re?n.find(we=>we.id===re):void 0;return de&&de.status!=="stopped"?l.jsx(l.Fragment,{}):l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Waiting for agent..."})})}if(B.status==="complete")return l.jsxs("div",{className:ht.bar,children:[l.jsx("span",{className:`${ht.statusText} ${ht.statusCompleted}`,children:"Task completed"}),l.jsx("button",{onClick:()=>o(ei(B.workspaceId,void 0,H)),className:ht.btnPrimary,children:"+ New Task"})]});if(B.status==="failed")return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:`${ht.statusText} ${ht.statusFailed}`,children:"Task failed"})})}if(M){const B=n.find(re=>re.id===M),$=(B==null?void 0:B.status)==="stopped";if(B!==void 0&&!$)return l.jsx(l.Fragment,{});if($)return l.jsxs("div",{className:ht.bar,children:[l.jsxs("span",{className:`${ht.statusText} ${ht.hintText}`,children:["Session ",B.endReason||B.status]}),l.jsx("button",{onClick:()=>o(Cb(B.environmentId)),className:ht.btnPrimary,children:"+ New Chat"})]})}return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Loading..."})})}const j6="_nav_14i94_1",C6="_tab_14i94_24",E6="_tabActive_14i94_62",A6="_tabLabel_14i94_75",D6="_statusDot_14i94_81",R6="_pulse_14i94_87",M6="_addButton_14i94_99",O6="_empty_14i94_132",ca={nav:j6,tab:C6,tabActive:E6,tabLabel:A6,statusDot:D6,pulse:R6,addButton:M6,empty:O6},I6={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function B6({environments:n}){const s=St(),i=y.useRef(null),o=Mt("/environments/:environmentId"),c=Mt("/environments/:environmentId/edit"),u=Mt("/environments/:environmentId/workspaces/:workspaceId"),d=Mt("/environments/:environmentId/workspaces/:workspaceId/*"),m=(o==null?void 0:o.params.environmentId)??(c==null?void 0:c.params.environmentId)??(u==null?void 0:u.params.environmentId)??(d==null?void 0:d.params.environmentId),h=m==="new"?void 0:m,g=y.useCallback(_=>{s(Qi(_))},[s]),v=y.useCallback(_=>{var w;const S=(w=i.current)==null?void 0:w.querySelectorAll('[role="tab"]');if(!S||S.length===0)return;const T=Array.from(S).findIndex(C=>C===document.activeElement),N=T>=0?T:n.findIndex(C=>C.id===h);let j=N;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),j=(N+1)%S.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),j=(N-1+S.length)%S.length;else if(_.key==="Home")_.preventDefault(),j=0;else if(_.key==="End")_.preventDefault(),j=S.length-1;else return;j<n.length&&s(Qi(n[j].id)),S[j].focus()},[h,n,s]),b=h??(n.length>0?n[0].id:void 0);return l.jsxs("div",{className:ca.nav,"data-testid":"environment-nav",children:[l.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:n.map(_=>{const S=_.id===h,T=_.id===b,N=I6[_.status]||"var(--text-tertiary)",j=_.status==="connected";return l.jsxs("button",{role:"tab",type:"button","aria-selected":S,tabIndex:T?0:-1,className:`${ca.tab} ${S?ca.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[l.jsx("span",{className:`${ca.statusDot} ${j?ca.pulse:""}`,style:{color:N},children:"●"}),l.jsx("span",{className:ca.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),l.jsx("button",{type:"button",className:ca.addButton,onClick:()=>s(P2),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),n.length===0&&l.jsx("div",{className:ca.empty,children:"No environments yet."})]})}function L6(n){if(n.length===0)return[];const s=[...n].sort((o,c)=>o[0]-c[0]),i=[[s[0][0],s[0][1]]];for(let o=1;o<s.length;o++){const c=i[i.length-1],[u,d]=s[o];u<=c[1]+1?c[1]=Math.max(c[1],d):i.push([u,d])}return i}function gx({text:n,indices:s,highlightClass:i}){if(!s||s.length===0)return l.jsx(l.Fragment,{children:n});const o=L6(s),c=[];let u=0;for(const[d,m]of o)d>u&&c.push(l.jsx("span",{children:n.slice(u,d)},`p${u}`)),c.push(l.jsx("mark",{className:i,children:n.slice(d,m+1)},`m${d}`)),u=m+1;return u<n.length&&c.push(l.jsx("span",{children:n.slice(u)},`p${u}`)),l.jsx(l.Fragment,{children:c})}function U6(n){const s=new Map(n.map(o=>[o.id,{...o,children:[]}])),i=[];for(const o of s.values())o.parentTaskId&&s.has(o.parentTaskId)?s.get(o.parentTaskId).children.push(o):i.push(o);for(const o of s.values())o.children.sort((c,u)=>c.sortOrder-u.sortOrder);return i.sort((o,c)=>o.sortOrder-c.sortOrder)}function z6(n,s){const i=new Map;for(const u of n){const m=u.dependsOn.length>0&&u.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":u.status,h=i.get(m);h?h.push(u):i.set(m,[u])}const o=[],c=new Set;for(const u of GT){c.add(u);const d=i.get(u);if(d&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const m=ma(u);o.push({status:u,label:m.label,style:m,tasks:d})}}for(const[u,d]of i)if(!c.has(u)&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const m=ma(u);o.push({status:u,label:m.label,style:m,tasks:d})}return o}const P6="_container_z4i38_1",V6="_header_z4i38_5",H6="_headerActions_z4i38_17",q6="_searchInput_z4i38_23",G6="_searchHighlight_z4i38_56",$6="_groupToggle_z4i38_62",F6="_groupToggleActive_z4i38_89",Z6="_addButton_z4i38_93",K6="_taskRow_z4i38_120",Y6="_selected_z4i38_140",J6="_expandArrow_z4i38_150",W6="_expanded_z4i38_157",X6="_leafSpacer_z4i38_161",Q6="_taskStatusIcon_z4i38_166",eO="_taskTitle_z4i38_170",tO="_workspaceBadge_z4i38_177",nO="_childCountBadge_z4i38_195",sO="_dependencyBadge_z4i38_208",aO="_blockedBadge_z4i38_220",iO="_addChildButton_z4i38_225",oO="_emptyState_z4i38_268",rO="_statusGroupHeader_z4i38_275",lO="_statusGroupIcon_z4i38_294",cO="_statusGroupLabel_z4i38_298",uO="_statusGroupCount_z4i38_303",Ge={container:P6,header:V6,headerActions:H6,searchInput:q6,searchHighlight:G6,groupToggle:$6,groupToggleActive:F6,addButton:Z6,taskRow:K6,selected:Y6,expandArrow:J6,expanded:W6,leafSpacer:X6,taskStatusIcon:Q6,taskTitle:eO,workspaceBadge:tO,childCountBadge:nO,dependencyBadge:sO,blockedBadge:aO,addChildButton:iO,emptyState:oO,statusGroupHeader:rO,statusGroupIcon:lO,statusGroupLabel:cO,statusGroupCount:uO},dO=[{name:"title",weight:2},{name:"description",weight:1}],vx=16,fO=16,yx="grackle-task-group-by-status";function Py(){try{return localStorage.getItem(yx)==="true"}catch{return!1}}function pO(n){try{localStorage.setItem(yx,String(n))}catch{}}function mO({group:n,isExpanded:s,onToggle:i,selectedTaskId:o,navigate:c,titleHighlights:u,workspaceNames:d}){return l.jsxs("div",{"data-testid":`status-group-${n.status}`,children:[l.jsxs("div",{className:Ge.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:i,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),i())},children:[l.jsx("span",{className:`${Ge.expandArrow} ${s?Ge.expanded:""}`,children:"▸"}),l.jsx("span",{className:Ge.statusGroupIcon,style:{color:n.style.color},children:n.style.icon}),l.jsx("span",{className:Ge.statusGroupLabel,children:n.label}),l.jsx("span",{className:Ge.statusGroupCount,children:n.tasks.length})]}),l.jsx(rs,{children:s&&l.jsx(Ot.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:n.tasks.map(m=>{const h=ma(m.status),g=o===m.id,v=m.parentTaskId||!m.workspaceId?void 0:d.get(m.workspaceId);return l.jsxs("div",{onClick:()=>c(os(m.id)),className:`${Ge.taskRow} ${g?Ge.selected:""}`,style:{"--task-indent":`${vx}px`},"data-task-id":m.id,children:[l.jsx("span",{className:Ge.leafSpacer}),l.jsx("span",{className:Ge.taskStatusIcon,style:{color:h.color},children:h.icon}),l.jsx("span",{className:Ge.taskTitle,title:m.title,children:l.jsx(gx,{text:m.title,indices:u.get(m.id),highlightClass:Ge.searchHighlight})}),v&&l.jsx("span",{className:Ge.workspaceBadge,title:v,children:v})]},m.id)})})})]})}function bx({node:n,depth:s,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:m,workspaceNames:h}){const g=ma(n.status),v=n.dependsOn.length>0&&n.dependsOn.some(w=>d.get(w)!=="complete"),b=i.has(n.id),_=n.children.length>0,S=c===n.id,T=vx+s*fO,j=s===0&&!n.parentTaskId&&n.workspaceId?h.get(n.workspaceId):void 0;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{onClick:()=>u(os(n.id)),className:`${Ge.taskRow} ${S?Ge.selected:""}`,style:{"--task-indent":`${T}px`},"data-task-id":n.id,children:[_&&l.jsx("span",{className:`${Ge.expandArrow} ${b?Ge.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:w=>{w.stopPropagation(),o(n.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),w.stopPropagation(),o(n.id))},children:"▸"}),!_&&l.jsx("span",{className:Ge.leafSpacer}),l.jsx("span",{className:Ge.taskStatusIcon,style:{color:g.color},children:g.icon}),l.jsx("span",{className:Ge.taskTitle,title:n.title,children:l.jsx(gx,{text:n.title,indices:m.get(n.id),highlightClass:Ge.searchHighlight})}),j&&l.jsx("span",{className:Ge.workspaceBadge,title:j,children:j}),_&&l.jsxs("span",{className:Ge.childCountBadge,children:[n.children.filter(w=>w.status==="complete").length,"/",n.children.length]}),n.dependsOn.length>0&&l.jsx("span",{className:`${Ge.dependencyBadge} ${v?Ge.blockedBadge:""}`,title:`Depends on: ${n.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<oT&&l.jsx("button",{onClick:w=>{w.stopPropagation(),u(ei(n.workspaceId,n.id))},title:"Add child task","aria-label":"Add child task",className:Ge.addChildButton,children:"+"})]}),l.jsx(rs,{children:_&&b&&l.jsx(Ot.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:n.children.map(w=>l.jsx(bx,{node:w,depth:s+1,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:m,workspaceNames:h},w.id))})})]})}function hO({workspaces:n,tasks:s}){const i=St(),[o,c]=y.useState(new Set),[u,d]=y.useState(new Set),[m,h]=y.useState(Py),[g,v]=y.useState(Py),[b,_]=y.useState(new Map),S=Mt("/tasks/:taskId/*"),T=(S==null?void 0:S.params.taskId)!=="new"?S==null?void 0:S.params.taskId:void 0,N=y.useMemo(()=>new Map(s.map(oe=>[oe.id,oe.status])),[s]),j=y.useMemo(()=>new Map(n.map(oe=>[oe.id,oe.name])),[n]),w=()=>{const oe=!m;pO(oe),h(oe),oe&&(v(!0),_(new Map))},C=oe=>{_(X=>{const B=new Map(X),$=B.has(oe)?B.get(oe):g;return B.set(oe,!$),B})},A=oe=>b.has(oe)?b.get(oe):g,M=oe=>{c(X=>{const B=new Set(X);return B.has(oe)?(B.delete(oe),d($=>new Set($).add(oe))):(B.add(oe),d($=>{const te=new Set($);return te.delete(oe),te})),B})};y.useEffect(()=>{const oe=new Set(s.filter(X=>X.parentTaskId).map(X=>X.parentTaskId));oe.size>0&&c(X=>{const B=new Set(X);for(const $ of oe)u.has($)||B.add($);return B})},[s,u]);const[D,E]=y.useState(""),{directMatchTaskIds:H,treeMatchTaskIds:z,titleHighlights:Z}=y.useMemo(()=>{if(!D.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const oe=iT(s,D,dO),X=new Set(oe.map(re=>re.item.id)),B=new Map;for(const re of oe){const de=re.matches.find($e=>$e.key==="title");de&&B.set(re.item.id,de.indices)}const $=new Set(X),te=new Map(s.map(re=>[re.id,re]));for(const re of[...X]){let de=te.get(re);for(;de!=null&&de.parentTaskId;)$.add(de.parentTaskId),de=te.get(de.parentTaskId)}return{directMatchTaskIds:X,treeMatchTaskIds:$,titleHighlights:B}},[D,s]),F=H!==null,Q=F?m?H:z:null,ae=Q?s.filter(oe=>Q.has(oe.id)):s,pe=m?[]:U6(ae);return l.jsxs("div",{className:Ge.container,children:[l.jsxs("div",{className:Ge.header,children:[l.jsx("span",{children:"Tasks"}),l.jsxs("div",{className:Ge.headerActions,children:[l.jsx("button",{className:`${Ge.groupToggle} ${m?Ge.groupToggleActive:""}`,onClick:w,"aria-label":m?"Switch to tree view":"Group tasks by status","aria-pressed":m,title:m?"Switch to tree view":"Group tasks by status","data-testid":"task-group-by-status-toggle",children:"≡"}),l.jsx("button",{className:Ge.addButton,onClick:()=>i(ei()),"aria-label":"New task",title:"New task","data-testid":"new-task-button",children:"+"})]})]}),s.length>0&&l.jsx("input",{type:"text",value:D,onChange:oe=>E(oe.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Ge.searchInput,"data-testid":"sidebar-search"}),m?z6(ae,N).map(oe=>l.jsx(mO,{group:oe,isExpanded:A(oe.status),onToggle:()=>C(oe.status),selectedTaskId:T,navigate:i,titleHighlights:Z,workspaceNames:j},oe.status)):pe.map(oe=>l.jsx(bx,{node:oe,depth:0,expandedTasks:o,toggleTask:M,selectedTaskId:T,navigate:i,taskStatusById:N,titleHighlights:Z,workspaceNames:j},oe.id)),ae.length===0&&!F&&l.jsx("div",{className:Ge.emptyState,children:"No tasks yet. Click + to create one."}),ae.length===0&&F&&l.jsx("div",{className:Ge.emptyState,children:"No matching tasks"})]})}const gO="_toast_da8ll_1",vO="_success_da8ll_18",yO="_icon_da8ll_22",bO="_error_da8ll_25",_O="_warning_da8ll_32",xO="_info_da8ll_38",SO="_message_da8ll_53",TO="_close_da8ll_60",rr={toast:gO,success:vO,icon:yO,error:bO,warning:_O,info:xO,message:SO,close:TO},kO={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function wO({toast:n,onDismiss:s}){return y.useEffect(()=>{const i=setTimeout(()=>s(n.id),n.duration);return()=>clearTimeout(i)},[n.id,n.duration,s]),l.jsxs(Ot.div,{className:`${rr.toast} ${rr[n.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:[l.jsx("span",{className:rr.icon,"aria-hidden":"true",children:kO[n.variant]}),l.jsx("span",{className:rr.message,children:n.message}),l.jsx("button",{type:"button",className:rr.close,onClick:()=>s(n.id),"aria-label":"Dismiss notification",children:"×"})]})}const NO="_container_qqse2_1",jO={container:NO};function CO({toasts:n,onDismiss:s}){return l.jsx("div",{className:jO.container,"data-testid":"toast-container",children:l.jsx(rs,{children:n.map(i=>l.jsx(wO,{toast:i,onDismiss:s},i.id))})})}const EO="_callout_1jaue_1",AO="_success_1jaue_11",DO="_icon_1jaue_15",RO="_error_1jaue_18",MO="_warning_1jaue_25",OO="_info_1jaue_32",IO="_content_1jaue_48",BO="_close_1jaue_53",lr={callout:EO,success:AO,icon:DO,error:RO,warning:MO,info:OO,content:IO,close:BO},LO={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function UO({variant:n="info",children:s,dismissible:i=!1,className:o}){const[c,u]=y.useState(!1);return l.jsx(l.Fragment,{children:!c&&l.jsxs("div",{className:[lr.callout,lr[n],o].filter(Boolean).join(" "),role:n==="error"||n==="warning"?"alert":"status",children:[l.jsx("span",{className:lr.icon,"aria-hidden":"true",children:LO[n]}),l.jsx("span",{className:lr.content,children:s}),i&&l.jsx("button",{type:"button",className:lr.close,onClick:()=>u(!0),"aria-label":"Dismiss",children:"×"})]})})}function zO({currentVersion:n,latestVersion:s,updateAvailable:i,isDocker:o}){if(!i)return l.jsx(l.Fragment,{});const c=o?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return l.jsx("div",{"data-testid":"update-banner",children:l.jsxs(UO,{variant:"info",dismissible:!0,children:[l.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",n,")."," ","Run: ",l.jsx("code",{children:c})]})})}const PO="_container_1pqxm_1",VO="_emptyState_1pqxm_8",HO="_card_1pqxm_14",qO="_cardHeader_1pqxm_34",GO="_categoryBadge_1pqxm_46",$O="_findingTitle_1pqxm_54",FO="_findingDate_1pqxm_60",ZO="_findingContent_1pqxm_72",KO="_tags_1pqxm_78",YO="_tag_1pqxm_78",ts={container:PO,emptyState:VO,card:HO,cardHeader:qO,categoryBadge:GO,findingTitle:$O,findingDate:FO,findingContent:ZO,tags:KO,tag:YO};function JO(n){const s=new Date(n),i=new Date,o=i.getTime()-s.getTime(),c=Math.floor(o/1e3),u=Math.floor(c/60),d=Math.floor(u/60),m=Math.floor(d/24);if(c<60)return"just now";if(u<60)return`${u}m ago`;if(d<24)return`${d}h ago`;if(m===1)return"yesterday";if(m<7)return`${m} days ago`;const h=s.getFullYear()===i.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return h?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Vy={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 WO({findings:n}){return n.length===0?l.jsx("div",{className:ts.emptyState,children:"No findings yet. Agents will post discoveries here."}):l.jsx("div",{className:ts.container,children:n.map((s,i)=>{const o=Vy[s.category]||Vy.general;return l.jsxs(Ot.div,{className:ts.card,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:i*.05,duration:.2},children:[l.jsxs("div",{className:ts.cardHeader,children:[l.jsx("span",{className:ts.categoryBadge,style:{background:o.bg,color:o.text},children:s.category}),l.jsx("span",{className:ts.findingTitle,children:s.title}),l.jsx("span",{className:ts.findingDate,title:s.createdAt,children:JO(s.createdAt)})]}),l.jsx("div",{className:ts.findingContent,children:s.content.length>300?s.content.slice(0,300)+"...":s.content}),s.tags.length>0&&l.jsx("div",{className:ts.tags,children:s.tags.map(c=>l.jsx("span",{className:ts.tag,style:{color:o.text,textShadow:`0 0 8px ${o.text}`},children:c},c))})]},s.id)})})}const XO="_section_1ingb_14",QO="_sectionTitle_1ingb_26",eI="_sectionDescription_1ingb_35",tI="_tokenList_1ingb_48",nI="_tokenRow_1ingb_55",sI="_tokenBadge_1ingb_68",aI="_tokenName_1ingb_83",iI="_tokenTarget_1ingb_90",oI="_deleteButton_1ingb_99",rI="_addForm_1ingb_113",lI="_formRow_1ingb_119",cI="_input_1ingb_125",uI="_select_1ingb_155",dI="_addButton_1ingb_187",fI="_emptyStateInfo_1ingb_221",pI="_themeOptions_1ingb_229",mI="_themeOption_1ingb_229",hI="_themeOptionSelected_1ingb_254",gI="_themeOptionHeader_1ingb_259",vI="_themeOptionLabel_1ingb_266",yI="_themeOptionDesc_1ingb_273",bI="_variantToggle_1ingb_279",_I="_variantButton_1ingb_286",xI="_variantActive_1ingb_305",SI="_themeSwatches_1ingb_311",TI="_themeSwatch_1ingb_311",kI="_systemToggle_1ingb_325",wI="_systemToggleHint_1ingb_341",NI="_themeActive_1ingb_348",jI="_aboutGrid_1ingb_354",CI="_aboutItem_1ingb_360",EI="_aboutLabel_1ingb_373",AI="_aboutValue_1ingb_379",DI="_aboutDot_1ingb_387",RI="_aboutDotConnected_1ingb_394",MI="_aboutDotDisconnected_1ingb_398",he={section:XO,sectionTitle:QO,sectionDescription:eI,tokenList:tI,tokenRow:nI,tokenBadge:sI,tokenName:aI,tokenTarget:iI,deleteButton:oI,addForm:rI,formRow:lI,input:cI,select:uI,addButton:dI,emptyStateInfo:fI,themeOptions:pI,themeOption:mI,themeOptionSelected:hI,themeOptionHeader:gI,themeOptionLabel:vI,themeOptionDesc:yI,variantToggle:bI,variantButton:_I,variantActive:xI,themeSwatches:SI,themeSwatch:TI,systemToggle:kI,systemToggleHint:wI,themeActive:NI,aboutGrid:jI,aboutItem:CI,aboutLabel:EI,aboutValue:AI,aboutDot:DI,aboutDotConnected:RI,aboutDotDisconnected:MI},OI=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function II({tokens:n,onSetToken:s,onDeleteToken:i,onShowToast:o}){const[c,u]=y.useState(""),[d,m]=y.useState(""),[h,g]=y.useState("env_var"),[v,b]=y.useState(""),[_,S]=y.useState(null),T=w=>{if(w.preventDefault(),!c||!d)return;const C=h==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,d,h,C,h==="file"?v:""),o==null||o("Token saved successfully","success"),u(""),m(""),b("")},N=w=>{S(w)},j=()=>{_&&(i(_),o==null||o("Token deleted","info")),S(null)};return l.jsxs(l.Fragment,{children:[l.jsx(Ja,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:j,onCancel:()=>S(null)}),l.jsxs("section",{className:he.section,children:[l.jsx("h3",{className:he.sectionTitle,children:"Tokens"}),l.jsx("p",{className:he.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),n.length===0?l.jsx("div",{className:he.emptyStateInfo,children:"Add your first API token to enable service integrations."}):l.jsx("div",{className:he.tokenList,children:n.map(w=>l.jsxs("div",{className:he.tokenRow,children:[l.jsx("span",{className:he.tokenBadge,children:w.tokenType}),l.jsx("span",{className:he.tokenName,children:w.name}),l.jsx("span",{className:he.tokenTarget,children:w.tokenType==="env_var"?w.envVar:w.filePath}),l.jsx("button",{className:he.deleteButton,onClick:()=>N(w.name),title:`Delete ${w.name}`,children:"×"})]},w.name))}),l.jsxs("form",{className:he.addForm,onSubmit:T,children:[l.jsxs("div",{className:he.formRow,children:[l.jsx("input",{className:he.input,type:"text",placeholder:"Token name",value:c,onChange:w=>u(w.target.value)}),l.jsx("input",{className:he.input,type:"password",placeholder:"Value",value:d,onChange:w=>m(w.target.value)})]}),l.jsxs("div",{className:he.formRow,children:[l.jsx("select",{className:he.select,value:h,onChange:w=>g(w.target.value),children:OI.map(w=>l.jsx("option",{value:w.value,children:w.label},w.value))}),l.jsx("input",{className:he.input,type:"text",placeholder:h==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:w=>b(w.target.value)}),l.jsx("button",{className:he.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const Pc=[{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"]}],_x=new Set(Pc.map(n=>n.id)),Hy="grackle";function ip(n){return Pc.find(s=>s.id===n)}function BI({themeId:n,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c}){return l.jsxs("section",{className:he.section,children:[l.jsx("h3",{className:he.sectionTitle,children:"Appearance"}),l.jsx("p",{className:he.sectionDescription,children:"Choose how Grackle looks across the app."}),l.jsx("div",{className:he.themeOptions,children:Pc.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),m=d?n===u.id||n===u.variantLightId||n===u.variantDarkId:n===u.id,h=d&&s===u.variantLightId;return l.jsxs("button",{type:"button",className:`${he.themeOption} ${m?he.themeOptionSelected:""}`,"aria-pressed":m,onClick:()=>i(u.id),children:[l.jsxs("span",{className:he.themeOptionHeader,children:[l.jsxs("span",{children:[l.jsx("span",{className:he.themeOptionLabel,children:u.label}),l.jsx("span",{className:he.themeOptionDesc,children:u.description})]}),d&&l.jsxs("span",{className:he.variantToggle,children:[l.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&h?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantLightId))},"aria-label":"Light variant","aria-pressed":m&&h,children:"☼"}),l.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&!h?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantDarkId))},"aria-label":"Dark variant","aria-pressed":m&&!h,children:"☾"})]})]}),u.swatches&&l.jsx("span",{className:he.themeSwatches,children:u.swatches.map((g,v)=>l.jsx("span",{className:he.themeSwatch,style:{background:g}},v))})]},u.id)})}),l.jsxs("label",{className:he.systemToggle,children:[l.jsx("input",{type:"checkbox",checked:o,onChange:u=>c(u.target.checked)}),l.jsx("span",{children:"Match system light/dark preference"})]}),l.jsx("p",{className:he.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),l.jsxs("p",{className:he.themeActive,children:["Active theme: ",l.jsx("strong",{children:s})]})]})}function LI({connected:n,environments:s,sessions:i}){const o=s.filter(d=>d.status==="connected").length,c=s.length,u=i.filter(d=>["running","idle"].includes(d.status)).length;return l.jsxs("section",{className:he.section,"data-testid":"about-panel",children:[l.jsx("h3",{className:he.sectionTitle,children:"About"}),l.jsx("p",{className:he.sectionDescription,children:"Connection status and application information."}),l.jsxs("div",{className:he.aboutGrid,children:[l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Connection"}),l.jsxs("span",{className:he.aboutValue,children:[l.jsx("span",{className:`${he.aboutDot} ${n?he.aboutDotConnected:he.aboutDotDisconnected}`}),n?"Connected":"Disconnected"]})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Environments"}),l.jsxs("span",{className:he.aboutValue,children:[o,"/",c," connected"]})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Active Sessions"}),l.jsx("span",{className:he.aboutValue,children:u})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Version"}),l.jsx("span",{className:he.aboutValue,children:"0.85.2"})]})]})]})}const UI="_container_cddyd_1",zI="_header_cddyd_8",PI="_headerTitle_cddyd_35",VI="_badge_cddyd_44",HI="_headerActions_cddyd_54",qI="_body_cddyd_61",GI="_formContent_cddyd_73",$I="_section_cddyd_85",FI="_label_cddyd_91",ZI="_titleInput_cddyd_98",KI="_descriptionTextarea_cddyd_131",YI="_parentContext_cddyd_167",JI="_parentLabel_cddyd_175",WI="_parentName_cddyd_182",XI="_personaSelect_cddyd_186",QI="_depList_cddyd_220",e5="_depItem_cddyd_226",t5="_depItemSelected_cddyd_248",n5="_noDeps_cddyd_252",s5="_btnPrimary_cddyd_258",a5="_btnGhost_cddyd_289",Oe={container:UI,header:zI,headerTitle:PI,badge:VI,headerActions:HI,body:qI,formContent:GI,section:$I,label:FI,titleInput:ZI,descriptionTextarea:KI,parentContext:YI,parentLabel:JI,parentName:WI,personaSelect:XI,depList:QI,depItem:e5,depItemSelected:t5,noDeps:n5,btnPrimary:s5,btnGhost:a5};function xx({mode:n,taskId:s,workspaceId:i,parentTaskId:o,environmentId:c,tasks:u,workspaces:d,personas:m,onCreateTask:h,onUpdateTask:g,onEditDone:v,onShowToast:b}){const _=St(),S=n==="edit",T=S&&s?u.find(me=>me.id===s):void 0,N=S?(T==null?void 0:T.workspaceId)??"":i??"",[j,w]=y.useState(N),C=N||j,A=d.find(me=>me.id===C),M=c??(A==null?void 0:A.environmentId),D=!S&&!i,E=S?(T==null?void 0:T.parentTaskId)??"":o??"",H=E?u.find(me=>me.id===E):void 0,[z,Z]=y.useState((T==null?void 0:T.title)??""),[F,Q]=y.useState((T==null?void 0:T.description)??""),[ae,pe]=y.useState((T==null?void 0:T.dependsOn)??[]),[oe,X]=y.useState((T==null?void 0:T.defaultPersonaId)??""),[B,$]=y.useState((T==null?void 0:T.canDecompose)??!1),[te,re]=y.useState(!1),de=y.useRef(!1);y.useEffect(()=>{S&&T&&!de.current&&(de.current=!0,Z(T.title),Q(T.description),pe(T.dependsOn),X(T.defaultPersonaId),$(T.canDecompose))},[S,T]);const $e=u.filter(me=>me.workspaceId===C&&(!S||me.id!==s)&&me.id!==E),we=z.trim().length>0&&(!S||T!==void 0)&&C.length>0,Se=me=>{pe(Ce=>Ce.includes(me)?Ce.filter(Ut=>Ut!==me):[...Ce,me])},Ie=()=>{!we||te||S&&T===void 0||(S&&s?(g(s,z.trim(),F,ae,oe),b==null||b("Task updated","success"),v?v():_(os(s,void 0,C,M),{replace:!0})):(re(!0),h(C,z.trim(),F,ae.length>0?ae:void 0,E||void 0,oe,B,()=>{b==null||b("Task created","success"),_(i?Wi(i,M):"/tasks",{replace:!0})},me=>{b==null||b(me,"error"),re(!1)})))},le=()=>{if(v){v();return}_(S&&s?os(s,void 0,C,M):i?Wi(i,M):"/tasks")},fe=S?"edit task":E?"child task":"new task";return l.jsxs("div",{className:Oe.container,children:[l.jsxs("div",{className:Oe.header,children:[l.jsxs("div",{className:Oe.headerTitle,children:[l.jsx("span",{className:Oe.badge,children:fe}),H&&l.jsxs("span",{className:Oe.parentContext,children:[l.jsx("span",{className:Oe.parentLabel,children:"Child of"}),l.jsx("span",{className:Oe.parentName,children:H.title})]})]}),l.jsxs("div",{className:Oe.headerActions,children:[l.jsx("button",{onClick:Ie,disabled:!we||te,className:Oe.btnPrimary,"data-testid":"task-edit-save",children:te?"Creating…":S?"Save Changes":"Create"}),l.jsx("button",{onClick:le,className:Oe.btnGhost,children:"Cancel"})]})]}),l.jsx("div",{className:Oe.body,children:l.jsxs("div",{className:Oe.formContent,children:[D&&l.jsxs("div",{className:Oe.section,children:[l.jsx("label",{className:Oe.label,htmlFor:"task-edit-workspace",children:"Workspace"}),l.jsxs("select",{id:"task-edit-workspace",value:j,onChange:me=>w(me.target.value),className:Oe.personaSelect,"data-testid":"task-edit-workspace",children:[l.jsx("option",{value:"",children:"Select a workspace..."}),d.map(me=>l.jsx("option",{value:me.id,children:me.name},me.id))]})]}),l.jsxs("div",{className:Oe.section,children:[l.jsx("label",{className:Oe.label,htmlFor:"task-edit-title",children:"Title"}),l.jsx("input",{id:"task-edit-title",type:"text",value:z,onChange:me=>Z(me.target.value),placeholder:"Task title...",autoFocus:!0,className:Oe.titleInput,"data-testid":"task-edit-title",onKeyDown:me=>{me.key==="Enter"&&we&&Ie()}})]}),l.jsxs("div",{className:Oe.section,children:[l.jsx("label",{className:Oe.label,htmlFor:"task-edit-description",children:"Description"}),l.jsx("textarea",{id:"task-edit-description",value:F,onChange:me=>Q(me.target.value),placeholder:"Describe the task... (markdown supported)",className:Oe.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),l.jsxs("div",{className:Oe.section,children:[l.jsx("label",{className:Oe.label,htmlFor:"task-edit-persona",children:"Default Persona"}),l.jsxs("select",{id:"task-edit-persona",value:oe,onChange:me=>X(me.target.value),className:Oe.personaSelect,"data-testid":"task-edit-persona",children:[l.jsx("option",{value:"",children:"(Inherit)"}),m.map(me=>l.jsx("option",{value:me.id,children:me.name},me.id))]})]}),!S&&l.jsx("div",{className:Oe.section,children:l.jsxs("label",{className:Oe.depItem,"data-testid":"task-edit-can-decompose",children:[l.jsx("input",{type:"checkbox",checked:B,onChange:me=>$(me.target.checked)}),"Can spawn subtasks"]})}),l.jsxs("div",{className:Oe.section,children:[l.jsx("div",{className:Oe.label,children:"Dependencies"}),$e.length===0?l.jsx("div",{className:Oe.noDeps,children:"No other tasks in this workspace"}):l.jsx("div",{className:Oe.depList,children:$e.map(me=>{const Ce=ae.includes(me.id);return l.jsxs("label",{className:`${Oe.depItem} ${Ce?Oe.depItemSelected:""}`,"data-testid":`dep-option-${me.id}`,children:[l.jsx("input",{type:"checkbox",checked:Ce,onChange:()=>Se(me.id)}),me.title,l.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",me.status,")"]})]},me.id)})})]})]})})]})}const i5="_container_legrg_1",o5="_header_legrg_8",r5="_headerTitle_legrg_35",l5="_badge_legrg_44",c5="_headerActions_legrg_54",u5="_body_legrg_61",d5="_formContent_legrg_73",f5="_section_legrg_85",p5="_label_legrg_91",m5="_nameInput_legrg_98",h5="_fieldInput_legrg_131",g5="_adapterSelect_legrg_164",v5="_readOnlyValue_legrg_198",y5="_codespaceSection_legrg_204",b5="_codespaceActions_legrg_210",_5="_creatingHint_legrg_216",x5="_errorHint_legrg_222",S5="_btnPrimary_legrg_235",T5="_btnGhost_legrg_266",ne={container:i5,header:o5,headerTitle:r5,badge:l5,headerActions:c5,body:u5,formContent:d5,section:f5,label:p5,nameInput:m5,fieldInput:h5,adapterSelect:g5,readOnlyValue:v5,codespaceSection:y5,codespaceActions:b5,creatingHint:_5,errorHint:x5,btnPrimary:S5,btnGhost:T5},hc=1,gc=65535;function jf(n){if(!n.trim())return!0;const s=Number(n);return Number.isInteger(s)&&s>=hc&&s<=gc}function Cf(n){try{const s=JSON.parse(n);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function k5({codespaceName:n,onCodespaceNameChange:s,envName:i,onEnvNameChange:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:m,onCreateCodespace:h}){const[g,v]=y.useState("pick"),[b,_]=y.useState(""),[S,T]=y.useState("");return g==="create"?l.jsxs("div",{className:ne.codespaceSection,children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Repository"}),l.jsx("input",{type:"text",value:b,onChange:N=>_(N.target.value),placeholder:"owner/repo",className:ne.fieldInput,"data-testid":"env-codespace-repo"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Machine Type"}),l.jsx("input",{type:"text",value:S,onChange:N=>T(N.target.value),placeholder:"Machine type (optional)...",className:ne.fieldInput,"data-testid":"env-codespace-machine"})]}),l.jsxs("div",{className:ne.codespaceActions,children:[l.jsx("button",{onClick:()=>{b.trim()&&(h(b.trim(),S.trim()||void 0),v("pick"),_(""),T(""))},disabled:!b.trim(),className:ne.btnPrimary,children:"Create"}),l.jsx("button",{onClick:()=>{v("pick"),_(""),T("")},className:ne.btnGhost,children:"Cancel"})]})]}):l.jsx("div",{className:ne.codespaceSection,children:l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Codespace"}),!d&&l.jsxs("select",{value:n,onChange:N=>{N.target.value==="__create__"?(v("create"),s("")):(s(N.target.value),N.target.value&&!i.trim()&&o(N.target.value))},disabled:m,className:ne.adapterSelect,"data-testid":"env-codespace-select",children:[l.jsx("option",{value:"",children:"Select a codespace..."}),c.map(N=>l.jsxs("option",{value:N.name,children:[N.name," (",N.repository,") — ",N.state]},N.name)),l.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),m&&l.jsx("span",{className:ne.creatingHint,children:"Creating codespace..."}),d&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ne.errorHint,children:d}),l.jsx("input",{type:"text",value:n,onChange:N=>s(N.target.value),placeholder:"Or enter codespace name manually...",className:ne.fieldInput,"data-testid":"env-codespace-manual"})]}),u&&!d&&l.jsx("span",{className:ne.errorHint,children:u})]})})}function Sx({mode:n,environmentId:s,environments:i,onAddEnvironment:o,onUpdateEnvironment:c,onListCodespaces:u,codespaces:d,codespaceError:m,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v,onShowToast:b}){const _=St(),S=n==="edit",T=S&&s?i.find(le=>le.id===s):void 0,[N,j]=y.useState(""),[w,C]=y.useState("local"),[A,M]=y.useState(""),[D,E]=y.useState(""),[H,z]=y.useState(""),[Z,F]=y.useState(""),[Q,ae]=y.useState(""),[pe,oe]=y.useState(""),[X,B]=y.useState(""),[$,te]=y.useState(null),re=y.useCallback(()=>{const le={};if(w==="local"){if(A.trim()&&(le.host=A.trim()),D.trim()){const fe=Number(D);Number.isInteger(fe)&&(le.port=fe)}}else if(w==="ssh"){if(le.host=A.trim(),H.trim()&&(le.user=H.trim()),D.trim()){const fe=Number(D);Number.isInteger(fe)&&(le.sshPort=fe)}Z.trim()&&(le.identityFile=Z.trim())}else w==="docker"?(Q.trim()&&(le.image=Q.trim()),pe.trim()&&(le.repo=pe.trim())):w==="codespace"&&(le.codespaceName=X.trim());return le},[w,A,D,H,Z,Q,pe,X]),de=()=>!(!N.trim()||w==="ssh"&&!A.trim()||w==="codespace"&&!X.trim()||(w==="local"||w==="ssh")&&!jf(D)),$e=()=>{de()&&(o(N.trim(),w,re()),b==null||b("Environment added successfully","success"),_(Xi,{replace:!0}))},we=()=>{_(s?Qi(s):Xi)},Se=y.useCallback((le,fe)=>{if(!T||!s)return;const me=Cf(T.adapterConfig),Ce=fe.trim();Ce?me[le]=Ce:delete me[le],c(s,{adapterConfig:me})},[T,s,c]),Ie=y.useCallback((le,fe)=>{if(!T||!s)return;const me=Cf(T.adapterConfig);if(fe.trim()){const Ce=Number(fe);Number.isInteger(Ce)&&Ce>=hc&&Ce<=gc&&(me[le]=Ce)}else delete me[le];c(s,{adapterConfig:me})},[T,s,c]);if(S){if(!T)return l.jsxs("div",{className:ne.container,children:[l.jsxs("div",{className:ne.header,children:[l.jsx("div",{className:ne.headerTitle,children:l.jsx("span",{className:ne.badge,children:"edit environment"})}),l.jsx("div",{className:ne.headerActions,children:l.jsx("button",{onClick:we,className:ne.btnGhost,children:"Back"})})]}),l.jsx("div",{className:ne.body,children:l.jsx("div",{className:ne.formContent,children:l.jsx("span",{className:ne.readOnlyValue,children:"Environment not found"})})})]});const le=Cf(T.adapterConfig);return l.jsxs("div",{className:ne.container,"data-testid":"env-edit-panel",children:[l.jsxs("div",{className:ne.header,children:[l.jsx("div",{className:ne.headerTitle,children:l.jsx("span",{className:ne.badge,children:"edit environment"})}),l.jsx("div",{className:ne.headerActions,children:l.jsx("button",{onClick:we,className:ne.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),l.jsx("div",{className:ne.body,children:l.jsxs("div",{className:ne.formContent,children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Name"}),l.jsx(Yt,{value:T.displayName,onSave:fe=>{s&&c(s,{displayName:fe})},validate:fe=>fe.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:$,onActivate:te,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Adapter Type"}),l.jsx("span",{className:ne.readOnlyValue,"data-testid":"env-edit-adapter-type",children:T.adapterType})]}),T.adapterType==="local"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Host"}),l.jsx(Yt,{value:String(le.host??""),onSave:fe=>Se("host",fe),mode:"edit",fieldId:"host",activeFieldId:$,onActivate:te,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Port"}),l.jsx(Yt,{value:String(le.port??""),onSave:fe=>Ie("port",fe),validate:fe=>jf(fe)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:$,onActivate:te,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),T.adapterType==="ssh"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Host"}),l.jsx(Yt,{value:String(le.host??""),onSave:fe=>Se("host",fe),validate:fe=>fe.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:$,onActivate:te,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"User"}),l.jsx(Yt,{value:String(le.user??""),onSave:fe=>Se("user",fe),mode:"edit",fieldId:"user",activeFieldId:$,onActivate:te,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"SSH Port"}),l.jsx(Yt,{value:String(le.sshPort??""),onSave:fe=>Ie("sshPort",fe),validate:fe=>jf(fe)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:$,onActivate:te,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Identity File"}),l.jsx(Yt,{value:String(le.identityFile??""),onSave:fe=>Se("identityFile",fe),mode:"edit",fieldId:"identityFile",activeFieldId:$,onActivate:te,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),T.adapterType==="docker"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Image"}),l.jsx(Yt,{value:String(le.image??""),onSave:fe=>Se("image",fe),mode:"edit",fieldId:"image",activeFieldId:$,onActivate:te,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Repo"}),l.jsx(Yt,{value:String(le.repo??""),onSave:fe=>Se("repo",fe),mode:"edit",fieldId:"repo",activeFieldId:$,onActivate:te,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),T.adapterType==="codespace"&&l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Codespace Name"}),l.jsx(Yt,{value:String(le.codespaceName??""),onSave:fe=>Se("codespaceName",fe),validate:fe=>fe.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:$,onActivate:te,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return l.jsxs("div",{className:ne.container,"data-testid":"env-create-panel",children:[l.jsxs("div",{className:ne.header,children:[l.jsx("div",{className:ne.headerTitle,children:l.jsx("span",{className:ne.badge,children:"new environment"})}),l.jsxs("div",{className:ne.headerActions,children:[l.jsx("button",{onClick:$e,disabled:!de(),className:ne.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),l.jsx("button",{onClick:we,className:ne.btnGhost,children:"Cancel"})]})]}),l.jsx("div",{className:ne.body,children:l.jsxs("div",{className:ne.formContent,children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-name",children:"Name"}),l.jsx("input",{id:"env-create-name",type:"text",value:N,onChange:le=>j(le.target.value),placeholder:"Environment name...",autoFocus:!0,className:ne.nameInput,"data-testid":"env-create-name",onKeyDown:le=>{le.key==="Enter"&&de()&&$e()}})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),l.jsxs("select",{id:"env-create-adapter",value:w,onChange:le=>{C(le.target.value),le.target.value==="codespace"&&u()},className:ne.adapterSelect,"data-testid":"env-create-adapter",children:[l.jsx("option",{value:"local",children:"local"}),l.jsx("option",{value:"ssh",children:"ssh"}),l.jsx("option",{value:"docker",children:"docker"}),l.jsx("option",{value:"codespace",children:"codespace"})]})]}),w==="local"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-host",children:"Host"}),l.jsx("input",{id:"env-create-host",type:"text",value:A,onChange:le=>M(le.target.value),placeholder:"Host (optional)...",className:ne.fieldInput,"data-testid":"env-create-host"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-port",children:"Port"}),l.jsx("input",{id:"env-create-port",type:"number",min:hc,max:gc,value:D,onChange:le=>E(le.target.value),placeholder:"Port (optional)...",className:ne.fieldInput,"data-testid":"env-create-port"})]})]}),w==="ssh"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-host",children:"Host"}),l.jsx("input",{id:"env-create-host",type:"text",value:A,onChange:le=>M(le.target.value),placeholder:"Host (required)...",className:ne.fieldInput,"data-testid":"env-create-host"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-user",children:"User"}),l.jsx("input",{id:"env-create-user",type:"text",value:H,onChange:le=>z(le.target.value),placeholder:"User (optional)...",className:ne.fieldInput,"data-testid":"env-create-user"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-port",children:"SSH Port"}),l.jsx("input",{id:"env-create-port",type:"number",min:hc,max:gc,value:D,onChange:le=>E(le.target.value),placeholder:"SSH port (optional)...",className:ne.fieldInput,"data-testid":"env-create-port"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-identity",children:"Identity File"}),l.jsx("input",{id:"env-create-identity",type:"text",value:Z,onChange:le=>F(le.target.value),placeholder:"Identity file (optional)...",className:ne.fieldInput,"data-testid":"env-create-identity"})]})]}),w==="docker"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-image",children:"Image"}),l.jsx("input",{id:"env-create-image",type:"text",value:Q,onChange:le=>ae(le.target.value),placeholder:"Image (optional)...",className:ne.fieldInput,"data-testid":"env-create-image"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-repo",children:"Repo"}),l.jsx("input",{id:"env-create-repo",type:"text",value:pe,onChange:le=>oe(le.target.value),placeholder:"Repo (optional)...",className:ne.fieldInput,"data-testid":"env-create-repo"})]})]}),w==="codespace"&&l.jsx(k5,{codespaceName:X,onCodespaceNameChange:B,envName:N,onEnvNameChange:j,codespaces:d,codespaceError:m,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v})]})})]})}const w5="_group_1iprv_1",N5="_groupTitle_1iprv_8",j5="_shortcutList_1iprv_17",C5="_shortcutRow_1iprv_23",E5="_keys_1iprv_36",A5="_kbd_1iprv_43",D5="_description_1iprv_60",qa={group:w5,groupTitle:N5,shortcutList:j5,shortcutRow:C5,keys:E5,kbd:A5,description:D5},R5=[{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 M5(){return l.jsxs("section",{className:he.section,"data-testid":"keyboard-shortcuts-panel",children:[l.jsx("h3",{className:he.sectionTitle,children:"Keyboard Shortcuts"}),l.jsx("p",{className:he.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),R5.map(n=>l.jsxs("div",{className:qa.group,children:[l.jsx("h4",{className:qa.groupTitle,children:n.title}),l.jsx("div",{className:qa.shortcutList,children:n.shortcuts.map(s=>l.jsxs("div",{className:qa.shortcutRow,children:[l.jsx("span",{className:qa.keys,children:s.keys.map(i=>l.jsx("kbd",{className:qa.kbd,children:i},i))}),l.jsx("span",{className:qa.description,children:s.description})]},s.description))})]},n.title))]})}const O5="_workpadSection_y8nj9_1",I5="_workpadLabel_y8nj9_9",B5="_workpadStatus_y8nj9_17",L5="_workpadSummary_y8nj9_23",U5="_workpadExtra_y8nj9_29",ua={workpadSection:O5,workpadLabel:I5,workpadStatus:B5,workpadSummary:L5,workpadExtra:U5};function z5({workpad:n}){if(!n)return;let s;try{const i=JSON.parse(n);if(i==null||typeof i!="object"||Array.isArray(i))return;s=i}catch{return l.jsxs("div",{className:ua.workpadSection,"data-testid":"workpad-panel",children:[l.jsx("div",{className:ua.workpadLabel,children:"Workpad"}),l.jsx("div",{className:ua.workpadExtra,children:n})]})}if(!(!s.status&&!s.summary&&!s.extra))return l.jsxs("div",{className:ua.workpadSection,"data-testid":"workpad-panel",children:[l.jsx("div",{className:ua.workpadLabel,children:"Workpad"}),s.status&&l.jsx("div",{className:ua.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&l.jsx("div",{className:ua.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&l.jsx("div",{className:ua.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const P5=[{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 V5({credentialProviders:n,onUpdateCredentialProviders:s}){const i=(o,c)=>{const u={...n};o==="claude"?u.claude=c:u[o]=c,s(u)};return l.jsxs("section",{className:he.section,children:[l.jsx("h3",{className:he.sectionTitle,children:"Credential Providers"}),l.jsx("p",{className:he.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),l.jsx("div",{className:he.tokenList,children:P5.map(o=>l.jsxs("div",{className:he.tokenRow,children:[l.jsx("span",{className:he.tokenName,children:o.label}),l.jsx("span",{className:he.tokenTarget,children:o.description}),l.jsx("select",{className:he.select,value:n[o.key],onChange:c=>i(o.key,c.target.value),children:o.options.map(c=>l.jsx("option",{value:c.value,children:c.label},c.value))})]},o.key))})]})}const H5="_container_10efq_1",q5="_header_10efq_7",G5="_form_10efq_19",$5="_formActions_10efq_87",F5="_editableSection_10efq_94",Z5="_list_10efq_105",K5="_card_10efq_111",Y5="_cardHeader_10efq_125",J5="_cardTitle_10efq_135",W5="_defaultBadge_10efq_141",X5="_cardActions_10efq_155",Q5="_description_10efq_160",e4="_meta_10efq_166",t4="_empty_10efq_212",n4="_typeToggle_10efq_348",s4="_typeBadge_10efq_362",a4="_scriptEditor_10efq_376",i4="_optional_10efq_383",gt={container:H5,header:q5,form:G5,formActions:$5,editableSection:F5,list:Z5,card:K5,cardHeader:Y5,cardTitle:J5,defaultBadge:W5,cardActions:X5,description:Q5,meta:e4,empty:t4,typeToggle:n4,typeBadge:s4,scriptEditor:a4,optional:i4};function o4({personas:n,appDefaultPersonaId:s,onDeletePersona:i,onSetAppDefaultPersonaId:o,onNavigateToNew:c,onNavigateToPersona:u}){const[d,m]=y.useState(null),h=d?n.find(v=>v.id===d):void 0,g=async v=>{await i(v),m(null)};return l.jsxs("div",{className:gt.container,children:[l.jsxs("div",{className:gt.header,children:[l.jsx("h2",{children:"Personas"}),l.jsx(As,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),n.length===0?l.jsx("p",{className:gt.empty,children:"No personas yet. Create one to get started."}):l.jsx("div",{className:gt.list,children:n.map(v=>{const b=s===v.id,_=v.type==="script";return l.jsxs("div",{className:gt.card,"data-testid":`persona-card-${v.id}`,onClick:()=>u(v.id),role:"button",tabIndex:0,onKeyDown:S=>{S.currentTarget===S.target&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),u(v.id))},children:[l.jsxs("div",{className:gt.cardHeader,children:[l.jsxs("span",{className:gt.cardTitle,children:[l.jsx("strong",{children:v.name}),l.jsx("span",{className:gt.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&l.jsx("span",{className:gt.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),l.jsxs("div",{className:gt.cardActions,onClick:S=>S.stopPropagation(),children:[!b&&l.jsx(As,{variant:"ghost",size:"sm",onClick:()=>{o(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),l.jsx(As,{variant:"ghost",size:"sm",onClick:()=>u(v.id),children:"Edit"}),l.jsx(As,{variant:"ghost",size:"sm",onClick:()=>m(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&l.jsx("p",{className:gt.description,children:v.description}),l.jsxs("div",{className:gt.meta,children:[v.runtime&&l.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&l.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&l.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),l.jsx(Ja,{isOpen:d!==null,title:"Delete Persona?",description:`"${(h==null?void 0:h.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{d&&g(d).catch(()=>{})},onCancel:()=>m(null)})]})}const r4="_container_uy08i_1",l4="_header_uy08i_7",c4="_count_uy08i_13",u4="_presets_uy08i_18",d4="_presetButton_uy08i_24",f4="_filterInput_uy08i_41",p4="_groups_uy08i_53",m4="_group_uy08i_53",h4="_groupHeader_uy08i_68",g4="_groupName_uy08i_77",v4="_groupCount_uy08i_81",y4="_toolList_uy08i_87",b4="_toolItem_uy08i_95",_4="_toolName_uy08i_103",tn={container:r4,header:l4,count:c4,presets:u4,presetButton:d4,filterInput:f4,groups:p4,group:m4,groupHeader:h4,groupName:g4,groupCount:v4,toolList:y4,toolItem:b4,toolName:_4},x4=(()=>{const n=new Map;for(const s of ob){const i=s==="get_version_status"?"version":s.split("_")[0];n.has(i)||n.set(i,[]),n.get(i).push(s)}return[...n.entries()].sort(([s],[i])=>s.localeCompare(i)).map(([s,i])=>({group:s,tools:i.sort()}))})(),S4=[{name:"default",label:"Default",tools:rb},{name:"worker",label:"Worker",tools:rT},{name:"orchestrator",label:"Orchestrator",tools:lT},{name:"admin",label:"Admin",tools:cT}];function qy({selectedTools:n,onChange:s,disabled:i}){const[o,c]=y.useState(""),u=y.useMemo(()=>new Set(n),[n]),d=y.useCallback(v=>{if(i)return;const b=new Set(u);b.has(v)?b.delete(v):b.add(v),s([...b].sort())},[u,s,i]),m=y.useCallback((v,b)=>{if(i)return;const _=new Set(u);for(const S of v)b?_.delete(S):_.add(S);s([..._].sort())},[u,s,i]),h=y.useCallback(v=>{i||s([...v].sort())},[s,i]),g=o.toLowerCase();return l.jsxs("div",{className:tn.container,"data-testid":"mcp-tool-selector",children:[l.jsx("div",{className:tn.header,children:l.jsx("span",{className:tn.count,children:n.length===0?`Using default (${rb.length} tools)`:`${n.length} of ${ob.size} tools selected`})}),l.jsxs("div",{className:tn.presets,"data-testid":"mcp-tool-presets",children:[S4.map(v=>l.jsx("button",{type:"button",className:tn.presetButton,disabled:i,onClick:()=>h(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),l.jsx("button",{type:"button",className:tn.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),l.jsx("input",{type:"text",className:tn.filterInput,placeholder:"Filter tools...",value:o,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),l.jsx("div",{className:tn.groups,children:x4.map(({group:v,tools:b})=>{const _=g?b.filter(T=>T.toLowerCase().includes(g)):b;if(_.length===0)return null;const S=_.every(T=>u.has(T));return l.jsxs("div",{className:tn.group,"data-testid":`tool-group-${v}`,children:[l.jsxs("label",{className:tn.groupHeader,children:[l.jsx("input",{type:"checkbox",checked:S,onChange:()=>m(_,S),disabled:i,"data-testid":`group-toggle-${v}`}),l.jsx("span",{className:tn.groupName,children:v}),l.jsxs("span",{className:tn.groupCount,children:["(",_.filter(T=>u.has(T)).length,"/",_.length,")"]})]}),l.jsx("div",{className:tn.toolList,children:_.map(T=>l.jsxs("label",{className:tn.toolItem,children:[l.jsx("input",{type:"checkbox",checked:u.has(T),onChange:()=>d(T),disabled:i,"data-testid":`tool-${T}`}),l.jsx("span",{className:tn.toolName,children:T})]},T))})]},v)})})]})}const T4="_nav_1bhou_1",k4="_tab_1bhou_24",w4="_tabIcon_1bhou_62",N4="_tabActive_1bhou_68",ac={nav:T4,tab:k4,tabIcon:w4,tabActive:N4},Es=[{path:"credentials",label:"Credentials",icon:"🔑"},{path:"personas",label:"Personas",icon:"👤"},{path:"appearance",label:"Appearance",icon:"🎨"},{path:"shortcuts",label:"Shortcuts",icon:"⌨️"},{path:"about",label:"About",icon:"ℹ️"}];function j4(){var d;const n=Lt(),s=St(),i=y.useRef(null),o=((d=Es.find(m=>{const h=`${Ji}/${m.path}`;return n.pathname===h||n.pathname.startsWith(`${h}/`)}))==null?void 0:d.path)??Es[0].path,c=y.useCallback(m=>{s(`${Ji}/${m}`)},[s]),u=y.useCallback(m=>{var S,T;const h=(S=i.current)==null?void 0:S.querySelectorAll('[role="tab"]');if(!h)return;const g=Array.from(h).findIndex(N=>N===document.activeElement),v=g>=0?g:Es.findIndex(N=>N.path===o);let b=v;if(m.key==="ArrowDown"||m.key==="j"||m.key==="J")m.preventDefault(),b=(v+1)%Es.length;else if(m.key==="ArrowUp"||m.key==="k"||m.key==="K")m.preventDefault(),b=(v-1+Es.length)%Es.length;else if(m.key==="Home")m.preventDefault(),b=0;else if(m.key==="End")m.preventDefault(),b=Es.length-1;else return;const _=Es[b].path;s(`${Ji}/${_}`),(T=h[b])==null||T.focus()},[o,s]);return l.jsx("nav",{className:ac.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:Es.map(m=>{const h=m.path===o;return l.jsxs("button",{role:"tab",type:"button","aria-selected":h,tabIndex:h?0:-1,className:`${ac.tab} ${h?ac.tabActive:""}`,onClick:()=>c(m.path),children:[l.jsx("span",{className:ac.tabIcon,"aria-hidden":"true",children:m.icon}),m.label]},m.path)})})}function C4({tasks:n,taskStatusById:s,sessionStatusByTaskId:i}){const o=new Map;for(const u of n)if(u.parentTaskId){const d=o.get(u.parentTaskId);d?d.push(u):o.set(u.parentTaskId,[u])}const c=new Map(u0.map(u=>[u,[]]));for(const u of n){const d=fp(u.status),m=u.dependsOn.length>0&&u.dependsOn.some(T=>s.get(T)!=="complete"),h=o.get(u.id)??[],g=h.length,v=h.filter(T=>T.status==="complete").length;let b;if(d==="paused"&&i){const T=i.get(u.id);T==="idle"?b="Needs input":T==="completed"&&(b="Ready to complete")}const _={task:u,isBlocked:m,childCount:g,doneChildCount:v,pausedSubBadge:b},S=c.get(d);S?S.push(_):c.get("not_started").push(_)}for(const u of c.values())u.sort((d,m)=>d.task.sortOrder-m.task.sortOrder);return u0.map(u=>{const d=ma(u);return{status:u,label:d.label,style:d,tasks:c.get(u)??[]}})}const E4="_boardContainer_1c4y1_1",A4="_column_1c4y1_17",D4="_columnHeader_1c4y1_34",R4="_columnIcon_1c4y1_47",M4="_columnLabel_1c4y1_52",O4="_columnCount_1c4y1_57",I4="_cardList_1c4y1_67",B4="_emptyPlaceholder_1c4y1_76",L4="_card_1c4y1_67",U4="_cardHeader_1c4y1_107",z4="_cardStatusIcon_1c4y1_113",P4="_cardTitle_1c4y1_119",V4="_cardBadges_1c4y1_127",H4="_badge_1c4y1_134",q4="_blockedBadge_1c4y1_146",G4="_childBadge_1c4y1_151",$4="_depBadge_1c4y1_155",F4="_parentBadge_1c4y1_159",Z4="_pausedSubBadge_1c4y1_166",K4="_personaBadge_1c4y1_170",Y4="_envBadge_1c4y1_174",J4="_emptyCta_1c4y1_178",W4="_ctaButton_1c4y1_188",X4="_ctaDescription_1c4y1_204",Xe={boardContainer:E4,column:A4,columnHeader:D4,columnIcon:R4,columnLabel:M4,columnCount:O4,cardList:I4,emptyPlaceholder:B4,card:L4,cardHeader:U4,cardStatusIcon:z4,cardTitle:P4,cardBadges:V4,badge:H4,blockedBadge:q4,childBadge:G4,depBadge:$4,parentBadge:F4,pausedSubBadge:Z4,personaBadge:K4,envBadge:Y4,emptyCta:J4,ctaButton:W4,ctaDescription:X4};function Q4({workspaceId:n,environmentId:s,tasks:i,sessions:o,personas:c,environments:u}){const d=St(),m=y.useMemo(()=>i.filter(_=>_.workspaceId===n),[i,n]),h=y.useMemo(()=>new Map(i.map(_=>[_.id,_.status])),[i]),g=y.useMemo(()=>new Map(m.map(_=>[_.id,_])),[m]),v=y.useMemo(()=>{const _=new Map(o.map(C=>[C.id,C])),S=new Map(c.map(C=>[C.id,C])),T=new Map(u.map(C=>[C.id,C])),N=new Map,j=new Map,w=new Map;for(const C of m)if(C.latestSessionId){const A=_.get(C.latestSessionId);if(A){if(N.set(C.id,A.endReason||A.status),A.personaId){const M=S.get(A.personaId);M&&j.set(C.id,M.name)}if(A.environmentId){const M=T.get(A.environmentId);M&&w.set(C.id,M.displayName)}}}return{sessionStatusByTaskId:N,personaNameByTaskId:j,environmentNameByTaskId:w}},[m,o,c,u]),b=y.useMemo(()=>C4({tasks:m,taskStatusById:h,sessionStatusByTaskId:v.sessionStatusByTaskId}),[m,h,v]);return m.length===0?l.jsxs("div",{className:Xe.emptyCta,"data-testid":"board-empty-cta",children:[l.jsx("button",{className:Xe.ctaButton,onClick:()=>d(ei(n,void 0,s)),children:"Create Task"}),l.jsx("div",{className:Xe.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):l.jsx("div",{className:Xe.boardContainer,"data-testid":"board-container",children:b.map(_=>l.jsxs("section",{className:Xe.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[l.jsxs("div",{className:Xe.columnHeader,children:[l.jsx("span",{className:Xe.columnIcon,style:{color:_.style.color},children:_.style.icon}),l.jsx("span",{className:Xe.columnLabel,children:_.label}),l.jsx("span",{className:Xe.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),l.jsx("div",{className:Xe.cardList,children:_.tasks.length===0?l.jsx("div",{className:Xe.emptyPlaceholder,children:"No tasks"}):l.jsx(rs,{mode:"popLayout",children:_.tasks.map(S=>l.jsx(Ot.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:l.jsx(eB,{boardTask:S,tasksById:g,personaName:v.personaNameByTaskId.get(S.task.id),envName:v.environmentNameByTaskId.get(S.task.id),onClick:()=>d(os(S.task.id,void 0,n,s))})},S.task.id))})})]},_.status))})}function eB({boardTask:n,tasksById:s,personaName:i,envName:o,onClick:c}){const{task:u,isBlocked:d,childCount:m,doneChildCount:h,pausedSubBadge:g}=n,v=ma(u.status),b=u.parentTaskId?s.get(u.parentTaskId):void 0;return l.jsxs("div",{className:Xe.card,tabIndex:0,role:"button","data-testid":`board-card-${u.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[l.jsxs("div",{className:Xe.cardHeader,children:[l.jsx("span",{className:Xe.cardStatusIcon,style:{color:v.color},children:v.icon}),l.jsx("span",{className:Xe.cardTitle,children:u.title})]}),l.jsxs("div",{className:Xe.cardBadges,children:[b&&l.jsx("span",{className:`${Xe.badge} ${Xe.parentBadge}`,title:b.title,children:b.title}),m>0&&l.jsxs("span",{className:`${Xe.badge} ${Xe.childBadge}`,children:[h,"/",m]}),d&&l.jsx("span",{className:`${Xe.badge} ${Xe.blockedBadge}`,children:"blocked"}),u.dependsOn.length>0&&!d&&l.jsx("span",{className:`${Xe.badge} ${Xe.depBadge}`,children:"dep"}),g&&l.jsx("span",{className:`${Xe.badge} ${Xe.pausedSubBadge}`,children:g}),i&&l.jsx("span",{className:`${Xe.badge} ${Xe.personaBadge}`,children:i}),o&&l.jsx("span",{className:`${Xe.badge} ${Xe.envBadge}`,children:o})]})]})}const tB="_formContent_ymnez_1",nB="_section_ymnez_13",sB="_label_ymnez_19",aB="_titleInput_ymnez_26",iB="_descriptionTextarea_ymnez_58",oB="_selectField_ymnez_94",rB="_checkboxRow_ymnez_128",lB="_checkboxLabel_ymnez_141",cB="_fieldError_ymnez_146",ut={formContent:tB,section:nB,label:sB,titleInput:aB,descriptionTextarea:iB,selectField:oB,checkboxRow:rB,checkboxLabel:lB,fieldError:cB};function uB(n,s){return{name:(n==null?void 0:n.name)??"",description:(n==null?void 0:n.description)??"",repoUrl:(n==null?void 0:n.repoUrl)??"",environmentId:(n==null?void 0:n.environmentId)??s??"",defaultPersonaId:(n==null?void 0:n.defaultPersonaId)??"",useWorktrees:(n==null?void 0:n.useWorktrees)??!0,workingDirectory:(n==null?void 0:n.workingDirectory)??""}}const dB=100;function fB({values:n,onChange:s,environments:i,personas:o,errors:c,disabled:u,autoFocusName:d}){const m=(h,g)=>{s({...n,[h]:g})};return l.jsxs("div",{className:ut.formContent,children:[l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-name",children:"Name"}),l.jsx("input",{id:"ws-name",className:ut.titleInput,type:"text",value:n.name,onChange:h=>m("name",h.target.value),placeholder:"Workspace name",maxLength:dB,autoFocus:d,disabled:u,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&l.jsx("span",{className:ut.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-description",children:"Description"}),l.jsx("textarea",{id:"ws-description",className:ut.descriptionTextarea,value:n.description,onChange:h=>m("description",h.target.value),placeholder:"Optional description (Markdown supported)",disabled:u,"data-testid":"workspace-form-description"})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-repo",children:"Repository URL"}),l.jsx("input",{id:"ws-repo",className:ut.titleInput,type:"text",value:n.repoUrl,onChange:h=>m("repoUrl",h.target.value),placeholder:"https://github.com/org/repo",disabled:u,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&l.jsx("span",{className:ut.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-environment",children:"Environment"}),l.jsxs("select",{id:"ws-environment",className:ut.selectField,value:n.environmentId,onChange:h=>m("environmentId",h.target.value),disabled:u,"data-testid":"workspace-form-environment",children:[l.jsx("option",{value:"",children:"Select environment…"}),i.map(h=>l.jsx("option",{value:h.id,children:h.displayName||h.id},h.id))]}),(c==null?void 0:c.environmentId)&&l.jsx("span",{className:ut.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-persona",children:"Default Persona"}),l.jsxs("select",{id:"ws-persona",className:ut.selectField,value:n.defaultPersonaId,onChange:h=>m("defaultPersonaId",h.target.value),disabled:u,"data-testid":"workspace-form-persona",children:[l.jsx("option",{value:"",children:"(Inherit)"}),o.map(h=>l.jsx("option",{value:h.id,children:h.name},h.id))]})]}),l.jsx("div",{className:ut.section,children:l.jsxs("label",{className:ut.checkboxRow,children:[l.jsx("input",{type:"checkbox",checked:n.useWorktrees,onChange:h=>m("useWorktrees",h.target.checked),disabled:u,"data-testid":"workspace-form-worktrees"}),l.jsx("span",{className:ut.checkboxLabel,children:"Enable worktree isolation"})]})}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-workdir",children:"Working Directory"}),l.jsx("input",{id:"ws-workdir",className:ut.titleInput,type:"text",value:n.workingDirectory,onChange:h=>m("workingDirectory",h.target.value),placeholder:"Default (server default)",disabled:u,"data-testid":"workspace-form-workdir"})]})]})}const Tx=y.createContext(void 0),pB=4e3;function mB({children:n}){const[s,i]=y.useState([]),o=y.useRef(0),c=y.useCallback(d=>{i(m=>m.filter(h=>h.id!==d))},[]),u=y.useCallback((d,m="info",h=pB)=>{const g=`toast-${++o.current}`;i(v=>[...v,{id:g,message:d,variant:m,duration:h}])},[]);return l.jsx(Tx.Provider,{value:{toasts:s,showToast:u,dismissToast:c},children:n})}function dn(){const n=y.useContext(Tx);if(!n)throw new Error("useToast must be used within ToastProvider");return n}const op="grackle-theme",kx="grackle-prefer-system",wx="(prefers-color-scheme: dark)";let fr=[],vc;function Ef(){vc=void 0;for(const n of fr)n()}function rp(){return typeof window>"u"?!1:window.matchMedia(wx).matches}function yr(){if(typeof localStorage>"u")return Hy;try{const n=localStorage.getItem(op);if(n!==null&&_x.has(n))return n}catch{}return Hy}function Cc(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(kx)==="true"}catch{return!1}}function lp(n){return Pc.find(s=>s.variantLightId===n||s.variantDarkId===n)}function Nx(n,s){const i=ip(n);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?rp()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const o=lp(n);if(o!=null&&o.variantLightId&&o.variantDarkId)return rp()?o.variantDarkId:o.variantLightId}return n}function qi(n,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=Nx(n,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&qi(yr(),Cc());function hB(){return vc===void 0&&(vc={themeId:yr(),systemDark:rp(),preferSystem:Cc()}),vc}function gB(n){return fr=[...fr,n],()=>{fr=fr.filter(s=>s!==n)}}function vB(){const n=y.useSyncExternalStore(gB,hB),{themeId:s,preferSystem:i}=n,o=Nx(s,i),c=y.useCallback(d=>{if(_x.has(d)){try{localStorage.setItem(op,d)}catch{}qi(d,Cc(),!0),Ef()}},[]),u=y.useCallback(d=>{try{localStorage.setItem(kx,d?"true":"false")}catch{}if(d){const m=yr(),h=ip(m);if(h!=null&&h.hidden){const g=lp(m);if(g)try{localStorage.setItem(op,g.id)}catch{}}}qi(yr(),d,!0),Ef()},[]);return y.useEffect(()=>{qi(s,i)},[s,i]),y.useEffect(()=>{if(typeof window>"u")return;const d=window.matchMedia(wx),m=()=>{const h=yr(),g=Cc();if(g){const v=ip(h);if(v!=null&&v.variantDarkId&&v.variantLightId&&qi(h,g),v!=null&&v.hidden){const b=lp(h);b!=null&&b.variantDarkId&&b.variantLightId&&qi(h,g)}}Ef()};return d.addEventListener("change",m),()=>{d.removeEventListener("change",m)}},[]),{themeId:s,setTheme:c,resolvedThemeId:o,preferSystem:i,setPreferSystem:u}}const jx=y.createContext(void 0);function yB({children:n}){const s=vB();return l.jsx(jx.Provider,{value:s,children:n})}function Cx(){const n=y.useContext(jx);if(!n)throw new Error("useThemeContext must be used within ThemeProvider");return n}const Ex=y.createContext(void 0),Ax=y.createContext(void 0);function bB({children:n}){const[s,i]=y.useState(void 0),o=y.useCallback(c=>{i(c)},[]);return l.jsx(Ax.Provider,{value:o,children:l.jsx(Ex.Provider,{value:s,children:n})})}function _B(){return y.useContext(Ex)}function xB(){const n=y.useContext(Ax);if(n===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return n}const am=y.createContext(void 0);function pt(){const n=y.useContext(am);if(!n)throw new Error("useGrackle must be used within GrackleProvider");return n}function Dx(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function Rx(n,s){return console.warn(`[ws] Malformed "${n}" message: ${s}`),!1}function SB(n){return Dx(n)&&typeof n.sessionId=="string"&&typeof n.eventType=="string"&&typeof n.timestamp=="string"&&typeof n.content=="string"&&(n.raw===void 0||typeof n.raw=="string")}const TB=new Set(["off","subscription","api_key"]),ic=new Set(["off","on"]);function kB(n){return Dx(n)&&TB.has(n.claude)&&ic.has(n.github)&&ic.has(n.copilot)&&ic.has(n.codex)&&ic.has(n.goose)}function Mx(n){switch(n){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 n}}function Ox(n){switch(n){case"completed":return"completed";case"killed":return"killed";case"failed":return"interrupted";case"interrupted":return"interrupted";case"terminated":return"terminated";default:return}}const Hi=5e3;function wB(n,s){const i=[];let o=n;const c=new Set;for(;o&&s.has(o)&&!c.has(o);){c.add(o);const u=s.get(o);i.unshift(u),o=u.parentTaskId||void 0}return i}const Wa={label:"Home",url:Ya};function NB(n){return n?[Wa,{label:"Settings",url:Ji},{label:n,url:void 0}]:[Wa,{label:"Settings",url:void 0}]}const Ix={label:"Environments",url:Xi};function jB(){return[Wa,{label:"Environments",url:void 0}]}function CB(){return[Wa,{label:"New Chat",url:void 0}]}function EB(n){return[Wa,{label:`Session ${n.slice(0,8)}`,url:void 0}]}function AB(n,s,i,o){const c=i.find(d=>d.id===n),u=o.find(d=>d.id===s);return[Wa,Ix,{label:(u==null?void 0:u.displayName)??"Environment",url:Qi(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function DB(n,s,i,o,c){const u=wB(n,c),d=c.get(n),m=d==null?void 0:d.workspaceId,h=m?i.find(S=>S.id===m):void 0,g=s??(h==null?void 0:h.environmentId),v=g?o.find(S=>S.id===g):void 0,b=[Wa];v&&g&&(b.push(Ix),b.push({label:v.displayName,url:Qi(g)})),h&&g&&b.push({label:h.name,url:Wi(h.id,g)});for(let S=0;S<u.length-1;S++)b.push({label:u[S].title,url:os(u[S].id,void 0,m,g)});const _=u[u.length-1];return b.push({label:(_==null?void 0:_.title)??n,url:void 0}),b}function im(n){const s=[];for(const i of n){const o=s[s.length-1];i.eventType==="text"&&(o==null?void 0:o.eventType)==="text"?s[s.length-1]={...o,content:o.content+i.content}:s.push(i)}return s}function om(n){const s=new Map;for(const u of n)if(u.raw)try{s.set(u,JSON.parse(u.raw))}catch{}const i=new Map;for(const u of n){if(u.eventType!=="tool_use")continue;const d=s.get(u);if(!(!d||typeof d.id!="string"))try{const m=JSON.parse(u.content);i.set(d.id,{tool:m.tool,args:m.args})}catch{}}const o=new Set;return n.map(u=>{if(u.eventType!=="tool_result")return u;const d=s.get(u);if(!d||typeof d.tool_use_id!="string")return u;const m=i.get(d.tool_use_id);if(!m)return u;o.add(d.tool_use_id);let h;const g=u.content.trim();if(g.startsWith("{"))try{const v=JSON.parse(g);typeof v.detailedContent=="string"&&(h=v.detailedContent)}catch{}return{...u,toolUseCtx:{...m,detailedResult:h}}}).filter(u=>{if(u.eventType!=="tool_use")return!0;const d=s.get(u);return d&&typeof d.id=="string"?!o.has(d.id):!0})}function RB(n,s,i){const o=n.filter(h=>h.status==="running"||h.status==="idle"||h.status==="waiting").length,c=Bx(s),u=s.filter(h=>cp(h,c)).length,d=s.filter(h=>h.status==="paused"||h.status==="failed"||cp(h,c)).length,m=i.filter(h=>h.status==="disconnected"||h.status==="error").length;return{activeSessions:o,blockedTasks:u,attentionTasks:d,unhealthyEnvironments:m}}function Bx(n){const s=new Map;for(const i of n)s.set(i.id,i.status);return s}function cp(n,s){return n.dependsOn.some(i=>s.get(i)!=="complete")}function MB(n,s){var d;const i=new Map;for(const m of s)i.set(m.id,m);const o=Bx(n),c=[];for(const m of n){const h=m.workspaceId?((d=i.get(m.workspaceId))==null?void 0:d.name)??"Unknown":"Unknown";m.status==="failed"?c.push({task:m,reason:"failed",workspaceName:h}):cp(m,o)?c.push({task:m,reason:"blocked",workspaceName:h}):m.status==="paused"&&c.push({task:m,reason:"paused",workspaceName:h})}const u={failed:0,blocked:1,paused:2};return c.sort((m,h)=>(u[m.reason]??3)-(u[h.reason]??3)),c}function OB(n,s){const i=new Map;for(const o of s)i.set(o.id,o);return n.filter(o=>o.status==="running"||o.status==="idle"||o.status==="waiting").map(o=>{var c;return{session:o,environmentName:((c=i.get(o.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function IB(n,s,i){const o=new Map;for(const c of s){if(!c.workspaceId)continue;let u=o.get(c.workspaceId);u||(u={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},o.set(c.workspaceId,u)),u.totalTasks+=1,c.status==="complete"?u.completedTasks+=1:c.status==="working"?u.workingTasks+=1:c.status==="failed"&&(u.failedTasks+=1)}return n.map(c=>{const u=o.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:u.totalTasks,completedTasks:u.completedTasks,workingTasks:u.workingTasks,failedTasks:u.failedTasks}})}const ns=[{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
|
|
38
63
|
export function verifyToken(req: Request, res: Response, next: NextFunction): void {
|
|
39
64
|
const header = req.headers.authorization;
|
|
40
65
|
if (!header?.startsWith("Bearer ")) {
|
|
@@ -57,7 +82,7 @@ CREATE TABLE audit_log (
|
|
|
57
82
|
ip_address INET,
|
|
58
83
|
created_at TIMESTAMPTZ DEFAULT now()
|
|
59
84
|
);
|
|
60
|
-
\`\`\``,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}],
|
|
85
|
+
\`\`\``,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}],da=[{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"}],BB=new Map(ns.map(n=>[n.id,n]));function Af(n){const s=BB.get(n);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${n}"`);return s}const Gy={"kn-auth-flow":{node:Af("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:Af("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:Af("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"}]}},LB=[{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}],UB=[{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}],zB=[{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.
|
|
61
86
|
Project: acme/alpha — Node.js + Express REST API
|
|
62
87
|
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";
|
|
63
88
|
import type { Request, Response, NextFunction } from "express";
|
|
@@ -366,7 +391,7 @@ src/services/analytics.ts:1:import { pool } from "../db/pool.js";`,raw:JSON.stri
|
|
|
366
391
|
2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
|
|
367
392
|
3. Add middleware to extract tenant ID from the request
|
|
368
393
|
|
|
369
|
-
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"}],$2=[{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"}],F2=[{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:""}],_0=[{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"}],Z2=[{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:""}],K2=[{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));
|
|
394
|
+
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"}],PB=[{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"}],VB=[{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:""}],$y=[{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"}],HB=[{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:""}],qB=[{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));
|
|
370
395
|
for (const f of files) {
|
|
371
396
|
const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);
|
|
372
397
|
if (eslintResult.exitCode !== 0) {
|
|
@@ -377,7 +402,7 @@ for (const f of files) {
|
|
|
377
402
|
env.findings.push({ category: "format", title: \`Prettier issues in \${f.filename}\`, content: prettierResult.stderr });
|
|
378
403
|
}
|
|
379
404
|
}
|
|
380
|
-
env.findings.push({ category: "summary", title: "Lint & format pass complete", content: \`Ran ESLint and Prettier on \${files.length} files\` });`,allowedMcpTools:[]}],
|
|
405
|
+
env.findings.push({ category: "summary", title: "Lint & format pass complete", content: \`Ran ESLint and Prettier on \${files.length} files\` });`,allowedMcpTools:[]}],GB={"task-001b":[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z"},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Implement auth middleware",startedAt:"2026-02-27T08:15:00Z"}],"task-006c":[{id:"sess-004",environmentId:"env-docker-01",runtime:"claude-code",status:"running",prompt:"Add compression options",startedAt:"2026-02-27T09:00:00Z"}]};function Ee(n){return new Date(Date.now()+n).toISOString()}const Fy=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(1200),content:JSON.stringify({tool:"Glob",args:{pattern:"src/routes/**/*.ts"}}),raw:JSON.stringify({id:"stream-a-01",type:"tool_use"})}},{delayMs:1600,event:{eventType:"tool_result",timestamp:Ee(1600),content:`src/routes/users.ts
|
|
381
406
|
src/routes/auth.ts
|
|
382
407
|
src/routes/billing.ts
|
|
383
408
|
src/routes/admin.ts
|
|
@@ -461,43 +486,18 @@ export function verifyToken(req: Request, res: Response, next: NextFunction): vo
|
|
|
461
486
|
|
|
462
487
|
Tests: 3 passed, 3 total
|
|
463
488
|
Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Ee(6400),content:JSON.stringify({tool:"Grep",args:{pattern:"decoded\\.exp",path:"src/"}}),raw:JSON.stringify({id:"tool-mock-004"})}},{delayMs:7e3,event:{eventType:"tool_result",timestamp:Ee(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
|
|
464
|
-
src/utils/token-refresh.ts:28: const remaining = decoded.exp - Date.now() / 1000;`,raw:JSON.stringify({tool_use_id:"tool-mock-004",is_error:!1})}},{delayMs:7800,event:{eventType:"text",timestamp:Ee(7800),content:"Fixed. The token expiry comparison was inverted — `decoded.exp > Date.now()` should have been `<` (a token is expired when its `exp` is in the past). The other occurrence in `token-refresh.ts` uses subtraction (not comparison), so it was already correct. All 3 auth tests pass."}},{delayMs:8400,event:{eventType:"usage",timestamp:Ee(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_usd:.12})}},{delayMs:8800,event:{eventType:"status",timestamp:Ee(8800),content:"completed"}}]}],S0=400;function J2({children:n}){const[s,i]=y.useState(H2),[o,c]=y.useState(q2),[u,d]=y.useState(G2),[m,h]=y.useState(void 0),[g,v]=y.useState($2),[b,_]=y.useState(F2),[S,T]=y.useState(_0),[N,j]=y.useState(Z2),[w,C]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[A,M]=y.useState(K2),[D]=y.useState(Y2),[E,H]=y.useState(""),[z,Z]=y.useState(ns),[F,Q]=y.useState(ca),[ae,pe]=y.useState(void 0),[oe,X]=y.useState(void 0),[B,$]=y.useState(""),te=y.useRef(void 0),re=y.useRef(0),de=y.useRef(0),$e=y.useRef(new Set),we=y.useRef(new Map),Se=y.useRef(b);Se.current=b;const Ie=y.useRef(new Map),le=y.useRef(new Map),fe=y.useCallback(q=>(re.current+=1,`mock-${q}-${String(re.current).padStart(3,"0")}`),[]),me=y.useCallback(()=>{const q=x0[de.current%x0.length];return de.current+=1,q},[]),Ce=y.useCallback((q,ee,ie)=>{const ce=setTimeout(()=>{var ue;$e.current.delete(ce),ie&&((ue=we.current.get(ie))==null||ue.delete(ce)),q()},ee);$e.current.add(ce),ie&&(we.current.has(ie)||we.current.set(ie,new Set),we.current.get(ie).add(ce))},[]),Ut=y.useCallback(q=>{const ee=we.current.get(q);ee&&(ee.forEach(ie=>{clearTimeout(ie),$e.current.delete(ie)}),we.current.delete(q))},[]),Tt=y.useCallback((q,ee,ie)=>{c(ce=>ce.map(ue=>ue.id===q?{...ue,status:ee,...ie!==void 0?{endReason:ie}:{}}:ue))},[]),I=y.useCallback(q=>{d(ee=>[...ee,q])},[]),Ne=y.useCallback((q,ee,ie)=>{ee.forEach((ce,ue)=>{Ce(()=>{const Pe={sessionId:q,...ce.event,timestamp:new Date().toISOString()};if(I(Pe),ce.event.eventType==="status"){const ye=Ob(ce.event.content),Re=Ib(ce.event.content);Tt(q,ye,Re)}ue===ee.length-1&&ie&&ie()},ce.delayMs,q)})},[Ce,I,Tt]),Ct=y.useCallback((q,ee,ie,ce)=>{console.log("[MockGrackle] spawn",{environmentId:q,prompt:ee,runtime:ce});const ue=fe("sess"),Pe={id:ue,environmentId:q,runtime:ce||"claude-code",status:"running",prompt:ee,startedAt:new Date().toISOString()};c(Re=>[...Re,Pe]),h(ue);const ye=me();if(console.log(`[MockGrackle] Playing scenario: ${ye.label}`),ye.pauseForInput){const Re=ye.pauseAfterStep??ye.steps.length-1,Fe=ye.steps.slice(0,Re+1),tt=Fe.length>0?Fe[Fe.length-1].delayMs:0;Ne(ue,Fe),Ce(()=>{Tt(ue,"idle"),I({sessionId:ue,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},tt+S0,ue),ye.resumeSteps&&Ie.current.set(ue,ye.resumeSteps)}else Ne(ue,ye.steps)},[fe,me,Ne,Ce,Tt,I]),It=y.useCallback(q=>{console.log("[MockGrackle] kill",q),Ut(q),Ie.current.delete(q),Tt(q,"stopped","killed"),I({sessionId:q,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),_(ee=>ee.map(ie=>ie.latestSessionId===q&&ie.status==="working"?{...ie,status:"not_started"}:ie))},[Ut,Tt,I]),it=y.useCallback(q=>{console.log("[MockGrackle] stopGraceful",q),Ut(q),Ie.current.delete(q),Tt(q,"stopped","terminated"),I({sessionId:q,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),_(ee=>ee.map(ie=>ie.latestSessionId===q&&ie.status==="working"?{...ie,status:"not_started"}:ie))},[Ut,Tt,I]),Yn=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Bs=y.useCallback(q=>{console.log("[MockGrackle] loadSessionEvents",q)},[]),Tn=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),d([])},[]),zn=y.useCallback((q,ee,ie,ce,ue,Pe,ye,Re,Fe)=>{console.log("[MockGrackle] createWorkspace",{name:q,description:ee});const tt={id:fe("proj"),name:q,description:ee||"",repoUrl:ie||"",environmentId:ce||"",status:"active",workingDirectory:ye||"",useWorktrees:Pe??!0,defaultPersonaId:ue||"",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Ve=>[...Ve,tt]),Re&&Re()},[fe]),Jn=y.useCallback(q=>{console.log("[MockGrackle] archiveWorkspace",q),v(ee=>ee.map(ie=>ie.id===q?{...ie,status:"archived"}:ie))},[]),Ls=y.useCallback(q=>{console.log("[MockGrackle] loadTasks",q)},[]),Pn=y.useCallback((q,ee,ie,ce,ue,Pe,ye,Re,Fe)=>{console.log("[MockGrackle] createTask",{workspaceId:q,title:ee,parentTaskId:ue}),_(tt=>{const Vt=tt.filter(Hn=>Hn.workspaceId===q).reduce((Hn,xa)=>Math.max(Hn,xa.sortOrder),0),Ht=ue?tt.find(Hn=>Hn.id===ue):void 0;if(ue&&!Ht)return console.warn("[MockGrackle] Parent task not found:",ue),tt;if(Ht&&!Ht.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ue),tt;const kt=Ht?Ht.depth+1:0,ls={id:fe("task"),workspaceId:q,title:ee,description:ie||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:ce||[],reviewNotes:void 0,sortOrder:Vt+1,createdAt:new Date().toISOString(),parentTaskId:ue||"",depth:kt,childTaskIds:[],canDecompose:ye??!ue,defaultPersonaId:Pe||"",workpad:""};return[...tt,ls]}),Re&&Re()},[fe]),De=y.useCallback((q,ee,ie,ce)=>{var tt;console.log("[MockGrackle] startTask",{taskId:q});const ue=Se.current.find(Ve=>Ve.id===q),Pe=(ue==null?void 0:ue.title)??"",ye=fe("sess"),Re={id:ye,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:Pe||q,startedAt:new Date().toISOString()};c(Ve=>[...Ve,Re]),_(Ve=>Ve.map(Vt=>Vt.id===q?{...Vt,status:"working",latestSessionId:ye,branch:`mock/${q.slice(0,8)}`}:Vt));const Fe=me();if(console.log(`[MockGrackle] Playing task scenario: ${Fe.label}`),Fe.pauseForInput){const Ve=Fe.pauseAfterStep??Fe.steps.length-1,Vt=Fe.steps.slice(0,Ve+1),Ht=Vt.length>0?Vt[Vt.length-1].delayMs:0;if(Ne(ye,Vt),Ce(()=>{Tt(ye,"idle"),I({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},Ht+S0,ye),Fe.resumeSteps){const kt=[...Fe.resumeSteps];Ie.current.set(ye,kt);const ls=kt.reduce((Hn,xa)=>Math.max(Hn,xa.delayMs),0);le.current.set(ye,{taskId:q,delayAfterResume:ls+200})}}else{const Ve=Fe.steps.length>0?Fe.steps[Fe.steps.length-1].delayMs:0;Ne(ye,Fe.steps);const Vt=(tt=Fe.steps[Fe.steps.length-1])==null?void 0:tt.event.content;Ce(()=>{Vt==="completed"?_(Ht=>Ht.map(kt=>kt.id===q&&kt.status==="working"?{...kt,status:"paused"}:kt)):Vt==="failed"&&_(Ht=>Ht.map(kt=>kt.id===q&&kt.status==="working"?{...kt,status:"failed"}:kt))},Ve+100,ye)}},[fe,me,Ne,Ce,Tt,I]),Je=y.useCallback((q,ee)=>{console.log("[MockGrackle] sendInput",{sessionId:q,text:ee}),I({sessionId:q,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ee}`}),Tt(q,"running"),I({sessionId:q,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const ie=Ie.current.get(q);if(ie)Ie.current.delete(q),Ne(q,ie);else{const ue=[{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"}}];Ne(q,ue)}const ce=le.current.get(q);ce&&(le.current.delete(q),Ce(()=>{_(ue=>ue.map(Pe=>Pe.id===ce.taskId&&Pe.status==="working"?{...Pe,status:"paused"}:Pe))},ce.delayAfterResume,q))},[I,Tt,Ne,Ce]),lo=y.useCallback(q=>{console.log("[MockGrackle] completeTask",q),_(ee=>ee.map(ie=>ie.id===q?{...ie,status:"complete"}:ie))},[]),co=y.useCallback(q=>{console.log("[MockGrackle] resumeTask",q)},[]),uo=y.useCallback((q,ee,ie,ce,ue)=>{console.log("[MockGrackle] updateTask",{taskId:q,title:ee}),_(Pe=>Pe.map(ye=>ye.id===q?{...ye,title:ee.trim()||ye.title,description:ie,dependsOn:ce,...ue!==void 0?{defaultPersonaId:ue}:{}}:ye))},[]),_a=y.useCallback(q=>{console.log("[MockGrackle] deleteTask",q),_(ee=>ee.filter(ie=>ie.id!==q))},[]),Or=y.useCallback(q=>{console.log("[MockGrackle] loadFindings",q),T(_0.filter(ee=>ee.workspaceId===q))},[]),fo=y.useCallback((q,ee,ie,ce,ue)=>{console.log("[MockGrackle] postFinding",{workspaceId:q,title:ee});const Pe={id:fe("find"),workspaceId:q,taskId:"",sessionId:"",category:ce||"general",title:ee,content:ie,tags:ue||[],createdAt:new Date().toISOString()};T(ye=>[...ye,Pe])},[fe]),Ir=y.useCallback(()=>{console.log("[MockGrackle] loadEnvironments")},[]),Br=y.useCallback((q,ee,ie)=>{console.log("[MockGrackle] addEnvironment",{displayName:q,adapterType:ee,adapterConfig:ie})},[]),Us=y.useCallback((q,ee)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:q,...ee}),i(ie=>ie.map(ce=>ce.id!==q?ce:{...ce,...ee.displayName!==void 0?{displayName:ee.displayName}:{},...ee.adapterConfig!==void 0?{adapterConfig:JSON.stringify(ee.adapterConfig)}:{}}))},[]),Jt=y.useCallback(()=>{console.log("[MockGrackle] loadTokens")},[]),Vn=y.useCallback((q,ee,ie,ce,ue)=>{console.log("[MockGrackle] setToken",{name:q,tokenType:ie}),j(Pe=>[...Pe.filter(Re=>Re.name!==q),{name:q,tokenType:ie,envVar:ce,filePath:ue,expiresAt:""}])},[]),Wt=y.useCallback(q=>{console.log("[MockGrackle] deleteToken",q),j(ee=>ee.filter(ie=>ie.name!==q))},[]),Lr=y.useCallback(q=>{console.log("[MockGrackle] updateCredentialProviders",q),C(q)},[]);y.useEffect(()=>()=>{$e.current.forEach(clearTimeout),$e.current.clear()},[]);const Hc=y.useMemo(()=>({connected:!0,send:()=>{},environments:s,sessions:o,events:u,eventsDropped:0,lastSpawnedId:m,workspaces:g,tasks:b,findings:S,tokens:N,credentialProviders:w,spawn:Ct,sendInput:Je,kill:It,stopGraceful:it,refresh:Yn,loadSessionEvents:Bs,clearEvents:Tn,loadWorkspaces:()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:zn,archiveWorkspace:Jn,updateWorkspace:(q,ee)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:q,...ee}),v(ie=>ie.map(ce=>ce.id!==q?ce:{...ce,...ee.name!==void 0?{name:ee.name}:{},...ee.description!==void 0?{description:ee.description}:{},...ee.repoUrl!==void 0?{repoUrl:ee.repoUrl}:{},...ee.environmentId!==void 0?{environmentId:ee.environmentId}:{},...ee.workingDirectory!==void 0?{workingDirectory:ee.workingDirectory}:{},...ee.useWorktrees!==void 0?{useWorktrees:ee.useWorktrees}:{},...ee.defaultPersonaId!==void 0?{defaultPersonaId:ee.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},loadTasks:Ls,loadAllTasks:()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Pn,startTask:De,stopTask:q=>{console.log("[MockGrackle] stopTask",{taskId:q}),lo(q)},completeTask:lo,resumeTask:co,updateTask:uo,deleteTask:_a,loadFindings:Or,postFinding:fo,loadEnvironments:Ir,addEnvironment:Br,updateEnvironment:Us,loadTokens:Jt,setToken:Vn,deleteToken:Wt,updateCredentialProviders:Lr,provisionStatus:{},provisionEnvironment:(q,ee)=>{},stopEnvironment:()=>{},removeEnvironment:()=>{},codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:()=>{},createCodespace:()=>{},workspaceCreating:!1,taskStartingId:void 0,personas:A,createPersona:async(q,ee,ie,ce,ue,Pe,ye,Re,Fe)=>{console.log("[MockGrackle] createPersona",{name:q});const tt={id:`mock-persona-${Date.now()}`,name:q,description:ee,systemPrompt:ie,toolConfig:"{}",runtime:ce??"claude-code",model:ue||"",maxTurns:Pe||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:ye||"agent",script:Re||"",allowedMcpTools:Fe||[]};return M(Ve=>[...Ve,tt]),tt},updatePersona:async(q,ee,ie,ce,ue,Pe,ye,Re,Fe,tt)=>{console.log("[MockGrackle] updatePersona",{personaId:q,name:ee});const Ve=A.find(kt=>kt.id===q);if(!Ve)throw new Error(`Persona not found: ${q}`);const Vt=new Date().toISOString(),Ht={...Ve,...ee!==void 0?{name:ee}:{},...ie!==void 0?{description:ie}:{},...ce!==void 0?{systemPrompt:ce}:{},...ue!==void 0?{runtime:ue}:{},...Pe!==void 0?{model:Pe}:{},...ye!==void 0?{maxTurns:ye}:{},...Re!==void 0?{type:Re}:{},...Fe!==void 0?{script:Fe}:{},...tt!==void 0?{allowedMcpTools:tt}:{},updatedAt:Vt};return M(kt=>kt.map(ls=>ls.id===q?Ht:ls)),Ht},deletePersona:async q=>{console.log("[MockGrackle] deletePersona",q),M(ee=>ee.filter(ie=>ie.id!==q))},taskSessions:D,loadTaskSessions:q=>{console.log("[MockGrackle] loadTaskSessions",q)},appDefaultPersonaId:E,setAppDefaultPersonaId:async q=>{console.log("[MockGrackle] setAppDefaultPersonaId",q),H(q)},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:(q,ee)=>{console.log(`[MockGrackle] loadUsage(${q}, ${ee})`)},knowledge:{graphData:{nodes:z,links:F},selectedNode:ae,loading:!1,selectedId:oe,searchQuery:B,search:q=>{if(console.log("[MockGrackle] knowledge.search",q),!q.trim()){$(q);return}$(q);const ee=te.current,ie=ee?ns.filter(ye=>!ye.workspaceId||ye.workspaceId===ee):ns,ce=q.toLowerCase(),ue=ie.filter(ye=>{var Re,Fe,tt;return ye.label.toLowerCase().includes(ce)||((Re=ye.content)==null?void 0:Re.toLowerCase().includes(ce))||((Fe=ye.tags)==null?void 0:Fe.some(Ve=>Ve.toLowerCase().includes(ce)))||((tt=ye.category)==null?void 0:tt.toLowerCase().includes(ce))});Z(ue);const Pe=new Set(ue.map(ye=>ye.id));Q(ca.filter(ye=>Pe.has(ye.source)&&Pe.has(ye.target))),X(void 0),pe(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),$("");const q=te.current,ee=q?ns.filter(ce=>!ce.workspaceId||ce.workspaceId===q):ns;Z(ee);const ie=new Set(ee.map(ce=>ce.id));Q(ca.filter(ce=>ie.has(ce.source)&&ie.has(ce.target)))},selectNode:q=>{console.log("[MockGrackle] knowledge.selectNode",q),X(q);const ee=q in b0?b0[q]:void 0;if(ee)pe(ee);else{const ie=ns.find(ce=>ce.id===q);if(ie){const ce=ca.filter(ue=>ue.source===q||ue.target===q).map(ue=>({fromId:ue.source,toId:ue.target,type:ue.type}));pe({node:ie,edges:ce})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),X(void 0),pe(void 0)},expandNode:q=>{console.log("[MockGrackle] knowledge.expandNode",q),Z(ee=>{const ie=new Set(ee.map(Re=>Re.id)),ce=ca.filter(Re=>Re.source===q||Re.target===q),ue=new Set;for(const Re of ce)ie.has(Re.source)||ue.add(Re.source),ie.has(Re.target)||ue.add(Re.target);if(ue.size===0)return ee;const Pe=ns.filter(Re=>ue.has(Re.id)),ye=new Set([...ie,...ue]);return Q(Re=>{const Fe=new Set(Re.map(Ve=>`${Ve.source}|${Ve.target}|${Ve.type}`)),tt=ca.filter(Ve=>ye.has(Ve.source)&&ye.has(Ve.target)&&!Fe.has(`${Ve.source}|${Ve.target}|${Ve.type}`));return tt.length>0?[...Re,...tt]:Re}),[...ee,...Pe]})},loadRecent:q=>{if(console.log("[MockGrackle] knowledge.loadRecent",q),te.current=q,q){const ee=ns.filter(ce=>!ce.workspaceId||ce.workspaceId===q);Z(ee);const ie=new Set(ee.map(ce=>ce.id));Q(ca.filter(ce=>ie.has(ce.source)&&ie.has(ce.target)))}else Z(ns),Q(ca);$("")},handleEvent:()=>!1}}),[s,o,u,m,g,b,S,N,w,A,D,E,z,F,ae,oe,B,Ct,Je,It,it,Yn,Bs,Tn,zn,Jn,Ls,Pn,De,lo,co,uo,_a,Or,fo,Ir,Br,Us,Jt,Vn,Wt,Lr]);return l.jsx(_p.Provider,{value:Hc,children:n})}const Bb=y.createContext(void 0),W2=4e3;function X2({children:n}){const[s,i]=y.useState([]),o=y.useRef(0),c=y.useCallback(d=>{i(m=>m.filter(h=>h.id!==d))},[]),u=y.useCallback((d,m="info",h=W2)=>{const g=`toast-${++o.current}`;i(v=>[...v,{id:g,message:d,variant:m,duration:h}])},[]);return l.jsx(Bb.Provider,{value:{toasts:s,showToast:u,dismissToast:c},children:n})}function dn(){const n=y.useContext(Bb);if(!n)throw new Error("useToast must be used within ToastProvider");return n}const Oc=[{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"]}],Lb=new Set(Oc.map(n=>n.id)),T0="grackle";function Pf(n){return Oc.find(s=>s.id===n)}const Vf="grackle-theme",Ub="grackle-prefer-system",zb="(prefers-color-scheme: dark)";let cr=[],fc;function uf(){fc=void 0;for(const n of cr)n()}function Hf(){return typeof window>"u"?!1:window.matchMedia(zb).matches}function mr(){if(typeof localStorage>"u")return T0;try{const n=localStorage.getItem(Vf);if(n!==null&&Lb.has(n))return n}catch{}return T0}function yc(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(Ub)==="true"}catch{return!1}}function qf(n){return Oc.find(s=>s.variantLightId===n||s.variantDarkId===n)}function Pb(n,s){const i=Pf(n);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?Hf()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const o=qf(n);if(o!=null&&o.variantLightId&&o.variantDarkId)return Hf()?o.variantDarkId:o.variantLightId}return n}function qi(n,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=Pb(n,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&qi(mr(),yc());function Q2(){return fc===void 0&&(fc={themeId:mr(),systemDark:Hf(),preferSystem:yc()}),fc}function ew(n){return cr=[...cr,n],()=>{cr=cr.filter(s=>s!==n)}}function tw(){const n=y.useSyncExternalStore(ew,Q2),{themeId:s,preferSystem:i}=n,o=Pb(s,i),c=y.useCallback(d=>{if(Lb.has(d)){try{localStorage.setItem(Vf,d)}catch{}qi(d,yc(),!0),uf()}},[]),u=y.useCallback(d=>{try{localStorage.setItem(Ub,d?"true":"false")}catch{}if(d){const m=mr(),h=Pf(m);if(h!=null&&h.hidden){const g=qf(m);if(g)try{localStorage.setItem(Vf,g.id)}catch{}}}qi(mr(),d,!0),uf()},[]);return y.useEffect(()=>{qi(s,i)},[s,i]),y.useEffect(()=>{if(typeof window>"u")return;const d=window.matchMedia(zb),m=()=>{const h=mr(),g=yc();if(g){const v=Pf(h);if(v!=null&&v.variantDarkId&&v.variantLightId&&qi(h,g),v!=null&&v.hidden){const b=qf(h);b!=null&&b.variantDarkId&&b.variantLightId&&qi(h,g)}}uf()};return d.addEventListener("change",m),()=>{d.removeEventListener("change",m)}},[]),{themeId:s,setTheme:c,resolvedThemeId:o,preferSystem:i,setPreferSystem:u}}const Vb=y.createContext(void 0);function nw({children:n}){const s=tw();return l.jsx(Vb.Provider,{value:s,children:n})}function Hb(){const n=y.useContext(Vb);if(!n)throw new Error("useThemeContext must be used within ThemeProvider");return n}const sw="_container_1mq5u_1",aw="_hamburger_1mq5u_33",iw="_brand_1mq5u_49",ow="_brandLogo_1mq5u_68",rw="_info_1mq5u_75",lw="_connectionLabel_1mq5u_90",cw="_connectionDot_1mq5u_103",uw="_connected_1mq5u_106",dw="_disconnected_1mq5u_110",js={container:sw,hamburger:aw,brand:iw,brandLogo:ow,info:rw,connectionLabel:lw,connectionDot:cw,connected:uw,disconnected:dw};function fw({connected:n,environments:s,sessions:i,onToggleSidebar:o,sidebarOpen:c}){const u=St(),d=s.length,m=s.filter(g=>g.status==="connected").length,h=i.filter(g=>["running","idle"].includes(g.status)).length;return l.jsxs("div",{className:js.container,children:[o&&l.jsx("button",{type:"button",className:js.hamburger,onClick:o,"aria-label":"Toggle sidebar","aria-expanded":c,children:"☰"}),l.jsxs("button",{type:"button",className:js.brand,onClick:()=>u(Ya),title:"Home",children:[l.jsx("img",{src:"/icon-192x192.png",alt:"",className:js.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]}),l.jsxs("div",{className:js.info,children:[l.jsxs("span",{"aria-label":n?"Connected":"Disconnected",children:[l.jsx("span",{className:`${js.connectionDot} ${n?js.connected:js.disconnected}`,"aria-hidden":"true",children:"●"})," ",l.jsx("span",{className:js.connectionLabel,"aria-hidden":"true",children:n?"Connected":"Disconnected"})]}),l.jsxs("span",{children:[m,"/",d," env",d!==1?"s":""]}),l.jsxs("span",{children:[h," active"]})]})]})}const pw="_nav_13gkc_1",mw="_tab_13gkc_35",hw="_tabIcon_13gkc_68",gw="_tabLabel_13gkc_79",vw="_tabActive_13gkc_84",ir={nav:pw,tab:mw,tabIcon:hw,tabLabel:gw,tabActive:vw},za=[{view:"dashboard",label:"Dashboard",icon:"🏠",route:Ya,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:"💬",route:f2,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:"📋",route:p2,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:"🖥️",route:Xi,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:"🧠",route:Db,testId:"sidebar-tab-knowledge"},{view:"settings",label:"Settings",icon:"⚙️",route:l2,testId:"sidebar-tab-settings"}];function yw(n){return n===Ya||n==="/"?"dashboard":n.startsWith("/chat")||n.startsWith("/sessions")?"chat":n.startsWith("/workspaces")||n.startsWith("/environments")?"environments":n.startsWith(Db)?"knowledge":n.startsWith(Ji)?"settings":"tasks"}function bw(){const n=Lt(),s=St(),i=y.useRef(null),o=yw(n.pathname),c=y.useCallback(d=>{s(d.route)},[s]),u=y.useCallback(d=>{var b,_;const m=(b=i.current)==null?void 0:b.querySelectorAll('[role="tab"]');if(!m)return;const h=Array.from(m).findIndex(S=>S===document.activeElement),g=h>=0?h:za.findIndex(S=>S.view===o);let v=g;if(d.key==="ArrowRight"||d.key==="j"||d.key==="J")d.preventDefault(),v=(g+1)%za.length;else if(d.key==="ArrowLeft"||d.key==="k"||d.key==="K")d.preventDefault(),v=(g-1+za.length)%za.length;else if(d.key==="Home")d.preventDefault(),v=0;else if(d.key==="End")d.preventDefault(),v=za.length-1;else return;s(za[v].route),(_=m[v])==null||_.focus()},[o,s]);return l.jsx("nav",{className:ir.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:u,"data-testid":"sidebar-nav",children:za.map(d=>{const m=d.view===o;return l.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${ir.tab} ${m?ir.tabActive:""}`,onClick:()=>c(d),"data-testid":d.testId,title:d.label,"aria-label":d.label,children:[l.jsx("span",{className:ir.tabIcon,"aria-hidden":"true",children:d.icon}),l.jsx("span",{className:ir.tabLabel,children:d.label})]},d.view)})})}const _w="_container_pi6ii_1",xw="_content_pi6ii_66",k0={container:_w,content:xw},Sw=320,qb=220,Gb=600,$b="grackle-sidebar-width";function Tw(){try{const n=localStorage.getItem($b);if(n!==null){const s=Number(n);if(Number.isFinite(s)&&s>=qb&&s<=Gb)return s}}catch{}return Sw}function kw(n){try{localStorage.setItem($b,String(n))}catch{}}function ww({content:n}){const[s]=y.useState(Tw),i=y.useRef(null);if(y.useEffect(()=>{const o=i.current;if(!o)return;const c=new ResizeObserver(u=>{for(const d of u){const m=d.borderBoxSize[0];if(m){const h=Math.round(m.inlineSize);h>=qb&&h<=Gb&&kw(h)}}});return c.observe(o),()=>{c.disconnect()}},[]),n!==void 0)return l.jsx("div",{className:k0.container,ref:i,"data-testid":"sidebar",style:{width:s},children:l.jsx("div",{className:k0.content,children:n})})}const Fb=y.createContext(void 0),Zb=y.createContext(void 0);function Nw({children:n}){const[s,i]=y.useState(void 0),o=y.useCallback(c=>{i(c)},[]);return l.jsx(Zb.Provider,{value:o,children:l.jsx(Fb.Provider,{value:s,children:n})})}function jw(){return y.useContext(Fb)}function Cw(){const n=y.useContext(Zb);if(n===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return n}function Ic(n){const s=Cw();y.useLayoutEffect(()=>(s(n),()=>{s(void 0)}),[n,s])}const xp=y.createContext({});function Sp(n){const s=y.useRef(null);return s.current===null&&(s.current=n()),s.current}const Bc=y.createContext(null),Tp=y.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});class Ew extends y.Component{getSnapshotBeforeUpdate(s){const i=this.props.childRef.current;if(i&&s.isPresent&&!this.props.isPresent){const o=this.props.sizeRef.current;o.height=i.offsetHeight||0,o.width=i.offsetWidth||0,o.top=i.offsetTop,o.left=i.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Aw({children:n,isPresent:s}){const i=y.useId(),o=y.useRef(null),c=y.useRef({width:0,height:0,top:0,left:0}),{nonce:u}=y.useContext(Tp);return y.useInsertionEffect(()=>{const{width:d,height:m,top:h,left:g}=c.current;if(s||!o.current||!d||!m)return;o.current.dataset.motionPopId=i;const v=document.createElement("style");return u&&(v.nonce=u),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
|
|
465
|
-
[data-motion-pop-id="${i}"] {
|
|
466
|
-
position: absolute !important;
|
|
467
|
-
width: ${d}px !important;
|
|
468
|
-
height: ${m}px !important;
|
|
469
|
-
top: ${h}px !important;
|
|
470
|
-
left: ${g}px !important;
|
|
471
|
-
}
|
|
472
|
-
`),()=>{document.head.removeChild(v)}},[s]),l.jsx(Ew,{isPresent:s,childRef:o,sizeRef:c,children:y.cloneElement(n,{ref:o})})}const Dw=({children:n,initial:s,isPresent:i,onExitComplete:o,custom:c,presenceAffectsLayout:u,mode:d})=>{const m=Sp(Rw),h=y.useId(),g=y.useCallback(b=>{m.set(b,!0);for(const _ of m.values())if(!_)return;o&&o()},[m,o]),v=y.useMemo(()=>({id:h,initial:s,isPresent:i,custom:c,onExitComplete:g,register:b=>(m.set(b,!1),()=>m.delete(b))}),u?[Math.random(),g]:[i,g]);return y.useMemo(()=>{m.forEach((b,_)=>m.set(_,!1))},[i]),y.useEffect(()=>{!i&&!m.size&&o&&o()},[i]),d==="popLayout"&&(n=l.jsx(Aw,{isPresent:i,children:n})),l.jsx(Bc.Provider,{value:v,children:n})};function Rw(){return new Map}function Kb(n=!0){const s=y.useContext(Bc);if(s===null)return[!0,null];const{isPresent:i,onExitComplete:o,register:c}=s,u=y.useId();y.useEffect(()=>{n&&c(u)},[n]);const d=y.useCallback(()=>n&&o&&o(u),[u,o,n]);return!i&&o?[!1,d]:[!0]}const tc=n=>n.key||"";function w0(n){const s=[];return y.Children.forEach(n,i=>{y.isValidElement(i)&&s.push(i)}),s}const kp=typeof window<"u",Yb=kp?y.useLayoutEffect:y.useEffect,rs=({children:n,custom:s,initial:i=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:u="sync",propagate:d=!1})=>{const[m,h]=Kb(d),g=y.useMemo(()=>w0(n),[n]),v=d&&!m?[]:g.map(tc),b=y.useRef(!0),_=y.useRef(g),S=Sp(()=>new Map),[T,N]=y.useState(g),[j,w]=y.useState(g);Yb(()=>{b.current=!1,_.current=g;for(let M=0;M<j.length;M++){const D=tc(j[M]);v.includes(D)?S.delete(D):S.get(D)!==!0&&S.set(D,!1)}},[j,v.length,v.join("-")]);const C=[];if(g!==T){let M=[...g];for(let D=0;D<j.length;D++){const E=j[D],H=tc(E);v.includes(H)||(M.splice(D,0,E),C.push(E))}u==="wait"&&C.length&&(M=C),w(w0(M)),N(g);return}const{forceRender:A}=y.useContext(xp);return l.jsx(l.Fragment,{children:j.map(M=>{const D=tc(M),E=d&&!m?!1:g===j||v.includes(D),H=()=>{if(S.has(D))S.set(D,!0);else return;let z=!0;S.forEach(Z=>{Z||(z=!1)}),z&&(A==null||A(),w(_.current),d&&(h==null||h()),o&&o())};return l.jsx(Dw,{isPresent:E,initial:!b.current||i?void 0:!1,custom:E?void 0:s,presenceAffectsLayout:c,mode:u,onExitComplete:E?void 0:H,children:M},D)})})},_n=n=>n;let Jb=_n;const Mw={useManualTiming:!1};function Ow(n){let s=new Set,i=new Set,o=!1,c=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function m(g){u.has(g)&&(h.schedule(g),n()),g(d)}const h={schedule:(g,v=!1,b=!1)=>{const S=b&&o?s:i;return v&&u.add(g),S.has(g)||S.add(g),g},cancel:g=>{i.delete(g),u.delete(g)},process:g=>{if(d=g,o){c=!0;return}o=!0,[s,i]=[i,s],s.forEach(m),s.clear(),o=!1,c&&(c=!1,h.process(g))}};return h}const nc=["read","resolveKeyframes","update","preRender","render","postRender"],Iw=40;function Wb(n,s){let i=!1,o=!0;const c={delta:0,timestamp:0,isProcessing:!1},u=()=>i=!0,d=nc.reduce((w,C)=>(w[C]=Ow(u),w),{}),{read:m,resolveKeyframes:h,update:g,preRender:v,render:b,postRender:_}=d,S=()=>{const w=performance.now();i=!1,c.delta=o?1e3/60:Math.max(Math.min(w-c.timestamp,Iw),1),c.timestamp=w,c.isProcessing=!0,m.process(c),h.process(c),g.process(c),v.process(c),b.process(c),_.process(c),c.isProcessing=!1,i&&s&&(o=!1,n(S))},T=()=>{i=!0,o=!0,c.isProcessing||n(S)};return{schedule:nc.reduce((w,C)=>{const A=d[C];return w[C]=(M,D=!1,E=!1)=>(i||T(),A.schedule(M,D,E)),w},{}),cancel:w=>{for(let C=0;C<nc.length;C++)d[nc[C]].cancel(w)},state:c,steps:d}}const{schedule:ft,cancel:ma,state:Kt,steps:df}=Wb(typeof requestAnimationFrame<"u"?requestAnimationFrame:_n,!0),Xb=y.createContext({strict:!1}),N0={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"]},eo={};for(const n in N0)eo[n]={isEnabled:s=>N0[n].some(i=>!!s[i])};function Bw(n){for(const s in n)eo[s]={...eo[s],...n[s]}}const Lw=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 bc(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||Lw.has(n)}let Qb=n=>!bc(n);function Uw(n){n&&(Qb=s=>s.startsWith("on")?!bc(s):n(s))}try{Uw(require("@emotion/is-prop-valid").default)}catch{}function zw(n,s,i){const o={};for(const c in n)c==="values"&&typeof n.values=="object"||(Qb(c)||i===!0&&bc(c)||!s&&!bc(c)||n.draggable&&c.startsWith("onDrag"))&&(o[c]=n[c]);return o}function Pw(n){if(typeof Proxy>"u")return n;const s=new Map,i=(...o)=>n(...o);return new Proxy(i,{get:(o,c)=>c==="create"?n:(s.has(c)||s.set(c,n(c)),s.get(c))})}const Lc=y.createContext({});function Sr(n){return typeof n=="string"||Array.isArray(n)}function Uc(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const wp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Np=["initial",...wp];function zc(n){return Uc(n.animate)||Np.some(s=>Sr(n[s]))}function e_(n){return!!(zc(n)||n.variants)}function Vw(n,s){if(zc(n)){const{initial:i,animate:o}=n;return{initial:i===!1||Sr(i)?i:void 0,animate:Sr(o)?o:void 0}}return n.inherit!==!1?s:{}}function Hw(n){const{initial:s,animate:i}=Vw(n,y.useContext(Lc));return y.useMemo(()=>({initial:s,animate:i}),[j0(s),j0(i)])}function j0(n){return Array.isArray(n)?n.join(" "):n}const qw=Symbol.for("motionComponentSymbol");function Gi(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function Gw(n,s,i){return y.useCallback(o=>{o&&n.onMount&&n.onMount(o),s&&(o?s.mount(o):s.unmount()),i&&(typeof i=="function"?i(o):Gi(i)&&(i.current=o))},[s])}const jp=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),$w="framerAppearId",t_="data-"+jp($w),{schedule:Cp}=Wb(queueMicrotask,!1),n_=y.createContext({});function Fw(n,s,i,o,c){var u,d;const{visualElement:m}=y.useContext(Lc),h=y.useContext(Xb),g=y.useContext(Bc),v=y.useContext(Tp).reducedMotion,b=y.useRef(null);o=o||h.renderer,!b.current&&o&&(b.current=o(n,{visualState:s,parent:m,props:i,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const _=b.current,S=y.useContext(n_);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&Zw(b.current,i,c,S);const T=y.useRef(!1);y.useInsertionEffect(()=>{_&&T.current&&_.update(i,g)});const N=i[t_],j=y.useRef(!!N&&!(!((u=window.MotionHandoffIsComplete)===null||u===void 0)&&u.call(window,N))&&((d=window.MotionHasOptimisedAnimation)===null||d===void 0?void 0:d.call(window,N)));return Yb(()=>{_&&(T.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),Cp.render(_.render),j.current&&_.animationState&&_.animationState.animateChanges())}),y.useEffect(()=>{_&&(!j.current&&_.animationState&&_.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{var w;(w=window.MotionHandoffMarkAsComplete)===null||w===void 0||w.call(window,N)}),j.current=!1))}),_}function Zw(n,s,i,o){const{layoutId:c,layout:u,drag:d,dragConstraints:m,layoutScroll:h,layoutRoot:g}=s;n.projection=new i(n.latestValues,s["data-framer-portal-id"]?void 0:s_(n.parent)),n.projection.setOptions({layoutId:c,layout:u,alwaysMeasureLayout:!!d||m&&Gi(m),visualElement:n,animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:h,layoutRoot:g})}function s_(n){if(n)return n.options.allowProjection!==!1?n.projection:s_(n.parent)}function Kw({preloadedFeatures:n,createVisualElement:s,useRender:i,useVisualState:o,Component:c}){var u,d;n&&Bw(n);function m(g,v){let b;const _={...y.useContext(Tp),...g,layoutId:Yw(g)},{isStatic:S}=_,T=Hw(g),N=o(g,S);if(!S&&kp){Jw();const j=Ww(_);b=j.MeasureLayout,T.visualElement=Fw(c,N,_,s,j.ProjectionNode)}return l.jsxs(Lc.Provider,{value:T,children:[b&&T.visualElement?l.jsx(b,{visualElement:T.visualElement,..._}):null,i(c,g,Gw(N,T.visualElement,v),N,S,T.visualElement)]})}m.displayName=`motion.${typeof c=="string"?c:`create(${(d=(u=c.displayName)!==null&&u!==void 0?u:c.name)!==null&&d!==void 0?d:""})`}`;const h=y.forwardRef(m);return h[qw]=c,h}function Yw({layoutId:n}){const s=y.useContext(xp).id;return s&&n!==void 0?s+"-"+n:n}function Jw(n,s){y.useContext(Xb).strict}function Ww(n){const{drag:s,layout:i}=eo;if(!s&&!i)return{};const o={...s,...i};return{MeasureLayout:s!=null&&s.isEnabled(n)||i!=null&&i.isEnabled(n)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}const Xw=["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 Ep(n){return typeof n!="string"||n.includes("-")?!1:!!(Xw.indexOf(n)>-1||/[A-Z]/u.test(n))}function C0(n){const s=[{},{}];return n==null||n.values.forEach((i,o)=>{s[0][o]=i.get(),s[1][o]=i.getVelocity()}),s}function Ap(n,s,i,o){if(typeof s=="function"){const[c,u]=C0(o);s=s(i!==void 0?i:n.custom,c,u)}if(typeof s=="string"&&(s=n.variants&&n.variants[s]),typeof s=="function"){const[c,u]=C0(o);s=s(i!==void 0?i:n.custom,c,u)}return s}const Gf=n=>Array.isArray(n),Qw=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),eN=n=>Gf(n)?n[n.length-1]||0:n,Qt=n=>!!(n&&n.getVelocity);function pc(n){const s=Qt(n)?n.get():n;return Qw(s)?s.toValue():s}function tN({scrapeMotionValuesFromProps:n,createRenderState:s,onUpdate:i},o,c,u){const d={latestValues:nN(o,c,u,n),renderState:s()};return i&&(d.onMount=m=>i({props:o,current:m,...d}),d.onUpdate=m=>i(m)),d}const a_=n=>(s,i)=>{const o=y.useContext(Lc),c=y.useContext(Bc),u=()=>tN(n,s,o,c);return i?u():Sp(u)};function nN(n,s,i,o){const c={},u=o(n,{});for(const _ in u)c[_]=pc(u[_]);let{initial:d,animate:m}=n;const h=zc(n),g=e_(n);s&&g&&!h&&n.inherit!==!1&&(d===void 0&&(d=s.initial),m===void 0&&(m=s.animate));let v=i?i.initial===!1:!1;v=v||d===!1;const b=v?m:d;if(b&&typeof b!="boolean"&&!Uc(b)){const _=Array.isArray(b)?b:[b];for(let S=0;S<_.length;S++){const T=Ap(n,_[S]);if(T){const{transitionEnd:N,transition:j,...w}=T;for(const C in w){let A=w[C];if(Array.isArray(A)){const M=v?A.length-1:0;A=A[M]}A!==null&&(c[C]=A)}for(const C in N)c[C]=N[C]}}}return c}const oo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ti=new Set(oo),i_=n=>s=>typeof s=="string"&&s.startsWith(n),o_=i_("--"),sN=i_("var(--"),Dp=n=>sN(n)?aN.test(n.split("/*")[0].trim()):!1,aN=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,r_=(n,s)=>s&&typeof n=="number"?s.transform(n):n,Is=(n,s,i)=>i>s?s:i<n?n:i,ro={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},Tr={...ro,transform:n=>Is(0,1,n)},sc={...ro,default:1},Ar=n=>({test:s=>typeof s=="string"&&s.endsWith(n)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${n}`}),pa=Ar("deg"),as=Ar("%"),Te=Ar("px"),iN=Ar("vh"),oN=Ar("vw"),E0={...as,parse:n=>as.parse(n)/100,transform:n=>as.transform(n*100)},rN={borderWidth:Te,borderTopWidth:Te,borderRightWidth:Te,borderBottomWidth:Te,borderLeftWidth:Te,borderRadius:Te,radius:Te,borderTopLeftRadius:Te,borderTopRightRadius:Te,borderBottomRightRadius:Te,borderBottomLeftRadius:Te,width:Te,maxWidth:Te,height:Te,maxHeight:Te,top:Te,right:Te,bottom:Te,left:Te,padding:Te,paddingTop:Te,paddingRight:Te,paddingBottom:Te,paddingLeft:Te,margin:Te,marginTop:Te,marginRight:Te,marginBottom:Te,marginLeft:Te,backgroundPositionX:Te,backgroundPositionY:Te},lN={rotate:pa,rotateX:pa,rotateY:pa,rotateZ:pa,scale:sc,scaleX:sc,scaleY:sc,scaleZ:sc,skew:pa,skewX:pa,skewY:pa,distance:Te,translateX:Te,translateY:Te,translateZ:Te,x:Te,y:Te,z:Te,perspective:Te,transformPerspective:Te,opacity:Tr,originX:E0,originY:E0,originZ:Te},A0={...ro,transform:Math.round},Rp={...rN,...lN,zIndex:A0,size:Te,fillOpacity:Tr,strokeOpacity:Tr,numOctaves:A0},cN={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},uN=oo.length;function dN(n,s,i){let o="",c=!0;for(let u=0;u<uN;u++){const d=oo[u],m=n[d];if(m===void 0)continue;let h=!0;if(typeof m=="number"?h=m===(d.startsWith("scale")?1:0):h=parseFloat(m)===0,!h||i){const g=r_(m,Rp[d]);if(!h){c=!1;const v=cN[d]||d;o+=`${v}(${g}) `}i&&(s[d]=g)}}return o=o.trim(),i?o=i(s,c?"":o):c&&(o="none"),o}function Mp(n,s,i){const{style:o,vars:c,transformOrigin:u}=n;let d=!1,m=!1;for(const h in s){const g=s[h];if(ti.has(h)){d=!0;continue}else if(o_(h)){c[h]=g;continue}else{const v=r_(g,Rp[h]);h.startsWith("origin")?(m=!0,u[h]=v):o[h]=v}}if(s.transform||(d||i?o.transform=dN(s,n.transform,i):o.transform&&(o.transform="none")),m){const{originX:h="50%",originY:g="50%",originZ:v=0}=u;o.transformOrigin=`${h} ${g} ${v}`}}const fN={offset:"stroke-dashoffset",array:"stroke-dasharray"},pN={offset:"strokeDashoffset",array:"strokeDasharray"};function mN(n,s,i=1,o=0,c=!0){n.pathLength=1;const u=c?fN:pN;n[u.offset]=Te.transform(-o);const d=Te.transform(s),m=Te.transform(i);n[u.array]=`${d} ${m}`}function D0(n,s,i){return typeof n=="string"?n:Te.transform(s+i*n)}function hN(n,s,i){const o=D0(s,n.x,n.width),c=D0(i,n.y,n.height);return`${o} ${c}`}function Op(n,{attrX:s,attrY:i,attrScale:o,originX:c,originY:u,pathLength:d,pathSpacing:m=1,pathOffset:h=0,...g},v,b){if(Mp(n,g,b),v){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:_,style:S,dimensions:T}=n;_.transform&&(T&&(S.transform=_.transform),delete _.transform),T&&(c!==void 0||u!==void 0||S.transform)&&(S.transformOrigin=hN(T,c!==void 0?c:.5,u!==void 0?u:.5)),s!==void 0&&(_.x=s),i!==void 0&&(_.y=i),o!==void 0&&(_.scale=o),d!==void 0&&mN(_,d,m,h,!1)}const Ip=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),l_=()=>({...Ip(),attrs:{}}),Bp=n=>typeof n=="string"&&n.toLowerCase()==="svg";function c_(n,{style:s,vars:i},o,c){Object.assign(n.style,s,c&&c.getProjectionStyles(o));for(const u in i)n.style.setProperty(u,i[u])}const u_=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 d_(n,s,i,o){c_(n,s,void 0,o);for(const c in s.attrs)n.setAttribute(u_.has(c)?c:jp(c),s.attrs[c])}const _c={};function gN(n){Object.assign(_c,n)}function f_(n,{layout:s,layoutId:i}){return ti.has(n)||n.startsWith("origin")||(s||i!==void 0)&&(!!_c[n]||n==="opacity")}function Lp(n,s,i){var o;const{style:c}=n,u={};for(const d in c)(Qt(c[d])||s.style&&Qt(s.style[d])||f_(d,n)||((o=i==null?void 0:i.getValue(d))===null||o===void 0?void 0:o.liveStyle)!==void 0)&&(u[d]=c[d]);return u}function p_(n,s,i){const o=Lp(n,s,i);for(const c in n)if(Qt(n[c])||Qt(s[c])){const u=oo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;o[u]=n[c]}return o}function vN(n,s){try{s.dimensions=typeof n.getBBox=="function"?n.getBBox():n.getBoundingClientRect()}catch{s.dimensions={x:0,y:0,width:0,height:0}}}const R0=["x","y","width","height","cx","cy","r"],yN={useVisualState:a_({scrapeMotionValuesFromProps:p_,createRenderState:l_,onUpdate:({props:n,prevProps:s,current:i,renderState:o,latestValues:c})=>{if(!i)return;let u=!!n.drag;if(!u){for(const m in c)if(ti.has(m)){u=!0;break}}if(!u)return;let d=!s;if(s)for(let m=0;m<R0.length;m++){const h=R0[m];n[h]!==s[h]&&(d=!0)}d&&ft.read(()=>{vN(i,o),ft.render(()=>{Op(o,c,Bp(i.tagName),n.transformTemplate),d_(i,o)})})}})},bN={useVisualState:a_({scrapeMotionValuesFromProps:Lp,createRenderState:Ip})};function m_(n,s,i){for(const o in s)!Qt(s[o])&&!f_(o,i)&&(n[o]=s[o])}function _N({transformTemplate:n},s){return y.useMemo(()=>{const i=Ip();return Mp(i,s,n),Object.assign({},i.vars,i.style)},[s])}function xN(n,s){const i=n.style||{},o={};return m_(o,i,n),Object.assign(o,_N(n,s)),o}function SN(n,s){const i={},o=xN(n,s);return n.drag&&n.dragListener!==!1&&(i.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(i.tabIndex=0),i.style=o,i}function TN(n,s,i,o){const c=y.useMemo(()=>{const u=l_();return Op(u,s,Bp(o),n.transformTemplate),{...u.attrs,style:{...u.style}}},[s]);if(n.style){const u={};m_(u,n.style,n),c.style={...u,...c.style}}return c}function kN(n=!1){return(i,o,c,{latestValues:u},d)=>{const h=(Ep(i)?TN:SN)(o,u,d,i),g=zw(o,typeof i=="string",n),v=i!==y.Fragment?{...g,...h,ref:c}:{},{children:b}=o,_=y.useMemo(()=>Qt(b)?b.get():b,[b]);return y.createElement(i,{...v,children:_})}}function wN(n,s){return function(o,{forwardMotionProps:c}={forwardMotionProps:!1}){const d={...Ep(o)?yN:bN,preloadedFeatures:n,useRender:kN(c),createVisualElement:s,Component:o};return Kw(d)}}function h_(n,s){if(!Array.isArray(s))return!1;const i=s.length;if(i!==n.length)return!1;for(let o=0;o<i;o++)if(s[o]!==n[o])return!1;return!0}function Pc(n,s,i){const o=n.getProps();return Ap(o,s,i!==void 0?i:o.custom,n)}function Up(n,s){return n?n[s]||n.default||n:void 0}const g_=new Set(["width","height","top","left","right","bottom",...oo]);let mc;function NN(){mc=void 0}const is={now:()=>(mc===void 0&&is.set(Kt.isProcessing||Mw.useManualTiming?Kt.timestamp:performance.now()),mc),set:n=>{mc=n,queueMicrotask(NN)}};function zp(n,s){n.indexOf(s)===-1&&n.push(s)}function Pp(n,s){const i=n.indexOf(s);i>-1&&n.splice(i,1)}class Vp{constructor(){this.subscriptions=[]}add(s){return zp(this.subscriptions,s),()=>Pp(this.subscriptions,s)}notify(s,i,o){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,i,o);else for(let u=0;u<c;u++){const d=this.subscriptions[u];d&&d(s,i,o)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function v_(n,s){return s?n*(1e3/s):0}const M0=30,jN=n=>!isNaN(parseFloat(n));class CN{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(o,c=!0)=>{const u=is.now();this.updatedAt!==u&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(o),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=i.owner}setCurrent(s){this.current=s,this.updatedAt=is.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=jN(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 Vp);const o=this.events[s].add(i);return s==="change"?()=>{o(),ft.read(()=>{this.events.change.getSize()||this.stop()})}:o}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,i){this.passiveEffect=s,this.stopPassiveEffect=i}set(s,i=!0){!i||!this.passiveEffect?this.updateAndNotify(s,i):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,i,o){this.set(i),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-o}jump(s,i=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,i&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=is.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>M0)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,M0);return v_(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 kr(n,s){return new CN(n,s)}function EN(n,s,i){n.hasValue(s)?n.getValue(s).set(i):n.addValue(s,kr(i))}function AN(n,s){const i=Pc(n,s);let{transitionEnd:o={},transition:c={},...u}=i||{};u={...u,...o};for(const d in u){const m=eN(u[d]);EN(n,d,m)}}function DN(n){return!!(Qt(n)&&n.add)}function $f(n,s){const i=n.getValue("willChange");if(DN(i))return i.add(s)}function y_(n){return n.props[t_]}function Hp(n){let s;return()=>(s===void 0&&(s=n()),s)}const RN=Hp(()=>window.ScrollTimeline!==void 0);class MN{constructor(s){this.stop=()=>this.runAll("stop"),this.animations=s.filter(Boolean)}get finished(){return Promise.all(this.animations.map(s=>"finished"in s?s.finished:s))}getAll(s){return this.animations[0][s]}setAll(s,i){for(let o=0;o<this.animations.length;o++)this.animations[o][s]=i}attachTimeline(s,i){const o=this.animations.map(c=>{if(RN()&&c.attachTimeline)return c.attachTimeline(s);if(typeof i=="function")return i(c)});return()=>{o.forEach((c,u)=>{c&&c(),this.animations[u].stop()})}}get time(){return this.getAll("time")}set time(s){this.setAll("time",s)}get speed(){return this.getAll("speed")}set speed(s){this.setAll("speed",s)}get startTime(){return this.getAll("startTime")}get duration(){let s=0;for(let i=0;i<this.animations.length;i++)s=Math.max(s,this.animations[i].duration);return s}runAll(s){this.animations.forEach(i=>i[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class ON extends MN{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Ds=n=>n*1e3,Rs=n=>n/1e3;function qp(n){return typeof n=="function"}function O0(n,s){n.timeline=s,n.onfinish=null}const Gp=n=>Array.isArray(n)&&typeof n[0]=="number",IN={linearEasing:void 0};function BN(n,s){const i=Hp(n);return()=>{var o;return(o=IN[s])!==null&&o!==void 0?o:i()}}const xc=BN(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),to=(n,s,i)=>{const o=s-n;return o===0?1:(i-n)/o},b_=(n,s,i=10)=>{let o="";const c=Math.max(Math.round(s/i),2);for(let u=0;u<c;u++)o+=n(to(0,c-1,u))+", ";return`linear(${o.substring(0,o.length-2)})`};function __(n){return!!(typeof n=="function"&&xc()||!n||typeof n=="string"&&(n in Ff||xc())||Gp(n)||Array.isArray(n)&&n.every(__))}const ur=([n,s,i,o])=>`cubic-bezier(${n}, ${s}, ${i}, ${o})`,Ff={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ur([0,.65,.55,1]),circOut:ur([.55,0,1,.45]),backIn:ur([.31,.01,.66,-.59]),backOut:ur([.33,1.53,.69,.99])};function x_(n,s){if(n)return typeof n=="function"&&xc()?b_(n,s):Gp(n)?ur(n):Array.isArray(n)?n.map(i=>x_(i,s)||Ff.easeOut):Ff[n]}const S_=(n,s,i)=>(((1-3*i+3*s)*n+(3*i-6*s))*n+3*s)*n,LN=1e-7,UN=12;function zN(n,s,i,o,c){let u,d,m=0;do d=s+(i-s)/2,u=S_(d,o,c)-n,u>0?i=d:s=d;while(Math.abs(u)>LN&&++m<UN);return d}function Dr(n,s,i,o){if(n===s&&i===o)return _n;const c=u=>zN(u,0,1,n,i);return u=>u===0||u===1?u:S_(c(u),s,o)}const T_=n=>s=>s<=.5?n(2*s)/2:(2-n(2*(1-s)))/2,k_=n=>s=>1-n(1-s),w_=Dr(.33,1.53,.69,.99),$p=k_(w_),N_=T_($p),j_=n=>(n*=2)<1?.5*$p(n):.5*(2-Math.pow(2,-10*(n-1))),Fp=n=>1-Math.sin(Math.acos(n)),C_=k_(Fp),E_=T_(Fp),A_=n=>/^0[^.\s]+$/u.test(n);function PN(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||A_(n):!0}const hr=n=>Math.round(n*1e5)/1e5,Zp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function VN(n){return n==null}const HN=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Kp=(n,s)=>i=>!!(typeof i=="string"&&HN.test(i)&&i.startsWith(n)||s&&!VN(i)&&Object.prototype.hasOwnProperty.call(i,s)),D_=(n,s,i)=>o=>{if(typeof o!="string")return o;const[c,u,d,m]=o.match(Zp);return{[n]:parseFloat(c),[s]:parseFloat(u),[i]:parseFloat(d),alpha:m!==void 0?parseFloat(m):1}},qN=n=>Is(0,255,n),ff={...ro,transform:n=>Math.round(qN(n))},Fa={test:Kp("rgb","red"),parse:D_("red","green","blue"),transform:({red:n,green:s,blue:i,alpha:o=1})=>"rgba("+ff.transform(n)+", "+ff.transform(s)+", "+ff.transform(i)+", "+hr(Tr.transform(o))+")"};function GN(n){let s="",i="",o="",c="";return n.length>5?(s=n.substring(1,3),i=n.substring(3,5),o=n.substring(5,7),c=n.substring(7,9)):(s=n.substring(1,2),i=n.substring(2,3),o=n.substring(3,4),c=n.substring(4,5),s+=s,i+=i,o+=o,c+=c),{red:parseInt(s,16),green:parseInt(i,16),blue:parseInt(o,16),alpha:c?parseInt(c,16)/255:1}}const Zf={test:Kp("#"),parse:GN,transform:Fa.transform},$i={test:Kp("hsl","hue"),parse:D_("hue","saturation","lightness"),transform:({hue:n,saturation:s,lightness:i,alpha:o=1})=>"hsla("+Math.round(n)+", "+as.transform(hr(s))+", "+as.transform(hr(i))+", "+hr(Tr.transform(o))+")"},Xt={test:n=>Fa.test(n)||Zf.test(n)||$i.test(n),parse:n=>Fa.test(n)?Fa.parse(n):$i.test(n)?$i.parse(n):Zf.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Fa.transform(n):$i.transform(n)},$N=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function FN(n){var s,i;return isNaN(n)&&typeof n=="string"&&(((s=n.match(Zp))===null||s===void 0?void 0:s.length)||0)+(((i=n.match($N))===null||i===void 0?void 0:i.length)||0)>0}const R_="number",M_="color",ZN="var",KN="var(",I0="${}",YN=/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 wr(n){const s=n.toString(),i=[],o={color:[],number:[],var:[]},c=[];let u=0;const m=s.replace(YN,h=>(Xt.test(h)?(o.color.push(u),c.push(M_),i.push(Xt.parse(h))):h.startsWith(KN)?(o.var.push(u),c.push(ZN),i.push(h)):(o.number.push(u),c.push(R_),i.push(parseFloat(h))),++u,I0)).split(I0);return{values:i,split:m,indexes:o,types:c}}function O_(n){return wr(n).values}function I_(n){const{split:s,types:i}=wr(n),o=s.length;return c=>{let u="";for(let d=0;d<o;d++)if(u+=s[d],c[d]!==void 0){const m=i[d];m===R_?u+=hr(c[d]):m===M_?u+=Xt.transform(c[d]):u+=c[d]}return u}}const JN=n=>typeof n=="number"?0:n;function WN(n){const s=O_(n);return I_(n)(s.map(JN))}const ha={test:FN,parse:O_,createTransformer:I_,getAnimatableNone:WN},XN=new Set(["brightness","contrast","saturate","opacity"]);function QN(n){const[s,i]=n.slice(0,-1).split("(");if(s==="drop-shadow")return n;const[o]=i.match(Zp)||[];if(!o)return n;const c=i.replace(o,"");let u=XN.has(s)?1:0;return o!==i&&(u*=100),s+"("+u+c+")"}const ej=/\b([a-z-]*)\(.*?\)/gu,Kf={...ha,getAnimatableNone:n=>{const s=n.match(ej);return s?s.map(QN).join(" "):n}},tj={...Rp,color:Xt,backgroundColor:Xt,outlineColor:Xt,fill:Xt,stroke:Xt,borderColor:Xt,borderTopColor:Xt,borderRightColor:Xt,borderBottomColor:Xt,borderLeftColor:Xt,filter:Kf,WebkitFilter:Kf},Yp=n=>tj[n];function B_(n,s){let i=Yp(n);return i!==Kf&&(i=ha),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const nj=new Set(["auto","none","0"]);function sj(n,s,i){let o=0,c;for(;o<n.length&&!c;){const u=n[o];typeof u=="string"&&!nj.has(u)&&wr(u).values.length&&(c=n[o]),o++}if(c&&i)for(const u of s)n[u]=B_(i,c)}const B0=n=>n===ro||n===Te,L0=(n,s)=>parseFloat(n.split(", ")[s]),U0=(n,s)=>(i,{transform:o})=>{if(o==="none"||!o)return 0;const c=o.match(/^matrix3d\((.+)\)$/u);if(c)return L0(c[1],s);{const u=o.match(/^matrix\((.+)\)$/u);return u?L0(u[1],n):0}},aj=new Set(["x","y","z"]),ij=oo.filter(n=>!aj.has(n));function oj(n){const s=[];return ij.forEach(i=>{const o=n.getValue(i);o!==void 0&&(s.push([i,o.get()]),o.set(i.startsWith("scale")?1:0))}),s}const no={width:({x:n},{paddingLeft:s="0",paddingRight:i="0"})=>n.max-n.min-parseFloat(s)-parseFloat(i),height:({y:n},{paddingTop:s="0",paddingBottom:i="0"})=>n.max-n.min-parseFloat(s)-parseFloat(i),top:(n,{top:s})=>parseFloat(s),left:(n,{left:s})=>parseFloat(s),bottom:({y:n},{top:s})=>parseFloat(s)+(n.max-n.min),right:({x:n},{left:s})=>parseFloat(s)+(n.max-n.min),x:U0(4,13),y:U0(5,14)};no.translateX=no.x;no.translateY=no.y;const Ka=new Set;let Yf=!1,Jf=!1;function L_(){if(Jf){const n=Array.from(Ka).filter(o=>o.needsMeasurement),s=new Set(n.map(o=>o.element)),i=new Map;s.forEach(o=>{const c=oj(o);c.length&&(i.set(o,c),o.render())}),n.forEach(o=>o.measureInitialState()),s.forEach(o=>{o.render();const c=i.get(o);c&&c.forEach(([u,d])=>{var m;(m=o.getValue(u))===null||m===void 0||m.set(d)})}),n.forEach(o=>o.measureEndState()),n.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}Jf=!1,Yf=!1,Ka.forEach(n=>n.complete()),Ka.clear()}function U_(){Ka.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(Jf=!0)})}function rj(){U_(),L_()}class Jp{constructor(s,i,o,c,u,d=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=i,this.name=o,this.motionValue=c,this.element=u,this.isAsync=d}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ka.add(this),Yf||(Yf=!0,ft.read(U_),ft.resolveKeyframes(L_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:i,element:o,motionValue:c}=this;for(let u=0;u<s.length;u++)if(s[u]===null)if(u===0){const d=c==null?void 0:c.get(),m=s[s.length-1];if(d!==void 0)s[0]=d;else if(o&&i){const h=o.readValue(i,m);h!=null&&(s[0]=h)}s[0]===void 0&&(s[0]=m),c&&d===void 0&&c.set(s[0])}else s[u]=s[u-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ka.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ka.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const z_=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),lj=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function cj(n){const s=lj.exec(n);if(!s)return[,];const[,i,o,c]=s;return[`--${i??o}`,c]}function P_(n,s,i=1){const[o,c]=cj(n);if(!o)return;const u=window.getComputedStyle(s).getPropertyValue(o);if(u){const d=u.trim();return z_(d)?parseFloat(d):d}return Dp(c)?P_(c,s,i+1):c}const V_=n=>s=>s.test(n),uj={test:n=>n==="auto",parse:n=>n},H_=[ro,Te,as,pa,oN,iN,uj],z0=n=>H_.find(V_(n));class q_ extends Jp{constructor(s,i,o,c,u){super(s,i,o,c,u,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:i,name:o}=this;if(!i||!i.current)return;super.readKeyframes();for(let h=0;h<s.length;h++){let g=s[h];if(typeof g=="string"&&(g=g.trim(),Dp(g))){const v=P_(g,i.current);v!==void 0&&(s[h]=v),h===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!g_.has(o)||s.length!==2)return;const[c,u]=s,d=z0(c),m=z0(u);if(d!==m)if(B0(d)&&B0(m))for(let h=0;h<s.length;h++){const g=s[h];typeof g=="string"&&(s[h]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:i}=this,o=[];for(let c=0;c<s.length;c++)PN(s[c])&&o.push(c);o.length&&sj(s,o,i)}measureInitialState(){const{element:s,unresolvedKeyframes:i,name:o}=this;if(!s||!s.current)return;o==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=no[o](s.measureViewportBox(),window.getComputedStyle(s.current)),i[0]=this.measuredOrigin;const c=i[i.length-1];c!==void 0&&s.getValue(o,c).jump(c,!1)}measureEndState(){var s;const{element:i,name:o,unresolvedKeyframes:c}=this;if(!i||!i.current)return;const u=i.getValue(o);u&&u.jump(this.measuredOrigin,!1);const d=c.length-1,m=c[d];c[d]=no[o](i.measureViewportBox(),window.getComputedStyle(i.current)),m!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=m),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([h,g])=>{i.getValue(h).set(g)}),this.resolveNoneKeyframes()}}const P0=(n,s)=>s==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(ha.test(n)||n==="0")&&!n.startsWith("url("));function dj(n){const s=n[0];if(n.length===1)return!0;for(let i=0;i<n.length;i++)if(n[i]!==s)return!0}function fj(n,s,i,o){const c=n[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const u=n[n.length-1],d=P0(c,s),m=P0(u,s);return!d||!m?!1:dj(n)||(i==="spring"||qp(i))&&o}const pj=n=>n!==null;function Vc(n,{repeat:s,repeatType:i="loop"},o){const c=n.filter(pj),u=s&&i!=="loop"&&s%2===1?0:c.length-1;return!u||o===void 0?c[u]:o}const mj=40;class G_{constructor({autoplay:s=!0,delay:i=0,type:o="keyframes",repeat:c=0,repeatDelay:u=0,repeatType:d="loop",...m}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=is.now(),this.options={autoplay:s,delay:i,type:o,repeat:c,repeatDelay:u,repeatType:d,...m},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>mj?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&rj(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=is.now(),this.hasAttemptedResolve=!0;const{name:o,type:c,velocity:u,delay:d,onComplete:m,onUpdate:h,isGenerator:g}=this.options;if(!g&&!fj(s,o,c,u))if(d)this.options.duration=0;else{h&&h(Vc(s,this.options,i)),m&&m(),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 Wf=2e4;function $_(n){let s=0;const i=50;let o=n.next(s);for(;!o.done&&s<Wf;)s+=i,o=n.next(s);return s>=Wf?1/0:s}const vt=(n,s,i)=>n+(s-n)*i;function pf(n,s,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?n+(s-n)*6*i:i<1/2?s:i<2/3?n+(s-n)*(2/3-i)*6:n}function hj({hue:n,saturation:s,lightness:i,alpha:o}){n/=360,s/=100,i/=100;let c=0,u=0,d=0;if(!s)c=u=d=i;else{const m=i<.5?i*(1+s):i+s-i*s,h=2*i-m;c=pf(h,m,n+1/3),u=pf(h,m,n),d=pf(h,m,n-1/3)}return{red:Math.round(c*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:o}}function Sc(n,s){return i=>i>0?s:n}const mf=(n,s,i)=>{const o=n*n,c=i*(s*s-o)+o;return c<0?0:Math.sqrt(c)},gj=[Zf,Fa,$i],vj=n=>gj.find(s=>s.test(n));function V0(n){const s=vj(n);if(!s)return!1;let i=s.parse(n);return s===$i&&(i=hj(i)),i}const H0=(n,s)=>{const i=V0(n),o=V0(s);if(!i||!o)return Sc(n,s);const c={...i};return u=>(c.red=mf(i.red,o.red,u),c.green=mf(i.green,o.green,u),c.blue=mf(i.blue,o.blue,u),c.alpha=vt(i.alpha,o.alpha,u),Fa.transform(c))},yj=(n,s)=>i=>s(n(i)),Rr=(...n)=>n.reduce(yj),Xf=new Set(["none","hidden"]);function bj(n,s){return Xf.has(n)?i=>i<=0?n:s:i=>i>=1?s:n}function _j(n,s){return i=>vt(n,s,i)}function Wp(n){return typeof n=="number"?_j:typeof n=="string"?Dp(n)?Sc:Xt.test(n)?H0:Tj:Array.isArray(n)?F_:typeof n=="object"?Xt.test(n)?H0:xj:Sc}function F_(n,s){const i=[...n],o=i.length,c=n.map((u,d)=>Wp(u)(u,s[d]));return u=>{for(let d=0;d<o;d++)i[d]=c[d](u);return i}}function xj(n,s){const i={...n,...s},o={};for(const c in i)n[c]!==void 0&&s[c]!==void 0&&(o[c]=Wp(n[c])(n[c],s[c]));return c=>{for(const u in o)i[u]=o[u](c);return i}}function Sj(n,s){var i;const o=[],c={color:0,var:0,number:0};for(let u=0;u<s.values.length;u++){const d=s.types[u],m=n.indexes[d][c[d]],h=(i=n.values[m])!==null&&i!==void 0?i:0;o[u]=h,c[d]++}return o}const Tj=(n,s)=>{const i=ha.createTransformer(s),o=wr(n),c=wr(s);return o.indexes.var.length===c.indexes.var.length&&o.indexes.color.length===c.indexes.color.length&&o.indexes.number.length>=c.indexes.number.length?Xf.has(n)&&!c.values.length||Xf.has(s)&&!o.values.length?bj(n,s):Rr(F_(Sj(o,c),c.values),i):Sc(n,s)};function Z_(n,s,i){return typeof n=="number"&&typeof s=="number"&&typeof i=="number"?vt(n,s,i):Wp(n)(n,s)}const kj=5;function K_(n,s,i){const o=Math.max(s-kj,0);return v_(i-n(o),s-o)}const _t={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},hf=.001;function wj({duration:n=_t.duration,bounce:s=_t.bounce,velocity:i=_t.velocity,mass:o=_t.mass}){let c,u,d=1-s;d=Is(_t.minDamping,_t.maxDamping,d),n=Is(_t.minDuration,_t.maxDuration,Rs(n)),d<1?(c=g=>{const v=g*d,b=v*n,_=v-i,S=Qf(g,d),T=Math.exp(-b);return hf-_/S*T},u=g=>{const b=g*d*n,_=b*i+i,S=Math.pow(d,2)*Math.pow(g,2)*n,T=Math.exp(-b),N=Qf(Math.pow(g,2),d);return(-c(g)+hf>0?-1:1)*((_-S)*T)/N}):(c=g=>{const v=Math.exp(-g*n),b=(g-i)*n+1;return-hf+v*b},u=g=>{const v=Math.exp(-g*n),b=(i-g)*(n*n);return v*b});const m=5/n,h=jj(c,u,m);if(n=Ds(n),isNaN(h))return{stiffness:_t.stiffness,damping:_t.damping,duration:n};{const g=Math.pow(h,2)*o;return{stiffness:g,damping:d*2*Math.sqrt(o*g),duration:n}}}const Nj=12;function jj(n,s,i){let o=i;for(let c=1;c<Nj;c++)o=o-n(o)/s(o);return o}function Qf(n,s){return n*Math.sqrt(1-s*s)}const Cj=["duration","bounce"],Ej=["stiffness","damping","mass"];function q0(n,s){return s.some(i=>n[i]!==void 0)}function Aj(n){let s={velocity:_t.velocity,stiffness:_t.stiffness,damping:_t.damping,mass:_t.mass,isResolvedFromDuration:!1,...n};if(!q0(n,Ej)&&q0(n,Cj))if(n.visualDuration){const i=n.visualDuration,o=2*Math.PI/(i*1.2),c=o*o,u=2*Is(.05,1,1-(n.bounce||0))*Math.sqrt(c);s={...s,mass:_t.mass,stiffness:c,damping:u}}else{const i=wj(n);s={...s,...i,mass:_t.mass},s.isResolvedFromDuration=!0}return s}function Y_(n=_t.visualDuration,s=_t.bounce){const i=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:s}:n;let{restSpeed:o,restDelta:c}=i;const u=i.keyframes[0],d=i.keyframes[i.keyframes.length-1],m={done:!1,value:u},{stiffness:h,damping:g,mass:v,duration:b,velocity:_,isResolvedFromDuration:S}=Aj({...i,velocity:-Rs(i.velocity||0)}),T=_||0,N=g/(2*Math.sqrt(h*v)),j=d-u,w=Rs(Math.sqrt(h/v)),C=Math.abs(j)<5;o||(o=C?_t.restSpeed.granular:_t.restSpeed.default),c||(c=C?_t.restDelta.granular:_t.restDelta.default);let A;if(N<1){const D=Qf(w,N);A=E=>{const H=Math.exp(-N*w*E);return d-H*((T+N*w*j)/D*Math.sin(D*E)+j*Math.cos(D*E))}}else if(N===1)A=D=>d-Math.exp(-w*D)*(j+(T+w*j)*D);else{const D=w*Math.sqrt(N*N-1);A=E=>{const H=Math.exp(-N*w*E),z=Math.min(D*E,300);return d-H*((T+N*w*j)*Math.sinh(z)+D*j*Math.cosh(z))/D}}const M={calculatedDuration:S&&b||null,next:D=>{const E=A(D);if(S)m.done=D>=b;else{let H=0;N<1&&(H=D===0?Ds(T):K_(A,D,E));const z=Math.abs(H)<=o,Z=Math.abs(d-E)<=c;m.done=z&&Z}return m.value=m.done?d:E,m},toString:()=>{const D=Math.min($_(M),Wf),E=b_(H=>M.next(D*H).value,D,30);return D+"ms "+E}};return M}function G0({keyframes:n,velocity:s=0,power:i=.8,timeConstant:o=325,bounceDamping:c=10,bounceStiffness:u=500,modifyTarget:d,min:m,max:h,restDelta:g=.5,restSpeed:v}){const b=n[0],_={done:!1,value:b},S=z=>m!==void 0&&z<m||h!==void 0&&z>h,T=z=>m===void 0?h:h===void 0||Math.abs(m-z)<Math.abs(h-z)?m:h;let N=i*s;const j=b+N,w=d===void 0?j:d(j);w!==j&&(N=w-b);const C=z=>-N*Math.exp(-z/o),A=z=>w+C(z),M=z=>{const Z=C(z),F=A(z);_.done=Math.abs(Z)<=g,_.value=_.done?w:F};let D,E;const H=z=>{S(_.value)&&(D=z,E=Y_({keyframes:[_.value,T(_.value)],velocity:K_(A,z,_.value),damping:c,stiffness:u,restDelta:g,restSpeed:v}))};return H(0),{calculatedDuration:null,next:z=>{let Z=!1;return!E&&D===void 0&&(Z=!0,M(z),H(z)),D!==void 0&&z>=D?E.next(z-D):(!Z&&M(z),_)}}}const Dj=Dr(.42,0,1,1),Rj=Dr(0,0,.58,1),J_=Dr(.42,0,.58,1),Mj=n=>Array.isArray(n)&&typeof n[0]!="number",Oj={linear:_n,easeIn:Dj,easeInOut:J_,easeOut:Rj,circIn:Fp,circInOut:E_,circOut:C_,backIn:$p,backInOut:N_,backOut:w_,anticipate:j_},$0=n=>{if(Gp(n)){Jb(n.length===4);const[s,i,o,c]=n;return Dr(s,i,o,c)}else if(typeof n=="string")return Oj[n];return n};function Ij(n,s,i){const o=[],c=i||Z_,u=n.length-1;for(let d=0;d<u;d++){let m=c(n[d],n[d+1]);if(s){const h=Array.isArray(s)?s[d]||_n:s;m=Rr(h,m)}o.push(m)}return o}function Bj(n,s,{clamp:i=!0,ease:o,mixer:c}={}){const u=n.length;if(Jb(u===s.length),u===1)return()=>s[0];if(u===2&&s[0]===s[1])return()=>s[1];const d=n[0]===n[1];n[0]>n[u-1]&&(n=[...n].reverse(),s=[...s].reverse());const m=Ij(s,o,c),h=m.length,g=v=>{if(d&&v<n[0])return s[0];let b=0;if(h>1)for(;b<n.length-2&&!(v<n[b+1]);b++);const _=to(n[b],n[b+1],v);return m[b](_)};return i?v=>g(Is(n[0],n[u-1],v)):g}function Lj(n,s){const i=n[n.length-1];for(let o=1;o<=s;o++){const c=to(0,s,o);n.push(vt(i,1,c))}}function Uj(n){const s=[0];return Lj(s,n.length-1),s}function zj(n,s){return n.map(i=>i*s)}function Pj(n,s){return n.map(()=>s||J_).splice(0,n.length-1)}function Tc({duration:n=300,keyframes:s,times:i,ease:o="easeInOut"}){const c=Mj(o)?o.map($0):$0(o),u={done:!1,value:s[0]},d=zj(i&&i.length===s.length?i:Uj(s),n),m=Bj(d,s,{ease:Array.isArray(c)?c:Pj(s,c)});return{calculatedDuration:n,next:h=>(u.value=m(h),u.done=h>=n,u)}}const Vj=n=>{const s=({timestamp:i})=>n(i);return{start:()=>ft.update(s,!0),stop:()=>ma(s),now:()=>Kt.isProcessing?Kt.timestamp:is.now()}},Hj={decay:G0,inertia:G0,tween:Tc,keyframes:Tc,spring:Y_},qj=n=>n/100;class Xp extends G_{constructor(s){super(s),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:h}=this.options;h&&h()};const{name:i,motionValue:o,element:c,keyframes:u}=this.options,d=(c==null?void 0:c.KeyframeResolver)||Jp,m=(h,g)=>this.onKeyframesResolved(h,g);this.resolver=new d(u,m,i,o,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:i="keyframes",repeat:o=0,repeatDelay:c=0,repeatType:u,velocity:d=0}=this.options,m=qp(i)?i:Hj[i]||Tc;let h,g;m!==Tc&&typeof s[0]!="number"&&(h=Rr(qj,Z_(s[0],s[1])),s=[0,100]);const v=m({...this.options,keyframes:s});u==="mirror"&&(g=m({...this.options,keyframes:[...s].reverse(),velocity:-d})),v.calculatedDuration===null&&(v.calculatedDuration=$_(v));const{calculatedDuration:b}=v,_=b+c,S=_*(o+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:h,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:o}=this;if(!o){const{keyframes:z}=this.options;return{done:!0,value:z[z.length-1]}}const{finalKeyframe:c,generator:u,mirroredGenerator:d,mapPercentToKeyframes:m,keyframes:h,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=o;if(this.startTime===null)return u.next(0);const{delay:_,repeat:S,repeatType:T,repeatDelay:N,onUpdate:j}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),i?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const w=this.currentTime-_*(this.speed>=0?1:-1),C=this.speed>=0?w<0:w>v;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let A=this.currentTime,M=u;if(S){const z=Math.min(this.currentTime,v)/b;let Z=Math.floor(z),F=z%1;!F&&z>=1&&(F=1),F===1&&Z--,Z=Math.min(Z,S+1),!!(Z%2)&&(T==="reverse"?(F=1-F,N&&(F-=N/b)):T==="mirror"&&(M=d)),A=Is(0,1,F)*b}const D=C?{done:!1,value:h[0]}:M.next(A);m&&(D.value=m(D.value));let{done:E}=D;!C&&g!==null&&(E=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const H=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return H&&c!==void 0&&(D.value=Vc(h,this.options,c)),j&&j(D.value),H&&this.finish(),D}get duration(){const{resolved:s}=this;return s?Rs(s.calculatedDuration):0}get time(){return Rs(this.currentTime)}set time(s){s=Ds(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=Rs(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=Vj,onPlay:i,startTime:o}=this.options;this.driver||(this.driver=s(u=>this.tick(u))),i&&i();const c=this.driver.now();this.holdTime!==null?this.startTime=c-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=c):this.startTime=o??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var s;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(s=this.currentTime)!==null&&s!==void 0?s:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:s}=this.options;s&&s()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(s){return this.startTime=0,this.tick(s,!0)}}const Gj=new Set(["opacity","clipPath","filter","transform"]);function $j(n,s,i,{delay:o=0,duration:c=300,repeat:u=0,repeatType:d="loop",ease:m="easeInOut",times:h}={}){const g={[s]:i};h&&(g.offset=h);const v=x_(m,c);return Array.isArray(v)&&(g.easing=v),n.animate(g,{delay:o,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:u+1,direction:d==="reverse"?"alternate":"normal"})}const Fj=Hp(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),kc=10,Zj=2e4;function Kj(n){return qp(n.type)||n.type==="spring"||!__(n.ease)}function Yj(n,s){const i=new Xp({...s,keyframes:n,repeat:0,delay:0,isGenerator:!0});let o={done:!1,value:n[0]};const c=[];let u=0;for(;!o.done&&u<Zj;)o=i.sample(u),c.push(o.value),u+=kc;return{times:void 0,keyframes:c,duration:u-kc,ease:"linear"}}const W_={anticipate:j_,backInOut:N_,circInOut:E_};function Jj(n){return n in W_}class F0 extends G_{constructor(s){super(s);const{name:i,motionValue:o,element:c,keyframes:u}=this.options;this.resolver=new q_(u,(d,m)=>this.onKeyframesResolved(d,m),i,o,c),this.resolver.scheduleResolve()}initPlayback(s,i){let{duration:o=300,times:c,ease:u,type:d,motionValue:m,name:h,startTime:g}=this.options;if(!m.owner||!m.owner.current)return!1;if(typeof u=="string"&&xc()&&Jj(u)&&(u=W_[u]),Kj(this.options)){const{onComplete:b,onUpdate:_,motionValue:S,element:T,...N}=this.options,j=Yj(s,N);s=j.keyframes,s.length===1&&(s[1]=s[0]),o=j.duration,c=j.times,u=j.ease,d="keyframes"}const v=$j(m.owner.current,h,s,{...this.options,duration:o,times:c,ease:u});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(O0(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;m.set(Vc(s,this.options,i)),b&&b(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:o,times:c,type:d,ease:u,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:i}=s;return Rs(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Rs(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.currentTime=Ds(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:i}=s;return i.playbackRate}set speed(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:i}=s;return i.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:i}=s;return i.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:i}=this;if(!i)return _n;const{animation:o}=i;O0(o,s)}return _n}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.playState==="finished"&&this.updateFinishedPromise(),i.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:i,keyframes:o,duration:c,type:u,ease:d,times:m}=s;if(i.playState==="idle"||i.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:_,...S}=this.options,T=new Xp({...S,keyframes:o,duration:c,type:u,ease:d,times:m,isGenerator:!0}),N=Ds(this.time);g.setWithVelocity(T.sample(N-kc).value,T.sample(N).value,kc)}const{onStop:h}=this.options;h&&h(),this.cancel()}complete(){const{resolved:s}=this;s&&s.animation.finish()}cancel(){const{resolved:s}=this;s&&s.animation.cancel()}static supports(s){const{motionValue:i,name:o,repeatDelay:c,repeatType:u,damping:d,type:m}=s;if(!i||!i.owner||!(i.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:g}=i.owner.getProps();return Fj()&&o&&Gj.has(o)&&!h&&!g&&!c&&u!=="mirror"&&d!==0&&m!=="inertia"}}const Wj={type:"spring",stiffness:500,damping:25,restSpeed:10},Xj=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),Qj={type:"keyframes",duration:.8},eC={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},tC=(n,{keyframes:s})=>s.length>2?Qj:ti.has(n)?n.startsWith("scale")?Xj(s[1]):Wj:eC;function nC({when:n,delay:s,delayChildren:i,staggerChildren:o,staggerDirection:c,repeat:u,repeatType:d,repeatDelay:m,from:h,elapsed:g,...v}){return!!Object.keys(v).length}const Qp=(n,s,i,o={},c,u)=>d=>{const m=Up(o,n)||{},h=m.delay||o.delay||0;let{elapsed:g=0}=o;g=g-Ds(h);let v={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...m,delay:-g,onUpdate:_=>{s.set(_),m.onUpdate&&m.onUpdate(_)},onComplete:()=>{d(),m.onComplete&&m.onComplete()},name:n,motionValue:s,element:u?void 0:c};nC(m)||(v={...v,...tC(n,v)}),v.duration&&(v.duration=Ds(v.duration)),v.repeatDelay&&(v.repeatDelay=Ds(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&&!u&&s.get()!==void 0){const _=Vc(v.keyframes,m);if(_!==void 0)return ft.update(()=>{v.onUpdate(_),v.onComplete()}),new ON([])}return!u&&F0.supports(v)?new F0(v):new Xp(v)};function sC({protectedKeys:n,needsAnimating:s},i){const o=n.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,o}function X_(n,s,{delay:i=0,transitionOverride:o,type:c}={}){var u;let{transition:d=n.getDefaultTransition(),transitionEnd:m,...h}=s;o&&(d=o);const g=[],v=c&&n.animationState&&n.animationState.getState()[c];for(const b in h){const _=n.getValue(b,(u=n.latestValues[b])!==null&&u!==void 0?u:null),S=h[b];if(S===void 0||v&&sC(v,b))continue;const T={delay:i,...Up(d||{},b)};let N=!1;if(window.MotionHandoffAnimation){const w=y_(n);if(w){const C=window.MotionHandoffAnimation(w,b,ft);C!==null&&(T.startTime=C,N=!0)}}$f(n,b),_.start(Qp(b,_,S,n.shouldReduceMotion&&g_.has(b)?{type:!1}:T,n,N));const j=_.animation;j&&g.push(j)}return m&&Promise.all(g).then(()=>{ft.update(()=>{m&&AN(n,m)})}),g}function ep(n,s,i={}){var o;const c=Pc(n,s,i.type==="exit"?(o=n.presenceContext)===null||o===void 0?void 0:o.custom:void 0);let{transition:u=n.getDefaultTransition()||{}}=c||{};i.transitionOverride&&(u=i.transitionOverride);const d=c?()=>Promise.all(X_(n,c,i)):()=>Promise.resolve(),m=n.variantChildren&&n.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=u;return aC(n,s,v+g,b,_,i)}:()=>Promise.resolve(),{when:h}=u;if(h){const[g,v]=h==="beforeChildren"?[d,m]:[m,d];return g().then(()=>v())}else return Promise.all([d(),m(i.delay)])}function aC(n,s,i=0,o=0,c=1,u){const d=[],m=(n.variantChildren.size-1)*o,h=c===1?(g=0)=>g*o:(g=0)=>m-g*o;return Array.from(n.variantChildren).sort(iC).forEach((g,v)=>{g.notify("AnimationStart",s),d.push(ep(g,s,{...u,delay:i+h(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(d)}function iC(n,s){return n.sortNodePosition(s)}function oC(n,s,i={}){n.notify("AnimationStart",s);let o;if(Array.isArray(s)){const c=s.map(u=>ep(n,u,i));o=Promise.all(c)}else if(typeof s=="string")o=ep(n,s,i);else{const c=typeof s=="function"?Pc(n,s,i.custom):s;o=Promise.all(X_(n,c,i))}return o.then(()=>{n.notify("AnimationComplete",s)})}const rC=Np.length;function Q_(n){if(!n)return;if(!n.isControllingVariants){const i=n.parent?Q_(n.parent)||{}:{};return n.props.initial!==void 0&&(i.initial=n.props.initial),i}const s={};for(let i=0;i<rC;i++){const o=Np[i],c=n.props[o];(Sr(c)||c===!1)&&(s[o]=c)}return s}const lC=[...wp].reverse(),cC=wp.length;function uC(n){return s=>Promise.all(s.map(({animation:i,options:o})=>oC(n,i,o)))}function dC(n){let s=uC(n),i=Z0(),o=!0;const c=h=>(g,v)=>{var b;const _=Pc(n,v,h==="exit"?(b=n.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(_){const{transition:S,transitionEnd:T,...N}=_;g={...g,...N,...T}}return g};function u(h){s=h(n)}function d(h){const{props:g}=n,v=Q_(n.parent)||{},b=[],_=new Set;let S={},T=1/0;for(let j=0;j<cC;j++){const w=lC[j],C=i[w],A=g[w]!==void 0?g[w]:v[w],M=Sr(A),D=w===h?C.isActive:null;D===!1&&(T=j);let E=A===v[w]&&A!==g[w]&&M;if(E&&o&&n.manuallyAnimateOnMount&&(E=!1),C.protectedKeys={...S},!C.isActive&&D===null||!A&&!C.prevProp||Uc(A)||typeof A=="boolean")continue;const H=fC(C.prevProp,A);let z=H||w===h&&C.isActive&&!E&&M||j>T&&M,Z=!1;const F=Array.isArray(A)?A:[A];let Q=F.reduce(c(w),{});D===!1&&(Q={});const{prevResolvedValues:ae={}}=C,pe={...ae,...Q},oe=$=>{z=!0,_.has($)&&(Z=!0,_.delete($)),C.needsAnimating[$]=!0;const te=n.getValue($);te&&(te.liveStyle=!1)};for(const $ in pe){const te=Q[$],re=ae[$];if(S.hasOwnProperty($))continue;let de=!1;Gf(te)&&Gf(re)?de=!h_(te,re):de=te!==re,de?te!=null?oe($):_.add($):te!==void 0&&_.has($)?oe($):C.protectedKeys[$]=!0}C.prevProp=A,C.prevResolvedValues=Q,C.isActive&&(S={...S,...Q}),o&&n.blockInitialAnimation&&(z=!1),z&&(!(E&&H)||Z)&&b.push(...F.map($=>({animation:$,options:{type:w}})))}if(_.size){const j={};_.forEach(w=>{const C=n.getBaseTarget(w),A=n.getValue(w);A&&(A.liveStyle=!0),j[w]=C??null}),b.push({animation:j})}let N=!!b.length;return o&&(g.initial===!1||g.initial===g.animate)&&!n.manuallyAnimateOnMount&&(N=!1),o=!1,N?s(b):Promise.resolve()}function m(h,g){var v;if(i[h].isActive===g)return Promise.resolve();(v=n.variantChildren)===null||v===void 0||v.forEach(_=>{var S;return(S=_.animationState)===null||S===void 0?void 0:S.setActive(h,g)}),i[h].isActive=g;const b=d(h);for(const _ in i)i[_].protectedKeys={};return b}return{animateChanges:d,setActive:m,setAnimateFunction:u,getState:()=>i,reset:()=>{i=Z0(),o=!0}}}function fC(n,s){return typeof s=="string"?s!==n:Array.isArray(s)?!h_(s,n):!1}function Pa(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Z0(){return{animate:Pa(!0),whileInView:Pa(),whileHover:Pa(),whileTap:Pa(),whileDrag:Pa(),whileFocus:Pa(),exit:Pa()}}class ya{constructor(s){this.isMounted=!1,this.node=s}update(){}}class pC extends ya{constructor(s){super(s),s.animationState||(s.animationState=dC(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Uc(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 mC=0;class hC extends ya{constructor(){super(...arguments),this.id=mC++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:i}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===o)return;const c=this.node.animationState.setActive("exit",!s);i&&!s&&c.then(()=>i(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const gC={animation:{Feature:pC},exit:{Feature:hC}},Zn={x:!1,y:!1};function ex(){return Zn.x||Zn.y}function vC(n){return n==="x"||n==="y"?Zn[n]?null:(Zn[n]=!0,()=>{Zn[n]=!1}):Zn.x||Zn.y?null:(Zn.x=Zn.y=!0,()=>{Zn.x=Zn.y=!1})}const em=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1;function Nr(n,s,i,o={passive:!0}){return n.addEventListener(s,i,o),()=>n.removeEventListener(s,i)}function Mr(n){return{point:{x:n.pageX,y:n.pageY}}}const yC=n=>s=>em(s)&&n(s,Mr(s));function gr(n,s,i,o){return Nr(n,s,yC(i),o)}const K0=(n,s)=>Math.abs(n-s);function bC(n,s){const i=K0(n.x,s.x),o=K0(n.y,s.y);return Math.sqrt(i**2+o**2)}class tx{constructor(s,i,{transformPagePoint:o,contextWindow:c,dragSnapToOrigin:u=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=vf(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,S=bC(b.offset,{x:0,y:0})>=3;if(!_&&!S)return;const{point:T}=b,{timestamp:N}=Kt;this.history.push({...T,timestamp:N});const{onStart:j,onMove:w}=this.handlers;_||(j&&j(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=gf(_,this.transformPagePoint),ft.update(this.updatePoint,!0)},this.handlePointerUp=(b,_)=>{this.end();const{onEnd:S,onSessionEnd:T,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=vf(b.type==="pointercancel"?this.lastMoveEventInfo:gf(_,this.transformPagePoint),this.history);this.startEvent&&S&&S(b,j),T&&T(b,j)},!em(s))return;this.dragSnapToOrigin=u,this.handlers=i,this.transformPagePoint=o,this.contextWindow=c||window;const d=Mr(s),m=gf(d,this.transformPagePoint),{point:h}=m,{timestamp:g}=Kt;this.history=[{...h,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,vf(m,this.history)),this.removeListeners=Rr(gr(this.contextWindow,"pointermove",this.handlePointerMove),gr(this.contextWindow,"pointerup",this.handlePointerUp),gr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),ma(this.updatePoint)}}function gf(n,s){return s?{point:s(n.point)}:n}function Y0(n,s){return{x:n.x-s.x,y:n.y-s.y}}function vf({point:n},s){return{point:n,delta:Y0(n,nx(s)),offset:Y0(n,_C(s)),velocity:xC(s,.1)}}function _C(n){return n[0]}function nx(n){return n[n.length-1]}function xC(n,s){if(n.length<2)return{x:0,y:0};let i=n.length-1,o=null;const c=nx(n);for(;i>=0&&(o=n[i],!(c.timestamp-o.timestamp>Ds(s)));)i--;if(!o)return{x:0,y:0};const u=Rs(c.timestamp-o.timestamp);if(u===0)return{x:0,y:0};const d={x:(c.x-o.x)/u,y:(c.y-o.y)/u};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}const sx=1e-4,SC=1-sx,TC=1+sx,ax=.01,kC=0-ax,wC=0+ax;function xn(n){return n.max-n.min}function NC(n,s,i){return Math.abs(n-s)<=i}function J0(n,s,i,o=.5){n.origin=o,n.originPoint=vt(s.min,s.max,n.origin),n.scale=xn(i)/xn(s),n.translate=vt(i.min,i.max,n.origin)-n.originPoint,(n.scale>=SC&&n.scale<=TC||isNaN(n.scale))&&(n.scale=1),(n.translate>=kC&&n.translate<=wC||isNaN(n.translate))&&(n.translate=0)}function vr(n,s,i,o){J0(n.x,s.x,i.x,o?o.originX:void 0),J0(n.y,s.y,i.y,o?o.originY:void 0)}function W0(n,s,i){n.min=i.min+s.min,n.max=n.min+xn(s)}function jC(n,s,i){W0(n.x,s.x,i.x),W0(n.y,s.y,i.y)}function X0(n,s,i){n.min=s.min-i.min,n.max=n.min+xn(s)}function yr(n,s,i){X0(n.x,s.x,i.x),X0(n.y,s.y,i.y)}function CC(n,{min:s,max:i},o){return s!==void 0&&n<s?n=o?vt(s,n,o.min):Math.max(n,s):i!==void 0&&n>i&&(n=o?vt(i,n,o.max):Math.min(n,i)),n}function Q0(n,s,i){return{min:s!==void 0?n.min+s:void 0,max:i!==void 0?n.max+i-(n.max-n.min):void 0}}function EC(n,{top:s,left:i,bottom:o,right:c}){return{x:Q0(n.x,i,c),y:Q0(n.y,s,o)}}function ey(n,s){let i=s.min-n.min,o=s.max-n.max;return s.max-s.min<n.max-n.min&&([i,o]=[o,i]),{min:i,max:o}}function AC(n,s){return{x:ey(n.x,s.x),y:ey(n.y,s.y)}}function DC(n,s){let i=.5;const o=xn(n),c=xn(s);return c>o?i=to(s.min,s.max-o,n.min):o>c&&(i=to(n.min,n.max-c,s.min)),Is(0,1,i)}function RC(n,s){const i={};return s.min!==void 0&&(i.min=s.min-n.min),s.max!==void 0&&(i.max=s.max-n.min),i}const tp=.35;function MC(n=tp){return n===!1?n=0:n===!0&&(n=tp),{x:ty(n,"left","right"),y:ty(n,"top","bottom")}}function ty(n,s,i){return{min:ny(n,s),max:ny(n,i)}}function ny(n,s){return typeof n=="number"?n:n[s]||0}const sy=()=>({translate:0,scale:1,origin:0,originPoint:0}),Fi=()=>({x:sy(),y:sy()}),ay=()=>({min:0,max:0}),jt=()=>({x:ay(),y:ay()});function Bn(n){return[n("x"),n("y")]}function ix({top:n,left:s,right:i,bottom:o}){return{x:{min:s,max:i},y:{min:n,max:o}}}function OC({x:n,y:s}){return{top:s.min,right:n.max,bottom:s.max,left:n.min}}function IC(n,s){if(!s)return n;const i=s({x:n.left,y:n.top}),o=s({x:n.right,y:n.bottom});return{top:i.y,left:i.x,bottom:o.y,right:o.x}}function yf(n){return n===void 0||n===1}function np({scale:n,scaleX:s,scaleY:i}){return!yf(n)||!yf(s)||!yf(i)}function Ga(n){return np(n)||ox(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function ox(n){return iy(n.x)||iy(n.y)}function iy(n){return n&&n!=="0%"}function wc(n,s,i){const o=n-i,c=s*o;return i+c}function oy(n,s,i,o,c){return c!==void 0&&(n=wc(n,c,o)),wc(n,i,o)+s}function sp(n,s=0,i=1,o,c){n.min=oy(n.min,s,i,o,c),n.max=oy(n.max,s,i,o,c)}function rx(n,{x:s,y:i}){sp(n.x,s.translate,s.scale,s.originPoint),sp(n.y,i.translate,i.scale,i.originPoint)}const ry=.999999999999,ly=1.0000000000001;function BC(n,s,i,o=!1){const c=i.length;if(!c)return;s.x=s.y=1;let u,d;for(let m=0;m<c;m++){u=i[m],d=u.projectionDelta;const{visualElement:h}=u.options;h&&h.props.style&&h.props.style.display==="contents"||(o&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Ki(n,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(s.x*=d.x.scale,s.y*=d.y.scale,rx(n,d)),o&&Ga(u.latestValues)&&Ki(n,u.latestValues))}s.x<ly&&s.x>ry&&(s.x=1),s.y<ly&&s.y>ry&&(s.y=1)}function Zi(n,s){n.min=n.min+s,n.max=n.max+s}function cy(n,s,i,o,c=.5){const u=vt(n.min,n.max,c);sp(n,s,i,u,o)}function Ki(n,s){cy(n.x,s.x,s.scaleX,s.scale,s.originX),cy(n.y,s.y,s.scaleY,s.scale,s.originY)}function lx(n,s){return ix(IC(n.getBoundingClientRect(),s))}function LC(n,s,i){const o=lx(n,i),{scroll:c}=s;return c&&(Zi(o.x,c.offset.x),Zi(o.y,c.offset.y)),o}const cx=({current:n})=>n?n.ownerDocument.defaultView:null,UC=new WeakMap;class zC{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=jt(),this.visualElement=s}start(s,{snapToCursor:i=!1}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(Mr(v).point)},u=(v,b)=>{const{drag:_,dragPropagation:S,onDragStart:T}=this.getProps();if(_&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=vC(_),!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),Bn(j=>{let w=this.getAxisMotionValue(j).get()||0;if(as.test(w)){const{projection:C}=this.visualElement;if(C&&C.layout){const A=C.layout.layoutBox[j];A&&(w=xn(A)*(parseFloat(w)/100))}}this.originPoint[j]=w}),T&&ft.postRender(()=>T(v,b)),$f(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},d=(v,b)=>{const{dragPropagation:_,dragDirectionLock:S,onDirectionLock:T,onDrag:N}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:j}=b;if(S&&this.currentDirection===null){this.currentDirection=PC(j),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",b.point,j),this.updateAxis("y",b.point,j),this.visualElement.render(),N&&N(v,b)},m=(v,b)=>this.stop(v,b),h=()=>Bn(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 tx(s,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:m,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:cx(this.visualElement)})}stop(s,i){const o=this.isDragging;if(this.cancel(),!o)return;const{velocity:c}=i;this.startAnimation(c);const{onDragEnd:u}=this.getProps();u&&ft.postRender(()=>u(s,i))}cancel(){this.isDragging=!1;const{projection:s,animationState:i}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:o}=this.getProps();!o&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),i&&i.setActive("whileDrag",!1)}updateAxis(s,i,o){const{drag:c}=this.getProps();if(!o||!ac(s,c,this.currentDirection))return;const u=this.getAxisMotionValue(s);let d=this.originPoint[s]+o[s];this.constraints&&this.constraints[s]&&(d=CC(d,this.constraints[s],this.elastic[s])),u.set(d)}resolveConstraints(){var s;const{dragConstraints:i,dragElastic:o}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)===null||s===void 0?void 0:s.layout,u=this.constraints;i&&Gi(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=EC(c.layoutBox,i):this.constraints=!1,this.elastic=MC(o),u!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Bn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=RC(c.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!Gi(s))return!1;const o=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const u=LC(o,c.root,this.visualElement.getTransformPagePoint());let d=AC(c.layout.layoutBox,u);if(i){const m=i(OC(d));this.hasMutatedConstraints=!!m,m&&(d=ix(m))}return d}startAnimation(s){const{drag:i,dragMomentum:o,dragElastic:c,dragTransition:u,dragSnapToOrigin:d,onDragTransitionEnd:m}=this.getProps(),h=this.constraints||{},g=Bn(v=>{if(!ac(v,i,this.currentDirection))return;let b=h&&h[v]||{};d&&(b={min:0,max:0});const _=c?200:1e6,S=c?40:1e7,T={type:"inertia",velocity:o?s[v]:0,bounceStiffness:_,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...u,...b};return this.startAxisValueAnimation(v,T)});return Promise.all(g).then(m)}startAxisValueAnimation(s,i){const o=this.getAxisMotionValue(s);return $f(this.visualElement,s),o.start(Qp(s,o,0,i,this.visualElement,!1))}stopAnimation(){Bn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){Bn(s=>{var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.pause()})}getAnimationState(s){var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.state}getAxisMotionValue(s){const i=`_drag${s.toUpperCase()}`,o=this.visualElement.getProps(),c=o[i];return c||this.visualElement.getValue(s,(o.initial?o.initial[s]:void 0)||0)}snapToCursor(s){Bn(i=>{const{drag:o}=this.getProps();if(!ac(i,o,this.currentDirection))return;const{projection:c}=this.visualElement,u=this.getAxisMotionValue(i);if(c&&c.layout){const{min:d,max:m}=c.layout.layoutBox[i];u.set(s[i]-vt(d,m,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:o}=this.visualElement;if(!Gi(i)||!o||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Bn(d=>{const m=this.getAxisMotionValue(d);if(m&&this.constraints!==!1){const h=m.get();c[d]=DC({min:h,max:h},this.constraints[d])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.resolveConstraints(),Bn(d=>{if(!ac(d,s,null))return;const m=this.getAxisMotionValue(d),{min:h,max:g}=this.constraints[d];m.set(vt(h,g,c[d]))})}addListeners(){if(!this.visualElement.current)return;UC.set(this.visualElement,this);const s=this.visualElement.current,i=gr(s,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(h)}),o=()=>{const{dragConstraints:h}=this.getProps();Gi(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,u=c.addEventListener("measure",o);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),ft.read(o);const d=Nr(window,"resize",()=>this.scalePositionWithinConstraints()),m=c.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(Bn(v=>{const b=this.getAxisMotionValue(v);b&&(this.originPoint[v]+=h[v].translate,b.set(b.get()+h[v].translate))}),this.visualElement.render())}));return()=>{d(),i(),u(),m&&m()}}getProps(){const s=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:o=!1,dragPropagation:c=!1,dragConstraints:u=!1,dragElastic:d=tp,dragMomentum:m=!0}=s;return{...s,drag:i,dragDirectionLock:o,dragPropagation:c,dragConstraints:u,dragElastic:d,dragMomentum:m}}}function ac(n,s,i){return(s===!0||s===n)&&(i===null||i===n)}function PC(n,s=10){let i=null;return Math.abs(n.y)>s?i="y":Math.abs(n.x)>s&&(i="x"),i}class VC extends ya{constructor(s){super(s),this.removeGroupControls=_n,this.removeListeners=_n,this.controls=new zC(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||_n}unmount(){this.removeGroupControls(),this.removeListeners()}}const uy=n=>(s,i)=>{n&&ft.postRender(()=>n(s,i))};class HC extends ya{constructor(){super(...arguments),this.removePointerDownListener=_n}onPointerDown(s){this.session=new tx(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:cx(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:uy(s),onStart:uy(i),onMove:o,onEnd:(u,d)=>{delete this.session,c&&ft.postRender(()=>c(u,d))}}}mount(){this.removePointerDownListener=gr(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 hc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function dy(n,s){return s.max===s.min?0:n/(s.max-s.min)*100}const or={correct:(n,s)=>{if(!s.target)return n;if(typeof n=="string")if(Te.test(n))n=parseFloat(n);else return n;const i=dy(n,s.target.x),o=dy(n,s.target.y);return`${i}% ${o}%`}},qC={correct:(n,{treeScale:s,projectionDelta:i})=>{const o=n,c=ha.parse(n);if(c.length>5)return o;const u=ha.createTransformer(n),d=typeof c[0]!="number"?1:0,m=i.x.scale*s.x,h=i.y.scale*s.y;c[0+d]/=m,c[1+d]/=h;const g=vt(m,h,.5);return typeof c[2+d]=="number"&&(c[2+d]/=g),typeof c[3+d]=="number"&&(c[3+d]/=g),u(c)}};class GC extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o,layoutId:c}=this.props,{projection:u}=s;gN($C),u&&(i.group&&i.group.add(u),o&&o.register&&c&&o.register(u),u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),hc.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:i,visualElement:o,drag:c,isPresent:u}=this.props,d=o.projection;return d&&(d.isPresent=u,c||s.layoutDependency!==i||i===void 0?d.willUpdate():this.safeToRemove(),s.isPresent!==u&&(u?d.promote():d.relegate()||ft.postRender(()=>{const m=d.getStack();(!m||!m.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Cp.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(c),o&&o.deregister&&o.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function ux(n){const[s,i]=Kb(),o=y.useContext(xp);return l.jsx(GC,{...n,layoutGroup:o,switchLayoutGroup:y.useContext(n_),isPresent:s,safeToRemove:i})}const $C={borderRadius:{...or,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:or,borderTopRightRadius:or,borderBottomLeftRadius:or,borderBottomRightRadius:or,boxShadow:qC};function FC(n,s,i){const o=Qt(n)?n:kr(n);return o.start(Qp("",o,s,i)),o.animation}function ZC(n){return n instanceof SVGElement&&n.tagName!=="svg"}const KC=(n,s)=>n.depth-s.depth;class YC{constructor(){this.children=[],this.isDirty=!1}add(s){zp(this.children,s),this.isDirty=!0}remove(s){Pp(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(KC),this.isDirty=!1,this.children.forEach(s)}}function JC(n,s){const i=is.now(),o=({timestamp:c})=>{const u=c-i;u>=s&&(ma(o),n(u-s))};return ft.read(o,!0),()=>ma(o)}const dx=["TopLeft","TopRight","BottomLeft","BottomRight"],WC=dx.length,fy=n=>typeof n=="string"?parseFloat(n):n,py=n=>typeof n=="number"||Te.test(n);function XC(n,s,i,o,c,u){c?(n.opacity=vt(0,i.opacity!==void 0?i.opacity:1,QC(o)),n.opacityExit=vt(s.opacity!==void 0?s.opacity:1,0,eE(o))):u&&(n.opacity=vt(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,o));for(let d=0;d<WC;d++){const m=`border${dx[d]}Radius`;let h=my(s,m),g=my(i,m);if(h===void 0&&g===void 0)continue;h||(h=0),g||(g=0),h===0||g===0||py(h)===py(g)?(n[m]=Math.max(vt(fy(h),fy(g),o),0),(as.test(g)||as.test(h))&&(n[m]+="%")):n[m]=g}(s.rotate||i.rotate)&&(n.rotate=vt(s.rotate||0,i.rotate||0,o))}function my(n,s){return n[s]!==void 0?n[s]:n.borderRadius}const QC=fx(0,.5,C_),eE=fx(.5,.95,_n);function fx(n,s,i){return o=>o<n?0:o>s?1:i(to(n,s,o))}function hy(n,s){n.min=s.min,n.max=s.max}function On(n,s){hy(n.x,s.x),hy(n.y,s.y)}function gy(n,s){n.translate=s.translate,n.scale=s.scale,n.originPoint=s.originPoint,n.origin=s.origin}function vy(n,s,i,o,c){return n-=s,n=wc(n,1/i,o),c!==void 0&&(n=wc(n,1/c,o)),n}function tE(n,s=0,i=1,o=.5,c,u=n,d=n){if(as.test(s)&&(s=parseFloat(s),s=vt(d.min,d.max,s/100)-d.min),typeof s!="number")return;let m=vt(u.min,u.max,o);n===u&&(m-=s),n.min=vy(n.min,s,i,m,c),n.max=vy(n.max,s,i,m,c)}function yy(n,s,[i,o,c],u,d){tE(n,s[i],s[o],s[c],s.scale,u,d)}const nE=["x","scaleX","originX"],sE=["y","scaleY","originY"];function by(n,s,i,o){yy(n.x,s,nE,i?i.x:void 0,o?o.x:void 0),yy(n.y,s,sE,i?i.y:void 0,o?o.y:void 0)}function _y(n){return n.translate===0&&n.scale===1}function px(n){return _y(n.x)&&_y(n.y)}function xy(n,s){return n.min===s.min&&n.max===s.max}function aE(n,s){return xy(n.x,s.x)&&xy(n.y,s.y)}function Sy(n,s){return Math.round(n.min)===Math.round(s.min)&&Math.round(n.max)===Math.round(s.max)}function mx(n,s){return Sy(n.x,s.x)&&Sy(n.y,s.y)}function Ty(n){return xn(n.x)/xn(n.y)}function ky(n,s){return n.translate===s.translate&&n.scale===s.scale&&n.originPoint===s.originPoint}class iE{constructor(){this.members=[]}add(s){zp(this.members,s),s.scheduleRender()}remove(s){if(Pp(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(s){const i=this.members.findIndex(c=>s===c);if(i===0)return!1;let o;for(let c=i;c>=0;c--){const u=this.members[c];if(u.isPresent!==!1){o=u;break}}return o?(this.promote(o),!0):!1}promote(s,i){const o=this.lead;if(s!==o&&(this.prevLead=o,this.lead=s,s.show(),o)){o.instance&&o.scheduleRender(),s.scheduleRender(),s.resumeFrom=o,i&&(s.resumeFrom.preserveOpacity=!0),o.snapshot&&(s.snapshot=o.snapshot,s.snapshot.latestValues=o.animationValues||o.latestValues),s.root&&s.root.isUpdating&&(s.isLayoutDirty=!0);const{crossfade:c}=s.options;c===!1&&o.hide()}}exitAnimationComplete(){this.members.forEach(s=>{const{options:i,resumingFrom:o}=s;i.onExitComplete&&i.onExitComplete(),o&&o.options.onExitComplete&&o.options.onExitComplete()})}scheduleRender(){this.members.forEach(s=>{s.instance&&s.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function oE(n,s,i){let o="";const c=n.x.translate/s.x,u=n.y.translate/s.y,d=(i==null?void 0:i.z)||0;if((c||u||d)&&(o=`translate3d(${c}px, ${u}px, ${d}px) `),(s.x!==1||s.y!==1)&&(o+=`scale(${1/s.x}, ${1/s.y}) `),i){const{transformPerspective:g,rotate:v,rotateX:b,rotateY:_,skewX:S,skewY:T}=i;g&&(o=`perspective(${g}px) ${o}`),v&&(o+=`rotate(${v}deg) `),b&&(o+=`rotateX(${b}deg) `),_&&(o+=`rotateY(${_}deg) `),S&&(o+=`skewX(${S}deg) `),T&&(o+=`skewY(${T}deg) `)}const m=n.x.scale*s.x,h=n.y.scale*s.y;return(m!==1||h!==1)&&(o+=`scale(${m}, ${h})`),o||"none"}const $a={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},dr=typeof window<"u"&&window.MotionDebug!==void 0,bf=["","X","Y","Z"],rE={visibility:"hidden"},wy=1e3;let lE=0;function _f(n,s,i,o){const{latestValues:c}=s;c[n]&&(i[n]=c[n],s.setStaticValue(n,0),o&&(o[n]=0))}function hx(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:s}=n.options;if(!s)return;const i=y_(s);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:c,layoutId:u}=n.options;window.MotionCancelOptimisedAnimation(i,"transform",ft,!(c||u))}const{parent:o}=n;o&&!o.hasCheckedOptimisedAppear&&hx(o)}function gx({attachResizeListener:n,defaultParent:s,measureScroll:i,checkIsScrollRoot:o,resetTransform:c}){return class{constructor(d={},m=s==null?void 0:s()){this.id=lE++,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,dr&&($a.totalNodes=$a.resolvedTargetDeltas=$a.recalculatedProjection=0),this.nodes.forEach(dE),this.nodes.forEach(gE),this.nodes.forEach(vE),this.nodes.forEach(fE),dr&&window.MotionDebug.record($a)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,this.root=m?m.root||m:this,this.path=m?[...m.path,m]:[],this.parent=m,this.depth=m?m.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new YC)}addEventListener(d,m){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new Vp),this.eventHandlers.get(d).add(m)}notifyListeners(d,...m){const h=this.eventHandlers.get(d);h&&h.notify(...m)}hasListeners(d){return this.eventHandlers.has(d)}mount(d,m=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=ZC(d),this.instance=d;const{layoutId:h,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),m&&(g||h)&&(this.isLayoutDirty=!0),n){let b;const _=()=>this.root.updateBlockedByResize=!1;n(d,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=JC(_,250),hc.hasAnimatedSinceResize&&(hc.hasAnimatedSinceResize=!1,this.nodes.forEach(jy))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&v&&(h||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:_,hasRelativeTargetChanged:S,layout:T})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||v.getDefaultTransition()||SE,{onLayoutAnimationStart:j,onLayoutAnimationComplete:w}=v.getProps(),C=!this.targetLayout||!mx(this.targetLayout,T)||S,A=!_&&S;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||A||_&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,A);const M={...Up(N,"layout"),onPlay:j,onComplete:w};(v.shouldReduceMotion||this.options.layoutRoot)&&(M.delay=0,M.type=!1),this.startAnimation(M)}else _||jy(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=T})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const d=this.getStack();d&&d.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ma(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(yE),this.animationId++)}getTransformTemplate(){const{visualElement:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&hx(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:m,layout:h}=this.options;if(m===void 0&&!h)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),d&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ny);return}this.isUpdating||this.nodes.forEach(mE),this.isUpdating=!1,this.nodes.forEach(hE),this.nodes.forEach(cE),this.nodes.forEach(uE),this.clearAllSnapshots();const m=is.now();Kt.delta=Is(0,1e3/60,m-Kt.timestamp),Kt.timestamp=m,Kt.isProcessing=!0,df.update.process(Kt),df.preRender.process(Kt),df.render.process(Kt),Kt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Cp.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(pE),this.sharedNodes.forEach(bE)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ft.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ft.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const d=this.layout;this.layout=this.measure(!1),this.layoutCorrected=jt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:m}=this.options;m&&m.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let m=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(m=!1),m){const h=o(this.instance);this.scroll={animationId:this.root.animationId,phase:d,isRoot:h,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!c)return;const d=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,m=this.projectionDelta&&!px(this.projectionDelta),h=this.getTransformTemplate(),g=h?h(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;d&&(m||Ga(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const m=this.measurePageBox();let h=this.removeElementScroll(m);return d&&(h=this.removeTransform(h)),TE(h),{animationId:this.root.animationId,measuredBox:m,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:m}=this.options;if(!m)return jt();const h=m.measureViewportBox();if(!(((d=this.scroll)===null||d===void 0?void 0:d.wasRoot)||this.path.some(kE))){const{scroll:v}=this.root;v&&(Zi(h.x,v.offset.x),Zi(h.y,v.offset.y))}return h}removeElementScroll(d){var m;const h=jt();if(On(h,d),!((m=this.scroll)===null||m===void 0)&&m.wasRoot)return h;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&&On(h,d),Zi(h.x,b.offset.x),Zi(h.y,b.offset.y))}return h}applyTransform(d,m=!1){const h=jt();On(h,d);for(let g=0;g<this.path.length;g++){const v=this.path[g];!m&&v.options.layoutScroll&&v.scroll&&v!==v.root&&Ki(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),Ga(v.latestValues)&&Ki(h,v.latestValues)}return Ga(this.latestValues)&&Ki(h,this.latestValues),h}removeTransform(d){const m=jt();On(m,d);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!g.instance||!Ga(g.latestValues))continue;np(g.latestValues)&&g.updateSnapshot();const v=jt(),b=g.measurePageBox();On(v,b),by(m,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return Ga(this.latestValues)&&by(m,this.latestValues),m}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Kt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!1){var m;const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==h;if(!(d||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((m=this.parent)===null||m===void 0)&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:_}=this.options;if(!(!this.layout||!(b||_))){if(this.resolvedRelativeTargetAt=Kt.timestamp,!this.targetDelta&&!this.relativeTarget){const S=this.getClosestProjectingParent();S&&S.layout&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=jt(),this.relativeTargetOrigin=jt(),yr(this.relativeTargetOrigin,this.layout.layoutBox,S.layout.layoutBox),On(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=jt(),this.targetWithTransforms=jt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),jC(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):On(this.target,this.layout.layoutBox),rx(this.target,this.targetDelta)):On(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=jt(),this.relativeTargetOrigin=jt(),yr(this.relativeTargetOrigin,this.target,S.target),On(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}dr&&$a.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||np(this.parent.latestValues)||ox(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var d;const m=this.getLead(),h=!!this.resumingFrom||this!==m;let g=!0;if((this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty)&&(g=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===Kt.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;On(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,S=this.treeScale.y;BC(this.layoutCorrected,this.treeScale,this.path,h),m.layout&&!m.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(m.target=m.layout.layoutBox,m.targetWithTransforms=jt());const{target:T}=m;if(!T){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(gy(this.prevProjectionDelta.x,this.projectionDelta.x),gy(this.prevProjectionDelta.y,this.projectionDelta.y)),vr(this.projectionDelta,this.layoutCorrected,T,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==S||!ky(this.projectionDelta.x,this.prevProjectionDelta.x)||!ky(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",T)),dr&&$a.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){var m;if((m=this.options.visualElement)===null||m===void 0||m.scheduleRender(),d){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Fi(),this.projectionDelta=Fi(),this.projectionDeltaWithTransform=Fi()}setAnimationOrigin(d,m=!1){const h=this.snapshot,g=h?h.latestValues:{},v={...this.latestValues},b=Fi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!m;const _=jt(),S=h?h.source:void 0,T=this.layout?this.layout.source:void 0,N=S!==T,j=this.getStack(),w=!j||j.members.length<=1,C=!!(N&&!w&&this.options.crossfade===!0&&!this.path.some(xE));this.animationProgress=0;let A;this.mixTargetDelta=M=>{const D=M/1e3;Cy(b.x,d.x,D),Cy(b.y,d.y,D),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(yr(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),_E(this.relativeTarget,this.relativeTargetOrigin,_,D),A&&aE(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=jt()),On(A,this.relativeTarget)),N&&(this.animationValues=v,XC(v,g,this.latestValues,D,C,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=D},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ma(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ft.update(()=>{hc.hasAnimatedSinceResize=!0,this.currentAnimation=FC(0,wy,{...d,onUpdate:m=>{this.mixTargetDelta(m),d.onUpdate&&d.onUpdate(m)},onComplete:()=>{d.onComplete&&d.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const d=this.getStack();d&&d.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(wy),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:m,target:h,layout:g,latestValues:v}=d;if(!(!m||!h||!g)){if(this!==d&&this.layout&&g&&vx(this.options.animationType,this.layout.layoutBox,g.layoutBox)){h=this.target||jt();const b=xn(this.layout.layoutBox.x);h.x.min=d.target.x.min,h.x.max=h.x.min+b;const _=xn(this.layout.layoutBox.y);h.y.min=d.target.y.min,h.y.max=h.y.min+_}On(m,h),Ki(m,v),vr(this.projectionDeltaWithTransform,this.layoutCorrected,m,v)}}registerSharedNode(d,m){this.sharedNodes.has(d)||this.sharedNodes.set(d,new iE),this.sharedNodes.get(d).add(m);const g=m.options.initialPromotionConfig;m.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(m):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){var d;const{layoutId:m}=this.options;return m?((d=this.getStack())===null||d===void 0?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:m}=this.options;return m?(d=this.getStack())===null||d===void 0?void 0:d.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:m,preserveFollowOpacity:h}={}){const g=this.getStack();g&&g.promote(this,h),d&&(this.projectionDelta=void 0,this.needsReset=!0),m&&this.setOptions({transition:m})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let m=!1;const{latestValues:h}=d;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(m=!0),!m)return;const g={};h.z&&_f("z",d,g,this.animationValues);for(let v=0;v<bf.length;v++)_f(`rotate${bf[v]}`,d,g,this.animationValues),_f(`skew${bf[v]}`,d,g,this.animationValues);d.render();for(const v in g)d.setStaticValue(v,g[v]),this.animationValues&&(this.animationValues[v]=g[v]);d.scheduleRender()}getProjectionStyles(d){var m,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return rE;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=pc(d==null?void 0:d.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const b=this.getLead();if(!this.projectionDelta||!this.layout||!b.target){const N={};return this.options.layoutId&&(N.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,N.pointerEvents=pc(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!Ga(this.latestValues)&&(N.transform=v?v({},""):"none",this.hasProjected=!1),N}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=oE(this.projectionDeltaWithTransform,this.treeScale,_),v&&(g.transform=v(_,g.transform));const{x:S,y:T}=this.projectionDelta;g.transformOrigin=`${S.origin*100}% ${T.origin*100}% 0`,b.animationValues?g.opacity=b===this?(h=(m=_.opacity)!==null&&m!==void 0?m:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:_.opacityExit:g.opacity=b===this?_.opacity!==void 0?_.opacity:"":_.opacityExit!==void 0?_.opacityExit:0;for(const N in _c){if(_[N]===void 0)continue;const{correct:j,applyTo:w}=_c[N],C=g.transform==="none"?_[N]:j(_[N],b);if(w){const A=w.length;for(let M=0;M<A;M++)g[w[M]]=C}else g[N]=C}return this.options.layoutId&&(g.pointerEvents=b===this?pc(d==null?void 0:d.pointerEvents)||"":"none"),g}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>{var m;return(m=d.currentAnimation)===null||m===void 0?void 0:m.stop()}),this.root.nodes.forEach(Ny),this.root.sharedNodes.clear()}}}function cE(n){n.updateLayout()}function uE(n){var s;const i=((s=n.resumeFrom)===null||s===void 0?void 0:s.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&i&&n.hasListeners("didUpdate")){const{layoutBox:o,measuredBox:c}=n.layout,{animationType:u}=n.options,d=i.source!==n.layout.source;u==="size"?Bn(b=>{const _=d?i.measuredBox[b]:i.layoutBox[b],S=xn(_);_.min=o[b].min,_.max=_.min+S}):vx(u,i.layoutBox,o)&&Bn(b=>{const _=d?i.measuredBox[b]:i.layoutBox[b],S=xn(o[b]);_.max=_.min+S,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[b].max=n.relativeTarget[b].min+S)});const m=Fi();vr(m,o,i.layoutBox);const h=Fi();d?vr(h,n.applyTransform(c,!0),i.measuredBox):vr(h,o,i.layoutBox);const g=!px(m);let v=!1;if(!n.resumeFrom){const b=n.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:S}=b;if(_&&S){const T=jt();yr(T,i.layoutBox,_.layoutBox);const N=jt();yr(N,o,S.layoutBox),mx(T,N)||(v=!0),b.options.layoutRoot&&(n.relativeTarget=N,n.relativeTargetOrigin=T,n.relativeParent=b)}}}n.notifyListeners("didUpdate",{layout:o,snapshot:i,delta:h,layoutDelta:m,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(n.isLead()){const{onExitComplete:o}=n.options;o&&o()}n.options.transition=void 0}function dE(n){dr&&$a.totalNodes++,n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function fE(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function pE(n){n.clearSnapshot()}function Ny(n){n.clearMeasurements()}function mE(n){n.isLayoutDirty=!1}function hE(n){const{visualElement:s}=n.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),n.resetTransform()}function jy(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function gE(n){n.resolveTargetDelta()}function vE(n){n.calcProjection()}function yE(n){n.resetSkewAndRotation()}function bE(n){n.removeLeadSnapshot()}function Cy(n,s,i){n.translate=vt(s.translate,0,i),n.scale=vt(s.scale,1,i),n.origin=s.origin,n.originPoint=s.originPoint}function Ey(n,s,i,o){n.min=vt(s.min,i.min,o),n.max=vt(s.max,i.max,o)}function _E(n,s,i,o){Ey(n.x,s.x,i.x,o),Ey(n.y,s.y,i.y,o)}function xE(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const SE={duration:.45,ease:[.4,0,.1,1]},Ay=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),Dy=Ay("applewebkit/")&&!Ay("chrome/")?Math.round:_n;function Ry(n){n.min=Dy(n.min),n.max=Dy(n.max)}function TE(n){Ry(n.x),Ry(n.y)}function vx(n,s,i){return n==="position"||n==="preserve-aspect"&&!NC(Ty(s),Ty(i),.2)}function kE(n){var s;return n!==n.root&&((s=n.scroll)===null||s===void 0?void 0:s.wasRoot)}const wE=gx({attachResizeListener:(n,s)=>Nr(n,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),xf={current:void 0},yx=gx({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!xf.current){const n=new wE({});n.mount(window),n.setOptions({layoutScroll:!0}),xf.current=n}return xf.current},resetTransform:(n,s)=>{n.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),NE={pan:{Feature:HC},drag:{Feature:VC,ProjectionNode:yx,MeasureLayout:ux}};function jE(n,s,i){var o;if(n instanceof Element)return[n];if(typeof n=="string"){let c=document;const u=(o=void 0)!==null&&o!==void 0?o:c.querySelectorAll(n);return u?Array.from(u):[]}return Array.from(n)}function bx(n,s){const i=jE(n),o=new AbortController,c={passive:!0,...s,signal:o.signal};return[i,c,()=>o.abort()]}function My(n){return s=>{s.pointerType==="touch"||ex()||n(s)}}function CE(n,s,i={}){const[o,c,u]=bx(n,i),d=My(m=>{const{target:h}=m,g=s(m);if(typeof g!="function"||!h)return;const v=My(b=>{g(b),h.removeEventListener("pointerleave",v)});h.addEventListener("pointerleave",v,c)});return o.forEach(m=>{m.addEventListener("pointerenter",d,c)}),u}function Oy(n,s,i){const{props:o}=n;n.animationState&&o.whileHover&&n.animationState.setActive("whileHover",i==="Start");const c="onHover"+i,u=o[c];u&&ft.postRender(()=>u(s,Mr(s)))}class EE extends ya{mount(){const{current:s}=this.node;s&&(this.unmount=CE(s,i=>(Oy(this.node,i,"Start"),o=>Oy(this.node,o,"End"))))}unmount(){}}class AE extends ya{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=Rr(Nr(this.node.current,"focus",()=>this.onFocus()),Nr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const _x=(n,s)=>s?n===s?!0:_x(n,s.parentElement):!1,DE=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function RE(n){return DE.has(n.tagName)||n.tabIndex!==-1}const fr=new WeakSet;function Iy(n){return s=>{s.key==="Enter"&&n(s)}}function Sf(n,s){n.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const ME=(n,s)=>{const i=n.currentTarget;if(!i)return;const o=Iy(()=>{if(fr.has(i))return;Sf(i,"down");const c=Iy(()=>{Sf(i,"up")}),u=()=>Sf(i,"cancel");i.addEventListener("keyup",c,s),i.addEventListener("blur",u,s)});i.addEventListener("keydown",o,s),i.addEventListener("blur",()=>i.removeEventListener("keydown",o),s)};function By(n){return em(n)&&!ex()}function OE(n,s,i={}){const[o,c,u]=bx(n,i),d=m=>{const h=m.currentTarget;if(!By(m)||fr.has(h))return;fr.add(h);const g=s(m),v=(S,T)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!By(S)||!fr.has(h))&&(fr.delete(h),typeof g=="function"&&g(S,{success:T}))},b=S=>{v(S,i.useGlobalTarget||_x(h,S.target))},_=S=>{v(S,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return o.forEach(m=>{!RE(m)&&m.getAttribute("tabindex")===null&&(m.tabIndex=0),(i.useGlobalTarget?window:m).addEventListener("pointerdown",d,c),m.addEventListener("focus",g=>ME(g,c),c)}),u}function Ly(n,s,i){const{props:o}=n;n.animationState&&o.whileTap&&n.animationState.setActive("whileTap",i==="Start");const c="onTap"+(i==="End"?"":i),u=o[c];u&&ft.postRender(()=>u(s,Mr(s)))}class IE extends ya{mount(){const{current:s}=this.node;s&&(this.unmount=OE(s,i=>(Ly(this.node,i,"Start"),(o,{success:c})=>Ly(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const ap=new WeakMap,Tf=new WeakMap,BE=n=>{const s=ap.get(n.target);s&&s(n)},LE=n=>{n.forEach(BE)};function UE({root:n,...s}){const i=n||document;Tf.has(i)||Tf.set(i,{});const o=Tf.get(i),c=JSON.stringify(s);return o[c]||(o[c]=new IntersectionObserver(LE,{root:n,...s})),o[c]}function zE(n,s,i){const o=UE(s);return ap.set(n,i),o.observe(n),()=>{ap.delete(n),o.unobserve(n)}}const PE={some:0,all:1};class VE extends ya{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:i,margin:o,amount:c="some",once:u}=s,d={root:i?i.current:void 0,rootMargin:o,threshold:typeof c=="number"?c:PE[c]},m=h=>{const{isIntersecting:g}=h;if(this.isInView===g||(this.isInView=g,u&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:b}=this.node.getProps(),_=g?v:b;_&&_(h)};return zE(this.node.current,d,m)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:i}=this.node;["amount","margin","root"].some(HE(s,i))&&this.startObserver()}unmount(){}}function HE({viewport:n={}},{viewport:s={}}={}){return i=>n[i]!==s[i]}const qE={inView:{Feature:VE},tap:{Feature:IE},focus:{Feature:AE},hover:{Feature:EE}},GE={layout:{ProjectionNode:yx,MeasureLayout:ux}},Nc={current:null},tm={current:!1};function xx(){if(tm.current=!0,!!kp)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),s=()=>Nc.current=n.matches;n.addListener(s),s()}else Nc.current=!1}const $E=[...H_,Xt,ha],FE=n=>$E.find(V_(n)),Uy=new WeakMap;function ZE(n,s,i){for(const o in s){const c=s[o],u=i[o];if(Qt(c))n.addValue(o,c);else if(Qt(u))n.addValue(o,kr(c,{owner:n}));else if(u!==c)if(n.hasValue(o)){const d=n.getValue(o);d.liveStyle===!0?d.jump(c):d.hasAnimated||d.set(c)}else{const d=n.getStaticValue(o);n.addValue(o,kr(d!==void 0?d:c,{owner:n}))}}for(const o in i)s[o]===void 0&&n.removeValue(o);return s}const zy=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class KE{scrapeMotionValuesFromProps(s,i,o){return{}}constructor({parent:s,props:i,presenceContext:o,reducedMotionConfig:c,blockInitialAnimation:u,visualState:d},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Jp,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=is.now();this.renderScheduledAt<S&&(this.renderScheduledAt=S,ft.render(this.render,!1,!0))};const{latestValues:h,renderState:g,onUpdate:v}=d;this.onUpdate=v,this.latestValues=h,this.baseTarget={...h},this.initialValues=i.initial?{...h}:{},this.renderState=g,this.parent=s,this.props=i,this.presenceContext=o,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=m,this.blockInitialAnimation=!!u,this.isControllingVariants=zc(i),this.isVariantNode=e_(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,..._}=this.scrapeMotionValuesFromProps(i,{},this);for(const S in _){const T=_[S];h[S]!==void 0&&Qt(T)&&T.set(h[S],!1)}}mount(s){this.current=s,Uy.set(s,this),this.projection&&!this.projection.instance&&this.projection.mount(s),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,o)=>this.bindToMotionValue(o,i)),tm.current||xx(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Nc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Uy.delete(this.current),this.projection&&this.projection.unmount(),ma(this.notifyUpdate),ma(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const i=this.features[s];i&&(i.unmount(),i.isMounted=!1)}this.current=null}bindToMotionValue(s,i){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const o=ti.has(s),c=i.on("change",m=>{this.latestValues[s]=m,this.props.onUpdate&&ft.preRender(this.notifyUpdate),o&&this.projection&&(this.projection.isTransformDirty=!0)}),u=i.on("renderRequest",this.scheduleRender);let d;window.MotionCheckAppearSync&&(d=window.MotionCheckAppearSync(this,s,i)),this.valueSubscriptions.set(s,()=>{c(),u(),d&&d(),i.owner&&i.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in eo){const i=eo[s];if(!i)continue;const{isEnabled:o,Feature:c}=i;if(!this.features[s]&&c&&o(this.props)&&(this.features[s]=new c(this)),this.features[s]){const u=this.features[s];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):jt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,i){this.latestValues[s]=i}update(s,i){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let o=0;o<zy.length;o++){const c=zy[o];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const u="on"+c,d=s[u];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=ZE(this,this.scrapeMotionValuesFromProps(s,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(s){return this.props.variants?this.props.variants[s]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(s){const i=this.getClosestVariantNode();if(i)return i.variantChildren&&i.variantChildren.add(s),()=>i.variantChildren.delete(s)}addValue(s,i){const o=this.values.get(s);i!==o&&(o&&this.removeValue(s),this.bindToMotionValue(s,i),this.values.set(s,i),this.latestValues[s]=i.get())}removeValue(s){this.values.delete(s);const i=this.valueSubscriptions.get(s);i&&(i(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,i){if(this.props.values&&this.props.values[s])return this.props.values[s];let o=this.values.get(s);return o===void 0&&i!==void 0&&(o=kr(i===null?void 0:i,{owner:this}),this.addValue(s,o)),o}readValue(s,i){var o;let c=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:(o=this.getBaseTargetFromProps(this.props,s))!==null&&o!==void 0?o:this.readValueFromInstance(this.current,s,this.options);return c!=null&&(typeof c=="string"&&(z_(c)||A_(c))?c=parseFloat(c):!FE(c)&&ha.test(i)&&(c=B_(s,i)),this.setBaseTarget(s,Qt(c)?c.get():c)),Qt(c)?c.get():c}setBaseTarget(s,i){this.baseTarget[s]=i}getBaseTarget(s){var i;const{initial:o}=this.props;let c;if(typeof o=="string"||typeof o=="object"){const d=Ap(this.props,o,(i=this.presenceContext)===null||i===void 0?void 0:i.custom);d&&(c=d[s])}if(o&&c!==void 0)return c;const u=this.getBaseTargetFromProps(this.props,s);return u!==void 0&&!Qt(u)?u:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,i){return this.events[s]||(this.events[s]=new Vp),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class Sx extends KE{constructor(){super(...arguments),this.KeyframeResolver=q_}sortInstanceNodePosition(s,i){return s.compareDocumentPosition(i)&2?1:-1}getBaseTargetFromProps(s,i){return s.style?s.style[i]:void 0}removeValueFromRenderState(s,{vars:i,style:o}){delete i[s],delete o[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;Qt(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function YE(n){return window.getComputedStyle(n)}class JE extends Sx{constructor(){super(...arguments),this.type="html",this.renderInstance=c_}readValueFromInstance(s,i){if(ti.has(i)){const o=Yp(i);return o&&o.default||0}else{const o=YE(s),c=(o_(i)?o.getPropertyValue(i):o[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return lx(s,i)}build(s,i,o){Mp(s,i,o.transformTemplate)}scrapeMotionValuesFromProps(s,i,o){return Lp(s,i,o)}}class WE extends Sx{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=jt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(ti.has(i)){const o=Yp(i);return o&&o.default||0}return i=u_.has(i)?i:jp(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,o){return p_(s,i,o)}build(s,i,o){Op(s,i,this.isSVGTag,o.transformTemplate)}renderInstance(s,i,o,c){d_(s,i,o,c)}mount(s){this.isSVGTag=Bp(s.tagName),super.mount(s)}}const XE=(n,s)=>Ep(n)?new WE(s):new JE(s,{allowProjection:n!==y.Fragment}),QE=wN({...gC,...qE,...NE,...GE},XE),Ot=Pw(QE);function eA(){!tm.current&&xx();const[n]=y.useState(Nc.current);return n}const ip={not_started:{color:"var(--text-tertiary)",icon:"○",label:"Not Started"},working:{color:"var(--accent-green)",icon:"●",label:"Working"},paused:{color:"var(--accent-yellow)",icon:"◉",label:"Paused"},complete:{color:"var(--accent-green)",icon:"✓",label:"Complete"},failed:{color:"var(--accent-red)",icon:"✗",label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:"⦸",label:"Blocked"}};function ga(n){return n==="blocked"?ip.blocked:ip[nm(n)]}const tA={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function nA(n){return tA[nm(n)]??"statusPending"}const sA=["working","paused","failed","not_started","blocked","complete"],Py=["not_started","working","paused","complete","failed"],aA={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function nm(n){return n in ip&&n!=="blocked"?n:aA[n]??"not_started"}const iA={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"};function oA(n){if(n.length===0)return[];const s=[...n].sort((o,c)=>o[0]-c[0]),i=[[s[0][0],s[0][1]]];for(let o=1;o<s.length;o++){const c=i[i.length-1],[u,d]=s[o];u<=c[1]+1?c[1]=Math.max(c[1],d):i.push([u,d])}return i}function Tx({text:n,indices:s,highlightClass:i}){if(!s||s.length===0)return l.jsx(l.Fragment,{children:n});const o=oA(s),c=[];let u=0;for(const[d,m]of o)d>u&&c.push(l.jsx("span",{children:n.slice(u,d)},`p${u}`)),c.push(l.jsx("mark",{className:i,children:n.slice(d,m+1)},`m${d}`)),u=m+1;return u<n.length&&c.push(l.jsx("span",{children:n.slice(u)},`p${u}`)),l.jsx(l.Fragment,{children:c})}function rA(n){const s=new Map(n.map(o=>[o.id,{...o,children:[]}])),i=[];for(const o of s.values())o.parentTaskId&&s.has(o.parentTaskId)?s.get(o.parentTaskId).children.push(o):i.push(o);for(const o of s.values())o.children.sort((c,u)=>c.sortOrder-u.sortOrder);return i.sort((o,c)=>o.sortOrder-c.sortOrder)}function lA(n,s){const i=new Map;for(const u of n){const m=u.dependsOn.length>0&&u.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":u.status,h=i.get(m);h?h.push(u):i.set(m,[u])}const o=[],c=new Set;for(const u of sA){c.add(u);const d=i.get(u);if(d&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const m=ga(u);o.push({status:u,label:m.label,style:m,tasks:d})}}for(const[u,d]of i)if(!c.has(u)&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const m=ga(u);o.push({status:u,label:m.label,style:m,tasks:d})}return o}const cA="_container_z4i38_1",uA="_header_z4i38_5",dA="_headerActions_z4i38_17",fA="_searchInput_z4i38_23",pA="_searchHighlight_z4i38_56",mA="_groupToggle_z4i38_62",hA="_groupToggleActive_z4i38_89",gA="_addButton_z4i38_93",vA="_taskRow_z4i38_120",yA="_selected_z4i38_140",bA="_expandArrow_z4i38_150",_A="_expanded_z4i38_157",xA="_leafSpacer_z4i38_161",SA="_taskStatusIcon_z4i38_166",TA="_taskTitle_z4i38_170",kA="_workspaceBadge_z4i38_177",wA="_childCountBadge_z4i38_195",NA="_dependencyBadge_z4i38_208",jA="_blockedBadge_z4i38_220",CA="_addChildButton_z4i38_225",EA="_emptyState_z4i38_268",AA="_statusGroupHeader_z4i38_275",DA="_statusGroupIcon_z4i38_294",RA="_statusGroupLabel_z4i38_298",MA="_statusGroupCount_z4i38_303",Ge={container:cA,header:uA,headerActions:dA,searchInput:fA,searchHighlight:pA,groupToggle:mA,groupToggleActive:hA,addButton:gA,taskRow:vA,selected:yA,expandArrow:bA,expanded:_A,leafSpacer:xA,taskStatusIcon:SA,taskTitle:TA,workspaceBadge:kA,childCountBadge:wA,dependencyBadge:NA,blockedBadge:jA,addChildButton:CA,emptyState:EA,statusGroupHeader:AA,statusGroupIcon:DA,statusGroupLabel:RA,statusGroupCount:MA},OA=[{name:"title",weight:2},{name:"description",weight:1}],kx=16,IA=16,wx="grackle-task-group-by-status";function Vy(){try{return localStorage.getItem(wx)==="true"}catch{return!1}}function BA(n){try{localStorage.setItem(wx,String(n))}catch{}}function LA({group:n,isExpanded:s,onToggle:i,selectedTaskId:o,navigate:c,titleHighlights:u,workspaceNames:d}){return l.jsxs("div",{"data-testid":`status-group-${n.status}`,children:[l.jsxs("div",{className:Ge.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:i,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),i())},children:[l.jsx("span",{className:`${Ge.expandArrow} ${s?Ge.expanded:""}`,children:"▸"}),l.jsx("span",{className:Ge.statusGroupIcon,style:{color:n.style.color},children:n.style.icon}),l.jsx("span",{className:Ge.statusGroupLabel,children:n.label}),l.jsx("span",{className:Ge.statusGroupCount,children:n.tasks.length})]}),l.jsx(rs,{children:s&&l.jsx(Ot.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:n.tasks.map(m=>{const h=ga(m.status),g=o===m.id,v=m.parentTaskId||!m.workspaceId?void 0:d.get(m.workspaceId);return l.jsxs("div",{onClick:()=>c(os(m.id)),className:`${Ge.taskRow} ${g?Ge.selected:""}`,style:{"--task-indent":`${kx}px`},"data-task-id":m.id,children:[l.jsx("span",{className:Ge.leafSpacer}),l.jsx("span",{className:Ge.taskStatusIcon,style:{color:h.color},children:h.icon}),l.jsx("span",{className:Ge.taskTitle,title:m.title,children:l.jsx(Tx,{text:m.title,indices:u.get(m.id),highlightClass:Ge.searchHighlight})}),v&&l.jsx("span",{className:Ge.workspaceBadge,title:v,children:v})]},m.id)})})})]})}function Nx({node:n,depth:s,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:m,workspaceNames:h}){const g=ga(n.status),v=n.dependsOn.length>0&&n.dependsOn.some(w=>d.get(w)!=="complete"),b=i.has(n.id),_=n.children.length>0,S=c===n.id,T=kx+s*IA,j=s===0&&!n.parentTaskId&&n.workspaceId?h.get(n.workspaceId):void 0;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{onClick:()=>u(os(n.id)),className:`${Ge.taskRow} ${S?Ge.selected:""}`,style:{"--task-indent":`${T}px`},"data-task-id":n.id,children:[_&&l.jsx("span",{className:`${Ge.expandArrow} ${b?Ge.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:w=>{w.stopPropagation(),o(n.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),w.stopPropagation(),o(n.id))},children:"▸"}),!_&&l.jsx("span",{className:Ge.leafSpacer}),l.jsx("span",{className:Ge.taskStatusIcon,style:{color:g.color},children:g.icon}),l.jsx("span",{className:Ge.taskTitle,title:n.title,children:l.jsx(Tx,{text:n.title,indices:m.get(n.id),highlightClass:Ge.searchHighlight})}),j&&l.jsx("span",{className:Ge.workspaceBadge,title:j,children:j}),_&&l.jsxs("span",{className:Ge.childCountBadge,children:[n.children.filter(w=>w.status==="complete").length,"/",n.children.length]}),n.dependsOn.length>0&&l.jsx("span",{className:`${Ge.dependencyBadge} ${v?Ge.blockedBadge:""}`,title:`Depends on: ${n.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<mT&&l.jsx("button",{onClick:w=>{w.stopPropagation(),u(ei(n.workspaceId,n.id))},title:"Add child task","aria-label":"Add child task",className:Ge.addChildButton,children:"+"})]}),l.jsx(rs,{children:_&&b&&l.jsx(Ot.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:n.children.map(w=>l.jsx(Nx,{node:w,depth:s+1,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:m,workspaceNames:h},w.id))})})]})}function UA({workspaces:n,tasks:s}){const i=St(),[o,c]=y.useState(new Set),[u,d]=y.useState(new Set),[m,h]=y.useState(Vy),[g,v]=y.useState(Vy),[b,_]=y.useState(new Map),S=Mt("/tasks/:taskId/*"),T=(S==null?void 0:S.params.taskId)!=="new"?S==null?void 0:S.params.taskId:void 0,N=y.useMemo(()=>new Map(s.map(oe=>[oe.id,oe.status])),[s]),j=y.useMemo(()=>new Map(n.map(oe=>[oe.id,oe.name])),[n]),w=()=>{const oe=!m;BA(oe),h(oe),oe&&(v(!0),_(new Map))},C=oe=>{_(X=>{const B=new Map(X),$=B.has(oe)?B.get(oe):g;return B.set(oe,!$),B})},A=oe=>b.has(oe)?b.get(oe):g,M=oe=>{c(X=>{const B=new Set(X);return B.has(oe)?(B.delete(oe),d($=>new Set($).add(oe))):(B.add(oe),d($=>{const te=new Set($);return te.delete(oe),te})),B})};y.useEffect(()=>{const oe=new Set(s.filter(X=>X.parentTaskId).map(X=>X.parentTaskId));oe.size>0&&c(X=>{const B=new Set(X);for(const $ of oe)u.has($)||B.add($);return B})},[s,u]);const[D,E]=y.useState(""),{directMatchTaskIds:H,treeMatchTaskIds:z,titleHighlights:Z}=y.useMemo(()=>{if(!D.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const oe=pT(s,D,OA),X=new Set(oe.map(re=>re.item.id)),B=new Map;for(const re of oe){const de=re.matches.find($e=>$e.key==="title");de&&B.set(re.item.id,de.indices)}const $=new Set(X),te=new Map(s.map(re=>[re.id,re]));for(const re of[...X]){let de=te.get(re);for(;de!=null&&de.parentTaskId;)$.add(de.parentTaskId),de=te.get(de.parentTaskId)}return{directMatchTaskIds:X,treeMatchTaskIds:$,titleHighlights:B}},[D,s]),F=H!==null,Q=F?m?H:z:null,ae=Q?s.filter(oe=>Q.has(oe.id)):s,pe=m?[]:rA(ae);return l.jsxs("div",{className:Ge.container,children:[l.jsxs("div",{className:Ge.header,children:[l.jsx("span",{children:"Tasks"}),l.jsxs("div",{className:Ge.headerActions,children:[l.jsx("button",{className:`${Ge.groupToggle} ${m?Ge.groupToggleActive:""}`,onClick:w,"aria-label":m?"Switch to tree view":"Group tasks by status","aria-pressed":m,title:m?"Switch to tree view":"Group tasks by status","data-testid":"task-group-by-status-toggle",children:"≡"}),l.jsx("button",{className:Ge.addButton,onClick:()=>i(ei()),"aria-label":"New task",title:"New task","data-testid":"new-task-button",children:"+"})]})]}),s.length>0&&l.jsx("input",{type:"text",value:D,onChange:oe=>E(oe.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Ge.searchInput,"data-testid":"sidebar-search"}),m?lA(ae,N).map(oe=>l.jsx(LA,{group:oe,isExpanded:A(oe.status),onToggle:()=>C(oe.status),selectedTaskId:T,navigate:i,titleHighlights:Z,workspaceNames:j},oe.status)):pe.map(oe=>l.jsx(Nx,{node:oe,depth:0,expandedTasks:o,toggleTask:M,selectedTaskId:T,navigate:i,taskStatusById:N,titleHighlights:Z,workspaceNames:j},oe.id)),ae.length===0&&!F&&l.jsx("div",{className:Ge.emptyState,children:"No tasks yet. Click + to create one."}),ae.length===0&&F&&l.jsx("div",{className:Ge.emptyState,children:"No matching tasks"})]})}const zA="_nav_14i94_1",PA="_tab_14i94_24",VA="_tabActive_14i94_62",HA="_tabLabel_14i94_75",qA="_statusDot_14i94_81",GA="_pulse_14i94_87",$A="_addButton_14i94_99",FA="_empty_14i94_132",ua={nav:zA,tab:PA,tabActive:VA,tabLabel:HA,statusDot:qA,pulse:GA,addButton:$A,empty:FA},ZA={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function KA({environments:n}){const s=St(),i=y.useRef(null),o=Mt("/environments/:environmentId"),c=Mt("/environments/:environmentId/edit"),u=Mt("/environments/:environmentId/workspaces/:workspaceId"),d=Mt("/environments/:environmentId/workspaces/:workspaceId/*"),m=(o==null?void 0:o.params.environmentId)??(c==null?void 0:c.params.environmentId)??(u==null?void 0:u.params.environmentId)??(d==null?void 0:d.params.environmentId),h=m==="new"?void 0:m,g=y.useCallback(_=>{s(Qi(_))},[s]),v=y.useCallback(_=>{var w;const S=(w=i.current)==null?void 0:w.querySelectorAll('[role="tab"]');if(!S||S.length===0)return;const T=Array.from(S).findIndex(C=>C===document.activeElement),N=T>=0?T:n.findIndex(C=>C.id===h);let j=N;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),j=(N+1)%S.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),j=(N-1+S.length)%S.length;else if(_.key==="Home")_.preventDefault(),j=0;else if(_.key==="End")_.preventDefault(),j=S.length-1;else return;j<n.length&&s(Qi(n[j].id)),S[j].focus()},[h,n,s]),b=h??(n.length>0?n[0].id:void 0);return l.jsxs("div",{className:ua.nav,"data-testid":"environment-nav",children:[l.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:n.map(_=>{const S=_.id===h,T=_.id===b,N=ZA[_.status]||"var(--text-tertiary)",j=_.status==="connected";return l.jsxs("button",{role:"tab",type:"button","aria-selected":S,tabIndex:T?0:-1,className:`${ua.tab} ${S?ua.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[l.jsx("span",{className:`${ua.statusDot} ${j?ua.pulse:""}`,style:{color:N},children:"●"}),l.jsx("span",{className:ua.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),l.jsx("button",{type:"button",className:ua.addButton,onClick:()=>s(o2),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),n.length===0&&l.jsx("div",{className:ua.empty,children:"No environments yet."})]})}const YA="_nav_1bhou_1",JA="_tab_1bhou_24",WA="_tabIcon_1bhou_62",XA="_tabActive_1bhou_68",ic={nav:YA,tab:JA,tabIcon:WA,tabActive:XA},Cs=[{path:"credentials",label:"Credentials",icon:"🔑"},{path:"personas",label:"Personas",icon:"👤"},{path:"appearance",label:"Appearance",icon:"🎨"},{path:"shortcuts",label:"Shortcuts",icon:"⌨️"},{path:"about",label:"About",icon:"ℹ️"}];function QA(){var d;const n=Lt(),s=St(),i=y.useRef(null),o=((d=Cs.find(m=>{const h=`${Ji}/${m.path}`;return n.pathname===h||n.pathname.startsWith(`${h}/`)}))==null?void 0:d.path)??Cs[0].path,c=y.useCallback(m=>{s(`${Ji}/${m}`)},[s]),u=y.useCallback(m=>{var S,T;const h=(S=i.current)==null?void 0:S.querySelectorAll('[role="tab"]');if(!h)return;const g=Array.from(h).findIndex(N=>N===document.activeElement),v=g>=0?g:Cs.findIndex(N=>N.path===o);let b=v;if(m.key==="ArrowDown"||m.key==="j"||m.key==="J")m.preventDefault(),b=(v+1)%Cs.length;else if(m.key==="ArrowUp"||m.key==="k"||m.key==="K")m.preventDefault(),b=(v-1+Cs.length)%Cs.length;else if(m.key==="Home")m.preventDefault(),b=0;else if(m.key==="End")m.preventDefault(),b=Cs.length-1;else return;const _=Cs[b].path;s(`${Ji}/${_}`),(T=h[b])==null||T.focus()},[o,s]);return l.jsx("nav",{className:ic.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:Cs.map(m=>{const h=m.path===o;return l.jsxs("button",{role:"tab",type:"button","aria-selected":h,tabIndex:h?0:-1,className:`${ic.tab} ${h?ic.tabActive:""}`,onClick:()=>c(m.path),children:[l.jsx("span",{className:ic.tabIcon,"aria-hidden":"true",children:m.icon}),m.label]},m.path)})})}const eD="_nav_1snmp_1",tD="_searchForm_1snmp_8",nD="_searchInput_1snmp_15",sD="_searchButton_1snmp_33",aD="_clearButton_1snmp_68",iD="_workspaceSelect_1snmp_85",oD="_listHeader_1snmp_99",rD="_nodeList_1snmp_108",lD="_nodeItem_1snmp_116",cD="_indicator_1snmp_129",uD="_label_1snmp_136",dD="_badge_1snmp_145",In={nav:eD,searchForm:tD,searchInput:nD,searchButton:sD,clearButton:aD,workspaceSelect:iD,listHeader:oD,nodeList:rD,nodeItem:lD,indicator:cD,label:uD,badge:dD};function fD({nodes:n,workspaces:s,loading:i,searchQuery:o,onSearch:c,onClearSearch:u,onSelectNode:d,onWorkspaceChange:m}){const[h,g]=y.useState(""),v=y.useCallback(T=>{T.preventDefault(),h.trim()&&c(h.trim())},[h,c]),b=y.useCallback(()=>{g(""),u()},[u]),_=y.useCallback(T=>{d(T)},[d]),S=y.useCallback(T=>{g(""),m(T)},[m]);return l.jsxs("div",{className:In.nav,"data-testid":"knowledge-nav",children:[l.jsxs("form",{className:In.searchForm,onSubmit:v,children:[l.jsx("input",{className:In.searchInput,type:"text",placeholder:"Search...",value:h,onChange:T=>{g(T.target.value)},"data-testid":"knowledge-search-input"}),l.jsx("button",{type:"submit",className:In.searchButton,disabled:i,children:"Go"})]}),o&&l.jsx("button",{type:"button",className:In.clearButton,onClick:b,children:"Clear search"}),l.jsxs("select",{className:In.workspaceSelect,onChange:T=>{S(T.target.value)},"data-testid":"knowledge-workspace-filter",children:[l.jsx("option",{value:"",children:"All workspaces"}),s.map(T=>l.jsx("option",{value:T.id,children:T.name},T.id))]}),l.jsxs("div",{className:In.listHeader,children:["Nodes (",n.length,")"]}),l.jsx("ul",{className:In.nodeList,children:n.map(T=>l.jsxs("li",{className:In.nodeItem,onClick:()=>{_(T.id)},onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),_(T.id))},role:"button",tabIndex:0,children:[l.jsx("span",{className:In.indicator,style:{backgroundColor:T.kind==="reference"?"#4A9EFF":T.category==="decision"?"#22C55E":T.category==="concept"?"#A855F7":T.category==="snippet"?"#6B7280":"#EAB308"}}),l.jsx("span",{className:In.label,children:T.label}),l.jsx("span",{className:In.badge,children:T.kind==="reference"?T.sourceType:T.category})]},T.id))})]})}function pD(){const{workspaces:n,tasks:s}=pt(),i=y.useMemo(()=>l.jsx(UA,{workspaces:n,tasks:s}),[n,s]);return Ic(i),l.jsx(Qa,{})}function mD(){const{environments:n}=pt(),s=y.useMemo(()=>l.jsx(KA,{environments:n}),[n]);return Ic(s),l.jsx(Qa,{})}function hD(){const n=y.useMemo(()=>l.jsx(QA,{}),[]);return Ic(n),l.jsx(Qa,{})}function gD(){const{knowledge:n,workspaces:s}=pt(),i=y.useCallback(m=>{n.search(m)},[n]),o=y.useCallback(()=>{n.clearSearch()},[n]),c=y.useCallback(m=>{n.selectNode(m)},[n]),u=y.useCallback(m=>{n.loadRecent(m||void 0)},[n]),d=y.useMemo(()=>l.jsx(fD,{nodes:n.graphData.nodes,workspaces:s,loading:n.loading,searchQuery:n.searchQuery,onSearch:i,onClearSearch:o,onSelectNode:c,onWorkspaceChange:u}),[n,s,i,o,c,u]);return Ic(d),l.jsx(Qa,{})}const vD="_bar_tnfsh_1",yD="_btnPrimary_tnfsh_32",bD="_statusText_tnfsh_85",_D="_statusCompleted_tnfsh_90",xD="_statusFailed_tnfsh_94",SD="_statusBlocked_tnfsh_98",TD="_hintText_tnfsh_103",ht={bar:vD,btnPrimary:yD,statusText:bD,statusCompleted:_D,statusFailed:xD,statusBlocked:SD,hintText:TD};function kD({sessions:n,tasks:s,environments:i}){const o=St(),c=Lt(),u=Mt("/sessions/:sessionId"),d=Mt("/tasks/:taskId"),m=Mt("/tasks/:taskId/stream"),h=Mt("/tasks/:taskId/findings"),g=Mt("/tasks/:taskId/edit"),v=Mt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=Mt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),_=Mt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),S=Mt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),T=Mt("/sessions/new"),N=Mt("/environments/:environmentId/workspaces/:workspaceId"),j=Mt("/tasks/new"),w=Mt("/chat"),C=Mt("/"),A=Mt("/settings/*"),M=u==null?void 0:u.params.sessionId,D=(d==null?void 0:d.params.taskId)??(m==null?void 0:m.params.taskId)??(h==null?void 0:h.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),E=v??b??_??S,H=(E==null?void 0:E.params.environmentId)??(N==null?void 0:N.params.environmentId),z=c.pathname.startsWith("/environments")&&!N&&!E,Z=!!w,F=!!T,Q=!!N&&!v&&!b&&!_&&!S,ae=!!j;if(!!C&&!F&&!Q&&!ae||!!A||(!!g||!!S)||ae||z||F)return l.jsx(l.Fragment,{});if(Z)return i.find($=>$.adapterType==="local"&&$.status==="connected")?l.jsx(l.Fragment,{}):l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Add a local environment to start chatting"})});if(Q)return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Select a task or click + to create one"})});if(D){const B=s.find(re=>re.id===D);if(!B)return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Loading..."})});const $=new Map(s.map(re=>[re.id,re])),te=B.dependsOn.some(re=>{const de=$.get(re);return de!==void 0&&de.status!=="complete"});if(B.status==="not_started"){const re=te?B.dependsOn.map(de=>$.get(de)).filter(de=>de&&de.status!=="complete").map(de=>de.title):[];return l.jsx("div",{className:ht.bar,children:te?l.jsxs("span",{className:ht.statusBlocked,children:["Blocked by: ",re.join(", ")]}):l.jsx("span",{className:ht.hintText,children:"Use the buttons above to start or manage this task"})})}if(B.status==="working"||B.status==="paused"){const re=B.latestSessionId||void 0,de=re?n.find(we=>we.id===re):void 0;return de&&de.status!=="stopped"?l.jsx(l.Fragment,{}):l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Waiting for agent..."})})}if(B.status==="complete")return l.jsxs("div",{className:ht.bar,children:[l.jsx("span",{className:`${ht.statusText} ${ht.statusCompleted}`,children:"Task completed"}),l.jsx("button",{onClick:()=>o(ei(B.workspaceId,void 0,H)),className:ht.btnPrimary,children:"+ New Task"})]});if(B.status==="failed")return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:`${ht.statusText} ${ht.statusFailed}`,children:"Task failed"})})}if(M){const B=n.find(re=>re.id===M),$=(B==null?void 0:B.status)==="stopped";if(B!==void 0&&!$)return l.jsx(l.Fragment,{});if($)return l.jsxs("div",{className:ht.bar,children:[l.jsxs("span",{className:`${ht.statusText} ${ht.hintText}`,children:["Session ",B.endReason||B.status]}),l.jsx("button",{onClick:()=>o(Cb(B.environmentId)),className:ht.btnPrimary,children:"+ New Chat"})]})}return l.jsx("div",{className:ht.bar,children:l.jsx("span",{className:ht.hintText,children:"Loading..."})})}const wD="_toast_da8ll_1",ND="_success_da8ll_18",jD="_icon_da8ll_22",CD="_error_da8ll_25",ED="_warning_da8ll_32",AD="_info_da8ll_38",DD="_message_da8ll_53",RD="_close_da8ll_60",rr={toast:wD,success:ND,icon:jD,error:CD,warning:ED,info:AD,message:DD,close:RD},MD={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function OD({toast:n,onDismiss:s}){return y.useEffect(()=>{const i=setTimeout(()=>s(n.id),n.duration);return()=>clearTimeout(i)},[n.id,n.duration,s]),l.jsxs(Ot.div,{className:`${rr.toast} ${rr[n.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:[l.jsx("span",{className:rr.icon,"aria-hidden":"true",children:MD[n.variant]}),l.jsx("span",{className:rr.message,children:n.message}),l.jsx("button",{type:"button",className:rr.close,onClick:()=>s(n.id),"aria-label":"Dismiss notification",children:"×"})]})}const ID="_container_qqse2_1",BD={container:ID};function LD({toasts:n,onDismiss:s}){return l.jsx("div",{className:BD.container,"data-testid":"toast-container",children:l.jsx(rs,{children:n.map(i=>l.jsx(OD,{toast:i,onDismiss:s},i.id))})})}const UD="_callout_1jaue_1",zD="_success_1jaue_11",PD="_icon_1jaue_15",VD="_error_1jaue_18",HD="_warning_1jaue_25",qD="_info_1jaue_32",GD="_content_1jaue_48",$D="_close_1jaue_53",lr={callout:UD,success:zD,icon:PD,error:VD,warning:HD,info:qD,content:GD,close:$D},FD={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function ZD({variant:n="info",children:s,dismissible:i=!1,className:o}){const[c,u]=y.useState(!1);return l.jsx(l.Fragment,{children:!c&&l.jsxs("div",{className:[lr.callout,lr[n],o].filter(Boolean).join(" "),role:n==="error"||n==="warning"?"alert":"status",children:[l.jsx("span",{className:lr.icon,"aria-hidden":"true",children:FD[n]}),l.jsx("span",{className:lr.content,children:s}),i&&l.jsx("button",{type:"button",className:lr.close,onClick:()=>u(!0),"aria-label":"Dismiss",children:"×"})]})})}const KD="_breadcrumbs_17or2_1",YD="_list_17or2_11",JD="_item_17or2_21",WD="_separator_17or2_28",XD="_link_17or2_34",QD="_current_17or2_57",Hi={breadcrumbs:KD,list:YD,item:JD,separator:WD,link:XD,current:QD},eR="›";function ba({segments:n}){return l.jsx("nav",{className:Hi.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:l.jsx("ol",{className:Hi.list,children:n.map((s,i)=>{const o=i===n.length-1;return l.jsxs("li",{className:Hi.item,children:[i>0&&l.jsx("span",{className:Hi.separator,"aria-hidden":"true",children:eR}),s.url&&!o?l.jsx(yp,{className:Hi.link,to:s.url,title:s.label,children:s.label}):l.jsx("span",{className:Hi.current,"aria-current":"page",title:s.label,children:s.label})]},i)})})})}const tR="_btn_dwk2o_1",nR="_sm_dwk2o_22",sR="_md_dwk2o_28",aR="_lg_dwk2o_34",iR="_primary_dwk2o_40",oR="_danger_dwk2o_55",rR="_outline_dwk2o_70",lR="_ghost_dwk2o_80",kf={btn:tR,sm:nR,md:sR,lg:aR,primary:iR,danger:oR,outline:rR,ghost:lR},As=y.forwardRef(function({variant:s="primary",size:i="md",className:o,children:c,...u},d){const m=[kf.btn,kf[s],kf[i],o].filter(Boolean).join(" ");return l.jsx("button",{ref:d,className:m,...u,children:c})}),cR="_copyButton_1bqk0_1",uR={copyButton:cR},dR=2e3;function ni({text:n,className:s,"data-testid":i}){const[o,c]=y.useState(!1),u=y.useRef(void 0);y.useEffect(()=>()=>{u.current!==void 0&&clearTimeout(u.current)},[]);const d=y.useCallback(async()=>{try{await navigator.clipboard.writeText(n),c(!0),u.current!==void 0&&clearTimeout(u.current),u.current=setTimeout(()=>{c(!1),u.current=void 0},dR)}catch{}},[n]);return l.jsx("button",{type:"button",className:`${uR.copyButton} ${s??""}`,onClick:()=>{d().catch(()=>{})},"aria-label":o?"Copied":"Copy to clipboard","data-testid":i??"copy-button",children:o?"✓":"📋"})}const fR="_banner_bxqlh_1",pR="_label_bxqlh_15",mR="_text_bxqlh_25",hR="_link_bxqlh_29",oc={banner:fR,label:pR,text:mR,link:hR};function gR(){return l.jsxs("div",{className:oc.banner,"data-testid":"demo-banner",children:[l.jsx("span",{className:oc.label,children:"DEMO"}),l.jsxs("span",{className:oc.text,children:["This is an interactive demo with mock data."," ",l.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:oc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const vR="_container_og0yp_1",yR="_chevronButton_og0yp_6",bR="_mainButton_og0yp_6",_R="_sm_og0yp_34",xR="_md_og0yp_34",SR="_lg_og0yp_34",TR="_primary_og0yp_57",kR="_danger_og0yp_70",wR="_outline_og0yp_83",NR="_ghost_og0yp_92",jR="_dropdown_og0yp_100",CR="_option_og0yp_113",ER="_optionLabel_og0yp_130",AR="_optionDesc_og0yp_135",Es={container:vR,chevronButton:yR,mainButton:bR,sm:_R,md:xR,lg:SR,primary:TR,danger:kR,outline:wR,ghost:NR,dropdown:jR,option:CR,optionLabel:ER,optionDesc:AR};function jx({label:n,onClick:s,options:i,variant:o="primary",size:c="md","data-testid":u}){const[d,m]=y.useState(!1),h=y.useRef(null);y.useEffect(()=>{if(!d)return;function _(S){h.current&&S.target instanceof Node&&!h.current.contains(S.target)&&m(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[d]),y.useEffect(()=>{if(!d)return;function _(S){S.key==="Escape"&&m(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[d]);const g=Es[o]||"",v=Es[c]||"",b=()=>{d&&m(!1),s()};return l.jsxs("div",{ref:h,className:Es.container,"data-testid":u,children:[l.jsx("button",{type:"button",className:`${Es.mainButton} ${g} ${v}`,onClick:b,"data-testid":u?`${u}-main`:void 0,children:n}),l.jsx("button",{type:"button",className:`${Es.chevronButton} ${g} ${v}`,onClick:()=>m(_=>!_),"aria-label":`More options for ${n}`,"aria-haspopup":"menu","aria-expanded":d,"data-testid":u?`${u}-chevron`:void 0,children:"▾"}),d&&l.jsx("div",{className:Es.dropdown,"data-testid":u?`${u}-menu`:void 0,children:i.map((_,S)=>l.jsxs("button",{type:"button",className:Es.option,onClick:()=>{_.onClick(),m(!1)},children:[l.jsx("span",{className:Es.optionLabel,children:_.label}),_.description&&l.jsx("span",{className:Es.optionDesc,children:_.description})]},S))})]})}function op(){op=function(c,u){return new i(c,void 0,u)};var n=RegExp.prototype,s=new WeakMap;function i(c,u,d){var m=new RegExp(c,u);return s.set(m,d||s.get(c)),jc(m,i.prototype)}function o(c,u){var d=s.get(u);return Object.keys(d).reduce(function(m,h){var g=d[h];if(typeof g=="number")m[h]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;m[h]=c[g[v]]}return m},Object.create(null))}return(function(c,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(u&&u.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),u&&jc(c,u)})(i,RegExp),i.prototype.exec=function(c){var u=n.exec.call(this,c);if(u){u.groups=o(u,this);var d=u.indices;d&&(d.groups=o(d,this))}return u},i.prototype[Symbol.replace]=function(c,u){if(typeof u=="string"){var d=s.get(this);return n[Symbol.replace].call(this,c,u.replace(/\$<([^>]+)>/g,function(h,g){var v=d[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof u=="function"){var m=this;return n[Symbol.replace].call(this,c,function(){var h=arguments;return typeof h[h.length-1]!="object"&&(h=[].slice.call(h)).push(o(h,m)),u.apply(this,h)})}return n[Symbol.replace].call(this,c,u)},op.apply(this,arguments)}function jc(n,s){return jc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},jc(n,s)}function Hy(n,s){(s==null||s>n.length)&&(s=n.length);for(var i=0,o=new Array(s);i<s;i++)o[i]=n[i];return o}function wf(n,s){var i=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i)return(i=i.call(n)).next.bind(i);if(Array.isArray(n)||(i=(function(c,u){if(c){if(typeof c=="string")return Hy(c,u);var d=Object.prototype.toString.call(c).slice(8,-1);return d==="Object"&&c.constructor&&(d=c.constructor.name),d==="Map"||d==="Set"?Array.from(c):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?Hy(c,u):void 0}})(n))||s){i&&(n=i);var o=0;return function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
473
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var DR=(function(n){return function(s){return s===void 0&&(s={}),(function(o,c){if(c&&!o.registered(c))throw new Error('The default language "'+c+'" is not registered with refractor.')})(n,s.defaultLanguage),function(o){JS(o,"element",i)};function i(o,c,u){var d,m;if(u&&u.tagName==="pre"&&o.tagName==="code"){var h=(o==null||(d=o.data)==null?void 0:d.meta)||(o==null||(m=o.properties)==null?void 0:m.metastring)||"";o.properties.className?typeof o.properties.className=="boolean"?o.properties.className=[]:Array.isArray(o.properties.className)||(o.properties.className=[o.properties.className]):o.properties.className=[];var g,v,b=(function(D){for(var E,H=wf(D.properties.className);!(E=H()).done;){var z=E.value;if(z.slice(0,9)==="language-")return z.slice(9).toLowerCase()}return null})(o);if(!b&&s.defaultLanguage&&o.properties.className.push("language-"+(b=s.defaultLanguage)),o.properties.className.push("code-highlight"),b)try{var _,S;S=(_=b)!=null&&_.includes("diff-")?b.split("-")[1]:b,g=n.highlight(Jl(o),S),u.properties.className=(u.properties.className||[]).concat("language-"+S)}catch(D){if(!s.ignoreMissing||!/Unknown language/.test(D.message))throw D;g=o}else g=o;g.children=(v=1,function D(E){return E.reduce(function(H,z){if(z.type==="text"){var Z=z.value,F=(Z.match(/\n/g)||"").length;if(F===0)z.position={start:{line:v,column:1},end:{line:v,column:1}},H.push(z);else for(var Q,ae=Z.split(`
|
|
474
|
-
`),pe=wf(ae.entries());!(Q=pe()).done;){var oe=Q.value,X=oe[0],B=oe[1];H.push({type:"text",value:X===ae.length-1?B:B+`
|
|
475
|
-
`,position:{start:{line:v+X,column:1},end:{line:v+X,column:1}}})}return v+=F,H}if(Object.prototype.hasOwnProperty.call(z,"children")){var $=v;return z.children=D(z.children),H.push(z),z.position={start:{line:$,column:1},end:{line:v,column:1}},H}return H.push(z),H},[])})(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 T,N=(function(D){var E=/{([\d,-]+)}/,H=D.split(",").map(function(F){return F.trim()}).join();if(E.test(H)){var z=E.exec(H)[1],Z=XS(z);return function(F){return Z.includes(F+1)}}return function(){return!1}})(h),j=(function(D){var E=op(/showLineNumbers=(\d+)/i,{lines:1});if(E.test(D)){var H=E.exec(D);return Number(H.groups.lines)}return 1})(h),w=(function(D){for(var E=new Array(D),H=0;H<D;H++)E[H]={type:"element",tagName:"span",properties:{className:[]},children:[]};return E})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],A=function(){var D,E,H=T.value,z=H[0],Z=H[1];Z.properties.className=["code-line"];var F=QS(g,function(Q){return Q.position.start.line<=z+1&&Q.position.end.line>=z+1});Z.children=F.children,(h.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!C.some(function(Q){return h.toLowerCase().includes(Q)})&&(Z.properties.line=[(z+j).toString()],Z.properties.className.push("line-number")),N(z)&&Z.properties.className.push("highlight-line"),(b==="diff"||(D=b)!=null&&D.includes("diff-"))&&Jl(Z).substring(0,1)==="-"?Z.properties.className.push("deleted"):(b==="diff"||(E=b)!=null&&E.includes("diff-"))&&Jl(Z).substring(0,1)==="+"&&Z.properties.className.push("inserted")},M=wf(w.entries());!(T=M()).done;)A();w.length>0&&Jl(w[w.length-1]).trim()===""&&w.pop(),o.children=w}}}})(WS);function Cx(n){if(n>=1e6)return`${(n/1e6).toFixed(1)}M`;if(n>=1e3){const s=Number((n/1e3).toFixed(1));return s>=1e3?`${(n/1e6).toFixed(1)}M`:`${s.toFixed(1)}k`}return String(n)}function so(n){return n===0?"-":n<.01?`$${n.toFixed(4)}`:`$${n.toFixed(2)}`}const RR={read:"file-read",view:"file-read",edit:"file-edit",file_change:"file-edit",write:"file-write",bash:"shell",command_execution:"shell",grep:"search",glob:"search",todowrite:"todo",update_plan:"todo",todo_write:"todo",report_intent:"metadata"};function MR(n){return RR[n.toLowerCase()]??"generic"}const OR="_card_17a7m_2",IR="_cardBlue_17a7m_20",BR="_cardOrange_17a7m_24",LR="_cardGreen_17a7m_28",UR="_cardPurple_17a7m_32",zR="_cardNeutral_17a7m_36",PR="_cardRed_17a7m_40",VR="_header_17a7m_44",HR="_icon_17a7m_51",qR="_toolName_17a7m_58",GR="_fileName_17a7m_65",$R="_badge_17a7m_74",FR="_spacer_17a7m_81",ZR="_bodyToggle_17a7m_85",KR="_chevron_17a7m_103",YR="_chevronExpanded_17a7m_108",JR="_pre_17a7m_112",WR="_diffAdd_17a7m_136",XR="_diffRemove_17a7m_148",QR="_diffContext_17a7m_160",eM="_diffHeader_17a7m_169",tM="_diffLine_17a7m_175",nM="_exitOk_17a7m_181",sM="_exitError_17a7m_187",aM="_exitPending_17a7m_193",iM="_copyButtonInline_17a7m_207",oM="_inProgress_17a7m_221",rM="_metadata_17a7m_225",lM="_metadataPrefix_17a7m_232",se={card:OR,cardBlue:IR,cardOrange:BR,cardGreen:LR,cardPurple:UR,cardNeutral:zR,cardRed:PR,header:VR,icon:HR,toolName:qR,fileName:GR,badge:$R,spacer:FR,bodyToggle:ZR,chevron:KR,chevronExpanded:YR,pre:JR,diffAdd:WR,diffRemove:XR,diffContext:QR,diffHeader:eM,diffLine:tM,exitOk:nM,exitError:sM,exitPending:aM,copyButtonInline:iM,inProgress:oM,metadata:rM,metadataPrefix:lM};function cM(n){if(n==null||typeof n!="object")return"";const s=n;return typeof s.file_path=="string"?s.file_path:typeof s.path=="string"?s.path:""}function uM(n){const s=n.split(/[/\\]/);return s[s.length-1]||n}const Nf=5;function qy({tool:n,args:s,result:i,isError:o,writeVariant:c}){const[u,d]=y.useState(!1),m=cM(s),h=uM(m),g=i===void 0,v=o?se.cardRed:c?se.cardGreen:se.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?"📝":"📄",S=c?"tool-card-file-write":"tool-card-file-read",T=(i==null?void 0:i.split(`
|
|
476
|
-
`))??[],N=T.length>Nf,j=u?T:T.slice(0,Nf);return l.jsxs("div",{className:`${se.card} ${v} ${g?se.inProgress:""}`,"data-testid":S,children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,children:_}),l.jsx("span",{className:se.toolName,style:{color:b},children:n}),h&&l.jsx("span",{className:se.fileName,title:m,children:h}),!g&&T.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:se.spacer}),l.jsxs("span",{className:se.badge,children:[T.length," lines"]})]}),!g&&!o&&i&&l.jsx(ni,{text:i,"data-testid":"tool-card-copy",className:se.copyButtonInline})]}),o&&i&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-error",children:i}),!o&&!g&&T.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:se.pre,"data-testid":"tool-card-content",children:j.map((w,C)=>l.jsxs("span",{className:se.diffLine,children:[l.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),w]},C))}),N&&l.jsxs("button",{type:"button",className:se.bodyToggle,onClick:()=>{d(w=>!w)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${se.chevron} ${u?se.chevronExpanded:""}`,children:"▸"}),u?"collapse":`${T.length-Nf} more lines`]})]})]})}function dM(n){const s=n.split(`
|
|
477
|
-
`),i=[];for(const o of s)o.startsWith("diff --git")||o.startsWith("index ")||(o.startsWith("--- ")||o.startsWith("+++ "))&&!o.startsWith("---- ")&&!o.startsWith("++++ ")||(o.startsWith("@@")?i.push({type:"header",content:o}):o.startsWith("+")?i.push({type:"add",content:o.slice(1)}):o.startsWith("-")?i.push({type:"remove",content:o.slice(1)}):o.startsWith(" ")?i.push({type:"context",content:o.slice(1)}):o===""&&i.push({type:"context",content:""}));return i}function fM(n,s){const i=n.split(`
|
|
478
|
-
`),o=s.split(`
|
|
479
|
-
`),c=[];for(const u of i)c.push({type:"remove",content:u});for(const u of o)c.push({type:"add",content:u});return c}function pM(n){let s=0,i=0;for(const o of n)o.type==="add"&&s++,o.type==="remove"&&i++;return{added:s,removed:i}}function mM(n){if(n==null||typeof n!="object")return"";const s=n;return typeof s.file_path=="string"&&s.file_path||typeof s.path=="string"&&s.path||""}function hM(n){if(n===void 0||typeof n!="object"||n===null)return;const s=n,i=(typeof s.old_string=="string"?s.old_string:void 0)??(typeof s.old_str=="string"?s.old_str:void 0),o=(typeof s.new_string=="string"?s.new_string:void 0)??(typeof s.new_str=="string"?s.new_str:void 0);if(i!==void 0&&o!==void 0)return{oldStr:i,newStr:o}}function gM(n){const s=n.split(/[/\\]/);return s[s.length-1]||n}function vM(n,s){if(s){let o=s;if(s.trimStart().startsWith("{"))try{const c=JSON.parse(s);typeof c.detailedContent=="string"&&(o=c.detailedContent)}catch{}if(o.includes("@@")||o.startsWith("diff ")){const c=dM(o);if(c.length>0)return c}}const i=hM(n);if(i)return fM(i.oldStr,i.newStr)}const jf=5;function yM({tool:n,args:s,result:i,isError:o,detailedResult:c}){const[u,d]=y.useState(!1),m=mM(s),h=gM(m),g=i===void 0,v=vM(s,c),b=v?pM(v):null,_=((v==null?void 0:v.length)??0)>jf,S=u?v:v==null?void 0:v.slice(0,jf);return l.jsxs("div",{className:`${se.card} ${o?se.cardRed:se.cardOrange} ${g?se.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,children:"✏️"}),l.jsx("span",{className:se.toolName,style:{color:"var(--accent-yellow)"},children:n}),h&&l.jsx("span",{className:se.fileName,title:m,children:h}),b&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:se.spacer}),l.jsxs("span",{className:se.badge,"data-testid":"tool-card-diff-stats",children:[l.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",l.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]}),!g&&!o&&(v||i)&&l.jsx(ni,{text:v?v.map(T=>`${T.type==="add"?"+":T.type==="remove"?"-":T.type==="header"?"":" "}${T.content}`).join(`
|
|
480
|
-
`):i,"data-testid":"tool-card-copy",className:se.copyButtonInline})]}),o&&i&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-error",children:i}),!o&&S&&S.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:se.pre,"data-testid":"tool-card-diff",children:S.map((T,N)=>{let j=se.diffContext;return T.type==="add"&&(j=se.diffAdd),T.type==="remove"&&(j=se.diffRemove),T.type==="header"&&(j=se.diffHeader),l.jsx("span",{className:`${se.diffLine} ${j}`,children:T.content},N)})}),_&&l.jsxs("button",{type:"button",className:se.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${se.chevron} ${u?se.chevronExpanded:""}`,children:"▸"}),u?"collapse":`${((v==null?void 0:v.length)??0)-jf} more lines`]})]}),!o&&!v&&!g&&i&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-content",children:i})]})}const bM=/^\[exit (\d+)\]\s*/;function _M(n){const s=bM.exec(n);return s?{exitCode:Number(s[1]),output:n.slice(s[0].length)}:{exitCode:void 0,output:n}}function xM(n){if(n==null||typeof n!="object")return"";const s=n;return typeof s.command=="string"?s.command:""}function SM(n){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'(.+?)'\s*$/i.exec(n);if(s)return s[1];const i=/pwsh(?:\.exe)?["']?\s+-Command\s+"(.+?)"\s*$/i.exec(n);return i?i[1]:n}const Cf=3;function TM({tool:n,args:s,result:i,isError:o}){const[c,u]=y.useState(!1),d=xM(s),m=SM(d),h=i===void 0,g=i?_M(i):null,v=(g==null?void 0:g.output.split(`
|
|
481
|
-
`))??[],b=v.length>Cf,_=c?v:v.slice(0,Cf),S=g==null?void 0:g.exitCode,T=o||S!==void 0&&S!==0;return l.jsxs("div",{className:`${se.card} ${T?se.cardRed:se.cardNeutral}`,"data-testid":"tool-card-shell",children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),l.jsx("span",{className:se.fileName,style:{flex:1,color:"var(--text-primary)"},title:d!==m?d:void 0,"data-testid":"tool-card-command",children:m}),S!==void 0&&l.jsxs("span",{className:S===0?se.exitOk:se.exitError,"data-testid":"tool-card-exit-code",children:[S===0?"✓":"✗"," exit ",S]}),!h&&g&&g.output.length>0&&l.jsx(ni,{text:g.output,"data-testid":"tool-card-copy",className:se.copyButtonInline}),h&&l.jsx("span",{className:se.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),!h&&g&&g.output.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:se.pre,"data-testid":"tool-card-output",children:_.join(`
|
|
482
|
-
`)}),b&&l.jsxs("button",{type:"button",className:se.bodyToggle,onClick:()=>{u(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${se.chevron} ${c?se.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Cf} more lines`]})]})]})}function kM(n){if(n==null||typeof n!="object")return{pattern:"",path:""};const s=n,i=typeof s.pattern=="string"?s.pattern:"",o=typeof s.path=="string"?s.path:"";return{pattern:i,path:o}}const Ef=5;function wM({tool:n,args:s,result:i,isError:o}){const[c,u]=y.useState(!1),{pattern:d,path:m}=kM(s),h=i===void 0,g=(i==null?void 0:i.split(`
|
|
483
|
-
`).filter(_=>_.length>0))??[],v=g.length>Ef,b=c?g:g.slice(0,Ef);return l.jsxs("div",{className:`${se.card} ${o?se.cardRed:se.cardPurple} ${h?se.inProgress:""}`,"data-testid":"tool-card-search",children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,children:"🔍"}),l.jsx("span",{className:se.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:n}),d&&l.jsxs("span",{className:se.fileName,"data-testid":"tool-card-pattern",children:['"',d,'"']}),m&&l.jsxs("span",{className:se.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",m]}),!h&&!o&&g.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:se.spacer}),l.jsxs("span",{className:se.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]}),!h&&!o&&i&&l.jsx(ni,{text:i,"data-testid":"tool-card-copy",className:se.copyButtonInline})]}),o&&i&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&b.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:se.pre,"data-testid":"tool-card-results",children:b.join(`
|
|
484
|
-
`)}),v&&l.jsxs("button",{type:"button",className:se.bodyToggle,onClick:()=>{u(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${se.chevron} ${c?se.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.length-Ef} more matches`]})]})]})}const NM="_progressBar_14f5c_1",jM="_progressFill_14f5c_9",CM="_activeTask_14f5c_16",EM="_activeIcon_14f5c_27",AM="_todoPulse_14f5c_1",DM="_activeText_14f5c_34",RM="_checklist_14f5c_48",MM="_item_14f5c_55",OM="_itemIcon_14f5c_65",IM="_itemText_14f5c_73",BM="_pending_14f5c_78",LM="_in_progress_14f5c_85",UM="_completed_14f5c_97",zM="_emptyMessage_14f5c_108",Fn={progressBar:NM,progressFill:jM,activeTask:CM,activeIcon:EM,todoPulse:AM,activeText:DM,checklist:RM,item:MM,itemIcon:OM,itemText:IM,pending:BM,in_progress:LM,completed:UM,emptyMessage:zM},PM=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function VM(n){if(n===void 0||typeof n!="object"||n===null)return[];const s=n;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:Gy(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:Gy(i.status)})):typeof s.content=="string"?HM(s.content):[]}function Gy(n){switch(n.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 HM(n){const s=n.split(`
|
|
485
|
-
`),i=[];for(const o of s){const c=PM.exec(o.trim());if(c){const u=c[1],d=c[2].trim();let m="pending";u==="x"||u==="X"?m="completed":(u==="~"||u==="/"||u==="!")&&(m="in_progress"),i.push({content:d,status:m})}}return i}function qM(n){switch(n){case"completed":return"✓";case"in_progress":return"●";default:return"○"}}function GM({args:n}){const s=VM(n),i=s.filter(u=>u.status==="completed").length,o=s.find(u=>u.status==="in_progress"),c=s.length===0;return l.jsxs("div",{className:`${se.card} ${se.cardBlue}`,"data-testid":"tool-card-todo",children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,children:"☑"}),l.jsx("span",{className:se.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:se.spacer}),l.jsxs("span",{className:se.badge,"data-testid":"tool-card-todo-progress",children:[i,"/",s.length]})]})]}),!c&&l.jsx("div",{className:Fn.progressBar,"data-testid":"tool-card-todo-bar",children:l.jsx("div",{className:Fn.progressFill,style:{width:`${i/s.length*100}%`}})}),o&&l.jsxs("div",{className:Fn.activeTask,"data-testid":"tool-card-todo-active",children:[l.jsx("span",{className:Fn.activeIcon,children:"●"}),l.jsx("span",{className:Fn.activeText,children:o.activeForm||o.content})]}),!c&&l.jsx("div",{className:Fn.checklist,"data-testid":"tool-card-todo-list",children:s.map((u,d)=>l.jsxs("div",{className:`${Fn.item} ${Fn[u.status]}`,"data-testid":"tool-card-todo-item",children:[l.jsx("span",{className:Fn.itemIcon,children:qM(u.status)}),l.jsx("span",{className:Fn.itemText,children:u.content})]},d))}),c&&l.jsx("div",{className:Fn.emptyMessage,children:"All items completed and cleared."})]})}function $M(n,s){if(s==null||typeof s!="object")return"";const i=s;if(typeof i.intent=="string")return i.intent;for(const o of Object.values(i))if(typeof o=="string")return o;return n}function FM({tool:n,args:s}){const i=$M(n,s);return l.jsxs("div",{className:se.metadata,"data-testid":"tool-card-metadata",children:[l.jsx("span",{className:se.metadataPrefix,children:"↳"}),i]})}function ZM(n){const s=/^mcp__(.+?)__(.+)$/.exec(n);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:n,isMcp:!1}}function KM(n){if(n==null)return"";if(typeof n!="object")return String(n);const s=n;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(n);return i.length>120?`${i.slice(0,120)}…`:i}catch{return""}}const Af=5;function YM({tool:n,args:s,result:i,isError:o}){const[c,u]=y.useState(!1),{display:d}=ZM(n),m=KM(s),h=i===void 0,g=(i==null?void 0:i.split(`
|
|
486
|
-
`))??[],v=g.length>Af,b=c?i:g.slice(0,Af).join(`
|
|
487
|
-
`);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return l.jsxs("div",{className:`${se.card} ${o?se.cardRed:se.cardBlue} ${h?se.inProgress:""}`,"data-testid":"tool-card-generic",children:[l.jsxs("div",{className:se.header,children:[l.jsx("span",{className:se.icon,children:"⚙"}),l.jsx("span",{className:se.toolName,style:{color:"var(--accent-blue)"},children:d}),m&&l.jsx("span",{className:se.fileName,children:m}),!h&&!o&&i&&l.jsx(ni,{text:i,"data-testid":"tool-card-copy",className:se.copyButtonInline})]}),h&&_&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-args",children:_}),o&&i&&l.jsx("pre",{className:se.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&i&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:se.pre,"data-testid":"tool-card-result",children:b}),v&&l.jsxs("button",{type:"button",className:se.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[l.jsx("span",{className:`${se.chevron} ${c?se.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.length-Af} more lines`]})]})]})}function Df(n){switch(MR(n.tool)){case"file-read":return l.jsx(qy,{...n});case"file-edit":return l.jsx(yM,{...n});case"file-write":return l.jsx(qy,{...n,writeVariant:!0});case"shell":return l.jsx(TM,{...n});case"search":return l.jsx(wM,{...n});case"todo":return l.jsx(GM,{...n});case"metadata":return l.jsx(FM,{...n});default:return l.jsx(YM,{...n})}}const JM="_systemContextEvent_8n7q0_1",WM="_systemContextHeader_8n7q0_7",XM="_systemContextBadge_8n7q0_28",QM="_systemContextToggle_8n7q0_37",e3="_systemContextPre_8n7q0_43",t3="_systemContextEllipsis_8n7q0_54",n3="_systemEvent_8n7q0_58",s3="_systemTimestamp_8n7q0_65",a3="_textEvent_8n7q0_69",i3="_messageCopyButton_8n7q0_75",o3="_codeBlockWrapper_8n7q0_159",r3="_codeBlockCopyButton_8n7q0_162",l3="_errorEvent_8n7q0_166",c3="_statusEvent_8n7q0_174",u3="_userInputEvent_8n7q0_183",d3="_userInputContent_8n7q0_189",f3="_signalEvent_8n7q0_206",p3="_signalBadge_8n7q0_217",m3="_signalContent_8n7q0_226",h3="_usageEvent_8n7q0_231",g3="_usageBadge_8n7q0_238",v3="_defaultEvent_8n7q0_247",xt={systemContextEvent:JM,systemContextHeader:WM,systemContextBadge:XM,systemContextToggle:QM,systemContextPre:e3,systemContextEllipsis:t3,systemEvent:n3,systemTimestamp:s3,textEvent:a3,messageCopyButton:i3,codeBlockWrapper:o3,codeBlockCopyButton:r3,errorEvent:l3,statusEvent:c3,userInputEvent:u3,userInputContent:d3,signalEvent:f3,signalBadge:p3,signalContent:m3,usageEvent:h3,usageBadge:g3,defaultEvent:v3},$y=3;function y3({content:n}){const[s,i]=y.useState(!1),o=n.split(`
|
|
488
|
-
`),c=o.length>$y,u=s?n:o.slice(0,$y).join(`
|
|
489
|
-
`);return l.jsxs("div",{className:xt.systemContextEvent,"data-testid":"system-context-event",children:[l.jsxs("button",{type:"button",className:xt.systemContextHeader,onClick:()=>{i(d=>!d)},"aria-expanded":s,children:[l.jsx("span",{className:xt.systemContextBadge,children:"SYSTEM PROMPT"}),c&&l.jsx("span",{className:xt.systemContextToggle,"aria-hidden":"true",children:s?"▾":"▸"})]}),l.jsxs("pre",{className:xt.systemContextPre,children:[u,!s&&c&&l.jsx("span",{className:xt.systemContextEllipsis,children:"…"})]})]})}function b3({time:n,content:s}){return l.jsxs("div",{className:xt.systemEvent,children:[l.jsxs("span",{className:xt.systemTimestamp,children:["[",n,"]"]})," ",s]})}function rp(n){return typeof n=="string"?n:typeof n=="number"?String(n):Array.isArray(n)?n.map(rp).join(""):n!=null&&typeof n=="object"&&"props"in n?rp(n.props.children):""}function _3({children:n,node:s,...i}){const o=rp(n);return l.jsxs("div",{className:xt.codeBlockWrapper,children:[l.jsx("pre",{...i,children:n}),l.jsx(ni,{text:o,"data-testid":"copy-code-block",className:xt.codeBlockCopyButton})]})}const x3={pre:_3};function S3({content:n}){return l.jsxs("div",{className:xt.textEvent,children:[l.jsx(ni,{text:n,"data-testid":"copy-message",className:xt.messageCopyButton}),l.jsx(up,{remarkPlugins:[dp],rehypePlugins:[DR],components:x3,children:n})]})}function T3({content:n}){return l.jsxs("div",{className:xt.errorEvent,children:["Error: ",n]})}function k3({content:n}){return l.jsxs("div",{className:xt.statusEvent,children:["--- ",n," ---"]})}function w3({content:n}){return l.jsx("div",{className:xt.userInputEvent,children:l.jsx("span",{className:xt.userInputContent,children:n})})}function N3({content:n}){return l.jsxs("div",{className:xt.signalEvent,"data-testid":"signal-event",children:[l.jsx("span",{className:xt.signalBadge,children:"SIGNAL"}),l.jsx("span",{className:xt.signalContent,children:n})]})}function j3({content:n}){let s=n;try{const i=JSON.parse(n),o=Number(i.input_tokens)||0,c=Number(i.output_tokens)||0,u=Cx(o+c),d=so(Number(i.cost_usd)||0);s=`${u} tokens · ${d}`}catch{}return l.jsx("div",{className:xt.usageEvent,"data-testid":"usage-event",children:l.jsx("span",{className:xt.usageBadge,children:s})})}function C3({content:n}){return l.jsx("div",{className:xt.defaultEvent,children:n})}function E3({event:n,toolUseCtx:s}){const i=new Date(n.timestamp).toLocaleTimeString();switch(n.eventType){case"system":{if(n.raw)try{if(JSON.parse(n.raw).systemContext===!0)return l.jsx(y3,{content:n.content})}catch{}return l.jsx(b3,{time:i,content:n.content})}case"text":case"output":return l.jsx(S3,{content:n.content});case"tool_use":{let o="",c={};try{const u=JSON.parse(n.content);o=u.tool||"",c=u.args}catch{}return l.jsx(Df,{tool:o,args:c})}case"tool_result":{let o=!1;if(n.raw)try{o=JSON.parse(n.raw).is_error===!0}catch{}let c=n.content;if(n.content.trimStart().startsWith("{"))try{const u=JSON.parse(n.content);typeof u.content=="string"&&(c=u.content)}catch{}return s?l.jsx(Df,{tool:s.tool,args:s.args,result:c,isError:o,detailedResult:s.detailedResult}):l.jsx(Df,{tool:"Tool output",args:void 0,result:c,isError:o})}case"error":return l.jsx(T3,{content:n.content});case"status":return l.jsx(k3,{content:n.content});case"user_input":return l.jsx(w3,{content:n.content});case"signal":return l.jsx(N3,{content:n.content});case"usage":return l.jsx(j3,{content:n.content});default:return l.jsx(C3,{content:n.content})}}const A3="_overlay_cmicx_1",D3="_dialog_cmicx_11",R3="_title_cmicx_30",M3="_description_cmicx_38",O3="_actions_cmicx_45",I3="_cancelButton_cmicx_52",B3="_confirmButton_cmicx_79",Va={overlay:A3,dialog:D3,title:R3,description:M3,actions:O3,cancelButton:I3,confirmButton:B3};function Ja({isOpen:n,title:s,description:i,confirmLabel:o="Delete",onConfirm:c,onCancel:u}){const d=y.useId(),m=y.useId();return l.jsx(rs,{children:n&&l.jsx(Ot.div,{className:Va.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:u,onKeyDown:h=>{h.key==="Escape"&&u()},role:"dialog","aria-modal":"true","aria-labelledby":d,"aria-describedby":i?m:void 0,children:l.jsxs(Ot.div,{className:Va.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:h=>h.stopPropagation(),children:[l.jsx("h3",{id:d,className:Va.title,children:s}),i&&l.jsx("p",{id:m,className:Va.description,children:i}),l.jsxs("div",{className:Va.actions,children:[l.jsx("button",{type:"button",className:Va.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),l.jsx("button",{type:"button",className:Va.confirmButton,onClick:c,children:o})]})]})})})}const L3="_spinner_1uyt1_1",U3="_spin_1uyt1_1",z3="_sm_1uyt1_14",P3="_md_1uyt1_20",V3="_lg_1uyt1_26",H3="_xl_1uyt1_32",Fy={spinner:L3,spin:U3,sm:z3,md:P3,lg:V3,xl:H3};function Ex({size:n="md",className:s,label:i="Loading",liveRegion:o=!1}){return l.jsx("span",{className:`${Fy.spinner} ${Fy[n]} ${s??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const q3="_splash_1bn1g_1",G3="_logo_1bn1g_11",Zy={splash:q3,logo:G3};function Ax(){return l.jsxs("div",{className:Zy.splash,"data-testid":"splash-screen",children:[l.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Zy.logo}),l.jsx(Ex,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}function $3(n,s){const i=y.useRef(null);y.useEffect(()=>{const o=i.current;if(i.current=n,o===null)return;const c=new Map;for(const d of o)c.set(d.id,d);const u=new Set;for(const d of n){u.add(d.id);const m=c.get(d.id);if(m&&m.status!==d.status&&d.status!=="sleeping"){if(d.status==="connecting"){s("Provisioning environment…","info");continue}d.status==="connected"?s("Environment connected","success"):d.status==="error"?s("Environment provision failed","error"):d.status==="disconnected"&&(m.status==="connected"?s("Environment disconnected","warning"):s("Environment stopped","info"))}}for(const d of o)u.has(d.id)||s("Environment removed","info")},[n,s])}const F3={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 Z3(n){return F3[n]}function K3(n,s){if(n===void 0)return[];const i=[],o=new Map;for(const u of n)o.set(u.id,u);const c=new Set;for(const u of s){c.add(u.id);const d=o.get(u.id);if(!d||d.status===u.status)continue;const m=Z3(u.status);m&&i.push(m)}for(const u of n)c.has(u.id)||i.push({message:"Task deleted",variant:"info"});return i}function Y3(n,s){const i=y.useRef(void 0);y.useEffect(()=>{const o=i.current;i.current=n;const c=K3(o,n);for(const u of c)s(u.message,u.variant)},[n,s])}function J3(n,s,i){const o=n.filter(h=>h.status==="running"||h.status==="idle"||h.status==="waiting").length,c=Dx(s),u=s.filter(h=>lp(h,c)).length,d=s.filter(h=>h.status==="paused"||h.status==="failed"||lp(h,c)).length,m=i.filter(h=>h.status==="disconnected"||h.status==="error").length;return{activeSessions:o,blockedTasks:u,attentionTasks:d,unhealthyEnvironments:m}}function Dx(n){const s=new Map;for(const i of n)s.set(i.id,i.status);return s}function lp(n,s){return n.dependsOn.some(i=>s.get(i)!=="complete")}function W3(n,s){var d;const i=new Map;for(const m of s)i.set(m.id,m);const o=Dx(n),c=[];for(const m of n){const h=m.workspaceId?((d=i.get(m.workspaceId))==null?void 0:d.name)??"Unknown":"Unknown";m.status==="failed"?c.push({task:m,reason:"failed",workspaceName:h}):lp(m,o)?c.push({task:m,reason:"blocked",workspaceName:h}):m.status==="paused"&&c.push({task:m,reason:"paused",workspaceName:h})}const u={failed:0,blocked:1,paused:2};return c.sort((m,h)=>(u[m.reason]??3)-(u[h.reason]??3)),c}function X3(n,s){const i=new Map;for(const o of s)i.set(o.id,o);return n.filter(o=>o.status==="running"||o.status==="idle"||o.status==="waiting").map(o=>{var c;return{session:o,environmentName:((c=i.get(o.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function Q3(n,s,i){const o=new Map;for(const c of s){if(!c.workspaceId)continue;let u=o.get(c.workspaceId);u||(u={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},o.set(c.workspaceId,u)),u.totalTasks+=1,c.status==="complete"?u.completedTasks+=1:c.status==="working"?u.workingTasks+=1:c.status==="failed"&&(u.failedTasks+=1)}return n.map(c=>{const u=o.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:u.totalTasks,completedTasks:u.completedTasks,workingTasks:u.workingTasks,failedTasks:u.failedTasks}})}const e6="_dashboard_16pzm_1",t6="_kpiStrip_16pzm_11",n6="_kpiCard_16pzm_23",s6="_kpiValue_16pzm_68",a6="_kpiLabel_16pzm_76",i6="_bodyGrid_16pzm_84",o6="_section_16pzm_96",r6="_sectionHeader_16pzm_109",l6="_sectionIcon_16pzm_118",c6="_sectionTitle_16pzm_123",u6="_sectionCount_16pzm_131",d6="_sectionBody_16pzm_138",f6="_emptyHint_16pzm_143",p6="_sessionRow_16pzm_150",m6="_sessionPrompt_16pzm_177",h6="_sessionEnv_16pzm_186",g6="_sessionRuntime_16pzm_192",v6="_sessionStatus_16pzm_198",y6="_statusDot_16pzm_207",b6="_attentionRow_16pzm_233",_6="_attentionTitle_16pzm_259",x6="_attentionMeta_16pzm_267",S6="_reasonBadge_16pzm_274",T6="_bottomGrid_16pzm_301",k6="_envRow_16pzm_312",w6="_envName_16pzm_323",N6="_envStatusBadge_16pzm_333",j6="_workspaceRow_16pzm_369",C6="_workspaceTop_16pzm_395",E6="_workspaceName_16pzm_401",A6="_workspaceCounts_16pzm_407",D6="_progressBar_16pzm_415",R6="_progressFill_16pzm_422",_e={dashboard:e6,kpiStrip:t6,kpiCard:n6,kpiValue:s6,kpiLabel:a6,bodyGrid:i6,section:o6,sectionHeader:r6,sectionIcon:l6,sectionTitle:c6,sectionCount:u6,sectionBody:d6,emptyHint:f6,sessionRow:p6,sessionPrompt:m6,sessionEnv:h6,sessionRuntime:g6,sessionStatus:v6,statusDot:y6,attentionRow:b6,attentionTitle:_6,attentionMeta:x6,reasonBadge:S6,bottomGrid:T6,envRow:k6,envName:w6,envStatusBadge:N6,workspaceRow:j6,workspaceTop:C6,workspaceName:E6,workspaceCounts:A6,progressBar:D6,progressFill:R6},M6={hidden:{opacity:0,y:12},visible:n=>({opacity:1,y:0,transition:{delay:n*.06,duration:.3,ease:"easeOut"}})},rc={hidden:{opacity:0,y:16},visible:n=>({opacity:1,y:0,transition:{delay:.15+n*.08,duration:.35,ease:"easeOut"}})};function O6(n,s,i,o){const c=[`${n} of ${s} tasks completed`];return i>0&&c.push(`${i} in progress`),o>0&&c.push(`${o} failed`),c.join(", ")}function lc({value:n,label:s,accent:i,index:o,testId:c}){return l.jsxs(Ot.div,{className:_e.kpiCard,"data-accent":i,"data-testid":c,variants:M6,initial:"hidden",animate:"visible",custom:o,children:[l.jsx("span",{className:_e.kpiValue,children:n}),l.jsx("span",{className:_e.kpiLabel,children:s})]})}function I6(){const{workspaces:n,tasks:s,sessions:i,environments:o,loadTasks:c}=pt(),u=St(),d=y.useRef(new Set);y.useEffect(()=>{for(const b of n)d.current.has(b.id)||(d.current.add(b.id),c(b.id))},[n,c]);const m=y.useMemo(()=>J3(i,s,o),[i,s,o]),h=y.useMemo(()=>X3(i,o),[i,o]),g=y.useMemo(()=>W3(s,n),[s,n]),v=y.useMemo(()=>Q3(n,s),[n,s,o]);return l.jsxs("div",{className:_e.dashboard,"data-testid":"dashboard",children:[l.jsxs("div",{className:_e.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[l.jsx(lc,{value:m.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),l.jsx(lc,{value:m.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),l.jsx(lc,{value:m.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),l.jsx(lc,{value:m.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),l.jsxs("div",{className:_e.bodyGrid,children:[l.jsxs(Ot.div,{className:_e.section,variants:rc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[l.jsxs("div",{className:_e.sectionHeader,children:[l.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"●"}),l.jsx("span",{className:_e.sectionTitle,children:"Active Sessions"}),l.jsx("span",{className:_e.sectionCount,children:h.length})]}),l.jsx("div",{className:_e.sectionBody,children:h.length===0?l.jsx("div",{className:_e.emptyHint,children:"No active sessions"}):h.map(({session:b,environmentName:_})=>l.jsxs("button",{type:"button",className:_e.sessionRow,onClick:()=>u(jb(b.id)),"data-testid":"session-row",children:[l.jsx("span",{className:_e.sessionPrompt,title:b.prompt,children:b.prompt||"—"}),l.jsx("span",{className:_e.sessionEnv,children:_}),l.jsx("span",{className:_e.sessionRuntime,children:b.runtime}),l.jsxs("span",{className:_e.sessionStatus,children:[l.jsx("span",{className:_e.statusDot,"data-status":b.status}),b.status]})]},b.id))})]}),l.jsxs(Ot.div,{className:_e.section,variants:rc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[l.jsxs("div",{className:_e.sectionHeader,children:[l.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"⚑"}),l.jsx("span",{className:_e.sectionTitle,children:"Needs Attention"}),l.jsx("span",{className:_e.sectionCount,children:g.length})]}),l.jsx("div",{className:_e.sectionBody,children:g.length===0?l.jsx("div",{className:_e.emptyHint,children:"All clear"}):g.map(({task:b,reason:_,workspaceName:S})=>l.jsxs("button",{type:"button",className:_e.attentionRow,onClick:()=>u(os(b.id)),"data-testid":"attention-row",children:[l.jsxs("div",{className:_e.attentionTitle,children:[l.jsx("span",{className:_e.reasonBadge,"data-reason":_,children:_}),b.title]}),l.jsx("div",{className:_e.attentionMeta,children:l.jsx("span",{children:S})})]},b.id))})]})]}),l.jsxs("div",{className:_e.bottomGrid,children:[l.jsxs(Ot.div,{className:_e.section,variants:rc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[l.jsxs("div",{className:_e.sectionHeader,children:[l.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"◈"}),l.jsx("span",{className:_e.sectionTitle,children:"Environment Health"}),l.jsx("span",{className:_e.sectionCount,children:o.length})]}),l.jsx("div",{className:_e.sectionBody,children:o.length===0?l.jsx("div",{className:_e.emptyHint,children:"No environments configured"}):o.map(b=>l.jsxs("div",{className:_e.envRow,"data-testid":"dashboard-env-row",children:[l.jsx("span",{className:_e.envName,children:b.displayName}),l.jsx("span",{className:_e.envStatusBadge,"data-status":b.status,children:b.status})]},b.id))})]}),l.jsxs(Ot.div,{className:_e.section,variants:rc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[l.jsxs("div",{className:_e.sectionHeader,children:[l.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"▦"}),l.jsx("span",{className:_e.sectionTitle,children:"Workspaces"}),l.jsx("span",{className:_e.sectionCount,children:n.length})]}),l.jsx("div",{className:_e.sectionBody,children:v.length===0?l.jsx("div",{className:_e.emptyHint,children:"No workspaces yet"}):v.map(({workspace:b,totalTasks:_,completedTasks:S,workingTasks:T,failedTasks:N})=>{const j=_>0?Math.round(S/_*100):0;return l.jsxs("button",{type:"button",className:_e.workspaceRow,onClick:()=>u(Wi(b.id,b.environmentId)),"data-testid":"workspace-row",children:[l.jsxs("div",{className:_e.workspaceTop,children:[l.jsx("span",{className:_e.workspaceName,children:b.name}),l.jsxs("span",{className:_e.workspaceCounts,"aria-label":O6(S,_,T,N),children:[S,"/",_,T>0&&l.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",T]}),N>0&&l.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",N]})]})]}),_>0&&l.jsx("div",{className:_e.progressBar,children:l.jsx("div",{className:_e.progressFill,style:{width:`${j}%`}})})]},b.id)})})]})]})]})}const B6="_panelContainer_1h5qd_1",L6="_emptyState_1h5qd_8",U6="_fadeIn_1h5qd_1",z6="_workspaceSummary_1h5qd_17",P6="_workspaceSummaryTitle_1h5qd_28",V6="_workspaceSummarySubtitle_1h5qd_32",H6="_header_1h5qd_36",q6="_headerInfo_1h5qd_71",G6="_killButton_1h5qd_77",$6="_headerTitle_1h5qd_106",F6="_headerActions_1h5qd_121",Z6="_taskStatusBadge_1h5qd_128",K6="_taskBranch_1h5qd_137",Y6="_taskBlockedBadge_1h5qd_143",J6="_btnPrimary_1h5qd_151",W6="_btnDanger_1h5qd_182",X6="_btnGhost_1h5qd_221",Q6="_rejectInput_1h5qd_247",eO="_tabBar_1h5qd_277",tO="_tab_1h5qd_277",nO="_active_1h5qd_303",sO="_eventScroll_1h5qd_308",aO="_tabContent_1h5qd_314",iO="_noContext_1h5qd_319",oO="_overviewContent_1h5qd_325",rO="_overviewDashboard_1h5qd_334",lO="_overviewHero_1h5qd_340",cO="_statusBadge_1h5qd_347",uO="_statusPending_1h5qd_359",dO="_statusAssigned_1h5qd_364",fO="_statusInProgress_1h5qd_369",pO="_statusReview_1h5qd_374",mO="_statusDone_1h5qd_379",hO="_statusFailed_1h5qd_384",gO="_statusWaitingInput_1h5qd_389",vO="_overviewBranchPill_1h5qd_394",yO="_branchLink_1h5qd_409",bO="_overviewSection_1h5qd_420",_O="_overviewLabel_1h5qd_426",xO="_overviewValue_1h5qd_433",SO="_overviewMuted_1h5qd_438",TO="_overviewMarkdown_1h5qd_444",kO="_envRow_1h5qd_513",wO="_envDot_1h5qd_519",NO="_envDotGreen_1h5qd_526",jO="_envDotYellow_1h5qd_530",CO="_envDotRed_1h5qd_534",EO="_envDotGray_1h5qd_538",AO="_depList_1h5qd_542",DO="_depItem_1h5qd_548",RO="_depBlocked_1h5qd_555",MO="_depDone_1h5qd_559",OO="_timeline_1h5qd_563",IO="_timelineRow_1h5qd_569",BO="_timelineKey_1h5qd_576",LO="_timelineValue_1h5qd_582",UO="_timelineDelta_1h5qd_586",zO="_reviewNotes_1h5qd_597",PO="_overviewDescription_1h5qd_608",VO="_waitingMessage_1h5qd_614",HO="_errorMessage_1h5qd_618",qO="_eventOverflowWarning_1h5qd_622",GO="_attemptSelector_1h5qd_636",$O="_attemptLabel_1h5qd_652",FO="_attemptButton_1h5qd_656",ZO="_attemptActive_1h5qd_673",KO="_attemptStatus_1h5qd_679",YO="_emptyCta_1h5qd_685",JO="_ctaTitle_1h5qd_697",WO="_ctaDescription_1h5qd_703",XO="_ctaButton_1h5qd_710",QO="_ctaCreateForm_1h5qd_745",eI="_ctaCreateInput_1h5qd_751",tI="_ctaCreateOk_1h5qd_782",nI="_ctaLink_1h5qd_817",sI="_workspaceHeader_1h5qd_831",aI="_workspaceName_1h5qd_856",iI="_workspaceMeta_1h5qd_869",oI="_metaRow_1h5qd_877",rI="_metaLabel_1h5qd_890",lI="_metaValue_1h5qd_905",cI="_archiveButton_1h5qd_915",uI="_repoLink_1h5qd_945",dI="_metaToggle_1h5qd_955",fI="_metaToggleArrow_1h5qd_976",pI="_metaToggleArrowOpen_1h5qd_981",mI="_progressBarContainer_1h5qd_985",hI="_progressBar_1h5qd_985",gI="_progressFill_1h5qd_1001",vI="_progressLabel_1h5qd_1008",yI="_metaTimestamps_1h5qd_1015",bI="_metaTimestamp_1h5qd_1015",U={panelContainer:B6,emptyState:L6,fadeIn:U6,workspaceSummary:z6,workspaceSummaryTitle:P6,workspaceSummarySubtitle:V6,header:H6,headerInfo:q6,killButton:G6,headerTitle:$6,headerActions:F6,taskStatusBadge:Z6,taskBranch:K6,taskBlockedBadge:Y6,btnPrimary:J6,btnDanger:W6,btnGhost:X6,rejectInput:Q6,tabBar:eO,tab:tO,active:nO,eventScroll:sO,tabContent:aO,noContext:iO,overviewContent:oO,overviewDashboard:rO,overviewHero:lO,statusBadge:cO,statusPending:uO,statusAssigned:dO,statusInProgress:fO,statusReview:pO,statusDone:mO,statusFailed:hO,statusWaitingInput:gO,overviewBranchPill:vO,branchLink:yO,overviewSection:bO,overviewLabel:_O,overviewValue:xO,overviewMuted:SO,overviewMarkdown:TO,envRow:kO,envDot:wO,envDotGreen:NO,envDotYellow:jO,envDotRed:CO,envDotGray:EO,depList:AO,depItem:DO,depBlocked:RO,depDone:MO,timeline:OO,timelineRow:IO,timelineKey:BO,timelineValue:LO,timelineDelta:UO,reviewNotes:zO,overviewDescription:PO,waitingMessage:VO,errorMessage:HO,eventOverflowWarning:qO,attemptSelector:GO,attemptLabel:$O,attemptButton:FO,attemptActive:ZO,attemptStatus:KO,emptyCta:YO,ctaTitle:JO,ctaDescription:WO,ctaButton:XO,ctaCreateForm:QO,ctaCreateInput:eI,ctaCreateOk:tI,ctaLink:nI,workspaceHeader:sI,workspaceName:aI,workspaceMeta:iI,metaRow:oI,metaLabel:rI,metaValue:lI,archiveButton:cI,repoLink:uI,metaToggle:dI,metaToggleArrow:fI,metaToggleArrowOpen:pI,progressBarContainer:mI,progressBar:hI,progressFill:gI,progressLabel:vI,metaTimestamps:yI,metaTimestamp:bI};function _I(){return l.jsx("div",{className:U.emptyState,children:"Select a task or click + to create one"})}function xI(){return l.jsx("div",{className:U.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function SI(){const{workspaces:n,environments:s}=pt(),i=St(),o=s.length>0;return n.length>0?l.jsx(I6,{}):l.jsxs("div",{className:U.emptyCta,"data-testid":"welcome-cta",children:[l.jsx("div",{className:U.ctaTitle,children:"Welcome to Grackle"}),l.jsx("div",{className:U.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),l.jsx("button",{className:U.ctaButton,onClick:()=>i(Ab),disabled:!o,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!o&&l.jsx("div",{className:U.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const Rx=50;function TI(n,s,i,o,c=Rx){return o?n<c:s-n-i<c}function kI(n,s){const i=s-n;return i>0?i:0}function wI({scrollRef:n,contentLength:s,isReversed:i}){const[o,c]=y.useState(!0),u=y.useRef(0),d=y.useRef(!1),m=y.useRef(0);y.useEffect(()=>{const g=n.current;if(!g)return;let v=!0;const b=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const _=TI(g.scrollTop,g.scrollHeight,g.clientHeight,i,Rx);_!==v&&(v=_,c(_))}))};return g.addEventListener("scroll",b,{passive:!0}),()=>{g.removeEventListener("scroll",b),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[n,i]),y.useLayoutEffect(()=>{const g=n.current;!g||d.current||(d.current=!0,i?g.scrollTop=0:g.scrollTop=g.scrollHeight,c(!0))},[n,i]),y.useLayoutEffect(()=>{const g=n.current;if(g){if(i&&!o){const v=kI(u.current,g.scrollHeight);v>0&&(g.scrollTop+=v)}o&&(i?g.scrollTo({top:0,behavior:"smooth"}):g.scrollTo({top:g.scrollHeight,behavior:"smooth"})),u.current=g.scrollHeight}},[s,o,i,n]);const h=y.useCallback(()=>{const g=n.current;if(!g)return;const v=i?0:g.scrollHeight;g.scrollTo({top:v,behavior:"smooth"}),c(!0)},[n,i]);return{isAtAnchor:o,scrollToAnchor:h}}const NI="_wrapper_p24zt_1",jI="_scrollContainer_p24zt_9",CI="_toolbar_p24zt_15",EI="_directionToggle_p24zt_22",AI="_scrollToAnchor_p24zt_60",DI="_scrollToAnchorBottom_p24zt_84",RI="_scrollToAnchorTop_p24zt_88",Ha={wrapper:NI,scrollContainer:jI,toolbar:CI,directionToggle:EI,scrollToAnchor:AI,scrollToAnchorBottom:DI,scrollToAnchorTop:RI},Mx="grackle-stream-direction";function MI(){try{return localStorage.getItem(Mx)==="reversed"}catch{return!1}}function OI({eventsDropped:n}){return n<=0?l.jsx(l.Fragment,{}):l.jsxs("div",{className:U.eventOverflowWarning,role:"alert",children:["⚠"," ",n.toLocaleString()," older event",n===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function sm({events:n,eventsDropped:s,emptyState:i}){const o=y.useRef(null),[c,u]=y.useState(MI),d=eA(),m=y.useMemo(()=>c?[...n].reverse():n,[n,c]),{isAtAnchor:h,scrollToAnchor:g}=wI({scrollRef:o,contentLength:n.length,isReversed:c}),v=()=>{const S=!c;u(S);try{localStorage.setItem(Mx,S?"reversed":"default")}catch{}},b=d?0:.2,_=c?-8:8;return l.jsxs("div",{className:Ha.wrapper,children:[l.jsx("div",{className:Ha.toolbar,children:l.jsx("button",{className:Ha.directionToggle,onClick:v,title:c?"Showing newest first":"Showing oldest first","aria-label":c?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:c?"↓":"↑"})}),l.jsxs("div",{ref:o,className:Ha.scrollContainer,"data-testid":"event-stream-scroll",children:[n.length===0&&i,l.jsx(OI,{eventsDropped:s}),l.jsx(rs,{initial:!1,children:m.map((S,T)=>{const N=c?n.length-1-T:T;return l.jsx(Ot.div,{initial:{opacity:0,y:_},animate:{opacity:1,y:0},transition:{duration:b,ease:"easeOut"},children:l.jsx(E3,{event:S,toolUseCtx:S.toolUseCtx})},`${S.sessionId}-${S.timestamp}-${N}`)})})]}),l.jsx(rs,{children:!h&&l.jsxs(Ot.button,{className:`${Ha.scrollToAnchor} ${c?Ha.scrollToAnchorTop:Ha.scrollToAnchorBottom}`,onClick:g,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:[c?"↑":"↓"," New events"]})})]})}const II="_bar_1xhb4_1",BI="_input_1xhb4_32",LI="_select_1xhb4_67",UI="_btnPrimary_1xhb4_103",zI="_btnGhost_1xhb4_173",PI="_badge_1xhb4_195",VI="_disconnectHint_1xhb4_205",bn={bar:II,input:BI,select:LI,btnPrimary:UI,btnGhost:zI,badge:PI,disconnectHint:VI};function HI(n,s){if(!n)return!1;const i=s.find(o=>o.id===n);return i!==void 0&&(i.status==="disconnected"||i.status==="error")}function qI({environmentId:n,onReconnect:s}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:bn.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),l.jsx("button",{type:"button",onClick:()=>s(n),className:bn.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function jr({mode:n,sessionId:s,environmentId:i,taskId:o,showPersonaSelect:c,personas:u,environments:d,onSendInput:m,onSpawn:h,onStartTask:g,onProvisionEnvironment:v,onShowToast:b}){const[_,S]=y.useState(""),[T,N]=y.useState(""),j=HI(i,d),w=C=>{if(C.preventDefault(),!!_.trim())if(n==="send"){if(!s||j)return;m(s,_),S("")}else if(n==="spawn"){if(!i)return;h(i,_,T),b==null||b("Session started","success"),S(""),N("")}else{if(!o)return;g(o,void 0,i,_),S("")}};return n==="spawn"?l.jsxs("form",{onSubmit:w,className:bn.bar,children:[l.jsx("span",{className:bn.badge,children:"new chat"}),l.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:bn.input}),c&&l.jsxs("select",{value:T,onChange:C=>N(C.target.value),className:bn.select,children:[l.jsx("option",{value:"",children:"(Default)"}),u.map(C=>l.jsx("option",{value:C.id,children:C.name},C.id))]}),l.jsx("button",{type:"submit",disabled:!_.trim()||!i,className:bn.btnPrimary,children:"Go"})]}):n==="start"?l.jsxs("form",{onSubmit:w,className:bn.bar,children:[l.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:bn.input}),l.jsx("button",{type:"submit",disabled:!_.trim(),className:bn.btnPrimary,children:"Send"})]}):l.jsxs("form",{onSubmit:w,className:bn.bar,children:[j&&i&&l.jsx(qI,{environmentId:i,onReconnect:v}),l.jsx("input",{type:"text",value:_,onChange:C=>S(C.target.value),placeholder:"Type a message...",autoFocus:!j,disabled:j,className:bn.input}),l.jsx("span",{title:j?"Environment is unavailable — reconnect first":void 0,children:l.jsx("button",{type:"submit",disabled:!_.trim()||j,className:bn.btnPrimary,children:"Send"})})]})}function am(n){const s=[];for(const i of n){const o=s[s.length-1];i.eventType==="text"&&(o==null?void 0:o.eventType)==="text"?s[s.length-1]={...o,content:o.content+i.content}:s.push(i)}return s}function im(n){const s=new Map;for(const u of n)if(u.raw)try{s.set(u,JSON.parse(u.raw))}catch{}const i=new Map;for(const u of n){if(u.eventType!=="tool_use")continue;const d=s.get(u);if(!(!d||typeof d.id!="string"))try{const m=JSON.parse(u.content);i.set(d.id,{tool:m.tool,args:m.args})}catch{}}const o=new Set;return n.map(u=>{if(u.eventType!=="tool_result")return u;const d=s.get(u);if(!d||typeof d.tool_use_id!="string")return u;const m=i.get(d.tool_use_id);if(!m)return u;o.add(d.tool_use_id);let h;const g=u.content.trim();if(g.startsWith("{"))try{const v=JSON.parse(g);typeof v.detailedContent=="string"&&(h=v.detailedContent)}catch{}return{...u,toolUseCtx:{...m,detailedResult:h}}}).filter(u=>{if(u.eventType!=="tool_use")return!0;const d=s.get(u);return d&&typeof d.id=="string"?!o.has(d.id):!0})}const GI="_panelContainer_19poq_1",$I="_chatHeader_19poq_8",FI="_chatHeaderInfo_19poq_37",ZI="_emptyState_19poq_43",KI="_emptyTitle_19poq_55",YI="_emptyDescription_19poq_61",JI="_emptyHint_19poq_67",Za={panelContainer:GI,chatHeader:$I,chatHeaderInfo:FI,emptyState:ZI,emptyTitle:KI,emptyDescription:YI,emptyHint:JI};function WI({hasLocalEnvironment:n}){return l.jsxs("div",{className:Za.emptyState,"data-testid":"chat-empty-state",children:[l.jsx("div",{className:Za.emptyTitle,children:"Welcome to Grackle"}),l.jsx("div",{className:Za.emptyDescription,children:n?"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."}),!n&&l.jsx("div",{className:Za.emptyHint,children:"Go to Settings → Environments to add one."})]})}function XI(){const{tasks:n,sessions:s,events:i,eventsDropped:o,environments:c,loadTaskSessions:u,loadSessionEvents:d,kill:m,stopGraceful:h,taskSessions:g,sendInput:v,spawn:b,startTask:_,personas:S,provisionEnvironment:T}=pt(),{showToast:N}=dn(),j=y.useRef(void 0),[w,C]=y.useState(),A=n.find(F=>F.id===nr),M=A!=null&&A.latestSessionId?s.find(F=>F.id===A.latestSessionId)??(g[nr]??[]).find(F=>F.id===A.latestSessionId):void 0;y.useEffect(()=>{u(nr)},[u]),y.useEffect(()=>{A!=null&&A.latestSessionId&&u(nr)},[A==null?void 0:A.latestSessionId,u]),y.useEffect(()=>{M&&M.id!==j.current&&(j.current=M.id,d(M.id))},[M==null?void 0:M.id,d]);const D=y.useMemo(()=>{if(!M)return[];const F=i.filter(Q=>Q.sessionId===M.id);return im(am(F))},[i,M==null?void 0:M.id]),E=c.find(F=>F.adapterType==="local"&&F.status==="connected"),H=M!==void 0&&M.status!=="stopped"&&M.status!=="suspended",z=(M==null?void 0:M.status)==="idle";y.useEffect(()=>{w&&M&&z&&(v(M.id,w),C(void 0))},[w,z,M==null?void 0:M.id,v]);const Z=y.useCallback((F,Q,ae,pe)=>{pe&&C(pe),_(F,Q,ae)},[_]);return l.jsxs("div",{className:Za.panelContainer,"data-testid":"chat-page",children:[H&&l.jsxs("div",{className:Za.chatHeader,children:[l.jsxs("span",{className:Za.chatHeaderInfo,children:["Session: ",M.id.slice(0,8)," | ",M.runtime," | ",M.status]}),l.jsx(jx,{label:"Stop",onClick:()=>h(M.id),variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>h(M.id)},{label:"Kill",description:"Force kill",onClick:()=>m(M.id)}]})]}),l.jsx(sm,{events:D,eventsDropped:o,emptyState:l.jsx(WI,{hasLocalEnvironment:!!E})}),E&&H&&l.jsx(jr,{mode:"send",sessionId:M.id,environmentId:M.environmentId,personas:S,environments:c,onSendInput:v,onSpawn:b,onStartTask:_,onProvisionEnvironment:T,onShowToast:N}),E&&!H&&l.jsx(jr,{mode:"start",taskId:nr,environmentId:E.id,personas:S,environments:c,onSendInput:v,onSpawn:b,onStartTask:Z,onProvisionEnvironment:T,onShowToast:N})]})}function QI(n,s){const i=[];let o=n;const c=new Set;for(;o&&s.has(o)&&!c.has(o);){c.add(o);const u=s.get(o);i.unshift(u),o=u.parentTaskId||void 0}return i}const Wa={label:"Home",url:Ya};function e5(n){return n?[Wa,{label:"Settings",url:Ji},{label:n,url:void 0}]:[Wa,{label:"Settings",url:void 0}]}const Ox={label:"Environments",url:Xi};function t5(){return[Wa,{label:"Environments",url:void 0}]}function n5(){return[Wa,{label:"New Chat",url:void 0}]}function s5(n){return[Wa,{label:`Session ${n.slice(0,8)}`,url:void 0}]}function a5(n,s,i,o){const c=i.find(d=>d.id===n),u=o.find(d=>d.id===s);return[Wa,Ox,{label:(u==null?void 0:u.displayName)??"Environment",url:Qi(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function i5(n,s,i,o,c){const u=QI(n,c),d=c.get(n),m=d==null?void 0:d.workspaceId,h=m?i.find(S=>S.id===m):void 0,g=s??(h==null?void 0:h.environmentId),v=g?o.find(S=>S.id===g):void 0,b=[Wa];v&&g&&(b.push(Ox),b.push({label:v.displayName,url:Qi(g)})),h&&g&&b.push({label:h.name,url:Wi(h.id,g)});for(let S=0;S<u.length-1;S++)b.push({label:u[S].title,url:os(u[S].id,void 0,m,g)});const _=u[u.length-1];return b.push({label:(_==null?void 0:_.title)??n,url:void 0}),b}function o5(){const n=n5(),[s]=bp(),i=s.get("env")??"",{sendInput:o,spawn:c,startTask:u,personas:d,environments:m,provisionEnvironment:h}=pt(),{showToast:g}=dn();return l.jsxs("div",{className:U.panelContainer,children:[l.jsx(ba,{segments:n}),l.jsx("div",{className:U.emptyState,children:"Enter a prompt below to start a new session"}),l.jsx(jr,{mode:"spawn",environmentId:i,showPersonaSelect:!0,personas:d,environments:m,onSendInput:o,onSpawn:c,onStartTask:u,onProvisionEnvironment:h,onShowToast:g})]})}function r5({sessionId:n,session:s,isActive:i,onStop:o,onKill:c}){return l.jsxs("div",{className:U.header,children:[l.jsxs("span",{children:["Session: ",n.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costUsd?` | ${Cx((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${so(s.costUsd??0)}`:""]}),l.jsxs("span",{className:U.headerInfo,children:[s&&l.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),i&&l.jsx(jx,{label:"Stop",onClick:o,variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:o},{label:"Kill",description:"Force kill",onClick:c}]})]})]})}function l5({session:n}){const s=n&&(n.status==="stopped"||n.status==="suspended"),i=s?`Session ${n.endReason||n.status} with no events recorded.`:"Waiting for events...";return l.jsx("div",{className:s?U.errorMessage:U.waitingMessage,children:i})}function c5(){const{sessionId:n}=va(),{events:s,eventsDropped:i,sessions:o,kill:c,stopGraceful:u,loadSessionEvents:d,sendInput:m,spawn:h,startTask:g,personas:v,environments:b,provisionEnvironment:_}=pt(),{showToast:S}=dn(),T=y.useRef(void 0),N=s5(n),j=o.find(A=>A.id===n)??void 0,w=y.useMemo(()=>{const A=n?s.filter(M=>M.sessionId===n):[];return im(am(A))},[s,n]);if(y.useEffect(()=>{n&&n!==T.current&&(T.current=n,d(n))},[n,d]),!n)return l.jsx("div",{className:U.emptyState,children:"No session selected"});const C=(j==null?void 0:j.status)==="running"||(j==null?void 0:j.status)==="idle";return l.jsxs("div",{className:U.panelContainer,children:[l.jsx(ba,{segments:N}),l.jsx(r5,{sessionId:n,session:j,isActive:C,onStop:()=>u(n),onKill:()=>c(n)}),l.jsx(sm,{events:w,eventsDropped:i,emptyState:l.jsx(l5,{session:j})}),C&&l.jsx(jr,{mode:"send",sessionId:n,environmentId:j.environmentId,personas:v,environments:b,onSendInput:m,onSpawn:h,onStartTask:g,onProvisionEnvironment:_,onShowToast:S})]})}function u5(n){if(!n)return!1;const s=n.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||n.isContentEditable)}function Ms(n,s){const i=y.useRef(s);i.current=s;const{key:o,ctrl:c=!1,shift:u=!1,suppressInInputs:d=!0,enabled:m=!0}=n;y.useEffect(()=>{if(!m)return;const h=g=>{if(d&&u5(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(u&&!g.shiftKey||g.key===o&&i.current())};return document.addEventListener("keydown",h),()=>{document.removeEventListener("keydown",h)}},[o,c,u,d,m])}const Ky=220,Yy=70,d5=40,f5=60,p5="hierarchy",m5="dependency";function h5(n){return y.useMemo(()=>{if(n.length===0)return{nodes:[],edges:[]};const s=new Qv.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:d5,ranksep:f5});const i=new Map(n.map(d=>[d.id,d])),o=new Map;for(const d of n)if(d.parentTaskId&&i.has(d.parentTaskId)){const m=o.get(d.parentTaskId)||[];m.push(d),o.set(d.parentTaskId,m)}for(const d of n)s.setNode(d.id,{width:Ky,height:Yy});const c=[];for(const d of n){if(d.parentTaskId&&i.has(d.parentTaskId)){const m=`hierarchy-${d.parentTaskId}-${d.id}`;s.setEdge(d.parentTaskId,d.id,{},m),c.push({id:m,source:d.parentTaskId,target:d.id,type:"smoothstep",data:{edgeType:p5},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const m of d.dependsOn)if(i.has(m)){const h=`dependency-${m}-${d.id}`;s.setEdge(m,d.id,{},h),c.push({id:h,source:m,target:d.id,type:"smoothstep",data:{edgeType:m5},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return Qv.layout(s),{nodes:n.map(d=>{const m=s.node(d.id),h=o.get(d.id)||[];return{id:d.id,type:"task",position:{x:m.x-Ky/2,y:m.y-Yy/2},data:{task:d,childCount:h.length,doneChildCount:h.filter(g=>g.status==="complete").length,hasDependencies:d.dependsOn.length>0}}}),edges:c}},[n])}const g5="_dagContainer_js4w6_1",v5="_taskNode_js4w6_26",y5="_taskNodeBorder_js4w6_54",b5="_taskNodeContent_js4w6_60",_5="_taskNodeHeader_js4w6_70",x5="_taskNodeIcon_js4w6_77",S5="_taskNodeTitle_js4w6_82",T5="_taskNodeBadges_js4w6_90",k5="_childBadge_js4w6_95",w5="_depBadge_js4w6_107",N5="_handle_js4w6_119",j5="_emptyCta_js4w6_126",C5="_ctaDescription_js4w6_137",E5="_ctaButton_js4w6_144",nn={dagContainer:g5,taskNode:v5,taskNodeBorder:y5,taskNodeContent:b5,taskNodeHeader:_5,taskNodeIcon:x5,taskNodeTitle:S5,taskNodeBadges:T5,childBadge:k5,depBadge:w5,handle:N5,emptyCta:j5,ctaDescription:C5,ctaButton:E5};function A5({data:n}){const{task:s,childCount:i,doneChildCount:o,hasDependencies:c}=n,u=ga(s.status);return l.jsxs("div",{className:nn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[l.jsx(e0,{type:"target",position:t0.Top,className:nn.handle}),l.jsx("div",{className:nn.taskNodeBorder,style:{backgroundColor:u.color}}),l.jsxs("div",{className:nn.taskNodeContent,children:[l.jsxs("div",{className:nn.taskNodeHeader,children:[l.jsx("span",{className:nn.taskNodeIcon,style:{color:u.color},children:u.icon}),l.jsx("span",{className:nn.taskNodeTitle,children:s.title})]}),l.jsxs("div",{className:nn.taskNodeBadges,children:[i>0&&l.jsxs("span",{className:nn.childBadge,children:[o,"/",i]}),c&&l.jsx("span",{className:nn.depBadge,children:"dep"})]})]}),l.jsx(e0,{type:"source",position:t0.Bottom,className:nn.handle})]})}const D5=iA,R5={task:A5};function M5({workspaceId:n,environmentId:s,tasks:i,resolvedThemeId:o}){const c=St(),u=y.useMemo(()=>i.filter(b=>b.workspaceId===n),[i,n]),{nodes:d,edges:m}=h5(u),h=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[S,T]of Object.entries(D5))_[S]=b.getPropertyValue(T).trim()||"#6b7a8d";return _},[o]),g=y.useCallback((b,_)=>{c(os(_.id,void 0,n,s))},[c,n,s]),v=y.useCallback(b=>{const _=b.data;return h[_.task.status]||h.pending},[h]);return u.length===0?l.jsxs("div",{className:nn.emptyCta,children:[l.jsx("button",{className:nn.ctaButton,onClick:()=>c(ei(n,void 0,s)),children:"Create Task"}),l.jsx("div",{className:nn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):l.jsx("div",{className:nn.dagContainer,children:l.jsxs(tT,{nodes:d,edges:m,nodeTypes:R5,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[l.jsx(nT,{variant:sT.Dots,gap:24,size:1,color:"var(--text-disabled)"}),l.jsx(aT,{showInteractive:!1}),l.jsx(iT,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}function O5({tasks:n,taskStatusById:s,sessionStatusByTaskId:i}){const o=new Map;for(const u of n)if(u.parentTaskId){const d=o.get(u.parentTaskId);d?d.push(u):o.set(u.parentTaskId,[u])}const c=new Map(Py.map(u=>[u,[]]));for(const u of n){const d=nm(u.status),m=u.dependsOn.length>0&&u.dependsOn.some(T=>s.get(T)!=="complete"),h=o.get(u.id)??[],g=h.length,v=h.filter(T=>T.status==="complete").length;let b;if(d==="paused"&&i){const T=i.get(u.id);T==="idle"?b="Needs input":T==="completed"&&(b="Ready to complete")}const _={task:u,isBlocked:m,childCount:g,doneChildCount:v,pausedSubBadge:b},S=c.get(d);S?S.push(_):c.get("not_started").push(_)}for(const u of c.values())u.sort((d,m)=>d.task.sortOrder-m.task.sortOrder);return Py.map(u=>{const d=ga(u);return{status:u,label:d.label,style:d,tasks:c.get(u)??[]}})}const I5="_boardContainer_1c4y1_1",B5="_column_1c4y1_17",L5="_columnHeader_1c4y1_34",U5="_columnIcon_1c4y1_47",z5="_columnLabel_1c4y1_52",P5="_columnCount_1c4y1_57",V5="_cardList_1c4y1_67",H5="_emptyPlaceholder_1c4y1_76",q5="_card_1c4y1_67",G5="_cardHeader_1c4y1_107",$5="_cardStatusIcon_1c4y1_113",F5="_cardTitle_1c4y1_119",Z5="_cardBadges_1c4y1_127",K5="_badge_1c4y1_134",Y5="_blockedBadge_1c4y1_146",J5="_childBadge_1c4y1_151",W5="_depBadge_1c4y1_155",X5="_parentBadge_1c4y1_159",Q5="_pausedSubBadge_1c4y1_166",e4="_personaBadge_1c4y1_170",t4="_envBadge_1c4y1_174",n4="_emptyCta_1c4y1_178",s4="_ctaButton_1c4y1_188",a4="_ctaDescription_1c4y1_204",Xe={boardContainer:I5,column:B5,columnHeader:L5,columnIcon:U5,columnLabel:z5,columnCount:P5,cardList:V5,emptyPlaceholder:H5,card:q5,cardHeader:G5,cardStatusIcon:$5,cardTitle:F5,cardBadges:Z5,badge:K5,blockedBadge:Y5,childBadge:J5,depBadge:W5,parentBadge:X5,pausedSubBadge:Q5,personaBadge:e4,envBadge:t4,emptyCta:n4,ctaButton:s4,ctaDescription:a4};function i4({workspaceId:n,environmentId:s,tasks:i,sessions:o,personas:c,environments:u}){const d=St(),m=y.useMemo(()=>i.filter(_=>_.workspaceId===n),[i,n]),h=y.useMemo(()=>new Map(i.map(_=>[_.id,_.status])),[i]),g=y.useMemo(()=>new Map(m.map(_=>[_.id,_])),[m]),v=y.useMemo(()=>{const _=new Map(o.map(C=>[C.id,C])),S=new Map(c.map(C=>[C.id,C])),T=new Map(u.map(C=>[C.id,C])),N=new Map,j=new Map,w=new Map;for(const C of m)if(C.latestSessionId){const A=_.get(C.latestSessionId);if(A){if(N.set(C.id,A.endReason||A.status),A.personaId){const M=S.get(A.personaId);M&&j.set(C.id,M.name)}if(A.environmentId){const M=T.get(A.environmentId);M&&w.set(C.id,M.displayName)}}}return{sessionStatusByTaskId:N,personaNameByTaskId:j,environmentNameByTaskId:w}},[m,o,c,u]),b=y.useMemo(()=>O5({tasks:m,taskStatusById:h,sessionStatusByTaskId:v.sessionStatusByTaskId}),[m,h,v]);return m.length===0?l.jsxs("div",{className:Xe.emptyCta,"data-testid":"board-empty-cta",children:[l.jsx("button",{className:Xe.ctaButton,onClick:()=>d(ei(n,void 0,s)),children:"Create Task"}),l.jsx("div",{className:Xe.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):l.jsx("div",{className:Xe.boardContainer,"data-testid":"board-container",children:b.map(_=>l.jsxs("section",{className:Xe.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[l.jsxs("div",{className:Xe.columnHeader,children:[l.jsx("span",{className:Xe.columnIcon,style:{color:_.style.color},children:_.style.icon}),l.jsx("span",{className:Xe.columnLabel,children:_.label}),l.jsx("span",{className:Xe.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),l.jsx("div",{className:Xe.cardList,children:_.tasks.length===0?l.jsx("div",{className:Xe.emptyPlaceholder,children:"No tasks"}):l.jsx(rs,{mode:"popLayout",children:_.tasks.map(S=>l.jsx(Ot.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:l.jsx(o4,{boardTask:S,tasksById:g,personaName:v.personaNameByTaskId.get(S.task.id),envName:v.environmentNameByTaskId.get(S.task.id),onClick:()=>d(os(S.task.id,void 0,n,s))})},S.task.id))})})]},_.status))})}function o4({boardTask:n,tasksById:s,personaName:i,envName:o,onClick:c}){const{task:u,isBlocked:d,childCount:m,doneChildCount:h,pausedSubBadge:g}=n,v=ga(u.status),b=u.parentTaskId?s.get(u.parentTaskId):void 0;return l.jsxs("div",{className:Xe.card,tabIndex:0,role:"button","data-testid":`board-card-${u.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[l.jsxs("div",{className:Xe.cardHeader,children:[l.jsx("span",{className:Xe.cardStatusIcon,style:{color:v.color},children:v.icon}),l.jsx("span",{className:Xe.cardTitle,children:u.title})]}),l.jsxs("div",{className:Xe.cardBadges,children:[b&&l.jsx("span",{className:`${Xe.badge} ${Xe.parentBadge}`,title:b.title,children:b.title}),m>0&&l.jsxs("span",{className:`${Xe.badge} ${Xe.childBadge}`,children:[h,"/",m]}),d&&l.jsx("span",{className:`${Xe.badge} ${Xe.blockedBadge}`,children:"blocked"}),u.dependsOn.length>0&&!d&&l.jsx("span",{className:`${Xe.badge} ${Xe.depBadge}`,children:"dep"}),g&&l.jsx("span",{className:`${Xe.badge} ${Xe.pausedSubBadge}`,children:g}),i&&l.jsx("span",{className:`${Xe.badge} ${Xe.personaBadge}`,children:i}),o&&l.jsx("span",{className:`${Xe.badge} ${Xe.envBadge}`,children:o})]})]})}function om(n){const{value:s,onSave:i,validate:o,fieldId:c,activeFieldId:u,onActivate:d,enterToSave:m=!0,trimOnSave:h=!0}=n,[g,v]=y.useState(""),[b,_]=y.useState(""),S=y.useRef(!1),T=u===c,N=y.useCallback(H=>{v(H),_("")},[]),j=y.useCallback(()=>{_("")},[]),w=y.useCallback(()=>{S.current=!1,d==null||d(null),v(""),_("")},[d]),C=y.useCallback(()=>{const H=h?g.trim():g;if(o){const Z=o(g);if(Z){_(Z);return}}const z=h?s.trim():s;if(H===z){w();return}i(H),w()},[g,s,h,o,i,w]),A=y.useCallback(()=>{S.current=!0,d==null||d(c),v(s),_("")},[c,s,d]),M=y.useCallback(H=>{if(S.current){S.current=!1;return}H.relatedTarget instanceof HTMLElement&&H.relatedTarget.dataset.editAction===c||C()},[c,C]),D=y.useCallback(H=>{H.key==="Escape"?w():H.key==="Enter"&&m&&C()},[w,m,C]),E=(()=>{if(!T)return!1;const H=h?s.trim():s;return(h?g.trim():g)!==H})();return y.useEffect(()=>{!T&&(g!==""||b!=="")&&(v(""),_(""))},[T,g,b]),{isEditing:T,draft:g,error:b,isDirty:E,startEdit:A,cancelEdit:w,save:C,setDraft:N,clearError:j,handleBlur:M,handleKeyDown:D,ignoreInitialBlurRef:S}}const r4="_editFieldWrapper_yuzty_1",l4="_editInput_yuzty_10",c4="_editTextarea_yuzty_42",u4="_editSelect_yuzty_78",d4="_editError_yuzty_111",f4="_editInputInvalid_yuzty_118",p4="_editHint_yuzty_123",m4="_unsavedDot_yuzty_132",h4="_metaValueClickable_yuzty_140",g4="_editButton_yuzty_159",v4="_metaPlaceholder_yuzty_175",y4="_worktreeToggle_yuzty_180",Ye={editFieldWrapper:r4,editInput:l4,editTextarea:c4,editSelect:u4,editError:d4,editInputInvalid:f4,editHint:p4,unsavedDot:m4,metaValueClickable:h4,editButton:g4,metaPlaceholder:v4,worktreeToggle:y4};function Yt(n){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="text",activeFieldId:d,onActivate:m,onChange:h,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:_,"data-testid":S}=n,T=y.useRef(null),N=om({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:m,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(N.isEditing){const w=window.setTimeout(()=>{var C;(C=T.current)==null||C.focus()},0);return()=>window.clearTimeout(w)}},[N.isEditing]),c==="create"){const w=A=>{h==null||h(A.target.value)},C=o==null?void 0:o(s);return l.jsxs("div",{className:Ye.editFieldWrapper,children:[l.jsx("input",{className:`${Ye.editInput} ${C?Ye.editInputInvalid:""}`,value:s,onChange:w,maxLength:b,placeholder:v,"aria-label":_,"data-testid":S?`${S}-input`:void 0}),C&&l.jsx("span",{className:Ye.editError,"data-testid":"edit-error",children:C})]})}if(N.isEditing)return l.jsxs("div",{className:Ye.editFieldWrapper,children:[l.jsx("input",{ref:T,className:`${Ye.editInput} ${N.error?Ye.editInputInvalid:""}`,value:N.draft,onChange:w=>N.setDraft(w.target.value),onBlur:N.handleBlur,onKeyDown:N.handleKeyDown,maxLength:b,placeholder:v,"aria-label":_,"data-testid":S?`${S}-input`:void 0}),N.isDirty&&l.jsx("span",{className:Ye.unsavedDot,title:"Unsaved changes"}),N.error&&l.jsx("span",{className:Ye.editError,"data-testid":"edit-error",children:N.error}),l.jsx("span",{className:Ye.editHint,children:"Enter to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return l.jsxs("span",{role:"button",tabIndex:0,className:Ye.metaValueClickable,onClick:()=>N.startEdit(),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),N.startEdit())},title:"Click to edit","aria-label":_,"data-testid":S?`${S}-button`:void 0,children:[j!==void 0?j:s?l.jsx("span",{children:s}):l.jsx("span",{className:Ye.metaPlaceholder,children:v||"None"}),l.jsx("span",{className:Ye.editButton,"aria-hidden":"true",children:"✏️"})]})}function cp(n){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="textarea",activeFieldId:d,onActivate:m,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=n,S=y.useRef(null),T=om({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:m,enterToSave:!1,trimOnSave:!1});if(y.useEffect(()=>{if(T.isEditing){const j=window.setTimeout(()=>{var w;(w=S.current)==null||w.focus()},0);return()=>window.clearTimeout(j)}},[T.isEditing]),c==="create"){const j=C=>{h==null||h(C.target.value)},w=o==null?void 0:o(s);return l.jsxs("div",{className:Ye.editFieldWrapper,children:[l.jsx("textarea",{className:`${Ye.editTextarea} ${w?Ye.editInputInvalid:""}`,value:s,onChange:j,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),w&&l.jsx("span",{className:Ye.editError,"data-testid":"edit-error",children:w})]})}if(T.isEditing)return l.jsxs("div",{className:Ye.editFieldWrapper,children:[l.jsx("textarea",{ref:S,className:`${Ye.editTextarea} ${T.error?Ye.editInputInvalid:""}`,value:T.draft,onChange:j=>T.setDraft(j.target.value),onBlur:T.handleBlur,onKeyDown:T.handleKeyDown,title:b,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),T.isDirty&&l.jsx("span",{className:Ye.unsavedDot,title:"Unsaved changes"}),T.error&&l.jsx("span",{className:Ye.editError,"data-testid":"edit-error",children:T.error}),l.jsx("span",{className:Ye.editHint,children:"Tab to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return l.jsxs("span",{role:"button",tabIndex:0,className:Ye.metaValueClickable,onClick:()=>T.startEdit(),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),T.startEdit())},title:"Click to edit","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[N!==void 0?N:s?l.jsx("span",{children:s}):l.jsx("span",{className:Ye.metaPlaceholder,children:v||"None"}),l.jsx("span",{className:Ye.editButton,"aria-hidden":"true",children:"✏️"})]})}function Cc(n){var A;const{value:s,onSave:i,mode:o="edit",options:c,fieldId:u="select",activeFieldId:d,onActivate:m,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=n,S=y.useRef(null),T=om({value:s,onSave:i,fieldId:u,activeFieldId:d,onActivate:m,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(T.isEditing){const M=window.setTimeout(()=>{var D;(D=S.current)==null||D.focus()},0);return()=>window.clearTimeout(M)}},[T.isEditing]);const N=y.useCallback(M=>{const D=M.target.value;T.ignoreInitialBlurRef.current=!1,D!==s&&i(D),T.cancelEdit()},[s,i,T]),j=y.useCallback(M=>{if(T.ignoreInitialBlurRef.current){T.ignoreInitialBlurRef.current=!1;return}M.relatedTarget instanceof HTMLElement&&M.relatedTarget.dataset.editAction===u||T.cancelEdit()},[u,T]);if(o==="create")return l.jsx("select",{className:Ye.editSelect,value:s,onChange:M=>h==null?void 0:h(M.target.value),"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(M=>l.jsx("option",{value:M.value,children:M.label},M.value))});if(T.isEditing)return l.jsx("select",{ref:S,className:Ye.editSelect,value:T.draft,onChange:N,onBlur:j,title:b,"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(M=>l.jsx("option",{value:M.value,children:M.label},M.value))});const w=g==null?void 0:g(s),C=(A=c.find(M=>M.value===s))==null?void 0:A.label;return l.jsxs("button",{type:"button",className:Ye.metaValueClickable,onClick:()=>T.startEdit(),title:"Click to change","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[w!==void 0?w:C?l.jsx("span",{children:C}):l.jsx("span",{className:Ye.metaPlaceholder,children:v||"None"}),l.jsx("span",{className:Ye.editButton,"aria-hidden":"true",children:"✏️"})]})}function b4(n){const{checked:s,onChange:i,label:o,ariaLabel:c,"data-testid":u}=n;return l.jsxs("label",{className:Ye.worktreeToggle,"data-testid":u,children:[l.jsx("input",{type:"checkbox",checked:s,onChange:d=>i(d.target.checked),"aria-label":c}),l.jsx("span",{children:o})]})}const _4="_envRow_1e1r5_1",x4="_envDot_1e1r5_7",S4="_envDotGreen_1e1r5_14",T4="_envDotYellow_1e1r5_18",k4="_envDotRed_1e1r5_22",w4="_envDotGray_1e1r5_26",Yi={envRow:_4,envDot:x4,envDotGreen:S4,envDotYellow:T4,envDotRed:k4,envDotGray:w4};function N4(n){const s=n.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?Yi.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?Yi.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?Yi.envDotRed:Yi.envDotGray}function j4(n){const{value:s,onSave:i,environments:o,allowNone:c=!1,fieldId:u="environment",activeFieldId:d,onActivate:m,placeholder:h="No environment",ariaLabel:g="Environment","data-testid":v}=n,b=o.find(T=>T.id===s),_=[...c?[{value:"",label:"None"}]:[],...o.map(T=>({value:T.id,label:T.displayName}))],S=()=>{if(b)return l.jsxs("span",{className:Yi.envRow,children:[l.jsx("span",{className:`${Yi.envDot} ${N4(b.status)}`}),b.displayName]})};return l.jsx(Cc,{value:s,onSave:i,options:_,fieldId:u,activeFieldId:d,onActivate:m,renderDisplay:S,placeholder:h,ariaLabel:g,"data-testid":v})}function Jy(n){if(!n)return"";const s=new Date(n);if(isNaN(s.getTime()))return"";const o=Date.now()-s.getTime();if(o<0)return"just now";const c=Math.floor(o/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const u=Math.floor(c/60);if(u<24)return`${u}h ago`;const d=Math.floor(u/24);return d<30?`${d}d ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const Rf=100;function C4(n){try{const s=new URL(n);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function E4(){const{workspaceId:n,environmentId:s}=va(),i=St(),{tasks:o,environments:c,workspaces:u,personas:d,sessions:m,archiveWorkspace:h,updateWorkspace:g,usageCache:v,loadUsage:b}=pt(),{resolvedThemeId:_}=Hb(),[S,T]=y.useState("tasks"),[N,j]=y.useState(!1),[w,C]=y.useState(null),[A,M]=y.useState(!1),D=y.useRef(void 0),E=u.find(X=>X.id===n),H=s??(E==null?void 0:E.environmentId)??"",z=a5(n,H,u,c);Ms({key:"1"},()=>T("graph")),Ms({key:"2"},()=>T("board")),Ms({key:"3"},()=>T("tasks")),y.useEffect(()=>{const X=D.current;D.current=n,!(X===void 0||X===n)&&w!==null&&C(null)},[n,w]);const Z=m.reduce((X,B)=>X+(B.costUsd??0),0);y.useEffect(()=>{n&&b("workspace",n)},[n,b,Z]);const F=n?v[`workspace:${n}`]:void 0,Q=o.filter(X=>X.workspaceId===n),ae=Q.filter(X=>X.status==="complete").length,pe=Q.length,oe=pe>0?Math.round(ae/pe*100):0;return l.jsxs("div",{className:U.panelContainer,children:[l.jsx(ba,{segments:z}),l.jsxs("div",{className:U.workspaceHeader,children:[l.jsx("span",{className:U.workspaceName,"data-testid":"workspace-name",children:l.jsx(Yt,{value:(E==null?void 0:E.name)||"",onSave:X=>{E&&g(E.id,{name:X})},validate:X=>{const B=X.trim();if(!B)return"Name is required";if(B.length>Rf)return`Max ${Rf} characters`},maxLength:Rf,fieldId:"name",activeFieldId:w,onActivate:C,ariaLabel:"Workspace name",renderDisplay:X=>X||n||void 0,"data-testid":"edit-name"})}),l.jsx("button",{className:U.archiveButton,onClick:()=>j(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),l.jsxs("button",{className:U.metaToggle,onClick:()=>M(!A),"aria-expanded":!A,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[l.jsx("span",{className:`${U.metaToggleArrow} ${A?"":U.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!A&&l.jsxs("div",{className:U.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Description"}),l.jsx("div",{className:U.metaValue,children:l.jsx(cp,{value:(E==null?void 0:E.description)||"",onSave:X=>{E&&g(E.id,{description:X})},fieldId:"description",activeFieldId:w,onActivate:C,renderDisplay:X=>X?l.jsx("span",{className:U.overviewMarkdown,children:l.jsx(up,{remarkPlugins:[dp],children:X})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Repository"}),l.jsx("div",{className:U.metaValue,children:l.jsx(Yt,{value:(E==null?void 0:E.repoUrl)||"",onSave:X=>{E&&g(E.id,{repoUrl:X})},validate:X=>{const B=X.trim();if(B&&!/^https?:\/\/.+/.test(B))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:w,onActivate:C,renderDisplay:X=>{const B=C4(X);return B?l.jsx("a",{className:U.repoLink,href:B,target:"_blank",rel:"noopener noreferrer",onClick:$=>$.stopPropagation(),children:X}):X?l.jsx("span",{children:X}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Environment"}),l.jsx("div",{className:U.metaValue,children:l.jsx(j4,{value:(E==null?void 0:E.environmentId)||"",onSave:X=>{E&&X&&g(E.id,{environmentId:X})},environments:c,fieldId:"environmentId",activeFieldId:w,onActivate:C,placeholder:"Select environment",ariaLabel:"Workspace environment","data-testid":"edit-env"})})]}),l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Persona"}),l.jsx("div",{className:U.metaValue,children:l.jsx(Cc,{value:(E==null?void 0:E.defaultPersonaId)||"",onSave:X=>{E&&g(E.id,{defaultPersonaId:X})},options:[{value:"",label:"(Inherit)"},...d.map(X=>({value:X.id,label:X.name}))],fieldId:"defaultPersonaId",activeFieldId:w,onActivate:C,renderDisplay:X=>{const B=d.find($=>$.id===X);if(B)return l.jsx("span",{children:B.name})},placeholder:(E==null?void 0:E.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Worktrees"}),l.jsx("div",{className:U.metaValue,children:l.jsx(b4,{checked:(E==null?void 0:E.useWorktrees)??!0,onChange:X=>{E&&g(E.id,{useWorktrees:X})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Working Dir"}),l.jsx("div",{className:U.metaValue,children:l.jsx(Yt,{value:(E==null?void 0:E.workingDirectory)||"",onSave:X=>{E&&g(E.id,{workingDirectory:X})},fieldId:"workingDirectory",activeFieldId:w,onActivate:C,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),E&&l.jsxs("div",{className:U.metaTimestamps,children:[l.jsxs("span",{className:U.metaTimestamp,children:["Created ",Jy(E.createdAt)]}),E.updatedAt&&E.updatedAt!==E.createdAt&&l.jsxs("span",{className:U.metaTimestamp,children:["· Updated ",Jy(E.updatedAt)]})]})]}),pe>0&&l.jsxs("div",{className:U.progressBarContainer,"data-testid":"progress-bar",children:[l.jsx("div",{className:U.progressBar,children:l.jsx("div",{className:U.progressFill,style:{width:`${oe}%`}})}),l.jsxs("span",{className:U.progressLabel,children:[ae,"/",pe]})]}),F&&F.costUsd>0&&l.jsx("div",{className:U.progressBarContainer,children:l.jsxs("span",{className:U.progressLabel,children:["Usage: ",so(F.costUsd)," (",F.sessionCount," session",F.sessionCount!==1?"s":"",")"]})}),l.jsxs("div",{className:U.tabBar,role:"tablist","aria-label":"Workspace view",children:[l.jsx("button",{role:"tab","aria-selected":S==="graph",className:`${U.tab} ${S==="graph"?U.active:""}`,onClick:()=>T("graph"),children:"Graph"}),l.jsx("button",{role:"tab","aria-selected":S==="board",className:`${U.tab} ${S==="board"?U.active:""}`,onClick:()=>T("board"),"data-testid":"board-tab",children:"Board"}),l.jsx("button",{role:"tab","aria-selected":S==="tasks",className:`${U.tab} ${S==="tasks"?U.active:""}`,onClick:()=>T("tasks"),children:"Tasks"})]}),S==="tasks"&&pe>0&&l.jsxs("div",{className:U.workspaceSummary,children:[l.jsx("span",{className:U.workspaceSummaryTitle,children:`${ae}/${pe} tasks complete`}),l.jsx("span",{className:U.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),S==="tasks"&&pe===0&&l.jsxs("div",{className:U.emptyCta,children:[l.jsx("button",{className:U.ctaButton,onClick:()=>i(ei(n,void 0,H)),children:"Create Task"}),l.jsx("div",{className:U.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),S==="board"&&l.jsx(i4,{workspaceId:n,environmentId:H,tasks:o,sessions:m,personas:d,environments:c}),S==="graph"&&l.jsx(M5,{workspaceId:n,environmentId:H,tasks:o,resolvedThemeId:_}),l.jsx(Ja,{isOpen:N,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{E&&(h(E.id),i("/",{replace:!0})),j(!1)},onCancel:()=>j(!1)})]})}const A4="_formContent_ymnez_1",D4="_section_ymnez_13",R4="_label_ymnez_19",M4="_titleInput_ymnez_26",O4="_descriptionTextarea_ymnez_58",I4="_selectField_ymnez_94",B4="_checkboxRow_ymnez_128",L4="_checkboxLabel_ymnez_141",U4="_fieldError_ymnez_146",ut={formContent:A4,section:D4,label:R4,titleInput:M4,descriptionTextarea:O4,selectField:I4,checkboxRow:B4,checkboxLabel:L4,fieldError:U4};function z4(n,s){return{name:(n==null?void 0:n.name)??"",description:(n==null?void 0:n.description)??"",repoUrl:(n==null?void 0:n.repoUrl)??"",environmentId:(n==null?void 0:n.environmentId)??s??"",defaultPersonaId:(n==null?void 0:n.defaultPersonaId)??"",useWorktrees:(n==null?void 0:n.useWorktrees)??!0,workingDirectory:(n==null?void 0:n.workingDirectory)??""}}const P4=100;function V4({values:n,onChange:s,environments:i,personas:o,errors:c,disabled:u,autoFocusName:d}){const m=(h,g)=>{s({...n,[h]:g})};return l.jsxs("div",{className:ut.formContent,children:[l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-name",children:"Name"}),l.jsx("input",{id:"ws-name",className:ut.titleInput,type:"text",value:n.name,onChange:h=>m("name",h.target.value),placeholder:"Workspace name",maxLength:P4,autoFocus:d,disabled:u,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&l.jsx("span",{className:ut.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-description",children:"Description"}),l.jsx("textarea",{id:"ws-description",className:ut.descriptionTextarea,value:n.description,onChange:h=>m("description",h.target.value),placeholder:"Optional description (Markdown supported)",disabled:u,"data-testid":"workspace-form-description"})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-repo",children:"Repository URL"}),l.jsx("input",{id:"ws-repo",className:ut.titleInput,type:"text",value:n.repoUrl,onChange:h=>m("repoUrl",h.target.value),placeholder:"https://github.com/org/repo",disabled:u,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&l.jsx("span",{className:ut.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-environment",children:"Environment"}),l.jsxs("select",{id:"ws-environment",className:ut.selectField,value:n.environmentId,onChange:h=>m("environmentId",h.target.value),disabled:u,"data-testid":"workspace-form-environment",children:[l.jsx("option",{value:"",children:"Select environment…"}),i.map(h=>l.jsx("option",{value:h.id,children:h.displayName||h.id},h.id))]}),(c==null?void 0:c.environmentId)&&l.jsx("span",{className:ut.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-persona",children:"Default Persona"}),l.jsxs("select",{id:"ws-persona",className:ut.selectField,value:n.defaultPersonaId,onChange:h=>m("defaultPersonaId",h.target.value),disabled:u,"data-testid":"workspace-form-persona",children:[l.jsx("option",{value:"",children:"(Inherit)"}),o.map(h=>l.jsx("option",{value:h.id,children:h.name},h.id))]})]}),l.jsx("div",{className:ut.section,children:l.jsxs("label",{className:ut.checkboxRow,children:[l.jsx("input",{type:"checkbox",checked:n.useWorktrees,onChange:h=>m("useWorktrees",h.target.checked),disabled:u,"data-testid":"workspace-form-worktrees"}),l.jsx("span",{className:ut.checkboxLabel,children:"Enable worktree isolation"})]})}),l.jsxs("div",{className:ut.section,children:[l.jsx("label",{className:ut.label,htmlFor:"ws-workdir",children:"Working Directory"}),l.jsx("input",{id:"ws-workdir",className:ut.titleInput,type:"text",value:n.workingDirectory,onChange:h=>m("workingDirectory",h.target.value),placeholder:"Default (server default)",disabled:u,"data-testid":"workspace-form-workdir"})]})]})}const H4="_container_cddyd_1",q4="_header_cddyd_8",G4="_headerTitle_cddyd_35",$4="_badge_cddyd_44",F4="_headerActions_cddyd_54",Z4="_body_cddyd_61",K4="_formContent_cddyd_73",Y4="_section_cddyd_85",J4="_label_cddyd_91",W4="_titleInput_cddyd_98",X4="_descriptionTextarea_cddyd_131",Q4="_parentContext_cddyd_167",eB="_parentLabel_cddyd_175",tB="_parentName_cddyd_182",nB="_personaSelect_cddyd_186",sB="_depList_cddyd_220",aB="_depItem_cddyd_226",iB="_depItemSelected_cddyd_248",oB="_noDeps_cddyd_252",rB="_btnPrimary_cddyd_258",lB="_btnGhost_cddyd_289",Oe={container:H4,header:q4,headerTitle:G4,badge:$4,headerActions:F4,body:Z4,formContent:K4,section:Y4,label:J4,titleInput:W4,descriptionTextarea:X4,parentContext:Q4,parentLabel:eB,parentName:tB,personaSelect:nB,depList:sB,depItem:aB,depItemSelected:iB,noDeps:oB,btnPrimary:rB,btnGhost:lB};function cB(n){const s={};return n.name.trim()||(s.name="Name is required"),n.repoUrl.trim()&&!/^https?:\/\/.+/i.test(n.repoUrl.trim())&&(s.repoUrl="Must be a valid http(s) URL"),n.environmentId||(s.environmentId="Environment is required"),Object.keys(s).length>0?s:void 0}const uB=[{label:"Home",url:Ya},{label:"New Workspace",url:void 0}];function dB(){const[n]=bp(),s=n.get("environment")??void 0,{environments:i,personas:o,createWorkspace:c,workspaceCreating:u}=pt(),{showToast:d}=dn(),m=St(),[h,g]=y.useState(()=>{var j;return z4(void 0,s||((j=i[0])==null?void 0:j.id))}),[v,b]=y.useState(),[_,S]=y.useState();y.useEffect(()=>{s||h.environmentId||i.length===0||g(j=>{var w;return j.environmentId?j:{...j,environmentId:((w=i[0])==null?void 0:w.id)??""}})},[i,s,h.environmentId]);const T=()=>{const j=cB(h);if(j){b(j),S(void 0);return}b(void 0),S(void 0),c(h.name.trim(),h.description,h.repoUrl.trim(),h.environmentId,h.defaultPersonaId,h.useWorktrees,h.workingDirectory,()=>{d("Workspace created","success"),m(Ya,{replace:!0})},w=>{S(w)})},N=()=>{m(s?Qi(s):Ya,{replace:!0})};return l.jsxs("div",{className:Oe.container,children:[l.jsxs("div",{className:Oe.header,children:[l.jsx("div",{className:Oe.headerTitle,children:l.jsx(ba,{segments:uB})}),l.jsxs("div",{className:Oe.headerActions,children:[l.jsx("button",{className:Oe.btnGhost,onClick:N,disabled:u,"data-testid":"workspace-create-cancel",children:"Cancel"}),l.jsx("button",{className:Oe.btnPrimary,onClick:T,disabled:u||!h.name.trim()||!h.environmentId,"data-testid":"workspace-create-save",children:u?l.jsx(Ex,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),l.jsxs("div",{className:Oe.body,children:[l.jsx(V4,{values:h,onChange:j=>{g(j),b(void 0),S(void 0)},environments:i,personas:o,errors:v,disabled:u,autoFocusName:!0}),_&&l.jsx("div",{className:Oe.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function Ix({mode:n,taskId:s,workspaceId:i,parentTaskId:o,environmentId:c,tasks:u,workspaces:d,personas:m,onCreateTask:h,onUpdateTask:g,onEditDone:v,onShowToast:b}){const _=St(),S=n==="edit",T=S&&s?u.find(me=>me.id===s):void 0,N=S?(T==null?void 0:T.workspaceId)??"":i??"",[j,w]=y.useState(N),C=N||j,A=d.find(me=>me.id===C),M=c??(A==null?void 0:A.environmentId),D=!S&&!i,E=S?(T==null?void 0:T.parentTaskId)??"":o??"",H=E?u.find(me=>me.id===E):void 0,[z,Z]=y.useState((T==null?void 0:T.title)??""),[F,Q]=y.useState((T==null?void 0:T.description)??""),[ae,pe]=y.useState((T==null?void 0:T.dependsOn)??[]),[oe,X]=y.useState((T==null?void 0:T.defaultPersonaId)??""),[B,$]=y.useState((T==null?void 0:T.canDecompose)??!1),[te,re]=y.useState(!1),de=y.useRef(!1);y.useEffect(()=>{S&&T&&!de.current&&(de.current=!0,Z(T.title),Q(T.description),pe(T.dependsOn),X(T.defaultPersonaId),$(T.canDecompose))},[S,T]);const $e=u.filter(me=>me.workspaceId===C&&(!S||me.id!==s)&&me.id!==E),we=z.trim().length>0&&(!S||T!==void 0)&&C.length>0,Se=me=>{pe(Ce=>Ce.includes(me)?Ce.filter(Ut=>Ut!==me):[...Ce,me])},Ie=()=>{!we||te||S&&T===void 0||(S&&s?(g(s,z.trim(),F,ae,oe),b==null||b("Task updated","success"),v?v():_(os(s,void 0,C,M),{replace:!0})):(re(!0),h(C,z.trim(),F,ae.length>0?ae:void 0,E||void 0,oe,B,()=>{b==null||b("Task created","success"),_(i?Wi(i,M):"/tasks",{replace:!0})},me=>{b==null||b(me,"error"),re(!1)})))},le=()=>{if(v){v();return}_(S&&s?os(s,void 0,C,M):i?Wi(i,M):"/tasks")},fe=S?"edit task":E?"child task":"new task";return l.jsxs("div",{className:Oe.container,children:[l.jsxs("div",{className:Oe.header,children:[l.jsxs("div",{className:Oe.headerTitle,children:[l.jsx("span",{className:Oe.badge,children:fe}),H&&l.jsxs("span",{className:Oe.parentContext,children:[l.jsx("span",{className:Oe.parentLabel,children:"Child of"}),l.jsx("span",{className:Oe.parentName,children:H.title})]})]}),l.jsxs("div",{className:Oe.headerActions,children:[l.jsx("button",{onClick:Ie,disabled:!we||te,className:Oe.btnPrimary,"data-testid":"task-edit-save",children:te?"Creating…":S?"Save Changes":"Create"}),l.jsx("button",{onClick:le,className:Oe.btnGhost,children:"Cancel"})]})]}),l.jsx("div",{className:Oe.body,children:l.jsxs("div",{className:Oe.formContent,children:[D&&l.jsxs("div",{className:Oe.section,children:[l.jsx("label",{className:Oe.label,htmlFor:"task-edit-workspace",children:"Workspace"}),l.jsxs("select",{id:"task-edit-workspace",value:j,onChange:me=>w(me.target.value),className:Oe.personaSelect,"data-testid":"task-edit-workspace",children:[l.jsx("option",{value:"",children:"Select a workspace..."}),d.map(me=>l.jsx("option",{value:me.id,children:me.name},me.id))]})]}),l.jsxs("div",{className:Oe.section,children:[l.jsx("label",{className:Oe.label,htmlFor:"task-edit-title",children:"Title"}),l.jsx("input",{id:"task-edit-title",type:"text",value:z,onChange:me=>Z(me.target.value),placeholder:"Task title...",autoFocus:!0,className:Oe.titleInput,"data-testid":"task-edit-title",onKeyDown:me=>{me.key==="Enter"&&we&&Ie()}})]}),l.jsxs("div",{className:Oe.section,children:[l.jsx("label",{className:Oe.label,htmlFor:"task-edit-description",children:"Description"}),l.jsx("textarea",{id:"task-edit-description",value:F,onChange:me=>Q(me.target.value),placeholder:"Describe the task... (markdown supported)",className:Oe.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),l.jsxs("div",{className:Oe.section,children:[l.jsx("label",{className:Oe.label,htmlFor:"task-edit-persona",children:"Default Persona"}),l.jsxs("select",{id:"task-edit-persona",value:oe,onChange:me=>X(me.target.value),className:Oe.personaSelect,"data-testid":"task-edit-persona",children:[l.jsx("option",{value:"",children:"(Inherit)"}),m.map(me=>l.jsx("option",{value:me.id,children:me.name},me.id))]})]}),!S&&l.jsx("div",{className:Oe.section,children:l.jsxs("label",{className:Oe.depItem,"data-testid":"task-edit-can-decompose",children:[l.jsx("input",{type:"checkbox",checked:B,onChange:me=>$(me.target.checked)}),"Can spawn subtasks"]})}),l.jsxs("div",{className:Oe.section,children:[l.jsx("div",{className:Oe.label,children:"Dependencies"}),$e.length===0?l.jsx("div",{className:Oe.noDeps,children:"No other tasks in this workspace"}):l.jsx("div",{className:Oe.depList,children:$e.map(me=>{const Ce=ae.includes(me.id);return l.jsxs("label",{className:`${Oe.depItem} ${Ce?Oe.depItemSelected:""}`,"data-testid":`dep-option-${me.id}`,children:[l.jsx("input",{type:"checkbox",checked:Ce,onChange:()=>Se(me.id)}),me.title,l.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",me.status,")"]})]},me.id)})})]})]})})]})}function Wy(){const{workspaceId:n,environmentId:s}=va(),[i]=bp(),o=n??i.get("workspace")??"",c=i.get("parent")??void 0,{tasks:u,workspaces:d,personas:m,createTask:h,updateTask:g}=pt(),{showToast:v}=dn();return l.jsx(Ix,{mode:"new",workspaceId:o,parentTaskId:c,environmentId:s,tasks:u,workspaces:d,personas:m,onCreateTask:h,onUpdateTask:g,onShowToast:v})}const fB="_container_1pqxm_1",pB="_emptyState_1pqxm_8",mB="_card_1pqxm_14",hB="_cardHeader_1pqxm_34",gB="_categoryBadge_1pqxm_46",vB="_findingTitle_1pqxm_54",yB="_findingDate_1pqxm_60",bB="_findingContent_1pqxm_72",_B="_tags_1pqxm_78",xB="_tag_1pqxm_78",ts={container:fB,emptyState:pB,card:mB,cardHeader:hB,categoryBadge:gB,findingTitle:vB,findingDate:yB,findingContent:bB,tags:_B,tag:xB};function SB(n){const s=new Date(n),i=new Date,o=i.getTime()-s.getTime(),c=Math.floor(o/1e3),u=Math.floor(c/60),d=Math.floor(u/60),m=Math.floor(d/24);if(c<60)return"just now";if(u<60)return`${u}m ago`;if(d<24)return`${d}h ago`;if(m===1)return"yesterday";if(m<7)return`${m} days ago`;const h=s.getFullYear()===i.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return h?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Xy={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 TB({findings:n}){return n.length===0?l.jsx("div",{className:ts.emptyState,children:"No findings yet. Agents will post discoveries here."}):l.jsx("div",{className:ts.container,children:n.map((s,i)=>{const o=Xy[s.category]||Xy.general;return l.jsxs(Ot.div,{className:ts.card,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:i*.05,duration:.2},children:[l.jsxs("div",{className:ts.cardHeader,children:[l.jsx("span",{className:ts.categoryBadge,style:{background:o.bg,color:o.text},children:s.category}),l.jsx("span",{className:ts.findingTitle,children:s.title}),l.jsx("span",{className:ts.findingDate,title:s.createdAt,children:SB(s.createdAt)})]}),l.jsx("div",{className:ts.findingContent,children:s.content.length>300?s.content.slice(0,300)+"...":s.content}),s.tags.length>0&&l.jsx("div",{className:ts.tags,children:s.tags.map(c=>l.jsx("span",{className:ts.tag,style:{color:o.text,textShadow:`0 0 8px ${o.text}`},children:c},c))})]},s.id)})})}const kB="_workpadSection_y8nj9_1",wB="_workpadLabel_y8nj9_9",NB="_workpadStatus_y8nj9_17",jB="_workpadSummary_y8nj9_23",CB="_workpadExtra_y8nj9_29",da={workpadSection:kB,workpadLabel:wB,workpadStatus:NB,workpadSummary:jB,workpadExtra:CB};function EB({workpad:n}){if(!n)return;let s;try{const i=JSON.parse(n);if(i==null||typeof i!="object"||Array.isArray(i))return;s=i}catch{return l.jsxs("div",{className:da.workpadSection,"data-testid":"workpad-panel",children:[l.jsx("div",{className:da.workpadLabel,children:"Workpad"}),l.jsx("div",{className:da.workpadExtra,children:n})]})}if(!(!s.status&&!s.summary&&!s.extra))return l.jsxs("div",{className:da.workpadSection,"data-testid":"workpad-panel",children:[l.jsx("div",{className:da.workpadLabel,children:"Workpad"}),s.status&&l.jsx("div",{className:da.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&l.jsx("div",{className:da.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&l.jsx("div",{className:da.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}function cc(n){if(!n)return"—";const s=new Date(n);return isNaN(s.getTime())?"—":s.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Mf(n,s){if(!n||!s)return;const i=new Date(s).getTime()-new Date(n).getTime();if(isNaN(i)||i<0)return;const o=Math.floor(i/6e4),c=Math.floor(i%6e4/1e3);if(o===0)return`${c}s`;const u=Math.floor(o/60),d=o%60;return u===0?`${o}m ${c}s`:`${u}h ${d}m`}function Qy(n){const s=n.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?U.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?U.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?U.envDotRed:U.envDotGray}function AB({status:n}){const s=ga(n),i=nA(n);return l.jsx("span",{className:`${U.statusBadge} ${U[i]??U.statusPending}`,children:s.label})}function DB({task:n,tasksById:s,environments:i,workspaces:o,taskSessions:c,selectedEnvId:u}){const{loadUsage:d,usageCache:m}=pt(),h=c.reduce((A,M)=>A+(M.costUsd??0),0);y.useEffect(()=>{d("task",n.id),n.childTaskIds.length>0&&d("task_tree",n.id)},[n.id,n.childTaskIds.length,d,h]);const g=`task:${n.id}`,v=g in m?m[g]:void 0,b=`task_tree:${n.id}`,_=n.childTaskIds.length>0&&b in m?m[b]:void 0,S=c.length>0?c[c.length-1]:void 0,T=(S==null?void 0:S.environmentId)??"",N=T?i.find(A=>A.id===T):void 0,j=o.find(A=>A.id===n.workspaceId),w=i.find(A=>A.id===u),C=n.branch&&(j!=null&&j.repoUrl)?`${j.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(n.branch)}`:void 0;return l.jsxs("div",{className:U.overviewDashboard,children:[l.jsxs("div",{className:U.overviewHero,children:[l.jsx(AB,{status:n.status}),n.branch&&l.jsx("span",{className:U.overviewBranchPill,children:C?l.jsxs("a",{href:C,target:"_blank",rel:"noreferrer noopener",className:U.branchLink,children:["🔗"," ",n.branch]}):l.jsxs("span",{children:["🔗"," ",n.branch]})})]}),typeof n.description=="string"&&n.description&&l.jsxs("div",{className:U.overviewSection,children:[l.jsx("div",{className:U.overviewLabel,children:"Description"}),l.jsx("div",{className:U.overviewMarkdown,children:l.jsx(up,{remarkPlugins:[dp],children:n.description})})]}),n.workpad&&l.jsx(EB,{workpad:n.workpad}),l.jsxs("div",{className:U.overviewSection,children:[l.jsx("div",{className:U.overviewLabel,children:"Environment"}),T&&N?l.jsxs("div",{className:U.envRow,"data-testid":"task-overview-environment",children:[l.jsx("span",{className:`${U.envDot} ${Qy(N.status)}`,title:N.status,"aria-label":`Status: ${N.status}`,role:"img"}),l.jsx("span",{className:U.overviewValue,children:N.displayName})]}):w?l.jsxs("div",{className:U.envRow,"data-testid":"task-overview-environment",children:[l.jsx("span",{className:`${U.envDot} ${Qy(w.status)}`,title:w.status,"aria-label":`Status: ${w.status}`,role:"img"}),l.jsx("span",{className:U.overviewValue,children:w.displayName}),l.jsx("span",{className:U.overviewMuted,children:"(workspace default)"})]}):l.jsx("div",{className:U.overviewMuted,children:"Set in workspace settings"})]}),l.jsxs("div",{className:U.overviewSection,"data-testid":"task-overview-dependencies",children:[l.jsx("div",{className:U.overviewLabel,children:"Dependencies"}),n.dependsOn.length===0?l.jsx("div",{className:U.overviewMuted,children:"None"}):l.jsx("div",{className:U.depList,children:n.dependsOn.map(A=>{const M=s.get(A),D=(M==null?void 0:M.status)==="complete";return l.jsxs("div",{className:`${U.depItem} ${D?U.depDone:U.depBlocked}`,children:[l.jsx("span",{children:D?"✓":"○"}),l.jsx("span",{children:(M==null?void 0:M.title)??A})]},A)})})]}),l.jsxs("div",{className:U.overviewSection,children:[l.jsx("div",{className:U.overviewLabel,children:"Timeline"}),l.jsxs("div",{className:U.timeline,children:[n.createdAt&&l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Created"}),l.jsx("span",{className:U.timelineValue,children:cc(n.createdAt)})]}),n.assignedAt&&(()=>{const A=Mf(n.createdAt,n.assignedAt);return l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Assigned"}),l.jsx("span",{className:U.timelineValue,children:cc(n.assignedAt)}),A!==void 0&&l.jsx("span",{className:U.timelineDelta,children:A})]})})(),n.startedAt&&(()=>{const A=Mf(n.assignedAt??n.createdAt,n.startedAt);return l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Started"}),l.jsx("span",{className:U.timelineValue,children:cc(n.startedAt)}),A!==void 0&&l.jsx("span",{className:U.timelineDelta,children:A})]})})(),n.completedAt&&(()=>{const A=Mf(n.startedAt,n.completedAt);return l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Completed"}),l.jsx("span",{className:U.timelineValue,children:cc(n.completedAt)}),A!==void 0&&l.jsx("span",{className:U.timelineDelta,children:A})]})})(),!n.createdAt&&!n.assignedAt&&!n.startedAt&&!n.completedAt&&l.jsx("div",{className:U.overviewMuted,children:"No timing data"})]})]}),v&&v.costUsd>0&&l.jsxs("div",{className:U.overviewSection,children:[l.jsx("div",{className:U.overviewLabel,children:"Usage"}),l.jsxs("div",{className:U.timeline,children:[l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Cost"}),l.jsx("span",{className:U.timelineValue,children:so(v.costUsd)}),l.jsxs("span",{className:U.timelineDelta,children:[v.sessionCount," session",v.sessionCount!==1?"s":""]})]}),_&&_.costUsd>v.costUsd&&l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Total (incl. subtasks)"}),l.jsx("span",{className:U.timelineValue,children:so(_.costUsd)}),l.jsxs("span",{className:U.timelineDelta,children:[_.sessionCount," session",_.sessionCount!==1?"s":""]})]})]})]}),n.reviewNotes&&l.jsxs("div",{className:U.overviewSection,children:[l.jsx("div",{className:U.overviewLabel,children:"Review Notes"}),l.jsx("div",{className:U.reviewNotes,children:n.reviewNotes})]})]})}function RB({task:n,sessionId:s,isBlocked:i,onStart:o,onResume:c,onStop:u,onPause:d,onDelete:m,onEdit:h}){if(n.status==="not_started")return i?l.jsxs("div",{className:U.headerActions,children:[l.jsx("button",{onClick:h,className:U.btnGhost,children:"Edit"}),l.jsx("button",{onClick:m,className:U.btnDanger,children:"Delete"})]}):l.jsxs("div",{className:U.headerActions,children:[l.jsx("button",{"data-testid":"task-header-start",onClick:o,className:U.btnPrimary,children:"Start"}),l.jsx("button",{onClick:h,className:U.btnGhost,children:"Edit"}),l.jsx("button",{onClick:m,className:U.btnDanger,children:"Delete"})]});if(n.status==="working")return l.jsxs("div",{className:U.headerActions,children:[l.jsx("button",{onClick:u,className:U.btnDanger,children:"Stop"}),l.jsx("button",{onClick:d,disabled:!s,className:U.btnGhost,children:"Pause"})]});if(n.status==="paused")return l.jsxs("div",{className:U.headerActions,children:[l.jsx("button",{onClick:u,className:U.btnPrimary,children:"Stop"}),l.jsx("button",{onClick:c,className:U.btnGhost,children:"Resume"}),l.jsx("button",{onClick:m,className:U.btnDanger,children:"Delete"})]});if(n.status==="complete")return l.jsx("div",{className:U.headerActions,children:l.jsx("button",{onClick:m,className:U.btnDanger,children:"Delete"})});if(n.status==="failed")return l.jsxs("div",{className:U.headerActions,children:[l.jsx("button",{onClick:o,className:U.btnPrimary,children:"Retry"}),l.jsx("button",{onClick:m,className:U.btnDanger,children:"Delete"})]})}function MB({taskSessions:n,selectedSessionId:s,onSelect:i}){if(!(n.length<2))return l.jsxs("div",{className:U.attemptSelector,"data-testid":"attempt-selector",children:[l.jsx("span",{className:U.attemptLabel,children:"Attempts:"}),n.map((o,c)=>{const u=o.id===s,d=o.status==="stopped"&&o.endReason==="completed"?"✓":o.status==="stopped"?"✗":o.status==="running"||o.status==="idle"?"●":"";return l.jsxs("button",{className:`${U.attemptButton} ${u?U.attemptActive:""}`,onClick:()=>i(o.id),title:`Attempt #${c+1} — ${o.status}`,"aria-label":`Attempt #${c+1}, ${o.status}`,"aria-pressed":u,"data-testid":`attempt-${c+1}`,children:["#",c+1,d&&l.jsx("span",{className:U.attemptStatus,children:d})]},o.id)})]})}function fa(){const{taskId:n,workspaceId:s,environmentId:i}=va(),o=Lt(),c=St(),{showToast:u}=dn(),{events:d,eventsDropped:m,tasks:h,sessions:g,environments:v,findings:b,loadSessionEvents:_,loadFindings:S,kill:T,startTask:N,stopTask:j,resumeTask:w,deleteTask:C,createTask:A,updateTask:M,workspaces:D,taskSessions:E,loadTaskSessions:H,sendInput:z,spawn:Z,personas:F,provisionEnvironment:Q}=pt(),ae=y.useRef(void 0),pe=y.useRef(void 0),oe=y.useRef(void 0),X=y.useRef(void 0),B=y.useRef(void 0),$=o.pathname.endsWith("/stream")?"stream":o.pathname.endsWith("/findings")?"findings":"overview",te=o.pathname.endsWith("/edit"),[re,de]=y.useState($),[$e,we]=y.useState(!1),[Se,Ie]=y.useState(void 0),[le,fe]=y.useState(""),[me,Ce]=y.useState(te),Ut=y.useRef($),Tt=y.useRef(te),I=h.find(De=>De.id===n),Ne=(I==null?void 0:I.workspaceId)||void 0,Ct=D.find(De=>De.id===Ne);y.useEffect(()=>{$!==Ut.current&&(Ut.current=$,$!==re&&de($))},[$,re]),y.useEffect(()=>{te!==Tt.current&&(Tt.current=te,te!==me&&Ce(te))},[te,me]),y.useEffect(()=>{if(le===""){if(Ct!=null&&Ct.environmentId)fe(Ct.environmentId);else if(v.length>0){const De=v.find(Je=>Je.status==="connected");fe((De==null?void 0:De.id)??v[0].id)}}},[le,Ct==null?void 0:Ct.environmentId,v]);const It=I?E[I.id]??[]:[];let it;Se&&It.some(De=>De.id===Se)?it=Se:it=(I==null?void 0:I.latestSessionId)||void 0;const Yn=()=>{we(!0)},Bs=()=>{if(!I)return;C(I.id),we(!1);const De=i??(Ct==null?void 0:Ct.environmentId);c(I.workspaceId&&De?Wi(I.workspaceId,De):"/",{replace:!0})};y.useEffect(()=>{(I==null?void 0:I.id)!==pe.current&&(pe.current=I==null?void 0:I.id,Ie(void 0),fe(""),Ce(te))},[I==null?void 0:I.id,te]),y.useEffect(()=>{if(!(I!=null&&I.id))return;const De=I.id!==X.current,Je=I.latestSessionId!==B.current;(De||Je)&&(X.current=I.id,B.current=I.latestSessionId,H(I.id))},[I==null?void 0:I.id,I==null?void 0:I.latestSessionId,H]),y.useEffect(()=>{if((I==null?void 0:I.status)!==oe.current){const De=oe.current===void 0;oe.current=I==null?void 0:I.status;const Je=(I==null?void 0:I.status)==="not_started"?"overview":(I==null?void 0:I.status)==="working"||(I==null?void 0:I.status)==="paused"?"stream":(I==null?void 0:I.status)==="complete"?"findings":void 0;Je&&Je!==re&&!(De&&$!=="overview")&&de(Je)}},[I==null?void 0:I.status,re,$]);const Tn=y.useMemo(()=>new Map(h.map(De=>[De.id,De])),[h]),zn=y.useMemo(()=>{const De=it?d.filter(Je=>Je.sessionId===it):[];return im(am(De))},[d,it]),Jn=I?I.dependsOn.some(De=>{const Je=Tn.get(De);return Je!==void 0&&Je.status!=="complete"}):!1,Ls=y.useMemo(()=>i5(n,i,D,v,Tn),[n,i,D,v,Tn]);y.useEffect(()=>{it&&it!==ae.current&&(ae.current=it,_(it))},[it,_]),y.useEffect(()=>{re==="findings"&&Ne&&S(Ne)},[re,Ne,S]);const Pn=De=>{de(De),c(os(n,De==="overview"?void 0:De,s,i))};return Ms({key:"1"},()=>Pn("overview")),Ms({key:"2"},()=>Pn("stream")),Ms({key:"3"},()=>Pn("findings")),l.jsxs("div",{className:U.panelContainer,children:[l.jsx(ba,{segments:Ls}),l.jsxs("div",{className:U.header,children:[l.jsxs("span",{className:U.headerTitle,children:[l.jsx("span",{"data-testid":"task-title",children:(I==null?void 0:I.title)||n}),I&&l.jsx("span",{className:U.taskStatusBadge,"data-testid":"task-status",children:I.status}),(I==null?void 0:I.branch)&&l.jsx("span",{className:U.taskBranch,children:I.branch}),Jn&&l.jsx("span",{className:U.taskBlockedBadge,children:"blocked"})]}),I&&l.jsx(RB,{task:I,sessionId:it,isBlocked:Jn,onStart:()=>N(I.id,void 0,le),onResume:()=>w(I.id),onStop:()=>j(I.id),onPause:()=>it&&T(it),onDelete:Yn,onEdit:()=>Ce(!0)})]}),l.jsxs("div",{className:U.tabBar,role:"tablist","aria-label":"Task view",children:[l.jsx("button",{role:"tab","aria-selected":re==="overview",className:`${U.tab} ${re==="overview"?U.active:""}`,onClick:()=>Pn("overview"),children:"Overview"}),l.jsx("button",{role:"tab","aria-selected":re==="stream",className:`${U.tab} ${re==="stream"?U.active:""}`,onClick:()=>Pn("stream"),children:"Stream"}),l.jsx("button",{role:"tab","aria-selected":re==="findings",className:`${U.tab} ${re==="findings"?U.active:""}`,onClick:()=>Pn("findings"),children:"Findings"})]}),l.jsxs(rs,{mode:"wait",children:[re==="overview"&&l.jsx(Ot.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:U.overviewContent,"data-testid":"task-overview",children:me&&I?l.jsx(Ix,{mode:"edit",taskId:I.id,workspaceId:Ne,environmentId:i,tasks:h,workspaces:D,personas:F,onCreateTask:A,onUpdateTask:M,onEditDone:()=>{te?c(os(I.id,void 0,s,i),{replace:!0}):Ce(!1)},onShowToast:u}):I?l.jsx(DB,{task:I,tasksById:Tn,environments:v,workspaces:D,taskSessions:It,selectedEnvId:le}):l.jsx("div",{className:U.waitingMessage,children:"No additional details"})},"overview"),re==="stream"&&l.jsxs(Ot.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:[l.jsx(MB,{taskSessions:It,selectedSessionId:it,onSelect:De=>Ie(De)}),l.jsx(sm,{events:zn,eventsDropped:m,emptyState:!it&&I?Jn?l.jsx("div",{className:U.emptyCta,"data-testid":"stream-blocked-message",children:l.jsx("div",{className:U.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):l.jsxs("div",{className:U.emptyCta,children:[l.jsx("button",{"data-testid":"stream-start-cta",className:U.ctaButton,onClick:()=>N(I.id,void 0,le),children:"Start Task"}),l.jsx("div",{className:U.ctaDescription,children:"Click to begin agent execution"})]}):it&&zn.length===0?l.jsx("div",{className:U.waitingMessage,children:"Waiting for events..."}):void 0})]},"stream"),re==="findings"&&l.jsx(Ot.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:U.tabContent,children:Ne?l.jsx(TB,{findings:b.filter(De=>De.workspaceId===Ne)}):l.jsx("div",{className:U.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!I||I.status!=="working"&&I.status!=="paused")return;const De=it?g.find(Je=>Je.id===it):void 0;if(!(!De||De.status==="stopped"))return l.jsx(jr,{mode:"send",sessionId:De.id,environmentId:De.environmentId,personas:F,environments:v,onSendInput:z,onSpawn:Z,onStartTask:N,onProvisionEnvironment:Q,onShowToast:u})})(),I&&l.jsx(Ja,{isOpen:$e,title:"Delete Task?",description:`"${I.title}" will be permanently removed.`,onConfirm:Bs,onCancel:()=>we(!1)})]})}const OB="_container_legrg_1",IB="_header_legrg_8",BB="_headerTitle_legrg_35",LB="_badge_legrg_44",UB="_headerActions_legrg_54",zB="_body_legrg_61",PB="_formContent_legrg_73",VB="_section_legrg_85",HB="_label_legrg_91",qB="_nameInput_legrg_98",GB="_fieldInput_legrg_131",$B="_adapterSelect_legrg_164",FB="_readOnlyValue_legrg_198",ZB="_codespaceSection_legrg_204",KB="_codespaceActions_legrg_210",YB="_creatingHint_legrg_216",JB="_errorHint_legrg_222",WB="_btnPrimary_legrg_235",XB="_btnGhost_legrg_266",ne={container:OB,header:IB,headerTitle:BB,badge:LB,headerActions:UB,body:zB,formContent:PB,section:VB,label:HB,nameInput:qB,fieldInput:GB,adapterSelect:$B,readOnlyValue:FB,codespaceSection:ZB,codespaceActions:KB,creatingHint:YB,errorHint:JB,btnPrimary:WB,btnGhost:XB},gc=1,vc=65535;function Of(n){if(!n.trim())return!0;const s=Number(n);return Number.isInteger(s)&&s>=gc&&s<=vc}function If(n){try{const s=JSON.parse(n);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function QB({codespaceName:n,onCodespaceNameChange:s,envName:i,onEnvNameChange:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:m,onCreateCodespace:h}){const[g,v]=y.useState("pick"),[b,_]=y.useState(""),[S,T]=y.useState("");return g==="create"?l.jsxs("div",{className:ne.codespaceSection,children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Repository"}),l.jsx("input",{type:"text",value:b,onChange:N=>_(N.target.value),placeholder:"owner/repo",className:ne.fieldInput,"data-testid":"env-codespace-repo"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Machine Type"}),l.jsx("input",{type:"text",value:S,onChange:N=>T(N.target.value),placeholder:"Machine type (optional)...",className:ne.fieldInput,"data-testid":"env-codespace-machine"})]}),l.jsxs("div",{className:ne.codespaceActions,children:[l.jsx("button",{onClick:()=>{b.trim()&&(h(b.trim(),S.trim()||void 0),v("pick"),_(""),T(""))},disabled:!b.trim(),className:ne.btnPrimary,children:"Create"}),l.jsx("button",{onClick:()=>{v("pick"),_(""),T("")},className:ne.btnGhost,children:"Cancel"})]})]}):l.jsx("div",{className:ne.codespaceSection,children:l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Codespace"}),!d&&l.jsxs("select",{value:n,onChange:N=>{N.target.value==="__create__"?(v("create"),s("")):(s(N.target.value),N.target.value&&!i.trim()&&o(N.target.value))},disabled:m,className:ne.adapterSelect,"data-testid":"env-codespace-select",children:[l.jsx("option",{value:"",children:"Select a codespace..."}),c.map(N=>l.jsxs("option",{value:N.name,children:[N.name," (",N.repository,") — ",N.state]},N.name)),l.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),m&&l.jsx("span",{className:ne.creatingHint,children:"Creating codespace..."}),d&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:ne.errorHint,children:d}),l.jsx("input",{type:"text",value:n,onChange:N=>s(N.target.value),placeholder:"Or enter codespace name manually...",className:ne.fieldInput,"data-testid":"env-codespace-manual"})]}),u&&!d&&l.jsx("span",{className:ne.errorHint,children:u})]})})}function Bx({mode:n,environmentId:s,environments:i,onAddEnvironment:o,onUpdateEnvironment:c,onListCodespaces:u,codespaces:d,codespaceError:m,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v,onShowToast:b}){const _=St(),S=n==="edit",T=S&&s?i.find(le=>le.id===s):void 0,[N,j]=y.useState(""),[w,C]=y.useState("local"),[A,M]=y.useState(""),[D,E]=y.useState(""),[H,z]=y.useState(""),[Z,F]=y.useState(""),[Q,ae]=y.useState(""),[pe,oe]=y.useState(""),[X,B]=y.useState(""),[$,te]=y.useState(null),re=y.useCallback(()=>{const le={};if(w==="local"){if(A.trim()&&(le.host=A.trim()),D.trim()){const fe=Number(D);Number.isInteger(fe)&&(le.port=fe)}}else if(w==="ssh"){if(le.host=A.trim(),H.trim()&&(le.user=H.trim()),D.trim()){const fe=Number(D);Number.isInteger(fe)&&(le.sshPort=fe)}Z.trim()&&(le.identityFile=Z.trim())}else w==="docker"?(Q.trim()&&(le.image=Q.trim()),pe.trim()&&(le.repo=pe.trim())):w==="codespace"&&(le.codespaceName=X.trim());return le},[w,A,D,H,Z,Q,pe,X]),de=()=>!(!N.trim()||w==="ssh"&&!A.trim()||w==="codespace"&&!X.trim()||(w==="local"||w==="ssh")&&!Of(D)),$e=()=>{de()&&(o(N.trim(),w,re()),b==null||b("Environment added successfully","success"),_(Xi,{replace:!0}))},we=()=>{_(s?Qi(s):Xi)},Se=y.useCallback((le,fe)=>{if(!T||!s)return;const me=If(T.adapterConfig),Ce=fe.trim();Ce?me[le]=Ce:delete me[le],c(s,{adapterConfig:me})},[T,s,c]),Ie=y.useCallback((le,fe)=>{if(!T||!s)return;const me=If(T.adapterConfig);if(fe.trim()){const Ce=Number(fe);Number.isInteger(Ce)&&Ce>=gc&&Ce<=vc&&(me[le]=Ce)}else delete me[le];c(s,{adapterConfig:me})},[T,s,c]);if(S){if(!T)return l.jsxs("div",{className:ne.container,children:[l.jsxs("div",{className:ne.header,children:[l.jsx("div",{className:ne.headerTitle,children:l.jsx("span",{className:ne.badge,children:"edit environment"})}),l.jsx("div",{className:ne.headerActions,children:l.jsx("button",{onClick:we,className:ne.btnGhost,children:"Back"})})]}),l.jsx("div",{className:ne.body,children:l.jsx("div",{className:ne.formContent,children:l.jsx("span",{className:ne.readOnlyValue,children:"Environment not found"})})})]});const le=If(T.adapterConfig);return l.jsxs("div",{className:ne.container,"data-testid":"env-edit-panel",children:[l.jsxs("div",{className:ne.header,children:[l.jsx("div",{className:ne.headerTitle,children:l.jsx("span",{className:ne.badge,children:"edit environment"})}),l.jsx("div",{className:ne.headerActions,children:l.jsx("button",{onClick:we,className:ne.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),l.jsx("div",{className:ne.body,children:l.jsxs("div",{className:ne.formContent,children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Name"}),l.jsx(Yt,{value:T.displayName,onSave:fe=>{s&&c(s,{displayName:fe})},validate:fe=>fe.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:$,onActivate:te,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Adapter Type"}),l.jsx("span",{className:ne.readOnlyValue,"data-testid":"env-edit-adapter-type",children:T.adapterType})]}),T.adapterType==="local"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Host"}),l.jsx(Yt,{value:String(le.host??""),onSave:fe=>Se("host",fe),mode:"edit",fieldId:"host",activeFieldId:$,onActivate:te,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Port"}),l.jsx(Yt,{value:String(le.port??""),onSave:fe=>Ie("port",fe),validate:fe=>Of(fe)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:$,onActivate:te,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),T.adapterType==="ssh"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Host"}),l.jsx(Yt,{value:String(le.host??""),onSave:fe=>Se("host",fe),validate:fe=>fe.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:$,onActivate:te,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"User"}),l.jsx(Yt,{value:String(le.user??""),onSave:fe=>Se("user",fe),mode:"edit",fieldId:"user",activeFieldId:$,onActivate:te,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"SSH Port"}),l.jsx(Yt,{value:String(le.sshPort??""),onSave:fe=>Ie("sshPort",fe),validate:fe=>Of(fe)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:$,onActivate:te,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Identity File"}),l.jsx(Yt,{value:String(le.identityFile??""),onSave:fe=>Se("identityFile",fe),mode:"edit",fieldId:"identityFile",activeFieldId:$,onActivate:te,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),T.adapterType==="docker"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Image"}),l.jsx(Yt,{value:String(le.image??""),onSave:fe=>Se("image",fe),mode:"edit",fieldId:"image",activeFieldId:$,onActivate:te,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Repo"}),l.jsx(Yt,{value:String(le.repo??""),onSave:fe=>Se("repo",fe),mode:"edit",fieldId:"repo",activeFieldId:$,onActivate:te,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),T.adapterType==="codespace"&&l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,children:"Codespace Name"}),l.jsx(Yt,{value:String(le.codespaceName??""),onSave:fe=>Se("codespaceName",fe),validate:fe=>fe.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:$,onActivate:te,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return l.jsxs("div",{className:ne.container,"data-testid":"env-create-panel",children:[l.jsxs("div",{className:ne.header,children:[l.jsx("div",{className:ne.headerTitle,children:l.jsx("span",{className:ne.badge,children:"new environment"})}),l.jsxs("div",{className:ne.headerActions,children:[l.jsx("button",{onClick:$e,disabled:!de(),className:ne.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),l.jsx("button",{onClick:we,className:ne.btnGhost,children:"Cancel"})]})]}),l.jsx("div",{className:ne.body,children:l.jsxs("div",{className:ne.formContent,children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-name",children:"Name"}),l.jsx("input",{id:"env-create-name",type:"text",value:N,onChange:le=>j(le.target.value),placeholder:"Environment name...",autoFocus:!0,className:ne.nameInput,"data-testid":"env-create-name",onKeyDown:le=>{le.key==="Enter"&&de()&&$e()}})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),l.jsxs("select",{id:"env-create-adapter",value:w,onChange:le=>{C(le.target.value),le.target.value==="codespace"&&u()},className:ne.adapterSelect,"data-testid":"env-create-adapter",children:[l.jsx("option",{value:"local",children:"local"}),l.jsx("option",{value:"ssh",children:"ssh"}),l.jsx("option",{value:"docker",children:"docker"}),l.jsx("option",{value:"codespace",children:"codespace"})]})]}),w==="local"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-host",children:"Host"}),l.jsx("input",{id:"env-create-host",type:"text",value:A,onChange:le=>M(le.target.value),placeholder:"Host (optional)...",className:ne.fieldInput,"data-testid":"env-create-host"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-port",children:"Port"}),l.jsx("input",{id:"env-create-port",type:"number",min:gc,max:vc,value:D,onChange:le=>E(le.target.value),placeholder:"Port (optional)...",className:ne.fieldInput,"data-testid":"env-create-port"})]})]}),w==="ssh"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-host",children:"Host"}),l.jsx("input",{id:"env-create-host",type:"text",value:A,onChange:le=>M(le.target.value),placeholder:"Host (required)...",className:ne.fieldInput,"data-testid":"env-create-host"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-user",children:"User"}),l.jsx("input",{id:"env-create-user",type:"text",value:H,onChange:le=>z(le.target.value),placeholder:"User (optional)...",className:ne.fieldInput,"data-testid":"env-create-user"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-port",children:"SSH Port"}),l.jsx("input",{id:"env-create-port",type:"number",min:gc,max:vc,value:D,onChange:le=>E(le.target.value),placeholder:"SSH port (optional)...",className:ne.fieldInput,"data-testid":"env-create-port"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-identity",children:"Identity File"}),l.jsx("input",{id:"env-create-identity",type:"text",value:Z,onChange:le=>F(le.target.value),placeholder:"Identity file (optional)...",className:ne.fieldInput,"data-testid":"env-create-identity"})]})]}),w==="docker"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-image",children:"Image"}),l.jsx("input",{id:"env-create-image",type:"text",value:Q,onChange:le=>ae(le.target.value),placeholder:"Image (optional)...",className:ne.fieldInput,"data-testid":"env-create-image"})]}),l.jsxs("div",{className:ne.section,children:[l.jsx("label",{className:ne.label,htmlFor:"env-create-repo",children:"Repo"}),l.jsx("input",{id:"env-create-repo",type:"text",value:pe,onChange:le=>oe(le.target.value),placeholder:"Repo (optional)...",className:ne.fieldInput,"data-testid":"env-create-repo"})]})]}),w==="codespace"&&l.jsx(QB,{codespaceName:X,onCodespaceNameChange:B,envName:N,onEnvNameChange:j,codespaces:d,codespaceError:m,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v})]})})]})}function eL(){const{environments:n,addEnvironment:s,updateEnvironment:i,listCodespaces:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:m,createCodespace:h}=pt(),{showToast:g}=dn();return l.jsx(Bx,{mode:"new",environments:n,onAddEnvironment:s,onUpdateEnvironment:i,onListCodespaces:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:m,onCreateCodespace:h,onShowToast:g})}function tL(){const{environmentId:n}=va(),{environments:s,addEnvironment:i,updateEnvironment:o,listCodespaces:c,codespaces:u,codespaceError:d,codespaceListError:m,codespaceCreating:h,createCodespace:g}=pt(),{showToast:v}=dn();return l.jsx(Bx,{mode:"edit",environmentId:n,environments:s,onAddEnvironment:i,onUpdateEnvironment:o,onListCodespaces:c,codespaces:u,codespaceError:d,codespaceListError:m,codespaceCreating:h,onCreateCodespace:g,onShowToast:v})}const nL="_layout_11u79_1",sL="_content_11u79_8",aL="_tabPanel_11u79_14",br={layout:nL,content:sL,tabPanel:aL};function iL(){const n=t5();return l.jsxs("div",{className:br.layout,children:[l.jsx(ba,{segments:n}),l.jsx("div",{className:br.content,children:l.jsx(Qa,{})})]})}const oL="_container_13sb6_1",rL="_envHeader_13sb6_6",lL="_envTitleRow_13sb6_10",cL="_statusDot_13sb6_16",uL="_envName_13sb6_21",dL="_statusBadge_13sb6_27",fL="_envMeta_13sb6_33",pL="_metaTag_13sb6_39",mL="_actions_13sb6_51",hL="_provisionMessage_13sb6_59",gL="_errorMessage_13sb6_64",vL="_section_13sb6_69",yL="_sectionHeader_13sb6_73",bL="_cardList_13sb6_121",_L="_card_13sb6_121",xL="_cardHeader_13sb6_138",SL="_cardName_13sb6_144",TL="_cardActions_13sb6_149",kL="_cardDescription_13sb6_154",wL="_cardMeta_13sb6_160",NL="_repoLink_13sb6_166",jL="_empty_13sb6_174",CL="_btnPrimary_13sb6_180",EL="_btnOutline_13sb6_214",AL="_btnSmall_13sb6_241",DL="_btnDanger_13sb6_267",qe={container:oL,envHeader:rL,envTitleRow:lL,statusDot:cL,envName:uL,statusBadge:dL,envMeta:fL,metaTag:pL,actions:mL,provisionMessage:hL,errorMessage:gL,section:vL,sectionHeader:yL,cardList:bL,card:_L,cardHeader:xL,cardName:SL,cardActions:TL,cardDescription:kL,cardMeta:wL,repoLink:NL,empty:jL,btnPrimary:CL,btnOutline:EL,btnSmall:AL,btnDanger:DL},RL={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function ML(){const{environmentId:n}=va(),s=St(),{environments:i,workspaces:o,sessions:c,provisionStatus:u,provisionEnvironment:d,stopEnvironment:m,removeEnvironment:h,archiveWorkspace:g}=pt(),[v,b]=y.useState(!1),[_,S]=y.useState(!1),[T,N]=y.useState(void 0),j=i.find(ae=>ae.id===n);if(!n||!j)return l.jsx(Kn,{to:Xi,replace:!0});const w=o.filter(ae=>ae.environmentId===j.id),C=c.filter(ae=>ae.environmentId===j.id),A=C.reduce((ae,pe)=>ae+(pe.costUsd??0),0),M=RL[j.status]||"var(--text-tertiary)",D=j.status==="connected",E=j.status==="connecting",H=j.status==="disconnected"||j.status==="error",z=j.id in u?u[j.id]:void 0,Z=()=>{h(j.id),b(!1),s(Xi,{replace:!0})},F=()=>{S(!1),d(j.id,!0)},Q=ae=>{g(ae),N(void 0)};return l.jsxs("div",{className:qe.container,children:[l.jsx(Ja,{isOpen:v,title:"Delete Environment?",description:`"${j.displayName||j.id}" will be permanently removed along with all its data.`,onConfirm:Z,onCancel:()=>b(!1)}),l.jsx(Ja,{isOpen:_,title:"Reprovision Environment?",description:"This will kill any active session and force a fresh provision cycle. The environment will be temporarily disconnected.",confirmLabel:"Reprovision",onConfirm:F,onCancel:()=>S(!1)}),l.jsxs("div",{className:qe.envHeader,children:[l.jsxs("div",{className:qe.envTitleRow,children:[l.jsx("span",{className:qe.statusDot,style:{color:M},children:"●"}),l.jsx("h2",{className:qe.envName,children:j.displayName||j.id}),l.jsx("span",{className:qe.statusBadge,style:{color:M},children:j.status})]}),l.jsxs("div",{className:qe.envMeta,children:[l.jsxs("span",{className:qe.metaTag,children:["Adapter: ",j.adapterType]}),C.length>0&&l.jsxs("span",{className:qe.metaTag,children:[C.length," session",C.length!==1?"s":""]}),A>0&&l.jsxs("span",{className:qe.metaTag,children:["Cost: ",so(A)]})]})]}),l.jsxs("div",{className:qe.actions,children:[D&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:qe.btnPrimary,onClick:()=>s(Cb(j.id)),children:"New Chat"}),l.jsx("button",{className:qe.btnOutline,onClick:()=>m(j.id),children:"Stop"}),l.jsx("button",{className:qe.btnOutline,onClick:()=>S(!0),disabled:z!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),H&&l.jsx("button",{className:qe.btnPrimary,onClick:()=>d(j.id),children:j.status==="error"?"Retry":"Connect"}),E&&z!==void 0&&l.jsx("span",{className:qe.provisionMessage,children:z.message}),j.status==="error"&&(z==null?void 0:z.stage)==="error"&&l.jsx("span",{className:qe.errorMessage,children:z.message}),l.jsx("button",{className:qe.btnOutline,onClick:()=>s(r2(j.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),l.jsx("button",{className:qe.btnDanger,onClick:()=>b(!0),children:"Delete"})]}),l.jsxs("div",{className:qe.section,children:[l.jsxs("div",{className:qe.sectionHeader,children:[l.jsx("h3",{children:"Workspaces"}),l.jsx("button",{className:qe.btnPrimary,onClick:()=>s(`${Ab}?environment=${encodeURIComponent(j.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"})]}),w.length===0&&l.jsx("p",{className:qe.empty,children:"No workspaces yet. Create one to get started."}),l.jsx("div",{className:qe.cardList,children:w.map(ae=>l.jsx(OL,{workspace:ae,confirmArchiveId:T,onOpen:()=>s(Wi(ae.id,j.id)),onArchive:()=>N(ae.id),onConfirmArchive:()=>Q(ae.id),onCancelArchive:()=>N(void 0)},ae.id))})]})]})}function OL({workspace:n,confirmArchiveId:s,onOpen:i,onArchive:o,onConfirmArchive:c,onCancelArchive:u}){const d=s===n.id,m=n.repoUrl&&/^https?:\/\//.test(n.repoUrl);return l.jsxs("div",{className:qe.card,"data-testid":"workspace-card",children:[l.jsxs("div",{className:qe.cardHeader,children:[l.jsx("strong",{className:qe.cardName,children:n.name}),l.jsxs("div",{className:qe.cardActions,children:[l.jsx("button",{className:qe.btnSmall,onClick:i,children:"Open"}),d?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:qe.btnDanger,onClick:c,children:"Confirm"}),l.jsx("button",{className:qe.btnSmall,onClick:u,children:"Cancel"})]}):l.jsx("button",{className:qe.btnSmall,onClick:o,children:"Archive"})]})]}),n.description&&l.jsx("p",{className:qe.cardDescription,children:n.description}),n.repoUrl&&l.jsx("div",{className:qe.cardMeta,children:m?l.jsx("a",{href:n.repoUrl,target:"_blank",rel:"noopener noreferrer",className:qe.repoLink,children:n.repoUrl}):l.jsx("span",{children:n.repoUrl})})]})}const IL={credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function BL(){const s=Lt().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=IL[s],o=e5(i);return l.jsxs("div",{className:br.layout,children:[l.jsx(ba,{segments:o}),l.jsx("div",{className:br.content,children:l.jsx("div",{className:br.tabPanel,children:l.jsx(Qa,{})},s)})]})}const LL="_section_1ingb_14",UL="_sectionTitle_1ingb_26",zL="_sectionDescription_1ingb_35",PL="_tokenList_1ingb_48",VL="_tokenRow_1ingb_55",HL="_tokenBadge_1ingb_68",qL="_tokenName_1ingb_83",GL="_tokenTarget_1ingb_90",$L="_deleteButton_1ingb_99",FL="_addForm_1ingb_113",ZL="_formRow_1ingb_119",KL="_input_1ingb_125",YL="_select_1ingb_155",JL="_addButton_1ingb_187",WL="_emptyStateInfo_1ingb_221",XL="_themeOptions_1ingb_229",QL="_themeOption_1ingb_229",e8="_themeOptionSelected_1ingb_254",t8="_themeOptionHeader_1ingb_259",n8="_themeOptionLabel_1ingb_266",s8="_themeOptionDesc_1ingb_273",a8="_variantToggle_1ingb_279",i8="_variantButton_1ingb_286",o8="_variantActive_1ingb_305",r8="_themeSwatches_1ingb_311",l8="_themeSwatch_1ingb_311",c8="_systemToggle_1ingb_325",u8="_systemToggleHint_1ingb_341",d8="_themeActive_1ingb_348",f8="_aboutGrid_1ingb_354",p8="_aboutItem_1ingb_360",m8="_aboutLabel_1ingb_373",h8="_aboutValue_1ingb_379",g8="_aboutDot_1ingb_387",v8="_aboutDotConnected_1ingb_394",y8="_aboutDotDisconnected_1ingb_398",he={section:LL,sectionTitle:UL,sectionDescription:zL,tokenList:PL,tokenRow:VL,tokenBadge:HL,tokenName:qL,tokenTarget:GL,deleteButton:$L,addForm:FL,formRow:ZL,input:KL,select:YL,addButton:JL,emptyStateInfo:WL,themeOptions:XL,themeOption:QL,themeOptionSelected:e8,themeOptionHeader:t8,themeOptionLabel:n8,themeOptionDesc:s8,variantToggle:a8,variantButton:i8,variantActive:o8,themeSwatches:r8,themeSwatch:l8,systemToggle:c8,systemToggleHint:u8,themeActive:d8,aboutGrid:f8,aboutItem:p8,aboutLabel:m8,aboutValue:h8,aboutDot:g8,aboutDotConnected:v8,aboutDotDisconnected:y8},b8=[{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 _8({credentialProviders:n,onUpdateCredentialProviders:s}){const i=(o,c)=>{const u={...n};o==="claude"?u.claude=c:u[o]=c,s(u)};return l.jsxs("section",{className:he.section,children:[l.jsx("h3",{className:he.sectionTitle,children:"Credential Providers"}),l.jsx("p",{className:he.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),l.jsx("div",{className:he.tokenList,children:b8.map(o=>l.jsxs("div",{className:he.tokenRow,children:[l.jsx("span",{className:he.tokenName,children:o.label}),l.jsx("span",{className:he.tokenTarget,children:o.description}),l.jsx("select",{className:he.select,value:n[o.key],onChange:c=>i(o.key,c.target.value),children:o.options.map(c=>l.jsx("option",{value:c.value,children:c.label},c.value))})]},o.key))})]})}const x8=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function S8({tokens:n,onSetToken:s,onDeleteToken:i,onShowToast:o}){const[c,u]=y.useState(""),[d,m]=y.useState(""),[h,g]=y.useState("env_var"),[v,b]=y.useState(""),[_,S]=y.useState(null),T=w=>{if(w.preventDefault(),!c||!d)return;const C=h==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,d,h,C,h==="file"?v:""),o==null||o("Token saved successfully","success"),u(""),m(""),b("")},N=w=>{S(w)},j=()=>{_&&(i(_),o==null||o("Token deleted","info")),S(null)};return l.jsxs(l.Fragment,{children:[l.jsx(Ja,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:j,onCancel:()=>S(null)}),l.jsxs("section",{className:he.section,children:[l.jsx("h3",{className:he.sectionTitle,children:"Tokens"}),l.jsx("p",{className:he.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),n.length===0?l.jsx("div",{className:he.emptyStateInfo,children:"Add your first API token to enable service integrations."}):l.jsx("div",{className:he.tokenList,children:n.map(w=>l.jsxs("div",{className:he.tokenRow,children:[l.jsx("span",{className:he.tokenBadge,children:w.tokenType}),l.jsx("span",{className:he.tokenName,children:w.name}),l.jsx("span",{className:he.tokenTarget,children:w.tokenType==="env_var"?w.envVar:w.filePath}),l.jsx("button",{className:he.deleteButton,onClick:()=>N(w.name),title:`Delete ${w.name}`,children:"×"})]},w.name))}),l.jsxs("form",{className:he.addForm,onSubmit:T,children:[l.jsxs("div",{className:he.formRow,children:[l.jsx("input",{className:he.input,type:"text",placeholder:"Token name",value:c,onChange:w=>u(w.target.value)}),l.jsx("input",{className:he.input,type:"password",placeholder:"Value",value:d,onChange:w=>m(w.target.value)})]}),l.jsxs("div",{className:he.formRow,children:[l.jsx("select",{className:he.select,value:h,onChange:w=>g(w.target.value),children:x8.map(w=>l.jsx("option",{value:w.value,children:w.label},w.value))}),l.jsx("input",{className:he.input,type:"text",placeholder:h==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:w=>b(w.target.value)}),l.jsx("button",{className:he.addButton,type:"submit",children:"Add Token"})]})]})]})]})}function T8(){const{tokens:n,setToken:s,deleteToken:i,credentialProviders:o,updateCredentialProviders:c}=pt(),{showToast:u}=dn();return l.jsxs(l.Fragment,{children:[l.jsx(_8,{credentialProviders:o,onUpdateCredentialProviders:c}),l.jsx(S8,{tokens:n,onSetToken:s,onDeleteToken:i,onShowToast:u})]})}const k8="_container_10efq_1",w8="_header_10efq_7",N8="_form_10efq_19",j8="_formActions_10efq_87",C8="_editableSection_10efq_94",E8="_list_10efq_105",A8="_card_10efq_111",D8="_cardHeader_10efq_125",R8="_cardTitle_10efq_135",M8="_defaultBadge_10efq_141",O8="_cardActions_10efq_155",I8="_description_10efq_160",B8="_meta_10efq_166",L8="_empty_10efq_212",U8="_typeToggle_10efq_348",z8="_typeBadge_10efq_362",P8="_scriptEditor_10efq_376",V8="_optional_10efq_383",gt={container:k8,header:w8,form:N8,formActions:j8,editableSection:C8,list:E8,card:A8,cardHeader:D8,cardTitle:R8,defaultBadge:M8,cardActions:O8,description:I8,meta:B8,empty:L8,typeToggle:U8,typeBadge:z8,scriptEditor:P8,optional:V8};function H8({personas:n,appDefaultPersonaId:s,onDeletePersona:i,onSetAppDefaultPersonaId:o,onNavigateToNew:c,onNavigateToPersona:u}){const[d,m]=y.useState(null),h=d?n.find(v=>v.id===d):void 0,g=async v=>{await i(v),m(null)};return l.jsxs("div",{className:gt.container,children:[l.jsxs("div",{className:gt.header,children:[l.jsx("h2",{children:"Personas"}),l.jsx(As,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),n.length===0?l.jsx("p",{className:gt.empty,children:"No personas yet. Create one to get started."}):l.jsx("div",{className:gt.list,children:n.map(v=>{const b=s===v.id,_=v.type==="script";return l.jsxs("div",{className:gt.card,"data-testid":`persona-card-${v.id}`,onClick:()=>u(v.id),role:"button",tabIndex:0,onKeyDown:S=>{S.currentTarget===S.target&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),u(v.id))},children:[l.jsxs("div",{className:gt.cardHeader,children:[l.jsxs("span",{className:gt.cardTitle,children:[l.jsx("strong",{children:v.name}),l.jsx("span",{className:gt.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&l.jsx("span",{className:gt.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),l.jsxs("div",{className:gt.cardActions,onClick:S=>S.stopPropagation(),children:[!b&&l.jsx(As,{variant:"ghost",size:"sm",onClick:()=>{o(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),l.jsx(As,{variant:"ghost",size:"sm",onClick:()=>u(v.id),children:"Edit"}),l.jsx(As,{variant:"ghost",size:"sm",onClick:()=>m(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&l.jsx("p",{className:gt.description,children:v.description}),l.jsxs("div",{className:gt.meta,children:[v.runtime&&l.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&l.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&l.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),l.jsx(Ja,{isOpen:d!==null,title:"Delete Persona?",description:`"${(h==null?void 0:h.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{d&&g(d).catch(()=>{})},onCancel:()=>m(null)})]})}function q8(){const{personas:n,deletePersona:s,appDefaultPersonaId:i,setAppDefaultPersonaId:o}=pt(),{showToast:c}=dn(),u=St();return l.jsx(H8,{personas:n,appDefaultPersonaId:i,onDeletePersona:async d=>{try{await s(d)}catch(m){throw console.error("Failed to delete persona",{personaId:d,error:m}),c("Failed to delete persona","error"),m}},onSetAppDefaultPersonaId:async d=>{try{await o(d)}catch(m){console.error("Failed to set app default persona ID",{personaId:d,error:m}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>u(c2),onNavigateToPersona:d=>u(Eb(d))})}const G8="_container_uy08i_1",$8="_header_uy08i_7",F8="_count_uy08i_13",Z8="_presets_uy08i_18",K8="_presetButton_uy08i_24",Y8="_filterInput_uy08i_41",J8="_groups_uy08i_53",W8="_group_uy08i_53",X8="_groupHeader_uy08i_68",Q8="_groupName_uy08i_77",eU="_groupCount_uy08i_81",tU="_toolList_uy08i_87",nU="_toolItem_uy08i_95",sU="_toolName_uy08i_103",tn={container:G8,header:$8,count:F8,presets:Z8,presetButton:K8,filterInput:Y8,groups:J8,group:W8,groupHeader:X8,groupName:Q8,groupCount:eU,toolList:tU,toolItem:nU,toolName:sU},aU=(()=>{const n=new Map;for(const s of rb){const i=s==="get_version_status"?"version":s.split("_")[0];n.has(i)||n.set(i,[]),n.get(i).push(s)}return[...n.entries()].sort(([s],[i])=>s.localeCompare(i)).map(([s,i])=>({group:s,tools:i.sort()}))})(),iU=[{name:"default",label:"Default",tools:lb},{name:"worker",label:"Worker",tools:hT},{name:"orchestrator",label:"Orchestrator",tools:gT},{name:"admin",label:"Admin",tools:vT}];function eb({selectedTools:n,onChange:s,disabled:i}){const[o,c]=y.useState(""),u=y.useMemo(()=>new Set(n),[n]),d=y.useCallback(v=>{if(i)return;const b=new Set(u);b.has(v)?b.delete(v):b.add(v),s([...b].sort())},[u,s,i]),m=y.useCallback((v,b)=>{if(i)return;const _=new Set(u);for(const S of v)b?_.delete(S):_.add(S);s([..._].sort())},[u,s,i]),h=y.useCallback(v=>{i||s([...v].sort())},[s,i]),g=o.toLowerCase();return l.jsxs("div",{className:tn.container,"data-testid":"mcp-tool-selector",children:[l.jsx("div",{className:tn.header,children:l.jsx("span",{className:tn.count,children:n.length===0?`Using default (${lb.length} tools)`:`${n.length} of ${rb.size} tools selected`})}),l.jsxs("div",{className:tn.presets,"data-testid":"mcp-tool-presets",children:[iU.map(v=>l.jsx("button",{type:"button",className:tn.presetButton,disabled:i,onClick:()=>h(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),l.jsx("button",{type:"button",className:tn.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),l.jsx("input",{type:"text",className:tn.filterInput,placeholder:"Filter tools...",value:o,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),l.jsx("div",{className:tn.groups,children:aU.map(({group:v,tools:b})=>{const _=g?b.filter(T=>T.toLowerCase().includes(g)):b;if(_.length===0)return null;const S=_.every(T=>u.has(T));return l.jsxs("div",{className:tn.group,"data-testid":`tool-group-${v}`,children:[l.jsxs("label",{className:tn.groupHeader,children:[l.jsx("input",{type:"checkbox",checked:S,onChange:()=>m(_,S),disabled:i,"data-testid":`group-toggle-${v}`}),l.jsx("span",{className:tn.groupName,children:v}),l.jsxs("span",{className:tn.groupCount,children:["(",_.filter(T=>u.has(T)).length,"/",_.length,")"]})]}),l.jsx("div",{className:tn.toolList,children:_.map(T=>l.jsxs("label",{className:tn.toolItem,children:[l.jsx("input",{type:"checkbox",checked:u.has(T),onChange:()=>d(T),disabled:i,"data-testid":`tool-${T}`}),l.jsx("span",{className:tn.toolName,children:T})]},T))})]},v)})})]})}const tb=[{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)"}],nb=[{value:"genaiscript",label:"genaiscript"}],oU="0";function sb(){const{personaId:n}=va(),s=St(),{showToast:i}=dn(),{personas:o,createPersona:c,updatePersona:u,deletePersona:d,appDefaultPersonaId:m,setAppDefaultPersonaId:h}=pt(),g=n===void 0,v=g?void 0:o.find(_=>_.id===n);if(!g&&o.length>0&&!v)return l.jsx(Kn,{to:af,replace:!0});const b=[{label:"Settings",url:Ji},{label:"Personas",url:af},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return l.jsxs("div",{className:gt.container,children:[l.jsx(ba,{segments:b}),l.jsx(rU,{existing:v,isNew:g,appDefaultPersonaId:m,onCreatePersona:c,onUpdatePersona:u,onDeletePersona:d,onSetAppDefaultPersonaId:h,onDone:()=>{s(af)},showToast:i})]})}function rU({existing:n,isNew:s,appDefaultPersonaId:i,onCreatePersona:o,onUpdatePersona:c,onDeletePersona:u,onSetAppDefaultPersonaId:d,onDone:m,showToast:h}){const g=St(),[v,b]=y.useState((n==null?void 0:n.name)??""),[_,S]=y.useState((n==null?void 0:n.description)??""),[T,N]=y.useState((n==null?void 0:n.systemPrompt)??""),[j,w]=y.useState((n==null?void 0:n.runtime)??"claude-code"),[C,A]=y.useState((n==null?void 0:n.model)??"sonnet"),[M,D]=y.useState((n==null?void 0:n.maxTurns)??0),[E,H]=y.useState((n==null?void 0:n.type)==="script"?"script":"agent"),[z,Z]=y.useState((n==null?void 0:n.script)??""),[F,Q]=y.useState((n==null?void 0:n.allowedMcpTools)??[]),[ae,pe]=y.useState(!1),[oe,X]=y.useState(null),[B,$]=y.useState(!!s);y.useEffect(()=>{if(!s&&n&&!B){$(!0),b(n.name),S(n.description),N(n.systemPrompt);const I=n.type==="script"?"script":"agent";w(I==="script"?n.runtime||"genaiscript":n.runtime),A(n.model),D(n.maxTurns),H(I),Z(n.script||""),Q(n.allowedMcpTools)}},[s,n,B]);const te=I=>{H(I),I==="script"?w("genaiscript"):j==="genaiscript"&&w("claude-code")},re=!s&&n===void 0,de=v.trim().length>0&&!re&&T.trim().length>0&&(E==="script"?z.trim().length>0:!!j&&!!C),$e=s&&de,we=!s&&i===(n==null?void 0:n.id),Se=!s&&n&&!we&&E==="agent"&&!!j&&!!C,Ie=(I,Ne)=>{if(!I.trim())return`${Ne} is required`},le=I=>{if(I.preventDefault(),!(re||!de)){if(n){c(n.id,v,_,T,j,C,M,E,z).then(()=>{h("Persona updated","success"),m()},()=>{h("Failed to save persona","error")});return}o(v,_,T,j,C,M,E,z,F).then(Ne=>{h("Persona created","success"),g(Eb(Ne.id),{replace:!0})},()=>{h("Failed to save persona","error")})}},fe=()=>{n&&u(n.id).then(()=>{h("Persona deleted","success"),m()},()=>{h("Failed to delete persona","error")})},me=async(I,Ne,Ct,It)=>I().then(()=>{Ne(),h(Ct,"success")},()=>{h(It,"error")}),Ce=(I,Ne)=>{if(!n)return;const Ct=I==="type"?String(Ne):E,It=I==="runtime"?String(Ne):I==="type"?String(Ne)==="script"?"genaiscript":j==="genaiscript"?"claude-code":j:j,it=I==="model"?String(Ne):C,Yn=I==="maxTurns"?Number(Ne):M,Bs=I==="systemPrompt"?String(Ne):T,Tn=I==="script"?String(Ne):z;me(()=>c(n.id,I==="name"?String(Ne):v,I==="description"?String(Ne):_,Bs,It,it,Yn,Ct,Tn),()=>{if(I==="type"){const zn=String(Ne)==="script"?"script":"agent";H(zn),w(It)}I==="runtime"&&w(String(Ne)),I==="name"&&b(String(Ne)),I==="description"&&S(String(Ne)),I==="systemPrompt"&&N(String(Ne)),I==="model"&&A(String(Ne)),I==="maxTurns"&&D(Number(Ne)),I==="script"&&Z(String(Ne))},"Persona updated","Failed to update persona").catch(()=>{})},Ut=I=>{le(I)},Tt=()=>{n&&d(n.id).then(()=>{h("Set as app default","success")},()=>{h("Failed to set app default","error")})};return l.jsxs(l.Fragment,{children:[re?l.jsxs("div",{className:gt.form,children:[l.jsx("h3",{children:"Edit Persona"}),l.jsx("p",{children:"Loading persona..."})]}):s?l.jsxs("form",{onSubmit:Ut,className:gt.form,children:[l.jsx("h3",{children:"Create Persona"}),l.jsxs("div",{className:gt.typeToggle,"data-testid":"persona-type-toggle",children:[l.jsxs("label",{children:[l.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:E==="agent",onChange:()=>te("agent")}),"Agent"]}),l.jsxs("label",{children:[l.jsx("input",{type:"radio",name:"personaType",value:"script",checked:E==="script",onChange:()=>te("script")}),"Script"]})]}),l.jsxs("label",{children:["Name",l.jsx("input",{type:"text",value:v,onChange:I=>b(I.target.value),placeholder:E==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),l.jsxs("label",{children:["Description",l.jsx("input",{type:"text",value:_,onChange:I=>S(I.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),l.jsxs("label",{children:["Runtime",l.jsx("select",{value:j,onChange:I=>w(I.target.value),"data-testid":"persona-runtime-select",children:(E==="script"?nb:tb).map(I=>l.jsx("option",{value:I.value,children:I.label},I.value))})]}),E==="agent"&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{children:["Model",l.jsx("input",{type:"text",value:C,onChange:I=>A(I.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),l.jsxs("label",{children:["Max Turns",l.jsx("input",{type:"number",value:M,onChange:I=>D(parseInt(I.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),l.jsxs("label",{children:["System Prompt",l.jsx("textarea",{value:T,onChange:I=>N(I.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),E==="script"&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{children:["Model ",l.jsx("span",{className:gt.optional,children:"(optional)"}),l.jsx("input",{type:"text",value:C,onChange:I=>A(I.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),l.jsxs("label",{children:["System Prompt",l.jsx("textarea",{value:T,onChange:I=>N(I.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),l.jsxs("label",{children:["Script",l.jsx("textarea",{value:z,onChange:I=>Z(I.target.value),placeholder:`script({ model: "openai:gpt-4o" });
|
|
489
|
+
src/utils/token-refresh.ts:28: const remaining = decoded.exp - Date.now() / 1000;`,raw:JSON.stringify({tool_use_id:"tool-mock-004",is_error:!1})}},{delayMs:7800,event:{eventType:"text",timestamp:Ee(7800),content:"Fixed. The token expiry comparison was inverted — `decoded.exp > Date.now()` should have been `<` (a token is expired when its `exp` is in the past). The other occurrence in `token-refresh.ts` uses subtraction (not comparison), so it was already correct. All 3 auth tests pass."}},{delayMs:8400,event:{eventType:"usage",timestamp:Ee(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_usd:.12})}},{delayMs:8800,event:{eventType:"status",timestamp:Ee(8800),content:"completed"}}]}],Zy=400;function $B({children:n}){const[s,i]=y.useState(LB),[o,c]=y.useState(UB),[u,d]=y.useState(zB),[m,h]=y.useState(void 0),[g,v]=y.useState(PB),[b,_]=y.useState(VB),[S,T]=y.useState($y),[N,j]=y.useState(HB),[w,C]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[A,M]=y.useState(qB),[D]=y.useState(GB),[E,H]=y.useState(""),[z,Z]=y.useState(ns),[F,Q]=y.useState(da),[ae,pe]=y.useState(void 0),[oe,X]=y.useState(void 0),[B,$]=y.useState(""),te=y.useRef(void 0),re=y.useRef(0),de=y.useRef(0),$e=y.useRef(new Set),we=y.useRef(new Map),Se=y.useRef(b);Se.current=b;const Ie=y.useRef(new Map),le=y.useRef(new Map),fe=y.useCallback(q=>(re.current+=1,`mock-${q}-${String(re.current).padStart(3,"0")}`),[]),me=y.useCallback(()=>{const q=Fy[de.current%Fy.length];return de.current+=1,q},[]),Ce=y.useCallback((q,ee,ie)=>{const ce=setTimeout(()=>{var ue;$e.current.delete(ce),ie&&((ue=we.current.get(ie))==null||ue.delete(ce)),q()},ee);$e.current.add(ce),ie&&(we.current.has(ie)||we.current.set(ie,new Set),we.current.get(ie).add(ce))},[]),Ut=y.useCallback(q=>{const ee=we.current.get(q);ee&&(ee.forEach(ie=>{clearTimeout(ie),$e.current.delete(ie)}),we.current.delete(q))},[]),Tt=y.useCallback((q,ee,ie)=>{c(ce=>ce.map(ue=>ue.id===q?{...ue,status:ee,...ie!==void 0?{endReason:ie}:{}}:ue))},[]),I=y.useCallback(q=>{d(ee=>[...ee,q])},[]),Ne=y.useCallback((q,ee,ie)=>{ee.forEach((ce,ue)=>{Ce(()=>{const Pe={sessionId:q,...ce.event,timestamp:new Date().toISOString()};if(I(Pe),ce.event.eventType==="status"){const ye=Mx(ce.event.content),Re=Ox(ce.event.content);Tt(q,ye,Re)}ue===ee.length-1&&ie&&ie()},ce.delayMs,q)})},[Ce,I,Tt]),Ct=y.useCallback((q,ee,ie,ce)=>{console.log("[MockGrackle] spawn",{environmentId:q,prompt:ee,runtime:ce});const ue=fe("sess"),Pe={id:ue,environmentId:q,runtime:ce||"claude-code",status:"running",prompt:ee,startedAt:new Date().toISOString()};c(Re=>[...Re,Pe]),h(ue);const ye=me();if(console.log(`[MockGrackle] Playing scenario: ${ye.label}`),ye.pauseForInput){const Re=ye.pauseAfterStep??ye.steps.length-1,Fe=ye.steps.slice(0,Re+1),tt=Fe.length>0?Fe[Fe.length-1].delayMs:0;Ne(ue,Fe),Ce(()=>{Tt(ue,"idle"),I({sessionId:ue,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},tt+Zy,ue),ye.resumeSteps&&Ie.current.set(ue,ye.resumeSteps)}else Ne(ue,ye.steps)},[fe,me,Ne,Ce,Tt,I]),It=y.useCallback(q=>{console.log("[MockGrackle] kill",q),Ut(q),Ie.current.delete(q),Tt(q,"stopped","killed"),I({sessionId:q,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),_(ee=>ee.map(ie=>ie.latestSessionId===q&&ie.status==="working"?{...ie,status:"not_started"}:ie))},[Ut,Tt,I]),it=y.useCallback(q=>{console.log("[MockGrackle] stopGraceful",q),Ut(q),Ie.current.delete(q),Tt(q,"stopped","terminated"),I({sessionId:q,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),_(ee=>ee.map(ie=>ie.latestSessionId===q&&ie.status==="working"?{...ie,status:"not_started"}:ie))},[Ut,Tt,I]),Yn=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Bs=y.useCallback(q=>{console.log("[MockGrackle] loadSessionEvents",q)},[]),Tn=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),d([])},[]),zn=y.useCallback((q,ee,ie,ce,ue,Pe,ye,Re,Fe)=>{console.log("[MockGrackle] createWorkspace",{name:q,description:ee});const tt={id:fe("proj"),name:q,description:ee||"",repoUrl:ie||"",environmentId:ce||"",status:"active",workingDirectory:ye||"",useWorktrees:Pe??!0,defaultPersonaId:ue||"",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Ve=>[...Ve,tt]),Re&&Re()},[fe]),Jn=y.useCallback(q=>{console.log("[MockGrackle] archiveWorkspace",q),v(ee=>ee.map(ie=>ie.id===q?{...ie,status:"archived"}:ie))},[]),Ls=y.useCallback(q=>{console.log("[MockGrackle] loadTasks",q)},[]),Pn=y.useCallback((q,ee,ie,ce,ue,Pe,ye,Re,Fe)=>{console.log("[MockGrackle] createTask",{workspaceId:q,title:ee,parentTaskId:ue}),_(tt=>{const Vt=tt.filter(Hn=>Hn.workspaceId===q).reduce((Hn,xa)=>Math.max(Hn,xa.sortOrder),0),Ht=ue?tt.find(Hn=>Hn.id===ue):void 0;if(ue&&!Ht)return console.warn("[MockGrackle] Parent task not found:",ue),tt;if(Ht&&!Ht.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ue),tt;const kt=Ht?Ht.depth+1:0,ls={id:fe("task"),workspaceId:q,title:ee,description:ie||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:ce||[],reviewNotes:void 0,sortOrder:Vt+1,createdAt:new Date().toISOString(),parentTaskId:ue||"",depth:kt,childTaskIds:[],canDecompose:ye??!ue,defaultPersonaId:Pe||"",workpad:""};return[...tt,ls]}),Re&&Re()},[fe]),De=y.useCallback((q,ee,ie,ce)=>{var tt;console.log("[MockGrackle] startTask",{taskId:q});const ue=Se.current.find(Ve=>Ve.id===q),Pe=(ue==null?void 0:ue.title)??"",ye=fe("sess"),Re={id:ye,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:Pe||q,startedAt:new Date().toISOString()};c(Ve=>[...Ve,Re]),_(Ve=>Ve.map(Vt=>Vt.id===q?{...Vt,status:"working",latestSessionId:ye,branch:`mock/${q.slice(0,8)}`}:Vt));const Fe=me();if(console.log(`[MockGrackle] Playing task scenario: ${Fe.label}`),Fe.pauseForInput){const Ve=Fe.pauseAfterStep??Fe.steps.length-1,Vt=Fe.steps.slice(0,Ve+1),Ht=Vt.length>0?Vt[Vt.length-1].delayMs:0;if(Ne(ye,Vt),Ce(()=>{Tt(ye,"idle"),I({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},Ht+Zy,ye),Fe.resumeSteps){const kt=[...Fe.resumeSteps];Ie.current.set(ye,kt);const ls=kt.reduce((Hn,xa)=>Math.max(Hn,xa.delayMs),0);le.current.set(ye,{taskId:q,delayAfterResume:ls+200})}}else{const Ve=Fe.steps.length>0?Fe.steps[Fe.steps.length-1].delayMs:0;Ne(ye,Fe.steps);const Vt=(tt=Fe.steps[Fe.steps.length-1])==null?void 0:tt.event.content;Ce(()=>{Vt==="completed"?_(Ht=>Ht.map(kt=>kt.id===q&&kt.status==="working"?{...kt,status:"paused"}:kt)):Vt==="failed"&&_(Ht=>Ht.map(kt=>kt.id===q&&kt.status==="working"?{...kt,status:"failed"}:kt))},Ve+100,ye)}},[fe,me,Ne,Ce,Tt,I]),Je=y.useCallback((q,ee)=>{console.log("[MockGrackle] sendInput",{sessionId:q,text:ee}),I({sessionId:q,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ee}`}),Tt(q,"running"),I({sessionId:q,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const ie=Ie.current.get(q);if(ie)Ie.current.delete(q),Ne(q,ie);else{const ue=[{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"}}];Ne(q,ue)}const ce=le.current.get(q);ce&&(le.current.delete(q),Ce(()=>{_(ue=>ue.map(Pe=>Pe.id===ce.taskId&&Pe.status==="working"?{...Pe,status:"paused"}:Pe))},ce.delayAfterResume,q))},[I,Tt,Ne,Ce]),lo=y.useCallback(q=>{console.log("[MockGrackle] completeTask",q),_(ee=>ee.map(ie=>ie.id===q?{...ie,status:"complete"}:ie))},[]),co=y.useCallback(q=>{console.log("[MockGrackle] resumeTask",q)},[]),uo=y.useCallback((q,ee,ie,ce,ue)=>{console.log("[MockGrackle] updateTask",{taskId:q,title:ee}),_(Pe=>Pe.map(ye=>ye.id===q?{...ye,title:ee.trim()||ye.title,description:ie,dependsOn:ce,...ue!==void 0?{defaultPersonaId:ue}:{}}:ye))},[]),_a=y.useCallback(q=>{console.log("[MockGrackle] deleteTask",q),_(ee=>ee.filter(ie=>ie.id!==q))},[]),Or=y.useCallback(q=>{console.log("[MockGrackle] loadFindings",q),T($y.filter(ee=>ee.workspaceId===q))},[]),fo=y.useCallback((q,ee,ie,ce,ue)=>{console.log("[MockGrackle] postFinding",{workspaceId:q,title:ee});const Pe={id:fe("find"),workspaceId:q,taskId:"",sessionId:"",category:ce||"general",title:ee,content:ie,tags:ue||[],createdAt:new Date().toISOString()};T(ye=>[...ye,Pe])},[fe]),Ir=y.useCallback(()=>{console.log("[MockGrackle] loadEnvironments")},[]),Br=y.useCallback((q,ee,ie)=>{console.log("[MockGrackle] addEnvironment",{displayName:q,adapterType:ee,adapterConfig:ie})},[]),Us=y.useCallback((q,ee)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:q,...ee}),i(ie=>ie.map(ce=>ce.id!==q?ce:{...ce,...ee.displayName!==void 0?{displayName:ee.displayName}:{},...ee.adapterConfig!==void 0?{adapterConfig:JSON.stringify(ee.adapterConfig)}:{}}))},[]),Jt=y.useCallback(()=>{console.log("[MockGrackle] loadTokens")},[]),Vn=y.useCallback((q,ee,ie,ce,ue)=>{console.log("[MockGrackle] setToken",{name:q,tokenType:ie}),j(Pe=>[...Pe.filter(Re=>Re.name!==q),{name:q,tokenType:ie,envVar:ce,filePath:ue,expiresAt:""}])},[]),Wt=y.useCallback(q=>{console.log("[MockGrackle] deleteToken",q),j(ee=>ee.filter(ie=>ie.name!==q))},[]),Lr=y.useCallback(q=>{console.log("[MockGrackle] updateCredentialProviders",q),C(q)},[]);y.useEffect(()=>()=>{$e.current.forEach(clearTimeout),$e.current.clear()},[]);const Hc=y.useMemo(()=>({connected:!0,send:()=>{},environments:s,sessions:o,events:u,eventsDropped:0,lastSpawnedId:m,workspaces:g,tasks:b,findings:S,tokens:N,credentialProviders:w,spawn:Ct,sendInput:Je,kill:It,stopGraceful:it,refresh:Yn,loadSessionEvents:Bs,clearEvents:Tn,loadWorkspaces:()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:zn,archiveWorkspace:Jn,updateWorkspace:(q,ee)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:q,...ee}),v(ie=>ie.map(ce=>ce.id!==q?ce:{...ce,...ee.name!==void 0?{name:ee.name}:{},...ee.description!==void 0?{description:ee.description}:{},...ee.repoUrl!==void 0?{repoUrl:ee.repoUrl}:{},...ee.environmentId!==void 0?{environmentId:ee.environmentId}:{},...ee.workingDirectory!==void 0?{workingDirectory:ee.workingDirectory}:{},...ee.useWorktrees!==void 0?{useWorktrees:ee.useWorktrees}:{},...ee.defaultPersonaId!==void 0?{defaultPersonaId:ee.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},loadTasks:Ls,loadAllTasks:()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Pn,startTask:De,stopTask:q=>{console.log("[MockGrackle] stopTask",{taskId:q}),lo(q)},completeTask:lo,resumeTask:co,updateTask:uo,deleteTask:_a,loadFindings:Or,postFinding:fo,loadEnvironments:Ir,addEnvironment:Br,updateEnvironment:Us,loadTokens:Jt,setToken:Vn,deleteToken:Wt,updateCredentialProviders:Lr,provisionStatus:{},provisionEnvironment:(q,ee)=>{},stopEnvironment:()=>{},removeEnvironment:()=>{},codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:()=>{},createCodespace:()=>{},workspaceCreating:!1,taskStartingId:void 0,personas:A,createPersona:async(q,ee,ie,ce,ue,Pe,ye,Re,Fe)=>{console.log("[MockGrackle] createPersona",{name:q});const tt={id:`mock-persona-${Date.now()}`,name:q,description:ee,systemPrompt:ie,toolConfig:"{}",runtime:ce??"claude-code",model:ue||"",maxTurns:Pe||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:ye||"agent",script:Re||"",allowedMcpTools:Fe||[]};return M(Ve=>[...Ve,tt]),tt},updatePersona:async(q,ee,ie,ce,ue,Pe,ye,Re,Fe,tt)=>{console.log("[MockGrackle] updatePersona",{personaId:q,name:ee});const Ve=A.find(kt=>kt.id===q);if(!Ve)throw new Error(`Persona not found: ${q}`);const Vt=new Date().toISOString(),Ht={...Ve,...ee!==void 0?{name:ee}:{},...ie!==void 0?{description:ie}:{},...ce!==void 0?{systemPrompt:ce}:{},...ue!==void 0?{runtime:ue}:{},...Pe!==void 0?{model:Pe}:{},...ye!==void 0?{maxTurns:ye}:{},...Re!==void 0?{type:Re}:{},...Fe!==void 0?{script:Fe}:{},...tt!==void 0?{allowedMcpTools:tt}:{},updatedAt:Vt};return M(kt=>kt.map(ls=>ls.id===q?Ht:ls)),Ht},deletePersona:async q=>{console.log("[MockGrackle] deletePersona",q),M(ee=>ee.filter(ie=>ie.id!==q))},taskSessions:D,loadTaskSessions:q=>{console.log("[MockGrackle] loadTaskSessions",q)},appDefaultPersonaId:E,setAppDefaultPersonaId:async q=>{console.log("[MockGrackle] setAppDefaultPersonaId",q),H(q)},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:(q,ee)=>{console.log(`[MockGrackle] loadUsage(${q}, ${ee})`)},knowledge:{graphData:{nodes:z,links:F},selectedNode:ae,loading:!1,selectedId:oe,searchQuery:B,search:q=>{if(console.log("[MockGrackle] knowledge.search",q),!q.trim()){$(q);return}$(q);const ee=te.current,ie=ee?ns.filter(ye=>!ye.workspaceId||ye.workspaceId===ee):ns,ce=q.toLowerCase(),ue=ie.filter(ye=>{var Re,Fe,tt;return ye.label.toLowerCase().includes(ce)||((Re=ye.content)==null?void 0:Re.toLowerCase().includes(ce))||((Fe=ye.tags)==null?void 0:Fe.some(Ve=>Ve.toLowerCase().includes(ce)))||((tt=ye.category)==null?void 0:tt.toLowerCase().includes(ce))});Z(ue);const Pe=new Set(ue.map(ye=>ye.id));Q(da.filter(ye=>Pe.has(ye.source)&&Pe.has(ye.target))),X(void 0),pe(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),$("");const q=te.current,ee=q?ns.filter(ce=>!ce.workspaceId||ce.workspaceId===q):ns;Z(ee);const ie=new Set(ee.map(ce=>ce.id));Q(da.filter(ce=>ie.has(ce.source)&&ie.has(ce.target)))},selectNode:q=>{console.log("[MockGrackle] knowledge.selectNode",q),X(q);const ee=q in Gy?Gy[q]:void 0;if(ee)pe(ee);else{const ie=ns.find(ce=>ce.id===q);if(ie){const ce=da.filter(ue=>ue.source===q||ue.target===q).map(ue=>({fromId:ue.source,toId:ue.target,type:ue.type}));pe({node:ie,edges:ce})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),X(void 0),pe(void 0)},expandNode:q=>{console.log("[MockGrackle] knowledge.expandNode",q),Z(ee=>{const ie=new Set(ee.map(Re=>Re.id)),ce=da.filter(Re=>Re.source===q||Re.target===q),ue=new Set;for(const Re of ce)ie.has(Re.source)||ue.add(Re.source),ie.has(Re.target)||ue.add(Re.target);if(ue.size===0)return ee;const Pe=ns.filter(Re=>ue.has(Re.id)),ye=new Set([...ie,...ue]);return Q(Re=>{const Fe=new Set(Re.map(Ve=>`${Ve.source}|${Ve.target}|${Ve.type}`)),tt=da.filter(Ve=>ye.has(Ve.source)&&ye.has(Ve.target)&&!Fe.has(`${Ve.source}|${Ve.target}|${Ve.type}`));return tt.length>0?[...Re,...tt]:Re}),[...ee,...Pe]})},loadRecent:q=>{if(console.log("[MockGrackle] knowledge.loadRecent",q),te.current=q,q){const ee=ns.filter(ce=>!ce.workspaceId||ce.workspaceId===q);Z(ee);const ie=new Set(ee.map(ce=>ce.id));Q(da.filter(ce=>ie.has(ce.source)&&ie.has(ce.target)))}else Z(ns),Q(da);$("")},handleEvent:()=>!1}}),[s,o,u,m,g,b,S,N,w,A,D,E,z,F,ae,oe,B,Ct,Je,It,it,Yn,Bs,Tn,zn,Jn,Ls,Pn,De,lo,co,uo,_a,Or,fo,Ir,Br,Us,Jt,Vn,Wt,Lr]);return l.jsx(am.Provider,{value:Hc,children:n})}const FB=3e3;function ZB(n){const[s,i]=y.useState(!1),o=y.useRef(n.onSessionEvent);o.current=n.onSessionEvent;const c=y.useRef(n.onDomainEvent);c.current=n.onDomainEvent;const u=y.useRef(n.onConnect);u.current=n.onConnect;const d=y.useRef(n.onDisconnect);return d.current=n.onDisconnect,y.useEffect(()=>{let m=!1,h;async function g(){var v,b;if(!m){try{const _=ke.streamEvents({});i(!0),(v=u.current)==null||v.call(u);for await(const S of _){if(m)break;const T=S.event;if(T.case==="sessionEvent"){const N=T.value;o.current({sessionId:N.sessionId,type:N.type,timestamp:N.timestamp,content:N.content,raw:N.raw})}else if(T.case==="domainEvent"){const N=T.value;c.current({id:N.id,type:N.type,timestamp:N.timestamp,payloadJson:N.payloadJson})}}}catch(_){if(_ instanceof Ec&&_.code===uT.Unauthenticated){window.location.href=$2;return}}m||(i(!1),(b=d.current)==null||b.call(d),h=setTimeout(()=>{g().catch(()=>{})},FB))}}return g().catch(()=>{}),()=>{m=!0,clearTimeout(h),i(!1)}},[]),{connected:s}}function KB(n){return{id:n.id,displayName:n.displayName,adapterType:n.adapterType,adapterConfig:n.adapterConfig||"{}",status:n.status,bootstrapped:n.bootstrapped}}function Ky(n){return{id:n.id,environmentId:n.environmentId,runtime:n.runtime,status:n.status,prompt:n.prompt,startedAt:n.startedAt,endedAt:n.endedAt||void 0,error:n.error||void 0,endReason:n.endReason||void 0,personaId:n.personaId||void 0,inputTokens:n.inputTokens,outputTokens:n.outputTokens,costUsd:n.costUsd}}function YB(n){return{sessionId:n.sessionId,eventType:lb(n.type),timestamp:n.timestamp,content:n.content,raw:n.raw||void 0}}function JB(n){return{id:n.id,name:n.name,description:n.description,repoUrl:n.repoUrl,environmentId:n.environmentId,status:dT(n.status),workingDirectory:n.workingDirectory,useWorktrees:n.useWorktrees,defaultPersonaId:n.defaultPersonaId,createdAt:n.createdAt,updatedAt:n.updatedAt}}function Yy(n){return{id:n.id,workspaceId:n.workspaceId??void 0,title:n.title,description:n.description,status:fT(n.status),branch:n.branch,latestSessionId:n.latestSessionId,dependsOn:[...n.dependsOn],sortOrder:n.sortOrder,createdAt:n.createdAt,startedAt:n.startedAt||void 0,completedAt:n.completedAt||void 0,parentTaskId:n.parentTaskId,depth:n.depth,childTaskIds:[...n.childTaskIds],canDecompose:n.canDecompose,defaultPersonaId:n.defaultPersonaId,workpad:n.workpad}}function WB(n){return{id:n.id,workspaceId:n.workspaceId,taskId:n.taskId,sessionId:n.sessionId,category:n.category,title:n.title,content:n.content,tags:[...n.tags],createdAt:n.createdAt}}function XB(n){return{name:n.name,tokenType:n.type,envVar:n.envVar,filePath:n.filePath,expiresAt:n.expiresAt}}function QB(n){return{claude:pT(n.claude),github:Jl(n.github),copilot:Jl(n.copilot),codex:Jl(n.codex),goose:Jl(n.goose)}}function eL(n){return{name:n.name,repository:n.repository,state:n.state,gitStatus:n.gitStatus}}function Df(n){return{id:n.id,name:n.name,description:n.description,systemPrompt:n.systemPrompt,toolConfig:n.toolConfig?JSON.stringify({allowedTools:[...n.toolConfig.allowedTools],disallowedTools:[...n.toolConfig.disallowedTools]}):"{}",runtime:n.runtime,model:n.model,maxTurns:n.maxTurns,mcpServers:JSON.stringify(n.mcpServers.map(s=>({name:s.name,command:s.command,args:[...s.args],tools:[...s.tools]}))),createdAt:n.createdAt,updatedAt:n.updatedAt,type:n.type||"agent",script:n.script,allowedMcpTools:[...n.allowedMcpTools]}}function tL(n){return{inputTokens:n.inputTokens,outputTokens:n.outputTokens,costUsd:n.costUsd,sessionCount:n.sessionCount}}function oc(n,s=0){return{id:n.id,label:n.title||n.label||n.id,kind:n.kind,category:n.category||void 0,sourceType:n.sourceType||void 0,sourceId:n.sourceId||void 0,content:n.content||void 0,tags:n.tags.length>0?[...n.tags]:void 0,workspaceId:n.workspaceId||void 0,createdAt:n.createdAt||void 0,updatedAt:n.updatedAt||void 0,val:s}}function Rf(n){return{source:n.fromId,target:n.toId,type:n.type}}const Jy=5e3;function nL(){const[n,s]=y.useState([]),[i,o]=y.useState({}),c=y.useCallback(()=>{ke.listEnvironments({}).then(_=>{s(_.environments.map(KB))},()=>{})},[]),u=y.useCallback(_=>{switch(_.type){case"environment.added":return!0;case"environment.removed":{const S=_.payload.environmentId;return S&&(s(T=>T.filter(N=>N.id!==S)),o(T=>{const N={...T};return delete N[S],N})),!0}case"environment.changed":return c(),!0;case"environment.provision_progress":{const S=_.payload;if(typeof S.environmentId!="string"||typeof S.stage!="string"||typeof S.message!="string"||typeof S.progress!="number")return Rx("environment.provision_progress","invalid payload"),!0;if(o(T=>({...T,[S.environmentId]:{stage:S.stage,message:S.message,progress:S.progress}})),S.stage==="ready"){const T=S.environmentId;setTimeout(()=>{o(N=>{const j={...N};return delete j[T],j})},Jy)}return!0}default:return!1}},[c]),d=y.useCallback(_=>{var S;if(_.type==="environments"){const T=Array.isArray((S=_.payload)==null?void 0:S.environments)?_.payload.environments:[];return s(T),!0}return!1},[]),m=y.useCallback((_,S,T)=>{ke.addEnvironment({displayName:_,adapterType:S,adapterConfig:JSON.stringify(T??{})}).catch(()=>{})},[]),h=y.useCallback((_,S)=>{ke.updateEnvironment({id:_,displayName:S.displayName,adapterConfig:S.adapterConfig?JSON.stringify(S.adapterConfig):void 0}).catch(()=>{})},[]),g=y.useCallback((_,S)=>{(async()=>{try{const N=ke.provisionEnvironment({id:_,force:S??!1});for await(const j of N)o(w=>({...w,[_]:{stage:j.stage,message:j.message,progress:j.progress}})),j.stage==="ready"&&setTimeout(()=>{o(w=>{const C={...w};return delete C[_],C})},Jy)}catch{o(N=>{const j={...N};return delete j[_],j})}})().catch(()=>{})},[]),v=y.useCallback(_=>{ke.stopEnvironment({id:_}).catch(()=>{})},[]),b=y.useCallback(_=>{ke.removeEnvironment({id:_}).catch(()=>{})},[]);return{environments:n,provisionStatus:i,loadEnvironments:c,addEnvironment:m,updateEnvironment:h,provisionEnvironment:g,stopEnvironment:v,removeEnvironment:b,handleEvent:u,handleLegacyMessage:d}}const Mf=new Set(["pending","running","idle"]),sL=new Set(["completed","failed","interrupted","hibernating","suspended"]),Wy=["pending","running","idle"];function aL(){const[n,s]=y.useState([]),[i,o]=y.useState([]),[c,u]=y.useState(0),[d,m]=y.useState(void 0),[h,g]=y.useState({}),v=y.useCallback(()=>{ke.listSessions({}).then(D=>{const E=D.sessions.map(Ky);s(H=>{const z=new Map(H.map(Z=>[Z.id,Z]));return E.map(Z=>{const F=z.get(Z.id),Q=F==null?void 0:F.status;return!Q||Q===Z.status?Z:sL.has(Q)&&Mf.has(Z.status)?{...Z,status:Q,...F.endReason!==void 0?{endReason:F.endReason}:{}}:Mf.has(Q)&&Mf.has(Z.status)&&Wy.indexOf(Q)>Wy.indexOf(Z.status)?{...Z,status:Q}:Z})})},()=>{})},[]),b=y.useCallback(D=>{if(D.type!=="session_event")return!1;if(!SB(D.payload))return Rx("session_event","payload is not a valid SessionEvent"),!0;const E=D.payload;let H=0;if(o(z=>{const Z=[...z,E];return Z.length>Hi?(H=Z.length-Hi,Z.slice(-Hi)):Z}),H>0&&u(z=>z+H),E.eventType==="usage")try{const z=JSON.parse(E.content),Z=Number(z.input_tokens)||0,F=Number(z.output_tokens)||0,Q=Number(z.cost_usd)||0;(Z>0||F>0||Q>0)&&s(ae=>ae.map(pe=>pe.id===E.sessionId?{...pe,inputTokens:(pe.inputTokens??0)+Z,outputTokens:(pe.outputTokens??0)+F,costUsd:(pe.costUsd??0)+Q}:pe))}catch{}if(E.eventType==="status"){const z=Mx(E.content),Z=Ox(E.content);s(F=>F.some(ae=>ae.id===E.sessionId)?F.map(ae=>ae.id===E.sessionId?{...ae,status:z,...Z!==void 0?{endReason:Z}:{}}:ae):[...F,{id:E.sessionId,environmentId:"",runtime:"",status:z,prompt:"",startedAt:E.timestamp,...Z!==void 0?{endReason:Z}:{}}])}return!0},[]),_=y.useCallback(D=>{b({type:"session_event",payload:D})},[b]),S=y.useCallback(D=>{var E,H,z,Z,F;switch(D.type){case"sessions":{const Q=Array.isArray((E=D.payload)==null?void 0:E.sessions)?D.payload.sessions:[];return s(Q),!0}case"spawned":{const Q=(H=D.payload)==null?void 0:H.sessionId;return typeof Q=="string"&&Q&&m(Q),v(),!0}case"session_events":{const Q=Array.isArray((z=D.payload)==null?void 0:z.events)?D.payload.events:[];return Q.length>0&&o(Q),!0}case"task_sessions":{const Q=(Z=D.payload)==null?void 0:Z.taskId;if(typeof Q=="string"&&Q){const ae=Array.isArray((F=D.payload)==null?void 0:F.sessions)?D.payload.sessions:[];g(pe=>({...pe,[Q]:ae}))}return!0}default:return!1}},[v]),T=y.useCallback((D,E,H,z)=>{ke.spawnAgent({environmentId:D,prompt:E,personaId:H||"",workingDirectory:z||""}).then(Z=>{m(Z.id),v()},()=>{})},[v]),N=y.useCallback((D,E)=>{ke.sendInput({sessionId:D,text:E}).catch(()=>{})},[]),j=y.useCallback(D=>{ke.killAgent({id:D,graceful:!1}).catch(()=>{})},[]),w=y.useCallback(D=>{ke.killAgent({id:D,graceful:!0}).catch(()=>{})},[]),C=y.useCallback(D=>{ke.getSessionEvents({id:D}).then(E=>{const H=E.events.map(YB);if(H.length>0){let z=0;o(Z=>{const F=new Set;for(const pe of Z)pe.sessionId===D&&F.add(`${pe.timestamp}|${pe.eventType}`);const Q=H.filter(pe=>!F.has(`${pe.timestamp}|${pe.eventType}`)),ae=[...Z,...Q].sort((pe,oe)=>pe.sessionId!==oe.sessionId?0:pe.timestamp.localeCompare(oe.timestamp));return ae.length>Hi?(z=ae.length-Hi,ae.slice(-Hi)):ae}),z>0&&u(Z=>Z+z)}},()=>{})},[]),A=y.useCallback(()=>{o([]),u(0)},[]),M=y.useCallback(D=>{ke.getTaskSessions({id:D}).then(E=>{const H=E.sessions.map(Ky);g(z=>({...z,[D]:H}))},()=>{})},[]);return{sessions:n,events:i,eventsDropped:c,lastSpawnedId:d,taskSessions:h,loadSessions:v,spawn:T,sendInput:N,kill:j,stopGraceful:w,loadSessionEvents:C,clearEvents:A,loadTaskSessions:M,handleMessage:b,handleSessionEvent:_,handleLegacyMessage:S}}function iL(){const[n,s]=y.useState([]),[i,o]=y.useState(!1),c=y.useCallback(()=>{ke.listWorkspaces({}).then(v=>{s(v.workspaces.map(JB))},()=>{})},[]),u=y.useCallback(v=>{switch(v.type){case"workspace.created":return o(!1),c(),!0;case"workspace.archived":case"workspace.updated":return c(),!0;default:return!1}},[c]),d=y.useCallback(()=>{o(!1)},[]),m=y.useCallback((v,b,_,S,T,N,j,w,C)=>{o(!0),ke.createWorkspace({name:v,description:b||"",repoUrl:_||"",environmentId:S||"",defaultPersonaId:T||void 0,useWorktrees:N??!0,workingDirectory:j||void 0}).then(()=>{o(!1),w==null||w()},A=>{o(!1);const M=A instanceof Ec?A.message:"Failed to create workspace";C==null||C(M)})},[]),h=y.useCallback(v=>{ke.archiveWorkspace({id:v}).catch(()=>{})},[]),g=y.useCallback((v,b)=>{ke.updateWorkspace({id:v,...b}).catch(()=>{})},[]);return{workspaces:n,workspaceCreating:i,loadWorkspaces:c,createWorkspace:m,archiveWorkspace:h,updateWorkspace:g,handleEvent:u,onDisconnect:d}}function oL(){const[n,s]=y.useState([]),[i,o]=y.useState(void 0),c=y.useRef({}),u=y.useCallback(C=>{ke.listTasks({workspaceId:C}).then(A=>{const M=A.tasks.map(Yy);s(D=>[...D.filter(E=>E.workspaceId!==C),...M])},()=>{})},[]),d=y.useCallback(()=>{ke.listTasks({}).then(C=>{const A=C.tasks.map(Yy);s(M=>{const D=new Set(A.map(E=>E.id));return[...M.filter(E=>!D.has(E.id)),...A]})},()=>{})},[]),m=y.useCallback((C,A)=>{const M=D=>{clearTimeout(c.current[D]),c.current[D]=setTimeout(()=>{delete c.current[D],u(D)},200)};C?M(C):A&&s(D=>{const E=D.find(H=>H.id===A);return E!=null&&E.workspaceId?M(E.workspaceId):d(),D})},[u,d]),h=y.useCallback(C=>{const A=C.payload;switch(C.type){case"task.created":{const M=typeof A.workspaceId=="string"?A.workspaceId:"";return M&&u(M),!0}case"task.started":{const M=typeof A.taskId=="string"?A.taskId:"",D=typeof A.sessionId=="string"?A.sessionId:"",E=typeof A.workspaceId=="string"?A.workspaceId:"";return o(H=>M&&H===M?void 0:H),D&&M&&s(H=>H.map(z=>z.id===M?{...z,latestSessionId:D}:z)),m(E,M),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const M=typeof A.workspaceId=="string"?A.workspaceId:"",D=typeof A.taskId=="string"?A.taskId:"";return m(M,D),!0}default:return!1}},[u,m]),g=y.useCallback(()=>{o(void 0)},[]),v=y.useCallback(C=>{var A,M;if(C.type==="tasks"){const D=Array.isArray((A=C.payload)==null?void 0:A.tasks)?C.payload.tasks:[],E=typeof((M=C.payload)==null?void 0:M.workspaceId)=="string"&&C.payload.workspaceId?C.payload.workspaceId:"";return s(E?H=>[...H.filter(z=>z.workspaceId!==E),...D]:H=>{const z=new Set(D.map(Z=>Z.id));return[...H.filter(Z=>!z.has(Z.id)),...D]}),!0}return!1},[]),b=y.useCallback((C,A,M,D,E,H,z,Z,F)=>{ke.createTask({workspaceId:C,title:A,description:M||"",dependsOn:D||[],parentTaskId:E||"",defaultPersonaId:H||void 0,canDecompose:z??void 0}).then(()=>{Z==null||Z()},Q=>{const ae=Q instanceof Ec?Q.message:"Failed to create task";F==null||F(ae)})},[]),_=y.useCallback((C,A,M,D)=>{o(C),ke.startTask({taskId:C,personaId:A||"",environmentId:M||"",notes:D||""}).catch(()=>{o(void 0)})},[]),S=y.useCallback(C=>{ke.stopTask({id:C}).catch(()=>{})},[]),T=y.useCallback(C=>{ke.completeTask({id:C}).catch(()=>{})},[]),N=y.useCallback(C=>{ke.resumeTask({id:C}).catch(()=>{})},[]),j=y.useCallback((C,A,M,D,E)=>{ke.updateTask({id:C,title:A,description:M,dependsOn:D,...E!==void 0?{defaultPersonaId:E}:{}}).catch(()=>{})},[]),w=y.useCallback(C=>{ke.deleteTask({id:C}).catch(()=>{})},[]);return{tasks:n,taskStartingId:i,loadTasks:u,loadAllTasks:d,createTask:b,startTask:_,stopTask:S,completeTask:T,resumeTask:N,updateTask:j,deleteTask:w,handleEvent:h,onDisconnect:g,handleLegacyMessage:v}}function rL(){const[n,s]=y.useState([]),i=y.useCallback(u=>{ke.queryFindings({workspaceId:u}).then(d=>{s(d.findings.map(WB))},()=>{})},[]),o=y.useCallback(u=>{if(u.type==="finding.posted"){const d=typeof u.payload.workspaceId=="string"?u.payload.workspaceId:"";return d&&i(d),!0}return!1},[i]),c=y.useCallback((u,d,m,h,g)=>{ke.postFinding({workspaceId:u,title:d,content:m,category:h??"general",tags:g??[]}).catch(()=>{})},[]);return{findings:n,loadFindings:i,postFinding:c,handleEvent:o}}function lL(){const[n,s]=y.useState([]),i=y.useCallback(()=>{ke.listTokens({}).then(d=>{s(d.tokens.map(XB))},()=>{})},[]),o=y.useCallback(d=>d.type==="token.changed"?(i(),!0):!1,[i]),c=y.useCallback((d,m,h,g,v)=>{ke.setToken({name:d,value:m,type:h,envVar:g,filePath:v}).catch(()=>{})},[]),u=y.useCallback(d=>{ke.deleteToken({name:d}).catch(()=>{})},[]);return{tokens:n,loadTokens:i,setToken:c,deleteToken:u,handleEvent:o}}function cL(){const[n,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),i=y.useCallback(()=>{ke.getCredentialProviders({}).then(u=>{s(QB(u))},()=>{})},[]),o=y.useCallback(u=>u.type==="credential.providers_changed"?(kB(u.payload)&&s(u.payload),!0):!1,[]),c=y.useCallback(u=>{const d=[{provider:"claude",value:u.claude},{provider:"github",value:u.github},{provider:"copilot",value:u.copilot},{provider:"codex",value:u.codex},{provider:"goose",value:u.goose}];for(const{provider:m,value:h}of d)ke.setCredentialProvider({provider:m,value:h}).catch(()=>{})},[]);return{credentialProviders:n,loadCredentials:i,updateCredentialProviders:c,handleEvent:o}}function uL(){const[n,s]=y.useState([]),[i,o]=y.useState(""),[c,u]=y.useState(""),[d,m]=y.useState(!1),h=y.useCallback(()=>{ke.listCodespaces({}).then(v=>{s(v.codespaces.map(eL)),u(v.error)},()=>{})},[]),g=y.useCallback((v,b)=>{m(!0),o(""),ke.createCodespace({repo:v,machine:b??""}).then(()=>{m(!1),h()},_=>{m(!1);const S=_ instanceof Ec?_.message:"Failed to create codespace";o(S)})},[h]);return{codespaces:n,codespaceError:i,codespaceListError:c,codespaceCreating:d,listCodespaces:h,createCodespace:g}}function dL(){const[n,s]=y.useState([]),i=y.useCallback(()=>{ke.listPersonas({}).then(m=>{s(m.personas.map(Df))},()=>{})},[]),o=y.useCallback(m=>{switch(m.type){case"persona.created":case"persona.updated":case"persona.deleted":return i(),!0;default:return!1}},[i]),c=y.useCallback((m,h,g,v,b,_,S,T,N)=>ke.createPersona({name:m,description:h,systemPrompt:g,runtime:v||"",model:b||"",maxTurns:_||0,type:S||"agent",script:T||"",allowedMcpTools:N||[]}).then(j=>{const w=Df(j);return s(C=>[...C.filter(A=>A.id!==w.id),w]),w}),[]),u=y.useCallback((m,h,g,v,b,_,S,T,N,j)=>{const w={id:m};return h!==void 0&&(w.name=h),g!==void 0&&(w.description=g),v!==void 0&&(w.systemPrompt=v),b!==void 0&&(w.runtime=b),_!==void 0&&(w.model=_),S!==void 0&&(w.maxTurns=S),T!==void 0&&(w.type=T),N!==void 0&&(w.script=N),j!==void 0&&(w.allowedMcpTools=j),ke.updatePersona(w).then(C=>{const A=Df(C);return s(M=>M.map(D=>D.id===A.id?A:D)),A})},[]),d=y.useCallback(async m=>{await ke.deletePersona({id:m}),s(h=>h.filter(g=>g.id!==m))},[]);return{personas:n,loadPersonas:i,createPersona:c,updatePersona:u,deletePersona:d,handleEvent:o}}function fL(n){if(n)try{return JSON.parse(n)}catch{return}}function pL(){const[n,s]=y.useState(new Map),[i,o]=y.useState([]),[c,u]=y.useState(void 0),[d,m]=y.useState(void 0),[h,g]=y.useState(!1),[v,b]=y.useState(""),_=y.useRef(""),S=y.useCallback(M=>{const D=M??"";_.current=D,b(""),g(!0),ke.listRecentKnowledgeNodes({limit:30,workspaceId:D}).then(E=>{const H=new Map,z=[];for(const Z of E.nodes)H.set(Z.id,oc(Z));for(const Z of E.edges)z.push(Rf(Z));for(const Z of z){const F=H.get(Z.source);F&&(F.val+=1);const Q=H.get(Z.target);Q&&(Q.val+=1)}s(H),o(z),g(!1)},()=>{g(!1)})},[]),T=y.useCallback(M=>{M.trim()&&(b(M),m(void 0),u(void 0),g(!0),ke.searchKnowledge({query:M,limit:20,workspaceId:_.current}).then(D=>{const E=new Map,H=[];for(const z of D.results){z.node&&E.set(z.node.id,oc(z.node,z.edges.length));for(const Z of z.edges)H.push(Rf(Z))}s(E),o(H),g(!1)},()=>{g(!1)}))},[]),N=y.useCallback(()=>{S(_.current)},[S]),j=y.useCallback(M=>{m(M),ke.getKnowledgeNode({id:M}).then(D=>{if(!D.node){u(void 0);return}u({node:oc(D.node,D.edges.length),edges:D.edges.map(E=>({fromId:E.fromId,toId:E.toId,type:E.type,metadata:fL(E.metadataJson)}))})},()=>{u(void 0)})},[]),w=y.useCallback(()=>{m(void 0),u(void 0)},[]),C=y.useCallback(M=>{ke.expandKnowledgeNode({id:M,depth:1}).then(D=>{s(E=>{const H=new Map(E);for(const z of D.nodes)H.has(z.id)||H.set(z.id,oc(z));return H}),o(E=>{const H=new Set(E.map(Z=>`${Z.source}:${Z.target}:${Z.type}`)),z=[];for(const Z of D.edges){const F=Rf(Z),Q=`${F.source}:${F.target}:${F.type}`;H.has(Q)||z.push(F)}return[...E,...z]})},()=>{})},[]),A=y.useCallback(M=>!1,[]);return{graphData:{nodes:[...n.values()],links:i},selectedNode:c,selectedId:d,loading:h,searchQuery:v,search:T,clearSearch:N,selectNode:j,clearSelection:w,expandNode:C,loadRecent:S,handleEvent:A}}function mL(){const[n,s]=y.useState(""),[i,o]=y.useState(void 0),[c,u]=y.useState({}),d=nL(),m=aL(),h=iL(),g=oL(),v=rL(),b=lL(),_=cL(),S=uL(),T=dL(),N=pL(),{connected:j}=ZB({onSessionEvent:F=>{m.handleSessionEvent({sessionId:F.sessionId,eventType:lb(F.type),timestamp:F.timestamp,content:F.content,raw:F.raw||void 0})},onDomainEvent:F=>{try{const Q=JSON.parse(F.payloadJson);E({id:F.id,type:F.type,timestamp:F.timestamp,payload:Q})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",F.payloadJson)}},onConnect:H,onDisconnect:z}),w="default_persona_id",C="onboarding_completed",A=y.useCallback(async F=>{const Q=await ke.setSetting({key:w,value:F});s(Q.value)},[]),M=y.useCallback(()=>{o(!0),ke.setSetting({key:C,value:"true"}).catch(()=>{})},[]),D=y.useCallback((F,Q)=>{ke.getUsage({scope:F,id:Q}).then(ae=>{const pe=`${F}:${Q}`;u(oe=>({...oe,[pe]:tL(ae)}))},()=>{})},[]);function E(F){const Q=F.payload.key,ae=F.payload.value;if(F.type==="setting.changed"){Q===w&&s(ae??""),Q===C&&o(ae==="true");return}if(d.handleEvent(F)){(F.type==="environment.removed"||F.type==="environment.changed")&&m.loadSessions();return}if(!h.handleEvent(F)){if(g.handleEvent(F)){F.type==="task.started"&&m.loadSessions();return}v.handleEvent(F)||b.handleEvent(F)||_.handleEvent(F)||T.handleEvent(F)||N.handleEvent(F)}}function H(){d.loadEnvironments(),m.loadSessions(),h.loadWorkspaces(),b.loadTokens(),_.loadCredentials(),T.loadPersonas(),ke.getSetting({key:w}).then(F=>{s(F.value)},()=>{}),ke.getSetting({key:C}).then(F=>{o(F.value==="true")},()=>{}),g.loadAllTasks()}function z(){h.onDisconnect(),g.onDisconnect()}const Z=y.useCallback(()=>{d.loadEnvironments(),m.loadSessions(),h.loadWorkspaces(),b.loadTokens()},[d.loadEnvironments,m.loadSessions,h.loadWorkspaces,b.loadTokens]);return{connected:j,environments:d.environments,sessions:m.sessions,events:m.events,eventsDropped:m.eventsDropped,lastSpawnedId:m.lastSpawnedId,workspaces:h.workspaces,tasks:g.tasks,findings:v.findings,tokens:b.tokens,spawn:m.spawn,sendInput:m.sendInput,kill:m.kill,stopGraceful:m.stopGraceful,refresh:Z,loadSessionEvents:m.loadSessionEvents,clearEvents:m.clearEvents,loadWorkspaces:h.loadWorkspaces,createWorkspace:h.createWorkspace,archiveWorkspace:h.archiveWorkspace,updateWorkspace:h.updateWorkspace,loadTasks:g.loadTasks,loadAllTasks:g.loadAllTasks,createTask:g.createTask,startTask:g.startTask,stopTask:g.stopTask,completeTask:g.completeTask,resumeTask:g.resumeTask,updateTask:g.updateTask,deleteTask:g.deleteTask,loadFindings:v.loadFindings,postFinding:v.postFinding,loadEnvironments:d.loadEnvironments,addEnvironment:d.addEnvironment,updateEnvironment:d.updateEnvironment,loadTokens:b.loadTokens,setToken:b.setToken,deleteToken:b.deleteToken,credentialProviders:_.credentialProviders,updateCredentialProviders:_.updateCredentialProviders,provisionStatus:d.provisionStatus,provisionEnvironment:d.provisionEnvironment,stopEnvironment:d.stopEnvironment,removeEnvironment:d.removeEnvironment,codespaces:S.codespaces,codespaceError:S.codespaceError,codespaceListError:S.codespaceListError,codespaceCreating:S.codespaceCreating,listCodespaces:S.listCodespaces,createCodespace:S.createCodespace,workspaceCreating:h.workspaceCreating,taskStartingId:g.taskStartingId,personas:T.personas,createPersona:T.createPersona,updatePersona:T.updatePersona,deletePersona:T.deletePersona,taskSessions:m.taskSessions,loadTaskSessions:m.loadTaskSessions,appDefaultPersonaId:n,setAppDefaultPersonaId:A,onboardingCompleted:i,completeOnboarding:M,usageCache:c,loadUsage:D,knowledge:N}}function hL({children:n}){const s=mL();return l.jsx(am.Provider,{value:s,children:n})}function gL(n,s){const i=y.useRef(null);y.useEffect(()=>{const o=i.current;if(i.current=n,o===null)return;const c=new Map;for(const d of o)c.set(d.id,d);const u=new Set;for(const d of n){u.add(d.id);const m=c.get(d.id);if(m&&m.status!==d.status&&d.status!=="sleeping"){if(d.status==="connecting"){s("Provisioning environment…","info");continue}d.status==="connected"?s("Environment connected","success"):d.status==="error"?s("Environment provision failed","error"):d.status==="disconnected"&&(m.status==="connected"?s("Environment disconnected","warning"):s("Environment stopped","info"))}}for(const d of o)u.has(d.id)||s("Environment removed","info")},[n,s])}const vL={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 yL(n){return vL[n]}function bL(n,s){if(n===void 0)return[];const i=[],o=new Map;for(const u of n)o.set(u.id,u);const c=new Set;for(const u of s){c.add(u.id);const d=o.get(u.id);if(!d||d.status===u.status)continue;const m=yL(u.status);m&&i.push(m)}for(const u of n)c.has(u.id)||i.push({message:"Task deleted",variant:"info"});return i}function _L(n,s){const i=y.useRef(void 0);y.useEffect(()=>{const o=i.current;i.current=n;const c=bL(o,n);for(const u of c)s(u.message,u.variant)},[n,s])}const xL="_dashboard_16pzm_1",SL="_kpiStrip_16pzm_11",TL="_kpiCard_16pzm_23",kL="_kpiValue_16pzm_68",wL="_kpiLabel_16pzm_76",NL="_bodyGrid_16pzm_84",jL="_section_16pzm_96",CL="_sectionHeader_16pzm_109",EL="_sectionIcon_16pzm_118",AL="_sectionTitle_16pzm_123",DL="_sectionCount_16pzm_131",RL="_sectionBody_16pzm_138",ML="_emptyHint_16pzm_143",OL="_sessionRow_16pzm_150",IL="_sessionPrompt_16pzm_177",BL="_sessionEnv_16pzm_186",LL="_sessionRuntime_16pzm_192",UL="_sessionStatus_16pzm_198",zL="_statusDot_16pzm_207",PL="_attentionRow_16pzm_233",VL="_attentionTitle_16pzm_259",HL="_attentionMeta_16pzm_267",qL="_reasonBadge_16pzm_274",GL="_bottomGrid_16pzm_301",$L="_envRow_16pzm_312",FL="_envName_16pzm_323",ZL="_envStatusBadge_16pzm_333",KL="_workspaceRow_16pzm_369",YL="_workspaceTop_16pzm_395",JL="_workspaceName_16pzm_401",WL="_workspaceCounts_16pzm_407",XL="_progressBar_16pzm_415",QL="_progressFill_16pzm_422",_e={dashboard:xL,kpiStrip:SL,kpiCard:TL,kpiValue:kL,kpiLabel:wL,bodyGrid:NL,section:jL,sectionHeader:CL,sectionIcon:EL,sectionTitle:AL,sectionCount:DL,sectionBody:RL,emptyHint:ML,sessionRow:OL,sessionPrompt:IL,sessionEnv:BL,sessionRuntime:LL,sessionStatus:UL,statusDot:zL,attentionRow:PL,attentionTitle:VL,attentionMeta:HL,reasonBadge:qL,bottomGrid:GL,envRow:$L,envName:FL,envStatusBadge:ZL,workspaceRow:KL,workspaceTop:YL,workspaceName:JL,workspaceCounts:WL,progressBar:XL,progressFill:QL},e8={hidden:{opacity:0,y:12},visible:n=>({opacity:1,y:0,transition:{delay:n*.06,duration:.3,ease:"easeOut"}})},rc={hidden:{opacity:0,y:16},visible:n=>({opacity:1,y:0,transition:{delay:.15+n*.08,duration:.35,ease:"easeOut"}})};function t8(n,s,i,o){const c=[`${n} of ${s} tasks completed`];return i>0&&c.push(`${i} in progress`),o>0&&c.push(`${o} failed`),c.join(", ")}function lc({value:n,label:s,accent:i,index:o,testId:c}){return l.jsxs(Ot.div,{className:_e.kpiCard,"data-accent":i,"data-testid":c,variants:e8,initial:"hidden",animate:"visible",custom:o,children:[l.jsx("span",{className:_e.kpiValue,children:n}),l.jsx("span",{className:_e.kpiLabel,children:s})]})}function n8(){const{workspaces:n,tasks:s,sessions:i,environments:o,loadTasks:c}=pt(),u=St(),d=y.useRef(new Set);y.useEffect(()=>{for(const b of n)d.current.has(b.id)||(d.current.add(b.id),c(b.id))},[n,c]);const m=y.useMemo(()=>RB(i,s,o),[i,s,o]),h=y.useMemo(()=>OB(i,o),[i,o]),g=y.useMemo(()=>MB(s,n),[s,n]),v=y.useMemo(()=>IB(n,s),[n,s,o]);return l.jsxs("div",{className:_e.dashboard,"data-testid":"dashboard",children:[l.jsxs("div",{className:_e.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[l.jsx(lc,{value:m.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),l.jsx(lc,{value:m.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),l.jsx(lc,{value:m.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),l.jsx(lc,{value:m.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),l.jsxs("div",{className:_e.bodyGrid,children:[l.jsxs(Ot.div,{className:_e.section,variants:rc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[l.jsxs("div",{className:_e.sectionHeader,children:[l.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"●"}),l.jsx("span",{className:_e.sectionTitle,children:"Active Sessions"}),l.jsx("span",{className:_e.sectionCount,children:h.length})]}),l.jsx("div",{className:_e.sectionBody,children:h.length===0?l.jsx("div",{className:_e.emptyHint,children:"No active sessions"}):h.map(({session:b,environmentName:_})=>l.jsxs("button",{type:"button",className:_e.sessionRow,onClick:()=>u(jb(b.id)),"data-testid":"session-row",children:[l.jsx("span",{className:_e.sessionPrompt,title:b.prompt,children:b.prompt||"—"}),l.jsx("span",{className:_e.sessionEnv,children:_}),l.jsx("span",{className:_e.sessionRuntime,children:b.runtime}),l.jsxs("span",{className:_e.sessionStatus,children:[l.jsx("span",{className:_e.statusDot,"data-status":b.status}),b.status]})]},b.id))})]}),l.jsxs(Ot.div,{className:_e.section,variants:rc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[l.jsxs("div",{className:_e.sectionHeader,children:[l.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"⚑"}),l.jsx("span",{className:_e.sectionTitle,children:"Needs Attention"}),l.jsx("span",{className:_e.sectionCount,children:g.length})]}),l.jsx("div",{className:_e.sectionBody,children:g.length===0?l.jsx("div",{className:_e.emptyHint,children:"All clear"}):g.map(({task:b,reason:_,workspaceName:S})=>l.jsxs("button",{type:"button",className:_e.attentionRow,onClick:()=>u(os(b.id)),"data-testid":"attention-row",children:[l.jsxs("div",{className:_e.attentionTitle,children:[l.jsx("span",{className:_e.reasonBadge,"data-reason":_,children:_}),b.title]}),l.jsx("div",{className:_e.attentionMeta,children:l.jsx("span",{children:S})})]},b.id))})]})]}),l.jsxs("div",{className:_e.bottomGrid,children:[l.jsxs(Ot.div,{className:_e.section,variants:rc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[l.jsxs("div",{className:_e.sectionHeader,children:[l.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"◈"}),l.jsx("span",{className:_e.sectionTitle,children:"Environment Health"}),l.jsx("span",{className:_e.sectionCount,children:o.length})]}),l.jsx("div",{className:_e.sectionBody,children:o.length===0?l.jsx("div",{className:_e.emptyHint,children:"No environments configured"}):o.map(b=>l.jsxs("div",{className:_e.envRow,"data-testid":"dashboard-env-row",children:[l.jsx("span",{className:_e.envName,children:b.displayName}),l.jsx("span",{className:_e.envStatusBadge,"data-status":b.status,children:b.status})]},b.id))})]}),l.jsxs(Ot.div,{className:_e.section,variants:rc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[l.jsxs("div",{className:_e.sectionHeader,children:[l.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"▦"}),l.jsx("span",{className:_e.sectionTitle,children:"Workspaces"}),l.jsx("span",{className:_e.sectionCount,children:n.length})]}),l.jsx("div",{className:_e.sectionBody,children:v.length===0?l.jsx("div",{className:_e.emptyHint,children:"No workspaces yet"}):v.map(({workspace:b,totalTasks:_,completedTasks:S,workingTasks:T,failedTasks:N})=>{const j=_>0?Math.round(S/_*100):0;return l.jsxs("button",{type:"button",className:_e.workspaceRow,onClick:()=>u(Wi(b.id,b.environmentId)),"data-testid":"workspace-row",children:[l.jsxs("div",{className:_e.workspaceTop,children:[l.jsx("span",{className:_e.workspaceName,children:b.name}),l.jsxs("span",{className:_e.workspaceCounts,"aria-label":t8(S,_,T,N),children:[S,"/",_,T>0&&l.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",T]}),N>0&&l.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",N]})]})]}),_>0&&l.jsx("div",{className:_e.progressBar,children:l.jsx("div",{className:_e.progressFill,style:{width:`${j}%`}})})]},b.id)})})]})]})]})}function s8(){return l.jsx("div",{className:U.emptyState,children:"Select a task or click + to create one"})}function a8(){return l.jsx("div",{className:U.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function i8(){const{workspaces:n,environments:s}=pt(),i=St(),o=s.length>0;return n.length>0?l.jsx(n8,{}):l.jsxs("div",{className:U.emptyCta,"data-testid":"welcome-cta",children:[l.jsx("div",{className:U.ctaTitle,children:"Welcome to Grackle"}),l.jsx("div",{className:U.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),l.jsx("button",{className:U.ctaButton,onClick:()=>i(Ab),disabled:!o,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!o&&l.jsx("div",{className:U.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const o8="_panelContainer_19poq_1",r8="_chatHeader_19poq_8",l8="_chatHeaderInfo_19poq_37",c8="_emptyState_19poq_43",u8="_emptyTitle_19poq_55",d8="_emptyDescription_19poq_61",f8="_emptyHint_19poq_67",Za={panelContainer:o8,chatHeader:r8,chatHeaderInfo:l8,emptyState:c8,emptyTitle:u8,emptyDescription:d8,emptyHint:f8};function p8({hasLocalEnvironment:n}){return l.jsxs("div",{className:Za.emptyState,"data-testid":"chat-empty-state",children:[l.jsx("div",{className:Za.emptyTitle,children:"Welcome to Grackle"}),l.jsx("div",{className:Za.emptyDescription,children:n?"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."}),!n&&l.jsx("div",{className:Za.emptyHint,children:"Go to Settings → Environments to add one."})]})}function m8(){const{tasks:n,sessions:s,events:i,eventsDropped:o,environments:c,loadTaskSessions:u,loadSessionEvents:d,kill:m,stopGraceful:h,taskSessions:g,sendInput:v,spawn:b,startTask:_,personas:S,provisionEnvironment:T}=pt(),{showToast:N}=dn(),j=y.useRef(void 0),[w,C]=y.useState(),A=n.find(F=>F.id===nr),M=A!=null&&A.latestSessionId?s.find(F=>F.id===A.latestSessionId)??(g[nr]??[]).find(F=>F.id===A.latestSessionId):void 0;y.useEffect(()=>{u(nr)},[u]),y.useEffect(()=>{A!=null&&A.latestSessionId&&u(nr)},[A==null?void 0:A.latestSessionId,u]),y.useEffect(()=>{M&&M.id!==j.current&&(j.current=M.id,d(M.id))},[M==null?void 0:M.id,d]);const D=y.useMemo(()=>{if(!M)return[];const F=i.filter(Q=>Q.sessionId===M.id);return om(im(F))},[i,M==null?void 0:M.id]),E=c.find(F=>F.adapterType==="local"&&F.status==="connected"),H=M!==void 0&&M.status!=="stopped"&&M.status!=="suspended",z=(M==null?void 0:M.status)==="idle";y.useEffect(()=>{w&&M&&z&&(v(M.id,w),C(void 0))},[w,z,M==null?void 0:M.id,v]);const Z=y.useCallback((F,Q,ae,pe)=>{pe&&C(pe),_(F,Q,ae)},[_]);return l.jsxs("div",{className:Za.panelContainer,"data-testid":"chat-page",children:[H&&l.jsxs("div",{className:Za.chatHeader,children:[l.jsxs("span",{className:Za.chatHeaderInfo,children:["Session: ",M.id.slice(0,8)," | ",M.runtime," | ",M.status]}),l.jsx(Rb,{label:"Stop",onClick:()=>h(M.id),variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>h(M.id)},{label:"Kill",description:"Force kill",onClick:()=>m(M.id)}]})]}),l.jsx(nm,{events:D,eventsDropped:o,emptyState:l.jsx(p8,{hasLocalEnvironment:!!E})}),E&&H&&l.jsx(_r,{mode:"send",sessionId:M.id,environmentId:M.environmentId,personas:S,environments:c,onSendInput:v,onSpawn:b,onStartTask:_,onProvisionEnvironment:T,onShowToast:N}),E&&!H&&l.jsx(_r,{mode:"start",taskId:nr,environmentId:E.id,personas:S,environments:c,onSendInput:v,onSpawn:b,onStartTask:Z,onProvisionEnvironment:T,onShowToast:N})]})}function h8(){const n=CB(),[s]=_p(),i=s.get("env")??"",{sendInput:o,spawn:c,startTask:u,personas:d,environments:m,provisionEnvironment:h}=pt(),{showToast:g}=dn();return l.jsxs("div",{className:U.panelContainer,children:[l.jsx(ya,{segments:n}),l.jsx("div",{className:U.emptyState,children:"Enter a prompt below to start a new session"}),l.jsx(_r,{mode:"spawn",environmentId:i,showPersonaSelect:!0,personas:d,environments:m,onSendInput:o,onSpawn:c,onStartTask:u,onProvisionEnvironment:h,onShowToast:g})]})}function g8({sessionId:n,session:s,isActive:i,onStop:o,onKill:c}){return l.jsxs("div",{className:U.header,children:[l.jsxs("span",{children:["Session: ",n.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costUsd?` | ${Mb((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${eo(s.costUsd??0)}`:""]}),l.jsxs("span",{className:U.headerInfo,children:[s&&l.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),i&&l.jsx(Rb,{label:"Stop",onClick:o,variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:o},{label:"Kill",description:"Force kill",onClick:c}]})]})]})}function v8({session:n}){const s=n&&(n.status==="stopped"||n.status==="suspended"),i=s?`Session ${n.endReason||n.status} with no events recorded.`:"Waiting for events...";return l.jsx("div",{className:s?U.errorMessage:U.waitingMessage,children:i})}function y8(){const{sessionId:n}=va(),{events:s,eventsDropped:i,sessions:o,kill:c,stopGraceful:u,loadSessionEvents:d,sendInput:m,spawn:h,startTask:g,personas:v,environments:b,provisionEnvironment:_}=pt(),{showToast:S}=dn(),T=y.useRef(void 0),N=EB(n),j=o.find(A=>A.id===n)??void 0,w=y.useMemo(()=>{const A=n?s.filter(M=>M.sessionId===n):[];return om(im(A))},[s,n]);if(y.useEffect(()=>{n&&n!==T.current&&(T.current=n,d(n))},[n,d]),!n)return l.jsx("div",{className:U.emptyState,children:"No session selected"});const C=(j==null?void 0:j.status)==="running"||(j==null?void 0:j.status)==="idle";return l.jsxs("div",{className:U.panelContainer,children:[l.jsx(ya,{segments:N}),l.jsx(g8,{sessionId:n,session:j,isActive:C,onStop:()=>u(n),onKill:()=>c(n)}),l.jsx(nm,{events:w,eventsDropped:i,emptyState:l.jsx(v8,{session:j})}),C&&l.jsx(_r,{mode:"send",sessionId:n,environmentId:j.environmentId,personas:v,environments:b,onSendInput:m,onSpawn:h,onStartTask:g,onProvisionEnvironment:_,onShowToast:S})]})}function b8(n){if(!n)return!1;const s=n.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||n.isContentEditable)}function Ms(n,s){const i=y.useRef(s);i.current=s;const{key:o,ctrl:c=!1,shift:u=!1,suppressInInputs:d=!0,enabled:m=!0}=n;y.useEffect(()=>{if(!m)return;const h=g=>{if(d&&b8(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(u&&!g.shiftKey||g.key===o&&i.current())};return document.addEventListener("keydown",h),()=>{document.removeEventListener("keydown",h)}},[o,c,u,d,m])}function Xy(n){if(!n)return"";const s=new Date(n);if(isNaN(s.getTime()))return"";const o=Date.now()-s.getTime();if(o<0)return"just now";const c=Math.floor(o/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const u=Math.floor(c/60);if(u<24)return`${u}h ago`;const d=Math.floor(u/24);return d<30?`${d}d ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const Of=100;function _8(n){try{const s=new URL(n);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function x8(){const{workspaceId:n,environmentId:s}=va(),i=St(),{tasks:o,environments:c,workspaces:u,personas:d,sessions:m,archiveWorkspace:h,updateWorkspace:g,usageCache:v,loadUsage:b}=pt(),{resolvedThemeId:_}=Cx(),[S,T]=y.useState("tasks"),[N,j]=y.useState(!1),[w,C]=y.useState(null),[A,M]=y.useState(!1),D=y.useRef(void 0),E=u.find(X=>X.id===n),H=s??(E==null?void 0:E.environmentId)??"",z=AB(n,H,u,c);Ms({key:"1"},()=>T("graph")),Ms({key:"2"},()=>T("board")),Ms({key:"3"},()=>T("tasks")),y.useEffect(()=>{const X=D.current;D.current=n,!(X===void 0||X===n)&&w!==null&&C(null)},[n,w]);const Z=m.reduce((X,B)=>X+(B.costUsd??0),0);y.useEffect(()=>{n&&b("workspace",n)},[n,b,Z]);const F=n?v[`workspace:${n}`]:void 0,Q=o.filter(X=>X.workspaceId===n),ae=Q.filter(X=>X.status==="complete").length,pe=Q.length,oe=pe>0?Math.round(ae/pe*100):0;return l.jsxs("div",{className:U.panelContainer,children:[l.jsx(ya,{segments:z}),l.jsxs("div",{className:U.workspaceHeader,children:[l.jsx("span",{className:U.workspaceName,"data-testid":"workspace-name",children:l.jsx(Yt,{value:(E==null?void 0:E.name)||"",onSave:X=>{E&&g(E.id,{name:X})},validate:X=>{const B=X.trim();if(!B)return"Name is required";if(B.length>Of)return`Max ${Of} characters`},maxLength:Of,fieldId:"name",activeFieldId:w,onActivate:C,ariaLabel:"Workspace name",renderDisplay:X=>X||n||void 0,"data-testid":"edit-name"})}),l.jsx("button",{className:U.archiveButton,onClick:()=>j(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),l.jsxs("button",{className:U.metaToggle,onClick:()=>M(!A),"aria-expanded":!A,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[l.jsx("span",{className:`${U.metaToggleArrow} ${A?"":U.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!A&&l.jsxs("div",{className:U.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Description"}),l.jsx("div",{className:U.metaValue,children:l.jsx(ap,{value:(E==null?void 0:E.description)||"",onSave:X=>{E&&g(E.id,{description:X})},fieldId:"description",activeFieldId:w,onActivate:C,renderDisplay:X=>X?l.jsx("span",{className:U.overviewMarkdown,children:l.jsx(up,{remarkPlugins:[dp],children:X})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Repository"}),l.jsx("div",{className:U.metaValue,children:l.jsx(Yt,{value:(E==null?void 0:E.repoUrl)||"",onSave:X=>{E&&g(E.id,{repoUrl:X})},validate:X=>{const B=X.trim();if(B&&!/^https?:\/\/.+/.test(B))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:w,onActivate:C,renderDisplay:X=>{const B=_8(X);return B?l.jsx("a",{className:U.repoLink,href:B,target:"_blank",rel:"noopener noreferrer",onClick:$=>$.stopPropagation(),children:X}):X?l.jsx("span",{children:X}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Environment"}),l.jsx("div",{className:U.metaValue,children:l.jsx(B3,{value:(E==null?void 0:E.environmentId)||"",onSave:X=>{E&&X&&g(E.id,{environmentId:X})},environments:c,fieldId:"environmentId",activeFieldId:w,onActivate:C,placeholder:"Select environment",ariaLabel:"Workspace environment","data-testid":"edit-env"})})]}),l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Persona"}),l.jsx("div",{className:U.metaValue,children:l.jsx(jc,{value:(E==null?void 0:E.defaultPersonaId)||"",onSave:X=>{E&&g(E.id,{defaultPersonaId:X})},options:[{value:"",label:"(Inherit)"},...d.map(X=>({value:X.id,label:X.name}))],fieldId:"defaultPersonaId",activeFieldId:w,onActivate:C,renderDisplay:X=>{const B=d.find($=>$.id===X);if(B)return l.jsx("span",{children:B.name})},placeholder:(E==null?void 0:E.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Worktrees"}),l.jsx("div",{className:U.metaValue,children:l.jsx(C3,{checked:(E==null?void 0:E.useWorktrees)??!0,onChange:X=>{E&&g(E.id,{useWorktrees:X})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),l.jsxs("div",{className:U.metaRow,children:[l.jsx("span",{className:U.metaLabel,children:"Working Dir"}),l.jsx("div",{className:U.metaValue,children:l.jsx(Yt,{value:(E==null?void 0:E.workingDirectory)||"",onSave:X=>{E&&g(E.id,{workingDirectory:X})},fieldId:"workingDirectory",activeFieldId:w,onActivate:C,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),E&&l.jsxs("div",{className:U.metaTimestamps,children:[l.jsxs("span",{className:U.metaTimestamp,children:["Created ",Xy(E.createdAt)]}),E.updatedAt&&E.updatedAt!==E.createdAt&&l.jsxs("span",{className:U.metaTimestamp,children:["· Updated ",Xy(E.updatedAt)]})]})]}),pe>0&&l.jsxs("div",{className:U.progressBarContainer,"data-testid":"progress-bar",children:[l.jsx("div",{className:U.progressBar,children:l.jsx("div",{className:U.progressFill,style:{width:`${oe}%`}})}),l.jsxs("span",{className:U.progressLabel,children:[ae,"/",pe]})]}),F&&F.costUsd>0&&l.jsx("div",{className:U.progressBarContainer,children:l.jsxs("span",{className:U.progressLabel,children:["Usage: ",eo(F.costUsd)," (",F.sessionCount," session",F.sessionCount!==1?"s":"",")"]})}),l.jsxs("div",{className:U.tabBar,role:"tablist","aria-label":"Workspace view",children:[l.jsx("button",{role:"tab","aria-selected":S==="graph",className:`${U.tab} ${S==="graph"?U.active:""}`,onClick:()=>T("graph"),children:"Graph"}),l.jsx("button",{role:"tab","aria-selected":S==="board",className:`${U.tab} ${S==="board"?U.active:""}`,onClick:()=>T("board"),"data-testid":"board-tab",children:"Board"}),l.jsx("button",{role:"tab","aria-selected":S==="tasks",className:`${U.tab} ${S==="tasks"?U.active:""}`,onClick:()=>T("tasks"),children:"Tasks"})]}),S==="tasks"&&pe>0&&l.jsxs("div",{className:U.workspaceSummary,children:[l.jsx("span",{className:U.workspaceSummaryTitle,children:`${ae}/${pe} tasks complete`}),l.jsx("span",{className:U.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),S==="tasks"&&pe===0&&l.jsxs("div",{className:U.emptyCta,children:[l.jsx("button",{className:U.ctaButton,onClick:()=>i(ei(n,void 0,H)),children:"Create Task"}),l.jsx("div",{className:U.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),S==="board"&&l.jsx(Q4,{workspaceId:n,environmentId:H,tasks:o,sessions:m,personas:d,environments:c}),S==="graph"&&l.jsx(J2,{workspaceId:n,environmentId:H,tasks:o,resolvedThemeId:_}),l.jsx(Ja,{isOpen:N,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{E&&(h(E.id),i("/",{replace:!0})),j(!1)},onCancel:()=>j(!1)})]})}function S8(n){const s={};return n.name.trim()||(s.name="Name is required"),n.repoUrl.trim()&&!/^https?:\/\/.+/i.test(n.repoUrl.trim())&&(s.repoUrl="Must be a valid http(s) URL"),n.environmentId||(s.environmentId="Environment is required"),Object.keys(s).length>0?s:void 0}const T8=[{label:"Home",url:Ya},{label:"New Workspace",url:void 0}];function k8(){const[n]=_p(),s=n.get("environment")??void 0,{environments:i,personas:o,createWorkspace:c,workspaceCreating:u}=pt(),{showToast:d}=dn(),m=St(),[h,g]=y.useState(()=>{var j;return uB(void 0,s||((j=i[0])==null?void 0:j.id))}),[v,b]=y.useState(),[_,S]=y.useState();y.useEffect(()=>{s||h.environmentId||i.length===0||g(j=>{var w;return j.environmentId?j:{...j,environmentId:((w=i[0])==null?void 0:w.id)??""}})},[i,s,h.environmentId]);const T=()=>{const j=S8(h);if(j){b(j),S(void 0);return}b(void 0),S(void 0),c(h.name.trim(),h.description,h.repoUrl.trim(),h.environmentId,h.defaultPersonaId,h.useWorktrees,h.workingDirectory,()=>{d("Workspace created","success"),m(Ya,{replace:!0})},w=>{S(w)})},N=()=>{m(s?Qi(s):Ya,{replace:!0})};return l.jsxs("div",{className:Oe.container,children:[l.jsxs("div",{className:Oe.header,children:[l.jsx("div",{className:Oe.headerTitle,children:l.jsx(ya,{segments:T8})}),l.jsxs("div",{className:Oe.headerActions,children:[l.jsx("button",{className:Oe.btnGhost,onClick:N,disabled:u,"data-testid":"workspace-create-cancel",children:"Cancel"}),l.jsx("button",{className:Oe.btnPrimary,onClick:T,disabled:u||!h.name.trim()||!h.environmentId,"data-testid":"workspace-create-save",children:u?l.jsx(cx,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),l.jsxs("div",{className:Oe.body,children:[l.jsx(fB,{values:h,onChange:j=>{g(j),b(void 0),S(void 0)},environments:i,personas:o,errors:v,disabled:u,autoFocusName:!0}),_&&l.jsx("div",{className:Oe.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function Qy(){const{workspaceId:n,environmentId:s}=va(),[i]=_p(),o=n??i.get("workspace")??"",c=i.get("parent")??void 0,{tasks:u,workspaces:d,personas:m,createTask:h,updateTask:g}=pt(),{showToast:v}=dn();return l.jsx(xx,{mode:"new",workspaceId:o,parentTaskId:c,environmentId:s,tasks:u,workspaces:d,personas:m,onCreateTask:h,onUpdateTask:g,onShowToast:v})}function cc(n){if(!n)return"—";const s=new Date(n);return isNaN(s.getTime())?"—":s.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function If(n,s){if(!n||!s)return;const i=new Date(s).getTime()-new Date(n).getTime();if(isNaN(i)||i<0)return;const o=Math.floor(i/6e4),c=Math.floor(i%6e4/1e3);if(o===0)return`${c}s`;const u=Math.floor(o/60),d=o%60;return u===0?`${o}m ${c}s`:`${u}h ${d}m`}function eb(n){const s=n.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?U.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?U.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?U.envDotRed:U.envDotGray}function w8({status:n}){const s=ma(n),i=qT(n);return l.jsx("span",{className:`${U.statusBadge} ${U[i]??U.statusPending}`,children:s.label})}function N8({task:n,tasksById:s,environments:i,workspaces:o,taskSessions:c,selectedEnvId:u}){const{loadUsage:d,usageCache:m}=pt(),h=c.reduce((A,M)=>A+(M.costUsd??0),0);y.useEffect(()=>{d("task",n.id),n.childTaskIds.length>0&&d("task_tree",n.id)},[n.id,n.childTaskIds.length,d,h]);const g=`task:${n.id}`,v=g in m?m[g]:void 0,b=`task_tree:${n.id}`,_=n.childTaskIds.length>0&&b in m?m[b]:void 0,S=c.length>0?c[c.length-1]:void 0,T=(S==null?void 0:S.environmentId)??"",N=T?i.find(A=>A.id===T):void 0,j=o.find(A=>A.id===n.workspaceId),w=i.find(A=>A.id===u),C=n.branch&&(j!=null&&j.repoUrl)?`${j.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(n.branch)}`:void 0;return l.jsxs("div",{className:U.overviewDashboard,children:[l.jsxs("div",{className:U.overviewHero,children:[l.jsx(w8,{status:n.status}),n.branch&&l.jsx("span",{className:U.overviewBranchPill,children:C?l.jsxs("a",{href:C,target:"_blank",rel:"noreferrer noopener",className:U.branchLink,children:["🔗"," ",n.branch]}):l.jsxs("span",{children:["🔗"," ",n.branch]})})]}),typeof n.description=="string"&&n.description&&l.jsxs("div",{className:U.overviewSection,children:[l.jsx("div",{className:U.overviewLabel,children:"Description"}),l.jsx("div",{className:U.overviewMarkdown,children:l.jsx(up,{remarkPlugins:[dp],children:n.description})})]}),n.workpad&&l.jsx(z5,{workpad:n.workpad}),l.jsxs("div",{className:U.overviewSection,children:[l.jsx("div",{className:U.overviewLabel,children:"Environment"}),T&&N?l.jsxs("div",{className:U.envRow,"data-testid":"task-overview-environment",children:[l.jsx("span",{className:`${U.envDot} ${eb(N.status)}`,title:N.status,"aria-label":`Status: ${N.status}`,role:"img"}),l.jsx("span",{className:U.overviewValue,children:N.displayName})]}):w?l.jsxs("div",{className:U.envRow,"data-testid":"task-overview-environment",children:[l.jsx("span",{className:`${U.envDot} ${eb(w.status)}`,title:w.status,"aria-label":`Status: ${w.status}`,role:"img"}),l.jsx("span",{className:U.overviewValue,children:w.displayName}),l.jsx("span",{className:U.overviewMuted,children:"(workspace default)"})]}):l.jsx("div",{className:U.overviewMuted,children:"Set in workspace settings"})]}),l.jsxs("div",{className:U.overviewSection,"data-testid":"task-overview-dependencies",children:[l.jsx("div",{className:U.overviewLabel,children:"Dependencies"}),n.dependsOn.length===0?l.jsx("div",{className:U.overviewMuted,children:"None"}):l.jsx("div",{className:U.depList,children:n.dependsOn.map(A=>{const M=s.get(A),D=(M==null?void 0:M.status)==="complete";return l.jsxs("div",{className:`${U.depItem} ${D?U.depDone:U.depBlocked}`,children:[l.jsx("span",{children:D?"✓":"○"}),l.jsx("span",{children:(M==null?void 0:M.title)??A})]},A)})})]}),l.jsxs("div",{className:U.overviewSection,children:[l.jsx("div",{className:U.overviewLabel,children:"Timeline"}),l.jsxs("div",{className:U.timeline,children:[n.createdAt&&l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Created"}),l.jsx("span",{className:U.timelineValue,children:cc(n.createdAt)})]}),n.assignedAt&&(()=>{const A=If(n.createdAt,n.assignedAt);return l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Assigned"}),l.jsx("span",{className:U.timelineValue,children:cc(n.assignedAt)}),A!==void 0&&l.jsx("span",{className:U.timelineDelta,children:A})]})})(),n.startedAt&&(()=>{const A=If(n.assignedAt??n.createdAt,n.startedAt);return l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Started"}),l.jsx("span",{className:U.timelineValue,children:cc(n.startedAt)}),A!==void 0&&l.jsx("span",{className:U.timelineDelta,children:A})]})})(),n.completedAt&&(()=>{const A=If(n.startedAt,n.completedAt);return l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Completed"}),l.jsx("span",{className:U.timelineValue,children:cc(n.completedAt)}),A!==void 0&&l.jsx("span",{className:U.timelineDelta,children:A})]})})(),!n.createdAt&&!n.assignedAt&&!n.startedAt&&!n.completedAt&&l.jsx("div",{className:U.overviewMuted,children:"No timing data"})]})]}),v&&v.costUsd>0&&l.jsxs("div",{className:U.overviewSection,children:[l.jsx("div",{className:U.overviewLabel,children:"Usage"}),l.jsxs("div",{className:U.timeline,children:[l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Cost"}),l.jsx("span",{className:U.timelineValue,children:eo(v.costUsd)}),l.jsxs("span",{className:U.timelineDelta,children:[v.sessionCount," session",v.sessionCount!==1?"s":""]})]}),_&&_.costUsd>v.costUsd&&l.jsxs("div",{className:U.timelineRow,children:[l.jsx("span",{className:U.timelineKey,children:"Total (incl. subtasks)"}),l.jsx("span",{className:U.timelineValue,children:eo(_.costUsd)}),l.jsxs("span",{className:U.timelineDelta,children:[_.sessionCount," session",_.sessionCount!==1?"s":""]})]})]})]}),n.reviewNotes&&l.jsxs("div",{className:U.overviewSection,children:[l.jsx("div",{className:U.overviewLabel,children:"Review Notes"}),l.jsx("div",{className:U.reviewNotes,children:n.reviewNotes})]})]})}function j8({task:n,sessionId:s,isBlocked:i,onStart:o,onResume:c,onStop:u,onPause:d,onDelete:m,onEdit:h}){if(n.status==="not_started")return i?l.jsxs("div",{className:U.headerActions,children:[l.jsx("button",{onClick:h,className:U.btnGhost,children:"Edit"}),l.jsx("button",{onClick:m,className:U.btnDanger,children:"Delete"})]}):l.jsxs("div",{className:U.headerActions,children:[l.jsx("button",{"data-testid":"task-header-start",onClick:o,className:U.btnPrimary,children:"Start"}),l.jsx("button",{onClick:h,className:U.btnGhost,children:"Edit"}),l.jsx("button",{onClick:m,className:U.btnDanger,children:"Delete"})]});if(n.status==="working")return l.jsxs("div",{className:U.headerActions,children:[l.jsx("button",{onClick:u,className:U.btnDanger,children:"Stop"}),l.jsx("button",{onClick:d,disabled:!s,className:U.btnGhost,children:"Pause"})]});if(n.status==="paused")return l.jsxs("div",{className:U.headerActions,children:[l.jsx("button",{onClick:u,className:U.btnPrimary,children:"Stop"}),l.jsx("button",{onClick:c,className:U.btnGhost,children:"Resume"}),l.jsx("button",{onClick:m,className:U.btnDanger,children:"Delete"})]});if(n.status==="complete")return l.jsx("div",{className:U.headerActions,children:l.jsx("button",{onClick:m,className:U.btnDanger,children:"Delete"})});if(n.status==="failed")return l.jsxs("div",{className:U.headerActions,children:[l.jsx("button",{onClick:o,className:U.btnPrimary,children:"Retry"}),l.jsx("button",{onClick:m,className:U.btnDanger,children:"Delete"})]})}function C8({taskSessions:n,selectedSessionId:s,onSelect:i}){if(!(n.length<2))return l.jsxs("div",{className:U.attemptSelector,"data-testid":"attempt-selector",children:[l.jsx("span",{className:U.attemptLabel,children:"Attempts:"}),n.map((o,c)=>{const u=o.id===s,d=o.status==="stopped"&&o.endReason==="completed"?"✓":o.status==="stopped"?"✗":o.status==="running"||o.status==="idle"?"●":"";return l.jsxs("button",{className:`${U.attemptButton} ${u?U.attemptActive:""}`,onClick:()=>i(o.id),title:`Attempt #${c+1} — ${o.status}`,"aria-label":`Attempt #${c+1}, ${o.status}`,"aria-pressed":u,"data-testid":`attempt-${c+1}`,children:["#",c+1,d&&l.jsx("span",{className:U.attemptStatus,children:d})]},o.id)})]})}function fa(){const{taskId:n,workspaceId:s,environmentId:i}=va(),o=Lt(),c=St(),{showToast:u}=dn(),{events:d,eventsDropped:m,tasks:h,sessions:g,environments:v,findings:b,loadSessionEvents:_,loadFindings:S,kill:T,startTask:N,stopTask:j,resumeTask:w,deleteTask:C,createTask:A,updateTask:M,workspaces:D,taskSessions:E,loadTaskSessions:H,sendInput:z,spawn:Z,personas:F,provisionEnvironment:Q}=pt(),ae=y.useRef(void 0),pe=y.useRef(void 0),oe=y.useRef(void 0),X=y.useRef(void 0),B=y.useRef(void 0),$=o.pathname.endsWith("/stream")?"stream":o.pathname.endsWith("/findings")?"findings":"overview",te=o.pathname.endsWith("/edit"),[re,de]=y.useState($),[$e,we]=y.useState(!1),[Se,Ie]=y.useState(void 0),[le,fe]=y.useState(""),[me,Ce]=y.useState(te),Ut=y.useRef($),Tt=y.useRef(te),I=h.find(De=>De.id===n),Ne=(I==null?void 0:I.workspaceId)||void 0,Ct=D.find(De=>De.id===Ne);y.useEffect(()=>{$!==Ut.current&&(Ut.current=$,$!==re&&de($))},[$,re]),y.useEffect(()=>{te!==Tt.current&&(Tt.current=te,te!==me&&Ce(te))},[te,me]),y.useEffect(()=>{if(le===""){if(Ct!=null&&Ct.environmentId)fe(Ct.environmentId);else if(v.length>0){const De=v.find(Je=>Je.status==="connected");fe((De==null?void 0:De.id)??v[0].id)}}},[le,Ct==null?void 0:Ct.environmentId,v]);const It=I?E[I.id]??[]:[];let it;Se&&It.some(De=>De.id===Se)?it=Se:it=(I==null?void 0:I.latestSessionId)||void 0;const Yn=()=>{we(!0)},Bs=()=>{if(!I)return;C(I.id),we(!1);const De=i??(Ct==null?void 0:Ct.environmentId);c(I.workspaceId&&De?Wi(I.workspaceId,De):"/",{replace:!0})};y.useEffect(()=>{(I==null?void 0:I.id)!==pe.current&&(pe.current=I==null?void 0:I.id,Ie(void 0),fe(""),Ce(te))},[I==null?void 0:I.id,te]),y.useEffect(()=>{if(!(I!=null&&I.id))return;const De=I.id!==X.current,Je=I.latestSessionId!==B.current;(De||Je)&&(X.current=I.id,B.current=I.latestSessionId,H(I.id))},[I==null?void 0:I.id,I==null?void 0:I.latestSessionId,H]),y.useEffect(()=>{if((I==null?void 0:I.status)!==oe.current){const De=oe.current===void 0;oe.current=I==null?void 0:I.status;const Je=(I==null?void 0:I.status)==="not_started"?"overview":(I==null?void 0:I.status)==="working"||(I==null?void 0:I.status)==="paused"?"stream":(I==null?void 0:I.status)==="complete"?"findings":void 0;Je&&Je!==re&&!(De&&$!=="overview")&&de(Je)}},[I==null?void 0:I.status,re,$]);const Tn=y.useMemo(()=>new Map(h.map(De=>[De.id,De])),[h]),zn=y.useMemo(()=>{const De=it?d.filter(Je=>Je.sessionId===it):[];return om(im(De))},[d,it]),Jn=I?I.dependsOn.some(De=>{const Je=Tn.get(De);return Je!==void 0&&Je.status!=="complete"}):!1,Ls=y.useMemo(()=>DB(n,i,D,v,Tn),[n,i,D,v,Tn]);y.useEffect(()=>{it&&it!==ae.current&&(ae.current=it,_(it))},[it,_]),y.useEffect(()=>{re==="findings"&&Ne&&S(Ne)},[re,Ne,S]);const Pn=De=>{de(De),c(os(n,De==="overview"?void 0:De,s,i))};return Ms({key:"1"},()=>Pn("overview")),Ms({key:"2"},()=>Pn("stream")),Ms({key:"3"},()=>Pn("findings")),l.jsxs("div",{className:U.panelContainer,children:[l.jsx(ya,{segments:Ls}),l.jsxs("div",{className:U.header,children:[l.jsxs("span",{className:U.headerTitle,children:[l.jsx("span",{"data-testid":"task-title",children:(I==null?void 0:I.title)||n}),I&&l.jsx("span",{className:U.taskStatusBadge,"data-testid":"task-status",children:I.status}),(I==null?void 0:I.branch)&&l.jsx("span",{className:U.taskBranch,children:I.branch}),Jn&&l.jsx("span",{className:U.taskBlockedBadge,children:"blocked"})]}),I&&l.jsx(j8,{task:I,sessionId:it,isBlocked:Jn,onStart:()=>N(I.id,void 0,le),onResume:()=>w(I.id),onStop:()=>j(I.id),onPause:()=>it&&T(it),onDelete:Yn,onEdit:()=>Ce(!0)})]}),l.jsxs("div",{className:U.tabBar,role:"tablist","aria-label":"Task view",children:[l.jsx("button",{role:"tab","aria-selected":re==="overview",className:`${U.tab} ${re==="overview"?U.active:""}`,onClick:()=>Pn("overview"),children:"Overview"}),l.jsx("button",{role:"tab","aria-selected":re==="stream",className:`${U.tab} ${re==="stream"?U.active:""}`,onClick:()=>Pn("stream"),children:"Stream"}),l.jsx("button",{role:"tab","aria-selected":re==="findings",className:`${U.tab} ${re==="findings"?U.active:""}`,onClick:()=>Pn("findings"),children:"Findings"})]}),l.jsxs(rs,{mode:"wait",children:[re==="overview"&&l.jsx(Ot.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:U.overviewContent,"data-testid":"task-overview",children:me&&I?l.jsx(xx,{mode:"edit",taskId:I.id,workspaceId:Ne,environmentId:i,tasks:h,workspaces:D,personas:F,onCreateTask:A,onUpdateTask:M,onEditDone:()=>{te?c(os(I.id,void 0,s,i),{replace:!0}):Ce(!1)},onShowToast:u}):I?l.jsx(N8,{task:I,tasksById:Tn,environments:v,workspaces:D,taskSessions:It,selectedEnvId:le}):l.jsx("div",{className:U.waitingMessage,children:"No additional details"})},"overview"),re==="stream"&&l.jsxs(Ot.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:[l.jsx(C8,{taskSessions:It,selectedSessionId:it,onSelect:De=>Ie(De)}),l.jsx(nm,{events:zn,eventsDropped:m,emptyState:!it&&I?Jn?l.jsx("div",{className:U.emptyCta,"data-testid":"stream-blocked-message",children:l.jsx("div",{className:U.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):l.jsxs("div",{className:U.emptyCta,children:[l.jsx("button",{"data-testid":"stream-start-cta",className:U.ctaButton,onClick:()=>N(I.id,void 0,le),children:"Start Task"}),l.jsx("div",{className:U.ctaDescription,children:"Click to begin agent execution"})]}):it&&zn.length===0?l.jsx("div",{className:U.waitingMessage,children:"Waiting for events..."}):void 0})]},"stream"),re==="findings"&&l.jsx(Ot.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:U.tabContent,children:Ne?l.jsx(WO,{findings:b.filter(De=>De.workspaceId===Ne)}):l.jsx("div",{className:U.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!I||I.status!=="working"&&I.status!=="paused")return;const De=it?g.find(Je=>Je.id===it):void 0;if(!(!De||De.status==="stopped"))return l.jsx(_r,{mode:"send",sessionId:De.id,environmentId:De.environmentId,personas:F,environments:v,onSendInput:z,onSpawn:Z,onStartTask:N,onProvisionEnvironment:Q,onShowToast:u})})(),I&&l.jsx(Ja,{isOpen:$e,title:"Delete Task?",description:`"${I.title}" will be permanently removed.`,onConfirm:Bs,onCancel:()=>we(!1)})]})}function E8(){const{environments:n,addEnvironment:s,updateEnvironment:i,listCodespaces:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:m,createCodespace:h}=pt(),{showToast:g}=dn();return l.jsx(Sx,{mode:"new",environments:n,onAddEnvironment:s,onUpdateEnvironment:i,onListCodespaces:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:m,onCreateCodespace:h,onShowToast:g})}function A8(){const{environmentId:n}=va(),{environments:s,addEnvironment:i,updateEnvironment:o,listCodespaces:c,codespaces:u,codespaceError:d,codespaceListError:m,codespaceCreating:h,createCodespace:g}=pt(),{showToast:v}=dn();return l.jsx(Sx,{mode:"edit",environmentId:n,environments:s,onAddEnvironment:i,onUpdateEnvironment:o,onListCodespaces:c,codespaces:u,codespaceError:d,codespaceListError:m,codespaceCreating:h,onCreateCodespace:g,onShowToast:v})}const D8="_layout_11u79_1",R8="_content_11u79_8",M8="_tabPanel_11u79_14",br={layout:D8,content:R8,tabPanel:M8};function O8(){const n=jB();return l.jsxs("div",{className:br.layout,children:[l.jsx(ya,{segments:n}),l.jsx("div",{className:br.content,children:l.jsx(Qa,{})})]})}const I8="_container_13sb6_1",B8="_envHeader_13sb6_6",L8="_envTitleRow_13sb6_10",U8="_statusDot_13sb6_16",z8="_envName_13sb6_21",P8="_statusBadge_13sb6_27",V8="_envMeta_13sb6_33",H8="_metaTag_13sb6_39",q8="_actions_13sb6_51",G8="_provisionMessage_13sb6_59",$8="_errorMessage_13sb6_64",F8="_section_13sb6_69",Z8="_sectionHeader_13sb6_73",K8="_cardList_13sb6_121",Y8="_card_13sb6_121",J8="_cardHeader_13sb6_138",W8="_cardName_13sb6_144",X8="_cardActions_13sb6_149",Q8="_cardDescription_13sb6_154",eU="_cardMeta_13sb6_160",tU="_repoLink_13sb6_166",nU="_empty_13sb6_174",sU="_btnPrimary_13sb6_180",aU="_btnOutline_13sb6_214",iU="_btnSmall_13sb6_241",oU="_btnDanger_13sb6_267",qe={container:I8,envHeader:B8,envTitleRow:L8,statusDot:U8,envName:z8,statusBadge:P8,envMeta:V8,metaTag:H8,actions:q8,provisionMessage:G8,errorMessage:$8,section:F8,sectionHeader:Z8,cardList:K8,card:Y8,cardHeader:J8,cardName:W8,cardActions:X8,cardDescription:Q8,cardMeta:eU,repoLink:tU,empty:nU,btnPrimary:sU,btnOutline:aU,btnSmall:iU,btnDanger:oU},rU={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function lU(){const{environmentId:n}=va(),s=St(),{environments:i,workspaces:o,sessions:c,provisionStatus:u,provisionEnvironment:d,stopEnvironment:m,removeEnvironment:h,archiveWorkspace:g}=pt(),[v,b]=y.useState(!1),[_,S]=y.useState(!1),[T,N]=y.useState(void 0),j=i.find(ae=>ae.id===n);if(!n||!j)return l.jsx(Kn,{to:Xi,replace:!0});const w=o.filter(ae=>ae.environmentId===j.id),C=c.filter(ae=>ae.environmentId===j.id),A=C.reduce((ae,pe)=>ae+(pe.costUsd??0),0),M=rU[j.status]||"var(--text-tertiary)",D=j.status==="connected",E=j.status==="connecting",H=j.status==="disconnected"||j.status==="error",z=j.id in u?u[j.id]:void 0,Z=()=>{h(j.id),b(!1),s(Xi,{replace:!0})},F=()=>{S(!1),d(j.id,!0)},Q=ae=>{g(ae),N(void 0)};return l.jsxs("div",{className:qe.container,children:[l.jsx(Ja,{isOpen:v,title:"Delete Environment?",description:`"${j.displayName||j.id}" will be permanently removed along with all its data.`,onConfirm:Z,onCancel:()=>b(!1)}),l.jsx(Ja,{isOpen:_,title:"Reprovision Environment?",description:"This will kill any active session and force a fresh provision cycle. The environment will be temporarily disconnected.",confirmLabel:"Reprovision",onConfirm:F,onCancel:()=>S(!1)}),l.jsxs("div",{className:qe.envHeader,children:[l.jsxs("div",{className:qe.envTitleRow,children:[l.jsx("span",{className:qe.statusDot,style:{color:M},children:"●"}),l.jsx("h2",{className:qe.envName,children:j.displayName||j.id}),l.jsx("span",{className:qe.statusBadge,style:{color:M},children:j.status})]}),l.jsxs("div",{className:qe.envMeta,children:[l.jsxs("span",{className:qe.metaTag,children:["Adapter: ",j.adapterType]}),C.length>0&&l.jsxs("span",{className:qe.metaTag,children:[C.length," session",C.length!==1?"s":""]}),A>0&&l.jsxs("span",{className:qe.metaTag,children:["Cost: ",eo(A)]})]})]}),l.jsxs("div",{className:qe.actions,children:[D&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:qe.btnPrimary,onClick:()=>s(Cb(j.id)),children:"New Chat"}),l.jsx("button",{className:qe.btnOutline,onClick:()=>m(j.id),children:"Stop"}),l.jsx("button",{className:qe.btnOutline,onClick:()=>S(!0),disabled:z!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),H&&l.jsx("button",{className:qe.btnPrimary,onClick:()=>d(j.id),children:j.status==="error"?"Retry":"Connect"}),E&&z!==void 0&&l.jsx("span",{className:qe.provisionMessage,children:z.message}),j.status==="error"&&(z==null?void 0:z.stage)==="error"&&l.jsx("span",{className:qe.errorMessage,children:z.message}),l.jsx("button",{className:qe.btnOutline,onClick:()=>s(V2(j.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),l.jsx("button",{className:qe.btnDanger,onClick:()=>b(!0),children:"Delete"})]}),l.jsxs("div",{className:qe.section,children:[l.jsxs("div",{className:qe.sectionHeader,children:[l.jsx("h3",{children:"Workspaces"}),l.jsx("button",{className:qe.btnPrimary,onClick:()=>s(`${Ab}?environment=${encodeURIComponent(j.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"})]}),w.length===0&&l.jsx("p",{className:qe.empty,children:"No workspaces yet. Create one to get started."}),l.jsx("div",{className:qe.cardList,children:w.map(ae=>l.jsx(cU,{workspace:ae,confirmArchiveId:T,onOpen:()=>s(Wi(ae.id,j.id)),onArchive:()=>N(ae.id),onConfirmArchive:()=>Q(ae.id),onCancelArchive:()=>N(void 0)},ae.id))})]})]})}function cU({workspace:n,confirmArchiveId:s,onOpen:i,onArchive:o,onConfirmArchive:c,onCancelArchive:u}){const d=s===n.id,m=n.repoUrl&&/^https?:\/\//.test(n.repoUrl);return l.jsxs("div",{className:qe.card,"data-testid":"workspace-card",children:[l.jsxs("div",{className:qe.cardHeader,children:[l.jsx("strong",{className:qe.cardName,children:n.name}),l.jsxs("div",{className:qe.cardActions,children:[l.jsx("button",{className:qe.btnSmall,onClick:i,children:"Open"}),d?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:qe.btnDanger,onClick:c,children:"Confirm"}),l.jsx("button",{className:qe.btnSmall,onClick:u,children:"Cancel"})]}):l.jsx("button",{className:qe.btnSmall,onClick:o,children:"Archive"})]})]}),n.description&&l.jsx("p",{className:qe.cardDescription,children:n.description}),n.repoUrl&&l.jsx("div",{className:qe.cardMeta,children:m?l.jsx("a",{href:n.repoUrl,target:"_blank",rel:"noopener noreferrer",className:qe.repoLink,children:n.repoUrl}):l.jsx("span",{children:n.repoUrl})})]})}const uU={credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function dU(){const s=Lt().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=uU[s],o=NB(i);return l.jsxs("div",{className:br.layout,children:[l.jsx(ya,{segments:o}),l.jsx("div",{className:br.content,children:l.jsx("div",{className:br.tabPanel,children:l.jsx(Qa,{})},s)})]})}function fU(){const{tokens:n,setToken:s,deleteToken:i,credentialProviders:o,updateCredentialProviders:c}=pt(),{showToast:u}=dn();return l.jsxs(l.Fragment,{children:[l.jsx(V5,{credentialProviders:o,onUpdateCredentialProviders:c}),l.jsx(II,{tokens:n,onSetToken:s,onDeleteToken:i,onShowToast:u})]})}function pU(){const{personas:n,deletePersona:s,appDefaultPersonaId:i,setAppDefaultPersonaId:o}=pt(),{showToast:c}=dn(),u=St();return l.jsx(o4,{personas:n,appDefaultPersonaId:i,onDeletePersona:async d=>{try{await s(d)}catch(m){throw console.error("Failed to delete persona",{personaId:d,error:m}),c("Failed to delete persona","error"),m}},onSetAppDefaultPersonaId:async d=>{try{await o(d)}catch(m){console.error("Failed to set app default persona ID",{personaId:d,error:m}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>u(q2),onNavigateToPersona:d=>u(Eb(d))})}const tb=[{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)"}],nb=[{value:"genaiscript",label:"genaiscript"}],mU="0";function sb(){const{personaId:n}=va(),s=St(),{showToast:i}=dn(),{personas:o,createPersona:c,updatePersona:u,deletePersona:d,appDefaultPersonaId:m,setAppDefaultPersonaId:h}=pt(),g=n===void 0,v=g?void 0:o.find(_=>_.id===n);if(!g&&o.length>0&&!v)return l.jsx(Kn,{to:af,replace:!0});const b=[{label:"Settings",url:Ji},{label:"Personas",url:af},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return l.jsxs("div",{className:gt.container,children:[l.jsx(ya,{segments:b}),l.jsx(hU,{existing:v,isNew:g,appDefaultPersonaId:m,onCreatePersona:c,onUpdatePersona:u,onDeletePersona:d,onSetAppDefaultPersonaId:h,onDone:()=>{s(af)},showToast:i})]})}function hU({existing:n,isNew:s,appDefaultPersonaId:i,onCreatePersona:o,onUpdatePersona:c,onDeletePersona:u,onSetAppDefaultPersonaId:d,onDone:m,showToast:h}){const g=St(),[v,b]=y.useState((n==null?void 0:n.name)??""),[_,S]=y.useState((n==null?void 0:n.description)??""),[T,N]=y.useState((n==null?void 0:n.systemPrompt)??""),[j,w]=y.useState((n==null?void 0:n.runtime)??"claude-code"),[C,A]=y.useState((n==null?void 0:n.model)??"sonnet"),[M,D]=y.useState((n==null?void 0:n.maxTurns)??0),[E,H]=y.useState((n==null?void 0:n.type)==="script"?"script":"agent"),[z,Z]=y.useState((n==null?void 0:n.script)??""),[F,Q]=y.useState((n==null?void 0:n.allowedMcpTools)??[]),[ae,pe]=y.useState(!1),[oe,X]=y.useState(null),[B,$]=y.useState(!!s);y.useEffect(()=>{if(!s&&n&&!B){$(!0),b(n.name),S(n.description),N(n.systemPrompt);const I=n.type==="script"?"script":"agent";w(I==="script"?n.runtime||"genaiscript":n.runtime),A(n.model),D(n.maxTurns),H(I),Z(n.script||""),Q(n.allowedMcpTools)}},[s,n,B]);const te=I=>{H(I),I==="script"?w("genaiscript"):j==="genaiscript"&&w("claude-code")},re=!s&&n===void 0,de=v.trim().length>0&&!re&&T.trim().length>0&&(E==="script"?z.trim().length>0:!!j&&!!C),$e=s&&de,we=!s&&i===(n==null?void 0:n.id),Se=!s&&n&&!we&&E==="agent"&&!!j&&!!C,Ie=(I,Ne)=>{if(!I.trim())return`${Ne} is required`},le=I=>{if(I.preventDefault(),!(re||!de)){if(n){c(n.id,v,_,T,j,C,M,E,z).then(()=>{h("Persona updated","success"),m()},()=>{h("Failed to save persona","error")});return}o(v,_,T,j,C,M,E,z,F).then(Ne=>{h("Persona created","success"),g(Eb(Ne.id),{replace:!0})},()=>{h("Failed to save persona","error")})}},fe=()=>{n&&u(n.id).then(()=>{h("Persona deleted","success"),m()},()=>{h("Failed to delete persona","error")})},me=async(I,Ne,Ct,It)=>I().then(()=>{Ne(),h(Ct,"success")},()=>{h(It,"error")}),Ce=(I,Ne)=>{if(!n)return;const Ct=I==="type"?String(Ne):E,It=I==="runtime"?String(Ne):I==="type"?String(Ne)==="script"?"genaiscript":j==="genaiscript"?"claude-code":j:j,it=I==="model"?String(Ne):C,Yn=I==="maxTurns"?Number(Ne):M,Bs=I==="systemPrompt"?String(Ne):T,Tn=I==="script"?String(Ne):z;me(()=>c(n.id,I==="name"?String(Ne):v,I==="description"?String(Ne):_,Bs,It,it,Yn,Ct,Tn),()=>{if(I==="type"){const zn=String(Ne)==="script"?"script":"agent";H(zn),w(It)}I==="runtime"&&w(String(Ne)),I==="name"&&b(String(Ne)),I==="description"&&S(String(Ne)),I==="systemPrompt"&&N(String(Ne)),I==="model"&&A(String(Ne)),I==="maxTurns"&&D(Number(Ne)),I==="script"&&Z(String(Ne))},"Persona updated","Failed to update persona").catch(()=>{})},Ut=I=>{le(I)},Tt=()=>{n&&d(n.id).then(()=>{h("Set as app default","success")},()=>{h("Failed to set app default","error")})};return l.jsxs(l.Fragment,{children:[re?l.jsxs("div",{className:gt.form,children:[l.jsx("h3",{children:"Edit Persona"}),l.jsx("p",{children:"Loading persona..."})]}):s?l.jsxs("form",{onSubmit:Ut,className:gt.form,children:[l.jsx("h3",{children:"Create Persona"}),l.jsxs("div",{className:gt.typeToggle,"data-testid":"persona-type-toggle",children:[l.jsxs("label",{children:[l.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:E==="agent",onChange:()=>te("agent")}),"Agent"]}),l.jsxs("label",{children:[l.jsx("input",{type:"radio",name:"personaType",value:"script",checked:E==="script",onChange:()=>te("script")}),"Script"]})]}),l.jsxs("label",{children:["Name",l.jsx("input",{type:"text",value:v,onChange:I=>b(I.target.value),placeholder:E==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),l.jsxs("label",{children:["Description",l.jsx("input",{type:"text",value:_,onChange:I=>S(I.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),l.jsxs("label",{children:["Runtime",l.jsx("select",{value:j,onChange:I=>w(I.target.value),"data-testid":"persona-runtime-select",children:(E==="script"?nb:tb).map(I=>l.jsx("option",{value:I.value,children:I.label},I.value))})]}),E==="agent"&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{children:["Model",l.jsx("input",{type:"text",value:C,onChange:I=>A(I.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),l.jsxs("label",{children:["Max Turns",l.jsx("input",{type:"number",value:M,onChange:I=>D(parseInt(I.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),l.jsxs("label",{children:["System Prompt",l.jsx("textarea",{value:T,onChange:I=>N(I.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),E==="script"&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{children:["Model ",l.jsx("span",{className:gt.optional,children:"(optional)"}),l.jsx("input",{type:"text",value:C,onChange:I=>A(I.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),l.jsxs("label",{children:["System Prompt",l.jsx("textarea",{value:T,onChange:I=>N(I.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),l.jsxs("label",{children:["Script",l.jsx("textarea",{value:z,onChange:I=>Z(I.target.value),placeholder:`script({ model: "openai:gpt-4o" });
|
|
490
490
|
|
|
491
491
|
const grackle = await host.mcpServer({
|
|
492
492
|
id: "grackle",
|
|
493
493
|
url: env.vars.GRACKLE_MCP_URL,
|
|
494
494
|
});
|
|
495
495
|
|
|
496
|
-
$\`Summarize the current tasks.\`;`,rows:20,className:gt.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),E==="agent"&&l.jsxs("div",{children:[l.jsx("label",{children:"Allowed MCP Tools"}),l.jsx(
|
|
496
|
+
$\`Summarize the current tasks.\`;`,rows:20,className:gt.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),E==="agent"&&l.jsxs("div",{children:[l.jsx("label",{children:"Allowed MCP Tools"}),l.jsx(qy,{selectedTools:F,onChange:Q})]}),l.jsxs("div",{className:gt.formActions,children:[l.jsx(As,{type:"submit",variant:"primary",size:"md",disabled:!$e,"data-testid":"persona-detail-save",children:"Create"}),l.jsx(As,{type:"button",variant:"outline",size:"md",onClick:m,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):n?l.jsxs("div",{className:gt.form,children:[l.jsx("h3",{children:"Edit Persona"}),l.jsxs("div",{className:gt.formActions,children:[l.jsx(As,{type:"button",variant:"outline",size:"md",onClick:m,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),Se&&l.jsx(As,{type:"button",variant:"ghost",size:"md",onClick:Tt,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),we&&l.jsx("span",{className:gt.defaultBadge,children:"App Default"}),l.jsx(As,{type:"button",variant:"danger",size:"md",onClick:()=>pe(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),l.jsxs("div",{className:gt.editableSection,children:[l.jsxs("label",{children:["Name",l.jsx(Yt,{value:v,onSave:I=>{Ce("name",I)},validate:I=>Ie(I,"Name"),fieldId:"persona-name",activeFieldId:oe,onActivate:X,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),l.jsxs("label",{children:["Description",l.jsx(Yt,{value:_,onSave:I=>{Ce("description",I)},fieldId:"persona-description",activeFieldId:oe,onActivate:X,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),l.jsxs("label",{children:["Type",l.jsx(jc,{value:E,onSave:I=>{Ce("type",I)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:oe,onActivate:X,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),l.jsxs("label",{children:["Runtime",l.jsx(jc,{value:j,onSave:I=>{Ce("runtime",I)},options:E==="script"?nb:tb,fieldId:"persona-runtime",activeFieldId:oe,onActivate:X,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),l.jsxs("label",{children:["Model",E==="script"?" (optional)":"",l.jsx(Yt,{value:C,onSave:I=>{Ce("model",I)},validate:E==="agent"?I=>Ie(I,"Model"):void 0,fieldId:"persona-model",activeFieldId:oe,onActivate:X,placeholder:E==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),l.jsxs("label",{children:["Max Turns",l.jsx(Yt,{value:String(M),onSave:I=>{Ce("maxTurns",parseInt(I,10)||0)},validate:I=>/^\d+$/.test(I.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:oe,onActivate:X,placeholder:mU,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),l.jsxs("label",{children:["System Prompt",l.jsx(ap,{value:T,onSave:I=>{Ce("systemPrompt",I)},validate:I=>Ie(I,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:oe,onActivate:X,placeholder:E==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),E==="script"&&l.jsxs("label",{children:["Script",l.jsx(ap,{value:z,onSave:I=>{Ce("script",I)},validate:I=>Ie(I,"Script"),fieldId:"persona-script",activeFieldId:oe,onActivate:X,placeholder:`script({ model: "openai:gpt-4o" });
|
|
497
497
|
|
|
498
498
|
const grackle = await host.mcpServer({
|
|
499
499
|
id: "grackle",
|
|
500
500
|
url: env.vars.GRACKLE_MCP_URL,
|
|
501
501
|
});
|
|
502
502
|
|
|
503
|
-
$\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),E==="agent"&&l.jsxs("div",{children:[l.jsx("label",{children:"Allowed MCP Tools"}),l.jsx(eb,{selectedTools:F,onChange:I=>{Q(I);const Ne=I.length===0?["__clear__"]:I;me(()=>c(n.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Ne),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Se&&!we&&l.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,l.jsx(Ja,{isOpen:ae,title:"Delete Persona?",description:`"${n==null?void 0:n.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:fe,onCancel:()=>pe(!1)})]})}function lU({themeId:n,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c}){return l.jsxs("section",{className:he.section,children:[l.jsx("h3",{className:he.sectionTitle,children:"Appearance"}),l.jsx("p",{className:he.sectionDescription,children:"Choose how Grackle looks across the app."}),l.jsx("div",{className:he.themeOptions,children:Oc.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),m=d?n===u.id||n===u.variantLightId||n===u.variantDarkId:n===u.id,h=d&&s===u.variantLightId;return l.jsxs("button",{type:"button",className:`${he.themeOption} ${m?he.themeOptionSelected:""}`,"aria-pressed":m,onClick:()=>i(u.id),children:[l.jsxs("span",{className:he.themeOptionHeader,children:[l.jsxs("span",{children:[l.jsx("span",{className:he.themeOptionLabel,children:u.label}),l.jsx("span",{className:he.themeOptionDesc,children:u.description})]}),d&&l.jsxs("span",{className:he.variantToggle,children:[l.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&h?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantLightId))},"aria-label":"Light variant","aria-pressed":m&&h,children:"☼"}),l.jsx("span",{role:"button",tabIndex:0,className:`${he.variantButton} ${m&&!h?he.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantDarkId))},"aria-label":"Dark variant","aria-pressed":m&&!h,children:"☾"})]})]}),u.swatches&&l.jsx("span",{className:he.themeSwatches,children:u.swatches.map((g,v)=>l.jsx("span",{className:he.themeSwatch,style:{background:g}},v))})]},u.id)})}),l.jsxs("label",{className:he.systemToggle,children:[l.jsx("input",{type:"checkbox",checked:o,onChange:u=>c(u.target.checked)}),l.jsx("span",{children:"Match system light/dark preference"})]}),l.jsx("p",{className:he.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),l.jsxs("p",{className:he.themeActive,children:["Active theme: ",l.jsx("strong",{children:s})]})]})}function cU(){const{themeId:n,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=Hb();return l.jsx(lU,{themeId:n,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c})}function uU({connected:n,environments:s,sessions:i}){const o=s.filter(d=>d.status==="connected").length,c=s.length,u=i.filter(d=>["running","idle"].includes(d.status)).length;return l.jsxs("section",{className:he.section,"data-testid":"about-panel",children:[l.jsx("h3",{className:he.sectionTitle,children:"About"}),l.jsx("p",{className:he.sectionDescription,children:"Connection status and application information."}),l.jsxs("div",{className:he.aboutGrid,children:[l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Connection"}),l.jsxs("span",{className:he.aboutValue,children:[l.jsx("span",{className:`${he.aboutDot} ${n?he.aboutDotConnected:he.aboutDotDisconnected}`}),n?"Connected":"Disconnected"]})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Environments"}),l.jsxs("span",{className:he.aboutValue,children:[o,"/",c," connected"]})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Active Sessions"}),l.jsx("span",{className:he.aboutValue,children:u})]}),l.jsxs("div",{className:he.aboutItem,children:[l.jsx("span",{className:he.aboutLabel,children:"Version"}),l.jsx("span",{className:he.aboutValue,children:"0.85.0"})]})]})]})}function dU({currentVersion:n,latestVersion:s,updateAvailable:i,isDocker:o}){if(!i)return l.jsx(l.Fragment,{});const c=o?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return l.jsx("div",{"data-testid":"update-banner",children:l.jsxs(ZD,{variant:"info",dismissible:!0,children:[l.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",n,")."," ","Run: ",l.jsx("code",{children:c})]})})}function fU(){const[n,s]=y.useState(void 0);return y.useEffect(()=>{let i=!1;return ke.getVersionStatus({}).then(o=>{i||s({currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker})},()=>{}),()=>{i=!0}},[]),n}function pU(){const{connected:n,environments:s,sessions:i}=pt(),o=fU();return l.jsxs(l.Fragment,{children:[o&&l.jsx(dU,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),l.jsx(uU,{connected:n,environments:s,sessions:i})]})}const mU="_group_1iprv_1",hU="_groupTitle_1iprv_8",gU="_shortcutList_1iprv_17",vU="_shortcutRow_1iprv_23",yU="_keys_1iprv_36",bU="_kbd_1iprv_43",_U="_description_1iprv_60",qa={group:mU,groupTitle:hU,shortcutList:gU,shortcutRow:vU,keys:yU,kbd:bU,description:_U},xU=[{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 SU(){return l.jsxs("section",{className:he.section,"data-testid":"keyboard-shortcuts-panel",children:[l.jsx("h3",{className:he.sectionTitle,children:"Keyboard Shortcuts"}),l.jsx("p",{className:he.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),xU.map(n=>l.jsxs("div",{className:qa.group,children:[l.jsx("h4",{className:qa.groupTitle,children:n.title}),l.jsx("div",{className:qa.shortcutList,children:n.shortcuts.map(s=>l.jsxs("div",{className:qa.shortcutRow,children:[l.jsx("span",{className:qa.keys,children:s.keys.map(i=>l.jsx("kbd",{className:qa.kbd,children:i},i))}),l.jsx("span",{className:qa.description,children:s.description})]},s.description))})]},n.title))]})}function TU(){return l.jsx(SU,{})}const ab=ei();function kU(){const n=St();return Ms({key:"?"},()=>{n(u2)}),Ms({key:"n"},()=>{n(ab)}),Ms({key:"N"},()=>{n(ab)}),l.jsx(l.Fragment,{})}const wU="_wizard_1260s_1",NU="_container_1260s_10",jU="_stepContent_1260s_19",CU="_logoArea_1260s_28",EU="_logoImage_1260s_32",AU="_heading_1260s_41",DU="_tagline_1260s_49",RU="_subtitle_1260s_56",MU="_featureList_1260s_64",OU="_runtimeGrid_1260s_89",IU="_runtimeCard_1260s_101",BU="_runtimeName_1260s_133",LU="_runtimeDescription_1260s_139",UU="_buttonRow_1260s_144",zU="_primaryButton_1260s_151",PU="_ghostButton_1260s_185",VU="_dots_1260s_213",HU="_dot_1260s_213",rt={wizard:wU,container:NU,stepContent:jU,logoArea:CU,logoImage:EU,heading:AU,tagline:DU,subtitle:RU,featureList:MU,runtimeGrid:OU,runtimeCard:IU,runtimeName:BU,runtimeDescription:LU,buttonRow:UU,primaryButton:zU,ghostButton:PU,dots:VU,dot:HU};function qU({onNext:n}){return l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-welcome",children:[l.jsx("div",{className:rt.logoArea,children:l.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:rt.logoImage})}),l.jsx("h1",{className:rt.heading,children:"Welcome to Grackle"}),l.jsx("p",{className:rt.tagline,children:"Multi-agent orchestration for software teams"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:n,"data-testid":"setup-get-started",children:"Get Started"})]})}function GU({onNext:n,onBack:s}){return l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-about",children:[l.jsx("h2",{className:rt.heading,children:"What is Grackle?"}),l.jsxs("ul",{className:rt.featureList,children:[l.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),l.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),l.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),l.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),l.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),l.jsxs("div",{className:rt.buttonRow,children:[l.jsx("button",{type:"button",className:rt.ghostButton,onClick:s,children:"Back"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:n,"data-testid":"setup-about-next",children:"Next"})]})]})}const $U=[{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 FU({currentRuntime:n,onFinish:s,onBack:i,finishDisabled:o}){const[c,u]=y.useState(n||"claude-code");return y.useEffect(()=>{n&&u(n)},[n]),l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-runtime",children:[l.jsx("h2",{className:rt.heading,children:"Choose Your Runtime"}),l.jsx("p",{className:rt.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),l.jsx("div",{className:rt.runtimeGrid,children:$U.map(d=>l.jsxs("button",{type:"button",className:rt.runtimeCard,"data-selected":c===d.id,"aria-pressed":c===d.id,"data-testid":`runtime-card-${d.id}`,onClick:()=>u(d.id),children:[l.jsx("span",{className:rt.runtimeName,children:d.name}),l.jsx("span",{className:rt.runtimeDescription,children:d.description})]},d.id))}),l.jsxs("div",{className:rt.buttonRow,children:[l.jsx("button",{type:"button",className:rt.ghostButton,onClick:i,children:"Back"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:()=>{s(c)},disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const ZU=3,ib={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function KU(){const{personas:n,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=pt(),{showToast:c}=dn(),u=St(),[d,m]=y.useState(0),[h,g]=y.useState(!1),v=n.find(_=>_.id==="claude-code"),b=y.useCallback(_=>{g(!0);const S=[];if(v&&_!==v.runtime){const N=ib[_]??"sonnet";S.push(s(v.id,void 0,void 0,void 0,_,N))}const T=n.find(N=>N.id===n0);if(T&&_!==T.runtime){const N=ib[_]??"sonnet";S.push(s(n0,void 0,void 0,void 0,_,N))}Promise.all(S).then(()=>i()).then(()=>{u("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),g(!1)})},[v,n,s,i,u,c]);return o===!0?l.jsx(Kn,{to:"/",replace:!0}):l.jsx("div",{className:rt.wizard,"data-testid":"setup-wizard",children:l.jsxs("div",{className:rt.container,children:[l.jsx(rs,{mode:"wait",children:l.jsxs(Ot.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[d===0&&l.jsx(qU,{onNext:()=>m(1)}),d===1&&l.jsx(GU,{onNext:()=>m(2),onBack:()=>m(0)}),d===2&&l.jsx(FU,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:b,onBack:()=>m(1),finishDisabled:!v||h})]},d)}),l.jsx("div",{className:rt.dots,children:Array.from({length:ZU},(_,S)=>l.jsx("span",{className:rt.dot,"data-active":S===d},S))})]})})}const YU="_root_zndgp_1",JU="_body_zndgp_7",WU="_main_zndgp_19",XU="_sidebarWrapper_zndgp_26",QU="_overlay_zndgp_51",pr={root:YU,body:JU,main:WU,sidebarWrapper:XU,overlay:QU},ez=y.lazy(()=>wT(()=>import("./KnowledgePage-4d_6DFDB.js"),__vite__mapDeps([0,1,2,3,4])).then(n=>({default:n.KnowledgePage}))),Lx=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function tz(){const{connected:n,environments:s,sessions:i,tasks:o}=pt(),{toasts:c,dismissToast:u}=dn(),d=Lt(),m=jw(),h=m!==void 0,[g,v]=y.useState(!1),b=y.useCallback(()=>v(_=>!_),[]);return y.useEffect(()=>{v(!1)},[d.pathname]),y.useEffect(()=>{if(!g)return;const _=S=>{S.key==="Escape"&&v(!1)};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[g]),l.jsxs(l.Fragment,{children:[l.jsx(fw,{connected:n,environments:s,sessions:i,onToggleSidebar:h?b:void 0,sidebarOpen:g}),l.jsx(bw,{}),l.jsxs("div",{className:pr.body,children:[h&&l.jsx("div",{className:pr.sidebarWrapper,"data-sidebar-open":g,children:l.jsx(ww,{content:m})}),h&&g&&l.jsx("div",{className:pr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),l.jsxs("div",{className:pr.main,children:[l.jsx(Qa,{}),l.jsx(kD,{sessions:i,tasks:o,environments:s})]})]}),l.jsx(LD,{toasts:c,onDismiss:u}),l.jsx(kU,{})]})}function nz(){const{lastSpawnedId:n,environments:s,tasks:i,connected:o,onboardingCompleted:c}=pt(),{showToast:u}=dn();$3(s,u),Y3(i,u);const d=St(),m=Lt();return y.useEffect(()=>{n&&!m.pathname.includes("/tasks/")&&d(jb(n),{replace:!0})},[n,d,m.pathname]),o&&c===!1?l.jsx(Kn,{to:"/setup",replace:!0}):l.jsx(Nw,{children:l.jsxs("div",{className:pr.root,children:[Lx&&l.jsx(gR,{}),l.jsx(tz,{})]})})}function Bf(){const{workspaceId:n}=va(),{workspaces:s}=pt(),i=Lt(),o=s.find(h=>h.id===n);if(!(o!=null&&o.environmentId))return s.length===0?void 0:l.jsx(Kn,{to:"/environments",replace:!0});const c=encodeURIComponent(n),u=`/workspaces/${c}`,d=i.pathname.startsWith(u)?i.pathname.slice(u.length):"",m=`/environments/${encodeURIComponent(o.environmentId)}/workspaces/${c}${d}${i.search}${i.hash}`;return l.jsx(Kn,{to:m,replace:!0})}function sz(){return l.jsxs(wk,{children:[l.jsx(je,{path:"setup",element:l.jsx(KU,{})}),l.jsxs(je,{element:l.jsx(nz,{}),children:[l.jsx(je,{index:!0,element:l.jsx(SI,{})}),l.jsx(je,{path:"chat",element:l.jsx(XI,{})}),l.jsx(je,{path:"sessions/new",element:l.jsx(o5,{})}),l.jsx(je,{path:"sessions/:sessionId",element:l.jsx(c5,{})}),l.jsx(je,{element:l.jsx(gD,{}),children:l.jsx(je,{path:"knowledge",element:l.jsx(y.Suspense,{fallback:l.jsx(Ax,{}),children:l.jsx(ez,{})})})}),l.jsxs(je,{element:l.jsx(pD,{}),children:[l.jsx(je,{path:"tasks",element:l.jsx(_I,{})}),l.jsx(je,{path:"tasks/new",element:l.jsx(Wy,{})}),l.jsx(je,{path:"tasks/:taskId",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/edit",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/stream",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/findings",element:l.jsx(fa,{})})]}),l.jsxs(je,{element:l.jsx(mD,{}),children:[l.jsx(je,{path:"workspaces",element:l.jsx(Kn,{to:"/environments",replace:!0})}),l.jsx(je,{path:"workspaces/new",element:l.jsx(dB,{})}),l.jsx(je,{path:"workspaces/:workspaceId",element:l.jsx(Bf,{})}),l.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId",element:l.jsx(Bf,{})}),l.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:l.jsx(Bf,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId",element:l.jsx(E4,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:l.jsx(Wy,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:l.jsx(fa,{})}),l.jsxs(je,{path:"environments",element:l.jsx(iL,{}),children:[l.jsx(je,{index:!0,element:l.jsx(xI,{})}),l.jsx(je,{path:"new",element:l.jsx(eL,{})}),l.jsx(je,{path:":environmentId",element:l.jsx(ML,{})}),l.jsx(je,{path:":environmentId/edit",element:l.jsx(tL,{})})]})]}),l.jsx(je,{element:l.jsx(hD,{}),children:l.jsxs(je,{path:"settings",element:l.jsx(BL,{}),children:[l.jsx(je,{index:!0,element:l.jsx(Kn,{to:"credentials",replace:!0})}),l.jsx(je,{path:"environments",element:l.jsx(Kn,{to:"/environments",replace:!0})}),l.jsx(je,{path:"credentials",element:l.jsx(T8,{})}),l.jsx(je,{path:"tokens",element:l.jsx(Kn,{to:"../credentials",replace:!0})}),l.jsx(je,{path:"personas",element:l.jsx(q8,{})}),l.jsx(je,{path:"personas/new",element:l.jsx(sb,{})}),l.jsx(je,{path:"personas/:personaId",element:l.jsx(sb,{})}),l.jsx(je,{path:"appearance",element:l.jsx(cU,{})}),l.jsx(je,{path:"shortcuts",element:l.jsx(TU,{})}),l.jsx(je,{path:"about",element:l.jsx(pU,{})})]})}),l.jsx(je,{path:"*",element:l.jsx(Kn,{to:"/",replace:!0})})]})]})}const az=1e4;function iz(){const{onboardingCompleted:n}=pt(),[s,i]=y.useState(!1);y.useEffect(()=>{if(n!==void 0)return;const c=setTimeout(()=>i(!0),az);return()=>clearTimeout(c)},[n]);const o=n===void 0&&!s;return l.jsx(rs,{mode:"wait",children:o?l.jsx(Ot.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:l.jsx(Ax,{})},"splash"):l.jsx(Ot.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:l.jsx(Jk,{basename:"/".replace(/\/$/,""),children:l.jsx(sz,{})})},"app")})}function oz(){const n=Lx?J2:P2;return l.jsx(nw,{children:l.jsx(X2,{children:l.jsx(n,{children:l.jsx(iz,{})})})})}ST.createRoot(document.getElementById("root")).render(l.jsx(y.StrictMode,{children:l.jsx(oz,{})}));export{ba as B,Db as K,pt as a,jb as s,os as t,St as u};
|
|
503
|
+
$\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),E==="agent"&&l.jsxs("div",{children:[l.jsx("label",{children:"Allowed MCP Tools"}),l.jsx(qy,{selectedTools:F,onChange:I=>{Q(I);const Ne=I.length===0?["__clear__"]:I;me(()=>c(n.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Ne),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Se&&!we&&l.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,l.jsx(Ja,{isOpen:ae,title:"Delete Persona?",description:`"${n==null?void 0:n.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:fe,onCancel:()=>pe(!1)})]})}function gU(){const{themeId:n,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=Cx();return l.jsx(BI,{themeId:n,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c})}function vU(){const[n,s]=y.useState(void 0);return y.useEffect(()=>{let i=!1;return ke.getVersionStatus({}).then(o=>{i||s({currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker})},()=>{}),()=>{i=!0}},[]),n}function yU(){const{connected:n,environments:s,sessions:i}=pt(),o=vU();return l.jsxs(l.Fragment,{children:[o&&l.jsx(zO,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),l.jsx(LI,{connected:n,environments:s,sessions:i})]})}function bU(){return l.jsx(M5,{})}const ab=ei();function _U(){const n=St();return Ms({key:"?"},()=>{n(G2)}),Ms({key:"n"},()=>{n(ab)}),Ms({key:"N"},()=>{n(ab)}),l.jsx(l.Fragment,{})}function Vc(n){const s=xB();y.useLayoutEffect(()=>(s(n),()=>{s(void 0)}),[n,s])}function xU(){const{workspaces:n,tasks:s}=pt(),i=y.useMemo(()=>l.jsx(hO,{workspaces:n,tasks:s}),[n,s]);return Vc(i),l.jsx(Qa,{})}function SU(){const{environments:n}=pt(),s=y.useMemo(()=>l.jsx(B6,{environments:n}),[n]);return Vc(s),l.jsx(Qa,{})}function TU(){const n=y.useMemo(()=>l.jsx(j4,{}),[]);return Vc(n),l.jsx(Qa,{})}function kU(){const{knowledge:n,workspaces:s}=pt(),i=y.useCallback(m=>{n.search(m)},[n]),o=y.useCallback(()=>{n.clearSearch()},[n]),c=y.useCallback(m=>{n.selectNode(m)},[n]),u=y.useCallback(m=>{n.loadRecent(m||void 0)},[n]),d=y.useMemo(()=>l.jsx(Y3,{nodes:n.graphData.nodes,workspaces:s,loading:n.loading,searchQuery:n.searchQuery,onSearch:i,onClearSearch:o,onSelectNode:c,onWorkspaceChange:u}),[n,s,i,o,c,u]);return Vc(d),l.jsx(Qa,{})}const wU="_wizard_1260s_1",NU="_container_1260s_10",jU="_stepContent_1260s_19",CU="_logoArea_1260s_28",EU="_logoImage_1260s_32",AU="_heading_1260s_41",DU="_tagline_1260s_49",RU="_subtitle_1260s_56",MU="_featureList_1260s_64",OU="_runtimeGrid_1260s_89",IU="_runtimeCard_1260s_101",BU="_runtimeName_1260s_133",LU="_runtimeDescription_1260s_139",UU="_buttonRow_1260s_144",zU="_primaryButton_1260s_151",PU="_ghostButton_1260s_185",VU="_dots_1260s_213",HU="_dot_1260s_213",rt={wizard:wU,container:NU,stepContent:jU,logoArea:CU,logoImage:EU,heading:AU,tagline:DU,subtitle:RU,featureList:MU,runtimeGrid:OU,runtimeCard:IU,runtimeName:BU,runtimeDescription:LU,buttonRow:UU,primaryButton:zU,ghostButton:PU,dots:VU,dot:HU};function qU({onNext:n}){return l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-welcome",children:[l.jsx("div",{className:rt.logoArea,children:l.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:rt.logoImage})}),l.jsx("h1",{className:rt.heading,children:"Welcome to Grackle"}),l.jsx("p",{className:rt.tagline,children:"Multi-agent orchestration for software teams"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:n,"data-testid":"setup-get-started",children:"Get Started"})]})}function GU({onNext:n,onBack:s}){return l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-about",children:[l.jsx("h2",{className:rt.heading,children:"What is Grackle?"}),l.jsxs("ul",{className:rt.featureList,children:[l.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),l.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),l.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),l.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),l.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),l.jsxs("div",{className:rt.buttonRow,children:[l.jsx("button",{type:"button",className:rt.ghostButton,onClick:s,children:"Back"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:n,"data-testid":"setup-about-next",children:"Next"})]})]})}const $U=[{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 FU({currentRuntime:n,onFinish:s,onBack:i,finishDisabled:o}){const[c,u]=y.useState(n||"claude-code");return y.useEffect(()=>{n&&u(n)},[n]),l.jsxs("div",{className:rt.stepContent,"data-testid":"setup-runtime",children:[l.jsx("h2",{className:rt.heading,children:"Choose Your Runtime"}),l.jsx("p",{className:rt.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),l.jsx("div",{className:rt.runtimeGrid,children:$U.map(d=>l.jsxs("button",{type:"button",className:rt.runtimeCard,"data-selected":c===d.id,"aria-pressed":c===d.id,"data-testid":`runtime-card-${d.id}`,onClick:()=>u(d.id),children:[l.jsx("span",{className:rt.runtimeName,children:d.name}),l.jsx("span",{className:rt.runtimeDescription,children:d.description})]},d.id))}),l.jsxs("div",{className:rt.buttonRow,children:[l.jsx("button",{type:"button",className:rt.ghostButton,onClick:i,children:"Back"}),l.jsx("button",{type:"button",className:rt.primaryButton,onClick:()=>{s(c)},disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const ZU=3,ib={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function KU(){const{personas:n,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=pt(),{showToast:c}=dn(),u=St(),[d,m]=y.useState(0),[h,g]=y.useState(!1),v=n.find(_=>_.id==="claude-code"),b=y.useCallback(_=>{g(!0);const S=[];if(v&&_!==v.runtime){const N=ib[_]??"sonnet";S.push(s(v.id,void 0,void 0,void 0,_,N))}const T=n.find(N=>N.id===n0);if(T&&_!==T.runtime){const N=ib[_]??"sonnet";S.push(s(n0,void 0,void 0,void 0,_,N))}Promise.all(S).then(()=>i()).then(()=>{u("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),g(!1)})},[v,n,s,i,u,c]);return o===!0?l.jsx(Kn,{to:"/",replace:!0}):l.jsx("div",{className:rt.wizard,"data-testid":"setup-wizard",children:l.jsxs("div",{className:rt.container,children:[l.jsx(rs,{mode:"wait",children:l.jsxs(Ot.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[d===0&&l.jsx(qU,{onNext:()=>m(1)}),d===1&&l.jsx(GU,{onNext:()=>m(2),onBack:()=>m(0)}),d===2&&l.jsx(FU,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:b,onBack:()=>m(1),finishDisabled:!v||h})]},d)}),l.jsx("div",{className:rt.dots,children:Array.from({length:ZU},(_,S)=>l.jsx("span",{className:rt.dot,"data-active":S===d},S))})]})})}const YU="_root_zndgp_1",JU="_body_zndgp_7",WU="_main_zndgp_19",XU="_sidebarWrapper_zndgp_26",QU="_overlay_zndgp_51",pr={root:YU,body:JU,main:WU,sidebarWrapper:XU,overlay:QU},ez=y.lazy(()=>wT(()=>import("./KnowledgePage-BIcDgOZa.js"),__vite__mapDeps([0,1,2,3,4])).then(n=>({default:n.KnowledgePage}))),Lx=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function tz(){const{connected:n,environments:s,sessions:i,tasks:o}=pt(),{toasts:c,dismissToast:u}=dn(),d=Lt(),m=_B(),h=m!==void 0,[g,v]=y.useState(!1),b=y.useCallback(()=>v(_=>!_),[]);return y.useEffect(()=>{v(!1)},[d.pathname]),y.useEffect(()=>{if(!g)return;const _=S=>{S.key==="Escape"&&v(!1)};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[g]),l.jsxs(l.Fragment,{children:[l.jsx(i6,{connected:n,environments:s,sessions:i,onToggleSidebar:h?b:void 0,sidebarOpen:g}),l.jsx(f6,{}),l.jsxs("div",{className:pr.body,children:[h&&l.jsx("div",{className:pr.sidebarWrapper,"data-sidebar-open":g,children:l.jsx(y6,{content:m})}),h&&g&&l.jsx("div",{className:pr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),l.jsxs("div",{className:pr.main,children:[l.jsx(Qa,{}),l.jsx(N6,{sessions:i,tasks:o,environments:s})]})]}),l.jsx(CO,{toasts:c,onDismiss:u}),l.jsx(_U,{})]})}function nz(){const{lastSpawnedId:n,environments:s,tasks:i,connected:o,onboardingCompleted:c}=pt(),{showToast:u}=dn();gL(s,u),_L(i,u);const d=St(),m=Lt();return y.useEffect(()=>{n&&!m.pathname.includes("/tasks/")&&d(jb(n),{replace:!0})},[n,d,m.pathname]),o&&c===!1?l.jsx(Kn,{to:"/setup",replace:!0}):l.jsx(bB,{children:l.jsxs("div",{className:pr.root,children:[Lx&&l.jsx(bw,{}),l.jsx(tz,{})]})})}function Bf(){const{workspaceId:n}=va(),{workspaces:s}=pt(),i=Lt(),o=s.find(h=>h.id===n);if(!(o!=null&&o.environmentId))return s.length===0?void 0:l.jsx(Kn,{to:"/environments",replace:!0});const c=encodeURIComponent(n),u=`/workspaces/${c}`,d=i.pathname.startsWith(u)?i.pathname.slice(u.length):"",m=`/environments/${encodeURIComponent(o.environmentId)}/workspaces/${c}${d}${i.search}${i.hash}`;return l.jsx(Kn,{to:m,replace:!0})}function sz(){return l.jsxs(i2,{children:[l.jsx(je,{path:"setup",element:l.jsx(KU,{})}),l.jsxs(je,{element:l.jsx(nz,{}),children:[l.jsx(je,{index:!0,element:l.jsx(i8,{})}),l.jsx(je,{path:"chat",element:l.jsx(m8,{})}),l.jsx(je,{path:"sessions/new",element:l.jsx(h8,{})}),l.jsx(je,{path:"sessions/:sessionId",element:l.jsx(y8,{})}),l.jsx(je,{element:l.jsx(kU,{}),children:l.jsx(je,{path:"knowledge",element:l.jsx(y.Suspense,{fallback:l.jsx(ux,{}),children:l.jsx(ez,{})})})}),l.jsxs(je,{element:l.jsx(xU,{}),children:[l.jsx(je,{path:"tasks",element:l.jsx(s8,{})}),l.jsx(je,{path:"tasks/new",element:l.jsx(Qy,{})}),l.jsx(je,{path:"tasks/:taskId",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/edit",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/stream",element:l.jsx(fa,{})}),l.jsx(je,{path:"tasks/:taskId/findings",element:l.jsx(fa,{})})]}),l.jsxs(je,{element:l.jsx(SU,{}),children:[l.jsx(je,{path:"workspaces",element:l.jsx(Kn,{to:"/environments",replace:!0})}),l.jsx(je,{path:"workspaces/new",element:l.jsx(k8,{})}),l.jsx(je,{path:"workspaces/:workspaceId",element:l.jsx(Bf,{})}),l.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId",element:l.jsx(Bf,{})}),l.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:l.jsx(Bf,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId",element:l.jsx(x8,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:l.jsx(Qy,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:l.jsx(fa,{})}),l.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:l.jsx(fa,{})}),l.jsxs(je,{path:"environments",element:l.jsx(O8,{}),children:[l.jsx(je,{index:!0,element:l.jsx(a8,{})}),l.jsx(je,{path:"new",element:l.jsx(E8,{})}),l.jsx(je,{path:":environmentId",element:l.jsx(lU,{})}),l.jsx(je,{path:":environmentId/edit",element:l.jsx(A8,{})})]})]}),l.jsx(je,{element:l.jsx(TU,{}),children:l.jsxs(je,{path:"settings",element:l.jsx(dU,{}),children:[l.jsx(je,{index:!0,element:l.jsx(Kn,{to:"credentials",replace:!0})}),l.jsx(je,{path:"environments",element:l.jsx(Kn,{to:"/environments",replace:!0})}),l.jsx(je,{path:"credentials",element:l.jsx(fU,{})}),l.jsx(je,{path:"tokens",element:l.jsx(Kn,{to:"../credentials",replace:!0})}),l.jsx(je,{path:"personas",element:l.jsx(pU,{})}),l.jsx(je,{path:"personas/new",element:l.jsx(sb,{})}),l.jsx(je,{path:"personas/:personaId",element:l.jsx(sb,{})}),l.jsx(je,{path:"appearance",element:l.jsx(gU,{})}),l.jsx(je,{path:"shortcuts",element:l.jsx(bU,{})}),l.jsx(je,{path:"about",element:l.jsx(yU,{})})]})}),l.jsx(je,{path:"*",element:l.jsx(Kn,{to:"/",replace:!0})})]})]})}const az=1e4;function iz(){const{onboardingCompleted:n}=pt(),[s,i]=y.useState(!1);y.useEffect(()=>{if(n!==void 0)return;const c=setTimeout(()=>i(!0),az);return()=>clearTimeout(c)},[n]);const o=n===void 0&&!s;return l.jsx(rs,{mode:"wait",children:o?l.jsx(Ot.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:l.jsx(ux,{})},"splash"):l.jsx(Ot.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:l.jsx(A2,{basename:"/".replace(/\/$/,""),children:l.jsx(sz,{})})},"app")})}function oz(){const n=Lx?$B:hL;return l.jsx(yB,{children:l.jsx(mB,{children:l.jsx(n,{children:l.jsx(iz,{})})})})}ST.createRoot(document.getElementById("root")).render(l.jsx(y.StrictMode,{children:l.jsx(oz,{})}));export{ya as B,Db as K,pt as a,jb as s,os as t,St as u};
|