@xfey/tutti 0.1.72 → 0.1.73
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.
|
@@ -47,7 +47,7 @@ Error generating stack: `+e.message+`
|
|
|
47
47
|
`},$l=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},eu=function(){N.useEffect(function(){return document.body.setAttribute(Zl,($l()+1).toString()),function(){var e=$l()-1;e<=0?document.body.removeAttribute(Zl):document.body.setAttribute(Zl,e.toString())}},[])},tu=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;eu();var a=N.useMemo(function(){return Yl(i)},[i]);return N.createElement(Xl,{styles:Ql(a,!t,i,n?``:`!important`)})},nu=!1;if(typeof window<`u`)try{var ru=Object.defineProperty({},`passive`,{get:function(){return nu=!0,!0}});window.addEventListener(`test`,ru,ru),window.removeEventListener(`test`,ru,ru)}catch{nu=!1}var iu=nu?{passive:!1}:!1,au=function(e){return e.tagName===`TEXTAREA`},ou=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!au(e)&&n[t]===`visible`)},su=function(e){return ou(e,`overflowY`)},cu=function(e){return ou(e,`overflowX`)},lu=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),fu(e,r)){var i=pu(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},uu=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},du=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},fu=function(e,t){return e===`v`?su(t):cu(t)},pu=function(e,t){return e===`v`?uu(t):du(t)},mu=function(e,t){return e===`h`&&t===`rtl`?-1:1},hu=function(e,t,n,r,i){var a=mu(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=pu(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&fu(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},gu=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},_u=function(e){return[e.deltaX,e.deltaY]},vu=function(e){return e&&`current`in e?e.current:e},yu=function(e,t){return e[0]===t[0]&&e[1]===t[1]},bu=function(e){return`
|
|
48
48
|
.block-interactivity-${e} {pointer-events: none;}
|
|
49
49
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
50
|
-
`},xu=0,Su=[];function Cu(e){var t=N.useRef([]),n=N.useRef([0,0]),r=N.useRef(),i=N.useState(xu++)[0],a=N.useState(H)[0],o=N.useRef(e);N.useEffect(function(){o.current=e},[e]),N.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Sl([e.lockRef.current],(e.shards||[]).map(vu),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=N.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=gu(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=lu(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=lu(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return hu(h,t,e,h===`h`?s:c,!0)},[]),c=N.useCallback(function(e){var n=e;if(!(!Su.length||Su[Su.length-1]!==a)){var r=`deltaY`in n?_u(n):gu(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&yu(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(vu).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=N.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:wu(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=N.useCallback(function(e){n.current=gu(e),r.current=void 0},[]),d=N.useCallback(function(t){l(t.type,_u(t),t.target,s(t,e.lockRef.current))},[]),f=N.useCallback(function(t){l(t.type,gu(t),t.target,s(t,e.lockRef.current))},[]);N.useEffect(function(){return Su.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,iu),document.addEventListener(`touchmove`,c,iu),document.addEventListener(`touchstart`,u,iu),function(){Su=Su.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,iu),document.removeEventListener(`touchmove`,c,iu),document.removeEventListener(`touchstart`,u,iu)}},[]);var p=e.removeScrollBar,m=e.inert;return N.createElement(N.Fragment,null,m?N.createElement(a,{styles:bu(i)}):null,p?N.createElement(tu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function wu(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Tu=Il(Ll,Cu),Eu=N.forwardRef(function(e,t){return N.createElement(zl,bl({},e,{ref:t,sideCar:Tu}))});Eu.classNames=zl.classNames;var Du=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Ou=new WeakMap,ku=new WeakMap,Au={},ju=0,Mu=function(e){return e&&(e.host||Mu(e.parentNode))},Nu=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Mu(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Pu=function(e,t,n,r){var i=Nu(t,Array.isArray(e)?e:[e]);Au[n]||(Au[n]=new WeakMap);var a=Au[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Ou.get(e)||0)+1,l=(a.get(e)||0)+1;Ou.set(e,c),a.set(e,l),o.push(e),c===1&&i&&ku.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),ju++,function(){o.forEach(function(e){var t=Ou.get(e)-1,i=a.get(e)-1;Ou.set(e,t),a.set(e,i),t||(ku.has(e)||e.removeAttribute(r),ku.delete(e)),i||e.removeAttribute(n)}),ju--,ju||(Ou=new WeakMap,Ou=new WeakMap,ku=new WeakMap,Au={})}},Fu=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Du(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Pu(r,i,n,`aria-hidden`)):function(){return null}},Iu=Object.defineProperty,Lu=(e,t)=>Iu(e,`name`,{value:t,configurable:!0}),Ru=`Dialog`,[zu,Bu]=Xs(Ru),[Vu,Hu]=zu(Ru),Uu=Lu(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=N.useRef(null),c=N.useRef(null),[l,u]=fc({prop:r,defaultProp:i??!1,onChange:a,caller:Ru}),[d,f]=N.useState(0),[p,m]=N.useState(0);return(0,P.jsx)(Vu,{scope:t,triggerRef:s,contentRef:c,contentId:rc(),titleId:rc(),descriptionId:rc(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:N.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Wu=`DialogPortal`,[Gu,Ku]=zu(Wu,{forceMount:void 0}),qu=Lu(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Hu(Wu,t);return(0,P.jsx)(Gu,{scope:t,forceMount:n,children:N.Children.map(r,e=>(0,P.jsx)(sl,{present:n||a.open,children:(0,P.jsx)(rl,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Ju=`DialogOverlay`,Yu=N.forwardRef(Lu(function(e,t){let n=Ku(Ju,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Hu(Ju,e.__scopeDialog);return a.modal?(0,P.jsx)(sl,{present:r||a.open,children:(0,P.jsx)(Zu,{...i,ref:t})}):null},`DialogOverlay`)),Xu=rs(`DialogOverlay.RemoveScroll`),Zu=N.forwardRef(Lu(function(e,t){let{__scopeDialog:n,...r}=e,i=Hu(Ju,n),a=es(t,Nc());return(0,P.jsx)(Eu,{as:Xu,allowPinchZoom:!0,shards:[i.contentRef],children:(0,P.jsx)(bc.div,{"data-state":ld(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Qu=`DialogContent`,$u=N.forwardRef(Lu(function(e,t){let n=Ku(Qu,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Hu(Qu,e.__scopeDialog);return(0,P.jsx)(sl,{present:r||a.open,children:a.modal?(0,P.jsx)(ed,{...i,ref:t}):(0,P.jsx)(td,{...i,ref:t})})},`DialogContent`)),ed=N.forwardRef(Lu(function(e,t){let n=Hu(Qu,e.__scopeDialog),r=N.useRef(null),i=es(t,n.contentRef,r);return N.useEffect(()=>{let e=r.current;if(e)return Fu(e)},[]),(0,P.jsx)(nd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Hs(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Hs(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Hs(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),td=N.forwardRef(Lu(function(e,t){let n=Hu(Qu,e.__scopeDialog),r=N.useRef(!1),i=N.useRef(!1);return(0,P.jsx)(nd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),nd=N.forwardRef(Lu(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Hu(Qu,n);return vl(),(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(Wc,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,P.jsx)(Mc,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":ld(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),rd=`DialogTitle`,id=N.forwardRef(Lu(function(e,t){let{__scopeDialog:n,...r}=e,i=Hu(rd,n),{setTitleCount:a}=i;return Qs(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,P.jsx)(bc.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),ad=`DialogDescription`,od=N.forwardRef(Lu(function(e,t){let{__scopeDialog:n,...r}=e,i=Hu(ad,n),{setDescriptionCount:a}=i;return Qs(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,P.jsx)(bc.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),sd=`DialogClose`,cd=N.forwardRef(Lu(function(e,t){let{__scopeDialog:n,...r}=e,i=Hu(sd,n);return(0,P.jsx)(bc.button,{type:`button`,...r,ref:t,onClick:Hs(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function ld(e){return e?`open`:`closed`}Lu(ld,`getState`);function ud({brand:e,visual:t,auth:n,mobileAuth:r,footer:i,className:a,...o}){return(0,P.jsxs)(`section`,{className:R(`homepage-entry`,a),...o,children:[(0,P.jsxs)(`div`,{className:`homepage-entry-desktop`,children:[(0,P.jsxs)(`section`,{className:`homepage-entry-visual-column`,"aria-label":`Tutti product preview`,children:[(0,P.jsx)(`div`,{className:`homepage-entry-brand`,children:e}),(0,P.jsx)(`div`,{className:`homepage-entry-visual`,children:t})]}),(0,P.jsxs)(`aside`,{className:`homepage-entry-auth-rail`,"aria-label":`Sign in to Tutti`,children:[(0,P.jsx)(`div`,{className:`homepage-entry-auth-content`,children:n}),i===void 0?null:(0,P.jsx)(`div`,{className:`homepage-entry-auth-footnote`,children:i})]})]}),(0,P.jsxs)(`section`,{className:`homepage-entry-mobile`,"aria-label":`Sign in to Tutti`,children:[(0,P.jsx)(`div`,{className:`product-appbar`,children:e}),(0,P.jsx)(`div`,{className:`auth-shell`,children:r}),i===void 0?null:(0,P.jsx)(`div`,{className:`homepage-entry-mobile-footnote`,children:i})]})]})}function dd({className:e,...t}){return(0,P.jsx)(`p`,{className:R(`product-entry-footnote`,e),...t})}function fd({title:e,description:t,children:n,action:r,feedback:i,secondaryAction:a,className:o,...s}){return(0,P.jsxs)(`form`,{className:R(`product-entry-auth-form`,o),...s,children:[(0,P.jsxs)(`header`,{className:`product-entry-auth-header`,children:[(0,P.jsx)(`h1`,{children:e}),(0,P.jsx)(`p`,{children:t})]}),(0,P.jsx)(`div`,{className:`product-entry-auth-body`,children:n}),a===void 0?null:(0,P.jsx)(`div`,{className:`product-entry-auth-secondary`,children:a}),i===void 0?null:(0,P.jsx)(`div`,{className:`product-entry-auth-feedback`,children:i}),(0,P.jsx)(`footer`,{className:`product-entry-auth-footer`,children:r})]})}var pd=40.1,md=pd+.6,hd={openingFadeEnd:1.05,chatEnd:7.45,scratchpadPanEnd:8.8,scratchpadEnd:17.8,runCursorStart:17.95,runCursorArrive:18.65,runClickStart:18.67,runEnd:18.9,executionPrepareEnd:20.35,executionImplementEnd:24.55,executionValidateEnd:26.35,executionComplete:28.15,executionEnd:28.95,fullWorkspace:30.95,artifactLive:30.55,artifactClick:32.65,artifactScroll:36.1,artifactScrollEnd:39.55,finalHoldEnd:pd,fadeEnd:md},gd={centerX:.325,centerY:.25,scale:1.62},_d={centerX:.325,centerY:.47,scale:1.64},vd={centerX:.855,centerY:.23,scale:1.72},yd={centerX:.855,centerY:.35,scale:1.72},bd={centerX:.855,centerY:.79,scale:1.72},xd={centerX:.5,centerY:.5,scale:1},Sd=[{start:1.35,end:5.95,from:gd,to:_d,linearPosition:!0},{start:7.45,end:8.8,from:_d,to:vd},{start:8.8,end:14.3,from:vd,to:yd,linearPosition:!0},{start:14.6,end:17.8,from:yd,to:bd},{start:hd.executionEnd,end:hd.fullWorkspace,from:bd,to:xd}];function Cd(e,t=0,n=1){return Math.min(n,Math.max(t,e))}function wd(e){return 1-(1-Cd(e))**3}function Td(e){let t=Cd(e);return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function Ed(e){let t=Cd(e);return t<.5?16*t**5:1-(-2*t+2)**5/2}function Dd(e,t,n,r=wd){let i=Math.max(.001,n-t);return r(Cd((e-t)/i))}function Od(e,t,n){return e+(t-e)*n}function kd(e,t){let n=Cd((t-e.start)/Math.max(.001,e.end-e.start)),r=e.linearPosition?n:Ed(n);return{centerX:Od(e.from.centerX,e.to.centerX,r),centerY:Od(e.from.centerY,e.to.centerY,r),scale:Od(e.from.scale,e.to.scale,e.linearPosition?n:Td(n))}}function Ad(e){if(e<Sd[0].start)return gd;for(let t of Sd)if(e<=t.end)return e<t.start?t.from:kd(t,e);return xd}function jd(e){return e>=hd.executionComplete?{id:`complete`,label:`Task completed`}:e>=hd.executionValidateEnd?{id:`update`,label:`Synchronizing project`}:e>=hd.executionImplementEnd?{id:`validate`,label:`Validating result`}:e>=hd.executionPrepareEnd?{id:`implement`,label:`Implementing with Codex`}:{id:`prepare`,label:`Preparing workspace`}}function Md(e){return Dd(e,hd.artifactScroll,hd.artifactScrollEnd,Td)}function Nd(e){return 1-Dd(e,pd,md,Td)}var Pd=1500,Fd=1e3,Id=2.5,Ld=`(min-width: 980px) and (prefers-reduced-motion: no-preference)`,Rd=(0,N.lazy)(async()=>({default:(await va(()=>import(`./homepage-motion-scene-tQ6KRj6o.js`),[])).HomepageMotionScene}));function zd(e){let[t,n]=(0,N.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!0:window.matchMedia(e).matches);return(0,N.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function Bd(){return zd(Ld)}function Vd(e,t){let[n,r]=(0,N.useState)({elapsed:0,cycle:0}),i=(0,N.useRef)(null),a=md+t;return(0,N.useEffect)(()=>{if(!e){i.current=null;return}let t=0,n=e=>{let o=i.current??e;i.current=e;let s=Math.min(.1,(e-o)/1e3);r(e=>{let t=e.elapsed+s;return t<a?{...e,elapsed:t}:{elapsed:t%a,cycle:e.cycle+1}}),t=window.requestAnimationFrame(n)};return t=window.requestAnimationFrame(n),()=>window.cancelAnimationFrame(t)},[a,e]),{cycle:n.cycle,time:Math.min(n.elapsed,md)}}function Hd(e,t){let[n,r]=(0,N.useState)(0),i=(0,N.useRef)(t),a=(0,N.useRef)(!1);return i.current=t,(0,N.useEffect)(()=>{if(r(0),a.current=!1,!e)return;let t=0,n=null,o=e=>{n??=e;let s=Math.min((e-n)/1e3,md);if(r(s),s>=md){a.current||(a.current=!0,i.current());return}t=window.requestAnimationFrame(o)};return t=window.requestAnimationFrame(o),()=>window.cancelAnimationFrame(t)},[e]),n}function Ud(e){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(0);return(0,N.useLayoutEffect)(()=>{if(!e)return;let n=t.current;if(n===null)return;let i=()=>{let e=n.getBoundingClientRect(),t=Math.min(e.width/Pd,e.height/Fd);r(Number.isFinite(t)?t:0)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(n),()=>a.disconnect()},[e]),{frameRef:t,masterScale:n}}function Wd({assets:e,enabled:t,sceneKey:n,time:r,className:i,...a}){let{frameRef:o,masterScale:s}=Ud(t);return t?(0,P.jsx)(`div`,{ref:o,className:R(`homepage-motion-frame`,i),...a,children:(0,P.jsx)(`div`,{className:`homepage-motion-master`,style:{"--homepage-motion-scale":s},children:(0,P.jsx)(N.Suspense,{fallback:null,children:(0,P.jsx)(Rd,{time:r,assets:e},n)})})}):null}function Gd({assets:e,idleSeconds:t=Id,className:n,...r}){let i=Bd(),a=Vd(i,Math.max(0,t));return(0,P.jsx)(Wd,{...r,assets:e,enabled:i,sceneKey:a.cycle,time:a.time,className:n})}function Kd({assets:e,onComplete:t,className:n,...r}){let i=Bd(),a=Hd(i,(0,N.useCallback)(()=>t(),[t]));return(0,P.jsx)(Wd,{...r,assets:e,enabled:i,time:a,className:n})}function qd({onOpen:e,onDismiss:t,className:n,...r}){return(0,P.jsxs)(`aside`,{className:R(`product-tour-pill`,n),"aria-label":`Product tour`,...r,children:[(0,P.jsxs)(xs,{type:`button`,className:`product-tour-pill-open`,onClick:e,children:[(0,P.jsx)(`span`,{className:`product-tour-pill-icon`,"aria-hidden":`true`,children:(0,P.jsx)(pi,{})}),(0,P.jsxs)(`span`,{className:`product-tour-pill-copy`,children:[(0,P.jsx)(`strong`,{children:`New to Tutti?`}),(0,P.jsx)(`span`,{children:`Take a tour`})]})]}),(0,P.jsx)(ys,{type:`button`,className:`product-tour-pill-dismiss`,label:`Dismiss product tour`,icon:(0,P.jsx)(ra,{"aria-hidden":`true`}),onClick:t})]})}function Jd({assets:e,open:t,onOpenChange:n}){let r=Bd();return(0,N.useEffect)(()=>{t&&!r&&n(!1)},[r,n,t]),r?(0,P.jsx)(Uu,{open:t,onOpenChange:n,children:(0,P.jsxs)(qu,{children:[(0,P.jsx)(Yu,{className:`product-tour-dialog-overlay`}),(0,P.jsxs)($u,{className:`product-tour-dialog-content`,onInteractOutside:e=>e.preventDefault(),onPointerDownOutside:e=>e.preventDefault(),children:[(0,P.jsx)(id,{className:`product-tour-dialog-title`,children:`Welcome to Tutti`}),(0,P.jsx)(cd,{asChild:!0,children:(0,P.jsx)(ys,{type:`button`,className:`product-tour-dialog-close`,label:`Close product tour`,icon:(0,P.jsx)(ra,{"aria-hidden":`true`})})}),t?(0,P.jsx)(Kd,{className:`product-tour-dialog-motion`,assets:e,onComplete:()=>n(!1)}):null]})]})}):null}function Yd({asChild:e=!1,className:t,...n}){return(0,P.jsx)(e?is:`section`,{className:R(`product-card`,t),...n})}function Xd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-header`,t),...n,children:e})}function Zd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-body`,t),...n,children:e})}function Qd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-feedback`,t),...n,children:e})}function $d({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-footer`,t),...n,children:e})}function ef({title:e,description:t,children:n,action:r,feedback:i,secondaryAction:a,size:o=`standard`,className:s,...c}){return(0,P.jsx)(Yd,{className:R(`entry-card auth-card`,o===`wide`?`is-wide`:void 0,s),asChild:!0,children:(0,P.jsxs)(`form`,{...c,children:[(0,P.jsx)(`section`,{className:`auth-card-intro`,children:(0,P.jsxs)(Xd,{className:`auth-card-header`,children:[(0,P.jsx)(`h1`,{children:e}),(0,P.jsx)(`p`,{children:t})]})}),(0,P.jsx)(`section`,{className:`auth-card-action`,children:(0,P.jsxs)(`div`,{className:`auth-card-action-content`,children:[(0,P.jsx)(Zd,{children:n}),a===void 0?null:(0,P.jsx)(`div`,{className:`auth-card-secondary`,children:a}),i===void 0?null:(0,P.jsx)(Qd,{children:i}),(0,P.jsx)($d,{children:r})]})})]})})}function tf({projectName:e,hostLabel:t,hostOnline:n=!1,members:r,invitedBy:i,className:a,...o}){return(0,P.jsxs)(`section`,{className:R(`invite-summary`,a),"aria-label":`Project invitation`,...o,children:[(0,P.jsxs)(`div`,{className:`invite-project`,children:[(0,P.jsx)(`h2`,{children:e}),(0,P.jsxs)(`p`,{className:R(`project-line`,n?`is-online`:`is-offline`),children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]})]}),r===void 0?null:(0,P.jsx)(`div`,{className:`invite-members`,children:r}),i===void 0?null:(0,P.jsxs)(`div`,{className:`invite-meta`,children:[(0,P.jsx)(`span`,{children:`Invited by`}),(0,P.jsx)(`strong`,{children:i})]})]})}function nf({label:e,value:t,action:n,className:r,...i}){return(0,P.jsxs)(`div`,{className:R(`account-row`,r),...i,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:e}),(0,P.jsx)(`strong`,{children:t})]}),n]})}function rf({title:e,accountName:t,accountAction:n,children:r,className:i,...a}){return(0,P.jsxs)(Yd,{className:R(`project-center-card`,i),...a,children:[(0,P.jsxs)(`header`,{className:`project-center-card-header`,children:[(0,P.jsx)(`h1`,{children:e}),t===void 0&&n===void 0?null:(0,P.jsxs)(`div`,{className:`project-center-account`,"aria-label":t===void 0?`Page actions`:`Signed in user`,children:[t===void 0?null:(0,P.jsx)(`span`,{className:`project-center-account-name`,children:t}),n]})]}),r]})}function af({action:e,description:t,descriptionId:n,disabledTrigger:r=!1,className:i,...a}){return(0,P.jsx)(`div`,{className:R(`project-center-header-action`,i),...a,children:t===void 0?e:(0,P.jsx)(Ts,{content:t,disabledTrigger:r,side:`bottom`,...n===void 0?{}:{contentId:n},children:e})})}function of({children:e,className:t,...n}){return(0,P.jsx)(`section`,{className:R(`project-entry-grid`,t),"aria-label":`Project entry options`,...n,children:e})}function sf({icon:e,title:t,description:n}){return(0,P.jsxs)(`header`,{className:`project-entry-card-header`,children:[(0,P.jsx)(`span`,{className:`project-entry-card-icon`,"aria-hidden":`true`,children:e}),(0,P.jsxs)(`div`,{className:`project-entry-card-copy`,children:[(0,P.jsx)(`h2`,{children:t}),(0,P.jsx)(`p`,{children:n})]})]})}function cf({title:e,description:t,inputLabel:n,placeholder:r,value:i,error:a,actionLabel:o=`Continue`,onValueChange:s,className:c,...l}){return(0,P.jsxs)(`form`,{className:R(`project-entry-card project-join-card`,c),...l,children:[(0,P.jsx)(sf,{icon:(0,P.jsx)(ki,{}),title:e,description:t}),(0,P.jsxs)(`div`,{className:`project-entry-card-content project-join-card-content`,children:[(0,P.jsxs)(`div`,{className:`project-join-card-form-row`,children:[(0,P.jsx)(Os,{type:`text`,"aria-label":n,value:i,onChange:e=>s(e.target.value),...r===void 0?{}:{placeholder:r}}),(0,P.jsx)(`div`,{className:`project-join-card-actions`,children:(0,P.jsxs)(bs,{type:`submit`,disabled:i.trim()===``,children:[o,(0,P.jsx)(ai,{"aria-hidden":`true`})]})})]}),a==null?null:(0,P.jsx)(Ns,{children:a})]})]})}function lf({title:e,description:t,actionHref:n,actionLabel:r=`Local projects`,expanded:i,statusTitle:a,statusDescription:o,command:s,onAction:c,onCopyCommand:l,className:u,...d}){let f=(0,N.useId)();return(0,P.jsxs)(`section`,{className:R(`project-entry-card project-launch-card`,i?`is-expanded`:void 0,u),...d,children:[(0,P.jsx)(sf,{icon:(0,P.jsx)($i,{}),title:e,description:t}),(0,P.jsxs)(`div`,{className:`project-entry-card-content project-launch-card-content`,children:[i?(0,P.jsxs)(`div`,{className:`project-launch-card-status`,id:f,children:[(0,P.jsx)(`p`,{className:`project-launch-card-status-title`,role:`status`,"aria-live":`polite`,children:a}),(0,P.jsx)(`p`,{children:o}),(0,P.jsx)(uf,{command:s,...l===void 0?{}:{onCopyCommand:l}})]}):null,(0,P.jsx)(`div`,{className:`project-launch-card-actions`,children:(0,P.jsx)(bs,{asChild:!0,children:(0,P.jsxs)(`a`,{href:n,"aria-expanded":i,...i?{"aria-controls":f}:{},onClick:c,children:[r,(0,P.jsx)(ai,{"aria-hidden":`true`})]})})})]})]})}function uf({command:e,terminalLabel:t=`Install and start in your terminal`,copyLabel:n=`Copy`,onCopyCommand:r,className:i,...a}){return(0,P.jsxs)(`section`,{className:R(`project-launch-terminal`,i),...a,children:[(0,P.jsxs)(`div`,{className:`project-launch-terminal-bar`,children:[(0,P.jsx)(`span`,{children:t}),r===void 0?null:(0,P.jsxs)(xs,{className:`project-launch-copy-button`,type:`button`,"aria-label":`Copy launch command`,onClick:()=>r(e),children:[(0,P.jsx)(vi,{"aria-hidden":`true`}),n]})]}),(0,P.jsx)(`pre`,{className:`project-launch-command-block`,"aria-label":`Launch command`,children:(0,P.jsx)(`code`,{children:(0,P.jsxs)(`span`,{className:`project-launch-command-line`,children:[(0,P.jsx)(`span`,{className:`project-launch-command-prompt`,"aria-hidden":`true`,children:`>`}),(0,P.jsx)(`span`,{children:e})]})})})]})}function df({children:e,className:t,...n}){return(0,P.jsx)(`ul`,{className:R(`project-list`,t),"aria-label":`Recent projects`,...n,children:e})}function ff({title:e,children:t,listLabel:n,summaryClassName:r,className:i,...a}){return(0,P.jsxs)(`details`,{className:R(`project-list-disclosure`,i),...a,children:[(0,P.jsxs)(`summary`,{className:R(`project-list-disclosure-summary`,r),children:[(0,P.jsx)(ui,{"aria-hidden":`true`}),(0,P.jsx)(`strong`,{children:e})]}),(0,P.jsx)(df,{...n===void 0?{}:{"aria-label":n},children:t})]})}function pf({title:e,statusLabel:t,online:n=!1,details:r,className:i,disabled:a,...o}){return(0,P.jsx)(`li`,{className:`project-list-item`,children:(0,P.jsxs)(`button`,{className:R(`project-list-row`,n?`is-online`:`is-offline`,i),type:`button`,disabled:a,...o,children:[(0,P.jsxs)(`span`,{className:`project-list-identity`,children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsxs)(`small`,{children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]})]}),r.map(e=>(0,P.jsxs)(`span`,{className:`project-list-detail`,children:[(0,P.jsx)(`small`,{children:e.label}),(0,P.jsx)(`strong`,{children:e.value})]},e.label)),(0,P.jsx)(ai,{"aria-hidden":`true`})]})})}function mf({children:e,className:t,...n}){return(0,P.jsx)(`li`,{className:R(`project-list-item project-list-state-row`,t),...n,children:e})}function hf({open:e,onOpenChange:t,title:n,description:r,children:i,closeDisabled:a=!1,explicitCloseOnly:o=!1,className:s}){return(0,P.jsxs)(Uu,{open:e,onOpenChange:e=>{(e||!a)&&t(e)},children:[(0,P.jsx)(Yu,{className:`product-entry-dialog-overlay`}),(0,P.jsx)($u,{asChild:!0,onEscapeKeyDown:e=>{(a||o)&&e.preventDefault()},onInteractOutside:e=>{(a||o)&&e.preventDefault()},onPointerDownOutside:e=>{(a||o)&&e.preventDefault()},children:(0,P.jsxs)(Yd,{className:R(`product-entry-dialog-card`,s),children:[(0,P.jsxs)(`header`,{className:`product-entry-dialog-header`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(id,{children:n}),r===void 0?null:(0,P.jsx)(od,{children:r})]}),(0,P.jsx)(cd,{asChild:!0,children:(0,P.jsx)(ys,{type:`button`,label:`Close`,icon:(0,P.jsx)(ra,{"aria-hidden":`true`}),disabled:a})})]}),i]})})]})}function gf({open:e,onOpenChange:t,steps:n,currentStep:r,children:i,action:a,backAction:o,feedback:s,closeDisabled:c=!1,explicitCloseOnly:l=!1,className:u,...d}){return(0,P.jsxs)(hf,{open:e,onOpenChange:t,title:`New project`,description:`Step ${r+1} of ${n.length}`,closeDisabled:c,explicitCloseOnly:l,className:`local-console-create-card`,children:[(0,P.jsx)(`ol`,{className:`local-console-create-steps`,"aria-label":`New project steps`,children:n.map((e,t)=>(0,P.jsxs)(`li`,{className:R(t===r?`is-current`:void 0,t<r?`is-complete`:void 0),"aria-current":t===r?`step`:void 0,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,children:t+1}),(0,P.jsx)(`small`,{children:e})]},e))}),(0,P.jsxs)(`form`,{className:R(`local-console-create-form`,u),...d,children:[(0,P.jsx)(`div`,{className:`local-console-create-body`,children:i}),s===void 0?null:(0,P.jsx)(`div`,{className:`local-console-create-feedback`,children:s}),(0,P.jsxs)(`footer`,{className:`local-console-create-actions`,children:[(0,P.jsx)(`div`,{children:o}),(0,P.jsx)(`div`,{children:a})]})]})]})}function _f({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`local-console-form-grid`,t),...n,children:e})}function vf({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`local-console-inline-actions`,t),...n,children:e})}function yf({title:e,description:t,children:n,className:r,...i}){return(0,P.jsxs)(`section`,{className:R(`local-console-field-group`,r),...i,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`strong`,{children:e}),t===void 0?null:(0,P.jsx)(`small`,{children:t})]}),(0,P.jsx)(`div`,{className:`local-console-field-group-body`,children:n})]})}function bf({title:e,children:t,className:n,...r}){return(0,P.jsxs)(`section`,{className:R(`local-console-project-section`,n),...r,children:[(0,P.jsx)(`header`,{className:`local-console-project-section-header`,children:(0,P.jsx)(`strong`,{children:e})}),(0,P.jsx)(df,{children:t})]})}function xf({children:e,className:t,...n}){return(0,P.jsx)(ff,{title:`Unavailable`,className:R(`local-console-unavailable-projects`,t),summaryClassName:`local-console-project-section-header`,...n,children:e})}function Sf({title:e,statusLabel:t,online:n=!1,path:r,createdLabel:i,providerLabel:a,providerStatus:o,actions:s,className:c,...l}){return(0,P.jsx)(`li`,{className:R(`project-list-item`,`local-console-project-item`,c),...l,children:(0,P.jsxs)(`div`,{className:R(`local-console-project-row`,n?`is-online`:`is-offline`),children:[(0,P.jsxs)(`span`,{className:`project-list-identity`,children:[(0,P.jsx)(`span`,{className:`local-console-project-title`,children:(0,P.jsx)(`strong`,{children:e})}),(0,P.jsxs)(`span`,{className:`local-console-project-signals`,children:[(0,P.jsxs)(`small`,{className:`local-console-runtime-status`,children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]}),(0,P.jsxs)(`small`,{className:R(`local-console-provider-status`,`is-${o}`),children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),a]})]})]}),(0,P.jsxs)(`span`,{className:`local-console-project-metadata`,children:[(0,P.jsx)(`strong`,{className:`local-console-project-date`,children:i}),(0,P.jsx)(`small`,{className:`local-console-project-path`,title:typeof r==`string`?r:void 0,children:r})]}),(0,P.jsx)(`span`,{className:`local-console-project-actions`,children:s})]})})}function Cf(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var wf=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Tf=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ef={};function Df(e,t){return((t||Ef).jsx?Tf:wf).test(e)}var Of=/[ \t\n\f\r]/g;function kf(e){return typeof e==`object`?e.type===`text`?Af(e.value):!1:Af(e)}function Af(e){return e.replace(Of,``)===``}var jf=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};jf.prototype.normal={},jf.prototype.property={},jf.prototype.space=void 0;function Mf(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new jf(n,r,t)}function Nf(e){return e.toLowerCase()}var Pf=class{constructor(e,t){this.attribute=t,this.property=e}};Pf.prototype.attribute=``,Pf.prototype.booleanish=!1,Pf.prototype.boolean=!1,Pf.prototype.commaOrSpaceSeparated=!1,Pf.prototype.commaSeparated=!1,Pf.prototype.defined=!1,Pf.prototype.mustUseProperty=!1,Pf.prototype.number=!1,Pf.prototype.overloadedBoolean=!1,Pf.prototype.property=``,Pf.prototype.spaceSeparated=!1,Pf.prototype.space=void 0;var Ff=s({boolean:()=>U,booleanish:()=>Lf,commaOrSpaceSeparated:()=>Vf,commaSeparated:()=>Bf,number:()=>W,overloadedBoolean:()=>Rf,spaceSeparated:()=>zf}),If=0,U=Hf(),Lf=Hf(),Rf=Hf(),W=Hf(),zf=Hf(),Bf=Hf(),Vf=Hf();function Hf(){return 2**++If}var Uf=Object.keys(Ff),Wf=class extends Pf{constructor(e,t,n,r){let i=-1;if(super(e,t),Gf(this,`space`,r),typeof n==`number`)for(;++i<Uf.length;){let e=Uf[i];Gf(this,Uf[i],(n&Ff[e])===Ff[e])}}};Wf.prototype.defined=!0;function Gf(e,t,n){n&&(e[t]=n)}function Kf(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Wf(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Nf(r)]=r,n[Nf(a.attribute)]=r}return new jf(t,n,e.space)}var qf=Kf({properties:{ariaActiveDescendant:null,ariaAtomic:Lf,ariaAutoComplete:null,ariaBusy:Lf,ariaChecked:Lf,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:zf,ariaCurrent:null,ariaDescribedBy:zf,ariaDetails:null,ariaDisabled:Lf,ariaDropEffect:zf,ariaErrorMessage:null,ariaExpanded:Lf,ariaFlowTo:zf,ariaGrabbed:Lf,ariaHasPopup:null,ariaHidden:Lf,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zf,ariaLevel:W,ariaLive:null,ariaModal:Lf,ariaMultiLine:Lf,ariaMultiSelectable:Lf,ariaOrientation:null,ariaOwns:zf,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:Lf,ariaReadOnly:Lf,ariaRelevant:null,ariaRequired:Lf,ariaRoleDescription:zf,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:Lf,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Jf(e,t){return t in e?e[t]:t}function Yf(e,t){return Jf(e,t.toLowerCase())}var Xf=Kf({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Bf,acceptCharset:zf,accessKey:zf,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:zf,autoFocus:U,autoPlay:U,blocking:zf,capture:null,charSet:null,checked:U,cite:null,className:zf,cols:W,colSpan:null,content:null,contentEditable:Lf,controls:U,controlsList:zf,coords:W|Bf,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:Rf,draggable:Lf,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:zf,height:W,hidden:Rf,high:W,href:null,hrefLang:null,htmlFor:zf,httpEquiv:zf,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:zf,itemRef:zf,itemScope:U,itemType:zf,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:U,optimum:W,pattern:null,ping:zf,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:zf,required:U,reversed:U,rows:W,rowSpan:W,sandbox:zf,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:Lf,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:U,useMap:null,value:Lf,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zf,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:Lf,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:U,disableRemotePlayback:U,prefix:null,property:null,results:W,security:null,unselectable:null},space:`html`,transform:Yf}),Zf=Kf({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Vf,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:zf,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:U,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Bf,g2:Bf,glyphName:Bf,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:Vf,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:W,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zf,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vf,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vf,rev:Vf,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vf,requiredFeatures:Vf,requiredFonts:Vf,requiredFormats:Vf,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:Vf,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vf,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vf,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Jf}),Qf=Kf({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),$f=Kf({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Yf}),ep=Kf({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),tp={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},np=/[A-Z]/g,rp=/-[a-z]/g,ip=/^data[-\w.:]+$/i;function ap(e,t){let n=Nf(t),r=t,i=Pf;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ip.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(rp,sp);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!rp.test(e)){let n=e.replace(np,op);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Wf}return new i(r,t)}function op(e){return`-`+e.toLowerCase()}function sp(e){return e.charAt(1).toUpperCase()}var cp=Mf([qf,Xf,Qf,$f,ep],`html`),lp=Mf([qf,Zf,Qf,$f,ep],`svg`);function up(e){return e.join(` `).trim()}var dp=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
50
|
+
`},xu=0,Su=[];function Cu(e){var t=N.useRef([]),n=N.useRef([0,0]),r=N.useRef(),i=N.useState(xu++)[0],a=N.useState(H)[0],o=N.useRef(e);N.useEffect(function(){o.current=e},[e]),N.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Sl([e.lockRef.current],(e.shards||[]).map(vu),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=N.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=gu(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=lu(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=lu(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return hu(h,t,e,h===`h`?s:c,!0)},[]),c=N.useCallback(function(e){var n=e;if(!(!Su.length||Su[Su.length-1]!==a)){var r=`deltaY`in n?_u(n):gu(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&yu(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(vu).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=N.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:wu(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=N.useCallback(function(e){n.current=gu(e),r.current=void 0},[]),d=N.useCallback(function(t){l(t.type,_u(t),t.target,s(t,e.lockRef.current))},[]),f=N.useCallback(function(t){l(t.type,gu(t),t.target,s(t,e.lockRef.current))},[]);N.useEffect(function(){return Su.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,iu),document.addEventListener(`touchmove`,c,iu),document.addEventListener(`touchstart`,u,iu),function(){Su=Su.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,iu),document.removeEventListener(`touchmove`,c,iu),document.removeEventListener(`touchstart`,u,iu)}},[]);var p=e.removeScrollBar,m=e.inert;return N.createElement(N.Fragment,null,m?N.createElement(a,{styles:bu(i)}):null,p?N.createElement(tu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function wu(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Tu=Il(Ll,Cu),Eu=N.forwardRef(function(e,t){return N.createElement(zl,bl({},e,{ref:t,sideCar:Tu}))});Eu.classNames=zl.classNames;var Du=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Ou=new WeakMap,ku=new WeakMap,Au={},ju=0,Mu=function(e){return e&&(e.host||Mu(e.parentNode))},Nu=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Mu(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Pu=function(e,t,n,r){var i=Nu(t,Array.isArray(e)?e:[e]);Au[n]||(Au[n]=new WeakMap);var a=Au[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Ou.get(e)||0)+1,l=(a.get(e)||0)+1;Ou.set(e,c),a.set(e,l),o.push(e),c===1&&i&&ku.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),ju++,function(){o.forEach(function(e){var t=Ou.get(e)-1,i=a.get(e)-1;Ou.set(e,t),a.set(e,i),t||(ku.has(e)||e.removeAttribute(r),ku.delete(e)),i||e.removeAttribute(n)}),ju--,ju||(Ou=new WeakMap,Ou=new WeakMap,ku=new WeakMap,Au={})}},Fu=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Du(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Pu(r,i,n,`aria-hidden`)):function(){return null}},Iu=Object.defineProperty,Lu=(e,t)=>Iu(e,`name`,{value:t,configurable:!0}),Ru=`Dialog`,[zu,Bu]=Xs(Ru),[Vu,Hu]=zu(Ru),Uu=Lu(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=N.useRef(null),c=N.useRef(null),[l,u]=fc({prop:r,defaultProp:i??!1,onChange:a,caller:Ru}),[d,f]=N.useState(0),[p,m]=N.useState(0);return(0,P.jsx)(Vu,{scope:t,triggerRef:s,contentRef:c,contentId:rc(),titleId:rc(),descriptionId:rc(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:N.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Wu=`DialogPortal`,[Gu,Ku]=zu(Wu,{forceMount:void 0}),qu=Lu(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Hu(Wu,t);return(0,P.jsx)(Gu,{scope:t,forceMount:n,children:N.Children.map(r,e=>(0,P.jsx)(sl,{present:n||a.open,children:(0,P.jsx)(rl,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Ju=`DialogOverlay`,Yu=N.forwardRef(Lu(function(e,t){let n=Ku(Ju,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Hu(Ju,e.__scopeDialog);return a.modal?(0,P.jsx)(sl,{present:r||a.open,children:(0,P.jsx)(Zu,{...i,ref:t})}):null},`DialogOverlay`)),Xu=rs(`DialogOverlay.RemoveScroll`),Zu=N.forwardRef(Lu(function(e,t){let{__scopeDialog:n,...r}=e,i=Hu(Ju,n),a=es(t,Nc());return(0,P.jsx)(Eu,{as:Xu,allowPinchZoom:!0,shards:[i.contentRef],children:(0,P.jsx)(bc.div,{"data-state":ld(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Qu=`DialogContent`,$u=N.forwardRef(Lu(function(e,t){let n=Ku(Qu,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Hu(Qu,e.__scopeDialog);return(0,P.jsx)(sl,{present:r||a.open,children:a.modal?(0,P.jsx)(ed,{...i,ref:t}):(0,P.jsx)(td,{...i,ref:t})})},`DialogContent`)),ed=N.forwardRef(Lu(function(e,t){let n=Hu(Qu,e.__scopeDialog),r=N.useRef(null),i=es(t,n.contentRef,r);return N.useEffect(()=>{let e=r.current;if(e)return Fu(e)},[]),(0,P.jsx)(nd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Hs(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Hs(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Hs(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),td=N.forwardRef(Lu(function(e,t){let n=Hu(Qu,e.__scopeDialog),r=N.useRef(!1),i=N.useRef(!1);return(0,P.jsx)(nd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),nd=N.forwardRef(Lu(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Hu(Qu,n);return vl(),(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(Wc,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,P.jsx)(Mc,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":ld(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),rd=`DialogTitle`,id=N.forwardRef(Lu(function(e,t){let{__scopeDialog:n,...r}=e,i=Hu(rd,n),{setTitleCount:a}=i;return Qs(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,P.jsx)(bc.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),ad=`DialogDescription`,od=N.forwardRef(Lu(function(e,t){let{__scopeDialog:n,...r}=e,i=Hu(ad,n),{setDescriptionCount:a}=i;return Qs(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,P.jsx)(bc.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),sd=`DialogClose`,cd=N.forwardRef(Lu(function(e,t){let{__scopeDialog:n,...r}=e,i=Hu(sd,n);return(0,P.jsx)(bc.button,{type:`button`,...r,ref:t,onClick:Hs(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function ld(e){return e?`open`:`closed`}Lu(ld,`getState`);function ud({brand:e,visual:t,auth:n,mobileAuth:r,footer:i,className:a,...o}){return(0,P.jsxs)(`section`,{className:R(`homepage-entry`,a),...o,children:[(0,P.jsxs)(`div`,{className:`homepage-entry-desktop`,children:[(0,P.jsxs)(`section`,{className:`homepage-entry-visual-column`,"aria-label":`Tutti product preview`,children:[(0,P.jsx)(`div`,{className:`homepage-entry-brand`,children:e}),(0,P.jsx)(`div`,{className:`homepage-entry-visual`,children:t})]}),(0,P.jsxs)(`aside`,{className:`homepage-entry-auth-rail`,"aria-label":`Sign in to Tutti`,children:[(0,P.jsx)(`div`,{className:`homepage-entry-auth-content`,children:n}),i===void 0?null:(0,P.jsx)(`div`,{className:`homepage-entry-auth-footnote`,children:i})]})]}),(0,P.jsxs)(`section`,{className:`homepage-entry-mobile`,"aria-label":`Sign in to Tutti`,children:[(0,P.jsx)(`div`,{className:`product-appbar`,children:e}),(0,P.jsx)(`div`,{className:`auth-shell`,children:r}),i===void 0?null:(0,P.jsx)(`div`,{className:`homepage-entry-mobile-footnote`,children:i})]})]})}function dd({className:e,...t}){return(0,P.jsx)(`p`,{className:R(`product-entry-footnote`,e),...t})}function fd({title:e,description:t,children:n,action:r,feedback:i,secondaryAction:a,className:o,...s}){return(0,P.jsxs)(`form`,{className:R(`product-entry-auth-form`,o),...s,children:[(0,P.jsxs)(`header`,{className:`product-entry-auth-header`,children:[(0,P.jsx)(`h1`,{children:e}),(0,P.jsx)(`p`,{children:t})]}),(0,P.jsx)(`div`,{className:`product-entry-auth-body`,children:n}),a===void 0?null:(0,P.jsx)(`div`,{className:`product-entry-auth-secondary`,children:a}),i===void 0?null:(0,P.jsx)(`div`,{className:`product-entry-auth-feedback`,children:i}),(0,P.jsx)(`footer`,{className:`product-entry-auth-footer`,children:r})]})}var pd=40.1,md=pd+.6,hd={openingFadeEnd:1.05,chatEnd:7.45,scratchpadPanEnd:8.8,scratchpadEnd:17.8,runCursorStart:17.95,runCursorArrive:18.65,runClickStart:18.67,runEnd:18.9,executionPrepareEnd:20.35,executionImplementEnd:24.55,executionValidateEnd:26.35,executionComplete:28.15,executionEnd:28.95,fullWorkspace:30.95,artifactLive:30.55,artifactClick:32.65,artifactScroll:36.1,artifactScrollEnd:39.55,finalHoldEnd:pd,fadeEnd:md},gd={centerX:.325,centerY:.25,scale:1.62},_d={centerX:.325,centerY:.47,scale:1.64},vd={centerX:.855,centerY:.23,scale:1.72},yd={centerX:.855,centerY:.35,scale:1.72},bd={centerX:.855,centerY:.79,scale:1.72},xd={centerX:.5,centerY:.5,scale:1},Sd=[{start:1.35,end:5.95,from:gd,to:_d,linearPosition:!0},{start:7.45,end:8.8,from:_d,to:vd},{start:8.8,end:14.3,from:vd,to:yd,linearPosition:!0},{start:14.6,end:17.8,from:yd,to:bd},{start:hd.executionEnd,end:hd.fullWorkspace,from:bd,to:xd}];function Cd(e,t=0,n=1){return Math.min(n,Math.max(t,e))}function wd(e){return 1-(1-Cd(e))**3}function Td(e){let t=Cd(e);return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function Ed(e){let t=Cd(e);return t<.5?16*t**5:1-(-2*t+2)**5/2}function Dd(e,t,n,r=wd){let i=Math.max(.001,n-t);return r(Cd((e-t)/i))}function Od(e,t,n){return e+(t-e)*n}function kd(e,t){let n=Cd((t-e.start)/Math.max(.001,e.end-e.start)),r=e.linearPosition?n:Ed(n);return{centerX:Od(e.from.centerX,e.to.centerX,r),centerY:Od(e.from.centerY,e.to.centerY,r),scale:Od(e.from.scale,e.to.scale,e.linearPosition?n:Td(n))}}function Ad(e){if(e<Sd[0].start)return gd;for(let t of Sd)if(e<=t.end)return e<t.start?t.from:kd(t,e);return xd}function jd(e){return e>=hd.executionComplete?{id:`complete`,label:`Task completed`}:e>=hd.executionValidateEnd?{id:`update`,label:`Synchronizing project`}:e>=hd.executionImplementEnd?{id:`validate`,label:`Validating result`}:e>=hd.executionPrepareEnd?{id:`implement`,label:`Implementing with Codex`}:{id:`prepare`,label:`Preparing workspace`}}function Md(e){return Dd(e,hd.artifactScroll,hd.artifactScrollEnd,Td)}function Nd(e){return 1-Dd(e,pd,md,Td)}var Pd=1500,Fd=1e3,Id=2.5,Ld=`(min-width: 980px) and (prefers-reduced-motion: no-preference)`,Rd=(0,N.lazy)(async()=>({default:(await va(()=>import(`./homepage-motion-scene-BFtd7PRa.js`),[])).HomepageMotionScene}));function zd(e){let[t,n]=(0,N.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!0:window.matchMedia(e).matches);return(0,N.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function Bd(){return zd(Ld)}function Vd(e,t){let[n,r]=(0,N.useState)({elapsed:0,cycle:0}),i=(0,N.useRef)(null),a=md+t;return(0,N.useEffect)(()=>{if(!e){i.current=null;return}let t=0,n=e=>{let o=i.current??e;i.current=e;let s=Math.min(.1,(e-o)/1e3);r(e=>{let t=e.elapsed+s;return t<a?{...e,elapsed:t}:{elapsed:t%a,cycle:e.cycle+1}}),t=window.requestAnimationFrame(n)};return t=window.requestAnimationFrame(n),()=>window.cancelAnimationFrame(t)},[a,e]),{cycle:n.cycle,time:Math.min(n.elapsed,md)}}function Hd(e,t){let[n,r]=(0,N.useState)(0),i=(0,N.useRef)(t),a=(0,N.useRef)(!1);return i.current=t,(0,N.useEffect)(()=>{if(r(0),a.current=!1,!e)return;let t=0,n=null,o=e=>{n??=e;let s=Math.min((e-n)/1e3,md);if(r(s),s>=md){a.current||(a.current=!0,i.current());return}t=window.requestAnimationFrame(o)};return t=window.requestAnimationFrame(o),()=>window.cancelAnimationFrame(t)},[e]),n}function Ud(e){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(0);return(0,N.useLayoutEffect)(()=>{if(!e)return;let n=t.current;if(n===null)return;let i=()=>{let e=n.getBoundingClientRect(),t=Math.min(e.width/Pd,e.height/Fd);r(Number.isFinite(t)?t:0)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(n),()=>a.disconnect()},[e]),{frameRef:t,masterScale:n}}function Wd({assets:e,enabled:t,sceneKey:n,time:r,className:i,...a}){let{frameRef:o,masterScale:s}=Ud(t);return t?(0,P.jsx)(`div`,{ref:o,className:R(`homepage-motion-frame`,i),...a,children:(0,P.jsx)(`div`,{className:`homepage-motion-master`,style:{"--homepage-motion-scale":s},children:(0,P.jsx)(N.Suspense,{fallback:null,children:(0,P.jsx)(Rd,{time:r,assets:e},n)})})}):null}function Gd({assets:e,idleSeconds:t=Id,className:n,...r}){let i=Bd(),a=Vd(i,Math.max(0,t));return(0,P.jsx)(Wd,{...r,assets:e,enabled:i,sceneKey:a.cycle,time:a.time,className:n})}function Kd({assets:e,onComplete:t,className:n,...r}){let i=Bd(),a=Hd(i,(0,N.useCallback)(()=>t(),[t]));return(0,P.jsx)(Wd,{...r,assets:e,enabled:i,time:a,className:n})}function qd({onOpen:e,onDismiss:t,className:n,...r}){return(0,P.jsxs)(`aside`,{className:R(`product-tour-pill`,n),"aria-label":`Product tour`,...r,children:[(0,P.jsxs)(xs,{type:`button`,className:`product-tour-pill-open`,onClick:e,children:[(0,P.jsx)(`span`,{className:`product-tour-pill-icon`,"aria-hidden":`true`,children:(0,P.jsx)(pi,{})}),(0,P.jsxs)(`span`,{className:`product-tour-pill-copy`,children:[(0,P.jsx)(`strong`,{children:`New to Tutti?`}),(0,P.jsx)(`span`,{children:`Take a tour`})]})]}),(0,P.jsx)(ys,{type:`button`,className:`product-tour-pill-dismiss`,label:`Dismiss product tour`,icon:(0,P.jsx)(ra,{"aria-hidden":`true`}),onClick:t})]})}function Jd({assets:e,open:t,onOpenChange:n}){let r=Bd();return(0,N.useEffect)(()=>{t&&!r&&n(!1)},[r,n,t]),r?(0,P.jsx)(Uu,{open:t,onOpenChange:n,children:(0,P.jsxs)(qu,{children:[(0,P.jsx)(Yu,{className:`product-tour-dialog-overlay`}),(0,P.jsxs)($u,{className:`product-tour-dialog-content`,onInteractOutside:e=>e.preventDefault(),onPointerDownOutside:e=>e.preventDefault(),children:[(0,P.jsx)(id,{className:`product-tour-dialog-title`,children:`Welcome to Tutti`}),(0,P.jsx)(cd,{asChild:!0,children:(0,P.jsx)(ys,{type:`button`,className:`product-tour-dialog-close`,label:`Close product tour`,icon:(0,P.jsx)(ra,{"aria-hidden":`true`})})}),t?(0,P.jsx)(Kd,{className:`product-tour-dialog-motion`,assets:e,onComplete:()=>n(!1)}):null]})]})}):null}function Yd({asChild:e=!1,className:t,...n}){return(0,P.jsx)(e?is:`section`,{className:R(`product-card`,t),...n})}function Xd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-header`,t),...n,children:e})}function Zd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-body`,t),...n,children:e})}function Qd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-feedback`,t),...n,children:e})}function $d({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-footer`,t),...n,children:e})}function ef({title:e,description:t,children:n,action:r,feedback:i,secondaryAction:a,size:o=`standard`,className:s,...c}){return(0,P.jsx)(Yd,{className:R(`entry-card auth-card`,o===`wide`?`is-wide`:void 0,s),asChild:!0,children:(0,P.jsxs)(`form`,{...c,children:[(0,P.jsx)(`section`,{className:`auth-card-intro`,children:(0,P.jsxs)(Xd,{className:`auth-card-header`,children:[(0,P.jsx)(`h1`,{children:e}),(0,P.jsx)(`p`,{children:t})]})}),(0,P.jsx)(`section`,{className:`auth-card-action`,children:(0,P.jsxs)(`div`,{className:`auth-card-action-content`,children:[(0,P.jsx)(Zd,{children:n}),a===void 0?null:(0,P.jsx)(`div`,{className:`auth-card-secondary`,children:a}),i===void 0?null:(0,P.jsx)(Qd,{children:i}),(0,P.jsx)($d,{children:r})]})})]})})}function tf({projectName:e,hostLabel:t,hostOnline:n=!1,members:r,invitedBy:i,className:a,...o}){return(0,P.jsxs)(`section`,{className:R(`invite-summary`,a),"aria-label":`Project invitation`,...o,children:[(0,P.jsxs)(`div`,{className:`invite-project`,children:[(0,P.jsx)(`h2`,{children:e}),(0,P.jsxs)(`p`,{className:R(`project-line`,n?`is-online`:`is-offline`),children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]})]}),r===void 0?null:(0,P.jsx)(`div`,{className:`invite-members`,children:r}),i===void 0?null:(0,P.jsxs)(`div`,{className:`invite-meta`,children:[(0,P.jsx)(`span`,{children:`Invited by`}),(0,P.jsx)(`strong`,{children:i})]})]})}function nf({label:e,value:t,action:n,className:r,...i}){return(0,P.jsxs)(`div`,{className:R(`account-row`,r),...i,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:e}),(0,P.jsx)(`strong`,{children:t})]}),n]})}function rf({title:e,accountName:t,accountAction:n,children:r,className:i,...a}){return(0,P.jsxs)(Yd,{className:R(`project-center-card`,i),...a,children:[(0,P.jsxs)(`header`,{className:`project-center-card-header`,children:[(0,P.jsx)(`h1`,{children:e}),t===void 0&&n===void 0?null:(0,P.jsxs)(`div`,{className:`project-center-account`,"aria-label":t===void 0?`Page actions`:`Signed in user`,children:[t===void 0?null:(0,P.jsx)(`span`,{className:`project-center-account-name`,children:t}),n]})]}),r]})}function af({action:e,description:t,descriptionId:n,disabledTrigger:r=!1,className:i,...a}){return(0,P.jsx)(`div`,{className:R(`project-center-header-action`,i),...a,children:t===void 0?e:(0,P.jsx)(Ts,{content:t,disabledTrigger:r,side:`bottom`,...n===void 0?{}:{contentId:n},children:e})})}function of({children:e,className:t,...n}){return(0,P.jsx)(`section`,{className:R(`project-entry-grid`,t),"aria-label":`Project entry options`,...n,children:e})}function sf({icon:e,title:t,description:n}){return(0,P.jsxs)(`header`,{className:`project-entry-card-header`,children:[(0,P.jsx)(`span`,{className:`project-entry-card-icon`,"aria-hidden":`true`,children:e}),(0,P.jsxs)(`div`,{className:`project-entry-card-copy`,children:[(0,P.jsx)(`h2`,{children:t}),(0,P.jsx)(`p`,{children:n})]})]})}function cf({title:e,description:t,inputLabel:n,placeholder:r,value:i,error:a,actionLabel:o=`Continue`,onValueChange:s,className:c,...l}){return(0,P.jsxs)(`form`,{className:R(`project-entry-card project-join-card`,c),...l,children:[(0,P.jsx)(sf,{icon:(0,P.jsx)(ki,{}),title:e,description:t}),(0,P.jsxs)(`div`,{className:`project-entry-card-content project-join-card-content`,children:[(0,P.jsxs)(`div`,{className:`project-join-card-form-row`,children:[(0,P.jsx)(Os,{type:`text`,"aria-label":n,value:i,onChange:e=>s(e.target.value),...r===void 0?{}:{placeholder:r}}),(0,P.jsx)(`div`,{className:`project-join-card-actions`,children:(0,P.jsxs)(bs,{type:`submit`,disabled:i.trim()===``,children:[o,(0,P.jsx)(ai,{"aria-hidden":`true`})]})})]}),a==null?null:(0,P.jsx)(Ns,{children:a})]})]})}function lf({title:e,description:t,actionHref:n,actionLabel:r=`Local projects`,expanded:i,statusTitle:a,statusDescription:o,command:s,onAction:c,onCopyCommand:l,className:u,...d}){let f=(0,N.useId)();return(0,P.jsxs)(`section`,{className:R(`project-entry-card project-launch-card`,i?`is-expanded`:void 0,u),...d,children:[(0,P.jsx)(sf,{icon:(0,P.jsx)($i,{}),title:e,description:t}),(0,P.jsxs)(`div`,{className:`project-entry-card-content project-launch-card-content`,children:[i?(0,P.jsxs)(`div`,{className:`project-launch-card-status`,id:f,children:[(0,P.jsx)(`p`,{className:`project-launch-card-status-title`,role:`status`,"aria-live":`polite`,children:a}),(0,P.jsx)(`p`,{children:o}),(0,P.jsx)(uf,{command:s,...l===void 0?{}:{onCopyCommand:l}})]}):null,(0,P.jsx)(`div`,{className:`project-launch-card-actions`,children:(0,P.jsx)(bs,{asChild:!0,children:(0,P.jsxs)(`a`,{href:n,"aria-expanded":i,...i?{"aria-controls":f}:{},onClick:c,children:[r,(0,P.jsx)(ai,{"aria-hidden":`true`})]})})})]})]})}function uf({command:e,terminalLabel:t=`Install and start in your terminal`,copyLabel:n=`Copy`,onCopyCommand:r,className:i,...a}){return(0,P.jsxs)(`section`,{className:R(`project-launch-terminal`,i),...a,children:[(0,P.jsxs)(`div`,{className:`project-launch-terminal-bar`,children:[(0,P.jsx)(`span`,{children:t}),r===void 0?null:(0,P.jsxs)(xs,{className:`project-launch-copy-button`,type:`button`,"aria-label":`Copy launch command`,onClick:()=>r(e),children:[(0,P.jsx)(vi,{"aria-hidden":`true`}),n]})]}),(0,P.jsx)(`pre`,{className:`project-launch-command-block`,"aria-label":`Launch command`,children:(0,P.jsx)(`code`,{children:(0,P.jsxs)(`span`,{className:`project-launch-command-line`,children:[(0,P.jsx)(`span`,{className:`project-launch-command-prompt`,"aria-hidden":`true`,children:`>`}),(0,P.jsx)(`span`,{children:e})]})})})]})}function df({children:e,className:t,...n}){return(0,P.jsx)(`ul`,{className:R(`project-list`,t),"aria-label":`Recent projects`,...n,children:e})}function ff({title:e,children:t,listLabel:n,summaryClassName:r,className:i,...a}){return(0,P.jsxs)(`details`,{className:R(`project-list-disclosure`,i),...a,children:[(0,P.jsxs)(`summary`,{className:R(`project-list-disclosure-summary`,r),children:[(0,P.jsx)(ui,{"aria-hidden":`true`}),(0,P.jsx)(`strong`,{children:e})]}),(0,P.jsx)(df,{...n===void 0?{}:{"aria-label":n},children:t})]})}function pf({title:e,statusLabel:t,online:n=!1,details:r,className:i,disabled:a,...o}){return(0,P.jsx)(`li`,{className:`project-list-item`,children:(0,P.jsxs)(`button`,{className:R(`project-list-row`,n?`is-online`:`is-offline`,i),type:`button`,disabled:a,...o,children:[(0,P.jsxs)(`span`,{className:`project-list-identity`,children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsxs)(`small`,{children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]})]}),r.map(e=>(0,P.jsxs)(`span`,{className:`project-list-detail`,children:[(0,P.jsx)(`small`,{children:e.label}),(0,P.jsx)(`strong`,{children:e.value})]},e.label)),(0,P.jsx)(ai,{"aria-hidden":`true`})]})})}function mf({children:e,className:t,...n}){return(0,P.jsx)(`li`,{className:R(`project-list-item project-list-state-row`,t),...n,children:e})}function hf({open:e,onOpenChange:t,title:n,description:r,children:i,closeDisabled:a=!1,explicitCloseOnly:o=!1,className:s}){return(0,P.jsxs)(Uu,{open:e,onOpenChange:e=>{(e||!a)&&t(e)},children:[(0,P.jsx)(Yu,{className:`product-entry-dialog-overlay`}),(0,P.jsx)($u,{asChild:!0,onEscapeKeyDown:e=>{(a||o)&&e.preventDefault()},onInteractOutside:e=>{(a||o)&&e.preventDefault()},onPointerDownOutside:e=>{(a||o)&&e.preventDefault()},children:(0,P.jsxs)(Yd,{className:R(`product-entry-dialog-card`,s),children:[(0,P.jsxs)(`header`,{className:`product-entry-dialog-header`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(id,{children:n}),r===void 0?null:(0,P.jsx)(od,{children:r})]}),(0,P.jsx)(cd,{asChild:!0,children:(0,P.jsx)(ys,{type:`button`,label:`Close`,icon:(0,P.jsx)(ra,{"aria-hidden":`true`}),disabled:a})})]}),i]})})]})}function gf({open:e,onOpenChange:t,steps:n,currentStep:r,children:i,action:a,backAction:o,feedback:s,closeDisabled:c=!1,explicitCloseOnly:l=!1,className:u,...d}){return(0,P.jsxs)(hf,{open:e,onOpenChange:t,title:`New project`,description:`Step ${r+1} of ${n.length}`,closeDisabled:c,explicitCloseOnly:l,className:`local-console-create-card`,children:[(0,P.jsx)(`ol`,{className:`local-console-create-steps`,"aria-label":`New project steps`,children:n.map((e,t)=>(0,P.jsxs)(`li`,{className:R(t===r?`is-current`:void 0,t<r?`is-complete`:void 0),"aria-current":t===r?`step`:void 0,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,children:t+1}),(0,P.jsx)(`small`,{children:e})]},e))}),(0,P.jsxs)(`form`,{className:R(`local-console-create-form`,u),...d,children:[(0,P.jsx)(`div`,{className:`local-console-create-body`,children:i}),s===void 0?null:(0,P.jsx)(`div`,{className:`local-console-create-feedback`,children:s}),(0,P.jsxs)(`footer`,{className:`local-console-create-actions`,children:[(0,P.jsx)(`div`,{children:o}),(0,P.jsx)(`div`,{children:a})]})]})]})}function _f({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`local-console-form-grid`,t),...n,children:e})}function vf({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`local-console-inline-actions`,t),...n,children:e})}function yf({title:e,description:t,children:n,className:r,...i}){return(0,P.jsxs)(`section`,{className:R(`local-console-field-group`,r),...i,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`strong`,{children:e}),t===void 0?null:(0,P.jsx)(`small`,{children:t})]}),(0,P.jsx)(`div`,{className:`local-console-field-group-body`,children:n})]})}function bf({title:e,children:t,className:n,...r}){return(0,P.jsxs)(`section`,{className:R(`local-console-project-section`,n),...r,children:[(0,P.jsx)(`header`,{className:`local-console-project-section-header`,children:(0,P.jsx)(`strong`,{children:e})}),(0,P.jsx)(df,{children:t})]})}function xf({children:e,className:t,...n}){return(0,P.jsx)(ff,{title:`Unavailable`,className:R(`local-console-unavailable-projects`,t),summaryClassName:`local-console-project-section-header`,...n,children:e})}function Sf({title:e,statusLabel:t,online:n=!1,path:r,createdLabel:i,providerLabel:a,providerStatus:o,actions:s,className:c,...l}){return(0,P.jsx)(`li`,{className:R(`project-list-item`,`local-console-project-item`,c),...l,children:(0,P.jsxs)(`div`,{className:R(`local-console-project-row`,n?`is-online`:`is-offline`),children:[(0,P.jsxs)(`span`,{className:`project-list-identity`,children:[(0,P.jsx)(`span`,{className:`local-console-project-title`,children:(0,P.jsx)(`strong`,{children:e})}),(0,P.jsxs)(`span`,{className:`local-console-project-signals`,children:[(0,P.jsxs)(`small`,{className:`local-console-runtime-status`,children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]}),(0,P.jsxs)(`small`,{className:R(`local-console-provider-status`,`is-${o}`),children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),a]})]})]}),(0,P.jsxs)(`span`,{className:`local-console-project-metadata`,children:[(0,P.jsx)(`strong`,{className:`local-console-project-date`,children:i}),(0,P.jsx)(`small`,{className:`local-console-project-path`,title:typeof r==`string`?r:void 0,children:r})]}),(0,P.jsx)(`span`,{className:`local-console-project-actions`,children:s})]})})}function Cf(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var wf=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Tf=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ef={};function Df(e,t){return((t||Ef).jsx?Tf:wf).test(e)}var Of=/[ \t\n\f\r]/g;function kf(e){return typeof e==`object`?e.type===`text`?Af(e.value):!1:Af(e)}function Af(e){return e.replace(Of,``)===``}var jf=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};jf.prototype.normal={},jf.prototype.property={},jf.prototype.space=void 0;function Mf(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new jf(n,r,t)}function Nf(e){return e.toLowerCase()}var Pf=class{constructor(e,t){this.attribute=t,this.property=e}};Pf.prototype.attribute=``,Pf.prototype.booleanish=!1,Pf.prototype.boolean=!1,Pf.prototype.commaOrSpaceSeparated=!1,Pf.prototype.commaSeparated=!1,Pf.prototype.defined=!1,Pf.prototype.mustUseProperty=!1,Pf.prototype.number=!1,Pf.prototype.overloadedBoolean=!1,Pf.prototype.property=``,Pf.prototype.spaceSeparated=!1,Pf.prototype.space=void 0;var Ff=s({boolean:()=>U,booleanish:()=>Lf,commaOrSpaceSeparated:()=>Vf,commaSeparated:()=>Bf,number:()=>W,overloadedBoolean:()=>Rf,spaceSeparated:()=>zf}),If=0,U=Hf(),Lf=Hf(),Rf=Hf(),W=Hf(),zf=Hf(),Bf=Hf(),Vf=Hf();function Hf(){return 2**++If}var Uf=Object.keys(Ff),Wf=class extends Pf{constructor(e,t,n,r){let i=-1;if(super(e,t),Gf(this,`space`,r),typeof n==`number`)for(;++i<Uf.length;){let e=Uf[i];Gf(this,Uf[i],(n&Ff[e])===Ff[e])}}};Wf.prototype.defined=!0;function Gf(e,t,n){n&&(e[t]=n)}function Kf(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Wf(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Nf(r)]=r,n[Nf(a.attribute)]=r}return new jf(t,n,e.space)}var qf=Kf({properties:{ariaActiveDescendant:null,ariaAtomic:Lf,ariaAutoComplete:null,ariaBusy:Lf,ariaChecked:Lf,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:zf,ariaCurrent:null,ariaDescribedBy:zf,ariaDetails:null,ariaDisabled:Lf,ariaDropEffect:zf,ariaErrorMessage:null,ariaExpanded:Lf,ariaFlowTo:zf,ariaGrabbed:Lf,ariaHasPopup:null,ariaHidden:Lf,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zf,ariaLevel:W,ariaLive:null,ariaModal:Lf,ariaMultiLine:Lf,ariaMultiSelectable:Lf,ariaOrientation:null,ariaOwns:zf,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:Lf,ariaReadOnly:Lf,ariaRelevant:null,ariaRequired:Lf,ariaRoleDescription:zf,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:Lf,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Jf(e,t){return t in e?e[t]:t}function Yf(e,t){return Jf(e,t.toLowerCase())}var Xf=Kf({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Bf,acceptCharset:zf,accessKey:zf,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:zf,autoFocus:U,autoPlay:U,blocking:zf,capture:null,charSet:null,checked:U,cite:null,className:zf,cols:W,colSpan:null,content:null,contentEditable:Lf,controls:U,controlsList:zf,coords:W|Bf,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:Rf,draggable:Lf,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:zf,height:W,hidden:Rf,high:W,href:null,hrefLang:null,htmlFor:zf,httpEquiv:zf,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:zf,itemRef:zf,itemScope:U,itemType:zf,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:U,optimum:W,pattern:null,ping:zf,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:zf,required:U,reversed:U,rows:W,rowSpan:W,sandbox:zf,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:Lf,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:U,useMap:null,value:Lf,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zf,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:Lf,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:U,disableRemotePlayback:U,prefix:null,property:null,results:W,security:null,unselectable:null},space:`html`,transform:Yf}),Zf=Kf({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Vf,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:zf,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:U,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Bf,g2:Bf,glyphName:Bf,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:Vf,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:W,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zf,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vf,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vf,rev:Vf,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vf,requiredFeatures:Vf,requiredFonts:Vf,requiredFormats:Vf,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:Vf,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vf,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vf,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Jf}),Qf=Kf({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),$f=Kf({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Yf}),ep=Kf({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),tp={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},np=/[A-Z]/g,rp=/-[a-z]/g,ip=/^data[-\w.:]+$/i;function ap(e,t){let n=Nf(t),r=t,i=Pf;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ip.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(rp,sp);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!rp.test(e)){let n=e.replace(np,op);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Wf}return new i(r,t)}function op(e){return`-`+e.toLowerCase()}function sp(e){return e.charAt(1).toUpperCase()}var cp=Mf([qf,Xf,Qf,$f,ep],`html`),lp=Mf([qf,Zf,Qf,$f,ep],`svg`);function up(e){return e.join(` `).trim()}var dp=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
51
51
|
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function ee(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),ee()}function _(e){return e?e.replace(l,p):p}t.exports=g})),fp=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(dp());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),pp=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),mp=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(fp()),r=pp();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),hp=_p(`end`),gp=_p(`start`);function _p(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function vp(e){let t=gp(e),n=hp(e);if(t&&n)return{start:t,end:n}}function yp(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?xp(e.position):`start`in e||`end`in e?xp(e):`line`in e||`column`in e?bp(e):``}function bp(e){return Sp(e&&e.line)+`:`+Sp(e&&e.column)}function xp(e){return bp(e&&e.start)+`-`+bp(e&&e.end)}function Sp(e){return e&&typeof e==`number`?e:1}var Cp=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=yp(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Cp.prototype.file=``,Cp.prototype.name=``,Cp.prototype.reason=``,Cp.prototype.message=``,Cp.prototype.stack=``,Cp.prototype.column=void 0,Cp.prototype.line=void 0,Cp.prototype.ancestors=void 0,Cp.prototype.cause=void 0,Cp.prototype.fatal=void 0,Cp.prototype.place=void 0,Cp.prototype.ruleId=void 0,Cp.prototype.source=void 0;var wp=l(mp(),1),Tp={}.hasOwnProperty,Ep=new Map,Dp=/[A-Z]/g,Op=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),kp=new Set([`td`,`th`]),Ap=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function jp(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Hp(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Vp(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?lp:cp,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Mp(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Mp(e,t,n){if(t.type===`element`)return Np(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Pp(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ip(e,t,n);if(t.type===`mdxjsEsm`)return Fp(e,t);if(t.type===`root`)return Lp(e,t,n);if(t.type===`text`)return Rp(e,t)}function Np(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=lp,e.schema=i),e.ancestors.push(t);let a=Jp(e,t.tagName,!1),o=Up(e,t),s=Gp(e,t);return Op.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!kf(e):!0})),zp(e,o,a,t),Bp(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Pp(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Yp(e,t.position)}function Fp(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Yp(e,t.position)}function Ip(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=lp,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Jp(e,t.name,!0),o=Wp(e,t),s=Gp(e,t);return zp(e,o,a,t),Bp(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Lp(e,t,n){let r={};return Bp(r,Gp(e,t)),e.create(t,e.Fragment,r,n)}function Rp(e,t){return t.value}function zp(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Bp(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Vp(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Hp(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=gp(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Up(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Tp.call(t.properties,i)){let a=Kp(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&kp.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Wp(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Yp(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Yp(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Gp(e,t){let n=[],r=-1,i=e.passKeys?new Map:Ep;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Mp(e,a,o);s!==void 0&&n.push(s)}return n}function Kp(e,t,n){let r=ap(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Cf(n):up(n)),r.property===`style`){let t=typeof n==`object`?n:qp(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Xp(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?tp[r.property]||r.property:r.attribute,n]}}function qp(e,t){try{return(0,wp.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Cp("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Ap+`#cannot-parse-style-attribute`,r}}function Jp(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Df(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Df(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Tp.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Yp(e)}function Yp(e,t){let n=new Cp("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Ap+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Xp(e){let t={},n;for(n in e)Tp.call(e,n)&&(t[Zp(n)]=e[n]);return t}function Zp(e){let t=e.replace(Dp,Qp);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Qp(e){return`-`+e.toLowerCase()}var $p={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},em={};function tm(e,t){let n=t||em;return nm(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function nm(e,t,n){if(im(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return rm(e.children,t,n)}return Array.isArray(e)?rm(e,t,n):``}function rm(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=nm(e[i],t,n);return r.join(``)}function im(e){return!!(e&&typeof e==`object`)}var am=document.createElement(`i`);function om(e){let t=`&`+e+`;`;am.innerHTML=t;let n=am.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function sm(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function cm(e,t){return e.length>0?(sm(e,e.length,0,t),e):t}var lm={}.hasOwnProperty;function um(e){let t={},n=-1;for(;++n<e.length;)dm(t,e[n]);return t}function dm(e,t){let n;for(n in t){let r=(lm.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){lm.call(r,a)||(r[a]=[]);let e=i[a];fm(r[a],Array.isArray(e)?e:e?[e]:[])}}}function fm(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);sm(e,0,0,r)}function pm(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function mm(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var hm=Em(/[A-Za-z]/),gm=Em(/[\dA-Za-z]/),_m=Em(/[#-'*+\--9=?A-Z^-~]/);function vm(e){return e!==null&&(e<32||e===127)}var ym=Em(/\d/),bm=Em(/[\dA-Fa-f]/),xm=Em(/[!-/:-@[-`{-~]/);function G(e){return e!==null&&e<-2}function Sm(e){return e!==null&&(e<0||e===32)}function Cm(e){return e===-2||e===-1||e===32}var wm=Em(/\p{P}|\p{S}/u),Tm=Em(/\s/);function Em(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Dm(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&gm(e.charCodeAt(n+1))&&gm(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Om(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Cm(r)?(e.enter(n),s(r)):t(r)}function s(r){return Cm(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var km={tokenize:Am};function Am(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Om(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return G(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var jm={tokenize:Nm},Mm={tokenize:Pm};function Nm(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return sm(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Mm,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Mm,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return G(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;sm(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Pm(e,t,n){return Om(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Fm(e){if(e===null||Sm(e)||Tm(e))return 1;if(wm(e))return 2}function Im(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Lm={name:`attention`,resolveAll:Rm,tokenize:zm};function Rm(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Bm(d,-c),Bm(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=cm(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=cm(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=cm(l,Im(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=cm(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=cm(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,sm(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function zm(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Fm(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Fm(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Bm(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Vm={name:`autolink`,tokenize:Hm};function Hm(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return hm(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||gm(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||gm(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||vm(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):_m(t)?(e.consume(t),l):n(t)}function u(e){return gm(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||gm(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Um={partial:!0,tokenize:Wm};function Wm(e,t,n){return r;function r(t){return Cm(t)?Om(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||G(e)?t(e):n(e)}}var Gm={continuation:{tokenize:qm},exit:Jm,name:`blockQuote`,tokenize:Km};function Km(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Cm(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function qm(e,t,n){let r=this;return i;function i(t){return Cm(t)?Om(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Gm,t,n)(r)}}function Jm(e){e.exit(`blockQuote`)}var Ym={name:`characterEscape`,tokenize:Xm};function Xm(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return xm(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Zm={name:`characterReference`,tokenize:Qm};function Qm(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=gm,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=bm,u):(e.enter(`characterReferenceValue`),a=7,o=ym,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===gm&&!om(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var $m={partial:!0,tokenize:nh},eh={concrete:!0,name:`codeFenced`,tokenize:th};function th(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Cm(t)?Om(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||G(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check($m,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||G(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Cm(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Om(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||G(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||G(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Cm(t)?Om(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||G(t)?e.check($m,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||G(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Cm(t)?Om(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Cm(t)?Om(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||G(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function nh(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var rh={name:`codeIndented`,tokenize:ah},ih={partial:!0,tokenize:oh};function ah(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Om(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):G(t)?e.attempt(ih,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||G(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function oh(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):G(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Om(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):G(e)?i(e):n(e)}}var sh={name:`codeText`,previous:lh,resolve:ch,tokenize:uh};function ch(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function lh(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function uh(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):G(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||G(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var dh=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&fh(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),fh(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),fh(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);fh(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);fh(this.left,t.reverse())}}};function fh(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function ph(e){let t={},n=-1,r,i,a,o,s,c,l,u=new dh(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,mh(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return sm(e,0,1/0,u.slice(0)),!l}function mh(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var hh={resolve:_h,tokenize:vh},gh={partial:!0,tokenize:yh};function _h(e){return ph(e),e}function vh(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):G(t)?e.check(gh,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function yh(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Om(e,a,`linePrefix`)}function a(i){if(i===null||G(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function bh(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||vm(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||G(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Sm(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||vm(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function xh(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):G(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||G(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Cm(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Sh(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):G(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Om(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||G(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Ch(e,t){let n;return r;function r(i){return G(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Cm(i)?Om(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var wh={name:`definition`,tokenize:Eh},Th={partial:!0,tokenize:Dh};function Eh(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return xh.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=mm(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Sm(t)?Ch(e,l)(t):l(t)}function l(t){return bh(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Th,d,d)(t)}function d(t){return Cm(t)?Om(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||G(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Dh(e,t,n){return r;function r(t){return Sm(t)?Ch(e,i)(t):n(t)}function i(t){return Sh(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Cm(t)?Om(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||G(e)?t(e):n(e)}}var Oh={name:`hardBreakEscape`,tokenize:kh};function kh(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return G(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Ah={name:`headingAtx`,resolve:jh,tokenize:Mh};function jh(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},sm(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Mh(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Sm(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||G(n)?(e.exit(`atxHeading`),t(n)):Cm(n)?Om(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Sm(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Nh=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Ph=[`pre`,`script`,`style`,`textarea`],Fh={concrete:!0,name:`htmlFlow`,resolveTo:Rh,tokenize:zh},Ih={partial:!0,tokenize:Vh},Lh={partial:!0,tokenize:Bh};function Rh(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function zh(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:j):hm(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):hm(a)?(e.consume(a),i=4,r.interrupt?t:j):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:j):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:D:m):n(i)}function h(t){return hm(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Sm(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Ph.includes(l)?(i=1,r.interrupt?t(s):D(s)):Nh.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||gm(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return Cm(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||hm(t)?(e.consume(t),b):Cm(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||gm(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Cm(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Cm(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||G(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Sm(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Cm(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||G(t)?D(t):Cm(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),ne):t===60&&i===1?(e.consume(t),A):t===62&&i===4?(e.consume(t),M):t===63&&i===3?(e.consume(t),j):t===93&&i===5?(e.consume(t),ie):G(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Ih,ae,O)(t)):t===null||G(t)?(e.exit(`htmlFlowData`),O(t)):(e.consume(t),D)}function O(t){return e.check(Lh,k,ae)(t)}function k(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||G(t)?O(t):(e.enter(`htmlFlowData`),D(t))}function ne(t){return t===45?(e.consume(t),j):D(t)}function A(t){return t===47?(e.consume(t),o=``,re):D(t)}function re(t){if(t===62){let n=o.toLowerCase();return Ph.includes(n)?(e.consume(t),M):D(t)}return hm(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),re):D(t)}function ie(t){return t===93?(e.consume(t),j):D(t)}function j(t){return t===62?(e.consume(t),M):t===45&&i===2?(e.consume(t),j):D(t)}function M(t){return t===null||G(t)?(e.exit(`htmlFlowData`),ae(t)):(e.consume(t),M)}function ae(n){return e.exit(`htmlFlow`),t(n)}}function Bh(e,t,n){let r=this;return i;function i(t){return G(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Vh(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Um,t,n)}}var Hh={name:`htmlText`,tokenize:Uh};function Uh(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):hm(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):hm(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):G(t)?(o=d,A(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ne(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):G(t)?(o=h,A(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ne(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ne(t):G(t)?(o=v,A(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):G(t)?(o=y,A(t)):(e.consume(t),y)}function b(e){return e===62?ne(e):y(e)}function x(t){return hm(t)?(e.consume(t),S):n(t)}function S(t){return t===45||gm(t)?(e.consume(t),S):C(t)}function C(t){return G(t)?(o=C,A(t)):Cm(t)?(e.consume(t),C):ne(t)}function w(t){return t===45||gm(t)?(e.consume(t),w):t===47||t===62||Sm(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ne):t===58||t===95||hm(t)?(e.consume(t),E):G(t)?(o=T,A(t)):Cm(t)?(e.consume(t),T):ne(t)}function E(t){return t===45||t===46||t===58||t===95||gm(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):G(t)?(o=ee,A(t)):Cm(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,O):G(t)?(o=D,A(t)):Cm(t)?(e.consume(t),D):(e.consume(t),k)}function O(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):G(t)?(o=O,A(t)):(e.consume(t),O)}function k(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Sm(t)?T(t):(e.consume(t),k)}function te(e){return e===47||e===62||Sm(e)?T(e):n(e)}function ne(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function A(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return Cm(t)?Om(e,ie,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ie(t)}function ie(t){return e.enter(`htmlTextData`),o(t)}}var Wh={name:`labelEnd`,resolveAll:Jh,resolveTo:Yh,tokenize:Xh},Gh={tokenize:Zh},Kh={tokenize:Qh},qh={tokenize:$h};function Jh(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&sm(e,0,e.length,n),e}function Yh(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=cm(s,e.slice(a+1,a+r+3)),s=cm(s,[[`enter`,u,t]]),s=cm(s,Im(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=cm(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=cm(s,e.slice(o+1)),s=cm(s,[[`exit`,c,t]]),sm(e,a,e.length,s),e}function Xh(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(mm(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Gh,u,o?u:d)(t):t===91?e.attempt(Kh,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(qh,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Zh(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Sm(t)?Ch(e,a)(t):a(t)}function a(t){return t===41?u(t):bh(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Sm(t)?Ch(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Sh(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Sm(t)?Ch(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Qh(e,t,n){let r=this;return i;function i(t){return xh.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(mm(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function $h(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var eg={name:`labelStartImage`,resolveAll:Wh.resolveAll,tokenize:tg};function tg(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var ng={name:`labelStartLink`,resolveAll:Wh.resolveAll,tokenize:rg};function rg(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var ig={name:`lineEnding`,tokenize:ag};function ag(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Om(e,t,`linePrefix`)}}var og={name:`thematicBreak`,tokenize:sg};function sg(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||G(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Cm(t)?Om(e,s,`whitespace`)(t):s(t))}}var cg={continuation:{tokenize:fg},exit:mg,name:`list`,tokenize:dg},lg={partial:!0,tokenize:hg},ug={partial:!0,tokenize:pg};function dg(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:ym(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(og,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return ym(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Um,r.interrupt?n:u,e.attempt(lg,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Cm(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function fg(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Um,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Om(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Cm(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ug,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Om(e,e.attempt(cg,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function pg(e,t,n){let r=this;return Om(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function mg(e){e.exit(this.containerState.type)}function hg(e,t,n){let r=this;return Om(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Cm(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var gg={name:`setextUnderline`,resolveTo:_g,tokenize:vg};function _g(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function vg(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Cm(t)?Om(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||G(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var yg={tokenize:bg};function bg(e){let t=this,n=e.attempt(Um,r,e.attempt(this.parser.constructs.flowInitial,i,Om(e,e.attempt(this.parser.constructs.flow,i,e.attempt(hh,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var xg={resolveAll:Tg()},Sg=wg(`string`),Cg=wg(`text`);function wg(e){return{resolveAll:Tg(e===`text`?Eg:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Tg(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Eg(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Dg=s({attentionMarkers:()=>Fg,contentInitial:()=>kg,disable:()=>Ig,document:()=>Og,flow:()=>jg,flowInitial:()=>Ag,insideSpan:()=>Pg,string:()=>Mg,text:()=>Ng}),Og={42:cg,43:cg,45:cg,48:cg,49:cg,50:cg,51:cg,52:cg,53:cg,54:cg,55:cg,56:cg,57:cg,62:Gm},kg={91:wh},Ag={[-2]:rh,[-1]:rh,32:rh},jg={35:Ah,42:og,45:[gg,og],60:Fh,61:gg,95:og,96:eh,126:eh},Mg={38:Zm,92:Ym},Ng={[-5]:ig,[-4]:ig,[-3]:ig,33:eg,38:Zm,42:Lm,60:[Vm,Hh],91:ng,92:[Oh,Ym],93:Wh,95:Lm,96:sh},Pg={null:[Lm,xg]},Fg={null:[42,95]},Ig={null:[]};function Lg(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=cm(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Im(a,l.events,l),l.events):[]}function f(e,t){return zg(p(e),t)}function p(e){return Rg(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){G(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&sm(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Rg(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function zg(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
52
52
|
`;break;case-3:o=`\r
|
|
53
53
|
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Bg(e){let t={constructs:um([Dg,...(e||{}).extensions||[]]),content:n(km),defined:[],document:n(jm),flow:n(yg),lazy:{},string:n(Sg),text:n(Cg)};return t;function n(e){return n;function n(n){return Lg(t,e,n)}}}function Vg(e){for(;!ph(e););return e}var Hg=/[\0\t\n\r]/g;function Ug(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Hg.lastIndex=u,c=Hg.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Wg=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Gg(e){return e.replace(Wg,Kg)}function Kg(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return pm(n.slice(t?2:1),t?16:10)}return om(n)||e}var qg={}.hasOwnProperty;function Jg(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Yg(n)(Vg(Bg(n).document().write(Ug()(e,t,!0))))}function Yg(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Se),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ve),blockQuote:a(pe),characterEscape:T,characterReference:T,codeFenced:a(me),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(me,o),codeText:a(he,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(_e),hardBreakEscape:a(ye),hardBreakTrailing:a(ye),htmlFlow:a(be,o),htmlFlowData:T,htmlText:a(be,o),htmlTextData:T,image:a(xe),label:o,link:a(Se),listItem:a(we),listItemValue:f,listOrdered:a(Ce,d),listUnordered:a(Ce),paragraph:a(Te),reference:oe,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ve),strong:a(Ee),thematicBreak:a(Oe)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:fe,autolinkProtocol:de,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:le,characterReference:ue,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(te),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(O),htmlFlowData:E,htmlText:c(k),htmlTextData:E,image:c(A),label:ie,labelText:re,lineEnding:ee,link:c(ne),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:se,resourceDestinationString:j,resourceTitleString:M,resource:ae,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Zg(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];qg.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||$g).call(a,void 0,e[0])}for(r.position={start:Xg(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Xg(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Xg(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||$g).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+yp({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Xg(e.end)}function u(){return tm(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=mm(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=De(),n.position={start:Xg(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Xg(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Xg(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function D(){this.data.atHardBreak=!0}function O(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function A(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function re(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Gg(t),n.identifier=mm(t).toLowerCase()}function ie(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function M(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ae(){this.data.inReference=void 0}function oe(){this.data.referenceType=`collapsed`}function se(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=mm(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ce(e){this.data.characterReferenceType=e.type}function le(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=pm(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=om(t);let i=this.stack[this.stack.length-1];i.value+=r}function ue(e){let t=this.stack.pop();t.position.end=Xg(e.end)}function de(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function fe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function pe(){return{type:`blockquote`,children:[]}}function me(){return{type:`code`,lang:null,meta:null,value:``}}function he(){return{type:`inlineCode`,value:``}}function ge(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function _e(){return{type:`emphasis`,children:[]}}function ve(){return{type:`heading`,depth:0,children:[]}}function ye(){return{type:`break`}}function be(){return{type:`html`,value:``}}function xe(){return{type:`image`,title:null,url:``,alt:null}}function Se(){return{type:`link`,title:null,url:``,children:[]}}function Ce(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function we(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Te(){return{type:`paragraph`,children:[]}}function Ee(){return{type:`strong`,children:[]}}function De(){return{type:`text`,value:``}}function Oe(){return{type:`thematicBreak`}}}function Xg(e){return{line:e.line,column:e.column,offset:e.offset}}function Zg(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Zg(e,r):Qg(e,r)}}function Qg(e,t){let n;for(n in t)if(qg.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function $g(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+yp({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yp({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+yp({start:t.start,end:t.end})+`) is still open`)}function e_(e){let t=this;t.parser=n;function n(n){return Jg(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function t_(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function n_(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
@@ -66,4 +66,4 @@ Error generating stack: `+e.message+`
|
|
|
66
66
|
`)||T!==e.length||!t.endsWith(`
|
|
67
67
|
`)||n!==t.length-1)return null;let r=e.slice(0,-1);if(!t.startsWith(r))return null;let i=t.slice(r.length,-1);return i===``?null:{nextValue:`${e}${i}`,nextCaret:e.length+i.length}},he=(e,t,n,r=!1)=>{let i=b.current;if(i===null)return{nextValue:e,nextCaret:t};let a=n??i.finalData;return a!==void 0&&(b.current={...i,finalData:a}),a!==void 0&&a!==``&&e.slice(i.start,i.start+i.data.length)===i.data&&e.slice(i.start+i.data.length,i.start+i.data.length+a.length)===a?(b.current=null,{nextValue:`${e.slice(0,i.start)}${e.slice(i.start+i.data.length)}`,nextCaret:Math.max(i.start,t-i.data.length)}):a!==void 0&&a!==``&&e.slice(i.start,i.start+a.length)===a?(b.current=null,{nextValue:e,nextCaret:t}):(r&&a!==void 0&&(b.current=null),{nextValue:e,nextCaret:t})},ge=()=>{let t=h.current,n=t===null||!ae(t)?T:se(t).end;if(_y(e,n)!==null){w(!0),E(n),D(0),le(n);return}let r=n===0?``:e[n-1]??``,i=r!==``&&my.test(r)?` @`:`@`,a=`${e.slice(0,n)}${i}${e.slice(n)}`,o=n+i.length;w(!0),E(o),D(0),de(a,o)};(0,N.useEffect)(()=>{i===void 0||g.current===i||(g.current=i,ge())},[i]),(0,N.useEffect)(()=>{D(0)},[k?.start,k?.query]),(0,N.useLayoutEffect)(()=>{let t=h.current;if(t===null)return;let n=vy(e,k),r=xy(n);if(!v.current){let i=M(t)!==e,a=t.querySelector(`[data-mention-value]`)!==null,o=(Sy(n)||a)&&x.current!==r;(i||o)&&Cy(t,n),x.current=r,e===``&&(y.current=null,b.current=null)}_.current!==null&&(ce(t,_.current),_.current=null)},[k,e]);let _e=({clearCompositionSeedOnMiss:e=!1,compositionData:t}={})=>{let n=h.current;if(n===null)return;let r=he(M(n),se(n).end,t,e);de(r.nextValue,r.nextCaret)},ve=n=>{if(v.current||wy(n)){f?.(n);return}if(ne){if(n.key===`ArrowDown`){n.preventDefault(),D(e=>(e+1)%te.length);return}if(n.key===`ArrowUp`){n.preventDefault(),D(e=>(e-1+te.length)%te.length);return}if(n.key===`Enter`&&!n.shiftKey&&!n.metaKey||n.key===`Tab`){let e=te[A];if(e===void 0)return;n.preventDefault(),ue(e);return}}let i=h.current;if(i!==null&&(n.key===`Backspace`||n.key===`Delete`)){let t=se(i);if(t.start!==t.end){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start)}${e.slice(t.end)}`,t.start);return}if(n.key===`Backspace`&&t.start>0&&e[t.start-1]===`
|
|
68
68
|
`){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start-1)}${e.slice(t.start)}`,t.start-1);return}if(n.key===`Delete`&&e[t.start]===`
|
|
69
|
-
`){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start)}${e.slice(t.start+1)}`,t.start);return}let r=yy(e).find(r=>n.key===`Backspace`?t.start>r.start&&t.start<=r.end||t.start===r.end+1&&e[r.end]===` `:t.start>=r.start&&t.start<r.end);if(r!==void 0){n.preventDefault(),y.current=null,b.current=null;let i=n.key===`Backspace`&&t.start===r.end+1&&e[r.end]===` `?r.end+1:r.end;de(`${e.slice(0,r.start)}${e.slice(i)}`,r.start);return}if(n.key===`Backspace`&&t.start>0){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start-1)}${e.slice(t.start)}`,t.start-1);return}if(n.key===`Delete`&&t.start<e.length){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start)}${e.slice(t.start+1)}`,t.start);return}}if(t&&n.key===`Enter`){if(n.preventDefault(),r&&!n.shiftKey&&!n.metaKey){i?.closest(`form`)?.requestSubmit();return}pe();return}if(!t&&n.key===`Enter`){n.preventDefault(),i?.closest(`form`)?.requestSubmit();return}f?.(n)},ye=t=>{if(v.current||wy(t))return;let n=h.current;if(n===null)return;let r=M(n),i=se(n).end,a=me(r,i),o=a?.nextValue??r,s=a?.nextCaret??i,c=Ty(t);if(c.inputType===`insertText`&&Ey(c.data)){let t=s-c.data.length,n=`${o.slice(0,t)}${o.slice(s)}`;y.current=t>=0&&n===e?{data:c.data,start:t,end:s,valueBefore:n,createdAt:Date.now()}:null}else y.current=null;let l=he(o,s,void 0,!0);de(l.nextValue,l.nextCaret)},be=e=>{if(v.current||wy(e))return;let t=Ty(e);if(t.inputType===`insertParagraph`||t.inputType===`insertLineBreak`){pe()&&e.preventDefault();return}y.current=null},xe=t=>{t.preventDefault();let n=t.clipboardData.getData(`text/plain`),r=h.current;if(r===null)return;let i=se(r);de(`${e.slice(0,i.start)}${n}${e.slice(i.end)}`,i.start+n.length)},Se=()=>{let e=h.current;e===null||!ae(e)||E(se(e).end)},Ce=R(`mention-input-editor`,t?`is-multiline`:`is-singleline`,c),we=ne?(0,P.jsx)(`div`,{className:`mention-menu`,id:S,role:`listbox`,"aria-label":`Mention people`,children:te.map((e,t)=>(0,P.jsx)(`button`,{className:R(`mention-option`,t===A?`is-selected`:void 0),type:`button`,role:`option`,id:`${S}-option-${t}`,"aria-selected":t===A,onMouseEnter:()=>D(t),onMouseDown:t=>{t.preventDefault(),ue(e)},children:(0,P.jsxs)(`span`,{className:`mention-option-text`,children:[`@`,e.handle]})},e.id))}):null,Te=a?.current;return(0,P.jsxs)(`span`,{className:R(`mention-input`,t?`is-multiline`:void 0),children:[(0,P.jsx)(`div`,{className:Ce,contentEditable:!ie,role:`textbox`,"aria-label":j,"aria-multiline":t,"aria-disabled":ie,"aria-expanded":ne,...ne?{"aria-controls":S}:{},...re===void 0?{}:{"aria-activedescendant":re},"data-placeholder":m.placeholder,"data-max-rows":n,onBlur:e=>{w(!1),l?.(e)},onClick:e=>{Se(),u?.(e)},onFocus:e=>{w(!0),Se(),d?.(e)},onCompositionStart:()=>{v.current=!0;let e=h.current,t=y.current;if(y.current=null,e!==null&&t!==null&&Date.now()-t.createdAt<500&&M(e).slice(t.start,t.end)===t.data){b.current=t,_.current=null,E(t.start),s(t.valueBefore);let n=vy(t.valueBefore,null);Cy(e,n),x.current=xy(n),ce(e,t.start)}else b.current=null},onCompositionEnd:e=>{v.current=!1;let t=Ty(e);_e(t.data===null?{}:{compositionData:t.data})},onBeforeInput:be,onInput:ye,onKeyDown:ve,onKeyUp:e=>{!v.current&&!wy(e)&&Se(),p?.(e)},onPaste:xe,ref:h,suppressContentEditableWarning:!0}),Te==null?we:(0,_c.createPortal)(we,Te)]})}function Ay(e){return(0,P.jsx)(Fi,{...e})}function jy({avatar:e,author:t,time:n,children:r,system:i=!1,className:a,...o}){return(0,P.jsxs)(`article`,{className:R(`message`,i?`is-system`:void 0,a),...o,children:[(0,P.jsxs)(`div`,{className:`message-byline`,children:[e,(0,P.jsxs)(`div`,{className:`message-meta`,children:[(0,P.jsx)(`span`,{className:`message-author`,children:t}),n===void 0?null:(0,P.jsx)(`span`,{className:`message-time`,children:n})]})]}),(0,P.jsx)(`div`,{className:`message-content`,children:(0,P.jsx)(`div`,{className:`message-card`,children:r})})]})}function My({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`message-markdown`,t),...n,children:(0,P.jsx)(ry,{components:Uy,children:e})})}function Ny({children:e}){return(0,P.jsx)(`p`,{children:Dy(e)})}function Py({children:e}){return(0,P.jsx)(`li`,{children:Dy(e)})}function Fy({children:e}){return(0,P.jsx)(`strong`,{children:Dy(e)})}function Iy({children:e}){return(0,P.jsx)(`em`,{children:Dy(e)})}function Ly({children:e}){return(0,P.jsx)(`h1`,{children:Dy(e)})}function Ry({children:e}){return(0,P.jsx)(`h2`,{children:Dy(e)})}function zy({children:e}){return(0,P.jsx)(`h3`,{children:Dy(e)})}function By({children:e}){return(0,P.jsx)(`h4`,{children:Dy(e)})}function Vy({children:e}){return(0,P.jsx)(`h5`,{children:Dy(e)})}function Hy({children:e}){return(0,P.jsx)(`h6`,{children:Dy(e)})}var Uy={p:Ny,li:Py,strong:Fy,em:Iy,h1:Ly,h2:Ry,h3:zy,h4:By,h5:Vy,h6:Hy};function Wy({name:e,category:t,imageUrl:n,className:r,"aria-label":i,...a}){let o=t===`image`&&n!==void 0;return(0,P.jsx)(`button`,{type:`button`,"aria-label":i??`Open ${t===`image`?`image`:`file`} ${e}`,className:R(`reference-message-card`,t===`image`?`is-image`:`is-file`,r),...a,children:o?(0,P.jsx)(`img`,{className:`reference-message-image`,src:n,alt:e,loading:`lazy`,decoding:`async`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`reference-message-icon`,"aria-hidden":`true`,children:t===`image`?(0,P.jsx)(Ei,{}):(0,P.jsx)(Ci,{})}),(0,P.jsx)(`span`,{className:`reference-message-main`,children:(0,P.jsx)(`strong`,{children:e})})]})})}function Gy({children:e,composer:t,empty:n,title:r=`Chat`,subtitle:i,actions:a,streamRef:o,streamOverlay:s,onStreamScroll:c,dropUploadPending:l=!1,onDropFiles:u,className:d,...f}){return(0,P.jsxs)(uy,{className:R(`panel chat-panel chat-primary`,d),"aria-label":`Group chat`,dropLabel:`Drop references to upload`,pending:l,onFilesUpload:u,...f,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ma,{icon:(0,P.jsx)(Ay,{"aria-hidden":`true`})}),(0,P.jsxs)(`div`,{className:`panel-title-copy`,children:[(0,P.jsx)(`h3`,{children:r}),i===void 0?null:(0,P.jsx)(`div`,{className:`panel-subtitle`,children:i})]})]}),a===void 0?null:(0,P.jsx)(`div`,{className:`panel-actions`,children:a})]}),(0,P.jsxs)(`div`,{className:`chat-stream-frame`,children:[(0,P.jsx)(`div`,{className:`chat-stream`,ref:o,onScroll:c,children:e??n}),s===void 0?null:(0,P.jsx)(`div`,{className:`chat-stream-overlay`,children:s})]}),t]})}function Ky({value:e,placeholder:t,ariaLabel:n,maxLength:r,saving:i=!1,disabled:a=!1,allowEmpty:o=!1,onUpdate:s,className:c,...l}){let u=(0,N.useRef)(null),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(e),[h,g]=(0,N.useState)(!1),_=i||h,v=!a&&!_&&s!==void 0,y=e.trim(),b=y.length===0;(0,N.useEffect)(()=>{d||m(e)},[d,e]),(0,N.useEffect)(()=>{d&&(u.current?.focus(),u.current?.select())},[d]);let x=()=>{m(e),f(!1)},S=()=>{let e=p.trim();if(!o&&e.length===0){x();return}if(e===y){f(!1);return}s===void 0||_||(g(!0),Promise.resolve(s(e)).then(()=>{f(!1)}).catch(()=>void 0).finally(()=>{g(!1)}))},C=e=>{if(e.key===`Enter`){e.preventDefault(),S();return}e.key===`Escape`&&(e.preventDefault(),x())};return(0,P.jsx)(`span`,{className:R(`inline-editable-text`,b?`is-empty`:void 0,d?`is-editing`:void 0,v?void 0:`is-disabled`,c),...l,children:d?(0,P.jsx)(`input`,{ref:u,className:`inline-editable-text-input`,"aria-label":n,value:p,maxLength:r,disabled:_,onBlur:S,onChange:e=>m(e.currentTarget.value),onKeyDown:C}):(0,P.jsx)(`button`,{className:`inline-editable-text-button`,type:`button`,"aria-label":n,disabled:!v,onClick:()=>f(!0),children:b?t:y})})}var qy={bare:``,quiet:`quiet-button`,pill:`pill-action`,action:`action-button`};function Jy({variant:e=`pill`,label:t,pendingLabel:n=t,pending:r=!1,disabled:i=!1,iconOnly:a=!1,accept:o,icon:s,onFileUpload:c,className:l,...u}){let d=i||r||c===void 0,f=r?n:t,p=e=>{let t=e.currentTarget.files?.[0];e.currentTarget.value=``,t!==void 0&&c?.(t)};return(0,P.jsxs)(`label`,{...u,className:R(qy[e],d?`is-disabled`:void 0,l),"aria-disabled":d,"aria-busy":r,"aria-label":u[`aria-label`]??f,title:u.title??f,children:[(0,P.jsx)(`input`,{type:`file`,accept:o,disabled:d,onChange:p}),s??(r?(0,P.jsx)(Mi,{className:`is-spinning`,"aria-hidden":`true`}):(0,P.jsx)(_i,{"aria-hidden":`true`})),a?null:(0,P.jsx)(`span`,{children:f})]})}function Yy({value:e,pending:t=!1,uploadPending:n=!1,placeholder:r=`Write a message`,mentionOptions:i,onValueChange:a,onComposerSubmit:o,onFileUpload:s,className:c,...l}){let[u,d]=(0,N.useState)(0),f=(0,N.useRef)(null);return(0,P.jsx)(`form`,{className:R(`composer`,c),"aria-label":`Message composer`,onSubmit:o,...l,children:(0,P.jsxs)(`div`,{className:`composer-input-shell`,ref:f,children:[(0,P.jsx)(ky,{"aria-label":`Message`,placeholder:r,value:e,multiline:!0,maxRows:8,submitOnEnter:!0,mentionRequestKey:u,menuPortalTargetRef:f,...i===void 0?{}:{mentionOptions:i},onValueChange:a}),(0,P.jsxs)(`div`,{className:`composer-tools`,"aria-label":`Message tools`,children:[(0,P.jsx)(`button`,{className:`composer-tool-button composer-mention-button`,type:`button`,"aria-label":`Mention people`,title:`Mention people`,onClick:()=>d(e=>e+1),children:(0,P.jsx)(oi,{"aria-hidden":`true`})}),(0,P.jsx)(Jy,{variant:`bare`,className:`composer-tool-button composer-upload-button`,label:`Upload image`,pendingLabel:`Uploading image`,pending:n,accept:`image/*`,icon:(0,P.jsx)(Ei,{"aria-hidden":`true`}),iconOnly:!0,onFileUpload:s}),(0,P.jsx)(Jy,{variant:`bare`,className:`composer-tool-button composer-upload-button`,label:`Upload file`,pendingLabel:`Uploading file`,pending:n,icon:(0,P.jsx)(Ci,{"aria-hidden":`true`}),iconOnly:!0,onFileUpload:s}),(0,P.jsx)(`button`,{className:`composer-tool-button composer-send-button`,type:`submit`,disabled:e.trim()===``||t,"aria-label":t?`Sending message`:`Send message`,title:t?`Sending message`:`Send message`,children:(0,P.jsx)(Gi,{"aria-hidden":`true`})})]})]})})}function Xy(e){return(0,P.jsx)(Ri,{...e})}var Zy={confirmed:(0,P.jsx)(li,{"aria-hidden":`true`}),question:(0,P.jsx)(pi,{"aria-hidden":`true`}),"task-change":(0,P.jsx)(Xi,{"aria-hidden":`true`})};function Qy({kind:e,children:t,className:n,...r}){return(0,P.jsxs)(`div`,{className:R(`scratchpad-row`,`is-${e}`,n),...r,children:[(0,P.jsx)(`span`,{className:`scratchpad-marker`,"aria-hidden":`true`,children:Zy[e]}),(0,P.jsx)(`p`,{children:t})]})}function $y({compiledTasks:e=[],onOpenCompiledTask:t}){return(0,P.jsxs)(`section`,{className:`scratchpad-submitted-receipt`,"aria-label":`Submitted to Worklist`,children:[(0,P.jsxs)(`div`,{className:`scratchpad-submitted-receipt-header`,children:[(0,P.jsx)(`strong`,{children:`Submitted to Worklist`}),(0,P.jsx)(li,{className:`scratchpad-submitted-receipt-check`,"aria-hidden":`true`})]}),e.length===0?(0,P.jsxs)(`div`,{className:`scratchpad-submitted-empty`,role:`status`,children:[(0,P.jsx)(Xi,{"aria-hidden":`true`}),(0,P.jsxs)(`span`,{className:`scratchpad-submitted-empty-copy`,children:[(0,P.jsx)(`span`,{children:`No new task created`}),(0,P.jsx)(`small`,{children:`This Scratchpad was submitted, but no Worklist task was added.`})]})]}):(0,P.jsx)(`div`,{className:`scratchpad-submitted-task-list`,children:e.map(e=>(0,P.jsxs)(`button`,{className:`scratchpad-submitted-task`,disabled:t===void 0,onClick:()=>t?.(e.taskId),type:`button`,children:[(0,P.jsxs)(`span`,{className:`scratchpad-submitted-task-copy`,children:[(0,P.jsx)(`span`,{children:e.title}),(0,P.jsx)(`small`,{children:e.moduleName})]}),(0,P.jsx)(di,{"aria-hidden":`true`})]},e.taskId))})]})}function eb({title:e,summary:t,sections:n,updatedLabel:r,updatedLabelPrefix:i=`Updated`,footerNote:a,submitAvailable:o,pages:s,empty:c,actionsDisabled:l=!1,compact:u=!1,syncPending:d=!1,submitPending:f=!1,onSubmitScratchpad:p,onOpenCompiledTask:m,className:h,...g}){let _=s!==void 0&&s.length>0,v=(0,N.useMemo)(()=>s!==void 0&&s.length>0?s:[{key:`current`,title:e,summary:t,sections:n,...r===void 0?{}:{updatedLabel:r},updatedLabelPrefix:i,...a===void 0?{}:{footerNote:a},...o===void 0?{}:{submitAvailable:o}}],[a,s,n,o,t,e,r,i]),y=Math.max(0,v.length-1),b=v[y]?.key,[x,S]=(0,N.useState)(y);(0,N.useEffect)(()=>{S(y)},[y,b]);let C=Math.min(x,Math.max(0,v.length-1)),w=v[C]??{key:`current`,title:e,summary:t,sections:n,...r===void 0?{}:{updatedLabel:r},updatedLabelPrefix:i,...a===void 0?{}:{footerNote:a},...o===void 0?{}:{submitAvailable:o}},T=d||f,E=f?`Running`:d?`Refreshing`:`Run`,ee=w.submitAvailable??w.sections.length>0,D=l||T||!ee||w.submitted===!0;return(0,P.jsx)(pa,{title:`Scratchpad`,icon:(0,P.jsx)(Xy,{"aria-hidden":`true`}),className:R(`scratchpad-panel`,u?`is-compact`:void 0,h),"aria-busy":T,...g,children:(0,P.jsxs)(`div`,{className:`scratchpad-panel-body scratchpad`,children:[!_&&w.sections.length===0?c??(0,P.jsx)(`div`,{}):(0,P.jsxs)(`div`,{className:R(`scratchpad-content`,w.submitted===!0?`is-submitted`:void 0),children:[(0,P.jsx)(`div`,{className:`scratchpad-head`,children:(0,P.jsx)(`div`,{children:(0,P.jsx)(`h4`,{children:w.title})})}),(0,P.jsx)(`p`,{className:`scratchpad-summary`,children:w.summary}),w.sections.map(e=>(0,P.jsxs)(`section`,{className:`scratchpad-section`,"aria-labelledby":e.id,children:[(0,P.jsx)(`span`,{className:`scratchpad-label`,id:e.id,children:e.label}),(0,P.jsx)(`div`,{className:`scratchpad-list`,children:e.rows.map(t=>(0,P.jsx)(Qy,{kind:t.kind,children:t.text},`${e.id}:${t.text}`))})]},e.id)),w.submitted===!0?(0,P.jsx)($y,{compiledTasks:w.compiledTasks??[],...m===void 0?{}:{onOpenCompiledTask:m}}):null]},w.key),!u&&v.length>1?(0,P.jsx)(`div`,{className:`scratchpad-history-nav`,children:(0,P.jsx)(fa,{"aria-label":`Scratchpad history`,currentPage:C,maxVisible:7,pageAriaLabel:e=>`Scratchpad page ${e+1}`,pageCount:v.length,onPageChange:S})}):null,(0,P.jsxs)(`div`,{className:`scratchpad-footer`,children:[w.footerNote===void 0?null:(0,P.jsx)(`p`,{className:R(`scratchpad-footer-note`,w.footerNote.tone===`error`?`is-error`:void 0),title:w.footerNote.text,children:w.footerNote.text}),u?null:(0,P.jsx)(`div`,{className:`scratchpad-submit-context`,children:w.updatedLabel===void 0?null:(0,P.jsxs)(`span`,{className:`scratchpad-updated-at`,children:[(0,P.jsx)(`span`,{children:w.updatedLabelPrefix??`Updated`}),(0,P.jsx)(`span`,{children:w.updatedLabel})]})}),(0,P.jsx)(`div`,{className:`scratchpad-footer-actions`,children:(0,P.jsxs)(bs,{className:R(`scratchpad-submit-button`,T?`is-pending`:void 0),type:`button`,"aria-busy":T,disabled:D,onClick:p,children:[T?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(zi,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:E})]})})]})]})})}function tb(e){return e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(mi,{"aria-hidden":`true`}):e===`pending`?(0,P.jsx)(ta,{"aria-hidden":`true`}):e===`running`?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(hi,{"aria-hidden":`true`})}function nb(e){return e===`complete`?`Complete`:e===`failed`?`Failed`:e===`pending`?`Needs input`:`Running`}function rb(e){return(0,P.jsx)(na,{"aria-hidden":`true`,"data-tone":e})}function ib({title:e,summary:t,tone:n,steps:r,metaLabel:i,className:a,...o}){let s=i??nb(n),c=o[`aria-label`]??`${e}. ${s}. ${t}`;return(0,P.jsx)(pa,{title:e,icon:rb(n),className:R(`execution-progress-panel`,`is-${n}`,a),"aria-label":c,...o,children:(0,P.jsx)(`div`,{className:`execution-progress-body`,children:(0,P.jsx)(`div`,{className:`execution-progress-list`,children:r.map(e=>(0,P.jsxs)(`div`,{className:R(`execution-progress-step`,`is-${e.status}`),children:[(0,P.jsx)(`span`,{className:R(`execution-progress-marker`,`is-${e.status}`),"aria-hidden":`true`,children:tb(e.status)}),(0,P.jsxs)(`span`,{className:`execution-progress-step-content`,children:[(0,P.jsxs)(`span`,{className:`execution-progress-step-title`,children:[(0,P.jsx)(`span`,{className:`execution-progress-step-label`,children:e.label}),e.elapsedLabel===void 0?null:(0,P.jsxs)(`span`,{className:`execution-progress-step-elapsed`,children:[` `,`(`,e.elapsedLabel,`)`]})]}),e.detail===void 0?null:(0,P.jsx)(`span`,{className:`execution-progress-step-detail`,children:e.detail}),e.metrics===void 0||e.metrics.length===0?null:(0,P.jsx)(`span`,{className:`execution-progress-step-metrics`,children:e.metrics.map(e=>(0,P.jsx)(`span`,{className:`execution-progress-step-metric`,children:e},e))})]})]},e.id))})})})}function ab({tone:e=`neutral`,compact:t=!1,asChild:n=!1,className:r,...i}){return(0,P.jsx)(n?is:`div`,{className:R(`chat-event-card`,`is-${e}`,t?`is-compact`:void 0,r),...i})}function ob({as:e=`div`,icon:t,title:n,meta:r,action:i,className:a,...o}){return(0,P.jsxs)(e,{className:R(`chat-event-card-header`,a),...o,children:[(0,P.jsx)(sb,{children:t}),(0,P.jsxs)(`span`,{className:`chat-event-card-title`,children:[(0,P.jsx)(`strong`,{children:n}),r===void 0?null:(0,P.jsx)(`span`,{className:`chat-event-card-meta`,children:r})]}),i]})}function sb({className:e,...t}){return(0,P.jsx)(`span`,{className:R(`chat-event-card-status-icon`,e),...t})}function cb({className:e,...t}){return(0,P.jsx)(`div`,{className:R(`chat-event-card-body`,e),...t})}function lb({className:e,...t}){return(0,P.jsx)(`footer`,{className:R(`chat-event-card-footer`,e),...t})}function ub(e){return e===`done`?`success`:e===`failed`?`danger`:e===`pending`?`warning`:`neutral`}function db(e){return e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(ra,{"aria-hidden":`true`}):(0,P.jsx)(Pi,{"aria-hidden":`true`})}function fb({title:e,summary:t,request:n,messages:r,draft:i,contextLabel:a,defaultOpen:o,readOnly:s=!1,replyCount:c,status:l,statusLabel:u,mentionOptions:d,sendPending:f=!1,submitPending:p=!1,onDraftChange:m,onSendMessage:h,onSubmitRound:g,className:_,...v}){let y=t.trim()===``?n:t,b=a===void 0?y:`${y} (${a})`,[x,S]=(0,N.useState)(o??!0),C=l??(s?`done`:`pending`),w=u??(s?`submitted`:`needs input`),T=c??r.length,E=p||T===0,ee=T===0?`No replies`:`${T} ${T===1?`reply`:`replies`}`,D=ub(C),O=`${w} · ${ee}`,k=(0,P.jsxs)(cb,{className:`chat-clarification-card-body`,children:[(0,P.jsx)(`div`,{className:`chat-event-thread`,children:r.map(e=>(0,P.jsxs)(`article`,{className:`chat-event-message`,children:[e.avatar,(0,P.jsxs)(`div`,{className:`chat-event-message-copy`,children:[(0,P.jsxs)(`div`,{className:`message-meta`,children:[(0,P.jsx)(`span`,{className:`message-author`,children:e.author}),e.time===void 0?null:(0,P.jsx)(`span`,{className:`message-time`,children:e.time})]}),(0,P.jsx)(`p`,{children:(0,P.jsx)(Oy,{children:e.body})})]})]},e.id))}),s?null:(0,P.jsx)(`form`,{className:`chat-event-composer`,"aria-label":`Round reply`,onSubmit:h,children:(0,P.jsxs)(`div`,{className:`composer-input-shell chat-event-composer-input-shell`,children:[(0,P.jsx)(ky,{type:`text`,"aria-label":`Round message`,value:i,placeholder:`Reply in this round`,multiline:!0,maxRows:4,submitOnEnter:!0,...d===void 0?{}:{mentionOptions:d},onValueChange:m}),(0,P.jsx)(`div`,{className:`composer-tools chat-event-composer-tools`,"aria-label":`Round message tools`,children:(0,P.jsx)(`button`,{className:`composer-tool-button composer-send-button chat-event-send-button`,type:`submit`,disabled:i.trim()===``||f,"aria-label":f?`Sending round message`:`Send round message`,title:f?`Sending round message`:`Send round message`,children:(0,P.jsx)(Gi,{"aria-hidden":`true`})})})]})})]});return(0,P.jsx)(`article`,{className:R(`message is-chat-event`,_),...v,children:s?(0,P.jsx)(ab,{tone:D,asChild:!0,children:(0,P.jsxs)(`details`,{className:`chat-clarification-card`,open:x,"aria-label":b,onToggle:e=>S(e.currentTarget.open),children:[(0,P.jsx)(ob,{as:`summary`,icon:db(C),title:e,meta:O,action:(0,P.jsx)(`span`,{className:`chat-event-card-toggle`,"aria-hidden":`true`,children:(0,P.jsx)(ui,{})})}),k]})}):(0,P.jsx)(ab,{tone:D,asChild:!0,children:(0,P.jsxs)(`section`,{className:`chat-clarification-card is-fixed-open`,"aria-label":b,children:[(0,P.jsx)(ob,{icon:db(C),title:e,meta:O,tabIndex:-1,action:(0,P.jsxs)(bs,{className:`chat-event-primary-action`,type:`button`,"aria-label":T===0?`Reply before submitting round`:`Submit round`,"aria-busy":p,disabled:E,title:T===0?`Reply before submitting round`:`Submit round`,onClick:g,children:[p?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(li,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`button-label`,children:p?`Submitting`:`Submit`})]})}),k]})})})}function pb({decision:e,disabled:t,onDecide:n}){let r=e.tone===`primary`?bs:xs,i=e.decisionId.startsWith(`allow`)?(0,P.jsx)(li,{"aria-hidden":`true`}):(0,P.jsx)(ra,{"aria-hidden":`true`});return(0,P.jsxs)(r,{type:`button`,className:R(`chat-approval-card-decision`,e.tone===`primary`?`is-primary`:void 0,e.tone===`danger`?`is-danger`:void 0),disabled:t,onClick:()=>n(e.decisionId),children:[i,(0,P.jsx)(`span`,{className:`button-label`,children:e.label})]})}function mb(e,t){return e===`pending`?`warning`:e===`resolved`?`success`:/expired|cancelled/iu.test(t)?`neutral`:`danger`}function hb(e){return e===`success`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`danger`?(0,P.jsx)(ra,{"aria-hidden":`true`}):e===`neutral`?(0,P.jsx)(gi,{"aria-hidden":`true`}):(0,P.jsx)(Ji,{"aria-hidden":`true`})}function gb({title:e,summary:t,reason:n,status:r,statusLabel:i,detailLabel:a,detail:o,detailCode:s=!1,decisions:c=[],decisionPending:l=!1,resolutionLabel:u,defaultOpen:d,onDecide:f,className:p,...m}){let[h,g]=(0,N.useState)(d??r===`pending`),_=mb(r,i),v=[...c].sort((e,t)=>e.tone===t.tone?0:e.tone===`primary`?-1:+(t.tone===`primary`)),y=r===`pending`&&f!==void 0?(0,P.jsx)(lb,{className:`chat-approval-card-actions`,children:v.map(e=>(0,P.jsx)(pb,{decision:e,disabled:l,onDecide:f},e.decisionId))}):null,b=(0,P.jsx)(cb,{className:`chat-approval-card-body`,children:(0,P.jsxs)(`div`,{className:`chat-approval-card-content`,children:[(0,P.jsx)(`p`,{className:`chat-approval-card-summary`,children:t}),n===void 0?null:(0,P.jsx)(`p`,{className:`chat-approval-card-reason`,children:n}),o===void 0?null:(0,P.jsxs)(`div`,{className:`chat-approval-card-detail`,children:[a===void 0?null:(0,P.jsx)(`span`,{className:`chat-approval-card-detail-label`,children:a}),s?(0,P.jsx)(`code`,{className:`chat-approval-card-detail-code`,children:o}):(0,P.jsx)(`span`,{className:`chat-approval-card-detail-text`,children:o})]}),r===`pending`||u===void 0?null:(0,P.jsx)(`p`,{className:`chat-approval-card-resolution`,children:u})]})});return(0,P.jsx)(`article`,{className:R(`message is-chat-event`,p),...m,children:r===`pending`?(0,P.jsx)(ab,{tone:_,asChild:!0,children:(0,P.jsxs)(`section`,{className:`chat-approval-card is-fixed-open`,"aria-label":t,children:[(0,P.jsx)(ob,{icon:hb(_),title:e,meta:i,tabIndex:-1}),b,y]})}):(0,P.jsx)(ab,{tone:_,asChild:!0,children:(0,P.jsxs)(`details`,{className:`chat-approval-card`,open:h,"aria-label":t,onToggle:e=>g(e.currentTarget.open),children:[(0,P.jsx)(ob,{as:`summary`,icon:hb(_),title:e,meta:i,action:(0,P.jsx)(`span`,{className:`chat-event-card-toggle`,"aria-hidden":`true`,children:(0,P.jsx)(ui,{})})}),b]})})})}function _b({status:e,title:t,taskId:n,taskTitle:r,summary:i,moduleName:a,finalNote:o,generatedFiles:s=[],errorCode:c,onOpenTask:l,className:u,...d}){let f=o?.trim()??``,p=i.trim(),m=f.length>0?f:p,h=e===`completed`?`Task completed`:`Task failed`;return(0,P.jsx)(`article`,{className:R(`message is-chat-event is-task-result`,u),...d,children:(0,P.jsx)(ab,{tone:e===`completed`?`success`:`danger`,compact:!0,asChild:!0,children:(0,P.jsxs)(`button`,{className:R(`chat-task-result-card`,`is-${e}`),disabled:l===void 0,onClick:()=>l?.(n),type:`button`,"aria-label":`${t}: ${r}`,children:[(0,P.jsx)(sb,{"aria-hidden":`true`,children:e===`completed`?(0,P.jsx)(li,{}):(0,P.jsx)(ra,{})}),(0,P.jsxs)(`span`,{className:`chat-task-result-card-main`,children:[(0,P.jsx)(`span`,{className:`chat-task-result-card-state`,children:h}),(0,P.jsx)(`strong`,{children:r}),a===void 0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-module`,children:a}),m.length===0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-summary`,children:m}),c===void 0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-error-code`,children:c}),s.length===0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-files`,"aria-label":`Generated files`,children:s.map(e=>(0,P.jsxs)(`span`,{className:`chat-task-result-card-file`,children:[(0,P.jsx)(Ci,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:e.name})]},e.path))})]}),(0,P.jsx)(`span`,{className:`chat-task-result-card-arrow`,"aria-hidden":`true`,children:(0,P.jsx)(di,{})})]})})})}function vb({status:e}){return e===`done`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(li,{})}):e===`pending`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(Ii,{})}):e===`failed`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(ra,{})}):e===`running`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(Mi,{})}):(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`})}function yb({title:e,status:t,selected:n=!1,className:r,type:i=`button`,...a}){return(0,P.jsxs)(`button`,{className:R(`task-row`,n?`is-selected`:void 0,`is-${t}`,r),type:i,"aria-current":n?`true`:void 0,...a,children:[(0,P.jsx)(vb,{status:t}),(0,P.jsx)(`div`,{className:`task-row-main`,children:(0,P.jsx)(`div`,{className:`task-title-line`,children:(0,P.jsx)(`strong`,{children:e})})})]})}function bb({label:e,value:t,code:n=!1,status:r}){return(0,P.jsxs)(`div`,{className:`detail-row`,children:[(0,P.jsx)(`span`,{children:e}),r===void 0?n?(0,P.jsx)(`code`,{children:t}):(0,P.jsx)(`strong`,{children:t}):(0,P.jsx)(`strong`,{children:(0,P.jsx)(ws,{status:r,children:t})})]})}function xb({rows:e}){return(0,P.jsx)(P.Fragment,{children:e.map((e,t)=>(0,N.createElement)(bb,{...e,key:`${e.label}-${t}`}))})}function Sb({...e}){return(0,P.jsx)(yb,{...e})}function Cb({detail:e,missingTaskId:t}){return e===void 0?(0,P.jsxs)(`aside`,{className:`task-detail-card`,"aria-label":`Selected task details`,children:[(0,P.jsx)(`div`,{className:`task-detail-head`,children:(0,P.jsx)(`h4`,{children:t===void 0?`No task selected`:`Task not found`})}),(0,P.jsx)(`p`,{children:t===void 0?`Select a task to inspect its contract, latest result, and run history.`:`No task exists for ${t}. Select another task from the Worklist.`})]}):(0,P.jsxs)(`aside`,{className:`task-detail-card`,"aria-label":`Selected task details`,children:[(0,P.jsxs)(`div`,{className:`task-detail-head`,children:[(0,P.jsx)(ws,{status:e.status,children:e.status}),(0,P.jsx)(`h4`,{children:e.title})]}),(0,P.jsx)(`p`,{children:e.summary}),(0,P.jsxs)(`section`,{className:`task-detail-section`,"aria-label":`Task contract`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Task contract`}),(0,P.jsx)(xb,{rows:e.contractRows})]}),(0,P.jsxs)(`section`,{className:`task-detail-section task-evidence-section`,"aria-label":`Evidence`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Evidence`}),(0,P.jsx)(xb,{rows:e.evidenceRows??e.resultRows})]}),(0,P.jsxs)(`section`,{className:`task-detail-section`,"aria-label":`Run result history`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Run result history`}),e.runResults.length===0?(0,P.jsx)(`p`,{children:`No run result yet.`}):(0,P.jsx)(`div`,{className:`run-result-list`,children:e.runResults.map(e=>(0,P.jsx)(`article`,{className:`run-result-item`,children:(0,P.jsxs)(`div`,{className:`run-result-item-head`,children:[(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:e.title}),e.meta===void 0?null:(0,P.jsx)(`small`,{children:e.meta})]}),e.status===void 0?null:(0,P.jsx)(ws,{status:e.status,children:e.status})]})},e.id))})]})]})}function wb({modules:e,taskCount:t,detail:n,missingTaskId:r,runNote:i,onSelectTask:a,empty:o,className:s,...c}){return(0,P.jsx)(pa,{title:`Worklist`,icon:(0,P.jsx)(ji,{"aria-hidden":`true`}),action:(0,P.jsx)(`div`,{className:`worklist-header-summary`,children:(0,P.jsx)(`span`,{className:`mini-meta`,children:t===1?`1 task`:`${t} tasks`})}),className:R(`tasks worklist-page-panel`,s),...c,children:(0,P.jsxs)(`div`,{className:`worklist-page-body`,children:[i===void 0?null:(0,P.jsx)(`p`,{className:`worklist-run-note`,children:i}),e.length===0?(0,P.jsx)(`div`,{className:`worklist-page-empty`,children:o??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No compiled tasks`})}):(0,P.jsxs)(`div`,{className:`task-board-body`,children:[(0,P.jsx)(`div`,{className:`task-list`,"aria-label":`Tasks`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`task-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:e.label}),e.rows.map(e=>(0,P.jsx)(Sb,{title:e.title,status:e.status,onClick:()=>a?.(e.id),...e.selected===void 0?{}:{selected:e.selected}},e.id))]},e.label))}),(0,P.jsx)(Cb,{...n===void 0?{}:{detail:n},...r===void 0?{}:{missingTaskId:r}})]})]})})}function Tb({sections:e,statuses:t=[],className:n,...r}){return(0,P.jsxs)(`section`,{className:R(`settings-sheet`,n),"aria-labelledby":`settings-title`,...r,children:[(0,P.jsxs)(`header`,{className:`settings-sheet-head`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ma,{icon:(0,P.jsx)(qi,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{id:`settings-title`,children:`Project settings`})]}),t.length===0?null:(0,P.jsx)(`div`,{className:`panel-actions`,children:t.map(e=>(0,P.jsx)(Ss,{className:`task-tag`,tone:e.tone,children:e.label},e.label))})]}),e.map(e=>(0,P.jsxs)(`section`,{className:`settings-section`,id:e.id,"aria-label":e.title,children:[(0,P.jsx)(`div`,{className:`settings-section-title`,children:(0,P.jsx)(`h4`,{children:e.title})}),(0,P.jsx)(`div`,{className:`settings-section-body`,children:e.rows.map(e=>(0,P.jsxs)(`div`,{className:`settings-row`,children:[(0,P.jsx)(`span`,{className:`field-label`,children:e.label}),e.value===void 0?(0,P.jsx)(`span`,{}):e.plain===!0?(0,P.jsx)(`div`,{className:`settings-row-value`,children:e.value}):e.code===!0?(0,P.jsx)(`code`,{children:e.value}):(0,P.jsx)(`strong`,{children:e.value})]},e.label))})]},e.id))]})}function Eb({row:e}){return e.category===`image`?(0,P.jsx)(Ei,{"aria-hidden":`true`}):e.canPreview===!1?(0,P.jsx)(xi,{"aria-hidden":`true`}):e.selected===!0?(0,P.jsx)(bi,{"aria-hidden":`true`}):e.extension===`md`||e.extension===`txt`?(0,P.jsx)(Si,{"aria-hidden":`true`}):(0,P.jsx)(Ci,{"aria-hidden":`true`})}function Db({row:e,onSelectFile:t}){return(0,P.jsxs)(`button`,{className:R(`reference-row`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-current":e.selected===!0?`true`:void 0,onClick:()=>t?.(e.path),children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Eb,{row:e})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`span`,{children:e.meta})]})]})}function Ob({name:e,rows:t,onSelectFile:n}){return(0,P.jsxs)(`details`,{className:`reference-folder-group`,children:[(0,P.jsxs)(`summary`,{className:`reference-folder-head`,children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Ti,{})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsxs)(`span`,{children:[t.length,` `,t.length===1?`file`:`files`]})]})]}),(0,P.jsx)(`div`,{className:`reference-folder-files`,children:t.map(e=>(0,P.jsx)(Db,{row:e,...n===void 0?{}:{onSelectFile:n}},e.path))})]})}function kb(e){let t=new Map;for(let n of e){if(n.source!==`tutti_output`||n.generatedGroup===void 0)continue;let e=t.get(n.generatedGroup)??[];e.push(n),t.set(n.generatedGroup,e)}return[...t.entries()].map(([e,t])=>({name:e,rows:t}))}function Ab({files:e,detail:t,uploadPending:n=!1,fileSortMode:r=`time`,empty:i,onSelectFile:a,onUploadFile:o,onDropFiles:s,onFileSortModeChange:c,className:l,...u}){let d=e.filter(e=>e.category===`image`&&e.source!==`tutti_output`),f=e.filter(e=>!(e.category===`image`&&e.source!==`tutti_output`)),p=f.filter(e=>e.source!==`tutti_output`||e.generatedGroup===void 0),m=kb(f),h=e=>(0,P.jsx)(`div`,{className:`reference-image-strip`,role:`list`,"aria-label":`Reference images`,onWheel:e=>{Math.abs(e.deltaY)>Math.abs(e.deltaX)&&(e.currentTarget.scrollLeft+=e.deltaY,e.preventDefault())},children:e.map(e=>(0,P.jsxs)(`button`,{className:R(`reference-image-tile`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-current":e.selected===!0?`true`:void 0,"aria-label":`Open ${e.name}`,onClick:()=>a?.(e.path),children:[e.thumbnailUrl===void 0?(0,P.jsx)(`span`,{className:`reference-image-tile-fallback`,"aria-hidden":`true`,children:(0,P.jsx)(Ei,{})}):(0,P.jsx)(`img`,{src:e.thumbnailUrl,alt:e.name,loading:`lazy`,decoding:`async`}),(0,P.jsx)(`span`,{children:e.name})]},e.path))}),g=e=>e.map(e=>(0,P.jsx)(Db,{row:e,...a===void 0?{}:{onSelectFile:a}},e.path)),_=s??(o===void 0?void 0:e=>{for(let t of e)o(t)});return(0,P.jsxs)(uy,{className:R(`panel references-panel`,l),"aria-label":`References`,dropLabel:`Drop reference files to upload`,pending:n,onFilesUpload:_,...u,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ma,{icon:(0,P.jsx)(Si,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`References`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(Jy,{variant:`action`,className:`reference-upload-button`,label:`Upload`,pendingLabel:`Uploading`,pending:n,onFileUpload:o})})]}),(0,P.jsx)(`div`,{className:`reference-board-body`,children:e.length===0?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:i??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No reference files`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-list`,"aria-label":`Reference file list`,children:[d.length===0?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Images`}),h(d)]}),f.length===0?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-files-head`,children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Files`}),(0,P.jsxs)(`div`,{className:`reference-list-toolbar`,role:`toolbar`,"aria-label":`Sort files`,children:[(0,P.jsx)(`button`,{className:R(`reference-sort-button`,r===`time`?`is-active`:void 0),type:`button`,"aria-label":`Sort files by upload time`,"aria-pressed":r===`time`,onClick:()=>c?.(`time`),children:(0,P.jsx)(gi,{"aria-hidden":`true`})}),(0,P.jsx)(`button`,{className:R(`reference-sort-button`,r===`type`?`is-active`:void 0),type:`button`,"aria-label":`Sort files by type`,"aria-pressed":r===`type`,onClick:()=>c?.(`type`),children:(0,P.jsx)(Qi,{"aria-hidden":`true`})})]})]}),g(p),m.map(e=>(0,P.jsx)(Ob,{name:e.name,rows:e.rows,...a===void 0?{}:{onSelectFile:a}},e.name))]})]}),(0,P.jsxs)(`aside`,{className:`reference-detail-card`,"aria-label":`Selected reference content`,children:[(0,P.jsxs)(`div`,{className:`reference-detail-head`,children:[(0,P.jsx)(`h4`,{children:t?.title??`No file selected`}),t?.meta===void 0?null:(0,P.jsx)(`p`,{children:t.meta})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Summary`}),(0,P.jsx)(`p`,{className:`reference-summary`,children:t?.summary??`Summary not available yet`}),t?.summaryStatus===void 0?null:(0,P.jsx)(`p`,{className:`reference-summary-status`,children:t.summaryStatus})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Content`}),t?.content===void 0?t?.imageUrl===void 0?(0,P.jsx)(`p`,{className:`reference-content`,children:t?.unavailableReason??`Select a reference file`}):(0,P.jsx)(`img`,{className:`reference-image-preview`,src:t.imageUrl,alt:t.title,decoding:`async`}):(0,P.jsx)(`pre`,{className:`reference-content`,children:(0,P.jsx)(`code`,{children:t.content})})]})]})]})})]})}function jb(e){return e.status===`loading`?{status:`running`,label:`Loading`}:e.status===`not_declared`?{status:`todo`,label:`No artifact`}:e.status===`invalid`?{status:`failed`,label:`Invalid`}:e.status===`updating`?{status:`running`,label:`Updating`}:e.previewStatus===`ready`?{status:`done`,label:`Ready`}:e.previewStatus===`starting`?{status:`running`,label:`Starting`}:e.previewStatus===`failed`?{status:`failed`,label:`Failed`}:{status:`todo`,label:`Idle`}}function Mb({state:e,empty:t,emptyWatermark:n}){if(e.status===`declared`&&e.previewStatus===`ready`&&e.previewUrl!==void 0)return(0,P.jsx)(`iframe`,{className:`artifact-iframe`,src:e.previewUrl,title:`${e.title} artifact preview`,sandbox:`allow-scripts allow-forms allow-same-origin`,referrerPolicy:`no-referrer`});let r,i=`neutral`;return e.status===`loading`?r=`Loading artifact`:e.status===`updating`?r=`Artifact is updating`:e.status===`not_declared`?r=`No artifact`:e.status===`invalid`?(i=`error`,r=`Invalid artifact. ${e.message}`):e.previewStatus===`starting`?r=`Preview is starting`:e.previewStatus===`failed`?(i=`error`,r=e.errorMessage??`Preview failed`):r=`Preview is idle`,(0,P.jsx)(`div`,{className:`artifact-empty-preview`,role:e.status===`invalid`?`alert`:void 0,children:t??(0,P.jsx)(ia,{tone:i,watermark:n,children:r})})}function Nb({state:e,error:t=null,empty:n,emptyWatermark:r,className:i,...a}){let o=t===null?e:{status:`invalid`,message:t},s=jb(o);return(0,P.jsxs)(`section`,{className:R(`panel artifacts-panel`,i),"aria-label":`Artifacts`,...a,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ma,{icon:(0,P.jsx)(Li,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`Artifacts`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(ws,{status:s.status,children:s.label})})]}),(0,P.jsx)(`div`,{className:`artifact-board-body`,children:(0,P.jsx)(`div`,{className:`artifact-preview-frame`,"aria-label":`Current artifact`,children:(0,P.jsx)(Mb,{state:o,empty:n,emptyWatermark:r})})})]})}function Pb({row:e}){return e.selected===!0?(0,P.jsx)(bi,{"aria-hidden":`true`}):(0,P.jsx)(Yi,{"aria-hidden":`true`})}function Fb({skills:e,communityLinks:t=[],detail:n,uploadPending:r=!1,deletePending:i=!1,empty:a,onSelectSkill:o,onUploadSkill:s,onDeleteSkill:c,className:l,...u}){let d=e.find(e=>e.selected===!0)?.name,f=t.length>0;return(0,P.jsxs)(`section`,{className:R(`panel references-panel skills-panel`,l),"aria-label":`Skills`,...u,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ma,{icon:(0,P.jsx)(Yi,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`Skills`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(Jy,{variant:`action`,className:`reference-upload-button`,label:`Upload`,pendingLabel:`Uploading`,pending:r,accept:`.zip,application/zip,application/x-zip-compressed`,onFileUpload:s})})]}),(0,P.jsx)(`div`,{className:`reference-board-body`,children:e.length===0&&!f?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:a??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No skills`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-list`,"aria-label":`Skill list`,children:[f?(0,P.jsxs)(`div`,{className:`skill-community-section`,"aria-label":`Skill communities`,children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Skill communities`}),(0,P.jsx)(`div`,{className:`skill-community-grid`,children:t.map(e=>(0,P.jsxs)(`a`,{className:`skill-community-card`,href:e.href,target:`_blank`,rel:`noreferrer`,children:[(0,P.jsx)(`span`,{className:`skill-community-card-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Ai,{})}),(0,P.jsx)(`span`,{className:`skill-community-card-main`,children:(0,P.jsx)(`strong`,{children:e.title})})]},e.href))})]}):null,e.length===0?null:(0,P.jsx)(`div`,{className:`reference-section-label`,children:`User skills`}),e.map(e=>(0,P.jsxs)(`button`,{className:R(`reference-row`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-label":`Select skill ${e.name}`,"aria-current":e.selected===!0?`true`:void 0,onClick:()=>o?.(e.name),children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Pb,{row:e})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`span`,{children:e.shortDescription??e.description})]})]},e.name))]}),(0,P.jsx)(`aside`,{className:`reference-detail-card`,"aria-label":`Selected skill content`,children:e.length===0?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:a??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No skills`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-detail-head skill-detail-head`,children:[(0,P.jsxs)(`div`,{className:`skill-detail-title`,children:[(0,P.jsx)(`h4`,{children:n?.title??`No skill selected`}),n?.description===void 0?null:(0,P.jsx)(`p`,{children:n.description}),n?.updatedLabel===void 0?null:(0,P.jsx)(`p`,{children:n.updatedLabel})]}),d===void 0||c===void 0?null:(0,P.jsxs)(xs,{className:`skill-delete-button`,type:`button`,disabled:i,"aria-busy":i,onClick:()=>c(d),children:[(0,P.jsx)(ea,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:i?`Deleting`:`Delete`})]})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`SKILL.md`}),n?.skillMd===void 0?(0,P.jsx)(`p`,{className:`reference-content`,children:n?.unavailableReason??`Select a skill`}):(0,P.jsx)(`pre`,{className:`reference-content`,children:(0,P.jsx)(`code`,{"aria-label":`Skill markdown for ${n.title}`,children:n.skillMd})})]})]})})]})})]})}function Ib({label:e,children:t}){return(0,P.jsxs)(`section`,{className:`timeline-trace-section`,children:[(0,P.jsx)(`span`,{className:`timeline-trace-label`,children:e}),(0,P.jsx)(`div`,{className:`timeline-trace-section-body`,children:t})]})}function Lb(e){return e.replaceAll(`_`,` `)}function Rb(e){return e===`passed`?`success`:e===`failed`?`error`:`warning`}function zb(e){return e.status===`promoted`?`success`:e.status===`not_promoted`?`error`:`neutral`}function Bb(e){if(e.skipReasonSummary!==void 0)return e.skipReasonSummary;switch(e.checks){case`passed`:return`All validation checks passed.`;case`failed`:return`Validation checks failed.`;case`skipped`:return`Validation was skipped.`}}function Vb(e){if(e.summary!==void 0)return e.summary;switch(e.status){case`promoted`:return`Changes were promoted after verification.`;case`not_promoted`:return`Changes were not promoted.`;case`not_attempted`:return`Promotion was not attempted.`}}function Hb(e){switch(e){case`added`:return`+`;case`modified`:return`~`;case`deleted`:return`-`;case`renamed`:return`~`;case`unknown`:return`?`}}var Ub=3;function Wb({expanded:e,collapsedLabel:t,expandedLabel:n,onClick:r}){return(0,P.jsxs)(`button`,{"aria-expanded":e,className:R(`timeline-trace-more`,e&&`is-expanded`),onClick:r,type:`button`,children:[(0,P.jsx)(`span`,{children:e?n:t}),(0,P.jsx)(ui,{"aria-hidden":`true`})]})}function Gb({expanded:e,hiddenCount:t,label:n,onClick:r}){return t<=0?null:(0,P.jsx)(Wb,{collapsedLabel:`Show ${t} more ${n}${t===1?``:`s`}`,expanded:e,expandedLabel:`Show fewer ${n}s`,onClick:r})}function Kb(e){let t=[];return(e.origin!==void 0||e.decisions!==void 0||e.clarification!==void 0)&&t.push({id:`context`,label:`Context`,tone:`neutral`}),e.contract!==void 0&&t.push({id:`contract`,label:`Contract`,tone:`neutral`}),(e.result!==void 0||e.changes!==void 0)&&t.push({id:`result`,label:`Result`,tone:e.tone}),e.verification!==void 0&&t.push({id:`checks`,label:`Checks`,tone:Rb(e.verification.checks)}),e.promotion!==void 0&&t.push({id:`promotion`,label:`Promotion`,tone:zb(e.promotion)}),e.checkpoint!==void 0&&t.push({id:`checkpoint`,label:`Checkpoint`,tone:e.tone}),t}function qb({trace:e}){let t=Kb(e),n=e.links.filter(e=>e.onClick!==void 0),[r,i]=(0,N.useState)(()=>new Set),a=r.has(`origin`),o=r.has(`decisions`),s=r.has(`clarification-answers`),c=r.has(`scope`),l=r.has(`changes`),u=r.has(`checkpoint`),d=r.has(`generated-files`),f=e.origin?.snippets??[],p=e.decisions===void 0||o?e.decisions??[]:e.decisions.slice(0,Ub),m=e.clarification?.answers===void 0||s?e.clarification?.answers??[]:e.clarification.answers.slice(0,Ub),h=e.contract===void 0||c?e.contract?.scope??[]:e.contract.scope.slice(0,Ub),g=e.checkpoint===void 0||u?e.checkpoint?.items??[]:e.checkpoint.items.slice(0,Ub),_=e.checkpoint?.generatedFiles===void 0||d?e.checkpoint?.generatedFiles??[]:e.checkpoint.generatedFiles.slice(0,Ub);function v(e){i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsxs)(`div`,{className:R(`timeline-trace-card`,`is-${e.tone}`),children:[e.summary===void 0||e.result!==void 0?null:(0,P.jsx)(`p`,{className:`timeline-trace-summary`,children:e.summary}),t.length===0?null:(0,P.jsx)(`ol`,{className:`timeline-trace-path`,"aria-label":`Recorded task trace`,children:t.map(e=>(0,P.jsxs)(`li`,{className:`is-${e.tone}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`}),(0,P.jsx)(`strong`,{children:e.label})]},e.id))}),e.origin===void 0?null:(0,P.jsxs)(Ib,{label:`Origin`,children:[e.origin.title===void 0?null:(0,P.jsx)(`strong`,{className:`timeline-trace-title`,children:e.origin.title}),e.origin.summary===void 0?null:(0,P.jsx)(`p`,{children:e.origin.summary}),e.origin.unavailableReason===void 0?null:(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:e.origin.unavailableReason}),f.length>0?(0,P.jsx)(Wb,{collapsedLabel:`Show ${f.length} source message${f.length===1?``:`s`}`,expanded:a,expandedLabel:`Show fewer source messages`,onClick:()=>v(`origin`)}):e.origin.sourceCount===void 0?null:(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.origin.sourceCount,` source message`,e.origin.sourceCount===1?``:`s`]}),!a||f.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-snippet-list`,children:f.map(e=>(0,P.jsx)(`li`,{className:`timeline-trace-snippet`,children:e.onClick===void 0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]}):(0,P.jsxs)(`button`,{className:`timeline-trace-snippet-button`,onClick:e.onClick,type:`button`,children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]})},e.id))})]}),e.decisions===void 0||e.decisions.length===0?null:(0,P.jsxs)(Ib,{label:`Accepted Context`,children:[(0,P.jsx)(`ul`,{className:`timeline-trace-list`,children:p.map(e=>(0,P.jsxs)(`li`,{children:[e.title===void 0?null:(0,P.jsx)(Ss,{tone:`neutral`,children:e.title}),(0,P.jsx)(`span`,{children:e.summary})]},e.id))}),(0,P.jsx)(Gb,{expanded:o,hiddenCount:Math.max(e.decisions.length-Ub,0),label:`context item`,onClick:()=>v(`decisions`)})]}),e.clarification===void 0?null:(0,P.jsxs)(Ib,{label:`Clarification`,children:[e.clarification.title===void 0?null:(0,P.jsx)(`strong`,{className:`timeline-trace-title`,children:e.clarification.title}),e.clarification.summary===void 0?null:(0,P.jsx)(`p`,{children:e.clarification.summary}),e.clarification.request===void 0?null:(0,P.jsx)(`p`,{children:e.clarification.request}),e.clarification.status===void 0&&e.clarification.answerCount===void 0?null:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[e.clarification.status===void 0?null:(0,P.jsx)(Ss,{tone:e.clarification.status===`active`?`warning`:`success`,children:e.clarification.status===`active`?`needs input`:`resolved`}),e.clarification.answerCount===void 0?null:(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.clarification.answerCount,` answer`,e.clarification.answerCount===1?``:`s`]})]}),e.clarification.answers===void 0||e.clarification.answers.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-snippet-list`,children:m.map(e=>(0,P.jsx)(`li`,{className:`timeline-trace-snippet`,children:e.onClick===void 0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]}):(0,P.jsxs)(`button`,{className:`timeline-trace-snippet-button`,onClick:e.onClick,type:`button`,children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]})},e.id))}),e.clarification.answers===void 0?null:(0,P.jsx)(Gb,{expanded:s,hiddenCount:Math.max(e.clarification.answers.length-Ub,0),label:`answer`,onClick:()=>v(`clarification-answers`)})]}),e.contract===void 0?null:(0,P.jsxs)(Ib,{label:`Contract`,children:[(0,P.jsx)(`p`,{children:e.contract.goal}),h.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-list is-bulleted`,children:h.map((e,t)=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`span`,{children:e})},`scope-${t}`))}),(0,P.jsx)(Gb,{expanded:c,hiddenCount:Math.max(e.contract.scope.length-Ub,0),label:`scope item`,onClick:()=>v(`scope`)}),c&&e.contract.truncated===!0?(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:`Additional scope items are outside this bounded audit preview.`}):null]}),e.result===void 0?null:(0,P.jsxs)(Ib,{label:`Result`,children:[(0,P.jsx)(`p`,{children:e.result.summary}),e.result.errorCode===void 0?null:(0,P.jsx)(`code`,{className:`timeline-trace-code`,children:e.result.errorCode})]}),e.changes===void 0?null:(0,P.jsxs)(Ib,{label:`Changes`,children:[e.changes.items.length===0?(0,P.jsx)(`p`,{className:`timeline-trace-muted`,children:`No repo changes recorded.`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Wb,{collapsedLabel:`Show ${e.changes.items.length} file change${e.changes.items.length===1?``:`s`}`,expanded:l,expandedLabel:`Show fewer file changes`,onClick:()=>v(`changes`)}),l?(0,P.jsx)(`ul`,{className:`timeline-trace-diff-list`,children:e.changes.items.map(e=>(0,P.jsxs)(`li`,{className:`is-${e.status}`,children:[(0,P.jsx)(`span`,{className:`timeline-trace-diff-mark`,children:Hb(e.status)}),(0,P.jsx)(`code`,{children:e.previousPath===void 0?e.path:`${e.previousPath} -> ${e.path}`})]},`${e.status}:${e.path}`))}):null]}),l&&e.changes.totalCount>e.changes.items.length?(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.changes.totalCount-e.changes.items.length,` additional files are outside this bounded audit preview.`]}):null]}),e.verification===void 0?null:(0,P.jsx)(Ib,{label:`Verification`,children:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[(0,P.jsx)(Ss,{tone:Rb(e.verification.checks),children:Lb(e.verification.checks)}),(0,P.jsx)(`p`,{children:Bb(e.verification)})]})}),e.promotion===void 0?null:(0,P.jsx)(Ib,{label:`Promotion`,children:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[(0,P.jsx)(Ss,{tone:zb(e.promotion),children:Lb(e.promotion.status)}),(0,P.jsx)(`p`,{children:Vb(e.promotion)})]})}),e.checkpoint===void 0?null:(0,P.jsxs)(Ib,{label:`Checkpoint`,children:[(0,P.jsxs)(`div`,{className:`timeline-trace-counters`,children:[(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.completed,` completed`]}),(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.failed,` failed`]}),(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.remaining,` remaining`]})]}),(0,P.jsx)(`ul`,{className:`timeline-trace-list`,children:g.map(e=>(0,P.jsxs)(`li`,{children:[(0,P.jsx)(Ss,{tone:e.status===`done`?`success`:`error`,children:e.status===`done`?`done`:`failed`}),(0,P.jsx)(`strong`,{children:e.title}),(0,P.jsx)(`span`,{children:e.summary})]},e.id))}),(0,P.jsx)(Gb,{expanded:u,hiddenCount:Math.max(e.checkpoint.items.length-Ub,0),label:`checkpoint item`,onClick:()=>v(`checkpoint`)}),e.checkpoint.generatedFiles===void 0||e.checkpoint.generatedFiles.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-file-list`,children:_.map(e=>(0,P.jsxs)(`li`,{children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`code`,{children:e.path})]},e.id))}),e.checkpoint.generatedFiles===void 0?null:(0,P.jsx)(Gb,{expanded:d,hiddenCount:Math.max(e.checkpoint.generatedFiles.length-Ub,0),label:`generated file`,onClick:()=>v(`generated-files`)}),(u||d)&&e.checkpoint.truncated===!0?(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:`Additional checkpoint evidence is outside this bounded audit preview.`}):null]}),n.length===0?null:(0,P.jsx)(Ib,{label:`Links`,children:(0,P.jsx)(`div`,{className:`timeline-trace-links`,children:n.map(e=>(0,P.jsxs)(xs,{className:`timeline-trace-link`,onClick:e.onClick,type:`button`,children:[(0,P.jsx)(yi,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:e.label})]},e.id))})})]})}function Jb({item:e,expanded:t,active:n,onActivate:r,onToggle:i}){let a=e.trace,o=a!==void 0,s=e.tone??`neutral`,c=s===`error`?(0,P.jsx)(ra,{"aria-hidden":`true`}):s===`warning`?(0,P.jsx)(Ii,{"aria-hidden":`true`}):s===`sync`?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(li,{"aria-hidden":`true`});return(0,P.jsxs)(`li`,{className:R(`timeline-event-item`,o?`has-trace`:void 0,t?`is-expanded`:void 0,n?`is-current`:void 0,e.tone===void 0?void 0:`is-${e.tone}`),id:`timeline-event-${e.id}`,children:[(0,P.jsx)(`time`,{className:`timeline-event-time`,children:e.occurredAt}),(0,P.jsx)(`div`,{className:`timeline-event-marker`,"aria-hidden":`true`}),(0,P.jsxs)(`div`,{className:`timeline-event-main`,children:[(0,P.jsxs)(`button`,{"aria-expanded":o?t:void 0,className:`timeline-event-toggle`,disabled:!o,onClick:()=>{r(),i()},type:`button`,children:[(0,P.jsx)(`span`,{className:R(`timeline-event-status-icon`,`is-${s}`),"aria-hidden":`true`,children:c}),(0,P.jsxs)(`span`,{className:`timeline-event-copy`,children:[(0,P.jsx)(`span`,{className:`timeline-event-stage`,children:e.stageLabel??(e.kind===`checkpoint`?`Checkpoint`:`Task event`)}),(0,P.jsxs)(`span`,{className:`timeline-event-title-line`,children:[(0,P.jsx)(`h4`,{children:e.taskTitle??e.title}),e.tokenLabel===void 0?null:(0,P.jsx)(`span`,{className:`timeline-event-token`,children:e.tokenLabel})]})]}),o?(0,P.jsx)(ui,{className:`timeline-event-chevron`,"aria-hidden":`true`}):null]}),a!==void 0&&t?(0,P.jsx)(qb,{trace:a}):null]})]})}function Yb(e){let t=new Map;for(let n of e){let e=n.taskId===void 0?`event:${n.id}`:`task:${n.taskId}`,r=t.get(e);r===void 0?t.set(e,{id:e,title:n.taskTitle??n.title,...n.taskId===void 0?{}:{taskId:n.taskId},items:[n]}):r.items.push(n)}return[...t.values()]}function Xb({tokenOverview:e,items:t,scoreUnits:n=[],empty:r,defaultExpandedItemIds:i,className:a,...o}){let[s,c]=(0,N.useState)(()=>new Set(i??[])),[l,u]=(0,N.useState)(()=>n.at(-1)?.id),[d,f]=(0,N.useState)(0),p=(0,N.useRef)(null),m=Yb(t),h=new Set(t.flatMap(e=>e.taskId===void 0?[]:[e.taskId])).size;(0,N.useEffect)(()=>{if(n.length===0){u(void 0);return}(l===void 0||!n.some(e=>e.id===l))&&u(n.at(-1)?.id)},[l,n]),(0,N.useEffect)(()=>{let e=p.current;if(e===null)return;let t=e;t.scrollLeft=t.scrollWidth;function n(e){if(Math.abs(e.deltaY)<=Math.abs(e.deltaX))return;let n=Math.max(0,t.scrollWidth-t.clientWidth),r=Math.min(n,Math.max(0,t.scrollLeft+e.deltaY));r!==t.scrollLeft&&(e.preventDefault(),t.scrollLeft=r)}return t.addEventListener(`wheel`,n,{passive:!1}),()=>t.removeEventListener(`wheel`,n)},[n.length]),(0,N.useEffect)(()=>{let e=p.current;if(e===null)return;let t=()=>f(e.clientWidth);if(t(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t);let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[n.length]);function g(e,t=!1){u(e),t&&(c(t=>new Set(t).add(e)),window.requestAnimationFrame(()=>{document.getElementById(`timeline-event-${e}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}))}function _(e){c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsx)(pa,{className:R(`timeline-panel`,a),title:`Timeline`,icon:(0,P.jsx)(ci,{"aria-hidden":`true`}),...o,children:(0,P.jsxs)(`div`,{className:`timeline-board-body`,children:[(0,P.jsxs)(`section`,{className:`timeline-events`,"aria-label":`Project timeline`,children:[(0,P.jsx)(`div`,{className:`timeline-audit-header`,children:(0,P.jsxs)(`div`,{className:`timeline-audit-intro`,children:[(0,P.jsx)(`h4`,{children:`Task traceability`}),(0,P.jsxs)(`div`,{className:`timeline-audit-meta`,"aria-label":`Timeline record summary`,children:[(0,P.jsx)(`span`,{children:h===1?`1 task`:`${h} tasks`}),(0,P.jsx)(`span`,{children:t.length===1?`1 record`:`${t.length} records`})]})]})}),t.length===0?r:(0,P.jsx)(`div`,{className:`timeline-task-groups`,children:m.map(e=>(0,P.jsxs)(`section`,{className:`timeline-task-group`,"aria-label":e.title,children:[(0,P.jsxs)(`header`,{className:`timeline-task-group-head`,children:[(0,P.jsx)(`span`,{children:e.taskId===void 0?`Project record`:`Task trace`}),(0,P.jsx)(`strong`,{children:e.title})]}),(0,P.jsx)(`ol`,{className:`timeline-event-list`,children:e.items.map(e=>(0,P.jsx)(Jb,{active:l===e.id,expanded:s.has(e.id),item:e,onActivate:()=>g(e.id),onToggle:()=>_(e.id)},e.id))})]},e.id))})]}),(0,P.jsxs)(`section`,{className:`timeline-overview`,"aria-label":`Timeline score and token usage`,children:[n.length===0?null:(0,P.jsx)(`div`,{className:`timeline-score-index`,ref:p,role:`group`,"aria-label":`Timeline score index`,children:(0,P.jsx)(so,{"aria-label":`Timeline event score`,...l===void 0?{}:{activeUnitId:l},edgePadding:0,minimumWidth:d,onUnitSelect:e=>g(e,!0),openingBarline:`double`,openingClef:`treble`,horizontalSpacingScale:po,reveal:!0,scale:uo,units:n})}),(0,P.jsxs)(`div`,{className:`timeline-overview-token`,"aria-label":`Total tokens`,children:[(0,P.jsx)(`span`,{children:`Total tokens`}),(0,P.jsx)(`strong`,{children:e.totalLabel})]})]})]})})}var Zb=new Intl.NumberFormat(`en-US`),Qb=Vo(`beethoven-ode-to-joy`);function $b(e){return[...e].reverse().map((e,t)=>{let n=Qb.units[t%Qb.units.length];if(n===void 0)throw Error(`Timeline score theme unexpectedly has no units`);return{...n,id:e.id,label:`Open ${e.stageLabel??e.title}`}})}function ex(e){return Zb.format(e)}function tx(e){if(e!==void 0)switch(e){case`completed`:return`success`;case`failed`:return`error`;case`needs_human`:return`warning`}}function nx(e){if(e.kind===`task_accepted`)return`Task accepted`;if(e.kind===`checkpoint`)return`Checkpoint`;switch(e.update_state){case`completed`:return`Task completed`;case`failed`:return`Task failed`;case`needs_input`:return`Needs input`;default:return`Task update`}}function rx(e,t){let n=Date.parse(e.occurred_at),r=Date.parse(t.occurred_at),i=Number.isFinite(n)&&Number.isFinite(r)?r-n:t.occurred_at.localeCompare(e.occurred_at);return i===0?t.id.localeCompare(e.id):i}function ix(e,t={}){let n=e.token_usage?.total_tokens??0,r=tx(e.status),i={id:e.id,title:e.task_title??e.title,occurredAt:tr(e.occurred_at),kind:e.kind,stageLabel:nx(e)};return r!==void 0&&(i.tone=r),n>0&&(i.tokenLabel=`${ex(n)} tokens`),e.task_id!==void 0&&(i.taskId=e.task_id),e.task_title!==void 0&&(i.taskTitle=e.task_title),e.trace_card!==void 0&&(i.trace=ox(e.trace_card,t)),i}function ax(e,t){if(e.kind===`worklist_task`&&e.task_id!==void 0){let n=t.onOpenWorklistTask,r=e.task_id;return n===void 0?void 0:()=>n(r)}if(e.kind===`chat_message`&&e.message_id!==void 0){let n=t.onOpenChatMessage,r=e.message_id;return n===void 0?void 0:()=>n(r)}if(e.kind===`reference_file`&&e.path!==void 0){let n=t.onOpenReferenceFile,r=e.path;return n===void 0?void 0:()=>n(r)}}function ox(e,t={}){return{tone:e.tone,...e.summary===void 0?{}:{summary:e.summary},...e.origin===void 0?{}:{origin:{...e.origin.title===void 0?{}:{title:e.origin.title},...e.origin.summary===void 0?{}:{summary:e.origin.summary},...e.origin.unavailable_reason===void 0?{}:{unavailableReason:e.origin.unavailable_reason},...e.origin.source_count===void 0?{}:{sourceCount:e.origin.source_count},...e.origin.snippets===void 0?{}:{snippets:e.origin.snippets.map(e=>({id:e.message_id,author:e.author,body:e.body,createdAt:tr(e.created_at),...t.onOpenChatMessage===void 0?{}:{onClick:()=>t.onOpenChatMessage?.(e.message_id)}}))}}},...e.decisions===void 0?{}:{decisions:e.decisions.map((e,t)=>({id:`${t}:${e.source??`decision`}`,...e.title===void 0?{}:{title:e.title},summary:e.summary}))},...e.clarification===void 0?{}:{clarification:{...e.clarification.title===void 0?{}:{title:e.clarification.title},...e.clarification.summary===void 0?{}:{summary:e.clarification.summary},...e.clarification.request===void 0?{}:{request:e.clarification.request},...e.clarification.status===void 0?{}:{status:e.clarification.status},...e.clarification.answer_count===void 0?{}:{answerCount:e.clarification.answer_count},...e.clarification.answers===void 0?{}:{answers:e.clarification.answers.map(e=>({id:e.message_id,author:e.author,body:e.body,createdAt:tr(e.created_at),...t.onOpenChatMessage===void 0?{}:{onClick:()=>t.onOpenChatMessage?.(e.message_id)}}))}}},...e.contract===void 0?{}:{contract:{goal:e.contract.goal,scope:e.contract.scope,...e.contract.truncated===void 0?{}:{truncated:e.contract.truncated}}},...e.result===void 0?{}:{result:{summary:e.result.summary,...e.result.error_code===void 0?{}:{errorCode:e.result.error_code}}},...e.changes===void 0?{}:{changes:{items:e.changes.items.map(e=>({status:e.status,path:e.path,...e.previous_path===void 0?{}:{previousPath:e.previous_path}})),totalCount:e.changes.total_count,truncated:e.changes.truncated}},...e.verification===void 0?{}:{verification:{checks:e.verification.checks,...e.verification.skip_reason_code===void 0?{}:{skipReasonCode:e.verification.skip_reason_code},...e.verification.skip_reason_summary===void 0?{}:{skipReasonSummary:e.verification.skip_reason_summary}}},...e.promotion===void 0?{}:{promotion:{status:e.promotion.status,...e.promotion.commit_short_oid===void 0?{}:{commitShortOid:e.promotion.commit_short_oid},...e.promotion.summary===void 0?{}:{summary:e.promotion.summary},...e.promotion.reason_code===void 0?{}:{reasonCode:e.promotion.reason_code}}},...e.checkpoint===void 0?{}:{checkpoint:{counters:e.checkpoint.counters,items:e.checkpoint.items.map(e=>({id:e.task_id,title:e.title,status:e.status,summary:e.summary})),...e.checkpoint.generated_files===void 0?{}:{generatedFiles:e.checkpoint.generated_files.map(e=>({id:e.path,name:e.name,path:e.path}))},...e.checkpoint.truncated===void 0?{}:{truncated:e.checkpoint.truncated}}},links:e.links.flatMap(e=>{let n=e.task_id??e.message_id??e.path,r=ax(e,t);return r===void 0?[]:[{id:`${e.kind}:${n??e.label}`,label:e.label,onClick:r}]})}}function sx(e,t={}){let n=e.usage_overview,r=[...e.items].sort(rx).map(e=>ix(e,t));return{tokenOverview:{totalLabel:ex(n.total_tokens)},items:r,scoreUnits:$b(r)}}var cx=[{id:`prepare`,label:`Preparing workspace`},{id:`implement`,label:`Implementing with Codex`},{id:`validate`,label:`Validating result`},{id:`save`,label:`Saving result`}],lx=[{id:`workspace_inspect`,summary:`inspecting the persistent project workspace`,displayStageId:`prepare`},{id:`artifact_candidate_validate`,summary:`validating the candidate Artifact preview`,displayStageId:`validate`},{id:`provider_task_run`,summary:`running Codex task implementation`,displayStageId:`implement`},{id:`provider_retry`,summary:`retrying Codex task after a transient provider failure`,displayStageId:`implement`},{id:`candidate_diff_collect`,summary:`collecting candidate changes`,displayStageId:`validate`},{id:`checks`,summary:`running project checks`,displayStageId:`validate`},{id:`post_checks_diff_collect`,summary:`rechecking candidate changes after checks`,displayStageId:`validate`},{id:`accepted_checkpoint`,summary:`saving the validated project state as an accepted checkpoint`,displayStageId:`save`},{id:`promotion_reconcile`,summary:`reconciling promotion after mainline changed`,displayStageId:`save`},{id:`self_correction`,summary:`retrying task implementation after pipeline feedback`,displayStageId:`implement`}],ux={scratchpad_refresh:{key:`scratchpad_refresh`,label:`Refreshing Scratchpad`,target:{kind:`scratchpad`}},project_context_bootstrap:{key:`project_context_bootstrap`,label:`Preparing project context`,target:{kind:`scratchpad`}},task_compile:{key:`task_compile`,label:`Compiling Worklist tasks`,target:{kind:`scratchpad`}},context_sync:{key:`context_sync`,label:`Synchronizing project context`,target:{kind:`worklist`}},reference_summary_refresh:{key:`reference_summary_refresh`,label:`Processing reference`,target:{kind:`references`}},recovery_check:{key:`recovery_check`,label:`Recovering workspace`,target:{kind:`worklist`}},follow_up_check:{key:`follow_up_check`,label:`Checking follow-up`,target:{kind:`worklist`}}},dx=`Tutti is working on`,fx=new Set([`scratchpad_refresh`]),px=`task_compile`,mx=`project_context_bootstrap`,hx={reading_context:`Codex is reading project context`,planning:`Codex is planning changes`,editing_files:`Codex is editing files`,running_command:`Codex is running a command`,using_tool:`Codex is using a tool`,waiting_for_approval:`Codex is waiting for approval`,finalizing:`Codex is finalizing the result`};function gx(e){if(e===void 0)return null;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(e instanceof Date)return e.getTime();let t=Date.parse(e);return Number.isNaN(t)?null:t}function _x(e){return gx(e.now)??Date.now()}function vx(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;if(t<60)return`${t}m${n}s`;let r=Math.floor(t/60),i=t%60;return`${r}h${String(i).padStart(2,`0`)}m`}function yx(e,t){let n=gx(e);if(n!==null)return vx(Math.max(0,Math.floor((_x(t)-n)/1e3)))}function bx(e,t){return yx(e.active_activity?.started_at??e.runtime?.started_at,t)}function xx(e){let t=e.runtime;if(t===void 0)return;let n=e.active_activity?.activity_ref;if(!(n!==void 0&&t.activity_ref!==n))return t}function Sx(e){if(e<1e3)return String(e);if(e<1e6){let t=e/1e3;return`${e<1e5?t.toFixed(1).replace(/\.0$/u,``):String(Math.round(t))}k`}return`${(e/1e6).toFixed(1).replace(/\.0$/u,``)}m`}function Cx(e){let t=e?.token_usage?.total_tokens;return t===void 0?[]:[`${Sx(t)} tokens`]}function wx(e){let t=e?.token_usage?.total_tokens;return t===void 0?void 0:`${Sx(t)} tokens`}function Tx(e){let t=e?.current_action;return t===void 0?void 0:hx[t]}function Ex(e){let t=Tx(e);if(t===void 0)return;let n=wx(e);return n===void 0?t:`${t} (${n})`}function Dx(e){let t={};return e.active_activity?.activity_ref!==void 0&&(t.activityRef=e.active_activity.activity_ref),e.active_activity?.workflow_ref!==void 0&&(t.workflowRef=e.active_activity.workflow_ref),e.active_task?.id!==void 0&&(t.taskId=e.active_task.id),Object.keys(t).length===0?void 0:t}function Ox(e,t,n){return e===`context_sync`&&t.last_conclusion?.task_id!==void 0?{kind:`task`,taskId:t.last_conclusion.task_id}:n.target}function kx(e){return lx[Fx(e)]??lx[0]}function Ax(e){return cx.findIndex(t=>t.id===e)}function jx(e){return cx[Ax(kx(e).displayStageId)]??cx[0]}function Mx(e){if(e.status!==`running`||e.active_activity?.activity_kind!==`procedure`)return null;let t=e.active_activity.workflow_kind;if(t===void 0||fx.has(t))return null;let n=ux[t],r=Ox(t,e,n);return{key:`procedure:${n.key}`,label:n.label,title:n.label,tone:`running`,target:r}}function Nx(e,t){if(e.status!==`running`||e.active_activity?.activity_kind!==`procedure`)return null;let n=e.active_activity.workflow_kind;if(n===void 0||fx.has(n))return null;let r=ux[n],i=Ox(n,e,r),a=Dx(e),o=xx(e),s=n===px?Cx(o):[],c=n===mx?`Creating project context for the first time`:void 0,l=yx(e.active_activity?.started_at??o?.started_at,t);return{key:`procedure:${r.key}`,title:dx,summary:e.summary,tone:`running`,metaLabel:r.label,completionTarget:i,...a===void 0?{}:{completionSource:a},steps:[{id:`procedure:${r.key}:active`,label:r.label,status:`running`,...l===void 0?{}:{elapsedLabel:l},...c===void 0?{}:{detail:c},...s.length===0?{}:{metrics:s}}]}}function Px(e){let t=e.indexOf(` - `);return t===-1?``:e.slice(t+3).trim().replace(/\.$/u,``)}function Fx(e){let t=Px(e).toLocaleLowerCase();if(t===``)return 0;let n=lx.findIndex(e=>t.includes(e.summary.toLocaleLowerCase()));return n===-1?0:n}function Ix(e,t){if(e.status!==`running`||e.active_task===void 0)return null;let n=Ax(kx(e.summary).displayStageId),r=jx(e.summary),i=Dx(e),a=xx(e),o=bx(e,t);return{key:`run:${e.active_task.id}`,title:dx,summary:e.active_task.title,tone:`running`,metaLabel:r.label,completionTarget:{kind:`task`,taskId:e.active_task.id},...i===void 0?{}:{completionSource:i},steps:cx.map((e,t)=>{let r=t<n?`done`:t===n?`running`:`waiting`,i=t===n,s=e.id===`implement`,c=i&&s?Ex(a):void 0,l=s&&c===void 0?Cx(a):[];return{id:e.id,label:e.label,status:r,...i&&o!==void 0?{elapsedLabel:o}:{},...c===void 0?{}:{detail:c},...l.length>0?{metrics:l}:{}}})}}function Lx(e,t){if(e.status!==`running`||e.active_activity?.workflow_kind!==`context_sync`||e.last_conclusion?.kind!==`completed`||e.last_conclusion.task_id===void 0)return null;let n=Dx(e),r=bx(e,t);return{key:`context-sync:${e.last_conclusion.task_id}`,title:dx,summary:e.summary,tone:`running`,metaLabel:`Synchronizing context`,completionTarget:{kind:`task`,taskId:e.last_conclusion.task_id},...n===void 0?{}:{completionSource:n},steps:[{id:`task_complete`,label:`Task completed`,status:`done`},{id:`context_sync`,label:`Synchronizing project context`,status:`running`,...r===void 0?{}:{elapsedLabel:r}}]}}function Rx(e){let t=e.blocked_by?.kind===`approval`?{kind:`approval`}:{kind:`clarification`};return{key:`pending:${e.blocked_by?.kind===`approval`?e.blocked_by.approval_id:e.blocked_by?.kind===`clarification`?e.blocked_by.round_id:e.updated_at}`,title:dx,summary:e.summary,tone:`pending`,metaLabel:`Needs input`,completionTarget:t,steps:[{id:`waiting_for_input`,label:`Needs input`,status:`pending`}]}}function zx(e){let t=e.last_conclusion?.task_id??(e.status===`failed`?e.active_task?.id:void 0);return t===void 0&&e.status!==`failed`?null:{key:`failed:${t??e.updated_at}`,title:dx,summary:e.last_conclusion?.summary??e.summary,tone:`failed`,metaLabel:`Failed`,...t===void 0?{}:{completionTarget:{kind:`task`,taskId:t}},steps:[{id:`run_failed`,label:`Run failed`,status:`failed`}]}}function Bx(e,t={}){let n=Ix(e,t);if(n!==null)return n;let r=Lx(e,t);if(r!==null)return r;let i=Nx(e,t);return i===null?e.status===`pending`?Rx(e):e.status===`failed`?zx(e):null:i}function Vx(e){let t=e.activeTaskCompileClarification&&!e.activeScratchpadRefreshFromSubmit&&!e.activeProjectContextBootstrap&&!e.activeTaskCompile,n=[],r=yx(e.startedAt,e);if(e.activeProjectContextBootstrap)n.push({id:`scratchpad_submit:project_context`,label:`Preparing project context`,status:`running`,...r===void 0?{}:{elapsedLabel:r},detail:`Creating project context for the first time`});else if(e.activeTaskCompile||e.activeScratchpadRefreshFromSubmit){let t=e.activeTaskCompile?Cx(e.runtime):[];n.push({id:`scratchpad_submit:task_compile`,label:`Compiling Worklist tasks`,status:`running`,...r===void 0?{}:{elapsedLabel:r},...t.length===0?{}:{metrics:t}})}else n.push({id:`scratchpad_submit:task_compile`,label:`Compiling Worklist tasks`,status:t?`done`:`running`});t&&n.push({id:`scratchpad_submit:needs_input`,label:`Needs input`,status:`pending`});let i=n.find(e=>e.status===`running`||e.status===`pending`)?.label??`Compiling Worklist tasks`;return{key:`scratchpad-submit`,title:dx,summary:t?`Task compilation needs a decision before Worklist can update.`:`Preparing the Scratchpad for formal tasks.`,tone:t?`pending`:`running`,metaLabel:t?`Needs input`:i,completionTarget:t?{kind:`clarification`}:{kind:`scratchpad`},steps:n}}function Hx(e,t){return{...e,key:`${e.key}:complete`,title:dx,summary:t,tone:`complete`,metaLabel:`Complete`,steps:e.steps.map(e=>({...e,status:`done`}))}}function Ux(e,t){let n=e.completionSource;return n===void 0?!0:n.activityRef===void 0?n.workflowRef===void 0?n.taskId===void 0?!0:t.task_id===n.taskId:t.workflow_ref===n.workflowRef:t.activity_ref===n.activityRef}function Wx(e){if(e.status===`idle`)return[];let t=[];if(e.status===`pending`){let n=e.blocked_by?.kind===`approval`?{kind:`approval`}:{kind:`clarification`};t.push({key:`pending`,label:`Needs input`,title:`Needs input`,tone:`pending`,target:n})}let n=e.last_conclusion?.kind===`failed`?e.last_conclusion.task_id:e.status===`failed`?e.active_task?.id??e.last_conclusion?.task_id:void 0;if(n!==void 0&&t.push({key:`failed`,label:`Run failed`,tone:`failed`,target:{kind:`task`,taskId:n}}),e.status===`running`&&e.active_task!==void 0){let n=jx(e.summary);t.push({key:`running`,label:n.label,title:n.label,tone:`running`,target:{kind:`task`,taskId:e.active_task.id}})}let r=Mx(e);return r!==null&&t.push(r),t}var Gx=`/assets/beethoven-symphony-5-opening-ypVy5SB4.svg`,Kx=`/assets/beethoven-symphony-7-allegretto-B3bc-cZD.svg`,qx=`/assets/dvorak-symphony-9-largo-BEgNL3HB.svg`,Jx=`/assets/mozart-symphony-18-allegro-B5-MrLL1.svg`,Yx=`/assets/Tutti-square-BqFU7F0D.png`,Xx=`/assets/Tutti-B7gEyTp1.png`,Zx=`/assets/tutti_avatar-_0Yc-cMJ.png`,Qx=`/assets/avatar-avery-CkLXb185.svg`,$x=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2080%2080'%20fill='none'%20shape-rendering='auto'%20aria-hidden='true'%3e%3c!--%20Generated%20by%20DiceBear%20(https://dicebear.com)%20--%3e%3cmetadata%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:dcterms='http://purl.org/dc/terms/'%3e%3crdf:RDF%3e%3crdf:Description%3e%3cdc:title%3eDylan!%20The%20Avatar%20Generator%3c/dc:title%3e%3cdc:creator%3eNatalia%20Spivak%3c/dc:creator%3e%3cdc:source%20xsi:type='dcterms:URI'%3ehttps://www.figma.com/community/file/1356575240759683500%3c/dc:source%3e%3cdcterms:license%20xsi:type='dcterms:URI'%3ehttps://creativecommons.org/licenses/by/4.0/%3c/dcterms:license%3e%3cdc:rights%3eRemix%20of%20“Dylan!%20The%20Avatar%20Generator”%20(https://www.figma.com/community/file/1356575240759683500)%20by%20“Natalia%20Spivak”,%20licensed%20under%20“CC%20BY%204.0”%20(https://creativecommons.org/licenses/by/4.0/)%3c/dc:rights%3e%3c/rdf:Description%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%3e%3cg%20id='mood-happy-7dff0831'%3e%3cpath%20d='M.04%2017.04c2.41%209.29%2015.16%2012.28%2022.34%206.67a14%2014%200%200%200%204.7-7.22c.36-1.28-1.57-1.8-1.93-.57-1.24%204.23-4.33%207.4-8.68%208.33-3.77.8-8.03-.1-11.05-2.52a10%2010%200%200%201-3.45-5.26c-.32-1.25-2.25-.72-1.93.53'%20fill='black'/%3e%3c/g%3e%3cg%20id='hair-shortCurls-7dff0831'%3e%3cpath%20d='m15.3%2027.49%201.58%204.38%201.06-9.52s2.27%201.27%203.44-.26.16-3.47.16-3.47%201.81.55%203.31-.8c1.87-1.67%201.26-3.46%201.26-3.46s1.71%201.9%204.5%201.1c2.77-.8%203.14-2.76%203.14-2.76s.56%202.18%203.4%202.12%203.2-2.01%203.2-2.01%200%202.43%202.43%203.14%203.43-1.24%203.43-1.24c0%20.02-.9%202.39.66%203.76%201.44%201.26%203.5.35%203.5.35s-.73%202.3.77%203.62c1.6%201.4%203.48.6%203.48.6l.77%208.34%201.8-3.8s1.4-.13%202.72.15c0%20.01%202.58-2.78%201.15-5.9s-3.64-2.86-3.64-2.86%201.95-3.05.13-5.65-4.94-1.96-4.94-1.96%201.18-3.52-1.68-5.27-5.92.46-5.92.46-.1-3.7-3.2-4.16c-3.26-.48-4.58%202.66-4.58%202.66s-1.35-2.89-4.14-2.44c-2.8.44-3.32%203.53-3.32%203.53S27.32%203.57%2024.92%205s-1.8%204.51-1.8%204.51-2.98-2.24-5.32-.23-.14%205.1-.14%205.1-3.87-1.12-5.04%201.8%201.66%204.95%201.66%204.95-5.35%201.16-2.82%207.33c0%200%20.6-.27%202.02-.62s1.8-.38%201.8-.38z'%20fill='%23000000'/%3e%3c/g%3e%3cclipPath%20id='clip-7dff0831'%3e%3crect%20width='80'%20height='80'%20rx='0'%20ry='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23clip-7dff0831)'%3e%3crect%20width='80'%20height='80'%20fill='%23e5f4ec'/%3e%3cpath%20d='M19.07%2030.47s1.57-20.23%2021.59-20.23S62.3%2030.55%2062.3%2030.55s9.43-.8%209.43%207.6c0%208.42-9.28%207.13-9.28%207.13S60.9%2067.15%2042.03%2067.15c-21.11%200-23.4-20.8-23.4-20.8s-9%20.72-9.93-6.25c-1.08-8.2%2010.37-9.64%2010.37-9.64'%20fill='%23c26450'/%3e%3cpath%20d='m64.3%2039.49.46-.41.1-.09c.12-.1-.13.1-.02.02l.24-.17q.5-.35%201.06-.62l.26-.12.05-.02.05-.02.58-.21q.6-.18%201.2-.28c.52-.08.85-.76.7-1.23-.18-.56-.67-.8-1.23-.7a9.3%209.3%200%200%200-4.87%202.43c-.38.36-.4%201.06%200%201.4.4.36%201%20.4%201.4%200zm-51.8-1.16.14.01c-.27-.02-.11-.01-.04%200l.3.05.52.14.28.09.12.05c.02%200%20.22.09.06.02-.14-.1%200-.04.03-.03l.15.06.26.13.47.3.27.22q.47.38.83.83c.33.4%201.07.37%201.41%200%20.4-.43.36-.98%200-1.4a7.3%207.3%200%200%200-4.84-2.53c-.52-.06-1.02.5-1%201%20.03.59.44.94%201%201m18.3-1.9v4.54c0%20.52.46%201.02%201%201s1-.44%201-1V36.4c0-.52-.46-1.02-1-1s-1%20.44-1%201M49.2%2036l-.15%204.81a1%201%200%200%200%201%201c.56-.02.98-.44%201-1l.15-4.8a1%201%200%200%200-1-1%201%201%200%200%200-1%201'%20fill='black'/%3e%3cuse%20transform='translate(27.82%2026.75)'%20href='%23mood-happy-7dff0831'/%3e%3cuse%20transform='translate(3.78%202.95)'%20href='%23hair-shortCurls-7dff0831'/%3e%3c/g%3e%3c/svg%3e`,eS=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2080%2080'%20fill='none'%20shape-rendering='auto'%20aria-hidden='true'%3e%3c!--%20Generated%20by%20DiceBear%20(https://dicebear.com)%20--%3e%3cmetadata%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:dcterms='http://purl.org/dc/terms/'%3e%3crdf:RDF%3e%3crdf:Description%3e%3cdc:title%3eDylan!%20The%20Avatar%20Generator%3c/dc:title%3e%3cdc:creator%3eNatalia%20Spivak%3c/dc:creator%3e%3cdc:source%20xsi:type='dcterms:URI'%3ehttps://www.figma.com/community/file/1356575240759683500%3c/dc:source%3e%3cdcterms:license%20xsi:type='dcterms:URI'%3ehttps://creativecommons.org/licenses/by/4.0/%3c/dcterms:license%3e%3cdc:rights%3eRemix%20of%20“Dylan!%20The%20Avatar%20Generator”%20(https://www.figma.com/community/file/1356575240759683500)%20by%20“Natalia%20Spivak”,%20licensed%20under%20“CC%20BY%204.0”%20(https://creativecommons.org/licenses/by/4.0/)%3c/dc:rights%3e%3c/rdf:Description%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%3e%3cg%20id='mood-happy-46c131e2'%3e%3cpath%20d='M.04%2017.04c2.41%209.29%2015.16%2012.28%2022.34%206.67a14%2014%200%200%200%204.7-7.22c.36-1.28-1.57-1.8-1.93-.57-1.24%204.23-4.33%207.4-8.68%208.33-3.77.8-8.03-.1-11.05-2.52a10%2010%200%200%201-3.45-5.26c-.32-1.25-2.25-.72-1.93.53'%20fill='black'/%3e%3c/g%3e%3cg%20id='hair-fluffy-46c131e2'%3e%3cpath%20d='M16.45%2029.48s13.74%2023.53%203.86%2028.24C9.05%2063.08-1.2%2048.01.1%2036.77s10.96-16.35%2010.96-16.35-.58-9.5%209.2-15.04c9.78-5.55%2016.64.44%2016.64.44s8.06-5.9%2015.5-1.37c7.46%204.53%207.26%2014.68%207.26%2014.68s13.74-.56%2013.65%2016.47c-.08%2015.17-10.03%2022.94-16.8%2021.6-10.45-2.07%201.27-29.22%201.27-29.22s-14.4%201.04-20.14-9.75c0%200-4%205.95-9.7%208.62a32%2032%200%200%201-11.47%202.64z'%20fill='%231d5dff'/%3e%3c/g%3e%3cclipPath%20id='clip-46c131e2'%3e%3crect%20width='80'%20height='80'%20rx='0'%20ry='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23clip-46c131e2)'%3e%3crect%20width='80'%20height='80'%20fill='%23fbf0d1'/%3e%3cpath%20d='M19.07%2030.47s1.57-20.23%2021.59-20.23S62.3%2030.55%2062.3%2030.55s9.43-.8%209.43%207.6c0%208.42-9.28%207.13-9.28%207.13S60.9%2067.15%2042.03%2067.15c-21.11%200-23.4-20.8-23.4-20.8s-9%20.72-9.93-6.25c-1.08-8.2%2010.37-9.64%2010.37-9.64'%20fill='%23c26450'/%3e%3cpath%20d='m64.3%2039.49.46-.41.1-.09c.12-.1-.13.1-.02.02l.24-.17q.5-.35%201.06-.62l.26-.12.05-.02.05-.02.58-.21q.6-.18%201.2-.28c.52-.08.85-.76.7-1.23-.18-.56-.67-.8-1.23-.7a9.3%209.3%200%200%200-4.87%202.43c-.38.36-.4%201.06%200%201.4.4.36%201%20.4%201.4%200zm-51.8-1.16.14.01c-.27-.02-.11-.01-.04%200l.3.05.52.14.28.09.12.05c.02%200%20.22.09.06.02-.14-.1%200-.04.03-.03l.15.06.26.13.47.3.27.22q.47.38.83.83c.33.4%201.07.37%201.41%200%20.4-.43.36-.98%200-1.4a7.3%207.3%200%200%200-4.84-2.53c-.52-.06-1.02.5-1%201%20.03.59.44.94%201%201m18.3-1.9v4.54c0%20.52.46%201.02%201%201s1-.44%201-1V36.4c0-.52-.46-1.02-1-1s-1%20.44-1%201M49.2%2036l-.15%204.81a1%201%200%200%200%201%201c.56-.02.98-.44%201-1l.15-4.8a1%201%200%200%200-1-1%201%201%200%200%200-1%201'%20fill='black'/%3e%3cuse%20transform='translate(27.82%2026.75)'%20href='%23mood-happy-46c131e2'/%3e%3cuse%20transform='translate(3.78%202.95)'%20href='%23hair-fluffy-46c131e2'/%3e%3c/g%3e%3c/svg%3e`,tS=`/assets/ode-to-joy-SNBUPr3-.svg`,nS=Yx,rS=Xx,iS=Zx,aS={logoSrc:Xx,tuttiAvatarSrc:Zx,scoreSrc:tS,humanAvatars:{fey:$x,avery:Qx,jun:eS}};function oS({onClick:e}){let t=(0,P.jsx)(Es,{src:rS,label:`Tutti`});return e===void 0?t:(0,P.jsx)(Ds,{logo:t,label:`Tutti Project Center`,onClick:e})}function sS({onClick:e}){return(0,P.jsx)(Ds,{logo:(0,P.jsx)(Es,{src:rS,className:`tutti-logo`}),onClick:e})}var cS=`https://lets.tutti.now`,lS=`${cS}/start/create-a-project#connect-a-provider-and-choose-a-model`,uS={href:cS,target:`_blank`,rel:`noopener noreferrer`};function dS(){return(0,P.jsxs)(dd,{children:[`New to Tutti?`,` `,(0,P.jsx)(`a`,{...uS,"aria-label":`Read the Tutti documentation (opens in a new tab)`,children:`Read the docs`}),`.`]})}function fS(){return(0,P.jsx)(Is,{...uS,label:`Support Center`,icon:(0,P.jsx)(pi,{"aria-hidden":`true`})})}var pS=[Gx,Kx,qx,Jx];function mS(){return pS[Math.min(pS.length-1,Math.floor(Math.random()*pS.length))]}function hS({backgroundPattern:e,children:t,...n}){let[r]=(0,N.useState)(mS);return(0,P.jsx)(Ho,{...e===void 0?{backgroundImageSrc:r}:{backgroundPattern:e},...n,children:t})}function gS({actions:e,children:t,onBrandClick:n}){return(0,P.jsxs)(hS,{children:[(0,P.jsx)(Uo,{brand:(0,P.jsx)(sS,{onClick:n}),actions:e}),t]})}function _S({children:e,label:t,onBrandClick:n}){return(0,P.jsx)(gS,{onBrandClick:n,children:(0,P.jsx)(Go,{"aria-label":t,children:e})})}function vS({auth:e,mobileAuth:t,onBrandClick:n}){return(0,P.jsx)(hS,{backgroundPattern:`dots`,className:`homepage-entry-page`,children:(0,P.jsx)(ud,{brand:(0,P.jsx)(sS,{onClick:n}),visual:(0,P.jsx)(Gd,{assets:aS}),auth:e,mobileAuth:t,footer:(0,P.jsx)(dS,{})})})}function yS({phase:e,form:t,onChange:n}){return e===`code`?(0,P.jsx)(`div`,{className:`form-stack`,children:(0,P.jsx)(Ms,{label:`Email verification code`,children:(0,P.jsx)(Os,{autoComplete:`one-time-code`,inputMode:`numeric`,type:`text`,value:t.code,onChange:e=>n({code:e.target.value}),placeholder:`Enter email code`,maxLength:6})})}):e===`profile`?(0,P.jsxs)(`div`,{className:`form-stack`,children:[(0,P.jsx)(Ms,{label:`Display name`,children:(0,P.jsx)(Os,{autoComplete:`name`,type:`text`,value:t.displayName,onChange:e=>n({displayName:e.target.value}),placeholder:`username`})}),(0,P.jsx)(`p`,{className:`form-note`,children:`This name cannot be changed yet.`})]}):(0,P.jsx)(`div`,{className:`form-stack`,children:(0,P.jsx)(Ms,{label:`Email`,children:(0,P.jsx)(Os,{autoComplete:`email`,type:`email`,value:t.email,onChange:e=>n({email:e.target.value}),placeholder:`alex@example.com`})})})}function bS({surface:e,phase:t,form:n,pending:r,error:i,submitDisabled:a,submitLabel:o,pendingLabel:s,onChange:c,onSubmit:l,onBack:u}){let d={title:t===`profile`?`Choose display name`:`Sign in`,description:t===`profile`?`Set the name your teammates will see.`:t===`code`?`Enter your email verification code.`:`Use your email to continue.`,onSubmit:l,action:(0,P.jsxs)(bs,{type:`submit`,disabled:a||r,children:[r?s??(t===`profile`?`Saving`:t===`code`?`Verifying`:`Sending code`):o??(t===`profile`?`Save name`:t===`code`?`Verify email code`:`Send code`),(0,P.jsx)(ai,{"aria-hidden":`true`})]}),secondaryAction:t===`code`&&u!==void 0?(0,P.jsxs)(xs,{type:`button`,onClick:u,disabled:r,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Change email`]}):void 0,feedback:i===null?void 0:(0,P.jsx)(Ns,{children:i}),children:(0,P.jsx)(yS,{phase:t,form:n,onChange:c})};return e===`card`?(0,P.jsx)(ef,{...d}):(0,P.jsx)(fd,{...d})}function xS(e){return(0,P.jsx)(bS,{...e,surface:`card`})}function SS(e){return(0,P.jsx)(bS,{...e,surface:`rail`})}function CS({onBrandClick:e,...t}){return(0,P.jsx)(vS,{onBrandClick:e,auth:(0,P.jsx)(SS,{...t}),mobileAuth:(0,P.jsx)(xS,{...t})})}function wS({nextKind:e,actionPending:t,loginForm:n,onRetry:r,onAccept:i,onOpen:a}){if(e===`loading`)return(0,P.jsx)(xs,{type:`button`,disabled:!0,children:`Loading`});if(e===`error`)return(0,P.jsx)(xs,{type:`button`,onClick:r,children:`Retry`});if(e===`invalid_or_expired`)return(0,P.jsxs)(xs,{type:`button`,disabled:!0,children:[(0,P.jsx)(ta,{"aria-hidden":`true`}),`Invalid invite`]});if(e===`login_required`){let e=n?.phase===`profile`?`Save name`:n?.phase===`code`?`Verify email code`:`Send code`,r=n?.phase===`profile`?`Saving`:n?.phase===`code`?`Verifying`:`Sending code`;return(0,P.jsxs)(bs,{type:`submit`,disabled:t||n?.submitDisabled===!0,children:[t?r:e,(0,P.jsx)(ai,{"aria-hidden":`true`})]})}return e===`accept_join`?(0,P.jsxs)(bs,{type:`button`,disabled:t,onClick:i,children:[t?`Joining`:`Accept and open workspace`,(0,P.jsx)(ai,{"aria-hidden":`true`})]}):e===`open_workspace`?(0,P.jsxs)(bs,{type:`button`,disabled:t,onClick:a,children:[t?`Opening`:`Open workspace`,(0,P.jsx)(ai,{"aria-hidden":`true`})]}):(0,P.jsxs)(xs,{type:`button`,disabled:!0,children:[(0,P.jsx)(Vi,{"aria-hidden":`true`}),`Host offline`]})}function TS({nextKind:e,error:t}){return e===`loading`?null:e===`error`?(0,P.jsx)(ia,{tone:`error`,icon:(0,P.jsx)(ta,{"aria-hidden":`true`}),children:t??`Invite unavailable`}):e===`invalid_or_expired`?(0,P.jsx)(ia,{tone:`error`,icon:(0,P.jsx)(ta,{"aria-hidden":`true`}),children:`Join token is invalid or expired`}):e===`host_offline`?(0,P.jsx)(ia,{tone:`warning`,icon:(0,P.jsx)(Vi,{"aria-hidden":`true`}),children:`Host is offline`}):null}function ES({projectName:e,description:t,hostLabel:n,hostOnline:r,nextKind:i,accountLabel:a,membershipLabel:o,actionPending:s,error:c,loginForm:l,onBrandClick:u,onRetry:d,onAccept:f,onOpen:p}){let m=i===`login_required`&&l!==void 0;return(0,P.jsx)(_S,{label:`Join project`,onBrandClick:u,children:(0,P.jsxs)(ef,{title:`Join project`,description:t,onSubmit:e=>{if(m){l.onSubmit(e);return}e.preventDefault()},action:(0,P.jsx)(wS,{nextKind:i,actionPending:m?l.pending:s,...m?{loginForm:l}:{},onAccept:f,onOpen:p,...d===void 0?{}:{onRetry:d}}),secondaryAction:m&&l.phase===`code`&&l.onBack!==void 0?(0,P.jsxs)(xs,{type:`button`,onClick:l.onBack,disabled:l.pending,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Change email`]}):void 0,feedback:(0,P.jsxs)(P.Fragment,{children:[m&&l.error!==null?(0,P.jsx)(Ns,{children:l.error}):null,(0,P.jsx)(TS,{nextKind:i,error:c}),c===null||i===`error`?null:(0,P.jsx)(Ns,{children:c})]}),children:[(0,P.jsx)(tf,{projectName:e,hostLabel:n,hostOnline:r}),m?(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(yS,{phase:l.phase,form:l.form,onChange:l.onChange})}):(0,P.jsx)(nf,{label:a===null?`Account`:`Signed in as`,value:a??`Sign in required`,action:o===null?null:(0,P.jsx)(`span`,{className:`quiet-link`,children:o})})]})})}function DS(e){switch(e.status){case`online`:return`Online`;case`reconnecting`:return`Reconnecting`;case`relay-unavailable`:return`Relay unavailable`;case`stale`:return`Needs restart`;case`stopped`:return`Stopped`;case`workspace-missing`:return`Folder missing`;case`workspace-replaced`:return`Folder changed`;case`invalid`:return`Needs attention`}}function OS(e){return(e.status===`online`||e.status===`reconnecting`)&&e.provider_status===`configured`}function kS(e){return(e.status===`stopped`||e.status===`stale`||e.status===`relay-unavailable`)&&e.provider_status===`configured`}function AS(e,t){let n=Date.parse(e.activity_at??``),r=Date.parse(t.activity_at??``),i=Number.isNaN(n)?0:n;return(Number.isNaN(r)?0:r)-i||e.display_name.localeCompare(t.display_name,`en`)||e.project_id.localeCompare(t.project_id,`en`)}function jS(e){return e.provider_status===`configured`?e.provider_model?.trim()||`Provider ready`:e.provider_status===`invalid`?`Provider issue`:`Provider needed`}function MS({project:e,pending:t,onLaunch:n,onOpen:r,onCopyInvite:i,onStop:a}){return e.status===`online`||e.status===`reconnecting`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(bs,{type:`button`,disabled:t||e.open_url===void 0,onClick:r,children:[(0,P.jsx)(yi,{"aria-hidden":`true`}),`Open`]}),(0,P.jsxs)(xs,{type:`button`,disabled:t,onClick:i,children:[(0,P.jsx)(Ai,{"aria-hidden":`true`}),`Invite`]}),(0,P.jsxs)(xs,{type:`button`,disabled:t,onClick:a,children:[(0,P.jsx)(Zi,{"aria-hidden":`true`}),`Stop`]})]}):(0,P.jsxs)(xs,{type:`button`,disabled:t||!kS(e),onClick:n,children:[(0,P.jsx)(Ui,{"aria-hidden":`true`}),`Resume`]})}function NS({form:e,models:t,projects:n,projectsLoading:r,sessionLoading:i,sessionError:a,createOpen:o,createStep:s,modelDiscoveryPending:c,launchPending:l,projectActionPending:u,packageUpdateAction:d,onChange:f,onCreateOpenChange:p,onCreateSubmit:m,onCreateBack:h,onChooseFolder:g,onRefresh:_,onLaunchExisting:v,onOpenProject:y,onCopyInvite:b,onStopProject:x,onPackageUpdate:S}){let C=[`Folder`,`Details`,`Provider`,`Model`],w=C.findIndex(e=>e.toLowerCase()===s),T=c||l,E=s===`folder`?e.workspacePath.trim()!==``:s===`details`?e.displayName.trim()!==``:s===`provider`?e.baseUrl.trim()!==``&&e.apiKey.trim()!==``:t.length>0&&e.model.trim()!==``,ee=n.filter(OS).sort(AS),D=n.filter(kS).sort(AS),O=n.filter(e=>!OS(e)&&!kS(e)).sort(AS),k=e=>(0,P.jsx)(Sf,{title:e.display_name,statusLabel:DS(e),online:e.status===`online`,path:e.workspace_path,createdLabel:Qn(e.created_at),providerLabel:jS(e),providerStatus:e.provider_status,actions:(0,P.jsx)(MS,{project:e,pending:u===e.project_id,onLaunch:()=>v(e),onOpen:()=>y(e),onCopyInvite:()=>b(e),onStop:()=>x(e)})},e.project_id);return(0,P.jsx)(gS,{onBrandClick:_,children:(0,P.jsxs)(Wo,{children:[(0,P.jsxs)(rf,{className:`local-console-card`,title:`Local projects`,accountAction:(0,P.jsxs)(P.Fragment,{children:[d===void 0?null:(0,P.jsx)(af,{description:d.description,descriptionId:`local-console-package-update-description`,disabledTrigger:d.disabled,"aria-live":`polite`,action:(0,P.jsx)(xs,{type:`button`,disabled:d.disabled,onClick:S,children:d.label})}),(0,P.jsx)(ys,{type:`button`,label:`Refresh projects`,icon:(0,P.jsx)(Hi,{"aria-hidden":`true`}),disabled:r,onClick:_}),(0,P.jsxs)(bs,{type:`button`,disabled:i||a!==null,onClick:()=>p(!0),children:[(0,P.jsx)(Bi,{"aria-hidden":`true`}),`New project`]})]}),"aria-label":`Tutti Local Console`,children:[r||i?(0,P.jsx)(df,{"aria-label":`Machine projects`,children:(0,P.jsx)(mf,{"aria-label":`Loading local projects`,children:(0,P.jsx)(aa,{})})}):a===null?n.length===0?(0,P.jsx)(df,{"aria-label":`Machine projects`,children:(0,P.jsx)(mf,{children:(0,P.jsx)(ia,{children:`Create your first local project.`})})}):null:(0,P.jsx)(df,{"aria-label":`Machine projects`,children:(0,P.jsx)(mf,{children:(0,P.jsx)(ia,{children:a})})}),r||i||n.length===0?null:(0,P.jsxs)(P.Fragment,{children:[ee.length===0?null:(0,P.jsx)(bf,{title:`Available`,"aria-label":`Available projects`,children:ee.map(k)}),D.length===0?null:(0,P.jsx)(bf,{title:`Ready to resume`,"aria-label":`Projects ready to resume`,children:D.map(k)}),O.length===0?null:(0,P.jsx)(xf,{children:O.map(k)})]})]}),(0,P.jsxs)(gf,{open:o,onOpenChange:p,steps:C,currentStep:Math.max(0,w),closeDisabled:T,explicitCloseOnly:!0,onSubmit:m,backAction:s===`folder`?void 0:(0,P.jsxs)(xs,{type:`button`,disabled:T,onClick:h,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Back`]}),action:(0,P.jsxs)(bs,{type:`submit`,disabled:!E||T||i,children:[s===`model`?(0,P.jsx)(Ui,{"aria-hidden":`true`}):(0,P.jsx)(ai,{"aria-hidden":`true`}),s===`provider`&&c?`Checking provider`:s===`model`?l?`Launching`:`Launch and continue`:`Continue`]}),children:[s===`folder`?(0,P.jsx)(yf,{title:`Project folder`,description:`Choose an existing folder on this machine. It can be empty or contain an existing project.`,children:(0,P.jsxs)(vf,{children:[(0,P.jsx)(Os,{"aria-label":`Project folder`,autoComplete:`off`,value:e.workspacePath,onChange:e=>f({workspacePath:e.target.value}),placeholder:`Enter an absolute project folder path`,autoFocus:!0}),(0,P.jsxs)(xs,{type:`button`,onClick:g,children:[(0,P.jsx)(wi,{"aria-hidden":`true`}),`Choose folder`]})]})}):null,s===`details`?(0,P.jsx)(yf,{title:`Project details`,description:`Describe what you want to build with this project.`,children:(0,P.jsxs)(_f,{children:[(0,P.jsx)(Ms,{label:`Project name`,className:`local-console-field-wide`,children:(0,P.jsx)(Os,{autoComplete:`off`,value:e.displayName,maxLength:80,onChange:e=>f({displayName:e.target.value}),placeholder:`Enter a project name`,autoFocus:!0})}),(0,P.jsx)(Ms,{label:`Project description (optional)`,className:`local-console-field-wide`,children:(0,P.jsx)(ks,{value:e.description,maxLength:160,onChange:e=>f({description:e.target.value}),placeholder:`A short project description helps Tutti produce better code`})})]})}):null,s===`provider`?(0,P.jsx)(yf,{title:`Provider`,description:(0,P.jsxs)(P.Fragment,{children:[`Enter an endpoint compatible with the`,` `,(0,P.jsx)(Ps,{href:lS,"aria-label":`Tutti Responses API provider guide (opens in a new tab)`,icon:(0,P.jsx)(pi,{"aria-hidden":`true`}),children:`OpenAI Responses API`}),`. Credentials stay only on this machine.`]}),children:(0,P.jsxs)(_f,{children:[(0,P.jsx)(Ms,{label:`Base URL`,children:(0,P.jsx)(Os,{autoComplete:`off`,inputMode:`url`,type:`url`,value:e.baseUrl,onChange:e=>f({baseUrl:e.target.value}),placeholder:`Enter Provider Base URL`,autoFocus:!0})}),(0,P.jsx)(Ms,{label:`API key`,children:(0,P.jsx)(Os,{autoComplete:`off`,type:`password`,value:e.apiKey,onChange:e=>f({apiKey:e.target.value}),placeholder:`Enter API key`})})]})}):null,s===`model`?(0,P.jsx)(yf,{title:`Model`,description:`Choose an available model or type another model name.`,children:(0,P.jsx)(Ms,{label:`Model`,children:(0,P.jsx)(As,{autoComplete:`off`,value:e.model,options:t,maxVisibleOptions:8,onValueChange:e=>f({model:e}),placeholder:`Choose or enter a model`,autoFocus:!0})})}):null]})]})})}function PS({onBrandClick:e,sessionError:t=null,...n}){let r={...n,error:n.error??t};return(0,P.jsx)(vS,{onBrandClick:e,auth:(0,P.jsx)(SS,{...r}),mobileAuth:(0,P.jsx)(xS,{...r})})}function FS({account:e,projects:t,loading:n,error:r,openPending:i,logoutPending:a,joinLinkForm:o,launchExpanded:s,onLaunch:c,onCopyLaunchCommand:l,onBrandClick:u,onLogout:d,onOpenProject:f}){let p=t.filter(e=>e.hostStatus===`offline`),m=t.filter(e=>e.hostStatus!==`offline`),h=e=>(0,P.jsx)(pf,{title:e.displayName,statusLabel:`Host ${e.hostStatusLabel.toLowerCase()}`,online:e.canOpen,details:[{label:`Role`,value:e.membershipLabel},{label:`Opened`,value:e.lastOpenedLabel}],disabled:!e.canOpen||i,onClick:()=>f(e.relayProjectRef)},e.relayProjectRef);return(0,P.jsx)(gS,{onBrandClick:u,children:(0,P.jsx)(Wo,{children:(0,P.jsxs)(rf,{title:`Projects`,...e===null?{}:{accountName:e.displayName,accountAction:(0,P.jsxs)(xs,{type:`button`,onClick:d,disabled:a,children:[(0,P.jsx)(Ni,{"aria-hidden":`true`}),`Sign out`]})},"aria-label":`Project Center`,children:[(0,P.jsxs)(of,{children:[(0,P.jsx)(cf,{title:`Join a project`,description:`Paste an invitation link or the full invitation message.`,inputLabel:`Invitation link or message`,placeholder:`Paste an invitation link or message`,value:o.value,error:o.error,onValueChange:o.onChange,"aria-label":`Join a project`,onSubmit:e=>{e.preventDefault(),o.onSubmit()}}),(0,P.jsx)(lf,{title:`Launch from your computer`,description:`Open Tutti on this computer to create or manage local projects.`,actionHref:`tutti://projects`,expanded:s,statusTitle:`Opening the Tutti app…`,statusDescription:`If Tutti is not installed, copy this command and run it in Terminal:`,command:`npm install -g @xfey/tutti && tutti`,onAction:c,onCopyCommand:l,"aria-label":`Launch a project from your computer`})]}),n?(0,P.jsx)(df,{children:(0,P.jsx)(mf,{"aria-label":`Loading projects`,children:(0,P.jsx)(aa,{})})}):r===null?(0,P.jsxs)(P.Fragment,{children:[m.length===0?(0,P.jsx)(df,{children:(0,P.jsx)(mf,{"aria-label":`No available projects`,children:(0,P.jsx)(ia,{children:`No available projects`})})}):(0,P.jsx)(df,{children:m.map(h)}),p.length===0?null:(0,P.jsx)(ff,{title:`Offline Projects`,listLabel:`Offline projects`,className:`project-center-offline-projects`,children:p.map(h)})]}):(0,P.jsx)(df,{children:(0,P.jsx)(mf,{"aria-label":`Project Center error`,children:(0,P.jsx)(ia,{tone:`error`,children:r})})})]})})})}function IS({form:e,pending:t,tokenMissing:n,onChange:r}){return(0,P.jsxs)(`div`,{className:`form-stack`,children:[(0,P.jsx)(Ms,{label:`Project name`,children:(0,P.jsx)(Os,{autoComplete:`off`,disabled:t||n,type:`text`,value:e.projectName,onChange:e=>r({projectName:e.target.value}),placeholder:`tutti-default`})}),(0,P.jsx)(Ms,{label:`OpenAI API key`,children:(0,P.jsx)(Os,{autoComplete:`off`,disabled:t||n,type:`password`,value:e.apiKey,onChange:e=>r({apiKey:e.target.value}),placeholder:`sk-...`})}),(0,P.jsx)(Ms,{label:`Base URL`,children:(0,P.jsx)(Os,{autoComplete:`off`,disabled:t||n,type:`url`,value:e.baseUrl,onChange:e=>r({baseUrl:e.target.value}),placeholder:`https://api.openai.com/v1`})}),(0,P.jsx)(Ms,{label:`Default model`,children:(0,P.jsx)(Os,{autoComplete:`off`,disabled:t||n,type:`text`,value:e.defaultModel,onChange:e=>r({defaultModel:e.target.value}),placeholder:`gpt-5.5`})})]})}function LS({form:e,statusLabel:t,configured:n,loading:r,pending:i,openProjectPending:a=!1,tokenMissing:o,error:s,success:c,onChange:l,onSubmit:u,onRetry:d,onBrandClick:f}){let p=i||a;return(0,P.jsx)(_S,{label:`Project setup`,onBrandClick:f,children:(0,P.jsxs)(ef,{title:`Project setup`,description:`Configure the provider for this project.`,size:`wide`,onSubmit:u,action:o?(0,P.jsxs)(xs,{type:`button`,disabled:!0,children:[(0,P.jsx)(ta,{"aria-hidden":`true`}),`Missing token`]}):s!==null&&r?(0,P.jsx)(xs,{type:`button`,onClick:d,children:`Retry`}):a?(0,P.jsxs)(xs,{type:`button`,disabled:!0,children:[(0,P.jsx)(ai,{"aria-hidden":`true`}),`Opening project`]}):(0,P.jsxs)(bs,{type:`submit`,disabled:i||e.apiKey.trim()===``||e.projectName.trim()===``,children:[i?`Saving`:`Save provider`,(0,P.jsx)(Wi,{"aria-hidden":`true`})]}),feedback:(0,P.jsxs)(P.Fragment,{children:[c===null?null:(0,P.jsx)(ia,{icon:(0,P.jsx)(fi,{"aria-hidden":`true`}),children:c}),s===null?null:(0,P.jsx)(Ns,{children:s})]}),children:[(0,P.jsx)(tf,{projectName:`OpenAI provider`,hostLabel:t,hostOnline:n,members:(0,P.jsx)(Oi,{"aria-hidden":`true`})}),(0,P.jsx)(nf,{label:`Status`,value:r?`Loading`:t,action:n?(0,P.jsx)(fi,{"aria-hidden":`true`}):null}),(0,P.jsx)(IS,{form:e,pending:p,tokenMissing:o,onChange:l})]})})}var RS=`http://127.0.0.1:4370`;function zS(){let e=`https://tutti.now`;return typeof e==`string`?e:typeof window<`u`&&window.location.port!==`4372`?window.location.origin:RS}function BS(e){try{return new URL(e,zS()).toString()}catch{return e}}function VS({avatar:e,label:t,plain:n=!1,online:r=!1}){return(0,P.jsx)(Jo,{label:t,tone:e.color,plain:n,online:r,initials:e.initials,...e.kind===`image`?{imageUrl:BS(e.image_url)}:{}})}function HS({label:e=`Tutti`}){return(0,P.jsx)(Jo,{label:e,tone:`green`,className:`is-system`,imageUrl:iS,icon:(0,P.jsx)(si,{"aria-hidden":`true`})})}function US({tone:e}){return e===`pending`?(0,P.jsx)(ta,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(mi,{"aria-hidden":`true`}):e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):(0,P.jsx)(Mi,{"aria-hidden":`true`})}function WS({members:e}){return e===void 0||e.length===0?null:(0,P.jsx)(Yo,{"aria-label":`Members`,children:e.map(e=>(0,P.jsx)(VS,{avatar:e.avatar,label:e.displayName},e.key))})}function GS({activePage:e,statusShortcuts:t,unread:n,artifactSignal:r,mobileContext:i,children:a,onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenTimeline:f,onOpenSettings:p,onActivateStatusShortcut:m,getStatusShortcutAriaControls:h}){let g=e!==`chat`&&n?.chat===!0,_=e!==`worklist`&&n?.worklist===!0,v=r?.available===!0,y=e!==`references`&&n?.references===!0,b=e!==`skills`&&n?.skills===!0;return(0,P.jsx)(Ko,{children:(0,P.jsx)(qo,{className:`is-headerless`,sidebar:(0,P.jsxs)(Fs,{brand:(0,P.jsx)(oS,{...o===void 0?{}:{onClick:o}}),mobileTitle:i.title,...i.meta===void 0?{}:{mobileMeta:i.meta},...i.action===void 0?{}:{mobileAction:i.action},...t.length===0?{}:{status:t.map(e=>(0,N.createElement)(Rs,{icon:(0,P.jsx)(US,{tone:e.tone}),label:e.label,tone:e.tone,onClick:()=>m?.(e),...h?.(e)===void 0?{}:{"aria-controls":h(e)},key:e.key}))},footer:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(fS,{}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(Ki,{"aria-hidden":`true`}),label:`Settings`,active:e===`settings`,onClick:e===`settings`?void 0:p})]}),children:[(0,P.jsx)(Ls,{icon:(0,P.jsx)(Ay,{"aria-hidden":`true`}),label:`Chat`,active:e===`chat`,badge:g?{label:`Unread messages`}:!1,onClick:e===`chat`?void 0:s}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(ji,{"aria-hidden":`true`}),label:`Worklist`,active:e===`worklist`,badge:_?{label:`Unread worklist updates`}:!1,onClick:e===`worklist`?void 0:c}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(Li,{"aria-hidden":`true`}),label:`Artifacts`,active:e===`artifacts`,badge:v?{label:`Artifacts available`,text:`Live`,variant:`pill`}:!1,onClick:e===`artifacts`?void 0:u}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(Si,{"aria-hidden":`true`}),label:`References`,active:e===`references`,badge:y?{label:`New reference files`}:!1,onClick:e===`references`?void 0:l}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(Yi,{"aria-hidden":`true`}),label:`Skills`,active:e===`skills`,badge:b?{label:`New skill updates`}:!1,onClick:e===`skills`?void 0:d}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(ci,{"aria-hidden":`true`}),label:`Timeline`,active:e===`timeline`,onClick:e===`timeline`?void 0:f})]}),children:a})})}function KS(){return(0,P.jsx)(Es,{src:rS,className:`empty-state-brand-logo`})}function qS(e){return(0,P.jsx)(ia,{watermark:(0,P.jsx)(KS,{}),...e})}var JS=`tutti.execution-score-themes.v1`,YS=40,XS={assignments:[],bag:[]};function ZS(){return{assignments:[],bag:[]}}function QS(){try{return typeof window>`u`?null:window.sessionStorage}catch{return null}}function $S(e,t){if(typeof e!=`object`||!e)return null;let n=e;if(!Array.isArray(n.assignments)||!Array.isArray(n.bag))return null;let r=n.assignments.filter(e=>typeof e==`object`&&!!e&&typeof e.identity==`string`&&t.has(String(e.themeId))),i=n.bag.filter(e=>typeof e==`string`&&t.has(e)),a=typeof n.recent==`string`&&t.has(n.recent)?n.recent:void 0;return{assignments:r,bag:i,...a===void 0?{}:{recent:a}}}function eC(e,t){if(e===null)return XS;try{let n=e.getItem(JS);return n===null?ZS():$S(JSON.parse(n),t)??ZS()}catch{return XS}}function tC(e,t){if(XS=t,e!==null)try{e.setItem(JS,JSON.stringify(t))}catch{}}function nC(e,t,n){let r=e.map(e=>e.id);for(let e=r.length-1;e>0;--e){let t=Math.min(e,Math.max(0,Math.floor(n()*(e+1))));[r[e],r[t]]=[r[t],r[e]]}if(r.length>1&&r[0]===t){let e=r.findIndex(e=>e!==t);[r[0],r[e]]=[r[e],r[0]]}return r}function rC(e,t={}){let n=t.themes??Bo;if(n.length===0)throw Error(`Execution score themes are unavailable`);let r=new Map(n.map(e=>[e.id,e])),i=new Set(r.keys()),a=t.storage===void 0?QS():t.storage,o=eC(a,i),s=o.assignments.find(t=>t.identity===e),c=s===void 0?void 0:r.get(s.themeId);if(c!==void 0)return c;let l=t.random??Math.random,u=o.bag.length>0?[...o.bag]:nC(n,o.recent,l),d=u.shift(),f=d===void 0?void 0:r.get(d);if(f===void 0)throw Error(`Execution score themes are unavailable`);return tC(a,{assignments:[...o.assignments,{identity:e,themeId:f.id}].slice(-YS),bag:u,recent:f.id}),f}function iC(e){return`round-card-${e}`}function aC(e){return`approval-card-${e}`}function oC(e){return`chat-message-${e}`}var sC=`workspace-scratchpad`,cC=720,lC=80,uC=160,dC=96,fC=160,pC=2;function mC(e){return e.completionSource?.activityRef??e.completionSource?.workflowRef??e.completionSource?.taskId??e.key}function hC({progress:e}){let t=mC(e),[n]=(0,N.useState)(()=>rC(t)),r=(0,N.useRef)(t),i=(0,N.useRef)(e.tone),[a,o]=(0,N.useState)(null);if((0,N.useEffect)(()=>{let n=r.current,a=i.current;if(r.current=t,i.current=e.tone,e.tone!==`running`||a===`pending`||n===t){o(null);return}o(t);let s=window.setTimeout(()=>{o(e=>e===t?null:e)},cC);return()=>{window.clearTimeout(s)}},[e.tone,t]),e.tone===`running`||e.tone===`pending`||e.tone===`complete`){let r=e.tone===`running`&&a===t,i=e.steps.find(e=>e.status===`running`||e.status===`pending`)??e.steps.at(-1),o=e.completionTarget?.kind===`task`?`Task completed`:`Procedure completed`,s=e.tone===`complete`?void 0:i?.detail??(e.tone===`pending`?e.summary:void 0),c=e.tone===`complete`?void 0:i?.elapsedLabel,l=e.tone===`complete`?void 0:i?.metrics;return(0,P.jsx)(So,{stageLabel:r?`Loading the next movement…`:e.tone===`complete`?o:i?.label??e.summary,...r||s===void 0?{}:{stageDetail:s},...r||c===void 0?{}:{elapsedLabel:c},...r||l===void 0?{}:{metrics:l},scoreLabel:r?`Loading the next movement score`:e.tone===`complete`?`${o} score cadence`:e.tone===`pending`?`Execution score paused while waiting for input`:`${i?.label??`Execution`} running score using ${n.shortName}`,state:r?`handoff`:e.tone===`complete`?`complete`:e.tone===`pending`?`paused`:`running`,units:n.units,playbackBpm:n.tempo,openingClef:n.clef,keySignatureFifths:n.keySignatureFifths,timeSignature:n.meter})}return(0,P.jsx)(ib,{title:e.title,summary:e.summary,tone:e.tone,steps:e.steps,...e.metaLabel===void 0?{}:{metaLabel:e.metaLabel}})}function gC(e){if(e===void 0)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function _C(e,t){if(e===null)return null;let n=gC(e.requestedAt);if(n===null)return t.length;let r=t.findIndex(e=>{let t=gC(e.createdAt);return t!==null&&t>n});return r===-1?t.length:r}function vC(e,{focusSelector:t}={}){let n=typeof document>`u`?null:document.getElementById(e);n!==null&&(n.scrollIntoView({block:`center`}),t!==void 0&&n.querySelector(t)?.focus({preventScroll:!0}))}function yC(e){return e.messageKind===`system_notice`&&e.workflowRef!==void 0&&(e.body.startsWith(`Worklist updated with `)||e.body===`Worklist is already covered by existing tasks.`)}function bC(e,t){if(t===void 0)return;let n=t.label.trim(),r=t.handle?.trim()??n;if(n===``||r===``)return;let i=r.toLocaleLowerCase();e.has(i)||e.set(i,{id:t.id,label:n,handle:r})}function xC({members:e,messages:t,clarificationMessagesByRoundId:n}){let r=new Map;bC(r,{id:`tutti`,label:`Tutti`,handle:`tutti`});for(let t of e)bC(r,{id:t.key,label:t.displayName});for(let e of t)bC(r,{id:`message:${e.author}`,label:e.author,...e.avatarKind===`tutti`?{handle:`tutti`}:{}});for(let e of Object.values(n))for(let t of e)bC(r,{id:`round-message:${t.author}`,label:t.author,...t.avatarKind===`tutti`?{handle:`tutti`}:{}});return[...r.values()]}function SC({message:e}){return e.avatarKind===`tutti`?(0,P.jsx)(HS,{label:e.author}):(0,P.jsx)(VS,{avatar:e.avatar??{kind:`initials`,initials:dr(e.author),color:`blue`},label:e.author,online:e.online})}function CC({projectName:e,projectDescription:t=``,members:n,messages:r,scratchpad:i,executionProgress:a=null,activeApproval:o=null,activeClarification:s,clarificationMessagesByRoundId:c,statusShortcuts:l,unread:u,artifactSignal:d,draft:f,roundDraft:p,sendPending:m,scratchpadSyncPending:h=!1,scratchpadActionsDisabled:g=!1,scratchpadSubmitPending:_=!1,referenceUploadPending:v=!1,focusMessageId:y=null,messageHistoryIdentity:b=`latest`,initialMessagePosition:x=y===null?`latest`:`focus`,hasOlderMessages:S=!1,hasNewerMessages:C=!1,loadingOlderMessages:w=!1,loadingNewerMessages:T=!1,historyConnectedToLatest:E=!0,roundSendPending:ee=!1,roundSubmitPending:D=!1,submittedRoundId:O=null,approvalDecisionPending:k=!1,projectNameSaving:te=!1,projectDescriptionSaving:ne=!1,loading:A=!1,unavailable:re=!1,onDraftChange:ie,onMessageFocused:j,onInitialMessagePositioned:M,onLoadOlderMessages:ae,onLoadNewerMessages:oe,onJumpToLatest:se,onUploadReferenceFile:ce,onOpenReferenceFile:le,onRoundDraftChange:ue,onSendMessage:de,onSendRoundMessage:fe,onSubmitRound:pe,onDecideApproval:me,onSubmitScratchpad:he,onUpdateProjectDisplayName:ge,onUpdateProjectDescription:_e,onOpenProjectCenter:ve,onOpenWorklist:ye,onOpenWorklistTask:be,onOpenReferences:xe,onOpenArtifacts:Se,onOpenSkills:Ce,onOpenTimeline:we,onOpenSettings:Te,onActivateStatusShortcut:Ee}){let[De,Oe]=(0,N.useState)(!1),ke=(0,N.useRef)(null),Ae=(0,N.useRef)(!1),je=(0,N.useRef)(null),Me=(0,N.useRef)(null),Ne=(0,N.useRef)(!0),Pe=(0,N.useRef)(void 0),Fe=(0,N.useRef)(b),Ie=(0,N.useRef)(null),Le=(0,P.jsx)(Ky,{className:`chat-project-title-edit`,value:e,placeholder:`Untitled project`,ariaLabel:`Edit project name`,maxLength:lC,saving:te,disabled:A,...ge===void 0?{}:{onUpdate:ge}}),Re=(0,P.jsx)(Ky,{className:`chat-project-description-edit`,value:t,placeholder:`Add a project description`,ariaLabel:`Edit project description`,maxLength:uC,allowEmpty:!0,saving:ne,disabled:A,..._e===void 0?{}:{onUpdate:_e}}),ze=s!==null&&r.some(e=>e.id===s.cardMessageId),Be=new Map;for(let e of r)e.clarificationCard!==void 0&&e.workflowRef!==void 0&&Be.set(e.workflowRef,e.clarificationCard.roundId);let Ve=new Map;for(let e of r){if(!yC(e)||e.workflowRef===void 0)continue;let t=Be.get(e.workflowRef);t!==void 0&&Ve.set(t,{...e,id:`round-result:${e.id}`,messageKind:`agent_text`,author:`Tutti`,avatarKind:`tutti`,online:!1})}let He=e=>{let t=c[e]??[],n=Ve.get(e);return n===void 0||t.some(e=>e.body===n.body)?t:[...t,n]},Ue=xC({members:n,messages:r,clarificationMessagesByRoundId:c}),We=ce===void 0?void 0:e=>{for(let t of e)ce(t)};(0,N.useLayoutEffect)(()=>{Fe.current!==b&&(Fe.current=b,Ae.current=!1,je.current=null,Pe.current=void 0)},[b]),(0,N.useLayoutEffect)(()=>{let e=je.current;if(e!==null){if(r[0]?.id!==e.firstMessageId){let t=ke.current;t!==null&&(t.scrollTop=e.scrollTop+Math.max(0,t.scrollHeight-e.scrollHeight),Ne.current=t.scrollHeight-t.clientHeight-t.scrollTop<=pC),je.current=null;return}w||(je.current=null)}},[w,r]),(0,N.useEffect)(()=>{if(y===null||!r.some(e=>e.id===y))return;Ae.current=!0,vC(oC(y));let e=ke.current;e!==null&&(Ne.current=e.scrollHeight-e.clientHeight-e.scrollTop<=pC),j?.()},[y,r,j]),(0,N.useEffect)(()=>{if(Ae.current||A||re||x!==`latest`||y!==null||r.length===0&&s===null&&o===null)return;let e=ke.current;if(e===null)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight,Ne.current=!0,Ae.current=!0});return()=>window.cancelAnimationFrame(t)},[o,s,y,A,r,re]),(0,N.useEffect)(()=>{if(Ae.current||A||re||x!==`start`||y!==null)return;let e=ke.current;if(e===null)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=0,Ne.current=e.scrollHeight<=e.clientHeight+pC,Ae.current=!0,M?.()});return()=>window.cancelAnimationFrame(t)},[y,x,A,r,M,re]);let Ge=()=>{if(!S||w||je.current!==null||ae===void 0)return;let e=ke.current;e!==null&&(je.current={firstMessageId:r[0]?.id,scrollHeight:e.scrollHeight,scrollTop:e.scrollTop},ae())},Ke=()=>{!C||T||oe===void 0||oe()},qe=e=>{let t=e.currentTarget;Ne.current=t.scrollHeight-t.clientHeight-t.scrollTop<=pC,Me.current!==null&&window.cancelAnimationFrame(Me.current),Me.current=window.requestAnimationFrame(()=>{if(Me.current=null,t.scrollTop<=dC){Ge();return}t.scrollHeight-t.clientHeight-t.scrollTop<=fC&&Ke()})};(0,N.useEffect)(()=>()=>{Me.current!==null&&window.cancelAnimationFrame(Me.current)},[]),(0,N.useEffect)(()=>{if(A||re||w||T||!Ae.current)return;let e=ke.current;if(e===null||e.scrollHeight>e.clientHeight+pC)return;let t=window.requestAnimationFrame(()=>{S?Ge():C&&Ke()});return()=>window.cancelAnimationFrame(t)},[C,S,A,T,w,r,re]);let Je=r.at(-1)?.id;(0,N.useEffect)(()=>{let e=Pe.current;if(Pe.current=Je,e===void 0||e===Je||!E||!Ne.current||!Ae.current||je.current!==null)return;let t=ke.current;if(t===null)return;let n=window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight,Ne.current=!0});return()=>window.cancelAnimationFrame(n)},[E,Je]);let Ye=({key:e,roundId:t,title:n,summary:r,request:i,contextLabel:a,writable:o})=>{let s=He(t),c=s.filter(e=>e.messageKind===`user_text`).length;return(0,P.jsx)(fb,{id:iC(t),tabIndex:-1,title:n,summary:r,request:i,...a===void 0?{}:{contextLabel:a},messages:s.map(e=>({id:e.id,author:e.author,body:e.body,time:e.time,avatar:(0,P.jsx)(SC,{message:e})})),replyCount:c,draft:o?p:``,defaultOpen:!0,readOnly:!o,status:o?`pending`:`done`,statusLabel:o?`needs input`:`submitted`,mentionOptions:Ue,sendPending:o&&ee,submitPending:o&&D,onDraftChange:ue,onSendMessage:fe,onSubmitRound:pe},`${e}:${o?`writable`:`sealed`}`)},Xe=e=>{if(e.target.kind===`approval`&&o!==null){if(!E){Ie.current=e,se?.();return}vC(aC(o.approvalId),{focusSelector:`.chat-event-card-header`});return}if(e.target.kind===`clarification`&&s!==null){if(!E&&!ze){Ie.current=e,se?.();return}vC(iC(s.roundId),{focusSelector:`.chat-event-card-header`});return}if(e.target.kind===`scratchpad`){vC(sC);return}Ee?.(e)};(0,N.useEffect)(()=>{let e=Ie.current;if(!E||A||e===null)return;Ie.current=null;let t=window.requestAnimationFrame(()=>{e.target.kind===`approval`&&o!==null?vC(aC(o.approvalId),{focusSelector:`.chat-event-card-header`}):e.target.kind===`clarification`&&s!==null&&vC(iC(s.roundId),{focusSelector:`.chat-event-card-header`})});return()=>window.cancelAnimationFrame(t)},[o,s,E,A,r]);let Ze=e=>s===null?null:Ye({key:e,roundId:s.roundId,title:s.title,summary:s.summary,request:s.request,contextLabel:s.ownerLabel,writable:s.status===`writable`&&s.roundId!==O}),Qe=()=>o===null?null:(0,P.jsx)(gb,{id:aC(o.approvalId),tabIndex:-1,title:o.title,summary:o.summary,...o.reason===void 0?{}:{reason:o.reason},...o.detail===void 0?{}:{detail:o.detail,...o.detailLabel===void 0?{}:{detailLabel:o.detailLabel},...o.detailCode===void 0?{}:{detailCode:o.detailCode}},status:o.status,statusLabel:o.statusLabel,decisions:o.decisions,decisionPending:k,...o.resolutionLabel===void 0?{}:{resolutionLabel:o.resolutionLabel},onDecide:e=>me?.(o.approvalId,e)},`approval:${o.approvalId}:${o.status}`),$e=e=>{let t=e.clarificationCard;if(t===void 0)return null;let n=s!==null&&s.roundId===t.roundId;return Ye({key:e.id,roundId:t.roundId,title:n&&s!==null?s.title:t.title??`Clarification round ${t.roundId.slice(-4)}`,summary:n&&s!==null?s.summary:t.summary,request:n&&s!==null?s.request:t.summary,...n&&s!==null?{contextLabel:s.ownerLabel}:{},writable:n&&t.status===`writable`&&t.roundId!==O})},et=e=>{if(yC(e)&&Be.has(e.workflowRef??``))return null;if(e.messageKind===`clarification_card`)return $e(e);if(s!==null&&e.id===s.cardMessageId)return Ze(e.id);if(e.taskResult!==void 0)return(0,P.jsx)(_b,{id:oC(e.id),tabIndex:-1,className:e.id===y?`is-focused`:void 0,title:e.taskResult.title,status:e.taskResult.status,taskId:e.taskResult.taskId,taskTitle:e.taskResult.taskTitle,summary:e.taskResult.summary,...e.taskResult.moduleName===void 0?{}:{moduleName:e.taskResult.moduleName},...e.taskResult.finalNote===void 0?{}:{finalNote:e.taskResult.finalNote},...e.taskResult.generatedFiles===void 0?{}:{generatedFiles:e.taskResult.generatedFiles},...e.taskResult.errorCode===void 0?{}:{errorCode:e.taskResult.errorCode},...be===void 0?{}:{onOpenTask:be}},e.id);let t=e.referenceFile;return(0,P.jsx)(jy,{id:oC(e.id),tabIndex:-1,author:e.author,time:e.time,avatar:(0,P.jsx)(SC,{message:e}),className:e.id===y?`is-focused`:void 0,children:t===void 0?e.messageKind===`agent_text`?(0,P.jsx)(My,{children:e.body}):(0,P.jsx)(`p`,{children:(0,P.jsx)(Oy,{children:e.body})}):(0,P.jsx)(Wy,{name:t.name,category:t.category,...t.imageUrl===void 0?{}:{imageUrl:t.imageUrl},onClick:()=>le?.(t.path)})},e.id)},tt=E?_C(o,r):null,nt=()=>{let e=s!==null&&(ze||E)||o!==null&&E;return r.length===0&&!e&&!w&&!T?(0,P.jsx)(qS,{children:`No messages yet`}):(0,P.jsxs)(P.Fragment,{children:[w?(0,P.jsx)(`div`,{className:`chat-history-status`,role:`status`,children:`Loading earlier messages…`}):null,!E||ze?null:Ze(`active-round`),r.map((e,t)=>(0,P.jsxs)(N.Fragment,{children:[tt===t?Qe():null,et(e)]},`timeline:${e.id}`)),tt===r.length?Qe():null,T?(0,P.jsx)(`div`,{className:`chat-history-status`,role:`status`,children:`Loading newer messages…`}):null]})},rt=(e,t=!1)=>(0,P.jsx)(eb,{id:e,tabIndex:-1,compact:t,title:i.title,summary:i.summary,sections:i.sections,submitAvailable:i.submitAvailable,...i.pages===void 0?{}:{pages:i.pages},...i.footerNote===void 0?{}:{footerNote:i.footerNote},...i.updatedLabelPrefix===void 0?{}:{updatedLabelPrefix:i.updatedLabelPrefix},syncPending:h,actionsDisabled:g,submitPending:_,onSubmitScratchpad:he,...be===void 0?{}:{onOpenCompiledTask:be},empty:(0,P.jsx)(qS,{children:`Scratchpad empty. Discuss more, tutti together!`}),...i.updatedLabel===void 0?{}:{updatedLabel:i.updatedLabel}}),it=(0,P.jsx)(`div`,{className:`chat-panel-actions`,children:(0,P.jsx)(WS,{members:n})});return(0,P.jsxs)(GS,{activePage:`chat`,statusShortcuts:l,mobileContext:{title:e,action:(0,P.jsx)(Ls,{className:h?`mobile-scratchpad-trigger is-syncing`:`mobile-scratchpad-trigger`,type:`button`,label:De?`Close Scratchpad`:`Open Scratchpad`,active:De,"aria-expanded":De,"aria-controls":`${sC}-mobile-sheet`,icon:(0,P.jsx)(Xy,{"aria-hidden":`true`}),onClick:()=>Oe(e=>!e)})},...u===void 0?{}:{unread:u},...d===void 0?{}:{artifactSignal:d},onOpenProjectCenter:ve,onOpenWorklist:ye,onOpenReferences:xe,onOpenArtifacts:Se,onOpenSkills:Ce,onOpenTimeline:we,onOpenSettings:Te,onActivateStatusShortcut:Xe,getStatusShortcutAriaControls:e=>e.target.kind===`approval`&&o!==null&&E?aC(o.approvalId):e.target.kind===`clarification`&&s!==null&&(E||ze)?iC(s.roundId):e.target.kind===`scratchpad`?sC:void 0,children:[(0,P.jsxs)(`section`,{className:`workspace-grid is-tutti chat-workspace-grid`,"aria-label":`Chat workspace`,children:[A?(0,P.jsx)(Gy,{title:Le,subtitle:Re,actions:it,children:(0,P.jsx)(aa,{})}):re?(0,P.jsx)(Gy,{title:Le,subtitle:Re,actions:it,children:(0,P.jsx)(qS,{children:`Workspace unavailable`})}):(0,P.jsx)(Gy,{title:Le,subtitle:Re,actions:it,streamRef:ke,onStreamScroll:qe,streamOverlay:C&&se!==void 0?(0,P.jsx)(xs,{className:`chat-jump-latest`,type:`button`,onClick:se,children:`Jump to latest`}):void 0,dropUploadPending:v,...We===void 0?{}:{onDropFiles:We},composer:(0,P.jsx)(Yy,{value:f,pending:m,uploadPending:v,mentionOptions:Ue,onValueChange:ie,onComposerSubmit:de,...ce===void 0?{}:{onFileUpload:ce}}),empty:(0,P.jsx)(qS,{children:`No messages yet`}),children:nt()}),(0,P.jsxs)(`div`,{className:a===null?`chat-side-column`:`chat-side-column has-progress`,children:[rt(sC),a===null?null:(0,P.jsx)(hC,{progress:a})]})]}),De?(0,P.jsxs)(`div`,{className:`mobile-scratchpad-layer is-open`,id:`${sC}-mobile-sheet`,children:[(0,P.jsx)(`button`,{className:`mobile-scratchpad-backdrop`,type:`button`,"aria-label":`Close Scratchpad`,onClick:()=>Oe(!1)}),(0,P.jsxs)(`section`,{className:`mobile-scratchpad-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`Scratchpad`,children:[(0,P.jsxs)(`div`,{className:`mobile-scratchpad-card-head`,children:[(0,P.jsx)(`h2`,{children:`Scratchpad`}),(0,P.jsx)(ys,{className:`mobile-scratchpad-close`,type:`button`,label:`Close Scratchpad`,icon:(0,P.jsx)(ra,{"aria-hidden":`true`}),onClick:()=>Oe(!1)})]}),(0,P.jsx)(`div`,{className:`mobile-scratchpad-card-body`,children:rt(`${sC}-mobile`,!0)})]})]}):null]})}function wC({statusShortcuts:e,unread:t,artifactSignal:n,state:r,loading:i=!1,unavailable:a=!1,onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenSkills:u,onOpenTimeline:d,onOpenSettings:f,onActivateStatusShortcut:p}){let m=i?{status:`loading`}:a?{status:`not_declared`}:r;return(0,P.jsx)(GS,{activePage:`artifacts`,statusShortcuts:e,mobileContext:{title:m.status===`declared`?m.title:`Artifacts`},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenSkills:u,onOpenTimeline:d,onOpenSettings:f,onActivateStatusShortcut:p,children:(0,P.jsx)(`section`,{className:`workspace-grid artifacts-workspace-grid`,"aria-label":`Artifacts`,children:(0,P.jsx)(Nb,{state:m,...a?{empty:(0,P.jsx)(qS,{children:`Workspace unavailable`})}:{},emptyWatermark:(0,P.jsx)(KS,{})})})})}function TC({statusShortcuts:e,unread:t,artifactSignal:n,files:r,detail:i,uploadPending:a=!1,fileSortMode:o=`time`,loading:s=!1,unavailable:c=!1,onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,onSelectFile:_,onUploadFile:v,onFileSortModeChange:y}){let b=s||c;return(0,P.jsx)(GS,{activePage:`references`,statusShortcuts:e,mobileContext:{title:`References`,action:(0,P.jsx)(Jy,{variant:`bare`,className:`sidebar-button reference-upload-button`,label:`Upload reference`,pendingLabel:`Uploading reference`,pending:a,iconOnly:!0,onFileUpload:v})},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,children:(0,P.jsx)(`section`,{className:`workspace-grid references-workspace-grid`,"aria-label":`Reference files`,children:(0,P.jsx)(Ab,{files:b?[]:r,...s?{detail:{title:`Loading`,unavailableReason:`Loading`}}:c?{detail:{title:`References unavailable`,unavailableReason:`Workspace unavailable`}}:i===void 0?{}:{detail:i},uploadPending:a,fileSortMode:o,empty:s?(0,P.jsx)(qS,{children:`Loading reference files`}):c?(0,P.jsx)(qS,{children:`Workspace unavailable`}):(0,P.jsx)(qS,{children:`No reference files`}),onSelectFile:_,onUploadFile:v,...y===void 0?{}:{onFileSortModeChange:y}})})})}var EC=6,DC=`......`,OC=80,kC=160;function AC(e){let t=document.createElement(`canvas`).getContext(`2d`);if(t===null)return null;let n=window.getComputedStyle(e);return t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(` `),e=>t.measureText(e).width}function jC(e,t,n){if(n(e)<=t)return e;let r=e.slice(-EC),i=Math.max(0,e.length-r.length),a=0,o=i;for(;a<o;){let i=Math.ceil((a+o)/2);n(`${e.slice(0,i)}${DC}${r}`)<=t?a=i:o=i-1}return`${e.slice(0,a)}${DC}${r}`}function MC({value:e}){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(e);return(0,N.useEffect)(()=>{let n=t.current;if(n===null)return;let i=()=>{let t=AC(n),i=n.getBoundingClientRect().width;if(t===null||i<=0){r(e);return}let a=jC(e,i,t);r(e=>e===a?e:a)};i();let a=typeof ResizeObserver>`u`?null:new ResizeObserver(i);return a?.observe(n),window.addEventListener(`resize`,i),()=>{a?.disconnect(),window.removeEventListener(`resize`,i)}},[e]),(0,P.jsx)(`code`,{ref:t,className:`settings-masked-link`,title:e,"aria-label":e,children:n})}function NC({value:e,onCopy:t}){return t===void 0?(0,P.jsx)(MC,{value:e}):(0,P.jsx)(`button`,{className:`settings-value-button settings-link-copy-button`,type:`button`,"aria-label":`Copy invite link`,onClick:t,children:(0,P.jsx)(MC,{value:e})})}function PC(e,t){return e.map(e=>({id:e.id,title:e.title,rows:e.rows.map(e=>({label:e.label,value:e.identity===!0?(0,P.jsxs)(`div`,{className:`settings-identity`,children:[(0,P.jsx)(VS,{avatar:t.currentMember.avatar,label:t.currentMember.displayName}),(0,P.jsx)(`strong`,{children:t.currentMember.displayName})]}):e.value,...e.identity===!0?{plain:!0}:{},...e.code===void 0?{}:{code:e.code}}))}))}function FC({settings:e,onCopyJoinUrl:t}){let n=e.invite;return n===void 0?null:{label:`invite link`,value:n.joinUrl===void 0?`not recoverable`:(0,P.jsx)(NC,{value:n.joinUrl,onCopy:t}),...n.joinUrl===void 0?{}:{plain:!0}}}function IC({settings:e,statusShortcuts:t,unread:n,artifactSignal:r,loading:i=!1,unavailable:a=!1,projectNameSaving:o=!1,projectDescriptionSaving:s=!1,onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onActivateStatusShortcut:h,onCopyJoinUrl:g,onUpdateProjectDisplayName:_,onUpdateProjectDescription:v}){let y=e?.statuses??[],b=e===void 0?null:FC({settings:e,onCopyJoinUrl:g});return(0,P.jsx)(GS,{activePage:`settings`,statusShortcuts:t,mobileContext:{title:`Settings`},...n===void 0?{}:{unread:n},...r===void 0?{}:{artifactSignal:r},onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onActivateStatusShortcut:h,children:(0,P.jsx)(`section`,{className:`workspace-grid settings-workspace-grid`,"aria-label":`Project settings`,children:(0,P.jsx)(`div`,{className:`settings-page-grid`,children:i?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Loading settings`,children:(0,P.jsx)(qS,{children:`Loading settings`})}):a?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Settings unavailable`,children:(0,P.jsx)(qS,{children:`Workspace unavailable`})}):e===void 0?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Settings unavailable`,children:(0,P.jsx)(qS,{children:`Settings unavailable`})}):(0,P.jsx)(Tb,{statuses:y,sections:[{id:`settings-project`,title:`Project`,rows:[{label:`display_name`,plain:!0,value:(0,P.jsx)(Ky,{value:e.project.displayName,placeholder:`Untitled project`,ariaLabel:`Project display name`,maxLength:OC,saving:o,..._===void 0?{}:{onUpdate:_}})},{label:`description`,plain:!0,value:(0,P.jsx)(Ky,{value:e.project.description,placeholder:`Add a project description`,ariaLabel:`Project description`,maxLength:kC,allowEmpty:!0,saving:s,...v===void 0?{}:{onUpdate:v}})},...b===null?[]:[b]]},...PC(e.sections,e)]})})})})}var LC=[{title:`Awesome GitHub Copilot Skills`,href:`https://awesome-copilot.github.com/skills/`},{title:`Anthropic official skills`,href:`https://github.com/anthropics/skills`},{title:`Claude Skills Marketplace`,href:`https://claudeskills.info/skills/`}];function RC({statusShortcuts:e,unread:t,artifactSignal:n,skills:r,detail:i,uploadPending:a=!1,deletePending:o=!1,loading:s=!1,unavailable:c=!1,onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenReferences:f,onOpenArtifacts:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,onSelectSkill:_,onUploadSkill:v,onDeleteSkill:y}){let b=s||c;return(0,P.jsx)(GS,{activePage:`skills`,statusShortcuts:e,mobileContext:{title:`Skills`,action:(0,P.jsx)(Jy,{variant:`bare`,className:`sidebar-button reference-upload-button`,label:`Upload skill`,pendingLabel:`Uploading skill`,pending:a,accept:`.zip,application/zip,application/x-zip-compressed`,iconOnly:!0,onFileUpload:v})},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenReferences:f,onOpenArtifacts:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,children:(0,P.jsx)(`section`,{className:`workspace-grid references-workspace-grid`,"aria-label":`Skills`,children:(0,P.jsx)(Fb,{skills:b?[]:r,communityLinks:b?[]:LC,...s?{detail:{title:`Loading`,unavailableReason:`Loading`}}:c?{detail:{title:`Skills unavailable`,unavailableReason:`Workspace unavailable`}}:i===void 0?{}:{detail:i},uploadPending:a,deletePending:o,empty:s?(0,P.jsx)(qS,{children:`Loading skills`}):c?(0,P.jsx)(qS,{children:`Workspace unavailable`}):(0,P.jsx)(qS,{children:`No skills`}),onSelectSkill:_,onUploadSkill:v,onDeleteSkill:y})})})}function zC({timeline:e,statusShortcuts:t,unread:n,artifactSignal:r,loading:i=!1,unavailable:a=!1,onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenSettings:f,onActivateStatusShortcut:p}){return(0,P.jsx)(GS,{activePage:`timeline`,statusShortcuts:t,mobileContext:{title:`Timeline`},...n===void 0?{}:{unread:n},...r===void 0?{}:{artifactSignal:r},onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenSettings:f,onActivateStatusShortcut:p,children:(0,P.jsx)(`section`,{className:`workspace-grid timeline-workspace-grid`,"aria-label":`Timeline workspace`,children:i?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Loading timeline`,children:(0,P.jsx)(qS,{children:`Loading timeline`})}):a?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Timeline unavailable`,children:(0,P.jsx)(qS,{children:`Workspace unavailable`})}):e===void 0?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Timeline unavailable`,children:(0,P.jsx)(qS,{children:`Timeline unavailable`})}):(0,P.jsx)(Xb,{tokenOverview:e.tokenOverview,items:e.items,scoreUnits:e.scoreUnits,empty:(0,P.jsx)(qS,{children:`No timeline events yet`})})})})}function BC({statusShortcuts:e,unread:t,artifactSignal:n,modules:r,taskCount:i,detail:a,missingTaskId:o,runNote:s,loading:c=!1,unavailable:l=!1,onOpenProjectCenter:u,onOpenChat:d,onOpenReferences:f,onOpenArtifacts:p,onOpenSkills:m,onOpenTimeline:h,onOpenSettings:g,onActivateStatusShortcut:_,onSelectTask:v}){return(0,P.jsx)(GS,{activePage:`worklist`,statusShortcuts:e,mobileContext:{title:`Worklist`,meta:i===1?`1 task`:`${i} tasks`},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:u,onOpenChat:d,onOpenReferences:f,onOpenArtifacts:p,onOpenSkills:m,onOpenTimeline:h,onOpenSettings:g,onActivateStatusShortcut:_,children:(0,P.jsx)(`section`,{className:`workspace-grid worklist-workspace-grid`,"aria-label":`Worklist workspace`,children:c?(0,P.jsx)(`section`,{className:`panel tasks worklist-page-panel`,"aria-label":`Loading Worklist`,children:(0,P.jsx)(qS,{children:`Loading Worklist`})}):l?(0,P.jsx)(`section`,{className:`panel tasks worklist-page-panel`,"aria-label":`Worklist unavailable`,children:(0,P.jsx)(qS,{children:`Workspace unavailable`})}):(0,P.jsx)(wb,{modules:r,taskCount:i,...a===void 0?{}:{detail:a},...o===void 0?{}:{missingTaskId:o},...s==null?{}:{runNote:s},onSelectTask:v,empty:(0,P.jsx)(qS,{children:`No compiled tasks`})})})})}function VC(e){return XC(e)&&!HC(e)&&!ew(e)&&Symbol.asyncIterator in e}function HC(e){return Array.isArray(e)}function UC(e){return typeof e==`bigint`}function WC(e){return typeof e==`boolean`}function GC(e){return e instanceof globalThis.Date}function KC(e){return typeof e==`function`}function qC(e){return XC(e)&&!HC(e)&&!ew(e)&&Symbol.iterator in e}function JC(e){return e===null}function YC(e){return typeof e==`number`}function XC(e){return typeof e==`object`&&!!e}function ZC(e){return e instanceof globalThis.RegExp}function QC(e){return typeof e==`string`}function $C(e){return typeof e==`symbol`}function ew(e){return e instanceof globalThis.Uint8Array}function tw(e){return e===void 0}function nw(e){return e.map(e=>sw(e))}function rw(e){return new Date(e.getTime())}function iw(e){return new Uint8Array(e)}function aw(e){return new RegExp(e.source,e.flags)}function ow(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=sw(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=sw(e[n]);return t}function sw(e){return HC(e)?nw(e):GC(e)?rw(e):ew(e)?iw(e):ZC(e)?aw(e):XC(e)?ow(e):e}function cw(e){return sw(e)}function lw(e,t){return cw(t===void 0?e:{...t,...e})}function uw(e){return typeof e==`object`&&!!e}function dw(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function fw(e){return e===void 0}function pw(e){return typeof e==`number`}var mw;(function(e){e.InstanceMode=`default`,e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(t,n){return e.ExactOptionalPropertyTypes?n in t:t[n]!==void 0}e.IsExactOptionalProperty=t;function n(t){let n=uw(t);return e.AllowArrayObject?n:n&&!dw(t)}e.IsObjectLike=n;function r(e){return n(e)&&!(e instanceof Date)&&!(e instanceof Uint8Array)}e.IsRecordLike=r;function i(t){return e.AllowNaN?pw(t):Number.isFinite(t)}e.IsNumberLike=i;function a(t){let n=fw(t);return e.AllowNullVoid?n||t===null:n}e.IsVoidLike=a})(mw||={});function hw(e){return globalThis.Object.freeze(e).map(e=>bw(e))}function gw(e){return e}function _w(e){return e}function vw(e){return e}function yw(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=bw(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=bw(e[n]);return globalThis.Object.freeze(t)}function bw(e){return HC(e)?hw(e):GC(e)?gw(e):ew(e)?_w(e):ZC(e)?vw(e):XC(e)?yw(e):e}function K(e,t){let n=t===void 0?e:{...t,...e};switch(mw.InstanceMode){case`freeze`:return bw(n);case`clone`:return cw(n);default:return n}}var xw=class extends Error{constructor(e){super(e)}},Sw=Symbol.for(`TypeBox.Transform`),Cw=Symbol.for(`TypeBox.Readonly`),ww=Symbol.for(`TypeBox.Optional`),Tw=Symbol.for(`TypeBox.Hint`),q=Symbol.for(`TypeBox.Kind`);function Ew(e){return XC(e)&&e[Cw]===`Readonly`}function Dw(e){return XC(e)&&e[ww]===`Optional`}function Ow(e){return Vw(e,`Any`)}function kw(e){return Vw(e,`Argument`)}function Aw(e){return Vw(e,`Array`)}function jw(e){return Vw(e,`AsyncIterator`)}function Mw(e){return Vw(e,`BigInt`)}function Nw(e){return Vw(e,`Boolean`)}function Pw(e){return Vw(e,`Computed`)}function Fw(e){return Vw(e,`Constructor`)}function Iw(e){return Vw(e,`Date`)}function Lw(e){return Vw(e,`Function`)}function Rw(e){return Vw(e,`Integer`)}function zw(e){return Vw(e,`Intersect`)}function Bw(e){return Vw(e,`Iterator`)}function Vw(e,t){return XC(e)&&q in e&&e[q]===t}function Hw(e){return WC(e)||YC(e)||QC(e)}function Uw(e){return Vw(e,`Literal`)}function Ww(e){return Vw(e,`MappedKey`)}function Gw(e){return Vw(e,`MappedResult`)}function Kw(e){return Vw(e,`Never`)}function qw(e){return Vw(e,`Not`)}function Jw(e){return Vw(e,`Null`)}function Yw(e){return Vw(e,`Number`)}function Xw(e){return Vw(e,`Object`)}function Zw(e){return Vw(e,`Promise`)}function Qw(e){return Vw(e,`Record`)}function $w(e){return Vw(e,`Ref`)}function eT(e){return Vw(e,`RegExp`)}function tT(e){return Vw(e,`String`)}function nT(e){return Vw(e,`Symbol`)}function rT(e){return Vw(e,`TemplateLiteral`)}function iT(e){return Vw(e,`This`)}function aT(e){return XC(e)&&Sw in e}function oT(e){return Vw(e,`Tuple`)}function sT(e){return Vw(e,`Undefined`)}function cT(e){return Vw(e,`Union`)}function lT(e){return Vw(e,`Uint8Array`)}function uT(e){return Vw(e,`Unknown`)}function dT(e){return Vw(e,`Unsafe`)}function fT(e){return Vw(e,`Void`)}function pT(e){return XC(e)&&q in e&&QC(e[q])}function mT(e){return Ow(e)||kw(e)||Aw(e)||Nw(e)||Mw(e)||jw(e)||Pw(e)||Fw(e)||Iw(e)||Lw(e)||Rw(e)||zw(e)||Bw(e)||Uw(e)||Ww(e)||Gw(e)||Kw(e)||qw(e)||Jw(e)||Yw(e)||Xw(e)||Zw(e)||Qw(e)||$w(e)||eT(e)||tT(e)||nT(e)||rT(e)||iT(e)||oT(e)||sT(e)||cT(e)||lT(e)||uT(e)||dT(e)||fT(e)||pT(e)}var hT=`Argument.Any.Array.AsyncIterator.BigInt.Boolean.Computed.Constructor.Date.Enum.Function.Integer.Intersect.Iterator.Literal.MappedKey.MappedResult.Not.Null.Number.Object.Promise.Record.Ref.RegExp.String.Symbol.TemplateLiteral.This.Tuple.Undefined.Union.Uint8Array.Unknown.Void`.split(`.`);function gT(e){try{return new RegExp(e),!0}catch{return!1}}function _T(e){if(!QC(e))return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function vT(e){return xT(e)||_E(e)}function yT(e){return tw(e)||UC(e)}function bT(e){return tw(e)||YC(e)}function xT(e){return tw(e)||WC(e)}function ST(e){return tw(e)||QC(e)}function CT(e){return tw(e)||QC(e)&&_T(e)&&gT(e)}function wT(e){return tw(e)||QC(e)&&_T(e)}function TT(e){return tw(e)||_E(e)}function ET(e){return XC(e)&&e[ww]===`Optional`}function DT(e){return VT(e,`Any`)&&ST(e.$id)}function OT(e){return VT(e,`Argument`)&&YC(e.index)}function kT(e){return VT(e,`Array`)&&e.type===`array`&&ST(e.$id)&&_E(e.items)&&bT(e.minItems)&&bT(e.maxItems)&&xT(e.uniqueItems)&&TT(e.contains)&&bT(e.minContains)&&bT(e.maxContains)}function AT(e){return VT(e,`AsyncIterator`)&&e.type===`AsyncIterator`&&ST(e.$id)&&_E(e.items)}function jT(e){return VT(e,`BigInt`)&&e.type===`bigint`&&ST(e.$id)&&yT(e.exclusiveMaximum)&&yT(e.exclusiveMinimum)&&yT(e.maximum)&&yT(e.minimum)&&yT(e.multipleOf)}function MT(e){return VT(e,`Boolean`)&&e.type===`boolean`&&ST(e.$id)}function NT(e){return VT(e,`Computed`)&&QC(e.target)&&HC(e.parameters)&&e.parameters.every(e=>_E(e))}function PT(e){return VT(e,`Constructor`)&&e.type===`Constructor`&&ST(e.$id)&&HC(e.parameters)&&e.parameters.every(e=>_E(e))&&_E(e.returns)}function FT(e){return VT(e,`Date`)&&e.type===`Date`&&ST(e.$id)&&bT(e.exclusiveMaximumTimestamp)&&bT(e.exclusiveMinimumTimestamp)&&bT(e.maximumTimestamp)&&bT(e.minimumTimestamp)&&bT(e.multipleOfTimestamp)}function IT(e){return VT(e,`Function`)&&e.type===`Function`&&ST(e.$id)&&HC(e.parameters)&&e.parameters.every(e=>_E(e))&&_E(e.returns)}function LT(e){return VT(e,`Integer`)&&e.type===`integer`&&ST(e.$id)&&bT(e.exclusiveMaximum)&&bT(e.exclusiveMinimum)&&bT(e.maximum)&&bT(e.minimum)&&bT(e.multipleOf)}function RT(e){return XC(e)&&Object.entries(e).every(([e,t])=>_T(e)&&_E(t))}function zT(e){return VT(e,`Intersect`)&&!(QC(e.type)&&e.type!==`object`)&&HC(e.allOf)&&e.allOf.every(e=>_E(e)&&!cE(e))&&ST(e.type)&&(xT(e.unevaluatedProperties)||TT(e.unevaluatedProperties))&&ST(e.$id)}function BT(e){return VT(e,`Iterator`)&&e.type===`Iterator`&&ST(e.$id)&&_E(e.items)}function VT(e,t){return XC(e)&&q in e&&e[q]===t}function HT(e){return GT(e)&&QC(e.const)}function UT(e){return GT(e)&&YC(e.const)}function WT(e){return GT(e)&&WC(e.const)}function GT(e){return VT(e,`Literal`)&&ST(e.$id)&&KT(e.const)}function KT(e){return WC(e)||YC(e)||QC(e)}function qT(e){return VT(e,`MappedKey`)&&HC(e.keys)&&e.keys.every(e=>YC(e)||QC(e))}function JT(e){return VT(e,`MappedResult`)&&RT(e.properties)}function YT(e){return VT(e,`Never`)&&XC(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function XT(e){return VT(e,`Not`)&&_E(e.not)}function ZT(e){return VT(e,`Null`)&&e.type===`null`&&ST(e.$id)}function QT(e){return VT(e,`Number`)&&e.type===`number`&&ST(e.$id)&&bT(e.exclusiveMaximum)&&bT(e.exclusiveMinimum)&&bT(e.maximum)&&bT(e.minimum)&&bT(e.multipleOf)}function $T(e){return VT(e,`Object`)&&e.type===`object`&&ST(e.$id)&&RT(e.properties)&&vT(e.additionalProperties)&&bT(e.minProperties)&&bT(e.maxProperties)}function eE(e){return VT(e,`Promise`)&&e.type===`Promise`&&ST(e.$id)&&_E(e.item)}function tE(e){return VT(e,`Record`)&&e.type===`object`&&ST(e.$id)&&vT(e.additionalProperties)&&XC(e.patternProperties)&&(e=>{let t=Object.getOwnPropertyNames(e.patternProperties);return t.length===1&&gT(t[0])&&XC(e.patternProperties)&&_E(e.patternProperties[t[0]])})(e)}function nE(e){return VT(e,`Ref`)&&ST(e.$id)&&QC(e.$ref)}function rE(e){return VT(e,`RegExp`)&&ST(e.$id)&&QC(e.source)&&QC(e.flags)&&bT(e.maxLength)&&bT(e.minLength)}function iE(e){return VT(e,`String`)&&e.type===`string`&&ST(e.$id)&&bT(e.minLength)&&bT(e.maxLength)&&CT(e.pattern)&&wT(e.format)}function aE(e){return VT(e,`Symbol`)&&e.type===`symbol`&&ST(e.$id)}function oE(e){return VT(e,`TemplateLiteral`)&&e.type===`string`&&QC(e.pattern)&&e.pattern[0]===`^`&&e.pattern[e.pattern.length-1]===`$`}function sE(e){return VT(e,`This`)&&ST(e.$id)&&QC(e.$ref)}function cE(e){return XC(e)&&Sw in e}function lE(e){return VT(e,`Tuple`)&&e.type===`array`&&ST(e.$id)&&YC(e.minItems)&&YC(e.maxItems)&&e.minItems===e.maxItems&&(tw(e.items)&&tw(e.additionalItems)&&e.minItems===0||HC(e.items)&&e.items.every(e=>_E(e)))}function uE(e){return VT(e,`Undefined`)&&e.type===`undefined`&&ST(e.$id)}function dE(e){return VT(e,`Union`)&&ST(e.$id)&&XC(e)&&HC(e.anyOf)&&e.anyOf.every(e=>_E(e))}function fE(e){return VT(e,`Uint8Array`)&&e.type===`Uint8Array`&&ST(e.$id)&&bT(e.minByteLength)&&bT(e.maxByteLength)}function pE(e){return VT(e,`Unknown`)&&ST(e.$id)}function mE(e){return VT(e,`Unsafe`)}function hE(e){return VT(e,`Void`)&&e.type===`void`&&ST(e.$id)}function gE(e){return XC(e)&&q in e&&QC(e[q])&&!hT.includes(e[q])}function _E(e){return XC(e)&&(DT(e)||OT(e)||kT(e)||MT(e)||jT(e)||AT(e)||NT(e)||PT(e)||FT(e)||IT(e)||LT(e)||zT(e)||BT(e)||GT(e)||qT(e)||JT(e)||YT(e)||XT(e)||ZT(e)||QT(e)||$T(e)||eE(e)||tE(e)||nE(e)||rE(e)||iE(e)||aE(e)||oE(e)||sE(e)||lE(e)||uE(e)||dE(e)||fE(e)||pE(e)||mE(e)||hE(e)||gE(e))}var vE=`(true|false)`,yE=`(0|[1-9][0-9]*)`,bE=`(.*)`,xE=`(?!.*)`;`${vE}`;var SE=`^${yE}$`,CE=`^${bE}$`,wE=`^${xE}$`;function TE(e,t){return e.includes(t)}function EE(e){return[...new Set(e)]}function DE(e,t){return e.filter(e=>t.includes(e))}function OE(e,t){return e.reduce((e,t)=>DE(e,t),t)}function kE(e){return e.length===1?e[0]:e.length>1?OE(e.slice(1),e[0]):[]}function AE(e){let t=[];for(let n of e)t.push(...n);return t}function jE(e){return K({[q]:`Any`},e)}function ME(e,t){return K({[q]:`Array`,type:`array`,items:e},t)}function NE(e){return K({[q]:`Argument`,index:e})}function PE(e,t){return K({[q]:`AsyncIterator`,type:`AsyncIterator`,items:e},t)}function FE(e,t,n){return K({[q]:`Computed`,target:e,parameters:t},n)}function IE(e,t){let{[t]:n,...r}=e;return r}function LE(e,t){return t.reduce((e,t)=>IE(e,t),e)}function RE(e){return K({[q]:`Never`,not:{}},e)}function zE(e){return K({[q]:`MappedResult`,properties:e})}function BE(e,t,n){return K({[q]:`Constructor`,type:`Constructor`,parameters:e,returns:t},n)}function VE(e,t,n){return K({[q]:`Function`,type:`Function`,parameters:e,returns:t},n)}function HE(e,t){return K({[q]:`Union`,anyOf:e},t)}function UE(e){return e.some(e=>Dw(e))}function WE(e){return e.map(e=>Dw(e)?GE(e):e)}function GE(e){return LE(e,[ww])}function KE(e,t){return UE(e)?MO(HE(WE(e),t)):HE(WE(e),t)}function qE(e,t){return e.length===1?K(e[0],t):e.length===0?RE(t):KE(e,t)}function JE(e,t){return e.length===0?RE(t):e.length===1?K(e[0],t):HE(e,t)}var YE=class extends xw{};function XE(e){return e.replace(/\\\$/g,`$`).replace(/\\\*/g,`*`).replace(/\\\^/g,`^`).replace(/\\\|/g,`|`).replace(/\\\(/g,`(`).replace(/\\\)/g,`)`)}function ZE(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function QE(e,t){return ZE(e,t,`(`)}function $E(e,t){return ZE(e,t,`)`)}function eD(e,t){return ZE(e,t,`|`)}function tD(e){if(!(QE(e,0)&&$E(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(QE(e,n)&&(t+=1),$E(e,n)&&--t,t===0&&n!==e.length-1)return!1;return!0}function nD(e){return e.slice(1,e.length-1)}function rD(e){let t=0;for(let n=0;n<e.length;n++)if(QE(e,n)&&(t+=1),$E(e,n)&&--t,eD(e,n)&&t===0)return!0;return!1}function iD(e){for(let t=0;t<e.length;t++)if(QE(e,t))return!0;return!1}function aD(e){let[t,n]=[0,0],r=[];for(let i=0;i<e.length;i++)if(QE(e,i)&&(t+=1),$E(e,i)&&--t,eD(e,i)&&t===0){let t=e.slice(n,i);t.length>0&&r.push(sD(t)),n=i+1}let i=e.slice(n);return i.length>0&&r.push(sD(i)),r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`or`,expr:r}}function oD(e){function t(e,t){if(!QE(e,t))throw new YE(`TemplateLiteralParser: Index must point to open parens`);let n=0;for(let r=t;r<e.length;r++)if(QE(e,r)&&(n+=1),$E(e,r)&&--n,n===0)return[t,r];throw new YE(`TemplateLiteralParser: Unclosed group parens in expression`)}function n(e,t){for(let n=t;n<e.length;n++)if(QE(e,n))return[t,n];return[t,e.length]}let r=[];for(let i=0;i<e.length;i++)if(QE(e,i)){let[n,a]=t(e,i),o=e.slice(n,a+1);r.push(sD(o)),i=a}else{let[t,a]=n(e,i),o=e.slice(t,a);o.length>0&&r.push(sD(o)),i=a-1}return r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`and`,expr:r}}function sD(e){return tD(e)?sD(nD(e)):rD(e)?aD(e):iD(e)?oD(e):{type:`const`,const:XE(e)}}function cD(e){return sD(e.slice(1,e.length-1))}var lD=class extends xw{};function uD(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`0`&&e.expr[1].type===`const`&&e.expr[1].const===`[1-9][0-9]*`}function dD(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`true`&&e.expr[1].type===`const`&&e.expr[1].const===`false`}function fD(e){return e.type===`const`&&e.const===`.*`}function pD(e){return uD(e)||fD(e)?!1:dD(e)?!0:e.type===`and`||e.type===`or`?e.expr.every(e=>pD(e)):e.type===`const`?!0:(()=>{throw new lD(`Unknown expression type`)})()}function mD(e){return pD(cD(e.pattern))}var hD=class extends xw{};function*gD(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of gD(e.slice(1)))yield`${t}${n}`}function*_D(e){return yield*gD(e.expr.map(e=>[...bD(e)]))}function*vD(e){for(let t of e.expr)yield*bD(t)}function*yD(e){return yield e.const}function*bD(e){return e.type===`and`?yield*_D(e):e.type===`or`?yield*vD(e):e.type===`const`?yield*yD(e):(()=>{throw new hD(`Unknown expression`)})()}function xD(e){let t=cD(e.pattern);return pD(t)?[...bD(t)]:[]}function SD(e,t){return K({[q]:`Literal`,const:e,type:typeof e},t)}function CD(e){return K({[q]:`Boolean`,type:`boolean`},e)}function wD(e){return K({[q]:`BigInt`,type:`bigint`},e)}function TD(e){return K({[q]:`Number`,type:`number`},e)}function ED(e){return K({[q]:`String`,type:`string`},e)}function*DD(e){let t=e.trim().replace(/"|'/g,``);return t===`boolean`?yield CD():t===`number`?yield TD():t===`bigint`?yield wD():t===`string`?yield ED():yield(()=>{let e=t.split(`|`).map(e=>SD(e.trim()));return e.length===0?RE():e.length===1?e[0]:qE(e)})()}function*OD(e){if(e[1]!==`{`)return yield*[SD(`$`),...kD(e.slice(1))];for(let t=2;t<e.length;t++)if(e[t]===`}`){let n=DD(e.slice(2,t)),r=kD(e.slice(t+1));return yield*[...n,...r]}yield SD(e)}function*kD(e){for(let t=0;t<e.length;t++)if(e[t]===`$`)return yield*[SD(e.slice(0,t)),...OD(e.slice(t))];yield SD(e)}function AD(e){return[...kD(e)]}var jD=class extends xw{};function MD(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ND(e,t){return rT(e)?e.pattern.slice(1,e.pattern.length-1):cT(e)?`(${e.anyOf.map(e=>ND(e,t)).join(`|`)})`:Yw(e)||Rw(e)||Mw(e)?`${t}${yE}`:tT(e)?`${t}${bE}`:Uw(e)?`${t}${MD(e.const.toString())}`:Nw(e)?`${t}${vE}`:(()=>{throw new jD(`Unexpected Kind '${e[q]}'`)})()}function PD(e){return`^${e.map(e=>ND(e,``)).join(``)}\$`}function FD(e){return qE(xD(e).map(e=>SD(e)))}function ID(e,t){let n=QC(e)?PD(AD(e)):PD(e);return K({[q]:`TemplateLiteral`,type:`string`,pattern:n},t)}function LD(e){return xD(e).map(e=>e.toString())}function RD(e){let t=[];for(let n of e)t.push(...BD(n));return t}function zD(e){return[e.toString()]}function BD(e){return[...new Set(rT(e)?LD(e):cT(e)?RD(e.anyOf):Uw(e)?zD(e.const):Yw(e)||Rw(e)?[`[number]`]:[])]}function VD(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=tO(e,BD(t[i]),n);return r}function HD(e,t,n){return VD(e,t.properties,n)}function UD(e,t,n){return zE(HD(e,t,n))}function WD(e,t){return e.map(e=>QD(e,t))}function GD(e){return e.filter(e=>!Kw(e))}function KD(e,t){return VO(GD(WD(e,t)))}function qD(e){return e.some(e=>Kw(e))?[]:e}function JD(e,t){return qE(qD(WD(e,t)))}function YD(e,t){return t in e?e[t]:t===`[number]`?qE(e):RE()}function XD(e,t){return t===`[number]`?e:RE()}function ZD(e,t){return t in e?e[t]:RE()}function QD(e,t){return zw(e)?KD(e.allOf,t):cT(e)?JD(e.anyOf,t):oT(e)?YD(e.items??[],t):Aw(e)?XD(e.items,t):Xw(e)?ZD(e.properties,t):RE()}function $D(e,t){return t.map(t=>QD(e,t))}function eO(e,t){return qE($D(e,t))}function tO(e,t,n){if($w(e)||$w(t)){if(!mT(e)||!mT(t))throw new xw(`Index types using Ref parameters require both Type and Key to be of TSchema`);return FE(`Index`,[e,t])}return Gw(t)?UD(e,t,n):Ww(t)?aO(e,t,n):K(mT(t)?eO(e,BD(t)):eO(e,t),n)}function nO(e,t,n){return{[t]:tO(e,[t],cw(n))}}function rO(e,t,n){return t.reduce((t,r)=>({...t,...nO(e,r,n)}),{})}function iO(e,t,n){return rO(e,t.keys,n)}function aO(e,t,n){return zE(iO(e,t,n))}function oO(e,t){return K({[q]:`Iterator`,type:`Iterator`,items:e},t)}function sO(e){return globalThis.Object.keys(e).filter(t=>!Dw(e[t]))}function cO(e,t){let n=sO(e);return K(n.length>0?{[q]:`Object`,type:`object`,required:n,properties:e}:{[q]:`Object`,type:`object`,properties:e},t)}var lO=cO;function uO(e,t){return K({[q]:`Promise`,type:`Promise`,item:e},t)}function dO(e){return K(LE(e,[Cw]))}function fO(e){return K({...e,[Cw]:`Readonly`})}function pO(e,t){return t===!1?dO(e):fO(e)}function mO(e,t){let n=t??!0;return Gw(e)?_O(e,n):pO(e,n)}function hO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=mO(e[r],t);return n}function gO(e,t){return hO(e.properties,t)}function _O(e,t){return zE(gO(e,t))}function vO(e,t){return K(e.length>0?{[q]:`Tuple`,type:`array`,items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[q]:`Tuple`,type:`array`,minItems:e.length,maxItems:e.length},t)}function yO(e,t){return e in t?EO(e,t[e]):zE(t)}function bO(e){return{[e]:SD(e)}}function xO(e){let t={};for(let n of e)t[n]=SD(n);return t}function SO(e,t){return TE(t,e)?bO(e):xO(t)}function CO(e,t){return yO(e,SO(e,t))}function wO(e,t){return t.map(t=>EO(e,t))}function TO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=EO(e,t[r]);return n}function EO(e,t){let n={...t};return Dw(t)?MO(EO(e,LE(t,[ww]))):Ew(t)?mO(EO(e,LE(t,[Cw]))):Gw(t)?yO(e,t.properties):Ww(t)?CO(e,t.keys):Fw(t)?BE(wO(e,t.parameters),EO(e,t.returns),n):Lw(t)?VE(wO(e,t.parameters),EO(e,t.returns),n):jw(t)?PE(EO(e,t.items),n):Bw(t)?oO(EO(e,t.items),n):zw(t)?HO(wO(e,t.allOf),n):cT(t)?JE(wO(e,t.anyOf),n):oT(t)?vO(wO(e,t.items??[]),n):Xw(t)?lO(TO(e,t.properties),n):Aw(t)?ME(EO(e,t.items),n):Zw(t)?uO(EO(e,t.item),n):t}function DO(e,t){let n={};for(let r of e)n[r]=EO(r,t);return n}function OO(e,t,n){let r=mT(e)?BD(e):e;return lO(DO(r,t({[q]:`MappedKey`,keys:r})),n)}function kO(e){return K(LE(e,[ww]))}function AO(e){return K({...e,[ww]:`Optional`})}function jO(e,t){return t===!1?kO(e):AO(e)}function MO(e,t){let n=t??!0;return Gw(e)?FO(e,n):jO(e,n)}function NO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=MO(e[r],t);return n}function PO(e,t){return NO(e.properties,t)}function FO(e,t){return zE(PO(e,t))}function IO(e,t={}){let n=e.every(e=>Xw(e)),r=mT(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return K(t.unevaluatedProperties===!1||mT(t.unevaluatedProperties)||n?{...r,[q]:`Intersect`,type:`object`,allOf:e}:{...r,[q]:`Intersect`,allOf:e},t)}function LO(e){return e.every(e=>Dw(e))}function RO(e){return LE(e,[ww])}function zO(e){return e.map(e=>Dw(e)?RO(e):e)}function BO(e,t){return LO(e)?MO(IO(zO(e),t)):IO(zO(e),t)}function VO(e,t={}){if(e.length===1)return K(e[0],t);if(e.length===0)return RE(t);if(e.some(e=>aT(e)))throw Error(`Cannot intersect transform types`);return BO(e,t)}function HO(e,t){if(e.length===1)return K(e[0],t);if(e.length===0)return RE(t);if(e.some(e=>aT(e)))throw Error(`Cannot intersect transform types`);return IO(e,t)}function UO(...e){let[t,n]=typeof e[0]==`string`?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=`string`)throw new xw(`Ref: $ref must be a string`);return K({[q]:`Ref`,$ref:t},n)}function WO(e,t){return FE(`Awaited`,[FE(e,t)])}function GO(e){return FE(`Awaited`,[UO(e)])}function KO(e){return HO(YO(e))}function qO(e){return JE(YO(e))}function JO(e){return XO(e)}function YO(e){return e.map(e=>XO(e))}function XO(e,t){return K(Pw(e)?WO(e.target,e.parameters):zw(e)?KO(e.allOf):cT(e)?qO(e.anyOf):Zw(e)?JO(e.item):$w(e)?GO(e.$ref):e,t)}function ZO(e){let t=[];for(let n of e)t.push(ik(n));return t}function QO(e){return AE(ZO(e))}function $O(e){return kE(ZO(e))}function ek(e){return e.map((e,t)=>t.toString())}function tk(e){return[`[number]`]}function nk(e){return globalThis.Object.getOwnPropertyNames(e)}function rk(e){return ak?globalThis.Object.getOwnPropertyNames(e).map(e=>e[0]===`^`&&e[e.length-1]===`$`?e.slice(1,e.length-1):e):[]}function ik(e){return zw(e)?QO(e.allOf):cT(e)?$O(e.anyOf):oT(e)?ek(e.items??[]):Aw(e)?tk(e.items):Xw(e)?nk(e.properties):Qw(e)?rk(e.patternProperties):[]}var ak=!1;function ok(e,t){return FE(`KeyOf`,[FE(e,t)])}function sk(e){return FE(`KeyOf`,[UO(e)])}function ck(e,t){return K(qE(lk(ik(e))),t)}function lk(e){return e.map(e=>e===`[number]`?TD():SD(e))}function uk(e,t){return Pw(e)?ok(e.target,e.parameters):$w(e)?sk(e.$ref):Gw(e)?pk(e,t):ck(e,t)}function dk(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=uk(e[r],cw(t));return n}function fk(e,t){return dk(e.properties,t)}function pk(e,t){return zE(fk(e,t))}function mk(e){let t=[];for(let n of e)t.push(...ik(n));return EE(t)}function hk(e){return e.filter(e=>!Kw(e))}function gk(e,t){let n=[];for(let r of e)n.push(...$D(r,[t]));return hk(n)}function _k(e,t){let n={};for(let r of t)n[r]=VO(gk(e,r));return n}function vk(e,t){return lO(_k(e,mk(e)),t)}function yk(e){return K({[q]:`Date`,type:`Date`},e)}function bk(e){return K({[q]:`Null`,type:`null`},e)}function xk(e){return K({[q]:`Symbol`,type:`symbol`},e)}function Sk(e){return K({[q]:`Undefined`,type:`undefined`},e)}function Ck(e){return K({[q]:`Uint8Array`,type:`Uint8Array`},e)}function wk(e){return K({[q]:`Unknown`},e)}function Tk(e){return e.map(e=>Ok(e,!1))}function Ek(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=mO(Ok(e[n],!1));return t}function Dk(e,t){return t===!0?e:mO(e)}function Ok(e,t){return VC(e)||qC(e)?Dk(jE(),t):HC(e)?mO(vO(Tk(e))):ew(e)?Ck():GC(e)?yk():XC(e)?Dk(lO(Ek(e)),t):KC(e)?Dk(VE([],wk()),t):tw(e)?Sk():JC(e)?bk():$C(e)?xk():UC(e)?wD():YC(e)||WC(e)||QC(e)?SD(e):lO({})}function kk(e,t){return K(Ok(e,!0),t)}function Ak(e,t){return Fw(e)?vO(e.parameters,t):RE(t)}function jk(e,t){if(tw(e))throw Error(`Enum undefined or empty`);let n=globalThis.Object.getOwnPropertyNames(e).filter(e=>isNaN(e)).map(t=>e[t]);return JE([...new Set(n)].map(e=>SD(e)),{...t,[Tw]:`Enum`})}var Mk=class extends xw{},J;(function(e){e[e.Union=0]=`Union`,e[e.True=1]=`True`,e[e.False=2]=`False`})(J||={});function Nk(e){return e===J.False?e:J.True}function Pk(e){throw new Mk(e)}function Fk(e){return YT(e)||zT(e)||dE(e)||pE(e)||DT(e)}function Ik(e,t){return YT(t)?eA(e,t):zT(t)?Xk(e,t):dE(t)?LA(e,t):pE(t)?zA(e,t):DT(t)?Lk(e,t):Pk(`StructuralRight`)}function Lk(e,t){return J.True}function Rk(e,t){return zT(t)?Xk(e,t):dE(t)&&t.anyOf.some(e=>DT(e)||pE(e))?J.True:dE(t)?J.Union:pE(t)||DT(t)?J.True:J.Union}function zk(e,t){return pE(e)?J.False:DT(e)?J.Union:YT(e)?J.True:J.False}function Bk(e,t){return $T(t)&&_A(t)?J.True:Fk(t)?Ik(e,t):kT(t)?Nk(UA(e.items,t.items)):J.False}function Vk(e,t){return Fk(t)?Ik(e,t):AT(t)?Nk(UA(e.items,t.items)):J.False}function Hk(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?TA(e,t):jT(t)?J.True:J.False}function Uk(e,t){return WT(e)||MT(e)?J.True:J.False}function Wk(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?TA(e,t):MT(t)?J.True:J.False}function Gk(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):PT(t)?e.parameters.length>t.parameters.length?J.False:e.parameters.every((e,n)=>Nk(UA(t.parameters[n],e))===J.True)?Nk(UA(e.returns,t.returns)):J.False:J.False}function Kk(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?TA(e,t):FT(t)?J.True:J.False}function qk(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):IT(t)?e.parameters.length>t.parameters.length?J.False:e.parameters.every((e,n)=>Nk(UA(t.parameters[n],e))===J.True)?Nk(UA(e.returns,t.returns)):J.False:J.False}function Jk(e,t){return GT(e)&&YC(e.const)||QT(e)||LT(e)?J.True:J.False}function Yk(e,t){return LT(t)||QT(t)?J.True:Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?TA(e,t):J.False}function Xk(e,t){return t.allOf.every(t=>UA(e,t)===J.True)?J.True:J.False}function Zk(e,t){return e.allOf.some(e=>UA(e,t)===J.True)?J.True:J.False}function Qk(e,t){return Fk(t)?Ik(e,t):BT(t)?Nk(UA(e.items,t.items)):J.False}function $k(e,t){return GT(t)&&t.const===e.const?J.True:Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?TA(e,t):iE(t)?OA(e,t):QT(t)?aA(e,t):LT(t)?Jk(e,t):MT(t)?Uk(e,t):J.False}function eA(e,t){return J.False}function tA(e,t){return J.True}function nA(e){let[t,n]=[e,0];for(;XT(t);)t=t.not,n+=1;return n%2==0?t:wk()}function rA(e,t){return XT(e)?UA(nA(e),t):XT(t)?UA(e,nA(t)):Pk(`Invalid fallthrough for Not`)}function iA(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?TA(e,t):ZT(t)?J.True:J.False}function aA(e,t){return UT(e)||QT(e)||LT(e)?J.True:J.False}function oA(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?TA(e,t):LT(t)||QT(t)?J.True:J.False}function sA(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function cA(e){return _A(e)}function lA(e){return sA(e,0)||sA(e,1)&&`description`in e.properties&&dE(e.properties.description)&&e.properties.description.anyOf.length===2&&(iE(e.properties.description.anyOf[0])&&uE(e.properties.description.anyOf[1])||iE(e.properties.description.anyOf[1])&&uE(e.properties.description.anyOf[0]))}function uA(e){return sA(e,0)}function dA(e){return sA(e,0)}function fA(e){return sA(e,0)}function pA(e){return sA(e,0)}function mA(e){return _A(e)}function hA(e){let t=TD();return sA(e,0)||sA(e,1)&&`length`in e.properties&&Nk(UA(e.properties.length,t))===J.True}function gA(e){return sA(e,0)}function _A(e){let t=TD();return sA(e,0)||sA(e,1)&&`length`in e.properties&&Nk(UA(e.properties.length,t))===J.True}function vA(e){let t=VE([jE()],jE());return sA(e,0)||sA(e,1)&&`then`in e.properties&&Nk(UA(e.properties.then,t))===J.True}function yA(e,t){return UA(e,t)===J.False||ET(e)&&!ET(t)?J.False:J.True}function bA(e,t){return pE(e)?J.False:DT(e)?J.Union:YT(e)||HT(e)&&cA(t)||UT(e)&&uA(t)||WT(e)&&dA(t)||aE(e)&&lA(t)||jT(e)&&fA(t)||iE(e)&&cA(t)||aE(e)&&lA(t)||QT(e)&&uA(t)||LT(e)&&uA(t)||MT(e)&&dA(t)||fE(e)&&mA(t)||FT(e)&&pA(t)||PT(e)&&gA(t)||IT(e)&&hA(t)?J.True:tE(e)&&iE(CA(e))?t[Tw]===`Record`?J.True:J.False:tE(e)&&QT(CA(e))&&sA(t,0)?J.True:J.False}function xA(e,t){return Fk(t)?Ik(e,t):tE(t)?TA(e,t):$T(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!ET(t.properties[n]))return J.False;if(ET(t.properties[n]))return J.True;if(yA(e.properties[n],t.properties[n])===J.False)return J.False}return J.True})():J.False}function SA(e,t){return Fk(t)?Ik(e,t):$T(t)&&vA(t)?J.True:eE(t)?Nk(UA(e.item,t.item)):J.False}function CA(e){return SE in e.patternProperties?TD():CE in e.patternProperties?ED():Pk(`Unknown record key pattern`)}function wA(e){return SE in e.patternProperties?e.patternProperties[SE]:CE in e.patternProperties?e.patternProperties[CE]:Pk(`Unable to get record value schema`)}function TA(e,t){let[n,r]=[CA(t),wA(t)];return HT(e)&&QT(n)&&Nk(UA(e,r))===J.True?J.True:fE(e)&&QT(n)||iE(e)&&QT(n)||kT(e)&&QT(n)?UA(e,r):$T(e)?(()=>{for(let t of Object.getOwnPropertyNames(e.properties))if(yA(r,e.properties[t])===J.False)return J.False;return J.True})():J.False}function EA(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?UA(wA(e),wA(t)):J.False}function DA(e,t){return UA(rE(e)?ED():e,rE(t)?ED():t)}function OA(e,t){return GT(e)&&QC(e.const)||iE(e)?J.True:J.False}function kA(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?TA(e,t):iE(t)?J.True:J.False}function AA(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?TA(e,t):aE(t)?J.True:J.False}function jA(e,t){return oE(e)?UA(FD(e),t):oE(t)?UA(e,FD(t)):Pk(`Invalid fallthrough for TemplateLiteral`)}function MA(e,t){return kT(t)&&e.items!==void 0&&e.items.every(e=>UA(e,t.items)===J.True)}function NA(e,t){return YT(e)?J.True:pE(e)?J.False:DT(e)?J.Union:J.False}function PA(e,t){return Fk(t)?Ik(e,t):$T(t)&&_A(t)||kT(t)&&MA(e,t)?J.True:lE(t)?tw(e.items)&&!tw(t.items)||!tw(e.items)&&tw(t.items)?J.False:tw(e.items)&&!tw(t.items)||e.items.every((e,n)=>UA(e,t.items[n])===J.True)?J.True:J.False:J.False}function FA(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?TA(e,t):fE(t)?J.True:J.False}function IA(e,t){return Fk(t)?Ik(e,t):$T(t)?bA(e,t):tE(t)?TA(e,t):hE(t)?VA(e,t):uE(t)?J.True:J.False}function LA(e,t){return t.anyOf.some(t=>UA(e,t)===J.True)?J.True:J.False}function RA(e,t){return e.anyOf.every(e=>UA(e,t)===J.True)?J.True:J.False}function zA(e,t){return J.True}function BA(e,t){return YT(t)?eA(e,t):zT(t)?Xk(e,t):dE(t)?LA(e,t):DT(t)?Lk(e,t):iE(t)?OA(e,t):QT(t)?aA(e,t):LT(t)?Jk(e,t):MT(t)?Uk(e,t):kT(t)?zk(e,t):lE(t)?NA(e,t):$T(t)?bA(e,t):pE(t)?J.True:J.False}function VA(e,t){return uE(e)||uE(e)?J.True:J.False}function HA(e,t){return zT(t)?Xk(e,t):dE(t)?LA(e,t):pE(t)?zA(e,t):DT(t)?Lk(e,t):$T(t)?bA(e,t):hE(t)?J.True:J.False}function UA(e,t){return oE(e)||oE(t)?jA(e,t):rE(e)||rE(t)?DA(e,t):XT(e)||XT(t)?rA(e,t):DT(e)?Rk(e,t):kT(e)?Bk(e,t):jT(e)?Hk(e,t):MT(e)?Wk(e,t):AT(e)?Vk(e,t):PT(e)?Gk(e,t):FT(e)?Kk(e,t):IT(e)?qk(e,t):LT(e)?Yk(e,t):zT(e)?Zk(e,t):BT(e)?Qk(e,t):GT(e)?$k(e,t):YT(e)?tA(e,t):ZT(e)?iA(e,t):QT(e)?oA(e,t):$T(e)?xA(e,t):tE(e)?EA(e,t):iE(e)?kA(e,t):aE(e)?AA(e,t):lE(e)?PA(e,t):eE(e)?SA(e,t):fE(e)?FA(e,t):uE(e)?IA(e,t):dE(e)?RA(e,t):pE(e)?BA(e,t):hE(e)?HA(e,t):Pk(`Unknown left type operand '${e[q]}'`)}function WA(e,t){return UA(e,t)}function GA(e,t,n,r,i){let a={};for(let o of globalThis.Object.getOwnPropertyNames(e))a[o]=YA(e[o],t,n,r,cw(i));return a}function KA(e,t,n,r,i){return GA(e.properties,t,n,r,i)}function qA(e,t,n,r,i){return zE(KA(e,t,n,r,i))}function JA(e,t,n,r){let i=WA(e,t);return i===J.Union?JE([n,r]):i===J.True?n:r}function YA(e,t,n,r,i){return Gw(e)?qA(e,t,n,r,i):Ww(e)?K($A(e,t,n,r,i)):K(JA(e,t,n,r),i)}function XA(e,t,n,r,i){return{[e]:YA(SD(e),t,n,r,cw(i))}}function ZA(e,t,n,r,i){return e.reduce((e,a)=>({...e,...XA(a,t,n,r,i)}),{})}function QA(e,t,n,r,i){return ZA(e.keys,t,n,r,i)}function $A(e,t,n,r,i){return zE(QA(e,t,n,r,i))}function ej(e,t){return nj(FD(e),t)}function tj(e,t){let n=e.filter(e=>WA(e,t)===J.False);return n.length===1?n[0]:JE(n)}function nj(e,t,n={}){return rT(e)?K(ej(e,t),n):Gw(e)?K(aj(e,t),n):K(cT(e)?tj(e.anyOf,t):WA(e,t)===J.False?e:RE(),n)}function rj(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=nj(e[r],t);return n}function ij(e,t){return rj(e.properties,t)}function aj(e,t){return zE(ij(e,t))}function oj(e,t){return cj(FD(e),t)}function sj(e,t){let n=e.filter(e=>WA(e,t)!==J.False);return n.length===1?n[0]:JE(n)}function cj(e,t,n){return rT(e)?K(oj(e,t),n):Gw(e)?K(dj(e,t),n):K(cT(e)?sj(e.anyOf,t):WA(e,t)===J.False?RE():e,n)}function lj(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=cj(e[r],t);return n}function uj(e,t){return lj(e.properties,t)}function dj(e,t){return zE(uj(e,t))}function fj(e,t){return Fw(e)?K(e.returns,t):RE(t)}function pj(e){return mO(MO(e))}function mj(e,t,n){return K({[q]:`Record`,type:`object`,patternProperties:{[e]:t}},n)}function hj(e,t,n){let r={};for(let n of e)r[n]=t;return lO(r,{...n,[Tw]:`Record`})}function gj(e,t,n){return mD(e)?hj(BD(e),t,n):mj(e.pattern,t,n)}function _j(e,t,n){return hj(BD(JE(e)),t,n)}function vj(e,t,n){return hj([e.toString()],t,n)}function yj(e,t,n){return mj(e.source,t,n)}function bj(e,t,n){return mj(tw(e.pattern)?CE:e.pattern,t,n)}function xj(e,t,n){return mj(CE,t,n)}function Sj(e,t,n){return mj(wE,t,n)}function Cj(e,t,n){return lO({true:t,false:t},n)}function wj(e,t,n){return mj(SE,t,n)}function Tj(e,t,n){return mj(SE,t,n)}function Ej(e,t,n={}){return cT(e)?_j(e.anyOf,t,n):rT(e)?gj(e,t,n):Uw(e)?vj(e.const,t,n):Nw(e)?Cj(e,t,n):Rw(e)?wj(e,t,n):Yw(e)?Tj(e,t,n):eT(e)?yj(e,t,n):tT(e)?bj(e,t,n):Ow(e)?xj(e,t,n):Kw(e)?Sj(e,t,n):RE(n)}function Dj(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function Oj(e){let t=Dj(e);return t===CE?ED():t===SE?TD():ED({pattern:t})}function kj(e){return e.patternProperties[Dj(e)]}function Aj(e,t){return t.parameters=Wj(e,t.parameters),t.returns=Gj(e,t.returns),t}function jj(e,t){return t.parameters=Wj(e,t.parameters),t.returns=Gj(e,t.returns),t}function Mj(e,t){return t.allOf=Wj(e,t.allOf),t}function Nj(e,t){return t.anyOf=Wj(e,t.anyOf),t}function Pj(e,t){return tw(t.items)||(t.items=Wj(e,t.items)),t}function Fj(e,t){return t.items=Gj(e,t.items),t}function Ij(e,t){return t.items=Gj(e,t.items),t}function Lj(e,t){return t.items=Gj(e,t.items),t}function Rj(e,t){return t.item=Gj(e,t.item),t}function zj(e,t){let n=Uj(e,t.properties);return{...t,...lO(n)}}function Bj(e,t){let n=Ej(Gj(e,Oj(t)),Gj(e,kj(t)));return{...t,...n}}function Vj(e,t){return t.index in e?e[t.index]:wk()}function Hj(e,t){let n=Ew(t),r=Dw(t),i=Gj(e,t);return n&&r?pj(i):n&&!r?mO(i):!n&&r?MO(i):i}function Uj(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:Hj(e,t[r])}),{})}function Wj(e,t){return t.map(t=>Gj(e,t))}function Gj(e,t){return Fw(t)?Aj(e,t):Lw(t)?jj(e,t):zw(t)?Mj(e,t):cT(t)?Nj(e,t):oT(t)?Pj(e,t):Aw(t)?Fj(e,t):jw(t)?Ij(e,t):Bw(t)?Lj(e,t):Zw(t)?Rj(e,t):Xw(t)?zj(e,t):Qw(t)?Bj(e,t):kw(t)?Vj(e,t):t}function Kj(e,t){return Gj(t,lw(e))}function qj(e){return K({[q]:`Integer`,type:`integer`},e)}function Jj(e,t,n){return{[e]:aM(SD(e),t,cw(n))}}function Yj(e,t,n){return e.reduce((e,r)=>({...e,...Jj(r,t,n)}),{})}function Xj(e,t,n){return Yj(e.keys,t,n)}function Zj(e,t,n){return zE(Xj(e,t,n))}function Qj(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join(``)}function $j(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join(``)}function eM(e){return e.toUpperCase()}function tM(e){return e.toLowerCase()}function nM(e,t,n){let r=cD(e.pattern);return pD(r)?ID([JE(iM([...bD(r)].map(e=>SD(e)),t))],n):{...e,pattern:rM(e.pattern,t)}}function rM(e,t){return typeof e==`string`?t===`Uncapitalize`?Qj(e):t===`Capitalize`?$j(e):t===`Uppercase`?eM(e):t===`Lowercase`?tM(e):e:e.toString()}function iM(e,t){return e.map(e=>aM(e,t))}function aM(e,t,n={}){return Ww(e)?Zj(e,t,n):rT(e)?nM(e,t,n):cT(e)?JE(iM(e.anyOf,t),n):Uw(e)?SD(rM(e.const,t),n):K(e,n)}function oM(e,t={}){return aM(e,`Capitalize`,t)}function sM(e,t={}){return aM(e,`Lowercase`,t)}function cM(e,t={}){return aM(e,`Uncapitalize`,t)}function lM(e,t={}){return aM(e,`Uppercase`,t)}function uM(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=bM(e[i],t,cw(n));return r}function dM(e,t,n){return uM(e.properties,t,n)}function fM(e,t,n){return zE(dM(e,t,n))}function pM(e,t){return e.map(e=>yM(e,t))}function mM(e,t){return e.map(e=>yM(e,t))}function hM(e,t){let{[t]:n,...r}=e;return r}function gM(e,t){return t.reduce((e,t)=>hM(e,t),e)}function _M(e,t,n){let r=LE(e,[Sw,`$id`,`required`,`properties`]);return lO(gM(n,t),r)}function vM(e){return JE(e.reduce((e,t)=>Hw(t)?[...e,SD(t)]:e,[]))}function yM(e,t){return zw(e)?HO(pM(e.allOf,t)):cT(e)?JE(mM(e.anyOf,t)):Xw(e)?_M(e,t,e.properties):lO({})}function bM(e,t,n){let r=HC(t)?vM(t):t,i=mT(t)?BD(t):t,a=$w(e),o=$w(t);return Gw(e)?fM(e,i,n):Ww(t)?wM(e,t,n):a&&o||!a&&o||a&&!o?FE(`Omit`,[e,r],n):K({...yM(e,i),...n})}function xM(e,t,n){return{[t]:bM(e,[t],cw(n))}}function SM(e,t,n){return t.reduce((t,r)=>({...t,...xM(e,r,n)}),{})}function CM(e,t,n){return SM(e,t.keys,n)}function wM(e,t,n){return zE(CM(e,t,n))}function TM(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=PM(e[i],t,cw(n));return r}function EM(e,t,n){return TM(e.properties,t,n)}function DM(e,t,n){return zE(EM(e,t,n))}function OM(e,t){return e.map(e=>NM(e,t))}function kM(e,t){return e.map(e=>NM(e,t))}function AM(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function jM(e,t,n){let r=LE(e,[Sw,`$id`,`required`,`properties`]);return lO(AM(n,t),r)}function MM(e){return JE(e.reduce((e,t)=>Hw(t)?[...e,SD(t)]:e,[]))}function NM(e,t){return zw(e)?HO(OM(e.allOf,t)):cT(e)?JE(kM(e.anyOf,t)):Xw(e)?jM(e,t,e.properties):lO({})}function PM(e,t,n){let r=HC(t)?MM(t):t,i=mT(t)?BD(t):t,a=$w(e),o=$w(t);return Gw(e)?DM(e,i,n):Ww(t)?RM(e,t,n):a&&o||!a&&o||a&&!o?FE(`Pick`,[e,r],n):K({...NM(e,i),...n})}function FM(e,t,n){return{[t]:PM(e,[t],cw(n))}}function IM(e,t,n){return t.reduce((t,r)=>({...t,...FM(e,r,n)}),{})}function LM(e,t,n){return IM(e,t.keys,n)}function RM(e,t,n){return zE(LM(e,t,n))}function zM(e,t){return FE(`Partial`,[FE(e,t)])}function BM(e){return FE(`Partial`,[UO(e)])}function VM(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=MO(e[n]);return t}function HM(e,t){let n=LE(e,[Sw,`$id`,`required`,`properties`]);return lO(VM(t),n)}function UM(e){return e.map(e=>WM(e))}function WM(e){return Pw(e)?zM(e.target,e.parameters):$w(e)?BM(e.$ref):zw(e)?HO(UM(e.allOf)):cT(e)?JE(UM(e.anyOf)):Xw(e)?HM(e,e.properties):Mw(e)||Nw(e)||Rw(e)||Uw(e)||Jw(e)||Yw(e)||tT(e)||nT(e)||sT(e)?e:lO({})}function GM(e,t){return Gw(e)?JM(e,t):K({...WM(e),...t})}function KM(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=GM(e[r],cw(t));return n}function qM(e,t){return KM(e.properties,t)}function JM(e,t){return zE(qM(e,t))}function YM(e,t){return FE(`Required`,[FE(e,t)])}function XM(e){return FE(`Required`,[UO(e)])}function ZM(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=LE(e[n],[ww]);return t}function QM(e,t){let n=LE(e,[Sw,`$id`,`required`,`properties`]);return lO(ZM(t),n)}function $M(e){return e.map(e=>eN(e))}function eN(e){return Pw(e)?YM(e.target,e.parameters):$w(e)?XM(e.$ref):zw(e)?HO($M(e.allOf)):cT(e)?JE($M(e.anyOf)):Xw(e)?QM(e,e.properties):Mw(e)||Nw(e)||Rw(e)||Uw(e)||Jw(e)||Yw(e)||tT(e)||nT(e)||sT(e)?e:lO({})}function tN(e,t){return Gw(e)?iN(e,t):K({...eN(e),...t})}function nN(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=tN(e[r],t);return n}function rN(e,t){return nN(e.properties,t)}function iN(e,t){return zE(rN(e,t))}function aN(e,t){return t.map(t=>$w(t)?oN(e,t.$ref):DN(e,t))}function oN(e,t){return t in e?$w(e[t])?oN(e,e[t].$ref):DN(e,e[t]):RE()}function sN(e){return XO(e[0])}function cN(e){return tO(e[0],e[1])}function lN(e){return uk(e[0])}function uN(e){return GM(e[0])}function dN(e){return bM(e[0],e[1])}function fN(e){return PM(e[0],e[1])}function pN(e){return tN(e[0])}function mN(e,t,n){let r=aN(e,n);return t===`Awaited`?sN(r):t===`Index`?cN(r):t===`KeyOf`?lN(r):t===`Partial`?uN(r):t===`Omit`?dN(r):t===`Pick`?fN(r):t===`Required`?pN(r):RE()}function hN(e,t){return ME(DN(e,t))}function gN(e,t){return PE(DN(e,t))}function _N(e,t,n){return BE(EN(e,t),DN(e,n))}function vN(e,t,n){return VE(EN(e,t),DN(e,n))}function yN(e,t){return HO(EN(e,t))}function bN(e,t){return oO(DN(e,t))}function xN(e,t){return lO(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:DN(e,t[r])}),{}))}function SN(e,t){let[n,r]=[DN(e,kj(t)),Dj(t)],i=lw(t);return i.patternProperties[r]=n,i}function CN(e,t){return $w(t)?{...oN(e,t.$ref),[Sw]:t[Sw]}:t}function wN(e,t){return vO(EN(e,t))}function TN(e,t){return JE(EN(e,t))}function EN(e,t){return t.map(t=>DN(e,t))}function DN(e,t){return Dw(t)?K(DN(e,LE(t,[ww])),t):Ew(t)?K(DN(e,LE(t,[Cw])),t):aT(t)?K(CN(e,t),t):Aw(t)?K(hN(e,t.items),t):jw(t)?K(gN(e,t.items),t):Pw(t)?K(mN(e,t.target,t.parameters)):Fw(t)?K(_N(e,t.parameters,t.returns),t):Lw(t)?K(vN(e,t.parameters,t.returns),t):zw(t)?K(yN(e,t.allOf),t):Bw(t)?K(bN(e,t.items),t):Xw(t)?K(xN(e,t.properties),t):Qw(t)?K(SN(e,t)):oT(t)?K(wN(e,t.items||[]),t):cT(t)?K(TN(e,t.anyOf),t):t}function ON(e,t){return t in e?DN(e,e[t]):RE()}function kN(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:ON(e,n)}),{})}var AN=class{constructor(e){let t=kN(e),n=this.WithIdentifiers(t);this.$defs=n}Import(e,t){let n={...this.$defs,[e]:K(this.$defs[e],t)};return K({[q]:`Import`,$defs:n,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:{...e[n],$id:n}}),{})}};function jN(e){return new AN(e)}function MN(e,t){return K({[q]:`Not`,not:e},t)}function NN(e,t){return Lw(e)?vO(e.parameters,t):RE()}var PN=0;function FN(e,t={}){tw(t.$id)&&(t.$id=`T${PN++}`);let n=lw(e({[q]:`This`,$ref:`${t.$id}`}));return n.$id=t.$id,K({[Tw]:`Recursive`,...n},t)}function IN(e,t){let n=QC(e)?new globalThis.RegExp(e):e;return K({[q]:`RegExp`,type:`RegExp`,source:n.source,flags:n.flags},t)}function LN(e){return zw(e)?e.allOf:cT(e)?e.anyOf:oT(e)?e.items??[]:[]}function RN(e){return LN(e)}function zN(e,t){return Lw(e)?K(e.returns,t):RE(t)}var BN=class{constructor(e){this.schema=e}Decode(e){return new VN(this.schema,e)}},VN=class{constructor(e,t){this.schema=e,this.decode=t}EncodeTransform(e,t){let n={Encode:n=>t[Sw].Encode(e(n)),Decode:e=>this.decode(t[Sw].Decode(e))};return{...t,[Sw]:n}}EncodeSchema(e,t){let n={Decode:this.decode,Encode:e};return{...t,[Sw]:n}}Encode(e){return aT(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};function HN(e){return new BN(e)}function UN(e={}){return K({[q]:e[q]??`Unsafe`},e)}function WN(e){return K({[q]:`Void`,type:`void`},e)}var Y=s({Any:()=>jE,Argument:()=>NE,Array:()=>ME,AsyncIterator:()=>PE,Awaited:()=>XO,BigInt:()=>wD,Boolean:()=>CD,Capitalize:()=>oM,Composite:()=>vk,Const:()=>kk,Constructor:()=>BE,ConstructorParameters:()=>Ak,Date:()=>yk,Enum:()=>jk,Exclude:()=>nj,Extends:()=>YA,Extract:()=>cj,Function:()=>VE,Index:()=>tO,InstanceType:()=>fj,Instantiate:()=>Kj,Integer:()=>qj,Intersect:()=>HO,Iterator:()=>oO,KeyOf:()=>uk,Literal:()=>SD,Lowercase:()=>sM,Mapped:()=>OO,Module:()=>jN,Never:()=>RE,Not:()=>MN,Null:()=>bk,Number:()=>TD,Object:()=>lO,Omit:()=>bM,Optional:()=>MO,Parameters:()=>NN,Partial:()=>GM,Pick:()=>PM,Promise:()=>uO,Readonly:()=>mO,ReadonlyOptional:()=>pj,Record:()=>Ej,Recursive:()=>FN,Ref:()=>UO,RegExp:()=>IN,Required:()=>tN,Rest:()=>RN,ReturnType:()=>zN,String:()=>ED,Symbol:()=>xk,TemplateLiteral:()=>ID,Transform:()=>HN,Tuple:()=>vO,Uint8Array:()=>Ck,Uncapitalize:()=>cM,Undefined:()=>Sk,Union:()=>JE,Unknown:()=>wk,Unsafe:()=>UN,Uppercase:()=>lM,Void:()=>WN});function GN(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function KN(e,t){return Y.String({pattern:`^${GN(e)}${Ft}$`,...t===void 0?{}:{description:t}})}var X=Y.String({minLength:1,description:`ISO 8601 date-time string`}),qN=Y.String({minLength:1});KN(Lt.project,`ProjectId`);var JN=KN(Lt.message,`MessageId`),YN=KN(Lt.taskModule,`TaskModuleId`),XN=KN(Lt.task,`TaskId`),ZN=KN(Lt.runResult,`RunResultId`),QN=KN(Lt.recoverySummary,`RecoverySummaryId`),$N=KN(Lt.activity,`ActivityRef`),eP=KN(Lt.event,`EventRef`),tP=KN(Lt.workflowInvocation,`WorkflowInvocationRef`),nP=KN(Lt.clarificationThread,`ClarificationThreadRef`),rP=KN(Lt.clarificationRound,`ClarificationRoundRef`);KN(Lt.clarificationInteractionResponse,`ClarificationInteractionResponseId`);var iP=KN(Lt.approvalRequest,`ApprovalRequestId`),aP=KN(Lt.idempotency,`IdempotencyKey`),oP=KN(Lt.relayProject,`RelayProjectRef`);KN(Lt.relayAccount,`RelayAccountRef`),KN(Lt.relayMembership,`RelayMembershipRef`),KN(Lt.relayAccountSession,`RelayAccountSessionRef`),KN(Lt.relayClientSession,`RelayClientSessionId`);var sP=KN(Lt.relayUpload,`RelayUploadRef`);KN(Lt.relayAuthChallenge,`RelayAuthChallengeRef`),KN(Lt.hostConnection,`HostConnectionRef`),KN(Lt.joinToken,`JoinTokenRef`);var cP=Y.Union([Y.Literal(`project_context_bootstrap`),Y.Literal(`scratchpad_refresh`),Y.Literal(`task_compile`),Y.Literal(`context_sync`),Y.Literal(`reference_summary_refresh`),Y.Literal(`recovery_check`),Y.Literal(`follow_up_check`)]);Y.Object({cursor:Y.Optional(qN),limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50}))},{additionalProperties:!1});function lP(e){return Y.Object({items:Y.Array(e),page:Y.Object({next_cursor:Y.Optional(qN),has_more:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:200})},{additionalProperties:!1})},{additionalProperties:!1})}function uP(e){return Y.Object({items:Y.Array(e),window:Y.Object({older_cursor:Y.Optional(qN),newer_cursor:Y.Optional(qN),has_older:Y.Boolean(),has_newer:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:200})},{additionalProperties:!1})},{additionalProperties:!1})}var dP=Y.Union([Y.Object({kind:Y.Literal(`all`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`workspace`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`session`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`bootstrap`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`messages`),scope:Y.Literal(`main_chat`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`messages`),scope:Y.Literal(`clarification_round`),round_id:rP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`scratchpad`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`worklist`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`read_state`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task`),task_id:XN},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task_detail`),task_id:XN},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task_run_results`),task_id:XN},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification`),thread_id:Y.Optional(nP),round_id:Y.Optional(rP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`execution_status`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`activity`),activity_ref:$N},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_config`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_usage`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project_timeline`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`skills`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`artifacts`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`approval`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`viewer`),path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`recovery_summaries`)},{additionalProperties:!1})]);Y.Object({kind:Y.String({minLength:1})});var fP=Y.Object({kind:Y.Literal(`interrupted`),retry_with_new_command_id:Y.Literal(!0)},{additionalProperties:!1});function pP(e){return Y.Object({command_id:aP,issued_at:X,payload:e},{additionalProperties:!1})}function mP(e){return Y.Object({command_id:aP,disposition:e,invalidates:Y.Optional(Y.Array(dP))},{additionalProperties:!1})}function hP(e,t){return Y.Object({command_id:aP,disposition:e,result:Y.Optional(t),invalidates:Y.Optional(Y.Array(dP))},{additionalProperties:!1})}var gP=Y.Union([Y.Literal(`bad_request`),Y.Literal(`unauthorized`),Y.Literal(`forbidden`),Y.Literal(`not_found`),Y.Literal(`conflict`),Y.Literal(`validation_failed`),Y.Literal(`provider_not_configured`),Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`),Y.Literal(`relay_session_invalid`),Y.Literal(`command_replay_mismatch`),Y.Literal(`repo_snapshot_unavailable`),Y.Literal(`host_unavailable`),Y.Literal(`internal_error`)]);Y.Object({error:Y.Object({code:gP,message:Y.String({minLength:1}),retryable:Y.Boolean(),details:Y.Optional(Y.Unknown())},{additionalProperties:!1})},{additionalProperties:!1}),Y.Union([Y.Literal(`connection.ready`),Y.Literal(`message.created`),Y.Literal(`scratchpad.updated`),Y.Literal(`worklist.changed`),Y.Literal(`task.updated`),Y.Literal(`task_detail.updated`),Y.Literal(`clarification.changed`),Y.Literal(`approval.changed`),Y.Literal(`activity.event`),Y.Literal(`execution_status.changed`),Y.Literal(`provider_config.changed`),Y.Literal(`workspace.recovered`),Y.Literal(`query.invalidate`)]),Y.Union([Y.Object({kind:Y.Literal(`all`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`me`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`recent_projects`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`join_entries`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project_presence`),relay_project_ref:oP},{additionalProperties:!1})]),Y.Union([Y.Literal(`connection.ready`),Y.Literal(`query.invalidate`)]);var _P=Y.Object({retention_seconds:Y.Literal(300),max_events:Y.Literal(1e3)},{additionalProperties:!1}),Z=Y.String({minLength:1}),vP=Y.Union([Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`),Y.Literal(`unknown`)]),yP=vP,bP=Y.Union([Y.Object({status:Y.Literal(`not_configured`)},{additionalProperties:!1}),Y.Object({status:Y.Literal(`configured`),provider:Y.Literal(`openai`),auth_kind:Y.Literal(`api_key`),redacted_key:Z,default_model:Z,validated_at:X},{additionalProperties:!1}),Y.Object({status:Y.Literal(`invalid`),provider:Y.Optional(Y.Literal(`openai`)),auth_kind:Y.Optional(Y.Literal(`api_key`)),redacted_key:Y.Optional(Z),default_model:Y.Optional(Z),validated_at:Y.Optional(X),invalid_reason_code:Y.Optional(vP)},{additionalProperties:!1})]),xP=Y.Union([Y.Literal(`implementation`),Y.Literal(`planning`),Y.Literal(`context`),Y.Literal(`qna`),Y.Literal(`other`)]),SP=Y.Object({input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),CP=Y.Object({source:Y.String({minLength:1}),label:Y.String({minLength:1}),category:xP,input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),wP=Y.Object({model:Y.String({minLength:1}),input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),TP=Y.Object({total_tokens:Y.Integer({minimum:0}),totals:SP,by_source:Y.Array(CP),by_model:Y.Array(wP),recent_windows:Y.Object({today:SP,last_7_days:SP,last_30_days:SP},{additionalProperties:!1})},{additionalProperties:!1}),EP=Y.Union([Y.Literal(`task_accepted`),Y.Literal(`task_update`),Y.Literal(`checkpoint`)]),DP=Y.Union([Y.Literal(`completed`),Y.Literal(`failed`),Y.Literal(`needs_human`)]),OP=Y.Union([Y.Literal(`needs_input`),Y.Literal(`completed`),Y.Literal(`failed`)]),kP=Y.Union([Y.Literal(`neutral`),Y.Literal(`success`),Y.Literal(`warning`),Y.Literal(`error`)]),AP=Y.Object({kind:Y.Union([Y.Literal(`worklist_task`),Y.Literal(`chat_message`),Y.Literal(`reference_file`),Y.Literal(`repo_path`)]),label:Y.String({minLength:1}),task_id:Y.Optional(XN),message_id:Y.Optional(JN),path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1}),jP=Y.Object({message_id:JN,author:Y.String({minLength:1}),body:Y.String(),created_at:X},{additionalProperties:!1}),MP=Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.String({minLength:1}),source:Y.Optional(Y.Union([Y.Literal(`scratchpad`),Y.Literal(`clarification`),Y.Literal(`contract`)]))},{additionalProperties:!1}),NP=Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),request:Y.Optional(Y.String()),status:Y.Optional(Y.Union([Y.Literal(`active`),Y.Literal(`resolved`)])),answer_count:Y.Optional(Y.Integer({minimum:0})),answers:Y.Optional(Y.Array(jP))},{additionalProperties:!1}),PP=Y.Union([Y.Literal(`added`),Y.Literal(`modified`),Y.Literal(`deleted`),Y.Literal(`renamed`),Y.Literal(`unknown`)]),FP=Y.Object({tone:kP,summary:Y.Optional(Y.String()),origin:Y.Optional(Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),snippets:Y.Optional(Y.Array(jP)),source_count:Y.Optional(Y.Integer({minimum:0})),unavailable_reason:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),decisions:Y.Optional(Y.Array(MP)),clarification:Y.Optional(NP),contract:Y.Optional(Y.Object({goal:Y.String(),scope:Y.Array(Y.String()),truncated:Y.Optional(Y.Boolean())},{additionalProperties:!1})),result:Y.Optional(Y.Object({summary:Y.String(),error_code:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),changes:Y.Optional(Y.Object({items:Y.Array(Y.Object({status:PP,path:Y.String({minLength:1}),previous_path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),total_count:Y.Integer({minimum:0}),truncated:Y.Boolean()},{additionalProperties:!1})),verification:Y.Optional(Y.Object({checks:Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)]),skip_reason_code:Y.Optional(Y.String({minLength:1})),skip_reason_summary:Y.Optional(Y.String())},{additionalProperties:!1})),promotion:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`promoted`),Y.Literal(`not_promoted`),Y.Literal(`not_attempted`)]),commit_oid:Y.Optional(Y.String({minLength:1})),commit_short_oid:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),reason_code:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),checkpoint:Y.Optional(Y.Object({counters:Y.Object({completed:Y.Integer({minimum:0}),failed:Y.Integer({minimum:0}),remaining:Y.Integer({minimum:0})},{additionalProperties:!1}),items:Y.Array(Y.Object({task_id:XN,title:Y.String({minLength:1}),status:Y.Union([Y.Literal(`done`),Y.Literal(`failed`)]),summary:Y.String()},{additionalProperties:!1})),generated_files:Y.Optional(Y.Array(Y.Object({path:Y.String({minLength:1}),name:Y.String({minLength:1})},{additionalProperties:!1}))),truncated:Y.Optional(Y.Boolean())},{additionalProperties:!1})),links:Y.Array(AP)},{additionalProperties:!1}),IP=Y.Object({id:Y.String({minLength:1}),kind:EP,occurred_at:X,title:Y.String({minLength:1}),summary:Y.Optional(Y.String()),task_id:Y.Optional(XN),task_title:Y.Optional(Y.String({minLength:1})),activity_ref:Y.Optional($N),workflow_ref:Y.Optional(tP),run_result_id:Y.Optional(ZN),message_id:Y.Optional(JN),status:Y.Optional(DP),update_state:Y.Optional(OP),token_usage:Y.Optional(SP),usage_sources:Y.Optional(Y.Array(CP)),usage_models:Y.Optional(Y.Array(wP)),trace_card:Y.Optional(FP)},{additionalProperties:!1});Y.Object({generated_at:X,usage_overview:TP,items:Y.Array(IP)},{additionalProperties:!1});var LP=10*1024*1024,RP=50*1024*1024,zP=RP,BP=Y.Union([Y.Literal(`reference_file`),Y.Literal(`skill_zip`)]),VP=Y.String({pattern:`^sha256:[a-f0-9]{64}$`});function HP(e){return{upload_id:sP,file_name:Z,size_bytes:Y.Integer({minimum:1,maximum:e}),sha256:VP,media_type:Y.Optional(Z)}}function UP(e){return e===`skill_zip`?RP:LP}var WP=HP(zP),GP=HP(LP),KP=HP(RP),qP={relay_project_ref:oP,file_name:Z,sha256:VP,media_type:Y.Optional(Z)},JP=Y.Object({...qP,purpose:Y.Literal(`reference_file`),size_bytes:Y.Integer({minimum:1,maximum:LP})},{additionalProperties:!1}),YP=Y.Object({...qP,purpose:Y.Literal(`skill_zip`),size_bytes:Y.Integer({minimum:1,maximum:RP})},{additionalProperties:!1});Y.Object(WP,{additionalProperties:!1});var XP=Y.Union([JP,YP]),ZP=Y.Object({upload_id:sP,relay_project_ref:oP,purpose:BP,file_name:Z,size_bytes:Y.Integer({minimum:1,maximum:zP}),sha256:VP,media_type:Y.Optional(Z),expires_at:X},{additionalProperties:!1}),QP=Y.Object({method:Y.Literal(`PUT`),url:Y.String({minLength:1}),headers:Y.Optional(Y.Record(Y.String({minLength:1}),Y.String()))},{additionalProperties:!1}),$P=Y.Union([Y.Object({kind:Y.Literal(`started`)},{additionalProperties:!1})]),eF=Y.Object({upload:ZP,put:QP},{additionalProperties:!1});pP(XP),hP($P,eF);var tF=Y.Union([Y.Literal(`chat`),Y.Literal(`worklist`),Y.Literal(`references`),Y.Literal(`skills`)]),nF=Y.Object({scope:tF,latest_event_cursor:Y.Integer({minimum:0}),read_event_cursor:Y.Integer({minimum:0}),has_unread:Y.Boolean(),updated_at:Y.Optional(X)},{additionalProperties:!1}),rF=Y.Object({generated_at:X,scopes:Y.Object({chat:nF,worklist:nF,references:nF,skills:nF},{additionalProperties:!1})},{additionalProperties:!1}),iF=Y.Object({scope:tF,up_to_event_cursor:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1}),aF=Y.Union([Y.Object({kind:Y.Literal(`marked`)},{additionalProperties:!1}),fP]),oF=Y.Object({read_state:rF},{additionalProperties:!1});pP(iF),hP(aF,oF);var sF=Y.Object({attempt:Y.Integer({minimum:1}),kind:Y.Union([Y.Literal(`initial`),Y.Literal(`continuation`),Y.Literal(`retry`)]),parent_activity_ref:Y.Optional($N),root_activity_ref:Y.Optional($N)},{additionalProperties:!1}),cF=Y.Union([Y.Object({kind:Y.Literal(`task`),task_id:XN},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`workflow`),workflow_ref:tP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification_round`),clarification_round_ref:rP},{additionalProperties:!1})]),lF=Y.Union([Y.Literal(`todo`),Y.Literal(`running`),Y.Literal(`pending`),Y.Literal(`done`),Y.Literal(`failed`)]),uF=Y.Object({task_id:XN,title:Z,summary:Y.String(),status:lF,module_id:YN,module_name:Z},{additionalProperties:!1}),dF=Y.Object({workflow_ref:tP,activity_ref:$N,topic:Y.String(),background_summary:Y.String(),current_consensus:Y.Array(Y.String()),open_questions:Y.Array(Y.String()),task_changes:Y.Array(Y.String()),submitted_at:X,compiled_tasks:Y.Optional(Y.Array(uF))},{additionalProperties:!1}),fF=Y.Object({id:Y.Literal(`current`),state:Y.Union([Y.Literal(`empty`),Y.Literal(`ready`),Y.Literal(`submitted`)]),topic:Y.String(),background_summary:Y.String(),current_consensus:Y.Array(Y.String()),open_questions:Y.Array(Y.String()),task_changes:Y.Array(Y.String()),updated_by_activity_ref:Y.Optional($N),updated_at:Y.Optional(X),submitted_by_activity_ref:Y.Optional($N),submitted_by_workflow_ref:Y.Optional(tP),submitted_at:Y.Optional(X),receipts:Y.Array(dF)},{additionalProperties:!1}),pF=Y.Object({id:YN,name:Z,summary:Y.Optional(Y.String()),order:Y.Integer(),archived:Y.Boolean(),created_at:X,updated_at:Y.Optional(X)},{additionalProperties:!1}),mF=Y.Object({id:XN,module_id:YN,title:Z,summary:Y.String(),status:lF,order:Y.Integer(),current_activity_ref:Y.Optional($N),active_clarification_thread_ref:Y.Optional(nP),latest_run_result_id:Y.Optional(ZN),created_from_workflow_ref:tP,created_at:X,updated_at:X},{additionalProperties:!1});Y.Object({modules:Y.Array(Y.Object({module:pF,tasks:Y.Array(mF)},{additionalProperties:!1})),updated_at:Y.Optional(X)},{additionalProperties:!1});var hF=Y.Object({goal:Y.String(),scope:Y.Array(Y.String())},{additionalProperties:!1}),gF=Y.Union([Y.Literal(`no_validation_command_found`),Y.Literal(`project_has_no_test_setup`),Y.Literal(`validation_not_applicable`),Y.Literal(`command_prerequisite_missing`),Y.Literal(`command_requires_external_service`),Y.Literal(`command_requires_secret`),Y.Literal(`command_requires_interactive_input`),Y.Literal(`command_too_expensive_for_mvp`),Y.Literal(`unsafe_command_blocked`),Y.Literal(`known_failing_baseline`)]),_F=Y.Object({status:Y.Union([Y.Literal(`succeeded`),Y.Literal(`failed`),Y.Literal(`unknown`)]),target:Y.Optional(Z),redacted_summary:Y.String(),started_at:Y.Optional(X),finished_at:Y.Optional(X)},{additionalProperties:!1}),vF=Y.Object({latest_run_result_id:Y.Optional(ZN),result_kind:Y.Optional(Y.Union([Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`)])),run_lineage:Y.Optional(sF),clarification_thread_ref:Y.Optional(nP),outcome:Y.Optional(Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)])),summary:Y.Optional(Y.String()),checks:Y.Optional(Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)])),docs:Y.Optional(Y.Union([Y.Literal(`updated`),Y.Literal(`checked_no_change`),Y.Literal(`not_checked`),Y.Literal(`sync_deferred`)])),skip_reason_code:Y.Optional(gF),skip_reason_summary:Y.Optional(Y.String()),external_side_effects:Y.Optional(Y.Array(_F)),changed_paths:Y.Optional(Y.Array(Y.String())),user_note_candidate:Y.Optional(Y.String()),promotion:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`promoted`),Y.Literal(`not_promoted`),Y.Literal(`not_attempted`)]),summary:Y.Optional(Y.String()),reason_code:Y.Optional(Z),commit_oid:Y.Optional(Z)},{additionalProperties:!1})),error_code:Y.Optional(Z),retryable:Y.Optional(Y.Boolean()),updated_at:Y.Optional(X)},{additionalProperties:!1}),yF=Y.Object({task:mF,detail:Y.Object({task_id:XN,contract:hF,result:vF,frozen_contract_since_activity_ref:Y.Optional($N),updated_at:X},{additionalProperties:!1})},{additionalProperties:!1});lP(Y.Union([Y.Object({id:ZN,activity_ref:$N,task_id:XN,run_lineage:sF,result_kind:Y.Literal(`needs_human`),summary:Y.String(),clarification_thread_ref:nP,created_at:X},{additionalProperties:!1}),Y.Object({id:ZN,activity_ref:$N,task_id:XN,run_lineage:sF,result_kind:Y.Literal(`finished`),outcome:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),summary:Y.String(),user_note_candidate:Y.Optional(Y.String()),checks:Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)]),docs:Y.Union([Y.Literal(`updated`),Y.Literal(`checked_no_change`),Y.Literal(`not_checked`),Y.Literal(`sync_deferred`)]),skip_reason_code:Y.Optional(gF),skip_reason_summary:Y.Optional(Y.String()),external_side_effects:Y.Optional(Y.Array(_F)),created_at:X},{additionalProperties:!1}),Y.Object({id:ZN,activity_ref:$N,task_id:XN,run_lineage:sF,result_kind:Y.Literal(`failed`),summary:Y.String(),error_code:Z,retryable:Y.Boolean(),created_at:X},{additionalProperties:!1})]));var bF=Y.Object({recovery_summary_id:QN,summary:Y.String({minLength:1}),affected_activities:Y.Array($N),affected_activity_count:Y.Integer({minimum:0}),created_at:X},{additionalProperties:!1});lP(bF),Y.Object({recovery_summary:bF},{additionalProperties:!1});var xF=Y.Union(or.map(e=>Y.Literal(e))),SF=Y.Union([Y.Object({kind:Y.Literal(`initials`),initials:Y.String({minLength:1}),color:xF},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`image`),image_url:Y.String({minLength:1}),initials:Y.String({minLength:1}),color:xF},{additionalProperties:!1})]),CF=Y.Union([Y.Object({kind:Y.Literal(`main_chat`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification_round`),clarification_round_ref:rP},{additionalProperties:!1})]),wF=Y.Object({kind:Y.Union([Y.Literal(`human`),Y.Literal(`system`),Y.Literal(`agent`)]),ref:Y.Optional(Z),display_name:Y.Optional(Z),avatar:Y.Optional(SF)},{additionalProperties:!1}),TF=Y.Union([Y.Literal(`user_text`),Y.Literal(`agent_text`),Y.Literal(`system_notice`),Y.Literal(`clarification_request`),Y.Literal(`clarification_card`)]),EF=Y.Union([Y.Literal(`file`),Y.Literal(`image`)]),DF=Y.Object({path:Y.String({minLength:1}),name:Z,source:Y.Union([Y.Literal(`human_upload`),Y.Literal(`tutti_output`)]),category:EF,blob_oid:Y.Optional(Z),media_type:Y.Optional(Z),size_bytes:Y.Integer({minimum:0}),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(Y.Union([Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unsupported_encoding`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`unknown`)]))},{additionalProperties:!1})},{additionalProperties:!1}),OF=Y.Object({task_id:XN,title:Z,status:Y.Union([Y.Literal(`done`),Y.Literal(`failed`)]),summary:Y.String(),module_name:Y.Optional(Z),latest_run_result_id:Y.Optional(ZN)},{additionalProperties:!1}),kF=Y.Object({path:Y.String({minLength:1}),name:Z,group:Y.Optional(Z),size_bytes:Y.Integer({minimum:0}),media_type:Y.Optional(Z)},{additionalProperties:!1}),AF=Y.Object({kind:Y.Literal(`worklist_terminal`),status:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),reason:Y.Union([Y.Literal(`all_tasks_done`),Y.Literal(`run_failed`)]),title:Z,feedback_key:Z,counters:Y.Object({completed:Y.Integer({minimum:0}),failed:Y.Integer({minimum:0}),remaining:Y.Integer({minimum:0})},{additionalProperties:!1}),items:Y.Array(OF),final_note:Y.Optional(Y.String()),generated_files:Y.Optional(Y.Array(kF)),primary_task_id:Y.Optional(XN)},{additionalProperties:!1}),jF=Y.Object({kind:Y.Literal(`task_result`),status:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),title:Z,task_id:XN,task_title:Z,result_key:Z,summary:Y.String(),module_name:Y.Optional(Z),latest_run_result_id:Y.Optional(ZN),activity_ref:Y.Optional($N),final_note:Y.Optional(Y.String()),generated_files:Y.Optional(Y.Array(kF)),error_code:Y.Optional(Z)},{additionalProperties:!1}),MF=Y.Object({kind:Y.Literal(`worklist_compile`),workflow_ref:tP,title:Z,task_count:Y.Integer({minimum:0}),tasks:Y.Array(uF)},{additionalProperties:!1}),NF=Y.Object({kind:Y.Literal(`artifact_preview`),title:Z,status:Y.Union([Y.Literal(`available`),Y.Literal(`updated`)]),task_id:Y.Optional(XN),run_result_id:Y.Optional(ZN)},{additionalProperties:!1}),PF=Y.Object({task_id:Y.Optional(XN),activity_ref:Y.Optional($N),workflow_ref:Y.Optional(tP),clarification_thread_ref:Y.Optional(nP),clarification_round_ref:Y.Optional(rP),scratchpad_source:Y.Optional(Y.Union([Y.Literal(`include`),Y.Literal(`exclude`)])),reference_file:Y.Optional(DF),worklist_compile:Y.Optional(MF),worklist_feedback:Y.Optional(AF),task_result:Y.Optional(jF),artifact_preview:Y.Optional(NF)},{additionalProperties:!1}),FF=Y.Object({id:JN,scope:CF,author:wF,message_kind:TF,body:Y.String(),refs:Y.Optional(PF),clarification_card:Y.Optional(Y.Object({thread_id:nP,round_id:rP,title:Y.Optional(Z),summary:Z,status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),is_current_round:Y.Boolean()},{additionalProperties:!1})),created_at:X},{additionalProperties:!1});uP(FF);var IF=Y.Object({body:Y.String({minLength:1,maxLength:8e3})},{additionalProperties:!1}),LF=Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),RF=Y.Union([LF,fP]),zF=Y.Object({message:FF},{additionalProperties:!1});Y.Object({limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50})),anchor:Y.Optional(Y.Union([Y.Literal(`latest`),Y.Literal(`start`)])),before:Y.Optional(qN),after:Y.Optional(qN),around:Y.Optional(JN)},{additionalProperties:!1}),pP(IF),hP(RF,zF),Y.Object({message:FF},{additionalProperties:!1});var BF=Y.Union([Y.Literal(`command_execution`),Y.Literal(`file_change`),Y.Literal(`permissions`),Y.Literal(`legacy_exec_command`),Y.Literal(`legacy_apply_patch`)]),VF=Y.Union([Y.Literal(`allow_once`),Y.Literal(`allow_session`),Y.Literal(`deny`),Y.Literal(`cancel`)]),HF=Y.Union([Y.Literal(`primary`),Y.Literal(`neutral`),Y.Literal(`danger`)]),UF=Y.Object({decision_id:Z,kind:VF,label:Z,tone:HF},{additionalProperties:!1}),WF=Y.Object({text:Z,cwd_label:Y.Optional(Z),actions:Y.Optional(Y.Array(Y.Object({label:Z,detail:Y.Optional(Z)},{additionalProperties:!1}))),network:Y.Optional(Y.Object({host:Z,protocol:Z},{additionalProperties:!1}))},{additionalProperties:!1}),GF=Y.Object({grant_root_label:Y.Optional(Z),paths:Y.Optional(Y.Array(Z))},{additionalProperties:!1}),KF=Y.Object({network:Y.Optional(Y.Object({enabled:Y.Boolean()},{additionalProperties:!1})),filesystem:Y.Optional(Y.Object({read:Y.Optional(Y.Array(Z)),write:Y.Optional(Y.Array(Z))},{additionalProperties:!1}))},{additionalProperties:!1}),qF=Y.Object({approval_id:iP,request_kind:BF,title:Z,summary:Z,reason:Y.Optional(Z),requested_at:X,expires_at:Y.Optional(X),task_id:Y.Optional(XN),activity_ref:Y.Optional($N),command:Y.Optional(WF),file_change:Y.Optional(GF),permissions:Y.Optional(KF),decisions:Y.Array(UF,{minItems:1})},{additionalProperties:!1}),JF=Y.Union([Y.Literal(`accepted`),Y.Literal(`declined`),Y.Literal(`cancelled`),Y.Literal(`expired`)]),YF=Y.Object({decision_id:Z,label:Z,outcome:JF,decided_at:X,decided_by:Y.Optional(Y.Object({account_ref:Z,display_name:Z},{additionalProperties:!1}))},{additionalProperties:!1}),XF=Y.Union([Y.Object({state:Y.Literal(`none`)},{additionalProperties:!1}),Y.Object({state:Y.Literal(`pending`),request:qF},{additionalProperties:!1}),Y.Object({state:Y.Literal(`resolved`),request:qF,resolution:YF},{additionalProperties:!1})]),ZF=Y.Object({decision_id:Z},{additionalProperties:!1}),QF=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_approval`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`decision_unavailable`)},{additionalProperties:!1}),fP]),$F=Y.Object({approval:Y.Optional(XF)},{additionalProperties:!1});pP(ZF),hP(QF,$F);var eI=Y.Union([Y.Object({ref_kind:Y.Literal(`project_doc`),path:Z},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`directory_readme`),path:Z},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`task_detail`),task_id:XN},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`worklist`),module_id:Y.Optional(YN),task_id:Y.Optional(XN)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`scratchpad`),id:Y.Literal(`current`)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`clarification_round`),clarification_round_ref:rP},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`chat_messages`),message_refs:Y.Array(JN)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`repo_paths`),paths:Y.Array(Z)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`recovery_summary`),recovery_summary_id:QN},{additionalProperties:!1})]),tI=Y.Object({kind:Y.Literal(`freeform`),purpose:Y.Union([Y.Literal(`clarify_requirement`),Y.Literal(`confirm_risk`)]),prompt:Y.Object({title:Y.Optional(Z),summary:Z,request:Z},{additionalProperties:!1}),subject:Y.Optional(Y.Object({kind:Y.Union([Y.Literal(`task`),Y.Literal(`deployment_target`),Y.Literal(`project_context`)]),ref:Y.Optional(Z),summary:Z},{additionalProperties:!1})),expires_when:Y.Optional(Y.Union([Y.Literal(`current_run_only`),Y.Literal(`until_task_contract_changes`)]))},{additionalProperties:!1});Y.Object({summary:Z,request:Z,interaction:Y.Optional(tI)},{additionalProperties:!1});var nI=Y.Object({summary:Z,request:Z,interaction:Y.Optional(tI),title:Y.Optional(Z),related_refs:Y.Optional(Y.Array(eI))},{additionalProperties:!1}),rI=Y.Union([Y.Object({kind:Y.Literal(`task_compile`),workflow_ref:tP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task`),task_id:XN},{additionalProperties:!1})]),iI=Y.Object({id:nP,owner:rI,status:Y.Union([Y.Literal(`active`),Y.Literal(`closed`)]),current_round_id:Y.Optional(rP),created_from_activity_ref:Y.Optional($N),closed_reason:Y.Optional(Y.Union([Y.Literal(`resolved`),Y.Literal(`contract_changed`),Y.Literal(`cancelled`)])),created_at:X,updated_at:X},{additionalProperties:!1}),aI=Y.Union([Y.Object({kind:Y.Literal(`next_round`),clarification_round_ref:rP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`run`),activity_ref:$N},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`proposal_applied`),workflow_ref:tP},{additionalProperties:!1})]),oI=Y.Object({id:rP,thread_id:nP,round_index:Y.Integer({minimum:1}),status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),request_payload:nI,card_message_id:JN,opening_message_id:JN,submitted_at:Y.Optional(X),submitted_message_refs:Y.Optional(Y.Array(JN)),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),successor_ref:Y.Optional(aI),capabilities:Y.Object({send_message:Y.Boolean(),submit:Y.Boolean()},{additionalProperties:!1}),created_at:X,updated_at:X},{additionalProperties:!1});Y.Union([Y.Object({state:Y.Literal(`none`)},{additionalProperties:!1}),Y.Object({state:Y.Literal(`active`),thread:iI,round:oI},{additionalProperties:!1})]);var sI=Y.Object({id:rP,thread_id:nP,round_index:Y.Integer({minimum:1}),status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),title:Y.Optional(Z),summary:Z,submitted_at:Y.Optional(X),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),created_at:X,updated_at:X},{additionalProperties:!1});Y.Object({thread:iI,rounds:Y.Array(sI)},{additionalProperties:!1}),Y.Object({thread:iI,round:oI},{additionalProperties:!1}),Y.Object({limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50})),anchor:Y.Optional(Y.Union([Y.Literal(`start`),Y.Literal(`latest`)])),before:Y.Optional(qN),after:Y.Optional(qN)},{additionalProperties:!1});var cI=Y.Object({body:Y.String({minLength:1,maxLength:8e3})},{additionalProperties:!1}),lI=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_round`),current_round_id:Y.Optional(rP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),fP]),uI=Y.Object({message:Y.Optional(FF)},{additionalProperties:!1});pP(cI),hP(lI,uI);var dI=Y.Object({},{additionalProperties:!1}),fI=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_submitted`),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),successor_ref:Y.Optional(aI)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_round`),current_round_id:Y.Optional(rP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),fP]),pI=Y.Object({round:Y.Optional(oI),materialization:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`queued`),Y.Literal(`already_materialized`)]),successor_ref:Y.Optional(aI)},{additionalProperties:!1}))},{additionalProperties:!1});pP(dI),hP(fI,pI),Y.Object({reason:Y.Union([Y.Literal(`round_opened`),Y.Literal(`round_message_created`),Y.Literal(`round_submitted`),Y.Literal(`successor_materialized`),Y.Literal(`chain_closed`),Y.Literal(`recovered`)]),thread_id:nP,round_id:Y.Optional(rP),successor_ref:Y.Optional(aI)},{additionalProperties:!1});var mI=Y.String(),hI=Y.Object({source:Y.Literal(`mainline`),branch:Y.Literal(`tutti/mainline`),head:Y.Optional(Y.Object({oid:Z,short_oid:Z},{additionalProperties:!1})),mainline_clean:Y.Boolean(),generated_at:X},{additionalProperties:!1}),gI=Y.Union([Y.Literal(`product`),Y.Literal(`tech`),Y.Literal(`structure`),Y.Literal(`architecture_principles`)]),_I=Y.Union([Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`binary`),Y.Literal(`unsupported_encoding`),Y.Literal(`too_large`)]),vI=Y.Object({doc_key:gI,path:mI,status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`unreadable`)]),unreadable_reason:Y.Optional(_I),size_bytes:Y.Optional(Y.Integer({minimum:0})),blob_oid:Y.Optional(Z),last_commit:Y.Optional(Y.Object({oid:Z,short_oid:Z,committed_at:X,title:Y.Optional(Z)},{additionalProperties:!1}))},{additionalProperties:!1}),yI=Y.Union([Y.Literal(`directory`),Y.Literal(`symlink`),Y.Literal(`submodule`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unknown`)]),bI=Y.Object({path:mI,name:Y.String(),kind:Y.Union([Y.Literal(`directory`),Y.Literal(`file`),Y.Literal(`symlink`),Y.Literal(`submodule`)]),depth:Y.Integer({minimum:0}),parent_path:Y.Optional(mI),size_bytes:Y.Optional(Y.Integer({minimum:0})),blob_oid:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),has_children:Y.Optional(Y.Boolean()),project_doc_key:Y.Optional(gI),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(yI)},{additionalProperties:!1})},{additionalProperties:!1}),xI=Y.Union([Y.Object({kind:Y.Literal(`text`),encoding:Y.Literal(`utf-8`),text:Y.String(),truncated:Y.Boolean(),bytes_returned:Y.Integer({minimum:0}),total_bytes:Y.Integer({minimum:0}),line_count:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`omitted`),reason:Y.Union([Y.Literal(`binary`),Y.Literal(`unsupported_encoding`),Y.Literal(`too_large`)]),total_bytes:Y.Integer({minimum:0})},{additionalProperties:!1})]),SI=Y.Object({path:mI,name:Z,kind:Y.Literal(`file`),size_bytes:Y.Integer({minimum:0}),blob_oid:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),media_type:Y.Optional(Z)},{additionalProperties:!1});Y.Object({snapshot:hI,docs:Y.Array(vI)},{additionalProperties:!1}),Y.Object({doc_key:gI},{additionalProperties:!1}),Y.Object({max_bytes:Y.Optional(Y.Integer({minimum:1,maximum:1048576}))},{additionalProperties:!1}),Y.Object({snapshot:hI,doc:vI,content:xI},{additionalProperties:!1}),Y.Object({path:Y.Optional(mI),depth:Y.Optional(Y.Integer({minimum:1,maximum:3})),limit:Y.Optional(Y.Integer({minimum:1,maximum:1e3})),cursor:Y.Optional(qN)},{additionalProperties:!1});var CI=Y.Object({next_cursor:Y.Optional(qN),has_more:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:1e3})},{additionalProperties:!1});Y.Object({snapshot:hI,root:bI,items:Y.Array(bI),page:CI},{additionalProperties:!1}),Y.Object({path:mI,max_bytes:Y.Optional(Y.Integer({minimum:1,maximum:1048576}))},{additionalProperties:!1});var wI=Y.Union([Y.Literal(`thumbnail`),Y.Literal(`preview`),Y.Literal(`original`)]);Y.Object({path:mI,variant:wI,v:Z},{additionalProperties:!1}),Y.Object({snapshot:hI,file:SI,content:xI},{additionalProperties:!1});var TI=Y.Object({path:Y.Literal(`docs/reference`),status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`)]),index_path:Y.Literal(`docs/reference/README.md`),files_path:Y.Literal(`docs/reference/files`),images_path:Y.Literal(`docs/reference/images`),tutti_path:Y.Literal(`docs/reference/tutti`),index_status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`unreadable`)]),index_unreadable_reason:Y.Optional(_I)},{additionalProperties:!1}),EI=Y.Union([Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unsupported_encoding`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`unknown`)]),DI=Y.Object({status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`stale`),Y.Literal(`unavailable`)]),text:Y.Optional(Y.String()),generated_at:Y.Optional(X),source_blob_oid:Y.Optional(Z),unavailable_reason:Y.Optional(Y.String()),read_paths:Y.Optional(Y.Array(mI))},{additionalProperties:!1}),OI=Y.Object({path:mI,name:Z,source:Y.Union([Y.Literal(`human_upload`),Y.Literal(`tutti_output`)]),category:EF,size_bytes:Y.Integer({minimum:0}),media_type:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),blob_oid:Y.Optional(Z),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(EI)},{additionalProperties:!1}),summary:Y.Optional(DI)},{additionalProperties:!1});Y.Object({include_index:Y.Optional(Y.Boolean()),limit:Y.Optional(Y.Integer({minimum:1,maximum:1e3})),cursor:Y.Optional(qN)},{additionalProperties:!1}),Y.Object({snapshot:hI,directory:TI,items:Y.Array(OI),page:CI},{additionalProperties:!1});var kI=Y.Object({...GP,note:Y.Optional(Y.String())},{additionalProperties:!1}),AI=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),fP]),jI=Y.Object({file:OI,message:FF,index_path:Y.Literal(`docs/reference/README.md`)},{additionalProperties:!1});pP(kI),hP(AI,jI);var MI=Y.Object({paths:Y.Optional(Y.Array(mI))},{additionalProperties:!1}),NI=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:$N},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`no_targets`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:Y.Union([Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`)]),retryable:Y.Boolean()},{additionalProperties:!1}),fP]),PI=Y.Object({activity_ref:Y.Optional($N),workflow_ref:Y.Optional(tP),target_count:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1});pP(MI),hP(NI,PI);var FI=Y.Union([Y.Literal(`static`),Y.Literal(`server`)]),II=Y.String({minLength:1,maxLength:120,pattern:`\\S`}),LI=Y.String({minLength:1}),RI=Y.Object({title:II,kind:Y.Literal(`static`),root:LI,entry:LI,network:Y.Boolean()},{additionalProperties:!1}),zI=Y.Object({title:II,kind:Y.Literal(`server`),cwd:LI,entry:Y.String({minLength:1,maxLength:256,pattern:`^/`}),network:Y.Boolean()},{additionalProperties:!1});Y.Object({version:Y.Literal(1),artifact:Y.Union([RI,zI])},{additionalProperties:!1});var BI=Y.Union([Y.Literal(`ready`),Y.Literal(`starting`),Y.Literal(`idle`),Y.Literal(`failed`)]),VI=Y.Object({title:II,kind:FI,network:Y.Boolean()},{additionalProperties:!1}),HI=Y.Object({status:BI,url:Y.Optional(Y.String({minLength:1})),error_message:Y.Optional(Z)},{additionalProperties:!1}),UI=Y.Union([Y.Object({status:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({status:Y.Literal(`invalid`),error:Y.Object({code:Z,message:Z},{additionalProperties:!1})},{additionalProperties:!1}),Y.Object({status:Y.Literal(`declared`),preview_generation:Z,artifact:VI,preview:HI},{additionalProperties:!1})]);Y.Object({artifact:UI},{additionalProperties:!1});var WI=Y.Object({},{additionalProperties:!1}),GI=Y.Union([Y.Object({kind:Y.Literal(`issued`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`invalid_manifest`),message:Z},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`preview_not_ready`),status:Y.Union([Y.Literal(`starting`),Y.Literal(`idle`),Y.Literal(`failed`)]),message:Y.Optional(Z)},{additionalProperties:!1}),fP]),KI=Y.Object({bootstrap_url:Y.String({minLength:1}),expires_at:X},{additionalProperties:!1});pP(WI),hP(GI,KI);var qI=Y.String({minLength:1,maxLength:96,pattern:`^[a-z0-9_-]+$`}),JI=Y.Object({name:qI,description:Z,short_description:Y.Optional(Z),enabled:Y.Boolean(),source:Y.Literal(`user`),updated_at:Y.Optional(X)},{additionalProperties:!1}),YI=Y.Object({name:qI,description:Z,short_description:Y.Optional(Z),enabled:Y.Boolean(),source:Y.Literal(`user`),updated_at:Y.Optional(X),skill_md:Y.String({minLength:1})},{additionalProperties:!1});Y.Object({items:Y.Array(JI)},{additionalProperties:!1}),Y.Object({skill_name:qI},{additionalProperties:!1}),Y.Object({skill:YI},{additionalProperties:!1});var XI=Y.Object(KP,{additionalProperties:!1}),ZI=Y.Union([Y.Object({kind:Y.Literal(`created`),skill_name:qI},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`replaced`),skill_name:qI},{additionalProperties:!1}),fP]),QI=Y.Object({skill:YI},{additionalProperties:!1});pP(XI),hP(ZI,QI);var $I=Y.Object({skill_name:qI},{additionalProperties:!1}),eL=Y.Union([Y.Object({kind:Y.Literal(`deleted`),skill_name:qI},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_found`),skill_name:qI},{additionalProperties:!1}),fP]);pP($I),mP(eL);var tL=Y.Union([Y.Literal(`idle`),Y.Literal(`running`),Y.Literal(`pending`),Y.Literal(`failed`)]),nL=Y.Union([Y.Literal(`foreground`),Y.Literal(`scratchpad_background`)]),rL=Y.Object({activity_ref:$N,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)]),workflow_ref:Y.Optional(tP),workflow_kind:Y.Optional(cP),lane:Y.Optional(nL),started_at:Y.Optional(X)},{additionalProperties:!1}),iL=Y.Union([Y.Literal(`reading_context`),Y.Literal(`planning`),Y.Literal(`editing_files`),Y.Literal(`running_command`),Y.Literal(`using_tool`),Y.Literal(`waiting_for_approval`),Y.Literal(`finalizing`)]),aL=Y.Object({input_tokens:Y.Optional(Y.Integer({minimum:0})),cached_input_tokens:Y.Optional(Y.Integer({minimum:0})),output_tokens:Y.Optional(Y.Integer({minimum:0})),reasoning_output_tokens:Y.Optional(Y.Integer({minimum:0})),total_tokens:Y.Integer({minimum:0})},{additionalProperties:!1}),oL=Y.Object({activity_ref:$N,stage_id:Y.Optional(Y.String()),started_at:Y.Optional(X),updated_at:Y.Optional(X),token_usage:Y.Optional(aL),current_action:Y.Optional(iL)},{additionalProperties:!1}),sL=Y.Object({status:tL,summary:Y.String(),active_task:Y.Optional(mF),active_activity:Y.Optional(rL),active_activities:Y.Optional(Y.Array(rL)),runtime:Y.Optional(oL),blocked_by:Y.Optional(Y.Union([Y.Object({kind:Y.Literal(`clarification`),thread_id:nP,round_id:rP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`approval`),approval_id:iP},{additionalProperties:!1})])),last_conclusion:Y.Optional(Y.Object({kind:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`),Y.Literal(`needs_human`),Y.Literal(`recovered`)]),summary:Y.String(),task_id:Y.Optional(XN),activity_ref:Y.Optional($N),workflow_ref:Y.Optional(tP),occurred_at:X},{additionalProperties:!1})),updated_at:X},{additionalProperties:!1}),cL=Y.Object({activity_ref:$N,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)]),status:Y.Union([Y.Literal(`running`),Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`),Y.Literal(`interrupted`)]),title:Z,summary:Y.String(),task_id:Y.Optional(XN),workflow_ref:Y.Optional(tP),workflow_kind:Y.Optional(cP),lane:Y.Optional(nL),run_lineage:Y.Optional(sF),started_at:Y.Optional(X),ended_at:Y.Optional(X),latest_event_ref:Y.Optional(eP),result_anchor:Y.Optional(cF)},{additionalProperties:!1}),lL=Y.Object({event_ref:eP,activity_ref:$N,event_kind:Y.Union([Y.Literal(`started`),Y.Literal(`progress`),Y.Literal(`needs_human`),Y.Literal(`artifact_snapshot`),Y.Literal(`finished`),Y.Literal(`failed`)]),occurred_at:X,summary:Y.String(),payload:Y.Optional(Y.Object({progress:Y.Optional(Y.Object({message:Y.String(),phase:Y.Optional(Y.String())},{additionalProperties:!1})),artifact:Y.Optional(Y.Object({artifact_kind:Y.Union([Y.Literal(`scratchpad_snapshot`),Y.Literal(`task_compile_proposal`),Y.Literal(`context_sync_findings`),Y.Literal(`recovery_summary`),Y.Literal(`run_changed_paths`)]),summary:Y.String()},{additionalProperties:!1})),terminal:Y.Optional(Y.Object({result_kind:Y.Union([Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`)]),summary:Y.String()},{additionalProperties:!1}))},{additionalProperties:!1}))},{additionalProperties:!1});Y.Object({server_time:X,current_event_cursor:Z,replay:Y.Object({requested_cursor:Y.Optional(Z),status:Y.Union([Y.Literal(`not_requested`),Y.Literal(`replayed`),Y.Literal(`missed`)]),replayed_event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),retry_after_ms:Y.Integer({minimum:0}),replay_window:_P},{additionalProperties:!1}),Y.Object({reason:Y.Union([Y.Literal(`replay_missed`),Y.Literal(`bulk_state_change`),Y.Literal(`workspace_recovered`),Y.Literal(`viewer_changed`)]),message:Y.Optional(Y.String())},{additionalProperties:!1}),Y.Object({execution_status:sL},{additionalProperties:!1}),Y.Object({approval:XF},{additionalProperties:!1}),Y.Object({activity:cL,event:lL},{additionalProperties:!1}),Y.Object({reason:Y.Union([Y.Literal(`task_compile_applied`),Y.Literal(`task_state_changed`),Y.Literal(`task_result_recorded`),Y.Literal(`workspace_recovered`)]),workflow_ref:Y.Optional(tP),activity_ref:Y.Optional($N),changed_module_ids:Y.Optional(Y.Array(YN)),changed_task_ids:Y.Optional(Y.Array(XN))},{additionalProperties:!1}),Y.Object({task:mF},{additionalProperties:!1}),Y.Object({task_id:XN,task:Y.Optional(mF),detail:Y.Optional(yF),latest_run_result_id:Y.Optional(ZN)},{additionalProperties:!1}),Y.Object({scratchpad:fF,activity_ref:Y.Optional($N)},{additionalProperties:!1}),Y.Object({provider_config:bP},{additionalProperties:!1}),Y.Object({recovery_summary_id:QN,summary:Y.String(),affected_activities:Y.Array($N),replayed_round_ids:Y.Optional(Y.Array(rP))},{additionalProperties:!1}),Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:$N},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:yP,retryable:Y.Boolean()},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`no_source_messages`)},{additionalProperties:!1}),fP]),Y.Object({activity_ref:Y.Optional($N),workflow_ref:Y.Optional(tP),scratchpad:Y.Optional(fF)},{additionalProperties:!1});var uL=Y.Object({expected_scratchpad_updated_at:Y.Optional(X)},{additionalProperties:!1}),dL=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:$N},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`scratchpad_empty`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_scratchpad`),current_scratchpad:fF},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:yP,retryable:Y.Boolean()},{additionalProperties:!1}),fP]),fL=Y.Object({activity_ref:Y.Optional($N),workflow_ref:Y.Optional(tP)},{additionalProperties:!1});pP(uL),hP(dL,fL);var pL=Y.Object({scope:Y.Optional(Y.Object({kind:Y.Literal(`worklist`)},{additionalProperties:!1}))},{additionalProperties:!1}),mL=Y.Union([Y.Object({kind:Y.Literal(`scheduled`),task_id:XN,activity_ref:$N,queued_task_ids:Y.Array(XN)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:$N,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)])},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`blocked_by_clarification`),thread_id:nP,round_id:rP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`nothing_to_run`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`mainline_not_clean`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:yP,retryable:Y.Boolean()},{additionalProperties:!1}),fP]);pP(pL),mP(mL);var hL=Y.Object({display_name:Y.String({minLength:1,maxLength:80})},{additionalProperties:!1}),gL=Y.Union([Y.Object({kind:Y.Literal(`updated`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`unchanged`)},{additionalProperties:!1}),fP]),_L=Y.Object({project:Y.Object({display_name:Y.String({minLength:1,maxLength:80})},{additionalProperties:!1})},{additionalProperties:!1});pP(hL),hP(gL,_L);var vL=Y.Object({description:Y.String({maxLength:160})},{additionalProperties:!1}),yL=Y.Union([Y.Object({kind:Y.Literal(`updated`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`unchanged`)},{additionalProperties:!1}),fP]),bL=Y.Object({project:Y.Object({description:Y.String({maxLength:160})},{additionalProperties:!1})},{additionalProperties:!1});pP(vL),hP(yL,bL);var xL=Y.Object({},{additionalProperties:!1}),SL=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_initialized`)},{additionalProperties:!1}),fP]),CL=Y.Object({activity_ref:$N,workflow_ref:tP},{additionalProperties:!1}),wL=Y.Object({docs:Y.Array(vI),created_paths:Y.Array(mI),commit_oid:Y.Optional(Z)},{additionalProperties:!1});pP(xL),hP(SL,wL);var TL=Y.Object({},{additionalProperties:!1}),EL=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:$N},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:yP,retryable:Y.Boolean()},{additionalProperties:!1}),fP]),DL=CL;pP(TL),hP(EL,DL);function OL(e){try{return decodeURIComponent(e)}catch{return e}}function kL(e){return Ut(OL(e))}function AL(e,t=``){if(/^\/$/u.test(e))return{kind:`home`};if(/^\/console\/?$/u.test(e))return{kind:`local_console`};if(/^\/setup\/?$/u.test(e))return{kind:`setup`};if(/^\/projects\/?$/u.test(e)){let e=new URLSearchParams(t).get(`open`);if(e!==null){let t=kL(e);if(t!==null)return{kind:`project_open`,relayProjectRef:t}}return{kind:`project_center`}}let n=/^\/join\/([^/]+)\/?$/u.exec(e);if(n?.[1]!==void 0)return{kind:`join`,joinToken:OL(n[1])};let r=/^\/projects\/([^/]+)\/workspace\/?$/u.exec(e);if(r?.[1]!==void 0){let e=kL(r[1]);return e===null?{kind:`project_center`}:{kind:`workspace`,relayProjectRef:e}}let i=/^\/projects\/([^/]+)\/references\/?$/u.exec(e);if(i?.[1]!==void 0){let e=kL(i[1]);return e===null?{kind:`project_center`}:{kind:`references`,relayProjectRef:e}}let a=/^\/projects\/([^/]+)\/artifacts\/?$/u.exec(e);if(a?.[1]!==void 0){let e=kL(a[1]);return e===null?{kind:`project_center`}:{kind:`artifacts`,relayProjectRef:e}}let o=/^\/projects\/([^/]+)\/worklist\/?$/u.exec(e);if(o?.[1]!==void 0){let e=kL(o[1]);return e===null?{kind:`project_center`}:{kind:`worklist`,relayProjectRef:e}}let s=/^\/projects\/([^/]+)\/skills\/?$/u.exec(e);if(s?.[1]!==void 0){let e=kL(s[1]);return e===null?{kind:`project_center`}:{kind:`skills`,relayProjectRef:e}}let c=/^\/projects\/([^/]+)\/timeline\/?$/u.exec(e);if(c?.[1]!==void 0){let e=kL(c[1]);return e===null?{kind:`project_center`}:{kind:`timeline`,relayProjectRef:e}}let l=/^\/projects\/([^/]+)\/settings\/?$/u.exec(e);if(l?.[1]!==void 0){let e=kL(l[1]);return e===null?{kind:`project_center`}:{kind:`settings`,relayProjectRef:e}}return{kind:`project_center`}}var jL={success:3e3,error:9e3,warning:6e3,info:4500},ML=5,NL=(0,N.createContext)(null);function PL(e){return e.persistent===!0||e.tone===`loading`?e.durationMs:e.durationMs??jL[e.tone]}function FL(e){return e.persistent??e.tone===`loading`}function IL(e){return e.dismissible??e.tone!==`loading`}function LL(e,t){let n=PL(t);return{id:e,tone:t.tone,title:t.title,persistent:FL(t),dismissible:IL(t),...t.message===void 0?{}:{message:t.message},...n===void 0?{}:{durationMs:n}}}function RL(e,t){let n=t.tone===void 0,r={tone:t.tone??e.tone,title:t.title??e.title,...t.message===void 0?e.message===void 0?{}:{message:e.message}:{message:t.message},...t.durationMs===void 0?!n||e.durationMs===void 0?{}:{durationMs:e.durationMs}:{durationMs:t.durationMs},...t.persistent===void 0?!n||e.persistent===void 0?{}:{persistent:e.persistent}:{persistent:t.persistent},...t.dismissible===void 0?!n||e.dismissible===void 0?{}:{dismissible:e.dismissible}:{dismissible:t.dismissible}};return LL(e.id,r)}function zL(e){return[e.id,e.tone,e.title,e.message??``,e.durationMs??``,e.persistent===!0?`persistent`:`timed`].join(`:`)}function BL({children:e}){let[t,n]=(0,N.useState)([]),r=(0,N.useRef)(new Map),i=(0,N.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e))},[]),a=(0,N.useCallback)(e=>{let t=Gt(),r=LL(t,e);return n(e=>[...e,r].slice(-ML)),t},[]),o=(0,N.useCallback)((e,t)=>{if(e===void 0){a(t);return}n(n=>n.map(n=>n.id===e?RL(n,t):n))},[a]);(0,N.useEffect)(()=>{let e=new Set(t.map(e=>e.id));for(let[t,n]of r.current)e.has(t)||(window.clearTimeout(n.timeout),r.current.delete(t));for(let e of t){let t=r.current.get(e.id),n=zL(e);if(t!==void 0&&t.key!==n&&(window.clearTimeout(t.timeout),r.current.delete(e.id)),e.persistent===!0||e.durationMs===void 0||r.current.has(e.id))continue;let a=window.setTimeout(()=>i(e.id),e.durationMs);r.current.set(e.id,{key:n,timeout:a})}},[i,t]),(0,N.useEffect)(()=>()=>{for(let e of r.current.values())window.clearTimeout(e.timeout);r.current.clear()},[]);let s=(0,N.useMemo)(()=>({notify:a,update:o,dismiss:i}),[i,a,o]);return(0,P.jsxs)(NL.Provider,{value:s,children:[e,(0,P.jsx)(ua,{notices:t,onDismiss:i})]})}function VL(){let e=(0,N.useContext)(NL);if(e===null)throw Error(`useNotify must be used inside NotificationProvider`);return e}var HL=`http://127.0.0.1:4370`;function UL(){return typeof window<`u`?window.location.origin:HL}function WL(){let e=`https://tutti.now`;return typeof e==`string`?e:UL()}var GL=WL(),KL={relayBaseUrl:GL},qL=3e4,Q={relayRoot:[`relay`],me:[`relay`,`me`],recentProjects:[`relay`,`projects`,`recent`],projectPresence:e=>[`relay`,`projects`,e,`presence`],relayJoinRoot:[`relay`,`join`],join:e=>[`relay`,`join`,e],bootstrap:e=>[`host`,e,`bootstrap`],hostRoot:e=>[`host`,e],hostSession:e=>[`host`,e,`session`],hostWorkspace:e=>[`host`,e,`workspace`],messages:e=>[`host`,e,`messages`,`main_chat`],messagesWindow:(e,t)=>[...Q.messages(e),{limit:t}],messagesAround:(e,t,n)=>[...Q.messages(e),{around:t,limit:n}],messageHistory:(e,t,n)=>[...Q.messages(e),{history:t,limit:n}],scratchpad:e=>[`host`,e,`scratchpad`],worklist:e=>[`host`,e,`worklist`],readState:e=>[`host`,e,`read-state`],activeClarification:e=>[`host`,e,`clarification`,`active`],activeApproval:e=>[`host`,e,`approval`,`active`],noActiveClarificationRoundMessages:e=>[`host`,e,`clarification-round-messages`,`none`],clarificationRoundMessages:(e,t)=>[`host`,e,`clarification-round-messages`,t],task:(e,t)=>[`host`,e,`task`,t],taskDetail:(e,t)=>[`host`,e,`task-detail`,t],taskRunResults:(e,t)=>[`host`,e,`task-run-results`,t],executionStatus:e=>[`host`,e,`execution-status`],providerConfig:e=>[`host`,e,`provider-config`],providerUsage:e=>[`host`,e,`provider-usage`],projectTimeline:e=>[`host`,e,`project-timeline`],viewerRoot:e=>[`host`,e,`viewer`],viewerFile:(e,t)=>[`host`,e,`viewer`,`file`,t],referenceFiles:e=>[`host`,e,`references`,`files`],artifacts:e=>[`host`,e,`artifacts`],artifactPreviewSession:(e,t)=>[`relay`,e,`artifact-preview-session`,t],skills:e=>[`host`,e,`skills`],skillDetail:(e,t)=>[`host`,e,`skills`,t]};function JL(){return`${window.location.pathname}${window.location.search}${window.location.hash}`}function $(e,t={}){t.replace===!0?window.history.replaceState(null,``,e):window.history.pushState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}function YL(e){let t=new URL(e,window.location.origin);$(`${t.pathname}${t.search}${t.hash}`)}function XL(){let[e,t]=(0,N.useState)(JL);return(0,N.useEffect)(()=>{let e=()=>{t(JL())};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]),(0,N.useMemo)(()=>{let t=new URL(e,window.location.origin);return AL(t.pathname,t.search)},[e])}function ZL(e){return e instanceof Error?e.message:`Request failed`}function QL(e){e.invalidateQueries({queryKey:Q.me}),e.invalidateQueries({queryKey:Q.recentProjects})}function $L(e,t){if(t!==void 0)for(let n of t)switch(n.kind){case`all`:e.invalidateQueries({queryKey:Q.relayRoot});break;case`me`:e.invalidateQueries({queryKey:Q.me});break;case`recent_projects`:e.invalidateQueries({queryKey:Q.recentProjects});break;case`join_entries`:e.invalidateQueries({queryKey:Q.relayJoinRoot});break;case`project_presence`:Vt(n.relay_project_ref,Lt.relayProject)&&e.invalidateQueries({queryKey:Q.projectPresence(n.relay_project_ref)});break}}function eR(e){let t=rt(),n=(0,N.useMemo)(()=>zn(KL),[]);(0,N.useEffect)(()=>{if(e)try{let e=n.connectEvents({onReady:e=>{e.payload.replay.status===`missed`&&t.invalidateQueries({queryKey:Q.relayRoot})},onInvalidate:e=>{$L(t,e)}});return()=>{e.close()}}catch{return}},[e,t,n])}function tR(e,t,n){if(n!==void 0)for(let r of n)switch(r.kind){case`all`:e.invalidateQueries({queryKey:Q.hostRoot(t)});break;case`workspace`:e.invalidateQueries({queryKey:Q.hostWorkspace(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`session`:e.invalidateQueries({queryKey:Q.hostSession(t)});break;case`bootstrap`:e.invalidateQueries({queryKey:Q.bootstrap(t)});break;case`messages`:r.scope===`main_chat`?e.invalidateQueries({queryKey:Q.messages(t)}):e.invalidateQueries({queryKey:Q.clarificationRoundMessages(t,r.round_id)});break;case`scratchpad`:e.invalidateQueries({queryKey:Q.scratchpad(t)});break;case`worklist`:e.invalidateQueries({queryKey:Q.worklist(t)});break;case`read_state`:e.invalidateQueries({queryKey:Q.readState(t)});break;case`task`:e.invalidateQueries({queryKey:Q.task(t,r.task_id)});break;case`task_detail`:e.invalidateQueries({queryKey:Q.taskDetail(t,r.task_id)});break;case`task_run_results`:e.invalidateQueries({queryKey:Q.taskRunResults(t,r.task_id)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`execution_status`:e.invalidateQueries({queryKey:Q.executionStatus(t)});break;case`approval`:e.invalidateQueries({queryKey:Q.activeApproval(t)});break;case`provider_config`:e.invalidateQueries({queryKey:Q.providerConfig(t)});break;case`provider_usage`:e.invalidateQueries({queryKey:Q.providerUsage(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`project_timeline`:e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`viewer`:e.invalidateQueries({queryKey:Q.viewerRoot(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)}),(r.path===void 0||r.path.startsWith(`docs/reference`))&&e.invalidateQueries({queryKey:Q.referenceFiles(t)}),r.path!==void 0&&e.invalidateQueries({queryKey:Q.viewerFile(t,r.path)});break;case`skills`:e.invalidateQueries({queryKey:Q.skills(t)});break;case`artifacts`:e.invalidateQueries({queryKey:Q.artifacts(t)});break;case`recovery_summaries`:e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`activity`:break;case`clarification`:e.invalidateQueries({queryKey:Q.activeClarification(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)}),r.round_id!==void 0&&e.invalidateQueries({queryKey:Q.clarificationRoundMessages(t,r.round_id)});break}}function nR(){return{items:[],window:{has_older:!1,has_newer:!1,limit:50}}}function rR(){return{modules:[]}}function iR(){return{id:`current`,state:`empty`,topic:``,background_summary:``,current_consensus:[],open_questions:[],task_changes:[],receipts:[]}}function aR(e){return{chat:e?.scopes.chat.has_unread===!0,worklist:e?.scopes.worklist.has_unread===!0,references:e?.scopes.references.has_unread===!0,skills:e?.scopes.skills.has_unread===!0}}function oR(e){return e?.artifact.status===`declared`?{available:!0}:{available:!1}}function sR({enabled:e,hostClient:t,relayProjectRef:n,readState:r,scope:i}){let a=rt(),o=(0,N.useRef)(null),s=yt({mutationFn:e=>t.markRead({scope:i,up_to_event_cursor:e}),onSuccess:e=>{tR(a,n,e.invalidates)},onError:()=>{o.current=null}});(0,N.useEffect)(()=>{if(!e||r===void 0)return;let t=r.scopes[i];if(!t.has_unread){t.read_event_cursor>=t.latest_event_cursor&&(o.current=null);return}let n=`${i}:${t.latest_event_cursor}`;o.current===n||s.isPending||(o.current=n,s.mutate(t.latest_event_cursor))},[e,s,r,i])}function cR(){return{state:`none`}}function lR(e){return{status:`idle`,summary:`Idle`,updated_at:e}}function uR(e){return e.active_activities??(e.active_activity===void 0?[]:[e.active_activity])}function dR(e,t,n){return uR(e).some(e=>e.workflow_kind===t?n===void 0||(e.lane??`foreground`)===n:!1)}function fR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/references`;return t===void 0?n:`${n}?path=${encodeURIComponent(t)}`}function pR(e){return`/projects/${encodeURIComponent(Ht(e))}/artifacts`}function mR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/worklist`;return t===void 0?n:`${n}?task=${encodeURIComponent(t)}`}function hR(e,t){return`${rn(e)}?message=${encodeURIComponent(t)}`}function gR(e){return`/projects/${encodeURIComponent(Ht(e))}/settings`}function _R(e){return`/projects/${encodeURIComponent(Ht(e))}/timeline`}function vR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/skills`;return t===void 0?n:`${n}?skill=${encodeURIComponent(t)}`}function yR(e,t){switch(t.target.kind){case`approval`:case`clarification`:case`scratchpad`:return rn(e);case`worklist`:return mR(e);case`references`:return fR(e);case`task`:return mR(e,t.target.taskId)}}function bR(e,t){$(yR(e,t))}function xR(e,t){let n=Fr(e);if(t!==void 0&&n.some(e=>e.id===t))return t;for(let e of[`running`,`pending`,`failed`,`todo`,`done`]){let t=n.find(t=>t.status===e);if(t!==void 0)return t.id}}function SR(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function CR(e){switch(e){case`binary`:return`Binary file`;case`too_large`:return`File too large`;case`unsupported_encoding`:return`Unsupported encoding`;case`restricted_path`:case`secret_like`:return`Restricted file`;default:return`Preview unavailable`}}function wR(e){if(!(e===void 0||e.kind===`text`))return CR(e.reason)}function TR(e){return Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function ER(e){if(globalThis.crypto?.subtle===void 0)throw Error(`This browser does not support file upload hashing.`);return`sha256:${TR(await globalThis.crypto.subtle.digest(`SHA-256`,await e.arrayBuffer()))}`}async function DR(e){if(e.file.size<=0)throw Error(`Upload file cannot be empty.`);let t=UP(e.purpose);if(e.file.size>t)throw Error(`Upload file cannot exceed ${SR(t)}.`);let n=await ER(e.file),r=e.file.type===``?void 0:e.file.type,i=zn(KL),a=e.purpose===`skill_zip`?{relay_project_ref:e.relayProjectRef,purpose:`skill_zip`,file_name:e.file.name,size_bytes:e.file.size,sha256:n,...r===void 0?{}:{media_type:r}}:{relay_project_ref:e.relayProjectRef,purpose:`reference_file`,file_name:e.file.name,size_bytes:e.file.size,sha256:n,...r===void 0?{}:{media_type:r}},o=await i.startUpload(a);if(o.result===void 0)throw Error(`Upload session could not be started.`);let s=new Headers(o.result.put.headers??{});r!==void 0&&!s.has(`content-type`)&&s.set(`content-type`,r);let c;try{c=await fetch(o.result.put.url,{method:o.result.put.method,headers:s,body:e.file})}catch{throw Error(`File upload failed while sending the file to upload storage. Check that R2 CORS allows PUT from this Web origin.`)}if(!c.ok)throw Error(`File upload failed while sending the file to upload storage (${c.status}).`);return{upload_id:o.result.upload.upload_id,file_name:o.result.upload.file_name,size_bytes:o.result.upload.size_bytes,sha256:o.result.upload.sha256,...o.result.upload.media_type===void 0?{}:{media_type:o.result.upload.media_type}}}function OR(e){let t=rt(),n=VL(),[r,i]=(0,N.useState)(`identity`),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)({email:``,displayName:``,code:``}),l=yt({mutationFn:async()=>{let e=s.email.trim(),t=await Vn(KL,{email:e});if(t.result===void 0)throw Error(`Login challenge was not returned`);return{challenge:t.result.challenge,disposition:t.disposition,email:e}},onSuccess:({challenge:e,disposition:t,email:r})=>{o(e),c(e=>({...e,code:``})),i(`code`),n.notify({tone:`success`,title:t.kind===`otp_already_pending`?`Verification email already sent`:`Verification email sent`,message:t.kind===`otp_already_pending`?`Verification email already sent to ${r}.`:`Verification email sent to ${r}.`})}}),u=yt({mutationFn:async()=>{if(a===null)throw Error(`Login challenge is missing`);let e=await Hn(KL,{challenge_ref:a.challenge_ref,code:s.code.trim()});if(e.result===void 0)throw Error(`Login response was not returned`);return e.result},onSuccess:n=>{if(!n.account.profile_complete){t.invalidateQueries({queryKey:Q.me}),c(e=>({...e,displayName:``})),i(`profile`);return}QL(t),e?.()}}),d=yt({mutationFn:async()=>{let e=await Un(KL,{display_name:s.displayName.trim()});if(e.result===void 0)throw Error(`Profile response was not returned`);return e.result.account},onSuccess:()=>{QL(t),e?.()}}),f=e=>{if(e.preventDefault(),r===`identity`&&s.email.trim()!==``){l.mutate();return}if(r===`code`&&a!==null&&s.code.trim()!==``){u.mutate();return}r===`profile`&&s.displayName.trim()!==``&&d.mutate()},p=l.isPending||u.isPending||d.isPending,m=r===`identity`?l.error:r===`code`?u.error??l.error:d.error;return{phase:r,form:s,pending:p,submitDisabled:r===`identity`?s.email.trim()===``:r===`code`?a===null||s.code.replace(/\s+/gu,``).length!==6:s.displayName.trim()===``,challengeEmailHint:a?.email_hint??null,error:m===null?null:ZL(m),onChange:e=>{c(t=>({...t,...e,...e.code===void 0?{}:{code:e.code.replace(/\D/gu,``).slice(0,6)}}))},onSubmit:f,onBack:()=>{l.reset(),u.reset(),d.reset(),o(null),c(e=>({...e,code:``})),i(`identity`)}}}function kR(e){let t=rt(),[n,r]=(0,N.useState)({email:``,displayName:``,code:``}),i=yt({mutationFn:async()=>{let e=await Un(KL,{display_name:n.displayName.trim()});if(e.result===void 0)throw Error(`Profile response was not returned`);return e.result.account},onSuccess:()=>{QL(t),e?.()}});return{phase:`profile`,form:n,pending:i.isPending,submitDisabled:n.displayName.trim()===``,challengeEmailHint:null,error:i.error===null?null:ZL(i.error),onChange:e=>{r(t=>({...t,...e,...e.code===void 0?{}:{code:e.code.replace(/\D/gu,``).slice(0,6)}}))},onSubmit:e=>{e.preventDefault(),n.displayName.trim()!==``&&i.mutate()}}}var AR=`tutti.workspace-onboarding.v1`,jR={version:1,start_chat_pending:!1,tour_pending:!1};function MR(){try{return typeof window>`u`?null:window.sessionStorage}catch{return null}}function NR(e){return e.storage===void 0?MR():e.storage}function PR(e,t){return`${AR}:${e}:${t}`}function FR(e){if(typeof e!=`object`||!e)return null;let t=e;return t.version===1&&typeof t.start_chat_pending==`boolean`&&typeof t.tour_pending==`boolean`?{version:1,start_chat_pending:t.start_chat_pending,tour_pending:t.tour_pending}:null}function IR(e,t,n){if(e!==null)try{if(!n.start_chat_pending&&!n.tour_pending){e.removeItem(t);return}e.setItem(t,JSON.stringify(n))}catch{}}function LR(e,t,n={}){let r=NR(n);if(r===null)return{...jR};try{let n=r.getItem(PR(e,t));return n===null?{...jR}:FR(JSON.parse(n))??{...jR}}catch{return{...jR}}}function RR(e,t,n={}){IR(NR(n),PR(e,t),{version:1,start_chat_pending:!0,tour_pending:!0})}function zR(e,t,n,r){let i=NR(r),a=LR(e,t,{storage:i});a[n]&&IR(i,PR(e,t),{...a,[n]:!1})}function BR(e,t,n={}){zR(e,t,`start_chat_pending`,n)}function VR(e,t,n={}){zR(e,t,`tour_pending`,n)}function HR({joinToken:e}){let t=rt(),n=F({queryKey:Q.join(e),queryFn:()=>Gn(KL,e)}),r=OR(()=>{n.refetch()}),i=kR(()=>{n.refetch()}),a=yt({mutationFn:()=>Kn(KL,e),onSuccess:n=>{QL(t),t.invalidateQueries({queryKey:Q.join(e)}),n.disposition.kind===`joined`&&n.result!==void 0&&RR(n.result.account.account_ref,n.result.relay_project.relay_project_ref),n.result?.relay_project.host_status===`online`&&$(rn(n.result.relay_project.relay_project_ref))}}),o=yt({mutationFn:e=>Jn(KL,e),onSuccess:e=>{QL(t),e.disposition.kind===`opened`&&e.result?.open_url!==void 0&&YL(e.result.open_url)}}),s=n.data;eR(s?.account!==void 0);let c=s?.relay_project?.display_name??`Project`,l=s?.relay_project?.host_status??`unknown`,u=s?.account?.profile_complete===!1,d=u?`login_required`:n.isLoading?`loading`:n.error===null?s?.next.kind??`invalid_or_expired`:`error`;return(0,P.jsx)(ES,{projectName:c,description:d===`invalid_or_expired`?`This invite can no longer be used.`:`You have been invited to join ${c}.`,hostLabel:rr(l),hostOnline:l===`online`,nextKind:d,accountLabel:s?.account?.display_name??null,membershipLabel:s?.membership?.label??null,actionPending:a.isPending||o.isPending,error:n.error===null?a.error===null?o.error===null?null:ZL(o.error):ZL(a.error):ZL(n.error),onBrandClick:()=>$(`/`),onRetry:()=>void n.refetch(),onAccept:()=>a.mutate(),onOpen:()=>{s?.next.kind===`open_workspace`&&o.mutate(s.next.relay_project_ref)},...d===`login_required`?{loginForm:u?i:r}:{}})}function UR(){$(`/projects`,{replace:!0})}function WR(){let e=F({queryKey:Q.me,queryFn:()=>Bn(KL)}),t=OR(UR);return(0,N.useEffect)(()=>{e.data!==void 0&&UR()},[e.data]),e.isLoading||e.data!==void 0?null:(0,P.jsx)(PS,{...t,onBrandClick:()=>$(`/`),sessionError:e.error===null||Qt(e.error)?null:`Tutti could not check your current session. You can still try signing in.`})}function GR(e){let t=e.trim().replace(/[\\/]+$/u,``);return t===``?``:t.slice(Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`))+1)}function KR(e=``){return{workspacePath:e,displayName:GR(e),description:``,baseUrl:``,apiKey:``,model:``}}function qR(e,t,n){return{...e,workspacePath:t,...n?{}:{displayName:GR(t)}}}function JR(e){switch(e){case`console_busy`:return`Wait for the current Local Console action to finish.`;case`host_busy`:return`Wait for active project work or questions to finish.`;case`host_identity_unverified`:return`Stop or reopen the affected project before updating.`;case`update_in_progress`:return`Another Tutti update is already in progress.`;case`update_recovery_required`:return`Run tutti again after closing this page to recover the interrupted update.`;case`global_prefix_read_only`:return`Use your normal terminal installation environment to update Tutti.`;case`npm_install_failed`:return`The npm installation failed. Refresh to check whether it can be retried.`;case`post_install_validation_failed`:return`The installed package could not be verified. Run tutti again to recover.`;case`completion_start_failed`:case`completion_failed`:case`worker_crashed`:return`The update was interrupted. Run tutti again to recover.`;case`host_restore_failed`:return`Tutti updated, but one or more local projects could not restart.`;case`installation_not_global`:case`custom_home`:case`npm_unavailable`:case`npm_global_root_mismatch`:case`npm_version_unsupported`:case`registry_unavailable`:case void 0:return`Tutti cannot update from this Local Console.`}}function YR(e){if(e.status!==`updating`)return e.status===`blocked`||e.status===`failed`?JR(e.reason_code):void 0;switch(e.phase){case`stopping_hosts`:return`Safely stopping online projects.`;case`installing`:return`Installing the new Tutti version.`;case`restarting`:return`Restarting local projects.`;case`preparing`:case void 0:return`Preparing the update.`}}function XR(e){let t=e.update;if(t===null||t.status===`up_to_date`||t.latest_version===void 0&&t.status!==`updating`&&t.status!==`failed`)return;let n=e.checking&&t.status===`ready`?`Checking update readiness.`:YR(t);return{label:t.status===`updating`?`Updating…`:`Restart and Update`,disabled:t.status!==`ready`||!t.can_update||e.checking||e.starting,...n===void 0?{}:{description:n}}}function ZR(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length===0?t:n}function QR({inviterName:e,projectName:t,joinUrl:n}){return`${ZR(e,`A teammate`)} invited you to join the Tutti project “${ZR(t,`Untitled project`)}”.\n\nOpen the invitation link:\n${n.trim()}`}var $R=KR();function ez(){let e=window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash;return new URLSearchParams(e).get(`access_token`)}function tz(){window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}`)}function nz(e){return window.open(e,`_blank`,`noopener,noreferrer`)}function rz(){let e=window.open(`about:blank`,`_blank`);return e!==null&&(e.opener=null),e}function iz(){let e=VL(),t=(0,N.useRef)(void 0),n=(0,N.useRef)(void 0),r=(0,N.useRef)(!1),i=(0,N.useRef)(null),a=(0,N.useRef)(!1),o=(0,N.useRef)(null),s=(0,N.useRef)(!1),c=(0,N.useMemo)(()=>Fn({baseUrl:window.location.origin,csrfToken:()=>t.current,contextToken:()=>n.current}),[]),[l,u]=(0,N.useState)(null),[d,f]=(0,N.useState)(null),[p,m]=(0,N.useState)($R),h=(0,N.useRef)(!1),g=(0,N.useRef)({baseUrl:``,apiKey:``}),[_,v]=(0,N.useState)([]),[y,b]=(0,N.useState)(!1),[x,S]=(0,N.useState)(`folder`),[C,w]=(0,N.useState)([]),[T,E]=(0,N.useState)(!0),[ee,D]=(0,N.useState)(!1),[O,k]=(0,N.useState)(!1),[te,ne]=(0,N.useState)(null),[A,re]=(0,N.useState)(null),[ie,j]=(0,N.useState)(!1),[M,ae]=(0,N.useState)(!1);async function oe(){if(t.current!==void 0){E(!0);try{w((await c.getProjects()).projects)}catch(t){e.notify({tone:`error`,title:`Projects unavailable`,message:ZL(t)})}finally{E(!1)}}}async function se(e={}){i.current?.abort();let t=new AbortController;i.current=t,j(!0);try{re(await c.getPackageUpdate({refresh:e.refresh===!0,signal:t.signal}))}catch{}finally{i.current===t&&(i.current=null,j(!1))}}(0,N.useEffect)(()=>{r.current||(r.current=!0,(async()=>{try{let e=ez();if(e!==null&&e.trim()!==``){tz();let r=await c.exchangeSession(e);t.current=r.csrf_token,n.current=r.context_token}let r=await c.getBootstrap();t.current=r.csrf_token,u(r),f(null),await Promise.all([oe(),se()])}catch(e){E(!1),f(ZL(e))}})())},[c]),(0,N.useEffect)(()=>()=>{i.current?.abort()},[]),(0,N.useEffect)(()=>{if(l===null)return;let e=window.setInterval(()=>{c.heartbeat().catch(()=>void 0)},6e4);return()=>window.clearInterval(e)},[l,c]),(0,N.useEffect)(()=>{if(l===null||A?.latest_version===void 0||A.status===`up_to_date`||A.status===`failed`)return;let e=window.setInterval(()=>void se(),A.status===`updating`?2e3:15e3);return()=>window.clearInterval(e)},[l,A?.latest_version,A?.status]),(0,N.useEffect)(()=>{let t=l?.package_update_completion;t===void 0||s.current||(s.current=!0,e.notify(t.restart_failure_count===0?{tone:`success`,title:`Tutti updated to ${t.target_version}`}:{tone:`warning`,title:`Tutti updated to ${t.target_version}`,message:`${t.restart_failure_count} local project${t.restart_failure_count===1?``:`s`} could not restart.`}))},[l,e]),(0,N.useEffect)(()=>{if(A?.status!==`failed`)return;let t=A.reason_code??`update_failed`;o.current!==t&&(o.current=t,e.notify({tone:`error`,title:`Tutti update did not complete`,message:JR(A.reason_code)}))},[e,A]);async function ce(){try{let t=await c.pickFolder();t.kind===`selected`?ge({workspacePath:t.path}):t.kind===`unavailable`&&e.notify({tone:`info`,title:`Use a folder path`,message:t.message})}catch(t){e.notify({tone:`error`,title:`Folder picker unavailable`,message:ZL(t)})}}async function le(){let t={baseUrl:p.baseUrl.trim(),apiKey:p.apiKey.trim()},n=()=>g.current.baseUrl.trim()===t.baseUrl&&g.current.apiKey.trim()===t.apiKey;D(!0);try{let r=await c.discoverModels({base_url:t.baseUrl,api_key:t.apiKey});if(!n())return;r.kind===`ok`?(v(r.models),m(e=>({...e,model:``})),S(`model`)):(v([]),e.notify({tone:`error`,title:`Provider check failed`,message:r.reason===`model_list_empty`?`The endpoint did not return any available models.`:`Check the Base URL and API key, then try again.`}))}catch(t){if(!n())return;v([]),e.notify({tone:`error`,title:`Provider check failed`,message:ZL(t)})}finally{D(!1)}}async function ue(){k(!0);try{let e=await c.launchProject({workspace_path:p.workspacePath.trim(),project:{display_name:p.displayName.trim(),...p.description.trim()===``?{}:{description:p.description.trim()}},provider:{base_url:p.baseUrl.trim(),api_key:p.apiKey.trim(),model:p.model.trim()}});_e(),window.location.assign(e.join_url)}catch(t){e.notify({tone:`error`,title:`Launch failed`,message:ZL(t)})}finally{k(!1)}}async function de(t){ne(t.project_id);try{await c.launchProject({workspace_path:t.workspace_path}),await oe(),e.notify({tone:`success`,title:`${t.display_name} is ready`})}catch(t){let n=t instanceof Jt&&t.code===`provider_configuration_required`;e.notify({tone:n?`warning`:`error`,title:n?`Provider required`:`Launch failed`,message:n?`Use New project with this folder to update its Provider configuration.`:ZL(t)})}finally{ne(null)}}async function fe(t){ne(t.project_id);try{let n=await c.refreshInvite(t.project_id);await navigator.clipboard.writeText(QR({inviterName:``,projectName:t.display_name,joinUrl:n.join_url})),w(e=>e.map(e=>e.project_id===t.project_id?{...e,join_url:n.join_url}:e)),e.notify({tone:`success`,title:`Invitation copied`})}catch(t){e.notify({tone:`error`,title:`Invite unavailable`,message:ZL(t)})}finally{ne(null)}}async function pe(t){if(t.open_url===void 0)return;if(t.update_required!==!0){nz(t.open_url);return}let n=rz();ne(t.project_id);try{let r=await c.openProject(t.project_id);w(e=>e.map(e=>e.project_id===r.project.project_id?r.project:e)),n===null?window.location.assign(r.open_url):n.location.replace(r.open_url),r.disposition===`updated`?e.notify({tone:`success`,title:`${t.display_name} updated`}):r.disposition===`deferred_busy`?e.notify({tone:`info`,title:`Opened without updating`,message:`Try Open again after the current project activity finishes.`}):r.disposition===`deferred_unsupported`?e.notify({tone:`info`,title:`Opened with the current Host`,message:`Stop and Resume this project once to enable safe automatic updates.`}):r.disposition===`deferred_unavailable`&&e.notify({tone:`warning`,title:`Update deferred`,message:`The current Host could not be safely restarted, so the project opened as-is.`})}catch(t){n?.close(),e.notify({tone:`error`,title:`Open failed`,message:ZL(t)})}finally{ne(null)}}async function me(t){ne(t.project_id);try{await c.stopProject(t.project_id),await Promise.all([oe(),se()]),e.notify({tone:`success`,title:`${t.display_name} stopped`})}catch(t){e.notify({tone:`error`,title:`Stop failed`,message:ZL(t)})}finally{ne(null)}}async function he(){if(!(a.current||A?.status!==`ready`||!A.can_update)){a.current=!0,ae(!0);try{re(await c.startPackageUpdate())}catch(t){t instanceof Jt&&t.statusCode===0?re({...A,status:`updating`,can_update:!1,phase:`preparing`}):(e.notify({tone:`error`,title:`Update not started`,message:ZL(t)}),await se())}finally{a.current=!1,ae(!1)}}}function ge(e){e.displayName!==void 0&&(h.current=!0);let t=e.baseUrl!==void 0&&e.baseUrl!==p.baseUrl||e.apiKey!==void 0&&e.apiKey!==p.apiKey;t&&(v([]),g.current={baseUrl:e.baseUrl??p.baseUrl,apiKey:e.apiKey??p.apiKey}),m(n=>({...e.workspacePath===void 0?n:qR(n,e.workspacePath,h.current),...e,...t?{model:``}:{}}))}function _e(){b(!1),S(`folder`),v([]),g.current={baseUrl:``,apiKey:``},h.current=!1,m(KR())}function ve(e){if(!e){!ee&&!O&&_e();return}let t=l?.invocation.source===`terminal`?l.invocation.current_directory:``;h.current=!1,g.current={baseUrl:``,apiKey:``},v([]),m(KR(t)),S(`folder`),b(!0)}function ye(e){if(e.preventDefault(),x===`folder`){S(`details`);return}if(x===`details`){S(`provider`);return}if(x===`provider`){le();return}ue()}function be(){S(e=>{switch(e){case`folder`:return`folder`;case`details`:return`folder`;case`provider`:return`details`;case`model`:return`provider`}})}let xe=XR({update:A,checking:ie,starting:M});return(0,P.jsx)(NS,{form:p,models:_,projects:C,projectsLoading:T,sessionLoading:l===null&&d===null,sessionError:d,createOpen:y,createStep:x,modelDiscoveryPending:ee,launchPending:O,projectActionPending:te,...xe===void 0?{}:{packageUpdateAction:xe},onChange:ge,onCreateOpenChange:ve,onCreateSubmit:ye,onCreateBack:be,onChooseFolder:()=>void ce(),onRefresh:()=>void Promise.all([oe(),se({refresh:!0})]),onLaunchExisting:e=>void de(e),onOpenProject:e=>void pe(e),onCopyInvite:e=>void fe(e),onStopProject:e=>void me(e),onPackageUpdate:()=>void he()})}var az=/^[A-Za-z0-9_-]{8,256}$/u,oz=/https?:\/\/[^\s<>"'`“”‘’]+/giu,sz=/(?:^|[\s("'“‘])((?:\/)?join\/[A-Za-z0-9_-]{8,256})(?=$|[\s?#.,;:!'"”’)\]}])/giu,cz=/[.,;:!?)}\]]+$/u;function lz(e){let t;try{t=decodeURIComponent(e)}catch{return null}return az.test(t)?t:null}function uz(e){let t=e.split(`/`).filter(Boolean);return t.length!==2||t[0]!==`join`?null:lz(t[1]??``)}function dz(e,t){let n=uz(t);n!==null&&e.add(`/join/${encodeURIComponent(n)}`)}function fz(e,t){try{dz(e,new URL(t.replace(cz,``)).pathname)}catch{}}function pz(e){let t=e.trim();if(t===``)return{kind:`empty`};let n=new Set;for(let e of t.matchAll(oz))fz(n,e[0]);for(let e of t.matchAll(sz)){let t=e[1];if(t!==void 0)try{dz(n,new URL(t,`https://tutti.invalid`).pathname)}catch{}}let r=lz(t);return r!==null&&n.add(`/join/${encodeURIComponent(r)}`),n.size===0?{kind:`invalid`}:n.size>1?{kind:`ambiguous`}:{kind:`matched`,route:[...n][0]}}function mz({requestedOpenProjectRef:e}){let t=rt(),n=VL(),r=OR(),i=kR(),[a,o]=(0,N.useState)(``),[s,c]=(0,N.useState)(null),[l,u]=(0,N.useState)(!1),d=(0,N.useRef)(null),f=F({queryKey:Q.me,queryFn:()=>Bn(KL)}),p=F({queryKey:Q.recentProjects,queryFn:()=>qn(KL),enabled:f.isSuccess});eR(f.isSuccess);let m=yt({mutationFn:e=>Jn(KL,e),onSuccess:e=>{if(QL(t),e.disposition.kind===`opened`&&e.result?.open_url!==void 0){YL(e.result.open_url);return}n.notify({tone:`warning`,title:`Host is offline`})},onError:e=>{n.notify({tone:`error`,title:`Project open failed`,message:ZL(e)})}}),h=m.mutate;(0,N.useEffect)(()=>{e===void 0||f.data?.account.profile_complete!==!0||d.current===e||(d.current=e,h(e))},[f.data?.account.profile_complete,h,e]);let g=yt({mutationFn:()=>Wn(KL),onSuccess:()=>{t.invalidateQueries({queryKey:Q.relayRoot}),t.invalidateQueries({queryKey:Q.me}),t.invalidateQueries({queryKey:Q.recentProjects})},onError:e=>{n.notify({tone:`error`,title:`Sign out failed`,message:ZL(e)})}});if(f.error!==null&&Qt(f.error))return(0,P.jsx)(CS,{...r,onBrandClick:()=>$(`/`)});let _=f.data?.account;if(_!==void 0&&!_.profile_complete)return(0,P.jsx)(CS,{...i,onBrandClick:()=>$(`/`)});let v=(p.data?.projects??[]).map(ar);return(0,P.jsx)(FS,{account:_===void 0?null:{displayName:_.display_name},projects:v,loading:f.isLoading||p.isLoading,error:f.error===null?p.error===null?null:ZL(p.error):ZL(f.error),openPending:m.isPending,logoutPending:g.isPending,joinLinkForm:{value:a,error:s,onChange:e=>{o(e),c(null)},onSubmit:()=>{let e=pz(a);if(e.kind!==`matched`){c(e.kind===`ambiguous`?`Paste one Tutti invitation at a time.`:`Paste a valid Tutti invitation.`);return}$(e.route)}},launchExpanded:l,onLaunch:()=>u(!0),onCopyLaunchCommand:e=>{navigator.clipboard.writeText(e).then(()=>{n.notify({tone:`success`,title:`Command copied`})}).catch(()=>{n.notify({tone:`error`,title:`Copy failed`,message:`The browser could not copy the launch command.`})})},onBrandClick:()=>$(`/`),onOpenProject:e=>m.mutate(e),onLogout:()=>g.mutate()})}function hz(e){let t=e?.relay;if(t?.join_url_visibility===`visible_once`&&t.join_url!==void 0&&t.join_url.trim()!==``)return t.join_url}function gz(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return!1}}function _z(e,t){let n=hz(e);if(n!==void 0)return{kind:`join`,joinUrl:n};let r=e?.relay?.relay_project_ref;return r===void 0?{kind:`unavailable`,message:`Relay project is unavailable`}:gz(t.currentOrigin,t.relayBaseUrl)?{kind:`relay_open`,relayProjectRef:r}:{kind:`unavailable`,message:`Open the latest Join URL printed by tutti launch.`}}var vz=`gpt-5.5`,yz=`/host-local/v1`;function bz(){return new URL(window.location.href).searchParams.get(`token`)?.trim()??``}function xz(e){return{baseUrl:yz,credentials:`same-origin`,headers:{authorization:`Bearer ${e}`}}}function Sz(e){return I(xz(e),`/provider/config`)}function Cz(e){return I(xz(e),`/launch-status`)}function wz(e){return I(xz(e),`/project`)}function Tz(e,t){return I(xz(e),`/project`,{method:`POST`,body:t})}function Ez(e,t){return I(xz(e),`/provider/config`,{method:`POST`,body:t})}function Dz(e){return e===void 0?`loading`:e.status===`configured`?`configured`:e.status===`invalid`?`invalid`:`not configured`}function Oz(e){let t=e instanceof Error&&`code`in e?String(e.code):``;return t.startsWith(`provider_`)?t:ZL(e)}function kz(){let e=bz(),t=e===``,[n,r]=(0,N.useState)({projectName:``,apiKey:``,baseUrl:``,defaultModel:vz}),[i,a]=(0,N.useState)(null),[o,s]=(0,N.useState)(null),c=(0,N.useRef)(!1),l=F({queryKey:[`host-local`,`provider-config`,e],queryFn:()=>Sz(e),enabled:!t}),u=F({queryKey:[`host-local`,`launch-status`,e],queryFn:()=>Cz(e),enabled:!t}),d=F({queryKey:[`host-local`,`project`,e],queryFn:()=>wz(e),enabled:!t}),f=u.data,p=yt({mutationFn:e=>Jn(KL,e.relayProjectRef),onSuccess:e=>{if(e.disposition.kind===`opened`&&e.result?.open_url!==void 0){YL(e.result.open_url);return}s(`Host is offline`)},onError:e=>{s(ZL(e))}}),m=yt({mutationFn:async()=>{let t=n.projectName.trim(),r=d.data?.display_name.trim()??``;t!==``&&t!==r&&await Tz(e,{display_name:t});let i={api_key:n.apiKey.trim()},a=n.baseUrl.trim(),o=n.defaultModel.trim();return a!==``&&(i.base_url=a),o!==``&&(i.default_model=o),await Ez(e,i)},onSuccess:()=>{a(`Provider saved.`),r(e=>({...e,apiKey:``})),d.refetch(),l.refetch(),v()}}),h=l.data;(0,N.useEffect)(()=>{let e=d.data?.display_name;e!==void 0&&r(t=>t.projectName.trim()===``?{...t,projectName:e}:t)},[d.data?.display_name]),(0,N.useEffect)(()=>{t||h?.status!==`configured`||v()},[h?.status,t]);let g=t?`Setup token is missing.`:d.error===null?l.error===null?m.error===null?o:Oz(m.error):Oz(l.error):Oz(d.error);function _(e){e.preventDefault(),a(null),s(null),c.current=!1,!t&&n.apiKey.trim()!==``&&n.projectName.trim()!==``&&m.mutate()}async function v(){if(c.current)return;c.current=!0;let e=_z(f??(await u.refetch()).data,{currentOrigin:window.location.origin,relayBaseUrl:GL});if(e.kind===`join`){window.location.assign(e.joinUrl);return}if(e.kind===`unavailable`){s(e.message);return}p.mutate({relayProjectRef:e.relayProjectRef})}return(0,P.jsx)(LS,{form:n,statusLabel:Dz(h),configured:h?.status===`configured`,loading:l.isLoading||d.isLoading,pending:m.isPending,tokenMissing:t,error:g,success:i,openProjectPending:p.isPending,onChange:e=>r(t=>({...t,...e})),onSubmit:_,onRetry:()=>void l.refetch(),onBrandClick:()=>$(`/`)})}function Az(e){return`${e.created_at}:${e.id}`}function jz(e){return{kind:`initial`,entry:e}}function Mz(e,t=50){if(e.kind===`older`)return{before:e.before,limit:t};if(e.kind===`newer`)return{after:e.after,limit:t};switch(e.entry.kind){case`latest`:return{limit:t};case`start`:return{anchor:`start`,limit:t};case`around`:return{around:e.entry.messageId,limit:t}}}function Nz(e){let t=e.window.older_cursor;return e.window.has_older&&t!==void 0?{kind:`older`,before:t}:void 0}function Pz(e){let t=e.window.newer_cursor;return e.window.has_newer&&t!==void 0?{kind:`newer`,after:t}:void 0}function Fz(e,t=50){let n=e[0],r=e.at(-1);if(n===void 0||r===void 0)return{items:[],window:{has_older:!1,has_newer:!1,limit:t}};let i=new Map;for(let t of e)for(let e of t.items)i.set(e.id,e);let a=[...i.values()].sort((e,t)=>Az(e).localeCompare(Az(t))),o={has_older:n.window.has_older,has_newer:r.window.has_newer,limit:n.window.limit};return o.has_older&&n.window.older_cursor!==void 0&&(o.older_cursor=n.window.older_cursor),o.has_newer&&r.window.newer_cursor!==void 0&&(o.newer_cursor=r.window.newer_cursor),{items:a,window:o}}var Iz=5400,Lz=1500;function Rz(e){let t=e.completionSource;return t?.activityRef??t?.workflowRef??t?.taskId??e.key}function zz(e){switch(e.kind){case`accepted`:case`already_running`:return null;case`scratchpad_empty`:return{label:`Scratchpad is empty. Let it refresh before running.`,tone:`error`};case`stale_scratchpad`:return{label:`Scratchpad changed. Review the latest snapshot and run again.`,tone:`error`};case`provider_not_configured`:return{label:`Provider is not configured yet.`,tone:`error`};case`provider_unavailable`:return{label:`Provider unavailable: ${e.reason}.`,tone:`error`};case`interrupted`:return{label:`Run was interrupted. Try again.`,tone:`error`}}}function Bz(e,t){t.displayName.trim()===``||e.has(t.key)||e.set(t.key,t)}function Vz(e){if(e.author.kind!==`human`)return null;let t=e.author.display_name?.trim()||`Member`;return{key:e.author.ref===void 0?`message-author:${t.toLocaleLowerCase()}`:e.author.ref,displayName:t,avatar:e.author.avatar??{kind:`initials`,initials:dr(t),color:`blue`}}}function Hz({account:e,presence:t,messages:n=[]}){let r=new Map;e!==void 0&&Bz(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of t?.sample_members??[])Bz(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of t?.members??[])Bz(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of n){let t=Vz(e);t!==null&&Bz(r,t)}return[...r.values()]}function Uz({account:e,presence:t}){let n={},r=(e,t)=>{let r=n[e];n[e]={avatar:t.avatar,online:r?.online===!0||t.online}};for(let e of t?.members??[])r(e.account_ref,{avatar:e.avatar,online:e.online});for(let e of t?.sample_members??[])r(e.account_ref,{avatar:e.avatar,online:!0});return e!==void 0&&r(e.account_ref,{avatar:e.avatar,online:!0}),n}function Wz({relayProjectRef:e}){let t=rt(),n=VL(),r=(0,N.useMemo)(()=>Pn({...KL,relayProjectRef:e}),[e]),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(``),[c,l]=(0,N.useState)(null),[u,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(null),[m,h]=(0,N.useState)(()=>Date.now()),[g,_]=(0,N.useState)(null),v=new URL(JL(),window.location.origin).searchParams.get(`message`),y=v!==null&&Vt(v,Lt.message)?v:void 0,[b,x]=(0,N.useState)(()=>y===void 0?{kind:`latest`}:{kind:`around`,messageId:y}),S=(0,N.useRef)(null),C=(0,N.useRef)(null),w=(0,N.useRef)(null),[T,E]=(0,N.useState)(null),ee=u!==null;(0,N.useEffect)(()=>{y!==void 0&&(b.kind!==`around`||b.messageId!==y)&&x({kind:`around`,messageId:y})},[b,y]);let D=(t=null)=>{x({kind:`latest`}),_(t),y!==void 0&&$(rn(e),{replace:!0})},O=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:qL}),k=O.data?.session.account.account_ref,te=k===void 0?null:`${k}:${e}`,ne=y!==void 0||te!==null&&T===te;(0,N.useEffect)(()=>{te===null||T===te||(y===void 0&&k!==void 0&&x(LR(k,e).start_chat_pending?{kind:`start`}:{kind:`latest`}),E(te))},[k,te,e,y,T]);let A=bt({queryKey:Q.messageHistory(e,b,50),queryFn:({pageParam:e})=>r.getMessages(Mz(e)),initialPageParam:jz(b),getPreviousPageParam:e=>Nz(e),getNextPageParam:e=>Pz(e),enabled:O.isSuccess&&ne,staleTime:qL}),re=F({queryKey:Q.scratchpad(e),queryFn:()=>r.getScratchpad(),enabled:O.isSuccess,staleTime:qL,refetchInterval:ee?Lz:!1}),ie=F({queryKey:Q.activeClarification(e),queryFn:()=>r.getActiveClarification(),enabled:O.isSuccess,staleTime:qL,refetchInterval:ee?Lz:!1}),j=F({queryKey:Q.activeApproval(e),queryFn:()=>r.getActiveApproval(),enabled:O.isSuccess,staleTime:qL}),M=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:O.isSuccess,staleTime:qL,refetchInterval:ee?Lz:!1}),ae=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:O.isSuccess,staleTime:qL}),oe=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:O.isSuccess,staleTime:qL}),se=F({queryKey:Q.projectPresence(e),queryFn:()=>Yn(KL,e),enabled:O.isSuccess,staleTime:qL,refetchInterval:6e4});eR(O.isSuccess);let ce=yt({mutationFn:e=>r.updateProjectDisplayName({display_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project name`,message:e}),onSuccess:(r,i,a)=>{tR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project name saved`,message:i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project name save failed`,message:`${t}: ${ZL(e)}`})}}),le=yt({mutationFn:e=>r.updateProjectDescription({description:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project description`,...e.length===0?{}:{message:e}}),onSuccess:(r,i,a)=>{tR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project description saved`,...i.length===0?{}:{message:i}})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project description save failed`,message:ZL(e)})}}),ue=yt({mutationFn:({body:e,commandId:t})=>r.sendMainChatMessage({body:e},{commandId:t}),onSuccess:(n,r)=>{S.current=null,a(e=>e.trim()===r.body?``:e),n.result?.message!==void 0&&(b.kind===`latest`&&!A.hasNextPage?_(n.result.message.id):D(n.result.message.id)),tR(t,e,n.invalidates)},onError:e=>{n.notify({tone:`error`,title:`Message send failed`,message:ZL(e)})}}),de=yt({mutationFn:async t=>{let n=await DR({relayProjectRef:e,purpose:`reference_file`,file:t});return r.uploadReferenceFile(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading reference`,message:e.name}),onSuccess:(r,i,a)=>{let o=r.result?.message;o!==void 0&&(b.kind===`latest`&&!A.hasNextPage?_(o.id):D(o.id)),tR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Reference uploaded`,message:r.result?.file.name??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Reference upload failed`,message:ZL(e)})}}),fe=yt({mutationFn:e=>r.submitWorklist(e===void 0?{}:{expected_scratchpad_updated_at:e}),onMutate:()=>(d({kind:`request`}),n.notify({tone:`loading`,title:`Running Scratchpad`})),onSuccess:(r,i,a)=>{if(r.disposition.kind===`accepted`){let e=r.result?.activity_ref;d(e===void 0?null:{kind:`activity`,activityRef:e,...r.result?.workflow_ref===void 0?{}:{workflowRef:r.result.workflow_ref}}),n.update(a,{tone:`success`,title:`Scratchpad run started`,message:`Tutti is preparing Worklist tasks.`})}else if(r.disposition.kind===`already_running`)d(null),n.update(a,{tone:`info`,title:`Already running`,message:`Tutti is already processing work.`});else{d(null);let e=zz(r.disposition);n.update(a,{tone:e?.tone??`warning`,title:`Scratchpad run blocked`,...e?.label===void 0?{}:{message:e.label}})}tR(t,e,r.invalidates)},onError:(e,t,r)=>{d(null),n.update(r,{tone:`error`,title:`Scratchpad run failed`,message:ZL(e)})}}),pe=O.data,me=Uz({account:pe?.session.account,presence:se.data?.presence}),he=pe?.generated_at??new Date(0).toISOString(),ge=A.data===void 0?void 0:Fz(A.data.pages,50),_e=ge??(ne&&b.kind===`latest`?pe?.snapshots.main_chat:void 0)??nR(),ve=A.data!==void 0&&A.hasPreviousPage===!0,ye=A.data!==void 0&&A.hasNextPage===!0,be=b.kind===`latest`||b.kind===`start`&&!ye||b.kind===`around`&&_e.items.length>0&&!ye,xe=b.kind===`around`?`around:${b.messageId}`:b.kind,Se=b.kind===`around`?`focus`:b.kind===`start`?`start`:`latest`,Ce=pe!==void 0&&(!ne||ge===void 0&&A.isLoading&&(b.kind!==`latest`||pe.snapshots.main_chat===void 0)),we=re.data??pe?.snapshots.scratchpad??iR(),Te=ae.data??pe?.snapshots.read_state;sR({enabled:O.isSuccess,hostClient:r,relayProjectRef:e,readState:Te,scope:`chat`});let Ee=ie.data??pe?.snapshots.active_clarification??cR(),De=j.data??pe?.snapshots.active_approval??{state:`none`},Oe=Ee.state===`active`?Ee.round.id:void 0;(0,N.useEffect)(()=>{c!==null&&(Oe===void 0||c!==Oe)&&l(null)},[Oe,c]);let ke=Ee.state===`active`&&Ee.thread.owner.kind===`task_compile`,Ae=(0,N.useMemo)(()=>{let e=new Set;for(let t of _e.items)t.clarification_card!==void 0&&e.add(t.clarification_card.round_id);return Oe!==void 0&&e.add(Oe),[...e]},[Oe,_e.items]),je=_t({queries:Ae.map(t=>({queryKey:Q.clarificationRoundMessages(e,t),queryFn:()=>r.getClarificationRoundMessages(t,{anchor:`start`,limit:50}),enabled:O.isSuccess}))}),Me=yt({mutationFn:({roundId:e,body:t})=>r.sendClarificationRoundMessage(e,{body:t}),onSuccess:n=>{s(``),tR(t,e,n.invalidates)},onError:e=>{n.notify({tone:`error`,title:`Reply send failed`,message:ZL(e)})}}),Ne=yt({mutationFn:e=>r.submitClarificationRound(e),onMutate:e=>(l(e),n.notify({tone:`loading`,title:`Submitting reply`})),onSuccess:(r,i,a)=>{tR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Reply submitted`})},onError:(e,t,r)=>{l(e=>e===t?null:e),n.update(r,{tone:`error`,title:`Reply submit failed`,message:ZL(e)})}}),Pe=yt({mutationFn:({approvalId:e,decisionId:t})=>r.decideApproval(e,{decision_id:t}),onMutate:()=>n.notify({tone:`loading`,title:`Sending decision`}),onSuccess:(r,i,a)=>{tR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Decision sent`})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Decision failed`,message:ZL(e)})}}),Fe=Object.fromEntries(Ae.map((e,t)=>[e,(je[t]?.data??nR()).items.map(e=>_r(e,{authorProfiles:me}))])),Ie=Hz({account:pe?.session.account,presence:se.data?.presence,messages:[..._e.items,...je.flatMap(e=>e.data?.items??[])]}),Le=M.data??pe?.snapshots.execution_status??lR(he),Re=uR(Le),ze=dR(Le,`scratchpad_refresh`),Be=dR(Le,`scratchpad_refresh`,`foreground`),Ve=dR(Le,`task_compile`,`foreground`),He=dR(Le,`project_context_bootstrap`,`foreground`),Ue=u?.kind===`activity`?u.activityRef:void 0,We=u?.kind===`activity`?u.workflowRef:void 0;(0,N.useEffect)(()=>{if(u===null)return;if(we.state===`submitted`){d(null);return}if(we.state===`empty`){d(null);return}if(Le.status===`pending`){ke||d(null);return}let e=Le.last_conclusion,t=We!==void 0&&e?.workflow_ref===We,r=Ue!==void 0&&e?.activity_ref===Ue;if(!(!t&&!r)){if(d(null),e?.kind===`failed`){n.notify({tone:`error`,title:`Scratchpad run failed`,message:e.summary});return}if(e?.kind===`needs_human`){n.notify({tone:`warning`,title:`Scratchpad needs input`,message:e.summary});return}}},[Le.last_conclusion?.activity_ref,Le.last_conclusion?.kind,Le.last_conclusion?.summary,Le.last_conclusion?.workflow_ref,Le.status,Le.summary,ke,n,we.state,u,Ue,We]);let Ge=Ue!==void 0&&Re.some(e=>e.activity_ref===Ue),Ke=Ge&&Re.some(e=>e.activity_ref===Ue&&e.workflow_kind===`scratchpad_refresh`)||u!==null&&Be,qe=Ve||He||Ke||Ge||ke,Je=ze,Ye=fe.isPending||qe||u!==null&&Le.status===`idle`,Xe=Le.status!==`idle`||Ye||f!==null;(0,N.useEffect)(()=>{if(!Xe)return;h(Date.now());let e=window.setInterval(()=>{h(Date.now())},1e3);return()=>{window.clearInterval(e)}},[Xe]);let Ze=Re.some(e=>e.activity_kind===`procedure`&&(e.lane??`foreground`)===`foreground`)&&!Je&&!Ye,Qe=Wx(Le),$e={key:`scratchpad-submit`,label:ke?`Needs input`:Ke?`Compiling Worklist tasks`:He?`Preparing project context`:Ve?`Compiling Worklist tasks`:`Preparing Worklist`,title:ke?`Needs input`:`Preparing Scratchpad for Worklist.`,tone:ke?`pending`:`running`,target:ke?{kind:`clarification`}:{kind:`scratchpad`}},et=Ye&&Qe.length===0?[$e]:Qe,tt=Bx(Le,{now:m}),nt=Re.find(e=>(e.lane??`foreground`)===`foreground`?e.workflow_kind===`project_context_bootstrap`&&He||e.workflow_kind===`task_compile`&&Ve||e.workflow_kind===`scratchpad_refresh`&&Ke?!0:Ue!==void 0&&e.activity_ref===Ue:!1),it=(Ye?Vx({activeScratchpadRefreshFromSubmit:Ke,activeProjectContextBootstrap:He,activeTaskCompile:Ve,activeTaskCompileClarification:ke,now:m,...nt?.started_at===void 0?{}:{startedAt:nt.started_at},...Le.runtime===void 0?{}:{runtime:Le.runtime}}):null)??tt;(0,N.useEffect)(()=>{it!==null&&(C.current=it,p(null))},[it]),(0,N.useEffect)(()=>{if(!ze||it!==null)return;let e=C.current;if(e?.completionSource===void 0)return;let t=`hidden:${Rz(e)}`;if(w.current===t)return;w.current=t;let n=Hx(e,e.summary);p(n),C.current=null;let r=window.setTimeout(()=>{p(e=>e?.key===n.key?null:e)},Iz);return()=>{window.clearTimeout(r)}},[it,ze]),(0,N.useEffect)(()=>{if(it!==null||Le.status!==`idle`)return;let e=Le.last_conclusion;if(e?.kind!==`completed`)return;let t=e.activity_ref??`${e.kind}:${e.task_id??`none`}:${e.occurred_at}`;if(w.current===t)return;let n=C.current;if(n===null)return;if(!Ux(n,e)){C.current=null;return}w.current=t;let r=Hx(n,e.summary);p(r);let i=window.setTimeout(()=>{p(e=>e?.key===r.key?null:e),C.current=null},Iz);return()=>{window.clearTimeout(i)}},[it,Le.last_conclusion?.activity_ref,Le.last_conclusion?.kind,Le.last_conclusion?.occurred_at,Le.last_conclusion?.summary,Le.last_conclusion?.task_id,Le.status]);let at=it??f,ot=f===null?null:{key:`completed`,label:`Completed`,tone:`done`,target:f.completionTarget??{kind:`scratchpad`}},st=ot===null?et:[ot,...et],ct=e=>{e.preventDefault();let t=i.trim();if(t!==``&&!ue.isPending){let e=S.current?.body===t?S.current:{body:t,commandId:Wt()};S.current=e,ue.mutate(e)}},lt=e=>{e.preventDefault();let t=o.trim();t!==``&&Oe!==void 0&&!Me.isPending&&Me.mutate({roundId:Oe,body:t})},ut=ne&&ge===void 0&&A.error!==null&&(b.kind!==`latest`||pe?.snapshots.main_chat===void 0),dt=pe===void 0&&O.error!==null||ut;return(0,N.useEffect)(()=>{y!==void 0&&_(y)},[y]),(0,P.jsx)(CC,{projectName:pe?.workspace.project.display_name??`Workspace`,projectDescription:pe?.workspace.project.description??``,members:Ie,messages:_e.items.map(e=>_r(e,{authorProfiles:me,referenceAssetUrl:(e,t,n)=>r.viewerAssetUrl({path:e,variant:t,v:n})})),scratchpad:Nr(we,_e.items),executionProgress:at,activeApproval:Sr(De),activeClarification:vr(Ee),clarificationMessagesByRoundId:Fe,statusShortcuts:st,unread:aR(Te),artifactSignal:oR(oe.data),draft:i,roundDraft:o,sendPending:ue.isPending,focusMessageId:g,messageHistoryIdentity:xe,initialMessagePosition:Se,hasOlderMessages:ve,hasNewerMessages:ye,loadingOlderMessages:A.isFetchingPreviousPage,loadingNewerMessages:A.isFetchingNextPage,historyConnectedToLatest:be,submittedRoundId:c,referenceUploadPending:de.isPending,scratchpadSyncPending:Je,scratchpadActionsDisabled:Ze,scratchpadSubmitPending:Ye,roundSendPending:Me.isPending,roundSubmitPending:Ne.isPending,approvalDecisionPending:Pe.isPending,projectNameSaving:ce.isPending,projectDescriptionSaving:le.isPending,loading:pe===void 0&&O.isLoading||Ce,unavailable:dt,onDraftChange:e=>{S.current?.body!==e.trim()&&(S.current=null),a(e)},onMessageFocused:()=>_(null),onInitialMessagePositioned:()=>{b.kind===`start`&&A.isSuccess&&k!==void 0&&BR(k,e)},onLoadOlderMessages:()=>{A.fetchPreviousPage()},onLoadNewerMessages:()=>{A.fetchNextPage()},onJumpToLatest:()=>D(),onUploadReferenceFile:e=>de.mutate(e),onOpenReferenceFile:t=>$(fR(e,t)),onRoundDraftChange:s,onSendMessage:ct,onSendRoundMessage:lt,onSubmitRound:()=>{Oe!==void 0&&Ne.mutate(Oe)},onDecideApproval:(e,t)=>Pe.mutate({approvalId:e,decisionId:t}),onSubmitScratchpad:()=>fe.mutate(we.updated_at),onUpdateProjectDisplayName:async e=>{await ce.mutateAsync(e)},onUpdateProjectDescription:async e=>{await le.mutateAsync(e)},onOpenProjectCenter:()=>$(`/projects`),onOpenWorklist:()=>$(mR(e)),onOpenWorklistTask:t=>$(mR(e,t)),onOpenReferences:()=>$(fR(e)),onOpenArtifacts:()=>$(pR(e)),onOpenSkills:()=>$(vR(e)),onOpenTimeline:()=>$(_R(e)),onOpenSettings:()=>$(gR(e)),onActivateStatusShortcut:t=>bR(e,t)})}function Gz(e){return Qt(e)?Zt(e,`relay_session_invalid`)?`client_session`:`account_session`:null}function Kz(e){return e===`client_session`?{title:`Workspace session expired`,message:`Open the project again from Project Center.`}:{title:`Sign in required`,message:`Sign in to Tutti before opening this workspace.`}}function qz(e){return e===`client_session`?`/projects`:`/`}function Jz({relayProjectRef:e,children:t}){let n=rt(),r=VL(),i=(0,N.useMemo)(()=>Pn({...KL,relayProjectRef:e}),[e]),a=(0,N.useRef)(void 0),o=(0,N.useRef)(null),s=F({queryKey:Q.bootstrap(e),queryFn:()=>i.getBootstrap(),staleTime:qL}),c=Gz(s.error),l=c===null&&s.data?.workspace.capabilities.sse===!0;return a.current===void 0&&s.data!==void 0&&(a.current=s.data.event_cursor),(0,N.useEffect)(()=>{if(c===null)return;let t=`${e}:${c}`;o.current!==t&&(o.current=t,r.notify({tone:`warning`,...Kz(c)}),$(qz(c),{replace:!0}))},[c,r,e]),(0,N.useEffect)(()=>{if(!l)return;let t=i.connectEvents({...a.current===void 0?{}:{after:a.current},onReady:t=>{t.payload.replay.status===`missed`&&n.invalidateQueries({queryKey:Q.hostRoot(e)})},onInvalidate:t=>{tR(n,e,t)},onError:()=>void 0});return()=>t.close()},[i,n,e,l]),c===null?t:null}function Yz({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...KL,relayProjectRef:e}),[e]),n=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap(),staleTime:qL}).data?.session.account.account_ref,r=n===void 0?null:`${n}:${e}`,[i,a]=(0,N.useState)({identity:null,pending:!1}),[o,s]=(0,N.useState)(!1),c=Bd();(0,N.useEffect)(()=>{n===void 0||r===null||i.identity===r||a({identity:r,pending:LR(n,e).tour_pending})},[n,r,i.identity,e]);let l=t=>{VR(t,e),a({identity:r,pending:!1})};return(0,P.jsxs)(P.Fragment,{children:[c&&r!==null&&i.identity===r&&i.pending&&n!==void 0&&typeof document<`u`?(0,_c.createPortal)((0,P.jsx)(qd,{onOpen:()=>{l(n),s(!0)},onDismiss:()=>l(n)}),document.body):null,(0,P.jsx)(Jd,{assets:aS,open:o,onOpenChange:s})]})}var Xz=2e4,Zz=3e4;function Qz(e){let t=e.intervalMs??Xz,n=e.setIntervalFn??window.setInterval.bind(window),r=e.clearIntervalFn??window.clearInterval.bind(window),i=!0,a=!1,o=!1,s=()=>{!i||a||(a=!0,e.renew().then(()=>{i&&!o&&(o=!0,e.onInitialRenewed?.())}).catch(()=>void 0).finally(()=>{a=!1}))};s();let c=n(s,t);return()=>{i=!1,r(c)}}function $z(e,t,n={}){let r=n.runActive??!1;if(e===void 0)return r?{status:`updating`}:{status:`loading`};if(e.status===`not_declared`)return r?{status:`updating`}:{status:`not_declared`};if(e.status===`invalid`)return r?{status:`updating`}:{status:`invalid`,message:e.error.message};let i={status:`declared`,title:e.artifact.title,previewStatus:e.preview.status,...e.preview.error_message===void 0?{}:{errorMessage:e.preview.error_message}};return e.preview.status===`ready`?t.previewUrl===void 0?r?{status:`updating`}:t.errorMessage===void 0?{...i,previewStatus:t.pending?`starting`:`failed`,...t.pending?{}:{errorMessage:`Preview session is unavailable`}}:{...i,previewStatus:`failed`,errorMessage:t.errorMessage}:{...i,previewUrl:t.previewUrl}:r?{status:`updating`}:i}function eB(e){if(!(e===void 0||e.disposition.kind===`issued`))return e.disposition.kind===`invalid_manifest`?e.disposition.message:e.disposition.kind===`preview_not_ready`?e.disposition.message??`Preview is not ready`:e.disposition.kind===`not_declared`?`Artifact is no longer declared`:`Preview session expired before it could be opened`}function tB(e){return e===void 0?!1:e.disposition.kind!==`issued`||e.result===void 0?e.disposition.kind===`preview_not_ready`||e.disposition.kind===`interrupted`?1e3:!1:Math.max(1e3,Date.parse(e.result.expires_at)-Date.now()-Zz)}function nB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...KL,relayProjectRef:e}),[e]),n=(0,N.useMemo)(()=>zn(KL),[]),r=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap(),staleTime:qL}),i=F({queryKey:Q.artifacts(e),queryFn:()=>t.getArtifacts(),enabled:r.isSuccess,staleTime:qL}),a=F({queryKey:Q.executionStatus(e),queryFn:()=>t.getExecutionStatus(),enabled:r.isSuccess,staleTime:qL}),o=F({queryKey:Q.readState(e),queryFn:()=>t.getReadState(),enabled:r.isSuccess,staleTime:qL}),s=r.data,c=s?.generated_at??new Date(0).toISOString(),l=o.data??s?.snapshots.read_state,u=a.data??s?.snapshots.execution_status??lR(c),d=u.active_activity?.activity_kind===`run`||u.active_activities?.some(e=>e.activity_kind===`run`)===!0,f=i.data?.artifact,p=f?.status===`declared`&&f.preview.status===`ready`&&f.preview.url!==void 0?f.preview.url:null,m=F({queryKey:Q.artifactPreviewSession(e,p??`not-ready`),queryFn:()=>n.issueArtifactPreviewSession(e),enabled:p!==null,staleTime:1/0,retry:1,refetchInterval:e=>tB(e.state.data)}),h=m.data,g=h?.disposition.kind===`issued`?h.result?.bootstrap_url:void 0,_=m.error===null?eB(h):ZL(m.error);(0,N.useEffect)(()=>{if(r.isSuccess)return Qz({renew:()=>t.renewArtifactPreviewLease(),onInitialRenewed:()=>{i.refetch()}})},[i.refetch,r.isSuccess,t]);let v=i.data!==void 0,y=!v&&(r.error!==null||i.error!==null);return(0,P.jsx)(wC,{statusShortcuts:Wx(u),unread:aR(l),artifactSignal:oR(i.data),state:$z(i.data?.artifact,{...g===void 0?{}:{previewUrl:g},pending:p!==null&&g===void 0&&_===void 0,..._===void 0?{}:{errorMessage:_}},{runActive:d}),loading:!v&&(r.isLoading||i.isLoading),unavailable:y,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(mR(e)),onOpenReferences:()=>$(fR(e)),onOpenSkills:()=>$(vR(e)),onOpenTimeline:()=>$(_R(e)),onOpenSettings:()=>$(gR(e)),onActivateStatusShortcut:t=>bR(e,t)})}function rB({relayProjectRef:e}){let t=rt(),n=VL(),r=(0,N.useMemo)(()=>Pn({...KL,relayProjectRef:e}),[e]),i=new URL(JL(),window.location.origin).searchParams.get(`path`)??void 0,[a,o]=(0,N.useState)(i),[s,c]=(0,N.useState)(`time`),l=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:qL}),u=F({queryKey:Q.referenceFiles(e),queryFn:()=>r.getReferenceFiles({limit:200}),enabled:l.isSuccess,staleTime:qL}),d=F({queryKey:Q.messagesWindow(e,200),queryFn:()=>r.getMessages({limit:200}),enabled:l.isSuccess,staleTime:qL}),f=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:l.isSuccess,staleTime:qL}),p=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:l.isSuccess,staleTime:qL}),m=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:l.isSuccess,staleTime:qL}),h=u.data?.items??[],g=(0,N.useMemo)(()=>{let e=new Map;for(let t of d.data?.items??[]){let n=t.refs?.reference_file;if(n===void 0)continue;let r=e.get(n.path);(r===void 0||t.created_at>r)&&e.set(n.path,t.created_at)}return e},[d.data?.items]),_=(0,N.useMemo)(()=>{let e=(e,t)=>e.name.localeCompare(t.name),t=(t,n)=>{let r=g.get(t.path)??``,i=g.get(n.path)??``;return r===i?e(t,n):i.localeCompare(r)},n=(e,n)=>{let r=e.extension??e.media_type??`file`,i=n.extension??n.media_type??`file`;return r===i?t(e,n):r.localeCompare(i)},r=[...h.filter(e=>e.category===`image`&&e.source===`human_upload`)].sort(t),i=[...h.filter(e=>!(e.category===`image`&&e.source===`human_upload`))].sort(s===`time`?t:n);return[...r,...i]},[s,h,g]);(0,N.useEffect)(()=>{if(_.length===0){a!==void 0&&o(void 0);return}if(i!==void 0&&_.some(e=>e.path===i)){a!==i&&o(i);return}(a===void 0||!_.some(e=>e.path===a))&&o(_[0]?.path)},[_,i,a]);let v=h.find(e=>e.path===a),y=v?.category===`image`,b=v?.text_read.can_read===!0,x=F({queryKey:a===void 0?Q.viewerFile(e,`none`):Q.viewerFile(e,a),queryFn:()=>r.getViewerFile({path:a,max_bytes:204800}),enabled:l.isSuccess&&a!==void 0&&b&&!y,staleTime:qL}),S=yt({mutationFn:async t=>{let n=await DR({relayProjectRef:e,purpose:`reference_file`,file:t});return r.uploadReferenceFile(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading reference`,message:e.name}),onSuccess:(r,i,a)=>{tR(t,e,r.invalidates),r.result?.file.path!==void 0&&(o(r.result.file.path),$(fR(e,r.result.file.path))),n.update(a,{tone:`success`,title:`Reference uploaded`,message:r.result?.file.name??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Reference upload failed`,message:ZL(e)||t.name})}}),C=l.data,w=C?.generated_at??new Date(0).toISOString(),T=p.data??C?.snapshots.read_state;sR({enabled:l.isSuccess,hostClient:r,relayProjectRef:e,readState:T,scope:`references`});let E=f.data??C?.snapshots.execution_status??lR(w),ee=_.map(e=>{let t=oB(e,u.data?.directory.tutti_path);return{path:e.path,name:e.name,meta:aB(e),source:e.source,...t===void 0?{}:{generatedGroup:t},selected:e.path===a,canPreview:e.text_read.can_read,category:e.category,...e.category===`image`&&e.source===`human_upload`?{...e.blob_oid===void 0?{}:{thumbnailUrl:r.viewerAssetUrl({path:e.path,variant:`thumbnail`,v:e.blob_oid})}}:{},...e.extension===void 0?{}:{extension:e.extension}}}),D=x.data?.content,O=(()=>{if(v===void 0)return{title:h.length===0?`No reference files`:`No file selected`,unavailableReason:h.length===0?`No reference files`:`Select a reference file`};if(D?.kind===`text`)return{title:v.name,meta:SR(v.size_bytes),...iB(v),content:D.text};if(y&&a!==void 0)return v.blob_oid===void 0?{title:v.name,meta:SR(v.size_bytes),...iB(v),unavailableReason:`Image version unavailable`}:{title:v.name,meta:SR(v.size_bytes),...iB(v),imageUrl:r.viewerAssetUrl({path:a,variant:`preview`,v:v.blob_oid})};let e=b&&x.isLoading?`Loading`:wR(D)??(b?void 0:CR(v.text_read.blocked_reason));return e===void 0?{title:v.name,meta:SR(v.size_bytes),...iB(v)}:{title:v.name,meta:SR(v.size_bytes),...iB(v),unavailableReason:e}})(),k=u.data!==void 0,te=!k&&(l.error!==null||u.error!==null);return(0,P.jsx)(TC,{statusShortcuts:Wx(E),unread:aR(T),artifactSignal:oR(m.data),files:ee,detail:O,uploadPending:S.isPending,fileSortMode:s,loading:!k&&(l.isLoading||u.isLoading),unavailable:te,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(mR(e)),onOpenArtifacts:()=>$(pR(e)),onOpenSkills:()=>$(vR(e)),onOpenTimeline:()=>$(_R(e)),onOpenSettings:()=>$(gR(e)),onActivateStatusShortcut:t=>bR(e,t),onSelectFile:t=>{o(t),$(fR(e,t))},onUploadFile:e=>S.mutate(e),onFileSortModeChange:c})}function iB(e){let t=e.summary;return t===void 0||t.status===`missing`?{summaryStatus:`Summary not available yet`}:t.status===`stale`?{...t.text===void 0?{}:{summary:t.text},summaryStatus:`Summary may be out of date`}:t.status===`unavailable`?{...t.text===void 0?{}:{summary:t.text},summaryStatus:`Summary could not be generated`}:t.text===void 0?{summaryStatus:`Summary unavailable`}:{summary:t.text}}function aB(e){let t=e.source===`tutti_output`?`Tutti`:`Uploaded`;if(e.category===`image`)return[t,e.media_type??`Image`,SR(e.size_bytes)].join(` · `);let n=[t,SR(e.size_bytes)];return e.text_read.can_read||n.push(CR(e.text_read.blocked_reason)),n.join(` · `)}function oB(e,t){if(e.source!==`tutti_output`||t===void 0)return;let n=`${t}/`;if(!e.path.startsWith(n))return;let[r,i]=e.path.slice(n.length).split(`/`);if(!(r===void 0||r.length===0||i===void 0))return r}function sB({relayProjectRef:e}){let t=rt(),n=VL(),r=(0,N.useMemo)(()=>Pn({...KL,relayProjectRef:e}),[e]),i=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap()}),a=F({queryKey:Q.hostWorkspace(e),queryFn:()=>r.getWorkspace(),enabled:i.isSuccess}),o=F({queryKey:Q.hostSession(e),queryFn:()=>r.getSession(),enabled:i.isSuccess}),s=F({queryKey:Q.providerConfig(e),queryFn:()=>r.getProviderConfig(),enabled:i.isSuccess}),c=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:i.isSuccess}),l=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:i.isSuccess}),u=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:i.isSuccess}),d=yt({mutationFn:e=>r.updateProjectDisplayName({display_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project name`,message:e}),onSuccess:(r,i,a)=>{tR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project name saved`,message:i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project name save failed`,message:`${t}: ${ZL(e)}`})}}),f=yt({mutationFn:e=>r.updateProjectDescription({description:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project description`,...e.length===0?{}:{message:e}}),onSuccess:(r,i,a)=>{tR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project description saved`,...i.length===0?{}:{message:i}})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project description save failed`,message:ZL(e)})}}),p=i.data,m=p?.generated_at??new Date(0).toISOString(),h=l.data??p?.snapshots.read_state,g=a.data??p?.workspace,_=o.data??p?.session,v=s.data??p?.provider_config,y=c.data??p?.snapshots.execution_status??lR(m),b=g===void 0||_===void 0||v===void 0?void 0:Jr(g,_,v),x=b===void 0&&(i.error!==null||a.error!==null||o.error!==null||s.error!==null),S=g?.relay.join_url,C=S===void 0||g===void 0||_===void 0?void 0:QR({inviterName:_.account.display_name,projectName:g.project.display_name,joinUrl:S});return(0,P.jsx)(IC,{...b===void 0?{}:{settings:b},statusShortcuts:Wx(y),unread:aR(h),artifactSignal:oR(u.data),loading:b===void 0&&(i.isLoading||a.isLoading||o.isLoading||s.isLoading),unavailable:x,projectNameSaving:d.isPending,projectDescriptionSaving:f.isPending,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(mR(e)),onOpenReferences:()=>$(fR(e)),onOpenArtifacts:()=>$(pR(e)),onOpenSkills:()=>$(vR(e)),onOpenTimeline:()=>$(_R(e)),onActivateStatusShortcut:t=>bR(e,t),...C===void 0?{}:{onCopyJoinUrl:()=>{navigator.clipboard.writeText(C).then(()=>{n.notify({tone:`success`,title:`Invitation copied`})}).catch(()=>{n.notify({tone:`error`,title:`Copy failed`,message:`The browser could not copy the invite link.`})})}},onUpdateProjectDisplayName:async e=>{await d.mutateAsync(e)},onUpdateProjectDescription:async e=>{await f.mutateAsync(e)}})}function cB({relayProjectRef:e}){let t=rt(),n=VL(),r=(0,N.useMemo)(()=>Pn({...KL,relayProjectRef:e}),[e]),i=new URL(JL(),window.location.origin).searchParams.get(`skill`)??void 0,[a,o]=(0,N.useState)(i),s=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:qL}),c=F({queryKey:Q.skills(e),queryFn:()=>r.getSkills(),enabled:s.isSuccess,staleTime:qL}),l=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:s.isSuccess,staleTime:qL}),u=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:s.isSuccess,staleTime:qL}),d=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:s.isSuccess,staleTime:qL}),f=c.data?.items??[];(0,N.useEffect)(()=>{if(f.length===0){a!==void 0&&o(void 0);return}if(i!==void 0&&f.some(e=>e.name===i)){a!==i&&o(i);return}(a===void 0||!f.some(e=>e.name===a))&&o(f[0]?.name)},[i,a,f]);let p=F({queryKey:a===void 0?Q.skillDetail(e,`none`):Q.skillDetail(e,a),queryFn:()=>r.getSkill(a),enabled:s.isSuccess&&a!==void 0,staleTime:qL}),m=yt({mutationFn:async t=>{let n=await DR({relayProjectRef:e,purpose:`skill_zip`,file:t});return r.importSkillZip(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading skill`,message:e.name}),onSuccess:(r,i,a)=>{tR(t,e,r.invalidates);let s=r.result?.skill.name??(r.disposition.kind===`created`||r.disposition.kind===`replaced`?r.disposition.skill_name:void 0);s!==void 0&&(o(s),$(vR(e,s))),n.update(a,{tone:`success`,title:`Skill installed`,message:s??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Skill upload failed`,message:ZL(e)})}}),h=yt({mutationFn:e=>r.deleteSkill({skill_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Deleting skill`,message:e}),onSuccess:(r,i,s)=>{tR(t,e,r.invalidates);let c=r.disposition.kind===`deleted`||r.disposition.kind===`not_found`?r.disposition.skill_name:a,l=f.find(e=>e.name!==c);o(l?.name),$(l===void 0?vR(e):vR(e,l.name)),n.update(s,{tone:`success`,title:`Skill deleted`,message:c??i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Skill delete failed`,message:`${t}: ${ZL(e)}`})}}),g=s.data,_=g?.generated_at??new Date(0).toISOString(),v=u.data??g?.snapshots.read_state;sR({enabled:s.isSuccess,hostClient:r,relayProjectRef:e,readState:v,scope:`skills`});let y=l.data??g?.snapshots.execution_status??lR(_),b=f.map(e=>({name:e.name,description:e.description,...e.short_description===void 0?{}:{shortDescription:e.short_description},selected:e.name===a,...e.updated_at===void 0?{}:{updatedLabel:`Updated ${Zn(e.updated_at)}`}})),x=f.find(e=>e.name===a),S=(()=>{let e=p.data?.skill;return e===void 0?a===void 0?{title:f.length===0?`No skills`:`No skill selected`,unavailableReason:f.length===0?`No user skills`:`Select a skill`}:{title:x?.name??a,...x?.description===void 0?{}:{description:x.description},unavailableReason:p.isLoading?`Loading`:`Skill unavailable`}:{title:e.name,description:e.description,...e.updated_at===void 0?{}:{updatedLabel:`Updated ${Zn(e.updated_at)}`},skillMd:e.skill_md}})(),C=c.data!==void 0,w=!C&&(s.error!==null||c.error!==null);return(0,P.jsx)(RC,{statusShortcuts:Wx(y),unread:aR(v),artifactSignal:oR(d.data),skills:b,detail:S,uploadPending:m.isPending,deletePending:h.isPending,loading:!C&&(s.isLoading||c.isLoading),unavailable:w,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(mR(e)),onOpenReferences:()=>$(fR(e)),onOpenArtifacts:()=>$(pR(e)),onOpenTimeline:()=>$(_R(e)),onOpenSettings:()=>$(gR(e)),onActivateStatusShortcut:t=>bR(e,t),onSelectSkill:t=>{o(t),$(vR(e,t))},onUploadSkill:e=>m.mutate(e),onDeleteSkill:e=>h.mutate(e)})}function lB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...KL,relayProjectRef:e}),[e]),n=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap(),staleTime:qL}),r=F({queryKey:Q.projectTimeline(e),queryFn:()=>t.getProjectTimeline(),enabled:n.isSuccess,staleTime:qL}),i=F({queryKey:Q.executionStatus(e),queryFn:()=>t.getExecutionStatus(),enabled:n.isSuccess,staleTime:qL}),a=F({queryKey:Q.readState(e),queryFn:()=>t.getReadState(),enabled:n.isSuccess,staleTime:qL}),o=F({queryKey:Q.artifacts(e),queryFn:()=>t.getArtifacts(),enabled:n.isSuccess,staleTime:qL}),s=n.data,c=s?.generated_at??new Date(0).toISOString(),l=a.data??s?.snapshots.read_state,u=i.data??s?.snapshots.execution_status??lR(c),d=r.data===void 0&&(n.error!==null||r.error!==null);return(0,P.jsx)(zC,{...r.data===void 0?{}:{timeline:sx(r.data,{onOpenWorklistTask:t=>$(mR(e,t)),onOpenChatMessage:t=>$(hR(e,t)),onOpenReferenceFile:t=>$(fR(e,t))})},statusShortcuts:Wx(u),unread:aR(l),artifactSignal:oR(o.data),loading:r.data===void 0&&(n.isLoading||r.isLoading),unavailable:d,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(mR(e)),onOpenReferences:()=>$(fR(e)),onOpenArtifacts:()=>$(pR(e)),onOpenSkills:()=>$(vR(e)),onOpenSettings:()=>$(gR(e)),onActivateStatusShortcut:t=>bR(e,t)})}function uB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...KL,relayProjectRef:e}),[e]),n=new URL(JL(),window.location.origin).searchParams.get(`task`)??void 0,[r,i]=(0,N.useState)(void 0),a=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap()}),o=F({queryKey:Q.worklist(e),queryFn:()=>t.getWorklist(),enabled:a.isSuccess}),s=F({queryKey:Q.executionStatus(e),queryFn:()=>t.getExecutionStatus(),enabled:a.isSuccess}),c=F({queryKey:Q.readState(e),queryFn:()=>t.getReadState(),enabled:a.isSuccess}),l=F({queryKey:Q.artifacts(e),queryFn:()=>t.getArtifacts(),enabled:a.isSuccess}),u=a.data,d=u?.generated_at??new Date(0).toISOString(),f=o.data??u?.snapshots.worklist??rR(),p=c.data??u?.snapshots.read_state;sR({enabled:a.isSuccess,hostClient:t,relayProjectRef:e,readState:p,scope:`worklist`});let m=(0,N.useMemo)(()=>Fr(f),[f]),h=n!==void 0&&m.some(e=>e.id===n),g=n!==void 0&&!h?n:void 0;(0,N.useEffect)(()=>{if(n!==void 0){i(h?e=>e===n?e:n:void 0);return}if(m.length===0){i(void 0);return}(r===void 0||!m.some(e=>e.id===r))&&i(xR(f,void 0))},[h,n,r,m,f]);let _=F({queryKey:r===void 0?Q.taskDetail(e,`none`):Q.taskDetail(e,r),queryFn:()=>t.getTaskDetail(r),enabled:a.isSuccess&&r!==void 0}),v=F({queryKey:r===void 0?Q.taskRunResults(e,`none`):Q.taskRunResults(e,r),queryFn:()=>t.getTaskRunResults(r,{limit:50}),enabled:a.isSuccess&&r!==void 0}),y=s.data??u?.snapshots.execution_status??lR(d),b=Pr(f,r),x=Gr(_.data,v.data),S=o.data!==void 0||u?.snapshots.worklist!==void 0,C=!S&&(a.error!==null||o.error!==null);return(0,P.jsx)(BC,{statusShortcuts:Wx(y),unread:aR(p),artifactSignal:oR(l.data),modules:b.modules,taskCount:b.taskCount,...x===void 0?{}:{detail:x},...g===void 0?{}:{missingTaskId:g},loading:!S&&(a.isLoading||o.isLoading),unavailable:C,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenReferences:()=>$(fR(e)),onOpenArtifacts:()=>$(pR(e)),onOpenSkills:()=>$(vR(e)),onOpenTimeline:()=>$(_R(e)),onOpenSettings:()=>$(gR(e)),onActivateStatusShortcut:t=>bR(e,t),onSelectTask:t=>{i(t),$(mR(e,t))}})}var dB=`is-scrollbar-active`,fB=1e3;function pB(e,t){let n=e.target;return n instanceof Element?n:t.scrollingElement??t.documentElement}function mB(e){let t=new Map,n=e=>{let n=t.get(e);n!==void 0&&(window.clearTimeout(n),t.delete(e)),e.classList.remove(dB)},r=e=>{let r=t.get(e);r!==void 0&&window.clearTimeout(r),e.classList.add(dB);let i=window.setTimeout(()=>n(e),fB);t.set(e,i)},i=t=>{r(pB(t,e))};return e.addEventListener(`scroll`,i,{capture:!0,passive:!0}),()=>{e.removeEventListener(`scroll`,i,!0);for(let[e,n]of t)window.clearTimeout(n),e.classList.remove(dB);t.clear()}}var hB=`--tutti-viewport-height`,gB=`--tutti-viewport-offset-top`;function _B(e,t=window){let n=e.documentElement,r=t.visualViewport,i=()=>{let e=r?.height??t.innerHeight,i=r?.offsetTop??0;n.style.setProperty(hB,`${Math.max(0,e)}px`),n.style.setProperty(gB,`${Math.max(0,i)}px`)};return i(),t.addEventListener(`resize`,i),t.addEventListener(`orientationchange`,i),r?.addEventListener(`resize`,i),r?.addEventListener(`scroll`,i),()=>{t.removeEventListener(`resize`,i),t.removeEventListener(`orientationchange`,i),r?.removeEventListener(`resize`,i),r?.removeEventListener(`scroll`,i),n.style.removeProperty(hB),n.style.removeProperty(gB)}}var vB=new $e({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function yB(){let e=XL();if(e.kind===`local_console`)return(0,P.jsx)(iz,{});if(e.kind===`home`)return(0,P.jsx)(WR,{});if(e.kind===`join`)return(0,P.jsx)(HR,{joinToken:e.joinToken});if(e.kind===`setup`)return(0,P.jsx)(kz,{});if(e.kind===`project_open`)return(0,P.jsx)(mz,{requestedOpenProjectRef:e.relayProjectRef});if(e.kind===`workspace`||e.kind===`worklist`||e.kind===`references`||e.kind===`artifacts`||e.kind===`skills`||e.kind===`timeline`||e.kind===`settings`){let t=e.kind===`workspace`?(0,P.jsx)(Wz,{relayProjectRef:e.relayProjectRef}):e.kind===`worklist`?(0,P.jsx)(uB,{relayProjectRef:e.relayProjectRef}):e.kind===`references`?(0,P.jsx)(rB,{relayProjectRef:e.relayProjectRef}):e.kind===`artifacts`?(0,P.jsx)(nB,{relayProjectRef:e.relayProjectRef}):e.kind===`skills`?(0,P.jsx)(cB,{relayProjectRef:e.relayProjectRef}):e.kind===`timeline`?(0,P.jsx)(lB,{relayProjectRef:e.relayProjectRef}):(0,P.jsx)(sB,{relayProjectRef:e.relayProjectRef});return(0,P.jsxs)(Jz,{relayProjectRef:e.relayProjectRef,children:[t,(0,P.jsx)(Yz,{relayProjectRef:e.relayProjectRef})]},e.relayProjectRef)}return(0,P.jsx)(mz,{})}function bB(){return(0,N.useEffect)(()=>{let e=mB(document),t=_B(document);return()=>{e(),t()}},[]),(0,P.jsx)(it,{client:vB,children:(0,P.jsx)(BL,{children:(0,P.jsx)(yB,{})})})}function xB(e){let t=document.querySelector(`link[rel="icon"]`),n=t??document.createElement(`link`);n.rel=`icon`,n.type=`image/png`,n.sizes=`1204x1204`,n.href=e,t===null&&document.head.append(n)}xB(nS),(0,xt.createRoot)(document.getElementById(`root`)).render((0,P.jsx)(N.StrictMode,{children:(0,P.jsx)(bB,{})}));export{L as C,ci as S,Mi as _,Cd as a,di as b,Nd as c,Xi as d,Yi as f,Fi as g,Li as h,Ad as i,Dd as l,zi as m,hd as n,Td as o,Ki as p,Md as r,jd as s,Xy as t,na as u,ji as v,tt as w,li as x,Si as y};
|
|
69
|
+
`){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start)}${e.slice(t.start+1)}`,t.start);return}let r=yy(e).find(r=>n.key===`Backspace`?t.start>r.start&&t.start<=r.end||t.start===r.end+1&&e[r.end]===` `:t.start>=r.start&&t.start<r.end);if(r!==void 0){n.preventDefault(),y.current=null,b.current=null;let i=n.key===`Backspace`&&t.start===r.end+1&&e[r.end]===` `?r.end+1:r.end;de(`${e.slice(0,r.start)}${e.slice(i)}`,r.start);return}if(n.key===`Backspace`&&t.start>0){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start-1)}${e.slice(t.start)}`,t.start-1);return}if(n.key===`Delete`&&t.start<e.length){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start)}${e.slice(t.start+1)}`,t.start);return}}if(t&&n.key===`Enter`){if(n.preventDefault(),r&&!n.shiftKey&&!n.metaKey){i?.closest(`form`)?.requestSubmit();return}pe();return}if(!t&&n.key===`Enter`){n.preventDefault(),i?.closest(`form`)?.requestSubmit();return}f?.(n)},ye=t=>{if(v.current||wy(t))return;let n=h.current;if(n===null)return;let r=M(n),i=se(n).end,a=me(r,i),o=a?.nextValue??r,s=a?.nextCaret??i,c=Ty(t);if(c.inputType===`insertText`&&Ey(c.data)){let t=s-c.data.length,n=`${o.slice(0,t)}${o.slice(s)}`;y.current=t>=0&&n===e?{data:c.data,start:t,end:s,valueBefore:n,createdAt:Date.now()}:null}else y.current=null;let l=he(o,s,void 0,!0);de(l.nextValue,l.nextCaret)},be=e=>{if(v.current||wy(e))return;let t=Ty(e);if(t.inputType===`insertParagraph`||t.inputType===`insertLineBreak`){pe()&&e.preventDefault();return}y.current=null},xe=t=>{t.preventDefault();let n=t.clipboardData.getData(`text/plain`),r=h.current;if(r===null)return;let i=se(r);de(`${e.slice(0,i.start)}${n}${e.slice(i.end)}`,i.start+n.length)},Se=()=>{let e=h.current;e===null||!ae(e)||E(se(e).end)},Ce=R(`mention-input-editor`,t?`is-multiline`:`is-singleline`,c),we=ne?(0,P.jsx)(`div`,{className:`mention-menu`,id:S,role:`listbox`,"aria-label":`Mention people`,children:te.map((e,t)=>(0,P.jsx)(`button`,{className:R(`mention-option`,t===A?`is-selected`:void 0),type:`button`,role:`option`,id:`${S}-option-${t}`,"aria-selected":t===A,onMouseEnter:()=>D(t),onMouseDown:t=>{t.preventDefault(),ue(e)},children:(0,P.jsxs)(`span`,{className:`mention-option-text`,children:[`@`,e.handle]})},e.id))}):null,Te=a?.current;return(0,P.jsxs)(`span`,{className:R(`mention-input`,t?`is-multiline`:void 0),children:[(0,P.jsx)(`div`,{className:Ce,contentEditable:!ie,role:`textbox`,"aria-label":j,"aria-multiline":t,"aria-disabled":ie,"aria-expanded":ne,...ne?{"aria-controls":S}:{},...re===void 0?{}:{"aria-activedescendant":re},"data-placeholder":m.placeholder,"data-max-rows":n,onBlur:e=>{w(!1),l?.(e)},onClick:e=>{Se(),u?.(e)},onFocus:e=>{w(!0),Se(),d?.(e)},onCompositionStart:()=>{v.current=!0;let e=h.current,t=y.current;if(y.current=null,e!==null&&t!==null&&Date.now()-t.createdAt<500&&M(e).slice(t.start,t.end)===t.data){b.current=t,_.current=null,E(t.start),s(t.valueBefore);let n=vy(t.valueBefore,null);Cy(e,n),x.current=xy(n),ce(e,t.start)}else b.current=null},onCompositionEnd:e=>{v.current=!1;let t=Ty(e);_e(t.data===null?{}:{compositionData:t.data})},onBeforeInput:be,onInput:ye,onKeyDown:ve,onKeyUp:e=>{!v.current&&!wy(e)&&Se(),p?.(e)},onPaste:xe,ref:h,suppressContentEditableWarning:!0}),Te==null?we:(0,_c.createPortal)(we,Te)]})}function Ay(e){return(0,P.jsx)(Fi,{...e})}function jy({avatar:e,author:t,time:n,children:r,system:i=!1,className:a,...o}){return(0,P.jsxs)(`article`,{className:R(`message`,i?`is-system`:void 0,a),...o,children:[(0,P.jsxs)(`div`,{className:`message-byline`,children:[e,(0,P.jsxs)(`div`,{className:`message-meta`,children:[(0,P.jsx)(`span`,{className:`message-author`,children:t}),n===void 0?null:(0,P.jsx)(`span`,{className:`message-time`,children:n})]})]}),(0,P.jsx)(`div`,{className:`message-content`,children:(0,P.jsx)(`div`,{className:`message-card`,children:r})})]})}function My({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`message-markdown`,t),...n,children:(0,P.jsx)(ry,{components:Uy,children:e})})}function Ny({children:e}){return(0,P.jsx)(`p`,{children:Dy(e)})}function Py({children:e}){return(0,P.jsx)(`li`,{children:Dy(e)})}function Fy({children:e}){return(0,P.jsx)(`strong`,{children:Dy(e)})}function Iy({children:e}){return(0,P.jsx)(`em`,{children:Dy(e)})}function Ly({children:e}){return(0,P.jsx)(`h1`,{children:Dy(e)})}function Ry({children:e}){return(0,P.jsx)(`h2`,{children:Dy(e)})}function zy({children:e}){return(0,P.jsx)(`h3`,{children:Dy(e)})}function By({children:e}){return(0,P.jsx)(`h4`,{children:Dy(e)})}function Vy({children:e}){return(0,P.jsx)(`h5`,{children:Dy(e)})}function Hy({children:e}){return(0,P.jsx)(`h6`,{children:Dy(e)})}var Uy={p:Ny,li:Py,strong:Fy,em:Iy,h1:Ly,h2:Ry,h3:zy,h4:By,h5:Vy,h6:Hy};function Wy({name:e,category:t,imageUrl:n,className:r,"aria-label":i,...a}){let o=t===`image`&&n!==void 0;return(0,P.jsx)(`button`,{type:`button`,"aria-label":i??`Open ${t===`image`?`image`:`file`} ${e}`,className:R(`reference-message-card`,t===`image`?`is-image`:`is-file`,r),...a,children:o?(0,P.jsx)(`img`,{className:`reference-message-image`,src:n,alt:e,loading:`lazy`,decoding:`async`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`reference-message-icon`,"aria-hidden":`true`,children:t===`image`?(0,P.jsx)(Ei,{}):(0,P.jsx)(Ci,{})}),(0,P.jsx)(`span`,{className:`reference-message-main`,children:(0,P.jsx)(`strong`,{children:e})})]})})}function Gy({children:e,composer:t,empty:n,title:r=`Chat`,subtitle:i,actions:a,streamRef:o,streamOverlay:s,onStreamScroll:c,dropUploadPending:l=!1,onDropFiles:u,className:d,...f}){return(0,P.jsxs)(uy,{className:R(`panel chat-panel chat-primary`,d),"aria-label":`Group chat`,dropLabel:`Drop references to upload`,pending:l,onFilesUpload:u,...f,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ma,{icon:(0,P.jsx)(Ay,{"aria-hidden":`true`})}),(0,P.jsxs)(`div`,{className:`panel-title-copy`,children:[(0,P.jsx)(`h3`,{children:r}),i===void 0?null:(0,P.jsx)(`div`,{className:`panel-subtitle`,children:i})]})]}),a===void 0?null:(0,P.jsx)(`div`,{className:`panel-actions`,children:a})]}),(0,P.jsxs)(`div`,{className:`chat-stream-frame`,children:[(0,P.jsx)(`div`,{className:`chat-stream`,ref:o,onScroll:c,children:e??n}),s===void 0?null:(0,P.jsx)(`div`,{className:`chat-stream-overlay`,children:s})]}),t]})}function Ky({value:e,placeholder:t,ariaLabel:n,maxLength:r,saving:i=!1,disabled:a=!1,allowEmpty:o=!1,onUpdate:s,className:c,...l}){let u=(0,N.useRef)(null),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(e),[h,g]=(0,N.useState)(!1),_=i||h,v=!a&&!_&&s!==void 0,y=e.trim(),b=y.length===0;(0,N.useEffect)(()=>{d||m(e)},[d,e]),(0,N.useEffect)(()=>{d&&(u.current?.focus(),u.current?.select())},[d]);let x=()=>{m(e),f(!1)},S=()=>{let e=p.trim();if(!o&&e.length===0){x();return}if(e===y){f(!1);return}s===void 0||_||(g(!0),Promise.resolve(s(e)).then(()=>{f(!1)}).catch(()=>void 0).finally(()=>{g(!1)}))},C=e=>{if(e.key===`Enter`){e.preventDefault(),S();return}e.key===`Escape`&&(e.preventDefault(),x())};return(0,P.jsx)(`span`,{className:R(`inline-editable-text`,b?`is-empty`:void 0,d?`is-editing`:void 0,v?void 0:`is-disabled`,c),...l,children:d?(0,P.jsx)(`input`,{ref:u,className:`inline-editable-text-input`,"aria-label":n,value:p,maxLength:r,disabled:_,onBlur:S,onChange:e=>m(e.currentTarget.value),onKeyDown:C}):(0,P.jsx)(`button`,{className:`inline-editable-text-button`,type:`button`,"aria-label":n,disabled:!v,onClick:()=>f(!0),children:b?t:y})})}var qy={bare:``,quiet:`quiet-button`,pill:`pill-action`,action:`action-button`};function Jy({variant:e=`pill`,label:t,pendingLabel:n=t,pending:r=!1,disabled:i=!1,iconOnly:a=!1,accept:o,icon:s,onFileUpload:c,className:l,...u}){let d=i||r||c===void 0,f=r?n:t,p=e=>{let t=e.currentTarget.files?.[0];e.currentTarget.value=``,t!==void 0&&c?.(t)};return(0,P.jsxs)(`label`,{...u,className:R(qy[e],d?`is-disabled`:void 0,l),"aria-disabled":d,"aria-busy":r,"aria-label":u[`aria-label`]??f,title:u.title??f,children:[(0,P.jsx)(`input`,{type:`file`,accept:o,disabled:d,onChange:p}),s??(r?(0,P.jsx)(Mi,{className:`is-spinning`,"aria-hidden":`true`}):(0,P.jsx)(_i,{"aria-hidden":`true`})),a?null:(0,P.jsx)(`span`,{children:f})]})}function Yy({value:e,pending:t=!1,uploadPending:n=!1,placeholder:r=`Write a message`,mentionOptions:i,onValueChange:a,onComposerSubmit:o,onFileUpload:s,className:c,...l}){let[u,d]=(0,N.useState)(0),f=(0,N.useRef)(null);return(0,P.jsx)(`form`,{className:R(`composer`,c),"aria-label":`Message composer`,onSubmit:o,...l,children:(0,P.jsxs)(`div`,{className:`composer-input-shell`,ref:f,children:[(0,P.jsx)(ky,{"aria-label":`Message`,placeholder:r,value:e,multiline:!0,maxRows:8,submitOnEnter:!0,mentionRequestKey:u,menuPortalTargetRef:f,...i===void 0?{}:{mentionOptions:i},onValueChange:a}),(0,P.jsxs)(`div`,{className:`composer-tools`,"aria-label":`Message tools`,children:[(0,P.jsx)(`button`,{className:`composer-tool-button composer-mention-button`,type:`button`,"aria-label":`Mention people`,title:`Mention people`,onClick:()=>d(e=>e+1),children:(0,P.jsx)(oi,{"aria-hidden":`true`})}),(0,P.jsx)(Jy,{variant:`bare`,className:`composer-tool-button composer-upload-button`,label:`Upload image`,pendingLabel:`Uploading image`,pending:n,accept:`image/*`,icon:(0,P.jsx)(Ei,{"aria-hidden":`true`}),iconOnly:!0,onFileUpload:s}),(0,P.jsx)(Jy,{variant:`bare`,className:`composer-tool-button composer-upload-button`,label:`Upload file`,pendingLabel:`Uploading file`,pending:n,icon:(0,P.jsx)(Ci,{"aria-hidden":`true`}),iconOnly:!0,onFileUpload:s}),(0,P.jsx)(`button`,{className:`composer-tool-button composer-send-button`,type:`submit`,disabled:e.trim()===``||t,"aria-label":t?`Sending message`:`Send message`,title:t?`Sending message`:`Send message`,children:(0,P.jsx)(Gi,{"aria-hidden":`true`})})]})]})})}function Xy(e){return(0,P.jsx)(Ri,{...e})}var Zy={confirmed:(0,P.jsx)(li,{"aria-hidden":`true`}),question:(0,P.jsx)(pi,{"aria-hidden":`true`}),"task-change":(0,P.jsx)(Xi,{"aria-hidden":`true`})};function Qy({kind:e,children:t,className:n,...r}){return(0,P.jsxs)(`div`,{className:R(`scratchpad-row`,`is-${e}`,n),...r,children:[(0,P.jsx)(`span`,{className:`scratchpad-marker`,"aria-hidden":`true`,children:Zy[e]}),(0,P.jsx)(`p`,{children:t})]})}function $y({compiledTasks:e=[],onOpenCompiledTask:t}){return(0,P.jsxs)(`section`,{className:`scratchpad-submitted-receipt`,"aria-label":`Submitted to Worklist`,children:[(0,P.jsxs)(`div`,{className:`scratchpad-submitted-receipt-header`,children:[(0,P.jsx)(`strong`,{children:`Submitted to Worklist`}),(0,P.jsx)(li,{className:`scratchpad-submitted-receipt-check`,"aria-hidden":`true`})]}),e.length===0?(0,P.jsxs)(`div`,{className:`scratchpad-submitted-empty`,role:`status`,children:[(0,P.jsx)(Xi,{"aria-hidden":`true`}),(0,P.jsxs)(`span`,{className:`scratchpad-submitted-empty-copy`,children:[(0,P.jsx)(`span`,{children:`No new task created`}),(0,P.jsx)(`small`,{children:`This Scratchpad was submitted, but no Worklist task was added.`})]})]}):(0,P.jsx)(`div`,{className:`scratchpad-submitted-task-list`,children:e.map(e=>(0,P.jsxs)(`button`,{className:`scratchpad-submitted-task`,disabled:t===void 0,onClick:()=>t?.(e.taskId),type:`button`,children:[(0,P.jsxs)(`span`,{className:`scratchpad-submitted-task-copy`,children:[(0,P.jsx)(`span`,{children:e.title}),(0,P.jsx)(`small`,{children:e.moduleName})]}),(0,P.jsx)(di,{"aria-hidden":`true`})]},e.taskId))})]})}function eb({title:e,summary:t,sections:n,updatedLabel:r,updatedLabelPrefix:i=`Updated`,footerNote:a,submitAvailable:o,pages:s,empty:c,actionsDisabled:l=!1,compact:u=!1,syncPending:d=!1,submitPending:f=!1,onSubmitScratchpad:p,onOpenCompiledTask:m,className:h,...g}){let _=s!==void 0&&s.length>0,v=(0,N.useMemo)(()=>s!==void 0&&s.length>0?s:[{key:`current`,title:e,summary:t,sections:n,...r===void 0?{}:{updatedLabel:r},updatedLabelPrefix:i,...a===void 0?{}:{footerNote:a},...o===void 0?{}:{submitAvailable:o}}],[a,s,n,o,t,e,r,i]),y=Math.max(0,v.length-1),b=v[y]?.key,[x,S]=(0,N.useState)(y);(0,N.useEffect)(()=>{S(y)},[y,b]);let C=Math.min(x,Math.max(0,v.length-1)),w=v[C]??{key:`current`,title:e,summary:t,sections:n,...r===void 0?{}:{updatedLabel:r},updatedLabelPrefix:i,...a===void 0?{}:{footerNote:a},...o===void 0?{}:{submitAvailable:o}},T=d||f,E=f?`Running`:d?`Refreshing`:`Run`,ee=w.submitAvailable??w.sections.length>0,D=l||T||!ee||w.submitted===!0;return(0,P.jsx)(pa,{title:`Scratchpad`,icon:(0,P.jsx)(Xy,{"aria-hidden":`true`}),className:R(`scratchpad-panel`,u?`is-compact`:void 0,h),"aria-busy":T,...g,children:(0,P.jsxs)(`div`,{className:`scratchpad-panel-body scratchpad`,children:[!_&&w.sections.length===0?c??(0,P.jsx)(`div`,{}):(0,P.jsxs)(`div`,{className:R(`scratchpad-content`,w.submitted===!0?`is-submitted`:void 0),children:[(0,P.jsx)(`div`,{className:`scratchpad-head`,children:(0,P.jsx)(`div`,{children:(0,P.jsx)(`h4`,{children:w.title})})}),(0,P.jsx)(`p`,{className:`scratchpad-summary`,children:w.summary}),w.sections.map(e=>(0,P.jsxs)(`section`,{className:`scratchpad-section`,"aria-labelledby":e.id,children:[(0,P.jsx)(`span`,{className:`scratchpad-label`,id:e.id,children:e.label}),(0,P.jsx)(`div`,{className:`scratchpad-list`,children:e.rows.map(t=>(0,P.jsx)(Qy,{kind:t.kind,children:t.text},`${e.id}:${t.text}`))})]},e.id)),w.submitted===!0?(0,P.jsx)($y,{compiledTasks:w.compiledTasks??[],...m===void 0?{}:{onOpenCompiledTask:m}}):null]},w.key),!u&&v.length>1?(0,P.jsx)(`div`,{className:`scratchpad-history-nav`,children:(0,P.jsx)(fa,{"aria-label":`Scratchpad history`,currentPage:C,maxVisible:7,pageAriaLabel:e=>`Scratchpad page ${e+1}`,pageCount:v.length,onPageChange:S})}):null,(0,P.jsxs)(`div`,{className:`scratchpad-footer`,children:[w.footerNote===void 0?null:(0,P.jsx)(`p`,{className:R(`scratchpad-footer-note`,w.footerNote.tone===`error`?`is-error`:void 0),title:w.footerNote.text,children:w.footerNote.text}),u?null:(0,P.jsx)(`div`,{className:`scratchpad-submit-context`,children:w.updatedLabel===void 0?null:(0,P.jsxs)(`span`,{className:`scratchpad-updated-at`,children:[(0,P.jsx)(`span`,{children:w.updatedLabelPrefix??`Updated`}),(0,P.jsx)(`span`,{children:w.updatedLabel})]})}),(0,P.jsx)(`div`,{className:`scratchpad-footer-actions`,children:(0,P.jsxs)(bs,{className:R(`scratchpad-submit-button`,T?`is-pending`:void 0),type:`button`,"aria-busy":T,disabled:D,onClick:p,children:[T?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(zi,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:E})]})})]})]})})}function tb(e){return e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(mi,{"aria-hidden":`true`}):e===`pending`?(0,P.jsx)(ta,{"aria-hidden":`true`}):e===`running`?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(hi,{"aria-hidden":`true`})}function nb(e){return e===`complete`?`Complete`:e===`failed`?`Failed`:e===`pending`?`Needs input`:`Running`}function rb(e){return(0,P.jsx)(na,{"aria-hidden":`true`,"data-tone":e})}function ib({title:e,summary:t,tone:n,steps:r,metaLabel:i,className:a,...o}){let s=i??nb(n),c=o[`aria-label`]??`${e}. ${s}. ${t}`;return(0,P.jsx)(pa,{title:e,icon:rb(n),className:R(`execution-progress-panel`,`is-${n}`,a),"aria-label":c,...o,children:(0,P.jsx)(`div`,{className:`execution-progress-body`,children:(0,P.jsx)(`div`,{className:`execution-progress-list`,children:r.map(e=>(0,P.jsxs)(`div`,{className:R(`execution-progress-step`,`is-${e.status}`),children:[(0,P.jsx)(`span`,{className:R(`execution-progress-marker`,`is-${e.status}`),"aria-hidden":`true`,children:tb(e.status)}),(0,P.jsxs)(`span`,{className:`execution-progress-step-content`,children:[(0,P.jsxs)(`span`,{className:`execution-progress-step-title`,children:[(0,P.jsx)(`span`,{className:`execution-progress-step-label`,children:e.label}),e.elapsedLabel===void 0?null:(0,P.jsxs)(`span`,{className:`execution-progress-step-elapsed`,children:[` `,`(`,e.elapsedLabel,`)`]})]}),e.detail===void 0?null:(0,P.jsx)(`span`,{className:`execution-progress-step-detail`,children:e.detail}),e.metrics===void 0||e.metrics.length===0?null:(0,P.jsx)(`span`,{className:`execution-progress-step-metrics`,children:e.metrics.map(e=>(0,P.jsx)(`span`,{className:`execution-progress-step-metric`,children:e},e))})]})]},e.id))})})})}function ab({tone:e=`neutral`,compact:t=!1,asChild:n=!1,className:r,...i}){return(0,P.jsx)(n?is:`div`,{className:R(`chat-event-card`,`is-${e}`,t?`is-compact`:void 0,r),...i})}function ob({as:e=`div`,icon:t,title:n,meta:r,action:i,className:a,...o}){return(0,P.jsxs)(e,{className:R(`chat-event-card-header`,a),...o,children:[(0,P.jsx)(sb,{children:t}),(0,P.jsxs)(`span`,{className:`chat-event-card-title`,children:[(0,P.jsx)(`strong`,{children:n}),r===void 0?null:(0,P.jsx)(`span`,{className:`chat-event-card-meta`,children:r})]}),i]})}function sb({className:e,...t}){return(0,P.jsx)(`span`,{className:R(`chat-event-card-status-icon`,e),...t})}function cb({className:e,...t}){return(0,P.jsx)(`div`,{className:R(`chat-event-card-body`,e),...t})}function lb({className:e,...t}){return(0,P.jsx)(`footer`,{className:R(`chat-event-card-footer`,e),...t})}function ub(e){return e===`done`?`success`:e===`failed`?`danger`:e===`pending`?`warning`:`neutral`}function db(e){return e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(ra,{"aria-hidden":`true`}):(0,P.jsx)(Pi,{"aria-hidden":`true`})}function fb({title:e,summary:t,request:n,messages:r,draft:i,contextLabel:a,defaultOpen:o,readOnly:s=!1,replyCount:c,status:l,statusLabel:u,mentionOptions:d,sendPending:f=!1,submitPending:p=!1,onDraftChange:m,onSendMessage:h,onSubmitRound:g,className:_,...v}){let y=t.trim()===``?n:t,b=a===void 0?y:`${y} (${a})`,[x,S]=(0,N.useState)(o??!0),C=l??(s?`done`:`pending`),w=u??(s?`submitted`:`needs input`),T=c??r.length,E=p||T===0,ee=T===0?`No replies`:`${T} ${T===1?`reply`:`replies`}`,D=ub(C),O=`${w} · ${ee}`,k=(0,P.jsxs)(cb,{className:`chat-clarification-card-body`,children:[(0,P.jsx)(`div`,{className:`chat-event-thread`,children:r.map(e=>(0,P.jsxs)(`article`,{className:`chat-event-message`,children:[e.avatar,(0,P.jsxs)(`div`,{className:`chat-event-message-copy`,children:[(0,P.jsxs)(`div`,{className:`message-meta`,children:[(0,P.jsx)(`span`,{className:`message-author`,children:e.author}),e.time===void 0?null:(0,P.jsx)(`span`,{className:`message-time`,children:e.time})]}),(0,P.jsx)(`p`,{children:(0,P.jsx)(Oy,{children:e.body})})]})]},e.id))}),s?null:(0,P.jsx)(`form`,{className:`chat-event-composer`,"aria-label":`Round reply`,onSubmit:h,children:(0,P.jsxs)(`div`,{className:`composer-input-shell chat-event-composer-input-shell`,children:[(0,P.jsx)(ky,{type:`text`,"aria-label":`Round message`,value:i,placeholder:`Reply in this round`,multiline:!0,maxRows:4,submitOnEnter:!0,...d===void 0?{}:{mentionOptions:d},onValueChange:m}),(0,P.jsx)(`div`,{className:`composer-tools chat-event-composer-tools`,"aria-label":`Round message tools`,children:(0,P.jsx)(`button`,{className:`composer-tool-button composer-send-button chat-event-send-button`,type:`submit`,disabled:i.trim()===``||f,"aria-label":f?`Sending round message`:`Send round message`,title:f?`Sending round message`:`Send round message`,children:(0,P.jsx)(Gi,{"aria-hidden":`true`})})})]})})]});return(0,P.jsx)(`article`,{className:R(`message is-chat-event`,_),...v,children:s?(0,P.jsx)(ab,{tone:D,asChild:!0,children:(0,P.jsxs)(`details`,{className:`chat-clarification-card`,open:x,"aria-label":b,onToggle:e=>S(e.currentTarget.open),children:[(0,P.jsx)(ob,{as:`summary`,icon:db(C),title:e,meta:O,action:(0,P.jsx)(`span`,{className:`chat-event-card-toggle`,"aria-hidden":`true`,children:(0,P.jsx)(ui,{})})}),k]})}):(0,P.jsx)(ab,{tone:D,asChild:!0,children:(0,P.jsxs)(`section`,{className:`chat-clarification-card is-fixed-open`,"aria-label":b,children:[(0,P.jsx)(ob,{icon:db(C),title:e,meta:O,tabIndex:-1,action:(0,P.jsxs)(bs,{className:`chat-event-primary-action`,type:`button`,"aria-label":T===0?`Reply before submitting round`:`Submit round`,"aria-busy":p,disabled:E,title:T===0?`Reply before submitting round`:`Submit round`,onClick:g,children:[p?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(li,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`button-label`,children:p?`Submitting`:`Submit`})]})}),k]})})})}function pb({decision:e,disabled:t,onDecide:n}){let r=e.tone===`primary`?bs:xs,i=e.decisionId.startsWith(`allow`)?(0,P.jsx)(li,{"aria-hidden":`true`}):(0,P.jsx)(ra,{"aria-hidden":`true`});return(0,P.jsxs)(r,{type:`button`,className:R(`chat-approval-card-decision`,e.tone===`primary`?`is-primary`:void 0,e.tone===`danger`?`is-danger`:void 0),disabled:t,onClick:()=>n(e.decisionId),children:[i,(0,P.jsx)(`span`,{className:`button-label`,children:e.label})]})}function mb(e,t){return e===`pending`?`warning`:e===`resolved`?`success`:/expired|cancelled/iu.test(t)?`neutral`:`danger`}function hb(e){return e===`success`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`danger`?(0,P.jsx)(ra,{"aria-hidden":`true`}):e===`neutral`?(0,P.jsx)(gi,{"aria-hidden":`true`}):(0,P.jsx)(Ji,{"aria-hidden":`true`})}function gb({title:e,summary:t,reason:n,status:r,statusLabel:i,detailLabel:a,detail:o,detailCode:s=!1,decisions:c=[],decisionPending:l=!1,resolutionLabel:u,defaultOpen:d,onDecide:f,className:p,...m}){let[h,g]=(0,N.useState)(d??r===`pending`),_=mb(r,i),v=[...c].sort((e,t)=>e.tone===t.tone?0:e.tone===`primary`?-1:+(t.tone===`primary`)),y=r===`pending`&&f!==void 0?(0,P.jsx)(lb,{className:`chat-approval-card-actions`,children:v.map(e=>(0,P.jsx)(pb,{decision:e,disabled:l,onDecide:f},e.decisionId))}):null,b=(0,P.jsx)(cb,{className:`chat-approval-card-body`,children:(0,P.jsxs)(`div`,{className:`chat-approval-card-content`,children:[(0,P.jsx)(`p`,{className:`chat-approval-card-summary`,children:t}),n===void 0?null:(0,P.jsx)(`p`,{className:`chat-approval-card-reason`,children:n}),o===void 0?null:(0,P.jsxs)(`div`,{className:`chat-approval-card-detail`,children:[a===void 0?null:(0,P.jsx)(`span`,{className:`chat-approval-card-detail-label`,children:a}),s?(0,P.jsx)(`code`,{className:`chat-approval-card-detail-code`,children:o}):(0,P.jsx)(`span`,{className:`chat-approval-card-detail-text`,children:o})]}),r===`pending`||u===void 0?null:(0,P.jsx)(`p`,{className:`chat-approval-card-resolution`,children:u})]})});return(0,P.jsx)(`article`,{className:R(`message is-chat-event`,p),...m,children:r===`pending`?(0,P.jsx)(ab,{tone:_,asChild:!0,children:(0,P.jsxs)(`section`,{className:`chat-approval-card is-fixed-open`,"aria-label":t,children:[(0,P.jsx)(ob,{icon:hb(_),title:e,meta:i,tabIndex:-1}),b,y]})}):(0,P.jsx)(ab,{tone:_,asChild:!0,children:(0,P.jsxs)(`details`,{className:`chat-approval-card`,open:h,"aria-label":t,onToggle:e=>g(e.currentTarget.open),children:[(0,P.jsx)(ob,{as:`summary`,icon:hb(_),title:e,meta:i,action:(0,P.jsx)(`span`,{className:`chat-event-card-toggle`,"aria-hidden":`true`,children:(0,P.jsx)(ui,{})})}),b]})})})}function _b({status:e,title:t,taskId:n,taskTitle:r,summary:i,moduleName:a,finalNote:o,generatedFiles:s=[],errorCode:c,onOpenTask:l,className:u,...d}){let f=o?.trim()??``,p=i.trim(),m=f.length>0?f:p,h=e===`completed`?`Task completed`:`Task failed`;return(0,P.jsx)(`article`,{className:R(`message is-chat-event is-task-result`,u),...d,children:(0,P.jsx)(ab,{tone:e===`completed`?`success`:`danger`,compact:!0,asChild:!0,children:(0,P.jsxs)(`button`,{className:R(`chat-task-result-card`,`is-${e}`),disabled:l===void 0,onClick:()=>l?.(n),type:`button`,"aria-label":`${t}: ${r}`,children:[(0,P.jsx)(sb,{"aria-hidden":`true`,children:e===`completed`?(0,P.jsx)(li,{}):(0,P.jsx)(ra,{})}),(0,P.jsxs)(`span`,{className:`chat-task-result-card-main`,children:[(0,P.jsx)(`span`,{className:`chat-task-result-card-state`,children:h}),(0,P.jsx)(`strong`,{children:r}),a===void 0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-module`,children:a}),m.length===0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-summary`,children:m}),c===void 0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-error-code`,children:c}),s.length===0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-files`,"aria-label":`Generated files`,children:s.map(e=>(0,P.jsxs)(`span`,{className:`chat-task-result-card-file`,children:[(0,P.jsx)(Ci,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:e.name})]},e.path))})]}),(0,P.jsx)(`span`,{className:`chat-task-result-card-arrow`,"aria-hidden":`true`,children:(0,P.jsx)(di,{})})]})})})}function vb({status:e}){return e===`done`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(li,{})}):e===`pending`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(Ii,{})}):e===`failed`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(ra,{})}):e===`running`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(Mi,{})}):(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`})}function yb({title:e,status:t,selected:n=!1,className:r,type:i=`button`,...a}){return(0,P.jsxs)(`button`,{className:R(`task-row`,n?`is-selected`:void 0,`is-${t}`,r),type:i,"aria-current":n?`true`:void 0,...a,children:[(0,P.jsx)(vb,{status:t}),(0,P.jsx)(`div`,{className:`task-row-main`,children:(0,P.jsx)(`div`,{className:`task-title-line`,children:(0,P.jsx)(`strong`,{children:e})})})]})}function bb({label:e,value:t,code:n=!1,status:r}){return(0,P.jsxs)(`div`,{className:`detail-row`,children:[(0,P.jsx)(`span`,{children:e}),r===void 0?n?(0,P.jsx)(`code`,{children:t}):(0,P.jsx)(`strong`,{children:t}):(0,P.jsx)(`strong`,{children:(0,P.jsx)(ws,{status:r,children:t})})]})}function xb({rows:e}){return(0,P.jsx)(P.Fragment,{children:e.map((e,t)=>(0,N.createElement)(bb,{...e,key:`${e.label}-${t}`}))})}function Sb({...e}){return(0,P.jsx)(yb,{...e})}function Cb({detail:e,missingTaskId:t}){return e===void 0?(0,P.jsxs)(`aside`,{className:`task-detail-card`,"aria-label":`Selected task details`,children:[(0,P.jsx)(`div`,{className:`task-detail-head`,children:(0,P.jsx)(`h4`,{children:t===void 0?`No task selected`:`Task not found`})}),(0,P.jsx)(`p`,{children:t===void 0?`Select a task to inspect its contract, latest result, and run history.`:`No task exists for ${t}. Select another task from the Worklist.`})]}):(0,P.jsxs)(`aside`,{className:`task-detail-card`,"aria-label":`Selected task details`,children:[(0,P.jsxs)(`div`,{className:`task-detail-head`,children:[(0,P.jsx)(ws,{status:e.status,children:e.status}),(0,P.jsx)(`h4`,{children:e.title})]}),(0,P.jsx)(`p`,{children:e.summary}),(0,P.jsxs)(`section`,{className:`task-detail-section`,"aria-label":`Task contract`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Task contract`}),(0,P.jsx)(xb,{rows:e.contractRows})]}),(0,P.jsxs)(`section`,{className:`task-detail-section task-evidence-section`,"aria-label":`Evidence`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Evidence`}),(0,P.jsx)(xb,{rows:e.evidenceRows??e.resultRows})]}),(0,P.jsxs)(`section`,{className:`task-detail-section`,"aria-label":`Run result history`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Run result history`}),e.runResults.length===0?(0,P.jsx)(`p`,{children:`No run result yet.`}):(0,P.jsx)(`div`,{className:`run-result-list`,children:e.runResults.map(e=>(0,P.jsx)(`article`,{className:`run-result-item`,children:(0,P.jsxs)(`div`,{className:`run-result-item-head`,children:[(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:e.title}),e.meta===void 0?null:(0,P.jsx)(`small`,{children:e.meta})]}),e.status===void 0?null:(0,P.jsx)(ws,{status:e.status,children:e.status})]})},e.id))})]})]})}function wb({modules:e,taskCount:t,detail:n,missingTaskId:r,runNote:i,onSelectTask:a,empty:o,className:s,...c}){return(0,P.jsx)(pa,{title:`Worklist`,icon:(0,P.jsx)(ji,{"aria-hidden":`true`}),action:(0,P.jsx)(`div`,{className:`worklist-header-summary`,children:(0,P.jsx)(`span`,{className:`mini-meta`,children:t===1?`1 task`:`${t} tasks`})}),className:R(`tasks worklist-page-panel`,s),...c,children:(0,P.jsxs)(`div`,{className:`worklist-page-body`,children:[i===void 0?null:(0,P.jsx)(`p`,{className:`worklist-run-note`,children:i}),e.length===0?(0,P.jsx)(`div`,{className:`worklist-page-empty`,children:o??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No compiled tasks`})}):(0,P.jsxs)(`div`,{className:`task-board-body`,children:[(0,P.jsx)(`div`,{className:`task-list`,"aria-label":`Tasks`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`task-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:e.label}),e.rows.map(e=>(0,P.jsx)(Sb,{title:e.title,status:e.status,onClick:()=>a?.(e.id),...e.selected===void 0?{}:{selected:e.selected}},e.id))]},e.label))}),(0,P.jsx)(Cb,{...n===void 0?{}:{detail:n},...r===void 0?{}:{missingTaskId:r}})]})]})})}function Tb({sections:e,statuses:t=[],className:n,...r}){return(0,P.jsxs)(`section`,{className:R(`settings-sheet`,n),"aria-labelledby":`settings-title`,...r,children:[(0,P.jsxs)(`header`,{className:`settings-sheet-head`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ma,{icon:(0,P.jsx)(qi,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{id:`settings-title`,children:`Project settings`})]}),t.length===0?null:(0,P.jsx)(`div`,{className:`panel-actions`,children:t.map(e=>(0,P.jsx)(Ss,{className:`task-tag`,tone:e.tone,children:e.label},e.label))})]}),e.map(e=>(0,P.jsxs)(`section`,{className:`settings-section`,id:e.id,"aria-label":e.title,children:[(0,P.jsx)(`div`,{className:`settings-section-title`,children:(0,P.jsx)(`h4`,{children:e.title})}),(0,P.jsx)(`div`,{className:`settings-section-body`,children:e.rows.map(e=>(0,P.jsxs)(`div`,{className:`settings-row`,children:[(0,P.jsx)(`span`,{className:`field-label`,children:e.label}),e.value===void 0?(0,P.jsx)(`span`,{}):e.plain===!0?(0,P.jsx)(`div`,{className:`settings-row-value`,children:e.value}):e.code===!0?(0,P.jsx)(`code`,{children:e.value}):(0,P.jsx)(`strong`,{children:e.value})]},e.label))})]},e.id))]})}function Eb({row:e}){return e.category===`image`?(0,P.jsx)(Ei,{"aria-hidden":`true`}):e.canPreview===!1?(0,P.jsx)(xi,{"aria-hidden":`true`}):e.selected===!0?(0,P.jsx)(bi,{"aria-hidden":`true`}):e.extension===`md`||e.extension===`txt`?(0,P.jsx)(Si,{"aria-hidden":`true`}):(0,P.jsx)(Ci,{"aria-hidden":`true`})}function Db({row:e,onSelectFile:t}){return(0,P.jsxs)(`button`,{className:R(`reference-row`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-current":e.selected===!0?`true`:void 0,onClick:()=>t?.(e.path),children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Eb,{row:e})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`span`,{children:e.meta})]})]})}function Ob({name:e,rows:t,onSelectFile:n}){return(0,P.jsxs)(`details`,{className:`reference-folder-group`,children:[(0,P.jsxs)(`summary`,{className:`reference-folder-head`,children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Ti,{})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsxs)(`span`,{children:[t.length,` `,t.length===1?`file`:`files`]})]})]}),(0,P.jsx)(`div`,{className:`reference-folder-files`,children:t.map(e=>(0,P.jsx)(Db,{row:e,...n===void 0?{}:{onSelectFile:n}},e.path))})]})}function kb(e){let t=new Map;for(let n of e){if(n.source!==`tutti_output`||n.generatedGroup===void 0)continue;let e=t.get(n.generatedGroup)??[];e.push(n),t.set(n.generatedGroup,e)}return[...t.entries()].map(([e,t])=>({name:e,rows:t}))}function Ab({files:e,detail:t,uploadPending:n=!1,fileSortMode:r=`time`,empty:i,onSelectFile:a,onUploadFile:o,onDropFiles:s,onFileSortModeChange:c,className:l,...u}){let d=e.filter(e=>e.category===`image`&&e.source!==`tutti_output`),f=e.filter(e=>!(e.category===`image`&&e.source!==`tutti_output`)),p=f.filter(e=>e.source!==`tutti_output`||e.generatedGroup===void 0),m=kb(f),h=e=>(0,P.jsx)(`div`,{className:`reference-image-strip`,role:`list`,"aria-label":`Reference images`,onWheel:e=>{Math.abs(e.deltaY)>Math.abs(e.deltaX)&&(e.currentTarget.scrollLeft+=e.deltaY,e.preventDefault())},children:e.map(e=>(0,P.jsxs)(`button`,{className:R(`reference-image-tile`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-current":e.selected===!0?`true`:void 0,"aria-label":`Open ${e.name}`,onClick:()=>a?.(e.path),children:[e.thumbnailUrl===void 0?(0,P.jsx)(`span`,{className:`reference-image-tile-fallback`,"aria-hidden":`true`,children:(0,P.jsx)(Ei,{})}):(0,P.jsx)(`img`,{src:e.thumbnailUrl,alt:e.name,loading:`lazy`,decoding:`async`}),(0,P.jsx)(`span`,{children:e.name})]},e.path))}),g=e=>e.map(e=>(0,P.jsx)(Db,{row:e,...a===void 0?{}:{onSelectFile:a}},e.path)),_=s??(o===void 0?void 0:e=>{for(let t of e)o(t)});return(0,P.jsxs)(uy,{className:R(`panel references-panel`,l),"aria-label":`References`,dropLabel:`Drop reference files to upload`,pending:n,onFilesUpload:_,...u,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ma,{icon:(0,P.jsx)(Si,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`References`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(Jy,{variant:`action`,className:`reference-upload-button`,label:`Upload`,pendingLabel:`Uploading`,pending:n,onFileUpload:o})})]}),(0,P.jsx)(`div`,{className:`reference-board-body`,children:e.length===0?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:i??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No reference files`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-list`,"aria-label":`Reference file list`,children:[d.length===0?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Images`}),h(d)]}),f.length===0?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-files-head`,children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Files`}),(0,P.jsxs)(`div`,{className:`reference-list-toolbar`,role:`toolbar`,"aria-label":`Sort files`,children:[(0,P.jsx)(`button`,{className:R(`reference-sort-button`,r===`time`?`is-active`:void 0),type:`button`,"aria-label":`Sort files by upload time`,"aria-pressed":r===`time`,onClick:()=>c?.(`time`),children:(0,P.jsx)(gi,{"aria-hidden":`true`})}),(0,P.jsx)(`button`,{className:R(`reference-sort-button`,r===`type`?`is-active`:void 0),type:`button`,"aria-label":`Sort files by type`,"aria-pressed":r===`type`,onClick:()=>c?.(`type`),children:(0,P.jsx)(Qi,{"aria-hidden":`true`})})]})]}),g(p),m.map(e=>(0,P.jsx)(Ob,{name:e.name,rows:e.rows,...a===void 0?{}:{onSelectFile:a}},e.name))]})]}),(0,P.jsxs)(`aside`,{className:`reference-detail-card`,"aria-label":`Selected reference content`,children:[(0,P.jsxs)(`div`,{className:`reference-detail-head`,children:[(0,P.jsx)(`h4`,{children:t?.title??`No file selected`}),t?.meta===void 0?null:(0,P.jsx)(`p`,{children:t.meta})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Summary`}),(0,P.jsx)(`p`,{className:`reference-summary`,children:t?.summary??`Summary not available yet`}),t?.summaryStatus===void 0?null:(0,P.jsx)(`p`,{className:`reference-summary-status`,children:t.summaryStatus})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Content`}),t?.content===void 0?t?.imageUrl===void 0?(0,P.jsx)(`p`,{className:`reference-content`,children:t?.unavailableReason??`Select a reference file`}):(0,P.jsx)(`img`,{className:`reference-image-preview`,src:t.imageUrl,alt:t.title,decoding:`async`}):(0,P.jsx)(`pre`,{className:`reference-content`,children:(0,P.jsx)(`code`,{children:t.content})})]})]})]})})]})}function jb(e){return e.status===`loading`?{status:`running`,label:`Loading`}:e.status===`not_declared`?{status:`todo`,label:`No artifact`}:e.status===`invalid`?{status:`failed`,label:`Invalid`}:e.status===`updating`?{status:`running`,label:`Updating`}:e.previewStatus===`ready`?{status:`done`,label:`Ready`}:e.previewStatus===`starting`?{status:`running`,label:`Starting`}:e.previewStatus===`failed`?{status:`failed`,label:`Failed`}:{status:`todo`,label:`Idle`}}function Mb({state:e,empty:t,emptyWatermark:n}){if(e.status===`declared`&&e.previewStatus===`ready`&&e.previewUrl!==void 0)return(0,P.jsx)(`iframe`,{className:`artifact-iframe`,src:e.previewUrl,title:`${e.title} artifact preview`,sandbox:`allow-scripts allow-forms allow-same-origin`,referrerPolicy:`no-referrer`});let r,i=`neutral`;return e.status===`loading`?r=`Loading artifact`:e.status===`updating`?r=`Artifact is updating`:e.status===`not_declared`?r=`No artifact`:e.status===`invalid`?(i=`error`,r=`Invalid artifact. ${e.message}`):e.previewStatus===`starting`?r=`Preview is starting`:e.previewStatus===`failed`?(i=`error`,r=e.errorMessage??`Preview failed`):r=`Preview is idle`,(0,P.jsx)(`div`,{className:`artifact-empty-preview`,role:e.status===`invalid`?`alert`:void 0,children:t??(0,P.jsx)(ia,{tone:i,watermark:n,children:r})})}function Nb({state:e,error:t=null,empty:n,emptyWatermark:r,className:i,...a}){let o=t===null?e:{status:`invalid`,message:t},s=jb(o);return(0,P.jsxs)(`section`,{className:R(`panel artifacts-panel`,i),"aria-label":`Artifacts`,...a,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ma,{icon:(0,P.jsx)(Li,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`Artifacts`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(ws,{status:s.status,children:s.label})})]}),(0,P.jsx)(`div`,{className:`artifact-board-body`,children:(0,P.jsx)(`div`,{className:`artifact-preview-frame`,"aria-label":`Current artifact`,children:(0,P.jsx)(Mb,{state:o,empty:n,emptyWatermark:r})})})]})}function Pb({row:e}){return e.selected===!0?(0,P.jsx)(bi,{"aria-hidden":`true`}):(0,P.jsx)(Yi,{"aria-hidden":`true`})}function Fb({skills:e,communityLinks:t=[],detail:n,uploadPending:r=!1,deletePending:i=!1,empty:a,onSelectSkill:o,onUploadSkill:s,onDeleteSkill:c,className:l,...u}){let d=e.find(e=>e.selected===!0)?.name,f=t.length>0;return(0,P.jsxs)(`section`,{className:R(`panel references-panel skills-panel`,l),"aria-label":`Skills`,...u,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ma,{icon:(0,P.jsx)(Yi,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`Skills`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(Jy,{variant:`action`,className:`reference-upload-button`,label:`Upload`,pendingLabel:`Uploading`,pending:r,accept:`.zip,application/zip,application/x-zip-compressed`,onFileUpload:s})})]}),(0,P.jsx)(`div`,{className:`reference-board-body`,children:e.length===0&&!f?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:a??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No skills`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-list`,"aria-label":`Skill list`,children:[f?(0,P.jsxs)(`div`,{className:`skill-community-section`,"aria-label":`Skill communities`,children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Skill communities`}),(0,P.jsx)(`div`,{className:`skill-community-grid`,children:t.map(e=>(0,P.jsxs)(`a`,{className:`skill-community-card`,href:e.href,target:`_blank`,rel:`noreferrer`,children:[(0,P.jsx)(`span`,{className:`skill-community-card-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Ai,{})}),(0,P.jsx)(`span`,{className:`skill-community-card-main`,children:(0,P.jsx)(`strong`,{children:e.title})})]},e.href))})]}):null,e.length===0?null:(0,P.jsx)(`div`,{className:`reference-section-label`,children:`User skills`}),e.map(e=>(0,P.jsxs)(`button`,{className:R(`reference-row`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-label":`Select skill ${e.name}`,"aria-current":e.selected===!0?`true`:void 0,onClick:()=>o?.(e.name),children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Pb,{row:e})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`span`,{children:e.shortDescription??e.description})]})]},e.name))]}),(0,P.jsx)(`aside`,{className:`reference-detail-card`,"aria-label":`Selected skill content`,children:e.length===0?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:a??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No skills`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-detail-head skill-detail-head`,children:[(0,P.jsxs)(`div`,{className:`skill-detail-title`,children:[(0,P.jsx)(`h4`,{children:n?.title??`No skill selected`}),n?.description===void 0?null:(0,P.jsx)(`p`,{children:n.description}),n?.updatedLabel===void 0?null:(0,P.jsx)(`p`,{children:n.updatedLabel})]}),d===void 0||c===void 0?null:(0,P.jsxs)(xs,{className:`skill-delete-button`,type:`button`,disabled:i,"aria-busy":i,onClick:()=>c(d),children:[(0,P.jsx)(ea,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:i?`Deleting`:`Delete`})]})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`SKILL.md`}),n?.skillMd===void 0?(0,P.jsx)(`p`,{className:`reference-content`,children:n?.unavailableReason??`Select a skill`}):(0,P.jsx)(`pre`,{className:`reference-content`,children:(0,P.jsx)(`code`,{"aria-label":`Skill markdown for ${n.title}`,children:n.skillMd})})]})]})})]})})]})}function Ib({label:e,children:t}){return(0,P.jsxs)(`section`,{className:`timeline-trace-section`,children:[(0,P.jsx)(`span`,{className:`timeline-trace-label`,children:e}),(0,P.jsx)(`div`,{className:`timeline-trace-section-body`,children:t})]})}function Lb(e){return e.replaceAll(`_`,` `)}function Rb(e){return e===`passed`?`success`:e===`failed`?`error`:`warning`}function zb(e){return e.status===`promoted`?`success`:e.status===`not_promoted`?`error`:`neutral`}function Bb(e){if(e.skipReasonSummary!==void 0)return e.skipReasonSummary;switch(e.checks){case`passed`:return`All validation checks passed.`;case`failed`:return`Validation checks failed.`;case`skipped`:return`Validation was skipped.`}}function Vb(e){if(e.summary!==void 0)return e.summary;switch(e.status){case`promoted`:return`Changes were promoted after verification.`;case`not_promoted`:return`Changes were not promoted.`;case`not_attempted`:return`Promotion was not attempted.`}}function Hb(e){switch(e){case`added`:return`+`;case`modified`:return`~`;case`deleted`:return`-`;case`renamed`:return`~`;case`unknown`:return`?`}}var Ub=3;function Wb({expanded:e,collapsedLabel:t,expandedLabel:n,onClick:r}){return(0,P.jsxs)(`button`,{"aria-expanded":e,className:R(`timeline-trace-more`,e&&`is-expanded`),onClick:r,type:`button`,children:[(0,P.jsx)(`span`,{children:e?n:t}),(0,P.jsx)(ui,{"aria-hidden":`true`})]})}function Gb({expanded:e,hiddenCount:t,label:n,onClick:r}){return t<=0?null:(0,P.jsx)(Wb,{collapsedLabel:`Show ${t} more ${n}${t===1?``:`s`}`,expanded:e,expandedLabel:`Show fewer ${n}s`,onClick:r})}function Kb(e){let t=[];return(e.origin!==void 0||e.decisions!==void 0||e.clarification!==void 0)&&t.push({id:`context`,label:`Context`,tone:`neutral`}),e.contract!==void 0&&t.push({id:`contract`,label:`Contract`,tone:`neutral`}),(e.result!==void 0||e.changes!==void 0)&&t.push({id:`result`,label:`Result`,tone:e.tone}),e.verification!==void 0&&t.push({id:`checks`,label:`Checks`,tone:Rb(e.verification.checks)}),e.promotion!==void 0&&t.push({id:`promotion`,label:`Promotion`,tone:zb(e.promotion)}),e.checkpoint!==void 0&&t.push({id:`checkpoint`,label:`Checkpoint`,tone:e.tone}),t}function qb({trace:e}){let t=Kb(e),n=e.links.filter(e=>e.onClick!==void 0),[r,i]=(0,N.useState)(()=>new Set),a=r.has(`origin`),o=r.has(`decisions`),s=r.has(`clarification-answers`),c=r.has(`scope`),l=r.has(`changes`),u=r.has(`checkpoint`),d=r.has(`generated-files`),f=e.origin?.snippets??[],p=e.decisions===void 0||o?e.decisions??[]:e.decisions.slice(0,Ub),m=e.clarification?.answers===void 0||s?e.clarification?.answers??[]:e.clarification.answers.slice(0,Ub),h=e.contract===void 0||c?e.contract?.scope??[]:e.contract.scope.slice(0,Ub),g=e.checkpoint===void 0||u?e.checkpoint?.items??[]:e.checkpoint.items.slice(0,Ub),_=e.checkpoint?.generatedFiles===void 0||d?e.checkpoint?.generatedFiles??[]:e.checkpoint.generatedFiles.slice(0,Ub);function v(e){i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsxs)(`div`,{className:R(`timeline-trace-card`,`is-${e.tone}`),children:[e.summary===void 0||e.result!==void 0?null:(0,P.jsx)(`p`,{className:`timeline-trace-summary`,children:e.summary}),t.length===0?null:(0,P.jsx)(`ol`,{className:`timeline-trace-path`,"aria-label":`Recorded task trace`,children:t.map(e=>(0,P.jsxs)(`li`,{className:`is-${e.tone}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`}),(0,P.jsx)(`strong`,{children:e.label})]},e.id))}),e.origin===void 0?null:(0,P.jsxs)(Ib,{label:`Origin`,children:[e.origin.title===void 0?null:(0,P.jsx)(`strong`,{className:`timeline-trace-title`,children:e.origin.title}),e.origin.summary===void 0?null:(0,P.jsx)(`p`,{children:e.origin.summary}),e.origin.unavailableReason===void 0?null:(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:e.origin.unavailableReason}),f.length>0?(0,P.jsx)(Wb,{collapsedLabel:`Show ${f.length} source message${f.length===1?``:`s`}`,expanded:a,expandedLabel:`Show fewer source messages`,onClick:()=>v(`origin`)}):e.origin.sourceCount===void 0?null:(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.origin.sourceCount,` source message`,e.origin.sourceCount===1?``:`s`]}),!a||f.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-snippet-list`,children:f.map(e=>(0,P.jsx)(`li`,{className:`timeline-trace-snippet`,children:e.onClick===void 0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]}):(0,P.jsxs)(`button`,{className:`timeline-trace-snippet-button`,onClick:e.onClick,type:`button`,children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]})},e.id))})]}),e.decisions===void 0||e.decisions.length===0?null:(0,P.jsxs)(Ib,{label:`Accepted Context`,children:[(0,P.jsx)(`ul`,{className:`timeline-trace-list`,children:p.map(e=>(0,P.jsxs)(`li`,{children:[e.title===void 0?null:(0,P.jsx)(Ss,{tone:`neutral`,children:e.title}),(0,P.jsx)(`span`,{children:e.summary})]},e.id))}),(0,P.jsx)(Gb,{expanded:o,hiddenCount:Math.max(e.decisions.length-Ub,0),label:`context item`,onClick:()=>v(`decisions`)})]}),e.clarification===void 0?null:(0,P.jsxs)(Ib,{label:`Clarification`,children:[e.clarification.title===void 0?null:(0,P.jsx)(`strong`,{className:`timeline-trace-title`,children:e.clarification.title}),e.clarification.summary===void 0?null:(0,P.jsx)(`p`,{children:e.clarification.summary}),e.clarification.request===void 0?null:(0,P.jsx)(`p`,{children:e.clarification.request}),e.clarification.status===void 0&&e.clarification.answerCount===void 0?null:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[e.clarification.status===void 0?null:(0,P.jsx)(Ss,{tone:e.clarification.status===`active`?`warning`:`success`,children:e.clarification.status===`active`?`needs input`:`resolved`}),e.clarification.answerCount===void 0?null:(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.clarification.answerCount,` answer`,e.clarification.answerCount===1?``:`s`]})]}),e.clarification.answers===void 0||e.clarification.answers.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-snippet-list`,children:m.map(e=>(0,P.jsx)(`li`,{className:`timeline-trace-snippet`,children:e.onClick===void 0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]}):(0,P.jsxs)(`button`,{className:`timeline-trace-snippet-button`,onClick:e.onClick,type:`button`,children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]})},e.id))}),e.clarification.answers===void 0?null:(0,P.jsx)(Gb,{expanded:s,hiddenCount:Math.max(e.clarification.answers.length-Ub,0),label:`answer`,onClick:()=>v(`clarification-answers`)})]}),e.contract===void 0?null:(0,P.jsxs)(Ib,{label:`Contract`,children:[(0,P.jsx)(`p`,{children:e.contract.goal}),h.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-list is-bulleted`,children:h.map((e,t)=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`span`,{children:e})},`scope-${t}`))}),(0,P.jsx)(Gb,{expanded:c,hiddenCount:Math.max(e.contract.scope.length-Ub,0),label:`scope item`,onClick:()=>v(`scope`)}),c&&e.contract.truncated===!0?(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:`Additional scope items are outside this bounded audit preview.`}):null]}),e.result===void 0?null:(0,P.jsxs)(Ib,{label:`Result`,children:[(0,P.jsx)(`p`,{children:e.result.summary}),e.result.errorCode===void 0?null:(0,P.jsx)(`code`,{className:`timeline-trace-code`,children:e.result.errorCode})]}),e.changes===void 0?null:(0,P.jsxs)(Ib,{label:`Changes`,children:[e.changes.items.length===0?(0,P.jsx)(`p`,{className:`timeline-trace-muted`,children:`No repo changes recorded.`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Wb,{collapsedLabel:`Show ${e.changes.items.length} file change${e.changes.items.length===1?``:`s`}`,expanded:l,expandedLabel:`Show fewer file changes`,onClick:()=>v(`changes`)}),l?(0,P.jsx)(`ul`,{className:`timeline-trace-diff-list`,children:e.changes.items.map(e=>(0,P.jsxs)(`li`,{className:`is-${e.status}`,children:[(0,P.jsx)(`span`,{className:`timeline-trace-diff-mark`,children:Hb(e.status)}),(0,P.jsx)(`code`,{children:e.previousPath===void 0?e.path:`${e.previousPath} -> ${e.path}`})]},`${e.status}:${e.path}`))}):null]}),l&&e.changes.totalCount>e.changes.items.length?(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.changes.totalCount-e.changes.items.length,` additional files are outside this bounded audit preview.`]}):null]}),e.verification===void 0?null:(0,P.jsx)(Ib,{label:`Verification`,children:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[(0,P.jsx)(Ss,{tone:Rb(e.verification.checks),children:Lb(e.verification.checks)}),(0,P.jsx)(`p`,{children:Bb(e.verification)})]})}),e.promotion===void 0?null:(0,P.jsx)(Ib,{label:`Promotion`,children:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[(0,P.jsx)(Ss,{tone:zb(e.promotion),children:Lb(e.promotion.status)}),(0,P.jsx)(`p`,{children:Vb(e.promotion)})]})}),e.checkpoint===void 0?null:(0,P.jsxs)(Ib,{label:`Checkpoint`,children:[(0,P.jsxs)(`div`,{className:`timeline-trace-counters`,children:[(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.completed,` completed`]}),(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.failed,` failed`]}),(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.remaining,` remaining`]})]}),(0,P.jsx)(`ul`,{className:`timeline-trace-list`,children:g.map(e=>(0,P.jsxs)(`li`,{children:[(0,P.jsx)(Ss,{tone:e.status===`done`?`success`:`error`,children:e.status===`done`?`done`:`failed`}),(0,P.jsx)(`strong`,{children:e.title}),(0,P.jsx)(`span`,{children:e.summary})]},e.id))}),(0,P.jsx)(Gb,{expanded:u,hiddenCount:Math.max(e.checkpoint.items.length-Ub,0),label:`checkpoint item`,onClick:()=>v(`checkpoint`)}),e.checkpoint.generatedFiles===void 0||e.checkpoint.generatedFiles.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-file-list`,children:_.map(e=>(0,P.jsxs)(`li`,{children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`code`,{children:e.path})]},e.id))}),e.checkpoint.generatedFiles===void 0?null:(0,P.jsx)(Gb,{expanded:d,hiddenCount:Math.max(e.checkpoint.generatedFiles.length-Ub,0),label:`generated file`,onClick:()=>v(`generated-files`)}),(u||d)&&e.checkpoint.truncated===!0?(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:`Additional checkpoint evidence is outside this bounded audit preview.`}):null]}),n.length===0?null:(0,P.jsx)(Ib,{label:`Links`,children:(0,P.jsx)(`div`,{className:`timeline-trace-links`,children:n.map(e=>(0,P.jsxs)(xs,{className:`timeline-trace-link`,onClick:e.onClick,type:`button`,children:[(0,P.jsx)(yi,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:e.label})]},e.id))})})]})}function Jb({item:e,expanded:t,active:n,onActivate:r,onToggle:i}){let a=e.trace,o=a!==void 0,s=e.tone??`neutral`,c=s===`error`?(0,P.jsx)(ra,{"aria-hidden":`true`}):s===`warning`?(0,P.jsx)(Ii,{"aria-hidden":`true`}):s===`sync`?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(li,{"aria-hidden":`true`});return(0,P.jsxs)(`li`,{className:R(`timeline-event-item`,o?`has-trace`:void 0,t?`is-expanded`:void 0,n?`is-current`:void 0,e.tone===void 0?void 0:`is-${e.tone}`),id:`timeline-event-${e.id}`,children:[(0,P.jsx)(`time`,{className:`timeline-event-time`,children:e.occurredAt}),(0,P.jsx)(`div`,{className:`timeline-event-marker`,"aria-hidden":`true`}),(0,P.jsxs)(`div`,{className:`timeline-event-main`,children:[(0,P.jsxs)(`button`,{"aria-expanded":o?t:void 0,className:`timeline-event-toggle`,disabled:!o,onClick:()=>{r(),i()},type:`button`,children:[(0,P.jsx)(`span`,{className:R(`timeline-event-status-icon`,`is-${s}`),"aria-hidden":`true`,children:c}),(0,P.jsxs)(`span`,{className:`timeline-event-copy`,children:[(0,P.jsx)(`span`,{className:`timeline-event-stage`,children:e.stageLabel??(e.kind===`checkpoint`?`Checkpoint`:`Task event`)}),(0,P.jsxs)(`span`,{className:`timeline-event-title-line`,children:[(0,P.jsx)(`h4`,{children:e.taskTitle??e.title}),e.tokenLabel===void 0?null:(0,P.jsx)(`span`,{className:`timeline-event-token`,children:e.tokenLabel})]})]}),o?(0,P.jsx)(ui,{className:`timeline-event-chevron`,"aria-hidden":`true`}):null]}),a!==void 0&&t?(0,P.jsx)(qb,{trace:a}):null]})]})}function Yb(e){let t=new Map;for(let n of e){let e=n.taskId===void 0?`event:${n.id}`:`task:${n.taskId}`,r=t.get(e);r===void 0?t.set(e,{id:e,title:n.taskTitle??n.title,...n.taskId===void 0?{}:{taskId:n.taskId},items:[n]}):r.items.push(n)}return[...t.values()]}function Xb({tokenOverview:e,items:t,scoreUnits:n=[],empty:r,defaultExpandedItemIds:i,className:a,...o}){let[s,c]=(0,N.useState)(()=>new Set(i??[])),[l,u]=(0,N.useState)(()=>n.at(-1)?.id),[d,f]=(0,N.useState)(0),p=(0,N.useRef)(null),m=Yb(t),h=new Set(t.flatMap(e=>e.taskId===void 0?[]:[e.taskId])).size;(0,N.useEffect)(()=>{if(n.length===0){u(void 0);return}(l===void 0||!n.some(e=>e.id===l))&&u(n.at(-1)?.id)},[l,n]),(0,N.useEffect)(()=>{let e=p.current;if(e===null)return;let t=e;t.scrollLeft=t.scrollWidth;function n(e){if(Math.abs(e.deltaY)<=Math.abs(e.deltaX))return;let n=Math.max(0,t.scrollWidth-t.clientWidth),r=Math.min(n,Math.max(0,t.scrollLeft+e.deltaY));r!==t.scrollLeft&&(e.preventDefault(),t.scrollLeft=r)}return t.addEventListener(`wheel`,n,{passive:!1}),()=>t.removeEventListener(`wheel`,n)},[n.length]),(0,N.useEffect)(()=>{let e=p.current;if(e===null)return;let t=()=>f(e.clientWidth);if(t(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t);let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[n.length]);function g(e,t=!1){u(e),t&&(c(t=>new Set(t).add(e)),window.requestAnimationFrame(()=>{document.getElementById(`timeline-event-${e}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}))}function _(e){c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsx)(pa,{className:R(`timeline-panel`,a),title:`Timeline`,icon:(0,P.jsx)(ci,{"aria-hidden":`true`}),...o,children:(0,P.jsxs)(`div`,{className:`timeline-board-body`,children:[(0,P.jsxs)(`section`,{className:`timeline-events`,"aria-label":`Project timeline`,children:[(0,P.jsx)(`div`,{className:`timeline-audit-header`,children:(0,P.jsxs)(`div`,{className:`timeline-audit-intro`,children:[(0,P.jsx)(`h4`,{children:`Task traceability`}),(0,P.jsxs)(`div`,{className:`timeline-audit-meta`,"aria-label":`Timeline record summary`,children:[(0,P.jsx)(`span`,{children:h===1?`1 task`:`${h} tasks`}),(0,P.jsx)(`span`,{children:t.length===1?`1 record`:`${t.length} records`})]})]})}),t.length===0?r:(0,P.jsx)(`div`,{className:`timeline-task-groups`,children:m.map(e=>(0,P.jsxs)(`section`,{className:`timeline-task-group`,"aria-label":e.title,children:[(0,P.jsxs)(`header`,{className:`timeline-task-group-head`,children:[(0,P.jsx)(`span`,{children:e.taskId===void 0?`Project record`:`Task trace`}),(0,P.jsx)(`strong`,{children:e.title})]}),(0,P.jsx)(`ol`,{className:`timeline-event-list`,children:e.items.map(e=>(0,P.jsx)(Jb,{active:l===e.id,expanded:s.has(e.id),item:e,onActivate:()=>g(e.id),onToggle:()=>_(e.id)},e.id))})]},e.id))})]}),(0,P.jsxs)(`section`,{className:`timeline-overview`,"aria-label":`Timeline score and token usage`,children:[n.length===0?null:(0,P.jsx)(`div`,{className:`timeline-score-index`,ref:p,role:`group`,"aria-label":`Timeline score index`,children:(0,P.jsx)(so,{"aria-label":`Timeline event score`,...l===void 0?{}:{activeUnitId:l},edgePadding:0,minimumWidth:d,onUnitSelect:e=>g(e,!0),openingBarline:`double`,openingClef:`treble`,horizontalSpacingScale:po,reveal:!0,scale:uo,units:n})}),(0,P.jsxs)(`div`,{className:`timeline-overview-token`,"aria-label":`Total tokens`,children:[(0,P.jsx)(`span`,{children:`Total tokens`}),(0,P.jsx)(`strong`,{children:e.totalLabel})]})]})]})})}var Zb=new Intl.NumberFormat(`en-US`),Qb=Vo(`beethoven-ode-to-joy`);function $b(e){return[...e].reverse().map((e,t)=>{let n=Qb.units[t%Qb.units.length];if(n===void 0)throw Error(`Timeline score theme unexpectedly has no units`);return{...n,id:e.id,label:`Open ${e.stageLabel??e.title}`}})}function ex(e){return Zb.format(e)}function tx(e){if(e!==void 0)switch(e){case`completed`:return`success`;case`failed`:return`error`;case`needs_human`:return`warning`}}function nx(e){if(e.kind===`task_accepted`)return`Task accepted`;if(e.kind===`checkpoint`)return`Checkpoint`;switch(e.update_state){case`completed`:return`Task completed`;case`failed`:return`Task failed`;case`needs_input`:return`Needs input`;default:return`Task update`}}function rx(e,t){let n=Date.parse(e.occurred_at),r=Date.parse(t.occurred_at),i=Number.isFinite(n)&&Number.isFinite(r)?r-n:t.occurred_at.localeCompare(e.occurred_at);return i===0?t.id.localeCompare(e.id):i}function ix(e,t={}){let n=e.token_usage?.total_tokens??0,r=tx(e.status),i={id:e.id,title:e.task_title??e.title,occurredAt:tr(e.occurred_at),kind:e.kind,stageLabel:nx(e)};return r!==void 0&&(i.tone=r),n>0&&(i.tokenLabel=`${ex(n)} tokens`),e.task_id!==void 0&&(i.taskId=e.task_id),e.task_title!==void 0&&(i.taskTitle=e.task_title),e.trace_card!==void 0&&(i.trace=ox(e.trace_card,t)),i}function ax(e,t){if(e.kind===`worklist_task`&&e.task_id!==void 0){let n=t.onOpenWorklistTask,r=e.task_id;return n===void 0?void 0:()=>n(r)}if(e.kind===`chat_message`&&e.message_id!==void 0){let n=t.onOpenChatMessage,r=e.message_id;return n===void 0?void 0:()=>n(r)}if(e.kind===`reference_file`&&e.path!==void 0){let n=t.onOpenReferenceFile,r=e.path;return n===void 0?void 0:()=>n(r)}}function ox(e,t={}){return{tone:e.tone,...e.summary===void 0?{}:{summary:e.summary},...e.origin===void 0?{}:{origin:{...e.origin.title===void 0?{}:{title:e.origin.title},...e.origin.summary===void 0?{}:{summary:e.origin.summary},...e.origin.unavailable_reason===void 0?{}:{unavailableReason:e.origin.unavailable_reason},...e.origin.source_count===void 0?{}:{sourceCount:e.origin.source_count},...e.origin.snippets===void 0?{}:{snippets:e.origin.snippets.map(e=>({id:e.message_id,author:e.author,body:e.body,createdAt:tr(e.created_at),...t.onOpenChatMessage===void 0?{}:{onClick:()=>t.onOpenChatMessage?.(e.message_id)}}))}}},...e.decisions===void 0?{}:{decisions:e.decisions.map((e,t)=>({id:`${t}:${e.source??`decision`}`,...e.title===void 0?{}:{title:e.title},summary:e.summary}))},...e.clarification===void 0?{}:{clarification:{...e.clarification.title===void 0?{}:{title:e.clarification.title},...e.clarification.summary===void 0?{}:{summary:e.clarification.summary},...e.clarification.request===void 0?{}:{request:e.clarification.request},...e.clarification.status===void 0?{}:{status:e.clarification.status},...e.clarification.answer_count===void 0?{}:{answerCount:e.clarification.answer_count},...e.clarification.answers===void 0?{}:{answers:e.clarification.answers.map(e=>({id:e.message_id,author:e.author,body:e.body,createdAt:tr(e.created_at),...t.onOpenChatMessage===void 0?{}:{onClick:()=>t.onOpenChatMessage?.(e.message_id)}}))}}},...e.contract===void 0?{}:{contract:{goal:e.contract.goal,scope:e.contract.scope,...e.contract.truncated===void 0?{}:{truncated:e.contract.truncated}}},...e.result===void 0?{}:{result:{summary:e.result.summary,...e.result.error_code===void 0?{}:{errorCode:e.result.error_code}}},...e.changes===void 0?{}:{changes:{items:e.changes.items.map(e=>({status:e.status,path:e.path,...e.previous_path===void 0?{}:{previousPath:e.previous_path}})),totalCount:e.changes.total_count,truncated:e.changes.truncated}},...e.verification===void 0?{}:{verification:{checks:e.verification.checks,...e.verification.skip_reason_code===void 0?{}:{skipReasonCode:e.verification.skip_reason_code},...e.verification.skip_reason_summary===void 0?{}:{skipReasonSummary:e.verification.skip_reason_summary}}},...e.promotion===void 0?{}:{promotion:{status:e.promotion.status,...e.promotion.commit_short_oid===void 0?{}:{commitShortOid:e.promotion.commit_short_oid},...e.promotion.summary===void 0?{}:{summary:e.promotion.summary},...e.promotion.reason_code===void 0?{}:{reasonCode:e.promotion.reason_code}}},...e.checkpoint===void 0?{}:{checkpoint:{counters:e.checkpoint.counters,items:e.checkpoint.items.map(e=>({id:e.task_id,title:e.title,status:e.status,summary:e.summary})),...e.checkpoint.generated_files===void 0?{}:{generatedFiles:e.checkpoint.generated_files.map(e=>({id:e.path,name:e.name,path:e.path}))},...e.checkpoint.truncated===void 0?{}:{truncated:e.checkpoint.truncated}}},links:e.links.flatMap(e=>{let n=e.task_id??e.message_id??e.path,r=ax(e,t);return r===void 0?[]:[{id:`${e.kind}:${n??e.label}`,label:e.label,onClick:r}]})}}function sx(e,t={}){let n=e.usage_overview,r=[...e.items].sort(rx).map(e=>ix(e,t));return{tokenOverview:{totalLabel:ex(n.total_tokens)},items:r,scoreUnits:$b(r)}}function cx(e,t,n={}){let r=n.runActive??!1;if(e===void 0)return r?{status:`updating`}:{status:`loading`};if(e.status===`not_declared`)return r?{status:`updating`}:{status:`not_declared`};if(e.status===`invalid`)return r?{status:`updating`}:{status:`invalid`,message:e.error.message};let i={status:`declared`,title:e.artifact.title,previewStatus:e.preview.status,...e.preview.error_message===void 0?{}:{errorMessage:e.preview.error_message}};return e.preview.status===`ready`?t.previewUrl===void 0?r?{status:`updating`}:t.errorMessage===void 0?{...i,previewStatus:t.pending?`starting`:`failed`,...t.pending?{}:{errorMessage:`Preview session is unavailable`}}:{...i,previewStatus:`failed`,errorMessage:t.errorMessage}:{...i,previewUrl:t.previewUrl}:r?{status:`updating`}:i}function lx(e){return e?.status===`declared`&&e.preview.status===`ready`?{status:`live`}:{status:`hidden`}}function ux(e){return e.status===`declared`&&e.previewStatus===`ready`?{status:`live`}:{status:`hidden`}}var dx=[{id:`prepare`,label:`Preparing workspace`},{id:`implement`,label:`Implementing with Codex`},{id:`validate`,label:`Validating result`},{id:`save`,label:`Saving result`}],fx=[{id:`workspace_inspect`,summary:`inspecting the persistent project workspace`,displayStageId:`prepare`},{id:`artifact_candidate_validate`,summary:`validating the candidate Artifact preview`,displayStageId:`validate`},{id:`provider_task_run`,summary:`running Codex task implementation`,displayStageId:`implement`},{id:`provider_retry`,summary:`retrying Codex task after a transient provider failure`,displayStageId:`implement`},{id:`candidate_diff_collect`,summary:`collecting candidate changes`,displayStageId:`validate`},{id:`checks`,summary:`running project checks`,displayStageId:`validate`},{id:`post_checks_diff_collect`,summary:`rechecking candidate changes after checks`,displayStageId:`validate`},{id:`accepted_checkpoint`,summary:`saving the validated project state as an accepted checkpoint`,displayStageId:`save`},{id:`promotion_reconcile`,summary:`reconciling promotion after mainline changed`,displayStageId:`save`},{id:`self_correction`,summary:`retrying task implementation after pipeline feedback`,displayStageId:`implement`}],px={scratchpad_refresh:{key:`scratchpad_refresh`,label:`Refreshing Scratchpad`,target:{kind:`scratchpad`}},project_context_bootstrap:{key:`project_context_bootstrap`,label:`Preparing project context`,target:{kind:`scratchpad`}},task_compile:{key:`task_compile`,label:`Compiling Worklist tasks`,target:{kind:`scratchpad`}},context_sync:{key:`context_sync`,label:`Synchronizing project context`,target:{kind:`worklist`}},reference_summary_refresh:{key:`reference_summary_refresh`,label:`Processing reference`,target:{kind:`references`}},recovery_check:{key:`recovery_check`,label:`Recovering workspace`,target:{kind:`worklist`}},follow_up_check:{key:`follow_up_check`,label:`Checking follow-up`,target:{kind:`worklist`}}},mx=`Tutti is working on`,hx=new Set([`scratchpad_refresh`]),gx=`task_compile`,_x=`project_context_bootstrap`,vx={reading_context:`Codex is reading project context`,planning:`Codex is planning changes`,editing_files:`Codex is editing files`,running_command:`Codex is running a command`,using_tool:`Codex is using a tool`,waiting_for_approval:`Codex is waiting for approval`,finalizing:`Codex is finalizing the result`};function yx(e){if(e===void 0)return null;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(e instanceof Date)return e.getTime();let t=Date.parse(e);return Number.isNaN(t)?null:t}function bx(e){return yx(e.now)??Date.now()}function xx(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;if(t<60)return`${t}m${n}s`;let r=Math.floor(t/60),i=t%60;return`${r}h${String(i).padStart(2,`0`)}m`}function Sx(e,t){let n=yx(e);if(n!==null)return xx(Math.max(0,Math.floor((bx(t)-n)/1e3)))}function Cx(e,t){return Sx(e.active_activity?.started_at??e.runtime?.started_at,t)}function wx(e){let t=e.runtime;if(t===void 0)return;let n=e.active_activity?.activity_ref;if(!(n!==void 0&&t.activity_ref!==n))return t}function Tx(e){if(e<1e3)return String(e);if(e<1e6){let t=e/1e3;return`${e<1e5?t.toFixed(1).replace(/\.0$/u,``):String(Math.round(t))}k`}return`${(e/1e6).toFixed(1).replace(/\.0$/u,``)}m`}function Ex(e){let t=e?.token_usage?.total_tokens;return t===void 0?[]:[`${Tx(t)} tokens`]}function Dx(e){let t=e?.token_usage?.total_tokens;return t===void 0?void 0:`${Tx(t)} tokens`}function Ox(e){let t=e?.current_action;return t===void 0?void 0:vx[t]}function kx(e){let t=Ox(e);if(t===void 0)return;let n=Dx(e);return n===void 0?t:`${t} (${n})`}function Ax(e){let t={};return e.active_activity?.activity_ref!==void 0&&(t.activityRef=e.active_activity.activity_ref),e.active_activity?.workflow_ref!==void 0&&(t.workflowRef=e.active_activity.workflow_ref),e.active_task?.id!==void 0&&(t.taskId=e.active_task.id),Object.keys(t).length===0?void 0:t}function jx(e,t,n){return e===`context_sync`&&t.last_conclusion?.task_id!==void 0?{kind:`task`,taskId:t.last_conclusion.task_id}:n.target}function Mx(e){return fx[Rx(e)]??fx[0]}function Nx(e){return dx.findIndex(t=>t.id===e)}function Px(e){return dx[Nx(Mx(e).displayStageId)]??dx[0]}function Fx(e){if(e.status!==`running`||e.active_activity?.activity_kind!==`procedure`)return null;let t=e.active_activity.workflow_kind;if(t===void 0||hx.has(t))return null;let n=px[t],r=jx(t,e,n);return{key:`procedure:${n.key}`,label:n.label,title:n.label,tone:`running`,target:r}}function Ix(e,t){if(e.status!==`running`||e.active_activity?.activity_kind!==`procedure`)return null;let n=e.active_activity.workflow_kind;if(n===void 0||hx.has(n))return null;let r=px[n],i=jx(n,e,r),a=Ax(e),o=wx(e),s=n===gx?Ex(o):[],c=n===_x?`Creating project context for the first time`:void 0,l=Sx(e.active_activity?.started_at??o?.started_at,t);return{key:`procedure:${r.key}`,title:mx,summary:e.summary,tone:`running`,metaLabel:r.label,completionTarget:i,...a===void 0?{}:{completionSource:a},steps:[{id:`procedure:${r.key}:active`,label:r.label,status:`running`,...l===void 0?{}:{elapsedLabel:l},...c===void 0?{}:{detail:c},...s.length===0?{}:{metrics:s}}]}}function Lx(e){let t=e.indexOf(` - `);return t===-1?``:e.slice(t+3).trim().replace(/\.$/u,``)}function Rx(e){let t=Lx(e).toLocaleLowerCase();if(t===``)return 0;let n=fx.findIndex(e=>t.includes(e.summary.toLocaleLowerCase()));return n===-1?0:n}function zx(e,t){if(e.status!==`running`||e.active_task===void 0)return null;let n=Nx(Mx(e.summary).displayStageId),r=Px(e.summary),i=Ax(e),a=wx(e),o=Cx(e,t);return{key:`run:${e.active_task.id}`,title:mx,summary:e.active_task.title,tone:`running`,metaLabel:r.label,completionTarget:{kind:`task`,taskId:e.active_task.id},...i===void 0?{}:{completionSource:i},steps:dx.map((e,t)=>{let r=t<n?`done`:t===n?`running`:`waiting`,i=t===n,s=e.id===`implement`,c=i&&s?kx(a):void 0,l=s&&c===void 0?Ex(a):[];return{id:e.id,label:e.label,status:r,...i&&o!==void 0?{elapsedLabel:o}:{},...c===void 0?{}:{detail:c},...l.length>0?{metrics:l}:{}}})}}function Bx(e,t){if(e.status!==`running`||e.active_activity?.workflow_kind!==`context_sync`||e.last_conclusion?.kind!==`completed`||e.last_conclusion.task_id===void 0)return null;let n=Ax(e),r=Cx(e,t);return{key:`context-sync:${e.last_conclusion.task_id}`,title:mx,summary:e.summary,tone:`running`,metaLabel:`Synchronizing context`,completionTarget:{kind:`task`,taskId:e.last_conclusion.task_id},...n===void 0?{}:{completionSource:n},steps:[{id:`task_complete`,label:`Task completed`,status:`done`},{id:`context_sync`,label:`Synchronizing project context`,status:`running`,...r===void 0?{}:{elapsedLabel:r}}]}}function Vx(e){let t=e.blocked_by?.kind===`approval`?{kind:`approval`}:{kind:`clarification`};return{key:`pending:${e.blocked_by?.kind===`approval`?e.blocked_by.approval_id:e.blocked_by?.kind===`clarification`?e.blocked_by.round_id:e.updated_at}`,title:mx,summary:e.summary,tone:`pending`,metaLabel:`Needs input`,completionTarget:t,steps:[{id:`waiting_for_input`,label:`Needs input`,status:`pending`}]}}function Hx(e){let t=e.last_conclusion?.task_id??(e.status===`failed`?e.active_task?.id:void 0);return t===void 0&&e.status!==`failed`?null:{key:`failed:${t??e.updated_at}`,title:mx,summary:e.last_conclusion?.summary??e.summary,tone:`failed`,metaLabel:`Failed`,...t===void 0?{}:{completionTarget:{kind:`task`,taskId:t}},steps:[{id:`run_failed`,label:`Run failed`,status:`failed`}]}}function Ux(e,t={}){let n=zx(e,t);if(n!==null)return n;let r=Bx(e,t);if(r!==null)return r;let i=Ix(e,t);return i===null?e.status===`pending`?Vx(e):e.status===`failed`?Hx(e):null:i}function Wx(e){let t=e.activeTaskCompileClarification&&!e.activeScratchpadRefreshFromSubmit&&!e.activeProjectContextBootstrap&&!e.activeTaskCompile,n=[],r=Sx(e.startedAt,e);if(e.activeProjectContextBootstrap)n.push({id:`scratchpad_submit:project_context`,label:`Preparing project context`,status:`running`,...r===void 0?{}:{elapsedLabel:r},detail:`Creating project context for the first time`});else if(e.activeTaskCompile||e.activeScratchpadRefreshFromSubmit){let t=e.activeTaskCompile?Ex(e.runtime):[];n.push({id:`scratchpad_submit:task_compile`,label:`Compiling Worklist tasks`,status:`running`,...r===void 0?{}:{elapsedLabel:r},...t.length===0?{}:{metrics:t}})}else n.push({id:`scratchpad_submit:task_compile`,label:`Compiling Worklist tasks`,status:t?`done`:`running`});t&&n.push({id:`scratchpad_submit:needs_input`,label:`Needs input`,status:`pending`});let i=n.find(e=>e.status===`running`||e.status===`pending`)?.label??`Compiling Worklist tasks`;return{key:`scratchpad-submit`,title:mx,summary:t?`Task compilation needs a decision before Worklist can update.`:`Preparing the Scratchpad for formal tasks.`,tone:t?`pending`:`running`,metaLabel:t?`Needs input`:i,completionTarget:t?{kind:`clarification`}:{kind:`scratchpad`},steps:n}}function Gx(e,t){return{...e,key:`${e.key}:complete`,title:mx,summary:t,tone:`complete`,metaLabel:`Complete`,steps:e.steps.map(e=>({...e,status:`done`}))}}function Kx(e,t){let n=e.completionSource;return n===void 0?!0:n.activityRef===void 0?n.workflowRef===void 0?n.taskId===void 0?!0:t.task_id===n.taskId:t.workflow_ref===n.workflowRef:t.activity_ref===n.activityRef}function qx(e){if(e.status===`idle`)return[];let t=[];if(e.status===`pending`){let n=e.blocked_by?.kind===`approval`?{kind:`approval`}:{kind:`clarification`};t.push({key:`pending`,label:`Needs input`,title:`Needs input`,tone:`pending`,target:n})}let n=e.last_conclusion?.kind===`failed`?e.last_conclusion.task_id:e.status===`failed`?e.active_task?.id??e.last_conclusion?.task_id:void 0;if(n!==void 0&&t.push({key:`failed`,label:`Run failed`,tone:`failed`,target:{kind:`task`,taskId:n}}),e.status===`running`&&e.active_task!==void 0){let n=Px(e.summary);t.push({key:`running`,label:n.label,title:n.label,tone:`running`,target:{kind:`task`,taskId:e.active_task.id}})}let r=Fx(e);return r!==null&&t.push(r),t}var Jx=`/assets/beethoven-symphony-5-opening-ypVy5SB4.svg`,Yx=`/assets/beethoven-symphony-7-allegretto-B3bc-cZD.svg`,Xx=`/assets/dvorak-symphony-9-largo-BEgNL3HB.svg`,Zx=`/assets/mozart-symphony-18-allegro-B5-MrLL1.svg`,Qx=`/assets/Tutti-square-BqFU7F0D.png`,$x=`/assets/Tutti-B7gEyTp1.png`,eS=`/assets/tutti_avatar-_0Yc-cMJ.png`,tS=`/assets/avatar-avery-CkLXb185.svg`,nS=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2080%2080'%20fill='none'%20shape-rendering='auto'%20aria-hidden='true'%3e%3c!--%20Generated%20by%20DiceBear%20(https://dicebear.com)%20--%3e%3cmetadata%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:dcterms='http://purl.org/dc/terms/'%3e%3crdf:RDF%3e%3crdf:Description%3e%3cdc:title%3eDylan!%20The%20Avatar%20Generator%3c/dc:title%3e%3cdc:creator%3eNatalia%20Spivak%3c/dc:creator%3e%3cdc:source%20xsi:type='dcterms:URI'%3ehttps://www.figma.com/community/file/1356575240759683500%3c/dc:source%3e%3cdcterms:license%20xsi:type='dcterms:URI'%3ehttps://creativecommons.org/licenses/by/4.0/%3c/dcterms:license%3e%3cdc:rights%3eRemix%20of%20“Dylan!%20The%20Avatar%20Generator”%20(https://www.figma.com/community/file/1356575240759683500)%20by%20“Natalia%20Spivak”,%20licensed%20under%20“CC%20BY%204.0”%20(https://creativecommons.org/licenses/by/4.0/)%3c/dc:rights%3e%3c/rdf:Description%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%3e%3cg%20id='mood-happy-7dff0831'%3e%3cpath%20d='M.04%2017.04c2.41%209.29%2015.16%2012.28%2022.34%206.67a14%2014%200%200%200%204.7-7.22c.36-1.28-1.57-1.8-1.93-.57-1.24%204.23-4.33%207.4-8.68%208.33-3.77.8-8.03-.1-11.05-2.52a10%2010%200%200%201-3.45-5.26c-.32-1.25-2.25-.72-1.93.53'%20fill='black'/%3e%3c/g%3e%3cg%20id='hair-shortCurls-7dff0831'%3e%3cpath%20d='m15.3%2027.49%201.58%204.38%201.06-9.52s2.27%201.27%203.44-.26.16-3.47.16-3.47%201.81.55%203.31-.8c1.87-1.67%201.26-3.46%201.26-3.46s1.71%201.9%204.5%201.1c2.77-.8%203.14-2.76%203.14-2.76s.56%202.18%203.4%202.12%203.2-2.01%203.2-2.01%200%202.43%202.43%203.14%203.43-1.24%203.43-1.24c0%20.02-.9%202.39.66%203.76%201.44%201.26%203.5.35%203.5.35s-.73%202.3.77%203.62c1.6%201.4%203.48.6%203.48.6l.77%208.34%201.8-3.8s1.4-.13%202.72.15c0%20.01%202.58-2.78%201.15-5.9s-3.64-2.86-3.64-2.86%201.95-3.05.13-5.65-4.94-1.96-4.94-1.96%201.18-3.52-1.68-5.27-5.92.46-5.92.46-.1-3.7-3.2-4.16c-3.26-.48-4.58%202.66-4.58%202.66s-1.35-2.89-4.14-2.44c-2.8.44-3.32%203.53-3.32%203.53S27.32%203.57%2024.92%205s-1.8%204.51-1.8%204.51-2.98-2.24-5.32-.23-.14%205.1-.14%205.1-3.87-1.12-5.04%201.8%201.66%204.95%201.66%204.95-5.35%201.16-2.82%207.33c0%200%20.6-.27%202.02-.62s1.8-.38%201.8-.38z'%20fill='%23000000'/%3e%3c/g%3e%3cclipPath%20id='clip-7dff0831'%3e%3crect%20width='80'%20height='80'%20rx='0'%20ry='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23clip-7dff0831)'%3e%3crect%20width='80'%20height='80'%20fill='%23e5f4ec'/%3e%3cpath%20d='M19.07%2030.47s1.57-20.23%2021.59-20.23S62.3%2030.55%2062.3%2030.55s9.43-.8%209.43%207.6c0%208.42-9.28%207.13-9.28%207.13S60.9%2067.15%2042.03%2067.15c-21.11%200-23.4-20.8-23.4-20.8s-9%20.72-9.93-6.25c-1.08-8.2%2010.37-9.64%2010.37-9.64'%20fill='%23c26450'/%3e%3cpath%20d='m64.3%2039.49.46-.41.1-.09c.12-.1-.13.1-.02.02l.24-.17q.5-.35%201.06-.62l.26-.12.05-.02.05-.02.58-.21q.6-.18%201.2-.28c.52-.08.85-.76.7-1.23-.18-.56-.67-.8-1.23-.7a9.3%209.3%200%200%200-4.87%202.43c-.38.36-.4%201.06%200%201.4.4.36%201%20.4%201.4%200zm-51.8-1.16.14.01c-.27-.02-.11-.01-.04%200l.3.05.52.14.28.09.12.05c.02%200%20.22.09.06.02-.14-.1%200-.04.03-.03l.15.06.26.13.47.3.27.22q.47.38.83.83c.33.4%201.07.37%201.41%200%20.4-.43.36-.98%200-1.4a7.3%207.3%200%200%200-4.84-2.53c-.52-.06-1.02.5-1%201%20.03.59.44.94%201%201m18.3-1.9v4.54c0%20.52.46%201.02%201%201s1-.44%201-1V36.4c0-.52-.46-1.02-1-1s-1%20.44-1%201M49.2%2036l-.15%204.81a1%201%200%200%200%201%201c.56-.02.98-.44%201-1l.15-4.8a1%201%200%200%200-1-1%201%201%200%200%200-1%201'%20fill='black'/%3e%3cuse%20transform='translate(27.82%2026.75)'%20href='%23mood-happy-7dff0831'/%3e%3cuse%20transform='translate(3.78%202.95)'%20href='%23hair-shortCurls-7dff0831'/%3e%3c/g%3e%3c/svg%3e`,rS=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2080%2080'%20fill='none'%20shape-rendering='auto'%20aria-hidden='true'%3e%3c!--%20Generated%20by%20DiceBear%20(https://dicebear.com)%20--%3e%3cmetadata%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:dcterms='http://purl.org/dc/terms/'%3e%3crdf:RDF%3e%3crdf:Description%3e%3cdc:title%3eDylan!%20The%20Avatar%20Generator%3c/dc:title%3e%3cdc:creator%3eNatalia%20Spivak%3c/dc:creator%3e%3cdc:source%20xsi:type='dcterms:URI'%3ehttps://www.figma.com/community/file/1356575240759683500%3c/dc:source%3e%3cdcterms:license%20xsi:type='dcterms:URI'%3ehttps://creativecommons.org/licenses/by/4.0/%3c/dcterms:license%3e%3cdc:rights%3eRemix%20of%20“Dylan!%20The%20Avatar%20Generator”%20(https://www.figma.com/community/file/1356575240759683500)%20by%20“Natalia%20Spivak”,%20licensed%20under%20“CC%20BY%204.0”%20(https://creativecommons.org/licenses/by/4.0/)%3c/dc:rights%3e%3c/rdf:Description%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%3e%3cg%20id='mood-happy-46c131e2'%3e%3cpath%20d='M.04%2017.04c2.41%209.29%2015.16%2012.28%2022.34%206.67a14%2014%200%200%200%204.7-7.22c.36-1.28-1.57-1.8-1.93-.57-1.24%204.23-4.33%207.4-8.68%208.33-3.77.8-8.03-.1-11.05-2.52a10%2010%200%200%201-3.45-5.26c-.32-1.25-2.25-.72-1.93.53'%20fill='black'/%3e%3c/g%3e%3cg%20id='hair-fluffy-46c131e2'%3e%3cpath%20d='M16.45%2029.48s13.74%2023.53%203.86%2028.24C9.05%2063.08-1.2%2048.01.1%2036.77s10.96-16.35%2010.96-16.35-.58-9.5%209.2-15.04c9.78-5.55%2016.64.44%2016.64.44s8.06-5.9%2015.5-1.37c7.46%204.53%207.26%2014.68%207.26%2014.68s13.74-.56%2013.65%2016.47c-.08%2015.17-10.03%2022.94-16.8%2021.6-10.45-2.07%201.27-29.22%201.27-29.22s-14.4%201.04-20.14-9.75c0%200-4%205.95-9.7%208.62a32%2032%200%200%201-11.47%202.64z'%20fill='%231d5dff'/%3e%3c/g%3e%3cclipPath%20id='clip-46c131e2'%3e%3crect%20width='80'%20height='80'%20rx='0'%20ry='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23clip-46c131e2)'%3e%3crect%20width='80'%20height='80'%20fill='%23fbf0d1'/%3e%3cpath%20d='M19.07%2030.47s1.57-20.23%2021.59-20.23S62.3%2030.55%2062.3%2030.55s9.43-.8%209.43%207.6c0%208.42-9.28%207.13-9.28%207.13S60.9%2067.15%2042.03%2067.15c-21.11%200-23.4-20.8-23.4-20.8s-9%20.72-9.93-6.25c-1.08-8.2%2010.37-9.64%2010.37-9.64'%20fill='%23c26450'/%3e%3cpath%20d='m64.3%2039.49.46-.41.1-.09c.12-.1-.13.1-.02.02l.24-.17q.5-.35%201.06-.62l.26-.12.05-.02.05-.02.58-.21q.6-.18%201.2-.28c.52-.08.85-.76.7-1.23-.18-.56-.67-.8-1.23-.7a9.3%209.3%200%200%200-4.87%202.43c-.38.36-.4%201.06%200%201.4.4.36%201%20.4%201.4%200zm-51.8-1.16.14.01c-.27-.02-.11-.01-.04%200l.3.05.52.14.28.09.12.05c.02%200%20.22.09.06.02-.14-.1%200-.04.03-.03l.15.06.26.13.47.3.27.22q.47.38.83.83c.33.4%201.07.37%201.41%200%20.4-.43.36-.98%200-1.4a7.3%207.3%200%200%200-4.84-2.53c-.52-.06-1.02.5-1%201%20.03.59.44.94%201%201m18.3-1.9v4.54c0%20.52.46%201.02%201%201s1-.44%201-1V36.4c0-.52-.46-1.02-1-1s-1%20.44-1%201M49.2%2036l-.15%204.81a1%201%200%200%200%201%201c.56-.02.98-.44%201-1l.15-4.8a1%201%200%200%200-1-1%201%201%200%200%200-1%201'%20fill='black'/%3e%3cuse%20transform='translate(27.82%2026.75)'%20href='%23mood-happy-46c131e2'/%3e%3cuse%20transform='translate(3.78%202.95)'%20href='%23hair-fluffy-46c131e2'/%3e%3c/g%3e%3c/svg%3e`,iS=`/assets/ode-to-joy-SNBUPr3-.svg`,aS=Qx,oS=$x,sS=eS,cS={logoSrc:$x,tuttiAvatarSrc:eS,scoreSrc:iS,humanAvatars:{fey:nS,avery:tS,jun:rS}};function lS({onClick:e}){let t=(0,P.jsx)(Es,{src:oS,label:`Tutti`});return e===void 0?t:(0,P.jsx)(Ds,{logo:t,label:`Tutti Project Center`,onClick:e})}function uS({onClick:e}){return(0,P.jsx)(Ds,{logo:(0,P.jsx)(Es,{src:oS,className:`tutti-logo`}),onClick:e})}var dS=`https://lets.tutti.now`,fS=`${dS}/start/create-a-project#connect-a-provider-and-choose-a-model`,pS={href:dS,target:`_blank`,rel:`noopener noreferrer`};function mS(){return(0,P.jsxs)(dd,{children:[`New to Tutti?`,` `,(0,P.jsx)(`a`,{...pS,"aria-label":`Read the Tutti documentation (opens in a new tab)`,children:`Read the docs`}),`.`]})}function hS(){return(0,P.jsx)(Is,{...pS,label:`Support Center`,icon:(0,P.jsx)(pi,{"aria-hidden":`true`})})}var gS=[Jx,Yx,Xx,Zx];function _S(){return gS[Math.min(gS.length-1,Math.floor(Math.random()*gS.length))]}function vS({backgroundPattern:e,children:t,...n}){let[r]=(0,N.useState)(_S);return(0,P.jsx)(Ho,{...e===void 0?{backgroundImageSrc:r}:{backgroundPattern:e},...n,children:t})}function yS({actions:e,children:t,onBrandClick:n}){return(0,P.jsxs)(vS,{children:[(0,P.jsx)(Uo,{brand:(0,P.jsx)(uS,{onClick:n}),actions:e}),t]})}function bS({children:e,label:t,onBrandClick:n}){return(0,P.jsx)(yS,{onBrandClick:n,children:(0,P.jsx)(Go,{"aria-label":t,children:e})})}function xS({auth:e,mobileAuth:t,onBrandClick:n}){return(0,P.jsx)(vS,{backgroundPattern:`dots`,className:`homepage-entry-page`,children:(0,P.jsx)(ud,{brand:(0,P.jsx)(uS,{onClick:n}),visual:(0,P.jsx)(Gd,{assets:cS}),auth:e,mobileAuth:t,footer:(0,P.jsx)(mS,{})})})}function SS({phase:e,form:t,onChange:n}){return e===`code`?(0,P.jsx)(`div`,{className:`form-stack`,children:(0,P.jsx)(Ms,{label:`Email verification code`,children:(0,P.jsx)(Os,{autoComplete:`one-time-code`,inputMode:`numeric`,type:`text`,value:t.code,onChange:e=>n({code:e.target.value}),placeholder:`Enter email code`,maxLength:6})})}):e===`profile`?(0,P.jsxs)(`div`,{className:`form-stack`,children:[(0,P.jsx)(Ms,{label:`Display name`,children:(0,P.jsx)(Os,{autoComplete:`name`,type:`text`,value:t.displayName,onChange:e=>n({displayName:e.target.value}),placeholder:`username`})}),(0,P.jsx)(`p`,{className:`form-note`,children:`This name cannot be changed yet.`})]}):(0,P.jsx)(`div`,{className:`form-stack`,children:(0,P.jsx)(Ms,{label:`Email`,children:(0,P.jsx)(Os,{autoComplete:`email`,type:`email`,value:t.email,onChange:e=>n({email:e.target.value}),placeholder:`alex@example.com`})})})}function CS({surface:e,phase:t,form:n,pending:r,error:i,submitDisabled:a,submitLabel:o,pendingLabel:s,onChange:c,onSubmit:l,onBack:u}){let d={title:t===`profile`?`Choose display name`:`Sign in`,description:t===`profile`?`Set the name your teammates will see.`:t===`code`?`Enter your email verification code.`:`Use your email to continue.`,onSubmit:l,action:(0,P.jsxs)(bs,{type:`submit`,disabled:a||r,children:[r?s??(t===`profile`?`Saving`:t===`code`?`Verifying`:`Sending code`):o??(t===`profile`?`Save name`:t===`code`?`Verify email code`:`Send code`),(0,P.jsx)(ai,{"aria-hidden":`true`})]}),secondaryAction:t===`code`&&u!==void 0?(0,P.jsxs)(xs,{type:`button`,onClick:u,disabled:r,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Change email`]}):void 0,feedback:i===null?void 0:(0,P.jsx)(Ns,{children:i}),children:(0,P.jsx)(SS,{phase:t,form:n,onChange:c})};return e===`card`?(0,P.jsx)(ef,{...d}):(0,P.jsx)(fd,{...d})}function wS(e){return(0,P.jsx)(CS,{...e,surface:`card`})}function TS(e){return(0,P.jsx)(CS,{...e,surface:`rail`})}function ES({onBrandClick:e,...t}){return(0,P.jsx)(xS,{onBrandClick:e,auth:(0,P.jsx)(TS,{...t}),mobileAuth:(0,P.jsx)(wS,{...t})})}function DS({nextKind:e,actionPending:t,loginForm:n,onRetry:r,onAccept:i,onOpen:a}){if(e===`loading`)return(0,P.jsx)(xs,{type:`button`,disabled:!0,children:`Loading`});if(e===`error`)return(0,P.jsx)(xs,{type:`button`,onClick:r,children:`Retry`});if(e===`invalid_or_expired`)return(0,P.jsxs)(xs,{type:`button`,disabled:!0,children:[(0,P.jsx)(ta,{"aria-hidden":`true`}),`Invalid invite`]});if(e===`login_required`){let e=n?.phase===`profile`?`Save name`:n?.phase===`code`?`Verify email code`:`Send code`,r=n?.phase===`profile`?`Saving`:n?.phase===`code`?`Verifying`:`Sending code`;return(0,P.jsxs)(bs,{type:`submit`,disabled:t||n?.submitDisabled===!0,children:[t?r:e,(0,P.jsx)(ai,{"aria-hidden":`true`})]})}return e===`accept_join`?(0,P.jsxs)(bs,{type:`button`,disabled:t,onClick:i,children:[t?`Joining`:`Accept and open workspace`,(0,P.jsx)(ai,{"aria-hidden":`true`})]}):e===`open_workspace`?(0,P.jsxs)(bs,{type:`button`,disabled:t,onClick:a,children:[t?`Opening`:`Open workspace`,(0,P.jsx)(ai,{"aria-hidden":`true`})]}):(0,P.jsxs)(xs,{type:`button`,disabled:!0,children:[(0,P.jsx)(Vi,{"aria-hidden":`true`}),`Host offline`]})}function OS({nextKind:e,error:t}){return e===`loading`?null:e===`error`?(0,P.jsx)(ia,{tone:`error`,icon:(0,P.jsx)(ta,{"aria-hidden":`true`}),children:t??`Invite unavailable`}):e===`invalid_or_expired`?(0,P.jsx)(ia,{tone:`error`,icon:(0,P.jsx)(ta,{"aria-hidden":`true`}),children:`Join token is invalid or expired`}):e===`host_offline`?(0,P.jsx)(ia,{tone:`warning`,icon:(0,P.jsx)(Vi,{"aria-hidden":`true`}),children:`Host is offline`}):null}function kS({projectName:e,description:t,hostLabel:n,hostOnline:r,nextKind:i,accountLabel:a,membershipLabel:o,actionPending:s,error:c,loginForm:l,onBrandClick:u,onRetry:d,onAccept:f,onOpen:p}){let m=i===`login_required`&&l!==void 0;return(0,P.jsx)(bS,{label:`Join project`,onBrandClick:u,children:(0,P.jsxs)(ef,{title:`Join project`,description:t,onSubmit:e=>{if(m){l.onSubmit(e);return}e.preventDefault()},action:(0,P.jsx)(DS,{nextKind:i,actionPending:m?l.pending:s,...m?{loginForm:l}:{},onAccept:f,onOpen:p,...d===void 0?{}:{onRetry:d}}),secondaryAction:m&&l.phase===`code`&&l.onBack!==void 0?(0,P.jsxs)(xs,{type:`button`,onClick:l.onBack,disabled:l.pending,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Change email`]}):void 0,feedback:(0,P.jsxs)(P.Fragment,{children:[m&&l.error!==null?(0,P.jsx)(Ns,{children:l.error}):null,(0,P.jsx)(OS,{nextKind:i,error:c}),c===null||i===`error`?null:(0,P.jsx)(Ns,{children:c})]}),children:[(0,P.jsx)(tf,{projectName:e,hostLabel:n,hostOnline:r}),m?(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(SS,{phase:l.phase,form:l.form,onChange:l.onChange})}):(0,P.jsx)(nf,{label:a===null?`Account`:`Signed in as`,value:a??`Sign in required`,action:o===null?null:(0,P.jsx)(`span`,{className:`quiet-link`,children:o})})]})})}function AS(e){switch(e.status){case`online`:return`Online`;case`reconnecting`:return`Reconnecting`;case`relay-unavailable`:return`Relay unavailable`;case`stale`:return`Needs restart`;case`stopped`:return`Stopped`;case`workspace-missing`:return`Folder missing`;case`workspace-replaced`:return`Folder changed`;case`invalid`:return`Needs attention`}}function jS(e){return(e.status===`online`||e.status===`reconnecting`)&&e.provider_status===`configured`}function MS(e){return(e.status===`stopped`||e.status===`stale`||e.status===`relay-unavailable`)&&e.provider_status===`configured`}function NS(e,t){let n=Date.parse(e.activity_at??``),r=Date.parse(t.activity_at??``),i=Number.isNaN(n)?0:n;return(Number.isNaN(r)?0:r)-i||e.display_name.localeCompare(t.display_name,`en`)||e.project_id.localeCompare(t.project_id,`en`)}function PS(e){return e.provider_status===`configured`?e.provider_model?.trim()||`Provider ready`:e.provider_status===`invalid`?`Provider issue`:`Provider needed`}function FS({project:e,pending:t,onLaunch:n,onOpen:r,onCopyInvite:i,onStop:a}){return e.status===`online`||e.status===`reconnecting`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(bs,{type:`button`,disabled:t||e.open_url===void 0,onClick:r,children:[(0,P.jsx)(yi,{"aria-hidden":`true`}),`Open`]}),(0,P.jsxs)(xs,{type:`button`,disabled:t,onClick:i,children:[(0,P.jsx)(Ai,{"aria-hidden":`true`}),`Invite`]}),(0,P.jsxs)(xs,{type:`button`,disabled:t,onClick:a,children:[(0,P.jsx)(Zi,{"aria-hidden":`true`}),`Stop`]})]}):(0,P.jsxs)(xs,{type:`button`,disabled:t||!MS(e),onClick:n,children:[(0,P.jsx)(Ui,{"aria-hidden":`true`}),`Resume`]})}function IS({form:e,models:t,projects:n,projectsLoading:r,sessionLoading:i,sessionError:a,createOpen:o,createStep:s,modelDiscoveryPending:c,launchPending:l,projectActionPending:u,packageUpdateAction:d,onChange:f,onCreateOpenChange:p,onCreateSubmit:m,onCreateBack:h,onChooseFolder:g,onRefresh:_,onLaunchExisting:v,onOpenProject:y,onCopyInvite:b,onStopProject:x,onPackageUpdate:S}){let C=[`Folder`,`Details`,`Provider`,`Model`],w=C.findIndex(e=>e.toLowerCase()===s),T=c||l,E=s===`folder`?e.workspacePath.trim()!==``:s===`details`?e.displayName.trim()!==``:s===`provider`?e.baseUrl.trim()!==``&&e.apiKey.trim()!==``:t.length>0&&e.model.trim()!==``,ee=n.filter(jS).sort(NS),D=n.filter(MS).sort(NS),O=n.filter(e=>!jS(e)&&!MS(e)).sort(NS),k=e=>(0,P.jsx)(Sf,{title:e.display_name,statusLabel:AS(e),online:e.status===`online`,path:e.workspace_path,createdLabel:Qn(e.created_at),providerLabel:PS(e),providerStatus:e.provider_status,actions:(0,P.jsx)(FS,{project:e,pending:u===e.project_id,onLaunch:()=>v(e),onOpen:()=>y(e),onCopyInvite:()=>b(e),onStop:()=>x(e)})},e.project_id);return(0,P.jsx)(yS,{onBrandClick:_,children:(0,P.jsxs)(Wo,{children:[(0,P.jsxs)(rf,{className:`local-console-card`,title:`Local projects`,accountAction:(0,P.jsxs)(P.Fragment,{children:[d===void 0?null:(0,P.jsx)(af,{description:d.description,descriptionId:`local-console-package-update-description`,disabledTrigger:d.disabled,"aria-live":`polite`,action:(0,P.jsx)(xs,{type:`button`,disabled:d.disabled,onClick:S,children:d.label})}),(0,P.jsx)(ys,{type:`button`,label:`Refresh projects`,icon:(0,P.jsx)(Hi,{"aria-hidden":`true`}),disabled:r,onClick:_}),(0,P.jsxs)(bs,{type:`button`,disabled:i||a!==null,onClick:()=>p(!0),children:[(0,P.jsx)(Bi,{"aria-hidden":`true`}),`New project`]})]}),"aria-label":`Tutti Local Console`,children:[r||i?(0,P.jsx)(df,{"aria-label":`Machine projects`,children:(0,P.jsx)(mf,{"aria-label":`Loading local projects`,children:(0,P.jsx)(aa,{})})}):a===null?n.length===0?(0,P.jsx)(df,{"aria-label":`Machine projects`,children:(0,P.jsx)(mf,{children:(0,P.jsx)(ia,{children:`Create your first local project.`})})}):null:(0,P.jsx)(df,{"aria-label":`Machine projects`,children:(0,P.jsx)(mf,{children:(0,P.jsx)(ia,{children:a})})}),r||i||n.length===0?null:(0,P.jsxs)(P.Fragment,{children:[ee.length===0?null:(0,P.jsx)(bf,{title:`Available`,"aria-label":`Available projects`,children:ee.map(k)}),D.length===0?null:(0,P.jsx)(bf,{title:`Ready to resume`,"aria-label":`Projects ready to resume`,children:D.map(k)}),O.length===0?null:(0,P.jsx)(xf,{children:O.map(k)})]})]}),(0,P.jsxs)(gf,{open:o,onOpenChange:p,steps:C,currentStep:Math.max(0,w),closeDisabled:T,explicitCloseOnly:!0,onSubmit:m,backAction:s===`folder`?void 0:(0,P.jsxs)(xs,{type:`button`,disabled:T,onClick:h,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Back`]}),action:(0,P.jsxs)(bs,{type:`submit`,disabled:!E||T||i,children:[s===`model`?(0,P.jsx)(Ui,{"aria-hidden":`true`}):(0,P.jsx)(ai,{"aria-hidden":`true`}),s===`provider`&&c?`Checking provider`:s===`model`?l?`Launching`:`Launch and continue`:`Continue`]}),children:[s===`folder`?(0,P.jsx)(yf,{title:`Project folder`,description:`Choose an existing folder on this machine. It can be empty or contain an existing project.`,children:(0,P.jsxs)(vf,{children:[(0,P.jsx)(Os,{"aria-label":`Project folder`,autoComplete:`off`,value:e.workspacePath,onChange:e=>f({workspacePath:e.target.value}),placeholder:`Enter an absolute project folder path`,autoFocus:!0}),(0,P.jsxs)(xs,{type:`button`,onClick:g,children:[(0,P.jsx)(wi,{"aria-hidden":`true`}),`Choose folder`]})]})}):null,s===`details`?(0,P.jsx)(yf,{title:`Project details`,description:`Describe what you want to build with this project.`,children:(0,P.jsxs)(_f,{children:[(0,P.jsx)(Ms,{label:`Project name`,className:`local-console-field-wide`,children:(0,P.jsx)(Os,{autoComplete:`off`,value:e.displayName,maxLength:80,onChange:e=>f({displayName:e.target.value}),placeholder:`Enter a project name`,autoFocus:!0})}),(0,P.jsx)(Ms,{label:`Project description (optional)`,className:`local-console-field-wide`,children:(0,P.jsx)(ks,{value:e.description,maxLength:160,onChange:e=>f({description:e.target.value}),placeholder:`A short project description helps Tutti produce better code`})})]})}):null,s===`provider`?(0,P.jsx)(yf,{title:`Provider`,description:(0,P.jsxs)(P.Fragment,{children:[`Enter an endpoint compatible with the`,` `,(0,P.jsx)(Ps,{href:fS,"aria-label":`Tutti Responses API provider guide (opens in a new tab)`,icon:(0,P.jsx)(pi,{"aria-hidden":`true`}),children:`OpenAI Responses API`}),`. Credentials stay only on this machine.`]}),children:(0,P.jsxs)(_f,{children:[(0,P.jsx)(Ms,{label:`Base URL`,children:(0,P.jsx)(Os,{autoComplete:`off`,inputMode:`url`,type:`url`,value:e.baseUrl,onChange:e=>f({baseUrl:e.target.value}),placeholder:`Enter Provider Base URL`,autoFocus:!0})}),(0,P.jsx)(Ms,{label:`API key`,children:(0,P.jsx)(Os,{autoComplete:`off`,type:`password`,value:e.apiKey,onChange:e=>f({apiKey:e.target.value}),placeholder:`Enter API key`})})]})}):null,s===`model`?(0,P.jsx)(yf,{title:`Model`,description:`Choose an available model or type another model name.`,children:(0,P.jsx)(Ms,{label:`Model`,children:(0,P.jsx)(As,{autoComplete:`off`,value:e.model,options:t,maxVisibleOptions:8,onValueChange:e=>f({model:e}),placeholder:`Choose or enter a model`,autoFocus:!0})})}):null]})]})})}function LS({onBrandClick:e,sessionError:t=null,...n}){let r={...n,error:n.error??t};return(0,P.jsx)(xS,{onBrandClick:e,auth:(0,P.jsx)(TS,{...r}),mobileAuth:(0,P.jsx)(wS,{...r})})}function RS({account:e,projects:t,loading:n,error:r,openPending:i,logoutPending:a,joinLinkForm:o,launchExpanded:s,onLaunch:c,onCopyLaunchCommand:l,onBrandClick:u,onLogout:d,onOpenProject:f}){let p=t.filter(e=>e.hostStatus===`offline`),m=t.filter(e=>e.hostStatus!==`offline`),h=e=>(0,P.jsx)(pf,{title:e.displayName,statusLabel:`Host ${e.hostStatusLabel.toLowerCase()}`,online:e.canOpen,details:[{label:`Role`,value:e.membershipLabel},{label:`Opened`,value:e.lastOpenedLabel}],disabled:!e.canOpen||i,onClick:()=>f(e.relayProjectRef)},e.relayProjectRef);return(0,P.jsx)(yS,{onBrandClick:u,children:(0,P.jsx)(Wo,{children:(0,P.jsxs)(rf,{title:`Projects`,...e===null?{}:{accountName:e.displayName,accountAction:(0,P.jsxs)(xs,{type:`button`,onClick:d,disabled:a,children:[(0,P.jsx)(Ni,{"aria-hidden":`true`}),`Sign out`]})},"aria-label":`Project Center`,children:[(0,P.jsxs)(of,{children:[(0,P.jsx)(cf,{title:`Join a project`,description:`Paste an invitation link or the full invitation message.`,inputLabel:`Invitation link or message`,placeholder:`Paste an invitation link or message`,value:o.value,error:o.error,onValueChange:o.onChange,"aria-label":`Join a project`,onSubmit:e=>{e.preventDefault(),o.onSubmit()}}),(0,P.jsx)(lf,{title:`Launch from your computer`,description:`Open Tutti on this computer to create or manage local projects.`,actionHref:`tutti://projects`,expanded:s,statusTitle:`Opening the Tutti app…`,statusDescription:`If Tutti is not installed, copy this command and run it in Terminal:`,command:`npm install -g @xfey/tutti && tutti`,onAction:c,onCopyCommand:l,"aria-label":`Launch a project from your computer`})]}),n?(0,P.jsx)(df,{children:(0,P.jsx)(mf,{"aria-label":`Loading projects`,children:(0,P.jsx)(aa,{})})}):r===null?(0,P.jsxs)(P.Fragment,{children:[m.length===0?(0,P.jsx)(df,{children:(0,P.jsx)(mf,{"aria-label":`No available projects`,children:(0,P.jsx)(ia,{children:`No available projects`})})}):(0,P.jsx)(df,{children:m.map(h)}),p.length===0?null:(0,P.jsx)(ff,{title:`Offline Projects`,listLabel:`Offline projects`,className:`project-center-offline-projects`,children:p.map(h)})]}):(0,P.jsx)(df,{children:(0,P.jsx)(mf,{"aria-label":`Project Center error`,children:(0,P.jsx)(ia,{tone:`error`,children:r})})})]})})})}function zS({form:e,pending:t,tokenMissing:n,onChange:r}){return(0,P.jsxs)(`div`,{className:`form-stack`,children:[(0,P.jsx)(Ms,{label:`Project name`,children:(0,P.jsx)(Os,{autoComplete:`off`,disabled:t||n,type:`text`,value:e.projectName,onChange:e=>r({projectName:e.target.value}),placeholder:`tutti-default`})}),(0,P.jsx)(Ms,{label:`OpenAI API key`,children:(0,P.jsx)(Os,{autoComplete:`off`,disabled:t||n,type:`password`,value:e.apiKey,onChange:e=>r({apiKey:e.target.value}),placeholder:`sk-...`})}),(0,P.jsx)(Ms,{label:`Base URL`,children:(0,P.jsx)(Os,{autoComplete:`off`,disabled:t||n,type:`url`,value:e.baseUrl,onChange:e=>r({baseUrl:e.target.value}),placeholder:`https://api.openai.com/v1`})}),(0,P.jsx)(Ms,{label:`Default model`,children:(0,P.jsx)(Os,{autoComplete:`off`,disabled:t||n,type:`text`,value:e.defaultModel,onChange:e=>r({defaultModel:e.target.value}),placeholder:`gpt-5.5`})})]})}function BS({form:e,statusLabel:t,configured:n,loading:r,pending:i,openProjectPending:a=!1,tokenMissing:o,error:s,success:c,onChange:l,onSubmit:u,onRetry:d,onBrandClick:f}){let p=i||a;return(0,P.jsx)(bS,{label:`Project setup`,onBrandClick:f,children:(0,P.jsxs)(ef,{title:`Project setup`,description:`Configure the provider for this project.`,size:`wide`,onSubmit:u,action:o?(0,P.jsxs)(xs,{type:`button`,disabled:!0,children:[(0,P.jsx)(ta,{"aria-hidden":`true`}),`Missing token`]}):s!==null&&r?(0,P.jsx)(xs,{type:`button`,onClick:d,children:`Retry`}):a?(0,P.jsxs)(xs,{type:`button`,disabled:!0,children:[(0,P.jsx)(ai,{"aria-hidden":`true`}),`Opening project`]}):(0,P.jsxs)(bs,{type:`submit`,disabled:i||e.apiKey.trim()===``||e.projectName.trim()===``,children:[i?`Saving`:`Save provider`,(0,P.jsx)(Wi,{"aria-hidden":`true`})]}),feedback:(0,P.jsxs)(P.Fragment,{children:[c===null?null:(0,P.jsx)(ia,{icon:(0,P.jsx)(fi,{"aria-hidden":`true`}),children:c}),s===null?null:(0,P.jsx)(Ns,{children:s})]}),children:[(0,P.jsx)(tf,{projectName:`OpenAI provider`,hostLabel:t,hostOnline:n,members:(0,P.jsx)(Oi,{"aria-hidden":`true`})}),(0,P.jsx)(nf,{label:`Status`,value:r?`Loading`:t,action:n?(0,P.jsx)(fi,{"aria-hidden":`true`}):null}),(0,P.jsx)(zS,{form:e,pending:p,tokenMissing:o,onChange:l})]})})}var VS=`http://127.0.0.1:4370`;function HS(){return typeof window<`u`&&window.location.port!==`4372`?window.location.origin:VS}function US(e){try{return new URL(e,HS()).toString()}catch{return e}}function WS({avatar:e,label:t,plain:n=!1,online:r=!1}){return(0,P.jsx)(Jo,{label:t,tone:e.color,plain:n,online:r,initials:e.initials,...e.kind===`image`?{imageUrl:US(e.image_url)}:{}})}function GS({label:e=`Tutti`}){return(0,P.jsx)(Jo,{label:e,tone:`green`,className:`is-system`,imageUrl:sS,icon:(0,P.jsx)(si,{"aria-hidden":`true`})})}function KS({tone:e}){return e===`pending`?(0,P.jsx)(ta,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(mi,{"aria-hidden":`true`}):e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):(0,P.jsx)(Mi,{"aria-hidden":`true`})}function qS({members:e}){return e===void 0||e.length===0?null:(0,P.jsx)(Yo,{"aria-label":`Members`,children:e.map(e=>(0,P.jsx)(WS,{avatar:e.avatar,label:e.displayName},e.key))})}function JS({activePage:e,statusShortcuts:t,unread:n,artifactSignal:r,mobileContext:i,children:a,onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenTimeline:f,onOpenSettings:p,onActivateStatusShortcut:m,getStatusShortcutAriaControls:h}){let g=e!==`chat`&&n?.chat===!0,_=e!==`worklist`&&n?.worklist===!0,v=r?.status===`live`,y=e!==`references`&&n?.references===!0,b=e!==`skills`&&n?.skills===!0;return(0,P.jsx)(Ko,{children:(0,P.jsx)(qo,{className:`is-headerless`,sidebar:(0,P.jsxs)(Fs,{brand:(0,P.jsx)(lS,{...o===void 0?{}:{onClick:o}}),mobileTitle:i.title,...i.meta===void 0?{}:{mobileMeta:i.meta},...i.action===void 0?{}:{mobileAction:i.action},...t.length===0?{}:{status:t.map(e=>(0,N.createElement)(Rs,{icon:(0,P.jsx)(KS,{tone:e.tone}),label:e.label,tone:e.tone,onClick:()=>m?.(e),...h?.(e)===void 0?{}:{"aria-controls":h(e)},key:e.key}))},footer:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(hS,{}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(Ki,{"aria-hidden":`true`}),label:`Settings`,active:e===`settings`,onClick:e===`settings`?void 0:p})]}),children:[(0,P.jsx)(Ls,{icon:(0,P.jsx)(Ay,{"aria-hidden":`true`}),label:`Chat`,active:e===`chat`,badge:g?{label:`Unread messages`}:!1,onClick:e===`chat`?void 0:s}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(ji,{"aria-hidden":`true`}),label:`Worklist`,active:e===`worklist`,badge:_?{label:`Unread worklist updates`}:!1,onClick:e===`worklist`?void 0:c}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(Li,{"aria-hidden":`true`}),label:`Artifacts`,active:e===`artifacts`,badge:v?{label:`Live preview available`,text:`Live`,variant:`pill`}:!1,onClick:e===`artifacts`?void 0:u}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(Si,{"aria-hidden":`true`}),label:`References`,active:e===`references`,badge:y?{label:`New reference files`}:!1,onClick:e===`references`?void 0:l}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(Yi,{"aria-hidden":`true`}),label:`Skills`,active:e===`skills`,badge:b?{label:`New skill updates`}:!1,onClick:e===`skills`?void 0:d}),(0,P.jsx)(Ls,{icon:(0,P.jsx)(ci,{"aria-hidden":`true`}),label:`Timeline`,active:e===`timeline`,onClick:e===`timeline`?void 0:f})]}),children:a})})}function YS(){return(0,P.jsx)(Es,{src:oS,className:`empty-state-brand-logo`})}function XS(e){return(0,P.jsx)(ia,{watermark:(0,P.jsx)(YS,{}),...e})}var ZS=`tutti.execution-score-themes.v1`,QS=40,$S={assignments:[],bag:[]};function eC(){return{assignments:[],bag:[]}}function tC(){try{return typeof window>`u`?null:window.sessionStorage}catch{return null}}function nC(e,t){if(typeof e!=`object`||!e)return null;let n=e;if(!Array.isArray(n.assignments)||!Array.isArray(n.bag))return null;let r=n.assignments.filter(e=>typeof e==`object`&&!!e&&typeof e.identity==`string`&&t.has(String(e.themeId))),i=n.bag.filter(e=>typeof e==`string`&&t.has(e)),a=typeof n.recent==`string`&&t.has(n.recent)?n.recent:void 0;return{assignments:r,bag:i,...a===void 0?{}:{recent:a}}}function rC(e,t){if(e===null)return $S;try{let n=e.getItem(ZS);return n===null?eC():nC(JSON.parse(n),t)??eC()}catch{return $S}}function iC(e,t){if($S=t,e!==null)try{e.setItem(ZS,JSON.stringify(t))}catch{}}function aC(e,t,n){let r=e.map(e=>e.id);for(let e=r.length-1;e>0;--e){let t=Math.min(e,Math.max(0,Math.floor(n()*(e+1))));[r[e],r[t]]=[r[t],r[e]]}if(r.length>1&&r[0]===t){let e=r.findIndex(e=>e!==t);[r[0],r[e]]=[r[e],r[0]]}return r}function oC(e,t={}){let n=t.themes??Bo;if(n.length===0)throw Error(`Execution score themes are unavailable`);let r=new Map(n.map(e=>[e.id,e])),i=new Set(r.keys()),a=t.storage===void 0?tC():t.storage,o=rC(a,i),s=o.assignments.find(t=>t.identity===e),c=s===void 0?void 0:r.get(s.themeId);if(c!==void 0)return c;let l=t.random??Math.random,u=o.bag.length>0?[...o.bag]:aC(n,o.recent,l),d=u.shift(),f=d===void 0?void 0:r.get(d);if(f===void 0)throw Error(`Execution score themes are unavailable`);return iC(a,{assignments:[...o.assignments,{identity:e,themeId:f.id}].slice(-QS),bag:u,recent:f.id}),f}function sC(e){return`round-card-${e}`}function cC(e){return`approval-card-${e}`}function lC(e){return`chat-message-${e}`}var uC=`workspace-scratchpad`,dC=720,fC=80,pC=160,mC=96,hC=160,gC=2;function _C(e){return e.completionSource?.activityRef??e.completionSource?.workflowRef??e.completionSource?.taskId??e.key}function vC({progress:e}){let t=_C(e),[n]=(0,N.useState)(()=>oC(t)),r=(0,N.useRef)(t),i=(0,N.useRef)(e.tone),[a,o]=(0,N.useState)(null);if((0,N.useEffect)(()=>{let n=r.current,a=i.current;if(r.current=t,i.current=e.tone,e.tone!==`running`||a===`pending`||n===t){o(null);return}o(t);let s=window.setTimeout(()=>{o(e=>e===t?null:e)},dC);return()=>{window.clearTimeout(s)}},[e.tone,t]),e.tone===`running`||e.tone===`pending`||e.tone===`complete`){let r=e.tone===`running`&&a===t,i=e.steps.find(e=>e.status===`running`||e.status===`pending`)??e.steps.at(-1),o=e.completionTarget?.kind===`task`?`Task completed`:`Procedure completed`,s=e.tone===`complete`?void 0:i?.detail??(e.tone===`pending`?e.summary:void 0),c=e.tone===`complete`?void 0:i?.elapsedLabel,l=e.tone===`complete`?void 0:i?.metrics;return(0,P.jsx)(So,{stageLabel:r?`Loading the next movement…`:e.tone===`complete`?o:i?.label??e.summary,...r||s===void 0?{}:{stageDetail:s},...r||c===void 0?{}:{elapsedLabel:c},...r||l===void 0?{}:{metrics:l},scoreLabel:r?`Loading the next movement score`:e.tone===`complete`?`${o} score cadence`:e.tone===`pending`?`Execution score paused while waiting for input`:`${i?.label??`Execution`} running score using ${n.shortName}`,state:r?`handoff`:e.tone===`complete`?`complete`:e.tone===`pending`?`paused`:`running`,units:n.units,playbackBpm:n.tempo,openingClef:n.clef,keySignatureFifths:n.keySignatureFifths,timeSignature:n.meter})}return(0,P.jsx)(ib,{title:e.title,summary:e.summary,tone:e.tone,steps:e.steps,...e.metaLabel===void 0?{}:{metaLabel:e.metaLabel}})}function yC(e){if(e===void 0)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function bC(e,t){if(e===null)return null;let n=yC(e.requestedAt);if(n===null)return t.length;let r=t.findIndex(e=>{let t=yC(e.createdAt);return t!==null&&t>n});return r===-1?t.length:r}function xC(e,{focusSelector:t}={}){let n=typeof document>`u`?null:document.getElementById(e);n!==null&&(n.scrollIntoView({block:`center`}),t!==void 0&&n.querySelector(t)?.focus({preventScroll:!0}))}function SC(e){return e.messageKind===`system_notice`&&e.workflowRef!==void 0&&(e.body.startsWith(`Worklist updated with `)||e.body===`Worklist is already covered by existing tasks.`)}function CC(e,t){if(t===void 0)return;let n=t.label.trim(),r=t.handle?.trim()??n;if(n===``||r===``)return;let i=r.toLocaleLowerCase();e.has(i)||e.set(i,{id:t.id,label:n,handle:r})}function wC({members:e,messages:t,clarificationMessagesByRoundId:n}){let r=new Map;CC(r,{id:`tutti`,label:`Tutti`,handle:`tutti`});for(let t of e)CC(r,{id:t.key,label:t.displayName});for(let e of t)CC(r,{id:`message:${e.author}`,label:e.author,...e.avatarKind===`tutti`?{handle:`tutti`}:{}});for(let e of Object.values(n))for(let t of e)CC(r,{id:`round-message:${t.author}`,label:t.author,...t.avatarKind===`tutti`?{handle:`tutti`}:{}});return[...r.values()]}function TC({message:e}){return e.avatarKind===`tutti`?(0,P.jsx)(GS,{label:e.author}):(0,P.jsx)(WS,{avatar:e.avatar??{kind:`initials`,initials:dr(e.author),color:`blue`},label:e.author,online:e.online})}function EC({projectName:e,projectDescription:t=``,members:n,messages:r,scratchpad:i,executionProgress:a=null,activeApproval:o=null,activeClarification:s,clarificationMessagesByRoundId:c,statusShortcuts:l,unread:u,artifactSignal:d,draft:f,roundDraft:p,sendPending:m,scratchpadSyncPending:h=!1,scratchpadActionsDisabled:g=!1,scratchpadSubmitPending:_=!1,referenceUploadPending:v=!1,focusMessageId:y=null,messageHistoryIdentity:b=`latest`,initialMessagePosition:x=y===null?`latest`:`focus`,hasOlderMessages:S=!1,hasNewerMessages:C=!1,loadingOlderMessages:w=!1,loadingNewerMessages:T=!1,historyConnectedToLatest:E=!0,roundSendPending:ee=!1,roundSubmitPending:D=!1,submittedRoundId:O=null,approvalDecisionPending:k=!1,projectNameSaving:te=!1,projectDescriptionSaving:ne=!1,loading:A=!1,unavailable:re=!1,onDraftChange:ie,onMessageFocused:j,onInitialMessagePositioned:M,onLoadOlderMessages:ae,onLoadNewerMessages:oe,onJumpToLatest:se,onUploadReferenceFile:ce,onOpenReferenceFile:le,onRoundDraftChange:ue,onSendMessage:de,onSendRoundMessage:fe,onSubmitRound:pe,onDecideApproval:me,onSubmitScratchpad:he,onUpdateProjectDisplayName:ge,onUpdateProjectDescription:_e,onOpenProjectCenter:ve,onOpenWorklist:ye,onOpenWorklistTask:be,onOpenReferences:xe,onOpenArtifacts:Se,onOpenSkills:Ce,onOpenTimeline:we,onOpenSettings:Te,onActivateStatusShortcut:Ee}){let[De,Oe]=(0,N.useState)(!1),ke=(0,N.useRef)(null),Ae=(0,N.useRef)(!1),je=(0,N.useRef)(null),Me=(0,N.useRef)(null),Ne=(0,N.useRef)(!0),Pe=(0,N.useRef)(void 0),Fe=(0,N.useRef)(b),Ie=(0,N.useRef)(null),Le=(0,P.jsx)(Ky,{className:`chat-project-title-edit`,value:e,placeholder:`Untitled project`,ariaLabel:`Edit project name`,maxLength:fC,saving:te,disabled:A,...ge===void 0?{}:{onUpdate:ge}}),Re=(0,P.jsx)(Ky,{className:`chat-project-description-edit`,value:t,placeholder:`Add a project description`,ariaLabel:`Edit project description`,maxLength:pC,allowEmpty:!0,saving:ne,disabled:A,..._e===void 0?{}:{onUpdate:_e}}),ze=s!==null&&r.some(e=>e.id===s.cardMessageId),Be=new Map;for(let e of r)e.clarificationCard!==void 0&&e.workflowRef!==void 0&&Be.set(e.workflowRef,e.clarificationCard.roundId);let Ve=new Map;for(let e of r){if(!SC(e)||e.workflowRef===void 0)continue;let t=Be.get(e.workflowRef);t!==void 0&&Ve.set(t,{...e,id:`round-result:${e.id}`,messageKind:`agent_text`,author:`Tutti`,avatarKind:`tutti`,online:!1})}let He=e=>{let t=c[e]??[],n=Ve.get(e);return n===void 0||t.some(e=>e.body===n.body)?t:[...t,n]},Ue=wC({members:n,messages:r,clarificationMessagesByRoundId:c}),We=ce===void 0?void 0:e=>{for(let t of e)ce(t)};(0,N.useLayoutEffect)(()=>{Fe.current!==b&&(Fe.current=b,Ae.current=!1,je.current=null,Pe.current=void 0)},[b]),(0,N.useLayoutEffect)(()=>{let e=je.current;if(e!==null){if(r[0]?.id!==e.firstMessageId){let t=ke.current;t!==null&&(t.scrollTop=e.scrollTop+Math.max(0,t.scrollHeight-e.scrollHeight),Ne.current=t.scrollHeight-t.clientHeight-t.scrollTop<=gC),je.current=null;return}w||(je.current=null)}},[w,r]),(0,N.useEffect)(()=>{if(y===null||!r.some(e=>e.id===y))return;Ae.current=!0,xC(lC(y));let e=ke.current;e!==null&&(Ne.current=e.scrollHeight-e.clientHeight-e.scrollTop<=gC),j?.()},[y,r,j]),(0,N.useEffect)(()=>{if(Ae.current||A||re||x!==`latest`||y!==null||r.length===0&&s===null&&o===null)return;let e=ke.current;if(e===null)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight,Ne.current=!0,Ae.current=!0});return()=>window.cancelAnimationFrame(t)},[o,s,y,A,r,re]),(0,N.useEffect)(()=>{if(Ae.current||A||re||x!==`start`||y!==null)return;let e=ke.current;if(e===null)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=0,Ne.current=e.scrollHeight<=e.clientHeight+gC,Ae.current=!0,M?.()});return()=>window.cancelAnimationFrame(t)},[y,x,A,r,M,re]);let Ge=()=>{if(!S||w||je.current!==null||ae===void 0)return;let e=ke.current;e!==null&&(je.current={firstMessageId:r[0]?.id,scrollHeight:e.scrollHeight,scrollTop:e.scrollTop},ae())},Ke=()=>{!C||T||oe===void 0||oe()},qe=e=>{let t=e.currentTarget;Ne.current=t.scrollHeight-t.clientHeight-t.scrollTop<=gC,Me.current!==null&&window.cancelAnimationFrame(Me.current),Me.current=window.requestAnimationFrame(()=>{if(Me.current=null,t.scrollTop<=mC){Ge();return}t.scrollHeight-t.clientHeight-t.scrollTop<=hC&&Ke()})};(0,N.useEffect)(()=>()=>{Me.current!==null&&window.cancelAnimationFrame(Me.current)},[]),(0,N.useEffect)(()=>{if(A||re||w||T||!Ae.current)return;let e=ke.current;if(e===null||e.scrollHeight>e.clientHeight+gC)return;let t=window.requestAnimationFrame(()=>{S?Ge():C&&Ke()});return()=>window.cancelAnimationFrame(t)},[C,S,A,T,w,r,re]);let Je=r.at(-1)?.id;(0,N.useEffect)(()=>{let e=Pe.current;if(Pe.current=Je,e===void 0||e===Je||!E||!Ne.current||!Ae.current||je.current!==null)return;let t=ke.current;if(t===null)return;let n=window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight,Ne.current=!0});return()=>window.cancelAnimationFrame(n)},[E,Je]);let Ye=({key:e,roundId:t,title:n,summary:r,request:i,contextLabel:a,writable:o})=>{let s=He(t),c=s.filter(e=>e.messageKind===`user_text`).length;return(0,P.jsx)(fb,{id:sC(t),tabIndex:-1,title:n,summary:r,request:i,...a===void 0?{}:{contextLabel:a},messages:s.map(e=>({id:e.id,author:e.author,body:e.body,time:e.time,avatar:(0,P.jsx)(TC,{message:e})})),replyCount:c,draft:o?p:``,defaultOpen:!0,readOnly:!o,status:o?`pending`:`done`,statusLabel:o?`needs input`:`submitted`,mentionOptions:Ue,sendPending:o&&ee,submitPending:o&&D,onDraftChange:ue,onSendMessage:fe,onSubmitRound:pe},`${e}:${o?`writable`:`sealed`}`)},Xe=e=>{if(e.target.kind===`approval`&&o!==null){if(!E){Ie.current=e,se?.();return}xC(cC(o.approvalId),{focusSelector:`.chat-event-card-header`});return}if(e.target.kind===`clarification`&&s!==null){if(!E&&!ze){Ie.current=e,se?.();return}xC(sC(s.roundId),{focusSelector:`.chat-event-card-header`});return}if(e.target.kind===`scratchpad`){xC(uC);return}Ee?.(e)};(0,N.useEffect)(()=>{let e=Ie.current;if(!E||A||e===null)return;Ie.current=null;let t=window.requestAnimationFrame(()=>{e.target.kind===`approval`&&o!==null?xC(cC(o.approvalId),{focusSelector:`.chat-event-card-header`}):e.target.kind===`clarification`&&s!==null&&xC(sC(s.roundId),{focusSelector:`.chat-event-card-header`})});return()=>window.cancelAnimationFrame(t)},[o,s,E,A,r]);let Ze=e=>s===null?null:Ye({key:e,roundId:s.roundId,title:s.title,summary:s.summary,request:s.request,contextLabel:s.ownerLabel,writable:s.status===`writable`&&s.roundId!==O}),Qe=()=>o===null?null:(0,P.jsx)(gb,{id:cC(o.approvalId),tabIndex:-1,title:o.title,summary:o.summary,...o.reason===void 0?{}:{reason:o.reason},...o.detail===void 0?{}:{detail:o.detail,...o.detailLabel===void 0?{}:{detailLabel:o.detailLabel},...o.detailCode===void 0?{}:{detailCode:o.detailCode}},status:o.status,statusLabel:o.statusLabel,decisions:o.decisions,decisionPending:k,...o.resolutionLabel===void 0?{}:{resolutionLabel:o.resolutionLabel},onDecide:e=>me?.(o.approvalId,e)},`approval:${o.approvalId}:${o.status}`),$e=e=>{let t=e.clarificationCard;if(t===void 0)return null;let n=s!==null&&s.roundId===t.roundId;return Ye({key:e.id,roundId:t.roundId,title:n&&s!==null?s.title:t.title??`Clarification round ${t.roundId.slice(-4)}`,summary:n&&s!==null?s.summary:t.summary,request:n&&s!==null?s.request:t.summary,...n&&s!==null?{contextLabel:s.ownerLabel}:{},writable:n&&t.status===`writable`&&t.roundId!==O})},et=e=>{if(SC(e)&&Be.has(e.workflowRef??``))return null;if(e.messageKind===`clarification_card`)return $e(e);if(s!==null&&e.id===s.cardMessageId)return Ze(e.id);if(e.taskResult!==void 0)return(0,P.jsx)(_b,{id:lC(e.id),tabIndex:-1,className:e.id===y?`is-focused`:void 0,title:e.taskResult.title,status:e.taskResult.status,taskId:e.taskResult.taskId,taskTitle:e.taskResult.taskTitle,summary:e.taskResult.summary,...e.taskResult.moduleName===void 0?{}:{moduleName:e.taskResult.moduleName},...e.taskResult.finalNote===void 0?{}:{finalNote:e.taskResult.finalNote},...e.taskResult.generatedFiles===void 0?{}:{generatedFiles:e.taskResult.generatedFiles},...e.taskResult.errorCode===void 0?{}:{errorCode:e.taskResult.errorCode},...be===void 0?{}:{onOpenTask:be}},e.id);let t=e.referenceFile;return(0,P.jsx)(jy,{id:lC(e.id),tabIndex:-1,author:e.author,time:e.time,avatar:(0,P.jsx)(TC,{message:e}),className:e.id===y?`is-focused`:void 0,children:t===void 0?e.messageKind===`agent_text`?(0,P.jsx)(My,{children:e.body}):(0,P.jsx)(`p`,{children:(0,P.jsx)(Oy,{children:e.body})}):(0,P.jsx)(Wy,{name:t.name,category:t.category,...t.imageUrl===void 0?{}:{imageUrl:t.imageUrl},onClick:()=>le?.(t.path)})},e.id)},tt=E?bC(o,r):null,nt=()=>{let e=s!==null&&(ze||E)||o!==null&&E;return r.length===0&&!e&&!w&&!T?(0,P.jsx)(XS,{children:`No messages yet`}):(0,P.jsxs)(P.Fragment,{children:[w?(0,P.jsx)(`div`,{className:`chat-history-status`,role:`status`,children:`Loading earlier messages…`}):null,!E||ze?null:Ze(`active-round`),r.map((e,t)=>(0,P.jsxs)(N.Fragment,{children:[tt===t?Qe():null,et(e)]},`timeline:${e.id}`)),tt===r.length?Qe():null,T?(0,P.jsx)(`div`,{className:`chat-history-status`,role:`status`,children:`Loading newer messages…`}):null]})},rt=(e,t=!1)=>(0,P.jsx)(eb,{id:e,tabIndex:-1,compact:t,title:i.title,summary:i.summary,sections:i.sections,submitAvailable:i.submitAvailable,...i.pages===void 0?{}:{pages:i.pages},...i.footerNote===void 0?{}:{footerNote:i.footerNote},...i.updatedLabelPrefix===void 0?{}:{updatedLabelPrefix:i.updatedLabelPrefix},syncPending:h,actionsDisabled:g,submitPending:_,onSubmitScratchpad:he,...be===void 0?{}:{onOpenCompiledTask:be},empty:(0,P.jsx)(XS,{children:`Scratchpad empty. Discuss more, tutti together!`}),...i.updatedLabel===void 0?{}:{updatedLabel:i.updatedLabel}}),it=(0,P.jsx)(`div`,{className:`chat-panel-actions`,children:(0,P.jsx)(qS,{members:n})});return(0,P.jsxs)(JS,{activePage:`chat`,statusShortcuts:l,mobileContext:{title:e,action:(0,P.jsx)(Ls,{className:h?`mobile-scratchpad-trigger is-syncing`:`mobile-scratchpad-trigger`,type:`button`,label:De?`Close Scratchpad`:`Open Scratchpad`,active:De,"aria-expanded":De,"aria-controls":`${uC}-mobile-sheet`,icon:(0,P.jsx)(Xy,{"aria-hidden":`true`}),onClick:()=>Oe(e=>!e)})},...u===void 0?{}:{unread:u},...d===void 0?{}:{artifactSignal:d},onOpenProjectCenter:ve,onOpenWorklist:ye,onOpenReferences:xe,onOpenArtifacts:Se,onOpenSkills:Ce,onOpenTimeline:we,onOpenSettings:Te,onActivateStatusShortcut:Xe,getStatusShortcutAriaControls:e=>e.target.kind===`approval`&&o!==null&&E?cC(o.approvalId):e.target.kind===`clarification`&&s!==null&&(E||ze)?sC(s.roundId):e.target.kind===`scratchpad`?uC:void 0,children:[(0,P.jsxs)(`section`,{className:`workspace-grid is-tutti chat-workspace-grid`,"aria-label":`Chat workspace`,children:[A?(0,P.jsx)(Gy,{title:Le,subtitle:Re,actions:it,children:(0,P.jsx)(aa,{})}):re?(0,P.jsx)(Gy,{title:Le,subtitle:Re,actions:it,children:(0,P.jsx)(XS,{children:`Workspace unavailable`})}):(0,P.jsx)(Gy,{title:Le,subtitle:Re,actions:it,streamRef:ke,onStreamScroll:qe,streamOverlay:C&&se!==void 0?(0,P.jsx)(xs,{className:`chat-jump-latest`,type:`button`,onClick:se,children:`Jump to latest`}):void 0,dropUploadPending:v,...We===void 0?{}:{onDropFiles:We},composer:(0,P.jsx)(Yy,{value:f,pending:m,uploadPending:v,mentionOptions:Ue,onValueChange:ie,onComposerSubmit:de,...ce===void 0?{}:{onFileUpload:ce}}),empty:(0,P.jsx)(XS,{children:`No messages yet`}),children:nt()}),(0,P.jsxs)(`div`,{className:a===null?`chat-side-column`:`chat-side-column has-progress`,children:[rt(uC),a===null?null:(0,P.jsx)(vC,{progress:a})]})]}),De?(0,P.jsxs)(`div`,{className:`mobile-scratchpad-layer is-open`,id:`${uC}-mobile-sheet`,children:[(0,P.jsx)(`button`,{className:`mobile-scratchpad-backdrop`,type:`button`,"aria-label":`Close Scratchpad`,onClick:()=>Oe(!1)}),(0,P.jsxs)(`section`,{className:`mobile-scratchpad-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`Scratchpad`,children:[(0,P.jsxs)(`div`,{className:`mobile-scratchpad-card-head`,children:[(0,P.jsx)(`h2`,{children:`Scratchpad`}),(0,P.jsx)(ys,{className:`mobile-scratchpad-close`,type:`button`,label:`Close Scratchpad`,icon:(0,P.jsx)(ra,{"aria-hidden":`true`}),onClick:()=>Oe(!1)})]}),(0,P.jsx)(`div`,{className:`mobile-scratchpad-card-body`,children:rt(`${uC}-mobile`,!0)})]})]}):null]})}function DC({statusShortcuts:e,unread:t,state:n,loading:r=!1,unavailable:i=!1,onOpenProjectCenter:a,onOpenChat:o,onOpenWorklist:s,onOpenReferences:c,onOpenSkills:l,onOpenTimeline:u,onOpenSettings:d,onActivateStatusShortcut:f}){let p=r?{status:`loading`}:i?{status:`not_declared`}:n;return(0,P.jsx)(JS,{activePage:`artifacts`,statusShortcuts:e,mobileContext:{title:p.status===`declared`?p.title:`Artifacts`},...t===void 0?{}:{unread:t},artifactSignal:ux(p),onOpenProjectCenter:a,onOpenChat:o,onOpenWorklist:s,onOpenReferences:c,onOpenSkills:l,onOpenTimeline:u,onOpenSettings:d,onActivateStatusShortcut:f,children:(0,P.jsx)(`section`,{className:`workspace-grid artifacts-workspace-grid`,"aria-label":`Artifacts`,children:(0,P.jsx)(Nb,{state:p,...i?{empty:(0,P.jsx)(XS,{children:`Workspace unavailable`})}:{},emptyWatermark:(0,P.jsx)(YS,{})})})})}function OC({statusShortcuts:e,unread:t,artifactSignal:n,files:r,detail:i,uploadPending:a=!1,fileSortMode:o=`time`,loading:s=!1,unavailable:c=!1,onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,onSelectFile:_,onUploadFile:v,onFileSortModeChange:y}){let b=s||c;return(0,P.jsx)(JS,{activePage:`references`,statusShortcuts:e,mobileContext:{title:`References`,action:(0,P.jsx)(Jy,{variant:`bare`,className:`sidebar-button reference-upload-button`,label:`Upload reference`,pendingLabel:`Uploading reference`,pending:a,iconOnly:!0,onFileUpload:v})},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,children:(0,P.jsx)(`section`,{className:`workspace-grid references-workspace-grid`,"aria-label":`Reference files`,children:(0,P.jsx)(Ab,{files:b?[]:r,...s?{detail:{title:`Loading`,unavailableReason:`Loading`}}:c?{detail:{title:`References unavailable`,unavailableReason:`Workspace unavailable`}}:i===void 0?{}:{detail:i},uploadPending:a,fileSortMode:o,empty:s?(0,P.jsx)(XS,{children:`Loading reference files`}):c?(0,P.jsx)(XS,{children:`Workspace unavailable`}):(0,P.jsx)(XS,{children:`No reference files`}),onSelectFile:_,onUploadFile:v,...y===void 0?{}:{onFileSortModeChange:y}})})})}var kC=6,AC=`......`,jC=80,MC=160;function NC(e){let t=document.createElement(`canvas`).getContext(`2d`);if(t===null)return null;let n=window.getComputedStyle(e);return t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(` `),e=>t.measureText(e).width}function PC(e,t,n){if(n(e)<=t)return e;let r=e.slice(-kC),i=Math.max(0,e.length-r.length),a=0,o=i;for(;a<o;){let i=Math.ceil((a+o)/2);n(`${e.slice(0,i)}${AC}${r}`)<=t?a=i:o=i-1}return`${e.slice(0,a)}${AC}${r}`}function FC({value:e}){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(e);return(0,N.useEffect)(()=>{let n=t.current;if(n===null)return;let i=()=>{let t=NC(n),i=n.getBoundingClientRect().width;if(t===null||i<=0){r(e);return}let a=PC(e,i,t);r(e=>e===a?e:a)};i();let a=typeof ResizeObserver>`u`?null:new ResizeObserver(i);return a?.observe(n),window.addEventListener(`resize`,i),()=>{a?.disconnect(),window.removeEventListener(`resize`,i)}},[e]),(0,P.jsx)(`code`,{ref:t,className:`settings-masked-link`,title:e,"aria-label":e,children:n})}function IC({value:e,onCopy:t}){return t===void 0?(0,P.jsx)(FC,{value:e}):(0,P.jsx)(`button`,{className:`settings-value-button settings-link-copy-button`,type:`button`,"aria-label":`Copy invite link`,onClick:t,children:(0,P.jsx)(FC,{value:e})})}function LC(e,t){return e.map(e=>({id:e.id,title:e.title,rows:e.rows.map(e=>({label:e.label,value:e.identity===!0?(0,P.jsxs)(`div`,{className:`settings-identity`,children:[(0,P.jsx)(WS,{avatar:t.currentMember.avatar,label:t.currentMember.displayName}),(0,P.jsx)(`strong`,{children:t.currentMember.displayName})]}):e.value,...e.identity===!0?{plain:!0}:{},...e.code===void 0?{}:{code:e.code}}))}))}function RC({settings:e,onCopyJoinUrl:t}){let n=e.invite;return n===void 0?null:{label:`invite link`,value:n.joinUrl===void 0?`not recoverable`:(0,P.jsx)(IC,{value:n.joinUrl,onCopy:t}),...n.joinUrl===void 0?{}:{plain:!0}}}function zC({settings:e,statusShortcuts:t,unread:n,artifactSignal:r,loading:i=!1,unavailable:a=!1,projectNameSaving:o=!1,projectDescriptionSaving:s=!1,onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onActivateStatusShortcut:h,onCopyJoinUrl:g,onUpdateProjectDisplayName:_,onUpdateProjectDescription:v}){let y=e?.statuses??[],b=e===void 0?null:RC({settings:e,onCopyJoinUrl:g});return(0,P.jsx)(JS,{activePage:`settings`,statusShortcuts:t,mobileContext:{title:`Settings`},...n===void 0?{}:{unread:n},...r===void 0?{}:{artifactSignal:r},onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onActivateStatusShortcut:h,children:(0,P.jsx)(`section`,{className:`workspace-grid settings-workspace-grid`,"aria-label":`Project settings`,children:(0,P.jsx)(`div`,{className:`settings-page-grid`,children:i?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Loading settings`,children:(0,P.jsx)(XS,{children:`Loading settings`})}):a?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Settings unavailable`,children:(0,P.jsx)(XS,{children:`Workspace unavailable`})}):e===void 0?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Settings unavailable`,children:(0,P.jsx)(XS,{children:`Settings unavailable`})}):(0,P.jsx)(Tb,{statuses:y,sections:[{id:`settings-project`,title:`Project`,rows:[{label:`display_name`,plain:!0,value:(0,P.jsx)(Ky,{value:e.project.displayName,placeholder:`Untitled project`,ariaLabel:`Project display name`,maxLength:jC,saving:o,..._===void 0?{}:{onUpdate:_}})},{label:`description`,plain:!0,value:(0,P.jsx)(Ky,{value:e.project.description,placeholder:`Add a project description`,ariaLabel:`Project description`,maxLength:MC,allowEmpty:!0,saving:s,...v===void 0?{}:{onUpdate:v}})},...b===null?[]:[b]]},...LC(e.sections,e)]})})})})}var BC=[{title:`Awesome GitHub Copilot Skills`,href:`https://awesome-copilot.github.com/skills/`},{title:`Anthropic official skills`,href:`https://github.com/anthropics/skills`},{title:`Claude Skills Marketplace`,href:`https://claudeskills.info/skills/`}];function VC({statusShortcuts:e,unread:t,artifactSignal:n,skills:r,detail:i,uploadPending:a=!1,deletePending:o=!1,loading:s=!1,unavailable:c=!1,onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenReferences:f,onOpenArtifacts:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,onSelectSkill:_,onUploadSkill:v,onDeleteSkill:y}){let b=s||c;return(0,P.jsx)(JS,{activePage:`skills`,statusShortcuts:e,mobileContext:{title:`Skills`,action:(0,P.jsx)(Jy,{variant:`bare`,className:`sidebar-button reference-upload-button`,label:`Upload skill`,pendingLabel:`Uploading skill`,pending:a,accept:`.zip,application/zip,application/x-zip-compressed`,iconOnly:!0,onFileUpload:v})},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenReferences:f,onOpenArtifacts:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,children:(0,P.jsx)(`section`,{className:`workspace-grid references-workspace-grid`,"aria-label":`Skills`,children:(0,P.jsx)(Fb,{skills:b?[]:r,communityLinks:b?[]:BC,...s?{detail:{title:`Loading`,unavailableReason:`Loading`}}:c?{detail:{title:`Skills unavailable`,unavailableReason:`Workspace unavailable`}}:i===void 0?{}:{detail:i},uploadPending:a,deletePending:o,empty:s?(0,P.jsx)(XS,{children:`Loading skills`}):c?(0,P.jsx)(XS,{children:`Workspace unavailable`}):(0,P.jsx)(XS,{children:`No skills`}),onSelectSkill:_,onUploadSkill:v,onDeleteSkill:y})})})}function HC({timeline:e,statusShortcuts:t,unread:n,artifactSignal:r,loading:i=!1,unavailable:a=!1,onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenSettings:f,onActivateStatusShortcut:p}){return(0,P.jsx)(JS,{activePage:`timeline`,statusShortcuts:t,mobileContext:{title:`Timeline`},...n===void 0?{}:{unread:n},...r===void 0?{}:{artifactSignal:r},onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenSettings:f,onActivateStatusShortcut:p,children:(0,P.jsx)(`section`,{className:`workspace-grid timeline-workspace-grid`,"aria-label":`Timeline workspace`,children:i?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Loading timeline`,children:(0,P.jsx)(XS,{children:`Loading timeline`})}):a?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Timeline unavailable`,children:(0,P.jsx)(XS,{children:`Workspace unavailable`})}):e===void 0?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Timeline unavailable`,children:(0,P.jsx)(XS,{children:`Timeline unavailable`})}):(0,P.jsx)(Xb,{tokenOverview:e.tokenOverview,items:e.items,scoreUnits:e.scoreUnits,empty:(0,P.jsx)(XS,{children:`No timeline events yet`})})})})}function UC({statusShortcuts:e,unread:t,artifactSignal:n,modules:r,taskCount:i,detail:a,missingTaskId:o,runNote:s,loading:c=!1,unavailable:l=!1,onOpenProjectCenter:u,onOpenChat:d,onOpenReferences:f,onOpenArtifacts:p,onOpenSkills:m,onOpenTimeline:h,onOpenSettings:g,onActivateStatusShortcut:_,onSelectTask:v}){return(0,P.jsx)(JS,{activePage:`worklist`,statusShortcuts:e,mobileContext:{title:`Worklist`,meta:i===1?`1 task`:`${i} tasks`},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:u,onOpenChat:d,onOpenReferences:f,onOpenArtifacts:p,onOpenSkills:m,onOpenTimeline:h,onOpenSettings:g,onActivateStatusShortcut:_,children:(0,P.jsx)(`section`,{className:`workspace-grid worklist-workspace-grid`,"aria-label":`Worklist workspace`,children:c?(0,P.jsx)(`section`,{className:`panel tasks worklist-page-panel`,"aria-label":`Loading Worklist`,children:(0,P.jsx)(XS,{children:`Loading Worklist`})}):l?(0,P.jsx)(`section`,{className:`panel tasks worklist-page-panel`,"aria-label":`Worklist unavailable`,children:(0,P.jsx)(XS,{children:`Workspace unavailable`})}):(0,P.jsx)(wb,{modules:r,taskCount:i,...a===void 0?{}:{detail:a},...o===void 0?{}:{missingTaskId:o},...s==null?{}:{runNote:s},onSelectTask:v,empty:(0,P.jsx)(XS,{children:`No compiled tasks`})})})})}function WC(e){return $C(e)&&!GC(e)&&!rw(e)&&Symbol.asyncIterator in e}function GC(e){return Array.isArray(e)}function KC(e){return typeof e==`bigint`}function qC(e){return typeof e==`boolean`}function JC(e){return e instanceof globalThis.Date}function YC(e){return typeof e==`function`}function XC(e){return $C(e)&&!GC(e)&&!rw(e)&&Symbol.iterator in e}function ZC(e){return e===null}function QC(e){return typeof e==`number`}function $C(e){return typeof e==`object`&&!!e}function ew(e){return e instanceof globalThis.RegExp}function tw(e){return typeof e==`string`}function nw(e){return typeof e==`symbol`}function rw(e){return e instanceof globalThis.Uint8Array}function iw(e){return e===void 0}function aw(e){return e.map(e=>uw(e))}function ow(e){return new Date(e.getTime())}function sw(e){return new Uint8Array(e)}function cw(e){return new RegExp(e.source,e.flags)}function lw(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=uw(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=uw(e[n]);return t}function uw(e){return GC(e)?aw(e):JC(e)?ow(e):rw(e)?sw(e):ew(e)?cw(e):$C(e)?lw(e):e}function dw(e){return uw(e)}function fw(e,t){return dw(t===void 0?e:{...t,...e})}function pw(e){return typeof e==`object`&&!!e}function mw(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function hw(e){return e===void 0}function gw(e){return typeof e==`number`}var _w;(function(e){e.InstanceMode=`default`,e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(t,n){return e.ExactOptionalPropertyTypes?n in t:t[n]!==void 0}e.IsExactOptionalProperty=t;function n(t){let n=pw(t);return e.AllowArrayObject?n:n&&!mw(t)}e.IsObjectLike=n;function r(e){return n(e)&&!(e instanceof Date)&&!(e instanceof Uint8Array)}e.IsRecordLike=r;function i(t){return e.AllowNaN?gw(t):Number.isFinite(t)}e.IsNumberLike=i;function a(t){let n=hw(t);return e.AllowNullVoid?n||t===null:n}e.IsVoidLike=a})(_w||={});function vw(e){return globalThis.Object.freeze(e).map(e=>Cw(e))}function yw(e){return e}function bw(e){return e}function xw(e){return e}function Sw(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Cw(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Cw(e[n]);return globalThis.Object.freeze(t)}function Cw(e){return GC(e)?vw(e):JC(e)?yw(e):rw(e)?bw(e):ew(e)?xw(e):$C(e)?Sw(e):e}function K(e,t){let n=t===void 0?e:{...t,...e};switch(_w.InstanceMode){case`freeze`:return Cw(n);case`clone`:return dw(n);default:return n}}var ww=class extends Error{constructor(e){super(e)}},Tw=Symbol.for(`TypeBox.Transform`),Ew=Symbol.for(`TypeBox.Readonly`),Dw=Symbol.for(`TypeBox.Optional`),Ow=Symbol.for(`TypeBox.Hint`),q=Symbol.for(`TypeBox.Kind`);function kw(e){return $C(e)&&e[Ew]===`Readonly`}function Aw(e){return $C(e)&&e[Dw]===`Optional`}function jw(e){return Ww(e,`Any`)}function Mw(e){return Ww(e,`Argument`)}function Nw(e){return Ww(e,`Array`)}function Pw(e){return Ww(e,`AsyncIterator`)}function Fw(e){return Ww(e,`BigInt`)}function Iw(e){return Ww(e,`Boolean`)}function Lw(e){return Ww(e,`Computed`)}function Rw(e){return Ww(e,`Constructor`)}function zw(e){return Ww(e,`Date`)}function Bw(e){return Ww(e,`Function`)}function Vw(e){return Ww(e,`Integer`)}function Hw(e){return Ww(e,`Intersect`)}function Uw(e){return Ww(e,`Iterator`)}function Ww(e,t){return $C(e)&&q in e&&e[q]===t}function Gw(e){return qC(e)||QC(e)||tw(e)}function Kw(e){return Ww(e,`Literal`)}function qw(e){return Ww(e,`MappedKey`)}function Jw(e){return Ww(e,`MappedResult`)}function Yw(e){return Ww(e,`Never`)}function Xw(e){return Ww(e,`Not`)}function Zw(e){return Ww(e,`Null`)}function Qw(e){return Ww(e,`Number`)}function $w(e){return Ww(e,`Object`)}function eT(e){return Ww(e,`Promise`)}function tT(e){return Ww(e,`Record`)}function nT(e){return Ww(e,`Ref`)}function rT(e){return Ww(e,`RegExp`)}function iT(e){return Ww(e,`String`)}function aT(e){return Ww(e,`Symbol`)}function oT(e){return Ww(e,`TemplateLiteral`)}function sT(e){return Ww(e,`This`)}function cT(e){return $C(e)&&Tw in e}function lT(e){return Ww(e,`Tuple`)}function uT(e){return Ww(e,`Undefined`)}function dT(e){return Ww(e,`Union`)}function fT(e){return Ww(e,`Uint8Array`)}function pT(e){return Ww(e,`Unknown`)}function mT(e){return Ww(e,`Unsafe`)}function hT(e){return Ww(e,`Void`)}function gT(e){return $C(e)&&q in e&&tw(e[q])}function _T(e){return jw(e)||Mw(e)||Nw(e)||Iw(e)||Fw(e)||Pw(e)||Lw(e)||Rw(e)||zw(e)||Bw(e)||Vw(e)||Hw(e)||Uw(e)||Kw(e)||qw(e)||Jw(e)||Yw(e)||Xw(e)||Zw(e)||Qw(e)||$w(e)||eT(e)||tT(e)||nT(e)||rT(e)||iT(e)||aT(e)||oT(e)||sT(e)||lT(e)||uT(e)||dT(e)||fT(e)||pT(e)||mT(e)||hT(e)||gT(e)}var vT=`Argument.Any.Array.AsyncIterator.BigInt.Boolean.Computed.Constructor.Date.Enum.Function.Integer.Intersect.Iterator.Literal.MappedKey.MappedResult.Not.Null.Number.Object.Promise.Record.Ref.RegExp.String.Symbol.TemplateLiteral.This.Tuple.Undefined.Union.Uint8Array.Unknown.Void`.split(`.`);function yT(e){try{return new RegExp(e),!0}catch{return!1}}function bT(e){if(!tw(e))return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function xT(e){return wT(e)||bE(e)}function ST(e){return iw(e)||KC(e)}function CT(e){return iw(e)||QC(e)}function wT(e){return iw(e)||qC(e)}function TT(e){return iw(e)||tw(e)}function ET(e){return iw(e)||tw(e)&&bT(e)&&yT(e)}function DT(e){return iw(e)||tw(e)&&bT(e)}function OT(e){return iw(e)||bE(e)}function kT(e){return $C(e)&&e[Dw]===`Optional`}function AT(e){return WT(e,`Any`)&&TT(e.$id)}function jT(e){return WT(e,`Argument`)&&QC(e.index)}function MT(e){return WT(e,`Array`)&&e.type===`array`&&TT(e.$id)&&bE(e.items)&&CT(e.minItems)&&CT(e.maxItems)&&wT(e.uniqueItems)&&OT(e.contains)&&CT(e.minContains)&&CT(e.maxContains)}function NT(e){return WT(e,`AsyncIterator`)&&e.type===`AsyncIterator`&&TT(e.$id)&&bE(e.items)}function PT(e){return WT(e,`BigInt`)&&e.type===`bigint`&&TT(e.$id)&&ST(e.exclusiveMaximum)&&ST(e.exclusiveMinimum)&&ST(e.maximum)&&ST(e.minimum)&&ST(e.multipleOf)}function FT(e){return WT(e,`Boolean`)&&e.type===`boolean`&&TT(e.$id)}function IT(e){return WT(e,`Computed`)&&tw(e.target)&&GC(e.parameters)&&e.parameters.every(e=>bE(e))}function LT(e){return WT(e,`Constructor`)&&e.type===`Constructor`&&TT(e.$id)&&GC(e.parameters)&&e.parameters.every(e=>bE(e))&&bE(e.returns)}function RT(e){return WT(e,`Date`)&&e.type===`Date`&&TT(e.$id)&&CT(e.exclusiveMaximumTimestamp)&&CT(e.exclusiveMinimumTimestamp)&&CT(e.maximumTimestamp)&&CT(e.minimumTimestamp)&&CT(e.multipleOfTimestamp)}function zT(e){return WT(e,`Function`)&&e.type===`Function`&&TT(e.$id)&&GC(e.parameters)&&e.parameters.every(e=>bE(e))&&bE(e.returns)}function BT(e){return WT(e,`Integer`)&&e.type===`integer`&&TT(e.$id)&&CT(e.exclusiveMaximum)&&CT(e.exclusiveMinimum)&&CT(e.maximum)&&CT(e.minimum)&&CT(e.multipleOf)}function VT(e){return $C(e)&&Object.entries(e).every(([e,t])=>bT(e)&&bE(t))}function HT(e){return WT(e,`Intersect`)&&!(tw(e.type)&&e.type!==`object`)&&GC(e.allOf)&&e.allOf.every(e=>bE(e)&&!dE(e))&&TT(e.type)&&(wT(e.unevaluatedProperties)||OT(e.unevaluatedProperties))&&TT(e.$id)}function UT(e){return WT(e,`Iterator`)&&e.type===`Iterator`&&TT(e.$id)&&bE(e.items)}function WT(e,t){return $C(e)&&q in e&&e[q]===t}function GT(e){return JT(e)&&tw(e.const)}function KT(e){return JT(e)&&QC(e.const)}function qT(e){return JT(e)&&qC(e.const)}function JT(e){return WT(e,`Literal`)&&TT(e.$id)&&YT(e.const)}function YT(e){return qC(e)||QC(e)||tw(e)}function XT(e){return WT(e,`MappedKey`)&&GC(e.keys)&&e.keys.every(e=>QC(e)||tw(e))}function ZT(e){return WT(e,`MappedResult`)&&VT(e.properties)}function QT(e){return WT(e,`Never`)&&$C(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function $T(e){return WT(e,`Not`)&&bE(e.not)}function eE(e){return WT(e,`Null`)&&e.type===`null`&&TT(e.$id)}function tE(e){return WT(e,`Number`)&&e.type===`number`&&TT(e.$id)&&CT(e.exclusiveMaximum)&&CT(e.exclusiveMinimum)&&CT(e.maximum)&&CT(e.minimum)&&CT(e.multipleOf)}function nE(e){return WT(e,`Object`)&&e.type===`object`&&TT(e.$id)&&VT(e.properties)&&xT(e.additionalProperties)&&CT(e.minProperties)&&CT(e.maxProperties)}function rE(e){return WT(e,`Promise`)&&e.type===`Promise`&&TT(e.$id)&&bE(e.item)}function iE(e){return WT(e,`Record`)&&e.type===`object`&&TT(e.$id)&&xT(e.additionalProperties)&&$C(e.patternProperties)&&(e=>{let t=Object.getOwnPropertyNames(e.patternProperties);return t.length===1&&yT(t[0])&&$C(e.patternProperties)&&bE(e.patternProperties[t[0]])})(e)}function aE(e){return WT(e,`Ref`)&&TT(e.$id)&&tw(e.$ref)}function oE(e){return WT(e,`RegExp`)&&TT(e.$id)&&tw(e.source)&&tw(e.flags)&&CT(e.maxLength)&&CT(e.minLength)}function sE(e){return WT(e,`String`)&&e.type===`string`&&TT(e.$id)&&CT(e.minLength)&&CT(e.maxLength)&&ET(e.pattern)&&DT(e.format)}function cE(e){return WT(e,`Symbol`)&&e.type===`symbol`&&TT(e.$id)}function lE(e){return WT(e,`TemplateLiteral`)&&e.type===`string`&&tw(e.pattern)&&e.pattern[0]===`^`&&e.pattern[e.pattern.length-1]===`$`}function uE(e){return WT(e,`This`)&&TT(e.$id)&&tw(e.$ref)}function dE(e){return $C(e)&&Tw in e}function fE(e){return WT(e,`Tuple`)&&e.type===`array`&&TT(e.$id)&&QC(e.minItems)&&QC(e.maxItems)&&e.minItems===e.maxItems&&(iw(e.items)&&iw(e.additionalItems)&&e.minItems===0||GC(e.items)&&e.items.every(e=>bE(e)))}function pE(e){return WT(e,`Undefined`)&&e.type===`undefined`&&TT(e.$id)}function mE(e){return WT(e,`Union`)&&TT(e.$id)&&$C(e)&&GC(e.anyOf)&&e.anyOf.every(e=>bE(e))}function hE(e){return WT(e,`Uint8Array`)&&e.type===`Uint8Array`&&TT(e.$id)&&CT(e.minByteLength)&&CT(e.maxByteLength)}function gE(e){return WT(e,`Unknown`)&&TT(e.$id)}function _E(e){return WT(e,`Unsafe`)}function vE(e){return WT(e,`Void`)&&e.type===`void`&&TT(e.$id)}function yE(e){return $C(e)&&q in e&&tw(e[q])&&!vT.includes(e[q])}function bE(e){return $C(e)&&(AT(e)||jT(e)||MT(e)||FT(e)||PT(e)||NT(e)||IT(e)||LT(e)||RT(e)||zT(e)||BT(e)||HT(e)||UT(e)||JT(e)||XT(e)||ZT(e)||QT(e)||$T(e)||eE(e)||tE(e)||nE(e)||rE(e)||iE(e)||aE(e)||oE(e)||sE(e)||cE(e)||lE(e)||uE(e)||fE(e)||pE(e)||mE(e)||hE(e)||gE(e)||_E(e)||vE(e)||yE(e))}var xE=`(true|false)`,SE=`(0|[1-9][0-9]*)`,CE=`(.*)`,wE=`(?!.*)`;`${xE}`;var TE=`^${SE}$`,EE=`^${CE}$`,DE=`^${wE}$`;function OE(e,t){return e.includes(t)}function kE(e){return[...new Set(e)]}function AE(e,t){return e.filter(e=>t.includes(e))}function jE(e,t){return e.reduce((e,t)=>AE(e,t),t)}function ME(e){return e.length===1?e[0]:e.length>1?jE(e.slice(1),e[0]):[]}function NE(e){let t=[];for(let n of e)t.push(...n);return t}function PE(e){return K({[q]:`Any`},e)}function FE(e,t){return K({[q]:`Array`,type:`array`,items:e},t)}function IE(e){return K({[q]:`Argument`,index:e})}function LE(e,t){return K({[q]:`AsyncIterator`,type:`AsyncIterator`,items:e},t)}function RE(e,t,n){return K({[q]:`Computed`,target:e,parameters:t},n)}function zE(e,t){let{[t]:n,...r}=e;return r}function BE(e,t){return t.reduce((e,t)=>zE(e,t),e)}function VE(e){return K({[q]:`Never`,not:{}},e)}function HE(e){return K({[q]:`MappedResult`,properties:e})}function UE(e,t,n){return K({[q]:`Constructor`,type:`Constructor`,parameters:e,returns:t},n)}function WE(e,t,n){return K({[q]:`Function`,type:`Function`,parameters:e,returns:t},n)}function GE(e,t){return K({[q]:`Union`,anyOf:e},t)}function KE(e){return e.some(e=>Aw(e))}function qE(e){return e.map(e=>Aw(e)?JE(e):e)}function JE(e){return BE(e,[Dw])}function YE(e,t){return KE(e)?FO(GE(qE(e),t)):GE(qE(e),t)}function XE(e,t){return e.length===1?K(e[0],t):e.length===0?VE(t):YE(e,t)}function ZE(e,t){return e.length===0?VE(t):e.length===1?K(e[0],t):GE(e,t)}var QE=class extends ww{};function $E(e){return e.replace(/\\\$/g,`$`).replace(/\\\*/g,`*`).replace(/\\\^/g,`^`).replace(/\\\|/g,`|`).replace(/\\\(/g,`(`).replace(/\\\)/g,`)`)}function eD(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function tD(e,t){return eD(e,t,`(`)}function nD(e,t){return eD(e,t,`)`)}function rD(e,t){return eD(e,t,`|`)}function iD(e){if(!(tD(e,0)&&nD(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(tD(e,n)&&(t+=1),nD(e,n)&&--t,t===0&&n!==e.length-1)return!1;return!0}function aD(e){return e.slice(1,e.length-1)}function oD(e){let t=0;for(let n=0;n<e.length;n++)if(tD(e,n)&&(t+=1),nD(e,n)&&--t,rD(e,n)&&t===0)return!0;return!1}function sD(e){for(let t=0;t<e.length;t++)if(tD(e,t))return!0;return!1}function cD(e){let[t,n]=[0,0],r=[];for(let i=0;i<e.length;i++)if(tD(e,i)&&(t+=1),nD(e,i)&&--t,rD(e,i)&&t===0){let t=e.slice(n,i);t.length>0&&r.push(uD(t)),n=i+1}let i=e.slice(n);return i.length>0&&r.push(uD(i)),r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`or`,expr:r}}function lD(e){function t(e,t){if(!tD(e,t))throw new QE(`TemplateLiteralParser: Index must point to open parens`);let n=0;for(let r=t;r<e.length;r++)if(tD(e,r)&&(n+=1),nD(e,r)&&--n,n===0)return[t,r];throw new QE(`TemplateLiteralParser: Unclosed group parens in expression`)}function n(e,t){for(let n=t;n<e.length;n++)if(tD(e,n))return[t,n];return[t,e.length]}let r=[];for(let i=0;i<e.length;i++)if(tD(e,i)){let[n,a]=t(e,i),o=e.slice(n,a+1);r.push(uD(o)),i=a}else{let[t,a]=n(e,i),o=e.slice(t,a);o.length>0&&r.push(uD(o)),i=a-1}return r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`and`,expr:r}}function uD(e){return iD(e)?uD(aD(e)):oD(e)?cD(e):sD(e)?lD(e):{type:`const`,const:$E(e)}}function dD(e){return uD(e.slice(1,e.length-1))}var fD=class extends ww{};function pD(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`0`&&e.expr[1].type===`const`&&e.expr[1].const===`[1-9][0-9]*`}function mD(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`true`&&e.expr[1].type===`const`&&e.expr[1].const===`false`}function hD(e){return e.type===`const`&&e.const===`.*`}function gD(e){return pD(e)||hD(e)?!1:mD(e)?!0:e.type===`and`||e.type===`or`?e.expr.every(e=>gD(e)):e.type===`const`?!0:(()=>{throw new fD(`Unknown expression type`)})()}function _D(e){return gD(dD(e.pattern))}var vD=class extends ww{};function*yD(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of yD(e.slice(1)))yield`${t}${n}`}function*bD(e){return yield*yD(e.expr.map(e=>[...CD(e)]))}function*xD(e){for(let t of e.expr)yield*CD(t)}function*SD(e){return yield e.const}function*CD(e){return e.type===`and`?yield*bD(e):e.type===`or`?yield*xD(e):e.type===`const`?yield*SD(e):(()=>{throw new vD(`Unknown expression`)})()}function wD(e){let t=dD(e.pattern);return gD(t)?[...CD(t)]:[]}function TD(e,t){return K({[q]:`Literal`,const:e,type:typeof e},t)}function ED(e){return K({[q]:`Boolean`,type:`boolean`},e)}function DD(e){return K({[q]:`BigInt`,type:`bigint`},e)}function OD(e){return K({[q]:`Number`,type:`number`},e)}function kD(e){return K({[q]:`String`,type:`string`},e)}function*AD(e){let t=e.trim().replace(/"|'/g,``);return t===`boolean`?yield ED():t===`number`?yield OD():t===`bigint`?yield DD():t===`string`?yield kD():yield(()=>{let e=t.split(`|`).map(e=>TD(e.trim()));return e.length===0?VE():e.length===1?e[0]:XE(e)})()}function*jD(e){if(e[1]!==`{`)return yield*[TD(`$`),...MD(e.slice(1))];for(let t=2;t<e.length;t++)if(e[t]===`}`){let n=AD(e.slice(2,t)),r=MD(e.slice(t+1));return yield*[...n,...r]}yield TD(e)}function*MD(e){for(let t=0;t<e.length;t++)if(e[t]===`$`)return yield*[TD(e.slice(0,t)),...jD(e.slice(t))];yield TD(e)}function ND(e){return[...MD(e)]}var PD=class extends ww{};function FD(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ID(e,t){return oT(e)?e.pattern.slice(1,e.pattern.length-1):dT(e)?`(${e.anyOf.map(e=>ID(e,t)).join(`|`)})`:Qw(e)||Vw(e)||Fw(e)?`${t}${SE}`:iT(e)?`${t}${CE}`:Kw(e)?`${t}${FD(e.const.toString())}`:Iw(e)?`${t}${xE}`:(()=>{throw new PD(`Unexpected Kind '${e[q]}'`)})()}function LD(e){return`^${e.map(e=>ID(e,``)).join(``)}\$`}function RD(e){return XE(wD(e).map(e=>TD(e)))}function zD(e,t){let n=tw(e)?LD(ND(e)):LD(e);return K({[q]:`TemplateLiteral`,type:`string`,pattern:n},t)}function BD(e){return wD(e).map(e=>e.toString())}function VD(e){let t=[];for(let n of e)t.push(...UD(n));return t}function HD(e){return[e.toString()]}function UD(e){return[...new Set(oT(e)?BD(e):dT(e)?VD(e.anyOf):Kw(e)?HD(e.const):Qw(e)||Vw(e)?[`[number]`]:[])]}function WD(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=iO(e,UD(t[i]),n);return r}function GD(e,t,n){return WD(e,t.properties,n)}function KD(e,t,n){return HE(GD(e,t,n))}function qD(e,t){return e.map(e=>tO(e,t))}function JD(e){return e.filter(e=>!Yw(e))}function YD(e,t){return WO(JD(qD(e,t)))}function XD(e){return e.some(e=>Yw(e))?[]:e}function ZD(e,t){return XE(XD(qD(e,t)))}function QD(e,t){return t in e?e[t]:t===`[number]`?XE(e):VE()}function $D(e,t){return t===`[number]`?e:VE()}function eO(e,t){return t in e?e[t]:VE()}function tO(e,t){return Hw(e)?YD(e.allOf,t):dT(e)?ZD(e.anyOf,t):lT(e)?QD(e.items??[],t):Nw(e)?$D(e.items,t):$w(e)?eO(e.properties,t):VE()}function nO(e,t){return t.map(t=>tO(e,t))}function rO(e,t){return XE(nO(e,t))}function iO(e,t,n){if(nT(e)||nT(t)){if(!_T(e)||!_T(t))throw new ww(`Index types using Ref parameters require both Type and Key to be of TSchema`);return RE(`Index`,[e,t])}return Jw(t)?KD(e,t,n):qw(t)?cO(e,t,n):K(_T(t)?rO(e,UD(t)):rO(e,t),n)}function aO(e,t,n){return{[t]:iO(e,[t],dw(n))}}function oO(e,t,n){return t.reduce((t,r)=>({...t,...aO(e,r,n)}),{})}function sO(e,t,n){return oO(e,t.keys,n)}function cO(e,t,n){return HE(sO(e,t,n))}function lO(e,t){return K({[q]:`Iterator`,type:`Iterator`,items:e},t)}function uO(e){return globalThis.Object.keys(e).filter(t=>!Aw(e[t]))}function dO(e,t){let n=uO(e);return K(n.length>0?{[q]:`Object`,type:`object`,required:n,properties:e}:{[q]:`Object`,type:`object`,properties:e},t)}var fO=dO;function pO(e,t){return K({[q]:`Promise`,type:`Promise`,item:e},t)}function mO(e){return K(BE(e,[Ew]))}function hO(e){return K({...e,[Ew]:`Readonly`})}function gO(e,t){return t===!1?mO(e):hO(e)}function _O(e,t){let n=t??!0;return Jw(e)?bO(e,n):gO(e,n)}function vO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=_O(e[r],t);return n}function yO(e,t){return vO(e.properties,t)}function bO(e,t){return HE(yO(e,t))}function xO(e,t){return K(e.length>0?{[q]:`Tuple`,type:`array`,items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[q]:`Tuple`,type:`array`,minItems:e.length,maxItems:e.length},t)}function SO(e,t){return e in t?kO(e,t[e]):HE(t)}function CO(e){return{[e]:TD(e)}}function wO(e){let t={};for(let n of e)t[n]=TD(n);return t}function TO(e,t){return OE(t,e)?CO(e):wO(t)}function EO(e,t){return SO(e,TO(e,t))}function DO(e,t){return t.map(t=>kO(e,t))}function OO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=kO(e,t[r]);return n}function kO(e,t){let n={...t};return Aw(t)?FO(kO(e,BE(t,[Dw]))):kw(t)?_O(kO(e,BE(t,[Ew]))):Jw(t)?SO(e,t.properties):qw(t)?EO(e,t.keys):Rw(t)?UE(DO(e,t.parameters),kO(e,t.returns),n):Bw(t)?WE(DO(e,t.parameters),kO(e,t.returns),n):Pw(t)?LE(kO(e,t.items),n):Uw(t)?lO(kO(e,t.items),n):Hw(t)?GO(DO(e,t.allOf),n):dT(t)?ZE(DO(e,t.anyOf),n):lT(t)?xO(DO(e,t.items??[]),n):$w(t)?fO(OO(e,t.properties),n):Nw(t)?FE(kO(e,t.items),n):eT(t)?pO(kO(e,t.item),n):t}function AO(e,t){let n={};for(let r of e)n[r]=kO(r,t);return n}function jO(e,t,n){let r=_T(e)?UD(e):e;return fO(AO(r,t({[q]:`MappedKey`,keys:r})),n)}function MO(e){return K(BE(e,[Dw]))}function NO(e){return K({...e,[Dw]:`Optional`})}function PO(e,t){return t===!1?MO(e):NO(e)}function FO(e,t){let n=t??!0;return Jw(e)?RO(e,n):PO(e,n)}function IO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=FO(e[r],t);return n}function LO(e,t){return IO(e.properties,t)}function RO(e,t){return HE(LO(e,t))}function zO(e,t={}){let n=e.every(e=>$w(e)),r=_T(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return K(t.unevaluatedProperties===!1||_T(t.unevaluatedProperties)||n?{...r,[q]:`Intersect`,type:`object`,allOf:e}:{...r,[q]:`Intersect`,allOf:e},t)}function BO(e){return e.every(e=>Aw(e))}function VO(e){return BE(e,[Dw])}function HO(e){return e.map(e=>Aw(e)?VO(e):e)}function UO(e,t){return BO(e)?FO(zO(HO(e),t)):zO(HO(e),t)}function WO(e,t={}){if(e.length===1)return K(e[0],t);if(e.length===0)return VE(t);if(e.some(e=>cT(e)))throw Error(`Cannot intersect transform types`);return UO(e,t)}function GO(e,t){if(e.length===1)return K(e[0],t);if(e.length===0)return VE(t);if(e.some(e=>cT(e)))throw Error(`Cannot intersect transform types`);return zO(e,t)}function KO(...e){let[t,n]=typeof e[0]==`string`?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=`string`)throw new ww(`Ref: $ref must be a string`);return K({[q]:`Ref`,$ref:t},n)}function qO(e,t){return RE(`Awaited`,[RE(e,t)])}function JO(e){return RE(`Awaited`,[KO(e)])}function YO(e){return GO(QO(e))}function XO(e){return ZE(QO(e))}function ZO(e){return $O(e)}function QO(e){return e.map(e=>$O(e))}function $O(e,t){return K(Lw(e)?qO(e.target,e.parameters):Hw(e)?YO(e.allOf):dT(e)?XO(e.anyOf):eT(e)?ZO(e.item):nT(e)?JO(e.$ref):e,t)}function ek(e){let t=[];for(let n of e)t.push(sk(n));return t}function tk(e){return NE(ek(e))}function nk(e){return ME(ek(e))}function rk(e){return e.map((e,t)=>t.toString())}function ik(e){return[`[number]`]}function ak(e){return globalThis.Object.getOwnPropertyNames(e)}function ok(e){return ck?globalThis.Object.getOwnPropertyNames(e).map(e=>e[0]===`^`&&e[e.length-1]===`$`?e.slice(1,e.length-1):e):[]}function sk(e){return Hw(e)?tk(e.allOf):dT(e)?nk(e.anyOf):lT(e)?rk(e.items??[]):Nw(e)?ik(e.items):$w(e)?ak(e.properties):tT(e)?ok(e.patternProperties):[]}var ck=!1;function lk(e,t){return RE(`KeyOf`,[RE(e,t)])}function uk(e){return RE(`KeyOf`,[KO(e)])}function dk(e,t){return K(XE(fk(sk(e))),t)}function fk(e){return e.map(e=>e===`[number]`?OD():TD(e))}function pk(e,t){return Lw(e)?lk(e.target,e.parameters):nT(e)?uk(e.$ref):Jw(e)?gk(e,t):dk(e,t)}function mk(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=pk(e[r],dw(t));return n}function hk(e,t){return mk(e.properties,t)}function gk(e,t){return HE(hk(e,t))}function _k(e){let t=[];for(let n of e)t.push(...sk(n));return kE(t)}function vk(e){return e.filter(e=>!Yw(e))}function yk(e,t){let n=[];for(let r of e)n.push(...nO(r,[t]));return vk(n)}function bk(e,t){let n={};for(let r of t)n[r]=WO(yk(e,r));return n}function xk(e,t){return fO(bk(e,_k(e)),t)}function Sk(e){return K({[q]:`Date`,type:`Date`},e)}function Ck(e){return K({[q]:`Null`,type:`null`},e)}function wk(e){return K({[q]:`Symbol`,type:`symbol`},e)}function Tk(e){return K({[q]:`Undefined`,type:`undefined`},e)}function Ek(e){return K({[q]:`Uint8Array`,type:`Uint8Array`},e)}function Dk(e){return K({[q]:`Unknown`},e)}function Ok(e){return e.map(e=>jk(e,!1))}function kk(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=_O(jk(e[n],!1));return t}function Ak(e,t){return t===!0?e:_O(e)}function jk(e,t){return WC(e)||XC(e)?Ak(PE(),t):GC(e)?_O(xO(Ok(e))):rw(e)?Ek():JC(e)?Sk():$C(e)?Ak(fO(kk(e)),t):YC(e)?Ak(WE([],Dk()),t):iw(e)?Tk():ZC(e)?Ck():nw(e)?wk():KC(e)?DD():QC(e)||qC(e)||tw(e)?TD(e):fO({})}function Mk(e,t){return K(jk(e,!0),t)}function Nk(e,t){return Rw(e)?xO(e.parameters,t):VE(t)}function Pk(e,t){if(iw(e))throw Error(`Enum undefined or empty`);let n=globalThis.Object.getOwnPropertyNames(e).filter(e=>isNaN(e)).map(t=>e[t]);return ZE([...new Set(n)].map(e=>TD(e)),{...t,[Ow]:`Enum`})}var Fk=class extends ww{},J;(function(e){e[e.Union=0]=`Union`,e[e.True=1]=`True`,e[e.False=2]=`False`})(J||={});function Ik(e){return e===J.False?e:J.True}function Lk(e){throw new Fk(e)}function Rk(e){return QT(e)||HT(e)||mE(e)||gE(e)||AT(e)}function zk(e,t){return QT(t)?rA(e,t):HT(t)?$k(e,t):mE(t)?BA(e,t):gE(t)?HA(e,t):AT(t)?Bk(e,t):Lk(`StructuralRight`)}function Bk(e,t){return J.True}function Vk(e,t){return HT(t)?$k(e,t):mE(t)&&t.anyOf.some(e=>AT(e)||gE(e))?J.True:mE(t)?J.Union:gE(t)||AT(t)?J.True:J.Union}function Hk(e,t){return gE(e)?J.False:AT(e)?J.Union:QT(e)?J.True:J.False}function Uk(e,t){return nE(t)&&bA(t)?J.True:Rk(t)?zk(e,t):MT(t)?Ik(KA(e.items,t.items)):J.False}function Wk(e,t){return Rk(t)?zk(e,t):NT(t)?Ik(KA(e.items,t.items)):J.False}function Gk(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?OA(e,t):PT(t)?J.True:J.False}function Kk(e,t){return qT(e)||FT(e)?J.True:J.False}function qk(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?OA(e,t):FT(t)?J.True:J.False}function Jk(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):LT(t)?e.parameters.length>t.parameters.length?J.False:e.parameters.every((e,n)=>Ik(KA(t.parameters[n],e))===J.True)?Ik(KA(e.returns,t.returns)):J.False:J.False}function Yk(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?OA(e,t):RT(t)?J.True:J.False}function Xk(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):zT(t)?e.parameters.length>t.parameters.length?J.False:e.parameters.every((e,n)=>Ik(KA(t.parameters[n],e))===J.True)?Ik(KA(e.returns,t.returns)):J.False:J.False}function Zk(e,t){return JT(e)&&QC(e.const)||tE(e)||BT(e)?J.True:J.False}function Qk(e,t){return BT(t)||tE(t)?J.True:Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?OA(e,t):J.False}function $k(e,t){return t.allOf.every(t=>KA(e,t)===J.True)?J.True:J.False}function eA(e,t){return e.allOf.some(e=>KA(e,t)===J.True)?J.True:J.False}function tA(e,t){return Rk(t)?zk(e,t):UT(t)?Ik(KA(e.items,t.items)):J.False}function nA(e,t){return JT(t)&&t.const===e.const?J.True:Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?OA(e,t):sE(t)?jA(e,t):tE(t)?cA(e,t):BT(t)?Zk(e,t):FT(t)?Kk(e,t):J.False}function rA(e,t){return J.False}function iA(e,t){return J.True}function aA(e){let[t,n]=[e,0];for(;$T(t);)t=t.not,n+=1;return n%2==0?t:Dk()}function oA(e,t){return $T(e)?KA(aA(e),t):$T(t)?KA(e,aA(t)):Lk(`Invalid fallthrough for Not`)}function sA(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?OA(e,t):eE(t)?J.True:J.False}function cA(e,t){return KT(e)||tE(e)||BT(e)?J.True:J.False}function lA(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?OA(e,t):BT(t)||tE(t)?J.True:J.False}function uA(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function dA(e){return bA(e)}function fA(e){return uA(e,0)||uA(e,1)&&`description`in e.properties&&mE(e.properties.description)&&e.properties.description.anyOf.length===2&&(sE(e.properties.description.anyOf[0])&&pE(e.properties.description.anyOf[1])||sE(e.properties.description.anyOf[1])&&pE(e.properties.description.anyOf[0]))}function pA(e){return uA(e,0)}function mA(e){return uA(e,0)}function hA(e){return uA(e,0)}function gA(e){return uA(e,0)}function _A(e){return bA(e)}function vA(e){let t=OD();return uA(e,0)||uA(e,1)&&`length`in e.properties&&Ik(KA(e.properties.length,t))===J.True}function yA(e){return uA(e,0)}function bA(e){let t=OD();return uA(e,0)||uA(e,1)&&`length`in e.properties&&Ik(KA(e.properties.length,t))===J.True}function xA(e){let t=WE([PE()],PE());return uA(e,0)||uA(e,1)&&`then`in e.properties&&Ik(KA(e.properties.then,t))===J.True}function SA(e,t){return KA(e,t)===J.False||kT(e)&&!kT(t)?J.False:J.True}function CA(e,t){return gE(e)?J.False:AT(e)?J.Union:QT(e)||GT(e)&&dA(t)||KT(e)&&pA(t)||qT(e)&&mA(t)||cE(e)&&fA(t)||PT(e)&&hA(t)||sE(e)&&dA(t)||cE(e)&&fA(t)||tE(e)&&pA(t)||BT(e)&&pA(t)||FT(e)&&mA(t)||hE(e)&&_A(t)||RT(e)&&gA(t)||LT(e)&&yA(t)||zT(e)&&vA(t)?J.True:iE(e)&&sE(EA(e))?t[Ow]===`Record`?J.True:J.False:iE(e)&&tE(EA(e))&&uA(t,0)?J.True:J.False}function wA(e,t){return Rk(t)?zk(e,t):iE(t)?OA(e,t):nE(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!kT(t.properties[n]))return J.False;if(kT(t.properties[n]))return J.True;if(SA(e.properties[n],t.properties[n])===J.False)return J.False}return J.True})():J.False}function TA(e,t){return Rk(t)?zk(e,t):nE(t)&&xA(t)?J.True:rE(t)?Ik(KA(e.item,t.item)):J.False}function EA(e){return TE in e.patternProperties?OD():EE in e.patternProperties?kD():Lk(`Unknown record key pattern`)}function DA(e){return TE in e.patternProperties?e.patternProperties[TE]:EE in e.patternProperties?e.patternProperties[EE]:Lk(`Unable to get record value schema`)}function OA(e,t){let[n,r]=[EA(t),DA(t)];return GT(e)&&tE(n)&&Ik(KA(e,r))===J.True?J.True:hE(e)&&tE(n)||sE(e)&&tE(n)||MT(e)&&tE(n)?KA(e,r):nE(e)?(()=>{for(let t of Object.getOwnPropertyNames(e.properties))if(SA(r,e.properties[t])===J.False)return J.False;return J.True})():J.False}function kA(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?KA(DA(e),DA(t)):J.False}function AA(e,t){return KA(oE(e)?kD():e,oE(t)?kD():t)}function jA(e,t){return JT(e)&&tw(e.const)||sE(e)?J.True:J.False}function MA(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?OA(e,t):sE(t)?J.True:J.False}function NA(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?OA(e,t):cE(t)?J.True:J.False}function PA(e,t){return lE(e)?KA(RD(e),t):lE(t)?KA(e,RD(t)):Lk(`Invalid fallthrough for TemplateLiteral`)}function FA(e,t){return MT(t)&&e.items!==void 0&&e.items.every(e=>KA(e,t.items)===J.True)}function IA(e,t){return QT(e)?J.True:gE(e)?J.False:AT(e)?J.Union:J.False}function LA(e,t){return Rk(t)?zk(e,t):nE(t)&&bA(t)||MT(t)&&FA(e,t)?J.True:fE(t)?iw(e.items)&&!iw(t.items)||!iw(e.items)&&iw(t.items)?J.False:iw(e.items)&&!iw(t.items)||e.items.every((e,n)=>KA(e,t.items[n])===J.True)?J.True:J.False:J.False}function RA(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?OA(e,t):hE(t)?J.True:J.False}function zA(e,t){return Rk(t)?zk(e,t):nE(t)?CA(e,t):iE(t)?OA(e,t):vE(t)?WA(e,t):pE(t)?J.True:J.False}function BA(e,t){return t.anyOf.some(t=>KA(e,t)===J.True)?J.True:J.False}function VA(e,t){return e.anyOf.every(e=>KA(e,t)===J.True)?J.True:J.False}function HA(e,t){return J.True}function UA(e,t){return QT(t)?rA(e,t):HT(t)?$k(e,t):mE(t)?BA(e,t):AT(t)?Bk(e,t):sE(t)?jA(e,t):tE(t)?cA(e,t):BT(t)?Zk(e,t):FT(t)?Kk(e,t):MT(t)?Hk(e,t):fE(t)?IA(e,t):nE(t)?CA(e,t):gE(t)?J.True:J.False}function WA(e,t){return pE(e)||pE(e)?J.True:J.False}function GA(e,t){return HT(t)?$k(e,t):mE(t)?BA(e,t):gE(t)?HA(e,t):AT(t)?Bk(e,t):nE(t)?CA(e,t):vE(t)?J.True:J.False}function KA(e,t){return lE(e)||lE(t)?PA(e,t):oE(e)||oE(t)?AA(e,t):$T(e)||$T(t)?oA(e,t):AT(e)?Vk(e,t):MT(e)?Uk(e,t):PT(e)?Gk(e,t):FT(e)?qk(e,t):NT(e)?Wk(e,t):LT(e)?Jk(e,t):RT(e)?Yk(e,t):zT(e)?Xk(e,t):BT(e)?Qk(e,t):HT(e)?eA(e,t):UT(e)?tA(e,t):JT(e)?nA(e,t):QT(e)?iA(e,t):eE(e)?sA(e,t):tE(e)?lA(e,t):nE(e)?wA(e,t):iE(e)?kA(e,t):sE(e)?MA(e,t):cE(e)?NA(e,t):fE(e)?LA(e,t):rE(e)?TA(e,t):hE(e)?RA(e,t):pE(e)?zA(e,t):mE(e)?VA(e,t):gE(e)?UA(e,t):vE(e)?GA(e,t):Lk(`Unknown left type operand '${e[q]}'`)}function qA(e,t){return KA(e,t)}function JA(e,t,n,r,i){let a={};for(let o of globalThis.Object.getOwnPropertyNames(e))a[o]=QA(e[o],t,n,r,dw(i));return a}function YA(e,t,n,r,i){return JA(e.properties,t,n,r,i)}function XA(e,t,n,r,i){return HE(YA(e,t,n,r,i))}function ZA(e,t,n,r){let i=qA(e,t);return i===J.Union?ZE([n,r]):i===J.True?n:r}function QA(e,t,n,r,i){return Jw(e)?XA(e,t,n,r,i):qw(e)?K(nj(e,t,n,r,i)):K(ZA(e,t,n,r),i)}function $A(e,t,n,r,i){return{[e]:QA(TD(e),t,n,r,dw(i))}}function ej(e,t,n,r,i){return e.reduce((e,a)=>({...e,...$A(a,t,n,r,i)}),{})}function tj(e,t,n,r,i){return ej(e.keys,t,n,r,i)}function nj(e,t,n,r,i){return HE(tj(e,t,n,r,i))}function rj(e,t){return aj(RD(e),t)}function ij(e,t){let n=e.filter(e=>qA(e,t)===J.False);return n.length===1?n[0]:ZE(n)}function aj(e,t,n={}){return oT(e)?K(rj(e,t),n):Jw(e)?K(cj(e,t),n):K(dT(e)?ij(e.anyOf,t):qA(e,t)===J.False?e:VE(),n)}function oj(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=aj(e[r],t);return n}function sj(e,t){return oj(e.properties,t)}function cj(e,t){return HE(sj(e,t))}function lj(e,t){return dj(RD(e),t)}function uj(e,t){let n=e.filter(e=>qA(e,t)!==J.False);return n.length===1?n[0]:ZE(n)}function dj(e,t,n){return oT(e)?K(lj(e,t),n):Jw(e)?K(mj(e,t),n):K(dT(e)?uj(e.anyOf,t):qA(e,t)===J.False?VE():e,n)}function fj(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=dj(e[r],t);return n}function pj(e,t){return fj(e.properties,t)}function mj(e,t){return HE(pj(e,t))}function hj(e,t){return Rw(e)?K(e.returns,t):VE(t)}function gj(e){return _O(FO(e))}function _j(e,t,n){return K({[q]:`Record`,type:`object`,patternProperties:{[e]:t}},n)}function vj(e,t,n){let r={};for(let n of e)r[n]=t;return fO(r,{...n,[Ow]:`Record`})}function yj(e,t,n){return _D(e)?vj(UD(e),t,n):_j(e.pattern,t,n)}function bj(e,t,n){return vj(UD(ZE(e)),t,n)}function xj(e,t,n){return vj([e.toString()],t,n)}function Sj(e,t,n){return _j(e.source,t,n)}function Cj(e,t,n){return _j(iw(e.pattern)?EE:e.pattern,t,n)}function wj(e,t,n){return _j(EE,t,n)}function Tj(e,t,n){return _j(DE,t,n)}function Ej(e,t,n){return fO({true:t,false:t},n)}function Dj(e,t,n){return _j(TE,t,n)}function Oj(e,t,n){return _j(TE,t,n)}function kj(e,t,n={}){return dT(e)?bj(e.anyOf,t,n):oT(e)?yj(e,t,n):Kw(e)?xj(e.const,t,n):Iw(e)?Ej(e,t,n):Vw(e)?Dj(e,t,n):Qw(e)?Oj(e,t,n):rT(e)?Sj(e,t,n):iT(e)?Cj(e,t,n):jw(e)?wj(e,t,n):Yw(e)?Tj(e,t,n):VE(n)}function Aj(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function jj(e){let t=Aj(e);return t===EE?kD():t===TE?OD():kD({pattern:t})}function Mj(e){return e.patternProperties[Aj(e)]}function Nj(e,t){return t.parameters=qj(e,t.parameters),t.returns=Jj(e,t.returns),t}function Pj(e,t){return t.parameters=qj(e,t.parameters),t.returns=Jj(e,t.returns),t}function Fj(e,t){return t.allOf=qj(e,t.allOf),t}function Ij(e,t){return t.anyOf=qj(e,t.anyOf),t}function Lj(e,t){return iw(t.items)||(t.items=qj(e,t.items)),t}function Rj(e,t){return t.items=Jj(e,t.items),t}function zj(e,t){return t.items=Jj(e,t.items),t}function Bj(e,t){return t.items=Jj(e,t.items),t}function Vj(e,t){return t.item=Jj(e,t.item),t}function Hj(e,t){let n=Kj(e,t.properties);return{...t,...fO(n)}}function Uj(e,t){let n=kj(Jj(e,jj(t)),Jj(e,Mj(t)));return{...t,...n}}function Wj(e,t){return t.index in e?e[t.index]:Dk()}function Gj(e,t){let n=kw(t),r=Aw(t),i=Jj(e,t);return n&&r?gj(i):n&&!r?_O(i):!n&&r?FO(i):i}function Kj(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:Gj(e,t[r])}),{})}function qj(e,t){return t.map(t=>Jj(e,t))}function Jj(e,t){return Rw(t)?Nj(e,t):Bw(t)?Pj(e,t):Hw(t)?Fj(e,t):dT(t)?Ij(e,t):lT(t)?Lj(e,t):Nw(t)?Rj(e,t):Pw(t)?zj(e,t):Uw(t)?Bj(e,t):eT(t)?Vj(e,t):$w(t)?Hj(e,t):tT(t)?Uj(e,t):Mw(t)?Wj(e,t):t}function Yj(e,t){return Jj(t,fw(e))}function Xj(e){return K({[q]:`Integer`,type:`integer`},e)}function Zj(e,t,n){return{[e]:cM(TD(e),t,dw(n))}}function Qj(e,t,n){return e.reduce((e,r)=>({...e,...Zj(r,t,n)}),{})}function $j(e,t,n){return Qj(e.keys,t,n)}function eM(e,t,n){return HE($j(e,t,n))}function tM(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join(``)}function nM(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join(``)}function rM(e){return e.toUpperCase()}function iM(e){return e.toLowerCase()}function aM(e,t,n){let r=dD(e.pattern);return gD(r)?zD([ZE(sM([...CD(r)].map(e=>TD(e)),t))],n):{...e,pattern:oM(e.pattern,t)}}function oM(e,t){return typeof e==`string`?t===`Uncapitalize`?tM(e):t===`Capitalize`?nM(e):t===`Uppercase`?rM(e):t===`Lowercase`?iM(e):e:e.toString()}function sM(e,t){return e.map(e=>cM(e,t))}function cM(e,t,n={}){return qw(e)?eM(e,t,n):oT(e)?aM(e,t,n):dT(e)?ZE(sM(e.anyOf,t),n):Kw(e)?TD(oM(e.const,t),n):K(e,n)}function lM(e,t={}){return cM(e,`Capitalize`,t)}function uM(e,t={}){return cM(e,`Lowercase`,t)}function dM(e,t={}){return cM(e,`Uncapitalize`,t)}function fM(e,t={}){return cM(e,`Uppercase`,t)}function pM(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=CM(e[i],t,dw(n));return r}function mM(e,t,n){return pM(e.properties,t,n)}function hM(e,t,n){return HE(mM(e,t,n))}function gM(e,t){return e.map(e=>SM(e,t))}function _M(e,t){return e.map(e=>SM(e,t))}function vM(e,t){let{[t]:n,...r}=e;return r}function yM(e,t){return t.reduce((e,t)=>vM(e,t),e)}function bM(e,t,n){let r=BE(e,[Tw,`$id`,`required`,`properties`]);return fO(yM(n,t),r)}function xM(e){return ZE(e.reduce((e,t)=>Gw(t)?[...e,TD(t)]:e,[]))}function SM(e,t){return Hw(e)?GO(gM(e.allOf,t)):dT(e)?ZE(_M(e.anyOf,t)):$w(e)?bM(e,t,e.properties):fO({})}function CM(e,t,n){let r=GC(t)?xM(t):t,i=_T(t)?UD(t):t,a=nT(e),o=nT(t);return Jw(e)?hM(e,i,n):qw(t)?DM(e,t,n):a&&o||!a&&o||a&&!o?RE(`Omit`,[e,r],n):K({...SM(e,i),...n})}function wM(e,t,n){return{[t]:CM(e,[t],dw(n))}}function TM(e,t,n){return t.reduce((t,r)=>({...t,...wM(e,r,n)}),{})}function EM(e,t,n){return TM(e,t.keys,n)}function DM(e,t,n){return HE(EM(e,t,n))}function OM(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=LM(e[i],t,dw(n));return r}function kM(e,t,n){return OM(e.properties,t,n)}function AM(e,t,n){return HE(kM(e,t,n))}function jM(e,t){return e.map(e=>IM(e,t))}function MM(e,t){return e.map(e=>IM(e,t))}function NM(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function PM(e,t,n){let r=BE(e,[Tw,`$id`,`required`,`properties`]);return fO(NM(n,t),r)}function FM(e){return ZE(e.reduce((e,t)=>Gw(t)?[...e,TD(t)]:e,[]))}function IM(e,t){return Hw(e)?GO(jM(e.allOf,t)):dT(e)?ZE(MM(e.anyOf,t)):$w(e)?PM(e,t,e.properties):fO({})}function LM(e,t,n){let r=GC(t)?FM(t):t,i=_T(t)?UD(t):t,a=nT(e),o=nT(t);return Jw(e)?AM(e,i,n):qw(t)?VM(e,t,n):a&&o||!a&&o||a&&!o?RE(`Pick`,[e,r],n):K({...IM(e,i),...n})}function RM(e,t,n){return{[t]:LM(e,[t],dw(n))}}function zM(e,t,n){return t.reduce((t,r)=>({...t,...RM(e,r,n)}),{})}function BM(e,t,n){return zM(e,t.keys,n)}function VM(e,t,n){return HE(BM(e,t,n))}function HM(e,t){return RE(`Partial`,[RE(e,t)])}function UM(e){return RE(`Partial`,[KO(e)])}function WM(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=FO(e[n]);return t}function GM(e,t){let n=BE(e,[Tw,`$id`,`required`,`properties`]);return fO(WM(t),n)}function KM(e){return e.map(e=>qM(e))}function qM(e){return Lw(e)?HM(e.target,e.parameters):nT(e)?UM(e.$ref):Hw(e)?GO(KM(e.allOf)):dT(e)?ZE(KM(e.anyOf)):$w(e)?GM(e,e.properties):Fw(e)||Iw(e)||Vw(e)||Kw(e)||Zw(e)||Qw(e)||iT(e)||aT(e)||uT(e)?e:fO({})}function JM(e,t){return Jw(e)?ZM(e,t):K({...qM(e),...t})}function YM(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=JM(e[r],dw(t));return n}function XM(e,t){return YM(e.properties,t)}function ZM(e,t){return HE(XM(e,t))}function QM(e,t){return RE(`Required`,[RE(e,t)])}function $M(e){return RE(`Required`,[KO(e)])}function eN(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=BE(e[n],[Dw]);return t}function tN(e,t){let n=BE(e,[Tw,`$id`,`required`,`properties`]);return fO(eN(t),n)}function nN(e){return e.map(e=>rN(e))}function rN(e){return Lw(e)?QM(e.target,e.parameters):nT(e)?$M(e.$ref):Hw(e)?GO(nN(e.allOf)):dT(e)?ZE(nN(e.anyOf)):$w(e)?tN(e,e.properties):Fw(e)||Iw(e)||Vw(e)||Kw(e)||Zw(e)||Qw(e)||iT(e)||aT(e)||uT(e)?e:fO({})}function iN(e,t){return Jw(e)?sN(e,t):K({...rN(e),...t})}function aN(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=iN(e[r],t);return n}function oN(e,t){return aN(e.properties,t)}function sN(e,t){return HE(oN(e,t))}function cN(e,t){return t.map(t=>nT(t)?lN(e,t.$ref):AN(e,t))}function lN(e,t){return t in e?nT(e[t])?lN(e,e[t].$ref):AN(e,e[t]):VE()}function uN(e){return $O(e[0])}function dN(e){return iO(e[0],e[1])}function fN(e){return pk(e[0])}function pN(e){return JM(e[0])}function mN(e){return CM(e[0],e[1])}function hN(e){return LM(e[0],e[1])}function gN(e){return iN(e[0])}function _N(e,t,n){let r=cN(e,n);return t===`Awaited`?uN(r):t===`Index`?dN(r):t===`KeyOf`?fN(r):t===`Partial`?pN(r):t===`Omit`?mN(r):t===`Pick`?hN(r):t===`Required`?gN(r):VE()}function vN(e,t){return FE(AN(e,t))}function yN(e,t){return LE(AN(e,t))}function bN(e,t,n){return UE(kN(e,t),AN(e,n))}function xN(e,t,n){return WE(kN(e,t),AN(e,n))}function SN(e,t){return GO(kN(e,t))}function CN(e,t){return lO(AN(e,t))}function wN(e,t){return fO(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:AN(e,t[r])}),{}))}function TN(e,t){let[n,r]=[AN(e,Mj(t)),Aj(t)],i=fw(t);return i.patternProperties[r]=n,i}function EN(e,t){return nT(t)?{...lN(e,t.$ref),[Tw]:t[Tw]}:t}function DN(e,t){return xO(kN(e,t))}function ON(e,t){return ZE(kN(e,t))}function kN(e,t){return t.map(t=>AN(e,t))}function AN(e,t){return Aw(t)?K(AN(e,BE(t,[Dw])),t):kw(t)?K(AN(e,BE(t,[Ew])),t):cT(t)?K(EN(e,t),t):Nw(t)?K(vN(e,t.items),t):Pw(t)?K(yN(e,t.items),t):Lw(t)?K(_N(e,t.target,t.parameters)):Rw(t)?K(bN(e,t.parameters,t.returns),t):Bw(t)?K(xN(e,t.parameters,t.returns),t):Hw(t)?K(SN(e,t.allOf),t):Uw(t)?K(CN(e,t.items),t):$w(t)?K(wN(e,t.properties),t):tT(t)?K(TN(e,t)):lT(t)?K(DN(e,t.items||[]),t):dT(t)?K(ON(e,t.anyOf),t):t}function jN(e,t){return t in e?AN(e,e[t]):VE()}function MN(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:jN(e,n)}),{})}var NN=class{constructor(e){let t=MN(e),n=this.WithIdentifiers(t);this.$defs=n}Import(e,t){let n={...this.$defs,[e]:K(this.$defs[e],t)};return K({[q]:`Import`,$defs:n,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:{...e[n],$id:n}}),{})}};function PN(e){return new NN(e)}function FN(e,t){return K({[q]:`Not`,not:e},t)}function IN(e,t){return Bw(e)?xO(e.parameters,t):VE()}var LN=0;function RN(e,t={}){iw(t.$id)&&(t.$id=`T${LN++}`);let n=fw(e({[q]:`This`,$ref:`${t.$id}`}));return n.$id=t.$id,K({[Ow]:`Recursive`,...n},t)}function zN(e,t){let n=tw(e)?new globalThis.RegExp(e):e;return K({[q]:`RegExp`,type:`RegExp`,source:n.source,flags:n.flags},t)}function BN(e){return Hw(e)?e.allOf:dT(e)?e.anyOf:lT(e)?e.items??[]:[]}function VN(e){return BN(e)}function HN(e,t){return Bw(e)?K(e.returns,t):VE(t)}var UN=class{constructor(e){this.schema=e}Decode(e){return new WN(this.schema,e)}},WN=class{constructor(e,t){this.schema=e,this.decode=t}EncodeTransform(e,t){let n={Encode:n=>t[Tw].Encode(e(n)),Decode:e=>this.decode(t[Tw].Decode(e))};return{...t,[Tw]:n}}EncodeSchema(e,t){let n={Decode:this.decode,Encode:e};return{...t,[Tw]:n}}Encode(e){return cT(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};function GN(e){return new UN(e)}function KN(e={}){return K({[q]:e[q]??`Unsafe`},e)}function qN(e){return K({[q]:`Void`,type:`void`},e)}var Y=s({Any:()=>PE,Argument:()=>IE,Array:()=>FE,AsyncIterator:()=>LE,Awaited:()=>$O,BigInt:()=>DD,Boolean:()=>ED,Capitalize:()=>lM,Composite:()=>xk,Const:()=>Mk,Constructor:()=>UE,ConstructorParameters:()=>Nk,Date:()=>Sk,Enum:()=>Pk,Exclude:()=>aj,Extends:()=>QA,Extract:()=>dj,Function:()=>WE,Index:()=>iO,InstanceType:()=>hj,Instantiate:()=>Yj,Integer:()=>Xj,Intersect:()=>GO,Iterator:()=>lO,KeyOf:()=>pk,Literal:()=>TD,Lowercase:()=>uM,Mapped:()=>jO,Module:()=>PN,Never:()=>VE,Not:()=>FN,Null:()=>Ck,Number:()=>OD,Object:()=>fO,Omit:()=>CM,Optional:()=>FO,Parameters:()=>IN,Partial:()=>JM,Pick:()=>LM,Promise:()=>pO,Readonly:()=>_O,ReadonlyOptional:()=>gj,Record:()=>kj,Recursive:()=>RN,Ref:()=>KO,RegExp:()=>zN,Required:()=>iN,Rest:()=>VN,ReturnType:()=>HN,String:()=>kD,Symbol:()=>wk,TemplateLiteral:()=>zD,Transform:()=>GN,Tuple:()=>xO,Uint8Array:()=>Ek,Uncapitalize:()=>dM,Undefined:()=>Tk,Union:()=>ZE,Unknown:()=>Dk,Unsafe:()=>KN,Uppercase:()=>fM,Void:()=>qN});function JN(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function YN(e,t){return Y.String({pattern:`^${JN(e)}${Ft}$`,...t===void 0?{}:{description:t}})}var X=Y.String({minLength:1,description:`ISO 8601 date-time string`}),XN=Y.String({minLength:1});YN(Lt.project,`ProjectId`);var ZN=YN(Lt.message,`MessageId`),QN=YN(Lt.taskModule,`TaskModuleId`),$N=YN(Lt.task,`TaskId`),eP=YN(Lt.runResult,`RunResultId`),tP=YN(Lt.recoverySummary,`RecoverySummaryId`),nP=YN(Lt.activity,`ActivityRef`),rP=YN(Lt.event,`EventRef`),iP=YN(Lt.workflowInvocation,`WorkflowInvocationRef`),aP=YN(Lt.clarificationThread,`ClarificationThreadRef`),oP=YN(Lt.clarificationRound,`ClarificationRoundRef`);YN(Lt.clarificationInteractionResponse,`ClarificationInteractionResponseId`);var sP=YN(Lt.approvalRequest,`ApprovalRequestId`),cP=YN(Lt.idempotency,`IdempotencyKey`),lP=YN(Lt.relayProject,`RelayProjectRef`);YN(Lt.relayAccount,`RelayAccountRef`),YN(Lt.relayMembership,`RelayMembershipRef`),YN(Lt.relayAccountSession,`RelayAccountSessionRef`),YN(Lt.relayClientSession,`RelayClientSessionId`);var uP=YN(Lt.relayUpload,`RelayUploadRef`);YN(Lt.relayAuthChallenge,`RelayAuthChallengeRef`),YN(Lt.hostConnection,`HostConnectionRef`),YN(Lt.joinToken,`JoinTokenRef`);var dP=Y.Union([Y.Literal(`project_context_bootstrap`),Y.Literal(`scratchpad_refresh`),Y.Literal(`task_compile`),Y.Literal(`context_sync`),Y.Literal(`reference_summary_refresh`),Y.Literal(`recovery_check`),Y.Literal(`follow_up_check`)]);Y.Object({cursor:Y.Optional(XN),limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50}))},{additionalProperties:!1});function fP(e){return Y.Object({items:Y.Array(e),page:Y.Object({next_cursor:Y.Optional(XN),has_more:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:200})},{additionalProperties:!1})},{additionalProperties:!1})}function pP(e){return Y.Object({items:Y.Array(e),window:Y.Object({older_cursor:Y.Optional(XN),newer_cursor:Y.Optional(XN),has_older:Y.Boolean(),has_newer:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:200})},{additionalProperties:!1})},{additionalProperties:!1})}var mP=Y.Union([Y.Object({kind:Y.Literal(`all`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`workspace`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`session`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`bootstrap`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`messages`),scope:Y.Literal(`main_chat`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`messages`),scope:Y.Literal(`clarification_round`),round_id:oP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`scratchpad`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`worklist`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`read_state`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task`),task_id:$N},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task_detail`),task_id:$N},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task_run_results`),task_id:$N},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification`),thread_id:Y.Optional(aP),round_id:Y.Optional(oP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`execution_status`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`activity`),activity_ref:nP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_config`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_usage`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project_timeline`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`skills`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`artifacts`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`approval`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`viewer`),path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`recovery_summaries`)},{additionalProperties:!1})]);Y.Object({kind:Y.String({minLength:1})});var hP=Y.Object({kind:Y.Literal(`interrupted`),retry_with_new_command_id:Y.Literal(!0)},{additionalProperties:!1});function gP(e){return Y.Object({command_id:cP,issued_at:X,payload:e},{additionalProperties:!1})}function _P(e){return Y.Object({command_id:cP,disposition:e,invalidates:Y.Optional(Y.Array(mP))},{additionalProperties:!1})}function vP(e,t){return Y.Object({command_id:cP,disposition:e,result:Y.Optional(t),invalidates:Y.Optional(Y.Array(mP))},{additionalProperties:!1})}var yP=Y.Union([Y.Literal(`bad_request`),Y.Literal(`unauthorized`),Y.Literal(`forbidden`),Y.Literal(`not_found`),Y.Literal(`conflict`),Y.Literal(`validation_failed`),Y.Literal(`provider_not_configured`),Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`),Y.Literal(`relay_session_invalid`),Y.Literal(`command_replay_mismatch`),Y.Literal(`repo_snapshot_unavailable`),Y.Literal(`host_unavailable`),Y.Literal(`internal_error`)]);Y.Object({error:Y.Object({code:yP,message:Y.String({minLength:1}),retryable:Y.Boolean(),details:Y.Optional(Y.Unknown())},{additionalProperties:!1})},{additionalProperties:!1}),Y.Union([Y.Literal(`connection.ready`),Y.Literal(`message.created`),Y.Literal(`scratchpad.updated`),Y.Literal(`worklist.changed`),Y.Literal(`task.updated`),Y.Literal(`task_detail.updated`),Y.Literal(`clarification.changed`),Y.Literal(`approval.changed`),Y.Literal(`activity.event`),Y.Literal(`execution_status.changed`),Y.Literal(`provider_config.changed`),Y.Literal(`workspace.recovered`),Y.Literal(`query.invalidate`)]),Y.Union([Y.Object({kind:Y.Literal(`all`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`me`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`recent_projects`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`join_entries`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project_presence`),relay_project_ref:lP},{additionalProperties:!1})]),Y.Union([Y.Literal(`connection.ready`),Y.Literal(`query.invalidate`)]);var bP=Y.Object({retention_seconds:Y.Literal(300),max_events:Y.Literal(1e3)},{additionalProperties:!1}),Z=Y.String({minLength:1}),xP=Y.Union([Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`),Y.Literal(`unknown`)]),SP=xP,CP=Y.Union([Y.Object({status:Y.Literal(`not_configured`)},{additionalProperties:!1}),Y.Object({status:Y.Literal(`configured`),provider:Y.Literal(`openai`),auth_kind:Y.Literal(`api_key`),redacted_key:Z,default_model:Z,validated_at:X},{additionalProperties:!1}),Y.Object({status:Y.Literal(`invalid`),provider:Y.Optional(Y.Literal(`openai`)),auth_kind:Y.Optional(Y.Literal(`api_key`)),redacted_key:Y.Optional(Z),default_model:Y.Optional(Z),validated_at:Y.Optional(X),invalid_reason_code:Y.Optional(xP)},{additionalProperties:!1})]),wP=Y.Union([Y.Literal(`implementation`),Y.Literal(`planning`),Y.Literal(`context`),Y.Literal(`qna`),Y.Literal(`other`)]),TP=Y.Object({input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),EP=Y.Object({source:Y.String({minLength:1}),label:Y.String({minLength:1}),category:wP,input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),DP=Y.Object({model:Y.String({minLength:1}),input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),OP=Y.Object({total_tokens:Y.Integer({minimum:0}),totals:TP,by_source:Y.Array(EP),by_model:Y.Array(DP),recent_windows:Y.Object({today:TP,last_7_days:TP,last_30_days:TP},{additionalProperties:!1})},{additionalProperties:!1}),kP=Y.Union([Y.Literal(`task_accepted`),Y.Literal(`task_update`),Y.Literal(`checkpoint`)]),AP=Y.Union([Y.Literal(`completed`),Y.Literal(`failed`),Y.Literal(`needs_human`)]),jP=Y.Union([Y.Literal(`needs_input`),Y.Literal(`completed`),Y.Literal(`failed`)]),MP=Y.Union([Y.Literal(`neutral`),Y.Literal(`success`),Y.Literal(`warning`),Y.Literal(`error`)]),NP=Y.Object({kind:Y.Union([Y.Literal(`worklist_task`),Y.Literal(`chat_message`),Y.Literal(`reference_file`),Y.Literal(`repo_path`)]),label:Y.String({minLength:1}),task_id:Y.Optional($N),message_id:Y.Optional(ZN),path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1}),PP=Y.Object({message_id:ZN,author:Y.String({minLength:1}),body:Y.String(),created_at:X},{additionalProperties:!1}),FP=Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.String({minLength:1}),source:Y.Optional(Y.Union([Y.Literal(`scratchpad`),Y.Literal(`clarification`),Y.Literal(`contract`)]))},{additionalProperties:!1}),IP=Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),request:Y.Optional(Y.String()),status:Y.Optional(Y.Union([Y.Literal(`active`),Y.Literal(`resolved`)])),answer_count:Y.Optional(Y.Integer({minimum:0})),answers:Y.Optional(Y.Array(PP))},{additionalProperties:!1}),LP=Y.Union([Y.Literal(`added`),Y.Literal(`modified`),Y.Literal(`deleted`),Y.Literal(`renamed`),Y.Literal(`unknown`)]),RP=Y.Object({tone:MP,summary:Y.Optional(Y.String()),origin:Y.Optional(Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),snippets:Y.Optional(Y.Array(PP)),source_count:Y.Optional(Y.Integer({minimum:0})),unavailable_reason:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),decisions:Y.Optional(Y.Array(FP)),clarification:Y.Optional(IP),contract:Y.Optional(Y.Object({goal:Y.String(),scope:Y.Array(Y.String()),truncated:Y.Optional(Y.Boolean())},{additionalProperties:!1})),result:Y.Optional(Y.Object({summary:Y.String(),error_code:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),changes:Y.Optional(Y.Object({items:Y.Array(Y.Object({status:LP,path:Y.String({minLength:1}),previous_path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),total_count:Y.Integer({minimum:0}),truncated:Y.Boolean()},{additionalProperties:!1})),verification:Y.Optional(Y.Object({checks:Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)]),skip_reason_code:Y.Optional(Y.String({minLength:1})),skip_reason_summary:Y.Optional(Y.String())},{additionalProperties:!1})),promotion:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`promoted`),Y.Literal(`not_promoted`),Y.Literal(`not_attempted`)]),commit_oid:Y.Optional(Y.String({minLength:1})),commit_short_oid:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),reason_code:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),checkpoint:Y.Optional(Y.Object({counters:Y.Object({completed:Y.Integer({minimum:0}),failed:Y.Integer({minimum:0}),remaining:Y.Integer({minimum:0})},{additionalProperties:!1}),items:Y.Array(Y.Object({task_id:$N,title:Y.String({minLength:1}),status:Y.Union([Y.Literal(`done`),Y.Literal(`failed`)]),summary:Y.String()},{additionalProperties:!1})),generated_files:Y.Optional(Y.Array(Y.Object({path:Y.String({minLength:1}),name:Y.String({minLength:1})},{additionalProperties:!1}))),truncated:Y.Optional(Y.Boolean())},{additionalProperties:!1})),links:Y.Array(NP)},{additionalProperties:!1}),zP=Y.Object({id:Y.String({minLength:1}),kind:kP,occurred_at:X,title:Y.String({minLength:1}),summary:Y.Optional(Y.String()),task_id:Y.Optional($N),task_title:Y.Optional(Y.String({minLength:1})),activity_ref:Y.Optional(nP),workflow_ref:Y.Optional(iP),run_result_id:Y.Optional(eP),message_id:Y.Optional(ZN),status:Y.Optional(AP),update_state:Y.Optional(jP),token_usage:Y.Optional(TP),usage_sources:Y.Optional(Y.Array(EP)),usage_models:Y.Optional(Y.Array(DP)),trace_card:Y.Optional(RP)},{additionalProperties:!1});Y.Object({generated_at:X,usage_overview:OP,items:Y.Array(zP)},{additionalProperties:!1});var BP=10*1024*1024,VP=50*1024*1024,HP=VP,UP=Y.Union([Y.Literal(`reference_file`),Y.Literal(`skill_zip`)]),WP=Y.String({pattern:`^sha256:[a-f0-9]{64}$`});function GP(e){return{upload_id:uP,file_name:Z,size_bytes:Y.Integer({minimum:1,maximum:e}),sha256:WP,media_type:Y.Optional(Z)}}function KP(e){return e===`skill_zip`?VP:BP}var qP=GP(HP),JP=GP(BP),YP=GP(VP),XP={relay_project_ref:lP,file_name:Z,sha256:WP,media_type:Y.Optional(Z)},ZP=Y.Object({...XP,purpose:Y.Literal(`reference_file`),size_bytes:Y.Integer({minimum:1,maximum:BP})},{additionalProperties:!1}),QP=Y.Object({...XP,purpose:Y.Literal(`skill_zip`),size_bytes:Y.Integer({minimum:1,maximum:VP})},{additionalProperties:!1});Y.Object(qP,{additionalProperties:!1});var $P=Y.Union([ZP,QP]),eF=Y.Object({upload_id:uP,relay_project_ref:lP,purpose:UP,file_name:Z,size_bytes:Y.Integer({minimum:1,maximum:HP}),sha256:WP,media_type:Y.Optional(Z),expires_at:X},{additionalProperties:!1}),tF=Y.Object({method:Y.Literal(`PUT`),url:Y.String({minLength:1}),headers:Y.Optional(Y.Record(Y.String({minLength:1}),Y.String()))},{additionalProperties:!1}),nF=Y.Union([Y.Object({kind:Y.Literal(`started`)},{additionalProperties:!1})]),rF=Y.Object({upload:eF,put:tF},{additionalProperties:!1});gP($P),vP(nF,rF);var iF=Y.Union([Y.Literal(`chat`),Y.Literal(`worklist`),Y.Literal(`references`),Y.Literal(`skills`)]),aF=Y.Object({scope:iF,latest_event_cursor:Y.Integer({minimum:0}),read_event_cursor:Y.Integer({minimum:0}),has_unread:Y.Boolean(),updated_at:Y.Optional(X)},{additionalProperties:!1}),oF=Y.Object({generated_at:X,scopes:Y.Object({chat:aF,worklist:aF,references:aF,skills:aF},{additionalProperties:!1})},{additionalProperties:!1}),sF=Y.Object({scope:iF,up_to_event_cursor:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1}),cF=Y.Union([Y.Object({kind:Y.Literal(`marked`)},{additionalProperties:!1}),hP]),lF=Y.Object({read_state:oF},{additionalProperties:!1});gP(sF),vP(cF,lF);var uF=Y.Object({attempt:Y.Integer({minimum:1}),kind:Y.Union([Y.Literal(`initial`),Y.Literal(`continuation`),Y.Literal(`retry`)]),parent_activity_ref:Y.Optional(nP),root_activity_ref:Y.Optional(nP)},{additionalProperties:!1}),dF=Y.Union([Y.Object({kind:Y.Literal(`task`),task_id:$N},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`workflow`),workflow_ref:iP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification_round`),clarification_round_ref:oP},{additionalProperties:!1})]),fF=Y.Union([Y.Literal(`todo`),Y.Literal(`running`),Y.Literal(`pending`),Y.Literal(`done`),Y.Literal(`failed`)]),pF=Y.Object({task_id:$N,title:Z,summary:Y.String(),status:fF,module_id:QN,module_name:Z},{additionalProperties:!1}),mF=Y.Object({workflow_ref:iP,activity_ref:nP,topic:Y.String(),background_summary:Y.String(),current_consensus:Y.Array(Y.String()),open_questions:Y.Array(Y.String()),task_changes:Y.Array(Y.String()),submitted_at:X,compiled_tasks:Y.Optional(Y.Array(pF))},{additionalProperties:!1}),hF=Y.Object({id:Y.Literal(`current`),state:Y.Union([Y.Literal(`empty`),Y.Literal(`ready`),Y.Literal(`submitted`)]),topic:Y.String(),background_summary:Y.String(),current_consensus:Y.Array(Y.String()),open_questions:Y.Array(Y.String()),task_changes:Y.Array(Y.String()),updated_by_activity_ref:Y.Optional(nP),updated_at:Y.Optional(X),submitted_by_activity_ref:Y.Optional(nP),submitted_by_workflow_ref:Y.Optional(iP),submitted_at:Y.Optional(X),receipts:Y.Array(mF)},{additionalProperties:!1}),gF=Y.Object({id:QN,name:Z,summary:Y.Optional(Y.String()),order:Y.Integer(),archived:Y.Boolean(),created_at:X,updated_at:Y.Optional(X)},{additionalProperties:!1}),_F=Y.Object({id:$N,module_id:QN,title:Z,summary:Y.String(),status:fF,order:Y.Integer(),current_activity_ref:Y.Optional(nP),active_clarification_thread_ref:Y.Optional(aP),latest_run_result_id:Y.Optional(eP),created_from_workflow_ref:iP,created_at:X,updated_at:X},{additionalProperties:!1});Y.Object({modules:Y.Array(Y.Object({module:gF,tasks:Y.Array(_F)},{additionalProperties:!1})),updated_at:Y.Optional(X)},{additionalProperties:!1});var vF=Y.Object({goal:Y.String(),scope:Y.Array(Y.String())},{additionalProperties:!1}),yF=Y.Union([Y.Literal(`no_validation_command_found`),Y.Literal(`project_has_no_test_setup`),Y.Literal(`validation_not_applicable`),Y.Literal(`command_prerequisite_missing`),Y.Literal(`command_requires_external_service`),Y.Literal(`command_requires_secret`),Y.Literal(`command_requires_interactive_input`),Y.Literal(`command_too_expensive_for_mvp`),Y.Literal(`unsafe_command_blocked`),Y.Literal(`known_failing_baseline`)]),bF=Y.Object({status:Y.Union([Y.Literal(`succeeded`),Y.Literal(`failed`),Y.Literal(`unknown`)]),target:Y.Optional(Z),redacted_summary:Y.String(),started_at:Y.Optional(X),finished_at:Y.Optional(X)},{additionalProperties:!1}),xF=Y.Object({latest_run_result_id:Y.Optional(eP),result_kind:Y.Optional(Y.Union([Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`)])),run_lineage:Y.Optional(uF),clarification_thread_ref:Y.Optional(aP),outcome:Y.Optional(Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)])),summary:Y.Optional(Y.String()),checks:Y.Optional(Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)])),docs:Y.Optional(Y.Union([Y.Literal(`updated`),Y.Literal(`checked_no_change`),Y.Literal(`not_checked`),Y.Literal(`sync_deferred`)])),skip_reason_code:Y.Optional(yF),skip_reason_summary:Y.Optional(Y.String()),external_side_effects:Y.Optional(Y.Array(bF)),changed_paths:Y.Optional(Y.Array(Y.String())),user_note_candidate:Y.Optional(Y.String()),promotion:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`promoted`),Y.Literal(`not_promoted`),Y.Literal(`not_attempted`)]),summary:Y.Optional(Y.String()),reason_code:Y.Optional(Z),commit_oid:Y.Optional(Z)},{additionalProperties:!1})),error_code:Y.Optional(Z),retryable:Y.Optional(Y.Boolean()),updated_at:Y.Optional(X)},{additionalProperties:!1}),SF=Y.Object({task:_F,detail:Y.Object({task_id:$N,contract:vF,result:xF,frozen_contract_since_activity_ref:Y.Optional(nP),updated_at:X},{additionalProperties:!1})},{additionalProperties:!1});fP(Y.Union([Y.Object({id:eP,activity_ref:nP,task_id:$N,run_lineage:uF,result_kind:Y.Literal(`needs_human`),summary:Y.String(),clarification_thread_ref:aP,created_at:X},{additionalProperties:!1}),Y.Object({id:eP,activity_ref:nP,task_id:$N,run_lineage:uF,result_kind:Y.Literal(`finished`),outcome:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),summary:Y.String(),user_note_candidate:Y.Optional(Y.String()),checks:Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)]),docs:Y.Union([Y.Literal(`updated`),Y.Literal(`checked_no_change`),Y.Literal(`not_checked`),Y.Literal(`sync_deferred`)]),skip_reason_code:Y.Optional(yF),skip_reason_summary:Y.Optional(Y.String()),external_side_effects:Y.Optional(Y.Array(bF)),created_at:X},{additionalProperties:!1}),Y.Object({id:eP,activity_ref:nP,task_id:$N,run_lineage:uF,result_kind:Y.Literal(`failed`),summary:Y.String(),error_code:Z,retryable:Y.Boolean(),created_at:X},{additionalProperties:!1})]));var CF=Y.Object({recovery_summary_id:tP,summary:Y.String({minLength:1}),affected_activities:Y.Array(nP),affected_activity_count:Y.Integer({minimum:0}),created_at:X},{additionalProperties:!1});fP(CF),Y.Object({recovery_summary:CF},{additionalProperties:!1});var wF=Y.Union(or.map(e=>Y.Literal(e))),TF=Y.Union([Y.Object({kind:Y.Literal(`initials`),initials:Y.String({minLength:1}),color:wF},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`image`),image_url:Y.String({minLength:1}),initials:Y.String({minLength:1}),color:wF},{additionalProperties:!1})]),EF=Y.Union([Y.Object({kind:Y.Literal(`main_chat`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification_round`),clarification_round_ref:oP},{additionalProperties:!1})]),DF=Y.Object({kind:Y.Union([Y.Literal(`human`),Y.Literal(`system`),Y.Literal(`agent`)]),ref:Y.Optional(Z),display_name:Y.Optional(Z),avatar:Y.Optional(TF)},{additionalProperties:!1}),OF=Y.Union([Y.Literal(`user_text`),Y.Literal(`agent_text`),Y.Literal(`system_notice`),Y.Literal(`clarification_request`),Y.Literal(`clarification_card`)]),kF=Y.Union([Y.Literal(`file`),Y.Literal(`image`)]),AF=Y.Object({path:Y.String({minLength:1}),name:Z,source:Y.Union([Y.Literal(`human_upload`),Y.Literal(`tutti_output`)]),category:kF,blob_oid:Y.Optional(Z),media_type:Y.Optional(Z),size_bytes:Y.Integer({minimum:0}),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(Y.Union([Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unsupported_encoding`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`unknown`)]))},{additionalProperties:!1})},{additionalProperties:!1}),jF=Y.Object({task_id:$N,title:Z,status:Y.Union([Y.Literal(`done`),Y.Literal(`failed`)]),summary:Y.String(),module_name:Y.Optional(Z),latest_run_result_id:Y.Optional(eP)},{additionalProperties:!1}),MF=Y.Object({path:Y.String({minLength:1}),name:Z,group:Y.Optional(Z),size_bytes:Y.Integer({minimum:0}),media_type:Y.Optional(Z)},{additionalProperties:!1}),NF=Y.Object({kind:Y.Literal(`worklist_terminal`),status:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),reason:Y.Union([Y.Literal(`all_tasks_done`),Y.Literal(`run_failed`)]),title:Z,feedback_key:Z,counters:Y.Object({completed:Y.Integer({minimum:0}),failed:Y.Integer({minimum:0}),remaining:Y.Integer({minimum:0})},{additionalProperties:!1}),items:Y.Array(jF),final_note:Y.Optional(Y.String()),generated_files:Y.Optional(Y.Array(MF)),primary_task_id:Y.Optional($N)},{additionalProperties:!1}),PF=Y.Object({kind:Y.Literal(`task_result`),status:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),title:Z,task_id:$N,task_title:Z,result_key:Z,summary:Y.String(),module_name:Y.Optional(Z),latest_run_result_id:Y.Optional(eP),activity_ref:Y.Optional(nP),final_note:Y.Optional(Y.String()),generated_files:Y.Optional(Y.Array(MF)),error_code:Y.Optional(Z)},{additionalProperties:!1}),FF=Y.Object({kind:Y.Literal(`worklist_compile`),workflow_ref:iP,title:Z,task_count:Y.Integer({minimum:0}),tasks:Y.Array(pF)},{additionalProperties:!1}),IF=Y.Object({kind:Y.Literal(`artifact_preview`),title:Z,status:Y.Union([Y.Literal(`available`),Y.Literal(`updated`)]),task_id:Y.Optional($N),run_result_id:Y.Optional(eP)},{additionalProperties:!1}),LF=Y.Object({task_id:Y.Optional($N),activity_ref:Y.Optional(nP),workflow_ref:Y.Optional(iP),clarification_thread_ref:Y.Optional(aP),clarification_round_ref:Y.Optional(oP),scratchpad_source:Y.Optional(Y.Union([Y.Literal(`include`),Y.Literal(`exclude`)])),reference_file:Y.Optional(AF),worklist_compile:Y.Optional(FF),worklist_feedback:Y.Optional(NF),task_result:Y.Optional(PF),artifact_preview:Y.Optional(IF)},{additionalProperties:!1}),RF=Y.Object({id:ZN,scope:EF,author:DF,message_kind:OF,body:Y.String(),refs:Y.Optional(LF),clarification_card:Y.Optional(Y.Object({thread_id:aP,round_id:oP,title:Y.Optional(Z),summary:Z,status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),is_current_round:Y.Boolean()},{additionalProperties:!1})),created_at:X},{additionalProperties:!1});pP(RF);var zF=Y.Object({body:Y.String({minLength:1,maxLength:8e3})},{additionalProperties:!1}),BF=Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),VF=Y.Union([BF,hP]),HF=Y.Object({message:RF},{additionalProperties:!1});Y.Object({limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50})),anchor:Y.Optional(Y.Union([Y.Literal(`latest`),Y.Literal(`start`)])),before:Y.Optional(XN),after:Y.Optional(XN),around:Y.Optional(ZN)},{additionalProperties:!1}),gP(zF),vP(VF,HF),Y.Object({message:RF},{additionalProperties:!1});var UF=Y.Union([Y.Literal(`command_execution`),Y.Literal(`file_change`),Y.Literal(`permissions`),Y.Literal(`legacy_exec_command`),Y.Literal(`legacy_apply_patch`)]),WF=Y.Union([Y.Literal(`allow_once`),Y.Literal(`allow_session`),Y.Literal(`deny`),Y.Literal(`cancel`)]),GF=Y.Union([Y.Literal(`primary`),Y.Literal(`neutral`),Y.Literal(`danger`)]),KF=Y.Object({decision_id:Z,kind:WF,label:Z,tone:GF},{additionalProperties:!1}),qF=Y.Object({text:Z,cwd_label:Y.Optional(Z),actions:Y.Optional(Y.Array(Y.Object({label:Z,detail:Y.Optional(Z)},{additionalProperties:!1}))),network:Y.Optional(Y.Object({host:Z,protocol:Z},{additionalProperties:!1}))},{additionalProperties:!1}),JF=Y.Object({grant_root_label:Y.Optional(Z),paths:Y.Optional(Y.Array(Z))},{additionalProperties:!1}),YF=Y.Object({network:Y.Optional(Y.Object({enabled:Y.Boolean()},{additionalProperties:!1})),filesystem:Y.Optional(Y.Object({read:Y.Optional(Y.Array(Z)),write:Y.Optional(Y.Array(Z))},{additionalProperties:!1}))},{additionalProperties:!1}),XF=Y.Object({approval_id:sP,request_kind:UF,title:Z,summary:Z,reason:Y.Optional(Z),requested_at:X,expires_at:Y.Optional(X),task_id:Y.Optional($N),activity_ref:Y.Optional(nP),command:Y.Optional(qF),file_change:Y.Optional(JF),permissions:Y.Optional(YF),decisions:Y.Array(KF,{minItems:1})},{additionalProperties:!1}),ZF=Y.Union([Y.Literal(`accepted`),Y.Literal(`declined`),Y.Literal(`cancelled`),Y.Literal(`expired`)]),QF=Y.Object({decision_id:Z,label:Z,outcome:ZF,decided_at:X,decided_by:Y.Optional(Y.Object({account_ref:Z,display_name:Z},{additionalProperties:!1}))},{additionalProperties:!1}),$F=Y.Union([Y.Object({state:Y.Literal(`none`)},{additionalProperties:!1}),Y.Object({state:Y.Literal(`pending`),request:XF},{additionalProperties:!1}),Y.Object({state:Y.Literal(`resolved`),request:XF,resolution:QF},{additionalProperties:!1})]),eI=Y.Object({decision_id:Z},{additionalProperties:!1}),tI=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_approval`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`decision_unavailable`)},{additionalProperties:!1}),hP]),nI=Y.Object({approval:Y.Optional($F)},{additionalProperties:!1});gP(eI),vP(tI,nI);var rI=Y.Union([Y.Object({ref_kind:Y.Literal(`project_doc`),path:Z},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`directory_readme`),path:Z},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`task_detail`),task_id:$N},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`worklist`),module_id:Y.Optional(QN),task_id:Y.Optional($N)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`scratchpad`),id:Y.Literal(`current`)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`clarification_round`),clarification_round_ref:oP},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`chat_messages`),message_refs:Y.Array(ZN)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`repo_paths`),paths:Y.Array(Z)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`recovery_summary`),recovery_summary_id:tP},{additionalProperties:!1})]),iI=Y.Object({kind:Y.Literal(`freeform`),purpose:Y.Union([Y.Literal(`clarify_requirement`),Y.Literal(`confirm_risk`)]),prompt:Y.Object({title:Y.Optional(Z),summary:Z,request:Z},{additionalProperties:!1}),subject:Y.Optional(Y.Object({kind:Y.Union([Y.Literal(`task`),Y.Literal(`deployment_target`),Y.Literal(`project_context`)]),ref:Y.Optional(Z),summary:Z},{additionalProperties:!1})),expires_when:Y.Optional(Y.Union([Y.Literal(`current_run_only`),Y.Literal(`until_task_contract_changes`)]))},{additionalProperties:!1});Y.Object({summary:Z,request:Z,interaction:Y.Optional(iI)},{additionalProperties:!1});var aI=Y.Object({summary:Z,request:Z,interaction:Y.Optional(iI),title:Y.Optional(Z),related_refs:Y.Optional(Y.Array(rI))},{additionalProperties:!1}),oI=Y.Union([Y.Object({kind:Y.Literal(`task_compile`),workflow_ref:iP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task`),task_id:$N},{additionalProperties:!1})]),sI=Y.Object({id:aP,owner:oI,status:Y.Union([Y.Literal(`active`),Y.Literal(`closed`)]),current_round_id:Y.Optional(oP),created_from_activity_ref:Y.Optional(nP),closed_reason:Y.Optional(Y.Union([Y.Literal(`resolved`),Y.Literal(`contract_changed`),Y.Literal(`cancelled`)])),created_at:X,updated_at:X},{additionalProperties:!1}),cI=Y.Union([Y.Object({kind:Y.Literal(`next_round`),clarification_round_ref:oP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`run`),activity_ref:nP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`proposal_applied`),workflow_ref:iP},{additionalProperties:!1})]),lI=Y.Object({id:oP,thread_id:aP,round_index:Y.Integer({minimum:1}),status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),request_payload:aI,card_message_id:ZN,opening_message_id:ZN,submitted_at:Y.Optional(X),submitted_message_refs:Y.Optional(Y.Array(ZN)),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),successor_ref:Y.Optional(cI),capabilities:Y.Object({send_message:Y.Boolean(),submit:Y.Boolean()},{additionalProperties:!1}),created_at:X,updated_at:X},{additionalProperties:!1});Y.Union([Y.Object({state:Y.Literal(`none`)},{additionalProperties:!1}),Y.Object({state:Y.Literal(`active`),thread:sI,round:lI},{additionalProperties:!1})]);var uI=Y.Object({id:oP,thread_id:aP,round_index:Y.Integer({minimum:1}),status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),title:Y.Optional(Z),summary:Z,submitted_at:Y.Optional(X),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),created_at:X,updated_at:X},{additionalProperties:!1});Y.Object({thread:sI,rounds:Y.Array(uI)},{additionalProperties:!1}),Y.Object({thread:sI,round:lI},{additionalProperties:!1}),Y.Object({limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50})),anchor:Y.Optional(Y.Union([Y.Literal(`start`),Y.Literal(`latest`)])),before:Y.Optional(XN),after:Y.Optional(XN)},{additionalProperties:!1});var dI=Y.Object({body:Y.String({minLength:1,maxLength:8e3})},{additionalProperties:!1}),fI=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_round`),current_round_id:Y.Optional(oP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),hP]),pI=Y.Object({message:Y.Optional(RF)},{additionalProperties:!1});gP(dI),vP(fI,pI);var mI=Y.Object({},{additionalProperties:!1}),hI=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_submitted`),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),successor_ref:Y.Optional(cI)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_round`),current_round_id:Y.Optional(oP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),hP]),gI=Y.Object({round:Y.Optional(lI),materialization:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`queued`),Y.Literal(`already_materialized`)]),successor_ref:Y.Optional(cI)},{additionalProperties:!1}))},{additionalProperties:!1});gP(mI),vP(hI,gI),Y.Object({reason:Y.Union([Y.Literal(`round_opened`),Y.Literal(`round_message_created`),Y.Literal(`round_submitted`),Y.Literal(`successor_materialized`),Y.Literal(`chain_closed`),Y.Literal(`recovered`)]),thread_id:aP,round_id:Y.Optional(oP),successor_ref:Y.Optional(cI)},{additionalProperties:!1});var _I=Y.String(),vI=Y.Object({source:Y.Literal(`mainline`),branch:Y.Literal(`tutti/mainline`),head:Y.Optional(Y.Object({oid:Z,short_oid:Z},{additionalProperties:!1})),mainline_clean:Y.Boolean(),generated_at:X},{additionalProperties:!1}),yI=Y.Union([Y.Literal(`product`),Y.Literal(`tech`),Y.Literal(`structure`),Y.Literal(`architecture_principles`)]),bI=Y.Union([Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`binary`),Y.Literal(`unsupported_encoding`),Y.Literal(`too_large`)]),xI=Y.Object({doc_key:yI,path:_I,status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`unreadable`)]),unreadable_reason:Y.Optional(bI),size_bytes:Y.Optional(Y.Integer({minimum:0})),blob_oid:Y.Optional(Z),last_commit:Y.Optional(Y.Object({oid:Z,short_oid:Z,committed_at:X,title:Y.Optional(Z)},{additionalProperties:!1}))},{additionalProperties:!1}),SI=Y.Union([Y.Literal(`directory`),Y.Literal(`symlink`),Y.Literal(`submodule`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unknown`)]),CI=Y.Object({path:_I,name:Y.String(),kind:Y.Union([Y.Literal(`directory`),Y.Literal(`file`),Y.Literal(`symlink`),Y.Literal(`submodule`)]),depth:Y.Integer({minimum:0}),parent_path:Y.Optional(_I),size_bytes:Y.Optional(Y.Integer({minimum:0})),blob_oid:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),has_children:Y.Optional(Y.Boolean()),project_doc_key:Y.Optional(yI),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(SI)},{additionalProperties:!1})},{additionalProperties:!1}),wI=Y.Union([Y.Object({kind:Y.Literal(`text`),encoding:Y.Literal(`utf-8`),text:Y.String(),truncated:Y.Boolean(),bytes_returned:Y.Integer({minimum:0}),total_bytes:Y.Integer({minimum:0}),line_count:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`omitted`),reason:Y.Union([Y.Literal(`binary`),Y.Literal(`unsupported_encoding`),Y.Literal(`too_large`)]),total_bytes:Y.Integer({minimum:0})},{additionalProperties:!1})]),TI=Y.Object({path:_I,name:Z,kind:Y.Literal(`file`),size_bytes:Y.Integer({minimum:0}),blob_oid:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),media_type:Y.Optional(Z)},{additionalProperties:!1});Y.Object({snapshot:vI,docs:Y.Array(xI)},{additionalProperties:!1}),Y.Object({doc_key:yI},{additionalProperties:!1}),Y.Object({max_bytes:Y.Optional(Y.Integer({minimum:1,maximum:1048576}))},{additionalProperties:!1}),Y.Object({snapshot:vI,doc:xI,content:wI},{additionalProperties:!1}),Y.Object({path:Y.Optional(_I),depth:Y.Optional(Y.Integer({minimum:1,maximum:3})),limit:Y.Optional(Y.Integer({minimum:1,maximum:1e3})),cursor:Y.Optional(XN)},{additionalProperties:!1});var EI=Y.Object({next_cursor:Y.Optional(XN),has_more:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:1e3})},{additionalProperties:!1});Y.Object({snapshot:vI,root:CI,items:Y.Array(CI),page:EI},{additionalProperties:!1}),Y.Object({path:_I,max_bytes:Y.Optional(Y.Integer({minimum:1,maximum:1048576}))},{additionalProperties:!1});var DI=Y.Union([Y.Literal(`thumbnail`),Y.Literal(`preview`),Y.Literal(`original`)]);Y.Object({path:_I,variant:DI,v:Z},{additionalProperties:!1}),Y.Object({snapshot:vI,file:TI,content:wI},{additionalProperties:!1});var OI=Y.Object({path:Y.Literal(`docs/reference`),status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`)]),index_path:Y.Literal(`docs/reference/README.md`),files_path:Y.Literal(`docs/reference/files`),images_path:Y.Literal(`docs/reference/images`),tutti_path:Y.Literal(`docs/reference/tutti`),index_status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`unreadable`)]),index_unreadable_reason:Y.Optional(bI)},{additionalProperties:!1}),kI=Y.Union([Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unsupported_encoding`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`unknown`)]),AI=Y.Object({status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`stale`),Y.Literal(`unavailable`)]),text:Y.Optional(Y.String()),generated_at:Y.Optional(X),source_blob_oid:Y.Optional(Z),unavailable_reason:Y.Optional(Y.String()),read_paths:Y.Optional(Y.Array(_I))},{additionalProperties:!1}),jI=Y.Object({path:_I,name:Z,source:Y.Union([Y.Literal(`human_upload`),Y.Literal(`tutti_output`)]),category:kF,size_bytes:Y.Integer({minimum:0}),media_type:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),blob_oid:Y.Optional(Z),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(kI)},{additionalProperties:!1}),summary:Y.Optional(AI)},{additionalProperties:!1});Y.Object({include_index:Y.Optional(Y.Boolean()),limit:Y.Optional(Y.Integer({minimum:1,maximum:1e3})),cursor:Y.Optional(XN)},{additionalProperties:!1}),Y.Object({snapshot:vI,directory:OI,items:Y.Array(jI),page:EI},{additionalProperties:!1});var MI=Y.Object({...JP,note:Y.Optional(Y.String())},{additionalProperties:!1}),NI=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),hP]),PI=Y.Object({file:jI,message:RF,index_path:Y.Literal(`docs/reference/README.md`)},{additionalProperties:!1});gP(MI),vP(NI,PI);var FI=Y.Object({paths:Y.Optional(Y.Array(_I))},{additionalProperties:!1}),II=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:nP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`no_targets`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:Y.Union([Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`)]),retryable:Y.Boolean()},{additionalProperties:!1}),hP]),LI=Y.Object({activity_ref:Y.Optional(nP),workflow_ref:Y.Optional(iP),target_count:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1});gP(FI),vP(II,LI);var RI=Y.Union([Y.Literal(`static`),Y.Literal(`server`)]),zI=Y.String({minLength:1,maxLength:120,pattern:`\\S`}),BI=Y.String({minLength:1}),VI=Y.Object({title:zI,kind:Y.Literal(`static`),root:BI,entry:BI,network:Y.Boolean()},{additionalProperties:!1}),HI=Y.Object({title:zI,kind:Y.Literal(`server`),cwd:BI,entry:Y.String({minLength:1,maxLength:256,pattern:`^/`}),network:Y.Boolean()},{additionalProperties:!1});Y.Object({version:Y.Literal(1),artifact:Y.Union([VI,HI])},{additionalProperties:!1});var UI=Y.Union([Y.Literal(`ready`),Y.Literal(`starting`),Y.Literal(`idle`),Y.Literal(`failed`)]),WI=Y.Object({title:zI,kind:RI,network:Y.Boolean()},{additionalProperties:!1}),GI=Y.Object({status:UI,url:Y.Optional(Y.String({minLength:1})),error_message:Y.Optional(Z)},{additionalProperties:!1}),KI=Y.Union([Y.Object({status:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({status:Y.Literal(`invalid`),error:Y.Object({code:Z,message:Z},{additionalProperties:!1})},{additionalProperties:!1}),Y.Object({status:Y.Literal(`declared`),preview_generation:Z,artifact:WI,preview:GI},{additionalProperties:!1})]);Y.Object({artifact:KI},{additionalProperties:!1});var qI=Y.Object({},{additionalProperties:!1}),JI=Y.Union([Y.Object({kind:Y.Literal(`issued`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`invalid_manifest`),message:Z},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`preview_not_ready`),status:Y.Union([Y.Literal(`starting`),Y.Literal(`idle`),Y.Literal(`failed`)]),message:Y.Optional(Z)},{additionalProperties:!1}),hP]),YI=Y.Object({bootstrap_url:Y.String({minLength:1}),expires_at:X},{additionalProperties:!1});gP(qI),vP(JI,YI);var XI=Y.String({minLength:1,maxLength:96,pattern:`^[a-z0-9_-]+$`}),ZI=Y.Object({name:XI,description:Z,short_description:Y.Optional(Z),enabled:Y.Boolean(),source:Y.Literal(`user`),updated_at:Y.Optional(X)},{additionalProperties:!1}),QI=Y.Object({name:XI,description:Z,short_description:Y.Optional(Z),enabled:Y.Boolean(),source:Y.Literal(`user`),updated_at:Y.Optional(X),skill_md:Y.String({minLength:1})},{additionalProperties:!1});Y.Object({items:Y.Array(ZI)},{additionalProperties:!1}),Y.Object({skill_name:XI},{additionalProperties:!1}),Y.Object({skill:QI},{additionalProperties:!1});var $I=Y.Object(YP,{additionalProperties:!1}),eL=Y.Union([Y.Object({kind:Y.Literal(`created`),skill_name:XI},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`replaced`),skill_name:XI},{additionalProperties:!1}),hP]),tL=Y.Object({skill:QI},{additionalProperties:!1});gP($I),vP(eL,tL);var nL=Y.Object({skill_name:XI},{additionalProperties:!1}),rL=Y.Union([Y.Object({kind:Y.Literal(`deleted`),skill_name:XI},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_found`),skill_name:XI},{additionalProperties:!1}),hP]);gP(nL),_P(rL);var iL=Y.Union([Y.Literal(`idle`),Y.Literal(`running`),Y.Literal(`pending`),Y.Literal(`failed`)]),aL=Y.Union([Y.Literal(`foreground`),Y.Literal(`scratchpad_background`)]),oL=Y.Object({activity_ref:nP,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)]),workflow_ref:Y.Optional(iP),workflow_kind:Y.Optional(dP),lane:Y.Optional(aL),started_at:Y.Optional(X)},{additionalProperties:!1}),sL=Y.Union([Y.Literal(`reading_context`),Y.Literal(`planning`),Y.Literal(`editing_files`),Y.Literal(`running_command`),Y.Literal(`using_tool`),Y.Literal(`waiting_for_approval`),Y.Literal(`finalizing`)]),cL=Y.Object({input_tokens:Y.Optional(Y.Integer({minimum:0})),cached_input_tokens:Y.Optional(Y.Integer({minimum:0})),output_tokens:Y.Optional(Y.Integer({minimum:0})),reasoning_output_tokens:Y.Optional(Y.Integer({minimum:0})),total_tokens:Y.Integer({minimum:0})},{additionalProperties:!1}),lL=Y.Object({activity_ref:nP,stage_id:Y.Optional(Y.String()),started_at:Y.Optional(X),updated_at:Y.Optional(X),token_usage:Y.Optional(cL),current_action:Y.Optional(sL)},{additionalProperties:!1}),uL=Y.Object({status:iL,summary:Y.String(),active_task:Y.Optional(_F),active_activity:Y.Optional(oL),active_activities:Y.Optional(Y.Array(oL)),runtime:Y.Optional(lL),blocked_by:Y.Optional(Y.Union([Y.Object({kind:Y.Literal(`clarification`),thread_id:aP,round_id:oP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`approval`),approval_id:sP},{additionalProperties:!1})])),last_conclusion:Y.Optional(Y.Object({kind:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`),Y.Literal(`needs_human`),Y.Literal(`recovered`)]),summary:Y.String(),task_id:Y.Optional($N),activity_ref:Y.Optional(nP),workflow_ref:Y.Optional(iP),occurred_at:X},{additionalProperties:!1})),updated_at:X},{additionalProperties:!1}),dL=Y.Object({activity_ref:nP,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)]),status:Y.Union([Y.Literal(`running`),Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`),Y.Literal(`interrupted`)]),title:Z,summary:Y.String(),task_id:Y.Optional($N),workflow_ref:Y.Optional(iP),workflow_kind:Y.Optional(dP),lane:Y.Optional(aL),run_lineage:Y.Optional(uF),started_at:Y.Optional(X),ended_at:Y.Optional(X),latest_event_ref:Y.Optional(rP),result_anchor:Y.Optional(dF)},{additionalProperties:!1}),fL=Y.Object({event_ref:rP,activity_ref:nP,event_kind:Y.Union([Y.Literal(`started`),Y.Literal(`progress`),Y.Literal(`needs_human`),Y.Literal(`artifact_snapshot`),Y.Literal(`finished`),Y.Literal(`failed`)]),occurred_at:X,summary:Y.String(),payload:Y.Optional(Y.Object({progress:Y.Optional(Y.Object({message:Y.String(),phase:Y.Optional(Y.String())},{additionalProperties:!1})),artifact:Y.Optional(Y.Object({artifact_kind:Y.Union([Y.Literal(`scratchpad_snapshot`),Y.Literal(`task_compile_proposal`),Y.Literal(`context_sync_findings`),Y.Literal(`recovery_summary`),Y.Literal(`run_changed_paths`)]),summary:Y.String()},{additionalProperties:!1})),terminal:Y.Optional(Y.Object({result_kind:Y.Union([Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`)]),summary:Y.String()},{additionalProperties:!1}))},{additionalProperties:!1}))},{additionalProperties:!1});Y.Object({server_time:X,current_event_cursor:Z,replay:Y.Object({requested_cursor:Y.Optional(Z),status:Y.Union([Y.Literal(`not_requested`),Y.Literal(`replayed`),Y.Literal(`missed`)]),replayed_event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),retry_after_ms:Y.Integer({minimum:0}),replay_window:bP},{additionalProperties:!1}),Y.Object({reason:Y.Union([Y.Literal(`replay_missed`),Y.Literal(`bulk_state_change`),Y.Literal(`workspace_recovered`),Y.Literal(`viewer_changed`)]),message:Y.Optional(Y.String())},{additionalProperties:!1}),Y.Object({execution_status:uL},{additionalProperties:!1}),Y.Object({approval:$F},{additionalProperties:!1}),Y.Object({activity:dL,event:fL},{additionalProperties:!1}),Y.Object({reason:Y.Union([Y.Literal(`task_compile_applied`),Y.Literal(`task_state_changed`),Y.Literal(`task_result_recorded`),Y.Literal(`workspace_recovered`)]),workflow_ref:Y.Optional(iP),activity_ref:Y.Optional(nP),changed_module_ids:Y.Optional(Y.Array(QN)),changed_task_ids:Y.Optional(Y.Array($N))},{additionalProperties:!1}),Y.Object({task:_F},{additionalProperties:!1}),Y.Object({task_id:$N,task:Y.Optional(_F),detail:Y.Optional(SF),latest_run_result_id:Y.Optional(eP)},{additionalProperties:!1}),Y.Object({scratchpad:hF,activity_ref:Y.Optional(nP)},{additionalProperties:!1}),Y.Object({provider_config:CP},{additionalProperties:!1}),Y.Object({recovery_summary_id:tP,summary:Y.String(),affected_activities:Y.Array(nP),replayed_round_ids:Y.Optional(Y.Array(oP))},{additionalProperties:!1}),Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:nP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:SP,retryable:Y.Boolean()},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`no_source_messages`)},{additionalProperties:!1}),hP]),Y.Object({activity_ref:Y.Optional(nP),workflow_ref:Y.Optional(iP),scratchpad:Y.Optional(hF)},{additionalProperties:!1});var pL=Y.Object({expected_scratchpad_updated_at:Y.Optional(X)},{additionalProperties:!1}),mL=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:nP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`scratchpad_empty`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_scratchpad`),current_scratchpad:hF},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:SP,retryable:Y.Boolean()},{additionalProperties:!1}),hP]),hL=Y.Object({activity_ref:Y.Optional(nP),workflow_ref:Y.Optional(iP)},{additionalProperties:!1});gP(pL),vP(mL,hL);var gL=Y.Object({scope:Y.Optional(Y.Object({kind:Y.Literal(`worklist`)},{additionalProperties:!1}))},{additionalProperties:!1}),_L=Y.Union([Y.Object({kind:Y.Literal(`scheduled`),task_id:$N,activity_ref:nP,queued_task_ids:Y.Array($N)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:nP,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)])},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`blocked_by_clarification`),thread_id:aP,round_id:oP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`nothing_to_run`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`mainline_not_clean`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:SP,retryable:Y.Boolean()},{additionalProperties:!1}),hP]);gP(gL),_P(_L);var vL=Y.Object({display_name:Y.String({minLength:1,maxLength:80})},{additionalProperties:!1}),yL=Y.Union([Y.Object({kind:Y.Literal(`updated`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`unchanged`)},{additionalProperties:!1}),hP]),bL=Y.Object({project:Y.Object({display_name:Y.String({minLength:1,maxLength:80})},{additionalProperties:!1})},{additionalProperties:!1});gP(vL),vP(yL,bL);var xL=Y.Object({description:Y.String({maxLength:160})},{additionalProperties:!1}),SL=Y.Union([Y.Object({kind:Y.Literal(`updated`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`unchanged`)},{additionalProperties:!1}),hP]),CL=Y.Object({project:Y.Object({description:Y.String({maxLength:160})},{additionalProperties:!1})},{additionalProperties:!1});gP(xL),vP(SL,CL);var wL=Y.Object({},{additionalProperties:!1}),TL=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_initialized`)},{additionalProperties:!1}),hP]),EL=Y.Object({activity_ref:nP,workflow_ref:iP},{additionalProperties:!1}),DL=Y.Object({docs:Y.Array(xI),created_paths:Y.Array(_I),commit_oid:Y.Optional(Z)},{additionalProperties:!1});gP(wL),vP(TL,DL);var OL=Y.Object({},{additionalProperties:!1}),kL=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:nP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:SP,retryable:Y.Boolean()},{additionalProperties:!1}),hP]),AL=EL;gP(OL),vP(kL,AL);function jL(e){try{return decodeURIComponent(e)}catch{return e}}function ML(e){return Ut(jL(e))}function NL(e,t=``){if(/^\/$/u.test(e))return{kind:`home`};if(/^\/console\/?$/u.test(e))return{kind:`local_console`};if(/^\/setup\/?$/u.test(e))return{kind:`setup`};if(/^\/projects\/?$/u.test(e)){let e=new URLSearchParams(t).get(`open`);if(e!==null){let t=ML(e);if(t!==null)return{kind:`project_open`,relayProjectRef:t}}return{kind:`project_center`}}let n=/^\/join\/([^/]+)\/?$/u.exec(e);if(n?.[1]!==void 0)return{kind:`join`,joinToken:jL(n[1])};let r=/^\/projects\/([^/]+)\/workspace\/?$/u.exec(e);if(r?.[1]!==void 0){let e=ML(r[1]);return e===null?{kind:`project_center`}:{kind:`workspace`,relayProjectRef:e}}let i=/^\/projects\/([^/]+)\/references\/?$/u.exec(e);if(i?.[1]!==void 0){let e=ML(i[1]);return e===null?{kind:`project_center`}:{kind:`references`,relayProjectRef:e}}let a=/^\/projects\/([^/]+)\/artifacts\/?$/u.exec(e);if(a?.[1]!==void 0){let e=ML(a[1]);return e===null?{kind:`project_center`}:{kind:`artifacts`,relayProjectRef:e}}let o=/^\/projects\/([^/]+)\/worklist\/?$/u.exec(e);if(o?.[1]!==void 0){let e=ML(o[1]);return e===null?{kind:`project_center`}:{kind:`worklist`,relayProjectRef:e}}let s=/^\/projects\/([^/]+)\/skills\/?$/u.exec(e);if(s?.[1]!==void 0){let e=ML(s[1]);return e===null?{kind:`project_center`}:{kind:`skills`,relayProjectRef:e}}let c=/^\/projects\/([^/]+)\/timeline\/?$/u.exec(e);if(c?.[1]!==void 0){let e=ML(c[1]);return e===null?{kind:`project_center`}:{kind:`timeline`,relayProjectRef:e}}let l=/^\/projects\/([^/]+)\/settings\/?$/u.exec(e);if(l?.[1]!==void 0){let e=ML(l[1]);return e===null?{kind:`project_center`}:{kind:`settings`,relayProjectRef:e}}return{kind:`project_center`}}var PL={success:3e3,error:9e3,warning:6e3,info:4500},FL=5,IL=(0,N.createContext)(null);function LL(e){return e.persistent===!0||e.tone===`loading`?e.durationMs:e.durationMs??PL[e.tone]}function RL(e){return e.persistent??e.tone===`loading`}function zL(e){return e.dismissible??e.tone!==`loading`}function BL(e,t){let n=LL(t);return{id:e,tone:t.tone,title:t.title,persistent:RL(t),dismissible:zL(t),...t.message===void 0?{}:{message:t.message},...n===void 0?{}:{durationMs:n}}}function VL(e,t){let n=t.tone===void 0,r={tone:t.tone??e.tone,title:t.title??e.title,...t.message===void 0?e.message===void 0?{}:{message:e.message}:{message:t.message},...t.durationMs===void 0?!n||e.durationMs===void 0?{}:{durationMs:e.durationMs}:{durationMs:t.durationMs},...t.persistent===void 0?!n||e.persistent===void 0?{}:{persistent:e.persistent}:{persistent:t.persistent},...t.dismissible===void 0?!n||e.dismissible===void 0?{}:{dismissible:e.dismissible}:{dismissible:t.dismissible}};return BL(e.id,r)}function HL(e){return[e.id,e.tone,e.title,e.message??``,e.durationMs??``,e.persistent===!0?`persistent`:`timed`].join(`:`)}function UL({children:e}){let[t,n]=(0,N.useState)([]),r=(0,N.useRef)(new Map),i=(0,N.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e))},[]),a=(0,N.useCallback)(e=>{let t=Gt(),r=BL(t,e);return n(e=>[...e,r].slice(-FL)),t},[]),o=(0,N.useCallback)((e,t)=>{if(e===void 0){a(t);return}n(n=>n.map(n=>n.id===e?VL(n,t):n))},[a]);(0,N.useEffect)(()=>{let e=new Set(t.map(e=>e.id));for(let[t,n]of r.current)e.has(t)||(window.clearTimeout(n.timeout),r.current.delete(t));for(let e of t){let t=r.current.get(e.id),n=HL(e);if(t!==void 0&&t.key!==n&&(window.clearTimeout(t.timeout),r.current.delete(e.id)),e.persistent===!0||e.durationMs===void 0||r.current.has(e.id))continue;let a=window.setTimeout(()=>i(e.id),e.durationMs);r.current.set(e.id,{key:n,timeout:a})}},[i,t]),(0,N.useEffect)(()=>()=>{for(let e of r.current.values())window.clearTimeout(e.timeout);r.current.clear()},[]);let s=(0,N.useMemo)(()=>({notify:a,update:o,dismiss:i}),[i,a,o]);return(0,P.jsxs)(IL.Provider,{value:s,children:[e,(0,P.jsx)(ua,{notices:t,onDismiss:i})]})}function WL(){let e=(0,N.useContext)(IL);if(e===null)throw Error(`useNotify must be used inside NotificationProvider`);return e}var GL=`http://127.0.0.1:4370`;function KL(){return typeof window<`u`?window.location.origin:GL}function qL(){return KL()}var JL=qL(),YL={relayBaseUrl:JL},XL=3e4,Q={relayRoot:[`relay`],me:[`relay`,`me`],recentProjects:[`relay`,`projects`,`recent`],projectPresence:e=>[`relay`,`projects`,e,`presence`],relayJoinRoot:[`relay`,`join`],join:e=>[`relay`,`join`,e],bootstrap:e=>[`host`,e,`bootstrap`],hostRoot:e=>[`host`,e],hostSession:e=>[`host`,e,`session`],hostWorkspace:e=>[`host`,e,`workspace`],messages:e=>[`host`,e,`messages`,`main_chat`],messagesWindow:(e,t)=>[...Q.messages(e),{limit:t}],messagesAround:(e,t,n)=>[...Q.messages(e),{around:t,limit:n}],messageHistory:(e,t,n)=>[...Q.messages(e),{history:t,limit:n}],scratchpad:e=>[`host`,e,`scratchpad`],worklist:e=>[`host`,e,`worklist`],readState:e=>[`host`,e,`read-state`],activeClarification:e=>[`host`,e,`clarification`,`active`],activeApproval:e=>[`host`,e,`approval`,`active`],noActiveClarificationRoundMessages:e=>[`host`,e,`clarification-round-messages`,`none`],clarificationRoundMessages:(e,t)=>[`host`,e,`clarification-round-messages`,t],task:(e,t)=>[`host`,e,`task`,t],taskDetail:(e,t)=>[`host`,e,`task-detail`,t],taskRunResults:(e,t)=>[`host`,e,`task-run-results`,t],executionStatus:e=>[`host`,e,`execution-status`],providerConfig:e=>[`host`,e,`provider-config`],providerUsage:e=>[`host`,e,`provider-usage`],projectTimeline:e=>[`host`,e,`project-timeline`],viewerRoot:e=>[`host`,e,`viewer`],viewerFile:(e,t)=>[`host`,e,`viewer`,`file`,t],referenceFiles:e=>[`host`,e,`references`,`files`],artifacts:e=>[`host`,e,`artifacts`],artifactPreviewSession:(e,t)=>[`relay`,e,`artifact-preview-session`,t],skills:e=>[`host`,e,`skills`],skillDetail:(e,t)=>[`host`,e,`skills`,t]};function ZL(){return`${window.location.pathname}${window.location.search}${window.location.hash}`}function $(e,t={}){t.replace===!0?window.history.replaceState(null,``,e):window.history.pushState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}function QL(e){let t=new URL(e,window.location.origin);$(`${t.pathname}${t.search}${t.hash}`)}function $L(){let[e,t]=(0,N.useState)(ZL);return(0,N.useEffect)(()=>{let e=()=>{t(ZL())};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]),(0,N.useMemo)(()=>{let t=new URL(e,window.location.origin);return NL(t.pathname,t.search)},[e])}function eR(e){return e instanceof Error?e.message:`Request failed`}function tR(e){e.invalidateQueries({queryKey:Q.me}),e.invalidateQueries({queryKey:Q.recentProjects})}function nR(e,t){if(t!==void 0)for(let n of t)switch(n.kind){case`all`:e.invalidateQueries({queryKey:Q.relayRoot});break;case`me`:e.invalidateQueries({queryKey:Q.me});break;case`recent_projects`:e.invalidateQueries({queryKey:Q.recentProjects});break;case`join_entries`:e.invalidateQueries({queryKey:Q.relayJoinRoot});break;case`project_presence`:Vt(n.relay_project_ref,Lt.relayProject)&&e.invalidateQueries({queryKey:Q.projectPresence(n.relay_project_ref)});break}}function rR(e){let t=rt(),n=(0,N.useMemo)(()=>zn(YL),[]);(0,N.useEffect)(()=>{if(e)try{let e=n.connectEvents({onReady:e=>{e.payload.replay.status===`missed`&&t.invalidateQueries({queryKey:Q.relayRoot})},onInvalidate:e=>{nR(t,e)}});return()=>{e.close()}}catch{return}},[e,t,n])}function iR(e,t,n){if(n!==void 0)for(let r of n)switch(r.kind){case`all`:e.invalidateQueries({queryKey:Q.hostRoot(t)});break;case`workspace`:e.invalidateQueries({queryKey:Q.hostWorkspace(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`session`:e.invalidateQueries({queryKey:Q.hostSession(t)});break;case`bootstrap`:e.invalidateQueries({queryKey:Q.bootstrap(t)});break;case`messages`:r.scope===`main_chat`?e.invalidateQueries({queryKey:Q.messages(t)}):e.invalidateQueries({queryKey:Q.clarificationRoundMessages(t,r.round_id)});break;case`scratchpad`:e.invalidateQueries({queryKey:Q.scratchpad(t)});break;case`worklist`:e.invalidateQueries({queryKey:Q.worklist(t)});break;case`read_state`:e.invalidateQueries({queryKey:Q.readState(t)});break;case`task`:e.invalidateQueries({queryKey:Q.task(t,r.task_id)});break;case`task_detail`:e.invalidateQueries({queryKey:Q.taskDetail(t,r.task_id)});break;case`task_run_results`:e.invalidateQueries({queryKey:Q.taskRunResults(t,r.task_id)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`execution_status`:e.invalidateQueries({queryKey:Q.executionStatus(t)});break;case`approval`:e.invalidateQueries({queryKey:Q.activeApproval(t)});break;case`provider_config`:e.invalidateQueries({queryKey:Q.providerConfig(t)});break;case`provider_usage`:e.invalidateQueries({queryKey:Q.providerUsage(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`project_timeline`:e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`viewer`:e.invalidateQueries({queryKey:Q.viewerRoot(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)}),(r.path===void 0||r.path.startsWith(`docs/reference`))&&e.invalidateQueries({queryKey:Q.referenceFiles(t)}),r.path!==void 0&&e.invalidateQueries({queryKey:Q.viewerFile(t,r.path)});break;case`skills`:e.invalidateQueries({queryKey:Q.skills(t)});break;case`artifacts`:e.invalidateQueries({queryKey:Q.artifacts(t)});break;case`recovery_summaries`:e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`activity`:break;case`clarification`:e.invalidateQueries({queryKey:Q.activeClarification(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)}),r.round_id!==void 0&&e.invalidateQueries({queryKey:Q.clarificationRoundMessages(t,r.round_id)});break}}function aR(){return{items:[],window:{has_older:!1,has_newer:!1,limit:50}}}function oR(){return{modules:[]}}function sR(){return{id:`current`,state:`empty`,topic:``,background_summary:``,current_consensus:[],open_questions:[],task_changes:[],receipts:[]}}function cR(e){return{chat:e?.scopes.chat.has_unread===!0,worklist:e?.scopes.worklist.has_unread===!0,references:e?.scopes.references.has_unread===!0,skills:e?.scopes.skills.has_unread===!0}}function lR({enabled:e,hostClient:t,relayProjectRef:n,readState:r,scope:i}){let a=rt(),o=(0,N.useRef)(null),s=yt({mutationFn:e=>t.markRead({scope:i,up_to_event_cursor:e}),onSuccess:e=>{iR(a,n,e.invalidates)},onError:()=>{o.current=null}});(0,N.useEffect)(()=>{if(!e||r===void 0)return;let t=r.scopes[i];if(!t.has_unread){t.read_event_cursor>=t.latest_event_cursor&&(o.current=null);return}let n=`${i}:${t.latest_event_cursor}`;o.current===n||s.isPending||(o.current=n,s.mutate(t.latest_event_cursor))},[e,s,r,i])}function uR(){return{state:`none`}}function dR(e){return{status:`idle`,summary:`Idle`,updated_at:e}}function fR(e){return e.active_activities??(e.active_activity===void 0?[]:[e.active_activity])}function pR(e,t,n){return fR(e).some(e=>e.workflow_kind===t?n===void 0||(e.lane??`foreground`)===n:!1)}function mR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/references`;return t===void 0?n:`${n}?path=${encodeURIComponent(t)}`}function hR(e){return`/projects/${encodeURIComponent(Ht(e))}/artifacts`}function gR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/worklist`;return t===void 0?n:`${n}?task=${encodeURIComponent(t)}`}function _R(e,t){return`${rn(e)}?message=${encodeURIComponent(t)}`}function vR(e){return`/projects/${encodeURIComponent(Ht(e))}/settings`}function yR(e){return`/projects/${encodeURIComponent(Ht(e))}/timeline`}function bR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/skills`;return t===void 0?n:`${n}?skill=${encodeURIComponent(t)}`}function xR(e,t){switch(t.target.kind){case`approval`:case`clarification`:case`scratchpad`:return rn(e);case`worklist`:return gR(e);case`references`:return mR(e);case`task`:return gR(e,t.target.taskId)}}function SR(e,t){$(xR(e,t))}function CR(e,t){let n=Fr(e);if(t!==void 0&&n.some(e=>e.id===t))return t;for(let e of[`running`,`pending`,`failed`,`todo`,`done`]){let t=n.find(t=>t.status===e);if(t!==void 0)return t.id}}function wR(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function TR(e){switch(e){case`binary`:return`Binary file`;case`too_large`:return`File too large`;case`unsupported_encoding`:return`Unsupported encoding`;case`restricted_path`:case`secret_like`:return`Restricted file`;default:return`Preview unavailable`}}function ER(e){if(!(e===void 0||e.kind===`text`))return TR(e.reason)}function DR(e){return Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function OR(e){if(globalThis.crypto?.subtle===void 0)throw Error(`This browser does not support file upload hashing.`);return`sha256:${DR(await globalThis.crypto.subtle.digest(`SHA-256`,await e.arrayBuffer()))}`}async function kR(e){if(e.file.size<=0)throw Error(`Upload file cannot be empty.`);let t=KP(e.purpose);if(e.file.size>t)throw Error(`Upload file cannot exceed ${wR(t)}.`);let n=await OR(e.file),r=e.file.type===``?void 0:e.file.type,i=zn(YL),a=e.purpose===`skill_zip`?{relay_project_ref:e.relayProjectRef,purpose:`skill_zip`,file_name:e.file.name,size_bytes:e.file.size,sha256:n,...r===void 0?{}:{media_type:r}}:{relay_project_ref:e.relayProjectRef,purpose:`reference_file`,file_name:e.file.name,size_bytes:e.file.size,sha256:n,...r===void 0?{}:{media_type:r}},o=await i.startUpload(a);if(o.result===void 0)throw Error(`Upload session could not be started.`);let s=new Headers(o.result.put.headers??{});r!==void 0&&!s.has(`content-type`)&&s.set(`content-type`,r);let c;try{c=await fetch(o.result.put.url,{method:o.result.put.method,headers:s,body:e.file})}catch{throw Error(`File upload failed while sending the file to upload storage. Check that R2 CORS allows PUT from this Web origin.`)}if(!c.ok)throw Error(`File upload failed while sending the file to upload storage (${c.status}).`);return{upload_id:o.result.upload.upload_id,file_name:o.result.upload.file_name,size_bytes:o.result.upload.size_bytes,sha256:o.result.upload.sha256,...o.result.upload.media_type===void 0?{}:{media_type:o.result.upload.media_type}}}function AR(e){let t=rt(),n=WL(),[r,i]=(0,N.useState)(`identity`),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)({email:``,displayName:``,code:``}),l=yt({mutationFn:async()=>{let e=s.email.trim(),t=await Vn(YL,{email:e});if(t.result===void 0)throw Error(`Login challenge was not returned`);return{challenge:t.result.challenge,disposition:t.disposition,email:e}},onSuccess:({challenge:e,disposition:t,email:r})=>{o(e),c(e=>({...e,code:``})),i(`code`),n.notify({tone:`success`,title:t.kind===`otp_already_pending`?`Verification email already sent`:`Verification email sent`,message:t.kind===`otp_already_pending`?`Verification email already sent to ${r}.`:`Verification email sent to ${r}.`})}}),u=yt({mutationFn:async()=>{if(a===null)throw Error(`Login challenge is missing`);let e=await Hn(YL,{challenge_ref:a.challenge_ref,code:s.code.trim()});if(e.result===void 0)throw Error(`Login response was not returned`);return e.result},onSuccess:n=>{if(!n.account.profile_complete){t.invalidateQueries({queryKey:Q.me}),c(e=>({...e,displayName:``})),i(`profile`);return}tR(t),e?.()}}),d=yt({mutationFn:async()=>{let e=await Un(YL,{display_name:s.displayName.trim()});if(e.result===void 0)throw Error(`Profile response was not returned`);return e.result.account},onSuccess:()=>{tR(t),e?.()}}),f=e=>{if(e.preventDefault(),r===`identity`&&s.email.trim()!==``){l.mutate();return}if(r===`code`&&a!==null&&s.code.trim()!==``){u.mutate();return}r===`profile`&&s.displayName.trim()!==``&&d.mutate()},p=l.isPending||u.isPending||d.isPending,m=r===`identity`?l.error:r===`code`?u.error??l.error:d.error;return{phase:r,form:s,pending:p,submitDisabled:r===`identity`?s.email.trim()===``:r===`code`?a===null||s.code.replace(/\s+/gu,``).length!==6:s.displayName.trim()===``,challengeEmailHint:a?.email_hint??null,error:m===null?null:eR(m),onChange:e=>{c(t=>({...t,...e,...e.code===void 0?{}:{code:e.code.replace(/\D/gu,``).slice(0,6)}}))},onSubmit:f,onBack:()=>{l.reset(),u.reset(),d.reset(),o(null),c(e=>({...e,code:``})),i(`identity`)}}}function jR(e){let t=rt(),[n,r]=(0,N.useState)({email:``,displayName:``,code:``}),i=yt({mutationFn:async()=>{let e=await Un(YL,{display_name:n.displayName.trim()});if(e.result===void 0)throw Error(`Profile response was not returned`);return e.result.account},onSuccess:()=>{tR(t),e?.()}});return{phase:`profile`,form:n,pending:i.isPending,submitDisabled:n.displayName.trim()===``,challengeEmailHint:null,error:i.error===null?null:eR(i.error),onChange:e=>{r(t=>({...t,...e,...e.code===void 0?{}:{code:e.code.replace(/\D/gu,``).slice(0,6)}}))},onSubmit:e=>{e.preventDefault(),n.displayName.trim()!==``&&i.mutate()}}}var MR=`tutti.workspace-onboarding.v1`,NR={version:1,start_chat_pending:!1,tour_pending:!1};function PR(){try{return typeof window>`u`?null:window.sessionStorage}catch{return null}}function FR(e){return e.storage===void 0?PR():e.storage}function IR(e,t){return`${MR}:${e}:${t}`}function LR(e){if(typeof e!=`object`||!e)return null;let t=e;return t.version===1&&typeof t.start_chat_pending==`boolean`&&typeof t.tour_pending==`boolean`?{version:1,start_chat_pending:t.start_chat_pending,tour_pending:t.tour_pending}:null}function RR(e,t,n){if(e!==null)try{if(!n.start_chat_pending&&!n.tour_pending){e.removeItem(t);return}e.setItem(t,JSON.stringify(n))}catch{}}function zR(e,t,n={}){let r=FR(n);if(r===null)return{...NR};try{let n=r.getItem(IR(e,t));return n===null?{...NR}:LR(JSON.parse(n))??{...NR}}catch{return{...NR}}}function BR(e,t,n={}){RR(FR(n),IR(e,t),{version:1,start_chat_pending:!0,tour_pending:!0})}function VR(e,t,n,r){let i=FR(r),a=zR(e,t,{storage:i});a[n]&&RR(i,IR(e,t),{...a,[n]:!1})}function HR(e,t,n={}){VR(e,t,`start_chat_pending`,n)}function UR(e,t,n={}){VR(e,t,`tour_pending`,n)}function WR({joinToken:e}){let t=rt(),n=F({queryKey:Q.join(e),queryFn:()=>Gn(YL,e)}),r=AR(()=>{n.refetch()}),i=jR(()=>{n.refetch()}),a=yt({mutationFn:()=>Kn(YL,e),onSuccess:n=>{tR(t),t.invalidateQueries({queryKey:Q.join(e)}),n.disposition.kind===`joined`&&n.result!==void 0&&BR(n.result.account.account_ref,n.result.relay_project.relay_project_ref),n.result?.relay_project.host_status===`online`&&$(rn(n.result.relay_project.relay_project_ref))}}),o=yt({mutationFn:e=>Jn(YL,e),onSuccess:e=>{tR(t),e.disposition.kind===`opened`&&e.result?.open_url!==void 0&&QL(e.result.open_url)}}),s=n.data;rR(s?.account!==void 0);let c=s?.relay_project?.display_name??`Project`,l=s?.relay_project?.host_status??`unknown`,u=s?.account?.profile_complete===!1,d=u?`login_required`:n.isLoading?`loading`:n.error===null?s?.next.kind??`invalid_or_expired`:`error`;return(0,P.jsx)(kS,{projectName:c,description:d===`invalid_or_expired`?`This invite can no longer be used.`:`You have been invited to join ${c}.`,hostLabel:rr(l),hostOnline:l===`online`,nextKind:d,accountLabel:s?.account?.display_name??null,membershipLabel:s?.membership?.label??null,actionPending:a.isPending||o.isPending,error:n.error===null?a.error===null?o.error===null?null:eR(o.error):eR(a.error):eR(n.error),onBrandClick:()=>$(`/`),onRetry:()=>void n.refetch(),onAccept:()=>a.mutate(),onOpen:()=>{s?.next.kind===`open_workspace`&&o.mutate(s.next.relay_project_ref)},...d===`login_required`?{loginForm:u?i:r}:{}})}function GR(){$(`/projects`,{replace:!0})}function KR(){let e=F({queryKey:Q.me,queryFn:()=>Bn(YL)}),t=AR(GR);return(0,N.useEffect)(()=>{e.data!==void 0&&GR()},[e.data]),e.isLoading||e.data!==void 0?null:(0,P.jsx)(LS,{...t,onBrandClick:()=>$(`/`),sessionError:e.error===null||Qt(e.error)?null:`Tutti could not check your current session. You can still try signing in.`})}function qR(e){let t=e.trim().replace(/[\\/]+$/u,``);return t===``?``:t.slice(Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`))+1)}function JR(e=``){return{workspacePath:e,displayName:qR(e),description:``,baseUrl:``,apiKey:``,model:``}}function YR(e,t,n){return{...e,workspacePath:t,...n?{}:{displayName:qR(t)}}}function XR(e){switch(e){case`console_busy`:return`Wait for the current Local Console action to finish.`;case`host_busy`:return`Wait for active project work or questions to finish.`;case`host_identity_unverified`:return`Stop or reopen the affected project before updating.`;case`update_in_progress`:return`Another Tutti update is already in progress.`;case`update_recovery_required`:return`Run tutti again after closing this page to recover the interrupted update.`;case`global_prefix_read_only`:return`Use your normal terminal installation environment to update Tutti.`;case`npm_install_failed`:return`The npm installation failed. Refresh to check whether it can be retried.`;case`post_install_validation_failed`:return`The installed package could not be verified. Run tutti again to recover.`;case`completion_start_failed`:case`completion_failed`:case`worker_crashed`:return`The update was interrupted. Run tutti again to recover.`;case`host_restore_failed`:return`Tutti updated, but one or more local projects could not restart.`;case`installation_not_global`:case`custom_home`:case`npm_unavailable`:case`npm_global_root_mismatch`:case`npm_version_unsupported`:case`registry_unavailable`:case void 0:return`Tutti cannot update from this Local Console.`}}function ZR(e){if(e.status!==`updating`)return e.status===`blocked`||e.status===`failed`?XR(e.reason_code):void 0;switch(e.phase){case`stopping_hosts`:return`Safely stopping online projects.`;case`installing`:return`Installing the new Tutti version.`;case`restarting`:return`Restarting local projects.`;case`preparing`:case void 0:return`Preparing the update.`}}function QR(e){let t=e.update;if(t===null||t.status===`up_to_date`||t.latest_version===void 0&&t.status!==`updating`&&t.status!==`failed`)return;let n=e.checking&&t.status===`ready`?`Checking update readiness.`:ZR(t);return{label:t.status===`updating`?`Updating…`:`Restart and Update`,disabled:t.status!==`ready`||!t.can_update||e.checking||e.starting,...n===void 0?{}:{description:n}}}function $R(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length===0?t:n}function ez({inviterName:e,projectName:t,joinUrl:n}){return`${$R(e,`A teammate`)} invited you to join the Tutti project “${$R(t,`Untitled project`)}”.\n\nOpen the invitation link:\n${n.trim()}`}var tz=JR();function nz(){let e=window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash;return new URLSearchParams(e).get(`access_token`)}function rz(){window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}`)}function iz(e){return window.open(e,`_blank`,`noopener,noreferrer`)}function az(){let e=window.open(`about:blank`,`_blank`);return e!==null&&(e.opener=null),e}function oz(){let e=WL(),t=(0,N.useRef)(void 0),n=(0,N.useRef)(void 0),r=(0,N.useRef)(!1),i=(0,N.useRef)(null),a=(0,N.useRef)(!1),o=(0,N.useRef)(null),s=(0,N.useRef)(!1),c=(0,N.useMemo)(()=>Fn({baseUrl:window.location.origin,csrfToken:()=>t.current,contextToken:()=>n.current}),[]),[l,u]=(0,N.useState)(null),[d,f]=(0,N.useState)(null),[p,m]=(0,N.useState)(tz),h=(0,N.useRef)(!1),g=(0,N.useRef)({baseUrl:``,apiKey:``}),[_,v]=(0,N.useState)([]),[y,b]=(0,N.useState)(!1),[x,S]=(0,N.useState)(`folder`),[C,w]=(0,N.useState)([]),[T,E]=(0,N.useState)(!0),[ee,D]=(0,N.useState)(!1),[O,k]=(0,N.useState)(!1),[te,ne]=(0,N.useState)(null),[A,re]=(0,N.useState)(null),[ie,j]=(0,N.useState)(!1),[M,ae]=(0,N.useState)(!1);async function oe(){if(t.current!==void 0){E(!0);try{w((await c.getProjects()).projects)}catch(t){e.notify({tone:`error`,title:`Projects unavailable`,message:eR(t)})}finally{E(!1)}}}async function se(e={}){i.current?.abort();let t=new AbortController;i.current=t,j(!0);try{re(await c.getPackageUpdate({refresh:e.refresh===!0,signal:t.signal}))}catch{}finally{i.current===t&&(i.current=null,j(!1))}}(0,N.useEffect)(()=>{r.current||(r.current=!0,(async()=>{try{let e=nz();if(e!==null&&e.trim()!==``){rz();let r=await c.exchangeSession(e);t.current=r.csrf_token,n.current=r.context_token}let r=await c.getBootstrap();t.current=r.csrf_token,u(r),f(null),await Promise.all([oe(),se()])}catch(e){E(!1),f(eR(e))}})())},[c]),(0,N.useEffect)(()=>()=>{i.current?.abort()},[]),(0,N.useEffect)(()=>{if(l===null)return;let e=window.setInterval(()=>{c.heartbeat().catch(()=>void 0)},6e4);return()=>window.clearInterval(e)},[l,c]),(0,N.useEffect)(()=>{if(l===null||A?.latest_version===void 0||A.status===`up_to_date`||A.status===`failed`)return;let e=window.setInterval(()=>void se(),A.status===`updating`?2e3:15e3);return()=>window.clearInterval(e)},[l,A?.latest_version,A?.status]),(0,N.useEffect)(()=>{let t=l?.package_update_completion;t===void 0||s.current||(s.current=!0,e.notify(t.restart_failure_count===0?{tone:`success`,title:`Tutti updated to ${t.target_version}`}:{tone:`warning`,title:`Tutti updated to ${t.target_version}`,message:`${t.restart_failure_count} local project${t.restart_failure_count===1?``:`s`} could not restart.`}))},[l,e]),(0,N.useEffect)(()=>{if(A?.status!==`failed`)return;let t=A.reason_code??`update_failed`;o.current!==t&&(o.current=t,e.notify({tone:`error`,title:`Tutti update did not complete`,message:XR(A.reason_code)}))},[e,A]);async function ce(){try{let t=await c.pickFolder();t.kind===`selected`?ge({workspacePath:t.path}):t.kind===`unavailable`&&e.notify({tone:`info`,title:`Use a folder path`,message:t.message})}catch(t){e.notify({tone:`error`,title:`Folder picker unavailable`,message:eR(t)})}}async function le(){let t={baseUrl:p.baseUrl.trim(),apiKey:p.apiKey.trim()},n=()=>g.current.baseUrl.trim()===t.baseUrl&&g.current.apiKey.trim()===t.apiKey;D(!0);try{let r=await c.discoverModels({base_url:t.baseUrl,api_key:t.apiKey});if(!n())return;r.kind===`ok`?(v(r.models),m(e=>({...e,model:``})),S(`model`)):(v([]),e.notify({tone:`error`,title:`Provider check failed`,message:r.reason===`model_list_empty`?`The endpoint did not return any available models.`:`Check the Base URL and API key, then try again.`}))}catch(t){if(!n())return;v([]),e.notify({tone:`error`,title:`Provider check failed`,message:eR(t)})}finally{D(!1)}}async function ue(){k(!0);try{let e=await c.launchProject({workspace_path:p.workspacePath.trim(),project:{display_name:p.displayName.trim(),...p.description.trim()===``?{}:{description:p.description.trim()}},provider:{base_url:p.baseUrl.trim(),api_key:p.apiKey.trim(),model:p.model.trim()}});_e(),window.location.assign(e.join_url)}catch(t){e.notify({tone:`error`,title:`Launch failed`,message:eR(t)})}finally{k(!1)}}async function de(t){ne(t.project_id);try{await c.launchProject({workspace_path:t.workspace_path}),await oe(),e.notify({tone:`success`,title:`${t.display_name} is ready`})}catch(t){let n=t instanceof Jt&&t.code===`provider_configuration_required`;e.notify({tone:n?`warning`:`error`,title:n?`Provider required`:`Launch failed`,message:n?`Use New project with this folder to update its Provider configuration.`:eR(t)})}finally{ne(null)}}async function fe(t){ne(t.project_id);try{let n=await c.refreshInvite(t.project_id);await navigator.clipboard.writeText(ez({inviterName:``,projectName:t.display_name,joinUrl:n.join_url})),w(e=>e.map(e=>e.project_id===t.project_id?{...e,join_url:n.join_url}:e)),e.notify({tone:`success`,title:`Invitation copied`})}catch(t){e.notify({tone:`error`,title:`Invite unavailable`,message:eR(t)})}finally{ne(null)}}async function pe(t){if(t.open_url===void 0)return;if(t.update_required!==!0){iz(t.open_url);return}let n=az();ne(t.project_id);try{let r=await c.openProject(t.project_id);w(e=>e.map(e=>e.project_id===r.project.project_id?r.project:e)),n===null?window.location.assign(r.open_url):n.location.replace(r.open_url),r.disposition===`updated`?e.notify({tone:`success`,title:`${t.display_name} updated`}):r.disposition===`deferred_busy`?e.notify({tone:`info`,title:`Opened without updating`,message:`Try Open again after the current project activity finishes.`}):r.disposition===`deferred_unsupported`?e.notify({tone:`info`,title:`Opened with the current Host`,message:`Stop and Resume this project once to enable safe automatic updates.`}):r.disposition===`deferred_unavailable`&&e.notify({tone:`warning`,title:`Update deferred`,message:`The current Host could not be safely restarted, so the project opened as-is.`})}catch(t){n?.close(),e.notify({tone:`error`,title:`Open failed`,message:eR(t)})}finally{ne(null)}}async function me(t){ne(t.project_id);try{await c.stopProject(t.project_id),await Promise.all([oe(),se()]),e.notify({tone:`success`,title:`${t.display_name} stopped`})}catch(t){e.notify({tone:`error`,title:`Stop failed`,message:eR(t)})}finally{ne(null)}}async function he(){if(!(a.current||A?.status!==`ready`||!A.can_update)){a.current=!0,ae(!0);try{re(await c.startPackageUpdate())}catch(t){t instanceof Jt&&t.statusCode===0?re({...A,status:`updating`,can_update:!1,phase:`preparing`}):(e.notify({tone:`error`,title:`Update not started`,message:eR(t)}),await se())}finally{a.current=!1,ae(!1)}}}function ge(e){e.displayName!==void 0&&(h.current=!0);let t=e.baseUrl!==void 0&&e.baseUrl!==p.baseUrl||e.apiKey!==void 0&&e.apiKey!==p.apiKey;t&&(v([]),g.current={baseUrl:e.baseUrl??p.baseUrl,apiKey:e.apiKey??p.apiKey}),m(n=>({...e.workspacePath===void 0?n:YR(n,e.workspacePath,h.current),...e,...t?{model:``}:{}}))}function _e(){b(!1),S(`folder`),v([]),g.current={baseUrl:``,apiKey:``},h.current=!1,m(JR())}function ve(e){if(!e){!ee&&!O&&_e();return}let t=l?.invocation.source===`terminal`?l.invocation.current_directory:``;h.current=!1,g.current={baseUrl:``,apiKey:``},v([]),m(JR(t)),S(`folder`),b(!0)}function ye(e){if(e.preventDefault(),x===`folder`){S(`details`);return}if(x===`details`){S(`provider`);return}if(x===`provider`){le();return}ue()}function be(){S(e=>{switch(e){case`folder`:return`folder`;case`details`:return`folder`;case`provider`:return`details`;case`model`:return`provider`}})}let xe=QR({update:A,checking:ie,starting:M});return(0,P.jsx)(IS,{form:p,models:_,projects:C,projectsLoading:T,sessionLoading:l===null&&d===null,sessionError:d,createOpen:y,createStep:x,modelDiscoveryPending:ee,launchPending:O,projectActionPending:te,...xe===void 0?{}:{packageUpdateAction:xe},onChange:ge,onCreateOpenChange:ve,onCreateSubmit:ye,onCreateBack:be,onChooseFolder:()=>void ce(),onRefresh:()=>void Promise.all([oe(),se({refresh:!0})]),onLaunchExisting:e=>void de(e),onOpenProject:e=>void pe(e),onCopyInvite:e=>void fe(e),onStopProject:e=>void me(e),onPackageUpdate:()=>void he()})}var sz=/^[A-Za-z0-9_-]{8,256}$/u,cz=/https?:\/\/[^\s<>"'`“”‘’]+/giu,lz=/(?:^|[\s("'“‘])((?:\/)?join\/[A-Za-z0-9_-]{8,256})(?=$|[\s?#.,;:!'"”’)\]}])/giu,uz=/[.,;:!?)}\]]+$/u;function dz(e){let t;try{t=decodeURIComponent(e)}catch{return null}return sz.test(t)?t:null}function fz(e){let t=e.split(`/`).filter(Boolean);return t.length!==2||t[0]!==`join`?null:dz(t[1]??``)}function pz(e,t){let n=fz(t);n!==null&&e.add(`/join/${encodeURIComponent(n)}`)}function mz(e,t){try{pz(e,new URL(t.replace(uz,``)).pathname)}catch{}}function hz(e){let t=e.trim();if(t===``)return{kind:`empty`};let n=new Set;for(let e of t.matchAll(cz))mz(n,e[0]);for(let e of t.matchAll(lz)){let t=e[1];if(t!==void 0)try{pz(n,new URL(t,`https://tutti.invalid`).pathname)}catch{}}let r=dz(t);return r!==null&&n.add(`/join/${encodeURIComponent(r)}`),n.size===0?{kind:`invalid`}:n.size>1?{kind:`ambiguous`}:{kind:`matched`,route:[...n][0]}}function gz({requestedOpenProjectRef:e}){let t=rt(),n=WL(),r=AR(),i=jR(),[a,o]=(0,N.useState)(``),[s,c]=(0,N.useState)(null),[l,u]=(0,N.useState)(!1),d=(0,N.useRef)(null),f=F({queryKey:Q.me,queryFn:()=>Bn(YL)}),p=F({queryKey:Q.recentProjects,queryFn:()=>qn(YL),enabled:f.isSuccess});rR(f.isSuccess);let m=yt({mutationFn:e=>Jn(YL,e),onSuccess:e=>{if(tR(t),e.disposition.kind===`opened`&&e.result?.open_url!==void 0){QL(e.result.open_url);return}n.notify({tone:`warning`,title:`Host is offline`})},onError:e=>{n.notify({tone:`error`,title:`Project open failed`,message:eR(e)})}}),h=m.mutate;(0,N.useEffect)(()=>{e===void 0||f.data?.account.profile_complete!==!0||d.current===e||(d.current=e,h(e))},[f.data?.account.profile_complete,h,e]);let g=yt({mutationFn:()=>Wn(YL),onSuccess:()=>{t.invalidateQueries({queryKey:Q.relayRoot}),t.invalidateQueries({queryKey:Q.me}),t.invalidateQueries({queryKey:Q.recentProjects})},onError:e=>{n.notify({tone:`error`,title:`Sign out failed`,message:eR(e)})}});if(f.error!==null&&Qt(f.error))return(0,P.jsx)(ES,{...r,onBrandClick:()=>$(`/`)});let _=f.data?.account;if(_!==void 0&&!_.profile_complete)return(0,P.jsx)(ES,{...i,onBrandClick:()=>$(`/`)});let v=(p.data?.projects??[]).map(ar);return(0,P.jsx)(RS,{account:_===void 0?null:{displayName:_.display_name},projects:v,loading:f.isLoading||p.isLoading,error:f.error===null?p.error===null?null:eR(p.error):eR(f.error),openPending:m.isPending,logoutPending:g.isPending,joinLinkForm:{value:a,error:s,onChange:e=>{o(e),c(null)},onSubmit:()=>{let e=hz(a);if(e.kind!==`matched`){c(e.kind===`ambiguous`?`Paste one Tutti invitation at a time.`:`Paste a valid Tutti invitation.`);return}$(e.route)}},launchExpanded:l,onLaunch:()=>u(!0),onCopyLaunchCommand:e=>{navigator.clipboard.writeText(e).then(()=>{n.notify({tone:`success`,title:`Command copied`})}).catch(()=>{n.notify({tone:`error`,title:`Copy failed`,message:`The browser could not copy the launch command.`})})},onBrandClick:()=>$(`/`),onOpenProject:e=>m.mutate(e),onLogout:()=>g.mutate()})}function _z(e){let t=e?.relay;if(t?.join_url_visibility===`visible_once`&&t.join_url!==void 0&&t.join_url.trim()!==``)return t.join_url}function vz(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return!1}}function yz(e,t){let n=_z(e);if(n!==void 0)return{kind:`join`,joinUrl:n};let r=e?.relay?.relay_project_ref;return r===void 0?{kind:`unavailable`,message:`Relay project is unavailable`}:vz(t.currentOrigin,t.relayBaseUrl)?{kind:`relay_open`,relayProjectRef:r}:{kind:`unavailable`,message:`Open the latest Join URL printed by tutti launch.`}}var bz=`gpt-5.5`,xz=`/host-local/v1`;function Sz(){return new URL(window.location.href).searchParams.get(`token`)?.trim()??``}function Cz(e){return{baseUrl:xz,credentials:`same-origin`,headers:{authorization:`Bearer ${e}`}}}function wz(e){return I(Cz(e),`/provider/config`)}function Tz(e){return I(Cz(e),`/launch-status`)}function Ez(e){return I(Cz(e),`/project`)}function Dz(e,t){return I(Cz(e),`/project`,{method:`POST`,body:t})}function Oz(e,t){return I(Cz(e),`/provider/config`,{method:`POST`,body:t})}function kz(e){return e===void 0?`loading`:e.status===`configured`?`configured`:e.status===`invalid`?`invalid`:`not configured`}function Az(e){let t=e instanceof Error&&`code`in e?String(e.code):``;return t.startsWith(`provider_`)?t:eR(e)}function jz(){let e=Sz(),t=e===``,[n,r]=(0,N.useState)({projectName:``,apiKey:``,baseUrl:``,defaultModel:bz}),[i,a]=(0,N.useState)(null),[o,s]=(0,N.useState)(null),c=(0,N.useRef)(!1),l=F({queryKey:[`host-local`,`provider-config`,e],queryFn:()=>wz(e),enabled:!t}),u=F({queryKey:[`host-local`,`launch-status`,e],queryFn:()=>Tz(e),enabled:!t}),d=F({queryKey:[`host-local`,`project`,e],queryFn:()=>Ez(e),enabled:!t}),f=u.data,p=yt({mutationFn:e=>Jn(YL,e.relayProjectRef),onSuccess:e=>{if(e.disposition.kind===`opened`&&e.result?.open_url!==void 0){QL(e.result.open_url);return}s(`Host is offline`)},onError:e=>{s(eR(e))}}),m=yt({mutationFn:async()=>{let t=n.projectName.trim(),r=d.data?.display_name.trim()??``;t!==``&&t!==r&&await Dz(e,{display_name:t});let i={api_key:n.apiKey.trim()},a=n.baseUrl.trim(),o=n.defaultModel.trim();return a!==``&&(i.base_url=a),o!==``&&(i.default_model=o),await Oz(e,i)},onSuccess:()=>{a(`Provider saved.`),r(e=>({...e,apiKey:``})),d.refetch(),l.refetch(),v()}}),h=l.data;(0,N.useEffect)(()=>{let e=d.data?.display_name;e!==void 0&&r(t=>t.projectName.trim()===``?{...t,projectName:e}:t)},[d.data?.display_name]),(0,N.useEffect)(()=>{t||h?.status!==`configured`||v()},[h?.status,t]);let g=t?`Setup token is missing.`:d.error===null?l.error===null?m.error===null?o:Az(m.error):Az(l.error):Az(d.error);function _(e){e.preventDefault(),a(null),s(null),c.current=!1,!t&&n.apiKey.trim()!==``&&n.projectName.trim()!==``&&m.mutate()}async function v(){if(c.current)return;c.current=!0;let e=yz(f??(await u.refetch()).data,{currentOrigin:window.location.origin,relayBaseUrl:JL});if(e.kind===`join`){window.location.assign(e.joinUrl);return}if(e.kind===`unavailable`){s(e.message);return}p.mutate({relayProjectRef:e.relayProjectRef})}return(0,P.jsx)(BS,{form:n,statusLabel:kz(h),configured:h?.status===`configured`,loading:l.isLoading||d.isLoading,pending:m.isPending,tokenMissing:t,error:g,success:i,openProjectPending:p.isPending,onChange:e=>r(t=>({...t,...e})),onSubmit:_,onRetry:()=>void l.refetch(),onBrandClick:()=>$(`/`)})}function Mz(e){return`${e.created_at}:${e.id}`}function Nz(e){return{kind:`initial`,entry:e}}function Pz(e,t=50){if(e.kind===`older`)return{before:e.before,limit:t};if(e.kind===`newer`)return{after:e.after,limit:t};switch(e.entry.kind){case`latest`:return{limit:t};case`start`:return{anchor:`start`,limit:t};case`around`:return{around:e.entry.messageId,limit:t}}}function Fz(e){let t=e.window.older_cursor;return e.window.has_older&&t!==void 0?{kind:`older`,before:t}:void 0}function Iz(e){let t=e.window.newer_cursor;return e.window.has_newer&&t!==void 0?{kind:`newer`,after:t}:void 0}function Lz(e,t=50){let n=e[0],r=e.at(-1);if(n===void 0||r===void 0)return{items:[],window:{has_older:!1,has_newer:!1,limit:t}};let i=new Map;for(let t of e)for(let e of t.items)i.set(e.id,e);let a=[...i.values()].sort((e,t)=>Mz(e).localeCompare(Mz(t))),o={has_older:n.window.has_older,has_newer:r.window.has_newer,limit:n.window.limit};return o.has_older&&n.window.older_cursor!==void 0&&(o.older_cursor=n.window.older_cursor),o.has_newer&&r.window.newer_cursor!==void 0&&(o.newer_cursor=r.window.newer_cursor),{items:a,window:o}}var Rz=5400,zz=1500;function Bz(e){let t=e.completionSource;return t?.activityRef??t?.workflowRef??t?.taskId??e.key}function Vz(e){switch(e.kind){case`accepted`:case`already_running`:return null;case`scratchpad_empty`:return{label:`Scratchpad is empty. Let it refresh before running.`,tone:`error`};case`stale_scratchpad`:return{label:`Scratchpad changed. Review the latest snapshot and run again.`,tone:`error`};case`provider_not_configured`:return{label:`Provider is not configured yet.`,tone:`error`};case`provider_unavailable`:return{label:`Provider unavailable: ${e.reason}.`,tone:`error`};case`interrupted`:return{label:`Run was interrupted. Try again.`,tone:`error`}}}function Hz(e,t){t.displayName.trim()===``||e.has(t.key)||e.set(t.key,t)}function Uz(e){if(e.author.kind!==`human`)return null;let t=e.author.display_name?.trim()||`Member`;return{key:e.author.ref===void 0?`message-author:${t.toLocaleLowerCase()}`:e.author.ref,displayName:t,avatar:e.author.avatar??{kind:`initials`,initials:dr(t),color:`blue`}}}function Wz({account:e,presence:t,messages:n=[]}){let r=new Map;e!==void 0&&Hz(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of t?.sample_members??[])Hz(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of t?.members??[])Hz(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of n){let t=Uz(e);t!==null&&Hz(r,t)}return[...r.values()]}function Gz({account:e,presence:t}){let n={},r=(e,t)=>{let r=n[e];n[e]={avatar:t.avatar,online:r?.online===!0||t.online}};for(let e of t?.members??[])r(e.account_ref,{avatar:e.avatar,online:e.online});for(let e of t?.sample_members??[])r(e.account_ref,{avatar:e.avatar,online:!0});return e!==void 0&&r(e.account_ref,{avatar:e.avatar,online:!0}),n}function Kz({relayProjectRef:e}){let t=rt(),n=WL(),r=(0,N.useMemo)(()=>Pn({...YL,relayProjectRef:e}),[e]),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(``),[c,l]=(0,N.useState)(null),[u,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(null),[m,h]=(0,N.useState)(()=>Date.now()),[g,_]=(0,N.useState)(null),v=new URL(ZL(),window.location.origin).searchParams.get(`message`),y=v!==null&&Vt(v,Lt.message)?v:void 0,[b,x]=(0,N.useState)(()=>y===void 0?{kind:`latest`}:{kind:`around`,messageId:y}),S=(0,N.useRef)(null),C=(0,N.useRef)(null),w=(0,N.useRef)(null),[T,E]=(0,N.useState)(null),ee=u!==null;(0,N.useEffect)(()=>{y!==void 0&&(b.kind!==`around`||b.messageId!==y)&&x({kind:`around`,messageId:y})},[b,y]);let D=(t=null)=>{x({kind:`latest`}),_(t),y!==void 0&&$(rn(e),{replace:!0})},O=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:XL}),k=O.data?.session.account.account_ref,te=k===void 0?null:`${k}:${e}`,ne=y!==void 0||te!==null&&T===te;(0,N.useEffect)(()=>{te===null||T===te||(y===void 0&&k!==void 0&&x(zR(k,e).start_chat_pending?{kind:`start`}:{kind:`latest`}),E(te))},[k,te,e,y,T]);let A=bt({queryKey:Q.messageHistory(e,b,50),queryFn:({pageParam:e})=>r.getMessages(Pz(e)),initialPageParam:Nz(b),getPreviousPageParam:e=>Fz(e),getNextPageParam:e=>Iz(e),enabled:O.isSuccess&&ne,staleTime:XL}),re=F({queryKey:Q.scratchpad(e),queryFn:()=>r.getScratchpad(),enabled:O.isSuccess,staleTime:XL,refetchInterval:ee?zz:!1}),ie=F({queryKey:Q.activeClarification(e),queryFn:()=>r.getActiveClarification(),enabled:O.isSuccess,staleTime:XL,refetchInterval:ee?zz:!1}),j=F({queryKey:Q.activeApproval(e),queryFn:()=>r.getActiveApproval(),enabled:O.isSuccess,staleTime:XL}),M=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:O.isSuccess,staleTime:XL,refetchInterval:ee?zz:!1}),ae=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:O.isSuccess,staleTime:XL}),oe=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:O.isSuccess,staleTime:XL}),se=F({queryKey:Q.projectPresence(e),queryFn:()=>Yn(YL,e),enabled:O.isSuccess,staleTime:XL,refetchInterval:6e4});rR(O.isSuccess);let ce=yt({mutationFn:e=>r.updateProjectDisplayName({display_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project name`,message:e}),onSuccess:(r,i,a)=>{iR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project name saved`,message:i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project name save failed`,message:`${t}: ${eR(e)}`})}}),le=yt({mutationFn:e=>r.updateProjectDescription({description:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project description`,...e.length===0?{}:{message:e}}),onSuccess:(r,i,a)=>{iR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project description saved`,...i.length===0?{}:{message:i}})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project description save failed`,message:eR(e)})}}),ue=yt({mutationFn:({body:e,commandId:t})=>r.sendMainChatMessage({body:e},{commandId:t}),onSuccess:(n,r)=>{S.current=null,a(e=>e.trim()===r.body?``:e),n.result?.message!==void 0&&(b.kind===`latest`&&!A.hasNextPage?_(n.result.message.id):D(n.result.message.id)),iR(t,e,n.invalidates)},onError:e=>{n.notify({tone:`error`,title:`Message send failed`,message:eR(e)})}}),de=yt({mutationFn:async t=>{let n=await kR({relayProjectRef:e,purpose:`reference_file`,file:t});return r.uploadReferenceFile(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading reference`,message:e.name}),onSuccess:(r,i,a)=>{let o=r.result?.message;o!==void 0&&(b.kind===`latest`&&!A.hasNextPage?_(o.id):D(o.id)),iR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Reference uploaded`,message:r.result?.file.name??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Reference upload failed`,message:eR(e)})}}),fe=yt({mutationFn:e=>r.submitWorklist(e===void 0?{}:{expected_scratchpad_updated_at:e}),onMutate:()=>(d({kind:`request`}),n.notify({tone:`loading`,title:`Running Scratchpad`})),onSuccess:(r,i,a)=>{if(r.disposition.kind===`accepted`){let e=r.result?.activity_ref;d(e===void 0?null:{kind:`activity`,activityRef:e,...r.result?.workflow_ref===void 0?{}:{workflowRef:r.result.workflow_ref}}),n.update(a,{tone:`success`,title:`Scratchpad run started`,message:`Tutti is preparing Worklist tasks.`})}else if(r.disposition.kind===`already_running`)d(null),n.update(a,{tone:`info`,title:`Already running`,message:`Tutti is already processing work.`});else{d(null);let e=Vz(r.disposition);n.update(a,{tone:e?.tone??`warning`,title:`Scratchpad run blocked`,...e?.label===void 0?{}:{message:e.label}})}iR(t,e,r.invalidates)},onError:(e,t,r)=>{d(null),n.update(r,{tone:`error`,title:`Scratchpad run failed`,message:eR(e)})}}),pe=O.data,me=Gz({account:pe?.session.account,presence:se.data?.presence}),he=pe?.generated_at??new Date(0).toISOString(),ge=A.data===void 0?void 0:Lz(A.data.pages,50),_e=ge??(ne&&b.kind===`latest`?pe?.snapshots.main_chat:void 0)??aR(),ve=A.data!==void 0&&A.hasPreviousPage===!0,ye=A.data!==void 0&&A.hasNextPage===!0,be=b.kind===`latest`||b.kind===`start`&&!ye||b.kind===`around`&&_e.items.length>0&&!ye,xe=b.kind===`around`?`around:${b.messageId}`:b.kind,Se=b.kind===`around`?`focus`:b.kind===`start`?`start`:`latest`,Ce=pe!==void 0&&(!ne||ge===void 0&&A.isLoading&&(b.kind!==`latest`||pe.snapshots.main_chat===void 0)),we=re.data??pe?.snapshots.scratchpad??sR(),Te=ae.data??pe?.snapshots.read_state;lR({enabled:O.isSuccess,hostClient:r,relayProjectRef:e,readState:Te,scope:`chat`});let Ee=ie.data??pe?.snapshots.active_clarification??uR(),De=j.data??pe?.snapshots.active_approval??{state:`none`},Oe=Ee.state===`active`?Ee.round.id:void 0;(0,N.useEffect)(()=>{c!==null&&(Oe===void 0||c!==Oe)&&l(null)},[Oe,c]);let ke=Ee.state===`active`&&Ee.thread.owner.kind===`task_compile`,Ae=(0,N.useMemo)(()=>{let e=new Set;for(let t of _e.items)t.clarification_card!==void 0&&e.add(t.clarification_card.round_id);return Oe!==void 0&&e.add(Oe),[...e]},[Oe,_e.items]),je=_t({queries:Ae.map(t=>({queryKey:Q.clarificationRoundMessages(e,t),queryFn:()=>r.getClarificationRoundMessages(t,{anchor:`start`,limit:50}),enabled:O.isSuccess}))}),Me=yt({mutationFn:({roundId:e,body:t})=>r.sendClarificationRoundMessage(e,{body:t}),onSuccess:n=>{s(``),iR(t,e,n.invalidates)},onError:e=>{n.notify({tone:`error`,title:`Reply send failed`,message:eR(e)})}}),Ne=yt({mutationFn:e=>r.submitClarificationRound(e),onMutate:e=>(l(e),n.notify({tone:`loading`,title:`Submitting reply`})),onSuccess:(r,i,a)=>{iR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Reply submitted`})},onError:(e,t,r)=>{l(e=>e===t?null:e),n.update(r,{tone:`error`,title:`Reply submit failed`,message:eR(e)})}}),Pe=yt({mutationFn:({approvalId:e,decisionId:t})=>r.decideApproval(e,{decision_id:t}),onMutate:()=>n.notify({tone:`loading`,title:`Sending decision`}),onSuccess:(r,i,a)=>{iR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Decision sent`})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Decision failed`,message:eR(e)})}}),Fe=Object.fromEntries(Ae.map((e,t)=>[e,(je[t]?.data??aR()).items.map(e=>_r(e,{authorProfiles:me}))])),Ie=Wz({account:pe?.session.account,presence:se.data?.presence,messages:[..._e.items,...je.flatMap(e=>e.data?.items??[])]}),Le=M.data??pe?.snapshots.execution_status??dR(he),Re=fR(Le),ze=pR(Le,`scratchpad_refresh`),Be=pR(Le,`scratchpad_refresh`,`foreground`),Ve=pR(Le,`task_compile`,`foreground`),He=pR(Le,`project_context_bootstrap`,`foreground`),Ue=u?.kind===`activity`?u.activityRef:void 0,We=u?.kind===`activity`?u.workflowRef:void 0;(0,N.useEffect)(()=>{if(u===null)return;if(we.state===`submitted`){d(null);return}if(we.state===`empty`){d(null);return}if(Le.status===`pending`){ke||d(null);return}let e=Le.last_conclusion,t=We!==void 0&&e?.workflow_ref===We,r=Ue!==void 0&&e?.activity_ref===Ue;if(!(!t&&!r)){if(d(null),e?.kind===`failed`){n.notify({tone:`error`,title:`Scratchpad run failed`,message:e.summary});return}if(e?.kind===`needs_human`){n.notify({tone:`warning`,title:`Scratchpad needs input`,message:e.summary});return}}},[Le.last_conclusion?.activity_ref,Le.last_conclusion?.kind,Le.last_conclusion?.summary,Le.last_conclusion?.workflow_ref,Le.status,Le.summary,ke,n,we.state,u,Ue,We]);let Ge=Ue!==void 0&&Re.some(e=>e.activity_ref===Ue),Ke=Ge&&Re.some(e=>e.activity_ref===Ue&&e.workflow_kind===`scratchpad_refresh`)||u!==null&&Be,qe=Ve||He||Ke||Ge||ke,Je=ze,Ye=fe.isPending||qe||u!==null&&Le.status===`idle`,Xe=Le.status!==`idle`||Ye||f!==null;(0,N.useEffect)(()=>{if(!Xe)return;h(Date.now());let e=window.setInterval(()=>{h(Date.now())},1e3);return()=>{window.clearInterval(e)}},[Xe]);let Ze=Re.some(e=>e.activity_kind===`procedure`&&(e.lane??`foreground`)===`foreground`)&&!Je&&!Ye,Qe=qx(Le),$e={key:`scratchpad-submit`,label:ke?`Needs input`:Ke?`Compiling Worklist tasks`:He?`Preparing project context`:Ve?`Compiling Worklist tasks`:`Preparing Worklist`,title:ke?`Needs input`:`Preparing Scratchpad for Worklist.`,tone:ke?`pending`:`running`,target:ke?{kind:`clarification`}:{kind:`scratchpad`}},et=Ye&&Qe.length===0?[$e]:Qe,tt=Ux(Le,{now:m}),nt=Re.find(e=>(e.lane??`foreground`)===`foreground`?e.workflow_kind===`project_context_bootstrap`&&He||e.workflow_kind===`task_compile`&&Ve||e.workflow_kind===`scratchpad_refresh`&&Ke?!0:Ue!==void 0&&e.activity_ref===Ue:!1),it=(Ye?Wx({activeScratchpadRefreshFromSubmit:Ke,activeProjectContextBootstrap:He,activeTaskCompile:Ve,activeTaskCompileClarification:ke,now:m,...nt?.started_at===void 0?{}:{startedAt:nt.started_at},...Le.runtime===void 0?{}:{runtime:Le.runtime}}):null)??tt;(0,N.useEffect)(()=>{it!==null&&(C.current=it,p(null))},[it]),(0,N.useEffect)(()=>{if(!ze||it!==null)return;let e=C.current;if(e?.completionSource===void 0)return;let t=`hidden:${Bz(e)}`;if(w.current===t)return;w.current=t;let n=Gx(e,e.summary);p(n),C.current=null;let r=window.setTimeout(()=>{p(e=>e?.key===n.key?null:e)},Rz);return()=>{window.clearTimeout(r)}},[it,ze]),(0,N.useEffect)(()=>{if(it!==null||Le.status!==`idle`)return;let e=Le.last_conclusion;if(e?.kind!==`completed`)return;let t=e.activity_ref??`${e.kind}:${e.task_id??`none`}:${e.occurred_at}`;if(w.current===t)return;let n=C.current;if(n===null)return;if(!Kx(n,e)){C.current=null;return}w.current=t;let r=Gx(n,e.summary);p(r);let i=window.setTimeout(()=>{p(e=>e?.key===r.key?null:e),C.current=null},Rz);return()=>{window.clearTimeout(i)}},[it,Le.last_conclusion?.activity_ref,Le.last_conclusion?.kind,Le.last_conclusion?.occurred_at,Le.last_conclusion?.summary,Le.last_conclusion?.task_id,Le.status]);let at=it??f,ot=f===null?null:{key:`completed`,label:`Completed`,tone:`done`,target:f.completionTarget??{kind:`scratchpad`}},st=ot===null?et:[ot,...et],ct=e=>{e.preventDefault();let t=i.trim();if(t!==``&&!ue.isPending){let e=S.current?.body===t?S.current:{body:t,commandId:Wt()};S.current=e,ue.mutate(e)}},lt=e=>{e.preventDefault();let t=o.trim();t!==``&&Oe!==void 0&&!Me.isPending&&Me.mutate({roundId:Oe,body:t})},ut=ne&&ge===void 0&&A.error!==null&&(b.kind!==`latest`||pe?.snapshots.main_chat===void 0),dt=pe===void 0&&O.error!==null||ut;return(0,N.useEffect)(()=>{y!==void 0&&_(y)},[y]),(0,P.jsx)(EC,{projectName:pe?.workspace.project.display_name??`Workspace`,projectDescription:pe?.workspace.project.description??``,members:Ie,messages:_e.items.map(e=>_r(e,{authorProfiles:me,referenceAssetUrl:(e,t,n)=>r.viewerAssetUrl({path:e,variant:t,v:n})})),scratchpad:Nr(we,_e.items),executionProgress:at,activeApproval:Sr(De),activeClarification:vr(Ee),clarificationMessagesByRoundId:Fe,statusShortcuts:st,unread:cR(Te),artifactSignal:lx(oe.data?.artifact),draft:i,roundDraft:o,sendPending:ue.isPending,focusMessageId:g,messageHistoryIdentity:xe,initialMessagePosition:Se,hasOlderMessages:ve,hasNewerMessages:ye,loadingOlderMessages:A.isFetchingPreviousPage,loadingNewerMessages:A.isFetchingNextPage,historyConnectedToLatest:be,submittedRoundId:c,referenceUploadPending:de.isPending,scratchpadSyncPending:Je,scratchpadActionsDisabled:Ze,scratchpadSubmitPending:Ye,roundSendPending:Me.isPending,roundSubmitPending:Ne.isPending,approvalDecisionPending:Pe.isPending,projectNameSaving:ce.isPending,projectDescriptionSaving:le.isPending,loading:pe===void 0&&O.isLoading||Ce,unavailable:dt,onDraftChange:e=>{S.current?.body!==e.trim()&&(S.current=null),a(e)},onMessageFocused:()=>_(null),onInitialMessagePositioned:()=>{b.kind===`start`&&A.isSuccess&&k!==void 0&&HR(k,e)},onLoadOlderMessages:()=>{A.fetchPreviousPage()},onLoadNewerMessages:()=>{A.fetchNextPage()},onJumpToLatest:()=>D(),onUploadReferenceFile:e=>de.mutate(e),onOpenReferenceFile:t=>$(mR(e,t)),onRoundDraftChange:s,onSendMessage:ct,onSendRoundMessage:lt,onSubmitRound:()=>{Oe!==void 0&&Ne.mutate(Oe)},onDecideApproval:(e,t)=>Pe.mutate({approvalId:e,decisionId:t}),onSubmitScratchpad:()=>fe.mutate(we.updated_at),onUpdateProjectDisplayName:async e=>{await ce.mutateAsync(e)},onUpdateProjectDescription:async e=>{await le.mutateAsync(e)},onOpenProjectCenter:()=>$(`/projects`),onOpenWorklist:()=>$(gR(e)),onOpenWorklistTask:t=>$(gR(e,t)),onOpenReferences:()=>$(mR(e)),onOpenArtifacts:()=>$(hR(e)),onOpenSkills:()=>$(bR(e)),onOpenTimeline:()=>$(yR(e)),onOpenSettings:()=>$(vR(e)),onActivateStatusShortcut:t=>SR(e,t)})}function qz(e){return Qt(e)?Zt(e,`relay_session_invalid`)?`client_session`:`account_session`:null}function Jz(e){return e===`client_session`?{title:`Workspace session expired`,message:`Open the project again from Project Center.`}:{title:`Sign in required`,message:`Sign in to Tutti before opening this workspace.`}}function Yz(e){return e===`client_session`?`/projects`:`/`}function Xz({relayProjectRef:e,children:t}){let n=rt(),r=WL(),i=(0,N.useMemo)(()=>Pn({...YL,relayProjectRef:e}),[e]),a=(0,N.useRef)(void 0),o=(0,N.useRef)(null),s=F({queryKey:Q.bootstrap(e),queryFn:()=>i.getBootstrap(),staleTime:XL}),c=qz(s.error),l=c===null&&s.data?.workspace.capabilities.sse===!0;return a.current===void 0&&s.data!==void 0&&(a.current=s.data.event_cursor),(0,N.useEffect)(()=>{if(c===null)return;let t=`${e}:${c}`;o.current!==t&&(o.current=t,r.notify({tone:`warning`,...Jz(c)}),$(Yz(c),{replace:!0}))},[c,r,e]),(0,N.useEffect)(()=>{if(!l)return;let t=i.connectEvents({...a.current===void 0?{}:{after:a.current},onReady:t=>{t.payload.replay.status===`missed`&&n.invalidateQueries({queryKey:Q.hostRoot(e)})},onInvalidate:t=>{iR(n,e,t)},onError:()=>void 0});return()=>t.close()},[i,n,e,l]),c===null?t:null}function Zz({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...YL,relayProjectRef:e}),[e]),n=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap(),staleTime:XL}).data?.session.account.account_ref,r=n===void 0?null:`${n}:${e}`,[i,a]=(0,N.useState)({identity:null,pending:!1}),[o,s]=(0,N.useState)(!1),c=Bd();(0,N.useEffect)(()=>{n===void 0||r===null||i.identity===r||a({identity:r,pending:zR(n,e).tour_pending})},[n,r,i.identity,e]);let l=t=>{UR(t,e),a({identity:r,pending:!1})};return(0,P.jsxs)(P.Fragment,{children:[c&&r!==null&&i.identity===r&&i.pending&&n!==void 0&&typeof document<`u`?(0,_c.createPortal)((0,P.jsx)(qd,{onOpen:()=>{l(n),s(!0)},onDismiss:()=>l(n)}),document.body):null,(0,P.jsx)(Jd,{assets:cS,open:o,onOpenChange:s})]})}var Qz=2e4,$z=3e4;function eB(e){let t=e.intervalMs??Qz,n=e.setIntervalFn??window.setInterval.bind(window),r=e.clearIntervalFn??window.clearInterval.bind(window),i=!0,a=!1,o=!1,s=()=>{!i||a||(a=!0,e.renew().then(()=>{i&&!o&&(o=!0,e.onInitialRenewed?.())}).catch(()=>void 0).finally(()=>{a=!1}))};s();let c=n(s,t);return()=>{i=!1,r(c)}}function tB(e){if(!(e===void 0||e.disposition.kind===`issued`))return e.disposition.kind===`invalid_manifest`?e.disposition.message:e.disposition.kind===`preview_not_ready`?e.disposition.message??`Preview is not ready`:e.disposition.kind===`not_declared`?`Artifact is no longer declared`:`Preview session expired before it could be opened`}function nB(e){return e===void 0?!1:e.disposition.kind!==`issued`||e.result===void 0?e.disposition.kind===`preview_not_ready`||e.disposition.kind===`interrupted`?1e3:!1:Math.max(1e3,Date.parse(e.result.expires_at)-Date.now()-$z)}function rB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...YL,relayProjectRef:e}),[e]),n=(0,N.useMemo)(()=>zn(YL),[]),r=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap(),staleTime:XL}),i=F({queryKey:Q.artifacts(e),queryFn:()=>t.getArtifacts(),enabled:r.isSuccess,staleTime:XL}),a=F({queryKey:Q.executionStatus(e),queryFn:()=>t.getExecutionStatus(),enabled:r.isSuccess,staleTime:XL}),o=F({queryKey:Q.readState(e),queryFn:()=>t.getReadState(),enabled:r.isSuccess,staleTime:XL}),s=r.data,c=s?.generated_at??new Date(0).toISOString(),l=o.data??s?.snapshots.read_state,u=a.data??s?.snapshots.execution_status??dR(c),d=u.active_activity?.activity_kind===`run`||u.active_activities?.some(e=>e.activity_kind===`run`)===!0,f=i.data?.artifact,p=f?.status===`declared`&&f.preview.status===`ready`&&f.preview.url!==void 0?f.preview.url:null,m=F({queryKey:Q.artifactPreviewSession(e,p??`not-ready`),queryFn:()=>n.issueArtifactPreviewSession(e),enabled:p!==null,staleTime:1/0,retry:1,refetchInterval:e=>nB(e.state.data)}),h=m.data,g=h?.disposition.kind===`issued`?h.result?.bootstrap_url:void 0,_=m.error===null?tB(h):eR(m.error);(0,N.useEffect)(()=>{if(r.isSuccess)return eB({renew:()=>t.renewArtifactPreviewLease(),onInitialRenewed:()=>{i.refetch()}})},[i.refetch,r.isSuccess,t]);let v=i.data!==void 0,y=!v&&(r.error!==null||i.error!==null);return(0,P.jsx)(DC,{statusShortcuts:qx(u),unread:cR(l),state:cx(i.data?.artifact,{...g===void 0?{}:{previewUrl:g},pending:p!==null&&g===void 0&&_===void 0,..._===void 0?{}:{errorMessage:_}},{runActive:d}),loading:!v&&(r.isLoading||i.isLoading),unavailable:y,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(gR(e)),onOpenReferences:()=>$(mR(e)),onOpenSkills:()=>$(bR(e)),onOpenTimeline:()=>$(yR(e)),onOpenSettings:()=>$(vR(e)),onActivateStatusShortcut:t=>SR(e,t)})}function iB({relayProjectRef:e}){let t=rt(),n=WL(),r=(0,N.useMemo)(()=>Pn({...YL,relayProjectRef:e}),[e]),i=new URL(ZL(),window.location.origin).searchParams.get(`path`)??void 0,[a,o]=(0,N.useState)(i),[s,c]=(0,N.useState)(`time`),l=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:XL}),u=F({queryKey:Q.referenceFiles(e),queryFn:()=>r.getReferenceFiles({limit:200}),enabled:l.isSuccess,staleTime:XL}),d=F({queryKey:Q.messagesWindow(e,200),queryFn:()=>r.getMessages({limit:200}),enabled:l.isSuccess,staleTime:XL}),f=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:l.isSuccess,staleTime:XL}),p=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:l.isSuccess,staleTime:XL}),m=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:l.isSuccess,staleTime:XL}),h=u.data?.items??[],g=(0,N.useMemo)(()=>{let e=new Map;for(let t of d.data?.items??[]){let n=t.refs?.reference_file;if(n===void 0)continue;let r=e.get(n.path);(r===void 0||t.created_at>r)&&e.set(n.path,t.created_at)}return e},[d.data?.items]),_=(0,N.useMemo)(()=>{let e=(e,t)=>e.name.localeCompare(t.name),t=(t,n)=>{let r=g.get(t.path)??``,i=g.get(n.path)??``;return r===i?e(t,n):i.localeCompare(r)},n=(e,n)=>{let r=e.extension??e.media_type??`file`,i=n.extension??n.media_type??`file`;return r===i?t(e,n):r.localeCompare(i)},r=[...h.filter(e=>e.category===`image`&&e.source===`human_upload`)].sort(t),i=[...h.filter(e=>!(e.category===`image`&&e.source===`human_upload`))].sort(s===`time`?t:n);return[...r,...i]},[s,h,g]);(0,N.useEffect)(()=>{if(_.length===0){a!==void 0&&o(void 0);return}if(i!==void 0&&_.some(e=>e.path===i)){a!==i&&o(i);return}(a===void 0||!_.some(e=>e.path===a))&&o(_[0]?.path)},[_,i,a]);let v=h.find(e=>e.path===a),y=v?.category===`image`,b=v?.text_read.can_read===!0,x=F({queryKey:a===void 0?Q.viewerFile(e,`none`):Q.viewerFile(e,a),queryFn:()=>r.getViewerFile({path:a,max_bytes:204800}),enabled:l.isSuccess&&a!==void 0&&b&&!y,staleTime:XL}),S=yt({mutationFn:async t=>{let n=await kR({relayProjectRef:e,purpose:`reference_file`,file:t});return r.uploadReferenceFile(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading reference`,message:e.name}),onSuccess:(r,i,a)=>{iR(t,e,r.invalidates),r.result?.file.path!==void 0&&(o(r.result.file.path),$(mR(e,r.result.file.path))),n.update(a,{tone:`success`,title:`Reference uploaded`,message:r.result?.file.name??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Reference upload failed`,message:eR(e)||t.name})}}),C=l.data,w=C?.generated_at??new Date(0).toISOString(),T=p.data??C?.snapshots.read_state;lR({enabled:l.isSuccess,hostClient:r,relayProjectRef:e,readState:T,scope:`references`});let E=f.data??C?.snapshots.execution_status??dR(w),ee=_.map(e=>{let t=sB(e,u.data?.directory.tutti_path);return{path:e.path,name:e.name,meta:oB(e),source:e.source,...t===void 0?{}:{generatedGroup:t},selected:e.path===a,canPreview:e.text_read.can_read,category:e.category,...e.category===`image`&&e.source===`human_upload`?{...e.blob_oid===void 0?{}:{thumbnailUrl:r.viewerAssetUrl({path:e.path,variant:`thumbnail`,v:e.blob_oid})}}:{},...e.extension===void 0?{}:{extension:e.extension}}}),D=x.data?.content,O=(()=>{if(v===void 0)return{title:h.length===0?`No reference files`:`No file selected`,unavailableReason:h.length===0?`No reference files`:`Select a reference file`};if(D?.kind===`text`)return{title:v.name,meta:wR(v.size_bytes),...aB(v),content:D.text};if(y&&a!==void 0)return v.blob_oid===void 0?{title:v.name,meta:wR(v.size_bytes),...aB(v),unavailableReason:`Image version unavailable`}:{title:v.name,meta:wR(v.size_bytes),...aB(v),imageUrl:r.viewerAssetUrl({path:a,variant:`preview`,v:v.blob_oid})};let e=b&&x.isLoading?`Loading`:ER(D)??(b?void 0:TR(v.text_read.blocked_reason));return e===void 0?{title:v.name,meta:wR(v.size_bytes),...aB(v)}:{title:v.name,meta:wR(v.size_bytes),...aB(v),unavailableReason:e}})(),k=u.data!==void 0,te=!k&&(l.error!==null||u.error!==null);return(0,P.jsx)(OC,{statusShortcuts:qx(E),unread:cR(T),artifactSignal:lx(m.data?.artifact),files:ee,detail:O,uploadPending:S.isPending,fileSortMode:s,loading:!k&&(l.isLoading||u.isLoading),unavailable:te,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(gR(e)),onOpenArtifacts:()=>$(hR(e)),onOpenSkills:()=>$(bR(e)),onOpenTimeline:()=>$(yR(e)),onOpenSettings:()=>$(vR(e)),onActivateStatusShortcut:t=>SR(e,t),onSelectFile:t=>{o(t),$(mR(e,t))},onUploadFile:e=>S.mutate(e),onFileSortModeChange:c})}function aB(e){let t=e.summary;return t===void 0||t.status===`missing`?{summaryStatus:`Summary not available yet`}:t.status===`stale`?{...t.text===void 0?{}:{summary:t.text},summaryStatus:`Summary may be out of date`}:t.status===`unavailable`?{...t.text===void 0?{}:{summary:t.text},summaryStatus:`Summary could not be generated`}:t.text===void 0?{summaryStatus:`Summary unavailable`}:{summary:t.text}}function oB(e){let t=e.source===`tutti_output`?`Tutti`:`Uploaded`;if(e.category===`image`)return[t,e.media_type??`Image`,wR(e.size_bytes)].join(` · `);let n=[t,wR(e.size_bytes)];return e.text_read.can_read||n.push(TR(e.text_read.blocked_reason)),n.join(` · `)}function sB(e,t){if(e.source!==`tutti_output`||t===void 0)return;let n=`${t}/`;if(!e.path.startsWith(n))return;let[r,i]=e.path.slice(n.length).split(`/`);if(!(r===void 0||r.length===0||i===void 0))return r}function cB({relayProjectRef:e}){let t=rt(),n=WL(),r=(0,N.useMemo)(()=>Pn({...YL,relayProjectRef:e}),[e]),i=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap()}),a=F({queryKey:Q.hostWorkspace(e),queryFn:()=>r.getWorkspace(),enabled:i.isSuccess}),o=F({queryKey:Q.hostSession(e),queryFn:()=>r.getSession(),enabled:i.isSuccess}),s=F({queryKey:Q.providerConfig(e),queryFn:()=>r.getProviderConfig(),enabled:i.isSuccess}),c=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:i.isSuccess}),l=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:i.isSuccess}),u=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:i.isSuccess}),d=yt({mutationFn:e=>r.updateProjectDisplayName({display_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project name`,message:e}),onSuccess:(r,i,a)=>{iR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project name saved`,message:i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project name save failed`,message:`${t}: ${eR(e)}`})}}),f=yt({mutationFn:e=>r.updateProjectDescription({description:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project description`,...e.length===0?{}:{message:e}}),onSuccess:(r,i,a)=>{iR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project description saved`,...i.length===0?{}:{message:i}})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project description save failed`,message:eR(e)})}}),p=i.data,m=p?.generated_at??new Date(0).toISOString(),h=l.data??p?.snapshots.read_state,g=a.data??p?.workspace,_=o.data??p?.session,v=s.data??p?.provider_config,y=c.data??p?.snapshots.execution_status??dR(m),b=g===void 0||_===void 0||v===void 0?void 0:Jr(g,_,v),x=b===void 0&&(i.error!==null||a.error!==null||o.error!==null||s.error!==null),S=g?.relay.join_url,C=S===void 0||g===void 0||_===void 0?void 0:ez({inviterName:_.account.display_name,projectName:g.project.display_name,joinUrl:S});return(0,P.jsx)(zC,{...b===void 0?{}:{settings:b},statusShortcuts:qx(y),unread:cR(h),artifactSignal:lx(u.data?.artifact),loading:b===void 0&&(i.isLoading||a.isLoading||o.isLoading||s.isLoading),unavailable:x,projectNameSaving:d.isPending,projectDescriptionSaving:f.isPending,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(gR(e)),onOpenReferences:()=>$(mR(e)),onOpenArtifacts:()=>$(hR(e)),onOpenSkills:()=>$(bR(e)),onOpenTimeline:()=>$(yR(e)),onActivateStatusShortcut:t=>SR(e,t),...C===void 0?{}:{onCopyJoinUrl:()=>{navigator.clipboard.writeText(C).then(()=>{n.notify({tone:`success`,title:`Invitation copied`})}).catch(()=>{n.notify({tone:`error`,title:`Copy failed`,message:`The browser could not copy the invite link.`})})}},onUpdateProjectDisplayName:async e=>{await d.mutateAsync(e)},onUpdateProjectDescription:async e=>{await f.mutateAsync(e)}})}function lB({relayProjectRef:e}){let t=rt(),n=WL(),r=(0,N.useMemo)(()=>Pn({...YL,relayProjectRef:e}),[e]),i=new URL(ZL(),window.location.origin).searchParams.get(`skill`)??void 0,[a,o]=(0,N.useState)(i),s=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:XL}),c=F({queryKey:Q.skills(e),queryFn:()=>r.getSkills(),enabled:s.isSuccess,staleTime:XL}),l=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:s.isSuccess,staleTime:XL}),u=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:s.isSuccess,staleTime:XL}),d=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:s.isSuccess,staleTime:XL}),f=c.data?.items??[];(0,N.useEffect)(()=>{if(f.length===0){a!==void 0&&o(void 0);return}if(i!==void 0&&f.some(e=>e.name===i)){a!==i&&o(i);return}(a===void 0||!f.some(e=>e.name===a))&&o(f[0]?.name)},[i,a,f]);let p=F({queryKey:a===void 0?Q.skillDetail(e,`none`):Q.skillDetail(e,a),queryFn:()=>r.getSkill(a),enabled:s.isSuccess&&a!==void 0,staleTime:XL}),m=yt({mutationFn:async t=>{let n=await kR({relayProjectRef:e,purpose:`skill_zip`,file:t});return r.importSkillZip(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading skill`,message:e.name}),onSuccess:(r,i,a)=>{iR(t,e,r.invalidates);let s=r.result?.skill.name??(r.disposition.kind===`created`||r.disposition.kind===`replaced`?r.disposition.skill_name:void 0);s!==void 0&&(o(s),$(bR(e,s))),n.update(a,{tone:`success`,title:`Skill installed`,message:s??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Skill upload failed`,message:eR(e)})}}),h=yt({mutationFn:e=>r.deleteSkill({skill_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Deleting skill`,message:e}),onSuccess:(r,i,s)=>{iR(t,e,r.invalidates);let c=r.disposition.kind===`deleted`||r.disposition.kind===`not_found`?r.disposition.skill_name:a,l=f.find(e=>e.name!==c);o(l?.name),$(l===void 0?bR(e):bR(e,l.name)),n.update(s,{tone:`success`,title:`Skill deleted`,message:c??i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Skill delete failed`,message:`${t}: ${eR(e)}`})}}),g=s.data,_=g?.generated_at??new Date(0).toISOString(),v=u.data??g?.snapshots.read_state;lR({enabled:s.isSuccess,hostClient:r,relayProjectRef:e,readState:v,scope:`skills`});let y=l.data??g?.snapshots.execution_status??dR(_),b=f.map(e=>({name:e.name,description:e.description,...e.short_description===void 0?{}:{shortDescription:e.short_description},selected:e.name===a,...e.updated_at===void 0?{}:{updatedLabel:`Updated ${Zn(e.updated_at)}`}})),x=f.find(e=>e.name===a),S=(()=>{let e=p.data?.skill;return e===void 0?a===void 0?{title:f.length===0?`No skills`:`No skill selected`,unavailableReason:f.length===0?`No user skills`:`Select a skill`}:{title:x?.name??a,...x?.description===void 0?{}:{description:x.description},unavailableReason:p.isLoading?`Loading`:`Skill unavailable`}:{title:e.name,description:e.description,...e.updated_at===void 0?{}:{updatedLabel:`Updated ${Zn(e.updated_at)}`},skillMd:e.skill_md}})(),C=c.data!==void 0,w=!C&&(s.error!==null||c.error!==null);return(0,P.jsx)(VC,{statusShortcuts:qx(y),unread:cR(v),artifactSignal:lx(d.data?.artifact),skills:b,detail:S,uploadPending:m.isPending,deletePending:h.isPending,loading:!C&&(s.isLoading||c.isLoading),unavailable:w,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(gR(e)),onOpenReferences:()=>$(mR(e)),onOpenArtifacts:()=>$(hR(e)),onOpenTimeline:()=>$(yR(e)),onOpenSettings:()=>$(vR(e)),onActivateStatusShortcut:t=>SR(e,t),onSelectSkill:t=>{o(t),$(bR(e,t))},onUploadSkill:e=>m.mutate(e),onDeleteSkill:e=>h.mutate(e)})}function uB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...YL,relayProjectRef:e}),[e]),n=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap(),staleTime:XL}),r=F({queryKey:Q.projectTimeline(e),queryFn:()=>t.getProjectTimeline(),enabled:n.isSuccess,staleTime:XL}),i=F({queryKey:Q.executionStatus(e),queryFn:()=>t.getExecutionStatus(),enabled:n.isSuccess,staleTime:XL}),a=F({queryKey:Q.readState(e),queryFn:()=>t.getReadState(),enabled:n.isSuccess,staleTime:XL}),o=F({queryKey:Q.artifacts(e),queryFn:()=>t.getArtifacts(),enabled:n.isSuccess,staleTime:XL}),s=n.data,c=s?.generated_at??new Date(0).toISOString(),l=a.data??s?.snapshots.read_state,u=i.data??s?.snapshots.execution_status??dR(c),d=r.data===void 0&&(n.error!==null||r.error!==null);return(0,P.jsx)(HC,{...r.data===void 0?{}:{timeline:sx(r.data,{onOpenWorklistTask:t=>$(gR(e,t)),onOpenChatMessage:t=>$(_R(e,t)),onOpenReferenceFile:t=>$(mR(e,t))})},statusShortcuts:qx(u),unread:cR(l),artifactSignal:lx(o.data?.artifact),loading:r.data===void 0&&(n.isLoading||r.isLoading),unavailable:d,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(gR(e)),onOpenReferences:()=>$(mR(e)),onOpenArtifacts:()=>$(hR(e)),onOpenSkills:()=>$(bR(e)),onOpenSettings:()=>$(vR(e)),onActivateStatusShortcut:t=>SR(e,t)})}function dB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...YL,relayProjectRef:e}),[e]),n=new URL(ZL(),window.location.origin).searchParams.get(`task`)??void 0,[r,i]=(0,N.useState)(void 0),a=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap()}),o=F({queryKey:Q.worklist(e),queryFn:()=>t.getWorklist(),enabled:a.isSuccess}),s=F({queryKey:Q.executionStatus(e),queryFn:()=>t.getExecutionStatus(),enabled:a.isSuccess}),c=F({queryKey:Q.readState(e),queryFn:()=>t.getReadState(),enabled:a.isSuccess}),l=F({queryKey:Q.artifacts(e),queryFn:()=>t.getArtifacts(),enabled:a.isSuccess}),u=a.data,d=u?.generated_at??new Date(0).toISOString(),f=o.data??u?.snapshots.worklist??oR(),p=c.data??u?.snapshots.read_state;lR({enabled:a.isSuccess,hostClient:t,relayProjectRef:e,readState:p,scope:`worklist`});let m=(0,N.useMemo)(()=>Fr(f),[f]),h=n!==void 0&&m.some(e=>e.id===n),g=n!==void 0&&!h?n:void 0;(0,N.useEffect)(()=>{if(n!==void 0){i(h?e=>e===n?e:n:void 0);return}if(m.length===0){i(void 0);return}(r===void 0||!m.some(e=>e.id===r))&&i(CR(f,void 0))},[h,n,r,m,f]);let _=F({queryKey:r===void 0?Q.taskDetail(e,`none`):Q.taskDetail(e,r),queryFn:()=>t.getTaskDetail(r),enabled:a.isSuccess&&r!==void 0}),v=F({queryKey:r===void 0?Q.taskRunResults(e,`none`):Q.taskRunResults(e,r),queryFn:()=>t.getTaskRunResults(r,{limit:50}),enabled:a.isSuccess&&r!==void 0}),y=s.data??u?.snapshots.execution_status??dR(d),b=Pr(f,r),x=Gr(_.data,v.data),S=o.data!==void 0||u?.snapshots.worklist!==void 0,C=!S&&(a.error!==null||o.error!==null);return(0,P.jsx)(UC,{statusShortcuts:qx(y),unread:cR(p),artifactSignal:lx(l.data?.artifact),modules:b.modules,taskCount:b.taskCount,...x===void 0?{}:{detail:x},...g===void 0?{}:{missingTaskId:g},loading:!S&&(a.isLoading||o.isLoading),unavailable:C,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenReferences:()=>$(mR(e)),onOpenArtifacts:()=>$(hR(e)),onOpenSkills:()=>$(bR(e)),onOpenTimeline:()=>$(yR(e)),onOpenSettings:()=>$(vR(e)),onActivateStatusShortcut:t=>SR(e,t),onSelectTask:t=>{i(t),$(gR(e,t))}})}var fB=`is-scrollbar-active`,pB=1e3;function mB(e,t){let n=e.target;return n instanceof Element?n:t.scrollingElement??t.documentElement}function hB(e){let t=new Map,n=e=>{let n=t.get(e);n!==void 0&&(window.clearTimeout(n),t.delete(e)),e.classList.remove(fB)},r=e=>{let r=t.get(e);r!==void 0&&window.clearTimeout(r),e.classList.add(fB);let i=window.setTimeout(()=>n(e),pB);t.set(e,i)},i=t=>{r(mB(t,e))};return e.addEventListener(`scroll`,i,{capture:!0,passive:!0}),()=>{e.removeEventListener(`scroll`,i,!0);for(let[e,n]of t)window.clearTimeout(n),e.classList.remove(fB);t.clear()}}var gB=`--tutti-viewport-height`,_B=`--tutti-viewport-offset-top`;function vB(e,t=window){let n=e.documentElement,r=t.visualViewport,i=()=>{let e=r?.height??t.innerHeight,i=r?.offsetTop??0;n.style.setProperty(gB,`${Math.max(0,e)}px`),n.style.setProperty(_B,`${Math.max(0,i)}px`)};return i(),t.addEventListener(`resize`,i),t.addEventListener(`orientationchange`,i),r?.addEventListener(`resize`,i),r?.addEventListener(`scroll`,i),()=>{t.removeEventListener(`resize`,i),t.removeEventListener(`orientationchange`,i),r?.removeEventListener(`resize`,i),r?.removeEventListener(`scroll`,i),n.style.removeProperty(gB),n.style.removeProperty(_B)}}var yB=new $e({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function bB(){let e=$L();if(e.kind===`local_console`)return(0,P.jsx)(oz,{});if(e.kind===`home`)return(0,P.jsx)(KR,{});if(e.kind===`join`)return(0,P.jsx)(WR,{joinToken:e.joinToken});if(e.kind===`setup`)return(0,P.jsx)(jz,{});if(e.kind===`project_open`)return(0,P.jsx)(gz,{requestedOpenProjectRef:e.relayProjectRef});if(e.kind===`workspace`||e.kind===`worklist`||e.kind===`references`||e.kind===`artifacts`||e.kind===`skills`||e.kind===`timeline`||e.kind===`settings`){let t=e.kind===`workspace`?(0,P.jsx)(Kz,{relayProjectRef:e.relayProjectRef}):e.kind===`worklist`?(0,P.jsx)(dB,{relayProjectRef:e.relayProjectRef}):e.kind===`references`?(0,P.jsx)(iB,{relayProjectRef:e.relayProjectRef}):e.kind===`artifacts`?(0,P.jsx)(rB,{relayProjectRef:e.relayProjectRef}):e.kind===`skills`?(0,P.jsx)(lB,{relayProjectRef:e.relayProjectRef}):e.kind===`timeline`?(0,P.jsx)(uB,{relayProjectRef:e.relayProjectRef}):(0,P.jsx)(cB,{relayProjectRef:e.relayProjectRef});return(0,P.jsxs)(Xz,{relayProjectRef:e.relayProjectRef,children:[t,(0,P.jsx)(Zz,{relayProjectRef:e.relayProjectRef})]},e.relayProjectRef)}return(0,P.jsx)(gz,{})}function xB(){return(0,N.useEffect)(()=>{let e=hB(document),t=vB(document);return()=>{e(),t()}},[]),(0,P.jsx)(it,{client:yB,children:(0,P.jsx)(UL,{children:(0,P.jsx)(bB,{})})})}function SB(e){let t=document.querySelector(`link[rel="icon"]`),n=t??document.createElement(`link`);n.rel=`icon`,n.type=`image/png`,n.sizes=`1204x1204`,n.href=e,t===null&&document.head.append(n)}SB(aS),(0,xt.createRoot)(document.getElementById(`root`)).render((0,P.jsx)(N.StrictMode,{children:(0,P.jsx)(xB,{})}));export{L as C,ci as S,Mi as _,Cd as a,di as b,Nd as c,Xi as d,Yi as f,Fi as g,Li as h,Ad as i,Dd as l,zi as m,hd as n,Td as o,Ki as p,Md as r,jd as s,Xy as t,na as u,ji as v,tt as w,li as x,Si as y};
|