@sma1lboy/rove 0.9.286 → 0.9.287-next.221

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/term-mount-BTgAJUtW.js","assets/term-mount-BrP-ENHg.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/term-mount-CdilPGdu.js","assets/term-mount-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
2
  var e=Object.defineProperty,t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(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 r=`rove.bridge.token`;if(typeof window<`u`){let e=new URLSearchParams(window.location.hash.slice(1)).get(`token`);e&&(localStorage.setItem(r,e),history.replaceState(null,``,window.location.pathname+window.location.search))}function i(){return localStorage.getItem(r)}function a(e){localStorage.setItem(r,e)}function o(){localStorage.removeItem(r)}var s=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function te(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function A(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ne(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ne(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+te(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),ne(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+te(a,u),c+=ne(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+te(a,u++),c+=ne(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ne(A(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function j(e,t,n){if(e==null)return e;var r=[],i=0;return ne(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function M(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},P={map:j,forEach:function(e,t,n){j(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return j(e,function(){t++}),t},toArray:function(e){return j(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=P,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:M}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,N)}catch(e){N(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),c=t(((e,t)=>{t.exports=s()})),l=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&&te(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&&te(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,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function te(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,te(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}}}})),u=t(((e,t)=>{t.exports=l()})),d=t((e=>{var t=c();function n(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 r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),f=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=d()})),p=t((e=>{var t=u(),n=c(),r=f();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){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n: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 l(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 d(e){if(o(e)!==e)throw Error(i(188))}function p(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 d(a),e;if(s===r)return d(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.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 m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),ee=Symbol.for(`react.memo_cache_sentinel`),te=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=te&&e[te]||e[`@@iterator`],typeof e==`function`?e:null)}var ne=Symbol.for(`react.client.reference`);function j(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?j(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}var M=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},ie=[],ae=-1;function oe(e){return{current:e}}function F(e){0>ae||(e.current=ie[ae],ie[ae]=null,ae--)}function I(e,t){ae++,ie[ae]=e.current,e.current=t}var se=oe(null),L=oe(null),ce=oe(null),le=oe(null);function ue(e,t){switch(I(ce,t),I(L,e),I(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}F(se),I(se,e)}function de(){F(se),F(L),F(ce)}function fe(e){e.memoizedState!==null&&I(le,e);var t=se.current,n=Wd(t,e.type);t!==n&&(I(L,e),I(se,n))}function pe(e){L.current===e&&(F(se),F(L)),le.current===e&&(F(le),ep._currentValue=re)}var me,he;function ge(e){if(me===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);me=t&&t[1]||``,he=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+me+e+he}var _e=!1;function ve(e,t){if(!e||_e)return``;_e=!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}e.call(n.prototype)}}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(`
@@ -13,10 +13,10 @@ Error generating stack: `+e.message+`
13
13
  This worktree is at the PR's head ({head}, going into {base}). Read the change against {base} (git diff origin/{base}...HEAD), then tell me what you find: bugs, risks, missing tests, anything unclear. Do not push, comment on or approve the PR; report here.`}},st={reviewQueue:{sourceIssues:`[ 议题 ]`,sourceReviews:`[ 等我评审的 PR ]`,palette:`评审队列`,title:`等我评审的 PR`,empty:`你的项目里没有等你评审的 PR。`,other:`另有 {count} 个在 Rove 不认识的项目里。`,draft:`草稿`,fork:`fork`,checksPassing:`检查通过`,checksFailing:`检查未通过`,checksPending:`检查进行中`,start:`[ 评审 ]`,preparing:`正在获取 #{number}…`,failed:`无法开始评审 #{number}:{error}`,gh:{missing:"没有安装 `gh` 命令行,或不在 PATH 中。",unauthenticated:"`gh` 未登录:请在这台 Mac 上运行 `gh auth login`。",failed:`暂时读不到 GitHub。按 r 重试。`},prompt:`评审 {repo} 的拉取请求 #{number}:{title}
14
14
  {url}
15
15
 
16
- 这个 worktree 在该 PR 的头部({head},合入 {base})。对照 {base} 阅读改动(git diff origin/{base}...HEAD),然后告诉我你的发现:bug、风险、缺失的测试、不清楚的地方。不要推送、评论或批准这个 PR;在这里汇报。`}},ct=n({en:()=>lt,zh:()=>ut}),lt={runLog:{title:`Runs`,all:`all`,outcome:{ok:`ok`,blocked:`blocked`,failed:`failed`,skipped:`skipped`},source:{schedule:`schedule`,manual:`manual`,webhook:`webhook`},blocked:{"task-missing":`task is gone`,"awaiting-owner":`waiting on a decision`,"report-missing":`last run never reported`,quota:`rate limited`,"engine-error":`engine error`,"engine-dead":`engine stopped`,"awaiting-permission":`waiting on a permission`,busy:`still working`},blockedRun:`blocked: {reason}`,empty:`No runs match.`,more:`+{count} more`}},ut={runLog:{title:`运行记录`,all:`全部`,outcome:{ok:`成功`,blocked:`受阻`,failed:`失败`,skipped:`跳过`},source:{schedule:`定时`,manual:`手动`,webhook:`Webhook`},blocked:{"task-missing":`任务已不存在`,"awaiting-owner":`等你做决定`,"report-missing":`上次运行没有汇报`,quota:`触发限流`,"engine-error":`引擎出错`,"engine-dead":`引擎已停止`,"awaiting-permission":`等你授权`,busy:`仍在运行`},blockedRun:`受阻:{reason}`,empty:`没有符合条件的运行。`,more:`另有 {count} 条`}},dt=n({en:()=>ft,zh:()=>pt}),ft={settings:{title:`Settings`,open:`settings`,sections:{connectors:`Connectors`,appearance:`Appearance`,notifications:`Notifications`,snippets:`Snippets`,about:`About`,voice:`Voice`},groups:{preferences:`Preferences`,agents:`Agents and tools`,more:`More`},pages:{general:`Language, layout, and where Rove opens files and creates worktrees.`,appearance:`Theme, colours, and how tasks and panes look.`,notifications:`When Rove tells you a task finished or needs you.`,keys:`Rebind chords in your own file, and how the prefix guide behaves.`,engines:`The coding agents Rove can start, and how it plugs into them.`,autoRouting:`What each depth tier starts, and who picks the tier.`,voice:`Dictation: the recognizer that turns what you say into prompts.`,connectors:`Accounts Rove uses, here and on your other machines.`,plugins:`Built-in pages and registered plugins.`,about:`Versions, updates, and this browser.`,feedback:`Send a note to the Rove team.`,dev:`Experimental switches, restarts and resets.`,snippets:`Prompt text you reuse. Type @name in a prompt to insert it.`},connectors:{githubDescription:`Clone, push and open PRs on every machine with one GitHub account`,connect:`Connect`,disconnect:`Disconnect`,disconnectBody:`Signs this machine's gh out of GitHub, for every tool that uses gh and not only Rove. Other machines keep their own sign-ins.`,machines:`Machines`,thisMachine:`This machine`,machinesHint:`Each machine signs in to GitHub by itself. The mark says whether it uses the same account as this one.`,refresh:`Check again`,refreshing:`Checking…`,useRove:`Use Rove's account`,loginThere:`Log in there`,codeHint:`Enter this code at GitHub (click the code to copy it)`,openGithub:`Open github.com/login/device`,codeCopied:`Code copied`,syncing:`Signed in. Bringing the other machines along…`,loginFailed:`Sign-in failed: {error}`,dismiss:`Dismiss`,loading:`checking…`,markSame:`✓ same account`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ signed out`,markNoGh:`gh is not installed`,markOutdated:`Rove there is outdated`,markOffline:`offline`,markDenied:`refuses credential changes`,markFailed:`could not check`,detail:`git over {protocol} · SSH key {ssh}`,synced:`{machine} now uses @{login}`},general:{groupInterface:`Interface`,groupFiles:`Worktrees`,groupTerminal:`Terminal`,tabStrip:`Tab strip`,scrollback:`Scrollback`},appearance:{groupColours:`Colours`,groupTasks:`Tasks and panes`,taskColorsNote:`Gives each task its own hue on the working border and in the list.`,colorblindNote:`Shows added and removed lines in blue and red instead of green and red.`,workingBorderNote:`The pane's border while the selected task is working.`,railGroup:`Task list`,railGroupProject:`By project`,railGroupState:`By state`,statusMark:`Task status`,statusMarkEngine:`Engine icon`,statusMarkBoth:`Icon and dots`,statusMarkDots:`Dots only`,previewWorking:`Working`,previewDone:`Finished, unread`,previewIdle:`Idle`,previewWaiting:`Waiting for you`,previewBroken:`Broken`,previewTitle:`Fix the login redirect`},notifications:{toastNote:`A popup in the corner of this page.`,volume:`Chime volume`},about:{groupRove:`Rove`,daemon:`Daemon`,daemonCurrent:`rove {version}, same build as this page`,daemonStale:"rove {version} is out of date; run `rove daemon restart`",updates:`Updates`,browser:`This browser`,browserHint:`Forget this browser's token. A login token is revoked on the host too.`,access:`Access`,signIn:`Sign-in`,signInMode:{open:`None`,password:`Password`,token:`Token link`},signInHint:{open:`A browser on this computer opens Rove with no link or password. Phones and other computers still need a token.`,password:`A browser without a token signs in with the password. Token links keep working.`,token:`Only the link rove printed, or a device token, gets in. Password sign-in is off.`},passwordSet:`Set a password`,passwordChange:`Change the password`,passwordHint:`At least {min} characters. It is stored hashed on this computer.`,passwordField:`New password`,passwordSave:`Save`,signOut:`Sign out`},engines:{enabled:`Offer {name} when picking an engine`,default:`Make {name} the default engine`,namePlaceholder:`Display name (blank = default)`,rename:`Rename`,reset:`Reset to defaults`,remove:`Remove engine`,save:`Save`,cancel:`Cancel`},plugins:{builtIn:`Built in`,builtInHint:`First-party pages. Turning one off removes its entry from the rail.`,registered:`Registered plugins`,empty:`No other plugins registered.`,linked:`linked`,unsupportedPlatform:`unsupported platform`,turnOn:`Install {name}`},feedback:{hint:"Files a public GitHub issue on the Rove repo, through `gh` on the machine running rove. Without a signed-in `gh` you get a prefilled link to open instead.",kindLabel:`Kind`,kindBug:`Bug`,kindIdea:`Idea`,kindQuestion:`Question`,titleLabel:`Title`,body:`What happened`,send:`File issue`,sent:`Filed issue #{number}`,notFiled:`Not filed yet. {hint}`,openLink:`Open the prefilled issue`,report:`Report a problem with an agent`,reportNote:`An agent asks what went wrong, drafts the issue with you and files it.`,reportFailed:`Could not start the conversation.`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`."}},prefs:{languageHint:`Display language, shared with the TUI.`,soundHint:`chime, plus a desktop notification while this tab is in the background`,soundVolumeHint:`Plays the new level when you pick it.`,push:`Notify when this page is closed`,pushHint:`This browser gets a notification when a task finishes, needs you or fails, even with no Rove page open. Follows the cross-task switch.`,pushUnsupported:`This browser can't receive push here: it needs https (or localhost), and on iPhone/iPad the page added to the home screen.`,pushBlocked:`Notifications are blocked for this site; allow them in the browser's site settings.`,pushFailed:`Couldn't turn it on: {error}`,zenHint:`Hide the Files pane. The zen chip and ctrl+a z toggle it and write this same setting.`,editInTui:`Edit it in the TUI.`,tierModel:`model`,tierEdit:`Edit`,tierEffort:`Reasoning effort`,classifierConnection:`Classifier connection`,unset:`(none)`,modeAuto:`Auto (follow the browser)`,themePreviewHint:`Point at a theme to see this page in it; click to keep it. The TUI follows.`,themeUser:`yours`,themeInstalled:`Installed`,themeMoreHint:`Not installed yet: point to preview, click to install and switch.`,themeBrowse:`Browse {count} more from rove.run`,themeHide:`Hide themes from rove.run`,themeGet:`get`,themeInstalling:`installing…`,themeInstallFailed:`failed, retry`,themeAgent:`Make one with an agent`,themeAgentHint:`opens a Scratch session; reopen Settings to see what it wrote.`,themeAgentFailed:`couldn't open the session; try again.`,themeAgentPrompt:"Make me a new Rove color theme. Ask me first what look I want, unless I already said. Save it as one JSON file in {dir} (for example {dir}/my-theme.json); the file name is the theme's name. The format is in https://github.com/sma1lboy/rove/blob/main/docs/themes.md and the JSON schema is https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json. Start from https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json, give each color slot a { dark, light } pair, and keep text readable on every background. When it's saved, run `rove theme list` to check it loads, then tell me the name: it appears in Settings → Appearance.",resetButton:`Reset`,resetHint:`Clears this Mac's saved settings and task list, restarts the Rove daemon, then reloads this page. Worktrees on disk and engine session history are not touched.`,resetBody:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json and restarts the daemon, then reloads this page with an empty task list. Worktrees on disk and engine session history are NOT touched.`,restartButton:`Restart`,restartHint:`Stops the Rove daemon and starts a fresh one; this page reconnects on its own. Running engine sessions live in the PTY host and survive it.`,restartBody:`Stops the Rove daemon and starts a fresh one, picking up daemon edits. This page reconnects in a few seconds. Running engine sessions survive.`,keysYaml:`The file is read on the Mac; changes apply when you come back to this page.`},keys:{editHint:`Click a key to record a new one, then press the key you want. To put it behind the prefix, press the prefix key first. The × removes it.`,reset:`Reset`,recordFor:`Record a key for {name}`,removeFor:`Remove the key for {name}`,pluginNoTask:`Select a task before using a plugin chord.`,pluginChords:`Plugin chords`,agent:`Change them with an agent`,agentHint:`opens a Scratch session; reopen Settings to see what it changed.`,agentFailed:`couldn't open the session; try again.`,agentPrompt:"Change my Rove keybindings. Ask me first what I want changed, unless I already said. Edit {path} (create it if it is missing; keep existing entries and comments you were not asked to change). The format, every binding id and its default chord are in https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md (see Customizing). Only use binding ids listed there; a direct override replaces that binding's whole chord list, and null unbinds. The file must stay valid YAML: check it parses (for example with `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}` or any YAML parser you have). Rove reloads it live, and unknown ids or invalid chords are ignored with a warning, so when you are done tell me what you changed and ask me to reopen Settings → Keybindings: it lists every applied override and every warning."},pages:{attachTooLarge:`{name} is larger than 500 MB`,new:`[ new ]`,routinePause:`[ pause ]`,routineEnable:`[ enable ]`,delete:`[ delete ]`,routinesNeedYou:`NEEDS YOU`,routinesActive:`ACTIVE`,routinesPaused:`PAUSED`,laterStarts:`LATER`,laterCancel:`[ cancel ]`,laterFailed:`Did not start: {error}`,laterCancelFailed:`Could not cancel the start: {error}`,routineSchedule:`Schedule`,routineNext:`Next run`,routineProject:`Project`,routineDelivers:`Delivers to`,routineEngine:`Engine`,routineChangeEngine:`[ change ]`,routinePrompt:`PROMPT`,routineScript:`SCRIPT`,cronDown:`Decrease {field}`,cronUp:`Increase {field}`,storySave:`save`,storySaveStart:`save & start`,storyStart:`start`,attachHintTouch:`paste a path / a screenshot → inserts an image placeholder`}},pt={settings:{title:`设置`,open:`设置`,sections:{connectors:`连接器`,appearance:`外观`,notifications:`通知`,snippets:`片段`,about:`关于`,voice:`语音`},groups:{preferences:`偏好`,agents:`智能体与工具`,more:`更多`},pages:{general:`语言、布局,以及 Rove 在哪里打开文件、创建 worktree。`,appearance:`主题、颜色,以及任务和面板的外观。`,notifications:`任务完成或需要你时,Rove 怎么提醒。`,keys:`在你自己的文件里重绑快捷键,以及前缀引导的行为。`,engines:`Rove 能启动的编码智能体,以及它如何接入它们。`,autoRouting:`每个深度档位启动什么,以及由谁选择档位。`,voice:`口述:把你说的话变成提示词的识别器。`,connectors:`Rove 使用的账号,本机和你的其他机器。`,plugins:`内置页面和已注册的插件。`,about:`版本、更新,以及此浏览器。`,feedback:`给 Rove 团队留一条意见。`,dev:`实验开关、重启和重置。`,snippets:`常用的提示词文本。在提示词里输入 @名称 即可插入。`},connectors:{githubDescription:`用同一个 GitHub 账号在每台机器上克隆、推送和开 PR`,connect:`连接`,disconnect:`断开`,disconnectBody:`把这台机器的 gh 从 GitHub 退出登录,所有用 gh 的工具都会受影响,不只是 Rove。其他机器保持各自的登录。`,machines:`机器`,thisMachine:`本机`,machinesHint:`每台机器各自登录 GitHub。右边的标记表示它和本机用的是不是同一个账号。`,refresh:`重新检查`,refreshing:`检查中…`,useRove:`使用 Rove 的账号`,loginThere:`在那里登录`,codeHint:`到 GitHub 输入这个验证码(点击验证码可复制)`,openGithub:`打开 github.com/login/device`,codeCopied:`验证码已复制`,syncing:`已登录,正在同步其他机器…`,loginFailed:`登录失败:{error}`,dismiss:`关闭`,loading:`检查中…`,markSame:`✓ 同一账号`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ 未登录`,markNoGh:`未安装 gh`,markOutdated:`那边的 Rove 版本过旧`,markOffline:`离线`,markDenied:`拒绝修改凭据`,markFailed:`无法检查`,detail:`git 走 {protocol} · SSH 密钥 {ssh}`,synced:`{machine} 现在使用 @{login}`},general:{groupInterface:`界面`,groupFiles:`Worktree`,groupTerminal:`终端`,tabStrip:`标签栏`,scrollback:`回滚行数`},appearance:{groupColours:`颜色`,groupTasks:`任务与面板`,taskColorsNote:`让每个任务在工作边框和列表里有自己的色调。`,colorblindNote:`新增和删除的行用蓝色和红色,而不是绿色和红色。`,workingBorderNote:`所选任务工作时,面板边框的样子。`,railGroup:`任务列表`,railGroupProject:`按项目`,railGroupState:`按状态`,statusMark:`任务状态`,statusMarkEngine:`引擎图标`,statusMarkBoth:`图标加点阵`,statusMarkDots:`只有点阵`,previewWorking:`正在跑`,previewDone:`完成未读`,previewIdle:`空闲`,previewWaiting:`等你回答`,previewBroken:`出错`,previewTitle:`修复登录跳转`},notifications:{toastNote:`本页角落里的弹出提示。`,volume:`提示音音量`},about:{groupRove:`Rove`,daemon:`守护进程`,daemonCurrent:`rove {version},与本页同一版本`,daemonStale:"rove {version} 版本过旧;运行 `rove daemon restart`",updates:`更新`,browser:`此浏览器`,browserHint:`忘掉此浏览器的令牌。登录得到的令牌也会在主机上吊销。`,access:`访问`,signIn:`登录方式`,signInMode:{open:`免登录`,password:`密码`,token:`Token 链接`},signInHint:{open:`本机浏览器不用链接或密码就能打开 Rove。手机和其他电脑仍然需要 token。`,password:`没有 token 的浏览器用密码登录。Token 链接照常可用。`,token:`只有 rove 打印的链接或设备 token 能进。密码登录关闭。`},passwordSet:`设置密码`,passwordChange:`修改密码`,passwordHint:`至少 {min} 个字符。以哈希形式存在本机。`,passwordField:`新密码`,passwordSave:`保存`,signOut:`退出登录`},engines:{enabled:`选引擎时列出 {name}`,default:`把 {name} 设为默认引擎`,namePlaceholder:`显示名称(留空 = 默认)`,rename:`重命名`,reset:`恢复默认`,remove:`移除引擎`,save:`保存`,cancel:`取消`},plugins:{builtIn:`内置`,builtInHint:`官方页面。关掉后,它在侧栏的入口会消失。`,registered:`已注册的插件`,empty:`没有其他已注册的插件。`,linked:`已链接`,unsupportedPlatform:`平台不支持`,turnOn:`安装 {name}`},feedback:{hint:"通过运行 rove 那台机器上的 `gh`,在 Rove 仓库提一个公开的 GitHub issue。没有登录 `gh` 时会给你一条预填好的链接。",kindLabel:`类型`,kindBug:`缺陷`,kindIdea:`想法`,kindQuestion:`问题`,titleLabel:`标题`,body:`发生了什么`,send:`提交 issue`,sent:`已提交 issue #{number}`,notFiled:`还没提交。{hint}`,openLink:`打开预填好的 issue`,report:`让 agent 帮我报告问题`,reportNote:`由 agent 问清哪里不对,和你一起起草 issue 并提交。`,reportFailed:`没能开始对话。`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。"}},prefs:{languageHint:`显示语言,与 TUI 共用同一设置。`,soundHint:`提示音;本页在后台时另发桌面通知`,soundVolumeHint:`选中后会播放新音量。`,push:`页面关闭时也通知`,pushHint:`任务完成、需要你或出错时,即使没有打开任何 Rove 页面,这个浏览器也会收到通知。跟随「跨任务通知」开关。`,pushUnsupported:`这个浏览器在这里收不到推送:需要 https(或 localhost),iPhone/iPad 上还要先把页面添加到主屏幕。`,pushBlocked:`这个网站的通知被浏览器屏蔽了,去浏览器的网站设置里允许。`,pushFailed:`没能开启:{error}`,zenHint:`收起文件栏。zen 按钮和 ctrl+a z 切换时会写入同一个设置。`,editInTui:`请在 TUI 中编辑`,tierModel:`模型`,tierEdit:`编辑`,tierEffort:`推理强度`,classifierConnection:`分类器连接`,unset:`(无)`,modeAuto:`自动(跟随浏览器)`,themePreviewHint:`鼠标指向一个主题,整页就换成它看看;点一下就定下来。TUI 也会跟着换。`,themeUser:`自装`,themeInstalled:`已安装`,themeMoreHint:`尚未安装:指向即预览,点一下安装并切换。`,themeBrowse:`浏览 rove.run 上的另外 {count} 个主题`,themeHide:`收起 rove.run 的主题`,themeGet:`安装`,themeInstalling:`安装中…`,themeInstallFailed:`失败,重试`,themeAgent:`让 agent 做一个`,themeAgentHint:`会开一个 Scratch 会话;做好后重新打开设置就能看到。`,themeAgentFailed:`会话没打开,再试一次。`,themeAgentPrompt:"帮我做一个新的 Rove 配色主题。先问我想要什么风格,除非我已经说过。把它存成 {dir} 下的一个 JSON 文件(比如 {dir}/my-theme.json),文件名就是主题名。格式说明见 https://github.com/sma1lboy/rove/blob/main/docs/themes.md,JSON schema 是 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json。以 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json 为起点,每个颜色槽都给 { dark, light } 两个值,并保证文字在每种背景上都看得清。存好后运行 `rove theme list` 确认能加载,然后告诉我主题名:它会出现在 设置 → 外观 里。",resetButton:`重置`,resetHint:`清空这台 Mac 上保存的设置和任务列表,重启 Rove 守护进程,然后刷新本页。磁盘上的工作树和引擎会话历史不受影响。`,resetBody:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并重启守护进程,然后刷新本页,任务列表为空。磁盘上的工作树和引擎会话历史不会被动。`,restartButton:`重启`,restartHint:`停止 Rove 守护进程并启动新的进程,本页会自动重连。运行中的引擎会话在 PTY 宿主里,不受影响。`,restartBody:`停止 Rove 守护进程并启动新的进程,载入守护进程的改动。本页几秒后自动重连,运行中的引擎会话不受影响。`,keysYaml:`该文件在 Mac 上读取,改动会在你回到本页时生效。`},keys:{editHint:`点一个按键开始录入,再按你想要的键。想放到 prefix 后面,就先按 prefix 键。× 是删掉它。`,reset:`恢复默认`,recordFor:`为「{name}」录入按键`,removeFor:`删掉「{name}」的按键`,pluginNoTask:`使用插件快捷键前请先选中一个任务。`,pluginChords:`插件快捷键`,agent:`让 agent 来改`,agentHint:`会开一个 Scratch 会话;改好后重新打开设置就能看到。`,agentFailed:`会话没打开,再试一次。`,agentPrompt:"帮我改 Rove 的快捷键。先问我想改什么,除非我已经说过。编辑 {path}(不存在就新建;没让你改的条目和注释都保留)。格式、每个 binding id 及其默认按键见 https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md(Customizing 一节)。只用那里列出的 binding id;直接覆盖会替换该 binding 的整个按键列表,null 表示解绑。文件必须保持合法 YAML:确认它能解析(比如 `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}`,或任何你有的 YAML 解析器)。Rove 会实时重新加载它,未知 id 或无效按键会被忽略并给出警告,所以改完后告诉我改了什么,并请我重新打开 设置 → 快捷键:那里会列出所有生效的覆盖和所有警告。"},pages:{attachTooLarge:`{name} 超过 500 MB`,new:`[ 新建 ]`,routinePause:`[ 暂停 ]`,routineEnable:`[ 启用 ]`,delete:`[ 删除 ]`,routinesNeedYou:`需要处理`,routinesActive:`运行中`,routinesPaused:`已暂停`,laterStarts:`稍后启动`,laterCancel:`[ 取消 ]`,laterFailed:`没有启动:{error}`,laterCancelFailed:`取消失败:{error}`,routineSchedule:`调度`,routineNext:`下次执行`,routineProject:`项目`,routineDelivers:`投递到`,routineEngine:`引擎`,routineChangeEngine:`[ 更换 ]`,routinePrompt:`提示词`,routineScript:`脚本`,cronDown:`减小{field}`,cronUp:`增大{field}`,storySave:`保存`,storySaveStart:`保存并启动`,storyStart:`启动`,attachHintTouch:`粘贴路径 / 截图 → 插入图片占位行`}},mt=n({en:()=>ht,zh:()=>gt}),ht={transcript:{you:`You`,agent:`Agent`,system:`System`,copy:`[ copy ]`,copied:`Copied`,export:`[ export .md ]`,findPlaceholder:`Find in this conversation`,findCount:`{at} / {total}`,findNone:`no match`,prev:`[ prev ]`,next:`[ next ]`,older:`[ load earlier ]`,loading:`Reading the conversation…`,empty:`Nothing said yet.`,failed:`failed`,error:`Could not read the conversation: {error}`,retry:`[ retry ]`,noHistory:`This engine keeps no history Rove can read. Showing its terminal tail.`,tail:`Terminal tail`}},gt={transcript:{you:`你`,agent:`智能体`,system:`系统`,copy:`[ 复制 ]`,copied:`已复制`,export:`[ 导出 .md ]`,findPlaceholder:`在这段对话中查找`,findCount:`{at} / {total}`,findNone:`没有匹配`,prev:`[ 上一个 ]`,next:`[ 下一个 ]`,older:`[ 加载更早 ]`,loading:`正在读取对话…`,empty:`还没有对话内容。`,failed:`失败`,error:`读不到这段对话:{error}`,retry:`[ 重试 ]`,noHistory:`这个引擎没有 Rove 能读取的历史记录,显示的是它的终端末尾。`,tail:`终端末尾`}},_t=n({en:()=>vt,zh:()=>yt}),vt={usage:{title:`Usage`,open:`Open usage`,range:`last {days} days · tokens are input + output`,perDay:`Per day`,byModel:`By engine and model`,topTasks:`Top tasks`,quota:`Quota`,turns:`{count} turns`,loading:`Loading…`,empty:`No turns recorded in this window.`,failed:`Could not read usage: {error}`,cutoff:`The daemon returns at most {count} turns: {day} and earlier are partial.`,noReader:`{engines}: no turn reader, so their work is not counted here.`,removedTask:`(removed task)`,full:`{engine} {label} {percent}% · at this pace full around {time}, before it resets`,lasts:`{engine} {label} {percent}% · at this pace it lasts until the reset`,window:`{engine} {label} {percent}%`}},yt={usage:{title:`用量`,open:`打开用量`,range:`最近 {days} 天 · token 为输入加输出`,perDay:`按天`,byModel:`按引擎和模型`,topTasks:`用量最高的任务`,quota:`额度`,turns:`{count} 轮`,loading:`加载中…`,empty:`这段时间没有记录到任何一轮。`,failed:`无法读取用量:{error}`,cutoff:`守护进程最多返回 {count} 轮:{day} 及更早的数据不完整。`,noReader:`{engines}:没有轮次读取器,这里不统计它们的工作。`,removedTask:`(已删除的任务)`,full:`{engine} {label} {percent}% · 按当前速度约 {time} 用完,早于重置时间`,lasts:`{engine} {label} {percent}% · 按当前速度可撑到重置`,window:`{engine} {label} {percent}%`}},bt=n({en:()=>xt,zh:()=>St}),xt={voice:{say:`Say`,stop:`Stop {time}`,release:`Release {time}`,working:`Hearing…`,hint:`Dictate: tap to start and stop, or hold to talk and let go`,slideToSend:`Slide up to send`,tipSend:`Let go to send`,hold:`Hold to talk`,holdOrType:`Hold to talk, tap to type`,learned:`Learned {pairs}`,learnedPair:`{spoken} → {term}`,undo:`undo`,unlearned:`Forgotten`,unlearnFailed:`Couldn't undo: the voice sidecar isn't answering`,setup:{dictation:`Dictation`,backend:{off:`Off`,local:`On this Mac`,cloud:`Cloud`},unavailable:`This Rove cannot set up dictation`,offHint:`The mic is hidden. Nothing runs in the background.`,localNeeded:`Install the model below; the mic shows once it is ready.`,localInstalling:`Installing the model; the mic shows once it is ready.`,cloudNeeded:`Save an endpoint below to turn dictation on.`,ready:`{model} · ready`,starting:`Starting…`,localTitle:`Whisper large-v3`,localHint:`Runs on this Mac's GPU, about 3.5 GB to download. Audio never leaves the Mac.`,install:`Install`,installing:`Installing…`,installed:`Installed, about 4 GB on disk.`,failed:`Install failed: {line}`,uninstall:`Uninstall`,uninstallAsk:`Remove the model?`,cancel:`Cancel`,cloudTitle:`Cloud endpoint`,cloudHint:`Any OpenAI-compatible /audio/transcriptions service. The audio and your terms go there; the key stays on the Mac.`,baseURL:`Base URL`,model:`Model`,apiKey:`API key`,keySaved:`Saved; leave empty to keep it`,save:`Save`,saveAndUse:`Save and use`,forget:`Forget`,forgetAsk:`Remove the endpoint and its key?`}}},St={voice:{say:`说`,stop:`停 {time}`,release:`松手 {time}`,working:`在听…`,hint:`口述:点一下开始、再点一下结束,或按住说话、松手结束`,slideToSend:`上滑发送`,tipSend:`松手发送`,hold:`按住说话`,holdOrType:`按住说话,轻点打字`,learned:`记住了 {pairs}`,learnedPair:`{spoken} → {term}`,undo:`撤销`,unlearned:`已撤销`,unlearnFailed:`没能撤销:语音服务没有响应`,setup:{dictation:`语音输入`,backend:{off:`关闭`,local:`本机`,cloud:`云端`},unavailable:`这个 Rove 无法设置语音输入`,offHint:`不显示麦克风,后台也不运行任何东西。`,localNeeded:`在下面安装模型,就绪后显示麦克风。`,localInstalling:`正在安装模型,就绪后显示麦克风。`,cloudNeeded:`在下面保存一个服务地址后开启。`,ready:`{model} · 就绪`,starting:`启动中…`,localTitle:`Whisper large-v3`,localHint:`在这台 Mac 的 GPU 上运行,约需下载 3.5 GB。音频不离开这台 Mac。`,install:`安装`,installing:`安装中…`,installed:`已安装,约占 4 GB 磁盘。`,failed:`安装失败:{line}`,uninstall:`卸载`,uninstallAsk:`删除模型?`,cancel:`取消`,cloudTitle:`云端服务`,cloudHint:`任何兼容 OpenAI /audio/transcriptions 的服务。音频和你的术语会发到那里;密钥只存在这台 Mac 上。`,baseURL:`Base URL`,model:`模型`,apiKey:`API 密钥`,keySaved:`已保存;留空则保留原密钥`,save:`保存`,saveAndUse:`保存并使用`,forget:`删除`,forgetAsk:`删除这个服务地址和密钥?`}}},Ct=n({en:()=>wt,zh:()=>Tt}),wt={workspace:{pickTask:`pick a task on the left`,noTabs:`no open sessions in this task`,startEngine:`Start {engine}`,startSession:`Start session`,tabNotLive:`this tab has no running session`,restored:`restored session, read-only until reopened`,exited:`session ended (exit {code})`,attachFailed:`could not open this session: {message}`,reopen:`Reopen session`,reopening:`Reopening…`,reopenFailed:`could not reopen this session: {message}`,engineExited:`engine exited (code {code})`,retry:`Retry`,engineSettings:`Settings → Engines`,usageLimitUntil:`usage limit reached — rove resumes this task at {time}`,resumeQuota:`resume now`,resumingQuota:`resuming…`,usageLimit:`usage limit reached`,dismiss:`Dismiss`},tab:{shell:`shell`,engine:`engine`},firstRun:{title:`All your coding agents, in one place`,body:`When one runs out of quota, switch the task to another. Agents talk to each other directly, and every task gets its own worktree and branch.`,start:`Start your first task`},status:{connecting:`connecting`,retrying:`reconnecting, attempt {count}`,retry:`retry now`,backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},connect:{title:`open the link rove printed`,body:"Run `rove --web` and open the link it prints, or paste it here.",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`connect`,invalid:"that is not a `rove --web` link",failing:"can't reach rove. Is `rove --web` still running? After `--rotate-token`, open the new link.",forget:`forget this link`,notConnected:`not connected to rove — reconnecting (the view refreshes on its own)`},relay:{unpaired:"open the relay link that `rove --web --preset relay` printed on your computer",connecting:`connecting to your computer through the relay…`,loading:`loading rove…`,offline:"your computer is not answering on this relay. Is `rove --web --preset relay` still running? After `--rotate-relay`, open the new link. Reload to retry.",failed:`can't reach your computer through the relay ({error}). Reload to retry.`},login:{title:`sign in`,body:`Enter this Rove's password.`,field:`password`,submit:`sign in`,checking:`checking…`,wrong:`that did not work`,locked:`too many tries from here; try again in {minutes} min`,lockedHost:"password login is locked; run `rove --web --unlock` on the host",unreachable:"can't reach rove. Is `rove --web` still running?"},layout:{splitTooSmall:`Not enough room to split here`,railFold:`Fold the task list`,navBack:`Back`,navForward:`Forward`,railUnfold:`Unfold the task list`,dropUploading:`Uploading {name}…`,pasteNoImage:`No image on this browser's clipboard`,pasteNoAccess:`Can't read this browser's clipboard: {error}`,pasteNeedsHttps:`the page needs https or localhost`,refreshTimeout:"The daemon did not come back on the new build in time; check `rove daemon status`",railResize:`Drag to resize the task list, click to fold it, double-click to reset`,composerPlaceholder:`Message the agent`,composerSend:`Send`,composerAttach:`Attach a file`,composerNotSent:`Not sent: {reason}`,composerOldBridge:`This Mac's rove --web is older than this page; restart it to send from here.`,composerAtMenu:`The agent is waiting on a choice. Answer it with the 1–4 and ⏎ keys below; your message is kept.`,termKeys:`Terminal keys`,termKeyUp:`Up arrow`,termKeyDown:`Down arrow`,termKeyLeft:`Left arrow`,termKeyRight:`Right arrow`,termKeyInterrupt:`Ctrl+C, interrupt`,termKeyEnter:`Enter`,narrowTerminal:`Terminal`}},Tt={workspace:{pickTask:`从左边选一个任务`,noTabs:`这个任务没有打开的会话`,startEngine:`启动 {engine}`,startSession:`启动会话`,tabNotLive:`这个标签没有在运行的会话`,restored:`已恢复的会话,重新打开前只读`,exited:`会话已结束(退出码 {code})`,attachFailed:`打不开这个会话:{message}`,reopen:`重新打开会话`,reopening:`正在重新打开…`,reopenFailed:`重新打开失败:{message}`,engineExited:`引擎已退出(退出码 {code})`,retry:`重试`,engineSettings:`设置 → 引擎`,usageLimitUntil:`已达到用量上限 —— rove 会在 {time} 自动继续这个任务`,resumeQuota:`现在继续`,resumingQuota:`正在继续…`,usageLimit:`已达到用量上限`,dismiss:`忽略`},tab:{shell:`终端`,engine:`引擎`},firstRun:{title:`所有编程 agent,都在一个地方`,body:`一个额度用完了,换另一个接着干;agent 之间直接对话。每个任务有独立的 worktree 和分支,互不覆盖。`,start:`开始第一个任务`},status:{connecting:`连接中`,retrying:`重连中,第 {count} 次`,retry:`立即重试`,backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},connect:{title:`打开 rove 打印的链接`,body:"运行 `rove --web`,打开它打印的链接,或者把链接粘贴到这里。",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`连接`,invalid:"这不是 `rove --web` 打印的链接",failing:"连不上 rove。`rove --web` 还在运行吗?用过 `--rotate-token` 的话,请打开新的链接。",forget:`忘掉这个链接`,notConnected:`没有连上 rove,正在重连(连上后这里会自动刷新)`},relay:{unpaired:"打开电脑上 `rove --web --preset relay` 打印的 relay 链接",connecting:`正在通过 relay 连接你的电脑…`,loading:`正在加载 rove…`,offline:"你的电脑没有在这个 relay 上应答。`rove --web --preset relay` 还在运行吗?用过 `--rotate-relay` 的话,请打开新的链接。刷新重试。",failed:`无法通过 relay 连到你的电脑({error})。刷新重试。`},login:{title:`登录`,body:`输入这台 Rove 的密码。`,field:`密码`,submit:`登录`,checking:`验证中…`,wrong:`登录失败`,locked:`这里尝试次数过多;{minutes} 分钟后再试`,lockedHost:"密码登录已锁定;在主机上运行 `rove --web --unlock`",unreachable:"连不上 rove。`rove --web` 还在运行吗?"},layout:{splitTooSmall:`这里放不下分屏了`,railFold:`折叠任务列表`,navBack:`后退`,navForward:`前进`,railUnfold:`展开任务列表`,dropUploading:`正在上传 {name}…`,pasteNoImage:`浏览器剪贴板里没有图片`,pasteNoAccess:`读不到浏览器剪贴板:{error}`,pasteNeedsHttps:`页面要走 https 或 localhost`,refreshTimeout:"守护进程没能及时以新版本重新上线,请检查 `rove daemon status`",railResize:`拖动调整任务列表宽度,单击折叠,双击还原`,composerPlaceholder:`给 agent 发消息`,composerSend:`发送`,composerAttach:`附加文件`,composerNotSent:`没发出去:{reason}`,composerOldBridge:`这台 Mac 上的 rove --web 比页面旧,重启它之后才能从这里发送。`,composerAtMenu:`agent 正在等你选择。用下方的 1–4 和 ⏎ 键回答;你的消息已保留。`,termKeys:`终端按键`,termKeyUp:`上方向键`,termKeyDown:`下方向键`,termKeyLeft:`左方向键`,termKeyRight:`右方向键`,termKeyInterrupt:`Ctrl+C 中断`,termKeyEnter:`回车`,narrowTerminal:`终端`}},Et=[nt,Ct,We,Xe,dt,Re,$e,ct,_t,mt,qe,Fe,at,Ve,bt],Dt=Object.assign({},...Et.map(e=>e.en)),Ot={en:Dt,zh:Object.assign({},...Et.map(e=>e.zh))};function kt(){try{let e=JSON.parse(localStorage.getItem(`rove.prefs`)??`null`);if(e&&typeof e==`object`&&`prefs`in e){let t=e.prefs;if(t&&typeof t==`object`&&`locale`in t&&(t.locale===`en`||t.locale===`zh`))return t.locale}}catch{}return globalThis.navigator?.language?.toLowerCase().startsWith(`zh`)?`zh`:`en`}var At=v(kt());function jt(){let e=typeof document>`u`?void 0:document.documentElement;e&&(e.lang=At.get()===`zh`?`zh-CN`:`en`)}jt(),At.subscribe(jt);function Mt(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function Nt(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}function R(e,t){return Nt(Mt(Ot[At.get()],e)??Mt(Dt,e)??e,t)}function Pt(e,t,n){return Nt(Mt(e[At.get()],t)??Mt(e.en,t)??t,n)}function z(){return y(At)}function Ft(e){let t=e.trim(),n=t.indexOf(`#`),r=n>=0?new URLSearchParams(t.slice(n+1)).get(`token`):t;return r&&/^[A-Za-z0-9_-]{43}$/.test(r)?r:null}var It=(...e)=>e.filter(Boolean).join(` `),Lt=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),B=t(((e,t)=>{t.exports=Lt()}))(),Rt=({danger:e=!1}={})=>`rounded-sm font-sans text-meta not-italic normal-nums text-paper active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 ${e?`bg-error`:`bg-accent`} px-3.5 py-1.5 font-semibold`,zt={link:`text-accent hover:underline`,filled:Rt(),danger:Rt({danger:!0}),action:`rounded-sm border-hairline border-line bg-inset px-3 py-1.5 font-sans text-meta text-ink hover:border-line-active hover:bg-menu active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,floating:`whitespace-nowrap rounded-sm border-hairline border-line-active bg-surface px-2 py-0.5 font-mono text-meta text-ink shadow-popover`,row:``,pill:`inline-flex flex-none items-center gap-1.5 whitespace-nowrap font-mono text-meta text-muted hover:text-ink aria-[current=true]:text-accent`,card:`flex min-w-0 flex-col gap-1.5 rounded-sm border-hairline p-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`},Bt={roomy:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-1.5 touch:after:-inset-y-3`,tight:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-0.75 touch:after:-inset-y-0.5`,none:``};function V({variant:e=`link`,hit:t=e===`link`?`roomy`:`none`,className:n,type:r=`button`,...i}){return(0,B.jsx)(`button`,{type:r,className:It(zt[e],Bt[t],n),...i})}var Vt=`text-meta leading-[inherit]`,Ht=`font-normal normal-nums`,Ut=`touch:relative touch:after:absolute touch:after:content-['']`,Wt=`flex h-full flex-col`,Gt=e=>[`app relative grid min-h-0 flex-1 grid-rows-[1fr_auto] transition-[grid-template-columns] duration-220 ease-snap motion-reduce:transition-none`,e.surface?`is-narrow narrow-${e.surface} grid-cols-[minmax(0,1fr)]`:e.zen?`grid-cols-[var(--rail-w,minmax(220px,280px))_1fr]`:`grid-cols-[var(--rail-w,minmax(220px,280px))_1fr_var(--panel-w,clamp(300px,28vw,440px))]`,e.zen?`is-zen`:``,e.expanded?`is-panel-expanded`:``,e.folded?`is-rail-folded`:``,e.peek?`is-rail-peek`:``,e.dragging?`is-dragging transition-none`:``].join(` `),Kt=[`relative narrow-content:hidden narrow-back:col-1 narrow-back:row-1 touch:select-none touch:touch-callout-none`,`wide:overflow-x-clip wide:pt-8.5 wide:[&>:not([data-grip])]:min-w-(--rail-open-w)`,`rail-folded:absolute rail-folded:inset-y-1.5 rail-folded:left-1.5 rail-folded:z-6 rail-folded:col-1 rail-folded:row-1 rail-folded:box-border rail-folded:w-(--rail-open-w) rail-folded:-translate-x-[calc(100%+12px)] rail-folded:rounded-md rail-folded:border-hairline rail-folded:border-line rail-folded:bg-surface rail-folded:shadow-none rail-folded:transition-[translate] rail-folded:duration-200 rail-folded:ease-snap rail-folded:motion-reduce:transition-none rail-folded:[&>:not([data-grip])]:min-w-0`,`rail-peek:translate-none rail-peek:shadow-dialog`].join(` `),qt=`rail-folded:col-2 panel-expanded:invisible panel-expanded:col-2 narrow-sidebar:hidden narrow-back:z-1 narrow-back:col-1 narrow-back:translate-x-(--back-x) narrow-back:bg-paper narrow-back:shadow-dialog`,Jt=`rail-folded:col-3 panel-expanded:z-2 panel-expanded:col-[2/-1] panel-expanded:bg-paper panel-expanded:pl-2`,Yt=`${Ut} touch:after:-inset-x-1.5 touch:after:-inset-y-3`,Xt=`flex items-center gap-2`,Zt=`px-1.5 py-0.5 text-meta font-bold ${Ut} touch:after:-inset-2.5 touch:after:-bottom-1`,Qt=`flex items-center rounded-sm px-2.5 py-1.5 text-muted aria-selected:bg-inset aria-selected:text-ink [&_svg]:size-4 ${Ut} touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.5`,$t=`keys-only m-0 overflow-hidden px-3.5 py-1 text-meta text-ellipsis whitespace-nowrap`,en=e=>`shortcut-badge absolute top-1/2 z-8 -translate-y-1/2 cursor-pointer rounded-sm border-hairline border-accent bg-surface px-1.25 py-px text-meta text-accent ${e?`right-full mr-1.5`:`right-1`}`,tn=`relative min-w-0 flex-1`,nn={left:[`[border-left:var(--hairline)_solid_var(--line)]`,`[border-left:var(--hairline)_solid_var(--accent)]`],top:[`[border-top:var(--hairline)_solid_var(--line)]`,`[border-top:var(--hairline)_solid_var(--accent)]`]},rn=(e,t)=>nn[e][+!!t],an=(e,t)=>{let n=`split-leaf absolute box-border flex min-h-0 min-w-0 ${t.active?`is-active`:``}`,r=t.active?`border-accent`:``;return e===`box`?`${n} rounded-[calc(var(--radius)-1px)] border-hairline ${t.active?`border-accent`:`border-line`}`:e===`line`?`${n} ${t.left?rn(`left`,t.active):``} ${t.top?rn(`top`,t.active):``} ${t.left||t.top?r:``}`:e===`rail`?`${n} ${rn(`left`,t.active)} ${r} ${t.top?`[--mt:6px]`:``}`:e===`rule`?`${n} ${rn(`top`,t.active)} ${r} ${t.left?`[--ml:8px]`:``}`:n},on=(e,t)=>`absolute right-2 z-3 bg-paper px-1 font-mono text-meta ${Ht} ${e?`-top-2`:`top-0.5`} ${t?`text-accent`:`text-subtle`}`,sn=`hidden gap-1 overflow-x-auto scrollbar-none [border-top:var(--hairline)_solid_var(--line)] bg-surface px-1.5 py-1 touch:flex`,cn=e=>`h-8 min-w-max touch-manipulation [flex:1_1_0] rounded-sm border-hairline bg-inset px-0.5 py-0 font-mono text-meta ${Ht} ${e?`border-accent text-accent`:`border-line text-ink`}`,ln=`prefix-guide fixed bottom-19 left-3 z-40 max-h-[60vh] w-[min(560px,calc(100vw-24px))] overflow-y-auto rounded-sm border-hairline border-line bg-surface px-3 py-2 text-meta shadow-popover motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,un=`min-w-[3ch] text-accent`,dn=`mb-1.5 flex justify-between gap-4`,fn=`columns-[2_220px] gap-x-5`,pn=`mb-2 break-inside-avoid`,mn=`flex w-full gap-2.5 px-0 py-px text-left text-ink enabled:hover:bg-hover disabled:cursor-default touch:py-2.5`,hn=`mx-0 my-2 overflow-x-hidden overflow-y-auto scrollbar-none`,gn=e=>`flex w-full min-w-0 justify-between gap-4 rounded-sm px-1.5 py-0.75 text-left font-mono text-meta ${Ht} whitespace-pre text-ink touch:py-2.5 ${e?`is-selected bg-hover`:``}`,_n=`min-w-0 overflow-hidden text-ellipsis`,vn=`w-full rounded-none border-0 [border-bottom:var(--hairline)_solid_var(--line)] bg-transparent px-1.5 py-2 font-mono text-meta font-normal normal-nums text-ink focus-visible:outline-none`,yn=`flex justify-between gap-4`,bn=`flex flex-col items-end ${Vt}`,xn=`mt-2 max-h-[52vh] overflow-y-auto`,Sn=`mb-2.5`,Cn=`m-0 mb-1 font-sans text-meta font-bold normal-nums text-accent`,wn=`flex gap-3 py-px ${Vt}`,Tn=`min-w-[14ch] text-ink`,En=`flex flex-wrap items-baseline gap-3 [border-bottom:var(--hairline)_solid_var(--warning)] bg-inset px-3.5 py-1 text-meta text-warning [&_span]:text-muted`,Dn=`keys-only fixed bottom-[34px] left-3 z-40 min-w-55 rounded-sm border-hairline border-line bg-surface px-3 py-2 font-mono text-meta ${Ht} text-ink shadow-popover`,On=e=>`mb-0.5 ${e?`motion-safe:[animation:sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`:`motion-safe:[animation:rise-in_140ms_ease-out,sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`}`,kn=`m-auto font-mono text-meta ${Ht} text-subtle`,An=`${kn} flex flex-col items-center gap-3 [&_p]:m-0`,jn=`workspace row-1 flex min-h-0 min-w-0 flex-col gap-1.5 px-1 pt-2 pb-1`,Mn=`flex min-h-0 flex-1 overflow-hidden rounded-md border-hairline border-line bg-paper focus-within:border-focus`,Nn=`working-flow:border-transparent working-flow:[background:linear-gradient(var(--paper),var(--paper))_0_0/100%_100%_padding-box,linear-gradient(90deg,var(--line),var(--task-ink,var(--focus)),var(--line),var(--task-ink,var(--focus)),var(--line))_0_0/300%_100%_border-box] working-flow:motion-safe:animate-flow-border`,Pn=`relative flex min-w-0 flex-1 flex-col`,Fn=`relative flex min-h-0 min-w-0 flex-1 flex-col`,In=`term-host relative min-h-0 min-w-0 flex-1 touch-none overflow-hidden`,Ln=`pointer-events-none absolute inset-0 z-5 h-full w-full`,Rn=`relative h-full [&.is-leaving]:pointer-events-none [&.is-leaving]:absolute [&.is-leaving]:inset-0 [&.is-leaving]:z-6`,zn=`pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre>div>div]:overflow-hidden [&_pre>div>div]:[height:var(--row-h,1.15em)] [&_pre>div>div]:[line-height:var(--row-h,1.15em)]`,Bn=e=>`absolute right-2.5 bottom-2.5 z-5 flex items-center gap-3 rounded-sm border-hairline border-line bg-inset px-2.5 py-1.25 font-mono text-meta ${Ht} ${e?`text-error`:`text-muted`} [&_.link:disabled]:pointer-events-none [&_.link:disabled]:opacity-60`,Vn=`col-span-full touch:[&_.link]:after:inset-[-2px_-6px_-4px] flex min-w-0 items-center gap-2 [border-top:var(--hairline)_solid_var(--line)] bg-surface px-3 py-1 font-mono text-meta ${Ht} whitespace-nowrap text-muted`,Hn=e=>`size-1.5 rounded-full ${e?`bg-warning`:`bg-subtle`}`,Un=`grid min-w-0 grid-cols-[auto_minmax(2rem,1fr)_auto] gap-x-2.5 gap-y-1 pt-2 pb-1 font-sans whitespace-nowrap text-meta text-subtle normal-nums`,Wn=`col-span-3 grid cursor-pointer grid-cols-subgrid items-center text-left hover:text-ink`,Gn={ok:`text-muted`,warn:`text-warning`,crit:`text-error`},Kn={ok:`text-success`,warn:`text-warning`,crit:`text-error`},qn=e=>`relative h-0.75 overflow-hidden rounded-full bg-[color-mix(in_srgb,currentColor_18%,transparent)] after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:rounded-full after:bg-current after:content-[''] ${Kn[e]??Kn.ok}`,Jn=`font-mono text-title font-bold normal-nums tracking-[0.02em] whitespace-nowrap`,Yn=`text-accent`,Xn=`grid h-full place-items-center p-6`,Zn=`flex w-[min(460px,100%)] flex-col gap-3 rounded-md border-hairline border-line bg-surface p-6 [&_p]:m-0`,Qn=`flex flex-col gap-2 p-3.5 text-left font-sans text-meta ${Ht} leading-[1.5]`,$n=`mx-2.5 my-3 font-mono text-meta text-subtle`,er=`font-sans text-meta text-subtle`,tr=`m-0 max-h-[38vh] overflow-auto rounded-sm border-hairline border-line bg-paper px-3 py-2.5 font-mono text-meta leading-[1.5] whitespace-pre-wrap wrap-anywhere`,nr=e=>`flex w-full flex-col gap-0.5 rounded-sm px-2.5 py-1.5 text-left focus-visible:bg-accent-soft focus-visible:outline-none ${e?`bg-accent-soft`:``}`,rr=`mx-0 mt-1 mb-0 max-h-47 list-none overflow-y-auto rounded-sm border-hairline border-line bg-inset p-0.5 font-mono text-meta`,ir=e=>`block w-full cursor-pointer overflow-hidden rounded-[calc(var(--radius-sm)-2px)] px-2 py-0.75 text-left text-ellipsis whitespace-nowrap [font:inherit] touch:py-2.5 ${e.cursor?`bg-hover`:``} ${e.accent?`text-accent`:e.cursor?`text-ink`:`text-muted`}`,H=`m-0 font-sans text-meta font-medium normal-nums`,ar=`link text-accent [&:hover]:underline touch-hit`,or=`rounded-sm border-hairline border-line bg-paper font-mono text-meta font-normal normal-nums text-ink focus-visible:border-line-active focus-visible:outline-none`,sr=`${or} w-full px-2.5 py-2`,cr=`actions flex items-center justify-end gap-3.5`;function lr({failing:e=!1}){z();let[t,n]=(0,h.useState)(``),[r,i]=(0,h.useState)(!1);return(0,B.jsx)(`div`,{className:Xn,children:(0,B.jsxs)(`form`,{className:Zn,onSubmit:e=>{e.preventDefault();let n=Ft(t);if(!n){i(!0);return}a(n),window.location.reload()},children:[(0,B.jsxs)(`span`,{className:Jn,children:[(0,B.jsx)(`span`,{className:Yn,children:`[`}),` rove `,(0,B.jsx)(`span`,{className:Yn,children:`]`})]}),(0,B.jsx)(`h1`,{className:`${H} text-muted`,children:R(`connect.title`)}),(0,B.jsx)(`p`,{className:e?`text-error`:`text-muted`,children:R(e?`connect.failing`:`connect.body`)}),(0,B.jsx)(`input`,{className:sr,autoFocus:!0,spellCheck:!1,placeholder:R(`connect.placeholder`),value:t,onChange:e=>{n(e.target.value),i(!1)}}),r&&(0,B.jsx)(`p`,{className:`text-error`,children:R(`connect.invalid`)}),(0,B.jsxs)(`div`,{className:cr,children:[e&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>{o(),window.location.reload()},children:R(`connect.forget`)}),(0,B.jsx)(`button`,{type:`submit`,className:Rt(),children:R(`connect.submit`)})]})]})})}var ur=`flex flex-col gap-1.5`,dr=`min-h-18 max-h-[50vh] leading-[1.45]`,fr=`flex flex-wrap gap-1.5`,pr=(e=!1,t=!1)=>`rounded-sm border-hairline px-2.5 py-1 font-mono text-meta font-normal not-italic normal-nums ${e?`border-accent bg-accent-soft text-ink`:`border-line hover:bg-hover ${t?`text-subtle`:`text-muted`}`}`,mr=`m-0 list-none p-0`,hr=`overlay fixed inset-0 z-20 grid justify-items-center [align-items:start] bg-(--scrim) pt-[12vh] motion-safe:animate-fade-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-fade-out short:pt-3`,gr=(e=!1)=>`dialog static m-0 flex max-h-[76vh] ${e?`w-[min(620px,calc(100vw-32px))]`:`w-[min(440px,calc(100vw-32px))]`} flex-col gap-3 rounded-md border-hairline border-line bg-surface px-5 py-4.5 text-inherit shadow-dialog focus:outline-none motion-safe:animate-rise-in [.is-leaving_&]:animate-sink-out short:max-h-[calc(100dvh-24px)] short:px-4 short:py-3`,_r=`flex items-center justify-between gap-3`,vr=`m-0 min-w-0 font-sans text-title leading-[1.4] font-semibold normal-nums text-ink wrap-anywhere`,yr=`grid size-6 place-items-center -my-1 mr-[-6px] ml-0 rounded-sm text-display leading-none text-muted hover:bg-inset hover:text-ink focus-visible:bg-inset focus-visible:text-ink touch:relative touch:after:absolute touch:after:-inset-2.5 touch:after:content-['']`,br=`dialog-body -m-0.5 flex min-h-0 flex-col gap-3 overflow-y-auto p-0.5 [&_p]:m-0 [&>.actions]:sticky [&>.actions]:-bottom-0.5 [&>.actions]:bg-surface [.dialog-body+div>&]:mt-3.5`,xr=(e=!1)=>`menu fixed z-30 flex max-h-[calc(100vh-16px)] ${e?`min-w-40`:`min-w-50`} origin-top-left flex-col overflow-y-auto rounded-md border-hairline border-line bg-surface p-1 shadow-popover motion-safe:animate-menu-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,Sr=e=>`flex items-baseline justify-between gap-6 rounded-[calc(var(--radius)-4px)] px-2.5 py-1.25 text-left text-body leading-[inherit] touch:py-2.5 ${e.danger&&e.selected?`bg-error text-paper`:e.selected||e.open?`bg-hover`:``} ${e.danger&&!e.selected?`text-error`:``} ${e.selected?`forced-colors:outline-2 forced-colors:-outline-offset-2 forced-colors:outline-[Highlight] forced-colors:outline-solid`:``}`,Cr=`font-mono text-meta normal-nums`,wr=e=>`${Cr} ${e.danger&&e.selected?`text-inherit`:e.selected?`text-muted`:`text-subtle`} touch:hidden!`,Tr=e=>`${Cr} ${e?`text-ink`:`text-subtle`}`,Er=`${Cr} text-accent`,Dr=`fixed right-3.5 bottom-8.5 z-40 flex flex-col gap-1.5 narrow:pointer-events-none narrow:top-12 narrow:bottom-auto narrow:left-3.5 narrow:items-end narrow:*:pointer-events-auto`,Or=`flex cursor-default flex-wrap items-baseline justify-between gap-x-3`,kr=e=>`toast max-w-105 cursor-pointer rounded-sm border-hairline border-line bg-inset px-3 py-1.5 text-left font-sans text-meta normal-nums wrap-anywhere ${e?`text-error`:`text-ink`} motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,Ar=`text-subtle`,jr=`flex items-baseline justify-between gap-3`,Mr=`mt-1`,Nr=`m-0 flex list-none flex-col gap-0.5 p-0`,Pr=`flex min-w-0 items-baseline gap-2.5`,Fr=`flex-none font-mono text-meta font-normal normal-nums min-w-[3ch] text-right text-subtle`,Ir=`flex items-baseline gap-1`,Lr=`min-w-0 flex-1`,Rr=`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,zr=`font-mono [&:hover]:text-accent`,Br={row:`min-h-6.5 touch:min-h-10`,file:`min-h-6 font-mono text-meta touch:min-h-10`,"file-narrow":`min-h-9 font-mono text-meta`,pane:`min-h-5.5 touch:min-h-10`},Vr=`bg-hover cursor-grabbing scale-[1.02] motion-reduce:scale-none`,Hr=`before:absolute before:top-1/2 before:h-3 before:w-0.5 before:-translate-y-1/2 before:rounded-full before:bg-subtle before:opacity-0 before:transition-opacity before:duration-150 before:content-[''] hover:before:opacity-70 touch:before:hidden`;function Ur(e){let t=e.stack?`flex-col items-stretch gap-0.5 px-2.5 py-1.5`:`items-center gap-2 px-2 py-0.75`,n=e.lifted?Vr:e.moving?`bg-accent-soft`:e.selected?`bg-menu`:`hover:bg-hover data-menu-open:bg-hover`;return`relative flex w-full rounded-sm text-left ${e.lifted?``:`active:scale-97 motion-reduce:active:scale-none`} ${e.grab&&!e.lifted?`cursor-grab before:left-0.5 ${Hr}`:``} ${t} ${Br[e.size??`row`]} ${n}`}var Wr=`row-title min-w-0 flex-1 truncate`,Gr=`row-title min-w-0 flex-auto truncate text-(length:--fs-title)`,Kr=`running-shimmer:bg-[linear-gradient(90deg,var(--ink)_0%,var(--ink)_35%,var(--accent)_50%,var(--ink)_65%,var(--ink)_100%)] running-shimmer:bg-size-[300%_100%] running-shimmer:bg-clip-text running-shimmer:text-transparent running-shimmer:animate-shimmer`,qr=`w-[1ch] flex-none text-center font-mono`,Jr=`grid w-[2ch] flex-none place-items-center font-mono text-subtle`,Yr=`flex flex-none gap-1.5 font-mono text-meta`;function U(e){return e instanceof Error?e.message:String(e)}function Xr(e){z();let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>{t.current&&!t.current.contains(document.activeElement)&&t.current.focus();let e=e=>{e.key===`Escape`&&(e.preventDefault(),L())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,B.jsx)(`div`,{className:hr,onMouseDown:e=>e.target===e.currentTarget&&L(),children:(0,B.jsxs)(`dialog`,{ref:t,tabIndex:-1,open:!0,className:gr(e.wide),"aria-label":e.title,children:[(0,B.jsxs)(`div`,{className:_r,children:[(0,B.jsx)(`h1`,{className:vr,children:e.title}),(0,B.jsx)(`button`,{type:`button`,className:yr,"aria-label":R(`dialog.close`),title:R(`dialog.close`),onClick:L,children:`×`})]}),e.children]})})}function Zr(){let[e,t]=(0,h.useState)(!1),[n,r]=(0,h.useState)(null);return{busy:e,error:n,setError:r,submit:async e=>{t(!0),r(null);try{await e(),L()}catch(e){r(U(e))}finally{t(!1)}}}}function Qr(e){let[t,n]=(0,h.useState)(e.initial??``),{busy:r,error:i,submit:a}=Zr();return(0,B.jsx)(Xr,{title:e.title,children:(0,B.jsxs)(`form`,{className:br,onSubmit:n=>{n.preventDefault(),(t.trim()||e.allowEmpty)&&a(()=>e.onSubmit(t.trim()))},children:[e.multiline?(0,B.jsx)(`textarea`,{className:`${sr} ${dr}`,"aria-label":e.title,autoFocus:!0,rows:4,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},onFocus:e=>e.currentTarget.setSelectionRange(t.length,t.length)}):(0,B.jsx)(`input`,{className:sr,"aria-label":e.title,autoFocus:!0,spellCheck:!1,value:t,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.select()}),i&&(0,B.jsx)(`p`,{className:`text-error`,children:i}),(0,B.jsx)(ti,{busy:r,submitLabel:e.submitLabel})]})})}function $r(e){let{busy:t,error:n,setError:r,submit:i}=Zr(),[a,o]=(0,h.useState)(!1),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(!1),d=(0,h.useRef)(null);(0,h.useEffect)(()=>d.current?.focus(),[]);let f=t=>void i(async()=>{try{a&&e.escalate?await e.escalate.run(l):await(t&&e.secondary?e.secondary.onConfirm():e.onConfirm())}catch(n){throw!a&&e.escalate?.when(n)&&(o(!0),c(n),u(t),r(U(n))),n}});return(0,B.jsx)(Xr,{title:a&&e.escalate?.title||e.title,children:(0,B.jsxs)(`div`,{className:br,children:[(0,B.jsx)(`p`,{className:`whitespace-pre-line text-muted`,children:a&&e.escalate?.body?e.escalate.body(s):e.body}),n&&!(a&&e.escalate?.body)&&(0,B.jsx)(`p`,{className:`text-error`,children:n}),(0,B.jsxs)(`div`,{className:cr,children:[(0,B.jsx)(`button`,{type:`button`,className:ar,onClick:L,children:R(`dialog.cancel`)}),e.secondary&&!a&&(0,B.jsx)(`button`,{type:`button`,className:Rt({danger:!0}),disabled:t,onClick:()=>f(!0),children:e.secondary.label}),(0,B.jsx)(`button`,{ref:d,type:`button`,className:Rt({danger:!0}),disabled:t,onClick:()=>f(!1),children:a&&e.escalate?e.escalate.label:e.confirmLabel})]})]})})}function ei(e){let t=Math.max(0,e.choices.findIndex(t=>t.value===e.current)),[n,r]=(0,h.useState)(t),{busy:i,error:a,submit:o}=Zr(),s=t=>void o(()=>e.onPick(t));return(0,h.useEffect)(()=>{let t=t=>{if(t.key===`ArrowDown`||t.key===`j`)r(t=>Math.min(e.choices.length-1,t+1));else if(t.key===`ArrowUp`||t.key===`k`)r(e=>Math.max(0,e-1));else if(t.key===`Enter`){let t=e.choices[n];t&&s(t.value)}else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)}),(0,B.jsx)(Xr,{title:e.title,children:(0,B.jsxs)(`div`,{className:br,children:[(0,B.jsx)(`ul`,{className:mr,children:e.choices.map((t,a)=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":t.value===e.current,disabled:i,className:Ur({selected:a===n}),onMouseEnter:()=>r(a),onClick:()=>s(t.value),children:[(0,B.jsx)(`span`,{className:`${qr} text-accent`,children:t.value===e.current?`●`:` `}),(0,B.jsx)(`span`,{className:Wr,children:t.label})]})},t.value))}),a&&(0,B.jsx)(`p`,{className:`text-error`,children:a})]})})}function ti({busy:e,submitLabel:t}){return(0,B.jsxs)(`div`,{className:cr,children:[(0,B.jsx)(`button`,{type:`button`,className:ar,onClick:L,children:R(`dialog.cancel`)}),(0,B.jsx)(`button`,{type:`submit`,className:Rt(),disabled:e,children:t})]})}function ni(e,t){let n=window.setInterval(()=>{(typeof document>`u`||document.visibilityState===`visible`)&&t()},e),r=()=>{document.visibilityState===`visible`&&t()};return document.addEventListener(`visibilitychange`,r),()=>{window.clearInterval(n),document.removeEventListener(`visibilitychange`,r)}}var ri={cancel:`Cancel`,failureHint:"Run `{command}` for diagnosis and next steps.",toastFailureHint:`Next: run rove doctor`,loading:`Loading…`,create:`create`,confirm:`Confirm`,paneCrash:{title:`This pane crashed`,hint:`The error was logged to client.log. Retry, or restart Rove if it keeps happening.`,regionTitle:`The {region} hit an error`,regionHint:"The rest of Rove keeps working. Retry below; if it persists, inspect client.log and run `rove doctor`.",retry:`[ retry ]`,region:{sidebar:`task list`,workspace:`workspace`,files:`file tree`,page:`page`}},rename:{defaultTitle:`Rename task`,defaultFieldLabel:`TITLE`,footerHint:`enter {submitLabel} · esc cancel`,defaultSubmitLabel:`rename`},prompt:{fieldLabel:`input`,submitLabel:`submit`}},ii={cancel:`取消`,failureHint:"运行 `{command}` 查看诊断和后续步骤。",toastFailureHint:`下一步:运行 rove doctor`,loading:`加载中…`,create:`创建`,confirm:`确认`,paneCrash:{title:`此面板已崩溃`,hint:`错误已记录到 client.log。可重试;若反复出现请重启 Rove。`,regionTitle:`{region}出错了`,regionHint:"Rove 的其余部分仍可正常使用。请在下方重试;若问题持续,请查看 client.log 并运行 `rove doctor`。",retry:`[ 重试 ]`,region:{sidebar:`任务列表`,workspace:`工作区`,files:`文件树`,page:`页面`}},rename:{defaultTitle:`重命名任务`,defaultFieldLabel:`名称`,footerHint:`enter {submitLabel} · esc 取消`,defaultSubmitLabel:`重命名`},prompt:{fieldLabel:`输入`,submitLabel:`提交`}},ai={fix:{hint:"{count} finding(s) above have a known fix — run `{command}` to review them one by one",none:`fix: nothing to fix — no known remediation applies to this report`,header:`fixes — each one asks before running:`,willRun:`will run: {command}`,confirmPrompt:`apply this fix? [y/N] `,done:`✓ done`,failed:`✗ exited with code {code}; inspect the command output above, then rerun rove doctor`,skipped:`· skipped`,nonInteractive:`no interactive terminal — nothing was executed; run the commands above yourself`,manualHeader:`manual steps — doctor prints these but never runs them:`,daemonRestartWhy:`safe to run: engine sessions live in the separate PTY host and survive a daemon restart`,daemonStale:`restart the daemon — it is running an older build than this CLI`,daemonDown:`start the daemon — it is not running`,hooksDown:`restart the daemon to re-establish the engine hook channel`,inspectStale:`restart the daemon — it predates the hook-channel check`,skillInstallWhy:`safe to run: installs skill files only; re-running is idempotent`,skillMissing:`install the Rove agent skill`,skillStale:`update the Rove agent skill to the version this build expects`,spawnHelper:`restore the exec bit on node-pty's spawn-helper — every node-pty PTY spawn fails without it`,spawnHelperWhy:"safe to run: chmod on two prebuilt binaries; idempotent, and `bun install` does the same",resetWhy:`stops the daemon, the PTY host, and every live session — not undoable, so doctor only prints it`,resetDaemonWedged:`the daemon process is alive but unreachable (wedged)`,resetPty:`the PTY host process is alive but its socket is unreachable (wedged)`,resetPtyStale:`the PTY host is still running an older build than the one you launched`,resetLegacy:`pre-v0.8 tmux sessions are still holding processes and memory`,orphans:`{count} process(es) outlived the PTY session that spawned them and are still running`,orphansWhy:`kills processes, which is not undoable — and a task you backgrounded on purpose looks the same; read the list, then run it yourself`,engineTabs:`engine tabs may hold a stale daemon socket path`,engineTabsAction:`close and reopen the affected engine tabs in the TUI`,engineTabsWhy:`kills that tab's live engine session — your call, not doctor's`,staleInstall:`the install this Rove runs from no longer exists on disk`,staleInstallAction:`npm install -g @sma1lboy/rove, then relaunch Rove`,staleInstallWhy:`doctor cannot reinstall Rove over the running process — a human has to, then relaunch`,humanOnlyWhy:`doctor does not install software or log in to accounts for you`,git:`git is not on PATH`,gitAction:`install git with your OS package manager`,noEngine:`no usable engine — no engine CLI is both installed and logged in`,noEngineAction:`install an engine CLI (claude, codex, copilot, or kimi) and log in`,noEngineLogin:`no usable engine — an engine CLI is installed but not signed in`,noEngineLoginAction:`run one of the installed engine CLIs ({list}) in a shell and complete its login`,windowsNode:`Node.js is missing — the Windows PTY host cannot start`,windowsNodeAction:`install Node.js from https://nodejs.org`,staleBun:`the Bun running Rove is older than this build supports — terminals will not paint`,staleBunAction:"upgrade Bun (`bun upgrade`, `brew upgrade bun`, or `npm install -g bun@latest`), then relaunch Rove"}},oi={fix:{hint:"上面有 {count} 项发现存在已知修法 — 运行 `{command}` 逐条查看",none:`fix: 无可修项 — 本次报告没有匹配到已知修法`,header:`修复项 — 每一条都会先询问再执行:`,willRun:`将执行: {command}`,confirmPrompt:`执行这条修复吗? [y/N] `,done:`✓ 完成`,failed:`✗ 退出码 {code};请检查上方命令输出,再运行 rove doctor`,skipped:`· 已跳过`,nonInteractive:`没有交互终端 — 未执行任何命令; 请自行运行上面的命令`,manualHeader:`人工步骤 — doctor 只打印, 永远不会替你执行:`,daemonRestartWhy:`可安全执行: 引擎会话在独立的 PTY host 里, daemon 重启后仍然存活`,daemonStale:`重启 daemon — 它运行的构建比当前 CLI 旧`,daemonDown:`启动 daemon — 它当前没有在运行`,hooksDown:`重启 daemon 以重建引擎 hook 通道`,inspectStale:`重启 daemon — 它的版本早于 hook 通道检查`,skillInstallWhy:`可安全执行: 只写入 skill 文件; 重复运行是幂等的`,skillMissing:`安装 Rove agent skill`,skillStale:`把 Rove agent skill 更新到当前构建期望的版本`,spawnHelper:`恢复 node-pty spawn-helper 的可执行位 — 缺了它 node-pty 的每次 PTY 启动都会失败`,spawnHelperWhy:"可安全执行: 只对两个预编译二进制做 chmod; 幂等, `bun install` 也会做同样的事",resetWhy:`会停掉 daemon、PTY host 和所有活动会话 — 不可撤销, 所以 doctor 只打印`,resetDaemonWedged:`daemon 进程存活但无法连接 (卡死)`,resetPty:`PTY host 进程存活但 socket 无法连接 (卡死)`,resetPtyStale:`PTY host 仍在跑比你启动的版本更旧的构建`,resetLegacy:`v0.8 之前的 tmux 会话仍占用进程和内存`,orphans:`有 {count} 个进程比启动它们的 PTY 会话活得更久, 现在还在运行`,orphansWhy:`会杀进程, 不可撤销 — 而且你故意放后台的任务看起来一模一样; 先看清单, 再自己执行`,engineTabs:`引擎 tab 可能持有过期的 daemon socket 路径`,engineTabsAction:`在 TUI 里关闭并重开受影响的引擎 tab`,engineTabsWhy:`会杀掉该 tab 的活动引擎会话 — 由你决定, doctor 不代劳`,staleInstall:`当前 Rove 所在的安装已从磁盘删除`,staleInstallAction:`npm install -g @sma1lboy/rove, 然后重新启动 Rove`,staleInstallWhy:`doctor 无法在运行中的进程上重装 Rove — 需要人工重装后重新启动`,humanOnlyWhy:`doctor 不会替你安装软件或登录账号`,git:`PATH 上找不到 git`,gitAction:`用你的系统包管理器安装 git`,noEngine:`没有可用引擎 — 没有任何引擎 CLI 同时满足已安装且已登录`,noEngineAction:`安装任一引擎 CLI(claude、codex、copilot 或 kimi)并登录`,noEngineLogin:`没有可用引擎 — 引擎 CLI 已安装, 但没有登录`,noEngineLoginAction:`在 shell 里运行已安装的引擎 CLI({list})之一并完成登录`,windowsNode:`缺少 Node.js — Windows PTY host 无法启动`,windowsNodeAction:`从 https://nodejs.org 安装 Node.js`,staleBun:`运行 Rove 的 Bun 版本低于本构建的要求 — 终端不会有任何输出`,staleBunAction:"升级 Bun (`bun upgrade` / `brew upgrade bun` / `npm install -g bun@latest`), 然后重新启动 Rove"}},si={mentionNoEngine:`No engine session in this task — nothing to mention into. Open one with ctrl+t.`,tabs:{all:`All`,changes:`Changes`},actions:{zen:`Zen`,createPR:`Ask agent to create PR`,diffAll:`[D] diff everything`},legend:{changes:`M modified · A added · D deleted · ? untracked`},scope:{working:`scope: working tree`,branch:`scope: vs {base}`,toggleHint:`b to toggle`,noBase:`no base ref for branch scope (no origin/HEAD, main or master)`},empty:{noTask:`(no task — press n to create)`,noFiles:`(empty worktree)`,noChanges:`(no changes — clean worktree)`},error:{retryHint:`press r to retry`,notGitRepo:"not a git repository — run `git init` here, or open a task in a repo",pathMissing:`the worktree directory is gone — reopen the task to re-create it`,permissionDenied:`permission denied reading the worktree — check the directory's owner and mode`,gitNotInstalled:`git is not on PATH — install it with your OS package manager`,gitFailed:"git command failed; run `git status` in this worktree to diagnose"},toast:{prOnTargetBranch:`Already on the target branch ({branch}) — ask the agent to create the PR from a task branch`,noPausedOperation:`Nothing to resolve — no merge, rebase or cherry-pick is paused here`,conflictReadFailed:`Git could not read the conflicted files. Run git status in this worktree, then retry.`,conflictSendFailed:`Could not send the conflict prompt. Open an engine tab in this task, then retry.`,ciNoFailingChecks:`No failing check logs to read — the run may have expired, or the checks are no longer red`,ciChecksUnavailable:"gh could not read this PR's checks: {detail}. Run `gh auth status`, then retry."}},ci={mentionNoEngine:`这个任务没有引擎会话——没有地方可以提及。用 ctrl+t 开一个。`,tabs:{all:`全部`,changes:`改动`},actions:{zen:`专注模式`,createPR:`让 agent 创建 PR`,diffAll:`[D] 查看全部改动`},legend:{changes:`M 已修改 · A 已添加 · D 已删除 · ? 未跟踪`},scope:{working:`范围:工作区改动`,branch:`范围:对比 {base}`,toggleHint:`按 b 切换`,noBase:`分支范围没有基准 ref(没有 origin/HEAD、main 或 master)`},empty:{noTask:`(暂无任务 — 按 n 创建)`,noFiles:`(worktree 为空)`,noChanges:`(无改动 — worktree 干净)`},error:{retryHint:`按 r 重试`,notGitRepo:"不是 git 仓库——在这里执行 `git init`,或改为打开仓库里的任务",pathMissing:`worktree 目录已不存在——重新打开该任务会重建它`,permissionDenied:`读取 worktree 时权限不足——请检查该目录的属主和权限`,gitNotInstalled:`PATH 上找不到 git——请用系统包管理器安装`,gitFailed:"git 命令失败;请在此 worktree 运行 `git status` 诊断"},toast:{prOnTargetBranch:`当前就在目标分支({branch})— 请在任务分支上让 agent 创建 PR`,noPausedOperation:`没有要解决的冲突——这里没有暂停中的合并、变基或拣选`,conflictReadFailed:`Git 无法读取冲突文件。请在此 worktree 运行 git status,然后重试。`,conflictSendFailed:`无法发送冲突提示。请在此任务中打开一个引擎标签页,然后重试。`,ciNoFailingChecks:`没有可读的失败检查日志——运行记录可能已过期,或检查已不再是红的`,ciChecksUnavailable:"gh 读不到这个 PR 的检查状态:{detail}。请运行 `gh auth status`,然后重试。"}},li={retryHint:`Correct the field above, then choose Create again.`,title:`New task`,legend:`{enter} · tab complete/fields · ctrl+[ ] mode · ctrl+e engine · esc cancel`,enterCreate:`enter create`,enterNext:`enter next field`,tabs:{existing:`For Existing`,clone:`For New Repo`,adopt:`Adopt Worktree`},field:{mode:`MODE`,tier:`DEPTH`,engine:`ENGINE`,effort:`EFFORT`,repo:`REPO`,fromBranch:`FROM BRANCH`,prompt:`FIRST MESSAGE`,extras:`ALSO INCLUDE`,gitUrl:`GIT URL`,parentDir:`PARENT DIR`,folderName:`FOLDER NAME`,baseBranch:`BASE BRANCH`,adoptFilter:`FILTER (PATH GLOB)`,opens:`OPENS`},intent:{task:`a new task worktree`,project:`the project itself`},placeholder:{folderName:`auto from url`,adoptFilter:`* — type e.g. feature-* to narrow`,prompt:`Describe a task or ask a question (optional)`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(remembered — next clone defaults to this dir)`,currentDir:`(current dir)`,noBranchesFound:`(no local branches found — typed text will be used as ref)`,noMatchBranch:`(no match — typed text will be used as ref)`,scanningWorktrees:`scanning worktrees…`,extrasNone:`(none — enter picks a repo; the first is the primary)`,extrasPicked:`{count} more repo(s) in this task`},picker:{moreAbove:`↑ {count} more`,moreBelow:`↓ {count} more`},scroll:{moreAbove:`↑ {count} more rows`,moreBelow:`↓ {count} more rows`},open:{failed:`Couldn't open the project: {error}`},adopt:{repoLine:`repo: {path}`,repoNone:`(none)`,noUnlinked:`no unlinked worktrees — every git worktree here is already a task`,noMatch:`no worktrees match the filter`,hintSelected:`{count} selected · enter toggles · ctrl+a all · Create imports`,hintDefault:`enter toggles · ctrl+a all · Create imports the highlighted row`,summaryAll:`Adopted {count} worktree(s)`,summaryPartial:`Adopted {done}/{total} worktrees — the rest failed (see log)`,summaryNone:`Couldn't adopt any worktree: {error}`},clone:{progressFallback:`Cloning…`,progressInto:`Cloning into {target}…`},button:{create:`Create`,cloning:`Cloning…`},error:{gitUrlRequired:`git URL is required`,gitUrlInvalid:`does not look like a git URL: {url}`,folderRequired:`folder name is required`,folderHasSeparator:`folder name cannot contain path separators`,parentRequired:`parent directory is required`,parentNotFound:`parent directory does not exist: {path}`,parentNotDir:`not a directory: {path}`,targetExists:`target already exists: {path}`,cloneFailed:`git clone failed: {error}`,noAdoptable:`no adoptable worktrees to import`,repoAmbiguous:`more than one saved repo is named {name} — pick the one you mean from the list`,tierUnavailable:`{tier} points at engine {engine}, which is not available here — retarget it in Settings → Auto routing`}},ui={retryHint:`请修正上方字段,然后再次选择创建。`,title:`新建任务`,legend:`{enter} · tab 补全/切字段 · ctrl+[ ] 切模式 · ctrl+e 引擎 · esc 取消`,enterCreate:`enter 创建`,enterNext:`enter 下一个字段`,tabs:{existing:`已有仓库`,clone:`克隆新仓库`,adopt:`接管 Worktree`},field:{mode:`模式`,tier:`深度`,engine:`引擎`,effort:`推理强度`,repo:`仓库`,fromBranch:`基准分支`,prompt:`第一条消息`,extras:`同时包含`,gitUrl:`git 地址`,parentDir:`父目录`,folderName:`文件夹名`,baseBranch:`基准分支`,adoptFilter:`过滤(路径 glob)`,opens:`打开`},intent:{task:`新建任务 worktree`,project:`项目本身`},placeholder:{folderName:`自动从地址推导`,adoptFilter:`* — 输入如 feature-* 来缩小范围`,prompt:`描述一个任务,或提个问题(可选)`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(已记住 — 下次克隆默认使用此目录)`,currentDir:`(当前目录)`,noBranchesFound:`(未找到本地分支 — 将直接使用输入文本作为 ref)`,noMatchBranch:`(无匹配 — 将直接使用输入文本作为 ref)`,scanningWorktrees:`正在扫描 worktree…`,extrasNone:`(未选 — 回车选一个仓库,第一个是主仓库)`,extrasPicked:`任务里另含 {count} 个仓库`},picker:{moreAbove:`↑ 还有 {count} 项`,moreBelow:`↓ 还有 {count} 项`},scroll:{moreAbove:`↑ 上方还有 {count} 行`,moreBelow:`↓ 下方还有 {count} 行`},open:{failed:`无法打开项目:{error}`},adopt:{repoLine:`仓库:{path}`,repoNone:`(无)`,noUnlinked:`没有未关联的 worktree — 此仓库所有 git worktree 均已是任务`,noMatch:`没有 worktree 匹配此过滤条件`,hintSelected:`已选 {count} 项 · enter 切换选中 · ctrl+a 全选 · 创建 导入`,hintDefault:`enter 切换选中 · ctrl+a 全选 · 创建 将导入高亮行`,summaryAll:`已接管 {count} 个 worktree`,summaryPartial:`已接管 {done}/{total} 个 worktree — 其余失败(详见日志)`,summaryNone:`没有 worktree 接管成功:{error}`},clone:{progressFallback:`克隆中…`,progressInto:`正在克隆到 {target}…`},button:{create:`创建`,cloning:`克隆中…`},error:{gitUrlRequired:`git 地址不能为空`,gitUrlInvalid:`不像是有效的 git 地址:{url}`,folderRequired:`文件夹名不能为空`,folderHasSeparator:`文件夹名不能包含路径分隔符`,parentRequired:`父目录不能为空`,parentNotFound:`父目录不存在:{path}`,parentNotDir:`不是目录:{path}`,targetExists:`目标路径已存在:{path}`,cloneFailed:`git clone 失败:{error}`,noAdoptable:`没有可接管的 worktree`,repoAmbiguous:`有多个已保存仓库都叫 {name} — 请从列表中选择你要的那个`,tierUnavailable:`{tier} 指向的引擎 {engine} 在这台机器上不可用——去 设置 → 自动路由 重新指定`}},di={engineTitle:`Engine and account`,engineChecking:`Checking installed engines and accounts…`,engineReady:`✓ Ready to start a task`,engineMissing:`No usable engine yet`,engineUsable:`✓ {engine}: ready`,engineSignedOut:`! {engine}: installed, not signed in`,engineSetup:"Install an engine using docs.rove.run/rove/engines, then run its CLI and sign in. Run `rove doctor --fix` to check setup; Settings → Engines lists integrations.",engineContinue:`❯ Continue to optional setup`,engineLegend:`enter continue · esc skip optional setup`,quickStart:`Start a task with a prompt`,quickIntent:`Creates an isolated worktree and branch. Use {key} for the full task dialog.`,tabShared:`New conversations share this task’s files`,tabIsolated:`{key}: new task, isolated worktree`,title:`Welcome to Rove`,subtitle:`Managed tasks get isolated worktrees and branches. Directory and project tasks reuse existing files.`,completionsLabel:`Shell completions for {shell}`,completionsExplain:`Tab-completes rove subcommands. One line is added to your shell config.`,skillLabel:`Rove agent skill`,skillExplain:`Lets the coding agents on this machine drive Rove themselves: start tasks, read other sessions, message them.`,optionYes:`Install`,recommended:`recommended`,stepCounter:`{n} / {total}`,optionNo:`Not now`,queued:`Queued — installs when you quit Rove`,skillInstalled:`Installed for {engines}`,skillFailed:`Install failed: {reason}`,skillNoEngines:`No coding agent here takes the skill`,skipped:`Skipped`,installFailed:`! {item} failed: {reason}. Retry: {command} (or quit Rove again).`,legend:`↑↓ select · enter confirm · esc close`,keysTitle:`Keyboard basics`,keysBare:`Bare keys act in the focused pane — {nav} moves, {open} opens.`,keysOnePress:`A few one-press chords are Rove's own — {newTab} new tab, {focusNext} next pane.`,keysPrefix:`{prefix} opens the command map — hold it a beat and a guide appears.`,keysHelp:`{help} shows the full live reference anytime.`,keysNext:`Next: Settings → Engines lists every engine and installs its activity hooks.`,keysLegend:`enter finish`,appliedCompletions:`✓ completions hooked into {path} (takes effect in new shells)`,keptCompletions:`· {path} already has a completions block — left untouched`},fi={engineTitle:`引擎与账户`,engineChecking:`正在检查引擎与账户…`,engineReady:`✓ 可以开始任务`,engineMissing:`还没有可用的引擎`,engineUsable:`✓ {engine}:可用`,engineSignedOut:`! {engine}:已安装,未登录`,engineSetup:"从 docs.rove.run/rove/engines 安装引擎,然后运行其 CLI 并登录。运行 `rove doctor --fix` 检查配置;设置 → 引擎 可查看集成。",engineContinue:`❯ 继续可选设置`,engineLegend:`enter 继续 · esc 跳过可选设置`,quickStart:`输入提示词开始任务`,quickIntent:`创建独立 worktree 和分支。按 {key} 打开完整任务对话框。`,tabShared:`新对话共享当前任务的文件`,tabIsolated:`{key}:新建任务,使用独立 worktree`,title:`欢迎使用 Rove`,subtitle:`托管任务使用独立的 worktree 和分支;目录与项目任务复用现有文件。`,completionsLabel:`{shell} 的 shell 补全`,completionsExplain:`让 rove 子命令支持 Tab 补全,会在你的 shell 配置里加一行。`,skillLabel:`Rove agent skill`,skillExplain:`让本机的编码 agent 自己操作 Rove:开任务、读其他会话、给它们发消息。`,optionYes:`安装`,recommended:`推荐`,stepCounter:`{n} / {total}`,optionNo:`跳过`,queued:`已排队 — 退出 Rove 后安装`,skillInstalled:`已为 {engines} 安装`,skillFailed:`安装失败:{reason}`,skillNoEngines:`这台机器上没有能装 skill 的编码 agent`,skipped:`已跳过`,installFailed:`! {item} 安装失败:{reason}。重试:{command}(或再次退出 Rove)。`,legend:`↑↓ 选择 · enter 确认 · esc 关闭`,keysTitle:`键盘基础`,keysBare:`裸键作用于当前聚焦面板 — {nav} 移动,{open} 打开。`,keysOnePress:`少量单次快捷键属于 Rove 自己 — {newTab} 新标签页,{focusNext} 切换面板。`,keysPrefix:`{prefix} 打开命令层 — 按住稍等会出现命令指南。`,keysHelp:`随时按 {help} 查看完整的实时键位表。`,keysNext:`接下来:设置 → 引擎 里列出每个引擎,并可在那里安装它们的活动钩子。`,keysLegend:`enter 完成`,appliedCompletions:`✓ 补全已写入 {path}(新开的 shell 生效)`,keptCompletions:`· {path} 里已有补全配置 — 未改动`},pi={title:`Quick task · {repoLabel}`,promptLabel:`PROMPT`,promptPlaceholder:`what should this task do?`,attemptsLabel:`ATTEMPTS`,engineLabel:`ENGINE`,branchLabel:`BRANCH`,legend:`enter create · tab fields · ctrl+e engine · ctrl+v attach · esc cancel`,startedRound:`Started {count} attempts`,roundPartial:`Started {ok}/{count} attempts — {failed} failed`},mi={title:`快速任务 · {repoLabel}`,promptLabel:`提示词`,promptPlaceholder:`这个任务要做什么?`,attemptsLabel:`尝试次数`,engineLabel:`引擎`,branchLabel:`分支`,legend:`enter 创建 · tab 切换字段 · ctrl+e 引擎 · ctrl+v 附件 · esc 取消`,startedRound:`已启动 {count} 个尝试`,roundPartial:`已启动 {ok}/{count} 个尝试 —— {failed} 个失败`},hi={cancel:`cancel`,forgetProjectTitle:`Remove project "{title}"?`,forgetProjectBody:"Forgets it from the projects list. The repo, its branches, worktrees, and any tasks under it stay on disk — re-add it with `rove add`.",forgetProjectConfirm:`remove`,deleteTitle:`Remove session "{title}"?`,deleteTitleDir:`Remove session "{title}"?`,deleteBodyDir:`Ends this session and closes all its tabs. Nothing on disk changes: the folder and its files stay.`,deleteBodyMain:`Ends this session and closes all its tabs. The project stays in your list and nothing on disk changes: the repo, its branches and worktrees stay.`,deleteBodyTask:`Ends this session, closes all its tabs and removes its worktree folder. The git branch stays.`,deleteBodyTaskBranch:`Ends this session, closes all its tabs and removes its worktree folder, and its git branch if it is merged. An unmerged branch stays.`,deleteConfirm:`remove`,childrenTitle:`"{title}" has {count} child tasks`,childrenBody:`Promote moves them up one level and keeps their worktrees and sessions. Remove with children removes them too.`,childrenPromote:`promote children`,childrenCascade:`remove with children`,childrenBodyMain:`Ends this session and closes its tabs; nothing on disk changes. Its child tasks keep running unless you delete them too.`,childrenKeepMain:`remove session`,childrenCascadeMain:`remove with children`,forceDeleteTitle:`"{title}" has uncommitted changes`,forceDeleteConfirm:`force remove`},gi={cancel:`取消`,forgetProjectTitle:`从列表中移除项目「{title}」?`,forgetProjectBody:"只是把它从项目列表里忘掉。仓库、分支、worktree 以及它下面的任务都会留在磁盘上——之后可以用 `rove add` 重新加回来。",forgetProjectConfirm:`移除`,deleteTitle:`移除会话「{title}」?`,deleteTitleDir:`移除会话「{title}」?`,deleteBodyDir:`结束这个会话,关闭它的所有标签页。磁盘上什么都不动:文件夹和里面的文件都会保留。`,deleteBodyMain:`结束这个会话,关闭它的所有标签页。项目仍留在列表里,磁盘上什么都不动:仓库、分支和 worktree 都会保留。`,deleteBodyTask:`结束这个会话,关闭它的所有标签页,并删除它的 worktree 文件夹。git 分支会保留。`,deleteBodyTaskBranch:`结束这个会话,关闭它的所有标签页,删除它的 worktree 文件夹,以及已合并的 git 分支。未合并的分支会保留。`,deleteConfirm:`移除`,childrenTitle:`「{title}」有 {count} 个子任务`,childrenBody:`提升会把它们上移一级,并保留它们的 worktree 和会话。连同子任务移除会把它们一并移除。`,childrenPromote:`提升子任务`,childrenCascade:`连同子任务移除`,childrenBodyMain:`结束这个会话并关闭它的标签页,磁盘上什么都不动。它的子任务会继续运行,除非你也选择把它们一并删除。`,childrenKeepMain:`移除会话`,childrenCascadeMain:`连同子任务移除`,forceDeleteTitle:`「{title}」有未提交的改动`,forceDeleteConfirm:`强制移除`},_i={noDaemonWorktree:"No daemon running — can't create the worktree. Start it with `rove daemon restart`.",noEditor:`No editor found — set ROVE_OPEN_EDITOR (e.g. 'code', 'cursor', 'nvim')`,openWorktreeFailed:`Couldn't open worktree with {label}`,worktreeErrorDeleting:`This task is being deleted — it can't be opened`,worktreeErrorNotGit:"This project isn't a git repo yet — a task needs a git branch. Run `git init` (+ a first commit) in the project, then open the task. Non-git support is coming.",worktreeErrorGeneric:`Couldn't create the worktree: {message}`,scratchAdopted:`Adopted into {repo} — save it as a project from New Task if you want it in the picker`,scratchOpenFailed:`Couldn't open a scratch shell: {message}`,scratchCloseFailed:`Couldn't close the scratch task: {message}`,worktreeGoneTitle:`Worktree for "{title}" is gone`,worktreeGoneBody:`Closed {count} tab(s). The branch {branch} is still there — reopen the task to re-create its worktree.`,checksPassingTitle:`Checks passed for "{title}"`,checksFailingTitle:`Checks failed for "{title}"`,checksResolvedBody:`PR {pr} on {branch}`,copiedId:`Copied task ID {text}`,copiedTab:`Copied tab address {text}`,copiedBranch:`Copied branch {text}`,copiedPath:`Copied path {text}`,copyFailed:`Couldn't reach a clipboard — no clipboard command on PATH, and this terminal refused OSC 52.`,forgetProjectFailed:`Couldn't remove the project — it stays in the projects list: {error}`,deleteFailed:`Couldn't delete "{title}" — the task and its worktree are untouched: {error}`,createFailed:`Couldn't create the task — nothing was created: {error}`,engineStartFailed:`Task created; engine did not start`,engineStartRetry:`{error}. Press ⏎ on the task to retry.`,forkFailed:`Couldn't fork the task — the original is untouched: {error}`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,childFailed:`Couldn't start the new conversation — the current one is untouched: {error}`,renameFailed:`Couldn't rename the task — it keeps its old title: {error}`,renameBranchFailed:`Couldn't rename the branch — it stays "{branch}": {error}`,switchEngineFailed:`Couldn't switch the engine — the task keeps the one it had: {error}`,setStatusFailed:`Couldn't set the status — it stays {status}: {error}`,pinFailed:`Couldn't change the pin — the task keeps its current place: {error}`,moveFailed:`Couldn't move the task — it keeps its current place: {error}`,moveToProjectFailed:`Couldn't move the task to that project — it stays where it was: {error}`,movedToProject:`Moved to {project} — the session and its checkout stay where they are`,issueChatFailed:`Couldn't start the issue chat — the issue is unchanged: {error}`,inboxMarkReadFailed:`Couldn't mark it read — it stays in the inbox: {error}`,inboxDismissFailed:`Couldn't dismiss it — it stays in the inbox: {error}`,engineSwitched:`Engine → {engine} (applies on reopen)`,statusSet:`Status → {status}`},vi={noDaemonWorktree:"守护进程未运行——无法创建 worktree。请运行 `rove daemon restart` 启动它。",noEditor:`未找到编辑器——请设置 ROVE_OPEN_EDITOR(如 'code'、'cursor'、'nvim')`,openWorktreeFailed:`无法用 {label} 打开 worktree`,worktreeErrorDeleting:`该任务正在删除中——无法打开`,worktreeErrorNotGit:"该项目尚非 git 仓库——任务需要 git 分支。请在项目中执行 `git init`(+ 首次提交)后再打开任务。非 git 项目的支持即将推出。",worktreeErrorGeneric:`无法创建 worktree:{message}`,scratchAdopted:`已归入 {repo}——若要出现在项目选择器里,可在新建任务中保存为项目`,scratchOpenFailed:`无法打开临时 Shell:{message}`,scratchCloseFailed:`无法关闭临时任务:{message}`,worktreeGoneTitle:`"{title}" 的 worktree 已消失`,worktreeGoneBody:`已关闭 {count} 个标签页。分支 {branch} 仍在——重新打开该任务会重建 worktree。`,checksPassingTitle:`「{title}」的 PR 检查已通过`,checksFailingTitle:`「{title}」的 PR 检查失败了`,checksResolvedBody:`PR {pr},分支 {branch}`,copiedId:`已复制任务 ID {text}`,copiedTab:`已复制标签页地址 {text}`,copiedBranch:`已复制分支 {text}`,copiedPath:`已复制路径 {text}`,copyFailed:`无法访问剪贴板——PATH 上没有剪贴板命令,这个终端也拒绝了 OSC 52。`,forgetProjectFailed:`移除项目失败——它仍在项目列表里:{error}`,deleteFailed:`删除「{title}」失败——任务和它的 worktree 都没有被改动:{error}`,createFailed:`创建任务失败——什么都没有被创建:{error}`,engineStartFailed:`任务已创建,引擎没有启动`,engineStartRetry:`{error}。在任务上按 ⏎ 重试。`,forkFailed:`fork 任务失败——原任务没有被改动:{error}`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,childFailed:`无法开始新对话——当前对话没有被改动:{error}`,renameFailed:`重命名任务失败——它仍用原来的标题:{error}`,renameBranchFailed:`重命名分支失败——它仍是「{branch}」:{error}`,switchEngineFailed:`切换引擎失败——任务仍使用原来的引擎:{error}`,setStatusFailed:`设置状态失败——它仍是 {status}:{error}`,pinFailed:`修改置顶状态失败——任务仍在原来的位置:{error}`,moveFailed:`移动任务失败——它仍在原来的位置:{error}`,moveToProjectFailed:`移到该项目失败——任务仍在原来的项目:{error}`,movedToProject:`已移到 {project}——会话和它的工作目录都没有动`,issueChatFailed:`启动议题会话失败——议题没有被改动:{error}`,inboxMarkReadFailed:`标记为已读失败——它仍留在收件箱里:{error}`,inboxDismissFailed:`忽略失败——它仍留在收件箱里:{error}`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,statusSet:`状态 → {status}`},yi={nav:{kanban:`Kanban`,automations:`Routines`,issues:`Issues`,mods:`Mods`},header:{scratch:`Ungrouped`},search:{placeholder:`fuzzy filter`},sort:{label:`sort: {mode}`,hint:`Change the order (manual → newest → attention → name)`,reorderSwitched:`Reorder needs manual order — switched`,modes:{default:`manual`,recent:`newest`,attention:`attention`,name:`name`}},menu:{open:`Open`,collapseChildren:`Collapse children`,expandChildren:`Expand children`,newChat:`New conversation`,newShell:`New shell`,continueEngine:`Continue in another engine…`,newScratchChat:`New conversation (no folder)`,newTask:`New task`,newTaskFromBranch:`New task from this branch`,forgetProject:`Remove project`,fieldNotes:`Field notes`,rename:`Rename`,pin:`Pin`,unpin:`Unpin`,reorder:`Reorder row`,moveToTop:`Move to top`,reorderProject:`Reorder project`,runAgain:`Run again`,setStatus:`Set status`,moveToProject:`Move to project…`,copyId:`Copy task ID`,copyBranch:`Copy branch name`,copyPath:`Copy path`,openEditor:`Open in editor`,renameBranch:`Rename branch`,changeEngine:`Change engine`,fixChecks:`Fix failing checks`,rerunChecks:`Re-run failed checks`,syncBase:`Sync with base`,resolveConflicts:`Resolve conflicts`,land:`Land into base branch`,archive:`Archive`,unarchive:`Unarchive`,delete:`Remove session`},status:{backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},setStatus:{title:`Set status`,current:`current`,footer:`↑↓ choose · enter set · esc cancel`},moveToProject:{title:`Move to project`,empty:"No other project yet — add one first, or run `rove api update --project PATH`",footer:`↑↓ choose · enter move · esc cancel`},sync:{done:`Merged {base} into this worktree`,alreadyCurrent:`Already up to date with {base}`,conflict:`Merge conflict — resolve then commit: {files}`,dirty:`Commit the worktree's changes first, then sync: {files}`,failed:`Sync failed: {error}`},archive:{done:`Archived {title}. Its worktree, branch and sessions are untouched`,restored:`Restored {title}`,busyTitle:`Archive while it's working?`,busyBody:`An engine in {title} is still working or waiting on you. Archiving hides the row without stopping it.`,busyConfirm:`Archive anyway`,failed:`Couldn't archive: {error}`,restoreFailed:`Couldn't restore: {error}`},rerun:{started:`Re-running failed checks`,none:`No failed checks to re-run`,external:`These checks didn't run on GitHub Actions; re-run them where they ran`,refused:`Re-run refused: {detail}`},changeEngine:{title:`Change engine`,current:`current`,effortLabel:`EFFORT`,noEffort:`engine default`,footer:{engine:`↑↓ engine`,effort:`←→ effort`,model:`tab model`,set:`enter set`,cancel:`esc cancel`}},engineModel:{label:`MODEL`,placeholder:`engine default`,loading:`listing models…`},tier:{swift:`swift`,standard:`standard`,deep:`deep`,manual:`manual`},tierDesc:{swift:`small, well-specified edits — the fastest, cheapest setting`,standard:`everyday feature work and bug fixes`,deep:`hard problems: unclear root causes, large refactors, design decisions`},runAgain:{title:`Run again`,source:`Brief from “{title}”`,hint:`Runs this brief again in a new task, on its own branch and worktree.`,confirm:`Run again`,footer:`↑↓ scroll · ←→ choose · enter run · esc cancel`},fieldNotes:{title:`Field notes`,empty:"No field notes for this repo yet — agents file one with `rove api note`.",loading:`Loading…`,footer:`↑↓ scroll · esc close`,footerDeletable:`↑↓ select · d delete · esc close`,confirmDelete:{title:`Delete this field note?`,body:`“{text}” stops being injected into new sessions on this repo. Nothing else changes.`}},confirm:hi,renameBranch:{title:`Rename branch`,fieldLabel:`branch`},moveChip:` move`,recentJump:`Recent: {title}`,archivedHit:`{title} · archived, enter unarchives`,machine:{connecting:`connecting…`,offline:`offline`,unsupported:`unsupported`,mismatch:`protocol mismatch`,filesElsewhere:`on {host}`,filesHint:`{host} is unreachable right now; its files show here again when it reconnects.`,terminalElsewhere:`This task runs on {host}, which is unreachable right now.`,runsOn:`on {host}`,noTabs:`No tabs on {host} yet — prefix t opens one there.`},empty:{noMatchSearch:`No matching tasks — esc to clear.`,noActiveProject:`No active tasks for this project.`,noActive:`No active tasks — create one above.`},activity:{working:`working`,rateLimited:`rate limited`,permissionNeeded:`needs permission`,error:`error`,dead:`engine exited`},group:{waitingOnYou:`needs you`,landing:`ready to land`,readyForReview:`needs review`,working:`working`},subtitle:{noTracking:`no activity tracking`,materializing:`materializing`,deleting:`deleting`,deleteFailed:`delete failed`},reBranch:{title:`Set branch`,fieldLabel:`branch`,hintNoBranches:`(no local branches — type a new name)`,hintNoMatch:`(no match — enter renames to this branch)`,footer:`↑↓ pick · enter set · esc cancel`},toast:_i},bi={nav:{kanban:`看板`,automations:`例行任务`,issues:`议题`,mods:`Mods`},header:{scratch:`未分组`},search:{placeholder:`模糊搜索`},sort:{label:`排序:{mode}`,hint:`切换排序(手动 → 最新 → 关注 → 名称)`,reorderSwitched:`调整顺序需手动排序,已切换`,modes:{default:`手动`,recent:`最新`,attention:`关注`,name:`名称`}},menu:{open:`打开`,collapseChildren:`折叠子任务`,expandChildren:`展开子任务`,newChat:`新建会话`,newShell:`新建终端`,continueEngine:`换个引擎继续…`,newScratchChat:`新建会话(无文件夹)`,newTask:`新建任务`,newTaskFromBranch:`基于此分支新建任务`,forgetProject:`移除项目`,fieldNotes:`现场笔记`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,reorder:`重新排序`,moveToTop:`移到顶部`,reorderProject:`调整项目顺序`,runAgain:`重新运行`,setStatus:`设置状态`,moveToProject:`移到其他项目…`,copyId:`复制任务 ID`,copyBranch:`复制分支名`,copyPath:`复制路径`,openEditor:`在编辑器中打开`,renameBranch:`重命名分支`,changeEngine:`切换引擎`,fixChecks:`修复失败的检查`,rerunChecks:`重新运行失败的检查`,syncBase:`同步基础分支`,resolveConflicts:`让 agent 解决冲突`,land:`合入基础分支`,archive:`归档`,unarchive:`取消归档`,delete:`移除会话`},status:{backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},setStatus:{title:`设置状态`,current:`当前`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},moveToProject:{title:`移到其他项目`,empty:"还没有其他项目——先添加一个,或运行 `rove api update --project PATH`",footer:`↑↓ 选择 · enter 移动 · esc 取消`},sync:{done:`已把 {base} 合并进该工作树`,alreadyCurrent:`已经和 {base} 同步`,conflict:`合并冲突——解决后提交:{files}`,dirty:`请先提交工作树里的改动,再同步:{files}`,failed:`同步失败:{error}`},archive:{done:`已归档 {title}。工作树、分支和会话都保持原样`,restored:`已恢复 {title}`,busyTitle:`它还在工作,仍要归档?`,busyBody:`{title} 里有引擎仍在工作或在等你。归档只隐藏这一行,不会停止它。`,busyConfirm:`仍要归档`,failed:`归档失败:{error}`,restoreFailed:`恢复失败:{error}`},rerun:{started:`正在重新运行失败的检查`,none:`没有可重新运行的失败检查`,external:`这些检查不是在 GitHub Actions 上运行的,请到它们运行的地方重新运行`,refused:`无法重新运行:{detail}`},changeEngine:{title:`切换引擎`,current:`当前`,effortLabel:`推理强度`,noEffort:`引擎默认`,footer:{engine:`↑↓ 引擎`,effort:`←→ 强度`,model:`tab 模型`,set:`enter 设置`,cancel:`esc 取消`}},engineModel:{label:`模型`,placeholder:`引擎默认`,loading:`正在列出模型…`},tier:{swift:`轻快`,standard:`标准`,deep:`深入`,manual:`手动`},tierDesc:{swift:`小而明确的改动——最快、最省的一档`,standard:`日常的功能开发和修 bug`,deep:`难题:根因不明、大重构、设计决策`},runAgain:{title:`重新运行`,source:`来自任务「{title}」的指令`,hint:`在新任务里重新执行这段指令,新任务有自己的分支和工作树。`,confirm:`重新运行`,footer:`↑↓ 滚动 · ←→ 选择 · enter 运行 · esc 取消`},confirm:gi,renameBranch:{title:`重命名分支`,fieldLabel:`分支`},fieldNotes:{title:`现场笔记`,empty:"该仓库暂无现场笔记——agent 可用 `rove api note` 记录。",loading:`加载中…`,footer:`↑↓ 滚动 · esc 关闭`,footerDeletable:`↑↓ 选择 · d 删除 · esc 关闭`,confirmDelete:{title:`删除这条现场笔记?`,body:`「{text}」将不再注入该仓库的新会话。其他内容不受影响。`}},moveChip:` 移动`,recentJump:`最近:{title}`,archivedHit:`{title} · 已归档,回车恢复`,machine:{connecting:`连接中…`,offline:`离线`,unsupported:`不支持`,mismatch:`协议不兼容`,filesElsewhere:`在 {host} 上`,filesHint:`{host} 暂时连不上;重新连上后这里会再显示它的文件。`,terminalElsewhere:`这个任务跑在 {host} 上,暂时连不上。`,runsOn:`在 {host} 上`,noTabs:`{host} 上还没有 tab——按 prefix t 在那里新开一个。`},empty:{noMatchSearch:`无匹配任务——按 esc 清除。`,noActiveProject:`该项目暂无活跃任务。`,noActive:`暂无活跃任务——在上方新建。`},activity:{working:`运行中`,rateLimited:`请求受限`,permissionNeeded:`等待授权`,error:`错误`,dead:`引擎已退出`},group:{waitingOnYou:`等你处理`,landing:`可以合了`,readyForReview:`待你验收`,working:`运行中`},subtitle:{noTracking:`不跟踪活动`,materializing:`正在创建 worktree`,deleting:`正在删除`,deleteFailed:`删除失败`},reBranch:{title:`设置分支`,fieldLabel:`分支`,hintNoBranches:`(没有本地分支——输入新名称)`,hintNoMatch:`(无匹配——回车将分支重命名为此名)`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},toast:vi},xi={noTask:`(no task — press n to create)`,exited:`process exited — F5 restarts it`,engineExit:{title:`Engine exited`,titleCode:`Engine exited (code {code})`,retry:`Retry`,settings:`Settings → Engines`,another:`Another engine`,continueIn:`Continue in another engine`},usageLimit:{title:`Usage limit reached`,dismiss:`Dismiss`},restoring:`restoring session…`,recovery:{live:`Live process reattached`,relaunched:`Command relaunched in a new process. Any restored output is historical; check the engine to resume or continue your conversation.`,restored:`Historical screen restored; previous process ended. Restart and check the engine before continuing.`},tab:{groupTitle:`group {n}`,renameTitle:`Rename tab`,renameField:`TAB TITLE`,renameSubmit:`rename`,chooseEngineHint:`←/→ or h/l choose, enter confirm, esc cancel`,newChat:{title:`New conversation`,engine:`ENGINE`,destLabel:`DESTINATION`,destTab:`child task, same directory`,destFork:`fork a child task (new worktree)`,destScratch:`new scratch task ($HOME)`,ctxLabel:`CONTEXT`,ctxFresh:`fresh conversation`,ctxContinue:`continue this conversation`},cannotCloseLast:`Cannot close the only tab`,tabGone:`That tab is no longer there`,closeOthersTitle:`Close the other tabs?`,closeOthersBody:`Closing {count} · their sessions end, this tab stays open.`,closeOthersConfirm:`close tabs`,closeOthersCancel:`cancel`,menu:{rename:`Rename tab`,copyAddress:`Copy tab address`,continueEngine:`Continue in another engine…`,closeOthers:`Close other tabs`,close:`Close tab`},nothingToFork:`No conversation in this tab to fork yet`,noTranscriptToHandOff:`{engine} keeps no readable transcript to hand over`},split:{renameTitle:`Rename split`,renameField:`SPLIT NAME`},scrolledBack:`↑ scrolled {lines}L`,scrollFirst:`[first]`,scrollLatest:`[latest]`,unavailable:{shellMissing:`terminal unavailable — the shell named by $SHELL isn't on this machine. Point $SHELL at one that exists, or unset it to fall back to the system default.`,spawnFailed:`terminal unavailable — the shell exited immediately. Its error is in ~/.rove/pty.log.`,retry:`F5 tries again`},reset:{title:`Reset terminal?`,body:`The running shell will be killed and a fresh one will spawn at the worktree. Any in-flight processes (vim, htop, paused jobs) end immediately.`}},Si={recovery:{live:`已重新连接仍在运行的进程`,relaunched:`命令已在新进程中重启。如有恢复的输出,它属于历史记录;请在引擎内确认会话恢复或继续操作。`,restored:`已恢复历史画面;原进程已结束。请重启并确认引擎状态后继续。`},noTask:`(无任务 —— 按 n 创建)`,exited:`进程已退出 —— 按 F5 重启`,engineExit:{title:`引擎已退出`,titleCode:`引擎已退出(退出码 {code})`,retry:`重试`,settings:`设置 → 引擎`,another:`换个引擎`,continueIn:`换个引擎继续`},usageLimit:{title:`已达到用量上限`,dismiss:`忽略`},restoring:`正在恢复会话…`,tab:{groupTitle:`group {n}`,renameTitle:`重命名标签页`,renameField:`标签页名称`,renameSubmit:`重命名`,chooseEngineHint:`←/→ 或 h/l 选择,enter 确认,esc 取消`,newChat:{title:`新建对话`,engine:`引擎`,destLabel:`落点`,destTab:`子任务,同一目录`,destFork:`fork 子任务(新 worktree)`,destScratch:`新临时任务($HOME)`,ctxLabel:`上下文`,ctxFresh:`全新对话`,ctxContinue:`接着当前对话`},cannotCloseLast:`无法关闭唯一的标签页`,tabGone:`这个标签页已经不在了`,closeOthersTitle:`关闭其他标签页?`,closeOthersBody:`将关闭 {count} 个,它们的会话会结束,只保留这个标签页。`,closeOthersConfirm:`关闭标签页`,closeOthersCancel:`取消`,menu:{rename:`重命名标签页`,copyAddress:`复制标签页地址`,continueEngine:`换个引擎继续…`,closeOthers:`关闭其他标签页`,close:`关闭标签页`},nothingToFork:`这个标签页还没有可派生的对话`,noTranscriptToHandOff:`{engine} 没有可读的对话记录,无法交接`},split:{renameTitle:`重命名分屏`,renameField:`分屏名称`},scrolledBack:`↑ 已回滚 {lines} 行`,scrollFirst:`[最早]`,scrollLatest:`[最新]`,unavailable:{shellMissing:`终端不可用 —— $SHELL 指向的 shell 在这台机器上不存在。请把 $SHELL 指向一个真实存在的 shell,或取消设置以回退到系统默认。`,spawnFailed:`终端不可用 —— shell 启动后立即退出。具体错误见 ~/.rove/pty.log。`,retry:`按 F5 重试`},reset:{title:`重置终端?`,body:`正在运行的 shell 会被杀掉并在 worktree 重新启动,进行中的进程(vim、htop、暂停的任务)会立即结束。`}},Ci={pageTitle:`ROVE UPDATE`,closeHint:`q / esc close`,chip:`↑ {version}`,current:`current`,available:`v{version} available`,latest:`latest`,latestUnknown:`unknown — could not reach the registry`,registryRetry:`Check your connection, then close and reopen Update to retry.`,upToDate:`No newer release — nothing to install.`,releaseUrlUnavailable:`release URL unavailable; visit github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`Opened release page in your browser.`,statusReleaseError:`Could not open release URL. Visit github.com/Sma1lboy/rove/releases in your browser.`,statusRunningUpdater:`Closing the TUI and running the updater in this terminal...`,loadingNotes:`Loading release notes...`,notesUnavailable:`Release notes are unavailable. Use Open release to view the GitHub release page.`,changesSectionHeader:`── changes from v{from} to v{to} ──`,updateComplete:`Rove update complete. Relaunch Rove to use the new version.`,updateFailed:"Rove update failed with exit code {code}. Check the output above, then run `rove update` to retry.",pressAnyKey:`Press any key to close this update window.`,webRunning:`Running {command} …`,webInstalled:"Installed. The daemon and this web bridge still run v{current}: run `rove daemon restart`, then restart `rove --web`. The page reloads itself once the bridge runs the new version.",webStartFailed:`Could not start the updater: {error}`,actions:{updateNow:`Update now`,openRelease:`Open release`,close:`Close`,closeDetail:`return to the workspace`},whatsNew:{title:`WHAT'S NEW`,closeHint:`q / esc continue`,upgraded:`You're now on Rove v{to}, up from v{from}. Here's what changed.`,notesUnavailable:`Could not load the release notes — check your connection, or read them on GitHub.`,sourceHint:`release notes: {url}`},skew:{title:`⚠ DAEMON OUT OF DATE`,olderBuild:`an older build`,hint:`daemon is {daemon} — you launched v{clientVersion}. Press {keys} to refresh Rove onto the installed build`,hintNoKey:"daemon is {daemon} — you launched v{clientVersion}. Run `rove daemon restart`, then relaunch Rove"},refresh:{confirmTitle:`Refresh Rove?`,confirmBody:`Rove restarts the daemon and relaunches itself on the installed build. Running engine sessions live in the PTY host and keep going; open tabs come back.`,confirmLabel:`Refresh`,relaunching:`rove: restarting on the installed build...`,alreadyCurrent:`Rove and the daemon already run the same build — nothing to refresh.`,installGone:"This Rove was installed from a directory that no longer exists, so it cannot relaunch itself. Reinstall with `npm install -g @sma1lboy/rove`."},staleInstall:{title:`✕ ROVE INSTALL IS GONE`,hint:"this Rove is running from an install that no longer exists on disk, so it cannot start a daemon. Reinstall (`npm install -g @sma1lboy/rove`) and relaunch Rove"},versions:{pageTitle:`ROVE VERSIONS`,loading:`Loading releases...`,unavailable:`Could not fetch releases. Check your connection or wait for the rate limit, then reopen this page.`,tagCurrent:`current`,tagLatest:`latest`,tagBreaking:`breaking`,breakingWarning:"⚠ installing this crosses breaking version(s) {versions}. Rove will refuse to start until you run `rove reset`, which stops the daemon, the PTY host, and every live session. Tasks and worktrees are kept.",footerHint:`j/k select · enter install · q close`,closeHint:`q / esc close`}},wi={pageTitle:`ROVE 更新`,closeHint:`q / esc 关闭`,chip:`↑ {version}`,current:`当前`,available:`有新版本 v{version}`,latest:`最新`,latestUnknown:`未知 —— 无法连接到 registry`,registryRetry:`请检查网络,然后关闭并重新打开更新页重试。`,upToDate:`没有更新的版本 —— 无需安装。`,releaseUrlUnavailable:`发布链接不可用;请访问 github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`已在浏览器中打开发布说明页面。`,statusReleaseError:`无法打开发布链接。请在浏览器访问 github.com/Sma1lboy/rove/releases。`,statusRunningUpdater:`正在关闭 TUI,并在当前终端中运行更新程序……`,loadingNotes:`正在加载发布说明……`,notesUnavailable:`发布说明不可用。请使用「打开发布页」查看 GitHub 发布页面。`,changesSectionHeader:`── v{from} 至 v{to} 的变更 ──`,updateComplete:`Rove 更新完成。请重新启动 Rove 以使用新版本。`,updateFailed:"Rove 更新失败,退出码为 {code}。请检查上方输出,再运行 `rove update` 重试。",pressAnyKey:`按任意键关闭此更新窗口。`,webRunning:`正在运行 {command} …`,webInstalled:"已安装。daemon 和这个 web bridge 仍在跑 v{current}:先运行 `rove daemon restart`,再重启 `rove --web`。bridge 换到新版本后,页面会自动刷新。",webStartFailed:`无法启动更新程序:{error}`,actions:{updateNow:`立即更新`,openRelease:`打开发布页`,close:`关闭`,closeDetail:`返回工作区`},whatsNew:{title:`更新内容`,closeHint:`q / esc 继续`,upgraded:`Rove 已从 v{from} 更新到 v{to},本次变更如下。`,notesUnavailable:`无法加载发布说明 —— 请检查网络连接,或到 GitHub 上查看。`,sourceHint:`发布说明:{url}`},skew:{title:`⚠ DAEMON 版本不一致`,olderBuild:`旧版本构建`,hint:`daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。按 {keys} 可让 Rove 刷新到已安装的版本`,hintNoKey:"daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。请运行 `rove daemon restart`,然后重新启动 Rove"},refresh:{confirmTitle:`刷新 Rove?`,confirmBody:`Rove 会重启 daemon,并以已安装的版本重新启动自身。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。`,confirmLabel:`刷新`,relaunching:`rove:正在以已安装的版本重新启动……`,alreadyCurrent:`Rove 与 daemon 已经是同一个版本 —— 无需刷新。`,installGone:"当前 Rove 的安装目录已不存在,无法重新启动自身。请运行 `npm install -g @sma1lboy/rove` 重新安装。"},staleInstall:{title:`✕ ROVE 安装已不存在`,hint:"当前 Rove 运行自一份已从磁盘删除的安装,因此无法启动 daemon。请重新安装(`npm install -g @sma1lboy/rove`)并重新启动 Rove"},versions:{pageTitle:`ROVE 版本列表`,loading:`正在加载发布列表……`,unavailable:`无法获取发布列表。请检查网络或等待限流解除,然后重新打开本页。`,tagCurrent:`当前`,tagLatest:`最新`,tagBreaking:`breaking`,breakingWarning:"⚠ 安装该版本会跨过 breaking 版本 {versions}。更新后 Rove 会拒绝启动,直到你运行 `rove reset`——它会停掉 daemon、PTY host 和所有活动会话。任务和 worktree 会保留。",footerHint:`j/k 选择 · enter 安装 · q 关闭`,closeHint:`q / esc 关闭`}},Ti={quit:{confirmTitle:`Quit Rove?`,confirmBody:`The daemon and task sessions keep running. This closes only the native workspace.`,confirmLabel:`Quit`},narrowBack:`Tasks`,empty:{selectTask:`Select a task with a worktree`,noSessions:`No sessions here — press ⏎ to start {engine}, or ctrl+e to pick another`,noSessionsShell:`No sessions here — press ⏎ to start a shell, or ctrl+e to pick another`,remoteUnsupported:`Hosted engine launch over SSH is not implemented — this task's worktree is on {host}`},welcome:{title:`Welcome to Rove`,tagline:`All your coding agents in one place: when one runs out of quota, switch the task to another, and agents talk to each other directly.`,worktreeExplain:`Managed tasks create isolated worktrees and branches. Directory and project tasks reuse existing files; tabs within a task share its directory.`,stepNew:`creates your first task — pick a repo, a base branch, an engine`,stepHelp:`shows every shortcut reachable from the current focus`,stepPrefix:`opens the command menu`,enginesFound:`✓ engines: {list}`,enginesSignedOut:`✗ installed but not signed in: {list} — run one of them in a shell and log in`,enginesMissing:`✗ no engine CLI found — install claude, codex, copilot, or kimi, then restart Rove`,gitMissing:`✗ git not found on PATH — Rove needs git to create worktrees`,doctorHint:"run `rove doctor` in a shell for the full diagnosis",docsHint:`docs: https://docs.rove.run`},attention:{none:`No available Inbox items`},inbox:{title:`INBOX`,empty:`No pending attention`,openHint:`enter open`,clearHint:`d ack`,clearAllHint:`D ack all`,more:`+{count} more`,section:{attention:`ATTENTION`,recent:`RECENT`},state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,running:`running`,dead:`engine exited`,routineFailed:`routine needs you`,reportMissing:`report missing`,decisionNeeded:`decision needed`,gateAnswered:`answered · engine not running`},resumesAt:`resumes {time}`}},Ei={quit:{confirmTitle:`退出 Rove?`,confirmBody:`守护进程和任务会话会继续运行,这里只关闭原生工作区。`,confirmLabel:`退出`},narrowBack:`任务`,empty:{selectTask:`请选择一个带 worktree 的任务`,noSessions:`这里没有会话——按 ⏎ 启动 {engine},或按 ctrl+e 另选一个`,noSessionsShell:`这里没有会话——按 ⏎ 启动 shell,或按 ctrl+e 另选一个`,remoteUnsupported:`尚未实现通过 SSH 启动托管引擎——该任务的 worktree 在 {host} 上`},welcome:{title:`欢迎使用 Rove`,tagline:`所有编程 agent 都在一个地方:一个额度用完了,换另一个接着干;agent 之间直接对话,不用你传话。`,worktreeExplain:`托管任务创建独立的 worktree 和分支。目录与项目任务复用现有文件;同一任务内的标签页共享目录。`,stepNew:`创建你的第一个任务——选仓库、基础分支和引擎`,stepHelp:`查看当前焦点下的全部快捷键`,stepPrefix:`打开命令菜单`,enginesFound:`✓ 已检测到引擎:{list}`,enginesSignedOut:`✗ 已安装但未登录:{list}——请在 shell 里运行其中之一并完成登录`,enginesMissing:`✗ 未找到引擎 CLI——请安装 claude、codex、copilot 或 kimi 后重启 Rove`,gitMissing:`✗ PATH 上没有 git——Rove 需要 git 来创建 worktree`,doctorHint:"在 shell 里运行 `rove doctor` 查看完整诊断",docsHint:`文档:https://docs.rove.run`},attention:{none:`收件箱中没有可打开的项目`},inbox:{title:`收件箱`,empty:`暂无待处理`,openHint:`enter 打开`,clearHint:`d 已阅`,clearAllHint:`D 全部已阅`,more:`还有 {count} 条`,section:{attention:`待处理`,recent:`最近使用`},state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,running:`进行中`,dead:`引擎已退出`,routineFailed:`例行任务需要处理`,reportMissing:`未回报`,decisionNeeded:`等你决定`,gateAnswered:`已回答 · 引擎未运行`},resumesAt:`{time} 恢复`}},Di={title:`Worktrees`,loading:`Loading worktrees…`,noProjects:`No local projects known to Rove yet.`,loadFailed:`Could not read the worktrees: {message}`,noWorktrees:`No worktrees.`,badge:{roveManaged:`rove`,dirty:`dirty`,dirtyUnknown:`dirty?`,remoteOn:`on remote`,remoteOff:`not pushed`,remoteUnknown:`remote unknown`},verdict:{prOpen:`PR open`,prMerged:`merged (PR)`,inMain:`in main`,prClosed:`PR closed`,idle:`stale`},row:{detached:`(detached)`,created:`created {age} ago`},delete:{button:`Delete`,confirmTitle:`Delete worktree?`,confirmBody:`Delete the worktree for "{branch}"? This removes the working directory; the branch itself is kept.`,forceTitle:`Force delete worktree?`,forceBody:'"{branch}" has uncommitted, untracked, or gitignored work. Force delete removes the worktree, but the work is snapshotted first to a salvage ref — list them with `git for-each-ref refs/rove/salvage`. Force delete anyway?',forceReason:`Refused because: {reason}`,failed:`Failed to delete worktree: {error}`,residue:`Git deregistered the worktree, but couldn't delete {path} ({reason}). Rove is done with it — retrying won't help; delete the directory by hand if you want the space.`},land:{button:`Land`,confirmTitle:`Land branch?`,confirmBody:`Merge "{branch}" into {landedOn} ({commits} commits), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,confirmBodyOne:`Merge "{branch}" into {landedOn} (1 commit), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,noTask:`This worktree isn't tracked as a Rove task — nothing to land.`,conflict:`Land hit conflicts (merge aborted). Resolve by hand: {files}`,dirtyBase:"The base checkout has uncommitted changes — commit them, then land. Never `git stash` here: the stash stack lives in the repo's common dir and is shared by every linked worktree, so a stash can entangle other tasks' work.",failed:`Land failed: {error}`,done:`Landed "{branch}" onto {landedOn} ({commit}).`,worktreeKept:`Landed, but the worktree was kept: {reason}`,worktreePathStale:`Landed and removed the worktree, but the task still points at it: {reason}`,worktreeResidue:`Landed. Git deregistered the worktree, but couldn't delete {path} ({reason}) — delete the directory by hand if you want the space.`},hint:{}},Oi={title:`工作树`,loading:`正在加载 worktree…`,noProjects:`Rove 还没有已知的本地项目。`,loadFailed:`读不到 worktree 列表:{message}`,noWorktrees:`没有 worktree。`,badge:{roveManaged:`rove`,dirty:`有改动`,dirtyUnknown:`改动未知`,remoteOn:`已推送`,remoteOff:`未推送`,remoteUnknown:`远端未知`},verdict:{prOpen:`PR 评审中`,prMerged:`已合入 (PR)`,inMain:`已在主分支`,prClosed:`PR 已关闭`,idle:`陈旧`},row:{detached:`(游离状态)`,created:`{age}前创建`},delete:{button:`删除`,confirmTitle:`删除 worktree?`,confirmBody:`确定删除 "{branch}" 对应的 worktree?工作目录会被移除,分支本身会保留。`,forceTitle:`强制删除 worktree?`,forceBody:'"{branch}" 存在未提交、未跟踪或被 gitignore 的改动。强制删除会移除 worktree,但这些改动会先被快照到一个 salvage ref——用 `git for-each-ref refs/rove/salvage` 可以列出它们。仍要强制删除吗?',forceReason:`拒绝原因:{reason}`,failed:`删除 worktree 失败:{error}`,residue:`Git 已注销该 worktree,但没能删掉 {path}({reason})。Rove 这边已经处理完了——重试没有用;想要回磁盘空间请手动删除该目录。`},land:{button:`合入`,confirmTitle:`合入分支?`,confirmBody:`把 "{branch}" 合入 {landedOn}({commits} 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,confirmBodyOne:`把 "{branch}" 合入 {landedOn}(1 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,noTask:`该 worktree 未作为 Rove 任务被跟踪——没有可合入的对象。`,conflict:`合入遇到冲突(已中止)。请手动解决:{files}`,dirtyBase:"基础检出有未提交改动——请先提交再合入。绝不要在这里 `git stash`:stash 栈存放在仓库的 common dir 中,该仓库所有 linked worktree 共享,一次 stash 可能纠缠其他任务的工作。",failed:`合入失败:{error}`,done:`已把 "{branch}" 合入 {landedOn}({commit})。`,worktreeKept:`已合入,但 worktree 保留了:{reason}`,worktreePathStale:`已合入并移除 worktree,但任务仍指向它:{reason}`,worktreeResidue:`已合入。Git 已注销该 worktree,但没能删掉 {path}({reason})——想要回磁盘空间请手动删除该目录。`},hint:{}},ki={common:{en:ri,zh:ii},doctor:{en:ai,zh:oi},files:{en:si,zh:ci},newTask:{en:li,zh:ui},onboarding:{en:di,zh:fi},quickTask:{en:pi,zh:mi},tasks:{en:yi,zh:bi},terminal:{en:xi,zh:Si},update:{en:Ci,zh:wi},workspace:{en:Ti,zh:Ei},worktrees:{en:Di,zh:Oi}};function W(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function G(e,t,n){let r=ki[e],i=W(r[At.get()],t)??W(r.en,t)??t;return n?i.replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??e)):i}var Ai=[{id:`chat.tab.new`,scope:`workspace`,keys:[`ctrl+t`],category:`Workspace`,description:`New chat tab`,hint:{keys:`ctrl+t`},presentation:`onePress`},{id:`chat.tab.chooseEngine`,scope:`workspace`,keys:[`ctrl+e`],category:`Workspace`,description:`New conversation — engine/shell picker with destination + context toggles`,hint:{keys:`ctrl+e`},presentation:`onePress`},{id:`chat.tab.fork`,scope:`workspace`,keys:[],prefixKeys:[`c`],category:`Workspace`,description:`Fork this chat into a new tab (same Task directory, keeps the conversation)`,hint:{keys:`ctrl+a c`}},{id:`chat.fork.new`,scope:`workspace`,keys:[],prefixKeys:[`f`],category:`Workspace`,description:`Quick-fork: create child task seeded with current repo/branch/model`,hint:{keys:`ctrl+a f`}},{id:`chat.tab.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close chat tab`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.reopenSession`,scope:`workspace`,keys:[`return`],category:`Workspace`,description:`Reopen a session in a task whose tabs are all closed`,hint:{keys:`enter`},presentation:`onePress`},{id:`chat.tab.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active chat tab`,hint:{keys:`f2`},presentation:`onePress`},{id:`chat.tab.cycle-next`,scope:`workspace`,keys:[`ctrl+]`],category:`Workspace`,description:`Next chat tab`,hint:{keys:`ctrl+]`},presentation:`onePress`},{id:`chat.tab.cycle-prev`,scope:`workspace`,keys:[`ctrl+[`],category:`Workspace`,description:`Previous chat tab`,hint:{keys:`ctrl+[`},presentation:`onePress`},{id:`chat.tab.goto`,scope:`workspace`,keys:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),category:`Workspace`,description:`Go to chat tab N`,hint:{keys:`ctrl+1-9`},presentation:`onePress`},{id:`workspace.split.right`,scope:`workspace`,keys:[`ctrl+\\`],category:`Workspace`,description:`Split right`,hint:{keys:`ctrl+\\`},presentation:`onePress`},{id:`workspace.split.down`,scope:`workspace`,keys:[`ctrl+=`],category:`Workspace`,description:`Split down`,hint:{keys:`ctrl+=`},presentation:`onePress`},{id:`workspace.split.focus-next`,scope:`workspace`,keys:[`f3`],category:`Workspace`,description:`Focus next split`,hint:{keys:`f3`},presentation:`onePress`},{id:`workspace.split.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close active split (tab when unsplit)`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.split.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active split (tab when unsplit)`,hint:{keys:`f2`},presentation:`onePress`}],ji=[{id:`files.nav`,scope:`files`,keys:[`j`,`k`,`down`,`up`],category:`Files`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`files.hierarchy`,scope:`files`,keys:[`h`,`l`,`left`,`right`],category:`Files`,description:`Collapse / expand tree level`,hint:{keys:`h/l`}},{id:`files.open`,scope:`files`,keys:[`return`],category:`Files`,description:`Open file in configured editor (diff when supported)`,hint:{keys:`enter`}},{id:`files.tab`,scope:`files`,keys:[`[`,`]`],category:`Files`,description:`Switch tab (cycle All / Changes)`,hint:{keys:`[/]`}},{id:`files.refresh`,scope:`files`,keys:[`r`],category:`Files`,description:`Refresh`,hint:{keys:`r`}},{id:`files.scope`,scope:`files`,keys:[`b`],category:`Files`,description:`Toggle Changes scope (working ↔ branch vs base)`,hint:{keys:`b`}},{id:`files.diff`,scope:`files`,keys:[`d`],category:`Files`,description:`Open read-only diff in a workspace tab`,hint:{keys:`d`}},{id:`files.diffAll`,scope:`files`,keys:[`shift+d`],category:`Files`,description:`Open the whole worktree's diff in one workspace tab`,hint:{keys:`D`}},{id:`files.openExternal`,scope:`files`,keys:[`o`],category:`Files`,description:`Open file in system default app (audio / video / pdf preview)`,hint:{keys:`o`}},{id:`files.mention`,scope:`files`,keys:[`a`],category:`Files`,description:`Inject @<path> mention into the engine pane`,hint:{keys:`a`}},{id:`files.createPR`,scope:`global`,keys:[],prefixKeys:[`p`,`shift+p`],category:`Files`,description:`Ask the agent to create a PR from the current task`},{id:`files.fixChecks`,scope:`global`,keys:[],prefixKeys:[`k`],category:`Files`,description:`Ask the agent to fix the failing PR checks`},{id:`files.syncBase`,scope:`global`,keys:[],prefixKeys:[`u`],category:`Files`,description:`Merge the base branch into this task's worktree`},{id:`diff.review.cursor`,scope:`workspace`,keys:[`j`,`k`,`down`,`up`],bareKeys:!0,category:`Diff review`,description:`Move the line cursor over the diff`,hint:{keys:`j/k`}},{id:`diff.review.range`,scope:`workspace`,keys:[`v`],bareKeys:!0,category:`Diff review`,description:`Toggle range anchor at the cursor`,hint:{keys:`v`}},{id:`diff.review.note`,scope:`workspace`,keys:[`c`],bareKeys:!0,category:`Diff review`,description:`Add a review note at the cursor`,hint:{keys:`c`}},{id:`diff.review.send`,scope:`workspace`,keys:[`s`],bareKeys:!0,category:`Diff review`,description:`Send all unsent review notes to the engine`,hint:{keys:`s`}},{id:`diff.review.drop`,scope:`workspace`,keys:[`x`],bareKeys:!0,category:`Diff review`,description:`Drop the review note the cursor sits inside`,hint:{keys:`x`}},{id:`diff.review.reload`,scope:`workspace`,keys:[`r`],bareKeys:!0,category:`Diff review`,description:`Reload the previewed file from disk`,hint:{keys:`r`}}],Mi=[{id:`inbox.show`,scope:`global`,keys:[],prefixKeys:[`i`],category:`Global`,description:`Open Inbox`},{id:`inbox.nav`,scope:`inbox`,keys:[`j`,`k`,`down`,`up`],category:`Inbox`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`inbox.open`,scope:`inbox`,keys:[`return`],category:`Inbox`,description:`Open the selected Task and Terminal Tab`,hint:{keys:`enter`}},{id:`inbox.delete`,scope:`inbox`,keys:[`d`],category:`Inbox`,description:`Ack the selected Inbox item`,hint:{keys:`d`}},{id:`inbox.deleteAll`,scope:`inbox`,keys:[`shift+d`],category:`Inbox`,description:`Ack every ATTENTION item`,hint:{keys:`D`}}],Ni=[{id:`palette.open`,scope:`global`,keys:[],prefixKeys:[`/`],category:`Global`,description:`Search commands`},{id:`help.open`,scope:`global`,keys:[`f1`],category:`Global`,description:`Show keybindings help`,hint:{keys:`F1`},presentation:`onePress`},{id:`task.new`,scope:`sidebar`,keys:[`n`],category:`Sidebar`,description:`New task`,hint:{keys:`n`}},{id:`task.new.global`,scope:`global`,keys:[],prefixKeys:[`n`],category:`Global`,description:`New task`},{id:`task.openEditor`,scope:`global`,keys:[],prefixKeys:[`o`],category:`Global`,description:`Open active Task directory in editor`},{id:`task.moveMode`,scope:`global`,keys:[],prefixKeys:[`m`],category:`Global`,description:`Reorder sidebar rows (then j/k)`},{id:`settings.open`,scope:`global`,keys:[],prefixKeys:[`,`],category:`Global`,description:`Open settings`},{id:`app.refresh`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Refresh Rove onto the installed build (after an update)`},{id:`settings.open.sidebar`,scope:`sidebar`,keys:[`s`],category:`Sidebar`,description:`Open settings`,hint:{keys:`s`}},{id:`worktrees.open.sidebar`,scope:`sidebar`,keys:[`x`],category:`Sidebar`,description:`Open worktrees`,hint:{keys:`x`}},{id:`kanban.open`,scope:`global`,keys:[],prefixKeys:[`1`],category:`Global`,description:`Open kanban (issues board)`},{id:`automations.open`,scope:`global`,keys:[],prefixKeys:[`2`],category:`Global`,description:`Open routines (scheduled tasks)`},{id:`workItems.open`,scope:`global`,keys:[],prefixKeys:[`3`],category:`Global`,description:`Open GitHub issues (external tracker)`},{id:`app.quit`,scope:`sidebar`,keys:[`q`,`ctrl+q`],category:`Sidebar`,description:`Quit (with confirm)`,hint:{keys:`q`}},{id:`focus.sidebar`,scope:`workspace`,keys:[`ctrl+q`],prefixKeys:[`q`],category:`Workspace`,description:`Back to sidebar (tasks)`,hint:{keys:`ctrl+q`},presentation:`onePress`},{id:`focus.previous`,scope:`global`,keys:[],prefixKeys:[`h`],category:`Navigation`,description:`Focus previous pane (files → workspace → sidebar)`},{id:`focus.next`,scope:`global`,keys:[`f4`],prefixKeys:[`l`],category:`Navigation`,description:`Focus next pane (sidebar → workspace → files)`,hint:{keys:`f4`},presentation:`onePress`},{id:`attention.next`,scope:`global`,keys:[`f7`],category:`Navigation`,description:`Jump to the next available Inbox item`,hint:{keys:`f7`},presentation:`onePress`},{id:`workspace.zenToggle`,scope:`global`,keys:[],prefixKeys:[`z`],category:`Navigation`,description:`Toggle zen mode (hide the files column)`},{id:`view.redraw`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Redraw the screen`},{id:`sidebar.nav`,scope:`sidebar`,keys:[`j`,`k`,`down`,`up`],category:`Sidebar`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`sidebar.select`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Open the selected task`,hint:{keys:`enter`}},{id:`sidebar.tree.open`,scope:`sidebar`,keys:[`l`,`space`],category:`Sidebar`,description:`Open the row under the cursor (a tab row enters its chat)`,hint:{keys:`l`}},{id:`sidebar.goto`,scope:`sidebar`,keys:[`g`,`shift+g`],category:`Sidebar`,description:`Top / bottom of list (gg or shift-G)`},{id:`sidebar.rename`,scope:`sidebar`,keys:[`r`],category:`Sidebar`,description:`Rename task`,hint:{keys:`r`}},{id:`sidebar.localMerge`,scope:`sidebar`,keys:[`shift+m`],category:`Sidebar`,description:`Reorder row (Shift+M, then j/k)`,hint:{keys:`M`}},{id:`sidebar.pin`,scope:`sidebar`,keys:[`shift+p`],category:`Sidebar`,description:`Pin / unpin task at top (Shift+P)`,hint:{keys:`P`}},{id:`sidebar.sort`,scope:`sidebar`,keys:[`t`],category:`Sidebar`,description:`Cycle task sort (default → recent → attention → name)`,hint:{keys:`t`}},{id:`sidebar.delete`,scope:`sidebar`,keys:[`d`],category:`Sidebar`,description:`Remove session (with confirm)`,hint:{keys:`d`}},{id:`sidebar.search.enter`,scope:`sidebar`,keys:[`/`],category:`Sidebar`,description:`Search tasks (fuzzy filter)`,hint:{keys:`/`}},{id:`sidebar.search.nav`,scope:`sidebar`,keys:[`down`,`up`],category:`Sidebar`,description:`Move highlight in search results`},{id:`sidebar.search.submit`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Select search match and exit search`},{id:`sidebar.search.cancel`,scope:`sidebar`,keys:[`escape`],category:`Sidebar`,description:`Cancel search (restore prior selection)`},{id:`tasks.openWorktree`,scope:`sidebar`,keys:[`o`],category:`Tasks pane`,description:`Open selected Task directory in your editor`,hint:{keys:`o`}},{id:`tasks.renameBranch`,scope:`sidebar`,keys:[`b`],category:`Tasks pane`,description:`Rename the selected task's git branch`,hint:{keys:`b`}},{id:`tasks.cycleEngine`,scope:`sidebar`,keys:[`v`],category:`Tasks pane`,description:`Cycle engine vendor — applies on reopen`,hint:{keys:`v`}},{id:`tasks.update`,scope:`sidebar`,keys:[`u`],category:`Tasks pane`,description:`Open the update page — version check + release notes`,hint:{keys:`u`}},{id:`tasks.focusEngine`,scope:`sidebar`,keys:[`right`],category:`Tasks pane`,description:`Focus the engine pane of the current window`,hint:{keys:`→`}},...Ai,...ji,...Mi,{id:`terminal.scroll-up`,scope:`terminal`,keys:[`ctrl+pageup`],category:`Terminal`,description:`Scroll scrollback up`,hint:{keys:`ctrl+pgup`}},{id:`terminal.scroll-down`,scope:`terminal`,keys:[`ctrl+pagedown`],category:`Terminal`,description:`Scroll scrollback down`},{id:`terminal.reset`,scope:`terminal`,keys:[`f5`],category:`Terminal`,description:`Reset terminal — kill the current shell and respawn`,hint:{keys:`f5`},presentation:`onePress`}],Pi={ctrl:`⌃`,control:`⌃`,alt:`⌥`,opt:`⌥`,option:`⌥`,shift:`⇧`,cmd:`⌘`,command:`⌘`,meta:`⌘`,super:`⌘`},Fi={enter:`⏎`,return:`⏎`,esc:`⎋`,escape:`⎋`,space:`␣`,up:`↑`,down:`↓`,left:`←`,right:`→`,backspace:`⌫`,delete:`⌦`,del:`⌦`,pgup:`⇞`,pageup:`⇞`,pgdn:`⇟`,pagedown:`⇟`,home:`↖`,end:`↘`};function Ii(e,t){if(e.includes(`/`))return e.split(`/`).map(e=>Ii(e,t)).join(`/`);let n=e.toLowerCase();return n===`tab`?`tab`:Fi[n]||(/^f\d{1,2}$/.test(n)?n.toUpperCase():t?/^[a-z]$/.test(n)?e.toUpperCase():e.replace(/[a-z]+/gi,e=>e.toUpperCase()):e)}function Li(e,t=`⌃A`){let n=e.trim();if(!n)return n;let r=/^prefix\s+(.+)$/i.exec(n);if(r){let e=r[1]??``;return`${t} ${e.includes(`+`)?Li(e,t):Ii(e,!0)}`}let i=n.split(`+`);if(i.length===1)return Ii(i[0]??``,!1);let a=i[i.length-1]??``;return`${i.slice(0,-1).map(e=>Pi[e.toLowerCase().trim()]??e).join(``)} ${Ii(a,!0)}`}var Ri={path:``,exists:!1,rows:[],prefix:{key:`ctrl+a`,firstStrokes:[`ctrl+a`],timeoutMs:5e3},plugins:[],applied:[],warnings:[]},zi=v(Ri),Bi=new Map(Ni.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint&&{...e.hint}}]));function Vi(e){for(let e of Ni){let t=Bi.get(e.id);if(!t)continue;let n=e;n.keys=[...t.keys],n.prefixKeys=t.prefixKeys&&[...t.prefixKeys],n.hint=t.hint&&{...t.hint}}for(let t of e.rows){let e=Ni.find(e=>e.id===t.id);e&&(e.keys=[...t.keys],e.prefixKeys=t.prefixKeys&&[...t.prefixKeys],e.hint=t.hint&&{...t.hint})}zi.set(e)}async function Hi(e){try{Vi(await e.request(`keybindings.get`))}catch{}}function Ui(e){let t=y(e.conn).hello;(0,h.useEffect)(()=>{if(!t)return;let n=()=>void Hi(e);return n(),window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[t,e])}var Wi=()=>zi.get().prefix.key,Gi=()=>{let e=Wi();return e===null?``:Li(e)};function Ki(e,t=`direct`){let n=Ni.find(t=>t.id===e),r=t===`prefix`?n?.prefixKeys?.[0]:n?.keys[0];return r===void 0?void 0:Li(r)}var qi=e=>Ni.find(t=>t.id===e)?.keys??[];function Ji(e){let t=Gi(),n=Ki(e,`prefix`);return t&&n?`${t} ${n}`:``}var Yi=e=>Bi.get(e)?.prefixKeys??[];function Xi(e,t){let n=zi.get().rows.find(t=>t.id===e),r=Bi.get(e),i=t===`prefix`?n?.prefixKeys:n?.keys,a=t===`prefix`?r?.prefixKeys:r?.keys;return i&&JSON.stringify(i)!==JSON.stringify(a??[])?i:void 0}function Zi(e,t){for(let n of t){let t=e.find(e=>e.chord===n);if(t)return t}}function Qi(e){return!e.dialog&&e.page!==`worktrees`&&e.page!==`update`}var $i=v({stale:!1,daemonVersion:null,bridgeVersion:null}),ea=2e4;async function ta(e){try{let t=await e.request(`daemon.info`);return $i.set({stale:t.stale,daemonVersion:t.daemonVersion,bridgeVersion:t.bridgeVersion}),t.stale}catch{return $i.get().stale}}function na(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void ta(e)),n=ni(ea,()=>void ta(e));return()=>{t(),n()}},[e])}function ra(e){if(!$i.get().stale){F(G(`update`,`refresh.alreadyCurrent`),`error`);return}C.set((0,B.jsx)($r,{title:G(`update`,`refresh.confirmTitle`),body:G(`update`,`refresh.confirmBody`),confirmLabel:G(`update`,`refresh.confirmLabel`),onConfirm:async()=>{await e.request(`daemon.restart`),F(G(`update`,`refresh.relaunching`));for(let t=0;t<20;t++)if(await new Promise(e=>window.setTimeout(e,1e3)),!await ta(e))return;throw Error(R(`layout.refreshTimeout`))}}))}function ia({onRefresh:e}){z();let{stale:t,daemonVersion:n,bridgeVersion:r}=y($i);if(y(zi),!t)return null;let i=G(`update`,`skew.hint`,{daemon:n?`v${n}`:G(`update`,`skew.olderBuild`),clientVersion:r??``,keys:Ji(`app.refresh`)});return(0,B.jsxs)(`div`,{className:`mono ${En}`,role:`alert`,children:[(0,B.jsx)(`b`,{children:G(`update`,`skew.title`)}),(0,B.jsx)(`span`,{children:i}),(0,B.jsx)(`button`,{type:`button`,className:ar,onClick:e,children:G(`update`,`refresh.confirmLabel`)})]})}var aa=[`info`,`success`,`warning`,`error`,`muted`],oa=4e3,sa=4e3,ca=/^[A-Za-z0-9._:-]{1,64}$/,la={box:new Set([`type`,`direction`,`gap`,`padding`,`border`,`children`]),text:new Set([`type`,`text`,`tone`,`bold`]),button:new Set([`type`,`key`,`label`,`tone`]),input:new Set([`type`,`key`,`placeholder`,`value`])};function ua(e){return typeof e==`string`&&aa.includes(e)}function da(e){return e===0||e===1||e===2||e===3}var fa=class extends Error{};function pa(e){let t=0,n=new Set,r=(e,i,a)=>{if(a>12)throw new fa(`${i}: deeper than 12`);if(++t>400)throw new fa(`more than 400 elements`);if(!e||typeof e!=`object`||Array.isArray(e))throw new fa(`${i}: not an element`);let o=e,s=o.type;if(s!==`box`&&s!==`text`&&s!==`button`&&s!==`input`)throw new fa(`${i}: unknown element ${JSON.stringify(s)}`);for(let e of Object.keys(o))if(!la[s].has(e))throw new fa(`${i}: ${s} has no prop "${e}"`);if(o.tone!==void 0&&!ua(o.tone))throw new fa(`${i}: tone must be one of ${aa.join(`, `)}`);if(s===`text`){if(typeof o.text!=`string`||o.text.length>4e3)throw new fa(`${i}: text must be a string of at most ${oa} chars`);if(o.bold!==void 0&&typeof o.bold!=`boolean`)throw new fa(`${i}: bold must be boolean`);return{type:s,text:o.text,...o.tone===void 0?{}:{tone:o.tone},...o.bold?{bold:!0}:{}}}if(s===`button`||s===`input`){if(typeof o.key!=`string`||!ca.test(o.key))throw new fa(`${i}: bad ${s} key`);if(n.has(o.key))throw new fa(`${i}: duplicate key "${o.key}"`);n.add(o.key)}if(s===`input`){for(let e of[`placeholder`,`value`]){let t=o[e];if(t!==void 0&&(typeof t!=`string`||t.length>4e3))throw new fa(`${i}: ${e} must be a string of at most ${sa} chars`)}return{type:s,key:o.key,...o.placeholder===void 0?{}:{placeholder:o.placeholder},...o.value===void 0?{}:{value:o.value}}}if(s===`button`){if(typeof o.label!=`string`||o.label.length===0||o.label.length>40)throw new fa(`${i}: label must be 1-40 chars`);return{type:s,key:o.key,label:o.label,...o.tone===void 0?{}:{tone:o.tone}}}if(o.direction!==void 0&&o.direction!==`row`&&o.direction!==`column`)throw new fa(`${i}: direction must be "row" or "column"`);for(let e of[`gap`,`padding`])if(o[e]!==void 0&&!da(o[e]))throw new fa(`${i}: ${e} must be 0-3`);if(o.border!==void 0&&typeof o.border!=`boolean`)throw new fa(`${i}: border must be boolean`);if(!Array.isArray(o.children))throw new fa(`${i}: box needs children`);return{type:s,...o.direction===void 0?{}:{direction:o.direction},...o.gap===void 0?{}:{gap:o.gap},...o.padding===void 0?{}:{padding:o.padding},...o.border?{border:!0}:{},children:o.children.map((e,t)=>r(e,`${i}.children[${t}]`,a+1))}};try{return{ok:!0,tree:r(e,`tree`,1)}}catch(e){if(e instanceof fa)return{ok:!1,error:e.message};throw e}}function ma(e){let t=e?.panes;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.plugin!=`string`||typeof t.id!=`string`||typeof t.title!=`string`)continue;let r=pa(t.tree);r.ok&&n.push({plugin:t.plugin,id:t.id,title:t.title,tree:r.tree})}return n}function ha(e){let t=[],n=(e,r,i)=>{if(e.type===`button`||e.type===`input`)t.push({kind:e.type,plugin:r,pane:i,key:e.key});else if(e.type===`box`)for(let t of e.children)n(t,r,i)};for(let t of e)n(t.tree,t.plugin,t.id);return t}function ga(e,t){return e!==null&&t!==null&&e.plugin===t.plugin&&e.pane===t.pane&&e.key===t.key}function _a(e,t){return e.find(e=>ga(e,t))??e[0]??null}function va(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>ga(e,t));return r<0?e[0]??null:e[(r+n+e.length)%e.length]??null}function ya(e,t){if(!t)return e;let n=new Map(e.map(e=>[e.id,e]));for(let e of t.remove)n.delete(e);for(let e of t.upsert)n.set(e.id,e);return t.order?t.order.flatMap(e=>n.get(e)??[]):e.map(e=>n.get(e.id)??e)}function ba(e,t){return{...e,rev:t.rev,tasks:ya(e.tasks,t.tasks),...t.archived?{archived:ya(e.archived??[],t.archived)}:{},...t.attention?{attention:t.attention}:{},...t.gates?{gates:t.gates}:{}}}function xa(e){return!!e&&typeof e==`object`&&typeof e.from==`number`}var Sa=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,...t}:n)}),Ca=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,title:t,label:n.label===n.title?t:n.label}:n)});function wa(e,t){let n=new Set([t]);for(let t=!0;t;){t=!1;for(let r of e)r.parentTaskId&&n.has(r.parentTaskId)&&!n.has(r.id)&&(n.add(r.id),t=!0)}return n}var Ta=(e,t)=>n=>{let r=t?n.tasks:n.archived??[],i=wa(r,e),a=r.filter(e=>i.has(e.id)).map(e=>({...e,archived:t})),o=r.filter(e=>!i.has(e.id));return t?{...n,tasks:o,archived:[...n.archived??[],...a]}:{...n,tasks:[...n.tasks,...a],archived:o}},Ea=(e,t)=>n=>{let r=[...n.tasks,...n.archived??[]],i=t?wa(r,e):new Set([e]),a=r.find(t=>t.id===e)?.parentTaskId,o=t=>t.filter(e=>!i.has(e.id)).map(t=>t.parentTaskId===e?{...t,parentTaskId:a}:t);return{...n,tasks:o(n.tasks),...n.archived?{archived:o(n.archived)}:{}}},Da={"task.pin":(e,t)=>Sa(e,{pinned:t.pinned===!0}),"task.keep":(e,t)=>Sa(e,{kept:t.kept===!0}),"task.setStatus":(e,t)=>Sa(e,{status:t.status}),"task.rename":(e,t)=>Ca(e,String(t.title)),"task.archive":(e,t)=>Ta(e,t.archived===!0),"task.delete":(e,t)=>Ea(e,t.cascade===!0)};Object.keys(Da);function Oa(e,t){return Da[e]?.(String(t.taskId),t)??null}var ka=`rove.web.selection`,Aa=`null`,ja=300;function Ma(){try{let e=JSON.parse(localStorage.getItem(ka)??`null`);if(e&&typeof e==`object`&&`taskId`in e&&typeof e.taskId==`string`)return{taskId:e.taskId,tabId:`tabId`in e&&typeof e.tabId==`string`?e.tabId:null}}catch{}return{taskId:null,tabId:null}}function Na(e){if(!e||typeof e!=`object`||!(`taskIds`in e))return;let t=e.taskIds;return Array.isArray(t)?t.filter(e=>typeof e==`string`):void 0}function Pa(e){return!!e&&typeof e==`object`&&`tasks`in e&&Array.isArray(e.tasks)}var Fa=`rove.web.visits`,Ia=20;function La(){try{let e=JSON.parse(localStorage.getItem(Fa)??`[]`);return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.taskId==`string`):[]}catch{return[]}}function Ra(e,t){if(t)return e?.tasks.find(e=>e.id===t)??e?.archived?.find(e=>e.id===t)}function za(e,t,n,r){let i=(e,t)=>e.some(e=>e.id===t&&!e.deleting),a=n.taskId;if(a===null||!i(e,a)||i(t,a))return null;let o=r.find(e=>e.taskId!==a&&i(t,e.taskId));return o?{taskId:o.taskId,tabId:o.tabId}:{taskId:null,tabId:null}}var Ba=class{client;tasks=v(null);remote=v([]);tabs=v({});tabsSettled=v(!1);mods=v([]);installedMods=v(new Set);selection=v(Ma());visits=v(La());tabTimer=null;tabsReadAt=-1/0;tabScope=new Set;tabSets=new Map;tabReads=new Map;syncing=null;served=null;edits=new Map;pendingSelect=null;selectIntent=0;provisioning=new Map;viewingSent=Aa;taskShown=!0;viewingExtras=()=>({});constructor(e){this.client=e,e.onOpen(()=>{this.resync(),this.viewingSent=Aa,this.reportViewing(),this.refreshMods()}),typeof document<`u`&&typeof document.addEventListener==`function`&&document.addEventListener(`visibilitychange`,()=>{this.reportViewing(),document.visibilityState===`visible`&&this.refreshMods()}),typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`pagehide`,()=>this.reportViewing(!0)),e.on(`tasks`,e=>{Pa(e)&&this.acceptTasks(e)}),e.on(`tasks.patch`,e=>{let t=this.served;t&&xa(e)&&e.from===t.rev?this.acceptTasks(ba(t,e)):this.resync()}),e.on(`tabs`,e=>this.scheduleTabRefresh(Na(e))),e.on(`mods`,e=>this.mods.set(ma(e)??[]))}resync(){return this.syncing??=this.client.request(`tasks.subscribe`,{patches:!0}).then(e=>this.acceptTasks(e)).catch(()=>{}).finally(()=>{this.syncing=null}),this.syncing}async refreshMods(){try{let{mods:e}=await this.client.request(`builtinMods.list`);this.installedMods.set(new Set(e.filter(e=>e.installed).map(e=>e.id)))}catch{}}onSelect=()=>{};setTaskShown(e){this.taskShown!==e&&(this.taskShown=e,this.reportViewing())}select(e,t=null){this.onSelect();let n=++this.selectIntent;if(this.tasks.get()?.tasks.find(t=>t.id===e)?.noWorktree){this.provisioning.has(e)?this.provisioning.set(e,{intent:n,tabId:t}):this.provisionThenSelect(e,{intent:n,tabId:t});return}this.commitSelection(e,t)}commitSelection(e,t){let n=this.tabs.get()[e]??[],r={taskId:e,tabId:t??Va(n)?.id??null};this.selection.set(r),localStorage.setItem(ka,JSON.stringify(r));let i=[{...r,at:Date.now()},...this.visits.get().filter(e=>e.taskId!==r.taskId||e.tabId!==r.tabId)].slice(0,Ia);this.visits.set(i),localStorage.setItem(Fa,JSON.stringify(i)),this.reportViewing(),e in this.tabs.get()||this.scheduleTabRefresh([e])}reportViewing(e=!1){let{taskId:t,tabId:n}=this.selection.get(),r=e||typeof document<`u`&&document.visibilityState===`hidden`||!t||!this.taskShown?null:{taskId:t,...n?{tabId:n}:{},...this.viewingExtras()},i=JSON.stringify(r);i!==this.viewingSent&&(this.viewingSent=i,this.client.request(`ui.viewing`,r??{taskId:null}).catch(()=>{this.viewingSent===i&&(this.viewingSent=Aa)}))}async provisionThenSelect(e,t){this.provisioning.set(e,t);let n=!0;try{await this.client.request(`task.ensureWorktree`,{taskId:e})}catch(e){n=!1,F(e instanceof Error?e.message:String(e),`error`)}let r=this.provisioning.get(e)??t;this.provisioning.delete(e),n&&(this.markProvisioned(e),(this.tasks.get()?.tasks.some(t=>t.id===e)??!1)&&r.intent===this.selectIntent&&this.commitSelection(e,r.tabId))}markProvisioned(e){let t=this.tasks.get();if(!t)return;let n=t.tasks.map(t=>t.id===e?{...t,noWorktree:void 0}:t);this.tasks.set({...t,tasks:n})}selectWhenListed(e){this.tasks.get()?.tasks.some(t=>t.id===e)?this.select(e):this.pendingSelect=e}engineTarget(e){let{taskId:t,tabId:n}=this.selection.get(),r=t===e?this.tabs.get()[e]?.find(e=>e.id===n):void 0;return r?.kind===`engine`?{taskId:e,tabId:r.id}:{taskId:e}}async refreshTabsNow(e){await this.refreshTabs([e])}tabbedTasks(){let e=this.tasks.get(),t=e?.archived?.find(e=>e.id===this.selection.get().taskId);return[...e?.tasks??[],...t?[t]:[],...this.remote.get().filter(e=>!e.machine?.stale)]}act(e,t){let n=Oa(e,t),r=()=>this.client.request(e,t);return n?this.optimistic(n,r):r()}closeTab(e,t){return this.tabAct(e,`tab.close`,{taskId:e,tabId:t},e=>e.filter(e=>e.id!==t))}renameTab(e,t,n){return this.tabAct(e,`tab.rename`,{taskId:e,tabId:t,title:n},e=>e.map(e=>e.id===t?{...e,title:n}:e))}async tabAct(e,t,n,r){let i=this.tabs.get()[e];i&&(this.tabReads.set(e,(this.tabReads.get(e)??0)+1),this.tabs.set({...this.tabs.get(),[e]:r(i)}),this.reselectIfClosed(e));try{await this.client.request(t,n)}finally{await this.refreshTabs([e])}}async optimistic(e,t){this.edits.set(e,!1);let n=this.selection.get();this.served&&this.acceptTasks(this.served,!0);try{let n=await t();return this.edits.has(e)&&this.edits.set(e,!0),n}catch(t){throw this.edits.delete(e),this.served&&this.acceptTasks(this.served,!0),n.taskId!==null&&this.selection.get().taskId!==n.taskId&&Ra(this.tasks.get(),n.taskId)&&this.commitSelection(n.taskId,n.tabId),t}}acceptTasks(e,t=!1){this.served=e;let n=e;for(let[e,r]of this.edits)r&&!t?this.edits.delete(e):n=e(n);let r=[...this.tasks.get()?.tasks??[],...this.remote.get()];this.remote.set(n.tasks.filter(e=>e.machine)),this.tasks.set({...n,tasks:n.tasks.filter(e=>!e.machine)});let i=za(r,n.tasks,this.selection.get(),this.visits.get());i?.taskId?this.commitSelection(i.taskId,i.tabId):i&&(this.selection.set(i),localStorage.setItem(ka,JSON.stringify(i)),this.reportViewing()),this.pendingSelect&&n.tasks.some(e=>e.id===this.pendingSelect)&&(this.select(this.pendingSelect),this.pendingSelect=null);let a=this.tabbedTasks(),o=new Set(a.map(e=>e.id)),s=this.tabs.get();Object.keys(s).some(e=>!o.has(e))&&this.tabs.set(Object.fromEntries(Object.entries(s).filter(([e])=>o.has(e))));for(let e of this.tabSets.keys())o.has(e)||this.tabSets.delete(e);let c=a.filter(e=>{let t=Object.keys(e.tabStatus??{}).sort().join(` `);return this.tabSets.get(e.id)!==t&&(this.tabSets.set(e.id,t),!0)});c.length>0&&this.scheduleTabRefresh(c.map(e=>e.id))}scheduleTabRefresh(e){if(!e)this.tabScope=null;else for(let t of e)this.tabScope?.add(t);if(this.tabTimer!==null)return;let t=Math.max(0,this.tabsReadAt+ja-Date.now());this.tabTimer=window.setTimeout(()=>{this.tabTimer=null,this.tabsReadAt=Date.now();let e=this.tabScope;this.tabScope=new Set,this.refreshTabs(e?[...e]:this.tabbedTasks().map(e=>e.id))},t)}async refreshTabs(e){await Promise.all(e.map(async e=>{let t=(this.tabReads.get(e)??0)+1;this.tabReads.set(e,t);let n;try{n=(await this.client.request(`task.tabs`,{taskId:e})).tabs}catch{return}this.tabReads.get(e)===t&&(this.tabs.set({...this.tabs.get(),[e]:n}),this.reselectIfClosed(e))})),this.tabsSettled.get()||this.tabsSettled.set(!0)}reselectIfClosed(e){let t=this.selection.get();t.taskId===e&&((this.tabs.get()[e]??[]).some(e=>e.id===t.tabId)||this.commitSelection(e,null))}};function Va(e){return e.find(e=>e.alive!==!1)??e[0]}function Ha({model:e}){let t=y(e.selection),n=y(e.tasks),r=y(e.remote),i=Ra(n,t.taskId)??r.find(e=>e.id===t.taskId),a=n?.attention.filter(e=>e.unread).length??0,o=`${a>0?`(${a}) `:``}${i?`${i.label} - `:``}rove`;return(0,h.useEffect)(()=>{document.title=o},[o]),null}var Ua=[`sidebar`,`workspace`,`files`];function Wa(e,t,n){let r=Ua.filter(e=>e!==`files`||n.filesVisible),i=r.indexOf(e);if(i<0)return(t>0?r[r.length-1]:r[0])??null;let a=Math.min(Math.max(i+t,0),r.length-1);return a===i?null:r[a]??null}var Ga=`.split-leaf.is-active textarea.xterm-helper-textarea`,Ka={sidebar:[`.rail`,`.rail`],workspace:[`.workspace`,Ga],files:[`.side-panel`,`.side-view:not([hidden]) :is([tabindex='0'], input)`]};function qa(){for(let e of document.querySelectorAll(Ga))if(e.closest(`[data-stream]`)?.getClientRects().length)return e;return null}function Ja(){let e=qa();return e?.focus(),e!==null}function Ya(e){let t=Wa(Object.keys(Ka).find(e=>document.activeElement?.closest(Ka[e][0]))??`sidebar`,e,{filesVisible:document.querySelector(Ka.files[0])!==null});t&&document.querySelector(Ka[t][1])?.focus()}var Xa=[];function Za(e){Xa.push(e)}var Qa={workspace:`workspace`,sidebar:`sidebar`,files:`files`,terminal:`terminal`};function $a(){let e=Xa.flatMap(e=>e()),t=new Set(e.filter(e=>!e.prefix).map(e=>e.id)),n=e.map(e=>{let t=Xi(e.id,e.prefix?`prefix`:`direct`);return t?{...e,chords:t}:e});for(let r of e){let e=r.prefix?Xi(r.id,`direct`):void 0;if(!e||e.length===0||t.has(r.id))continue;t.add(r.id);let i=Ni.find(e=>e.id===r.id)?.scope??`global`;n.push({...r,prefix:!1,chords:e,...Qa[i]?{surface:Qa[i]}:{}})}return n}function eo(e,t){return!e.surface||e.surface===t||t===`terminal`&&e.surface===`workspace`}function to(e,t){return e.surface===t?0:e.surface?1:2}function no(){let e=document.activeElement;return e instanceof Element?e.closest(`.xterm`)?`terminal`:e.closest(`.rail`)?`sidebar`:e.closest(`.files`)?`files`:e.closest(`.workspace, .side-panel`)?`workspace`:null:null}function ro(e,t){let n=new Set,r=new Set;for(let i of $a())!eo(i,t)||i.live?.(e)===!1||(i.prefix?r:n).add(i.id);return{direct:n,prefix:r,inputPassthrough:t===`terminal`}}function io(){let e=new Set($a().map(e=>e.id));return Ni.filter(t=>e.has(t.id))}var ao=new Map,oo=v(null);function K(e){return ao.set(e.stream,e),()=>{ao.get(e.stream)===e&&ao.delete(e.stream),oo.get()===e&&oo.set(null)}}function so(e){return ao.get(e)}Za(()=>[{id:`terminal.scroll-up`,chords:[`ctrl+pageup`],prefix:!1,surface:`terminal`,run:()=>oo.get()?.scrollPages(-1)},{id:`terminal.scroll-down`,chords:[`ctrl+pagedown`],prefix:!1,surface:`terminal`,run:()=>oo.get()?.scrollPages(1)},{id:`terminal.reset`,chords:[`f5`],prefix:!1,surface:`terminal`,run:()=>oo.get()?.reset()}]);var co={INPUT:!0,TEXTAREA:!0,SELECT:!0},lo=`.rail, .side-panel, dialog, [role=dialog], [role=menu], [role=listbox]`;function uo(e){return!e||e.tagName===`BODY`||e.tagName===`HTML`?`none`:e.closest(`.xterm`)?`terminal`:co[e.tagName]===!0||e.isContentEditable?`field`:e.closest(lo)?`pane`:`loose`}function fo(e,t,n){return e.key!==`Escape`||e.defaultPrevented||e.isComposing||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||n.overlay||!n.terminal?!1:t===`none`||t===`loose`}function po(){(0,h.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=qa(),n=document.activeElement;if(!fo(e,uo(n instanceof HTMLElement?n:null),{overlay:C.get()!==null||S.get()!==null||O.get()!==null||M.get()!==null,terminal:t!==null}))return;let r=t?.closest(`[data-stream]`)?.dataset.stream,i=r?so(r):void 0;!t||!i||(e.preventDefault(),t.focus(),i.input(`\x1B`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}var mo=Reflect.get(globalThis,`__roveRelay`);function ho(e,t){return mo?mo.fetch(e,t):fetch(e,t)}function go(e,t){return mo?new mo.WebSocket(e,t):new WebSocket(e,t)}function _o(e,t){let n=t&&typeof t==`object`?t:{};if(e===200&&typeof n.token==`string`&&/^[A-Za-z0-9_-]{43}$/.test(n.token))return{kind:`ok`,token:n.token};if(e===429){if(n.locked===`global`)return{kind:`lockedHost`};let e=typeof n.retryAfterSeconds==`number`?n.retryAfterSeconds:900;return{kind:`locked`,minutes:Math.max(1,Math.ceil(e/60))}}return e===401?{kind:`wrong`}:{kind:`unreachable`}}async function vo(e=ho){try{let t=await e(`/login`,{headers:{Accept:`application/json`},cache:`no-store`});return!t.ok||!(t.headers.get(`content-type`)??``).includes(`application/json`)?!1:(await t.json()).password===!0}catch{return!1}}async function yo(e=ho){try{let t=await e(`/auth`,{headers:{Accept:`application/json`},cache:`no-store`});return!t.ok||!(t.headers.get(`content-type`)??``).includes(`application/json`)?!1:(await t.json()).open===!0}catch{return!1}}async function bo(e,t=ho){try{let n=await t(`/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e}),credentials:`omit`}),r=_o(n.status,await n.json().catch(()=>null));return r.kind===`ok`&&a(r.token),r}catch{return{kind:`unreachable`}}}async function xo(e=ho){let t=i();o(),t&&await e(`/logout`,{method:`POST`,headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}function So(e){if(!e)return null;switch(e.kind){case`ok`:return null;case`wrong`:return R(`login.wrong`);case`locked`:return R(`login.locked`,{minutes:e.minutes});case`lockedHost`:return R(`login.lockedHost`);case`unreachable`:return R(`login.unreachable`)}}function Co(){z();let[e,t]=(0,h.useState)(``),[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(null),o=So(i);return(0,B.jsx)(`div`,{className:Xn,children:(0,B.jsxs)(`form`,{className:Zn,onSubmit:async i=>{if(i.preventDefault(),n||!e)return;r(!0);let o=await bo(e);if(o.kind===`ok`){window.location.reload();return}t(``),a(o),r(!1)},children:[(0,B.jsxs)(`span`,{className:Jn,children:[(0,B.jsx)(`span`,{className:Yn,children:`[`}),` rove `,(0,B.jsx)(`span`,{className:Yn,children:`]`})]}),(0,B.jsx)(`h1`,{className:`${H} text-muted`,children:R(`login.title`)}),(0,B.jsx)(`p`,{className:`text-muted`,children:R(`login.body`)}),(0,B.jsx)(`input`,{className:sr,type:`password`,autoComplete:`current-password`,"aria-label":R(`login.field`),placeholder:R(`login.field`),autoFocus:!0,value:e,disabled:n,onChange:e=>{t(e.target.value),a(null)}}),o&&(0,B.jsx)(`p`,{className:`text-error`,role:`alert`,children:o}),(0,B.jsx)(`div`,{className:cr,children:(0,B.jsx)(`button`,{type:`submit`,className:Rt(),disabled:n||!e,children:R(n?`login.checking`:`login.submit`)})})]})})}function wo(e){return(0,B.jsx)(`svg`,{className:`block size-2.5 flex-none transition-[rotate,opacity] duration-120 ease-[ease] motion-reduce:transition-none ${e.right?`-rotate-90 is-right`:``} ${e.className??``}`,viewBox:`0 0 10 10`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M2.5 3.75 5 6.25l2.5-2.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var To=120;function Eo(e,t,n,r=e-t){return e+t+8<=n?e:Math.max(8,Math.min(r,n-t-8))}function Do(e){let{item:t}=e;return(0,B.jsxs)(`button`,{ref:e.rowRef,type:`button`,role:t.checked===void 0?`menuitem`:`menuitemradio`,"aria-checked":t.checked,"aria-haspopup":t.children?`menu`:void 0,"aria-expanded":t.children?!!e.open:void 0,className:Sr({selected:e.selected,open:e.open,danger:t.danger}),onMouseEnter:e.onEnter,onMouseLeave:e.onLeave,onClick:e.onPick,children:[(0,B.jsx)(`span`,{children:t.label}),t.children?(0,B.jsx)(wo,{right:!0,className:Tr(!!(e.selected||e.open))}):t.checked?(0,B.jsx)(`span`,{className:Er,"aria-hidden":!0,children:`✓`}):t.key&&(0,B.jsx)(`span`,{className:wr({selected:e.selected,danger:t.danger}),children:t.key})]})}function Oo(){let e=y(S),[t,n]=(0,h.useState)(0),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(-1),[s,c]=(0,h.useState)(!1),l=(0,h.useRef)(null),u=(0,h.useRef)(null),d=(0,h.useRef)([]),f=(0,h.useRef)(void 0),[p,m]=(0,h.useState)({x:0,y:0}),[g,_]=(0,h.useState)({x:0,y:0});if((0,h.useLayoutEffect)(()=>{if(!e||!l.current)return;n(e.start??(e.fromKeyboard?0:-1)),i(null),c(!1);let{width:t,height:r}=l.current.getBoundingClientRect(),a=e.right===void 0?e.x:Math.max(e.right-l.current.offsetWidth,0);m({x:Eo(a,t,window.innerWidth),y:Eo(e.y,r,window.innerHeight)});let o=e.target;return o?.setAttribute(`data-menu-open`,``),()=>o?.removeAttribute(`data-menu-open`)},[e]),(0,h.useLayoutEffect)(()=>{let e=r===null?null:d.current[r];if(!e||!l.current||!u.current)return;let t=l.current.getBoundingClientRect(),n=e.getBoundingClientRect(),{width:i,height:a}=u.current.getBoundingClientRect();_({x:Eo(t.right+2,i,window.innerWidth,t.left-i-2),y:Eo(n.top-5,a,window.innerHeight,n.bottom+5-a)})},[r]),(0,h.useEffect)(()=>()=>window.clearTimeout(f.current),[]),(0,h.useEffect)(()=>{if(!e)return;let d=e.items,f=r===null?[]:d[r]?.children??[],p=()=>S.set(null),m=e=>{e?.run&&(p(),e.run())},h=(e,t,n)=>e(e=>n===1?e>=t?0:e+1:e<=0?t:e-1),g=e=>{let l=e.key;if(s&&r!==null){let t=f.length-1;if(l===`Escape`||l===`ArrowLeft`||l===`h`)i(null),c(!1);else if(l===`ArrowDown`||l===`j`)h(o,t,1);else if(l===`ArrowUp`||l===`k`)h(o,t,-1);else if(l===`Home`)o(0);else if(l===`End`)o(t);else if(l===`Enter`)m(f[a]);else return;e.preventDefault(),e.stopPropagation();return}let u=d.length-1,g=d[t],_=()=>{i(t),c(!0),o(0)};if(l===`Escape`)p();else if(l===`ArrowDown`||l===`j`)h(n,u,1);else if(l===`ArrowUp`||l===`k`)h(n,u,-1);else if(l===`Home`)n(0);else if(l===`End`)n(u);else if((l===`ArrowRight`||l===`l`)&&g?.children)_();else if(l===`Enter`)g?.children?_():m(g);else return;e.preventDefault(),e.stopPropagation()},_=e=>{e.target instanceof Node&&(l.current?.contains(e.target)||u.current?.contains(e.target))||p()};return window.addEventListener(`keydown`,g,!0),window.addEventListener(`mousedown`,_),()=>{window.removeEventListener(`keydown`,g,!0),window.removeEventListener(`mousedown`,_)}},[e,t,r,a,s]),!e)return null;let v=r===null?null:e.items[r]?.children,b=e=>{e.run&&(S.set(null),e.run())},x=e=>{window.clearTimeout(f.current),i(e),c(!1),o(-1)};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{ref:l,className:xr(),role:`menu`,style:{left:p.x,top:p.y,minWidth:e.minWidth},children:e.items.map((a,o)=>(0,B.jsxs)(h.Fragment,{children:[o>0&&a.section!==e.items[o-1]?.section&&(0,B.jsx)(`hr`,{className:`-mx-1 my-1 h-px flex-none border-none bg-line`}),(0,B.jsx)(Do,{item:a,rowRef:e=>{d.current[o]=e},selected:o===t,open:o===r,onEnter:()=>{n(o),window.clearTimeout(f.current),a.children?f.current=window.setTimeout(()=>x(o),To):i(null)},onLeave:()=>{window.clearTimeout(f.current),o!==r&&n(-1)},onPick:()=>a.children?x(o):b(a)})]},a.label))}),v&&(0,B.jsx)(`div`,{ref:u,className:xr(!0),role:`menu`,style:{left:g.x,top:g.y},children:v.map((e,t)=>(0,B.jsx)(Do,{item:e,selected:t===a,onEnter:()=>{o(t),c(!0)},onLeave:()=>o(-1),onPick:()=>b(e)},e.label))})]})}function ko(){let e=y(C),t=y(T);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Oo,{}),e,(0,B.jsx)(`div`,{className:Dr,"aria-live":`polite`,children:t.map(e=>{let t=`${kr(e.tone===`error`)} ${e.leaving?`is-leaving`:``}`,n=e.action;return n?(0,B.jsxs)(`div`,{className:`${t} ${Or}`,children:[(0,B.jsx)(`span`,{children:e.text}),(0,B.jsx)(V,{onClick:()=>{se(e.id),n.run()},children:`[ ${n.label} ]`})]},e.id):(0,B.jsx)(`button`,{type:`button`,className:t,onClick:()=>se(e.id),children:e.text},e.id)})})]})}function Ao(e){return e.urls[e.at]??``}function jo(e){try{return new URL(e).host.replace(/^www\./,``)}catch{return e}}function Mo(){return{kind:`browser`,tabs:[{id:`t1`,urls:[],at:-1}],active:`t1`,recent:[`t1`],next:2}}function No(e,t){return!e.tabs.some(e=>e.id===t)||e.active===t&&e.recent.at(-1)===t?e:{...e,active:t,recent:[...e.recent.filter(e=>e!==t),t]}}function Po(e){let t=e;for(;t.tabs.length>12;){let e=t.tabs.filter(e=>e.id!==t.active).sort((e,n)=>t.recent.indexOf(e.id)-t.recent.indexOf(n.id))[0];if(!e)break;t=Vo(t,e.id)??t}return t}function Fo(e,t){let n=`t${e.next}`,r={id:n,urls:t,at:t.length-1};return Po(No({...e,tabs:[...e.tabs,r],next:e.next+1},n))}function Io(e){return Fo(e,[])}function Lo(e,t){return{...e,tabs:e.tabs.map(e=>e.id===t.id?t:e)}}function Ro(e,t,n){let r=e.tabs.find(e=>e.id===t);if(!r||Ao(r)===n)return e;let i=[...r.urls.slice(0,r.at+1),n].slice(-30);return Lo(e,{...r,urls:i,at:i.length-1})}function zo(e,t,n){let r=e.tabs.find(e=>e.id===t);return!r||n===r.at||n<0||n>=r.urls.length?e:Lo(e,{...r,at:n})}function Bo(e,t){let n=e.tabs.find(e=>Ao(e)===t);if(n)return No(e,n.id);let r=e.tabs.find(e=>Ao(e)===``);return r?Ro(No(e,r.id),r.id,t):Fo(e,[t])}function Vo(e,t){let n=e.tabs.filter(e=>e.id!==t);if(n.length===0)return null;let r=e.recent.filter(e=>e!==t);if(e.active!==t)return{...e,tabs:n,recent:r};let i=[...r].reverse().find(e=>n.some(t=>t.id===e))??n[0].id;return{...e,tabs:n,active:i,recent:[...r.filter(e=>e!==i),i]}}function Ho(e,t){return e.tabs.some(e=>e.id===t)?Vo(e,t):e}function Uo(e,t){let n=e.tabs.find(e=>e.id===t);return n?{...e,tabs:[n],active:t,recent:[t]}:e}function Wo(e,t,n){let r=new Set(n.map(e=>e.id)),i=[...e.filter(e=>r.has(e)&&e!==t),...r.has(t)?[t]:[]];return i.slice(Math.max(0,i.length-3))}function Go(e,t,n,r){if(!Array.isArray(e))return null;let i=[];for(let t of e){if(!t||typeof t!=`object`)continue;let e=t;if(typeof e.id!=`string`||!/^t\d+$/.test(e.id)||i.some(t=>t.id===e.id))continue;let n=Array.isArray(e.urls)?e.urls.filter(e=>typeof e==`string`&&e!==``).slice(-30):[],r=typeof e.at==`number`&&Number.isInteger(e.at)?e.at:n.length-1;i.push({id:e.id,urls:n,at:n.length===0?-1:Math.min(n.length-1,Math.max(0,r))})}let a=i[0];if(!a)return null;let o=new Set(i.map(e=>e.id)),s=Array.isArray(n)?n.filter(e=>typeof e==`string`&&o.has(e)):[],c=typeof t==`string`&&o.has(t)?t:s.at(-1)??a.id,l=Math.max(...i.map(e=>Number(e.id.slice(1))));return{kind:`browser`,tabs:i,active:c,recent:[...s.filter(e=>e!==c),c],next:Math.max(l+1,typeof r==`number`&&Number.isInteger(r)?r:0)}}var Ko=[`quota`,`files`,`file`,`diff`,`chat`,`browser`],qo=1e3;function Jo(){return{columns:[{kind:`files`}],weights:{}}}function Yo(e,t){return e.columns.find(e=>e.kind===t)}function Xo(e){return e.slice(e.lastIndexOf(`/`)+1)}function Zo(e,t){return{...e,columns:e.columns.map(e=>e.kind===t.kind?t:e)}}function Qo(e){return[...e].sort((e,t)=>Ko.indexOf(e.kind)-Ko.indexOf(t.kind))}function $o(e,t){return{...e,columns:Qo([...e.columns,t])}}function es(e,t){return Yo(e,t)||t===`file`?e:$o(e,t===`diff`?{kind:t,path:`.`,scope:`working`}:t===`browser`?Mo():{kind:t})}function ts(e,t,n){let r=n===void 0?{kind:`file`,path:t}:{kind:`file`,path:t,at:n},i=Yo(e,`file`);return i?i.kind===`file`&&i.path===t&&(n===void 0||i.at===n)?e:Zo(e,r):$o(e,r)}function ns(e,t,n,r){let i=r===void 0?{kind:`diff`,path:t,scope:n}:{kind:`diff`,path:t,scope:n,at:r},a=Yo(e,`diff`);return a?a.kind===`diff`&&a.path===t&&a.scope===n&&(r===void 0||a.at===r)?e:Zo(e,i):$o(e,i)}function rs(e,t){let n=Yo(e,`browser`);return n?.kind===`browser`?Zo(e,Bo(n,t)):$o(e,Bo(Mo(),t))}function is(e,t){if(!Yo(e,t))return e;let{[t]:n,...r}=e.weights;return{columns:e.columns.filter(e=>e.kind!==t),weights:r}}function as(e,t){let n=Yo(e,`browser`);if(n?.kind!==`browser`)return e;let r=t(n);return r===n?e:r?Zo(e,r):is(e,`browser`)}function os(e,t,n,r=!1){if(t&&Yo(e,n)){let t=is(e,n);return{panel:t,open:t.columns.length>0}}if(r){let t=e.columns.filter(e=>e.kind===n);return{panel:es({...e,columns:t},n),open:!0}}return{panel:es(e,n),open:!0}}function ss(e){let t=e.columns.flatMap(t=>{let n=e.weights[t.kind];return n!==void 0&&n>0?[n]:[]}),n=t.length>0?t.reduce((e,t)=>e+t,0)/t.length:1,r=e.columns.map(t=>e.weights[t.kind]||n),i=r.reduce((e,t)=>e+t,0);return r.map(e=>e/i*qo)}function cs(e,t){let n=t.reduce((e,t)=>e+t,0);if(t.length!==e.columns.length||!(n>0))return e;let r=Object.fromEntries(e.columns.map((e,r)=>[e.kind,Math.round(t[r]/n*1e3)/1e3]));return e.columns.every(t=>Math.abs((e.weights[t.kind]??0)-(r[t.kind]??0))<.001)?e:{...e,weights:r}}function ls(e){return Object.keys(e.weights).length===0?e:{...e,weights:{}}}function us(e,t,n,r){let i=e[t],a=e[t+1];if(i===void 0||a===void 0)return[...e];let o=i+a,s=Math.min(r,o/2),c=Math.max(s,Math.min(o-s,i+n));return e.map((e,n)=>n===t?c:n===t+1?o-c:e)}var ds=Ko.filter(e=>e!==`chat`&&e!==`file`),fs=v(`terminal`),ps=`rove.web.panelWidth`,ms=`rove.web.panelOpen`,hs=v((()=>{let e=Number(localStorage.getItem(ps));return Number.isFinite(e)&&e>0?e:null})());hs.subscribe(()=>{let e=hs.get();e===null?localStorage.removeItem(ps):localStorage.setItem(ps,String(Math.round(e)))}),hs.subscribe(ue);var gs=v(localStorage.getItem(ms)===`1`);gs.subscribe(()=>localStorage.setItem(ms,gs.get()?`1`:`0`));var _s=v(!1);gs.subscribe(()=>{gs.get()||_s.set(!1)});function vs(e,t,n=window.innerWidth){let r=Math.max(280,n-t-320);return Math.max(280,Math.min(r,Math.round(e)))}function ys(e,t,n=window.innerWidth){return e<2?null:vs(Math.max(300,Math.min(440,n*.28))*e,t,n)}var bs=[`files`,`diff`,`browser`];function xs(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&t.taskId!==``&&bs.includes(t.view)&&typeof t.at==`number`&&(t.url===void 0||typeof t.url==`string`)&&(t.path===void 0||typeof t.path==`string`)}function Ss(e){return e.narrow?{panel:!1,panelOpen:!1,narrow:!0}:{panel:!0,panelOpen:e.panelOpen&&!e.zen,narrow:!1}}function Cs(e,t){return{tab:e.path?e.view===`files`?`file`:`diff`:e.view,...e.view===`browser`&&e.url?{url:e.url}:{},...e.view!==`browser`&&e.path?{path:e.path}:{},show:t.taskId===e.taskId&&!t.narrow}}function ws(e,t,n){return t.url?rs(e,t.url):t.path?t.tab===`file`?ts(e,t.path,n):ns(e,t.path,`working`,n):es(e,t.tab)}var Ts=[`files`,`chat`,`diff`,`browser`,`quota`],Es=e=>e===`branch`||e===`task`?e:`working`;function Ds(e){if(!e||typeof e!=`object`)return null;let t=e;return t.kind===`files`||t.kind===`chat`||t.kind===`quota`?{kind:t.kind}:t.kind===`file`&&typeof t.path==`string`&&t.path!==``&&t.path!==`.`?{kind:`file`,path:t.path}:t.kind===`diff`&&typeof t.path==`string`&&t.path!==``?{kind:`diff`,path:t.path,scope:Es(t.scope)}:t.kind===`browser`?Go(t.tabs,t.active,t.recent,t.next):null}function Os(e,t){if(!e||typeof e!=`object`)return{};let n=e,r=t.flatMap(({kind:e})=>{let t=n[e];return typeof t==`number`&&Number.isFinite(t)&&t>0?[[e,t]]:[]});return Object.fromEntries(r)}function ks(e){let t=[e.top,e.bottom].map(e=>e&&typeof e==`object`&&`tabs`in e&&Array.isArray(e.tabs)?e.tabs:null);return t[0]?{tabs:t.flatMap(e=>e??[]).filter(e=>!!e&&typeof e==`object`&&/^t\d+$/.test(String(e.id))),recent:Array.isArray(e.recent)?e.recent.filter(e=>typeof e==`string`):[]}:null}function As(e){let t=ks(e);if(!t)return null;let n=[...new Set(t.tabs.map(e=>e.kind))],r=[];for(let i of n){if((i===`files`||i===`chat`||i===`quota`)&&r.push({kind:i}),i===`diff`){let e=t.tabs.filter(e=>e.kind===`diff`&&typeof e.path==`string`&&e.path!==``),n=[...t.recent].reverse().map(t=>e.find(e=>e.id===t)).find(e=>e)??e[0];n&&r.push({kind:`diff`,path:n.path,scope:Es(n.scope)})}if(i===`browser`){let n=Go(t.tabs.filter(e=>e.kind===`browser`),void 0,t.recent,e.next);n&&r.push(n)}}return{columns:Qo(r),weights:{}}}function js(e){if(!e||typeof e!=`object`)return null;let t=e;if(!Array.isArray(t.columns))return As(t);let n=[];for(let e of t.columns){let t=Ds(e);t&&!n.some(e=>e.kind===t.kind)&&n.push(t)}return{columns:Qo(n),weights:Os(t.weights,n)}}function Ms(e,t){let n=Jo(),r=typeof t==`string`&&t!==``?t:``;return e!==`browser`&&!r?n:{...n,columns:[...n.columns,r?Bo(Mo(),r):Mo()]}}function Ns(e){try{let t=JSON.parse(e??`{}`);return t&&typeof t==`object`&&!Array.isArray(t)?Object.entries(t):[]}catch{return[]}}function Ps(e,t,n){let r=Object.fromEntries(Object.entries(e).filter(([e])=>e!==t));r[t]=n;for(let e of Object.keys(r).slice(0,-50))delete r[e];return r}function Fs(e,t){let n={};for(let[t,r]of Ns(e)){let e=js(r);e&&(n[t]=e)}let r=new Map(Ns(t.tab).filter(([,e])=>Ts.includes(e))),i=new Map(Ns(t.url)),a=[...new Set([...r.keys(),...i.keys()])].filter(e=>!(e in n));n={...Object.fromEntries(a.map(e=>[e,Ms(r.get(e),i.get(e))])),...n};for(let e of Object.keys(n).slice(0,-50))delete n[e];return n}var Is=`rove.web.panels`,Ls=`rove.web.panelTab`,Rs=`rove.web.panelUrl`;function zs(){let e={tab:localStorage.getItem(Ls),url:localStorage.getItem(Rs)},t=Fs(localStorage.getItem(Is),e);return(e.tab!==null||e.url!==null)&&(localStorage.setItem(Is,JSON.stringify(t)),localStorage.removeItem(Ls),localStorage.removeItem(Rs)),t}var Bs=v(zs()),Vs={columns:[],weights:{}};function Hs(e){return y(Bs)[e]??Vs}function Us(e){let t=Hs(e??``);return y(gs)&&(e===null||t.columns.length>0)}function Ws(e){return gs.get()&&(e===null||(Bs.get()[e]??Vs).columns.length>0)}var Gs=e=>Bs.subscribe(e);function Ks(e,t){let n=Bs.get()[e]??Vs,r=t(n);if(r===n)return;let i=Ps(Bs.get(),e,r);Bs.set(i),localStorage.setItem(Is,JSON.stringify(i))}function qs(e,t){Ks(e,e=>es(e,t)),gs.set(!0),be()&&fs.set(t)}function Js(e,t){let n=gs.get(),r=os(Bs.get()[e]??Vs,n&&!A.get(),t,!n);Ks(e,()=>r.panel),r.open?gs.set(!0):_s.set(!1),r.open&&A.get()&&A.set(!1)}function Ys(e){Ks(e.taskId,t=>ns(t,e.path,e.scope)),gs.set(!0),A.get()&&A.set(!1),be()&&fs.set(`diff`)}function Xs(e,t){Ks(e,e=>ts(e,t)),gs.set(!0),A.get()&&A.set(!1),be()&&fs.set(`file`)}function Zs(e,t){Ks(e,e=>rs(e,t)),gs.set(!0),A.get()&&A.set(!1),be()&&fs.set(`browser`)}function Qs(e,t){let n=Bs.get()[e]??Vs;!be()&&n.columns.length===0&&_s.set(!1),be()&&fs.get()===t&&!Yo(n,t)&&qs(e,`files`)}function $s(e,t){Ks(e,e=>is(e,t)),Qs(e,t)}function ec(e,t){Ks(e,e=>as(e,t)),Qs(e,`browser`)}function tc(e,t){ec(e,e=>Ho(e,t))}function nc(e,t){let n=Cs(e,{taskId:t,narrow:be()});Ks(e.taskId,t=>ws(t,n,e.at)),n.show&&(gs.set(!0),A.get()&&A.set(!1))}var rc={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function ic(e){if(e.altKey&&e.code){let t=/^Key([A-Z])$/.exec(e.code);if(t?.[1])return t[1].toLowerCase();let n=/^Digit(\d)$/.exec(e.code);if(n?.[1])return n[1]}return rc[e.key]??e.key.toLowerCase()}function ac(e){let t=ic(e),n=t===`return`?[`return`,`enter`]:[t],r=[];e.ctrlKey&&r.push(`ctrl`),e.metaKey&&r.push(`cmd`),e.altKey&&r.push(`alt`);let i=t.length===1;return e.shiftKey&&!i&&r.push(`shift`),r.length===0?e.shiftKey&&i?[...n.map(e=>`shift+${e}`),...n]:n:e.shiftKey&&i?[]:n.map(e=>`${r.join(`+`)}+${e}`)}function oc(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}var sc=new Map(Ni.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));function cc(){return Ni.map(e=>{let t=sc.get(e.id);return{id:e.id,scope:e.scope,category:e.category,...e.bareKeys?{bareKeys:!0}:{},keys:[...t?.keys??[]],...t?.prefixKeys?{prefixKeys:[...t.prefixKeys]}:{},...t?.hint?{hint:{...t.hint}}:{}}})}var lc=new Map(Ni.map(e=>[e.id,e]));function uc(e){return lc.get(e)}function dc(e,t){if(!e)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e=0;e<r.length&&i<n.length;e++)r.charCodeAt(e)===n.charCodeAt(i)&&i++;return i===n.length}function fc(e){let t=[],n=new Map;for(let r of e){let e=n.get(r.category);e||(e=[],n.set(r.category,e),t.push({category:r.category,rows:e})),e.push(r)}return t}function pc(e){return e.hint?.keys??e.keys[0]}function mc(e){let t=uc(e);if(!t)return null;let n=pc(t);return n&&n.length>0?n:null}function hc(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function gc(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function _c(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=hc(c),l=gc(c,t),u=r?r.direct.has(c.id):l,d=r?r.prefix.has(c.id):l;if(e){let t={binding:c,primary:e,aliases:c.keys.filter(t=>t!==e)};if(u&&(l||c.presentation===`onePress`))c.presentation===`onePress`?a.push(t):i.push(t);else if(!l&&c.scope!==`global`){let e=s.get(c.scope);e?e.push(t):s.set(c.scope,[t])}}n&&d&&c.prefixKeys?.length&&o.push({binding:c,primary:`${n} + ${c.prefixKeys[0]}`,aliases:c.prefixKeys.slice(1).map(e=>`${n} + ${e}`)})}let c=[];i.length&&c.push({kind:`here`,scope:t??void 0,rows:i}),a.length&&c.push({kind:`direct`,rows:a}),o.length&&c.push({kind:`prefix`,rows:o});for(let[e,t]of s)c.push({kind:`other`,scope:e,rows:t});return c}var vc={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function yc(e){return e?vc[e]:`Global`}function bc(e){return[`kanban.open`,`automations.open`,`workItems.open`].includes(e)?`Views`:e.startsWith(`focus.`)?`Navigation`:e.startsWith(`inbox.`)||e.startsWith(`attention.`)?`Attention`:e.startsWith(`chat.tab.`)||e.startsWith(`chat.session.`)?`Sessions`:e.startsWith(`chat.fork.`)||e.startsWith(`task.`)?`Tasks`:e.startsWith(`settings.`)||e===`workspace.zenToggle`?`Tools`:uc(e)?.category??`Global`}function xc(e,t,n){let r=e.trim();return dc(r,t)||dc(r,n)}var Sc={title:`Rove — keybindings`,palette:`Search commands`,search:`Type an action name or chord…`,filter:`/ filter actions`,noResults:`No matching actions. Try another name or clear the filter.`,run:`↑↓ select · enter run · esc cancel`,reportProblem:`Report a problem`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of {logPath} only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`.",unavailable:`This action is no longer available. Close and reopen the palette.`,esc:`esc`,scrollKeys:`↑↓ ⇞⇟ scroll`,commandLayer:`{prefix} — more Rove commands`,escCancel:`esc cancel`,directLayer:`Hold ctrl — Rove shortcuts`,releaseCtrl:`release ctrl to close`,overflow:`… F1 for all shortcuts`,moreCommandsPrefix:`More commands (prefix)`,focused:`Focused: {surface}`,allBindings:`All keybinding contexts`,grammar:`Use keys here · one-press Rove shortcuts · {prefix} for more commands · right-click a row for its menu`,disabled:`prefix disabled`,here:`HERE — only in {surface}`,direct:`ONE PRESS — Rove shortcuts`,afterPrefix:`AFTER PREFIX — more Rove commands`,otherPane:`OTHER PANE — {surface}`,marks:{rows:`MARKS — task and tab rows`,inbox:`MARKS — tab strip and Inbox`,pr:`MARKS — pull request chip`},mark:{spinner:`working: an engine turn or a task job is running`,needsInput:`waiting on your answer: a permission prompt or a question`,attention:`needs you: an error, a rate limit, an exited engine or a failed deletion`,unseen:`a turn finished and you have not looked yet`,idle:`quiet`,subagent:`running subagents, in front of the branch`,remote:`the task lives on another machine`,done:`the turn finished`,rateLimited:`rate limited; it resumes on its own`,dead:`the engine process exited`,routineFailed:`a routine run failed`,conflict:`merge conflicts`,checksFailing:`checks failing`,checksPassing:`checks passing`}},Cc={title:`Rove — 快捷键`,palette:`搜索命令`,search:`输入操作名称或快捷键…`,filter:`/ 筛选操作`,noResults:`没有匹配的操作。请换个名称或清空筛选。`,run:`↑↓ 选择 · enter 执行 · esc 取消`,reportProblem:`报告问题`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 {logPath} 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。",unavailable:`此操作已不可用。请关闭并重新打开命令面板。`,esc:`esc`,scrollKeys:`↑↓ ⇞⇟ 滚动`,commandLayer:`{prefix} — 更多 Rove 命令`,escCancel:`esc 取消`,directLayer:`按住 ctrl — Rove 快捷键`,releaseCtrl:`松开 ctrl 关闭`,overflow:`… 按 F1 查看全部快捷键`,moreCommandsPrefix:`更多命令(prefix)`,focused:`当前焦点:{surface}`,allBindings:`所有快捷键上下文`,grammar:`当前区域直接按 · Rove 单次快捷键 · {prefix} 打开更多命令 · 右键任务行打开菜单`,disabled:`Prefix 已禁用`,here:`当前区域 — 仅在{surface}`,direct:`一次按下 — Rove 快捷键`,afterPrefix:`按下 Prefix 后 — 更多 Rove 命令`,otherPane:`其他区域 — {surface}`,marks:{rows:`标记 — 任务行和标签行`,inbox:`标记 — 标签栏和收件箱`,pr:`标记 — PR 标记`},mark:{spinner:`运行中:引擎正在执行一轮,或任务作业正在运行`,needsInput:`等你回答:权限确认或提问`,attention:`需要你处理:出错、限流、引擎已退出或删除失败`,unseen:`一轮已结束,你还没看过`,idle:`空闲`,subagent:`正在运行的子代理,显示在分支名前`,remote:`任务在另一台机器上`,done:`这一轮已结束`,rateLimited:`被限流,会自动恢复`,dead:`引擎进程已退出`,routineFailed:`例行任务运行失败`,conflict:`存在合并冲突`,checksFailing:`检查未通过`,checksPassing:`检查已通过`}},wc={status:{commands:`{key} commands`,help:`{key} help`,sidebar:`{key} sidebar`,settings:`settings`},pane:{move:`move`,open:`open`,collapse:`collapse`,diff:`diff`}},Tc={status:{commands:`{key} 命令`,help:`{key} 帮助`,sidebar:`{key} 侧栏`,settings:`设置`},pane:{move:`移动`,open:`打开`,collapse:`折叠`,diff:`差异`}},Ec={category:{Global:`Global`,Sidebar:`Sidebar`,Workspace:`Workspace`,Navigation:`Navigation`,"Tasks pane":`Tasks pane`,Files:`Files`,Terminal:`Terminal`,Views:`Views`,Tasks:`Tasks`,Sessions:`Sessions`,Attention:`Attention`,Tools:`Tools`,"Diff review":`Diff review`,Inbox:`Inbox`},desc:{"palette.open":`Search commands`,"help.open":`Show keybindings help`,"task.new":`New task`,"task.new.global":`New task`,"task.openEditor":`Open active Task directory in editor`,"task.moveMode":`Reorder sidebar rows (then j/k — tab, task, or project)`,"settings.open":`Open settings`,"app.refresh":`Refresh Rove onto the installed build (after an update)`,"settings.open.sidebar":`Open settings`,"inbox.show":`Open Inbox`,"worktrees.open.sidebar":`Open worktrees`,"kanban.open":`Open kanban (issues board)`,"automations.open":`Open routines (scheduled tasks)`,"workItems.open":`Open GitHub issues (external tracker)`,"app.quit":`Quit (with confirm)`,"focus.sidebar":`Back to sidebar (tasks)`,"focus.previous":`Focus previous pane (files → workspace → sidebar)`,"focus.next":`Focus next pane (sidebar → workspace → files)`,"workspace.zenToggle":`Toggle zen mode`,"view.redraw":`Redraw the screen`,"attention.next":`Jump to the next Inbox item`,"sidebar.nav":`Move cursor up/down`,"sidebar.select":`Open the selected task`,"sidebar.tree.open":`Open the row under the cursor`,"sidebar.goto":`Top / bottom of list (gg or shift-G)`,"sidebar.rename":`Rename task`,"sidebar.localMerge":`Reorder row (Shift+M, then j/k — tab, task, or project)`,"sidebar.pin":`Pin / unpin task at top (Shift+P)`,"sidebar.sort":`Cycle task sort (default → recent → attention → name)`,"sidebar.delete":`Remove session (with confirm)`,"sidebar.search.enter":`Search tasks (fuzzy filter)`,"sidebar.search.nav":`Move highlight in search results`,"sidebar.search.submit":`Select search match and exit search`,"sidebar.search.cancel":`Cancel search (restore prior selection)`,"tasks.openWorktree":`Open selected Task directory in your editor`,"tasks.renameBranch":`Rename the selected task's git branch`,"tasks.cycleEngine":`Cycle engine vendor — applies on reopen`,"tasks.update":`Open the update page (when a new version is available)`,"tasks.focusEngine":`Focus the engine pane of the current window`,"chat.tab.new":`New conversation here (a child task sharing this directory)`,"chat.tab.chooseEngine":`New conversation — engine/shell picker with destination + context toggles`,"chat.tab.fork":`Continue this chat in a new child task (same directory, keeps the conversation)`,"chat.fork.new":`Quick-fork: create child task seeded with current repo/branch/model`,"chat.tab.close":`Close chat tab`,"chat.tab.rename":`Rename active chat tab`,"chat.tab.cycle-next":`Next chat tab`,"chat.tab.cycle-prev":`Previous chat tab`,"chat.tab.goto":`Go to chat tab N`,"workspace.split.right":`Split right`,"workspace.split.down":`Split down`,"workspace.split.focus-next":`Focus next split`,"workspace.split.close":`Close active split (tab when unsplit)`,"workspace.split.rename":`Rename active split (tab when unsplit)`,"workspace.reopenSession":`Reopen a session in a task whose tabs are all closed`,"files.nav":`Move cursor up/down`,"files.hierarchy":`Collapse / expand tree level`,"files.open":`Open file in configured editor (diff when supported)`,"files.tab":`Switch tab (cycle All / Changes)`,"files.refresh":`Refresh`,"files.scope":`Toggle Changes scope (working ↔ branch vs base)`,"files.diff":`Open a read-only diff in a workspace tab`,"files.diffAll":`Open the whole worktree's diff in one workspace tab`,"files.openExternal":`Open file in system default app (audio / video / pdf preview)`,"files.mention":`Inject @<path> mention into the engine pane`,"files.createPR":`Ask the agent to create a PR from the current task`,"files.fixChecks":`Ask the agent to fix the failing PR checks`,"files.syncBase":`Merge the base branch into this task's worktree`,"diff.review.cursor":`Move the line cursor over the diff`,"diff.review.range":`Toggle range anchor at the cursor`,"diff.review.note":`Add a review note at the cursor`,"diff.review.send":`Send all unsent review notes to the engine`,"diff.review.drop":`Drop the review note the cursor sits inside`,"diff.review.reload":`Reload the previewed file from disk`,"inbox.nav":`Move through Inbox items`,"inbox.open":`Open the selected Inbox item`,"inbox.delete":`Ack the selected Inbox item`,"inbox.deleteAll":`Ack every ATTENTION item`,"terminal.scroll-up":`Scroll scrollback up`,"terminal.scroll-down":`Scroll scrollback down`,"terminal.reset":`Reset terminal — kill the current shell and respawn`}},Dc={category:{Global:`全局`,Sidebar:`侧边栏`,Workspace:`工作区`,Navigation:`导航`,"Tasks pane":`任务面板`,Files:`文件`,Terminal:`终端`,Views:`视图`,Tasks:`任务`,Sessions:`会话`,Attention:`提醒`,Tools:`工具`,"Diff review":`差异审阅`,Inbox:`收件箱`},desc:{"palette.open":`搜索命令`,"help.open":`显示快捷键帮助`,"task.new":`新建任务`,"task.new.global":`新建任务`,"task.openEditor":`在编辑器中打开当前 Task 的目录`,"task.moveMode":`调整侧边栏行顺序(然后 j/k——tab / 任务 / 项目)`,"settings.open":`打开设置`,"app.refresh":`让 Rove 刷新到已安装的版本(更新之后)`,"settings.open.sidebar":`打开设置`,"inbox.show":`打开收件箱`,"worktrees.open.sidebar":`打开 worktrees`,"kanban.open":`打开看板(issues)`,"automations.open":`打开例行任务(定时任务)`,"workItems.open":`打开 GitHub issues(外部跟踪器)`,"app.quit":`退出(需确认)`,"focus.sidebar":`返回侧边栏(任务列表)`,"focus.previous":`聚焦上一个面板(文件 → 工作区 → 侧边栏)`,"focus.next":`聚焦下一个面板(侧边栏 → 工作区 → 文件)`,"workspace.zenToggle":`切换禅模式`,"view.redraw":`重绘屏幕`,"attention.next":`跳到下一个收件箱条目`,"sidebar.nav":`上下移动光标`,"sidebar.select":`打开选中的任务`,"sidebar.tree.open":`打开光标所在行`,"sidebar.goto":`跳到列表顶部 / 底部(gg 或 shift-G)`,"sidebar.rename":`重命名任务`,"sidebar.localMerge":`调整当前行顺序(Shift+M,然后 j/k——tab / 任务 / 项目)`,"sidebar.pin":`置顶 / 取消置顶任务(Shift+P)`,"sidebar.sort":`切换任务排序方式(默认 → 最近 → 关注 → 名称)`,"sidebar.delete":`移除会话(需确认)`,"sidebar.search.enter":`搜索任务(模糊过滤)`,"sidebar.search.nav":`在搜索结果中移动高亮`,"sidebar.search.submit":`选中搜索匹配项并退出搜索`,"sidebar.search.cancel":`取消搜索(恢复之前的选中项)`,"tasks.openWorktree":`在编辑器中打开选中 Task 的目录`,"tasks.renameBranch":`重命名选中任务的 git 分支`,"tasks.cycleEngine":`循环切换引擎厂商——重新打开后生效`,"tasks.update":`打开更新页面(有新版本时)`,"tasks.focusEngine":`聚焦当前窗口的引擎面板`,"chat.tab.new":`在此新建对话(共享当前目录的子任务)`,"chat.tab.chooseEngine":`新建对话 —— 选择引擎或 shell,可切换落点与上下文`,"chat.tab.fork":`把当前对话接到新子任务(同一目录,带上已有对话)`,"chat.fork.new":`快速派生:以当前仓库/分支/模型创建子任务`,"chat.tab.close":`关闭聊天标签页`,"chat.tab.rename":`重命名当前聊天标签页`,"chat.tab.cycle-next":`下一个聊天标签页`,"chat.tab.cycle-prev":`上一个聊天标签页`,"chat.tab.goto":`跳到第 N 个聊天标签页`,"workspace.split.right":`向右分屏`,"workspace.split.down":`向下分屏`,"workspace.split.focus-next":`聚焦下一个分屏`,"workspace.split.close":`关闭当前分屏(未分屏时关闭标签页)`,"workspace.split.rename":`重命名当前分屏(未分屏时重命名标签页)`,"workspace.reopenSession":`在标签页全部关闭的任务中重新打开会话`,"files.nav":`上下移动光标`,"files.hierarchy":`折叠 / 展开树层级`,"files.open":`在已配置的编辑器中打开文件(支持时显示 diff)`,"files.tab":`切换标签页(循环 全部 / 变更)`,"files.refresh":`刷新`,"files.scope":`切换变更范围(工作区 ↔ 分支对比 base)`,"files.diff":`在工作区标签页中打开只读 diff`,"files.diffAll":`把整个 worktree 的 diff 打开在一个工作区标签页里`,"files.openExternal":`在系统默认应用中打开文件(音频 / 视频 / pdf 预览)`,"files.mention":`将 @<path> 提及注入引擎面板`,"files.createPR":`让 agent 从当前任务创建 PR`,"files.fixChecks":`让 agent 修复失败的 PR 检查`,"files.syncBase":`把基础分支合并进该任务的工作树`,"diff.review.cursor":`在 diff 中移动行光标`,"diff.review.range":`在光标处切换范围锚点`,"diff.review.note":`在光标处添加审阅备注`,"diff.review.send":`将所有未发送的审阅备注发给引擎`,"diff.review.drop":`删除光标所在的评审备注`,"diff.review.reload":`从磁盘重新加载当前预览的文件`,"inbox.nav":`在收件箱条目之间移动`,"inbox.open":`打开选中的收件箱条目`,"inbox.delete":`将选中的收件箱条目标为已阅`,"inbox.deleteAll":`将所有待处理条目标为已阅`,"terminal.scroll-up":`向上滚动回滚`,"terminal.scroll-down":`向下滚动回滚`,"terminal.reset":`重置终端——关闭当前 shell 并重新启动`}};function Oc(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function kc(e,t){return At.get()===`zh`?t:e}function Ac(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var jc=(e,t)=>Ac(Oc(kc(Sc,Cc),e)??Oc(Sc,e)??e,t),Mc=(e,t)=>Ac(Oc(kc(wc,Tc),e)??Oc(wc,e)??e,t),Nc=(e,t)=>Ac(Oc(kc(xi,Si),e)??Oc(xi,e)??e,t);function Pc(e){return kc(Ec,Dc).desc[e]??Ec.desc[e]??e}function Fc(e){let t=Pc(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function Ic(e){return kc(Ec,Dc).category[e]??e}var Lc=(e,t)=>Ac(Oc(kc(Ti,Ei),e)??Oc(Ti,e)??e,t),Rc=(e,t)=>Ac(Oc(kc(yi,bi),e)??Oc(yi,e)??e,t),zc=e=>e.split(` + `).map(e=>Li(e)).join(` + `);function Bc(e){let t=Ic(yc(e.scope));return e.kind===`here`?jc(`here`,{surface:t}):e.kind===`direct`?jc(`direct`):e.kind===`prefix`?jc(`afterPrefix`):jc(`otherPane`,{surface:t})}function Vc(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;C.set((0,B.jsx)(Hc,{model:e,surface:no(),origin:t}))}function Hc({model:e,surface:t,origin:n}){z();let r=y(zi),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),c=(0,h.useRef)(null),l=(0,h.useMemo)(()=>ro(e,t),[e,t]),u=(0,h.useMemo)(()=>_c(io(),t===`terminal`?`terminal`:t,Wi(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>xc(o,Pc(e.binding.id),e.primary))})).filter(e=>e.rows.length>0);return(0,h.useEffect)(()=>()=>n?.focus(),[n]),(0,h.useEffect)(()=>{let e=c.current,t=t=>{if(!e||t.ctrlKey||t.metaKey||t.altKey)return;let n=e.clientHeight;if(t.key===`ArrowUp`)e.scrollBy({top:-24});else if(t.key===`ArrowDown`)e.scrollBy({top:24});else if(t.key===`PageUp`)e.scrollBy({top:-n});else if(t.key===`PageDown`)e.scrollBy({top:n});else if(t.key===`Home`)e.scrollTo({top:0});else if(t.key===`End`)e.scrollTo({top:e.scrollHeight});else if(!i&&t.key===`?`)L();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,B.jsx)(Xr,{title:jc(`title`),wide:!0,children:(0,B.jsxs)(`div`,{className:`${br} help`,children:[(0,B.jsxs)(`div`,{className:yn,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-muted`,children:t?jc(`focused`,{surface:Ic(yc(t))}):jc(`allBindings`)}),(0,B.jsx)(`p`,{className:`text-muted`,children:jc(`grammar`,{prefix:Gi()})})]}),(0,B.jsxs)(`div`,{className:bn,children:[(0,B.jsx)(`span`,{className:`subtle`,children:jc(`scrollKeys`)}),(0,B.jsx)(`button`,{type:`button`,className:ar,onClick:L,children:jc(`esc`)})]})]}),i?(0,B.jsx)(`input`,{className:sr,autoFocus:!0,spellCheck:!1,value:o,placeholder:jc(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,B.jsx)(`p`,{className:`text-muted`,children:jc(`filter`)}),u.length===0&&(0,B.jsx)(`p`,{className:`text-muted`,children:jc(`noResults`)}),(0,B.jsx)(`div`,{className:xn,ref:c,children:u.map((e,t)=>(0,B.jsxs)(`section`,{className:Sn,children:[(0,B.jsx)(`h2`,{className:Cn,children:Bc(e)}),e.rows.map(t=>(0,B.jsxs)(`div`,{className:wn,children:[(0,B.jsx)(`span`,{className:`mono ${Tn}`,children:zc(t.primary)}),(0,B.jsx)(`span`,{className:`flex-1`,children:Pc(t.binding.id)}),t.aliases.length>0&&(0,B.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(zc).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}function Uc(e){switch(e){case`permission_needed`:return{glyph:`?`,tone:`warning`,stateKey:`inbox.state.needsInput`};case`turn_complete`:return{glyph:`✓`,tone:`success`,stateKey:`inbox.state.done`};case`rate_limited`:return{glyph:`◷`,tone:`warning`,stateKey:`inbox.state.rateLimited`};case`dead`:return{glyph:`†`,tone:`attention`,stateKey:`inbox.state.dead`};case`decision_needed`:return{glyph:`?`,tone:`warning`,stateKey:`inbox.state.decision`};case`routine_failed`:return{glyph:`↻`,tone:`attention`,stateKey:`inbox.state.routineFailed`};case`report_missing`:return{glyph:`!`,tone:`warning`,stateKey:`inbox.state.reportMissing`};default:return{glyph:`!`,tone:`attention`,stateKey:`inbox.state.error`}}}function Wc(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<48?`${r}h`:`${Math.round(r/24)}d`}var Gc=e=>e===`routine_failed`,Kc=e=>`${e.taskId??``}:${e.tabId??``}`;function qc(e,t){let n=new Map(t.map((e,t)=>[e,t])),r=e=>+(e.state===`turn_complete`),i=e=>n.get(e.taskId??``)??2**53-1;return[...e].sort((e,t)=>r(e)-r(t)||e.at-t.at||i(e)-i(t)||Kc(e).localeCompare(Kc(t)))}function Jc(e,t,n){let r=new Set(t),i=qc(e,t).filter(e=>e.taskId===null||r.has(e.taskId));if(i.length===0)return null;let a=n.taskId===null?-1:i.findIndex(e=>Kc(e)===Kc(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}function Yc(e){let t=(e.terminal?.tail??[]).map(e=>e.trimEnd()),n=t.length;for(;n>0&&t[n-1]===``;)n--;let r=0;for(;r<n&&t[r]===``;)r++;return t.slice(Math.max(r,n-12),n)}async function Xc(e,t,n=!1){let r=`attention.dismiss`,i;if(Gc(t.state)){if(!t.automationId)return;r=`attention.dismissRoutine`,i={automationId:t.automationId}}else{if(t.gateId||t.state===`decision_needed`||t.state===`report_missing`&&!n||t.taskId===null)return;i={taskId:t.taskId,...t.tabId?{tabId:t.tabId}:{},...t.deliveryId?{deliveryId:t.deliveryId}:{}}}await e.client.request(r,i).catch(e=>F(String(e),`error`))}function Zc(e,t){Xc(e,t),L(),k.set(t.automationId??null),O.set(`routines`)}var Qc=524288e3,$c=1048576;function el(e,t){return/\.pdf$/i.test(e)?`pdf[${t}]`:/\.(png|jpe?g|gif|webp)$/i.test(e)?`images[${t}]`:`files[${t}]`}function tl(e){let t=-1;for(let n of e.matchAll(/^(?:images|pdf|files)\[(\d+)\]:/gm)){let e=Number.parseInt(n[1],10);e>t&&(t=e)}return t+1}function nl(e,t){let n=e.replace(/\s+$/,``),r=tl(e);for(let e of t){let t=`${el(e,r)}: ${e}`;n=n.length>0?`${n}\n${t}`:t,r+=1}return n}function rl(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}async function il(e,t){if(t.size>524288e3)throw Error(R(`pages.attachTooLarge`,{name:t.name}));let n={mime:t.type,name:t.name},r=async(e,n)=>rl(new Uint8Array(await t.slice(e,n).arrayBuffer()));if(t.size<=1048576)return e.request(`attachment.put`,{...n,data:await r(0,t.size)});let i;for(let a=0;;){let o=Math.min(a+$c,t.size),s=await e.request(`attachment.part`,{...n,...i?{upload:i}:{},offset:a,data:await r(a,o),done:o===t.size});if(s.path!==void 0)return{path:s.path,kind:s.kind??`file`};i=s.upload,a=o}}async function al(e,t){return(await il(e,t)).path}function ol(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=0;for(;n>=1023.5&&r<t.length-1;)n/=1024,r++;let i=n.toFixed(1);return`${Number(i)>=100?Math.round(n):i} ${t[r]}`}var sl=`size-14 rounded-sm border-hairline border-line object-cover`;function cl({name:e,thumb:t}){if(t)return(0,B.jsx)(`img`,{src:t,alt:``,draggable:!1,className:sl});let n=e.includes(`.`)?e.split(`.`).pop()??``:``;return(0,B.jsx)(`span`,{className:`${sl} flex items-center justify-center font-mono text-meta uppercase text-muted`,children:n.slice(0,4)||`file`})}function ll({item:e,onRemove:t}){let[n]=(0,h.useState)(e.pending);return(0,B.jsxs)(`li`,{className:`group relative size-14 shrink-0 ${n?`motion-safe:animate-rise-in`:``}`,title:`${e.name} · ${ol(e.size)}`,children:[(0,B.jsx)(`div`,{className:`transition-opacity duration-150 motion-reduce:transition-none ${e.pending?`opacity-50`:``}`,children:(0,B.jsx)(cl,{...e})}),(0,B.jsx)(`button`,{type:`button`,"aria-label":R(`newSession.removeAttachment`,{name:e.name}),className:`absolute top-0.5 right-0.5 flex size-5 cursor-pointer items-center justify-center rounded-full border-hairline border-line bg-paper p-0 text-meta leading-none text-ink opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 touch:size-7 touch:opacity-100 touch:after:absolute touch:after:-inset-2 touch:after:content-['']`,onClick:()=>t(e.id),children:`×`})]})}function ul({items:e,onRemove:t}){return e.length===0?null:(0,B.jsx)(`ul`,{className:`m-0 flex min-w-0 list-none flex-wrap gap-1.5 p-0`,"data-field":`attachments`,children:e.map(e=>(0,B.jsx)(ll,{item:e,onRemove:t},e.id))})}function dl(e){return{drop:{onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:t=>{t.dataTransfer.files.length!==0&&(t.preventDefault(),e(Array.from(t.dataTransfer.files)))}},onPaste:t=>{let n=Array.from(t.clipboardData.files);n.length!==0&&(t.preventDefault(),e(n))}}}function fl(e){return(0,B.jsxs)(`label`,{className:e.className,title:e.title,children:[e.children,(0,B.jsx)(`input`,{type:`file`,multiple:!0,className:`sr-only`,disabled:e.disabled,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length>0&&e.onFiles(n)}})]})}var pl={image:`images`,pdf:`pdf`};function ml(e,t){let n=t.filter(e=>e.path!==void 0);return n.length===0?e:`${e}\n\n${n.map((e,t)=>`${pl[e.kind??`image`]??`files`}[${t}]: ${e.path}`).join(`
16
+ 这个 worktree 在该 PR 的头部({head},合入 {base})。对照 {base} 阅读改动(git diff origin/{base}...HEAD),然后告诉我你的发现:bug、风险、缺失的测试、不清楚的地方。不要推送、评论或批准这个 PR;在这里汇报。`}},ct=n({en:()=>lt,zh:()=>ut}),lt={runLog:{title:`Runs`,all:`all`,outcome:{ok:`ok`,blocked:`blocked`,failed:`failed`,skipped:`skipped`},source:{schedule:`schedule`,manual:`manual`,webhook:`webhook`},blocked:{"task-missing":`task is gone`,"awaiting-owner":`waiting on a decision`,"report-missing":`last run never reported`,quota:`rate limited`,"engine-error":`engine error`,"engine-dead":`engine stopped`,"awaiting-permission":`waiting on a permission`,busy:`still working`},blockedRun:`blocked: {reason}`,empty:`No runs match.`,more:`+{count} more`}},ut={runLog:{title:`运行记录`,all:`全部`,outcome:{ok:`成功`,blocked:`受阻`,failed:`失败`,skipped:`跳过`},source:{schedule:`定时`,manual:`手动`,webhook:`Webhook`},blocked:{"task-missing":`任务已不存在`,"awaiting-owner":`等你做决定`,"report-missing":`上次运行没有汇报`,quota:`触发限流`,"engine-error":`引擎出错`,"engine-dead":`引擎已停止`,"awaiting-permission":`等你授权`,busy:`仍在运行`},blockedRun:`受阻:{reason}`,empty:`没有符合条件的运行。`,more:`另有 {count} 条`}},dt=n({en:()=>ft,zh:()=>pt}),ft={settings:{title:`Settings`,open:`settings`,sections:{connectors:`Connectors`,appearance:`Appearance`,notifications:`Notifications`,snippets:`Snippets`,about:`About`,voice:`Voice`},groups:{preferences:`Preferences`,agents:`Agents and tools`,more:`More`},pages:{general:`Language, layout, and where Rove opens files and creates worktrees.`,appearance:`Theme, colours, and how tasks and panes look.`,notifications:`When Rove tells you a task finished or needs you.`,keys:`Rebind chords in your own file, and how the prefix guide behaves.`,engines:`The coding agents Rove can start, and how it plugs into them.`,autoRouting:`What each depth tier starts, and who picks the tier.`,voice:`Dictation: the recognizer that turns what you say into prompts.`,connectors:`Accounts Rove uses, here and on your other machines.`,plugins:`Built-in pages and registered plugins.`,about:`Versions, updates, and this browser.`,feedback:`Send a note to the Rove team.`,dev:`Experimental switches, restarts and resets.`,snippets:`Prompt text you reuse. Type @name in a prompt to insert it.`},connectors:{githubDescription:`Clone, push and open PRs on every machine with one GitHub account`,connect:`Connect`,disconnect:`Disconnect`,disconnectBody:`Signs this machine's gh out of GitHub, for every tool that uses gh and not only Rove. Other machines keep their own sign-ins.`,machines:`Machines`,thisMachine:`This machine`,machinesHint:`Each machine signs in to GitHub by itself. The mark says whether it uses the same account as this one.`,refresh:`Check again`,refreshing:`Checking…`,useRove:`Use Rove's account`,loginThere:`Log in there`,codeHint:`Enter this code at GitHub (click the code to copy it)`,openGithub:`Open github.com/login/device`,codeCopied:`Code copied`,syncing:`Signed in. Bringing the other machines along…`,loginFailed:`Sign-in failed: {error}`,dismiss:`Dismiss`,loading:`checking…`,markSame:`✓ same account`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ signed out`,markNoGh:`gh is not installed`,markOutdated:`Rove there is outdated`,markOffline:`offline`,markDenied:`refuses credential changes`,markFailed:`could not check`,detail:`git over {protocol} · SSH key {ssh}`,synced:`{machine} now uses @{login}`},general:{groupInterface:`Interface`,groupFiles:`Worktrees`,groupTerminal:`Terminal`,tabStrip:`Tab strip`,scrollback:`Scrollback`},appearance:{groupColours:`Colours`,groupTasks:`Tasks and panes`,taskColorsNote:`Gives each task its own hue on the working border and in the list.`,colorblindNote:`Shows added and removed lines in blue and red instead of green and red.`,workingBorderNote:`The pane's border while the selected task is working.`,railGroup:`Task list`,railGroupProject:`By project`,railGroupState:`By state`,statusMark:`Task status`,statusMarkEngine:`Engine icon`,statusMarkBoth:`Icon and dots`,statusMarkDots:`Dots only`,previewWorking:`Working`,previewDone:`Finished, unread`,previewIdle:`Idle`,previewWaiting:`Waiting for you`,previewBroken:`Broken`,previewTitle:`Fix the login redirect`},notifications:{toastNote:`A popup in the corner of this page.`,volume:`Chime volume`},about:{groupRove:`Rove`,daemon:`Daemon`,daemonCurrent:`rove {version}, same build as this page`,daemonStale:"rove {version} is out of date; run `rove daemon restart`",updates:`Updates`,browser:`This browser`,browserHint:`Forget this browser's token. A login token is revoked on the host too.`,access:`Access`,signIn:`Sign-in`,signInMode:{open:`None`,password:`Password`,token:`Token link`},signInHint:{open:`A browser on this computer opens Rove with no link or password. Phones and other computers still need a token.`,password:`A browser without a token signs in with the password. Token links keep working.`,token:`Only the link rove printed, or a device token, gets in. Password sign-in is off.`},passwordSet:`Set a password`,passwordChange:`Change the password`,passwordHint:`At least {min} characters. It is stored hashed on this computer.`,passwordField:`New password`,passwordSave:`Save`,signOut:`Sign out`},engines:{enabled:`Offer {name} when picking an engine`,default:`Make {name} the default engine`,namePlaceholder:`Display name (blank = default)`,rename:`Rename`,reset:`Reset to defaults`,remove:`Remove engine`,save:`Save`,cancel:`Cancel`},plugins:{builtIn:`Built in`,builtInHint:`First-party pages. Turning one off removes its entry from the rail.`,registered:`Registered plugins`,empty:`No other plugins registered.`,linked:`linked`,unsupportedPlatform:`unsupported platform`,turnOn:`Install {name}`},feedback:{hint:"Files a public GitHub issue on the Rove repo, through `gh` on the machine running rove. Without a signed-in `gh` you get a prefilled link to open instead.",kindLabel:`Kind`,kindBug:`Bug`,kindIdea:`Idea`,kindQuestion:`Question`,titleLabel:`Title`,body:`What happened`,send:`File issue`,sent:`Filed issue #{number}`,notFiled:`Not filed yet. {hint}`,openLink:`Open the prefilled issue`,report:`Report a problem with an agent`,reportNote:`An agent asks what went wrong, drafts the issue with you and files it.`,reportFailed:`Could not start the conversation.`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`."}},prefs:{languageHint:`Display language, shared with the TUI.`,soundHint:`chime, plus a desktop notification while this tab is in the background`,soundVolumeHint:`Plays the new level when you pick it.`,push:`Notify when this page is closed`,pushHint:`This browser gets a notification when a task finishes, needs you or fails, even with no Rove page open. Follows the cross-task switch.`,pushUnsupported:`This browser can't receive push here: it needs https (or localhost), and on iPhone/iPad the page added to the home screen.`,pushBlocked:`Notifications are blocked for this site; allow them in the browser's site settings.`,pushFailed:`Couldn't turn it on: {error}`,zenHint:`Hide the Files pane. The zen chip and ctrl+a z toggle it and write this same setting.`,editInTui:`Edit it in the TUI.`,tierModel:`model`,tierEdit:`Edit`,tierEffort:`Reasoning effort`,classifierConnection:`Classifier connection`,unset:`(none)`,modeAuto:`Auto (follow the browser)`,themePreviewHint:`Point at a theme to see this page in it; click to keep it. The TUI follows.`,themeUser:`yours`,themeInstalled:`Installed`,themeMoreHint:`Not installed yet: point to preview, click to install and switch.`,themeBrowse:`Browse {count} more from rove.run`,themeHide:`Hide themes from rove.run`,themeGet:`get`,themeInstalling:`installing…`,themeInstallFailed:`failed, retry`,themeAgent:`Make one with an agent`,themeAgentHint:`opens a Scratch session; reopen Settings to see what it wrote.`,themeAgentFailed:`couldn't open the session; try again.`,themeAgentPrompt:"Make me a new Rove color theme. Ask me first what look I want, unless I already said. Save it as one JSON file in {dir} (for example {dir}/my-theme.json); the file name is the theme's name. The format is in https://github.com/sma1lboy/rove/blob/main/docs/themes.md and the JSON schema is https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json. Start from https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json, give each color slot a { dark, light } pair, and keep text readable on every background. When it's saved, run `rove theme list` to check it loads, then tell me the name: it appears in Settings → Appearance.",resetButton:`Reset`,resetHint:`Clears this Mac's saved settings and task list, restarts the Rove daemon, then reloads this page. Worktrees on disk and engine session history are not touched.`,resetBody:`Wipes ~/.config/rove/state.json and ~/.rove/tasks.json and restarts the daemon, then reloads this page with an empty task list. Worktrees on disk and engine session history are NOT touched.`,restartButton:`Restart`,restartHint:`Stops the Rove daemon and starts a fresh one; this page reconnects on its own. Running engine sessions live in the PTY host and survive it.`,restartBody:`Stops the Rove daemon and starts a fresh one, picking up daemon edits. This page reconnects in a few seconds. Running engine sessions survive.`,keysYaml:`The file is read on the Mac; changes apply when you come back to this page.`},keys:{editHint:`Click a key to record a new one, then press the key you want. To put it behind the prefix, press the prefix key first. The × removes it.`,reset:`Reset`,recordFor:`Record a key for {name}`,removeFor:`Remove the key for {name}`,pluginNoTask:`Select a task before using a plugin chord.`,pluginChords:`Plugin chords`,agent:`Change them with an agent`,agentHint:`opens a Scratch session; reopen Settings to see what it changed.`,agentFailed:`couldn't open the session; try again.`,agentPrompt:"Change my Rove keybindings. Ask me first what I want changed, unless I already said. Edit {path} (create it if it is missing; keep existing entries and comments you were not asked to change). The format, every binding id and its default chord are in https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md (see Customizing). Only use binding ids listed there; a direct override replaces that binding's whole chord list, and null unbinds. The file must stay valid YAML: check it parses (for example with `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}` or any YAML parser you have). Rove reloads it live, and unknown ids or invalid chords are ignored with a warning, so when you are done tell me what you changed and ask me to reopen Settings → Keybindings: it lists every applied override and every warning."},pages:{attachTooLarge:`{name} is larger than 500 MB`,new:`[ new ]`,routinePause:`[ pause ]`,routineEnable:`[ enable ]`,delete:`[ delete ]`,routinesNeedYou:`NEEDS YOU`,routinesActive:`ACTIVE`,routinesPaused:`PAUSED`,laterStarts:`LATER`,laterCancel:`[ cancel ]`,laterFailed:`Did not start: {error}`,laterCancelFailed:`Could not cancel the start: {error}`,routineSchedule:`Schedule`,routineNext:`Next run`,routineProject:`Project`,routineDelivers:`Delivers to`,routineEngine:`Engine`,routineChangeEngine:`[ change ]`,routinePrompt:`PROMPT`,routineScript:`SCRIPT`,cronDown:`Decrease {field}`,cronUp:`Increase {field}`,storySave:`save`,storySaveStart:`save & start`,storyStart:`start`,attachHintTouch:`paste a path / a screenshot → inserts an image placeholder`}},pt={settings:{title:`设置`,open:`设置`,sections:{connectors:`连接器`,appearance:`外观`,notifications:`通知`,snippets:`片段`,about:`关于`,voice:`语音`},groups:{preferences:`偏好`,agents:`智能体与工具`,more:`更多`},pages:{general:`语言、布局,以及 Rove 在哪里打开文件、创建 worktree。`,appearance:`主题、颜色,以及任务和面板的外观。`,notifications:`任务完成或需要你时,Rove 怎么提醒。`,keys:`在你自己的文件里重绑快捷键,以及前缀引导的行为。`,engines:`Rove 能启动的编码智能体,以及它如何接入它们。`,autoRouting:`每个深度档位启动什么,以及由谁选择档位。`,voice:`口述:把你说的话变成提示词的识别器。`,connectors:`Rove 使用的账号,本机和你的其他机器。`,plugins:`内置页面和已注册的插件。`,about:`版本、更新,以及此浏览器。`,feedback:`给 Rove 团队留一条意见。`,dev:`实验开关、重启和重置。`,snippets:`常用的提示词文本。在提示词里输入 @名称 即可插入。`},connectors:{githubDescription:`用同一个 GitHub 账号在每台机器上克隆、推送和开 PR`,connect:`连接`,disconnect:`断开`,disconnectBody:`把这台机器的 gh 从 GitHub 退出登录,所有用 gh 的工具都会受影响,不只是 Rove。其他机器保持各自的登录。`,machines:`机器`,thisMachine:`本机`,machinesHint:`每台机器各自登录 GitHub。右边的标记表示它和本机用的是不是同一个账号。`,refresh:`重新检查`,refreshing:`检查中…`,useRove:`使用 Rove 的账号`,loginThere:`在那里登录`,codeHint:`到 GitHub 输入这个验证码(点击验证码可复制)`,openGithub:`打开 github.com/login/device`,codeCopied:`验证码已复制`,syncing:`已登录,正在同步其他机器…`,loginFailed:`登录失败:{error}`,dismiss:`关闭`,loading:`检查中…`,markSame:`✓ 同一账号`,markDifferent:`⚠ @{login}`,markSignedOut:`✗ 未登录`,markNoGh:`未安装 gh`,markOutdated:`那边的 Rove 版本过旧`,markOffline:`离线`,markDenied:`拒绝修改凭据`,markFailed:`无法检查`,detail:`git 走 {protocol} · SSH 密钥 {ssh}`,synced:`{machine} 现在使用 @{login}`},general:{groupInterface:`界面`,groupFiles:`Worktree`,groupTerminal:`终端`,tabStrip:`标签栏`,scrollback:`回滚行数`},appearance:{groupColours:`颜色`,groupTasks:`任务与面板`,taskColorsNote:`让每个任务在工作边框和列表里有自己的色调。`,colorblindNote:`新增和删除的行用蓝色和红色,而不是绿色和红色。`,workingBorderNote:`所选任务工作时,面板边框的样子。`,railGroup:`任务列表`,railGroupProject:`按项目`,railGroupState:`按状态`,statusMark:`任务状态`,statusMarkEngine:`引擎图标`,statusMarkBoth:`图标加点阵`,statusMarkDots:`只有点阵`,previewWorking:`正在跑`,previewDone:`完成未读`,previewIdle:`空闲`,previewWaiting:`等你回答`,previewBroken:`出错`,previewTitle:`修复登录跳转`},notifications:{toastNote:`本页角落里的弹出提示。`,volume:`提示音音量`},about:{groupRove:`Rove`,daemon:`守护进程`,daemonCurrent:`rove {version},与本页同一版本`,daemonStale:"rove {version} 版本过旧;运行 `rove daemon restart`",updates:`更新`,browser:`此浏览器`,browserHint:`忘掉此浏览器的令牌。登录得到的令牌也会在主机上吊销。`,access:`访问`,signIn:`登录方式`,signInMode:{open:`免登录`,password:`密码`,token:`Token 链接`},signInHint:{open:`本机浏览器不用链接或密码就能打开 Rove。手机和其他电脑仍然需要 token。`,password:`没有 token 的浏览器用密码登录。Token 链接照常可用。`,token:`只有 rove 打印的链接或设备 token 能进。密码登录关闭。`},passwordSet:`设置密码`,passwordChange:`修改密码`,passwordHint:`至少 {min} 个字符。以哈希形式存在本机。`,passwordField:`新密码`,passwordSave:`保存`,signOut:`退出登录`},engines:{enabled:`选引擎时列出 {name}`,default:`把 {name} 设为默认引擎`,namePlaceholder:`显示名称(留空 = 默认)`,rename:`重命名`,reset:`恢复默认`,remove:`移除引擎`,save:`保存`,cancel:`取消`},plugins:{builtIn:`内置`,builtInHint:`官方页面。关掉后,它在侧栏的入口会消失。`,registered:`已注册的插件`,empty:`没有其他已注册的插件。`,linked:`已链接`,unsupportedPlatform:`平台不支持`,turnOn:`安装 {name}`},feedback:{hint:"通过运行 rove 那台机器上的 `gh`,在 Rove 仓库提一个公开的 GitHub issue。没有登录 `gh` 时会给你一条预填好的链接。",kindLabel:`类型`,kindBug:`缺陷`,kindIdea:`想法`,kindQuestion:`问题`,titleLabel:`标题`,body:`发生了什么`,send:`提交 issue`,sent:`已提交 issue #{number}`,notFiled:`还没提交。{hint}`,openLink:`打开预填好的 issue`,report:`让 agent 帮我报告问题`,reportNote:`由 agent 问清哪里不对,和你一起起草 issue 并提交。`,reportFailed:`没能开始对话。`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 `${ROVE_HOME_DIR:-$HOME}/.rove/daemon.log` 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。"}},prefs:{languageHint:`显示语言,与 TUI 共用同一设置。`,soundHint:`提示音;本页在后台时另发桌面通知`,soundVolumeHint:`选中后会播放新音量。`,push:`页面关闭时也通知`,pushHint:`任务完成、需要你或出错时,即使没有打开任何 Rove 页面,这个浏览器也会收到通知。跟随「跨任务通知」开关。`,pushUnsupported:`这个浏览器在这里收不到推送:需要 https(或 localhost),iPhone/iPad 上还要先把页面添加到主屏幕。`,pushBlocked:`这个网站的通知被浏览器屏蔽了,去浏览器的网站设置里允许。`,pushFailed:`没能开启:{error}`,zenHint:`收起文件栏。zen 按钮和 ctrl+a z 切换时会写入同一个设置。`,editInTui:`请在 TUI 中编辑`,tierModel:`模型`,tierEdit:`编辑`,tierEffort:`推理强度`,classifierConnection:`分类器连接`,unset:`(无)`,modeAuto:`自动(跟随浏览器)`,themePreviewHint:`鼠标指向一个主题,整页就换成它看看;点一下就定下来。TUI 也会跟着换。`,themeUser:`自装`,themeInstalled:`已安装`,themeMoreHint:`尚未安装:指向即预览,点一下安装并切换。`,themeBrowse:`浏览 rove.run 上的另外 {count} 个主题`,themeHide:`收起 rove.run 的主题`,themeGet:`安装`,themeInstalling:`安装中…`,themeInstallFailed:`失败,重试`,themeAgent:`让 agent 做一个`,themeAgentHint:`会开一个 Scratch 会话;做好后重新打开设置就能看到。`,themeAgentFailed:`会话没打开,再试一次。`,themeAgentPrompt:"帮我做一个新的 Rove 配色主题。先问我想要什么风格,除非我已经说过。把它存成 {dir} 下的一个 JSON 文件(比如 {dir}/my-theme.json),文件名就是主题名。格式说明见 https://github.com/sma1lboy/rove/blob/main/docs/themes.md,JSON schema 是 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/theme.schema.json。以 https://raw.githubusercontent.com/sma1lboy/rove/main/packages/rove/src/tui/context/theme/claude.json 为起点,每个颜色槽都给 { dark, light } 两个值,并保证文字在每种背景上都看得清。存好后运行 `rove theme list` 确认能加载,然后告诉我主题名:它会出现在 设置 → 外观 里。",resetButton:`重置`,resetHint:`清空这台 Mac 上保存的设置和任务列表,重启 Rove 守护进程,然后刷新本页。磁盘上的工作树和引擎会话历史不受影响。`,resetBody:`清空 ~/.config/rove/state.json 和 ~/.rove/tasks.json 并重启守护进程,然后刷新本页,任务列表为空。磁盘上的工作树和引擎会话历史不会被动。`,restartButton:`重启`,restartHint:`停止 Rove 守护进程并启动新的进程,本页会自动重连。运行中的引擎会话在 PTY 宿主里,不受影响。`,restartBody:`停止 Rove 守护进程并启动新的进程,载入守护进程的改动。本页几秒后自动重连,运行中的引擎会话不受影响。`,keysYaml:`该文件在 Mac 上读取,改动会在你回到本页时生效。`},keys:{editHint:`点一个按键开始录入,再按你想要的键。想放到 prefix 后面,就先按 prefix 键。× 是删掉它。`,reset:`恢复默认`,recordFor:`为「{name}」录入按键`,removeFor:`删掉「{name}」的按键`,pluginNoTask:`使用插件快捷键前请先选中一个任务。`,pluginChords:`插件快捷键`,agent:`让 agent 来改`,agentHint:`会开一个 Scratch 会话;改好后重新打开设置就能看到。`,agentFailed:`会话没打开,再试一次。`,agentPrompt:"帮我改 Rove 的快捷键。先问我想改什么,除非我已经说过。编辑 {path}(不存在就新建;没让你改的条目和注释都保留)。格式、每个 binding id 及其默认按键见 https://github.com/sma1lboy/rove/blob/main/docs/KEYBINDINGS.md(Customizing 一节)。只用那里列出的 binding id;直接覆盖会替换该 binding 的整个按键列表,null 表示解绑。文件必须保持合法 YAML:确认它能解析(比如 `ruby -ryaml -e 'YAML.load_file(ARGV[0])' {path}`,或任何你有的 YAML 解析器)。Rove 会实时重新加载它,未知 id 或无效按键会被忽略并给出警告,所以改完后告诉我改了什么,并请我重新打开 设置 → 快捷键:那里会列出所有生效的覆盖和所有警告。"},pages:{attachTooLarge:`{name} 超过 500 MB`,new:`[ 新建 ]`,routinePause:`[ 暂停 ]`,routineEnable:`[ 启用 ]`,delete:`[ 删除 ]`,routinesNeedYou:`需要处理`,routinesActive:`运行中`,routinesPaused:`已暂停`,laterStarts:`稍后启动`,laterCancel:`[ 取消 ]`,laterFailed:`没有启动:{error}`,laterCancelFailed:`取消失败:{error}`,routineSchedule:`调度`,routineNext:`下次执行`,routineProject:`项目`,routineDelivers:`投递到`,routineEngine:`引擎`,routineChangeEngine:`[ 更换 ]`,routinePrompt:`提示词`,routineScript:`脚本`,cronDown:`减小{field}`,cronUp:`增大{field}`,storySave:`保存`,storySaveStart:`保存并启动`,storyStart:`启动`,attachHintTouch:`粘贴路径 / 截图 → 插入图片占位行`}},mt=n({en:()=>ht,zh:()=>gt}),ht={transcript:{you:`You`,agent:`Agent`,system:`System`,copy:`[ copy ]`,copied:`Copied`,export:`[ export .md ]`,findPlaceholder:`Find in this conversation`,findCount:`{at} / {total}`,findNone:`no match`,prev:`[ prev ]`,next:`[ next ]`,older:`[ load earlier ]`,loading:`Reading the conversation…`,empty:`Nothing said yet.`,failed:`failed`,error:`Could not read the conversation: {error}`,retry:`[ retry ]`,noHistory:`This engine keeps no history Rove can read. Showing its terminal tail.`,tail:`Terminal tail`}},gt={transcript:{you:`你`,agent:`智能体`,system:`系统`,copy:`[ 复制 ]`,copied:`已复制`,export:`[ 导出 .md ]`,findPlaceholder:`在这段对话中查找`,findCount:`{at} / {total}`,findNone:`没有匹配`,prev:`[ 上一个 ]`,next:`[ 下一个 ]`,older:`[ 加载更早 ]`,loading:`正在读取对话…`,empty:`还没有对话内容。`,failed:`失败`,error:`读不到这段对话:{error}`,retry:`[ 重试 ]`,noHistory:`这个引擎没有 Rove 能读取的历史记录,显示的是它的终端末尾。`,tail:`终端末尾`}},_t=n({en:()=>vt,zh:()=>yt}),vt={usage:{title:`Usage`,open:`Open usage`,range:`last {days} days · tokens are input + output`,perDay:`Per day`,byModel:`By engine and model`,topTasks:`Top tasks`,quota:`Quota`,turns:`{count} turns`,loading:`Loading…`,empty:`No turns recorded in this window.`,failed:`Could not read usage: {error}`,cutoff:`The daemon returns at most {count} turns: {day} and earlier are partial.`,noReader:`{engines}: no turn reader, so their work is not counted here.`,removedTask:`(removed task)`,full:`{engine} {label} {percent}% · at this pace full around {time}, before it resets`,lasts:`{engine} {label} {percent}% · at this pace it lasts until the reset`,window:`{engine} {label} {percent}%`}},yt={usage:{title:`用量`,open:`打开用量`,range:`最近 {days} 天 · token 为输入加输出`,perDay:`按天`,byModel:`按引擎和模型`,topTasks:`用量最高的任务`,quota:`额度`,turns:`{count} 轮`,loading:`加载中…`,empty:`这段时间没有记录到任何一轮。`,failed:`无法读取用量:{error}`,cutoff:`守护进程最多返回 {count} 轮:{day} 及更早的数据不完整。`,noReader:`{engines}:没有轮次读取器,这里不统计它们的工作。`,removedTask:`(已删除的任务)`,full:`{engine} {label} {percent}% · 按当前速度约 {time} 用完,早于重置时间`,lasts:`{engine} {label} {percent}% · 按当前速度可撑到重置`,window:`{engine} {label} {percent}%`}},bt=n({en:()=>xt,zh:()=>St}),xt={voice:{say:`Say`,stop:`Stop {time}`,release:`Release {time}`,working:`Hearing…`,hint:`Dictate: tap to start and stop, or hold to talk and let go`,slideToSend:`Slide up to send`,tipSend:`Let go to send`,hold:`Hold to talk`,holdOrType:`Hold to talk, tap to type`,learned:`Learned {pairs}`,learnedPair:`{spoken} → {term}`,undo:`undo`,unlearned:`Forgotten`,unlearnFailed:`Couldn't undo: the voice sidecar isn't answering`,setup:{dictation:`Dictation`,backend:{off:`Off`,local:`On this Mac`,cloud:`Cloud`},unavailable:`This Rove cannot set up dictation`,offHint:`The mic is hidden. Nothing runs in the background.`,localNeeded:`Install the model below; the mic shows once it is ready.`,localInstalling:`Installing the model; the mic shows once it is ready.`,cloudNeeded:`Save an endpoint below to turn dictation on.`,ready:`{model} · ready`,starting:`Starting…`,localTitle:`Whisper large-v3`,localHint:`Runs on this Mac's GPU, about 3.5 GB to download. Audio never leaves the Mac.`,install:`Install`,installing:`Installing…`,installed:`Installed, about 4 GB on disk.`,failed:`Install failed: {line}`,uninstall:`Uninstall`,uninstallAsk:`Remove the model?`,cancel:`Cancel`,cloudTitle:`Cloud endpoint`,cloudHint:`Any OpenAI-compatible /audio/transcriptions service. The audio and your terms go there; the key stays on the Mac.`,baseURL:`Base URL`,model:`Model`,apiKey:`API key`,keySaved:`Saved; leave empty to keep it`,save:`Save`,saveAndUse:`Save and use`,forget:`Forget`,forgetAsk:`Remove the endpoint and its key?`}}},St={voice:{say:`说`,stop:`停 {time}`,release:`松手 {time}`,working:`在听…`,hint:`口述:点一下开始、再点一下结束,或按住说话、松手结束`,slideToSend:`上滑发送`,tipSend:`松手发送`,hold:`按住说话`,holdOrType:`按住说话,轻点打字`,learned:`记住了 {pairs}`,learnedPair:`{spoken} → {term}`,undo:`撤销`,unlearned:`已撤销`,unlearnFailed:`没能撤销:语音服务没有响应`,setup:{dictation:`语音输入`,backend:{off:`关闭`,local:`本机`,cloud:`云端`},unavailable:`这个 Rove 无法设置语音输入`,offHint:`不显示麦克风,后台也不运行任何东西。`,localNeeded:`在下面安装模型,就绪后显示麦克风。`,localInstalling:`正在安装模型,就绪后显示麦克风。`,cloudNeeded:`在下面保存一个服务地址后开启。`,ready:`{model} · 就绪`,starting:`启动中…`,localTitle:`Whisper large-v3`,localHint:`在这台 Mac 的 GPU 上运行,约需下载 3.5 GB。音频不离开这台 Mac。`,install:`安装`,installing:`安装中…`,installed:`已安装,约占 4 GB 磁盘。`,failed:`安装失败:{line}`,uninstall:`卸载`,uninstallAsk:`删除模型?`,cancel:`取消`,cloudTitle:`云端服务`,cloudHint:`任何兼容 OpenAI /audio/transcriptions 的服务。音频和你的术语会发到那里;密钥只存在这台 Mac 上。`,baseURL:`Base URL`,model:`模型`,apiKey:`API 密钥`,keySaved:`已保存;留空则保留原密钥`,save:`保存`,saveAndUse:`保存并使用`,forget:`删除`,forgetAsk:`删除这个服务地址和密钥?`}}},Ct=n({en:()=>wt,zh:()=>Tt}),wt={workspace:{pickTask:`pick a task on the left`,noTabs:`no open sessions in this task`,startEngine:`Start {engine}`,startSession:`Start session`,tabNotLive:`this tab has no running session`,restored:`restored session, read-only until reopened`,exited:`session ended (exit {code})`,attachFailed:`could not open this session: {message}`,reopen:`Reopen session`,reopening:`Reopening…`,reopenFailed:`could not reopen this session: {message}`,engineExited:`engine exited (code {code})`,retry:`Retry`,engineSettings:`Settings → Engines`,usageLimitUntil:`usage limit reached — rove resumes this task at {time}`,resumeQuota:`resume now`,resumingQuota:`resuming…`,usageLimit:`usage limit reached`,dismiss:`Dismiss`},tab:{shell:`shell`,engine:`engine`},firstRun:{title:`All your coding agents, in one place`,body:`When one runs out of quota, switch the task to another. Agents talk to each other directly, and every task gets its own worktree and branch.`,start:`Start your first task`},status:{connecting:`connecting`,retrying:`reconnecting, attempt {count}`,retry:`retry now`,backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},connect:{title:`open the link rove printed`,body:"Run `rove --web` and open the link it prints, or paste it here.",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`connect`,invalid:"that is not a `rove --web` link",failing:"can't reach rove. Is `rove --web` still running? After `--rotate-token`, open the new link.",forget:`forget this link`,notConnected:`not connected to rove — reconnecting (the view refreshes on its own)`},relay:{unpaired:"open the relay link that `rove --web --preset relay` printed on your computer",connecting:`connecting to your computer through the relay…`,loading:`loading rove…`,offline:"your computer is not answering on this relay. Is `rove --web --preset relay` still running? After `--rotate-relay`, open the new link. Reload to retry.",failed:`can't reach your computer through the relay ({error}). Reload to retry.`},login:{title:`sign in`,body:`Enter this Rove's password.`,field:`password`,submit:`sign in`,checking:`checking…`,wrong:`that did not work`,locked:`too many tries from here; try again in {minutes} min`,lockedHost:"password login is locked; run `rove --web --unlock` on the host",unreachable:"can't reach rove. Is `rove --web` still running?"},layout:{splitTooSmall:`Not enough room to split here`,railFold:`Fold the task list`,navBack:`Back`,navForward:`Forward`,railUnfold:`Unfold the task list`,dropUploading:`Uploading {name}…`,pasteNoImage:`No image on this browser's clipboard`,pasteNoAccess:`Can't read this browser's clipboard: {error}`,pasteNeedsHttps:`the page needs https or localhost`,refreshTimeout:"The daemon did not come back on the new build in time; check `rove daemon status`",railResize:`Drag to resize the task list, click to fold it, double-click to reset`,composerPlaceholder:`Message the agent`,composerSend:`Send`,composerAttach:`Attach a file`,composerNotSent:`Not sent: {reason}`,composerOldBridge:`This Mac's rove --web is older than this page; restart it to send from here.`,composerAtMenu:`The agent is waiting on a choice. Answer it with the 1–4 and ⏎ keys below; your message is kept.`,termKeys:`Terminal keys`,termKeyUp:`Up arrow`,termKeyDown:`Down arrow`,termKeyLeft:`Left arrow`,termKeyRight:`Right arrow`,termKeyInterrupt:`Ctrl+C, interrupt`,termKeyEnter:`Enter`,narrowTerminal:`Terminal`}},Tt={workspace:{pickTask:`从左边选一个任务`,noTabs:`这个任务没有打开的会话`,startEngine:`启动 {engine}`,startSession:`启动会话`,tabNotLive:`这个标签没有在运行的会话`,restored:`已恢复的会话,重新打开前只读`,exited:`会话已结束(退出码 {code})`,attachFailed:`打不开这个会话:{message}`,reopen:`重新打开会话`,reopening:`正在重新打开…`,reopenFailed:`重新打开失败:{message}`,engineExited:`引擎已退出(退出码 {code})`,retry:`重试`,engineSettings:`设置 → 引擎`,usageLimitUntil:`已达到用量上限 —— rove 会在 {time} 自动继续这个任务`,resumeQuota:`现在继续`,resumingQuota:`正在继续…`,usageLimit:`已达到用量上限`,dismiss:`忽略`},tab:{shell:`终端`,engine:`引擎`},firstRun:{title:`所有编程 agent,都在一个地方`,body:`一个额度用完了,换另一个接着干;agent 之间直接对话。每个任务有独立的 worktree 和分支,互不覆盖。`,start:`开始第一个任务`},status:{connecting:`连接中`,retrying:`重连中,第 {count} 次`,retry:`立即重试`,backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},connect:{title:`打开 rove 打印的链接`,body:"运行 `rove --web`,打开它打印的链接,或者把链接粘贴到这里。",placeholder:`http://127.0.0.1:7878/#token=…`,submit:`连接`,invalid:"这不是 `rove --web` 打印的链接",failing:"连不上 rove。`rove --web` 还在运行吗?用过 `--rotate-token` 的话,请打开新的链接。",forget:`忘掉这个链接`,notConnected:`没有连上 rove,正在重连(连上后这里会自动刷新)`},relay:{unpaired:"打开电脑上 `rove --web --preset relay` 打印的 relay 链接",connecting:`正在通过 relay 连接你的电脑…`,loading:`正在加载 rove…`,offline:"你的电脑没有在这个 relay 上应答。`rove --web --preset relay` 还在运行吗?用过 `--rotate-relay` 的话,请打开新的链接。刷新重试。",failed:`无法通过 relay 连到你的电脑({error})。刷新重试。`},login:{title:`登录`,body:`输入这台 Rove 的密码。`,field:`密码`,submit:`登录`,checking:`验证中…`,wrong:`登录失败`,locked:`这里尝试次数过多;{minutes} 分钟后再试`,lockedHost:"密码登录已锁定;在主机上运行 `rove --web --unlock`",unreachable:"连不上 rove。`rove --web` 还在运行吗?"},layout:{splitTooSmall:`这里放不下分屏了`,railFold:`折叠任务列表`,navBack:`后退`,navForward:`前进`,railUnfold:`展开任务列表`,dropUploading:`正在上传 {name}…`,pasteNoImage:`浏览器剪贴板里没有图片`,pasteNoAccess:`读不到浏览器剪贴板:{error}`,pasteNeedsHttps:`页面要走 https 或 localhost`,refreshTimeout:"守护进程没能及时以新版本重新上线,请检查 `rove daemon status`",railResize:`拖动调整任务列表宽度,单击折叠,双击还原`,composerPlaceholder:`给 agent 发消息`,composerSend:`发送`,composerAttach:`附加文件`,composerNotSent:`没发出去:{reason}`,composerOldBridge:`这台 Mac 上的 rove --web 比页面旧,重启它之后才能从这里发送。`,composerAtMenu:`agent 正在等你选择。用下方的 1–4 和 ⏎ 键回答;你的消息已保留。`,termKeys:`终端按键`,termKeyUp:`上方向键`,termKeyDown:`下方向键`,termKeyLeft:`左方向键`,termKeyRight:`右方向键`,termKeyInterrupt:`Ctrl+C 中断`,termKeyEnter:`回车`,narrowTerminal:`终端`}},Et=[nt,Ct,We,Xe,dt,Re,$e,ct,_t,mt,qe,Fe,at,Ve,bt],Dt=Object.assign({},...Et.map(e=>e.en)),Ot={en:Dt,zh:Object.assign({},...Et.map(e=>e.zh))};function kt(){try{let e=JSON.parse(localStorage.getItem(`rove.prefs`)??`null`);if(e&&typeof e==`object`&&`prefs`in e){let t=e.prefs;if(t&&typeof t==`object`&&`locale`in t&&(t.locale===`en`||t.locale===`zh`))return t.locale}}catch{}return globalThis.navigator?.language?.toLowerCase().startsWith(`zh`)?`zh`:`en`}var At=v(kt());function jt(){let e=typeof document>`u`?void 0:document.documentElement;e&&(e.lang=At.get()===`zh`?`zh-CN`:`en`)}jt(),At.subscribe(jt);function Mt(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function Nt(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}function R(e,t){return Nt(Mt(Ot[At.get()],e)??Mt(Dt,e)??e,t)}function Pt(e,t,n){return Nt(Mt(e[At.get()],t)??Mt(e.en,t)??t,n)}function z(){return y(At)}function Ft(e){let t=e.trim(),n=t.indexOf(`#`),r=n>=0?new URLSearchParams(t.slice(n+1)).get(`token`):t;return r&&/^[A-Za-z0-9_-]{43}$/.test(r)?r:null}var It=(...e)=>e.filter(Boolean).join(` `),Lt=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),B=t(((e,t)=>{t.exports=Lt()}))(),Rt=({danger:e=!1}={})=>`rounded-sm font-sans text-meta not-italic normal-nums text-paper active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 ${e?`bg-error`:`bg-accent`} px-3.5 py-1.5 font-semibold`,zt={link:`text-accent hover:underline`,filled:Rt(),danger:Rt({danger:!0}),action:`rounded-sm border-hairline border-line bg-inset px-3 py-1.5 font-sans text-meta text-ink hover:border-line-active hover:bg-menu active:scale-97 motion-reduce:active:scale-none disabled:cursor-default disabled:opacity-50 touch:min-h-10 focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`,floating:`whitespace-nowrap rounded-sm border-hairline border-line-active bg-surface px-2 py-0.5 font-mono text-meta text-ink shadow-popover`,row:``,pill:`inline-flex flex-none items-center gap-1.5 whitespace-nowrap font-mono text-meta text-muted hover:text-ink aria-[current=true]:text-accent`,card:`flex min-w-0 flex-col gap-1.5 rounded-sm border-hairline p-1.5 text-left focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-focus`},Bt={roomy:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-1.5 touch:after:-inset-y-3`,tight:`relative touch:after:absolute touch:after:content-[''] touch:after:-inset-x-0.75 touch:after:-inset-y-0.5`,none:``};function V({variant:e=`link`,hit:t=e===`link`?`roomy`:`none`,className:n,type:r=`button`,...i}){return(0,B.jsx)(`button`,{type:r,className:It(zt[e],Bt[t],n),...i})}var Vt=`text-meta leading-[inherit]`,Ht=`font-normal normal-nums`,Ut=`touch:relative touch:after:absolute touch:after:content-['']`,Wt=`flex h-full flex-col`,Gt=e=>[`app relative grid min-h-0 flex-1 grid-rows-[1fr_auto] transition-[grid-template-columns] duration-220 ease-snap motion-reduce:transition-none`,e.surface?`is-narrow narrow-${e.surface} grid-cols-[minmax(0,1fr)]`:e.zen?`grid-cols-[var(--rail-w,minmax(220px,280px))_1fr]`:`grid-cols-[var(--rail-w,minmax(220px,280px))_1fr_var(--panel-w,clamp(300px,28vw,440px))]`,e.zen?`is-zen`:``,e.expanded?`is-panel-expanded`:``,e.folded?`is-rail-folded`:``,e.peek?`is-rail-peek`:``,e.dragging?`is-dragging transition-none`:``].join(` `),Kt=[`relative narrow-content:hidden narrow-back:col-1 narrow-back:row-1 touch:select-none touch:touch-callout-none`,`wide:overflow-x-clip wide:pt-8.5 wide:[&>:not([data-grip])]:min-w-(--rail-open-w)`,`rail-folded:absolute rail-folded:inset-y-1.5 rail-folded:left-1.5 rail-folded:z-6 rail-folded:col-1 rail-folded:row-1 rail-folded:box-border rail-folded:w-(--rail-open-w) rail-folded:-translate-x-[calc(100%+12px)] rail-folded:rounded-md rail-folded:border-hairline rail-folded:border-line rail-folded:bg-surface rail-folded:shadow-none rail-folded:transition-[translate] rail-folded:duration-200 rail-folded:ease-snap rail-folded:motion-reduce:transition-none rail-folded:[&>:not([data-grip])]:min-w-0`,`rail-peek:translate-none rail-peek:shadow-dialog`].join(` `),qt=`rail-folded:col-2 panel-expanded:invisible panel-expanded:col-2 narrow-sidebar:hidden narrow-back:z-1 narrow-back:col-1 narrow-back:translate-x-(--back-x) narrow-back:bg-paper narrow-back:shadow-dialog`,Jt=`rail-folded:col-3 panel-expanded:z-2 panel-expanded:col-[2/-1] panel-expanded:bg-paper panel-expanded:pl-2`,Yt=`${Ut} touch:after:-inset-x-1.5 touch:after:-inset-y-3`,Xt=`flex items-center gap-2`,Zt=`flex min-w-0 items-baseline gap-1.5 px-1.5 py-0.5 text-meta font-bold ${Ut} touch:after:-inset-2.5 touch:after:-bottom-1`,Qt=`flex items-center rounded-sm px-2.5 py-1.5 text-muted aria-selected:bg-inset aria-selected:text-ink [&_svg]:size-4 ${Ut} touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.5`,$t=`keys-only m-0 overflow-hidden px-3.5 py-1 text-meta text-ellipsis whitespace-nowrap`,en=e=>`shortcut-badge absolute top-1/2 z-8 -translate-y-1/2 cursor-pointer rounded-sm border-hairline border-accent bg-surface px-1.25 py-px text-meta text-accent ${e?`right-full mr-1.5`:`right-1`}`,tn=`relative min-w-0 flex-1`,nn={left:[`[border-left:var(--hairline)_solid_var(--line)]`,`[border-left:var(--hairline)_solid_var(--accent)]`],top:[`[border-top:var(--hairline)_solid_var(--line)]`,`[border-top:var(--hairline)_solid_var(--accent)]`]},rn=(e,t)=>nn[e][+!!t],an=(e,t)=>{let n=`split-leaf absolute box-border flex min-h-0 min-w-0 ${t.active?`is-active`:``}`,r=t.active?`border-accent`:``;return e===`box`?`${n} rounded-[calc(var(--radius)-1px)] border-hairline ${t.active?`border-accent`:`border-line`}`:e===`line`?`${n} ${t.left?rn(`left`,t.active):``} ${t.top?rn(`top`,t.active):``} ${t.left||t.top?r:``}`:e===`rail`?`${n} ${rn(`left`,t.active)} ${r} ${t.top?`[--mt:6px]`:``}`:e===`rule`?`${n} ${rn(`top`,t.active)} ${r} ${t.left?`[--ml:8px]`:``}`:n},on=(e,t)=>`absolute right-2 z-3 bg-paper px-1 font-mono text-meta ${Ht} ${e?`-top-2`:`top-0.5`} ${t?`text-accent`:`text-subtle`}`,sn=`hidden gap-1 overflow-x-auto scrollbar-none [border-top:var(--hairline)_solid_var(--line)] bg-surface px-1.5 py-1 touch:flex`,cn=e=>`h-10 min-w-max touch-manipulation [flex:1_1_0] rounded-sm border-hairline bg-inset px-0.5 py-0 font-mono text-meta ${Ht} ${e?`border-accent text-accent`:`border-line text-ink`}`,ln=`prefix-guide fixed bottom-19 left-3 z-40 max-h-[60vh] w-[min(560px,calc(100vw-24px))] overflow-y-auto rounded-sm border-hairline border-line bg-surface px-3 py-2 text-meta shadow-popover motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,un=`min-w-[3ch] text-accent`,dn=`mb-1.5 flex justify-between gap-4`,fn=`columns-[2_220px] gap-x-5`,pn=`mb-2 break-inside-avoid`,mn=`flex w-full gap-2.5 px-0 py-px text-left text-ink enabled:hover:bg-hover disabled:cursor-default touch:py-2.5`,hn=`mx-0 my-2 overflow-x-hidden overflow-y-auto scrollbar-none`,gn=e=>`flex w-full min-w-0 justify-between gap-4 rounded-sm px-1.5 py-0.75 text-left font-mono text-meta ${Ht} whitespace-pre text-ink touch:py-2.5 ${e?`is-selected bg-hover`:``}`,_n=`min-w-0 overflow-hidden text-ellipsis`,vn=`w-full rounded-none border-0 [border-bottom:var(--hairline)_solid_var(--line)] bg-transparent px-1.5 py-2 font-mono text-meta font-normal normal-nums text-ink focus-visible:outline-none`,yn=`flex justify-between gap-4`,bn=`flex flex-col items-end ${Vt}`,xn=`mt-2 max-h-[52vh] overflow-y-auto`,Sn=`mb-2.5`,Cn=`m-0 mb-1 font-sans text-meta font-bold normal-nums text-accent`,wn=`flex gap-3 py-px ${Vt}`,Tn=`min-w-[14ch] text-ink`,En=`flex flex-wrap items-baseline gap-3 [border-bottom:var(--hairline)_solid_var(--warning)] bg-inset px-3.5 py-1 text-meta text-warning [&_span]:text-muted`,Dn=`keys-only fixed bottom-[34px] left-3 z-40 min-w-55 rounded-sm border-hairline border-line bg-surface px-3 py-2 font-mono text-meta ${Ht} text-ink shadow-popover`,On=e=>`mb-0.5 ${e?`motion-safe:[animation:sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`:`motion-safe:[animation:rise-in_140ms_ease-out,sink-out_140ms_ease-in_var(--hud-out,3860ms)_forwards]`}`,kn=`m-auto font-mono text-meta ${Ht} text-subtle`,An=`${kn} flex flex-col items-center gap-3 [&_p]:m-0`,jn=`workspace row-1 flex min-h-0 min-w-0 flex-col gap-1.5 px-1 pt-2 pb-1`,Mn=`flex min-h-0 flex-1 overflow-hidden rounded-md border-hairline border-line bg-paper focus-within:border-focus`,Nn=`working-flow:border-transparent working-flow:[background:linear-gradient(var(--paper),var(--paper))_0_0/100%_100%_padding-box,linear-gradient(90deg,var(--line),var(--task-ink,var(--focus)),var(--line),var(--task-ink,var(--focus)),var(--line))_0_0/300%_100%_border-box] working-flow:motion-safe:animate-flow-border`,Pn=`relative flex min-w-0 flex-1 flex-col`,Fn=`relative flex min-h-0 min-w-0 flex-1 flex-col`,In=`term-host relative min-h-0 min-w-0 flex-1 touch-none overflow-hidden`,Ln=`pointer-events-none absolute inset-0 z-5 h-full w-full`,Rn=`relative h-full [&.is-leaving]:pointer-events-none [&.is-leaving]:absolute [&.is-leaving]:inset-0 [&.is-leaving]:z-6`,zn=`pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre>div>div]:overflow-hidden [&_pre>div>div]:[height:var(--row-h,1.15em)] [&_pre>div>div]:[line-height:var(--row-h,1.15em)]`,Bn=e=>`absolute right-2.5 bottom-2.5 z-5 flex max-w-[calc(100%-20px)] flex-wrap items-center gap-x-3 gap-y-1 rounded-sm border-hairline border-line bg-inset px-2.5 py-1.25 font-mono text-meta ${Ht} ${e?`text-error`:`text-muted`} [&_.link:disabled]:pointer-events-none [&_.link:disabled]:opacity-60 [&_button]:whitespace-nowrap`,Vn=`col-span-full touch:[&_.link]:after:inset-[-2px_-6px_-4px] flex min-w-0 items-center gap-2 [border-top:var(--hairline)_solid_var(--line)] bg-surface px-3 py-1 font-mono text-meta ${Ht} whitespace-nowrap text-muted`,Hn=e=>`size-1.5 rounded-full ${e?`bg-warning`:`bg-subtle`}`,Un=`grid min-w-0 grid-cols-[auto_minmax(2rem,1fr)_auto] gap-x-2.5 gap-y-1 pt-2 pb-1 font-sans whitespace-nowrap text-meta text-subtle normal-nums`,Wn=`col-span-3 grid cursor-pointer grid-cols-subgrid items-center text-left hover:text-ink`,Gn={ok:`text-muted`,warn:`text-warning`,crit:`text-error`},Kn={ok:`text-success`,warn:`text-warning`,crit:`text-error`},qn=e=>`relative h-0.75 overflow-hidden rounded-full bg-[color-mix(in_srgb,currentColor_18%,transparent)] after:absolute after:inset-y-0 after:left-0 after:w-(--fill) after:rounded-full after:bg-current after:content-[''] ${Kn[e]??Kn.ok}`,Jn=`font-mono text-title font-bold normal-nums tracking-[0.02em] whitespace-nowrap`,Yn=`text-accent`,Xn=`grid h-full place-items-center p-6`,Zn=`flex w-[min(460px,100%)] flex-col gap-3 rounded-md border-hairline border-line bg-surface p-6 [&_p]:m-0`,Qn=`flex flex-col gap-2 p-3.5 text-left font-sans text-meta ${Ht} leading-[1.5]`,$n=`mx-2.5 my-3 font-mono text-meta text-subtle`,er=`font-sans text-meta text-subtle`,tr=`m-0 max-h-[38vh] overflow-auto rounded-sm border-hairline border-line bg-paper px-3 py-2.5 font-mono text-meta leading-[1.5] whitespace-pre-wrap wrap-anywhere`,nr=e=>`flex w-full flex-col gap-0.5 rounded-sm px-2.5 py-1.5 text-left focus-visible:bg-accent-soft focus-visible:outline-none ${e?`bg-accent-soft`:``}`,rr=`mx-0 mt-1 mb-0 max-h-47 list-none overflow-y-auto rounded-sm border-hairline border-line bg-inset p-0.5 font-mono text-meta`,ir=e=>`block w-full cursor-pointer overflow-hidden rounded-[calc(var(--radius-sm)-2px)] px-2 py-0.75 text-left text-ellipsis whitespace-nowrap [font:inherit] touch:py-2.5 ${e.cursor?`bg-hover`:``} ${e.accent?`text-accent`:e.cursor?`text-ink`:`text-muted`}`,H=`m-0 font-sans text-meta font-medium normal-nums`,ar=`link text-accent [&:hover]:underline touch-hit`,or=`rounded-sm border-hairline border-line bg-paper font-mono text-meta font-normal normal-nums text-ink focus-visible:border-line-active focus-visible:outline-none`,sr=`${or} w-full px-2.5 py-2`,cr=`actions flex items-center justify-end gap-3.5`;function lr({failing:e=!1}){z();let[t,n]=(0,h.useState)(``),[r,i]=(0,h.useState)(!1);return(0,B.jsx)(`div`,{className:Xn,children:(0,B.jsxs)(`form`,{className:Zn,onSubmit:e=>{e.preventDefault();let n=Ft(t);if(!n){i(!0);return}a(n),window.location.reload()},children:[(0,B.jsxs)(`span`,{className:Jn,children:[(0,B.jsx)(`span`,{className:Yn,children:`[`}),` rove `,(0,B.jsx)(`span`,{className:Yn,children:`]`})]}),(0,B.jsx)(`h1`,{className:`${H} text-muted`,children:R(`connect.title`)}),(0,B.jsx)(`p`,{className:e?`text-error`:`text-muted`,children:R(e?`connect.failing`:`connect.body`)}),(0,B.jsx)(`input`,{className:sr,autoFocus:!0,spellCheck:!1,placeholder:R(`connect.placeholder`),value:t,onChange:e=>{n(e.target.value),i(!1)}}),r&&(0,B.jsx)(`p`,{className:`text-error`,children:R(`connect.invalid`)}),(0,B.jsxs)(`div`,{className:cr,children:[e&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>{o(),window.location.reload()},children:R(`connect.forget`)}),(0,B.jsx)(`button`,{type:`submit`,className:Rt(),children:R(`connect.submit`)})]})]})})}var ur=`flex flex-col gap-1.5`,dr=`min-h-18 max-h-[50vh] leading-[1.45]`,fr=`flex flex-wrap gap-1.5`,pr=(e=!1,t=!1)=>`rounded-sm border-hairline px-2.5 py-1 font-mono text-meta font-normal not-italic normal-nums ${e?`border-accent bg-accent-soft text-ink`:`border-line hover:bg-hover ${t?`text-subtle`:`text-muted`}`}`,mr=`m-0 list-none p-0`,hr=`overlay fixed inset-0 z-20 grid justify-items-center [align-items:start] bg-(--scrim) pt-[12vh] motion-safe:animate-fade-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-fade-out short:pt-3`,gr=(e=!1)=>`dialog static m-0 flex max-h-[76vh] ${e?`w-[min(620px,calc(100vw-32px))]`:`w-[min(440px,calc(100vw-32px))]`} flex-col gap-3 rounded-md border-hairline border-line bg-surface px-5 py-4.5 text-inherit shadow-dialog focus:outline-none motion-safe:animate-rise-in [.is-leaving_&]:animate-sink-out short:max-h-[calc(100dvh-24px)] short:px-4 short:py-3`,_r=`flex items-center justify-between gap-3`,vr=`m-0 min-w-0 font-sans text-title leading-[1.4] font-semibold normal-nums text-ink wrap-anywhere`,yr=`grid size-6 place-items-center -my-1 mr-[-6px] ml-0 rounded-sm text-display leading-none text-muted hover:bg-inset hover:text-ink focus-visible:bg-inset focus-visible:text-ink touch:relative touch:after:absolute touch:after:-inset-2.5 touch:after:content-['']`,br=`dialog-body -m-0.5 flex min-h-0 flex-col gap-3 overflow-y-auto p-0.5 [&_p]:m-0 [&>.actions]:sticky [&>.actions]:-bottom-0.5 [&>.actions]:bg-surface [.dialog-body+div>&]:mt-3.5`,xr=(e=!1)=>`menu fixed z-30 flex max-h-[calc(100vh-16px)] ${e?`min-w-40`:`min-w-50`} origin-top-left flex-col overflow-y-auto rounded-md border-hairline border-line bg-surface p-1 shadow-popover motion-safe:animate-menu-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,Sr=e=>`flex items-baseline justify-between gap-6 rounded-[calc(var(--radius)-4px)] px-2.5 py-1.25 text-left text-body leading-[inherit] touch:py-2.5 ${e.danger&&e.selected?`bg-error text-paper`:e.selected||e.open?`bg-hover`:``} ${e.danger&&!e.selected?`text-error`:``} ${e.selected?`forced-colors:outline-2 forced-colors:-outline-offset-2 forced-colors:outline-[Highlight] forced-colors:outline-solid`:``}`,Cr=`font-mono text-meta normal-nums`,wr=e=>`${Cr} ${e.danger&&e.selected?`text-inherit`:e.selected?`text-muted`:`text-subtle`} touch:hidden!`,Tr=e=>`${Cr} ${e?`text-ink`:`text-subtle`}`,Er=`${Cr} text-accent`,Dr=`fixed right-3.5 bottom-8.5 z-40 flex flex-col gap-1.5 narrow:pointer-events-none narrow:top-12 narrow:bottom-auto narrow:left-3.5 narrow:items-end narrow:*:pointer-events-auto`,Or=`flex cursor-default flex-wrap items-baseline justify-between gap-x-3`,kr=e=>`toast max-w-105 cursor-pointer rounded-sm border-hairline border-line bg-inset px-3 py-1.5 text-left font-sans text-meta normal-nums wrap-anywhere ${e?`text-error`:`text-ink`} motion-safe:animate-rise-in [&.is-leaving]:pointer-events-none [&.is-leaving]:animate-sink-out`,Ar=`text-subtle`,jr=`flex items-baseline justify-between gap-3`,Mr=`mt-1`,Nr=`m-0 flex list-none flex-col gap-0.5 p-0`,Pr=`flex min-w-0 items-baseline gap-2.5`,Fr=`flex-none font-mono text-meta font-normal normal-nums min-w-[3ch] text-right text-subtle`,Ir=`flex items-baseline gap-1`,Lr=`min-w-0 flex-1`,Rr=`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,zr=`font-mono [&:hover]:text-accent`,Br={row:`min-h-6.5 touch:min-h-10`,file:`min-h-6 font-mono text-meta touch:min-h-10`,"file-narrow":`min-h-9 font-mono text-meta`,pane:`min-h-5.5 touch:min-h-10`},Vr=`bg-hover cursor-grabbing scale-[1.02] motion-reduce:scale-none`,Hr=`before:absolute before:top-1/2 before:h-3 before:w-0.5 before:-translate-y-1/2 before:rounded-full before:bg-subtle before:opacity-0 before:transition-opacity before:duration-150 before:content-[''] hover:before:opacity-70 touch:before:hidden`;function Ur(e){let t=e.stack?`flex-col items-stretch gap-0.5 px-2.5 py-1.5`:`items-center gap-2 px-2 py-0.75`,n=e.lifted?Vr:e.moving?`bg-accent-soft`:e.selected?`bg-menu`:`hover:bg-hover data-menu-open:bg-hover`;return`relative flex w-full rounded-sm text-left ${e.lifted?``:`active:scale-97 motion-reduce:active:scale-none`} ${e.grab&&!e.lifted?`cursor-grab before:left-0.5 ${Hr}`:``} ${t} ${Br[e.size??`row`]} ${n}`}var Wr=`row-title min-w-0 flex-1 truncate`,Gr=`row-title min-w-0 flex-auto truncate text-(length:--fs-title)`,Kr=`running-shimmer:bg-[linear-gradient(90deg,var(--ink)_0%,var(--ink)_35%,var(--accent)_50%,var(--ink)_65%,var(--ink)_100%)] running-shimmer:bg-size-[300%_100%] running-shimmer:bg-clip-text running-shimmer:text-transparent running-shimmer:animate-shimmer`,qr=`w-[1ch] flex-none text-center font-mono`,Jr=`grid w-[2ch] flex-none place-items-center font-mono text-subtle`,Yr=`flex flex-none gap-1.5 font-mono text-meta`;function U(e){return e instanceof Error?e.message:String(e)}function Xr(e){z();let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>{t.current&&!t.current.contains(document.activeElement)&&t.current.focus();let e=e=>{e.key===`Escape`&&(e.preventDefault(),L())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,B.jsx)(`div`,{className:hr,onMouseDown:e=>e.target===e.currentTarget&&L(),children:(0,B.jsxs)(`dialog`,{ref:t,tabIndex:-1,open:!0,className:gr(e.wide),"aria-label":e.title,children:[(0,B.jsxs)(`div`,{className:_r,children:[(0,B.jsx)(`h1`,{className:vr,children:e.title}),(0,B.jsx)(`button`,{type:`button`,className:yr,"aria-label":R(`dialog.close`),title:R(`dialog.close`),onClick:L,children:`×`})]}),e.children]})})}function Zr(){let[e,t]=(0,h.useState)(!1),[n,r]=(0,h.useState)(null);return{busy:e,error:n,setError:r,submit:async e=>{t(!0),r(null);try{await e(),L()}catch(e){r(U(e))}finally{t(!1)}}}}function Qr(e){let[t,n]=(0,h.useState)(e.initial??``),{busy:r,error:i,submit:a}=Zr();return(0,B.jsx)(Xr,{title:e.title,children:(0,B.jsxs)(`form`,{className:br,onSubmit:n=>{n.preventDefault(),(t.trim()||e.allowEmpty)&&a(()=>e.onSubmit(t.trim()))},children:[e.multiline?(0,B.jsx)(`textarea`,{className:`${sr} ${dr}`,"aria-label":e.title,autoFocus:!0,rows:4,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},onFocus:e=>e.currentTarget.setSelectionRange(t.length,t.length)}):(0,B.jsx)(`input`,{className:sr,"aria-label":e.title,autoFocus:!0,spellCheck:!1,value:t,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.select()}),i&&(0,B.jsx)(`p`,{className:`text-error`,children:i}),(0,B.jsx)(ti,{busy:r,submitLabel:e.submitLabel})]})})}function $r(e){let{busy:t,error:n,setError:r,submit:i}=Zr(),[a,o]=(0,h.useState)(!1),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(!1),d=(0,h.useRef)(null);(0,h.useEffect)(()=>d.current?.focus(),[]);let f=t=>void i(async()=>{try{a&&e.escalate?await e.escalate.run(l):await(t&&e.secondary?e.secondary.onConfirm():e.onConfirm())}catch(n){throw!a&&e.escalate?.when(n)&&(o(!0),c(n),u(t),r(U(n))),n}});return(0,B.jsx)(Xr,{title:a&&e.escalate?.title||e.title,children:(0,B.jsxs)(`div`,{className:br,children:[(0,B.jsx)(`p`,{className:`whitespace-pre-line text-muted`,children:a&&e.escalate?.body?e.escalate.body(s):e.body}),n&&!(a&&e.escalate?.body)&&(0,B.jsx)(`p`,{className:`text-error`,children:n}),(0,B.jsxs)(`div`,{className:cr,children:[(0,B.jsx)(`button`,{type:`button`,className:ar,onClick:L,children:R(`dialog.cancel`)}),e.secondary&&!a&&(0,B.jsx)(`button`,{type:`button`,className:Rt({danger:!0}),disabled:t,onClick:()=>f(!0),children:e.secondary.label}),(0,B.jsx)(`button`,{ref:d,type:`button`,className:Rt({danger:!0}),disabled:t,onClick:()=>f(!1),children:a&&e.escalate?e.escalate.label:e.confirmLabel})]})]})})}function ei(e){let t=Math.max(0,e.choices.findIndex(t=>t.value===e.current)),[n,r]=(0,h.useState)(t),{busy:i,error:a,submit:o}=Zr(),s=t=>void o(()=>e.onPick(t));return(0,h.useEffect)(()=>{let t=t=>{if(t.key===`ArrowDown`||t.key===`j`)r(t=>Math.min(e.choices.length-1,t+1));else if(t.key===`ArrowUp`||t.key===`k`)r(e=>Math.max(0,e-1));else if(t.key===`Enter`){let t=e.choices[n];t&&s(t.value)}else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)}),(0,B.jsx)(Xr,{title:e.title,children:(0,B.jsxs)(`div`,{className:br,children:[(0,B.jsx)(`ul`,{className:mr,children:e.choices.map((t,a)=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":t.value===e.current,disabled:i,className:Ur({selected:a===n}),onMouseEnter:()=>r(a),onClick:()=>s(t.value),children:[(0,B.jsx)(`span`,{className:`${qr} text-accent`,children:t.value===e.current?`●`:` `}),(0,B.jsx)(`span`,{className:Wr,children:t.label})]})},t.value))}),a&&(0,B.jsx)(`p`,{className:`text-error`,children:a})]})})}function ti({busy:e,submitLabel:t}){return(0,B.jsxs)(`div`,{className:cr,children:[(0,B.jsx)(`button`,{type:`button`,className:ar,onClick:L,children:R(`dialog.cancel`)}),(0,B.jsx)(`button`,{type:`submit`,className:Rt(),disabled:e,children:t})]})}function ni(e,t){let n=window.setInterval(()=>{(typeof document>`u`||document.visibilityState===`visible`)&&t()},e),r=()=>{document.visibilityState===`visible`&&t()};return document.addEventListener(`visibilitychange`,r),()=>{window.clearInterval(n),document.removeEventListener(`visibilitychange`,r)}}var ri={cancel:`Cancel`,failureHint:"Run `{command}` for diagnosis and next steps.",toastFailureHint:`Next: run rove doctor`,loading:`Loading…`,create:`create`,confirm:`Confirm`,paneCrash:{title:`This pane crashed`,hint:`The error was logged to client.log. Retry, or restart Rove if it keeps happening.`,regionTitle:`The {region} hit an error`,regionHint:"The rest of Rove keeps working. Retry below; if it persists, inspect client.log and run `rove doctor`.",retry:`[ retry ]`,region:{sidebar:`task list`,workspace:`workspace`,files:`file tree`,page:`page`}},rename:{defaultTitle:`Rename task`,defaultFieldLabel:`TITLE`,footerHint:`enter {submitLabel} · esc cancel`,defaultSubmitLabel:`rename`},prompt:{fieldLabel:`input`,submitLabel:`submit`}},ii={cancel:`取消`,failureHint:"运行 `{command}` 查看诊断和后续步骤。",toastFailureHint:`下一步:运行 rove doctor`,loading:`加载中…`,create:`创建`,confirm:`确认`,paneCrash:{title:`此面板已崩溃`,hint:`错误已记录到 client.log。可重试;若反复出现请重启 Rove。`,regionTitle:`{region}出错了`,regionHint:"Rove 的其余部分仍可正常使用。请在下方重试;若问题持续,请查看 client.log 并运行 `rove doctor`。",retry:`[ 重试 ]`,region:{sidebar:`任务列表`,workspace:`工作区`,files:`文件树`,page:`页面`}},rename:{defaultTitle:`重命名任务`,defaultFieldLabel:`名称`,footerHint:`enter {submitLabel} · esc 取消`,defaultSubmitLabel:`重命名`},prompt:{fieldLabel:`输入`,submitLabel:`提交`}},ai={fix:{hint:"{count} finding(s) above have a known fix — run `{command}` to review them one by one",none:`fix: nothing to fix — no known remediation applies to this report`,header:`fixes — each one asks before running:`,willRun:`will run: {command}`,confirmPrompt:`apply this fix? [y/N] `,done:`✓ done`,failed:`✗ exited with code {code}; inspect the command output above, then rerun rove doctor`,skipped:`· skipped`,nonInteractive:`no interactive terminal — nothing was executed; run the commands above yourself`,manualHeader:`manual steps — doctor prints these but never runs them:`,daemonRestartWhy:`safe to run: engine sessions live in the separate PTY host and survive a daemon restart`,daemonStale:`restart the daemon — it is running an older build than this CLI`,daemonDown:`start the daemon — it is not running`,hooksDown:`restart the daemon to re-establish the engine hook channel`,inspectStale:`restart the daemon — it predates the hook-channel check`,skillInstallWhy:`safe to run: installs skill files only; re-running is idempotent`,skillMissing:`install the Rove agent skill`,skillStale:`update the Rove agent skill to the version this build expects`,spawnHelper:`restore the exec bit on node-pty's spawn-helper — every node-pty PTY spawn fails without it`,spawnHelperWhy:"safe to run: chmod on two prebuilt binaries; idempotent, and `bun install` does the same",resetWhy:`stops the daemon, the PTY host, and every live session — not undoable, so doctor only prints it`,resetDaemonWedged:`the daemon process is alive but unreachable (wedged)`,resetPty:`the PTY host process is alive but its socket is unreachable (wedged)`,resetPtyStale:`the PTY host is still running an older build than the one you launched`,resetLegacy:`pre-v0.8 tmux sessions are still holding processes and memory`,orphans:`{count} process(es) outlived the PTY session that spawned them and are still running`,orphansWhy:`kills processes, which is not undoable — and a task you backgrounded on purpose looks the same; read the list, then run it yourself`,engineTabs:`engine tabs may hold a stale daemon socket path`,engineTabsAction:`close and reopen the affected engine tabs in the TUI`,engineTabsWhy:`kills that tab's live engine session — your call, not doctor's`,staleInstall:`the install this Rove runs from no longer exists on disk`,staleInstallAction:`npm install -g @sma1lboy/rove, then relaunch Rove`,staleInstallWhy:`doctor cannot reinstall Rove over the running process — a human has to, then relaunch`,humanOnlyWhy:`doctor does not install software or log in to accounts for you`,git:`git is not on PATH`,gitAction:`install git with your OS package manager`,noEngine:`no usable engine — no engine CLI is both installed and logged in`,noEngineAction:`install an engine CLI (claude, codex, copilot, or kimi) and log in`,noEngineLogin:`no usable engine — an engine CLI is installed but not signed in`,noEngineLoginAction:`run one of the installed engine CLIs ({list}) in a shell and complete its login`,windowsNode:`Node.js is missing — the Windows PTY host cannot start`,windowsNodeAction:`install Node.js from https://nodejs.org`,staleBun:`the Bun running Rove is older than this build supports — terminals will not paint`,staleBunAction:"upgrade Bun (`bun upgrade`, `brew upgrade bun`, or `npm install -g bun@latest`), then relaunch Rove"}},oi={fix:{hint:"上面有 {count} 项发现存在已知修法 — 运行 `{command}` 逐条查看",none:`fix: 无可修项 — 本次报告没有匹配到已知修法`,header:`修复项 — 每一条都会先询问再执行:`,willRun:`将执行: {command}`,confirmPrompt:`执行这条修复吗? [y/N] `,done:`✓ 完成`,failed:`✗ 退出码 {code};请检查上方命令输出,再运行 rove doctor`,skipped:`· 已跳过`,nonInteractive:`没有交互终端 — 未执行任何命令; 请自行运行上面的命令`,manualHeader:`人工步骤 — doctor 只打印, 永远不会替你执行:`,daemonRestartWhy:`可安全执行: 引擎会话在独立的 PTY host 里, daemon 重启后仍然存活`,daemonStale:`重启 daemon — 它运行的构建比当前 CLI 旧`,daemonDown:`启动 daemon — 它当前没有在运行`,hooksDown:`重启 daemon 以重建引擎 hook 通道`,inspectStale:`重启 daemon — 它的版本早于 hook 通道检查`,skillInstallWhy:`可安全执行: 只写入 skill 文件; 重复运行是幂等的`,skillMissing:`安装 Rove agent skill`,skillStale:`把 Rove agent skill 更新到当前构建期望的版本`,spawnHelper:`恢复 node-pty spawn-helper 的可执行位 — 缺了它 node-pty 的每次 PTY 启动都会失败`,spawnHelperWhy:"可安全执行: 只对两个预编译二进制做 chmod; 幂等, `bun install` 也会做同样的事",resetWhy:`会停掉 daemon、PTY host 和所有活动会话 — 不可撤销, 所以 doctor 只打印`,resetDaemonWedged:`daemon 进程存活但无法连接 (卡死)`,resetPty:`PTY host 进程存活但 socket 无法连接 (卡死)`,resetPtyStale:`PTY host 仍在跑比你启动的版本更旧的构建`,resetLegacy:`v0.8 之前的 tmux 会话仍占用进程和内存`,orphans:`有 {count} 个进程比启动它们的 PTY 会话活得更久, 现在还在运行`,orphansWhy:`会杀进程, 不可撤销 — 而且你故意放后台的任务看起来一模一样; 先看清单, 再自己执行`,engineTabs:`引擎 tab 可能持有过期的 daemon socket 路径`,engineTabsAction:`在 TUI 里关闭并重开受影响的引擎 tab`,engineTabsWhy:`会杀掉该 tab 的活动引擎会话 — 由你决定, doctor 不代劳`,staleInstall:`当前 Rove 所在的安装已从磁盘删除`,staleInstallAction:`npm install -g @sma1lboy/rove, 然后重新启动 Rove`,staleInstallWhy:`doctor 无法在运行中的进程上重装 Rove — 需要人工重装后重新启动`,humanOnlyWhy:`doctor 不会替你安装软件或登录账号`,git:`PATH 上找不到 git`,gitAction:`用你的系统包管理器安装 git`,noEngine:`没有可用引擎 — 没有任何引擎 CLI 同时满足已安装且已登录`,noEngineAction:`安装任一引擎 CLI(claude、codex、copilot 或 kimi)并登录`,noEngineLogin:`没有可用引擎 — 引擎 CLI 已安装, 但没有登录`,noEngineLoginAction:`在 shell 里运行已安装的引擎 CLI({list})之一并完成登录`,windowsNode:`缺少 Node.js — Windows PTY host 无法启动`,windowsNodeAction:`从 https://nodejs.org 安装 Node.js`,staleBun:`运行 Rove 的 Bun 版本低于本构建的要求 — 终端不会有任何输出`,staleBunAction:"升级 Bun (`bun upgrade` / `brew upgrade bun` / `npm install -g bun@latest`), 然后重新启动 Rove"}},si={mentionNoEngine:`No engine session in this task — nothing to mention into. Open one with ctrl+t.`,tabs:{all:`All`,changes:`Changes`},actions:{zen:`Zen`,createPR:`Ask agent to create PR`,diffAll:`[D] diff everything`},legend:{changes:`M modified · A added · D deleted · ? untracked`},scope:{working:`scope: working tree`,branch:`scope: vs {base}`,toggleHint:`b to toggle`,noBase:`no base ref for branch scope (no origin/HEAD, main or master)`},empty:{noTask:`(no task — press n to create)`,noFiles:`(empty worktree)`,noChanges:`(no changes — clean worktree)`},error:{retryHint:`press r to retry`,notGitRepo:"not a git repository — run `git init` here, or open a task in a repo",pathMissing:`the worktree directory is gone — reopen the task to re-create it`,permissionDenied:`permission denied reading the worktree — check the directory's owner and mode`,gitNotInstalled:`git is not on PATH — install it with your OS package manager`,gitFailed:"git command failed; run `git status` in this worktree to diagnose"},toast:{prOnTargetBranch:`Already on the target branch ({branch}) — ask the agent to create the PR from a task branch`,noPausedOperation:`Nothing to resolve — no merge, rebase or cherry-pick is paused here`,conflictReadFailed:`Git could not read the conflicted files. Run git status in this worktree, then retry.`,conflictSendFailed:`Could not send the conflict prompt. Open an engine tab in this task, then retry.`,ciNoFailingChecks:`No failing check logs to read — the run may have expired, or the checks are no longer red`,ciChecksUnavailable:"gh could not read this PR's checks: {detail}. Run `gh auth status`, then retry."}},ci={mentionNoEngine:`这个任务没有引擎会话——没有地方可以提及。用 ctrl+t 开一个。`,tabs:{all:`全部`,changes:`改动`},actions:{zen:`专注模式`,createPR:`让 agent 创建 PR`,diffAll:`[D] 查看全部改动`},legend:{changes:`M 已修改 · A 已添加 · D 已删除 · ? 未跟踪`},scope:{working:`范围:工作区改动`,branch:`范围:对比 {base}`,toggleHint:`按 b 切换`,noBase:`分支范围没有基准 ref(没有 origin/HEAD、main 或 master)`},empty:{noTask:`(暂无任务 — 按 n 创建)`,noFiles:`(worktree 为空)`,noChanges:`(无改动 — worktree 干净)`},error:{retryHint:`按 r 重试`,notGitRepo:"不是 git 仓库——在这里执行 `git init`,或改为打开仓库里的任务",pathMissing:`worktree 目录已不存在——重新打开该任务会重建它`,permissionDenied:`读取 worktree 时权限不足——请检查该目录的属主和权限`,gitNotInstalled:`PATH 上找不到 git——请用系统包管理器安装`,gitFailed:"git 命令失败;请在此 worktree 运行 `git status` 诊断"},toast:{prOnTargetBranch:`当前就在目标分支({branch})— 请在任务分支上让 agent 创建 PR`,noPausedOperation:`没有要解决的冲突——这里没有暂停中的合并、变基或拣选`,conflictReadFailed:`Git 无法读取冲突文件。请在此 worktree 运行 git status,然后重试。`,conflictSendFailed:`无法发送冲突提示。请在此任务中打开一个引擎标签页,然后重试。`,ciNoFailingChecks:`没有可读的失败检查日志——运行记录可能已过期,或检查已不再是红的`,ciChecksUnavailable:"gh 读不到这个 PR 的检查状态:{detail}。请运行 `gh auth status`,然后重试。"}},li={retryHint:`Correct the field above, then choose Create again.`,title:`New task`,legend:`{enter} · tab complete/fields · ctrl+[ ] mode · ctrl+e engine · esc cancel`,enterCreate:`enter create`,enterNext:`enter next field`,tabs:{existing:`For Existing`,clone:`For New Repo`,adopt:`Adopt Worktree`},field:{mode:`MODE`,tier:`DEPTH`,engine:`ENGINE`,effort:`EFFORT`,repo:`REPO`,fromBranch:`FROM BRANCH`,prompt:`FIRST MESSAGE`,extras:`ALSO INCLUDE`,gitUrl:`GIT URL`,parentDir:`PARENT DIR`,folderName:`FOLDER NAME`,baseBranch:`BASE BRANCH`,adoptFilter:`FILTER (PATH GLOB)`,opens:`OPENS`},intent:{task:`a new task worktree`,project:`the project itself`},placeholder:{folderName:`auto from url`,adoptFilter:`* — type e.g. feature-* to narrow`,prompt:`Describe a task or ask a question (optional)`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(remembered — next clone defaults to this dir)`,currentDir:`(current dir)`,noBranchesFound:`(no local branches found — typed text will be used as ref)`,noMatchBranch:`(no match — typed text will be used as ref)`,scanningWorktrees:`scanning worktrees…`,extrasNone:`(none — enter picks a repo; the first is the primary)`,extrasPicked:`{count} more repo(s) in this task`},picker:{moreAbove:`↑ {count} more`,moreBelow:`↓ {count} more`},scroll:{moreAbove:`↑ {count} more rows`,moreBelow:`↓ {count} more rows`},open:{failed:`Couldn't open the project: {error}`},adopt:{repoLine:`repo: {path}`,repoNone:`(none)`,noUnlinked:`no unlinked worktrees — every git worktree here is already a task`,noMatch:`no worktrees match the filter`,hintSelected:`{count} selected · enter toggles · ctrl+a all · Create imports`,hintDefault:`enter toggles · ctrl+a all · Create imports the highlighted row`,summaryAll:`Adopted {count} worktree(s)`,summaryPartial:`Adopted {done}/{total} worktrees — the rest failed (see log)`,summaryNone:`Couldn't adopt any worktree: {error}`},clone:{progressFallback:`Cloning…`,progressInto:`Cloning into {target}…`},button:{create:`Create`,cloning:`Cloning…`},error:{gitUrlRequired:`git URL is required`,gitUrlInvalid:`does not look like a git URL: {url}`,folderRequired:`folder name is required`,folderHasSeparator:`folder name cannot contain path separators`,parentRequired:`parent directory is required`,parentNotFound:`parent directory does not exist: {path}`,parentNotDir:`not a directory: {path}`,targetExists:`target already exists: {path}`,cloneFailed:`git clone failed: {error}`,noAdoptable:`no adoptable worktrees to import`,repoAmbiguous:`more than one saved repo is named {name} — pick the one you mean from the list`,tierUnavailable:`{tier} points at engine {engine}, which is not available here — retarget it in Settings → Auto routing`}},ui={retryHint:`请修正上方字段,然后再次选择创建。`,title:`新建任务`,legend:`{enter} · tab 补全/切字段 · ctrl+[ ] 切模式 · ctrl+e 引擎 · esc 取消`,enterCreate:`enter 创建`,enterNext:`enter 下一个字段`,tabs:{existing:`已有仓库`,clone:`克隆新仓库`,adopt:`接管 Worktree`},field:{mode:`模式`,tier:`深度`,engine:`引擎`,effort:`推理强度`,repo:`仓库`,fromBranch:`基准分支`,prompt:`第一条消息`,extras:`同时包含`,gitUrl:`git 地址`,parentDir:`父目录`,folderName:`文件夹名`,baseBranch:`基准分支`,adoptFilter:`过滤(路径 glob)`,opens:`打开`},intent:{task:`新建任务 worktree`,project:`项目本身`},placeholder:{folderName:`自动从地址推导`,adoptFilter:`* — 输入如 feature-* 来缩小范围`,prompt:`描述一个任务,或提个问题(可选)`},hint:{modeCycle:`ctrl+[ ]`,engineCycle:`ctrl+e`,remembered:`(已记住 — 下次克隆默认使用此目录)`,currentDir:`(当前目录)`,noBranchesFound:`(未找到本地分支 — 将直接使用输入文本作为 ref)`,noMatchBranch:`(无匹配 — 将直接使用输入文本作为 ref)`,scanningWorktrees:`正在扫描 worktree…`,extrasNone:`(未选 — 回车选一个仓库,第一个是主仓库)`,extrasPicked:`任务里另含 {count} 个仓库`},picker:{moreAbove:`↑ 还有 {count} 项`,moreBelow:`↓ 还有 {count} 项`},scroll:{moreAbove:`↑ 上方还有 {count} 行`,moreBelow:`↓ 下方还有 {count} 行`},open:{failed:`无法打开项目:{error}`},adopt:{repoLine:`仓库:{path}`,repoNone:`(无)`,noUnlinked:`没有未关联的 worktree — 此仓库所有 git worktree 均已是任务`,noMatch:`没有 worktree 匹配此过滤条件`,hintSelected:`已选 {count} 项 · enter 切换选中 · ctrl+a 全选 · 创建 导入`,hintDefault:`enter 切换选中 · ctrl+a 全选 · 创建 将导入高亮行`,summaryAll:`已接管 {count} 个 worktree`,summaryPartial:`已接管 {done}/{total} 个 worktree — 其余失败(详见日志)`,summaryNone:`没有 worktree 接管成功:{error}`},clone:{progressFallback:`克隆中…`,progressInto:`正在克隆到 {target}…`},button:{create:`创建`,cloning:`克隆中…`},error:{gitUrlRequired:`git 地址不能为空`,gitUrlInvalid:`不像是有效的 git 地址:{url}`,folderRequired:`文件夹名不能为空`,folderHasSeparator:`文件夹名不能包含路径分隔符`,parentRequired:`父目录不能为空`,parentNotFound:`父目录不存在:{path}`,parentNotDir:`不是目录:{path}`,targetExists:`目标路径已存在:{path}`,cloneFailed:`git clone 失败:{error}`,noAdoptable:`没有可接管的 worktree`,repoAmbiguous:`有多个已保存仓库都叫 {name} — 请从列表中选择你要的那个`,tierUnavailable:`{tier} 指向的引擎 {engine} 在这台机器上不可用——去 设置 → 自动路由 重新指定`}},di={engineTitle:`Engine and account`,engineChecking:`Checking installed engines and accounts…`,engineReady:`✓ Ready to start a task`,engineMissing:`No usable engine yet`,engineUsable:`✓ {engine}: ready`,engineSignedOut:`! {engine}: installed, not signed in`,engineSetup:"Install an engine using docs.rove.run/rove/engines, then run its CLI and sign in. Run `rove doctor --fix` to check setup; Settings → Engines lists integrations.",engineContinue:`❯ Continue to optional setup`,engineLegend:`enter continue · esc skip optional setup`,quickStart:`Start a task with a prompt`,quickIntent:`Creates an isolated worktree and branch. Use {key} for the full task dialog.`,tabShared:`New conversations share this task’s files`,tabIsolated:`{key}: new task, isolated worktree`,title:`Welcome to Rove`,subtitle:`Managed tasks get isolated worktrees and branches. Directory and project tasks reuse existing files.`,completionsLabel:`Shell completions for {shell}`,completionsExplain:`Tab-completes rove subcommands. One line is added to your shell config.`,skillLabel:`Rove agent skill`,skillExplain:`Lets the coding agents on this machine drive Rove themselves: start tasks, read other sessions, message them.`,optionYes:`Install`,recommended:`recommended`,stepCounter:`{n} / {total}`,optionNo:`Not now`,queued:`Queued — installs when you quit Rove`,skillInstalled:`Installed for {engines}`,skillFailed:`Install failed: {reason}`,skillNoEngines:`No coding agent here takes the skill`,skipped:`Skipped`,installFailed:`! {item} failed: {reason}. Retry: {command} (or quit Rove again).`,legend:`↑↓ select · enter confirm · esc close`,keysTitle:`Keyboard basics`,keysBare:`Bare keys act in the focused pane — {nav} moves, {open} opens.`,keysOnePress:`A few one-press chords are Rove's own — {newTab} new tab, {focusNext} next pane.`,keysPrefix:`{prefix} opens the command map — hold it a beat and a guide appears.`,keysHelp:`{help} shows the full live reference anytime.`,keysNext:`Next: Settings → Engines lists every engine and installs its activity hooks.`,keysLegend:`enter finish`,appliedCompletions:`✓ completions hooked into {path} (takes effect in new shells)`,keptCompletions:`· {path} already has a completions block — left untouched`},fi={engineTitle:`引擎与账户`,engineChecking:`正在检查引擎与账户…`,engineReady:`✓ 可以开始任务`,engineMissing:`还没有可用的引擎`,engineUsable:`✓ {engine}:可用`,engineSignedOut:`! {engine}:已安装,未登录`,engineSetup:"从 docs.rove.run/rove/engines 安装引擎,然后运行其 CLI 并登录。运行 `rove doctor --fix` 检查配置;设置 → 引擎 可查看集成。",engineContinue:`❯ 继续可选设置`,engineLegend:`enter 继续 · esc 跳过可选设置`,quickStart:`输入提示词开始任务`,quickIntent:`创建独立 worktree 和分支。按 {key} 打开完整任务对话框。`,tabShared:`新对话共享当前任务的文件`,tabIsolated:`{key}:新建任务,使用独立 worktree`,title:`欢迎使用 Rove`,subtitle:`托管任务使用独立的 worktree 和分支;目录与项目任务复用现有文件。`,completionsLabel:`{shell} 的 shell 补全`,completionsExplain:`让 rove 子命令支持 Tab 补全,会在你的 shell 配置里加一行。`,skillLabel:`Rove agent skill`,skillExplain:`让本机的编码 agent 自己操作 Rove:开任务、读其他会话、给它们发消息。`,optionYes:`安装`,recommended:`推荐`,stepCounter:`{n} / {total}`,optionNo:`跳过`,queued:`已排队 — 退出 Rove 后安装`,skillInstalled:`已为 {engines} 安装`,skillFailed:`安装失败:{reason}`,skillNoEngines:`这台机器上没有能装 skill 的编码 agent`,skipped:`已跳过`,installFailed:`! {item} 安装失败:{reason}。重试:{command}(或再次退出 Rove)。`,legend:`↑↓ 选择 · enter 确认 · esc 关闭`,keysTitle:`键盘基础`,keysBare:`裸键作用于当前聚焦面板 — {nav} 移动,{open} 打开。`,keysOnePress:`少量单次快捷键属于 Rove 自己 — {newTab} 新标签页,{focusNext} 切换面板。`,keysPrefix:`{prefix} 打开命令层 — 按住稍等会出现命令指南。`,keysHelp:`随时按 {help} 查看完整的实时键位表。`,keysNext:`接下来:设置 → 引擎 里列出每个引擎,并可在那里安装它们的活动钩子。`,keysLegend:`enter 完成`,appliedCompletions:`✓ 补全已写入 {path}(新开的 shell 生效)`,keptCompletions:`· {path} 里已有补全配置 — 未改动`},pi={title:`Quick task · {repoLabel}`,promptLabel:`PROMPT`,promptPlaceholder:`what should this task do?`,attemptsLabel:`ATTEMPTS`,engineLabel:`ENGINE`,branchLabel:`BRANCH`,legend:`enter create · tab fields · ctrl+e engine · ctrl+v attach · esc cancel`,startedRound:`Started {count} attempts`,roundPartial:`Started {ok}/{count} attempts — {failed} failed`},mi={title:`快速任务 · {repoLabel}`,promptLabel:`提示词`,promptPlaceholder:`这个任务要做什么?`,attemptsLabel:`尝试次数`,engineLabel:`引擎`,branchLabel:`分支`,legend:`enter 创建 · tab 切换字段 · ctrl+e 引擎 · ctrl+v 附件 · esc 取消`,startedRound:`已启动 {count} 个尝试`,roundPartial:`已启动 {ok}/{count} 个尝试 —— {failed} 个失败`},hi={cancel:`cancel`,forgetProjectTitle:`Remove project "{title}"?`,forgetProjectBody:"Forgets it from the projects list. The repo, its branches, worktrees, and any tasks under it stay on disk — re-add it with `rove add`.",forgetProjectConfirm:`remove`,deleteTitle:`Remove session "{title}"?`,deleteTitleDir:`Remove session "{title}"?`,deleteBodyDir:`Ends this session and closes all its tabs. Nothing on disk changes: the folder and its files stay.`,deleteBodyMain:`Ends this session and closes all its tabs. The project stays in your list and nothing on disk changes: the repo, its branches and worktrees stay.`,deleteBodyTask:`Ends this session, closes all its tabs and removes its worktree folder. The git branch stays.`,deleteBodyTaskBranch:`Ends this session, closes all its tabs and removes its worktree folder, and its git branch if it is merged. An unmerged branch stays.`,deleteConfirm:`remove`,childrenTitle:`"{title}" has {count} child tasks`,childrenBody:`Promote moves them up one level and keeps their worktrees and sessions. Remove with children removes them too.`,childrenPromote:`promote children`,childrenCascade:`remove with children`,childrenBodyMain:`Ends this session and closes its tabs; nothing on disk changes. Its child tasks keep running unless you delete them too.`,childrenKeepMain:`remove session`,childrenCascadeMain:`remove with children`,forceDeleteTitle:`"{title}" has uncommitted changes`,forceDeleteConfirm:`force remove`},gi={cancel:`取消`,forgetProjectTitle:`从列表中移除项目「{title}」?`,forgetProjectBody:"只是把它从项目列表里忘掉。仓库、分支、worktree 以及它下面的任务都会留在磁盘上——之后可以用 `rove add` 重新加回来。",forgetProjectConfirm:`移除`,deleteTitle:`移除会话「{title}」?`,deleteTitleDir:`移除会话「{title}」?`,deleteBodyDir:`结束这个会话,关闭它的所有标签页。磁盘上什么都不动:文件夹和里面的文件都会保留。`,deleteBodyMain:`结束这个会话,关闭它的所有标签页。项目仍留在列表里,磁盘上什么都不动:仓库、分支和 worktree 都会保留。`,deleteBodyTask:`结束这个会话,关闭它的所有标签页,并删除它的 worktree 文件夹。git 分支会保留。`,deleteBodyTaskBranch:`结束这个会话,关闭它的所有标签页,删除它的 worktree 文件夹,以及已合并的 git 分支。未合并的分支会保留。`,deleteConfirm:`移除`,childrenTitle:`「{title}」有 {count} 个子任务`,childrenBody:`提升会把它们上移一级,并保留它们的 worktree 和会话。连同子任务移除会把它们一并移除。`,childrenPromote:`提升子任务`,childrenCascade:`连同子任务移除`,childrenBodyMain:`结束这个会话并关闭它的标签页,磁盘上什么都不动。它的子任务会继续运行,除非你也选择把它们一并删除。`,childrenKeepMain:`移除会话`,childrenCascadeMain:`连同子任务移除`,forceDeleteTitle:`「{title}」有未提交的改动`,forceDeleteConfirm:`强制移除`},_i={noDaemonWorktree:"No daemon running — can't create the worktree. Start it with `rove daemon restart`.",noEditor:`No editor found — set ROVE_OPEN_EDITOR (e.g. 'code', 'cursor', 'nvim')`,openWorktreeFailed:`Couldn't open worktree with {label}`,worktreeErrorDeleting:`This task is being deleted — it can't be opened`,worktreeErrorNotGit:"This project isn't a git repo yet — a task needs a git branch. Run `git init` (+ a first commit) in the project, then open the task. Non-git support is coming.",worktreeErrorGeneric:`Couldn't create the worktree: {message}`,scratchAdopted:`Adopted into {repo} — save it as a project from New Task if you want it in the picker`,scratchOpenFailed:`Couldn't open a scratch shell: {message}`,scratchCloseFailed:`Couldn't close the scratch task: {message}`,worktreeGoneTitle:`Worktree for "{title}" is gone`,worktreeGoneBody:`Closed {count} tab(s). The branch {branch} is still there — reopen the task to re-create its worktree.`,checksPassingTitle:`Checks passed for "{title}"`,checksFailingTitle:`Checks failed for "{title}"`,checksResolvedBody:`PR {pr} on {branch}`,copiedId:`Copied task ID {text}`,copiedTab:`Copied tab address {text}`,copiedBranch:`Copied branch {text}`,copiedPath:`Copied path {text}`,copyFailed:`Couldn't reach a clipboard — no clipboard command on PATH, and this terminal refused OSC 52.`,forgetProjectFailed:`Couldn't remove the project — it stays in the projects list: {error}`,deleteFailed:`Couldn't delete "{title}" — the task and its worktree are untouched: {error}`,createFailed:`Couldn't create the task — nothing was created: {error}`,engineStartFailed:`Task created; engine did not start`,engineStartRetry:`{error}. Press ⏎ on the task to retry.`,forkFailed:`Couldn't fork the task — the original is untouched: {error}`,forkLeftBehind:`Started from the last commit — uncommitted work stays in the original task ({reason})`,childFailed:`Couldn't start the new conversation — the current one is untouched: {error}`,renameFailed:`Couldn't rename the task — it keeps its old title: {error}`,renameBranchFailed:`Couldn't rename the branch — it stays "{branch}": {error}`,switchEngineFailed:`Couldn't switch the engine — the task keeps the one it had: {error}`,setStatusFailed:`Couldn't set the status — it stays {status}: {error}`,pinFailed:`Couldn't change the pin — the task keeps its current place: {error}`,moveFailed:`Couldn't move the task — it keeps its current place: {error}`,moveToProjectFailed:`Couldn't move the task to that project — it stays where it was: {error}`,movedToProject:`Moved to {project} — the session and its checkout stay where they are`,issueChatFailed:`Couldn't start the issue chat — the issue is unchanged: {error}`,inboxMarkReadFailed:`Couldn't mark it read — it stays in the inbox: {error}`,inboxDismissFailed:`Couldn't dismiss it — it stays in the inbox: {error}`,engineSwitched:`Engine → {engine} (applies on reopen)`,statusSet:`Status → {status}`},vi={noDaemonWorktree:"守护进程未运行——无法创建 worktree。请运行 `rove daemon restart` 启动它。",noEditor:`未找到编辑器——请设置 ROVE_OPEN_EDITOR(如 'code'、'cursor'、'nvim')`,openWorktreeFailed:`无法用 {label} 打开 worktree`,worktreeErrorDeleting:`该任务正在删除中——无法打开`,worktreeErrorNotGit:"该项目尚非 git 仓库——任务需要 git 分支。请在项目中执行 `git init`(+ 首次提交)后再打开任务。非 git 项目的支持即将推出。",worktreeErrorGeneric:`无法创建 worktree:{message}`,scratchAdopted:`已归入 {repo}——若要出现在项目选择器里,可在新建任务中保存为项目`,scratchOpenFailed:`无法打开临时 Shell:{message}`,scratchCloseFailed:`无法关闭临时任务:{message}`,worktreeGoneTitle:`"{title}" 的 worktree 已消失`,worktreeGoneBody:`已关闭 {count} 个标签页。分支 {branch} 仍在——重新打开该任务会重建 worktree。`,checksPassingTitle:`「{title}」的 PR 检查已通过`,checksFailingTitle:`「{title}」的 PR 检查失败了`,checksResolvedBody:`PR {pr},分支 {branch}`,copiedId:`已复制任务 ID {text}`,copiedTab:`已复制标签页地址 {text}`,copiedBranch:`已复制分支 {text}`,copiedPath:`已复制路径 {text}`,copyFailed:`无法访问剪贴板——PATH 上没有剪贴板命令,这个终端也拒绝了 OSC 52。`,forgetProjectFailed:`移除项目失败——它仍在项目列表里:{error}`,deleteFailed:`删除「{title}」失败——任务和它的 worktree 都没有被改动:{error}`,createFailed:`创建任务失败——什么都没有被创建:{error}`,engineStartFailed:`任务已创建,引擎没有启动`,engineStartRetry:`{error}。在任务上按 ⏎ 重试。`,forkFailed:`fork 任务失败——原任务没有被改动:{error}`,forkLeftBehind:`已从最近一次提交开始——未提交的改动留在原任务里({reason})`,childFailed:`无法开始新对话——当前对话没有被改动:{error}`,renameFailed:`重命名任务失败——它仍用原来的标题:{error}`,renameBranchFailed:`重命名分支失败——它仍是「{branch}」:{error}`,switchEngineFailed:`切换引擎失败——任务仍使用原来的引擎:{error}`,setStatusFailed:`设置状态失败——它仍是 {status}:{error}`,pinFailed:`修改置顶状态失败——任务仍在原来的位置:{error}`,moveFailed:`移动任务失败——它仍在原来的位置:{error}`,moveToProjectFailed:`移到该项目失败——任务仍在原来的项目:{error}`,movedToProject:`已移到 {project}——会话和它的工作目录都没有动`,issueChatFailed:`启动议题会话失败——议题没有被改动:{error}`,inboxMarkReadFailed:`标记为已读失败——它仍留在收件箱里:{error}`,inboxDismissFailed:`忽略失败——它仍留在收件箱里:{error}`,engineSwitched:`引擎 → {engine}(重新打开后生效)`,statusSet:`状态 → {status}`},yi={nav:{kanban:`Kanban`,automations:`Routines`,issues:`Issues`,mods:`Mods`},header:{scratch:`Ungrouped`},search:{placeholder:`fuzzy filter`},sort:{label:`sort: {mode}`,hint:`Change the order (manual → newest → attention → name)`,reorderSwitched:`Reorder needs manual order — switched`,modes:{default:`manual`,recent:`newest`,attention:`attention`,name:`name`}},menu:{open:`Open`,collapseChildren:`Collapse children`,expandChildren:`Expand children`,newChat:`New conversation`,newShell:`New shell`,continueEngine:`Continue in another engine…`,newScratchChat:`New conversation (no folder)`,newTask:`New task`,newTaskFromBranch:`New task from this branch`,forgetProject:`Remove project`,fieldNotes:`Field notes`,rename:`Rename`,pin:`Pin`,unpin:`Unpin`,reorder:`Reorder row`,moveToTop:`Move to top`,reorderProject:`Reorder project`,runAgain:`Run again`,setStatus:`Set status`,moveToProject:`Move to project…`,copyId:`Copy task ID`,copyBranch:`Copy branch name`,copyPath:`Copy path`,openEditor:`Open in editor`,renameBranch:`Rename branch`,changeEngine:`Change engine`,fixChecks:`Fix failing checks`,rerunChecks:`Re-run failed checks`,syncBase:`Sync with base`,resolveConflicts:`Resolve conflicts`,land:`Land into base branch`,archive:`Archive`,unarchive:`Unarchive`,delete:`Remove session`},status:{backlog:`Backlog`,inProgress:`In progress`,inReview:`In review`,done:`Done`,canceled:`Canceled`,error:`Error`},setStatus:{title:`Set status`,current:`current`,footer:`↑↓ choose · enter set · esc cancel`},moveToProject:{title:`Move to project`,empty:"No other project yet — add one first, or run `rove api update --project PATH`",footer:`↑↓ choose · enter move · esc cancel`},sync:{done:`Merged {base} into this worktree`,alreadyCurrent:`Already up to date with {base}`,conflict:`Merge conflict — resolve then commit: {files}`,dirty:`Commit the worktree's changes first, then sync: {files}`,failed:`Sync failed: {error}`},archive:{done:`Archived {title}. Its worktree, branch and sessions are untouched`,restored:`Restored {title}`,busyTitle:`Archive while it's working?`,busyBody:`An engine in {title} is still working or waiting on you. Archiving hides the row without stopping it.`,busyConfirm:`Archive anyway`,failed:`Couldn't archive: {error}`,restoreFailed:`Couldn't restore: {error}`},rerun:{started:`Re-running failed checks`,none:`No failed checks to re-run`,external:`These checks didn't run on GitHub Actions; re-run them where they ran`,refused:`Re-run refused: {detail}`},changeEngine:{title:`Change engine`,current:`current`,effortLabel:`EFFORT`,noEffort:`engine default`,footer:{engine:`↑↓ engine`,effort:`←→ effort`,model:`tab model`,set:`enter set`,cancel:`esc cancel`}},engineModel:{label:`MODEL`,placeholder:`engine default`,loading:`listing models…`},tier:{swift:`swift`,standard:`standard`,deep:`deep`,manual:`manual`},tierDesc:{swift:`small, well-specified edits — the fastest, cheapest setting`,standard:`everyday feature work and bug fixes`,deep:`hard problems: unclear root causes, large refactors, design decisions`},runAgain:{title:`Run again`,source:`Brief from “{title}”`,hint:`Runs this brief again in a new task, on its own branch and worktree.`,confirm:`Run again`,footer:`↑↓ scroll · ←→ choose · enter run · esc cancel`},fieldNotes:{title:`Field notes`,empty:"No field notes for this repo yet — agents file one with `rove api note`.",loading:`Loading…`,footer:`↑↓ scroll · esc close`,footerDeletable:`↑↓ select · d delete · esc close`,confirmDelete:{title:`Delete this field note?`,body:`“{text}” stops being injected into new sessions on this repo. Nothing else changes.`}},confirm:hi,renameBranch:{title:`Rename branch`,fieldLabel:`branch`},moveChip:` move`,recentJump:`Recent: {title}`,archivedHit:`{title} · archived, enter unarchives`,machine:{connecting:`connecting…`,offline:`offline`,unsupported:`unsupported`,mismatch:`protocol mismatch`,filesElsewhere:`on {host}`,filesHint:`{host} is unreachable right now; its files show here again when it reconnects.`,terminalElsewhere:`This task runs on {host}, which is unreachable right now.`,runsOn:`on {host}`,noTabs:`No tabs on {host} yet — prefix t opens one there.`},empty:{noMatchSearch:`No matching tasks — esc to clear.`,noActiveProject:`No active tasks for this project.`,noActive:`No active tasks — create one above.`},activity:{working:`working`,rateLimited:`rate limited`,permissionNeeded:`needs permission`,error:`error`,dead:`engine exited`},group:{waitingOnYou:`needs you`,landing:`ready to land`,readyForReview:`needs review`,working:`working`},subtitle:{noTracking:`no activity tracking`,materializing:`materializing`,deleting:`deleting`,deleteFailed:`delete failed`},reBranch:{title:`Set branch`,fieldLabel:`branch`,hintNoBranches:`(no local branches — type a new name)`,hintNoMatch:`(no match — enter renames to this branch)`,footer:`↑↓ pick · enter set · esc cancel`},toast:_i},bi={nav:{kanban:`看板`,automations:`例行任务`,issues:`议题`,mods:`Mods`},header:{scratch:`未分组`},search:{placeholder:`模糊搜索`},sort:{label:`排序:{mode}`,hint:`切换排序(手动 → 最新 → 关注 → 名称)`,reorderSwitched:`调整顺序需手动排序,已切换`,modes:{default:`手动`,recent:`最新`,attention:`关注`,name:`名称`}},menu:{open:`打开`,collapseChildren:`折叠子任务`,expandChildren:`展开子任务`,newChat:`新建会话`,newShell:`新建终端`,continueEngine:`换个引擎继续…`,newScratchChat:`新建会话(无文件夹)`,newTask:`新建任务`,newTaskFromBranch:`基于此分支新建任务`,forgetProject:`移除项目`,fieldNotes:`现场笔记`,rename:`重命名`,pin:`置顶`,unpin:`取消置顶`,reorder:`重新排序`,moveToTop:`移到顶部`,reorderProject:`调整项目顺序`,runAgain:`重新运行`,setStatus:`设置状态`,moveToProject:`移到其他项目…`,copyId:`复制任务 ID`,copyBranch:`复制分支名`,copyPath:`复制路径`,openEditor:`在编辑器中打开`,renameBranch:`重命名分支`,changeEngine:`切换引擎`,fixChecks:`修复失败的检查`,rerunChecks:`重新运行失败的检查`,syncBase:`同步基础分支`,resolveConflicts:`让 agent 解决冲突`,land:`合入基础分支`,archive:`归档`,unarchive:`取消归档`,delete:`移除会话`},status:{backlog:`待办`,inProgress:`进行中`,inReview:`待评审`,done:`已完成`,canceled:`已取消`,error:`出错`},setStatus:{title:`设置状态`,current:`当前`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},moveToProject:{title:`移到其他项目`,empty:"还没有其他项目——先添加一个,或运行 `rove api update --project PATH`",footer:`↑↓ 选择 · enter 移动 · esc 取消`},sync:{done:`已把 {base} 合并进该工作树`,alreadyCurrent:`已经和 {base} 同步`,conflict:`合并冲突——解决后提交:{files}`,dirty:`请先提交工作树里的改动,再同步:{files}`,failed:`同步失败:{error}`},archive:{done:`已归档 {title}。工作树、分支和会话都保持原样`,restored:`已恢复 {title}`,busyTitle:`它还在工作,仍要归档?`,busyBody:`{title} 里有引擎仍在工作或在等你。归档只隐藏这一行,不会停止它。`,busyConfirm:`仍要归档`,failed:`归档失败:{error}`,restoreFailed:`恢复失败:{error}`},rerun:{started:`正在重新运行失败的检查`,none:`没有可重新运行的失败检查`,external:`这些检查不是在 GitHub Actions 上运行的,请到它们运行的地方重新运行`,refused:`无法重新运行:{detail}`},changeEngine:{title:`切换引擎`,current:`当前`,effortLabel:`推理强度`,noEffort:`引擎默认`,footer:{engine:`↑↓ 引擎`,effort:`←→ 强度`,model:`tab 模型`,set:`enter 设置`,cancel:`esc 取消`}},engineModel:{label:`模型`,placeholder:`引擎默认`,loading:`正在列出模型…`},tier:{swift:`轻快`,standard:`标准`,deep:`深入`,manual:`手动`},tierDesc:{swift:`小而明确的改动——最快、最省的一档`,standard:`日常的功能开发和修 bug`,deep:`难题:根因不明、大重构、设计决策`},runAgain:{title:`重新运行`,source:`来自任务「{title}」的指令`,hint:`在新任务里重新执行这段指令,新任务有自己的分支和工作树。`,confirm:`重新运行`,footer:`↑↓ 滚动 · ←→ 选择 · enter 运行 · esc 取消`},confirm:gi,renameBranch:{title:`重命名分支`,fieldLabel:`分支`},fieldNotes:{title:`现场笔记`,empty:"该仓库暂无现场笔记——agent 可用 `rove api note` 记录。",loading:`加载中…`,footer:`↑↓ 滚动 · esc 关闭`,footerDeletable:`↑↓ 选择 · d 删除 · esc 关闭`,confirmDelete:{title:`删除这条现场笔记?`,body:`「{text}」将不再注入该仓库的新会话。其他内容不受影响。`}},moveChip:` 移动`,recentJump:`最近:{title}`,archivedHit:`{title} · 已归档,回车恢复`,machine:{connecting:`连接中…`,offline:`离线`,unsupported:`不支持`,mismatch:`协议不兼容`,filesElsewhere:`在 {host} 上`,filesHint:`{host} 暂时连不上;重新连上后这里会再显示它的文件。`,terminalElsewhere:`这个任务跑在 {host} 上,暂时连不上。`,runsOn:`在 {host} 上`,noTabs:`{host} 上还没有 tab——按 prefix t 在那里新开一个。`},empty:{noMatchSearch:`无匹配任务——按 esc 清除。`,noActiveProject:`该项目暂无活跃任务。`,noActive:`暂无活跃任务——在上方新建。`},activity:{working:`运行中`,rateLimited:`请求受限`,permissionNeeded:`等待授权`,error:`错误`,dead:`引擎已退出`},group:{waitingOnYou:`等你处理`,landing:`可以合了`,readyForReview:`待你验收`,working:`运行中`},subtitle:{noTracking:`不跟踪活动`,materializing:`正在创建 worktree`,deleting:`正在删除`,deleteFailed:`删除失败`},reBranch:{title:`设置分支`,fieldLabel:`分支`,hintNoBranches:`(没有本地分支——输入新名称)`,hintNoMatch:`(无匹配——回车将分支重命名为此名)`,footer:`↑↓ 选择 · enter 设置 · esc 取消`},toast:vi},xi={noTask:`(no task — press n to create)`,exited:`process exited — F5 restarts it`,engineExit:{title:`Engine exited`,titleCode:`Engine exited (code {code})`,retry:`Retry`,settings:`Settings → Engines`,another:`Another engine`,continueIn:`Continue in another engine`},usageLimit:{title:`Usage limit reached`,dismiss:`Dismiss`},restoring:`restoring session…`,recovery:{live:`Live process reattached`,relaunched:`Command relaunched in a new process. Any restored output is historical; check the engine to resume or continue your conversation.`,restored:`Historical screen restored; previous process ended. Restart and check the engine before continuing.`},tab:{groupTitle:`group {n}`,renameTitle:`Rename tab`,renameField:`TAB TITLE`,renameSubmit:`rename`,chooseEngineHint:`←/→ or h/l choose, enter confirm, esc cancel`,newChat:{title:`New conversation`,engine:`ENGINE`,destLabel:`DESTINATION`,destTab:`child task, same directory`,destFork:`fork a child task (new worktree)`,destScratch:`new scratch task ($HOME)`,ctxLabel:`CONTEXT`,ctxFresh:`fresh conversation`,ctxContinue:`continue this conversation`},cannotCloseLast:`Cannot close the only tab`,tabGone:`That tab is no longer there`,closeOthersTitle:`Close the other tabs?`,closeOthersBody:`Closing {count} · their sessions end, this tab stays open.`,closeOthersConfirm:`close tabs`,closeOthersCancel:`cancel`,menu:{rename:`Rename tab`,copyAddress:`Copy tab address`,continueEngine:`Continue in another engine…`,closeOthers:`Close other tabs`,close:`Close tab`},nothingToFork:`No conversation in this tab to fork yet`,noTranscriptToHandOff:`{engine} keeps no readable transcript to hand over`},split:{renameTitle:`Rename split`,renameField:`SPLIT NAME`},scrolledBack:`↑ scrolled {lines}L`,scrollFirst:`[first]`,scrollLatest:`[latest]`,unavailable:{shellMissing:`terminal unavailable — the shell named by $SHELL isn't on this machine. Point $SHELL at one that exists, or unset it to fall back to the system default.`,spawnFailed:`terminal unavailable — the shell exited immediately. Its error is in ~/.rove/pty.log.`,retry:`F5 tries again`},reset:{title:`Reset terminal?`,body:`The running shell will be killed and a fresh one will spawn at the worktree. Any in-flight processes (vim, htop, paused jobs) end immediately.`}},Si={recovery:{live:`已重新连接仍在运行的进程`,relaunched:`命令已在新进程中重启。如有恢复的输出,它属于历史记录;请在引擎内确认会话恢复或继续操作。`,restored:`已恢复历史画面;原进程已结束。请重启并确认引擎状态后继续。`},noTask:`(无任务 —— 按 n 创建)`,exited:`进程已退出 —— 按 F5 重启`,engineExit:{title:`引擎已退出`,titleCode:`引擎已退出(退出码 {code})`,retry:`重试`,settings:`设置 → 引擎`,another:`换个引擎`,continueIn:`换个引擎继续`},usageLimit:{title:`已达到用量上限`,dismiss:`忽略`},restoring:`正在恢复会话…`,tab:{groupTitle:`group {n}`,renameTitle:`重命名标签页`,renameField:`标签页名称`,renameSubmit:`重命名`,chooseEngineHint:`←/→ 或 h/l 选择,enter 确认,esc 取消`,newChat:{title:`新建对话`,engine:`引擎`,destLabel:`落点`,destTab:`子任务,同一目录`,destFork:`fork 子任务(新 worktree)`,destScratch:`新临时任务($HOME)`,ctxLabel:`上下文`,ctxFresh:`全新对话`,ctxContinue:`接着当前对话`},cannotCloseLast:`无法关闭唯一的标签页`,tabGone:`这个标签页已经不在了`,closeOthersTitle:`关闭其他标签页?`,closeOthersBody:`将关闭 {count} 个,它们的会话会结束,只保留这个标签页。`,closeOthersConfirm:`关闭标签页`,closeOthersCancel:`取消`,menu:{rename:`重命名标签页`,copyAddress:`复制标签页地址`,continueEngine:`换个引擎继续…`,closeOthers:`关闭其他标签页`,close:`关闭标签页`},nothingToFork:`这个标签页还没有可派生的对话`,noTranscriptToHandOff:`{engine} 没有可读的对话记录,无法交接`},split:{renameTitle:`重命名分屏`,renameField:`分屏名称`},scrolledBack:`↑ 已回滚 {lines} 行`,scrollFirst:`[最早]`,scrollLatest:`[最新]`,unavailable:{shellMissing:`终端不可用 —— $SHELL 指向的 shell 在这台机器上不存在。请把 $SHELL 指向一个真实存在的 shell,或取消设置以回退到系统默认。`,spawnFailed:`终端不可用 —— shell 启动后立即退出。具体错误见 ~/.rove/pty.log。`,retry:`按 F5 重试`},reset:{title:`重置终端?`,body:`正在运行的 shell 会被杀掉并在 worktree 重新启动,进行中的进程(vim、htop、暂停的任务)会立即结束。`}},Ci={pageTitle:`ROVE UPDATE`,closeHint:`q / esc close`,chip:`↑ {version}`,current:`current`,available:`v{version} available`,latest:`latest`,latestUnknown:`unknown — could not reach the registry`,registryRetry:`Check your connection, then close and reopen Update to retry.`,upToDate:`No newer release — nothing to install.`,releaseUrlUnavailable:`release URL unavailable; visit github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`Opened release page in your browser.`,statusReleaseError:`Could not open release URL. Visit github.com/Sma1lboy/rove/releases in your browser.`,statusRunningUpdater:`Closing the TUI and running the updater in this terminal...`,loadingNotes:`Loading release notes...`,notesUnavailable:`Release notes are unavailable. Use Open release to view the GitHub release page.`,changesSectionHeader:`── changes from v{from} to v{to} ──`,updateComplete:`Rove update complete. Relaunch Rove to use the new version.`,updateFailed:"Rove update failed with exit code {code}. Check the output above, then run `rove update` to retry.",pressAnyKey:`Press any key to close this update window.`,webRunning:`Running {command} …`,webInstalled:"Installed. The daemon and this web bridge still run v{current}: run `rove daemon restart`, then restart `rove --web`. The page reloads itself once the bridge runs the new version.",webStartFailed:`Could not start the updater: {error}`,actions:{updateNow:`Update now`,openRelease:`Open release`,close:`Close`,closeDetail:`return to the workspace`},whatsNew:{title:`WHAT'S NEW`,closeHint:`q / esc continue`,upgraded:`You're now on Rove v{to}, up from v{from}. Here's what changed.`,notesUnavailable:`Could not load the release notes — check your connection, or read them on GitHub.`,sourceHint:`release notes: {url}`},skew:{title:`⚠ DAEMON OUT OF DATE`,olderBuild:`an older build`,hint:`daemon is {daemon} — you launched v{clientVersion}. Press {keys} to refresh Rove onto the installed build`,hintNoKey:"daemon is {daemon} — you launched v{clientVersion}. Run `rove daemon restart`, then relaunch Rove"},refresh:{confirmTitle:`Refresh Rove?`,confirmBody:`Rove restarts the daemon and relaunches itself on the installed build. Running engine sessions live in the PTY host and keep going; open tabs come back.`,confirmLabel:`Refresh`,relaunching:`rove: restarting on the installed build...`,alreadyCurrent:`Rove and the daemon already run the same build — nothing to refresh.`,installGone:"This Rove was installed from a directory that no longer exists, so it cannot relaunch itself. Reinstall with `npm install -g @sma1lboy/rove`."},staleInstall:{title:`✕ ROVE INSTALL IS GONE`,hint:"this Rove is running from an install that no longer exists on disk, so it cannot start a daemon. Reinstall (`npm install -g @sma1lboy/rove`) and relaunch Rove"},versions:{pageTitle:`ROVE VERSIONS`,loading:`Loading releases...`,unavailable:`Could not fetch releases. Check your connection or wait for the rate limit, then reopen this page.`,tagCurrent:`current`,tagLatest:`latest`,tagBreaking:`breaking`,breakingWarning:"⚠ installing this crosses breaking version(s) {versions}. Rove will refuse to start until you run `rove reset`, which stops the daemon, the PTY host, and every live session. Tasks and worktrees are kept.",footerHint:`j/k select · enter install · q close`,closeHint:`q / esc close`}},wi={pageTitle:`ROVE 更新`,closeHint:`q / esc 关闭`,chip:`↑ {version}`,current:`当前`,available:`有新版本 v{version}`,latest:`最新`,latestUnknown:`未知 —— 无法连接到 registry`,registryRetry:`请检查网络,然后关闭并重新打开更新页重试。`,upToDate:`没有更新的版本 —— 无需安装。`,releaseUrlUnavailable:`发布链接不可用;请访问 github.com/Sma1lboy/rove/releases`,statusReleaseOpened:`已在浏览器中打开发布说明页面。`,statusReleaseError:`无法打开发布链接。请在浏览器访问 github.com/Sma1lboy/rove/releases。`,statusRunningUpdater:`正在关闭 TUI,并在当前终端中运行更新程序……`,loadingNotes:`正在加载发布说明……`,notesUnavailable:`发布说明不可用。请使用「打开发布页」查看 GitHub 发布页面。`,changesSectionHeader:`── v{from} 至 v{to} 的变更 ──`,updateComplete:`Rove 更新完成。请重新启动 Rove 以使用新版本。`,updateFailed:"Rove 更新失败,退出码为 {code}。请检查上方输出,再运行 `rove update` 重试。",pressAnyKey:`按任意键关闭此更新窗口。`,webRunning:`正在运行 {command} …`,webInstalled:"已安装。daemon 和这个 web bridge 仍在跑 v{current}:先运行 `rove daemon restart`,再重启 `rove --web`。bridge 换到新版本后,页面会自动刷新。",webStartFailed:`无法启动更新程序:{error}`,actions:{updateNow:`立即更新`,openRelease:`打开发布页`,close:`关闭`,closeDetail:`返回工作区`},whatsNew:{title:`更新内容`,closeHint:`q / esc 继续`,upgraded:`Rove 已从 v{from} 更新到 v{to},本次变更如下。`,notesUnavailable:`无法加载发布说明 —— 请检查网络连接,或到 GitHub 上查看。`,sourceHint:`发布说明:{url}`},skew:{title:`⚠ DAEMON 版本不一致`,olderBuild:`旧版本构建`,hint:`daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。按 {keys} 可让 Rove 刷新到已安装的版本`,hintNoKey:"daemon 运行的是 {daemon},而你启动的是 v{clientVersion}。请运行 `rove daemon restart`,然后重新启动 Rove"},refresh:{confirmTitle:`刷新 Rove?`,confirmBody:`Rove 会重启 daemon,并以已安装的版本重新启动自身。正在运行的引擎会话由 PTY host 托管,不会中断;已打开的标签页会恢复。`,confirmLabel:`刷新`,relaunching:`rove:正在以已安装的版本重新启动……`,alreadyCurrent:`Rove 与 daemon 已经是同一个版本 —— 无需刷新。`,installGone:"当前 Rove 的安装目录已不存在,无法重新启动自身。请运行 `npm install -g @sma1lboy/rove` 重新安装。"},staleInstall:{title:`✕ ROVE 安装已不存在`,hint:"当前 Rove 运行自一份已从磁盘删除的安装,因此无法启动 daemon。请重新安装(`npm install -g @sma1lboy/rove`)并重新启动 Rove"},versions:{pageTitle:`ROVE 版本列表`,loading:`正在加载发布列表……`,unavailable:`无法获取发布列表。请检查网络或等待限流解除,然后重新打开本页。`,tagCurrent:`当前`,tagLatest:`最新`,tagBreaking:`breaking`,breakingWarning:"⚠ 安装该版本会跨过 breaking 版本 {versions}。更新后 Rove 会拒绝启动,直到你运行 `rove reset`——它会停掉 daemon、PTY host 和所有活动会话。任务和 worktree 会保留。",footerHint:`j/k 选择 · enter 安装 · q 关闭`,closeHint:`q / esc 关闭`}},Ti={quit:{confirmTitle:`Quit Rove?`,confirmBody:`The daemon and task sessions keep running. This closes only the native workspace.`,confirmLabel:`Quit`},narrowBack:`Tasks`,empty:{selectTask:`Select a task with a worktree`,noSessions:`No sessions here — press ⏎ to start {engine}, or ctrl+e to pick another`,noSessionsShell:`No sessions here — press ⏎ to start a shell, or ctrl+e to pick another`,remoteUnsupported:`Hosted engine launch over SSH is not implemented — this task's worktree is on {host}`},welcome:{title:`Welcome to Rove`,tagline:`All your coding agents in one place: when one runs out of quota, switch the task to another, and agents talk to each other directly.`,worktreeExplain:`Managed tasks create isolated worktrees and branches. Directory and project tasks reuse existing files; tabs within a task share its directory.`,stepNew:`creates your first task — pick a repo, a base branch, an engine`,stepHelp:`shows every shortcut reachable from the current focus`,stepPrefix:`opens the command menu`,enginesFound:`✓ engines: {list}`,enginesSignedOut:`✗ installed but not signed in: {list} — run one of them in a shell and log in`,enginesMissing:`✗ no engine CLI found — install claude, codex, copilot, or kimi, then restart Rove`,gitMissing:`✗ git not found on PATH — Rove needs git to create worktrees`,doctorHint:"run `rove doctor` in a shell for the full diagnosis",docsHint:`docs: https://docs.rove.run`},attention:{none:`No available Inbox items`},inbox:{title:`INBOX`,empty:`No pending attention`,openHint:`enter open`,clearHint:`d ack`,clearAllHint:`D ack all`,more:`+{count} more`,section:{attention:`ATTENTION`,recent:`RECENT`},state:{done:`done`,needsInput:`needs input`,error:`error`,rateLimited:`rate limited`,running:`running`,dead:`engine exited`,routineFailed:`routine needs you`,reportMissing:`report missing`,decisionNeeded:`decision needed`,gateAnswered:`answered · engine not running`},resumesAt:`resumes {time}`}},Ei={quit:{confirmTitle:`退出 Rove?`,confirmBody:`守护进程和任务会话会继续运行,这里只关闭原生工作区。`,confirmLabel:`退出`},narrowBack:`任务`,empty:{selectTask:`请选择一个带 worktree 的任务`,noSessions:`这里没有会话——按 ⏎ 启动 {engine},或按 ctrl+e 另选一个`,noSessionsShell:`这里没有会话——按 ⏎ 启动 shell,或按 ctrl+e 另选一个`,remoteUnsupported:`尚未实现通过 SSH 启动托管引擎——该任务的 worktree 在 {host} 上`},welcome:{title:`欢迎使用 Rove`,tagline:`所有编程 agent 都在一个地方:一个额度用完了,换另一个接着干;agent 之间直接对话,不用你传话。`,worktreeExplain:`托管任务创建独立的 worktree 和分支。目录与项目任务复用现有文件;同一任务内的标签页共享目录。`,stepNew:`创建你的第一个任务——选仓库、基础分支和引擎`,stepHelp:`查看当前焦点下的全部快捷键`,stepPrefix:`打开命令菜单`,enginesFound:`✓ 已检测到引擎:{list}`,enginesSignedOut:`✗ 已安装但未登录:{list}——请在 shell 里运行其中之一并完成登录`,enginesMissing:`✗ 未找到引擎 CLI——请安装 claude、codex、copilot 或 kimi 后重启 Rove`,gitMissing:`✗ PATH 上没有 git——Rove 需要 git 来创建 worktree`,doctorHint:"在 shell 里运行 `rove doctor` 查看完整诊断",docsHint:`文档:https://docs.rove.run`},attention:{none:`收件箱中没有可打开的项目`},inbox:{title:`收件箱`,empty:`暂无待处理`,openHint:`enter 打开`,clearHint:`d 已阅`,clearAllHint:`D 全部已阅`,more:`还有 {count} 条`,section:{attention:`待处理`,recent:`最近使用`},state:{done:`完成`,needsInput:`需要输入`,error:`出错`,rateLimited:`限流`,running:`进行中`,dead:`引擎已退出`,routineFailed:`例行任务需要处理`,reportMissing:`未回报`,decisionNeeded:`等你决定`,gateAnswered:`已回答 · 引擎未运行`},resumesAt:`{time} 恢复`}},Di={title:`Worktrees`,loading:`Loading worktrees…`,noProjects:`No local projects known to Rove yet.`,loadFailed:`Could not read the worktrees: {message}`,noWorktrees:`No worktrees.`,badge:{roveManaged:`rove`,dirty:`dirty`,dirtyUnknown:`dirty?`,remoteOn:`on remote`,remoteOff:`not pushed`,remoteUnknown:`remote unknown`},verdict:{prOpen:`PR open`,prMerged:`merged (PR)`,inMain:`in main`,prClosed:`PR closed`,idle:`stale`},row:{detached:`(detached)`,created:`created {age} ago`},delete:{button:`Delete`,confirmTitle:`Delete worktree?`,confirmBody:`Delete the worktree for "{branch}"? This removes the working directory; the branch itself is kept.`,forceTitle:`Force delete worktree?`,forceBody:'"{branch}" has uncommitted, untracked, or gitignored work. Force delete removes the worktree, but the work is snapshotted first to a salvage ref — list them with `git for-each-ref refs/rove/salvage`. Force delete anyway?',forceReason:`Refused because: {reason}`,failed:`Failed to delete worktree: {error}`,residue:`Git deregistered the worktree, but couldn't delete {path} ({reason}). Rove is done with it — retrying won't help; delete the directory by hand if you want the space.`},land:{button:`Land`,confirmTitle:`Land branch?`,confirmBody:`Merge "{branch}" into {landedOn} ({commits} commits), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,confirmBodyOne:`Merge "{branch}" into {landedOn} (1 commit), then remove this worktree? The branch is kept. Conflicts abort with a file list.`,noTask:`This worktree isn't tracked as a Rove task — nothing to land.`,conflict:`Land hit conflicts (merge aborted). Resolve by hand: {files}`,dirtyBase:"The base checkout has uncommitted changes — commit them, then land. Never `git stash` here: the stash stack lives in the repo's common dir and is shared by every linked worktree, so a stash can entangle other tasks' work.",failed:`Land failed: {error}`,done:`Landed "{branch}" onto {landedOn} ({commit}).`,worktreeKept:`Landed, but the worktree was kept: {reason}`,worktreePathStale:`Landed and removed the worktree, but the task still points at it: {reason}`,worktreeResidue:`Landed. Git deregistered the worktree, but couldn't delete {path} ({reason}) — delete the directory by hand if you want the space.`},hint:{}},Oi={title:`工作树`,loading:`正在加载 worktree…`,noProjects:`Rove 还没有已知的本地项目。`,loadFailed:`读不到 worktree 列表:{message}`,noWorktrees:`没有 worktree。`,badge:{roveManaged:`rove`,dirty:`有改动`,dirtyUnknown:`改动未知`,remoteOn:`已推送`,remoteOff:`未推送`,remoteUnknown:`远端未知`},verdict:{prOpen:`PR 评审中`,prMerged:`已合入 (PR)`,inMain:`已在主分支`,prClosed:`PR 已关闭`,idle:`陈旧`},row:{detached:`(游离状态)`,created:`{age}前创建`},delete:{button:`删除`,confirmTitle:`删除 worktree?`,confirmBody:`确定删除 "{branch}" 对应的 worktree?工作目录会被移除,分支本身会保留。`,forceTitle:`强制删除 worktree?`,forceBody:'"{branch}" 存在未提交、未跟踪或被 gitignore 的改动。强制删除会移除 worktree,但这些改动会先被快照到一个 salvage ref——用 `git for-each-ref refs/rove/salvage` 可以列出它们。仍要强制删除吗?',forceReason:`拒绝原因:{reason}`,failed:`删除 worktree 失败:{error}`,residue:`Git 已注销该 worktree,但没能删掉 {path}({reason})。Rove 这边已经处理完了——重试没有用;想要回磁盘空间请手动删除该目录。`},land:{button:`合入`,confirmTitle:`合入分支?`,confirmBody:`把 "{branch}" 合入 {landedOn}({commits} 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,confirmBodyOne:`把 "{branch}" 合入 {landedOn}(1 个提交),然后移除这个 worktree?分支会保留。冲突会中止并给出文件清单。`,noTask:`该 worktree 未作为 Rove 任务被跟踪——没有可合入的对象。`,conflict:`合入遇到冲突(已中止)。请手动解决:{files}`,dirtyBase:"基础检出有未提交改动——请先提交再合入。绝不要在这里 `git stash`:stash 栈存放在仓库的 common dir 中,该仓库所有 linked worktree 共享,一次 stash 可能纠缠其他任务的工作。",failed:`合入失败:{error}`,done:`已把 "{branch}" 合入 {landedOn}({commit})。`,worktreeKept:`已合入,但 worktree 保留了:{reason}`,worktreePathStale:`已合入并移除 worktree,但任务仍指向它:{reason}`,worktreeResidue:`已合入。Git 已注销该 worktree,但没能删掉 {path}({reason})——想要回磁盘空间请手动删除该目录。`},hint:{}},ki={common:{en:ri,zh:ii},doctor:{en:ai,zh:oi},files:{en:si,zh:ci},newTask:{en:li,zh:ui},onboarding:{en:di,zh:fi},quickTask:{en:pi,zh:mi},tasks:{en:yi,zh:bi},terminal:{en:xi,zh:Si},update:{en:Ci,zh:wi},workspace:{en:Ti,zh:Ei},worktrees:{en:Di,zh:Oi}};function W(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function G(e,t,n){let r=ki[e],i=W(r[At.get()],t)??W(r.en,t)??t;return n?i.replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??e)):i}var Ai=[{id:`chat.tab.new`,scope:`workspace`,keys:[`ctrl+t`],category:`Workspace`,description:`New chat tab`,hint:{keys:`ctrl+t`},presentation:`onePress`},{id:`chat.tab.chooseEngine`,scope:`workspace`,keys:[`ctrl+e`],category:`Workspace`,description:`New conversation — engine/shell picker with destination + context toggles`,hint:{keys:`ctrl+e`},presentation:`onePress`},{id:`chat.tab.fork`,scope:`workspace`,keys:[],prefixKeys:[`c`],category:`Workspace`,description:`Fork this chat into a new tab (same Task directory, keeps the conversation)`,hint:{keys:`ctrl+a c`}},{id:`chat.fork.new`,scope:`workspace`,keys:[],prefixKeys:[`f`],category:`Workspace`,description:`Quick-fork: create child task seeded with current repo/branch/model`,hint:{keys:`ctrl+a f`}},{id:`chat.tab.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close chat tab`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.reopenSession`,scope:`workspace`,keys:[`return`],category:`Workspace`,description:`Reopen a session in a task whose tabs are all closed`,hint:{keys:`enter`},presentation:`onePress`},{id:`chat.tab.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active chat tab`,hint:{keys:`f2`},presentation:`onePress`},{id:`chat.tab.cycle-next`,scope:`workspace`,keys:[`ctrl+]`],category:`Workspace`,description:`Next chat tab`,hint:{keys:`ctrl+]`},presentation:`onePress`},{id:`chat.tab.cycle-prev`,scope:`workspace`,keys:[`ctrl+[`],category:`Workspace`,description:`Previous chat tab`,hint:{keys:`ctrl+[`},presentation:`onePress`},{id:`chat.tab.goto`,scope:`workspace`,keys:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),category:`Workspace`,description:`Go to chat tab N`,hint:{keys:`ctrl+1-9`},presentation:`onePress`},{id:`workspace.split.right`,scope:`workspace`,keys:[`ctrl+\\`],category:`Workspace`,description:`Split right`,hint:{keys:`ctrl+\\`},presentation:`onePress`},{id:`workspace.split.down`,scope:`workspace`,keys:[`ctrl+=`],category:`Workspace`,description:`Split down`,hint:{keys:`ctrl+=`},presentation:`onePress`},{id:`workspace.split.focus-next`,scope:`workspace`,keys:[`f3`],category:`Workspace`,description:`Focus next split`,hint:{keys:`f3`},presentation:`onePress`},{id:`workspace.split.close`,scope:`workspace`,keys:[`ctrl+w`],prefixKeys:[`w`],category:`Workspace`,description:`Close active split (tab when unsplit)`,hint:{keys:`ctrl+w`},presentation:`onePress`},{id:`workspace.split.rename`,scope:`workspace`,keys:[`f2`],category:`Workspace`,description:`Rename active split (tab when unsplit)`,hint:{keys:`f2`},presentation:`onePress`}],ji=[{id:`files.nav`,scope:`files`,keys:[`j`,`k`,`down`,`up`],category:`Files`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`files.hierarchy`,scope:`files`,keys:[`h`,`l`,`left`,`right`],category:`Files`,description:`Collapse / expand tree level`,hint:{keys:`h/l`}},{id:`files.open`,scope:`files`,keys:[`return`],category:`Files`,description:`Open file in configured editor (diff when supported)`,hint:{keys:`enter`}},{id:`files.tab`,scope:`files`,keys:[`[`,`]`],category:`Files`,description:`Switch tab (cycle All / Changes)`,hint:{keys:`[/]`}},{id:`files.refresh`,scope:`files`,keys:[`r`],category:`Files`,description:`Refresh`,hint:{keys:`r`}},{id:`files.scope`,scope:`files`,keys:[`b`],category:`Files`,description:`Toggle Changes scope (working ↔ branch vs base)`,hint:{keys:`b`}},{id:`files.diff`,scope:`files`,keys:[`d`],category:`Files`,description:`Open read-only diff in a workspace tab`,hint:{keys:`d`}},{id:`files.diffAll`,scope:`files`,keys:[`shift+d`],category:`Files`,description:`Open the whole worktree's diff in one workspace tab`,hint:{keys:`D`}},{id:`files.openExternal`,scope:`files`,keys:[`o`],category:`Files`,description:`Open file in system default app (audio / video / pdf preview)`,hint:{keys:`o`}},{id:`files.mention`,scope:`files`,keys:[`a`],category:`Files`,description:`Inject @<path> mention into the engine pane`,hint:{keys:`a`}},{id:`files.createPR`,scope:`global`,keys:[],prefixKeys:[`p`,`shift+p`],category:`Files`,description:`Ask the agent to create a PR from the current task`},{id:`files.fixChecks`,scope:`global`,keys:[],prefixKeys:[`k`],category:`Files`,description:`Ask the agent to fix the failing PR checks`},{id:`files.syncBase`,scope:`global`,keys:[],prefixKeys:[`u`],category:`Files`,description:`Merge the base branch into this task's worktree`},{id:`diff.review.cursor`,scope:`workspace`,keys:[`j`,`k`,`down`,`up`],bareKeys:!0,category:`Diff review`,description:`Move the line cursor over the diff`,hint:{keys:`j/k`}},{id:`diff.review.range`,scope:`workspace`,keys:[`v`],bareKeys:!0,category:`Diff review`,description:`Toggle range anchor at the cursor`,hint:{keys:`v`}},{id:`diff.review.note`,scope:`workspace`,keys:[`c`],bareKeys:!0,category:`Diff review`,description:`Add a review note at the cursor`,hint:{keys:`c`}},{id:`diff.review.send`,scope:`workspace`,keys:[`s`],bareKeys:!0,category:`Diff review`,description:`Send all unsent review notes to the engine`,hint:{keys:`s`}},{id:`diff.review.drop`,scope:`workspace`,keys:[`x`],bareKeys:!0,category:`Diff review`,description:`Drop the review note the cursor sits inside`,hint:{keys:`x`}},{id:`diff.review.reload`,scope:`workspace`,keys:[`r`],bareKeys:!0,category:`Diff review`,description:`Reload the previewed file from disk`,hint:{keys:`r`}}],Mi=[{id:`inbox.show`,scope:`global`,keys:[],prefixKeys:[`i`],category:`Global`,description:`Open Inbox`},{id:`inbox.nav`,scope:`inbox`,keys:[`j`,`k`,`down`,`up`],category:`Inbox`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`inbox.open`,scope:`inbox`,keys:[`return`],category:`Inbox`,description:`Open the selected Task and Terminal Tab`,hint:{keys:`enter`}},{id:`inbox.delete`,scope:`inbox`,keys:[`d`],category:`Inbox`,description:`Ack the selected Inbox item`,hint:{keys:`d`}},{id:`inbox.deleteAll`,scope:`inbox`,keys:[`shift+d`],category:`Inbox`,description:`Ack every ATTENTION item`,hint:{keys:`D`}}],Ni=[{id:`palette.open`,scope:`global`,keys:[],prefixKeys:[`/`],category:`Global`,description:`Search commands`},{id:`help.open`,scope:`global`,keys:[`f1`],category:`Global`,description:`Show keybindings help`,hint:{keys:`F1`},presentation:`onePress`},{id:`task.new`,scope:`sidebar`,keys:[`n`],category:`Sidebar`,description:`New task`,hint:{keys:`n`}},{id:`task.new.global`,scope:`global`,keys:[],prefixKeys:[`n`],category:`Global`,description:`New task`},{id:`task.openEditor`,scope:`global`,keys:[],prefixKeys:[`o`],category:`Global`,description:`Open active Task directory in editor`},{id:`task.moveMode`,scope:`global`,keys:[],prefixKeys:[`m`],category:`Global`,description:`Reorder sidebar rows (then j/k)`},{id:`settings.open`,scope:`global`,keys:[],prefixKeys:[`,`],category:`Global`,description:`Open settings`},{id:`app.refresh`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Refresh Rove onto the installed build (after an update)`},{id:`settings.open.sidebar`,scope:`sidebar`,keys:[`s`],category:`Sidebar`,description:`Open settings`,hint:{keys:`s`}},{id:`worktrees.open.sidebar`,scope:`sidebar`,keys:[`x`],category:`Sidebar`,description:`Open worktrees`,hint:{keys:`x`}},{id:`kanban.open`,scope:`global`,keys:[],prefixKeys:[`1`],category:`Global`,description:`Open kanban (issues board)`},{id:`automations.open`,scope:`global`,keys:[],prefixKeys:[`2`],category:`Global`,description:`Open routines (scheduled tasks)`},{id:`workItems.open`,scope:`global`,keys:[],prefixKeys:[`3`],category:`Global`,description:`Open GitHub issues (external tracker)`},{id:`app.quit`,scope:`sidebar`,keys:[`q`,`ctrl+q`],category:`Sidebar`,description:`Quit (with confirm)`,hint:{keys:`q`}},{id:`focus.sidebar`,scope:`workspace`,keys:[`ctrl+q`],prefixKeys:[`q`],category:`Workspace`,description:`Back to sidebar (tasks)`,hint:{keys:`ctrl+q`},presentation:`onePress`},{id:`focus.previous`,scope:`global`,keys:[],prefixKeys:[`h`],category:`Navigation`,description:`Focus previous pane (files → workspace → sidebar)`},{id:`focus.next`,scope:`global`,keys:[`f4`],prefixKeys:[`l`],category:`Navigation`,description:`Focus next pane (sidebar → workspace → files)`,hint:{keys:`f4`},presentation:`onePress`},{id:`attention.next`,scope:`global`,keys:[`f7`],category:`Navigation`,description:`Jump to the next available Inbox item`,hint:{keys:`f7`},presentation:`onePress`},{id:`workspace.zenToggle`,scope:`global`,keys:[],prefixKeys:[`z`],category:`Navigation`,description:`Toggle zen mode (hide the files column)`},{id:`view.redraw`,scope:`global`,keys:[],prefixKeys:[`r`],category:`Global`,description:`Redraw the screen`},{id:`sidebar.nav`,scope:`sidebar`,keys:[`j`,`k`,`down`,`up`],category:`Sidebar`,description:`Move cursor up/down`,hint:{keys:`j/k`}},{id:`sidebar.select`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Open the selected task`,hint:{keys:`enter`}},{id:`sidebar.tree.open`,scope:`sidebar`,keys:[`l`,`space`],category:`Sidebar`,description:`Open the row under the cursor (a tab row enters its chat)`,hint:{keys:`l`}},{id:`sidebar.goto`,scope:`sidebar`,keys:[`g`,`shift+g`],category:`Sidebar`,description:`Top / bottom of list (gg or shift-G)`},{id:`sidebar.rename`,scope:`sidebar`,keys:[`r`],category:`Sidebar`,description:`Rename task`,hint:{keys:`r`}},{id:`sidebar.localMerge`,scope:`sidebar`,keys:[`shift+m`],category:`Sidebar`,description:`Reorder row (Shift+M, then j/k)`,hint:{keys:`M`}},{id:`sidebar.pin`,scope:`sidebar`,keys:[`shift+p`],category:`Sidebar`,description:`Pin / unpin task at top (Shift+P)`,hint:{keys:`P`}},{id:`sidebar.sort`,scope:`sidebar`,keys:[`t`],category:`Sidebar`,description:`Cycle task sort (default → recent → attention → name)`,hint:{keys:`t`}},{id:`sidebar.delete`,scope:`sidebar`,keys:[`d`],category:`Sidebar`,description:`Remove session (with confirm)`,hint:{keys:`d`}},{id:`sidebar.search.enter`,scope:`sidebar`,keys:[`/`],category:`Sidebar`,description:`Search tasks (fuzzy filter)`,hint:{keys:`/`}},{id:`sidebar.search.nav`,scope:`sidebar`,keys:[`down`,`up`],category:`Sidebar`,description:`Move highlight in search results`},{id:`sidebar.search.submit`,scope:`sidebar`,keys:[`return`],category:`Sidebar`,description:`Select search match and exit search`},{id:`sidebar.search.cancel`,scope:`sidebar`,keys:[`escape`],category:`Sidebar`,description:`Cancel search (restore prior selection)`},{id:`tasks.openWorktree`,scope:`sidebar`,keys:[`o`],category:`Tasks pane`,description:`Open selected Task directory in your editor`,hint:{keys:`o`}},{id:`tasks.renameBranch`,scope:`sidebar`,keys:[`b`],category:`Tasks pane`,description:`Rename the selected task's git branch`,hint:{keys:`b`}},{id:`tasks.cycleEngine`,scope:`sidebar`,keys:[`v`],category:`Tasks pane`,description:`Cycle engine vendor — applies on reopen`,hint:{keys:`v`}},{id:`tasks.update`,scope:`sidebar`,keys:[`u`],category:`Tasks pane`,description:`Open the update page — version check + release notes`,hint:{keys:`u`}},{id:`tasks.focusEngine`,scope:`sidebar`,keys:[`right`],category:`Tasks pane`,description:`Focus the engine pane of the current window`,hint:{keys:`→`}},...Ai,...ji,...Mi,{id:`terminal.scroll-up`,scope:`terminal`,keys:[`ctrl+pageup`],category:`Terminal`,description:`Scroll scrollback up`,hint:{keys:`ctrl+pgup`}},{id:`terminal.scroll-down`,scope:`terminal`,keys:[`ctrl+pagedown`],category:`Terminal`,description:`Scroll scrollback down`},{id:`terminal.reset`,scope:`terminal`,keys:[`f5`],category:`Terminal`,description:`Reset terminal — kill the current shell and respawn`,hint:{keys:`f5`},presentation:`onePress`}],Pi={ctrl:`⌃`,control:`⌃`,alt:`⌥`,opt:`⌥`,option:`⌥`,shift:`⇧`,cmd:`⌘`,command:`⌘`,meta:`⌘`,super:`⌘`},Fi={enter:`⏎`,return:`⏎`,esc:`⎋`,escape:`⎋`,space:`␣`,up:`↑`,down:`↓`,left:`←`,right:`→`,backspace:`⌫`,delete:`⌦`,del:`⌦`,pgup:`⇞`,pageup:`⇞`,pgdn:`⇟`,pagedown:`⇟`,home:`↖`,end:`↘`};function Ii(e,t){if(e.includes(`/`))return e.split(`/`).map(e=>Ii(e,t)).join(`/`);let n=e.toLowerCase();return n===`tab`?`tab`:Fi[n]||(/^f\d{1,2}$/.test(n)?n.toUpperCase():t?/^[a-z]$/.test(n)?e.toUpperCase():e.replace(/[a-z]+/gi,e=>e.toUpperCase()):e)}function Li(e,t=`⌃A`){let n=e.trim();if(!n)return n;let r=/^prefix\s+(.+)$/i.exec(n);if(r){let e=r[1]??``;return`${t} ${e.includes(`+`)?Li(e,t):Ii(e,!0)}`}let i=n.split(`+`);if(i.length===1)return Ii(i[0]??``,!1);let a=i[i.length-1]??``;return`${i.slice(0,-1).map(e=>Pi[e.toLowerCase().trim()]??e).join(``)} ${Ii(a,!0)}`}var Ri={path:``,exists:!1,rows:[],prefix:{key:`ctrl+a`,firstStrokes:[`ctrl+a`],timeoutMs:5e3},plugins:[],applied:[],warnings:[]},zi=v(Ri),Bi=new Map(Ni.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint&&{...e.hint}}]));function Vi(e){for(let e of Ni){let t=Bi.get(e.id);if(!t)continue;let n=e;n.keys=[...t.keys],n.prefixKeys=t.prefixKeys&&[...t.prefixKeys],n.hint=t.hint&&{...t.hint}}for(let t of e.rows){let e=Ni.find(e=>e.id===t.id);e&&(e.keys=[...t.keys],e.prefixKeys=t.prefixKeys&&[...t.prefixKeys],e.hint=t.hint&&{...t.hint})}zi.set(e)}async function Hi(e){try{Vi(await e.request(`keybindings.get`))}catch{}}function Ui(e){let t=y(e.conn).hello;(0,h.useEffect)(()=>{if(!t)return;let n=()=>void Hi(e);return n(),window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[t,e])}var Wi=()=>zi.get().prefix.key,Gi=()=>{let e=Wi();return e===null?``:Li(e)};function Ki(e,t=`direct`){let n=Ni.find(t=>t.id===e),r=t===`prefix`?n?.prefixKeys?.[0]:n?.keys[0];return r===void 0?void 0:Li(r)}var qi=e=>Ni.find(t=>t.id===e)?.keys??[];function Ji(e){let t=Gi(),n=Ki(e,`prefix`);return t&&n?`${t} ${n}`:``}var Yi=e=>Bi.get(e)?.prefixKeys??[];function Xi(e,t){let n=zi.get().rows.find(t=>t.id===e),r=Bi.get(e),i=t===`prefix`?n?.prefixKeys:n?.keys,a=t===`prefix`?r?.prefixKeys:r?.keys;return i&&JSON.stringify(i)!==JSON.stringify(a??[])?i:void 0}function Zi(e,t){for(let n of t){let t=e.find(e=>e.chord===n);if(t)return t}}function Qi(e){return!e.dialog&&e.page!==`worktrees`&&e.page!==`update`}var $i=v({stale:!1,daemonVersion:null,bridgeVersion:null}),ea=2e4;async function ta(e){try{let t=await e.request(`daemon.info`);return $i.set({stale:t.stale,daemonVersion:t.daemonVersion,bridgeVersion:t.bridgeVersion}),t.stale}catch{return $i.get().stale}}function na(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void ta(e)),n=ni(ea,()=>void ta(e));return()=>{t(),n()}},[e])}function ra(e){if(!$i.get().stale){F(G(`update`,`refresh.alreadyCurrent`),`error`);return}C.set((0,B.jsx)($r,{title:G(`update`,`refresh.confirmTitle`),body:G(`update`,`refresh.confirmBody`),confirmLabel:G(`update`,`refresh.confirmLabel`),onConfirm:async()=>{await e.request(`daemon.restart`),F(G(`update`,`refresh.relaunching`));for(let t=0;t<20;t++)if(await new Promise(e=>window.setTimeout(e,1e3)),!await ta(e))return;throw Error(R(`layout.refreshTimeout`))}}))}function ia({onRefresh:e}){z();let{stale:t,daemonVersion:n,bridgeVersion:r}=y($i);if(y(zi),!t)return null;let i=G(`update`,`skew.hint`,{daemon:n?`v${n}`:G(`update`,`skew.olderBuild`),clientVersion:r??``,keys:Ji(`app.refresh`)});return(0,B.jsxs)(`div`,{className:`mono ${En}`,role:`alert`,children:[(0,B.jsx)(`b`,{children:G(`update`,`skew.title`)}),(0,B.jsx)(`span`,{children:i}),(0,B.jsx)(`button`,{type:`button`,className:ar,onClick:e,children:G(`update`,`refresh.confirmLabel`)})]})}var aa=[`info`,`success`,`warning`,`error`,`muted`],oa=4e3,sa=4e3,ca=/^[A-Za-z0-9._:-]{1,64}$/,la={box:new Set([`type`,`direction`,`gap`,`padding`,`border`,`children`]),text:new Set([`type`,`text`,`tone`,`bold`]),button:new Set([`type`,`key`,`label`,`tone`]),input:new Set([`type`,`key`,`placeholder`,`value`])};function ua(e){return typeof e==`string`&&aa.includes(e)}function da(e){return e===0||e===1||e===2||e===3}var fa=class extends Error{};function pa(e){let t=0,n=new Set,r=(e,i,a)=>{if(a>12)throw new fa(`${i}: deeper than 12`);if(++t>400)throw new fa(`more than 400 elements`);if(!e||typeof e!=`object`||Array.isArray(e))throw new fa(`${i}: not an element`);let o=e,s=o.type;if(s!==`box`&&s!==`text`&&s!==`button`&&s!==`input`)throw new fa(`${i}: unknown element ${JSON.stringify(s)}`);for(let e of Object.keys(o))if(!la[s].has(e))throw new fa(`${i}: ${s} has no prop "${e}"`);if(o.tone!==void 0&&!ua(o.tone))throw new fa(`${i}: tone must be one of ${aa.join(`, `)}`);if(s===`text`){if(typeof o.text!=`string`||o.text.length>4e3)throw new fa(`${i}: text must be a string of at most ${oa} chars`);if(o.bold!==void 0&&typeof o.bold!=`boolean`)throw new fa(`${i}: bold must be boolean`);return{type:s,text:o.text,...o.tone===void 0?{}:{tone:o.tone},...o.bold?{bold:!0}:{}}}if(s===`button`||s===`input`){if(typeof o.key!=`string`||!ca.test(o.key))throw new fa(`${i}: bad ${s} key`);if(n.has(o.key))throw new fa(`${i}: duplicate key "${o.key}"`);n.add(o.key)}if(s===`input`){for(let e of[`placeholder`,`value`]){let t=o[e];if(t!==void 0&&(typeof t!=`string`||t.length>4e3))throw new fa(`${i}: ${e} must be a string of at most ${sa} chars`)}return{type:s,key:o.key,...o.placeholder===void 0?{}:{placeholder:o.placeholder},...o.value===void 0?{}:{value:o.value}}}if(s===`button`){if(typeof o.label!=`string`||o.label.length===0||o.label.length>40)throw new fa(`${i}: label must be 1-40 chars`);return{type:s,key:o.key,label:o.label,...o.tone===void 0?{}:{tone:o.tone}}}if(o.direction!==void 0&&o.direction!==`row`&&o.direction!==`column`)throw new fa(`${i}: direction must be "row" or "column"`);for(let e of[`gap`,`padding`])if(o[e]!==void 0&&!da(o[e]))throw new fa(`${i}: ${e} must be 0-3`);if(o.border!==void 0&&typeof o.border!=`boolean`)throw new fa(`${i}: border must be boolean`);if(!Array.isArray(o.children))throw new fa(`${i}: box needs children`);return{type:s,...o.direction===void 0?{}:{direction:o.direction},...o.gap===void 0?{}:{gap:o.gap},...o.padding===void 0?{}:{padding:o.padding},...o.border?{border:!0}:{},children:o.children.map((e,t)=>r(e,`${i}.children[${t}]`,a+1))}};try{return{ok:!0,tree:r(e,`tree`,1)}}catch(e){if(e instanceof fa)return{ok:!1,error:e.message};throw e}}function ma(e){let t=e?.panes;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.plugin!=`string`||typeof t.id!=`string`||typeof t.title!=`string`)continue;let r=pa(t.tree);r.ok&&n.push({plugin:t.plugin,id:t.id,title:t.title,tree:r.tree})}return n}function ha(e){let t=[],n=(e,r,i)=>{if(e.type===`button`||e.type===`input`)t.push({kind:e.type,plugin:r,pane:i,key:e.key});else if(e.type===`box`)for(let t of e.children)n(t,r,i)};for(let t of e)n(t.tree,t.plugin,t.id);return t}function ga(e,t){return e!==null&&t!==null&&e.plugin===t.plugin&&e.pane===t.pane&&e.key===t.key}function _a(e,t){return e.find(e=>ga(e,t))??e[0]??null}function va(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>ga(e,t));return r<0?e[0]??null:e[(r+n+e.length)%e.length]??null}function ya(e,t){if(!t)return e;let n=new Map(e.map(e=>[e.id,e]));for(let e of t.remove)n.delete(e);for(let e of t.upsert)n.set(e.id,e);return t.order?t.order.flatMap(e=>n.get(e)??[]):e.map(e=>n.get(e.id)??e)}function ba(e,t){return{...e,rev:t.rev,tasks:ya(e.tasks,t.tasks),...t.archived?{archived:ya(e.archived??[],t.archived)}:{},...t.attention?{attention:t.attention}:{},...t.gates?{gates:t.gates}:{}}}function xa(e){return!!e&&typeof e==`object`&&typeof e.from==`number`}var Sa=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,...t}:n)}),Ca=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,title:t,label:n.label===n.title?t:n.label}:n)});function wa(e,t){let n=new Set([t]);for(let t=!0;t;){t=!1;for(let r of e)r.parentTaskId&&n.has(r.parentTaskId)&&!n.has(r.id)&&(n.add(r.id),t=!0)}return n}var Ta=(e,t)=>n=>{let r=t?n.tasks:n.archived??[],i=wa(r,e),a=r.filter(e=>i.has(e.id)).map(e=>({...e,archived:t})),o=r.filter(e=>!i.has(e.id));return t?{...n,tasks:o,archived:[...n.archived??[],...a]}:{...n,tasks:[...n.tasks,...a],archived:o}},Ea=(e,t)=>n=>{let r=[...n.tasks,...n.archived??[]],i=t?wa(r,e):new Set([e]),a=r.find(t=>t.id===e)?.parentTaskId,o=t=>t.filter(e=>!i.has(e.id)).map(t=>t.parentTaskId===e?{...t,parentTaskId:a}:t);return{...n,tasks:o(n.tasks),...n.archived?{archived:o(n.archived)}:{}}},Da={"task.pin":(e,t)=>Sa(e,{pinned:t.pinned===!0}),"task.keep":(e,t)=>Sa(e,{kept:t.kept===!0}),"task.setStatus":(e,t)=>Sa(e,{status:t.status}),"task.rename":(e,t)=>Ca(e,String(t.title)),"task.archive":(e,t)=>Ta(e,t.archived===!0),"task.delete":(e,t)=>Ea(e,t.cascade===!0)};Object.keys(Da);function Oa(e,t){return Da[e]?.(String(t.taskId),t)??null}var ka=`rove.web.selection`,Aa=`null`,ja=300;function Ma(){try{let e=JSON.parse(localStorage.getItem(ka)??`null`);if(e&&typeof e==`object`&&`taskId`in e&&typeof e.taskId==`string`)return{taskId:e.taskId,tabId:`tabId`in e&&typeof e.tabId==`string`?e.tabId:null}}catch{}return{taskId:null,tabId:null}}function Na(e){if(!e||typeof e!=`object`||!(`taskIds`in e))return;let t=e.taskIds;return Array.isArray(t)?t.filter(e=>typeof e==`string`):void 0}function Pa(e){return!!e&&typeof e==`object`&&`tasks`in e&&Array.isArray(e.tasks)}var Fa=`rove.web.visits`,Ia=20;function La(){try{let e=JSON.parse(localStorage.getItem(Fa)??`[]`);return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.taskId==`string`):[]}catch{return[]}}function Ra(e,t){if(t)return e?.tasks.find(e=>e.id===t)??e?.archived?.find(e=>e.id===t)}function za(e,t,n,r){let i=(e,t)=>e.some(e=>e.id===t&&!e.deleting),a=n.taskId;if(a===null||!i(e,a)||i(t,a))return null;let o=r.find(e=>e.taskId!==a&&i(t,e.taskId));return o?{taskId:o.taskId,tabId:o.tabId}:{taskId:null,tabId:null}}var Ba=class{client;tasks=v(null);remote=v([]);tabs=v({});tabsSettled=v(!1);mods=v([]);installedMods=v(new Set);selection=v(Ma());visits=v(La());tabTimer=null;tabsReadAt=-1/0;tabScope=new Set;tabSets=new Map;tabReads=new Map;syncing=null;served=null;edits=new Map;pendingSelect=null;selectIntent=0;provisioning=new Map;viewingSent=Aa;taskShown=!0;viewingExtras=()=>({});constructor(e){this.client=e,e.onOpen(()=>{this.resync(),this.viewingSent=Aa,this.reportViewing(),this.refreshMods()}),typeof document<`u`&&typeof document.addEventListener==`function`&&document.addEventListener(`visibilitychange`,()=>{this.reportViewing(),document.visibilityState===`visible`&&this.refreshMods()}),typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`pagehide`,()=>this.reportViewing(!0)),e.on(`tasks`,e=>{Pa(e)&&this.acceptTasks(e)}),e.on(`tasks.patch`,e=>{let t=this.served;t&&xa(e)&&e.from===t.rev?this.acceptTasks(ba(t,e)):this.resync()}),e.on(`tabs`,e=>this.scheduleTabRefresh(Na(e))),e.on(`mods`,e=>this.mods.set(ma(e)??[]))}resync(){return this.syncing??=this.client.request(`tasks.subscribe`,{patches:!0}).then(e=>this.acceptTasks(e)).catch(()=>{}).finally(()=>{this.syncing=null}),this.syncing}async refreshMods(){try{let{mods:e}=await this.client.request(`builtinMods.list`);this.installedMods.set(new Set(e.filter(e=>e.installed).map(e=>e.id)))}catch{}}onSelect=()=>{};setTaskShown(e){this.taskShown!==e&&(this.taskShown=e,this.reportViewing())}select(e,t=null){this.onSelect();let n=++this.selectIntent;if(this.tasks.get()?.tasks.find(t=>t.id===e)?.noWorktree){this.provisioning.has(e)?this.provisioning.set(e,{intent:n,tabId:t}):this.provisionThenSelect(e,{intent:n,tabId:t});return}this.commitSelection(e,t)}commitSelection(e,t){let n=this.tabs.get()[e]??[],r={taskId:e,tabId:t??Va(n)?.id??null};this.selection.set(r),localStorage.setItem(ka,JSON.stringify(r));let i=[{...r,at:Date.now()},...this.visits.get().filter(e=>e.taskId!==r.taskId||e.tabId!==r.tabId)].slice(0,Ia);this.visits.set(i),localStorage.setItem(Fa,JSON.stringify(i)),this.reportViewing(),e in this.tabs.get()||this.scheduleTabRefresh([e])}reportViewing(e=!1){let{taskId:t,tabId:n}=this.selection.get(),r=e||typeof document<`u`&&document.visibilityState===`hidden`||!t||!this.taskShown?null:{taskId:t,...n?{tabId:n}:{},...this.viewingExtras()},i=JSON.stringify(r);i!==this.viewingSent&&(this.viewingSent=i,this.client.request(`ui.viewing`,r??{taskId:null}).catch(()=>{this.viewingSent===i&&(this.viewingSent=Aa)}))}async provisionThenSelect(e,t){this.provisioning.set(e,t);let n=!0;try{await this.client.request(`task.ensureWorktree`,{taskId:e})}catch(e){n=!1,F(e instanceof Error?e.message:String(e),`error`)}let r=this.provisioning.get(e)??t;this.provisioning.delete(e),n&&(this.markProvisioned(e),(this.tasks.get()?.tasks.some(t=>t.id===e)??!1)&&r.intent===this.selectIntent&&this.commitSelection(e,r.tabId))}markProvisioned(e){let t=this.tasks.get();if(!t)return;let n=t.tasks.map(t=>t.id===e?{...t,noWorktree:void 0}:t);this.tasks.set({...t,tasks:n})}selectWhenListed(e){this.tasks.get()?.tasks.some(t=>t.id===e)?this.select(e):this.pendingSelect=e}engineTarget(e){let{taskId:t,tabId:n}=this.selection.get(),r=t===e?this.tabs.get()[e]?.find(e=>e.id===n):void 0;return r?.kind===`engine`?{taskId:e,tabId:r.id}:{taskId:e}}async refreshTabsNow(e){await this.refreshTabs([e])}tabbedTasks(){let e=this.tasks.get(),t=e?.archived?.find(e=>e.id===this.selection.get().taskId);return[...e?.tasks??[],...t?[t]:[],...this.remote.get().filter(e=>!e.machine?.stale)]}act(e,t){let n=Oa(e,t),r=()=>this.client.request(e,t);return n?this.optimistic(n,r):r()}closeTab(e,t){return this.tabAct(e,`tab.close`,{taskId:e,tabId:t},e=>e.filter(e=>e.id!==t))}renameTab(e,t,n){return this.tabAct(e,`tab.rename`,{taskId:e,tabId:t,title:n},e=>e.map(e=>e.id===t?{...e,title:n}:e))}async tabAct(e,t,n,r){let i=this.tabs.get()[e];i&&(this.tabReads.set(e,(this.tabReads.get(e)??0)+1),this.tabs.set({...this.tabs.get(),[e]:r(i)}),this.reselectIfClosed(e));try{await this.client.request(t,n)}finally{await this.refreshTabs([e])}}async optimistic(e,t){this.edits.set(e,!1);let n=this.selection.get();this.served&&this.acceptTasks(this.served,!0);try{let n=await t();return this.edits.has(e)&&this.edits.set(e,!0),n}catch(t){throw this.edits.delete(e),this.served&&this.acceptTasks(this.served,!0),n.taskId!==null&&this.selection.get().taskId!==n.taskId&&Ra(this.tasks.get(),n.taskId)&&this.commitSelection(n.taskId,n.tabId),t}}acceptTasks(e,t=!1){this.served=e;let n=e;for(let[e,r]of this.edits)r&&!t?this.edits.delete(e):n=e(n);let r=[...this.tasks.get()?.tasks??[],...this.remote.get()];this.remote.set(n.tasks.filter(e=>e.machine)),this.tasks.set({...n,tasks:n.tasks.filter(e=>!e.machine)});let i=za(r,n.tasks,this.selection.get(),this.visits.get());i?.taskId?this.commitSelection(i.taskId,i.tabId):i&&(this.selection.set(i),localStorage.setItem(ka,JSON.stringify(i)),this.reportViewing()),this.pendingSelect&&n.tasks.some(e=>e.id===this.pendingSelect)&&(this.select(this.pendingSelect),this.pendingSelect=null);let a=this.tabbedTasks(),o=new Set(a.map(e=>e.id)),s=this.tabs.get();Object.keys(s).some(e=>!o.has(e))&&this.tabs.set(Object.fromEntries(Object.entries(s).filter(([e])=>o.has(e))));for(let e of this.tabSets.keys())o.has(e)||this.tabSets.delete(e);let c=a.filter(e=>{let t=Object.keys(e.tabStatus??{}).sort().join(` `);return this.tabSets.get(e.id)!==t&&(this.tabSets.set(e.id,t),!0)});c.length>0&&this.scheduleTabRefresh(c.map(e=>e.id))}scheduleTabRefresh(e){if(!e)this.tabScope=null;else for(let t of e)this.tabScope?.add(t);if(this.tabTimer!==null)return;let t=Math.max(0,this.tabsReadAt+ja-Date.now());this.tabTimer=window.setTimeout(()=>{this.tabTimer=null,this.tabsReadAt=Date.now();let e=this.tabScope;this.tabScope=new Set,this.refreshTabs(e?[...e]:this.tabbedTasks().map(e=>e.id))},t)}async refreshTabs(e){await Promise.all(e.map(async e=>{let t=(this.tabReads.get(e)??0)+1;this.tabReads.set(e,t);let n;try{n=(await this.client.request(`task.tabs`,{taskId:e})).tabs}catch{return}this.tabReads.get(e)===t&&(this.tabs.set({...this.tabs.get(),[e]:n}),this.reselectIfClosed(e))})),this.tabsSettled.get()||this.tabsSettled.set(!0)}reselectIfClosed(e){let t=this.selection.get();t.taskId===e&&((this.tabs.get()[e]??[]).some(e=>e.id===t.tabId)||this.commitSelection(e,null))}};function Va(e){return e.find(e=>e.alive!==!1)??e[0]}function Ha({model:e}){let t=y(e.selection),n=y(e.tasks),r=y(e.remote),i=Ra(n,t.taskId)??r.find(e=>e.id===t.taskId),a=n?.attention.filter(e=>e.unread).length??0,o=`${a>0?`(${a}) `:``}${i?`${i.label} - `:``}rove`;return(0,h.useEffect)(()=>{document.title=o},[o]),null}var Ua=[`sidebar`,`workspace`,`files`];function Wa(e,t,n){let r=Ua.filter(e=>e!==`files`||n.filesVisible),i=r.indexOf(e);if(i<0)return(t>0?r[r.length-1]:r[0])??null;let a=Math.min(Math.max(i+t,0),r.length-1);return a===i?null:r[a]??null}var Ga=`.split-leaf.is-active textarea.xterm-helper-textarea`,Ka={sidebar:[`.rail`,`.rail`],workspace:[`.workspace`,Ga],files:[`.side-panel`,`.side-view:not([hidden]) :is([tabindex='0'], input)`]};function qa(){for(let e of document.querySelectorAll(Ga))if(e.closest(`[data-stream]`)?.getClientRects().length)return e;return null}function Ja(){let e=qa();return e?.focus(),e!==null}function Ya(e){let t=Wa(Object.keys(Ka).find(e=>document.activeElement?.closest(Ka[e][0]))??`sidebar`,e,{filesVisible:document.querySelector(Ka.files[0])!==null});t&&document.querySelector(Ka[t][1])?.focus()}var Xa=[];function Za(e){Xa.push(e)}var Qa={workspace:`workspace`,sidebar:`sidebar`,files:`files`,terminal:`terminal`};function $a(){let e=Xa.flatMap(e=>e()),t=new Set(e.filter(e=>!e.prefix).map(e=>e.id)),n=e.map(e=>{let t=Xi(e.id,e.prefix?`prefix`:`direct`);return t?{...e,chords:t}:e});for(let r of e){let e=r.prefix?Xi(r.id,`direct`):void 0;if(!e||e.length===0||t.has(r.id))continue;t.add(r.id);let i=Ni.find(e=>e.id===r.id)?.scope??`global`;n.push({...r,prefix:!1,chords:e,...Qa[i]?{surface:Qa[i]}:{}})}return n}function eo(e,t){return!e.surface||e.surface===t||t===`terminal`&&e.surface===`workspace`}function to(e,t){return e.surface===t?0:e.surface?1:2}function no(){let e=document.activeElement;return e instanceof Element?e.closest(`.xterm`)?`terminal`:e.closest(`.rail`)?`sidebar`:e.closest(`.files`)?`files`:e.closest(`.workspace, .side-panel`)?`workspace`:null:null}function ro(e,t){let n=new Set,r=new Set;for(let i of $a())!eo(i,t)||i.live?.(e)===!1||(i.prefix?r:n).add(i.id);return{direct:n,prefix:r,inputPassthrough:t===`terminal`}}function io(){let e=new Set($a().map(e=>e.id));return Ni.filter(t=>e.has(t.id))}var ao=new Map,oo=v(null);function K(e){return ao.set(e.stream,e),()=>{ao.get(e.stream)===e&&ao.delete(e.stream),oo.get()===e&&oo.set(null)}}function so(e){return ao.get(e)}Za(()=>[{id:`terminal.scroll-up`,chords:[`ctrl+pageup`],prefix:!1,surface:`terminal`,run:()=>oo.get()?.scrollPages(-1)},{id:`terminal.scroll-down`,chords:[`ctrl+pagedown`],prefix:!1,surface:`terminal`,run:()=>oo.get()?.scrollPages(1)},{id:`terminal.reset`,chords:[`f5`],prefix:!1,surface:`terminal`,run:()=>oo.get()?.reset()}]);var co={INPUT:!0,TEXTAREA:!0,SELECT:!0},lo=`.rail, .side-panel, dialog, [role=dialog], [role=menu], [role=listbox]`;function uo(e){return!e||e.tagName===`BODY`||e.tagName===`HTML`?`none`:e.closest(`.xterm`)?`terminal`:co[e.tagName]===!0||e.isContentEditable?`field`:e.closest(lo)?`pane`:`loose`}function fo(e,t,n){return e.key!==`Escape`||e.defaultPrevented||e.isComposing||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||n.overlay||!n.terminal?!1:t===`none`||t===`loose`}function po(){(0,h.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=qa(),n=document.activeElement;if(!fo(e,uo(n instanceof HTMLElement?n:null),{overlay:C.get()!==null||S.get()!==null||O.get()!==null||M.get()!==null,terminal:t!==null}))return;let r=t?.closest(`[data-stream]`)?.dataset.stream,i=r?so(r):void 0;!t||!i||(e.preventDefault(),t.focus(),i.input(`\x1B`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}var mo=Reflect.get(globalThis,`__roveRelay`);function ho(e,t){return mo?mo.fetch(e,t):fetch(e,t)}function go(e,t){return mo?new mo.WebSocket(e,t):new WebSocket(e,t)}function _o(e,t){let n=t&&typeof t==`object`?t:{};if(e===200&&typeof n.token==`string`&&/^[A-Za-z0-9_-]{43}$/.test(n.token))return{kind:`ok`,token:n.token};if(e===429){if(n.locked===`global`)return{kind:`lockedHost`};let e=typeof n.retryAfterSeconds==`number`?n.retryAfterSeconds:900;return{kind:`locked`,minutes:Math.max(1,Math.ceil(e/60))}}return e===401?{kind:`wrong`}:{kind:`unreachable`}}async function vo(e=ho){try{let t=await e(`/login`,{headers:{Accept:`application/json`},cache:`no-store`});return!t.ok||!(t.headers.get(`content-type`)??``).includes(`application/json`)?!1:(await t.json()).password===!0}catch{return!1}}async function yo(e=ho){try{let t=await e(`/auth`,{headers:{Accept:`application/json`},cache:`no-store`});return!t.ok||!(t.headers.get(`content-type`)??``).includes(`application/json`)?!1:(await t.json()).open===!0}catch{return!1}}async function bo(e,t=ho){try{let n=await t(`/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e}),credentials:`omit`}),r=_o(n.status,await n.json().catch(()=>null));return r.kind===`ok`&&a(r.token),r}catch{return{kind:`unreachable`}}}async function xo(e=ho){let t=i();o(),t&&await e(`/logout`,{method:`POST`,headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}function So(e){if(!e)return null;switch(e.kind){case`ok`:return null;case`wrong`:return R(`login.wrong`);case`locked`:return R(`login.locked`,{minutes:e.minutes});case`lockedHost`:return R(`login.lockedHost`);case`unreachable`:return R(`login.unreachable`)}}function Co(){z();let[e,t]=(0,h.useState)(``),[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(null),o=So(i);return(0,B.jsx)(`div`,{className:Xn,children:(0,B.jsxs)(`form`,{className:Zn,onSubmit:async i=>{if(i.preventDefault(),n||!e)return;r(!0);let o=await bo(e);if(o.kind===`ok`){window.location.reload();return}t(``),a(o),r(!1)},children:[(0,B.jsxs)(`span`,{className:Jn,children:[(0,B.jsx)(`span`,{className:Yn,children:`[`}),` rove `,(0,B.jsx)(`span`,{className:Yn,children:`]`})]}),(0,B.jsx)(`h1`,{className:`${H} text-muted`,children:R(`login.title`)}),(0,B.jsx)(`p`,{className:`text-muted`,children:R(`login.body`)}),(0,B.jsx)(`input`,{className:sr,type:`password`,autoComplete:`current-password`,"aria-label":R(`login.field`),placeholder:R(`login.field`),autoFocus:!0,value:e,disabled:n,onChange:e=>{t(e.target.value),a(null)}}),o&&(0,B.jsx)(`p`,{className:`text-error`,role:`alert`,children:o}),(0,B.jsx)(`div`,{className:cr,children:(0,B.jsx)(`button`,{type:`submit`,className:Rt(),disabled:n||!e,children:R(n?`login.checking`:`login.submit`)})})]})})}function wo(e){return(0,B.jsx)(`svg`,{className:`block size-2.5 flex-none transition-[rotate,opacity] duration-120 ease-[ease] motion-reduce:transition-none ${e.right?`-rotate-90 is-right`:``} ${e.className??``}`,viewBox:`0 0 10 10`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M2.5 3.75 5 6.25l2.5-2.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var To=120;function Eo(e,t,n,r=e-t){return e+t+8<=n?e:Math.max(8,Math.min(r,n-t-8))}function Do(e){let{item:t}=e;return(0,B.jsxs)(`button`,{ref:e.rowRef,type:`button`,role:t.checked===void 0?`menuitem`:`menuitemradio`,"aria-checked":t.checked,"aria-haspopup":t.children?`menu`:void 0,"aria-expanded":t.children?!!e.open:void 0,className:Sr({selected:e.selected,open:e.open,danger:t.danger}),onMouseEnter:e.onEnter,onMouseLeave:e.onLeave,onClick:e.onPick,children:[(0,B.jsx)(`span`,{children:t.label}),t.children?(0,B.jsx)(wo,{right:!0,className:Tr(!!(e.selected||e.open))}):t.checked?(0,B.jsx)(`span`,{className:Er,"aria-hidden":!0,children:`✓`}):t.key&&(0,B.jsx)(`span`,{className:wr({selected:e.selected,danger:t.danger}),children:t.key})]})}function Oo(){let e=y(S),[t,n]=(0,h.useState)(0),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(-1),[s,c]=(0,h.useState)(!1),l=(0,h.useRef)(null),u=(0,h.useRef)(null),d=(0,h.useRef)([]),f=(0,h.useRef)(void 0),[p,m]=(0,h.useState)({x:0,y:0}),[g,_]=(0,h.useState)({x:0,y:0});if((0,h.useLayoutEffect)(()=>{if(!e||!l.current)return;n(e.start??(e.fromKeyboard?0:-1)),i(null),c(!1);let{width:t,height:r}=l.current.getBoundingClientRect(),a=e.right===void 0?e.x:Math.max(e.right-l.current.offsetWidth,0);m({x:Eo(a,t,window.innerWidth),y:Eo(e.y,r,window.innerHeight)});let o=e.target;return o?.setAttribute(`data-menu-open`,``),()=>o?.removeAttribute(`data-menu-open`)},[e]),(0,h.useLayoutEffect)(()=>{let e=r===null?null:d.current[r];if(!e||!l.current||!u.current)return;let t=l.current.getBoundingClientRect(),n=e.getBoundingClientRect(),{width:i,height:a}=u.current.getBoundingClientRect();_({x:Eo(t.right+2,i,window.innerWidth,t.left-i-2),y:Eo(n.top-5,a,window.innerHeight,n.bottom+5-a)})},[r]),(0,h.useEffect)(()=>()=>window.clearTimeout(f.current),[]),(0,h.useEffect)(()=>{if(!e)return;let d=e.items,f=r===null?[]:d[r]?.children??[],p=()=>S.set(null),m=e=>{e?.run&&(p(),e.run())},h=(e,t,n)=>e(e=>n===1?e>=t?0:e+1:e<=0?t:e-1),g=e=>{let l=e.key;if(s&&r!==null){let t=f.length-1;if(l===`Escape`||l===`ArrowLeft`||l===`h`)i(null),c(!1);else if(l===`ArrowDown`||l===`j`)h(o,t,1);else if(l===`ArrowUp`||l===`k`)h(o,t,-1);else if(l===`Home`)o(0);else if(l===`End`)o(t);else if(l===`Enter`)m(f[a]);else return;e.preventDefault(),e.stopPropagation();return}let u=d.length-1,g=d[t],_=()=>{i(t),c(!0),o(0)};if(l===`Escape`)p();else if(l===`ArrowDown`||l===`j`)h(n,u,1);else if(l===`ArrowUp`||l===`k`)h(n,u,-1);else if(l===`Home`)n(0);else if(l===`End`)n(u);else if((l===`ArrowRight`||l===`l`)&&g?.children)_();else if(l===`Enter`)g?.children?_():m(g);else return;e.preventDefault(),e.stopPropagation()},_=e=>{e.target instanceof Node&&(l.current?.contains(e.target)||u.current?.contains(e.target))||p()};return window.addEventListener(`keydown`,g,!0),window.addEventListener(`mousedown`,_),()=>{window.removeEventListener(`keydown`,g,!0),window.removeEventListener(`mousedown`,_)}},[e,t,r,a,s]),!e)return null;let v=r===null?null:e.items[r]?.children,b=e=>{e.run&&(S.set(null),e.run())},x=e=>{window.clearTimeout(f.current),i(e),c(!1),o(-1)};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{ref:l,className:xr(),role:`menu`,style:{left:p.x,top:p.y,minWidth:e.minWidth},children:e.items.map((a,o)=>(0,B.jsxs)(h.Fragment,{children:[o>0&&a.section!==e.items[o-1]?.section&&(0,B.jsx)(`hr`,{className:`-mx-1 my-1 h-px flex-none border-none bg-line`}),(0,B.jsx)(Do,{item:a,rowRef:e=>{d.current[o]=e},selected:o===t,open:o===r,onEnter:()=>{n(o),window.clearTimeout(f.current),a.children?f.current=window.setTimeout(()=>x(o),To):i(null)},onLeave:()=>{window.clearTimeout(f.current),o!==r&&n(-1)},onPick:()=>a.children?x(o):b(a)})]},a.label))}),v&&(0,B.jsx)(`div`,{ref:u,className:xr(!0),role:`menu`,style:{left:g.x,top:g.y},children:v.map((e,t)=>(0,B.jsx)(Do,{item:e,selected:t===a,onEnter:()=>{o(t),c(!0)},onLeave:()=>o(-1),onPick:()=>b(e)},e.label))})]})}function ko(){let e=y(C),t=y(T);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Oo,{}),e,(0,B.jsx)(`div`,{className:Dr,"aria-live":`polite`,children:t.map(e=>{let t=`${kr(e.tone===`error`)} ${e.leaving?`is-leaving`:``}`,n=e.action;return n?(0,B.jsxs)(`div`,{className:`${t} ${Or}`,children:[(0,B.jsx)(`span`,{children:e.text}),(0,B.jsx)(V,{onClick:()=>{se(e.id),n.run()},children:`[ ${n.label} ]`})]},e.id):(0,B.jsx)(`button`,{type:`button`,className:t,onClick:()=>se(e.id),children:e.text},e.id)})})]})}function Ao(e){return e.urls[e.at]??``}function jo(e){try{return new URL(e).host.replace(/^www\./,``)}catch{return e}}function Mo(){return{kind:`browser`,tabs:[{id:`t1`,urls:[],at:-1}],active:`t1`,recent:[`t1`],next:2}}function No(e,t){return!e.tabs.some(e=>e.id===t)||e.active===t&&e.recent.at(-1)===t?e:{...e,active:t,recent:[...e.recent.filter(e=>e!==t),t]}}function Po(e){let t=e;for(;t.tabs.length>12;){let e=t.tabs.filter(e=>e.id!==t.active).sort((e,n)=>t.recent.indexOf(e.id)-t.recent.indexOf(n.id))[0];if(!e)break;t=Vo(t,e.id)??t}return t}function Fo(e,t){let n=`t${e.next}`,r={id:n,urls:t,at:t.length-1};return Po(No({...e,tabs:[...e.tabs,r],next:e.next+1},n))}function Io(e){return Fo(e,[])}function Lo(e,t){return{...e,tabs:e.tabs.map(e=>e.id===t.id?t:e)}}function Ro(e,t,n){let r=e.tabs.find(e=>e.id===t);if(!r||Ao(r)===n)return e;let i=[...r.urls.slice(0,r.at+1),n].slice(-30);return Lo(e,{...r,urls:i,at:i.length-1})}function zo(e,t,n){let r=e.tabs.find(e=>e.id===t);return!r||n===r.at||n<0||n>=r.urls.length?e:Lo(e,{...r,at:n})}function Bo(e,t){let n=e.tabs.find(e=>Ao(e)===t);if(n)return No(e,n.id);let r=e.tabs.find(e=>Ao(e)===``);return r?Ro(No(e,r.id),r.id,t):Fo(e,[t])}function Vo(e,t){let n=e.tabs.filter(e=>e.id!==t);if(n.length===0)return null;let r=e.recent.filter(e=>e!==t);if(e.active!==t)return{...e,tabs:n,recent:r};let i=[...r].reverse().find(e=>n.some(t=>t.id===e))??n[0].id;return{...e,tabs:n,active:i,recent:[...r.filter(e=>e!==i),i]}}function Ho(e,t){return e.tabs.some(e=>e.id===t)?Vo(e,t):e}function Uo(e,t){let n=e.tabs.find(e=>e.id===t);return n?{...e,tabs:[n],active:t,recent:[t]}:e}function Wo(e,t,n){let r=new Set(n.map(e=>e.id)),i=[...e.filter(e=>r.has(e)&&e!==t),...r.has(t)?[t]:[]];return i.slice(Math.max(0,i.length-3))}function Go(e,t,n,r){if(!Array.isArray(e))return null;let i=[];for(let t of e){if(!t||typeof t!=`object`)continue;let e=t;if(typeof e.id!=`string`||!/^t\d+$/.test(e.id)||i.some(t=>t.id===e.id))continue;let n=Array.isArray(e.urls)?e.urls.filter(e=>typeof e==`string`&&e!==``).slice(-30):[],r=typeof e.at==`number`&&Number.isInteger(e.at)?e.at:n.length-1;i.push({id:e.id,urls:n,at:n.length===0?-1:Math.min(n.length-1,Math.max(0,r))})}let a=i[0];if(!a)return null;let o=new Set(i.map(e=>e.id)),s=Array.isArray(n)?n.filter(e=>typeof e==`string`&&o.has(e)):[],c=typeof t==`string`&&o.has(t)?t:s.at(-1)??a.id,l=Math.max(...i.map(e=>Number(e.id.slice(1))));return{kind:`browser`,tabs:i,active:c,recent:[...s.filter(e=>e!==c),c],next:Math.max(l+1,typeof r==`number`&&Number.isInteger(r)?r:0)}}var Ko=[`quota`,`files`,`file`,`diff`,`chat`,`browser`],qo=1e3;function Jo(){return{columns:[{kind:`files`}],weights:{}}}function Yo(e,t){return e.columns.find(e=>e.kind===t)}function Xo(e){return e.slice(e.lastIndexOf(`/`)+1)}function Zo(e,t){return{...e,columns:e.columns.map(e=>e.kind===t.kind?t:e)}}function Qo(e){return[...e].sort((e,t)=>Ko.indexOf(e.kind)-Ko.indexOf(t.kind))}function $o(e,t){return{...e,columns:Qo([...e.columns,t])}}function es(e,t){return Yo(e,t)||t===`file`?e:$o(e,t===`diff`?{kind:t,path:`.`,scope:`working`}:t===`browser`?Mo():{kind:t})}function ts(e,t,n){let r=n===void 0?{kind:`file`,path:t}:{kind:`file`,path:t,at:n},i=Yo(e,`file`);return i?i.kind===`file`&&i.path===t&&(n===void 0||i.at===n)?e:Zo(e,r):$o(e,r)}function ns(e,t,n,r){let i=r===void 0?{kind:`diff`,path:t,scope:n}:{kind:`diff`,path:t,scope:n,at:r},a=Yo(e,`diff`);return a?a.kind===`diff`&&a.path===t&&a.scope===n&&(r===void 0||a.at===r)?e:Zo(e,i):$o(e,i)}function rs(e,t){let n=Yo(e,`browser`);return n?.kind===`browser`?Zo(e,Bo(n,t)):$o(e,Bo(Mo(),t))}function is(e,t){if(!Yo(e,t))return e;let{[t]:n,...r}=e.weights;return{columns:e.columns.filter(e=>e.kind!==t),weights:r}}function as(e,t){let n=Yo(e,`browser`);if(n?.kind!==`browser`)return e;let r=t(n);return r===n?e:r?Zo(e,r):is(e,`browser`)}function os(e,t,n,r=!1){if(t&&Yo(e,n)){let t=is(e,n);return{panel:t,open:t.columns.length>0}}if(r){let t=e.columns.filter(e=>e.kind===n);return{panel:es({...e,columns:t},n),open:!0}}return{panel:es(e,n),open:!0}}function ss(e){let t=e.columns.flatMap(t=>{let n=e.weights[t.kind];return n!==void 0&&n>0?[n]:[]}),n=t.length>0?t.reduce((e,t)=>e+t,0)/t.length:1,r=e.columns.map(t=>e.weights[t.kind]||n),i=r.reduce((e,t)=>e+t,0);return r.map(e=>e/i*qo)}function cs(e,t){let n=t.reduce((e,t)=>e+t,0);if(t.length!==e.columns.length||!(n>0))return e;let r=Object.fromEntries(e.columns.map((e,r)=>[e.kind,Math.round(t[r]/n*1e3)/1e3]));return e.columns.every(t=>Math.abs((e.weights[t.kind]??0)-(r[t.kind]??0))<.001)?e:{...e,weights:r}}function ls(e){return Object.keys(e.weights).length===0?e:{...e,weights:{}}}function us(e,t,n,r){let i=e[t],a=e[t+1];if(i===void 0||a===void 0)return[...e];let o=i+a,s=Math.min(r,o/2),c=Math.max(s,Math.min(o-s,i+n));return e.map((e,n)=>n===t?c:n===t+1?o-c:e)}var ds=Ko.filter(e=>e!==`chat`&&e!==`file`),fs=v(`terminal`),ps=`rove.web.panelWidth`,ms=`rove.web.panelOpen`,hs=v((()=>{let e=Number(localStorage.getItem(ps));return Number.isFinite(e)&&e>0?e:null})());hs.subscribe(()=>{let e=hs.get();e===null?localStorage.removeItem(ps):localStorage.setItem(ps,String(Math.round(e)))}),hs.subscribe(ue);var gs=v(localStorage.getItem(ms)===`1`);gs.subscribe(()=>localStorage.setItem(ms,gs.get()?`1`:`0`));var _s=v(!1);gs.subscribe(()=>{gs.get()||_s.set(!1)});function vs(e,t,n=window.innerWidth){let r=Math.max(280,n-t-320);return Math.max(280,Math.min(r,Math.round(e)))}function ys(e,t,n=window.innerWidth){return e<2?null:vs(Math.max(300,Math.min(440,n*.28))*e,t,n)}var bs=[`files`,`diff`,`browser`];function xs(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&t.taskId!==``&&bs.includes(t.view)&&typeof t.at==`number`&&(t.url===void 0||typeof t.url==`string`)&&(t.path===void 0||typeof t.path==`string`)}function Ss(e){return e.narrow?{panel:!1,panelOpen:!1,narrow:!0}:{panel:!0,panelOpen:e.panelOpen&&!e.zen,narrow:!1}}function Cs(e,t){return{tab:e.path?e.view===`files`?`file`:`diff`:e.view,...e.view===`browser`&&e.url?{url:e.url}:{},...e.view!==`browser`&&e.path?{path:e.path}:{},show:t.taskId===e.taskId&&!t.narrow}}function ws(e,t,n){return t.url?rs(e,t.url):t.path?t.tab===`file`?ts(e,t.path,n):ns(e,t.path,`working`,n):es(e,t.tab)}var Ts=[`files`,`chat`,`diff`,`browser`,`quota`],Es=e=>e===`branch`||e===`task`?e:`working`;function Ds(e){if(!e||typeof e!=`object`)return null;let t=e;return t.kind===`files`||t.kind===`chat`||t.kind===`quota`?{kind:t.kind}:t.kind===`file`&&typeof t.path==`string`&&t.path!==``&&t.path!==`.`?{kind:`file`,path:t.path}:t.kind===`diff`&&typeof t.path==`string`&&t.path!==``?{kind:`diff`,path:t.path,scope:Es(t.scope)}:t.kind===`browser`?Go(t.tabs,t.active,t.recent,t.next):null}function Os(e,t){if(!e||typeof e!=`object`)return{};let n=e,r=t.flatMap(({kind:e})=>{let t=n[e];return typeof t==`number`&&Number.isFinite(t)&&t>0?[[e,t]]:[]});return Object.fromEntries(r)}function ks(e){let t=[e.top,e.bottom].map(e=>e&&typeof e==`object`&&`tabs`in e&&Array.isArray(e.tabs)?e.tabs:null);return t[0]?{tabs:t.flatMap(e=>e??[]).filter(e=>!!e&&typeof e==`object`&&/^t\d+$/.test(String(e.id))),recent:Array.isArray(e.recent)?e.recent.filter(e=>typeof e==`string`):[]}:null}function As(e){let t=ks(e);if(!t)return null;let n=[...new Set(t.tabs.map(e=>e.kind))],r=[];for(let i of n){if((i===`files`||i===`chat`||i===`quota`)&&r.push({kind:i}),i===`diff`){let e=t.tabs.filter(e=>e.kind===`diff`&&typeof e.path==`string`&&e.path!==``),n=[...t.recent].reverse().map(t=>e.find(e=>e.id===t)).find(e=>e)??e[0];n&&r.push({kind:`diff`,path:n.path,scope:Es(n.scope)})}if(i===`browser`){let n=Go(t.tabs.filter(e=>e.kind===`browser`),void 0,t.recent,e.next);n&&r.push(n)}}return{columns:Qo(r),weights:{}}}function js(e){if(!e||typeof e!=`object`)return null;let t=e;if(!Array.isArray(t.columns))return As(t);let n=[];for(let e of t.columns){let t=Ds(e);t&&!n.some(e=>e.kind===t.kind)&&n.push(t)}return{columns:Qo(n),weights:Os(t.weights,n)}}function Ms(e,t){let n=Jo(),r=typeof t==`string`&&t!==``?t:``;return e!==`browser`&&!r?n:{...n,columns:[...n.columns,r?Bo(Mo(),r):Mo()]}}function Ns(e){try{let t=JSON.parse(e??`{}`);return t&&typeof t==`object`&&!Array.isArray(t)?Object.entries(t):[]}catch{return[]}}function Ps(e,t,n){let r=Object.fromEntries(Object.entries(e).filter(([e])=>e!==t));r[t]=n;for(let e of Object.keys(r).slice(0,-50))delete r[e];return r}function Fs(e,t){let n={};for(let[t,r]of Ns(e)){let e=js(r);e&&(n[t]=e)}let r=new Map(Ns(t.tab).filter(([,e])=>Ts.includes(e))),i=new Map(Ns(t.url)),a=[...new Set([...r.keys(),...i.keys()])].filter(e=>!(e in n));n={...Object.fromEntries(a.map(e=>[e,Ms(r.get(e),i.get(e))])),...n};for(let e of Object.keys(n).slice(0,-50))delete n[e];return n}var Is=`rove.web.panels`,Ls=`rove.web.panelTab`,Rs=`rove.web.panelUrl`;function zs(){let e={tab:localStorage.getItem(Ls),url:localStorage.getItem(Rs)},t=Fs(localStorage.getItem(Is),e);return(e.tab!==null||e.url!==null)&&(localStorage.setItem(Is,JSON.stringify(t)),localStorage.removeItem(Ls),localStorage.removeItem(Rs)),t}var Bs=v(zs()),Vs={columns:[],weights:{}};function Hs(e){return y(Bs)[e]??Vs}function Us(e){let t=Hs(e??``);return y(gs)&&(e===null||t.columns.length>0)}function Ws(e){return gs.get()&&(e===null||(Bs.get()[e]??Vs).columns.length>0)}var Gs=e=>Bs.subscribe(e);function Ks(e,t){let n=Bs.get()[e]??Vs,r=t(n);if(r===n)return;let i=Ps(Bs.get(),e,r);Bs.set(i),localStorage.setItem(Is,JSON.stringify(i))}function qs(e,t){Ks(e,e=>es(e,t)),gs.set(!0),be()&&fs.set(t)}function Js(e,t){let n=gs.get(),r=os(Bs.get()[e]??Vs,n&&!A.get(),t,!n);Ks(e,()=>r.panel),r.open?gs.set(!0):_s.set(!1),r.open&&A.get()&&A.set(!1)}function Ys(e){Ks(e.taskId,t=>ns(t,e.path,e.scope)),gs.set(!0),A.get()&&A.set(!1),be()&&fs.set(`diff`)}function Xs(e,t){Ks(e,e=>ts(e,t)),gs.set(!0),A.get()&&A.set(!1),be()&&fs.set(`file`)}function Zs(e,t){Ks(e,e=>rs(e,t)),gs.set(!0),A.get()&&A.set(!1),be()&&fs.set(`browser`)}function Qs(e,t){let n=Bs.get()[e]??Vs;!be()&&n.columns.length===0&&_s.set(!1),be()&&fs.get()===t&&!Yo(n,t)&&qs(e,`files`)}function $s(e,t){Ks(e,e=>is(e,t)),Qs(e,t)}function ec(e,t){Ks(e,e=>as(e,t)),Qs(e,`browser`)}function tc(e,t){ec(e,e=>Ho(e,t))}function nc(e,t){let n=Cs(e,{taskId:t,narrow:be()});Ks(e.taskId,t=>ws(t,n,e.at)),n.show&&(gs.set(!0),A.get()&&A.set(!1))}var rc={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function ic(e){if(e.altKey&&e.code){let t=/^Key([A-Z])$/.exec(e.code);if(t?.[1])return t[1].toLowerCase();let n=/^Digit(\d)$/.exec(e.code);if(n?.[1])return n[1]}return rc[e.key]??e.key.toLowerCase()}function ac(e){let t=ic(e),n=t===`return`?[`return`,`enter`]:[t],r=[];e.ctrlKey&&r.push(`ctrl`),e.metaKey&&r.push(`cmd`),e.altKey&&r.push(`alt`);let i=t.length===1;return e.shiftKey&&!i&&r.push(`shift`),r.length===0?e.shiftKey&&i?[...n.map(e=>`shift+${e}`),...n]:n:e.shiftKey&&i?[]:n.map(e=>`${r.join(`+`)}+${e}`)}function oc(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}var sc=new Map(Ni.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));function cc(){return Ni.map(e=>{let t=sc.get(e.id);return{id:e.id,scope:e.scope,category:e.category,...e.bareKeys?{bareKeys:!0}:{},keys:[...t?.keys??[]],...t?.prefixKeys?{prefixKeys:[...t.prefixKeys]}:{},...t?.hint?{hint:{...t.hint}}:{}}})}var lc=new Map(Ni.map(e=>[e.id,e]));function uc(e){return lc.get(e)}function dc(e,t){if(!e)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e=0;e<r.length&&i<n.length;e++)r.charCodeAt(e)===n.charCodeAt(i)&&i++;return i===n.length}function fc(e){let t=[],n=new Map;for(let r of e){let e=n.get(r.category);e||(e=[],n.set(r.category,e),t.push({category:r.category,rows:e})),e.push(r)}return t}function pc(e){return e.hint?.keys??e.keys[0]}function mc(e){let t=uc(e);if(!t)return null;let n=pc(t);return n&&n.length>0?n:null}function hc(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function gc(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function _c(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=hc(c),l=gc(c,t),u=r?r.direct.has(c.id):l,d=r?r.prefix.has(c.id):l;if(e){let t={binding:c,primary:e,aliases:c.keys.filter(t=>t!==e)};if(u&&(l||c.presentation===`onePress`))c.presentation===`onePress`?a.push(t):i.push(t);else if(!l&&c.scope!==`global`){let e=s.get(c.scope);e?e.push(t):s.set(c.scope,[t])}}n&&d&&c.prefixKeys?.length&&o.push({binding:c,primary:`${n} + ${c.prefixKeys[0]}`,aliases:c.prefixKeys.slice(1).map(e=>`${n} + ${e}`)})}let c=[];i.length&&c.push({kind:`here`,scope:t??void 0,rows:i}),a.length&&c.push({kind:`direct`,rows:a}),o.length&&c.push({kind:`prefix`,rows:o});for(let[e,t]of s)c.push({kind:`other`,scope:e,rows:t});return c}var vc={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function yc(e){return e?vc[e]:`Global`}function bc(e){return[`kanban.open`,`automations.open`,`workItems.open`].includes(e)?`Views`:e.startsWith(`focus.`)?`Navigation`:e.startsWith(`inbox.`)||e.startsWith(`attention.`)?`Attention`:e.startsWith(`chat.tab.`)||e.startsWith(`chat.session.`)?`Sessions`:e.startsWith(`chat.fork.`)||e.startsWith(`task.`)?`Tasks`:e.startsWith(`settings.`)||e===`workspace.zenToggle`?`Tools`:uc(e)?.category??`Global`}function xc(e,t,n){let r=e.trim();return dc(r,t)||dc(r,n)}var Sc={title:`Rove — keybindings`,palette:`Search commands`,search:`Type an action name or chord…`,filter:`/ filter actions`,noResults:`No matching actions. Try another name or clear the filter.`,run:`↑↓ select · enter run · esc cancel`,reportProblem:`Report a problem`,reportPrompt:"You are helping the user report a problem with Rove itself (not their own project) as a GitHub issue. First ask what they were doing and what felt wrong: one to three short questions, one at a time. Then collect context: run `rove --version` and `rove daemon status`, and read the last ~50 lines of {logPath} only if the problem could involve the daemon. Draft an issue title and body (what happened, what they expected, steps, relevant output) and show it to the user. Only after they say OK, file it with a heredoc: `rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'` followed by the body and `EOF`. Then share the issue URL. If it prints a prefilled link instead (gh missing or signed out), give the user that link and tell them to run `gh auth login`.",unavailable:`This action is no longer available. Close and reopen the palette.`,esc:`esc`,scrollKeys:`↑↓ ⇞⇟ scroll`,commandLayer:`{prefix} — more Rove commands`,escCancel:`esc cancel`,directLayer:`Hold ctrl — Rove shortcuts`,releaseCtrl:`release ctrl to close`,overflow:`… F1 for all shortcuts`,moreCommandsPrefix:`More commands (prefix)`,focused:`Focused: {surface}`,allBindings:`All keybinding contexts`,grammar:`Use keys here · one-press Rove shortcuts · {prefix} for more commands · right-click a row for its menu`,disabled:`prefix disabled`,here:`HERE — only in {surface}`,direct:`ONE PRESS — Rove shortcuts`,afterPrefix:`AFTER PREFIX — more Rove commands`,otherPane:`OTHER PANE — {surface}`,marks:{rows:`MARKS — task and tab rows`,inbox:`MARKS — tab strip and Inbox`,pr:`MARKS — pull request chip`},mark:{spinner:`working: an engine turn or a task job is running`,needsInput:`waiting on your answer: a permission prompt or a question`,attention:`needs you: an error, a rate limit, an exited engine or a failed deletion`,unseen:`a turn finished and you have not looked yet`,idle:`quiet`,subagent:`running subagents, in front of the branch`,remote:`the task lives on another machine`,done:`the turn finished`,rateLimited:`rate limited; it resumes on its own`,dead:`the engine process exited`,routineFailed:`a routine run failed`,conflict:`merge conflicts`,checksFailing:`checks failing`,checksPassing:`checks passing`}},Cc={title:`Rove — 快捷键`,palette:`搜索命令`,search:`输入操作名称或快捷键…`,filter:`/ 筛选操作`,noResults:`没有匹配的操作。请换个名称或清空筛选。`,run:`↑↓ 选择 · enter 执行 · esc 取消`,reportProblem:`报告问题`,reportPrompt:"你在帮用户把 Rove 本身的问题(不是他们自己项目的问题)提成一个 GitHub issue。先问清楚他们当时在做什么、哪里不对劲:一到三个简短的问题,一次问一个。然后收集上下文:运行 `rove --version` 和 `rove daemon status`,只有问题可能和 daemon 有关时才读 {logPath} 的最后约 50 行。起草 issue 的标题和正文(发生了什么、期望什么、复现步骤、相关输出)并展示给用户。用户确认之后才提交,用 heredoc:`rove feedback --kind bug|idea|question --title \"...\" --body-file - <<'EOF'`,接正文,最后一行 `EOF`。然后把 issue 链接发给用户。如果输出的是预填链接(没装 gh 或没登录),把链接给用户,并告诉他运行 `gh auth login`。",unavailable:`此操作已不可用。请关闭并重新打开命令面板。`,esc:`esc`,scrollKeys:`↑↓ ⇞⇟ 滚动`,commandLayer:`{prefix} — 更多 Rove 命令`,escCancel:`esc 取消`,directLayer:`按住 ctrl — Rove 快捷键`,releaseCtrl:`松开 ctrl 关闭`,overflow:`… 按 F1 查看全部快捷键`,moreCommandsPrefix:`更多命令(prefix)`,focused:`当前焦点:{surface}`,allBindings:`所有快捷键上下文`,grammar:`当前区域直接按 · Rove 单次快捷键 · {prefix} 打开更多命令 · 右键任务行打开菜单`,disabled:`Prefix 已禁用`,here:`当前区域 — 仅在{surface}`,direct:`一次按下 — Rove 快捷键`,afterPrefix:`按下 Prefix 后 — 更多 Rove 命令`,otherPane:`其他区域 — {surface}`,marks:{rows:`标记 — 任务行和标签行`,inbox:`标记 — 标签栏和收件箱`,pr:`标记 — PR 标记`},mark:{spinner:`运行中:引擎正在执行一轮,或任务作业正在运行`,needsInput:`等你回答:权限确认或提问`,attention:`需要你处理:出错、限流、引擎已退出或删除失败`,unseen:`一轮已结束,你还没看过`,idle:`空闲`,subagent:`正在运行的子代理,显示在分支名前`,remote:`任务在另一台机器上`,done:`这一轮已结束`,rateLimited:`被限流,会自动恢复`,dead:`引擎进程已退出`,routineFailed:`例行任务运行失败`,conflict:`存在合并冲突`,checksFailing:`检查未通过`,checksPassing:`检查已通过`}},wc={status:{commands:`{key} commands`,help:`{key} help`,sidebar:`{key} sidebar`,settings:`settings`},pane:{move:`move`,open:`open`,collapse:`collapse`,diff:`diff`}},Tc={status:{commands:`{key} 命令`,help:`{key} 帮助`,sidebar:`{key} 侧栏`,settings:`设置`},pane:{move:`移动`,open:`打开`,collapse:`折叠`,diff:`差异`}},Ec={category:{Global:`Global`,Sidebar:`Sidebar`,Workspace:`Workspace`,Navigation:`Navigation`,"Tasks pane":`Tasks pane`,Files:`Files`,Terminal:`Terminal`,Views:`Views`,Tasks:`Tasks`,Sessions:`Sessions`,Attention:`Attention`,Tools:`Tools`,"Diff review":`Diff review`,Inbox:`Inbox`},desc:{"palette.open":`Search commands`,"help.open":`Show keybindings help`,"task.new":`New task`,"task.new.global":`New task`,"task.openEditor":`Open active Task directory in editor`,"task.moveMode":`Reorder sidebar rows (then j/k — tab, task, or project)`,"settings.open":`Open settings`,"app.refresh":`Refresh Rove onto the installed build (after an update)`,"settings.open.sidebar":`Open settings`,"inbox.show":`Open Inbox`,"worktrees.open.sidebar":`Open worktrees`,"kanban.open":`Open kanban (issues board)`,"automations.open":`Open routines (scheduled tasks)`,"workItems.open":`Open GitHub issues (external tracker)`,"app.quit":`Quit (with confirm)`,"focus.sidebar":`Back to sidebar (tasks)`,"focus.previous":`Focus previous pane (files → workspace → sidebar)`,"focus.next":`Focus next pane (sidebar → workspace → files)`,"workspace.zenToggle":`Toggle zen mode`,"view.redraw":`Redraw the screen`,"attention.next":`Jump to the next Inbox item`,"sidebar.nav":`Move cursor up/down`,"sidebar.select":`Open the selected task`,"sidebar.tree.open":`Open the row under the cursor`,"sidebar.goto":`Top / bottom of list (gg or shift-G)`,"sidebar.rename":`Rename task`,"sidebar.localMerge":`Reorder row (Shift+M, then j/k — tab, task, or project)`,"sidebar.pin":`Pin / unpin task at top (Shift+P)`,"sidebar.sort":`Cycle task sort (default → recent → attention → name)`,"sidebar.delete":`Remove session (with confirm)`,"sidebar.search.enter":`Search tasks (fuzzy filter)`,"sidebar.search.nav":`Move highlight in search results`,"sidebar.search.submit":`Select search match and exit search`,"sidebar.search.cancel":`Cancel search (restore prior selection)`,"tasks.openWorktree":`Open selected Task directory in your editor`,"tasks.renameBranch":`Rename the selected task's git branch`,"tasks.cycleEngine":`Cycle engine vendor — applies on reopen`,"tasks.update":`Open the update page (when a new version is available)`,"tasks.focusEngine":`Focus the engine pane of the current window`,"chat.tab.new":`New conversation here (a child task sharing this directory)`,"chat.tab.chooseEngine":`New conversation — engine/shell picker with destination + context toggles`,"chat.tab.fork":`Continue this chat in a new child task (same directory, keeps the conversation)`,"chat.fork.new":`Quick-fork: create child task seeded with current repo/branch/model`,"chat.tab.close":`Close chat tab`,"chat.tab.rename":`Rename active chat tab`,"chat.tab.cycle-next":`Next chat tab`,"chat.tab.cycle-prev":`Previous chat tab`,"chat.tab.goto":`Go to chat tab N`,"workspace.split.right":`Split right`,"workspace.split.down":`Split down`,"workspace.split.focus-next":`Focus next split`,"workspace.split.close":`Close active split (tab when unsplit)`,"workspace.split.rename":`Rename active split (tab when unsplit)`,"workspace.reopenSession":`Reopen a session in a task whose tabs are all closed`,"files.nav":`Move cursor up/down`,"files.hierarchy":`Collapse / expand tree level`,"files.open":`Open file in configured editor (diff when supported)`,"files.tab":`Switch tab (cycle All / Changes)`,"files.refresh":`Refresh`,"files.scope":`Toggle Changes scope (working ↔ branch vs base)`,"files.diff":`Open a read-only diff in a workspace tab`,"files.diffAll":`Open the whole worktree's diff in one workspace tab`,"files.openExternal":`Open file in system default app (audio / video / pdf preview)`,"files.mention":`Inject @<path> mention into the engine pane`,"files.createPR":`Ask the agent to create a PR from the current task`,"files.fixChecks":`Ask the agent to fix the failing PR checks`,"files.syncBase":`Merge the base branch into this task's worktree`,"diff.review.cursor":`Move the line cursor over the diff`,"diff.review.range":`Toggle range anchor at the cursor`,"diff.review.note":`Add a review note at the cursor`,"diff.review.send":`Send all unsent review notes to the engine`,"diff.review.drop":`Drop the review note the cursor sits inside`,"diff.review.reload":`Reload the previewed file from disk`,"inbox.nav":`Move through Inbox items`,"inbox.open":`Open the selected Inbox item`,"inbox.delete":`Ack the selected Inbox item`,"inbox.deleteAll":`Ack every ATTENTION item`,"terminal.scroll-up":`Scroll scrollback up`,"terminal.scroll-down":`Scroll scrollback down`,"terminal.reset":`Reset terminal — kill the current shell and respawn`}},Dc={category:{Global:`全局`,Sidebar:`侧边栏`,Workspace:`工作区`,Navigation:`导航`,"Tasks pane":`任务面板`,Files:`文件`,Terminal:`终端`,Views:`视图`,Tasks:`任务`,Sessions:`会话`,Attention:`提醒`,Tools:`工具`,"Diff review":`差异审阅`,Inbox:`收件箱`},desc:{"palette.open":`搜索命令`,"help.open":`显示快捷键帮助`,"task.new":`新建任务`,"task.new.global":`新建任务`,"task.openEditor":`在编辑器中打开当前 Task 的目录`,"task.moveMode":`调整侧边栏行顺序(然后 j/k——tab / 任务 / 项目)`,"settings.open":`打开设置`,"app.refresh":`让 Rove 刷新到已安装的版本(更新之后)`,"settings.open.sidebar":`打开设置`,"inbox.show":`打开收件箱`,"worktrees.open.sidebar":`打开 worktrees`,"kanban.open":`打开看板(issues)`,"automations.open":`打开例行任务(定时任务)`,"workItems.open":`打开 GitHub issues(外部跟踪器)`,"app.quit":`退出(需确认)`,"focus.sidebar":`返回侧边栏(任务列表)`,"focus.previous":`聚焦上一个面板(文件 → 工作区 → 侧边栏)`,"focus.next":`聚焦下一个面板(侧边栏 → 工作区 → 文件)`,"workspace.zenToggle":`切换禅模式`,"view.redraw":`重绘屏幕`,"attention.next":`跳到下一个收件箱条目`,"sidebar.nav":`上下移动光标`,"sidebar.select":`打开选中的任务`,"sidebar.tree.open":`打开光标所在行`,"sidebar.goto":`跳到列表顶部 / 底部(gg 或 shift-G)`,"sidebar.rename":`重命名任务`,"sidebar.localMerge":`调整当前行顺序(Shift+M,然后 j/k——tab / 任务 / 项目)`,"sidebar.pin":`置顶 / 取消置顶任务(Shift+P)`,"sidebar.sort":`切换任务排序方式(默认 → 最近 → 关注 → 名称)`,"sidebar.delete":`移除会话(需确认)`,"sidebar.search.enter":`搜索任务(模糊过滤)`,"sidebar.search.nav":`在搜索结果中移动高亮`,"sidebar.search.submit":`选中搜索匹配项并退出搜索`,"sidebar.search.cancel":`取消搜索(恢复之前的选中项)`,"tasks.openWorktree":`在编辑器中打开选中 Task 的目录`,"tasks.renameBranch":`重命名选中任务的 git 分支`,"tasks.cycleEngine":`循环切换引擎厂商——重新打开后生效`,"tasks.update":`打开更新页面(有新版本时)`,"tasks.focusEngine":`聚焦当前窗口的引擎面板`,"chat.tab.new":`在此新建对话(共享当前目录的子任务)`,"chat.tab.chooseEngine":`新建对话 —— 选择引擎或 shell,可切换落点与上下文`,"chat.tab.fork":`把当前对话接到新子任务(同一目录,带上已有对话)`,"chat.fork.new":`快速派生:以当前仓库/分支/模型创建子任务`,"chat.tab.close":`关闭聊天标签页`,"chat.tab.rename":`重命名当前聊天标签页`,"chat.tab.cycle-next":`下一个聊天标签页`,"chat.tab.cycle-prev":`上一个聊天标签页`,"chat.tab.goto":`跳到第 N 个聊天标签页`,"workspace.split.right":`向右分屏`,"workspace.split.down":`向下分屏`,"workspace.split.focus-next":`聚焦下一个分屏`,"workspace.split.close":`关闭当前分屏(未分屏时关闭标签页)`,"workspace.split.rename":`重命名当前分屏(未分屏时重命名标签页)`,"workspace.reopenSession":`在标签页全部关闭的任务中重新打开会话`,"files.nav":`上下移动光标`,"files.hierarchy":`折叠 / 展开树层级`,"files.open":`在已配置的编辑器中打开文件(支持时显示 diff)`,"files.tab":`切换标签页(循环 全部 / 变更)`,"files.refresh":`刷新`,"files.scope":`切换变更范围(工作区 ↔ 分支对比 base)`,"files.diff":`在工作区标签页中打开只读 diff`,"files.diffAll":`把整个 worktree 的 diff 打开在一个工作区标签页里`,"files.openExternal":`在系统默认应用中打开文件(音频 / 视频 / pdf 预览)`,"files.mention":`将 @<path> 提及注入引擎面板`,"files.createPR":`让 agent 从当前任务创建 PR`,"files.fixChecks":`让 agent 修复失败的 PR 检查`,"files.syncBase":`把基础分支合并进该任务的工作树`,"diff.review.cursor":`在 diff 中移动行光标`,"diff.review.range":`在光标处切换范围锚点`,"diff.review.note":`在光标处添加审阅备注`,"diff.review.send":`将所有未发送的审阅备注发给引擎`,"diff.review.drop":`删除光标所在的评审备注`,"diff.review.reload":`从磁盘重新加载当前预览的文件`,"inbox.nav":`在收件箱条目之间移动`,"inbox.open":`打开选中的收件箱条目`,"inbox.delete":`将选中的收件箱条目标为已阅`,"inbox.deleteAll":`将所有待处理条目标为已阅`,"terminal.scroll-up":`向上滚动回滚`,"terminal.scroll-down":`向下滚动回滚`,"terminal.reset":`重置终端——关闭当前 shell 并重新启动`}};function Oc(e,t){let n=e;for(let e of t.split(`.`)){if(!n||typeof n!=`object`||!(e in n))return;n=Reflect.get(n,e)}return typeof n==`string`?n:void 0}function kc(e,t){return At.get()===`zh`?t:e}function Ac(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var jc=(e,t)=>Ac(Oc(kc(Sc,Cc),e)??Oc(Sc,e)??e,t),Mc=(e,t)=>Ac(Oc(kc(wc,Tc),e)??Oc(wc,e)??e,t),Nc=(e,t)=>Ac(Oc(kc(xi,Si),e)??Oc(xi,e)??e,t);function Pc(e){return kc(Ec,Dc).desc[e]??Ec.desc[e]??e}function Fc(e){let t=Pc(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function Ic(e){return kc(Ec,Dc).category[e]??e}var Lc=(e,t)=>Ac(Oc(kc(Ti,Ei),e)??Oc(Ti,e)??e,t),Rc=(e,t)=>Ac(Oc(kc(yi,bi),e)??Oc(yi,e)??e,t),zc=e=>e.split(` + `).map(e=>Li(e)).join(` + `);function Bc(e){let t=Ic(yc(e.scope));return e.kind===`here`?jc(`here`,{surface:t}):e.kind===`direct`?jc(`direct`):e.kind===`prefix`?jc(`afterPrefix`):jc(`otherPane`,{surface:t})}function Vc(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;C.set((0,B.jsx)(Hc,{model:e,surface:no(),origin:t}))}function Hc({model:e,surface:t,origin:n}){z();let r=y(zi),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),c=(0,h.useRef)(null),l=(0,h.useMemo)(()=>ro(e,t),[e,t]),u=(0,h.useMemo)(()=>_c(io(),t===`terminal`?`terminal`:t,Wi(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>xc(o,Pc(e.binding.id),e.primary))})).filter(e=>e.rows.length>0);return(0,h.useEffect)(()=>()=>n?.focus(),[n]),(0,h.useEffect)(()=>{let e=c.current,t=t=>{if(!e||t.ctrlKey||t.metaKey||t.altKey)return;let n=e.clientHeight;if(t.key===`ArrowUp`)e.scrollBy({top:-24});else if(t.key===`ArrowDown`)e.scrollBy({top:24});else if(t.key===`PageUp`)e.scrollBy({top:-n});else if(t.key===`PageDown`)e.scrollBy({top:n});else if(t.key===`Home`)e.scrollTo({top:0});else if(t.key===`End`)e.scrollTo({top:e.scrollHeight});else if(!i&&t.key===`?`)L();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,B.jsx)(Xr,{title:jc(`title`),wide:!0,children:(0,B.jsxs)(`div`,{className:`${br} help`,children:[(0,B.jsxs)(`div`,{className:yn,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-muted`,children:t?jc(`focused`,{surface:Ic(yc(t))}):jc(`allBindings`)}),(0,B.jsx)(`p`,{className:`text-muted`,children:jc(`grammar`,{prefix:Gi()})})]}),(0,B.jsxs)(`div`,{className:bn,children:[(0,B.jsx)(`span`,{className:`subtle`,children:jc(`scrollKeys`)}),(0,B.jsx)(`button`,{type:`button`,className:ar,onClick:L,children:jc(`esc`)})]})]}),i?(0,B.jsx)(`input`,{className:sr,autoFocus:!0,spellCheck:!1,value:o,placeholder:jc(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,B.jsx)(`p`,{className:`text-muted`,children:jc(`filter`)}),u.length===0&&(0,B.jsx)(`p`,{className:`text-muted`,children:jc(`noResults`)}),(0,B.jsx)(`div`,{className:xn,ref:c,children:u.map((e,t)=>(0,B.jsxs)(`section`,{className:Sn,children:[(0,B.jsx)(`h2`,{className:Cn,children:Bc(e)}),e.rows.map(t=>(0,B.jsxs)(`div`,{className:wn,children:[(0,B.jsx)(`span`,{className:`mono ${Tn}`,children:zc(t.primary)}),(0,B.jsx)(`span`,{className:`flex-1`,children:Pc(t.binding.id)}),t.aliases.length>0&&(0,B.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(zc).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}function Uc(e){switch(e){case`permission_needed`:return{glyph:`?`,tone:`warning`,stateKey:`inbox.state.needsInput`};case`turn_complete`:return{glyph:`✓`,tone:`success`,stateKey:`inbox.state.done`};case`rate_limited`:return{glyph:`◷`,tone:`warning`,stateKey:`inbox.state.rateLimited`};case`dead`:return{glyph:`†`,tone:`attention`,stateKey:`inbox.state.dead`};case`decision_needed`:return{glyph:`?`,tone:`warning`,stateKey:`inbox.state.decision`};case`routine_failed`:return{glyph:`↻`,tone:`attention`,stateKey:`inbox.state.routineFailed`};case`report_missing`:return{glyph:`!`,tone:`warning`,stateKey:`inbox.state.reportMissing`};default:return{glyph:`!`,tone:`attention`,stateKey:`inbox.state.error`}}}function Wc(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<48?`${r}h`:`${Math.round(r/24)}d`}var Gc=e=>e===`routine_failed`,Kc=e=>`${e.taskId??``}:${e.tabId??``}`;function qc(e,t){let n=new Map(t.map((e,t)=>[e,t])),r=e=>+(e.state===`turn_complete`),i=e=>n.get(e.taskId??``)??2**53-1;return[...e].sort((e,t)=>r(e)-r(t)||e.at-t.at||i(e)-i(t)||Kc(e).localeCompare(Kc(t)))}function Jc(e,t,n){let r=new Set(t),i=qc(e,t).filter(e=>e.taskId===null||r.has(e.taskId));if(i.length===0)return null;let a=n.taskId===null?-1:i.findIndex(e=>Kc(e)===Kc(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}function Yc(e){let t=(e.terminal?.tail??[]).map(e=>e.trimEnd()),n=t.length;for(;n>0&&t[n-1]===``;)n--;let r=0;for(;r<n&&t[r]===``;)r++;return t.slice(Math.max(r,n-12),n)}async function Xc(e,t,n=!1){let r=`attention.dismiss`,i;if(Gc(t.state)){if(!t.automationId)return;r=`attention.dismissRoutine`,i={automationId:t.automationId}}else{if(t.gateId||t.state===`decision_needed`||t.state===`report_missing`&&!n||t.taskId===null)return;i={taskId:t.taskId,...t.tabId?{tabId:t.tabId}:{},...t.deliveryId?{deliveryId:t.deliveryId}:{}}}await e.client.request(r,i).catch(e=>F(String(e),`error`))}function Zc(e,t){Xc(e,t),L(),k.set(t.automationId??null),O.set(`routines`)}var Qc=524288e3,$c=1048576;function el(e,t){return/\.pdf$/i.test(e)?`pdf[${t}]`:/\.(png|jpe?g|gif|webp)$/i.test(e)?`images[${t}]`:`files[${t}]`}function tl(e){let t=-1;for(let n of e.matchAll(/^(?:images|pdf|files)\[(\d+)\]:/gm)){let e=Number.parseInt(n[1],10);e>t&&(t=e)}return t+1}function nl(e,t){let n=e.replace(/\s+$/,``),r=tl(e);for(let e of t){let t=`${el(e,r)}: ${e}`;n=n.length>0?`${n}\n${t}`:t,r+=1}return n}function rl(e){let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}async function il(e,t){if(t.size>524288e3)throw Error(R(`pages.attachTooLarge`,{name:t.name}));let n={mime:t.type,name:t.name},r=async(e,n)=>rl(new Uint8Array(await t.slice(e,n).arrayBuffer()));if(t.size<=1048576)return e.request(`attachment.put`,{...n,data:await r(0,t.size)});let i;for(let a=0;;){let o=Math.min(a+$c,t.size),s=await e.request(`attachment.part`,{...n,...i?{upload:i}:{},offset:a,data:await r(a,o),done:o===t.size});if(s.path!==void 0)return{path:s.path,kind:s.kind??`file`};i=s.upload,a=o}}async function al(e,t){return(await il(e,t)).path}function ol(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=0;for(;n>=1023.5&&r<t.length-1;)n/=1024,r++;let i=n.toFixed(1);return`${Number(i)>=100?Math.round(n):i} ${t[r]}`}var sl=`size-14 rounded-sm border-hairline border-line object-cover`;function cl({name:e,thumb:t}){if(t)return(0,B.jsx)(`img`,{src:t,alt:``,draggable:!1,className:sl});let n=e.includes(`.`)?e.split(`.`).pop()??``:``;return(0,B.jsx)(`span`,{className:`${sl} flex items-center justify-center font-mono text-meta uppercase text-muted`,children:n.slice(0,4)||`file`})}function ll({item:e,onRemove:t}){let[n]=(0,h.useState)(e.pending);return(0,B.jsxs)(`li`,{className:`group relative size-14 shrink-0 ${n?`motion-safe:animate-rise-in`:``}`,title:`${e.name} · ${ol(e.size)}`,children:[(0,B.jsx)(`div`,{className:`transition-opacity duration-150 motion-reduce:transition-none ${e.pending?`opacity-50`:``}`,children:(0,B.jsx)(cl,{...e})}),(0,B.jsx)(`button`,{type:`button`,"aria-label":R(`newSession.removeAttachment`,{name:e.name}),className:`absolute top-0.5 right-0.5 flex size-5 cursor-pointer items-center justify-center rounded-full border-hairline border-line bg-paper p-0 text-meta leading-none text-ink opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 touch:size-7 touch:opacity-100 touch:after:absolute touch:after:-inset-2 touch:after:content-['']`,onClick:()=>t(e.id),children:`×`})]})}function ul({items:e,onRemove:t}){return e.length===0?null:(0,B.jsx)(`ul`,{className:`m-0 flex min-w-0 list-none flex-wrap gap-1.5 p-0`,"data-field":`attachments`,children:e.map(e=>(0,B.jsx)(ll,{item:e,onRemove:t},e.id))})}function dl(e){return{drop:{onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:t=>{t.dataTransfer.files.length!==0&&(t.preventDefault(),e(Array.from(t.dataTransfer.files)))}},onPaste:t=>{let n=Array.from(t.clipboardData.files);n.length!==0&&(t.preventDefault(),e(n))}}}function fl(e){return(0,B.jsxs)(`label`,{className:e.className,title:e.title,children:[e.children,(0,B.jsx)(`input`,{type:`file`,multiple:!0,className:`sr-only`,disabled:e.disabled,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length>0&&e.onFiles(n)}})]})}var pl={image:`images`,pdf:`pdf`};function ml(e,t){let n=t.filter(e=>e.path!==void 0);return n.length===0?e:`${e}\n\n${n.map((e,t)=>`${pl[e.kind??`image`]??`files`}[${t}]: ${e.path}`).join(`
17
17
  `)}`}var hl=112;async function gl(e){if(e.type.startsWith(`image/`))try{let t=await createImageBitmap(e),n=Math.min(1,hl/Math.min(t.width,t.height)),r=document.createElement(`canvas`);return r.width=Math.round(t.width*n),r.height=Math.round(t.height*n),r.getContext(`2d`)?.drawImage(t,0,0,r.width,r.height),t.close(),r.toDataURL(`image/webp`,.8)}catch{return}}function _l(e){if(!e)return[];try{let t=JSON.parse(sessionStorage.getItem(e)??`[]`);return Array.isArray(t)?t:[]}catch{return[]}}var vl=0;function yl(e,t,n){let[r,i]=(0,h.useState)(()=>_l(n)),a=(0,h.useRef)(r),o=(0,h.useRef)(new Set),s=e=>{if(a.current=e(a.current),i(a.current),n)try{sessionStorage.setItem(n,JSON.stringify(a.current.filter(e=>e.path!==void 0)))}catch{}},c=async n=>{let r=`${Date.now()}-${vl++}`,i=await gl(n);s(e=>[...e,{id:r,name:n.name,size:n.size,mime:n.type,...i?{thumb:i}:{}}]);try{let t=await il(e.client,n);s(e=>e.map(e=>e.id===r?{...e,path:t.path,kind:t.kind}:e))}catch(e){s(e=>e.filter(e=>e.id!==r)),t(e instanceof Error?e.message:String(e))}};return{attachments:r,attach:e=>{for(let t of e){let e=c(t);o.current.add(e),e.finally(()=>o.current.delete(e))}},remove:e=>s(t=>t.filter(t=>t.id!==e)),ready:async()=>(await Promise.all(o.current),a.current),clear:()=>s(()=>[])}}function bl(e){return(0,B.jsx)(ul,{items:e.attachments.map(e=>({...e,pending:e.path===void 0})),onRemove:e.onRemove})}function xl(e){let t=(0,h.useRef)(null),n=(0,h.useRef)(e.value);n.current=e.value;let r=(r,i)=>{r.preventDefault();let a=e.choices.findIndex(e=>e.id===n.current),o=e.choices[(a+i+e.choices.length)%e.choices.length];o&&(n.current=o.id,e.onChange(o.id),requestAnimationFrame(()=>t.current?.querySelector(`[aria-pressed=true]`)?.focus()))};return(0,B.jsx)(`div`,{ref:t,className:fr,"aria-label":e.label,"data-field":e.field,onKeyDown:t=>{t.ctrlKey||t.metaKey||t.altKey||e.choices.length===0||(t.key===`ArrowRight`||t.key===`l`?r(t,1):(t.key===`ArrowLeft`||t.key===`h`)&&r(t,-1))},children:e.choices.map(t=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t.id===e.value,tabIndex:t.id===e.value||!e.choices.some(t=>t.id===e.value)?0:-1,className:pr(t.id===e.value,t.dim),title:t.title,onClick:()=>e.onChange(t.id),children:t.label},t.id))})}function Sl(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: none) and (pointer: coarse)`).matches}var Cl=/^(?:enter|return|tab|esc|space|shift|ctrl\+\S+|cmd\+\S+|alt\+\S+|[↑↓←→]+(?:\/[↑↓←→]+)?|[b-hj-z](?:\/[b-hj-z])?)(?:\/\S+)?(?:\s|$)/i;function wl(e){return e.split(`·`).map(e=>e.trim()).filter(e=>e&&!Cl.test(e)).join(` · `)}function Tl(e){return Sl()?wl(e):e}function El(e){if(typeof e!=`string`)return``;let t=e.replace(/\s+/g,` `).trim();if(t.length===0)return``;let n=[...t];return n.length<=40?t:`${n.slice(0,40).join(``)}…`}function Dl(e){let t=e.lastIndexOf(`/`);return t<0||t===e.length-1?{base:e,dir:``}:{base:e.slice(t+1),dir:e.slice(0,t+1)}}function Ol(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.toLowerCase().includes(n)):e}function kl(e){return e.startsWith(`~`)||e.includes(`/`)}function Al(e,t){return t?e===`~`?t:e.startsWith(`~/`)?t+e.slice(1):e:e}function jl(e){return e.length>1?e.replace(/\/+$/,``):e}var Ml=/^(?:(?:https?|ssh|git):\/\/[A-Za-z0-9[]\S*|[A-Za-z0-9._-]+@[A-Za-z0-9][A-Za-z0-9.-]*:\S+)$/i,Nl=/^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/(?![.]+(?:git)?$)[A-Za-z0-9._-]{1,100}$/i;function Pl(e){let t=e.trim();return Ml.test(t)||Nl.test(t)?t:null}function Fl(e,t){return e.filter(e=>e.enabled!==!1||e.id===t)}function Il(e,t){return(e.find(e=>e.id===t)??e.find(e=>e.ready!==!1)??e[0])?.id??``}function Ll(e,t){return!e||e.acceptsModel===!1?[]:[{id:``,label:t},...(e.models??[]).map(e=>({id:e.id,label:e.label??e.id}))]}function Rl(e,t){let n=e?.effortLevels??[];return n.length===0?[]:[{id:``,label:t},...n.map(e=>({id:e,label:e}))]}function zl(e,t,n,r){let i=t?e.find(e=>e.id===t)?.label??t:r;return n?`${i} ${n}`:i}function q(e,t){return e.includes(t)?e.length>1?e.filter(e=>e!==t):e:[...e,t]}function J(e){let[t,n,...r]=e;return!t||!n?t??``:r.length>0?`${t} + ${n} +${r.length}`:`${t} + ${n}`}function Bl(e){if(!(e instanceof Error)||!(`code`in e)||e.code!==`PARTIAL_FANOUT`)return;let t=`detail`in e&&e.detail&&typeof e.detail==`object`?e.detail:void 0;return t&&`groupId`in t&&typeof t.groupId==`string`&&t.groupId?t.groupId:void 0}function Vl(e){let[t,...n]=e;if(!t)return``;let r=Dl(t).base;return n.length>0?`${r} +${n.length}`:r}function Hl(e,t){return e.includes(t)?e.filter(e=>e!==t):e.length>=8?e:[...e,t]}function Ul(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function Wl(e){let[t,...n]=e.repos;if(!t)throw Error(`no repo`);let r=e.at?El(e.prompt):``,i=(e.engines?.length??0)>1;return{repo:t.repo,...t.baseRef?{baseBranch:t.baseRef}:{},...n.length>0?{extraRepos:n.map(e=>({repo:e.repo,...e.baseRef?{baseRef:e.baseRef}:{}}))}:{},...!i&&n.length>0&&e.branch?{branch:e.branch}:{},...e.at?{scheduleAt:e.at.toISOString(),schedulePrompt:e.prompt}:e.prompt?{prompt:e.prompt}:{},...r?{title:r}:{},...i?{agents:(e.engines??[]).map(e=>`${e}:1`).join(`,`)}:{},...!i&&e.engine?{engine:e.engine}:{},...!i&&e.engine&&e.commandFrom?{commandFrom:e.commandFrom}:{},...!i&&e.model?{model:e.model}:{},...!i&&e.effort?{effort:e.effort}:{}}}async function Gl(e,t,n){let r=t?{engine:t}:{},{taskId:i}=await e(`task.openScratch`,r);return await e(`tab.new`,{taskId:i,kind:`engine`,...r,prompt:n.trim()}),i}async function Kl(e,t,n,r,i=r.trim(),a){let o=n?{engine:n}:{},s=r.trim()?El(r):``,{taskId:c}=await e(`task.openCheckout`,{repo:t,...o,...s?{title:s}:{},...a?{scheduleAt:a.toISOString(),schedulePrompt:i}:{}});if(!(a||!c))return await e(`tab.new`,{taskId:c,kind:`engine`,...o,prompt:i}),c}function ql(e,t){let n=e.querySelector(`[data-field="${t}"]`);(n?.matches(`input, textarea`)?n:n?.querySelector(`[tabindex='0']`))?.focus()}function Jl(e,t,n){let r=document.activeElement?.closest(`[data-field]`)?.getAttribute(`data-field`),i=t.findIndex(e=>e===r),a=t[i<0?0:(i+n+t.length)%t.length];a&&ql(e,a)}var Yl=new WeakMap,Xl=200,Zl=e=>`client`in e?e.client:e,Ql=(e,t)=>t?`${e} ${JSON.stringify(t)}`:e;function Y(e,t,n){return Yl.get(Zl(e))?.get(Ql(t,n))}function $l(e,t,n,r){let i=Zl(e),a=Yl.get(i)??new Map,o=Ql(t,n);a.delete(o),a.set(o,r),Yl.set(i,a);for(let e of a.keys()){if(a.size<=Xl)break;a.delete(e)}return r}function X(e,t,n){return Zl(e).request(t,n).then(r=>$l(e,t,n,r))}function eu(e,t,n){return n&&n!==`leaf-1`?`${e}::${t}::${n}`:`${e}::${t}`}function tu(e,t,n){let r=t?{repo:t}:{},[i]=(0,h.useState)(()=>{let t=Y(e,`engines.list`,r),i=t?Fl(t.engines):[];return{offered:i,engine:t?Il(i,n??t.preferred):``}}),[a,o]=(0,h.useState)(i.offered),[s,c]=(0,h.useState)(i.engine);return(0,h.useEffect)(()=>{X(e,`engines.list`,r).then(e=>{let t=Fl(e.engines);o(t),c(Il(t,n??e.preferred))}).catch(()=>o([]))},[e]),{engines:a,engine:s,setEngine:c}}var nu=`shell`,ru=`pane:`,iu=e=>e.startsWith(ru),au=e=>e.slice(5);function ou(e){let[t,n]=(0,h.useState)(()=>Y(e,`plugin.panes`)?.panes??[]);return(0,h.useEffect)(()=>{X(e,`plugin.panes`).then(e=>n(e.panes)).catch(()=>n([]))},[e]),t}function su(e){let t=[...e.engines,...e.withShell?[{id:nu,name:R(`tab.shell`)}]:[],...(e.panes??[]).map(e=>({id:ru+e.id,name:e.title}))];return(0,B.jsx)(xl,{label:R(`newTask.engine`),field:`engine`,value:e.value,onChange:e.onChange,choices:t.map(e=>({id:e.id,label:e.name,dim:`ready`in e&&e.ready===!1,title:`ready`in e&&e.ready===!1?R(`newTask.notReady`):void 0}))})}function cu(e,t){return lu(e,t,{kind:`engine`,latest:!0}).catch(e=>F(String(e),`error`))}async function lu(e,t,n){let{tabId:r,taskId:i}=await e.client.request(`tab.new`,{taskId:t,kind:n.kind,...n.engine?{engine:n.engine}:{},...n.prompt?{prompt:n.prompt}:{},...n.latest?{latest:!0}:{},...n.replaceTab?{replaceTab:n.replaceTab}:{}});if(i){e.selectWhenListed(i);return}await e.refreshTabsNow(t),n.replaceTab&&await so(eu(t,r))?.reattach(),e.select(t,r)}async function uu(e){await lu(e,(await e.client.request(`task.openScratch`,{})).taskId,{kind:`shell`})}var du=[`1`,`2`,`3`,`4`,`5`],fu=[`tab`,`fork`,`scratch`],pu=[`message`,`attempts`,`engine`,`fork-base`,`destination`];function mu(e){z();let{model:t,taskId:n}=e,r=t.tasks.get()?.tasks.find(e=>e.id===n),i=tu(t,r?.repo),[a,o]=(0,h.useState)(e.destination??`tab`),[s,c]=(0,h.useState)(e.context??`fresh`),[l,u]=(0,h.useState)(``),[d,f]=(0,h.useState)(`1`),[p,m]=(0,h.useState)(r?.branch??`main`),{busy:g,error:_,setError:v,submit:y}=Zr(),{attachments:b,attach:x,remove:S,ready:C}=yl(t,v),w=s===`fresh`&&a!==`fork`,T=a===`tab`&&s===`fresh`,E=ou(t),D=i.engine===`shell`&&!w||iu(i.engine)&&!T?``:i.engine,O=D===nu,k=iu(D),ee=a===`fork`,te=(e,t)=>{let n=e===`scratch`&&t===`continue`&&a===`scratch`?`tab`:e;o(n),c(n===`scratch`?`fresh`:t)},A=()=>{let r=t.selection.get();return e.sourceTabId??(r.taskId===n?r.tabId:null)??`tab-1`},ne=()=>t.tasks.get()?.tasks.find(e=>e.id===n)?.tabStatus?.[A()]?.reason===`dead`,j=async()=>{let e=await t.client.request(`tab.handoff`,{taskId:n,tabId:A()});if(e.kind===`handoff`&&e.prompt)return e.prompt;throw Error(e.kind===`no-transcript`?G(`terminal`,`tab.noTranscriptToHandOff`,{engine:e.engine??``}):G(`terminal`,`tab.nothingToFork`))},M=()=>y(async()=>{let e=s===`continue`&&a===`tab`&&!O&&!k&&ne(),i=[s===`continue`&&!e?await j():``,ml(l.trim(),await C())].filter(Boolean).join(`
18
18
 
19
- `);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,O?{}:{engine:D});O?await lu(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(ee){if(!r)throw Error(G(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(R(`taskops.forkNeedsMessage`));let e=p.trim()||r.branch,a;try{a=await t.client.request(`tab.forkTask`,{repo:r.repo,baseBranch:e,prompt:i,...D?{engine:D}:{},...Number(d)>1?{count:Number(d)}:{},...e===r.branch?{forkFrom:n}:{}})}catch(e){let t=Bl(e);if(!t)throw e;F(e instanceof Error?e.message:String(e),`error`),_e(t);return}a.forkRefused&&F(R(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?_e(a.groupId):o&&t.selectWhenListed(o)}else if(O)await lu(t,n,{kind:`shell`});else if(k){let{selection:e}=t,r=e.get().taskId===n?e.get().tabId:null,i=await t.client.request(`plugin.paneOpen`,{taskId:n,pane:au(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await lu(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:A()}:{}})});return(0,B.jsx)(Xr,{title:G(`terminal`,`tab.newChat.title`),wide:!0,children:(0,B.jsxs)(`form`,{className:br,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(ee||!e.shiftKey))e.preventDefault(),e.stopPropagation(),ee?Jl(e.currentTarget,pu,e.shiftKey?-1:1):te(fu[(fu.indexOf(a)+1)%fu.length]??`tab`,s);else if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`e`){e.preventDefault(),e.stopPropagation();let t=i.engines.filter(e=>e.ready!==!1),n=t[(t.findIndex(e=>e.id===i.engine)+1)%t.length];n&&i.setEngine(n.id)}else e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`f`?(e.preventDefault(),e.stopPropagation(),te(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&ee&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),M()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,B.jsxs)(`div`,{className:ur,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:G(`terminal`,`tab.newChat.engine`)}),(0,B.jsx)(su,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,B.jsxs)(`div`,{className:ur,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:G(`terminal`,`tab.newChat.destLabel`)}),(0,B.jsx)(xl,{label:G(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>te(e,s),choices:fu.map(e=>({id:e,label:G(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,B.jsxs)(`div`,{className:ur,children:[(0,B.jsxs)(`span`,{className:`${H} text-muted`,children:[G(`terminal`,`tab.newChat.ctxLabel`),` `,(0,B.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,B.jsx)(xl,{label:G(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>te(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:G(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),ee&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:G(`quickTask`,`attemptsLabel`)}),(0,B.jsx)(xl,{label:G(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:du.map(e=>({id:e,label:e}))})]}),(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:R(`taskops.forkBranch`)}),(0,B.jsx)(`input`,{className:sr,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:R(`newChat.prompt`)}),(0,B.jsx)(`textarea`,{className:`${sr} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:R(`newChat.promptPlaceholder`),value:l,onChange:e=>u(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),x(t))},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&e.currentTarget.form?.requestSubmit()}})]}),(0,B.jsx)(bl,{attachments:b,onRemove:S}),Sl()?(0,B.jsx)(`p`,{className:`text-muted`,children:R(`pages.attachHintTouch`)}):(0,B.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${er}`,children:G(`quickTask`,`legend`)}),_&&(0,B.jsx)(`p`,{className:`text-error`,children:_}),(0,B.jsx)(ti,{busy:g,submitLabel:R(`newChat.start`)})]})})}var hu=e=>e.split(`/`).filter(Boolean).pop()??e;function gu(e,t,n=``){let r=hu(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&hu(t.repo)===r);if(i.length===0)return r;let a=e=>e.split(`/`).filter(Boolean).slice(-2).join(`/`);return i.some(e=>e.host===n)?i.some(t=>t.host!==n&&a(t.repo)===a(e))&&n?`${n}:${a(e)}`:a(e):n?`${n}:${r}`:r}var _u=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function vu(e,t){let n=hu(e.repo),r=t.filter(t=>t!==e&&hu(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?_u(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&_u(e.repoId)===a)?i:a:gu(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var yu=/\s+#\d+\/\d+$/,bu=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),xu=e=>e.groupId&&e.kind!==`main`?`${e.machine?.id??``}\0${e.groupId}`:null;function Su(e){let t=new Map;for(let n of e){let e=xu(n);if(e===null)continue;let r=t.get(e);r?r.push(n):t.set(e,[n])}for(let[e,n]of t)n.length<2?t.delete(e):n.sort(bu);return t}function Cu(e){return(e[0]?.label??``).replace(yu,``)}function wu(e){let t=e=>e.engine?.name??e.label,n=new Map;for(let r of e)n.set(t(r),(n.get(t(r))??0)+1);let r=new Map;return new Map(e.map(e=>{let i=t(e),a=(r.get(i)??0)+1;return r.set(i,a),[e.id,(n.get(i)??0)>1?`${i} #${a}`:i]}))}var Tu=[`default`,`recent`,`attention`,`name`],Eu={folded:new Set,opened:new Set},Du=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},Ou=e=>Du(e.updatedAt??e.createdAt),ku=e=>Du(e.createdAt),Au=(e,t)=>ku(t)-ku(e)||t.id.localeCompare(e.id),ju=(e,t)=>Ou(t)-Ou(e)||t.id.localeCompare(e.id),Mu=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Nu={default:null,recent:Au,attention:(e,t)=>e.rank-t.rank||ju(e,t),name:(e,t)=>Mu.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},Pu=`~scratch`,Fu=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function Iu(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(zu(Nu[t]))}function Lu(e,t=`default`){let n=[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)),r=new Map;for(let e of n){let t=Fu(e)?Pu:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=Nu[t],a=[...r].map(([e,t])=>{let n=t.sort(zu(i));if(e===`~scratch`&&t.every(Fu))return{repo:``,label:R(`rail.noProject`),tasks:n,key:Pu,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:hu(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var Ru=e=>e.kind===`main`?0:e.pinned?1:2,zu=e=>(t,n)=>Ru(t)-Ru(n)||(e?e(t,n):0);function Bu(e,t){let n=new Set([e.id]);for(let r=e.parentTaskId;r!==void 0;r=t.get(r)?.parentTaskId){if(n.has(r))return r===e.id;n.add(r)}return!1}function Vu(e){let t=new Map;for(let n of e)for(let e of n.tasks)t.set(e.id,e);let n=new Map,r=new Set;for(let e of t.values()){let i=e.parentTaskId;if(i===void 0||!t.has(i)||Bu(e,t))continue;r.add(e.id);let a=n.get(i);a?a.push(e):n.set(i,[e])}return{children:n,nested:r}}function Hu(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),Hu(e,r.id,n);return n}function Uu(e,t,n,r){return r.folded.has(e)?!0:r.opened.has(e)||t<=5?!1:r.selectedId===void 0||!n.includes(r.selectedId)}function Wu(e,t=``,n=Eu,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&dc(a,e)),{children:s,nested:c}=Vu(e),l=[];for(let t of e){let e=a===``||o(t.label),u=t.machine===void 0?{}:{machine:t.machine},d=t.key??t.repo,f=t=>e||o(t.label,t.title,t.branch,hu(t.repo)),p=e=>f(e)||(s.get(e.id)??[]).some(p),m=(e,t,r,i=!1,o)=>{let c=r+1,l=t.machine?{machine:t.machine.id}:{},u=s.get(t.id),d=u?Hu(s,t.id):[],m=u!==void 0&&a===``&&Uu(t.id,u.length,d,n);e.push({id:t.id,kind:`task`,task:t,depth:Math.min(c,3),...c>3?{level:c}:{},...u?{fold:{count:d.length,collapsed:m,descendantIds:d}}:{},...o===void 0?{}:{attempt:o},...l});let g=i||f(t);m||h(e,(u??[]).filter(e=>g||p(e)),r+1,g)},h=(e,t,n,r)=>{let a=i?Su(t):new Map,o=new Set;for(let i of t){let t=xu(i),s=t===null?void 0:a.get(t);if(t===null||!s){m(e,i,n,r);continue}if(o.has(t))continue;o.add(t);let c=s[0];if(!c)continue;let l=n+1;e.push({id:`round:${c.machine?.id??``}:${c.groupId}`,kind:`round`,groupId:c.groupId??``,title:Cu(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=wu(s);for(let t of s)m(e,t,n+1,r,u.get(t.id))}},g=[];h(g,t.tasks.filter(e=>!c.has(e.id)&&p(e)),r,!1),!(g.length===0&&!e)&&l.push({id:`project:${d}`,kind:`project`,repo:t.repo,label:t.label,...t.noProject?{noProject:!0}:{},...u},...g)}return l}var Gu=e=>Math.max(0,...e.tasks.map(ku));function Ku(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Lu(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Lu(n.filter(e=>e.machine?.id===t.alias),e.sort).map(e=>({group:e,machine:t.alias})))],i=new Map;for(let e of r){let{repoId:t,repo:n}=e.group,r=e.group.noProject?Pu:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=Nu[e.sort],o=new Map,s=[];for(let[e,t]of i){let n=t[0];if(!n)continue;let r=t.flatMap(e=>e.group.tasks),i=n.group.noProject===!0,c={repo:n.group.repo,label:i?n.group.label:``,key:e,tasks:t.length===1?n.group.tasks:r.sort(zu(a)),...n.group.repoId?{repoId:n.group.repoId}:{},...n.machine===void 0||i?{}:{machine:n.machine},...i?{noProject:!0}:{}};s.push(c);for(let e of t)o.set(e,c)}let c=new Map(s.map(e=>[e,e.noProject?e.label:vu(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>Gu(t)-Gu(e)),e.sort===`name`&&l.sort((e,t)=>Mu.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:Wu(l,e.query,e.fold),groups:r.filter(e=>e.machine===void 0).map(e=>{let t=o.get(e);return{...e.group,label:(t&&c.get(t))??e.group.label}})}}function qu(e){return e.title??e.engineName??(e.kind===`engine`?R(`tab.engine`):R(`tab.shell`))}function Ju(e,t){if(t.size===0)return e;let n=!1;return e.filter(e=>e.kind===`project`||e.kind===`state`?(n=t.has(e.id),!0):!n)}function Yu(e){return e.kind===`leaf`?[e]:e.children.flatMap(Yu)}function Xu(e){return!!e&&Yu(e.root).length>1}function Zu(e){let t=[],n=(e,r,i,a,o,s,c)=>{if(e.kind===`leaf`){t.push({id:e.id,x:r,y:i,w:a,h:o,left:s,top:c});return}let l=e.children.length;e.children.forEach((t,u)=>{e.orientation===`row`?n(t,r+a*u/l,i,a/l,o,u>0||s,c):n(t,r,i+o*u/l,a,o/l,s,u>0||c)})};return n(e,0,0,1,1,!1,!1),t}function Qu(e,t,n=1){let r=Yu(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function $u(e,t){let n=new Map,r=new Map;for(let i of Yu(e.root)){if(i.title){r.set(i.id,i.title);continue}let e=i.own?t:`shell`,a=(n.get(e)??0)+1;n.set(e,a),r.set(i.id,a===1?e:`${e} ${a}`)}return r}function ed(e,t,n){return e.kind===`engine`&&Yu(t.root).some(e=>e.id===n&&e.own)}function td(e){return e.alive!==!1||!!e.split&&!Yu(e.split.root).some(e=>e.own)}function nd(e){return Yu(e.root).map(e=>e.id).join(`,`)}function rd(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function id(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var ad=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function od(e){let{taskId:t,tabId:n}=e.selection.get(),r=ad(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function sd(e,t){let{taskId:n,tabs:r}=od(e),i=r[t];!n||!i||e.select(n,i.id)}function cd(e){let{taskId:t,tabs:n,at:r}=od(e),i=n[r];!t||!i||C.set((0,B.jsx)(Qr,{title:R(`menu.renameTab`),initial:qu(i),submitLabel:R(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var ld=e=>!!e.selection.get().taskId,ud=e=>ad(e).length>0,dd=[{id:`help.open`,chords:[`f1`],prefix:!1,run:Vc},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>Ya(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:ld,run:e=>{let{taskId:t}=e.selection.get();t&&C.set((0,B.jsx)(mu,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=od(e);return!!t[n]&&!Xu(t[n]?.split)},run:cd},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:ud,run:e=>sd(e,(od(e).at+1)%ad(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:ud,run:e=>sd(e,(od(e).at-1+ad(e).length)%ad(e).length)},{id:`chat.tab.goto`,chords:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),prefix:!1,surface:`workspace`,live:ud,run:(e,t=``)=>{let n=$a().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&sd(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>pd(e)}];Za(()=>dd);function fd(e){(0,h.useEffect)(()=>{let t=t=>{if(C.get()||rd(t.target))return;let n=O.get();if(n===`worktrees`)return;let r=no()??(ld(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!ud(e)&&!id(t.target)){t.preventDefault(),t.stopPropagation(),C.set((0,B.jsx)(mu,{model:e,taskId:i}));return}let a=ac(t),o=$a().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&eo(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>to(e,r)-to(t,r))[0];o&&(t.preventDefault(),t.stopPropagation(),o.run(e,a.find(e=>o.chords.includes(e))))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}function pd(e){let t=e.tasks.get();if(!t)return;let n=Jc(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){F(R(`inbox.empty`));return}if(Gc(n.state)){Zc(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Xc(e,n))}async function md(e,t){try{if(t.kind===`action`){await e.client.request(`plugin.chordAction`,{chord:t.chord});return}let{taskId:n,tabId:r}=e.selection.get();if(!n){F(R(`keys.pluginNoTask`),`error`);return}let i=await e.client.request(`plugin.paneOpen`,{taskId:n,pane:t.target,...r?{tabId:r}:{}});await e.refreshTabsNow(n),e.select(n,i.tabId)}catch(e){F(U(e),`error`)}}function hd(e){(0,h.useEffect)(()=>{let t=t=>{let n=zi.get().plugins;if(n.length===0||!Qi({dialog:C.get()!==null,page:O.get()})||rd(t.target))return;let r=Zi(n,ac(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),md(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var gd=`prefix.moreCommands`,_d=/^ctrl\+[^+]+$/;function vd(e){return _d.test(e)?e.slice(5):null}function yd(e){let t=uc(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return Li(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${Li(e.prefixKey)} ${Li(n)}`}return null}function bd(e,t){let n=Ni.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>vd(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?vd(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:gd}),n}var Z=4e3,xd=180,Sd=Z,Cd=v({guide:null,entries:[]}),wd=1;function Td(e,t){let n={id:wd++,stroke:e,action:t,at:Date.now()};Cd.set({guide:null,entries:[...Cd.get().entries,n].slice(-3)})}var Ed=class extends Error{code;detail;constructor(e,t,n){super(t),this.code=e,this.detail=n}},Dd=[500,1e3,2e3,4e3,8e3,15e3],Od=4e3,kd=1e4,Ad=class{url;token;conn=v({state:`connecting`,hello:null,failures:0});ws=null;nextId=1;pending=new Map;listeners=new Map;openHooks=new Set;retryTimer=null;deadline=null;constructor(e,t){this.url=e,this.token=t}start(){this.connect();let e=()=>{document.visibilityState===`visible`&&this.checkNow()};document.addEventListener(`visibilitychange`,e),window.addEventListener(`online`,e),window.addEventListener(`pageshow`,e)}checkNow(){if(this.retryTimer!==null){this.retryNow();return}let e=this.ws;!e||this.conn.get().state!==`open`||this.deadline!==null||(this.armDeadline(e,Od),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof Ed&&e.code!==`NOT_CONNECTED`&&this.clearDeadline()}))}armDeadline(e,t){this.clearDeadline(),this.deadline=window.setTimeout(()=>this.lost(e),t)}clearDeadline(){this.deadline!==null&&window.clearTimeout(this.deadline),this.deadline=null}onOpen(e){return this.openHooks.add(e),this.conn.get().state===`open`&&e(),()=>this.openHooks.delete(e)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}request(e,t={},n){let r=this.ws;if(!r||r.readyState!==WebSocket.OPEN)return Promise.reject(new Ed(`NOT_CONNECTED`,`not connected to rove`));let i=this.nextId++;return new Promise((a,o)=>{this.pending.set(i,{resolve:e=>a(e),reject:o,progress:n}),r.send(JSON.stringify({id:i,op:e,args:t}))})}connect(){this.retryTimer=null;let e=go(this.url,this.token?[`rove.v1`,`rove.bearer.${this.token}`]:[`rove.v1`]);this.ws=e,this.armDeadline(e,kd),e.onmessage=e=>this.receive(String(e.data)),e.onopen=()=>{this.request(`hello`).then(e=>{this.clearDeadline(),this.conn.set({state:`open`,hello:e,failures:0});for(let e of this.openHooks)e()},()=>this.lost(e))},e.onclose=t=>this.lost(e,t?.code)}lost(e,t){if(this.ws!==e)return;this.ws=null,this.clearDeadline(),e.onopen=null,e.onclose=null,e.onmessage=null,e.close();for(let e of this.pending.values())e.reject(new Ed(`NOT_CONNECTED`,`connection lost`));if(this.pending.clear(),t===4401){o(),this.conn.set({state:`retrying`,hello:null,failures:2});return}let n=this.conn.get().failures+1;this.conn.set({state:`retrying`,hello:this.conn.get().hello,failures:n});let r=Dd[Math.min(n-1,Dd.length-1)];this.retryTimer=window.setTimeout(()=>this.connect(),r)}receive(e){let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!=`object`)return;if(`event`in t&&typeof t.event==`string`){let e=`data`in t?t.data:void 0;if(t.event===`op.progress`){let t=e;typeof t?.id==`number`&&typeof t.line==`string`&&this.pending.get(t.id)?.progress?.(t.line);return}for(let n of this.listeners.get(t.event)??[])n(e);return}if(!(`id`in t)||typeof t.id!=`number`)return;let n=this.pending.get(t.id);if(!n)return;if(this.pending.delete(t.id),`ok`in t&&t.ok===!0){n.resolve(`result`in t?t.result:void 0);return}let r=`error`in t&&t.error&&typeof t.error==`object`?t.error:{},i=`code`in r&&typeof r.code==`string`?r.code:`INTERNAL`,a=`message`in r&&typeof r.message==`string`?r.message:i;n.reject(new Ed(i,a,r))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}};function jd(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}var Md=`modulepreload`,Nd=function(e){return`/`+e},Pd={},Fd=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Nd(t,n),t=s(t),t in Pd)return;Pd[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Md,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Id=8,Ld=32,Rd=3e3,zd=100,Bd=new WeakMap,Vd=null;function Hd(e){let t=Bd.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},Bd.set(e,t)),t}function Ud(){return Vd||(Vd=document.createElement(`div`),Vd.style.display=`none`,document.body.append(Vd)),Vd}function Wd(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Ld)break;e.snapshots.delete(t)}}function Gd(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?Wd(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function Kd(e){let t=[...e.entries.values()].filter(e=>e.slot.parkedAt!==null);t.sort((e,t)=>(e.slot.parkedAt??0)-(t.slot.parkedAt??0));for(let n of t.slice(0,Math.max(0,t.length-Id)))Gd(e,n,!0)}function qd(e,t,n,r){return Hd(e).entries.get(eu(t,n,r))?.slot.parkedAt!=null}async function Jd(e,t){let n=Hd(e.client),r=eu(e.taskId,e.tabId,e.leafId),i=n.entries.get(r);if(i&&i.slot.parkedAt!==null){let{slot:r,handle:a,box:o}=i;return r.parkedAt=null,r.binding=t,i.leaving!==null&&(window.clearTimeout(i.leaving),i.leaving=null,o.classList.remove(`is-leaving`)),n.left=null,Qd(n),e.host.append(o),t.setNotice(r.notice),t.onScrolled(r.scrolled),a.term.refresh(0,a.term.rows-1),e.focusOnMount&&a.term.focus(),{handle:a,release:()=>Yd(n,i)}}let a=document.createElement(`div`);a.className=Rn,e.host.append(a),Xd(n,e.host);let o=!i,s={binding:t,notice:{kind:`none`},scrolled:0,parkedAt:null},c=null,l=o?n.snapshots.get(r):void 0;l&&n.snapshots.delete(r);let{mountTerminal:u}=await Fd(async()=>{let{mountTerminal:e}=await import(`./term-mount-BTgAJUtW.js`);return{mountTerminal:e}},__vite__mapDeps([0,1])),d=u({...e,el:a,snapshot:l,onPainted:()=>Qd(n),setNotice:e=>{s.notice=e,s.binding?.setNotice(e)},onScrolled:e=>{s.scrolled=e,s.binding?.onScrolled(e)},onFocusChange:e=>s.binding?.onFocusChange(e),onExit:e=>{s.binding?s.binding.onExit(e):c&&n.entries.get(r)===c&&Gd(n,c,!1)},copyText:e=>s.binding?.copyText(e)??Promise.resolve(!1),pasteImage:()=>s.binding?.pasteImage()??Promise.resolve()});if(!o)return{handle:d,release:()=>{d.dispose(),a.remove()}};let f={key:r,handle:d,box:a,slot:s,leaving:null};return c=f,n.entries.set(r,f),{handle:d,release:()=>Yd(n,f)}}function Yd(e,t){let{slot:n}=t;e.entries.get(t.key)===t&&n.parkedAt===null&&(n.binding?.onFocusChange(!1),n.binding=null,t.handle.term.blur(),n.parkedAt=performance.now(),Ud().append(t.box),e.left=t,Kd(e))}function Xd(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>zd)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>Zd(e,n),Rd))}function Zd(e,t){t.leaving!==null&&(window.clearTimeout(t.leaving),t.leaving=null,t.box.classList.remove(`is-leaving`),e.entries.get(t.key)===t&&t.slot.parkedAt!==null&&Ud().append(t.box))}function Qd(e){for(let t of e.entries.values())Zd(e,t)}async function $d(e,t,n){return Yc(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function ef(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(F(R(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Ed?e.code:void 0;return F(t===`UNKNOWN_OP`?R(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?R(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function tf(e,t,n,r){let{client:i}=e,a=eu(t,n),o=so(a)!==void 0||qd(i,t,n);try{return o||await i.request(`term.attach`,{taskId:t,tabId:n}),await i.request(`term.input`,{stream:a,data:r}),!0}catch(e){return F(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function nf(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||F(R(`inbox.gateKept`)),!0}catch(e){return F(e instanceof Error?e.message:String(e),`error`),!1}}var rf=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),af={id:`enter`,cap:`⏎`,bytes:()=>`\r`},of=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},rf(`up`,`↑`,`A`),rf(`down`,`↓`,`B`),rf(`left`,`←`,`D`),rf(`right`,`→`,`C`),af],sf=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),cf=[sf(1),sf(2),sf(3),sf(4),af];function lf(e){if(e.length!==1)return e;let t=e.toUpperCase().charCodeAt(0);return t===32?`\0`:t===63?``:t>=64&&t<=95?String.fromCharCode(t&31):e}var uf=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,df=2e3;function ff(e,t,n){let[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(!n)return;let r=!0,a=0,o=async()=>{try{let a=await $d(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,df))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function pf(e){z();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=ff(t,n,r),c=(0,h.useRef)(null),[l,u]=(0,h.useState)(``),[d,f]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)},[o]);let p=async e=>{f(!0);let t=await e();return f(!1),t&&window.setTimeout(s,600),t},m=async()=>{let e=l.trim();!e||d||await p(()=>i===`gate`&&a?nf(t,a.id,{text:e}):r?ef(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,B.jsxs)(`div`,{className:uf,children:[a&&(0,B.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,B.jsx)(`pre`,{ref:c,className:`m-0 max-h-60 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 text-ink whitespace-pre-wrap wrap-anywhere`,"data-peek-lines":12,children:o===null?`…`:o.length===0?R(`inbox.noOutput`):o.join(`
19
+ `);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,O?{}:{engine:D});O?await lu(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(ee){if(!r)throw Error(G(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(R(`taskops.forkNeedsMessage`));let e=p.trim()||r.branch,a;try{a=await t.client.request(`tab.forkTask`,{repo:r.repo,baseBranch:e,prompt:i,...D?{engine:D}:{},...Number(d)>1?{count:Number(d)}:{},...e===r.branch?{forkFrom:n}:{}})}catch(e){let t=Bl(e);if(!t)throw e;F(e instanceof Error?e.message:String(e),`error`),_e(t);return}a.forkRefused&&F(R(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?_e(a.groupId):o&&t.selectWhenListed(o)}else if(O)await lu(t,n,{kind:`shell`});else if(k){let{selection:e}=t,r=e.get().taskId===n?e.get().tabId:null,i=await t.client.request(`plugin.paneOpen`,{taskId:n,pane:au(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await lu(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:A()}:{}})});return(0,B.jsx)(Xr,{title:G(`terminal`,`tab.newChat.title`),wide:!0,children:(0,B.jsxs)(`form`,{className:br,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(ee||!e.shiftKey))e.preventDefault(),e.stopPropagation(),ee?Jl(e.currentTarget,pu,e.shiftKey?-1:1):te(fu[(fu.indexOf(a)+1)%fu.length]??`tab`,s);else if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`e`){e.preventDefault(),e.stopPropagation();let t=i.engines.filter(e=>e.ready!==!1),n=t[(t.findIndex(e=>e.id===i.engine)+1)%t.length];n&&i.setEngine(n.id)}else e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`f`?(e.preventDefault(),e.stopPropagation(),te(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&ee&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),M()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,B.jsxs)(`div`,{className:ur,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:G(`terminal`,`tab.newChat.engine`)}),(0,B.jsx)(su,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,B.jsxs)(`div`,{className:ur,children:[(0,B.jsx)(`span`,{className:`${H} text-muted`,children:G(`terminal`,`tab.newChat.destLabel`)}),(0,B.jsx)(xl,{label:G(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>te(e,s),choices:fu.map(e=>({id:e,label:G(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,B.jsxs)(`div`,{className:ur,children:[(0,B.jsxs)(`span`,{className:`${H} text-muted`,children:[G(`terminal`,`tab.newChat.ctxLabel`),` `,(0,B.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,B.jsx)(xl,{label:G(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>te(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:G(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),ee&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:G(`quickTask`,`attemptsLabel`)}),(0,B.jsx)(xl,{label:G(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:du.map(e=>({id:e,label:e}))})]}),(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:R(`taskops.forkBranch`)}),(0,B.jsx)(`input`,{className:sr,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:R(`newChat.prompt`)}),(0,B.jsx)(`textarea`,{className:`${sr} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:R(`newChat.promptPlaceholder`),value:l,onChange:e=>u(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),x(t))},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&e.currentTarget.form?.requestSubmit()}})]}),(0,B.jsx)(bl,{attachments:b,onRemove:S}),Sl()?(0,B.jsx)(`p`,{className:`text-muted`,children:R(`pages.attachHintTouch`)}):(0,B.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${er}`,children:G(`quickTask`,`legend`)}),_&&(0,B.jsx)(`p`,{className:`text-error`,children:_}),(0,B.jsx)(ti,{busy:g,submitLabel:R(`newChat.start`)})]})})}var hu=e=>e.split(`/`).filter(Boolean).pop()??e;function gu(e,t,n=``){let r=hu(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&hu(t.repo)===r);if(i.length===0)return r;let a=e=>e.split(`/`).filter(Boolean).slice(-2).join(`/`);return i.some(e=>e.host===n)?i.some(t=>t.host!==n&&a(t.repo)===a(e))&&n?`${n}:${a(e)}`:a(e):n?`${n}:${r}`:r}var _u=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function vu(e,t){let n=hu(e.repo),r=t.filter(t=>t!==e&&hu(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?_u(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&_u(e.repoId)===a)?i:a:gu(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var yu=/\s+#\d+\/\d+$/,bu=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),xu=e=>e.groupId&&e.kind!==`main`?`${e.machine?.id??``}\0${e.groupId}`:null;function Su(e){let t=new Map;for(let n of e){let e=xu(n);if(e===null)continue;let r=t.get(e);r?r.push(n):t.set(e,[n])}for(let[e,n]of t)n.length<2?t.delete(e):n.sort(bu);return t}function Cu(e){return(e[0]?.label??``).replace(yu,``)}function wu(e){let t=e=>e.engine?.name??e.label,n=new Map;for(let r of e)n.set(t(r),(n.get(t(r))??0)+1);let r=new Map;return new Map(e.map(e=>{let i=t(e),a=(r.get(i)??0)+1;return r.set(i,a),[e.id,(n.get(i)??0)>1?`${i} #${a}`:i]}))}var Tu=[`default`,`recent`,`attention`,`name`],Eu={folded:new Set,opened:new Set},Du=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},Ou=e=>Du(e.updatedAt??e.createdAt),ku=e=>Du(e.createdAt),Au=(e,t)=>ku(t)-ku(e)||t.id.localeCompare(e.id),ju=(e,t)=>Ou(t)-Ou(e)||t.id.localeCompare(e.id),Mu=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Nu={default:null,recent:Au,attention:(e,t)=>e.rank-t.rank||ju(e,t),name:(e,t)=>Mu.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},Pu=`~scratch`,Fu=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function Iu(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(zu(Nu[t]))}function Lu(e,t=`default`){let n=[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)),r=new Map;for(let e of n){let t=Fu(e)?Pu:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=Nu[t],a=[...r].map(([e,t])=>{let n=t.sort(zu(i));if(e===`~scratch`&&t.every(Fu))return{repo:``,label:R(`rail.noProject`),tasks:n,key:Pu,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:hu(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var Ru=e=>e.kind===`main`?0:e.pinned?1:2,zu=e=>(t,n)=>Ru(t)-Ru(n)||(e?e(t,n):0);function Bu(e,t){let n=new Set([e.id]);for(let r=e.parentTaskId;r!==void 0;r=t.get(r)?.parentTaskId){if(n.has(r))return r===e.id;n.add(r)}return!1}function Vu(e){let t=new Map;for(let n of e)for(let e of n.tasks)t.set(e.id,e);let n=new Map,r=new Set;for(let e of t.values()){let i=e.parentTaskId;if(i===void 0||!t.has(i)||Bu(e,t))continue;r.add(e.id);let a=n.get(i);a?a.push(e):n.set(i,[e])}return{children:n,nested:r}}function Hu(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),Hu(e,r.id,n);return n}function Uu(e,t,n,r){return r.folded.has(e)?!0:r.opened.has(e)||t<=5?!1:r.selectedId===void 0||!n.includes(r.selectedId)}function Wu(e,t=``,n=Eu,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&dc(a,e)),{children:s,nested:c}=Vu(e),l=[];for(let t of e){let e=a===``||o(t.label),u=t.machine===void 0?{}:{machine:t.machine},d=t.key??t.repo,f=t=>e||o(t.label,t.title,t.branch,hu(t.repo)),p=e=>f(e)||(s.get(e.id)??[]).some(p),m=(e,t,r,i=!1,o)=>{let c=r+1,l=t.machine?{machine:t.machine.id}:{},u=s.get(t.id),d=u?Hu(s,t.id):[],m=u!==void 0&&a===``&&Uu(t.id,u.length,d,n);e.push({id:t.id,kind:`task`,task:t,depth:Math.min(c,3),...c>3?{level:c}:{},...u?{fold:{count:d.length,collapsed:m,descendantIds:d}}:{},...o===void 0?{}:{attempt:o},...l});let g=i||f(t);m||h(e,(u??[]).filter(e=>g||p(e)),r+1,g)},h=(e,t,n,r)=>{let a=i?Su(t):new Map,o=new Set;for(let i of t){let t=xu(i),s=t===null?void 0:a.get(t);if(t===null||!s){m(e,i,n,r);continue}if(o.has(t))continue;o.add(t);let c=s[0];if(!c)continue;let l=n+1;e.push({id:`round:${c.machine?.id??``}:${c.groupId}`,kind:`round`,groupId:c.groupId??``,title:Cu(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=wu(s);for(let t of s)m(e,t,n+1,r,u.get(t.id))}},g=[];h(g,t.tasks.filter(e=>!c.has(e.id)&&p(e)),r,!1),!(g.length===0&&!e)&&l.push({id:`project:${d}`,kind:`project`,repo:t.repo,label:t.label,...t.noProject?{noProject:!0}:{},...u},...g)}return l}var Gu=e=>Math.max(0,...e.tasks.map(ku));function Ku(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...Lu(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>Lu(n.filter(e=>e.machine?.id===t.alias),e.sort).map(e=>({group:e,machine:t.alias})))],i=new Map;for(let e of r){let{repoId:t,repo:n}=e.group,r=e.group.noProject?Pu:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=Nu[e.sort],o=new Map,s=[];for(let[e,t]of i){let n=t[0];if(!n)continue;let r=t.flatMap(e=>e.group.tasks),i=n.group.noProject===!0,c={repo:n.group.repo,label:i?n.group.label:``,key:e,tasks:t.length===1?n.group.tasks:r.sort(zu(a)),...n.group.repoId?{repoId:n.group.repoId}:{},...n.machine===void 0||i?{}:{machine:n.machine},...i?{noProject:!0}:{}};s.push(c);for(let e of t)o.set(e,c)}let c=new Map(s.map(e=>[e,e.noProject?e.label:vu(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>Gu(t)-Gu(e)),e.sort===`name`&&l.sort((e,t)=>Mu.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:Wu(l,e.query,e.fold),groups:r.filter(e=>e.machine===void 0).map(e=>{let t=o.get(e);return{...e.group,label:(t&&c.get(t))??e.group.label}})}}function qu(e){return e.title??e.engineName??(e.kind===`engine`?R(`tab.engine`):R(`tab.shell`))}function Ju(e,t){if(t.size===0)return e;let n=!1;return e.filter(e=>e.kind===`project`||e.kind===`state`?(n=t.has(e.id),!0):!n)}function Yu(e){return e.kind===`leaf`?[e]:e.children.flatMap(Yu)}function Xu(e){return!!e&&Yu(e.root).length>1}function Zu(e){let t=[],n=(e,r,i,a,o,s,c)=>{if(e.kind===`leaf`){t.push({id:e.id,x:r,y:i,w:a,h:o,left:s,top:c});return}let l=e.children.length;e.children.forEach((t,u)=>{e.orientation===`row`?n(t,r+a*u/l,i,a/l,o,u>0||s,c):n(t,r,i+o*u/l,a,o/l,s,u>0||c)})};return n(e,0,0,1,1,!1,!1),t}function Qu(e,t,n=1){let r=Yu(e.root).map(e=>e.id),i=r.indexOf(t);return r[(Math.max(0,i)+n+r.length)%r.length]??t}function $u(e,t){let n=new Map,r=new Map;for(let i of Yu(e.root)){if(i.title){r.set(i.id,i.title);continue}let e=i.own?t:`shell`,a=(n.get(e)??0)+1;n.set(e,a),r.set(i.id,a===1?e:`${e} ${a}`)}return r}function ed(e,t,n){return e.kind===`engine`&&Yu(t.root).some(e=>e.id===n&&e.own)}function td(e){return e.alive!==!1||!!e.split&&!Yu(e.split.root).some(e=>e.own)}function nd(e){return Yu(e.root).map(e=>e.id).join(`,`)}function rd(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function id(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var ad=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function od(e){let{taskId:t,tabId:n}=e.selection.get(),r=ad(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function sd(e,t){let{taskId:n,tabs:r}=od(e),i=r[t];!n||!i||e.select(n,i.id)}function cd(e){let{taskId:t,tabs:n,at:r}=od(e),i=n[r];!t||!i||C.set((0,B.jsx)(Qr,{title:R(`menu.renameTab`),initial:qu(i),submitLabel:R(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var ld=e=>!!e.selection.get().taskId,ud=e=>ad(e).length>0,dd=[{id:`help.open`,chords:[`f1`],prefix:!1,run:Vc},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>Ya(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:ld,run:e=>{let{taskId:t}=e.selection.get();t&&C.set((0,B.jsx)(mu,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=od(e);return!!t[n]&&!Xu(t[n]?.split)},run:cd},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:ud,run:e=>sd(e,(od(e).at+1)%ad(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:ud,run:e=>sd(e,(od(e).at-1+ad(e).length)%ad(e).length)},{id:`chat.tab.goto`,chords:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`].map(e=>`ctrl+${e}`),prefix:!1,surface:`workspace`,live:ud,run:(e,t=``)=>{let n=$a().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&sd(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>pd(e)}];Za(()=>dd);function fd(e){(0,h.useEffect)(()=>{let t=t=>{if(C.get()||rd(t.target))return;let n=O.get();if(n===`worktrees`)return;let r=no()??(ld(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!ud(e)&&!id(t.target)){t.preventDefault(),t.stopPropagation(),C.set((0,B.jsx)(mu,{model:e,taskId:i}));return}let a=ac(t),o=$a().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&eo(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>to(e,r)-to(t,r))[0];o&&(t.preventDefault(),t.stopPropagation(),o.run(e,a.find(e=>o.chords.includes(e))))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}function pd(e){let t=e.tasks.get();if(!t)return;let n=Jc(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){F(R(`inbox.empty`));return}if(Gc(n.state)){Zc(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Xc(e,n))}async function md(e,t){try{if(t.kind===`action`){await e.client.request(`plugin.chordAction`,{chord:t.chord});return}let{taskId:n,tabId:r}=e.selection.get();if(!n){F(R(`keys.pluginNoTask`),`error`);return}let i=await e.client.request(`plugin.paneOpen`,{taskId:n,pane:t.target,...r?{tabId:r}:{}});await e.refreshTabsNow(n),e.select(n,i.tabId)}catch(e){F(U(e),`error`)}}function hd(e){(0,h.useEffect)(()=>{let t=t=>{let n=zi.get().plugins;if(n.length===0||!Qi({dialog:C.get()!==null,page:O.get()})||rd(t.target))return;let r=Zi(n,ac(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),md(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var gd=`prefix.moreCommands`,_d=/^ctrl\+[^+]+$/;function vd(e){return _d.test(e)?e.slice(5):null}function yd(e){let t=uc(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return Li(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${Li(e.prefixKey)} ${Li(n)}`}return null}function bd(e,t){let n=Ni.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>vd(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?vd(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:gd}),n}var Z=4e3,xd=180,Sd=Z,Cd=v({guide:null,entries:[]}),wd=1;function Td(e,t){let n={id:wd++,stroke:e,action:t,at:Date.now()};Cd.set({guide:null,entries:[...Cd.get().entries,n].slice(-3)})}var Ed=class extends Error{code;detail;constructor(e,t,n){super(t),this.code=e,this.detail=n}},Dd=[500,1e3,2e3,4e3,8e3,15e3],Od=4e3,kd=1e4,Ad=class{url;token;conn=v({state:`connecting`,hello:null,failures:0});ws=null;nextId=1;pending=new Map;listeners=new Map;openHooks=new Set;retryTimer=null;deadline=null;constructor(e,t){this.url=e,this.token=t}start(){this.connect();let e=()=>{document.visibilityState===`visible`&&this.checkNow()};document.addEventListener(`visibilitychange`,e),window.addEventListener(`online`,e),window.addEventListener(`pageshow`,e)}checkNow(){if(this.retryTimer!==null){this.retryNow();return}let e=this.ws;!e||this.conn.get().state!==`open`||this.deadline!==null||(this.armDeadline(e,Od),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof Ed&&e.code!==`NOT_CONNECTED`&&this.clearDeadline()}))}armDeadline(e,t){this.clearDeadline(),this.deadline=window.setTimeout(()=>this.lost(e),t)}clearDeadline(){this.deadline!==null&&window.clearTimeout(this.deadline),this.deadline=null}onOpen(e){return this.openHooks.add(e),this.conn.get().state===`open`&&e(),()=>this.openHooks.delete(e)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}request(e,t={},n){let r=this.ws;if(!r||r.readyState!==WebSocket.OPEN)return Promise.reject(new Ed(`NOT_CONNECTED`,`not connected to rove`));let i=this.nextId++;return new Promise((a,o)=>{this.pending.set(i,{resolve:e=>a(e),reject:o,progress:n}),r.send(JSON.stringify({id:i,op:e,args:t}))})}connect(){this.retryTimer=null;let e=go(this.url,this.token?[`rove.v1`,`rove.bearer.${this.token}`]:[`rove.v1`]);this.ws=e,this.armDeadline(e,kd),e.onmessage=e=>this.receive(String(e.data)),e.onopen=()=>{this.request(`hello`).then(e=>{this.clearDeadline(),this.conn.set({state:`open`,hello:e,failures:0});for(let e of this.openHooks)e()},()=>this.lost(e))},e.onclose=t=>this.lost(e,t?.code)}lost(e,t){if(this.ws!==e)return;this.ws=null,this.clearDeadline(),e.onopen=null,e.onclose=null,e.onmessage=null,e.close();for(let e of this.pending.values())e.reject(new Ed(`NOT_CONNECTED`,`connection lost`));if(this.pending.clear(),t===4401){o(),this.conn.set({state:`retrying`,hello:null,failures:2});return}let n=this.conn.get().failures+1;this.conn.set({state:`retrying`,hello:this.conn.get().hello,failures:n});let r=Dd[Math.min(n-1,Dd.length-1)];this.retryTimer=window.setTimeout(()=>this.connect(),r)}receive(e){let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!=`object`)return;if(`event`in t&&typeof t.event==`string`){let e=`data`in t?t.data:void 0;if(t.event===`op.progress`){let t=e;typeof t?.id==`number`&&typeof t.line==`string`&&this.pending.get(t.id)?.progress?.(t.line);return}for(let n of this.listeners.get(t.event)??[])n(e);return}if(!(`id`in t)||typeof t.id!=`number`)return;let n=this.pending.get(t.id);if(!n)return;if(this.pending.delete(t.id),`ok`in t&&t.ok===!0){n.resolve(`result`in t?t.result:void 0);return}let r=`error`in t&&t.error&&typeof t.error==`object`?t.error:{},i=`code`in r&&typeof r.code==`string`?r.code:`INTERNAL`,a=`message`in r&&typeof r.message==`string`?r.message:i;n.reject(new Ed(i,a,r))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}};function jd(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}var Md=`modulepreload`,Nd=function(e){return`/`+e},Pd={},Fd=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Nd(t,n),t=s(t),t in Pd)return;Pd[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Md,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Id=8,Ld=32,Rd=3e3,zd=100,Bd=new WeakMap,Vd=null;function Hd(e){let t=Bd.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},Bd.set(e,t)),t}function Ud(){return Vd||(Vd=document.createElement(`div`),Vd.style.display=`none`,document.body.append(Vd)),Vd}function Wd(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=Ld)break;e.snapshots.delete(t)}}function Gd(e,t,n){e.entries.delete(t.key),t.leaving!==null&&window.clearTimeout(t.leaving),t.leaving=null,n?Wd(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function Kd(e){let t=[...e.entries.values()].filter(e=>e.slot.parkedAt!==null);t.sort((e,t)=>(e.slot.parkedAt??0)-(t.slot.parkedAt??0));for(let n of t.slice(0,Math.max(0,t.length-Id)))Gd(e,n,!0)}function qd(e,t,n,r){return Hd(e).entries.get(eu(t,n,r))?.slot.parkedAt!=null}async function Jd(e,t){let n=Hd(e.client),r=eu(e.taskId,e.tabId,e.leafId),i=n.entries.get(r);if(i&&i.slot.parkedAt!==null){let{slot:r,handle:a,box:o}=i;return r.parkedAt=null,r.binding=t,i.leaving!==null&&(window.clearTimeout(i.leaving),i.leaving=null,o.classList.remove(`is-leaving`)),n.left=null,Qd(n),e.host.append(o),t.setNotice(r.notice),t.onScrolled(r.scrolled),a.term.refresh(0,a.term.rows-1),e.focusOnMount&&a.term.focus(),{handle:a,release:()=>Yd(n,i)}}let a=document.createElement(`div`);a.className=Rn,e.host.append(a),Xd(n,e.host);let o=!i,s={binding:t,notice:{kind:`none`},scrolled:0,parkedAt:null},c=null,l=o?n.snapshots.get(r):void 0;l&&n.snapshots.delete(r);let{mountTerminal:u}=await Fd(async()=>{let{mountTerminal:e}=await import(`./term-mount-CdilPGdu.js`);return{mountTerminal:e}},__vite__mapDeps([0,1])),d=u({...e,el:a,snapshot:l,onPainted:()=>Qd(n),setNotice:e=>{s.notice=e,s.binding?.setNotice(e)},onScrolled:e=>{s.scrolled=e,s.binding?.onScrolled(e)},onFocusChange:e=>s.binding?.onFocusChange(e),onExit:e=>{s.binding?s.binding.onExit(e):c&&n.entries.get(r)===c&&Gd(n,c,!1)},copyText:e=>s.binding?.copyText(e)??Promise.resolve(!1),pasteImage:()=>s.binding?.pasteImage()??Promise.resolve()});if(!o)return{handle:d,release:()=>{d.dispose(),a.remove()}};let f={key:r,handle:d,box:a,slot:s,leaving:null};return c=f,n.entries.set(r,f),{handle:d,release:()=>Yd(n,f)}}function Yd(e,t){let{slot:n}=t;e.entries.get(t.key)===t&&n.parkedAt===null&&(n.binding?.onFocusChange(!1),n.binding=null,t.handle.term.blur(),n.parkedAt=performance.now(),Ud().append(t.box),e.left=t,Kd(e))}function Xd(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>zd)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>Zd(e,n),Rd))}function Zd(e,t){t.leaving!==null&&(window.clearTimeout(t.leaving),t.leaving=null,t.box.classList.remove(`is-leaving`),e.entries.get(t.key)===t&&t.slot.parkedAt!==null&&Ud().append(t.box))}function Qd(e){for(let t of e.entries.values())Zd(e,t)}async function $d(e,t,n){return Yc(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function ef(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(F(R(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Ed?e.code:void 0;return F(t===`UNKNOWN_OP`?R(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?R(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function tf(e,t,n,r){let{client:i}=e,a=eu(t,n),o=so(a)!==void 0||qd(i,t,n);try{return o||await i.request(`term.attach`,{taskId:t,tabId:n}),await i.request(`term.input`,{stream:a,data:r}),!0}catch(e){return F(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function nf(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||F(R(`inbox.gateKept`)),!0}catch(e){return F(e instanceof Error?e.message:String(e),`error`),!1}}var rf=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),af={id:`enter`,cap:`⏎`,bytes:()=>`\r`},of=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},rf(`up`,`↑`,`A`),rf(`down`,`↓`,`B`),rf(`left`,`←`,`D`),rf(`right`,`→`,`C`),af],sf=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),cf=[sf(1),sf(2),sf(3),sf(4),af];function lf(e){if(e.length!==1)return e;let t=e.toUpperCase().charCodeAt(0);return t===32?`\0`:t===63?``:t>=64&&t<=95?String.fromCharCode(t&31):e}var uf=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,df=2e3;function ff(e,t,n){let[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(!n)return;let r=!0,a=0,o=async()=>{try{let a=await $d(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,df))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function pf(e){z();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=ff(t,n,r),c=(0,h.useRef)(null),[l,u]=(0,h.useState)(``),[d,f]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)},[o]);let p=async e=>{f(!0);let t=await e();return f(!1),t&&window.setTimeout(s,600),t},m=async()=>{let e=l.trim();!e||d||await p(()=>i===`gate`&&a?nf(t,a.id,{text:e}):r?ef(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,B.jsxs)(`div`,{className:uf,children:[a&&(0,B.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,B.jsx)(`pre`,{ref:c,className:`m-0 max-h-60 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 text-ink whitespace-pre-wrap wrap-anywhere`,"data-peek-lines":12,children:o===null?`…`:o.length===0?R(`inbox.noOutput`):o.join(`
20
20
  `)}),i===`gate`&&a&&(0,B.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.options.map(e=>(0,B.jsxs)(V,{disabled:d,title:e.detail,onClick:()=>void p(()=>nf(t,a.id,{option:e.key})),children:[`[ `,e.key===a.recommended?`★ `:``,e.label,` ]`]},e.key))}),i===`menu`&&r&&(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[cf.map(e=>(0,B.jsxs)(V,{disabled:d,onClick:()=>void p(()=>tf(t,n,r,e.bytes(!1))),children:[`[ `,e.cap,` ]`]},e.id)),(0,B.jsx)(V,{onClick:e.onOpenTab,children:R(`inbox.openTab`)})]}),(i===`reply`||i===`gate`)&&(0,B.jsxs)(`form`,{className:`flex min-w-0 items-center gap-2`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,B.jsx)(`input`,{className:`min-w-0 flex-1 rounded-sm border-hairline border-line bg-paper px-2 py-1.5 font-mono text-ink focus-visible:border-line-active focus-visible:outline-none touch:min-h-10 touch:text-display`,value:l,disabled:d,placeholder:R(`inbox.replyPlaceholder`),"aria-label":R(`inbox.replyPlaceholder`),autoComplete:`off`,enterKeyHint:`send`,onChange:e=>u(e.target.value)}),(0,B.jsx)(V,{type:`submit`,disabled:d||l.trim()===``,children:R(`inbox.send`)})]})]})}function mf({text:e}){return(0,B.jsx)(`span`,{className:`inline-flex flex-wrap gap-x-3 gap-y-0`,children:e.split(`·`).map(e=>e.trim()).filter(Boolean).map(e=>(0,B.jsx)(`span`,{children:e},e))})}var hf={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,info:`text-info`,success:`text-success`,added:`text-diff-added`,removed:`text-diff-removed`},gf={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,success:`text-success`,info:`text-accent`,ink:`text-ink`},_f=6;function vf(e,t){return e?`${e.repo.split(`/`).filter(Boolean).pop()??e.repo} › ${e.label}`:t}function yf({model:e}){z();let t=y(e.tasks),n=y(e.visits),r=y(e.tabs),[i,a]=(0,h.useState)(0),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(Date.now());(0,h.useEffect)(()=>{let e=window.setInterval(()=>l(Date.now()),3e4);return()=>window.clearInterval(e)},[]);let u=new Map((t?.tasks??[]).map(e=>[e.id,e])),d=(e,t)=>e&&t&&r[e]?.find(e=>e.id===t)?.title||``,f=qc(t?.attention??[],t?.tasks.map(e=>e.id)??[]).map((e,t)=>{let n=e.taskId?u.get(e.taskId):void 0;return{key:`a${t}:${e.taskId}:${e.tabId}`,section:`attention`,taskId:e.taskId,tabId:e.tabId,identity:vf(n,e.label??e.taskId??``),subtitle:d(e.taskId,e.tabId)||n?.branch||``,at:e.at,attention:e}}),p=new Set(f.map(e=>`${e.taskId}:${e.tabId}`)),m=n.filter(e=>u.has(e.taskId)&&!p.has(`${e.taskId}:${e.tabId}`)).slice(0,_f).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,identity:vf(u.get(e.taskId),e.taskId),subtitle:d(e.taskId,e.tabId)||u.get(e.taskId)?.branch||``,at:e.at})),g=[...f,...m],_=g[Math.min(i,g.length-1)],v=t=>{if(t.attention&&Gc(t.attention.state))return Zc(e,t.attention);t.attention&&Xc(e,t.attention),t.taskId&&u.has(t.taskId)&&(e.select(t.taskId,t.tabId),L())},b=()=>void Promise.all(f.map(t=>t.attention&&Xc(e,t.attention,!0)));(0,h.useEffect)(()=>{let t=t=>{if(!(t.target instanceof HTMLElement&&t.target.closest(`input, textarea`))){if(t.key===`ArrowDown`||t.key===`j`)a(e=>Math.min(g.length-1,e+1));else if(t.key===`ArrowUp`||t.key===`k`)a(e=>Math.max(0,e-1));else if(t.key===`Enter`&&_)v(_);else if(t.key===`d`&&_?.attention)Xc(e,_.attention,!0);else if(t.key===`D`)b();else return;t.preventDefault()}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)});let x=n=>{let r=n.attention?Uc(n.attention.state):null,i=n===_,l=n.attention,d=n.taskId?u.get(n.taskId):void 0,f=l?.gateId?t?.gates?.find(e=>e.id===l.gateId&&e.status===`open`):void 0,p=n.tabId??f?.tabId??null,m=!!l&&!!d&&!d.machine&&!Gc(l.state)&&(!l.gateId||!!f)&&(!!p||!!f),h=l?.state===`permission_needed`||!!p&&d?.tabStatus?.[p]?.kind===`needs-input`,y=f?`gate`:l?.state===`dead`?`readonly`:h?`menu`:`reply`,b=`${n.taskId}:${n.tabId}:${l?.gateId??``}`,x=m&&o===b;return(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`div`,{className:Ir,children:[(0,B.jsxs)(`button`,{type:`button`,className:`${Ur({selected:i,stack:!0})} ${Lr}`,onMouseEnter:()=>a(g.indexOf(n)),onClick:()=>v(n),children:[(0,B.jsxs)(`span`,{className:Pr,children:[(0,B.jsx)(`span`,{className:Wr,children:n.identity}),r&&(0,B.jsxs)(`span`,{className:`flex-none font-mono text-meta font-normal normal-nums ${gf[r.tone]}`,children:[r.glyph,` `,R(r.stateKey)]}),(0,B.jsx)(`span`,{className:Fr,children:Wc(c-n.at)})]}),n.subtitle&&(0,B.jsx)(`span`,{className:`truncate font-mono text-meta font-normal normal-nums text-muted`,children:n.subtitle})]}),m?(0,B.jsx)(V,{className:Rr,"aria-expanded":x,onClick:()=>{a(g.indexOf(n)),s(x?null:b)},children:R(x?`inbox.hide`:`inbox.reply`)}):(0,B.jsx)(`span`,{"aria-hidden":!0,className:Rr})]}),x&&n.taskId&&(0,B.jsx)(pf,{model:e,taskId:n.taskId,tabId:p,mode:y,gate:f,onOpenTab:()=>v(n)})]},n.key)};return(0,B.jsx)(Xr,{title:R(`inbox.title`),wide:!0,children:(0,B.jsxs)(`div`,{className:br,children:[(0,B.jsxs)(`div`,{className:jr,children:[(0,B.jsx)(`p`,{className:`${H} text-muted ${Ar} touch:hidden!`,children:(0,B.jsx)(mf,{text:R(`inbox.hints`)})}),f.length>0&&(0,B.jsx)(V,{className:`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,onClick:b,children:R(`inbox.ackAll`)})]}),(0,B.jsx)(`h2`,{className:`${H} text-muted ${Mr}`,children:R(`inbox.attention`)}),f.length===0?(0,B.jsx)(`p`,{className:`mono text-muted`,children:R(`inbox.empty`)}):(0,B.jsx)(`ul`,{className:Nr,children:f.map(x)}),m.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted mt-1`,children:R(`inbox.recent`)}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:m.map(x)})]})]})})}var bf=[`project`,`state`],xf=`rove.railGroup`,Sf=v(bf.find(e=>e===localStorage.getItem(xf))??`project`);function Cf(e){Sf.set(e),localStorage.setItem(xf,e)}var wf=`rove.activeSortMode`;function Tf(){let e=localStorage.getItem(wf);return Tu.find(t=>t===e)??`recent`}var Ef=v(Tf());function Df(e){Ef.set(e),localStorage.setItem(wf,e)}function Of(){Df(Tu[(Tu.indexOf(Ef.get())+1)%Tu.length]??`default`)}var kf=v(!1),Af=v(null);function jf(e){e&&(Ef.get()!=="default"||Sf.get()===`state`)&&(Df(`default`),Cf(`project`),F(G(`tasks`,`sort.reorderSwitched`))),e||Af.set(null),kf.set(e)}async function Mf(e,t,n){let r=n<0?`up`:`down`;try{await e.client.request(`task.move`,{taskId:t.task.id,direction:r})}catch(e){F(G(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function Nf(e,t,n){let r=n<0?`up`:`down`;try{for(let i=0;i<Math.abs(n);i++)await e.client.request(`task.move`,{taskId:t,direction:r})}catch(e){F(G(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}var Pf=`flex min-h-0 min-w-0 flex-1 flex-col p-4 font-mono text-meta leading-[1.5] font-normal not-italic normal-nums`,Ff=`flex min-h-0 flex-1 flex-col items-center justify-center gap-1.5 overflow-hidden text-center keyboard:hidden`,If=`relative mx-auto flex w-full max-w-[104ch] flex-none flex-col gap-2 keyboard:mt-auto`,Lf=`flex flex-col gap-2 rounded-md border-hairline border-line bg-surface px-3 py-2.5 focus-within:border-line-active`,Rf=`flex flex-wrap items-center justify-end gap-1.5`,zf=`max-h-[40vh] min-h-[4.5em] w-full bg-transparent text-ink [border:0] [outline:0]`,Bf=`flex flex-wrap items-center gap-1.5 px-1`,Vf=`flex min-w-0 items-center gap-1.5`,Hf=`${Vf} ml-auto narrow:ml-0`,Uf=(e=!1)=>`flex h-7 min-w-7 cursor-pointer items-center justify-center rounded-sm px-1 has-[:disabled]:opacity-60 disabled:opacity-60 [&:hover]:bg-hover [&:hover]:text-ink ${e?`text-accent`:`text-muted`}`,Wf=`size-3.25 flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,Gf=(e=!1)=>`inline-flex max-w-[28ch] items-center gap-1.5 overflow-hidden rounded-full border-hairline px-2.5 py-0.75 text-ellipsis whitespace-nowrap touch:py-1.75 [&:hover]:bg-hover [&:hover]:text-ink aria-expanded:bg-hover aria-expanded:text-ink ${e?`border-[color-mix(in_srgb,var(--accent)_45%,transparent)] bg-accent-soft text-accent`:`border-line text-muted`}`,Kf=`disabled:cursor-default disabled:opacity-60`,qf=e=>`${Gf(e)} min-w-[9ch] justify-center ${Kf}`,Jf=`touch-none select-none [-webkit-touch-callout:none]`,Yf=`group/chip relative inline-flex`,Xf=`flex min-h-0 flex-col gap-1 overflow-y-auto p-1.5 [outline:0]`,Zf=`flex min-h-0 flex-col overflow-y-auto`,Qf=`sticky top-0 z-1 m-0 bg-surface px-1.5 pt-1.5 pb-0.5 text-left`,$f=e=>`flex w-full items-baseline gap-2 rounded-[calc(var(--radius)-6px)] px-2 py-1 text-left touch:py-2.5 disabled:cursor-default disabled:opacity-50 ${e.dim?`text-subtle`:`text-ink`} ${e.cursor?`bg-hover`:``}`,ep=`flex-[0_0_1.5ch] text-accent`,tp=`ml-auto pl-3 inline-flex items-center gap-1`,np=`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,rp=`flex-none whitespace-nowrap`,ip=`flex flex-col gap-0.5 px-1.5 py-0.5`,ap=`min-w-[36ch]`,op=`flex items-center gap-1.5 p-1.5`;function sp(){return(0,B.jsx)(`svg`,{className:Wf,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M2 4.5a1 1 0 0 1 1-1h3l1.5 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z`})})}function cp(){return(0,B.jsxs)(`svg`,{className:Wf,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`circle`,{cx:`4.5`,cy:`3.5`,r:`1.5`}),(0,B.jsx)(`circle`,{cx:`4.5`,cy:`12.5`,r:`1.5`}),(0,B.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.5`}),(0,B.jsx)(`path`,{d:`M4.5 5v6M11.5 6.5c0 3-7 2-7 4.5`})]})}var lp=`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,up=`before:absolute before:top-0 before:left-1 before:content-[''] before:[border-left:var(--hairline)_solid_var(--line-active)]`,dp={blank:``,pipe:`${up} before:bottom-0`,tee:`${up} before:bottom-0`,elbow:`${up} before:right-0 before:bottom-1/2 before:rounded-bl-[6px] before:[border-bottom:var(--hairline)_solid_var(--line-active)]`},fp=e=>`relative w-3 ${dp[e]}`,pp=`-mx-1 inline-flex min-w-6 cursor-pointer items-center justify-center gap-1 self-stretch rounded-xs px-2 font-mono hover:bg-hover`,mp=`inline-flex items-center gap-1`,hp=e=>`fixed z-35 flex max-h-[min(380px,60vh)] w-85 max-w-[calc(100vw-24px)] animate-pr-list-in flex-col overflow-y-auto overscroll-contain rounded-md border-hairline border-line bg-surface p-1.5 shadow-popover transition-[opacity,translate] duration-120 ease-in motion-reduce:animate-none motion-reduce:transition-none ${e?`-translate-x-1 opacity-0`:``}`,gp=`inline-flex flex-none items-center text-subtle`,_p=`group/rail rail @container row-1 flex min-h-0 flex-col focus:outline-none ${Kt}`,vp=`flex min-w-0 items-center gap-2.5 overflow-hidden px-3.5 pt-3.5 pb-2.5 whitespace-nowrap`,yp=`flex gap-1 px-3.5 pb-2 text-meta`,bp=`min-w-0 flex-1 border-none bg-transparent p-0 text-ink [font:inherit] outline-none placeholder:text-subtle`,xp=e=>`flex-1 overflow-y-auto px-1.5 pt-1 pb-3 scrollbar-none ${e?`[&>[data-row]]:[transition:transform_150ms_ease-out,scale_150ms_ease-out,opacity_150ms_ease-out] motion-reduce:[&>[data-row]]:transition-none [&>[data-row]]:[box-shadow:none]! [&>[data-row]:not([data-lifted])]:opacity-45`:``}`,Sp=`group-focus-within/rail:[box-shadow:inset_0_0_0_1px_var(--focus)]`,Cp=e=>`group/head mx-2 mt-1.5 mb-1 flex items-center gap-1 font-mono text-meta font-semibold normal-nums not-first:mt-4.5 ${e.dragging?`origin-left scale-[1.03] cursor-grabbing text-ink motion-reduce:scale-none`:`text-subtle`} ${e.grab&&!e.dragging?`relative cursor-grab before:-left-1.5 [&>button:first-child]:cursor-grab ${Hr}`:``} ${e.moving?`bg-accent-soft after:font-mono after:text-meta after:font-medium after:normal-nums after:text-accent after:content-['move']`:``}`,wp=`touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-inset-y-3 touch:after:content-['']`,Tp=`group/toggle -ml-1 inline-flex min-w-0 cursor-pointer items-center gap-1 rounded-xs border-none bg-transparent px-1 py-0.5 text-inherit [font:inherit] hover:text-ink ${wp}`,Ep=e=>e?``:`opacity-0 group-hover/head:opacity-100 group-focus-visible/toggle:opacity-100 touch:opacity-100`,Dp=`-mr-[4.5px] ml-auto size-5 cursor-pointer rounded-xs border-none bg-transparent text-muted opacity-0 [font:400_var(--fs-display)/1_var(--sans)] group-hover/head:opacity-100 hover:bg-hover hover:text-ink focus-visible:opacity-100 touch:opacity-100 ${wp}`,Op=1e4;function kp(e,t){let n=e.hostLabel||e.alias;if(e.state===`online`)return e.version?`${n} · v${e.version}`:n;let r=t[e.state];return e.state===`mismatch`?e.version?`${n} · ⚠ v${e.version} (${r})`:`${n} · ⚠ ${r}`:`${n} · ${r}`}function Ap(e,t,n,r=e){let i=t?.hostLabel&&t.hostLabel!==e?` (${t.hostLabel})`:``,a=n.runsOn.replace(`{host}`,t?`${e}${i}`:r);return!t||t.state===`online`?a:`${a}${kp(t,n).slice((t.hostLabel||t.alias).length)}`}function jp(e,t,n){if(e.kind!==`task`||e.machine===void 0)return null;let r=e.machine;return Ap(r,t.find(e=>e.alias===r),n,e.task.machine?.label)}function Mp({label:e}){return(0,B.jsx)(`span`,{className:gp,title:e,role:`img`,"aria-label":e,children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M4.5 13a3 3 0 0 1-.4-5.97A4.5 4.5 0 0 1 12.8 6.6 3.2 3.2 0 0 1 12.3 13Z`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinejoin:`round`})})})}function Np({host:e,onMachines:t}){return z(),(0,B.jsxs)(`div`,{className:Qn,children:[(0,B.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`machine.filesElsewhere`,{host:e})}),(0,B.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`machine.filesHint`,{host:e})}),(0,B.jsx)(`div`,{children:(0,B.jsx)(V,{hit:`tight`,onClick:t,children:R(`machines.open`)})})]})}function Pp(e){let t=y(e.client.conn),n=y(e.remote),[r,i]=(0,h.useState)(()=>Y(e,`machines.list`)?.machines??[]),a=[...new Set(n.map(e=>`${e.machine?.id}:${e.machine?.stale??!1}`))].join();return(0,h.useEffect)(()=>{if(t.state!==`open`)return;let n=!0,r=()=>X(e,`machines.list`).then(e=>n&&i(e.machines),()=>{});r();let a=ni(Op,r);return()=>{n=!1,a()}},[e.client,t.state,a]),r}function Fp(e){let[t,n]=(0,h.useState)(!1),r=(0,h.useRef)(e.onClose);r.current=e.onClose,(0,h.useEffect)(()=>{t||r.current?.()},[t]);let i=(0,h.useRef)(null),a=(0,h.useRef)(null),o=(0,h.useRef)(null);(0,h.useLayoutEffect)(()=>{let e=o.current;if(!t||!e)return;let n=e.getBoundingClientRect(),r=n.right>window.innerWidth-8?window.innerWidth-8-n.right:n.left<8?8-n.left:0;r&&(e.style.transform=`translateX(${Math.round(r)}px)`)},[t]);let s=()=>{n(!1),a.current?.focus()};return(0,h.useEffect)(()=>{if(!t)return;let e=e=>{i.current?.contains(e.target)||n(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[t]),(0,B.jsxs)(`span`,{ref:i,className:Yf,onKeyDown:e=>{e.key!==`Escape`||!t||(e.preventDefault(),e.stopPropagation(),s())},children:[(0,B.jsx)(`button`,{ref:a,type:`button`,className:Gf(),"data-field":e.field,title:e.title,"aria-haspopup":`menu`,"aria-expanded":t,disabled:e.disabled,onClick:()=>n(e=>!e),children:e.label}),t&&(0,B.jsx)(`div`,{ref:o,className:`absolute bottom-[calc(100%+6px)] left-0 z-20 flex max-h-[min(50vh,420px)] max-w-[min(52ch,calc(100vw-16px))] min-w-[min(34ch,calc(100vw-16px))] flex-col overflow-hidden rounded-md border-hairline border-line-active bg-surface shadow-popover group-last-of-type/chip:right-0 group-last-of-type/chip:left-auto`,children:e.children(s)})]})}function Ip(e){let[t,n]=(0,h.useState)(0),r=[...e.extra?[e.extra]:[],...e.rows,...e.more??[]],i=Math.min(t,Math.max(0,r.length-1)),a=(0,h.useRef)(null);return(0,h.useEffect)(()=>{a.current?.scrollIntoView({block:`nearest`})},[i,e.rows]),(0,B.jsxs)(`div`,{className:Xf,children:[(0,B.jsx)(`input`,{className:sr,autoFocus:!0,spellCheck:!1,placeholder:e.placeholder,value:e.query,onChange:t=>{n(0),e.onQuery(t.target.value)},onKeyDown:t=>{if(!t.nativeEvent.isComposing){if(t.key===`ArrowDown`||t.key===`ArrowUp`)t.preventDefault(),n(Math.max(0,Math.min(r.length-1,i+(t.key===`ArrowDown`?1:-1))));else if(t.key===`Enter`){t.preventDefault();let n=r[i];n&&e.onPick(n.key,t.metaKey||t.ctrlKey)}}}}),(0,B.jsxs)(`div`,{className:Zf,children:[r.length===0&&(0,B.jsx)(`p`,{className:`mx-2 my-1 text-muted`,children:e.empty}),r.map((t,r)=>(0,B.jsxs)(h.Fragment,{children:[e.moreLabel&&t===e.more?.[0]&&(0,B.jsx)(`p`,{className:`mx-2 mt-2 mb-0.5 text-muted`,children:e.moreLabel}),(0,B.jsxs)(`button`,{type:`button`,"aria-current":t.checked===!0,ref:r===i?a:void 0,tabIndex:-1,title:t.title,className:$f({cursor:r===i}),onMouseMove:()=>n(r),onClick:n=>e.onPick(t.key,n.metaKey||n.ctrlKey),children:[(0,B.jsx)(`span`,{className:ep,children:t.checked?`✓`:``}),(0,B.jsx)(`span`,{className:rp,children:t.text}),t.dim&&(0,B.jsx)(`span`,{className:`ml-auto pl-3 text-muted ${t.title?`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`:``}`,children:t.dim})]})]},t.key))]})]})}function Lp(e){return(0,B.jsxs)(`button`,{type:`button`,role:e.multi?`menuitemcheckbox`:`menuitemradio`,"aria-checked":e.checked,tabIndex:-1,disabled:e.option.disabled,className:$f({cursor:e.cursor,dim:e.option.dim}),onMouseMove:e.onHover,onClick:e.onPick,children:[(0,B.jsx)(`span`,{className:ep,children:e.checked?`✓`:``}),(0,B.jsx)(`span`,{children:e.option.label}),!e.checked&&e.digit!==void 0&&!e.option.disabled&&(0,B.jsx)(`span`,{className:`ml-auto pl-3 text-muted`,children:e.digit})]})}function Rp(e){let[t,n]=(0,h.useState)(()=>Math.max(0,e.options.findIndex(t=>t.id===e.value))),r=(0,h.useRef)(null);return(0,h.useEffect)(()=>r.current?.focus(),[]),(0,B.jsxs)(`div`,{ref:r,role:`menu`,tabIndex:-1,className:Xf,onKeyDown:r=>{if(!(r.ctrlKey||r.metaKey||r.altKey||r.nativeEvent.isComposing)){if(r.key===`ArrowDown`||r.key===`ArrowUp`)r.preventDefault(),n(Math.max(0,Math.min(e.options.length-1,t+(r.key===`ArrowDown`?1:-1))));else if(r.key===`Enter`){r.preventDefault();let n=e.options[t];n&&!n.disabled&&e.onPick(n.id)}else if(e.onBack&&(r.key===`Escape`||r.key===`ArrowLeft`))r.preventDefault(),r.stopPropagation(),e.onBack();else{let t=e.digits?Ul(r.key,e.options.length):null,n=t===null?void 0:e.options[t];if(!n||n.disabled)return;r.preventDefault(),e.onPick(n.id)}}},children:[e.onBack?(0,B.jsxs)(`button`,{type:`button`,className:`${Qf} ${H} text-muted`,tabIndex:-1,onClick:e.onBack,children:[`‹ `,e.heading]}):(0,B.jsx)(`p`,{className:`${Qf} ${H} text-muted`,children:e.heading}),e.options.map((r,i)=>(0,B.jsx)(Lp,{option:r,checked:e.values?e.values.includes(r.id):r.id===e.value,multi:e.values!==void 0,cursor:i===t,digit:e.digits&&i<9?i+1:void 0,onHover:()=>n(i),onPick:()=>e.onPick(r.id)},r.id)),e.footer]})}function zp(e){let[t,n]=(0,h.useState)(`root`),r=e.models.length+ +(e.efforts.length>0),[i,a]=(0,h.useState)(()=>Math.max(0,e.models.findIndex(t=>t.id===e.model))),o=(0,h.useRef)(null);if((0,h.useEffect)(()=>{t===`root`&&o.current?.focus()},[t]),t===`effort`)return(0,B.jsx)(Rp,{heading:R(`newSession.effort`),options:e.efforts,value:e.effort,onBack:()=>n(`root`),onPick:t=>{e.onEffort(t),e.close()}});let s=t=>{e.onModel(t),e.close()},c=e.efforts.find(t=>t.id===e.effort)?.label??``;return(0,B.jsxs)(`div`,{ref:o,role:`menu`,tabIndex:-1,className:Xf,onKeyDown:t=>{if(!(t.ctrlKey||t.metaKey||t.altKey||t.nativeEvent.isComposing)){if(t.key===`ArrowDown`||t.key===`ArrowUp`)t.preventDefault(),a(Math.max(0,Math.min(r-1,i+(t.key===`ArrowDown`?1:-1))));else if(t.key===`Enter`||t.key===`ArrowRight`&&i>=e.models.length){t.preventDefault();let r=e.models[i];r?s(r.id):e.efforts.length>0&&n(`effort`)}else{let n=Ul(t.key,e.models.length),r=n===null?void 0:e.models[n];if(!r)return;t.preventDefault(),s(r.id)}}},children:[(0,B.jsx)(`p`,{className:`${Qf} ${H} text-muted`,children:R(`newSession.modelHeading`)}),e.models.map((t,n)=>(0,B.jsx)(Lp,{option:t,checked:t.id===e.model,multi:!1,cursor:n===i,digit:n<9?n+1:void 0,onHover:()=>a(n),onPick:()=>s(t.id)},t.id)),e.efforts.length>0&&(0,B.jsxs)(`button`,{type:`button`,role:`menuitem`,tabIndex:-1,className:`${$f({cursor:i===e.models.length})} mt-1 border-t-hairline border-t-line`,onMouseMove:()=>a(e.models.length),onClick:()=>n(`effort`),children:[(0,B.jsx)(`span`,{className:`flex-[0_0_1.5ch] text-accent`}),(0,B.jsx)(`span`,{children:R(`newSession.effort`)}),(0,B.jsxs)(`span`,{className:`${tp} text-muted`,children:[c,(0,B.jsx)(wo,{right:!0})]})]})]})}function Bp(e){return(0,B.jsxs)(`div`,{className:`${Xf} ${ap}`,children:[(0,B.jsx)(`p`,{className:`${Qf} ${H} text-muted`,children:R(`newSession.branches`)}),(0,B.jsxs)(`label`,{className:ip,children:[(0,B.jsx)(`span`,{className:`text-muted`,children:R(`newSession.branchName`)}),(0,B.jsx)(`input`,{className:sr,autoFocus:!0,spellCheck:!1,placeholder:R(`newSession.branchNamePlaceholder`),value:e.branch,onChange:t=>e.onBranch(t.target.value)})]}),e.repos.map(t=>(0,B.jsxs)(`label`,{className:ip,children:[(0,B.jsxs)(`span`,{children:[t.name,t.primary&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` `,R(`newSession.primary`)]})]}),(0,B.jsx)(`select`,{className:sr,"aria-label":t.name,value:t.base||t.current,onChange:n=>e.onBase(t.path,n.target.value),children:(t.branches.includes(t.base||t.current)?t.branches:[t.base||t.current,...t.branches]).filter(e=>e!==``).map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]},t.path))]})}function Vp(e){return e.id.startsWith(`root:`)?e.primary??e.checkouts[0]??e.id:e.id}function Hp(e,t){if(!e)return null;let n=t.find(t=>t.id===e||t.checkouts.includes(e));return n?{ref:Vp(n),clone:!1}:e.startsWith(`/`)?{ref:e,clone:!1}:null}function Up(e,t,n){let r=t.toLowerCase();return n?e.some(e=>e.toLowerCase()===`github.com/${r}`):e.some(e=>Dl(e).base.toLowerCase()===(r.split(`/`)[1]??``))}function Wp(e,t,n){let r=t.find(t=>t.id===e||t.checkouts.includes(e))?.id??e,i=n.find(e=>e.id===r);return i?{ref:Vp(i),clone:!1}:r.startsWith(`root:`)||r.startsWith(`/`)?null:{ref:r,clone:!0}}function Gp(e,t){let n=new Set(t.filter(e=>e.installed!==!1).map(e=>e.id)),r=new Set(t.length>0?e.filter(e=>!n.has(e.id)).map(e=>e.id):[]),i=new Set(e.map(e=>e.id)),a=t.filter(e=>n.has(e.id)&&!i.has(e.id)).map(e=>({id:e.id,name:e.name??e.id}));return{rows:[...e,...a],missing:r}}function Kp(e){return{repo:e.pick.ref,machine:e.machine,...e.pick.clone?{clone:!0}:{},...e.baseRef?{baseBranch:e.baseRef}:{},...e.prompt?{prompt:e.prompt}:{},...e.engine?{engine:e.engine}:{},...e.engineThere?{engineThere:!0}:{},...!e.engineThere&&e.model?{model:e.model}:{},...!e.engineThere&&e.effort?{effort:e.effort}:{}}}function qp({on:e,...t}){return(0,B.jsx)(`button`,{type:`button`,className:`${Gf(e)} ${Kf}`,"aria-pressed":e,...t})}var Jp={offline:`newSession.remoteOffline`,outdated:`newSession.remoteOutdated`},Yp=`local`,Xp=(e,t)=>X(e,`machines.repos`,{machine:t});function Zp(e,t){let n=t.filter(e=>e.state===`online`).map(e=>e.alias).join(`
21
21
  `);(0,h.useEffect)(()=>{for(let t of n?[Yp,...n.split(`
22
22
  `)]:[])Xp(e,t).catch(()=>{})},[e,n])}function Qp(e,t){let[n,r]=(0,h.useState)(null);return(0,h.useEffect)(()=>{if(!t)return;let n=!1;return X(e,`machines.engines`,{machine:t}).then(e=>!n&&r({machine:t,reply:e})).catch(()=>{}),()=>{n=!0}},[e,t]),t?(n?.machine===t?n.reply:Y(e,`machines.engines`,{machine:t}))?.engines??[]:[]}function $p(e,t,n){let r=Gp(n.engines,Qp(e,t)),i=r.rows.filter(e=>!r.missing.has(e.id)),a=i.some(e=>e.id===n.engine)?n.engine:i[0]?.id??n.engine;return{engines:r.rows,engine:a,setEngine:n.setEngine,missing:t?r.missing:void 0}}function em(e,t,n){let[r,i]=(0,h.useState)(null),a=nm(e,r?.from??``);return(0,h.useEffect)(()=>{!r||!a.loaded||!t.loaded||(t.problem||n(Wp(r.ref,a.repos,t.repos)),i(null))},[r,a,t,n]),(e,t)=>i(e&&t?{from:e,ref:t}:null)}function tm(e,t,n){let r=Pp(e),[i,a]=(0,h.useState)(t.machine??``),o=nm(e,i),[s,c]=(0,h.useState)(!1),l=$p(e,s?i:``,n);Zp(e,r);let[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(``),m=em(e,o,e=>d(t=>t??e));return(0,h.useEffect)(()=>{!i||!o.loaded||i!==t.machine||d(e=>e??Hp(t.repo,o.repos))},[o.loaded]),{machines:r,machine:i,remote:i!==``,machineName:r.find(e=>e.alias===i)?.hostLabel||i,remoteList:o,engineThere:s,toggleEngineThere:()=>c(e=>!e),shown:l,pick:u,setPick:d,base:f,setBase:p,switchTo(e,t){m(e&&(i||`local`),i?u?.ref:t),a(e),d(null),p(``)}}}function nm(e,t){z();let[n,r]=(0,h.useState)(null);if((0,h.useEffect)(()=>{if(!t)return;let n=!1;return Xp(e,t).then(e=>!n&&r({machine:t,reply:e,failed:``})).catch(e=>!n&&r({machine:t,reply:null,failed:String(e)})),()=>{n=!0}},[e,t]),!t)return{repos:[],loaded:!0,problem:``};let i=n?.machine===t?n:void 0,a=Y(e,`machines.repos`,{machine:t});if(!i&&!a)return{repos:[],loaded:!1,problem:``};let o=i?i.reply:a;if(!o)return{repos:[],loaded:!0,problem:R(`newSession.remoteFailed`,{machine:t,message:i?.failed??``})};let s=o.reason?Jp[o.reason]:void 0,c=o.reason?s?R(s,{machine:t}):R(`newSession.remoteFailed`,{machine:t,message:o.message??o.reason}):``;return{repos:o.repos,loaded:!0,problem:c}}function rm(e,t){return t.problem?t.problem:t.loaded?R(`newSession.remoteNone`,{machine:e}):R(`newSession.remoteLoading`,{machine:e})}function im(){return(0,B.jsxs)(`svg`,{className:Wf,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`8`,rx:`1`}),(0,B.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function am(e){let t=(z()===`zh`?bi:yi).machine,n=e.machines.find(t=>t.alias===e.value),r=e.value?n?.hostLabel||e.value:R(`newSession.thisMachine`);return(0,B.jsx)(Fp,{field:`machine`,title:R(`newSession.machine`),label:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(im,{}),r]}),children:n=>(0,B.jsx)(Rp,{heading:R(`newSession.machine`),options:[{id:``,label:R(`newSession.thisMachine`)},...e.machines.map(e=>({id:e.alias,label:kp(e,t),disabled:e.state!==`online`}))],value:e.value,digits:!0,onPick:t=>{e.onPick(t),n()}})})}function om(e){return(0,B.jsx)(qp,{on:e.on,"data-field":`engine-there`,title:R(e.on?`newSession.engineThereOn`:`newSession.engineThereOff`,{machine:e.machine}),onClick:e.onToggle,children:R(`newSession.engineThere`)})}function sm(e){let[t,n]=(0,h.useState)(``),r=t.trim();return(0,B.jsx)(Fp,{field:`branch`,title:R(`newSession.branch`),label:e.value||R(`newSession.branch`),children:i=>(0,B.jsx)(Ip,{placeholder:R(`newSession.branchTypeRef`),empty:``,rows:[{key:``,text:R(`newSession.branchRemoteDefault`),checked:e.value===``}],query:t,onQuery:n,extra:r?{key:r,text:r,checked:e.value===r}:null,onPick:t=>{e.onPick(t),n(``),i()}})})}async function cm(e,t){return(await e.client.request(`task.spawn`,Kp(t))).taskIds[0]}function lm(e){return e instanceof Ed&&e.code===`CLONE_FAILED`?G(`newTask`,`error.cloneFailed`,{error:e.message}):e instanceof Error?e.message:String(e)}function um(e){let[t,n]=(0,h.useState)(``);if(e.ungrouped)return null;if(e.remote)return e.remotePick&&(0,B.jsx)(sm,{value:e.remoteBase,onPick:e.onRemoteBase});let{repos:r,bases:i,inPlace:a}=e,o=r[0]??``,s=e.probes[o]??null,c=i[o]||s?.current||``,l=Ol(s?.branches??[],t).map(e=>({key:e,text:e,checked:e===(i[o]||s?.current)})),u=r.map(t=>({path:t,name:Dl(t).base,primary:t===o,branches:e.probes[t]?.branches??[],current:e.probes[t]?.current??``,base:i[t]??``}));return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(qp,{on:!a,disabled:r.length>1||e.plain,title:e.plain?R(`newSession.worktreeNoGit`):r.length>1?R(`newSession.worktreeMulti`):R(a?`newSession.worktreeOff`:`newSession.worktreeOn`),onClick:e.onToggleWorktree,children:[(0,B.jsx)(cp,{}),R(`newSession.worktree`)]}),r.length>1?(0,B.jsx)(Fp,{field:`branch`,title:R(`newSession.branches`),label:R(`newSession.branches`),children:()=>(0,B.jsx)(Bp,{repos:u,branch:e.branchName,onBranch:e.onBranchName,onBase:e.onBase})}):!a&&s?.ok&&c&&(0,B.jsx)(Fp,{field:`branch`,title:R(`newSession.branch`),label:c,children:r=>(0,B.jsx)(Ip,{placeholder:R(`newSession.branchSearch`),empty:R(`newSession.branchEmpty`),rows:l,query:t,onQuery:n,onPick:t=>{e.onBase(o,t),n(``),r()}})})]})}var dm=`rove.web.newSession.prompt`,fm=`rove.web.newSession.attachments`,pm=sessionStorage.getItem(dm)??``;function mm(){return pm}function hm(e){pm=e;try{sessionStorage.setItem(dm,e)}catch{}}function gm(e,t){let[n,r]=(0,h.useState)(null),i=t&&n!==null,a=i?n:e.engine?[e.engine]:[];return{ids:a,comparing:i,setComparing:e=>r(e?a:null),toggle(t){let n=q(a,t);r(n),n[0]&&n[0]!==e.engine&&e.setEngine(n[0])}}}function _m(e){let{picks:t,choice:n}=e,r=n.engines;if(r.length<2)return null;let i=t.ids.map(e=>r.find(t=>t.id===e)?.name??e);return(0,B.jsx)(Fp,{field:`engine`,title:R(`newSession.engine`),label:J(i)||R(`newSession.engine`),children:i=>(0,B.jsx)(Rp,{heading:R(`newSession.engine`),options:r.map(t=>{if(!e.missing)return{id:t.id,label:t.name,dim:t.ready===!1};let n=e.missing.has(t.id);return{id:t.id,label:n?R(`newSession.engineMissing`,{engine:t.name}):t.name,disabled:n}}),value:n.engine,...t.comparing?{values:t.ids}:{},onPick:e=>{if(t.comparing)return t.toggle(e);n.setEngine(e),i()},footer:e.available&&r.length>1?(0,B.jsx)(V,{className:`mx-2 mt-1 mb-0.5 self-start font-mono`,"data-field":`compare-engines`,hit:`tight`,onClick:()=>t.setComparing(!t.comparing),children:R(t.comparing?`compare.oneEngine`:`compare.severalEngines`)}):null})})}function vm(e){return(0,B.jsx)(Fp,{field:`model`,title:R(`newSession.model`),label:zl(e.models,e.model,e.effort,R(`newSession.modelDefault`)),children:t=>(0,B.jsx)(zp,{...e,close:t})})}var ym=6e4,bm=/^(?:(today|tomorrow|今天|明天)\s*)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/i,xm=/^\+\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?$/i;function Sm(e,t){let n=e.trim(),r=xm.exec(n);if(r&&(r[1]||r[2])){let e=Number(r[1]??0)*60+Number(r[2]??0);return e>0?new Date(t.getTime()+e*ym):null}let i=bm.exec(n);if(!i)return null;let a=i[1]?.toLowerCase(),o=Number(i[2]),s=Number(i[3]??0),c=i[4]?.toLowerCase();if(c){if(o<1||o>12)return null;o=o%12+(c===`pm`?12:0)}if(o>23||s>59)return null;let l=new Date(t.getFullYear(),t.getMonth(),t.getDate(),o,s);if(a===`tomorrow`||a===`明天`)l.setDate(l.getDate()+1);else if(l.getTime()<=t.getTime()){if(a)return null;l.setDate(l.getDate()+1)}return l.getTime()>t.getTime()?l:null}function Cm(e,t=new Date){let n=e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});return e.toDateString()===t.toDateString()?n:`${e.toLocaleDateString([],{weekday:`short`})} ${n}`}function wm(e){let[t,n]=(0,h.useState)(``),r=()=>{let n=Sm(t,new Date);if(!n)return e.onInvalid(R(`newSession.laterBad`));e.onSchedule(n)};return(0,B.jsxs)(`div`,{className:op,children:[(0,B.jsx)(`input`,{className:`${sr} min-w-0 flex-1`,value:t,placeholder:R(`newSession.laterPlaceholder`),"aria-label":R(`newSession.later`),spellCheck:!1,autoComplete:`off`,autoFocus:!0,onChange:e=>n(e.target.value),onKeyDown:t=>{if(t.key===`Escape`)return t.preventDefault(),t.stopPropagation(),e.onBack();t.key!==`Enter`||t.nativeEvent.isComposing||(t.preventDefault(),t.stopPropagation(),r())}}),(0,B.jsx)(V,{variant:`filled`,disabled:!t.trim(),onClick:r,children:R(`newSession.laterConfirm`)})]})}function Tm(e){let[t,n]=(0,h.useState)(`root`);return(0,B.jsx)(Fp,{field:`more`,title:R(`newSession.more`),label:(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`}),onClose:()=>n(`root`),children:r=>t===`later`?(0,B.jsxs)(`div`,{className:Xf,children:[(0,B.jsxs)(`button`,{type:`button`,className:`${Qf} ${H} text-muted`,onClick:()=>n(`root`),children:[`‹ `,R(`newSession.later`)]}),(0,B.jsx)(wm,{onBack:()=>n(`root`),onInvalid:e.onInvalid,onSchedule:t=>{r(),e.onLater?.(t)}})]}):(0,B.jsx)(`div`,{role:`menu`,className:Xf,children:e.onLater&&(0,B.jsx)(Em,{label:R(`newSession.later`),sub:!0,disabled:e.busy,onClick:()=>n(`later`)})})})}function Em(e){return(0,B.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`${$f({cursor:!1})} [&:hover:not(:disabled)]:bg-hover`,disabled:e.disabled,onClick:e.onClick,children:[(0,B.jsx)(`span`,{className:np,children:e.label}),(e.dim!==void 0||e.sub)&&(0,B.jsxs)(`span`,{className:`${tp} text-muted`,children:[e.dim,e.sub&&(0,B.jsx)(wo,{right:!0})]})]})}var Dm=128,Om=80,km=3,Am=2,jm=Dm/2,Mm=Om/2,Nm=25,Pm=(1-1.2/Nm)**2,Fm=1e3/30,Im=7,Lm=0,Rm=1,zm=2,Bm=3,Vm=4,Hm=[``,`--color-subtle`,`--color-muted`,`--color-ink`,`--color-accent`],Um=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5],Wm=Array.from({length:64},(e,t)=>{let n=t%8,r=t>>3;return(4*(Um[(r&3)*4+(n&3)]??0)+([0,2,3,1][(r>>2)*2+(n>>2)]??0)+.5)/64}),Gm=(e,t)=>Wm[(t&7)*8+(e&7)]??1,Km=[{radius:1.55,lift:.3,roll:-.42,speed:.9,phase:.4,ink:Vm},{radius:1.95,lift:.22,roll:.3,speed:-.55,phase:2.6,ink:Bm},{radius:2.4,lift:.36,roll:-.12,speed:.38,phase:4.4,ink:Bm}],qm=1.9,Jm=[[6,9,.3],[22,68,2.1],[37,4,4],[95,7,1.2],[118,20,3.3],[122,62,5.1],[11,40,2.8],[83,75,.9]];function Ym(e,t){e.fill(Lm);let n=(t,n,r)=>{t>=0&&t<Dm&&n>=0&&n<Om&&(e[n*Dm+t]=r)};for(let[e,r,i]of Jm)Math.sin(t*.8+i)>-.5&&n(e,r,Rm);let r=-.55+.25*Math.sin(t*.3),i=-.5,a=.67,o=Math.hypot(r,i,a),s=t*.35,c=Math.sin(s),l=Math.cos(s),u=.4,d=Math.sin(u),f=Math.cos(u);for(let e=0;e<Om;e++)for(let t=0;t<Dm;t++){let s=(t+.5-jm)/Nm,u=(e+.5-Mm)/Nm,p=s*s+u*u;if(p>=1)continue;let m=Math.sqrt(1-p),h=Math.max(0,(s*r+u*i+m*a)/o),g=s*f+u*d,_=u*f-s*d,v=Math.atan2(g*l+m*c,m*l-g*c),y=Math.asin(Math.max(-1,Math.min(1,_))),b=.5+.5*Math.sin(y*9+1.3*Math.sin(v*2+y*3));h**.75*(.4+.6*b)>Gm(t,e)?n(t,e,h>.4?Bm:zm):p>Pm&&n(t,e,Rm)}for(let e of Km){let r=Math.sin(e.roll),i=Math.cos(e.roll),a=t=>{let n=e.radius*Math.cos(t),a=e.radius*Math.sin(t),o=a*e.lift,s=n*i-o*r,c=n*r+o*i,l=s*s+c*c<1;return a<0&&l?null:[Math.floor(jm+s*Nm),Math.floor(Mm+c*Nm),l]},o=Math.round(Math.PI*e.radius*Nm);for(let e=0;e<o;e++){let t=a(e/o*Math.PI*2);t&&!t[2]&&n(t[0],t[1],Rm)}let s=e.phase+t*e.speed,c=.5/(e.radius*Nm),l=-Math.sign(e.speed)*c;for(let e=qm/c;e>=0;e--){let t=a(s+e*l);if(t?.[2])for(let e=-2;e<=2;e++)for(let r=-2;r<=2;r++)n(t[0]+r,t[1]+e,Lm)}for(let t=qm/c;t>0;t--){let r=a(s+t*l),i=1-t*c/qm;r&&i>Gm(r[0],r[1])&&n(r[0],r[1],i>.6?e.ink:zm)}let u=a(s);if(u)for(let t=-1;t<=1;t++)for(let r=-1;r<=1;r++)n(u[0]+r,u[1]+t,e.ink)}}function Xm(e,t){let n=e.getContext(`2d`);if(!n)return;let r=window.devicePixelRatio||1,i=Math.round(384*r);e.width!==i&&(e.width=i,e.height=Math.round(240*r)),n.setTransform(r,0,0,r,0,0),n.clearRect(0,0,384,240);let a=getComputedStyle(e);for(let e=Rm;e<=Vm;e++){n.fillStyle=a.getPropertyValue(Hm[e]??``)||a.color;for(let r=0;r<t.length;r++)t[r]===e&&n.fillRect(r%Dm*km,Math.floor(r/Dm)*km,Am,Am)}}function Zm(){let e=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let t=e.current;if(!t)return;let n=new Uint8Array(10240);if(typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches){Ym(n,Im),Xm(t,n);return}let r=0,i=0,a=e=>{r=requestAnimationFrame(a),!(e-i<Fm)&&(i=e,Ym(n,e/1e3),Xm(t,n))};return r=requestAnimationFrame(a),()=>cancelAnimationFrame(r)},[]),(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`mb-3 max-w-full`,children:(0,B.jsx)(`canvas`,{ref:e,width:384,height:240,"data-plate":`rove`,className:`h-auto w-96 max-w-full text-muted`})})}var Qm=`clone:`;function $m(e){let{model:t,saved:n,picked:r,primary:i,home:a,query:o,remote:s}=e,[c,l]=(0,h.useState)(()=>Y(t,`github.repos`)??null);(0,h.useEffect)(()=>{let e=!1;return X(t,`github.repos`).then(t=>!e&&l(t)).catch(()=>!e&&l({repos:[],reason:`failed`})),()=>{e=!0}},[t]);let u=o.trim(),d=Ol(n,o),f=R(`newSession.noFolder`),p=e.ungrouped&&(!u||f.toLowerCase().includes(u.toLowerCase()))?[{key:Pu,text:f,checked:e.ungrouped.on}]:[],m=d.map(e=>{let{base:t,dir:n}=Dl(e);return{key:e,text:t,dim:e===i&&r.length>1?`${R(`newSession.primary`)}, ${n}`:n,checked:r.includes(e)}}),g=Pl(u),_=g&&(g.includes(`:`)||d.length===0)?g:null,v=!_&&kl(u)&&!n.includes(u)&&(!s||u.startsWith(`/`))?jl(Al(u,a)):``,y=_?{key:Qm+_,text:s?R(`newSession.cloneRowOn`,{source:_,machine:s.name}):R(`newSession.cloneRow`,{source:_})}:v?{key:v,text:v,checked:r.includes(v)}:null,b=u.toLowerCase(),x=(c?.repos??[]).filter(e=>e.nameWithOwner.toLowerCase().includes(b)).filter(e=>!Up(n,e.nameWithOwner,s!==void 0)).map(e=>({key:Qm+e.nameWithOwner,text:e.nameWithOwner,dim:e.description,title:e.description}));return(0,B.jsx)(Ip,{placeholder:R(s?`newSession.repoSearchRemote`:`newSession.repoSearch`),empty:s?.empty??R(`newSession.repoEmpty`),rows:s?.blocked?[]:[...p,...m],query:o,onQuery:e.onQuery,extra:s?.blocked?null:y,more:s?.blocked?[]:x,moreLabel:R(`newSession.githubGroup`),onPick:(t,n)=>{if(t===`~scratch`)return e.ungrouped?.pick(),e.close();if(!t.startsWith(`clone:`))return e.onToggle(t,n);e.onClone(t.slice(6)),e.close()}})}function eh(e,t){let n=e.scratch||e.noProject,r=n?[]:t.extraRepos??[];return{...n?{ungrouped:!0}:{repo:t.repo},...t.baseRef?{baseBranch:t.baseRef}:{},...r.length>0?{extras:r}:{},...e.machine?{machine:e.machine.id}:{},prompt:t.prompt,...t.engine?{engine:t.engine}:{},worktree:e.kind===`task`,retryOf:{id:e.id,label:e.label}}}function th(e,t){return e?[e,...(t.extras??[]).map(e=>e.repo)]:[]}function nh(e,t){return e?{...t.baseBranch?{[e]:t.baseBranch}:{},...Object.fromEntries((t.extras??[]).flatMap(e=>e.baseRef?[[e.repo,e.baseRef]]:[]))}:{}}function rh(e){return[e.machine??``,e.repo??``,e.ungrouped?`u`:``,e.retryOf?.id??``,e.baseBranch??``,e.worktree===void 0?``:String(e.worktree)].join(`\0`)}function ih(e,t){return e.retryOf&&e.engine&&e.engine===t?e.retryOf.id:void 0}async function ah(e,t){try{let{task:n}=await e.client.request(`task.get`,{taskId:t.id});if(!n.prompt)return void F(R(`menu.retryNoPrompt`),`error`);P(eh(t,{...n,prompt:n.prompt}))}catch(e){F(U(e),`error`)}}function oh(e,t){let n=async n=>{await e.act(`task.archive`,{taskId:t.id,archived:!0,...n?{force:n}:{}}),F(G(`tasks`,`archive.done`,{title:t.label}))};C.set((0,B.jsx)($r,{title:R(`newSession.retryArchiveTitle`,{title:t.label}),body:R(`newSession.retryArchiveBody`),confirmLabel:G(`tasks`,`menu.archive`),onConfirm:()=>n(!1),escalate:{when:e=>e instanceof Ed&&e.code===`TASK_BUSY`,label:G(`tasks`,`archive.busyConfirm`),title:G(`tasks`,`archive.busyTitle`),body:()=>G(`tasks`,`archive.busyBody`,{title:t.label}),run:()=>n(!0)}}))}var sh=v([]),ch=()=>y(sh);async function lh(e){sh.set((await e.request(`snippets.get`)).snippets)}async function uh(e,t){sh.set((await e.request(`snippets.save`,{name:t.name,text:t.text})).snippets)}async function dh(e,t){sh.set((await e.request(`snippets.remove`,{name:t})).snippets)}var fh=/^[A-Za-z0-9][\w-]{0,31}$/;function ph(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]??``);)n--;if(n===0||e[n-1]!==`@`)return null;let r=e[n-2];if(r!==void 0&&!/\s/.test(r))return null;let i=t;for(;i<e.length&&/[\w-]/.test(e[i]??``);)i++;return{start:n-1,end:i,query:e.slice(n,t)}}function mh(e,t){let n=t.toLowerCase(),r=e.filter(e=>e.name.toLowerCase().startsWith(n));return[...r.filter(e=>e.name.toLowerCase()===n),...r.filter(e=>e.name.toLowerCase()!==n)]}function hh(e,t,n){return{text:e.slice(0,t.start)+n.text+e.slice(t.end),caret:t.start+n.text.length}}var gh=e=>e.split(`
@@ -39,7 +39,7 @@ This worktree is at the PR's head ({head}, going into {base}). Read the change a
39
39
  `).slice(-10).join(`
40
40
  `)}`},e.label))]})}var VO=30;function HO(e,t,n){let r=t.join(`\0`),[i,a]=(0,h.useState)(()=>Object.fromEntries(t.map(t=>[t,Y(e,`routine.runs`,{id:t})?.runs??[]])));return(0,h.useEffect)(()=>{let n=!0;for(let r of t)X(e,`routine.runs`,{id:r}).then(e=>n&&a(t=>({...t,[r]:e.runs}))).catch(()=>void 0);return()=>{n=!1}},[e,r,n]),i}function UO(e){z();let{auto:t}=iT(),[n,r]=(0,h.useState)(null),i=AO(e.runs,n),a=e=>{if(e.status===`skipped_blocked`){let t=e.blocked?.reason;return t?$(R(`runLog.blockedRun`),{reason:R(`runLog.blocked.${t}`)}):R(`runLog.outcome.blocked`)}return t.runStatus[e.status]??e.status},o=(e,t,n,r)=>(0,B.jsx)(V,{variant:`pill`,hit:`tight`,"aria-current":t,className:`max-w-40 truncate`,onClick:n,children:`[ ${e} ]`},r);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:`${H} text-muted`,children:R(`runLog.title`)}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[o(R(`runLog.all`),n===null,()=>r(null),`all`),TO.map(e=>o(R(`runLog.outcome.${e}`),n===e,()=>r(e),e))]}),i.length===0?(0,B.jsx)(`p`,{className:`text-muted`,children:e.runs.length===0?t.noRuns:R(`runLog.empty`)}):i.slice(0,VO).map(n=>{let r=RO(n.status),i=uD(n,e.now),o=i===`awaiting`?`, ${t.responseAwaiting}`:i===`missing`?`, ${t.responseMissing}`:``,s=OO(n),c=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:LO[r]}),(0,B.jsx)(`span`,{children:`#${n.runNumber}`}),(0,B.jsx)(`span`,{className:fO,children:`${a(n)}${n.tabId?`, ${n.tabId}`:``}${o}`}),(0,B.jsx)(`span`,{className:`text-subtle`,children:R(`runLog.source.${DO[n.trigger]}`)}),s!==null&&(0,B.jsx)(`span`,{className:`text-muted`,children:kO(s)}),(0,B.jsx)(`span`,{className:`text-muted`,children:e.when(n.at)})]}),l=n.error?NO(n.error):null,u=n.taskId,d=i===`missing`?`text-warning`:IO[r];return(0,B.jsxs)(`div`,{className:`${cO} ${d}`,children:[u?(0,B.jsx)(`button`,{type:`button`,className:`mono ${dO}`,onClick:()=>e.openRun(u),children:c}):(0,B.jsx)(`span`,{className:`mono ${uO}`,children:c}),l&&(0,B.jsxs)(`details`,{className:`mono pl-[calc(2ch+16px)] [&_summary]:cursor-pointer [&_summary]:list-none [&_summary]:truncate [&_summary::-webkit-details-marker]:hidden [&[open]_summary]:whitespace-normal [&_pre]:mx-0 [&_pre]:mt-1 [&_pre]:mb-1.5 [&_pre]:max-h-[16lh] [&_pre]:overflow-auto [&_pre]:rounded-sm [&_pre]:bg-inset [&_pre]:px-2 [&_pre]:py-1.5 [&_pre]:whitespace-pre-wrap [&_pre]:wrap-anywhere [&_pre]:text-muted`,children:[(0,B.jsx)(`summary`,{children:l.summary}),(0,B.jsx)(`pre`,{children:l.full})]})]},n.id)}),i.length>VO&&(0,B.jsx)(`p`,{className:`text-muted`,children:R(`runLog.more`,{count:i.length-VO})})]})}function WO(e){let{auto:t}=iT(),n=aT(),r=z()===`zh`?`zh-CN`:`en-US`,{routine:i,busy:a,when:o}=e,s=VD(i.schedule,n),c=i.nextRunAt?Date.parse(i.nextRunAt):NaN;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:iO,children:[(0,B.jsx)(`h2`,{className:aO,children:i.name}),(0,B.jsxs)(`span`,{className:`mono ${By}`,children:[(0,B.jsx)(`button`,{type:`button`,className:`${ar} ${Vy.row}`,disabled:a,onClick:e.onRunNow,children:t.runNow}),(0,B.jsx)(`button`,{type:`button`,className:`${ar} ${Vy.row}`,disabled:a,onClick:e.onToggle,children:R(i.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,B.jsx)(`button`,{type:`button`,className:`${ar} ${Vy.row}`,disabled:a,onClick:e.onDelete,children:R(`pages.delete`)})]})]}),(0,B.jsxs)(`dl`,{className:oO,children:[(0,B.jsx)(`dt`,{className:`text-muted`,children:R(`pages.routineSchedule`)}),(0,B.jsxs)(`dd`,{children:[s??(0,B.jsx)(`span`,{className:`mono`,children:i.schedule}),s&&(0,B.jsx)(`span`,{className:`mono text-muted`,children:` ${i.schedule}`})]}),(0,B.jsx)(`dt`,{className:`text-muted`,children:R(`pages.routineNext`)}),(0,B.jsx)(`dd`,{className:i.enabled?``:`text-warning`,children:i.enabled?Number.isFinite(c)?`${o(i.nextRunAt)} · ${new Date(c).toLocaleString(r,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}`:`—`:t.paused}),(0,B.jsx)(`dt`,{className:`text-muted`,children:R(`pages.routineProject`)}),(0,B.jsx)(`dd`,{children:e.project}),!i.script&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:`text-muted`,children:R(`pages.routineDelivers`)}),(0,B.jsx)(`dd`,{children:i.target?$(t.targetExisting,{task:e.targetTitle??i.target.taskId,tab:i.target.tabId}):i.persistentSession?i.newConversation?t.targetStandingNew:t.targetStanding:t.targetFresh})]}),e.engine&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:`text-muted`,children:R(`pages.routineEngine`)}),(0,B.jsxs)(`dd`,{className:`flex flex-wrap items-baseline gap-x-3.5`,children:[(0,B.jsx)(`span`,{children:e.engine}),(0,B.jsx)(V,{className:`font-mono`,hit:`tight`,disabled:a,onClick:e.onChangeEngine,children:R(`pages.routineChangeEngine`)})]})]})]}),i.precheck&&(0,B.jsx)(`p`,{className:`mono text-muted`,children:$(t.precheck,{command:i.precheck.command})}),i.script?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:`${H} text-muted`,children:R(`pages.routineScript`)}),(0,B.jsx)(`p`,{className:`mono ${sO}`,children:i.script.command})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:`${H} text-muted`,children:R(`pages.routinePrompt`)}),(0,B.jsx)(`p`,{className:sO,children:i.prompt})]}),(0,B.jsx)(UO,{runs:e.runs,now:e.now,when:o,openRun:e.openRun}),(0,B.jsx)(zO,{runs:e.runs,when:o})]})}var GO=5e3;function KO({model:e}){let{auto:t,common:n}=iT(),r=e.client,[i,a]=fT(GO),o=y(e.tasks),s=uT(e),c=dT(e),[l,u]=(0,h.useState)(()=>Y(r,`routine.list`)??null),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),[g,_]=(0,h.useState)(null),v=hT(),b=aT(),x=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0;return X(r,`routine.list`).then(t=>e&&u(t)).catch(()=>e&&u(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[r,i]);let[S,w]=(0,h.useState)(()=>Y(r,`engines.list`)?.engines??[]);(0,h.useEffect)(()=>{let e=!0;return X(r,`engines.list`).then(t=>e&&w(t.engines)).catch(()=>{}),()=>{e=!1}},[r]);let T=l?.automations??[],E=l?.lastRunStatus??{},D=l?.lastFailure??{},ee=e=>{let t=E[e.id];return t!==void 0&&lD(t)},te=[{key:`pages.routinesNeedYou`,rows:T.filter(ee)},{key:`pages.routinesActive`,rows:T.filter(e=>e.enabled&&!ee(e))},{key:`pages.routinesPaused`,rows:T.filter(e=>!e.enabled&&!ee(e))}],A=te.flatMap(e=>e.rows),ne=Math.max(0,A.findIndex(e=>e.id===d)),j=A[ne],M=e=>f(A[e]?.id??null),N=te[0]?.rows.length??0,P=y(k);(0,h.useEffect)(()=>{P===null||!l||(l.automations.some(e=>e.id===P)&&f(P),k.set(null))},[P,l]);let re=HO(r,j?[j.id]:[],i),ie=j?re[j.id]??[]:[];(0,h.useEffect)(()=>_(null),[j?.id]);let ae=(0,h.useRef)(null),[oe,I]=(0,h.useState)(0),se=(0,h.useRef)(0);(0,h.useEffect)(()=>{let e=x.current,t=oe!==se.current;if(se.current=oe,t&&e&&ae.current&&e.offsetTop>ae.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}ae.current?.querySelector(`[data-row="${ne}"]`)?.scrollIntoView({block:`nearest`})},[ne,oe]);let L=Date.now(),ce=e=>{let n=e?Date.parse(e):NaN;if(!Number.isFinite(n))return`—`;let r=n-L,i=r>=0,a=Math.floor(Math.abs(r)/6e4),o=Math.floor(a/60);return a<1?i?t.when.now:t.when.justNow:a<60?$(i?t.when.inMinutes:t.when.minutesAgo,{n:a}):o<24?$(i?t.when.inHours:t.when.hoursAgo,{n:o}):new Date(n).toLocaleDateString()},le=e=>o?.tasks.find(t=>t.id===e)?.label??e,ue=t=>{O.set(null),e.select(t)},de=(e,t,n)=>F($(e,{name:t,error:oT(n)}),`error`),fe=async()=>{if(!(!j||p)){m(j.id);try{await r.request(`routine.setEnabled`,{id:j.id,enabled:!j.enabled}),a()}catch(e){de(j.enabled?t.disableFailed:t.enableFailed,j.name,e)}finally{m(null)}}},pe=async()=>{if(!(!j||p)){m(j.id),_($(t.running,{name:j.name}));try{let e=await r.request(`routine.runNow`,{id:j.id});_($(t.ranWith,{name:j.name,status:e.status})),a()}catch(e){de(t.runFailed,j.name,e)}finally{m(null)}}},me=async()=>{if(p)return;let e=lT(await r.request(`repos.list`).then(e=>e.repos).catch(()=>[]),s);C.set((0,B.jsx)(wO,{repos:e,tasks:(o?.tasks??[]).filter(e=>!e.deleting).map(e=>({id:e.id,title:e.label,repo:e.repo})),defaultRepo:c,onSubmit:e=>{(async()=>{m(`new`);try{await r.request(`routine.create`,{...e.repo===null?{}:{repo:e.repo},name:e.name,prompt:e.prompt,schedule:e.schedule,...e.target?{targetTask:e.target.taskId,targetTab:e.target.tabId}:{}}),a()}catch(e){F($(t.createFailed,{error:oT(e)}),`error`)}finally{m(null)}})()}}))},he=()=>{if(!j||p)return;let e=j;C.set((0,B.jsx)($r,{title:t.deleteTitle,body:$(t.deleteBody,{name:e.name}),confirmLabel:t.deleteButton,onConfirm:async()=>{m(e.id);try{await r.request(`routine.delete`,{id:e.id}),a()}catch(n){de(t.deleteFailed,e.name,n)}finally{m(null)}}}))};mT(e=>{if(e.ctrlKey)return e.key===`c`&&(O.set(null),!0);switch(e.key){case`Escape`:case`q`:return O.set(null),!0;case`j`:case`ArrowDown`:return M(Math.min(A.length-1,ne+1)),!0;case`k`:case`ArrowUp`:return M(Math.max(0,ne-1)),!0;case`n`:return me(),!0;case`r`:return a(),!0;case`e`:return fe(),!0;case`s`:return pe(),!0;case`d`:return he(),!0;case`Enter`:{let e=ie[0]?.taskId;return e?ue(e):ie.length>0&&_(t.latestRunNoTask),!0}default:return!1}});let ge=e=>cD(e,e=>S.find(t=>t.id===e)?.name??e,t.engineDefault),_e=()=>{if(!j)return;let n=j;C.set((0,B.jsx)(qD,{model:e,current:async()=>({engine:n.vendor,effort:n.modelEffort,model:n.model}),onSet:async e=>{let i=await r.request(`routine.setEngine`,{id:n.id,engine:e.engine.id,model:e.model??``,effort:e.effort??``});_($(i.releasedSessionTaskId?t.engineChangedNewSession:t.engineChanged,{name:n.name,engine:[e.engine.name,e.model,e.effort].filter(Boolean).join(` · `)})),a()}}))},ve=e=>e===void 0?R(`rail.noProject`):cT(e,T.flatMap(e=>e.repo??[]));return(0,B.jsxs)(`div`,{className:`${Fy} ${JD}`,tabIndex:0,ref:v,children:[(0,B.jsxs)(`div`,{className:Ry,children:[(0,B.jsx)(`h1`,{className:Ly,children:t.title}),(0,B.jsxs)(`span`,{className:`mono ${By}`,children:[N>0&&(0,B.jsx)(`span`,{className:`text-error`,children:$(t.needAttention,{count:String(N),total:String(A.length)})}),(0,B.jsx)(`span`,{className:`text-muted`,children:l?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,B.jsx)(`button`,{type:`button`,className:`${ar} ${Vy.header}`,onClick:()=>void me(),children:R(`pages.new`)})]})]}),(0,B.jsx)(bO,{client:r,tick:i,reload:a}),l===null?(0,B.jsx)(`p`,{className:`text-muted`,children:n.loading}):A.length===0?(0,B.jsxs)(`div`,{className:Hy,children:[(0,B.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,B.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):(0,B.jsxs)(`div`,{className:YD,children:[(0,B.jsx)(`div`,{className:XD,ref:ae,children:te.map(e=>e.rows.length===0?null:(0,B.jsxs)(`section`,{children:[(0,B.jsxs)(`h2`,{className:`${H} ${ZD} ${e===te[0]?`text-error`:`text-muted`}`,children:[R(e.key),` `,(0,B.jsx)(`span`,{className:`mono`,children:e.rows.length})]}),e.rows.map(e=>{let n=A.indexOf(e),r=E[e.id],i=r?RO(r):null;return(0,B.jsxs)(`div`,{"data-row":n,className:QD(n===ne),onClick:()=>{M(n),I(e=>e+1)},children:[(0,B.jsxs)(`span`,{className:$D,children:[(0,B.jsx)(`span`,{className:eO(!e.enabled),children:e.name}),(0,B.jsx)(`span`,{className:`mono text-muted ${tO}`,children:e.enabled?ce(e.nextRunAt):t.paused}),(0,B.jsx)(`span`,{className:`mono ${i?IO[i]:`text-muted`}`,style:{width:`1ch`},children:i?LO[i]:` `})]}),(0,B.jsx)(`span`,{className:`mono text-muted ${nO}`,title:e.schedule,children:[ve(e.repo),VD(e.schedule,b)??e.schedule,ge(e)?.short].filter(Boolean).join(` · `)}),D[e.id]?(0,B.jsx)(`span`,{className:`mono text-warning ${nO}`,title:D[e.id]?.reason,children:$(t.lastFailed,{when:ce(D[e.id]?.at),reason:D[e.id]?.reason??``})}):null]},e.id)})]},e.key))}),(0,B.jsx)(`div`,{className:rO,ref:x,children:j?(0,B.jsx)(WO,{routine:j,runs:ie,busy:p===j.id,project:ve(j.repo),engine:ge(j)?.full??null,targetTitle:j.target?le(j.target.taskId):void 0,now:L,when:ce,openRun:ue,onRunNow:()=>void pe(),onToggle:()=>void fe(),onDelete:he,onChangeEngine:_e}):(0,B.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),g&&(0,B.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:g})]})}var qO=`flex min-w-0 items-baseline gap-2.5 font-mono text-meta whitespace-nowrap`,JO=`${qO} w-full cursor-pointer border-none bg-transparent p-0 text-left text-inherit [font:inherit] [&:hover]:underline`,YO=`w-[5ch] flex-none text-muted`,XO=`w-[16ch] flex-none overflow-hidden text-accent`,ZO=`mt-3.5 mb-0.5`,QO=`min-w-0 flex-1 truncate`,$O=`flex-none text-right text-muted`,ek=`${$O} min-w-[5ch]`,tk=`${$O} min-w-[4ch]`,nk=`${$O} min-w-[5ch]`,rk=`w-[8ch] flex-none overflow-hidden text-accent`,ik=`flex flex-wrap gap-x-3 font-mono text-meta text-muted`,ak=`m-0 text-meta text-muted`,ok={turns:0,tokens:0,ms:0},sk=e=>(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0),ck=e=>Math.max(0,e.endedAt-e.startedAt),lk=(e,t)=>({turns:e.turns+1,tokens:e.tokens+sk(t),ms:e.ms+ck(t)});function uk(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function dk(e,t,n,r){let i=[];for(let e=n-1;e>=0;e--){let n=new Date(t);n.setDate(n.getDate()-e),i.push(uk(n.getTime()))}let a=new Map(i.map(e=>[e,{sum:ok,byEngine:{}}]));for(let t of e){let e=a.get(uk(t.startedAt));if(!e)continue;let n=t.vendor??`unknown`;e.sum=lk(e.sum,t),e.byEngine[n]=(e.byEngine[n]??0)+sk(t)}let o=e.reduce((e,t)=>Math.min(e,t.startedAt),1/0),s=e.length>=r&&Number.isFinite(o)?{count:e.length,day:uk(o)}:null;return{cutoff:s,days:i.map(e=>{let t=a.get(e);return{day:e,...t?.sum??ok,byEngine:t?.byEngine??{},partial:s!==null&&e<=s.day}})}}function fk(e){let t=new Map;for(let n of e){let e=n.vendor??`unknown`,r=n.model??`unknown`,i=`${e}\0${r}`;t.set(i,{engine:e,model:r,...lk(t.get(i)??ok,n)})}return[...t.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns)}function pk(e,t){let n=new Map;for(let t of e)n.set(t.taskId,{taskId:t.taskId,...lk(n.get(t.taskId)??ok,t)});return[...n.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns).slice(0,t)}function mk(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4)).replace(/\.0$/,``)}k`:`${(e/1e6).toFixed(+(e<1e7)).replace(/\.0$/,``)}M`}var hk=[``,`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`];function gk(e,t,n){if(e<=0||t<=0)return``;let r=Math.max(1,Math.round(e/t*n*8));return`${`█`.repeat(Math.floor(r/8))}${hk[r%8]}`}var _k=[`█`,`▓`,`▒`,`░`];function vk(e,t,n,r){return n<=0?``:t.map((t,i)=>{let a=e[t]??0,o=a<=0?0:Math.max(1,Math.round(a/n*r));return(_k[i%_k.length]??`█`).repeat(o)}).join(``)}var yk=.1,bk=/^(\d+)\s*(h|d)$/;function xk(e,t){let n=bk.exec(e.label.trim());if(!n||e.resetsAt===null||e.percent<=0)return null;let r=Number(n[1])*(n[2]===`d`?24:1)*36e5,i=r-(e.resetsAt-t);if(!(i>=r*yk)||i>r)return null;if(e.percent>=100)return{kind:`full`,at:t};let a=t+(100-e.percent)/e.percent*i;return a<e.resetsAt?{kind:`full`,at:a}:{kind:`lasts`}}var Sk=14,Ck=500,wk=3e4,Tk=16,Ek=8,Dk=8;function Ok(e,t,n,r){let i=Y(e,t,n),[a,o]=(0,h.useState)(i?{kind:`ready`,value:i}:{kind:`loading`}),s=JSON.stringify(n);return(0,h.useEffect)(()=>{let r=!0;return X(e,t,n).then(e=>r&&o({kind:`ready`,value:e})).catch(e=>r&&o(t=>t.kind===`ready`?t:{kind:`failed`,error:oT(e)})),()=>{r=!1}},[e,t,s,r]),a}var kk=e=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`${ek}`,children:mk(e.tokens)}),(0,B.jsx)(`span`,{className:`${tk}`,children:`${e.turns}t`}),(0,B.jsx)(`span`,{className:`${nk}`,children:kO(e.ms)})]});function Ak({usage:e,nameOf:t}){let n=Date.now(),r=e.flatMap(e=>e.windows.map(r=>{let i={engine:e.name||t(e.vendor),label:r.label,percent:Math.round(r.percent)},a=xk(r,n);if(a?.kind===`full`){let t=a.at-n<72e6,o=new Date(a.at).toLocaleString([],{...t?{}:{weekday:`short`},hour:`2-digit`,minute:`2-digit`});return{key:`${e.vendor}:${r.kind}`,text:$(R(`usage.full`),{...i,time:o})}}return{key:`${e.vendor}:${r.kind}`,text:$(R(a?`usage.lasts`:`usage.window`),i)}}));return r.length===0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:`${H} text-muted ${ZO}`,children:R(`usage.quota`)}),r.map(e=>(0,B.jsx)(`p`,{className:`mono ${ak}`,children:e.text},e.key))]})}function jk({row:e,title:t,open:n}){let r=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:QO,children:t}),kk(e)]});return n?(0,B.jsx)(V,{variant:`row`,className:JO,onClick:n,children:r}):(0,B.jsx)(`div`,{className:qO,children:r})}function Mk({model:e}){z();let t=hT(),[n]=fT(wk),r=Ok(e,`turns.list`,{sinceDays:Sk,limit:Ck},n),i=Ok(e,`engines.list`,{},n),a=Ok(e,`usage.get`,{},n),o=y(e.tasks),s=i.kind===`ready`?i.value.engines:[],c=e=>s.find(t=>t.id===e)?.name??e,l=e=>o?.tasks.find(t=>t.id===e)?.label??R(`usage.removedTask`);return(0,B.jsxs)(`div`,{className:Iy,tabIndex:0,ref:t,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),O.set(null))},children:[(0,B.jsx)(`h1`,{className:Ly,children:R(`usage.title`)}),(()=>{if(r.kind===`loading`)return(0,B.jsx)(`p`,{className:`text-muted`,children:R(`usage.loading`)});if(r.kind===`failed`)return(0,B.jsx)(`p`,{className:`text-error`,children:$(R(`usage.failed`),{error:r.error})});let t=r.value.turns,n=new Set(r.value.readers??[]),i=dk(t,Date.now(),Sk,Ck),s=new Map;for(let e of i.days)for(let[t,n]of Object.entries(e.byEngine))s.set(t,(s.get(t)??0)+n);let u=[...s].sort((e,t)=>t[1]-e[1]).map(([e])=>e),d=Math.max(0,...i.days.map(e=>e.tokens)),f=fk(t),p=Math.max(0,...f.map(e=>e.tokens)),m=[...new Set((o?.tasks??[]).flatMap(e=>e.engine?.id&&!n.has(e.engine.id)?[e.engine.id]:[]))];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:ak,children:$(R(`usage.range`),{days:Sk})}),t.length===0?(0,B.jsx)(`p`,{className:`text-muted`,children:R(`usage.empty`)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:`${H} text-muted ${ZO}`,children:R(`usage.perDay`)}),(0,B.jsx)(`div`,{className:ik,children:u.map((e,t)=>(0,B.jsx)(`span`,{children:`${_k[t%_k.length]} ${c(e)}`},e))}),i.days.map(e=>(0,B.jsxs)(`div`,{className:qO,children:[(0,B.jsx)(`span`,{className:YO,children:`${e.day.slice(5)}${e.partial?`~`:``}`}),(0,B.jsx)(`span`,{className:XO,children:vk(e.byEngine,u,d,Tk)}),kk(e)]},e.day)),i.cutoff&&(0,B.jsx)(`p`,{className:`m-0 text-meta text-muted`,children:$(R(`usage.cutoff`),{count:i.cutoff.count,day:i.cutoff.day.slice(5)})}),(0,B.jsx)(`h2`,{className:`${H} text-muted ${ZO}`,children:R(`usage.byModel`)}),f.map(e=>(0,B.jsxs)(`div`,{className:qO,children:[(0,B.jsx)(`span`,{className:QO,title:`${c(e.engine)} · ${e.model}`,children:`${c(e.engine)} · ${e.model}`}),(0,B.jsx)(`span`,{className:rk,children:gk(e.tokens,p,Ek)}),kk(e)]},`${e.engine}\0${e.model}`)),(0,B.jsx)(`h2`,{className:`${H} text-muted ${ZO}`,children:R(`usage.topTasks`)}),pk(t,Dk).map(t=>(0,B.jsx)(jk,{row:t,title:l(t.taskId),open:o?.tasks.some(e=>e.id===t.taskId)?()=>{O.set(null),e.select(t.taskId)}:null},t.taskId))]}),m.length>0&&(0,B.jsx)(`p`,{className:`m-0 text-meta text-muted`,children:$(R(`usage.noReader`),{engines:m.map(c).join(`, `)})}),a.kind===`ready`&&a.value.usage&&(0,B.jsx)(Ak,{usage:a.value.usage,nameOf:c})]})})()]})}var Nk={id:`mods`,label:`mods`},Pk=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`}];function Fk({model:e}){let{nav:t}=iT(),n=y(O),r=y(e.mods).length>0,i=y(e.installedMods),a=[...Pk.filter(e=>!e.mod||i.has(e.mod)),...r?[Nk]:[]];return(0,B.jsxs)(`div`,{className:Jy,children:[(0,B.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${Zy(!1)}`,onClick:()=>gg(),children:[R(`rail.newTask`),(0,B.jsx)(`span`,{className:Qy,"aria-hidden":`true`,children:`+`})]}),a.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`rail-nav-row ${Zy(n===e.id)}`,"aria-current":n===e.id?`page`:void 0,onClick:()=>ge(e.id),children:t[e.label]},e.id))]})}function Ik({model:e,page:t}){(0,h.useEffect)(()=>e.selection.subscribe(()=>O.set(null)),[e]);let n=y(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,B.jsx)(WE,{model:e}):t===`routines`?(0,B.jsx)(KO,{model:e}):t===`issues`&&n.has(`issues`)?(0,B.jsx)(UT,{model:e}):t===`mods`?(0,B.jsx)(sD,{model:e}):t===`compare`?(0,B.jsx)(jT,{model:e}):t===`usage`?(0,B.jsx)(Mk,{model:e}):null}var Lk=f();function Rk(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var zk=e=>e.charAt(0).toUpperCase()+e.slice(1);function Bk(e){return[R(`rail.pr.state.${e.state}`),...e.checks?[R(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function Vk(e){let t=new Map;for(let n of e){let e=Qb(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=$b(e);return t?[{pr:e,mark:t}]:[]})];for(let{pr:e,mark:i}of r){let r=e.url??(e.number===void 0?n.id:`${n.repo}#${e.number}`),a=t.get(r),o=e.lifecycle===`unknown`,s=a?.pr.lifecycle===`unknown`;(!a||s&&!o||o===s&&ex([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}function Hk({tasks:e,onOpen:t}){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(!1),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=(0,h.useRef)(null),l=Sl();(0,h.useLayoutEffect)(()=>{let e=c.current;if(!e||!n)return;let t=e.getBoundingClientRect();t.right>window.innerWidth-8&&(e.style.left=`${Math.max(8,window.innerWidth-t.width-8)}px`,e.style.top=`${n.bottom+6}px`);let r=e.getBoundingClientRect().bottom-(window.innerHeight-8);r>0&&(e.style.top=`${Math.max(8,e.getBoundingClientRect().top-r)}px`)},[n]);let u=()=>{t?.(),s.current!==null&&window.clearTimeout(s.current),s.current=null,a(!1),o.current&&!n&&r(o.current.getBoundingClientRect())},d=()=>{a(!0),s.current=window.setTimeout(()=>r(null),140)};(0,h.useEffect)(()=>{if(!l||!n)return;let e=e=>{let t=e.target;o.current?.contains(t)||c.current?.contains(t)||(a(!0),s.current=window.setTimeout(()=>r(null),140))};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[l,n]),(0,h.useEffect)(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]);let f=Vk(e),p=ex(f.map(e=>e.mark));if(!p)return null;let m=f.length===1?`PR #${f[0]?.pr.number??``}, ${Bk(p)}`:R(`rail.pr.many`,{count:f.length});return(0,B.jsxs)(`span`,{ref:o,className:`chip ${mp} ${p.tone}`,"aria-label":m,onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>{l&&(e.stopPropagation(),n&&!i?d():u())},children:[p.glyph,f.length>1&&(0,B.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,Lk.createPortal)((0,B.jsx)(`div`,{ref:c,className:hp(i),style:{top:n.top-6,left:n.right+8},onMouseEnter:l?void 0:u,onMouseLeave:l?void 0:d,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),children:f.map(({task:e,pr:t,mark:n})=>{let r=Rk(t?.url),i=t?.additions!==void 0&&t.deletions!==void 0;return(0,B.jsxs)(`button`,{type:`button`,className:`flex flex-col gap-1 rounded-[calc(var(--radius)-6px)] px-3 py-2 text-left font-sans enabled:hover:bg-hover`,disabled:!t?.url,onClick:()=>t?.url&&window.open(t.url,`_blank`,`noopener`),children:[(0,B.jsx)(`span`,{className:`truncate font-semibold text-ink`,children:t.title||e.label}),(0,B.jsxs)(`span`,{className:`flex items-baseline gap-0 text-meta leading-[inherit] whitespace-nowrap`,children:[(0,B.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.25 ${n.tone}`,children:[(0,B.jsx)(`span`,{className:`font-mono`,children:n.glyph}),zk(R(`rail.pr.state.${n.state}`))]}),(0,B.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-pre text-muted`,children:[...n.checks?[R(`rail.pr.checks.${n.checks}`)]:[],[r,t?.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,B.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,B.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]},t.url??`${e.id}#${t.number??``}`)})}),document.body)]})}function Uk(e,t,n){let r=t.kind===`main`,i=e=>r?e.kind===`main`:e.kind!==`main`&&e.repo===t.repo&&!e.pinned==!t.pinned;if(t.id===n.id||!i(n))return null;let a=e.filter(i).sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).map(e=>e.id);return a.indexOf(n.id)-a.indexOf(t.id)}function Wk(e,t,n,r){let i=Uk(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function Gk(e,t){return e.id===t.id?!1:e.kind===`main`?t.kind===`main`:t.kind!==`main`&&t.repo===e.repo&&!t.pinned==!e.pinned}var Kk=e=>e===void 0||e.kind===`project`||e.kind===`state`?0:e.kind===`task`||e.kind===`pane`||e.kind===`round`?e.depth:1;function qk(e,t){let n=Kk(e[t]),r=t+1;for(;r<e.length&&Kk(e[r])>n;)r++;return r}function Jk(e,t){let n=Kk(e[t]),r=[];for(let i=2;i<=n;i++){let a=t+1;for(;a<e.length&&Kk(e[a])>i;)a++;let o=a<e.length&&Kk(e[a])===i;r.push(i===n?o?`tee`:`elbow`:o?`pipe`:`blank`)}return r}function Yk(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=qk(e,i),o=e.slice(i,a),s=[...e.slice(0,i),...e.slice(a)],c=s.findIndex(e=>e.id===n);if(c<0)return e;let l=r===`above`?c:qk(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}var Xk={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`};function Zk(e,t){let n=(0,h.useRef)(null);(0,h.useLayoutEffect)(()=>{let r=[...document.querySelectorAll(`[data-rail-body] > [data-row]`)],i=new Map(r.map(e=>[e.dataset.row??``,e.offsetTop])),a=n.current;if(n.current={list:e,tops:i},!(!a||a.list===e||a.tops.size===0||t)&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)for(let e of r){let t=a.tops.get(e.dataset.row??``);t===void 0?e.animate([{opacity:0},{opacity:1}],Xk):t!==e.offsetTop&&e.animate([{transform:`translateY(${t-e.offsetTop}px)`},{transform:`none`}],Xk)}})}var Qk=null,$k=()=>(Qk||(Qk=new Image,Qk.src=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`),Qk);function eA(e,t,n,r){let[i,a]=(0,h.useState)(null),o=(0,h.useRef)(t);o.current=t;let[s,c]=(0,h.useState)(null),l=(0,h.useRef)(()=>a(null));(0,h.useEffect)(()=>{if(!s)return;let e=()=>{c(null),l.current()};if(t!==s)return e();let n=window.setTimeout(e,3e3);return()=>window.clearTimeout(n)},[t,s]);let u=(0,h.useRef)(null),d=(0,h.useRef)(null);Zk(t,i!==null||s!==null);let f=()=>[...u.current?.querySelectorAll(`[data-row]`)??[]];(0,h.useLayoutEffect)(()=>{let e=d.current;if(!e||(d.current=null,window.matchMedia(`(prefers-reduced-motion: reduce)`).matches))return;let t=f().flatMap(t=>{let n=e.get(t.dataset.row??``),r=n===void 0?0:n-t.getBoundingClientRect().top;return r?[{el:t,dy:r}]:[]});for(let{el:e,dy:n}of t)e.style.transition=`none`,e.style.transform=`translateY(${n}px)`;u.current?.getBoundingClientRect();for(let{el:e}of t)e.style.transition=`transform 150ms ease-out`,e.style.transform=``,e.addEventListener(`transitionend`,()=>e.style.removeProperty(`transition`),{once:!0})});let p=(0,h.useRef)(null),m=(0,h.useRef)([]),g=(0,h.useRef)(new Map),_=(0,h.useRef)(0),v=(0,h.useRef)(0),y=e=>{p.current=e,a(e)},b=e=>!n||e.machine!==void 0?null:e.kind===`project`?e.noProject?null:t.find(t=>t.repo===e.repo&&!Fu(t))??null:e.kind===`task`&&e.depth===1&&e.task.kind!==`main`?e.task:null,x=e=>{let t=b(e);if(t)return{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setDragImage($k(),0,0),n.dataTransfer.setData(`text/plain`,t.id),u.current=n.currentTarget.closest(`[data-rail-body]`),w(u.current);let r=m.current,i=r.findIndex(t=>t.id===e.id);_.current=r.slice(i,qk(r,i)).reduce((e,t,n)=>e+(g.current.get(t.id)?.height??0)+(n>0?g.current.get(t.id)?.gap??0:0),0),v.current=n.clientY,y({fromRow:e.id,from:t,toRow:e.id,to:t,side:`above`,project:e.kind===`project`})},onDragEnd:()=>p.current&&y(null)}},S=(e,t,n)=>{let r=t;if(n.project)for(;r>0&&e[r]?.kind!==`project`;)r--;let i=e[r];if(!i||i.kind===`project`!==n.project)return null;let a=b(i);return!a||!n.project&&!Gk(n.from,a)?null:{row:i.id,task:a}},C={onDragOver:e=>{let t=p.current;if(!t)return;e.preventDefault();let n=e.clientY-v.current;v.current=e.clientY;let r=e.target.closest(`[data-row]`)?.dataset.row,i=m.current,a=S(i,i.findIndex(e=>e.id===r),t);if(!a||a.row===t.fromRow)return;let o=e.currentTarget.querySelector(`[data-row="${CSS.escape(t.fromRow)}"]`)?.getBoundingClientRect().top;if(o===void 0||e.clientY>=o&&e.clientY<o+_.current)return;let s=e.clientY<o?`above`:`below`;(s===`above`?n>=0:n<=0)||(t.toRow!==a.row||t.side!==s)&&y({...t,toRow:a.row,to:a.task,side:s})},onDrop:n=>{let i=p.current;if(!i)return;n.preventDefault(),p.current=null,r?l.current=()=>a(null):l.current=()=>{d.current=new Map(f().map(e=>[e.dataset.row??``,e.getBoundingClientRect().top])),a(null),Df(`default`),F(G(`tasks`,`sort.label`,{mode:G(`tasks`,`sort.modes.default`)}))};let s=o.current,u=()=>o.current===s?c(s):l.current();if(i.project){if(i.toRow===i.fromRow)return l.current();let t={repo:i.from.repo,target:i.to.repo,side:i.side===`above`?`before`:`after`};e.client.request(`project.move`,t).catch(e=>F(G(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)).finally(u);return}let m=Wk(t,i.from,i.to,i.side);m?Nf(e,i.from.id,m).finally(u):l.current()}},w=e=>{let t=[...e?.querySelectorAll(`[data-row]`)??[]];g.current=new Map(t.map((e,n)=>{let r=t[n-1],i=r?e.offsetTop-r.offsetTop-r.offsetHeight:0;return[e.dataset.row??``,{top:e.offsetTop,gap:i,height:e.offsetHeight}]}))},T=(e,t)=>{m.current=t?Yk(e,t.fromRow,t.toRow,t.side):e;let n=new Map;if(!t)return n;let r=Math.min(...[...g.current.values()].map(e=>e.top)),i=e=>e.kind===`project`||e.kind===`state`,a=Math.max(0,...e.filter(i).map(e=>g.current.get(e.id)?.gap??0));for(let[e,t]of m.current.entries()){let o=g.current.get(t.id);if(!o)return new Map;e>0&&(r+=i(t)?a:o.gap),r!==o.top&&n.set(t.id,r-o.top),r+=o.height}return n};return{props:x,body:C,places:e=>{let t=[...g.current.keys()],n=i&&e.length===t.length&&e.every((e,n)=>e.id===t[n])?i:null,r=T(e,n),a=n?e.findIndex(e=>e.id===n.fromRow):-1,o=new Set(a<0?[]:e.slice(a,qk(e,a)).map(e=>e.id));return{dragging:n?.fromRow??null,place:e=>{let t=r.get(e.id);return{"data-row":e.id,...o.has(e.id)?{"data-lifted":``}:{},...t?{style:{transform:`translateY(${t}px)`}}:{}}}}}}}function tA({model:e,narrow:t,onSettings:n}){z();let r=y(OS),i=Q(`engines.skill.bannerHintWeb`,{engines:r.join(`, `)});return(0,B.jsxs)(`div`,{className:Yy,children:[!t&&(0,B.jsx)(ZC,{client:e.client}),(0,B.jsxs)(`div`,{className:Xy,children:[(0,B.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${Zy(!1)}`,onClick:n,children:[(0,B.jsxs)(`svg`,{className:$y,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),(0,B.jsx)(`span`,{children:R(`rail.settings`)}),r.length>0&&(0,B.jsx)(`span`,{className:`ml-2 min-w-0 truncate text-meta text-subtle`,title:i,children:R(`rail.skillCue`)})]}),(0,B.jsx)(Dw,{model:e,bindingId:`settings.open`})]})]})}function nA(e,t,n,r,i=null){let a=e=>e.kind===`task`&&e.task.kind===`main`&&e.fold===void 0&&e.task.id!==n&&e.task.id!==i&&(r?t[e.task.id]?.length===0:(t[e.task.id]?.length??0)===0),o=e.filter(e=>!a(e));return o.filter((e,t)=>{if(e.kind!==`project`&&e.kind!==`state`)return!0;let n=o[t+1];return n!==void 0&&n.kind!==`project`&&n.kind!==`state`})}var rA=`rove.web.rail.shownMains`;function iA(){try{let e=JSON.parse(localStorage.getItem(rA)??`[]`);return Array.isArray(e)?Object.fromEntries(e.map(e=>[String(e),[null]])):{}}catch{return{}}}function aA(e,t){try{let n=e.filter(e=>e.kind===`main`&&(t[e.id]?.length??0)>0).map(e=>e.id);localStorage.setItem(rA,JSON.stringify(n))}catch{}}function oA(e,t,n){return(0,h.useEffect)(()=>{n&&aA(e,t)},[n,e,t]),(0,h.useMemo)(()=>n?t:{...iA(),...t},[n,t])}var sA=v({});function cA(e,t,n){let r=sA.get()[`${e}::${t.id}`];return r&&r.sig===nd(n)&&Yu(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function lA(e,t,n,r){sA.set({...sA.get(),[`${e}::${t}`]:{sig:nd(n),leaf:r}})}function uA(e,t,n,r){lA(e,t.id,n,r),so(eu(e,t.id,r))?.focus()}function dA(e){let{taskId:t,tabId:n}=e.selection.get(),r=t?e.tabs.get()[t]?.find(e=>e.id===n):void 0;return t&&r?{taskId:t,tab:r}:null}async function fA(e,t,n){try{let r=await e.client.request(`tab.split`,t);typeof t.taskId==`string`&&await e.refreshTabsNow(t.taskId),n?.(r)}catch(e){F(e instanceof Error?e.message:String(e),`error`)}}function pA(e,t,n,r,i){let a=i??(n.split?cA(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=so(eu(t,n.id,a))?.size();fA(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&lA(t,n.id,e.split,e.leaf):F(R(`layout.splitTooSmall`),`error`)})}function mA(e,t,n,r){let i=n.split,a=i?cA(t,n,i):r,o=()=>fA(e,{taskId:t,tabId:n.id,action:`close`,leafId:r},e=>{let i=e.split;if(!i)return;let o=a!==r&&Yu(i.root).some(e=>e.id===a);lA(t,n.id,i,o?a:i.activeLeafId)});if(!i||!ed(n,i,r)){o();return}C.set((0,B.jsx)($r,{title:R(`confirm.closePaneTitle`,{pane:$u(i,qu(n)).get(r)??r}),body:R(`confirm.closePaneBody`),confirmLabel:R(`menu.closePane`),onConfirm:o}))}function hA(e,t,n,r){let i=n.split;i&&C.set((0,B.jsx)(Qr,{title:Nc(`split.renameTitle`),initial:$u(i,qu(n)).get(r)??``,allowEmpty:!0,submitLabel:R(`dialog.save`),onSubmit:i=>fA(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function gA(e,t,n,r){return[{label:R(`menu.renamePane`),section:`split`,key:mc(`workspace.split.rename`)??void 0,run:()=>hA(e,t,n,r)},{label:R(`menu.closePane`),section:`split`,key:Ji(`workspace.split.close`)||void 0,run:()=>mA(e,t,n,r)}]}function _A(e,t,n,r){return[{label:R(`menu.splitRight`),section:`split`,key:mc(`workspace.split.right`)??void 0,run:()=>pA(e,t,n,`right`,r)},{label:R(`menu.splitDown`),section:`split`,key:mc(`workspace.split.down`)??void 0,run:()=>pA(e,t,n,`down`,r)}]}function vA(e,t,n,r){let i=n.split,a=r??(i?cA(t,n,i):`leaf-1`);return[..._A(e,t,n,a),...Xu(i)?gA(e,t,n,a):[]]}function yA(e,t){let n=e.tabs.get()[t]??[],r=e.selection.get(),i=(r.taskId===t?n.find(e=>e.id===r.tabId):void 0)??Va(n);return!i||!td(i)?[]:_A(e,t,i,i.split?cA(t,i,i.split):`leaf-1`)}function bA(e,{task:t,tab:n,leaf:r}){n.split&&uA(t.id,n,n.split,r),e.select(t.id,n.id)}function xA(e){let{row:t}=e,n=y(e.model.selection);y(sA);let r=n.taskId===t.task.id&&n.tabId===t.tab.id&&!!t.tab.split&&cA(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,B.jsxs)(`button`,{type:`button`,className:`${Ur({size:`pane`})} ${e.cursor?Sp:``}`,"aria-current":r||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,B.jsx)(`span`,{className:lp,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,B.jsx)(`span`,{className:fp(e)},t))}),(0,B.jsx)(`span`,{className:`${Wr} text-(length:--fs-meta) ${r?`text-ink`:`text-muted`}`,children:t.label})]})}function SA({model:e,task:t}){let[n,r]=(0,h.useState)(()=>Y(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,h.useState)(null),{busy:o,error:s,submit:c}=Zr();(0,h.useEffect)(()=>{X(e,`task.get`,{taskId:t.id}).then(e=>r(e.task)).catch(e=>a(U(e)))},[e,t.id]);let l=()=>c(async()=>{if(!n?.prompt)return;let t=(await e.client.request(`task.spawn`,{repo:n.repo,prompt:n.prompt,...n.engine?{engine:n.engine}:{},...n.baseRef?{baseBranch:n.baseRef}:{}})).taskIds[0];t&&e.selectWhenListed(t)});return(0,B.jsx)(Xr,{title:G(`tasks`,`runAgain.title`),wide:!0,children:(0,B.jsxs)(`form`,{className:br,onSubmit:e=>{e.preventDefault(),l()},children:[(0,B.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`runAgain.source`,{title:t.label})}),(0,B.jsx)(`pre`,{className:tr,children:n?.prompt??i??G(`tasks`,`fieldNotes.loading`)}),(0,B.jsx)(`p`,{className:er,children:G(`tasks`,`runAgain.hint`)}),s&&(0,B.jsx)(`p`,{className:`text-error`,children:s}),(0,B.jsx)(ti,{busy:o||!n?.prompt,submitLabel:G(`tasks`,`runAgain.confirm`)})]})})}function CA(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function wA({model:e,repo:t}){let[n,r]=(0,h.useState)({kind:`loading`}),[i,a]=(0,h.useState)(0),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)(null),u=(0,h.useRef)(null),d=()=>e.client.request(`notes.list`,{repo:t}).then(e=>r({kind:`ready`,notes:e.notes})).catch(e=>r({kind:`error`,message:U(e)}));(0,h.useEffect)(()=>void d(),[]);let f=n.kind===`ready`?n.notes:[];(0,h.useEffect)(()=>a(e=>Math.max(0,Math.min(e,f.length-1))),[f.length]),(0,h.useEffect)(()=>{u.current?.querySelector(`.is-selected`)?.scrollIntoView({block:`nearest`})},[i]);let p=async n=>{if(n.id!==void 0){l(null);try{await e.client.request(`notes.delete`,{repo:t,id:n.id}),s(null),await d()}catch(e){l(U(e))}}};return(0,B.jsx)(Xr,{title:G(`tasks`,`fieldNotes.title`),wide:!0,children:(0,B.jsxs)(`div`,{className:br,onKeyDown:e=>{if(!o){if(e.key===`ArrowDown`||e.key===`j`)a(e=>Math.min(f.length-1,e+1));else if(e.key===`ArrowUp`||e.key===`k`)a(e=>Math.max(0,e-1));else if(e.key===`d`&&f[i]?.id!==void 0)s(f[i]??null);else return;e.preventDefault()}},children:[(0,B.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,B.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,B.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,B.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,B.jsx)(`ul`,{className:`m-0 list-none p-0 flex max-h-[44vh] flex-col gap-2 overflow-y-auto`,ref:u,children:f.map((e,t)=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,className:nr(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,B.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,CA(e.at),`, `,e.author]}),(0,B.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,B.jsx)(`p`,{children:(0,B.jsx)(`strong`,{children:G(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,B.jsx)(`p`,{className:`text-muted`,children:G(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,B.jsx)(`p`,{className:`text-error`,children:c}),(0,B.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>s(null),children:R(`dialog.cancel`)}),(0,B.jsx)(`button`,{type:`button`,className:Rt({danger:!0}),onClick:()=>void p(o),children:R(`taskops.retire`)})]})]}),!o&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:G(`tasks`,`fieldNotes.footerDeletable`)}),(0,B.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:R(`taskops.retire`)}),(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:L,children:R(`taskops.close`)})]})]})]})})}var TA=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],EA={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},DA=e=>({binding:e,key:mc(e)??void 0});async function OA(e,t){if(!e){F(R(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),F(R(`menu.copied`,{text:e}))}catch{F(R(`menu.copyFailed`),`error`)}}function kA(e,t,n){let r=[{label:R(`menu.newTask`),section:`open`,run:()=>gg(t)}],i=n.mainTaskId;return i&&(n.first||r.push({label:G(`tasks`,`menu.moveToTop`),section:`edit`,run:()=>void e.client.request(`task.move`,{taskId:i,direction:`top`}).catch(e=>F(G(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))}),r.push({label:G(`tasks`,`menu.reorderProject`),section:`edit`,...DA(`sidebar.localMerge`),run:()=>jA(i)})),r.push({label:G(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>C.set((0,B.jsx)(wA,{model:e,repo:t}))}),i&&r.push({label:G(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>C.set(O_(e,t,n.label))}),r}function AA(e){return[{label:R(`menu.newChatNoFolder`),section:`open`,run:()=>_g()},{label:R(`menu.newShell`),section:`open`,run:()=>void uu(e).catch(e=>F(String(e),`error`))}]}function jA(e){let t=!kf.get();t&&e!==void 0&&Af.set(e),jf(t),document.querySelector(`.rail`)?.focus()}function MA(e,t){let n=(e.tasks.get()?.tasks??[]).filter(e=>e.kind===`main`&&!e.machine&&e.repo!==t.repo).map(e=>e.repo),r=n.map(e=>{let t=e.slice(e.lastIndexOf(`/`)+1);return{value:e,label:n.filter(e=>e.endsWith(`/${t}`)).length>1?e:t}});return r.length===0?(F(G(`tasks`,`moveToProject.empty`),`error`),null):(0,B.jsx)(ei,{title:G(`tasks`,`moveToProject.title`),choices:r,onPick:async n=>{await e.client.request(`task.moveToProject`,{taskId:t.id,repo:n}),F(G(`tasks`,`toast.movedToProject`,{project:r.find(e=>e.value===n)?.label??n}))}})}function NA(e,t,n){let r=e.client,i=[];n&&(i.push({label:R(`menu.closeTab`),section:`tab`,run:()=>C.set((0,B.jsx)($r,{title:R(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:R(`confirm.closeTabBody`),confirmLabel:R(`menu.closeTab`),onConfirm:async()=>{await e.closeTab(t.id,n.id)}}))}),i.push(...vA(e,t.id,n))),i.push({label:R(`menu.newChat`),section:`open`,run:()=>void cu(e,t.id)}),i.push({label:R(`menu.newChatPick`),section:`open`,rare:!0,run:()=>C.set((0,B.jsx)(mu,{model:e,taskId:t.id}))}),i.push({label:R(`menu.continueEngine`),section:`open`,rare:!0,...DA(`chat.tab.fork`),run:()=>C.set((0,B.jsx)(mu,{model:e,taskId:t.id,context:`continue`,sourceTabId:n?.id}))}),i.push({label:R(`menu.newShell`),section:`open`,run:()=>void lu(e,t.id,{kind:`shell`}).catch(e=>F(String(e),`error`))}),t.kind===`task`&&t.ownsBranch===!0&&t.branch&&!t.sharesWorkspaceOf&&!t.machine&&!t.extraRepoCount&&i.push({label:G(`tasks`,`menu.newTaskFromBranch`),section:`open`,rare:!0,run:()=>P({repo:t.repo,baseBranch:t.branch,worktree:!0})}),t.startsAt&&(i.push({label:R(`menu.startNow`),section:`open`,run:()=>void e.client.request(`task.startScheduledNow`,{taskId:t.id}).catch(e=>F(String(e),`error`))}),i.push({label:R(`menu.cancelStart`),section:`open`,run:()=>void e.client.request(`task.cancelScheduledStart`,{taskId:t.id}).catch(e=>F(String(e),`error`))})),t.hasPrompt&&(i.push({label:G(`tasks`,`menu.runAgain`),section:`open`,run:()=>C.set((0,B.jsx)(SA,{model:e,task:t}))}),i.push({label:R(`menu.retryEdit`),section:`open`,rare:!0,run:()=>void ah(e,t)}));let a=!t.machine;if(a&&i.push({label:G(`tasks`,`menu.openEditor`),section:`open`,...DA(`tasks.openWorktree`),run:()=>void C_(e,t.id)}),t.groupId){let e=t.groupId;i.push({label:R(`compare.menu`),section:`open`,run:()=>_e(e)})}i.push({label:R(`menu.rename`),section:`edit`,...DA(`sidebar.rename`),run:()=>C.set((0,B.jsx)(Qr,{title:R(`menu.rename`),initial:t.title,submitLabel:R(`dialog.save`),onSubmit:n=>e.act(`task.rename`,{taskId:t.id,title:n}).then(()=>{})}))}),t.kind!==`main`&&i.push({label:t.pinned?R(`menu.unpin`):R(`menu.pin`),section:`edit`,...DA(`sidebar.pin`),run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>F(String(e),`error`))}),a&&i.push({label:G(`tasks`,`menu.reorder`),section:`edit`,rare:!0,...DA(`sidebar.localMerge`),run:()=>jA()}),i.push({label:R(`menu.setStatus`),section:`edit`,children:TA.map(n=>({label:R(EA[n]),checked:n===t.status,run:()=>void e.act(`task.setStatus`,{taskId:t.id,status:n}).catch(e=>F(String(e),`error`))}))}),a&&t.kind!==`main`&&!t.routine&&!t.parentTaskId&&!t.extraRepoCount&&i.push({label:G(`tasks`,`menu.moveToProject`),section:`edit`,rare:!0,run:()=>{let n=MA(e,t);n&&C.set(n)}}),a&&i.push({label:R(`menu.changeEngine`),section:`edit`,rare:!0,...DA(`tasks.cycleEngine`),run:()=>C.set((0,B.jsx)(qD,{model:e,current:async()=>(await e.client.request(`task.get`,{taskId:t.id})).task,onSet:async n=>{await e.client.request(`task.setEngine`,{taskId:t.id,engine:n.engine.id,...n.effort===void 0?{}:{effort:n.effort},...n.model===void 0?{}:{model:n.model}}),F(G(`tasks`,`toast.engineSwitched`,{engine:n.engine.name}))}}))}),t.pr?.checkState===`failing`&&i.push({label:G(`tasks`,`menu.fixChecks`),section:`git`,key:Ji(`files.fixChecks`),run:()=>void S_(e,t.id,R(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:G(`tasks`,`menu.syncBase`),section:`git`,rare:!0,key:Ji(`files.syncBase`),run:()=>void b_(e,t.id)}),t.branch&&i.push({label:R(`menu.renameBranch`),section:`git`,rare:!0,...DA(`tasks.renameBranch`),run:()=>C.set((0,B.jsx)(Qr,{title:R(`menu.renameBranch`),initial:t.branch,submitLabel:R(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:R(`menu.land`),section:`git`,run:()=>void v_(e,t)});let o=[{label:R(`menu.copyWhat.id`),run:()=>void OA(t.id,R(`menu.what.id`))}];return t.branch&&o.push({label:R(`menu.copyWhat.branch`),run:()=>void OA(t.branch,R(`menu.what.branch`))}),o.push({label:R(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>OA(e.task.worktreePath,R(`menu.what.path`))).catch(e=>F(String(e),`error`))}),i.push({label:R(`menu.copy`),section:`copy`,children:o}),t.kind!==`main`&&i.push({label:G(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void D_(e,t)}),i.push({label:R(`menu.removeSession`),section:`danger`,...DA(`sidebar.delete`),danger:!0,run:()=>C.set(t.kind===`main`?E_(e,t):T_(e,t))}),i}var PA=`rove.collapsedProjects`,FA=`rove.foldedTasks`,IA=`rove.openedTasks`,LA=600;function RA(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function zA(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var BA=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function VA(){let e=y(Ef),[t,n]=(0,h.useState)({active:!1,query:``}),[r,i]=(0,h.useState)(()=>RA(PA)),a=e=>i(t=>{let n=BA(t,e);return zA(PA,n),n}),[o,s]=(0,h.useState)(()=>({folded:RA(FA),opened:RA(IA)}));return{sort:e,cycleSort:Of,search:t,setSearch:n,collapsed:r,toggleProject:a,hand:o,toggleTaskFold:(e,t)=>s(n=>{let r=new Set(n.folded),i=new Set(n.opened);return t?(r.delete(e),i.add(e)):(i.delete(e),r.add(e)),zA(FA,r),zA(IA,i),{folded:r,opened:i}})}}var HA=[`sidebar.nav`,`sidebar.goto`,`sidebar.select`,`sidebar.tree.open`,`sidebar.rename`,`sidebar.pin`,`sidebar.localMerge`,`sidebar.delete`,`sidebar.sort`,`sidebar.search.enter`,`tasks.renameBranch`,`tasks.cycleEngine`,`tasks.openWorktree`,`tasks.update`,`tasks.focusEngine`,`task.new`,`settings.open.sidebar`,`worktrees.open.sidebar`];function UA(e){for(let t of e)for(let e of HA){let n=qi(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function WA(e,t){let n=e.selection.get().taskId===t;e.select(t),me(),n&&!mg(e.client)&&Ja()}function GA(e,t,n,r){let{search:i,setSearch:a}=n,[o,s]=(0,h.useState)(null),c=(0,h.useRef)(0),l=t.filter(e=>e.kind!==`project`&&e.kind!==`state`),u=l.findIndex(e=>e.id===o);(0,h.useEffect)(()=>{u<0&&s(r.selectedId&&l.some(e=>e.id===r.selectedId)?r.selectedId:l[0]?.id??null)},[u,l,r.selectedId]);let d=l[u],f=d?.kind===`task`||d?.kind===`pane`?d.task.id:null;(0,h.useEffect)(()=>L_.set(f),[f]);let p=l[0]?.id??null;(0,h.useEffect)(()=>{i.query,i.active&&s(p)},[i.active,i.query,p]);let m=e=>{let t=l[Math.max(0,Math.min(l.length-1,e))];t&&s(t.id)},g=t=>{t?.kind===`task`&&e.select(t.task.id),t?.kind===`round`&&_e(t.groupId),t?.kind===`pane`&&bA(e,t),t&&me()},_=(t,n)=>{t?.kind===`task`&&x(NA(e,t.task,null),n)?.run?.()},v=async t=>{if(t?.kind===`task`&&t.machine===void 0)try{let{engines:n}=await e.client.request(`engines.list`),r=Fl(n).filter(e=>e.ready!==!1),i=r[(r.findIndex(e=>e.id===t.task.engine?.id)+1)%r.length];if(!i||i.id===t.task.engine?.id)return;await e.client.request(`task.setCommand`,{taskId:t.task.id,engine:i.id}),F(R(`rail.engineSwitched`,{engine:i.name}))}catch(e){F(R(`rail.engineSwitchFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}};return{cursor:o,setCursor:s,onKeyDown:t=>{let o=l[u],s=t.target instanceof HTMLInputElement;if(i.active){if(t.metaKey||t.ctrlKey||t.altKey)return;if(t.key===`Escape`)a({active:!1,query:``});else if(t.key===`Enter`)g(o),a({active:!1,query:``});else if(t.key===`ArrowDown`)m(u+1);else if(t.key===`ArrowUp`)m(u-1);else if(t.key===`Backspace`&&!s)a(e=>({...e,query:e.query.slice(0,-1)}));else if(t.key.length===1&&!s)a(e=>({...e,query:e.query+t.key}));else return;t.preventDefault();return}let d=UA(ac(t));if(kf.get()){let n=o?.kind===`task`&&o.machine===void 0;if(d?.id===`sidebar.nav`)n&&Mf(e,o,d.slot%2==0?1:-1);else if(d?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)jf(!1);else return;t.preventDefault();return}switch(d?.id){case`sidebar.nav`:m(d.slot%2==0?u+1:u-1);break;case`sidebar.goto`:d.slot%2==1?m(l.length-1):Date.now()-c.current<LA?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:g(o);break;case`tasks.focusEngine`:Ja();break;case`sidebar.rename`:case`sidebar.pin`:case`sidebar.delete`:case`tasks.renameBranch`:case`tasks.openWorktree`:_(o,d.id);break;case`tasks.cycleEngine`:v(o);break;case`sidebar.localMerge`:o?.machine===void 0&&jf(!0);break;case`sidebar.sort`:n.cycleSort(),F(G(`tasks`,`sort.label`,{mode:G(`tasks`,`sort.modes.${Ef.get()}`)}));break;case`sidebar.search.enter`:a({active:!0,query:``});break;case`task.new`:r.onNewTask(o?.kind===`task`||o?.kind===`pane`?o.task.repo:void 0,o?.machine);break;case`settings.open.sidebar`:r.onSettings();break;case`worktrees.open.sidebar`:ge(`worktrees`);break;case`tasks.update`:ge(`update`);break;default:return}t.preventDefault()},onPress:e=>{let t=e.target.closest(`[data-row]`)?.dataset.row;t&&s(t)}}}var KA=192,qA=`rove.web.railWidth`,JA=`rove.web.railFolded`;function YA(){let e=Number(localStorage.getItem(qA));return Number.isFinite(e)&&e>0?e:null}var XA=v(YA());XA.subscribe(()=>{let e=XA.get();e===null?localStorage.removeItem(qA):localStorage.setItem(qA,String(Math.round(e)))}),XA.subscribe(ue);var ZA=v(localStorage.getItem(JA)===`1`);ZA.subscribe(()=>localStorage.setItem(JA,ZA.get()?`1`:`0`));var QA=v(!1),$A=null;function ej(e){$A!==null&&window.clearTimeout($A),$A=null,e?QA.set(!0):$A=window.setTimeout(()=>QA.set(!1),250)}ZA.subscribe(()=>QA.set(!1)),ZA.subscribe(ue);function tj(e,t=window.innerWidth){let n=Math.max(KA,t-320);return Math.max(KA,Math.min(n,Math.round(e)))}var nj=(e,t,n)=>`~pane:${e}:${t}:${n}`;function rj(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!Xu(n))return[];let r=$u(n,qu(t));return Yu(n.root).map(n=>({id:nj(e.task.id,t.id,n.id),kind:`pane`,task:e.task,tab:t,leaf:n.id,label:r.get(n.id)??n.id,depth:e.depth+1,...e.machine===void 0?{}:{machine:e.machine}}))})]:[e])}function ij(e){let{row:t}=e;return(0,B.jsxs)(`button`,{type:`button`,className:`${Ur({size:`pane`})} ${e.cursor?Sp:``}`,title:R(`compare.menu`),onClick:()=>{e.onClick(),_e(t.groupId)},...e.place,children:[e.guides&&(0,B.jsx)(`span`,{className:`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,B.jsx)(`span`,{className:fp(e)},t))}),(0,B.jsx)(`span`,{className:`${Wr} text-(length:--fs-meta) text-muted`,children:t.title}),(0,B.jsxs)(`span`,{className:`${Yr} ml-auto items-center`,children:[e.repo&&(0,B.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),(0,B.jsx)(`span`,{className:`text-subtle`,children:t.tasks.length}),(0,B.jsx)(Dx,{status:Xb(t.tasks)})]})]})}function aj(e){let t=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let e=t.current;return()=>{e&&document.activeElement===e&&e.closest(`nav`)?.focus()}},[]),(0,B.jsxs)(`div`,{className:`${yp} mono items-center`,children:[(0,B.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,B.jsx)(`input`,{ref:t,className:bp,type:`text`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`go`,value:e.query,placeholder:R(`rail.searchPlaceholder`),"aria-label":R(`rail.searchPlaceholder`),onChange:t=>e.onChange(t.target.value)}),e.query&&(0,B.jsx)(`span`,{className:`ml-1.5 text-muted`,children:e.count})]})}var oj=Math.min,sj=Math.max,cj=Math.round,lj=Math.floor,uj=e=>({x:e,y:e}),dj={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function fj(e,t,n){return sj(e,oj(t,n))}function pj(e,t){return typeof e==`function`?e(t):e}function mj(e){return e.split(`-`)[0]}function hj(e){return e.split(`-`)[1]}function gj(e){return e===`x`?`y`:`x`}function _j(e){return e===`y`?`height`:`width`}function vj(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function yj(e){return gj(vj(e))}function bj(e,t,n){n===void 0&&(n=!1);let r=hj(e),i=yj(e),a=_j(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=kj(o)),[o,kj(o)]}function xj(e){let t=kj(e);return[Sj(e),t,Sj(t)]}function Sj(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Cj=[`left`,`right`],wj=[`right`,`left`],Tj=[`top`,`bottom`],Ej=[`bottom`,`top`];function Dj(e,t,n){switch(e){case`top`:case`bottom`:return n?t?wj:Cj:t?Cj:wj;case`left`:case`right`:return t?Tj:Ej;default:return[]}}function Oj(e,t,n,r){let i=hj(e),a=Dj(mj(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Sj)))),a}function kj(e){let t=mj(e);return dj[t]+e.slice(t.length)}function Aj(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function jj(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Aj(e)}function Mj(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Nj(e,t,n){let{reference:r,floating:i}=e,a=vj(t),o=yj(t),s=_j(o),c=mj(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=hj(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Pj(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=pj(t,e),p=jj(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Mj(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Mj(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Fj=50,Ij=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Pj},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Nj(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Fj&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Nj(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Lj=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=pj(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=mj(r),_=vj(o),v=mj(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[kj(o)]:xj(o)),x=p!==`none`;!d&&x&&b.push(...Oj(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=bj(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===vj(t)||T.every(e=>vj(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=vj(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},Rj=new Set([`left`,`top`]);async function zj(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=mj(n),s=hj(n),c=vj(n)===`y`,l=Rj.has(o)?-1:1,u=a&&c?-1:1,d=pj(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Bj=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await zj(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Vj=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=pj(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=vj(i),p=gj(f),m=u[p],h=u[f],g=(e,t)=>fj(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}};function Hj(){return typeof window<`u`}function Uj(e){return Kj(e)?(e.nodeName||``).toLowerCase():`#document`}function Wj(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Gj(e){return((Kj(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Kj(e){return Hj()?e instanceof Node||e instanceof Wj(e).Node:!1}function qj(e){return Hj()?e instanceof Element||e instanceof Wj(e).Element:!1}function Jj(e){return Hj()?e instanceof HTMLElement||e instanceof Wj(e).HTMLElement:!1}function Yj(e){return!Hj()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Wj(e).ShadowRoot}function Xj(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=sM(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Zj(e){return/^(table|td|th)$/.test(Uj(e))}function Qj(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var $j=/transform|translate|scale|rotate|perspective|filter/,eM=/paint|layout|strict|content/,tM=e=>!!e&&e!==`none`,nM;function rM(e){let t=qj(e)?sM(e):e;return tM(t.transform)||tM(t.translate)||tM(t.scale)||tM(t.rotate)||tM(t.perspective)||!aM()&&(tM(t.backdropFilter)||tM(t.filter))||$j.test(t.willChange||``)||eM.test(t.contain||``)}function iM(e){let t=lM(e);for(;Jj(t)&&!oM(t);){if(rM(t))return t;if(Qj(t))return null;t=lM(t)}return null}function aM(){return nM??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),nM}function oM(e){return/^(html|body|#document)$/.test(Uj(e))}function sM(e){return Wj(e).getComputedStyle(e)}function cM(e){return qj(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lM(e){if(Uj(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Yj(e)&&e.host||Gj(e);return Yj(t)?t.host:t}function uM(e){let t=lM(e);return oM(t)?(e.ownerDocument||e).body:Jj(t)&&Xj(t)?t:uM(t)}function dM(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=uM(e),i=r===e.ownerDocument?.body,a=Wj(r);if(i){let e=fM(a);return t.concat(a,a.visualViewport||[],Xj(r)?r:[],e&&n?dM(e):[])}return t.concat(r,dM(r,[],n))}function fM(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function pM(e){let t=sM(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Jj(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=cj(n)!==a||cj(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function mM(e){return qj(e)?e:e.contextElement}function hM(e){let t=mM(e);if(!Jj(t))return uj(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=pM(t),o=(a?cj(n.width):n.width)/r,s=(a?cj(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var gM=uj(0);function _M(e){let t=Wj(e);return!aM()||!t.visualViewport?gM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vM(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Wj(e)}function yM(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=mM(e),o=uj(1);t&&(r?qj(r)&&(o=hM(r)):o=hM(e));let s=vM(a,n,r)?_M(a):uj(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Wj(a),t=qj(r)?Wj(r):r,n=e,i=fM(n);for(;i&&t!==n;){let e=hM(i),t=i.getBoundingClientRect(),r=sM(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Wj(i),i=fM(n)}}return Mj({width:u,height:d,x:c,y:l})}function bM(e,t){let n=cM(e).scrollLeft;return t?t.left+n:yM(Gj(e)).left+n}function xM(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-bM(e,n),y:n.top+t.scrollTop}}function SM(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Gj(r),s=t?Qj(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=uj(1),u=uj(0),d=Jj(r);if((d||!a)&&((Uj(r)!==`body`||Xj(o))&&(c=cM(r)),d)){let e=yM(r);l=hM(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?xM(o,c):uj(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function CM(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function wM(e){let t=cM(e),n=e.ownerDocument.body,r=sj(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=sj(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+bM(e),o=-t.scrollTop;return sM(n).direction===`rtl`&&(a+=sj(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var TM=25;function EM(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Wj(e),a=Gj(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!aM()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(bM(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=TM&&(s-=o)}return{width:s,height:c,x:l,y:u}}function DM(e,t){let n=yM(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=hM(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function OM(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=EM(e,n,t);else if(t===`document`)r=wM(Gj(e));else if(qj(t))r=DM(t,n);else{let n=_M(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Mj(r)}function kM(e,t){let n=t.get(e);if(n)return n;let r=dM(e,[],!1).filter(e=>qj(e)&&Uj(e)!==`body`),i=null,a=sM(e).position===`fixed`,o=a?lM(e):e;for(;qj(o)&&!oM(o);){let e=sM(o),t=rM(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=lM(o)}return t.set(e,r),r}function AM(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Qj(t)?[]:kM(t,this._c):[].concat(n),r],o=OM(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=OM(t,a[e],i);s=sj(n.top,s),c=oj(n.right,c),l=oj(n.bottom,l),u=sj(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function jM(e){let{width:t,height:n}=pM(e);return{width:t,height:n}}function MM(e,t,n){let r=Jj(t),i=Gj(t),a=n===`fixed`,o=yM(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=uj(0);if((r||!a)&&((Uj(t)!==`body`||Xj(i))&&(s=cM(t)),r)){let e=yM(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=bM(i));let l=i&&!r&&!a?xM(i,s):uj(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function NM(e){return sM(e).position===`static`}function PM(e,t){if(!Jj(e)||sM(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Gj(e)===n&&(n=n.ownerDocument.body),n}function FM(e,t){let n=Wj(e);if(Qj(e))return n;if(!Jj(e)){let t=lM(e);for(;t&&!oM(t);){if(qj(t)&&!NM(t))return t;t=lM(t)}return n}let r=PM(e,t);for(;r&&Zj(r)&&NM(r);)r=PM(r,t);return r&&oM(r)&&NM(r)&&!rM(r)?n:r||iM(e)||n}var IM=async function(e){let t=this.getOffsetParent||FM,n=this.getDimensions,r=await n(e.floating);return{reference:MM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function LM(e){return sM(e).direction===`rtl`}var RM={convertOffsetParentRelativeRectToViewportRelativeRect:SM,getDocumentElement:Gj,getClippingRect:AM,getOffsetParent:FM,getElementRects:IM,getClientRects:CM,getDimensions:jM,getScale:hM,isElement:qj,isRTL:LM};function zM(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function BM(e,t,n){let r=null,i,a=Gj(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=lj(d),h=lj(a.clientWidth-(u+f)),g=lj(a.clientHeight-(d+p)),_=lj(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:sj(0,oj(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!zM(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Wj(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function VM(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=mM(e),u=i||a?[...l?dM(l):[],...t?dM(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?BM(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?yM(e):null;c&&g();function g(){let t=yM(e);h&&!zM(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var HM=Bj,UM=Vj,WM=Lj,GM=(e,t,n)=>{let r=new Map,i=n??{},a={...RM,...i.platform,_c:r};return Ij(e,t,{...i,platform:a})},KM=`pointer-events-none fixed top-0 left-0 z-35 max-w-80 animate-tip-in rounded-sm border-hairline border-line bg-inset px-2.5 py-1.5 font-sans text-meta leading-[1.4] whitespace-normal wrap-anywhere text-ink shadow-popover motion-reduce:animate-none`,qM=500,JM=400,YM=`rove-tip`,XM=null,ZM=null,QM=null,$M=null,eN=0,tN=!1,nN=()=>tN;function rN(){return XM?.isConnected?XM:(XM=document.createElement(`div`),XM.id=YM,XM.setAttribute(`role`,`tooltip`),XM.className=KM,XM.hidden=!0,document.body.append(XM),XM)}function iN(){$M!==null&&window.clearTimeout($M),$M=null}function aN(e,t,n=`top`){iN(),oN();let r=rN();r.textContent=t,r.hidden=!1,ZM=e,e.setAttribute(`aria-describedby`,YM),QM=VM(e,r,()=>{if(!e.isConnected)return oN();GM(e,r,{strategy:`fixed`,placement:n,middleware:[HM(6),WM(),UM({padding:8})]}).then(({x:e,y:t})=>{r.style.left=`${e}px`,r.style.top=`${t}px`})})}function oN(){iN(),ZM&&(QM?.(),QM=null,ZM.getAttribute(`aria-describedby`)===YM&&ZM.removeAttribute(`aria-describedby`),ZM=null,XM&&(XM.hidden=!0),eN=performance.now())}function sN(e){if(!(e instanceof Element))return null;let t=e.closest(`[title], [data-tip]`);if(!t||t instanceof HTMLIFrameElement)return null;let n=t.getAttribute(`title`);if(n!==null){if(t.removeAttribute(`title`),n===``)return null;t.dataset.tip=n,!t.hasAttribute(`aria-label`)&&!t.textContent?.trim()&&t.setAttribute(`aria-label`,n)}return t.dataset.tip?t:null}function cN(e){if(e===ZM)return;iN();let t=ZM!==null||performance.now()-eN<JM,n=()=>e.isConnected&&e.dataset.tip&&aN(e,e.dataset.tip);t?n():$M=window.setTimeout(n,qM)}var lN=!1;function uN(){lN||(lN=!0,document.addEventListener(`pointerover`,e=>{if(e.pointerType===`touch`)return;let t=sN(e.target);t?cN(t):ZM&&e.target instanceof Node&&ZM.contains(e.target)||oN()}),document.addEventListener(`pointerout`,e=>{let t=sN(e.target);t&&!(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget))&&oN()}),document.addEventListener(`keydown`,e=>{tN=!0,e.key===`Escape`&&oN()},!0),document.addEventListener(`pointerdown`,()=>{tN=!1,oN()},!0),document.addEventListener(`focusin`,e=>{let t=tN?sN(e.target):null;t&&cN(t)}),document.addEventListener(`focusout`,e=>{e.target===ZM&&oN()}),window.addEventListener(`blur`,oN))}var dN=450,fN=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function pN(e,t){let n=(0,h.useRef)(null),r=(0,h.useRef)(null),i=(0,h.useRef)(e);i.current=e;let a=()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null},o=e=>{a(),n.current=window.setTimeout(()=>aN(e,i.current,`right`),dN)},s=()=>{a(),oN()};return(0,h.useEffect)(()=>{let e=r.current,n=e?.closest(`.rail`);if(!t||!e||!n||!nN()||!n.contains(document.activeElement)||!fN(e))return;let i=e=>{e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||s()};return o(e),n.addEventListener(`focusout`,i),()=>{n.removeEventListener(`focusout`,i),s()}},[t]),(0,h.useEffect)(()=>()=>{n.current!==null&&window.clearTimeout(n.current)},[]),{ref:e=>{r.current=e},onPointerEnter:e=>{e.pointerType===`touch`||!fN(e.currentTarget)||o(e.currentTarget)},onPointerLeave:s,hide:s}}function mN({at:e}){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=Cm(t);return(0,B.jsxs)(`span`,{className:`text-subtle`,title:R(`rail.startsAt`,{time:t.toLocaleString()}),children:[`◷ `,n]})}var hN=2e4;function gN(e,t){let n=J_().prefs.statusMarkNoticeSeen===!1,r=nx();(0,h.useEffect)(()=>{!n||t===void 0||(q_(e.client,`statusMarkNoticeSeen`,!0),t!==0&&r!==`dots`&&F(R(`rail.markNotice`),`info`,{label:R(`rail.markNoticeUndo`),run:()=>rx(e.client,`dots`)},hN))},[e,n,t,r])}var _N=150,vN=128,yN=0,bN=2,xN=[{reach:.96,grow:1.5,pulse:.9,done:104},{reach:.72,grow:1.1,pulse:1.2,done:84},{reach:1,grow:1.7,pulse:.7,done:116},{reach:.84,grow:1.3,pulse:1,done:96},{reach:.62,grow:1.2,pulse:1.3,done:80}],SN=`/-\\|`,CN=6,wN=(e,t,n,r)=>{let i=e[n];i&&t>=0&&t<i.length&&(i[t]=r)};function TN(e,t){let n=Math.min(64,Math.max(24,Math.floor(t))),r=(Math.floor(e)%_N+_N)%_N,i=Array.from({length:11},()=>Array(n).fill(` `)),a=Array.from({length:11},()=>Array(n).fill(` `));wN(a,yN,0,`o`);let o=bN+2*(xN.length-1),s=Math.min(o,Math.floor(r/2));for(let e=1;e<=s;e++)wN(i,yN,e,`|`);if(xN.forEach((e,t)=>{let o=bN+2*t,s=2*o;if(r<s)return;wN(i,yN,o,`+`);let c=n-1-1,l=1+Math.max(1,Math.floor(c*e.reach)),u=Math.min(l,1+Math.floor((r-s)*e.grow)),d=r>=e.done&&u===l;for(let t=1;t<u;t++)!d&&((t-Math.floor(r*e.pulse))%CN+CN)%CN===0?wN(a,t,o,`=`):wN(i,t,o,`-`);d?wN(a,u,o,`o`):u<l?wN(a,u,o,`>`):wN(a,u,o,SN[(Math.floor(r/2)+t)%4]??`-`)}),r>=vN){let e=Math.ceil((r-vN+1)/22*(n+1));for(let t of[i,a])for(let r of t)r.fill(` `,0,Math.min(n,e))}return{base:i.map(e=>e.join(``)).join(`
41
41
  `),accent:a.map(e=>e.join(``)).join(`
42
- `)}}var EN=`min-h-0 w-full overflow-y-auto`,DN=`mx-auto mt-[min(16vh,8rem)] flex w-full max-w-130 flex-col gap-4 px-5 pb-7`,ON=`relative grid w-full select-none overflow-hidden font-mono text-(length:--fs-body) text-subtle [contain:layout_paint]`,kN=`col-start-1 row-start-1 m-0 whitespace-pre font-[inherit] leading-[inherit]`,AN=`invisible absolute top-0 left-0 whitespace-pre`,jN=1.3,MN=`0000000000`,NN=1e3/12;function PN(){let e=(0,h.useRef)(null),t=(0,h.useRef)(null),n=(0,h.useRef)(null),r=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let i=e.current,a=t.current,o=n.current,s=r.current;if(!i||!a||!o||!s)return;let c=window.matchMedia(`(prefers-reduced-motion: reduce)`),l=24,u=90,d=0,f=0,p=0,m=-1,h=!0,g=()=>{let e=TN(u,l);o.textContent=e.base,s.textContent=e.accent},_=()=>{let e=a.getBoundingClientRect().width/10;e>0&&(l=Math.min(64,Math.max(24,Math.floor(i.clientWidth/e)))),g()},v=e=>{d=requestAnimationFrame(v);let t=p+Math.floor((e-f)/NN);t!==m&&(m=t,u=t,g())},y=()=>{cancelAnimationFrame(d),d=0},b=()=>{y(),c.matches?(u=90,g()):h&&document.visibilityState===`visible`&&(f=performance.now(),p=u,m=-1,d=requestAnimationFrame(v))},x=new ResizeObserver(_);x.observe(i),_(),b();let S=new IntersectionObserver(e=>{h=e[e.length-1]?.isIntersecting??!0,b()});return S.observe(i),c.addEventListener(`change`,b),document.addEventListener(`visibilitychange`,b),()=>{y(),x.disconnect(),S.disconnect(),c.removeEventListener(`change`,b),document.removeEventListener(`visibilitychange`,b)}},[]),(0,B.jsxs)(`div`,{ref:e,"aria-hidden":`true`,"data-field":`first-run-art`,className:ON,style:{height:`${11*jN}em`,lineHeight:jN},children:[(0,B.jsx)(`span`,{ref:t,className:AN,children:MN}),(0,B.jsx)(`pre`,{ref:n,className:kN}),(0,B.jsx)(`pre`,{ref:r,className:`${kN} text-accent`})]})}function FN(e){let t=G(`doctor`,`fix.humanOnlyWhy`),n=[];if(e.git||n.push({id:`git`,label:G(`doctor`,`fix.git`),action:G(`doctor`,`fix.gitAction`),why:t}),e.engines.length===0){let r=e.signedOut.length>0;n.push({id:`engine`,label:G(`doctor`,r?`fix.noEngineLogin`:`fix.noEngine`),action:G(`doctor`,r?`fix.noEngineLoginAction`:`fix.noEngineAction`,{list:e.signedOut.map(e=>e.id).join(`, `)}),why:t})}return n}function IN({model:e}){z(),y(zi);let[t,n]=(0,h.useState)(()=>Y(e,`welcome.env`)??null);(0,h.useEffect)(()=>{let t=!0;return X(e,`welcome.env`).then(e=>t&&n(e)).catch(()=>{}),()=>{t=!1}},[e]);let r=t===null?null:t.engines.length>0?{key:`enginesFound`,warn:!1,list:t.engines.map(e=>e.name).join(`, `)}:t.signedOut.length>0?{key:`enginesSignedOut`,warn:!0,list:t.signedOut.map(e=>e.name).join(`, `)}:{key:`enginesMissing`,warn:!0,list:``},i=t!==null&&(t.engines.length===0||!t.git)?FN(t):[];return(0,B.jsx)(`div`,{className:EN,"data-field":`welcome`,children:(0,B.jsxs)(`div`,{className:DN,children:[(0,B.jsx)(PN,{}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-ink`,children:R(`firstRun.title`)}),(0,B.jsx)(`p`,{className:`m-0 font-sans text-body text-muted`,children:R(`firstRun.body`)})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`button`,{type:`button`,className:Rt(),"data-field":`start-first-task`,onClick:()=>gg(t?.start?.repo),children:R(`firstRun.start`)}),(0,B.jsx)(`span`,{className:`keys-only mono text-meta text-subtle`,children:Ji(`task.new.global`)})]}),t!==null&&r!==null&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5 font-sans text-meta`,children:[(0,B.jsx)(`p`,{className:`m-0 ${r.warn?`text-warning`:`text-subtle`}`,children:G(`workspace`,`welcome.${r.key}`,{list:r.list})}),!t.git&&(0,B.jsx)(`p`,{className:`m-0 text-warning`,children:G(`workspace`,`welcome.gitMissing`)}),i.map(e=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,B.jsx)(`p`,{className:`m-0 text-warning`,children:e.label}),(0,B.jsx)(`p`,{className:`mono m-0 text-accent`,children:e.action}),(0,B.jsx)(`p`,{className:`m-0 text-muted`,children:e.why})]},e.id)),i.length>0&&(0,B.jsx)(`p`,{className:`m-0 text-muted`,children:G(`common`,`failureHint`,{command:`rove doctor`})})]})]})})}function LN(e,t){e.preventDefault(),S.set({x:e.clientX,y:e.clientY,items:t,target:e.currentTarget,fromKeyboard:e.button!==2})}function RN({model:e,narrow:t}){let n=z(),r=y(e.tasks),i=y(e.remote),a=Pp(e),o=y(e.tabs),s=Ub(e);gN(e,r?.tasks.length);let c=y(e.tabsSettled),l=y(e.selection),u=r?.tasks??[],d=r?.attention.filter(e=>e.unread).length??0,f=l.taskId,p=oA(u,o,c),m=new Map([...u,...i].map(e=>[e.id,e])),g=VA(),_=y(kf),v=y(Sf)===`state`,x=y(Af),S=e=>(v?Tg:Ku)({tasks:u,remote:i,machines:a,sort:g.sort,query:e,fold:{...g.hand,selectedId:f??void 0}}),w=S(g.search.active?g.search.query:``),{groups:T}=w,E=g.search.active?w.rows:Ju(rj(Eg(nA(w.rows,p,l.taskId,c,x)),o),g.collapsed),D=e=>e.filter(e=>e.kind!==`project`&&e.kind!==`state`&&e.kind!==`round`),O=(n===`zh`?bi:yi).machine,k=new Set(a.filter(e=>e.state!==`online`).map(e=>e.alias)),ee=T.find(e=>e.tasks.some(e=>e.kind===`main`))?.repo,te=e=>({mainTaskId:T.find(t=>t.repo===e)?.tasks.find(e=>e.kind===`main`)?.id??null,label:hu(e),first:e===ee}),A=eA(e,u,!g.search.active&&!v,g.sort==="default"),{place:ne,dragging:j}=A.places(E),M=()=>C.set((0,B.jsx)(ow,{model:e})),N=GA(e,E,g,{selectedId:f,onNewTask:gg,onSettings:M}),P=x!==null&&E.some(e=>e.id===x),re=N.setCursor;(0,h.useEffect)(()=>{P&&x!==null&&re(x)},[P,x,re]);let ie=D(S(``).rows).length,ae=(0,h.useRef)(null),oe=y(ZA)&&!t,F=y(QA)&&oe,I=t?u.find(e=>e.id===l.taskId&&!e.deleting)??null:null;return(0,B.jsxs)(`nav`,{className:`${_p} ${oe?`is-folded`:``}`,ref:ae,inert:oe&&!F,"aria-hidden":oe&&!F,onMouseEnter:oe?()=>ej(!0):void 0,onMouseLeave:oe?()=>ej(!1):void 0,tabIndex:0,onKeyDown:e=>{Pw(`sidebar`),N.onKeyDown(e)},children:[(0,B.jsxs)(`header`,{className:vp,children:[(0,B.jsxs)(`span`,{className:`${Jn} mr-auto`,children:[(0,B.jsx)(`span`,{className:Yn,children:`[`}),` rove `,(0,B.jsx)(`span`,{className:Yn,children:`]`})]}),(0,B.jsxs)(`span`,{className:`relative`,children:[(0,B.jsx)(`button`,{type:`button`,className:`m-0 text-meta font-medium normal-nums inbox-chip relative ${zr} ${Yt} ${d>0?`text-accent`:`text-muted`}`,onClick:()=>C.set((0,B.jsx)(yf,{model:e})),children:R(`rail.inbox`,{count:d})}),(0,B.jsx)(Dw,{model:e,bindingId:`inbox.show`,head:!0})]}),(0,B.jsx)(Ob,{})]}),_&&(0,B.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,B.jsx)(`span`,{className:`text-accent`,children:G(`tasks`,`moveChip`).trim()}),(0,B.jsx)(`span`,{className:`keys-only ml-1.5 text-muted`,children:(0,B.jsx)(mf,{text:R(`taskops.moveHint`)})})]}),g.search.active&&(0,B.jsx)(aj,{query:g.search.query,count:`${D(E).length}/${ie}`,onChange:e=>g.setSearch(t=>({...t,query:e}))}),(0,B.jsx)(Fk,{model:e}),(0,B.jsxs)(`div`,{"data-rail-body":!0,className:xp(j!==null),...A.body,onPointerDownCapture:N.onPress,children:[r&&u.length===0&&i.length===0&&t&&(0,B.jsx)(IN,{model:e}),r&&u.length===0&&i.length===0&&!t&&(0,B.jsx)(`p`,{className:`m-0 px-2 py-3 font-mono text-meta text-subtle`,children:R(`rail.empty`)}),I&&(0,B.jsx)(AP,{title:I.title}),E.map((t,n)=>t.kind===`round`?(0,B.jsx)(ij,{row:t,guides:t.depth>1?Jk(E,n):void 0,repo:v&&t.depth===1?Cg(t.tasks[0]):void 0,cursor:t.id===N.cursor,place:ne(t),onClick:()=>N.setCursor(t.id)},t.id):t.kind===`pane`?(0,B.jsx)(xA,{model:e,row:t,guides:Jk(E,n),cursor:t.id===N.cursor,place:ne(t),onClick:()=>{N.setCursor(t.id),bA(e,t),me()},onMenu:n=>{N.setCursor(t.id),LN(n,gA(e,t.task.id,t.tab,t.leaf))}},t.id):(0,B.jsx)(zN,{row:t,guides:t.kind===`task`&&t.depth>1?Jk(E,n):void 0,cloud:jp(t,a,O),repo:v&&t.kind===`task`&&t.depth===1?Cg(t.task):void 0,tabs:t.kind===`task`?o[t.task.id]:void 0,engineIcon:t.kind===`task`?s.get(t.task.engine?.id??``):void 0,selected:t.id===f,cursor:t.id===N.cursor&&j===null,stale:t.machine!==void 0&&k.has(t.machine),collapsed:(t.kind===`project`||t.kind===`state`)&&g.collapsed.has(t.id),drag:A.props(t),dragging:j===t.id,place:ne(t),onNewTask:t.kind===`project`?t.noProject?_g:()=>gg(t.repo,t.machine):void 0,moving:_&&t.machine===void 0&&(t.kind===`project`?!t.noProject&&te(t.repo).mainTaskId===N.cursor:t.id===N.cursor&&(t.kind!==`task`||t.task.kind!==`main`)),prTasks:t.kind===`task`?[t.task,...(t.fold?.descendantIds??[]).flatMap(e=>m.get(e)??[])]:void 0,rollup:t.kind===`task`&&t.fold?.collapsed?Xb([t.task,...t.fold.descendantIds.flatMap(e=>m.get(e)??[])]):void 0,onToggleFold:()=>{t.kind===`task`&&g.toggleTaskFold(t.id,t.fold?.collapsed===!0)},onClick:()=>{N.setCursor(t.id),(t.kind===`project`||t.kind===`state`)&&g.toggleProject(t.id),t.kind===`task`&&WA(e,t.task.id)},onMenu:n=>{if(t.kind!==`project`||t.machine===void 0){if(t.kind===`project`&&t.noProject){LN(n,AA(e));return}if(t.kind===`project`){let r=te(t.repo);r.mainTaskId&&E.some(e=>e.id===r.mainTaskId)&&N.setCursor(r.mainTaskId),LN(n,kA(e,t.repo,r));return}t.kind===`task`&&(N.setCursor(t.id),LN(n,b(HN(VN(NA(e,t.task,null),t.fold,()=>g.toggleTaskFold(t.id,t.fold?.collapsed===!0)),yA(e,t.task.id)),R(`menu.more`))))}}},t.id))]}),(0,B.jsx)(tA,{model:e,narrow:t,onSettings:M}),(0,B.jsx)(jP,{pane:`sidebar`}),!t&&!oe&&(0,B.jsx)(TP,{rail:ae})]})}function zN(e){let{row:t}=e,n=pN(t.kind===`task`?t.task.label:``,e.cursor&&t.kind===`task`),r=e.cursor?Sp:``;if(t.kind===`project`||t.kind===`state`)return(0,B.jsxs)(`h2`,{className:Cp({moving:e.moving,dragging:e.dragging,grab:e.drag!==void 0}),onContextMenu:e.onMenu,...e.place,...e.drag,children:[(0,B.jsxs)(`button`,{type:`button`,className:Tp,title:t.kind===`project`&&!t.noProject?t.repo:void 0,"aria-expanded":!e.collapsed,onClick:e.onClick,children:[(0,B.jsx)(`span`,{className:`truncate`,children:t.label}),t.kind===`state`&&(0,B.jsx)(`span`,{className:`font-normal text-subtle`,children:t.count}),(0,B.jsx)(wo,{right:e.collapsed,className:Ep(!!e.collapsed)})]}),e.onNewTask&&t.kind===`project`&&(0,B.jsx)(`button`,{type:`button`,className:Dp,title:R(`rail.newTask`),onClick:e.onNewTask,children:`+`})]});let i=t.task,a=i.rowStatus?.kind===`running`,o=d_(i),s=nx(),c=s===`engine`,l=t.fold?.collapsed?e.rollup:i.rowStatus;return(0,B.jsxs)(`button`,{type:`button`,ref:n.ref,className:`${Ur({selected:e.selected,moving:e.moving,lifted:e.dragging,grab:e.drag!==void 0})} ${r}`,onClick:e.onClick,onContextMenu:e.onMenu,onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,...e.place,...e.drag,children:[e.guides&&(0,B.jsx)(`span`,{className:`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,B.jsx)(`span`,{className:fp(e)},t))}),s!==`dots`&&(0,B.jsx)(ox,{icon:e.engineIcon,name:i.engine?.name,status:c?Kb(l):void 0}),(0,B.jsx)(`span`,{className:`${Gr} ${e.stale?`text-subtle`:``} ${a?Kr:``}`,children:t.attempt??i.label}),(0,B.jsxs)(`span`,{className:`${Yr} ml-auto items-center`,children:[e.repo&&(0,B.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),t.level!==void 0&&(0,B.jsx)(`span`,{className:`text-subtle`,children:t.level}),(i.extraRepoCount??0)>0&&(0,B.jsxs)(`span`,{className:`text-subtle`,title:R(`rail.extraRepos`,{count:i.extraRepoCount??0}),children:[`+`,i.extraRepoCount]}),o&&(0,B.jsxs)(`span`,{className:`text-subtle tabular-nums`,title:R(`rail.todos`,o),children:[o.done,`/`,o.total]}),t.fold?.collapsed&&(0,B.jsx)(BN,{count:t.fold.count,onUnfold:e.onToggleFold}),i.kept&&(0,B.jsx)(`span`,{className:`text-accent`,title:R(`compare.kept`),children:`✓`}),i.pinned&&(0,B.jsx)(`span`,{className:`text-subtle`,children:`▴`}),i.startsAt&&(0,B.jsx)(mN,{at:i.startsAt}),(0,B.jsx)(Hk,{tasks:e.prTasks??[i],onOpen:n.hide}),!c&&(0,B.jsx)(Dx,{status:l}),e.cloud&&(0,B.jsx)(Mp,{label:e.cloud})]})]})}function BN(e){let t=G(`tasks`,`menu.expandChildren`);return(0,B.jsxs)(`span`,{role:`button`,tabIndex:-1,"aria-label":t,"aria-expanded":!1,className:`chip text-muted ${pp}`,title:t,onClick:t=>{t.stopPropagation(),e.onUnfold()},children:[e.count,(0,B.jsx)(wo,{right:!0})]})}function VN(e,t,n){if(!t)return e;let r={label:G(`tasks`,t.collapsed?`menu.expandChildren`:`menu.collapseChildren`),section:`open`,rare:!0,run:n},i=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,i+1),r,...e.slice(i+1)]}function HN(e,t){let n=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,n+1),...t.map(e=>({...e,rare:!0})),...e.slice(n+1)]}var UN=`flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.25]`,WN=(e={})=>`relative grid cursor-pointer place-items-center rounded-sm border-none p-0 disabled:cursor-default disabled:opacity-35 [&_svg]:fill-none [&_svg]:stroke-current [&_svg]:[stroke-linecap:round] [&_svg]:[stroke-linejoin:round] [&_svg]:[stroke-width:1.25] touch:after:absolute touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.25 touch:after:content-[''] touch:first:after:-left-2 ${e.tool?`size-5.5 flex-none`:`size-6.5`} ${e.tool||e.small?`[&_svg]:size-3.5`:`[&_svg]:size-4`} ${e.on?`bg-accent-soft text-accent`:`bg-transparent text-subtle enabled:hover:bg-hover enabled:hover:text-ink`}`,GN=`absolute top-2 left-[calc(--spacing(2)+var(--shell-inset-left,0px))] z-7 flex items-center gap-0.5`,KN=`[&.is-resizing_iframe]:pointer-events-none`,qN=e=>`side-panel ${Jt} relative row-1 flex min-h-0 min-w-0 flex-col ${KN} ${e?`flex-1 p-0`:`pt-2 pr-1 pb-1 pl-0`}`,JN=`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] [--divider:5px] ${KN}`,YN=`side-col row-1 flex min-h-0 min-w-0 flex-col`,XN=e=>`side-head flex min-h-6.5 min-w-0 items-center gap-0.5 pb-1.5 font-mono text-meta normal-nums ${e?`px-2 pt-0`:`narrow:px-2 narrow:pt-0`}`,ZN=`min-w-0 flex-1 truncate px-2 text-ink`,QN=`flex min-w-0 flex-1 items-center gap-0.5`,$N=`scrollbar-none flex min-w-0 gap-0.5 overflow-x-auto`,eP=e=>`group/ptab relative flex min-w-12 max-w-40 items-center hover:text-ink ${e.active?`is-active text-ink`:`text-muted`} ${e.compact&&!e.active?`max-w-24 flex-none`:`flex-initial`}`,tP=e=>`flex min-w-0 cursor-pointer items-center gap-1.5 border-none bg-transparent py-1 pl-1.5 text-inherit [font:inherit] ${e?`pr-0.5`:`pr-1.5`}`,nP=`truncate`,rP=e=>`touch:relative size-4 flex-none cursor-pointer rounded-xs border-none p-0 font-mono text-title leading-none text-subtle hover:bg-hover hover:text-ink touch:after:absolute touch:after:-inset-1.5 touch:after:-left-1 touch:after:content-[''] ${e?`mr-0.5 bg-transparent`:`absolute top-1/2 right-0.5 -translate-y-1/2 bg-paper opacity-0 group-hover/ptab:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100`}`,iP=`ml-auto flex gap-0.5`,aP=`relative row-1 cursor-col-resize touch-none before:absolute before:inset-y-0 before:left-[calc(var(--divider)/2)] before:w-px before:bg-line before:content-[''] hover:before:bg-line-active after:absolute after:inset-x-[-3px] after:inset-y-0 after:content-['']`,oP=`side-view flex min-h-0 min-w-0 flex-1 flex-col [&[hidden]]:hidden`,sP=`m-auto flex max-w-[44ch] flex-col items-center gap-2.5 p-4 text-center font-mono text-meta leading-[1.5] text-subtle normal-nums`,cP=`flex min-h-0 flex-1 flex-col gap-1.5`,lP=`flex items-center gap-0.5 [&_svg]:flex-none`,uP=`mx-0.5 min-w-0 flex-1 rounded-sm border-none bg-inset px-2 py-1 text-ink [font-size:var(--fs-meta)] focus:bg-hover focus:outline-none aria-invalid:text-muted`,dP=`min-w-0 flex-1 rounded-sm border-none bg-paper`;function fP({children:e}){return(0,B.jsx)(`svg`,{className:`size-3.5 ${UN}`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var pP={chat:(0,B.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H8l-3 2.5v-2.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1zM5 6.5h6M5 8.5h4`}),files:(0,B.jsx)(`path`,{d:`M2 4.5a1 1 0 0 1 1-1h3l1.5 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z`}),file:(0,B.jsx)(`path`,{d:`M4 2h5l3 3v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM9 2v3h3M5.5 8h5M5.5 10.5h5`}),diff:(0,B.jsx)(`path`,{d:`M3.5 2.5h9a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1zM8 5v4M6 7h4M6 11h4`}),browser:(0,B.jsx)(`path`,{d:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM2 8h12M8 2c2.2 2 2.2 10 0 12M8 2c-2.2 2-2.2 10 0 12`}),quota:(0,B.jsx)(`path`,{d:`M2 10a6 6 0 1 1 12 0M8 10l2.5-3.5M4 13h8`})};function mP(e){let t=Ao(e);return t?jo(t):R(`panel.browser`)}var hP=7.3,gP=22,_P=160,vP=2,yP=24;function bP(e,t){let n=0;for(let t of e){let e=0;for(let n of t)e+=(n.codePointAt(0)??0)>11903?2:1;n+=Math.min(_P,gP+e*hP)+vP}return n<=t}function xP(e,t,n){let r=[{label:R(`panel.close`),section:`close`,run:()=>tc(e,n.id)}];return t.tabs.length>1&&r.push({label:R(`panel.closeOthers`),section:`close`,run:()=>ec(e,e=>Uo(e,n.id))}),r}function SP({taskId:e,column:t}){z();let n=(0,h.useRef)(null),r=(0,h.useRef)(null),[i,a]=(0,h.useState)(0);(0,h.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(([e])=>a(e?.contentRect.width??0));return t.observe(e),()=>t.disconnect()},[]);let o=i>0&&!bP(t.tabs.map(mP),i-yP);return(0,h.useEffect)(()=>{r.current?.querySelector(`.is-active`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t.active,t.tabs.length,o]),(0,B.jsxs)(`div`,{className:QN,ref:n,children:[(0,B.jsx)(`div`,{className:$N,role:`tablist`,"aria-label":R(`panel.tabs`),ref:r,children:t.tabs.map(n=>{let r=n.id===t.active;return(0,B.jsxs)(`div`,{role:`presentation`,className:eP({active:r,compact:o}),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),tc(e,n.id))},onContextMenu:r=>LN(r,xP(e,t,n)),children:[(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:tP(r),title:Ao(n)||mP(n),onClick:()=>ec(e,e=>No(e,n.id)),children:(0,B.jsx)(`span`,{className:nP,children:mP(n)})}),(0,B.jsx)(`button`,{type:`button`,className:rP(r),"aria-label":R(`panel.close`),tabIndex:-1,onClick:()=>tc(e,n.id),children:`×`})]},n.id)})}),(0,B.jsx)(`button`,{type:`button`,className:WN({tool:!0}),title:R(`panel.new`),"aria-label":R(`panel.new`),onClick:()=>ec(e,Io),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`})})})]})}function CP({edge:e,className:t,...n}){return(0,B.jsx)(`div`,{"data-grip":``,className:It(`absolute inset-y-0 z-5 w-1.5 cursor-col-resize touch-none`,`after:absolute after:inset-y-0 after:w-0.5 after:bg-line-active after:opacity-0 after:transition-opacity after:duration-120`,`hover:after:opacity-100 hover:after:delay-250 active:after:bg-accent active:after:opacity-100 active:after:delay-0`,e===`right`?`right-0 after:right-0`:`left-0 after:left-0`,t),...n})}var wP=400;function TP({rail:e}){z();let t=(0,h.useRef)(null),n=(0,h.useRef)(0),r=(0,h.useRef)(null);return(0,B.jsx)(CP,{edge:`right`,title:R(`layout.railResize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0,moved:!1},n.currentTarget.setPointerCapture(n.pointerId),de(!0)},onPointerMove:e=>{let n=t.current;!n||e.clientX===n.x||(n.moved=!0,XA.set(tj(n.width+e.clientX-n.x)))},onPointerUp:()=>{let e=t.current;if(t.current=null,!e)return;if(e.moved){n.current=0;return}let i=Date.now();r.current!==null&&window.clearTimeout(r.current),r.current=null,i-n.current<wP?(n.current=0,XA.set(null)):(n.current=i,r.current=window.setTimeout(()=>ZA.set(!0),wP))},onLostPointerCapture:()=>de(!1)})}function EP({side:e}){return(0,B.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`11`,rx:`2.5`}),(0,B.jsx)(`path`,{d:e===`left`?`M6 2.5v11`:`M10 2.5v11`})]})}function DP({model:e}){z();let t=y(zw),n=y(ZA),r=y(e.tasks),i=t=>Vw(e,t),a=R(n?`layout.railUnfold`:`layout.railFold`),o=n&&(r?.tasks??[]).some(Jb);return(0,B.jsxs)(`div`,{className:GN,onMouseEnter:()=>n&&QA.get()&&ej(!0),onMouseLeave:()=>n&&QA.get()&&ej(!1),children:[(0,B.jsxs)(`button`,{type:`button`,className:WN(),title:a,"aria-label":a,onClick:()=>ZA.set(!n),children:[(0,B.jsx)(EP,{side:`left`}),o&&(0,B.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]}),(0,B.jsx)(`button`,{type:`button`,className:WN(),title:R(`layout.navBack`),"aria-label":R(`layout.navBack`),disabled:Rw(t,-1,i)<0,onClick:()=>Ww(e,-1),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M10 3.5 5.5 8l4.5 4.5`})})}),(0,B.jsx)(`button`,{type:`button`,className:WN(),title:R(`layout.navForward`),"aria-label":R(`layout.navForward`),disabled:Rw(t,1,i)<0,onClick:()=>Ww(e,1),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`})})})]})}var OP=(0,B.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM4.5 6.5 6.5 8l-2 1.5M8 10h3`});function kP({taskId:e}){z();let t=y(fs);return(0,B.jsxs)(`div`,{className:Xt,children:[(0,B.jsx)(`button`,{type:`button`,className:`mono ${Zt}`,onClick:he,children:(0,B.jsx)(`span`,{className:`text-accent`,children:`‹ ${Lc(`narrowBack`)}`})}),e&&(0,B.jsx)(`span`,{className:`mono ml-auto flex gap-0.5`,role:`tablist`,children:[`terminal`,...ds].map(n=>{let r=R(n===`terminal`?`layout.narrowTerminal`:`panel.${n}`);return(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===n,"aria-label":r,title:r,className:Qt,onClick:()=>n===`terminal`?fs.set(n):qs(e,n),children:(0,B.jsx)(fP,{children:n===`terminal`?OP:pP[n]})},n)})})]})}function AP({title:e}){return z(),(0,B.jsxs)(`button`,{type:`button`,className:Ur({}),onClick:me,children:[(0,B.jsx)(`span`,{className:`${qr} font-bold text-accent`,children:`↩`}),(0,B.jsx)(`span`,{className:Wr,children:Rc(`recentJump`,{title:e})})]})}function jP({pane:e}){z();let{prefs:t}=J_(),n=y(Nw)[e];if(!t.keyHints)return null;let r=jw(e,n?`always`:`firstUse`);return r.length===0?null:(0,B.jsx)(`p`,{className:`mono text-muted ${$t}`,children:(0,B.jsx)(mf,{text:r.map(e=>`${Li(e.cap)} ${Mc(`pane.${e.msg}`)}`).join(` · `)})})}function MP(e){return e===`localhost`||e.endsWith(`.localhost`)||e===`[::1]`||/^127(\.\d{1,3}){3}$/.test(e)}var NP=/^(localhost|127(\.\d{1,3}){3}|\[::1\])(:\d+)?([/?#]|$)/i,PP=/^[a-z][a-z0-9+.-]*:(?!\d+([/?#]|$))/i;function FP(e){let t=e.trim();if(!t||/\s/.test(t)||PP.test(t)&&!/^https?:\/\//i.test(t))return null;let n=/^https?:\/\//i.test(t)?t:NP.test(t)?`http://${t}`:`https://${t.replace(/^\/\//,``)}`;try{let e=new URL(n);return e.hostname?e.href:null}catch{return null}}function IP(e,t,n=MP(t.hostname)){let r=new URL(e);return r.origin===t.origin?`self`:MP(r.hostname)?n?`yes`:`remote`:r.protocol===`https:`?`yes`:`unreachable`}function LP(e,t,n){let r=new URL(e).host;return t===`self`?{key:`self`,host:r}:t===`remote`?{key:`remote`,host:r}:t===`unreachable`?{key:`noFrame`,host:r}:n&&!n.reachable?{key:`unreachable`,host:r}:n&&!n.frameable?{key:`refuses`,host:r}:null}var RP=6e4,zP=new Map;function BP(e){let t=zP.get(e);return t&&Date.now()-t.at<RP?t:null}function VP(e,t,n){let[,r]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(!n||BP(t))return;let i=!0;return e.request(`browser.probe`,{url:t,origin:window.location.origin}).then(e=>zP.set(t,{probe:e,at:Date.now()}),()=>zP.set(t,{probe:null,at:Date.now()})).then(()=>i&&r(e=>e+1)),()=>{i=!1}},[e,t,n]);let i=n?BP(t):null;return{pending:n&&!i,probe:i?.probe??null}}function HP({d:e}){return(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:e})})}var UP=`M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5l-5 5`;function WP({model:e,tab:t,onNavigate:n,onStep:r}){z();let i=Ao(t),[a,o]=(0,h.useState)(i),[s,c]=(0,h.useState)(!1),[l,u]=(0,h.useState)(0),d=y(e.client.conn).hello?.peer?.local,f=i?IP(i,window.location,d):null;(0,h.useEffect)(()=>{o(i),c(!1)},[i]);let p=e=>{let t=FP(e);c(t===null&&e.trim()!==``),t!==null&&(o(t),t===i?u(l+1):n(t))},m=i?new URL(i).hostname:``,g=f===`yes`&&i.startsWith(`https:`)&&!MP(m),{pending:_,probe:v}=VP(e.client,i,g),b=i&&f?LP(i,f,v):null,x=f===`yes`&&!b&&!_,S=b?R(`browser.${b.key}`,{host:b.host}):f===null?R(s?`browser.invalid`:`browser.empty`):null;return(0,B.jsxs)(`div`,{className:cP,children:[(0,B.jsxs)(`form`,{className:lP,onSubmit:e=>{e.preventDefault(),p(a)},children:[(0,B.jsx)(`button`,{type:`button`,className:WN({small:!0}),disabled:t.at<=0,title:R(`browser.back`),"aria-label":R(`browser.back`),onClick:()=>r(t.at-1),children:(0,B.jsx)(HP,{d:`M10 3.5 5.5 8l4.5 4.5`})}),(0,B.jsx)(`button`,{type:`button`,className:WN({small:!0}),disabled:t.at>=t.urls.length-1,title:R(`browser.forward`),"aria-label":R(`browser.forward`),onClick:()=>r(t.at+1),children:(0,B.jsx)(HP,{d:`M6 3.5 10.5 8 6 12.5`})}),(0,B.jsx)(`button`,{type:`button`,className:WN({small:!0}),disabled:!x,title:R(`browser.reload`),"aria-label":R(`browser.reload`),onClick:()=>u(l+1),children:(0,B.jsx)(HP,{d:`M12.5 8a4.5 4.5 0 1 1-1.4-3.3M12.5 2.5v2.7H9.8`})}),(0,B.jsx)(`input`,{className:`browser-url mono ${uP}`,value:a,placeholder:R(`browser.placeholder`),"aria-label":R(`browser.address`),"aria-invalid":s,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,inputMode:`url`,onChange:e=>o(e.target.value)}),i?(0,B.jsx)(`a`,{className:WN({small:!0}),href:i,target:`_blank`,rel:`noopener noreferrer`,title:R(`browser.openTab`),"aria-label":R(`browser.openTab`),children:(0,B.jsx)(HP,{d:UP})}):(0,B.jsx)(`button`,{type:`button`,className:WN({small:!0}),disabled:!0,"aria-label":R(`browser.openTab`),children:(0,B.jsx)(HP,{d:UP})})]}),x?(0,B.jsx)(`iframe`,{className:dP,src:i,title:i,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,referrerPolicy:`no-referrer`},`${i}#${l}`):S?(0,B.jsx)(`p`,{className:sP,children:S}):null]})}var GP=`scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3`,KP=`m-0 p-3 font-mono text-meta text-muted`,qP=`flex items-baseline justify-between gap-3 font-mono text-meta normal-nums`,JP=`flex h-1.5 w-full gap-px overflow-hidden rounded-full bg-inset`,YP=`h-full min-w-[2px] flex-none`,XP=`m-0 flex list-none flex-col p-0`,ZP=`-mx-1 flex h-5.5 min-w-0 items-center gap-2 rounded-xs px-1 font-mono text-meta normal-nums`,QP=`mt-2`,$P=`size-2 flex-none rounded-full bg-line`,eF=`flex min-w-0 flex-1 items-center gap-1.5`,tF=`min-w-0 truncate text-muted`,nF=`w-[7ch] flex-none text-right text-ink`,rF=`w-[6ch] flex-none text-right text-muted`,iF=`group/fold`,aF=`${ZP} cursor-pointer list-none hover:bg-hover focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,oF=`m-0 flex list-none flex-col p-0`,sF=`${ZP} pl-5`,cF=`flex min-w-0 flex-1 overflow-hidden`,lF=`min-w-0 truncate text-subtle`,uF=`flex-none text-muted`,dF=`w-[7ch] flex-none text-right text-muted`,fF=`w-[6ch] flex-none`,pF=1e4,mF={system:`var(--info)`,system_prompt:`var(--info)`,system_tools:`var(--success)`,mcp_tools:`var(--warning)`,mcp_instructions:`var(--warning)`,custom_agents:`var(--ink)`,memory_files:`var(--merged)`,skills:`var(--muted)`,messages:`var(--accent)`,used:`var(--accent)`},hF=[`var(--info)`,`var(--success)`,`var(--warning)`,`var(--merged)`];function gF({model:e,task:t,active:n}){z();let r=y(e.client.conn),i=y(e.selection),a=y(e.tabs)[t.id]??[],o=i.taskId===t.id?a.find(e=>e.id===i.tabId):void 0,s=(o?.kind===`engine`?o:a.find(e=>e.kind===`engine`))?.id??null,[c,l]=(0,h.useState)({kind:`loading`}),[u,d]=(0,h.useState)(!1),f=(0,h.useRef)(``);if((0,h.useEffect)(()=>{if(!n||r.state!==`open`)return;let i=`${t.id}::${s}`;if(f.current!==i&&l({kind:`loading`}),f.current=i,!s){l({kind:`ready`,meter:null});return}let a=!0,o=n=>e.client.request(`context.usage`,{taskId:t.id,tabId:s,probe:n}).then(e=>a&&l({kind:`ready`,meter:e.meter})).catch(e=>a&&l(t=>t.kind===`ready`?t:{kind:`failed`,error:oT(e)})),c=()=>{d(!0),o(!0).finally(()=>a&&d(!1))};o(!1).then(c);let u=ni(pF,c);return()=>{a=!1,d(!1),u()}},[e,n,r.state,t.id,s]),c.kind===`loading`)return(0,B.jsx)(`p`,{className:KP,children:R(`context.loading`)});if(c.kind===`failed`)return(0,B.jsx)(`p`,{className:KP,children:R(`context.failed`,{error:c.error})});if(!c.meter)return(0,B.jsx)(`p`,{className:KP,children:R(`context.none`)});let p=c.meter,m=p.rows.filter(e=>e.share!==void 0),g=e=>e.share===void 0?void 0:mF[e.key]??hF[m.indexOf(e)%hF.length],_=`${p.approximate?`~`:``}${vF(p.used)}`;return(0,B.jsxs)(`div`,{className:GP,children:[(0,B.jsxs)(`div`,{className:qP,children:[(0,B.jsx)(`span`,{className:`text-ink`,children:p.percent===null?R(`context.usedTokens`,{tokens:_}):R(`context.used`,{percent:yF(p.percent)})}),p.window!==null&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[_,` / `,vF(p.window)]})]}),(0,B.jsx)(`div`,{className:JP,role:`meter`,"aria-valuenow":Math.round(p.percent??100),"aria-valuemin":0,"aria-valuemax":100,children:m.map(e=>(0,B.jsx)(`span`,{className:YP,style:{width:`${e.share}%`,background:g(e)}},e.key))}),(0,B.jsx)(`ul`,{className:XP,children:p.rows.map((e,t)=>{let n=`context.part.${e.key}`,r=R(n)===n?e.label??e.key:R(n),i=g(e),a=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:$P,style:i?{background:i}:void 0}),(0,B.jsxs)(`span`,{className:eF,children:[(0,B.jsx)(`span`,{className:tF,title:r,children:r}),e.items&&(0,B.jsx)(`span`,{className:`inline-block flex-none text-subtle group-open/fold:rotate-90`,children:`›`})]}),(0,B.jsx)(`span`,{className:nF,children:vF(e.tokens)}),(0,B.jsx)(`span`,{className:rF,children:e.deferred?`—`:yF(e.tokens/(p.window??p.used)*100)})]}),o=(e.deferred?!p.rows[t-1]?.deferred:e.share===void 0)?QP:void 0;if(!e.items)return(0,B.jsx)(`li`,{className:o,children:(0,B.jsx)(`div`,{className:ZP,children:a})},e.key);let s=e.items.reduce((e,t)=>e+t.tokens,0),c=(e.itemCount??e.items.length)-e.items.length;return(0,B.jsx)(`li`,{className:o,children:(0,B.jsxs)(`details`,{className:iF,children:[(0,B.jsx)(`summary`,{className:aF,children:a}),(0,B.jsxs)(`ul`,{className:oF,children:[e.items.map(e=>(0,B.jsx)(_F,{name:e.name,tokens:e.tokens},e.name)),c>0&&(0,B.jsx)(_F,{name:R(`context.more`,{count:c}),tokens:e.tokens-s})]})]})},e.key)})}),u&&m.length<2&&(0,B.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:R(`context.probing`)})]})}function _F({name:e,tokens:t}){let n=e.lastIndexOf(`/`)+1;return(0,B.jsxs)(`li`,{className:sF,title:e,children:[(0,B.jsxs)(`span`,{className:cF,children:[n>0&&(0,B.jsx)(`span`,{className:`min-w-0 truncate text-subtle`,children:e.slice(0,n)}),(0,B.jsx)(`span`,{className:n>0?uF:lF,children:e.slice(n)})]}),(0,B.jsx)(`span`,{className:dF,children:vF(Math.max(0,t))}),(0,B.jsx)(`span`,{className:fF})]})}function vF(e){return e>=1e6?`${+(e/1e6).toFixed(1)}M`:e>=1e3?`${+(e/1e3).toFixed(1)}k`:String(e)}function yF(e){return e>0&&e<.1?`<0.1%`:`${e<10?+e.toFixed(1):Math.round(e)}%`}var bF=3;function xF({model:e,task:t}){z();let n=t.autoFixCi,r=n=>void e.client.request(`task.autoFixCi`,{taskId:t.id,enabled:n}).catch(e=>F(e instanceof Error?e.message:String(e),`error`));return(0,B.jsx)(`div`,{className:`flex items-center gap-3 px-2 pt-1 font-mono text-meta`,children:n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:n.stopped?hf.attention:`text-muted`,title:R(`files.autoFix.hint`),children:R(n.stopped?`files.autoFix.stopped`:`files.autoFix.count`,{n:n.attempts,max:bF})}),(0,B.jsx)(V,{hit:`tight`,onClick:()=>r(!1),children:R(`files.autoFix.off`)})]}):(0,B.jsx)(V,{hit:`tight`,title:R(`files.autoFix.hint`),onClick:()=>r(!0),children:R(`files.autoFix.on`)})})}function SF(e){let t=e.pr;return!!t&&t.number!==void 0&&!e.machine&&(t.lifecycle===`open`||t.lifecycle===`ready_to_merge`)}function CF(e){let t={fail:0,pending:0,pass:0,skipped:0};for(let n of e)t[n.state]++;return t}function wF(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}function TF(e,t){let{startedAt:n,completedAt:r,durationMs:i}=e;return e.state===`pending`?n?{key:`files.checks.runningFor`,vars:{elapsed:wF(t-n)}}:null:i===null?r?{key:`files.checks.finishedAgo`,vars:{age:Wc(t-r)}}:null:r?{key:`files.checks.tookAgo`,vars:{duration:wF(i),age:Wc(t-r)}}:{key:`files.checks.took`,vars:{duration:wF(i)}}}function EF(e){let t=[],n=e.mergeState.toUpperCase();e.draft&&t.push({key:`files.merge.draft`,tone:`warning`}),e.mergeable.toUpperCase()===`CONFLICTING`||n===`DIRTY`?t.push({key:`files.merge.conflicts`,tone:`attention`}):n===`BEHIND`?t.push({key:`files.merge.behind`,tone:`warning`}):n===`UNSTABLE`?t.push({key:`files.merge.unstable`,tone:`warning`}):n===`BLOCKED`?t.push({key:`files.merge.blocked`,tone:`warning`}):n===`CLEAN`&&!e.draft&&t.push({key:`files.merge.clean`,tone:`success`});let r=e.review.toUpperCase();return r===`APPROVED`?t.push({key:`files.merge.approved`,tone:`success`}):r===`CHANGES_REQUESTED`?t.push({key:`files.merge.changes`,tone:`attention`}):r===`REVIEW_REQUIRED`&&t.push({key:`files.merge.reviewRequired`,tone:`warning`}),t}var DF=`flex flex-col gap-0.5 px-2 pb-2 font-mono text-meta`,OF=`flex items-start gap-2`,kF=`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 text-left text-ink`,AF={pass:{glyph:`✓`,tone:`success`},fail:{glyph:`✗`,tone:`attention`},pending:{glyph:`●`,tone:`warning`},skipped:{glyph:`–`,tone:`muted`}};function jF({model:e,task:t}){z();let n=t.pr,r=t.id,[i,a]=(0,h.useState)(()=>Y(e,`pr.checks`,{taskId:r})??null),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)({}),[u,d]=(0,h.useState)(0),f=`${n?.number}:${n?.checkState}:${n?.mergeable}:${n?.reviewDecision}`;(0,h.useEffect)(()=>{let t=!0,n={taskId:r};return e.client.request(`pr.checks`,u>0?{...n,fresh:!0}:n).then(r=>{t&&($l(e,`pr.checks`,n,r),a(r))},e=>t&&a({outcome:`unavailable`,detail:e instanceof Error?e.message:String(e)})),()=>{t=!1}},[e,r,f,u]);let p=t=>{let n=`${t.runId}:${t.name}`;if(c[n]){l(({[n]:e,...t})=>t);return}l(e=>({...e,[n]:{state:`loading`}})),e.client.request(`pr.checkLog`,{taskId:r,runId:t.runId,job:t.name}).then(e=>e.outcome===`ok`?{state:`text`,text:e.tail}:e.outcome===`none`?{state:`note`,text:R(`files.checks.noLog`)}:{state:`note`,text:R(`files.checks.logUnavailable`,{detail:e.detail})}).catch(e=>({state:`note`,text:R(`files.checks.logUnavailable`,{detail:e instanceof Error?e.message:String(e)})})).then(e=>l(t=>n in t?{...t,[n]:e}:t))},m=(0,B.jsx)(V,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>d(e=>e+1),children:R(`files.checks.refresh`)});if(!i)return(0,B.jsx)(`div`,{className:DF,children:(0,B.jsx)(`div`,{className:OF,children:(0,B.jsxs)(`span`,{className:`flex-1 text-muted`,children:[R(`files.checks.title`),` `,R(`files.checks.loading`)]})})});if(i.outcome!==`ok`)return(0,B.jsx)(`div`,{className:DF,children:(0,B.jsxs)(`div`,{className:OF,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 text-muted wrap-anywhere`,children:i.outcome===`none`?R(`files.checks.none`):R(`files.checks.unavailable`,{detail:i.detail})}),m]})});let g=CF(i.checks),_=Date.now(),v=o??(g.fail>0||g.pending>0),y=EF(i);return(0,B.jsxs)(`div`,{className:DF,children:[(0,B.jsxs)(`div`,{className:OF,children:[(0,B.jsxs)(V,{variant:`row`,className:kF,"aria-expanded":v,disabled:i.total===0,onClick:()=>s(!v),children:[i.total>0&&(0,B.jsx)(wo,{right:!v}),(0,B.jsx)(`span`,{children:i.total===0?R(`files.checks.none`):R(`files.checks.summary`,{pass:g.pass+g.skipped,total:i.total})}),g.fail>0&&(0,B.jsx)(`span`,{className:hf.attention,children:R(`files.checks.failed`,{count:g.fail})}),g.pending>0&&(0,B.jsx)(`span`,{className:hf.warning,children:R(`files.checks.running`,{count:g.pending})}),y.map(e=>(0,B.jsx)(`span`,{className:hf[e.tone],children:R(e.key)},e.key))]}),m]}),v&&i.checks.map(e=>{let{glyph:t,tone:n}=AF[e.state],r=TF(e,_),i=`${e.runId}:${e.name}`,a=c[i];return(0,B.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline gap-2 pl-4`,children:[(0,B.jsx)(`span`,{className:`w-[1ch] flex-none text-center ${hf[n]}`,children:t}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),r&&(0,B.jsx)(`span`,{className:`flex-none text-subtle`,children:R(r.key,r.vars)}),e.state===`fail`&&e.runId&&(0,B.jsx)(V,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>p(e),children:R(a?`files.checks.hideLog`:`files.checks.log`)})]}),a&&(0,B.jsx)(`pre`,{className:`m-0 ml-4 mb-1 max-h-40 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 whitespace-pre-wrap wrap-anywhere text-muted`,children:a.state===`loading`?R(`files.checks.loading`):a.text})]},`${e.name}:${e.url}`)}),v&&i.total>i.checks.length&&(0,B.jsx)(`span`,{className:`pl-4 text-subtle`,children:R(`files.checks.more`,{count:i.total-i.checks.length})})]})}function MF({model:e,task:t}){return SF(t)?(0,B.jsxs)(`div`,{onKeyDown:e=>e.stopPropagation(),children:[(0,B.jsx)(jF,{model:e,task:t}),(0,B.jsx)(xF,{model:e,task:t})]}):null}var NF=[`renamed`,`added`,`untracked`,`modified`,`deleted`,`conflict`],PF={U:`conflict`,D:`deleted`,M:`modified`,T:`modified`,"?":`untracked`,A:`added`,R:`renamed`,C:`renamed`},FF={conflict:`attention`,deleted:`attention`,modified:`warning`,untracked:`success`,added:`success`,renamed:`accent`},IF={conflict:`!`,deleted:`D`,modified:`M`,untracked:`U`,added:`A`,renamed:`R`};function LF(e){let t=new Map;for(let n of[`branch`,`working`])for(let r of e){let e=r.scope===n?PF[r.status]:void 0;e&&t.set(r.path,e)}let n=new Map(t);for(let[e,r]of t)for(let t=e.indexOf(`/`);t>=0;t=e.indexOf(`/`,t+1)){let i=e.slice(0,t+1),a=n.get(i);(a===void 0||NF.indexOf(r)>NF.indexOf(a))&&n.set(i,r)}return n}function RF(e,t){return e.some(e=>e.scope===`working`&&e.path===t&&e.status!==`?`)}function zF(e,t){let n={children:new Map,file:!1};for(let t of e){let e=n;for(let n of t.split(`/`)){let t=e.children.get(n);t||(t={children:new Map,file:!1},e.children.set(n,t)),e=t}e.file=!0}let r=[],i=(e,n,a)=>{let o=[...e.children].sort(([e,t],[n,r])=>{let i=t.children.size>0&&!t.file;return i===(r.children.size>0&&!r.file)?e.localeCompare(n):i?-1:1});for(let[e,s]of o){let o=s.children.size>0&&!s.file,c=o?`${n}${e}/`:`${n}${e}`,l=o&&t.has(c);r.push({path:c,name:e,depth:a,dir:o,open:l}),l&&i(s,c,a+1)}};return i(n,``,0),r}var BF={start:`\x1B[200~`,end:`\x1B[201~`};function VF(e,t){return e.engineTarget(t).tabId??e.tabs.get()[t]?.find(e=>e.kind===`engine`)?.id}async function HF(e,t,n){let r=VF(e,t);if(!r)return F(R(`files.stripNoEngine`),`error`),!1;try{return e.selection.get().tabId!==r&&e.select(t,r),await e.client.request(`term.input`,{stream:eu(t,r),data:`${BF.start}${n}${BF.end}`}),F(R(`files.stripFilled`)),!0}catch(e){return F(e instanceof Error?e.message:String(e),`error`),!1}}function UF(e){let t=e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived,n=e.changes;return t&&!!n&&`added`in n&&n.added+n.deleted>0}function WF(e){return[...UF(e)?[`commit`]:[],...GF(e)]}function GF(e){let t=e.pr;if(!t)return e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived&&!e.sessionPrs?.length?[`createPR`]:[];if(t.lifecycle===`merged`)return e.archived||e.kind===`main`?[]:[`archive`];if(t.lifecycle!==`open`&&t.lifecycle!==`ready_to_merge`)return[];let n=[];return((t.mergeable??``).toUpperCase()===`CONFLICTING`||e.prChip===`conflict`)&&n.push(`conflicts`),t.checkState===`failing`&&n.push(`fixCI`),(t.reviewDecision??``).toUpperCase()===`CHANGES_REQUESTED`&&n.push(`comments`),n}async function KF(e,t,n){try{let r=await e.client.request(`task.prompt`,{taskId:t.id,kind:n});r.outcome===`unavailable`?F(R(`files.stripUnavailable`,{detail:r.detail??``}),`error`):r.outcome===`none`||!r.prompt?F(R(`files.stripNothing`),`error`):await HF(e,t.id,r.prompt)}catch(e){F(e instanceof Error?e.message:String(e),`error`)}}var qF={commit:`files.stripCommit`,createPR:`files.stripCreate`,conflicts:`files.stripConflicts`,fixCI:`files.stripFixCi`,comments:`files.stripComments`,archive:`files.stripArchive`};function JF({model:e,task:t}){let n=WF(t);return n.length===0?null:(0,B.jsx)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:n.map(n=>(0,B.jsx)(V,{onClick:()=>n===`archive`?void D_(e,t):void KF(e,t,n),children:R(qF[n])},n))})}function YF(e){return e instanceof Ed&&e.code===`NOT_CONNECTED`?R(`workspace.connect.notConnected`):e instanceof Error?e.message:String(e)}var XF=2e3;function ZF({model:e,task:t}){z();let n=t.id,r=!t.machine,[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(!1),c=i?.running===!0;if((0,h.useEffect)(()=>{if(!r)return;let t=!0,i=()=>e.client.request(`run.status`,{taskId:n}).then(e=>t&&a(e),()=>{});i();let o=c?window.setInterval(()=>void i(),XF):0;return()=>{t=!1,window.clearInterval(o)}},[e,n,r,c]),!r||!i?.script)return null;let l=async t=>{s(!0);try{a(await e.client.request(t,{taskId:n}))}catch(e){F(e instanceof Error?e.message:String(e),`error`)}finally{s(!1)}};return(0,B.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:[i.url&&(0,B.jsx)(V,{onClick:()=>i.url&&Zs(n,i.url),children:R(`files.run.open`,{port:i.port??``})}),(0,B.jsx)(V,{disabled:o,onClick:()=>void l(c?`run.stop`:`run.start`),children:R(c?`files.run.stop`:`files.run.run`)})]})}function QF({model:e,task:t,narrow:n=!1}){z();let[r,i]=(0,h.useState)(()=>Y(e,`files.list`,{taskId:t.id})?.files??null),[a,o]=(0,h.useState)(()=>LF(Y(e,`diff.files`,{taskId:t.id})?.files??[])),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(new Set),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)(0),g=(0,h.useRef)(null),_=y(te),v=y(e.client.conn),b=JSON.stringify(t.changes??null);(0,h.useEffect)(()=>{let n=!0;return X(e,`files.list`,{taskId:t.id}).then(e=>{n&&(i(e.files),c(null))},e=>n&&c(YF(e))),()=>{n=!1}},[e,t.id,b,p,v.state]),(0,h.useEffect)(()=>{let n=!0;return X(e,`diff.files`,{taskId:t.id}).then(e=>n&&o(LF(e.files)),()=>{}),()=>{n=!1}},[e,t.id,b,p,v.state]);let x=r!==null,S=zF(r??[],l).map(e=>({path:e.path,label:e.name,depth:e.depth,dir:e.dir,open:e.open,state:a.get(e.path)})),C=Math.min(d,Math.max(0,S.length-1)),w=S[C],T=(e,t)=>u(n=>{let r=new Set(n);return t??!r.has(e)?r.add(e):r.delete(e),r}),E=e=>Xs(t.id,e),D=e=>Ys({taskId:t.id,path:e,scope:`working`}),O=n=>{if(!_?.startsWith(`${t.id}::`)){F(R(`files.mentionNoEngine`),`error`);return}e.client.request(`term.input`,{stream:_,data:`@${n} `}).catch(e=>F(String(e),`error`))},k=n=>t.machine?F(R(`files.remoteNoExternal`,{host:t.machine.label}),`error`):void e.client.request(`file.openExternal`,{taskId:t.id,path:n}).then(()=>F(R(`taskops.openedExternal`))).catch(e=>F(e instanceof Error?e.message:String(e),`error`));return(0,B.jsxs)(`div`,{className:`group/pane flex min-h-0 min-w-0 flex-1 flex-col outline-none ${n?`px-1.5 pt-2.5 pb-2`:`pt-0.5 pr-1.5 pb-1.5 pl-0`}`,tabIndex:0,ref:g,onKeyDown:e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)f(Math.min(S.length-1,C+1));else if(t===`k`||t===`ArrowUp`)f(Math.max(0,C-1));else if((t===`l`||t===`ArrowRight`)&&w?.dir)T(w.path,!0);else if((t===`h`||t===`ArrowLeft`)&&w?.dir)T(w.path,!1);else if(t===`r`)m(e=>e+1);else if(t===`D`&&e.shiftKey)D(`.`);else if(t===`d`&&w)D(w.path);else if(t===`Enter`&&w)w.dir?T(w.path):E(w.path);else if(t===`a`&&w)O(w.path);else if(t===`o`&&w&&!w.dir)k(w.path);else return;e.preventDefault()},children:[(0,B.jsx)(JF,{model:e,task:t}),(0,B.jsx)(MF,{model:e,task:t}),(0,B.jsx)(ZF,{model:e,task:t}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[s&&(0,B.jsx)(`p`,{className:`mono text-error`,children:s}),!s&&x&&S.length===0&&(0,B.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:R(`files.emptyAll`)}),S.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,className:Ur({selected:t===C,size:n?`file-narrow`:`file`}),style:{paddingLeft:8+e.depth*14},title:e.path,onClick:()=>{f(t),g.current?.focus(),e.dir?T(e.path):E(e.path)},children:[(0,B.jsx)(`span`,{className:Jr,children:e.dir?(0,B.jsx)(wo,{right:!e.open}):null}),(0,B.jsx)(`span`,{className:`${Wr} ${e.state?hf[FF[e.state]]:``}`,children:e.label}),e.state&&(0,B.jsx)(`span`,{className:`w-[1ch] flex-none text-center font-mono ${hf[FF[e.state]]}`,title:R(`files.state.${e.state}`),children:e.dir?`•`:IF[e.state]})]},e.path))]})]})}var $F={md:`md`,markdown:`md`,html:`html`,htm:`html`,svg:`svg`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,pdf:`pdf`};function eI(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<0?null:$F[t.slice(n+1).toLowerCase()]??null}function tI(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var nI=e=>new TextDecoder().decode(tI(e));function rI(e,t){if(e===`svg`)return`image/svg+xml`;if(e===`pdf`)return`application/pdf`;let n=t.slice(t.lastIndexOf(`.`)+1).toLowerCase();return n===`jpg`||n===`jpeg`?`image/jpeg`:n===`gif`?`image/gif`:n===`webp`?`image/webp`:`image/png`}var iI=`default-src 'none'; img-src data:; style-src 'unsafe-inline'`;function aI(e){let t=`<meta http-equiv="Content-Security-Policy" content="${iI}">`,n=/^\s*<!doctype[^>]*>/i.exec(e);return n?`${n[0]}${t}${e.slice(n[0].length)}`:`${t}${e}`}var oI=/^\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/,sI=/^https?:\/\/[^\s<>)\]]+/,cI=/[\p{L}\p{N}]/u;function lI(e){let t=[],n=``,r=()=>{n&&t.push({t:`text`,v:n}),n=``},i=0;for(;i<e.length;){let a=e.slice(i),o=e[i]??``;if(o==="`"){let n=e.indexOf("`",i+1);if(n>i+1){r(),t.push({t:`code`,v:e.slice(i+1,n)}),i=n+1;continue}}else if(a.startsWith(`**`)){let n=e.indexOf(`**`,i+2);if(n>i+2){r(),t.push({t:`bold`,c:lI(e.slice(i+2,n))}),i=n+2;continue}}else if(o===`*`||o===`_`&&!cI.test(e[i-1]??``)){let n=e.indexOf(o,i+1);if(n>i+1&&!/\s/.test(e[i+1]??` `)&&(o===`*`||!cI.test(e[n+1]??``))){r(),t.push({t:`em`,c:lI(e.slice(i+1,n))}),i=n+1;continue}}else if(o===`[`){let e=oI.exec(a);if(e){r(),t.push({t:`link`,href:e[2],c:lI(e[1])}),i+=e[0].length;continue}}else if(o===`h`&&!cI.test(e[i-1]??``)){let e=sI.exec(a);if(e){let n=e[0].replace(/[.,;:!?]+$/,``);r(),t.push({t:`link`,href:n,c:[{t:`text`,v:n}]}),i+=n.length;continue}}n+=o,i++}return r(),t}var uI=/^\s*(```+|~~~+)\s*([\w+#.-]*)\s*$/,dI=/^(#{1,6})\s+(.*?)\s*#*\s*$/,fI=/^(\s*)([-*+])\s+(.*)$/,pI=/^(\s*)\d+[.)]\s+(.*)$/,mI=/^\s*([-*_])(\s*\1){2,}\s*$/,hI=/^\s*\|.*\|\s*$/,gI=/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/,_I=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());function vI(e){let t=e.replace(/\r\n?/g,`
42
+ `)}}var EN=`min-h-0 w-full overflow-y-auto`,DN=`mx-auto mt-[min(16vh,8rem)] flex w-full max-w-130 flex-col gap-4 px-5 pb-7`,ON=`relative grid w-full select-none overflow-hidden font-mono text-(length:--fs-body) text-subtle [contain:layout_paint]`,kN=`col-start-1 row-start-1 m-0 whitespace-pre font-[inherit] leading-[inherit]`,AN=`invisible absolute top-0 left-0 whitespace-pre`,jN=1.3,MN=`0000000000`,NN=1e3/12;function PN(){let e=(0,h.useRef)(null),t=(0,h.useRef)(null),n=(0,h.useRef)(null),r=(0,h.useRef)(null);return(0,h.useEffect)(()=>{let i=e.current,a=t.current,o=n.current,s=r.current;if(!i||!a||!o||!s)return;let c=window.matchMedia(`(prefers-reduced-motion: reduce)`),l=24,u=90,d=0,f=0,p=0,m=-1,h=!0,g=()=>{let e=TN(u,l);o.textContent=e.base,s.textContent=e.accent},_=()=>{let e=a.getBoundingClientRect().width/10;e>0&&(l=Math.min(64,Math.max(24,Math.floor(i.clientWidth/e)))),g()},v=e=>{d=requestAnimationFrame(v);let t=p+Math.floor((e-f)/NN);t!==m&&(m=t,u=t,g())},y=()=>{cancelAnimationFrame(d),d=0},b=()=>{y(),c.matches?(u=90,g()):h&&document.visibilityState===`visible`&&(f=performance.now(),p=u,m=-1,d=requestAnimationFrame(v))},x=new ResizeObserver(_);x.observe(i),_(),b();let S=new IntersectionObserver(e=>{h=e[e.length-1]?.isIntersecting??!0,b()});return S.observe(i),c.addEventListener(`change`,b),document.addEventListener(`visibilitychange`,b),()=>{y(),x.disconnect(),S.disconnect(),c.removeEventListener(`change`,b),document.removeEventListener(`visibilitychange`,b)}},[]),(0,B.jsxs)(`div`,{ref:e,"aria-hidden":`true`,"data-field":`first-run-art`,className:ON,style:{height:`${11*jN}em`,lineHeight:jN},children:[(0,B.jsx)(`span`,{ref:t,className:AN,children:MN}),(0,B.jsx)(`pre`,{ref:n,className:kN}),(0,B.jsx)(`pre`,{ref:r,className:`${kN} text-accent`})]})}function FN(e){let t=G(`doctor`,`fix.humanOnlyWhy`),n=[];if(e.git||n.push({id:`git`,label:G(`doctor`,`fix.git`),action:G(`doctor`,`fix.gitAction`),why:t}),e.engines.length===0){let r=e.signedOut.length>0;n.push({id:`engine`,label:G(`doctor`,r?`fix.noEngineLogin`:`fix.noEngine`),action:G(`doctor`,r?`fix.noEngineLoginAction`:`fix.noEngineAction`,{list:e.signedOut.map(e=>e.id).join(`, `)}),why:t})}return n}function IN({model:e}){z(),y(zi);let[t,n]=(0,h.useState)(()=>Y(e,`welcome.env`)??null);(0,h.useEffect)(()=>{let t=!0;return X(e,`welcome.env`).then(e=>t&&n(e)).catch(()=>{}),()=>{t=!1}},[e]);let r=t===null?null:t.engines.length>0?{key:`enginesFound`,warn:!1,list:t.engines.map(e=>e.name).join(`, `)}:t.signedOut.length>0?{key:`enginesSignedOut`,warn:!0,list:t.signedOut.map(e=>e.name).join(`, `)}:{key:`enginesMissing`,warn:!0,list:``},i=t!==null&&(t.engines.length===0||!t.git)?FN(t):[];return(0,B.jsx)(`div`,{className:EN,"data-field":`welcome`,children:(0,B.jsxs)(`div`,{className:DN,children:[(0,B.jsx)(PN,{}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`h1`,{className:`m-0 font-sans text-title font-semibold text-ink`,children:R(`firstRun.title`)}),(0,B.jsx)(`p`,{className:`m-0 font-sans text-body text-muted`,children:R(`firstRun.body`)})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`button`,{type:`button`,className:Rt(),"data-field":`start-first-task`,onClick:()=>gg(t?.start?.repo),children:R(`firstRun.start`)}),(0,B.jsx)(`span`,{className:`keys-only mono text-meta text-subtle`,children:Ji(`task.new.global`)})]}),t!==null&&r!==null&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5 font-sans text-meta`,children:[(0,B.jsx)(`p`,{className:`m-0 ${r.warn?`text-warning`:`text-subtle`}`,children:G(`workspace`,`welcome.${r.key}`,{list:r.list})}),!t.git&&(0,B.jsx)(`p`,{className:`m-0 text-warning`,children:G(`workspace`,`welcome.gitMissing`)}),i.map(e=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,B.jsx)(`p`,{className:`m-0 text-warning`,children:e.label}),(0,B.jsx)(`p`,{className:`mono m-0 text-accent`,children:e.action}),(0,B.jsx)(`p`,{className:`m-0 text-muted`,children:e.why})]},e.id)),i.length>0&&(0,B.jsx)(`p`,{className:`m-0 text-muted`,children:G(`common`,`failureHint`,{command:`rove doctor`})})]})]})})}function LN(e,t){e.preventDefault(),S.set({x:e.clientX,y:e.clientY,items:t,target:e.currentTarget,fromKeyboard:e.button!==2})}function RN({model:e,narrow:t}){let n=z(),r=y(e.tasks),i=y(e.remote),a=Pp(e),o=y(e.tabs),s=Ub(e);gN(e,r?.tasks.length);let c=y(e.tabsSettled),l=y(e.selection),u=r?.tasks??[],d=r?.attention.filter(e=>e.unread).length??0,f=l.taskId,p=oA(u,o,c),m=new Map([...u,...i].map(e=>[e.id,e])),g=VA(),_=y(kf),v=y(Sf)===`state`,x=y(Af),S=e=>(v?Tg:Ku)({tasks:u,remote:i,machines:a,sort:g.sort,query:e,fold:{...g.hand,selectedId:f??void 0}}),w=S(g.search.active?g.search.query:``),{groups:T}=w,E=g.search.active?w.rows:Ju(rj(Eg(nA(w.rows,p,l.taskId,c,x)),o),g.collapsed),D=e=>e.filter(e=>e.kind!==`project`&&e.kind!==`state`&&e.kind!==`round`),O=(n===`zh`?bi:yi).machine,k=new Set(a.filter(e=>e.state!==`online`).map(e=>e.alias)),ee=T.find(e=>e.tasks.some(e=>e.kind===`main`))?.repo,te=e=>({mainTaskId:T.find(t=>t.repo===e)?.tasks.find(e=>e.kind===`main`)?.id??null,label:hu(e),first:e===ee}),A=eA(e,u,!g.search.active&&!v,g.sort==="default"),{place:ne,dragging:j}=A.places(E),M=()=>C.set((0,B.jsx)(ow,{model:e})),N=GA(e,E,g,{selectedId:f,onNewTask:gg,onSettings:M}),P=x!==null&&E.some(e=>e.id===x),re=N.setCursor;(0,h.useEffect)(()=>{P&&x!==null&&re(x)},[P,x,re]);let ie=D(S(``).rows).length,ae=(0,h.useRef)(null),oe=y(ZA)&&!t,F=y(QA)&&oe,I=t?u.find(e=>e.id===l.taskId&&!e.deleting)??null:null;return(0,B.jsxs)(`nav`,{className:`${_p} ${oe?`is-folded`:``}`,ref:ae,inert:oe&&!F,"aria-hidden":oe&&!F,onMouseEnter:oe?()=>ej(!0):void 0,onMouseLeave:oe?()=>ej(!1):void 0,tabIndex:0,onKeyDown:e=>{Pw(`sidebar`),N.onKeyDown(e)},children:[(0,B.jsxs)(`header`,{className:vp,children:[(0,B.jsxs)(`span`,{className:`${Jn} mr-auto`,children:[(0,B.jsx)(`span`,{className:Yn,children:`[`}),` rove `,(0,B.jsx)(`span`,{className:Yn,children:`]`})]}),(0,B.jsxs)(`span`,{className:`relative`,children:[(0,B.jsx)(`button`,{type:`button`,className:`m-0 text-meta font-medium normal-nums inbox-chip relative ${zr} ${Yt} ${d>0?`text-accent`:`text-muted`}`,onClick:()=>C.set((0,B.jsx)(yf,{model:e})),children:R(`rail.inbox`,{count:d})}),(0,B.jsx)(Dw,{model:e,bindingId:`inbox.show`,head:!0})]}),(0,B.jsx)(Ob,{})]}),_&&(0,B.jsxs)(`div`,{className:`flex gap-1 px-3.5 pb-2 text-meta mono`,children:[(0,B.jsx)(`span`,{className:`text-accent`,children:G(`tasks`,`moveChip`).trim()}),(0,B.jsx)(`span`,{className:`keys-only ml-1.5 text-muted`,children:(0,B.jsx)(mf,{text:R(`taskops.moveHint`)})})]}),g.search.active&&(0,B.jsx)(aj,{query:g.search.query,count:`${D(E).length}/${ie}`,onChange:e=>g.setSearch(t=>({...t,query:e}))}),(0,B.jsx)(Fk,{model:e}),(0,B.jsxs)(`div`,{"data-rail-body":!0,className:xp(j!==null),...A.body,onPointerDownCapture:N.onPress,children:[r&&u.length===0&&i.length===0&&t&&(0,B.jsx)(IN,{model:e}),r&&u.length===0&&i.length===0&&!t&&(0,B.jsx)(`p`,{className:`m-0 px-2 py-3 font-mono text-meta text-subtle`,children:R(`rail.empty`)}),I&&(0,B.jsx)(AP,{title:I.title}),E.map((t,n)=>t.kind===`round`?(0,B.jsx)(ij,{row:t,guides:t.depth>1?Jk(E,n):void 0,repo:v&&t.depth===1?Cg(t.tasks[0]):void 0,cursor:t.id===N.cursor,place:ne(t),onClick:()=>N.setCursor(t.id)},t.id):t.kind===`pane`?(0,B.jsx)(xA,{model:e,row:t,guides:Jk(E,n),cursor:t.id===N.cursor,place:ne(t),onClick:()=>{N.setCursor(t.id),bA(e,t),me()},onMenu:n=>{N.setCursor(t.id),LN(n,gA(e,t.task.id,t.tab,t.leaf))}},t.id):(0,B.jsx)(zN,{row:t,guides:t.kind===`task`&&t.depth>1?Jk(E,n):void 0,cloud:jp(t,a,O),repo:v&&t.kind===`task`&&t.depth===1?Cg(t.task):void 0,tabs:t.kind===`task`?o[t.task.id]:void 0,engineIcon:t.kind===`task`?s.get(t.task.engine?.id??``):void 0,selected:t.id===f,cursor:t.id===N.cursor&&j===null,stale:t.machine!==void 0&&k.has(t.machine),collapsed:(t.kind===`project`||t.kind===`state`)&&g.collapsed.has(t.id),drag:A.props(t),dragging:j===t.id,place:ne(t),onNewTask:t.kind===`project`?t.noProject?_g:()=>gg(t.repo,t.machine):void 0,moving:_&&t.machine===void 0&&(t.kind===`project`?!t.noProject&&te(t.repo).mainTaskId===N.cursor:t.id===N.cursor&&(t.kind!==`task`||t.task.kind!==`main`)),prTasks:t.kind===`task`?[t.task,...(t.fold?.descendantIds??[]).flatMap(e=>m.get(e)??[])]:void 0,rollup:t.kind===`task`&&t.fold?.collapsed?Xb([t.task,...t.fold.descendantIds.flatMap(e=>m.get(e)??[])]):void 0,onToggleFold:()=>{t.kind===`task`&&g.toggleTaskFold(t.id,t.fold?.collapsed===!0)},onClick:()=>{N.setCursor(t.id),(t.kind===`project`||t.kind===`state`)&&g.toggleProject(t.id),t.kind===`task`&&WA(e,t.task.id)},onMenu:n=>{if(t.kind!==`project`||t.machine===void 0){if(t.kind===`project`&&t.noProject){LN(n,AA(e));return}if(t.kind===`project`){let r=te(t.repo);r.mainTaskId&&E.some(e=>e.id===r.mainTaskId)&&N.setCursor(r.mainTaskId),LN(n,kA(e,t.repo,r));return}t.kind===`task`&&(N.setCursor(t.id),LN(n,b(HN(VN(NA(e,t.task,null),t.fold,()=>g.toggleTaskFold(t.id,t.fold?.collapsed===!0)),yA(e,t.task.id)),R(`menu.more`))))}}},t.id))]}),(0,B.jsx)(tA,{model:e,narrow:t,onSettings:M}),(0,B.jsx)(jP,{pane:`sidebar`}),!t&&!oe&&(0,B.jsx)(TP,{rail:ae})]})}function zN(e){let{row:t}=e,n=pN(t.kind===`task`?t.task.label:``,e.cursor&&t.kind===`task`),r=e.cursor?Sp:``;if(t.kind===`project`||t.kind===`state`)return(0,B.jsxs)(`h2`,{className:Cp({moving:e.moving,dragging:e.dragging,grab:e.drag!==void 0}),onContextMenu:e.onMenu,...e.place,...e.drag,children:[(0,B.jsxs)(`button`,{type:`button`,className:Tp,title:t.kind===`project`&&!t.noProject?t.repo:void 0,"aria-expanded":!e.collapsed,onClick:e.onClick,children:[(0,B.jsx)(`span`,{className:`truncate`,children:t.label}),t.kind===`state`&&(0,B.jsx)(`span`,{className:`font-normal text-subtle`,children:t.count}),(0,B.jsx)(wo,{right:e.collapsed,className:Ep(!!e.collapsed)})]}),e.onNewTask&&t.kind===`project`&&(0,B.jsx)(`button`,{type:`button`,className:Dp,title:R(`rail.newTask`),onClick:e.onNewTask,children:`+`})]});let i=t.task,a=i.rowStatus?.kind===`running`,o=d_(i),s=nx(),c=s===`engine`,l=t.fold?.collapsed?e.rollup:i.rowStatus;return(0,B.jsxs)(`button`,{type:`button`,ref:n.ref,className:`${Ur({selected:e.selected,moving:e.moving,lifted:e.dragging,grab:e.drag!==void 0})} ${r}`,onClick:e.onClick,onContextMenu:e.onMenu,onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,...e.place,...e.drag,children:[e.guides&&(0,B.jsx)(`span`,{className:`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,"aria-hidden":`true`,children:e.guides.map((e,t)=>(0,B.jsx)(`span`,{className:fp(e)},t))}),s!==`dots`&&(0,B.jsx)(ox,{icon:e.engineIcon,name:i.engine?.name,status:c?Kb(l):void 0}),(0,B.jsx)(`span`,{className:`${Gr} ${e.stale?`text-subtle`:``} ${a?Kr:``}`,children:t.attempt??i.label}),(0,B.jsxs)(`span`,{className:`${Yr} ml-auto items-center`,children:[e.repo&&(0,B.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),t.level!==void 0&&(0,B.jsx)(`span`,{className:`text-subtle`,children:t.level}),(i.extraRepoCount??0)>0&&(0,B.jsxs)(`span`,{className:`text-subtle`,title:R(`rail.extraRepos`,{count:i.extraRepoCount??0}),children:[`+`,i.extraRepoCount]}),o&&(0,B.jsxs)(`span`,{className:`text-subtle tabular-nums`,title:R(`rail.todos`,o),children:[o.done,`/`,o.total]}),t.fold?.collapsed&&(0,B.jsx)(BN,{count:t.fold.count,onUnfold:e.onToggleFold}),i.kept&&(0,B.jsx)(`span`,{className:`text-accent`,title:R(`compare.kept`),children:`✓`}),i.pinned&&(0,B.jsx)(`span`,{className:`text-subtle`,children:`▴`}),i.startsAt&&(0,B.jsx)(mN,{at:i.startsAt}),(0,B.jsx)(Hk,{tasks:e.prTasks??[i],onOpen:n.hide}),!c&&(0,B.jsx)(Dx,{status:l}),e.cloud&&(0,B.jsx)(Mp,{label:e.cloud})]})]})}function BN(e){let t=G(`tasks`,`menu.expandChildren`);return(0,B.jsxs)(`span`,{role:`button`,tabIndex:-1,"aria-label":t,"aria-expanded":!1,className:`chip text-muted ${pp}`,title:t,onClick:t=>{t.stopPropagation(),e.onUnfold()},children:[e.count,(0,B.jsx)(wo,{right:!0})]})}function VN(e,t,n){if(!t)return e;let r={label:G(`tasks`,t.collapsed?`menu.expandChildren`:`menu.collapseChildren`),section:`open`,rare:!0,run:n},i=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,i+1),r,...e.slice(i+1)]}function HN(e,t){let n=e.map(e=>e.section).lastIndexOf(`open`);return[...e.slice(0,n+1),...t.map(e=>({...e,rare:!0})),...e.slice(n+1)]}var UN=`flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.25]`,WN=(e={})=>`relative grid cursor-pointer place-items-center rounded-sm border-none p-0 disabled:cursor-default disabled:opacity-35 [&_svg]:fill-none [&_svg]:stroke-current [&_svg]:[stroke-linecap:round] [&_svg]:[stroke-linejoin:round] [&_svg]:[stroke-width:1.25] touch:after:absolute touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.25 touch:after:content-[''] touch:first:after:-left-2 ${e.tool?`size-5.5 flex-none`:`size-6.5`} ${e.tool||e.small?`[&_svg]:size-3.5`:`[&_svg]:size-4`} ${e.on?`bg-accent-soft text-accent`:`bg-transparent text-subtle enabled:hover:bg-hover enabled:hover:text-ink`}`,GN=`absolute top-2 left-[calc(--spacing(2)+var(--shell-inset-left,0px))] z-7 flex items-center gap-0.5`,KN=`[&.is-resizing_iframe]:pointer-events-none`,qN=e=>`side-panel ${Jt} relative row-1 flex min-h-0 min-w-0 flex-col ${KN} ${e?`flex-1 p-0`:`pt-2 pr-1 pb-1 pl-0`}`,JN=`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] [--divider:5px] ${KN}`,YN=`side-col row-1 flex min-h-0 min-w-0 flex-col`,XN=e=>`side-head flex min-h-6.5 min-w-0 items-center gap-0.5 pb-1.5 font-mono text-meta normal-nums ${e?`px-2 pt-0`:`narrow:px-2 narrow:pt-0`}`,ZN=`min-w-0 flex-1 truncate px-2 text-ink`,QN=`flex min-w-0 flex-1 items-center gap-0.5`,$N=`scrollbar-none flex min-w-0 gap-0.5 overflow-x-auto`,eP=e=>`group/ptab relative flex min-w-12 max-w-40 items-center hover:text-ink ${e.active?`is-active text-ink`:`text-muted`} ${e.compact&&!e.active?`max-w-24 flex-none`:`flex-initial`}`,tP=e=>`flex min-w-0 cursor-pointer items-center gap-1.5 border-none bg-transparent py-1 pl-1.5 text-inherit [font:inherit] ${e?`pr-0.5`:`pr-1.5`}`,nP=`truncate`,rP=e=>`touch:relative size-4 flex-none cursor-pointer rounded-xs border-none p-0 font-mono text-title leading-none text-subtle hover:bg-hover hover:text-ink touch:after:absolute touch:after:-inset-1.5 touch:after:-left-1 touch:after:content-[''] ${e?`mr-0.5 bg-transparent`:`absolute top-1/2 right-0.5 -translate-y-1/2 bg-paper opacity-0 group-hover/ptab:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100`}`,iP=`ml-auto flex gap-0.5`,aP=`relative row-1 cursor-col-resize touch-none before:absolute before:inset-y-0 before:left-[calc(var(--divider)/2)] before:w-px before:bg-line before:content-[''] hover:before:bg-line-active after:absolute after:inset-x-[-3px] after:inset-y-0 after:content-['']`,oP=`side-view flex min-h-0 min-w-0 flex-1 flex-col [&[hidden]]:hidden`,sP=`m-auto flex max-w-[44ch] flex-col items-center gap-2.5 p-4 text-center font-mono text-meta leading-[1.5] text-subtle normal-nums`,cP=`flex min-h-0 flex-1 flex-col gap-1.5`,lP=`flex items-center gap-0.5 [&_svg]:flex-none`,uP=`mx-0.5 min-w-0 flex-1 rounded-sm border-none bg-inset px-2 py-1 text-ink [font-size:var(--fs-meta)] focus:bg-hover focus:outline-none aria-invalid:text-muted`,dP=`min-w-0 flex-1 rounded-sm border-none bg-paper`;function fP({children:e}){return(0,B.jsx)(`svg`,{className:`size-3.5 ${UN}`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:e})}var pP={chat:(0,B.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H8l-3 2.5v-2.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1zM5 6.5h6M5 8.5h4`}),files:(0,B.jsx)(`path`,{d:`M2 4.5a1 1 0 0 1 1-1h3l1.5 1.5H13a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z`}),file:(0,B.jsx)(`path`,{d:`M4 2h5l3 3v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM9 2v3h3M5.5 8h5M5.5 10.5h5`}),diff:(0,B.jsx)(`path`,{d:`M3.5 2.5h9a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1zM8 5v4M6 7h4M6 11h4`}),browser:(0,B.jsx)(`path`,{d:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM2 8h12M8 2c2.2 2 2.2 10 0 12M8 2c-2.2 2-2.2 10 0 12`}),quota:(0,B.jsx)(`path`,{d:`M2 10a6 6 0 1 1 12 0M8 10l2.5-3.5M4 13h8`})};function mP(e){let t=Ao(e);return t?jo(t):R(`panel.browser`)}var hP=7.3,gP=22,_P=160,vP=2,yP=24;function bP(e,t){let n=0;for(let t of e){let e=0;for(let n of t)e+=(n.codePointAt(0)??0)>11903?2:1;n+=Math.min(_P,gP+e*hP)+vP}return n<=t}function xP(e,t,n){let r=[{label:R(`panel.close`),section:`close`,run:()=>tc(e,n.id)}];return t.tabs.length>1&&r.push({label:R(`panel.closeOthers`),section:`close`,run:()=>ec(e,e=>Uo(e,n.id))}),r}function SP({taskId:e,column:t}){z();let n=(0,h.useRef)(null),r=(0,h.useRef)(null),[i,a]=(0,h.useState)(0);(0,h.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(([e])=>a(e?.contentRect.width??0));return t.observe(e),()=>t.disconnect()},[]);let o=i>0&&!bP(t.tabs.map(mP),i-yP);return(0,h.useEffect)(()=>{r.current?.querySelector(`.is-active`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[t.active,t.tabs.length,o]),(0,B.jsxs)(`div`,{className:QN,ref:n,children:[(0,B.jsx)(`div`,{className:$N,role:`tablist`,"aria-label":R(`panel.tabs`),ref:r,children:t.tabs.map(n=>{let r=n.id===t.active;return(0,B.jsxs)(`div`,{role:`presentation`,className:eP({active:r,compact:o}),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),tc(e,n.id))},onContextMenu:r=>LN(r,xP(e,t,n)),children:[(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:tP(r),title:Ao(n)||mP(n),onClick:()=>ec(e,e=>No(e,n.id)),children:(0,B.jsx)(`span`,{className:nP,children:mP(n)})}),(0,B.jsx)(`button`,{type:`button`,className:rP(r),"aria-label":R(`panel.close`),tabIndex:-1,onClick:()=>tc(e,n.id),children:`×`})]},n.id)})}),(0,B.jsx)(`button`,{type:`button`,className:WN({tool:!0}),title:R(`panel.new`),"aria-label":R(`panel.new`),onClick:()=>ec(e,Io),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`})})})]})}function CP({edge:e,className:t,...n}){return(0,B.jsx)(`div`,{"data-grip":``,className:It(`absolute inset-y-0 z-5 w-1.5 cursor-col-resize touch-none`,`after:absolute after:inset-y-0 after:w-0.5 after:bg-line-active after:opacity-0 after:transition-opacity after:duration-120`,`hover:after:opacity-100 hover:after:delay-250 active:after:bg-accent active:after:opacity-100 active:after:delay-0`,e===`right`?`right-0 after:right-0`:`left-0 after:left-0`,t),...n})}var wP=400;function TP({rail:e}){z();let t=(0,h.useRef)(null),n=(0,h.useRef)(0),r=(0,h.useRef)(null);return(0,B.jsx)(CP,{edge:`right`,title:R(`layout.railResize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0,moved:!1},n.currentTarget.setPointerCapture(n.pointerId),de(!0)},onPointerMove:e=>{let n=t.current;!n||e.clientX===n.x||(n.moved=!0,XA.set(tj(n.width+e.clientX-n.x)))},onPointerUp:()=>{let e=t.current;if(t.current=null,!e)return;if(e.moved){n.current=0;return}let i=Date.now();r.current!==null&&window.clearTimeout(r.current),r.current=null,i-n.current<wP?(n.current=0,XA.set(null)):(n.current=i,r.current=window.setTimeout(()=>ZA.set(!0),wP))},onLostPointerCapture:()=>de(!1)})}function EP({side:e}){return(0,B.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,B.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`11`,rx:`2.5`}),(0,B.jsx)(`path`,{d:e===`left`?`M6 2.5v11`:`M10 2.5v11`})]})}function DP({model:e}){z();let t=y(zw),n=y(ZA),r=y(e.tasks),i=t=>Vw(e,t),a=R(n?`layout.railUnfold`:`layout.railFold`),o=n&&(r?.tasks??[]).some(Jb);return(0,B.jsxs)(`div`,{className:GN,onMouseEnter:()=>n&&QA.get()&&ej(!0),onMouseLeave:()=>n&&QA.get()&&ej(!1),children:[(0,B.jsxs)(`button`,{type:`button`,className:WN(),title:a,"aria-label":a,onClick:()=>ZA.set(!n),children:[(0,B.jsx)(EP,{side:`left`}),o&&(0,B.jsx)(`span`,{className:`absolute top-0.75 right-0.75 size-1.5 rounded-full bg-accent`})]}),(0,B.jsx)(`button`,{type:`button`,className:WN(),title:R(`layout.navBack`),"aria-label":R(`layout.navBack`),disabled:Rw(t,-1,i)<0,onClick:()=>Ww(e,-1),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M10 3.5 5.5 8l4.5 4.5`})})}),(0,B.jsx)(`button`,{type:`button`,className:WN(),title:R(`layout.navForward`),"aria-label":R(`layout.navForward`),disabled:Rw(t,1,i)<0,onClick:()=>Ww(e,1),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M6 3.5 10.5 8 6 12.5`})})})]})}var OP=(0,B.jsx)(`path`,{d:`M3 3.5h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM4.5 6.5 6.5 8l-2 1.5M8 10h3`});function kP({taskId:e,title:t}){z();let n=y(fs);return(0,B.jsxs)(`div`,{className:Xt,children:[(0,B.jsxs)(`button`,{type:`button`,className:`mono ${Zt}`,"aria-label":Lc(`narrowBack`),onClick:he,children:[(0,B.jsx)(`span`,{className:`flex-none text-accent`,children:t?`‹`:`‹ ${Lc(`narrowBack`)}`}),t&&(0,B.jsx)(`span`,{className:`truncate font-sans text-body font-normal text-ink`,children:t})]}),e&&(0,B.jsx)(`span`,{className:`mono ml-auto flex flex-none gap-0.5`,role:`tablist`,children:[`terminal`,...ds].map(t=>{let r=R(t===`terminal`?`layout.narrowTerminal`:`panel.${t}`);return(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":n===t,"aria-label":r,title:r,className:Qt,onClick:()=>t===`terminal`?fs.set(t):qs(e,t),children:(0,B.jsx)(fP,{children:t===`terminal`?OP:pP[t]})},t)})})]})}function AP({title:e}){return z(),(0,B.jsxs)(`button`,{type:`button`,className:Ur({}),onClick:me,children:[(0,B.jsx)(`span`,{className:`${qr} font-bold text-accent`,children:`↩`}),(0,B.jsx)(`span`,{className:Wr,children:Rc(`recentJump`,{title:e})})]})}function jP({pane:e}){z();let{prefs:t}=J_(),n=y(Nw)[e];if(!t.keyHints)return null;let r=jw(e,n?`always`:`firstUse`);return r.length===0?null:(0,B.jsx)(`p`,{className:`mono text-muted ${$t}`,children:(0,B.jsx)(mf,{text:r.map(e=>`${Li(e.cap)} ${Mc(`pane.${e.msg}`)}`).join(` · `)})})}function MP(e){return e===`localhost`||e.endsWith(`.localhost`)||e===`[::1]`||/^127(\.\d{1,3}){3}$/.test(e)}var NP=/^(localhost|127(\.\d{1,3}){3}|\[::1\])(:\d+)?([/?#]|$)/i,PP=/^[a-z][a-z0-9+.-]*:(?!\d+([/?#]|$))/i;function FP(e){let t=e.trim();if(!t||/\s/.test(t)||PP.test(t)&&!/^https?:\/\//i.test(t))return null;let n=/^https?:\/\//i.test(t)?t:NP.test(t)?`http://${t}`:`https://${t.replace(/^\/\//,``)}`;try{let e=new URL(n);return e.hostname?e.href:null}catch{return null}}function IP(e,t,n=MP(t.hostname)){let r=new URL(e);return r.origin===t.origin?`self`:MP(r.hostname)?n?`yes`:`remote`:r.protocol===`https:`?`yes`:`unreachable`}function LP(e,t,n){let r=new URL(e).host;return t===`self`?{key:`self`,host:r}:t===`remote`?{key:`remote`,host:r}:t===`unreachable`?{key:`noFrame`,host:r}:n&&!n.reachable?{key:`unreachable`,host:r}:n&&!n.frameable?{key:`refuses`,host:r}:null}var RP=6e4,zP=new Map;function BP(e){let t=zP.get(e);return t&&Date.now()-t.at<RP?t:null}function VP(e,t,n){let[,r]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(!n||BP(t))return;let i=!0;return e.request(`browser.probe`,{url:t,origin:window.location.origin}).then(e=>zP.set(t,{probe:e,at:Date.now()}),()=>zP.set(t,{probe:null,at:Date.now()})).then(()=>i&&r(e=>e+1)),()=>{i=!1}},[e,t,n]);let i=n?BP(t):null;return{pending:n&&!i,probe:i?.probe??null}}function HP({d:e}){return(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:e})})}var UP=`M6.5 3.5h-3v9h9v-3M9.5 3.5h3v3M12.5 3.5l-5 5`;function WP({model:e,tab:t,onNavigate:n,onStep:r}){z();let i=Ao(t),[a,o]=(0,h.useState)(i),[s,c]=(0,h.useState)(!1),[l,u]=(0,h.useState)(0),d=y(e.client.conn).hello?.peer?.local,f=i?IP(i,window.location,d):null;(0,h.useEffect)(()=>{o(i),c(!1)},[i]);let p=e=>{let t=FP(e);c(t===null&&e.trim()!==``),t!==null&&(o(t),t===i?u(l+1):n(t))},m=i?new URL(i).hostname:``,g=f===`yes`&&i.startsWith(`https:`)&&!MP(m),{pending:_,probe:v}=VP(e.client,i,g),b=i&&f?LP(i,f,v):null,x=f===`yes`&&!b&&!_,S=b?R(`browser.${b.key}`,{host:b.host}):f===null?R(s?`browser.invalid`:`browser.empty`):null;return(0,B.jsxs)(`div`,{className:cP,children:[(0,B.jsxs)(`form`,{className:lP,onSubmit:e=>{e.preventDefault(),p(a)},children:[(0,B.jsx)(`button`,{type:`button`,className:WN({small:!0}),disabled:t.at<=0,title:R(`browser.back`),"aria-label":R(`browser.back`),onClick:()=>r(t.at-1),children:(0,B.jsx)(HP,{d:`M10 3.5 5.5 8l4.5 4.5`})}),(0,B.jsx)(`button`,{type:`button`,className:WN({small:!0}),disabled:t.at>=t.urls.length-1,title:R(`browser.forward`),"aria-label":R(`browser.forward`),onClick:()=>r(t.at+1),children:(0,B.jsx)(HP,{d:`M6 3.5 10.5 8 6 12.5`})}),(0,B.jsx)(`button`,{type:`button`,className:WN({small:!0}),disabled:!x,title:R(`browser.reload`),"aria-label":R(`browser.reload`),onClick:()=>u(l+1),children:(0,B.jsx)(HP,{d:`M12.5 8a4.5 4.5 0 1 1-1.4-3.3M12.5 2.5v2.7H9.8`})}),(0,B.jsx)(`input`,{className:`browser-url mono ${uP}`,value:a,placeholder:R(`browser.placeholder`),"aria-label":R(`browser.address`),"aria-invalid":s,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,inputMode:`url`,onChange:e=>o(e.target.value)}),i?(0,B.jsx)(`a`,{className:WN({small:!0}),href:i,target:`_blank`,rel:`noopener noreferrer`,title:R(`browser.openTab`),"aria-label":R(`browser.openTab`),children:(0,B.jsx)(HP,{d:UP})}):(0,B.jsx)(`button`,{type:`button`,className:WN({small:!0}),disabled:!0,"aria-label":R(`browser.openTab`),children:(0,B.jsx)(HP,{d:UP})})]}),x?(0,B.jsx)(`iframe`,{className:dP,src:i,title:i,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,referrerPolicy:`no-referrer`},`${i}#${l}`):S?(0,B.jsx)(`p`,{className:sP,children:S}):null]})}var GP=`scrollbar-none flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3`,KP=`m-0 p-3 font-mono text-meta text-muted`,qP=`flex items-baseline justify-between gap-3 font-mono text-meta normal-nums`,JP=`flex h-1.5 w-full gap-px overflow-hidden rounded-full bg-inset`,YP=`h-full min-w-[2px] flex-none`,XP=`m-0 flex list-none flex-col p-0`,ZP=`-mx-1 flex h-5.5 min-w-0 items-center gap-2 rounded-xs px-1 font-mono text-meta normal-nums`,QP=`mt-2`,$P=`size-2 flex-none rounded-full bg-line`,eF=`flex min-w-0 flex-1 items-center gap-1.5`,tF=`min-w-0 truncate text-muted`,nF=`w-[7ch] flex-none text-right text-ink`,rF=`w-[6ch] flex-none text-right text-muted`,iF=`group/fold`,aF=`${ZP} cursor-pointer list-none hover:bg-hover focus-visible:outline focus-visible:outline-1 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,oF=`m-0 flex list-none flex-col p-0`,sF=`${ZP} pl-5`,cF=`flex min-w-0 flex-1 overflow-hidden`,lF=`min-w-0 truncate text-subtle`,uF=`flex-none text-muted`,dF=`w-[7ch] flex-none text-right text-muted`,fF=`w-[6ch] flex-none`,pF=1e4,mF={system:`var(--info)`,system_prompt:`var(--info)`,system_tools:`var(--success)`,mcp_tools:`var(--warning)`,mcp_instructions:`var(--warning)`,custom_agents:`var(--ink)`,memory_files:`var(--merged)`,skills:`var(--muted)`,messages:`var(--accent)`,used:`var(--accent)`},hF=[`var(--info)`,`var(--success)`,`var(--warning)`,`var(--merged)`];function gF({model:e,task:t,active:n}){z();let r=y(e.client.conn),i=y(e.selection),a=y(e.tabs)[t.id]??[],o=i.taskId===t.id?a.find(e=>e.id===i.tabId):void 0,s=(o?.kind===`engine`?o:a.find(e=>e.kind===`engine`))?.id??null,[c,l]=(0,h.useState)({kind:`loading`}),[u,d]=(0,h.useState)(!1),f=(0,h.useRef)(``);if((0,h.useEffect)(()=>{if(!n||r.state!==`open`)return;let i=`${t.id}::${s}`;if(f.current!==i&&l({kind:`loading`}),f.current=i,!s){l({kind:`ready`,meter:null});return}let a=!0,o=n=>e.client.request(`context.usage`,{taskId:t.id,tabId:s,probe:n}).then(e=>a&&l({kind:`ready`,meter:e.meter})).catch(e=>a&&l(t=>t.kind===`ready`?t:{kind:`failed`,error:oT(e)})),c=()=>{d(!0),o(!0).finally(()=>a&&d(!1))};o(!1).then(c);let u=ni(pF,c);return()=>{a=!1,d(!1),u()}},[e,n,r.state,t.id,s]),c.kind===`loading`)return(0,B.jsx)(`p`,{className:KP,children:R(`context.loading`)});if(c.kind===`failed`)return(0,B.jsx)(`p`,{className:KP,children:R(`context.failed`,{error:c.error})});if(!c.meter)return(0,B.jsx)(`p`,{className:KP,children:R(`context.none`)});let p=c.meter,m=p.rows.filter(e=>e.share!==void 0),g=e=>e.share===void 0?void 0:mF[e.key]??hF[m.indexOf(e)%hF.length],_=`${p.approximate?`~`:``}${vF(p.used)}`;return(0,B.jsxs)(`div`,{className:GP,children:[(0,B.jsxs)(`div`,{className:qP,children:[(0,B.jsx)(`span`,{className:`text-ink`,children:p.percent===null?R(`context.usedTokens`,{tokens:_}):R(`context.used`,{percent:yF(p.percent)})}),p.window!==null&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[_,` / `,vF(p.window)]})]}),(0,B.jsx)(`div`,{className:JP,role:`meter`,"aria-valuenow":Math.round(p.percent??100),"aria-valuemin":0,"aria-valuemax":100,children:m.map(e=>(0,B.jsx)(`span`,{className:YP,style:{width:`${e.share}%`,background:g(e)}},e.key))}),(0,B.jsx)(`ul`,{className:XP,children:p.rows.map((e,t)=>{let n=`context.part.${e.key}`,r=R(n)===n?e.label??e.key:R(n),i=g(e),a=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:$P,style:i?{background:i}:void 0}),(0,B.jsxs)(`span`,{className:eF,children:[(0,B.jsx)(`span`,{className:tF,title:r,children:r}),e.items&&(0,B.jsx)(`span`,{className:`inline-block flex-none text-subtle group-open/fold:rotate-90`,children:`›`})]}),(0,B.jsx)(`span`,{className:nF,children:vF(e.tokens)}),(0,B.jsx)(`span`,{className:rF,children:e.deferred?`—`:yF(e.tokens/(p.window??p.used)*100)})]}),o=(e.deferred?!p.rows[t-1]?.deferred:e.share===void 0)?QP:void 0;if(!e.items)return(0,B.jsx)(`li`,{className:o,children:(0,B.jsx)(`div`,{className:ZP,children:a})},e.key);let s=e.items.reduce((e,t)=>e+t.tokens,0),c=(e.itemCount??e.items.length)-e.items.length;return(0,B.jsx)(`li`,{className:o,children:(0,B.jsxs)(`details`,{className:iF,children:[(0,B.jsx)(`summary`,{className:aF,children:a}),(0,B.jsxs)(`ul`,{className:oF,children:[e.items.map(e=>(0,B.jsx)(_F,{name:e.name,tokens:e.tokens},e.name)),c>0&&(0,B.jsx)(_F,{name:R(`context.more`,{count:c}),tokens:e.tokens-s})]})]})},e.key)})}),u&&m.length<2&&(0,B.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:R(`context.probing`)})]})}function _F({name:e,tokens:t}){let n=e.lastIndexOf(`/`)+1;return(0,B.jsxs)(`li`,{className:sF,title:e,children:[(0,B.jsxs)(`span`,{className:cF,children:[n>0&&(0,B.jsx)(`span`,{className:`min-w-0 truncate text-subtle`,children:e.slice(0,n)}),(0,B.jsx)(`span`,{className:n>0?uF:lF,children:e.slice(n)})]}),(0,B.jsx)(`span`,{className:dF,children:vF(Math.max(0,t))}),(0,B.jsx)(`span`,{className:fF})]})}function vF(e){return e>=1e6?`${+(e/1e6).toFixed(1)}M`:e>=1e3?`${+(e/1e3).toFixed(1)}k`:String(e)}function yF(e){return e>0&&e<.1?`<0.1%`:`${e<10?+e.toFixed(1):Math.round(e)}%`}var bF=3;function xF({model:e,task:t}){z();let n=t.autoFixCi,r=n=>void e.client.request(`task.autoFixCi`,{taskId:t.id,enabled:n}).catch(e=>F(e instanceof Error?e.message:String(e),`error`));return(0,B.jsx)(`div`,{className:`flex items-center gap-3 px-2 pt-1 font-mono text-meta`,children:n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:n.stopped?hf.attention:`text-muted`,title:R(`files.autoFix.hint`),children:R(n.stopped?`files.autoFix.stopped`:`files.autoFix.count`,{n:n.attempts,max:bF})}),(0,B.jsx)(V,{hit:`tight`,onClick:()=>r(!1),children:R(`files.autoFix.off`)})]}):(0,B.jsx)(V,{hit:`tight`,title:R(`files.autoFix.hint`),onClick:()=>r(!0),children:R(`files.autoFix.on`)})})}function SF(e){let t=e.pr;return!!t&&t.number!==void 0&&!e.machine&&(t.lifecycle===`open`||t.lifecycle===`ready_to_merge`)}function CF(e){let t={fail:0,pending:0,pass:0,skipped:0};for(let n of e)t[n.state]++;return t}function wF(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}function TF(e,t){let{startedAt:n,completedAt:r,durationMs:i}=e;return e.state===`pending`?n?{key:`files.checks.runningFor`,vars:{elapsed:wF(t-n)}}:null:i===null?r?{key:`files.checks.finishedAgo`,vars:{age:Wc(t-r)}}:null:r?{key:`files.checks.tookAgo`,vars:{duration:wF(i),age:Wc(t-r)}}:{key:`files.checks.took`,vars:{duration:wF(i)}}}function EF(e){let t=[],n=e.mergeState.toUpperCase();e.draft&&t.push({key:`files.merge.draft`,tone:`warning`}),e.mergeable.toUpperCase()===`CONFLICTING`||n===`DIRTY`?t.push({key:`files.merge.conflicts`,tone:`attention`}):n===`BEHIND`?t.push({key:`files.merge.behind`,tone:`warning`}):n===`UNSTABLE`?t.push({key:`files.merge.unstable`,tone:`warning`}):n===`BLOCKED`?t.push({key:`files.merge.blocked`,tone:`warning`}):n===`CLEAN`&&!e.draft&&t.push({key:`files.merge.clean`,tone:`success`});let r=e.review.toUpperCase();return r===`APPROVED`?t.push({key:`files.merge.approved`,tone:`success`}):r===`CHANGES_REQUESTED`?t.push({key:`files.merge.changes`,tone:`attention`}):r===`REVIEW_REQUIRED`&&t.push({key:`files.merge.reviewRequired`,tone:`warning`}),t}var DF=`flex flex-col gap-0.5 px-2 pb-2 font-mono text-meta`,OF=`flex items-start gap-2`,kF=`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 text-left text-ink`,AF={pass:{glyph:`✓`,tone:`success`},fail:{glyph:`✗`,tone:`attention`},pending:{glyph:`●`,tone:`warning`},skipped:{glyph:`–`,tone:`muted`}};function jF({model:e,task:t}){z();let n=t.pr,r=t.id,[i,a]=(0,h.useState)(()=>Y(e,`pr.checks`,{taskId:r})??null),[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)({}),[u,d]=(0,h.useState)(0),f=`${n?.number}:${n?.checkState}:${n?.mergeable}:${n?.reviewDecision}`;(0,h.useEffect)(()=>{let t=!0,n={taskId:r};return e.client.request(`pr.checks`,u>0?{...n,fresh:!0}:n).then(r=>{t&&($l(e,`pr.checks`,n,r),a(r))},e=>t&&a({outcome:`unavailable`,detail:e instanceof Error?e.message:String(e)})),()=>{t=!1}},[e,r,f,u]);let p=t=>{let n=`${t.runId}:${t.name}`;if(c[n]){l(({[n]:e,...t})=>t);return}l(e=>({...e,[n]:{state:`loading`}})),e.client.request(`pr.checkLog`,{taskId:r,runId:t.runId,job:t.name}).then(e=>e.outcome===`ok`?{state:`text`,text:e.tail}:e.outcome===`none`?{state:`note`,text:R(`files.checks.noLog`)}:{state:`note`,text:R(`files.checks.logUnavailable`,{detail:e.detail})}).catch(e=>({state:`note`,text:R(`files.checks.logUnavailable`,{detail:e instanceof Error?e.message:String(e)})})).then(e=>l(t=>n in t?{...t,[n]:e}:t))},m=(0,B.jsx)(V,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>d(e=>e+1),children:R(`files.checks.refresh`)});if(!i)return(0,B.jsx)(`div`,{className:DF,children:(0,B.jsx)(`div`,{className:OF,children:(0,B.jsxs)(`span`,{className:`flex-1 text-muted`,children:[R(`files.checks.title`),` `,R(`files.checks.loading`)]})})});if(i.outcome!==`ok`)return(0,B.jsx)(`div`,{className:DF,children:(0,B.jsxs)(`div`,{className:OF,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 text-muted wrap-anywhere`,children:i.outcome===`none`?R(`files.checks.none`):R(`files.checks.unavailable`,{detail:i.detail})}),m]})});let g=CF(i.checks),_=Date.now(),v=o??(g.fail>0||g.pending>0),y=EF(i);return(0,B.jsxs)(`div`,{className:DF,children:[(0,B.jsxs)(`div`,{className:OF,children:[(0,B.jsxs)(V,{variant:`row`,className:kF,"aria-expanded":v,disabled:i.total===0,onClick:()=>s(!v),children:[i.total>0&&(0,B.jsx)(wo,{right:!v}),(0,B.jsx)(`span`,{children:i.total===0?R(`files.checks.none`):R(`files.checks.summary`,{pass:g.pass+g.skipped,total:i.total})}),g.fail>0&&(0,B.jsx)(`span`,{className:hf.attention,children:R(`files.checks.failed`,{count:g.fail})}),g.pending>0&&(0,B.jsx)(`span`,{className:hf.warning,children:R(`files.checks.running`,{count:g.pending})}),y.map(e=>(0,B.jsx)(`span`,{className:hf[e.tone],children:R(e.key)},e.key))]}),m]}),v&&i.checks.map(e=>{let{glyph:t,tone:n}=AF[e.state],r=TF(e,_),i=`${e.runId}:${e.name}`,a=c[i];return(0,B.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline gap-2 pl-4`,children:[(0,B.jsx)(`span`,{className:`w-[1ch] flex-none text-center ${hf[n]}`,children:t}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),r&&(0,B.jsx)(`span`,{className:`flex-none text-subtle`,children:R(r.key,r.vars)}),e.state===`fail`&&e.runId&&(0,B.jsx)(V,{hit:`tight`,className:`flex-none whitespace-nowrap`,onClick:()=>p(e),children:R(a?`files.checks.hideLog`:`files.checks.log`)})]}),a&&(0,B.jsx)(`pre`,{className:`m-0 ml-4 mb-1 max-h-40 overflow-y-auto rounded-sm border-hairline border-line bg-inset px-2 py-1.5 whitespace-pre-wrap wrap-anywhere text-muted`,children:a.state===`loading`?R(`files.checks.loading`):a.text})]},`${e.name}:${e.url}`)}),v&&i.total>i.checks.length&&(0,B.jsx)(`span`,{className:`pl-4 text-subtle`,children:R(`files.checks.more`,{count:i.total-i.checks.length})})]})}function MF({model:e,task:t}){return SF(t)?(0,B.jsxs)(`div`,{onKeyDown:e=>e.stopPropagation(),children:[(0,B.jsx)(jF,{model:e,task:t}),(0,B.jsx)(xF,{model:e,task:t})]}):null}var NF=[`renamed`,`added`,`untracked`,`modified`,`deleted`,`conflict`],PF={U:`conflict`,D:`deleted`,M:`modified`,T:`modified`,"?":`untracked`,A:`added`,R:`renamed`,C:`renamed`},FF={conflict:`attention`,deleted:`attention`,modified:`warning`,untracked:`success`,added:`success`,renamed:`accent`},IF={conflict:`!`,deleted:`D`,modified:`M`,untracked:`U`,added:`A`,renamed:`R`};function LF(e){let t=new Map;for(let n of[`branch`,`working`])for(let r of e){let e=r.scope===n?PF[r.status]:void 0;e&&t.set(r.path,e)}let n=new Map(t);for(let[e,r]of t)for(let t=e.indexOf(`/`);t>=0;t=e.indexOf(`/`,t+1)){let i=e.slice(0,t+1),a=n.get(i);(a===void 0||NF.indexOf(r)>NF.indexOf(a))&&n.set(i,r)}return n}function RF(e,t){return e.some(e=>e.scope===`working`&&e.path===t&&e.status!==`?`)}function zF(e,t){let n={children:new Map,file:!1};for(let t of e){let e=n;for(let n of t.split(`/`)){let t=e.children.get(n);t||(t={children:new Map,file:!1},e.children.set(n,t)),e=t}e.file=!0}let r=[],i=(e,n,a)=>{let o=[...e.children].sort(([e,t],[n,r])=>{let i=t.children.size>0&&!t.file;return i===(r.children.size>0&&!r.file)?e.localeCompare(n):i?-1:1});for(let[e,s]of o){let o=s.children.size>0&&!s.file,c=o?`${n}${e}/`:`${n}${e}`,l=o&&t.has(c);r.push({path:c,name:e,depth:a,dir:o,open:l}),l&&i(s,c,a+1)}};return i(n,``,0),r}var BF={start:`\x1B[200~`,end:`\x1B[201~`};function VF(e,t){return e.engineTarget(t).tabId??e.tabs.get()[t]?.find(e=>e.kind===`engine`)?.id}async function HF(e,t,n){let r=VF(e,t);if(!r)return F(R(`files.stripNoEngine`),`error`),!1;try{return e.selection.get().tabId!==r&&e.select(t,r),await e.client.request(`term.input`,{stream:eu(t,r),data:`${BF.start}${n}${BF.end}`}),F(R(`files.stripFilled`)),!0}catch(e){return F(e instanceof Error?e.message:String(e),`error`),!1}}function UF(e){let t=e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived,n=e.changes;return t&&!!n&&`added`in n&&n.added+n.deleted>0}function WF(e){return[...UF(e)?[`commit`]:[],...GF(e)]}function GF(e){let t=e.pr;if(!t)return e.kind===`task`&&!e.noWorktree&&!e.machine&&!e.archived&&!e.sessionPrs?.length?[`createPR`]:[];if(t.lifecycle===`merged`)return e.archived||e.kind===`main`?[]:[`archive`];if(t.lifecycle!==`open`&&t.lifecycle!==`ready_to_merge`)return[];let n=[];return((t.mergeable??``).toUpperCase()===`CONFLICTING`||e.prChip===`conflict`)&&n.push(`conflicts`),t.checkState===`failing`&&n.push(`fixCI`),(t.reviewDecision??``).toUpperCase()===`CHANGES_REQUESTED`&&n.push(`comments`),n}async function KF(e,t,n){try{let r=await e.client.request(`task.prompt`,{taskId:t.id,kind:n});r.outcome===`unavailable`?F(R(`files.stripUnavailable`,{detail:r.detail??``}),`error`):r.outcome===`none`||!r.prompt?F(R(`files.stripNothing`),`error`):await HF(e,t.id,r.prompt)}catch(e){F(e instanceof Error?e.message:String(e),`error`)}}var qF={commit:`files.stripCommit`,createPR:`files.stripCreate`,conflicts:`files.stripConflicts`,fixCI:`files.stripFixCi`,comments:`files.stripComments`,archive:`files.stripArchive`};function JF({model:e,task:t}){let n=WF(t);return n.length===0?null:(0,B.jsx)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:n.map(n=>(0,B.jsx)(V,{onClick:()=>n===`archive`?void D_(e,t):void KF(e,t,n),children:R(qF[n])},n))})}function YF(e){return e instanceof Ed&&e.code===`NOT_CONNECTED`?R(`workspace.connect.notConnected`):e instanceof Error?e.message:String(e)}var XF=2e3;function ZF({model:e,task:t}){z();let n=t.id,r=!t.machine,[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(!1),c=i?.running===!0;if((0,h.useEffect)(()=>{if(!r)return;let t=!0,i=()=>e.client.request(`run.status`,{taskId:n}).then(e=>t&&a(e),()=>{});i();let o=c?window.setInterval(()=>void i(),XF):0;return()=>{t=!1,window.clearInterval(o)}},[e,n,r,c]),!r||!i?.script)return null;let l=async t=>{s(!0);try{a(await e.client.request(t,{taskId:n}))}catch(e){F(e instanceof Error?e.message:String(e),`error`)}finally{s(!1)}};return(0,B.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-x-3.5 gap-y-1 px-2 pb-2 font-mono text-meta whitespace-nowrap`,children:[i.url&&(0,B.jsx)(V,{onClick:()=>i.url&&Zs(n,i.url),children:R(`files.run.open`,{port:i.port??``})}),(0,B.jsx)(V,{disabled:o,onClick:()=>void l(c?`run.stop`:`run.start`),children:R(c?`files.run.stop`:`files.run.run`)})]})}function QF({model:e,task:t,narrow:n=!1}){z();let[r,i]=(0,h.useState)(()=>Y(e,`files.list`,{taskId:t.id})?.files??null),[a,o]=(0,h.useState)(()=>LF(Y(e,`diff.files`,{taskId:t.id})?.files??[])),[s,c]=(0,h.useState)(null),[l,u]=(0,h.useState)(new Set),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)(0),g=(0,h.useRef)(null),_=y(te),v=y(e.client.conn),b=JSON.stringify(t.changes??null);(0,h.useEffect)(()=>{let n=!0;return X(e,`files.list`,{taskId:t.id}).then(e=>{n&&(i(e.files),c(null))},e=>n&&c(YF(e))),()=>{n=!1}},[e,t.id,b,p,v.state]),(0,h.useEffect)(()=>{let n=!0;return X(e,`diff.files`,{taskId:t.id}).then(e=>n&&o(LF(e.files)),()=>{}),()=>{n=!1}},[e,t.id,b,p,v.state]);let x=r!==null,S=zF(r??[],l).map(e=>({path:e.path,label:e.name,depth:e.depth,dir:e.dir,open:e.open,state:a.get(e.path)})),C=Math.min(d,Math.max(0,S.length-1)),w=S[C],T=(e,t)=>u(n=>{let r=new Set(n);return t??!r.has(e)?r.add(e):r.delete(e),r}),E=e=>Xs(t.id,e),D=e=>Ys({taskId:t.id,path:e,scope:`working`}),O=n=>{if(!_?.startsWith(`${t.id}::`)){F(R(`files.mentionNoEngine`),`error`);return}e.client.request(`term.input`,{stream:_,data:`@${n} `}).catch(e=>F(String(e),`error`))},k=n=>t.machine?F(R(`files.remoteNoExternal`,{host:t.machine.label}),`error`):void e.client.request(`file.openExternal`,{taskId:t.id,path:n}).then(()=>F(R(`taskops.openedExternal`))).catch(e=>F(e instanceof Error?e.message:String(e),`error`));return(0,B.jsxs)(`div`,{className:`group/pane flex min-h-0 min-w-0 flex-1 flex-col outline-none ${n?`px-1.5 pt-2.5 pb-2`:`pt-0.5 pr-1.5 pb-1.5 pl-0`}`,tabIndex:0,ref:g,onKeyDown:e=>{let t=e.key;if(t===`j`||t===`ArrowDown`)f(Math.min(S.length-1,C+1));else if(t===`k`||t===`ArrowUp`)f(Math.max(0,C-1));else if((t===`l`||t===`ArrowRight`)&&w?.dir)T(w.path,!0);else if((t===`h`||t===`ArrowLeft`)&&w?.dir)T(w.path,!1);else if(t===`r`)m(e=>e+1);else if(t===`D`&&e.shiftKey)D(`.`);else if(t===`d`&&w)D(w.path);else if(t===`Enter`&&w)w.dir?T(w.path):E(w.path);else if(t===`a`&&w)O(w.path);else if(t===`o`&&w&&!w.dir)k(w.path);else return;e.preventDefault()},children:[(0,B.jsx)(JF,{model:e,task:t}),(0,B.jsx)(MF,{model:e,task:t}),(0,B.jsx)(ZF,{model:e,task:t}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[s&&(0,B.jsx)(`p`,{className:`mono text-error`,children:s}),!s&&x&&S.length===0&&(0,B.jsx)(`p`,{className:`mx-2.5 my-3 font-mono text-meta text-subtle`,children:R(`files.emptyAll`)}),S.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,className:Ur({selected:t===C,size:n?`file-narrow`:`file`}),style:{paddingLeft:8+e.depth*14},title:e.path,onClick:()=>{f(t),g.current?.focus(),e.dir?T(e.path):E(e.path)},children:[(0,B.jsx)(`span`,{className:Jr,children:e.dir?(0,B.jsx)(wo,{right:!e.open}):null}),(0,B.jsx)(`span`,{className:`${Wr} ${e.state?hf[FF[e.state]]:``}`,children:e.label}),e.state&&(0,B.jsx)(`span`,{className:`w-[1ch] flex-none text-center font-mono ${hf[FF[e.state]]}`,title:R(`files.state.${e.state}`),children:e.dir?`•`:IF[e.state]})]},e.path))]})]})}var $F={md:`md`,markdown:`md`,html:`html`,htm:`html`,svg:`svg`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,webp:`image`,pdf:`pdf`};function eI(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<0?null:$F[t.slice(n+1).toLowerCase()]??null}function tI(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var nI=e=>new TextDecoder().decode(tI(e));function rI(e,t){if(e===`svg`)return`image/svg+xml`;if(e===`pdf`)return`application/pdf`;let n=t.slice(t.lastIndexOf(`.`)+1).toLowerCase();return n===`jpg`||n===`jpeg`?`image/jpeg`:n===`gif`?`image/gif`:n===`webp`?`image/webp`:`image/png`}var iI=`default-src 'none'; img-src data:; style-src 'unsafe-inline'`;function aI(e){let t=`<meta http-equiv="Content-Security-Policy" content="${iI}">`,n=/^\s*<!doctype[^>]*>/i.exec(e);return n?`${n[0]}${t}${e.slice(n[0].length)}`:`${t}${e}`}var oI=/^\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)/,sI=/^https?:\/\/[^\s<>)\]]+/,cI=/[\p{L}\p{N}]/u;function lI(e){let t=[],n=``,r=()=>{n&&t.push({t:`text`,v:n}),n=``},i=0;for(;i<e.length;){let a=e.slice(i),o=e[i]??``;if(o==="`"){let n=e.indexOf("`",i+1);if(n>i+1){r(),t.push({t:`code`,v:e.slice(i+1,n)}),i=n+1;continue}}else if(a.startsWith(`**`)){let n=e.indexOf(`**`,i+2);if(n>i+2){r(),t.push({t:`bold`,c:lI(e.slice(i+2,n))}),i=n+2;continue}}else if(o===`*`||o===`_`&&!cI.test(e[i-1]??``)){let n=e.indexOf(o,i+1);if(n>i+1&&!/\s/.test(e[i+1]??` `)&&(o===`*`||!cI.test(e[n+1]??``))){r(),t.push({t:`em`,c:lI(e.slice(i+1,n))}),i=n+1;continue}}else if(o===`[`){let e=oI.exec(a);if(e){r(),t.push({t:`link`,href:e[2],c:lI(e[1])}),i+=e[0].length;continue}}else if(o===`h`&&!cI.test(e[i-1]??``)){let e=sI.exec(a);if(e){let n=e[0].replace(/[.,;:!?]+$/,``);r(),t.push({t:`link`,href:n,c:[{t:`text`,v:n}]}),i+=n.length;continue}}n+=o,i++}return r(),t}var uI=/^\s*(```+|~~~+)\s*([\w+#.-]*)\s*$/,dI=/^(#{1,6})\s+(.*?)\s*#*\s*$/,fI=/^(\s*)([-*+])\s+(.*)$/,pI=/^(\s*)\d+[.)]\s+(.*)$/,mI=/^\s*([-*_])(\s*\1){2,}\s*$/,hI=/^\s*\|.*\|\s*$/,gI=/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/,_I=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());function vI(e){let t=e.replace(/\r\n?/g,`
43
43
  `).split(`
44
44
  `),n=[],r=[],i=()=>{r.length>0&&n.push({t:`para`,c:lI(r.join(`
45
45
  `))}),r=[]};for(let e=0;e<t.length;e++){let a=t[e],o=uI.exec(a);if(o){i();let r=o[1][0],a=[];for(e++;e<t.length&&!RegExp(`^\\s*${r}{3,}\\s*$`).test(t[e]);e++)a.push(t[e]);n.push({t:`code`,lang:o[2]??``,v:a.join(`
@@ -60,4 +60,4 @@ This worktree is at the PR's head ({head}, going into {base}). Read the change a
60
60
  `)})]}):(0,B.jsxs)(`div`,{className:yI,children:[(0,B.jsxs)(`div`,{className:bI,children:[(0,B.jsx)(`input`,{className:`${sr} ${xI}`,value:a,placeholder:R(`transcript.findPlaceholder`),"aria-label":R(`transcript.findPlaceholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:k}),a.trim()!==``&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`whitespace-nowrap text-muted`,children:b.length===0?R(`transcript.findNone`):R(`transcript.findCount`,{at:x+1,total:b.length})}),(0,B.jsx)(V,{onClick:()=>O(-1),disabled:b.length===0,children:R(`transcript.prev`)}),(0,B.jsx)(V,{onClick:()=>O(1),disabled:b.length===0,children:R(`transcript.next`)})]}),(0,B.jsx)(V,{onClick:()=>void te(),disabled:_.length===0,children:R(`transcript.export`)})]}),(0,B.jsxs)(`div`,{ref:d,className:SI,onScroll:e=>{let t=e.currentTarget;f.current=t.scrollHeight-t.scrollTop-t.clientHeight<WR,t.scrollTop<WR&&g?.older&&!r.paging&&D()},children:[g?.older&&(0,B.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:(0,B.jsx)(V,{onClick:()=>void D(),disabled:r.paging,children:R(`transcript.older`)})}),_.length===0&&(0,B.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:R(`transcript.empty`)}),_.map(e=>(0,B.jsx)(JR,{entry:e,failed:v,needle:a,flash:l===e.index,current:S===e.index,onCopy:()=>ee(e)},e.index))]})]})}var XR={working:`review.scopeWorking`,branch:`review.scopeBranch`,task:`review.scopeTask`};function ZR(e){return e.kind===`file`?{text:Xo(e.path),hint:e.path}:e.kind===`diff`?e.path===`.`?{text:R(XR[e.scope]),hint:R(`preview.whole`)}:{text:Xo(e.path),hint:e.path}:{text:R(`panel.${e.kind}`),hint:R(`panel.${e.kind}`)}}function QR({taskId:e,kind:t,expand:n}){z();let r=y(_s),i=R(r?`panel.restore`:`panel.expand`);return(0,B.jsxs)(B.Fragment,{children:[n&&(0,B.jsx)(`button`,{type:`button`,className:WN({tool:!0}),title:i,"aria-label":i,"aria-pressed":r,onClick:()=>_s.set(!r),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:r?`M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4`:`M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5l-4.5 4.5M2.5 13.5 7 9`})})}),(0,B.jsx)(`button`,{type:`button`,className:WN({tool:!0}),title:R(`panel.close`),"aria-label":R(`panel.close`),onClick:()=>$s(e,t),children:(0,B.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function $R({taskId:e,column:t,narrow:n}){if(z(),t.kind===`browser`)return(0,B.jsxs)(`div`,{className:XN(n),children:[(0,B.jsx)(SP,{taskId:e,column:t}),!n&&(0,B.jsx)(QR,{taskId:e,kind:`browser`,expand:!0})]});if(n&&t.kind!==`diff`)return null;let{text:r,hint:i}=ZR(t);return(0,B.jsxs)(`div`,{className:XN(n),children:[(0,B.jsx)(`span`,{className:ZN,title:i,children:r}),(0,B.jsx)(QR,{taskId:e,kind:t.kind,expand:!n})]})}function ez({model:e,task:t,column:n}){let r=(0,h.useRef)([]);return r.current=Wo(r.current,n.active,n.tabs),n.tabs.filter(e=>r.current.includes(e.id)).map(r=>(0,B.jsx)(`div`,{className:oP,hidden:r.id!==n.active,children:(0,B.jsx)(WP,{model:e,tab:r,onNavigate:e=>ec(t.id,t=>Ro(t,r.id,e)),onStep:e=>ec(t.id,t=>zo(t,r.id,e))})},r.id))}function tz({model:e,task:t,column:n,narrow:r,restored:i}){return n.kind===`browser`?(0,B.jsx)(ez,{model:e,task:t,column:n}):(0,B.jsxs)(`div`,{className:oP,children:[n.kind===`files`&&(0,B.jsx)(QF,{model:e,task:t,narrow:r}),n.kind===`chat`&&(0,B.jsx)(YR,{model:e,task:t,active:!0}),n.kind===`quota`&&(0,B.jsx)(gF,{model:e,task:t,active:!0}),n.kind===`file`&&(0,B.jsx)(TR,{model:e,view:{taskId:t.id,path:n.path,scope:`working`,file:!0},active:!0,restored:i,onClose:()=>$s(t.id,`file`)},`${t.id}:file:${n.path}:${n.at??``}`),n.kind===`diff`&&(0,B.jsx)(TR,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:!0,restored:i,onClose:()=>$s(t.id,`diff`)},`${t.id}:${n.path}:${n.scope}:${n.at??``}`)]})}function nz({taskId:e,kinds:t,index:n,body:r,slot:i}){z();let a=(0,h.useRef)(null);return(0,B.jsx)(`div`,{className:aP,style:{gridColumn:i},title:R(`panel.resizeSplit`),onPointerDown:e=>{let n=t.map(e=>r.current?.querySelector(`[data-kind="${e}"]`)?.getBoundingClientRect().width??0);a.current={x:e.clientX,widths:n},r.current?.classList.add(`is-resizing`),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:t=>{let r=a.current;if(!r)return;let i=us(r.widths,n,t.clientX-r.x,220);Ks(e,e=>cs(e,i))},onLostPointerCapture:()=>{a.current=null,r.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>Ks(e,ls)})}function rz({panel:e}){z();let t=(0,h.useRef)(null);return(0,B.jsx)(CP,{edge:`left`,title:R(`panel.resize`),onPointerDown:n=>{t.current={x:n.clientX,width:e.current?.getBoundingClientRect().width??0},e.current?.classList.add(`is-resizing`),n.currentTarget.setPointerCapture(n.pointerId),de(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=ZA.get()?0:tj(XA.get()??280);hs.set(vs(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),de(!1)},onDoubleClick:()=>hs.set(null)})}var iz=e=>e.kind===`diff`?`diff:${e.path}:${e.scope}`:e.kind===`file`?`file:${e.path}`:e.kind;function az({model:e,task:t,narrow:n}){z();let r=Hs(t.id),i=y(fs),a=y(_s),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=i===`terminal`?`files`:i,l=n?Yo(r,c):void 0;(0,h.useEffect)(()=>{n&&!l&&Ks(t.id,e=>es(e,c))},[n,l,c,t.id]);let u=n?l?[l]:[]:r.columns,d=u.map(e=>e.kind),f=(n?[1]:ss(r)).map((e,t)=>`${t>0?`var(--divider) `:``}minmax(0, ${e}fr)`).join(` `),p=(0,h.useRef)(u.map(iz));return(0,B.jsxs)(`aside`,{className:qN(n),ref:o,children:[!n&&!a&&(0,B.jsx)(rz,{panel:o}),(0,B.jsxs)(`div`,{className:JN,ref:s,style:{gridTemplateColumns:f},children:[u.map(r=>(0,B.jsxs)(`section`,{className:YN,"data-kind":r.kind,style:{gridColumn:2*d.indexOf(r.kind)+1},children:[(0,B.jsx)($R,{taskId:t.id,column:r,narrow:n}),(0,B.jsx)(tz,{model:e,task:t,column:r,narrow:n,restored:p.current.includes(iz(r))})]},r.kind)),!n&&u.slice(1).map((e,n)=>(0,B.jsx)(nz,{taskId:t.id,kinds:d,index:n,body:s,slot:2*n+2},`divider:${e.kind}`))]})]})}function oz({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=y(A),a=Us(t?.id??null);return!r&&(i||!a)?null:t?(0,B.jsx)(az,{model:e,task:t,narrow:r},t.id):n?(0,B.jsx)(`aside`,{className:qN(!1),children:(0,B.jsx)(Np,{host:n,onMachines:()=>Vg(e)})}):null}var sz=1500;function cz({model:e}){let t=e.client,n=y(t.conn),[r,i]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(n.state!==`connecting`)return i(!1);let e=window.setTimeout(()=>i(!0),sz);return()=>window.clearTimeout(e)},[n.state]),n.state===`open`||n.state===`connecting`&&!r?null:(0,B.jsxs)(`footer`,{className:Vn,children:[(0,B.jsx)(`span`,{className:Hn(n.state===`retrying`)}),(0,B.jsx)(`span`,{children:n.state===`retrying`?R(`status.retrying`,{count:n.failures}):R(`status.connecting`)}),n.state===`retrying`&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>t.retryNow(),children:R(`status.retry`)})]})}var lz=`rove.web.update.skipped`;function uz(e){return!e.latest||!e.notify||e.latest===e.skipped||e.latest===e.asked?null:e.latest}var dz=null;function fz(){let e=Sb.get(),t=uz({latest:e?.info?.hasUpdate?e.info.latest:null,notify:U_.get().prefs.updateNotify,skipped:localStorage.getItem(lz),asked:dz});!t||C.get()!==null||(dz=t,C.set((0,B.jsx)(pz,{current:e?.current??``,latest:t,notes:e?.notes??[]})))}function pz(e){let[t]=e.notes;return(0,B.jsx)(Xr,{title:R(`updatePrompt.title`,{version:e.latest}),wide:e.notes.length>0,children:(0,B.jsxs)(`div`,{className:br,children:[(0,B.jsx)(`p`,{className:`text-muted`,children:R(`updatePrompt.body`,{current:e.current})}),e.notes.length===1&&t?(0,B.jsx)(xb,{body:t.body}):(0,B.jsx)(kb,{notes:e.notes}),(0,B.jsxs)(`div`,{className:cr,children:[(0,B.jsx)(V,{onClick:()=>{localStorage.setItem(lz,e.latest),L()},children:R(`updatePrompt.skip`)}),(0,B.jsx)(V,{onClick:L,children:R(`updatePrompt.later`)}),(0,B.jsx)(V,{variant:`filled`,autoFocus:!0,onClick:()=>{L(),Cb.set(!0),ge(`update`)},children:R(`updatePrompt.yes`)})]})]})})}function mz({model:e,taskId:t,groupId:n}){z();let r=y(e.tasks),i=r?Gw(r.tasks,n):[];return i.length<2||!i.some(e=>e.id===t)?null:(0,B.jsxs)(`nav`,{className:ET,"aria-label":R(`compare.menu`),children:[i.map((n,r)=>(0,B.jsxs)(V,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,B.jsx)(Dx,{status:n.rowStatus}),r+1,` `,n.engine?.name??n.label,n.kept&&(0,B.jsx)(`span`,{className:`text-accent`,children:`✓`}),` ]`]},n.id)),(0,B.jsx)(V,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>_e(n),children:R(`compare.strip`)})]})}var hz=new Set,gz=2e3;function _z(e){hz.add(e)}function vz(e,t=gz){setTimeout(()=>hz.delete(e),t)}var yz=e=>hz.has(e),bz=new Map,xz=new Set,Sz=(e,t)=>`${e}/${t}`,Cz=e=>bz.get(e)??``;function wz(e,t){t===``?bz.delete(e):bz.set(e,t);for(let e of xz)e()}function Tz(e){return xz.add(e),()=>xz.delete(e)}function Ez(e,t){let n=Cz(e).trimEnd();wz(e,n===``?t:`${n}\n\n${t}`)}function Dz(e,t,n,r,i,a){let o=n.length-t.length;return{base:n,spans:[...e?.base===t?e.spans.filter(([e,t])=>t<=r||e>=i).map(([e,t])=>e>=i?[e+o,t+o]:[e,t]):[],a]}}async function Oz(e,t,n){if(n===t.base)return;let r;try{r=(await e.request(`voice.learn`,{base:t.base,spans:t.spans,sent:n})).learned??[]}catch{return}r.length!==0&&F(R(`voice.learned`,{pairs:r.map(e=>R(`voice.learnedPair`,{spoken:e.spoken,term:e.term})).join(`, `)}),`info`,{label:R(`voice.undo`),run:()=>void e.request(`voice.unlearn`,{learned:r}).then(()=>F(R(`voice.unlearned`)),()=>F(R(`voice.unlearnFailed`),`error`))})}function kz({model:e,taskId:t,tabId:n}){let r=y(e.tasks)?.tasks.find(e=>e.id===t)!==void 0,i=Sz(t,n),a=(0,h.useSyncExternalStore)(Tz,()=>Cz(i)),[o,s]=(0,h.useState)(!1),{attachments:c,attach:l,remove:u,ready:d,clear:f}=yl(e,e=>F(e,`error`)),p=(0,h.useRef)(null),m=pg(e.client),[g,_]=(0,h.useState)(!1),v=vh({value:a,onChange:e=>wz(i,e),area:p,listClassName:`m-0`}),b=(0,h.useRef)(null),x=e=>{let t=p.current,n=t?.selectionStart??a.length,r=t?.selectionEnd??a.length,o=n>0&&!/\s$/.test(a.slice(0,n))?` `:``,s=`${a.slice(0,n)}${o}${e}${a.slice(r)}`;wz(i,s);let c=n+o.length+e.length;b.current=Dz(b.current,a,s,n,r,[n+o.length,c]),requestAnimationFrame(()=>t?.setSelectionRange(c,c))},S=async e=>{let t=a.trim()?`${a.trimEnd()} ${e}`:e;await w(t)||wz(i,t)},C=e=>void S(e),w=async(r=a)=>{s(!0);try{let a=ml(r.trim(),await d()).trim();if(!a)return!1;let o=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:a});return o.delivered?(wz(i,``),f(),_(!1),b.current&&Oz(e.client,b.current,r),b.current=null,!0):(F(R(`layout.composerNotSent`,{reason:o.reason??``}),`error`),!1)}catch(e){let t=e instanceof Ed?e.code:void 0;return F(t===`UNKNOWN_OP`?R(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?R(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}finally{s(!1)}};if(!r)return null;let T=l,E={client:e.client,context:()=>({draft:a,taskId:t,tabId:n}),onText:e=>void x(e),disabled:o},D=m===!0&&!g&&a===``,O=()=>{(0,Lk.flushSync)(()=>_(!0)),p.current?.focus()};return(0,B.jsx)(Gh,{value:a,placeholder:R(`layout.composerPlaceholder`),sendLabel:R(`layout.composerSend`),busy:o,ready:a.trim()!==``||c.length>0,attached:(0,B.jsx)(bl,{attachments:c,onRemove:u}),attach:(0,B.jsxs)(fl,{className:Ah,title:R(`layout.composerAttach`),disabled:o,onFiles:T,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:R(`layout.composerAttach`)}),(0,B.jsx)(Ih,{})]}),dictate:(0,B.jsx)(hg,{...E,look:jh,face:e=>(0,B.jsx)(Uh,{state:e})}),voice:D?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(hg,{...E,onSend:C,look:Mh,onTap:O,idle:R(`voice.holdOrType`),face:e=>(0,B.jsx)(Hh,{state:e,idle:R(`voice.holdOrType`),working:R(`voice.working`),slide:R(`voice.slideToSend`),release:R(`voice.tipSend`)})}),c.length>0&&(0,B.jsx)(Lh,{label:R(`layout.composerSend`),disabled:o})]}):void 0,composerKey:i,fieldRef:p,suggest:v.list,...v.field,onPaste:dl(T).onPaste,onBlur:()=>a===``&&_(!1),onSend:()=>void w()})}var Az={up:`layout.termKeyUp`,down:`layout.termKeyDown`,left:`layout.termKeyLeft`,right:`layout.termKeyRight`,interrupt:`layout.termKeyInterrupt`,enter:`layout.termKeyEnter`};function jz({handle:e,atMenu:t}){z();let[n,r]=(0,h.useState)(!1);(0,h.useEffect)(()=>{e.armCtrl(n?()=>r(!1):null)},[e,n]),(0,h.useEffect)(()=>()=>e.armCtrl(null),[e]);let{term:i}=e,a=e=>(0,B.jsx)(`button`,{type:`button`,className:cn(!1),"aria-label":Az[e.id]?R(Az[e.id]):void 0,onClick:()=>{r(!1),i.input(e.bytes(i.modes.applicationCursorKeysMode),!0)},children:e.cap},e.id);return(0,B.jsxs)(`div`,{className:`mono ${sn}`,role:`toolbar`,"aria-label":R(`layout.termKeys`),onPointerDown:e=>e.preventDefault(),children:[t&&cf.map(a),(0,B.jsx)(`button`,{type:`button`,className:cn(n),"aria-pressed":n,onClick:()=>r(!n),children:`ctrl`}),of.filter(e=>!(t&&cf.includes(e))).map(a)]})}var Mz={background:`#141413`,foreground:`#eae7df`,cursor:`#cc785c`,cursorAccent:`#141413`,selectionBackground:`#33312e`,black:`#141413`,red:`#ec6f74`,green:`#9aca86`,yellow:`#e8c96b`,blue:`#61aaf2`,magenta:`#9b87f5`,cyan:`#d4967e`,white:`#a9a39a`,brightBlack:`#6b665f`,brightRed:`#ec6f74`,brightGreen:`#9aca86`,brightYellow:`#e8c96b`,brightBlue:`#61aaf2`,brightMagenta:`#9b87f5`,brightCyan:`#e0ab96`,brightWhite:`#eae7df`},Nz=`Rove Nerd Symbols`,Pz=[`"JetBrains Mono"`,`"${Nz}"`,`"SF Mono"`,`ui-monospace`,`Menlo`,`monospace`].join(`, `);function Fz(e){switch(e.kind){case`restored`:return R(`workspace.restored`);case`notLive`:return R(`workspace.tabNotLive`);case`exited`:return R(`workspace.exited`,{code:e.code??`?`});case`failed`:return R(`workspace.attachFailed`,{message:e.message});case`none`:return``}}function Iz(e){z();let{notice:t,engineExit:n,model:r,taskId:i,tabId:a,revive:o}=e,s=t.kind===`none`?n:null,c=t.kind===`none`&&!s&&e.usageLimit===!0&&!o.error,[l,u]=(0,h.useState)(!1);if(t.kind===`none`&&!s&&!c)return null;let d=c?r.tasks.get()?.attention.find(e=>e.taskId===i&&e.state===`rate_limited`)?.resumeAt:void 0,f=t.kind===`notLive`||t.kind===`restored`||t.kind===`exited`,p=t.kind===`exited`||s!==null,m=o.error?R(`workspace.reopenFailed`,{message:o.error}):s?R(`workspace.engineExited`,{code:s.code??`?`}):c?d?R(`workspace.usageLimitUntil`,{time:new Date(d).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}):R(`workspace.usageLimit`):Fz(t);return(0,B.jsxs)(`div`,{className:Bn(t.kind===`failed`||!!o.error),children:[(0,B.jsx)(`span`,{children:m}),e.onReopen&&(f||s)&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:o.busy,onClick:()=>e.onReopen?.(s!==null),children:o.busy?R(`workspace.reopening`):R(s?`workspace.retry`:`workspace.reopen`)}),t.kind===`failed`&&e.onRetryAttach&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:e.onRetryAttach,children:R(`workspace.retry`)}),c&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{variant:`link`,hit:`tight`,onClick:()=>C.set((0,B.jsx)(mu,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:R(`menu.continueEngine`)}),(0,B.jsx)(V,{variant:`link`,hit:`tight`,disabled:l,onClick:()=>{u(!0),r.client.request(`task.resumeQuota`,{taskId:i}).catch(e=>F(e instanceof Error?e.message:String(e),`error`)).finally(()=>u(!1))},children:R(l?`workspace.resumingQuota`:`workspace.resumeQuota`)}),(0,B.jsx)(V,{variant:`link`,hit:`tight`,onClick:e.onDismissLimit,children:R(`workspace.dismiss`)})]}),p&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>C.set((0,B.jsx)(ow,{model:r,section:`engines`})),children:R(`workspace.engineSettings`)}),(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>C.set((0,B.jsx)(mu,{model:r,taskId:i})),children:R(`menu.newChatPick`)}),(0,B.jsx)(V,{variant:`link`,hit:`tight`,onClick:()=>C.set((0,B.jsx)(mu,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:R(`menu.continueEngine`)})]})]})}function Lz(e){let t=e.split(`
61
61
  `).map(e=>e.trimEnd());for(;t[0]===``;)t.shift();for(;t.at(-1)===``;)t.pop();if(t.length===0)return null;let n=Math.max(0,...Array.from(t.join(`
62
62
  `).matchAll(/`+/g),e=>e[0].length)),r="`".repeat(Math.max(3,n+1));return`${r}\n${t.join(`
63
- `)}\n${r}\n`}function Rz(e){let t=document.querySelector(`[data-composer="${CSS.escape(e)}"]`);return t&&t.offsetParent!==null?t:null}function zz(e,t,n,r){let i=Lz(e.term.getSelection());if(i===null)return!1;let a=Sz(t,n),o=Rz(a);if(o){Ez(a,i),e.term.clearSelection();let t=o.querySelector(`textarea`);return t?.focus(),t?.setSelectionRange(t.value.length,t.value.length),!0}return r?(F(R(`quote.atMenu`),`error`),!1):e.term.modes.bracketedPasteMode?(e.term.paste(i),e.term.clearSelection(),e.term.focus(),!0):(F(R(`quote.notReady`),`error`),!1)}async function Bz(e,t,n){for(let r of n){r.size>1048576&&F(R(`layout.dropUploading`,{name:r.name}));try{t.term.paste(`${await al(e,r)} `)}catch(e){F(e instanceof Error?e.message:String(e),`error`)}}t.term.focus()}async function Vz(){if(!navigator.clipboard?.read)throw Error(R(`layout.pasteNeedsHttps`));let e=[];for(let t of await navigator.clipboard.read())for(let n of t.types)(n.startsWith(`image/`)||n===`application/pdf`)&&e.push(new File([await t.getType(n)],`clipboard`,{type:n}));return e}async function Hz(e,t){let n;try{n=await Vz()}catch(e){F(R(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?F(R(`layout.pasteNoImage`),`error`):await Bz(e,t,n)}async function Uz(e){try{return await navigator.clipboard.writeText(e),!0}catch{return F(R(`menu.copyFailed`),`error`),!1}}function Wz(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=y(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;z();let o=(0,h.useRef)(null),[s,c]=(0,h.useState)({kind:`none`}),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)({busy:!1,error:null}),g=(0,h.useRef)(e);g.current=e,pg(t);let _=e.composer===!0&&mg(t),v=(0,h.useRef)(_);v.current=_,(0,h.useEffect)(()=>{let e=o.current;if(!e)return;let a=null,s=!1,l=[document.fonts.load(`13px "JetBrains Mono"`),document.fonts.load(`bold 13px "JetBrains Mono"`)];document.fonts.load(`13px "${Nz}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||Jd({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:g.current.focused!==!1&&!v.current},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(g.current.onActivate?.(),oo.set(so(t)??null)):oo.get()?.stream===t&&oo.set(null)},onExit:()=>{yz(eu(n,r,i))||g.current.onExit?.()},copyText:Uz,pasteImage:async()=>{a&&await Hz(t,a.handle)}}).then(e=>{s?e.release():(a=e,u(e.handle))})};return qd(t,n,r,i)?d():Promise.allSettled(l).then(d),()=>{s=!0,u(null),a?.release()}},[t,n,r,i]);let[b,x]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!l)return;x(l.term.hasSelection());let e=l.term.onSelectionChange(()=>x(l.term.hasSelection()));return()=>{e.dispose(),x(!1)}},[l]),(0,h.useEffect)(()=>{if(!l)return;let{term:e,stream:a}=l,o={stream:a,focus:()=>e.focus(),input:t=>e.input(t,!0),reattach:()=>l.reattach(),scrollPages:e=>l.scrollLines(e*10),hasSelection:()=>e.hasSelection(),copySelection:()=>{let t=e.getSelection();return t.trim().length!==0&&(Uz(t),e.clearSelection(),!0)},reset:()=>{let o={cols:e.cols,rows:e.rows};C.set((0,B.jsx)($r,{title:Nc(`reset.title`),body:Nc(`reset.body`),confirmLabel:R(`workspace.reset`),onConfirm:async()=>{_z(a);try{await t.request(`tab.split`,{taskId:n,tabId:r,action:`reset`,leafId:i??`leaf-1`,...o}),await l.reattach(),e.focus()}finally{vz(a)}}}))},size:()=>({cols:e.cols,rows:e.rows})},s=K(o);return document.activeElement===e.textarea&&oo.set(o),()=>{s()}},[l,t,n,r,i]),(0,h.useEffect)(()=>{e.focused&&!_&&l&&document.activeElement!==l.term.textarea&&l.term.focus()},[e.focused,_,l]);let S=!i||i===`leaf-1`,[w,T]=(0,h.useState)(null),E=e.engineExit?.since===w,[D,O]=(0,h.useState)(null),k=e.usageLimit&&e.usageLimit.since!==D?e.usageLimit:null,ee=(0,h.useRef)(!1),te=async(i,a)=>{if(!ee.current){ee.current=!0,m({busy:!0,error:null});try{await t.request(`term.revive`,{taskId:n,tabId:r,...a?{restartExited:a}:{}}),await i.reattach(),i.term.focus(),T(e.engineExit?.since??null),m({busy:!1,error:null})}catch(e){m({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{ee.current=!1}}};return(0,B.jsxs)(`div`,{className:Pn,"data-stream":eu(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),Bz(t,l,Array.from(e.dataTransfer.files)))},onPasteCapture:e=>{if(!l)return;let n=Array.from(e.clipboardData.files);(n.length!==0||e.clipboardData.getData(`text/plain`)===``)&&(e.preventDefault(),e.stopPropagation(),n.length>0?Bz(t,l,n):Hz(t,l))},children:[(0,B.jsxs)(`div`,{className:Fn,children:[(0,B.jsx)(`div`,{className:In,ref:o}),(0,B.jsx)(Iz,{notice:s,engineExit:E?null:e.engineExit??null,model:e.model,taskId:n,tabId:r,revive:p,onReopen:S&&l?e=>void te(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0,usageLimit:k!==null,onDismissLimit:k?()=>O(k.since):void 0}),b&&e.composer&&l&&(0,B.jsx)(V,{variant:`floating`,className:`absolute top-2.5 right-2.5 z-4`,title:R(`quote.title`),onClick:()=>zz(l,n,r,a),children:R(`quote.action`)}),d>0&&l&&(0,B.jsxs)(`div`,{className:`mono absolute right-2.5 bottom-2.5 z-4 flex gap-3 rounded-sm border-hairline border-line bg-inset px-2.5 py-1 text-meta`,children:[(0,B.jsx)(`span`,{className:`text-warning`,children:Nc(`scrolledBack`,{lines:d})}),(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToTop(),children:Nc(`scrollFirst`)}),(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:Nc(`scrollLatest`)})]})]}),e.composer&&(0,B.jsx)(kz,{model:e.model,taskId:n,tabId:r}),l&&(0,B.jsx)(jz,{handle:l,atMenu:a})]})}var Gz=e=>dA(e)!==null,Kz=e=>Xu(dA(e)?.tab.split);function qz(e){let t=dA(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:cA(t.taskId,t.tab,n)}:null}Za(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:Gz,run:e=>{let t=dA(e);t&&pA(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:Gz,run:e=>{let t=dA(e);t&&pA(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:Kz,run:e=>{let t=qz(e);t&&uA(t.taskId,t.tab,t.split,Qu(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:Kz,run:e=>{let t=qz(e);t&&mA(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:Kz,run:e=>{let t=qz(e);t&&hA(e,t.taskId,t.tab,t.leaf)}}]);var Jz=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function Yz({model:e,taskId:t,tab:n}){let r=n.split;y(sA);let i=r?cA(t,n,r):`leaf-1`,a=r?$u(r,qu(n)):new Map,o=Xu(r),{prefs:s}=J_(),c=y(e.tasks)?.tasks.find(e=>e.id===t)?.tabStatus?.[n.id]??n.status,l=n.kind===`engine`&&c?.reason===`dead`?c.since:null;(0,h.useEffect)(()=>{l!==null&&e.refreshTabsNow(t)},[l,e,t]);let u=l!==null&&n.alive!==!1?{code:n.exit?.code??null,since:l}:null,d=n.kind===`engine`&&c?.reason===`rate_limited`?{since:c.since}:null;return(0,B.jsx)(`div`,{className:tn,children:(r?Zu(r.root):Jz).map(c=>(0,B.jsxs)(`div`,{className:an(o?s.splitStyle:null,{left:c.left,top:c.top,active:c.id===i}),style:{left:`calc(${c.x*100}% + var(--ml, 0px))`,top:`calc(${c.y*100}% + var(--mt, 0px))`,width:`calc(${c.w*100}% - var(--ml, 0px))`,height:`calc(${c.h*100}% - var(--mt, 0px))`},children:[(0,B.jsx)(Wz,{client:e.client,model:e,engineExit:c.id===`leaf-1`?u:null,usageLimit:c.id===`leaf-1`?d:null,composer:n.kind===`engine`&&c.id===`leaf-1`,taskId:t,tabId:n.id,leafId:c.id,focused:c.id===i,onActivate:()=>r&&lA(t,n.id,r,c.id),onExit:()=>{o?fA(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,B.jsx)(`span`,{className:on(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>LN(r,vA(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var Xz=/^[0-9a-f]{7,40}$/i;function Zz(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||(Xz.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}function Qz(e,t){let n=[];for(let r=Zz(e,t);r&&n.length<20&&!n.includes(r);r=Zz(e,r))n.unshift(r);let r=e.filter(n=>!n.deleting&&Zz(e,n)?.id===t.id).sort((e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``));if(n.length===0&&r.length===0)return null;let i=n[0]??t,a=i.baseRef&&!Xz.test(i.baseRef)?i.baseRef:null;return{nodes:[...n,t,...r],at:n.length,base:a}}var $z=e=>e.pr?.lifecycle===`merged`;function eB(e){return e.nodes.find(e=>!$z(e))??null}function tB({model:e,taskId:t}){z();let n=y(e.tasks)?.tasks??[],r=n.find(e=>e.id===t),i=r?Qz(n,r):null;if(!i)return null;let a=eB(i);return(0,B.jsxs)(`nav`,{className:ET,"aria-label":R(`compare.stackLabel`),children:[i.base&&(0,B.jsxs)(`span`,{className:`text-subtle`,children:[i.base,` ←`]}),i.nodes.map((n,r)=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-x-3.5`,children:[r>0&&(0,B.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,B.jsxs)(V,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,B.jsx)(Dx,{status:n.rowStatus}),n.label||n.title,$z(n)?(0,B.jsx)(`span`,{className:`text-accent`,children:`✓`}):n.pr?.number?(0,B.jsx)(`span`,{children:`PR`}):null,` ]`]})]},n.id)),a&&!a.machine&&(0,B.jsx)(V,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>void v_(e,a),children:R(`compare.landBottom`)})]})}function nB(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function rB({taskId:e}){z();let t=Hs(e),n=y(A),r=Us(e)&&!n;return(0,B.jsx)(`div`,{className:iP,children:ds.map(n=>{let i=r&&!!Yo(t,n);return(0,B.jsx)(`button`,{type:`button`,className:WN({on:i}),title:R(`panel.${n}`),"aria-label":R(`panel.${n}`),"aria-pressed":i,onClick:()=>Js(e,n),children:(0,B.jsx)(fP,{children:pP[n]})},n)})})}function iB({model:e,task:t,tabs:n,narrow:r}){let i=y(e.selection),{prefs:a}=J_(),o=!nB(a.tabStrip,n.length);return(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 font-mono text-meta/body transition-padding-left duration-220 ease-snap motion-reduce:transition-none rail-folded:min-h-6.5 rail-folded:pl-23`,role:`tablist`,children:[n.map((n,r)=>(0,B.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.id===i.tabId,className:`group/tab flex items-center gap-1.5 whitespace-nowrap rounded-sm px-2.5 py-1 active:scale-97 motion-reduce:active:scale-none touch:select-none touch:touch-callout-none ${o?`hidden`:``} ${n.id===i.tabId?`bg-inset text-ink`:`text-muted hover:bg-hover data-menu-open:bg-hover`}`,onClick:()=>e.select(t.id,n.id),onContextMenu:r=>LN(r,b(NA(e,t,n),R(`menu.more`))),children:[(0,B.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),qu(n)]},n.id)),!r&&(0,B.jsx)(rB,{taskId:t.id})]})}function aB(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function oB({model:e}){let t=z()===`zh`?Oi:Di,n=e.client,[r,i]=(0,h.useState)(()=>(Y(n,`worktrees.list`,{network:!0})??Y(n,`worktrees.list`,{network:!1}))?.projects??null),[a,o]=(0,h.useState)([]),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(0),d=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0,t=!1,r=r=>X(n,`worktrees.list`,{network:r}).then(n=>{if(!(!e||!r&&t)&&(r&&(t=!0),i(n.projects),r)){let e=new Set(n.projects.flatMap(e=>e.worktrees.map(e=>e.path)));o(t=>t.filter(t=>e.has(t)))}}).catch(()=>{});return r(!1),r(!0),()=>{e=!1}},[n,l]),(0,h.useEffect)(()=>d.current?.focus(),[]);let f=(r??[]).map(e=>({...e,worktrees:e.worktrees.filter(e=>!a.includes(e.path))})),p=f.flatMap(e=>e.worktrees),m=Math.min(s,Math.max(0,p.length-1));(0,h.useEffect)(()=>{d.current?.querySelector(`[data-row="${m}"]`)?.scrollIntoView({block:`nearest`})},[m]);let g=(0,h.useCallback)(()=>u(e=>e+1),[]),_=async(e,r)=>{o(t=>[...t,e.path]);try{let i=await n.request(`worktrees.remove`,{path:e.path,force:r});i.residue&&F(aB(t.delete.residue,i.residue)),g()}catch(n){o(t=>t.filter(t=>t!==e.path));let i=n&&typeof n==`object`&&`code`in n?n.code:null;if(!r&&i===`DIRTY_WORKTREE`){C.set((0,B.jsx)($r,{title:t.delete.forceTitle,body:`${aB(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${aB(t.delete.forceReason,{reason:U(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>_(e,!0)}));return}F(aB(t.delete.failed,{error:U(n)}),`error`)}},v=e=>C.set((0,B.jsx)($r,{title:t.delete.confirmTitle,body:aB(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{_(e,!1)}})),y=n=>{if(!n.taskId){F(t.land.noTask,`error`);return}v_(e,{id:n.taskId,title:n.branch,branch:n.branch},g)},b=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),O.set(null);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=p[m];if(e.key===`j`||e.key===`ArrowDown`)c(Math.min(p.length-1,m+1));else if(e.key===`k`||e.key===`ArrowUp`)c(Math.max(0,m-1));else if(e.key===`d`&&t)v(t);else if(e.key===`l`&&t)y(t);else if(e.key===`q`||e.key===`Escape`)O.set(null);else return;e.preventDefault()},x=0;return(0,B.jsxs)(`div`,{className:Iy,tabIndex:0,ref:d,onKeyDown:b,children:[(0,B.jsx)(`h1`,{className:Ly,children:t.title}),r===null?(0,B.jsx)(`p`,{className:`text-muted`,children:t.loading}):f.length===0?(0,B.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):f.map(e=>{let n=x;return x+=e.worktrees.length,(0,B.jsxs)(`section`,{className:ub,children:[(0,B.jsxs)(`h2`,{className:`mt-1.5 mr-2 mb-1 ml-0 flex items-center gap-1 font-mono text-meta font-semibold normal-nums text-subtle`,children:[(0,B.jsx)(`span`,{children:e.repo}),(0,B.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,B.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,B.jsxs)(`div`,{"data-row":i,className:db(i===m),onClick:()=>c(i),children:[(0,B.jsxs)(`div`,{className:fb,children:[(0,B.jsx)(`span`,{className:mb,children:e.branch||t.row.detached}),e.roveManaged&&(0,B.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,B.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,B.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,B.jsx)(`span`,{className:`chip ${e.branchOnRemote===!0?`text-success`:e.branchOnRemote===!1?`text-warning`:`text-muted`}`,children:e.branchOnRemote===!0?t.badge.remoteOn:e.branchOnRemote===!1?t.badge.remoteOff:t.badge.remoteUnknown}),e.verdictReason!==`dirty`&&e.verdictReason!==`fresh`&&(0,B.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,B.jsxs)(`div`,{className:`${pb} mono text-muted`,children:[(0,B.jsx)(`span`,{className:hb,children:e.path}),e.createdAtMs>0&&(0,B.jsx)(`span`,{children:aB(t.row.created,{age:Wc(Date.now()-e.createdAtMs)})})]}),i===m&&(0,B.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>v(e),children:t.delete.button}),e.taskId&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>y(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,B.jsx)(`p`,{className:`${gb} mono keys-only text-muted`,children:(0,B.jsx)(mf,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function sB({model:e,narrow:t}){let n=y(e.selection),r=y(e.tabs),i=y(e.tasks),a=y(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=Ra(i,n.taskId)??o??null,c=o?void 0:a.find(e=>e.id===n.taskId),l=s?r[s.id]??[]:[],u=s?s.id in r:!1,d=y(O),f=aS(s?.id),p=s?.rowStatus?.kind===`running`,m=y(M),g=y(fs)!==`terminal`&&t&&!!s;return(0,h.useEffect)(()=>{let t=e.selection.get();return e.selection.subscribe(()=>{M.set(null);let n=e.selection.get();(n.taskId!==t.taskId||n.tabId!==t.tabId)&&fs.set(`terminal`),t=n})},[e]),(0,h.useEffect)(()=>Uw(e),[e]),d===`update`?(0,B.jsxs)(`main`,{className:`${jn} ${qt}`,children:[t&&(0,B.jsx)(kP,{}),(0,B.jsx)(Mb,{client:e.client})]}):d===`worktrees`?(0,B.jsxs)(`main`,{className:`${jn} ${qt}`,children:[t&&(0,B.jsx)(kP,{}),(0,B.jsx)(oB,{model:e})]}):d?(0,B.jsxs)(`main`,{className:`${jn} ${qt}`,children:[t&&(0,B.jsx)(kP,{}),(0,B.jsx)(Ik,{model:e,page:d})]}):m?(0,B.jsxs)(`main`,{className:`${jn} ${qt}`,children:[t&&(0,B.jsx)(kP,{}),(0,B.jsx)(`div`,{className:Mn,children:(0,B.jsx)(yg,{model:e,seed:m},rh(m))})]}):(0,B.jsxs)(`main`,{className:`${jn} ${qt}`,children:[t&&(0,B.jsx)(kP,{taskId:s?.id}),s&&(0,B.jsx)(iB,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,B.jsx)(tB,{model:e,taskId:s.id}),s?.groupId&&(0,B.jsx)(mz,{model:e,taskId:s.id,groupId:s.groupId}),(0,B.jsxs)(`div`,{className:`${Mn} ${p?Nn:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,B.jsx)(IN,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,B.jsx)(`p`,{className:kn,children:R(`workspace.pickTask`)}),c?.machine&&(0,B.jsx)(`div`,{className:An,children:(0,B.jsx)(Np,{host:c.machine.label,onMachines:()=>Vg(e)})}),s&&u&&l.length===0&&!g&&(0,B.jsxs)(`div`,{className:An,children:[(0,B.jsx)(`p`,{children:R(`workspace.noTabs`)}),(0,B.jsx)(V,{variant:`filled`,onClick:()=>void lu(e,s.id,{kind:`engine`}).catch(e=>F(String(e),`error`)),children:s.engine?R(`workspace.startEngine`,{engine:s.engine.name}):R(`workspace.startSession`)}),` `,(0,B.jsx)(V,{variant:`filled`,onClick:()=>void cu(e,s.id),children:R(`menu.newChat`)}),` `,(0,B.jsx)(V,{variant:`filled`,onClick:()=>C.set((0,B.jsx)(mu,{model:e,taskId:s.id})),children:R(`menu.newChatPick`)})]}),s&&g&&(0,B.jsx)(oz,{model:e,task:s,narrow:!0}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,B.jsx)(`div`,{className:`min-w-0 flex-1 ${g?`hidden`:`flex`}`,children:(0,B.jsx)(Yz,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})]})}function cB({model:e}){z();let t=y(e.client.conn);return t.hello===null&&t.failures>=2?(0,B.jsx)(lB,{}):(0,B.jsx)(uB,{model:e})}function lB(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{vo().then(t)},[]),e===null?null:e?(0,B.jsx)(Co,{}):(0,B.jsx)(lr,{failing:!0})}function uB({model:e}){bw(e);let t=y(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;Ib(e.client,t.roveVersion);let n=()=>void Db(e.client).then(fz);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),hd(e),fd(e),po(),Ui(e.client),kw(e),na(e.client),jS(e.client),(0,h.useEffect)(()=>{e.onSelect=me;let t=M.subscribe(()=>{M.get()!==null&&me()});return re(),t},[e]),(0,h.useEffect)(()=>wC(e),[e]);let n=y(A),r=y(e.selection),i=y(e.tasks),a=y(e.remote),o=Se(),s=y(ZA),c=y(QA),l=y(XA),u=y(pe),d=y(Oe)===`app`,f=y(hs),p=y(_s),m=y(O),g=y(ce)===`drag`,_=y(M)!==null,v=a.find(e=>e.id===r.taskId&&!e.machine?.stale),b=Ra(i,r.taskId)??v??null,x=v?void 0:a.find(e=>e.id===r.taskId),S=Us(b?.id??null),C=Hs(b?.id??``).columns.length,w=o?Ce(u,!!b||!!x,m!==null||_):null;(0,h.useEffect)(()=>e.setTaskShown(w===null||w===`content`&&m===null&&!_),[e,w,m,_]);let T=tj(l??280),E=s?0:T,D=f===null?ys(C,E):vs(f,E),k={"--rail-w":`${s?0:T}px`,"--rail-open-w":`${T}px`,"--panel-w":D===null?void 0:`${D}px`};return(0,B.jsxs)(`div`,{className:Wt,children:[(0,B.jsx)(ia,{onRefresh:()=>ra(e.client)}),(0,B.jsxs)(`div`,{className:Gt({zen:n||!S||!b&&!x||o||_,expanded:p&&!n&&!o,surface:w&&d?`back`:w,folded:s&&!o,peek:s&&c&&!o,dragging:g}),style:o?void 0:k,children:[!o&&(0,B.jsx)(DP,{model:e}),s&&!o&&(0,B.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:R(`layout.railUnfold`),onMouseEnter:()=>ej(!0),onMouseLeave:()=>ej(!1),onMouseUp:()=>ZA.set(!1)}),(0,B.jsx)(RN,{model:e,narrow:o}),(0,B.jsx)(sB,{model:e,narrow:o}),!o&&(0,B.jsx)(oz,{model:e,task:b,remoteHost:x?.machine?.label}),(0,B.jsx)(cz,{model:e}),(0,B.jsx)(ko,{}),(0,B.jsx)(Tw,{model:e}),(0,B.jsx)(Ha,{model:e})]})]})}var dB=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function fB(e){return[...e.querySelectorAll(dB)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function pB(){window.addEventListener(`keydown`,e=>{if(e.key!==`Tab`||e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey)return;let t=[...document.querySelectorAll(`.overlay:not(.is-leaving)`)].at(-1);if(!t)return;let n=fB(t);if(n.length===0)return;let r=document.activeElement,i=r instanceof HTMLElement&&t.contains(r),a=e.shiftKey?n.filter(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)).at(-1)??n.at(-1):n.find(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))??n[0];e.preventDefault(),a?.focus()})}function mB(e){if(!I())for(let t of document.querySelectorAll(`${e}:not(.is-leaving)`)){let e=t.cloneNode(!0);e.classList.add(`is-leaving`),e.inert=!0,e.setAttribute(`aria-hidden`,`true`),document.body.append(e);let n=t.querySelectorAll(`*`),r=e.querySelectorAll(`*`);n.forEach((e,t)=>{let n=r[t];e.scrollTop&&(n.scrollTop=e.scrollTop),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(n.value=e.value)}),window.setTimeout(()=>e.remove(),200)}}function hB(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function gB(){for(let e of document.querySelectorAll(`.overlay:not(.is-leaving)`))for(let t of e.getAnimations())t instanceof CSSAnimation&&t.animationName===`fade-in`&&t.finish()}function _B(){let e=C.get(),t=-1/0;C.subscribe(()=>{let n=C.get();if(n===null&&e!==null)t=performance.now(),mB(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;hB(`.overlay`),n&&requestAnimationFrame(gB)}e=n});let n=S.get();S.subscribe(()=>{let e=S.get();e===null&&n!==null?mB(`.menu`):e!==null&&hB(`.menu`),n=e});let r=Cd.get().guide;Cd.subscribe(()=>{let e=Cd.get().guide;e===null&&r!==null?mB(`.prefix-guide`):e!==null&&hB(`.prefix-guide`),r=e})}var vB=500,yB=10,bB=`input, textarea, select, [contenteditable], .xterm`,xB=[`mousedown`,`mouseup`,`click`,`contextmenu`];function SB(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of xB)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of xB)document.addEventListener(t,e,!0);document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,t,!0)};document.addEventListener(`pointerdown`,r=>{if(t(),r.pointerType!==`touch`||!(r.target instanceof Element)||r.target.closest(bB))return;let i=r.target,a={x:r.clientX,y:r.clientY,native:!1,timer:window.setTimeout(()=>{e=null,!(a.native||!i.isConnected)&&(i.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:a.x,clientY:a.y,button:2})),n())},vB)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>yB&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function CB(e,t){e.viewingExtras=()=>Ss({narrow:be(),panelOpen:Ws(e.selection.get().taskId),zen:A.get()});let n=()=>e.reportViewing();gs.subscribe(n),Gs(n),A.subscribe(n),xe(n),t.on(`panel`,t=>{xs(t)&&nc(t,e.selection.get().taskId)})}function wB(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function TB({client:e,prompt:t}){let n=(z()===`zh`?ii:ri).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=Zr();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,B.jsx)(Xr,{title:t.title,children:(0,B.jsxs)(`form`,{className:br,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,B.jsx)(`input`,{className:sr,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,B.jsx)(`p`,{className:`text-error`,children:s}),(0,B.jsx)(ti,{busy:o,submitLabel:n.submitLabel})]})})}function EB(e,t){C.get()||C.set((0,B.jsx)(TB,{client:e,prompt:t},t.promptId))}var DB=900,OB=new WeakMap;function kB(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(OB.get(e)),OB.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),DB))}function AB(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&kB(t)},{capture:!0,passive:!0})}var jB=`rove-web.reloadedFor`;function MB(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function NB(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function PB(e,t=NB()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(jB)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=MB(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(jB,o.roveVersion)}catch{}t.reload()}})}function FB(){let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=()=>{t.style.setProperty(`--vvh`,`${e.height*e.scale}px`),t.toggleAttribute(`data-keyboard`,window.innerHeight-e.height*e.scale>120),e.scale===1&&window.scrollY!==0&&window.scrollTo(0,0)};e.addEventListener(`resize`,n),e.addEventListener(`scroll`,n),window.addEventListener(`scroll`,n,{passive:!0}),n()}var IB=(0,g.createRoot)(document.getElementById(`root`));FB(),SB(),Pe(),AB(),_B(),pB(),uN();function LB(e){let t=new Ad(jd(),e),n=new Ba(t);t.on(`prompt`,e=>{wB(e)&&EB(t,e)}),CB(n,t),PB(t),t.start(),IB.render((0,B.jsx)(h.StrictMode,{children:(0,B.jsx)(cB,{model:n})}))}var RB=i();RB?LB(RB):Promise.all([yo(),vo()]).then(([e,t])=>{e?LB(``):IB.render((0,B.jsx)(h.StrictMode,{children:t?(0,B.jsx)(Co,{}):(0,B.jsx)(lr,{})}))});export{U_ as a,eu as c,te as d,ce as f,Gx as i,Ln as l,Pz as n,lf as o,Mz as r,Ed as s,kB as t,zn as u};
63
+ `)}\n${r}\n`}function Rz(e){let t=document.querySelector(`[data-composer="${CSS.escape(e)}"]`);return t&&t.offsetParent!==null?t:null}function zz(e,t,n,r){let i=Lz(e.term.getSelection());if(i===null)return!1;let a=Sz(t,n),o=Rz(a);if(o){Ez(a,i),e.term.clearSelection();let t=o.querySelector(`textarea`);return t?.focus(),t?.setSelectionRange(t.value.length,t.value.length),!0}return r?(F(R(`quote.atMenu`),`error`),!1):e.term.modes.bracketedPasteMode?(e.term.paste(i),e.term.clearSelection(),e.term.focus(),!0):(F(R(`quote.notReady`),`error`),!1)}async function Bz(e,t,n){for(let r of n){r.size>1048576&&F(R(`layout.dropUploading`,{name:r.name}));try{t.term.paste(`${await al(e,r)} `)}catch(e){F(e instanceof Error?e.message:String(e),`error`)}}t.term.focus()}async function Vz(){if(!navigator.clipboard?.read)throw Error(R(`layout.pasteNeedsHttps`));let e=[];for(let t of await navigator.clipboard.read())for(let n of t.types)(n.startsWith(`image/`)||n===`application/pdf`)&&e.push(new File([await t.getType(n)],`clipboard`,{type:n}));return e}async function Hz(e,t){let n;try{n=await Vz()}catch(e){F(R(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?F(R(`layout.pasteNoImage`),`error`):await Bz(e,t,n)}async function Uz(e){try{return await navigator.clipboard.writeText(e),!0}catch{return F(R(`menu.copyFailed`),`error`),!1}}function Wz(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=y(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;z();let o=(0,h.useRef)(null),[s,c]=(0,h.useState)({kind:`none`}),[l,u]=(0,h.useState)(null),[d,f]=(0,h.useState)(0),[p,m]=(0,h.useState)({busy:!1,error:null}),g=(0,h.useRef)(e);g.current=e,pg(t);let _=e.composer===!0&&mg(t),v=(0,h.useRef)(_);v.current=_,(0,h.useEffect)(()=>{let e=o.current;if(!e)return;let a=null,s=!1,l=[document.fonts.load(`13px "JetBrains Mono"`),document.fonts.load(`bold 13px "JetBrains Mono"`)];document.fonts.load(`13px "${Nz}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||Jd({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:g.current.focused!==!1&&!v.current},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(g.current.onActivate?.(),oo.set(so(t)??null)):oo.get()?.stream===t&&oo.set(null)},onExit:()=>{yz(eu(n,r,i))||g.current.onExit?.()},copyText:Uz,pasteImage:async()=>{a&&await Hz(t,a.handle)}}).then(e=>{s?e.release():(a=e,u(e.handle))})};return qd(t,n,r,i)?d():Promise.allSettled(l).then(d),()=>{s=!0,u(null),a?.release()}},[t,n,r,i]);let[b,x]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!l)return;x(l.term.hasSelection());let e=l.term.onSelectionChange(()=>x(l.term.hasSelection()));return()=>{e.dispose(),x(!1)}},[l]),(0,h.useEffect)(()=>{if(!l)return;let{term:e,stream:a}=l,o={stream:a,focus:()=>e.focus(),input:t=>e.input(t,!0),reattach:()=>l.reattach(),scrollPages:e=>l.scrollLines(e*10),hasSelection:()=>e.hasSelection(),copySelection:()=>{let t=e.getSelection();return t.trim().length!==0&&(Uz(t),e.clearSelection(),!0)},reset:()=>{let o={cols:e.cols,rows:e.rows};C.set((0,B.jsx)($r,{title:Nc(`reset.title`),body:Nc(`reset.body`),confirmLabel:R(`workspace.reset`),onConfirm:async()=>{_z(a);try{await t.request(`tab.split`,{taskId:n,tabId:r,action:`reset`,leafId:i??`leaf-1`,...o}),await l.reattach(),e.focus()}finally{vz(a)}}}))},size:()=>({cols:e.cols,rows:e.rows})},s=K(o);return document.activeElement===e.textarea&&oo.set(o),()=>{s()}},[l,t,n,r,i]),(0,h.useEffect)(()=>{e.focused&&!_&&l&&document.activeElement!==l.term.textarea&&l.term.focus()},[e.focused,_,l]);let S=!i||i===`leaf-1`,[w,T]=(0,h.useState)(null),E=e.engineExit?.since===w,[D,O]=(0,h.useState)(null),k=e.usageLimit&&e.usageLimit.since!==D?e.usageLimit:null,ee=(0,h.useRef)(!1),te=async(i,a)=>{if(!ee.current){ee.current=!0,m({busy:!0,error:null});try{await t.request(`term.revive`,{taskId:n,tabId:r,...a?{restartExited:a}:{}}),await i.reattach(),i.term.focus(),T(e.engineExit?.since??null),m({busy:!1,error:null})}catch(e){m({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{ee.current=!1}}};return(0,B.jsxs)(`div`,{className:Pn,"data-stream":eu(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),Bz(t,l,Array.from(e.dataTransfer.files)))},onPasteCapture:e=>{if(!l)return;let n=Array.from(e.clipboardData.files);(n.length!==0||e.clipboardData.getData(`text/plain`)===``)&&(e.preventDefault(),e.stopPropagation(),n.length>0?Bz(t,l,n):Hz(t,l))},children:[(0,B.jsxs)(`div`,{className:Fn,children:[(0,B.jsx)(`div`,{className:In,ref:o}),(0,B.jsx)(Iz,{notice:s,engineExit:E?null:e.engineExit??null,model:e.model,taskId:n,tabId:r,revive:p,onReopen:S&&l?e=>void te(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0,usageLimit:k!==null,onDismissLimit:k?()=>O(k.since):void 0}),b&&e.composer&&l&&(0,B.jsx)(V,{variant:`floating`,className:`absolute top-2.5 right-2.5 z-4`,title:R(`quote.title`),onClick:()=>zz(l,n,r,a),children:R(`quote.action`)}),d>0&&l&&(0,B.jsxs)(`div`,{className:`mono absolute right-2.5 bottom-2.5 z-4 flex gap-3 rounded-sm border-hairline border-line bg-inset px-2.5 py-1 text-meta`,children:[(0,B.jsx)(`span`,{className:`text-warning`,children:Nc(`scrolledBack`,{lines:d})}),(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToTop(),children:Nc(`scrollFirst`)}),(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:Nc(`scrollLatest`)})]})]}),e.composer&&(0,B.jsx)(kz,{model:e.model,taskId:n,tabId:r}),l&&(0,B.jsx)(jz,{handle:l,atMenu:a})]})}var Gz=e=>dA(e)!==null,Kz=e=>Xu(dA(e)?.tab.split);function qz(e){let t=dA(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:cA(t.taskId,t.tab,n)}:null}Za(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:Gz,run:e=>{let t=dA(e);t&&pA(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:Gz,run:e=>{let t=dA(e);t&&pA(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:Kz,run:e=>{let t=qz(e);t&&uA(t.taskId,t.tab,t.split,Qu(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:Kz,run:e=>{let t=qz(e);t&&mA(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:Kz,run:e=>{let t=qz(e);t&&hA(e,t.taskId,t.tab,t.leaf)}}]);var Jz=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function Yz({model:e,taskId:t,tab:n}){let r=n.split;y(sA);let i=r?cA(t,n,r):`leaf-1`,a=r?$u(r,qu(n)):new Map,o=Xu(r),{prefs:s}=J_(),c=y(e.tasks)?.tasks.find(e=>e.id===t)?.tabStatus?.[n.id]??n.status,l=n.kind===`engine`&&c?.reason===`dead`?c.since:null;(0,h.useEffect)(()=>{l!==null&&e.refreshTabsNow(t)},[l,e,t]);let u=l!==null&&n.alive!==!1?{code:n.exit?.code??null,since:l}:null,d=n.kind===`engine`&&c?.reason===`rate_limited`?{since:c.since}:null;return(0,B.jsx)(`div`,{className:tn,children:(r?Zu(r.root):Jz).map(c=>(0,B.jsxs)(`div`,{className:an(o?s.splitStyle:null,{left:c.left,top:c.top,active:c.id===i}),style:{left:`calc(${c.x*100}% + var(--ml, 0px))`,top:`calc(${c.y*100}% + var(--mt, 0px))`,width:`calc(${c.w*100}% - var(--ml, 0px))`,height:`calc(${c.h*100}% - var(--mt, 0px))`},children:[(0,B.jsx)(Wz,{client:e.client,model:e,engineExit:c.id===`leaf-1`?u:null,usageLimit:c.id===`leaf-1`?d:null,composer:n.kind===`engine`&&c.id===`leaf-1`,taskId:t,tabId:n.id,leafId:c.id,focused:c.id===i,onActivate:()=>r&&lA(t,n.id,r,c.id),onExit:()=>{o?fA(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,B.jsx)(`span`,{className:on(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>LN(r,vA(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var Xz=/^[0-9a-f]{7,40}$/i;function Zz(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||(Xz.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}function Qz(e,t){let n=[];for(let r=Zz(e,t);r&&n.length<20&&!n.includes(r);r=Zz(e,r))n.unshift(r);let r=e.filter(n=>!n.deleting&&Zz(e,n)?.id===t.id).sort((e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``));if(n.length===0&&r.length===0)return null;let i=n[0]??t,a=i.baseRef&&!Xz.test(i.baseRef)?i.baseRef:null;return{nodes:[...n,t,...r],at:n.length,base:a}}var $z=e=>e.pr?.lifecycle===`merged`;function eB(e){return e.nodes.find(e=>!$z(e))??null}function tB({model:e,taskId:t}){z();let n=y(e.tasks)?.tasks??[],r=n.find(e=>e.id===t),i=r?Qz(n,r):null;if(!i)return null;let a=eB(i);return(0,B.jsxs)(`nav`,{className:ET,"aria-label":R(`compare.stackLabel`),children:[i.base&&(0,B.jsxs)(`span`,{className:`text-subtle`,children:[i.base,` ←`]}),i.nodes.map((n,r)=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-x-3.5`,children:[r>0&&(0,B.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,B.jsxs)(V,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,B.jsx)(Dx,{status:n.rowStatus}),n.label||n.title,$z(n)?(0,B.jsx)(`span`,{className:`text-accent`,children:`✓`}):n.pr?.number?(0,B.jsx)(`span`,{children:`PR`}):null,` ]`]})]},n.id)),a&&!a.machine&&(0,B.jsx)(V,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>void v_(e,a),children:R(`compare.landBottom`)})]})}function nB(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function rB({taskId:e}){z();let t=Hs(e),n=y(A),r=Us(e)&&!n;return(0,B.jsx)(`div`,{className:iP,children:ds.map(n=>{let i=r&&!!Yo(t,n);return(0,B.jsx)(`button`,{type:`button`,className:WN({on:i}),title:R(`panel.${n}`),"aria-label":R(`panel.${n}`),"aria-pressed":i,onClick:()=>Js(e,n),children:(0,B.jsx)(fP,{children:pP[n]})},n)})})}function iB({model:e,task:t,tabs:n,narrow:r}){let i=y(e.selection),{prefs:a}=J_(),o=!nB(a.tabStrip,n.length);return(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 font-mono text-meta/body transition-padding-left duration-220 ease-snap motion-reduce:transition-none rail-folded:min-h-6.5 rail-folded:pl-23`,role:`tablist`,children:[n.map((n,r)=>(0,B.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.id===i.tabId,className:`group/tab flex items-center gap-1.5 whitespace-nowrap rounded-sm px-2.5 py-1 active:scale-97 motion-reduce:active:scale-none touch:select-none touch:touch-callout-none ${o?`hidden`:``} ${n.id===i.tabId?`bg-inset text-ink`:`text-muted hover:bg-hover data-menu-open:bg-hover`}`,onClick:()=>e.select(t.id,n.id),onContextMenu:r=>LN(r,b(NA(e,t,n),R(`menu.more`))),children:[(0,B.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),qu(n)]},n.id)),!r&&(0,B.jsx)(rB,{taskId:t.id})]})}function aB(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function oB({model:e}){let t=z()===`zh`?Oi:Di,n=e.client,[r,i]=(0,h.useState)(()=>(Y(n,`worktrees.list`,{network:!0})??Y(n,`worktrees.list`,{network:!1}))?.projects??null),[a,o]=(0,h.useState)([]),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(0),d=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0,t=!1,r=r=>X(n,`worktrees.list`,{network:r}).then(n=>{if(!(!e||!r&&t)&&(r&&(t=!0),i(n.projects),r)){let e=new Set(n.projects.flatMap(e=>e.worktrees.map(e=>e.path)));o(t=>t.filter(t=>e.has(t)))}}).catch(()=>{});return r(!1),r(!0),()=>{e=!1}},[n,l]),(0,h.useEffect)(()=>d.current?.focus(),[]);let f=(r??[]).map(e=>({...e,worktrees:e.worktrees.filter(e=>!a.includes(e.path))})),p=f.flatMap(e=>e.worktrees),m=Math.min(s,Math.max(0,p.length-1));(0,h.useEffect)(()=>{d.current?.querySelector(`[data-row="${m}"]`)?.scrollIntoView({block:`nearest`})},[m]);let g=(0,h.useCallback)(()=>u(e=>e+1),[]),_=async(e,r)=>{o(t=>[...t,e.path]);try{let i=await n.request(`worktrees.remove`,{path:e.path,force:r});i.residue&&F(aB(t.delete.residue,i.residue)),g()}catch(n){o(t=>t.filter(t=>t!==e.path));let i=n&&typeof n==`object`&&`code`in n?n.code:null;if(!r&&i===`DIRTY_WORKTREE`){C.set((0,B.jsx)($r,{title:t.delete.forceTitle,body:`${aB(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${aB(t.delete.forceReason,{reason:U(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>_(e,!0)}));return}F(aB(t.delete.failed,{error:U(n)}),`error`)}},v=e=>C.set((0,B.jsx)($r,{title:t.delete.confirmTitle,body:aB(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{_(e,!1)}})),y=n=>{if(!n.taskId){F(t.land.noTask,`error`);return}v_(e,{id:n.taskId,title:n.branch,branch:n.branch},g)},b=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`&&!window.getSelection()?.toString())return e.preventDefault(),O.set(null);if(e.metaKey||e.ctrlKey||e.altKey)return;let t=p[m];if(e.key===`j`||e.key===`ArrowDown`)c(Math.min(p.length-1,m+1));else if(e.key===`k`||e.key===`ArrowUp`)c(Math.max(0,m-1));else if(e.key===`d`&&t)v(t);else if(e.key===`l`&&t)y(t);else if(e.key===`q`||e.key===`Escape`)O.set(null);else return;e.preventDefault()},x=0;return(0,B.jsxs)(`div`,{className:Iy,tabIndex:0,ref:d,onKeyDown:b,children:[(0,B.jsx)(`h1`,{className:Ly,children:t.title}),r===null?(0,B.jsx)(`p`,{className:`text-muted`,children:t.loading}):f.length===0?(0,B.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):f.map(e=>{let n=x;return x+=e.worktrees.length,(0,B.jsxs)(`section`,{className:ub,children:[(0,B.jsxs)(`h2`,{className:`mt-1.5 mr-2 mb-1 ml-0 flex items-center gap-1 font-mono text-meta font-semibold normal-nums text-subtle`,children:[(0,B.jsx)(`span`,{children:e.repo}),(0,B.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,B.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,B.jsxs)(`div`,{"data-row":i,className:db(i===m),onClick:()=>c(i),children:[(0,B.jsxs)(`div`,{className:fb,children:[(0,B.jsx)(`span`,{className:mb,children:e.branch||t.row.detached}),e.roveManaged&&(0,B.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,B.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,B.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,B.jsx)(`span`,{className:`chip ${e.branchOnRemote===!0?`text-success`:e.branchOnRemote===!1?`text-warning`:`text-muted`}`,children:e.branchOnRemote===!0?t.badge.remoteOn:e.branchOnRemote===!1?t.badge.remoteOff:t.badge.remoteUnknown}),e.verdictReason!==`dirty`&&e.verdictReason!==`fresh`&&(0,B.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,B.jsxs)(`div`,{className:`${pb} mono text-muted`,children:[(0,B.jsx)(`span`,{className:hb,children:e.path}),e.createdAtMs>0&&(0,B.jsx)(`span`,{children:aB(t.row.created,{age:Wc(Date.now()-e.createdAtMs)})})]}),i===m&&(0,B.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>v(e),children:t.delete.button}),e.taskId&&(0,B.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>y(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,B.jsx)(`p`,{className:`${gb} mono keys-only text-muted`,children:(0,B.jsx)(mf,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function sB({model:e,narrow:t}){let n=y(e.selection),r=y(e.tabs),i=y(e.tasks),a=y(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=Ra(i,n.taskId)??o??null,c=o?void 0:a.find(e=>e.id===n.taskId),l=s?r[s.id]??[]:[],u=s?s.id in r:!1,d=y(O),f=aS(s?.id),p=s?.rowStatus?.kind===`running`,m=y(M),g=y(fs)!==`terminal`&&t&&!!s;return(0,h.useEffect)(()=>{let t=e.selection.get();return e.selection.subscribe(()=>{M.set(null);let n=e.selection.get();(n.taskId!==t.taskId||n.tabId!==t.tabId)&&fs.set(`terminal`),t=n})},[e]),(0,h.useEffect)(()=>Uw(e),[e]),d===`update`?(0,B.jsxs)(`main`,{className:`${jn} ${qt}`,children:[t&&(0,B.jsx)(kP,{}),(0,B.jsx)(Mb,{client:e.client})]}):d===`worktrees`?(0,B.jsxs)(`main`,{className:`${jn} ${qt}`,children:[t&&(0,B.jsx)(kP,{}),(0,B.jsx)(oB,{model:e})]}):d?(0,B.jsxs)(`main`,{className:`${jn} ${qt}`,children:[t&&(0,B.jsx)(kP,{}),(0,B.jsx)(Ik,{model:e,page:d})]}):m?(0,B.jsxs)(`main`,{className:`${jn} ${qt}`,children:[t&&(0,B.jsx)(kP,{}),(0,B.jsx)(`div`,{className:Mn,children:(0,B.jsx)(yg,{model:e,seed:m},rh(m))})]}):(0,B.jsxs)(`main`,{className:`${jn} ${qt}`,children:[t&&(0,B.jsx)(kP,{taskId:s?.id,title:s?.title}),s&&(0,B.jsx)(iB,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,B.jsx)(tB,{model:e,taskId:s.id}),s?.groupId&&(0,B.jsx)(mz,{model:e,taskId:s.id,groupId:s.groupId}),(0,B.jsxs)(`div`,{className:`${Mn} ${p?Nn:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,B.jsx)(IN,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,B.jsx)(`p`,{className:kn,children:R(`workspace.pickTask`)}),c?.machine&&(0,B.jsx)(`div`,{className:An,children:(0,B.jsx)(Np,{host:c.machine.label,onMachines:()=>Vg(e)})}),s&&u&&l.length===0&&!g&&(0,B.jsxs)(`div`,{className:An,children:[(0,B.jsx)(`p`,{children:R(`workspace.noTabs`)}),(0,B.jsx)(V,{variant:`filled`,onClick:()=>void lu(e,s.id,{kind:`engine`}).catch(e=>F(String(e),`error`)),children:s.engine?R(`workspace.startEngine`,{engine:s.engine.name}):R(`workspace.startSession`)}),` `,(0,B.jsx)(V,{variant:`filled`,onClick:()=>void cu(e,s.id),children:R(`menu.newChat`)}),` `,(0,B.jsx)(V,{variant:`filled`,onClick:()=>C.set((0,B.jsx)(mu,{model:e,taskId:s.id})),children:R(`menu.newChatPick`)})]}),s&&g&&(0,B.jsx)(oz,{model:e,task:s,narrow:!0}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,B.jsx)(`div`,{className:`min-w-0 flex-1 ${g?`hidden`:`flex`}`,children:(0,B.jsx)(Yz,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})]})}function cB({model:e}){z();let t=y(e.client.conn);return t.hello===null&&t.failures>=2?(0,B.jsx)(lB,{}):(0,B.jsx)(uB,{model:e})}function lB(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{vo().then(t)},[]),e===null?null:e?(0,B.jsx)(Co,{}):(0,B.jsx)(lr,{failing:!0})}function uB({model:e}){bw(e);let t=y(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;Ib(e.client,t.roveVersion);let n=()=>void Db(e.client).then(fz);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),hd(e),fd(e),po(),Ui(e.client),kw(e),na(e.client),jS(e.client),(0,h.useEffect)(()=>{e.onSelect=me;let t=M.subscribe(()=>{M.get()!==null&&me()});return re(),t},[e]),(0,h.useEffect)(()=>wC(e),[e]);let n=y(A),r=y(e.selection),i=y(e.tasks),a=y(e.remote),o=Se(),s=y(ZA),c=y(QA),l=y(XA),u=y(pe),d=y(Oe)===`app`,f=y(hs),p=y(_s),m=y(O),g=y(ce)===`drag`,_=y(M)!==null,v=a.find(e=>e.id===r.taskId&&!e.machine?.stale),b=Ra(i,r.taskId)??v??null,x=v?void 0:a.find(e=>e.id===r.taskId),S=Us(b?.id??null),C=Hs(b?.id??``).columns.length,w=o?Ce(u,!!b||!!x,m!==null||_):null;(0,h.useEffect)(()=>e.setTaskShown(w===null||w===`content`&&m===null&&!_),[e,w,m,_]);let T=tj(l??280),E=s?0:T,D=f===null?ys(C,E):vs(f,E),k={"--rail-w":`${s?0:T}px`,"--rail-open-w":`${T}px`,"--panel-w":D===null?void 0:`${D}px`};return(0,B.jsxs)(`div`,{className:Wt,children:[(0,B.jsx)(ia,{onRefresh:()=>ra(e.client)}),(0,B.jsxs)(`div`,{className:Gt({zen:n||!S||!b&&!x||o||_,expanded:p&&!n&&!o,surface:w&&d?`back`:w,folded:s&&!o,peek:s&&c&&!o,dragging:g}),style:o?void 0:k,children:[!o&&(0,B.jsx)(DP,{model:e}),s&&!o&&(0,B.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:R(`layout.railUnfold`),onMouseEnter:()=>ej(!0),onMouseLeave:()=>ej(!1),onMouseUp:()=>ZA.set(!1)}),(0,B.jsx)(RN,{model:e,narrow:o}),(0,B.jsx)(sB,{model:e,narrow:o}),!o&&(0,B.jsx)(oz,{model:e,task:b,remoteHost:x?.machine?.label}),(0,B.jsx)(cz,{model:e}),(0,B.jsx)(ko,{}),(0,B.jsx)(Tw,{model:e}),(0,B.jsx)(Ha,{model:e})]})]})}var dB=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function fB(e){return[...e.querySelectorAll(dB)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function pB(){window.addEventListener(`keydown`,e=>{if(e.key!==`Tab`||e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey)return;let t=[...document.querySelectorAll(`.overlay:not(.is-leaving)`)].at(-1);if(!t)return;let n=fB(t);if(n.length===0)return;let r=document.activeElement,i=r instanceof HTMLElement&&t.contains(r),a=e.shiftKey?n.filter(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)).at(-1)??n.at(-1):n.find(e=>i&&!!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))??n[0];e.preventDefault(),a?.focus()})}function mB(e){if(!I())for(let t of document.querySelectorAll(`${e}:not(.is-leaving)`)){let e=t.cloneNode(!0);e.classList.add(`is-leaving`),e.inert=!0,e.setAttribute(`aria-hidden`,`true`),document.body.append(e);let n=t.querySelectorAll(`*`),r=e.querySelectorAll(`*`);n.forEach((e,t)=>{let n=r[t];e.scrollTop&&(n.scrollTop=e.scrollTop),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&(n.value=e.value)}),window.setTimeout(()=>e.remove(),200)}}function hB(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function gB(){for(let e of document.querySelectorAll(`.overlay:not(.is-leaving)`))for(let t of e.getAnimations())t instanceof CSSAnimation&&t.animationName===`fade-in`&&t.finish()}function _B(){let e=C.get(),t=-1/0;C.subscribe(()=>{let n=C.get();if(n===null&&e!==null)t=performance.now(),mB(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;hB(`.overlay`),n&&requestAnimationFrame(gB)}e=n});let n=S.get();S.subscribe(()=>{let e=S.get();e===null&&n!==null?mB(`.menu`):e!==null&&hB(`.menu`),n=e});let r=Cd.get().guide;Cd.subscribe(()=>{let e=Cd.get().guide;e===null&&r!==null?mB(`.prefix-guide`):e!==null&&hB(`.prefix-guide`),r=e})}var vB=500,yB=10,bB=`input, textarea, select, [contenteditable], .xterm`,xB=[`mousedown`,`mouseup`,`click`,`contextmenu`];function SB(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of xB)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of xB)document.addEventListener(t,e,!0);document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`keydown`,t,!0)};document.addEventListener(`pointerdown`,r=>{if(t(),r.pointerType!==`touch`||!(r.target instanceof Element)||r.target.closest(bB))return;let i=r.target,a={x:r.clientX,y:r.clientY,native:!1,timer:window.setTimeout(()=>{e=null,!(a.native||!i.isConnected)&&(i.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:a.x,clientY:a.y,button:2})),n())},vB)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>yB&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function CB(e,t){e.viewingExtras=()=>Ss({narrow:be(),panelOpen:Ws(e.selection.get().taskId),zen:A.get()});let n=()=>e.reportViewing();gs.subscribe(n),Gs(n),A.subscribe(n),xe(n),t.on(`panel`,t=>{xs(t)&&nc(t,e.selection.get().taskId)})}function wB(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function TB({client:e,prompt:t}){let n=(z()===`zh`?ii:ri).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=Zr();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,B.jsx)(Xr,{title:t.title,children:(0,B.jsxs)(`form`,{className:br,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,B.jsx)(`input`,{className:sr,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,B.jsx)(`p`,{className:`text-error`,children:s}),(0,B.jsx)(ti,{busy:o,submitLabel:n.submitLabel})]})})}function EB(e,t){C.get()||C.set((0,B.jsx)(TB,{client:e,prompt:t},t.promptId))}var DB=900,OB=new WeakMap;function kB(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(OB.get(e)),OB.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),DB))}function AB(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&kB(t)},{capture:!0,passive:!0})}var jB=`rove-web.reloadedFor`;function MB(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function NB(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function PB(e,t=NB()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(jB)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=MB(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(jB,o.roveVersion)}catch{}t.reload()}})}function FB(){let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=()=>{t.style.setProperty(`--vvh`,`${e.height*e.scale}px`),t.toggleAttribute(`data-keyboard`,window.innerHeight-e.height*e.scale>120),e.scale===1&&window.scrollY!==0&&window.scrollTo(0,0)};e.addEventListener(`resize`,n),e.addEventListener(`scroll`,n),window.addEventListener(`scroll`,n,{passive:!0}),n()}var IB=(0,g.createRoot)(document.getElementById(`root`));FB(),SB(),Pe(),AB(),_B(),pB(),uN();function LB(e){let t=new Ad(jd(),e),n=new Ba(t);t.on(`prompt`,e=>{wB(e)&&EB(t,e)}),CB(n,t),PB(t),t.start(),IB.render((0,B.jsx)(h.StrictMode,{children:(0,B.jsx)(cB,{model:n})}))}var RB=i();RB?LB(RB):Promise.all([yo(),vo()]).then(([e,t])=>{e?LB(``):IB.render((0,B.jsx)(h.StrictMode,{children:t?(0,B.jsx)(Co,{}):(0,B.jsx)(lr,{})}))});export{U_ as a,eu as c,te as d,ce as f,Gx as i,Ln as l,Pz as n,lf as o,Mz as r,Ed as s,kB as t,zn as u};