offsite 0.0.80 → 0.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/client/dist/assets/{XIcon-hd7a6qPG.js → XIcon-41gae75-.js} +1 -1
- package/apps/client/dist/assets/{diff-panel-Dp94FfM1.js → diff-panel-C5Y2kAT1.js} +1 -1
- package/apps/client/dist/assets/{editor-dialog-DYSeKCLc.js → editor-dialog-Ca40iXLG.js} +1 -1
- package/apps/client/dist/assets/{image-viewer-BhMHI8JP.js → image-viewer-juD9pPaf.js} +1 -1
- package/apps/client/dist/assets/{index-D4-QuDlU.js → index-Bi58_RHj.js} +3 -3
- package/apps/client/dist/assets/{preview-dialog-DXN8c37K.js → preview-dialog-BQ7xp6ft.js} +1 -1
- package/apps/client/dist/assets/{use-editor-shortcut-BKupwQEX.js → use-editor-shortcut-BAl1jKWS.js} +3 -3
- package/apps/client/dist/assets/{video-viewer-CizhN4mT.js → video-viewer-B6wuIPsW.js} +1 -1
- package/apps/client/dist/index.html +4 -4
- package/apps/client/dist/sw.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-dialog-
|
|
1
|
+
import{n as e,t}from"./preview-dialog-BQ7xp6ft.js";import{t as n}from"./zoomable-image-C1DMNgds.js";import{c as r}from"./utils-U6QfaJBO.js";var i=r();function a(r){return(0,i.jsxs)(t,{open:!0,onClose:r.onClose,children:[(0,i.jsx)(e,{title:r.name}),(0,i.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,i.jsx)(n,{src:r.src,alt:r.alt,onClose:r.onClose})})]})}export{a as ImageViewer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-panel-
|
|
2
|
-
import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{$ as n,$t as r,A as i,At as a,B as o,Bt as s,C as c,Ct as l,D as u,Dt as d,E as f,Et as p,F as m,Ft as h,G as g,Gt as _,H as v,Ht as y,It as b,J as x,Jt as S,K as C,Kt as w,L as T,Lt as E,M as D,Mt as O,N as k,Nt as A,O as j,Ot as M,P as ee,Pt as te,Q as ne,Qt as re,R as ie,Rt as ae,S as oe,St as se,T as N,Tt as ce,U as le,Ut as ue,V as de,Vt as fe,W as P,Wt as F,X as I,Xt as pe,Y as me,Yt as he,Z as ge,Zt as _e,_ as L,_n as ve,_t as ye,a as be,an as xe,at as Se,b as Ce,bn as we,bt as Te,c as Ee,cn as De,ct as Oe,d as ke,dn as Ae,dt as je,en as Me,et as Ne,f as Pe,fn as Fe,ft as Ie,g as R,gn as Le,gt as Re,h as ze,hn as Be,ht as Ve,i as He,in as z,it as Ue,j as We,jt as Ge,k as Ke,kt as qe,l as Je,ln as Ye,lt as Xe,m as Ze,mn as Qe,mt as $e,n as et,nn as tt,nt,o as rt,on as it,ot as at,p as ot,pn as st,pt as ct,q as lt,qt as ut,r as dt,rn as ft,rt as pt,s as mt,sn as ht,st as gt,t as _t,tn as vt,tt as yt,u as bt,un as xt,ut as St,v as Ct,vn as wt,vt as Tt,w as Et,wt as Dt,x as Ot,xn as kt,xt as At,y as jt,yn as Mt,yt as Nt,z as Pt,zt as Ft}from"./XIcon-hd7a6qPG.js";import{a as It,c as Lt,i as Rt,l as zt,n as Bt,o as Vt,r as Ht,t as B}from"./utils-U6QfaJBO.js";import{_ as Ut,c as Wt,d as Gt,f as Kt,h as qt,l as Jt,m as Yt,n as Xt,o as Zt,p as Qt,t as $t,u as en}from"./dist-C_Y10kCd.js";import{$ as tn,A as nn,At as rn,B as an,C as on,Ct as sn,D as cn,Dt as ln,E as un,Et as dn,F as fn,G as pn,H as mn,I as hn,J as gn,K as _n,L as vn,N as yn,O as bn,Ot as xn,P as Sn,Q as Cn,R as wn,S as Tn,T as En,Tt as Dn,U as On,V as kn,W as An,X as jn,Y as Mn,Z as Nn,_ as Pn,a as Fn,at as In,b as Ln,bt as Rn,c as zn,ct as Bn,d as Vn,dt as Hn,et as Un,f as Wn,ft as Gn,g as Kn,gt as qn,h as Jn,ht as Yn,i as Xn,it as Zn,jt as Qn,k as $n,kt as er,l as tr,lt as nr,m as rr,mt as ir,n as ar,nt as or,o as sr,ot as cr,p as lr,pt as ur,q as dr,r as fr,rt as pr,s as mr,st as hr,t as gr,tt as _r,u as vr,ut as yr,v as br,vt as xr,w as Sr,wt as Cr,x as wr,xt as Tr,y as Er,yt as Dr,z as Or}from"./use-editor-shortcut-BKupwQEX.js";import{a as V,i as kr,n as Ar,t as H}from"./button-CWFREsRn.js";import{a as jr,i as Mr,n as Nr,r as Pr,t as Fr}from"./dist-D99rUXSZ.js";import{n as Ir}from"./libesm-Bfkx4A5Z.js";import{a as Lr,i as Rr,l as zr,n as Br,o as Vr,r as Hr,s as Ur,t as Wr}from"./tooltip-CKPboHje.js";import{C as Gr,S as Kr,a as qr,c as Jr,h as Yr,i as Xr,l as Zr,o as Qr,p as $r,r as ei,s as ti,u as ni,v as ri,w as ii,y as ai}from"./preview-dialog-DXN8c37K.js";import{n as oi,r as si}from"./TextWrapIcon-BRhMbXe9.js";import{t as ci}from"./preload-helper-BLdHbfdN.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var U=e(zt(),1),li=U.useLayoutEffect,W=Lt(),ui=class extends U.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?U.createElement(this.props.errorComponent??di,{error:e[0],reset:this.reset}):this.props.children}};function di({error:e}){let[t,n]=U.useState(!1);return(0,W.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,W.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,W.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,W.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,W.jsx)(`div`,{children:(0,W.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,W.jsx)(`code`,{children:e.message}):null})}):null]})}var fi=()=>!0,pi=()=>!1;function mi({children:e,fallback:t=null}){return(0,W.jsx)(U.Fragment,{children:hi()?e:t})}function hi(e=!0){return U.useSyncExternalStore(gi,fi,e?pi:fi)}function gi(){return()=>{}}function _i(e){let t=Be(),n=`not-found-${st(t.stores.location,e=>e.pathname)}-${st(t.stores.status)}`;return(0,W.jsx)(ui,{getResetKey:()=>n,onCatch:(t,n)=>{if(Mt(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Mt(t))return e.fallback?.(t);throw t},children:e.children})}function vi(){return(0,W.jsx)(`p`,{children:`Not Found`})}function yi(e,t,n){return t.options.notFoundComponent?(0,W.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,W.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,W.jsx)(vi,{})}function bi(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,W.jsx)(n,{}):null}var xi=(e,t)=>e[0]===t[0]&&e[1]===t[1],Si=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Ci=U.memo(function({routeId:e}){let t=Be(),n=t.stores.getMatchStore(e);return wi(t,st(n))});function wi(e,t){let n=e.routesById[t.routeId],r=bi(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=Si(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)),l=(0,W.jsx)(Ti,{match:t});s&&(l=(0,W.jsx)(mi,{fallback:r,children:l})),o&&(l=(0,W.jsx)(_i,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return U.createElement(o,e)},children:l})),i&&(l=(0,W.jsx)(ui,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Mt(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:l})),c&&(l=(0,W.jsx)(U.Suspense,{fallback:r,children:l}));let u=n.isRoot&&n.options.shellComponent;return u?(0,W.jsx)(Qe.Provider,{value:t.routeId,children:(0,W.jsxs)(u,{children:[l,null]})}):(0,W.jsxs)(Qe.Provider,{value:t.routeId,children:[l,null]})}var Ti=U.memo(function({match:e}){let t=Be(),n=e.routeId,r=t.routesById[n],i=U.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=U.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,W.jsx)(e,{},i):(0,W.jsx)(Ei,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Si(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return bi(t,r)}if(e.status===`notFound`)return yi(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Ei=U.memo(function(){let e=Be(),t=U.useContext(Qe),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=st(a,e=>[!!e._notFound,e.error],{compare:xi}),i=st(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return yi(e,e.routesById[t],r);if(!i)return null;let a=(0,W.jsx)(Ci,{routeId:i});return t===`__root__`?(0,W.jsx)(U.Suspense,{fallback:bi(e),children:a}):a});function Di(e,t){let n=e[1];e.length=0,n?.(t)}function Oi({t:e}){let t=Be(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Di(n,!1),n.push(i,a),e(t),U.startTransition(r)}),li(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(we(r.publicHref)!==we(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...ve(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function ki(){let e=Be(),t=e.routesById[wt],n=bi(e,t),r=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Oi,{t:U.useState()[1]}),e.ssr?(0,W.jsx)(Ai,{}):(0,W.jsx)(U.Suspense,{fallback:n,children:(0,W.jsx)(Ai,{})})]});return e.options.InnerWrap?(0,W.jsx)(e.options.InnerWrap,{children:r}):r}function Ai(){let e=Be(),t=e._rendered,n=st(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;li(()=>{t[0]===n&&Di(t,!0)},[t,n]);let a=i?(0,W.jsx)(Ci,{routeId:i}):null;return e.options.disableGlobalCatchBoundary?a:(0,W.jsx)(ui,{getResetKey:()=>r,onCatch:void 0,children:a})}function ji({router:e,children:t,...n}){kt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,W.jsx)(Le.Provider,{value:e,children:t});return e.options.Wrap?(0,W.jsx)(e.options.Wrap,{children:r}):r}function Mi({router:e,...t}){return(0,W.jsx)(ji,{router:e,...t,children:(0,W.jsx)(ki,{})})}var Ni=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Pi=t(((e,t)=>{t.exports=Ni()})),Fi=t((e=>{var t=Pi(),n=zt(),r=Ut();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function C(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),D=Symbol.for(`react.portal`),O=Symbol.for(`react.fragment`),k=Symbol.for(`react.strict_mode`),A=Symbol.for(`react.profiler`),j=Symbol.for(`react.consumer`),M=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),ne=Symbol.for(`react.suspense_list`),re=Symbol.for(`react.memo`),ie=Symbol.for(`react.lazy`),ae=Symbol.for(`react.activity`),oe=Symbol.for(`react.legacy_hidden`),se=Symbol.for(`react.memo_cache_sentinel`),N=Symbol.for(`react.view_transition`),ce=Symbol.for(`react.recoverable`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case O:return`Fragment`;case A:return`Profiler`;case k:return`StrictMode`;case te:return`Suspense`;case ne:return`SuspenseList`;case ae:return`Activity`;case N:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case D:return`Portal`;case M:return e.displayName||`Context`;case j:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case re:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case ie:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var P=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},me=[],he=-1;function ge(e){return{current:e}}function _e(e){0>he||(e.current=me[he],me[he]=null,he--)}function L(e,t){he++,me[he]=e.current,e.current=t}var ve=ge(null),ye=ge(null),be=ge(null),xe=ge(null);function Se(e,t){switch(L(be,t),L(ye,e),L(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?fp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=fp(t),e=pp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ve),L(ve,e)}function Ce(){_e(ve),_e(ye),_e(be)}function we(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,L(xe,e)),t=ve.current;var n=pp(t,e.type);t!==n&&(L(ye,e),L(ve,n))}function Te(e){ye.current===e&&(_e(ve),_e(ye)),xe.current===e&&(_e(xe),sh._currentValue=pe)}var Ee,De;function Oe(e){if(Ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ee=t&&t[1]||``,De=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-panel-C5Y2kAT1.js","assets/rolldown-runtime-COiEfhsA.js","assets/dist-D99rUXSZ.js","assets/utils-U6QfaJBO.js","assets/TextWrapIcon-BRhMbXe9.js","assets/ChevronsDownUpIcon-BNVFd2te.js","assets/XIcon-41gae75-.js","assets/tags-DrTyXsO5.js","assets/button-CWFREsRn.js","assets/dist-Jliw2AH0.js","assets/tokensToHtml-BxQY-Ba2.js","assets/preload-helper-BLdHbfdN.js","assets/ccount-D7kz22QW.js","assets/unwrapDefault-ByDmBtHB.js","assets/lib-m_q9jTTN.js","assets/resolveLanguages-CUb-sBYj.js","assets/formatCSSVariablePrefix-KRh9vnZf.js","assets/libesm-Bfkx4A5Z.js","assets/editor-dialog-Ca40iXLG.js","assets/use-editor-shortcut-BAl1jKWS.js","assets/dist-C_Y10kCd.js","assets/tooltip-CKPboHje.js","assets/preview-dialog-BQ7xp6ft.js","assets/langs-DssLtjmH.js","assets/dist-TdUDcI9m.js","assets/editor.api-Rfucz3mk.js","assets/editor-DjpsE8to.css","assets/engine-oniguruma-BMl9YtsA.js","assets/editor-dialog-BNFI__d8.css","assets/dist-DUf7iKTq.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{$ as n,$t as r,A as i,At as a,B as o,Bt as s,C as c,Ct as l,D as u,Dt as d,E as f,Et as p,F as m,Ft as h,G as g,Gt as _,H as v,Ht as y,It as b,J as x,Jt as S,K as C,Kt as w,L as T,Lt as E,M as D,Mt as O,N as k,Nt as A,O as j,Ot as M,P as ee,Pt as te,Q as ne,Qt as re,R as ie,Rt as ae,S as oe,St as se,T as N,Tt as ce,U as le,Ut as ue,V as de,Vt as fe,W as P,Wt as F,X as I,Xt as pe,Y as me,Yt as he,Z as ge,Zt as _e,_ as L,_n as ve,_t as ye,a as be,an as xe,at as Se,b as Ce,bn as we,bt as Te,c as Ee,cn as De,ct as Oe,d as ke,dn as Ae,dt as je,en as Me,et as Ne,f as Pe,fn as Fe,ft as Ie,g as R,gn as Le,gt as Re,h as ze,hn as Be,ht as Ve,i as He,in as z,it as Ue,j as We,jt as Ge,k as Ke,kt as qe,l as Je,ln as Ye,lt as Xe,m as Ze,mn as Qe,mt as $e,n as et,nn as tt,nt,o as rt,on as it,ot as at,p as ot,pn as st,pt as ct,q as lt,qt as ut,r as dt,rn as ft,rt as pt,s as mt,sn as ht,st as gt,t as _t,tn as vt,tt as yt,u as bt,un as xt,ut as St,v as Ct,vn as wt,vt as Tt,w as Et,wt as Dt,x as Ot,xn as kt,xt as At,y as jt,yn as Mt,yt as Nt,z as Pt,zt as Ft}from"./XIcon-41gae75-.js";import{a as It,c as Lt,i as Rt,l as zt,n as Bt,o as Vt,r as Ht,t as B}from"./utils-U6QfaJBO.js";import{_ as Ut,c as Wt,d as Gt,f as Kt,h as qt,l as Jt,m as Yt,n as Xt,o as Zt,p as Qt,t as $t,u as en}from"./dist-C_Y10kCd.js";import{$ as tn,A as nn,At as rn,B as an,C as on,Ct as sn,D as cn,Dt as ln,E as un,Et as dn,F as fn,G as pn,H as mn,I as hn,J as gn,K as _n,L as vn,N as yn,O as bn,Ot as xn,P as Sn,Q as Cn,R as wn,S as Tn,T as En,Tt as Dn,U as On,V as kn,W as An,X as jn,Y as Mn,Z as Nn,_ as Pn,a as Fn,at as In,b as Ln,bt as Rn,c as zn,ct as Bn,d as Vn,dt as Hn,et as Un,f as Wn,ft as Gn,g as Kn,gt as qn,h as Jn,ht as Yn,i as Xn,it as Zn,jt as Qn,k as $n,kt as er,l as tr,lt as nr,m as rr,mt as ir,n as ar,nt as or,o as sr,ot as cr,p as lr,pt as ur,q as dr,r as fr,rt as pr,s as mr,st as hr,t as gr,tt as _r,u as vr,ut as yr,v as br,vt as xr,w as Sr,wt as Cr,x as wr,xt as Tr,y as Er,yt as Dr,z as Or}from"./use-editor-shortcut-BAl1jKWS.js";import{a as V,i as kr,n as Ar,t as H}from"./button-CWFREsRn.js";import{a as jr,i as Mr,n as Nr,r as Pr,t as Fr}from"./dist-D99rUXSZ.js";import{n as Ir}from"./libesm-Bfkx4A5Z.js";import{a as Lr,i as Rr,l as zr,n as Br,o as Vr,r as Hr,s as Ur,t as Wr}from"./tooltip-CKPboHje.js";import{C as Gr,S as Kr,a as qr,c as Jr,h as Yr,i as Xr,l as Zr,o as Qr,p as $r,r as ei,s as ti,u as ni,v as ri,w as ii,y as ai}from"./preview-dialog-BQ7xp6ft.js";import{n as oi,r as si}from"./TextWrapIcon-BRhMbXe9.js";import{t as ci}from"./preload-helper-BLdHbfdN.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var U=e(zt(),1),li=U.useLayoutEffect,W=Lt(),ui=class extends U.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?U.createElement(this.props.errorComponent??di,{error:e[0],reset:this.reset}):this.props.children}};function di({error:e}){let[t,n]=U.useState(!1);return(0,W.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,W.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,W.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,W.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,W.jsx)(`div`,{children:(0,W.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,W.jsx)(`code`,{children:e.message}):null})}):null]})}var fi=()=>!0,pi=()=>!1;function mi({children:e,fallback:t=null}){return(0,W.jsx)(U.Fragment,{children:hi()?e:t})}function hi(e=!0){return U.useSyncExternalStore(gi,fi,e?pi:fi)}function gi(){return()=>{}}function _i(e){let t=Be(),n=`not-found-${st(t.stores.location,e=>e.pathname)}-${st(t.stores.status)}`;return(0,W.jsx)(ui,{getResetKey:()=>n,onCatch:(t,n)=>{if(Mt(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Mt(t))return e.fallback?.(t);throw t},children:e.children})}function vi(){return(0,W.jsx)(`p`,{children:`Not Found`})}function yi(e,t,n){return t.options.notFoundComponent?(0,W.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,W.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,W.jsx)(vi,{})}function bi(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,W.jsx)(n,{}):null}var xi=(e,t)=>e[0]===t[0]&&e[1]===t[1],Si=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Ci=U.memo(function({routeId:e}){let t=Be(),n=t.stores.getMatchStore(e);return wi(t,st(n))});function wi(e,t){let n=e.routesById[t.routeId],r=bi(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=Si(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)),l=(0,W.jsx)(Ti,{match:t});s&&(l=(0,W.jsx)(mi,{fallback:r,children:l})),o&&(l=(0,W.jsx)(_i,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return U.createElement(o,e)},children:l})),i&&(l=(0,W.jsx)(ui,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Mt(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:l})),c&&(l=(0,W.jsx)(U.Suspense,{fallback:r,children:l}));let u=n.isRoot&&n.options.shellComponent;return u?(0,W.jsx)(Qe.Provider,{value:t.routeId,children:(0,W.jsxs)(u,{children:[l,null]})}):(0,W.jsxs)(Qe.Provider,{value:t.routeId,children:[l,null]})}var Ti=U.memo(function({match:e}){let t=Be(),n=e.routeId,r=t.routesById[n],i=U.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=U.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,W.jsx)(e,{},i):(0,W.jsx)(Ei,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Si(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return bi(t,r)}if(e.status===`notFound`)return yi(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Ei=U.memo(function(){let e=Be(),t=U.useContext(Qe),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=st(a,e=>[!!e._notFound,e.error],{compare:xi}),i=st(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return yi(e,e.routesById[t],r);if(!i)return null;let a=(0,W.jsx)(Ci,{routeId:i});return t===`__root__`?(0,W.jsx)(U.Suspense,{fallback:bi(e),children:a}):a});function Di(e,t){let n=e[1];e.length=0,n?.(t)}function Oi({t:e}){let t=Be(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Di(n,!1),n.push(i,a),e(t),U.startTransition(r)}),li(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(we(r.publicHref)!==we(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...ve(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function ki(){let e=Be(),t=e.routesById[wt],n=bi(e,t),r=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Oi,{t:U.useState()[1]}),e.ssr?(0,W.jsx)(Ai,{}):(0,W.jsx)(U.Suspense,{fallback:n,children:(0,W.jsx)(Ai,{})})]});return e.options.InnerWrap?(0,W.jsx)(e.options.InnerWrap,{children:r}):r}function Ai(){let e=Be(),t=e._rendered,n=st(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;li(()=>{t[0]===n&&Di(t,!0)},[t,n]);let a=i?(0,W.jsx)(Ci,{routeId:i}):null;return e.options.disableGlobalCatchBoundary?a:(0,W.jsx)(ui,{getResetKey:()=>r,onCatch:void 0,children:a})}function ji({router:e,children:t,...n}){kt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,W.jsx)(Le.Provider,{value:e,children:t});return e.options.Wrap?(0,W.jsx)(e.options.Wrap,{children:r}):r}function Mi({router:e,...t}){return(0,W.jsx)(ji,{router:e,...t,children:(0,W.jsx)(ki,{})})}var Ni=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Pi=t(((e,t)=>{t.exports=Ni()})),Fi=t((e=>{var t=Pi(),n=zt(),r=Ut();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function C(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),D=Symbol.for(`react.portal`),O=Symbol.for(`react.fragment`),k=Symbol.for(`react.strict_mode`),A=Symbol.for(`react.profiler`),j=Symbol.for(`react.consumer`),M=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),ne=Symbol.for(`react.suspense_list`),re=Symbol.for(`react.memo`),ie=Symbol.for(`react.lazy`),ae=Symbol.for(`react.activity`),oe=Symbol.for(`react.legacy_hidden`),se=Symbol.for(`react.memo_cache_sentinel`),N=Symbol.for(`react.view_transition`),ce=Symbol.for(`react.recoverable`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case O:return`Fragment`;case A:return`Profiler`;case k:return`StrictMode`;case te:return`Suspense`;case ne:return`SuspenseList`;case ae:return`Activity`;case N:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case D:return`Portal`;case M:return e.displayName||`Context`;case j:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case re:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case ie:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var P=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},me=[],he=-1;function ge(e){return{current:e}}function _e(e){0>he||(e.current=me[he],me[he]=null,he--)}function L(e,t){he++,me[he]=e.current,e.current=t}var ve=ge(null),ye=ge(null),be=ge(null),xe=ge(null);function Se(e,t){switch(L(be,t),L(ye,e),L(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?fp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=fp(t),e=pp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ve),L(ve,e)}function Ce(){_e(ve),_e(ye),_e(be)}function we(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,L(xe,e)),t=ve.current;var n=pp(t,e.type);t!==n&&(L(ye,e),L(ve,n))}function Te(e){ye.current===e&&(_e(ve),_e(ye)),xe.current===e&&(_e(xe),sh._currentValue=pe)}var Ee,De;function Oe(e){if(Ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ee=t&&t[1]||``,De=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+Ee+e+De}var ke=!1;function Ae(e,t){if(!e||ke)return``;ke=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -21,7 +21,7 @@ Error generating stack: `+e.message+`
|
|
|
21
21
|
`);F(ze(t),e=>({...e,text:e.text.trim()===``?`${n}\n\n`:`${e.text.trimEnd()}\n\n${n}\n\n`})),requestAnimationFrame(()=>{let e=document.querySelector(`[data-composer]`);if(e===null)throw Error(`the composer is not mounted`);e.focus(),e.setSelectionRange(e.value.length,e.value.length)})}function zI(e){return e.kind===`group`||e.kind===`agent`}function BI(e,t){let n=[],r=e.prompt?.id??`start`;e.prompt!==null&&n.push({kind:`user`,key:e.prompt.id,item:e.prompt,first:e.first});for(let r of e.items){let e=VI(r,t!==null),i=n.at(-1);e?.kind===`group`&&i?.kind===`group`?i.entries.push(...e.entries):e!==null&&n.push(e)}let i=n.at(-1);return t!==null&&t.partial===``&&i?.kind===`group`&&(n[n.length-1]={...i,live:!0}),t!==null&&t.partial!==``&&n.push({kind:`assistant`,key:`${r}:partial`,message:``,text:t.partial,time:null,streaming:!0,meta:!1}),t!==null&&t.partial===``&&n.push({kind:`working`,key:`${r}:working`}),t===null&&i?.kind===`assistant`&&(n[n.length-1]={...i,meta:!0}),n}function VI(e,t){switch(e.kind){case`assistant`:return{kind:`assistant`,key:e.id,message:e.message,text:e.text,time:e.time,streaming:!1,meta:!1};case`reasoning`:case`file_change`:case`web_search`:case`skill`:case`tool`:return{kind:`group`,key:`group:${e.id}`,entries:[e],live:!1};case`command`:return e.background===null?{kind:`group`,key:`group:${e.id}`,entries:[e],live:!1}:{kind:`agent`,key:e.id,item:e,live:t};case`subagent`:case`agent_message`:return{kind:`agent`,key:e.id,item:e,live:t};case`plan`:return{kind:`plan`,key:e.id,plan:e.plan};case`question`:return{kind:`question`,key:e.id,item:e};case`notice`:return{kind:`notice`,key:e.id,text:e.text};case`compaction`:return{kind:`compaction`,key:e.id,summary:e.summary,time:e.time};case`error`:return{kind:`error`,key:e.id,text:e.text,time:e.time};case`user`:case`todo_list`:return null}}function HI(e,t,n){let r=[],i=!1;for(let t of e)t.parent===null&&(t.kind===`user`?(r.push({prompt:t,first:!i,items:[]}),i=!0):(t.kind!==`notice`&&t.kind!==`error`&&(i=!0),r.length===0&&r.push({prompt:null,first:!0,items:[]}),r[r.length-1].items.push(t)));let a=r.flatMap((e,i)=>BI(e,t&&i===r.length-1?{partial:n}:null));return t&&r.length===0&&a.push({kind:`working`,key:`working`}),a}var UI={all:{label:`Restore code and chat`,description:`This will undo file changes made since this message and remove this message and everything after it from the chat.`,icon:mo,code:!0,conversation:!0},chat:{label:`Restore chat`,description:`This will remove this message and everything after it from the chat. Files will not change.`,icon:as,code:!1,conversation:!0},code:{label:`Restore code`,description:`This will undo file changes made since this message. The chat will not change.`,icon:In,code:!0,conversation:!1}};function WI(e){if(e===`claude`)return[`all`,`chat`,`code`];if(e===`opencode`)return[`all`,`chat`];if(e===`codex`)return[`chat`];throw Error(`unknown provider ${e}`)}function GI(e){let[t,n]=(0,U.useState)(!1),[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(null),d=e.target,f=d.messageId,p=k(e=>e.selection),m=k(e=>e.settings.provider),h=WI(m),g=k(e=>e.prefs.rewind),_=h.includes(g)?g:`chat`,v=p?.machine??null,y=p?.sessionId??null,b=p?.projectId??``,x=k(e=>v===null?``:Ct(e,v,b)?.path??``),S=t||l!==null;(0,U.useEffect)(()=>{if(i(null),o(null),!S||v===null||y===null)return;let e=!0;return z(v,`sessions.rewind`,{sessionId:y,projectId:b,messageId:f,settings:R().settings,code:!0,conversation:!1,dryRun:!0}).then(t=>{e&&i(t)},t=>{e&&o(Ht(t))}),()=>{e=!1}},[S,f,v,y,b]);async function C(e){if(v===null||y===null)return;let{code:t,conversation:r}=UI[e];c(!0);try{let i=r?await Promise.all(d.images.map((e,t)=>e.data===null?z(v,`sessions.image`,{sessionId:y,itemId:d.messageId,index:t}):{mediaType:e.mediaType,data:e.data})):[],a=r&&d.first&&m===`claude`,o=r&&!a;(t||o)&&await z(v,`sessions.rewind`,{sessionId:y,projectId:b,messageId:d.messageId,settings:R().settings,code:t,conversation:o,dryRun:!1}),a&&(Tt(v,b,!0),We({replacing:{machine:v,projectId:b,sessionId:y}})),r&&oe({text:d.text,images:i}),D({...R().prefs,rewind:e}),n(!1)}catch(e){ea(Ht(e)),N(e)}finally{c(!1)}}let w=r!==null&&a===null;return(0,W.jsxs)(W.Fragment,{children:[h.length>1&&(0,W.jsxs)(fn,{open:t,onOpenChange:e=>{s||n(e)},children:[(0,W.jsx)(Wr,{label:`Restore options`,children:(0,W.jsx)(dr,{asChild:!0,children:(0,W.jsx)(H,{type:`button`,size:`icon-micro`,variant:`ghost-muted`,"aria-label":`Restore options`,disabled:e.disabled,children:(0,W.jsx)(V,{icon:nr,className:`size-4`})})})}),(0,W.jsxs)(vn,{align:`end`,className:`w-72`,children:[(0,W.jsxs)(`div`,{className:`text-muted-foreground px-2 py-1.5 text-xs`,children:[a!==null&&`Code can't be restored: ${a}`,a===null&&r===null&&`Checking file changes…`,r!==null&&r.files.length===0&&`No file changes since this message.`,r!==null&&r.files.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{children:[`Restores `,r.files.length,` `,r.files.length===1?`file`:`files`,` (`,(0,W.jsxs)(`span`,{className:`text-diff-addition`,children:[`+`,r.insertions]}),` `,(0,W.jsxs)(`span`,{className:`text-diff-deletion`,children:[`−`,r.deletions]}),`)`]}),(0,W.jsx)(`ul`,{className:`mt-1 max-h-24 overflow-y-auto font-mono`,children:r.files.map(e=>(0,W.jsx)(`li`,{className:`truncate`,children:nf(e,x)},e))})]})]}),(0,W.jsx)(On,{}),h.map(e=>(0,W.jsxs)(wn,{disabled:s||UI[e].code&&!w,onSelect:()=>u(e),children:[(0,W.jsx)(V,{icon:UI[e].icon}),UI[e].label]},e))]})]}),(0,W.jsx)(Wr,{label:UI[_].label,children:(0,W.jsx)(H,{type:`button`,size:`icon-micro`,variant:`ghost-muted`,"aria-label":UI[_].label,disabled:e.disabled||s,onClick:()=>u(_),children:(0,W.jsx)(V,{icon:UI[_].icon,className:`size-4`})})}),(0,W.jsx)(lr,{open:l!==null,onOpenChange:e=>{e||u(null)},children:l!==null&&(0,W.jsxs)(Kn,{children:[(0,W.jsxs)(Er,{children:[(0,W.jsxs)(Ln,{children:[UI[l].label,`?`]}),(0,W.jsxs)(Pn,{children:[UI[l].description,` Do you really want to continue?`,UI[l].code&&a!==null&&(0,W.jsx)(`span`,{className:`text-destructive mt-2 block`,children:`Code can't be restored: ${a}`})]})]}),(0,W.jsxs)(br,{children:[(0,W.jsx)(Jn,{children:`Cancel`}),(0,W.jsx)(rr,{variant:`destructive`,disabled:UI[l].code&&!w,onClick:()=>void C(l),children:UI[l].label})]})]})})]})}var KI=20,qI=`linear-gradient(to bottom, black calc(100% - 1.75rem), transparent)`,JI=new Map;function YI(e){let[t,n]=(0,U.useState)(!1),r=e.item,i=r.format===`text`||r.format===`command`?r.text:``,a=i.trim()!==``&&(i.length>600||i.split(`
|
|
22
22
|
`).length>8),o=a&&!t;return(0,W.jsxs)(`div`,{className:`group flex flex-col items-end gap-1`,children:[(0,W.jsxs)(`div`,{className:`bg-message text-message-foreground relative max-w-[80%] rounded-2xl px-3 py-2`,children:[r.images.length>0&&(0,W.jsx)(`div`,{className:`mb-2 grid max-w-[210px] grid-cols-2 gap-2`,children:r.images.map((e,t)=>(0,W.jsx)(`div`,{className:`border-border/80 bg-background/70 aspect-[4/3] overflow-hidden rounded-lg border`,children:(0,W.jsx)(ZI,{itemId:r.id,index:t,mediaType:e.mediaType,data:e.data})},t))}),r.text!==``&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:B(`relative`,o&&`max-h-44 overflow-hidden`),style:o?{WebkitMaskImage:qI,maskImage:qI}:void 0,children:[r.format===`command`&&(0,W.jsx)(`span`,{className:`font-mono text-sm`,children:r.text}),r.format===`output`&&(0,W.jsx)(`pre`,{className:`text-muted-foreground font-mono text-xs whitespace-pre-wrap`,children:r.text}),r.format===`text`&&(0,W.jsx)($n,{text:r.text,className:`text-foreground`,lineBreaks:!0,rawHtml:!1})]}),a&&(0,W.jsx)(`div`,{className:`mt-1.5 flex items-center justify-end gap-2`,children:(0,W.jsx)(H,{type:`button`,size:`xs`,variant:`ghost-muted`,"aria-expanded":t,className:`-ml-1`,onClick:()=>n(!t),children:t?`Show less`:`Show full message`})})]})]}),(0,W.jsx)(`div`,{className:`flex w-full max-w-[80%] items-center justify-end pe-1 text-xs tabular-nums opacity-0 transition-opacity duration-200 group-hover:opacity-100 focus-within:opacity-100 has-aria-expanded:opacity-100 pointer-coarse:opacity-100`,children:(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r.time!==null&&(0,W.jsx)(Wr,{label:xn(r.time),children:(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs tabular-nums`,children:dn(r.time)})}),i!==``&&(0,W.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[e.rewind&&(0,W.jsx)(GI,{target:{messageId:r.id,text:i,images:r.images,first:e.first},disabled:e.running}),(0,W.jsx)(XI,{text:i})]})]})})]})}function XI(e){let t=nn();return(0,W.jsx)(Wr,{label:`Copy message`,children:(0,W.jsx)(H,{type:`button`,size:`icon-micro`,variant:`ghost-muted`,"aria-label":`Copy message`,disabled:t.copied,onClick:()=>void t.copy(e.text),children:(0,W.jsx)(V,{icon:t.copied?Dr:Yn,className:B(`size-4`,t.copied&&`text-primary`)})})})}function ZI(e){let t=k(e=>e.selection),n=t?.machine??null,r=t?.sessionId??null,[i,a]=(0,U.useState)(null);(0,U.useEffect)(()=>{if(e.data!==null||n===null||r===null)return;let t=!0,i=JSON.stringify([n,r,e.itemId,e.index]),o=JI.get(i);if(o===void 0){if(o=z(n,`sessions.image`,{sessionId:r,itemId:e.itemId,index:e.index}),JI.set(i,o),JI.size>KI){let[e]=JI.keys();JI.delete(e)}o.catch(()=>JI.delete(i))}return o.then(e=>{t&&a(e.data)}).catch(N),()=>{t=!1}},[e.data,e.itemId,e.index,n,r]);let o=e.data??i;return o===null?null:(0,W.jsx)(Sn,{src:`data:${e.mediaType};base64,${o}`,alt:``,name:`Image`,className:`block size-full`,imageClassName:`block size-full object-cover`})}function QI(e){switch(e.kind){case`command`:return`Shell`;case`file_change`:return`Edit`;case`web_search`:return e.url===null?`Web Search`:`Webfetch`;case`skill`:return`Skill`;case`tool`:return e.name}}function $I(e){let t=e.item,n=e.live&&t.status===`running`;if(t.status===`failed`)return(0,W.jsx)(aL,{title:QI(t),subtitle:oL(t,e.cwd),error:t.output});switch(t.kind){case`command`:return(0,W.jsx)(eL,{command:t.command,output:t.output,pending:n});case`file_change`:return(0,W.jsx)(rL,{items:[t],cwd:e.cwd,live:e.live});case`web_search`:{let e=t.url;return e===null?(0,W.jsx)(tL,{query:t.query??``,links:t.results,pending:n}):(0,W.jsx)(vI,{title:`Webfetch`,subtitle:(0,W.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary hover:underline hover:underline-offset-2`,children:e}),pending:n,grouped:!0,open:!1,onToggle:null})}case`skill`:return(0,W.jsxs)(`div`,{className:`flex min-h-7 items-center gap-1 text-[13px] leading-4 tracking-[-0.04px]`,children:[(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:`Loaded`}),(0,W.jsx)(`span`,{className:`text-foreground`,children:(0,W.jsx)(hI,{text:t.skill,active:n})}),(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:`skill`})]});case`tool`:{let r=t.input;switch(Xd(t.name)){case`read`:return(0,W.jsx)(vI,{title:`Read`,subtitle:cL(Zd(r)),args:sL(r,[`offset`,`limit`]),pending:n,grouped:!0,open:!1,onToggle:null});case`search`:return(0,W.jsx)(vI,{title:t.name,subtitle:oL(t,e.cwd),args:[...sL(r,[`pattern`]),...tf(r.glob)===``?[]:[`include=${tf(r.glob)}`]],pending:n,grouped:!0,open:!1,onToggle:null});case`other`:return(0,W.jsx)(vI,{title:`Called ${t.name}`,subtitle:oL(t,e.cwd),args:sL(r,Object.keys(r).filter(e=>![`description`,`query`,`url`,`path`,`pattern`].includes(e))).slice(0,3),pending:n,grouped:!0,open:!1,onToggle:null})}}}}function eL(e){let[t,n]=(0,U.useState)(!1);return(0,W.jsx)(vI,{title:`Shell`,subtitle:t?void 0:e.command,pending:e.pending,grouped:!0,open:t,onToggle:()=>n(!t),rail:!1,children:(0,W.jsxs)(`div`,{dir:`ltr`,className:`group/output border-border relative w-full overflow-hidden rounded-md border`,children:[(0,W.jsx)(`div`,{className:`absolute top-1 right-1 opacity-0 transition-opacity group-hover/output:opacity-100 focus-within:opacity-100`,children:(0,W.jsx)(XI,{text:e.command})}),(0,W.jsx)(`div`,{className:`max-h-60 [scrollbar-width:none] overflow-x-hidden overflow-y-auto`,children:(0,W.jsx)(`pre`,{className:`m-0 font-mono text-[13px] leading-5 tracking-[-0.04px] [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:(0,W.jsxs)(`code`,{children:[(0,W.jsx)(`span`,{className:`text-foreground block p-3`,children:e.command}),e.output!==``&&(0,W.jsx)(`span`,{className:`border-border bg-muted text-muted-foreground block border-t p-3`,children:e.output})]})})})]})})}function tL(e){let[t,n]=(0,U.useState)(!1),r=e.links;return(0,W.jsx)(vI,{title:`Web Search`,subtitle:e.query,pending:e.pending,grouped:!0,open:t,onToggle:r.length===0?null:()=>n(!t),children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-1 text-[13px] leading-5`,children:[r.slice(0,10).map(e=>(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary truncate hover:underline hover:underline-offset-2`,children:e.title===``?e.url:e.title},e.url)),r.length>10&&(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[`+`,r.length-10,` more`]})]})})}function nL(e){let[t,n]=(0,U.useState)(!1);return(0,W.jsx)(vI,{title:e.streaming?`Thinking`:`Thought`,subtitle:e.streaming?lL(e.text):void 0,pending:e.streaming,grouped:!0,open:t,onToggle:()=>n(!t),children:(0,W.jsx)($n,{text:e.text,className:`text-muted-foreground text-[13px]`,lineBreaks:!0})})}function rL(e){let t=new Map;for(let n of e.items){let r=nf(n.path,e.cwd);t.set(r,[...t.get(r)??[],n])}return(0,W.jsx)(`div`,{className:`border-border overflow-hidden rounded-md border`,children:[...t].map(([t,n])=>(0,W.jsx)(iL,{file:t,items:n,pending:e.live&&n.some(e=>e.status===`running`)},t))})}function iL(e){let[t,n]=(0,U.useState)(!1),r=Math.max(e.file.lastIndexOf(`/`),e.file.lastIndexOf(`\\`)),i=0,a=0;for(let t of e.items){let e=Qd(t);i+=e.added,a+=e.removed}return(0,W.jsxs)(`div`,{className:`border-border border-b last:border-b-0`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(!t),className:`group/tool flex h-9 w-full cursor-pointer items-center gap-2 ps-3 pe-1 text-left text-[13px] leading-4 tracking-[-0.04px] select-none`,children:[(0,W.jsx)(ni,{path:e.file,className:`size-4 shrink-0`}),(0,W.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline`,children:[r>=0&&(0,W.jsx)(`span`,{className:`text-muted-foreground truncate`,children:e.file.slice(0,r+1)}),(0,W.jsx)(`span`,{className:`text-foreground shrink-0`,children:(0,W.jsx)(hI,{text:e.file.slice(r+1),active:e.pending})})]}),(0,W.jsxs)(`span`,{role:`group`,"aria-label":`${i} additions, ${a} deletions`,className:`inline-flex items-center gap-1 align-middle font-mono text-xs tabular-nums`,children:[(0,W.jsxs)(`span`,{"aria-hidden":!0,className:`text-diff-addition`,children:[`+`,ln(i)]}),(0,W.jsxs)(`span`,{"aria-hidden":!0,className:`text-diff-deletion`,children:[`-`,ln(a)]})]}),(0,W.jsx)(_I,{open:t})]}),t&&(0,W.jsx)(`div`,{className:`border-border flex flex-col gap-2 border-t p-2`,children:e.items.map(e=>(0,W.jsx)(Jd,{item:e},e.id))})]})}function aL(e){let[t,n]=(0,U.useState)(!1),r=e.error.replace(/<\/?tool_use_error>/g,``).trim(),i=r.split(`: `)[0].trim();return(0,W.jsxs)(`div`,{className:`group/error flex w-full min-w-0 flex-col`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(!t),className:`flex h-6 w-full cursor-pointer items-center text-left text-[13px] leading-4 tracking-[-0.04px] select-none`,children:[(0,W.jsxs)(`span`,{className:`flex max-w-[calc(100%-20px)] min-w-0 items-center gap-1.5`,children:[(0,W.jsx)(V,{icon:io,className:`text-destructive size-4 shrink-0`}),(0,W.jsx)(`span`,{className:`text-foreground shrink-0 font-medium`,children:e.title}),e.subtitle!==``&&!t&&(0,W.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate`,children:e.subtitle}),!t&&(0,W.jsx)(`span`,{className:`text-destructive min-w-0 truncate`,children:i===``?`Failed`:i[0].toUpperCase()+i.slice(1)})]}),(0,W.jsx)(_I,{open:!0,className:`ms-1.5 size-3.5`})]}),t&&(0,W.jsxs)(`div`,{className:`relative ps-6 pe-10 select-text`,children:[(0,W.jsx)(`div`,{className:`absolute top-0 right-0 opacity-0 transition-opacity group-hover/error:opacity-100 focus-within:opacity-100`,children:(0,W.jsx)(XI,{text:r})}),(0,W.jsx)(`p`,{className:`text-destructive text-[13px] leading-5 tracking-[-0.04px] [overflow-wrap:anywhere] whitespace-pre-wrap`,children:r})]})]})}function oL(e,t){switch(e.kind){case`command`:return e.command;case`file_change`:return e.path;case`web_search`:return e.url??e.query??``;case`skill`:return e.skill;case`tool`:{let n=e.input;if(Xd(e.name)===`search`){let e=tf(n.path);return e===``||e===t?``:nf(e,t)}return[`description`,`query`,`url`,`file_path`,`path`,`pattern`].map(e=>tf(n[e])).find(e=>e!==``)??``}}}function sL(e,t){return t.flatMap(t=>{let n=e[t];return typeof n==`string`||typeof n==`number`||typeof n==`boolean`?[`${t}=${n}`]:[]})}function cL(e){return e.split(`/`).at(-1)??e}function lL(e){let t=[...e.matchAll(/^\s*(?:#{1,6}[ \t]+(.+?)|\*\*([^*\n]+)\*\*)\s*$/gm)].at(-1);return t===void 0?void 0:(t[1]??t[2]).trim()}var uL=new Intl.ListFormat(`en`,{style:`long`,type:`conjunction`});function dL(e){let t=e.entries.flatMap(e=>e.kind===`reasoning`?[]:[e]),n=e.entries.length-t.length,r=uL.format([...new Set(t.map(QI))]),i=r===``?n===1?`Thought`:`Thoughts`:r,a=t.length>0?t.length:n;return(0,W.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":e.open,"aria-label":`Used ${a} ${i}`,onClick:e.onToggle,className:B(`group/tool focus-visible:ring-ring/70 flex h-7 w-full cursor-pointer items-center rounded-md text-left text-xs select-none focus-visible:ring-2 focus-visible:outline-none`,e.open&&`bg-background sticky top-0 z-20 box-content pb-2`),children:[(0,W.jsxs)(`span`,{className:`flex max-w-[calc(100%-24px)] min-w-0 items-center gap-1`,children:[(0,W.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Used`}),(0,W.jsx)(`span`,{className:`text-muted-foreground shrink-0 tabular-nums`,children:a}),(0,W.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate`,children:i})]}),(0,W.jsx)(_I,{open:e.open})]}),e.open&&(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:pL(e.entries).map(t=>(0,W.jsx)(`div`,{className:`flex min-h-7 min-w-0 flex-col justify-center`,children:(0,W.jsx)(fL,{item:t,cwd:e.cwd,live:e.live})},t.key))})]})}function fL(e){let t=e.item;switch(t.kind){case`thinking`:return(0,W.jsx)(nL,{text:t.text,streaming:e.live&&t.last});case`tool`:return(0,W.jsx)($I,{item:t.item,cwd:e.cwd,live:e.live});case`reads`:return(0,W.jsx)(vI,{title:`Read`,subtitle:(0,W.jsx)(`span`,{title:t.items.map(e=>Zd(e.input)).join(`
|
|
23
23
|
`),children:t.items.map((t,n)=>(0,W.jsxs)(`span`,{children:[n>0&&` `,(0,W.jsx)(hI,{text:Zd(t.input).split(`/`).at(-1)??``,active:e.live&&t.status===`running`})]},t.id))}),pending:e.live&&t.items.some(e=>e.status===`running`),grouped:!0,open:!1,onToggle:null});case`files`:return(0,W.jsx)(rL,{items:t.items,cwd:e.cwd,live:e.live})}}function pL(e){let t=[];return e.forEach((n,r)=>{if(n.kind===`reasoning`){t.push({kind:`thinking`,key:n.id,text:n.text,last:r===e.length-1});return}let i=t.at(-1);n.status!==`failed`&&n.kind===`file_change`?i?.kind===`files`?i.items.push(n):t.push({kind:`files`,key:n.id,items:[n]}):n.status!==`failed`&&n.kind===`tool`&&Xd(n.name)===`read`?i?.kind===`reads`?i.items.push(n):t.push({kind:`reads`,key:n.id,items:[n]}):t.push({kind:`tool`,key:n.id,item:n})}),t}function mL(e){let[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(!0),s=(0,U.useRef)(null),c=e.rows.flatMap((t,n)=>t.kind===`user`?[{key:t.key,prompt:gL(t.item),reply:_L(e.rows,n)}]:[]),l=Math.max(c.findIndex(e=>e.key===t[0]),0),u=r===null?null:c[r];if((0,U.useEffect)(()=>{let t=e.scroller.current;if(t===null)throw Error(`transcript is not mounted`);function r(){if(t===null)throw Error(`transcript is not mounted`);let e=t.getBoundingClientRect(),r=[...t.querySelectorAll(`[data-kind="user"]`)],i=r.flatMap((t,n)=>{let i=t.getBoundingClientRect().top,a=r[n+1]?.getBoundingClientRect().top??1/0;return i<e.bottom&&a>e.top&&t.dataset.row?[t.dataset.row]:[]});n(e=>ft(e,i)?e:i)}let i=new ResizeObserver(()=>{if(t===null)throw Error(`transcript is not mounted`);r();let e=t.querySelector(`[data-row]`)?.parentElement;e!=null&&o(t.getBoundingClientRect().right-e.getBoundingClientRect().right>=40)});return r(),i.observe(t),t.addEventListener(`scroll`,r,{passive:!0}),()=>{i.disconnect(),t.removeEventListener(`scroll`,r)}},[e.scroller,c.length]),c.length<2)return null;function d(e){let t=s.current?.getBoundingClientRect();if(t===void 0)throw Error(`message rail is not mounted`);let n=Math.min(Math.max((e-t.top)/t.height,0),1);return Math.round(n*(c.length-1))}function f(e){return`${e/(c.length-1)*100}%`}return(0,W.jsxs)(`div`,{ref:s,className:B(`absolute top-1/2 right-[calc(var(--app-scrollbar-width)+0.25rem)] z-20 w-8 -translate-y-1/2 select-none pointer-coarse:hidden`,!a&&`hidden`),style:{height:`min(${(c.length-1)*10}px, 60%)`},children:[(0,W.jsx)(`button`,{type:`button`,"aria-label":`Jump to your message: ${u?.prompt??c[l].prompt}`,className:`focus-visible:ring-ring absolute inset-x-0 -inset-y-3 cursor-pointer rounded-md outline-none focus-visible:ring-2`,onPointerMove:e=>i(d(e.clientY)),onPointerLeave:()=>i(null),onFocus:()=>i(e=>e??l),onBlur:()=>i(null),onWheel:t=>{if(e.scroller.current===null)throw Error(`transcript is not mounted`);e.scroller.current.scrollBy({top:t.deltaY})},onClick:t=>{let n=t.detail===0?r:d(t.clientY);if(n===null)throw Error(`no message is selected`);e.onJump(c[n].key)},onKeyDown:e=>{let t=r??l,n=e.key===`ArrowUp`?t-1:e.key===`ArrowDown`?t+1:e.key===`Home`?0:e.key===`End`?c.length-1:null;n!==null&&(e.preventDefault(),i(Math.min(Math.max(n,0),c.length-1)))}}),c.map((e,n)=>{let i=r===null?null:Math.abs(n-r),a=t.includes(e.key);return(0,W.jsx)(`span`,{"aria-hidden":`true`,className:B(`pointer-events-none absolute right-1 h-0.5 w-5 origin-right -translate-y-1/2 rounded-full transition-all duration-150 ease-out`,i===0?`bg-foreground/85`:a?`bg-foreground/55`:`bg-foreground/20`,i===0?`scale-x-100`:i===1?`scale-x-75`:i===2?`scale-x-[0.55]`:a?`scale-x-50`:`scale-x-[0.35]`),style:{top:f(n)}},e.key)}),u!==null&&r!==null&&(0,W.jsxs)(`div`,{className:`bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-98 pointer-events-none absolute right-9 w-80 rounded-xl border p-3 shadow-lg/10 transition-[top,translate] duration-100 ease-out`,style:{top:f(r),translate:r===0?`0 -0.75rem`:r===c.length-1?`0 calc(-100% + 0.75rem)`:`0 -50%`},children:[(0,W.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 font-medium wrap-anywhere`,children:u.prompt}),u.reply!==``&&(0,W.jsx)(`p`,{className:`text-muted-foreground mt-1 line-clamp-3 text-xs leading-[1.125rem] wrap-anywhere`,children:u.reply})]})]})}function hL(e,t){let n=e?.querySelector(`[data-row="${CSS.escape(t)}"]`);if(e===null||!(n instanceof HTMLElement))throw Error(`that message is not on screen`);e.scrollTop+=n.getBoundingClientRect().top-e.getBoundingClientRect().top-24}function gL(e){let t=e.text.replace(/\s+/g,` `).trim();return t===``?e.images.length>0?`Image`:`Message`:t.slice(0,300)}function _L(e,t){let n=``;for(let r of e.slice(t+1)){if(r.kind===`user`)break;r.kind===`assistant`&&(n=r.text)}return n.slice(0,600).replace(/[#*`>|]+/g,``).replace(/\s+/g,` `).trim()}var vL=30;function yL(e){let t=k(e=>e.selection),n=k(e=>e.loaded),r=k(e=>e.items),i=k(e=>e.earlier),a=k(e=>e.before),o=k(e=>e.partial),s=k(e=>e.requests),c=k(Ce),l=(0,U.useRef)(null),u=(0,U.useRef)(null),d=(0,U.useRef)(!0),f=(0,U.useRef)(null),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)([]),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(!1),x=(0,U.useRef)(null),S=k(e=>t===null?``:Ct(e,t.machine,t.projectId)?.path??``),C=k(Ot),w=k(e=>e.sentAt);(0,U.useLayoutEffect)(()=>{let e=l.current;e!==null&&w!==0&&(d.current=!0,e.scrollTop=e.scrollHeight)},[w]),(0,U.useEffect)(()=>{let e=l.current;if(e===null||u.current===null)throw Error(`transcript is not mounted`);let t=new ResizeObserver(()=>{d.current&&(e.scrollTop=e.scrollHeight)});return t.observe(e),t.observe(u.current),()=>t.disconnect()},[]),(0,U.useLayoutEffect)(()=>{let e=l.current;e!==null&&d.current&&(e.scrollTop=e.scrollHeight)},[r,o,s,C]);let T=(0,U.useMemo)(()=>fI([...i,...r],c),[i,r,c]),E=HI(i,!1,``),D=[...E,...HI(r,C,o)],O=D.findIndex(e=>e.key===_?.key),A=y?0:Math.max(0,O===-1?D.length-vL:O-(_?.above??0));(0,U.useLayoutEffect)(()=>{let e=l.current;e!==null&&f.current!==null&&(e.scrollTop=e.scrollHeight-f.current),f.current=null},[i,A]),(0,U.useLayoutEffect)(()=>{x.current!==null&&(hL(l.current,x.current),x.current=null)},[A]),or(`mod+f`,e=>{let t=e.target;e.defaultPrevented||t instanceof Element&&t!==document.body&&t.closest(`[data-composer], [data-transcript]`)===null||(e.preventDefault(),b(!0),requestAnimationFrame(()=>document.querySelector(`[data-thread-find]`)?.select()))},{enableOnFormTags:!0}),(0,U.useLayoutEffect)(()=>{let e=l.current;e!==null&&D.length!==0&&(O===-1?v({key:D[A].key,above:0}):j(e))});function j(e){A===0||e.scrollTop>=e.clientHeight||(f.current=e.scrollHeight-e.scrollTop,v({key:D[A].key,above:vL}))}function M(e){let t=D.findIndex(t=>t.key===e);if(t===-1)throw Error(`that message is not loaded`);t>=A?hL(l.current,e):(x.current=e,v({key:e,above:1}))}let ee=(0,U.useCallback)(e=>{g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]);return(0,W.jsxs)(W.Fragment,{children:[y&&(0,W.jsx)(OI,{content:u,scroller:l,onClose:()=>{b(!1),D.length>0&&v({key:D[0].key,above:0}),document.querySelector(`[data-composer]`)?.focus()}}),(0,W.jsx)(mL,{rows:D,scroller:l,onJump:M}),(0,W.jsxs)(`div`,{ref:l,"data-transcript":!0,className:`topbar-scroll-fade relative min-h-0 flex-1 overflow-y-auto overscroll-y-contain pb-8`,onScroll:e=>{let t=e.currentTarget;d.current=t.scrollHeight-t.scrollTop-t.clientHeight<40,j(t)},children:[(0,W.jsx)(`div`,{ref:u,children:(0,W.jsxs)(Pd,{width:`chat`,className:`pt-3`,children:[!n&&(0,W.jsx)(`p`,{className:`text-muted-foreground py-6 text-center text-xs`,children:`Loading…`}),a!==null&&A===0&&(0,W.jsx)(`div`,{className:`flex justify-center pb-4`,children:(0,W.jsx)(H,{type:`button`,size:`xs`,variant:`ghost-muted`,disabled:p,onClick:async()=>{let e=l.current;e!==null&&(f.current=e.scrollHeight-e.scrollTop),v({key:D[0].key,above:vL}),m(!0),await St(),m(!1)},children:p?`Loading…`:`Load earlier conversation`})}),D.slice(A).map((t,n)=>{let r=A+n,i=D[r-1],a=r<E.length;return(0,W.jsx)(`div`,{"data-row":t.key,"data-kind":t.kind,className:B(i===void 0?void 0:t.kind===`user`?`pt-6`:t.kind===`working`?void 0:zI(t)&&zI(i)?`pt-2`:zI(t)||zI(i)?`pt-3`:`pt-4`,t.kind===`assistant`&&`group/assistant`),children:(0,W.jsx)(SL,{row:t,agents:T.agents,tasks:T.tasks,running:C,compacting:c?.compacting===!0,fork:!a,expanded:h.includes(t.key),onToggle:ee,onOpenTask:e.onOpenTask,rewind:!a,cwd:S})},t.key)})]})}),(0,W.jsx)(II,{scroller:l})]})]})}var bL=(0,U.memo)(yL);function xL(e){let t=e.row;switch(t.kind){case`user`:return(0,W.jsx)(YI,{item:t.item,first:t.first,running:e.running,rewind:e.rewind});case`working`:return(0,W.jsx)(`div`,{className:`text-muted-foreground h-9 pt-3 text-[13px] leading-5 font-medium tracking-[-0.04px]`,children:(0,W.jsx)(hI,{text:e.compacting?`Compacting conversation`:`Working`,active:!0})});case`group`:return(0,W.jsx)(dL,{entries:t.entries,cwd:e.cwd,live:t.live,open:e.expanded,onToggle:()=>e.onToggle(t.key)});case`agent`:return(0,W.jsx)(EI,{item:t.item,agents:e.agents,tasks:e.tasks,sending:t.live&&t.item.status===`running`,onOpen:e.onOpenTask});case`assistant`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{"data-quotable":!0,children:(0,W.jsx)($n,{text:t.text===``&&!t.streaming?`(empty response)`:t.text,streaming:t.streaming})}),t.meta&&(0,W.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 text-xs tabular-nums opacity-0 transition-opacity duration-200 group-hover/assistant:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,W.jsx)(XI,{text:t.text}),e.fork&&(0,W.jsx)(CL,{uuid:t.message})]}),t.time!==null&&(0,W.jsx)(Wr,{label:xn(t.time),children:(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs tabular-nums`,children:dn(t.time)})})]})]});case`error`:return(0,W.jsxs)(`div`,{className:`text-destructive flex gap-1.5 text-[13px] leading-5 tracking-[-0.04px]`,children:[(0,W.jsx)(V,{icon:io,className:`mt-0.5 size-4 shrink-0`}),(0,W.jsx)(`p`,{className:`min-w-0 [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:t.text})]});case`notice`:return(0,W.jsxs)(`div`,{className:`text-muted-foreground mx-auto flex w-full max-w-(--chat-content-max-width) items-center gap-3 py-1 text-xs`,children:[(0,W.jsx)(`span`,{className:`bg-border/70 h-px flex-1`}),(0,W.jsx)(`span`,{children:t.text}),(0,W.jsx)(`span`,{className:`bg-border/70 h-px flex-1`})]});case`compaction`:return(0,W.jsxs)(`div`,{className:`mx-auto w-full max-w-(--chat-content-max-width)`,children:[(0,W.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-3 py-1 text-xs`,children:[(0,W.jsx)(`span`,{className:`bg-border/70 h-px flex-1`}),t.summary===null?(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(V,{icon:es,className:`size-3`}),`Conversation compacted`]}):(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":e.expanded,className:`hover:text-foreground flex items-center gap-1.5 transition-colors`,onClick:()=>e.onToggle(t.key),children:[(0,W.jsx)(V,{icon:es,className:`size-3`}),`Compacted summary`,(0,W.jsx)(V,{icon:sn,strokeWidth:2.5,className:B(`size-3 transition-transform`,!e.expanded&&`-rotate-90`)})]}),(0,W.jsx)(`span`,{className:`bg-border/70 h-px flex-1`})]}),e.expanded&&t.summary!==null&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`bg-muted/40 text-muted-foreground mt-2 rounded-lg border px-4 py-3 text-sm`,children:(0,W.jsx)($n,{text:t.summary,streaming:!1})}),(0,W.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-end gap-2 text-xs tabular-nums`,children:[t.time!==null&&(0,W.jsx)(Wr,{label:xn(t.time),children:(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs tabular-nums`,children:dn(t.time)})}),(0,W.jsx)(XI,{text:t.summary})]})]})]});case`plan`:return(0,W.jsx)(`div`,{className:`min-w-0`,"data-quotable":!0,children:(0,W.jsx)(AI,{plan:t.plan})});case`question`:return(0,W.jsx)(FI,{item:t.item})}}var SL=(0,U.memo)(xL,(e,t)=>t.row.kind===`agent`?ft(e,t):ft(Li(e,[`agents`,`tasks`]),Li(t,[`agents`,`tasks`])));function CL(e){let[t,n]=(0,U.useState)(!1);return(0,W.jsx)(Wr,{label:`Fork from this response`,children:(0,W.jsx)(H,{type:`button`,size:`icon-micro`,variant:`ghost-muted`,disabled:t,"aria-label":`Fork from this response`,onClick:()=>{n(!0),at(e.uuid).finally(()=>n(!1))},children:(0,W.jsx)(V,{icon:Ro,className:B(`size-4`,t&&`animate-pulse`)})})})}var wL=Ft(`event`,[fe({offsite:s(`browser`),event:s(`location`),url:y(),replaced:ae()}),fe({offsite:s(`browser`),event:s(`open`),url:y()}),fe({offsite:s(`browser`),event:s(`loading`)})]);function TL(e){let t=Fe({from:`__root__`,select:e=>e.browse??null}),[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(0),[o,s]=(0,U.useState)(0),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(null),f=(0,U.useRef)(null),p=(0,U.useRef)(null),m=(0,U.useRef)({entries:[],index:-1}),h=k(t=>L(t,e.machine).status===`online`);(0,U.useEffect)(()=>{if(t===null||!h)return;let n=`${e.machine} ${i} ${t}`;if(p.current===n)return;let a=!0;return EL(e.machine,t).then(e=>{a&&(p.current=n,m.current={entries:[],index:-1},r({target:t,src:e,error:null}),s(e=>e+1),d(null),l(!0))},e=>{a&&(r({target:t,src:null,error:Ht(e)}),d(null),l(!1))}),()=>{a=!1}},[e.machine,t,i,h]),(0,U.useEffect)(()=>{function a(a){if(a.source===null||a.source!==f.current?.contentWindow)return;let o=wL.safeParse(a.data);if(!o.success)return;if(o.data.event===`loading`){d(null),l(!0);return}if(t===null||n===null)throw Error(`a page reported its location outside the browser`);let s=o.data.url;o.data.event===`open`?z(e.machine,`browser.open`,{url:s,fromPage:!0}).then(t=>{p.current=`${e.machine} ${i} ${s}`,r({target:s,src:`${De(e.machine)}${t}`,error:null}),l(!0),M({browse:s})},N):(d(DL(m.current,s,o.data.replaced)),s!==t&&(p.current=`${e.machine} ${i} ${s}`,r({...n,target:s}),M({browse:s})))}return window.addEventListener(`message`,a),()=>window.removeEventListener(`message`,a)},[e.machine,i,t,n]);let g=t!==null&&/^https?:\/\//i.test(t),_=t===null?null:n?.src??null,v=!g&&n?.target===t?n.src:null,y=n?.target===t?n.error:null,b=t!==null&&h&&(n?.target!==t||c);function x(e){if(u===null)throw Error(`no page is open to send a browser command to`);f.current?.contentWindow?.postMessage({offsite:`browser`,command:e},`*`)}return(0,W.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,W.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-2 border-b pr-3 pl-3`,children:[(0,W.jsx)(H,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,W.jsx)(V,{icon:_t,className:`size-4`})}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,W.jsx)(H,{size:`icon-sm`,variant:`ghost`,title:`Back`,"aria-label":`Back`,disabled:u?.back!==!0,onClick:()=>x(`back`),children:(0,W.jsx)(V,{icon:po,className:`size-4`})}),(0,W.jsx)(H,{size:`icon-sm`,variant:`ghost`,title:`Forward`,"aria-label":`Forward`,disabled:u?.forward!==!0,onClick:()=>x(`forward`),children:(0,W.jsx)(V,{icon:Tr,className:`size-4`})}),(0,W.jsx)(H,{size:`icon-sm`,variant:`ghost`,title:`Reload`,"aria-label":`Reload`,onClick:()=>{u===null?a(i+1):x(`reload`)},children:(0,W.jsx)(V,{icon:oi,className:B(`size-4`,b&&`animate-spin`)})})]}),(0,W.jsx)(`form`,{className:`min-w-0 flex-1`,onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget).get(`address`);if(typeof t!=`string`)throw Error(`the address field is missing`);let n=t.trim();n!==``&&ce(OL(n))},children:(0,W.jsx)(Kf,{name:`address`,className:`h-7 font-mono text-xs`,placeholder:`URL or file path`,"aria-label":`URL or file path`,defaultValue:t??``})},t),v!==null&&(0,W.jsx)(H,{size:`icon-sm`,variant:`ghost`,asChild:!0,children:(0,W.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,title:`Open in a new tab`,"aria-label":`Open in a new tab`,children:(0,W.jsx)(V,{icon:Jo,className:`size-4`})})})]}),y!==null&&(0,W.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:y}),t===null&&(0,W.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:`Type a URL or a file path above. URLs load from this machine.`}),_!==null&&(0,W.jsx)(`iframe`,{ref:f,src:_,sandbox:g?`allow-scripts allow-forms allow-popups allow-modals allow-downloads allow-presentation allow-pointer-lock`:void 0,title:t??``,className:`min-h-0 w-full flex-1 bg-white scheme-light`,onLoad:()=>l(!1)},o)]})}async function EL(e,t){if(/^https?:\/\//i.test(t)){let n=await z(e,`browser.open`,{url:t,fromPage:!1});return`${De(e)}${n}`}let n=await z(e,`files.browse`,void 0);return`${De(e)}/api/browse/${n}${kL(t)}`}function DL(e,t,n){return n&&e.index>=0?e.entries[e.index]=t:e.entries[e.index-1]===t?--e.index:e.entries[e.index+1]===t?e.index+=1:e.entries[e.index]!==t&&(e.entries=[...e.entries.slice(0,e.index+1),t],e.index+=1),{back:e.index>0,forward:e.index<e.entries.length-1}}function OL(e){return/^(https?:\/\/|file:)/i.test(e)||/^[/.]/.test(e)||/^[a-z]:[\\/]/i.test(e)?e:/^(localhost|\d+(\.\d+){3}|[\w.-]+:\d+)([:/?#]\S*)?$/i.test(e)?`http://${e}`:/^[\w-]+(\.[\w-]+)+([/?#]\S*)?$/.test(e)?`https://${e}`:`https://www.google.com/search?q=${encodeURIComponent(e)}`}function kL(e){let t=e.replaceAll(`\\`,`/`).split(`/`).map(encodeURIComponent).join(`/`);return t.startsWith(`/`)?t:`/${t}`}function AL(e){let t=e.stopping;return(0,W.jsx)(lr,{open:t!==null,onOpenChange:t=>{t||e.onClose()},children:t!==null&&(0,W.jsxs)(Kn,{children:[(0,W.jsxs)(Er,{children:[(0,W.jsxs)(Ln,{children:[`Stop `,t.title,`?`]}),(0,W.jsx)(Pn,{children:`It is still running. Do you really want to stop it?`})]}),(0,W.jsxs)(br,{children:[(0,W.jsx)(Jn,{children:`Cancel`}),(0,W.jsx)(rr,{variant:`destructive`,onClick:()=>{if(e.sessionId===null)throw Error(`Cannot stop a task without a session`);Te(e.machine,e.sessionId,t.taskId)},children:`Stop`})]})]})})}function jL(e){return(0,W.jsx)(`button`,{type:`button`,title:e.label,"aria-label":e.label,className:`text-muted-foreground hover:text-destructive focus-visible:ring-ring/70 mr-1.5 grid size-7 shrink-0 cursor-pointer place-items-center rounded-md focus-visible:ring-2 focus-visible:outline-none`,onClick:e.onClick,children:(0,W.jsx)(V,{icon:Cs,className:`size-4`})})}function ML(e){return(0,W.jsx)(H,{size:`xs`,variant:`outline`,className:`shrink-0`,onClick:()=>Te(e.machine,e.sessionId,e.taskId),children:`Stop`})}function NL(e){let t=k(e=>e.items),n=k(e=>e.earlier),r=k(t=>ke(t.machines,e.machine,e.sessionId)),[i,a]=(0,U.useState)(null),o=[...n,...t],s=fI(o,r),c=s.agents.find(t=>t.item.id===e.selected),l=s.tasks.find(t=>t.item.id===e.selected),u=c===void 0?null:CI(c.item);return(0,W.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,W.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-1 border-b pr-3 pl-3`,children:[(0,W.jsx)(H,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,W.jsx)(V,{icon:_t,className:`size-4`})}),c===void 0&&l===void 0&&(0,W.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Tasks`}),(c!==void 0||l!==void 0)&&(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs`,children:[(0,W.jsx)(H,{size:`icon-sm`,variant:`ghost`,title:`Back to tasks`,"aria-label":`Back to tasks`,onClick:()=>e.onSelect(null),children:(0,W.jsx)(V,{icon:po,className:`size-4`})}),c!==void 0&&u!==null&&(0,W.jsxs)(W.Fragment,{children:[c.status===`Running`?(0,W.jsx)(TI,{className:u.tone}):(0,W.jsx)(wI,{className:u.tone}),(0,W.jsx)(`span`,{className:`text-foreground shrink-0 font-medium`,children:u.name}),u.description!==``&&(0,W.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate`,children:u.description}),c.status===`Running`&&c.agentId!==null&&e.sessionId!==null&&(0,W.jsx)(ML,{machine:e.machine,sessionId:e.sessionId,taskId:c.agentId})]}),l!==void 0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(V,{icon:Ao,className:`text-muted-foreground size-4 shrink-0`}),(0,W.jsx)(`span`,{className:`text-foreground min-w-0 truncate font-medium`,children:pI(l.item)}),(0,W.jsx)(`span`,{className:B(`text-muted-foreground shrink-0`,l.status===`Failed`&&`text-destructive`,l.status===`Running`&&`text-shimmer`),children:l.status}),l.status===`Running`&&l.taskId!==null&&e.sessionId!==null&&(0,W.jsx)(ML,{machine:e.machine,sessionId:e.sessionId,taskId:l.taskId})]})]})]}),c===void 0&&l===void 0&&(0,W.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[(0,W.jsx)(`h2`,{className:`text-muted-foreground px-1 pb-1.5 text-xs font-medium`,children:`Agents`}),s.agents.length===0&&(0,W.jsx)(`p`,{className:`text-muted-foreground px-1 py-1 text-xs`,children:`No agents in this thread.`}),(0,W.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[...s.agents.filter(e=>e.status===`Running`),...s.agents.filter(e=>e.status!==`Running`)].map(t=>{let n=CI(t.item),r=t.agentId;return(0,W.jsxs)(`div`,{className:`bg-secondary hover:bg-accent flex items-center rounded-lg`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-label":`Open ${n.name} agent: ${n.description}`,className:`focus-visible:ring-ring/70 flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-left text-[13px] leading-5 tracking-[-0.04px] select-none focus-visible:ring-2 focus-visible:outline-none`,onClick:()=>e.onSelect(t.item.id),children:[t.status===`Running`?(0,W.jsx)(TI,{className:n.tone}):(0,W.jsx)(wI,{className:n.tone}),(0,W.jsx)(`span`,{className:`text-foreground shrink-0 font-medium`,children:n.name}),(0,W.jsx)(`span`,{className:`text-foreground min-w-0 flex-1 truncate`,children:n.description}),(0,W.jsx)(`span`,{className:B(`text-muted-foreground shrink-0 text-xs`,t.status===`Failed`&&`text-destructive`,t.status===`Running`&&`text-shimmer`),children:t.status})]}),t.status===`Running`&&r!==null&&e.sessionId!==null&&(0,W.jsx)(jL,{label:`Stop ${n.name} agent`,onClick:()=>a({taskId:r,title:`${n.name} agent`})})]},t.item.id)})}),(0,W.jsx)(`h2`,{className:`text-muted-foreground px-1 pt-5 pb-1.5 text-xs font-medium`,children:`Tasks`}),s.tasks.length===0&&(0,W.jsx)(`p`,{className:`text-muted-foreground px-1 py-1 text-xs`,children:`No background tasks in this thread.`}),(0,W.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[...s.tasks.filter(e=>e.status===`Running`),...s.tasks.filter(e=>e.status!==`Running`)].map(t=>{let n=t.taskId;return(0,W.jsxs)(`div`,{className:`bg-secondary hover:bg-accent flex items-center rounded-lg`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-label":`Open task: ${pI(t.item)}`,className:`focus-visible:ring-ring/70 flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-left text-[13px] leading-5 tracking-[-0.04px] select-none focus-visible:ring-2 focus-visible:outline-none`,onClick:()=>e.onSelect(t.item.id),children:[(0,W.jsx)(V,{icon:Ao,className:B(`size-4 shrink-0`,t.status===`Running`?`text-foreground animate-pulse`:`text-muted-foreground`)}),(0,W.jsx)(`span`,{className:`text-foreground min-w-0 flex-1 truncate`,children:pI(t.item)}),(0,W.jsx)(`span`,{className:B(`text-muted-foreground shrink-0 text-xs`,t.status===`Failed`&&`text-destructive`,t.status===`Running`&&`text-shimmer`),children:t.status})]}),t.status===`Running`&&n!==null&&e.sessionId!==null&&(0,W.jsx)(jL,{label:`Stop task: ${pI(t.item)}`,onClick:()=>a({taskId:n,title:pI(t.item)})})]},t.item.id)})})]}),c!==void 0&&(0,W.jsx)(FL,{item:c.item,agentId:c.agentId,running:c.status===`Running`,items:o,found:s,cwd:e.cwd,onSelect:e.onSelect},c.item.id),l!==void 0&&e.sessionId!==null&&(0,W.jsx)(PL,{machine:e.machine,sessionId:e.sessionId,command:l.item.command,path:l.path,events:l.events,running:l.status===`Running`},l.item.id),(0,W.jsx)(AL,{machine:e.machine,sessionId:e.sessionId,stopping:i,onClose:()=>a(null)})]})}function PL(e){let[t,n]=(0,U.useState)(void 0),[r,i]=(0,U.useState)(null),a=(0,U.useRef)(null),o=(0,U.useRef)(!0);(0,U.useEffect)(()=>{let t=e.path;if(t===null)return;let r=!0;async function a(t){try{let a=await z(e.machine,`tasks.output`,{sessionId:e.sessionId,path:t});if(!r)return;n(a),i(null)}catch(e){r&&i(Ht(e))}}a(t);let o=e.running?window.setInterval(()=>void a(t),2e3):null;return()=>{r=!1,o!==null&&window.clearInterval(o)}},[e.machine,e.sessionId,e.path,e.running]),(0,U.useLayoutEffect)(()=>{let e=a.current;e!==null&&o.current&&(e.scrollTop=e.scrollHeight)},[t,e.events]);let s=e.path===null?e.events.join(`
|
|
24
|
-
`):t?.text??``;return(0,W.jsxs)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain p-3`,onScroll:e=>{let t=e.currentTarget;o.current=t.scrollHeight-t.scrollTop-t.clientHeight<40},children:[e.command!==``&&(0,W.jsxs)(`p`,{className:`text-muted-foreground pb-2 font-mono text-xs [overflow-wrap:anywhere] whitespace-pre-wrap`,children:[`$ `,e.command]}),r!==null&&(0,W.jsx)(`p`,{className:`text-destructive text-xs`,children:r}),r===null&&e.path!==null&&t===void 0&&(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Loading…`}),r===null&&e.path!==null&&t===null&&(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The output file no longer exists.`}),t?.truncated===!0&&(0,W.jsx)(`p`,{className:`text-muted-foreground pb-2 text-xs`,children:`Showing the end of the output.`}),e.path===null&&e.events.length===0&&(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No events yet.`}),t?.text===``&&(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.running?`No output yet.`:`No output.`}),s!==``&&(0,W.jsx)(`pre`,{className:`bg-secondary text-foreground rounded-lg p-3 font-mono text-xs leading-5 [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:s})]})}function FL(e){let t=(0,U.useRef)(null),n=(0,U.useRef)(!0),[r,i]=(0,U.useState)([]);(0,U.useLayoutEffect)(()=>{let e=t.current;e!==null&&n.current&&(e.scrollTop=e.scrollHeight)},[e.items,e.running]);function a(e){i(r.includes(e)?r.filter(t=>t!==e):[...r,e])}let o=e.items.filter(t=>t.parent===e.item.id),s=o.length===0;(0,U.useEffect)(()=>{s&&e.agentId!==null&&Xe(e.item.id,e.agentId)},[s,e.item.id,e.agentId]);let c=o.at(0),l=c?.kind===`user`?c:null,u=BI({prompt:null,first:!1,items:l===null?o:o.slice(1)},e.running?{partial:``}:null);return(0,W.jsxs)(`div`,{ref:t,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-4 pt-1 pb-8`,onScroll:e=>{let t=e.currentTarget;n.current=t.scrollHeight-t.scrollTop-t.clientHeight<40},children:[l!==null&&(0,W.jsx)(vI,{title:`Prompt`,pending:!1,grouped:!0,open:r.includes(`prompt`),onToggle:()=>a(`prompt`),children:(0,W.jsx)($n,{text:l.text,className:`text-muted-foreground text-[13px]`})}),u.map((t,n)=>{let i=u[n-1];return(0,W.jsx)(`div`,{className:B(i===void 0?`pt-2`:t.kind===`working`?void 0:zI(t)&&zI(i)?`pt-2`:`pt-4`,t.kind===`assistant`&&`group/assistant`),children:(0,W.jsx)(SL,{row:t,agents:e.found.agents,tasks:e.found.tasks,running:e.running,compacting:!1,fork:!1,expanded:r.includes(t.key),onToggle:a,onOpenTask:e.onSelect,rewind:!1,cwd:e.cwd})},t.key)})]})}var IL=(0,U.lazy)(async()=>({default:(await ci(async()=>{let{DiffPanel:e}=await import(`./diff-panel-Dp94FfM1.js`);return{DiffPanel:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))).DiffPanel})),LL=`text-foreground hover:bg-accent data-[pressed=true]:bg-accent relative grid h-7 min-w-7 cursor-pointer place-items-center rounded-lg border border-transparent [&_svg]:size-4 [&_svg]:opacity-80`;function RL(e){let t=BL(e),n=k(e=>e.prefs),r=k(e=>e.editor===null);return gr(()=>Et({machine:e.selection.machine,projectId:e.selection.projectId}),r),(0,W.jsxs)(ar,{children:[(0,W.jsx)(Wn,{asChild:!0,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t.filter(e=>n.toolbar.includes(e.id)).map(e=>(0,W.jsxs)(`button`,{className:LL,"data-pressed":e.pressed,"aria-label":e.label,title:e.title,onClick:e.onSelect,children:[(0,W.jsx)(V,{icon:e.icon}),e.badge]},e.id)),e.children]})}),(0,W.jsx)(Xn,{className:`w-44`,children:t.map(e=>(0,W.jsxs)(fr,{checked:n.toolbar.includes(e.id),onCheckedChange:t=>D({...n,toolbar:t?[...n.toolbar,e.id]:n.toolbar.filter(t=>t!==e.id)}),children:[(0,W.jsx)(V,{icon:e.icon}),e.label]},e.id))})]})}function zL(e){let t=e.session,n=k(e=>e.prefs.toolbar),r=BL(e).filter(t=>e.mobile||!n.includes(t.id)),i=Pr(`sidebarScope`),a=k(e=>{if(t===void 0)return!1;let n=ke(e.machines,t.machine,t.id);return n?.running===!0||Object.values(n?.tasks??{}).includes(`running`)}),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(!1);function u(){if(t===void 0)throw Error(`session is missing`);Ue(t.machine,t.id,i)}return(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,W.jsxs)(fn,{open:e.open,onOpenChange:e.onOpenChange,children:[(0,W.jsx)(dr,{asChild:!0,children:(0,W.jsxs)(`button`,{className:B(LL,`data-[state=open]:bg-accent`),"aria-label":`More`,title:`More`,children:[(0,W.jsx)(V,{icon:nr}),r.some(e=>e.attention)&&(0,W.jsx)(`span`,{className:`bg-muted-foreground ring-background absolute top-0.5 right-0.5 size-1.5 rounded-full ring-2`})]})}),(0,W.jsxs)(vn,{className:`w-56 [&>[data-slot=dropdown-menu-separator]:first-child]:hidden`,align:`end`,children:[r.map(e=>(0,W.jsxs)(wn,{onSelect:e.onSelect,children:[(0,W.jsx)(V,{icon:e.icon}),(0,W.jsx)(`span`,{className:`flex-1`,children:e.label}),e.detail]},e.id)),e.children,t!==void 0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(On,{}),(0,W.jsx)(_k,{session:t,context:!1,mobile:e.mobile,onDeactivate:()=>{a?l(!0):u()},onRename:()=>s(t.title)})]})]})]}),t!==void 0&&o!==null&&(0,W.jsx)(ei,{open:!0,onOpenChange:e=>{e||s(null)},children:(0,W.jsx)(qr,{children:(0,W.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault();let n=o.trim();s(null),n!==``&&n!==t.title&&Se(t.machine,t.id,{title:n})},children:[(0,W.jsx)(Jr,{children:(0,W.jsx)(Zr,{children:`Rename thread`})}),(0,W.jsx)(Kf,{"aria-label":`Title`,value:o,onChange:e=>s(e.target.value)}),(0,W.jsxs)(ti,{children:[(0,W.jsx)(H,{type:`button`,variant:`outline`,onClick:()=>s(null),children:`Cancel`}),(0,W.jsx)(H,{type:`submit`,children:`Rename`})]})]})})}),(0,W.jsx)(lr,{open:c,onOpenChange:l,children:(0,W.jsxs)(Kn,{children:[(0,W.jsxs)(Er,{children:[(0,W.jsx)(Ln,{children:`Stop running work?`}),(0,W.jsx)(Pn,{children:`The agent or background tasks are running. Do you really want to stop them?`})]}),(0,W.jsxs)(br,{children:[(0,W.jsx)(Jn,{children:`Cancel`}),(0,W.jsx)(rr,{variant:`destructive`,onClick:u,children:`Stop and Mark Done`})]})]})})]})}function BL(e){let t=(0,U.useSyncExternalStore)(CP,()=>wP().alerts.length>0),n=(0,U.useSyncExternalStore)(CP,()=>wP().layout.tabs.filter(t=>t.projectId===e.selection.projectId).length),r=k(e=>{if(e.selection?.sessionId===null)return 0;let t=fI([...e.earlier,...e.items],Ce(e));return[...t.agents,...t.tasks].filter(e=>e.status===`Running`).length});return[{id:`diff`,label:`Diff`,title:`Diff`,icon:Lo,pressed:e.panel===`diff`,attention:e.changed,badge:e.changed&&(0,W.jsx)(`span`,{className:`bg-muted-foreground ring-background absolute top-0.5 right-0.5 size-1.5 rounded-full ring-2`}),detail:e.changed&&(0,W.jsx)(`span`,{className:`bg-muted-foreground size-1.5 rounded-full`}),onSelect:()=>e.onPanel(e.panel===`diff`?null:`diff`)},{id:`terminal`,label:`Terminal`,title:`Terminal (${Vt}+\`)`,icon:Ss,pressed:e.terminal,attention:t,badge:n>0&&(0,W.jsx)(`span`,{className:B(`absolute top-0 right-0 grid h-3 min-w-3 place-items-center rounded-full px-0.5 text-[8px] leading-none font-medium tabular-nums`,t?`bg-primary text-primary-foreground`:`text-foreground bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))]`),children:n}),detail:n>0&&(0,W.jsx)(`span`,{className:B(`text-xs tabular-nums`,t?`text-primary`:`text-muted-foreground`),children:n}),onSelect:()=>e.onTerminal(!e.terminal)},{id:`tasks`,label:`Tasks`,title:`Tasks`,icon:Ts,pressed:e.panel===`tasks`,attention:r>0,badge:r>0&&(0,W.jsx)(`span`,{className:`text-foreground absolute top-0 right-0 grid h-3 min-w-3 place-items-center rounded-full bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))] px-0.5 text-[8px] leading-none font-medium tabular-nums`,children:r}),detail:r>0&&(0,W.jsx)(`span`,{className:`text-muted-foreground text-xs tabular-nums`,children:r}),onSelect:()=>e.onPanel(e.panel===`tasks`?null:`tasks`)},{id:`browser`,label:`Browser`,title:`Browser`,icon:vo,pressed:e.panel===`browser`,attention:!1,badge:null,detail:null,onSelect:()=>e.onPanel(e.panel===`browser`?null:`browser`)},{id:`editor`,label:`Editor`,title:`Editor`,icon:js,pressed:!1,attention:!1,badge:null,detail:null,onSelect:()=>Et({machine:e.selection.machine,projectId:e.selection.projectId})}]}function VL(e){return(0,W.jsxs)(W.Fragment,{children:[e.panel===`browser`&&(0,W.jsx)(TL,{machine:e.selection.machine,onClose:()=>e.onPanel(null)}),e.panel===`diff`&&(0,W.jsx)(U.Suspense,{children:(0,W.jsx)(IL,{machine:e.selection.machine,projectId:e.selection.projectId,running:e.running,onClose:()=>e.onPanel(null)},`${e.selection.machine} ${e.selection.projectId}`)}),e.panel===`tasks`&&(0,W.jsx)(NL,{machine:e.selection.machine,cwd:e.cwd,sessionId:e.selection.sessionId,selected:e.selectedTask,onSelect:e.onSelectTask,onClose:()=>e.onPanel(null)})]})}function HL(){let e=k(e=>e.selection),t=k(e=>e.machines.length>0),n=h();return n===null?e===null?t?(0,W.jsx)(`div`,{className:`bg-sidebar relative flex min-w-0 flex-1 pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:(0,W.jsx)(uI,{className:`min-w-0 flex-1 border-r-0`,mobile:!0})}):(0,W.jsx)(`main`,{className:`bg-background flex flex-1 overflow-y-auto pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:(0,W.jsx)(eO,{})}):(0,W.jsx)(UL,{selection:e}):(0,W.jsx)(eI,{machine:n,mobile:!0,leading:(0,W.jsx)(H,{variant:`ghost`,size:`icon-xs`,className:`h-full w-11 rounded-none`,"aria-label":`Back`,title:`Back`,onClick:()=>l(`chat`,()=>void nt.navigate({to:`/`,search:{},replace:!0})),children:(0,W.jsx)(V,{icon:po})})})}function UL(e){let t=k(t=>L(t,e.selection.machine)),n=k(t=>t.sessions.find(t=>t.machine===e.selection.machine&&t.id===e.selection.sessionId)),r=k(e=>n!==void 0&&e.generatingTitles.includes(P(n.machine,n.id))),i=k(t=>Ct(t,e.selection.machine,e.selection.projectId)?.path??``),a=Ns(e.selection.machine,e.selection.projectId),o=k(Ot),s=k(t=>e.selection.projectId===`no-project`||Ct(t,e.selection.machine,e.selection.projectId)?.scratch===!0),c=cp(e.selection.machine,t.status===`online`&&!s?e.selection.projectId:null,o),u=lp({machine:e.selection.machine,projectId:e.selection.projectId,repos:c.repos,onRefresh:c.refresh}),d=(0,U.useSyncExternalStore)(CP,()=>wP().open),f=Fe({from:`__root__`,select:e=>e.panel??null}),[m,h]=(0,U.useState)(null),g=c.repos.some(e=>e.changed>0),_=!s&&(f!==null||d),v=(0,U.useCallback)(e=>{_?M(e):p(e,`overlay`)},[_]),y=(0,U.useCallback)(e=>{h(null),e===null?WL():v({panel:e,bottom:void 0})},[v]),b=(0,U.useCallback)(e=>{y(`tasks`),h(e)},[y]);function x(e){e?v({panel:void 0,bottom:`terminal`}):WL()}return(0,W.jsxs)(`main`,{className:`bg-background flex min-w-0 flex-1 flex-col overflow-hidden pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,W.jsxs)(`header`,{className:`flex h-(--workspace-topbar-height) shrink-0 items-center gap-1.5 px-2`,children:[(0,W.jsx)(H,{variant:`ghost`,size:`icon`,"aria-label":`Back`,onClick:()=>l(`chat`,pt),children:(0,W.jsx)(V,{icon:po,className:`text-foreground size-5`,strokeWidth:2})}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`text-foreground truncate font-medium`,children:(0,W.jsx)(`span`,{className:B((r||e.selection.sessionId!==null&&n===void 0)&&`text-shimmer`),children:n?.title??`New thread`})}),t.status===`online`&&(0,W.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1 text-xs`,children:[(0,W.jsx)(jd,{icon:t.icon,className:`size-3.5 shrink-0`}),(0,W.jsxs)(`span`,{className:`truncate`,children:[t.name,` / `,a]})]}),t.status!==`online`&&(0,W.jsxs)(`div`,{className:`text-warning-foreground truncate text-xs`,children:[t.status===`connecting`&&`Connecting to ${t.name}…`,t.status===`offline`&&`${t.name} is offline, reconnecting…`,t.status===`unpaired`&&`${t.name} needs pairing`]})]}),(0,W.jsx)(Mf,{}),!s&&(0,W.jsx)(zL,{selection:e.selection,mobile:!0,session:n,panel:f,terminal:d,changed:g,open:u.menuOpen,onOpenChange:u.setMenuOpen,onPanel:y,onTerminal:x,children:c.repos.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(On,{}),(0,W.jsx)(up,{git:u,collapsed:!0})]})}),(0,W.jsx)(dp,{git:u})]}),(0,W.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,W.jsxs)(U.Fragment,{children:[(0,W.jsx)(bL,{onOpenTask:b}),(0,W.jsx)(Df,{})]},`${e.selection.machine} ${e.selection.sessionId??e.selection.projectId}`)}),(0,W.jsx)($r,{open:_,onOpenChange:()=>y(null),children:(0,W.jsx)(ri,{children:(0,W.jsxs)(Yr,{"aria-describedby":void 0,className:`bg-background data-open:animate-in data-open:slide-in-from-right fixed inset-0 z-40 flex flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)] text-sm duration-200 outline-none [--workspace-topbar-height:44px] motion-reduce:animate-none`,children:[(0,W.jsxs)(ai,{className:`sr-only`,children:[f===`diff`&&`Diff`,f===`tasks`&&`Tasks`,f===`browser`&&`Browser`,f===null&&`Terminal`]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[f!==null&&(0,W.jsx)(VL,{panel:f,selection:e.selection,cwd:i,running:o,selectedTask:m,onSelectTask:h,onPanel:y}),f===null&&d&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`border-border/60 flex h-(--workspace-topbar-height) shrink-0 items-center gap-1 border-b px-3`,children:[(0,W.jsx)(H,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:()=>x(!1),children:(0,W.jsx)(V,{icon:_t,className:`size-4`})}),(0,W.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Terminal`})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,W.jsx)(YF,{view:e.selection.projectId})})]})]})]})})})]})}function WL(){l(`overlay`,()=>M({panel:void 0,bottom:void 0}))}var GL=(0,U.lazy)(async()=>({default:(await ci(async()=>{let{EditorDialog:e}=await import(`./editor-dialog-DYSeKCLc.js`);return{EditorDialog:e}},__vite__mapDeps([18,1,19,3,6,7,20,8,4,21,22,11,12,23,5,9,10,13,14,15,16,17,24,25,26,27,28]))).EditorDialog})),KL=window.matchMedia(`(min-width: 768px)`),qL=800,JL=[`mod+k`,`mod+shift+p`];function YL(e){return KL.addEventListener(`change`,e),()=>KL.removeEventListener(`change`,e)}function XL(){let e=(0,U.useSyncExternalStore)(YL,()=>KL.matches),t=k(e=>e.editor),n=k(e=>e.exporting);return Ua(),or(JL,()=>u(!R().paletteOpen),{enableOnFormTags:!0,preventDefault:!0}),(0,W.jsxs)(`div`,{className:`flex h-dvh text-sm`,children:[e?(0,W.jsx)(QL,{}):(0,W.jsx)(HL,{}),(0,W.jsx)(lk,{}),e?(0,W.jsx)(JD,{}):(0,W.jsx)($D,{}),t!==null&&(0,W.jsx)(U.Suspense,{children:(0,W.jsx)(GL,{machine:t.machine,projectId:t.projectId,onClose:()=>Et(null)})}),n!==null&&(0,W.jsx)(iO,{session:n}),(0,W.jsx)(Gf,{}),(0,W.jsx)(fu,{position:e?`bottom-right`:`top-center`,swipeDirections:e?[`right`,`bottom`]:[`left`,`right`,`top`]})]})}function ZL(e){M({panel:e??void 0})}function QL(){let e=k(e=>e.selection),t=k(e=>e.sessions),n=h(),r=k(e=>e.selection===null?``:Ct(e,e.selection.machine,e.selection.projectId)?.path??``),i=k(e=>{let t=ot(e);return t===null?null:L(e,t)}),[a,o]=(0,U.useState)(!0),s=(0,U.useRef)(null),[c,l]=(0,U.useState)(!1),u=Fe({from:`__root__`,select:e=>e.panel??null}),d=(0,U.useRef)(`diff`),[f,p]=(0,U.useState)(null),m=(0,U.useCallback)(e=>{p(e),ZL(`tasks`)},[]),[g,_]=Nr(`panelWidth`,540),[v,y]=(0,U.useState)(280),b=(0,U.useSyncExternalStore)(CP,()=>wP().open),x=k(Ot),S=k(e=>e.selection?.projectId===`no-project`||e.selection!==null&&Ct(e,e.selection.machine,e.selection.projectId)?.scratch===!0),C=cp(e?.machine??``,i?.status===`online`&&!S?e?.projectId??null:null,x),w=lp({machine:e?.machine??``,projectId:e?.projectId??``,repos:C.repos,onRefresh:C.refresh}),T=t.find(t=>t.machine===e?.machine&&t.id===e.sessionId),E=k(e=>T!==void 0&&e.generatingTitles.includes(P(T.machine,T.id))),D=Ns(e?.machine??``,e?.projectId??``);return or([`meta+backquote`,`ctrl+backquote`],e=>{e.stopPropagation(),MP(!wP().open)},{enableOnFormTags:!0,preventDefault:!0,eventListenerOptions:{capture:!0}}),or([`mod+j`,`mod+shift+b`],e=>{e.stopPropagation(),ZL(se().panel===void 0?d.current:null)},{enableOnFormTags:!0,preventDefault:!0,eventListenerOptions:{capture:!0}}),(0,U.useEffect)(()=>{u!==null&&(d.current=u)},[u]),or([`mod+b`,`mod+shift+j`],()=>o(e=>!e),{enableOnFormTags:!0,preventDefault:!0}),(0,U.useEffect)(()=>{if(n!==null)return;let e=s.current;if(e===null)throw Error(`header is not mounted`);let t=new ResizeObserver(e=>l(e[0].contentRect.width<qL));return t.observe(e),()=>t.disconnect()},[n]),n===null?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(uI,{className:B(`relative`,!a&&`hidden`),mobile:!1,onHide:()=>o(!1)}),!a&&(0,W.jsx)(`div`,{className:`fixed top-0 left-3 z-50 flex h-(--workspace-topbar-height) items-center`,children:(0,W.jsx)(H,{variant:`ghost`,size:`icon-sm`,"aria-label":`Show sidebar`,title:`Show sidebar (${Vt}+B)`,onClick:()=>o(!0),children:(0,W.jsx)(V,{icon:Bn})})}),(0,W.jsxs)(`main`,{className:`bg-background relative flex min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,W.jsxs)(`header`,{ref:s,className:B(`bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-3 pr-3 pl-[3.25rem]`,a&&`pl-5`),children:[e!==null&&i!==null&&(0,W.jsx)(`nav`,{className:`min-w-0 flex-1`,children:(0,W.jsxs)(`ol`,{className:`flex min-w-0 items-center gap-3 text-sm`,children:[(0,W.jsxs)(`li`,{className:`text-icon-muted flex shrink-0 items-center gap-1.5`,children:[(0,W.jsx)(jd,{icon:i.icon,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`max-w-40 truncate`,children:i.name})]}),(0,W.jsx)(`li`,{"aria-hidden":!0,className:`text-icon-muted shrink-0`,children:`/`}),(0,W.jsxs)(`li`,{className:`text-muted-foreground flex min-w-0 shrink items-center gap-1.5 font-medium`,title:`${i.name}:${r}`,children:[(0,W.jsx)(zs,{machine:e.machine,projectId:e.projectId,className:`size-3.5`}),(0,W.jsx)(`span`,{className:`max-w-40 truncate`,children:D})]}),(0,W.jsx)(`li`,{"aria-hidden":!0,className:`text-icon-muted shrink-0`,children:`/`}),(0,W.jsxs)(`li`,{className:B(`text-foreground flex min-w-10 items-center gap-2 font-medium`,a&&`flex-1`),children:[(0,W.jsx)(`span`,{className:B(`truncate`,(E||e.sessionId!==null&&T===void 0)&&`text-shimmer`),children:T?.title??`New thread`}),(0,W.jsx)(Mf,{})]}),!a&&(0,W.jsx)(`li`,{className:`shrink-0`,children:(0,W.jsx)(_F,{hideDone:!0})})]})}),e===null&&!a&&(0,W.jsx)(_F,{hideDone:!0}),e===null&&(0,W.jsx)(`span`,{className:`flex-1`}),i!==null&&i.status!==`online`&&(0,W.jsxs)(`span`,{className:`text-warning-foreground shrink-0 text-xs`,children:[i.status===`connecting`&&`Connecting to ${i.name}…`,i.status===`offline`&&`${i.name} is offline, reconnecting…`,i.status===`unpaired`&&`${i.name} needs pairing`]}),e!==null&&!S&&(0,W.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[!c&&C.repos.length>0&&(0,W.jsx)(fp,{machine:e.machine,projectId:e.projectId,repos:C.repos,onRefresh:C.refresh}),!c&&C.repos.length>0&&(0,W.jsx)(`span`,{className:`bg-foreground/15 mr-1 ml-2.5 h-4 w-px`}),(0,W.jsx)(RL,{selection:e,panel:u,terminal:b,changed:C.repos.some(e=>e.changed>0),onPanel:e=>{p(null),ZL(e)},onTerminal:MP,children:(0,W.jsx)(zL,{selection:e,mobile:!1,session:T,panel:u,terminal:b,changed:C.repos.some(e=>e.changed>0),open:w.menuOpen,onOpenChange:w.setMenuOpen,onPanel:e=>{p(null),ZL(e)},onTerminal:MP,children:c&&C.repos.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(On,{}),(0,W.jsx)(up,{git:w,collapsed:!0})]})})})]})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden`,children:[(0,W.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[i===null&&(0,W.jsx)(eO,{}),e===null&&i!==null&&(0,W.jsx)(`div`,{className:`grid flex-1 place-items-center p-6 text-center`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h1`,{className:`text-foreground text-3xl font-normal tracking-tight`,children:`Pick a thread, or start one`}),(0,W.jsx)(`p`,{className:`text-muted-foreground mt-2 text-sm`,children:`Open a project from the sidebar to talk to Claude.`})]})}),e!==null&&(0,W.jsxs)(U.Fragment,{children:[(0,W.jsx)(bL,{onOpenTask:m}),(0,W.jsx)(Df,{})]},`${e.machine} ${e.sessionId??e.projectId}`)]}),e!==null&&b&&!S&&(0,W.jsxs)(`aside`,{className:`border-border/80 bg-background relative shrink-0 overflow-hidden border-t`,style:{height:v},children:[(0,W.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,className:`group absolute inset-x-0 top-0 z-30 h-1.5 cursor-row-resize touch-none select-none`,onPointerDown:e=>Bt(e,e=>{let t=Math.max(120,Math.floor(window.innerHeight*.8));y(Math.min(t,Math.max(120,window.innerHeight-e.clientY)))}),children:(0,W.jsx)(`span`,{className:`group-hover:bg-border group-active:bg-primary/60 pointer-events-none absolute inset-x-0 top-0 h-px transition-colors`})}),(0,W.jsx)(YF,{view:e.projectId})]})]}),e!==null&&u!==null&&!S&&(0,W.jsxs)(`div`,{className:`relative flex shrink-0`,style:{width:g},children:[(0,W.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,className:`group absolute inset-y-0 -left-1 z-20 w-2 cursor-col-resize select-none`,onPointerDown:e=>Bt(e,e=>{let t=Math.max(360,Math.floor(window.innerWidth*.7)),n=Math.min(t,Math.max(360,window.innerWidth-e.clientX));_(n)}),children:(0,W.jsx)(`span`,{className:`group-hover:bg-border group-active:bg-primary/60 pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`})}),(0,W.jsx)(`div`,{className:`bg-background flex min-w-0 flex-1 flex-col overflow-hidden rounded-tl-lg border-t border-l`,children:(0,W.jsx)(VL,{panel:u,selection:e,cwd:r,running:x,selectedTask:f,onSelectTask:p,onPanel:ZL})})]})]})]}),(0,W.jsx)(dp,{git:w})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(uI,{className:B(`relative`,!a&&`hidden`),mobile:!1,onHide:()=>o(!1)}),(0,W.jsx)(eI,{machine:n,mobile:!1,leading:!a&&(0,W.jsx)(H,{variant:`ghost`,size:`icon-xs`,"aria-label":`Show sidebar`,title:`Show sidebar (${Vt}+B)`,onClick:()=>o(!0),children:(0,W.jsx)(V,{icon:Bn})})})]})}var $L=class extends U.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(e,t.componentStack)}render(){let e=this.state.error;return e===null?this.props.children:(0,W.jsxs)(`div`,{className:`flex h-dvh flex-col items-center justify-center gap-3 p-4 text-center`,children:[(0,W.jsx)(`p`,{className:`font-medium`,children:`Something went wrong`}),(0,W.jsx)(`p`,{className:`text-muted-foreground max-w-xl text-sm whitespace-pre-wrap`,children:e.message}),(0,W.jsx)(H,{onClick:()=>location.reload(),children:`Reload`})]})}},eR=[`typescript`,`tsx`,`javascript`],tR=`import { readFile } from 'node:fs/promises'
|
|
24
|
+
`):t?.text??``;return(0,W.jsxs)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain p-3`,onScroll:e=>{let t=e.currentTarget;o.current=t.scrollHeight-t.scrollTop-t.clientHeight<40},children:[e.command!==``&&(0,W.jsxs)(`p`,{className:`text-muted-foreground pb-2 font-mono text-xs [overflow-wrap:anywhere] whitespace-pre-wrap`,children:[`$ `,e.command]}),r!==null&&(0,W.jsx)(`p`,{className:`text-destructive text-xs`,children:r}),r===null&&e.path!==null&&t===void 0&&(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Loading…`}),r===null&&e.path!==null&&t===null&&(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The output file no longer exists.`}),t?.truncated===!0&&(0,W.jsx)(`p`,{className:`text-muted-foreground pb-2 text-xs`,children:`Showing the end of the output.`}),e.path===null&&e.events.length===0&&(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No events yet.`}),t?.text===``&&(0,W.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.running?`No output yet.`:`No output.`}),s!==``&&(0,W.jsx)(`pre`,{className:`bg-secondary text-foreground rounded-lg p-3 font-mono text-xs leading-5 [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:s})]})}function FL(e){let t=(0,U.useRef)(null),n=(0,U.useRef)(!0),[r,i]=(0,U.useState)([]);(0,U.useLayoutEffect)(()=>{let e=t.current;e!==null&&n.current&&(e.scrollTop=e.scrollHeight)},[e.items,e.running]);function a(e){i(r.includes(e)?r.filter(t=>t!==e):[...r,e])}let o=e.items.filter(t=>t.parent===e.item.id),s=o.length===0;(0,U.useEffect)(()=>{s&&e.agentId!==null&&Xe(e.item.id,e.agentId)},[s,e.item.id,e.agentId]);let c=o.at(0),l=c?.kind===`user`?c:null,u=BI({prompt:null,first:!1,items:l===null?o:o.slice(1)},e.running?{partial:``}:null);return(0,W.jsxs)(`div`,{ref:t,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-4 pt-1 pb-8`,onScroll:e=>{let t=e.currentTarget;n.current=t.scrollHeight-t.scrollTop-t.clientHeight<40},children:[l!==null&&(0,W.jsx)(vI,{title:`Prompt`,pending:!1,grouped:!0,open:r.includes(`prompt`),onToggle:()=>a(`prompt`),children:(0,W.jsx)($n,{text:l.text,className:`text-muted-foreground text-[13px]`})}),u.map((t,n)=>{let i=u[n-1];return(0,W.jsx)(`div`,{className:B(i===void 0?`pt-2`:t.kind===`working`?void 0:zI(t)&&zI(i)?`pt-2`:`pt-4`,t.kind===`assistant`&&`group/assistant`),children:(0,W.jsx)(SL,{row:t,agents:e.found.agents,tasks:e.found.tasks,running:e.running,compacting:!1,fork:!1,expanded:r.includes(t.key),onToggle:a,onOpenTask:e.onSelect,rewind:!1,cwd:e.cwd})},t.key)})]})}var IL=(0,U.lazy)(async()=>({default:(await ci(async()=>{let{DiffPanel:e}=await import(`./diff-panel-C5Y2kAT1.js`);return{DiffPanel:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))).DiffPanel})),LL=`text-foreground hover:bg-accent data-[pressed=true]:bg-accent relative grid h-7 min-w-7 cursor-pointer place-items-center rounded-lg border border-transparent [&_svg]:size-4 [&_svg]:opacity-80`;function RL(e){let t=BL(e),n=k(e=>e.prefs),r=k(e=>e.editor===null);return gr(()=>Et({machine:e.selection.machine,projectId:e.selection.projectId}),r),(0,W.jsxs)(ar,{children:[(0,W.jsx)(Wn,{asChild:!0,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t.filter(e=>n.toolbar.includes(e.id)).map(e=>(0,W.jsxs)(`button`,{className:LL,"data-pressed":e.pressed,"aria-label":e.label,title:e.title,onClick:e.onSelect,children:[(0,W.jsx)(V,{icon:e.icon}),e.badge]},e.id)),e.children]})}),(0,W.jsx)(Xn,{className:`w-44`,children:t.map(e=>(0,W.jsxs)(fr,{checked:n.toolbar.includes(e.id),onCheckedChange:t=>D({...n,toolbar:t?[...n.toolbar,e.id]:n.toolbar.filter(t=>t!==e.id)}),children:[(0,W.jsx)(V,{icon:e.icon}),e.label]},e.id))})]})}function zL(e){let t=e.session,n=k(e=>e.prefs.toolbar),r=BL(e).filter(t=>e.mobile||!n.includes(t.id)),i=Pr(`sidebarScope`),a=k(e=>{if(t===void 0)return!1;let n=ke(e.machines,t.machine,t.id);return n?.running===!0||Object.values(n?.tasks??{}).includes(`running`)}),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(!1);function u(){if(t===void 0)throw Error(`session is missing`);Ue(t.machine,t.id,i)}return(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,W.jsxs)(fn,{open:e.open,onOpenChange:e.onOpenChange,children:[(0,W.jsx)(dr,{asChild:!0,children:(0,W.jsxs)(`button`,{className:B(LL,`data-[state=open]:bg-accent`),"aria-label":`More`,title:`More`,children:[(0,W.jsx)(V,{icon:nr}),r.some(e=>e.attention)&&(0,W.jsx)(`span`,{className:`bg-muted-foreground ring-background absolute top-0.5 right-0.5 size-1.5 rounded-full ring-2`})]})}),(0,W.jsxs)(vn,{className:`w-56 [&>[data-slot=dropdown-menu-separator]:first-child]:hidden`,align:`end`,children:[r.map(e=>(0,W.jsxs)(wn,{onSelect:e.onSelect,children:[(0,W.jsx)(V,{icon:e.icon}),(0,W.jsx)(`span`,{className:`flex-1`,children:e.label}),e.detail]},e.id)),e.children,t!==void 0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(On,{}),(0,W.jsx)(_k,{session:t,context:!1,mobile:e.mobile,onDeactivate:()=>{a?l(!0):u()},onRename:()=>s(t.title)})]})]})]}),t!==void 0&&o!==null&&(0,W.jsx)(ei,{open:!0,onOpenChange:e=>{e||s(null)},children:(0,W.jsx)(qr,{children:(0,W.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault();let n=o.trim();s(null),n!==``&&n!==t.title&&Se(t.machine,t.id,{title:n})},children:[(0,W.jsx)(Jr,{children:(0,W.jsx)(Zr,{children:`Rename thread`})}),(0,W.jsx)(Kf,{"aria-label":`Title`,value:o,onChange:e=>s(e.target.value)}),(0,W.jsxs)(ti,{children:[(0,W.jsx)(H,{type:`button`,variant:`outline`,onClick:()=>s(null),children:`Cancel`}),(0,W.jsx)(H,{type:`submit`,children:`Rename`})]})]})})}),(0,W.jsx)(lr,{open:c,onOpenChange:l,children:(0,W.jsxs)(Kn,{children:[(0,W.jsxs)(Er,{children:[(0,W.jsx)(Ln,{children:`Stop running work?`}),(0,W.jsx)(Pn,{children:`The agent or background tasks are running. Do you really want to stop them?`})]}),(0,W.jsxs)(br,{children:[(0,W.jsx)(Jn,{children:`Cancel`}),(0,W.jsx)(rr,{variant:`destructive`,onClick:u,children:`Stop and Mark Done`})]})]})})]})}function BL(e){let t=(0,U.useSyncExternalStore)(CP,()=>wP().alerts.length>0),n=(0,U.useSyncExternalStore)(CP,()=>wP().layout.tabs.filter(t=>t.projectId===e.selection.projectId).length),r=k(e=>{if(e.selection?.sessionId===null)return 0;let t=fI([...e.earlier,...e.items],Ce(e));return[...t.agents,...t.tasks].filter(e=>e.status===`Running`).length});return[{id:`diff`,label:`Diff`,title:`Diff`,icon:Lo,pressed:e.panel===`diff`,attention:e.changed,badge:e.changed&&(0,W.jsx)(`span`,{className:`bg-muted-foreground ring-background absolute top-0.5 right-0.5 size-1.5 rounded-full ring-2`}),detail:e.changed&&(0,W.jsx)(`span`,{className:`bg-muted-foreground size-1.5 rounded-full`}),onSelect:()=>e.onPanel(e.panel===`diff`?null:`diff`)},{id:`terminal`,label:`Terminal`,title:`Terminal (${Vt}+\`)`,icon:Ss,pressed:e.terminal,attention:t,badge:n>0&&(0,W.jsx)(`span`,{className:B(`absolute top-0 right-0 grid h-3 min-w-3 place-items-center rounded-full px-0.5 text-[8px] leading-none font-medium tabular-nums`,t?`bg-primary text-primary-foreground`:`text-foreground bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))]`),children:n}),detail:n>0&&(0,W.jsx)(`span`,{className:B(`text-xs tabular-nums`,t?`text-primary`:`text-muted-foreground`),children:n}),onSelect:()=>e.onTerminal(!e.terminal)},{id:`tasks`,label:`Tasks`,title:`Tasks`,icon:Ts,pressed:e.panel===`tasks`,attention:r>0,badge:r>0&&(0,W.jsx)(`span`,{className:`text-foreground absolute top-0 right-0 grid h-3 min-w-3 place-items-center rounded-full bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))] px-0.5 text-[8px] leading-none font-medium tabular-nums`,children:r}),detail:r>0&&(0,W.jsx)(`span`,{className:`text-muted-foreground text-xs tabular-nums`,children:r}),onSelect:()=>e.onPanel(e.panel===`tasks`?null:`tasks`)},{id:`browser`,label:`Browser`,title:`Browser`,icon:vo,pressed:e.panel===`browser`,attention:!1,badge:null,detail:null,onSelect:()=>e.onPanel(e.panel===`browser`?null:`browser`)},{id:`editor`,label:`Editor`,title:`Editor`,icon:js,pressed:!1,attention:!1,badge:null,detail:null,onSelect:()=>Et({machine:e.selection.machine,projectId:e.selection.projectId})}]}function VL(e){return(0,W.jsxs)(W.Fragment,{children:[e.panel===`browser`&&(0,W.jsx)(TL,{machine:e.selection.machine,onClose:()=>e.onPanel(null)}),e.panel===`diff`&&(0,W.jsx)(U.Suspense,{children:(0,W.jsx)(IL,{machine:e.selection.machine,projectId:e.selection.projectId,running:e.running,onClose:()=>e.onPanel(null)},`${e.selection.machine} ${e.selection.projectId}`)}),e.panel===`tasks`&&(0,W.jsx)(NL,{machine:e.selection.machine,cwd:e.cwd,sessionId:e.selection.sessionId,selected:e.selectedTask,onSelect:e.onSelectTask,onClose:()=>e.onPanel(null)})]})}function HL(){let e=k(e=>e.selection),t=k(e=>e.machines.length>0),n=h();return n===null?e===null?t?(0,W.jsx)(`div`,{className:`bg-sidebar relative flex min-w-0 flex-1 pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:(0,W.jsx)(uI,{className:`min-w-0 flex-1 border-r-0`,mobile:!0})}):(0,W.jsx)(`main`,{className:`bg-background flex flex-1 overflow-y-auto pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:(0,W.jsx)(eO,{})}):(0,W.jsx)(UL,{selection:e}):(0,W.jsx)(eI,{machine:n,mobile:!0,leading:(0,W.jsx)(H,{variant:`ghost`,size:`icon-xs`,className:`h-full w-11 rounded-none`,"aria-label":`Back`,title:`Back`,onClick:()=>l(`chat`,()=>void nt.navigate({to:`/`,search:{},replace:!0})),children:(0,W.jsx)(V,{icon:po})})})}function UL(e){let t=k(t=>L(t,e.selection.machine)),n=k(t=>t.sessions.find(t=>t.machine===e.selection.machine&&t.id===e.selection.sessionId)),r=k(e=>n!==void 0&&e.generatingTitles.includes(P(n.machine,n.id))),i=k(t=>Ct(t,e.selection.machine,e.selection.projectId)?.path??``),a=Ns(e.selection.machine,e.selection.projectId),o=k(Ot),s=k(t=>e.selection.projectId===`no-project`||Ct(t,e.selection.machine,e.selection.projectId)?.scratch===!0),c=cp(e.selection.machine,t.status===`online`&&!s?e.selection.projectId:null,o),u=lp({machine:e.selection.machine,projectId:e.selection.projectId,repos:c.repos,onRefresh:c.refresh}),d=(0,U.useSyncExternalStore)(CP,()=>wP().open),f=Fe({from:`__root__`,select:e=>e.panel??null}),[m,h]=(0,U.useState)(null),g=c.repos.some(e=>e.changed>0),_=!s&&(f!==null||d),v=(0,U.useCallback)(e=>{_?M(e):p(e,`overlay`)},[_]),y=(0,U.useCallback)(e=>{h(null),e===null?WL():v({panel:e,bottom:void 0})},[v]),b=(0,U.useCallback)(e=>{y(`tasks`),h(e)},[y]);function x(e){e?v({panel:void 0,bottom:`terminal`}):WL()}return(0,W.jsxs)(`main`,{className:`bg-background flex min-w-0 flex-1 flex-col overflow-hidden pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,W.jsxs)(`header`,{className:`flex h-(--workspace-topbar-height) shrink-0 items-center gap-1.5 px-2`,children:[(0,W.jsx)(H,{variant:`ghost`,size:`icon`,"aria-label":`Back`,onClick:()=>l(`chat`,pt),children:(0,W.jsx)(V,{icon:po,className:`text-foreground size-5`,strokeWidth:2})}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`text-foreground truncate font-medium`,children:(0,W.jsx)(`span`,{className:B((r||e.selection.sessionId!==null&&n===void 0)&&`text-shimmer`),children:n?.title??`New thread`})}),t.status===`online`&&(0,W.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1 text-xs`,children:[(0,W.jsx)(jd,{icon:t.icon,className:`size-3.5 shrink-0`}),(0,W.jsxs)(`span`,{className:`truncate`,children:[t.name,` / `,a]})]}),t.status!==`online`&&(0,W.jsxs)(`div`,{className:`text-warning-foreground truncate text-xs`,children:[t.status===`connecting`&&`Connecting to ${t.name}…`,t.status===`offline`&&`${t.name} is offline, reconnecting…`,t.status===`unpaired`&&`${t.name} needs pairing`]})]}),(0,W.jsx)(Mf,{}),!s&&(0,W.jsx)(zL,{selection:e.selection,mobile:!0,session:n,panel:f,terminal:d,changed:g,open:u.menuOpen,onOpenChange:u.setMenuOpen,onPanel:y,onTerminal:x,children:c.repos.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(On,{}),(0,W.jsx)(up,{git:u,collapsed:!0})]})}),(0,W.jsx)(dp,{git:u})]}),(0,W.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,W.jsxs)(U.Fragment,{children:[(0,W.jsx)(bL,{onOpenTask:b}),(0,W.jsx)(Df,{})]},`${e.selection.machine} ${e.selection.sessionId??e.selection.projectId}`)}),(0,W.jsx)($r,{open:_,onOpenChange:()=>y(null),children:(0,W.jsx)(ri,{children:(0,W.jsxs)(Yr,{"aria-describedby":void 0,className:`bg-background data-open:animate-in data-open:slide-in-from-right fixed inset-0 z-40 flex flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)] text-sm duration-200 outline-none [--workspace-topbar-height:44px] motion-reduce:animate-none`,children:[(0,W.jsxs)(ai,{className:`sr-only`,children:[f===`diff`&&`Diff`,f===`tasks`&&`Tasks`,f===`browser`&&`Browser`,f===null&&`Terminal`]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[f!==null&&(0,W.jsx)(VL,{panel:f,selection:e.selection,cwd:i,running:o,selectedTask:m,onSelectTask:h,onPanel:y}),f===null&&d&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`border-border/60 flex h-(--workspace-topbar-height) shrink-0 items-center gap-1 border-b px-3`,children:[(0,W.jsx)(H,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:()=>x(!1),children:(0,W.jsx)(V,{icon:_t,className:`size-4`})}),(0,W.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Terminal`})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,W.jsx)(YF,{view:e.selection.projectId})})]})]})]})})})]})}function WL(){l(`overlay`,()=>M({panel:void 0,bottom:void 0}))}var GL=(0,U.lazy)(async()=>({default:(await ci(async()=>{let{EditorDialog:e}=await import(`./editor-dialog-Ca40iXLG.js`);return{EditorDialog:e}},__vite__mapDeps([18,1,19,3,6,7,20,8,4,21,22,11,12,23,5,9,10,13,14,15,16,17,24,25,26,27,28]))).EditorDialog})),KL=window.matchMedia(`(min-width: 768px)`),qL=800,JL=[`mod+k`,`mod+shift+p`];function YL(e){return KL.addEventListener(`change`,e),()=>KL.removeEventListener(`change`,e)}function XL(){let e=(0,U.useSyncExternalStore)(YL,()=>KL.matches),t=k(e=>e.editor),n=k(e=>e.exporting);return Ua(),or(JL,()=>u(!R().paletteOpen),{enableOnFormTags:!0,preventDefault:!0}),(0,W.jsxs)(`div`,{className:`flex h-dvh text-sm`,children:[e?(0,W.jsx)(QL,{}):(0,W.jsx)(HL,{}),(0,W.jsx)(lk,{}),e?(0,W.jsx)(JD,{}):(0,W.jsx)($D,{}),t!==null&&(0,W.jsx)(U.Suspense,{children:(0,W.jsx)(GL,{machine:t.machine,projectId:t.projectId,onClose:()=>Et(null)})}),n!==null&&(0,W.jsx)(iO,{session:n}),(0,W.jsx)(Gf,{}),(0,W.jsx)(fu,{position:e?`bottom-right`:`top-center`,swipeDirections:e?[`right`,`bottom`]:[`left`,`right`,`top`]})]})}function ZL(e){M({panel:e??void 0})}function QL(){let e=k(e=>e.selection),t=k(e=>e.sessions),n=h(),r=k(e=>e.selection===null?``:Ct(e,e.selection.machine,e.selection.projectId)?.path??``),i=k(e=>{let t=ot(e);return t===null?null:L(e,t)}),[a,o]=(0,U.useState)(!0),s=(0,U.useRef)(null),[c,l]=(0,U.useState)(!1),u=Fe({from:`__root__`,select:e=>e.panel??null}),d=(0,U.useRef)(`diff`),[f,p]=(0,U.useState)(null),m=(0,U.useCallback)(e=>{p(e),ZL(`tasks`)},[]),[g,_]=Nr(`panelWidth`,540),[v,y]=(0,U.useState)(280),b=(0,U.useSyncExternalStore)(CP,()=>wP().open),x=k(Ot),S=k(e=>e.selection?.projectId===`no-project`||e.selection!==null&&Ct(e,e.selection.machine,e.selection.projectId)?.scratch===!0),C=cp(e?.machine??``,i?.status===`online`&&!S?e?.projectId??null:null,x),w=lp({machine:e?.machine??``,projectId:e?.projectId??``,repos:C.repos,onRefresh:C.refresh}),T=t.find(t=>t.machine===e?.machine&&t.id===e.sessionId),E=k(e=>T!==void 0&&e.generatingTitles.includes(P(T.machine,T.id))),D=Ns(e?.machine??``,e?.projectId??``);return or([`meta+backquote`,`ctrl+backquote`],e=>{e.stopPropagation(),MP(!wP().open)},{enableOnFormTags:!0,preventDefault:!0,eventListenerOptions:{capture:!0}}),or([`mod+j`,`mod+shift+b`],e=>{e.stopPropagation(),ZL(se().panel===void 0?d.current:null)},{enableOnFormTags:!0,preventDefault:!0,eventListenerOptions:{capture:!0}}),(0,U.useEffect)(()=>{u!==null&&(d.current=u)},[u]),or([`mod+b`,`mod+shift+j`],()=>o(e=>!e),{enableOnFormTags:!0,preventDefault:!0}),(0,U.useEffect)(()=>{if(n!==null)return;let e=s.current;if(e===null)throw Error(`header is not mounted`);let t=new ResizeObserver(e=>l(e[0].contentRect.width<qL));return t.observe(e),()=>t.disconnect()},[n]),n===null?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(uI,{className:B(`relative`,!a&&`hidden`),mobile:!1,onHide:()=>o(!1)}),!a&&(0,W.jsx)(`div`,{className:`fixed top-0 left-3 z-50 flex h-(--workspace-topbar-height) items-center`,children:(0,W.jsx)(H,{variant:`ghost`,size:`icon-sm`,"aria-label":`Show sidebar`,title:`Show sidebar (${Vt}+B)`,onClick:()=>o(!0),children:(0,W.jsx)(V,{icon:Bn})})}),(0,W.jsxs)(`main`,{className:`bg-background relative flex min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,W.jsxs)(`header`,{ref:s,className:B(`bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-3 pr-3 pl-[3.25rem]`,a&&`pl-5`),children:[e!==null&&i!==null&&(0,W.jsx)(`nav`,{className:`min-w-0 flex-1`,children:(0,W.jsxs)(`ol`,{className:`flex min-w-0 items-center gap-3 text-sm`,children:[(0,W.jsxs)(`li`,{className:`text-icon-muted flex shrink-0 items-center gap-1.5`,children:[(0,W.jsx)(jd,{icon:i.icon,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`max-w-40 truncate`,children:i.name})]}),(0,W.jsx)(`li`,{"aria-hidden":!0,className:`text-icon-muted shrink-0`,children:`/`}),(0,W.jsxs)(`li`,{className:`text-muted-foreground flex min-w-0 shrink items-center gap-1.5 font-medium`,title:`${i.name}:${r}`,children:[(0,W.jsx)(zs,{machine:e.machine,projectId:e.projectId,className:`size-3.5`}),(0,W.jsx)(`span`,{className:`max-w-40 truncate`,children:D})]}),(0,W.jsx)(`li`,{"aria-hidden":!0,className:`text-icon-muted shrink-0`,children:`/`}),(0,W.jsxs)(`li`,{className:B(`text-foreground flex min-w-10 items-center gap-2 font-medium`,a&&`flex-1`),children:[(0,W.jsx)(`span`,{className:B(`truncate`,(E||e.sessionId!==null&&T===void 0)&&`text-shimmer`),children:T?.title??`New thread`}),(0,W.jsx)(Mf,{})]}),!a&&(0,W.jsx)(`li`,{className:`shrink-0`,children:(0,W.jsx)(_F,{hideDone:!0})})]})}),e===null&&!a&&(0,W.jsx)(_F,{hideDone:!0}),e===null&&(0,W.jsx)(`span`,{className:`flex-1`}),i!==null&&i.status!==`online`&&(0,W.jsxs)(`span`,{className:`text-warning-foreground shrink-0 text-xs`,children:[i.status===`connecting`&&`Connecting to ${i.name}…`,i.status===`offline`&&`${i.name} is offline, reconnecting…`,i.status===`unpaired`&&`${i.name} needs pairing`]}),e!==null&&!S&&(0,W.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[!c&&C.repos.length>0&&(0,W.jsx)(fp,{machine:e.machine,projectId:e.projectId,repos:C.repos,onRefresh:C.refresh}),!c&&C.repos.length>0&&(0,W.jsx)(`span`,{className:`bg-foreground/15 mr-1 ml-2.5 h-4 w-px`}),(0,W.jsx)(RL,{selection:e,panel:u,terminal:b,changed:C.repos.some(e=>e.changed>0),onPanel:e=>{p(null),ZL(e)},onTerminal:MP,children:(0,W.jsx)(zL,{selection:e,mobile:!1,session:T,panel:u,terminal:b,changed:C.repos.some(e=>e.changed>0),open:w.menuOpen,onOpenChange:w.setMenuOpen,onPanel:e=>{p(null),ZL(e)},onTerminal:MP,children:c&&C.repos.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(On,{}),(0,W.jsx)(up,{git:w,collapsed:!0})]})})})]})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden`,children:[(0,W.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[i===null&&(0,W.jsx)(eO,{}),e===null&&i!==null&&(0,W.jsx)(`div`,{className:`grid flex-1 place-items-center p-6 text-center`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h1`,{className:`text-foreground text-3xl font-normal tracking-tight`,children:`Pick a thread, or start one`}),(0,W.jsx)(`p`,{className:`text-muted-foreground mt-2 text-sm`,children:`Open a project from the sidebar to talk to Claude.`})]})}),e!==null&&(0,W.jsxs)(U.Fragment,{children:[(0,W.jsx)(bL,{onOpenTask:m}),(0,W.jsx)(Df,{})]},`${e.machine} ${e.sessionId??e.projectId}`)]}),e!==null&&b&&!S&&(0,W.jsxs)(`aside`,{className:`border-border/80 bg-background relative shrink-0 overflow-hidden border-t`,style:{height:v},children:[(0,W.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,className:`group absolute inset-x-0 top-0 z-30 h-1.5 cursor-row-resize touch-none select-none`,onPointerDown:e=>Bt(e,e=>{let t=Math.max(120,Math.floor(window.innerHeight*.8));y(Math.min(t,Math.max(120,window.innerHeight-e.clientY)))}),children:(0,W.jsx)(`span`,{className:`group-hover:bg-border group-active:bg-primary/60 pointer-events-none absolute inset-x-0 top-0 h-px transition-colors`})}),(0,W.jsx)(YF,{view:e.projectId})]})]}),e!==null&&u!==null&&!S&&(0,W.jsxs)(`div`,{className:`relative flex shrink-0`,style:{width:g},children:[(0,W.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,className:`group absolute inset-y-0 -left-1 z-20 w-2 cursor-col-resize select-none`,onPointerDown:e=>Bt(e,e=>{let t=Math.max(360,Math.floor(window.innerWidth*.7)),n=Math.min(t,Math.max(360,window.innerWidth-e.clientX));_(n)}),children:(0,W.jsx)(`span`,{className:`group-hover:bg-border group-active:bg-primary/60 pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`})}),(0,W.jsx)(`div`,{className:`bg-background flex min-w-0 flex-1 flex-col overflow-hidden rounded-tl-lg border-t border-l`,children:(0,W.jsx)(VL,{panel:u,selection:e,cwd:r,running:x,selectedTask:f,onSelectTask:p,onPanel:ZL})})]})]})]}),(0,W.jsx)(dp,{git:w})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(uI,{className:B(`relative`,!a&&`hidden`),mobile:!1,onHide:()=>o(!1)}),(0,W.jsx)(eI,{machine:n,mobile:!1,leading:!a&&(0,W.jsx)(H,{variant:`ghost`,size:`icon-xs`,"aria-label":`Show sidebar`,title:`Show sidebar (${Vt}+B)`,onClick:()=>o(!0),children:(0,W.jsx)(V,{icon:Bn})})})]})}var $L=class extends U.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(e,t.componentStack)}render(){let e=this.state.error;return e===null?this.props.children:(0,W.jsxs)(`div`,{className:`flex h-dvh flex-col items-center justify-center gap-3 p-4 text-center`,children:[(0,W.jsx)(`p`,{className:`font-medium`,children:`Something went wrong`}),(0,W.jsx)(`p`,{className:`text-muted-foreground max-w-xl text-sm whitespace-pre-wrap`,children:e.message}),(0,W.jsx)(H,{onClick:()=>location.reload(),children:`Reload`})]})}},eR=[`typescript`,`tsx`,`javascript`],tR=`import { readFile } from 'node:fs/promises'
|
|
25
25
|
import type { Config } from './config'
|
|
26
26
|
|
|
27
27
|
export interface Entry<T> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{c as t,l as n,t as r}from"./utils-U6QfaJBO.js";import{a as i,d as a,f as o,h as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"./dist-C_Y10kCd.js";import{a as _,i as v,n as y,t as ee}from"./button-CWFREsRn.js";import{Pt as te,t as b}from"./XIcon-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{c as t,l as n,t as r}from"./utils-U6QfaJBO.js";import{a as i,d as a,f as o,h as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"./dist-C_Y10kCd.js";import{a as _,i as v,n as y,t as ee}from"./button-CWFREsRn.js";import{Pt as te,t as b}from"./XIcon-41gae75-.js";var x=e(n(),1),S=Object.defineProperty,C=(e,t)=>S(e,`name`,{value:t,configurable:!0}),w=0,T=null;function ne(e){return E(),e.children}C(ne,`FocusGuards`);function E(){x.useEffect(()=>{T||={start:re(),end:re()};let{start:e,end:t}=T;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),w++,()=>{w===1&&(T?.start.remove(),T?.end.remove(),T=null),w=Math.max(0,w-1)}},[])}C(E,`useFocusGuards`);function re(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}C(re,`createFocusGuard`);var D=function(){return D=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},D.apply(this,arguments)};function ie(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ae(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var O=`right-scroll-bar-position`,k=`width-before-scroll-bar`,oe=`with-scroll-bars-hidden`,se=`--removed-body-scroll-bar-size`;function A(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function ce(e,t){var n=(0,x.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var le=typeof window<`u`?x.useLayoutEffect:x.useEffect,ue=new WeakMap;function de(e,t){var n=ce(t||null,function(t){return e.forEach(function(e){return A(e,t)})});return le(function(){var t=ue.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||A(e,null)}),i.forEach(function(e){r.has(e)||A(e,a)})}ue.set(n,e)},[e]),n}function fe(e){return e}function pe(e,t){t===void 0&&(t=fe);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function me(e){e===void 0&&(e={});var t=pe(null);return t.options=D({async:!0,ssr:!1},e),t}var he=function(e){var t=e.sideCar,n=ie(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return x.createElement(r,D({},n))};he.isSideCarExport=!0;function ge(e,t){return e.useMedium(t),he}var _e=me(),j=function(){},M=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:j,onWheelCapture:j,onTouchMoveCapture:j}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,ee=ie(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),te=f,b=de([n,t]),S=D(D({},ee),i);return x.createElement(x.Fragment,null,u&&x.createElement(te,{sideCar:_e,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?x.cloneElement(x.Children.only(s),D(D({},S),{ref:b})):x.createElement(v,D({},S,{className:c,ref:b}),s))});M.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},M.classNames={fullWidth:k,zeroRight:O};var ve=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function ye(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=ve();return t&&e.setAttribute(`nonce`,t),e}function be(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function xe(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Se=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ye())&&(be(t,n),xe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ce=function(){var e=Se();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},we=function(){var e=Ce();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Te={left:0,top:0,right:0,gap:0},N=function(e){return parseInt(e||``,10)||0},Ee=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[N(n),N(r),N(i)]},De=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Te;var t=Ee(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Oe=we(),P=`data-scroll-locked`,ke=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
2
|
.${oe} {
|
|
3
3
|
overflow: hidden ${r};
|
|
4
4
|
padding-right: ${s}px ${r};
|