@grackle-ai/web 0.89.2 → 0.89.3

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,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-B3FYOjkZ.js","assets/dagview-CzJGOIoX.js","assets/grpc-CRztlRZY.js","assets/markdown-DH3wQq0i.js","assets/KnowledgePage-DMqJ4jlP.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-BHCITraU.js","assets/dagview-CzJGOIoX.js","assets/grpc-CRztlRZY.js","assets/markdown-DH3wQq0i.js","assets/KnowledgePage-DMqJ4jlP.css"])))=>i.map(i=>d[i]);
2
2
  import{r as BS,a as LS,b as _,j as r,d as Dv,H as Rv,P as Mv,i as zS,B as US,c as $S,C as PS,M as VS}from"./dagview-CzJGOIoX.js";import{c as HS,a as qS,G as GS,f as FS,M as ZS,A as qb,D as Gb,W as KS,O as YS,b as JS,C as Wc,d as WS,e as Fb,w as XS,t as QS,p as hc,g as eT,R as gr,S as Iv}from"./grpc-CRztlRZY.js";import{v as tT,r as nT,t as gc,i as sT,f as aT,M as Xc,a as Qc}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 kf={exports:{}},vr={},Sf={exports:{}},Tf={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
@@ -251,7 +251,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
251
251
  top: ${h}px !important;
252
252
  left: ${g}px !important;
253
253
  }
254
- `),()=>{document.head.removeChild(v)}},[s]),r.jsx(sA,{isPresent:s,childRef:o,sizeRef:c,children:_.cloneElement(t,{ref:o})})}const iA=({children:t,initial:s,isPresent:i,onExitComplete:o,custom:c,presenceAffectsLayout:u,mode:d})=>{const p=em(oA),h=_.useId(),g=_.useCallback(b=>{p.set(b,!0);for(const y of p.values())if(!y)return;o&&o()},[p,o]),v=_.useMemo(()=>({id:h,initial:s,isPresent:i,custom:c,onExitComplete:g,register:b=>(p.set(b,!1),()=>p.delete(b))}),u?[Math.random(),g]:[i,g]);return _.useMemo(()=>{p.forEach((b,y)=>p.set(y,!1))},[i]),_.useEffect(()=>{!i&&!p.size&&o&&o()},[i]),d==="popLayout"&&(t=r.jsx(aA,{isPresent:i,children:t})),r.jsx(iu.Provider,{value:v,children:t})};function oA(){return new Map}function __(t=!0){const s=_.useContext(iu);if(s===null)return[!0,null];const{isPresent:i,onExitComplete:o,register:c}=s,u=_.useId();_.useEffect(()=>{t&&c(u)},[t]);const d=_.useCallback(()=>t&&o&&o(u),[u,o,t]);return!i&&o?[!1,d]:[!0]}const bc=t=>t.key||"";function ay(t){const s=[];return _.Children.forEach(t,i=>{_.isValidElement(i)&&s.push(i)}),s}const nm=typeof window<"u",x_=nm?_.useLayoutEffect:_.useEffect,vs=({children:t,custom:s,initial:i=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:u="sync",propagate:d=!1})=>{const[p,h]=__(d),g=_.useMemo(()=>ay(t),[t]),v=d&&!p?[]:g.map(bc),b=_.useRef(!0),y=_.useRef(g),k=em(()=>new Map),[S,N]=_.useState(g),[w,j]=_.useState(g);x_(()=>{b.current=!1,y.current=g;for(let I=0;I<w.length;I++){const R=bc(w[I]);v.includes(R)?k.delete(R):k.get(R)!==!0&&k.set(R,!1)}},[w,v.length,v.join("-")]);const C=[];if(g!==S){let I=[...g];for(let R=0;R<w.length;R++){const E=w[R],q=bc(E);v.includes(q)||(I.splice(R,0,E),C.push(E))}u==="wait"&&C.length&&(I=C),j(ay(I)),N(g);return}const{forceRender:D}=_.useContext(Qp);return r.jsx(r.Fragment,{children:w.map(I=>{const R=bc(I),E=d&&!p?!1:g===w||v.includes(R),q=()=>{if(k.has(R))k.set(R,!0);else return;let $=!0;k.forEach(Y=>{Y||($=!1)}),$&&(D==null||D(),j(y.current),d&&(h==null||h()),o&&o())};return r.jsx(iA,{isPresent:E,initial:!b.current||i?void 0:!1,custom:E?void 0:s,presenceAffectsLayout:c,mode:u,onExitComplete:E?void 0:q,children:I},R)})})},jn=t=>t;let k_=jn;const rA={useManualTiming:!1};function lA(t){let s=new Set,i=new Set,o=!1,c=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function p(g){u.has(g)&&(h.schedule(g),t()),g(d)}const h={schedule:(g,v=!1,b=!1)=>{const k=b&&o?s:i;return v&&u.add(g),k.has(g)||k.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(p),s.clear(),o=!1,c&&(c=!1,h.process(g))}};return h}const _c=["read","resolveKeyframes","update","preRender","render","postRender"],cA=40;function S_(t,s){let i=!1,o=!0;const c={delta:0,timestamp:0,isProcessing:!1},u=()=>i=!0,d=_c.reduce((j,C)=>(j[C]=lA(u),j),{}),{read:p,resolveKeyframes:h,update:g,preRender:v,render:b,postRender:y}=d,k=()=>{const j=performance.now();i=!1,c.delta=o?1e3/60:Math.max(Math.min(j-c.timestamp,cA),1),c.timestamp=j,c.isProcessing=!0,p.process(c),h.process(c),g.process(c),v.process(c),b.process(c),y.process(c),c.isProcessing=!1,i&&s&&(o=!1,t(k))},S=()=>{i=!0,o=!0,c.isProcessing||t(k)};return{schedule:_c.reduce((j,C)=>{const D=d[C];return j[C]=(I,R=!1,E=!1)=>(i||S(),D.schedule(I,R,E)),j},{}),cancel:j=>{for(let C=0;C<_c.length;C++)d[_c[C]].cancel(j)},state:c,steps:d}}const{schedule:vt,cancel:Da,state:Wt,steps:Hf}=S_(typeof requestAnimationFrame<"u"?requestAnimationFrame:jn,!0),T_=_.createContext({strict:!1}),iy={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"]},ho={};for(const t in iy)ho[t]={isEnabled:s=>iy[t].some(i=>!!s[i])};function uA(t){for(const s in t)ho[s]={...ho[s],...t[s]}}const dA=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function $c(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||dA.has(t)}let N_=t=>!$c(t);function fA(t){t&&(N_=s=>s.startsWith("on")?!$c(s):t(s))}try{fA(require("@emotion/is-prop-valid").default)}catch{}function pA(t,s,i){const o={};for(const c in t)c==="values"&&typeof t.values=="object"||(N_(c)||i===!0&&$c(c)||!s&&!$c(c)||t.draggable&&c.startsWith("onDrag"))&&(o[c]=t[c]);return o}function mA(t){if(typeof Proxy>"u")return t;const s=new Map,i=(...o)=>t(...o);return new Proxy(i,{get:(o,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const ou=_.createContext({});function Lr(t){return typeof t=="string"||Array.isArray(t)}function ru(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const sm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],am=["initial",...sm];function lu(t){return ru(t.animate)||am.some(s=>Lr(t[s]))}function j_(t){return!!(lu(t)||t.variants)}function hA(t,s){if(lu(t)){const{initial:i,animate:o}=t;return{initial:i===!1||Lr(i)?i:void 0,animate:Lr(o)?o:void 0}}return t.inherit!==!1?s:{}}function gA(t){const{initial:s,animate:i}=hA(t,_.useContext(ou));return _.useMemo(()=>({initial:s,animate:i}),[oy(s),oy(i)])}function oy(t){return Array.isArray(t)?t.join(" "):t}const vA=Symbol.for("motionComponentSymbol");function io(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function yA(t,s,i){return _.useCallback(o=>{o&&t.onMount&&t.onMount(o),s&&(o?s.mount(o):s.unmount()),i&&(typeof i=="function"?i(o):io(i)&&(i.current=o))},[s])}const im=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),bA="framerAppearId",w_="data-"+im(bA),{schedule:om}=S_(queueMicrotask,!1),C_=_.createContext({});function _A(t,s,i,o,c){var u,d;const{visualElement:p}=_.useContext(ou),h=_.useContext(T_),g=_.useContext(iu),v=_.useContext(tm).reducedMotion,b=_.useRef(null);o=o||h.renderer,!b.current&&o&&(b.current=o(t,{visualState:s,parent:p,props:i,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const y=b.current,k=_.useContext(C_);y&&!y.projection&&c&&(y.type==="html"||y.type==="svg")&&xA(b.current,i,c,k);const S=_.useRef(!1);_.useInsertionEffect(()=>{y&&S.current&&y.update(i,g)});const N=i[w_],w=_.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 x_(()=>{y&&(S.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),om.render(y.render),w.current&&y.animationState&&y.animationState.animateChanges())}),_.useEffect(()=>{y&&(!w.current&&y.animationState&&y.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var j;(j=window.MotionHandoffMarkAsComplete)===null||j===void 0||j.call(window,N)}),w.current=!1))}),y}function xA(t,s,i,o){const{layoutId:c,layout:u,drag:d,dragConstraints:p,layoutScroll:h,layoutRoot:g}=s;t.projection=new i(t.latestValues,s["data-framer-portal-id"]?void 0:E_(t.parent)),t.projection.setOptions({layoutId:c,layout:u,alwaysMeasureLayout:!!d||p&&io(p),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:h,layoutRoot:g})}function E_(t){if(t)return t.options.allowProjection!==!1?t.projection:E_(t.parent)}function kA({preloadedFeatures:t,createVisualElement:s,useRender:i,useVisualState:o,Component:c}){var u,d;t&&uA(t);function p(g,v){let b;const y={..._.useContext(tm),...g,layoutId:SA(g)},{isStatic:k}=y,S=gA(g),N=o(g,k);if(!k&&nm){TA();const w=NA(y);b=w.MeasureLayout,S.visualElement=_A(c,N,y,s,w.ProjectionNode)}return r.jsxs(ou.Provider,{value:S,children:[b&&S.visualElement?r.jsx(b,{visualElement:S.visualElement,...y}):null,i(c,g,yA(N,S.visualElement,v),N,k,S.visualElement)]})}p.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=_.forwardRef(p);return h[vA]=c,h}function SA({layoutId:t}){const s=_.useContext(Qp).id;return s&&t!==void 0?s+"-"+t:t}function TA(t,s){_.useContext(T_).strict}function NA(t){const{drag:s,layout:i}=ho;if(!s&&!i)return{};const o={...s,...i};return{MeasureLayout:s!=null&&s.isEnabled(t)||i!=null&&i.isEnabled(t)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}const jA=["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 rm(t){return typeof t!="string"||t.includes("-")?!1:!!(jA.indexOf(t)>-1||/[A-Z]/u.test(t))}function ry(t){const s=[{},{}];return t==null||t.values.forEach((i,o)=>{s[0][o]=i.get(),s[1][o]=i.getVelocity()}),s}function lm(t,s,i,o){if(typeof s=="function"){const[c,u]=ry(o);s=s(i!==void 0?i:t.custom,c,u)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,u]=ry(o);s=s(i!==void 0?i:t.custom,c,u)}return s}const _p=t=>Array.isArray(t),wA=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CA=t=>_p(t)?t[t.length-1]||0:t,nn=t=>!!(t&&t.getVelocity);function Mc(t){const s=nn(t)?t.get():t;return wA(s)?s.toValue():s}function EA({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:i},o,c,u){const d={latestValues:AA(o,c,u,t),renderState:s()};return i&&(d.onMount=p=>i({props:o,current:p,...d}),d.onUpdate=p=>i(p)),d}const A_=t=>(s,i)=>{const o=_.useContext(ou),c=_.useContext(iu),u=()=>EA(t,s,o,c);return i?u():em(u)};function AA(t,s,i,o){const c={},u=o(t,{});for(const y in u)c[y]=Mc(u[y]);let{initial:d,animate:p}=t;const h=lu(t),g=j_(t);s&&g&&!h&&t.inherit!==!1&&(d===void 0&&(d=s.initial),p===void 0&&(p=s.animate));let v=i?i.initial===!1:!1;v=v||d===!1;const b=v?p:d;if(b&&typeof b!="boolean"&&!ru(b)){const y=Array.isArray(b)?b:[b];for(let k=0;k<y.length;k++){const S=lm(t,y[k]);if(S){const{transitionEnd:N,transition:w,...j}=S;for(const C in j){let D=j[C];if(Array.isArray(D)){const I=v?D.length-1:0;D=D[I]}D!==null&&(c[C]=D)}for(const C in N)c[C]=N[C]}}}return c}const ko=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],vi=new Set(ko),D_=t=>s=>typeof s=="string"&&s.startsWith(t),R_=D_("--"),DA=D_("var(--"),cm=t=>DA(t)?RA.test(t.split("/*")[0].trim()):!1,RA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,M_=(t,s)=>s&&typeof t=="number"?s.transform(t):t,Fs=(t,s,i)=>i>s?s:i<t?t:i,So={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},zr={...So,transform:t=>Fs(0,1,t)},xc={...So,default:1},Gr=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),wa=Gr("deg"),hs=Gr("%"),Ne=Gr("px"),MA=Gr("vh"),IA=Gr("vw"),ly={...hs,parse:t=>hs.parse(t)/100,transform:t=>hs.transform(t*100)},OA={borderWidth:Ne,borderTopWidth:Ne,borderRightWidth:Ne,borderBottomWidth:Ne,borderLeftWidth:Ne,borderRadius:Ne,radius:Ne,borderTopLeftRadius:Ne,borderTopRightRadius:Ne,borderBottomRightRadius:Ne,borderBottomLeftRadius:Ne,width:Ne,maxWidth:Ne,height:Ne,maxHeight:Ne,top:Ne,right:Ne,bottom:Ne,left:Ne,padding:Ne,paddingTop:Ne,paddingRight:Ne,paddingBottom:Ne,paddingLeft:Ne,margin:Ne,marginTop:Ne,marginRight:Ne,marginBottom:Ne,marginLeft:Ne,backgroundPositionX:Ne,backgroundPositionY:Ne},BA={rotate:wa,rotateX:wa,rotateY:wa,rotateZ:wa,scale:xc,scaleX:xc,scaleY:xc,scaleZ:xc,skew:wa,skewX:wa,skewY:wa,distance:Ne,translateX:Ne,translateY:Ne,translateZ:Ne,x:Ne,y:Ne,z:Ne,perspective:Ne,transformPerspective:Ne,opacity:zr,originX:ly,originY:ly,originZ:Ne},cy={...So,transform:Math.round},um={...OA,...BA,zIndex:cy,size:Ne,fillOpacity:zr,strokeOpacity:zr,numOctaves:cy},LA={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},zA=ko.length;function UA(t,s,i){let o="",c=!0;for(let u=0;u<zA;u++){const d=ko[u],p=t[d];if(p===void 0)continue;let h=!0;if(typeof p=="number"?h=p===(d.startsWith("scale")?1:0):h=parseFloat(p)===0,!h||i){const g=M_(p,um[d]);if(!h){c=!1;const v=LA[d]||d;o+=`${v}(${g}) `}i&&(s[d]=g)}}return o=o.trim(),i?o=i(s,c?"":o):c&&(o="none"),o}function dm(t,s,i){const{style:o,vars:c,transformOrigin:u}=t;let d=!1,p=!1;for(const h in s){const g=s[h];if(vi.has(h)){d=!0;continue}else if(R_(h)){c[h]=g;continue}else{const v=M_(g,um[h]);h.startsWith("origin")?(p=!0,u[h]=v):o[h]=v}}if(s.transform||(d||i?o.transform=UA(s,t.transform,i):o.transform&&(o.transform="none")),p){const{originX:h="50%",originY:g="50%",originZ:v=0}=u;o.transformOrigin=`${h} ${g} ${v}`}}const $A={offset:"stroke-dashoffset",array:"stroke-dasharray"},PA={offset:"strokeDashoffset",array:"strokeDasharray"};function VA(t,s,i=1,o=0,c=!0){t.pathLength=1;const u=c?$A:PA;t[u.offset]=Ne.transform(-o);const d=Ne.transform(s),p=Ne.transform(i);t[u.array]=`${d} ${p}`}function uy(t,s,i){return typeof t=="string"?t:Ne.transform(s+i*t)}function HA(t,s,i){const o=uy(s,t.x,t.width),c=uy(i,t.y,t.height);return`${o} ${c}`}function fm(t,{attrX:s,attrY:i,attrScale:o,originX:c,originY:u,pathLength:d,pathSpacing:p=1,pathOffset:h=0,...g},v,b){if(dm(t,g,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:y,style:k,dimensions:S}=t;y.transform&&(S&&(k.transform=y.transform),delete y.transform),S&&(c!==void 0||u!==void 0||k.transform)&&(k.transformOrigin=HA(S,c!==void 0?c:.5,u!==void 0?u:.5)),s!==void 0&&(y.x=s),i!==void 0&&(y.y=i),o!==void 0&&(y.scale=o),d!==void 0&&VA(y,d,p,h,!1)}const pm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),I_=()=>({...pm(),attrs:{}}),mm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function O_(t,{style:s,vars:i},o,c){Object.assign(t.style,s,c&&c.getProjectionStyles(o));for(const u in i)t.style.setProperty(u,i[u])}const B_=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 L_(t,s,i,o){O_(t,s,void 0,o);for(const c in s.attrs)t.setAttribute(B_.has(c)?c:im(c),s.attrs[c])}const Pc={};function qA(t){Object.assign(Pc,t)}function z_(t,{layout:s,layoutId:i}){return vi.has(t)||t.startsWith("origin")||(s||i!==void 0)&&(!!Pc[t]||t==="opacity")}function hm(t,s,i){var o;const{style:c}=t,u={};for(const d in c)(nn(c[d])||s.style&&nn(s.style[d])||z_(d,t)||((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 U_(t,s,i){const o=hm(t,s,i);for(const c in t)if(nn(t[c])||nn(s[c])){const u=ko.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;o[u]=t[c]}return o}function GA(t,s){try{s.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{s.dimensions={x:0,y:0,width:0,height:0}}}const dy=["x","y","width","height","cx","cy","r"],FA={useVisualState:A_({scrapeMotionValuesFromProps:U_,createRenderState:I_,onUpdate:({props:t,prevProps:s,current:i,renderState:o,latestValues:c})=>{if(!i)return;let u=!!t.drag;if(!u){for(const p in c)if(vi.has(p)){u=!0;break}}if(!u)return;let d=!s;if(s)for(let p=0;p<dy.length;p++){const h=dy[p];t[h]!==s[h]&&(d=!0)}d&&vt.read(()=>{GA(i,o),vt.render(()=>{fm(o,c,mm(i.tagName),t.transformTemplate),L_(i,o)})})}})},ZA={useVisualState:A_({scrapeMotionValuesFromProps:hm,createRenderState:pm})};function $_(t,s,i){for(const o in s)!nn(s[o])&&!z_(o,i)&&(t[o]=s[o])}function KA({transformTemplate:t},s){return _.useMemo(()=>{const i=pm();return dm(i,s,t),Object.assign({},i.vars,i.style)},[s])}function YA(t,s){const i=t.style||{},o={};return $_(o,i,t),Object.assign(o,KA(t,s)),o}function JA(t,s){const i={},o=YA(t,s);return t.drag&&t.dragListener!==!1&&(i.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(i.tabIndex=0),i.style=o,i}function WA(t,s,i,o){const c=_.useMemo(()=>{const u=I_();return fm(u,s,mm(o),t.transformTemplate),{...u.attrs,style:{...u.style}}},[s]);if(t.style){const u={};$_(u,t.style,t),c.style={...u,...c.style}}return c}function XA(t=!1){return(i,o,c,{latestValues:u},d)=>{const h=(rm(i)?WA:JA)(o,u,d,i),g=pA(o,typeof i=="string",t),v=i!==_.Fragment?{...g,...h,ref:c}:{},{children:b}=o,y=_.useMemo(()=>nn(b)?b.get():b,[b]);return _.createElement(i,{...v,children:y})}}function QA(t,s){return function(o,{forwardMotionProps:c}={forwardMotionProps:!1}){const d={...rm(o)?FA:ZA,preloadedFeatures:t,useRender:XA(c),createVisualElement:s,Component:o};return kA(d)}}function P_(t,s){if(!Array.isArray(s))return!1;const i=s.length;if(i!==t.length)return!1;for(let o=0;o<i;o++)if(s[o]!==t[o])return!1;return!0}function cu(t,s,i){const o=t.getProps();return lm(o,s,i!==void 0?i:o.custom,t)}function gm(t,s){return t?t[s]||t.default||t:void 0}const V_=new Set(["width","height","top","left","right","bottom",...ko]);let Ic;function eD(){Ic=void 0}const gs={now:()=>(Ic===void 0&&gs.set(Wt.isProcessing||rA.useManualTiming?Wt.timestamp:performance.now()),Ic),set:t=>{Ic=t,queueMicrotask(eD)}};function vm(t,s){t.indexOf(s)===-1&&t.push(s)}function ym(t,s){const i=t.indexOf(s);i>-1&&t.splice(i,1)}class bm{constructor(){this.subscriptions=[]}add(s){return vm(this.subscriptions,s),()=>ym(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 H_(t,s){return s?t*(1e3/s):0}const fy=30,tD=t=>!isNaN(parseFloat(t));class nD{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(o,c=!0)=>{const u=gs.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=gs.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=tD(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 bm);const o=this.events[s].add(i);return s==="change"?()=>{o(),vt.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=gs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>fy)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,fy);return H_(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 Ur(t,s){return new nD(t,s)}function sD(t,s,i){t.hasValue(s)?t.getValue(s).set(i):t.addValue(s,Ur(i))}function aD(t,s){const i=cu(t,s);let{transitionEnd:o={},transition:c={},...u}=i||{};u={...u,...o};for(const d in u){const p=CA(u[d]);sD(t,d,p)}}function iD(t){return!!(nn(t)&&t.add)}function xp(t,s){const i=t.getValue("willChange");if(iD(i))return i.add(s)}function q_(t){return t.props[w_]}function _m(t){let s;return()=>(s===void 0&&(s=t()),s)}const oD=_m(()=>window.ScrollTimeline!==void 0);class rD{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(oD()&&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 lD extends rD{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Vs=t=>t*1e3,Hs=t=>t/1e3;function xm(t){return typeof t=="function"}function py(t,s){t.timeline=s,t.onfinish=null}const km=t=>Array.isArray(t)&&typeof t[0]=="number",cD={linearEasing:void 0};function uD(t,s){const i=_m(t);return()=>{var o;return(o=cD[s])!==null&&o!==void 0?o:i()}}const Vc=uD(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),go=(t,s,i)=>{const o=s-t;return o===0?1:(i-t)/o},G_=(t,s,i=10)=>{let o="";const c=Math.max(Math.round(s/i),2);for(let u=0;u<c;u++)o+=t(go(0,c-1,u))+", ";return`linear(${o.substring(0,o.length-2)})`};function F_(t){return!!(typeof t=="function"&&Vc()||!t||typeof t=="string"&&(t in kp||Vc())||km(t)||Array.isArray(t)&&t.every(F_))}const Sr=([t,s,i,o])=>`cubic-bezier(${t}, ${s}, ${i}, ${o})`,kp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Sr([0,.65,.55,1]),circOut:Sr([.55,0,1,.45]),backIn:Sr([.31,.01,.66,-.59]),backOut:Sr([.33,1.53,.69,.99])};function Z_(t,s){if(t)return typeof t=="function"&&Vc()?G_(t,s):km(t)?Sr(t):Array.isArray(t)?t.map(i=>Z_(i,s)||kp.easeOut):kp[t]}const K_=(t,s,i)=>(((1-3*i+3*s)*t+(3*i-6*s))*t+3*s)*t,dD=1e-7,fD=12;function pD(t,s,i,o,c){let u,d,p=0;do d=s+(i-s)/2,u=K_(d,o,c)-t,u>0?i=d:s=d;while(Math.abs(u)>dD&&++p<fD);return d}function Fr(t,s,i,o){if(t===s&&i===o)return jn;const c=u=>pD(u,0,1,t,i);return u=>u===0||u===1?u:K_(c(u),s,o)}const Y_=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,J_=t=>s=>1-t(1-s),W_=Fr(.33,1.53,.69,.99),Sm=J_(W_),X_=Y_(Sm),Q_=t=>(t*=2)<1?.5*Sm(t):.5*(2-Math.pow(2,-10*(t-1))),Tm=t=>1-Math.sin(Math.acos(t)),e1=J_(Tm),t1=Y_(Tm),n1=t=>/^0[^.\s]+$/u.test(t);function mD(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||n1(t):!0}const Cr=t=>Math.round(t*1e5)/1e5,Nm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function hD(t){return t==null}const gD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,jm=(t,s)=>i=>!!(typeof i=="string"&&gD.test(i)&&i.startsWith(t)||s&&!hD(i)&&Object.prototype.hasOwnProperty.call(i,s)),s1=(t,s,i)=>o=>{if(typeof o!="string")return o;const[c,u,d,p]=o.match(Nm);return{[t]:parseFloat(c),[s]:parseFloat(u),[i]:parseFloat(d),alpha:p!==void 0?parseFloat(p):1}},vD=t=>Fs(0,255,t),qf={...So,transform:t=>Math.round(vD(t))},ri={test:jm("rgb","red"),parse:s1("red","green","blue"),transform:({red:t,green:s,blue:i,alpha:o=1})=>"rgba("+qf.transform(t)+", "+qf.transform(s)+", "+qf.transform(i)+", "+Cr(zr.transform(o))+")"};function yD(t){let s="",i="",o="",c="";return t.length>5?(s=t.substring(1,3),i=t.substring(3,5),o=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),i=t.substring(2,3),o=t.substring(3,4),c=t.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 Sp={test:jm("#"),parse:yD,transform:ri.transform},oo={test:jm("hsl","hue"),parse:s1("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:i,alpha:o=1})=>"hsla("+Math.round(t)+", "+hs.transform(Cr(s))+", "+hs.transform(Cr(i))+", "+Cr(zr.transform(o))+")"},tn={test:t=>ri.test(t)||Sp.test(t)||oo.test(t),parse:t=>ri.test(t)?ri.parse(t):oo.test(t)?oo.parse(t):Sp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?ri.transform(t):oo.transform(t)},bD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function _D(t){var s,i;return isNaN(t)&&typeof t=="string"&&(((s=t.match(Nm))===null||s===void 0?void 0:s.length)||0)+(((i=t.match(bD))===null||i===void 0?void 0:i.length)||0)>0}const a1="number",i1="color",xD="var",kD="var(",my="${}",SD=/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 $r(t){const s=t.toString(),i=[],o={color:[],number:[],var:[]},c=[];let u=0;const p=s.replace(SD,h=>(tn.test(h)?(o.color.push(u),c.push(i1),i.push(tn.parse(h))):h.startsWith(kD)?(o.var.push(u),c.push(xD),i.push(h)):(o.number.push(u),c.push(a1),i.push(parseFloat(h))),++u,my)).split(my);return{values:i,split:p,indexes:o,types:c}}function o1(t){return $r(t).values}function r1(t){const{split:s,types:i}=$r(t),o=s.length;return c=>{let u="";for(let d=0;d<o;d++)if(u+=s[d],c[d]!==void 0){const p=i[d];p===a1?u+=Cr(c[d]):p===i1?u+=tn.transform(c[d]):u+=c[d]}return u}}const TD=t=>typeof t=="number"?0:t;function ND(t){const s=o1(t);return r1(t)(s.map(TD))}const Ra={test:_D,parse:o1,createTransformer:r1,getAnimatableNone:ND},jD=new Set(["brightness","contrast","saturate","opacity"]);function wD(t){const[s,i]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[o]=i.match(Nm)||[];if(!o)return t;const c=i.replace(o,"");let u=jD.has(s)?1:0;return o!==i&&(u*=100),s+"("+u+c+")"}const CD=/\b([a-z-]*)\(.*?\)/gu,Tp={...Ra,getAnimatableNone:t=>{const s=t.match(CD);return s?s.map(wD).join(" "):t}},ED={...um,color:tn,backgroundColor:tn,outlineColor:tn,fill:tn,stroke:tn,borderColor:tn,borderTopColor:tn,borderRightColor:tn,borderBottomColor:tn,borderLeftColor:tn,filter:Tp,WebkitFilter:Tp},wm=t=>ED[t];function l1(t,s){let i=wm(t);return i!==Tp&&(i=Ra),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const AD=new Set(["auto","none","0"]);function DD(t,s,i){let o=0,c;for(;o<t.length&&!c;){const u=t[o];typeof u=="string"&&!AD.has(u)&&$r(u).values.length&&(c=t[o]),o++}if(c&&i)for(const u of s)t[u]=l1(i,c)}const hy=t=>t===So||t===Ne,gy=(t,s)=>parseFloat(t.split(", ")[s]),vy=(t,s)=>(i,{transform:o})=>{if(o==="none"||!o)return 0;const c=o.match(/^matrix3d\((.+)\)$/u);if(c)return gy(c[1],s);{const u=o.match(/^matrix\((.+)\)$/u);return u?gy(u[1],t):0}},RD=new Set(["x","y","z"]),MD=ko.filter(t=>!RD.has(t));function ID(t){const s=[];return MD.forEach(i=>{const o=t.getValue(i);o!==void 0&&(s.push([i,o.get()]),o.set(i.startsWith("scale")?1:0))}),s}const vo={width:({x:t},{paddingLeft:s="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),height:({y:t},{paddingTop:s="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),top:(t,{top:s})=>parseFloat(s),left:(t,{left:s})=>parseFloat(s),bottom:({y:t},{top:s})=>parseFloat(s)+(t.max-t.min),right:({x:t},{left:s})=>parseFloat(s)+(t.max-t.min),x:vy(4,13),y:vy(5,14)};vo.translateX=vo.x;vo.translateY=vo.y;const ci=new Set;let Np=!1,jp=!1;function c1(){if(jp){const t=Array.from(ci).filter(o=>o.needsMeasurement),s=new Set(t.map(o=>o.element)),i=new Map;s.forEach(o=>{const c=ID(o);c.length&&(i.set(o,c),o.render())}),t.forEach(o=>o.measureInitialState()),s.forEach(o=>{o.render();const c=i.get(o);c&&c.forEach(([u,d])=>{var p;(p=o.getValue(u))===null||p===void 0||p.set(d)})}),t.forEach(o=>o.measureEndState()),t.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}jp=!1,Np=!1,ci.forEach(t=>t.complete()),ci.clear()}function u1(){ci.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(jp=!0)})}function OD(){u1(),c1()}class Cm{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?(ci.add(this),Np||(Np=!0,vt.read(u1),vt.resolveKeyframes(c1))):(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(),p=s[s.length-1];if(d!==void 0)s[0]=d;else if(o&&i){const h=o.readValue(i,p);h!=null&&(s[0]=h)}s[0]===void 0&&(s[0]=p),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),ci.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,ci.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const d1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),BD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LD(t){const s=BD.exec(t);if(!s)return[,];const[,i,o,c]=s;return[`--${i??o}`,c]}function f1(t,s,i=1){const[o,c]=LD(t);if(!o)return;const u=window.getComputedStyle(s).getPropertyValue(o);if(u){const d=u.trim();return d1(d)?parseFloat(d):d}return cm(c)?f1(c,s,i+1):c}const p1=t=>s=>s.test(t),zD={test:t=>t==="auto",parse:t=>t},m1=[So,Ne,hs,wa,IA,MA,zD],yy=t=>m1.find(p1(t));class h1 extends Cm{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(),cm(g))){const v=f1(g,i.current);v!==void 0&&(s[h]=v),h===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!V_.has(o)||s.length!==2)return;const[c,u]=s,d=yy(c),p=yy(u);if(d!==p)if(hy(d)&&hy(p))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++)mD(s[c])&&o.push(c);o.length&&DD(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=vo[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,p=c[d];c[d]=vo[o](i.measureViewportBox(),window.getComputedStyle(i.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([h,g])=>{i.getValue(h).set(g)}),this.resolveNoneKeyframes()}}const by=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ra.test(t)||t==="0")&&!t.startsWith("url("));function UD(t){const s=t[0];if(t.length===1)return!0;for(let i=0;i<t.length;i++)if(t[i]!==s)return!0}function $D(t,s,i,o){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const u=t[t.length-1],d=by(c,s),p=by(u,s);return!d||!p?!1:UD(t)||(i==="spring"||xm(i))&&o}const PD=t=>t!==null;function uu(t,{repeat:s,repeatType:i="loop"},o){const c=t.filter(PD),u=s&&i!=="loop"&&s%2===1?0:c.length-1;return!u||o===void 0?c[u]:o}const VD=40;class g1{constructor({autoplay:s=!0,delay:i=0,type:o="keyframes",repeat:c=0,repeatDelay:u=0,repeatType:d="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=gs.now(),this.options={autoplay:s,delay:i,type:o,repeat:c,repeatDelay:u,repeatType:d,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>VD?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&OD(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=gs.now(),this.hasAttemptedResolve=!0;const{name:o,type:c,velocity:u,delay:d,onComplete:p,onUpdate:h,isGenerator:g}=this.options;if(!g&&!$D(s,o,c,u))if(d)this.options.duration=0;else{h&&h(uu(s,this.options,i)),p&&p(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,i);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:i,...v},this.onPostResolved())}onPostResolved(){}then(s,i){return this.currentFinishedPromise.then(s,i)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const wp=2e4;function v1(t){let s=0;const i=50;let o=t.next(s);for(;!o.done&&s<wp;)s+=i,o=t.next(s);return s>=wp?1/0:s}const St=(t,s,i)=>t+(s-t)*i;function Gf(t,s,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+(s-t)*6*i:i<1/2?s:i<2/3?t+(s-t)*(2/3-i)*6:t}function HD({hue:t,saturation:s,lightness:i,alpha:o}){t/=360,s/=100,i/=100;let c=0,u=0,d=0;if(!s)c=u=d=i;else{const p=i<.5?i*(1+s):i+s-i*s,h=2*i-p;c=Gf(h,p,t+1/3),u=Gf(h,p,t),d=Gf(h,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:o}}function Hc(t,s){return i=>i>0?s:t}const Ff=(t,s,i)=>{const o=t*t,c=i*(s*s-o)+o;return c<0?0:Math.sqrt(c)},qD=[Sp,ri,oo],GD=t=>qD.find(s=>s.test(t));function _y(t){const s=GD(t);if(!s)return!1;let i=s.parse(t);return s===oo&&(i=HD(i)),i}const xy=(t,s)=>{const i=_y(t),o=_y(s);if(!i||!o)return Hc(t,s);const c={...i};return u=>(c.red=Ff(i.red,o.red,u),c.green=Ff(i.green,o.green,u),c.blue=Ff(i.blue,o.blue,u),c.alpha=St(i.alpha,o.alpha,u),ri.transform(c))},FD=(t,s)=>i=>s(t(i)),Zr=(...t)=>t.reduce(FD),Cp=new Set(["none","hidden"]);function ZD(t,s){return Cp.has(t)?i=>i<=0?t:s:i=>i>=1?s:t}function KD(t,s){return i=>St(t,s,i)}function Em(t){return typeof t=="number"?KD:typeof t=="string"?cm(t)?Hc:tn.test(t)?xy:WD:Array.isArray(t)?y1:typeof t=="object"?tn.test(t)?xy:YD:Hc}function y1(t,s){const i=[...t],o=i.length,c=t.map((u,d)=>Em(u)(u,s[d]));return u=>{for(let d=0;d<o;d++)i[d]=c[d](u);return i}}function YD(t,s){const i={...t,...s},o={};for(const c in i)t[c]!==void 0&&s[c]!==void 0&&(o[c]=Em(t[c])(t[c],s[c]));return c=>{for(const u in o)i[u]=o[u](c);return i}}function JD(t,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],p=t.indexes[d][c[d]],h=(i=t.values[p])!==null&&i!==void 0?i:0;o[u]=h,c[d]++}return o}const WD=(t,s)=>{const i=Ra.createTransformer(s),o=$r(t),c=$r(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?Cp.has(t)&&!c.values.length||Cp.has(s)&&!o.values.length?ZD(t,s):Zr(y1(JD(o,c),c.values),i):Hc(t,s)};function b1(t,s,i){return typeof t=="number"&&typeof s=="number"&&typeof i=="number"?St(t,s,i):Em(t)(t,s)}const XD=5;function _1(t,s,i){const o=Math.max(s-XD,0);return H_(i-t(o),s-o)}const wt={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},Zf=.001;function QD({duration:t=wt.duration,bounce:s=wt.bounce,velocity:i=wt.velocity,mass:o=wt.mass}){let c,u,d=1-s;d=Fs(wt.minDamping,wt.maxDamping,d),t=Fs(wt.minDuration,wt.maxDuration,Hs(t)),d<1?(c=g=>{const v=g*d,b=v*t,y=v-i,k=Ep(g,d),S=Math.exp(-b);return Zf-y/k*S},u=g=>{const b=g*d*t,y=b*i+i,k=Math.pow(d,2)*Math.pow(g,2)*t,S=Math.exp(-b),N=Ep(Math.pow(g,2),d);return(-c(g)+Zf>0?-1:1)*((y-k)*S)/N}):(c=g=>{const v=Math.exp(-g*t),b=(g-i)*t+1;return-Zf+v*b},u=g=>{const v=Math.exp(-g*t),b=(i-g)*(t*t);return v*b});const p=5/t,h=tR(c,u,p);if(t=Vs(t),isNaN(h))return{stiffness:wt.stiffness,damping:wt.damping,duration:t};{const g=Math.pow(h,2)*o;return{stiffness:g,damping:d*2*Math.sqrt(o*g),duration:t}}}const eR=12;function tR(t,s,i){let o=i;for(let c=1;c<eR;c++)o=o-t(o)/s(o);return o}function Ep(t,s){return t*Math.sqrt(1-s*s)}const nR=["duration","bounce"],sR=["stiffness","damping","mass"];function ky(t,s){return s.some(i=>t[i]!==void 0)}function aR(t){let s={velocity:wt.velocity,stiffness:wt.stiffness,damping:wt.damping,mass:wt.mass,isResolvedFromDuration:!1,...t};if(!ky(t,sR)&&ky(t,nR))if(t.visualDuration){const i=t.visualDuration,o=2*Math.PI/(i*1.2),c=o*o,u=2*Fs(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:wt.mass,stiffness:c,damping:u}}else{const i=QD(t);s={...s,...i,mass:wt.mass},s.isResolvedFromDuration=!0}return s}function x1(t=wt.visualDuration,s=wt.bounce){const i=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:o,restDelta:c}=i;const u=i.keyframes[0],d=i.keyframes[i.keyframes.length-1],p={done:!1,value:u},{stiffness:h,damping:g,mass:v,duration:b,velocity:y,isResolvedFromDuration:k}=aR({...i,velocity:-Hs(i.velocity||0)}),S=y||0,N=g/(2*Math.sqrt(h*v)),w=d-u,j=Hs(Math.sqrt(h/v)),C=Math.abs(w)<5;o||(o=C?wt.restSpeed.granular:wt.restSpeed.default),c||(c=C?wt.restDelta.granular:wt.restDelta.default);let D;if(N<1){const R=Ep(j,N);D=E=>{const q=Math.exp(-N*j*E);return d-q*((S+N*j*w)/R*Math.sin(R*E)+w*Math.cos(R*E))}}else if(N===1)D=R=>d-Math.exp(-j*R)*(w+(S+j*w)*R);else{const R=j*Math.sqrt(N*N-1);D=E=>{const q=Math.exp(-N*j*E),$=Math.min(R*E,300);return d-q*((S+N*j*w)*Math.sinh($)+R*w*Math.cosh($))/R}}const I={calculatedDuration:k&&b||null,next:R=>{const E=D(R);if(k)p.done=R>=b;else{let q=0;N<1&&(q=R===0?Vs(S):_1(D,R,E));const $=Math.abs(q)<=o,Y=Math.abs(d-E)<=c;p.done=$&&Y}return p.value=p.done?d:E,p},toString:()=>{const R=Math.min(v1(I),wp),E=G_(q=>I.next(R*q).value,R,30);return R+"ms "+E}};return I}function Sy({keyframes:t,velocity:s=0,power:i=.8,timeConstant:o=325,bounceDamping:c=10,bounceStiffness:u=500,modifyTarget:d,min:p,max:h,restDelta:g=.5,restSpeed:v}){const b=t[0],y={done:!1,value:b},k=$=>p!==void 0&&$<p||h!==void 0&&$>h,S=$=>p===void 0?h:h===void 0||Math.abs(p-$)<Math.abs(h-$)?p:h;let N=i*s;const w=b+N,j=d===void 0?w:d(w);j!==w&&(N=j-b);const C=$=>-N*Math.exp(-$/o),D=$=>j+C($),I=$=>{const Y=C($),Z=D($);y.done=Math.abs(Y)<=g,y.value=y.done?j:Z};let R,E;const q=$=>{k(y.value)&&(R=$,E=x1({keyframes:[y.value,S(y.value)],velocity:_1(D,$,y.value),damping:c,stiffness:u,restDelta:g,restSpeed:v}))};return q(0),{calculatedDuration:null,next:$=>{let Y=!1;return!E&&R===void 0&&(Y=!0,I($),q($)),R!==void 0&&$>=R?E.next($-R):(!Y&&I($),y)}}}const iR=Fr(.42,0,1,1),oR=Fr(0,0,.58,1),k1=Fr(.42,0,.58,1),rR=t=>Array.isArray(t)&&typeof t[0]!="number",lR={linear:jn,easeIn:iR,easeInOut:k1,easeOut:oR,circIn:Tm,circInOut:t1,circOut:e1,backIn:Sm,backInOut:X_,backOut:W_,anticipate:Q_},Ty=t=>{if(km(t)){k_(t.length===4);const[s,i,o,c]=t;return Fr(s,i,o,c)}else if(typeof t=="string")return lR[t];return t};function cR(t,s,i){const o=[],c=i||b1,u=t.length-1;for(let d=0;d<u;d++){let p=c(t[d],t[d+1]);if(s){const h=Array.isArray(s)?s[d]||jn:s;p=Zr(h,p)}o.push(p)}return o}function uR(t,s,{clamp:i=!0,ease:o,mixer:c}={}){const u=t.length;if(k_(u===s.length),u===1)return()=>s[0];if(u===2&&s[0]===s[1])return()=>s[1];const d=t[0]===t[1];t[0]>t[u-1]&&(t=[...t].reverse(),s=[...s].reverse());const p=cR(s,o,c),h=p.length,g=v=>{if(d&&v<t[0])return s[0];let b=0;if(h>1)for(;b<t.length-2&&!(v<t[b+1]);b++);const y=go(t[b],t[b+1],v);return p[b](y)};return i?v=>g(Fs(t[0],t[u-1],v)):g}function dR(t,s){const i=t[t.length-1];for(let o=1;o<=s;o++){const c=go(0,s,o);t.push(St(i,1,c))}}function fR(t){const s=[0];return dR(s,t.length-1),s}function pR(t,s){return t.map(i=>i*s)}function mR(t,s){return t.map(()=>s||k1).splice(0,t.length-1)}function qc({duration:t=300,keyframes:s,times:i,ease:o="easeInOut"}){const c=rR(o)?o.map(Ty):Ty(o),u={done:!1,value:s[0]},d=pR(i&&i.length===s.length?i:fR(s),t),p=uR(d,s,{ease:Array.isArray(c)?c:mR(s,c)});return{calculatedDuration:t,next:h=>(u.value=p(h),u.done=h>=t,u)}}const hR=t=>{const s=({timestamp:i})=>t(i);return{start:()=>vt.update(s,!0),stop:()=>Da(s),now:()=>Wt.isProcessing?Wt.timestamp:gs.now()}},gR={decay:Sy,inertia:Sy,tween:qc,keyframes:qc,spring:x1},vR=t=>t/100;class Am extends g1{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)||Cm,p=(h,g)=>this.onKeyframesResolved(h,g);this.resolver=new d(u,p,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,p=xm(i)?i:gR[i]||qc;let h,g;p!==qc&&typeof s[0]!="number"&&(h=Zr(vR,b1(s[0],s[1])),s=[0,100]);const v=p({...this.options,keyframes:s});u==="mirror"&&(g=p({...this.options,keyframes:[...s].reverse(),velocity:-d})),v.calculatedDuration===null&&(v.calculatedDuration=v1(v));const{calculatedDuration:b}=v,y=b+c,k=y*(o+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:h,calculatedDuration:b,resolvedDuration:y,totalDuration:k}}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:$}=this.options;return{done:!0,value:$[$.length-1]}}const{finalKeyframe:c,generator:u,mirroredGenerator:d,mapPercentToKeyframes:p,keyframes:h,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=o;if(this.startTime===null)return u.next(0);const{delay:y,repeat:k,repeatType:S,repeatDelay:N,onUpdate:w}=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 j=this.currentTime-y*(this.speed>=0?1:-1),C=this.speed>=0?j<0:j>v;this.currentTime=Math.max(j,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let D=this.currentTime,I=u;if(k){const $=Math.min(this.currentTime,v)/b;let Y=Math.floor($),Z=$%1;!Z&&$>=1&&(Z=1),Z===1&&Y--,Y=Math.min(Y,k+1),!!(Y%2)&&(S==="reverse"?(Z=1-Z,N&&(Z-=N/b)):S==="mirror"&&(I=d)),D=Fs(0,1,Z)*b}const R=C?{done:!1,value:h[0]}:I.next(D);p&&(R.value=p(R.value));let{done:E}=R;!C&&g!==null&&(E=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const q=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return q&&c!==void 0&&(R.value=uu(h,this.options,c)),w&&w(R.value),q&&this.finish(),R}get duration(){const{resolved:s}=this;return s?Hs(s.calculatedDuration):0}get time(){return Hs(this.currentTime)}set time(s){s=Vs(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=Hs(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=hR,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 yR=new Set(["opacity","clipPath","filter","transform"]);function bR(t,s,i,{delay:o=0,duration:c=300,repeat:u=0,repeatType:d="loop",ease:p="easeInOut",times:h}={}){const g={[s]:i};h&&(g.offset=h);const v=Z_(p,c);return Array.isArray(v)&&(g.easing=v),t.animate(g,{delay:o,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:u+1,direction:d==="reverse"?"alternate":"normal"})}const _R=_m(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Gc=10,xR=2e4;function kR(t){return xm(t.type)||t.type==="spring"||!F_(t.ease)}function SR(t,s){const i=new Am({...s,keyframes:t,repeat:0,delay:0,isGenerator:!0});let o={done:!1,value:t[0]};const c=[];let u=0;for(;!o.done&&u<xR;)o=i.sample(u),c.push(o.value),u+=Gc;return{times:void 0,keyframes:c,duration:u-Gc,ease:"linear"}}const S1={anticipate:Q_,backInOut:X_,circInOut:t1};function TR(t){return t in S1}class Ny extends g1{constructor(s){super(s);const{name:i,motionValue:o,element:c,keyframes:u}=this.options;this.resolver=new h1(u,(d,p)=>this.onKeyframesResolved(d,p),i,o,c),this.resolver.scheduleResolve()}initPlayback(s,i){let{duration:o=300,times:c,ease:u,type:d,motionValue:p,name:h,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof u=="string"&&Vc()&&TR(u)&&(u=S1[u]),kR(this.options)){const{onComplete:b,onUpdate:y,motionValue:k,element:S,...N}=this.options,w=SR(s,N);s=w.keyframes,s.length===1&&(s[1]=s[0]),o=w.duration,c=w.times,u=w.ease,d="keyframes"}const v=bR(p.owner.current,h,s,{...this.options,duration:o,times:c,ease:u});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(py(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(uu(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 Hs(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Hs(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.currentTime=Vs(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 jn;const{animation:o}=i;py(o,s)}return jn}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:p}=s;if(i.playState==="idle"||i.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:y,...k}=this.options,S=new Am({...k,keyframes:o,duration:c,type:u,ease:d,times:p,isGenerator:!0}),N=Vs(this.time);g.setWithVelocity(S.sample(N-Gc).value,S.sample(N).value,Gc)}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:p}=s;if(!i||!i.owner||!(i.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:g}=i.owner.getProps();return _R()&&o&&yR.has(o)&&!h&&!g&&!c&&u!=="mirror"&&d!==0&&p!=="inertia"}}const NR={type:"spring",stiffness:500,damping:25,restSpeed:10},jR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),wR={type:"keyframes",duration:.8},CR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ER=(t,{keyframes:s})=>s.length>2?wR:vi.has(t)?t.startsWith("scale")?jR(s[1]):NR:CR;function AR({when:t,delay:s,delayChildren:i,staggerChildren:o,staggerDirection:c,repeat:u,repeatType:d,repeatDelay:p,from:h,elapsed:g,...v}){return!!Object.keys(v).length}const Dm=(t,s,i,o={},c,u)=>d=>{const p=gm(o,t)||{},h=p.delay||o.delay||0;let{elapsed:g=0}=o;g=g-Vs(h);let v={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:y=>{s.set(y),p.onUpdate&&p.onUpdate(y)},onComplete:()=>{d(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:u?void 0:c};AR(p)||(v={...v,...ER(t,v)}),v.duration&&(v.duration=Vs(v.duration)),v.repeatDelay&&(v.repeatDelay=Vs(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 y=uu(v.keyframes,p);if(y!==void 0)return vt.update(()=>{v.onUpdate(y),v.onComplete()}),new lD([])}return!u&&Ny.supports(v)?new Ny(v):new Am(v)};function DR({protectedKeys:t,needsAnimating:s},i){const o=t.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,o}function T1(t,s,{delay:i=0,transitionOverride:o,type:c}={}){var u;let{transition:d=t.getDefaultTransition(),transitionEnd:p,...h}=s;o&&(d=o);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const b in h){const y=t.getValue(b,(u=t.latestValues[b])!==null&&u!==void 0?u:null),k=h[b];if(k===void 0||v&&DR(v,b))continue;const S={delay:i,...gm(d||{},b)};let N=!1;if(window.MotionHandoffAnimation){const j=q_(t);if(j){const C=window.MotionHandoffAnimation(j,b,vt);C!==null&&(S.startTime=C,N=!0)}}xp(t,b),y.start(Dm(b,y,k,t.shouldReduceMotion&&V_.has(b)?{type:!1}:S,t,N));const w=y.animation;w&&g.push(w)}return p&&Promise.all(g).then(()=>{vt.update(()=>{p&&aD(t,p)})}),g}function Ap(t,s,i={}){var o;const c=cu(t,s,i.type==="exit"?(o=t.presenceContext)===null||o===void 0?void 0:o.custom:void 0);let{transition:u=t.getDefaultTransition()||{}}=c||{};i.transitionOverride&&(u=i.transitionOverride);const d=c?()=>Promise.all(T1(t,c,i)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:y}=u;return RR(t,s,v+g,b,y,i)}:()=>Promise.resolve(),{when:h}=u;if(h){const[g,v]=h==="beforeChildren"?[d,p]:[p,d];return g().then(()=>v())}else return Promise.all([d(),p(i.delay)])}function RR(t,s,i=0,o=0,c=1,u){const d=[],p=(t.variantChildren.size-1)*o,h=c===1?(g=0)=>g*o:(g=0)=>p-g*o;return Array.from(t.variantChildren).sort(MR).forEach((g,v)=>{g.notify("AnimationStart",s),d.push(Ap(g,s,{...u,delay:i+h(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(d)}function MR(t,s){return t.sortNodePosition(s)}function IR(t,s,i={}){t.notify("AnimationStart",s);let o;if(Array.isArray(s)){const c=s.map(u=>Ap(t,u,i));o=Promise.all(c)}else if(typeof s=="string")o=Ap(t,s,i);else{const c=typeof s=="function"?cu(t,s,i.custom):s;o=Promise.all(T1(t,c,i))}return o.then(()=>{t.notify("AnimationComplete",s)})}const OR=am.length;function N1(t){if(!t)return;if(!t.isControllingVariants){const i=t.parent?N1(t.parent)||{}:{};return t.props.initial!==void 0&&(i.initial=t.props.initial),i}const s={};for(let i=0;i<OR;i++){const o=am[i],c=t.props[o];(Lr(c)||c===!1)&&(s[o]=c)}return s}const BR=[...sm].reverse(),LR=sm.length;function zR(t){return s=>Promise.all(s.map(({animation:i,options:o})=>IR(t,i,o)))}function UR(t){let s=zR(t),i=jy(),o=!0;const c=h=>(g,v)=>{var b;const y=cu(t,v,h==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(y){const{transition:k,transitionEnd:S,...N}=y;g={...g,...N,...S}}return g};function u(h){s=h(t)}function d(h){const{props:g}=t,v=N1(t.parent)||{},b=[],y=new Set;let k={},S=1/0;for(let w=0;w<LR;w++){const j=BR[w],C=i[j],D=g[j]!==void 0?g[j]:v[j],I=Lr(D),R=j===h?C.isActive:null;R===!1&&(S=w);let E=D===v[j]&&D!==g[j]&&I;if(E&&o&&t.manuallyAnimateOnMount&&(E=!1),C.protectedKeys={...k},!C.isActive&&R===null||!D&&!C.prevProp||ru(D)||typeof D=="boolean")continue;const q=$R(C.prevProp,D);let $=q||j===h&&C.isActive&&!E&&I||w>S&&I,Y=!1;const Z=Array.isArray(D)?D:[D];let te=Z.reduce(c(j),{});R===!1&&(te={});const{prevResolvedValues:ae={}}=C,me={...ae,...te},ie=F=>{$=!0,y.has(F)&&(Y=!0,y.delete(F)),C.needsAnimating[F]=!0;const ne=t.getValue(F);ne&&(ne.liveStyle=!1)};for(const F in me){const ne=te[F],re=ae[F];if(k.hasOwnProperty(F))continue;let ue=!1;_p(ne)&&_p(re)?ue=!P_(ne,re):ue=ne!==re,ue?ne!=null?ie(F):y.add(F):ne!==void 0&&y.has(F)?ie(F):C.protectedKeys[F]=!0}C.prevProp=D,C.prevResolvedValues=te,C.isActive&&(k={...k,...te}),o&&t.blockInitialAnimation&&($=!1),$&&(!(E&&q)||Y)&&b.push(...Z.map(F=>({animation:F,options:{type:j}})))}if(y.size){const w={};y.forEach(j=>{const C=t.getBaseTarget(j),D=t.getValue(j);D&&(D.liveStyle=!0),w[j]=C??null}),b.push({animation:w})}let N=!!b.length;return o&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(N=!1),o=!1,N?s(b):Promise.resolve()}function p(h,g){var v;if(i[h].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(y=>{var k;return(k=y.animationState)===null||k===void 0?void 0:k.setActive(h,g)}),i[h].isActive=g;const b=d(h);for(const y in i)i[y].protectedKeys={};return b}return{animateChanges:d,setActive:p,setAnimateFunction:u,getState:()=>i,reset:()=>{i=jy(),o=!0}}}function $R(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!P_(s,t):!1}function ti(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function jy(){return{animate:ti(!0),whileInView:ti(),whileHover:ti(),whileTap:ti(),whileDrag:ti(),whileFocus:ti(),exit:ti()}}class Ia{constructor(s){this.isMounted=!1,this.node=s}update(){}}class PR extends Ia{constructor(s){super(s),s.animationState||(s.animationState=UR(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();ru(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 VR=0;class HR extends Ia{constructor(){super(...arguments),this.id=VR++}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 qR={animation:{Feature:PR},exit:{Feature:HR}},ns={x:!1,y:!1};function j1(){return ns.x||ns.y}function GR(t){return t==="x"||t==="y"?ns[t]?null:(ns[t]=!0,()=>{ns[t]=!1}):ns.x||ns.y?null:(ns.x=ns.y=!0,()=>{ns.x=ns.y=!1})}const Rm=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Pr(t,s,i,o={passive:!0}){return t.addEventListener(s,i,o),()=>t.removeEventListener(s,i)}function Kr(t){return{point:{x:t.pageX,y:t.pageY}}}const FR=t=>s=>Rm(s)&&t(s,Kr(s));function Er(t,s,i,o){return Pr(t,s,FR(i),o)}const wy=(t,s)=>Math.abs(t-s);function ZR(t,s){const i=wy(t.x,s.x),o=wy(t.y,s.y);return Math.sqrt(i**2+o**2)}class w1{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=Yf(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,k=ZR(b.offset,{x:0,y:0})>=3;if(!y&&!k)return;const{point:S}=b,{timestamp:N}=Wt;this.history.push({...S,timestamp:N});const{onStart:w,onMove:j}=this.handlers;y||(w&&w(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),j&&j(this.lastMoveEvent,b)},this.handlePointerMove=(b,y)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=Kf(y,this.transformPagePoint),vt.update(this.updatePoint,!0)},this.handlePointerUp=(b,y)=>{this.end();const{onEnd:k,onSessionEnd:S,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=Yf(b.type==="pointercancel"?this.lastMoveEventInfo:Kf(y,this.transformPagePoint),this.history);this.startEvent&&k&&k(b,w),S&&S(b,w)},!Rm(s))return;this.dragSnapToOrigin=u,this.handlers=i,this.transformPagePoint=o,this.contextWindow=c||window;const d=Kr(s),p=Kf(d,this.transformPagePoint),{point:h}=p,{timestamp:g}=Wt;this.history=[{...h,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,Yf(p,this.history)),this.removeListeners=Zr(Er(this.contextWindow,"pointermove",this.handlePointerMove),Er(this.contextWindow,"pointerup",this.handlePointerUp),Er(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Da(this.updatePoint)}}function Kf(t,s){return s?{point:s(t.point)}:t}function Cy(t,s){return{x:t.x-s.x,y:t.y-s.y}}function Yf({point:t},s){return{point:t,delta:Cy(t,C1(s)),offset:Cy(t,KR(s)),velocity:YR(s,.1)}}function KR(t){return t[0]}function C1(t){return t[t.length-1]}function YR(t,s){if(t.length<2)return{x:0,y:0};let i=t.length-1,o=null;const c=C1(t);for(;i>=0&&(o=t[i],!(c.timestamp-o.timestamp>Vs(s)));)i--;if(!o)return{x:0,y:0};const u=Hs(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 E1=1e-4,JR=1-E1,WR=1+E1,A1=.01,XR=0-A1,QR=0+A1;function wn(t){return t.max-t.min}function e3(t,s,i){return Math.abs(t-s)<=i}function Ey(t,s,i,o=.5){t.origin=o,t.originPoint=St(s.min,s.max,t.origin),t.scale=wn(i)/wn(s),t.translate=St(i.min,i.max,t.origin)-t.originPoint,(t.scale>=JR&&t.scale<=WR||isNaN(t.scale))&&(t.scale=1),(t.translate>=XR&&t.translate<=QR||isNaN(t.translate))&&(t.translate=0)}function Ar(t,s,i,o){Ey(t.x,s.x,i.x,o?o.originX:void 0),Ey(t.y,s.y,i.y,o?o.originY:void 0)}function Ay(t,s,i){t.min=i.min+s.min,t.max=t.min+wn(s)}function t3(t,s,i){Ay(t.x,s.x,i.x),Ay(t.y,s.y,i.y)}function Dy(t,s,i){t.min=s.min-i.min,t.max=t.min+wn(s)}function Dr(t,s,i){Dy(t.x,s.x,i.x),Dy(t.y,s.y,i.y)}function n3(t,{min:s,max:i},o){return s!==void 0&&t<s?t=o?St(s,t,o.min):Math.max(t,s):i!==void 0&&t>i&&(t=o?St(i,t,o.max):Math.min(t,i)),t}function Ry(t,s,i){return{min:s!==void 0?t.min+s:void 0,max:i!==void 0?t.max+i-(t.max-t.min):void 0}}function s3(t,{top:s,left:i,bottom:o,right:c}){return{x:Ry(t.x,i,c),y:Ry(t.y,s,o)}}function My(t,s){let i=s.min-t.min,o=s.max-t.max;return s.max-s.min<t.max-t.min&&([i,o]=[o,i]),{min:i,max:o}}function a3(t,s){return{x:My(t.x,s.x),y:My(t.y,s.y)}}function i3(t,s){let i=.5;const o=wn(t),c=wn(s);return c>o?i=go(s.min,s.max-o,t.min):o>c&&(i=go(t.min,t.max-c,s.min)),Fs(0,1,i)}function o3(t,s){const i={};return s.min!==void 0&&(i.min=s.min-t.min),s.max!==void 0&&(i.max=s.max-t.min),i}const Dp=.35;function r3(t=Dp){return t===!1?t=0:t===!0&&(t=Dp),{x:Iy(t,"left","right"),y:Iy(t,"top","bottom")}}function Iy(t,s,i){return{min:Oy(t,s),max:Oy(t,i)}}function Oy(t,s){return typeof t=="number"?t:t[s]||0}const By=()=>({translate:0,scale:1,origin:0,originPoint:0}),ro=()=>({x:By(),y:By()}),Ly=()=>({min:0,max:0}),Rt=()=>({x:Ly(),y:Ly()});function Hn(t){return[t("x"),t("y")]}function D1({top:t,left:s,right:i,bottom:o}){return{x:{min:s,max:i},y:{min:t,max:o}}}function l3({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function c3(t,s){if(!s)return t;const i=s({x:t.left,y:t.top}),o=s({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:o.y,right:o.x}}function Jf(t){return t===void 0||t===1}function Rp({scale:t,scaleX:s,scaleY:i}){return!Jf(t)||!Jf(s)||!Jf(i)}function ii(t){return Rp(t)||R1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function R1(t){return zy(t.x)||zy(t.y)}function zy(t){return t&&t!=="0%"}function Fc(t,s,i){const o=t-i,c=s*o;return i+c}function Uy(t,s,i,o,c){return c!==void 0&&(t=Fc(t,c,o)),Fc(t,i,o)+s}function Mp(t,s=0,i=1,o,c){t.min=Uy(t.min,s,i,o,c),t.max=Uy(t.max,s,i,o,c)}function M1(t,{x:s,y:i}){Mp(t.x,s.translate,s.scale,s.originPoint),Mp(t.y,i.translate,i.scale,i.originPoint)}const $y=.999999999999,Py=1.0000000000001;function u3(t,s,i,o=!1){const c=i.length;if(!c)return;s.x=s.y=1;let u,d;for(let p=0;p<c;p++){u=i[p],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&&co(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(s.x*=d.x.scale,s.y*=d.y.scale,M1(t,d)),o&&ii(u.latestValues)&&co(t,u.latestValues))}s.x<Py&&s.x>$y&&(s.x=1),s.y<Py&&s.y>$y&&(s.y=1)}function lo(t,s){t.min=t.min+s,t.max=t.max+s}function Vy(t,s,i,o,c=.5){const u=St(t.min,t.max,c);Mp(t,s,i,u,o)}function co(t,s){Vy(t.x,s.x,s.scaleX,s.scale,s.originX),Vy(t.y,s.y,s.scaleY,s.scale,s.originY)}function I1(t,s){return D1(c3(t.getBoundingClientRect(),s))}function d3(t,s,i){const o=I1(t,i),{scroll:c}=s;return c&&(lo(o.x,c.offset.x),lo(o.y,c.offset.y)),o}const O1=({current:t})=>t?t.ownerDocument.defaultView:null,f3=new WeakMap;class p3{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=Rt(),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(Kr(v).point)},u=(v,b)=>{const{drag:y,dragPropagation:k,onDragStart:S}=this.getProps();if(y&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=GR(y),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Hn(w=>{let j=this.getAxisMotionValue(w).get()||0;if(hs.test(j)){const{projection:C}=this.visualElement;if(C&&C.layout){const D=C.layout.layoutBox[w];D&&(j=wn(D)*(parseFloat(j)/100))}}this.originPoint[w]=j}),S&&vt.postRender(()=>S(v,b)),xp(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},d=(v,b)=>{const{dragPropagation:y,dragDirectionLock:k,onDirectionLock:S,onDrag:N}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:w}=b;if(k&&this.currentDirection===null){this.currentDirection=m3(w),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",b.point,w),this.updateAxis("y",b.point,w),this.visualElement.render(),N&&N(v,b)},p=(v,b)=>this.stop(v,b),h=()=>Hn(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 w1(s,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:p,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:O1(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&&vt.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||!kc(s,c,this.currentDirection))return;const u=this.getAxisMotionValue(s);let d=this.originPoint[s]+o[s];this.constraints&&this.constraints[s]&&(d=n3(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&&io(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=s3(c.layoutBox,i):this.constraints=!1,this.elastic=r3(o),u!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Hn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=o3(c.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!io(s))return!1;const o=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const u=d3(o,c.root,this.visualElement.getTransformPagePoint());let d=a3(c.layout.layoutBox,u);if(i){const p=i(l3(d));this.hasMutatedConstraints=!!p,p&&(d=D1(p))}return d}startAnimation(s){const{drag:i,dragMomentum:o,dragElastic:c,dragTransition:u,dragSnapToOrigin:d,onDragTransitionEnd:p}=this.getProps(),h=this.constraints||{},g=Hn(v=>{if(!kc(v,i,this.currentDirection))return;let b=h&&h[v]||{};d&&(b={min:0,max:0});const y=c?200:1e6,k=c?40:1e7,S={type:"inertia",velocity:o?s[v]:0,bounceStiffness:y,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...u,...b};return this.startAxisValueAnimation(v,S)});return Promise.all(g).then(p)}startAxisValueAnimation(s,i){const o=this.getAxisMotionValue(s);return xp(this.visualElement,s),o.start(Dm(s,o,0,i,this.visualElement,!1))}stopAnimation(){Hn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){Hn(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){Hn(i=>{const{drag:o}=this.getProps();if(!kc(i,o,this.currentDirection))return;const{projection:c}=this.visualElement,u=this.getAxisMotionValue(i);if(c&&c.layout){const{min:d,max:p}=c.layout.layoutBox[i];u.set(s[i]-St(d,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:o}=this.visualElement;if(!io(i)||!o||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Hn(d=>{const p=this.getAxisMotionValue(d);if(p&&this.constraints!==!1){const h=p.get();c[d]=i3({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(),Hn(d=>{if(!kc(d,s,null))return;const p=this.getAxisMotionValue(d),{min:h,max:g}=this.constraints[d];p.set(St(h,g,c[d]))})}addListeners(){if(!this.visualElement.current)return;f3.set(this.visualElement,this);const s=this.visualElement.current,i=Er(s,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(h)}),o=()=>{const{dragConstraints:h}=this.getProps();io(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()),vt.read(o);const d=Pr(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(Hn(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(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:o=!1,dragPropagation:c=!1,dragConstraints:u=!1,dragElastic:d=Dp,dragMomentum:p=!0}=s;return{...s,drag:i,dragDirectionLock:o,dragPropagation:c,dragConstraints:u,dragElastic:d,dragMomentum:p}}}function kc(t,s,i){return(s===!0||s===t)&&(i===null||i===t)}function m3(t,s=10){let i=null;return Math.abs(t.y)>s?i="y":Math.abs(t.x)>s&&(i="x"),i}class h3 extends Ia{constructor(s){super(s),this.removeGroupControls=jn,this.removeListeners=jn,this.controls=new p3(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||jn}unmount(){this.removeGroupControls(),this.removeListeners()}}const Hy=t=>(s,i)=>{t&&vt.postRender(()=>t(s,i))};class g3 extends Ia{constructor(){super(...arguments),this.removePointerDownListener=jn}onPointerDown(s){this.session=new w1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:O1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:Hy(s),onStart:Hy(i),onMove:o,onEnd:(u,d)=>{delete this.session,c&&vt.postRender(()=>c(u,d))}}}mount(){this.removePointerDownListener=Er(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 Oc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function qy(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const br={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ne.test(t))t=parseFloat(t);else return t;const i=qy(t,s.target.x),o=qy(t,s.target.y);return`${i}% ${o}%`}},v3={correct:(t,{treeScale:s,projectionDelta:i})=>{const o=t,c=Ra.parse(t);if(c.length>5)return o;const u=Ra.createTransformer(t),d=typeof c[0]!="number"?1:0,p=i.x.scale*s.x,h=i.y.scale*s.y;c[0+d]/=p,c[1+d]/=h;const g=St(p,h,.5);return typeof c[2+d]=="number"&&(c[2+d]/=g),typeof c[3+d]=="number"&&(c[3+d]/=g),u(c)}};class y3 extends _.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o,layoutId:c}=this.props,{projection:u}=s;qA(b3),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()})),Oc.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()||vt.postRender(()=>{const p=d.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),om.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 B1(t){const[s,i]=__(),o=_.useContext(Qp);return r.jsx(y3,{...t,layoutGroup:o,switchLayoutGroup:_.useContext(C_),isPresent:s,safeToRemove:i})}const b3={borderRadius:{...br,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:br,borderTopRightRadius:br,borderBottomLeftRadius:br,borderBottomRightRadius:br,boxShadow:v3};function _3(t,s,i){const o=nn(t)?t:Ur(t);return o.start(Dm("",o,s,i)),o.animation}function x3(t){return t instanceof SVGElement&&t.tagName!=="svg"}const k3=(t,s)=>t.depth-s.depth;class S3{constructor(){this.children=[],this.isDirty=!1}add(s){vm(this.children,s),this.isDirty=!0}remove(s){ym(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(k3),this.isDirty=!1,this.children.forEach(s)}}function T3(t,s){const i=gs.now(),o=({timestamp:c})=>{const u=c-i;u>=s&&(Da(o),t(u-s))};return vt.read(o,!0),()=>Da(o)}const L1=["TopLeft","TopRight","BottomLeft","BottomRight"],N3=L1.length,Gy=t=>typeof t=="string"?parseFloat(t):t,Fy=t=>typeof t=="number"||Ne.test(t);function j3(t,s,i,o,c,u){c?(t.opacity=St(0,i.opacity!==void 0?i.opacity:1,w3(o)),t.opacityExit=St(s.opacity!==void 0?s.opacity:1,0,C3(o))):u&&(t.opacity=St(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,o));for(let d=0;d<N3;d++){const p=`border${L1[d]}Radius`;let h=Zy(s,p),g=Zy(i,p);if(h===void 0&&g===void 0)continue;h||(h=0),g||(g=0),h===0||g===0||Fy(h)===Fy(g)?(t[p]=Math.max(St(Gy(h),Gy(g),o),0),(hs.test(g)||hs.test(h))&&(t[p]+="%")):t[p]=g}(s.rotate||i.rotate)&&(t.rotate=St(s.rotate||0,i.rotate||0,o))}function Zy(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const w3=z1(0,.5,e1),C3=z1(.5,.95,jn);function z1(t,s,i){return o=>o<t?0:o>s?1:i(go(t,s,o))}function Ky(t,s){t.min=s.min,t.max=s.max}function $n(t,s){Ky(t.x,s.x),Ky(t.y,s.y)}function Yy(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function Jy(t,s,i,o,c){return t-=s,t=Fc(t,1/i,o),c!==void 0&&(t=Fc(t,1/c,o)),t}function E3(t,s=0,i=1,o=.5,c,u=t,d=t){if(hs.test(s)&&(s=parseFloat(s),s=St(d.min,d.max,s/100)-d.min),typeof s!="number")return;let p=St(u.min,u.max,o);t===u&&(p-=s),t.min=Jy(t.min,s,i,p,c),t.max=Jy(t.max,s,i,p,c)}function Wy(t,s,[i,o,c],u,d){E3(t,s[i],s[o],s[c],s.scale,u,d)}const A3=["x","scaleX","originX"],D3=["y","scaleY","originY"];function Xy(t,s,i,o){Wy(t.x,s,A3,i?i.x:void 0,o?o.x:void 0),Wy(t.y,s,D3,i?i.y:void 0,o?o.y:void 0)}function Qy(t){return t.translate===0&&t.scale===1}function U1(t){return Qy(t.x)&&Qy(t.y)}function eb(t,s){return t.min===s.min&&t.max===s.max}function R3(t,s){return eb(t.x,s.x)&&eb(t.y,s.y)}function tb(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function $1(t,s){return tb(t.x,s.x)&&tb(t.y,s.y)}function nb(t){return wn(t.x)/wn(t.y)}function sb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class M3{constructor(){this.members=[]}add(s){vm(this.members,s),s.scheduleRender()}remove(s){if(ym(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 I3(t,s,i){let o="";const c=t.x.translate/s.x,u=t.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:y,skewX:k,skewY:S}=i;g&&(o=`perspective(${g}px) ${o}`),v&&(o+=`rotate(${v}deg) `),b&&(o+=`rotateX(${b}deg) `),y&&(o+=`rotateY(${y}deg) `),k&&(o+=`skewX(${k}deg) `),S&&(o+=`skewY(${S}deg) `)}const p=t.x.scale*s.x,h=t.y.scale*s.y;return(p!==1||h!==1)&&(o+=`scale(${p}, ${h})`),o||"none"}const oi={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Tr=typeof window<"u"&&window.MotionDebug!==void 0,Wf=["","X","Y","Z"],O3={visibility:"hidden"},ab=1e3;let B3=0;function Xf(t,s,i,o){const{latestValues:c}=s;c[t]&&(i[t]=c[t],s.setStaticValue(t,0),o&&(o[t]=0))}function P1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const i=q_(s);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:c,layoutId:u}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",vt,!(c||u))}const{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&P1(o)}function V1({attachResizeListener:t,defaultParent:s,measureScroll:i,checkIsScrollRoot:o,resetTransform:c}){return class{constructor(d={},p=s==null?void 0:s()){this.id=B3++,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,Tr&&(oi.totalNodes=oi.resolvedTargetDeltas=oi.recalculatedProjection=0),this.nodes.forEach(U3),this.nodes.forEach(q3),this.nodes.forEach(G3),this.nodes.forEach($3),Tr&&window.MotionDebug.record(oi)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new S3)}addEventListener(d,p){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new bm),this.eventHandlers.get(d).add(p)}notifyListeners(d,...p){const h=this.eventHandlers.get(d);h&&h.notify(...p)}hasListeners(d){return this.eventHandlers.has(d)}mount(d,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=x3(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),p&&(g||h)&&(this.isLayoutDirty=!0),t){let b;const y=()=>this.root.updateBlockedByResize=!1;t(d,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=T3(y,250),Oc.hasAnimatedSinceResize&&(Oc.hasAnimatedSinceResize=!1,this.nodes.forEach(ob))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&v&&(h||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:y,hasRelativeTargetChanged:k,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||v.getDefaultTransition()||J3,{onLayoutAnimationStart:w,onLayoutAnimationComplete:j}=v.getProps(),C=!this.targetLayout||!$1(this.targetLayout,S)||k,D=!y&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||D||y&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,D);const I={...gm(N,"layout"),onPlay:w,onComplete:j};(v.shouldReduceMotion||this.options.layoutRoot)&&(I.delay=0,I.type=!1),this.startAnimation(I)}else y||ob(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}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,Da(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(F3),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&&P1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const b=this.path[v];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}const{layoutId:p,layout:h}=this.options;if(p===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(ib);return}this.isUpdating||this.nodes.forEach(V3),this.isUpdating=!1,this.nodes.forEach(H3),this.nodes.forEach(L3),this.nodes.forEach(z3),this.clearAllSnapshots();const p=gs.now();Wt.delta=Fs(0,1e3/60,p-Wt.timestamp),Wt.timestamp=p,Wt.isProcessing=!0,Hf.update.process(Wt),Hf.preRender.process(Wt),Hf.render.process(Wt),Wt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,om.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(P3),this.sharedNodes.forEach(Z3)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,vt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){vt.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=Rt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(p=!1),p){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,p=this.projectionDelta&&!U1(this.projectionDelta),h=this.getTransformTemplate(),g=h?h(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;d&&(p||ii(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const p=this.measurePageBox();let h=this.removeElementScroll(p);return d&&(h=this.removeTransform(h)),W3(h),{animationId:this.root.animationId,measuredBox:p,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:p}=this.options;if(!p)return Rt();const h=p.measureViewportBox();if(!(((d=this.scroll)===null||d===void 0?void 0:d.wasRoot)||this.path.some(X3))){const{scroll:v}=this.root;v&&(lo(h.x,v.offset.x),lo(h.y,v.offset.y))}return h}removeElementScroll(d){var p;const h=Rt();if($n(h,d),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return h;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:b,options:y}=v;v!==this.root&&b&&y.layoutScroll&&(b.wasRoot&&$n(h,d),lo(h.x,b.offset.x),lo(h.y,b.offset.y))}return h}applyTransform(d,p=!1){const h=Rt();$n(h,d);for(let g=0;g<this.path.length;g++){const v=this.path[g];!p&&v.options.layoutScroll&&v.scroll&&v!==v.root&&co(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),ii(v.latestValues)&&co(h,v.latestValues)}return ii(this.latestValues)&&co(h,this.latestValues),h}removeTransform(d){const p=Rt();$n(p,d);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!g.instance||!ii(g.latestValues))continue;Rp(g.latestValues)&&g.updateSnapshot();const v=Rt(),b=g.measurePageBox();$n(v,b),Xy(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return ii(this.latestValues)&&Xy(p,this.latestValues),p}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!==Wt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!1){var p;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||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:y}=this.options;if(!(!this.layout||!(b||y))){if(this.resolvedRelativeTargetAt=Wt.timestamp,!this.targetDelta&&!this.relativeTarget){const k=this.getClosestProjectingParent();k&&k.layout&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Rt(),this.relativeTargetOrigin=Rt(),Dr(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),$n(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Rt(),this.targetWithTransforms=Rt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),t3(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):$n(this.target,this.layout.layoutBox),M1(this.target,this.targetDelta)):$n(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const k=this.getClosestProjectingParent();k&&!!k.resumingFrom==!!this.resumingFrom&&!k.options.layoutScroll&&k.target&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Rt(),this.relativeTargetOrigin=Rt(),Dr(this.relativeTargetOrigin,this.target,k.target),$n(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Tr&&oi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Rp(this.parent.latestValues)||R1(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 p=this.getLead(),h=!!this.resumingFrom||this!==p;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===Wt.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;$n(this.layoutCorrected,this.layout.layoutBox);const y=this.treeScale.x,k=this.treeScale.y;u3(this.layoutCorrected,this.treeScale,this.path,h),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=Rt());const{target:S}=p;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Yy(this.prevProjectionDelta.x,this.projectionDelta.x),Yy(this.prevProjectionDelta.y,this.projectionDelta.y)),Ar(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==y||this.treeScale.y!==k||!sb(this.projectionDelta.x,this.prevProjectionDelta.x)||!sb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Tr&&oi.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){var p;if((p=this.options.visualElement)===null||p===void 0||p.scheduleRender(),d){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ro(),this.projectionDelta=ro(),this.projectionDeltaWithTransform=ro()}setAnimationOrigin(d,p=!1){const h=this.snapshot,g=h?h.latestValues:{},v={...this.latestValues},b=ro();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const y=Rt(),k=h?h.source:void 0,S=this.layout?this.layout.source:void 0,N=k!==S,w=this.getStack(),j=!w||w.members.length<=1,C=!!(N&&!j&&this.options.crossfade===!0&&!this.path.some(Y3));this.animationProgress=0;let D;this.mixTargetDelta=I=>{const R=I/1e3;rb(b.x,d.x,R),rb(b.y,d.y,R),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Dr(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),K3(this.relativeTarget,this.relativeTargetOrigin,y,R),D&&R3(this.relativeTarget,D)&&(this.isProjectionDirty=!1),D||(D=Rt()),$n(D,this.relativeTarget)),N&&(this.animationValues=v,j3(v,g,this.latestValues,R,C,j)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},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&&(Da(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=vt.update(()=>{Oc.hasAnimatedSinceResize=!0,this.currentAnimation=_3(0,ab,{...d,onUpdate:p=>{this.mixTargetDelta(p),d.onUpdate&&d.onUpdate(p)},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(ab),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:p,target:h,layout:g,latestValues:v}=d;if(!(!p||!h||!g)){if(this!==d&&this.layout&&g&&H1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){h=this.target||Rt();const b=wn(this.layout.layoutBox.x);h.x.min=d.target.x.min,h.x.max=h.x.min+b;const y=wn(this.layout.layoutBox.y);h.y.min=d.target.y.min,h.y.max=h.y.min+y}$n(p,h),co(p,v),Ar(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(d,p){this.sharedNodes.has(d)||this.sharedNodes.set(d,new M3),this.sharedNodes.get(d).add(p);const g=p.options.initialPromotionConfig;p.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(p):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){var d;const{layoutId:p}=this.options;return p?((d=this.getStack())===null||d===void 0?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:p}=this.options;return p?(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:p,preserveFollowOpacity:h}={}){const g=this.getStack();g&&g.promote(this,h),d&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let p=!1;const{latestValues:h}=d;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(p=!0),!p)return;const g={};h.z&&Xf("z",d,g,this.animationValues);for(let v=0;v<Wf.length;v++)Xf(`rotate${Wf[v]}`,d,g,this.animationValues),Xf(`skew${Wf[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 p,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return O3;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&&!ii(this.latestValues)&&(N.transform=v?v({},""):"none",this.hasProjected=!1),N}const y=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=I3(this.projectionDeltaWithTransform,this.treeScale,y),v&&(g.transform=v(y,g.transform));const{x:k,y:S}=this.projectionDelta;g.transformOrigin=`${k.origin*100}% ${S.origin*100}% 0`,b.animationValues?g.opacity=b===this?(h=(p=y.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:g.opacity=b===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const N in Pc){if(y[N]===void 0)continue;const{correct:w,applyTo:j}=Pc[N],C=g.transform==="none"?y[N]:w(y[N],b);if(j){const D=j.length;for(let I=0;I<D;I++)g[j[I]]=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 p;return(p=d.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(ib),this.root.sharedNodes.clear()}}}function L3(t){t.updateLayout()}function z3(t){var s;const i=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&i&&t.hasListeners("didUpdate")){const{layoutBox:o,measuredBox:c}=t.layout,{animationType:u}=t.options,d=i.source!==t.layout.source;u==="size"?Hn(b=>{const y=d?i.measuredBox[b]:i.layoutBox[b],k=wn(y);y.min=o[b].min,y.max=y.min+k}):H1(u,i.layoutBox,o)&&Hn(b=>{const y=d?i.measuredBox[b]:i.layoutBox[b],k=wn(o[b]);y.max=y.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+k)});const p=ro();Ar(p,o,i.layoutBox);const h=ro();d?Ar(h,t.applyTransform(c,!0),i.measuredBox):Ar(h,o,i.layoutBox);const g=!U1(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:y,layout:k}=b;if(y&&k){const S=Rt();Dr(S,i.layoutBox,y.layoutBox);const N=Rt();Dr(N,o,k.layoutBox),$1(S,N)||(v=!0),b.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=S,t.relativeParent=b)}}}t.notifyListeners("didUpdate",{layout:o,snapshot:i,delta:h,layoutDelta:p,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:o}=t.options;o&&o()}t.options.transition=void 0}function U3(t){Tr&&oi.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function $3(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function P3(t){t.clearSnapshot()}function ib(t){t.clearMeasurements()}function V3(t){t.isLayoutDirty=!1}function H3(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function ob(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function q3(t){t.resolveTargetDelta()}function G3(t){t.calcProjection()}function F3(t){t.resetSkewAndRotation()}function Z3(t){t.removeLeadSnapshot()}function rb(t,s,i){t.translate=St(s.translate,0,i),t.scale=St(s.scale,1,i),t.origin=s.origin,t.originPoint=s.originPoint}function lb(t,s,i,o){t.min=St(s.min,i.min,o),t.max=St(s.max,i.max,o)}function K3(t,s,i,o){lb(t.x,s.x,i.x,o),lb(t.y,s.y,i.y,o)}function Y3(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const J3={duration:.45,ease:[.4,0,.1,1]},cb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),ub=cb("applewebkit/")&&!cb("chrome/")?Math.round:jn;function db(t){t.min=ub(t.min),t.max=ub(t.max)}function W3(t){db(t.x),db(t.y)}function H1(t,s,i){return t==="position"||t==="preserve-aspect"&&!e3(nb(s),nb(i),.2)}function X3(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const Q3=V1({attachResizeListener:(t,s)=>Pr(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Qf={current:void 0},q1=V1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Qf.current){const t=new Q3({});t.mount(window),t.setOptions({layoutScroll:!0}),Qf.current=t}return Qf.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),eM={pan:{Feature:g3},drag:{Feature:h3,ProjectionNode:q1,MeasureLayout:B1}};function tM(t,s,i){var o;if(t instanceof Element)return[t];if(typeof t=="string"){let c=document;const u=(o=void 0)!==null&&o!==void 0?o:c.querySelectorAll(t);return u?Array.from(u):[]}return Array.from(t)}function G1(t,s){const i=tM(t),o=new AbortController,c={passive:!0,...s,signal:o.signal};return[i,c,()=>o.abort()]}function fb(t){return s=>{s.pointerType==="touch"||j1()||t(s)}}function nM(t,s,i={}){const[o,c,u]=G1(t,i),d=fb(p=>{const{target:h}=p,g=s(p);if(typeof g!="function"||!h)return;const v=fb(b=>{g(b),h.removeEventListener("pointerleave",v)});h.addEventListener("pointerleave",v,c)});return o.forEach(p=>{p.addEventListener("pointerenter",d,c)}),u}function pb(t,s,i){const{props:o}=t;t.animationState&&o.whileHover&&t.animationState.setActive("whileHover",i==="Start");const c="onHover"+i,u=o[c];u&&vt.postRender(()=>u(s,Kr(s)))}class sM extends Ia{mount(){const{current:s}=this.node;s&&(this.unmount=nM(s,i=>(pb(this.node,i,"Start"),o=>pb(this.node,o,"End"))))}unmount(){}}class aM extends Ia{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=Zr(Pr(this.node.current,"focus",()=>this.onFocus()),Pr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const F1=(t,s)=>s?t===s?!0:F1(t,s.parentElement):!1,iM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function oM(t){return iM.has(t.tagName)||t.tabIndex!==-1}const Nr=new WeakSet;function mb(t){return s=>{s.key==="Enter"&&t(s)}}function ep(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const rM=(t,s)=>{const i=t.currentTarget;if(!i)return;const o=mb(()=>{if(Nr.has(i))return;ep(i,"down");const c=mb(()=>{ep(i,"up")}),u=()=>ep(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 hb(t){return Rm(t)&&!j1()}function lM(t,s,i={}){const[o,c,u]=G1(t,i),d=p=>{const h=p.currentTarget;if(!hb(p)||Nr.has(h))return;Nr.add(h);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",y),!(!hb(k)||!Nr.has(h))&&(Nr.delete(h),typeof g=="function"&&g(k,{success:S}))},b=k=>{v(k,i.useGlobalTarget||F1(h,k.target))},y=k=>{v(k,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",y,c)};return o.forEach(p=>{!oM(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(i.useGlobalTarget?window:p).addEventListener("pointerdown",d,c),p.addEventListener("focus",g=>rM(g,c),c)}),u}function gb(t,s,i){const{props:o}=t;t.animationState&&o.whileTap&&t.animationState.setActive("whileTap",i==="Start");const c="onTap"+(i==="End"?"":i),u=o[c];u&&vt.postRender(()=>u(s,Kr(s)))}class cM extends Ia{mount(){const{current:s}=this.node;s&&(this.unmount=lM(s,i=>(gb(this.node,i,"Start"),(o,{success:c})=>gb(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Ip=new WeakMap,tp=new WeakMap,uM=t=>{const s=Ip.get(t.target);s&&s(t)},dM=t=>{t.forEach(uM)};function fM({root:t,...s}){const i=t||document;tp.has(i)||tp.set(i,{});const o=tp.get(i),c=JSON.stringify(s);return o[c]||(o[c]=new IntersectionObserver(dM,{root:t,...s})),o[c]}function pM(t,s,i){const o=fM(s);return Ip.set(t,i),o.observe(t),()=>{Ip.delete(t),o.unobserve(t)}}const mM={some:0,all:1};class hM extends Ia{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:mM[c]},p=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(),y=g?v:b;y&&y(h)};return pM(this.node.current,d,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:i}=this.node;["amount","margin","root"].some(gM(s,i))&&this.startObserver()}unmount(){}}function gM({viewport:t={}},{viewport:s={}}={}){return i=>t[i]!==s[i]}const vM={inView:{Feature:hM},tap:{Feature:cM},focus:{Feature:aM},hover:{Feature:sM}},yM={layout:{ProjectionNode:q1,MeasureLayout:B1}},Zc={current:null},Mm={current:!1};function Z1(){if(Mm.current=!0,!!nm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>Zc.current=t.matches;t.addListener(s),s()}else Zc.current=!1}const bM=[...m1,tn,Ra],_M=t=>bM.find(p1(t)),vb=new WeakMap;function xM(t,s,i){for(const o in s){const c=s[o],u=i[o];if(nn(c))t.addValue(o,c);else if(nn(u))t.addValue(o,Ur(c,{owner:t}));else if(u!==c)if(t.hasValue(o)){const d=t.getValue(o);d.liveStyle===!0?d.jump(c):d.hasAnimated||d.set(c)}else{const d=t.getStaticValue(o);t.addValue(o,Ur(d!==void 0?d:c,{owner:t}))}}for(const o in i)s[o]===void 0&&t.removeValue(o);return s}const yb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class kM{scrapeMotionValuesFromProps(s,i,o){return{}}constructor({parent:s,props:i,presenceContext:o,reducedMotionConfig:c,blockInitialAnimation:u,visualState:d},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Cm,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 k=gs.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,vt.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=p,this.blockInitialAnimation=!!u,this.isControllingVariants=lu(i),this.isVariantNode=j_(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,...y}=this.scrapeMotionValuesFromProps(i,{},this);for(const k in y){const S=y[k];h[k]!==void 0&&nn(S)&&S.set(h[k],!1)}}mount(s){this.current=s,vb.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)),Mm.current||Z1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Zc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){vb.delete(this.current),this.projection&&this.projection.unmount(),Da(this.notifyUpdate),Da(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=vi.has(s),c=i.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&vt.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 ho){const i=ho[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):Rt()}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<yb.length;o++){const c=yb[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=xM(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=Ur(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"&&(d1(c)||n1(c))?c=parseFloat(c):!_M(c)&&Ra.test(i)&&(c=l1(s,i)),this.setBaseTarget(s,nn(c)?c.get():c)),nn(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=lm(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&&!nn(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 bm),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class K1 extends kM{constructor(){super(...arguments),this.KeyframeResolver=h1}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;nn(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function SM(t){return window.getComputedStyle(t)}class TM extends K1{constructor(){super(...arguments),this.type="html",this.renderInstance=O_}readValueFromInstance(s,i){if(vi.has(i)){const o=wm(i);return o&&o.default||0}else{const o=SM(s),c=(R_(i)?o.getPropertyValue(i):o[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return I1(s,i)}build(s,i,o){dm(s,i,o.transformTemplate)}scrapeMotionValuesFromProps(s,i,o){return hm(s,i,o)}}class NM extends K1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Rt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(vi.has(i)){const o=wm(i);return o&&o.default||0}return i=B_.has(i)?i:im(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,o){return U_(s,i,o)}build(s,i,o){fm(s,i,this.isSVGTag,o.transformTemplate)}renderInstance(s,i,o,c){L_(s,i,o,c)}mount(s){this.isSVGTag=mm(s.tagName),super.mount(s)}}const jM=(t,s)=>rm(t)?new NM(s):new TM(s,{allowProjection:t!==_.Fragment}),wM=QA({...qR,...vM,...eM,...yM},jM),It=mA(wM);function CM(){!Mm.current&&Z1();const[t]=_.useState(Zc.current);return t}const EM="_overlay_cmicx_1",AM="_dialog_cmicx_11",DM="_title_cmicx_30",RM="_description_cmicx_38",MM="_actions_cmicx_45",IM="_cancelButton_cmicx_52",OM="_confirmButton_cmicx_79",ni={overlay:EM,dialog:AM,title:DM,description:RM,actions:MM,cancelButton:IM,confirmButton:OM};function pi({isOpen:t,title:s,description:i,confirmLabel:o="Delete",onConfirm:c,onCancel:u}){const d=_.useId(),p=_.useId();return r.jsx(vs,{children:t&&r.jsx(It.div,{className:ni.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?p:void 0,children:r.jsxs(It.div,{className:ni.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:[r.jsx("h3",{id:d,className:ni.title,children:s}),i&&r.jsx("p",{id:p,className:ni.description,children:i}),r.jsxs("div",{className:ni.actions,children:[r.jsx("button",{type:"button",className:ni.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),r.jsx("button",{type:"button",className:ni.confirmButton,onClick:c,children:o})]})]})})})}const BM="_spinner_1uyt1_1",LM="_spin_1uyt1_1",zM="_sm_1uyt1_14",UM="_md_1uyt1_20",$M="_lg_1uyt1_26",PM="_xl_1uyt1_32",bb={spinner:BM,spin:LM,sm:zM,md:UM,lg:$M,xl:PM};function Y1({size:t="md",className:s,label:i="Loading",liveRegion:o=!1}){return r.jsx("span",{className:`${bb.spinner} ${bb[t]} ${s??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const VM="_splash_1bn1g_1",HM="_logo_1bn1g_11",_b={splash:VM,logo:HM};function J1(){return r.jsxs("div",{className:_b.splash,"data-testid":"splash-screen",children:[r.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:_b.logo}),r.jsx(Y1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const W1=50;function qM(t,s,i,o,c=W1){return o?t<c:s-t-i<c}function GM(t,s){const i=s-t;return i>0?i:0}function FM({scrollRef:t,contentLength:s,isReversed:i}){const[o,c]=_.useState(!0),u=_.useRef(0),d=_.useRef(!1),p=_.useRef(0);_.useEffect(()=>{const g=t.current;if(!g)return;let v=!0;const b=()=>{p.current||(p.current=requestAnimationFrame(()=>{p.current=0;const y=qM(g.scrollTop,g.scrollHeight,g.clientHeight,i,W1);y!==v&&(v=y,c(y))}))};return g.addEventListener("scroll",b,{passive:!0}),()=>{g.removeEventListener("scroll",b),p.current&&(cancelAnimationFrame(p.current),p.current=0)}},[t,i]),_.useLayoutEffect(()=>{const g=t.current;!g||d.current||(d.current=!0,i?g.scrollTop=0:g.scrollTop=g.scrollHeight,c(!0))},[t,i]),_.useLayoutEffect(()=>{const g=t.current;if(g){if(i&&!o){const v=GM(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,t]);const h=_.useCallback(()=>{const g=t.current;if(!g)return;const v=i?0:g.scrollHeight;g.scrollTo({top:v,behavior:"smooth"}),c(!0)},[t,i]);return{isAtAnchor:o,scrollToAnchor:h}}const ZM="_wrapper_1rtuy_1",KM="_scrollContainer_1rtuy_9",YM="_toolbar_1rtuy_15",JM="_directionToggle_1rtuy_22",WM="_scrollToAnchor_1rtuy_60",XM="_scrollToAnchorBottom_1rtuy_84",QM="_scrollToAnchorTop_1rtuy_88",e6="_eventOverflowWarning_1rtuy_92",Ca={wrapper:ZM,scrollContainer:KM,toolbar:YM,directionToggle:JM,scrollToAnchor:WM,scrollToAnchorBottom:XM,scrollToAnchorTop:QM,eventOverflowWarning:e6},X1="grackle-stream-direction";function t6(){try{return localStorage.getItem(X1)==="reversed"}catch{return!1}}function n6({eventsDropped:t}){return t<=0?r.jsx(r.Fragment,{}):r.jsxs("div",{className:Ca.eventOverflowWarning,role:"alert",children:[r.jsx(Vp,{size:Gt,"aria-hidden":"true"})," ",t.toLocaleString()," older event",t===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function Im({events:t,eventsDropped:s,emptyState:i}){const o=_.useRef(null),[c,u]=_.useState(t6),d=CM(),p=_.useMemo(()=>c?[...t].reverse():t,[t,c]),{isAtAnchor:h,scrollToAnchor:g}=FM({scrollRef:o,contentLength:t.length,isReversed:c}),v=()=>{const k=!c;u(k);try{localStorage.setItem(X1,k?"reversed":"default")}catch{}},b=d?0:.2,y=c?-8:8;return r.jsxs("div",{className:Ca.wrapper,children:[r.jsx("div",{className:Ca.toolbar,children:r.jsx("button",{className:Ca.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?r.jsx(Vv,{size:Gt,"aria-hidden":"true"}):r.jsx(Hv,{size:Gt,"aria-hidden":"true"})})}),r.jsxs("div",{ref:o,className:Ca.scrollContainer,"data-testid":"event-stream-scroll",children:[t.length===0&&i,r.jsx(n6,{eventsDropped:s}),r.jsx(vs,{initial:!1,children:p.map((k,S)=>{const N=c?t.length-1-S:S;return r.jsx(It.div,{initial:{opacity:0,y},animate:{opacity:1,y:0},transition:{duration:b,ease:"easeOut"},children:r.jsx(nA,{event:k,toolUseCtx:k.toolUseCtx,settled:k.settled})},`${k.sessionId}-${k.timestamp}-${N}`)})})]}),r.jsx(vs,{children:!h&&r.jsxs(It.button,{className:`${Ca.scrollToAnchor} ${c?Ca.scrollToAnchorTop:Ca.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?r.jsx(Hv,{size:Gt,"aria-hidden":"true"}):r.jsx(Vv,{size:Gt,"aria-hidden":"true"})," New events"]})})]})}function Om(t){const{value:s,onSave:i,validate:o,fieldId:c,activeFieldId:u,onActivate:d,enterToSave:p=!0,trimOnSave:h=!0}=t,[g,v]=_.useState(""),[b,y]=_.useState(""),k=_.useRef(!1),S=u===c,N=_.useCallback(q=>{v(q),y("")},[]),w=_.useCallback(()=>{y("")},[]),j=_.useCallback(()=>{k.current=!1,d==null||d(null),v(""),y("")},[d]),C=_.useCallback(()=>{const q=h?g.trim():g;if(o){const Y=o(g);if(Y){y(Y);return}}const $=h?s.trim():s;if(q===$){j();return}i(q),j()},[g,s,h,o,i,j]),D=_.useCallback(()=>{k.current=!0,d==null||d(c),v(s),y("")},[c,s,d]),I=_.useCallback(q=>{if(k.current){k.current=!1;return}q.relatedTarget instanceof HTMLElement&&q.relatedTarget.dataset.editAction===c||C()},[c,C]),R=_.useCallback(q=>{q.key==="Escape"?j():q.key==="Enter"&&p&&C()},[j,p,C]),E=(()=>{if(!S)return!1;const q=h?s.trim():s;return(h?g.trim():g)!==q})();return _.useEffect(()=>{!S&&(g!==""||b!=="")&&(v(""),y(""))},[S,g,b]),{isEditing:S,draft:g,error:b,isDirty:E,startEdit:D,cancelEdit:j,save:C,setDraft:N,clearError:w,handleBlur:I,handleKeyDown:R,ignoreInitialBlurRef:k}}const s6="_editFieldWrapper_yuzty_1",a6="_editInput_yuzty_10",i6="_editTextarea_yuzty_42",o6="_editSelect_yuzty_78",r6="_editError_yuzty_111",l6="_editInputInvalid_yuzty_118",c6="_editHint_yuzty_123",u6="_unsavedDot_yuzty_132",d6="_metaValueClickable_yuzty_140",f6="_editButton_yuzty_159",p6="_metaPlaceholder_yuzty_175",m6="_worktreeToggle_yuzty_180",Je={editFieldWrapper:s6,editInput:a6,editTextarea:i6,editSelect:o6,editError:r6,editInputInvalid:l6,editHint:c6,unsavedDot:u6,metaValueClickable:d6,editButton:f6,metaPlaceholder:p6,worktreeToggle:m6};function Xt(t){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="text",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:y,"data-testid":k}=t,S=_.useRef(null),N=Om({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!0,trimOnSave:!0});if(_.useEffect(()=>{if(N.isEditing){const j=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(j)}},[N.isEditing]),c==="create"){const j=D=>{h==null||h(D.target.value)},C=o==null?void 0:o(s);return r.jsxs("div",{className:Je.editFieldWrapper,children:[r.jsx("input",{className:`${Je.editInput} ${C?Je.editInputInvalid:""}`,value:s,onChange:j,maxLength:b,placeholder:v,"aria-label":y,"data-testid":k?`${k}-input`:void 0}),C&&r.jsx("span",{className:Je.editError,"data-testid":"edit-error",children:C})]})}if(N.isEditing)return r.jsxs("div",{className:Je.editFieldWrapper,children:[r.jsx("input",{ref:S,className:`${Je.editInput} ${N.error?Je.editInputInvalid:""}`,value:N.draft,onChange:j=>N.setDraft(j.target.value),onBlur:N.handleBlur,onKeyDown:N.handleKeyDown,maxLength:b,placeholder:v,"aria-label":y,"data-testid":k?`${k}-input`:void 0}),N.isDirty&&r.jsx("span",{className:Je.unsavedDot,title:"Unsaved changes"}),N.error&&r.jsx("span",{className:Je.editError,"data-testid":"edit-error",children:N.error}),r.jsx("span",{className:Je.editHint,children:"Enter to save · Esc to cancel"})]});const w=g==null?void 0:g(s);return r.jsxs("span",{role:"button",tabIndex:0,className:Je.metaValueClickable,onClick:()=>N.startEdit(),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),N.startEdit())},title:"Click to edit","aria-label":y,"data-testid":k?`${k}-button`:void 0,children:[w!==void 0?w:s?r.jsx("span",{children:s}):r.jsx("span",{className:Je.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:Je.editButton,"aria-hidden":"true",children:"✏️"})]})}function Op(t){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="textarea",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":y}=t,k=_.useRef(null),S=Om({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!1,trimOnSave:!1});if(_.useEffect(()=>{if(S.isEditing){const w=window.setTimeout(()=>{var j;(j=k.current)==null||j.focus()},0);return()=>window.clearTimeout(w)}},[S.isEditing]),c==="create"){const w=C=>{h==null||h(C.target.value)},j=o==null?void 0:o(s);return r.jsxs("div",{className:Je.editFieldWrapper,children:[r.jsx("textarea",{className:`${Je.editTextarea} ${j?Je.editInputInvalid:""}`,value:s,onChange:w,placeholder:v,"aria-label":b,"data-testid":y?`${y}-input`:void 0}),j&&r.jsx("span",{className:Je.editError,"data-testid":"edit-error",children:j})]})}if(S.isEditing)return r.jsxs("div",{className:Je.editFieldWrapper,children:[r.jsx("textarea",{ref:k,className:`${Je.editTextarea} ${S.error?Je.editInputInvalid:""}`,value:S.draft,onChange:w=>S.setDraft(w.target.value),onBlur:S.handleBlur,onKeyDown:S.handleKeyDown,title:b,"aria-label":b,"data-testid":y?`${y}-input`:void 0}),S.isDirty&&r.jsx("span",{className:Je.unsavedDot,title:"Unsaved changes"}),S.error&&r.jsx("span",{className:Je.editError,"data-testid":"edit-error",children:S.error}),r.jsx("span",{className:Je.editHint,children:"Tab to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return r.jsxs("span",{role:"button",tabIndex:0,className:Je.metaValueClickable,onClick:()=>S.startEdit(),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),S.startEdit())},title:"Click to edit","aria-label":b,"data-testid":y?`${y}-button`:void 0,children:[N!==void 0?N:s?r.jsx("span",{children:s}):r.jsx("span",{className:Je.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:Je.editButton,"aria-hidden":"true",children:"✏️"})]})}function Kc(t){var D;const{value:s,onSave:i,mode:o="edit",options:c,fieldId:u="select",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":y}=t,k=_.useRef(null),S=Om({value:s,onSave:i,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!1,trimOnSave:!1});_.useEffect(()=>{if(S.isEditing){const I=window.setTimeout(()=>{var R;(R=k.current)==null||R.focus()},0);return()=>window.clearTimeout(I)}},[S.isEditing]);const N=_.useCallback(I=>{const R=I.target.value;S.ignoreInitialBlurRef.current=!1,R!==s&&i(R),S.cancelEdit()},[s,i,S]),w=_.useCallback(I=>{if(S.ignoreInitialBlurRef.current){S.ignoreInitialBlurRef.current=!1;return}I.relatedTarget instanceof HTMLElement&&I.relatedTarget.dataset.editAction===u||S.cancelEdit()},[u,S]);if(o==="create")return r.jsx("select",{className:Je.editSelect,value:s,onChange:I=>h==null?void 0:h(I.target.value),"aria-label":b,"data-testid":y?`${y}-select`:void 0,children:c.map(I=>r.jsx("option",{value:I.value,children:I.label},I.value))});if(S.isEditing)return r.jsx("select",{ref:k,className:Je.editSelect,value:S.draft,onChange:N,onBlur:w,title:b,"aria-label":b,"data-testid":y?`${y}-select`:void 0,children:c.map(I=>r.jsx("option",{value:I.value,children:I.label},I.value))});const j=g==null?void 0:g(s),C=(D=c.find(I=>I.value===s))==null?void 0:D.label;return r.jsxs("button",{type:"button",className:Je.metaValueClickable,onClick:()=>S.startEdit(),title:"Click to change","aria-label":b,"data-testid":y?`${y}-button`:void 0,children:[j!==void 0?j:C?r.jsx("span",{children:C}):r.jsx("span",{className:Je.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:Je.editButton,"aria-hidden":"true",children:"✏️"})]})}function h6(t){const{checked:s,onChange:i,label:o,ariaLabel:c,"data-testid":u}=t;return r.jsxs("label",{className:Je.worktreeToggle,"data-testid":u,children:[r.jsx("input",{type:"checkbox",checked:s,onChange:d=>i(d.target.checked),"aria-label":c}),r.jsx("span",{children:o})]})}const g6="_envRow_1e1r5_1",v6="_envDot_1e1r5_7",y6="_envDotGreen_1e1r5_14",b6="_envDotYellow_1e1r5_18",_6="_envDotRed_1e1r5_22",x6="_envDotGray_1e1r5_26",uo={envRow:g6,envDot:v6,envDotGreen:y6,envDotYellow:b6,envDotRed:_6,envDotGray:x6};function k6(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?uo.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?uo.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?uo.envDotRed:uo.envDotGray}function S6(t){const{value:s,onSave:i,environments:o,allowNone:c=!1,fieldId:u="environment",activeFieldId:d,onActivate:p,placeholder:h="No environment",ariaLabel:g="Environment","data-testid":v}=t,b=o.find(S=>S.id===s),y=[...c?[{value:"",label:"None"}]:[],...o.map(S=>({value:S.id,label:S.displayName}))],k=()=>{if(b)return r.jsxs("span",{className:uo.envRow,children:[r.jsx("span",{className:`${uo.envDot} ${k6(b.status)}`}),b.displayName]})};return r.jsx(Kc,{value:s,onSave:i,options:y,fieldId:u,activeFieldId:d,onActivate:p,renderDisplay:k,placeholder:h,ariaLabel:g,"data-testid":v})}const T6="_nav_1snmp_1",N6="_searchForm_1snmp_8",j6="_searchInput_1snmp_15",w6="_searchButton_1snmp_33",C6="_clearButton_1snmp_68",E6="_workspaceSelect_1snmp_85",A6="_listHeader_1snmp_99",D6="_nodeList_1snmp_108",R6="_nodeItem_1snmp_116",M6="_indicator_1snmp_129",I6="_label_1snmp_136",O6="_badge_1snmp_145",Pn={nav:T6,searchForm:N6,searchInput:j6,searchButton:w6,clearButton:C6,workspaceSelect:E6,listHeader:A6,nodeList:D6,nodeItem:R6,indicator:M6,label:I6,badge:O6};function B6({nodes:t,workspaces:s,loading:i,searchQuery:o,onSearch:c,onClearSearch:u,onSelectNode:d,onWorkspaceChange:p}){const[h,g]=_.useState(""),v=_.useCallback(S=>{S.preventDefault(),h.trim()&&c(h.trim())},[h,c]),b=_.useCallback(()=>{g(""),u()},[u]),y=_.useCallback(S=>{d(S)},[d]),k=_.useCallback(S=>{g(""),p(S)},[p]);return r.jsxs("div",{className:Pn.nav,"data-testid":"knowledge-nav",children:[r.jsxs("form",{className:Pn.searchForm,onSubmit:v,children:[r.jsx("input",{className:Pn.searchInput,type:"text",placeholder:"Search...",value:h,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input"}),r.jsx("button",{type:"submit",className:Pn.searchButton,disabled:i,children:"Go"})]}),o&&r.jsx("button",{type:"button",className:Pn.clearButton,onClick:b,children:"Clear search"}),r.jsxs("select",{className:Pn.workspaceSelect,onChange:S=>{k(S.target.value)},"data-testid":"knowledge-workspace-filter",children:[r.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>r.jsx("option",{value:S.id,children:S.name},S.id))]}),r.jsxs("div",{className:Pn.listHeader,children:["Nodes (",t.length,")"]}),r.jsx("ul",{className:Pn.nodeList,children:t.map(S=>r.jsxs("li",{className:Pn.nodeItem,onClick:()=>{y(S.id)},onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),y(S.id))},role:"button",tabIndex:0,children:[r.jsx("span",{className:Pn.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),r.jsx("span",{className:Pn.label,children:S.label}),r.jsx("span",{className:Pn.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const L6="_container_1mq5u_1",z6="_hamburger_1mq5u_33",U6="_brand_1mq5u_49",$6="_brandLogo_1mq5u_68",P6="_info_1mq5u_75",V6="_connectionLabel_1mq5u_90",H6="_connectionDot_1mq5u_103",q6="_connected_1mq5u_106",G6="_disconnected_1mq5u_110",Us={container:L6,hamburger:z6,brand:U6,brandLogo:$6,info:P6,connectionLabel:V6,connectionDot:H6,connected:q6,disconnected:G6};function F6({connected:t,environments:s,sessions:i,onToggleSidebar:o,sidebarOpen:c}){const u=yt(),d=s.length,p=s.filter(g=>g.status==="connected").length,h=i.filter(g=>["running","idle"].includes(g.status)).length;return r.jsxs("div",{className:Us.container,children:[o&&r.jsx("button",{type:"button",className:Us.hamburger,onClick:o,"aria-label":"Toggle sidebar","aria-expanded":c,children:r.jsx(m2,{size:Mt,"aria-hidden":"true"})}),r.jsxs("button",{type:"button",className:Us.brand,onClick:()=>u(fi),title:"Home",children:[r.jsx("img",{src:"/icon-192x192.png",alt:"",className:Us.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]}),r.jsxs("div",{className:Us.info,children:[r.jsxs("span",{"aria-label":t?"Connected":"Disconnected",children:[r.jsx("span",{className:`${Us.connectionDot} ${t?Us.connected:Us.disconnected}`,"aria-hidden":"true",children:r.jsx(Ea,{size:Hp,fill:"currentColor"})})," ",r.jsx("span",{className:Us.connectionLabel,"aria-hidden":"true",children:t?"Connected":"Disconnected"})]}),r.jsxs("span",{children:[p,"/",d," env",d!==1?"s":""]}),r.jsxs("span",{children:[h," active"]})]})]})}const Z6="_nav_13gkc_1",K6="_tab_13gkc_35",Y6="_tabIcon_13gkc_68",J6="_tabLabel_13gkc_79",W6="_tabActive_13gkc_84",_r={nav:Z6,tab:K6,tabIcon:Y6,tabLabel:J6,tabActive:W6},si=[{view:"dashboard",label:"Dashboard",icon:r.jsx(t2,{size:Mt}),route:fi,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:r.jsx(g2,{size:Mt}),route:Bj,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:r.jsx(HT,{size:Mt}),route:Lj,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:r.jsx(y2,{size:Mt}),route:po,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:r.jsx(LT,{size:Mt}),route:v_,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:r.jsx(Yb,{size:Mt}),route:au,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:r.jsx(w2,{size:Mt}),route:Rj,testId:"sidebar-tab-settings"}];function X6(t){return t===fi||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(v_)?"knowledge":t.startsWith(au)?"findings":t.startsWith(fo)?"settings":"tasks"}function Q6(){const t=Pt(),s=yt(),i=_.useRef(null),o=X6(t.pathname),c=_.useCallback(d=>{s(d.route)},[s]),u=_.useCallback(d=>{var b,y;const p=(b=i.current)==null?void 0:b.querySelectorAll('[role="tab"]');if(!p)return;const h=Array.from(p).findIndex(k=>k===document.activeElement),g=h>=0?h:si.findIndex(k=>k.view===o);let v=g;if(d.key==="ArrowRight"||d.key==="j"||d.key==="J")d.preventDefault(),v=(g+1)%si.length;else if(d.key==="ArrowLeft"||d.key==="k"||d.key==="K")d.preventDefault(),v=(g-1+si.length)%si.length;else if(d.key==="Home")d.preventDefault(),v=0;else if(d.key==="End")d.preventDefault(),v=si.length-1;else return;s(si[v].route),(y=p[v])==null||y.focus()},[o,s]);return r.jsx("nav",{className:_r.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:u,"data-testid":"sidebar-nav",children:si.map(d=>{const p=d.view===o;return r.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${_r.tab} ${p?_r.tabActive:""}`,onClick:()=>c(d),"data-testid":d.testId,title:d.label,"aria-label":d.label,children:[r.jsx("span",{className:_r.tabIcon,"aria-hidden":"true",children:d.icon}),r.jsx("span",{className:_r.tabLabel,children:d.label})]},d.view)})})}const e4="_container_pi6ii_1",t4="_content_pi6ii_66",xb={container:e4,content:t4},n4=320,Q1=220,ex=600,tx="grackle-sidebar-width";function s4(){try{const t=localStorage.getItem(tx);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=Q1&&s<=ex)return s}}catch{}return n4}function a4(t){try{localStorage.setItem(tx,String(t))}catch{}}function i4({content:t}){const[s]=_.useState(s4),i=_.useRef(null);if(_.useEffect(()=>{const o=i.current;if(!o)return;const c=new ResizeObserver(u=>{for(const d of u){const p=d.borderBoxSize[0];if(p){const h=Math.round(p.inlineSize);h>=Q1&&h<=ex&&a4(h)}}});return c.observe(o),()=>{c.disconnect()}},[]),t!==void 0)return r.jsx("div",{className:xb.container,ref:i,"data-testid":"sidebar",style:{width:s},children:r.jsx("div",{className:xb.content,children:t})})}const o4="_bar_tnfsh_1",r4="_btnPrimary_tnfsh_32",l4="_statusText_tnfsh_85",c4="_statusCompleted_tnfsh_90",u4="_statusFailed_tnfsh_94",d4="_statusBlocked_tnfsh_98",f4="_hintText_tnfsh_103",xt={bar:o4,btnPrimary:r4,statusText:l4,statusCompleted:c4,statusFailed:u4,statusBlocked:d4,hintText:f4};function p4({sessions:t,tasks:s,environments:i}){const o=yt(),c=Pt(),u=jt("/sessions/:sessionId"),d=jt("/tasks/:taskId"),p=jt("/tasks/:taskId/stream"),h=jt("/tasks/:taskId/findings"),g=jt("/tasks/:taskId/edit"),v=jt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=jt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),y=jt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),k=jt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),S=jt("/sessions/new"),N=jt("/environments/:environmentId/workspaces/:workspaceId"),w=jt("/tasks/new"),j=jt("/chat"),C=jt("/"),D=jt("/settings/*"),I=u==null?void 0:u.params.sessionId,R=(d==null?void 0:d.params.taskId)??(p==null?void 0:p.params.taskId)??(h==null?void 0:h.params.taskId)??(v==null?void 0:v.params.taskId)??(b==null?void 0:b.params.taskId)??(y==null?void 0:y.params.taskId)??(k==null?void 0:k.params.taskId),E=v??b??y??k,q=(E==null?void 0:E.params.environmentId)??(N==null?void 0:N.params.environmentId),$=c.pathname.startsWith("/environments")&&!N&&!E,Y=!!j,Z=!!S,te=!!N&&!v&&!b&&!y&&!k,ae=!!w;if(!!C&&!Z&&!te&&!ae||!!D||(!!g||!!k)||ae||$||Z)return r.jsx(r.Fragment,{});if(Y)return i.find(F=>F.adapterType==="local"&&F.status==="connected")?r.jsx(r.Fragment,{}):r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Add a local environment to start chatting"})});if(te)return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Select a task or click + to create one"})});if(R){const B=s.find(re=>re.id===R);if(!B)return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Loading..."})});const F=new Map(s.map(re=>[re.id,re])),ne=B.dependsOn.some(re=>{const ue=F.get(re);return ue!==void 0&&ue.status!=="complete"});if(B.status==="not_started"){const re=ne?B.dependsOn.map(ue=>F.get(ue)).filter(ue=>ue&&ue.status!=="complete").map(ue=>ue.title):[];return r.jsx("div",{className:xt.bar,children:ne?r.jsxs("span",{className:xt.statusBlocked,children:["Blocked by: ",re.join(", ")]}):r.jsx("span",{className:xt.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,ue=re?t.find(je=>je.id===re):void 0;return ue&&ue.status!=="stopped"?r.jsx(r.Fragment,{}):r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Waiting for agent..."})})}if(B.status==="complete")return r.jsxs("div",{className:xt.bar,children:[r.jsx("span",{className:`${xt.statusText} ${xt.statusCompleted}`,children:"Task completed"}),r.jsx("button",{onClick:()=>o(gi(B.workspaceId,void 0,q)),className:xt.btnPrimary,children:"+ New Task"})]});if(B.status==="failed")return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:`${xt.statusText} ${xt.statusFailed}`,children:"Task failed"})})}if(I){const B=t.find(re=>re.id===I),F=(B==null?void 0:B.status)==="stopped";if(B!==void 0&&!F)return r.jsx(r.Fragment,{});if(F)return r.jsxs("div",{className:xt.bar,children:[r.jsxs("span",{className:`${xt.statusText} ${xt.hintText}`,children:["Session ",B.endReason||B.status]}),r.jsx("button",{onClick:()=>o(m_(B.environmentId)),className:xt.btnPrimary,children:"+ New Chat"})]})}return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Loading..."})})}const m4="_nav_14i94_1",h4="_tab_14i94_24",g4="_tabActive_14i94_62",v4="_tabLabel_14i94_75",y4="_statusDot_14i94_81",b4="_pulse_14i94_87",_4="_addButton_14i94_99",x4="_empty_14i94_132",ka={nav:m4,tab:h4,tabActive:g4,tabLabel:v4,statusDot:y4,pulse:b4,addButton:_4,empty:x4},k4={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function S4({environments:t}){const s=yt(),i=_.useRef(null),o=jt("/environments/:environmentId"),c=jt("/environments/:environmentId/edit"),u=jt("/environments/:environmentId/workspaces/:workspaceId"),d=jt("/environments/:environmentId/workspaces/:workspaceId/*"),p=(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=p==="new"?void 0:p,g=_.useCallback(y=>{s(di(y))},[s]),v=_.useCallback(y=>{var j;const k=(j=i.current)==null?void 0:j.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),N=S>=0?S:t.findIndex(C=>C.id===h);let w=N;if(y.key==="ArrowDown"||y.key==="j"||y.key==="J")y.preventDefault(),w=(N+1)%k.length;else if(y.key==="ArrowUp"||y.key==="k"||y.key==="K")y.preventDefault(),w=(N-1+k.length)%k.length;else if(y.key==="Home")y.preventDefault(),w=0;else if(y.key==="End")y.preventDefault(),w=k.length-1;else return;w<t.length&&s(di(t[w].id)),k[w].focus()},[h,t,s]),b=h??(t.length>0?t[0].id:void 0);return r.jsxs("div",{className:ka.nav,"data-testid":"environment-nav",children:[r.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(y=>{const k=y.id===h,S=y.id===b,N=k4[y.status]||"var(--text-tertiary)",w=y.status==="connected";return r.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${ka.tab} ${k?ka.tabActive:""}`,onClick:()=>g(y.id),"data-testid":"env-nav-item",children:[r.jsx("span",{className:`${ka.statusDot} ${w?ka.pulse:""}`,style:{color:N},"aria-hidden":"true",children:r.jsx(Ea,{size:Hp,fill:"currentColor"})}),r.jsx("span",{className:ka.tabLabel,title:y.displayName||y.id,children:y.displayName||y.id})]},y.id)})}),r.jsx("button",{type:"button",className:ka.addButton,onClick:()=>s(Aj),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&r.jsx("div",{className:ka.empty,children:"No environments yet."})]})}function Bm(t){const s=new Date(t),i=new Date,o=i.getTime()-s.getTime(),c=Math.floor(o/1e3),u=Math.floor(c/60),d=Math.floor(u/60),p=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(p===1)return"yesterday";if(p<7)return`${p} 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 kb={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 Yc(t){return kb[t]||kb.general}const T4="_nav_dlm8m_1",N4="_categoryPills_dlm8m_24",j4="_categoryPill_dlm8m_24",w4="_tab_dlm8m_42",C4="_tabActive_dlm8m_80",E4="_tabContent_dlm8m_93",A4="_tabLabel_dlm8m_100",D4="_tabMeta_dlm8m_106",R4="_categoryDot_dlm8m_111",M4="_empty_dlm8m_118",fs={nav:T4,categoryPills:N4,categoryPill:j4,tab:w4,tabActive:C4,tabContent:E4,tabLabel:A4,tabMeta:D4,categoryDot:R4,empty:M4};function I4({findings:t,workspaceId:s,environmentId:i}){const o=yt(),c=_.useRef(null),u=jt("/findings/:findingId"),d=jt("/environments/:environmentId/workspaces/:workspaceId/findings/:findingId"),p=(u==null?void 0:u.params.findingId)??(d==null?void 0:d.params.findingId),h=_.useMemo(()=>{const y=new Set(t.map(k=>k.category).filter(Boolean));return Array.from(y).sort()},[t]),g=_.useCallback(y=>{o(vp(y,s,i))},[o,s,i]),v=_.useCallback(y=>{var j;const k=(j=c.current)==null?void 0:j.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),N=S>=0?S:t.findIndex(C=>C.id===p);let w=N;if(y.key==="ArrowDown"||y.key==="j"||y.key==="J")y.preventDefault(),w=(N+1)%k.length;else if(y.key==="ArrowUp"||y.key==="k"||y.key==="K")y.preventDefault(),w=(N-1+k.length)%k.length;else if(y.key==="Home")y.preventDefault(),w=0;else if(y.key==="End")y.preventDefault(),w=k.length-1;else return;w<t.length&&o(vp(t[w].id,s,i)),k[w].focus()},[p,t,o,s,i]),b=p??(t.length>0?t[0].id:void 0);return r.jsxs("div",{className:fs.nav,"data-testid":"findings-nav",children:[h.length>1&&r.jsx("div",{className:fs.categoryPills,"data-testid":"findings-nav-categories",children:h.map(y=>r.jsx("span",{className:fs.categoryPill,style:{color:Yc(y).text},children:y},y))}),r.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(y=>{const k=y.id===p,S=y.id===b;return r.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${fs.tab} ${k?fs.tabActive:""}`,onClick:()=>g(y.id),"data-testid":"finding-nav-item",children:[r.jsx("span",{className:fs.categoryDot,style:{color:Yc(y.category).text},"aria-hidden":"true",children:r.jsx(Ea,{size:Hp,fill:"currentColor"})}),r.jsxs("span",{className:fs.tabContent,children:[r.jsx("span",{className:fs.tabLabel,title:y.title,children:y.title}),r.jsx("span",{className:fs.tabMeta,title:y.createdAt,children:Bm(y.createdAt)})]})]},y.id)})}),t.length===0&&r.jsx("div",{className:fs.empty,children:"No findings yet. Agents will post discoveries here."})]})}function O4(t){if(t.length===0)return[];const s=[...t].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 nx({text:t,indices:s,highlightClass:i}){if(!s||s.length===0)return r.jsx(r.Fragment,{children:t});const o=O4(s),c=[];let u=0;for(const[d,p]of o)d>u&&c.push(r.jsx("span",{children:t.slice(u,d)},`p${u}`)),c.push(r.jsx("mark",{className:i,children:t.slice(d,p+1)},`m${d}`)),u=p+1;return u<t.length&&c.push(r.jsx("span",{children:t.slice(u)},`p${u}`)),r.jsx(r.Fragment,{children:c})}function B4(t){const s=new Map(t.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 L4(t,s){const i=new Map;for(const u of t){const p=u.dependsOn.length>0&&u.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":u.status,h=i.get(p);h?h.push(u):i.set(p,[u])}const o=[],c=new Set;for(const u of I2){c.add(u);const d=i.get(u);if(d&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const p=Aa(u);o.push({status:u,label:p.label,style:p,tasks:d})}}for(const[u,d]of i)if(!c.has(u)&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const p=Aa(u);o.push({status:u,label:p.label,style:p,tasks:d})}return o}const z4="_container_z4i38_1",U4="_header_z4i38_5",$4="_headerActions_z4i38_17",P4="_searchInput_z4i38_23",V4="_searchHighlight_z4i38_56",H4="_groupToggle_z4i38_62",q4="_groupToggleActive_z4i38_89",G4="_addButton_z4i38_93",F4="_taskRow_z4i38_120",Z4="_selected_z4i38_140",K4="_expandArrow_z4i38_150",Y4="_expanded_z4i38_157",J4="_leafSpacer_z4i38_161",W4="_taskStatusIcon_z4i38_166",X4="_taskTitle_z4i38_170",Q4="_workspaceBadge_z4i38_177",eI="_childCountBadge_z4i38_195",tI="_dependencyBadge_z4i38_208",nI="_blockedBadge_z4i38_220",sI="_addChildButton_z4i38_225",aI="_emptyState_z4i38_268",iI="_statusGroupHeader_z4i38_275",oI="_statusGroupIcon_z4i38_294",rI="_statusGroupLabel_z4i38_298",lI="_statusGroupCount_z4i38_303",Ve={container:z4,header:U4,headerActions:$4,searchInput:P4,searchHighlight:V4,groupToggle:H4,groupToggleActive:q4,addButton:G4,taskRow:F4,selected:Z4,expandArrow:K4,expanded:Y4,leafSpacer:J4,taskStatusIcon:W4,taskTitle:X4,workspaceBadge:Q4,childCountBadge:eI,dependencyBadge:tI,blockedBadge:nI,addChildButton:sI,emptyState:aI,statusGroupHeader:iI,statusGroupIcon:oI,statusGroupLabel:rI,statusGroupCount:lI},cI=[{name:"title",weight:2},{name:"description",weight:1}],sx=16,uI=16,ax="grackle-task-group-by-status";function Sb(){try{return localStorage.getItem(ax)==="true"}catch{return!1}}function dI(t){try{localStorage.setItem(ax,String(t))}catch{}}function fI({group:t,isExpanded:s,onToggle:i,selectedTaskId:o,navigate:c,titleHighlights:u,workspaceNames:d}){return r.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[r.jsxs("div",{className:Ve.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:i,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i())},children:[r.jsx("span",{className:`${Ve.expandArrow} ${s?Ve.expanded:""}`,"aria-hidden":"true",children:r.jsx(Ks,{size:kt})}),r.jsx("span",{className:Ve.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),r.jsx("span",{className:Ve.statusGroupLabel,children:t.label}),r.jsx("span",{className:Ve.statusGroupCount,children:t.tasks.length})]}),r.jsx(vs,{children:s&&r.jsx(It.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:t.tasks.map(p=>{const h=Aa(p.status),g=o===p.id,v=p.parentTaskId||!p.workspaceId?void 0:d.get(p.workspaceId);return r.jsxs("div",{onClick:()=>c(as(p.id)),className:`${Ve.taskRow} ${g?Ve.selected:""}`,style:{"--task-indent":`${sx}px`},"data-task-id":p.id,children:[r.jsx("span",{className:Ve.leafSpacer}),r.jsx("span",{className:Ve.taskStatusIcon,style:{color:h.color},"aria-hidden":"true","data-testid":`task-status-${Vr(p.status)}`,children:h.icon}),r.jsx("span",{className:Ve.taskTitle,title:p.title,children:r.jsx(nx,{text:p.title,indices:u.get(p.id),highlightClass:Ve.searchHighlight})}),v&&r.jsx("span",{className:Ve.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function ix({node:t,depth:s,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:p,workspaceNames:h}){const g=Aa(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(j=>d.get(j)!=="complete"),b=i.has(t.id),y=t.children.length>0,k=c===t.id,S=sx+s*uI,w=s===0&&!t.parentTaskId&&t.workspaceId?h.get(t.workspaceId):void 0;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{onClick:()=>u(as(t.id)),className:`${Ve.taskRow} ${k?Ve.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[y&&r.jsx("span",{className:`${Ve.expandArrow} ${b?Ve.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:j=>{j.stopPropagation(),o(t.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),j.stopPropagation(),o(t.id))},children:r.jsx(Ks,{size:kt,"aria-hidden":"true"})}),!y&&r.jsx("span",{className:Ve.leafSpacer}),r.jsx("span",{className:Ve.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${Vr(t.status)}`,children:g.icon}),r.jsx("span",{className:Ve.taskTitle,title:t.title,children:r.jsx(nx,{text:t.title,indices:p.get(t.id),highlightClass:Ve.searchHighlight})}),w&&r.jsx("span",{className:Ve.workspaceBadge,title:w,children:w}),y&&r.jsxs("span",{className:Ve.childCountBadge,children:[t.children.filter(j=>j.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&r.jsx("span",{className:`${Ve.dependencyBadge} ${v?Ve.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<ZS&&r.jsx("button",{onClick:j=>{j.stopPropagation(),u(gi(t.workspaceId,t.id))},title:"Add child task","aria-label":"Add child task",className:Ve.addChildButton,children:"+"})]}),r.jsx(vs,{children:y&&b&&r.jsx(It.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:t.children.map(j=>r.jsx(ix,{node:j,depth:s+1,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:p,workspaceNames:h},j.id))})})]})}function pI({workspaces:t,tasks:s}){const i=yt(),[o,c]=_.useState(new Set),[u,d]=_.useState(new Set),[p,h]=_.useState(Sb),[g,v]=_.useState(Sb),[b,y]=_.useState(new Map),k=jt("/tasks/:taskId/*"),S=(k==null?void 0:k.params.taskId)!=="new"?k==null?void 0:k.params.taskId:void 0,N=_.useMemo(()=>new Map(s.map(ie=>[ie.id,ie.status])),[s]),w=_.useMemo(()=>new Map(t.map(ie=>[ie.id,ie.name])),[t]),j=()=>{const ie=!p;dI(ie),h(ie),ie&&(v(!0),y(new Map))},C=ie=>{y(Q=>{const B=new Map(Q),F=B.has(ie)?B.get(ie):g;return B.set(ie,!F),B})},D=ie=>b.has(ie)?b.get(ie):g,I=ie=>{c(Q=>{const B=new Set(Q);return B.has(ie)?(B.delete(ie),d(F=>new Set(F).add(ie))):(B.add(ie),d(F=>{const ne=new Set(F);return ne.delete(ie),ne})),B})};_.useEffect(()=>{const ie=new Set(s.filter(Q=>Q.parentTaskId).map(Q=>Q.parentTaskId));ie.size>0&&c(Q=>{const B=new Set(Q);for(const F of ie)u.has(F)||B.add(F);return B})},[s,u]);const[R,E]=_.useState(""),{directMatchTaskIds:q,treeMatchTaskIds:$,titleHighlights:Y}=_.useMemo(()=>{if(!R.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const ie=FS(s,R,cI),Q=new Set(ie.map(re=>re.item.id)),B=new Map;for(const re of ie){const ue=re.matches.find(Fe=>Fe.key==="title");ue&&B.set(re.item.id,ue.indices)}const F=new Set(Q),ne=new Map(s.map(re=>[re.id,re]));for(const re of[...Q]){let ue=ne.get(re);for(;ue!=null&&ue.parentTaskId;)F.add(ue.parentTaskId),ue=ne.get(ue.parentTaskId)}return{directMatchTaskIds:Q,treeMatchTaskIds:F,titleHighlights:B}},[R,s]),Z=q!==null,te=Z?p?q:$:null,ae=te?s.filter(ie=>te.has(ie.id)):s,me=p?[]:B4(ae);return r.jsxs("div",{className:Ve.container,children:[r.jsxs("div",{className:Ve.header,children:[r.jsx("span",{children:"Tasks"}),r.jsxs("div",{className:Ve.headerActions,children:[r.jsx("button",{className:`${Ve.groupToggle} ${p?Ve.groupToggleActive:""}`,onClick:j,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,title:p?"Switch to tree view":"Group tasks by status","data-testid":"task-group-by-status-toggle",children:r.jsx(u2,{size:Gt})}),r.jsx("button",{className:Ve.addButton,onClick:()=>i(gi()),"aria-label":"New task",title:"New task","data-testid":"new-task-button",children:"+"})]})]}),s.length>0&&r.jsx("input",{type:"text",value:R,onChange:ie=>E(ie.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Ve.searchInput,"data-testid":"sidebar-search"}),p?L4(ae,N).map(ie=>r.jsx(fI,{group:ie,isExpanded:D(ie.status),onToggle:()=>C(ie.status),selectedTaskId:S,navigate:i,titleHighlights:Y,workspaceNames:w},ie.status)):me.map(ie=>r.jsx(ix,{node:ie,depth:0,expandedTasks:o,toggleTask:I,selectedTaskId:S,navigate:i,taskStatusById:N,titleHighlights:Y,workspaceNames:w},ie.id)),ae.length===0&&!Z&&r.jsx("div",{className:Ve.emptyState,children:"No tasks yet. Click + to create one."}),ae.length===0&&Z&&r.jsx("div",{className:Ve.emptyState,children:"No matching tasks"})]})}const mI="_toast_ed2dk_1",hI="_success_ed2dk_18",gI="_icon_ed2dk_22",vI="_error_ed2dk_25",yI="_warning_ed2dk_32",bI="_info_ed2dk_38",_I="_message_ed2dk_53",xI="_close_ed2dk_60",xr={toast:mI,success:hI,icon:gI,error:vI,warning:yI,info:bI,message:_I,close:xI},kI={success:r.jsx(yo,{size:Mt}),error:r.jsx(mi,{size:Mt}),warning:r.jsx(Vp,{size:Mt}),info:r.jsx(Pp,{size:Mt})};function SI({toast:t,onDismiss:s}){return _.useEffect(()=>{const i=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(i)},[t.id,t.duration,s]),r.jsxs(It.div,{className:`${xr.toast} ${xr[t.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[r.jsx("span",{className:xr.icon,"aria-hidden":"true",children:kI[t.variant]}),r.jsx("span",{className:xr.message,children:t.message}),r.jsx("button",{type:"button",className:xr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:r.jsx(mi,{size:Gt,"aria-hidden":"true"})})]})}const TI="_container_qqse2_1",NI={container:TI};function jI({toasts:t,onDismiss:s}){return r.jsx("div",{className:NI.container,"data-testid":"toast-container",children:r.jsx(vs,{children:t.map(i=>r.jsx(SI,{toast:i,onDismiss:s},i.id))})})}const wI="_callout_e5awm_1",CI="_success_e5awm_11",EI="_icon_e5awm_15",AI="_error_e5awm_18",DI="_warning_e5awm_25",RI="_info_e5awm_32",MI="_content_e5awm_48",II="_close_e5awm_53",kr={callout:wI,success:CI,icon:EI,error:AI,warning:DI,info:RI,content:MI,close:II},OI={success:r.jsx(yo,{size:Mt}),error:r.jsx(mi,{size:Mt}),warning:r.jsx(Vp,{size:Mt}),info:r.jsx(Pp,{size:Mt})};function BI({variant:t="info",children:s,dismissible:i=!1,className:o}){const[c,u]=_.useState(!1);return r.jsx(r.Fragment,{children:!c&&r.jsxs("div",{className:[kr.callout,kr[t],o].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[r.jsx("span",{className:kr.icon,"aria-hidden":"true",children:OI[t]}),r.jsx("span",{className:kr.content,children:s}),i&&r.jsx("button",{type:"button",className:kr.close,onClick:()=>u(!0),"aria-label":"Dismiss",children:r.jsx(mi,{size:Gt,"aria-hidden":"true"})})]})})}function LI({currentVersion:t,latestVersion:s,updateAvailable:i,isDocker:o}){if(!i)return r.jsx(r.Fragment,{});const c=o?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return r.jsx("div",{"data-testid":"update-banner",children:r.jsxs(BI,{variant:"info",dismissible:!0,children:[r.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",r.jsx("code",{children:c})]})})}const zI="_container_de44x_1",UI="_emptyState_de44x_8",$I="_card_de44x_14",PI="_cardClickable_de44x_34",VI="_cardHeader_de44x_42",HI="_categoryBadge_de44x_54",qI="_findingTitle_de44x_62",GI="_findingDate_de44x_68",FI="_findingContent_de44x_80",ZI="_tags_de44x_86",KI="_tag_de44x_86",es={container:zI,emptyState:UI,card:$I,cardClickable:PI,cardHeader:VI,categoryBadge:HI,findingTitle:qI,findingDate:GI,findingContent:FI,tags:ZI,tag:KI};function ox({findings:t,onFindingClick:s}){return t.length===0?r.jsx("div",{className:es.emptyState,children:"No findings yet. Agents will post discoveries here."}):r.jsx("div",{className:es.container,children:t.map((i,o)=>{const c=Yc(i.category),u=s?It.button:It.div;return r.jsxs(u,{type:s?"button":void 0,className:`${es.card} ${s?es.cardClickable:""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:o*.05,duration:.2},onClick:s?()=>{s(i.id)}:void 0,children:[r.jsxs("div",{className:es.cardHeader,children:[r.jsx("span",{className:es.categoryBadge,style:{background:c.bg,color:c.text},children:i.category}),r.jsx("span",{className:es.findingTitle,children:i.title}),r.jsx("span",{className:es.findingDate,title:i.createdAt,children:Bm(i.createdAt)})]}),r.jsx("div",{className:es.findingContent,children:i.content.length>300?i.content.slice(0,300)+"...":i.content}),i.tags.length>0&&r.jsx("div",{className:es.tags,children:i.tags.map(d=>r.jsx("span",{className:es.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:d},d))})]},i.id)})})}const YI="_section_1ingb_14",JI="_sectionTitle_1ingb_26",WI="_sectionDescription_1ingb_35",XI="_tokenList_1ingb_48",QI="_tokenRow_1ingb_55",eO="_tokenBadge_1ingb_68",tO="_tokenName_1ingb_83",nO="_tokenTarget_1ingb_90",sO="_deleteButton_1ingb_99",aO="_addForm_1ingb_113",iO="_formRow_1ingb_119",oO="_input_1ingb_125",rO="_select_1ingb_155",lO="_addButton_1ingb_187",cO="_emptyStateInfo_1ingb_221",uO="_themeOptions_1ingb_229",dO="_themeOption_1ingb_229",fO="_themeOptionSelected_1ingb_254",pO="_themeOptionHeader_1ingb_259",mO="_themeOptionLabel_1ingb_266",hO="_themeOptionDesc_1ingb_273",gO="_variantToggle_1ingb_279",vO="_variantButton_1ingb_286",yO="_variantActive_1ingb_305",bO="_themeSwatches_1ingb_311",_O="_themeSwatch_1ingb_311",xO="_systemToggle_1ingb_325",kO="_systemToggleHint_1ingb_341",SO="_themeActive_1ingb_348",TO="_aboutGrid_1ingb_354",NO="_aboutItem_1ingb_360",jO="_aboutLabel_1ingb_373",wO="_aboutValue_1ingb_379",CO="_aboutDot_1ingb_387",EO="_aboutDotConnected_1ingb_394",AO="_aboutDotDisconnected_1ingb_398",pe={section:YI,sectionTitle:JI,sectionDescription:WI,tokenList:XI,tokenRow:QI,tokenBadge:eO,tokenName:tO,tokenTarget:nO,deleteButton:sO,addForm:aO,formRow:iO,input:oO,select:rO,addButton:lO,emptyStateInfo:cO,themeOptions:uO,themeOption:dO,themeOptionSelected:fO,themeOptionHeader:pO,themeOptionLabel:mO,themeOptionDesc:hO,variantToggle:gO,variantButton:vO,variantActive:yO,themeSwatches:bO,themeSwatch:_O,systemToggle:xO,systemToggleHint:kO,themeActive:SO,aboutGrid:TO,aboutItem:NO,aboutLabel:jO,aboutValue:wO,aboutDot:CO,aboutDotConnected:EO,aboutDotDisconnected:AO},DO=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function RO({tokens:t,onSetToken:s,onDeleteToken:i,onShowToast:o}){const[c,u]=_.useState(""),[d,p]=_.useState(""),[h,g]=_.useState("env_var"),[v,b]=_.useState(""),[y,k]=_.useState(null),S=j=>{if(j.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(""),p(""),b("")},N=j=>{k(j)},w=()=>{y&&(i(y),o==null||o("Token deleted","info")),k(null)};return r.jsxs(r.Fragment,{children:[r.jsx(pi,{isOpen:y!==null,title:"Delete Token?",description:y?`"${y}" will be permanently removed.`:void 0,onConfirm:w,onCancel:()=>k(null)}),r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Tokens"}),r.jsx("p",{className:pe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?r.jsx("div",{className:pe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):r.jsx("div",{className:pe.tokenList,children:t.map(j=>r.jsxs("div",{className:pe.tokenRow,children:[r.jsx("span",{className:pe.tokenBadge,children:j.tokenType}),r.jsx("span",{className:pe.tokenName,children:j.name}),r.jsx("span",{className:pe.tokenTarget,children:j.tokenType==="env_var"?j.envVar:j.filePath}),r.jsx("button",{className:pe.deleteButton,onClick:()=>N(j.name),title:`Delete ${j.name}`,"aria-label":`Delete ${j.name}`,children:r.jsx(mi,{size:Gt,"aria-hidden":"true"})})]},j.name))}),r.jsxs("form",{className:pe.addForm,onSubmit:S,children:[r.jsxs("div",{className:pe.formRow,children:[r.jsx("input",{className:pe.input,type:"text",placeholder:"Token name",value:c,onChange:j=>u(j.target.value)}),r.jsx("input",{className:pe.input,type:"password",placeholder:"Value",value:d,onChange:j=>p(j.target.value)})]}),r.jsxs("div",{className:pe.formRow,children:[r.jsx("select",{className:pe.select,value:h,onChange:j=>g(j.target.value),children:DO.map(j=>r.jsx("option",{value:j.value,children:j.label},j.value))}),r.jsx("input",{className:pe.input,type:"text",placeholder:h==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:j=>b(j.target.value)}),r.jsx("button",{className:pe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const du=[{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"]}],rx=new Set(du.map(t=>t.id)),Tb="grackle";function Bp(t){return du.find(s=>s.id===t)}function MO({themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c}){return r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Appearance"}),r.jsx("p",{className:pe.sectionDescription,children:"Choose how Grackle looks across the app."}),r.jsx("div",{className:pe.themeOptions,children:du.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),p=d?t===u.id||t===u.variantLightId||t===u.variantDarkId:t===u.id,h=d&&s===u.variantLightId;return r.jsxs("button",{type:"button",className:`${pe.themeOption} ${p?pe.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>i(u.id),children:[r.jsxs("span",{className:pe.themeOptionHeader,children:[r.jsxs("span",{children:[r.jsx("span",{className:pe.themeOptionLabel,children:u.label}),r.jsx("span",{className:pe.themeOptionDesc,children:u.description})]}),d&&r.jsxs("span",{className:pe.variantToggle,children:[r.jsx("span",{role:"button",tabIndex:0,className:`${pe.variantButton} ${p&&h?pe.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":p&&h,children:"☼"}),r.jsx("span",{role:"button",tabIndex:0,className:`${pe.variantButton} ${p&&!h?pe.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":p&&!h,children:"☾"})]})]}),u.swatches&&r.jsx("span",{className:pe.themeSwatches,children:u.swatches.map((g,v)=>r.jsx("span",{className:pe.themeSwatch,style:{background:g}},v))})]},u.id)})}),r.jsxs("label",{className:pe.systemToggle,children:[r.jsx("input",{type:"checkbox",checked:o,onChange:u=>c(u.target.checked)}),r.jsx("span",{children:"Match system light/dark preference"})]}),r.jsx("p",{className:pe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),r.jsxs("p",{className:pe.themeActive,children:["Active theme: ",r.jsx("strong",{children:s})]})]})}function IO({connected:t,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 r.jsxs("section",{className:pe.section,"data-testid":"about-panel",children:[r.jsx("h3",{className:pe.sectionTitle,children:"About"}),r.jsx("p",{className:pe.sectionDescription,children:"Connection status and application information."}),r.jsxs("div",{className:pe.aboutGrid,children:[r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Connection"}),r.jsxs("span",{className:pe.aboutValue,children:[r.jsx("span",{className:`${pe.aboutDot} ${t?pe.aboutDotConnected:pe.aboutDotDisconnected}`}),t?"Connected":"Disconnected"]})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Environments"}),r.jsxs("span",{className:pe.aboutValue,children:[o,"/",c," connected"]})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Active Sessions"}),r.jsx("span",{className:pe.aboutValue,children:u})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Version"}),r.jsx("span",{className:pe.aboutValue,children:"0.89.1"})]})]})]})}const OO="_container_cddyd_1",BO="_header_cddyd_8",LO="_headerTitle_cddyd_35",zO="_badge_cddyd_44",UO="_headerActions_cddyd_54",$O="_body_cddyd_61",PO="_formContent_cddyd_73",VO="_section_cddyd_85",HO="_label_cddyd_91",qO="_titleInput_cddyd_98",GO="_descriptionTextarea_cddyd_131",FO="_parentContext_cddyd_167",ZO="_parentLabel_cddyd_175",KO="_parentName_cddyd_182",YO="_personaSelect_cddyd_186",JO="_depList_cddyd_220",WO="_depItem_cddyd_226",XO="_depItemSelected_cddyd_248",QO="_noDeps_cddyd_252",e5="_btnPrimary_cddyd_258",t5="_btnGhost_cddyd_289",Ye={container:OO,header:BO,headerTitle:LO,badge:zO,headerActions:UO,body:$O,formContent:PO,section:VO,label:HO,titleInput:qO,descriptionTextarea:GO,parentContext:FO,parentLabel:ZO,parentName:KO,personaSelect:YO,depList:JO,depItem:WO,depItemSelected:XO,noDeps:QO,btnPrimary:e5,btnGhost:t5};function lx({mode:t,taskId:s,workspaceId:i,parentTaskId:o,environmentId:c,tasks:u,workspaces:d,personas:p,onCreateTask:h,onUpdateTask:g,onEditDone:v,onShowToast:b}){const y=yt(),k=t==="edit",S=k&&s?u.find(de=>de.id===s):void 0,N=k?(S==null?void 0:S.workspaceId)??"":i??"",[w,j]=_.useState(N),C=N||w,D=d.find(de=>de.id===C),I=c??(D==null?void 0:D.environmentId),R=!k&&!i,E=k?(S==null?void 0:S.parentTaskId)??"":o??"",q=E?u.find(de=>de.id===E):void 0,[$,Y]=_.useState((S==null?void 0:S.title)??""),[Z,te]=_.useState((S==null?void 0:S.description)??""),[ae,me]=_.useState((S==null?void 0:S.dependsOn)??[]),[ie,Q]=_.useState((S==null?void 0:S.defaultPersonaId)??""),[B,F]=_.useState((S==null?void 0:S.canDecompose)??!1),[ne,re]=_.useState(!1),ue=_.useRef(!1);_.useEffect(()=>{k&&S&&!ue.current&&(ue.current=!0,Y(S.title),te(S.description),me(S.dependsOn),Q(S.defaultPersonaId),F(S.canDecompose))},[k,S]);const Fe=u.filter(de=>de.workspaceId===C&&(!k||de.id!==s)&&de.id!==E),je=$.trim().length>0&&(!k||S!==void 0)&&C.length>0,Te=de=>{me(Ie=>Ie.includes(de)?Ie.filter(bt=>bt!==de):[...Ie,de])},Me=()=>{!je||ne||k&&S===void 0||(k&&s?(g(s,$.trim(),Z,ae,ie),b==null||b("Task updated","success"),v?v():y(as(s,void 0,C,I),{replace:!0})):(re(!0),h(C,$.trim(),Z,ae.length>0?ae:void 0,E||void 0,ie,B,()=>{b==null||b("Task created","success"),y(i?ui(i,I):"/tasks",{replace:!0})},de=>{b==null||b(de,"error"),re(!1)})))},le=()=>{if(v){v();return}y(k&&s?as(s,void 0,C,I):i?ui(i,I):"/tasks")},ve=k?"edit task":E?"child task":"new task";return r.jsxs("div",{className:Ye.container,children:[r.jsxs("div",{className:Ye.header,children:[r.jsxs("div",{className:Ye.headerTitle,children:[r.jsx("span",{className:Ye.badge,children:ve}),q&&r.jsxs("span",{className:Ye.parentContext,children:[r.jsx("span",{className:Ye.parentLabel,children:"Child of"}),r.jsx("span",{className:Ye.parentName,children:q.title})]})]}),r.jsxs("div",{className:Ye.headerActions,children:[r.jsx("button",{onClick:Me,disabled:!je||ne,className:Ye.btnPrimary,"data-testid":"task-edit-save",children:ne?"Creating…":k?"Save Changes":"Create"}),r.jsx("button",{onClick:le,className:Ye.btnGhost,children:"Cancel"})]})]}),r.jsx("div",{className:Ye.body,children:r.jsxs("div",{className:Ye.formContent,children:[R&&r.jsxs("div",{className:Ye.section,children:[r.jsx("label",{className:Ye.label,htmlFor:"task-edit-workspace",children:"Workspace"}),r.jsxs("select",{id:"task-edit-workspace",value:w,onChange:de=>j(de.target.value),className:Ye.personaSelect,"data-testid":"task-edit-workspace",children:[r.jsx("option",{value:"",children:"Select a workspace..."}),d.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]}),r.jsxs("div",{className:Ye.section,children:[r.jsx("label",{className:Ye.label,htmlFor:"task-edit-title",children:"Title"}),r.jsx("input",{id:"task-edit-title",type:"text",value:$,onChange:de=>Y(de.target.value),placeholder:"Task title...",autoFocus:!0,className:Ye.titleInput,"data-testid":"task-edit-title",onKeyDown:de=>{de.key==="Enter"&&je&&Me()}})]}),r.jsxs("div",{className:Ye.section,children:[r.jsx("label",{className:Ye.label,htmlFor:"task-edit-description",children:"Description"}),r.jsx("textarea",{id:"task-edit-description",value:Z,onChange:de=>te(de.target.value),placeholder:"Describe the task... (markdown supported)",className:Ye.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),r.jsxs("div",{className:Ye.section,children:[r.jsx("label",{className:Ye.label,htmlFor:"task-edit-persona",children:"Default Persona"}),r.jsxs("select",{id:"task-edit-persona",value:ie,onChange:de=>Q(de.target.value),className:Ye.personaSelect,"data-testid":"task-edit-persona",children:[r.jsx("option",{value:"",children:"(Inherit)"}),p.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]}),!k&&r.jsx("div",{className:Ye.section,children:r.jsxs("label",{className:Ye.depItem,"data-testid":"task-edit-can-decompose",children:[r.jsx("input",{type:"checkbox",checked:B,onChange:de=>F(de.target.checked)}),"Can spawn subtasks"]})}),r.jsxs("div",{className:Ye.section,children:[r.jsx("div",{className:Ye.label,children:"Dependencies"}),Fe.length===0?r.jsx("div",{className:Ye.noDeps,children:"No other tasks in this workspace"}):r.jsx("div",{className:Ye.depList,children:Fe.map(de=>{const Ie=ae.includes(de.id);return r.jsxs("label",{className:`${Ye.depItem} ${Ie?Ye.depItemSelected:""}`,"data-testid":`dep-option-${de.id}`,children:[r.jsx("input",{type:"checkbox",checked:Ie,onChange:()=>Te(de.id)}),de.title,r.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",de.status,")"]})]},de.id)})})]})]})})]})}const n5="_container_legrg_1",s5="_header_legrg_8",a5="_headerTitle_legrg_35",i5="_badge_legrg_44",o5="_headerActions_legrg_54",r5="_body_legrg_61",l5="_formContent_legrg_73",c5="_section_legrg_85",u5="_label_legrg_91",d5="_nameInput_legrg_98",f5="_fieldInput_legrg_131",p5="_adapterSelect_legrg_164",m5="_readOnlyValue_legrg_198",h5="_codespaceSection_legrg_204",g5="_codespaceActions_legrg_210",v5="_creatingHint_legrg_216",y5="_errorHint_legrg_222",b5="_btnPrimary_legrg_235",_5="_btnGhost_legrg_266",se={container:n5,header:s5,headerTitle:a5,badge:i5,headerActions:o5,body:r5,formContent:l5,section:c5,label:u5,nameInput:d5,fieldInput:f5,adapterSelect:p5,readOnlyValue:m5,codespaceSection:h5,codespaceActions:g5,creatingHint:v5,errorHint:y5,btnPrimary:b5,btnGhost:_5},Bc=1,Lc=65535;function np(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=Bc&&s<=Lc}function sp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function x5({codespaceName:t,onCodespaceNameChange:s,envName:i,onEnvNameChange:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:p,onCreateCodespace:h}){const[g,v]=_.useState("pick"),[b,y]=_.useState(""),[k,S]=_.useState("");return g==="create"?r.jsxs("div",{className:se.codespaceSection,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Repository"}),r.jsx("input",{type:"text",value:b,onChange:N=>y(N.target.value),placeholder:"owner/repo",className:se.fieldInput,"data-testid":"env-codespace-repo"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Machine Type"}),r.jsx("input",{type:"text",value:k,onChange:N=>S(N.target.value),placeholder:"Machine type (optional)...",className:se.fieldInput,"data-testid":"env-codespace-machine"})]}),r.jsxs("div",{className:se.codespaceActions,children:[r.jsx("button",{onClick:()=>{b.trim()&&(h(b.trim(),k.trim()||void 0),v("pick"),y(""),S(""))},disabled:!b.trim(),className:se.btnPrimary,children:"Create"}),r.jsx("button",{onClick:()=>{v("pick"),y(""),S("")},className:se.btnGhost,children:"Cancel"})]})]}):r.jsx("div",{className:se.codespaceSection,children:r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Codespace"}),!d&&r.jsxs("select",{value:t,onChange:N=>{N.target.value==="__create__"?(v("create"),s("")):(s(N.target.value),N.target.value&&!i.trim()&&o(N.target.value))},disabled:p,className:se.adapterSelect,"data-testid":"env-codespace-select",children:[r.jsx("option",{value:"",children:"Select a codespace..."}),c.map(N=>r.jsxs("option",{value:N.name,children:[N.name," (",N.repository,") — ",N.state]},N.name)),r.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&r.jsx("span",{className:se.creatingHint,children:"Creating codespace..."}),d&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:se.errorHint,children:d}),r.jsx("input",{type:"text",value:t,onChange:N=>s(N.target.value),placeholder:"Or enter codespace name manually...",className:se.fieldInput,"data-testid":"env-codespace-manual"})]}),u&&!d&&r.jsx("span",{className:se.errorHint,children:u})]})})}function cx({mode:t,environmentId:s,environments:i,onAddEnvironment:o,onUpdateEnvironment:c,onListCodespaces:u,codespaces:d,codespaceError:p,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v,onShowToast:b}){const y=yt(),k=t==="edit",S=k&&s?i.find(le=>le.id===s):void 0,[N,w]=_.useState(""),[j,C]=_.useState("local"),[D,I]=_.useState(""),[R,E]=_.useState(""),[q,$]=_.useState(""),[Y,Z]=_.useState(""),[te,ae]=_.useState(""),[me,ie]=_.useState(""),[Q,B]=_.useState(""),[F,ne]=_.useState(null),re=_.useCallback(()=>{const le={};if(j==="local"){if(D.trim()&&(le.host=D.trim()),R.trim()){const ve=Number(R);Number.isInteger(ve)&&(le.port=ve)}}else if(j==="ssh"){if(le.host=D.trim(),q.trim()&&(le.user=q.trim()),R.trim()){const ve=Number(R);Number.isInteger(ve)&&(le.sshPort=ve)}Y.trim()&&(le.identityFile=Y.trim())}else j==="docker"?(te.trim()&&(le.image=te.trim()),me.trim()&&(le.repo=me.trim())):j==="codespace"&&(le.codespaceName=Q.trim());return le},[j,D,R,q,Y,te,me,Q]),ue=()=>!(!N.trim()||j==="ssh"&&!D.trim()||j==="codespace"&&!Q.trim()||(j==="local"||j==="ssh")&&!np(R)),Fe=()=>{ue()&&(o(N.trim(),j,re()),b==null||b("Environment added successfully","success"),y(po,{replace:!0}))},je=()=>{y(s?di(s):po)},Te=_.useCallback((le,ve)=>{if(!S||!s)return;const de=sp(S.adapterConfig),Ie=ve.trim();Ie?de[le]=Ie:delete de[le],c(s,{adapterConfig:de})},[S,s,c]),Me=_.useCallback((le,ve)=>{if(!S||!s)return;const de=sp(S.adapterConfig);if(ve.trim()){const Ie=Number(ve);Number.isInteger(Ie)&&Ie>=Bc&&Ie<=Lc&&(de[le]=Ie)}else delete de[le];c(s,{adapterConfig:de})},[S,s,c]);if(k){if(!S)return r.jsxs("div",{className:se.container,children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"edit environment"})}),r.jsx("div",{className:se.headerActions,children:r.jsx("button",{onClick:je,className:se.btnGhost,children:"Back"})})]}),r.jsx("div",{className:se.body,children:r.jsx("div",{className:se.formContent,children:r.jsx("span",{className:se.readOnlyValue,children:"Environment not found"})})})]});const le=sp(S.adapterConfig);return r.jsxs("div",{className:se.container,"data-testid":"env-edit-panel",children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"edit environment"})}),r.jsx("div",{className:se.headerActions,children:r.jsx("button",{onClick:je,className:se.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),r.jsx("div",{className:se.body,children:r.jsxs("div",{className:se.formContent,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Name"}),r.jsx(Xt,{value:S.displayName,onSave:ve=>{s&&c(s,{displayName:ve})},validate:ve=>ve.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:F,onActivate:ne,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Adapter Type"}),r.jsx("span",{className:se.readOnlyValue,"data-testid":"env-edit-adapter-type",children:S.adapterType})]}),S.adapterType==="local"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Host"}),r.jsx(Xt,{value:String(le.host??""),onSave:ve=>Te("host",ve),mode:"edit",fieldId:"host",activeFieldId:F,onActivate:ne,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Port"}),r.jsx(Xt,{value:String(le.port??""),onSave:ve=>Me("port",ve),validate:ve=>np(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:F,onActivate:ne,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),S.adapterType==="ssh"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Host"}),r.jsx(Xt,{value:String(le.host??""),onSave:ve=>Te("host",ve),validate:ve=>ve.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:F,onActivate:ne,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"User"}),r.jsx(Xt,{value:String(le.user??""),onSave:ve=>Te("user",ve),mode:"edit",fieldId:"user",activeFieldId:F,onActivate:ne,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"SSH Port"}),r.jsx(Xt,{value:String(le.sshPort??""),onSave:ve=>Me("sshPort",ve),validate:ve=>np(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:F,onActivate:ne,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Identity File"}),r.jsx(Xt,{value:String(le.identityFile??""),onSave:ve=>Te("identityFile",ve),mode:"edit",fieldId:"identityFile",activeFieldId:F,onActivate:ne,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),S.adapterType==="docker"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Image"}),r.jsx(Xt,{value:String(le.image??""),onSave:ve=>Te("image",ve),mode:"edit",fieldId:"image",activeFieldId:F,onActivate:ne,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Repo"}),r.jsx(Xt,{value:String(le.repo??""),onSave:ve=>Te("repo",ve),mode:"edit",fieldId:"repo",activeFieldId:F,onActivate:ne,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),S.adapterType==="codespace"&&r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Codespace Name"}),r.jsx(Xt,{value:String(le.codespaceName??""),onSave:ve=>Te("codespaceName",ve),validate:ve=>ve.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:F,onActivate:ne,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return r.jsxs("div",{className:se.container,"data-testid":"env-create-panel",children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"new environment"})}),r.jsxs("div",{className:se.headerActions,children:[r.jsx("button",{onClick:Fe,disabled:!ue(),className:se.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),r.jsx("button",{onClick:je,className:se.btnGhost,children:"Cancel"})]})]}),r.jsx("div",{className:se.body,children:r.jsxs("div",{className:se.formContent,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-name",children:"Name"}),r.jsx("input",{id:"env-create-name",type:"text",value:N,onChange:le=>w(le.target.value),placeholder:"Environment name...",autoFocus:!0,className:se.nameInput,"data-testid":"env-create-name",onKeyDown:le=>{le.key==="Enter"&&ue()&&Fe()}})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),r.jsxs("select",{id:"env-create-adapter",value:j,onChange:le=>{C(le.target.value),le.target.value==="codespace"&&u()},className:se.adapterSelect,"data-testid":"env-create-adapter",children:[r.jsx("option",{value:"local",children:"local"}),r.jsx("option",{value:"ssh",children:"ssh"}),r.jsx("option",{value:"docker",children:"docker"}),r.jsx("option",{value:"codespace",children:"codespace"})]})]}),j==="local"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-host",children:"Host"}),r.jsx("input",{id:"env-create-host",type:"text",value:D,onChange:le=>I(le.target.value),placeholder:"Host (optional)...",className:se.fieldInput,"data-testid":"env-create-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-port",children:"Port"}),r.jsx("input",{id:"env-create-port",type:"number",min:Bc,max:Lc,value:R,onChange:le=>E(le.target.value),placeholder:"Port (optional)...",className:se.fieldInput,"data-testid":"env-create-port"})]})]}),j==="ssh"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-host",children:"Host"}),r.jsx("input",{id:"env-create-host",type:"text",value:D,onChange:le=>I(le.target.value),placeholder:"Host (required)...",className:se.fieldInput,"data-testid":"env-create-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-user",children:"User"}),r.jsx("input",{id:"env-create-user",type:"text",value:q,onChange:le=>$(le.target.value),placeholder:"User (optional)...",className:se.fieldInput,"data-testid":"env-create-user"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-port",children:"SSH Port"}),r.jsx("input",{id:"env-create-port",type:"number",min:Bc,max:Lc,value:R,onChange:le=>E(le.target.value),placeholder:"SSH port (optional)...",className:se.fieldInput,"data-testid":"env-create-port"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-identity",children:"Identity File"}),r.jsx("input",{id:"env-create-identity",type:"text",value:Y,onChange:le=>Z(le.target.value),placeholder:"Identity file (optional)...",className:se.fieldInput,"data-testid":"env-create-identity"})]})]}),j==="docker"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-image",children:"Image"}),r.jsx("input",{id:"env-create-image",type:"text",value:te,onChange:le=>ae(le.target.value),placeholder:"Image (optional)...",className:se.fieldInput,"data-testid":"env-create-image"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-repo",children:"Repo"}),r.jsx("input",{id:"env-create-repo",type:"text",value:me,onChange:le=>ie(le.target.value),placeholder:"Repo (optional)...",className:se.fieldInput,"data-testid":"env-create-repo"})]})]}),j==="codespace"&&r.jsx(x5,{codespaceName:Q,onCodespaceNameChange:B,envName:N,onEnvNameChange:w,codespaces:d,codespaceError:p,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v})]})})]})}const k5="_group_1iprv_1",S5="_groupTitle_1iprv_8",T5="_shortcutList_1iprv_17",N5="_shortcutRow_1iprv_23",j5="_keys_1iprv_36",w5="_kbd_1iprv_43",C5="_description_1iprv_60",ai={group:k5,groupTitle:S5,shortcutList:T5,shortcutRow:N5,keys:j5,kbd:w5,description:C5},E5=[{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 A5(){return r.jsxs("section",{className:pe.section,"data-testid":"keyboard-shortcuts-panel",children:[r.jsx("h3",{className:pe.sectionTitle,children:"Keyboard Shortcuts"}),r.jsx("p",{className:pe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),E5.map(t=>r.jsxs("div",{className:ai.group,children:[r.jsx("h4",{className:ai.groupTitle,children:t.title}),r.jsx("div",{className:ai.shortcutList,children:t.shortcuts.map(s=>r.jsxs("div",{className:ai.shortcutRow,children:[r.jsx("span",{className:ai.keys,children:s.keys.map(i=>r.jsx("kbd",{className:ai.kbd,children:i},i))}),r.jsx("span",{className:ai.description,children:s.description})]},s.description))})]},t.title))]})}const D5="_workpadSection_y8nj9_1",R5="_workpadLabel_y8nj9_9",M5="_workpadStatus_y8nj9_17",I5="_workpadSummary_y8nj9_23",O5="_workpadExtra_y8nj9_29",Sa={workpadSection:D5,workpadLabel:R5,workpadStatus:M5,workpadSummary:I5,workpadExtra:O5};function B5({workpad:t}){if(!t)return;let s;try{const i=JSON.parse(t);if(i==null||typeof i!="object"||Array.isArray(i))return;s=i}catch{return r.jsxs("div",{className:Sa.workpadSection,"data-testid":"workpad-panel",children:[r.jsx("div",{className:Sa.workpadLabel,children:"Workpad"}),r.jsx("div",{className:Sa.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return r.jsxs("div",{className:Sa.workpadSection,"data-testid":"workpad-panel",children:[r.jsx("div",{className:Sa.workpadLabel,children:"Workpad"}),s.status&&r.jsx("div",{className:Sa.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&r.jsx("div",{className:Sa.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&r.jsx("div",{className:Sa.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const L5=[{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 z5({credentialProviders:t,onUpdateCredentialProviders:s}){const i=(o,c)=>{const u={...t};o==="claude"?u.claude=c:u[o]=c,s(u)};return r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Credential Providers"}),r.jsx("p",{className:pe.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),r.jsx("div",{className:pe.tokenList,children:L5.map(o=>r.jsxs("div",{className:pe.tokenRow,children:[r.jsx("span",{className:pe.tokenName,children:o.label}),r.jsx("span",{className:pe.tokenTarget,children:o.description}),r.jsx("select",{className:pe.select,value:t[o.key],onChange:c=>i(o.key,c.target.value),children:o.options.map(c=>r.jsx("option",{value:c.value,children:c.label},c.value))})]},o.key))})]})}const U5="_container_10efq_1",$5="_header_10efq_7",P5="_list_10efq_105",V5="_card_10efq_111",H5="_cardHeader_10efq_125",q5="_cardTitle_10efq_135",G5="_defaultBadge_10efq_141",F5="_cardActions_10efq_155",Z5="_description_10efq_160",K5="_meta_10efq_166",Y5="_empty_10efq_212",J5="_typeBadge_10efq_362",Vn={container:U5,header:$5,list:P5,card:V5,cardHeader:H5,cardTitle:q5,defaultBadge:G5,cardActions:F5,description:Z5,meta:K5,empty:Y5,typeBadge:J5};function W5({personas:t,appDefaultPersonaId:s,onDeletePersona:i,onSetAppDefaultPersonaId:o,onNavigateToNew:c,onNavigateToPersona:u}){const[d,p]=_.useState(null),h=d?t.find(v=>v.id===d):void 0,g=async v=>{await i(v),p(null)};return r.jsxs("div",{className:Vn.container,children:[r.jsxs("div",{className:Vn.header,children:[r.jsx("h2",{children:"Personas"}),r.jsx(Ps,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?r.jsx("p",{className:Vn.empty,children:"No personas yet. Create one to get started."}):r.jsx("div",{className:Vn.list,children:t.map(v=>{const b=s===v.id,y=v.type==="script";return r.jsxs("div",{className:Vn.card,"data-testid":`persona-card-${v.id}`,onClick:()=>u(v.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),u(v.id))},children:[r.jsxs("div",{className:Vn.cardHeader,children:[r.jsxs("span",{className:Vn.cardTitle,children:[r.jsx("strong",{children:v.name}),r.jsx("span",{className:Vn.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:y?"Script":"Agent"}),b&&r.jsx("span",{className:Vn.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),r.jsxs("div",{className:Vn.cardActions,onClick:k=>k.stopPropagation(),children:[!b&&r.jsx(Ps,{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"}),r.jsx(Ps,{variant:"ghost",size:"sm",onClick:()=>u(v.id),children:"Edit"}),r.jsx(Ps,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&r.jsx("p",{className:Vn.description,children:v.description}),r.jsxs("div",{className:Vn.meta,children:[v.runtime&&r.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&r.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&r.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),r.jsx(pi,{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:()=>p(null)})]})}const X5="_container_uy08i_1",Q5="_header_uy08i_7",eB="_count_uy08i_13",tB="_presets_uy08i_18",nB="_presetButton_uy08i_24",sB="_filterInput_uy08i_41",aB="_groups_uy08i_53",iB="_group_uy08i_53",oB="_groupHeader_uy08i_68",rB="_groupName_uy08i_77",lB="_groupCount_uy08i_81",cB="_toolList_uy08i_87",uB="_toolItem_uy08i_95",dB="_toolName_uy08i_103",on={container:X5,header:Q5,count:eB,presets:tB,presetButton:nB,filterInput:sB,groups:aB,group:iB,groupHeader:oB,groupName:rB,groupCount:lB,toolList:cB,toolItem:uB,toolName:dB},fB=(()=>{const t=new Map;for(const s of qb){const i=s==="get_version_status"?"version":s.split("_")[0];t.has(i)||t.set(i,[]),t.get(i).push(s)}return[...t.entries()].sort(([s],[i])=>s.localeCompare(i)).map(([s,i])=>({group:s,tools:i.sort()}))})(),pB=[{name:"default",label:"Default",tools:Gb},{name:"worker",label:"Worker",tools:KS},{name:"orchestrator",label:"Orchestrator",tools:YS},{name:"admin",label:"Admin",tools:JS}];function Nb({selectedTools:t,onChange:s,disabled:i}){const[o,c]=_.useState(""),u=_.useMemo(()=>new Set(t),[t]),d=_.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]),p=_.useCallback((v,b)=>{if(i)return;const y=new Set(u);for(const k of v)b?y.delete(k):y.add(k);s([...y].sort())},[u,s,i]),h=_.useCallback(v=>{i||s([...v].sort())},[s,i]),g=o.toLowerCase();return r.jsxs("div",{className:on.container,"data-testid":"mcp-tool-selector",children:[r.jsx("div",{className:on.header,children:r.jsx("span",{className:on.count,children:t.length===0?`Using default (${Gb.length} tools)`:`${t.length} of ${qb.size} tools selected`})}),r.jsxs("div",{className:on.presets,"data-testid":"mcp-tool-presets",children:[pB.map(v=>r.jsx("button",{type:"button",className:on.presetButton,disabled:i,onClick:()=>h(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),r.jsx("button",{type:"button",className:on.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),r.jsx("input",{type:"text",className:on.filterInput,placeholder:"Filter tools...",value:o,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),r.jsx("div",{className:on.groups,children:fB.map(({group:v,tools:b})=>{const y=g?b.filter(S=>S.toLowerCase().includes(g)):b;if(y.length===0)return null;const k=y.every(S=>u.has(S));return r.jsxs("div",{className:on.group,"data-testid":`tool-group-${v}`,children:[r.jsxs("label",{className:on.groupHeader,children:[r.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(y,k),disabled:i,"data-testid":`group-toggle-${v}`}),r.jsx("span",{className:on.groupName,children:v}),r.jsxs("span",{className:on.groupCount,children:["(",y.filter(S=>u.has(S)).length,"/",y.length,")"]})]}),r.jsx("div",{className:on.toolList,children:y.map(S=>r.jsxs("label",{className:on.toolItem,children:[r.jsx("input",{type:"checkbox",checked:u.has(S),onChange:()=>d(S),disabled:i,"data-testid":`tool-${S}`}),r.jsx("span",{className:on.toolName,children:S})]},S))})]},v)})})]})}const mB="_nav_1bhou_1",hB="_tab_1bhou_24",gB="_tabIcon_1bhou_62",vB="_tabActive_1bhou_68",Sc={nav:mB,tab:hB,tabIcon:gB,tabActive:vB},$s=[{path:"credentials",label:"Credentials",icon:r.jsx(a2,{size:Mt})},{path:"personas",label:"Personas",icon:r.jsx(A2,{size:Mt})},{path:"appearance",label:"Appearance",icon:r.jsx(_2,{size:Mt})},{path:"shortcuts",label:"Shortcuts",icon:r.jsx(o2,{size:Mt})},{path:"about",label:"About",icon:r.jsx(Pp,{size:Mt})}];function yB(){var d;const t=Pt(),s=yt(),i=_.useRef(null),o=((d=$s.find(p=>{const h=`${fo}/${p.path}`;return t.pathname===h||t.pathname.startsWith(`${h}/`)}))==null?void 0:d.path)??$s[0].path,c=_.useCallback(p=>{s(`${fo}/${p}`)},[s]),u=_.useCallback(p=>{var k,S;const h=(k=i.current)==null?void 0:k.querySelectorAll('[role="tab"]');if(!h)return;const g=Array.from(h).findIndex(N=>N===document.activeElement),v=g>=0?g:$s.findIndex(N=>N.path===o);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%$s.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+$s.length)%$s.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=$s.length-1;else return;const y=$s[b].path;s(`${fo}/${y}`),(S=h[b])==null||S.focus()},[o,s]);return r.jsx("nav",{className:Sc.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:$s.map(p=>{const h=p.path===o;return r.jsxs("button",{role:"tab",type:"button","aria-selected":h,tabIndex:h?0:-1,className:`${Sc.tab} ${h?Sc.tabActive:""}`,onClick:()=>c(p.path),children:[r.jsx("span",{className:Sc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function bB({tasks:t,taskStatusById:s,sessionStatusByTaskId:i}){const o=new Map;for(const u of t)if(u.parentTaskId){const d=o.get(u.parentTaskId);d?d.push(u):o.set(u.parentTaskId,[u])}const c=new Map(qv.map(u=>[u,[]]));for(const u of t){const d=Vr(u.status),p=u.dependsOn.length>0&&u.dependsOn.some(S=>s.get(S)!=="complete"),h=o.get(u.id)??[],g=h.length,v=h.filter(S=>S.status==="complete").length;let b;if(d==="paused"&&i){const S=i.get(u.id);S==="idle"?b="Needs input":S==="completed"&&(b="Ready to complete")}const y={task:u,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:b},k=c.get(d);k?k.push(y):c.get("not_started").push(y)}for(const u of c.values())u.sort((d,p)=>d.task.sortOrder-p.task.sortOrder);return qv.map(u=>{const d=Aa(u);return{status:u,label:d.label,style:d,tasks:c.get(u)??[]}})}const _B="_boardContainer_1c4y1_1",xB="_column_1c4y1_17",kB="_columnHeader_1c4y1_34",SB="_columnIcon_1c4y1_47",TB="_columnLabel_1c4y1_52",NB="_columnCount_1c4y1_57",jB="_cardList_1c4y1_67",wB="_emptyPlaceholder_1c4y1_76",CB="_card_1c4y1_67",EB="_cardHeader_1c4y1_107",AB="_cardStatusIcon_1c4y1_113",DB="_cardTitle_1c4y1_119",RB="_cardBadges_1c4y1_127",MB="_badge_1c4y1_134",IB="_blockedBadge_1c4y1_146",OB="_childBadge_1c4y1_151",BB="_depBadge_1c4y1_155",LB="_parentBadge_1c4y1_159",zB="_pausedSubBadge_1c4y1_166",UB="_personaBadge_1c4y1_170",$B="_envBadge_1c4y1_174",PB="_emptyCta_1c4y1_178",VB="_ctaButton_1c4y1_188",HB="_ctaDescription_1c4y1_204",nt={boardContainer:_B,column:xB,columnHeader:kB,columnIcon:SB,columnLabel:TB,columnCount:NB,cardList:jB,emptyPlaceholder:wB,card:CB,cardHeader:EB,cardStatusIcon:AB,cardTitle:DB,cardBadges:RB,badge:MB,blockedBadge:IB,childBadge:OB,depBadge:BB,parentBadge:LB,pausedSubBadge:zB,personaBadge:UB,envBadge:$B,emptyCta:PB,ctaButton:VB,ctaDescription:HB};function qB({workspaceId:t,environmentId:s,tasks:i,sessions:o,personas:c,environments:u}){const d=yt(),p=_.useMemo(()=>i.filter(y=>y.workspaceId===t),[i,t]),h=_.useMemo(()=>new Map(i.map(y=>[y.id,y.status])),[i]),g=_.useMemo(()=>new Map(p.map(y=>[y.id,y])),[p]),v=_.useMemo(()=>{const y=new Map(o.map(C=>[C.id,C])),k=new Map(c.map(C=>[C.id,C])),S=new Map(u.map(C=>[C.id,C])),N=new Map,w=new Map,j=new Map;for(const C of p)if(C.latestSessionId){const D=y.get(C.latestSessionId);if(D){if(N.set(C.id,D.endReason||D.status),D.personaId){const I=k.get(D.personaId);I&&w.set(C.id,I.name)}if(D.environmentId){const I=S.get(D.environmentId);I&&j.set(C.id,I.displayName)}}}return{sessionStatusByTaskId:N,personaNameByTaskId:w,environmentNameByTaskId:j}},[p,o,c,u]),b=_.useMemo(()=>bB({tasks:p,taskStatusById:h,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,h,v]);return p.length===0?r.jsxs("div",{className:nt.emptyCta,"data-testid":"board-empty-cta",children:[r.jsx("button",{className:nt.ctaButton,onClick:()=>d(gi(t,void 0,s)),children:"Create Task"}),r.jsx("div",{className:nt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):r.jsx("div",{className:nt.boardContainer,"data-testid":"board-container",children:b.map(y=>r.jsxs("section",{className:nt.column,"data-testid":`board-column-${y.status}`,"aria-label":`${y.label}, ${y.tasks.length} ${y.tasks.length===1?"task":"tasks"}`,children:[r.jsxs("div",{className:nt.columnHeader,children:[r.jsx("span",{className:nt.columnIcon,style:{color:y.style.color},children:y.style.icon}),r.jsx("span",{className:nt.columnLabel,children:y.label}),r.jsx("span",{className:nt.columnCount,"data-testid":`board-count-${y.status}`,children:y.tasks.length})]}),r.jsx("div",{className:nt.cardList,children:y.tasks.length===0?r.jsx("div",{className:nt.emptyPlaceholder,children:"No tasks"}):r.jsx(vs,{mode:"popLayout",children:y.tasks.map(k=>r.jsx(It.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:r.jsx(GB,{boardTask:k,tasksById:g,personaName:v.personaNameByTaskId.get(k.task.id),envName:v.environmentNameByTaskId.get(k.task.id),onClick:()=>d(as(k.task.id,void 0,t,s))})},k.task.id))})})]},y.status))})}function GB({boardTask:t,tasksById:s,personaName:i,envName:o,onClick:c}){const{task:u,isBlocked:d,childCount:p,doneChildCount:h,pausedSubBadge:g}=t,v=Aa(u.status),b=u.parentTaskId?s.get(u.parentTaskId):void 0;return r.jsxs("div",{className:nt.card,tabIndex:0,role:"button","data-testid":`board-card-${u.id}`,onClick:c,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),c())},children:[r.jsxs("div",{className:nt.cardHeader,children:[r.jsx("span",{className:nt.cardStatusIcon,style:{color:v.color},children:v.icon}),r.jsx("span",{className:nt.cardTitle,children:u.title})]}),r.jsxs("div",{className:nt.cardBadges,children:[b&&r.jsx("span",{className:`${nt.badge} ${nt.parentBadge}`,title:b.title,children:b.title}),p>0&&r.jsxs("span",{className:`${nt.badge} ${nt.childBadge}`,children:[h,"/",p]}),d&&r.jsx("span",{className:`${nt.badge} ${nt.blockedBadge}`,children:"blocked"}),u.dependsOn.length>0&&!d&&r.jsx("span",{className:`${nt.badge} ${nt.depBadge}`,children:"dep"}),g&&r.jsx("span",{className:`${nt.badge} ${nt.pausedSubBadge}`,children:g}),i&&r.jsx("span",{className:`${nt.badge} ${nt.personaBadge}`,children:i}),o&&r.jsx("span",{className:`${nt.badge} ${nt.envBadge}`,children:o})]})]})}const FB="_formContent_ymnez_1",ZB="_section_ymnez_13",KB="_label_ymnez_19",YB="_titleInput_ymnez_26",JB="_descriptionTextarea_ymnez_58",WB="_selectField_ymnez_94",XB="_checkboxRow_ymnez_128",QB="_checkboxLabel_ymnez_141",e8="_fieldError_ymnez_146",ht={formContent:FB,section:ZB,label:KB,titleInput:YB,descriptionTextarea:JB,selectField:WB,checkboxRow:XB,checkboxLabel:QB,fieldError:e8};function t8(t,s){return{name:(t==null?void 0:t.name)??"",description:(t==null?void 0:t.description)??"",repoUrl:(t==null?void 0:t.repoUrl)??"",environmentId:(t==null?void 0:t.environmentId)??s??"",defaultPersonaId:(t==null?void 0:t.defaultPersonaId)??"",useWorktrees:(t==null?void 0:t.useWorktrees)??!0,workingDirectory:(t==null?void 0:t.workingDirectory)??""}}const n8=100;function s8({values:t,onChange:s,environments:i,personas:o,errors:c,disabled:u,autoFocusName:d}){const p=(h,g)=>{s({...t,[h]:g})};return r.jsxs("div",{className:ht.formContent,children:[r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-name",children:"Name"}),r.jsx("input",{id:"ws-name",className:ht.titleInput,type:"text",value:t.name,onChange:h=>p("name",h.target.value),placeholder:"Workspace name",maxLength:n8,autoFocus:d,disabled:u,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&r.jsx("span",{className:ht.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-description",children:"Description"}),r.jsx("textarea",{id:"ws-description",className:ht.descriptionTextarea,value:t.description,onChange:h=>p("description",h.target.value),placeholder:"Optional description (Markdown supported)",disabled:u,"data-testid":"workspace-form-description"})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-repo",children:"Repository URL"}),r.jsx("input",{id:"ws-repo",className:ht.titleInput,type:"text",value:t.repoUrl,onChange:h=>p("repoUrl",h.target.value),placeholder:"https://github.com/org/repo",disabled:u,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&r.jsx("span",{className:ht.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-environment",children:"Environment"}),r.jsxs("select",{id:"ws-environment",className:ht.selectField,value:t.environmentId,onChange:h=>p("environmentId",h.target.value),disabled:u,"data-testid":"workspace-form-environment",children:[r.jsx("option",{value:"",children:"Select environment…"}),i.map(h=>r.jsx("option",{value:h.id,children:h.displayName||h.id},h.id))]}),(c==null?void 0:c.environmentId)&&r.jsx("span",{className:ht.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-persona",children:"Default Persona"}),r.jsxs("select",{id:"ws-persona",className:ht.selectField,value:t.defaultPersonaId,onChange:h=>p("defaultPersonaId",h.target.value),disabled:u,"data-testid":"workspace-form-persona",children:[r.jsx("option",{value:"",children:"(Inherit)"}),o.map(h=>r.jsx("option",{value:h.id,children:h.name},h.id))]})]}),r.jsx("div",{className:ht.section,children:r.jsxs("label",{className:ht.checkboxRow,children:[r.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:h=>p("useWorktrees",h.target.checked),disabled:u,"data-testid":"workspace-form-worktrees"}),r.jsx("span",{className:ht.checkboxLabel,children:"Enable worktree isolation"})]})}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-workdir",children:"Working Directory"}),r.jsx("input",{id:"ws-workdir",className:ht.titleInput,type:"text",value:t.workingDirectory,onChange:h=>p("workingDirectory",h.target.value),placeholder:"Default (server default)",disabled:u,"data-testid":"workspace-form-workdir"})]})]})}const ux=_.createContext(void 0),a8=4e3;function i8({children:t}){const[s,i]=_.useState([]),o=_.useRef(0),c=_.useCallback(d=>{i(p=>p.filter(h=>h.id!==d))},[]),u=_.useCallback((d,p="info",h=a8)=>{const g=`toast-${++o.current}`;i(v=>[...v,{id:g,message:d,variant:p,duration:h}])},[]);return r.jsx(ux.Provider,{value:{toasts:s,showToast:u,dismissToast:c},children:t})}function gn(){const t=_.useContext(ux);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const Lp="grackle-theme",dx="grackle-prefer-system",fx="(prefers-color-scheme: dark)";let jr=[],zc;function ap(){zc=void 0;for(const t of jr)t()}function zp(){return typeof window>"u"?!1:window.matchMedia(fx).matches}function Rr(){if(typeof localStorage>"u")return Tb;try{const t=localStorage.getItem(Lp);if(t!==null&&rx.has(t))return t}catch{}return Tb}function Jc(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(dx)==="true"}catch{return!1}}function Up(t){return du.find(s=>s.variantLightId===t||s.variantDarkId===t)}function px(t,s){const i=Bp(t);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?zp()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const o=Up(t);if(o!=null&&o.variantLightId&&o.variantDarkId)return zp()?o.variantDarkId:o.variantLightId}return t}function ao(t,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=px(t,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&ao(Rr(),Jc());function o8(){return zc===void 0&&(zc={themeId:Rr(),systemDark:zp(),preferSystem:Jc()}),zc}function r8(t){return jr=[...jr,t],()=>{jr=jr.filter(s=>s!==t)}}function l8(){const t=_.useSyncExternalStore(r8,o8),{themeId:s,preferSystem:i}=t,o=px(s,i),c=_.useCallback(d=>{if(rx.has(d)){try{localStorage.setItem(Lp,d)}catch{}ao(d,Jc(),!0),ap()}},[]),u=_.useCallback(d=>{try{localStorage.setItem(dx,d?"true":"false")}catch{}if(d){const p=Rr(),h=Bp(p);if(h!=null&&h.hidden){const g=Up(p);if(g)try{localStorage.setItem(Lp,g.id)}catch{}}}ao(Rr(),d,!0),ap()},[]);return _.useEffect(()=>{ao(s,i)},[s,i]),_.useEffect(()=>{if(typeof window>"u")return;const d=window.matchMedia(fx),p=()=>{const h=Rr(),g=Jc();if(g){const v=Bp(h);if(v!=null&&v.variantDarkId&&v.variantLightId&&ao(h,g),v!=null&&v.hidden){const b=Up(h);b!=null&&b.variantDarkId&&b.variantLightId&&ao(h,g)}}ap()};return d.addEventListener("change",p),()=>{d.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:o,preferSystem:i,setPreferSystem:u}}const mx=_.createContext(void 0);function c8({children:t}){const s=l8();return r.jsx(mx.Provider,{value:s,children:t})}function hx(){const t=_.useContext(mx);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const gx=_.createContext(void 0),vx=_.createContext(void 0);function u8({children:t}){const[s,i]=_.useState(void 0),o=_.useCallback(c=>{i(c)},[]);return r.jsx(vx.Provider,{value:o,children:r.jsx(gx.Provider,{value:s,children:t})})}function d8(){return _.useContext(gx)}function f8(){const t=_.useContext(vx);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const Lm=_.createContext(void 0);function lt(){const t=_.useContext(Lm);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function yx(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function bx(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function p8(t){return yx(t)&&typeof t.sessionId=="string"&&typeof t.eventType=="string"&&typeof t.timestamp=="string"&&typeof t.content=="string"&&(t.raw===void 0||typeof t.raw=="string")}const m8=new Set(["off","subscription","api_key"]),Tc=new Set(["off","on"]);function h8(t){return yx(t)&&m8.has(t.claude)&&Tc.has(t.github)&&Tc.has(t.copilot)&&Tc.has(t.codex)&&Tc.has(t.goose)}function _x(t){switch(t){case"waiting_input":return"idle";case"completed":return"stopped";case"killed":return"stopped";case"failed":return"stopped";case"interrupted":return"stopped";case"terminated":return"stopped";default:return t}}function xx(t){switch(t){case"completed":return"completed";case"killed":return"killed";case"failed":return"interrupted";case"interrupted":return"interrupted";case"terminated":return"terminated";default:return}}const so=5e3;function g8(t,s){const i=[];let o=t;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 Zs={label:"Home",url:fi};function v8(t){return t?[Zs,{label:"Settings",url:fo},{label:t,url:void 0}]:[Zs,{label:"Settings",url:void 0}]}const zm={label:"Environments",url:po};function y8(){return[Zs,{label:"Environments",url:void 0}]}function b8(){return[Zs,{label:"New Chat",url:void 0}]}function _8(t){return[Zs,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function x8(t,s,i,o){const c=i.find(d=>d.id===t),u=o.find(d=>d.id===s);return[Zs,zm,{label:(u==null?void 0:u.displayName)??"Environment",url:di(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function k8(t,s,i,o,c){const u=g8(t,c),d=c.get(t),p=d==null?void 0:d.workspaceId,h=p?i.find(k=>k.id===p):void 0,g=s??(h==null?void 0:h.environmentId),v=g?o.find(k=>k.id===g):void 0,b=[Zs];v&&g&&(b.push(zm),b.push({label:v.displayName,url:di(g)})),h&&g&&b.push({label:h.name,url:ui(h.id,g)});for(let k=0;k<u.length-1;k++)b.push({label:u[k].title,url:as(u[k].id,void 0,p,g)});const y=u[u.length-1];return b.push({label:(y==null?void 0:y.title)??t,url:void 0}),b}const S8={label:"Findings",url:au};function T8(){return[Zs,{label:"Findings",url:void 0}]}function kx(t,s,i,o,c){const u=[Zs];if(s&&i){const d=o.find(h=>h.id===s),p=c.find(h=>h.id===i);u.push(zm),p&&u.push({label:p.displayName,url:di(i)}),d&&u.push({label:d.name,url:ui(s,i)}),u.push({label:"Findings",url:zj(s,i)})}else u.push(S8);return u.push({label:t,url:void 0}),u}function Um(t){const s=[];for(const i of t){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 Nc(t){if(typeof t.id=="string")return t.id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const i=t.item;if(i&&typeof i.id=="string")return i.id}function N8(t){if(typeof t.tool_use_id=="string")return t.tool_use_id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const i=t.item;if(i&&typeof i.id=="string")return i.id}function $m(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const i=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const b=s.get(v),y=b?Nc(b):void 0;if(y)try{const k=JSON.parse(v.content);i.set(y,{tool:k.tool,args:k.args})}catch{}}const o=new Set,c=new Set,u=t.map((v,b)=>{if(v.eventType!=="tool_result")return v;const y=s.get(v),k=y?N8(y):void 0;if(!k)return v;const S=i.get(k);if(!S)return v;o.add(k),c.add(b);let N;const w=v.content.trim();if(w.startsWith("{"))try{const j=JSON.parse(w);typeof j.detailedContent=="string"&&(N=j.detailedContent)}catch{}return{...v,toolUseCtx:{...S,detailedResult:N}}}),d=[];for(let v=0;v<u.length;v++){if(u[v].eventType!=="tool_use")continue;const b=s.get(u[v]),y=b?Nc(b):void 0;y&&o.has(y)||d.push(v)}const p=[];for(let v=0;v<u.length;v++)u[v].eventType!=="tool_result"||c.has(v)||p.push(v);let h=0;for(const v of d){for(;h<p.length&&p[h]<v;)h++;if(h>=p.length)break;const b=p[h];if(b!==v+1)continue;const y=u[v],k=u[b];let S;try{const N=JSON.parse(y.content);S={tool:N.tool,args:N.args}}catch{}if(S){let N;const w=k.content.trim();if(w.startsWith("{"))try{const D=JSON.parse(w);typeof D.detailedContent=="string"&&(N=D.detailedContent)}catch{}u[b]={...k,toolUseCtx:{...S,detailedResult:N}},c.add(b);const j=s.get(y),C=j?Nc(j):void 0;C?o.add(C):(o.add(`__seq_${v}`),s.set(y,{...j??{},__seqId:`__seq_${v}`})),h++}}const g=u.filter(v=>{if(v.eventType!=="tool_use")return!0;const b=s.get(v);if(!b)return!0;const y=Nc(b);if(y&&o.has(y))return!1;const k=b.__seqId;return!(k&&o.has(k))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let b=!1;for(let y=v+1;y<g.length;y++)if(g[y].eventType!=="tool_use"){b=!0;break}b&&(g[v]={...g[v],settled:!0})}return g}function j8(t,s,i){const o=t.filter(h=>h.status==="running"||h.status==="idle"||h.status==="waiting").length,c=Sx(s),u=s.filter(h=>$p(h,c)).length,d=s.filter(h=>h.status==="paused"||h.status==="failed"||$p(h,c)).length,p=i.filter(h=>h.status==="disconnected"||h.status==="error").length;return{activeSessions:o,blockedTasks:u,attentionTasks:d,unhealthyEnvironments:p}}function Sx(t){const s=new Map;for(const i of t)s.set(i.id,i.status);return s}function $p(t,s){return t.dependsOn.some(i=>s.get(i)!=="complete")}function w8(t,s){var d;const i=new Map;for(const p of s)i.set(p.id,p);const o=Sx(t),c=[];for(const p of t){const h=p.workspaceId?((d=i.get(p.workspaceId))==null?void 0:d.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:h}):$p(p,o)?c.push({task:p,reason:"blocked",workspaceName:h}):p.status==="paused"&&c.push({task:p,reason:"paused",workspaceName:h})}const u={failed:0,blocked:1,paused:2};return c.sort((p,h)=>(u[p.reason]??3)-(u[h.reason]??3)),c}function C8(t,s){const i=new Map;for(const o of s)i.set(o.id,o);return t.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 E8(t,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 t.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 ps=[{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
254
+ `),()=>{document.head.removeChild(v)}},[s]),r.jsx(sA,{isPresent:s,childRef:o,sizeRef:c,children:_.cloneElement(t,{ref:o})})}const iA=({children:t,initial:s,isPresent:i,onExitComplete:o,custom:c,presenceAffectsLayout:u,mode:d})=>{const p=em(oA),h=_.useId(),g=_.useCallback(b=>{p.set(b,!0);for(const y of p.values())if(!y)return;o&&o()},[p,o]),v=_.useMemo(()=>({id:h,initial:s,isPresent:i,custom:c,onExitComplete:g,register:b=>(p.set(b,!1),()=>p.delete(b))}),u?[Math.random(),g]:[i,g]);return _.useMemo(()=>{p.forEach((b,y)=>p.set(y,!1))},[i]),_.useEffect(()=>{!i&&!p.size&&o&&o()},[i]),d==="popLayout"&&(t=r.jsx(aA,{isPresent:i,children:t})),r.jsx(iu.Provider,{value:v,children:t})};function oA(){return new Map}function __(t=!0){const s=_.useContext(iu);if(s===null)return[!0,null];const{isPresent:i,onExitComplete:o,register:c}=s,u=_.useId();_.useEffect(()=>{t&&c(u)},[t]);const d=_.useCallback(()=>t&&o&&o(u),[u,o,t]);return!i&&o?[!1,d]:[!0]}const bc=t=>t.key||"";function ay(t){const s=[];return _.Children.forEach(t,i=>{_.isValidElement(i)&&s.push(i)}),s}const nm=typeof window<"u",x_=nm?_.useLayoutEffect:_.useEffect,vs=({children:t,custom:s,initial:i=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:u="sync",propagate:d=!1})=>{const[p,h]=__(d),g=_.useMemo(()=>ay(t),[t]),v=d&&!p?[]:g.map(bc),b=_.useRef(!0),y=_.useRef(g),k=em(()=>new Map),[S,N]=_.useState(g),[w,j]=_.useState(g);x_(()=>{b.current=!1,y.current=g;for(let I=0;I<w.length;I++){const R=bc(w[I]);v.includes(R)?k.delete(R):k.get(R)!==!0&&k.set(R,!1)}},[w,v.length,v.join("-")]);const C=[];if(g!==S){let I=[...g];for(let R=0;R<w.length;R++){const E=w[R],q=bc(E);v.includes(q)||(I.splice(R,0,E),C.push(E))}u==="wait"&&C.length&&(I=C),j(ay(I)),N(g);return}const{forceRender:D}=_.useContext(Qp);return r.jsx(r.Fragment,{children:w.map(I=>{const R=bc(I),E=d&&!p?!1:g===w||v.includes(R),q=()=>{if(k.has(R))k.set(R,!0);else return;let $=!0;k.forEach(Y=>{Y||($=!1)}),$&&(D==null||D(),j(y.current),d&&(h==null||h()),o&&o())};return r.jsx(iA,{isPresent:E,initial:!b.current||i?void 0:!1,custom:E?void 0:s,presenceAffectsLayout:c,mode:u,onExitComplete:E?void 0:q,children:I},R)})})},jn=t=>t;let k_=jn;const rA={useManualTiming:!1};function lA(t){let s=new Set,i=new Set,o=!1,c=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function p(g){u.has(g)&&(h.schedule(g),t()),g(d)}const h={schedule:(g,v=!1,b=!1)=>{const k=b&&o?s:i;return v&&u.add(g),k.has(g)||k.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(p),s.clear(),o=!1,c&&(c=!1,h.process(g))}};return h}const _c=["read","resolveKeyframes","update","preRender","render","postRender"],cA=40;function S_(t,s){let i=!1,o=!0;const c={delta:0,timestamp:0,isProcessing:!1},u=()=>i=!0,d=_c.reduce((j,C)=>(j[C]=lA(u),j),{}),{read:p,resolveKeyframes:h,update:g,preRender:v,render:b,postRender:y}=d,k=()=>{const j=performance.now();i=!1,c.delta=o?1e3/60:Math.max(Math.min(j-c.timestamp,cA),1),c.timestamp=j,c.isProcessing=!0,p.process(c),h.process(c),g.process(c),v.process(c),b.process(c),y.process(c),c.isProcessing=!1,i&&s&&(o=!1,t(k))},S=()=>{i=!0,o=!0,c.isProcessing||t(k)};return{schedule:_c.reduce((j,C)=>{const D=d[C];return j[C]=(I,R=!1,E=!1)=>(i||S(),D.schedule(I,R,E)),j},{}),cancel:j=>{for(let C=0;C<_c.length;C++)d[_c[C]].cancel(j)},state:c,steps:d}}const{schedule:vt,cancel:Da,state:Wt,steps:Hf}=S_(typeof requestAnimationFrame<"u"?requestAnimationFrame:jn,!0),T_=_.createContext({strict:!1}),iy={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"]},ho={};for(const t in iy)ho[t]={isEnabled:s=>iy[t].some(i=>!!s[i])};function uA(t){for(const s in t)ho[s]={...ho[s],...t[s]}}const dA=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function $c(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||dA.has(t)}let N_=t=>!$c(t);function fA(t){t&&(N_=s=>s.startsWith("on")?!$c(s):t(s))}try{fA(require("@emotion/is-prop-valid").default)}catch{}function pA(t,s,i){const o={};for(const c in t)c==="values"&&typeof t.values=="object"||(N_(c)||i===!0&&$c(c)||!s&&!$c(c)||t.draggable&&c.startsWith("onDrag"))&&(o[c]=t[c]);return o}function mA(t){if(typeof Proxy>"u")return t;const s=new Map,i=(...o)=>t(...o);return new Proxy(i,{get:(o,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const ou=_.createContext({});function Lr(t){return typeof t=="string"||Array.isArray(t)}function ru(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const sm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],am=["initial",...sm];function lu(t){return ru(t.animate)||am.some(s=>Lr(t[s]))}function j_(t){return!!(lu(t)||t.variants)}function hA(t,s){if(lu(t)){const{initial:i,animate:o}=t;return{initial:i===!1||Lr(i)?i:void 0,animate:Lr(o)?o:void 0}}return t.inherit!==!1?s:{}}function gA(t){const{initial:s,animate:i}=hA(t,_.useContext(ou));return _.useMemo(()=>({initial:s,animate:i}),[oy(s),oy(i)])}function oy(t){return Array.isArray(t)?t.join(" "):t}const vA=Symbol.for("motionComponentSymbol");function io(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function yA(t,s,i){return _.useCallback(o=>{o&&t.onMount&&t.onMount(o),s&&(o?s.mount(o):s.unmount()),i&&(typeof i=="function"?i(o):io(i)&&(i.current=o))},[s])}const im=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),bA="framerAppearId",w_="data-"+im(bA),{schedule:om}=S_(queueMicrotask,!1),C_=_.createContext({});function _A(t,s,i,o,c){var u,d;const{visualElement:p}=_.useContext(ou),h=_.useContext(T_),g=_.useContext(iu),v=_.useContext(tm).reducedMotion,b=_.useRef(null);o=o||h.renderer,!b.current&&o&&(b.current=o(t,{visualState:s,parent:p,props:i,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const y=b.current,k=_.useContext(C_);y&&!y.projection&&c&&(y.type==="html"||y.type==="svg")&&xA(b.current,i,c,k);const S=_.useRef(!1);_.useInsertionEffect(()=>{y&&S.current&&y.update(i,g)});const N=i[w_],w=_.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 x_(()=>{y&&(S.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),om.render(y.render),w.current&&y.animationState&&y.animationState.animateChanges())}),_.useEffect(()=>{y&&(!w.current&&y.animationState&&y.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var j;(j=window.MotionHandoffMarkAsComplete)===null||j===void 0||j.call(window,N)}),w.current=!1))}),y}function xA(t,s,i,o){const{layoutId:c,layout:u,drag:d,dragConstraints:p,layoutScroll:h,layoutRoot:g}=s;t.projection=new i(t.latestValues,s["data-framer-portal-id"]?void 0:E_(t.parent)),t.projection.setOptions({layoutId:c,layout:u,alwaysMeasureLayout:!!d||p&&io(p),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:h,layoutRoot:g})}function E_(t){if(t)return t.options.allowProjection!==!1?t.projection:E_(t.parent)}function kA({preloadedFeatures:t,createVisualElement:s,useRender:i,useVisualState:o,Component:c}){var u,d;t&&uA(t);function p(g,v){let b;const y={..._.useContext(tm),...g,layoutId:SA(g)},{isStatic:k}=y,S=gA(g),N=o(g,k);if(!k&&nm){TA();const w=NA(y);b=w.MeasureLayout,S.visualElement=_A(c,N,y,s,w.ProjectionNode)}return r.jsxs(ou.Provider,{value:S,children:[b&&S.visualElement?r.jsx(b,{visualElement:S.visualElement,...y}):null,i(c,g,yA(N,S.visualElement,v),N,k,S.visualElement)]})}p.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=_.forwardRef(p);return h[vA]=c,h}function SA({layoutId:t}){const s=_.useContext(Qp).id;return s&&t!==void 0?s+"-"+t:t}function TA(t,s){_.useContext(T_).strict}function NA(t){const{drag:s,layout:i}=ho;if(!s&&!i)return{};const o={...s,...i};return{MeasureLayout:s!=null&&s.isEnabled(t)||i!=null&&i.isEnabled(t)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}const jA=["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 rm(t){return typeof t!="string"||t.includes("-")?!1:!!(jA.indexOf(t)>-1||/[A-Z]/u.test(t))}function ry(t){const s=[{},{}];return t==null||t.values.forEach((i,o)=>{s[0][o]=i.get(),s[1][o]=i.getVelocity()}),s}function lm(t,s,i,o){if(typeof s=="function"){const[c,u]=ry(o);s=s(i!==void 0?i:t.custom,c,u)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,u]=ry(o);s=s(i!==void 0?i:t.custom,c,u)}return s}const _p=t=>Array.isArray(t),wA=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CA=t=>_p(t)?t[t.length-1]||0:t,nn=t=>!!(t&&t.getVelocity);function Mc(t){const s=nn(t)?t.get():t;return wA(s)?s.toValue():s}function EA({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:i},o,c,u){const d={latestValues:AA(o,c,u,t),renderState:s()};return i&&(d.onMount=p=>i({props:o,current:p,...d}),d.onUpdate=p=>i(p)),d}const A_=t=>(s,i)=>{const o=_.useContext(ou),c=_.useContext(iu),u=()=>EA(t,s,o,c);return i?u():em(u)};function AA(t,s,i,o){const c={},u=o(t,{});for(const y in u)c[y]=Mc(u[y]);let{initial:d,animate:p}=t;const h=lu(t),g=j_(t);s&&g&&!h&&t.inherit!==!1&&(d===void 0&&(d=s.initial),p===void 0&&(p=s.animate));let v=i?i.initial===!1:!1;v=v||d===!1;const b=v?p:d;if(b&&typeof b!="boolean"&&!ru(b)){const y=Array.isArray(b)?b:[b];for(let k=0;k<y.length;k++){const S=lm(t,y[k]);if(S){const{transitionEnd:N,transition:w,...j}=S;for(const C in j){let D=j[C];if(Array.isArray(D)){const I=v?D.length-1:0;D=D[I]}D!==null&&(c[C]=D)}for(const C in N)c[C]=N[C]}}}return c}const ko=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],vi=new Set(ko),D_=t=>s=>typeof s=="string"&&s.startsWith(t),R_=D_("--"),DA=D_("var(--"),cm=t=>DA(t)?RA.test(t.split("/*")[0].trim()):!1,RA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,M_=(t,s)=>s&&typeof t=="number"?s.transform(t):t,Fs=(t,s,i)=>i>s?s:i<t?t:i,So={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},zr={...So,transform:t=>Fs(0,1,t)},xc={...So,default:1},Gr=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),wa=Gr("deg"),hs=Gr("%"),Ne=Gr("px"),MA=Gr("vh"),IA=Gr("vw"),ly={...hs,parse:t=>hs.parse(t)/100,transform:t=>hs.transform(t*100)},OA={borderWidth:Ne,borderTopWidth:Ne,borderRightWidth:Ne,borderBottomWidth:Ne,borderLeftWidth:Ne,borderRadius:Ne,radius:Ne,borderTopLeftRadius:Ne,borderTopRightRadius:Ne,borderBottomRightRadius:Ne,borderBottomLeftRadius:Ne,width:Ne,maxWidth:Ne,height:Ne,maxHeight:Ne,top:Ne,right:Ne,bottom:Ne,left:Ne,padding:Ne,paddingTop:Ne,paddingRight:Ne,paddingBottom:Ne,paddingLeft:Ne,margin:Ne,marginTop:Ne,marginRight:Ne,marginBottom:Ne,marginLeft:Ne,backgroundPositionX:Ne,backgroundPositionY:Ne},BA={rotate:wa,rotateX:wa,rotateY:wa,rotateZ:wa,scale:xc,scaleX:xc,scaleY:xc,scaleZ:xc,skew:wa,skewX:wa,skewY:wa,distance:Ne,translateX:Ne,translateY:Ne,translateZ:Ne,x:Ne,y:Ne,z:Ne,perspective:Ne,transformPerspective:Ne,opacity:zr,originX:ly,originY:ly,originZ:Ne},cy={...So,transform:Math.round},um={...OA,...BA,zIndex:cy,size:Ne,fillOpacity:zr,strokeOpacity:zr,numOctaves:cy},LA={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},zA=ko.length;function UA(t,s,i){let o="",c=!0;for(let u=0;u<zA;u++){const d=ko[u],p=t[d];if(p===void 0)continue;let h=!0;if(typeof p=="number"?h=p===(d.startsWith("scale")?1:0):h=parseFloat(p)===0,!h||i){const g=M_(p,um[d]);if(!h){c=!1;const v=LA[d]||d;o+=`${v}(${g}) `}i&&(s[d]=g)}}return o=o.trim(),i?o=i(s,c?"":o):c&&(o="none"),o}function dm(t,s,i){const{style:o,vars:c,transformOrigin:u}=t;let d=!1,p=!1;for(const h in s){const g=s[h];if(vi.has(h)){d=!0;continue}else if(R_(h)){c[h]=g;continue}else{const v=M_(g,um[h]);h.startsWith("origin")?(p=!0,u[h]=v):o[h]=v}}if(s.transform||(d||i?o.transform=UA(s,t.transform,i):o.transform&&(o.transform="none")),p){const{originX:h="50%",originY:g="50%",originZ:v=0}=u;o.transformOrigin=`${h} ${g} ${v}`}}const $A={offset:"stroke-dashoffset",array:"stroke-dasharray"},PA={offset:"strokeDashoffset",array:"strokeDasharray"};function VA(t,s,i=1,o=0,c=!0){t.pathLength=1;const u=c?$A:PA;t[u.offset]=Ne.transform(-o);const d=Ne.transform(s),p=Ne.transform(i);t[u.array]=`${d} ${p}`}function uy(t,s,i){return typeof t=="string"?t:Ne.transform(s+i*t)}function HA(t,s,i){const o=uy(s,t.x,t.width),c=uy(i,t.y,t.height);return`${o} ${c}`}function fm(t,{attrX:s,attrY:i,attrScale:o,originX:c,originY:u,pathLength:d,pathSpacing:p=1,pathOffset:h=0,...g},v,b){if(dm(t,g,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:y,style:k,dimensions:S}=t;y.transform&&(S&&(k.transform=y.transform),delete y.transform),S&&(c!==void 0||u!==void 0||k.transform)&&(k.transformOrigin=HA(S,c!==void 0?c:.5,u!==void 0?u:.5)),s!==void 0&&(y.x=s),i!==void 0&&(y.y=i),o!==void 0&&(y.scale=o),d!==void 0&&VA(y,d,p,h,!1)}const pm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),I_=()=>({...pm(),attrs:{}}),mm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function O_(t,{style:s,vars:i},o,c){Object.assign(t.style,s,c&&c.getProjectionStyles(o));for(const u in i)t.style.setProperty(u,i[u])}const B_=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 L_(t,s,i,o){O_(t,s,void 0,o);for(const c in s.attrs)t.setAttribute(B_.has(c)?c:im(c),s.attrs[c])}const Pc={};function qA(t){Object.assign(Pc,t)}function z_(t,{layout:s,layoutId:i}){return vi.has(t)||t.startsWith("origin")||(s||i!==void 0)&&(!!Pc[t]||t==="opacity")}function hm(t,s,i){var o;const{style:c}=t,u={};for(const d in c)(nn(c[d])||s.style&&nn(s.style[d])||z_(d,t)||((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 U_(t,s,i){const o=hm(t,s,i);for(const c in t)if(nn(t[c])||nn(s[c])){const u=ko.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;o[u]=t[c]}return o}function GA(t,s){try{s.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{s.dimensions={x:0,y:0,width:0,height:0}}}const dy=["x","y","width","height","cx","cy","r"],FA={useVisualState:A_({scrapeMotionValuesFromProps:U_,createRenderState:I_,onUpdate:({props:t,prevProps:s,current:i,renderState:o,latestValues:c})=>{if(!i)return;let u=!!t.drag;if(!u){for(const p in c)if(vi.has(p)){u=!0;break}}if(!u)return;let d=!s;if(s)for(let p=0;p<dy.length;p++){const h=dy[p];t[h]!==s[h]&&(d=!0)}d&&vt.read(()=>{GA(i,o),vt.render(()=>{fm(o,c,mm(i.tagName),t.transformTemplate),L_(i,o)})})}})},ZA={useVisualState:A_({scrapeMotionValuesFromProps:hm,createRenderState:pm})};function $_(t,s,i){for(const o in s)!nn(s[o])&&!z_(o,i)&&(t[o]=s[o])}function KA({transformTemplate:t},s){return _.useMemo(()=>{const i=pm();return dm(i,s,t),Object.assign({},i.vars,i.style)},[s])}function YA(t,s){const i=t.style||{},o={};return $_(o,i,t),Object.assign(o,KA(t,s)),o}function JA(t,s){const i={},o=YA(t,s);return t.drag&&t.dragListener!==!1&&(i.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(i.tabIndex=0),i.style=o,i}function WA(t,s,i,o){const c=_.useMemo(()=>{const u=I_();return fm(u,s,mm(o),t.transformTemplate),{...u.attrs,style:{...u.style}}},[s]);if(t.style){const u={};$_(u,t.style,t),c.style={...u,...c.style}}return c}function XA(t=!1){return(i,o,c,{latestValues:u},d)=>{const h=(rm(i)?WA:JA)(o,u,d,i),g=pA(o,typeof i=="string",t),v=i!==_.Fragment?{...g,...h,ref:c}:{},{children:b}=o,y=_.useMemo(()=>nn(b)?b.get():b,[b]);return _.createElement(i,{...v,children:y})}}function QA(t,s){return function(o,{forwardMotionProps:c}={forwardMotionProps:!1}){const d={...rm(o)?FA:ZA,preloadedFeatures:t,useRender:XA(c),createVisualElement:s,Component:o};return kA(d)}}function P_(t,s){if(!Array.isArray(s))return!1;const i=s.length;if(i!==t.length)return!1;for(let o=0;o<i;o++)if(s[o]!==t[o])return!1;return!0}function cu(t,s,i){const o=t.getProps();return lm(o,s,i!==void 0?i:o.custom,t)}function gm(t,s){return t?t[s]||t.default||t:void 0}const V_=new Set(["width","height","top","left","right","bottom",...ko]);let Ic;function eD(){Ic=void 0}const gs={now:()=>(Ic===void 0&&gs.set(Wt.isProcessing||rA.useManualTiming?Wt.timestamp:performance.now()),Ic),set:t=>{Ic=t,queueMicrotask(eD)}};function vm(t,s){t.indexOf(s)===-1&&t.push(s)}function ym(t,s){const i=t.indexOf(s);i>-1&&t.splice(i,1)}class bm{constructor(){this.subscriptions=[]}add(s){return vm(this.subscriptions,s),()=>ym(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 H_(t,s){return s?t*(1e3/s):0}const fy=30,tD=t=>!isNaN(parseFloat(t));class nD{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(o,c=!0)=>{const u=gs.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=gs.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=tD(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 bm);const o=this.events[s].add(i);return s==="change"?()=>{o(),vt.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=gs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>fy)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,fy);return H_(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 Ur(t,s){return new nD(t,s)}function sD(t,s,i){t.hasValue(s)?t.getValue(s).set(i):t.addValue(s,Ur(i))}function aD(t,s){const i=cu(t,s);let{transitionEnd:o={},transition:c={},...u}=i||{};u={...u,...o};for(const d in u){const p=CA(u[d]);sD(t,d,p)}}function iD(t){return!!(nn(t)&&t.add)}function xp(t,s){const i=t.getValue("willChange");if(iD(i))return i.add(s)}function q_(t){return t.props[w_]}function _m(t){let s;return()=>(s===void 0&&(s=t()),s)}const oD=_m(()=>window.ScrollTimeline!==void 0);class rD{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(oD()&&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 lD extends rD{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Vs=t=>t*1e3,Hs=t=>t/1e3;function xm(t){return typeof t=="function"}function py(t,s){t.timeline=s,t.onfinish=null}const km=t=>Array.isArray(t)&&typeof t[0]=="number",cD={linearEasing:void 0};function uD(t,s){const i=_m(t);return()=>{var o;return(o=cD[s])!==null&&o!==void 0?o:i()}}const Vc=uD(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),go=(t,s,i)=>{const o=s-t;return o===0?1:(i-t)/o},G_=(t,s,i=10)=>{let o="";const c=Math.max(Math.round(s/i),2);for(let u=0;u<c;u++)o+=t(go(0,c-1,u))+", ";return`linear(${o.substring(0,o.length-2)})`};function F_(t){return!!(typeof t=="function"&&Vc()||!t||typeof t=="string"&&(t in kp||Vc())||km(t)||Array.isArray(t)&&t.every(F_))}const Sr=([t,s,i,o])=>`cubic-bezier(${t}, ${s}, ${i}, ${o})`,kp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Sr([0,.65,.55,1]),circOut:Sr([.55,0,1,.45]),backIn:Sr([.31,.01,.66,-.59]),backOut:Sr([.33,1.53,.69,.99])};function Z_(t,s){if(t)return typeof t=="function"&&Vc()?G_(t,s):km(t)?Sr(t):Array.isArray(t)?t.map(i=>Z_(i,s)||kp.easeOut):kp[t]}const K_=(t,s,i)=>(((1-3*i+3*s)*t+(3*i-6*s))*t+3*s)*t,dD=1e-7,fD=12;function pD(t,s,i,o,c){let u,d,p=0;do d=s+(i-s)/2,u=K_(d,o,c)-t,u>0?i=d:s=d;while(Math.abs(u)>dD&&++p<fD);return d}function Fr(t,s,i,o){if(t===s&&i===o)return jn;const c=u=>pD(u,0,1,t,i);return u=>u===0||u===1?u:K_(c(u),s,o)}const Y_=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,J_=t=>s=>1-t(1-s),W_=Fr(.33,1.53,.69,.99),Sm=J_(W_),X_=Y_(Sm),Q_=t=>(t*=2)<1?.5*Sm(t):.5*(2-Math.pow(2,-10*(t-1))),Tm=t=>1-Math.sin(Math.acos(t)),e1=J_(Tm),t1=Y_(Tm),n1=t=>/^0[^.\s]+$/u.test(t);function mD(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||n1(t):!0}const Cr=t=>Math.round(t*1e5)/1e5,Nm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function hD(t){return t==null}const gD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,jm=(t,s)=>i=>!!(typeof i=="string"&&gD.test(i)&&i.startsWith(t)||s&&!hD(i)&&Object.prototype.hasOwnProperty.call(i,s)),s1=(t,s,i)=>o=>{if(typeof o!="string")return o;const[c,u,d,p]=o.match(Nm);return{[t]:parseFloat(c),[s]:parseFloat(u),[i]:parseFloat(d),alpha:p!==void 0?parseFloat(p):1}},vD=t=>Fs(0,255,t),qf={...So,transform:t=>Math.round(vD(t))},ri={test:jm("rgb","red"),parse:s1("red","green","blue"),transform:({red:t,green:s,blue:i,alpha:o=1})=>"rgba("+qf.transform(t)+", "+qf.transform(s)+", "+qf.transform(i)+", "+Cr(zr.transform(o))+")"};function yD(t){let s="",i="",o="",c="";return t.length>5?(s=t.substring(1,3),i=t.substring(3,5),o=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),i=t.substring(2,3),o=t.substring(3,4),c=t.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 Sp={test:jm("#"),parse:yD,transform:ri.transform},oo={test:jm("hsl","hue"),parse:s1("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:i,alpha:o=1})=>"hsla("+Math.round(t)+", "+hs.transform(Cr(s))+", "+hs.transform(Cr(i))+", "+Cr(zr.transform(o))+")"},tn={test:t=>ri.test(t)||Sp.test(t)||oo.test(t),parse:t=>ri.test(t)?ri.parse(t):oo.test(t)?oo.parse(t):Sp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?ri.transform(t):oo.transform(t)},bD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function _D(t){var s,i;return isNaN(t)&&typeof t=="string"&&(((s=t.match(Nm))===null||s===void 0?void 0:s.length)||0)+(((i=t.match(bD))===null||i===void 0?void 0:i.length)||0)>0}const a1="number",i1="color",xD="var",kD="var(",my="${}",SD=/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 $r(t){const s=t.toString(),i=[],o={color:[],number:[],var:[]},c=[];let u=0;const p=s.replace(SD,h=>(tn.test(h)?(o.color.push(u),c.push(i1),i.push(tn.parse(h))):h.startsWith(kD)?(o.var.push(u),c.push(xD),i.push(h)):(o.number.push(u),c.push(a1),i.push(parseFloat(h))),++u,my)).split(my);return{values:i,split:p,indexes:o,types:c}}function o1(t){return $r(t).values}function r1(t){const{split:s,types:i}=$r(t),o=s.length;return c=>{let u="";for(let d=0;d<o;d++)if(u+=s[d],c[d]!==void 0){const p=i[d];p===a1?u+=Cr(c[d]):p===i1?u+=tn.transform(c[d]):u+=c[d]}return u}}const TD=t=>typeof t=="number"?0:t;function ND(t){const s=o1(t);return r1(t)(s.map(TD))}const Ra={test:_D,parse:o1,createTransformer:r1,getAnimatableNone:ND},jD=new Set(["brightness","contrast","saturate","opacity"]);function wD(t){const[s,i]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[o]=i.match(Nm)||[];if(!o)return t;const c=i.replace(o,"");let u=jD.has(s)?1:0;return o!==i&&(u*=100),s+"("+u+c+")"}const CD=/\b([a-z-]*)\(.*?\)/gu,Tp={...Ra,getAnimatableNone:t=>{const s=t.match(CD);return s?s.map(wD).join(" "):t}},ED={...um,color:tn,backgroundColor:tn,outlineColor:tn,fill:tn,stroke:tn,borderColor:tn,borderTopColor:tn,borderRightColor:tn,borderBottomColor:tn,borderLeftColor:tn,filter:Tp,WebkitFilter:Tp},wm=t=>ED[t];function l1(t,s){let i=wm(t);return i!==Tp&&(i=Ra),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const AD=new Set(["auto","none","0"]);function DD(t,s,i){let o=0,c;for(;o<t.length&&!c;){const u=t[o];typeof u=="string"&&!AD.has(u)&&$r(u).values.length&&(c=t[o]),o++}if(c&&i)for(const u of s)t[u]=l1(i,c)}const hy=t=>t===So||t===Ne,gy=(t,s)=>parseFloat(t.split(", ")[s]),vy=(t,s)=>(i,{transform:o})=>{if(o==="none"||!o)return 0;const c=o.match(/^matrix3d\((.+)\)$/u);if(c)return gy(c[1],s);{const u=o.match(/^matrix\((.+)\)$/u);return u?gy(u[1],t):0}},RD=new Set(["x","y","z"]),MD=ko.filter(t=>!RD.has(t));function ID(t){const s=[];return MD.forEach(i=>{const o=t.getValue(i);o!==void 0&&(s.push([i,o.get()]),o.set(i.startsWith("scale")?1:0))}),s}const vo={width:({x:t},{paddingLeft:s="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),height:({y:t},{paddingTop:s="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),top:(t,{top:s})=>parseFloat(s),left:(t,{left:s})=>parseFloat(s),bottom:({y:t},{top:s})=>parseFloat(s)+(t.max-t.min),right:({x:t},{left:s})=>parseFloat(s)+(t.max-t.min),x:vy(4,13),y:vy(5,14)};vo.translateX=vo.x;vo.translateY=vo.y;const ci=new Set;let Np=!1,jp=!1;function c1(){if(jp){const t=Array.from(ci).filter(o=>o.needsMeasurement),s=new Set(t.map(o=>o.element)),i=new Map;s.forEach(o=>{const c=ID(o);c.length&&(i.set(o,c),o.render())}),t.forEach(o=>o.measureInitialState()),s.forEach(o=>{o.render();const c=i.get(o);c&&c.forEach(([u,d])=>{var p;(p=o.getValue(u))===null||p===void 0||p.set(d)})}),t.forEach(o=>o.measureEndState()),t.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}jp=!1,Np=!1,ci.forEach(t=>t.complete()),ci.clear()}function u1(){ci.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(jp=!0)})}function OD(){u1(),c1()}class Cm{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?(ci.add(this),Np||(Np=!0,vt.read(u1),vt.resolveKeyframes(c1))):(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(),p=s[s.length-1];if(d!==void 0)s[0]=d;else if(o&&i){const h=o.readValue(i,p);h!=null&&(s[0]=h)}s[0]===void 0&&(s[0]=p),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),ci.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,ci.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const d1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),BD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LD(t){const s=BD.exec(t);if(!s)return[,];const[,i,o,c]=s;return[`--${i??o}`,c]}function f1(t,s,i=1){const[o,c]=LD(t);if(!o)return;const u=window.getComputedStyle(s).getPropertyValue(o);if(u){const d=u.trim();return d1(d)?parseFloat(d):d}return cm(c)?f1(c,s,i+1):c}const p1=t=>s=>s.test(t),zD={test:t=>t==="auto",parse:t=>t},m1=[So,Ne,hs,wa,IA,MA,zD],yy=t=>m1.find(p1(t));class h1 extends Cm{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(),cm(g))){const v=f1(g,i.current);v!==void 0&&(s[h]=v),h===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!V_.has(o)||s.length!==2)return;const[c,u]=s,d=yy(c),p=yy(u);if(d!==p)if(hy(d)&&hy(p))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++)mD(s[c])&&o.push(c);o.length&&DD(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=vo[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,p=c[d];c[d]=vo[o](i.measureViewportBox(),window.getComputedStyle(i.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([h,g])=>{i.getValue(h).set(g)}),this.resolveNoneKeyframes()}}const by=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ra.test(t)||t==="0")&&!t.startsWith("url("));function UD(t){const s=t[0];if(t.length===1)return!0;for(let i=0;i<t.length;i++)if(t[i]!==s)return!0}function $D(t,s,i,o){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const u=t[t.length-1],d=by(c,s),p=by(u,s);return!d||!p?!1:UD(t)||(i==="spring"||xm(i))&&o}const PD=t=>t!==null;function uu(t,{repeat:s,repeatType:i="loop"},o){const c=t.filter(PD),u=s&&i!=="loop"&&s%2===1?0:c.length-1;return!u||o===void 0?c[u]:o}const VD=40;class g1{constructor({autoplay:s=!0,delay:i=0,type:o="keyframes",repeat:c=0,repeatDelay:u=0,repeatType:d="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=gs.now(),this.options={autoplay:s,delay:i,type:o,repeat:c,repeatDelay:u,repeatType:d,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>VD?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&OD(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=gs.now(),this.hasAttemptedResolve=!0;const{name:o,type:c,velocity:u,delay:d,onComplete:p,onUpdate:h,isGenerator:g}=this.options;if(!g&&!$D(s,o,c,u))if(d)this.options.duration=0;else{h&&h(uu(s,this.options,i)),p&&p(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,i);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:i,...v},this.onPostResolved())}onPostResolved(){}then(s,i){return this.currentFinishedPromise.then(s,i)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const wp=2e4;function v1(t){let s=0;const i=50;let o=t.next(s);for(;!o.done&&s<wp;)s+=i,o=t.next(s);return s>=wp?1/0:s}const St=(t,s,i)=>t+(s-t)*i;function Gf(t,s,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+(s-t)*6*i:i<1/2?s:i<2/3?t+(s-t)*(2/3-i)*6:t}function HD({hue:t,saturation:s,lightness:i,alpha:o}){t/=360,s/=100,i/=100;let c=0,u=0,d=0;if(!s)c=u=d=i;else{const p=i<.5?i*(1+s):i+s-i*s,h=2*i-p;c=Gf(h,p,t+1/3),u=Gf(h,p,t),d=Gf(h,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:o}}function Hc(t,s){return i=>i>0?s:t}const Ff=(t,s,i)=>{const o=t*t,c=i*(s*s-o)+o;return c<0?0:Math.sqrt(c)},qD=[Sp,ri,oo],GD=t=>qD.find(s=>s.test(t));function _y(t){const s=GD(t);if(!s)return!1;let i=s.parse(t);return s===oo&&(i=HD(i)),i}const xy=(t,s)=>{const i=_y(t),o=_y(s);if(!i||!o)return Hc(t,s);const c={...i};return u=>(c.red=Ff(i.red,o.red,u),c.green=Ff(i.green,o.green,u),c.blue=Ff(i.blue,o.blue,u),c.alpha=St(i.alpha,o.alpha,u),ri.transform(c))},FD=(t,s)=>i=>s(t(i)),Zr=(...t)=>t.reduce(FD),Cp=new Set(["none","hidden"]);function ZD(t,s){return Cp.has(t)?i=>i<=0?t:s:i=>i>=1?s:t}function KD(t,s){return i=>St(t,s,i)}function Em(t){return typeof t=="number"?KD:typeof t=="string"?cm(t)?Hc:tn.test(t)?xy:WD:Array.isArray(t)?y1:typeof t=="object"?tn.test(t)?xy:YD:Hc}function y1(t,s){const i=[...t],o=i.length,c=t.map((u,d)=>Em(u)(u,s[d]));return u=>{for(let d=0;d<o;d++)i[d]=c[d](u);return i}}function YD(t,s){const i={...t,...s},o={};for(const c in i)t[c]!==void 0&&s[c]!==void 0&&(o[c]=Em(t[c])(t[c],s[c]));return c=>{for(const u in o)i[u]=o[u](c);return i}}function JD(t,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],p=t.indexes[d][c[d]],h=(i=t.values[p])!==null&&i!==void 0?i:0;o[u]=h,c[d]++}return o}const WD=(t,s)=>{const i=Ra.createTransformer(s),o=$r(t),c=$r(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?Cp.has(t)&&!c.values.length||Cp.has(s)&&!o.values.length?ZD(t,s):Zr(y1(JD(o,c),c.values),i):Hc(t,s)};function b1(t,s,i){return typeof t=="number"&&typeof s=="number"&&typeof i=="number"?St(t,s,i):Em(t)(t,s)}const XD=5;function _1(t,s,i){const o=Math.max(s-XD,0);return H_(i-t(o),s-o)}const wt={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},Zf=.001;function QD({duration:t=wt.duration,bounce:s=wt.bounce,velocity:i=wt.velocity,mass:o=wt.mass}){let c,u,d=1-s;d=Fs(wt.minDamping,wt.maxDamping,d),t=Fs(wt.minDuration,wt.maxDuration,Hs(t)),d<1?(c=g=>{const v=g*d,b=v*t,y=v-i,k=Ep(g,d),S=Math.exp(-b);return Zf-y/k*S},u=g=>{const b=g*d*t,y=b*i+i,k=Math.pow(d,2)*Math.pow(g,2)*t,S=Math.exp(-b),N=Ep(Math.pow(g,2),d);return(-c(g)+Zf>0?-1:1)*((y-k)*S)/N}):(c=g=>{const v=Math.exp(-g*t),b=(g-i)*t+1;return-Zf+v*b},u=g=>{const v=Math.exp(-g*t),b=(i-g)*(t*t);return v*b});const p=5/t,h=tR(c,u,p);if(t=Vs(t),isNaN(h))return{stiffness:wt.stiffness,damping:wt.damping,duration:t};{const g=Math.pow(h,2)*o;return{stiffness:g,damping:d*2*Math.sqrt(o*g),duration:t}}}const eR=12;function tR(t,s,i){let o=i;for(let c=1;c<eR;c++)o=o-t(o)/s(o);return o}function Ep(t,s){return t*Math.sqrt(1-s*s)}const nR=["duration","bounce"],sR=["stiffness","damping","mass"];function ky(t,s){return s.some(i=>t[i]!==void 0)}function aR(t){let s={velocity:wt.velocity,stiffness:wt.stiffness,damping:wt.damping,mass:wt.mass,isResolvedFromDuration:!1,...t};if(!ky(t,sR)&&ky(t,nR))if(t.visualDuration){const i=t.visualDuration,o=2*Math.PI/(i*1.2),c=o*o,u=2*Fs(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:wt.mass,stiffness:c,damping:u}}else{const i=QD(t);s={...s,...i,mass:wt.mass},s.isResolvedFromDuration=!0}return s}function x1(t=wt.visualDuration,s=wt.bounce){const i=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:o,restDelta:c}=i;const u=i.keyframes[0],d=i.keyframes[i.keyframes.length-1],p={done:!1,value:u},{stiffness:h,damping:g,mass:v,duration:b,velocity:y,isResolvedFromDuration:k}=aR({...i,velocity:-Hs(i.velocity||0)}),S=y||0,N=g/(2*Math.sqrt(h*v)),w=d-u,j=Hs(Math.sqrt(h/v)),C=Math.abs(w)<5;o||(o=C?wt.restSpeed.granular:wt.restSpeed.default),c||(c=C?wt.restDelta.granular:wt.restDelta.default);let D;if(N<1){const R=Ep(j,N);D=E=>{const q=Math.exp(-N*j*E);return d-q*((S+N*j*w)/R*Math.sin(R*E)+w*Math.cos(R*E))}}else if(N===1)D=R=>d-Math.exp(-j*R)*(w+(S+j*w)*R);else{const R=j*Math.sqrt(N*N-1);D=E=>{const q=Math.exp(-N*j*E),$=Math.min(R*E,300);return d-q*((S+N*j*w)*Math.sinh($)+R*w*Math.cosh($))/R}}const I={calculatedDuration:k&&b||null,next:R=>{const E=D(R);if(k)p.done=R>=b;else{let q=0;N<1&&(q=R===0?Vs(S):_1(D,R,E));const $=Math.abs(q)<=o,Y=Math.abs(d-E)<=c;p.done=$&&Y}return p.value=p.done?d:E,p},toString:()=>{const R=Math.min(v1(I),wp),E=G_(q=>I.next(R*q).value,R,30);return R+"ms "+E}};return I}function Sy({keyframes:t,velocity:s=0,power:i=.8,timeConstant:o=325,bounceDamping:c=10,bounceStiffness:u=500,modifyTarget:d,min:p,max:h,restDelta:g=.5,restSpeed:v}){const b=t[0],y={done:!1,value:b},k=$=>p!==void 0&&$<p||h!==void 0&&$>h,S=$=>p===void 0?h:h===void 0||Math.abs(p-$)<Math.abs(h-$)?p:h;let N=i*s;const w=b+N,j=d===void 0?w:d(w);j!==w&&(N=j-b);const C=$=>-N*Math.exp(-$/o),D=$=>j+C($),I=$=>{const Y=C($),Z=D($);y.done=Math.abs(Y)<=g,y.value=y.done?j:Z};let R,E;const q=$=>{k(y.value)&&(R=$,E=x1({keyframes:[y.value,S(y.value)],velocity:_1(D,$,y.value),damping:c,stiffness:u,restDelta:g,restSpeed:v}))};return q(0),{calculatedDuration:null,next:$=>{let Y=!1;return!E&&R===void 0&&(Y=!0,I($),q($)),R!==void 0&&$>=R?E.next($-R):(!Y&&I($),y)}}}const iR=Fr(.42,0,1,1),oR=Fr(0,0,.58,1),k1=Fr(.42,0,.58,1),rR=t=>Array.isArray(t)&&typeof t[0]!="number",lR={linear:jn,easeIn:iR,easeInOut:k1,easeOut:oR,circIn:Tm,circInOut:t1,circOut:e1,backIn:Sm,backInOut:X_,backOut:W_,anticipate:Q_},Ty=t=>{if(km(t)){k_(t.length===4);const[s,i,o,c]=t;return Fr(s,i,o,c)}else if(typeof t=="string")return lR[t];return t};function cR(t,s,i){const o=[],c=i||b1,u=t.length-1;for(let d=0;d<u;d++){let p=c(t[d],t[d+1]);if(s){const h=Array.isArray(s)?s[d]||jn:s;p=Zr(h,p)}o.push(p)}return o}function uR(t,s,{clamp:i=!0,ease:o,mixer:c}={}){const u=t.length;if(k_(u===s.length),u===1)return()=>s[0];if(u===2&&s[0]===s[1])return()=>s[1];const d=t[0]===t[1];t[0]>t[u-1]&&(t=[...t].reverse(),s=[...s].reverse());const p=cR(s,o,c),h=p.length,g=v=>{if(d&&v<t[0])return s[0];let b=0;if(h>1)for(;b<t.length-2&&!(v<t[b+1]);b++);const y=go(t[b],t[b+1],v);return p[b](y)};return i?v=>g(Fs(t[0],t[u-1],v)):g}function dR(t,s){const i=t[t.length-1];for(let o=1;o<=s;o++){const c=go(0,s,o);t.push(St(i,1,c))}}function fR(t){const s=[0];return dR(s,t.length-1),s}function pR(t,s){return t.map(i=>i*s)}function mR(t,s){return t.map(()=>s||k1).splice(0,t.length-1)}function qc({duration:t=300,keyframes:s,times:i,ease:o="easeInOut"}){const c=rR(o)?o.map(Ty):Ty(o),u={done:!1,value:s[0]},d=pR(i&&i.length===s.length?i:fR(s),t),p=uR(d,s,{ease:Array.isArray(c)?c:mR(s,c)});return{calculatedDuration:t,next:h=>(u.value=p(h),u.done=h>=t,u)}}const hR=t=>{const s=({timestamp:i})=>t(i);return{start:()=>vt.update(s,!0),stop:()=>Da(s),now:()=>Wt.isProcessing?Wt.timestamp:gs.now()}},gR={decay:Sy,inertia:Sy,tween:qc,keyframes:qc,spring:x1},vR=t=>t/100;class Am extends g1{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)||Cm,p=(h,g)=>this.onKeyframesResolved(h,g);this.resolver=new d(u,p,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,p=xm(i)?i:gR[i]||qc;let h,g;p!==qc&&typeof s[0]!="number"&&(h=Zr(vR,b1(s[0],s[1])),s=[0,100]);const v=p({...this.options,keyframes:s});u==="mirror"&&(g=p({...this.options,keyframes:[...s].reverse(),velocity:-d})),v.calculatedDuration===null&&(v.calculatedDuration=v1(v));const{calculatedDuration:b}=v,y=b+c,k=y*(o+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:h,calculatedDuration:b,resolvedDuration:y,totalDuration:k}}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:$}=this.options;return{done:!0,value:$[$.length-1]}}const{finalKeyframe:c,generator:u,mirroredGenerator:d,mapPercentToKeyframes:p,keyframes:h,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=o;if(this.startTime===null)return u.next(0);const{delay:y,repeat:k,repeatType:S,repeatDelay:N,onUpdate:w}=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 j=this.currentTime-y*(this.speed>=0?1:-1),C=this.speed>=0?j<0:j>v;this.currentTime=Math.max(j,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let D=this.currentTime,I=u;if(k){const $=Math.min(this.currentTime,v)/b;let Y=Math.floor($),Z=$%1;!Z&&$>=1&&(Z=1),Z===1&&Y--,Y=Math.min(Y,k+1),!!(Y%2)&&(S==="reverse"?(Z=1-Z,N&&(Z-=N/b)):S==="mirror"&&(I=d)),D=Fs(0,1,Z)*b}const R=C?{done:!1,value:h[0]}:I.next(D);p&&(R.value=p(R.value));let{done:E}=R;!C&&g!==null&&(E=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const q=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return q&&c!==void 0&&(R.value=uu(h,this.options,c)),w&&w(R.value),q&&this.finish(),R}get duration(){const{resolved:s}=this;return s?Hs(s.calculatedDuration):0}get time(){return Hs(this.currentTime)}set time(s){s=Vs(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=Hs(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=hR,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 yR=new Set(["opacity","clipPath","filter","transform"]);function bR(t,s,i,{delay:o=0,duration:c=300,repeat:u=0,repeatType:d="loop",ease:p="easeInOut",times:h}={}){const g={[s]:i};h&&(g.offset=h);const v=Z_(p,c);return Array.isArray(v)&&(g.easing=v),t.animate(g,{delay:o,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:u+1,direction:d==="reverse"?"alternate":"normal"})}const _R=_m(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Gc=10,xR=2e4;function kR(t){return xm(t.type)||t.type==="spring"||!F_(t.ease)}function SR(t,s){const i=new Am({...s,keyframes:t,repeat:0,delay:0,isGenerator:!0});let o={done:!1,value:t[0]};const c=[];let u=0;for(;!o.done&&u<xR;)o=i.sample(u),c.push(o.value),u+=Gc;return{times:void 0,keyframes:c,duration:u-Gc,ease:"linear"}}const S1={anticipate:Q_,backInOut:X_,circInOut:t1};function TR(t){return t in S1}class Ny extends g1{constructor(s){super(s);const{name:i,motionValue:o,element:c,keyframes:u}=this.options;this.resolver=new h1(u,(d,p)=>this.onKeyframesResolved(d,p),i,o,c),this.resolver.scheduleResolve()}initPlayback(s,i){let{duration:o=300,times:c,ease:u,type:d,motionValue:p,name:h,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof u=="string"&&Vc()&&TR(u)&&(u=S1[u]),kR(this.options)){const{onComplete:b,onUpdate:y,motionValue:k,element:S,...N}=this.options,w=SR(s,N);s=w.keyframes,s.length===1&&(s[1]=s[0]),o=w.duration,c=w.times,u=w.ease,d="keyframes"}const v=bR(p.owner.current,h,s,{...this.options,duration:o,times:c,ease:u});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(py(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(uu(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 Hs(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Hs(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.currentTime=Vs(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 jn;const{animation:o}=i;py(o,s)}return jn}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:p}=s;if(i.playState==="idle"||i.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:y,...k}=this.options,S=new Am({...k,keyframes:o,duration:c,type:u,ease:d,times:p,isGenerator:!0}),N=Vs(this.time);g.setWithVelocity(S.sample(N-Gc).value,S.sample(N).value,Gc)}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:p}=s;if(!i||!i.owner||!(i.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:g}=i.owner.getProps();return _R()&&o&&yR.has(o)&&!h&&!g&&!c&&u!=="mirror"&&d!==0&&p!=="inertia"}}const NR={type:"spring",stiffness:500,damping:25,restSpeed:10},jR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),wR={type:"keyframes",duration:.8},CR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ER=(t,{keyframes:s})=>s.length>2?wR:vi.has(t)?t.startsWith("scale")?jR(s[1]):NR:CR;function AR({when:t,delay:s,delayChildren:i,staggerChildren:o,staggerDirection:c,repeat:u,repeatType:d,repeatDelay:p,from:h,elapsed:g,...v}){return!!Object.keys(v).length}const Dm=(t,s,i,o={},c,u)=>d=>{const p=gm(o,t)||{},h=p.delay||o.delay||0;let{elapsed:g=0}=o;g=g-Vs(h);let v={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:y=>{s.set(y),p.onUpdate&&p.onUpdate(y)},onComplete:()=>{d(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:u?void 0:c};AR(p)||(v={...v,...ER(t,v)}),v.duration&&(v.duration=Vs(v.duration)),v.repeatDelay&&(v.repeatDelay=Vs(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 y=uu(v.keyframes,p);if(y!==void 0)return vt.update(()=>{v.onUpdate(y),v.onComplete()}),new lD([])}return!u&&Ny.supports(v)?new Ny(v):new Am(v)};function DR({protectedKeys:t,needsAnimating:s},i){const o=t.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,o}function T1(t,s,{delay:i=0,transitionOverride:o,type:c}={}){var u;let{transition:d=t.getDefaultTransition(),transitionEnd:p,...h}=s;o&&(d=o);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const b in h){const y=t.getValue(b,(u=t.latestValues[b])!==null&&u!==void 0?u:null),k=h[b];if(k===void 0||v&&DR(v,b))continue;const S={delay:i,...gm(d||{},b)};let N=!1;if(window.MotionHandoffAnimation){const j=q_(t);if(j){const C=window.MotionHandoffAnimation(j,b,vt);C!==null&&(S.startTime=C,N=!0)}}xp(t,b),y.start(Dm(b,y,k,t.shouldReduceMotion&&V_.has(b)?{type:!1}:S,t,N));const w=y.animation;w&&g.push(w)}return p&&Promise.all(g).then(()=>{vt.update(()=>{p&&aD(t,p)})}),g}function Ap(t,s,i={}){var o;const c=cu(t,s,i.type==="exit"?(o=t.presenceContext)===null||o===void 0?void 0:o.custom:void 0);let{transition:u=t.getDefaultTransition()||{}}=c||{};i.transitionOverride&&(u=i.transitionOverride);const d=c?()=>Promise.all(T1(t,c,i)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:y}=u;return RR(t,s,v+g,b,y,i)}:()=>Promise.resolve(),{when:h}=u;if(h){const[g,v]=h==="beforeChildren"?[d,p]:[p,d];return g().then(()=>v())}else return Promise.all([d(),p(i.delay)])}function RR(t,s,i=0,o=0,c=1,u){const d=[],p=(t.variantChildren.size-1)*o,h=c===1?(g=0)=>g*o:(g=0)=>p-g*o;return Array.from(t.variantChildren).sort(MR).forEach((g,v)=>{g.notify("AnimationStart",s),d.push(Ap(g,s,{...u,delay:i+h(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(d)}function MR(t,s){return t.sortNodePosition(s)}function IR(t,s,i={}){t.notify("AnimationStart",s);let o;if(Array.isArray(s)){const c=s.map(u=>Ap(t,u,i));o=Promise.all(c)}else if(typeof s=="string")o=Ap(t,s,i);else{const c=typeof s=="function"?cu(t,s,i.custom):s;o=Promise.all(T1(t,c,i))}return o.then(()=>{t.notify("AnimationComplete",s)})}const OR=am.length;function N1(t){if(!t)return;if(!t.isControllingVariants){const i=t.parent?N1(t.parent)||{}:{};return t.props.initial!==void 0&&(i.initial=t.props.initial),i}const s={};for(let i=0;i<OR;i++){const o=am[i],c=t.props[o];(Lr(c)||c===!1)&&(s[o]=c)}return s}const BR=[...sm].reverse(),LR=sm.length;function zR(t){return s=>Promise.all(s.map(({animation:i,options:o})=>IR(t,i,o)))}function UR(t){let s=zR(t),i=jy(),o=!0;const c=h=>(g,v)=>{var b;const y=cu(t,v,h==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(y){const{transition:k,transitionEnd:S,...N}=y;g={...g,...N,...S}}return g};function u(h){s=h(t)}function d(h){const{props:g}=t,v=N1(t.parent)||{},b=[],y=new Set;let k={},S=1/0;for(let w=0;w<LR;w++){const j=BR[w],C=i[j],D=g[j]!==void 0?g[j]:v[j],I=Lr(D),R=j===h?C.isActive:null;R===!1&&(S=w);let E=D===v[j]&&D!==g[j]&&I;if(E&&o&&t.manuallyAnimateOnMount&&(E=!1),C.protectedKeys={...k},!C.isActive&&R===null||!D&&!C.prevProp||ru(D)||typeof D=="boolean")continue;const q=$R(C.prevProp,D);let $=q||j===h&&C.isActive&&!E&&I||w>S&&I,Y=!1;const Z=Array.isArray(D)?D:[D];let te=Z.reduce(c(j),{});R===!1&&(te={});const{prevResolvedValues:ae={}}=C,me={...ae,...te},ie=F=>{$=!0,y.has(F)&&(Y=!0,y.delete(F)),C.needsAnimating[F]=!0;const ne=t.getValue(F);ne&&(ne.liveStyle=!1)};for(const F in me){const ne=te[F],re=ae[F];if(k.hasOwnProperty(F))continue;let ue=!1;_p(ne)&&_p(re)?ue=!P_(ne,re):ue=ne!==re,ue?ne!=null?ie(F):y.add(F):ne!==void 0&&y.has(F)?ie(F):C.protectedKeys[F]=!0}C.prevProp=D,C.prevResolvedValues=te,C.isActive&&(k={...k,...te}),o&&t.blockInitialAnimation&&($=!1),$&&(!(E&&q)||Y)&&b.push(...Z.map(F=>({animation:F,options:{type:j}})))}if(y.size){const w={};y.forEach(j=>{const C=t.getBaseTarget(j),D=t.getValue(j);D&&(D.liveStyle=!0),w[j]=C??null}),b.push({animation:w})}let N=!!b.length;return o&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(N=!1),o=!1,N?s(b):Promise.resolve()}function p(h,g){var v;if(i[h].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(y=>{var k;return(k=y.animationState)===null||k===void 0?void 0:k.setActive(h,g)}),i[h].isActive=g;const b=d(h);for(const y in i)i[y].protectedKeys={};return b}return{animateChanges:d,setActive:p,setAnimateFunction:u,getState:()=>i,reset:()=>{i=jy(),o=!0}}}function $R(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!P_(s,t):!1}function ti(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function jy(){return{animate:ti(!0),whileInView:ti(),whileHover:ti(),whileTap:ti(),whileDrag:ti(),whileFocus:ti(),exit:ti()}}class Ia{constructor(s){this.isMounted=!1,this.node=s}update(){}}class PR extends Ia{constructor(s){super(s),s.animationState||(s.animationState=UR(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();ru(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 VR=0;class HR extends Ia{constructor(){super(...arguments),this.id=VR++}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 qR={animation:{Feature:PR},exit:{Feature:HR}},ns={x:!1,y:!1};function j1(){return ns.x||ns.y}function GR(t){return t==="x"||t==="y"?ns[t]?null:(ns[t]=!0,()=>{ns[t]=!1}):ns.x||ns.y?null:(ns.x=ns.y=!0,()=>{ns.x=ns.y=!1})}const Rm=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Pr(t,s,i,o={passive:!0}){return t.addEventListener(s,i,o),()=>t.removeEventListener(s,i)}function Kr(t){return{point:{x:t.pageX,y:t.pageY}}}const FR=t=>s=>Rm(s)&&t(s,Kr(s));function Er(t,s,i,o){return Pr(t,s,FR(i),o)}const wy=(t,s)=>Math.abs(t-s);function ZR(t,s){const i=wy(t.x,s.x),o=wy(t.y,s.y);return Math.sqrt(i**2+o**2)}class w1{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=Yf(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,k=ZR(b.offset,{x:0,y:0})>=3;if(!y&&!k)return;const{point:S}=b,{timestamp:N}=Wt;this.history.push({...S,timestamp:N});const{onStart:w,onMove:j}=this.handlers;y||(w&&w(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),j&&j(this.lastMoveEvent,b)},this.handlePointerMove=(b,y)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=Kf(y,this.transformPagePoint),vt.update(this.updatePoint,!0)},this.handlePointerUp=(b,y)=>{this.end();const{onEnd:k,onSessionEnd:S,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=Yf(b.type==="pointercancel"?this.lastMoveEventInfo:Kf(y,this.transformPagePoint),this.history);this.startEvent&&k&&k(b,w),S&&S(b,w)},!Rm(s))return;this.dragSnapToOrigin=u,this.handlers=i,this.transformPagePoint=o,this.contextWindow=c||window;const d=Kr(s),p=Kf(d,this.transformPagePoint),{point:h}=p,{timestamp:g}=Wt;this.history=[{...h,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,Yf(p,this.history)),this.removeListeners=Zr(Er(this.contextWindow,"pointermove",this.handlePointerMove),Er(this.contextWindow,"pointerup",this.handlePointerUp),Er(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Da(this.updatePoint)}}function Kf(t,s){return s?{point:s(t.point)}:t}function Cy(t,s){return{x:t.x-s.x,y:t.y-s.y}}function Yf({point:t},s){return{point:t,delta:Cy(t,C1(s)),offset:Cy(t,KR(s)),velocity:YR(s,.1)}}function KR(t){return t[0]}function C1(t){return t[t.length-1]}function YR(t,s){if(t.length<2)return{x:0,y:0};let i=t.length-1,o=null;const c=C1(t);for(;i>=0&&(o=t[i],!(c.timestamp-o.timestamp>Vs(s)));)i--;if(!o)return{x:0,y:0};const u=Hs(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 E1=1e-4,JR=1-E1,WR=1+E1,A1=.01,XR=0-A1,QR=0+A1;function wn(t){return t.max-t.min}function e3(t,s,i){return Math.abs(t-s)<=i}function Ey(t,s,i,o=.5){t.origin=o,t.originPoint=St(s.min,s.max,t.origin),t.scale=wn(i)/wn(s),t.translate=St(i.min,i.max,t.origin)-t.originPoint,(t.scale>=JR&&t.scale<=WR||isNaN(t.scale))&&(t.scale=1),(t.translate>=XR&&t.translate<=QR||isNaN(t.translate))&&(t.translate=0)}function Ar(t,s,i,o){Ey(t.x,s.x,i.x,o?o.originX:void 0),Ey(t.y,s.y,i.y,o?o.originY:void 0)}function Ay(t,s,i){t.min=i.min+s.min,t.max=t.min+wn(s)}function t3(t,s,i){Ay(t.x,s.x,i.x),Ay(t.y,s.y,i.y)}function Dy(t,s,i){t.min=s.min-i.min,t.max=t.min+wn(s)}function Dr(t,s,i){Dy(t.x,s.x,i.x),Dy(t.y,s.y,i.y)}function n3(t,{min:s,max:i},o){return s!==void 0&&t<s?t=o?St(s,t,o.min):Math.max(t,s):i!==void 0&&t>i&&(t=o?St(i,t,o.max):Math.min(t,i)),t}function Ry(t,s,i){return{min:s!==void 0?t.min+s:void 0,max:i!==void 0?t.max+i-(t.max-t.min):void 0}}function s3(t,{top:s,left:i,bottom:o,right:c}){return{x:Ry(t.x,i,c),y:Ry(t.y,s,o)}}function My(t,s){let i=s.min-t.min,o=s.max-t.max;return s.max-s.min<t.max-t.min&&([i,o]=[o,i]),{min:i,max:o}}function a3(t,s){return{x:My(t.x,s.x),y:My(t.y,s.y)}}function i3(t,s){let i=.5;const o=wn(t),c=wn(s);return c>o?i=go(s.min,s.max-o,t.min):o>c&&(i=go(t.min,t.max-c,s.min)),Fs(0,1,i)}function o3(t,s){const i={};return s.min!==void 0&&(i.min=s.min-t.min),s.max!==void 0&&(i.max=s.max-t.min),i}const Dp=.35;function r3(t=Dp){return t===!1?t=0:t===!0&&(t=Dp),{x:Iy(t,"left","right"),y:Iy(t,"top","bottom")}}function Iy(t,s,i){return{min:Oy(t,s),max:Oy(t,i)}}function Oy(t,s){return typeof t=="number"?t:t[s]||0}const By=()=>({translate:0,scale:1,origin:0,originPoint:0}),ro=()=>({x:By(),y:By()}),Ly=()=>({min:0,max:0}),Rt=()=>({x:Ly(),y:Ly()});function Hn(t){return[t("x"),t("y")]}function D1({top:t,left:s,right:i,bottom:o}){return{x:{min:s,max:i},y:{min:t,max:o}}}function l3({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function c3(t,s){if(!s)return t;const i=s({x:t.left,y:t.top}),o=s({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:o.y,right:o.x}}function Jf(t){return t===void 0||t===1}function Rp({scale:t,scaleX:s,scaleY:i}){return!Jf(t)||!Jf(s)||!Jf(i)}function ii(t){return Rp(t)||R1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function R1(t){return zy(t.x)||zy(t.y)}function zy(t){return t&&t!=="0%"}function Fc(t,s,i){const o=t-i,c=s*o;return i+c}function Uy(t,s,i,o,c){return c!==void 0&&(t=Fc(t,c,o)),Fc(t,i,o)+s}function Mp(t,s=0,i=1,o,c){t.min=Uy(t.min,s,i,o,c),t.max=Uy(t.max,s,i,o,c)}function M1(t,{x:s,y:i}){Mp(t.x,s.translate,s.scale,s.originPoint),Mp(t.y,i.translate,i.scale,i.originPoint)}const $y=.999999999999,Py=1.0000000000001;function u3(t,s,i,o=!1){const c=i.length;if(!c)return;s.x=s.y=1;let u,d;for(let p=0;p<c;p++){u=i[p],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&&co(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(s.x*=d.x.scale,s.y*=d.y.scale,M1(t,d)),o&&ii(u.latestValues)&&co(t,u.latestValues))}s.x<Py&&s.x>$y&&(s.x=1),s.y<Py&&s.y>$y&&(s.y=1)}function lo(t,s){t.min=t.min+s,t.max=t.max+s}function Vy(t,s,i,o,c=.5){const u=St(t.min,t.max,c);Mp(t,s,i,u,o)}function co(t,s){Vy(t.x,s.x,s.scaleX,s.scale,s.originX),Vy(t.y,s.y,s.scaleY,s.scale,s.originY)}function I1(t,s){return D1(c3(t.getBoundingClientRect(),s))}function d3(t,s,i){const o=I1(t,i),{scroll:c}=s;return c&&(lo(o.x,c.offset.x),lo(o.y,c.offset.y)),o}const O1=({current:t})=>t?t.ownerDocument.defaultView:null,f3=new WeakMap;class p3{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=Rt(),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(Kr(v).point)},u=(v,b)=>{const{drag:y,dragPropagation:k,onDragStart:S}=this.getProps();if(y&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=GR(y),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Hn(w=>{let j=this.getAxisMotionValue(w).get()||0;if(hs.test(j)){const{projection:C}=this.visualElement;if(C&&C.layout){const D=C.layout.layoutBox[w];D&&(j=wn(D)*(parseFloat(j)/100))}}this.originPoint[w]=j}),S&&vt.postRender(()=>S(v,b)),xp(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},d=(v,b)=>{const{dragPropagation:y,dragDirectionLock:k,onDirectionLock:S,onDrag:N}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:w}=b;if(k&&this.currentDirection===null){this.currentDirection=m3(w),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",b.point,w),this.updateAxis("y",b.point,w),this.visualElement.render(),N&&N(v,b)},p=(v,b)=>this.stop(v,b),h=()=>Hn(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 w1(s,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:p,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:O1(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&&vt.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||!kc(s,c,this.currentDirection))return;const u=this.getAxisMotionValue(s);let d=this.originPoint[s]+o[s];this.constraints&&this.constraints[s]&&(d=n3(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&&io(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=s3(c.layoutBox,i):this.constraints=!1,this.elastic=r3(o),u!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Hn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=o3(c.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!io(s))return!1;const o=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const u=d3(o,c.root,this.visualElement.getTransformPagePoint());let d=a3(c.layout.layoutBox,u);if(i){const p=i(l3(d));this.hasMutatedConstraints=!!p,p&&(d=D1(p))}return d}startAnimation(s){const{drag:i,dragMomentum:o,dragElastic:c,dragTransition:u,dragSnapToOrigin:d,onDragTransitionEnd:p}=this.getProps(),h=this.constraints||{},g=Hn(v=>{if(!kc(v,i,this.currentDirection))return;let b=h&&h[v]||{};d&&(b={min:0,max:0});const y=c?200:1e6,k=c?40:1e7,S={type:"inertia",velocity:o?s[v]:0,bounceStiffness:y,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...u,...b};return this.startAxisValueAnimation(v,S)});return Promise.all(g).then(p)}startAxisValueAnimation(s,i){const o=this.getAxisMotionValue(s);return xp(this.visualElement,s),o.start(Dm(s,o,0,i,this.visualElement,!1))}stopAnimation(){Hn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){Hn(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){Hn(i=>{const{drag:o}=this.getProps();if(!kc(i,o,this.currentDirection))return;const{projection:c}=this.visualElement,u=this.getAxisMotionValue(i);if(c&&c.layout){const{min:d,max:p}=c.layout.layoutBox[i];u.set(s[i]-St(d,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:o}=this.visualElement;if(!io(i)||!o||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Hn(d=>{const p=this.getAxisMotionValue(d);if(p&&this.constraints!==!1){const h=p.get();c[d]=i3({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(),Hn(d=>{if(!kc(d,s,null))return;const p=this.getAxisMotionValue(d),{min:h,max:g}=this.constraints[d];p.set(St(h,g,c[d]))})}addListeners(){if(!this.visualElement.current)return;f3.set(this.visualElement,this);const s=this.visualElement.current,i=Er(s,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(h)}),o=()=>{const{dragConstraints:h}=this.getProps();io(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()),vt.read(o);const d=Pr(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(Hn(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(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:o=!1,dragPropagation:c=!1,dragConstraints:u=!1,dragElastic:d=Dp,dragMomentum:p=!0}=s;return{...s,drag:i,dragDirectionLock:o,dragPropagation:c,dragConstraints:u,dragElastic:d,dragMomentum:p}}}function kc(t,s,i){return(s===!0||s===t)&&(i===null||i===t)}function m3(t,s=10){let i=null;return Math.abs(t.y)>s?i="y":Math.abs(t.x)>s&&(i="x"),i}class h3 extends Ia{constructor(s){super(s),this.removeGroupControls=jn,this.removeListeners=jn,this.controls=new p3(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||jn}unmount(){this.removeGroupControls(),this.removeListeners()}}const Hy=t=>(s,i)=>{t&&vt.postRender(()=>t(s,i))};class g3 extends Ia{constructor(){super(...arguments),this.removePointerDownListener=jn}onPointerDown(s){this.session=new w1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:O1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:Hy(s),onStart:Hy(i),onMove:o,onEnd:(u,d)=>{delete this.session,c&&vt.postRender(()=>c(u,d))}}}mount(){this.removePointerDownListener=Er(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 Oc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function qy(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const br={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ne.test(t))t=parseFloat(t);else return t;const i=qy(t,s.target.x),o=qy(t,s.target.y);return`${i}% ${o}%`}},v3={correct:(t,{treeScale:s,projectionDelta:i})=>{const o=t,c=Ra.parse(t);if(c.length>5)return o;const u=Ra.createTransformer(t),d=typeof c[0]!="number"?1:0,p=i.x.scale*s.x,h=i.y.scale*s.y;c[0+d]/=p,c[1+d]/=h;const g=St(p,h,.5);return typeof c[2+d]=="number"&&(c[2+d]/=g),typeof c[3+d]=="number"&&(c[3+d]/=g),u(c)}};class y3 extends _.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o,layoutId:c}=this.props,{projection:u}=s;qA(b3),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()})),Oc.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()||vt.postRender(()=>{const p=d.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),om.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 B1(t){const[s,i]=__(),o=_.useContext(Qp);return r.jsx(y3,{...t,layoutGroup:o,switchLayoutGroup:_.useContext(C_),isPresent:s,safeToRemove:i})}const b3={borderRadius:{...br,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:br,borderTopRightRadius:br,borderBottomLeftRadius:br,borderBottomRightRadius:br,boxShadow:v3};function _3(t,s,i){const o=nn(t)?t:Ur(t);return o.start(Dm("",o,s,i)),o.animation}function x3(t){return t instanceof SVGElement&&t.tagName!=="svg"}const k3=(t,s)=>t.depth-s.depth;class S3{constructor(){this.children=[],this.isDirty=!1}add(s){vm(this.children,s),this.isDirty=!0}remove(s){ym(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(k3),this.isDirty=!1,this.children.forEach(s)}}function T3(t,s){const i=gs.now(),o=({timestamp:c})=>{const u=c-i;u>=s&&(Da(o),t(u-s))};return vt.read(o,!0),()=>Da(o)}const L1=["TopLeft","TopRight","BottomLeft","BottomRight"],N3=L1.length,Gy=t=>typeof t=="string"?parseFloat(t):t,Fy=t=>typeof t=="number"||Ne.test(t);function j3(t,s,i,o,c,u){c?(t.opacity=St(0,i.opacity!==void 0?i.opacity:1,w3(o)),t.opacityExit=St(s.opacity!==void 0?s.opacity:1,0,C3(o))):u&&(t.opacity=St(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,o));for(let d=0;d<N3;d++){const p=`border${L1[d]}Radius`;let h=Zy(s,p),g=Zy(i,p);if(h===void 0&&g===void 0)continue;h||(h=0),g||(g=0),h===0||g===0||Fy(h)===Fy(g)?(t[p]=Math.max(St(Gy(h),Gy(g),o),0),(hs.test(g)||hs.test(h))&&(t[p]+="%")):t[p]=g}(s.rotate||i.rotate)&&(t.rotate=St(s.rotate||0,i.rotate||0,o))}function Zy(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const w3=z1(0,.5,e1),C3=z1(.5,.95,jn);function z1(t,s,i){return o=>o<t?0:o>s?1:i(go(t,s,o))}function Ky(t,s){t.min=s.min,t.max=s.max}function $n(t,s){Ky(t.x,s.x),Ky(t.y,s.y)}function Yy(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function Jy(t,s,i,o,c){return t-=s,t=Fc(t,1/i,o),c!==void 0&&(t=Fc(t,1/c,o)),t}function E3(t,s=0,i=1,o=.5,c,u=t,d=t){if(hs.test(s)&&(s=parseFloat(s),s=St(d.min,d.max,s/100)-d.min),typeof s!="number")return;let p=St(u.min,u.max,o);t===u&&(p-=s),t.min=Jy(t.min,s,i,p,c),t.max=Jy(t.max,s,i,p,c)}function Wy(t,s,[i,o,c],u,d){E3(t,s[i],s[o],s[c],s.scale,u,d)}const A3=["x","scaleX","originX"],D3=["y","scaleY","originY"];function Xy(t,s,i,o){Wy(t.x,s,A3,i?i.x:void 0,o?o.x:void 0),Wy(t.y,s,D3,i?i.y:void 0,o?o.y:void 0)}function Qy(t){return t.translate===0&&t.scale===1}function U1(t){return Qy(t.x)&&Qy(t.y)}function eb(t,s){return t.min===s.min&&t.max===s.max}function R3(t,s){return eb(t.x,s.x)&&eb(t.y,s.y)}function tb(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function $1(t,s){return tb(t.x,s.x)&&tb(t.y,s.y)}function nb(t){return wn(t.x)/wn(t.y)}function sb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class M3{constructor(){this.members=[]}add(s){vm(this.members,s),s.scheduleRender()}remove(s){if(ym(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 I3(t,s,i){let o="";const c=t.x.translate/s.x,u=t.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:y,skewX:k,skewY:S}=i;g&&(o=`perspective(${g}px) ${o}`),v&&(o+=`rotate(${v}deg) `),b&&(o+=`rotateX(${b}deg) `),y&&(o+=`rotateY(${y}deg) `),k&&(o+=`skewX(${k}deg) `),S&&(o+=`skewY(${S}deg) `)}const p=t.x.scale*s.x,h=t.y.scale*s.y;return(p!==1||h!==1)&&(o+=`scale(${p}, ${h})`),o||"none"}const oi={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Tr=typeof window<"u"&&window.MotionDebug!==void 0,Wf=["","X","Y","Z"],O3={visibility:"hidden"},ab=1e3;let B3=0;function Xf(t,s,i,o){const{latestValues:c}=s;c[t]&&(i[t]=c[t],s.setStaticValue(t,0),o&&(o[t]=0))}function P1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const i=q_(s);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:c,layoutId:u}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",vt,!(c||u))}const{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&P1(o)}function V1({attachResizeListener:t,defaultParent:s,measureScroll:i,checkIsScrollRoot:o,resetTransform:c}){return class{constructor(d={},p=s==null?void 0:s()){this.id=B3++,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,Tr&&(oi.totalNodes=oi.resolvedTargetDeltas=oi.recalculatedProjection=0),this.nodes.forEach(U3),this.nodes.forEach(q3),this.nodes.forEach(G3),this.nodes.forEach($3),Tr&&window.MotionDebug.record(oi)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new S3)}addEventListener(d,p){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new bm),this.eventHandlers.get(d).add(p)}notifyListeners(d,...p){const h=this.eventHandlers.get(d);h&&h.notify(...p)}hasListeners(d){return this.eventHandlers.has(d)}mount(d,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=x3(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),p&&(g||h)&&(this.isLayoutDirty=!0),t){let b;const y=()=>this.root.updateBlockedByResize=!1;t(d,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=T3(y,250),Oc.hasAnimatedSinceResize&&(Oc.hasAnimatedSinceResize=!1,this.nodes.forEach(ob))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&v&&(h||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:y,hasRelativeTargetChanged:k,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||v.getDefaultTransition()||J3,{onLayoutAnimationStart:w,onLayoutAnimationComplete:j}=v.getProps(),C=!this.targetLayout||!$1(this.targetLayout,S)||k,D=!y&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||D||y&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,D);const I={...gm(N,"layout"),onPlay:w,onComplete:j};(v.shouldReduceMotion||this.options.layoutRoot)&&(I.delay=0,I.type=!1),this.startAnimation(I)}else y||ob(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}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,Da(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(F3),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&&P1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const b=this.path[v];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}const{layoutId:p,layout:h}=this.options;if(p===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(ib);return}this.isUpdating||this.nodes.forEach(V3),this.isUpdating=!1,this.nodes.forEach(H3),this.nodes.forEach(L3),this.nodes.forEach(z3),this.clearAllSnapshots();const p=gs.now();Wt.delta=Fs(0,1e3/60,p-Wt.timestamp),Wt.timestamp=p,Wt.isProcessing=!0,Hf.update.process(Wt),Hf.preRender.process(Wt),Hf.render.process(Wt),Wt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,om.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(P3),this.sharedNodes.forEach(Z3)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,vt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){vt.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=Rt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(p=!1),p){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,p=this.projectionDelta&&!U1(this.projectionDelta),h=this.getTransformTemplate(),g=h?h(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;d&&(p||ii(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const p=this.measurePageBox();let h=this.removeElementScroll(p);return d&&(h=this.removeTransform(h)),W3(h),{animationId:this.root.animationId,measuredBox:p,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:p}=this.options;if(!p)return Rt();const h=p.measureViewportBox();if(!(((d=this.scroll)===null||d===void 0?void 0:d.wasRoot)||this.path.some(X3))){const{scroll:v}=this.root;v&&(lo(h.x,v.offset.x),lo(h.y,v.offset.y))}return h}removeElementScroll(d){var p;const h=Rt();if($n(h,d),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return h;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:b,options:y}=v;v!==this.root&&b&&y.layoutScroll&&(b.wasRoot&&$n(h,d),lo(h.x,b.offset.x),lo(h.y,b.offset.y))}return h}applyTransform(d,p=!1){const h=Rt();$n(h,d);for(let g=0;g<this.path.length;g++){const v=this.path[g];!p&&v.options.layoutScroll&&v.scroll&&v!==v.root&&co(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),ii(v.latestValues)&&co(h,v.latestValues)}return ii(this.latestValues)&&co(h,this.latestValues),h}removeTransform(d){const p=Rt();$n(p,d);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!g.instance||!ii(g.latestValues))continue;Rp(g.latestValues)&&g.updateSnapshot();const v=Rt(),b=g.measurePageBox();$n(v,b),Xy(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return ii(this.latestValues)&&Xy(p,this.latestValues),p}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!==Wt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!1){var p;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||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:y}=this.options;if(!(!this.layout||!(b||y))){if(this.resolvedRelativeTargetAt=Wt.timestamp,!this.targetDelta&&!this.relativeTarget){const k=this.getClosestProjectingParent();k&&k.layout&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Rt(),this.relativeTargetOrigin=Rt(),Dr(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),$n(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Rt(),this.targetWithTransforms=Rt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),t3(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):$n(this.target,this.layout.layoutBox),M1(this.target,this.targetDelta)):$n(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const k=this.getClosestProjectingParent();k&&!!k.resumingFrom==!!this.resumingFrom&&!k.options.layoutScroll&&k.target&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Rt(),this.relativeTargetOrigin=Rt(),Dr(this.relativeTargetOrigin,this.target,k.target),$n(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Tr&&oi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Rp(this.parent.latestValues)||R1(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 p=this.getLead(),h=!!this.resumingFrom||this!==p;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===Wt.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;$n(this.layoutCorrected,this.layout.layoutBox);const y=this.treeScale.x,k=this.treeScale.y;u3(this.layoutCorrected,this.treeScale,this.path,h),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=Rt());const{target:S}=p;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Yy(this.prevProjectionDelta.x,this.projectionDelta.x),Yy(this.prevProjectionDelta.y,this.projectionDelta.y)),Ar(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==y||this.treeScale.y!==k||!sb(this.projectionDelta.x,this.prevProjectionDelta.x)||!sb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Tr&&oi.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){var p;if((p=this.options.visualElement)===null||p===void 0||p.scheduleRender(),d){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ro(),this.projectionDelta=ro(),this.projectionDeltaWithTransform=ro()}setAnimationOrigin(d,p=!1){const h=this.snapshot,g=h?h.latestValues:{},v={...this.latestValues},b=ro();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const y=Rt(),k=h?h.source:void 0,S=this.layout?this.layout.source:void 0,N=k!==S,w=this.getStack(),j=!w||w.members.length<=1,C=!!(N&&!j&&this.options.crossfade===!0&&!this.path.some(Y3));this.animationProgress=0;let D;this.mixTargetDelta=I=>{const R=I/1e3;rb(b.x,d.x,R),rb(b.y,d.y,R),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Dr(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),K3(this.relativeTarget,this.relativeTargetOrigin,y,R),D&&R3(this.relativeTarget,D)&&(this.isProjectionDirty=!1),D||(D=Rt()),$n(D,this.relativeTarget)),N&&(this.animationValues=v,j3(v,g,this.latestValues,R,C,j)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},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&&(Da(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=vt.update(()=>{Oc.hasAnimatedSinceResize=!0,this.currentAnimation=_3(0,ab,{...d,onUpdate:p=>{this.mixTargetDelta(p),d.onUpdate&&d.onUpdate(p)},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(ab),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:p,target:h,layout:g,latestValues:v}=d;if(!(!p||!h||!g)){if(this!==d&&this.layout&&g&&H1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){h=this.target||Rt();const b=wn(this.layout.layoutBox.x);h.x.min=d.target.x.min,h.x.max=h.x.min+b;const y=wn(this.layout.layoutBox.y);h.y.min=d.target.y.min,h.y.max=h.y.min+y}$n(p,h),co(p,v),Ar(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(d,p){this.sharedNodes.has(d)||this.sharedNodes.set(d,new M3),this.sharedNodes.get(d).add(p);const g=p.options.initialPromotionConfig;p.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(p):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){var d;const{layoutId:p}=this.options;return p?((d=this.getStack())===null||d===void 0?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:p}=this.options;return p?(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:p,preserveFollowOpacity:h}={}){const g=this.getStack();g&&g.promote(this,h),d&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let p=!1;const{latestValues:h}=d;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(p=!0),!p)return;const g={};h.z&&Xf("z",d,g,this.animationValues);for(let v=0;v<Wf.length;v++)Xf(`rotate${Wf[v]}`,d,g,this.animationValues),Xf(`skew${Wf[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 p,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return O3;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&&!ii(this.latestValues)&&(N.transform=v?v({},""):"none",this.hasProjected=!1),N}const y=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=I3(this.projectionDeltaWithTransform,this.treeScale,y),v&&(g.transform=v(y,g.transform));const{x:k,y:S}=this.projectionDelta;g.transformOrigin=`${k.origin*100}% ${S.origin*100}% 0`,b.animationValues?g.opacity=b===this?(h=(p=y.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:g.opacity=b===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const N in Pc){if(y[N]===void 0)continue;const{correct:w,applyTo:j}=Pc[N],C=g.transform==="none"?y[N]:w(y[N],b);if(j){const D=j.length;for(let I=0;I<D;I++)g[j[I]]=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 p;return(p=d.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(ib),this.root.sharedNodes.clear()}}}function L3(t){t.updateLayout()}function z3(t){var s;const i=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&i&&t.hasListeners("didUpdate")){const{layoutBox:o,measuredBox:c}=t.layout,{animationType:u}=t.options,d=i.source!==t.layout.source;u==="size"?Hn(b=>{const y=d?i.measuredBox[b]:i.layoutBox[b],k=wn(y);y.min=o[b].min,y.max=y.min+k}):H1(u,i.layoutBox,o)&&Hn(b=>{const y=d?i.measuredBox[b]:i.layoutBox[b],k=wn(o[b]);y.max=y.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+k)});const p=ro();Ar(p,o,i.layoutBox);const h=ro();d?Ar(h,t.applyTransform(c,!0),i.measuredBox):Ar(h,o,i.layoutBox);const g=!U1(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:y,layout:k}=b;if(y&&k){const S=Rt();Dr(S,i.layoutBox,y.layoutBox);const N=Rt();Dr(N,o,k.layoutBox),$1(S,N)||(v=!0),b.options.layoutRoot&&(t.relativeTarget=N,t.relativeTargetOrigin=S,t.relativeParent=b)}}}t.notifyListeners("didUpdate",{layout:o,snapshot:i,delta:h,layoutDelta:p,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:o}=t.options;o&&o()}t.options.transition=void 0}function U3(t){Tr&&oi.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function $3(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function P3(t){t.clearSnapshot()}function ib(t){t.clearMeasurements()}function V3(t){t.isLayoutDirty=!1}function H3(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function ob(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function q3(t){t.resolveTargetDelta()}function G3(t){t.calcProjection()}function F3(t){t.resetSkewAndRotation()}function Z3(t){t.removeLeadSnapshot()}function rb(t,s,i){t.translate=St(s.translate,0,i),t.scale=St(s.scale,1,i),t.origin=s.origin,t.originPoint=s.originPoint}function lb(t,s,i,o){t.min=St(s.min,i.min,o),t.max=St(s.max,i.max,o)}function K3(t,s,i,o){lb(t.x,s.x,i.x,o),lb(t.y,s.y,i.y,o)}function Y3(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const J3={duration:.45,ease:[.4,0,.1,1]},cb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),ub=cb("applewebkit/")&&!cb("chrome/")?Math.round:jn;function db(t){t.min=ub(t.min),t.max=ub(t.max)}function W3(t){db(t.x),db(t.y)}function H1(t,s,i){return t==="position"||t==="preserve-aspect"&&!e3(nb(s),nb(i),.2)}function X3(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const Q3=V1({attachResizeListener:(t,s)=>Pr(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Qf={current:void 0},q1=V1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Qf.current){const t=new Q3({});t.mount(window),t.setOptions({layoutScroll:!0}),Qf.current=t}return Qf.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),eM={pan:{Feature:g3},drag:{Feature:h3,ProjectionNode:q1,MeasureLayout:B1}};function tM(t,s,i){var o;if(t instanceof Element)return[t];if(typeof t=="string"){let c=document;const u=(o=void 0)!==null&&o!==void 0?o:c.querySelectorAll(t);return u?Array.from(u):[]}return Array.from(t)}function G1(t,s){const i=tM(t),o=new AbortController,c={passive:!0,...s,signal:o.signal};return[i,c,()=>o.abort()]}function fb(t){return s=>{s.pointerType==="touch"||j1()||t(s)}}function nM(t,s,i={}){const[o,c,u]=G1(t,i),d=fb(p=>{const{target:h}=p,g=s(p);if(typeof g!="function"||!h)return;const v=fb(b=>{g(b),h.removeEventListener("pointerleave",v)});h.addEventListener("pointerleave",v,c)});return o.forEach(p=>{p.addEventListener("pointerenter",d,c)}),u}function pb(t,s,i){const{props:o}=t;t.animationState&&o.whileHover&&t.animationState.setActive("whileHover",i==="Start");const c="onHover"+i,u=o[c];u&&vt.postRender(()=>u(s,Kr(s)))}class sM extends Ia{mount(){const{current:s}=this.node;s&&(this.unmount=nM(s,i=>(pb(this.node,i,"Start"),o=>pb(this.node,o,"End"))))}unmount(){}}class aM extends Ia{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=Zr(Pr(this.node.current,"focus",()=>this.onFocus()),Pr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const F1=(t,s)=>s?t===s?!0:F1(t,s.parentElement):!1,iM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function oM(t){return iM.has(t.tagName)||t.tabIndex!==-1}const Nr=new WeakSet;function mb(t){return s=>{s.key==="Enter"&&t(s)}}function ep(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const rM=(t,s)=>{const i=t.currentTarget;if(!i)return;const o=mb(()=>{if(Nr.has(i))return;ep(i,"down");const c=mb(()=>{ep(i,"up")}),u=()=>ep(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 hb(t){return Rm(t)&&!j1()}function lM(t,s,i={}){const[o,c,u]=G1(t,i),d=p=>{const h=p.currentTarget;if(!hb(p)||Nr.has(h))return;Nr.add(h);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",y),!(!hb(k)||!Nr.has(h))&&(Nr.delete(h),typeof g=="function"&&g(k,{success:S}))},b=k=>{v(k,i.useGlobalTarget||F1(h,k.target))},y=k=>{v(k,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",y,c)};return o.forEach(p=>{!oM(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(i.useGlobalTarget?window:p).addEventListener("pointerdown",d,c),p.addEventListener("focus",g=>rM(g,c),c)}),u}function gb(t,s,i){const{props:o}=t;t.animationState&&o.whileTap&&t.animationState.setActive("whileTap",i==="Start");const c="onTap"+(i==="End"?"":i),u=o[c];u&&vt.postRender(()=>u(s,Kr(s)))}class cM extends Ia{mount(){const{current:s}=this.node;s&&(this.unmount=lM(s,i=>(gb(this.node,i,"Start"),(o,{success:c})=>gb(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Ip=new WeakMap,tp=new WeakMap,uM=t=>{const s=Ip.get(t.target);s&&s(t)},dM=t=>{t.forEach(uM)};function fM({root:t,...s}){const i=t||document;tp.has(i)||tp.set(i,{});const o=tp.get(i),c=JSON.stringify(s);return o[c]||(o[c]=new IntersectionObserver(dM,{root:t,...s})),o[c]}function pM(t,s,i){const o=fM(s);return Ip.set(t,i),o.observe(t),()=>{Ip.delete(t),o.unobserve(t)}}const mM={some:0,all:1};class hM extends Ia{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:mM[c]},p=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(),y=g?v:b;y&&y(h)};return pM(this.node.current,d,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:i}=this.node;["amount","margin","root"].some(gM(s,i))&&this.startObserver()}unmount(){}}function gM({viewport:t={}},{viewport:s={}}={}){return i=>t[i]!==s[i]}const vM={inView:{Feature:hM},tap:{Feature:cM},focus:{Feature:aM},hover:{Feature:sM}},yM={layout:{ProjectionNode:q1,MeasureLayout:B1}},Zc={current:null},Mm={current:!1};function Z1(){if(Mm.current=!0,!!nm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>Zc.current=t.matches;t.addListener(s),s()}else Zc.current=!1}const bM=[...m1,tn,Ra],_M=t=>bM.find(p1(t)),vb=new WeakMap;function xM(t,s,i){for(const o in s){const c=s[o],u=i[o];if(nn(c))t.addValue(o,c);else if(nn(u))t.addValue(o,Ur(c,{owner:t}));else if(u!==c)if(t.hasValue(o)){const d=t.getValue(o);d.liveStyle===!0?d.jump(c):d.hasAnimated||d.set(c)}else{const d=t.getStaticValue(o);t.addValue(o,Ur(d!==void 0?d:c,{owner:t}))}}for(const o in i)s[o]===void 0&&t.removeValue(o);return s}const yb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class kM{scrapeMotionValuesFromProps(s,i,o){return{}}constructor({parent:s,props:i,presenceContext:o,reducedMotionConfig:c,blockInitialAnimation:u,visualState:d},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Cm,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 k=gs.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,vt.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=p,this.blockInitialAnimation=!!u,this.isControllingVariants=lu(i),this.isVariantNode=j_(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,...y}=this.scrapeMotionValuesFromProps(i,{},this);for(const k in y){const S=y[k];h[k]!==void 0&&nn(S)&&S.set(h[k],!1)}}mount(s){this.current=s,vb.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)),Mm.current||Z1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Zc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){vb.delete(this.current),this.projection&&this.projection.unmount(),Da(this.notifyUpdate),Da(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=vi.has(s),c=i.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&vt.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 ho){const i=ho[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):Rt()}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<yb.length;o++){const c=yb[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=xM(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=Ur(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"&&(d1(c)||n1(c))?c=parseFloat(c):!_M(c)&&Ra.test(i)&&(c=l1(s,i)),this.setBaseTarget(s,nn(c)?c.get():c)),nn(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=lm(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&&!nn(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 bm),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class K1 extends kM{constructor(){super(...arguments),this.KeyframeResolver=h1}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;nn(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function SM(t){return window.getComputedStyle(t)}class TM extends K1{constructor(){super(...arguments),this.type="html",this.renderInstance=O_}readValueFromInstance(s,i){if(vi.has(i)){const o=wm(i);return o&&o.default||0}else{const o=SM(s),c=(R_(i)?o.getPropertyValue(i):o[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return I1(s,i)}build(s,i,o){dm(s,i,o.transformTemplate)}scrapeMotionValuesFromProps(s,i,o){return hm(s,i,o)}}class NM extends K1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Rt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(vi.has(i)){const o=wm(i);return o&&o.default||0}return i=B_.has(i)?i:im(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,o){return U_(s,i,o)}build(s,i,o){fm(s,i,this.isSVGTag,o.transformTemplate)}renderInstance(s,i,o,c){L_(s,i,o,c)}mount(s){this.isSVGTag=mm(s.tagName),super.mount(s)}}const jM=(t,s)=>rm(t)?new NM(s):new TM(s,{allowProjection:t!==_.Fragment}),wM=QA({...qR,...vM,...eM,...yM},jM),It=mA(wM);function CM(){!Mm.current&&Z1();const[t]=_.useState(Zc.current);return t}const EM="_overlay_cmicx_1",AM="_dialog_cmicx_11",DM="_title_cmicx_30",RM="_description_cmicx_38",MM="_actions_cmicx_45",IM="_cancelButton_cmicx_52",OM="_confirmButton_cmicx_79",ni={overlay:EM,dialog:AM,title:DM,description:RM,actions:MM,cancelButton:IM,confirmButton:OM};function pi({isOpen:t,title:s,description:i,confirmLabel:o="Delete",onConfirm:c,onCancel:u}){const d=_.useId(),p=_.useId();return r.jsx(vs,{children:t&&r.jsx(It.div,{className:ni.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?p:void 0,children:r.jsxs(It.div,{className:ni.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:[r.jsx("h3",{id:d,className:ni.title,children:s}),i&&r.jsx("p",{id:p,className:ni.description,children:i}),r.jsxs("div",{className:ni.actions,children:[r.jsx("button",{type:"button",className:ni.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),r.jsx("button",{type:"button",className:ni.confirmButton,onClick:c,children:o})]})]})})})}const BM="_spinner_1uyt1_1",LM="_spin_1uyt1_1",zM="_sm_1uyt1_14",UM="_md_1uyt1_20",$M="_lg_1uyt1_26",PM="_xl_1uyt1_32",bb={spinner:BM,spin:LM,sm:zM,md:UM,lg:$M,xl:PM};function Y1({size:t="md",className:s,label:i="Loading",liveRegion:o=!1}){return r.jsx("span",{className:`${bb.spinner} ${bb[t]} ${s??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const VM="_splash_1bn1g_1",HM="_logo_1bn1g_11",_b={splash:VM,logo:HM};function J1(){return r.jsxs("div",{className:_b.splash,"data-testid":"splash-screen",children:[r.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:_b.logo}),r.jsx(Y1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const W1=50;function qM(t,s,i,o,c=W1){return o?t<c:s-t-i<c}function GM(t,s){const i=s-t;return i>0?i:0}function FM({scrollRef:t,contentLength:s,isReversed:i}){const[o,c]=_.useState(!0),u=_.useRef(0),d=_.useRef(!1),p=_.useRef(0);_.useEffect(()=>{const g=t.current;if(!g)return;let v=!0;const b=()=>{p.current||(p.current=requestAnimationFrame(()=>{p.current=0;const y=qM(g.scrollTop,g.scrollHeight,g.clientHeight,i,W1);y!==v&&(v=y,c(y))}))};return g.addEventListener("scroll",b,{passive:!0}),()=>{g.removeEventListener("scroll",b),p.current&&(cancelAnimationFrame(p.current),p.current=0)}},[t,i]),_.useLayoutEffect(()=>{const g=t.current;!g||d.current||(d.current=!0,i?g.scrollTop=0:g.scrollTop=g.scrollHeight,c(!0))},[t,i]),_.useLayoutEffect(()=>{const g=t.current;if(g){if(i&&!o){const v=GM(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,t]);const h=_.useCallback(()=>{const g=t.current;if(!g)return;const v=i?0:g.scrollHeight;g.scrollTo({top:v,behavior:"smooth"}),c(!0)},[t,i]);return{isAtAnchor:o,scrollToAnchor:h}}const ZM="_wrapper_1rtuy_1",KM="_scrollContainer_1rtuy_9",YM="_toolbar_1rtuy_15",JM="_directionToggle_1rtuy_22",WM="_scrollToAnchor_1rtuy_60",XM="_scrollToAnchorBottom_1rtuy_84",QM="_scrollToAnchorTop_1rtuy_88",e6="_eventOverflowWarning_1rtuy_92",Ca={wrapper:ZM,scrollContainer:KM,toolbar:YM,directionToggle:JM,scrollToAnchor:WM,scrollToAnchorBottom:XM,scrollToAnchorTop:QM,eventOverflowWarning:e6},X1="grackle-stream-direction";function t6(){try{return localStorage.getItem(X1)==="reversed"}catch{return!1}}function n6({eventsDropped:t}){return t<=0?r.jsx(r.Fragment,{}):r.jsxs("div",{className:Ca.eventOverflowWarning,role:"alert",children:[r.jsx(Vp,{size:Gt,"aria-hidden":"true"})," ",t.toLocaleString()," older event",t===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function Im({events:t,eventsDropped:s,emptyState:i}){const o=_.useRef(null),[c,u]=_.useState(t6),d=CM(),p=_.useMemo(()=>c?[...t].reverse():t,[t,c]),{isAtAnchor:h,scrollToAnchor:g}=FM({scrollRef:o,contentLength:t.length,isReversed:c}),v=()=>{const k=!c;u(k);try{localStorage.setItem(X1,k?"reversed":"default")}catch{}},b=d?0:.2,y=c?-8:8;return r.jsxs("div",{className:Ca.wrapper,children:[r.jsx("div",{className:Ca.toolbar,children:r.jsx("button",{className:Ca.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?r.jsx(Vv,{size:Gt,"aria-hidden":"true"}):r.jsx(Hv,{size:Gt,"aria-hidden":"true"})})}),r.jsxs("div",{ref:o,className:Ca.scrollContainer,"data-testid":"event-stream-scroll",children:[t.length===0&&i,r.jsx(n6,{eventsDropped:s}),r.jsx(vs,{initial:!1,children:p.map((k,S)=>{const N=c?t.length-1-S:S;return r.jsx(It.div,{initial:{opacity:0,y},animate:{opacity:1,y:0},transition:{duration:b,ease:"easeOut"},children:r.jsx(nA,{event:k,toolUseCtx:k.toolUseCtx,settled:k.settled})},`${k.sessionId}-${k.timestamp}-${N}`)})})]}),r.jsx(vs,{children:!h&&r.jsxs(It.button,{className:`${Ca.scrollToAnchor} ${c?Ca.scrollToAnchorTop:Ca.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?r.jsx(Hv,{size:Gt,"aria-hidden":"true"}):r.jsx(Vv,{size:Gt,"aria-hidden":"true"})," New events"]})})]})}function Om(t){const{value:s,onSave:i,validate:o,fieldId:c,activeFieldId:u,onActivate:d,enterToSave:p=!0,trimOnSave:h=!0}=t,[g,v]=_.useState(""),[b,y]=_.useState(""),k=_.useRef(!1),S=u===c,N=_.useCallback(q=>{v(q),y("")},[]),w=_.useCallback(()=>{y("")},[]),j=_.useCallback(()=>{k.current=!1,d==null||d(null),v(""),y("")},[d]),C=_.useCallback(()=>{const q=h?g.trim():g;if(o){const Y=o(g);if(Y){y(Y);return}}const $=h?s.trim():s;if(q===$){j();return}i(q),j()},[g,s,h,o,i,j]),D=_.useCallback(()=>{k.current=!0,d==null||d(c),v(s),y("")},[c,s,d]),I=_.useCallback(q=>{if(k.current){k.current=!1;return}q.relatedTarget instanceof HTMLElement&&q.relatedTarget.dataset.editAction===c||C()},[c,C]),R=_.useCallback(q=>{q.key==="Escape"?j():q.key==="Enter"&&p&&C()},[j,p,C]),E=(()=>{if(!S)return!1;const q=h?s.trim():s;return(h?g.trim():g)!==q})();return _.useEffect(()=>{!S&&(g!==""||b!=="")&&(v(""),y(""))},[S,g,b]),{isEditing:S,draft:g,error:b,isDirty:E,startEdit:D,cancelEdit:j,save:C,setDraft:N,clearError:w,handleBlur:I,handleKeyDown:R,ignoreInitialBlurRef:k}}const s6="_editFieldWrapper_yuzty_1",a6="_editInput_yuzty_10",i6="_editTextarea_yuzty_42",o6="_editSelect_yuzty_78",r6="_editError_yuzty_111",l6="_editInputInvalid_yuzty_118",c6="_editHint_yuzty_123",u6="_unsavedDot_yuzty_132",d6="_metaValueClickable_yuzty_140",f6="_editButton_yuzty_159",p6="_metaPlaceholder_yuzty_175",m6="_worktreeToggle_yuzty_180",Je={editFieldWrapper:s6,editInput:a6,editTextarea:i6,editSelect:o6,editError:r6,editInputInvalid:l6,editHint:c6,unsavedDot:u6,metaValueClickable:d6,editButton:f6,metaPlaceholder:p6,worktreeToggle:m6};function Xt(t){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="text",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:y,"data-testid":k}=t,S=_.useRef(null),N=Om({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!0,trimOnSave:!0});if(_.useEffect(()=>{if(N.isEditing){const j=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(j)}},[N.isEditing]),c==="create"){const j=D=>{h==null||h(D.target.value)},C=o==null?void 0:o(s);return r.jsxs("div",{className:Je.editFieldWrapper,children:[r.jsx("input",{className:`${Je.editInput} ${C?Je.editInputInvalid:""}`,value:s,onChange:j,maxLength:b,placeholder:v,"aria-label":y,"data-testid":k?`${k}-input`:void 0}),C&&r.jsx("span",{className:Je.editError,"data-testid":"edit-error",children:C})]})}if(N.isEditing)return r.jsxs("div",{className:Je.editFieldWrapper,children:[r.jsx("input",{ref:S,className:`${Je.editInput} ${N.error?Je.editInputInvalid:""}`,value:N.draft,onChange:j=>N.setDraft(j.target.value),onBlur:N.handleBlur,onKeyDown:N.handleKeyDown,maxLength:b,placeholder:v,"aria-label":y,"data-testid":k?`${k}-input`:void 0}),N.isDirty&&r.jsx("span",{className:Je.unsavedDot,title:"Unsaved changes"}),N.error&&r.jsx("span",{className:Je.editError,"data-testid":"edit-error",children:N.error}),r.jsx("span",{className:Je.editHint,children:"Enter to save · Esc to cancel"})]});const w=g==null?void 0:g(s);return r.jsxs("span",{role:"button",tabIndex:0,className:Je.metaValueClickable,onClick:()=>N.startEdit(),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),N.startEdit())},title:"Click to edit","aria-label":y,"data-testid":k?`${k}-button`:void 0,children:[w!==void 0?w:s?r.jsx("span",{children:s}):r.jsx("span",{className:Je.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:Je.editButton,"aria-hidden":"true",children:"✏️"})]})}function Op(t){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="textarea",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":y}=t,k=_.useRef(null),S=Om({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!1,trimOnSave:!1});if(_.useEffect(()=>{if(S.isEditing){const w=window.setTimeout(()=>{var j;(j=k.current)==null||j.focus()},0);return()=>window.clearTimeout(w)}},[S.isEditing]),c==="create"){const w=C=>{h==null||h(C.target.value)},j=o==null?void 0:o(s);return r.jsxs("div",{className:Je.editFieldWrapper,children:[r.jsx("textarea",{className:`${Je.editTextarea} ${j?Je.editInputInvalid:""}`,value:s,onChange:w,placeholder:v,"aria-label":b,"data-testid":y?`${y}-input`:void 0}),j&&r.jsx("span",{className:Je.editError,"data-testid":"edit-error",children:j})]})}if(S.isEditing)return r.jsxs("div",{className:Je.editFieldWrapper,children:[r.jsx("textarea",{ref:k,className:`${Je.editTextarea} ${S.error?Je.editInputInvalid:""}`,value:S.draft,onChange:w=>S.setDraft(w.target.value),onBlur:S.handleBlur,onKeyDown:S.handleKeyDown,title:b,"aria-label":b,"data-testid":y?`${y}-input`:void 0}),S.isDirty&&r.jsx("span",{className:Je.unsavedDot,title:"Unsaved changes"}),S.error&&r.jsx("span",{className:Je.editError,"data-testid":"edit-error",children:S.error}),r.jsx("span",{className:Je.editHint,children:"Tab to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return r.jsxs("span",{role:"button",tabIndex:0,className:Je.metaValueClickable,onClick:()=>S.startEdit(),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),S.startEdit())},title:"Click to edit","aria-label":b,"data-testid":y?`${y}-button`:void 0,children:[N!==void 0?N:s?r.jsx("span",{children:s}):r.jsx("span",{className:Je.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:Je.editButton,"aria-hidden":"true",children:"✏️"})]})}function Kc(t){var D;const{value:s,onSave:i,mode:o="edit",options:c,fieldId:u="select",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":y}=t,k=_.useRef(null),S=Om({value:s,onSave:i,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!1,trimOnSave:!1});_.useEffect(()=>{if(S.isEditing){const I=window.setTimeout(()=>{var R;(R=k.current)==null||R.focus()},0);return()=>window.clearTimeout(I)}},[S.isEditing]);const N=_.useCallback(I=>{const R=I.target.value;S.ignoreInitialBlurRef.current=!1,R!==s&&i(R),S.cancelEdit()},[s,i,S]),w=_.useCallback(I=>{if(S.ignoreInitialBlurRef.current){S.ignoreInitialBlurRef.current=!1;return}I.relatedTarget instanceof HTMLElement&&I.relatedTarget.dataset.editAction===u||S.cancelEdit()},[u,S]);if(o==="create")return r.jsx("select",{className:Je.editSelect,value:s,onChange:I=>h==null?void 0:h(I.target.value),"aria-label":b,"data-testid":y?`${y}-select`:void 0,children:c.map(I=>r.jsx("option",{value:I.value,children:I.label},I.value))});if(S.isEditing)return r.jsx("select",{ref:k,className:Je.editSelect,value:S.draft,onChange:N,onBlur:w,title:b,"aria-label":b,"data-testid":y?`${y}-select`:void 0,children:c.map(I=>r.jsx("option",{value:I.value,children:I.label},I.value))});const j=g==null?void 0:g(s),C=(D=c.find(I=>I.value===s))==null?void 0:D.label;return r.jsxs("button",{type:"button",className:Je.metaValueClickable,onClick:()=>S.startEdit(),title:"Click to change","aria-label":b,"data-testid":y?`${y}-button`:void 0,children:[j!==void 0?j:C?r.jsx("span",{children:C}):r.jsx("span",{className:Je.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:Je.editButton,"aria-hidden":"true",children:"✏️"})]})}function h6(t){const{checked:s,onChange:i,label:o,ariaLabel:c,"data-testid":u}=t;return r.jsxs("label",{className:Je.worktreeToggle,"data-testid":u,children:[r.jsx("input",{type:"checkbox",checked:s,onChange:d=>i(d.target.checked),"aria-label":c}),r.jsx("span",{children:o})]})}const g6="_envRow_1e1r5_1",v6="_envDot_1e1r5_7",y6="_envDotGreen_1e1r5_14",b6="_envDotYellow_1e1r5_18",_6="_envDotRed_1e1r5_22",x6="_envDotGray_1e1r5_26",uo={envRow:g6,envDot:v6,envDotGreen:y6,envDotYellow:b6,envDotRed:_6,envDotGray:x6};function k6(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?uo.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?uo.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?uo.envDotRed:uo.envDotGray}function S6(t){const{value:s,onSave:i,environments:o,allowNone:c=!1,fieldId:u="environment",activeFieldId:d,onActivate:p,placeholder:h="No environment",ariaLabel:g="Environment","data-testid":v}=t,b=o.find(S=>S.id===s),y=[...c?[{value:"",label:"None"}]:[],...o.map(S=>({value:S.id,label:S.displayName}))],k=()=>{if(b)return r.jsxs("span",{className:uo.envRow,children:[r.jsx("span",{className:`${uo.envDot} ${k6(b.status)}`}),b.displayName]})};return r.jsx(Kc,{value:s,onSave:i,options:y,fieldId:u,activeFieldId:d,onActivate:p,renderDisplay:k,placeholder:h,ariaLabel:g,"data-testid":v})}const T6="_nav_1snmp_1",N6="_searchForm_1snmp_8",j6="_searchInput_1snmp_15",w6="_searchButton_1snmp_33",C6="_clearButton_1snmp_68",E6="_workspaceSelect_1snmp_85",A6="_listHeader_1snmp_99",D6="_nodeList_1snmp_108",R6="_nodeItem_1snmp_116",M6="_indicator_1snmp_129",I6="_label_1snmp_136",O6="_badge_1snmp_145",Pn={nav:T6,searchForm:N6,searchInput:j6,searchButton:w6,clearButton:C6,workspaceSelect:E6,listHeader:A6,nodeList:D6,nodeItem:R6,indicator:M6,label:I6,badge:O6};function B6({nodes:t,workspaces:s,loading:i,searchQuery:o,onSearch:c,onClearSearch:u,onSelectNode:d,onWorkspaceChange:p}){const[h,g]=_.useState(""),v=_.useCallback(S=>{S.preventDefault(),h.trim()&&c(h.trim())},[h,c]),b=_.useCallback(()=>{g(""),u()},[u]),y=_.useCallback(S=>{d(S)},[d]),k=_.useCallback(S=>{g(""),p(S)},[p]);return r.jsxs("div",{className:Pn.nav,"data-testid":"knowledge-nav",children:[r.jsxs("form",{className:Pn.searchForm,onSubmit:v,children:[r.jsx("input",{className:Pn.searchInput,type:"text",placeholder:"Search...",value:h,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input"}),r.jsx("button",{type:"submit",className:Pn.searchButton,disabled:i,children:"Go"})]}),o&&r.jsx("button",{type:"button",className:Pn.clearButton,onClick:b,children:"Clear search"}),r.jsxs("select",{className:Pn.workspaceSelect,onChange:S=>{k(S.target.value)},"data-testid":"knowledge-workspace-filter",children:[r.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>r.jsx("option",{value:S.id,children:S.name},S.id))]}),r.jsxs("div",{className:Pn.listHeader,children:["Nodes (",t.length,")"]}),r.jsx("ul",{className:Pn.nodeList,children:t.map(S=>r.jsxs("li",{className:Pn.nodeItem,onClick:()=>{y(S.id)},onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),y(S.id))},role:"button",tabIndex:0,children:[r.jsx("span",{className:Pn.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),r.jsx("span",{className:Pn.label,children:S.label}),r.jsx("span",{className:Pn.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const L6="_container_1mq5u_1",z6="_hamburger_1mq5u_33",U6="_brand_1mq5u_49",$6="_brandLogo_1mq5u_68",P6="_info_1mq5u_75",V6="_connectionLabel_1mq5u_90",H6="_connectionDot_1mq5u_103",q6="_connected_1mq5u_106",G6="_disconnected_1mq5u_110",Us={container:L6,hamburger:z6,brand:U6,brandLogo:$6,info:P6,connectionLabel:V6,connectionDot:H6,connected:q6,disconnected:G6};function F6({connected:t,environments:s,sessions:i,onToggleSidebar:o,sidebarOpen:c}){const u=yt(),d=s.length,p=s.filter(g=>g.status==="connected").length,h=i.filter(g=>["running","idle"].includes(g.status)).length;return r.jsxs("div",{className:Us.container,children:[o&&r.jsx("button",{type:"button",className:Us.hamburger,onClick:o,"aria-label":"Toggle sidebar","aria-expanded":c,children:r.jsx(m2,{size:Mt,"aria-hidden":"true"})}),r.jsxs("button",{type:"button",className:Us.brand,onClick:()=>u(fi),title:"Home",children:[r.jsx("img",{src:"/icon-192x192.png",alt:"",className:Us.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]}),r.jsxs("div",{className:Us.info,children:[r.jsxs("span",{"aria-label":t?"Connected":"Disconnected",children:[r.jsx("span",{className:`${Us.connectionDot} ${t?Us.connected:Us.disconnected}`,"aria-hidden":"true",children:r.jsx(Ea,{size:Hp,fill:"currentColor"})})," ",r.jsx("span",{className:Us.connectionLabel,"aria-hidden":"true",children:t?"Connected":"Disconnected"})]}),r.jsxs("span",{children:[p,"/",d," env",d!==1?"s":""]}),r.jsxs("span",{children:[h," active"]})]})]})}const Z6="_nav_13gkc_1",K6="_tab_13gkc_35",Y6="_tabIcon_13gkc_68",J6="_tabLabel_13gkc_79",W6="_tabActive_13gkc_84",_r={nav:Z6,tab:K6,tabIcon:Y6,tabLabel:J6,tabActive:W6},si=[{view:"dashboard",label:"Dashboard",icon:r.jsx(t2,{size:Mt}),route:fi,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:r.jsx(g2,{size:Mt}),route:Bj,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:r.jsx(HT,{size:Mt}),route:Lj,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:r.jsx(y2,{size:Mt}),route:po,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:r.jsx(LT,{size:Mt}),route:v_,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:r.jsx(Yb,{size:Mt}),route:au,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:r.jsx(w2,{size:Mt}),route:Rj,testId:"sidebar-tab-settings"}];function X6(t){return t===fi||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(v_)?"knowledge":t.startsWith(au)?"findings":t.startsWith(fo)?"settings":"tasks"}function Q6(){const t=Pt(),s=yt(),i=_.useRef(null),o=X6(t.pathname),c=_.useCallback(d=>{s(d.route)},[s]),u=_.useCallback(d=>{var b,y;const p=(b=i.current)==null?void 0:b.querySelectorAll('[role="tab"]');if(!p)return;const h=Array.from(p).findIndex(k=>k===document.activeElement),g=h>=0?h:si.findIndex(k=>k.view===o);let v=g;if(d.key==="ArrowRight"||d.key==="j"||d.key==="J")d.preventDefault(),v=(g+1)%si.length;else if(d.key==="ArrowLeft"||d.key==="k"||d.key==="K")d.preventDefault(),v=(g-1+si.length)%si.length;else if(d.key==="Home")d.preventDefault(),v=0;else if(d.key==="End")d.preventDefault(),v=si.length-1;else return;s(si[v].route),(y=p[v])==null||y.focus()},[o,s]);return r.jsx("nav",{className:_r.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:u,"data-testid":"sidebar-nav",children:si.map(d=>{const p=d.view===o;return r.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${_r.tab} ${p?_r.tabActive:""}`,onClick:()=>c(d),"data-testid":d.testId,title:d.label,"aria-label":d.label,children:[r.jsx("span",{className:_r.tabIcon,"aria-hidden":"true",children:d.icon}),r.jsx("span",{className:_r.tabLabel,children:d.label})]},d.view)})})}const e4="_container_pi6ii_1",t4="_content_pi6ii_66",xb={container:e4,content:t4},n4=320,Q1=220,ex=600,tx="grackle-sidebar-width";function s4(){try{const t=localStorage.getItem(tx);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=Q1&&s<=ex)return s}}catch{}return n4}function a4(t){try{localStorage.setItem(tx,String(t))}catch{}}function i4({content:t}){const[s]=_.useState(s4),i=_.useRef(null);if(_.useEffect(()=>{const o=i.current;if(!o)return;const c=new ResizeObserver(u=>{for(const d of u){const p=d.borderBoxSize[0];if(p){const h=Math.round(p.inlineSize);h>=Q1&&h<=ex&&a4(h)}}});return c.observe(o),()=>{c.disconnect()}},[]),t!==void 0)return r.jsx("div",{className:xb.container,ref:i,"data-testid":"sidebar",style:{width:s},children:r.jsx("div",{className:xb.content,children:t})})}const o4="_bar_tnfsh_1",r4="_btnPrimary_tnfsh_32",l4="_statusText_tnfsh_85",c4="_statusCompleted_tnfsh_90",u4="_statusFailed_tnfsh_94",d4="_statusBlocked_tnfsh_98",f4="_hintText_tnfsh_103",xt={bar:o4,btnPrimary:r4,statusText:l4,statusCompleted:c4,statusFailed:u4,statusBlocked:d4,hintText:f4};function p4({sessions:t,tasks:s,environments:i}){const o=yt(),c=Pt(),u=jt("/sessions/:sessionId"),d=jt("/tasks/:taskId"),p=jt("/tasks/:taskId/stream"),h=jt("/tasks/:taskId/findings"),g=jt("/tasks/:taskId/edit"),v=jt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=jt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),y=jt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),k=jt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),S=jt("/sessions/new"),N=jt("/environments/:environmentId/workspaces/:workspaceId"),w=jt("/tasks/new"),j=jt("/chat"),C=jt("/"),D=jt("/settings/*"),I=u==null?void 0:u.params.sessionId,R=(d==null?void 0:d.params.taskId)??(p==null?void 0:p.params.taskId)??(h==null?void 0:h.params.taskId)??(v==null?void 0:v.params.taskId)??(b==null?void 0:b.params.taskId)??(y==null?void 0:y.params.taskId)??(k==null?void 0:k.params.taskId),E=v??b??y??k,q=(E==null?void 0:E.params.environmentId)??(N==null?void 0:N.params.environmentId),$=c.pathname.startsWith("/environments")&&!N&&!E,Y=!!j,Z=!!S,te=!!N&&!v&&!b&&!y&&!k,ae=!!w;if(!!C&&!Z&&!te&&!ae||!!D||(!!g||!!k)||ae||$||Z)return r.jsx(r.Fragment,{});if(Y)return i.find(F=>F.adapterType==="local"&&F.status==="connected")?r.jsx(r.Fragment,{}):r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Add a local environment to start chatting"})});if(te)return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Select a task or click + to create one"})});if(R){const B=s.find(re=>re.id===R);if(!B)return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Loading..."})});const F=new Map(s.map(re=>[re.id,re])),ne=B.dependsOn.some(re=>{const ue=F.get(re);return ue!==void 0&&ue.status!=="complete"});if(B.status==="not_started"){const re=ne?B.dependsOn.map(ue=>F.get(ue)).filter(ue=>ue&&ue.status!=="complete").map(ue=>ue.title):[];return r.jsx("div",{className:xt.bar,children:ne?r.jsxs("span",{className:xt.statusBlocked,children:["Blocked by: ",re.join(", ")]}):r.jsx("span",{className:xt.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,ue=re?t.find(je=>je.id===re):void 0;return ue&&ue.status!=="stopped"?r.jsx(r.Fragment,{}):r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Waiting for agent..."})})}if(B.status==="complete")return r.jsxs("div",{className:xt.bar,children:[r.jsx("span",{className:`${xt.statusText} ${xt.statusCompleted}`,children:"Task completed"}),r.jsx("button",{onClick:()=>o(gi(B.workspaceId,void 0,q)),className:xt.btnPrimary,children:"+ New Task"})]});if(B.status==="failed")return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:`${xt.statusText} ${xt.statusFailed}`,children:"Task failed"})})}if(I){const B=t.find(re=>re.id===I),F=(B==null?void 0:B.status)==="stopped";if(B!==void 0&&!F)return r.jsx(r.Fragment,{});if(F)return r.jsxs("div",{className:xt.bar,children:[r.jsxs("span",{className:`${xt.statusText} ${xt.hintText}`,children:["Session ",B.endReason||B.status]}),r.jsx("button",{onClick:()=>o(m_(B.environmentId)),className:xt.btnPrimary,children:"+ New Chat"})]})}return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Loading..."})})}const m4="_nav_14i94_1",h4="_tab_14i94_24",g4="_tabActive_14i94_62",v4="_tabLabel_14i94_75",y4="_statusDot_14i94_81",b4="_pulse_14i94_87",_4="_addButton_14i94_99",x4="_empty_14i94_132",ka={nav:m4,tab:h4,tabActive:g4,tabLabel:v4,statusDot:y4,pulse:b4,addButton:_4,empty:x4},k4={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function S4({environments:t}){const s=yt(),i=_.useRef(null),o=jt("/environments/:environmentId"),c=jt("/environments/:environmentId/edit"),u=jt("/environments/:environmentId/workspaces/:workspaceId"),d=jt("/environments/:environmentId/workspaces/:workspaceId/*"),p=(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=p==="new"?void 0:p,g=_.useCallback(y=>{s(di(y))},[s]),v=_.useCallback(y=>{var j;const k=(j=i.current)==null?void 0:j.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),N=S>=0?S:t.findIndex(C=>C.id===h);let w=N;if(y.key==="ArrowDown"||y.key==="j"||y.key==="J")y.preventDefault(),w=(N+1)%k.length;else if(y.key==="ArrowUp"||y.key==="k"||y.key==="K")y.preventDefault(),w=(N-1+k.length)%k.length;else if(y.key==="Home")y.preventDefault(),w=0;else if(y.key==="End")y.preventDefault(),w=k.length-1;else return;w<t.length&&s(di(t[w].id)),k[w].focus()},[h,t,s]),b=h??(t.length>0?t[0].id:void 0);return r.jsxs("div",{className:ka.nav,"data-testid":"environment-nav",children:[r.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(y=>{const k=y.id===h,S=y.id===b,N=k4[y.status]||"var(--text-tertiary)",w=y.status==="connected";return r.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${ka.tab} ${k?ka.tabActive:""}`,onClick:()=>g(y.id),"data-testid":"env-nav-item",children:[r.jsx("span",{className:`${ka.statusDot} ${w?ka.pulse:""}`,style:{color:N},"aria-hidden":"true",children:r.jsx(Ea,{size:Hp,fill:"currentColor"})}),r.jsx("span",{className:ka.tabLabel,title:y.displayName||y.id,children:y.displayName||y.id})]},y.id)})}),r.jsx("button",{type:"button",className:ka.addButton,onClick:()=>s(Aj),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&r.jsx("div",{className:ka.empty,children:"No environments yet."})]})}function Bm(t){const s=new Date(t),i=new Date,o=i.getTime()-s.getTime(),c=Math.floor(o/1e3),u=Math.floor(c/60),d=Math.floor(u/60),p=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(p===1)return"yesterday";if(p<7)return`${p} 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 kb={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 Yc(t){return kb[t]||kb.general}const T4="_nav_dlm8m_1",N4="_categoryPills_dlm8m_24",j4="_categoryPill_dlm8m_24",w4="_tab_dlm8m_42",C4="_tabActive_dlm8m_80",E4="_tabContent_dlm8m_93",A4="_tabLabel_dlm8m_100",D4="_tabMeta_dlm8m_106",R4="_categoryDot_dlm8m_111",M4="_empty_dlm8m_118",fs={nav:T4,categoryPills:N4,categoryPill:j4,tab:w4,tabActive:C4,tabContent:E4,tabLabel:A4,tabMeta:D4,categoryDot:R4,empty:M4};function I4({findings:t,workspaceId:s,environmentId:i}){const o=yt(),c=_.useRef(null),u=jt("/findings/:findingId"),d=jt("/environments/:environmentId/workspaces/:workspaceId/findings/:findingId"),p=(u==null?void 0:u.params.findingId)??(d==null?void 0:d.params.findingId),h=_.useMemo(()=>{const y=new Set(t.map(k=>k.category).filter(Boolean));return Array.from(y).sort()},[t]),g=_.useCallback(y=>{o(vp(y,s,i))},[o,s,i]),v=_.useCallback(y=>{var j;const k=(j=c.current)==null?void 0:j.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),N=S>=0?S:t.findIndex(C=>C.id===p);let w=N;if(y.key==="ArrowDown"||y.key==="j"||y.key==="J")y.preventDefault(),w=(N+1)%k.length;else if(y.key==="ArrowUp"||y.key==="k"||y.key==="K")y.preventDefault(),w=(N-1+k.length)%k.length;else if(y.key==="Home")y.preventDefault(),w=0;else if(y.key==="End")y.preventDefault(),w=k.length-1;else return;w<t.length&&o(vp(t[w].id,s,i)),k[w].focus()},[p,t,o,s,i]),b=p??(t.length>0?t[0].id:void 0);return r.jsxs("div",{className:fs.nav,"data-testid":"findings-nav",children:[h.length>1&&r.jsx("div",{className:fs.categoryPills,"data-testid":"findings-nav-categories",children:h.map(y=>r.jsx("span",{className:fs.categoryPill,style:{color:Yc(y).text},children:y},y))}),r.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(y=>{const k=y.id===p,S=y.id===b;return r.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${fs.tab} ${k?fs.tabActive:""}`,onClick:()=>g(y.id),"data-testid":"finding-nav-item",children:[r.jsx("span",{className:fs.categoryDot,style:{color:Yc(y.category).text},"aria-hidden":"true",children:r.jsx(Ea,{size:Hp,fill:"currentColor"})}),r.jsxs("span",{className:fs.tabContent,children:[r.jsx("span",{className:fs.tabLabel,title:y.title,children:y.title}),r.jsx("span",{className:fs.tabMeta,title:y.createdAt,children:Bm(y.createdAt)})]})]},y.id)})}),t.length===0&&r.jsx("div",{className:fs.empty,children:"No findings yet. Agents will post discoveries here."})]})}function O4(t){if(t.length===0)return[];const s=[...t].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 nx({text:t,indices:s,highlightClass:i}){if(!s||s.length===0)return r.jsx(r.Fragment,{children:t});const o=O4(s),c=[];let u=0;for(const[d,p]of o)d>u&&c.push(r.jsx("span",{children:t.slice(u,d)},`p${u}`)),c.push(r.jsx("mark",{className:i,children:t.slice(d,p+1)},`m${d}`)),u=p+1;return u<t.length&&c.push(r.jsx("span",{children:t.slice(u)},`p${u}`)),r.jsx(r.Fragment,{children:c})}function B4(t){const s=new Map(t.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 L4(t,s){const i=new Map;for(const u of t){const p=u.dependsOn.length>0&&u.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":u.status,h=i.get(p);h?h.push(u):i.set(p,[u])}const o=[],c=new Set;for(const u of I2){c.add(u);const d=i.get(u);if(d&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const p=Aa(u);o.push({status:u,label:p.label,style:p,tasks:d})}}for(const[u,d]of i)if(!c.has(u)&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const p=Aa(u);o.push({status:u,label:p.label,style:p,tasks:d})}return o}const z4="_container_z4i38_1",U4="_header_z4i38_5",$4="_headerActions_z4i38_17",P4="_searchInput_z4i38_23",V4="_searchHighlight_z4i38_56",H4="_groupToggle_z4i38_62",q4="_groupToggleActive_z4i38_89",G4="_addButton_z4i38_93",F4="_taskRow_z4i38_120",Z4="_selected_z4i38_140",K4="_expandArrow_z4i38_150",Y4="_expanded_z4i38_157",J4="_leafSpacer_z4i38_161",W4="_taskStatusIcon_z4i38_166",X4="_taskTitle_z4i38_170",Q4="_workspaceBadge_z4i38_177",eI="_childCountBadge_z4i38_195",tI="_dependencyBadge_z4i38_208",nI="_blockedBadge_z4i38_220",sI="_addChildButton_z4i38_225",aI="_emptyState_z4i38_268",iI="_statusGroupHeader_z4i38_275",oI="_statusGroupIcon_z4i38_294",rI="_statusGroupLabel_z4i38_298",lI="_statusGroupCount_z4i38_303",Ve={container:z4,header:U4,headerActions:$4,searchInput:P4,searchHighlight:V4,groupToggle:H4,groupToggleActive:q4,addButton:G4,taskRow:F4,selected:Z4,expandArrow:K4,expanded:Y4,leafSpacer:J4,taskStatusIcon:W4,taskTitle:X4,workspaceBadge:Q4,childCountBadge:eI,dependencyBadge:tI,blockedBadge:nI,addChildButton:sI,emptyState:aI,statusGroupHeader:iI,statusGroupIcon:oI,statusGroupLabel:rI,statusGroupCount:lI},cI=[{name:"title",weight:2},{name:"description",weight:1}],sx=16,uI=16,ax="grackle-task-group-by-status";function Sb(){try{return localStorage.getItem(ax)==="true"}catch{return!1}}function dI(t){try{localStorage.setItem(ax,String(t))}catch{}}function fI({group:t,isExpanded:s,onToggle:i,selectedTaskId:o,navigate:c,titleHighlights:u,workspaceNames:d}){return r.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[r.jsxs("div",{className:Ve.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:i,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i())},children:[r.jsx("span",{className:`${Ve.expandArrow} ${s?Ve.expanded:""}`,"aria-hidden":"true",children:r.jsx(Ks,{size:kt})}),r.jsx("span",{className:Ve.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),r.jsx("span",{className:Ve.statusGroupLabel,children:t.label}),r.jsx("span",{className:Ve.statusGroupCount,children:t.tasks.length})]}),r.jsx(vs,{children:s&&r.jsx(It.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:t.tasks.map(p=>{const h=Aa(p.status),g=o===p.id,v=p.parentTaskId||!p.workspaceId?void 0:d.get(p.workspaceId);return r.jsxs("div",{onClick:()=>c(as(p.id)),className:`${Ve.taskRow} ${g?Ve.selected:""}`,style:{"--task-indent":`${sx}px`},"data-task-id":p.id,children:[r.jsx("span",{className:Ve.leafSpacer}),r.jsx("span",{className:Ve.taskStatusIcon,style:{color:h.color},"aria-hidden":"true","data-testid":`task-status-${Vr(p.status)}`,children:h.icon}),r.jsx("span",{className:Ve.taskTitle,title:p.title,children:r.jsx(nx,{text:p.title,indices:u.get(p.id),highlightClass:Ve.searchHighlight})}),v&&r.jsx("span",{className:Ve.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function ix({node:t,depth:s,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:p,workspaceNames:h}){const g=Aa(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(j=>d.get(j)!=="complete"),b=i.has(t.id),y=t.children.length>0,k=c===t.id,S=sx+s*uI,w=s===0&&!t.parentTaskId&&t.workspaceId?h.get(t.workspaceId):void 0;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{onClick:()=>u(as(t.id)),className:`${Ve.taskRow} ${k?Ve.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[y&&r.jsx("span",{className:`${Ve.expandArrow} ${b?Ve.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:j=>{j.stopPropagation(),o(t.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),j.stopPropagation(),o(t.id))},children:r.jsx(Ks,{size:kt,"aria-hidden":"true"})}),!y&&r.jsx("span",{className:Ve.leafSpacer}),r.jsx("span",{className:Ve.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${Vr(t.status)}`,children:g.icon}),r.jsx("span",{className:Ve.taskTitle,title:t.title,children:r.jsx(nx,{text:t.title,indices:p.get(t.id),highlightClass:Ve.searchHighlight})}),w&&r.jsx("span",{className:Ve.workspaceBadge,title:w,children:w}),y&&r.jsxs("span",{className:Ve.childCountBadge,children:[t.children.filter(j=>j.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&r.jsx("span",{className:`${Ve.dependencyBadge} ${v?Ve.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<ZS&&r.jsx("button",{onClick:j=>{j.stopPropagation(),u(gi(t.workspaceId,t.id))},title:"Add child task","aria-label":"Add child task",className:Ve.addChildButton,children:"+"})]}),r.jsx(vs,{children:y&&b&&r.jsx(It.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:t.children.map(j=>r.jsx(ix,{node:j,depth:s+1,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:p,workspaceNames:h},j.id))})})]})}function pI({workspaces:t,tasks:s}){const i=yt(),[o,c]=_.useState(new Set),[u,d]=_.useState(new Set),[p,h]=_.useState(Sb),[g,v]=_.useState(Sb),[b,y]=_.useState(new Map),k=jt("/tasks/:taskId/*"),S=(k==null?void 0:k.params.taskId)!=="new"?k==null?void 0:k.params.taskId:void 0,N=_.useMemo(()=>new Map(s.map(ie=>[ie.id,ie.status])),[s]),w=_.useMemo(()=>new Map(t.map(ie=>[ie.id,ie.name])),[t]),j=()=>{const ie=!p;dI(ie),h(ie),ie&&(v(!0),y(new Map))},C=ie=>{y(Q=>{const B=new Map(Q),F=B.has(ie)?B.get(ie):g;return B.set(ie,!F),B})},D=ie=>b.has(ie)?b.get(ie):g,I=ie=>{c(Q=>{const B=new Set(Q);return B.has(ie)?(B.delete(ie),d(F=>new Set(F).add(ie))):(B.add(ie),d(F=>{const ne=new Set(F);return ne.delete(ie),ne})),B})};_.useEffect(()=>{const ie=new Set(s.filter(Q=>Q.parentTaskId).map(Q=>Q.parentTaskId));ie.size>0&&c(Q=>{const B=new Set(Q);for(const F of ie)u.has(F)||B.add(F);return B})},[s,u]);const[R,E]=_.useState(""),{directMatchTaskIds:q,treeMatchTaskIds:$,titleHighlights:Y}=_.useMemo(()=>{if(!R.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const ie=FS(s,R,cI),Q=new Set(ie.map(re=>re.item.id)),B=new Map;for(const re of ie){const ue=re.matches.find(Fe=>Fe.key==="title");ue&&B.set(re.item.id,ue.indices)}const F=new Set(Q),ne=new Map(s.map(re=>[re.id,re]));for(const re of[...Q]){let ue=ne.get(re);for(;ue!=null&&ue.parentTaskId;)F.add(ue.parentTaskId),ue=ne.get(ue.parentTaskId)}return{directMatchTaskIds:Q,treeMatchTaskIds:F,titleHighlights:B}},[R,s]),Z=q!==null,te=Z?p?q:$:null,ae=te?s.filter(ie=>te.has(ie.id)):s,me=p?[]:B4(ae);return r.jsxs("div",{className:Ve.container,children:[r.jsxs("div",{className:Ve.header,children:[r.jsx("span",{children:"Tasks"}),r.jsxs("div",{className:Ve.headerActions,children:[r.jsx("button",{className:`${Ve.groupToggle} ${p?Ve.groupToggleActive:""}`,onClick:j,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,title:p?"Switch to tree view":"Group tasks by status","data-testid":"task-group-by-status-toggle",children:r.jsx(u2,{size:Gt})}),r.jsx("button",{className:Ve.addButton,onClick:()=>i(gi()),"aria-label":"New task",title:"New task","data-testid":"new-task-button",children:"+"})]})]}),s.length>0&&r.jsx("input",{type:"text",value:R,onChange:ie=>E(ie.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Ve.searchInput,"data-testid":"sidebar-search"}),p?L4(ae,N).map(ie=>r.jsx(fI,{group:ie,isExpanded:D(ie.status),onToggle:()=>C(ie.status),selectedTaskId:S,navigate:i,titleHighlights:Y,workspaceNames:w},ie.status)):me.map(ie=>r.jsx(ix,{node:ie,depth:0,expandedTasks:o,toggleTask:I,selectedTaskId:S,navigate:i,taskStatusById:N,titleHighlights:Y,workspaceNames:w},ie.id)),ae.length===0&&!Z&&r.jsx("div",{className:Ve.emptyState,children:"No tasks yet. Click + to create one."}),ae.length===0&&Z&&r.jsx("div",{className:Ve.emptyState,children:"No matching tasks"})]})}const mI="_toast_ed2dk_1",hI="_success_ed2dk_18",gI="_icon_ed2dk_22",vI="_error_ed2dk_25",yI="_warning_ed2dk_32",bI="_info_ed2dk_38",_I="_message_ed2dk_53",xI="_close_ed2dk_60",xr={toast:mI,success:hI,icon:gI,error:vI,warning:yI,info:bI,message:_I,close:xI},kI={success:r.jsx(yo,{size:Mt}),error:r.jsx(mi,{size:Mt}),warning:r.jsx(Vp,{size:Mt}),info:r.jsx(Pp,{size:Mt})};function SI({toast:t,onDismiss:s}){return _.useEffect(()=>{const i=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(i)},[t.id,t.duration,s]),r.jsxs(It.div,{className:`${xr.toast} ${xr[t.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[r.jsx("span",{className:xr.icon,"aria-hidden":"true",children:kI[t.variant]}),r.jsx("span",{className:xr.message,children:t.message}),r.jsx("button",{type:"button",className:xr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:r.jsx(mi,{size:Gt,"aria-hidden":"true"})})]})}const TI="_container_qqse2_1",NI={container:TI};function jI({toasts:t,onDismiss:s}){return r.jsx("div",{className:NI.container,"data-testid":"toast-container",children:r.jsx(vs,{children:t.map(i=>r.jsx(SI,{toast:i,onDismiss:s},i.id))})})}const wI="_callout_e5awm_1",CI="_success_e5awm_11",EI="_icon_e5awm_15",AI="_error_e5awm_18",DI="_warning_e5awm_25",RI="_info_e5awm_32",MI="_content_e5awm_48",II="_close_e5awm_53",kr={callout:wI,success:CI,icon:EI,error:AI,warning:DI,info:RI,content:MI,close:II},OI={success:r.jsx(yo,{size:Mt}),error:r.jsx(mi,{size:Mt}),warning:r.jsx(Vp,{size:Mt}),info:r.jsx(Pp,{size:Mt})};function BI({variant:t="info",children:s,dismissible:i=!1,className:o}){const[c,u]=_.useState(!1);return r.jsx(r.Fragment,{children:!c&&r.jsxs("div",{className:[kr.callout,kr[t],o].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[r.jsx("span",{className:kr.icon,"aria-hidden":"true",children:OI[t]}),r.jsx("span",{className:kr.content,children:s}),i&&r.jsx("button",{type:"button",className:kr.close,onClick:()=>u(!0),"aria-label":"Dismiss",children:r.jsx(mi,{size:Gt,"aria-hidden":"true"})})]})})}function LI({currentVersion:t,latestVersion:s,updateAvailable:i,isDocker:o}){if(!i)return r.jsx(r.Fragment,{});const c=o?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return r.jsx("div",{"data-testid":"update-banner",children:r.jsxs(BI,{variant:"info",dismissible:!0,children:[r.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",r.jsx("code",{children:c})]})})}const zI="_container_de44x_1",UI="_emptyState_de44x_8",$I="_card_de44x_14",PI="_cardClickable_de44x_34",VI="_cardHeader_de44x_42",HI="_categoryBadge_de44x_54",qI="_findingTitle_de44x_62",GI="_findingDate_de44x_68",FI="_findingContent_de44x_80",ZI="_tags_de44x_86",KI="_tag_de44x_86",es={container:zI,emptyState:UI,card:$I,cardClickable:PI,cardHeader:VI,categoryBadge:HI,findingTitle:qI,findingDate:GI,findingContent:FI,tags:ZI,tag:KI};function ox({findings:t,onFindingClick:s}){return t.length===0?r.jsx("div",{className:es.emptyState,children:"No findings yet. Agents will post discoveries here."}):r.jsx("div",{className:es.container,children:t.map((i,o)=>{const c=Yc(i.category),u=s?It.button:It.div;return r.jsxs(u,{type:s?"button":void 0,className:`${es.card} ${s?es.cardClickable:""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:o*.05,duration:.2},onClick:s?()=>{s(i.id)}:void 0,children:[r.jsxs("div",{className:es.cardHeader,children:[r.jsx("span",{className:es.categoryBadge,style:{background:c.bg,color:c.text},children:i.category}),r.jsx("span",{className:es.findingTitle,children:i.title}),r.jsx("span",{className:es.findingDate,title:i.createdAt,children:Bm(i.createdAt)})]}),r.jsx("div",{className:es.findingContent,children:i.content.length>300?i.content.slice(0,300)+"...":i.content}),i.tags.length>0&&r.jsx("div",{className:es.tags,children:i.tags.map(d=>r.jsx("span",{className:es.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:d},d))})]},i.id)})})}const YI="_section_1ingb_14",JI="_sectionTitle_1ingb_26",WI="_sectionDescription_1ingb_35",XI="_tokenList_1ingb_48",QI="_tokenRow_1ingb_55",eO="_tokenBadge_1ingb_68",tO="_tokenName_1ingb_83",nO="_tokenTarget_1ingb_90",sO="_deleteButton_1ingb_99",aO="_addForm_1ingb_113",iO="_formRow_1ingb_119",oO="_input_1ingb_125",rO="_select_1ingb_155",lO="_addButton_1ingb_187",cO="_emptyStateInfo_1ingb_221",uO="_themeOptions_1ingb_229",dO="_themeOption_1ingb_229",fO="_themeOptionSelected_1ingb_254",pO="_themeOptionHeader_1ingb_259",mO="_themeOptionLabel_1ingb_266",hO="_themeOptionDesc_1ingb_273",gO="_variantToggle_1ingb_279",vO="_variantButton_1ingb_286",yO="_variantActive_1ingb_305",bO="_themeSwatches_1ingb_311",_O="_themeSwatch_1ingb_311",xO="_systemToggle_1ingb_325",kO="_systemToggleHint_1ingb_341",SO="_themeActive_1ingb_348",TO="_aboutGrid_1ingb_354",NO="_aboutItem_1ingb_360",jO="_aboutLabel_1ingb_373",wO="_aboutValue_1ingb_379",CO="_aboutDot_1ingb_387",EO="_aboutDotConnected_1ingb_394",AO="_aboutDotDisconnected_1ingb_398",pe={section:YI,sectionTitle:JI,sectionDescription:WI,tokenList:XI,tokenRow:QI,tokenBadge:eO,tokenName:tO,tokenTarget:nO,deleteButton:sO,addForm:aO,formRow:iO,input:oO,select:rO,addButton:lO,emptyStateInfo:cO,themeOptions:uO,themeOption:dO,themeOptionSelected:fO,themeOptionHeader:pO,themeOptionLabel:mO,themeOptionDesc:hO,variantToggle:gO,variantButton:vO,variantActive:yO,themeSwatches:bO,themeSwatch:_O,systemToggle:xO,systemToggleHint:kO,themeActive:SO,aboutGrid:TO,aboutItem:NO,aboutLabel:jO,aboutValue:wO,aboutDot:CO,aboutDotConnected:EO,aboutDotDisconnected:AO},DO=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function RO({tokens:t,onSetToken:s,onDeleteToken:i,onShowToast:o}){const[c,u]=_.useState(""),[d,p]=_.useState(""),[h,g]=_.useState("env_var"),[v,b]=_.useState(""),[y,k]=_.useState(null),S=j=>{if(j.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(""),p(""),b("")},N=j=>{k(j)},w=()=>{y&&(i(y),o==null||o("Token deleted","info")),k(null)};return r.jsxs(r.Fragment,{children:[r.jsx(pi,{isOpen:y!==null,title:"Delete Token?",description:y?`"${y}" will be permanently removed.`:void 0,onConfirm:w,onCancel:()=>k(null)}),r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Tokens"}),r.jsx("p",{className:pe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?r.jsx("div",{className:pe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):r.jsx("div",{className:pe.tokenList,children:t.map(j=>r.jsxs("div",{className:pe.tokenRow,children:[r.jsx("span",{className:pe.tokenBadge,children:j.tokenType}),r.jsx("span",{className:pe.tokenName,children:j.name}),r.jsx("span",{className:pe.tokenTarget,children:j.tokenType==="env_var"?j.envVar:j.filePath}),r.jsx("button",{className:pe.deleteButton,onClick:()=>N(j.name),title:`Delete ${j.name}`,"aria-label":`Delete ${j.name}`,children:r.jsx(mi,{size:Gt,"aria-hidden":"true"})})]},j.name))}),r.jsxs("form",{className:pe.addForm,onSubmit:S,children:[r.jsxs("div",{className:pe.formRow,children:[r.jsx("input",{className:pe.input,type:"text",placeholder:"Token name",value:c,onChange:j=>u(j.target.value)}),r.jsx("input",{className:pe.input,type:"password",placeholder:"Value",value:d,onChange:j=>p(j.target.value)})]}),r.jsxs("div",{className:pe.formRow,children:[r.jsx("select",{className:pe.select,value:h,onChange:j=>g(j.target.value),children:DO.map(j=>r.jsx("option",{value:j.value,children:j.label},j.value))}),r.jsx("input",{className:pe.input,type:"text",placeholder:h==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:j=>b(j.target.value)}),r.jsx("button",{className:pe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const du=[{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"]}],rx=new Set(du.map(t=>t.id)),Tb="grackle";function Bp(t){return du.find(s=>s.id===t)}function MO({themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c}){return r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Appearance"}),r.jsx("p",{className:pe.sectionDescription,children:"Choose how Grackle looks across the app."}),r.jsx("div",{className:pe.themeOptions,children:du.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),p=d?t===u.id||t===u.variantLightId||t===u.variantDarkId:t===u.id,h=d&&s===u.variantLightId;return r.jsxs("button",{type:"button",className:`${pe.themeOption} ${p?pe.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>i(u.id),children:[r.jsxs("span",{className:pe.themeOptionHeader,children:[r.jsxs("span",{children:[r.jsx("span",{className:pe.themeOptionLabel,children:u.label}),r.jsx("span",{className:pe.themeOptionDesc,children:u.description})]}),d&&r.jsxs("span",{className:pe.variantToggle,children:[r.jsx("span",{role:"button",tabIndex:0,className:`${pe.variantButton} ${p&&h?pe.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":p&&h,children:"☼"}),r.jsx("span",{role:"button",tabIndex:0,className:`${pe.variantButton} ${p&&!h?pe.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":p&&!h,children:"☾"})]})]}),u.swatches&&r.jsx("span",{className:pe.themeSwatches,children:u.swatches.map((g,v)=>r.jsx("span",{className:pe.themeSwatch,style:{background:g}},v))})]},u.id)})}),r.jsxs("label",{className:pe.systemToggle,children:[r.jsx("input",{type:"checkbox",checked:o,onChange:u=>c(u.target.checked)}),r.jsx("span",{children:"Match system light/dark preference"})]}),r.jsx("p",{className:pe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),r.jsxs("p",{className:pe.themeActive,children:["Active theme: ",r.jsx("strong",{children:s})]})]})}function IO({connected:t,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 r.jsxs("section",{className:pe.section,"data-testid":"about-panel",children:[r.jsx("h3",{className:pe.sectionTitle,children:"About"}),r.jsx("p",{className:pe.sectionDescription,children:"Connection status and application information."}),r.jsxs("div",{className:pe.aboutGrid,children:[r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Connection"}),r.jsxs("span",{className:pe.aboutValue,children:[r.jsx("span",{className:`${pe.aboutDot} ${t?pe.aboutDotConnected:pe.aboutDotDisconnected}`}),t?"Connected":"Disconnected"]})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Environments"}),r.jsxs("span",{className:pe.aboutValue,children:[o,"/",c," connected"]})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Active Sessions"}),r.jsx("span",{className:pe.aboutValue,children:u})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Version"}),r.jsx("span",{className:pe.aboutValue,children:"0.89.2"})]})]})]})}const OO="_container_cddyd_1",BO="_header_cddyd_8",LO="_headerTitle_cddyd_35",zO="_badge_cddyd_44",UO="_headerActions_cddyd_54",$O="_body_cddyd_61",PO="_formContent_cddyd_73",VO="_section_cddyd_85",HO="_label_cddyd_91",qO="_titleInput_cddyd_98",GO="_descriptionTextarea_cddyd_131",FO="_parentContext_cddyd_167",ZO="_parentLabel_cddyd_175",KO="_parentName_cddyd_182",YO="_personaSelect_cddyd_186",JO="_depList_cddyd_220",WO="_depItem_cddyd_226",XO="_depItemSelected_cddyd_248",QO="_noDeps_cddyd_252",e5="_btnPrimary_cddyd_258",t5="_btnGhost_cddyd_289",Ye={container:OO,header:BO,headerTitle:LO,badge:zO,headerActions:UO,body:$O,formContent:PO,section:VO,label:HO,titleInput:qO,descriptionTextarea:GO,parentContext:FO,parentLabel:ZO,parentName:KO,personaSelect:YO,depList:JO,depItem:WO,depItemSelected:XO,noDeps:QO,btnPrimary:e5,btnGhost:t5};function lx({mode:t,taskId:s,workspaceId:i,parentTaskId:o,environmentId:c,tasks:u,workspaces:d,personas:p,onCreateTask:h,onUpdateTask:g,onEditDone:v,onShowToast:b}){const y=yt(),k=t==="edit",S=k&&s?u.find(de=>de.id===s):void 0,N=k?(S==null?void 0:S.workspaceId)??"":i??"",[w,j]=_.useState(N),C=N||w,D=d.find(de=>de.id===C),I=c??(D==null?void 0:D.environmentId),R=!k&&!i,E=k?(S==null?void 0:S.parentTaskId)??"":o??"",q=E?u.find(de=>de.id===E):void 0,[$,Y]=_.useState((S==null?void 0:S.title)??""),[Z,te]=_.useState((S==null?void 0:S.description)??""),[ae,me]=_.useState((S==null?void 0:S.dependsOn)??[]),[ie,Q]=_.useState((S==null?void 0:S.defaultPersonaId)??""),[B,F]=_.useState((S==null?void 0:S.canDecompose)??!1),[ne,re]=_.useState(!1),ue=_.useRef(!1);_.useEffect(()=>{k&&S&&!ue.current&&(ue.current=!0,Y(S.title),te(S.description),me(S.dependsOn),Q(S.defaultPersonaId),F(S.canDecompose))},[k,S]);const Fe=u.filter(de=>de.workspaceId===C&&(!k||de.id!==s)&&de.id!==E),je=$.trim().length>0&&(!k||S!==void 0)&&C.length>0,Te=de=>{me(Ie=>Ie.includes(de)?Ie.filter(bt=>bt!==de):[...Ie,de])},Me=()=>{!je||ne||k&&S===void 0||(k&&s?(g(s,$.trim(),Z,ae,ie),b==null||b("Task updated","success"),v?v():y(as(s,void 0,C,I),{replace:!0})):(re(!0),h(C,$.trim(),Z,ae.length>0?ae:void 0,E||void 0,ie,B,()=>{b==null||b("Task created","success"),y(i?ui(i,I):"/tasks",{replace:!0})},de=>{b==null||b(de,"error"),re(!1)})))},le=()=>{if(v){v();return}y(k&&s?as(s,void 0,C,I):i?ui(i,I):"/tasks")},ve=k?"edit task":E?"child task":"new task";return r.jsxs("div",{className:Ye.container,children:[r.jsxs("div",{className:Ye.header,children:[r.jsxs("div",{className:Ye.headerTitle,children:[r.jsx("span",{className:Ye.badge,children:ve}),q&&r.jsxs("span",{className:Ye.parentContext,children:[r.jsx("span",{className:Ye.parentLabel,children:"Child of"}),r.jsx("span",{className:Ye.parentName,children:q.title})]})]}),r.jsxs("div",{className:Ye.headerActions,children:[r.jsx("button",{onClick:Me,disabled:!je||ne,className:Ye.btnPrimary,"data-testid":"task-edit-save",children:ne?"Creating…":k?"Save Changes":"Create"}),r.jsx("button",{onClick:le,className:Ye.btnGhost,children:"Cancel"})]})]}),r.jsx("div",{className:Ye.body,children:r.jsxs("div",{className:Ye.formContent,children:[R&&r.jsxs("div",{className:Ye.section,children:[r.jsx("label",{className:Ye.label,htmlFor:"task-edit-workspace",children:"Workspace"}),r.jsxs("select",{id:"task-edit-workspace",value:w,onChange:de=>j(de.target.value),className:Ye.personaSelect,"data-testid":"task-edit-workspace",children:[r.jsx("option",{value:"",children:"Select a workspace..."}),d.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]}),r.jsxs("div",{className:Ye.section,children:[r.jsx("label",{className:Ye.label,htmlFor:"task-edit-title",children:"Title"}),r.jsx("input",{id:"task-edit-title",type:"text",value:$,onChange:de=>Y(de.target.value),placeholder:"Task title...",autoFocus:!0,className:Ye.titleInput,"data-testid":"task-edit-title",onKeyDown:de=>{de.key==="Enter"&&je&&Me()}})]}),r.jsxs("div",{className:Ye.section,children:[r.jsx("label",{className:Ye.label,htmlFor:"task-edit-description",children:"Description"}),r.jsx("textarea",{id:"task-edit-description",value:Z,onChange:de=>te(de.target.value),placeholder:"Describe the task... (markdown supported)",className:Ye.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),r.jsxs("div",{className:Ye.section,children:[r.jsx("label",{className:Ye.label,htmlFor:"task-edit-persona",children:"Default Persona"}),r.jsxs("select",{id:"task-edit-persona",value:ie,onChange:de=>Q(de.target.value),className:Ye.personaSelect,"data-testid":"task-edit-persona",children:[r.jsx("option",{value:"",children:"(Inherit)"}),p.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]}),!k&&r.jsx("div",{className:Ye.section,children:r.jsxs("label",{className:Ye.depItem,"data-testid":"task-edit-can-decompose",children:[r.jsx("input",{type:"checkbox",checked:B,onChange:de=>F(de.target.checked)}),"Can spawn subtasks"]})}),r.jsxs("div",{className:Ye.section,children:[r.jsx("div",{className:Ye.label,children:"Dependencies"}),Fe.length===0?r.jsx("div",{className:Ye.noDeps,children:"No other tasks in this workspace"}):r.jsx("div",{className:Ye.depList,children:Fe.map(de=>{const Ie=ae.includes(de.id);return r.jsxs("label",{className:`${Ye.depItem} ${Ie?Ye.depItemSelected:""}`,"data-testid":`dep-option-${de.id}`,children:[r.jsx("input",{type:"checkbox",checked:Ie,onChange:()=>Te(de.id)}),de.title,r.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",de.status,")"]})]},de.id)})})]})]})})]})}const n5="_container_legrg_1",s5="_header_legrg_8",a5="_headerTitle_legrg_35",i5="_badge_legrg_44",o5="_headerActions_legrg_54",r5="_body_legrg_61",l5="_formContent_legrg_73",c5="_section_legrg_85",u5="_label_legrg_91",d5="_nameInput_legrg_98",f5="_fieldInput_legrg_131",p5="_adapterSelect_legrg_164",m5="_readOnlyValue_legrg_198",h5="_codespaceSection_legrg_204",g5="_codespaceActions_legrg_210",v5="_creatingHint_legrg_216",y5="_errorHint_legrg_222",b5="_btnPrimary_legrg_235",_5="_btnGhost_legrg_266",se={container:n5,header:s5,headerTitle:a5,badge:i5,headerActions:o5,body:r5,formContent:l5,section:c5,label:u5,nameInput:d5,fieldInput:f5,adapterSelect:p5,readOnlyValue:m5,codespaceSection:h5,codespaceActions:g5,creatingHint:v5,errorHint:y5,btnPrimary:b5,btnGhost:_5},Bc=1,Lc=65535;function np(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=Bc&&s<=Lc}function sp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function x5({codespaceName:t,onCodespaceNameChange:s,envName:i,onEnvNameChange:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:p,onCreateCodespace:h}){const[g,v]=_.useState("pick"),[b,y]=_.useState(""),[k,S]=_.useState("");return g==="create"?r.jsxs("div",{className:se.codespaceSection,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Repository"}),r.jsx("input",{type:"text",value:b,onChange:N=>y(N.target.value),placeholder:"owner/repo",className:se.fieldInput,"data-testid":"env-codespace-repo"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Machine Type"}),r.jsx("input",{type:"text",value:k,onChange:N=>S(N.target.value),placeholder:"Machine type (optional)...",className:se.fieldInput,"data-testid":"env-codespace-machine"})]}),r.jsxs("div",{className:se.codespaceActions,children:[r.jsx("button",{onClick:()=>{b.trim()&&(h(b.trim(),k.trim()||void 0),v("pick"),y(""),S(""))},disabled:!b.trim(),className:se.btnPrimary,children:"Create"}),r.jsx("button",{onClick:()=>{v("pick"),y(""),S("")},className:se.btnGhost,children:"Cancel"})]})]}):r.jsx("div",{className:se.codespaceSection,children:r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Codespace"}),!d&&r.jsxs("select",{value:t,onChange:N=>{N.target.value==="__create__"?(v("create"),s("")):(s(N.target.value),N.target.value&&!i.trim()&&o(N.target.value))},disabled:p,className:se.adapterSelect,"data-testid":"env-codespace-select",children:[r.jsx("option",{value:"",children:"Select a codespace..."}),c.map(N=>r.jsxs("option",{value:N.name,children:[N.name," (",N.repository,") — ",N.state]},N.name)),r.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&r.jsx("span",{className:se.creatingHint,children:"Creating codespace..."}),d&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:se.errorHint,children:d}),r.jsx("input",{type:"text",value:t,onChange:N=>s(N.target.value),placeholder:"Or enter codespace name manually...",className:se.fieldInput,"data-testid":"env-codespace-manual"})]}),u&&!d&&r.jsx("span",{className:se.errorHint,children:u})]})})}function cx({mode:t,environmentId:s,environments:i,onAddEnvironment:o,onUpdateEnvironment:c,onListCodespaces:u,codespaces:d,codespaceError:p,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v,onShowToast:b}){const y=yt(),k=t==="edit",S=k&&s?i.find(le=>le.id===s):void 0,[N,w]=_.useState(""),[j,C]=_.useState("local"),[D,I]=_.useState(""),[R,E]=_.useState(""),[q,$]=_.useState(""),[Y,Z]=_.useState(""),[te,ae]=_.useState(""),[me,ie]=_.useState(""),[Q,B]=_.useState(""),[F,ne]=_.useState(null),re=_.useCallback(()=>{const le={};if(j==="local"){if(D.trim()&&(le.host=D.trim()),R.trim()){const ve=Number(R);Number.isInteger(ve)&&(le.port=ve)}}else if(j==="ssh"){if(le.host=D.trim(),q.trim()&&(le.user=q.trim()),R.trim()){const ve=Number(R);Number.isInteger(ve)&&(le.sshPort=ve)}Y.trim()&&(le.identityFile=Y.trim())}else j==="docker"?(te.trim()&&(le.image=te.trim()),me.trim()&&(le.repo=me.trim())):j==="codespace"&&(le.codespaceName=Q.trim());return le},[j,D,R,q,Y,te,me,Q]),ue=()=>!(!N.trim()||j==="ssh"&&!D.trim()||j==="codespace"&&!Q.trim()||(j==="local"||j==="ssh")&&!np(R)),Fe=()=>{ue()&&(o(N.trim(),j,re()),b==null||b("Environment added successfully","success"),y(po,{replace:!0}))},je=()=>{y(s?di(s):po)},Te=_.useCallback((le,ve)=>{if(!S||!s)return;const de=sp(S.adapterConfig),Ie=ve.trim();Ie?de[le]=Ie:delete de[le],c(s,{adapterConfig:de})},[S,s,c]),Me=_.useCallback((le,ve)=>{if(!S||!s)return;const de=sp(S.adapterConfig);if(ve.trim()){const Ie=Number(ve);Number.isInteger(Ie)&&Ie>=Bc&&Ie<=Lc&&(de[le]=Ie)}else delete de[le];c(s,{adapterConfig:de})},[S,s,c]);if(k){if(!S)return r.jsxs("div",{className:se.container,children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"edit environment"})}),r.jsx("div",{className:se.headerActions,children:r.jsx("button",{onClick:je,className:se.btnGhost,children:"Back"})})]}),r.jsx("div",{className:se.body,children:r.jsx("div",{className:se.formContent,children:r.jsx("span",{className:se.readOnlyValue,children:"Environment not found"})})})]});const le=sp(S.adapterConfig);return r.jsxs("div",{className:se.container,"data-testid":"env-edit-panel",children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"edit environment"})}),r.jsx("div",{className:se.headerActions,children:r.jsx("button",{onClick:je,className:se.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),r.jsx("div",{className:se.body,children:r.jsxs("div",{className:se.formContent,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Name"}),r.jsx(Xt,{value:S.displayName,onSave:ve=>{s&&c(s,{displayName:ve})},validate:ve=>ve.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:F,onActivate:ne,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Adapter Type"}),r.jsx("span",{className:se.readOnlyValue,"data-testid":"env-edit-adapter-type",children:S.adapterType})]}),S.adapterType==="local"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Host"}),r.jsx(Xt,{value:String(le.host??""),onSave:ve=>Te("host",ve),mode:"edit",fieldId:"host",activeFieldId:F,onActivate:ne,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Port"}),r.jsx(Xt,{value:String(le.port??""),onSave:ve=>Me("port",ve),validate:ve=>np(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:F,onActivate:ne,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),S.adapterType==="ssh"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Host"}),r.jsx(Xt,{value:String(le.host??""),onSave:ve=>Te("host",ve),validate:ve=>ve.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:F,onActivate:ne,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"User"}),r.jsx(Xt,{value:String(le.user??""),onSave:ve=>Te("user",ve),mode:"edit",fieldId:"user",activeFieldId:F,onActivate:ne,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"SSH Port"}),r.jsx(Xt,{value:String(le.sshPort??""),onSave:ve=>Me("sshPort",ve),validate:ve=>np(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:F,onActivate:ne,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Identity File"}),r.jsx(Xt,{value:String(le.identityFile??""),onSave:ve=>Te("identityFile",ve),mode:"edit",fieldId:"identityFile",activeFieldId:F,onActivate:ne,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),S.adapterType==="docker"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Image"}),r.jsx(Xt,{value:String(le.image??""),onSave:ve=>Te("image",ve),mode:"edit",fieldId:"image",activeFieldId:F,onActivate:ne,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Repo"}),r.jsx(Xt,{value:String(le.repo??""),onSave:ve=>Te("repo",ve),mode:"edit",fieldId:"repo",activeFieldId:F,onActivate:ne,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),S.adapterType==="codespace"&&r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Codespace Name"}),r.jsx(Xt,{value:String(le.codespaceName??""),onSave:ve=>Te("codespaceName",ve),validate:ve=>ve.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:F,onActivate:ne,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return r.jsxs("div",{className:se.container,"data-testid":"env-create-panel",children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"new environment"})}),r.jsxs("div",{className:se.headerActions,children:[r.jsx("button",{onClick:Fe,disabled:!ue(),className:se.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),r.jsx("button",{onClick:je,className:se.btnGhost,children:"Cancel"})]})]}),r.jsx("div",{className:se.body,children:r.jsxs("div",{className:se.formContent,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-name",children:"Name"}),r.jsx("input",{id:"env-create-name",type:"text",value:N,onChange:le=>w(le.target.value),placeholder:"Environment name...",autoFocus:!0,className:se.nameInput,"data-testid":"env-create-name",onKeyDown:le=>{le.key==="Enter"&&ue()&&Fe()}})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),r.jsxs("select",{id:"env-create-adapter",value:j,onChange:le=>{C(le.target.value),le.target.value==="codespace"&&u()},className:se.adapterSelect,"data-testid":"env-create-adapter",children:[r.jsx("option",{value:"local",children:"local"}),r.jsx("option",{value:"ssh",children:"ssh"}),r.jsx("option",{value:"docker",children:"docker"}),r.jsx("option",{value:"codespace",children:"codespace"})]})]}),j==="local"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-host",children:"Host"}),r.jsx("input",{id:"env-create-host",type:"text",value:D,onChange:le=>I(le.target.value),placeholder:"Host (optional)...",className:se.fieldInput,"data-testid":"env-create-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-port",children:"Port"}),r.jsx("input",{id:"env-create-port",type:"number",min:Bc,max:Lc,value:R,onChange:le=>E(le.target.value),placeholder:"Port (optional)...",className:se.fieldInput,"data-testid":"env-create-port"})]})]}),j==="ssh"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-host",children:"Host"}),r.jsx("input",{id:"env-create-host",type:"text",value:D,onChange:le=>I(le.target.value),placeholder:"Host (required)...",className:se.fieldInput,"data-testid":"env-create-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-user",children:"User"}),r.jsx("input",{id:"env-create-user",type:"text",value:q,onChange:le=>$(le.target.value),placeholder:"User (optional)...",className:se.fieldInput,"data-testid":"env-create-user"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-port",children:"SSH Port"}),r.jsx("input",{id:"env-create-port",type:"number",min:Bc,max:Lc,value:R,onChange:le=>E(le.target.value),placeholder:"SSH port (optional)...",className:se.fieldInput,"data-testid":"env-create-port"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-identity",children:"Identity File"}),r.jsx("input",{id:"env-create-identity",type:"text",value:Y,onChange:le=>Z(le.target.value),placeholder:"Identity file (optional)...",className:se.fieldInput,"data-testid":"env-create-identity"})]})]}),j==="docker"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-image",children:"Image"}),r.jsx("input",{id:"env-create-image",type:"text",value:te,onChange:le=>ae(le.target.value),placeholder:"Image (optional)...",className:se.fieldInput,"data-testid":"env-create-image"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-repo",children:"Repo"}),r.jsx("input",{id:"env-create-repo",type:"text",value:me,onChange:le=>ie(le.target.value),placeholder:"Repo (optional)...",className:se.fieldInput,"data-testid":"env-create-repo"})]})]}),j==="codespace"&&r.jsx(x5,{codespaceName:Q,onCodespaceNameChange:B,envName:N,onEnvNameChange:w,codespaces:d,codespaceError:p,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v})]})})]})}const k5="_group_1iprv_1",S5="_groupTitle_1iprv_8",T5="_shortcutList_1iprv_17",N5="_shortcutRow_1iprv_23",j5="_keys_1iprv_36",w5="_kbd_1iprv_43",C5="_description_1iprv_60",ai={group:k5,groupTitle:S5,shortcutList:T5,shortcutRow:N5,keys:j5,kbd:w5,description:C5},E5=[{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 A5(){return r.jsxs("section",{className:pe.section,"data-testid":"keyboard-shortcuts-panel",children:[r.jsx("h3",{className:pe.sectionTitle,children:"Keyboard Shortcuts"}),r.jsx("p",{className:pe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),E5.map(t=>r.jsxs("div",{className:ai.group,children:[r.jsx("h4",{className:ai.groupTitle,children:t.title}),r.jsx("div",{className:ai.shortcutList,children:t.shortcuts.map(s=>r.jsxs("div",{className:ai.shortcutRow,children:[r.jsx("span",{className:ai.keys,children:s.keys.map(i=>r.jsx("kbd",{className:ai.kbd,children:i},i))}),r.jsx("span",{className:ai.description,children:s.description})]},s.description))})]},t.title))]})}const D5="_workpadSection_y8nj9_1",R5="_workpadLabel_y8nj9_9",M5="_workpadStatus_y8nj9_17",I5="_workpadSummary_y8nj9_23",O5="_workpadExtra_y8nj9_29",Sa={workpadSection:D5,workpadLabel:R5,workpadStatus:M5,workpadSummary:I5,workpadExtra:O5};function B5({workpad:t}){if(!t)return;let s;try{const i=JSON.parse(t);if(i==null||typeof i!="object"||Array.isArray(i))return;s=i}catch{return r.jsxs("div",{className:Sa.workpadSection,"data-testid":"workpad-panel",children:[r.jsx("div",{className:Sa.workpadLabel,children:"Workpad"}),r.jsx("div",{className:Sa.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return r.jsxs("div",{className:Sa.workpadSection,"data-testid":"workpad-panel",children:[r.jsx("div",{className:Sa.workpadLabel,children:"Workpad"}),s.status&&r.jsx("div",{className:Sa.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&r.jsx("div",{className:Sa.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&r.jsx("div",{className:Sa.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const L5=[{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 z5({credentialProviders:t,onUpdateCredentialProviders:s}){const i=(o,c)=>{const u={...t};o==="claude"?u.claude=c:u[o]=c,s(u)};return r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Credential Providers"}),r.jsx("p",{className:pe.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),r.jsx("div",{className:pe.tokenList,children:L5.map(o=>r.jsxs("div",{className:pe.tokenRow,children:[r.jsx("span",{className:pe.tokenName,children:o.label}),r.jsx("span",{className:pe.tokenTarget,children:o.description}),r.jsx("select",{className:pe.select,value:t[o.key],onChange:c=>i(o.key,c.target.value),children:o.options.map(c=>r.jsx("option",{value:c.value,children:c.label},c.value))})]},o.key))})]})}const U5="_container_10efq_1",$5="_header_10efq_7",P5="_list_10efq_105",V5="_card_10efq_111",H5="_cardHeader_10efq_125",q5="_cardTitle_10efq_135",G5="_defaultBadge_10efq_141",F5="_cardActions_10efq_155",Z5="_description_10efq_160",K5="_meta_10efq_166",Y5="_empty_10efq_212",J5="_typeBadge_10efq_362",Vn={container:U5,header:$5,list:P5,card:V5,cardHeader:H5,cardTitle:q5,defaultBadge:G5,cardActions:F5,description:Z5,meta:K5,empty:Y5,typeBadge:J5};function W5({personas:t,appDefaultPersonaId:s,onDeletePersona:i,onSetAppDefaultPersonaId:o,onNavigateToNew:c,onNavigateToPersona:u}){const[d,p]=_.useState(null),h=d?t.find(v=>v.id===d):void 0,g=async v=>{await i(v),p(null)};return r.jsxs("div",{className:Vn.container,children:[r.jsxs("div",{className:Vn.header,children:[r.jsx("h2",{children:"Personas"}),r.jsx(Ps,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?r.jsx("p",{className:Vn.empty,children:"No personas yet. Create one to get started."}):r.jsx("div",{className:Vn.list,children:t.map(v=>{const b=s===v.id,y=v.type==="script";return r.jsxs("div",{className:Vn.card,"data-testid":`persona-card-${v.id}`,onClick:()=>u(v.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),u(v.id))},children:[r.jsxs("div",{className:Vn.cardHeader,children:[r.jsxs("span",{className:Vn.cardTitle,children:[r.jsx("strong",{children:v.name}),r.jsx("span",{className:Vn.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:y?"Script":"Agent"}),b&&r.jsx("span",{className:Vn.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),r.jsxs("div",{className:Vn.cardActions,onClick:k=>k.stopPropagation(),children:[!b&&r.jsx(Ps,{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"}),r.jsx(Ps,{variant:"ghost",size:"sm",onClick:()=>u(v.id),children:"Edit"}),r.jsx(Ps,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&r.jsx("p",{className:Vn.description,children:v.description}),r.jsxs("div",{className:Vn.meta,children:[v.runtime&&r.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&r.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&r.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),r.jsx(pi,{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:()=>p(null)})]})}const X5="_container_uy08i_1",Q5="_header_uy08i_7",eB="_count_uy08i_13",tB="_presets_uy08i_18",nB="_presetButton_uy08i_24",sB="_filterInput_uy08i_41",aB="_groups_uy08i_53",iB="_group_uy08i_53",oB="_groupHeader_uy08i_68",rB="_groupName_uy08i_77",lB="_groupCount_uy08i_81",cB="_toolList_uy08i_87",uB="_toolItem_uy08i_95",dB="_toolName_uy08i_103",on={container:X5,header:Q5,count:eB,presets:tB,presetButton:nB,filterInput:sB,groups:aB,group:iB,groupHeader:oB,groupName:rB,groupCount:lB,toolList:cB,toolItem:uB,toolName:dB},fB=(()=>{const t=new Map;for(const s of qb){const i=s==="get_version_status"?"version":s.split("_")[0];t.has(i)||t.set(i,[]),t.get(i).push(s)}return[...t.entries()].sort(([s],[i])=>s.localeCompare(i)).map(([s,i])=>({group:s,tools:i.sort()}))})(),pB=[{name:"default",label:"Default",tools:Gb},{name:"worker",label:"Worker",tools:KS},{name:"orchestrator",label:"Orchestrator",tools:YS},{name:"admin",label:"Admin",tools:JS}];function Nb({selectedTools:t,onChange:s,disabled:i}){const[o,c]=_.useState(""),u=_.useMemo(()=>new Set(t),[t]),d=_.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]),p=_.useCallback((v,b)=>{if(i)return;const y=new Set(u);for(const k of v)b?y.delete(k):y.add(k);s([...y].sort())},[u,s,i]),h=_.useCallback(v=>{i||s([...v].sort())},[s,i]),g=o.toLowerCase();return r.jsxs("div",{className:on.container,"data-testid":"mcp-tool-selector",children:[r.jsx("div",{className:on.header,children:r.jsx("span",{className:on.count,children:t.length===0?`Using default (${Gb.length} tools)`:`${t.length} of ${qb.size} tools selected`})}),r.jsxs("div",{className:on.presets,"data-testid":"mcp-tool-presets",children:[pB.map(v=>r.jsx("button",{type:"button",className:on.presetButton,disabled:i,onClick:()=>h(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),r.jsx("button",{type:"button",className:on.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),r.jsx("input",{type:"text",className:on.filterInput,placeholder:"Filter tools...",value:o,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),r.jsx("div",{className:on.groups,children:fB.map(({group:v,tools:b})=>{const y=g?b.filter(S=>S.toLowerCase().includes(g)):b;if(y.length===0)return null;const k=y.every(S=>u.has(S));return r.jsxs("div",{className:on.group,"data-testid":`tool-group-${v}`,children:[r.jsxs("label",{className:on.groupHeader,children:[r.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(y,k),disabled:i,"data-testid":`group-toggle-${v}`}),r.jsx("span",{className:on.groupName,children:v}),r.jsxs("span",{className:on.groupCount,children:["(",y.filter(S=>u.has(S)).length,"/",y.length,")"]})]}),r.jsx("div",{className:on.toolList,children:y.map(S=>r.jsxs("label",{className:on.toolItem,children:[r.jsx("input",{type:"checkbox",checked:u.has(S),onChange:()=>d(S),disabled:i,"data-testid":`tool-${S}`}),r.jsx("span",{className:on.toolName,children:S})]},S))})]},v)})})]})}const mB="_nav_1bhou_1",hB="_tab_1bhou_24",gB="_tabIcon_1bhou_62",vB="_tabActive_1bhou_68",Sc={nav:mB,tab:hB,tabIcon:gB,tabActive:vB},$s=[{path:"credentials",label:"Credentials",icon:r.jsx(a2,{size:Mt})},{path:"personas",label:"Personas",icon:r.jsx(A2,{size:Mt})},{path:"appearance",label:"Appearance",icon:r.jsx(_2,{size:Mt})},{path:"shortcuts",label:"Shortcuts",icon:r.jsx(o2,{size:Mt})},{path:"about",label:"About",icon:r.jsx(Pp,{size:Mt})}];function yB(){var d;const t=Pt(),s=yt(),i=_.useRef(null),o=((d=$s.find(p=>{const h=`${fo}/${p.path}`;return t.pathname===h||t.pathname.startsWith(`${h}/`)}))==null?void 0:d.path)??$s[0].path,c=_.useCallback(p=>{s(`${fo}/${p}`)},[s]),u=_.useCallback(p=>{var k,S;const h=(k=i.current)==null?void 0:k.querySelectorAll('[role="tab"]');if(!h)return;const g=Array.from(h).findIndex(N=>N===document.activeElement),v=g>=0?g:$s.findIndex(N=>N.path===o);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%$s.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+$s.length)%$s.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=$s.length-1;else return;const y=$s[b].path;s(`${fo}/${y}`),(S=h[b])==null||S.focus()},[o,s]);return r.jsx("nav",{className:Sc.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:$s.map(p=>{const h=p.path===o;return r.jsxs("button",{role:"tab",type:"button","aria-selected":h,tabIndex:h?0:-1,className:`${Sc.tab} ${h?Sc.tabActive:""}`,onClick:()=>c(p.path),children:[r.jsx("span",{className:Sc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function bB({tasks:t,taskStatusById:s,sessionStatusByTaskId:i}){const o=new Map;for(const u of t)if(u.parentTaskId){const d=o.get(u.parentTaskId);d?d.push(u):o.set(u.parentTaskId,[u])}const c=new Map(qv.map(u=>[u,[]]));for(const u of t){const d=Vr(u.status),p=u.dependsOn.length>0&&u.dependsOn.some(S=>s.get(S)!=="complete"),h=o.get(u.id)??[],g=h.length,v=h.filter(S=>S.status==="complete").length;let b;if(d==="paused"&&i){const S=i.get(u.id);S==="idle"?b="Needs input":S==="completed"&&(b="Ready to complete")}const y={task:u,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:b},k=c.get(d);k?k.push(y):c.get("not_started").push(y)}for(const u of c.values())u.sort((d,p)=>d.task.sortOrder-p.task.sortOrder);return qv.map(u=>{const d=Aa(u);return{status:u,label:d.label,style:d,tasks:c.get(u)??[]}})}const _B="_boardContainer_1c4y1_1",xB="_column_1c4y1_17",kB="_columnHeader_1c4y1_34",SB="_columnIcon_1c4y1_47",TB="_columnLabel_1c4y1_52",NB="_columnCount_1c4y1_57",jB="_cardList_1c4y1_67",wB="_emptyPlaceholder_1c4y1_76",CB="_card_1c4y1_67",EB="_cardHeader_1c4y1_107",AB="_cardStatusIcon_1c4y1_113",DB="_cardTitle_1c4y1_119",RB="_cardBadges_1c4y1_127",MB="_badge_1c4y1_134",IB="_blockedBadge_1c4y1_146",OB="_childBadge_1c4y1_151",BB="_depBadge_1c4y1_155",LB="_parentBadge_1c4y1_159",zB="_pausedSubBadge_1c4y1_166",UB="_personaBadge_1c4y1_170",$B="_envBadge_1c4y1_174",PB="_emptyCta_1c4y1_178",VB="_ctaButton_1c4y1_188",HB="_ctaDescription_1c4y1_204",nt={boardContainer:_B,column:xB,columnHeader:kB,columnIcon:SB,columnLabel:TB,columnCount:NB,cardList:jB,emptyPlaceholder:wB,card:CB,cardHeader:EB,cardStatusIcon:AB,cardTitle:DB,cardBadges:RB,badge:MB,blockedBadge:IB,childBadge:OB,depBadge:BB,parentBadge:LB,pausedSubBadge:zB,personaBadge:UB,envBadge:$B,emptyCta:PB,ctaButton:VB,ctaDescription:HB};function qB({workspaceId:t,environmentId:s,tasks:i,sessions:o,personas:c,environments:u}){const d=yt(),p=_.useMemo(()=>i.filter(y=>y.workspaceId===t),[i,t]),h=_.useMemo(()=>new Map(i.map(y=>[y.id,y.status])),[i]),g=_.useMemo(()=>new Map(p.map(y=>[y.id,y])),[p]),v=_.useMemo(()=>{const y=new Map(o.map(C=>[C.id,C])),k=new Map(c.map(C=>[C.id,C])),S=new Map(u.map(C=>[C.id,C])),N=new Map,w=new Map,j=new Map;for(const C of p)if(C.latestSessionId){const D=y.get(C.latestSessionId);if(D){if(N.set(C.id,D.endReason||D.status),D.personaId){const I=k.get(D.personaId);I&&w.set(C.id,I.name)}if(D.environmentId){const I=S.get(D.environmentId);I&&j.set(C.id,I.displayName)}}}return{sessionStatusByTaskId:N,personaNameByTaskId:w,environmentNameByTaskId:j}},[p,o,c,u]),b=_.useMemo(()=>bB({tasks:p,taskStatusById:h,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,h,v]);return p.length===0?r.jsxs("div",{className:nt.emptyCta,"data-testid":"board-empty-cta",children:[r.jsx("button",{className:nt.ctaButton,onClick:()=>d(gi(t,void 0,s)),children:"Create Task"}),r.jsx("div",{className:nt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):r.jsx("div",{className:nt.boardContainer,"data-testid":"board-container",children:b.map(y=>r.jsxs("section",{className:nt.column,"data-testid":`board-column-${y.status}`,"aria-label":`${y.label}, ${y.tasks.length} ${y.tasks.length===1?"task":"tasks"}`,children:[r.jsxs("div",{className:nt.columnHeader,children:[r.jsx("span",{className:nt.columnIcon,style:{color:y.style.color},children:y.style.icon}),r.jsx("span",{className:nt.columnLabel,children:y.label}),r.jsx("span",{className:nt.columnCount,"data-testid":`board-count-${y.status}`,children:y.tasks.length})]}),r.jsx("div",{className:nt.cardList,children:y.tasks.length===0?r.jsx("div",{className:nt.emptyPlaceholder,children:"No tasks"}):r.jsx(vs,{mode:"popLayout",children:y.tasks.map(k=>r.jsx(It.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:r.jsx(GB,{boardTask:k,tasksById:g,personaName:v.personaNameByTaskId.get(k.task.id),envName:v.environmentNameByTaskId.get(k.task.id),onClick:()=>d(as(k.task.id,void 0,t,s))})},k.task.id))})})]},y.status))})}function GB({boardTask:t,tasksById:s,personaName:i,envName:o,onClick:c}){const{task:u,isBlocked:d,childCount:p,doneChildCount:h,pausedSubBadge:g}=t,v=Aa(u.status),b=u.parentTaskId?s.get(u.parentTaskId):void 0;return r.jsxs("div",{className:nt.card,tabIndex:0,role:"button","data-testid":`board-card-${u.id}`,onClick:c,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),c())},children:[r.jsxs("div",{className:nt.cardHeader,children:[r.jsx("span",{className:nt.cardStatusIcon,style:{color:v.color},children:v.icon}),r.jsx("span",{className:nt.cardTitle,children:u.title})]}),r.jsxs("div",{className:nt.cardBadges,children:[b&&r.jsx("span",{className:`${nt.badge} ${nt.parentBadge}`,title:b.title,children:b.title}),p>0&&r.jsxs("span",{className:`${nt.badge} ${nt.childBadge}`,children:[h,"/",p]}),d&&r.jsx("span",{className:`${nt.badge} ${nt.blockedBadge}`,children:"blocked"}),u.dependsOn.length>0&&!d&&r.jsx("span",{className:`${nt.badge} ${nt.depBadge}`,children:"dep"}),g&&r.jsx("span",{className:`${nt.badge} ${nt.pausedSubBadge}`,children:g}),i&&r.jsx("span",{className:`${nt.badge} ${nt.personaBadge}`,children:i}),o&&r.jsx("span",{className:`${nt.badge} ${nt.envBadge}`,children:o})]})]})}const FB="_formContent_ymnez_1",ZB="_section_ymnez_13",KB="_label_ymnez_19",YB="_titleInput_ymnez_26",JB="_descriptionTextarea_ymnez_58",WB="_selectField_ymnez_94",XB="_checkboxRow_ymnez_128",QB="_checkboxLabel_ymnez_141",e8="_fieldError_ymnez_146",ht={formContent:FB,section:ZB,label:KB,titleInput:YB,descriptionTextarea:JB,selectField:WB,checkboxRow:XB,checkboxLabel:QB,fieldError:e8};function t8(t,s){return{name:(t==null?void 0:t.name)??"",description:(t==null?void 0:t.description)??"",repoUrl:(t==null?void 0:t.repoUrl)??"",environmentId:(t==null?void 0:t.environmentId)??s??"",defaultPersonaId:(t==null?void 0:t.defaultPersonaId)??"",useWorktrees:(t==null?void 0:t.useWorktrees)??!0,workingDirectory:(t==null?void 0:t.workingDirectory)??""}}const n8=100;function s8({values:t,onChange:s,environments:i,personas:o,errors:c,disabled:u,autoFocusName:d}){const p=(h,g)=>{s({...t,[h]:g})};return r.jsxs("div",{className:ht.formContent,children:[r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-name",children:"Name"}),r.jsx("input",{id:"ws-name",className:ht.titleInput,type:"text",value:t.name,onChange:h=>p("name",h.target.value),placeholder:"Workspace name",maxLength:n8,autoFocus:d,disabled:u,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&r.jsx("span",{className:ht.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-description",children:"Description"}),r.jsx("textarea",{id:"ws-description",className:ht.descriptionTextarea,value:t.description,onChange:h=>p("description",h.target.value),placeholder:"Optional description (Markdown supported)",disabled:u,"data-testid":"workspace-form-description"})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-repo",children:"Repository URL"}),r.jsx("input",{id:"ws-repo",className:ht.titleInput,type:"text",value:t.repoUrl,onChange:h=>p("repoUrl",h.target.value),placeholder:"https://github.com/org/repo",disabled:u,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&r.jsx("span",{className:ht.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-environment",children:"Environment"}),r.jsxs("select",{id:"ws-environment",className:ht.selectField,value:t.environmentId,onChange:h=>p("environmentId",h.target.value),disabled:u,"data-testid":"workspace-form-environment",children:[r.jsx("option",{value:"",children:"Select environment…"}),i.map(h=>r.jsx("option",{value:h.id,children:h.displayName||h.id},h.id))]}),(c==null?void 0:c.environmentId)&&r.jsx("span",{className:ht.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-persona",children:"Default Persona"}),r.jsxs("select",{id:"ws-persona",className:ht.selectField,value:t.defaultPersonaId,onChange:h=>p("defaultPersonaId",h.target.value),disabled:u,"data-testid":"workspace-form-persona",children:[r.jsx("option",{value:"",children:"(Inherit)"}),o.map(h=>r.jsx("option",{value:h.id,children:h.name},h.id))]})]}),r.jsx("div",{className:ht.section,children:r.jsxs("label",{className:ht.checkboxRow,children:[r.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:h=>p("useWorktrees",h.target.checked),disabled:u,"data-testid":"workspace-form-worktrees"}),r.jsx("span",{className:ht.checkboxLabel,children:"Enable worktree isolation"})]})}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-workdir",children:"Working Directory"}),r.jsx("input",{id:"ws-workdir",className:ht.titleInput,type:"text",value:t.workingDirectory,onChange:h=>p("workingDirectory",h.target.value),placeholder:"Default (server default)",disabled:u,"data-testid":"workspace-form-workdir"})]})]})}const ux=_.createContext(void 0),a8=4e3;function i8({children:t}){const[s,i]=_.useState([]),o=_.useRef(0),c=_.useCallback(d=>{i(p=>p.filter(h=>h.id!==d))},[]),u=_.useCallback((d,p="info",h=a8)=>{const g=`toast-${++o.current}`;i(v=>[...v,{id:g,message:d,variant:p,duration:h}])},[]);return r.jsx(ux.Provider,{value:{toasts:s,showToast:u,dismissToast:c},children:t})}function gn(){const t=_.useContext(ux);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const Lp="grackle-theme",dx="grackle-prefer-system",fx="(prefers-color-scheme: dark)";let jr=[],zc;function ap(){zc=void 0;for(const t of jr)t()}function zp(){return typeof window>"u"?!1:window.matchMedia(fx).matches}function Rr(){if(typeof localStorage>"u")return Tb;try{const t=localStorage.getItem(Lp);if(t!==null&&rx.has(t))return t}catch{}return Tb}function Jc(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(dx)==="true"}catch{return!1}}function Up(t){return du.find(s=>s.variantLightId===t||s.variantDarkId===t)}function px(t,s){const i=Bp(t);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?zp()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const o=Up(t);if(o!=null&&o.variantLightId&&o.variantDarkId)return zp()?o.variantDarkId:o.variantLightId}return t}function ao(t,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=px(t,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&ao(Rr(),Jc());function o8(){return zc===void 0&&(zc={themeId:Rr(),systemDark:zp(),preferSystem:Jc()}),zc}function r8(t){return jr=[...jr,t],()=>{jr=jr.filter(s=>s!==t)}}function l8(){const t=_.useSyncExternalStore(r8,o8),{themeId:s,preferSystem:i}=t,o=px(s,i),c=_.useCallback(d=>{if(rx.has(d)){try{localStorage.setItem(Lp,d)}catch{}ao(d,Jc(),!0),ap()}},[]),u=_.useCallback(d=>{try{localStorage.setItem(dx,d?"true":"false")}catch{}if(d){const p=Rr(),h=Bp(p);if(h!=null&&h.hidden){const g=Up(p);if(g)try{localStorage.setItem(Lp,g.id)}catch{}}}ao(Rr(),d,!0),ap()},[]);return _.useEffect(()=>{ao(s,i)},[s,i]),_.useEffect(()=>{if(typeof window>"u")return;const d=window.matchMedia(fx),p=()=>{const h=Rr(),g=Jc();if(g){const v=Bp(h);if(v!=null&&v.variantDarkId&&v.variantLightId&&ao(h,g),v!=null&&v.hidden){const b=Up(h);b!=null&&b.variantDarkId&&b.variantLightId&&ao(h,g)}}ap()};return d.addEventListener("change",p),()=>{d.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:o,preferSystem:i,setPreferSystem:u}}const mx=_.createContext(void 0);function c8({children:t}){const s=l8();return r.jsx(mx.Provider,{value:s,children:t})}function hx(){const t=_.useContext(mx);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const gx=_.createContext(void 0),vx=_.createContext(void 0);function u8({children:t}){const[s,i]=_.useState(void 0),o=_.useCallback(c=>{i(c)},[]);return r.jsx(vx.Provider,{value:o,children:r.jsx(gx.Provider,{value:s,children:t})})}function d8(){return _.useContext(gx)}function f8(){const t=_.useContext(vx);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const Lm=_.createContext(void 0);function lt(){const t=_.useContext(Lm);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function yx(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function bx(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function p8(t){return yx(t)&&typeof t.sessionId=="string"&&typeof t.eventType=="string"&&typeof t.timestamp=="string"&&typeof t.content=="string"&&(t.raw===void 0||typeof t.raw=="string")}const m8=new Set(["off","subscription","api_key"]),Tc=new Set(["off","on"]);function h8(t){return yx(t)&&m8.has(t.claude)&&Tc.has(t.github)&&Tc.has(t.copilot)&&Tc.has(t.codex)&&Tc.has(t.goose)}function _x(t){switch(t){case"waiting_input":return"idle";case"completed":return"stopped";case"killed":return"stopped";case"failed":return"stopped";case"interrupted":return"stopped";case"terminated":return"stopped";default:return t}}function xx(t){switch(t){case"completed":return"completed";case"killed":return"killed";case"failed":return"interrupted";case"interrupted":return"interrupted";case"terminated":return"terminated";default:return}}const so=5e3;function g8(t,s){const i=[];let o=t;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 Zs={label:"Home",url:fi};function v8(t){return t?[Zs,{label:"Settings",url:fo},{label:t,url:void 0}]:[Zs,{label:"Settings",url:void 0}]}const zm={label:"Environments",url:po};function y8(){return[Zs,{label:"Environments",url:void 0}]}function b8(){return[Zs,{label:"New Chat",url:void 0}]}function _8(t){return[Zs,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function x8(t,s,i,o){const c=i.find(d=>d.id===t),u=o.find(d=>d.id===s);return[Zs,zm,{label:(u==null?void 0:u.displayName)??"Environment",url:di(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function k8(t,s,i,o,c){const u=g8(t,c),d=c.get(t),p=d==null?void 0:d.workspaceId,h=p?i.find(k=>k.id===p):void 0,g=s??(h==null?void 0:h.environmentId),v=g?o.find(k=>k.id===g):void 0,b=[Zs];v&&g&&(b.push(zm),b.push({label:v.displayName,url:di(g)})),h&&g&&b.push({label:h.name,url:ui(h.id,g)});for(let k=0;k<u.length-1;k++)b.push({label:u[k].title,url:as(u[k].id,void 0,p,g)});const y=u[u.length-1];return b.push({label:(y==null?void 0:y.title)??t,url:void 0}),b}const S8={label:"Findings",url:au};function T8(){return[Zs,{label:"Findings",url:void 0}]}function kx(t,s,i,o,c){const u=[Zs];if(s&&i){const d=o.find(h=>h.id===s),p=c.find(h=>h.id===i);u.push(zm),p&&u.push({label:p.displayName,url:di(i)}),d&&u.push({label:d.name,url:ui(s,i)}),u.push({label:"Findings",url:zj(s,i)})}else u.push(S8);return u.push({label:t,url:void 0}),u}function Um(t){const s=[];for(const i of t){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 Nc(t){if(typeof t.id=="string")return t.id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const i=t.item;if(i&&typeof i.id=="string")return i.id}function N8(t){if(typeof t.tool_use_id=="string")return t.tool_use_id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const i=t.item;if(i&&typeof i.id=="string")return i.id}function $m(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const i=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const b=s.get(v),y=b?Nc(b):void 0;if(y)try{const k=JSON.parse(v.content);i.set(y,{tool:k.tool,args:k.args})}catch{}}const o=new Set,c=new Set,u=t.map((v,b)=>{if(v.eventType!=="tool_result")return v;const y=s.get(v),k=y?N8(y):void 0;if(!k)return v;const S=i.get(k);if(!S)return v;o.add(k),c.add(b);let N;const w=v.content.trim();if(w.startsWith("{"))try{const j=JSON.parse(w);typeof j.detailedContent=="string"&&(N=j.detailedContent)}catch{}return{...v,toolUseCtx:{...S,detailedResult:N}}}),d=[];for(let v=0;v<u.length;v++){if(u[v].eventType!=="tool_use")continue;const b=s.get(u[v]),y=b?Nc(b):void 0;y&&o.has(y)||d.push(v)}const p=[];for(let v=0;v<u.length;v++)u[v].eventType!=="tool_result"||c.has(v)||p.push(v);let h=0;for(const v of d){for(;h<p.length&&p[h]<v;)h++;if(h>=p.length)break;const b=p[h];if(b!==v+1)continue;const y=u[v],k=u[b];let S;try{const N=JSON.parse(y.content);S={tool:N.tool,args:N.args}}catch{}if(S){let N;const w=k.content.trim();if(w.startsWith("{"))try{const D=JSON.parse(w);typeof D.detailedContent=="string"&&(N=D.detailedContent)}catch{}u[b]={...k,toolUseCtx:{...S,detailedResult:N}},c.add(b);const j=s.get(y),C=j?Nc(j):void 0;C?o.add(C):(o.add(`__seq_${v}`),s.set(y,{...j??{},__seqId:`__seq_${v}`})),h++}}const g=u.filter(v=>{if(v.eventType!=="tool_use")return!0;const b=s.get(v);if(!b)return!0;const y=Nc(b);if(y&&o.has(y))return!1;const k=b.__seqId;return!(k&&o.has(k))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let b=!1;for(let y=v+1;y<g.length;y++)if(g[y].eventType!=="tool_use"){b=!0;break}b&&(g[v]={...g[v],settled:!0})}return g}function j8(t,s,i){const o=t.filter(h=>h.status==="running"||h.status==="idle"||h.status==="waiting").length,c=Sx(s),u=s.filter(h=>$p(h,c)).length,d=s.filter(h=>h.status==="paused"||h.status==="failed"||$p(h,c)).length,p=i.filter(h=>h.status==="disconnected"||h.status==="error").length;return{activeSessions:o,blockedTasks:u,attentionTasks:d,unhealthyEnvironments:p}}function Sx(t){const s=new Map;for(const i of t)s.set(i.id,i.status);return s}function $p(t,s){return t.dependsOn.some(i=>s.get(i)!=="complete")}function w8(t,s){var d;const i=new Map;for(const p of s)i.set(p.id,p);const o=Sx(t),c=[];for(const p of t){const h=p.workspaceId?((d=i.get(p.workspaceId))==null?void 0:d.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:h}):$p(p,o)?c.push({task:p,reason:"blocked",workspaceName:h}):p.status==="paused"&&c.push({task:p,reason:"paused",workspaceName:h})}const u={failed:0,blocked:1,paused:2};return c.sort((p,h)=>(u[p.reason]??3)-(u[h.reason]??3)),c}function C8(t,s){const i=new Map;for(const o of s)i.set(o.id,o);return t.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 E8(t,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 t.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 ps=[{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
255
255
  export function verifyToken(req: Request, res: Response, next: NextFunction): void {
256
256
  const header = req.headers.authorization;
257
257
  if (!header?.startsWith("Bearer ")) {
@@ -692,4 +692,4 @@ const grackle = await host.mcpServer({
692
692
  url: env.vars.GRACKLE_MCP_URL,
693
693
  });
694
694
 
695
- $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),E==="agent"&&r.jsxs("div",{children:[r.jsx("label",{children:"Allowed MCP Tools"}),r.jsx(Nb,{selectedTools:Z,onChange:L=>{te(L),de(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,L),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Te&&!je&&r.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,r.jsx(pi,{isOpen:ae,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:ve,onCancel:()=>me(!1)})]})}function l9(){const{themeId:t,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=hx();return r.jsx(MO,{themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c})}function c9(){const[t,s]=_.useState(void 0);return _.useEffect(()=>{let i=!1;return xe.getVersionStatus({}).then(o=>{i||s({currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker})},()=>{}),()=>{i=!0}},[]),t}function u9(){const{connected:t,environments:s,sessions:i}=lt(),o=c9();return r.jsxs(r.Fragment,{children:[o&&r.jsx(LI,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),r.jsx(IO,{connected:t,environments:s,sessions:i})]})}function d9(){return r.jsx(A5,{})}const Ub=gi();function f9(){const t=yt();return qs({key:"?"},()=>{t(Ij)}),qs({key:"n"},()=>{t(Ub)}),qs({key:"N"},()=>{t(Ub)}),r.jsx(r.Fragment,{})}function Yr(t){const s=f8();_.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function p9(){const{workspaces:t,tasks:s}=lt(),i=_.useMemo(()=>r.jsx(pI,{workspaces:t,tasks:s}),[t,s]);return Yr(i),r.jsx(Ma,{})}function m9(){const{environments:t}=lt(),s=_.useMemo(()=>r.jsx(S4,{environments:t}),[t]);return Yr(s),r.jsx(Ma,{})}function h9(){const t=_.useMemo(()=>r.jsx(yB,{}),[]);return Yr(t),r.jsx(Ma,{})}function g9(){const{findings:t,loadFindings:s,loadAllFindings:i}=lt(),{workspaceId:o,environmentId:c}=is();_.useEffect(()=>{o?s(o):i()},[o,s,i]);const u=_.useMemo(()=>r.jsx(I4,{findings:t,workspaceId:o,environmentId:c}),[t,o,c]);return Yr(u),r.jsx(Ma,{})}function v9(){const{knowledge:t,workspaces:s}=lt(),i=_.useCallback(p=>{t.search(p)},[t]),o=_.useCallback(()=>{t.clearSearch()},[t]),c=_.useCallback(p=>{t.selectNode(p)},[t]),u=_.useCallback(p=>{t.loadRecent(p||void 0)},[t]),d=_.useMemo(()=>r.jsx(B6,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:i,onClearSearch:o,onSelectNode:c,onWorkspaceChange:u}),[t,s,i,o,c,u]);return Yr(d),r.jsx(Ma,{})}const y9="_container_ce571_1",b9="_title_ce571_6",$b={container:y9,title:b9};function Pb(){const{environmentId:t,workspaceId:s}=is(),{findings:i,loadFindings:o,workspaces:c,environments:u}=lt(),d=yt();_.useEffect(()=>{s&&o(s)},[s,o]);const p=_.useCallback(g=>{d(vp(g,s,t))},[d,s,t]),h=s&&t?kx("Findings",s,t,c,u).slice(0,-1):T8();return r.jsxs("div",{className:$b.container,"data-testid":"findings-list-page",children:[r.jsx(ys,{segments:h}),r.jsx("h1",{className:$b.title,children:"Findings"}),r.jsx(ox,{findings:i,onFindingClick:p})]})}const _9="_container_1wwpb_1",x9="_notFound_1wwpb_6",k9="_header_1wwpb_12",S9="_categoryBadge_1wwpb_19",T9="_title_1wwpb_28",N9="_content_1wwpb_35",j9="_tags_1wwpb_77",w9="_tag_1wwpb_77",C9="_meta_1wwpb_92",E9="_metaTimestamp_1wwpb_100",A9="_metaLink_1wwpb_105",rn={container:_9,notFound:x9,header:k9,categoryBadge:S9,title:T9,content:N9,tags:j9,tag:w9,meta:C9,metaTimestamp:E9,metaLink:A9};function Vb(){const{findingId:t,environmentId:s,workspaceId:i}=is(),{selectedFinding:o,findingLoading:c,loadFinding:u,workspaces:d,environments:p}=lt(),h=yt();if(_.useEffect(()=>{t&&u(t)},[t,u]),c)return r.jsx("div",{className:rn.container,"data-testid":"finding-detail-page",children:r.jsx("div",{className:rn.notFound,children:"Loading..."})});if(!o)return r.jsx("div",{className:rn.container,"data-testid":"finding-detail-page",children:r.jsx("div",{className:rn.notFound,children:"Finding not found."})});const g=kx(o.title,i,s,d,p),v=Yc(o.category);return r.jsxs("div",{className:rn.container,"data-testid":"finding-detail-page",children:[r.jsx(ys,{segments:g}),r.jsxs("div",{className:rn.header,children:[r.jsx("span",{className:rn.categoryBadge,style:{background:v.bg,color:v.text},children:o.category}),r.jsx("h1",{className:rn.title,children:o.title})]}),o.content&&r.jsx("div",{className:rn.content,children:r.jsx(Xc,{remarkPlugins:[Qc],children:o.content})}),o.tags.length>0&&r.jsx("div",{className:rn.tags,children:o.tags.map(b=>r.jsx("span",{className:rn.tag,children:b},b))}),r.jsxs("div",{className:rn.meta,children:[r.jsx("span",{className:rn.metaTimestamp,title:o.createdAt,children:Bm(o.createdAt)}),o.taskId&&r.jsx("button",{type:"button",className:rn.metaLink,onClick:()=>{h(as(o.taskId))},children:"View Task"}),o.sessionId&&r.jsx("button",{type:"button",className:rn.metaLink,onClick:()=>{h(Xp(o.sessionId))},children:"View Session"})]})]})}const D9="_wizard_1260s_1",R9="_container_1260s_10",M9="_stepContent_1260s_19",I9="_logoArea_1260s_28",O9="_logoImage_1260s_32",B9="_heading_1260s_41",L9="_tagline_1260s_49",z9="_subtitle_1260s_56",U9="_featureList_1260s_64",$9="_runtimeGrid_1260s_89",P9="_runtimeCard_1260s_101",V9="_runtimeName_1260s_133",H9="_runtimeDescription_1260s_139",q9="_buttonRow_1260s_144",G9="_primaryButton_1260s_151",F9="_ghostButton_1260s_185",Z9="_dots_1260s_213",K9="_dot_1260s_213",dt={wizard:D9,container:R9,stepContent:M9,logoArea:I9,logoImage:O9,heading:B9,tagline:L9,subtitle:z9,featureList:U9,runtimeGrid:$9,runtimeCard:P9,runtimeName:V9,runtimeDescription:H9,buttonRow:q9,primaryButton:G9,ghostButton:F9,dots:Z9,dot:K9};function Y9({onNext:t}){return r.jsxs("div",{className:dt.stepContent,"data-testid":"setup-welcome",children:[r.jsx("div",{className:dt.logoArea,children:r.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:dt.logoImage})}),r.jsx("h1",{className:dt.heading,children:"Welcome to Grackle"}),r.jsx("p",{className:dt.tagline,children:"Multi-agent orchestration for software teams"}),r.jsx("button",{type:"button",className:dt.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function J9({onNext:t,onBack:s}){return r.jsxs("div",{className:dt.stepContent,"data-testid":"setup-about",children:[r.jsx("h2",{className:dt.heading,children:"What is Grackle?"}),r.jsxs("ul",{className:dt.featureList,children:[r.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),r.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),r.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),r.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),r.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),r.jsxs("div",{className:dt.buttonRow,children:[r.jsx("button",{type:"button",className:dt.ghostButton,onClick:s,children:"Back"}),r.jsx("button",{type:"button",className:dt.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const W9=[{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 X9({currentRuntime:t,onFinish:s,onBack:i,finishDisabled:o}){const[c,u]=_.useState(t||"claude-code");return _.useEffect(()=>{t&&u(t)},[t]),r.jsxs("div",{className:dt.stepContent,"data-testid":"setup-runtime",children:[r.jsx("h2",{className:dt.heading,children:"Choose Your Runtime"}),r.jsx("p",{className:dt.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),r.jsx("div",{className:dt.runtimeGrid,children:W9.map(d=>r.jsxs("button",{type:"button",className:dt.runtimeCard,"data-selected":c===d.id,"aria-pressed":c===d.id,"data-testid":`runtime-card-${d.id}`,onClick:()=>u(d.id),children:[r.jsx("span",{className:dt.runtimeName,children:d.name}),r.jsx("span",{className:dt.runtimeDescription,children:d.description})]},d.id))}),r.jsxs("div",{className:dt.buttonRow,children:[r.jsx("button",{type:"button",className:dt.ghostButton,onClick:i,children:"Back"}),r.jsx("button",{type:"button",className:dt.primaryButton,onClick:()=>{s(c)},disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const Q9=3,Hb={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function e$(){const{personas:t,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=lt(),{showToast:c}=gn(),u=yt(),[d,p]=_.useState(0),[h,g]=_.useState(!1),v=t.find(y=>y.id==="claude-code"),b=_.useCallback(y=>{g(!0);const k=[];if(v&&y!==v.runtime){const N=Hb[y]??"sonnet";k.push(s(v.id,void 0,void 0,void 0,y,N))}const S=t.find(N=>N.id===Iv);if(S&&y!==S.runtime){const N=Hb[y]??"sonnet";k.push(s(Iv,void 0,void 0,void 0,y,N))}Promise.all(k).then(()=>i()).then(()=>{u("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),g(!1)})},[v,t,s,i,u,c]);return o===!0?r.jsx(ss,{to:"/",replace:!0}):r.jsx("div",{className:dt.wizard,"data-testid":"setup-wizard",children:r.jsxs("div",{className:dt.container,children:[r.jsx(vs,{mode:"wait",children:r.jsxs(It.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[d===0&&r.jsx(Y9,{onNext:()=>p(1)}),d===1&&r.jsx(J9,{onNext:()=>p(2),onBack:()=>p(0)}),d===2&&r.jsx(X9,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:b,onBack:()=>p(1),finishDisabled:!v||h})]},d)}),r.jsx("div",{className:dt.dots,children:Array.from({length:Q9},(y,k)=>r.jsx("span",{className:dt.dot,"data-active":k===d},k))})]})})}const t$="_root_zndgp_1",n$="_body_zndgp_7",s$="_main_zndgp_19",a$="_sidebarWrapper_zndgp_26",i$="_overlay_zndgp_51",wr={root:t$,body:n$,main:s$,sidebarWrapper:a$,overlay:i$},o$=_.lazy(()=>fT(()=>import("./KnowledgePage-B3FYOjkZ.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),Tx=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function r$(){const{connected:t,environments:s,sessions:i,tasks:o}=lt(),{toasts:c,dismissToast:u}=gn(),d=Pt(),p=d8(),h=p!==void 0,[g,v]=_.useState(!1),b=_.useCallback(()=>v(y=>!y),[]);return _.useEffect(()=>{v(!1)},[d.pathname]),_.useEffect(()=>{if(!g)return;const y=k=>{k.key==="Escape"&&v(!1)};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}},[g]),r.jsxs(r.Fragment,{children:[r.jsx(F6,{connected:t,environments:s,sessions:i,onToggleSidebar:h?b:void 0,sidebarOpen:g}),r.jsx(Q6,{}),r.jsxs("div",{className:wr.body,children:[h&&r.jsx("div",{className:wr.sidebarWrapper,"data-sidebar-open":g,children:r.jsx(i4,{content:p})}),h&&g&&r.jsx("div",{className:wr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),r.jsxs("div",{className:wr.main,children:[r.jsx(Ma,{}),r.jsx(p4,{sessions:i,tasks:o,environments:s})]})]}),r.jsx(jI,{toasts:c,onDismiss:u}),r.jsx(f9,{})]})}function l$(){const{lastSpawnedId:t,environments:s,tasks:i,connected:o,onboardingCompleted:c}=lt(),{showToast:u}=gn();cL(s,u),pL(i,u);const d=yt(),p=Pt();return _.useEffect(()=>{t&&!p.pathname.includes("/tasks/")&&d(Xp(t),{replace:!0})},[t,d,p.pathname]),o&&c===!1?r.jsx(ss,{to:"/setup",replace:!0}):r.jsx(u8,{children:r.jsxs("div",{className:wr.root,children:[Tx&&r.jsx(cw,{}),r.jsx(r$,{})]})})}function fp(){const{workspaceId:t}=is(),{workspaces:s}=lt(),i=Pt(),o=s.find(h=>h.id===t);if(!(o!=null&&o.environmentId))return s.length===0?void 0:r.jsx(ss,{to:"/environments",replace:!0});const c=encodeURIComponent(t),u=`/workspaces/${c}`,d=i.pathname.startsWith(u)?i.pathname.slice(u.length):"",p=`/environments/${encodeURIComponent(o.environmentId)}/workspaces/${c}${d}${i.search}${i.hash}`;return r.jsx(ss,{to:p,replace:!0})}function c$(){return r.jsxs(YN,{children:[r.jsx(Se,{path:"setup",element:r.jsx(e$,{})}),r.jsxs(Se,{element:r.jsx(l$,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(O7,{})}),r.jsx(Se,{path:"chat",element:r.jsx(q7,{})}),r.jsx(Se,{path:"sessions/new",element:r.jsx(G7,{})}),r.jsx(Se,{path:"sessions/:sessionId",element:r.jsx(K7,{})}),r.jsx(Se,{element:r.jsx(v9,{}),children:r.jsx(Se,{path:"knowledge",element:r.jsx(_.Suspense,{fallback:r.jsx(J1,{}),children:r.jsx(o$,{})})})}),r.jsxs(Se,{element:r.jsx(p9,{}),children:[r.jsx(Se,{path:"tasks",element:r.jsx(M7,{})}),r.jsx(Se,{path:"tasks/new",element:r.jsx(Ib,{})}),r.jsx(Se,{path:"tasks/:taskId",element:r.jsx(ja,{})}),r.jsx(Se,{path:"tasks/:taskId/edit",element:r.jsx(ja,{})}),r.jsx(Se,{path:"tasks/:taskId/stream",element:r.jsx(ja,{})}),r.jsx(Se,{path:"tasks/:taskId/findings",element:r.jsx(ja,{})})]}),r.jsxs(Se,{element:r.jsx(g9,{}),children:[r.jsx(Se,{path:"findings",element:r.jsx(Pb,{})}),r.jsx(Se,{path:"findings/:findingId",element:r.jsx(Vb,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:r.jsx(Pb,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:r.jsx(Vb,{})})]}),r.jsxs(Se,{element:r.jsx(m9,{}),children:[r.jsx(Se,{path:"workspaces",element:r.jsx(ss,{to:"/environments",replace:!0})}),r.jsx(Se,{path:"workspaces/new",element:r.jsx(lU,{})}),r.jsx(Se,{path:"workspaces/:workspaceId",element:r.jsx(fp,{})}),r.jsx(Se,{path:"workspaces/:workspaceId/tasks/:taskId",element:r.jsx(fp,{})}),r.jsx(Se,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:r.jsx(fp,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId",element:r.jsx(W7,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:r.jsx(Ib,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:r.jsx(ja,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:r.jsx(ja,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:r.jsx(ja,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:r.jsx(ja,{})}),r.jsxs(Se,{path:"environments",element:r.jsx(yU,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(I7,{})}),r.jsx(Se,{path:"new",element:r.jsx(pU,{})}),r.jsx(Se,{path:":environmentId",element:r.jsx(FU,{})}),r.jsx(Se,{path:":environmentId/edit",element:r.jsx(mU,{})})]})]}),r.jsx(Se,{element:r.jsx(h9,{}),children:r.jsxs(Se,{path:"settings",element:r.jsx(YU,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(ss,{to:"credentials",replace:!0})}),r.jsx(Se,{path:"environments",element:r.jsx(ss,{to:"/environments",replace:!0})}),r.jsx(Se,{path:"credentials",element:r.jsx(JU,{})}),r.jsx(Se,{path:"tokens",element:r.jsx(ss,{to:"../credentials",replace:!0})}),r.jsx(Se,{path:"personas",element:r.jsx(WU,{})}),r.jsx(Se,{path:"personas/new",element:r.jsx(zb,{})}),r.jsx(Se,{path:"personas/:personaId",element:r.jsx(zb,{})}),r.jsx(Se,{path:"appearance",element:r.jsx(l9,{})}),r.jsx(Se,{path:"shortcuts",element:r.jsx(d9,{})}),r.jsx(Se,{path:"about",element:r.jsx(u9,{})})]})}),r.jsx(Se,{path:"*",element:r.jsx(ss,{to:"/",replace:!0})})]})]})}const u$=1e4;function d$(){const{onboardingCompleted:t}=lt(),[s,i]=_.useState(!1);_.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>i(!0),u$);return()=>clearTimeout(c)},[t]);const o=t===void 0&&!s;return r.jsx(vs,{mode:"wait",children:o?r.jsx(It.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:r.jsx(J1,{})},"splash"):r.jsx(It.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:r.jsx(_j,{basename:"/".replace(/\/$/,""),children:r.jsx(c$,{})})},"app")})}function f$(){const t=Tx?U8:lL;return r.jsx(c8,{children:r.jsx(i8,{children:r.jsx(t,{children:r.jsx(d$,{})})})})}cT.createRoot(document.getElementById("root")).render(r.jsx(_.StrictMode,{children:r.jsx(f$,{})}));export{ys as B,v_ as K,lt as a,vp as f,Xp as s,as as t,yt as u};
695
+ $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),E==="agent"&&r.jsxs("div",{children:[r.jsx("label",{children:"Allowed MCP Tools"}),r.jsx(Nb,{selectedTools:Z,onChange:L=>{te(L),de(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,L),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Te&&!je&&r.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,r.jsx(pi,{isOpen:ae,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:ve,onCancel:()=>me(!1)})]})}function l9(){const{themeId:t,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=hx();return r.jsx(MO,{themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c})}function c9(){const[t,s]=_.useState(void 0);return _.useEffect(()=>{let i=!1;return xe.getVersionStatus({}).then(o=>{i||s({currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker})},()=>{}),()=>{i=!0}},[]),t}function u9(){const{connected:t,environments:s,sessions:i}=lt(),o=c9();return r.jsxs(r.Fragment,{children:[o&&r.jsx(LI,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),r.jsx(IO,{connected:t,environments:s,sessions:i})]})}function d9(){return r.jsx(A5,{})}const Ub=gi();function f9(){const t=yt();return qs({key:"?"},()=>{t(Ij)}),qs({key:"n"},()=>{t(Ub)}),qs({key:"N"},()=>{t(Ub)}),r.jsx(r.Fragment,{})}function Yr(t){const s=f8();_.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function p9(){const{workspaces:t,tasks:s}=lt(),i=_.useMemo(()=>r.jsx(pI,{workspaces:t,tasks:s}),[t,s]);return Yr(i),r.jsx(Ma,{})}function m9(){const{environments:t}=lt(),s=_.useMemo(()=>r.jsx(S4,{environments:t}),[t]);return Yr(s),r.jsx(Ma,{})}function h9(){const t=_.useMemo(()=>r.jsx(yB,{}),[]);return Yr(t),r.jsx(Ma,{})}function g9(){const{findings:t,loadFindings:s,loadAllFindings:i}=lt(),{workspaceId:o,environmentId:c}=is();_.useEffect(()=>{o?s(o):i()},[o,s,i]);const u=_.useMemo(()=>r.jsx(I4,{findings:t,workspaceId:o,environmentId:c}),[t,o,c]);return Yr(u),r.jsx(Ma,{})}function v9(){const{knowledge:t,workspaces:s}=lt(),i=_.useCallback(p=>{t.search(p)},[t]),o=_.useCallback(()=>{t.clearSearch()},[t]),c=_.useCallback(p=>{t.selectNode(p)},[t]),u=_.useCallback(p=>{t.loadRecent(p||void 0)},[t]),d=_.useMemo(()=>r.jsx(B6,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:i,onClearSearch:o,onSelectNode:c,onWorkspaceChange:u}),[t,s,i,o,c,u]);return Yr(d),r.jsx(Ma,{})}const y9="_container_ce571_1",b9="_title_ce571_6",$b={container:y9,title:b9};function Pb(){const{environmentId:t,workspaceId:s}=is(),{findings:i,loadFindings:o,workspaces:c,environments:u}=lt(),d=yt();_.useEffect(()=>{s&&o(s)},[s,o]);const p=_.useCallback(g=>{d(vp(g,s,t))},[d,s,t]),h=s&&t?kx("Findings",s,t,c,u).slice(0,-1):T8();return r.jsxs("div",{className:$b.container,"data-testid":"findings-list-page",children:[r.jsx(ys,{segments:h}),r.jsx("h1",{className:$b.title,children:"Findings"}),r.jsx(ox,{findings:i,onFindingClick:p})]})}const _9="_container_1wwpb_1",x9="_notFound_1wwpb_6",k9="_header_1wwpb_12",S9="_categoryBadge_1wwpb_19",T9="_title_1wwpb_28",N9="_content_1wwpb_35",j9="_tags_1wwpb_77",w9="_tag_1wwpb_77",C9="_meta_1wwpb_92",E9="_metaTimestamp_1wwpb_100",A9="_metaLink_1wwpb_105",rn={container:_9,notFound:x9,header:k9,categoryBadge:S9,title:T9,content:N9,tags:j9,tag:w9,meta:C9,metaTimestamp:E9,metaLink:A9};function Vb(){const{findingId:t,environmentId:s,workspaceId:i}=is(),{selectedFinding:o,findingLoading:c,loadFinding:u,workspaces:d,environments:p}=lt(),h=yt();if(_.useEffect(()=>{t&&u(t)},[t,u]),c)return r.jsx("div",{className:rn.container,"data-testid":"finding-detail-page",children:r.jsx("div",{className:rn.notFound,children:"Loading..."})});if(!o)return r.jsx("div",{className:rn.container,"data-testid":"finding-detail-page",children:r.jsx("div",{className:rn.notFound,children:"Finding not found."})});const g=kx(o.title,i,s,d,p),v=Yc(o.category);return r.jsxs("div",{className:rn.container,"data-testid":"finding-detail-page",children:[r.jsx(ys,{segments:g}),r.jsxs("div",{className:rn.header,children:[r.jsx("span",{className:rn.categoryBadge,style:{background:v.bg,color:v.text},children:o.category}),r.jsx("h1",{className:rn.title,children:o.title})]}),o.content&&r.jsx("div",{className:rn.content,children:r.jsx(Xc,{remarkPlugins:[Qc],children:o.content})}),o.tags.length>0&&r.jsx("div",{className:rn.tags,children:o.tags.map(b=>r.jsx("span",{className:rn.tag,children:b},b))}),r.jsxs("div",{className:rn.meta,children:[r.jsx("span",{className:rn.metaTimestamp,title:o.createdAt,children:Bm(o.createdAt)}),o.taskId&&r.jsx("button",{type:"button",className:rn.metaLink,onClick:()=>{h(as(o.taskId))},children:"View Task"}),o.sessionId&&r.jsx("button",{type:"button",className:rn.metaLink,onClick:()=>{h(Xp(o.sessionId))},children:"View Session"})]})]})}const D9="_wizard_1260s_1",R9="_container_1260s_10",M9="_stepContent_1260s_19",I9="_logoArea_1260s_28",O9="_logoImage_1260s_32",B9="_heading_1260s_41",L9="_tagline_1260s_49",z9="_subtitle_1260s_56",U9="_featureList_1260s_64",$9="_runtimeGrid_1260s_89",P9="_runtimeCard_1260s_101",V9="_runtimeName_1260s_133",H9="_runtimeDescription_1260s_139",q9="_buttonRow_1260s_144",G9="_primaryButton_1260s_151",F9="_ghostButton_1260s_185",Z9="_dots_1260s_213",K9="_dot_1260s_213",dt={wizard:D9,container:R9,stepContent:M9,logoArea:I9,logoImage:O9,heading:B9,tagline:L9,subtitle:z9,featureList:U9,runtimeGrid:$9,runtimeCard:P9,runtimeName:V9,runtimeDescription:H9,buttonRow:q9,primaryButton:G9,ghostButton:F9,dots:Z9,dot:K9};function Y9({onNext:t}){return r.jsxs("div",{className:dt.stepContent,"data-testid":"setup-welcome",children:[r.jsx("div",{className:dt.logoArea,children:r.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:dt.logoImage})}),r.jsx("h1",{className:dt.heading,children:"Welcome to Grackle"}),r.jsx("p",{className:dt.tagline,children:"Multi-agent orchestration for software teams"}),r.jsx("button",{type:"button",className:dt.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function J9({onNext:t,onBack:s}){return r.jsxs("div",{className:dt.stepContent,"data-testid":"setup-about",children:[r.jsx("h2",{className:dt.heading,children:"What is Grackle?"}),r.jsxs("ul",{className:dt.featureList,children:[r.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),r.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),r.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),r.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),r.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),r.jsxs("div",{className:dt.buttonRow,children:[r.jsx("button",{type:"button",className:dt.ghostButton,onClick:s,children:"Back"}),r.jsx("button",{type:"button",className:dt.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const W9=[{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 X9({currentRuntime:t,onFinish:s,onBack:i,finishDisabled:o}){const[c,u]=_.useState(t||"claude-code");return _.useEffect(()=>{t&&u(t)},[t]),r.jsxs("div",{className:dt.stepContent,"data-testid":"setup-runtime",children:[r.jsx("h2",{className:dt.heading,children:"Choose Your Runtime"}),r.jsx("p",{className:dt.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),r.jsx("div",{className:dt.runtimeGrid,children:W9.map(d=>r.jsxs("button",{type:"button",className:dt.runtimeCard,"data-selected":c===d.id,"aria-pressed":c===d.id,"data-testid":`runtime-card-${d.id}`,onClick:()=>u(d.id),children:[r.jsx("span",{className:dt.runtimeName,children:d.name}),r.jsx("span",{className:dt.runtimeDescription,children:d.description})]},d.id))}),r.jsxs("div",{className:dt.buttonRow,children:[r.jsx("button",{type:"button",className:dt.ghostButton,onClick:i,children:"Back"}),r.jsx("button",{type:"button",className:dt.primaryButton,onClick:()=>{s(c)},disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const Q9=3,Hb={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function e$(){const{personas:t,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=lt(),{showToast:c}=gn(),u=yt(),[d,p]=_.useState(0),[h,g]=_.useState(!1),v=t.find(y=>y.id==="claude-code"),b=_.useCallback(y=>{g(!0);const k=[];if(v&&y!==v.runtime){const N=Hb[y]??"sonnet";k.push(s(v.id,void 0,void 0,void 0,y,N))}const S=t.find(N=>N.id===Iv);if(S&&y!==S.runtime){const N=Hb[y]??"sonnet";k.push(s(Iv,void 0,void 0,void 0,y,N))}Promise.all(k).then(()=>i()).then(()=>{u("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),g(!1)})},[v,t,s,i,u,c]);return o===!0?r.jsx(ss,{to:"/",replace:!0}):r.jsx("div",{className:dt.wizard,"data-testid":"setup-wizard",children:r.jsxs("div",{className:dt.container,children:[r.jsx(vs,{mode:"wait",children:r.jsxs(It.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[d===0&&r.jsx(Y9,{onNext:()=>p(1)}),d===1&&r.jsx(J9,{onNext:()=>p(2),onBack:()=>p(0)}),d===2&&r.jsx(X9,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:b,onBack:()=>p(1),finishDisabled:!v||h})]},d)}),r.jsx("div",{className:dt.dots,children:Array.from({length:Q9},(y,k)=>r.jsx("span",{className:dt.dot,"data-active":k===d},k))})]})})}const t$="_root_zndgp_1",n$="_body_zndgp_7",s$="_main_zndgp_19",a$="_sidebarWrapper_zndgp_26",i$="_overlay_zndgp_51",wr={root:t$,body:n$,main:s$,sidebarWrapper:a$,overlay:i$},o$=_.lazy(()=>fT(()=>import("./KnowledgePage-BHCITraU.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),Tx=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function r$(){const{connected:t,environments:s,sessions:i,tasks:o}=lt(),{toasts:c,dismissToast:u}=gn(),d=Pt(),p=d8(),h=p!==void 0,[g,v]=_.useState(!1),b=_.useCallback(()=>v(y=>!y),[]);return _.useEffect(()=>{v(!1)},[d.pathname]),_.useEffect(()=>{if(!g)return;const y=k=>{k.key==="Escape"&&v(!1)};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}},[g]),r.jsxs(r.Fragment,{children:[r.jsx(F6,{connected:t,environments:s,sessions:i,onToggleSidebar:h?b:void 0,sidebarOpen:g}),r.jsx(Q6,{}),r.jsxs("div",{className:wr.body,children:[h&&r.jsx("div",{className:wr.sidebarWrapper,"data-sidebar-open":g,children:r.jsx(i4,{content:p})}),h&&g&&r.jsx("div",{className:wr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),r.jsxs("div",{className:wr.main,children:[r.jsx(Ma,{}),r.jsx(p4,{sessions:i,tasks:o,environments:s})]})]}),r.jsx(jI,{toasts:c,onDismiss:u}),r.jsx(f9,{})]})}function l$(){const{lastSpawnedId:t,environments:s,tasks:i,connected:o,onboardingCompleted:c}=lt(),{showToast:u}=gn();cL(s,u),pL(i,u);const d=yt(),p=Pt();return _.useEffect(()=>{t&&!p.pathname.includes("/tasks/")&&d(Xp(t),{replace:!0})},[t,d,p.pathname]),o&&c===!1?r.jsx(ss,{to:"/setup",replace:!0}):r.jsx(u8,{children:r.jsxs("div",{className:wr.root,children:[Tx&&r.jsx(cw,{}),r.jsx(r$,{})]})})}function fp(){const{workspaceId:t}=is(),{workspaces:s}=lt(),i=Pt(),o=s.find(h=>h.id===t);if(!(o!=null&&o.environmentId))return s.length===0?void 0:r.jsx(ss,{to:"/environments",replace:!0});const c=encodeURIComponent(t),u=`/workspaces/${c}`,d=i.pathname.startsWith(u)?i.pathname.slice(u.length):"",p=`/environments/${encodeURIComponent(o.environmentId)}/workspaces/${c}${d}${i.search}${i.hash}`;return r.jsx(ss,{to:p,replace:!0})}function c$(){return r.jsxs(YN,{children:[r.jsx(Se,{path:"setup",element:r.jsx(e$,{})}),r.jsxs(Se,{element:r.jsx(l$,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(O7,{})}),r.jsx(Se,{path:"chat",element:r.jsx(q7,{})}),r.jsx(Se,{path:"sessions/new",element:r.jsx(G7,{})}),r.jsx(Se,{path:"sessions/:sessionId",element:r.jsx(K7,{})}),r.jsx(Se,{element:r.jsx(v9,{}),children:r.jsx(Se,{path:"knowledge",element:r.jsx(_.Suspense,{fallback:r.jsx(J1,{}),children:r.jsx(o$,{})})})}),r.jsxs(Se,{element:r.jsx(p9,{}),children:[r.jsx(Se,{path:"tasks",element:r.jsx(M7,{})}),r.jsx(Se,{path:"tasks/new",element:r.jsx(Ib,{})}),r.jsx(Se,{path:"tasks/:taskId",element:r.jsx(ja,{})}),r.jsx(Se,{path:"tasks/:taskId/edit",element:r.jsx(ja,{})}),r.jsx(Se,{path:"tasks/:taskId/stream",element:r.jsx(ja,{})}),r.jsx(Se,{path:"tasks/:taskId/findings",element:r.jsx(ja,{})})]}),r.jsxs(Se,{element:r.jsx(g9,{}),children:[r.jsx(Se,{path:"findings",element:r.jsx(Pb,{})}),r.jsx(Se,{path:"findings/:findingId",element:r.jsx(Vb,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:r.jsx(Pb,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:r.jsx(Vb,{})})]}),r.jsxs(Se,{element:r.jsx(m9,{}),children:[r.jsx(Se,{path:"workspaces",element:r.jsx(ss,{to:"/environments",replace:!0})}),r.jsx(Se,{path:"workspaces/new",element:r.jsx(lU,{})}),r.jsx(Se,{path:"workspaces/:workspaceId",element:r.jsx(fp,{})}),r.jsx(Se,{path:"workspaces/:workspaceId/tasks/:taskId",element:r.jsx(fp,{})}),r.jsx(Se,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:r.jsx(fp,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId",element:r.jsx(W7,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:r.jsx(Ib,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:r.jsx(ja,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:r.jsx(ja,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:r.jsx(ja,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:r.jsx(ja,{})}),r.jsxs(Se,{path:"environments",element:r.jsx(yU,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(I7,{})}),r.jsx(Se,{path:"new",element:r.jsx(pU,{})}),r.jsx(Se,{path:":environmentId",element:r.jsx(FU,{})}),r.jsx(Se,{path:":environmentId/edit",element:r.jsx(mU,{})})]})]}),r.jsx(Se,{element:r.jsx(h9,{}),children:r.jsxs(Se,{path:"settings",element:r.jsx(YU,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(ss,{to:"credentials",replace:!0})}),r.jsx(Se,{path:"environments",element:r.jsx(ss,{to:"/environments",replace:!0})}),r.jsx(Se,{path:"credentials",element:r.jsx(JU,{})}),r.jsx(Se,{path:"tokens",element:r.jsx(ss,{to:"../credentials",replace:!0})}),r.jsx(Se,{path:"personas",element:r.jsx(WU,{})}),r.jsx(Se,{path:"personas/new",element:r.jsx(zb,{})}),r.jsx(Se,{path:"personas/:personaId",element:r.jsx(zb,{})}),r.jsx(Se,{path:"appearance",element:r.jsx(l9,{})}),r.jsx(Se,{path:"shortcuts",element:r.jsx(d9,{})}),r.jsx(Se,{path:"about",element:r.jsx(u9,{})})]})}),r.jsx(Se,{path:"*",element:r.jsx(ss,{to:"/",replace:!0})})]})]})}const u$=1e4;function d$(){const{onboardingCompleted:t}=lt(),[s,i]=_.useState(!1);_.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>i(!0),u$);return()=>clearTimeout(c)},[t]);const o=t===void 0&&!s;return r.jsx(vs,{mode:"wait",children:o?r.jsx(It.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:r.jsx(J1,{})},"splash"):r.jsx(It.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:r.jsx(_j,{basename:"/".replace(/\/$/,""),children:r.jsx(c$,{})})},"app")})}function f$(){const t=Tx?U8:lL;return r.jsx(c8,{children:r.jsx(i8,{children:r.jsx(t,{children:r.jsx(d$,{})})})})}cT.createRoot(document.getElementById("root")).render(r.jsx(_.StrictMode,{children:r.jsx(f$,{})}));export{ys as B,v_ as K,lt as a,vp as f,Xp as s,as as t,yt as u};