@grackle-ai/web 0.87.0 → 0.88.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.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-DcSnAfbP.js","assets/dagview-CzJGOIoX.js","assets/grpc-Bldzxzim.js","assets/markdown-DH3wQq0i.js","assets/KnowledgePage-DMqJ4jlP.css"])))=>i.map(i=>d[i]);
2
- import{r as WS,a as XS,b as y,j as l,d as t0,H as n0,P as s0,i as QS,B as eT,c as tT,C as nT,M as sT}from"./dagview-CzJGOIoX.js";import{c as aT,a as iT,G as oT,f as rT,M as lT,A as lb,D as cb,W as cT,O as uT,b as dT,C as Dc,d as fT,e as ub,w as pT,t as mT,p as Xl,g as hT,R as ar,S as a0}from"./grpc-Bldzxzim.js";import{v as gT,r as vT,t as Ql,i as yT,f as bT,M as fp,a as pp}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 ef={exports:{}},ir={},tf={exports:{}},nf={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-D40LOPEE.js","assets/dagview-CzJGOIoX.js","assets/grpc-BgRV4tIv.js","assets/markdown-DH3wQq0i.js","assets/KnowledgePage-DMqJ4jlP.css"])))=>i.map(i=>d[i]);
2
+ import{r as WS,a as XS,b as y,j as l,d as t0,H as n0,P as s0,i as QS,B as eT,c as tT,C as nT,M as sT}from"./dagview-CzJGOIoX.js";import{c as aT,a as iT,G as oT,f as rT,M as lT,A as lb,D as cb,W as cT,O as uT,b as dT,C as Dc,d as fT,e as ub,w as pT,t as mT,p as Xl,g as hT,R as ar,S as a0}from"./grpc-BgRV4tIv.js";import{v as gT,r as vT,t as Ql,i as yT,f as bT,M as fp,a as pp}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 ef={exports:{}},ir={},tf={exports:{}},nf={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
5
5
  *
@@ -59,7 +59,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
59
59
  top: ${h}px !important;
60
60
  left: ${g}px !important;
61
61
  }
62
- `),()=>{document.head.removeChild(v)}},[s]),l.jsx(Ij,{isPresent:s,childRef:o,sizeRef:c,children:y.cloneElement(n,{ref:o})})}const Lj=({children:n,initial:s,isPresent:i,onExitComplete:o,custom:c,presenceAffectsLayout:u,mode:d})=>{const m=kp(Uj),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(Bj,{isPresent:i,children:n})),l.jsx(Bc.Provider,{value:v,children:n})};function Uj(){return new Map}function Bb(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 nc=n=>n.key||"";function k0(n){const s=[];return y.Children.forEach(n,i=>{y.isValidElement(i)&&s.push(i)}),s}const Np=typeof window<"u",Lb=Np?y.useLayoutEffect:y.useEffect,ls=({children:n,custom:s,initial:i=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:u="sync",propagate:d=!1})=>{const[m,h]=Bb(d),g=y.useMemo(()=>k0(n),[n]),v=d&&!m?[]:g.map(nc),b=y.useRef(!0),_=y.useRef(g),S=kp(()=>new Map),[T,N]=y.useState(g),[j,w]=y.useState(g);Lb(()=>{b.current=!1,_.current=g;for(let M=0;M<j.length;M++){const D=nc(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=nc(E);v.includes(H)||(M.splice(D,0,E),C.push(E))}u==="wait"&&C.length&&(M=C),w(k0(M)),N(g);return}const{forceRender:A}=y.useContext(Tp);return l.jsx(l.Fragment,{children:j.map(M=>{const D=nc(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(Lj,{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)})})},bn=n=>n;let Ub=bn;const zj={useManualTiming:!1};function Pj(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 sc=["read","resolveKeyframes","update","preRender","render","postRender"],Vj=40;function zb(n,s){let i=!1,o=!0;const c={delta:0,timestamp:0,isProcessing:!1},u=()=>i=!0,d=sc.reduce((w,C)=>(w[C]=Pj(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,Vj),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:sc.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<sc.length;C++)d[sc[C]].cancel(w)},state:c,steps:d}}const{schedule:ft,cancel:ya,state:Zt,steps:gf}=zb(typeof requestAnimationFrame<"u"?requestAnimationFrame:bn,!0),Pb=y.createContext({strict:!1}),w0={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"]},so={};for(const n in w0)so[n]={isEnabled:s=>w0[n].some(i=>!!s[i])};function Hj(n){for(const s in n)so[s]={...so[s],...n[s]}}const Gj=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 xc(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||Gj.has(n)}let Vb=n=>!xc(n);function $j(n){n&&(Vb=s=>s.startsWith("on")?!xc(s):n(s))}try{$j(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"||(Vb(c)||i===!0&&xc(c)||!s&&!xc(c)||n.draggable&&c.startsWith("onDrag"))&&(o[c]=n[c]);return o}function Fj(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 wr(n){return typeof n=="string"||Array.isArray(n)}function Uc(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const jp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Cp=["initial",...jp];function zc(n){return Uc(n.animate)||Cp.some(s=>wr(n[s]))}function Hb(n){return!!(zc(n)||n.variants)}function Zj(n,s){if(zc(n)){const{initial:i,animate:o}=n;return{initial:i===!1||wr(i)?i:void 0,animate:wr(o)?o:void 0}}return n.inherit!==!1?s:{}}function Kj(n){const{initial:s,animate:i}=Zj(n,y.useContext(Lc));return y.useMemo(()=>({initial:s,animate:i}),[N0(s),N0(i)])}function N0(n){return Array.isArray(n)?n.join(" "):n}const Yj=Symbol.for("motionComponentSymbol");function Fi(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function Jj(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):Fi(i)&&(i.current=o))},[s])}const Ep=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Wj="framerAppearId",Gb="data-"+Ep(Wj),{schedule:Ap}=zb(queueMicrotask,!1),$b=y.createContext({});function Xj(n,s,i,o,c){var u,d;const{visualElement:m}=y.useContext(Lc),h=y.useContext(Pb),g=y.useContext(Bc),v=y.useContext(wp).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($b);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&Qj(b.current,i,c,S);const T=y.useRef(!1);y.useInsertionEffect(()=>{_&&T.current&&_.update(i,g)});const N=i[Gb],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 Lb(()=>{_&&(T.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),Ap.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 Qj(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&&Fi(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 eC({preloadedFeatures:n,createVisualElement:s,useRender:i,useVisualState:o,Component:c}){var u,d;n&&Hj(n);function m(g,v){let b;const _={...y.useContext(wp),...g,layoutId:tC(g)},{isStatic:S}=_,T=Kj(g),N=o(g,S);if(!S&&Np){nC();const j=sC(_);b=j.MeasureLayout,T.visualElement=Xj(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,Jj(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[Yj]=c,h}function tC({layoutId:n}){const s=y.useContext(Tp).id;return s&&n!==void 0?s+"-"+n:n}function nC(n,s){y.useContext(Pb).strict}function sC(n){const{drag:s,layout:i}=so;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 aC=["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 Dp(n){return typeof n!="string"||n.includes("-")?!1:!!(aC.indexOf(n)>-1||/[A-Z]/u.test(n))}function j0(n){const s=[{},{}];return n==null||n.values.forEach((i,o)=>{s[0][o]=i.get(),s[1][o]=i.getVelocity()}),s}function Rp(n,s,i,o){if(typeof s=="function"){const[c,u]=j0(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]=j0(o);s=s(i!==void 0?i:n.custom,c,u)}return s}const qf=n=>Array.isArray(n),iC=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),oC=n=>qf(n)?n[n.length-1]||0:n,Xt=n=>!!(n&&n.getVelocity);function mc(n){const s=Xt(n)?n.get():n;return iC(s)?s.toValue():s}function rC({scrapeMotionValuesFromProps:n,createRenderState:s,onUpdate:i},o,c,u){const d={latestValues:lC(o,c,u,n),renderState:s()};return i&&(d.onMount=m=>i({props:o,current:m,...d}),d.onUpdate=m=>i(m)),d}const Fb=n=>(s,i)=>{const o=y.useContext(Lc),c=y.useContext(Bc),u=()=>rC(n,s,o,c);return i?u():kp(u)};function lC(n,s,i,o){const c={},u=o(n,{});for(const _ in u)c[_]=mc(u[_]);let{initial:d,animate:m}=n;const h=zc(n),g=Hb(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=Rp(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 lo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ai=new Set(lo),Zb=n=>s=>typeof s=="string"&&s.startsWith(n),Kb=Zb("--"),cC=Zb("var(--"),Mp=n=>cC(n)?uC.test(n.split("/*")[0].trim()):!1,uC=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Yb=(n,s)=>s&&typeof n=="number"?s.transform(n):n,Bs=(n,s,i)=>i>s?s:i<n?n:i,co={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},Nr={...co,transform:n=>Bs(0,1,n)},ac={...co,default:1},Rr=n=>({test:s=>typeof s=="string"&&s.endsWith(n)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${n}`}),ha=Rr("deg"),is=Rr("%"),Te=Rr("px"),dC=Rr("vh"),fC=Rr("vw"),C0={...is,parse:n=>is.parse(n)/100,transform:n=>is.transform(n*100)},pC={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},mC={rotate:ha,rotateX:ha,rotateY:ha,rotateZ:ha,scale:ac,scaleX:ac,scaleY:ac,scaleZ:ac,skew:ha,skewX:ha,skewY:ha,distance:Te,translateX:Te,translateY:Te,translateZ:Te,x:Te,y:Te,z:Te,perspective:Te,transformPerspective:Te,opacity:Nr,originX:C0,originY:C0,originZ:Te},E0={...co,transform:Math.round},Op={...pC,...mC,zIndex:E0,size:Te,fillOpacity:Nr,strokeOpacity:Nr,numOctaves:E0},hC={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},gC=lo.length;function vC(n,s,i){let o="",c=!0;for(let u=0;u<gC;u++){const d=lo[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=Yb(m,Op[d]);if(!h){c=!1;const v=hC[d]||d;o+=`${v}(${g}) `}i&&(s[d]=g)}}return o=o.trim(),i?o=i(s,c?"":o):c&&(o="none"),o}function Ip(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(ai.has(h)){d=!0;continue}else if(Kb(h)){c[h]=g;continue}else{const v=Yb(g,Op[h]);h.startsWith("origin")?(m=!0,u[h]=v):o[h]=v}}if(s.transform||(d||i?o.transform=vC(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 yC={offset:"stroke-dashoffset",array:"stroke-dasharray"},bC={offset:"strokeDashoffset",array:"strokeDasharray"};function _C(n,s,i=1,o=0,c=!0){n.pathLength=1;const u=c?yC:bC;n[u.offset]=Te.transform(-o);const d=Te.transform(s),m=Te.transform(i);n[u.array]=`${d} ${m}`}function A0(n,s,i){return typeof n=="string"?n:Te.transform(s+i*n)}function xC(n,s,i){const o=A0(s,n.x,n.width),c=A0(i,n.y,n.height);return`${o} ${c}`}function Bp(n,{attrX:s,attrY:i,attrScale:o,originX:c,originY:u,pathLength:d,pathSpacing:m=1,pathOffset:h=0,...g},v,b){if(Ip(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=xC(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&&_C(_,d,m,h,!1)}const Lp=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Jb=()=>({...Lp(),attrs:{}}),Up=n=>typeof n=="string"&&n.toLowerCase()==="svg";function Wb(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 Xb=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 Qb(n,s,i,o){Wb(n,s,void 0,o);for(const c in s.attrs)n.setAttribute(Xb.has(c)?c:Ep(c),s.attrs[c])}const Sc={};function SC(n){Object.assign(Sc,n)}function e_(n,{layout:s,layoutId:i}){return ai.has(n)||n.startsWith("origin")||(s||i!==void 0)&&(!!Sc[n]||n==="opacity")}function zp(n,s,i){var o;const{style:c}=n,u={};for(const d in c)(Xt(c[d])||s.style&&Xt(s.style[d])||e_(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 t_(n,s,i){const o=zp(n,s,i);for(const c in n)if(Xt(n[c])||Xt(s[c])){const u=lo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;o[u]=n[c]}return o}function TC(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 D0=["x","y","width","height","cx","cy","r"],kC={useVisualState:Fb({scrapeMotionValuesFromProps:t_,createRenderState:Jb,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(ai.has(m)){u=!0;break}}if(!u)return;let d=!s;if(s)for(let m=0;m<D0.length;m++){const h=D0[m];n[h]!==s[h]&&(d=!0)}d&&ft.read(()=>{TC(i,o),ft.render(()=>{Bp(o,c,Up(i.tagName),n.transformTemplate),Qb(i,o)})})}})},wC={useVisualState:Fb({scrapeMotionValuesFromProps:zp,createRenderState:Lp})};function n_(n,s,i){for(const o in s)!Xt(s[o])&&!e_(o,i)&&(n[o]=s[o])}function NC({transformTemplate:n},s){return y.useMemo(()=>{const i=Lp();return Ip(i,s,n),Object.assign({},i.vars,i.style)},[s])}function jC(n,s){const i=n.style||{},o={};return n_(o,i,n),Object.assign(o,NC(n,s)),o}function CC(n,s){const i={},o=jC(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 EC(n,s,i,o){const c=y.useMemo(()=>{const u=Jb();return Bp(u,s,Up(o),n.transformTemplate),{...u.attrs,style:{...u.style}}},[s]);if(n.style){const u={};n_(u,n.style,n),c.style={...u,...c.style}}return c}function AC(n=!1){return(i,o,c,{latestValues:u},d)=>{const h=(Dp(i)?EC:CC)(o,u,d,i),g=qj(o,typeof i=="string",n),v=i!==y.Fragment?{...g,...h,ref:c}:{},{children:b}=o,_=y.useMemo(()=>Xt(b)?b.get():b,[b]);return y.createElement(i,{...v,children:_})}}function DC(n,s){return function(o,{forwardMotionProps:c}={forwardMotionProps:!1}){const d={...Dp(o)?kC:wC,preloadedFeatures:n,useRender:AC(c),createVisualElement:s,Component:o};return eC(d)}}function s_(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 Rp(o,s,i!==void 0?i:o.custom,n)}function Pp(n,s){return n?n[s]||n.default||n:void 0}const a_=new Set(["width","height","top","left","right","bottom",...lo]);let hc;function RC(){hc=void 0}const os={now:()=>(hc===void 0&&os.set(Zt.isProcessing||zj.useManualTiming?Zt.timestamp:performance.now()),hc),set:n=>{hc=n,queueMicrotask(RC)}};function Vp(n,s){n.indexOf(s)===-1&&n.push(s)}function Hp(n,s){const i=n.indexOf(s);i>-1&&n.splice(i,1)}class Gp{constructor(){this.subscriptions=[]}add(s){return Vp(this.subscriptions,s),()=>Hp(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 i_(n,s){return s?n*(1e3/s):0}const R0=30,MC=n=>!isNaN(parseFloat(n));class OC{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(o,c=!0)=>{const u=os.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=os.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=MC(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 Gp);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=os.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>R0)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,R0);return i_(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 jr(n,s){return new OC(n,s)}function IC(n,s,i){n.hasValue(s)?n.getValue(s).set(i):n.addValue(s,jr(i))}function BC(n,s){const i=Pc(n,s);let{transitionEnd:o={},transition:c={},...u}=i||{};u={...u,...o};for(const d in u){const m=oC(u[d]);IC(n,d,m)}}function LC(n){return!!(Xt(n)&&n.add)}function Ff(n,s){const i=n.getValue("willChange");if(LC(i))return i.add(s)}function o_(n){return n.props[Gb]}function $p(n){let s;return()=>(s===void 0&&(s=n()),s)}const UC=$p(()=>window.ScrollTimeline!==void 0);class zC{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(UC()&&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 PC extends zC{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Rs=n=>n*1e3,Ms=n=>n/1e3;function qp(n){return typeof n=="function"}function M0(n,s){n.timeline=s,n.onfinish=null}const Fp=n=>Array.isArray(n)&&typeof n[0]=="number",VC={linearEasing:void 0};function HC(n,s){const i=$p(n);return()=>{var o;return(o=VC[s])!==null&&o!==void 0?o:i()}}const Tc=HC(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ao=(n,s,i)=>{const o=s-n;return o===0?1:(i-n)/o},r_=(n,s,i=10)=>{let o="";const c=Math.max(Math.round(s/i),2);for(let u=0;u<c;u++)o+=n(ao(0,c-1,u))+", ";return`linear(${o.substring(0,o.length-2)})`};function l_(n){return!!(typeof n=="function"&&Tc()||!n||typeof n=="string"&&(n in Zf||Tc())||Fp(n)||Array.isArray(n)&&n.every(l_))}const dr=([n,s,i,o])=>`cubic-bezier(${n}, ${s}, ${i}, ${o})`,Zf={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:dr([0,.65,.55,1]),circOut:dr([.55,0,1,.45]),backIn:dr([.31,.01,.66,-.59]),backOut:dr([.33,1.53,.69,.99])};function c_(n,s){if(n)return typeof n=="function"&&Tc()?r_(n,s):Fp(n)?dr(n):Array.isArray(n)?n.map(i=>c_(i,s)||Zf.easeOut):Zf[n]}const u_=(n,s,i)=>(((1-3*i+3*s)*n+(3*i-6*s))*n+3*s)*n,GC=1e-7,$C=12;function qC(n,s,i,o,c){let u,d,m=0;do d=s+(i-s)/2,u=u_(d,o,c)-n,u>0?i=d:s=d;while(Math.abs(u)>GC&&++m<$C);return d}function Mr(n,s,i,o){if(n===s&&i===o)return bn;const c=u=>qC(u,0,1,n,i);return u=>u===0||u===1?u:u_(c(u),s,o)}const d_=n=>s=>s<=.5?n(2*s)/2:(2-n(2*(1-s)))/2,f_=n=>s=>1-n(1-s),p_=Mr(.33,1.53,.69,.99),Zp=f_(p_),m_=d_(Zp),h_=n=>(n*=2)<1?.5*Zp(n):.5*(2-Math.pow(2,-10*(n-1))),Kp=n=>1-Math.sin(Math.acos(n)),g_=f_(Kp),v_=d_(Kp),y_=n=>/^0[^.\s]+$/u.test(n);function FC(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||y_(n):!0}const gr=n=>Math.round(n*1e5)/1e5,Yp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ZC(n){return n==null}const KC=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Jp=(n,s)=>i=>!!(typeof i=="string"&&KC.test(i)&&i.startsWith(n)||s&&!ZC(i)&&Object.prototype.hasOwnProperty.call(i,s)),b_=(n,s,i)=>o=>{if(typeof o!="string")return o;const[c,u,d,m]=o.match(Yp);return{[n]:parseFloat(c),[s]:parseFloat(u),[i]:parseFloat(d),alpha:m!==void 0?parseFloat(m):1}},YC=n=>Bs(0,255,n),vf={...co,transform:n=>Math.round(YC(n))},Ka={test:Jp("rgb","red"),parse:b_("red","green","blue"),transform:({red:n,green:s,blue:i,alpha:o=1})=>"rgba("+vf.transform(n)+", "+vf.transform(s)+", "+vf.transform(i)+", "+gr(Nr.transform(o))+")"};function JC(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 Kf={test:Jp("#"),parse:JC,transform:Ka.transform},Zi={test:Jp("hsl","hue"),parse:b_("hue","saturation","lightness"),transform:({hue:n,saturation:s,lightness:i,alpha:o=1})=>"hsla("+Math.round(n)+", "+is.transform(gr(s))+", "+is.transform(gr(i))+", "+gr(Nr.transform(o))+")"},Wt={test:n=>Ka.test(n)||Kf.test(n)||Zi.test(n),parse:n=>Ka.test(n)?Ka.parse(n):Zi.test(n)?Zi.parse(n):Kf.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Ka.transform(n):Zi.transform(n)},WC=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function XC(n){var s,i;return isNaN(n)&&typeof n=="string"&&(((s=n.match(Yp))===null||s===void 0?void 0:s.length)||0)+(((i=n.match(WC))===null||i===void 0?void 0:i.length)||0)>0}const __="number",x_="color",QC="var",eE="var(",O0="${}",tE=/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 Cr(n){const s=n.toString(),i=[],o={color:[],number:[],var:[]},c=[];let u=0;const m=s.replace(tE,h=>(Wt.test(h)?(o.color.push(u),c.push(x_),i.push(Wt.parse(h))):h.startsWith(eE)?(o.var.push(u),c.push(QC),i.push(h)):(o.number.push(u),c.push(__),i.push(parseFloat(h))),++u,O0)).split(O0);return{values:i,split:m,indexes:o,types:c}}function S_(n){return Cr(n).values}function T_(n){const{split:s,types:i}=Cr(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===__?u+=gr(c[d]):m===x_?u+=Wt.transform(c[d]):u+=c[d]}return u}}const nE=n=>typeof n=="number"?0:n;function sE(n){const s=S_(n);return T_(n)(s.map(nE))}const ba={test:XC,parse:S_,createTransformer:T_,getAnimatableNone:sE},aE=new Set(["brightness","contrast","saturate","opacity"]);function iE(n){const[s,i]=n.slice(0,-1).split("(");if(s==="drop-shadow")return n;const[o]=i.match(Yp)||[];if(!o)return n;const c=i.replace(o,"");let u=aE.has(s)?1:0;return o!==i&&(u*=100),s+"("+u+c+")"}const oE=/\b([a-z-]*)\(.*?\)/gu,Yf={...ba,getAnimatableNone:n=>{const s=n.match(oE);return s?s.map(iE).join(" "):n}},rE={...Op,color:Wt,backgroundColor:Wt,outlineColor:Wt,fill:Wt,stroke:Wt,borderColor:Wt,borderTopColor:Wt,borderRightColor:Wt,borderBottomColor:Wt,borderLeftColor:Wt,filter:Yf,WebkitFilter:Yf},Wp=n=>rE[n];function k_(n,s){let i=Wp(n);return i!==Yf&&(i=ba),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const lE=new Set(["auto","none","0"]);function cE(n,s,i){let o=0,c;for(;o<n.length&&!c;){const u=n[o];typeof u=="string"&&!lE.has(u)&&Cr(u).values.length&&(c=n[o]),o++}if(c&&i)for(const u of s)n[u]=k_(i,c)}const I0=n=>n===co||n===Te,B0=(n,s)=>parseFloat(n.split(", ")[s]),L0=(n,s)=>(i,{transform:o})=>{if(o==="none"||!o)return 0;const c=o.match(/^matrix3d\((.+)\)$/u);if(c)return B0(c[1],s);{const u=o.match(/^matrix\((.+)\)$/u);return u?B0(u[1],n):0}},uE=new Set(["x","y","z"]),dE=lo.filter(n=>!uE.has(n));function fE(n){const s=[];return dE.forEach(i=>{const o=n.getValue(i);o!==void 0&&(s.push([i,o.get()]),o.set(i.startsWith("scale")?1:0))}),s}const io={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:L0(4,13),y:L0(5,14)};io.translateX=io.x;io.translateY=io.y;const Ja=new Set;let Jf=!1,Wf=!1;function w_(){if(Wf){const n=Array.from(Ja).filter(o=>o.needsMeasurement),s=new Set(n.map(o=>o.element)),i=new Map;s.forEach(o=>{const c=fE(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)})}Wf=!1,Jf=!1,Ja.forEach(n=>n.complete()),Ja.clear()}function N_(){Ja.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(Wf=!0)})}function pE(){N_(),w_()}class Xp{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?(Ja.add(this),Jf||(Jf=!0,ft.read(N_),ft.resolveKeyframes(w_))):(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),Ja.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ja.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const j_=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),mE=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function hE(n){const s=mE.exec(n);if(!s)return[,];const[,i,o,c]=s;return[`--${i??o}`,c]}function C_(n,s,i=1){const[o,c]=hE(n);if(!o)return;const u=window.getComputedStyle(s).getPropertyValue(o);if(u){const d=u.trim();return j_(d)?parseFloat(d):d}return Mp(c)?C_(c,s,i+1):c}const E_=n=>s=>s.test(n),gE={test:n=>n==="auto",parse:n=>n},A_=[co,Te,is,ha,fC,dC,gE],U0=n=>A_.find(E_(n));class D_ extends Xp{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(),Mp(g))){const v=C_(g,i.current);v!==void 0&&(s[h]=v),h===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!a_.has(o)||s.length!==2)return;const[c,u]=s,d=U0(c),m=U0(u);if(d!==m)if(I0(d)&&I0(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++)FC(s[c])&&o.push(c);o.length&&cE(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=io[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]=io[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 z0=(n,s)=>s==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(ba.test(n)||n==="0")&&!n.startsWith("url("));function vE(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 yE(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=z0(c,s),m=z0(u,s);return!d||!m?!1:vE(n)||(i==="spring"||qp(i))&&o}const bE=n=>n!==null;function Vc(n,{repeat:s,repeatType:i="loop"},o){const c=n.filter(bE),u=s&&i!=="loop"&&s%2===1?0:c.length-1;return!u||o===void 0?c[u]:o}const _E=40;class R_{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=os.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>_E?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&pE(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=os.now(),this.hasAttemptedResolve=!0;const{name:o,type:c,velocity:u,delay:d,onComplete:m,onUpdate:h,isGenerator:g}=this.options;if(!g&&!yE(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 Xf=2e4;function M_(n){let s=0;const i=50;let o=n.next(s);for(;!o.done&&s<Xf;)s+=i,o=n.next(s);return s>=Xf?1/0:s}const gt=(n,s,i)=>n+(s-n)*i;function yf(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 xE({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=yf(h,m,n+1/3),u=yf(h,m,n),d=yf(h,m,n-1/3)}return{red:Math.round(c*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:o}}function kc(n,s){return i=>i>0?s:n}const bf=(n,s,i)=>{const o=n*n,c=i*(s*s-o)+o;return c<0?0:Math.sqrt(c)},SE=[Kf,Ka,Zi],TE=n=>SE.find(s=>s.test(n));function P0(n){const s=TE(n);if(!s)return!1;let i=s.parse(n);return s===Zi&&(i=xE(i)),i}const V0=(n,s)=>{const i=P0(n),o=P0(s);if(!i||!o)return kc(n,s);const c={...i};return u=>(c.red=bf(i.red,o.red,u),c.green=bf(i.green,o.green,u),c.blue=bf(i.blue,o.blue,u),c.alpha=gt(i.alpha,o.alpha,u),Ka.transform(c))},kE=(n,s)=>i=>s(n(i)),Or=(...n)=>n.reduce(kE),Qf=new Set(["none","hidden"]);function wE(n,s){return Qf.has(n)?i=>i<=0?n:s:i=>i>=1?s:n}function NE(n,s){return i=>gt(n,s,i)}function Qp(n){return typeof n=="number"?NE:typeof n=="string"?Mp(n)?kc:Wt.test(n)?V0:EE:Array.isArray(n)?O_:typeof n=="object"?Wt.test(n)?V0:jE:kc}function O_(n,s){const i=[...n],o=i.length,c=n.map((u,d)=>Qp(u)(u,s[d]));return u=>{for(let d=0;d<o;d++)i[d]=c[d](u);return i}}function jE(n,s){const i={...n,...s},o={};for(const c in i)n[c]!==void 0&&s[c]!==void 0&&(o[c]=Qp(n[c])(n[c],s[c]));return c=>{for(const u in o)i[u]=o[u](c);return i}}function CE(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 EE=(n,s)=>{const i=ba.createTransformer(s),o=Cr(n),c=Cr(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?Qf.has(n)&&!c.values.length||Qf.has(s)&&!o.values.length?wE(n,s):Or(O_(CE(o,c),c.values),i):kc(n,s)};function I_(n,s,i){return typeof n=="number"&&typeof s=="number"&&typeof i=="number"?gt(n,s,i):Qp(n)(n,s)}const AE=5;function B_(n,s,i){const o=Math.max(s-AE,0);return i_(i-n(o),s-o)}const bt={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},_f=.001;function DE({duration:n=bt.duration,bounce:s=bt.bounce,velocity:i=bt.velocity,mass:o=bt.mass}){let c,u,d=1-s;d=Bs(bt.minDamping,bt.maxDamping,d),n=Bs(bt.minDuration,bt.maxDuration,Ms(n)),d<1?(c=g=>{const v=g*d,b=v*n,_=v-i,S=ep(g,d),T=Math.exp(-b);return _f-_/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=ep(Math.pow(g,2),d);return(-c(g)+_f>0?-1:1)*((_-S)*T)/N}):(c=g=>{const v=Math.exp(-g*n),b=(g-i)*n+1;return-_f+v*b},u=g=>{const v=Math.exp(-g*n),b=(i-g)*(n*n);return v*b});const m=5/n,h=ME(c,u,m);if(n=Rs(n),isNaN(h))return{stiffness:bt.stiffness,damping:bt.damping,duration:n};{const g=Math.pow(h,2)*o;return{stiffness:g,damping:d*2*Math.sqrt(o*g),duration:n}}}const RE=12;function ME(n,s,i){let o=i;for(let c=1;c<RE;c++)o=o-n(o)/s(o);return o}function ep(n,s){return n*Math.sqrt(1-s*s)}const OE=["duration","bounce"],IE=["stiffness","damping","mass"];function H0(n,s){return s.some(i=>n[i]!==void 0)}function BE(n){let s={velocity:bt.velocity,stiffness:bt.stiffness,damping:bt.damping,mass:bt.mass,isResolvedFromDuration:!1,...n};if(!H0(n,IE)&&H0(n,OE))if(n.visualDuration){const i=n.visualDuration,o=2*Math.PI/(i*1.2),c=o*o,u=2*Bs(.05,1,1-(n.bounce||0))*Math.sqrt(c);s={...s,mass:bt.mass,stiffness:c,damping:u}}else{const i=DE(n);s={...s,...i,mass:bt.mass},s.isResolvedFromDuration=!0}return s}function L_(n=bt.visualDuration,s=bt.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}=BE({...i,velocity:-Ms(i.velocity||0)}),T=_||0,N=g/(2*Math.sqrt(h*v)),j=d-u,w=Ms(Math.sqrt(h/v)),C=Math.abs(j)<5;o||(o=C?bt.restSpeed.granular:bt.restSpeed.default),c||(c=C?bt.restDelta.granular:bt.restDelta.default);let A;if(N<1){const D=ep(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?Rs(T):B_(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_(M),Xf),E=r_(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=L_({keyframes:[_.value,T(_.value)],velocity:B_(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 LE=Mr(.42,0,1,1),UE=Mr(0,0,.58,1),U_=Mr(.42,0,.58,1),zE=n=>Array.isArray(n)&&typeof n[0]!="number",PE={linear:bn,easeIn:LE,easeInOut:U_,easeOut:UE,circIn:Kp,circInOut:v_,circOut:g_,backIn:Zp,backInOut:m_,backOut:p_,anticipate:h_},$0=n=>{if(Fp(n)){Ub(n.length===4);const[s,i,o,c]=n;return Mr(s,i,o,c)}else if(typeof n=="string")return PE[n];return n};function VE(n,s,i){const o=[],c=i||I_,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]||bn:s;m=Or(h,m)}o.push(m)}return o}function HE(n,s,{clamp:i=!0,ease:o,mixer:c}={}){const u=n.length;if(Ub(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=VE(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 _=ao(n[b],n[b+1],v);return m[b](_)};return i?v=>g(Bs(n[0],n[u-1],v)):g}function GE(n,s){const i=n[n.length-1];for(let o=1;o<=s;o++){const c=ao(0,s,o);n.push(gt(i,1,c))}}function $E(n){const s=[0];return GE(s,n.length-1),s}function qE(n,s){return n.map(i=>i*s)}function FE(n,s){return n.map(()=>s||U_).splice(0,n.length-1)}function wc({duration:n=300,keyframes:s,times:i,ease:o="easeInOut"}){const c=zE(o)?o.map($0):$0(o),u={done:!1,value:s[0]},d=qE(i&&i.length===s.length?i:$E(s),n),m=HE(d,s,{ease:Array.isArray(c)?c:FE(s,c)});return{calculatedDuration:n,next:h=>(u.value=m(h),u.done=h>=n,u)}}const ZE=n=>{const s=({timestamp:i})=>n(i);return{start:()=>ft.update(s,!0),stop:()=>ya(s),now:()=>Zt.isProcessing?Zt.timestamp:os.now()}},KE={decay:G0,inertia:G0,tween:wc,keyframes:wc,spring:L_},YE=n=>n/100;class em extends R_{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)||Xp,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:KE[i]||wc;let h,g;m!==wc&&typeof s[0]!="number"&&(h=Or(YE,I_(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=M_(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=Bs(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?Ms(s.calculatedDuration):0}get time(){return Ms(this.currentTime)}set time(s){s=Rs(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=Ms(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=ZE,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 JE=new Set(["opacity","clipPath","filter","transform"]);function WE(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=c_(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 XE=$p(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Nc=10,QE=2e4;function eA(n){return qp(n.type)||n.type==="spring"||!l_(n.ease)}function tA(n,s){const i=new em({...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<QE;)o=i.sample(u),c.push(o.value),u+=Nc;return{times:void 0,keyframes:c,duration:u-Nc,ease:"linear"}}const z_={anticipate:h_,backInOut:m_,circInOut:v_};function nA(n){return n in z_}class q0 extends R_{constructor(s){super(s);const{name:i,motionValue:o,element:c,keyframes:u}=this.options;this.resolver=new D_(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"&&Tc()&&nA(u)&&(u=z_[u]),eA(this.options)){const{onComplete:b,onUpdate:_,motionValue:S,element:T,...N}=this.options,j=tA(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=WE(m.owner.current,h,s,{...this.options,duration:o,times:c,ease:u});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(M0(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 Ms(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Ms(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.currentTime=Rs(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 bn;const{animation:o}=i;M0(o,s)}return bn}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 em({...S,keyframes:o,duration:c,type:u,ease:d,times:m,isGenerator:!0}),N=Rs(this.time);g.setWithVelocity(T.sample(N-Nc).value,T.sample(N).value,Nc)}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 XE()&&o&&JE.has(o)&&!h&&!g&&!c&&u!=="mirror"&&d!==0&&m!=="inertia"}}const sA={type:"spring",stiffness:500,damping:25,restSpeed:10},aA=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),iA={type:"keyframes",duration:.8},oA={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},rA=(n,{keyframes:s})=>s.length>2?iA:ai.has(n)?n.startsWith("scale")?aA(s[1]):sA:oA;function lA({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 tm=(n,s,i,o={},c,u)=>d=>{const m=Pp(o,n)||{},h=m.delay||o.delay||0;let{elapsed:g=0}=o;g=g-Rs(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};lA(m)||(v={...v,...rA(n,v)}),v.duration&&(v.duration=Rs(v.duration)),v.repeatDelay&&(v.repeatDelay=Rs(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 PC([])}return!u&&q0.supports(v)?new q0(v):new em(v)};function cA({protectedKeys:n,needsAnimating:s},i){const o=n.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,o}function P_(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&&cA(v,b))continue;const T={delay:i,...Pp(d||{},b)};let N=!1;if(window.MotionHandoffAnimation){const w=o_(n);if(w){const C=window.MotionHandoffAnimation(w,b,ft);C!==null&&(T.startTime=C,N=!0)}}Ff(n,b),_.start(tm(b,_,S,n.shouldReduceMotion&&a_.has(b)?{type:!1}:T,n,N));const j=_.animation;j&&g.push(j)}return m&&Promise.all(g).then(()=>{ft.update(()=>{m&&BC(n,m)})}),g}function tp(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(P_(n,c,i)):()=>Promise.resolve(),m=n.variantChildren&&n.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=u;return uA(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 uA(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(dA).forEach((g,v)=>{g.notify("AnimationStart",s),d.push(tp(g,s,{...u,delay:i+h(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(d)}function dA(n,s){return n.sortNodePosition(s)}function fA(n,s,i={}){n.notify("AnimationStart",s);let o;if(Array.isArray(s)){const c=s.map(u=>tp(n,u,i));o=Promise.all(c)}else if(typeof s=="string")o=tp(n,s,i);else{const c=typeof s=="function"?Pc(n,s,i.custom):s;o=Promise.all(P_(n,c,i))}return o.then(()=>{n.notify("AnimationComplete",s)})}const pA=Cp.length;function V_(n){if(!n)return;if(!n.isControllingVariants){const i=n.parent?V_(n.parent)||{}:{};return n.props.initial!==void 0&&(i.initial=n.props.initial),i}const s={};for(let i=0;i<pA;i++){const o=Cp[i],c=n.props[o];(wr(c)||c===!1)&&(s[o]=c)}return s}const mA=[...jp].reverse(),hA=jp.length;function gA(n){return s=>Promise.all(s.map(({animation:i,options:o})=>fA(n,i,o)))}function vA(n){let s=gA(n),i=F0(),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=V_(n.parent)||{},b=[],_=new Set;let S={},T=1/0;for(let j=0;j<hA;j++){const w=mA[j],C=i[w],A=g[w]!==void 0?g[w]:v[w],M=wr(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=yA(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=q=>{z=!0,_.has(q)&&(Z=!0,_.delete(q)),C.needsAnimating[q]=!0;const te=n.getValue(q);te&&(te.liveStyle=!1)};for(const q in pe){const te=Q[q],re=ae[q];if(S.hasOwnProperty(q))continue;let de=!1;qf(te)&&qf(re)?de=!s_(te,re):de=te!==re,de?te!=null?oe(q):_.add(q):te!==void 0&&_.has(q)?oe(q):C.protectedKeys[q]=!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(q=>({animation:q,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=F0(),o=!0}}}function yA(n,s){return typeof s=="string"?s!==n:Array.isArray(s)?!s_(s,n):!1}function Ha(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function F0(){return{animate:Ha(!0),whileInView:Ha(),whileHover:Ha(),whileTap:Ha(),whileDrag:Ha(),whileFocus:Ha(),exit:Ha()}}class Sa{constructor(s){this.isMounted=!1,this.node=s}update(){}}class bA extends Sa{constructor(s){super(s),s.animationState||(s.animationState=vA(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 _A=0;class xA extends Sa{constructor(){super(...arguments),this.id=_A++}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 SA={animation:{Feature:bA},exit:{Feature:xA}},Kn={x:!1,y:!1};function H_(){return Kn.x||Kn.y}function TA(n){return n==="x"||n==="y"?Kn[n]?null:(Kn[n]=!0,()=>{Kn[n]=!1}):Kn.x||Kn.y?null:(Kn.x=Kn.y=!0,()=>{Kn.x=Kn.y=!1})}const nm=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1;function Er(n,s,i,o={passive:!0}){return n.addEventListener(s,i,o),()=>n.removeEventListener(s,i)}function Ir(n){return{point:{x:n.pageX,y:n.pageY}}}const kA=n=>s=>nm(s)&&n(s,Ir(s));function vr(n,s,i,o){return Er(n,s,kA(i),o)}const Z0=(n,s)=>Math.abs(n-s);function wA(n,s){const i=Z0(n.x,s.x),o=Z0(n.y,s.y);return Math.sqrt(i**2+o**2)}class G_{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=Sf(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,S=wA(b.offset,{x:0,y:0})>=3;if(!_&&!S)return;const{point:T}=b,{timestamp:N}=Zt;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=xf(_,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=Sf(b.type==="pointercancel"?this.lastMoveEventInfo:xf(_,this.transformPagePoint),this.history);this.startEvent&&S&&S(b,j),T&&T(b,j)},!nm(s))return;this.dragSnapToOrigin=u,this.handlers=i,this.transformPagePoint=o,this.contextWindow=c||window;const d=Ir(s),m=xf(d,this.transformPagePoint),{point:h}=m,{timestamp:g}=Zt;this.history=[{...h,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,Sf(m,this.history)),this.removeListeners=Or(vr(this.contextWindow,"pointermove",this.handlePointerMove),vr(this.contextWindow,"pointerup",this.handlePointerUp),vr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),ya(this.updatePoint)}}function xf(n,s){return s?{point:s(n.point)}:n}function K0(n,s){return{x:n.x-s.x,y:n.y-s.y}}function Sf({point:n},s){return{point:n,delta:K0(n,$_(s)),offset:K0(n,NA(s)),velocity:jA(s,.1)}}function NA(n){return n[0]}function $_(n){return n[n.length-1]}function jA(n,s){if(n.length<2)return{x:0,y:0};let i=n.length-1,o=null;const c=$_(n);for(;i>=0&&(o=n[i],!(c.timestamp-o.timestamp>Rs(s)));)i--;if(!o)return{x:0,y:0};const u=Ms(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,CA=1-q_,EA=1+q_,F_=.01,AA=0-F_,DA=0+F_;function _n(n){return n.max-n.min}function RA(n,s,i){return Math.abs(n-s)<=i}function Y0(n,s,i,o=.5){n.origin=o,n.originPoint=gt(s.min,s.max,n.origin),n.scale=_n(i)/_n(s),n.translate=gt(i.min,i.max,n.origin)-n.originPoint,(n.scale>=CA&&n.scale<=EA||isNaN(n.scale))&&(n.scale=1),(n.translate>=AA&&n.translate<=DA||isNaN(n.translate))&&(n.translate=0)}function yr(n,s,i,o){Y0(n.x,s.x,i.x,o?o.originX:void 0),Y0(n.y,s.y,i.y,o?o.originY:void 0)}function J0(n,s,i){n.min=i.min+s.min,n.max=n.min+_n(s)}function MA(n,s,i){J0(n.x,s.x,i.x),J0(n.y,s.y,i.y)}function W0(n,s,i){n.min=s.min-i.min,n.max=n.min+_n(s)}function br(n,s,i){W0(n.x,s.x,i.x),W0(n.y,s.y,i.y)}function OA(n,{min:s,max:i},o){return s!==void 0&&n<s?n=o?gt(s,n,o.min):Math.max(n,s):i!==void 0&&n>i&&(n=o?gt(i,n,o.max):Math.min(n,i)),n}function X0(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 IA(n,{top:s,left:i,bottom:o,right:c}){return{x:X0(n.x,i,c),y:X0(n.y,s,o)}}function Q0(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 BA(n,s){return{x:Q0(n.x,s.x),y:Q0(n.y,s.y)}}function LA(n,s){let i=.5;const o=_n(n),c=_n(s);return c>o?i=ao(s.min,s.max-o,n.min):o>c&&(i=ao(n.min,n.max-c,s.min)),Bs(0,1,i)}function UA(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 np=.35;function zA(n=np){return n===!1?n=0:n===!0&&(n=np),{x:ey(n,"left","right"),y:ey(n,"top","bottom")}}function ey(n,s,i){return{min:ty(n,s),max:ty(n,i)}}function ty(n,s){return typeof n=="number"?n:n[s]||0}const ny=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ki=()=>({x:ny(),y:ny()}),sy=()=>({min:0,max:0}),Nt=()=>({x:sy(),y:sy()});function Bn(n){return[n("x"),n("y")]}function Z_({top:n,left:s,right:i,bottom:o}){return{x:{min:s,max:i},y:{min:n,max:o}}}function PA({x:n,y:s}){return{top:s.min,right:n.max,bottom:s.max,left:n.min}}function VA(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 Tf(n){return n===void 0||n===1}function sp({scale:n,scaleX:s,scaleY:i}){return!Tf(n)||!Tf(s)||!Tf(i)}function Fa(n){return sp(n)||K_(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function K_(n){return ay(n.x)||ay(n.y)}function ay(n){return n&&n!=="0%"}function jc(n,s,i){const o=n-i,c=s*o;return i+c}function iy(n,s,i,o,c){return c!==void 0&&(n=jc(n,c,o)),jc(n,i,o)+s}function ap(n,s=0,i=1,o,c){n.min=iy(n.min,s,i,o,c),n.max=iy(n.max,s,i,o,c)}function Y_(n,{x:s,y:i}){ap(n.x,s.translate,s.scale,s.originPoint),ap(n.y,i.translate,i.scale,i.originPoint)}const oy=.999999999999,ry=1.0000000000001;function HA(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&&Ji(n,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(s.x*=d.x.scale,s.y*=d.y.scale,Y_(n,d)),o&&Fa(u.latestValues)&&Ji(n,u.latestValues))}s.x<ry&&s.x>oy&&(s.x=1),s.y<ry&&s.y>oy&&(s.y=1)}function Yi(n,s){n.min=n.min+s,n.max=n.max+s}function ly(n,s,i,o,c=.5){const u=gt(n.min,n.max,c);ap(n,s,i,u,o)}function Ji(n,s){ly(n.x,s.x,s.scaleX,s.scale,s.originX),ly(n.y,s.y,s.scaleY,s.scale,s.originY)}function J_(n,s){return Z_(VA(n.getBoundingClientRect(),s))}function GA(n,s,i){const o=J_(n,i),{scroll:c}=s;return c&&(Yi(o.x,c.offset.x),Yi(o.y,c.offset.y)),o}const W_=({current:n})=>n?n.ownerDocument.defaultView:null,$A=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=Nt(),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(Ir(v).point)},u=(v,b)=>{const{drag:_,dragPropagation:S,onDragStart:T}=this.getProps();if(_&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=TA(_),!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(is.test(w)){const{projection:C}=this.visualElement;if(C&&C.layout){const A=C.layout.layoutBox[j];A&&(w=_n(A)*(parseFloat(w)/100))}}this.originPoint[j]=w}),T&&ft.postRender(()=>T(v,b)),Ff(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=FA(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 G_(s,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:m,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:W_(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||!ic(s,c,this.currentDirection))return;const u=this.getAxisMotionValue(s);let d=this.originPoint[s]+o[s];this.constraints&&this.constraints[s]&&(d=OA(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&&Fi(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=IA(c.layoutBox,i):this.constraints=!1,this.elastic=zA(o),u!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Bn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=UA(c.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!Fi(s))return!1;const o=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const u=GA(o,c.root,this.visualElement.getTransformPagePoint());let d=BA(c.layout.layoutBox,u);if(i){const m=i(PA(d));this.hasMutatedConstraints=!!m,m&&(d=Z_(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(!ic(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 Ff(this.visualElement,s),o.start(tm(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(!ic(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]-gt(d,m,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:o}=this.visualElement;if(!Fi(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]=LA({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(!ic(d,s,null))return;const m=this.getAxisMotionValue(d),{min:h,max:g}=this.constraints[d];m.set(gt(h,g,c[d]))})}addListeners(){if(!this.visualElement.current)return;$A.set(this.visualElement,this);const s=this.visualElement.current,i=vr(s,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(h)}),o=()=>{const{dragConstraints:h}=this.getProps();Fi(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=Er(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=np,dragMomentum:m=!0}=s;return{...s,drag:i,dragDirectionLock:o,dragPropagation:c,dragConstraints:u,dragElastic:d,dragMomentum:m}}}function ic(n,s,i){return(s===!0||s===n)&&(i===null||i===n)}function FA(n,s=10){let i=null;return Math.abs(n.y)>s?i="y":Math.abs(n.x)>s&&(i="x"),i}class ZA extends Sa{constructor(s){super(s),this.removeGroupControls=bn,this.removeListeners=bn,this.controls=new qA(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||bn}unmount(){this.removeGroupControls(),this.removeListeners()}}const cy=n=>(s,i)=>{n&&ft.postRender(()=>n(s,i))};class KA extends Sa{constructor(){super(...arguments),this.removePointerDownListener=bn}onPointerDown(s){this.session=new G_(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:W_(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:cy(s),onStart:cy(i),onMove:o,onEnd:(u,d)=>{delete this.session,c&&ft.postRender(()=>c(u,d))}}}mount(){this.removePointerDownListener=vr(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 gc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function uy(n,s){return s.max===s.min?0:n/(s.max-s.min)*100}const rr={correct:(n,s)=>{if(!s.target)return n;if(typeof n=="string")if(Te.test(n))n=parseFloat(n);else return n;const i=uy(n,s.target.x),o=uy(n,s.target.y);return`${i}% ${o}%`}},YA={correct:(n,{treeScale:s,projectionDelta:i})=>{const o=n,c=ba.parse(n);if(c.length>5)return o;const u=ba.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=gt(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 JA extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o,layoutId:c}=this.props,{projection:u}=s;SC(WA),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()})),gc.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(),Ap.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 X_(n){const[s,i]=Bb(),o=y.useContext(Tp);return l.jsx(JA,{...n,layoutGroup:o,switchLayoutGroup:y.useContext($b),isPresent:s,safeToRemove:i})}const WA={borderRadius:{...rr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:rr,borderTopRightRadius:rr,borderBottomLeftRadius:rr,borderBottomRightRadius:rr,boxShadow:YA};function XA(n,s,i){const o=Xt(n)?n:jr(n);return o.start(tm("",o,s,i)),o.animation}function QA(n){return n instanceof SVGElement&&n.tagName!=="svg"}const eD=(n,s)=>n.depth-s.depth;class tD{constructor(){this.children=[],this.isDirty=!1}add(s){Vp(this.children,s),this.isDirty=!0}remove(s){Hp(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(eD),this.isDirty=!1,this.children.forEach(s)}}function nD(n,s){const i=os.now(),o=({timestamp:c})=>{const u=c-i;u>=s&&(ya(o),n(u-s))};return ft.read(o,!0),()=>ya(o)}const Q_=["TopLeft","TopRight","BottomLeft","BottomRight"],sD=Q_.length,dy=n=>typeof n=="string"?parseFloat(n):n,fy=n=>typeof n=="number"||Te.test(n);function aD(n,s,i,o,c,u){c?(n.opacity=gt(0,i.opacity!==void 0?i.opacity:1,iD(o)),n.opacityExit=gt(s.opacity!==void 0?s.opacity:1,0,oD(o))):u&&(n.opacity=gt(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,o));for(let d=0;d<sD;d++){const m=`border${Q_[d]}Radius`;let h=py(s,m),g=py(i,m);if(h===void 0&&g===void 0)continue;h||(h=0),g||(g=0),h===0||g===0||fy(h)===fy(g)?(n[m]=Math.max(gt(dy(h),dy(g),o),0),(is.test(g)||is.test(h))&&(n[m]+="%")):n[m]=g}(s.rotate||i.rotate)&&(n.rotate=gt(s.rotate||0,i.rotate||0,o))}function py(n,s){return n[s]!==void 0?n[s]:n.borderRadius}const iD=ex(0,.5,g_),oD=ex(.5,.95,bn);function ex(n,s,i){return o=>o<n?0:o>s?1:i(ao(n,s,o))}function my(n,s){n.min=s.min,n.max=s.max}function Mn(n,s){my(n.x,s.x),my(n.y,s.y)}function hy(n,s){n.translate=s.translate,n.scale=s.scale,n.originPoint=s.originPoint,n.origin=s.origin}function gy(n,s,i,o,c){return n-=s,n=jc(n,1/i,o),c!==void 0&&(n=jc(n,1/c,o)),n}function rD(n,s=0,i=1,o=.5,c,u=n,d=n){if(is.test(s)&&(s=parseFloat(s),s=gt(d.min,d.max,s/100)-d.min),typeof s!="number")return;let m=gt(u.min,u.max,o);n===u&&(m-=s),n.min=gy(n.min,s,i,m,c),n.max=gy(n.max,s,i,m,c)}function vy(n,s,[i,o,c],u,d){rD(n,s[i],s[o],s[c],s.scale,u,d)}const lD=["x","scaleX","originX"],cD=["y","scaleY","originY"];function yy(n,s,i,o){vy(n.x,s,lD,i?i.x:void 0,o?o.x:void 0),vy(n.y,s,cD,i?i.y:void 0,o?o.y:void 0)}function by(n){return n.translate===0&&n.scale===1}function tx(n){return by(n.x)&&by(n.y)}function _y(n,s){return n.min===s.min&&n.max===s.max}function uD(n,s){return _y(n.x,s.x)&&_y(n.y,s.y)}function xy(n,s){return Math.round(n.min)===Math.round(s.min)&&Math.round(n.max)===Math.round(s.max)}function nx(n,s){return xy(n.x,s.x)&&xy(n.y,s.y)}function Sy(n){return _n(n.x)/_n(n.y)}function Ty(n,s){return n.translate===s.translate&&n.scale===s.scale&&n.originPoint===s.originPoint}class dD{constructor(){this.members=[]}add(s){Vp(this.members,s),s.scheduleRender()}remove(s){if(Hp(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 fD(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 Za={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},fr=typeof window<"u"&&window.MotionDebug!==void 0,kf=["","X","Y","Z"],pD={visibility:"hidden"},ky=1e3;let mD=0;function wf(n,s,i,o){const{latestValues:c}=s;c[n]&&(i[n]=c[n],s.setStaticValue(n,0),o&&(o[n]=0))}function sx(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:s}=n.options;if(!s)return;const i=o_(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&&sx(o)}function ax({attachResizeListener:n,defaultParent:s,measureScroll:i,checkIsScrollRoot:o,resetTransform:c}){return class{constructor(d={},m=s==null?void 0:s()){this.id=mD++,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,fr&&(Za.totalNodes=Za.resolvedTargetDeltas=Za.recalculatedProjection=0),this.nodes.forEach(vD),this.nodes.forEach(SD),this.nodes.forEach(TD),this.nodes.forEach(yD),fr&&window.MotionDebug.record(Za)},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 tD)}addEventListener(d,m){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new Gp),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=QA(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=nD(_,250),gc.hasAnimatedSinceResize&&(gc.hasAnimatedSinceResize=!1,this.nodes.forEach(Ny))})}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()||CD,{onLayoutAnimationStart:j,onLayoutAnimationComplete:w}=v.getProps(),C=!this.targetLayout||!nx(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={...Pp(N,"layout"),onPlay:j,onComplete:w};(v.shouldReduceMotion||this.options.layoutRoot)&&(M.delay=0,M.type=!1),this.startAnimation(M)}else _||Ny(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,ya(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(kD),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&&sx(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(wy);return}this.isUpdating||this.nodes.forEach(_D),this.isUpdating=!1,this.nodes.forEach(xD),this.nodes.forEach(hD),this.nodes.forEach(gD),this.clearAllSnapshots();const m=os.now();Zt.delta=Bs(0,1e3/60,m-Zt.timestamp),Zt.timestamp=m,Zt.isProcessing=!0,gf.update.process(Zt),gf.preRender.process(Zt),gf.render.process(Zt),Zt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Ap.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(bD),this.sharedNodes.forEach(wD)}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=Nt(),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&&!tx(this.projectionDelta),h=this.getTransformTemplate(),g=h?h(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;d&&(m||Fa(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)),ED(h),{animationId:this.root.animationId,measuredBox:m,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:m}=this.options;if(!m)return Nt();const h=m.measureViewportBox();if(!(((d=this.scroll)===null||d===void 0?void 0:d.wasRoot)||this.path.some(AD))){const{scroll:v}=this.root;v&&(Yi(h.x,v.offset.x),Yi(h.y,v.offset.y))}return h}removeElementScroll(d){var m;const h=Nt();if(Mn(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&&Mn(h,d),Yi(h.x,b.offset.x),Yi(h.y,b.offset.y))}return h}applyTransform(d,m=!1){const h=Nt();Mn(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&&Ji(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),Fa(v.latestValues)&&Ji(h,v.latestValues)}return Fa(this.latestValues)&&Ji(h,this.latestValues),h}removeTransform(d){const m=Nt();Mn(m,d);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!g.instance||!Fa(g.latestValues))continue;sp(g.latestValues)&&g.updateSnapshot();const v=Nt(),b=g.measurePageBox();Mn(v,b),yy(m,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return Fa(this.latestValues)&&yy(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!==Zt.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=Zt.timestamp,!this.targetDelta&&!this.relativeTarget){const S=this.getClosestProjectingParent();S&&S.layout&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Nt(),this.relativeTargetOrigin=Nt(),br(this.relativeTargetOrigin,this.layout.layoutBox,S.layout.layoutBox),Mn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Nt(),this.targetWithTransforms=Nt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),MA(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Mn(this.target,this.layout.layoutBox),Y_(this.target,this.targetDelta)):Mn(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=Nt(),this.relativeTargetOrigin=Nt(),br(this.relativeTargetOrigin,this.target,S.target),Mn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}fr&&Za.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||sp(this.parent.latestValues)||K_(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===Zt.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;Mn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,S=this.treeScale.y;HA(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=Nt());const{target:T}=m;if(!T){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(hy(this.prevProjectionDelta.x,this.projectionDelta.x),hy(this.prevProjectionDelta.y,this.projectionDelta.y)),yr(this.projectionDelta,this.layoutCorrected,T,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==S||!Ty(this.projectionDelta.x,this.prevProjectionDelta.x)||!Ty(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",T)),fr&&Za.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=Ki(),this.projectionDelta=Ki(),this.projectionDeltaWithTransform=Ki()}setAnimationOrigin(d,m=!1){const h=this.snapshot,g=h?h.latestValues:{},v={...this.latestValues},b=Ki();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!m;const _=Nt(),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(jD));this.animationProgress=0;let A;this.mixTargetDelta=M=>{const D=M/1e3;jy(b.x,d.x,D),jy(b.y,d.y,D),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(br(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ND(this.relativeTarget,this.relativeTargetOrigin,_,D),A&&uD(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Nt()),Mn(A,this.relativeTarget)),N&&(this.animationValues=v,aD(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&&(ya(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ft.update(()=>{gc.hasAnimatedSinceResize=!0,this.currentAnimation=XA(0,ky,{...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(ky),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&&ix(this.options.animationType,this.layout.layoutBox,g.layoutBox)){h=this.target||Nt();const b=_n(this.layout.layoutBox.x);h.x.min=d.target.x.min,h.x.max=h.x.min+b;const _=_n(this.layout.layoutBox.y);h.y.min=d.target.y.min,h.y.max=h.y.min+_}Mn(m,h),Ji(m,v),yr(this.projectionDeltaWithTransform,this.layoutCorrected,m,v)}}registerSharedNode(d,m){this.sharedNodes.has(d)||this.sharedNodes.set(d,new dD),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&&wf("z",d,g,this.animationValues);for(let v=0;v<kf.length;v++)wf(`rotate${kf[v]}`,d,g,this.animationValues),wf(`skew${kf[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 pD;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=mc(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=mc(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!Fa(this.latestValues)&&(N.transform=v?v({},""):"none",this.hasProjected=!1),N}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=fD(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 Sc){if(_[N]===void 0)continue;const{correct:j,applyTo:w}=Sc[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?mc(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(wy),this.root.sharedNodes.clear()}}}function hD(n){n.updateLayout()}function gD(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=_n(_);_.min=o[b].min,_.max=_.min+S}):ix(u,i.layoutBox,o)&&Bn(b=>{const _=d?i.measuredBox[b]:i.layoutBox[b],S=_n(o[b]);_.max=_.min+S,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[b].max=n.relativeTarget[b].min+S)});const m=Ki();yr(m,o,i.layoutBox);const h=Ki();d?yr(h,n.applyTransform(c,!0),i.measuredBox):yr(h,o,i.layoutBox);const g=!tx(m);let v=!1;if(!n.resumeFrom){const b=n.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:S}=b;if(_&&S){const T=Nt();br(T,i.layoutBox,_.layoutBox);const N=Nt();br(N,o,S.layoutBox),nx(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 vD(n){fr&&Za.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 yD(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function bD(n){n.clearSnapshot()}function wy(n){n.clearMeasurements()}function _D(n){n.isLayoutDirty=!1}function xD(n){const{visualElement:s}=n.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),n.resetTransform()}function Ny(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function SD(n){n.resolveTargetDelta()}function TD(n){n.calcProjection()}function kD(n){n.resetSkewAndRotation()}function wD(n){n.removeLeadSnapshot()}function jy(n,s,i){n.translate=gt(s.translate,0,i),n.scale=gt(s.scale,1,i),n.origin=s.origin,n.originPoint=s.originPoint}function Cy(n,s,i,o){n.min=gt(s.min,i.min,o),n.max=gt(s.max,i.max,o)}function ND(n,s,i,o){Cy(n.x,s.x,i.x,o),Cy(n.y,s.y,i.y,o)}function jD(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const CD={duration:.45,ease:[.4,0,.1,1]},Ey=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),Ay=Ey("applewebkit/")&&!Ey("chrome/")?Math.round:bn;function Dy(n){n.min=Ay(n.min),n.max=Ay(n.max)}function ED(n){Dy(n.x),Dy(n.y)}function ix(n,s,i){return n==="position"||n==="preserve-aspect"&&!RA(Sy(s),Sy(i),.2)}function AD(n){var s;return n!==n.root&&((s=n.scroll)===null||s===void 0?void 0:s.wasRoot)}const DD=ax({attachResizeListener:(n,s)=>Er(n,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Nf={current:void 0},ox=ax({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!Nf.current){const n=new DD({});n.mount(window),n.setOptions({layoutScroll:!0}),Nf.current=n}return Nf.current},resetTransform:(n,s)=>{n.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),RD={pan:{Feature:KA},drag:{Feature:ZA,ProjectionNode:ox,MeasureLayout:X_}};function MD(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 rx(n,s){const i=MD(n),o=new AbortController,c={passive:!0,...s,signal:o.signal};return[i,c,()=>o.abort()]}function Ry(n){return s=>{s.pointerType==="touch"||H_()||n(s)}}function OD(n,s,i={}){const[o,c,u]=rx(n,i),d=Ry(m=>{const{target:h}=m,g=s(m);if(typeof g!="function"||!h)return;const v=Ry(b=>{g(b),h.removeEventListener("pointerleave",v)});h.addEventListener("pointerleave",v,c)});return o.forEach(m=>{m.addEventListener("pointerenter",d,c)}),u}function My(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,Ir(s)))}class ID extends Sa{mount(){const{current:s}=this.node;s&&(this.unmount=OD(s,i=>(My(this.node,i,"Start"),o=>My(this.node,o,"End"))))}unmount(){}}class BD extends Sa{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=Or(Er(this.node.current,"focus",()=>this.onFocus()),Er(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const lx=(n,s)=>s?n===s?!0:lx(n,s.parentElement):!1,LD=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function UD(n){return LD.has(n.tagName)||n.tabIndex!==-1}const pr=new WeakSet;function Oy(n){return s=>{s.key==="Enter"&&n(s)}}function jf(n,s){n.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const zD=(n,s)=>{const i=n.currentTarget;if(!i)return;const o=Oy(()=>{if(pr.has(i))return;jf(i,"down");const c=Oy(()=>{jf(i,"up")}),u=()=>jf(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 Iy(n){return nm(n)&&!H_()}function PD(n,s,i={}){const[o,c,u]=rx(n,i),d=m=>{const h=m.currentTarget;if(!Iy(m)||pr.has(h))return;pr.add(h);const g=s(m),v=(S,T)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!Iy(S)||!pr.has(h))&&(pr.delete(h),typeof g=="function"&&g(S,{success:T}))},b=S=>{v(S,i.useGlobalTarget||lx(h,S.target))},_=S=>{v(S,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return o.forEach(m=>{!UD(m)&&m.getAttribute("tabindex")===null&&(m.tabIndex=0),(i.useGlobalTarget?window:m).addEventListener("pointerdown",d,c),m.addEventListener("focus",g=>zD(g,c),c)}),u}function By(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,Ir(s)))}class VD extends Sa{mount(){const{current:s}=this.node;s&&(this.unmount=PD(s,i=>(By(this.node,i,"Start"),(o,{success:c})=>By(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const ip=new WeakMap,Cf=new WeakMap,HD=n=>{const s=ip.get(n.target);s&&s(n)},GD=n=>{n.forEach(HD)};function $D({root:n,...s}){const i=n||document;Cf.has(i)||Cf.set(i,{});const o=Cf.get(i),c=JSON.stringify(s);return o[c]||(o[c]=new IntersectionObserver(GD,{root:n,...s})),o[c]}function qD(n,s,i){const o=$D(s);return ip.set(n,i),o.observe(n),()=>{ip.delete(n),o.unobserve(n)}}const FD={some:0,all:1};class ZD extends Sa{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:FD[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(KD(s,i))&&this.startObserver()}unmount(){}}function KD({viewport:n={}},{viewport:s={}}={}){return i=>n[i]!==s[i]}const YD={inView:{Feature:ZD},tap:{Feature:VD},focus:{Feature:BD},hover:{Feature:ID}},JD={layout:{ProjectionNode:ox,MeasureLayout:X_}},Cc={current:null},sm={current:!1};function cx(){if(sm.current=!0,!!Np)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),s=()=>Cc.current=n.matches;n.addListener(s),s()}else Cc.current=!1}const WD=[...A_,Wt,ba],XD=n=>WD.find(E_(n)),Ly=new WeakMap;function QD(n,s,i){for(const o in s){const c=s[o],u=i[o];if(Xt(c))n.addValue(o,c);else if(Xt(u))n.addValue(o,jr(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,jr(d!==void 0?d:c,{owner:n}))}}for(const o in i)s[o]===void 0&&n.removeValue(o);return s}const Uy=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eR{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=Xp,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=os.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=Hb(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&&Xt(T)&&T.set(h[S],!1)}}mount(s){this.current=s,Ly.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)),sm.current||cx(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Cc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Ly.delete(this.current),this.projection&&this.projection.unmount(),ya(this.notifyUpdate),ya(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=ai.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 so){const i=so[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):Nt()}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<Uy.length;o++){const c=Uy[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=QD(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=jr(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"&&(j_(c)||y_(c))?c=parseFloat(c):!XD(c)&&ba.test(i)&&(c=k_(s,i)),this.setBaseTarget(s,Xt(c)?c.get():c)),Xt(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=Rp(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&&!Xt(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 Gp),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class ux extends eR{constructor(){super(...arguments),this.KeyframeResolver=D_}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;Xt(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function tR(n){return window.getComputedStyle(n)}class nR extends ux{constructor(){super(...arguments),this.type="html",this.renderInstance=Wb}readValueFromInstance(s,i){if(ai.has(i)){const o=Wp(i);return o&&o.default||0}else{const o=tR(s),c=(Kb(i)?o.getPropertyValue(i):o[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return J_(s,i)}build(s,i,o){Ip(s,i,o.transformTemplate)}scrapeMotionValuesFromProps(s,i,o){return zp(s,i,o)}}class sR extends ux{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Nt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(ai.has(i)){const o=Wp(i);return o&&o.default||0}return i=Xb.has(i)?i:Ep(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,o){return t_(s,i,o)}build(s,i,o){Bp(s,i,this.isSVGTag,o.transformTemplate)}renderInstance(s,i,o,c){Qb(s,i,o,c)}mount(s){this.isSVGTag=Up(s.tagName),super.mount(s)}}const aR=(n,s)=>Dp(n)?new sR(s):new nR(s,{allowProjection:n!==y.Fragment}),iR=DC({...SA,...YD,...RD,...JD},aR),Mt=Fj(iR);function oR(){!sm.current&&cx();const[n]=y.useState(Cc.current);return n}const rR="_overlay_cmicx_1",lR="_dialog_cmicx_11",cR="_title_cmicx_30",uR="_description_cmicx_38",dR="_actions_cmicx_45",fR="_cancelButton_cmicx_52",pR="_confirmButton_cmicx_79",Ga={overlay:rR,dialog:lR,title:cR,description:uR,actions:dR,cancelButton:fR,confirmButton:pR};function Xa({isOpen:n,title:s,description:i,confirmLabel:o="Delete",onConfirm:c,onCancel:u}){const d=y.useId(),m=y.useId();return l.jsx(ls,{children:n&&l.jsx(Mt.div,{className:Ga.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(Mt.div,{className:Ga.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:Ga.title,children:s}),i&&l.jsx("p",{id:m,className:Ga.description,children:i}),l.jsxs("div",{className:Ga.actions,children:[l.jsx("button",{type:"button",className:Ga.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),l.jsx("button",{type:"button",className:Ga.confirmButton,onClick:c,children:o})]})]})})})}const mR="_spinner_1uyt1_1",hR="_spin_1uyt1_1",gR="_sm_1uyt1_14",vR="_md_1uyt1_20",yR="_lg_1uyt1_26",bR="_xl_1uyt1_32",zy={spinner:mR,spin:hR,sm:gR,md:vR,lg:yR,xl:bR};function dx({size:n="md",className:s,label:i="Loading",liveRegion:o=!1}){return l.jsx("span",{className:`${zy.spinner} ${zy[n]} ${s??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const _R="_splash_1bn1g_1",xR="_logo_1bn1g_11",Py={splash:_R,logo:xR};function fx(){return l.jsxs("div",{className:Py.splash,"data-testid":"splash-screen",children:[l.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Py.logo}),l.jsx(dx,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const px=50;function SR(n,s,i,o,c=px){return o?n<c:s-n-i<c}function TR(n,s){const i=s-n;return i>0?i:0}function kR({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 _=SR(g.scrollTop,g.scrollHeight,g.clientHeight,i,px);_!==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=TR(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 wR="_wrapper_1rtuy_1",NR="_scrollContainer_1rtuy_9",jR="_toolbar_1rtuy_15",CR="_directionToggle_1rtuy_22",ER="_scrollToAnchor_1rtuy_60",AR="_scrollToAnchorBottom_1rtuy_84",DR="_scrollToAnchorTop_1rtuy_88",RR="_eventOverflowWarning_1rtuy_92",ga={wrapper:wR,scrollContainer:NR,toolbar:jR,directionToggle:CR,scrollToAnchor:ER,scrollToAnchorBottom:AR,scrollToAnchorTop:DR,eventOverflowWarning:RR},mx="grackle-stream-direction";function MR(){try{return localStorage.getItem(mx)==="reversed"}catch{return!1}}function OR({eventsDropped:n}){return n<=0?l.jsx(l.Fragment,{}):l.jsxs("div",{className:ga.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 am({events:n,eventsDropped:s,emptyState:i}){const o=y.useRef(null),[c,u]=y.useState(MR),d=oR(),m=y.useMemo(()=>c?[...n].reverse():n,[n,c]),{isAtAnchor:h,scrollToAnchor:g}=kR({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:ga.wrapper,children:[l.jsx("div",{className:ga.toolbar,children:l.jsx("button",{className:ga.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:ga.scrollContainer,"data-testid":"event-stream-scroll",children:[n.length===0&&i,l.jsx(OR,{eventsDropped:s}),l.jsx(ls,{initial:!1,children:m.map((S,T)=>{const N=c?n.length-1-T:T;return l.jsx(Mt.div,{initial:{opacity:0,y:_},animate:{opacity:1,y:0},transition:{duration:b,ease:"easeOut"},children:l.jsx(Oj,{event:S,toolUseCtx:S.toolUseCtx})},`${S.sessionId}-${S.timestamp}-${N}`)})})]}),l.jsx(ls,{children:!h&&l.jsxs(Mt.button,{className:`${ga.scrollToAnchor} ${c?ga.scrollToAnchorTop:ga.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 im(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 IR="_editFieldWrapper_yuzty_1",BR="_editInput_yuzty_10",LR="_editTextarea_yuzty_42",UR="_editSelect_yuzty_78",zR="_editError_yuzty_111",PR="_editInputInvalid_yuzty_118",VR="_editHint_yuzty_123",HR="_unsavedDot_yuzty_132",GR="_metaValueClickable_yuzty_140",$R="_editButton_yuzty_159",qR="_metaPlaceholder_yuzty_175",FR="_worktreeToggle_yuzty_180",Ye={editFieldWrapper:IR,editInput:BR,editTextarea:LR,editSelect:UR,editError:zR,editInputInvalid:PR,editHint:VR,unsavedDot:HR,metaValueClickable:GR,editButton:$R,metaPlaceholder:qR,worktreeToggle:FR};function Kt(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=im({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 op(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=im({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 Ec(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=im({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 ZR(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 KR="_envRow_1e1r5_1",YR="_envDot_1e1r5_7",JR="_envDotGreen_1e1r5_14",WR="_envDotYellow_1e1r5_18",XR="_envDotRed_1e1r5_22",QR="_envDotGray_1e1r5_26",Wi={envRow:KR,envDot:YR,envDotGreen:JR,envDotYellow:WR,envDotRed:XR,envDotGray:QR};function eM(n){const s=n.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?Wi.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?Wi.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?Wi.envDotRed:Wi.envDotGray}function tM(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:Wi.envRow,children:[l.jsx("span",{className:`${Wi.envDot} ${eM(b.status)}`}),b.displayName]})};return l.jsx(Ec,{value:s,onSave:i,options:_,fieldId:u,activeFieldId:d,onActivate:m,renderDisplay:S,placeholder:h,ariaLabel:g,"data-testid":v})}const nM="_nav_1snmp_1",sM="_searchForm_1snmp_8",aM="_searchInput_1snmp_15",iM="_searchButton_1snmp_33",oM="_clearButton_1snmp_68",rM="_workspaceSelect_1snmp_85",lM="_listHeader_1snmp_99",cM="_nodeList_1snmp_108",uM="_nodeItem_1snmp_116",dM="_indicator_1snmp_129",fM="_label_1snmp_136",pM="_badge_1snmp_145",On={nav:nM,searchForm:sM,searchInput:aM,searchButton:iM,clearButton:oM,workspaceSelect:rM,listHeader:lM,nodeList:cM,nodeItem:uM,indicator:dM,label:fM,badge:pM};function mM({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:On.nav,"data-testid":"knowledge-nav",children:[l.jsxs("form",{className:On.searchForm,onSubmit:v,children:[l.jsx("input",{className:On.searchInput,type:"text",placeholder:"Search...",value:h,onChange:T=>{g(T.target.value)},"data-testid":"knowledge-search-input"}),l.jsx("button",{type:"submit",className:On.searchButton,disabled:i,children:"Go"})]}),o&&l.jsx("button",{type:"button",className:On.clearButton,onClick:b,children:"Clear search"}),l.jsxs("select",{className:On.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:On.listHeader,children:["Nodes (",n.length,")"]}),l.jsx("ul",{className:On.nodeList,children:n.map(T=>l.jsxs("li",{className:On.nodeItem,onClick:()=>{_(T.id)},onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),_(T.id))},role:"button",tabIndex:0,children:[l.jsx("span",{className:On.indicator,style:{backgroundColor:T.kind==="reference"?"#4A9EFF":T.category==="decision"?"#22C55E":T.category==="concept"?"#A855F7":T.category==="snippet"?"#6B7280":"#EAB308"}}),l.jsx("span",{className:On.label,children:T.label}),l.jsx("span",{className:On.badge,children:T.kind==="reference"?T.sourceType:T.category})]},T.id))})]})}const hM="_container_1mq5u_1",gM="_hamburger_1mq5u_33",vM="_brand_1mq5u_49",yM="_brandLogo_1mq5u_68",bM="_info_1mq5u_75",_M="_connectionLabel_1mq5u_90",xM="_connectionDot_1mq5u_103",SM="_connected_1mq5u_106",TM="_disconnected_1mq5u_110",Es={container:hM,hamburger:gM,brand:vM,brandLogo:yM,info:bM,connectionLabel:_M,connectionDot:xM,connected:SM,disconnected:TM};function kM({connected:n,environments:s,sessions:i,onToggleSidebar:o,sidebarOpen:c}){const u=xt(),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:Es.container,children:[o&&l.jsx("button",{type:"button",className:Es.hamburger,onClick:o,"aria-label":"Toggle sidebar","aria-expanded":c,children:"☰"}),l.jsxs("button",{type:"button",className:Es.brand,onClick:()=>u(Wa),title:"Home",children:[l.jsx("img",{src:"/icon-192x192.png",alt:"",className:Es.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]}),l.jsxs("div",{className:Es.info,children:[l.jsxs("span",{"aria-label":n?"Connected":"Disconnected",children:[l.jsx("span",{className:`${Es.connectionDot} ${n?Es.connected:Es.disconnected}`,"aria-hidden":"true",children:"●"})," ",l.jsx("span",{className:Es.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 wM="_nav_13gkc_1",NM="_tab_13gkc_35",jM="_tabIcon_13gkc_68",CM="_tabLabel_13gkc_79",EM="_tabActive_13gkc_84",lr={nav:wM,tab:NM,tabIcon:jM,tabLabel:CM,tabActive:EM},$a=[{view:"dashboard",label:"Dashboard",icon:"🏠",route:Wa,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:"💬",route:K2,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:"📋",route:Y2,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:"🖥️",route:eo,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:"🧠",route:Mb,testId:"sidebar-tab-knowledge"},{view:"settings",label:"Settings",icon:"⚙️",route:$2,testId:"sidebar-tab-settings"}];function AM(n){return n===Wa||n==="/"?"dashboard":n.startsWith("/chat")||n.startsWith("/sessions")?"chat":n.startsWith("/workspaces")||n.startsWith("/environments")?"environments":n.startsWith(Mb)?"knowledge":n.startsWith(Xi)?"settings":"tasks"}function DM(){const n=Bt(),s=xt(),i=y.useRef(null),o=AM(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:$a.findIndex(S=>S.view===o);let v=g;if(d.key==="ArrowRight"||d.key==="j"||d.key==="J")d.preventDefault(),v=(g+1)%$a.length;else if(d.key==="ArrowLeft"||d.key==="k"||d.key==="K")d.preventDefault(),v=(g-1+$a.length)%$a.length;else if(d.key==="Home")d.preventDefault(),v=0;else if(d.key==="End")d.preventDefault(),v=$a.length-1;else return;s($a[v].route),(_=m[v])==null||_.focus()},[o,s]);return l.jsx("nav",{className:lr.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:u,"data-testid":"sidebar-nav",children:$a.map(d=>{const m=d.view===o;return l.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${lr.tab} ${m?lr.tabActive:""}`,onClick:()=>c(d),"data-testid":d.testId,title:d.label,"aria-label":d.label,children:[l.jsx("span",{className:lr.tabIcon,"aria-hidden":"true",children:d.icon}),l.jsx("span",{className:lr.tabLabel,children:d.label})]},d.view)})})}const RM="_container_pi6ii_1",MM="_content_pi6ii_66",Vy={container:RM,content:MM},OM=320,hx=220,gx=600,vx="grackle-sidebar-width";function IM(){try{const n=localStorage.getItem(vx);if(n!==null){const s=Number(n);if(Number.isFinite(s)&&s>=hx&&s<=gx)return s}}catch{}return OM}function BM(n){try{localStorage.setItem(vx,String(n))}catch{}}function LM({content:n}){const[s]=y.useState(IM),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>=hx&&h<=gx&&BM(h)}}});return c.observe(o),()=>{c.disconnect()}},[]),n!==void 0)return l.jsx("div",{className:Vy.container,ref:i,"data-testid":"sidebar",style:{width:s},children:l.jsx("div",{className:Vy.content,children:n})})}const UM="_bar_tnfsh_1",zM="_btnPrimary_tnfsh_32",PM="_statusText_tnfsh_85",VM="_statusCompleted_tnfsh_90",HM="_statusFailed_tnfsh_94",GM="_statusBlocked_tnfsh_98",$M="_hintText_tnfsh_103",ht={bar:UM,btnPrimary:zM,statusText:PM,statusCompleted:VM,statusFailed:HM,statusBlocked:GM,hintText:$M};function qM({sessions:n,tasks:s,environments:i}){const o=xt(),c=Bt(),u=Rt("/sessions/:sessionId"),d=Rt("/tasks/:taskId"),m=Rt("/tasks/:taskId/stream"),h=Rt("/tasks/:taskId/findings"),g=Rt("/tasks/:taskId/edit"),v=Rt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=Rt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),_=Rt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),S=Rt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),T=Rt("/sessions/new"),N=Rt("/environments/:environmentId/workspaces/:workspaceId"),j=Rt("/tasks/new"),w=Rt("/chat"),C=Rt("/"),A=Rt("/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(q=>q.adapterType==="local"&&q.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 q=new Map(s.map(re=>[re.id,re])),te=B.dependsOn.some(re=>{const de=q.get(re);return de!==void 0&&de.status!=="complete"});if(B.status==="not_started"){const re=te?B.dependsOn.map(de=>q.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(ni(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),q=(B==null?void 0:B.status)==="stopped";if(B!==void 0&&!q)return l.jsx(l.Fragment,{});if(q)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(Ab(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 FM="_nav_14i94_1",ZM="_tab_14i94_24",KM="_tabActive_14i94_62",YM="_tabLabel_14i94_75",JM="_statusDot_14i94_81",WM="_pulse_14i94_87",XM="_addButton_14i94_99",QM="_empty_14i94_132",ua={nav:FM,tab:ZM,tabActive:KM,tabLabel:YM,statusDot:JM,pulse:WM,addButton:XM,empty:QM},e3={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function t3({environments:n}){const s=xt(),i=y.useRef(null),o=Rt("/environments/:environmentId"),c=Rt("/environments/:environmentId/edit"),u=Rt("/environments/:environmentId/workspaces/:workspaceId"),d=Rt("/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(to(_))},[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(to(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=e3[_.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(H2),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),n.length===0&&l.jsx("div",{className:ua.empty,children:"No environments yet."})]})}function n3(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 yx({text:n,indices:s,highlightClass:i}){if(!s||s.length===0)return l.jsx(l.Fragment,{children:n});const o=n3(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 s3(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 a3(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 FT){c.add(u);const d=i.get(u);if(d&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const m=va(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=va(u);o.push({status:u,label:m.label,style:m,tasks:d})}return o}const i3="_container_z4i38_1",o3="_header_z4i38_5",r3="_headerActions_z4i38_17",l3="_searchInput_z4i38_23",c3="_searchHighlight_z4i38_56",u3="_groupToggle_z4i38_62",d3="_groupToggleActive_z4i38_89",f3="_addButton_z4i38_93",p3="_taskRow_z4i38_120",m3="_selected_z4i38_140",h3="_expandArrow_z4i38_150",g3="_expanded_z4i38_157",v3="_leafSpacer_z4i38_161",y3="_taskStatusIcon_z4i38_166",b3="_taskTitle_z4i38_170",_3="_workspaceBadge_z4i38_177",x3="_childCountBadge_z4i38_195",S3="_dependencyBadge_z4i38_208",T3="_blockedBadge_z4i38_220",k3="_addChildButton_z4i38_225",w3="_emptyState_z4i38_268",N3="_statusGroupHeader_z4i38_275",j3="_statusGroupIcon_z4i38_294",C3="_statusGroupLabel_z4i38_298",E3="_statusGroupCount_z4i38_303",Ge={container:i3,header:o3,headerActions:r3,searchInput:l3,searchHighlight:c3,groupToggle:u3,groupToggleActive:d3,addButton:f3,taskRow:p3,selected:m3,expandArrow:h3,expanded:g3,leafSpacer:v3,taskStatusIcon:y3,taskTitle:b3,workspaceBadge:_3,childCountBadge:x3,dependencyBadge:S3,blockedBadge:T3,addChildButton:k3,emptyState:w3,statusGroupHeader:N3,statusGroupIcon:j3,statusGroupLabel:C3,statusGroupCount:E3},A3=[{name:"title",weight:2},{name:"description",weight:1}],bx=16,D3=16,_x="grackle-task-group-by-status";function Hy(){try{return localStorage.getItem(_x)==="true"}catch{return!1}}function R3(n){try{localStorage.setItem(_x,String(n))}catch{}}function M3({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(ls,{children:s&&l.jsx(Mt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:n.tasks.map(m=>{const h=va(m.status),g=o===m.id,v=m.parentTaskId||!m.workspaceId?void 0:d.get(m.workspaceId);return l.jsxs("div",{onClick:()=>c(rs(m.id)),className:`${Ge.taskRow} ${g?Ge.selected:""}`,style:{"--task-indent":`${bx}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(yx,{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 xx({node:n,depth:s,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:m,workspaceNames:h}){const g=va(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=bx+s*D3,j=s===0&&!n.parentTaskId&&n.workspaceId?h.get(n.workspaceId):void 0;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{onClick:()=>u(rs(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(yx,{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<lT&&l.jsx("button",{onClick:w=>{w.stopPropagation(),u(ni(n.workspaceId,n.id))},title:"Add child task","aria-label":"Add child task",className:Ge.addChildButton,children:"+"})]}),l.jsx(ls,{children:_&&b&&l.jsx(Mt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:n.children.map(w=>l.jsx(xx,{node:w,depth:s+1,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:m,workspaceNames:h},w.id))})})]})}function O3({workspaces:n,tasks:s}){const i=xt(),[o,c]=y.useState(new Set),[u,d]=y.useState(new Set),[m,h]=y.useState(Hy),[g,v]=y.useState(Hy),[b,_]=y.useState(new Map),S=Rt("/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;R3(oe),h(oe),oe&&(v(!0),_(new Map))},C=oe=>{_(X=>{const B=new Map(X),q=B.has(oe)?B.get(oe):g;return B.set(oe,!q),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(q=>new Set(q).add(oe))):(B.add(oe),d(q=>{const te=new Set(q);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 q of oe)u.has(q)||B.add(q);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=rT(s,D,A3),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 q=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;)q.add(de.parentTaskId),de=te.get(de.parentTaskId)}return{directMatchTaskIds:X,treeMatchTaskIds:q,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?[]:s3(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(ni()),"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?a3(ae,N).map(oe=>l.jsx(M3,{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(xx,{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 I3="_toast_da8ll_1",B3="_success_da8ll_18",L3="_icon_da8ll_22",U3="_error_da8ll_25",z3="_warning_da8ll_32",P3="_info_da8ll_38",V3="_message_da8ll_53",H3="_close_da8ll_60",cr={toast:I3,success:B3,icon:L3,error:U3,warning:z3,info:P3,message:V3,close:H3},G3={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function $3({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(Mt.div,{className:`${cr.toast} ${cr[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:cr.icon,"aria-hidden":"true",children:G3[n.variant]}),l.jsx("span",{className:cr.message,children:n.message}),l.jsx("button",{type:"button",className:cr.close,onClick:()=>s(n.id),"aria-label":"Dismiss notification",children:"×"})]})}const q3="_container_qqse2_1",F3={container:q3};function Z3({toasts:n,onDismiss:s}){return l.jsx("div",{className:F3.container,"data-testid":"toast-container",children:l.jsx(ls,{children:n.map(i=>l.jsx($3,{toast:i,onDismiss:s},i.id))})})}const K3="_callout_1jaue_1",Y3="_success_1jaue_11",J3="_icon_1jaue_15",W3="_error_1jaue_18",X3="_warning_1jaue_25",Q3="_info_1jaue_32",e6="_content_1jaue_48",t6="_close_1jaue_53",ur={callout:K3,success:Y3,icon:J3,error:W3,warning:X3,info:Q3,content:e6,close:t6},n6={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function s6({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:[ur.callout,ur[n],o].filter(Boolean).join(" "),role:n==="error"||n==="warning"?"alert":"status",children:[l.jsx("span",{className:ur.icon,"aria-hidden":"true",children:n6[n]}),l.jsx("span",{className:ur.content,children:s}),i&&l.jsx("button",{type:"button",className:ur.close,onClick:()=>u(!0),"aria-label":"Dismiss",children:"×"})]})})}function a6({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(s6,{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 i6="_container_1pqxm_1",o6="_emptyState_1pqxm_8",r6="_card_1pqxm_14",l6="_cardHeader_1pqxm_34",c6="_categoryBadge_1pqxm_46",u6="_findingTitle_1pqxm_54",d6="_findingDate_1pqxm_60",f6="_findingContent_1pqxm_72",p6="_tags_1pqxm_78",m6="_tag_1pqxm_78",ns={container:i6,emptyState:o6,card:r6,cardHeader:l6,categoryBadge:c6,findingTitle:u6,findingDate:d6,findingContent:f6,tags:p6,tag:m6};function h6(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 Gy={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 g6({findings:n}){return n.length===0?l.jsx("div",{className:ns.emptyState,children:"No findings yet. Agents will post discoveries here."}):l.jsx("div",{className:ns.container,children:n.map((s,i)=>{const o=Gy[s.category]||Gy.general;return l.jsxs(Mt.div,{className:ns.card,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:i*.05,duration:.2},children:[l.jsxs("div",{className:ns.cardHeader,children:[l.jsx("span",{className:ns.categoryBadge,style:{background:o.bg,color:o.text},children:s.category}),l.jsx("span",{className:ns.findingTitle,children:s.title}),l.jsx("span",{className:ns.findingDate,title:s.createdAt,children:h6(s.createdAt)})]}),l.jsx("div",{className:ns.findingContent,children:s.content.length>300?s.content.slice(0,300)+"...":s.content}),s.tags.length>0&&l.jsx("div",{className:ns.tags,children:s.tags.map(c=>l.jsx("span",{className:ns.tag,style:{color:o.text,textShadow:`0 0 8px ${o.text}`},children:c},c))})]},s.id)})})}const v6="_section_1ingb_14",y6="_sectionTitle_1ingb_26",b6="_sectionDescription_1ingb_35",_6="_tokenList_1ingb_48",x6="_tokenRow_1ingb_55",S6="_tokenBadge_1ingb_68",T6="_tokenName_1ingb_83",k6="_tokenTarget_1ingb_90",w6="_deleteButton_1ingb_99",N6="_addForm_1ingb_113",j6="_formRow_1ingb_119",C6="_input_1ingb_125",E6="_select_1ingb_155",A6="_addButton_1ingb_187",D6="_emptyStateInfo_1ingb_221",R6="_themeOptions_1ingb_229",M6="_themeOption_1ingb_229",O6="_themeOptionSelected_1ingb_254",I6="_themeOptionHeader_1ingb_259",B6="_themeOptionLabel_1ingb_266",L6="_themeOptionDesc_1ingb_273",U6="_variantToggle_1ingb_279",z6="_variantButton_1ingb_286",P6="_variantActive_1ingb_305",V6="_themeSwatches_1ingb_311",H6="_themeSwatch_1ingb_311",G6="_systemToggle_1ingb_325",$6="_systemToggleHint_1ingb_341",q6="_themeActive_1ingb_348",F6="_aboutGrid_1ingb_354",Z6="_aboutItem_1ingb_360",K6="_aboutLabel_1ingb_373",Y6="_aboutValue_1ingb_379",J6="_aboutDot_1ingb_387",W6="_aboutDotConnected_1ingb_394",X6="_aboutDotDisconnected_1ingb_398",he={section:v6,sectionTitle:y6,sectionDescription:b6,tokenList:_6,tokenRow:x6,tokenBadge:S6,tokenName:T6,tokenTarget:k6,deleteButton:w6,addForm:N6,formRow:j6,input:C6,select:E6,addButton:A6,emptyStateInfo:D6,themeOptions:R6,themeOption:M6,themeOptionSelected:O6,themeOptionHeader:I6,themeOptionLabel:B6,themeOptionDesc:L6,variantToggle:U6,variantButton:z6,variantActive:P6,themeSwatches:V6,themeSwatch:H6,systemToggle:G6,systemToggleHint:$6,themeActive:q6,aboutGrid:F6,aboutItem:Z6,aboutLabel:K6,aboutValue:Y6,aboutDot:J6,aboutDotConnected:W6,aboutDotDisconnected:X6},Q6=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function eO({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(Xa,{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:Q6.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 Hc=[{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"]}],Sx=new Set(Hc.map(n=>n.id)),$y="grackle";function rp(n){return Hc.find(s=>s.id===n)}function tO({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:Hc.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 nO({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.86.1"})]})]})]})}const sO="_container_cddyd_1",aO="_header_cddyd_8",iO="_headerTitle_cddyd_35",oO="_badge_cddyd_44",rO="_headerActions_cddyd_54",lO="_body_cddyd_61",cO="_formContent_cddyd_73",uO="_section_cddyd_85",dO="_label_cddyd_91",fO="_titleInput_cddyd_98",pO="_descriptionTextarea_cddyd_131",mO="_parentContext_cddyd_167",hO="_parentLabel_cddyd_175",gO="_parentName_cddyd_182",vO="_personaSelect_cddyd_186",yO="_depList_cddyd_220",bO="_depItem_cddyd_226",_O="_depItemSelected_cddyd_248",xO="_noDeps_cddyd_252",SO="_btnPrimary_cddyd_258",TO="_btnGhost_cddyd_289",Ke={container:sO,header:aO,headerTitle:iO,badge:oO,headerActions:rO,body:lO,formContent:cO,section:uO,label:dO,titleInput:fO,descriptionTextarea:pO,parentContext:mO,parentLabel:hO,parentName:gO,personaSelect:vO,depList:yO,depItem:bO,depItemSelected:_O,noDeps:xO,btnPrimary:SO,btnGhost:TO};function Tx({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 _=xt(),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,q]=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),q(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(Lt=>Lt!==me):[...Ce,me])},Oe=()=>{!we||te||S&&T===void 0||(S&&s?(g(s,z.trim(),F,ae,oe),b==null||b("Task updated","success"),v?v():_(rs(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?Qi(i,M):"/tasks",{replace:!0})},me=>{b==null||b(me,"error"),re(!1)})))},le=()=>{if(v){v();return}_(S&&s?rs(s,void 0,C,M):i?Qi(i,M):"/tasks")},fe=S?"edit task":E?"child task":"new task";return l.jsxs("div",{className:Ke.container,children:[l.jsxs("div",{className:Ke.header,children:[l.jsxs("div",{className:Ke.headerTitle,children:[l.jsx("span",{className:Ke.badge,children:fe}),H&&l.jsxs("span",{className:Ke.parentContext,children:[l.jsx("span",{className:Ke.parentLabel,children:"Child of"}),l.jsx("span",{className:Ke.parentName,children:H.title})]})]}),l.jsxs("div",{className:Ke.headerActions,children:[l.jsx("button",{onClick:Oe,disabled:!we||te,className:Ke.btnPrimary,"data-testid":"task-edit-save",children:te?"Creating…":S?"Save Changes":"Create"}),l.jsx("button",{onClick:le,className:Ke.btnGhost,children:"Cancel"})]})]}),l.jsx("div",{className:Ke.body,children:l.jsxs("div",{className:Ke.formContent,children:[D&&l.jsxs("div",{className:Ke.section,children:[l.jsx("label",{className:Ke.label,htmlFor:"task-edit-workspace",children:"Workspace"}),l.jsxs("select",{id:"task-edit-workspace",value:j,onChange:me=>w(me.target.value),className:Ke.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:Ke.section,children:[l.jsx("label",{className:Ke.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:Ke.titleInput,"data-testid":"task-edit-title",onKeyDown:me=>{me.key==="Enter"&&we&&Oe()}})]}),l.jsxs("div",{className:Ke.section,children:[l.jsx("label",{className:Ke.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:Ke.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),l.jsxs("div",{className:Ke.section,children:[l.jsx("label",{className:Ke.label,htmlFor:"task-edit-persona",children:"Default Persona"}),l.jsxs("select",{id:"task-edit-persona",value:oe,onChange:me=>X(me.target.value),className:Ke.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:Ke.section,children:l.jsxs("label",{className:Ke.depItem,"data-testid":"task-edit-can-decompose",children:[l.jsx("input",{type:"checkbox",checked:B,onChange:me=>q(me.target.checked)}),"Can spawn subtasks"]})}),l.jsxs("div",{className:Ke.section,children:[l.jsx("div",{className:Ke.label,children:"Dependencies"}),$e.length===0?l.jsx("div",{className:Ke.noDeps,children:"No other tasks in this workspace"}):l.jsx("div",{className:Ke.depList,children:$e.map(me=>{const Ce=ae.includes(me.id);return l.jsxs("label",{className:`${Ke.depItem} ${Ce?Ke.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 kO="_container_legrg_1",wO="_header_legrg_8",NO="_headerTitle_legrg_35",jO="_badge_legrg_44",CO="_headerActions_legrg_54",EO="_body_legrg_61",AO="_formContent_legrg_73",DO="_section_legrg_85",RO="_label_legrg_91",MO="_nameInput_legrg_98",OO="_fieldInput_legrg_131",IO="_adapterSelect_legrg_164",BO="_readOnlyValue_legrg_198",LO="_codespaceSection_legrg_204",UO="_codespaceActions_legrg_210",zO="_creatingHint_legrg_216",PO="_errorHint_legrg_222",VO="_btnPrimary_legrg_235",HO="_btnGhost_legrg_266",ne={container:kO,header:wO,headerTitle:NO,badge:jO,headerActions:CO,body:EO,formContent:AO,section:DO,label:RO,nameInput:MO,fieldInput:OO,adapterSelect:IO,readOnlyValue:BO,codespaceSection:LO,codespaceActions:UO,creatingHint:zO,errorHint:PO,btnPrimary:VO,btnGhost:HO},vc=1,yc=65535;function Ef(n){if(!n.trim())return!0;const s=Number(n);return Number.isInteger(s)&&s>=vc&&s<=yc}function Af(n){try{const s=JSON.parse(n);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function GO({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 kx({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 _=xt(),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(""),[q,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")&&!Ef(D)),$e=()=>{de()&&(o(N.trim(),w,re()),b==null||b("Environment added successfully","success"),_(eo,{replace:!0}))},we=()=>{_(s?to(s):eo)},Se=y.useCallback((le,fe)=>{if(!T||!s)return;const me=Af(T.adapterConfig),Ce=fe.trim();Ce?me[le]=Ce:delete me[le],c(s,{adapterConfig:me})},[T,s,c]),Oe=y.useCallback((le,fe)=>{if(!T||!s)return;const me=Af(T.adapterConfig);if(fe.trim()){const Ce=Number(fe);Number.isInteger(Ce)&&Ce>=vc&&Ce<=yc&&(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=Af(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(Kt,{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:q,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(Kt,{value:String(le.host??""),onSave:fe=>Se("host",fe),mode:"edit",fieldId:"host",activeFieldId:q,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(Kt,{value:String(le.port??""),onSave:fe=>Oe("port",fe),validate:fe=>Ef(fe)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:q,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(Kt,{value:String(le.host??""),onSave:fe=>Se("host",fe),validate:fe=>fe.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:q,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(Kt,{value:String(le.user??""),onSave:fe=>Se("user",fe),mode:"edit",fieldId:"user",activeFieldId:q,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(Kt,{value:String(le.sshPort??""),onSave:fe=>Oe("sshPort",fe),validate:fe=>Ef(fe)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:q,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(Kt,{value:String(le.identityFile??""),onSave:fe=>Se("identityFile",fe),mode:"edit",fieldId:"identityFile",activeFieldId:q,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(Kt,{value:String(le.image??""),onSave:fe=>Se("image",fe),mode:"edit",fieldId:"image",activeFieldId:q,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(Kt,{value:String(le.repo??""),onSave:fe=>Se("repo",fe),mode:"edit",fieldId:"repo",activeFieldId:q,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(Kt,{value:String(le.codespaceName??""),onSave:fe=>Se("codespaceName",fe),validate:fe=>fe.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:q,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:vc,max:yc,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:vc,max:yc,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(GO,{codespaceName:X,onCodespaceNameChange:B,envName:N,onEnvNameChange:j,codespaces:d,codespaceError:m,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v})]})})]})}const $O="_group_1iprv_1",qO="_groupTitle_1iprv_8",FO="_shortcutList_1iprv_17",ZO="_shortcutRow_1iprv_23",KO="_keys_1iprv_36",YO="_kbd_1iprv_43",JO="_description_1iprv_60",qa={group:$O,groupTitle:qO,shortcutList:FO,shortcutRow:ZO,keys:KO,kbd:YO,description:JO},WO=[{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 XO(){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."}),WO.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 QO="_workpadSection_y8nj9_1",eI="_workpadLabel_y8nj9_9",tI="_workpadStatus_y8nj9_17",nI="_workpadSummary_y8nj9_23",sI="_workpadExtra_y8nj9_29",da={workpadSection:QO,workpadLabel:eI,workpadStatus:tI,workpadSummary:nI,workpadExtra:sI};function aI({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)})]})}const iI=[{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 oI({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:iI.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 rI="_container_10efq_1",lI="_header_10efq_7",cI="_list_10efq_105",uI="_card_10efq_111",dI="_cardHeader_10efq_125",fI="_cardTitle_10efq_135",pI="_defaultBadge_10efq_141",mI="_cardActions_10efq_155",hI="_description_10efq_160",gI="_meta_10efq_166",vI="_empty_10efq_212",yI="_typeBadge_10efq_362",In={container:rI,header:lI,list:cI,card:uI,cardHeader:dI,cardTitle:fI,defaultBadge:pI,cardActions:mI,description:hI,meta:gI,empty:vI,typeBadge:yI};function bI({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:In.container,children:[l.jsxs("div",{className:In.header,children:[l.jsx("h2",{children:"Personas"}),l.jsx(Ds,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),n.length===0?l.jsx("p",{className:In.empty,children:"No personas yet. Create one to get started."}):l.jsx("div",{className:In.list,children:n.map(v=>{const b=s===v.id,_=v.type==="script";return l.jsxs("div",{className:In.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:In.cardHeader,children:[l.jsxs("span",{className:In.cardTitle,children:[l.jsx("strong",{children:v.name}),l.jsx("span",{className:In.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&l.jsx("span",{className:In.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),l.jsxs("div",{className:In.cardActions,onClick:S=>S.stopPropagation(),children:[!b&&l.jsx(Ds,{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(Ds,{variant:"ghost",size:"sm",onClick:()=>u(v.id),children:"Edit"}),l.jsx(Ds,{variant:"ghost",size:"sm",onClick:()=>m(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&l.jsx("p",{className:In.description,children:v.description}),l.jsxs("div",{className:In.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(Xa,{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 _I="_container_uy08i_1",xI="_header_uy08i_7",SI="_count_uy08i_13",TI="_presets_uy08i_18",kI="_presetButton_uy08i_24",wI="_filterInput_uy08i_41",NI="_groups_uy08i_53",jI="_group_uy08i_53",CI="_groupHeader_uy08i_68",EI="_groupName_uy08i_77",AI="_groupCount_uy08i_81",DI="_toolList_uy08i_87",RI="_toolItem_uy08i_95",MI="_toolName_uy08i_103",en={container:_I,header:xI,count:SI,presets:TI,presetButton:kI,filterInput:wI,groups:NI,group:jI,groupHeader:CI,groupName:EI,groupCount:AI,toolList:DI,toolItem:RI,toolName:MI},OI=(()=>{const n=new Map;for(const s of lb){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()}))})(),II=[{name:"default",label:"Default",tools:cb},{name:"worker",label:"Worker",tools:cT},{name:"orchestrator",label:"Orchestrator",tools:uT},{name:"admin",label:"Admin",tools:dT}];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:en.container,"data-testid":"mcp-tool-selector",children:[l.jsx("div",{className:en.header,children:l.jsx("span",{className:en.count,children:n.length===0?`Using default (${cb.length} tools)`:`${n.length} of ${lb.size} tools selected`})}),l.jsxs("div",{className:en.presets,"data-testid":"mcp-tool-presets",children:[II.map(v=>l.jsx("button",{type:"button",className:en.presetButton,disabled:i,onClick:()=>h(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),l.jsx("button",{type:"button",className:en.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),l.jsx("input",{type:"text",className:en.filterInput,placeholder:"Filter tools...",value:o,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),l.jsx("div",{className:en.groups,children:OI.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:en.group,"data-testid":`tool-group-${v}`,children:[l.jsxs("label",{className:en.groupHeader,children:[l.jsx("input",{type:"checkbox",checked:S,onChange:()=>m(_,S),disabled:i,"data-testid":`group-toggle-${v}`}),l.jsx("span",{className:en.groupName,children:v}),l.jsxs("span",{className:en.groupCount,children:["(",_.filter(T=>u.has(T)).length,"/",_.length,")"]})]}),l.jsx("div",{className:en.toolList,children:_.map(T=>l.jsxs("label",{className:en.toolItem,children:[l.jsx("input",{type:"checkbox",checked:u.has(T),onChange:()=>d(T),disabled:i,"data-testid":`tool-${T}`}),l.jsx("span",{className:en.toolName,children:T})]},T))})]},v)})})]})}const BI="_nav_1bhou_1",LI="_tab_1bhou_24",UI="_tabIcon_1bhou_62",zI="_tabActive_1bhou_68",oc={nav:BI,tab:LI,tabIcon:UI,tabActive:zI},As=[{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 PI(){var d;const n=Bt(),s=xt(),i=y.useRef(null),o=((d=As.find(m=>{const h=`${Xi}/${m.path}`;return n.pathname===h||n.pathname.startsWith(`${h}/`)}))==null?void 0:d.path)??As[0].path,c=y.useCallback(m=>{s(`${Xi}/${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:As.findIndex(N=>N.path===o);let b=v;if(m.key==="ArrowDown"||m.key==="j"||m.key==="J")m.preventDefault(),b=(v+1)%As.length;else if(m.key==="ArrowUp"||m.key==="k"||m.key==="K")m.preventDefault(),b=(v-1+As.length)%As.length;else if(m.key==="Home")m.preventDefault(),b=0;else if(m.key==="End")m.preventDefault(),b=As.length-1;else return;const _=As[b].path;s(`${Xi}/${_}`),(T=h[b])==null||T.focus()},[o,s]);return l.jsx("nav",{className:oc.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:As.map(m=>{const h=m.path===o;return l.jsxs("button",{role:"tab",type:"button","aria-selected":h,tabIndex:h?0:-1,className:`${oc.tab} ${h?oc.tabActive:""}`,onClick:()=>c(m.path),children:[l.jsx("span",{className:oc.tabIcon,"aria-hidden":"true",children:m.icon}),m.label]},m.path)})})}function VI({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(f0.map(u=>[u,[]]));for(const u of n){const d=mp(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 f0.map(u=>{const d=va(u);return{status:u,label:d.label,style:d,tasks:c.get(u)??[]}})}const HI="_boardContainer_1c4y1_1",GI="_column_1c4y1_17",$I="_columnHeader_1c4y1_34",qI="_columnIcon_1c4y1_47",FI="_columnLabel_1c4y1_52",ZI="_columnCount_1c4y1_57",KI="_cardList_1c4y1_67",YI="_emptyPlaceholder_1c4y1_76",JI="_card_1c4y1_67",WI="_cardHeader_1c4y1_107",XI="_cardStatusIcon_1c4y1_113",QI="_cardTitle_1c4y1_119",e4="_cardBadges_1c4y1_127",t4="_badge_1c4y1_134",n4="_blockedBadge_1c4y1_146",s4="_childBadge_1c4y1_151",a4="_depBadge_1c4y1_155",i4="_parentBadge_1c4y1_159",o4="_pausedSubBadge_1c4y1_166",r4="_personaBadge_1c4y1_170",l4="_envBadge_1c4y1_174",c4="_emptyCta_1c4y1_178",u4="_ctaButton_1c4y1_188",d4="_ctaDescription_1c4y1_204",Xe={boardContainer:HI,column:GI,columnHeader:$I,columnIcon:qI,columnLabel:FI,columnCount:ZI,cardList:KI,emptyPlaceholder:YI,card:JI,cardHeader:WI,cardStatusIcon:XI,cardTitle:QI,cardBadges:e4,badge:t4,blockedBadge:n4,childBadge:s4,depBadge:a4,parentBadge:i4,pausedSubBadge:o4,personaBadge:r4,envBadge:l4,emptyCta:c4,ctaButton:u4,ctaDescription:d4};function f4({workspaceId:n,environmentId:s,tasks:i,sessions:o,personas:c,environments:u}){const d=xt(),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(()=>VI({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(ni(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(ls,{mode:"popLayout",children:_.tasks.map(S=>l.jsx(Mt.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:l.jsx(p4,{boardTask:S,tasksById:g,personaName:v.personaNameByTaskId.get(S.task.id),envName:v.environmentNameByTaskId.get(S.task.id),onClick:()=>d(rs(S.task.id,void 0,n,s))})},S.task.id))})})]},_.status))})}function p4({boardTask:n,tasksById:s,personaName:i,envName:o,onClick:c}){const{task:u,isBlocked:d,childCount:m,doneChildCount:h,pausedSubBadge:g}=n,v=va(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 m4="_formContent_ymnez_1",h4="_section_ymnez_13",g4="_label_ymnez_19",v4="_titleInput_ymnez_26",y4="_descriptionTextarea_ymnez_58",b4="_selectField_ymnez_94",_4="_checkboxRow_ymnez_128",x4="_checkboxLabel_ymnez_141",S4="_fieldError_ymnez_146",ut={formContent:m4,section:h4,label:g4,titleInput:v4,descriptionTextarea:y4,selectField:b4,checkboxRow:_4,checkboxLabel:x4,fieldError:S4};function T4(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 k4=100;function w4({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:k4,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 wx=y.createContext(void 0),N4=4e3;function j4({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=N4)=>{const g=`toast-${++o.current}`;i(v=>[...v,{id:g,message:d,variant:m,duration:h}])},[]);return l.jsx(wx.Provider,{value:{toasts:s,showToast:u,dismissToast:c},children:n})}function un(){const n=y.useContext(wx);if(!n)throw new Error("useToast must be used within ToastProvider");return n}const lp="grackle-theme",Nx="grackle-prefer-system",jx="(prefers-color-scheme: dark)";let mr=[],bc;function Df(){bc=void 0;for(const n of mr)n()}function cp(){return typeof window>"u"?!1:window.matchMedia(jx).matches}function _r(){if(typeof localStorage>"u")return $y;try{const n=localStorage.getItem(lp);if(n!==null&&Sx.has(n))return n}catch{}return $y}function Ac(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(Nx)==="true"}catch{return!1}}function up(n){return Hc.find(s=>s.variantLightId===n||s.variantDarkId===n)}function Cx(n,s){const i=rp(n);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?cp()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const o=up(n);if(o!=null&&o.variantLightId&&o.variantDarkId)return cp()?o.variantDarkId:o.variantLightId}return n}function qi(n,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=Cx(n,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&qi(_r(),Ac());function C4(){return bc===void 0&&(bc={themeId:_r(),systemDark:cp(),preferSystem:Ac()}),bc}function E4(n){return mr=[...mr,n],()=>{mr=mr.filter(s=>s!==n)}}function A4(){const n=y.useSyncExternalStore(E4,C4),{themeId:s,preferSystem:i}=n,o=Cx(s,i),c=y.useCallback(d=>{if(Sx.has(d)){try{localStorage.setItem(lp,d)}catch{}qi(d,Ac(),!0),Df()}},[]),u=y.useCallback(d=>{try{localStorage.setItem(Nx,d?"true":"false")}catch{}if(d){const m=_r(),h=rp(m);if(h!=null&&h.hidden){const g=up(m);if(g)try{localStorage.setItem(lp,g.id)}catch{}}}qi(_r(),d,!0),Df()},[]);return y.useEffect(()=>{qi(s,i)},[s,i]),y.useEffect(()=>{if(typeof window>"u")return;const d=window.matchMedia(jx),m=()=>{const h=_r(),g=Ac();if(g){const v=rp(h);if(v!=null&&v.variantDarkId&&v.variantLightId&&qi(h,g),v!=null&&v.hidden){const b=up(h);b!=null&&b.variantDarkId&&b.variantLightId&&qi(h,g)}}Df()};return d.addEventListener("change",m),()=>{d.removeEventListener("change",m)}},[]),{themeId:s,setTheme:c,resolvedThemeId:o,preferSystem:i,setPreferSystem:u}}const Ex=y.createContext(void 0);function D4({children:n}){const s=A4();return l.jsx(Ex.Provider,{value:s,children:n})}function Ax(){const n=y.useContext(Ex);if(!n)throw new Error("useThemeContext must be used within ThemeProvider");return n}const Dx=y.createContext(void 0),Rx=y.createContext(void 0);function R4({children:n}){const[s,i]=y.useState(void 0),o=y.useCallback(c=>{i(c)},[]);return l.jsx(Rx.Provider,{value:o,children:l.jsx(Dx.Provider,{value:s,children:n})})}function M4(){return y.useContext(Dx)}function O4(){const n=y.useContext(Rx);if(n===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return n}const om=y.createContext(void 0);function pt(){const n=y.useContext(om);if(!n)throw new Error("useGrackle must be used within GrackleProvider");return n}function Mx(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function Ox(n,s){return console.warn(`[ws] Malformed "${n}" message: ${s}`),!1}function I4(n){return Mx(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 B4=new Set(["off","subscription","api_key"]),rc=new Set(["off","on"]);function L4(n){return Mx(n)&&B4.has(n.claude)&&rc.has(n.github)&&rc.has(n.copilot)&&rc.has(n.codex)&&rc.has(n.goose)}function Ix(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 Bx(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 $i=5e3;function U4(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 Qa={label:"Home",url:Wa};function z4(n){return n?[Qa,{label:"Settings",url:Xi},{label:n,url:void 0}]:[Qa,{label:"Settings",url:void 0}]}const Lx={label:"Environments",url:eo};function P4(){return[Qa,{label:"Environments",url:void 0}]}function V4(){return[Qa,{label:"New Chat",url:void 0}]}function H4(n){return[Qa,{label:`Session ${n.slice(0,8)}`,url:void 0}]}function G4(n,s,i,o){const c=i.find(d=>d.id===n),u=o.find(d=>d.id===s);return[Qa,Lx,{label:(u==null?void 0:u.displayName)??"Environment",url:to(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function $4(n,s,i,o,c){const u=U4(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=[Qa];v&&g&&(b.push(Lx),b.push({label:v.displayName,url:to(g)})),h&&g&&b.push({label:h.name,url:Qi(h.id,g)});for(let S=0;S<u.length-1;S++)b.push({label:u[S].title,url:rs(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 rm(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 lm(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 q4(n,s,i){const o=n.filter(h=>h.status==="running"||h.status==="idle"||h.status==="waiting").length,c=Ux(s),u=s.filter(h=>dp(h,c)).length,d=s.filter(h=>h.status==="paused"||h.status==="failed"||dp(h,c)).length,m=i.filter(h=>h.status==="disconnected"||h.status==="error").length;return{activeSessions:o,blockedTasks:u,attentionTasks:d,unhealthyEnvironments:m}}function Ux(n){const s=new Map;for(const i of n)s.set(i.id,i.status);return s}function dp(n,s){return n.dependsOn.some(i=>s.get(i)!=="complete")}function F4(n,s){var d;const i=new Map;for(const m of s)i.set(m.id,m);const o=Ux(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}):dp(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 Z4(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 K4(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 ss=[{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
62
+ `),()=>{document.head.removeChild(v)}},[s]),l.jsx(Ij,{isPresent:s,childRef:o,sizeRef:c,children:y.cloneElement(n,{ref:o})})}const Lj=({children:n,initial:s,isPresent:i,onExitComplete:o,custom:c,presenceAffectsLayout:u,mode:d})=>{const m=kp(Uj),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(Bj,{isPresent:i,children:n})),l.jsx(Bc.Provider,{value:v,children:n})};function Uj(){return new Map}function Bb(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 nc=n=>n.key||"";function k0(n){const s=[];return y.Children.forEach(n,i=>{y.isValidElement(i)&&s.push(i)}),s}const Np=typeof window<"u",Lb=Np?y.useLayoutEffect:y.useEffect,ls=({children:n,custom:s,initial:i=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:u="sync",propagate:d=!1})=>{const[m,h]=Bb(d),g=y.useMemo(()=>k0(n),[n]),v=d&&!m?[]:g.map(nc),b=y.useRef(!0),_=y.useRef(g),S=kp(()=>new Map),[T,N]=y.useState(g),[j,w]=y.useState(g);Lb(()=>{b.current=!1,_.current=g;for(let M=0;M<j.length;M++){const D=nc(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=nc(E);v.includes(H)||(M.splice(D,0,E),C.push(E))}u==="wait"&&C.length&&(M=C),w(k0(M)),N(g);return}const{forceRender:A}=y.useContext(Tp);return l.jsx(l.Fragment,{children:j.map(M=>{const D=nc(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(Lj,{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)})})},bn=n=>n;let Ub=bn;const zj={useManualTiming:!1};function Pj(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 sc=["read","resolveKeyframes","update","preRender","render","postRender"],Vj=40;function zb(n,s){let i=!1,o=!0;const c={delta:0,timestamp:0,isProcessing:!1},u=()=>i=!0,d=sc.reduce((w,C)=>(w[C]=Pj(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,Vj),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:sc.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<sc.length;C++)d[sc[C]].cancel(w)},state:c,steps:d}}const{schedule:ft,cancel:ya,state:Zt,steps:gf}=zb(typeof requestAnimationFrame<"u"?requestAnimationFrame:bn,!0),Pb=y.createContext({strict:!1}),w0={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"]},so={};for(const n in w0)so[n]={isEnabled:s=>w0[n].some(i=>!!s[i])};function Hj(n){for(const s in n)so[s]={...so[s],...n[s]}}const Gj=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 xc(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||Gj.has(n)}let Vb=n=>!xc(n);function $j(n){n&&(Vb=s=>s.startsWith("on")?!xc(s):n(s))}try{$j(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"||(Vb(c)||i===!0&&xc(c)||!s&&!xc(c)||n.draggable&&c.startsWith("onDrag"))&&(o[c]=n[c]);return o}function Fj(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 wr(n){return typeof n=="string"||Array.isArray(n)}function Uc(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const jp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Cp=["initial",...jp];function zc(n){return Uc(n.animate)||Cp.some(s=>wr(n[s]))}function Hb(n){return!!(zc(n)||n.variants)}function Zj(n,s){if(zc(n)){const{initial:i,animate:o}=n;return{initial:i===!1||wr(i)?i:void 0,animate:wr(o)?o:void 0}}return n.inherit!==!1?s:{}}function Kj(n){const{initial:s,animate:i}=Zj(n,y.useContext(Lc));return y.useMemo(()=>({initial:s,animate:i}),[N0(s),N0(i)])}function N0(n){return Array.isArray(n)?n.join(" "):n}const Yj=Symbol.for("motionComponentSymbol");function Fi(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function Jj(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):Fi(i)&&(i.current=o))},[s])}const Ep=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Wj="framerAppearId",Gb="data-"+Ep(Wj),{schedule:Ap}=zb(queueMicrotask,!1),$b=y.createContext({});function Xj(n,s,i,o,c){var u,d;const{visualElement:m}=y.useContext(Lc),h=y.useContext(Pb),g=y.useContext(Bc),v=y.useContext(wp).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($b);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&Qj(b.current,i,c,S);const T=y.useRef(!1);y.useInsertionEffect(()=>{_&&T.current&&_.update(i,g)});const N=i[Gb],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 Lb(()=>{_&&(T.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),Ap.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 Qj(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&&Fi(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 eC({preloadedFeatures:n,createVisualElement:s,useRender:i,useVisualState:o,Component:c}){var u,d;n&&Hj(n);function m(g,v){let b;const _={...y.useContext(wp),...g,layoutId:tC(g)},{isStatic:S}=_,T=Kj(g),N=o(g,S);if(!S&&Np){nC();const j=sC(_);b=j.MeasureLayout,T.visualElement=Xj(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,Jj(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[Yj]=c,h}function tC({layoutId:n}){const s=y.useContext(Tp).id;return s&&n!==void 0?s+"-"+n:n}function nC(n,s){y.useContext(Pb).strict}function sC(n){const{drag:s,layout:i}=so;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 aC=["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 Dp(n){return typeof n!="string"||n.includes("-")?!1:!!(aC.indexOf(n)>-1||/[A-Z]/u.test(n))}function j0(n){const s=[{},{}];return n==null||n.values.forEach((i,o)=>{s[0][o]=i.get(),s[1][o]=i.getVelocity()}),s}function Rp(n,s,i,o){if(typeof s=="function"){const[c,u]=j0(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]=j0(o);s=s(i!==void 0?i:n.custom,c,u)}return s}const qf=n=>Array.isArray(n),iC=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),oC=n=>qf(n)?n[n.length-1]||0:n,Xt=n=>!!(n&&n.getVelocity);function mc(n){const s=Xt(n)?n.get():n;return iC(s)?s.toValue():s}function rC({scrapeMotionValuesFromProps:n,createRenderState:s,onUpdate:i},o,c,u){const d={latestValues:lC(o,c,u,n),renderState:s()};return i&&(d.onMount=m=>i({props:o,current:m,...d}),d.onUpdate=m=>i(m)),d}const Fb=n=>(s,i)=>{const o=y.useContext(Lc),c=y.useContext(Bc),u=()=>rC(n,s,o,c);return i?u():kp(u)};function lC(n,s,i,o){const c={},u=o(n,{});for(const _ in u)c[_]=mc(u[_]);let{initial:d,animate:m}=n;const h=zc(n),g=Hb(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=Rp(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 lo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ai=new Set(lo),Zb=n=>s=>typeof s=="string"&&s.startsWith(n),Kb=Zb("--"),cC=Zb("var(--"),Mp=n=>cC(n)?uC.test(n.split("/*")[0].trim()):!1,uC=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Yb=(n,s)=>s&&typeof n=="number"?s.transform(n):n,Bs=(n,s,i)=>i>s?s:i<n?n:i,co={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},Nr={...co,transform:n=>Bs(0,1,n)},ac={...co,default:1},Rr=n=>({test:s=>typeof s=="string"&&s.endsWith(n)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${n}`}),ha=Rr("deg"),is=Rr("%"),Te=Rr("px"),dC=Rr("vh"),fC=Rr("vw"),C0={...is,parse:n=>is.parse(n)/100,transform:n=>is.transform(n*100)},pC={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},mC={rotate:ha,rotateX:ha,rotateY:ha,rotateZ:ha,scale:ac,scaleX:ac,scaleY:ac,scaleZ:ac,skew:ha,skewX:ha,skewY:ha,distance:Te,translateX:Te,translateY:Te,translateZ:Te,x:Te,y:Te,z:Te,perspective:Te,transformPerspective:Te,opacity:Nr,originX:C0,originY:C0,originZ:Te},E0={...co,transform:Math.round},Op={...pC,...mC,zIndex:E0,size:Te,fillOpacity:Nr,strokeOpacity:Nr,numOctaves:E0},hC={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},gC=lo.length;function vC(n,s,i){let o="",c=!0;for(let u=0;u<gC;u++){const d=lo[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=Yb(m,Op[d]);if(!h){c=!1;const v=hC[d]||d;o+=`${v}(${g}) `}i&&(s[d]=g)}}return o=o.trim(),i?o=i(s,c?"":o):c&&(o="none"),o}function Ip(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(ai.has(h)){d=!0;continue}else if(Kb(h)){c[h]=g;continue}else{const v=Yb(g,Op[h]);h.startsWith("origin")?(m=!0,u[h]=v):o[h]=v}}if(s.transform||(d||i?o.transform=vC(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 yC={offset:"stroke-dashoffset",array:"stroke-dasharray"},bC={offset:"strokeDashoffset",array:"strokeDasharray"};function _C(n,s,i=1,o=0,c=!0){n.pathLength=1;const u=c?yC:bC;n[u.offset]=Te.transform(-o);const d=Te.transform(s),m=Te.transform(i);n[u.array]=`${d} ${m}`}function A0(n,s,i){return typeof n=="string"?n:Te.transform(s+i*n)}function xC(n,s,i){const o=A0(s,n.x,n.width),c=A0(i,n.y,n.height);return`${o} ${c}`}function Bp(n,{attrX:s,attrY:i,attrScale:o,originX:c,originY:u,pathLength:d,pathSpacing:m=1,pathOffset:h=0,...g},v,b){if(Ip(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=xC(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&&_C(_,d,m,h,!1)}const Lp=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Jb=()=>({...Lp(),attrs:{}}),Up=n=>typeof n=="string"&&n.toLowerCase()==="svg";function Wb(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 Xb=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 Qb(n,s,i,o){Wb(n,s,void 0,o);for(const c in s.attrs)n.setAttribute(Xb.has(c)?c:Ep(c),s.attrs[c])}const Sc={};function SC(n){Object.assign(Sc,n)}function e_(n,{layout:s,layoutId:i}){return ai.has(n)||n.startsWith("origin")||(s||i!==void 0)&&(!!Sc[n]||n==="opacity")}function zp(n,s,i){var o;const{style:c}=n,u={};for(const d in c)(Xt(c[d])||s.style&&Xt(s.style[d])||e_(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 t_(n,s,i){const o=zp(n,s,i);for(const c in n)if(Xt(n[c])||Xt(s[c])){const u=lo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;o[u]=n[c]}return o}function TC(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 D0=["x","y","width","height","cx","cy","r"],kC={useVisualState:Fb({scrapeMotionValuesFromProps:t_,createRenderState:Jb,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(ai.has(m)){u=!0;break}}if(!u)return;let d=!s;if(s)for(let m=0;m<D0.length;m++){const h=D0[m];n[h]!==s[h]&&(d=!0)}d&&ft.read(()=>{TC(i,o),ft.render(()=>{Bp(o,c,Up(i.tagName),n.transformTemplate),Qb(i,o)})})}})},wC={useVisualState:Fb({scrapeMotionValuesFromProps:zp,createRenderState:Lp})};function n_(n,s,i){for(const o in s)!Xt(s[o])&&!e_(o,i)&&(n[o]=s[o])}function NC({transformTemplate:n},s){return y.useMemo(()=>{const i=Lp();return Ip(i,s,n),Object.assign({},i.vars,i.style)},[s])}function jC(n,s){const i=n.style||{},o={};return n_(o,i,n),Object.assign(o,NC(n,s)),o}function CC(n,s){const i={},o=jC(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 EC(n,s,i,o){const c=y.useMemo(()=>{const u=Jb();return Bp(u,s,Up(o),n.transformTemplate),{...u.attrs,style:{...u.style}}},[s]);if(n.style){const u={};n_(u,n.style,n),c.style={...u,...c.style}}return c}function AC(n=!1){return(i,o,c,{latestValues:u},d)=>{const h=(Dp(i)?EC:CC)(o,u,d,i),g=qj(o,typeof i=="string",n),v=i!==y.Fragment?{...g,...h,ref:c}:{},{children:b}=o,_=y.useMemo(()=>Xt(b)?b.get():b,[b]);return y.createElement(i,{...v,children:_})}}function DC(n,s){return function(o,{forwardMotionProps:c}={forwardMotionProps:!1}){const d={...Dp(o)?kC:wC,preloadedFeatures:n,useRender:AC(c),createVisualElement:s,Component:o};return eC(d)}}function s_(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 Rp(o,s,i!==void 0?i:o.custom,n)}function Pp(n,s){return n?n[s]||n.default||n:void 0}const a_=new Set(["width","height","top","left","right","bottom",...lo]);let hc;function RC(){hc=void 0}const os={now:()=>(hc===void 0&&os.set(Zt.isProcessing||zj.useManualTiming?Zt.timestamp:performance.now()),hc),set:n=>{hc=n,queueMicrotask(RC)}};function Vp(n,s){n.indexOf(s)===-1&&n.push(s)}function Hp(n,s){const i=n.indexOf(s);i>-1&&n.splice(i,1)}class Gp{constructor(){this.subscriptions=[]}add(s){return Vp(this.subscriptions,s),()=>Hp(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 i_(n,s){return s?n*(1e3/s):0}const R0=30,MC=n=>!isNaN(parseFloat(n));class OC{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(o,c=!0)=>{const u=os.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=os.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=MC(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 Gp);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=os.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>R0)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,R0);return i_(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 jr(n,s){return new OC(n,s)}function IC(n,s,i){n.hasValue(s)?n.getValue(s).set(i):n.addValue(s,jr(i))}function BC(n,s){const i=Pc(n,s);let{transitionEnd:o={},transition:c={},...u}=i||{};u={...u,...o};for(const d in u){const m=oC(u[d]);IC(n,d,m)}}function LC(n){return!!(Xt(n)&&n.add)}function Ff(n,s){const i=n.getValue("willChange");if(LC(i))return i.add(s)}function o_(n){return n.props[Gb]}function $p(n){let s;return()=>(s===void 0&&(s=n()),s)}const UC=$p(()=>window.ScrollTimeline!==void 0);class zC{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(UC()&&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 PC extends zC{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Rs=n=>n*1e3,Ms=n=>n/1e3;function qp(n){return typeof n=="function"}function M0(n,s){n.timeline=s,n.onfinish=null}const Fp=n=>Array.isArray(n)&&typeof n[0]=="number",VC={linearEasing:void 0};function HC(n,s){const i=$p(n);return()=>{var o;return(o=VC[s])!==null&&o!==void 0?o:i()}}const Tc=HC(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ao=(n,s,i)=>{const o=s-n;return o===0?1:(i-n)/o},r_=(n,s,i=10)=>{let o="";const c=Math.max(Math.round(s/i),2);for(let u=0;u<c;u++)o+=n(ao(0,c-1,u))+", ";return`linear(${o.substring(0,o.length-2)})`};function l_(n){return!!(typeof n=="function"&&Tc()||!n||typeof n=="string"&&(n in Zf||Tc())||Fp(n)||Array.isArray(n)&&n.every(l_))}const dr=([n,s,i,o])=>`cubic-bezier(${n}, ${s}, ${i}, ${o})`,Zf={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:dr([0,.65,.55,1]),circOut:dr([.55,0,1,.45]),backIn:dr([.31,.01,.66,-.59]),backOut:dr([.33,1.53,.69,.99])};function c_(n,s){if(n)return typeof n=="function"&&Tc()?r_(n,s):Fp(n)?dr(n):Array.isArray(n)?n.map(i=>c_(i,s)||Zf.easeOut):Zf[n]}const u_=(n,s,i)=>(((1-3*i+3*s)*n+(3*i-6*s))*n+3*s)*n,GC=1e-7,$C=12;function qC(n,s,i,o,c){let u,d,m=0;do d=s+(i-s)/2,u=u_(d,o,c)-n,u>0?i=d:s=d;while(Math.abs(u)>GC&&++m<$C);return d}function Mr(n,s,i,o){if(n===s&&i===o)return bn;const c=u=>qC(u,0,1,n,i);return u=>u===0||u===1?u:u_(c(u),s,o)}const d_=n=>s=>s<=.5?n(2*s)/2:(2-n(2*(1-s)))/2,f_=n=>s=>1-n(1-s),p_=Mr(.33,1.53,.69,.99),Zp=f_(p_),m_=d_(Zp),h_=n=>(n*=2)<1?.5*Zp(n):.5*(2-Math.pow(2,-10*(n-1))),Kp=n=>1-Math.sin(Math.acos(n)),g_=f_(Kp),v_=d_(Kp),y_=n=>/^0[^.\s]+$/u.test(n);function FC(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||y_(n):!0}const gr=n=>Math.round(n*1e5)/1e5,Yp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ZC(n){return n==null}const KC=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Jp=(n,s)=>i=>!!(typeof i=="string"&&KC.test(i)&&i.startsWith(n)||s&&!ZC(i)&&Object.prototype.hasOwnProperty.call(i,s)),b_=(n,s,i)=>o=>{if(typeof o!="string")return o;const[c,u,d,m]=o.match(Yp);return{[n]:parseFloat(c),[s]:parseFloat(u),[i]:parseFloat(d),alpha:m!==void 0?parseFloat(m):1}},YC=n=>Bs(0,255,n),vf={...co,transform:n=>Math.round(YC(n))},Ka={test:Jp("rgb","red"),parse:b_("red","green","blue"),transform:({red:n,green:s,blue:i,alpha:o=1})=>"rgba("+vf.transform(n)+", "+vf.transform(s)+", "+vf.transform(i)+", "+gr(Nr.transform(o))+")"};function JC(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 Kf={test:Jp("#"),parse:JC,transform:Ka.transform},Zi={test:Jp("hsl","hue"),parse:b_("hue","saturation","lightness"),transform:({hue:n,saturation:s,lightness:i,alpha:o=1})=>"hsla("+Math.round(n)+", "+is.transform(gr(s))+", "+is.transform(gr(i))+", "+gr(Nr.transform(o))+")"},Wt={test:n=>Ka.test(n)||Kf.test(n)||Zi.test(n),parse:n=>Ka.test(n)?Ka.parse(n):Zi.test(n)?Zi.parse(n):Kf.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Ka.transform(n):Zi.transform(n)},WC=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function XC(n){var s,i;return isNaN(n)&&typeof n=="string"&&(((s=n.match(Yp))===null||s===void 0?void 0:s.length)||0)+(((i=n.match(WC))===null||i===void 0?void 0:i.length)||0)>0}const __="number",x_="color",QC="var",eE="var(",O0="${}",tE=/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 Cr(n){const s=n.toString(),i=[],o={color:[],number:[],var:[]},c=[];let u=0;const m=s.replace(tE,h=>(Wt.test(h)?(o.color.push(u),c.push(x_),i.push(Wt.parse(h))):h.startsWith(eE)?(o.var.push(u),c.push(QC),i.push(h)):(o.number.push(u),c.push(__),i.push(parseFloat(h))),++u,O0)).split(O0);return{values:i,split:m,indexes:o,types:c}}function S_(n){return Cr(n).values}function T_(n){const{split:s,types:i}=Cr(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===__?u+=gr(c[d]):m===x_?u+=Wt.transform(c[d]):u+=c[d]}return u}}const nE=n=>typeof n=="number"?0:n;function sE(n){const s=S_(n);return T_(n)(s.map(nE))}const ba={test:XC,parse:S_,createTransformer:T_,getAnimatableNone:sE},aE=new Set(["brightness","contrast","saturate","opacity"]);function iE(n){const[s,i]=n.slice(0,-1).split("(");if(s==="drop-shadow")return n;const[o]=i.match(Yp)||[];if(!o)return n;const c=i.replace(o,"");let u=aE.has(s)?1:0;return o!==i&&(u*=100),s+"("+u+c+")"}const oE=/\b([a-z-]*)\(.*?\)/gu,Yf={...ba,getAnimatableNone:n=>{const s=n.match(oE);return s?s.map(iE).join(" "):n}},rE={...Op,color:Wt,backgroundColor:Wt,outlineColor:Wt,fill:Wt,stroke:Wt,borderColor:Wt,borderTopColor:Wt,borderRightColor:Wt,borderBottomColor:Wt,borderLeftColor:Wt,filter:Yf,WebkitFilter:Yf},Wp=n=>rE[n];function k_(n,s){let i=Wp(n);return i!==Yf&&(i=ba),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const lE=new Set(["auto","none","0"]);function cE(n,s,i){let o=0,c;for(;o<n.length&&!c;){const u=n[o];typeof u=="string"&&!lE.has(u)&&Cr(u).values.length&&(c=n[o]),o++}if(c&&i)for(const u of s)n[u]=k_(i,c)}const I0=n=>n===co||n===Te,B0=(n,s)=>parseFloat(n.split(", ")[s]),L0=(n,s)=>(i,{transform:o})=>{if(o==="none"||!o)return 0;const c=o.match(/^matrix3d\((.+)\)$/u);if(c)return B0(c[1],s);{const u=o.match(/^matrix\((.+)\)$/u);return u?B0(u[1],n):0}},uE=new Set(["x","y","z"]),dE=lo.filter(n=>!uE.has(n));function fE(n){const s=[];return dE.forEach(i=>{const o=n.getValue(i);o!==void 0&&(s.push([i,o.get()]),o.set(i.startsWith("scale")?1:0))}),s}const io={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:L0(4,13),y:L0(5,14)};io.translateX=io.x;io.translateY=io.y;const Ja=new Set;let Jf=!1,Wf=!1;function w_(){if(Wf){const n=Array.from(Ja).filter(o=>o.needsMeasurement),s=new Set(n.map(o=>o.element)),i=new Map;s.forEach(o=>{const c=fE(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)})}Wf=!1,Jf=!1,Ja.forEach(n=>n.complete()),Ja.clear()}function N_(){Ja.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(Wf=!0)})}function pE(){N_(),w_()}class Xp{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?(Ja.add(this),Jf||(Jf=!0,ft.read(N_),ft.resolveKeyframes(w_))):(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),Ja.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ja.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const j_=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),mE=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function hE(n){const s=mE.exec(n);if(!s)return[,];const[,i,o,c]=s;return[`--${i??o}`,c]}function C_(n,s,i=1){const[o,c]=hE(n);if(!o)return;const u=window.getComputedStyle(s).getPropertyValue(o);if(u){const d=u.trim();return j_(d)?parseFloat(d):d}return Mp(c)?C_(c,s,i+1):c}const E_=n=>s=>s.test(n),gE={test:n=>n==="auto",parse:n=>n},A_=[co,Te,is,ha,fC,dC,gE],U0=n=>A_.find(E_(n));class D_ extends Xp{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(),Mp(g))){const v=C_(g,i.current);v!==void 0&&(s[h]=v),h===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!a_.has(o)||s.length!==2)return;const[c,u]=s,d=U0(c),m=U0(u);if(d!==m)if(I0(d)&&I0(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++)FC(s[c])&&o.push(c);o.length&&cE(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=io[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]=io[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 z0=(n,s)=>s==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(ba.test(n)||n==="0")&&!n.startsWith("url("));function vE(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 yE(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=z0(c,s),m=z0(u,s);return!d||!m?!1:vE(n)||(i==="spring"||qp(i))&&o}const bE=n=>n!==null;function Vc(n,{repeat:s,repeatType:i="loop"},o){const c=n.filter(bE),u=s&&i!=="loop"&&s%2===1?0:c.length-1;return!u||o===void 0?c[u]:o}const _E=40;class R_{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=os.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>_E?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&pE(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=os.now(),this.hasAttemptedResolve=!0;const{name:o,type:c,velocity:u,delay:d,onComplete:m,onUpdate:h,isGenerator:g}=this.options;if(!g&&!yE(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 Xf=2e4;function M_(n){let s=0;const i=50;let o=n.next(s);for(;!o.done&&s<Xf;)s+=i,o=n.next(s);return s>=Xf?1/0:s}const gt=(n,s,i)=>n+(s-n)*i;function yf(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 xE({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=yf(h,m,n+1/3),u=yf(h,m,n),d=yf(h,m,n-1/3)}return{red:Math.round(c*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:o}}function kc(n,s){return i=>i>0?s:n}const bf=(n,s,i)=>{const o=n*n,c=i*(s*s-o)+o;return c<0?0:Math.sqrt(c)},SE=[Kf,Ka,Zi],TE=n=>SE.find(s=>s.test(n));function P0(n){const s=TE(n);if(!s)return!1;let i=s.parse(n);return s===Zi&&(i=xE(i)),i}const V0=(n,s)=>{const i=P0(n),o=P0(s);if(!i||!o)return kc(n,s);const c={...i};return u=>(c.red=bf(i.red,o.red,u),c.green=bf(i.green,o.green,u),c.blue=bf(i.blue,o.blue,u),c.alpha=gt(i.alpha,o.alpha,u),Ka.transform(c))},kE=(n,s)=>i=>s(n(i)),Or=(...n)=>n.reduce(kE),Qf=new Set(["none","hidden"]);function wE(n,s){return Qf.has(n)?i=>i<=0?n:s:i=>i>=1?s:n}function NE(n,s){return i=>gt(n,s,i)}function Qp(n){return typeof n=="number"?NE:typeof n=="string"?Mp(n)?kc:Wt.test(n)?V0:EE:Array.isArray(n)?O_:typeof n=="object"?Wt.test(n)?V0:jE:kc}function O_(n,s){const i=[...n],o=i.length,c=n.map((u,d)=>Qp(u)(u,s[d]));return u=>{for(let d=0;d<o;d++)i[d]=c[d](u);return i}}function jE(n,s){const i={...n,...s},o={};for(const c in i)n[c]!==void 0&&s[c]!==void 0&&(o[c]=Qp(n[c])(n[c],s[c]));return c=>{for(const u in o)i[u]=o[u](c);return i}}function CE(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 EE=(n,s)=>{const i=ba.createTransformer(s),o=Cr(n),c=Cr(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?Qf.has(n)&&!c.values.length||Qf.has(s)&&!o.values.length?wE(n,s):Or(O_(CE(o,c),c.values),i):kc(n,s)};function I_(n,s,i){return typeof n=="number"&&typeof s=="number"&&typeof i=="number"?gt(n,s,i):Qp(n)(n,s)}const AE=5;function B_(n,s,i){const o=Math.max(s-AE,0);return i_(i-n(o),s-o)}const bt={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},_f=.001;function DE({duration:n=bt.duration,bounce:s=bt.bounce,velocity:i=bt.velocity,mass:o=bt.mass}){let c,u,d=1-s;d=Bs(bt.minDamping,bt.maxDamping,d),n=Bs(bt.minDuration,bt.maxDuration,Ms(n)),d<1?(c=g=>{const v=g*d,b=v*n,_=v-i,S=ep(g,d),T=Math.exp(-b);return _f-_/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=ep(Math.pow(g,2),d);return(-c(g)+_f>0?-1:1)*((_-S)*T)/N}):(c=g=>{const v=Math.exp(-g*n),b=(g-i)*n+1;return-_f+v*b},u=g=>{const v=Math.exp(-g*n),b=(i-g)*(n*n);return v*b});const m=5/n,h=ME(c,u,m);if(n=Rs(n),isNaN(h))return{stiffness:bt.stiffness,damping:bt.damping,duration:n};{const g=Math.pow(h,2)*o;return{stiffness:g,damping:d*2*Math.sqrt(o*g),duration:n}}}const RE=12;function ME(n,s,i){let o=i;for(let c=1;c<RE;c++)o=o-n(o)/s(o);return o}function ep(n,s){return n*Math.sqrt(1-s*s)}const OE=["duration","bounce"],IE=["stiffness","damping","mass"];function H0(n,s){return s.some(i=>n[i]!==void 0)}function BE(n){let s={velocity:bt.velocity,stiffness:bt.stiffness,damping:bt.damping,mass:bt.mass,isResolvedFromDuration:!1,...n};if(!H0(n,IE)&&H0(n,OE))if(n.visualDuration){const i=n.visualDuration,o=2*Math.PI/(i*1.2),c=o*o,u=2*Bs(.05,1,1-(n.bounce||0))*Math.sqrt(c);s={...s,mass:bt.mass,stiffness:c,damping:u}}else{const i=DE(n);s={...s,...i,mass:bt.mass},s.isResolvedFromDuration=!0}return s}function L_(n=bt.visualDuration,s=bt.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}=BE({...i,velocity:-Ms(i.velocity||0)}),T=_||0,N=g/(2*Math.sqrt(h*v)),j=d-u,w=Ms(Math.sqrt(h/v)),C=Math.abs(j)<5;o||(o=C?bt.restSpeed.granular:bt.restSpeed.default),c||(c=C?bt.restDelta.granular:bt.restDelta.default);let A;if(N<1){const D=ep(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?Rs(T):B_(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_(M),Xf),E=r_(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=L_({keyframes:[_.value,T(_.value)],velocity:B_(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 LE=Mr(.42,0,1,1),UE=Mr(0,0,.58,1),U_=Mr(.42,0,.58,1),zE=n=>Array.isArray(n)&&typeof n[0]!="number",PE={linear:bn,easeIn:LE,easeInOut:U_,easeOut:UE,circIn:Kp,circInOut:v_,circOut:g_,backIn:Zp,backInOut:m_,backOut:p_,anticipate:h_},$0=n=>{if(Fp(n)){Ub(n.length===4);const[s,i,o,c]=n;return Mr(s,i,o,c)}else if(typeof n=="string")return PE[n];return n};function VE(n,s,i){const o=[],c=i||I_,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]||bn:s;m=Or(h,m)}o.push(m)}return o}function HE(n,s,{clamp:i=!0,ease:o,mixer:c}={}){const u=n.length;if(Ub(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=VE(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 _=ao(n[b],n[b+1],v);return m[b](_)};return i?v=>g(Bs(n[0],n[u-1],v)):g}function GE(n,s){const i=n[n.length-1];for(let o=1;o<=s;o++){const c=ao(0,s,o);n.push(gt(i,1,c))}}function $E(n){const s=[0];return GE(s,n.length-1),s}function qE(n,s){return n.map(i=>i*s)}function FE(n,s){return n.map(()=>s||U_).splice(0,n.length-1)}function wc({duration:n=300,keyframes:s,times:i,ease:o="easeInOut"}){const c=zE(o)?o.map($0):$0(o),u={done:!1,value:s[0]},d=qE(i&&i.length===s.length?i:$E(s),n),m=HE(d,s,{ease:Array.isArray(c)?c:FE(s,c)});return{calculatedDuration:n,next:h=>(u.value=m(h),u.done=h>=n,u)}}const ZE=n=>{const s=({timestamp:i})=>n(i);return{start:()=>ft.update(s,!0),stop:()=>ya(s),now:()=>Zt.isProcessing?Zt.timestamp:os.now()}},KE={decay:G0,inertia:G0,tween:wc,keyframes:wc,spring:L_},YE=n=>n/100;class em extends R_{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)||Xp,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:KE[i]||wc;let h,g;m!==wc&&typeof s[0]!="number"&&(h=Or(YE,I_(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=M_(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=Bs(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?Ms(s.calculatedDuration):0}get time(){return Ms(this.currentTime)}set time(s){s=Rs(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=Ms(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=ZE,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 JE=new Set(["opacity","clipPath","filter","transform"]);function WE(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=c_(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 XE=$p(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Nc=10,QE=2e4;function eA(n){return qp(n.type)||n.type==="spring"||!l_(n.ease)}function tA(n,s){const i=new em({...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<QE;)o=i.sample(u),c.push(o.value),u+=Nc;return{times:void 0,keyframes:c,duration:u-Nc,ease:"linear"}}const z_={anticipate:h_,backInOut:m_,circInOut:v_};function nA(n){return n in z_}class q0 extends R_{constructor(s){super(s);const{name:i,motionValue:o,element:c,keyframes:u}=this.options;this.resolver=new D_(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"&&Tc()&&nA(u)&&(u=z_[u]),eA(this.options)){const{onComplete:b,onUpdate:_,motionValue:S,element:T,...N}=this.options,j=tA(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=WE(m.owner.current,h,s,{...this.options,duration:o,times:c,ease:u});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(M0(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 Ms(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Ms(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.currentTime=Rs(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 bn;const{animation:o}=i;M0(o,s)}return bn}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 em({...S,keyframes:o,duration:c,type:u,ease:d,times:m,isGenerator:!0}),N=Rs(this.time);g.setWithVelocity(T.sample(N-Nc).value,T.sample(N).value,Nc)}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 XE()&&o&&JE.has(o)&&!h&&!g&&!c&&u!=="mirror"&&d!==0&&m!=="inertia"}}const sA={type:"spring",stiffness:500,damping:25,restSpeed:10},aA=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),iA={type:"keyframes",duration:.8},oA={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},rA=(n,{keyframes:s})=>s.length>2?iA:ai.has(n)?n.startsWith("scale")?aA(s[1]):sA:oA;function lA({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 tm=(n,s,i,o={},c,u)=>d=>{const m=Pp(o,n)||{},h=m.delay||o.delay||0;let{elapsed:g=0}=o;g=g-Rs(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};lA(m)||(v={...v,...rA(n,v)}),v.duration&&(v.duration=Rs(v.duration)),v.repeatDelay&&(v.repeatDelay=Rs(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 PC([])}return!u&&q0.supports(v)?new q0(v):new em(v)};function cA({protectedKeys:n,needsAnimating:s},i){const o=n.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,o}function P_(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&&cA(v,b))continue;const T={delay:i,...Pp(d||{},b)};let N=!1;if(window.MotionHandoffAnimation){const w=o_(n);if(w){const C=window.MotionHandoffAnimation(w,b,ft);C!==null&&(T.startTime=C,N=!0)}}Ff(n,b),_.start(tm(b,_,S,n.shouldReduceMotion&&a_.has(b)?{type:!1}:T,n,N));const j=_.animation;j&&g.push(j)}return m&&Promise.all(g).then(()=>{ft.update(()=>{m&&BC(n,m)})}),g}function tp(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(P_(n,c,i)):()=>Promise.resolve(),m=n.variantChildren&&n.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=u;return uA(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 uA(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(dA).forEach((g,v)=>{g.notify("AnimationStart",s),d.push(tp(g,s,{...u,delay:i+h(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(d)}function dA(n,s){return n.sortNodePosition(s)}function fA(n,s,i={}){n.notify("AnimationStart",s);let o;if(Array.isArray(s)){const c=s.map(u=>tp(n,u,i));o=Promise.all(c)}else if(typeof s=="string")o=tp(n,s,i);else{const c=typeof s=="function"?Pc(n,s,i.custom):s;o=Promise.all(P_(n,c,i))}return o.then(()=>{n.notify("AnimationComplete",s)})}const pA=Cp.length;function V_(n){if(!n)return;if(!n.isControllingVariants){const i=n.parent?V_(n.parent)||{}:{};return n.props.initial!==void 0&&(i.initial=n.props.initial),i}const s={};for(let i=0;i<pA;i++){const o=Cp[i],c=n.props[o];(wr(c)||c===!1)&&(s[o]=c)}return s}const mA=[...jp].reverse(),hA=jp.length;function gA(n){return s=>Promise.all(s.map(({animation:i,options:o})=>fA(n,i,o)))}function vA(n){let s=gA(n),i=F0(),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=V_(n.parent)||{},b=[],_=new Set;let S={},T=1/0;for(let j=0;j<hA;j++){const w=mA[j],C=i[w],A=g[w]!==void 0?g[w]:v[w],M=wr(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=yA(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=q=>{z=!0,_.has(q)&&(Z=!0,_.delete(q)),C.needsAnimating[q]=!0;const te=n.getValue(q);te&&(te.liveStyle=!1)};for(const q in pe){const te=Q[q],re=ae[q];if(S.hasOwnProperty(q))continue;let de=!1;qf(te)&&qf(re)?de=!s_(te,re):de=te!==re,de?te!=null?oe(q):_.add(q):te!==void 0&&_.has(q)?oe(q):C.protectedKeys[q]=!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(q=>({animation:q,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=F0(),o=!0}}}function yA(n,s){return typeof s=="string"?s!==n:Array.isArray(s)?!s_(s,n):!1}function Ha(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function F0(){return{animate:Ha(!0),whileInView:Ha(),whileHover:Ha(),whileTap:Ha(),whileDrag:Ha(),whileFocus:Ha(),exit:Ha()}}class Sa{constructor(s){this.isMounted=!1,this.node=s}update(){}}class bA extends Sa{constructor(s){super(s),s.animationState||(s.animationState=vA(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 _A=0;class xA extends Sa{constructor(){super(...arguments),this.id=_A++}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 SA={animation:{Feature:bA},exit:{Feature:xA}},Kn={x:!1,y:!1};function H_(){return Kn.x||Kn.y}function TA(n){return n==="x"||n==="y"?Kn[n]?null:(Kn[n]=!0,()=>{Kn[n]=!1}):Kn.x||Kn.y?null:(Kn.x=Kn.y=!0,()=>{Kn.x=Kn.y=!1})}const nm=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1;function Er(n,s,i,o={passive:!0}){return n.addEventListener(s,i,o),()=>n.removeEventListener(s,i)}function Ir(n){return{point:{x:n.pageX,y:n.pageY}}}const kA=n=>s=>nm(s)&&n(s,Ir(s));function vr(n,s,i,o){return Er(n,s,kA(i),o)}const Z0=(n,s)=>Math.abs(n-s);function wA(n,s){const i=Z0(n.x,s.x),o=Z0(n.y,s.y);return Math.sqrt(i**2+o**2)}class G_{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=Sf(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,S=wA(b.offset,{x:0,y:0})>=3;if(!_&&!S)return;const{point:T}=b,{timestamp:N}=Zt;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=xf(_,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=Sf(b.type==="pointercancel"?this.lastMoveEventInfo:xf(_,this.transformPagePoint),this.history);this.startEvent&&S&&S(b,j),T&&T(b,j)},!nm(s))return;this.dragSnapToOrigin=u,this.handlers=i,this.transformPagePoint=o,this.contextWindow=c||window;const d=Ir(s),m=xf(d,this.transformPagePoint),{point:h}=m,{timestamp:g}=Zt;this.history=[{...h,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,Sf(m,this.history)),this.removeListeners=Or(vr(this.contextWindow,"pointermove",this.handlePointerMove),vr(this.contextWindow,"pointerup",this.handlePointerUp),vr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),ya(this.updatePoint)}}function xf(n,s){return s?{point:s(n.point)}:n}function K0(n,s){return{x:n.x-s.x,y:n.y-s.y}}function Sf({point:n},s){return{point:n,delta:K0(n,$_(s)),offset:K0(n,NA(s)),velocity:jA(s,.1)}}function NA(n){return n[0]}function $_(n){return n[n.length-1]}function jA(n,s){if(n.length<2)return{x:0,y:0};let i=n.length-1,o=null;const c=$_(n);for(;i>=0&&(o=n[i],!(c.timestamp-o.timestamp>Rs(s)));)i--;if(!o)return{x:0,y:0};const u=Ms(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,CA=1-q_,EA=1+q_,F_=.01,AA=0-F_,DA=0+F_;function _n(n){return n.max-n.min}function RA(n,s,i){return Math.abs(n-s)<=i}function Y0(n,s,i,o=.5){n.origin=o,n.originPoint=gt(s.min,s.max,n.origin),n.scale=_n(i)/_n(s),n.translate=gt(i.min,i.max,n.origin)-n.originPoint,(n.scale>=CA&&n.scale<=EA||isNaN(n.scale))&&(n.scale=1),(n.translate>=AA&&n.translate<=DA||isNaN(n.translate))&&(n.translate=0)}function yr(n,s,i,o){Y0(n.x,s.x,i.x,o?o.originX:void 0),Y0(n.y,s.y,i.y,o?o.originY:void 0)}function J0(n,s,i){n.min=i.min+s.min,n.max=n.min+_n(s)}function MA(n,s,i){J0(n.x,s.x,i.x),J0(n.y,s.y,i.y)}function W0(n,s,i){n.min=s.min-i.min,n.max=n.min+_n(s)}function br(n,s,i){W0(n.x,s.x,i.x),W0(n.y,s.y,i.y)}function OA(n,{min:s,max:i},o){return s!==void 0&&n<s?n=o?gt(s,n,o.min):Math.max(n,s):i!==void 0&&n>i&&(n=o?gt(i,n,o.max):Math.min(n,i)),n}function X0(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 IA(n,{top:s,left:i,bottom:o,right:c}){return{x:X0(n.x,i,c),y:X0(n.y,s,o)}}function Q0(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 BA(n,s){return{x:Q0(n.x,s.x),y:Q0(n.y,s.y)}}function LA(n,s){let i=.5;const o=_n(n),c=_n(s);return c>o?i=ao(s.min,s.max-o,n.min):o>c&&(i=ao(n.min,n.max-c,s.min)),Bs(0,1,i)}function UA(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 np=.35;function zA(n=np){return n===!1?n=0:n===!0&&(n=np),{x:ey(n,"left","right"),y:ey(n,"top","bottom")}}function ey(n,s,i){return{min:ty(n,s),max:ty(n,i)}}function ty(n,s){return typeof n=="number"?n:n[s]||0}const ny=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ki=()=>({x:ny(),y:ny()}),sy=()=>({min:0,max:0}),Nt=()=>({x:sy(),y:sy()});function Bn(n){return[n("x"),n("y")]}function Z_({top:n,left:s,right:i,bottom:o}){return{x:{min:s,max:i},y:{min:n,max:o}}}function PA({x:n,y:s}){return{top:s.min,right:n.max,bottom:s.max,left:n.min}}function VA(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 Tf(n){return n===void 0||n===1}function sp({scale:n,scaleX:s,scaleY:i}){return!Tf(n)||!Tf(s)||!Tf(i)}function Fa(n){return sp(n)||K_(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function K_(n){return ay(n.x)||ay(n.y)}function ay(n){return n&&n!=="0%"}function jc(n,s,i){const o=n-i,c=s*o;return i+c}function iy(n,s,i,o,c){return c!==void 0&&(n=jc(n,c,o)),jc(n,i,o)+s}function ap(n,s=0,i=1,o,c){n.min=iy(n.min,s,i,o,c),n.max=iy(n.max,s,i,o,c)}function Y_(n,{x:s,y:i}){ap(n.x,s.translate,s.scale,s.originPoint),ap(n.y,i.translate,i.scale,i.originPoint)}const oy=.999999999999,ry=1.0000000000001;function HA(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&&Ji(n,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(s.x*=d.x.scale,s.y*=d.y.scale,Y_(n,d)),o&&Fa(u.latestValues)&&Ji(n,u.latestValues))}s.x<ry&&s.x>oy&&(s.x=1),s.y<ry&&s.y>oy&&(s.y=1)}function Yi(n,s){n.min=n.min+s,n.max=n.max+s}function ly(n,s,i,o,c=.5){const u=gt(n.min,n.max,c);ap(n,s,i,u,o)}function Ji(n,s){ly(n.x,s.x,s.scaleX,s.scale,s.originX),ly(n.y,s.y,s.scaleY,s.scale,s.originY)}function J_(n,s){return Z_(VA(n.getBoundingClientRect(),s))}function GA(n,s,i){const o=J_(n,i),{scroll:c}=s;return c&&(Yi(o.x,c.offset.x),Yi(o.y,c.offset.y)),o}const W_=({current:n})=>n?n.ownerDocument.defaultView:null,$A=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=Nt(),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(Ir(v).point)},u=(v,b)=>{const{drag:_,dragPropagation:S,onDragStart:T}=this.getProps();if(_&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=TA(_),!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(is.test(w)){const{projection:C}=this.visualElement;if(C&&C.layout){const A=C.layout.layoutBox[j];A&&(w=_n(A)*(parseFloat(w)/100))}}this.originPoint[j]=w}),T&&ft.postRender(()=>T(v,b)),Ff(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=FA(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 G_(s,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:m,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:W_(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||!ic(s,c,this.currentDirection))return;const u=this.getAxisMotionValue(s);let d=this.originPoint[s]+o[s];this.constraints&&this.constraints[s]&&(d=OA(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&&Fi(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=IA(c.layoutBox,i):this.constraints=!1,this.elastic=zA(o),u!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Bn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=UA(c.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!Fi(s))return!1;const o=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const u=GA(o,c.root,this.visualElement.getTransformPagePoint());let d=BA(c.layout.layoutBox,u);if(i){const m=i(PA(d));this.hasMutatedConstraints=!!m,m&&(d=Z_(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(!ic(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 Ff(this.visualElement,s),o.start(tm(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(!ic(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]-gt(d,m,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:o}=this.visualElement;if(!Fi(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]=LA({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(!ic(d,s,null))return;const m=this.getAxisMotionValue(d),{min:h,max:g}=this.constraints[d];m.set(gt(h,g,c[d]))})}addListeners(){if(!this.visualElement.current)return;$A.set(this.visualElement,this);const s=this.visualElement.current,i=vr(s,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(h)}),o=()=>{const{dragConstraints:h}=this.getProps();Fi(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=Er(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=np,dragMomentum:m=!0}=s;return{...s,drag:i,dragDirectionLock:o,dragPropagation:c,dragConstraints:u,dragElastic:d,dragMomentum:m}}}function ic(n,s,i){return(s===!0||s===n)&&(i===null||i===n)}function FA(n,s=10){let i=null;return Math.abs(n.y)>s?i="y":Math.abs(n.x)>s&&(i="x"),i}class ZA extends Sa{constructor(s){super(s),this.removeGroupControls=bn,this.removeListeners=bn,this.controls=new qA(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||bn}unmount(){this.removeGroupControls(),this.removeListeners()}}const cy=n=>(s,i)=>{n&&ft.postRender(()=>n(s,i))};class KA extends Sa{constructor(){super(...arguments),this.removePointerDownListener=bn}onPointerDown(s){this.session=new G_(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:W_(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:cy(s),onStart:cy(i),onMove:o,onEnd:(u,d)=>{delete this.session,c&&ft.postRender(()=>c(u,d))}}}mount(){this.removePointerDownListener=vr(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 gc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function uy(n,s){return s.max===s.min?0:n/(s.max-s.min)*100}const rr={correct:(n,s)=>{if(!s.target)return n;if(typeof n=="string")if(Te.test(n))n=parseFloat(n);else return n;const i=uy(n,s.target.x),o=uy(n,s.target.y);return`${i}% ${o}%`}},YA={correct:(n,{treeScale:s,projectionDelta:i})=>{const o=n,c=ba.parse(n);if(c.length>5)return o;const u=ba.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=gt(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 JA extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o,layoutId:c}=this.props,{projection:u}=s;SC(WA),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()})),gc.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(),Ap.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 X_(n){const[s,i]=Bb(),o=y.useContext(Tp);return l.jsx(JA,{...n,layoutGroup:o,switchLayoutGroup:y.useContext($b),isPresent:s,safeToRemove:i})}const WA={borderRadius:{...rr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:rr,borderTopRightRadius:rr,borderBottomLeftRadius:rr,borderBottomRightRadius:rr,boxShadow:YA};function XA(n,s,i){const o=Xt(n)?n:jr(n);return o.start(tm("",o,s,i)),o.animation}function QA(n){return n instanceof SVGElement&&n.tagName!=="svg"}const eD=(n,s)=>n.depth-s.depth;class tD{constructor(){this.children=[],this.isDirty=!1}add(s){Vp(this.children,s),this.isDirty=!0}remove(s){Hp(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(eD),this.isDirty=!1,this.children.forEach(s)}}function nD(n,s){const i=os.now(),o=({timestamp:c})=>{const u=c-i;u>=s&&(ya(o),n(u-s))};return ft.read(o,!0),()=>ya(o)}const Q_=["TopLeft","TopRight","BottomLeft","BottomRight"],sD=Q_.length,dy=n=>typeof n=="string"?parseFloat(n):n,fy=n=>typeof n=="number"||Te.test(n);function aD(n,s,i,o,c,u){c?(n.opacity=gt(0,i.opacity!==void 0?i.opacity:1,iD(o)),n.opacityExit=gt(s.opacity!==void 0?s.opacity:1,0,oD(o))):u&&(n.opacity=gt(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,o));for(let d=0;d<sD;d++){const m=`border${Q_[d]}Radius`;let h=py(s,m),g=py(i,m);if(h===void 0&&g===void 0)continue;h||(h=0),g||(g=0),h===0||g===0||fy(h)===fy(g)?(n[m]=Math.max(gt(dy(h),dy(g),o),0),(is.test(g)||is.test(h))&&(n[m]+="%")):n[m]=g}(s.rotate||i.rotate)&&(n.rotate=gt(s.rotate||0,i.rotate||0,o))}function py(n,s){return n[s]!==void 0?n[s]:n.borderRadius}const iD=ex(0,.5,g_),oD=ex(.5,.95,bn);function ex(n,s,i){return o=>o<n?0:o>s?1:i(ao(n,s,o))}function my(n,s){n.min=s.min,n.max=s.max}function Mn(n,s){my(n.x,s.x),my(n.y,s.y)}function hy(n,s){n.translate=s.translate,n.scale=s.scale,n.originPoint=s.originPoint,n.origin=s.origin}function gy(n,s,i,o,c){return n-=s,n=jc(n,1/i,o),c!==void 0&&(n=jc(n,1/c,o)),n}function rD(n,s=0,i=1,o=.5,c,u=n,d=n){if(is.test(s)&&(s=parseFloat(s),s=gt(d.min,d.max,s/100)-d.min),typeof s!="number")return;let m=gt(u.min,u.max,o);n===u&&(m-=s),n.min=gy(n.min,s,i,m,c),n.max=gy(n.max,s,i,m,c)}function vy(n,s,[i,o,c],u,d){rD(n,s[i],s[o],s[c],s.scale,u,d)}const lD=["x","scaleX","originX"],cD=["y","scaleY","originY"];function yy(n,s,i,o){vy(n.x,s,lD,i?i.x:void 0,o?o.x:void 0),vy(n.y,s,cD,i?i.y:void 0,o?o.y:void 0)}function by(n){return n.translate===0&&n.scale===1}function tx(n){return by(n.x)&&by(n.y)}function _y(n,s){return n.min===s.min&&n.max===s.max}function uD(n,s){return _y(n.x,s.x)&&_y(n.y,s.y)}function xy(n,s){return Math.round(n.min)===Math.round(s.min)&&Math.round(n.max)===Math.round(s.max)}function nx(n,s){return xy(n.x,s.x)&&xy(n.y,s.y)}function Sy(n){return _n(n.x)/_n(n.y)}function Ty(n,s){return n.translate===s.translate&&n.scale===s.scale&&n.originPoint===s.originPoint}class dD{constructor(){this.members=[]}add(s){Vp(this.members,s),s.scheduleRender()}remove(s){if(Hp(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 fD(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 Za={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},fr=typeof window<"u"&&window.MotionDebug!==void 0,kf=["","X","Y","Z"],pD={visibility:"hidden"},ky=1e3;let mD=0;function wf(n,s,i,o){const{latestValues:c}=s;c[n]&&(i[n]=c[n],s.setStaticValue(n,0),o&&(o[n]=0))}function sx(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:s}=n.options;if(!s)return;const i=o_(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&&sx(o)}function ax({attachResizeListener:n,defaultParent:s,measureScroll:i,checkIsScrollRoot:o,resetTransform:c}){return class{constructor(d={},m=s==null?void 0:s()){this.id=mD++,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,fr&&(Za.totalNodes=Za.resolvedTargetDeltas=Za.recalculatedProjection=0),this.nodes.forEach(vD),this.nodes.forEach(SD),this.nodes.forEach(TD),this.nodes.forEach(yD),fr&&window.MotionDebug.record(Za)},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 tD)}addEventListener(d,m){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new Gp),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=QA(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=nD(_,250),gc.hasAnimatedSinceResize&&(gc.hasAnimatedSinceResize=!1,this.nodes.forEach(Ny))})}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()||CD,{onLayoutAnimationStart:j,onLayoutAnimationComplete:w}=v.getProps(),C=!this.targetLayout||!nx(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={...Pp(N,"layout"),onPlay:j,onComplete:w};(v.shouldReduceMotion||this.options.layoutRoot)&&(M.delay=0,M.type=!1),this.startAnimation(M)}else _||Ny(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,ya(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(kD),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&&sx(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(wy);return}this.isUpdating||this.nodes.forEach(_D),this.isUpdating=!1,this.nodes.forEach(xD),this.nodes.forEach(hD),this.nodes.forEach(gD),this.clearAllSnapshots();const m=os.now();Zt.delta=Bs(0,1e3/60,m-Zt.timestamp),Zt.timestamp=m,Zt.isProcessing=!0,gf.update.process(Zt),gf.preRender.process(Zt),gf.render.process(Zt),Zt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Ap.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(bD),this.sharedNodes.forEach(wD)}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=Nt(),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&&!tx(this.projectionDelta),h=this.getTransformTemplate(),g=h?h(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;d&&(m||Fa(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)),ED(h),{animationId:this.root.animationId,measuredBox:m,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:m}=this.options;if(!m)return Nt();const h=m.measureViewportBox();if(!(((d=this.scroll)===null||d===void 0?void 0:d.wasRoot)||this.path.some(AD))){const{scroll:v}=this.root;v&&(Yi(h.x,v.offset.x),Yi(h.y,v.offset.y))}return h}removeElementScroll(d){var m;const h=Nt();if(Mn(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&&Mn(h,d),Yi(h.x,b.offset.x),Yi(h.y,b.offset.y))}return h}applyTransform(d,m=!1){const h=Nt();Mn(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&&Ji(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),Fa(v.latestValues)&&Ji(h,v.latestValues)}return Fa(this.latestValues)&&Ji(h,this.latestValues),h}removeTransform(d){const m=Nt();Mn(m,d);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!g.instance||!Fa(g.latestValues))continue;sp(g.latestValues)&&g.updateSnapshot();const v=Nt(),b=g.measurePageBox();Mn(v,b),yy(m,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return Fa(this.latestValues)&&yy(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!==Zt.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=Zt.timestamp,!this.targetDelta&&!this.relativeTarget){const S=this.getClosestProjectingParent();S&&S.layout&&this.animationProgress!==1?(this.relativeParent=S,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Nt(),this.relativeTargetOrigin=Nt(),br(this.relativeTargetOrigin,this.layout.layoutBox,S.layout.layoutBox),Mn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Nt(),this.targetWithTransforms=Nt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),MA(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Mn(this.target,this.layout.layoutBox),Y_(this.target,this.targetDelta)):Mn(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=Nt(),this.relativeTargetOrigin=Nt(),br(this.relativeTargetOrigin,this.target,S.target),Mn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}fr&&Za.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||sp(this.parent.latestValues)||K_(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===Zt.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;Mn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,S=this.treeScale.y;HA(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=Nt());const{target:T}=m;if(!T){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(hy(this.prevProjectionDelta.x,this.projectionDelta.x),hy(this.prevProjectionDelta.y,this.projectionDelta.y)),yr(this.projectionDelta,this.layoutCorrected,T,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==S||!Ty(this.projectionDelta.x,this.prevProjectionDelta.x)||!Ty(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",T)),fr&&Za.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=Ki(),this.projectionDelta=Ki(),this.projectionDeltaWithTransform=Ki()}setAnimationOrigin(d,m=!1){const h=this.snapshot,g=h?h.latestValues:{},v={...this.latestValues},b=Ki();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!m;const _=Nt(),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(jD));this.animationProgress=0;let A;this.mixTargetDelta=M=>{const D=M/1e3;jy(b.x,d.x,D),jy(b.y,d.y,D),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(br(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ND(this.relativeTarget,this.relativeTargetOrigin,_,D),A&&uD(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Nt()),Mn(A,this.relativeTarget)),N&&(this.animationValues=v,aD(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&&(ya(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ft.update(()=>{gc.hasAnimatedSinceResize=!0,this.currentAnimation=XA(0,ky,{...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(ky),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&&ix(this.options.animationType,this.layout.layoutBox,g.layoutBox)){h=this.target||Nt();const b=_n(this.layout.layoutBox.x);h.x.min=d.target.x.min,h.x.max=h.x.min+b;const _=_n(this.layout.layoutBox.y);h.y.min=d.target.y.min,h.y.max=h.y.min+_}Mn(m,h),Ji(m,v),yr(this.projectionDeltaWithTransform,this.layoutCorrected,m,v)}}registerSharedNode(d,m){this.sharedNodes.has(d)||this.sharedNodes.set(d,new dD),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&&wf("z",d,g,this.animationValues);for(let v=0;v<kf.length;v++)wf(`rotate${kf[v]}`,d,g,this.animationValues),wf(`skew${kf[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 pD;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=mc(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=mc(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!Fa(this.latestValues)&&(N.transform=v?v({},""):"none",this.hasProjected=!1),N}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=fD(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 Sc){if(_[N]===void 0)continue;const{correct:j,applyTo:w}=Sc[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?mc(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(wy),this.root.sharedNodes.clear()}}}function hD(n){n.updateLayout()}function gD(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=_n(_);_.min=o[b].min,_.max=_.min+S}):ix(u,i.layoutBox,o)&&Bn(b=>{const _=d?i.measuredBox[b]:i.layoutBox[b],S=_n(o[b]);_.max=_.min+S,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[b].max=n.relativeTarget[b].min+S)});const m=Ki();yr(m,o,i.layoutBox);const h=Ki();d?yr(h,n.applyTransform(c,!0),i.measuredBox):yr(h,o,i.layoutBox);const g=!tx(m);let v=!1;if(!n.resumeFrom){const b=n.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:S}=b;if(_&&S){const T=Nt();br(T,i.layoutBox,_.layoutBox);const N=Nt();br(N,o,S.layoutBox),nx(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 vD(n){fr&&Za.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 yD(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function bD(n){n.clearSnapshot()}function wy(n){n.clearMeasurements()}function _D(n){n.isLayoutDirty=!1}function xD(n){const{visualElement:s}=n.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),n.resetTransform()}function Ny(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function SD(n){n.resolveTargetDelta()}function TD(n){n.calcProjection()}function kD(n){n.resetSkewAndRotation()}function wD(n){n.removeLeadSnapshot()}function jy(n,s,i){n.translate=gt(s.translate,0,i),n.scale=gt(s.scale,1,i),n.origin=s.origin,n.originPoint=s.originPoint}function Cy(n,s,i,o){n.min=gt(s.min,i.min,o),n.max=gt(s.max,i.max,o)}function ND(n,s,i,o){Cy(n.x,s.x,i.x,o),Cy(n.y,s.y,i.y,o)}function jD(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const CD={duration:.45,ease:[.4,0,.1,1]},Ey=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),Ay=Ey("applewebkit/")&&!Ey("chrome/")?Math.round:bn;function Dy(n){n.min=Ay(n.min),n.max=Ay(n.max)}function ED(n){Dy(n.x),Dy(n.y)}function ix(n,s,i){return n==="position"||n==="preserve-aspect"&&!RA(Sy(s),Sy(i),.2)}function AD(n){var s;return n!==n.root&&((s=n.scroll)===null||s===void 0?void 0:s.wasRoot)}const DD=ax({attachResizeListener:(n,s)=>Er(n,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Nf={current:void 0},ox=ax({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!Nf.current){const n=new DD({});n.mount(window),n.setOptions({layoutScroll:!0}),Nf.current=n}return Nf.current},resetTransform:(n,s)=>{n.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),RD={pan:{Feature:KA},drag:{Feature:ZA,ProjectionNode:ox,MeasureLayout:X_}};function MD(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 rx(n,s){const i=MD(n),o=new AbortController,c={passive:!0,...s,signal:o.signal};return[i,c,()=>o.abort()]}function Ry(n){return s=>{s.pointerType==="touch"||H_()||n(s)}}function OD(n,s,i={}){const[o,c,u]=rx(n,i),d=Ry(m=>{const{target:h}=m,g=s(m);if(typeof g!="function"||!h)return;const v=Ry(b=>{g(b),h.removeEventListener("pointerleave",v)});h.addEventListener("pointerleave",v,c)});return o.forEach(m=>{m.addEventListener("pointerenter",d,c)}),u}function My(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,Ir(s)))}class ID extends Sa{mount(){const{current:s}=this.node;s&&(this.unmount=OD(s,i=>(My(this.node,i,"Start"),o=>My(this.node,o,"End"))))}unmount(){}}class BD extends Sa{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=Or(Er(this.node.current,"focus",()=>this.onFocus()),Er(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const lx=(n,s)=>s?n===s?!0:lx(n,s.parentElement):!1,LD=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function UD(n){return LD.has(n.tagName)||n.tabIndex!==-1}const pr=new WeakSet;function Oy(n){return s=>{s.key==="Enter"&&n(s)}}function jf(n,s){n.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const zD=(n,s)=>{const i=n.currentTarget;if(!i)return;const o=Oy(()=>{if(pr.has(i))return;jf(i,"down");const c=Oy(()=>{jf(i,"up")}),u=()=>jf(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 Iy(n){return nm(n)&&!H_()}function PD(n,s,i={}){const[o,c,u]=rx(n,i),d=m=>{const h=m.currentTarget;if(!Iy(m)||pr.has(h))return;pr.add(h);const g=s(m),v=(S,T)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!Iy(S)||!pr.has(h))&&(pr.delete(h),typeof g=="function"&&g(S,{success:T}))},b=S=>{v(S,i.useGlobalTarget||lx(h,S.target))},_=S=>{v(S,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return o.forEach(m=>{!UD(m)&&m.getAttribute("tabindex")===null&&(m.tabIndex=0),(i.useGlobalTarget?window:m).addEventListener("pointerdown",d,c),m.addEventListener("focus",g=>zD(g,c),c)}),u}function By(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,Ir(s)))}class VD extends Sa{mount(){const{current:s}=this.node;s&&(this.unmount=PD(s,i=>(By(this.node,i,"Start"),(o,{success:c})=>By(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const ip=new WeakMap,Cf=new WeakMap,HD=n=>{const s=ip.get(n.target);s&&s(n)},GD=n=>{n.forEach(HD)};function $D({root:n,...s}){const i=n||document;Cf.has(i)||Cf.set(i,{});const o=Cf.get(i),c=JSON.stringify(s);return o[c]||(o[c]=new IntersectionObserver(GD,{root:n,...s})),o[c]}function qD(n,s,i){const o=$D(s);return ip.set(n,i),o.observe(n),()=>{ip.delete(n),o.unobserve(n)}}const FD={some:0,all:1};class ZD extends Sa{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:FD[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(KD(s,i))&&this.startObserver()}unmount(){}}function KD({viewport:n={}},{viewport:s={}}={}){return i=>n[i]!==s[i]}const YD={inView:{Feature:ZD},tap:{Feature:VD},focus:{Feature:BD},hover:{Feature:ID}},JD={layout:{ProjectionNode:ox,MeasureLayout:X_}},Cc={current:null},sm={current:!1};function cx(){if(sm.current=!0,!!Np)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),s=()=>Cc.current=n.matches;n.addListener(s),s()}else Cc.current=!1}const WD=[...A_,Wt,ba],XD=n=>WD.find(E_(n)),Ly=new WeakMap;function QD(n,s,i){for(const o in s){const c=s[o],u=i[o];if(Xt(c))n.addValue(o,c);else if(Xt(u))n.addValue(o,jr(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,jr(d!==void 0?d:c,{owner:n}))}}for(const o in i)s[o]===void 0&&n.removeValue(o);return s}const Uy=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class eR{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=Xp,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=os.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=Hb(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&&Xt(T)&&T.set(h[S],!1)}}mount(s){this.current=s,Ly.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)),sm.current||cx(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Cc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Ly.delete(this.current),this.projection&&this.projection.unmount(),ya(this.notifyUpdate),ya(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=ai.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 so){const i=so[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):Nt()}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<Uy.length;o++){const c=Uy[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=QD(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=jr(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"&&(j_(c)||y_(c))?c=parseFloat(c):!XD(c)&&ba.test(i)&&(c=k_(s,i)),this.setBaseTarget(s,Xt(c)?c.get():c)),Xt(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=Rp(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&&!Xt(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 Gp),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class ux extends eR{constructor(){super(...arguments),this.KeyframeResolver=D_}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;Xt(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function tR(n){return window.getComputedStyle(n)}class nR extends ux{constructor(){super(...arguments),this.type="html",this.renderInstance=Wb}readValueFromInstance(s,i){if(ai.has(i)){const o=Wp(i);return o&&o.default||0}else{const o=tR(s),c=(Kb(i)?o.getPropertyValue(i):o[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return J_(s,i)}build(s,i,o){Ip(s,i,o.transformTemplate)}scrapeMotionValuesFromProps(s,i,o){return zp(s,i,o)}}class sR extends ux{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Nt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(ai.has(i)){const o=Wp(i);return o&&o.default||0}return i=Xb.has(i)?i:Ep(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,o){return t_(s,i,o)}build(s,i,o){Bp(s,i,this.isSVGTag,o.transformTemplate)}renderInstance(s,i,o,c){Qb(s,i,o,c)}mount(s){this.isSVGTag=Up(s.tagName),super.mount(s)}}const aR=(n,s)=>Dp(n)?new sR(s):new nR(s,{allowProjection:n!==y.Fragment}),iR=DC({...SA,...YD,...RD,...JD},aR),Mt=Fj(iR);function oR(){!sm.current&&cx();const[n]=y.useState(Cc.current);return n}const rR="_overlay_cmicx_1",lR="_dialog_cmicx_11",cR="_title_cmicx_30",uR="_description_cmicx_38",dR="_actions_cmicx_45",fR="_cancelButton_cmicx_52",pR="_confirmButton_cmicx_79",Ga={overlay:rR,dialog:lR,title:cR,description:uR,actions:dR,cancelButton:fR,confirmButton:pR};function Xa({isOpen:n,title:s,description:i,confirmLabel:o="Delete",onConfirm:c,onCancel:u}){const d=y.useId(),m=y.useId();return l.jsx(ls,{children:n&&l.jsx(Mt.div,{className:Ga.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(Mt.div,{className:Ga.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:Ga.title,children:s}),i&&l.jsx("p",{id:m,className:Ga.description,children:i}),l.jsxs("div",{className:Ga.actions,children:[l.jsx("button",{type:"button",className:Ga.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),l.jsx("button",{type:"button",className:Ga.confirmButton,onClick:c,children:o})]})]})})})}const mR="_spinner_1uyt1_1",hR="_spin_1uyt1_1",gR="_sm_1uyt1_14",vR="_md_1uyt1_20",yR="_lg_1uyt1_26",bR="_xl_1uyt1_32",zy={spinner:mR,spin:hR,sm:gR,md:vR,lg:yR,xl:bR};function dx({size:n="md",className:s,label:i="Loading",liveRegion:o=!1}){return l.jsx("span",{className:`${zy.spinner} ${zy[n]} ${s??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const _R="_splash_1bn1g_1",xR="_logo_1bn1g_11",Py={splash:_R,logo:xR};function fx(){return l.jsxs("div",{className:Py.splash,"data-testid":"splash-screen",children:[l.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Py.logo}),l.jsx(dx,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const px=50;function SR(n,s,i,o,c=px){return o?n<c:s-n-i<c}function TR(n,s){const i=s-n;return i>0?i:0}function kR({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 _=SR(g.scrollTop,g.scrollHeight,g.clientHeight,i,px);_!==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=TR(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 wR="_wrapper_1rtuy_1",NR="_scrollContainer_1rtuy_9",jR="_toolbar_1rtuy_15",CR="_directionToggle_1rtuy_22",ER="_scrollToAnchor_1rtuy_60",AR="_scrollToAnchorBottom_1rtuy_84",DR="_scrollToAnchorTop_1rtuy_88",RR="_eventOverflowWarning_1rtuy_92",ga={wrapper:wR,scrollContainer:NR,toolbar:jR,directionToggle:CR,scrollToAnchor:ER,scrollToAnchorBottom:AR,scrollToAnchorTop:DR,eventOverflowWarning:RR},mx="grackle-stream-direction";function MR(){try{return localStorage.getItem(mx)==="reversed"}catch{return!1}}function OR({eventsDropped:n}){return n<=0?l.jsx(l.Fragment,{}):l.jsxs("div",{className:ga.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 am({events:n,eventsDropped:s,emptyState:i}){const o=y.useRef(null),[c,u]=y.useState(MR),d=oR(),m=y.useMemo(()=>c?[...n].reverse():n,[n,c]),{isAtAnchor:h,scrollToAnchor:g}=kR({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:ga.wrapper,children:[l.jsx("div",{className:ga.toolbar,children:l.jsx("button",{className:ga.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:ga.scrollContainer,"data-testid":"event-stream-scroll",children:[n.length===0&&i,l.jsx(OR,{eventsDropped:s}),l.jsx(ls,{initial:!1,children:m.map((S,T)=>{const N=c?n.length-1-T:T;return l.jsx(Mt.div,{initial:{opacity:0,y:_},animate:{opacity:1,y:0},transition:{duration:b,ease:"easeOut"},children:l.jsx(Oj,{event:S,toolUseCtx:S.toolUseCtx})},`${S.sessionId}-${S.timestamp}-${N}`)})})]}),l.jsx(ls,{children:!h&&l.jsxs(Mt.button,{className:`${ga.scrollToAnchor} ${c?ga.scrollToAnchorTop:ga.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 im(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 IR="_editFieldWrapper_yuzty_1",BR="_editInput_yuzty_10",LR="_editTextarea_yuzty_42",UR="_editSelect_yuzty_78",zR="_editError_yuzty_111",PR="_editInputInvalid_yuzty_118",VR="_editHint_yuzty_123",HR="_unsavedDot_yuzty_132",GR="_metaValueClickable_yuzty_140",$R="_editButton_yuzty_159",qR="_metaPlaceholder_yuzty_175",FR="_worktreeToggle_yuzty_180",Ye={editFieldWrapper:IR,editInput:BR,editTextarea:LR,editSelect:UR,editError:zR,editInputInvalid:PR,editHint:VR,unsavedDot:HR,metaValueClickable:GR,editButton:$R,metaPlaceholder:qR,worktreeToggle:FR};function Kt(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=im({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 op(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=im({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 Ec(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=im({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 ZR(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 KR="_envRow_1e1r5_1",YR="_envDot_1e1r5_7",JR="_envDotGreen_1e1r5_14",WR="_envDotYellow_1e1r5_18",XR="_envDotRed_1e1r5_22",QR="_envDotGray_1e1r5_26",Wi={envRow:KR,envDot:YR,envDotGreen:JR,envDotYellow:WR,envDotRed:XR,envDotGray:QR};function eM(n){const s=n.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?Wi.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?Wi.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?Wi.envDotRed:Wi.envDotGray}function tM(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:Wi.envRow,children:[l.jsx("span",{className:`${Wi.envDot} ${eM(b.status)}`}),b.displayName]})};return l.jsx(Ec,{value:s,onSave:i,options:_,fieldId:u,activeFieldId:d,onActivate:m,renderDisplay:S,placeholder:h,ariaLabel:g,"data-testid":v})}const nM="_nav_1snmp_1",sM="_searchForm_1snmp_8",aM="_searchInput_1snmp_15",iM="_searchButton_1snmp_33",oM="_clearButton_1snmp_68",rM="_workspaceSelect_1snmp_85",lM="_listHeader_1snmp_99",cM="_nodeList_1snmp_108",uM="_nodeItem_1snmp_116",dM="_indicator_1snmp_129",fM="_label_1snmp_136",pM="_badge_1snmp_145",On={nav:nM,searchForm:sM,searchInput:aM,searchButton:iM,clearButton:oM,workspaceSelect:rM,listHeader:lM,nodeList:cM,nodeItem:uM,indicator:dM,label:fM,badge:pM};function mM({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:On.nav,"data-testid":"knowledge-nav",children:[l.jsxs("form",{className:On.searchForm,onSubmit:v,children:[l.jsx("input",{className:On.searchInput,type:"text",placeholder:"Search...",value:h,onChange:T=>{g(T.target.value)},"data-testid":"knowledge-search-input"}),l.jsx("button",{type:"submit",className:On.searchButton,disabled:i,children:"Go"})]}),o&&l.jsx("button",{type:"button",className:On.clearButton,onClick:b,children:"Clear search"}),l.jsxs("select",{className:On.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:On.listHeader,children:["Nodes (",n.length,")"]}),l.jsx("ul",{className:On.nodeList,children:n.map(T=>l.jsxs("li",{className:On.nodeItem,onClick:()=>{_(T.id)},onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),_(T.id))},role:"button",tabIndex:0,children:[l.jsx("span",{className:On.indicator,style:{backgroundColor:T.kind==="reference"?"#4A9EFF":T.category==="decision"?"#22C55E":T.category==="concept"?"#A855F7":T.category==="snippet"?"#6B7280":"#EAB308"}}),l.jsx("span",{className:On.label,children:T.label}),l.jsx("span",{className:On.badge,children:T.kind==="reference"?T.sourceType:T.category})]},T.id))})]})}const hM="_container_1mq5u_1",gM="_hamburger_1mq5u_33",vM="_brand_1mq5u_49",yM="_brandLogo_1mq5u_68",bM="_info_1mq5u_75",_M="_connectionLabel_1mq5u_90",xM="_connectionDot_1mq5u_103",SM="_connected_1mq5u_106",TM="_disconnected_1mq5u_110",Es={container:hM,hamburger:gM,brand:vM,brandLogo:yM,info:bM,connectionLabel:_M,connectionDot:xM,connected:SM,disconnected:TM};function kM({connected:n,environments:s,sessions:i,onToggleSidebar:o,sidebarOpen:c}){const u=xt(),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:Es.container,children:[o&&l.jsx("button",{type:"button",className:Es.hamburger,onClick:o,"aria-label":"Toggle sidebar","aria-expanded":c,children:"☰"}),l.jsxs("button",{type:"button",className:Es.brand,onClick:()=>u(Wa),title:"Home",children:[l.jsx("img",{src:"/icon-192x192.png",alt:"",className:Es.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]}),l.jsxs("div",{className:Es.info,children:[l.jsxs("span",{"aria-label":n?"Connected":"Disconnected",children:[l.jsx("span",{className:`${Es.connectionDot} ${n?Es.connected:Es.disconnected}`,"aria-hidden":"true",children:"●"})," ",l.jsx("span",{className:Es.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 wM="_nav_13gkc_1",NM="_tab_13gkc_35",jM="_tabIcon_13gkc_68",CM="_tabLabel_13gkc_79",EM="_tabActive_13gkc_84",lr={nav:wM,tab:NM,tabIcon:jM,tabLabel:CM,tabActive:EM},$a=[{view:"dashboard",label:"Dashboard",icon:"🏠",route:Wa,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:"💬",route:K2,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:"📋",route:Y2,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:"🖥️",route:eo,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:"🧠",route:Mb,testId:"sidebar-tab-knowledge"},{view:"settings",label:"Settings",icon:"⚙️",route:$2,testId:"sidebar-tab-settings"}];function AM(n){return n===Wa||n==="/"?"dashboard":n.startsWith("/chat")||n.startsWith("/sessions")?"chat":n.startsWith("/workspaces")||n.startsWith("/environments")?"environments":n.startsWith(Mb)?"knowledge":n.startsWith(Xi)?"settings":"tasks"}function DM(){const n=Bt(),s=xt(),i=y.useRef(null),o=AM(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:$a.findIndex(S=>S.view===o);let v=g;if(d.key==="ArrowRight"||d.key==="j"||d.key==="J")d.preventDefault(),v=(g+1)%$a.length;else if(d.key==="ArrowLeft"||d.key==="k"||d.key==="K")d.preventDefault(),v=(g-1+$a.length)%$a.length;else if(d.key==="Home")d.preventDefault(),v=0;else if(d.key==="End")d.preventDefault(),v=$a.length-1;else return;s($a[v].route),(_=m[v])==null||_.focus()},[o,s]);return l.jsx("nav",{className:lr.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:u,"data-testid":"sidebar-nav",children:$a.map(d=>{const m=d.view===o;return l.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${lr.tab} ${m?lr.tabActive:""}`,onClick:()=>c(d),"data-testid":d.testId,title:d.label,"aria-label":d.label,children:[l.jsx("span",{className:lr.tabIcon,"aria-hidden":"true",children:d.icon}),l.jsx("span",{className:lr.tabLabel,children:d.label})]},d.view)})})}const RM="_container_pi6ii_1",MM="_content_pi6ii_66",Vy={container:RM,content:MM},OM=320,hx=220,gx=600,vx="grackle-sidebar-width";function IM(){try{const n=localStorage.getItem(vx);if(n!==null){const s=Number(n);if(Number.isFinite(s)&&s>=hx&&s<=gx)return s}}catch{}return OM}function BM(n){try{localStorage.setItem(vx,String(n))}catch{}}function LM({content:n}){const[s]=y.useState(IM),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>=hx&&h<=gx&&BM(h)}}});return c.observe(o),()=>{c.disconnect()}},[]),n!==void 0)return l.jsx("div",{className:Vy.container,ref:i,"data-testid":"sidebar",style:{width:s},children:l.jsx("div",{className:Vy.content,children:n})})}const UM="_bar_tnfsh_1",zM="_btnPrimary_tnfsh_32",PM="_statusText_tnfsh_85",VM="_statusCompleted_tnfsh_90",HM="_statusFailed_tnfsh_94",GM="_statusBlocked_tnfsh_98",$M="_hintText_tnfsh_103",ht={bar:UM,btnPrimary:zM,statusText:PM,statusCompleted:VM,statusFailed:HM,statusBlocked:GM,hintText:$M};function qM({sessions:n,tasks:s,environments:i}){const o=xt(),c=Bt(),u=Rt("/sessions/:sessionId"),d=Rt("/tasks/:taskId"),m=Rt("/tasks/:taskId/stream"),h=Rt("/tasks/:taskId/findings"),g=Rt("/tasks/:taskId/edit"),v=Rt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=Rt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),_=Rt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),S=Rt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),T=Rt("/sessions/new"),N=Rt("/environments/:environmentId/workspaces/:workspaceId"),j=Rt("/tasks/new"),w=Rt("/chat"),C=Rt("/"),A=Rt("/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(q=>q.adapterType==="local"&&q.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 q=new Map(s.map(re=>[re.id,re])),te=B.dependsOn.some(re=>{const de=q.get(re);return de!==void 0&&de.status!=="complete"});if(B.status==="not_started"){const re=te?B.dependsOn.map(de=>q.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(ni(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),q=(B==null?void 0:B.status)==="stopped";if(B!==void 0&&!q)return l.jsx(l.Fragment,{});if(q)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(Ab(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 FM="_nav_14i94_1",ZM="_tab_14i94_24",KM="_tabActive_14i94_62",YM="_tabLabel_14i94_75",JM="_statusDot_14i94_81",WM="_pulse_14i94_87",XM="_addButton_14i94_99",QM="_empty_14i94_132",ua={nav:FM,tab:ZM,tabActive:KM,tabLabel:YM,statusDot:JM,pulse:WM,addButton:XM,empty:QM},e3={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function t3({environments:n}){const s=xt(),i=y.useRef(null),o=Rt("/environments/:environmentId"),c=Rt("/environments/:environmentId/edit"),u=Rt("/environments/:environmentId/workspaces/:workspaceId"),d=Rt("/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(to(_))},[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(to(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=e3[_.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(H2),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),n.length===0&&l.jsx("div",{className:ua.empty,children:"No environments yet."})]})}function n3(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 yx({text:n,indices:s,highlightClass:i}){if(!s||s.length===0)return l.jsx(l.Fragment,{children:n});const o=n3(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 s3(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 a3(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 FT){c.add(u);const d=i.get(u);if(d&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const m=va(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=va(u);o.push({status:u,label:m.label,style:m,tasks:d})}return o}const i3="_container_z4i38_1",o3="_header_z4i38_5",r3="_headerActions_z4i38_17",l3="_searchInput_z4i38_23",c3="_searchHighlight_z4i38_56",u3="_groupToggle_z4i38_62",d3="_groupToggleActive_z4i38_89",f3="_addButton_z4i38_93",p3="_taskRow_z4i38_120",m3="_selected_z4i38_140",h3="_expandArrow_z4i38_150",g3="_expanded_z4i38_157",v3="_leafSpacer_z4i38_161",y3="_taskStatusIcon_z4i38_166",b3="_taskTitle_z4i38_170",_3="_workspaceBadge_z4i38_177",x3="_childCountBadge_z4i38_195",S3="_dependencyBadge_z4i38_208",T3="_blockedBadge_z4i38_220",k3="_addChildButton_z4i38_225",w3="_emptyState_z4i38_268",N3="_statusGroupHeader_z4i38_275",j3="_statusGroupIcon_z4i38_294",C3="_statusGroupLabel_z4i38_298",E3="_statusGroupCount_z4i38_303",Ge={container:i3,header:o3,headerActions:r3,searchInput:l3,searchHighlight:c3,groupToggle:u3,groupToggleActive:d3,addButton:f3,taskRow:p3,selected:m3,expandArrow:h3,expanded:g3,leafSpacer:v3,taskStatusIcon:y3,taskTitle:b3,workspaceBadge:_3,childCountBadge:x3,dependencyBadge:S3,blockedBadge:T3,addChildButton:k3,emptyState:w3,statusGroupHeader:N3,statusGroupIcon:j3,statusGroupLabel:C3,statusGroupCount:E3},A3=[{name:"title",weight:2},{name:"description",weight:1}],bx=16,D3=16,_x="grackle-task-group-by-status";function Hy(){try{return localStorage.getItem(_x)==="true"}catch{return!1}}function R3(n){try{localStorage.setItem(_x,String(n))}catch{}}function M3({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(ls,{children:s&&l.jsx(Mt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:n.tasks.map(m=>{const h=va(m.status),g=o===m.id,v=m.parentTaskId||!m.workspaceId?void 0:d.get(m.workspaceId);return l.jsxs("div",{onClick:()=>c(rs(m.id)),className:`${Ge.taskRow} ${g?Ge.selected:""}`,style:{"--task-indent":`${bx}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(yx,{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 xx({node:n,depth:s,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:m,workspaceNames:h}){const g=va(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=bx+s*D3,j=s===0&&!n.parentTaskId&&n.workspaceId?h.get(n.workspaceId):void 0;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{onClick:()=>u(rs(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(yx,{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<lT&&l.jsx("button",{onClick:w=>{w.stopPropagation(),u(ni(n.workspaceId,n.id))},title:"Add child task","aria-label":"Add child task",className:Ge.addChildButton,children:"+"})]}),l.jsx(ls,{children:_&&b&&l.jsx(Mt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:n.children.map(w=>l.jsx(xx,{node:w,depth:s+1,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:m,workspaceNames:h},w.id))})})]})}function O3({workspaces:n,tasks:s}){const i=xt(),[o,c]=y.useState(new Set),[u,d]=y.useState(new Set),[m,h]=y.useState(Hy),[g,v]=y.useState(Hy),[b,_]=y.useState(new Map),S=Rt("/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;R3(oe),h(oe),oe&&(v(!0),_(new Map))},C=oe=>{_(X=>{const B=new Map(X),q=B.has(oe)?B.get(oe):g;return B.set(oe,!q),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(q=>new Set(q).add(oe))):(B.add(oe),d(q=>{const te=new Set(q);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 q of oe)u.has(q)||B.add(q);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=rT(s,D,A3),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 q=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;)q.add(de.parentTaskId),de=te.get(de.parentTaskId)}return{directMatchTaskIds:X,treeMatchTaskIds:q,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?[]:s3(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(ni()),"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?a3(ae,N).map(oe=>l.jsx(M3,{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(xx,{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 I3="_toast_da8ll_1",B3="_success_da8ll_18",L3="_icon_da8ll_22",U3="_error_da8ll_25",z3="_warning_da8ll_32",P3="_info_da8ll_38",V3="_message_da8ll_53",H3="_close_da8ll_60",cr={toast:I3,success:B3,icon:L3,error:U3,warning:z3,info:P3,message:V3,close:H3},G3={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function $3({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(Mt.div,{className:`${cr.toast} ${cr[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:cr.icon,"aria-hidden":"true",children:G3[n.variant]}),l.jsx("span",{className:cr.message,children:n.message}),l.jsx("button",{type:"button",className:cr.close,onClick:()=>s(n.id),"aria-label":"Dismiss notification",children:"×"})]})}const q3="_container_qqse2_1",F3={container:q3};function Z3({toasts:n,onDismiss:s}){return l.jsx("div",{className:F3.container,"data-testid":"toast-container",children:l.jsx(ls,{children:n.map(i=>l.jsx($3,{toast:i,onDismiss:s},i.id))})})}const K3="_callout_1jaue_1",Y3="_success_1jaue_11",J3="_icon_1jaue_15",W3="_error_1jaue_18",X3="_warning_1jaue_25",Q3="_info_1jaue_32",e6="_content_1jaue_48",t6="_close_1jaue_53",ur={callout:K3,success:Y3,icon:J3,error:W3,warning:X3,info:Q3,content:e6,close:t6},n6={success:"✓",error:"✕",warning:"⚠",info:"ℹ"};function s6({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:[ur.callout,ur[n],o].filter(Boolean).join(" "),role:n==="error"||n==="warning"?"alert":"status",children:[l.jsx("span",{className:ur.icon,"aria-hidden":"true",children:n6[n]}),l.jsx("span",{className:ur.content,children:s}),i&&l.jsx("button",{type:"button",className:ur.close,onClick:()=>u(!0),"aria-label":"Dismiss",children:"×"})]})})}function a6({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(s6,{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 i6="_container_1pqxm_1",o6="_emptyState_1pqxm_8",r6="_card_1pqxm_14",l6="_cardHeader_1pqxm_34",c6="_categoryBadge_1pqxm_46",u6="_findingTitle_1pqxm_54",d6="_findingDate_1pqxm_60",f6="_findingContent_1pqxm_72",p6="_tags_1pqxm_78",m6="_tag_1pqxm_78",ns={container:i6,emptyState:o6,card:r6,cardHeader:l6,categoryBadge:c6,findingTitle:u6,findingDate:d6,findingContent:f6,tags:p6,tag:m6};function h6(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 Gy={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 g6({findings:n}){return n.length===0?l.jsx("div",{className:ns.emptyState,children:"No findings yet. Agents will post discoveries here."}):l.jsx("div",{className:ns.container,children:n.map((s,i)=>{const o=Gy[s.category]||Gy.general;return l.jsxs(Mt.div,{className:ns.card,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:i*.05,duration:.2},children:[l.jsxs("div",{className:ns.cardHeader,children:[l.jsx("span",{className:ns.categoryBadge,style:{background:o.bg,color:o.text},children:s.category}),l.jsx("span",{className:ns.findingTitle,children:s.title}),l.jsx("span",{className:ns.findingDate,title:s.createdAt,children:h6(s.createdAt)})]}),l.jsx("div",{className:ns.findingContent,children:s.content.length>300?s.content.slice(0,300)+"...":s.content}),s.tags.length>0&&l.jsx("div",{className:ns.tags,children:s.tags.map(c=>l.jsx("span",{className:ns.tag,style:{color:o.text,textShadow:`0 0 8px ${o.text}`},children:c},c))})]},s.id)})})}const v6="_section_1ingb_14",y6="_sectionTitle_1ingb_26",b6="_sectionDescription_1ingb_35",_6="_tokenList_1ingb_48",x6="_tokenRow_1ingb_55",S6="_tokenBadge_1ingb_68",T6="_tokenName_1ingb_83",k6="_tokenTarget_1ingb_90",w6="_deleteButton_1ingb_99",N6="_addForm_1ingb_113",j6="_formRow_1ingb_119",C6="_input_1ingb_125",E6="_select_1ingb_155",A6="_addButton_1ingb_187",D6="_emptyStateInfo_1ingb_221",R6="_themeOptions_1ingb_229",M6="_themeOption_1ingb_229",O6="_themeOptionSelected_1ingb_254",I6="_themeOptionHeader_1ingb_259",B6="_themeOptionLabel_1ingb_266",L6="_themeOptionDesc_1ingb_273",U6="_variantToggle_1ingb_279",z6="_variantButton_1ingb_286",P6="_variantActive_1ingb_305",V6="_themeSwatches_1ingb_311",H6="_themeSwatch_1ingb_311",G6="_systemToggle_1ingb_325",$6="_systemToggleHint_1ingb_341",q6="_themeActive_1ingb_348",F6="_aboutGrid_1ingb_354",Z6="_aboutItem_1ingb_360",K6="_aboutLabel_1ingb_373",Y6="_aboutValue_1ingb_379",J6="_aboutDot_1ingb_387",W6="_aboutDotConnected_1ingb_394",X6="_aboutDotDisconnected_1ingb_398",he={section:v6,sectionTitle:y6,sectionDescription:b6,tokenList:_6,tokenRow:x6,tokenBadge:S6,tokenName:T6,tokenTarget:k6,deleteButton:w6,addForm:N6,formRow:j6,input:C6,select:E6,addButton:A6,emptyStateInfo:D6,themeOptions:R6,themeOption:M6,themeOptionSelected:O6,themeOptionHeader:I6,themeOptionLabel:B6,themeOptionDesc:L6,variantToggle:U6,variantButton:z6,variantActive:P6,themeSwatches:V6,themeSwatch:H6,systemToggle:G6,systemToggleHint:$6,themeActive:q6,aboutGrid:F6,aboutItem:Z6,aboutLabel:K6,aboutValue:Y6,aboutDot:J6,aboutDotConnected:W6,aboutDotDisconnected:X6},Q6=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function eO({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(Xa,{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:Q6.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 Hc=[{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"]}],Sx=new Set(Hc.map(n=>n.id)),$y="grackle";function rp(n){return Hc.find(s=>s.id===n)}function tO({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:Hc.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 nO({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.87.0"})]})]})]})}const sO="_container_cddyd_1",aO="_header_cddyd_8",iO="_headerTitle_cddyd_35",oO="_badge_cddyd_44",rO="_headerActions_cddyd_54",lO="_body_cddyd_61",cO="_formContent_cddyd_73",uO="_section_cddyd_85",dO="_label_cddyd_91",fO="_titleInput_cddyd_98",pO="_descriptionTextarea_cddyd_131",mO="_parentContext_cddyd_167",hO="_parentLabel_cddyd_175",gO="_parentName_cddyd_182",vO="_personaSelect_cddyd_186",yO="_depList_cddyd_220",bO="_depItem_cddyd_226",_O="_depItemSelected_cddyd_248",xO="_noDeps_cddyd_252",SO="_btnPrimary_cddyd_258",TO="_btnGhost_cddyd_289",Ke={container:sO,header:aO,headerTitle:iO,badge:oO,headerActions:rO,body:lO,formContent:cO,section:uO,label:dO,titleInput:fO,descriptionTextarea:pO,parentContext:mO,parentLabel:hO,parentName:gO,personaSelect:vO,depList:yO,depItem:bO,depItemSelected:_O,noDeps:xO,btnPrimary:SO,btnGhost:TO};function Tx({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 _=xt(),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,q]=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),q(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(Lt=>Lt!==me):[...Ce,me])},Oe=()=>{!we||te||S&&T===void 0||(S&&s?(g(s,z.trim(),F,ae,oe),b==null||b("Task updated","success"),v?v():_(rs(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?Qi(i,M):"/tasks",{replace:!0})},me=>{b==null||b(me,"error"),re(!1)})))},le=()=>{if(v){v();return}_(S&&s?rs(s,void 0,C,M):i?Qi(i,M):"/tasks")},fe=S?"edit task":E?"child task":"new task";return l.jsxs("div",{className:Ke.container,children:[l.jsxs("div",{className:Ke.header,children:[l.jsxs("div",{className:Ke.headerTitle,children:[l.jsx("span",{className:Ke.badge,children:fe}),H&&l.jsxs("span",{className:Ke.parentContext,children:[l.jsx("span",{className:Ke.parentLabel,children:"Child of"}),l.jsx("span",{className:Ke.parentName,children:H.title})]})]}),l.jsxs("div",{className:Ke.headerActions,children:[l.jsx("button",{onClick:Oe,disabled:!we||te,className:Ke.btnPrimary,"data-testid":"task-edit-save",children:te?"Creating…":S?"Save Changes":"Create"}),l.jsx("button",{onClick:le,className:Ke.btnGhost,children:"Cancel"})]})]}),l.jsx("div",{className:Ke.body,children:l.jsxs("div",{className:Ke.formContent,children:[D&&l.jsxs("div",{className:Ke.section,children:[l.jsx("label",{className:Ke.label,htmlFor:"task-edit-workspace",children:"Workspace"}),l.jsxs("select",{id:"task-edit-workspace",value:j,onChange:me=>w(me.target.value),className:Ke.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:Ke.section,children:[l.jsx("label",{className:Ke.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:Ke.titleInput,"data-testid":"task-edit-title",onKeyDown:me=>{me.key==="Enter"&&we&&Oe()}})]}),l.jsxs("div",{className:Ke.section,children:[l.jsx("label",{className:Ke.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:Ke.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),l.jsxs("div",{className:Ke.section,children:[l.jsx("label",{className:Ke.label,htmlFor:"task-edit-persona",children:"Default Persona"}),l.jsxs("select",{id:"task-edit-persona",value:oe,onChange:me=>X(me.target.value),className:Ke.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:Ke.section,children:l.jsxs("label",{className:Ke.depItem,"data-testid":"task-edit-can-decompose",children:[l.jsx("input",{type:"checkbox",checked:B,onChange:me=>q(me.target.checked)}),"Can spawn subtasks"]})}),l.jsxs("div",{className:Ke.section,children:[l.jsx("div",{className:Ke.label,children:"Dependencies"}),$e.length===0?l.jsx("div",{className:Ke.noDeps,children:"No other tasks in this workspace"}):l.jsx("div",{className:Ke.depList,children:$e.map(me=>{const Ce=ae.includes(me.id);return l.jsxs("label",{className:`${Ke.depItem} ${Ce?Ke.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 kO="_container_legrg_1",wO="_header_legrg_8",NO="_headerTitle_legrg_35",jO="_badge_legrg_44",CO="_headerActions_legrg_54",EO="_body_legrg_61",AO="_formContent_legrg_73",DO="_section_legrg_85",RO="_label_legrg_91",MO="_nameInput_legrg_98",OO="_fieldInput_legrg_131",IO="_adapterSelect_legrg_164",BO="_readOnlyValue_legrg_198",LO="_codespaceSection_legrg_204",UO="_codespaceActions_legrg_210",zO="_creatingHint_legrg_216",PO="_errorHint_legrg_222",VO="_btnPrimary_legrg_235",HO="_btnGhost_legrg_266",ne={container:kO,header:wO,headerTitle:NO,badge:jO,headerActions:CO,body:EO,formContent:AO,section:DO,label:RO,nameInput:MO,fieldInput:OO,adapterSelect:IO,readOnlyValue:BO,codespaceSection:LO,codespaceActions:UO,creatingHint:zO,errorHint:PO,btnPrimary:VO,btnGhost:HO},vc=1,yc=65535;function Ef(n){if(!n.trim())return!0;const s=Number(n);return Number.isInteger(s)&&s>=vc&&s<=yc}function Af(n){try{const s=JSON.parse(n);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function GO({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 kx({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 _=xt(),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(""),[q,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")&&!Ef(D)),$e=()=>{de()&&(o(N.trim(),w,re()),b==null||b("Environment added successfully","success"),_(eo,{replace:!0}))},we=()=>{_(s?to(s):eo)},Se=y.useCallback((le,fe)=>{if(!T||!s)return;const me=Af(T.adapterConfig),Ce=fe.trim();Ce?me[le]=Ce:delete me[le],c(s,{adapterConfig:me})},[T,s,c]),Oe=y.useCallback((le,fe)=>{if(!T||!s)return;const me=Af(T.adapterConfig);if(fe.trim()){const Ce=Number(fe);Number.isInteger(Ce)&&Ce>=vc&&Ce<=yc&&(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=Af(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(Kt,{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:q,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(Kt,{value:String(le.host??""),onSave:fe=>Se("host",fe),mode:"edit",fieldId:"host",activeFieldId:q,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(Kt,{value:String(le.port??""),onSave:fe=>Oe("port",fe),validate:fe=>Ef(fe)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:q,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(Kt,{value:String(le.host??""),onSave:fe=>Se("host",fe),validate:fe=>fe.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:q,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(Kt,{value:String(le.user??""),onSave:fe=>Se("user",fe),mode:"edit",fieldId:"user",activeFieldId:q,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(Kt,{value:String(le.sshPort??""),onSave:fe=>Oe("sshPort",fe),validate:fe=>Ef(fe)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:q,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(Kt,{value:String(le.identityFile??""),onSave:fe=>Se("identityFile",fe),mode:"edit",fieldId:"identityFile",activeFieldId:q,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(Kt,{value:String(le.image??""),onSave:fe=>Se("image",fe),mode:"edit",fieldId:"image",activeFieldId:q,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(Kt,{value:String(le.repo??""),onSave:fe=>Se("repo",fe),mode:"edit",fieldId:"repo",activeFieldId:q,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(Kt,{value:String(le.codespaceName??""),onSave:fe=>Se("codespaceName",fe),validate:fe=>fe.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:q,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:vc,max:yc,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:vc,max:yc,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(GO,{codespaceName:X,onCodespaceNameChange:B,envName:N,onEnvNameChange:j,codespaces:d,codespaceError:m,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v})]})})]})}const $O="_group_1iprv_1",qO="_groupTitle_1iprv_8",FO="_shortcutList_1iprv_17",ZO="_shortcutRow_1iprv_23",KO="_keys_1iprv_36",YO="_kbd_1iprv_43",JO="_description_1iprv_60",qa={group:$O,groupTitle:qO,shortcutList:FO,shortcutRow:ZO,keys:KO,kbd:YO,description:JO},WO=[{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 XO(){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."}),WO.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 QO="_workpadSection_y8nj9_1",eI="_workpadLabel_y8nj9_9",tI="_workpadStatus_y8nj9_17",nI="_workpadSummary_y8nj9_23",sI="_workpadExtra_y8nj9_29",da={workpadSection:QO,workpadLabel:eI,workpadStatus:tI,workpadSummary:nI,workpadExtra:sI};function aI({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)})]})}const iI=[{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 oI({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:iI.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 rI="_container_10efq_1",lI="_header_10efq_7",cI="_list_10efq_105",uI="_card_10efq_111",dI="_cardHeader_10efq_125",fI="_cardTitle_10efq_135",pI="_defaultBadge_10efq_141",mI="_cardActions_10efq_155",hI="_description_10efq_160",gI="_meta_10efq_166",vI="_empty_10efq_212",yI="_typeBadge_10efq_362",In={container:rI,header:lI,list:cI,card:uI,cardHeader:dI,cardTitle:fI,defaultBadge:pI,cardActions:mI,description:hI,meta:gI,empty:vI,typeBadge:yI};function bI({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:In.container,children:[l.jsxs("div",{className:In.header,children:[l.jsx("h2",{children:"Personas"}),l.jsx(Ds,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),n.length===0?l.jsx("p",{className:In.empty,children:"No personas yet. Create one to get started."}):l.jsx("div",{className:In.list,children:n.map(v=>{const b=s===v.id,_=v.type==="script";return l.jsxs("div",{className:In.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:In.cardHeader,children:[l.jsxs("span",{className:In.cardTitle,children:[l.jsx("strong",{children:v.name}),l.jsx("span",{className:In.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&l.jsx("span",{className:In.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),l.jsxs("div",{className:In.cardActions,onClick:S=>S.stopPropagation(),children:[!b&&l.jsx(Ds,{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(Ds,{variant:"ghost",size:"sm",onClick:()=>u(v.id),children:"Edit"}),l.jsx(Ds,{variant:"ghost",size:"sm",onClick:()=>m(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&l.jsx("p",{className:In.description,children:v.description}),l.jsxs("div",{className:In.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(Xa,{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 _I="_container_uy08i_1",xI="_header_uy08i_7",SI="_count_uy08i_13",TI="_presets_uy08i_18",kI="_presetButton_uy08i_24",wI="_filterInput_uy08i_41",NI="_groups_uy08i_53",jI="_group_uy08i_53",CI="_groupHeader_uy08i_68",EI="_groupName_uy08i_77",AI="_groupCount_uy08i_81",DI="_toolList_uy08i_87",RI="_toolItem_uy08i_95",MI="_toolName_uy08i_103",en={container:_I,header:xI,count:SI,presets:TI,presetButton:kI,filterInput:wI,groups:NI,group:jI,groupHeader:CI,groupName:EI,groupCount:AI,toolList:DI,toolItem:RI,toolName:MI},OI=(()=>{const n=new Map;for(const s of lb){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()}))})(),II=[{name:"default",label:"Default",tools:cb},{name:"worker",label:"Worker",tools:cT},{name:"orchestrator",label:"Orchestrator",tools:uT},{name:"admin",label:"Admin",tools:dT}];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:en.container,"data-testid":"mcp-tool-selector",children:[l.jsx("div",{className:en.header,children:l.jsx("span",{className:en.count,children:n.length===0?`Using default (${cb.length} tools)`:`${n.length} of ${lb.size} tools selected`})}),l.jsxs("div",{className:en.presets,"data-testid":"mcp-tool-presets",children:[II.map(v=>l.jsx("button",{type:"button",className:en.presetButton,disabled:i,onClick:()=>h(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),l.jsx("button",{type:"button",className:en.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),l.jsx("input",{type:"text",className:en.filterInput,placeholder:"Filter tools...",value:o,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),l.jsx("div",{className:en.groups,children:OI.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:en.group,"data-testid":`tool-group-${v}`,children:[l.jsxs("label",{className:en.groupHeader,children:[l.jsx("input",{type:"checkbox",checked:S,onChange:()=>m(_,S),disabled:i,"data-testid":`group-toggle-${v}`}),l.jsx("span",{className:en.groupName,children:v}),l.jsxs("span",{className:en.groupCount,children:["(",_.filter(T=>u.has(T)).length,"/",_.length,")"]})]}),l.jsx("div",{className:en.toolList,children:_.map(T=>l.jsxs("label",{className:en.toolItem,children:[l.jsx("input",{type:"checkbox",checked:u.has(T),onChange:()=>d(T),disabled:i,"data-testid":`tool-${T}`}),l.jsx("span",{className:en.toolName,children:T})]},T))})]},v)})})]})}const BI="_nav_1bhou_1",LI="_tab_1bhou_24",UI="_tabIcon_1bhou_62",zI="_tabActive_1bhou_68",oc={nav:BI,tab:LI,tabIcon:UI,tabActive:zI},As=[{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 PI(){var d;const n=Bt(),s=xt(),i=y.useRef(null),o=((d=As.find(m=>{const h=`${Xi}/${m.path}`;return n.pathname===h||n.pathname.startsWith(`${h}/`)}))==null?void 0:d.path)??As[0].path,c=y.useCallback(m=>{s(`${Xi}/${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:As.findIndex(N=>N.path===o);let b=v;if(m.key==="ArrowDown"||m.key==="j"||m.key==="J")m.preventDefault(),b=(v+1)%As.length;else if(m.key==="ArrowUp"||m.key==="k"||m.key==="K")m.preventDefault(),b=(v-1+As.length)%As.length;else if(m.key==="Home")m.preventDefault(),b=0;else if(m.key==="End")m.preventDefault(),b=As.length-1;else return;const _=As[b].path;s(`${Xi}/${_}`),(T=h[b])==null||T.focus()},[o,s]);return l.jsx("nav",{className:oc.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:As.map(m=>{const h=m.path===o;return l.jsxs("button",{role:"tab",type:"button","aria-selected":h,tabIndex:h?0:-1,className:`${oc.tab} ${h?oc.tabActive:""}`,onClick:()=>c(m.path),children:[l.jsx("span",{className:oc.tabIcon,"aria-hidden":"true",children:m.icon}),m.label]},m.path)})})}function VI({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(f0.map(u=>[u,[]]));for(const u of n){const d=mp(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 f0.map(u=>{const d=va(u);return{status:u,label:d.label,style:d,tasks:c.get(u)??[]}})}const HI="_boardContainer_1c4y1_1",GI="_column_1c4y1_17",$I="_columnHeader_1c4y1_34",qI="_columnIcon_1c4y1_47",FI="_columnLabel_1c4y1_52",ZI="_columnCount_1c4y1_57",KI="_cardList_1c4y1_67",YI="_emptyPlaceholder_1c4y1_76",JI="_card_1c4y1_67",WI="_cardHeader_1c4y1_107",XI="_cardStatusIcon_1c4y1_113",QI="_cardTitle_1c4y1_119",e4="_cardBadges_1c4y1_127",t4="_badge_1c4y1_134",n4="_blockedBadge_1c4y1_146",s4="_childBadge_1c4y1_151",a4="_depBadge_1c4y1_155",i4="_parentBadge_1c4y1_159",o4="_pausedSubBadge_1c4y1_166",r4="_personaBadge_1c4y1_170",l4="_envBadge_1c4y1_174",c4="_emptyCta_1c4y1_178",u4="_ctaButton_1c4y1_188",d4="_ctaDescription_1c4y1_204",Xe={boardContainer:HI,column:GI,columnHeader:$I,columnIcon:qI,columnLabel:FI,columnCount:ZI,cardList:KI,emptyPlaceholder:YI,card:JI,cardHeader:WI,cardStatusIcon:XI,cardTitle:QI,cardBadges:e4,badge:t4,blockedBadge:n4,childBadge:s4,depBadge:a4,parentBadge:i4,pausedSubBadge:o4,personaBadge:r4,envBadge:l4,emptyCta:c4,ctaButton:u4,ctaDescription:d4};function f4({workspaceId:n,environmentId:s,tasks:i,sessions:o,personas:c,environments:u}){const d=xt(),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(()=>VI({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(ni(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(ls,{mode:"popLayout",children:_.tasks.map(S=>l.jsx(Mt.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:l.jsx(p4,{boardTask:S,tasksById:g,personaName:v.personaNameByTaskId.get(S.task.id),envName:v.environmentNameByTaskId.get(S.task.id),onClick:()=>d(rs(S.task.id,void 0,n,s))})},S.task.id))})})]},_.status))})}function p4({boardTask:n,tasksById:s,personaName:i,envName:o,onClick:c}){const{task:u,isBlocked:d,childCount:m,doneChildCount:h,pausedSubBadge:g}=n,v=va(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 m4="_formContent_ymnez_1",h4="_section_ymnez_13",g4="_label_ymnez_19",v4="_titleInput_ymnez_26",y4="_descriptionTextarea_ymnez_58",b4="_selectField_ymnez_94",_4="_checkboxRow_ymnez_128",x4="_checkboxLabel_ymnez_141",S4="_fieldError_ymnez_146",ut={formContent:m4,section:h4,label:g4,titleInput:v4,descriptionTextarea:y4,selectField:b4,checkboxRow:_4,checkboxLabel:x4,fieldError:S4};function T4(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 k4=100;function w4({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:k4,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 wx=y.createContext(void 0),N4=4e3;function j4({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=N4)=>{const g=`toast-${++o.current}`;i(v=>[...v,{id:g,message:d,variant:m,duration:h}])},[]);return l.jsx(wx.Provider,{value:{toasts:s,showToast:u,dismissToast:c},children:n})}function un(){const n=y.useContext(wx);if(!n)throw new Error("useToast must be used within ToastProvider");return n}const lp="grackle-theme",Nx="grackle-prefer-system",jx="(prefers-color-scheme: dark)";let mr=[],bc;function Df(){bc=void 0;for(const n of mr)n()}function cp(){return typeof window>"u"?!1:window.matchMedia(jx).matches}function _r(){if(typeof localStorage>"u")return $y;try{const n=localStorage.getItem(lp);if(n!==null&&Sx.has(n))return n}catch{}return $y}function Ac(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(Nx)==="true"}catch{return!1}}function up(n){return Hc.find(s=>s.variantLightId===n||s.variantDarkId===n)}function Cx(n,s){const i=rp(n);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?cp()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const o=up(n);if(o!=null&&o.variantLightId&&o.variantDarkId)return cp()?o.variantDarkId:o.variantLightId}return n}function qi(n,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=Cx(n,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&qi(_r(),Ac());function C4(){return bc===void 0&&(bc={themeId:_r(),systemDark:cp(),preferSystem:Ac()}),bc}function E4(n){return mr=[...mr,n],()=>{mr=mr.filter(s=>s!==n)}}function A4(){const n=y.useSyncExternalStore(E4,C4),{themeId:s,preferSystem:i}=n,o=Cx(s,i),c=y.useCallback(d=>{if(Sx.has(d)){try{localStorage.setItem(lp,d)}catch{}qi(d,Ac(),!0),Df()}},[]),u=y.useCallback(d=>{try{localStorage.setItem(Nx,d?"true":"false")}catch{}if(d){const m=_r(),h=rp(m);if(h!=null&&h.hidden){const g=up(m);if(g)try{localStorage.setItem(lp,g.id)}catch{}}}qi(_r(),d,!0),Df()},[]);return y.useEffect(()=>{qi(s,i)},[s,i]),y.useEffect(()=>{if(typeof window>"u")return;const d=window.matchMedia(jx),m=()=>{const h=_r(),g=Ac();if(g){const v=rp(h);if(v!=null&&v.variantDarkId&&v.variantLightId&&qi(h,g),v!=null&&v.hidden){const b=up(h);b!=null&&b.variantDarkId&&b.variantLightId&&qi(h,g)}}Df()};return d.addEventListener("change",m),()=>{d.removeEventListener("change",m)}},[]),{themeId:s,setTheme:c,resolvedThemeId:o,preferSystem:i,setPreferSystem:u}}const Ex=y.createContext(void 0);function D4({children:n}){const s=A4();return l.jsx(Ex.Provider,{value:s,children:n})}function Ax(){const n=y.useContext(Ex);if(!n)throw new Error("useThemeContext must be used within ThemeProvider");return n}const Dx=y.createContext(void 0),Rx=y.createContext(void 0);function R4({children:n}){const[s,i]=y.useState(void 0),o=y.useCallback(c=>{i(c)},[]);return l.jsx(Rx.Provider,{value:o,children:l.jsx(Dx.Provider,{value:s,children:n})})}function M4(){return y.useContext(Dx)}function O4(){const n=y.useContext(Rx);if(n===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return n}const om=y.createContext(void 0);function pt(){const n=y.useContext(om);if(!n)throw new Error("useGrackle must be used within GrackleProvider");return n}function Mx(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function Ox(n,s){return console.warn(`[ws] Malformed "${n}" message: ${s}`),!1}function I4(n){return Mx(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 B4=new Set(["off","subscription","api_key"]),rc=new Set(["off","on"]);function L4(n){return Mx(n)&&B4.has(n.claude)&&rc.has(n.github)&&rc.has(n.copilot)&&rc.has(n.codex)&&rc.has(n.goose)}function Ix(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 Bx(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 $i=5e3;function U4(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 Qa={label:"Home",url:Wa};function z4(n){return n?[Qa,{label:"Settings",url:Xi},{label:n,url:void 0}]:[Qa,{label:"Settings",url:void 0}]}const Lx={label:"Environments",url:eo};function P4(){return[Qa,{label:"Environments",url:void 0}]}function V4(){return[Qa,{label:"New Chat",url:void 0}]}function H4(n){return[Qa,{label:`Session ${n.slice(0,8)}`,url:void 0}]}function G4(n,s,i,o){const c=i.find(d=>d.id===n),u=o.find(d=>d.id===s);return[Qa,Lx,{label:(u==null?void 0:u.displayName)??"Environment",url:to(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function $4(n,s,i,o,c){const u=U4(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=[Qa];v&&g&&(b.push(Lx),b.push({label:v.displayName,url:to(g)})),h&&g&&b.push({label:h.name,url:Qi(h.id,g)});for(let S=0;S<u.length-1;S++)b.push({label:u[S].title,url:rs(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 rm(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 lm(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 q4(n,s,i){const o=n.filter(h=>h.status==="running"||h.status==="idle"||h.status==="waiting").length,c=Ux(s),u=s.filter(h=>dp(h,c)).length,d=s.filter(h=>h.status==="paused"||h.status==="failed"||dp(h,c)).length,m=i.filter(h=>h.status==="disconnected"||h.status==="error").length;return{activeSessions:o,blockedTasks:u,attentionTasks:d,unhealthyEnvironments:m}}function Ux(n){const s=new Map;for(const i of n)s.set(i.id,i.status);return s}function dp(n,s){return n.dependsOn.some(i=>s.get(i)!=="complete")}function F4(n,s){var d;const i=new Map;for(const m of s)i.set(m.id,m);const o=Ux(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}):dp(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 Z4(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 K4(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 ss=[{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
63
63
  export function verifyToken(req: Request, res: Response, next: NextFunction): void {
64
64
  const header = req.headers.authorization;
65
65
  if (!header?.startsWith("Bearer ")) {
@@ -500,4 +500,4 @@ const grackle = await host.mcpServer({
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(qy,{selectedTools:F,onChange:I=>{Q(I),me(()=>c(n.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,I),()=>{},"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(Xa,{isOpen:ae,title:"Delete Persona?",description:`"${n==null?void 0:n.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:fe,onCancel:()=>pe(!1)})]})}function CU(){const{themeId:n,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=Ax();return l.jsx(tO,{themeId:n,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c})}function EU(){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 AU(){const{connected:n,environments:s,sessions:i}=pt(),o=EU();return l.jsxs(l.Fragment,{children:[o&&l.jsx(a6,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),l.jsx(nO,{connected:n,environments:s,sessions:i})]})}function DU(){return l.jsx(XO,{})}const ob=ni();function RU(){const n=xt();return Os({key:"?"},()=>{n(F2)}),Os({key:"n"},()=>{n(ob)}),Os({key:"N"},()=>{n(ob)}),l.jsx(l.Fragment,{})}function Gc(n){const s=O4();y.useLayoutEffect(()=>(s(n),()=>{s(void 0)}),[n,s])}function MU(){const{workspaces:n,tasks:s}=pt(),i=y.useMemo(()=>l.jsx(O3,{workspaces:n,tasks:s}),[n,s]);return Gc(i),l.jsx(ti,{})}function OU(){const{environments:n}=pt(),s=y.useMemo(()=>l.jsx(t3,{environments:n}),[n]);return Gc(s),l.jsx(ti,{})}function IU(){const n=y.useMemo(()=>l.jsx(PI,{}),[]);return Gc(n),l.jsx(ti,{})}function BU(){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(mM,{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 Gc(d),l.jsx(ti,{})}const LU="_wizard_1260s_1",UU="_container_1260s_10",zU="_stepContent_1260s_19",PU="_logoArea_1260s_28",VU="_logoImage_1260s_32",HU="_heading_1260s_41",GU="_tagline_1260s_49",$U="_subtitle_1260s_56",qU="_featureList_1260s_64",FU="_runtimeGrid_1260s_89",ZU="_runtimeCard_1260s_101",KU="_runtimeName_1260s_133",YU="_runtimeDescription_1260s_139",JU="_buttonRow_1260s_144",WU="_primaryButton_1260s_151",XU="_ghostButton_1260s_185",QU="_dots_1260s_213",e7="_dot_1260s_213",rt={wizard:LU,container:UU,stepContent:zU,logoArea:PU,logoImage:VU,heading:HU,tagline:GU,subtitle:$U,featureList:qU,runtimeGrid:FU,runtimeCard:ZU,runtimeName:KU,runtimeDescription:YU,buttonRow:JU,primaryButton:WU,ghostButton:XU,dots:QU,dot:e7};function t7({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 n7({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 s7=[{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 a7({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:s7.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 i7=3,rb={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function o7(){const{personas:n,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=pt(),{showToast:c}=un(),u=xt(),[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=rb[_]??"sonnet";S.push(s(v.id,void 0,void 0,void 0,_,N))}const T=n.find(N=>N.id===a0);if(T&&_!==T.runtime){const N=rb[_]??"sonnet";S.push(s(a0,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(Yn,{to:"/",replace:!0}):l.jsx("div",{className:rt.wizard,"data-testid":"setup-wizard",children:l.jsxs("div",{className:rt.container,children:[l.jsx(ls,{mode:"wait",children:l.jsxs(Mt.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(t7,{onNext:()=>m(1)}),d===1&&l.jsx(n7,{onNext:()=>m(2),onBack:()=>m(0)}),d===2&&l.jsx(a7,{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:i7},(_,S)=>l.jsx("span",{className:rt.dot,"data-active":S===d},S))})]})})}const r7="_root_zndgp_1",l7="_body_zndgp_7",c7="_main_zndgp_19",u7="_sidebarWrapper_zndgp_26",d7="_overlay_zndgp_51",hr={root:r7,body:l7,main:c7,sidebarWrapper:u7,overlay:d7},f7=y.lazy(()=>jT(()=>import("./KnowledgePage-DcSnAfbP.js"),__vite__mapDeps([0,1,2,3,4])).then(n=>({default:n.KnowledgePage}))),zx=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function p7(){const{connected:n,environments:s,sessions:i,tasks:o}=pt(),{toasts:c,dismissToast:u}=un(),d=Bt(),m=M4(),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(kM,{connected:n,environments:s,sessions:i,onToggleSidebar:h?b:void 0,sidebarOpen:g}),l.jsx(DM,{}),l.jsxs("div",{className:hr.body,children:[h&&l.jsx("div",{className:hr.sidebarWrapper,"data-sidebar-open":g,children:l.jsx(LM,{content:m})}),h&&g&&l.jsx("div",{className:hr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),l.jsxs("div",{className:hr.main,children:[l.jsx(ti,{}),l.jsx(qM,{sessions:i,tasks:o,environments:s})]})]}),l.jsx(Z3,{toasts:c,onDismiss:u}),l.jsx(RU,{})]})}function m7(){const{lastSpawnedId:n,environments:s,tasks:i,connected:o,onboardingCompleted:c}=pt(),{showToast:u}=un();EB(s,u),MB(i,u);const d=xt(),m=Bt();return y.useEffect(()=>{n&&!m.pathname.includes("/tasks/")&&d(Eb(n),{replace:!0})},[n,d,m.pathname]),o&&c===!1?l.jsx(Yn,{to:"/setup",replace:!0}):l.jsx(R4,{children:l.jsxs("div",{className:hr.root,children:[zx&&l.jsx(xw,{}),l.jsx(p7,{})]})})}function Uf(){const{workspaceId:n}=_a(),{workspaces:s}=pt(),i=Bt(),o=s.find(h=>h.id===n);if(!(o!=null&&o.environmentId))return s.length===0?void 0:l.jsx(Yn,{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(Yn,{to:m,replace:!0})}function h7(){return l.jsxs(r2,{children:[l.jsx(Ne,{path:"setup",element:l.jsx(o7,{})}),l.jsxs(Ne,{element:l.jsx(m7,{}),children:[l.jsx(Ne,{index:!0,element:l.jsx(t8,{})}),l.jsx(Ne,{path:"chat",element:l.jsx(u8,{})}),l.jsx(Ne,{path:"sessions/new",element:l.jsx(d8,{})}),l.jsx(Ne,{path:"sessions/:sessionId",element:l.jsx(m8,{})}),l.jsx(Ne,{element:l.jsx(BU,{}),children:l.jsx(Ne,{path:"knowledge",element:l.jsx(y.Suspense,{fallback:l.jsx(fx,{}),children:l.jsx(f7,{})})})}),l.jsxs(Ne,{element:l.jsx(MU,{}),children:[l.jsx(Ne,{path:"tasks",element:l.jsx(Q5,{})}),l.jsx(Ne,{path:"tasks/new",element:l.jsx(tb,{})}),l.jsx(Ne,{path:"tasks/:taskId",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"tasks/:taskId/edit",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"tasks/:taskId/stream",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"tasks/:taskId/findings",element:l.jsx(ma,{})})]}),l.jsxs(Ne,{element:l.jsx(OU,{}),children:[l.jsx(Ne,{path:"workspaces",element:l.jsx(Yn,{to:"/environments",replace:!0})}),l.jsx(Ne,{path:"workspaces/new",element:l.jsx(C8,{})}),l.jsx(Ne,{path:"workspaces/:workspaceId",element:l.jsx(Uf,{})}),l.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId",element:l.jsx(Uf,{})}),l.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:l.jsx(Uf,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId",element:l.jsx(v8,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:l.jsx(tb,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:l.jsx(ma,{})}),l.jsxs(Ne,{path:"environments",element:l.jsx(U8,{}),children:[l.jsx(Ne,{index:!0,element:l.jsx(e8,{})}),l.jsx(Ne,{path:"new",element:l.jsx(M8,{})}),l.jsx(Ne,{path:":environmentId",element:l.jsx(fU,{})}),l.jsx(Ne,{path:":environmentId/edit",element:l.jsx(O8,{})})]})]}),l.jsx(Ne,{element:l.jsx(IU,{}),children:l.jsxs(Ne,{path:"settings",element:l.jsx(hU,{}),children:[l.jsx(Ne,{index:!0,element:l.jsx(Yn,{to:"credentials",replace:!0})}),l.jsx(Ne,{path:"environments",element:l.jsx(Yn,{to:"/environments",replace:!0})}),l.jsx(Ne,{path:"credentials",element:l.jsx(gU,{})}),l.jsx(Ne,{path:"tokens",element:l.jsx(Yn,{to:"../credentials",replace:!0})}),l.jsx(Ne,{path:"personas",element:l.jsx(vU,{})}),l.jsx(Ne,{path:"personas/new",element:l.jsx(ib,{})}),l.jsx(Ne,{path:"personas/:personaId",element:l.jsx(ib,{})}),l.jsx(Ne,{path:"appearance",element:l.jsx(CU,{})}),l.jsx(Ne,{path:"shortcuts",element:l.jsx(DU,{})}),l.jsx(Ne,{path:"about",element:l.jsx(AU,{})})]})}),l.jsx(Ne,{path:"*",element:l.jsx(Yn,{to:"/",replace:!0})})]})]})}const g7=1e4;function v7(){const{onboardingCompleted:n}=pt(),[s,i]=y.useState(!1);y.useEffect(()=>{if(n!==void 0)return;const c=setTimeout(()=>i(!0),g7);return()=>clearTimeout(c)},[n]);const o=n===void 0&&!s;return l.jsx(ls,{mode:"wait",children:o?l.jsx(Mt.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:l.jsx(fx,{})},"splash"):l.jsx(Mt.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:l.jsx(R2,{basename:"/".replace(/\/$/,""),children:l.jsx(h7,{})})},"app")})}function y7(){const n=zx?aB:CB;return l.jsx(D4,{children:l.jsx(j4,{children:l.jsx(n,{children:l.jsx(v7,{})})})})}kT.createRoot(document.getElementById("root")).render(l.jsx(y.StrictMode,{children:l.jsx(y7,{})}));export{xa as B,Mb as K,pt as a,Eb as s,rs as t,xt 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),me(()=>c(n.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,I),()=>{},"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(Xa,{isOpen:ae,title:"Delete Persona?",description:`"${n==null?void 0:n.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:fe,onCancel:()=>pe(!1)})]})}function CU(){const{themeId:n,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=Ax();return l.jsx(tO,{themeId:n,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c})}function EU(){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 AU(){const{connected:n,environments:s,sessions:i}=pt(),o=EU();return l.jsxs(l.Fragment,{children:[o&&l.jsx(a6,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),l.jsx(nO,{connected:n,environments:s,sessions:i})]})}function DU(){return l.jsx(XO,{})}const ob=ni();function RU(){const n=xt();return Os({key:"?"},()=>{n(F2)}),Os({key:"n"},()=>{n(ob)}),Os({key:"N"},()=>{n(ob)}),l.jsx(l.Fragment,{})}function Gc(n){const s=O4();y.useLayoutEffect(()=>(s(n),()=>{s(void 0)}),[n,s])}function MU(){const{workspaces:n,tasks:s}=pt(),i=y.useMemo(()=>l.jsx(O3,{workspaces:n,tasks:s}),[n,s]);return Gc(i),l.jsx(ti,{})}function OU(){const{environments:n}=pt(),s=y.useMemo(()=>l.jsx(t3,{environments:n}),[n]);return Gc(s),l.jsx(ti,{})}function IU(){const n=y.useMemo(()=>l.jsx(PI,{}),[]);return Gc(n),l.jsx(ti,{})}function BU(){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(mM,{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 Gc(d),l.jsx(ti,{})}const LU="_wizard_1260s_1",UU="_container_1260s_10",zU="_stepContent_1260s_19",PU="_logoArea_1260s_28",VU="_logoImage_1260s_32",HU="_heading_1260s_41",GU="_tagline_1260s_49",$U="_subtitle_1260s_56",qU="_featureList_1260s_64",FU="_runtimeGrid_1260s_89",ZU="_runtimeCard_1260s_101",KU="_runtimeName_1260s_133",YU="_runtimeDescription_1260s_139",JU="_buttonRow_1260s_144",WU="_primaryButton_1260s_151",XU="_ghostButton_1260s_185",QU="_dots_1260s_213",e7="_dot_1260s_213",rt={wizard:LU,container:UU,stepContent:zU,logoArea:PU,logoImage:VU,heading:HU,tagline:GU,subtitle:$U,featureList:qU,runtimeGrid:FU,runtimeCard:ZU,runtimeName:KU,runtimeDescription:YU,buttonRow:JU,primaryButton:WU,ghostButton:XU,dots:QU,dot:e7};function t7({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 n7({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 s7=[{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 a7({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:s7.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 i7=3,rb={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function o7(){const{personas:n,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=pt(),{showToast:c}=un(),u=xt(),[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=rb[_]??"sonnet";S.push(s(v.id,void 0,void 0,void 0,_,N))}const T=n.find(N=>N.id===a0);if(T&&_!==T.runtime){const N=rb[_]??"sonnet";S.push(s(a0,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(Yn,{to:"/",replace:!0}):l.jsx("div",{className:rt.wizard,"data-testid":"setup-wizard",children:l.jsxs("div",{className:rt.container,children:[l.jsx(ls,{mode:"wait",children:l.jsxs(Mt.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(t7,{onNext:()=>m(1)}),d===1&&l.jsx(n7,{onNext:()=>m(2),onBack:()=>m(0)}),d===2&&l.jsx(a7,{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:i7},(_,S)=>l.jsx("span",{className:rt.dot,"data-active":S===d},S))})]})})}const r7="_root_zndgp_1",l7="_body_zndgp_7",c7="_main_zndgp_19",u7="_sidebarWrapper_zndgp_26",d7="_overlay_zndgp_51",hr={root:r7,body:l7,main:c7,sidebarWrapper:u7,overlay:d7},f7=y.lazy(()=>jT(()=>import("./KnowledgePage-D40LOPEE.js"),__vite__mapDeps([0,1,2,3,4])).then(n=>({default:n.KnowledgePage}))),zx=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function p7(){const{connected:n,environments:s,sessions:i,tasks:o}=pt(),{toasts:c,dismissToast:u}=un(),d=Bt(),m=M4(),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(kM,{connected:n,environments:s,sessions:i,onToggleSidebar:h?b:void 0,sidebarOpen:g}),l.jsx(DM,{}),l.jsxs("div",{className:hr.body,children:[h&&l.jsx("div",{className:hr.sidebarWrapper,"data-sidebar-open":g,children:l.jsx(LM,{content:m})}),h&&g&&l.jsx("div",{className:hr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),l.jsxs("div",{className:hr.main,children:[l.jsx(ti,{}),l.jsx(qM,{sessions:i,tasks:o,environments:s})]})]}),l.jsx(Z3,{toasts:c,onDismiss:u}),l.jsx(RU,{})]})}function m7(){const{lastSpawnedId:n,environments:s,tasks:i,connected:o,onboardingCompleted:c}=pt(),{showToast:u}=un();EB(s,u),MB(i,u);const d=xt(),m=Bt();return y.useEffect(()=>{n&&!m.pathname.includes("/tasks/")&&d(Eb(n),{replace:!0})},[n,d,m.pathname]),o&&c===!1?l.jsx(Yn,{to:"/setup",replace:!0}):l.jsx(R4,{children:l.jsxs("div",{className:hr.root,children:[zx&&l.jsx(xw,{}),l.jsx(p7,{})]})})}function Uf(){const{workspaceId:n}=_a(),{workspaces:s}=pt(),i=Bt(),o=s.find(h=>h.id===n);if(!(o!=null&&o.environmentId))return s.length===0?void 0:l.jsx(Yn,{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(Yn,{to:m,replace:!0})}function h7(){return l.jsxs(r2,{children:[l.jsx(Ne,{path:"setup",element:l.jsx(o7,{})}),l.jsxs(Ne,{element:l.jsx(m7,{}),children:[l.jsx(Ne,{index:!0,element:l.jsx(t8,{})}),l.jsx(Ne,{path:"chat",element:l.jsx(u8,{})}),l.jsx(Ne,{path:"sessions/new",element:l.jsx(d8,{})}),l.jsx(Ne,{path:"sessions/:sessionId",element:l.jsx(m8,{})}),l.jsx(Ne,{element:l.jsx(BU,{}),children:l.jsx(Ne,{path:"knowledge",element:l.jsx(y.Suspense,{fallback:l.jsx(fx,{}),children:l.jsx(f7,{})})})}),l.jsxs(Ne,{element:l.jsx(MU,{}),children:[l.jsx(Ne,{path:"tasks",element:l.jsx(Q5,{})}),l.jsx(Ne,{path:"tasks/new",element:l.jsx(tb,{})}),l.jsx(Ne,{path:"tasks/:taskId",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"tasks/:taskId/edit",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"tasks/:taskId/stream",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"tasks/:taskId/findings",element:l.jsx(ma,{})})]}),l.jsxs(Ne,{element:l.jsx(OU,{}),children:[l.jsx(Ne,{path:"workspaces",element:l.jsx(Yn,{to:"/environments",replace:!0})}),l.jsx(Ne,{path:"workspaces/new",element:l.jsx(C8,{})}),l.jsx(Ne,{path:"workspaces/:workspaceId",element:l.jsx(Uf,{})}),l.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId",element:l.jsx(Uf,{})}),l.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:l.jsx(Uf,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId",element:l.jsx(v8,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:l.jsx(tb,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:l.jsx(ma,{})}),l.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:l.jsx(ma,{})}),l.jsxs(Ne,{path:"environments",element:l.jsx(U8,{}),children:[l.jsx(Ne,{index:!0,element:l.jsx(e8,{})}),l.jsx(Ne,{path:"new",element:l.jsx(M8,{})}),l.jsx(Ne,{path:":environmentId",element:l.jsx(fU,{})}),l.jsx(Ne,{path:":environmentId/edit",element:l.jsx(O8,{})})]})]}),l.jsx(Ne,{element:l.jsx(IU,{}),children:l.jsxs(Ne,{path:"settings",element:l.jsx(hU,{}),children:[l.jsx(Ne,{index:!0,element:l.jsx(Yn,{to:"credentials",replace:!0})}),l.jsx(Ne,{path:"environments",element:l.jsx(Yn,{to:"/environments",replace:!0})}),l.jsx(Ne,{path:"credentials",element:l.jsx(gU,{})}),l.jsx(Ne,{path:"tokens",element:l.jsx(Yn,{to:"../credentials",replace:!0})}),l.jsx(Ne,{path:"personas",element:l.jsx(vU,{})}),l.jsx(Ne,{path:"personas/new",element:l.jsx(ib,{})}),l.jsx(Ne,{path:"personas/:personaId",element:l.jsx(ib,{})}),l.jsx(Ne,{path:"appearance",element:l.jsx(CU,{})}),l.jsx(Ne,{path:"shortcuts",element:l.jsx(DU,{})}),l.jsx(Ne,{path:"about",element:l.jsx(AU,{})})]})}),l.jsx(Ne,{path:"*",element:l.jsx(Yn,{to:"/",replace:!0})})]})]})}const g7=1e4;function v7(){const{onboardingCompleted:n}=pt(),[s,i]=y.useState(!1);y.useEffect(()=>{if(n!==void 0)return;const c=setTimeout(()=>i(!0),g7);return()=>clearTimeout(c)},[n]);const o=n===void 0&&!s;return l.jsx(ls,{mode:"wait",children:o?l.jsx(Mt.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:l.jsx(fx,{})},"splash"):l.jsx(Mt.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:l.jsx(R2,{basename:"/".replace(/\/$/,""),children:l.jsx(h7,{})})},"app")})}function y7(){const n=zx?aB:CB;return l.jsx(D4,{children:l.jsx(j4,{children:l.jsx(n,{children:l.jsx(v7,{})})})})}kT.createRoot(document.getElementById("root")).render(l.jsx(y.StrictMode,{children:l.jsx(y7,{})}));export{xa as B,Mb as K,pt as a,Eb as s,rs as t,xt as u};