@sma1lboy/rove 0.9.283 → 0.9.284-next.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{chunk-tay29xzx.js → chunk-0hc53k74.js} +1 -1
- package/dist/cli/{chunk-ve2jj5qv.js → chunk-0ppfr3vm.js} +1 -1
- package/dist/cli/{chunk-nf1gqqv8.js → chunk-0xh1e21e.js} +1 -1
- package/dist/cli/{chunk-4gjj2ed9.js → chunk-11nf15ht.js} +1 -1
- package/dist/cli/chunk-11wyec8z.js +2 -0
- package/dist/cli/{chunk-mt0mh96t.js → chunk-1e0v0ycz.js} +2 -2
- package/dist/cli/{chunk-0sy3bez6.js → chunk-1k7f137x.js} +1 -1
- package/dist/cli/{chunk-p4aqy3sm.js → chunk-1rs3dmwz.js} +1 -1
- package/dist/cli/{chunk-p5pebhe6.js → chunk-2xtk4ch2.js} +2 -2
- package/dist/cli/{chunk-37pwx1a7.js → chunk-36f8xr65.js} +1 -1
- package/dist/cli/{chunk-x5swq8ar.js → chunk-3a12v30f.js} +1 -1
- package/dist/cli/{chunk-28mm4k8b.js → chunk-3j3ms4fx.js} +1 -1
- package/dist/cli/{chunk-afhnm3e4.js → chunk-46c20c2s.js} +1 -1
- package/dist/cli/{chunk-b1zg5jnk.js → chunk-4khwsrwk.js} +1 -1
- package/dist/cli/{chunk-hcrpbx9x.js → chunk-4qg325ww.js} +2 -2
- package/dist/cli/{chunk-trw076nv.js → chunk-4qy2mvd5.js} +1 -1
- package/dist/cli/{chunk-0r1jf8m9.js → chunk-55ajzrj6.js} +1 -1
- package/dist/cli/{chunk-c69xdgfz.js → chunk-5c2syc7e.js} +2 -2
- package/dist/cli/{chunk-r4bwm4zh.js → chunk-5jpfg8kz.js} +1 -1
- package/dist/cli/{chunk-8ac8k0ba.js → chunk-5smmarfy.js} +1 -1
- package/dist/cli/{chunk-mcbxrpwg.js → chunk-6b3s6fqq.js} +1 -1
- package/dist/cli/{chunk-q2r4qavc.js → chunk-6nsjckc5.js} +1 -1
- package/dist/cli/{chunk-131bpjms.js → chunk-6tg9h05d.js} +1 -1
- package/dist/cli/{chunk-d9fx9282.js → chunk-6z1a05bz.js} +1 -1
- package/dist/cli/{chunk-bxg7y1qk.js → chunk-7vt1bf35.js} +5 -5
- package/dist/cli/{chunk-kd8j15cg.js → chunk-87rkqyr3.js} +1 -1
- package/dist/cli/{chunk-94t488yj.js → chunk-8d4v27ez.js} +1 -1
- package/dist/cli/{chunk-cacct9gd.js → chunk-9wd57t3j.js} +1 -1
- package/dist/cli/chunk-9xax0901.js +2 -0
- package/dist/cli/{chunk-4zmhzb28.js → chunk-9y17mj2r.js} +1 -1
- package/dist/cli/{chunk-s7ttzm9a.js → chunk-9y803nx4.js} +1 -1
- package/dist/cli/{chunk-g2yf429k.js → chunk-a7pygqgw.js} +1 -1
- package/dist/cli/chunk-a9867184.js +2 -0
- package/dist/cli/{chunk-9q43btkf.js → chunk-acqqhrjb.js} +1 -1
- package/dist/cli/{chunk-nzf76wa4.js → chunk-adr12wp8.js} +2 -2
- package/dist/cli/{chunk-1c6yk07x.js → chunk-af5a4v8t.js} +1 -1
- package/dist/cli/{chunk-69f84j0j.js → chunk-ah04qzfd.js} +1 -1
- package/dist/cli/chunk-bg2ypp04.js +3 -0
- package/dist/cli/chunk-bjhx1nav.js +2 -0
- package/dist/cli/{chunk-fd3gswsr.js → chunk-bxqdxv63.js} +1 -1
- package/dist/cli/{chunk-1gxnd3qq.js → chunk-ca5fmepn.js} +1 -1
- package/dist/cli/chunk-chzxsqth.js +2 -0
- package/dist/cli/chunk-d79vm3bt.js +20 -0
- package/dist/cli/chunk-dcnyp3qq.js +62 -0
- package/dist/cli/{chunk-tckyb2xt.js → chunk-dcw40f11.js} +1 -1
- package/dist/cli/chunk-dgjnak3n.js +2 -0
- package/dist/cli/chunk-dp0m6jrg.js +2 -0
- package/dist/cli/{chunk-gr0ffx3f.js → chunk-dxwjx5d1.js} +1 -1
- package/dist/cli/chunk-e0z123ad.js +2 -0
- package/dist/cli/{chunk-qnv8ggxh.js → chunk-e1c6909n.js} +1 -1
- package/dist/cli/{chunk-yz859e8t.js → chunk-e23n32hv.js} +1 -1
- package/dist/cli/{chunk-5mhf43dx.js → chunk-e5crm07d.js} +1 -1
- package/dist/cli/{chunk-dce6ytw0.js → chunk-ebb8z47a.js} +1 -1
- package/dist/cli/{chunk-60kx1j7x.js → chunk-ee9nm38f.js} +6 -7
- package/dist/cli/{chunk-xs6w6ekc.js → chunk-ejytsv0b.js} +2 -2
- package/dist/cli/{chunk-1masf4pj.js → chunk-em75b155.js} +1 -1
- package/dist/cli/{chunk-jfbfasx0.js → chunk-f050r8jy.js} +1 -1
- package/dist/cli/chunk-f535feph.js +2 -0
- package/dist/cli/{chunk-62z7016x.js → chunk-f6qne8f1.js} +1 -1
- package/dist/cli/{chunk-mejxvvzb.js → chunk-fq8sbarx.js} +1 -1
- package/dist/cli/chunk-fsqgs1p1.js +2 -0
- package/dist/cli/{chunk-xdqj48wx.js → chunk-fxqgvjtt.js} +1 -1
- package/dist/cli/chunk-g1er3ctd.js +2 -0
- package/dist/cli/{chunk-qnpkhvrn.js → chunk-g2f96z6s.js} +1 -1
- package/dist/cli/{chunk-ar3mt81z.js → chunk-gca19v0w.js} +1 -1
- package/dist/cli/{chunk-an97ga8b.js → chunk-ghww7w7x.js} +1 -1
- package/dist/cli/chunk-gpq30qgy.js +2 -0
- package/dist/cli/chunk-gqqtkwkq.js +2 -0
- package/dist/cli/{chunk-dxacz9ba.js → chunk-gvzr7jxt.js} +1 -1
- package/dist/cli/{chunk-gfdd2jbp.js → chunk-h37tqrdb.js} +1 -1
- package/dist/cli/{chunk-8ttn73cv.js → chunk-hk0zbk3t.js} +1 -1
- package/dist/cli/chunk-hp2p26w1.js +2 -0
- package/dist/cli/{chunk-jadjn49m.js → chunk-j1rsp5pc.js} +1 -1
- package/dist/cli/{chunk-2r1fgng9.js → chunk-jrzh4yv6.js} +1 -1
- package/dist/cli/{chunk-sttpyf2b.js → chunk-jy0kms4j.js} +1 -1
- package/dist/cli/chunk-jzsngv31.js +3 -0
- package/dist/cli/{chunk-xj8bma5k.js → chunk-k2p7at32.js} +1 -1
- package/dist/cli/chunk-m3rjakc6.js +2 -0
- package/dist/cli/{chunk-mhft316g.js → chunk-m9gvs19s.js} +1 -1
- package/dist/cli/chunk-ma00xdy2.js +2 -0
- package/dist/cli/{chunk-pmwk2etg.js → chunk-mdfm45fx.js} +1 -1
- package/dist/cli/chunk-nkfqg6e2.js +2 -0
- package/dist/cli/{chunk-paashxkd.js → chunk-ntqg38ke.js} +1 -1
- package/dist/cli/{chunk-jkssty8x.js → chunk-p1pbtfa5.js} +1 -1
- package/dist/cli/chunk-pk2w9dtp.js +2 -0
- package/dist/cli/{chunk-abate6bw.js → chunk-qap0g8v4.js} +1 -1
- package/dist/cli/chunk-qknyztxj.js +2 -0
- package/dist/cli/{chunk-ee8917py.js → chunk-qq1q07tz.js} +1 -1
- package/dist/cli/{chunk-8y10pmkf.js → chunk-qq2mjph2.js} +1 -1
- package/dist/cli/{chunk-cye56q32.js → chunk-r02sre5z.js} +3 -3
- package/dist/cli/{chunk-991x8tw6.js → chunk-r1r83d2r.js} +1 -1
- package/dist/cli/chunk-ratr5ew6.js +2 -0
- package/dist/cli/{chunk-5a6rkz1s.js → chunk-rg38rkr1.js} +1 -1
- package/dist/cli/{chunk-gygdyf0s.js → chunk-rja9tf6j.js} +1 -1
- package/dist/cli/{chunk-7mwvvj46.js → chunk-rz8319pe.js} +1 -1
- package/dist/cli/{chunk-bbq6wc47.js → chunk-s62qg37a.js} +1 -1
- package/dist/cli/{chunk-wcq8k0j6.js → chunk-sdcb3ttr.js} +1 -1
- package/dist/cli/chunk-sdqvrj4w.js +2 -0
- package/dist/cli/{chunk-bwxmrwb1.js → chunk-t183jy5m.js} +1 -1
- package/dist/cli/{chunk-g6jregtt.js → chunk-t8j9csw2.js} +3 -3
- package/dist/cli/{chunk-hptxcj03.js → chunk-txy0xkks.js} +2 -2
- package/dist/cli/chunk-v765ej4f.js +2 -0
- package/dist/cli/{chunk-90dkv2mn.js → chunk-w1evhnvr.js} +1 -1
- package/dist/cli/{chunk-v883qbhk.js → chunk-w6me6vm2.js} +1 -1
- package/dist/cli/{chunk-d9x7zeh7.js → chunk-w7sb3jmd.js} +1 -1
- package/dist/cli/chunk-w8a3gsvw.js +2 -0
- package/dist/cli/{chunk-q89yrevw.js → chunk-wgyfwry1.js} +1 -1
- package/dist/cli/{chunk-3wsjbxd7.js → chunk-wxb38172.js} +1 -1
- package/dist/cli/{chunk-ks5g5ee2.js → chunk-x02jmqj1.js} +1 -1
- package/dist/cli/{chunk-53pn0a9z.js → chunk-x1d70j6f.js} +1 -1
- package/dist/cli/chunk-x652sy0y.js +2 -0
- package/dist/cli/{chunk-r0qhywyp.js → chunk-x6k5tgzz.js} +1 -1
- package/dist/cli/{chunk-f9x0n7kr.js → chunk-xenhysr0.js} +1 -1
- package/dist/cli/{chunk-fx2e7z2s.js → chunk-xhzbynky.js} +1 -1
- package/dist/cli/{chunk-gq7s8vp3.js → chunk-xtbjzbyn.js} +1 -1
- package/dist/cli/{chunk-kfr8dm31.js → chunk-y343681c.js} +1 -1
- package/dist/cli/chunk-y8b2p44q.js +1 -1
- package/dist/cli/chunk-yb75pw36.js +2 -0
- package/dist/cli/{chunk-5jbfscxy.js → chunk-ycqt3445.js} +1 -1
- package/dist/cli/{chunk-1kxnpa9w.js → chunk-yeysn5x1.js} +3 -3
- package/dist/cli/{chunk-mdebknyq.js → chunk-yjeh02k3.js} +1 -1
- package/dist/cli/{chunk-tpc0002n.js → chunk-yv77a1p9.js} +1 -1
- package/dist/cli/{chunk-22emnsn5.js → chunk-z46zwmyq.js} +1 -1
- package/dist/cli/{chunk-ee5a0pka.js → chunk-z6t0rmg1.js} +6 -4
- package/dist/cli/index.js +7 -7
- package/dist/cli/rove-run.js +1 -1
- package/dist/cli/rove.js +6 -6
- package/dist/skills/rove/SKILL.md +40 -20
- package/dist/skills/rove/references/api-flags.md +15 -11
- package/dist/web/assets/{index-Cd9SayTz.js → index-CJt_9NpJ.js} +4 -4
- package/dist/web/assets/{term-mount-aQMkgSR7.js → term-mount-BhfGkya5.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +2 -1
- package/dist/cli/chunk-0jdvy6hk.js +0 -2
- package/dist/cli/chunk-2vkxtms5.js +0 -20
- package/dist/cli/chunk-335g4j0y.js +0 -2
- package/dist/cli/chunk-5yfffvqe.js +0 -2
- package/dist/cli/chunk-7zh7adny.js +0 -2
- package/dist/cli/chunk-81q3t424.js +0 -2
- package/dist/cli/chunk-8h94w236.js +0 -2
- package/dist/cli/chunk-cxef4y2s.js +0 -2
- package/dist/cli/chunk-dxwmnww0.js +0 -2
- package/dist/cli/chunk-e3jddh9d.js +0 -2
- package/dist/cli/chunk-g5sx5knm.js +0 -2
- package/dist/cli/chunk-k5arcpfm.js +0 -2
- package/dist/cli/chunk-k5pd6q0r.js +0 -2
- package/dist/cli/chunk-mkb5mmmw.js +0 -2
- package/dist/cli/chunk-nka82csc.js +0 -2
- package/dist/cli/chunk-nn130cde.js +0 -2
- package/dist/cli/chunk-np319fys.js +0 -2
- package/dist/cli/chunk-pzy7fe5e.js +0 -3
- package/dist/cli/chunk-q23gw6np.js +0 -2
- package/dist/cli/chunk-s61xd58f.js +0 -2
- package/dist/cli/chunk-s88gxrtj.js +0 -2
- package/dist/cli/chunk-sfrsqpvn.js +0 -2
- package/dist/cli/chunk-tjh04p1x.js +0 -2
- package/dist/cli/chunk-w1rgfjkp.js +0 -2
- package/dist/cli/chunk-x1jxxmtc.js +0 -3
- package/dist/cli/chunk-y57tnbwp.js +0 -2
- package/dist/cli/chunk-z16wb344.js +0 -2
- package/dist/cli/chunk-z3hfz52n.js +0 -2
- package/dist/cli/chunk-zw9w8wbk.js +0 -63
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/term-mount-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/term-mount-BhfGkya5.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 A=/\/+/g;function ee(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function j(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 te(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,te(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ee(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),te(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(A,`$&/`)+`/`)+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+ee(a,u),c+=te(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+ee(a,u++),c+=te(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return te(j(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 ne(e,t,n){if(e==null)return e;var r=[],i=0;return te(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function re(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 M=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)},N={map:ne,forEach:function(e,t,n){ne(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ne(e,function(){t++}),t},toArray:function(e){return ne(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=N,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:re}},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,M)}catch(e){M(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&&ee(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&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(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,ee(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`),A=Symbol.for(`react.memo_cache_sentinel`),ee=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var te=Symbol.for(`react.client.reference`);function ne(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?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?ne(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ne(e(t))}catch{}}return null}var re=Array.isArray,M=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ae=[],oe=-1;function se(e){return{current:e}}function ce(e){0>oe||(e.current=ae[oe],ae[oe]=null,oe--)}function P(e,t){oe++,ae[oe]=e.current,e.current=t}var le=se(null),ue=se(null),de=se(null),fe=se(null);function pe(e,t){switch(P(de,t),P(ue,e),P(le,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}}ce(le),P(le,e)}function me(){ce(le),ce(ue),ce(de)}function he(e){e.memoizedState!==null&&P(fe,e);var t=le.current,n=Wd(t,e.type);t!==n&&(P(ue,e),P(le,n))}function ge(e){ue.current===e&&(ce(le),ce(ue)),fe.current===e&&(ce(fe),ep._currentValue=ie)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+_e+e+ve}var be=!1;function xe(e,t){if(!e||be)return``;be=!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(`
|
|
@@ -16,7 +16,7 @@ This worktree is at the PR's head ({head}, going into {base}). Read the change a
|
|
|
16
16
|
这个 worktree 在该 PR 的头部({head},合入 {base})。对照 {base} 阅读改动(git diff origin/{base}...HEAD),然后告诉我你的发现:bug、风险、缺失的测试、不清楚的地方。不要推送、评论或批准这个 PR;在这里汇报。`}},ue=n({en:()=>de,zh:()=>fe}),de={runLog:{title:`Runs`,all:`all`,routine:`Routine`,allRoutines:`All routines`,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`}},fe={runLog:{title:`运行记录`,all:`全部`,routine:`例行任务`,allRoutines:`全部例行任务`,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} 条`}},pe=n({en:()=>me,zh:()=>he}),me={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`,refresh:`Refresh`,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:`{protocol}, ssh {ssh}`,synced:`{machine} now uses @{login}`},general:{groupInterface:`Interface`,groupFiles:`Files and worktrees`,groupTerminal:`Terminal`,editorNote:`Opens files from the file tree. auto follows $VISUAL / $EDITOR, else nvim / vim / emacs / nano.`,tabStrip:`Tab strip`,scrollback:`Scrollback`},appearance:{groupColours:`Colours`,groupTasks:`Tasks and panes`,groupTerminal:`Terminal app only`,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`},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:{terminalOnly:`Terminal only: the TUI changes, this page has nothing to draw.`,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:{createFile:`Create keybindings.yaml`,exists:`keybindings.yaml already exists; nothing was changed.`,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 5 MB`,new:`[ new ]`,routinePause:`[ pause ]`,routineEnable:`[ enable ]`,delete:`[ delete ]`,routinesNeedYou:`NEEDS YOU`,routinesActive:`ACTIVE`,routinesPaused:`PAUSED`,routineSchedule:`Schedule`,routineNext:`Next run`,routineProject:`Project`,routineDelivers:`Delivers to`,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`}},he={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:`本机`,refresh:`刷新`,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:`{protocol}, ssh {ssh}`,synced:`{machine} 现在使用 @{login}`},general:{groupInterface:`界面`,groupFiles:`文件与 worktree`,groupTerminal:`终端`,editorNote:`从文件树打开文件时用它。auto 跟随 $VISUAL / $EDITOR,否则依次尝试 nvim / vim / emacs / nano。`,tabStrip:`标签栏`,scrollback:`回滚行数`},appearance:{groupColours:`颜色`,groupTasks:`任务与面板`,groupTerminal:`仅终端应用`,taskColorsNote:`让每个任务在工作边框和列表里有自己的色调。`,colorblindNote:`新增和删除的行用蓝色和红色,而不是绿色和红色。`,workingBorderNote:`所选任务工作时,面板边框的样子。`,railGroup:`任务列表`,railGroupProject:`按项目`,railGroupState:`按状态`},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:{terminalOnly:`仅终端:TUI 会变化,网页没有可画的东西。`,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:{createFile:`创建 keybindings.yaml`,exists:`keybindings.yaml 已存在,未做任何改动。`,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} 超过 5 MB`,new:`[ 新建 ]`,routinePause:`[ 暂停 ]`,routineEnable:`[ 启用 ]`,delete:`[ 删除 ]`,routinesNeedYou:`需要处理`,routinesActive:`运行中`,routinesPaused:`已暂停`,routineSchedule:`调度`,routineNext:`下次执行`,routineProject:`项目`,routineDelivers:`投递到`,routinePrompt:`提示词`,routineScript:`脚本`,cronDown:`减小{field}`,cronUp:`增大{field}`,storySave:`保存`,storySaveStart:`保存并启动`,storyStart:`启动`,attachHintTouch:`粘贴路径 / 截图 → 插入图片占位行`}},ge=n({en:()=>_e,zh:()=>ve}),_e={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`}},ve={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:`终端末尾`}},ye=n({en:()=>be,zh:()=>xe}),be={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}%`}},xe={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}%`}},Se=n({en:()=>Ce,zh:()=>we}),Ce={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`,type:`Type instead`,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?`}}},we={voice:{say:`说`,stop:`停 {time}`,release:`松手 {time}`,working:`在听…`,hint:`口述:点一下开始、再点一下结束,或按住说话、松手结束`,slideToSend:`上滑发送`,tipSend:`松手发送`,hold:`按住说话`,type:`打字`,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:`删除这个服务地址和密钥?`}}},Te=n({en:()=>Ee,zh:()=>De}),Ee={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`,dropUnsupported:`Only images and PDFs can be dropped into a terminal`,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 an image or PDF`,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`}},De={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:`展开任务列表`,dropUnsupported:`终端里只能拖入图片和 PDF`,pasteNoImage:`浏览器剪贴板里没有图片`,pasteNoAccess:`读不到浏览器剪贴板:{error}`,pasteNeedsHttps:`页面要走 https 或 localhost`,refreshTimeout:"守护进程没能及时以新版本重新上线,请检查 `rove daemon status`",railResize:`拖动调整任务列表宽度,单击折叠,双击还原`,composerPlaceholder:`给 agent 发消息`,composerSend:`发送`,composerAttach:`附加图片或 PDF`,composerNotSent:`没发出去:{reason}`,composerOldBridge:`这台 Mac 上的 rove --web 比页面旧,重启它之后才能从这里发送。`,composerAtMenu:`agent 正在等你选择。用下方的 1–4 和 ⏎ 键回答;你的消息已保留。`,termKeys:`终端按键`,termKeyUp:`上方向键`,termKeyDown:`下方向键`,termKeyLeft:`左方向键`,termKeyRight:`右方向键`,termKeyInterrupt:`Ctrl+C 中断`,termKeyEnter:`回车`,narrowTerminal:`终端`}},Oe=[ae,Te,D,te,pe,x,M,ue,ye,ge,A,v,ce,w,Se],ke=Object.assign({},...Oe.map(e=>e.en)),Ae={en:ke,zh:Object.assign({},...Oe.map(e=>e.zh))};function je(){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 Me=g(je());function Ne(){let e=typeof document>`u`?void 0:document.documentElement;e&&(e.lang=Me.get()===`zh`?`zh-CN`:`en`)}Ne(),Me.subscribe(Ne);function Pe(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 Fe(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}function F(e,t){return Fe(Pe(Ae[Me.get()],e)??Pe(ke,e)??e,t)}function Ie(e,t,n){return Fe(Pe(e[Me.get()],t)??Pe(e.en,t)??t,n)}function I(){return _(Me)}function Le(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 Re=(...e)=>e.filter(Boolean).join(` `),ze=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})),L=t(((e,t)=>{t.exports=ze()}))(),Be=({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`,Ve={link:`text-accent hover:underline`,filled:Be(),danger:Be({danger:!0}),action:`rounded-sm border-hairline border-line px-3 py-1.25 font-sans text-meta text-ink hover:border-line-active hover:bg-hover 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`},He={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 R({variant:e=`link`,hit:t=e===`link`?`roomy`:`none`,className:n,type:r=`button`,...i}){return(0,L.jsx)(`button`,{type:r,className:Re(Ve[e],He[t],n),...i})}var Ue=`text-meta leading-[inherit]`,We=`font-normal normal-nums`,Ge=`touch:relative touch:after:absolute touch:after:content-['']`,Ke=`flex h-full flex-col`,qe=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(` `),Je=[`relative narrow-content:hidden 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(` `),Ye=`rail-folded:col-2 panel-expanded:invisible panel-expanded:col-2 narrow-sidebar:hidden`,Xe=`rail-folded:col-3 panel-expanded:z-2 panel-expanded:col-[2/-1] panel-expanded:bg-paper panel-expanded:pl-2`,Ze=`${Ge} touch:after:-inset-x-1.5 touch:after:-inset-y-3`,Qe=`flex items-center gap-2`,$e=`px-1.5 py-0.5 text-meta font-bold ${Ge} touch:after:-inset-2.5 touch:after:-bottom-1`,et=`flex items-center rounded-sm px-2.5 py-1.5 text-muted aria-selected:bg-inset aria-selected:text-ink [&_svg]:size-4 ${Ge} touch:after:-inset-x-px touch:after:-top-2 touch:after:-bottom-1.5`,tt=`keys-only m-0 overflow-hidden px-3.5 py-1 text-meta text-ellipsis whitespace-nowrap`,nt=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`}`,rt=`relative min-w-0 flex-1`,it={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)]`]},at=(e,t)=>it[e][+!!t],ot=(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?at(`left`,t.active):``} ${t.top?at(`top`,t.active):``} ${t.left||t.top?r:``}`:e===`rail`?`${n} ${at(`left`,t.active)} ${r} ${t.top?`[--mt:6px]`:``}`:e===`rule`?`${n} ${at(`top`,t.active)} ${r} ${t.left?`[--ml:8px]`:``}`:n},st=(e,t)=>`absolute right-2 z-3 bg-paper px-1 font-mono text-meta ${We} ${e?`-top-2`:`top-0.5`} ${t?`text-accent`:`text-subtle`}`,ct=`hidden gap-1 overflow-x-auto scrollbar-none [border-top:var(--hairline)_solid_var(--line)] bg-surface px-1.5 py-1 touch:flex`,lt=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 ${We} ${e?`border-accent text-accent`:`border-line text-ink`}`,ut=`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`,dt=`min-w-[3ch] text-accent`,ft=`mb-1.5 flex justify-between gap-4`,pt=`columns-[2_220px] gap-x-5`,mt=`mb-2 break-inside-avoid`,ht=`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`,gt=`mx-0 my-2 overflow-x-hidden overflow-y-auto scrollbar-none`,_t=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 ${We} whitespace-pre text-ink touch:py-2.5 ${e?`is-selected bg-hover`:``}`,vt=`min-w-0 overflow-hidden text-ellipsis`,yt=`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`,bt=`flex justify-between gap-4`,xt=`flex flex-col items-end ${Ue}`,St=`mt-2 max-h-[52vh] overflow-y-auto`,Ct=`mb-2.5`,wt=`m-0 mb-1 font-sans text-meta font-bold normal-nums text-accent`,Tt=`flex gap-3 py-px ${Ue}`,Et=`min-w-[14ch] text-ink`,Dt=`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`,Ot=`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 ${We} text-ink shadow-popover`,kt=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]`}`,At=`m-auto font-mono text-meta ${We} text-subtle`,jt=`${At} flex flex-col items-center gap-3 [&_p]:m-0`,Mt=`workspace row-1 flex min-h-0 min-w-0 flex-col gap-1.5 px-1 pt-2 pb-1`,Nt=`flex min-h-0 flex-1 overflow-hidden rounded-md border-hairline border-line bg-paper focus-within:border-focus`,Pt=`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`,Ft=`relative flex min-w-0 flex-1 flex-col`,It=`relative flex min-h-0 min-w-0 flex-1 flex-col`,Lt=`term-host relative min-h-0 min-w-0 flex-1 touch-none overflow-hidden`,Rt=`pointer-events-none absolute inset-0 z-5 h-full w-full`,zt=`relative h-full [&.is-leaving]:pointer-events-none [&.is-leaving]:absolute [&.is-leaving]:inset-0 [&.is-leaving]:z-6`,Bt=`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)]`,Vt=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 ${We} ${e?`text-error`:`text-muted`} [&_.link:disabled]:pointer-events-none [&_.link:disabled]:opacity-60`,Ht=`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 ${We} whitespace-nowrap text-muted`,Ut=e=>`size-1.5 rounded-full ${e?`bg-warning`:`bg-subtle`}`,Wt=`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`,Gt=`col-span-3 grid cursor-pointer grid-cols-subgrid items-center text-left hover:text-ink`,Kt={ok:`text-muted`,warn:`text-warning`,crit:`text-error`},qt={ok:`text-success`,warn:`text-warning`,crit:`text-error`},Jt=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-[''] ${qt[e]??qt.ok}`,Yt=`font-mono text-title font-bold normal-nums tracking-[0.02em] whitespace-nowrap`,Xt=`text-accent`,Zt=`grid h-full place-items-center p-6`,Qt=`flex w-[min(460px,100%)] flex-col gap-3 rounded-md border-hairline border-line bg-surface p-6 [&_p]:m-0`,$t=`flex flex-col gap-2 p-3.5 text-left font-sans text-meta ${We} leading-[1.5]`,en=`mx-2.5 my-3 font-mono text-meta text-subtle`,tn=`font-sans text-meta text-subtle`,nn=`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`,rn=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`:``}`,an=`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`,on=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`}`,z=`m-0 font-sans text-meta font-medium normal-nums`,sn=`link text-accent [&:hover]:underline touch-hit`,cn=`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`,ln=`${cn} w-full px-2.5 py-2`,un=`actions flex items-center justify-end gap-3.5`;function dn({failing:e=!1}){I();let[t,n]=(0,h.useState)(``),[r,i]=(0,h.useState)(!1);return(0,L.jsx)(`div`,{className:Zt,children:(0,L.jsxs)(`form`,{className:Qt,onSubmit:e=>{e.preventDefault();let n=Le(t);if(!n){i(!0);return}a(n),window.location.reload()},children:[(0,L.jsxs)(`span`,{className:Yt,children:[(0,L.jsx)(`span`,{className:Xt,children:`[`}),` rove `,(0,L.jsx)(`span`,{className:Xt,children:`]`})]}),(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:F(`connect.title`)}),(0,L.jsx)(`p`,{className:e?`text-error`:`text-muted`,children:F(e?`connect.failing`:`connect.body`)}),(0,L.jsx)(`input`,{className:ln,autoFocus:!0,spellCheck:!1,placeholder:F(`connect.placeholder`),value:t,onChange:e=>{n(e.target.value),i(!1)}}),r&&(0,L.jsx)(`p`,{className:`text-error`,children:F(`connect.invalid`)}),(0,L.jsxs)(`div`,{className:un,children:[e&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>{o(),window.location.reload()},children:F(`connect.forget`)}),(0,L.jsx)(`button`,{type:`submit`,className:Be(),children:F(`connect.submit`)})]})]})})}function fn(e,t){let n=e.filter(e=>e.rare&&!e.children);if(n.length===0)return[...e];let r=e.filter(e=>!n.includes(e)),i={label:t,section:`more`,children:n.map(({section:e,...t})=>t)},a=r.findIndex(e=>e.section===`danger`);return a<0?[...r,i]:[...r.slice(0,a),i,...r.slice(a)]}function pn(e,t){for(let n of e){if(n.binding===t)return n;let e=n.children&&pn(n.children,t);if(e)return e}}var mn=g(null),B=g(null),hn=null;B.subscribe(()=>{let e=document.activeElement;if(B.get()!==null){!hn&&e instanceof HTMLElement&&!e.closest(`.dialog`)&&(hn=e);return}let t=hn;hn=null,window.setTimeout(()=>{t?.isConnected&&(!document.activeElement||document.activeElement===document.body)&&t.focus()},0)});var gn=g([]),V=g(null),_n=g(null),vn=g(null),yn=g(null),bn=g(!0),xn=`rove.web.newSession`;function Sn(){try{let e=JSON.parse(sessionStorage.getItem(xn)??`null`);return e&&typeof e==`object`?e:null}catch{return null}}var Cn=g(Sn());Cn.subscribe(()=>{try{let e=Cn.get();if(!e)return sessionStorage.removeItem(xn);let{prompt:t,...n}=e;sessionStorage.setItem(xn,JSON.stringify(n))}catch{}});function wn(e,t,n,r,i){Tn({...e?{repo:e}:{},...t?{baseBranch:t}:{},...n?{machine:n}:{},...r?{prompt:r}:{},...i?{ungrouped:!0}:{}})}function Tn(e){V.set(null),B.set(null),Cn.set(e)}function En(){let e=new URLSearchParams(window.location.search),t=e.get(`prompt`);if(t===null)return;let n=e.get(`repo`)??void 0;e.delete(`prompt`),e.delete(`repo`);let r=e.toString();history.replaceState(null,``,`${window.location.pathname}${r?`?${r}`:``}${window.location.hash}`),wn(n,void 0,void 0,t)}var Dn=1,On=4e3,kn=8e3;function H(e,t=`info`,n){let r=Dn++;gn.set([...gn.get(),{id:r,text:e,tone:t,...n?{action:n}:{}}].slice(-3)),window.setTimeout(()=>jn(r),n?kn:On)}function An(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}function jn(e){if(!gn.get().some(t=>t.id===e&&!t.leaving))return;let t=()=>gn.set(gn.get().filter(t=>t.id!==e));if(An()){t();return}gn.set(gn.get().map(t=>t.id===e?{...t,leaving:!0}:t)),window.setTimeout(t,140)}function Mn(){B.set(null)}var Nn=g(null),Pn=null;function Fn(){Nn.get()!==`drag`&&(Pn!==null&&window.clearTimeout(Pn),Nn.set(`slide`),Pn=window.setTimeout(()=>Nn.set(null),240))}function In(e){Pn!==null&&window.clearTimeout(Pn),Pn=null,Nn.set(e?`drag`:null)}var Ln=`flex flex-col gap-1.5`,Rn=`min-h-18 max-h-[50vh] leading-[1.45]`,zn=`flex flex-wrap gap-1.5`,Bn=(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`}`}`,Vn=`m-0 list-none p-0`,Hn=`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`,Un=(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`,Wn=`flex items-center justify-between gap-3`,Gn=`m-0 min-w-0 font-sans text-title leading-[1.4] font-semibold normal-nums text-ink wrap-anywhere`,Kn=`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-['']`,qn=`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`,Jn=(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`,Yn=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`:``}`,Xn=`font-mono text-meta normal-nums`,Zn=e=>`${Xn} ${e.danger&&e.selected?`text-inherit`:e.selected?`text-muted`:`text-subtle`} touch:hidden!`,Qn=e=>`${Xn} ${e?`text-ink`:`text-subtle`}`,$n=`${Xn} text-accent`,er=`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`,tr=`flex cursor-default flex-wrap items-baseline justify-between gap-x-3`,nr=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`,rr=`text-subtle`,ir=`flex items-baseline justify-between gap-3`,ar=`mt-1`,or=`m-0 flex list-none flex-col gap-0.5 p-0`,sr=`flex min-w-0 items-baseline gap-2.5`,cr=`flex-none font-mono text-meta font-normal normal-nums min-w-[3ch] text-right text-subtle`,lr=`flex items-baseline gap-1`,ur=`min-w-0 flex-1`,dr=`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,fr=`font-mono [&:hover]:text-accent`,pr={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`},mr=`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 gr(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?mr: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} ${pr[e.size??`row`]} ${n}`}var _r=`row-title min-w-0 flex-1 truncate`,vr=`row-title min-w-0 flex-auto truncate text-(length:--fs-title)`,yr=`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`,br=`w-[1ch] flex-none text-center font-mono`,xr=`grid w-[2ch] flex-none place-items-center font-mono text-subtle`,Sr=`flex flex-none gap-1.5 font-mono text-meta`;function U(e){return e instanceof Error?e.message:String(e)}function Cr(e){I();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(),Mn())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,L.jsx)(`div`,{className:Hn,onMouseDown:e=>e.target===e.currentTarget&&Mn(),children:(0,L.jsxs)(`dialog`,{ref:t,tabIndex:-1,open:!0,className:Un(e.wide),"aria-label":e.title,children:[(0,L.jsxs)(`div`,{className:Wn,children:[(0,L.jsx)(`h1`,{className:Gn,children:e.title}),(0,L.jsx)(`button`,{type:`button`,className:Kn,"aria-label":F(`dialog.close`),title:F(`dialog.close`),onClick:Mn,children:`×`})]}),e.children]})})}function wr(){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(),Mn()}catch(e){r(U(e))}finally{t(!1)}}}}function Tr(e){let[t,n]=(0,h.useState)(e.initial??``),{busy:r,error:i,submit:a}=wr();return(0,L.jsx)(Cr,{title:e.title,children:(0,L.jsxs)(`form`,{className:qn,onSubmit:n=>{n.preventDefault(),(t.trim()||e.allowEmpty)&&a(()=>e.onSubmit(t.trim()))},children:[e.multiline?(0,L.jsx)(`textarea`,{className:`${ln} ${Rn}`,"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,L.jsx)(`input`,{className:ln,"aria-label":e.title,autoFocus:!0,spellCheck:!1,value:t,onChange:e=>n(e.target.value),onFocus:e=>e.currentTarget.select()}),i&&(0,L.jsx)(`p`,{className:`text-error`,children:i}),(0,L.jsx)(Or,{busy:r,submitLabel:e.submitLabel})]})})}function Er(e){let{busy:t,error:n,setError:r,submit:i}=wr(),[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,L.jsx)(Cr,{title:a&&e.escalate?.title||e.title,children:(0,L.jsxs)(`div`,{className:qn,children:[(0,L.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,L.jsx)(`p`,{className:`text-error`,children:n}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Mn,children:F(`dialog.cancel`)}),e.secondary&&!a&&(0,L.jsx)(`button`,{type:`button`,className:Be({danger:!0}),disabled:t,onClick:()=>f(!0),children:e.secondary.label}),(0,L.jsx)(`button`,{ref:d,type:`button`,className:Be({danger:!0}),disabled:t,onClick:()=>f(!1),children:a&&e.escalate?e.escalate.label:e.confirmLabel})]})]})})}function Dr(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}=wr(),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,L.jsx)(Cr,{title:e.title,children:(0,L.jsxs)(`div`,{className:qn,children:[(0,L.jsx)(`ul`,{className:Vn,children:e.choices.map((t,a)=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":t.value===e.current,disabled:i,className:gr({selected:a===n}),onMouseEnter:()=>r(a),onClick:()=>s(t.value),children:[(0,L.jsx)(`span`,{className:`${br} text-accent`,children:t.value===e.current?`●`:` `}),(0,L.jsx)(`span`,{className:_r,children:t.label})]})},t.value))}),a&&(0,L.jsx)(`p`,{className:`text-error`,children:a})]})})}function Or({busy:e,submitLabel:t}){return(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Mn,children:F(`dialog.cancel`)}),(0,L.jsx)(`button`,{type:`submit`,className:Be(),disabled:e,children:t})]})}function kr(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 Ar={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`}},jr={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:`提交`}},Mr={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"}},Nr={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"}},Pr={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."}},Fr={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`,然后重试。"}},Ir={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`}},Lr={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} 在这台机器上不可用——去 设置 → 自动路由 重新指定`}},Rr={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`},zr={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} 里已有补全配置 — 未改动`},Br={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`},Vr={title:`快速任务 · {repoLabel}`,promptLabel:`提示词`,promptPlaceholder:`这个任务要做什么?`,attemptsLabel:`尝试次数`,engineLabel:`引擎`,branchLabel:`分支`,legend:`enter 创建 · tab 切换字段 · ctrl+e 引擎 · ctrl+v 附件 · esc 取消`,startedRound:`已启动 {count} 个尝试`,roundPartial:`已启动 {ok}/{count} 个尝试 —— {failed} 个失败`},Hr={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`},Ur={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:`强制移除`},Wr={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}`,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}`},Gr={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}`,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}`},Kr={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`,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:Hr,renameBranch:{title:`Rename branch`,fieldLabel:`branch`},moveChip:` move`,recentJump:`Recent: {title}`,archivedRow:`Archived · {count}`,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:Wr},qr={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:`新建任务`,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:Ur,renameBranch:{title:`重命名分支`,fieldLabel:`分支`},fieldNotes:{title:`现场笔记`,empty:"该仓库暂无现场笔记——agent 可用 `rove api note` 记录。",loading:`加载中…`,footer:`↑↓ 滚动 · esc 关闭`,footerDeletable:`↑↓ 选择 · d 删除 · esc 关闭`,confirmDelete:{title:`删除这条现场笔记?`,body:`「{text}」将不再注入该仓库的新会话。其他内容不受影响。`}},moveChip:` 移动`,recentJump:`最近:{title}`,archivedRow:`已归档 · {count}`,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:Gr},Jr={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.`}},Yr={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、暂停的任务)会立即结束。`}},Xr={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`}},Zr={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 关闭`}},Qr={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}`}},$r={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} 恢复`}},ei={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:{}},ti={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:{}},ni={common:{en:Ar,zh:jr},doctor:{en:Mr,zh:Nr},files:{en:Pr,zh:Fr},newTask:{en:Ir,zh:Lr},onboarding:{en:Rr,zh:zr},quickTask:{en:Br,zh:Vr},tasks:{en:Kr,zh:qr},terminal:{en:Jr,zh:Yr},update:{en:Xr,zh:Zr},workspace:{en:Qr,zh:$r},worktrees:{en:ei,zh:ti}};function ri(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 W(e,t,n){let r=ni[e],i=ri(r[Me.get()],t)??ri(r.en,t)??t;return n?i.replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??e)):i}var ii=[{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`}],ai=[{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:[],category:`Diff review`,description:`Move the line cursor over the diff`,hint:{keys:`j/k`}},{id:`diff.review.range`,scope:`workspace`,keys:[],category:`Diff review`,description:`Toggle range anchor at the cursor`,hint:{keys:`v`}},{id:`diff.review.note`,scope:`workspace`,keys:[],category:`Diff review`,description:`Add a review note at the cursor`,hint:{keys:`c`}},{id:`diff.review.send`,scope:`workspace`,keys:[],category:`Diff review`,description:`Send all unsent review notes to the engine`,hint:{keys:`s`}},{id:`diff.review.drop`,scope:`workspace`,keys:[],category:`Diff review`,description:`Drop the review note the cursor sits inside`,hint:{keys:`x`}},{id:`diff.review.reload`,scope:`workspace`,keys:[],category:`Diff review`,description:`Reload the previewed file from disk`,hint:{keys:`r`}}],oi=[{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`}}],si=[{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`],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:`→`}},...ii,...ai,...oi,{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`}],ci={ctrl:`⌃`,control:`⌃`,alt:`⌥`,opt:`⌥`,option:`⌥`,shift:`⇧`,cmd:`⌘`,command:`⌘`,meta:`⌘`,super:`⌘`},li={enter:`⏎`,return:`⏎`,esc:`⎋`,escape:`⎋`,space:`␣`,up:`↑`,down:`↓`,left:`←`,right:`→`,backspace:`⌫`,delete:`⌦`,del:`⌦`,pgup:`⇞`,pageup:`⇞`,pgdn:`⇟`,pagedown:`⇟`,home:`↖`,end:`↘`};function ui(e,t){if(e.includes(`/`))return e.split(`/`).map(e=>ui(e,t)).join(`/`);let n=e.toLowerCase();return n===`tab`?`tab`:li[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 di(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(`+`)?di(e,t):ui(e,!0)}`}let i=n.split(`+`);if(i.length===1)return ui(i[0]??``,!1);let a=i[i.length-1]??``;return`${i.slice(0,-1).map(e=>ci[e.toLowerCase().trim()]??e).join(``)} ${ui(a,!0)}`}var fi=g({path:``,exists:!1,rows:[],prefix:{key:`ctrl+a`,firstStrokes:[`ctrl+a`],timeoutMs:5e3},plugins:[],applied:[],warnings:[]}),pi=new Map(si.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint&&{...e.hint}}]));function mi(e){for(let e of si){let t=pi.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=si.find(e=>e.id===t.id);e&&(e.keys=[...t.keys],e.prefixKeys=t.prefixKeys&&[...t.prefixKeys],e.hint=t.hint&&{...t.hint})}fi.set(e)}async function hi(e){try{mi(await e.request(`keybindings.get`))}catch{}}function gi(e){let t=_(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 _i=()=>fi.get().prefix.key,vi=()=>{let e=_i();return e===null?``:di(e)};function yi(e,t=`direct`){let n=si.find(t=>t.id===e),r=t===`prefix`?n?.prefixKeys?.[0]:n?.keys[0];return r===void 0?void 0:di(r)}var bi=e=>si.find(t=>t.id===e)?.keys??[];function xi(e){let t=vi(),n=yi(e,`prefix`);return t&&n?`${t} ${n}`:``}var Si=e=>pi.get(e)?.prefixKeys??[];function Ci(e,t){let n=fi.get().rows.find(t=>t.id===e),r=pi.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 wi(e,t){for(let n of t){let t=e.find(e=>e.chord===n);if(t)return t}}function Ti(e){return!e.dialog&&e.page!==`worktrees`&&e.page!==`update`}var Ei=g({stale:!1,daemonVersion:null,bridgeVersion:null}),Di=2e4;async function Oi(e){try{let t=await e.request(`daemon.info`);return Ei.set({stale:t.stale,daemonVersion:t.daemonVersion,bridgeVersion:t.bridgeVersion}),t.stale}catch{return Ei.get().stale}}function G(e){(0,h.useEffect)(()=>{let t=e.onOpen(()=>void Oi(e)),n=kr(Di,()=>void Oi(e));return()=>{t(),n()}},[e])}function ki(e){if(!Ei.get().stale){H(W(`update`,`refresh.alreadyCurrent`),`error`);return}B.set((0,L.jsx)(Er,{title:W(`update`,`refresh.confirmTitle`),body:W(`update`,`refresh.confirmBody`),confirmLabel:W(`update`,`refresh.confirmLabel`),onConfirm:async()=>{await e.request(`daemon.restart`),H(W(`update`,`refresh.relaunching`));for(let t=0;t<20;t++)if(await new Promise(e=>window.setTimeout(e,1e3)),!await Oi(e))return;throw Error(F(`layout.refreshTimeout`))}}))}function Ai({onRefresh:e}){I();let{stale:t,daemonVersion:n,bridgeVersion:r}=_(Ei);if(_(fi),!t)return null;let i=W(`update`,`skew.hint`,{daemon:n?`v${n}`:W(`update`,`skew.olderBuild`),clientVersion:r??``,keys:xi(`app.refresh`)});return(0,L.jsxs)(`div`,{className:`mono ${Dt}`,role:`alert`,children:[(0,L.jsx)(`b`,{children:W(`update`,`skew.title`)}),(0,L.jsx)(`span`,{children:i}),(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:e,children:W(`update`,`refresh.confirmLabel`)})]})}var ji=[`info`,`success`,`warning`,`error`,`muted`],Mi=4e3,Ni=4e3,Pi=/^[A-Za-z0-9._:-]{1,64}$/,Fi={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 Ii(e){return typeof e==`string`&&ji.includes(e)}function Li(e){return e===0||e===1||e===2||e===3}var Ri=class extends Error{};function zi(e){let t=0,n=new Set,r=(e,i,a)=>{if(a>12)throw new Ri(`${i}: deeper than 12`);if(++t>400)throw new Ri(`more than 400 elements`);if(!e||typeof e!=`object`||Array.isArray(e))throw new Ri(`${i}: not an element`);let o=e,s=o.type;if(s!==`box`&&s!==`text`&&s!==`button`&&s!==`input`)throw new Ri(`${i}: unknown element ${JSON.stringify(s)}`);for(let e of Object.keys(o))if(!Fi[s].has(e))throw new Ri(`${i}: ${s} has no prop "${e}"`);if(o.tone!==void 0&&!Ii(o.tone))throw new Ri(`${i}: tone must be one of ${ji.join(`, `)}`);if(s===`text`){if(typeof o.text!=`string`||o.text.length>4e3)throw new Ri(`${i}: text must be a string of at most ${Mi} chars`);if(o.bold!==void 0&&typeof o.bold!=`boolean`)throw new Ri(`${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`||!Pi.test(o.key))throw new Ri(`${i}: bad ${s} key`);if(n.has(o.key))throw new Ri(`${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 Ri(`${i}: ${e} must be a string of at most ${Ni} 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 Ri(`${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 Ri(`${i}: direction must be "row" or "column"`);for(let e of[`gap`,`padding`])if(o[e]!==void 0&&!Li(o[e]))throw new Ri(`${i}: ${e} must be 0-3`);if(o.border!==void 0&&typeof o.border!=`boolean`)throw new Ri(`${i}: border must be boolean`);if(!Array.isArray(o.children))throw new Ri(`${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 Ri)return{ok:!1,error:e.message};throw e}}function Bi(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=zi(t.tree);r.ok&&n.push({plugin:t.plugin,id:t.id,title:t.title,tree:r.tree})}return n}function Vi(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 Hi(e,t){return e!==null&&t!==null&&e.plugin===t.plugin&&e.pane===t.pane&&e.key===t.key}function Ui(e,t){return e.find(e=>Hi(e,t))??e[0]??null}function Wi(e,t,n){if(e.length===0)return null;let r=e.findIndex(e=>Hi(e,t));return r<0?e[0]??null:e[(r+n+e.length)%e.length]??null}var Gi=(e,t)=>n=>({...n,tasks:n.tasks.map(n=>n.id===e?{...n,...t}:n)}),Ki=(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 qi(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 Ji=(e,t)=>n=>{let r=t?n.tasks:n.archived??[],i=qi(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}},Yi=(e,t)=>n=>{let r=[...n.tasks,...n.archived??[]],i=t?qi(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)}:{}}},Xi={"task.pin":(e,t)=>Gi(e,{pinned:t.pinned===!0}),"task.keep":(e,t)=>Gi(e,{kept:t.kept===!0}),"task.setStatus":(e,t)=>Gi(e,{status:t.status}),"task.rename":(e,t)=>Ki(e,String(t.title)),"task.archive":(e,t)=>Ji(e,t.archived===!0),"task.delete":(e,t)=>Yi(e,t.cascade===!0)};Object.keys(Xi);function Zi(e,t){return Xi[e]?.(String(t.taskId),t)??null}var Qi=`rove.web.selection`,$i=`null`,ea=300;function ta(){try{let e=JSON.parse(localStorage.getItem(Qi)??`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 ra(e){return!!e&&typeof e==`object`&&`tasks`in e&&Array.isArray(e.tasks)}var ia=`rove.web.visits`,aa=20;function oa(){try{let e=JSON.parse(localStorage.getItem(ia)??`[]`);return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.taskId==`string`):[]}catch{return[]}}function sa(e,t){if(t)return e?.tasks.find(e=>e.id===t)??e?.archived?.find(e=>e.id===t)}function ca(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 la=class{client;tasks=g(null);remote=g([]);tabs=g({});tabsSettled=g(!1);mods=g([]);installedMods=g(new Set);selection=g(ta());visits=g(oa());tabTimer=null;tabsReadAt=-1/0;tabScope=new Set;tabSets=new Map;tabReads=new Map;served=null;edits=new Map;pendingSelect=null;selectIntent=0;provisioning=new Map;viewingSent=$i;taskShown=!0;viewingExtras=()=>({});constructor(e){this.client=e,e.onOpen(()=>{e.request(`tasks.subscribe`).then(e=>this.acceptTasks(e)),this.viewingSent=$i,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=>{ra(e)&&this.acceptTasks(e)}),e.on(`tabs`,e=>this.scheduleTabRefresh(na(e))),e.on(`mods`,e=>this.mods.set(Bi(e)??[]))}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??ua(n)?.id??null};this.selection.set(r),localStorage.setItem(Qi,JSON.stringify(r));let i=[{...r,at:Date.now()},...this.visits.get().filter(e=>e.taskId!==r.taskId||e.tabId!==r.tabId)].slice(0,aa);this.visits.set(i),localStorage.setItem(ia,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=$i)}))}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,H(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=Zi(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&&sa(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=ca(r,n.tasks,this.selection.get(),this.visits.get());i?.taskId?this.commitSelection(i.taskId,i.tabId):i&&(this.selection.set(i),localStorage.setItem(Qi,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+ea-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 ua(e){return e.find(e=>e.alive!==!1)??e[0]}function da({model:e}){let t=_(e.selection),n=_(e.tasks),r=_(e.remote),i=sa(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 fa=[`sidebar`,`workspace`,`files`];function pa(e,t,n){let r=fa.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 ma=`.split-leaf.is-active textarea.xterm-helper-textarea`,ha={sidebar:[`.rail`,`.rail`],workspace:[`.workspace`,ma],files:[`.side-panel`,`.side-view:not([hidden]) :is([tabindex='0'], input)`]};function ga(){for(let e of document.querySelectorAll(ma))if(e.closest(`[data-stream]`)?.getClientRects().length)return e;return null}function _a(){let e=ga();return e?.focus(),e!==null}function va(e){let t=pa(Object.keys(ha).find(e=>document.activeElement?.closest(ha[e][0]))??`sidebar`,e,{filesVisible:document.querySelector(ha.files[0])!==null});t&&document.querySelector(ha[t][1])?.focus()}var ya=[];function ba(e){ya.push(e)}var xa={workspace:`workspace`,sidebar:`sidebar`,files:`files`,terminal:`terminal`};function Sa(){let e=ya.flatMap(e=>e()),t=new Set(e.filter(e=>!e.prefix).map(e=>e.id)),n=e.map(e=>{let t=Ci(e.id,e.prefix?`prefix`:`direct`);return t?{...e,chords:t}:e});for(let r of e){let e=r.prefix?Ci(r.id,`direct`):void 0;if(!e||e.length===0||t.has(r.id))continue;t.add(r.id);let i=si.find(e=>e.id===r.id)?.scope??`global`;n.push({...r,prefix:!1,chords:e,...xa[i]?{surface:xa[i]}:{}})}return n}function Ca(e,t){return!e.surface||e.surface===t||t===`terminal`&&e.surface===`workspace`}function wa(e,t){return e.surface===t?0:e.surface?1:2}function Ta(){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 Ea(e,t){let n=new Set,r=new Set;for(let i of Sa())!Ca(i,t)||i.live?.(e)===!1||(i.prefix?r:n).add(i.id);return{direct:n,prefix:r,inputPassthrough:t===`terminal`}}function Da(){let e=new Set(Sa().map(e=>e.id));return si.filter(t=>e.has(t.id))}var Oa=new Map,ka=g(null);function Aa(e){return Oa.set(e.stream,e),()=>{Oa.get(e.stream)===e&&Oa.delete(e.stream),ka.get()===e&&ka.set(null)}}function ja(e){return Oa.get(e)}ba(()=>[{id:`terminal.scroll-up`,chords:[`ctrl+pageup`],prefix:!1,surface:`terminal`,run:()=>ka.get()?.scrollPages(-1)},{id:`terminal.scroll-down`,chords:[`ctrl+pagedown`],prefix:!1,surface:`terminal`,run:()=>ka.get()?.scrollPages(1)},{id:`terminal.reset`,chords:[`f5`],prefix:!1,surface:`terminal`,run:()=>ka.get()?.reset()}]);var Ma={INPUT:!0,TEXTAREA:!0,SELECT:!0},Na=`.rail, .side-panel, dialog, [role=dialog], [role=menu], [role=listbox]`;function Pa(e){return!e||e.tagName===`BODY`||e.tagName===`HTML`?`none`:e.closest(`.xterm`)?`terminal`:Ma[e.tagName]===!0||e.isContentEditable?`field`:e.closest(Na)?`pane`:`loose`}function Fa(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 Ia(){(0,h.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=ga(),n=document.activeElement;if(!Fa(e,Pa(n instanceof HTMLElement?n:null),{overlay:B.get()!==null||mn.get()!==null||V.get()!==null||Cn.get()!==null,terminal:t!==null}))return;let r=t?.closest(`[data-stream]`)?.dataset.stream,i=r?ja(r):void 0;!t||!i||(e.preventDefault(),t.focus(),i.input(`\x1B`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function La(e){return e.focusedPane===`sidebar`?`sidebar`:e.hasSelection||e.hasOpenPage?`content`:`sidebar`}var Ra=`(max-width: 559px)`,za=g(`sidebar`),Ba=()=>za.set(`workspace`),Va=()=>za.set(`sidebar`);function Ha(e){V.set(e),Ba()}function Ua(e){vn.set(e),Ha(`compare`)}var Wa,Ga=()=>(Wa??=window.matchMedia(Ra),Wa),Ka=()=>Ga().matches,qa=e=>{let t=Ga();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)};function Ja(){return(0,h.useSyncExternalStore)(e=>{let t=Ga();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>Ga().matches)}function Ya(e,t,n){return La({focusedPane:e,hasSelection:t,hasOpenPage:n})}var Xa=Reflect.get(globalThis,`__roveRelay`);function Za(e,t){return Xa?Xa.fetch(e,t):fetch(e,t)}function Qa(e,t){return Xa?new Xa.WebSocket(e,t):new WebSocket(e,t)}function $a(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 eo(e=Za){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 to(e=Za){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 no(e,t=Za){try{let n=await t(`/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:e}),credentials:`omit`}),r=$a(n.status,await n.json().catch(()=>null));return r.kind===`ok`&&a(r.token),r}catch{return{kind:`unreachable`}}}async function ro(e=Za){let t=i();o(),t&&await e(`/logout`,{method:`POST`,headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}function io(e){if(!e)return null;switch(e.kind){case`ok`:return null;case`wrong`:return F(`login.wrong`);case`locked`:return F(`login.locked`,{minutes:e.minutes});case`lockedHost`:return F(`login.lockedHost`);case`unreachable`:return F(`login.unreachable`)}}function ao(){I();let[e,t]=(0,h.useState)(``),[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(null),o=io(i);return(0,L.jsx)(`div`,{className:Zt,children:(0,L.jsxs)(`form`,{className:Qt,onSubmit:async i=>{if(i.preventDefault(),n||!e)return;r(!0);let o=await no(e);if(o.kind===`ok`){window.location.reload();return}t(``),a(o),r(!1)},children:[(0,L.jsxs)(`span`,{className:Yt,children:[(0,L.jsx)(`span`,{className:Xt,children:`[`}),` rove `,(0,L.jsx)(`span`,{className:Xt,children:`]`})]}),(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:F(`login.title`)}),(0,L.jsx)(`p`,{className:`text-muted`,children:F(`login.body`)}),(0,L.jsx)(`input`,{className:ln,type:`password`,autoComplete:`current-password`,"aria-label":F(`login.field`),placeholder:F(`login.field`),autoFocus:!0,value:e,disabled:n,onChange:e=>{t(e.target.value),a(null)}}),o&&(0,L.jsx)(`p`,{className:`text-error`,role:`alert`,children:o}),(0,L.jsx)(`div`,{className:un,children:(0,L.jsx)(`button`,{type:`submit`,className:Be(),disabled:n||!e,children:F(n?`login.checking`:`login.submit`)})})]})})}function oo(e){return(0,L.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,L.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 K=120;function so(e,t,n,r=e-t){return e+t+8<=n?e:Math.max(8,Math.min(r,n-t-8))}function co(e){let{item:t}=e;return(0,L.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:Yn({selected:e.selected,open:e.open,danger:t.danger}),onMouseEnter:e.onEnter,onMouseLeave:e.onLeave,onClick:e.onPick,children:[(0,L.jsx)(`span`,{children:t.label}),t.children?(0,L.jsx)(oo,{right:!0,className:Qn(!!(e.selected||e.open))}):t.checked?(0,L.jsx)(`span`,{className:$n,"aria-hidden":!0,children:`✓`}):t.key&&(0,L.jsx)(`span`,{className:Zn({selected:e.selected,danger:t.danger}),children:t.key})]})}function lo(){let e=_(mn),[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,v]=(0,h.useState)({x:0,y:0});if((0,h.useLayoutEffect)(()=>{if(!e||!l.current)return;n(e.fromKeyboard?0:-1),i(null),c(!1);let{width:t,height:r}=l.current.getBoundingClientRect();m({x:so(e.x,t,window.innerWidth),y:so(e.y,r,window.innerHeight)});let a=e.target;return a?.setAttribute(`data-menu-open`,``),()=>a?.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();v({x:so(t.right+2,i,window.innerWidth,t.left-i-2),y:so(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=()=>mn.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 y=r===null?null:e.items[r]?.children,b=e=>{e.run&&(mn.set(null),e.run())},x=e=>{window.clearTimeout(f.current),i(e),c(!1),o(-1)};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{ref:l,className:Jn(),role:`menu`,style:{left:p.x,top:p.y},children:e.items.map((a,o)=>(0,L.jsxs)(h.Fragment,{children:[o>0&&a.section!==e.items[o-1]?.section&&(0,L.jsx)(`hr`,{className:`-mx-1 my-1 h-px flex-none border-none bg-line`}),(0,L.jsx)(co,{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),K):i(null)},onLeave:()=>{window.clearTimeout(f.current),o!==r&&n(-1)},onPick:()=>a.children?x(o):b(a)})]},a.label))}),y&&(0,L.jsx)(`div`,{ref:u,className:Jn(!0),role:`menu`,style:{left:g.x,top:g.y},children:y.map((e,t)=>(0,L.jsx)(co,{item:e,selected:t===a,onEnter:()=>{o(t),c(!0)},onLeave:()=>o(-1),onPick:()=>b(e)},e.label))})]})}function uo(){let e=_(B),t=_(gn);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(lo,{}),e,(0,L.jsx)(`div`,{className:er,"aria-live":`polite`,children:t.map(e=>{let t=`${nr(e.tone===`error`)} ${e.leaving?`is-leaving`:``}`,n=e.action;return n?(0,L.jsxs)(`div`,{className:`${t} ${tr}`,children:[(0,L.jsx)(`span`,{children:e.text}),(0,L.jsx)(R,{onClick:()=>{jn(e.id),n.run()},children:`[ ${n.label} ]`})]},e.id):(0,L.jsx)(`button`,{type:`button`,className:t,onClick:()=>jn(e.id),children:e.text},e.id)})})]})}function fo(e){return e.urls[e.at]??``}function po(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 ho(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 go(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=Co(t,e.id)??t}return t}function _o(e,t){let n=`t${e.next}`,r={id:n,urls:t,at:t.length-1};return go(ho({...e,tabs:[...e.tabs,r],next:e.next+1},n))}function vo(e){return _o(e,[])}function yo(e,t){return{...e,tabs:e.tabs.map(e=>e.id===t.id?t:e)}}function bo(e,t,n){let r=e.tabs.find(e=>e.id===t);if(!r||fo(r)===n)return e;let i=[...r.urls.slice(0,r.at+1),n].slice(-30);return yo(e,{...r,urls:i,at:i.length-1})}function xo(e,t,n){let r=e.tabs.find(e=>e.id===t);return!r||n===r.at||n<0||n>=r.urls.length?e:yo(e,{...r,at:n})}function So(e,t){let n=e.tabs.find(e=>fo(e)===t);if(n)return ho(e,n.id);let r=e.tabs.find(e=>fo(e)===``);return r?bo(ho(e,r.id),r.id,t):_o(e,[t])}function Co(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 wo(e,t){return e.tabs.some(e=>e.id===t)?Co(e,t):e}function To(e,t){let n=e.tabs.find(e=>e.id===t);return n?{...e,tabs:[n],active:t,recent:[t]}:e}function Eo(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 Do(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 Oo=[`quota`,`files`,`file`,`diff`,`chat`,`browser`],ko=1e3;function Ao(){return{columns:[{kind:`files`}],weights:{}}}function jo(e,t){return e.columns.find(e=>e.kind===t)}function Mo(e){return e.slice(e.lastIndexOf(`/`)+1)}function No(e,t){return{...e,columns:e.columns.map(e=>e.kind===t.kind?t:e)}}function Po(e){return[...e].sort((e,t)=>Oo.indexOf(e.kind)-Oo.indexOf(t.kind))}function Fo(e,t){return{...e,columns:Po([...e.columns,t])}}function Io(e,t){return jo(e,t)||t===`file`?e:Fo(e,t===`diff`?{kind:t,path:`.`,scope:`working`}:t===`browser`?mo():{kind:t})}function Lo(e,t){let n=jo(e,`file`);return n?n.kind===`file`&&n.path===t?e:No(e,{kind:`file`,path:t}):Fo(e,{kind:`file`,path:t})}function Ro(e,t,n){let r={kind:`diff`,path:t,scope:n},i=jo(e,`diff`);return i?i.kind===`diff`&&i.path===t&&i.scope===n?e:No(e,r):Fo(e,r)}function zo(e,t){let n=jo(e,`browser`);return n?.kind===`browser`?No(e,So(n,t)):Fo(e,So(mo(),t))}function Bo(e,t){if(!jo(e,t))return e;let{[t]:n,...r}=e.weights;return{columns:e.columns.filter(e=>e.kind!==t),weights:r}}function Vo(e,t){let n=jo(e,`browser`);if(n?.kind!==`browser`)return e;let r=t(n);return r===n?e:r?No(e,r):Bo(e,`browser`)}function Ho(e,t,n,r=!1){if(t&&jo(e,n)){let t=Bo(e,n);return{panel:t,open:t.columns.length>0}}if(r){let t=e.columns.filter(e=>e.kind===n);return{panel:Io({...e,columns:t},n),open:!0}}return{panel:Io(e,n),open:!0}}function Uo(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*ko)}function Wo(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 Go(e){return Object.keys(e.weights).length===0?e:{...e,weights:{}}}function Ko(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 qo=Oo.filter(e=>e!==`chat`&&e!==`file`),Jo=g(`terminal`),Yo=`rove.web.panelWidth`,Xo=`rove.web.panelOpen`,Zo=g((()=>{let e=Number(localStorage.getItem(Yo));return Number.isFinite(e)&&e>0?e:null})());Zo.subscribe(()=>{let e=Zo.get();e===null?localStorage.removeItem(Yo):localStorage.setItem(Yo,String(Math.round(e)))}),Zo.subscribe(Fn);var Qo=g(localStorage.getItem(Xo)===`1`);Qo.subscribe(()=>localStorage.setItem(Xo,Qo.get()?`1`:`0`));var $o=g(!1);Qo.subscribe(()=>{Qo.get()||$o.set(!1)});function es(e,t,n=window.innerWidth){let r=Math.max(280,n-t-320);return Math.max(280,Math.min(r,Math.round(e)))}function ts(e,t,n=window.innerWidth){return e<2?null:es(Math.max(300,Math.min(440,n*.28))*e,t,n)}var ns=[`files`,`diff`,`browser`];function rs(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.taskId==`string`&&t.taskId!==``&&ns.includes(t.view)&&typeof t.at==`number`&&(t.url===void 0||typeof t.url==`string`)&&(t.path===void 0||typeof t.path==`string`)}function is(e){return e.narrow?{panel:!1,panelOpen:!1,narrow:!0}:{panel:!0,panelOpen:e.panelOpen&&!e.zen,narrow:!1}}function as(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 os(e,t){return t.url?zo(e,t.url):t.path?t.tab===`file`?Lo(e,t.path):Ro(e,t.path,`working`):Io(e,t.tab)}var ss=[`files`,`chat`,`diff`,`browser`,`quota`],cs=e=>e===`branch`||e===`task`?e:`working`;function ls(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:cs(t.scope)}:t.kind===`browser`?Do(t.tabs,t.active,t.recent,t.next):null}function us(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 ds(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 fs(e){let t=ds(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:cs(n.scope)})}if(i===`browser`){let n=Do(t.tabs.filter(e=>e.kind===`browser`),void 0,t.recent,e.next);n&&r.push(n)}}return{columns:Po(r),weights:{}}}function ps(e){if(!e||typeof e!=`object`)return null;let t=e;if(!Array.isArray(t.columns))return fs(t);let n=[];for(let e of t.columns){let t=ls(e);t&&!n.some(e=>e.kind===t.kind)&&n.push(t)}return{columns:Po(n),weights:us(t.weights,n)}}function ms(e,t){let n=Ao(),r=typeof t==`string`&&t!==``?t:``;return e!==`browser`&&!r?n:{...n,columns:[...n.columns,r?So(mo(),r):mo()]}}function hs(e){try{let t=JSON.parse(e??`{}`);return t&&typeof t==`object`&&!Array.isArray(t)?Object.entries(t):[]}catch{return[]}}function gs(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 _s(e,t){let n={};for(let[t,r]of hs(e)){let e=ps(r);e&&(n[t]=e)}let r=new Map(hs(t.tab).filter(([,e])=>ss.includes(e))),i=new Map(hs(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 vs=`rove.web.panels`,ys=`rove.web.panelTab`,bs=`rove.web.panelUrl`;function xs(){let e={tab:localStorage.getItem(ys),url:localStorage.getItem(bs)},t=_s(localStorage.getItem(vs),e);return(e.tab!==null||e.url!==null)&&(localStorage.setItem(vs,JSON.stringify(t)),localStorage.removeItem(ys),localStorage.removeItem(bs)),t}var Ss=g(xs()),Cs=Ao();function ws(e){return _(Ss)[e]??Cs}function Ts(e){let t=ws(e??``);return _(Qo)&&(e===null||t.columns.length>0)}function Es(e,t){let n=Ss.get()[e]??Cs,r=t(n);if(r===n)return;let i=gs(Ss.get(),e,r);Ss.set(i),localStorage.setItem(vs,JSON.stringify(i))}function Ds(e,t){Es(e,e=>Io(e,t)),Qo.set(!0),Ka()&&Jo.set(t)}function Os(e,t){let n=Qo.get(),r=Ho(Ss.get()[e]??Cs,n&&!bn.get(),t,!n);Es(e,()=>r.panel),Qo.set(r.open),r.open&&bn.get()&&bn.set(!1)}function ks(e){Es(e.taskId,t=>Ro(t,e.path,e.scope)),Qo.set(!0),bn.get()&&bn.set(!1),Ka()&&Jo.set(`diff`)}function As(e,t){Es(e,e=>Lo(e,t)),Qo.set(!0),bn.get()&&bn.set(!1),Ka()&&Jo.set(`file`)}function js(e,t){Es(e,e=>zo(e,t)),Qo.set(!0),bn.get()&&bn.set(!1),Ka()&&Jo.set(`browser`)}function Ms(e,t){let n=Ss.get()[e]??Cs;!Ka()&&n.columns.length===0&&Qo.set(!1),Ka()&&Jo.get()===t&&!jo(n,t)&&Ds(e,`files`)}function Ns(e,t){Es(e,e=>Bo(e,t)),Ms(e,t)}function Ps(e,t){Es(e,e=>Vo(e,t)),Ms(e,`browser`)}function Fs(e,t){Ps(e,e=>wo(e,t))}function Is(e,t){let n=as(e,{taskId:t,narrow:Ka()});Es(e.taskId,e=>os(e,n)),n.show&&(Qo.set(!0),bn.get()&&bn.set(!1))}var Ls={Enter:`return`," ":`space`,Escape:`escape`,ArrowUp:`up`,ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,PageUp:`pageup`,PageDown:`pagedown`};function Rs(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 Ls[e.key]??e.key.toLowerCase()}function zs(e){let t=Rs(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 Bs(e){return e.startsWith(`shift+`)&&e.length===7?e.slice(6).toUpperCase():e}new Map(si.map(e=>[e.id,{keys:[...e.keys],prefixKeys:e.prefixKeys&&[...e.prefixKeys],hint:e.hint?{...e.hint}:void 0}]));var Vs=new Map(si.map(e=>[e.id,e]));function Hs(e){return Vs.get(e)}function Us(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 Ws(e){return e.hint?.keys??e.keys[0]}function Gs(e){let t=Hs(e);if(!t)return null;let n=Ws(t);return n&&n.length>0?n:null}function Ks(e){return e.keys.length>0?e.hint?.keys??e.keys[0]??null:e.prefixKeys?.length?null:e.hint?.keys??null}function qs(e,t){return e.scope===`global`?!0:t===null?!1:e.scope===t||t===`terminal`&&e.scope===`workspace`}function Js(e,t,n,r){let i=[],a=[],o=[],s=new Map;for(let c of e){let e=Ks(c),l=qs(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 Ys={global:`Global`,sidebar:`Sidebar`,workspace:`Workspace`,files:`Files`,inbox:`Inbox`,terminal:`Terminal`};function Xs(e){return e?Ys[e]:`Global`}function Zs(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`:Hs(e)?.category??`Global`}function Qs(e,t,n){let r=e.trim();return Us(r,t)||Us(r,n)}var $s={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`}},ec={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:`检查已通过`}},tc={status:{commands:`{key} commands`,help:`{key} help`,sidebar:`{key} sidebar`,settings:`settings`},pane:{move:`move`,open:`open`,collapse:`collapse`,diff:`diff`}},nc={status:{commands:`{key} 命令`,help:`{key} 帮助`,sidebar:`{key} 侧栏`,settings:`设置`},pane:{move:`移动`,open:`打开`,collapse:`折叠`,diff:`差异`}},rc={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`}},ic={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 ac(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 oc(e,t){return Me.get()===`zh`?t:e}function sc(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e)):e}var cc=(e,t)=>sc(ac(oc($s,ec),e)??ac($s,e)??e,t),lc=(e,t)=>sc(ac(oc(tc,nc),e)??ac(tc,e)??e,t),uc=(e,t)=>sc(ac(oc(Jr,Yr),e)??ac(Jr,e)??e,t);function dc(e){return oc(rc,ic).desc[e]??rc.desc[e]??e}function fc(e){let t=dc(e),n=t.search(/\s—\s|——/);return n>0?t.slice(0,n):t}function pc(e){return oc(rc,ic).category[e]??e}var mc=(e,t)=>sc(ac(oc(Qr,$r),e)??ac(Qr,e)??e,t),hc=(e,t)=>sc(ac(oc(Kr,qr),e)??ac(Kr,e)??e,t),gc=e=>e.split(` + `).map(e=>di(e)).join(` + `);function _c(e){let t=pc(Xs(e.scope));return e.kind===`here`?cc(`here`,{surface:t}):e.kind===`direct`?cc(`direct`):e.kind===`prefix`?cc(`afterPrefix`):cc(`otherPane`,{surface:t})}function vc(e){let t=document.activeElement instanceof HTMLElement?document.activeElement:null;B.set((0,L.jsx)(yc,{model:e,surface:Ta(),origin:t}))}function yc({model:e,surface:t,origin:n}){I();let r=_(fi),[i,a]=(0,h.useState)(!1),[o,s]=(0,h.useState)(``),c=(0,h.useRef)(null),l=(0,h.useMemo)(()=>Ea(e,t),[e,t]),u=(0,h.useMemo)(()=>Js(Da(),t===`terminal`?`terminal`:t,_i(),l),[l,t,r]).map(e=>({...e,rows:e.rows.filter(e=>Qs(o,dc(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===`?`)Mn();else if(!i&&t.key===`/`)a(!0);else return;t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[i]),(0,L.jsx)(Cr,{title:cc(`title`),wide:!0,children:(0,L.jsxs)(`div`,{className:`${qn} help`,children:[(0,L.jsxs)(`div`,{className:bt,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-muted`,children:t?cc(`focused`,{surface:pc(Xs(t))}):cc(`allBindings`)}),(0,L.jsx)(`p`,{className:`text-muted`,children:cc(`grammar`,{prefix:vi()})})]}),(0,L.jsxs)(`div`,{className:xt,children:[(0,L.jsx)(`span`,{className:`subtle`,children:cc(`scrollKeys`)}),(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Mn,children:cc(`esc`)})]})]}),i?(0,L.jsx)(`input`,{className:ln,autoFocus:!0,spellCheck:!1,value:o,placeholder:cc(`search`),onChange:e=>{s(e.target.value),c.current?.scrollTo({top:0})}}):(0,L.jsx)(`p`,{className:`text-muted`,children:cc(`filter`)}),u.length===0&&(0,L.jsx)(`p`,{className:`text-muted`,children:cc(`noResults`)}),(0,L.jsx)(`div`,{className:St,ref:c,children:u.map((e,t)=>(0,L.jsxs)(`section`,{className:Ct,children:[(0,L.jsx)(`h2`,{className:wt,children:_c(e)}),e.rows.map(t=>(0,L.jsxs)(`div`,{className:Tt,children:[(0,L.jsx)(`span`,{className:`mono ${Et}`,children:gc(t.primary)}),(0,L.jsx)(`span`,{className:`flex-1`,children:dc(t.binding.id)}),t.aliases.length>0&&(0,L.jsx)(`span`,{className:`text-muted`,children:`(${t.aliases.map(gc).join(`, `)})`})]},`${e.kind}-${t.binding.id}`))]},`${e.kind}-${e.scope??t}`))})]})})}function bc(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 xc(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 Sc=e=>e===`routine_failed`,Cc=e=>`${e.taskId??``}:${e.tabId??``}`;function wc(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)||Cc(e).localeCompare(Cc(t)))}function Tc(e,t,n){let r=new Set(t),i=wc(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=>Cc(e)===Cc(n));return a<0||i.length===1?i[0]??null:i[(a+1)%i.length]??null}function Ec(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 Dc(e,t,n=!1){let r=`attention.dismiss`,i;if(Sc(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=>H(String(e),`error`))}function Oc(e,t){Dc(e,t),Mn(),_n.set(t.automationId??null),V.set(`routines`)}function kc(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 Ac=`size-14 rounded-sm border-hairline border-line object-cover`;function jc({name:e,thumb:t}){if(t)return(0,L.jsx)(`img`,{src:t,alt:``,draggable:!1,className:Ac});let n=e.includes(`.`)?e.split(`.`).pop()??``:``;return(0,L.jsx)(`span`,{className:`${Ac} flex items-center justify-center font-mono text-meta uppercase text-muted`,children:n.slice(0,4)||`file`})}function Mc({item:e,onRemove:t}){let[n]=(0,h.useState)(e.pending);return(0,L.jsxs)(`li`,{className:`group relative size-14 shrink-0 ${n?`motion-safe:animate-rise-in`:``}`,title:`${e.name} · ${kc(e.size)}`,children:[(0,L.jsx)(`div`,{className:`transition-opacity duration-150 motion-reduce:transition-none ${e.pending?`opacity-50`:``}`,children:(0,L.jsx)(jc,{...e})}),(0,L.jsx)(`button`,{type:`button`,"aria-label":F(`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 Nc({items:e,onRemove:t}){return e.length===0?null:(0,L.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,L.jsx)(Mc,{item:e,onRemove:t},e.id))})}var Pc=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`application/pdf`];function Fc(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 Ic(e){return(0,L.jsxs)(`label`,{className:e.className,title:e.title,children:[e.children,(0,L.jsx)(`input`,{type:`file`,accept:Pc.join(`,`),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)}})]})}function Lc(e,t){let n=t.filter(e=>e.path!==void 0);return n.length===0?e:`${e}\n\n${n.map((e,t)=>`${e.kind===`pdf`?`pdf`:`images`}[${t}]: ${e.path}`).join(`
|
|
17
17
|
`)}`}async function Rc(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}var zc=112;async function Bc(e){if(e.type.startsWith(`image/`))try{let t=await createImageBitmap(e),n=Math.min(1,zc/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 Vc(e){if(!e)return[];try{let t=JSON.parse(sessionStorage.getItem(e)??`[]`);return Array.isArray(t)?t:[]}catch{return[]}}var Hc=0;function Uc(e,t,n){let[r,i]=(0,h.useState)(()=>Vc(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()}-${Hc++}`,i=await Bc(n);s(e=>[...e,{id:r,name:n.name,size:n.size,mime:n.type,...i?{thumb:i}:{}}]);try{let t=await e.client.request(`attachment.put`,{mime:n.type,data:await Rc(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){if(!Pc.includes(t.type))continue;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 Wc(e){return(0,L.jsx)(Nc,{items:e.attachments.map(e=>({...e,pending:e.path===void 0})),onRemove:e.onRemove})}function Gc(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,L.jsx)(`div`,{ref:t,className:zn,"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,L.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:Bn(t.id===e.value,t.dim),title:t.title,onClick:()=>e.onChange(t.id),children:t.label},t.id))})}function Kc(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: none) and (pointer: coarse)`).matches}var qc=/^(?:enter|return|tab|esc|space|shift|ctrl\+\S+|cmd\+\S+|alt\+\S+|[↑↓←→]+(?:\/[↑↓←→]+)?|[b-hj-z](?:\/[b-hj-z])?)(?:\/\S+)?(?:\s|$)/i;function Jc(e){return e.split(`·`).map(e=>e.trim()).filter(e=>e&&!qc.test(e)).join(` · `)}function Yc(e){return Kc()?Jc(e):e}function Xc(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 Zc(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 Qc(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.toLowerCase().includes(n)):e}function $c(e){return e.startsWith(`~`)||e.includes(`/`)}function el(e,t){return t?e===`~`?t:e.startsWith(`~/`)?t+e.slice(1):e:e}function tl(e){return e.length>1?e.replace(/\/+$/,``):e}var nl=/^(?:(?:https?|ssh|git):\/\/[A-Za-z0-9[]\S*|[A-Za-z0-9._-]+@[A-Za-z0-9][A-Za-z0-9.-]*:\S+)$/i,rl=/^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/(?![.]+(?:git)?$)[A-Za-z0-9._-]{1,100}$/i;function il(e){let t=e.trim();return nl.test(t)||rl.test(t)?t:null}function al(e,t){return e.filter(e=>e.enabled!==!1||e.id===t)}function ol(e,t){return(e.find(e=>e.id===t)??e.find(e=>e.ready!==!1)??e[0])?.id??``}function sl(e,t){return!e||e.acceptsModel===!1?[]:[{id:``,label:t},...(e.models??[]).map(e=>({id:e.id,label:e.label??e.id}))]}function cl(e,t){let n=e?.effortLevels??[];return n.length===0?[]:[{id:``,label:t},...n.map(e=>({id:e,label:e}))]}function ll(e,t,n,r){let i=t?e.find(e=>e.id===t)?.label??t:r;return n?`${i} ${n}`:i}function ul(e,t){return e.includes(t)?e.length>1?e.filter(e=>e!==t):e:[...e,t]}function dl(e){let[t,n,...r]=e;return!t||!n?t??``:r.length>0?`${t} + ${n} +${r.length}`:`${t} + ${n}`}function fl(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 pl(e){let[t,...n]=e;if(!t)return``;let r=Zc(t).base;return n.length>0?`${r} +${n.length}`:r}function ml(e,t){return e.includes(t)?e.filter(e=>e!==t):e.length>=8?e:[...e,t]}function hl(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function gl(e){let[t,...n]=e.repos;if(!t)throw Error(`no repo`);let r=e.begin?``:Xc(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.begin&&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 _l(e,t,n,r){let i=t?{engine:t}:{},{taskId:a}=await e(`task.openScratch`,i);return r?await e(`tab.new`,{taskId:a,kind:`engine`,...i,prompt:n.trim()}):n.trim()&&await e(`task.rename`,{taskId:a,title:Xc(n)}),a}async function vl(e,t,n,r,i,a=r.trim()){let o=n?{engine:n}:{},s=r.trim()?Xc(r):``,{taskId:c}=await e(`task.openCheckout`,{repo:t,...o,...s?{title:s}:{}});return i&&await e(`tab.new`,{taskId:c,kind:`engine`,...o,prompt:a}),c}function yl(e,t){let n=e.querySelector(`[data-field="${t}"]`);(n?.matches(`input, textarea`)?n:n?.querySelector(`[tabindex='0']`))?.focus()}function bl(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&&yl(e,a)}var xl=new WeakMap,Sl=200,Cl=e=>`client`in e?e.client:e,wl=(e,t)=>t?`${e} ${JSON.stringify(t)}`:e;function q(e,t,n){return xl.get(Cl(e))?.get(wl(t,n))}function Tl(e,t,n,r){let i=Cl(e),a=xl.get(i)??new Map,o=wl(t,n);a.delete(o),a.set(o,r),xl.set(i,a);for(let e of a.keys()){if(a.size<=Sl)break;a.delete(e)}return r}function El(e,t,n){return Cl(e).request(t,n).then(r=>Tl(e,t,n,r))}function Dl(e,t,n){return n&&n!==`leaf-1`?`${e}::${t}::${n}`:`${e}::${t}`}function Ol(e,t,n){let r=t?{repo:t}:{},[i]=(0,h.useState)(()=>{let t=q(e,`engines.list`,r),i=t?al(t.engines):[];return{offered:i,engine:t?ol(i,n??t.preferred):``}}),[a,o]=(0,h.useState)(i.offered),[s,c]=(0,h.useState)(i.engine);return(0,h.useEffect)(()=>{El(e,`engines.list`,r).then(e=>{let t=al(e.engines);o(t),c(ol(t,n??e.preferred))}).catch(()=>o([]))},[e]),{engines:a,engine:s,setEngine:c}}var kl=`shell`,Al=`pane:`,jl=e=>e.startsWith(Al),Ml=e=>e.slice(5);function Nl(e){let[t,n]=(0,h.useState)(()=>q(e,`plugin.panes`)?.panes??[]);return(0,h.useEffect)(()=>{El(e,`plugin.panes`).then(e=>n(e.panes)).catch(()=>n([]))},[e]),t}function Pl(e){let t=[...e.engines,...e.withShell?[{id:kl,name:F(`tab.shell`)}]:[],...(e.panes??[]).map(e=>({id:Al+e.id,name:e.title}))];return(0,L.jsx)(Gc,{label:F(`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?F(`newTask.notReady`):void 0}))})}function Fl(e,t){return Il(e,t,{kind:`engine`,latest:!0}).catch(e=>H(String(e),`error`))}async function Il(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 ja(Dl(t,r))?.reattach(),e.select(t,r)}async function Ll(e){await Il(e,(await e.client.request(`task.openScratch`,{})).taskId,{kind:`shell`})}var Rl=[`1`,`2`,`3`,`4`,`5`],J=[`tab`,`fork`,`scratch`],Y=[`message`,`attempts`,`engine`,`fork-base`,`destination`];function X(e){I();let{model:t,taskId:n}=e,r=t.tasks.get()?.tasks.find(e=>e.id===n),i=Ol(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}=wr(),{attachments:b,attach:x,remove:S,ready:C}=Uc(t,v),w=s===`fresh`&&a!==`fork`,T=a===`tab`&&s===`fresh`,E=Nl(t),D=i.engine===`shell`&&!w||jl(i.engine)&&!T?``:i.engine,O=D===kl,k=jl(D),A=a===`fork`,ee=(e,t)=>{let n=e===`scratch`&&t===`continue`&&a===`scratch`?`tab`:e;o(n),c(n===`scratch`?`fresh`:t)},j=()=>{let r=t.selection.get();return e.sourceTabId??(r.taskId===n?r.tabId:null)??`tab-1`},te=()=>t.tasks.get()?.tasks.find(e=>e.id===n)?.tabStatus?.[j()]?.reason===`dead`,ne=async()=>{let e=await t.client.request(`tab.handoff`,{taskId:n,tabId:j()});if(e.kind===`handoff`&&e.prompt)return e.prompt;throw Error(e.kind===`no-transcript`?W(`terminal`,`tab.noTranscriptToHandOff`,{engine:e.engine??``}):W(`terminal`,`tab.nothingToFork`))},re=()=>y(async()=>{let e=s===`continue`&&a===`tab`&&!O&&!k&&te(),i=[s===`continue`&&!e?await ne():``,Lc(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 Il(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(A){if(!r)throw Error(W(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(F(`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=fl(e);if(!t)throw e;H(e instanceof Error?e.message:String(e),`error`),Ua(t);return}a.forkRefused&&H(F(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?Ua(a.groupId):o&&t.selectWhenListed(o)}else if(O)await Il(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:Ml(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await Il(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:j()}:{}})});return(0,L.jsx)(Cr,{title:W(`terminal`,`tab.newChat.title`),wide:!0,children:(0,L.jsxs)(`form`,{className:qn,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(A||!e.shiftKey))e.preventDefault(),e.stopPropagation(),A?bl(e.currentTarget,Y,e.shiftKey?-1:1):ee(J[(J.indexOf(a)+1)%J.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(),ee(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&A&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),re()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:W(`terminal`,`tab.newChat.engine`)}),(0,L.jsx)(Pl,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:W(`terminal`,`tab.newChat.destLabel`)}),(0,L.jsx)(Gc,{label:W(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>ee(e,s),choices:J.map(e=>({id:e,label:W(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted`,children:[W(`terminal`,`tab.newChat.ctxLabel`),` `,(0,L.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,L.jsx)(Gc,{label:W(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>ee(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:W(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),A&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:W(`quickTask`,`attemptsLabel`)}),(0,L.jsx)(Gc,{label:W(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:Rl.map(e=>({id:e,label:e}))})]}),(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:F(`taskops.forkBranch`)}),(0,L.jsx)(`input`,{className:ln,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:F(`newChat.prompt`)}),(0,L.jsx)(`textarea`,{className:`${ln} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:F(`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,L.jsx)(Wc,{attachments:b,onRemove:S}),Kc()?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`pages.attachHintTouch`)}):(0,L.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${tn}`,children:W(`quickTask`,`legend`)}),_&&(0,L.jsx)(`p`,{className:`text-error`,children:_}),(0,L.jsx)(Or,{busy:g,submitLabel:F(`newChat.start`)})]})})}var zl=e=>e.split(`/`).filter(Boolean).pop()??e;function Bl(e,t,n=``){let r=zl(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&zl(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 Vl=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function Hl(e,t){let n=zl(e.repo),r=t.filter(t=>t!==e&&zl(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?Vl(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&Vl(e.repoId)===a)?i:a:Bl(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var Ul=/\s+#\d+\/\d+$/,Wl=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),Gl=e=>e.groupId&&e.kind!==`main`?`${e.machine?.id??``}\0${e.groupId}`:null;function Kl(e){let t=new Map;for(let n of e){let e=Gl(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(Wl);return t}function ql(e){return(e[0]?.label??``).replace(Ul,``)}function Jl(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 Yl=[`default`,`recent`,`attention`,`name`],Xl={folded:new Set,opened:new Set},Zl=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},Ql=e=>Zl(e.updatedAt??e.createdAt),$l=e=>Zl(e.createdAt),eu=(e,t)=>$l(t)-$l(e)||t.id.localeCompare(e.id),tu=(e,t)=>Ql(t)-Ql(e)||t.id.localeCompare(e.id),nu=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),ru={default:null,recent:eu,attention:(e,t)=>e.rank-t.rank||tu(e,t),name:(e,t)=>nu.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},iu=`~scratch`,au=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function ou(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(lu(ru[t]))}function su(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=au(e)?iu:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=ru[t],a=[...r].map(([e,t])=>{let n=t.sort(lu(i));if(e===`~scratch`&&t.every(au))return{repo:``,label:F(`rail.noProject`),tasks:n,key:iu,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:zl(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var cu=e=>e.kind===`main`?0:e.pinned?1:2,lu=e=>(t,n)=>cu(t)-cu(n)||(e?e(t,n):0);function uu(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 du(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)||uu(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 fu(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),fu(e,r.id,n);return n}function pu(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 mu(e,t=``,n=Xl,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&Us(a,e)),{children:s,nested:c}=du(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,zl(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?fu(s,t.id):[],m=u!==void 0&&a===``&&pu(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?Kl(t):new Map,o=new Set;for(let i of t){let t=Gl(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:ql(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=Jl(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 hu=e=>Math.max(0,...e.tasks.map($l));function gu(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...su(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>su(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?iu:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=ru[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(lu(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:Hl(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>hu(t)-hu(e)),e.sort===`name`&&l.sort((e,t)=>nu.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:mu(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 _u(e){return e.title??e.engineName??(e.kind===`engine`?F(`tab.engine`):F(`tab.shell`))}function vu(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 bu(e){return!!e&&yu(e.root).length>1}function xu(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 Su(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 Cu(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 wu(e,t,n){return e.kind===`engine`&&yu(t.root).some(e=>e.id===n&&e.own)}function Tu(e){return e.alive!==!1||!!e.split&&!yu(e.split.root).some(e=>e.own)}function Eu(e){return yu(e.root).map(e=>e.id).join(`,`)}function Du(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function Ou(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var ku=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function Au(e){let{taskId:t,tabId:n}=e.selection.get(),r=ku(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function ju(e,t){let{taskId:n,tabs:r}=Au(e),i=r[t];!n||!i||e.select(n,i.id)}function Mu(e){let{taskId:t,tabs:n,at:r}=Au(e),i=n[r];!t||!i||B.set((0,L.jsx)(Tr,{title:F(`menu.renameTab`),initial:_u(i),submitLabel:F(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var Nu=e=>!!e.selection.get().taskId,Pu=e=>ku(e).length>0,Fu=[{id:`help.open`,chords:[`f1`],prefix:!1,run:vc},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>va(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:Nu,run:e=>{let{taskId:t}=e.selection.get();t&&B.set((0,L.jsx)(X,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=Au(e);return!!t[n]&&!bu(t[n]?.split)},run:Mu},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:Pu,run:e=>ju(e,(Au(e).at+1)%ku(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:Pu,run:e=>ju(e,(Au(e).at-1+ku(e).length)%ku(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:Pu,run:(e,t=``)=>{let n=Sa().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&ju(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>Lu(e)}];ba(()=>Fu);function Iu(e){(0,h.useEffect)(()=>{let t=t=>{if(B.get()||Du(t.target))return;let n=V.get();if(n===`worktrees`)return;let r=Ta()??(Nu(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!Pu(e)&&!Ou(t.target)){t.preventDefault(),t.stopPropagation(),B.set((0,L.jsx)(X,{model:e,taskId:i}));return}let a=zs(t),o=Sa().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&Ca(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>wa(e,r)-wa(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 Lu(e){let t=e.tasks.get();if(!t)return;let n=Tc(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){H(F(`inbox.empty`));return}if(Sc(n.state)){Oc(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Dc(e,n))}async function Ru(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){H(F(`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){H(U(e),`error`)}}function zu(e){(0,h.useEffect)(()=>{let t=t=>{let n=fi.get().plugins;if(n.length===0||!Ti({dialog:B.get()!==null,page:V.get()})||Du(t.target))return;let r=wi(n,zs(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),Ru(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var Bu=`prefix.moreCommands`,Vu=/^ctrl\+[^+]+$/;function Hu(e){return Vu.test(e)?e.slice(5):null}function Uu(e){let t=Hs(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return di(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${di(e.prefixKey)} ${di(n)}`}return null}function Wu(e,t){let n=si.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>Hu(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?Hu(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:Bu}),n}var Gu=4e3,Ku=180,qu=Gu,Ju=g({guide:null,entries:[]}),Yu=1;function Xu(e,t){let n={id:Yu++,stroke:e,action:t,at:Date.now()};Ju.set({guide:null,entries:[...Ju.get().entries,n].slice(-3)})}var Zu=class extends Error{code;detail;constructor(e,t,n){super(t),this.code=e,this.detail=n}},Qu=[500,1e3,2e3,4e3,8e3,15e3],$u=4e3,ed=1e4,td=class{url;token;conn=g({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,$u),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof Zu&&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 Zu(`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=Qa(this.url,this.token?[`rove.v1`,`rove.bearer.${this.token}`]:[`rove.v1`]);this.ws=e,this.armDeadline(e,ed),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 Zu(`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=Qu[Math.min(n-1,Qu.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 Zu(i,a,r))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}};function nd(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}var rd=`modulepreload`,id=function(e){return`/`+e},ad={},od=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=id(t,n),t=s(t),t in ad)return;ad[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`:rd,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)})},sd=8,cd=32,ld=3e3,ud=100,dd=new WeakMap,fd=null;function pd(e){let t=dd.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},dd.set(e,t)),t}function md(){return fd||(fd=document.createElement(`div`),fd.style.display=`none`,document.body.append(fd)),fd}function hd(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=cd)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?hd(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function _d(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-sd)))gd(e,n,!0)}function vd(e,t,n,r){return pd(e).entries.get(Dl(t,n,r))?.slot.parkedAt!=null}async function yd(e,t){let n=pd(e.client),r=Dl(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,Sd(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:()=>bd(n,i)}}let a=document.createElement(`div`);a.className=zt,e.host.append(a),Z(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 od(async()=>{let{mountTerminal:e}=await import(`./term-mount-aQMkgSR7.js`);return{mountTerminal:e}},__vite__mapDeps([0,1])),d=u({...e,el:a,snapshot:l,onPainted:()=>Sd(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:()=>bd(n,f)}}function bd(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(),md().append(t.box),e.left=t,_d(e))}function Z(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>ud)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>xd(e,n),ld))}function xd(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&&md().append(t.box))}function Sd(e){for(let t of e.entries.values())xd(e,t)}async function Cd(e,t,n){return Ec(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function wd(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(H(F(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Zu?e.code:void 0;return H(t===`UNKNOWN_OP`?F(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?F(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function Td(e,t,n,r){let{client:i}=e,a=Dl(t,n),o=ja(a)!==void 0||vd(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 H(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function Ed(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||H(F(`inbox.gateKept`)),!0}catch(e){return H(e instanceof Error?e.message:String(e),`error`),!1}}var Dd=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),Od={id:`enter`,cap:`⏎`,bytes:()=>`\r`},kd=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},Dd(`up`,`↑`,`A`),Dd(`down`,`↓`,`B`),Dd(`left`,`←`,`D`),Dd(`right`,`→`,`C`),Od],Ad=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),jd=[Ad(1),Ad(2),Ad(3),Ad(4),Od];function Md(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 Nd=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,Pd=2e3;function Fd(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 Cd(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,Pd))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function Id(e){I();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=Fd(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?Ed(t,a.id,{text:e}):r?wd(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,L.jsxs)(`div`,{className:Nd,children:[a&&(0,L.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,L.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?F(`inbox.noOutput`):o.join(`
|
|
19
|
+
`);if(a===`scratch`){let e=await t.client.request(`task.openScratch`,O?{}:{engine:D});O?await Il(t,e.taskId,{kind:`shell`}):t.selectWhenListed(e.taskId)}else if(A){if(!r)throw Error(W(`terminal`,`tab.tabGone`));if(!l.trim())throw Error(F(`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=fl(e);if(!t)throw e;H(e instanceof Error?e.message:String(e),`error`),Ua(t);return}a.forkRefused&&H(F(`taskops.forkLeftBehind`,{reason:a.forkRefused}));let o=a.taskIds[0];a.groupId?Ua(a.groupId):o&&t.selectWhenListed(o)}else if(O)await Il(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:Ml(D),...r?{tabId:r}:{}});await t.refreshTabsNow(n),t.select(n,i.tabId)}else await Il(t,n,{kind:`engine`,engine:D,prompt:i,...e?{replaceTab:j()}:{}})});return(0,L.jsx)(Cr,{title:W(`terminal`,`tab.newChat.title`),wide:!0,children:(0,L.jsxs)(`form`,{className:qn,onKeyDown:e=>{if(e.key===`Tab`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(A||!e.shiftKey))e.preventDefault(),e.stopPropagation(),A?bl(e.currentTarget,Y,e.shiftKey?-1:1):ee(J[(J.indexOf(a)+1)%J.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(),ee(a,s===`fresh`?`continue`:`fresh`)):e.key===`Enter`&&A&&e.target.closest(`[data-field=attempts], [data-field=engine]`)&&(e.preventDefault(),e.currentTarget.requestSubmit())},onSubmit:e=>{e.preventDefault(),re()},onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),x(Array.from(e.dataTransfer.files))},children:[(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:W(`terminal`,`tab.newChat.engine`)}),(0,L.jsx)(Pl,{engines:i.engines,value:D,onChange:i.setEngine,withShell:w,panes:T?E:[]})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:W(`terminal`,`tab.newChat.destLabel`)}),(0,L.jsx)(Gc,{label:W(`terminal`,`tab.newChat.destLabel`),field:`destination`,value:a,onChange:e=>ee(e,s),choices:J.map(e=>({id:e,label:W(`terminal`,`tab.newChat.dest${e===`tab`?`Tab`:e===`fork`?`Fork`:`Scratch`}`)}))})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted`,children:[W(`terminal`,`tab.newChat.ctxLabel`),` `,(0,L.jsx)(`span`,{className:`keys-only`,children:`ctrl+f`})]}),(0,L.jsx)(Gc,{label:W(`terminal`,`tab.newChat.ctxLabel`),field:`context`,value:s,onChange:e=>ee(a,e===`continue`?`continue`:`fresh`),choices:[`fresh`,`continue`].map(e=>({id:e,label:W(`terminal`,`tab.newChat.ctx${e===`fresh`?`Fresh`:`Continue`}`)}))})]}),A&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:W(`quickTask`,`attemptsLabel`)}),(0,L.jsx)(Gc,{label:W(`quickTask`,`attemptsLabel`),field:`attempts`,value:d,onChange:f,choices:Rl.map(e=>({id:e,label:e}))})]}),(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:F(`taskops.forkBranch`)}),(0,L.jsx)(`input`,{className:ln,"data-field":`fork-base`,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})]})]}),!O&&!k&&a!==`scratch`&&(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:F(`newChat.prompt`)}),(0,L.jsx)(`textarea`,{className:`${ln} min-h-18 max-h-[50vh] leading-[1.45]`,"data-field":`message`,autoFocus:!0,rows:4,placeholder:F(`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,L.jsx)(Wc,{attachments:b,onRemove:S}),Kc()?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`pages.attachHintTouch`)}):(0,L.jsx)(`p`,{className:`keys-only mx-0 mt-2 mb-0 ${tn}`,children:W(`quickTask`,`legend`)}),_&&(0,L.jsx)(`p`,{className:`text-error`,children:_}),(0,L.jsx)(Or,{busy:g,submitLabel:F(`newChat.start`)})]})})}var zl=e=>e.split(`/`).filter(Boolean).pop()??e;function Bl(e,t,n=``){let r=zl(e),i=t.filter(t=>(t.repo!==e||t.host!==n)&&zl(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 Vl=e=>e.startsWith(`root:`)?null:e.split(`/`).slice(-2).join(`/`);function Hl(e,t){let n=zl(e.repo),r=t.filter(t=>t!==e&&zl(t.repo)===n);if(r.length===0)return n;let i=e.repoId,a=i?Vl(i):null;return i&&a?r.some(e=>e.repoId&&e.repoId!==i&&Vl(e.repoId)===a)?i:a:Bl(e.repo,[e,...r].map(e=>({repo:e.repo,host:``})))}var Ul=/\s+#\d+\/\d+$/,Wl=(e,t)=>(e.createdAt??``).localeCompare(t.createdAt??``)||e.id.localeCompare(t.id),Gl=e=>e.groupId&&e.kind!==`main`?`${e.machine?.id??``}\0${e.groupId}`:null;function Kl(e){let t=new Map;for(let n of e){let e=Gl(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(Wl);return t}function ql(e){return(e[0]?.label??``).replace(Ul,``)}function Jl(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 Yl=[`default`,`recent`,`attention`,`name`],Xl={folded:new Set,opened:new Set},Zl=e=>{let t=Date.parse(e??``);return Number.isFinite(t)?t:0},Ql=e=>Zl(e.updatedAt??e.createdAt),$l=e=>Zl(e.createdAt),eu=(e,t)=>$l(t)-$l(e)||t.id.localeCompare(e.id),tu=(e,t)=>Ql(t)-Ql(e)||t.id.localeCompare(e.id),nu=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),ru={default:null,recent:eu,attention:(e,t)=>e.rank-t.rank||tu(e,t),name:(e,t)=>nu.compare(e.label.trim(),t.label.trim())||e.id.localeCompare(t.id)},iu=`~scratch`,au=e=>e.kind===`dir`&&(e.scratch===!0||e.noProject===!0);function ou(e,t){return[...e].sort((e,t)=>(e.order??e.rank)-(t.order??t.rank)).sort(lu(ru[t]))}function su(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=au(e)?iu:e.repo,n=r.get(t);n?n.push(e):r.set(t,[e])}let i=ru[t],a=[...r].map(([e,t])=>{let n=t.sort(lu(i));if(e===`~scratch`&&t.every(au))return{repo:``,label:F(`rail.noProject`),tasks:n,key:iu,noProject:!0};let r=t.find(e=>e.repoId)?.repoId;return{repo:e,label:zl(e),tasks:n,...r?{repoId:r}:{}}});return[...a.filter(e=>e.noProject),...a.filter(e=>!e.noProject)]}var cu=e=>e.kind===`main`?0:e.pinned?1:2,lu=e=>(t,n)=>cu(t)-cu(n)||(e?e(t,n):0);function uu(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 du(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)||uu(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 fu(e,t,n=[]){for(let r of e.get(t)??[])n.push(r.id),fu(e,r.id,n);return n}function pu(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 mu(e,t=``,n=Xl,r=0,i=!0){let a=t.trim(),o=(...e)=>e.some(e=>e!==``&&Us(a,e)),{children:s,nested:c}=du(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,zl(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?fu(s,t.id):[],m=u!==void 0&&a===``&&pu(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?Kl(t):new Map,o=new Set;for(let i of t){let t=Gl(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:ql(s),tasks:s,depth:Math.min(l,3),...c.machine?{machine:c.machine.id}:{}});let u=Jl(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 hu=e=>Math.max(0,...e.tasks.map($l));function gu(e){let t=e.tasks.filter(e=>!e.routine),n=e.remote.filter(e=>!e.routine),r=[...su(t,e.sort).map(e=>({group:e})),...e.machines.flatMap(t=>su(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?iu:t??(e.machine===void 0?n:`${e.machine}\0${n}`),a=i.get(r);a?a.push(e):i.set(r,[e])}let a=ru[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(lu(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:Hl(e,s)])),l=s.map(e=>({...e,label:c.get(e)??e.label}));return e.sort===`recent`&&l.sort((e,t)=>hu(t)-hu(e)),e.sort===`name`&&l.sort((e,t)=>nu.compare(e.label,t.label)),l.sort((e,t)=>Number(t.noProject===!0)-Number(e.noProject===!0)),{rows:mu(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 _u(e){return e.title??e.engineName??(e.kind===`engine`?F(`tab.engine`):F(`tab.shell`))}function vu(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 bu(e){return!!e&&yu(e.root).length>1}function xu(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 Su(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 Cu(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 wu(e,t,n){return e.kind===`engine`&&yu(t.root).some(e=>e.id===n&&e.own)}function Tu(e){return e.alive!==!1||!!e.split&&!yu(e.split.root).some(e=>e.own)}function Eu(e){return yu(e.root).map(e=>e.id).join(`,`)}function Du(e){return!(e instanceof HTMLElement)||e.closest(`.xterm`)?!1:e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)}function Ou(e){return e instanceof HTMLElement&&!!e.closest(`.rail, button, a`)}var ku=e=>e.tabs.get()[e.selection.get().taskId??``]??[];function Au(e){let{taskId:t,tabId:n}=e.selection.get(),r=ku(e);return{taskId:t,tabs:r,at:r.findIndex(e=>e.id===n)}}function ju(e,t){let{taskId:n,tabs:r}=Au(e),i=r[t];!n||!i||e.select(n,i.id)}function Mu(e){let{taskId:t,tabs:n,at:r}=Au(e),i=n[r];!t||!i||B.set((0,L.jsx)(Tr,{title:F(`menu.renameTab`),initial:_u(i),submitLabel:F(`dialog.save`),onSubmit:async n=>{await e.renameTab(t,i.id,n)}}))}var Nu=e=>!!e.selection.get().taskId,Pu=e=>ku(e).length>0,Fu=[{id:`help.open`,chords:[`f1`],prefix:!1,run:vc},{id:`focus.next`,chords:[`f4`],prefix:!1,run:()=>va(1)},{id:`chat.tab.chooseEngine`,chords:[`ctrl+e`],prefix:!1,surface:`workspace`,live:Nu,run:e=>{let{taskId:t}=e.selection.get();t&&B.set((0,L.jsx)(X,{model:e,taskId:t}))}},{id:`chat.tab.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:e=>{let{tabs:t,at:n}=Au(e);return!!t[n]&&!bu(t[n]?.split)},run:Mu},{id:`chat.tab.cycle-next`,chords:[`ctrl+]`],prefix:!1,surface:`workspace`,live:Pu,run:e=>ju(e,(Au(e).at+1)%ku(e).length)},{id:`chat.tab.cycle-prev`,chords:[`ctrl+[`],prefix:!1,surface:`workspace`,live:Pu,run:e=>ju(e,(Au(e).at-1+ku(e).length)%ku(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:Pu,run:(e,t=``)=>{let n=Sa().find(e=>e.id===`chat.tab.goto`&&!e.prefix)?.chords.indexOf(t)??-1;n>=0&&ju(e,n)}},{id:`attention.next`,chords:[`f7`],prefix:!1,run:e=>Lu(e)}];ba(()=>Fu);function Iu(e){(0,h.useEffect)(()=>{let t=t=>{if(B.get()||Du(t.target))return;let n=V.get();if(n===`worktrees`)return;let r=Ta()??(Nu(e)?`workspace`:`sidebar`),{taskId:i}=e.selection.get();if(!n&&i&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&!t.altKey&&t.key===`Enter`&&!Pu(e)&&!Ou(t.target)){t.preventDefault(),t.stopPropagation(),B.set((0,L.jsx)(X,{model:e,taskId:i}));return}let a=zs(t),o=Sa().filter(t=>!t.prefix&&!t.native&&t.chords.some(e=>a.includes(e))&&Ca(t,r)&&!(n&&t.surface)&&t.live?.(e)!==!1).sort((e,t)=>wa(e,r)-wa(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 Lu(e){let t=e.tasks.get();if(!t)return;let n=Tc(t.attention,t.tasks.map(e=>e.id),e.selection.get());if(!n){H(F(`inbox.empty`));return}if(Sc(n.state)){Oc(e,n);return}n.taskId!==null&&(e.select(n.taskId,n.tabId),Dc(e,n))}async function Ru(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){H(F(`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){H(U(e),`error`)}}function zu(e){(0,h.useEffect)(()=>{let t=t=>{let n=fi.get().plugins;if(n.length===0||!Ti({dialog:B.get()!==null,page:V.get()})||Du(t.target))return;let r=wi(n,zs(t));r&&(t.preventDefault(),t.stopImmediatePropagation(),Ru(e,r))};return window.addEventListener(`keydown`,t,{capture:!0}),()=>window.removeEventListener(`keydown`,t,{capture:!0})},[e])}var Bu=`prefix.moreCommands`,Vu=/^ctrl\+[^+]+$/;function Hu(e){return Vu.test(e)?e.slice(5):null}function Uu(e){let t=Hs(e.bindingId);if(!t)return null;if(e.reachability.direct.has(e.bindingId)){let e=t.keys[0];if(e)return di(e)}if(e.prefixKey&&e.reachability.prefix.has(e.bindingId)){let n=t.prefixKeys?.[0];if(n)return`${di(e.prefixKey)} ${di(n)}`}return null}function Wu(e,t){let n=si.filter(t=>e.direct.has(t.id)).flatMap(e=>{let t=e.keys.flatMap(e=>Hu(e)??[]);return t.length>2?[{stroke:`${t[0]}-${t.at(-1)}`,action:e.id}]:t.map(t=>({stroke:t,action:e.id}))}),r=t?Hu(t):null;return r&&e.prefix.size>0&&n.push({stroke:r,action:Bu}),n}var Gu=4e3,Ku=180,qu=Gu,Ju=g({guide:null,entries:[]}),Yu=1;function Xu(e,t){let n={id:Yu++,stroke:e,action:t,at:Date.now()};Ju.set({guide:null,entries:[...Ju.get().entries,n].slice(-3)})}var Zu=class extends Error{code;detail;constructor(e,t,n){super(t),this.code=e,this.detail=n}},Qu=[500,1e3,2e3,4e3,8e3,15e3],$u=4e3,ed=1e4,td=class{url;token;conn=g({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,$u),this.request(`hello`).then(()=>this.clearDeadline(),e=>{e instanceof Zu&&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 Zu(`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=Qa(this.url,this.token?[`rove.v1`,`rove.bearer.${this.token}`]:[`rove.v1`]);this.ws=e,this.armDeadline(e,ed),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 Zu(`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=Qu[Math.min(n-1,Qu.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 Zu(i,a,r))}retryNow(){this.retryTimer!==null&&(window.clearTimeout(this.retryTimer),this.connect())}};function nd(){return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}var rd=`modulepreload`,id=function(e){return`/`+e},ad={},od=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=id(t,n),t=s(t),t in ad)return;ad[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`:rd,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)})},sd=8,cd=32,ld=3e3,ud=100,dd=new WeakMap,fd=null;function pd(e){let t=dd.get(e);return t||(t={entries:new Map,snapshots:new Map,left:null},dd.set(e,t)),t}function md(){return fd||(fd=document.createElement(`div`),fd.style.display=`none`,document.body.append(fd)),fd}function hd(e,t,n){e.snapshots.delete(t),e.snapshots.set(t,n);for(let t of e.snapshots.keys()){if(e.snapshots.size<=cd)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?hd(e,t.key,t.handle.snapshot()):e.snapshots.delete(t.key),t.handle.dispose(),t.box.remove()}function _d(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-sd)))gd(e,n,!0)}function vd(e,t,n,r){return pd(e).entries.get(Dl(t,n,r))?.slot.parkedAt!=null}async function yd(e,t){let n=pd(e.client),r=Dl(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,Sd(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:()=>bd(n,i)}}let a=document.createElement(`div`);a.className=zt,e.host.append(a),Z(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 od(async()=>{let{mountTerminal:e}=await import(`./term-mount-BhfGkya5.js`);return{mountTerminal:e}},__vite__mapDeps([0,1])),d=u({...e,el:a,snapshot:l,onPainted:()=>Sd(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:()=>bd(n,f)}}function bd(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(),md().append(t.box),e.left=t,_d(e))}function Z(e,t){let n=e.left;e.left=null,!(!n||n.slot.parkedAt===null||performance.now()-n.slot.parkedAt>ud)&&e.entries.get(n.key)===n&&(n.box.classList.add(`is-leaving`),t.append(n.box),n.leaving=window.setTimeout(()=>xd(e,n),ld))}function xd(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&&md().append(t.box))}function Sd(e){for(let t of e.entries.values())xd(e,t)}async function Cd(e,t,n){return Ec(await e.request(`output.read`,{taskId:t,tab:n,source:`terminal`,limit:12}))}async function wd(e,t,n,r){try{let i=await e.client.request(`tab.send`,{taskId:t,tabId:n,prompt:r});return i.delivered?!0:(H(F(`layout.composerNotSent`,{reason:i.reason??``}),`error`),!1)}catch(e){let t=e instanceof Zu?e.code:void 0;return H(t===`UNKNOWN_OP`?F(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?F(`layout.composerAtMenu`):e instanceof Error?e.message:String(e),`error`),!1}}async function Td(e,t,n,r){let{client:i}=e,a=Dl(t,n),o=ja(a)!==void 0||vd(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 H(e instanceof Error?e.message:String(e),`error`),!1}finally{o||await i.request(`term.detach`,{stream:a}).catch(()=>{})}}async function Ed(e,t,n){try{return(await e.client.request(`gate.answer`,{gateId:t,...n})).delivered||H(F(`inbox.gateKept`)),!0}catch(e){return H(e instanceof Error?e.message:String(e),`error`),!1}}var Dd=(e,t,n)=>({id:e,cap:t,bytes:e=>`\x1b${e?`O`:`[`}${n}`}),Od={id:`enter`,cap:`⏎`,bytes:()=>`\r`},kd=[{id:`esc`,cap:`esc`,bytes:()=>`\x1B`},{id:`tab`,cap:`tab`,bytes:()=>` `},{id:`backtab`,cap:`⇧tab`,bytes:()=>`\x1B[Z`},{id:`interrupt`,cap:`^C`,bytes:()=>``},Dd(`up`,`↑`,`A`),Dd(`down`,`↓`,`B`),Dd(`left`,`←`,`D`),Dd(`right`,`→`,`C`),Od],Ad=e=>({id:`option-${e}`,cap:String(e),bytes:()=>String(e)}),jd=[Ad(1),Ad(2),Ad(3),Ad(4),Od];function Md(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 Nd=`mx-2.5 mt-0.5 mb-1.5 flex min-w-0 flex-col gap-1.5 font-mono text-meta`,Pd=2e3;function Fd(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 Cd(e.client,t,n);r&&i(a)}catch{r&&i(e=>e??[])}r&&(a=window.setTimeout(o,Pd))};return o(),()=>{r=!1,window.clearTimeout(a)}},[e,t,n,a]),{lines:r,refresh:()=>o(e=>e+1)}}function Id(e){I();let{model:t,taskId:n,tabId:r,mode:i,gate:a}=e,{lines:o,refresh:s}=Fd(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?Ed(t,a.id,{text:e}):r?wd(t,n,r,e):Promise.resolve(!1))&&u(``)};return(0,L.jsxs)(`div`,{className:Nd,children:[a&&(0,L.jsx)(`p`,{className:`m-0 whitespace-pre-wrap wrap-anywhere text-ink`,children:a.question}),r&&(0,L.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?F(`inbox.noOutput`):o.join(`
|
|
20
20
|
`)}),i===`gate`&&a&&(0,L.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.options.map(e=>(0,L.jsxs)(R,{disabled:d,title:e.detail,onClick:()=>void p(()=>Ed(t,a.id,{option:e.key})),children:[`[ `,e.key===a.recommended?`★ `:``,e.label,` ]`]},e.key))}),i===`menu`&&r&&(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[jd.map(e=>(0,L.jsxs)(R,{disabled:d,onClick:()=>void p(()=>Td(t,n,r,e.bytes(!1))),children:[`[ `,e.cap,` ]`]},e.id)),(0,L.jsx)(R,{onClick:e.onOpenTab,children:F(`inbox.openTab`)})]}),(i===`reply`||i===`gate`)&&(0,L.jsxs)(`form`,{className:`flex min-w-0 items-center gap-2`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,L.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:F(`inbox.replyPlaceholder`),"aria-label":F(`inbox.replyPlaceholder`),autoComplete:`off`,enterKeyHint:`send`,onChange:e=>u(e.target.value)}),(0,L.jsx)(R,{type:`submit`,disabled:d||l.trim()===``,children:F(`inbox.send`)})]})]})}function Ld({text:e}){return(0,L.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,L.jsx)(`span`,{children:e},e))})}var Rd={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`},zd={accent:`text-accent`,muted:`text-subtle`,attention:`text-error`,warning:`text-warning`,success:`text-success`,info:`text-accent`,ink:`text-ink`},Bd=6;function Vd(e,t){return e?`${e.repo.split(`/`).filter(Boolean).pop()??e.repo} › ${e.label}`:t}function Hd({model:e}){I();let t=_(e.tasks),n=_(e.visits),r=_(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=wc(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:Vd(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,Bd).map(e=>({key:`r:${e.taskId}:${e.tabId}`,section:`recent`,taskId:e.taskId,tabId:e.tabId,identity:Vd(u.get(e.taskId),e.taskId),subtitle:d(e.taskId,e.tabId)||u.get(e.taskId)?.branch||``,at:e.at})),g=[...f,...m],v=g[Math.min(i,g.length-1)],y=t=>{if(t.attention&&Sc(t.attention.state))return Oc(e,t.attention);t.attention&&Dc(e,t.attention),t.taskId&&u.has(t.taskId)&&(e.select(t.taskId,t.tabId),Mn())},b=()=>void Promise.all(f.map(t=>t.attention&&Dc(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)y(v);else if(t.key===`d`&&v?.attention)Dc(e,v.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?bc(n.attention.state):null,i=n===v,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&&!Sc(l.state)&&(!l.gateId||!!f)&&(!!p||!!f),h=l?.state===`permission_needed`||!!p&&d?.tabStatus?.[p]?.kind===`needs-input`,_=f?`gate`:l?.state===`dead`?`readonly`:h?`menu`:`reply`,b=`${n.taskId}:${n.tabId}:${l?.gateId??``}`,x=m&&o===b;return(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`div`,{className:lr,children:[(0,L.jsxs)(`button`,{type:`button`,className:`${gr({selected:i,stack:!0})} ${ur}`,onMouseEnter:()=>a(g.indexOf(n)),onClick:()=>y(n),children:[(0,L.jsxs)(`span`,{className:sr,children:[(0,L.jsx)(`span`,{className:_r,children:n.identity}),r&&(0,L.jsxs)(`span`,{className:`flex-none font-mono text-meta font-normal normal-nums ${zd[r.tone]}`,children:[r.glyph,` `,F(r.stateKey)]}),(0,L.jsx)(`span`,{className:cr,children:xc(c-n.at)})]}),n.subtitle&&(0,L.jsx)(`span`,{className:`truncate font-mono text-meta font-normal normal-nums text-muted`,children:n.subtitle})]}),m?(0,L.jsx)(R,{className:dr,"aria-expanded":x,onClick:()=>{a(g.indexOf(n)),s(x?null:b)},children:F(x?`inbox.hide`:`inbox.reply`)}):(0,L.jsx)(`span`,{"aria-hidden":!0,className:dr})]}),x&&n.taskId&&(0,L.jsx)(Id,{model:e,taskId:n.taskId,tabId:p,mode:_,gate:f,onOpenTab:()=>y(n)})]},n.key)};return(0,L.jsx)(Cr,{title:F(`inbox.title`),wide:!0,children:(0,L.jsxs)(`div`,{className:qn,children:[(0,L.jsxs)(`div`,{className:ir,children:[(0,L.jsx)(`p`,{className:`${z} text-muted ${rr} touch:hidden!`,children:(0,L.jsx)(Ld,{text:F(`inbox.hints`)})}),f.length>0&&(0,L.jsx)(R,{className:`flex-none min-w-[calc(9ch+0.5rem)] whitespace-nowrap pr-2 text-right font-mono text-meta`,onClick:b,children:F(`inbox.ackAll`)})]}),(0,L.jsx)(`h2`,{className:`${z} text-muted ${ar}`,children:F(`inbox.attention`)}),f.length===0?(0,L.jsx)(`p`,{className:`mono text-muted`,children:F(`inbox.empty`)}):(0,L.jsx)(`ul`,{className:or,children:f.map(x)}),m.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted mt-1`,children:F(`inbox.recent`)}),(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:m.map(x)})]})]})})}var Ud=[`project`,`state`],Wd=`rove.railGroup`,Gd=g(Ud.find(e=>e===localStorage.getItem(Wd))??`project`);function Kd(e){Gd.set(e),localStorage.setItem(Wd,e)}var qd=`rove.activeSortMode`;function Jd(){let e=localStorage.getItem(qd);return Yl.find(t=>t===e)??`recent`}var Yd=g(Jd());function Xd(e){Yd.set(e),localStorage.setItem(qd,e)}function Zd(){Xd(Yl[(Yl.indexOf(Yd.get())+1)%Yl.length]??`default`)}var Qd=g(!1),$d=g(null);function ef(e){e&&(Yd.get()!=="default"||Gd.get()===`state`)&&(Xd(`default`),Kd(`project`),H(W(`tasks`,`sort.reorderSwitched`))),e||$d.set(null),Qd.set(e)}async function tf(e,t,n){let r=n<0?`up`:`down`;try{await e.client.request(`task.move`,{taskId:t.task.id,direction:r})}catch(e){H(W(`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){H(W(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)}}async function rf(e,t,n){if(n.pin!==void 0)try{await e.act(`task.pin`,{taskId:t,pinned:n.pin})}catch(e){H(W(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`);return}await nf(e,t,n.steps)}var af=`-my-0.75 -mr-0.5 ml-0 flex flex-none self-stretch`,of=`before:absolute before:top-0 before:left-1 before:content-[''] before:[border-left:var(--hairline)_solid_var(--line-active)]`,sf={blank:``,pipe:`${of} before:bottom-0`,tee:`${of} before:bottom-0`,elbow:`${of} before:right-0 before:bottom-1/2 before:rounded-bl-[6px] before:[border-bottom:var(--hairline)_solid_var(--line-active)]`},cf=e=>`relative w-3 ${sf[e]}`,lf=`-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`,uf=`inline-flex items-center gap-1`,df=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`:``}`,ff=`inline-flex flex-none items-center text-subtle`,pf=`group/rail rail @container row-1 flex min-h-0 flex-col focus:outline-none ${Je}`,mf=`flex min-w-0 items-center gap-2.5 overflow-hidden px-3.5 pt-3.5 pb-2.5 whitespace-nowrap`,hf=`flex gap-1 px-3.5 pb-2 text-meta`,gf=`min-w-0 flex-1 border-none bg-transparent p-0 text-ink [font:inherit] outline-none placeholder:text-subtle`,_f=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`:``}`,vf=`group-focus-within/rail:[box-shadow:inset_0_0_0_1px_var(--focus)]`,yf=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']`:``}`,bf=`touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-inset-y-3 touch:after:content-['']`,xf=`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 ${bf}`,Sf=e=>e?``:`opacity-0 group-hover/head:opacity-100 group-focus-visible/toggle:opacity-100 touch:opacity-100`,Cf=`-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 ${bf}`,wf=1e4;function Tf(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 Ef(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}${Tf(t,n).slice((t.hostLabel||t.alias).length)}`}function Df(e,t,n){if(e.kind!==`task`||e.machine===void 0)return null;let r=e.machine;return Ef(r,t.find(e=>e.alias===r),n,e.task.machine?.label)}function Of({label:e}){return(0,L.jsx)(`span`,{className:ff,title:e,role:`img`,"aria-label":e,children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`,children:(0,L.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 kf({host:e,onMachines:t}){return I(),(0,L.jsxs)(`div`,{className:$t,children:[(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`machine.filesElsewhere`,{host:e})}),(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`machine.filesHint`,{host:e})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(R,{hit:`tight`,onClick:t,children:F(`machines.open`)})})]})}function Af(e){let t=_(e.client.conn),n=_(e.remote),[r,i]=(0,h.useState)(()=>q(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=()=>El(e,`machines.list`).then(e=>n&&i(e.machines),()=>{});r();let a=kr(wf,r);return()=>{n=!1,a()}},[e.client,t.state,a]),r}var jf=`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`,Mf=`flex flex-1 flex-col items-center justify-center gap-1.5 text-center`,Nf=`relative mx-auto flex w-full max-w-[104ch] flex-col gap-2`,Pf=`flex flex-col gap-2 rounded-md border-hairline border-line bg-surface px-3 py-2.5 focus-within:border-line-active`,Ff=`flex flex-wrap items-center justify-end gap-1.5`,If=`max-h-[40vh] min-h-[4.5em] w-full bg-transparent text-ink [border:0] [outline:0]`,Lf=`flex flex-wrap items-center gap-1.5 px-1`,Rf=`flex-1`,zf=(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`}`,Bf=`size-3.25 flex-none fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:1.3]`,Vf=(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`}`,Hf=`disabled:cursor-default disabled:opacity-60`,Uf=e=>`${Vf(e)} min-w-[9ch] justify-center ${Hf}`,Wf=`touch-none select-none [-webkit-touch-callout:none]`,Gf=`group/chip relative inline-flex`,Kf=`flex min-h-0 flex-col gap-1 overflow-y-auto p-1.5 [outline:0]`,qf=`flex min-h-0 flex-col overflow-y-auto`,Jf=`sticky top-0 z-1 m-0 bg-surface px-1.5 pt-1.5 pb-0.5 text-left`,Yf=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`:``}`,Xf=`flex-[0_0_1.5ch] text-accent`,Zf=`ml-auto pl-3 inline-flex items-center gap-1`,Qf=`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,$f=`flex-none whitespace-nowrap`,ep=`flex flex-col gap-0.5 px-1.5 py-0.5`,tp=`min-w-[36ch]`,np=`flex items-center gap-1.5 p-1.5`;function rp(){return(0,L.jsx)(`svg`,{className:Bf,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.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 ip(){return(0,L.jsxs)(`svg`,{className:Bf,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`circle`,{cx:`4.5`,cy:`3.5`,r:`1.5`}),(0,L.jsx)(`circle`,{cx:`4.5`,cy:`12.5`,r:`1.5`}),(0,L.jsx)(`circle`,{cx:`11.5`,cy:`5`,r:`1.5`}),(0,L.jsx)(`path`,{d:`M4.5 5v6M11.5 6.5c0 3-7 2-7 4.5`})]})}function ap(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,L.jsxs)(`span`,{ref:i,className:Gf,onKeyDown:e=>{e.key!==`Escape`||!t||(e.preventDefault(),e.stopPropagation(),s())},children:[(0,L.jsx)(`button`,{ref:a,type:`button`,className:Vf(),"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,L.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 op(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,L.jsxs)(`div`,{className:Kf,children:[(0,L.jsx)(`input`,{className:ln,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,L.jsxs)(`div`,{className:qf,children:[r.length===0&&(0,L.jsx)(`p`,{className:`mx-2 my-1 text-muted`,children:e.empty}),r.map((t,r)=>(0,L.jsxs)(h.Fragment,{children:[e.moreLabel&&t===e.more?.[0]&&(0,L.jsx)(`p`,{className:`mx-2 mt-2 mb-0.5 text-muted`,children:e.moreLabel}),(0,L.jsxs)(`button`,{type:`button`,"aria-current":t.checked===!0,ref:r===i?a:void 0,tabIndex:-1,title:t.title,className:Yf({cursor:r===i}),onMouseMove:()=>n(r),onClick:n=>e.onPick(t.key,n.metaKey||n.ctrlKey),children:[(0,L.jsx)(`span`,{className:Xf,children:t.checked?`✓`:``}),(0,L.jsx)(`span`,{className:$f,children:t.text}),t.dim&&(0,L.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 sp(e){return(0,L.jsxs)(`button`,{type:`button`,role:e.multi?`menuitemcheckbox`:`menuitemradio`,"aria-checked":e.checked,tabIndex:-1,disabled:e.option.disabled,className:Yf({cursor:e.cursor,dim:e.option.dim}),onMouseMove:e.onHover,onClick:e.onPick,children:[(0,L.jsx)(`span`,{className:Xf,children:e.checked?`✓`:``}),(0,L.jsx)(`span`,{children:e.option.label}),!e.checked&&e.digit!==void 0&&!e.option.disabled&&(0,L.jsx)(`span`,{className:`ml-auto pl-3 text-muted`,children:e.digit})]})}function cp(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,L.jsxs)(`div`,{ref:r,role:`menu`,tabIndex:-1,className:Kf,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?hl(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,L.jsxs)(`button`,{type:`button`,className:`${Jf} ${z} text-muted`,tabIndex:-1,onClick:e.onBack,children:[`‹ `,e.heading]}):(0,L.jsx)(`p`,{className:`${Jf} ${z} text-muted`,children:e.heading}),e.options.map((r,i)=>(0,L.jsx)(sp,{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 lp(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,L.jsx)(cp,{heading:F(`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,L.jsxs)(`div`,{ref:o,role:`menu`,tabIndex:-1,className:Kf,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=hl(t.key,e.models.length),r=n===null?void 0:e.models[n];if(!r)return;t.preventDefault(),s(r.id)}}},children:[(0,L.jsx)(`p`,{className:`${Jf} ${z} text-muted`,children:F(`newSession.modelHeading`)}),e.models.map((t,n)=>(0,L.jsx)(sp,{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,L.jsxs)(`button`,{type:`button`,role:`menuitem`,tabIndex:-1,className:`${Yf({cursor:i===e.models.length})} mt-1 border-t-hairline border-t-line`,onMouseMove:()=>a(e.models.length),onClick:()=>n(`effort`),children:[(0,L.jsx)(`span`,{className:`flex-[0_0_1.5ch] text-accent`}),(0,L.jsx)(`span`,{children:F(`newSession.effort`)}),(0,L.jsxs)(`span`,{className:`${Zf} text-muted`,children:[c,(0,L.jsx)(oo,{right:!0})]})]})]})}function up(e){return(0,L.jsxs)(`div`,{className:`${Kf} ${tp}`,children:[(0,L.jsx)(`p`,{className:`${Jf} ${z} text-muted`,children:F(`newSession.branches`)}),(0,L.jsxs)(`label`,{className:ep,children:[(0,L.jsx)(`span`,{className:`text-muted`,children:F(`newSession.branchName`)}),(0,L.jsx)(`input`,{className:ln,autoFocus:!0,spellCheck:!1,placeholder:F(`newSession.branchNamePlaceholder`),value:e.branch,onChange:t=>e.onBranch(t.target.value)})]}),e.repos.map(t=>(0,L.jsxs)(`label`,{className:ep,children:[(0,L.jsxs)(`span`,{children:[t.name,t.primary&&(0,L.jsxs)(`span`,{className:`text-muted`,children:[` `,F(`newSession.primary`)]})]}),(0,L.jsx)(`select`,{className:ln,"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,L.jsx)(`option`,{value:e,children:e},e))})]},t.path))]})}function dp(e){return e.id.startsWith(`root:`)?e.primary??e.checkouts[0]??e.id:e.id}function fp(e,t){if(!e)return null;let n=t.find(t=>t.id===e||t.checkouts.includes(e));return n?{ref:dp(n),clone:!1}:e.startsWith(`/`)?{ref:e,clone:!1}:null}function pp(e,t,n){let r=t.toLowerCase();return n?e.some(e=>e.toLowerCase()===`github.com/${r}`):e.some(e=>Zc(e).base.toLowerCase()===(r.split(`/`)[1]??``))}function mp(e){let t=e.begin?``:Xc(e.prompt);return{repo:e.pick.ref,machine:e.machine,...e.pick.clone?{clone:!0}:{},...e.baseRef?{baseBranch:e.baseRef}:{},...e.begin&&e.prompt?{prompt:e.prompt}:{},...t?{title:t}:{},...e.engine?{engine:e.engine}:{}}}var hp={offline:`newSession.remoteOffline`,outdated:`newSession.remoteOutdated`},gp=(e,t)=>El(e,`machines.repos`,{machine:t});function _p(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?n.split(`
|
|
22
22
|
`):[])gp(e,t).catch(()=>{})},[e,n])}function vp(e,t){I();let[n,r]=(0,h.useState)(null);if((0,h.useEffect)(()=>{if(!t)return;let n=!1;return gp(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=q(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:F(`newSession.remoteFailed`,{machine:t,message:i?.failed??``})};let s=o.reason?hp[o.reason]:void 0,c=o.reason?s?F(s,{machine:t}):F(`newSession.remoteFailed`,{machine:t,message:o.message??o.reason}):``;return{repos:o.repos,loaded:!0,problem:c}}function yp(e,t){return t.problem?t.problem:t.loaded?F(`newSession.remoteNone`,{machine:e}):F(`newSession.remoteLoading`,{machine:e})}function bp(){return(0,L.jsxs)(`svg`,{className:Bf,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,L.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`8`,rx:`1`}),(0,L.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function xp(e){let t=(I()===`zh`?qr:Kr).machine,n=e.machines.find(t=>t.alias===e.value),r=e.value?n?.hostLabel||e.value:F(`newSession.thisMachine`);return(0,L.jsx)(ap,{field:`machine`,title:F(`newSession.machine`),label:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(bp,{}),r]}),children:n=>(0,L.jsx)(cp,{heading:F(`newSession.machine`),options:[{id:``,label:F(`newSession.thisMachine`)},...e.machines.map(e=>({id:e.alias,label:Tf(e,t),disabled:e.state!==`online`}))],value:e.value,digits:!0,onPick:t=>{e.onPick(t),n()}})})}function Sp(e){let[t,n]=(0,h.useState)(``),r=t.trim();return(0,L.jsx)(ap,{field:`branch`,title:F(`newSession.branch`),label:e.value||F(`newSession.branch`),children:i=>(0,L.jsx)(op,{placeholder:F(`newSession.branchTypeRef`),empty:``,rows:[{key:``,text:F(`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 Cp(e,t){return(await e.client.request(`task.spawn`,mp(t))).taskIds[0]}function wp(e){return e instanceof Zu&&e.code===`CLONE_FAILED`?W(`newTask`,`error.cloneFailed`,{error:e.message}):e instanceof Error?e.message:String(e)}function Tp(e){let[t,n]=(0,h.useState)(``);if(e.ungrouped)return null;if(e.remote)return e.remotePick&&(0,L.jsx)(Sp,{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=Qc(s?.branches??[],t).map(e=>({key:e,text:e,checked:e===(i[o]||s?.current)})),u=r.map(t=>({path:t,name:Zc(t).base,primary:t===o,branches:e.probes[t]?.branches??[],current:e.probes[t]?.current??``,base:i[t]??``}));return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`${Vf(!a)} ${Hf}`,"aria-pressed":!a,disabled:r.length>1||e.plain,title:e.plain?F(`newSession.worktreeNoGit`):r.length>1?F(`newSession.worktreeMulti`):F(a?`newSession.worktreeOff`:`newSession.worktreeOn`),onClick:e.onToggleWorktree,children:[(0,L.jsx)(ip,{}),F(`newSession.worktree`)]}),r.length>1?(0,L.jsx)(ap,{field:`branch`,title:F(`newSession.branches`),label:F(`newSession.branches`),children:()=>(0,L.jsx)(up,{repos:u,branch:e.branchName,onBranch:e.onBranchName,onBase:e.onBase})}):!a&&s?.ok&&c&&(0,L.jsx)(ap,{field:`branch`,title:F(`newSession.branch`),label:c,children:r=>(0,L.jsx)(op,{placeholder:F(`newSession.branchSearch`),empty:F(`newSession.branchEmpty`),rows:l,query:t,onQuery:n,onPick:t=>{e.onBase(o,t),n(``),r()}})})]})}var Ep=`rove.web.newSession.prompt`,Dp=`rove.web.newSession.attachments`,Op=sessionStorage.getItem(Ep)??``;function kp(){return Op}function Ap(e){Op=e;try{sessionStorage.setItem(Ep,e)}catch{}}function jp(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=ul(a,t);r(n),n[0]&&n[0]!==e.engine&&e.setEngine(n[0])}}}function Mp(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,L.jsx)(ap,{field:`engine`,title:F(`newSession.engine`),label:dl(i)||F(`newSession.engine`),children:i=>(0,L.jsx)(cp,{heading:F(`newSession.engine`),options:r.map(e=>({id:e.id,label:e.name,dim:e.ready===!1})),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,L.jsx)(R,{className:`mx-2 mt-1 mb-0.5 self-start font-mono`,"data-field":`compare-engines`,hit:`tight`,onClick:()=>t.setComparing(!t.comparing),children:F(t.comparing?`compare.oneEngine`:`compare.severalEngines`)}):null})})}function Np(e){return(0,L.jsx)(ap,{field:`model`,title:F(`newSession.model`),label:ll(e.models,e.model,e.effort,F(`newSession.modelDefault`)),children:t=>(0,L.jsx)(lp,{...e,close:t})})}var Pp=6e4,Fp=/^(?:(today|tomorrow|今天|明天)\s*)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/i,Ip=/^\+\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?$/i;function Lp(e,t){let n=e.trim(),r=Ip.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*Pp):null}let i=Fp.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 Rp(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}`}async function zp(e,t,n,r){await e.request(`task.scheduleStart`,{taskId:t,at:n.toISOString(),prompt:r})}function Bp(e){let[t,n]=(0,h.useState)(``),r=()=>{let n=Lp(t,new Date);if(!n)return e.onInvalid(F(`newSession.laterBad`));e.onSchedule(n)};return(0,L.jsxs)(`div`,{className:np,children:[(0,L.jsx)(`input`,{className:`${ln} min-w-0 flex-1`,value:t,placeholder:F(`newSession.laterPlaceholder`),"aria-label":F(`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,L.jsx)(R,{variant:`filled`,disabled:!t.trim(),onClick:r,children:F(`newSession.laterConfirm`)})]})}function Vp(e){let[t,n]=(0,h.useState)(`root`);return(0,L.jsx)(ap,{field:`more`,title:F(`newSession.more`),label:(0,L.jsx)(`span`,{"aria-hidden":`true`,children:`⋯`}),onClose:()=>n(`root`),children:r=>t===`later`?(0,L.jsxs)(`div`,{className:Kf,children:[(0,L.jsxs)(`button`,{type:`button`,className:`${Jf} ${z} text-muted`,onClick:()=>n(`root`),children:[`‹ `,F(`newSession.later`)]}),(0,L.jsx)(Bp,{onBack:()=>n(`root`),onInvalid:e.onInvalid,onSchedule:t=>{r(),e.onLater?.(t)}})]}):(0,L.jsxs)(`div`,{role:`menu`,className:Kf,children:[e.onLater&&(0,L.jsx)(Hp,{label:F(`newSession.later`),sub:!0,disabled:e.busy,onClick:()=>n(`later`)}),e.onCreateOnly&&(0,L.jsx)(Hp,{label:F(`newSession.createOnly`),disabled:e.busy,onClick:(e=>()=>{r(),e()})(e.onCreateOnly)})]})})}function Hp(e){return(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`${Yf({cursor:!1})} [&:hover:not(:disabled)]:bg-hover`,disabled:e.disabled,onClick:e.onClick,children:[(0,L.jsx)(`span`,{className:Qf,children:e.label}),(e.dim!==void 0||e.sub)&&(0,L.jsxs)(`span`,{className:`${Zf} text-muted`,children:[e.dim,e.sub&&(0,L.jsx)(oo,{right:!0})]})]})}var Up=128,Wp=80,Gp=3,Kp=2,qp=Up/2,Jp=Wp/2,Yp=25,Xp=(1-1.2/Yp)**2,Zp=1e3/30,Qp=7,$p=0,em=1,tm=2,nm=3,rm=4,im=[``,`--color-subtle`,`--color-muted`,`--color-ink`,`--color-accent`],am=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5],om=Array.from({length:64},(e,t)=>{let n=t%8,r=t>>3;return(4*(am[(r&3)*4+(n&3)]??0)+([0,2,3,1][(r>>2)*2+(n>>2)]??0)+.5)/64}),sm=(e,t)=>om[(t&7)*8+(e&7)]??1,cm=[{radius:1.55,lift:.3,roll:-.42,speed:.9,phase:.4,ink:rm},{radius:1.95,lift:.22,roll:.3,speed:-.55,phase:2.6,ink:nm},{radius:2.4,lift:.36,roll:-.12,speed:.38,phase:4.4,ink:nm}],lm=1.9,um=[[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 dm(e,t){e.fill($p);let n=(t,n,r)=>{t>=0&&t<Up&&n>=0&&n<Wp&&(e[n*Up+t]=r)};for(let[e,r,i]of um)Math.sin(t*.8+i)>-.5&&n(e,r,em);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<Wp;e++)for(let t=0;t<Up;t++){let s=(t+.5-qp)/Yp,u=(e+.5-Jp)/Yp,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)>sm(t,e)?n(t,e,h>.4?nm:tm):p>Xp&&n(t,e,em)}for(let e of cm){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(qp+s*Yp),Math.floor(Jp+c*Yp),l]},o=Math.round(Math.PI*e.radius*Yp);for(let e=0;e<o;e++){let t=a(e/o*Math.PI*2);t&&!t[2]&&n(t[0],t[1],em)}let s=e.phase+t*e.speed,c=.5/(e.radius*Yp),l=-Math.sign(e.speed)*c;for(let e=lm/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,$p)}for(let t=lm/c;t>0;t--){let r=a(s+t*l),i=1-t*c/lm;r&&i>sm(r[0],r[1])&&n(r[0],r[1],i>.6?e.ink:tm)}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 fm(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=em;e<=rm;e++){n.fillStyle=a.getPropertyValue(im[e]??``)||a.color;for(let r=0;r<t.length;r++)t[r]===e&&n.fillRect(r%Up*Gp,Math.floor(r/Up)*Gp,Kp,Kp)}}function pm(){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){dm(n,Qp),fm(t,n);return}let r=0,i=0,a=e=>{r=requestAnimationFrame(a),!(e-i<Zp)&&(i=e,dm(n,e/1e3),fm(t,n))};return r=requestAnimationFrame(a),()=>cancelAnimationFrame(r)},[]),(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`mb-3 max-w-full`,children:(0,L.jsx)(`canvas`,{ref:e,width:384,height:240,"data-plate":`rove`,className:`h-auto w-96 max-w-full text-muted`})})}var mm=`clone:`;function hm(e){let{model:t,saved:n,picked:r,primary:i,home:a,query:o,remote:s}=e,[c,l]=(0,h.useState)(()=>q(t,`github.repos`)??null);(0,h.useEffect)(()=>{let e=!1;return El(t,`github.repos`).then(t=>!e&&l(t)).catch(()=>!e&&l({repos:[],reason:`failed`})),()=>{e=!0}},[t]);let u=o.trim(),d=Qc(n,o),f=F(`newSession.noFolder`),p=e.ungrouped&&(!u||f.toLowerCase().includes(u.toLowerCase()))?[{key:iu,text:f,checked:e.ungrouped.on}]:[],m=d.map(e=>{let{base:t,dir:n}=Zc(e);return{key:e,text:t,dim:e===i&&r.length>1?`${F(`newSession.primary`)}, ${n}`:n,checked:r.includes(e)}}),g=il(u),_=g&&(g.includes(`:`)||d.length===0)?g:null,v=!_&&$c(u)&&!n.includes(u)&&(!s||u.startsWith(`/`))?tl(el(u,a)):``,y=_?{key:mm+_,text:s?F(`newSession.cloneRowOn`,{source:_,machine:s.name}):F(`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=>!pp(n,e.nameWithOwner,s!==void 0)).map(e=>({key:mm+e.nameWithOwner,text:e.nameWithOwner,dim:e.description,title:e.description}));return(0,L.jsx)(op,{placeholder:F(s?`newSession.repoSearchRemote`:`newSession.repoSearch`),empty:s?.empty??F(`newSession.repoEmpty`),rows:s?.blocked?[]:[...p,...m],query:o,onQuery:e.onQuery,extra:s?.blocked?null:y,more:s?.blocked?[]:x,moreLabel:F(`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 gm(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 _m(e,t){return e?[e,...(t.extras??[]).map(e=>e.repo)]:[]}function vm(e,t){return e?{...t.baseBranch?{[e]:t.baseBranch}:{},...Object.fromEntries((t.extras??[]).flatMap(e=>e.baseRef?[[e.repo,e.baseRef]]:[]))}:{}}function ym(e,t){return e.retryOf&&e.engine&&e.engine===t?e.retryOf.id:void 0}async function bm(e,t){try{let{task:n}=await e.client.request(`task.get`,{taskId:t.id});if(!n.prompt)return void H(F(`menu.retryNoPrompt`),`error`);Tn(gm(t,{...n,prompt:n.prompt}))}catch(e){H(U(e),`error`)}}function xm(e,t){let n=async n=>{await e.act(`task.archive`,{taskId:t.id,archived:!0,...n?{force:n}:{}}),H(W(`tasks`,`archive.done`,{title:t.label}))};B.set((0,L.jsx)(Er,{title:F(`newSession.retryArchiveTitle`,{title:t.label}),body:F(`newSession.retryArchiveBody`),confirmLabel:W(`tasks`,`menu.archive`),onConfirm:()=>n(!1),escalate:{when:e=>e instanceof Zu&&e.code===`TASK_BUSY`,label:W(`tasks`,`archive.busyConfirm`),title:W(`tasks`,`archive.busyTitle`),body:()=>W(`tasks`,`archive.busyBody`,{title:t.label}),run:()=>n(!0)}}))}var Sm=g([]),Cm=()=>_(Sm);async function wm(e){Sm.set((await e.request(`snippets.get`)).snippets)}async function Tm(e,t){Sm.set((await e.request(`snippets.save`,{name:t.name,text:t.text})).snippets)}async function Em(e,t){Sm.set((await e.request(`snippets.remove`,{name:t})).snippets)}var Dm=/^[A-Za-z0-9][\w-]{0,31}$/;function Om(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 km(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 Am(e,t,n){return{text:e.slice(0,t.start)+n.text+e.slice(t.end),caret:t.start+n.text.length}}var jm=e=>e.split(`
|
|
@@ -35,7 +35,7 @@ This worktree is at the PR's head ({head}, going into {base}). Read the change a
|
|
|
35
35
|
`).trim(),r=n.timestamp??``;e&&(!t||r>t.at)&&(t={at:r,text:e})}let n=(e.terminal?.tail??[]).map(e=>e.trimEnd()).filter(e=>e.trim()!==``),r=t?.text??n.slice(-6).join(`
|
|
36
36
|
`);return r?r.length>US?`${r.slice(0,US).trimEnd()}…`:r:null}function GS(e){let t=e.files.filter(e=>e.scope===`working`),n=t.length>0?`working`:`branch`,r=n===`working`?t:e.files.filter(e=>e.scope===`branch`);return{scope:n,files:r,added:r.reduce((e,t)=>e+(t.added??0),0),deleted:r.reduce((e,t)=>e+(t.deleted??0),0)}}async function KS(e,t,n){let r=new Set(e.tasks.get()?.tasks.map(e=>e.id)),i=0;try{for(let a of t.filter(e=>r.has(e)))await e.act(`task.archive`,{taskId:a,archived:!0,...n?{force:!0}:{}}),i++}catch(e){if(i>0&&H(F(`compare.archived`,{count:i})),e instanceof Zu&&e.code===`TASK_BUSY`)throw e;H(F(`compare.archiveFailed`,{error:U(e)}),`error`);return}H(F(`compare.archived`,{count:i}))}async function qS(e,t,n){try{for(let r of n)r.id!==t.id&&r.kept&&await e.act(`task.keep`,{taskId:r.id,kept:!1});await e.act(`task.keep`,{taskId:t.id,kept:!0})}catch(e){H(F(`compare.keepFailed`,{error:U(e)}),`error`);return}H(F(`compare.keptToast`,{title:t.label}));let r=n.filter(e=>e.id!==t.id).map(e=>e.id);r.length!==0&&B.set((0,L.jsx)(Er,{title:F(`compare.archiveTitle`),body:F(`compare.archiveBody`,{count:r.length}),confirmLabel:F(`compare.archiveConfirm`),onConfirm:()=>KS(e,r,!1),escalate:{when:e=>e instanceof Zu&&e.code===`TASK_BUSY`,label:F(`compare.archiveBusyConfirm`),title:F(`compare.archiveBusyTitle`),body:()=>F(`compare.archiveBusyBody`),run:()=>KS(e,r,!0)}}))}async function JS(e,t){try{await e.act(`task.keep`,{taskId:t.id,kept:!1}),H(F(`compare.unkeptToast`,{title:t.label}))}catch(e){H(F(`compare.keepFailed`,{error:U(e)}),`error`)}}var YS={title:`ROUTINES`,holdingDaemon:`keeping the daemon awake`,notHolding:`none active`,needAttention:`{count} of {total} need you ·`,paused:`paused`,newTitle:`New routine`,composerLegend:`enter create · tab fields · ←→ ↑↓ edit the focused field · esc cancel`,fieldName:`NAME`,fieldRepo:`REPO`,fieldTarget:`DELIVER TO`,fieldTargetTab:`EXISTING ENGINE TAB`,targetFresh:`New task on each run`,targetStanding:`Routine-owned standing task`,targetExisting:`Existing conversation: {task} / {tab}. Never creates or revives a session.`,fieldPrompt:`PROMPT`,fieldSchedule:`SCHEDULE (FIVE-FIELD CRON)`,namePlaceholder:`weekday dependency audit`,promptPlaceholder:`Audit dependencies and summarize risky changes.`,noProject:`Ungrouped`,cronInvalid:`not a five-field cron`,cronField:{minute:`min`,hour:`hour`,dayOfMonth:`day`,month:`month`,dayOfWeek:`weekday`},schedule:{everyDay:`every day {at}`,weekdays:`weekdays {at}`,weekends:`weekends {at}`,onWeekday:`{weekday} {at}`,everyMinute:`every minute`,everyMinutes:`every {n}m`,everyHours:`every {n}h`,hourlyAt:`hourly at :{minute}`,atClock:`at {time}`,dow:{MON:`Mondays`,TUE:`Tuesdays`,WED:`Wednesdays`,THU:`Thursdays`,FRI:`Fridays`,SAT:`Saturdays`,SUN:`Sundays`}},when:{inMinutes:`in {n}m`,inHours:`in {n}h`,inDays:`in {n}d`,minutesAgo:`{n}m ago`,hoursAgo:`{n}h ago`,now:`now`,justNow:`just now`,dateTime:`{date}, {time}`},runStatus:{dispatched:`dispatched`,revived:`revived`,skipped_cancelled:`cancelled before delivery`,skipped_precheck:`skipped (precheck)`,skipped_blocked:`skipped (task can't use it)`,skipped_missed:`skipped (missed)`,skipped_unavailable:`skipped (unavailable)`,dispatch_failed:`dispatch failed`,ran:`ran`,script_failed:`script failed`},cronNever:`valid, but never fires`,missing:{target:`Choose an existing task.`,targetTab:`Enter an existing tab id, e.g. tab-2.`,name:`Give it a name.`,repo:`Pick a project.`,prompt:`Say what it should do.`,schedule:`That schedule will not run.`},empty:`No routines scheduled.`,loadFailed:`Could not read the routines: {message}`,emptyHint:`Press n to create one.`,precheck:`precheck: {command}`,lastFailed:`last failed {when}: {reason}`,recentRuns:`RECENT RUNS`,precheckDetail:`WHY IT SKIPPED — precheck {exit} in {duration}ms`,precheckExited:`exited {code}`,precheckTimedOut:`timed out`,precheckStdout:`stdout`,precheckStderr:`stderr`,precheckNoOutput:`(no output)`,noRuns:`Not run yet.`,responses:`RESPONSES`,noResponses:"No run has reported back yet. Agents answer with `routine-respond`.",responseAwaiting:`awaiting response`,responseMissing:`no response`,noSelection:`A routine runs its prompt in a project on a schedule.`,running:`Running {name}…`,ranWith:`{name}: {status}`,latestRunNoTask:`The latest run created no task.`,runNow:`[ run now ]`,deleteTitle:`Delete routine?`,deleteBody:`{name} and its run history will be removed. Tasks it already created are untouched.`,deleteButton:`Delete`,createFailed:`Couldn't create the routine: {error}`,deleteFailed:`Couldn't delete "{name}": {error}`,enableFailed:`"{name}" stays paused: {error}`,disableFailed:`"{name}" stays enabled: {error}`,runFailed:`Couldn't run "{name}" now — schedule unchanged: {error}`},XS={title:`例行任务`,holdingDaemon:`正在保持守护进程常驻`,notHolding:`无启用项`,needAttention:`{total} 个中有 {count} 个需要处理 ·`,paused:`已暂停`,newTitle:`新建例行任务`,composerLegend:`enter 创建 · tab 切字段 · ←→ ↑↓ 编辑当前字段 · esc 取消`,fieldName:`名称`,fieldTarget:`投递目标`,fieldTargetTab:`既有引擎标签页`,targetFresh:`每次新建任务`,targetStanding:`例行任务自有的常驻任务`,targetExisting:`既有会话:{task} / {tab}。不会创建或重启会话。`,fieldRepo:`仓库`,fieldPrompt:`提示词`,fieldSchedule:`调度(五段 cron)`,namePlaceholder:`工作日依赖审计`,promptPlaceholder:`审计依赖并总结有风险的变更。`,noProject:`未分组`,cronInvalid:`不是合法的五段 cron`,cronField:{minute:`分`,hour:`时`,dayOfMonth:`日`,month:`月`,dayOfWeek:`星期`},schedule:{everyDay:`每天{at}`,weekdays:`工作日{at}`,weekends:`周末{at}`,onWeekday:`{weekday}{at}`,everyMinute:`每分钟`,everyMinutes:`每 {n} 分钟`,everyHours:`每 {n} 小时`,hourlyAt:`每小时的 :{minute}`,atClock:`{time}`,dow:{MON:`每周一`,TUE:`每周二`,WED:`每周三`,THU:`每周四`,FRI:`每周五`,SAT:`每周六`,SUN:`每周日`}},when:{inMinutes:`{n} 分钟后`,inHours:`{n} 小时后`,inDays:`{n} 天后`,minutesAgo:`{n} 分钟前`,hoursAgo:`{n} 小时前`,now:`即将`,justNow:`刚刚`,dateTime:`{date} {time}`},runStatus:{dispatched:`已派发`,revived:`已重启会话`,skipped_cancelled:`交付前已取消`,skipped_precheck:`已跳过(预检)`,skipped_blocked:`已跳过(任务暂不能接收)`,skipped_missed:`已跳过(错过时间)`,skipped_unavailable:`已跳过(不可用)`,dispatch_failed:`派发失败`,ran:`已运行`,script_failed:`脚本失败`},cronNever:`语法合法,但永远不会触发`,missing:{target:`请选择既有任务。`,targetTab:`请输入既有标签页 ID,例如 tab-2。`,name:`起个名字。`,repo:`选一个项目。`,prompt:`说明它要做什么。`,schedule:`这个调度不会触发。`},empty:`还没有例行任务。`,loadFailed:`读不到例行任务:{message}`,emptyHint:`按 n 新建一条。`,precheck:`预检:{command}`,lastFailed:`上次失败({when}):{reason}`,recentRuns:`最近执行`,precheckDetail:`为什么跳过 —— 预检{exit},耗时 {duration}ms`,precheckExited:`退出码 {code}`,precheckTimedOut:`超时`,precheckStdout:`标准输出`,precheckStderr:`标准错误`,precheckNoOutput:`(无输出)`,noRuns:`尚未执行。`,responses:`回报`,noResponses:"还没有执行回报。agent 用 `routine-respond` 回报。",responseAwaiting:`等待回报`,responseMissing:`未回报`,noSelection:`例行任务会按调度在某个项目里跑它的提示词。`,running:`正在运行 {name}…`,ranWith:`{name}:{status}`,latestRunNoTask:`最近一次执行没有创建任务。`,runNow:`[ 立即运行 ]`,deleteTitle:`删除这条例行任务?`,deleteBody:`将删除 {name} 及其执行记录。它已经创建的任务不受影响。`,deleteButton:`删除`,createFailed:`创建例行任务失败:{error}`,deleteFailed:`删除“{name}”失败:{error}`,enableFailed:`“{name}”仍处于暂停状态:{error}`,disableFailed:`“{name}”仍处于启用状态:{error}`,runFailed:`无法立即运行“{name}”——排程未受影响:{error}`},ZS={title:`Kanban`,hint:`tab project · ←↓↑→ card · enter detail · n new · d delete · r refresh · esc close`,loading:`Loading issues…`,noRepos:"No projects yet — add one with `rove add <path>`, or file a story with `rove api issue-create`.",empty:"No issues — agents file them via `rove api issue-create`.",readFailed:"Couldn't read this project's stories: {error}. Run `rove doctor`, then reopen Kanban.",readFailedToast:`Couldn't read stories for {repo}: {error}`,columnEmpty:`No cards`,column:{backlog:`Backlog`,inProgress:`In progress`,parked:`Parked`,done:`Done`},more:`+{count} more`,attention:`{count} need you`,turnComplete:`turn done`,menu:{setStatus:`status → {status}`},detail:{status:{open:`open`,doing:`doing`,hold:`hold`,done:`done`},statusLabel:`STATUS`,created:`created {date}`,linked:`linked to a session`,titleLabel:`TITLE`,description:`DESCRIPTION`,noDescription:`No description.`,attachHint:`paste a path / ctrl+v screenshot → inserts an image placeholder`,engine:`ENGINE`,workspace:`WORKSPACE`,placement:{worktree:`New worktree task — its own workspace`,projectWorktree:`New worktree — as a chattab in the project workspace`,project:`Project checkout — a new chattab, no worktree`},jumpLabel:`AFTER START`,jump:{stay:`Stay on the board`,follow:`Jump to the session`},startLegend:`enter/ctrl+enter start · tab fields · ←→ status/engine · ↑↓ workspace · esc save & close`,sessionLabel:`SESSION`,openAction:`Open the linked session ↵`,unlinkAction:`Unlink`,openLegend:`enter open the focused action · tab fields · ←→ status · unlink returns the card to Backlog · esc save & close`,eventsLabel:`EVENTS`,eventsLoading:`Loading events…`,eventsNone:`No engine events recorded yet.`,doneNote:`Done stories have nothing left to start — set the status back to reopen one · esc save & close`,startedBackground:`Started in background: {title}`,newStory:`NEW STORY`,createLegend:`ctrl+s save · enter/ctrl+enter save & start · tab fields · esc cancel`},confirmDelete:{title:`Delete story #{id}?`,body:`“{title}” will be removed from the tracker. A linked task, branch, or worktree is left untouched.`},deleteFailed:`Couldn't delete story #{id}: {error}`,createFailed:`Couldn't create the story: {error}`,updateFailed:`Couldn't save story #{id}: {error}`,statusFailed:`Story #{id} stays in its old column: {error}`,linkFailed:`Story #{id} isn't linked to its task: {error}`,unlinkFailed:`Story #{id} is still linked: {error}`},QS={title:`看板`,hint:`tab 切项目 · ←↓↑→ 选卡片 · enter 详情 · n 新建 · d 删除 · r 刷新 · esc 关闭`,loading:`正在加载 issues…`,noRepos:"还没有项目——用 `rove add <路径>` 添加一个,或用 `rove api issue-create` 创建一个 story。",empty:"暂无 issue——agent 可通过 `rove api issue-create` 创建。",readFailed:"读取该项目的 story 失败:{error}。请运行 `rove doctor`,再重新打开看板。",readFailedToast:`读取 {repo} 的 story 失败:{error}`,columnEmpty:`暂无卡片`,column:{backlog:`待办`,inProgress:`进行中`,parked:`搁置`,done:`已完成`},more:`还有 {count} 条`,attention:`{count} 张等你处理`,turnComplete:`回合完成`,menu:{setStatus:`状态 → {status}`},detail:{status:{open:`待办`,doing:`进行中`,hold:`搁置`,done:`已完成`},statusLabel:`状态`,created:`创建于 {date}`,linked:`已关联会话`,titleLabel:`标题`,description:`描述`,noDescription:`暂无描述。`,attachHint:`粘贴路径 / ctrl+v 贴截图 → 插入图片占位行`,engine:`引擎`,workspace:`工作区`,placement:{worktree:`新建 worktree 任务——独立工作区`,projectWorktree:`新建 worktree——作为项目工作区里的 chattab`,project:`项目主目录——新开 chattab,不建 worktree`},jumpLabel:`启动后`,jump:{stay:`留在看板`,follow:`跳转到会话`},startLegend:`enter/ctrl+enter 启动 · tab 切字段 · ←→ 状态/引擎 · ↑↓ 工作区 · esc 保存关闭`,sessionLabel:`会话`,openAction:`打开关联会话 ↵`,unlinkAction:`解除关联`,openLegend:`enter 执行选中操作 · tab 切字段 · ←→ 状态 · 解除关联把卡片退回 Backlog · esc 保存关闭`,eventsLabel:`事件`,eventsLoading:`正在加载事件…`,eventsNone:`暂无引擎事件记录。`,doneNote:`已完成的 story 无需启动——改回状态即可重新打开 · esc 保存关闭`,startedBackground:`已在后台启动:{title}`,newStory:`新建 STORY`,createLegend:`ctrl+s 仅保存 · enter/ctrl+enter 保存并启动 · tab 切字段 · esc 取消`},confirmDelete:{title:`删除 story #{id}?`,body:`「{title}」将从 tracker 中移除。已关联的任务、分支、worktree 不受影响。`},deleteFailed:`删除 story #{id} 失败:{error}`,createFailed:`创建 story 失败:{error}`,updateFailed:`保存 story #{id} 失败:{error}`,statusFailed:`Story #{id} 仍留在原来的列:{error}`,linkFailed:`Story #{id} 未能关联到它的任务:{error}`,unlinkFailed:`Story #{id} 仍处于关联状态:{error}`},$S={title:`ISSUES`,noRepo:`no project`,empty:`No open issues.`,assignedFilter:`assigned to me`,starting:`Starting work on #{number}…`,startedNoEngine:`Created {title}, but its engine did not start.`,linkedChip:`→ {title}`,openingLinked:`Opening {title}…`,startFailed:`Couldn't start work on #{number}: {error}`,errorHint:{noRemote:"Add a GitHub remote (`git remote add origin <url>`) and try again, or press q / esc to close.",ghMissing:"Install the `gh` CLI and authenticate, or press q / esc to close.",auth:"Run `gh auth login`, or press q / esc to close.",fallback:`{message} · press q / esc to close`}},eC={title:`议题`,noRepo:`无项目`,empty:`没有开放的议题。`,assignedFilter:`分配给我的`,starting:`正在开始处理 #{number}…`,startedNoEngine:`已创建 {title},但引擎没有启动。`,linkedChip:`→ {title}`,openingLinked:`正在打开 {title}…`,startFailed:`开始处理 #{number} 失败:{error}`,errorHint:{noRemote:"添加 GitHub remote(`git remote add origin <url>`)后重试,或按 q / esc 关闭。",ghMissing:"安装 `gh` CLI 并登录,或按 q / esc 关闭。",auth:"执行 `gh auth login`,或按 q / esc 关闭。",fallback:`{message} · 按 q / esc 关闭`}};function tC(){let e=I()===`zh`;return{kanban:e?QS:ZS,auto:e?XS:YS,items:e?eC:$S,nav:(e?qr:Kr).nav,group:(e?qr:Kr).group,common:e?jr:Ar}}function $(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function nC(){let{auto:e}=tC();return(t,n)=>{let r=e;for(let e of t.replace(/^automations\./,``).split(`.`))r=r&&typeof r==`object`?Reflect.get(r,e):void 0;return typeof r==`string`?n?$(r,n):r:t}}function rC(e){return e instanceof Error?e.message:String(e)}function iC(e){return e.replace(/^\/private\//,`/`).replace(/\/+$/,``)}function aC(e,t){let n=e.split(`/`).filter(Boolean),r=n[n.length-1]??e;return t.some(t=>t!==e&&t.split(`/`).filter(Boolean).pop()===r)&&n.length>1?`${n[n.length-2]}/${r}`:r}function oC(...e){let t=new Set,n=[];for(let r of e.flat()){if(!r||r.startsWith(`ssh://`))continue;let e=iC(r);t.has(e)||(t.add(e),n.push(r))}return n}function sC(e){return oC((_(e.tasks)?.tasks??[]).filter(e=>!au(e)).map(e=>e.repo))}function cC(e){let t=_(e.tasks),{taskId:n}=_(e.selection);return t?.tasks.find(e=>e.id===n)?.repo}function lC(e){let[t,n]=(0,h.useState)(0);return(0,h.useEffect)(()=>kr(e,()=>n(e=>e+1)),[e]),[t,(0,h.useCallback)(()=>n(e=>e+1),[])]}function uC(e){return e instanceof HTMLElement?e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName):!1}function dC(e){let t=(0,h.useRef)(e);t.current=e,(0,h.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||B.get()||mn.get())return;let n=e.target instanceof HTMLElement?e.target:null;uC(n)||n?.closest(`.rail, .side-panel, .xterm`)||e.metaKey||e.altKey||e.ctrlKey&&e.key.toLowerCase()===`c`&&window.getSelection()?.toString()||t.current(e)&&(e.preventDefault(),e.stopPropagation())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function fC(){let e=(0,h.useRef)(null);return(0,h.useEffect)(()=>e.current?.focus(),[]),e}var pC={working:`info`,waiting:`warning`,error:`attention`,done:`success`,idle:`muted`},mC={prOpen:``,prMerged:``,prClosed:``};function hC(e){let t=gC(e);return{look:t,tone:pC[t]}}function gC(e){switch(e?.kind){case`busy`:case`running`:return`working`;case`needs-input`:return`waiting`;case`attention`:return e.reason===`rate_limited`?`waiting`:`error`;case`unseen`:return`done`;default:return`idle`}}function _C(e){return e.rowStatus?.kind===`needs-input`||e.rowStatus?.kind===`attention`}var vC={busy:0,attention:1,"needs-input":2,running:3,unseen:4,idle:5};function yC(e){let t;for(let{rowStatus:n}of e)n&&(!t||vC[n.kind]<vC[t.kind]||n.kind===t.kind&&n.since>t.since)&&(t=n);return t}function bC(e,t,n){if(!e)return null;if(e.lifecycle===`merged`)return{glyph:mC.prMerged,tone:n?`text-muted`:`text-merged`,state:`merged`};if(e.lifecycle===`closed`)return{glyph:mC.prClosed,tone:`text-muted`,state:`closed`};if(e.lifecycle!==`open`&&e.lifecycle!==`ready_to_merge`&&e.lifecycle!==`unknown`)return null;let r=t===`conflict`?`conflict`:t===`failing`?`failing`:t===`passing`?`passing`:e.checkState===`pending`?`pending`:void 0,i=n?`text-muted`:r===`conflict`?`text-warning`:r===`failing`?`text-error`:r===`passing`?`text-success`:`text-muted`;return{glyph:mC.prOpen,tone:i,state:`open`,...r?{checks:r}:{}}}function xC(e){return bC(e.pr,e.prChip,e.prChipStale===!0)}function SC(e){return bC(e,(e.mergeable??``).toUpperCase()===`CONFLICTING`?`conflict`:e.checkState===`failing`?`failing`:e.checkState===`passing`?`passing`:null,!1)}function CC(e){let t=e=>e.state===`open`?e.checks===`conflict`||e.checks===`failing`?0:1:e.state===`merged`?2:3;return[...e].sort((e,n)=>t(e)-t(n))[0]}function wC({tone:e,children:t}){return(0,L.jsx)(`span`,{className:Re(`flex-none font-mono text-meta`,e&&Rd[e]),children:t})}var TC=`mt-3 grid grid-cols-[repeat(auto-fit,minmax(min(100%,17rem),1fr))] items-start gap-x-5 gap-y-6`,EC=e=>e?`flex min-w-0 flex-col gap-2 pt-2 [border-top:var(--hairline)_solid_var(--accent)]`:`flex min-w-0 flex-col gap-2 pt-2 [border-top:var(--hairline)_solid_var(--line)]`,DC=`flex min-w-0 items-center gap-2`,OC=`min-w-0 truncate font-bold`,kC=`truncate font-mono text-meta text-muted`,AC=`m-0 line-clamp-6 whitespace-pre-wrap wrap-anywhere`,jC=`flex min-w-0 flex-col`,MC=`flex min-w-0 items-baseline gap-2 py-px font-mono text-meta`,NC=`flex flex-wrap gap-x-3.5 gap-y-1 font-mono text-meta`,PC=`flex min-w-0 flex-wrap items-center gap-x-3.5 gap-y-0.5 px-2.5 py-1 font-mono text-meta`,FC=1.2,IC=.3,LC=20,RC=.35,zC=.25,BC=.12,VC=2,HC=1,UC={error:{dots:[0,4,8,2,6],bright:1},done:{dots:[3,7,5,2],bright:1},idle:{dots:[1,2,5,8,7,6,3,0],bright:.6}},WC=Array.from({length:9},(e,t)=>Math.hypot(t%3-1,Math.floor(t/3)-1));function GC(e){return RC+.65*(.5+.5*Math.cos(2*Math.PI*e/FC))}function KC(e,t,n,r=1){switch(e){case`working`:{let e=t*80/1e3/r;return WC.map(t=>GC(e-t*IC))}case`waiting`:{let e=[0,1,4,5].includes(Math.floor(t/r)%LC);return Array(9).fill(e?zC:1)}default:{let t=UC[e],r=Array(9).fill(BC);return t?.dots.forEach((e,i)=>{let a=Math.min(Math.max(n-i*HC,0),VC)/VC;r[e]=t.bright*a+BC*(1-a)}),r}}}function qC(e,t){let n=UC[e];return!n||t<(n.dots.length-1)*HC+VC}var JC=3,YC=new Set,XC;function ZC(e,t){let n=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=1/0,i=e.held+t-e.step,a=qC(e.look,n?r:i);return KC(e.look,t,n?r:i,n?JC:1).forEach((t,n)=>{let r=e.el.children[n].style;r.opacity=t.toFixed(3)}),a}function QC(){let e=Math.floor(performance.now()/80);for(let t of YC)ZC(t,e)||YC.delete(t);$C()}function $C(){XC=YC.size?window.setTimeout(QC,80-performance.now()%80+2):void 0}function ew(e,t,n){let r=Math.floor(performance.now()/80),i=n>0?Math.max(Date.now()-n,0):1/0,a={el:e,look:t,step:r,held:Math.floor(i/80)};return ZC(a,r)&&(YC.add(a),XC===void 0&&$C()),()=>{YC.delete(a)}}function tw({status:e}){let{look:t,tone:n}=hC(e);return(0,L.jsx)(rw,{look:t,tone:n,since:e?.since??0},t)}var nw=e=>e===`muted`?`text-muted`:e===`ink`?`text-ink`:Rd[e];function rw({look:e,tone:t,since:n}){let r=(0,h.useRef)(null),[i]=(0,h.useState)(n);return(0,h.useLayoutEffect)(()=>{let t=r.current;return t?ew(t,e,i):void 0},[e,i]),(0,L.jsx)(`span`,{ref:r,className:`inline-grid flex-none grid-cols-[repeat(3,3px)] auto-rows-[3px] gap-px self-center ${nw(t)}`,"aria-hidden":`true`,children:Array.from({length:9},(e,t)=>(0,L.jsx)(`i`,{className:`rounded-full bg-current opacity-12`},t))})}var iw=6;function aw(e,t){let[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(()=>q(e,`diff.files`,{taskId:t.id})??null),o=`${t.rowStatus?.kind??``}:${t.rowStatus?.since??0}`,s=JSON.stringify(t.changes??null);return(0,h.useEffect)(()=>{let n=!0;return El(e,`output.read`,{taskId:t.id,limit:8}).then(e=>n&&r(WS(e)),()=>n&&r(null)),()=>{n=!1}},[e,t.id,o]),(0,h.useEffect)(()=>{let n=!0;return El(e,`diff.files`,{taskId:t.id}).then(e=>n&&a(e),()=>{}),()=>{n=!1}},[e,t.id,s,o]),{reply:n,changes:i?GS(i):null}}function ow({changes:e,onOpen:t}){if(!e)return(0,L.jsx)(`p`,{className:en,children:`…`});if(e.files.length===0)return(0,L.jsx)(`p`,{className:`m-0 font-mono text-meta text-subtle`,children:F(`compare.noChanges`)});let n=e.files.length-iw;return(0,L.jsxs)(`div`,{className:jC,children:[(0,L.jsxs)(`p`,{className:`m-0 flex gap-2 font-mono text-meta text-muted`,children:[(0,L.jsx)(`span`,{children:F(`compare.files`,{count:e.files.length})}),e.added>0&&(0,L.jsxs)(wC,{tone:`added`,children:[`+`,e.added]}),e.deleted>0&&(0,L.jsxs)(wC,{tone:`removed`,children:[`−`,e.deleted]})]}),e.files.slice(0,iw).map(n=>(0,L.jsxs)(R,{variant:`row`,className:`${MC} text-left [&:hover]:underline`,title:n.path,onClick:()=>t(n.path,e.scope),children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.path}),n.added?(0,L.jsxs)(wC,{tone:`added`,children:[`+`,n.added]}):null,n.deleted?(0,L.jsxs)(wC,{tone:`removed`,children:[`−`,n.deleted]}):null]},n.path)),n>0&&(0,L.jsx)(`span`,{className:`font-mono text-meta text-subtle`,children:F(`compare.more`,{count:n})})]})}function sw({model:e,row:t,round:n}){let{reply:r,changes:i}=aw(e,t),{look:a}=hC(t.rowStatus),o=t.kept===!0,s=(n,r)=>{e.select(t.id),ks({taskId:t.id,path:n,scope:r})};return(0,L.jsxs)(`section`,{className:EC(o),"data-attempt":t.id,children:[(0,L.jsxs)(`div`,{className:DC,children:[(0,L.jsx)(tw,{status:t.rowStatus}),(0,L.jsx)(`span`,{className:OC,children:t.engine?.name??t.label}),(0,L.jsx)(`span`,{className:`flex-none text-meta text-muted`,children:F(`compare.status.${a}`)}),o&&(0,L.jsx)(`span`,{className:`ml-auto flex-none font-mono text-meta text-accent`,children:F(`compare.kept`)})]}),(0,L.jsx)(`span`,{className:kC,title:t.branch,children:t.branch}),r?(0,L.jsx)(`p`,{className:AC,children:r}):(0,L.jsx)(`p`,{className:`m-0 text-muted`,children:F(`compare.noReply`)}),(0,L.jsx)(ow,{changes:i,onOpen:s}),(0,L.jsxs)(`div`,{className:NC,children:[(0,L.jsx)(R,{hit:`tight`,onClick:()=>e.select(t.id),children:F(`compare.terminal`)}),(0,L.jsx)(R,{hit:`tight`,onClick:()=>s(`.`,i?.scope??`working`),children:F(`compare.diff`)}),o?(0,L.jsx)(R,{hit:`tight`,onClick:()=>void JS(e,t),children:F(`compare.unkeep`)}):(0,L.jsx)(R,{hit:`tight`,onClick:()=>void qS(e,t,n),children:F(`compare.keep`)})]})]})}function cw({model:e}){I();let t=_(vn),n=_(e.tasks),r=fC(),i=t&&n?HS(n.tasks,t):[];return(0,L.jsxs)(`div`,{className:Kv,tabIndex:0,ref:r,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),V.set(null))},children:[(0,L.jsx)(`h1`,{className:qv,children:F(`compare.title`)}),i.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`compare.empty`)}):(0,L.jsx)(`div`,{className:TC,children:i.map(t=>(0,L.jsx)(sw,{model:e,row:t,round:i},t.id))})]})}function lw(e){let t=Math.floor(e/6e4),n=Math.floor(t/60);return{minutes:t,hours:n,days:Math.floor(n/24)}}function uw(e,t=Date.now()){let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<60)return`${r}s`;let{minutes:i,hours:a,days:o}=lw(n);return i<60?`${i}m`:a<24?`${a}h`:`${o}d`}var dw=[{id:`issues`,label:`reviewQueue.sourceIssues`},{id:`reviews`,label:`reviewQueue.sourceReviews`}];function fw(){I();let e=_(yg);return(0,L.jsx)(`span`,{className:`flex items-baseline gap-3 font-mono text-meta`,children:dw.map(t=>t.id===e?(0,L.jsx)(`span`,{className:`text-ink`,children:F(t.label)},t.id):(0,L.jsx)(R,{onClick:()=>yg.set(t.id),children:F(t.label)},t.id))})}var pw={passing:`reviewQueue.checksPassing`,failing:`reviewQueue.checksFailing`,pending:`reviewQueue.checksPending`},mw={missing:`reviewQueue.gh.missing`,unauthenticated:`reviewQueue.gh.unauthenticated`,failed:`reviewQueue.gh.failed`};function hw(e){let{pr:t}=e,n=Date.parse(t.createdAt),r=[t.isDraft?F(`reviewQueue.draft`):``,t.fork?F(`reviewQueue.fork`):``,t.checks?F(pw[t.checks]):``];return(0,L.jsxs)(`div`,{"data-row":e.index,className:$v(e.at),onClick:e.onPick,children:[(0,L.jsxs)(`div`,{className:ey,children:[(0,L.jsxs)(`span`,{className:`mono ${ty}`,children:[t.nameWithOwner.split(`/`)[1],`#`,t.number]}),(0,L.jsx)(`span`,{className:ry,children:t.title}),(0,L.jsx)(R,{disabled:e.busy,onClick:e.onReview,children:F(`reviewQueue.start`)})]}),(0,L.jsxs)(`div`,{className:ny,children:[(0,L.jsx)(`span`,{className:ry,children:[t.author,...r].filter(Boolean).join(`, `)}),(0,L.jsxs)(`span`,{className:`mono`,children:[`+`,t.additions,` −`,t.deletions]}),(0,L.jsx)(`span`,{className:`mono`,children:Number.isFinite(n)?uw(n,e.now):``})]})]})}function gw({model:e}){I();let t=e.client,[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(null),[o,s]=(0,h.useState)(0),[c,l]=(0,h.useState)(null),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(0),m=(0,h.useRef)(!1),g=fC(),_=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0,n=m.current;return m.current=!1,a(null),t.request(`review.queue`,n?{refresh:!0}:{}).then(t=>e&&r(t)).catch(t=>{e&&(a(rC(t)),r({prs:[],other:0}))}),()=>{e=!1}},[t,f]);let v=n?.prs??[],y=Math.min(o,Math.max(0,v.length-1));(0,h.useEffect)(()=>{_.current?.querySelector(`[data-row="${y}"]`)?.scrollIntoView({block:`nearest`})},[y]);let b=async e=>{if(c===null){l(e.number),d(F(`reviewQueue.preparing`,{number:e.number}));try{let{ref:n}=await t.request(`review.prepare`,{repo:e.repo,number:e.number});Tn(bg(e,n,F(`reviewQueue.prompt`,{number:e.number,repo:e.nameWithOwner,title:e.title,url:e.url,head:e.headRef,base:e.baseRef})))}catch(t){H(F(`reviewQueue.failed`,{number:e.number,error:rC(t)}),`error`)}finally{l(null),d(null)}}};dC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return s(Math.min(v.length-1,y+1)),!0;case`k`:case`ArrowUp`:return s(Math.max(0,y-1)),!0;case`r`:return m.current=!0,p(e=>e+1),!0;case`Enter`:{let e=v[y];return e&&b(e),!0}default:return!1}});let x=Date.now();return(0,L.jsxs)(`div`,{className:Kv,tabIndex:0,ref:g,children:[(0,L.jsxs)(`div`,{className:Jv,children:[(0,L.jsx)(`h1`,{className:qv,children:F(`reviewQueue.title`)}),(0,L.jsx)(fw,{})]}),i?(0,L.jsx)(`p`,{className:`text-error`,children:i}):n===null?(0,L.jsx)(`p`,{className:`text-muted`,children:`…`}):n.reason?(0,L.jsx)(`p`,{className:`text-muted`,children:F(mw[n.reason])}):v.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`reviewQueue.empty`)}):(0,L.jsx)(`div`,{className:Qv,ref:_,children:v.map((e,t)=>(0,L.jsx)(hw,{pr:e,index:t,at:t===y,now:x,busy:c!==null,onPick:()=>s(t),onReview:()=>void b(e)},`${e.nameWithOwner}#${e.number}`))}),n&&n.other>0&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:F(`reviewQueue.other`,{count:n.other})}),u&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:u})]})}var _w=30;function vw(){let{items:e}=tC();return t=>{let n=t.indexOf(`: `);switch(n>=0?t.slice(0,n):`failed`){case`no-remote`:return e.errorHint.noRemote;case`gh-missing`:return e.errorHint.ghMissing;case`auth`:return e.errorHint.auth;default:return $(e.errorHint.fallback,{message:t})}}}function yw({model:e}){let{items:t,common:n}=tC(),r=vw(),i=e.client,a=_(e.tasks),o=sC(e),s=cC(e),[c,l]=(0,h.useState)(()=>{let e=s?o.findIndex(e=>iC(e)===iC(s)):-1;return Math.max(0,e)}),u=o[c],d=(e,t)=>({repo:e,limit:_w,...t?{assignee:`@me`}:{}}),f=e=>Object.fromEntries(e.links.map(e=>[e.number,e.taskId])),[p,m]=(0,h.useState)(()=>u?q(i,`workitem.list`,d(u,!1))?.items??null:null),[g,v]=(0,h.useState)(()=>{let e=u?q(i,`workitem.links`,{repo:u}):void 0;return e?f(e):{}}),[y,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(!1),[C,w]=(0,h.useState)(0),[T,E]=(0,h.useState)(0),[D,O]=(0,h.useState)(!1),[k,A]=(0,h.useState)(null),ee=fC(),j=(0,h.useRef)(!1);(0,h.useEffect)(()=>{let e=!0;if(!u){m([]);return}b(null);let t=j.current;j.current=!1;let n=d(u,x),r=q(i,`workitem.list`,n);return r&&m(r.items),i.request(`workitem.list`,{...n,...t?{refresh:!0}:{}}).then(t=>e&&m(Tl(i,`workitem.list`,n,t).items)).catch(t=>{e&&(b(rC(t)),m([]))}),El(i,`workitem.links`,{repo:u}).then(t=>e&&v(f(t))).catch(()=>e&&v({})),()=>{e=!1}},[i,u,x,C,a?.tasks.length]);let te=p??[],ne=Math.min(T,Math.max(0,te.length-1));(0,h.useEffect)(()=>A(null),[u,x]);let re=(0,h.useRef)(null);(0,h.useEffect)(()=>{re.current?.querySelector(`[data-row="${ne}"]`)?.scrollIntoView({block:`nearest`})},[ne]);let M=e=>a?.tasks.find(t=>t.id===e)?.label??e,N=t=>{V.set(null),e.select(t)},ie=async()=>{let e=te[ne];if(!e||!u||D)return;let n=g[e.number];if(n){A($(t.openingLinked,{title:M(n)})),N(n);return}O(!0),A($(t.starting,{number:e.number}));try{let n=await i.request(`workitem.start`,{repo:u,number:e.number});n.started?N(n.taskId):A($(t.startedNoEngine,{title:n.title}))}catch(n){H($(t.startFailed,{number:e.number,error:rC(n)}),`error`)}finally{O(!1)}};dC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return E(Math.min(te.length-1,ne+1)),!0;case`k`:case`ArrowUp`:return E(Math.max(0,ne-1)),!0;case`Tab`:return l(t=>o.length?(t+(e.shiftKey?o.length-1:1))%o.length:0),!0;case`a`:return S(e=>!e),!0;case`r`:return j.current=!0,w(e=>e+1),!0;case`Enter`:return ie(),!0;default:return!1}});let ae=Date.now();return(0,L.jsxs)(`div`,{className:Kv,tabIndex:0,ref:ee,children:[(0,L.jsxs)(`div`,{className:Jv,children:[(0,L.jsx)(`h1`,{className:qv,children:t.title}),(0,L.jsx)(fw,{}),(0,L.jsxs)(`span`,{className:`mono touch:empty:hidden! text-muted ${Yv(!0)}`,children:[u?aC(u,o):t.noRepo,x?` ${t.assignedFilter}`:``]})]}),y?(0,L.jsxs)(`div`,{className:Qv,children:[(0,L.jsx)(`p`,{className:`text-error`,children:y}),(0,L.jsx)(`p`,{className:`text-muted`,children:r(y)})]}):p===null?(0,L.jsx)(`p`,{className:`text-muted`,children:n.loading}):te.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.empty}):(0,L.jsx)(`div`,{className:Qv,ref:re,children:te.map((e,n)=>{let r=g[e.number],i=Date.parse(e.updatedAt);return(0,L.jsxs)(`div`,{"data-row":n,className:$v(n===ne),onClick:()=>n===ne?void ie():E(n),children:[(0,L.jsxs)(`div`,{className:ey,children:[(0,L.jsxs)(`span`,{className:`mono ${ty}`,children:[`#`,e.number]}),(0,L.jsx)(`span`,{children:e.title})]}),(0,L.jsxs)(`div`,{className:ny,children:[(0,L.jsx)(`span`,{className:ry,children:[e.author,...e.labels.slice(0,2)].filter(Boolean).join(`, `)}),r&&(0,L.jsx)(`span`,{children:$(t.linkedChip,{title:M(r)})}),(0,L.jsx)(`span`,{className:`mono`,children:Number.isFinite(i)?uw(i,ae):``})]})]},e.number)})}),k&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:k})]})}function bw({model:e}){return _(yg)===`reviews`?(0,L.jsx)(gw,{model:e}):(0,L.jsx)(yw,{model:e})}var xw={backlog:`active`,in_progress:`active`,in_review:`parked`,error:`parked`,done:`terminal`,canceled:`terminal`,open:`active`,doing:`active`,hold:`parked`};function Sw(e){return xw[e]??`parked`}var Cw=[`backlog`,`in_progress`,`parked`,`done`];function ww(e,t,n){let r=e.find(e=>e.issues.length>0)?.issues[0]?.id??null;if(t==null)return r;let i=-1,a=-1;for(let[n,r]of e.entries()){let e=r.issues.findIndex(e=>e.id===t);if(e!==-1){i=n,a=e;break}}if(i===-1)return r;if(n===`up`||n===`down`){let r=e[i]?.issues??[],o=n===`up`?a-1:a+1;return r[Math.max(0,Math.min(o,r.length-1))]?.id??t}let o=n===`left`?-1:1;for(let n=i+o;n>=0&&n<e.length;n+=o){let r=e[n]?.issues??[];if(r.length!==0)return r[Math.min(a,r.length-1)]?.id??t}return t}function Tw(e,t){let n=Sw(e.status);return n===`terminal`?`done`:n===`parked`?`parked`:e.taskId!==void 0&&e.taskId!==``&&(t?.(e.taskId)??!0)||e.status===`doing`?`in_progress`:`backlog`}function Ew(e,t){let n=0;return{columns:e.map(e=>{if(e.key!==`in_progress`)return e;let r=[],i=[];for(let n of e.issues)n.taskId!==void 0&&n.taskId!==``&&t(n.taskId)?r.push(n):i.push(n);return n=r.length,r.length===0?e:{...e,issues:[...r,...i]}}),attentionCount:n}}function Dw(e,t){return e.created===t.created?t.id-e.id:e.created<t.created?1:-1}function Ow(e,t){let n={backlog:[],in_progress:[],parked:[],done:[]};for(let r of e)n[Tw(r,t)].push(r);return Cw.map(e=>{let t=e===`done`||e===`parked`,r=n[e].sort(Dw);return!t||r.length<=20?{key:e,issues:r,hiddenCount:0}:{key:e,issues:r.slice(0,20),hiddenCount:r.length-20}})}var kw=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`application/pdf`],Aw=5242880;function jw(e,t){return/\.pdf$/i.test(e)?`pdf[${t}]`:`images[${t}]`}function Mw(e){let t=-1;for(let n of e.matchAll(/^(?:images|pdf)\[(\d+)\]:/gm)){let e=Number.parseInt(n[1],10);e>t&&(t=e)}return t+1}function Nw(e,t){let n=e.replace(/\s+$/,``),r=Mw(e);for(let e of t){let t=`${jw(e,r)}: ${e}`;n=n.length>0?`${n}\n${t}`:t,r+=1}return n}function Pw(e){return Array.from(e??[]).filter(e=>kw.includes(e.type))}function Fw(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 Iw(e,t){let n=Fw(new Uint8Array(await t.arrayBuffer()));return(await e.request(`attachment.put`,{mime:t.type,data:n})).path}var Lw=[`worktree`,`projectWorktree`,`project`];async function Rw(e,t){let n=t.placement===`project`?`project`:`worktree`,{title:r,prompt:i}=await e.request(`issue.prompt`,{repo:t.repo,id:t.issue.id,where:n}),a=[];if(t.placement!==`project`){let{taskId:n}=await e.request(`task.create`,{repo:t.repo,engine:t.engine,title:r,prompt:i});if(await e.request(`issue.update`,{repo:t.repo,id:t.issue.id,task:n}).catch(e=>a.push({kind:`link`,error:rC(e)})),t.placement===`worktree`)return{taskId:n,warnings:a};let o=await e.request(`task.openMain`,{repo:t.repo}),s=await e.request(`tab.openViewport`,{taskId:o.taskId,viewTaskId:n});return{taskId:o.taskId,tabId:s.tabId,warnings:a}}let{taskId:o}=await e.request(`task.openMain`,{repo:t.repo}),{tabId:s,taskId:c=o}=await e.request(`tab.new`,{taskId:o,kind:`engine`,engine:t.engine,prompt:i});return await e.request(`issue.setStatus`,{repo:t.repo,id:t.issue.id,status:`doing`}).catch(e=>a.push({kind:`status`,error:rC(e)})),{taskId:c,tabId:s,warnings:a}}var zw=`text-meta leading-[inherit]`,Bw=`text-meta`,Vw=`flex flex-col gap-2 overflow-hidden`,Hw=`flex min-w-0 items-baseline gap-3`,Uw=`font-bold whitespace-nowrap text-accent touch:relative touch:after:absolute touch:after:-inset-x-2 touch:after:-inset-y-1 touch:after:content-['']`,Ww=`min-w-0 truncate ${Bw}`,Gw=`ml-auto ${zw}`,Kw=`grid min-h-0 flex-1 grid-cols-4 gap-2`,qw=`flex min-h-0 flex-1 flex-col gap-2`,Jw=`flex gap-4 ${Bw}`,Yw=e=>`flex items-baseline gap-1.5 whitespace-nowrap touch:relative touch:after:absolute touch:after:-inset-x-1.5 touch:after:-top-1 touch:after:-bottom-3 touch:after:content-[''] ${e?`font-bold text-accent`:`text-muted`}`,Xw={in_progress:`text-accent`,parked:`text-warning`,done:`text-success`},Zw=e=>`flex min-h-0 flex-col rounded-md border-hairline border-line p-2 ${e?`flex-1`:``}`,Qw=e=>`m-0 mb-2 flex justify-between gap-2 font-mono text-meta font-bold normal-nums ${Xw[e]??`text-muted`}`,$w=`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto`,eT=`m-0 ${Bw}`,tT=e=>`flex flex-none cursor-pointer flex-col gap-1 rounded-sm border-hairline bg-surface px-2.5 py-2 ${e.selected?`border-accent`:e.attention?`border-warning`:`border-line hover:border-line-active`}`,nT=`flex justify-between gap-2`,rT=e=>`min-w-0 font-bold wrap-anywhere ${e?`text-muted`:``}`,iT=`h-[2.8em] overflow-hidden whitespace-pre-wrap wrap-anywhere ${zw}`,aT=`flex justify-between gap-2 ${Bw}`,oT=`w-[min(680px,calc(100vw-32px))]!`,sT=`flex items-baseline gap-3.5`,cT=`flex items-baseline gap-2.5`,lT=`tracking-[0] normal-case`,uT=`min-h-40 font-mono`,dT=`flex flex-col items-start gap-0.5`,fT=e=>`text-left font-mono text-meta whitespace-pre-wrap normal-nums ${e?`font-bold text-accent`:`font-normal text-muted`}`,pT=zw,mT=`flex flex-col gap-1 [&_p]:m-0`,hT=`flex gap-2 ${Bw}`,gT=`min-w-[4ch] text-right`,_T=`rounded-sm border-hairline border-transparent p-1 focus:border-accent focus:outline-none`,vT={choice:`radiogroup`,list:`listbox`,cells:`group`};function yT(e){return(0,L.jsx)(`div`,{ref:e.fieldRef,role:vT[e.kind??`choice`],tabIndex:0,"aria-label":e.label,className:`${_T} ${e.className??``}`,onKeyDown:e.onKeyDown,onClick:e.onClick,children:e.children})}var bT=[`open`,`doing`,`hold`,`done`];function xT({model:e,taskId:t}){let{kanban:n}=tC(),[r,i]=(0,h.useState)(null);return(0,h.useEffect)(()=>{let n=!0;return e.client.request(`task.events`,{taskId:t}).then(e=>n&&i(e.events)).catch(()=>n&&i([])),()=>{n=!1}},[e,t]),(0,L.jsxs)(`div`,{className:mT,children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:n.detail.eventsLabel}),r===null?(0,L.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsLoading}):r.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:n.detail.eventsNone}):r.map(e=>(0,L.jsxs)(`div`,{className:`mono ${hT}`,children:[(0,L.jsx)(`span`,{className:`text-muted ${gT}`,children:uw(e.at)}),(0,L.jsx)(`span`,{children:e.kind}),e.tail&&(0,L.jsx)(`span`,{className:`text-muted`,children:e.tail})]},`${e.at}:${e.kind}:${e.tail}`))]})}function ST(e){let{kanban:t}=tC(),{issue:n,mode:r}=e,i=r===`create`,a=!i&&n.taskId?n.taskId:null,o=i||!a&&n.status!==`done`,[s,c]=(0,h.useState)(n.title),[l,u]=(0,h.useState)(n.body),[d,f]=(0,h.useState)(n.status),[p,m]=(0,h.useState)(e.defaultEngine),[g,_]=(0,h.useState)(Lw[0]),[v,y]=(0,h.useState)(!1),[b,x]=(0,h.useState)(!1),S=(0,h.useRef)({}),C=e=>t=>{S.current[e]=t},w=i?`title`:o?`workspace`:a?`open`:`title`;(0,h.useEffect)(()=>S.current[w]?.focus(),[w]);let T=()=>({title:s.trim()||n.title,body:l,status:d}),E=()=>({engine:p,placement:g,jump:v}),D=t=>{Mn(),t&&e.onOutcome(t)},O=()=>s.trim()?!0:(S.current.title?.focus(),!1),k=()=>{i?O()&&D({kind:`create`,title:s.trim(),body:l,start:E()}):o?D({kind:`start`,...E(),...T()}):a&&D({kind:`open`,taskId:a,...T()})},A=()=>{i&&O()&&D({kind:`create`,title:s.trim(),body:l,start:null})},ee=()=>D(i?null:{kind:`close`,...T()}),j=(0,h.useRef)({commit:k,saveOnly:A,close:ee});j.current={commit:k,saveOnly:A,close:ee},(0,h.useEffect)(()=>{let e=e=>{let t=e.key===`Escape`?j.current.close:e.key===`Enter`&&(e.ctrlKey||e.metaKey)?j.current.commit:e.key.toLowerCase()===`s`&&e.ctrlKey&&!e.metaKey?j.current.saveOnly:null;t&&(e.preventDefault(),e.stopImmediatePropagation(),t())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let te=async t=>{let n=t.find(e=>e.size>Aw);if(n){H(F(`pages.attachTooLarge`,{name:n.name||n.type}),`error`);return}x(!0);try{let n=await Promise.all(t.map(t=>Iw(e.model.client,t)));u(e=>Nw(e,n))}catch(e){H(U(e),`error`)}finally{x(!1)}},ne=e=>{let t=Pw(e.clipboardData.files);t.length!==0&&(e.preventDefault(),te(t))},re=e=>{let t=Pw(e.dataTransfer.files);e.preventDefault(),t.length>0&&te(t)},M=(e,t,n)=>e[(Math.max(0,e.indexOf(t))+n+e.length)%e.length],N=(e,t,n)=>r=>{if(r.ctrlKey||r.metaKey||r.altKey)return;let i=(e===`x`?{ArrowRight:1,l:1,ArrowLeft:-1,h:-1}:{ArrowDown:1,ArrowUp:-1})[r.key];if(i)t(i);else if(r.key===`Enter`&&n)n();else return;r.preventDefault()},ie=d===`done`?`text-success`:d===`hold`?`text-warning`:d===`doing`?`text-accent`:`text-muted`,ae=e=>t.detail.status[e];return(0,L.jsx)(`div`,{className:Hn,onMouseDown:e=>e.target===e.currentTarget&&j.current.close(),children:(0,L.jsxs)(`dialog`,{open:!0,className:`${Un(!0)} ${oT}`,"aria-label":i?t.detail.newStory:`#${n.id}`,onPaste:ne,onDrop:re,onDragOver:e=>e.preventDefault(),children:[(0,L.jsxs)(`div`,{className:Wn,children:[i?(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:t.detail.newStory}):(0,L.jsxs)(`h1`,{className:`${z} text-muted ${sT}`,children:[(0,L.jsxs)(`span`,{children:[`#`,n.id]}),(0,L.jsx)(`span`,{className:ie,children:ae(d)}),(0,L.jsx)(`span`,{className:`text-muted`,children:$(t.detail.created,{date:n.created})}),a&&(0,L.jsx)(`span`,{className:`text-accent`,children:t.detail.linked})]}),(0,L.jsx)(`button`,{type:`button`,className:Kn,"aria-label":F(`dialog.close`),title:F(`dialog.close`),onClick:()=>j.current.close(),children:`×`})]}),(0,L.jsxs)(`div`,{className:qn,children:[(0,L.jsxs)(`label`,{className:Ln,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.detail.titleLabel}),(0,L.jsx)(`input`,{ref:C(`title`),className:ln,spellCheck:!1,value:s,onChange:e=>c(e.target.value.replace(/[\r\n]+/g,` `)),onKeyDown:e=>{e.key===`Enter`&&!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),S.current.description?.focus())}})]}),(0,L.jsxs)(`label`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${cT}`,children:[t.detail.description,(0,L.jsx)(`span`,{className:`text-muted ${lT}`,children:Kc()?F(`pages.attachHintTouch`):t.detail.attachHint}),b&&(0,L.jsx)(`span`,{className:`text-accent`,children:`…`})]}),(0,L.jsx)(`textarea`,{ref:C(`description`),className:`${ln} ${Rn} ${uT}`,rows:8,spellCheck:!1,placeholder:t.detail.noDescription,value:l,onChange:e=>u(e.target.value)})]}),!i&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsxs)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted flex items-baseline gap-2.5`,children:[t.detail.statusLabel,(0,L.jsx)(`span`,{className:`keys-only text-muted tracking-[0] normal-case`,children:`←/→`})]}),(0,L.jsx)(yT,{fieldRef:C(`status`),label:t.detail.statusLabel,className:`flex flex-wrap gap-1.5`,onKeyDown:N(`x`,e=>f(M(bT,d,e))),children:bT.map(e=>(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===d,className:Bn(e===d),onClick:()=>{f(e),S.current.status?.focus()},children:ae(e)},e))})]}),o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${cT}`,children:[t.detail.engine,(0,L.jsx)(`span`,{className:`keys-only text-muted ${lT}`,children:`←/→`})]}),(0,L.jsx)(yT,{fieldRef:C(`engine`),label:t.detail.engine,className:zn,onKeyDown:N(`x`,t=>m(M(e.engines.map(e=>e.id),p,t)),k),children:e.engines.map(e=>(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e.id===p,className:Bn(e.id===p),onClick:()=>{m(e.id),S.current.engine?.focus()},children:e.name},e.id))})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${cT}`,children:[t.detail.workspace,(0,L.jsx)(`span`,{className:`keys-only text-muted ${lT}`,children:`↑/↓`})]}),(0,L.jsx)(yT,{fieldRef:C(`workspace`),label:t.detail.workspace,className:dT,onKeyDown:N(`y`,e=>_(M(Lw,g,e)),k),children:Lw.map(e=>(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===g,className:`touch:py-1.5 ${fT(e===g)}`,onClick:()=>{_(e),S.current.workspace?.focus()},children:[e===g?`▸ `:` `,t.detail.placement[e]]},e))})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${cT}`,children:[t.detail.jumpLabel,(0,L.jsx)(`span`,{className:`keys-only text-muted ${lT}`,children:`←/→`})]}),(0,L.jsx)(yT,{fieldRef:C(`jump`),label:t.detail.jumpLabel,className:zn,onKeyDown:N(`x`,()=>y(!v),k),children:[!1,!0].map(e=>(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-pressed":e===v,className:Bn(e===v),onClick:()=>{y(e),S.current.jump?.focus()},children:e?t.detail.jump.follow:t.detail.jump.stay},String(e)))})]}),(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${pT}`,children:(0,L.jsx)(Ld,{text:Yc(i?t.detail.createLegend:t.detail.startLegend)})}),(0,L.jsxs)(`div`,{className:un,children:[i&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:A,children:F(`pages.storySave`)}),(0,L.jsx)(`button`,{type:`button`,className:Be(),onClick:k,children:F(i?`pages.storySaveStart`:`pages.storyStart`)})]})]}):a?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.detail.sessionLabel}),(0,L.jsxs)(`div`,{className:`${zn} ${_T}`,children:[(0,L.jsx)(`button`,{ref:C(`open`),type:`button`,className:Bn(!0),onClick:()=>D({kind:`open`,taskId:a,...T()}),children:t.detail.openAction}),(0,L.jsx)(`button`,{ref:C(`unlink`),type:`button`,className:Bn(),onClick:()=>D({kind:`unlink`,...T()}),children:t.detail.unlinkAction})]})]}),(0,L.jsx)(xT,{model:e.model,taskId:a}),(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${pT}`,children:(0,L.jsx)(Ld,{text:Yc(t.detail.openLegend)})})]}):(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${pT}`,children:(0,L.jsx)(Ld,{text:Yc(t.detail.doneNote)})})]})]})})}var CT={"waiting-on-you":`text-error`,landing:`text-success`,"ready-for-review":`text-ink`,working:`text-accent`};function wT(e){let[t,n]=(0,h.useState)(()=>{let t=q(e,`engines.list`);return t?al(t.engines):[]});return(0,h.useEffect)(()=>{El(e,`engines.list`).then(e=>n(al(e.engines))).catch(()=>n([]))},[e]),{engines:t,defaultEngine:ol(t)}}function TT(e,t){let n=sC(e),r=n.join(`
|
|
37
37
|
`),[i,a]=(0,h.useState)(()=>q(e,`kanban.boards`)??null);return(0,h.useEffect)(()=>{let t=!0,r=e.client,i=e=>r.request(e).then(e=>e.repos).catch(()=>[]);return Promise.all([i(`repos.list`),i(`issue.repos`)]).then(([e,t])=>oC(e,n,t)).then(e=>Promise.all(e.map(e=>r.request(`issue.list`,{repo:e}).catch(t=>({repoRoot:e,nextId:1,issues:[],readError:rC(t)}))))).then(n=>{let r=Tl(e,`kanban.boards`,void 0,[...n].sort((e,t)=>e.repoRoot.localeCompare(t.repoRoot)));t&&a(r)}),()=>{t=!1}},[e,t,r]),i}function ET(e){let{issue:t}=e,n=t.body.trim();return(0,L.jsxs)(`div`,{"data-issue":t.id,className:tT({selected:e.selected,attention:e.badge?.tone===`text-error`}),onClick:()=>e.selected?e.onOpen():e.onSelect(),onContextMenu:t=>{t.preventDefault(),e.onMenu(t.clientX,t.clientY)},children:[(0,L.jsxs)(`div`,{className:nT,children:[(0,L.jsx)(`span`,{className:rT(e.column===`done`),children:t.title}),(0,L.jsxs)(`span`,{className:`mono text-muted`,children:[`#`,t.id]})]}),(0,L.jsx)(`div`,{className:`text-muted ${iT}`,children:n}),(0,L.jsxs)(`div`,{className:`mono text-muted ${aT}`,children:[(0,L.jsx)(`span`,{children:t.created}),e.badge&&(0,L.jsx)(`span`,{className:e.badge.tone,children:e.badge.label})]})]})}var DT=5e3,OT=760;function kT({model:e}){let{kanban:t,group:n,common:r}=tC(),[i,a]=lC(DT),o=TT(e,i),{engines:s,defaultEngine:c}=wT(e),l=_(e.tasks),u=cC(e),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),g=fC(),[v,y]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=g.current;if(!e)return;let t=new ResizeObserver(()=>y(e.clientWidth<OT));return t.observe(e),()=>t.disconnect()},[g]);let b=o??[],x=u?b.find(e=>e.repoRoot.replace(/^\/private\//,`/`)===u.replace(/^\/private\//,`/`)):void 0,S=Math.max(0,b.findIndex(e=>e.repoRoot===(d??x?.repoRoot))),C=b[S],w=b.map(e=>e.repoRoot),T=b.filter(e=>e.readError).map(e=>`${e.repoRoot}\0${e.readError}`).join(`
|
|
38
|
-
`);(0,h.useEffect)(()=>{for(let e of b)e.readError&&H($(t.readFailedToast,{repo:aC(e.repoRoot,w),error:e.readError}),`error`)},[T]);let E=l?.tasks??[],D=new Set(E.map(e=>e.id)),O=e=>E.find(t=>t.id===e)?.group,{columns:k,attentionCount:A}=Ew(C?Ow(C.issues,D.size===0?void 0:e=>D.has(e)):[],e=>O(e)===`waiting-on-you`),ee={backlog:t.column.backlog,in_progress:t.column.inProgress,parked:t.column.parked,done:t.column.done},j=(e,t)=>{let r=e.taskId&&(t===`in_progress`||t===`parked`)?O(e.taskId):void 0,i=r===`waiting-on-you`?n.waitingOnYou:r===`landing`?n.landing:r===`ready-for-review`?n.readyForReview:r===`working`?n.working:null;return r&&i?{label:i,tone:CT[r]??`text-muted`}:null},te=async(t,n,r,i)=>{try{return await e.client.request(t,{repo:C?.repoRoot,...n})}catch(e){return H($(r,{id:String(i),error:rC(e)}),`error`),null}finally{a()}},ne=(e,n)=>te(`issue.setStatus`,{id:e.id,status:n},t.statusFailed,e.id),re=t=>{V.set(null),e.select(t)},M=async(n,r,i)=>{try{let a=await Rw(e.client,{repo:n,issue:r,engine:i.engine,placement:i.placement});for(let e of a.warnings)H($(e.kind===`link`?t.linkFailed:t.statusFailed,{id:String(r.id),error:e.error}),`error`);i.jump?(V.set(null),e.selectWhenListed(a.taskId),a.tabId&&await e.refreshTabsNow(a.taskId).then(()=>e.select(a.taskId,a.tabId))):H($(t.detail.startedBackground,{title:`#${r.id} ${r.title}`}))}catch(e){H(U(e),`error`)}finally{a()}},N=async(e,n)=>{if(!C||n.kind===`create`)return;let r={};n.title!==e.title&&(r.title=n.title),n.body!==e.body&&(r.body=n.body),(r.title!==void 0||r.body!==void 0)&&await te(`issue.update`,{id:e.id,...r},t.updateFailed,e.id),n.status!==e.status&&await ne(e,n.status),n.kind===`open`?re(n.taskId):n.kind===`unlink`?await te(`issue.update`,{id:e.id,task:`none`},t.unlinkFailed,e.id):n.kind===`start`&&await M(C.repoRoot,{...e,...r},n)},ie=t=>{C&&(m(t.id),B.set((0,L.jsx)(ST,{model:e,issue:t,mode:`detail`,engines:s,defaultEngine:c,onOutcome:e=>void N(t,e)})))},ae=()=>{if(!C)return;let n=C.repoRoot,r={id:C.nextId,title:``,status:`open`,created:new Date().toISOString().slice(0,10),body:``};B.set((0,L.jsx)(ST,{model:e,issue:r,mode:`create`,engines:s,defaultEngine:c,onOutcome:i=>{i.kind===`create`&&(async()=>{try{let t=await e.client.request(`issue.create`,{repo:n,title:i.title,body:i.body});if(a(),!i.start)return;let o=t.issues.find(e=>e.id===r.id)??t.issues.reduce((e,t)=>e&&e.id>t.id?e:t,null);o&&await M(n,o,i.start)}catch(e){H($(t.createFailed,{error:rC(e)}),`error`)}})()}}))},oe=()=>{let n=C?.issues.find(e=>e.id===p);if(!C||!n)return;let i=C.repoRoot;B.set((0,L.jsx)(Er,{title:$(t.confirmDelete.title,{id:String(n.id)}),body:$(t.confirmDelete.body,{title:n.title}),confirmLabel:r.confirm,onConfirm:async()=>{try{await e.client.request(`issue.delete`,{repo:i,id:n.id}),m(null)}catch(e){H($(t.deleteFailed,{id:String(n.id),error:rC(e)}),`error`)}finally{a()}}}))},se=e=>{b.length!==0&&(f(b[(S+e+b.length)%b.length]?.repoRoot??null),m(null))},ce=e=>{let t=ww(k,p,e);t!=null&&m(t)},P=e=>k.some(e=>e.issues.length>0)?ce(e):se(e===`left`?-1:1);dC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`r`:return a(),!0;case`Tab`:return se(e.shiftKey?-1:1),!0;case`ArrowUp`:return ce(`up`),!0;case`ArrowDown`:return ce(`down`),!0;case`ArrowRight`:case`l`:return P(`right`),!0;case`ArrowLeft`:case`h`:return P(`left`),!0;case`Enter`:{let e=C?.issues.find(e=>e.id===p);return e&&ie(e),!0}case`n`:return ae(),!0;case`d`:return oe(),!0;default:return!1}});let le=(0,h.useRef)(null);(0,h.useEffect)(()=>{le.current?.querySelector(`[data-issue="${p}"]`)?.scrollIntoView({block:`nearest`})},[p]);let ue=(e,n,r)=>{m(e.id),mn.set({x:n,y:r,items:bT.filter(t=>t!==e.status).map(n=>({label:$(t.menu.setStatus,{status:t.detail.status[n]}),run:()=>void ne(e,n)}))})},de=k.find(e=>e.issues.some(e=>e.id===p))??k.find(e=>e.issues.length>0)??k[0],fe=(e,n=!1)=>{let r=$(t.attention,{count:String(A)});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{children:[ee[e.key],` (`,e.issues.length+e.hiddenCount,`)`]}),e.key===`in_progress`&&A>0&&(0,L.jsx)(`span`,{className:`text-warning`,title:n?r:void 0,children:n?`!${A}`:r})]})},pe=(e,n)=>(0,L.jsxs)(`section`,{className:Zw(!n),children:[n&&(0,L.jsx)(`h2`,{className:Qw(e.key),children:fe(e)}),(0,L.jsxs)(`div`,{className:$w,children:[e.issues.map(t=>(0,L.jsx)(ET,{issue:t,column:e.key,selected:t.id===p,badge:j(t,e.key),onSelect:()=>m(t.id),onOpen:()=>ie(t),onMenu:(e,n)=>ue(t,e,n)},t.id)),e.issues.length===0&&e.hiddenCount===0&&(0,L.jsx)(`p`,{className:`mono text-muted ${eT}`,children:t.columnEmpty}),e.hiddenCount>0&&(0,L.jsx)(`p`,{className:`mono text-muted ${eT}`,children:$(t.more,{count:String(e.hiddenCount)})})]})]},e.key);return(0,L.jsxs)(`div`,{className:`${Gv} ${Vw}`,tabIndex:0,ref:g,children:[(0,L.jsxs)(`div`,{className:`kb-top`,children:[(0,L.jsx)(`h1`,{className:qv,children:t.title}),(0,L.jsx)(`span`,{className:`mono keys-only text-muted`,children:t.hint}),(0,L.jsxs)(`span`,{className:`mono ${Xv}`,children:[(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Zv.kanban}`,disabled:!C,onClick:ae,children:F(`pages.new`)}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Zv.kanban}`,disabled:!C?.issues.some(e=>e.id===p),onClick:oe,children:F(`pages.delete`)})]})]}),o===null?(0,L.jsx)(`p`,{className:`text-muted`,children:t.loading}):C?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:Hw,children:[(0,L.jsxs)(`button`,{type:`button`,className:Uw,onClick:()=>se(1),children:[aC(C.repoRoot,w),b.length>1&&(0,L.jsx)(`span`,{className:`text-muted`,children:` ${S+1}/${b.length}`})]}),!v&&(0,L.jsx)(`span`,{className:`mono text-muted ${Ww}`,children:C.repoRoot}),C.issues.length===0&&!C.readError&&(0,L.jsx)(`span`,{className:`text-muted ${Gw}`,children:t.empty})]}),C.readError?(0,L.jsx)(`p`,{className:`text-error`,children:$(t.readFailed,{error:C.readError})}):v&&de?(0,L.jsxs)(`div`,{className:qw,ref:le,children:[(0,L.jsx)(`div`,{className:`mono ${Jw}`,children:k.map(e=>(0,L.jsx)(`button`,{type:`button`,className:Yw(e.key===de.key),onClick:()=>{let t=e.issues[0];t&&m(t.id)},children:fe(e,!0)},e.key))}),pe(de,!1)]}):(0,L.jsx)(`div`,{className:Kw,ref:le,children:k.map(e=>pe(e,!0))})]}):(0,L.jsx)(`p`,{className:`text-muted`,children:t.noRepos})]})}var AT={title:`Mods`,empty:`No mod is drawing anything.`,emptyHint:`A plugin with a [mod] entry draws its panes here, in the TUI and the web alike.`,keys:`↑↓/tab move · enter press · esc back`,pressFailed:`{plugin}: the press did not reach the mod ({reason})`},jT={title:`Mods`,empty:`当前没有 mod 在绘制内容。`,emptyHint:`声明了 [mod] 的插件会在这里绘制面板,TUI 和 web 显示的是同一份。`,keys:`↑↓/tab 移动 · enter 按下 · esc 返回`,pressFailed:`{plugin}:按键没有送达 mod({reason})`},MT={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`,muted:`text-muted`},NT=`flex flex-col gap-3`,PT=`[&_p]:mx-0 [&_p]:my-1`,FT=`rounded-md border-hairline border-line px-3 pt-2 pb-3 font-mono`,IT=`mb-2 text-meta leading-[inherit] text-ink`,LT=(e,t)=>`flex min-w-0 items-start ${e?`[&>form]:flex-[1_1_12em] [&>form]:self-center`:``} ${t?`rounded-sm border-hairline border-line`:``}`,RT=(e,t)=>`whitespace-pre-wrap wrap-anywhere ${e?MT[e]:`text-ink`} ${t?`font-bold`:``}`,zT=(e,t)=>`cursor-pointer rounded-sm border-hairline border-current px-2.5 py-0.5 [font:inherit] font-bold! ${MT[e]} ${t?`bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`:`bg-transparent [&:hover]:bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`}`,BT=`flex min-w-0 max-w-[40em] self-stretch`,VT=`w-full font-mono`,HT=[0,6,12,20];function UT(e){return`mod-${e.kind}:${e.plugin}/${e.pane}/${e.key}`}function WT(e){let[t,n]=(0,h.useState)(e.value??``);return(0,L.jsx)(`form`,{className:BT,onSubmit:r=>{r.preventDefault(),e.onSubmit(t),n(e.value??``)},children:(0,L.jsx)(`input`,{id:e.id,className:`${ln} ${VT}`,spellCheck:!1,value:t,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e=>n(e.target.value)})})}function GT(e){let{node:t}=e;if(t.type===`text`)return(0,L.jsx)(`span`,{className:RT(t.tone,t.bold===!0),children:t.text});if(t.type===`input`){let n={kind:`input`,plugin:e.pane.plugin,pane:e.pane.id,key:t.key};return(0,L.jsx)(WT,{id:UT(n),placeholder:t.placeholder,value:t.value,onFocus:()=>e.onFocus(n),onSubmit:t=>e.onSubmit(n,t)},t.value??``)}if(t.type===`button`){let n={kind:`button`,plugin:e.pane.plugin,pane:e.pane.id,key:t.key};return(0,L.jsx)(`button`,{type:`button`,id:UT(n),className:zT(t.tone??`info`,Hi(n,e.cursor)),onFocus:()=>e.onFocus(n),onClick:()=>e.onPress(n),children:t.label})}return(0,L.jsx)(`div`,{className:LT(t.direction===`row`,t.border===!0),style:{flexDirection:t.direction??`column`,gap:HT[t.gap??0],padding:HT[t.padding??0]},children:t.children.map((t,n)=>(0,L.jsx)(GT,{...e,node:t},n))})}function KT({model:e}){let t=I()===`zh`?jT:AT,n=_(e.mods),r=Vi(n),[i,a]=(0,h.useState)(null),o=Ui(r,i),s=fC(),c=(0,h.useRef)(!1),l=(t,n,r={})=>{a(t),!c.current&&(c.current=!0,e.client.request(n,{plugin:t.plugin,pane:t.pane,key:t.key,...r}).catch(e=>H(e instanceof Error?e.message:String(e),`error`)).finally(()=>{c.current=!1}))},u=e=>l(e,`mod.press`),d=(e,t)=>l(e,`mod.submit`,{value:t}),f=e=>{let t=Wi(r,o,e);a(t),t&&document.getElementById(UT(t))?.focus()};return dC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`ArrowDown`:return f(1),!0;case`ArrowUp`:return f(-1),!0;case`Enter`:return e.target instanceof HTMLButtonElement?!1:(o?.kind===`button`&&u(o),!0);default:return!1}}),(0,L.jsxs)(`div`,{className:`${Kv} ${NT}`,tabIndex:0,ref:s,children:[(0,L.jsxs)(`div`,{className:Jv,children:[(0,L.jsx)(`h1`,{className:qv,children:t.title}),(0,L.jsx)(`span`,{className:`keys-only touch:empty:hidden! text-muted ${Yv(!1)}`,children:t.keys})]}),n.length===0?(0,L.jsxs)(`div`,{className:PT,children:[(0,L.jsx)(`p`,{children:t.empty}),(0,L.jsx)(`p`,{className:`text-muted`,children:t.emptyHint})]}):n.map(e=>(0,L.jsxs)(`section`,{className:FT,children:[(0,L.jsxs)(`header`,{className:IT,children:[e.title,` `,(0,L.jsx)(`span`,{className:`text-muted`,children:e.plugin})]}),(0,L.jsx)(GT,{node:e.tree,pane:e,cursor:o,onPress:u,onSubmit:d,onFocus:a})]},`${e.plugin}/${e.id}`))]})}function qT(e){return e===`dispatch_failed`||e===`skipped_unavailable`||e===`script_failed`}function JT(e,t){return e.response?`responded`:e.status!==`dispatched`&&e.status!==`revived`?null:e.deliveryStatus===`missing`?`missing`:e.deliveryStatus===`awaiting`?`awaiting`:t-Date.parse(e.at)>72e5?`missing`:`awaiting`}var YT=6e4,XT=3294,ZT=new Map([[`JAN`,1],[`FEB`,2],[`MAR`,3],[`APR`,4],[`MAY`,5],[`JUN`,6],[`JUL`,7],[`AUG`,8],[`SEP`,9],[`OCT`,10],[`NOV`,11],[`DEC`,12]]),QT=new Map([[`SUN`,0],[`MON`,1],[`TUE`,2],[`WED`,3],[`THU`,4],[`FRI`,5],[`SAT`,6]]),$T=256;function eE(e,t,n){let r=e.toUpperCase(),i=t?.get(r);if(i!==void 0)return i;if(!/^\d+$/.test(r))throw Error(`invalid cron ${n}: ${e}`);return Number(r)}function tE(e){let t=new Set;for(let n of e.value.split(`,`)){if(n.length===0)throw Error(`invalid cron ${e.field}: ${e.value}`);let[r,i,...a]=n.split(`/`);if(a.length>0||r===void 0)throw Error(`invalid cron ${e.field}: ${n}`);let o=1;if(i!==void 0&&(!/^\d+$/.test(i)||(o=Number(i),o<1)))throw Error(`invalid cron ${e.field} step: ${n}`);let s,c;if(r===`*`)s=e.min,c=e.max;else if(r.includes(`-`)){let[t,i,...a]=r.split(`-`);if(a.length>0||t===void 0||i===void 0)throw Error(`invalid cron ${e.field} range: ${n}`);s=eE(t,e.names,e.field),c=eE(i,e.names,e.field)}else s=eE(r,e.names,e.field),c=i===void 0?s:e.max;if(s<e.min||c>e.max||s>c)throw Error(`cron ${e.field} out of range: ${n}`);for(let n=s;n<=c;n+=o)t.add(e.normalize?e.normalize(n):n)}return t}function nE(e){if(e.length>$T)throw Error(`cron expression is too long`);let t=e.trim().split(/\s+/).filter(Boolean);if(t.length!==5)throw Error(`cron expression needs 5 fields (minute hour day month weekday), got ${t.length}`);let[n,r,i,a,o]=t;return{minutes:tE({value:n,min:0,max:59,field:`minute`}),hours:tE({value:r,min:0,max:23,field:`hour`}),daysOfMonth:tE({value:i,min:1,max:31,field:`day-of-month`}),months:tE({value:a,min:1,max:12,field:`month`,names:ZT}),daysOfWeek:tE({value:o,min:0,max:7,field:`weekday`,names:QT,normalize:e=>e%7}),dayOfMonthRestricted:!i.startsWith(`*`),dayOfWeekRestricted:!o.startsWith(`*`)}}function rE(e){try{return nE(e),!0}catch{return!1}}function iE(e,t,n){return new Date(e.year,e.month-1,e.day,t,n,0,0).getTime()}function aE(e){let t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function oE(e,t){return aE(new Date(e.year,e.month-1,e.day+t,12,0,0,0).getTime())}function sE(e,t){if(!e.months.has(t.month))return!1;let n=e.daysOfMonth.has(t.day),r=e.daysOfWeek.has(new Date(t.year,t.month-1,t.day).getDay());return e.dayOfMonthRestricted&&e.dayOfWeekRestricted?n||r:n&&r}function cE(e){return e-e%YT}function lE(e,t){return[...e].sort((e,n)=>(e-n)*t)}function uE(e,t){let n=nE(e),r=lE(n.hours,1),i=lE(n.minutes,1),a=new Date(cE(t)+YT),o=aE(a.getTime()),s=a.getHours(),c=a.getMinutes();for(let e=0;e<XT;e++){if(sE(n,o)){for(let e of r)if(!(e<s))for(let n of i){if(e===s&&n<c)continue;let r=iE(o,e,n);if(r>t)return r}}o=oE(o,1),s=0,c=0}throw Error(`cron expression never matches: ${e}`)}var dE=[`minute`,`hour`,`dayOfMonth`,`month`,`dayOfWeek`];function fE(e){let t=e.trim().split(/\s+/).filter(Boolean);return dE.map((e,n)=>t[n]??`*`)}function pE(e){return dE.map((t,n)=>e[n]??`*`).join(` `)}var mE=[`*`,`*/5`,`*/10`,`*/15`,`*/30`,...bE(0,59)],hE=[`*`,`*/2`,`*/3`,`*/4`,`*/6`,`*/12`,...bE(0,23)],gE=[`*`,...bE(1,31)],_E=[`*`,`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`],vE=[`*`,`MON-FRI`,`SAT,SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`],yE=[`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`];function bE(e,t){let n=[];for(let r=e;r<=t;r++)n.push(String(r));return n}var xE={minute:mE,hour:hE,dayOfMonth:gE,month:_E,dayOfWeek:vE};function SE(e,t,n){let r=xE[e],i=r.indexOf(t.trim().toUpperCase());return i<0?(n>0?r[0]:r[r.length-1])??t:r[(i+n+r.length)%r.length]??t}function CE(e,t){return Math.min(Math.max(e+t,0),dE.length-1)}function wE(e,t,n){let r=fE(e);return t<0||t>=dE.length||(r[t]=n),pE(r)}function TE(e,t){let[n,r,i,a,o]=fE(e);if(a!==`*`||i!==`*`||n===void 0||r===void 0||o===void 0)return null;let s=EE(n,r,t);if(!s)return null;let{at:c,bare:l}=s;if(o===`*`)return l?c:t(`automations.schedule.everyDay`,{at:c});if(o===`MON-FRI`)return t(`automations.schedule.weekdays`,{at:c});if(o===`SAT,SUN`)return t(`automations.schedule.weekends`,{at:c});let u=yE.find(e=>e===o.toUpperCase());return u?t(`automations.schedule.onWeekday`,{weekday:t(`automations.schedule.dow.${u}`),at:c}):null}function EE(e,t,n){return t===`*`?e===`*`?{at:n(`automations.schedule.everyMinute`),bare:!0}:e.startsWith(`*/`)?{at:n(`automations.schedule.everyMinutes`,{n:e.slice(2)}),bare:!0}:/^\d+$/.test(e)?{at:n(`automations.schedule.hourlyAt`,{minute:e.padStart(2,`0`)}),bare:!1}:null:t.startsWith(`*/`)&&e===`0`?{at:n(`automations.schedule.everyHours`,{n:t.slice(2)}),bare:!0}:/^\d+$/.test(t)&&/^\d+$/.test(e)?{at:n(`automations.schedule.atClock`,{time:`${t.padStart(2,`0`)}:${e.padStart(2,`0`)}`}),bare:!1}:null}function DE(e,t,n,r){let i=e.trim();if(!rE(i))return{kind:`invalid`};let a;try{a=uE(i,t)}catch{return{kind:`never`}}return{kind:`ok`,nextRunMs:a,relative:OE(a-t,n),absolute:kE(a,t,n,r)}}function OE(e,t){let{minutes:n,hours:r,days:i}=lw(e);return n<60?t(`automations.when.inMinutes`,{n:Math.max(1,n)}):r<24?t(`automations.when.inHours`,{n:r}):t(`automations.when.inDays`,{n:i})}function kE(e,t,n,r){let i=new Date(e),a=`${String(i.getHours()).padStart(2,`0`)}:${String(i.getMinutes()).padStart(2,`0`)}`,o=new Date(t);if(i.getFullYear()===o.getFullYear()&&i.getMonth()===o.getMonth()&&i.getDate()===o.getDate())return a;let s=e-t<5184e5,c=i.toLocaleDateString(r,s?{weekday:`short`}:{weekday:`short`,month:`short`,day:`numeric`});return s?`${c} ${a}`:n(`automations.when.dateTime`,{date:c,time:a})}var AE={name:``,repo:``,prompt:``,schedule:`0 9 * * MON-FRI`};function jE(e){return e.name.trim().length>0&&(e.repo===null||e.repo.trim().length>0)&&e.prompt.trim().length>0&&(!e.target||e.target.taskId.trim().length>0&&/^tab-[\w-]+$/.test(e.target.tabId))&&rE(e.schedule.trim())}function ME(e){return e.name.trim().length===0?`name`:e.repo!==null&&e.repo.trim().length===0?`repo`:e.target&&!e.target.taskId.trim()?`target`:e.target&&!/^tab-[\w-]+$/.test(e.target.tabId)?`targetTab`:e.prompt.trim().length===0?`prompt`:rE(e.schedule.trim())?null:`schedule`}var NE=`flex flex-col overflow-hidden @container`,PE=`mt-2.5 grid min-h-0 flex-1 grid-cols-[minmax(260px,2fr)_minmax(0,3fr)] gap-4 rt-narrow:flex rt-narrow:flex-col rt-narrow:overflow-y-auto`,FE=`flex min-h-0 flex-col gap-3 overflow-y-auto scrollbar-none rt-narrow:shrink-0 rt-narrow:overflow-visible`,IE=`flex gap-1.5 px-2 pt-0 pb-1`,LE=e=>`flex min-w-0 cursor-pointer flex-col gap-0.5 rounded-sm px-2 py-1.5 ${e?`bg-menu`:`[&:hover]:bg-hover`}`,RE=`flex min-w-0 items-baseline gap-2.5`,zE=e=>`min-w-0 flex-1 truncate font-bold ${e?`text-muted`:``}`,BE=`whitespace-nowrap text-meta`,VE=`truncate text-meta`,HE=`flex min-h-0 flex-col gap-1.5 overflow-y-auto py-0 pr-0 pl-4 [border-left:var(--hairline)_solid_var(--line)] [&_h2]:m-0 [&_p]:m-0 [&>*]:shrink-0 [&>h2]:mt-2.5 rt-narrow:shrink-0 rt-narrow:overflow-visible rt-narrow:pt-3 rt-narrow:pl-0 rt-narrow:[border-left:none] rt-narrow:[border-top:var(--hairline)_solid_var(--line)]`,UE=`flex flex-wrap items-baseline justify-between gap-3`,WE=`font-sans text-display font-bold normal-nums wrap-anywhere`,GE=`mx-0 mt-1 mb-0 grid grid-cols-[max-content_minmax(0,1fr)] items-baseline gap-x-3.5 gap-y-1 [&_dd]:m-0 [&_dd]:wrap-anywhere [&_dd_.mono]:whitespace-pre`,KE=`max-h-[12lh] overflow-y-auto rounded-sm bg-inset px-2.5 py-2 whitespace-pre-wrap wrap-anywhere`,qE=`min-w-0 text-meta leading-[inherit]`,JE=`flex w-full min-w-0 gap-2 text-inherit`,YE=JE,XE=`${JE} cursor-pointer border-none bg-transparent p-0 text-left font-[inherit] [&:hover]:underline`,ZE=`min-w-0 flex-1 truncate`,QE=`[&+&]:mt-1.5`,$E=e=>`whitespace-pre-wrap wrap-anywhere text-meta ${e?``:`leading-[inherit]`}`,eD=`text-meta`,tD=`flex gap-4.5`,nD=e=>`flex min-w-[5ch] flex-col gap-0.5 rounded-sm border-hairline px-1.5 py-1 text-left font-mono text-body normal-nums [&>span]:text-meta [&>span]:text-subtle ${e?`border-accent font-bold text-accent`:`border-transparent font-normal`}`,rD=`hidden gap-2 px-1 pt-0.5 pb-1.5 touch:flex`,iD=`h-8 w-11 touch-manipulation rounded-sm border-hairline border-line bg-inset font-mono text-display font-normal normal-nums text-ink`;function aD(e){let{auto:t,common:n}=tC(),r=nC(),i=I()===`zh`?`zh-CN`:`en-US`,[a,o]=(0,h.useState)(()=>({...AE,repo:e.repos.find(t=>e.defaultRepo&&iC(t)===iC(e.defaultRepo))??e.repos[0]??null})),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(null),d=(0,h.useRef)({}),f=e=>t=>{d.current[e]=t};(0,h.useEffect)(()=>d.current.name?.focus(),[]);let p=e=>{o(t=>({...t,...e})),u(null)};(0,h.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),Mn())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let m=()=>{if(jE(a)){Mn(),e.onSubmit({name:a.name.trim(),repo:a.repo===null?null:a.repo.trim(),prompt:a.prompt.trim(),schedule:a.schedule.trim(),...a.target?{target:a.target}:{}});return}let n=ME(a);n&&(d.current[n]?.focus(),u(Reflect.get(t.missing,n)))},g=a.repo===null?[]:e.tasks.filter(e=>iC(e.repo)===iC(a.repo??``)),_=a.target?g.findIndex(e=>e.id===a.target?.taskId)+1:0,v=e=>{let t=(_+e+g.length+1)%(g.length+1),n=g[t-1];p({target:n?{kind:`existing-tab`,taskId:n.id,tabId:`tab-1`}:void 0})},y=[null,...e.repos],b=e=>{let t=Math.min(Math.max(y.indexOf(a.repo)+e,0),y.length-1),n=y[t];n!==void 0&&p({repo:n,target:void 0})},x=e=>t=>{(t.key===`ArrowUp`||t.key===`ArrowDown`)&&(t.preventDefault(),e(t.key===`ArrowDown`?1:-1))},S=e=>t=>{t.key===`Enter`&&(t.preventDefault(),d.current[e]?.focus())},C=fE(a.schedule),w=e=>{let t=dE[s];t&&p({schedule:wE(a.schedule,s,SE(t,C[s]??`*`,e))})},T=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`ArrowLeft`||e.key===`h`)c(CE(s,-1));else if(e.key===`ArrowRight`||e.key===`l`)c(CE(s,1));else if(e.key===`ArrowUp`||e.key===`ArrowDown`)w(e.key===`ArrowUp`?1:-1);else return;e.preventDefault()}},E=DE(a.schedule,Date.now(),r,i),D=TE(a.schedule,r);return(0,L.jsx)(`div`,{className:Hn,onMouseDown:e=>e.target===e.currentTarget&&Mn(),children:(0,L.jsxs)(`dialog`,{open:!0,className:`${Un(!0)} ${oT}`,"aria-label":t.newTitle,children:[(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:t.newTitle}),(0,L.jsxs)(`div`,{className:qn,children:[(0,L.jsxs)(`label`,{className:Ln,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.fieldName}),(0,L.jsx)(`input`,{ref:f(`name`),className:ln,spellCheck:!1,placeholder:t.namePlaceholder,value:a.name,onChange:e=>p({name:e.target.value}),onKeyDown:S(`repo`)})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${cT}`,children:[t.fieldRepo,(0,L.jsx)(`span`,{className:`keys-only text-muted ${lT}`,children:`↑/↓`})]}),(0,L.jsx)(yT,{fieldRef:f(`repo`),kind:`list`,label:t.fieldRepo,className:dT,onKeyDown:x(b),children:y.map(t=>(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-selected":t===a.repo,className:`touch:py-1.5 ${fT(t===a.repo)}`,onClick:()=>{p({repo:t,target:void 0}),d.current.repo?.focus()},children:[t===a.repo?`▸ `:` `,t===null?F(`rail.noProject`):aC(t,e.repos)]},t??``))})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${cT}`,children:[t.fieldTarget,(0,L.jsx)(`span`,{className:`keys-only text-muted ${lT}`,children:`↑/↓`})]}),(0,L.jsx)(yT,{fieldRef:f(`target`),kind:`list`,label:t.fieldTarget,onKeyDown:x(v),onClick:()=>v(1),children:a.target?g[_-1]?.title??a.target.taskId:t.targetFresh})]}),a.target&&(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:t.fieldTargetTab}),(0,L.jsx)(`input`,{ref:f(`targetTab`),className:ln,spellCheck:!1,value:a.target.tabId,onChange:e=>a.target&&p({target:{...a.target,tabId:e.target.value}}),onKeyDown:S(`prompt`)})]}),(0,L.jsxs)(`label`,{className:Ln,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.fieldPrompt}),(0,L.jsx)(`input`,{ref:f(`prompt`),className:ln,spellCheck:!1,placeholder:t.promptPlaceholder,value:a.prompt,onChange:e=>p({prompt:e.target.value}),onKeyDown:S(`schedule`)})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${cT}`,children:[t.fieldSchedule,(0,L.jsx)(`span`,{className:`keys-only text-muted ${lT}`,children:`←/→ ↑/↓`})]}),(0,L.jsx)(yT,{fieldRef:f(`schedule`),kind:`cells`,label:t.fieldSchedule,className:tD,onKeyDown:T,children:dE.map((e,n)=>(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,className:nD(n===s),onClick:()=>{c(n),d.current.schedule?.focus()},children:[C[n]??`*`,(0,L.jsx)(`span`,{children:t.cronField[e]})]},e))}),(0,L.jsx)(`div`,{className:rD,children:[-1,1].map(e=>{let n=t.cronField[dE[s]??`minute`]??``;return(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,className:iD,"aria-label":F(e<0?`pages.cronDown`:`pages.cronUp`,{field:n}),onClick:()=>{w(e),d.current.schedule?.focus()},children:e<0?`−`:`+`},e)})}),E.kind===`ok`?(0,L.jsxs)(`p`,{className:`mono text-success`,children:[D?`${D}, `:``,E.relative,`, `,E.absolute]}):(0,L.jsx)(`p`,{className:`mono text-error`,children:E.kind===`never`?t.cronNever:t.cronInvalid})]}),l&&(0,L.jsxs)(`p`,{className:`text-error`,children:[`※ `,l]}),(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${pT}`,children:(0,L.jsx)(Ld,{text:Yc(t.composerLegend)})}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Mn,children:n.cancel}),(0,L.jsx)(`button`,{ref:f(`confirm`),type:`button`,className:Be(),onClick:m,children:n.create})]})]})]})})}var oD=[`ok`,`blocked`,`failed`,`skipped`];function sD(e){switch(e.status){case`dispatched`:case`revived`:case`ran`:return`ok`;case`skipped_blocked`:return`blocked`;case`dispatch_failed`:case`skipped_unavailable`:case`script_failed`:return`failed`;default:return`skipped`}}var cD={scheduled:`schedule`,manual:`manual`,webhook:`webhook`};function lD(e){if(e.status===`skipped_precheck`)return e.precheckResult?.durationMs??null;if(e.status===`ran`||e.status===`script_failed`)return null;let t=Date.parse(e.at),n=Date.parse(e.response?.at??``);return Number.isFinite(t)&&Number.isFinite(n)&&n>=t?n-t:null}function uD(e){if(e<1e3)return`${Math.max(0,Math.round(e))}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return n%60==0?`${r}h`:`${r}h ${n%60}m`}function dD(e,t,n){return(t===null?Object.values(e).flat():e[t]??[]).filter(e=>n===null||sD(e)===n).sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||t.runNumber-e.runNumber)}function fD(e){let t=e.indexOf(`{`),n=e.lastIndexOf(`}`);if(t<0||n<=t)return null;try{return{prefix:e.slice(0,t).trim(),value:JSON.parse(e.slice(t,n+1))}}catch{return null}}var pD=(e,t)=>e&&typeof e==`object`?Reflect.get(e,t):void 0;function mD(e){let t=fD(e);if(!t)return{summary:e,full:e};let n=pD(t.value,`error`)??t.value,r=pD(n,`message`),i=pD(n,`code`),a=typeof r==`string`?typeof i==`string`?`${i}: ${r}`:r:null,o=t.prefix.replace(/:$/,``);return{summary:a?`${o} — ${a}`:e,full:`${t.prefix}\n${JSON.stringify(t.value,null,2)}`}}function hD(e){let t=e.trim();if(!/^[[{]/.test(t))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}var gD={dispatched:`success`,revived:`success`,skipped_precheck:`muted`,skipped_blocked:`warning`,skipped_cancelled:`muted`,skipped_missed:`warning`,skipped_unavailable:`warning`,dispatch_failed:`error`,ran:`success`,script_failed:`error`},_D={success:`text-success`,muted:`text-muted`,warning:`text-warning`,error:`text-error`},vD={success:`✓`,error:`†`,warning:`!`,muted:`·`},yD=e=>gD[e]??`muted`;function bD(e){let{auto:t}=tC(),{runs:n,when:r}=e,i=e=>t.runStatus[e]??e,a=n.filter(e=>e.response);return(0,L.jsxs)(L.Fragment,{children:[n[0]?.precheckResult&&(0,L.jsx)(xD,{run:n[0]}),(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:t.responses}),a.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.noResponses}):a.map(e=>(0,L.jsxs)(`div`,{className:QE,children:[(0,L.jsx)(`p`,{className:`mono ${eD} ${_D[yD(e.status)]}`,children:`#${e.runNumber} ${i(e.status)}, ${r(e.response?.at)}`}),(0,L.jsx)(`p`,{className:$E(!1),children:hD(e.response?.text??``)})]},e.id))]})}function xD({run:e}){let{auto:t}=tC(),n=e.precheckResult;if(!n)return null;let r=n.timedOut?t.precheckTimedOut:$(t.precheckExited,{code:String(n.exitCode??`?`)}),i=[{label:t.precheckStdout,text:n.stdout},{label:t.precheckStderr,text:n.stderr}].filter(e=>e.text.trim().length>0);return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:$(t.precheckDetail,{exit:r,duration:String(n.durationMs)})}),i.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.precheckNoOutput}):i.map(e=>(0,L.jsx)(`p`,{className:`mono ${$E(!0)}`,children:`${e.label}: ${e.text.replace(/\s+$/,``).split(`
|
|
38
|
+
`);(0,h.useEffect)(()=>{for(let e of b)e.readError&&H($(t.readFailedToast,{repo:aC(e.repoRoot,w),error:e.readError}),`error`)},[T]);let E=l?.tasks??[],D=new Set(E.map(e=>e.id)),O=e=>E.find(t=>t.id===e)?.group,{columns:k,attentionCount:A}=Ew(C?Ow(C.issues,D.size===0?void 0:e=>D.has(e)):[],e=>O(e)===`waiting-on-you`),ee={backlog:t.column.backlog,in_progress:t.column.inProgress,parked:t.column.parked,done:t.column.done},j=(e,t)=>{let r=e.taskId&&(t===`in_progress`||t===`parked`)?O(e.taskId):void 0,i=r===`waiting-on-you`?n.waitingOnYou:r===`landing`?n.landing:r===`ready-for-review`?n.readyForReview:r===`working`?n.working:null;return r&&i?{label:i,tone:CT[r]??`text-muted`}:null},te=async(t,n,r,i)=>{try{return await e.client.request(t,{repo:C?.repoRoot,...n})}catch(e){return H($(r,{id:String(i),error:rC(e)}),`error`),null}finally{a()}},ne=(e,n)=>te(`issue.setStatus`,{id:e.id,status:n},t.statusFailed,e.id),re=t=>{V.set(null),e.select(t)},M=async(n,r,i)=>{try{let a=await Rw(e.client,{repo:n,issue:r,engine:i.engine,placement:i.placement});for(let e of a.warnings)H($(e.kind===`link`?t.linkFailed:t.statusFailed,{id:String(r.id),error:e.error}),`error`);i.jump?(V.set(null),e.selectWhenListed(a.taskId),a.tabId&&await e.refreshTabsNow(a.taskId).then(()=>e.select(a.taskId,a.tabId))):H($(t.detail.startedBackground,{title:`#${r.id} ${r.title}`}))}catch(e){H(U(e),`error`)}finally{a()}},N=async(e,n)=>{if(!C||n.kind===`create`)return;let r={};n.title!==e.title&&(r.title=n.title),n.body!==e.body&&(r.body=n.body),(r.title!==void 0||r.body!==void 0)&&await te(`issue.update`,{id:e.id,...r},t.updateFailed,e.id),n.status!==e.status&&await ne(e,n.status),n.kind===`open`?re(n.taskId):n.kind===`unlink`?await te(`issue.update`,{id:e.id,task:`none`},t.unlinkFailed,e.id):n.kind===`start`&&await M(C.repoRoot,{...e,...r},n)},ie=t=>{C&&(m(t.id),B.set((0,L.jsx)(ST,{model:e,issue:t,mode:`detail`,engines:s,defaultEngine:c,onOutcome:e=>void N(t,e)})))},ae=()=>{if(!C)return;let n=C.repoRoot,r={id:C.nextId,title:``,status:`open`,created:new Date().toISOString().slice(0,10),body:``};B.set((0,L.jsx)(ST,{model:e,issue:r,mode:`create`,engines:s,defaultEngine:c,onOutcome:i=>{i.kind===`create`&&(async()=>{try{let t=await e.client.request(`issue.create`,{repo:n,title:i.title,body:i.body});if(a(),!i.start)return;let o=t.issues.find(e=>e.id===r.id)??t.issues.reduce((e,t)=>e&&e.id>t.id?e:t,null);o&&await M(n,o,i.start)}catch(e){H($(t.createFailed,{error:rC(e)}),`error`)}})()}}))},oe=()=>{let n=C?.issues.find(e=>e.id===p);if(!C||!n)return;let i=C.repoRoot;B.set((0,L.jsx)(Er,{title:$(t.confirmDelete.title,{id:String(n.id)}),body:$(t.confirmDelete.body,{title:n.title}),confirmLabel:r.confirm,onConfirm:async()=>{try{await e.client.request(`issue.delete`,{repo:i,id:n.id}),m(null)}catch(e){H($(t.deleteFailed,{id:String(n.id),error:rC(e)}),`error`)}finally{a()}}}))},se=e=>{b.length!==0&&(f(b[(S+e+b.length)%b.length]?.repoRoot??null),m(null))},ce=e=>{let t=ww(k,p,e);t!=null&&m(t)},P=e=>k.some(e=>e.issues.length>0)?ce(e):se(e===`left`?-1:1);dC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`r`:return a(),!0;case`Tab`:return se(e.shiftKey?-1:1),!0;case`ArrowUp`:return ce(`up`),!0;case`ArrowDown`:return ce(`down`),!0;case`ArrowRight`:case`l`:return P(`right`),!0;case`ArrowLeft`:case`h`:return P(`left`),!0;case`Enter`:{let e=C?.issues.find(e=>e.id===p);return e&&ie(e),!0}case`n`:return ae(),!0;case`d`:return oe(),!0;default:return!1}});let le=(0,h.useRef)(null);(0,h.useEffect)(()=>{le.current?.querySelector(`[data-issue="${p}"]`)?.scrollIntoView({block:`nearest`})},[p]);let ue=(e,n,r)=>{m(e.id),mn.set({x:n,y:r,items:bT.filter(t=>t!==e.status).map(n=>({label:$(t.menu.setStatus,{status:t.detail.status[n]}),run:()=>void ne(e,n)}))})},de=k.find(e=>e.issues.some(e=>e.id===p))??k.find(e=>e.issues.length>0)??k[0],fe=(e,n=!1)=>{let r=$(t.attention,{count:String(A)});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{children:[ee[e.key],` (`,e.issues.length+e.hiddenCount,`)`]}),e.key===`in_progress`&&A>0&&(0,L.jsx)(`span`,{className:`text-warning`,title:n?r:void 0,children:n?`!${A}`:r})]})},pe=(e,n)=>(0,L.jsxs)(`section`,{className:Zw(!n),children:[n&&(0,L.jsx)(`h2`,{className:Qw(e.key),children:fe(e)}),(0,L.jsxs)(`div`,{className:$w,children:[e.issues.map(t=>(0,L.jsx)(ET,{issue:t,column:e.key,selected:t.id===p,badge:j(t,e.key),onSelect:()=>m(t.id),onOpen:()=>ie(t),onMenu:(e,n)=>ue(t,e,n)},t.id)),e.issues.length===0&&e.hiddenCount===0&&(0,L.jsx)(`p`,{className:`mono text-muted ${eT}`,children:t.columnEmpty}),e.hiddenCount>0&&(0,L.jsx)(`p`,{className:`mono text-muted ${eT}`,children:$(t.more,{count:String(e.hiddenCount)})})]})]},e.key);return(0,L.jsxs)(`div`,{className:`${Gv} ${Vw}`,tabIndex:0,ref:g,children:[(0,L.jsxs)(`div`,{className:`kb-top`,children:[(0,L.jsx)(`h1`,{className:qv,children:t.title}),(0,L.jsx)(`span`,{className:`mono keys-only text-muted`,children:t.hint}),(0,L.jsxs)(`span`,{className:`mono ${Xv}`,children:[(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Zv.kanban}`,disabled:!C,onClick:ae,children:F(`pages.new`)}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Zv.kanban}`,disabled:!C?.issues.some(e=>e.id===p),onClick:oe,children:F(`pages.delete`)})]})]}),o===null?(0,L.jsx)(`p`,{className:`text-muted`,children:t.loading}):C?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:Hw,children:[(0,L.jsxs)(`button`,{type:`button`,className:Uw,onClick:()=>se(1),children:[aC(C.repoRoot,w),b.length>1&&(0,L.jsx)(`span`,{className:`text-muted`,children:` ${S+1}/${b.length}`})]}),!v&&(0,L.jsx)(`span`,{className:`mono text-muted ${Ww}`,children:C.repoRoot}),C.issues.length===0&&!C.readError&&(0,L.jsx)(`span`,{className:`text-muted ${Gw}`,children:t.empty})]}),C.readError?(0,L.jsx)(`p`,{className:`text-error`,children:$(t.readFailed,{error:C.readError})}):v&&de?(0,L.jsxs)(`div`,{className:qw,ref:le,children:[(0,L.jsx)(`div`,{className:`mono ${Jw}`,children:k.map(e=>(0,L.jsx)(`button`,{type:`button`,className:Yw(e.key===de.key),onClick:()=>{let t=e.issues[0];t&&m(t.id)},children:fe(e,!0)},e.key))}),pe(de,!1)]}):(0,L.jsx)(`div`,{className:Kw,ref:le,children:k.map(e=>pe(e,!0))})]}):(0,L.jsx)(`p`,{className:`text-muted`,children:t.noRepos})]})}var AT={title:`Mods`,empty:`No mod is drawing anything.`,emptyHint:`A plugin with a [mod] entry draws its panes here, in the TUI and the web alike.`,keys:`↑↓/tab move · enter press · esc back`,pressFailed:`{plugin}: the press did not reach the mod ({reason})`},jT={title:`Mods`,empty:`当前没有 mod 在绘制内容。`,emptyHint:`声明了 [mod] 的插件会在这里绘制面板,TUI 和 web 显示的是同一份。`,keys:`↑↓/tab 移动 · enter 按下 · esc 返回`,pressFailed:`{plugin}:按键没有送达 mod({reason})`},MT={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-error`,muted:`text-muted`},NT=`flex flex-col gap-3`,PT=`[&_p]:mx-0 [&_p]:my-1`,FT=`rounded-md border-hairline border-line px-3 pt-2 pb-3 font-mono`,IT=`mb-2 text-meta leading-[inherit] text-ink`,LT=(e,t)=>`flex min-w-0 items-start ${e?`[&>form]:flex-[1_1_12em] [&>form]:self-center`:``} ${t?`rounded-sm border-hairline border-line`:``}`,RT=(e,t)=>`whitespace-pre-wrap wrap-anywhere ${e?MT[e]:`text-ink`} ${t?`font-bold`:``}`,zT=(e,t)=>`cursor-pointer rounded-sm border-hairline border-current px-2.5 py-0.5 [font:inherit] font-bold! ${MT[e]} ${t?`bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`:`bg-transparent [&:hover]:bg-[color-mix(in_srgb,currentcolor_18%,transparent)]`}`,BT=`flex min-w-0 max-w-[40em] self-stretch`,VT=`w-full font-mono`,HT=[0,6,12,20];function UT(e){return`mod-${e.kind}:${e.plugin}/${e.pane}/${e.key}`}function WT(e){let[t,n]=(0,h.useState)(e.value??``);return(0,L.jsx)(`form`,{className:BT,onSubmit:r=>{r.preventDefault(),e.onSubmit(t),n(e.value??``)},children:(0,L.jsx)(`input`,{id:e.id,className:`${ln} ${VT}`,spellCheck:!1,value:t,placeholder:e.placeholder,onFocus:e.onFocus,onChange:e=>n(e.target.value)})})}function GT(e){let{node:t}=e;if(t.type===`text`)return(0,L.jsx)(`span`,{className:RT(t.tone,t.bold===!0),children:t.text});if(t.type===`input`){let n={kind:`input`,plugin:e.pane.plugin,pane:e.pane.id,key:t.key};return(0,L.jsx)(WT,{id:UT(n),placeholder:t.placeholder,value:t.value,onFocus:()=>e.onFocus(n),onSubmit:t=>e.onSubmit(n,t)},t.value??``)}if(t.type===`button`){let n={kind:`button`,plugin:e.pane.plugin,pane:e.pane.id,key:t.key};return(0,L.jsx)(`button`,{type:`button`,id:UT(n),className:zT(t.tone??`info`,Hi(n,e.cursor)),onFocus:()=>e.onFocus(n),onClick:()=>e.onPress(n),children:t.label})}return(0,L.jsx)(`div`,{className:LT(t.direction===`row`,t.border===!0),style:{flexDirection:t.direction??`column`,gap:HT[t.gap??0],padding:HT[t.padding??0]},children:t.children.map((t,n)=>(0,L.jsx)(GT,{...e,node:t},n))})}function KT({model:e}){let t=I()===`zh`?jT:AT,n=_(e.mods),r=Vi(n),[i,a]=(0,h.useState)(null),o=Ui(r,i),s=fC(),c=(0,h.useRef)(!1),l=(t,n,r={})=>{a(t),!c.current&&(c.current=!0,e.client.request(n,{plugin:t.plugin,pane:t.pane,key:t.key,...r}).catch(e=>H(e instanceof Error?e.message:String(e),`error`)).finally(()=>{c.current=!1}))},u=e=>l(e,`mod.press`),d=(e,t)=>l(e,`mod.submit`,{value:t}),f=e=>{let t=Wi(r,o,e);a(t),t&&document.getElementById(UT(t))?.focus()};return dC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`ArrowDown`:return f(1),!0;case`ArrowUp`:return f(-1),!0;case`Enter`:return e.target instanceof HTMLButtonElement?!1:(o?.kind===`button`&&u(o),!0);default:return!1}}),(0,L.jsxs)(`div`,{className:`${Kv} ${NT}`,tabIndex:0,ref:s,children:[(0,L.jsxs)(`div`,{className:Jv,children:[(0,L.jsx)(`h1`,{className:qv,children:t.title}),(0,L.jsx)(`span`,{className:`keys-only touch:empty:hidden! text-muted ${Yv(!1)}`,children:t.keys})]}),n.length===0?(0,L.jsxs)(`div`,{className:PT,children:[(0,L.jsx)(`p`,{children:t.empty}),(0,L.jsx)(`p`,{className:`text-muted`,children:t.emptyHint})]}):n.map(e=>(0,L.jsxs)(`section`,{className:FT,children:[(0,L.jsxs)(`header`,{className:IT,children:[e.title,` `,(0,L.jsx)(`span`,{className:`text-muted`,children:e.plugin})]}),(0,L.jsx)(GT,{node:e.tree,pane:e,cursor:o,onPress:u,onSubmit:d,onFocus:a})]},`${e.plugin}/${e.id}`))]})}function qT(e){return e===`dispatch_failed`||e===`skipped_unavailable`||e===`script_failed`}function JT(e,t){return e.response?`responded`:e.status!==`dispatched`&&e.status!==`revived`||e.deliveryStatus===`quiet`?null:e.deliveryStatus===`missing`?`missing`:e.deliveryStatus===`awaiting`?`awaiting`:t-Date.parse(e.at)>72e5?`missing`:`awaiting`}var YT=6e4,XT=3294,ZT=new Map([[`JAN`,1],[`FEB`,2],[`MAR`,3],[`APR`,4],[`MAY`,5],[`JUN`,6],[`JUL`,7],[`AUG`,8],[`SEP`,9],[`OCT`,10],[`NOV`,11],[`DEC`,12]]),QT=new Map([[`SUN`,0],[`MON`,1],[`TUE`,2],[`WED`,3],[`THU`,4],[`FRI`,5],[`SAT`,6]]),$T=256;function eE(e,t,n){let r=e.toUpperCase(),i=t?.get(r);if(i!==void 0)return i;if(!/^\d+$/.test(r))throw Error(`invalid cron ${n}: ${e}`);return Number(r)}function tE(e){let t=new Set;for(let n of e.value.split(`,`)){if(n.length===0)throw Error(`invalid cron ${e.field}: ${e.value}`);let[r,i,...a]=n.split(`/`);if(a.length>0||r===void 0)throw Error(`invalid cron ${e.field}: ${n}`);let o=1;if(i!==void 0&&(!/^\d+$/.test(i)||(o=Number(i),o<1)))throw Error(`invalid cron ${e.field} step: ${n}`);let s,c;if(r===`*`)s=e.min,c=e.max;else if(r.includes(`-`)){let[t,i,...a]=r.split(`-`);if(a.length>0||t===void 0||i===void 0)throw Error(`invalid cron ${e.field} range: ${n}`);s=eE(t,e.names,e.field),c=eE(i,e.names,e.field)}else s=eE(r,e.names,e.field),c=i===void 0?s:e.max;if(s<e.min||c>e.max||s>c)throw Error(`cron ${e.field} out of range: ${n}`);for(let n=s;n<=c;n+=o)t.add(e.normalize?e.normalize(n):n)}return t}function nE(e){if(e.length>$T)throw Error(`cron expression is too long`);let t=e.trim().split(/\s+/).filter(Boolean);if(t.length!==5)throw Error(`cron expression needs 5 fields (minute hour day month weekday), got ${t.length}`);let[n,r,i,a,o]=t;return{minutes:tE({value:n,min:0,max:59,field:`minute`}),hours:tE({value:r,min:0,max:23,field:`hour`}),daysOfMonth:tE({value:i,min:1,max:31,field:`day-of-month`}),months:tE({value:a,min:1,max:12,field:`month`,names:ZT}),daysOfWeek:tE({value:o,min:0,max:7,field:`weekday`,names:QT,normalize:e=>e%7}),dayOfMonthRestricted:!i.startsWith(`*`),dayOfWeekRestricted:!o.startsWith(`*`)}}function rE(e){try{return nE(e),!0}catch{return!1}}function iE(e,t,n){return new Date(e.year,e.month-1,e.day,t,n,0,0).getTime()}function aE(e){let t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function oE(e,t){return aE(new Date(e.year,e.month-1,e.day+t,12,0,0,0).getTime())}function sE(e,t){if(!e.months.has(t.month))return!1;let n=e.daysOfMonth.has(t.day),r=e.daysOfWeek.has(new Date(t.year,t.month-1,t.day).getDay());return e.dayOfMonthRestricted&&e.dayOfWeekRestricted?n||r:n&&r}function cE(e){return e-e%YT}function lE(e,t){return[...e].sort((e,n)=>(e-n)*t)}function uE(e,t){let n=nE(e),r=lE(n.hours,1),i=lE(n.minutes,1),a=new Date(cE(t)+YT),o=aE(a.getTime()),s=a.getHours(),c=a.getMinutes();for(let e=0;e<XT;e++){if(sE(n,o)){for(let e of r)if(!(e<s))for(let n of i){if(e===s&&n<c)continue;let r=iE(o,e,n);if(r>t)return r}}o=oE(o,1),s=0,c=0}throw Error(`cron expression never matches: ${e}`)}var dE=[`minute`,`hour`,`dayOfMonth`,`month`,`dayOfWeek`];function fE(e){let t=e.trim().split(/\s+/).filter(Boolean);return dE.map((e,n)=>t[n]??`*`)}function pE(e){return dE.map((t,n)=>e[n]??`*`).join(` `)}var mE=[`*`,`*/5`,`*/10`,`*/15`,`*/30`,...bE(0,59)],hE=[`*`,`*/2`,`*/3`,`*/4`,`*/6`,`*/12`,...bE(0,23)],gE=[`*`,...bE(1,31)],_E=[`*`,`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`],vE=[`*`,`MON-FRI`,`SAT,SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`],yE=[`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`,`SUN`];function bE(e,t){let n=[];for(let r=e;r<=t;r++)n.push(String(r));return n}var xE={minute:mE,hour:hE,dayOfMonth:gE,month:_E,dayOfWeek:vE};function SE(e,t,n){let r=xE[e],i=r.indexOf(t.trim().toUpperCase());return i<0?(n>0?r[0]:r[r.length-1])??t:r[(i+n+r.length)%r.length]??t}function CE(e,t){return Math.min(Math.max(e+t,0),dE.length-1)}function wE(e,t,n){let r=fE(e);return t<0||t>=dE.length||(r[t]=n),pE(r)}function TE(e,t){let[n,r,i,a,o]=fE(e);if(a!==`*`||i!==`*`||n===void 0||r===void 0||o===void 0)return null;let s=EE(n,r,t);if(!s)return null;let{at:c,bare:l}=s;if(o===`*`)return l?c:t(`automations.schedule.everyDay`,{at:c});if(o===`MON-FRI`)return t(`automations.schedule.weekdays`,{at:c});if(o===`SAT,SUN`)return t(`automations.schedule.weekends`,{at:c});let u=yE.find(e=>e===o.toUpperCase());return u?t(`automations.schedule.onWeekday`,{weekday:t(`automations.schedule.dow.${u}`),at:c}):null}function EE(e,t,n){return t===`*`?e===`*`?{at:n(`automations.schedule.everyMinute`),bare:!0}:e.startsWith(`*/`)?{at:n(`automations.schedule.everyMinutes`,{n:e.slice(2)}),bare:!0}:/^\d+$/.test(e)?{at:n(`automations.schedule.hourlyAt`,{minute:e.padStart(2,`0`)}),bare:!1}:null:t.startsWith(`*/`)&&e===`0`?{at:n(`automations.schedule.everyHours`,{n:t.slice(2)}),bare:!0}:/^\d+$/.test(t)&&/^\d+$/.test(e)?{at:n(`automations.schedule.atClock`,{time:`${t.padStart(2,`0`)}:${e.padStart(2,`0`)}`}),bare:!1}:null}function DE(e,t,n,r){let i=e.trim();if(!rE(i))return{kind:`invalid`};let a;try{a=uE(i,t)}catch{return{kind:`never`}}return{kind:`ok`,nextRunMs:a,relative:OE(a-t,n),absolute:kE(a,t,n,r)}}function OE(e,t){let{minutes:n,hours:r,days:i}=lw(e);return n<60?t(`automations.when.inMinutes`,{n:Math.max(1,n)}):r<24?t(`automations.when.inHours`,{n:r}):t(`automations.when.inDays`,{n:i})}function kE(e,t,n,r){let i=new Date(e),a=`${String(i.getHours()).padStart(2,`0`)}:${String(i.getMinutes()).padStart(2,`0`)}`,o=new Date(t);if(i.getFullYear()===o.getFullYear()&&i.getMonth()===o.getMonth()&&i.getDate()===o.getDate())return a;let s=e-t<5184e5,c=i.toLocaleDateString(r,s?{weekday:`short`}:{weekday:`short`,month:`short`,day:`numeric`});return s?`${c} ${a}`:n(`automations.when.dateTime`,{date:c,time:a})}var AE={name:``,repo:``,prompt:``,schedule:`0 9 * * MON-FRI`};function jE(e){return e.name.trim().length>0&&(e.repo===null||e.repo.trim().length>0)&&e.prompt.trim().length>0&&(!e.target||e.target.taskId.trim().length>0&&/^tab-[\w-]+$/.test(e.target.tabId))&&rE(e.schedule.trim())}function ME(e){return e.name.trim().length===0?`name`:e.repo!==null&&e.repo.trim().length===0?`repo`:e.target&&!e.target.taskId.trim()?`target`:e.target&&!/^tab-[\w-]+$/.test(e.target.tabId)?`targetTab`:e.prompt.trim().length===0?`prompt`:rE(e.schedule.trim())?null:`schedule`}var NE=`flex flex-col overflow-hidden @container`,PE=`mt-2.5 grid min-h-0 flex-1 grid-cols-[minmax(260px,2fr)_minmax(0,3fr)] gap-4 rt-narrow:flex rt-narrow:flex-col rt-narrow:overflow-y-auto`,FE=`flex min-h-0 flex-col gap-3 overflow-y-auto scrollbar-none rt-narrow:shrink-0 rt-narrow:overflow-visible`,IE=`flex gap-1.5 px-2 pt-0 pb-1`,LE=e=>`flex min-w-0 cursor-pointer flex-col gap-0.5 rounded-sm px-2 py-1.5 ${e?`bg-menu`:`[&:hover]:bg-hover`}`,RE=`flex min-w-0 items-baseline gap-2.5`,zE=e=>`min-w-0 flex-1 truncate font-bold ${e?`text-muted`:``}`,BE=`whitespace-nowrap text-meta`,VE=`truncate text-meta`,HE=`flex min-h-0 flex-col gap-1.5 overflow-y-auto py-0 pr-0 pl-4 [border-left:var(--hairline)_solid_var(--line)] [&_h2]:m-0 [&_p]:m-0 [&>*]:shrink-0 [&>h2]:mt-2.5 rt-narrow:shrink-0 rt-narrow:overflow-visible rt-narrow:pt-3 rt-narrow:pl-0 rt-narrow:[border-left:none] rt-narrow:[border-top:var(--hairline)_solid_var(--line)]`,UE=`flex flex-wrap items-baseline justify-between gap-3`,WE=`font-sans text-display font-bold normal-nums wrap-anywhere`,GE=`mx-0 mt-1 mb-0 grid grid-cols-[max-content_minmax(0,1fr)] items-baseline gap-x-3.5 gap-y-1 [&_dd]:m-0 [&_dd]:wrap-anywhere [&_dd_.mono]:whitespace-pre`,KE=`max-h-[12lh] overflow-y-auto rounded-sm bg-inset px-2.5 py-2 whitespace-pre-wrap wrap-anywhere`,qE=`min-w-0 text-meta leading-[inherit]`,JE=`flex w-full min-w-0 gap-2 text-inherit`,YE=JE,XE=`${JE} cursor-pointer border-none bg-transparent p-0 text-left font-[inherit] [&:hover]:underline`,ZE=`min-w-0 flex-1 truncate`,QE=`[&+&]:mt-1.5`,$E=e=>`whitespace-pre-wrap wrap-anywhere text-meta ${e?``:`leading-[inherit]`}`,eD=`text-meta`,tD=`flex gap-4.5`,nD=e=>`flex min-w-[5ch] flex-col gap-0.5 rounded-sm border-hairline px-1.5 py-1 text-left font-mono text-body normal-nums [&>span]:text-meta [&>span]:text-subtle ${e?`border-accent font-bold text-accent`:`border-transparent font-normal`}`,rD=`hidden gap-2 px-1 pt-0.5 pb-1.5 touch:flex`,iD=`h-8 w-11 touch-manipulation rounded-sm border-hairline border-line bg-inset font-mono text-display font-normal normal-nums text-ink`;function aD(e){let{auto:t,common:n}=tC(),r=nC(),i=I()===`zh`?`zh-CN`:`en-US`,[a,o]=(0,h.useState)(()=>({...AE,repo:e.repos.find(t=>e.defaultRepo&&iC(t)===iC(e.defaultRepo))??e.repos[0]??null})),[s,c]=(0,h.useState)(0),[l,u]=(0,h.useState)(null),d=(0,h.useRef)({}),f=e=>t=>{d.current[e]=t};(0,h.useEffect)(()=>d.current.name?.focus(),[]);let p=e=>{o(t=>({...t,...e})),u(null)};(0,h.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),Mn())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]);let m=()=>{if(jE(a)){Mn(),e.onSubmit({name:a.name.trim(),repo:a.repo===null?null:a.repo.trim(),prompt:a.prompt.trim(),schedule:a.schedule.trim(),...a.target?{target:a.target}:{}});return}let n=ME(a);n&&(d.current[n]?.focus(),u(Reflect.get(t.missing,n)))},g=a.repo===null?[]:e.tasks.filter(e=>iC(e.repo)===iC(a.repo??``)),_=a.target?g.findIndex(e=>e.id===a.target?.taskId)+1:0,v=e=>{let t=(_+e+g.length+1)%(g.length+1),n=g[t-1];p({target:n?{kind:`existing-tab`,taskId:n.id,tabId:`tab-1`}:void 0})},y=[null,...e.repos],b=e=>{let t=Math.min(Math.max(y.indexOf(a.repo)+e,0),y.length-1),n=y[t];n!==void 0&&p({repo:n,target:void 0})},x=e=>t=>{(t.key===`ArrowUp`||t.key===`ArrowDown`)&&(t.preventDefault(),e(t.key===`ArrowDown`?1:-1))},S=e=>t=>{t.key===`Enter`&&(t.preventDefault(),d.current[e]?.focus())},C=fE(a.schedule),w=e=>{let t=dE[s];t&&p({schedule:wE(a.schedule,s,SE(t,C[s]??`*`,e))})},T=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`ArrowLeft`||e.key===`h`)c(CE(s,-1));else if(e.key===`ArrowRight`||e.key===`l`)c(CE(s,1));else if(e.key===`ArrowUp`||e.key===`ArrowDown`)w(e.key===`ArrowUp`?1:-1);else return;e.preventDefault()}},E=DE(a.schedule,Date.now(),r,i),D=TE(a.schedule,r);return(0,L.jsx)(`div`,{className:Hn,onMouseDown:e=>e.target===e.currentTarget&&Mn(),children:(0,L.jsxs)(`dialog`,{open:!0,className:`${Un(!0)} ${oT}`,"aria-label":t.newTitle,children:[(0,L.jsx)(`h1`,{className:`${z} text-muted`,children:t.newTitle}),(0,L.jsxs)(`div`,{className:qn,children:[(0,L.jsxs)(`label`,{className:Ln,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.fieldName}),(0,L.jsx)(`input`,{ref:f(`name`),className:ln,spellCheck:!1,placeholder:t.namePlaceholder,value:a.name,onChange:e=>p({name:e.target.value}),onKeyDown:S(`repo`)})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${cT}`,children:[t.fieldRepo,(0,L.jsx)(`span`,{className:`keys-only text-muted ${lT}`,children:`↑/↓`})]}),(0,L.jsx)(yT,{fieldRef:f(`repo`),kind:`list`,label:t.fieldRepo,className:dT,onKeyDown:x(b),children:y.map(t=>(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-selected":t===a.repo,className:`touch:py-1.5 ${fT(t===a.repo)}`,onClick:()=>{p({repo:t,target:void 0}),d.current.repo?.focus()},children:[t===a.repo?`▸ `:` `,t===null?F(`rail.noProject`):aC(t,e.repos)]},t??``))})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${cT}`,children:[t.fieldTarget,(0,L.jsx)(`span`,{className:`keys-only text-muted ${lT}`,children:`↑/↓`})]}),(0,L.jsx)(yT,{fieldRef:f(`target`),kind:`list`,label:t.fieldTarget,onKeyDown:x(v),onClick:()=>v(1),children:a.target?g[_-1]?.title??a.target.taskId:t.targetFresh})]}),a.target&&(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:t.fieldTargetTab}),(0,L.jsx)(`input`,{ref:f(`targetTab`),className:ln,spellCheck:!1,value:a.target.tabId,onChange:e=>a.target&&p({target:{...a.target,tabId:e.target.value}}),onKeyDown:S(`prompt`)})]}),(0,L.jsxs)(`label`,{className:Ln,children:[(0,L.jsx)(`span`,{className:`${z} text-muted`,children:t.fieldPrompt}),(0,L.jsx)(`input`,{ref:f(`prompt`),className:ln,spellCheck:!1,placeholder:t.promptPlaceholder,value:a.prompt,onChange:e=>p({prompt:e.target.value}),onKeyDown:S(`schedule`)})]}),(0,L.jsxs)(`div`,{className:Ln,children:[(0,L.jsxs)(`span`,{className:`${z} text-muted ${cT}`,children:[t.fieldSchedule,(0,L.jsx)(`span`,{className:`keys-only text-muted ${lT}`,children:`←/→ ↑/↓`})]}),(0,L.jsx)(yT,{fieldRef:f(`schedule`),kind:`cells`,label:t.fieldSchedule,className:tD,onKeyDown:T,children:dE.map((e,n)=>(0,L.jsxs)(`button`,{type:`button`,tabIndex:-1,className:nD(n===s),onClick:()=>{c(n),d.current.schedule?.focus()},children:[C[n]??`*`,(0,L.jsx)(`span`,{children:t.cronField[e]})]},e))}),(0,L.jsx)(`div`,{className:rD,children:[-1,1].map(e=>{let n=t.cronField[dE[s]??`minute`]??``;return(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,className:iD,"aria-label":F(e<0?`pages.cronDown`:`pages.cronUp`,{field:n}),onClick:()=>{w(e),d.current.schedule?.focus()},children:e<0?`−`:`+`},e)})}),E.kind===`ok`?(0,L.jsxs)(`p`,{className:`mono text-success`,children:[D?`${D}, `:``,E.relative,`, `,E.absolute]}):(0,L.jsx)(`p`,{className:`mono text-error`,children:E.kind===`never`?t.cronNever:t.cronInvalid})]}),l&&(0,L.jsxs)(`p`,{className:`text-error`,children:[`※ `,l]}),(0,L.jsx)(`p`,{className:`touch:empty:hidden! text-muted ${pT}`,children:(0,L.jsx)(Ld,{text:Yc(t.composerLegend)})}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(`button`,{type:`button`,className:sn,onClick:Mn,children:n.cancel}),(0,L.jsx)(`button`,{ref:f(`confirm`),type:`button`,className:Be(),onClick:m,children:n.create})]})]})]})})}var oD=[`ok`,`blocked`,`failed`,`skipped`];function sD(e){switch(e.status){case`dispatched`:case`revived`:case`ran`:return`ok`;case`skipped_blocked`:return`blocked`;case`dispatch_failed`:case`skipped_unavailable`:case`script_failed`:return`failed`;default:return`skipped`}}var cD={scheduled:`schedule`,manual:`manual`,webhook:`webhook`};function lD(e){if(e.status===`skipped_precheck`)return e.precheckResult?.durationMs??null;if(e.status===`ran`||e.status===`script_failed`)return null;let t=Date.parse(e.at),n=Date.parse(e.response?.at??``);return Number.isFinite(t)&&Number.isFinite(n)&&n>=t?n-t:null}function uD(e){if(e<1e3)return`${Math.max(0,Math.round(e))}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return n%60==0?`${r}h`:`${r}h ${n%60}m`}function dD(e,t,n){return(t===null?Object.values(e).flat():e[t]??[]).filter(e=>n===null||sD(e)===n).sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||t.runNumber-e.runNumber)}function fD(e){let t=e.indexOf(`{`),n=e.lastIndexOf(`}`);if(t<0||n<=t)return null;try{return{prefix:e.slice(0,t).trim(),value:JSON.parse(e.slice(t,n+1))}}catch{return null}}var pD=(e,t)=>e&&typeof e==`object`?Reflect.get(e,t):void 0;function mD(e){let t=fD(e);if(!t)return{summary:e,full:e};let n=pD(t.value,`error`)??t.value,r=pD(n,`message`),i=pD(n,`code`),a=typeof r==`string`?typeof i==`string`?`${i}: ${r}`:r:null,o=t.prefix.replace(/:$/,``);return{summary:a?`${o} — ${a}`:e,full:`${t.prefix}\n${JSON.stringify(t.value,null,2)}`}}function hD(e){let t=e.trim();if(!/^[[{]/.test(t))return e;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}}var gD={dispatched:`success`,revived:`success`,skipped_precheck:`muted`,skipped_blocked:`warning`,skipped_cancelled:`muted`,skipped_missed:`warning`,skipped_unavailable:`warning`,dispatch_failed:`error`,ran:`success`,script_failed:`error`},_D={success:`text-success`,muted:`text-muted`,warning:`text-warning`,error:`text-error`},vD={success:`✓`,error:`†`,warning:`!`,muted:`·`},yD=e=>gD[e]??`muted`;function bD(e){let{auto:t}=tC(),{runs:n,when:r}=e,i=e=>t.runStatus[e]??e,a=n.filter(e=>e.response);return(0,L.jsxs)(L.Fragment,{children:[n[0]?.precheckResult&&(0,L.jsx)(xD,{run:n[0]}),(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:t.responses}),a.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.noResponses}):a.map(e=>(0,L.jsxs)(`div`,{className:QE,children:[(0,L.jsx)(`p`,{className:`mono ${eD} ${_D[yD(e.status)]}`,children:`#${e.runNumber} ${i(e.status)}, ${r(e.response?.at)}`}),(0,L.jsx)(`p`,{className:$E(!1),children:hD(e.response?.text??``)})]},e.id))]})}function xD({run:e}){let{auto:t}=tC(),n=e.precheckResult;if(!n)return null;let r=n.timedOut?t.precheckTimedOut:$(t.precheckExited,{code:String(n.exitCode??`?`)}),i=[{label:t.precheckStdout,text:n.stdout},{label:t.precheckStderr,text:n.stderr}].filter(e=>e.text.trim().length>0);return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:$(t.precheckDetail,{exit:r,duration:String(n.durationMs)})}),i.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.precheckNoOutput}):i.map(e=>(0,L.jsx)(`p`,{className:`mono ${$E(!0)}`,children:`${e.label}: ${e.text.replace(/\s+$/,``).split(`
|
|
39
39
|
`).slice(-10).join(`
|
|
40
40
|
`)}`},e.label))]})}var SD=30;function CD(e,t,n){let r=t.join(`\0`),[i,a]=(0,h.useState)(()=>Object.fromEntries(t.map(t=>[t,q(e,`routine.runs`,{id:t})?.runs??[]])));return(0,h.useEffect)(()=>{let n=!0;for(let r of t)El(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 wD(e){I();let{auto:t}=tC(),[n,r]=(0,h.useState)(null),[i,a]=(0,h.useState)(null);(0,h.useEffect)(()=>r(null),[e.followId]);let o=n===null?e.followId??``:n,s=o===``?e.routines.map(e=>e.id):[o],c=CD(e.c,s,e.tick),l=new Map(e.routines.map(e=>[e.id,e.name])),u=dD(c,o===``?null:o,i),d=e=>{if(e.status===`skipped_blocked`){let t=e.blocked?.reason;return t?$(F(`runLog.blockedRun`),{reason:F(`runLog.blocked.${t}`)}):F(`runLog.outcome.blocked`)}return t.runStatus[e.status]??e.status},f=(e,t,n,r)=>(0,L.jsx)(R,{variant:`pill`,hit:`tight`,"aria-current":t,className:`max-w-40 truncate`,onClick:n,children:`[ ${e} ]`},r);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:F(`runLog.title`)}),e.routines.length>1&&(0,L.jsx)(e_,{label:F(`runLog.routine`),value:o,picks:[{value:``,label:F(`runLog.allRoutines`)},...e.routines.map(e=>({value:e.id,label:e.name}))],onPick:r}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[f(F(`runLog.all`),i===null,()=>a(null),`all`),oD.map(e=>f(F(`runLog.outcome.${e}`),i===e,()=>a(e),e))]}),u.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:dD(c,o===``?null:o,null).length===0?t.noRuns:F(`runLog.empty`)}):u.slice(0,SD).map(n=>{let r=yD(n.status),i=JT(n,e.now),a=i===`awaiting`?`, ${t.responseAwaiting}`:i===`missing`?`, ${t.responseMissing}`:``,s=lD(n),c=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{children:vD[r]}),(0,L.jsx)(`span`,{children:`#${n.runNumber}`}),o===``&&(0,L.jsx)(`span`,{className:`max-w-[20ch] truncate`,children:l.get(n.automationId)??``}),(0,L.jsx)(`span`,{className:ZE,children:`${d(n)}${n.tabId?`, ${n.tabId}`:``}${a}`}),(0,L.jsx)(`span`,{className:`text-subtle`,children:F(`runLog.source.${cD[n.trigger]}`)}),s!==null&&(0,L.jsx)(`span`,{className:`text-muted`,children:uD(s)}),(0,L.jsx)(`span`,{className:`text-muted`,children:e.when(n.at)})]}),u=n.error?mD(n.error):null,f=n.taskId,p=i===`missing`?`text-warning`:_D[r];return(0,L.jsxs)(`div`,{className:`${qE} ${p}`,children:[f?(0,L.jsx)(`button`,{type:`button`,className:`mono ${XE}`,onClick:()=>e.openRun(f),children:c}):(0,L.jsx)(`span`,{className:`mono ${YE}`,children:c}),u&&(0,L.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,L.jsx)(`summary`,{children:u.summary}),(0,L.jsx)(`pre`,{children:u.full})]})]},n.id)}),u.length>SD&&(0,L.jsx)(`p`,{className:`text-muted`,children:F(`runLog.more`,{count:u.length-SD})})]})}var TD=5e3;function ED({model:e}){let{auto:t,common:n}=tC(),r=e.client,[i,a]=lC(TD),o=_(e.tasks),s=sC(e),c=cC(e),[l,u]=(0,h.useState)(()=>q(r,`routine.list`)??null),[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)(null),[g,v]=(0,h.useState)(null),y=fC(),b=nC(),x=I()===`zh`?`zh-CN`:`en-US`,S=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!0;return El(r,`routine.list`).then(t=>e&&u(t)).catch(()=>e&&u(e=>e??{automations:[],keepsDaemonAlive:!1})),()=>{e=!1}},[r,i]);let C=l?.automations??[],w=l?.lastRunStatus??{},T=l?.lastFailure??{},E=e=>{let t=w[e.id];return t!==void 0&&qT(t)},D=[{key:`pages.routinesNeedYou`,rows:C.filter(E)},{key:`pages.routinesActive`,rows:C.filter(e=>e.enabled&&!E(e))},{key:`pages.routinesPaused`,rows:C.filter(e=>!e.enabled&&!E(e))}],O=D.flatMap(e=>e.rows),k=Math.max(0,O.findIndex(e=>e.id===d)),A=O[k],ee=e=>f(O[e]?.id??null),j=D[0]?.rows.length??0,te=_(_n);(0,h.useEffect)(()=>{te===null||!l||(l.automations.some(e=>e.id===te)&&f(te),_n.set(null))},[te,l]);let ne=CD(r,A?[A.id]:[],i),re=A?ne[A.id]??[]:[];(0,h.useEffect)(()=>v(null),[A?.id]);let M=(0,h.useRef)(null),[N,ie]=(0,h.useState)(0),ae=(0,h.useRef)(0);(0,h.useEffect)(()=>{let e=S.current,t=N!==ae.current;if(ae.current=N,t&&e&&M.current&&e.offsetTop>M.current.offsetTop){e.scrollIntoView({block:`start`,behavior:`smooth`});return}M.current?.querySelector(`[data-row="${k}"]`)?.scrollIntoView({block:`nearest`})},[k,N]);let oe=Date.now(),se=e=>{let n=e?Date.parse(e):NaN;if(!Number.isFinite(n))return`—`;let r=n-oe,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()},ce=e=>o?.tasks.find(t=>t.id===e)?.label??e,P=t=>{V.set(null),e.select(t)},le=(e,t,n)=>H($(e,{name:t,error:rC(n)}),`error`),ue=async()=>{if(!(!A||p)){m(A.id);try{await r.request(`routine.setEnabled`,{id:A.id,enabled:!A.enabled}),a()}catch(e){le(A.enabled?t.disableFailed:t.enableFailed,A.name,e)}finally{m(null)}}},de=async()=>{if(!(!A||p)){m(A.id),v($(t.running,{name:A.name}));try{let e=await r.request(`routine.runNow`,{id:A.id});v($(t.ranWith,{name:A.name,status:e.status})),a()}catch(e){le(t.runFailed,A.name,e)}finally{m(null)}}},fe=async()=>{if(p)return;let e=oC(await r.request(`repos.list`).then(e=>e.repos).catch(()=>[]),s);B.set((0,L.jsx)(aD,{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){H($(t.createFailed,{error:rC(e)}),`error`)}finally{m(null)}})()}}))},pe=()=>{if(!A||p)return;let e=A;B.set((0,L.jsx)(Er,{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){le(t.deleteFailed,e.name,n)}finally{m(null)}}}))};dC(e=>{if(e.ctrlKey)return e.key===`c`&&(V.set(null),!0);switch(e.key){case`Escape`:case`q`:return V.set(null),!0;case`j`:case`ArrowDown`:return ee(Math.min(O.length-1,k+1)),!0;case`k`:case`ArrowUp`:return ee(Math.max(0,k-1)),!0;case`n`:return fe(),!0;case`r`:return a(),!0;case`e`:return ue(),!0;case`s`:return de(),!0;case`d`:return pe(),!0;case`Enter`:{let e=re[0]?.taskId;return e?P(e):re.length>0&&v(t.latestRunNoTask),!0}default:return!1}});let me=A?.target,he=A?TE(A.schedule,b):null,ge=e=>e===void 0?F(`rail.noProject`):aC(e,C.flatMap(e=>e.repo??[])),_e=A?.nextRunAt?Date.parse(A.nextRunAt):NaN;return(0,L.jsxs)(`div`,{className:`${Gv} ${NE}`,tabIndex:0,ref:y,children:[(0,L.jsxs)(`div`,{className:Jv,children:[(0,L.jsx)(`h1`,{className:qv,children:t.title}),(0,L.jsxs)(`span`,{className:`mono ${Xv}`,children:[j>0&&(0,L.jsx)(`span`,{className:`text-error`,children:$(t.needAttention,{count:String(j),total:String(O.length)})}),(0,L.jsx)(`span`,{className:`text-muted`,children:l?.keepsDaemonAlive?t.holdingDaemon:t.notHolding}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Zv.header}`,onClick:()=>void fe(),children:F(`pages.new`)})]})]}),l===null?(0,L.jsx)(`p`,{className:`text-muted`,children:n.loading}):O.length===0?(0,L.jsxs)(`div`,{className:Qv,children:[(0,L.jsx)(`p`,{className:`text-muted`,children:t.empty}),(0,L.jsx)(`p`,{className:`keys-only`,children:t.emptyHint})]}):(0,L.jsxs)(`div`,{className:PE,children:[(0,L.jsx)(`div`,{className:FE,ref:M,children:D.map(e=>e.rows.length===0?null:(0,L.jsxs)(`section`,{children:[(0,L.jsxs)(`h2`,{className:`${z} ${IE} ${e===D[0]?`text-error`:`text-muted`}`,children:[F(e.key),` `,(0,L.jsx)(`span`,{className:`mono`,children:e.rows.length})]}),e.rows.map(e=>{let n=O.indexOf(e),r=w[e.id],i=r?yD(r):null;return(0,L.jsxs)(`div`,{"data-row":n,className:LE(n===k),onClick:()=>{ee(n),ie(e=>e+1)},children:[(0,L.jsxs)(`span`,{className:RE,children:[(0,L.jsx)(`span`,{className:zE(!e.enabled),children:e.name}),(0,L.jsx)(`span`,{className:`mono text-muted ${BE}`,children:e.enabled?se(e.nextRunAt):t.paused}),(0,L.jsx)(`span`,{className:`mono ${i?_D[i]:`text-muted`}`,style:{width:`1ch`},children:i?vD[i]:` `})]}),(0,L.jsx)(`span`,{className:`mono text-muted ${VE}`,title:e.schedule,children:`${ge(e.repo)} · ${TE(e.schedule,b)??e.schedule}`}),T[e.id]?(0,L.jsx)(`span`,{className:`mono text-warning ${VE}`,title:T[e.id]?.reason,children:$(t.lastFailed,{when:se(T[e.id]?.at),reason:T[e.id]?.reason??``})}):null]},e.id)})]},e.key))}),(0,L.jsx)(`div`,{className:HE,ref:S,children:A?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:UE,children:[(0,L.jsx)(`h2`,{className:WE,children:A.name}),(0,L.jsxs)(`span`,{className:`mono ${Xv}`,children:[(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Zv.row}`,disabled:p===A.id,onClick:()=>void de(),children:t.runNow}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Zv.row}`,disabled:p===A.id,onClick:()=>void ue(),children:F(A.enabled?`pages.routinePause`:`pages.routineEnable`)}),(0,L.jsx)(`button`,{type:`button`,className:`${sn} ${Zv.row}`,disabled:p===A.id,onClick:pe,children:F(`pages.delete`)})]})]}),(0,L.jsxs)(`dl`,{className:GE,children:[(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineSchedule`)}),(0,L.jsxs)(`dd`,{children:[he??(0,L.jsx)(`span`,{className:`mono`,children:A.schedule}),he&&(0,L.jsx)(`span`,{className:`mono text-muted`,children:` ${A.schedule}`})]}),(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineNext`)}),(0,L.jsx)(`dd`,{className:A.enabled?``:`text-warning`,children:A.enabled?Number.isFinite(_e)?`${se(A.nextRunAt)} · ${new Date(_e).toLocaleString(x,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}`:`—`:t.paused}),(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineProject`)}),(0,L.jsx)(`dd`,{children:ge(A.repo)}),!A.script&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:`text-muted`,children:F(`pages.routineDelivers`)}),(0,L.jsx)(`dd`,{children:me?$(t.targetExisting,{task:ce(me.taskId),tab:me.tabId}):A.persistentSession?t.targetStanding:t.targetFresh})]})]}),A.precheck&&(0,L.jsx)(`p`,{className:`mono text-muted`,children:$(t.precheck,{command:A.precheck.command})}),A.script?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:F(`pages.routineScript`)}),(0,L.jsx)(`p`,{className:`mono ${KE}`,children:A.script.command})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted`,children:F(`pages.routinePrompt`)}),(0,L.jsx)(`p`,{className:KE,children:A.prompt})]}),(0,L.jsx)(wD,{c:r,tick:i,routines:C,followId:A.id,now:oe,when:se,openRun:P}),(0,L.jsx)(bD,{runs:re,when:se})]}):(0,L.jsx)(`p`,{className:`text-muted`,children:t.noSelection})})]}),g&&(0,L.jsx)(`p`,{className:`text-muted mx-0 mt-2 mb-0 text-meta leading-[inherit]`,children:g})]})}var DD=`flex min-w-0 items-baseline gap-2.5 font-mono text-meta whitespace-nowrap`,OD=`${DD} w-full cursor-pointer border-none bg-transparent p-0 text-left text-inherit [font:inherit] [&:hover]:underline`,kD=`w-[5ch] flex-none text-muted`,AD=`w-[16ch] flex-none overflow-hidden text-accent`,jD=`mt-3.5 mb-0.5`,MD=`min-w-0 flex-1 truncate`,ND=`flex-none text-right text-muted`,PD=`${ND} min-w-[5ch]`,FD=`${ND} min-w-[4ch]`,ID=`${ND} min-w-[5ch]`,LD=`w-[8ch] flex-none overflow-hidden text-accent`,RD=`flex flex-wrap gap-x-3 font-mono text-meta text-muted`,zD=`m-0 text-meta text-muted`,BD={turns:0,tokens:0,ms:0},VD=e=>(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0),HD=e=>Math.max(0,e.endedAt-e.startedAt),UD=(e,t)=>({turns:e.turns+1,tokens:e.tokens+VD(t),ms:e.ms+HD(t)});function WD(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function GD(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(WD(n.getTime()))}let a=new Map(i.map(e=>[e,{sum:BD,byEngine:{}}]));for(let t of e){let e=a.get(WD(t.startedAt));if(!e)continue;let n=t.vendor??`unknown`;e.sum=UD(e.sum,t),e.byEngine[n]=(e.byEngine[n]??0)+VD(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:WD(o)}:null;return{cutoff:s,days:i.map(e=>{let t=a.get(e);return{day:e,...t?.sum??BD,byEngine:t?.byEngine??{},partial:s!==null&&e<=s.day}})}}function KD(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,...UD(t.get(i)??BD,n)})}return[...t.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns)}function qD(e,t){let n=new Map;for(let t of e)n.set(t.taskId,{taskId:t.taskId,...UD(n.get(t.taskId)??BD,t)});return[...n.values()].sort((e,t)=>t.tokens-e.tokens||t.turns-e.turns).slice(0,t)}function JD(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 YD=[``,`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`];function XD(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))}${YD[r%8]}`}var ZD=[`█`,`▓`,`▒`,`░`];function QD(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(ZD[i%ZD.length]??`█`).repeat(o)}).join(``)}var $D=.1,eO=/^(\d+)\s*(h|d)$/;function tO(e,t){let n=eO.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*$D)||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 nO=14,rO=500,iO=3e4,aO=16,oO=8,sO=8;function cO(e,t,n,r){let i=q(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 El(e,t,n).then(e=>r&&o({kind:`ready`,value:e})).catch(e=>r&&o(t=>t.kind===`ready`?t:{kind:`failed`,error:rC(e)})),()=>{r=!1}},[e,t,s,r]),a}var lO=e=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`${PD}`,children:JD(e.tokens)}),(0,L.jsx)(`span`,{className:`${FD}`,children:`${e.turns}t`}),(0,L.jsx)(`span`,{className:`${ID}`,children:uD(e.ms)})]});function uO({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=tO(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:$(F(`usage.full`),{...i,time:o})}}return{key:`${e.vendor}:${r.kind}`,text:$(F(a?`usage.lasts`:`usage.window`),i)}}));return r.length===0?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted ${jD}`,children:F(`usage.quota`)}),r.map(e=>(0,L.jsx)(`p`,{className:`mono ${zD}`,children:e.text},e.key))]})}function dO({row:e,title:t,open:n}){let r=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:MD,children:t}),lO(e)]});return n?(0,L.jsx)(R,{variant:`row`,className:OD,onClick:n,children:r}):(0,L.jsx)(`div`,{className:DD,children:r})}function fO({model:e}){I();let t=fC(),[n]=lC(iO),r=cO(e,`turns.list`,{sinceDays:nO,limit:rO},n),i=cO(e,`engines.list`,{},n),a=cO(e,`usage.get`,{},n),o=_(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??F(`usage.removedTask`);return(0,L.jsxs)(`div`,{className:Kv,tabIndex:0,ref:t,onKeyDown:e=>{e.metaKey||e.ctrlKey||e.altKey||e.key!==`q`&&e.key!==`Escape`||(e.preventDefault(),V.set(null))},children:[(0,L.jsx)(`h1`,{className:qv,children:F(`usage.title`)}),(()=>{if(r.kind===`loading`)return(0,L.jsx)(`p`,{className:`text-muted`,children:F(`usage.loading`)});if(r.kind===`failed`)return(0,L.jsx)(`p`,{className:`text-error`,children:$(F(`usage.failed`),{error:r.error})});let t=r.value.turns,n=new Set(r.value.readers??[]),i=GD(t,Date.now(),nO,rO),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=KD(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,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:zD,children:$(F(`usage.range`),{days:nO})}),t.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:F(`usage.empty`)}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`${z} text-muted ${jD}`,children:F(`usage.perDay`)}),(0,L.jsx)(`div`,{className:RD,children:u.map((e,t)=>(0,L.jsx)(`span`,{children:`${ZD[t%ZD.length]} ${c(e)}`},e))}),i.days.map(e=>(0,L.jsxs)(`div`,{className:DD,children:[(0,L.jsx)(`span`,{className:kD,children:`${e.day.slice(5)}${e.partial?`~`:``}`}),(0,L.jsx)(`span`,{className:AD,children:QD(e.byEngine,u,d,aO)}),lO(e)]},e.day)),i.cutoff&&(0,L.jsx)(`p`,{className:`m-0 text-meta text-muted`,children:$(F(`usage.cutoff`),{count:i.cutoff.count,day:i.cutoff.day.slice(5)})}),(0,L.jsx)(`h2`,{className:`${z} text-muted ${jD}`,children:F(`usage.byModel`)}),f.map(e=>(0,L.jsxs)(`div`,{className:DD,children:[(0,L.jsx)(`span`,{className:MD,title:`${c(e.engine)} · ${e.model}`,children:`${c(e.engine)} · ${e.model}`}),(0,L.jsx)(`span`,{className:LD,children:XD(e.tokens,p,oO)}),lO(e)]},`${e.engine}\0${e.model}`)),(0,L.jsx)(`h2`,{className:`${z} text-muted ${jD}`,children:F(`usage.topTasks`)}),qD(t,sO).map(t=>(0,L.jsx)(dO,{row:t,title:l(t.taskId),open:o?.tasks.some(e=>e.id===t.taskId)?()=>{V.set(null),e.select(t.taskId)}:null},t.taskId))]}),m.length>0&&(0,L.jsx)(`p`,{className:`m-0 text-meta text-muted`,children:$(F(`usage.noReader`),{engines:m.map(c).join(`, `)})}),a.kind===`ready`&&a.value.usage&&(0,L.jsx)(uO,{usage:a.value.usage,nameOf:c})]})})()]})}var pO={id:`mods`,label:`mods`},mO=[{id:`kanban`,label:`kanban`,mod:`kanban`},{id:`routines`,label:`automations`},{id:`issues`,label:`issues`,mod:`issues`}];function hO({model:e}){let{nav:t}=tC(),n=_(V),r=_(e.mods).length>0,i=_(e.installedMods),a=[...mO.filter(e=>!e.mod||i.has(e.mod)),...r?[pO]:[]];return(0,L.jsxs)(`div`,{className:iy,children:[(0,L.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${sy(!1)}`,onClick:()=>Eh(),children:[F(`rail.newTask`),(0,L.jsx)(`span`,{className:cy,"aria-hidden":`true`,children:`+`})]}),a.map(e=>(0,L.jsx)(`button`,{type:`button`,className:`rail-nav-row ${sy(n===e.id)}`,"aria-current":n===e.id?`page`:void 0,onClick:()=>Ha(e.id),children:t[e.label]},e.id))]})}function gO({model:e,page:t}){(0,h.useEffect)(()=>e.selection.subscribe(()=>V.set(null)),[e]);let n=_(e.installedMods);return t===`kanban`&&n.has(`kanban`)?(0,L.jsx)(kT,{model:e}):t===`routines`?(0,L.jsx)(ED,{model:e}):t===`issues`&&n.has(`issues`)?(0,L.jsx)(bw,{model:e}):t===`mods`?(0,L.jsx)(KT,{model:e}):t===`compare`?(0,L.jsx)(cw,{model:e}):t===`usage`?(0,L.jsx)(fO,{model:e}):null}var _O=f();function vO(e){return e?.match(/^https?:\/\/[^/]+\/([^/]+\/[^/]+)\/(?:pull|merge_requests|-\/merge_requests)\//)?.[1]}var yO=e=>e.charAt(0).toUpperCase()+e.slice(1);function bO(e){return[F(`rail.pr.state.${e.state}`),...e.checks?[F(`rail.pr.checks.${e.checks}`)]:[]].join(`, `)}function xO(e){let t=new Map;for(let n of e){let e=xC(n),r=[...e&&n.pr?[{pr:n.pr,mark:e}]:[],...(n.sessionPrs??[]).flatMap(e=>{let t=SC(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&&CC([a.mark,i])!==a.mark)&&t.set(r,{task:n,pr:e,mark:i})}}return[...t.values()]}function SO({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=Kc();(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=xO(e),p=CC(f.map(e=>e.mark));if(!p)return null;let m=f.length===1?`PR #${f[0]?.pr.number??``}, ${bO(p)}`:F(`rail.pr.many`,{count:f.length});return(0,L.jsxs)(`span`,{ref:o,className:`chip ${uf} ${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,L.jsx)(`span`,{className:`font-sans`,children:f.length}),n&&(0,_O.createPortal)((0,L.jsx)(`div`,{ref:c,className:df(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=vO(t?.url),i=t?.additions!==void 0&&t.deletions!==void 0;return(0,L.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,L.jsx)(`span`,{className:`truncate font-semibold text-ink`,children:t.title||e.label}),(0,L.jsxs)(`span`,{className:`flex items-baseline gap-0 text-meta leading-[inherit] whitespace-nowrap`,children:[(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.25 ${n.tone}`,children:[(0,L.jsx)(`span`,{className:`font-mono`,children:n.glyph}),yO(F(`rail.pr.state.${n.state}`))]}),(0,L.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-pre text-muted`,children:[...n.checks?[F(`rail.pr.checks.${n.checks}`)]:[],[r,t?.number===void 0?``:`#${t.number}`].filter(Boolean).join(` `)].filter(Boolean).map(e=>`, ${e}`).join(``)}),i&&(0,L.jsxs)(`span`,{className:`ml-auto flex gap-1.5 pl-3 tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,L.jsxs)(`span`,{className:`text-error`,children:[`−`,t.deletions]})]})]})]},t.url??`${e.id}#${t.number??``}`)})}),document.body)]})}var CO=`~archived`;function wO(e,t,n,r){let i=t.filter(e=>!e.routine);if(i.length===0)return e;let a={id:CO,kind:`archived`,count:i.length,expanded:n};if(!n)return[...e,a];let o=mu([{repo:``,label:``,key:CO,tasks:i}],``,r,1,!1);return[...e,a,...o.filter(e=>e.kind!==`project`)]}function TO(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 EO(e,t,n,r){let i=TO(e,t,n);return i===null?null:r===`above`&&i>0?i-1:r===`below`&&i<0?i+1:i}function DO(e,t){return e.id===t.id?!1:e.kind===`main`?t.kind===`main`:t.kind!==`main`&&t.repo===e.repo}function OO(e,t,n,r,i){if(!DO(t,n))return null;if(t.kind===`main`){let i=EO(e,t,n,r);return i?{steps:i}:null}let a=n.pinned===!0||i&&r===`above`,o={...t,pinned:a},s=a===(n.pinned===!0)?EO(e.map(e=>e.id===t.id?o:e),o,n,r)??0:0,c=a===(t.pinned===!0)?{}:{pin:a};return`pin`in c||s!==0?{...c,steps:s}:null}var kO=e=>e===void 0||e.kind===`project`||e.kind===`state`?0:e.kind===`task`||e.kind===`pane`||e.kind===`round`?e.depth:1;function AO(e,t){let n=kO(e[t]),r=t+1;for(;r<e.length&&kO(e[r])>n;)r++;return r}function jO(e,t,n){let r=e.findIndex(e=>e.id===t),i=r<0?e:[...e.slice(0,r),...e.slice(AO(e,r))];for(let e=i.findIndex(e=>e.id===n)-1;e>=0;e--){let t=i[e];if(!t||t.kind===`project`||t.kind===`state`)return!0;if(t.kind===`task`&&t.depth===1&&t.task.kind!==`main`||t.kind===`round`&&t.depth===1)return!1}return!1}function MO(e,t){let n=kO(e[t]),r=[];for(let i=2;i<=n;i++){let a=t+1;for(;a<e.length&&kO(e[a])>i;)a++;let o=a<e.length&&kO(e[a])===i;r.push(i===n?o?`tee`:`elbow`:o?`pipe`:`blank`)}return r}function NO(e,t,n,r){let i=e.findIndex(e=>e.id===t);if(i<0||t===n)return e;let a=AO(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:AO(s,c);return[...s.slice(0,l),...o,...s.slice(l)]}var PO={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`};function FO(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}],PO):t!==e.offsetTop&&e.animate([{transform:`translateY(${t-e.offsetTop}px)`},{transform:`none`}],PO)}})}var IO=null,LO=()=>(IO||(IO=new Image,IO.src=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`),IO);function RO(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);FO(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&&!au(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(LO(),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,AO(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&&!DO(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),Xd(`default`),H(W(`tasks`,`sort.label`,{mode:W(`tasks`,`sort.modes.default`)}))};let s=()=>c(o.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=>H(W(`tasks`,`toast.moveFailed`,{error:e instanceof Error?e.message:String(e)}),`error`)).finally(s);return}let u=OO(t,i.from,i.to,i.side,jO(m.current,i.fromRow,i.toRow));u?rf(e,i.from.id,u).finally(s):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=>{m.current=i?NO(e,i.fromRow,i.toRow,i.side):e;let t=new Map;if(!i)return t;let n=Math.min(...[...g.current.values()].map(e=>e.top)),r=e=>e.kind===`project`||e.kind===`state`,a=Math.max(0,...e.filter(r).map(e=>g.current.get(e.id)?.gap??0));for(let[e,i]of m.current.entries()){let o=g.current.get(i.id);if(!o)return new Map;e>0&&(n+=r(i)?a:o.gap),n!==o.top&&t.set(i.id,n-o.top),n+=o.height}return t};return{props:x,body:C,dragging:i?.fromRow??null,places:e=>{let t=T(e),n=i?e.findIndex(e=>e.id===i.fromRow):-1,r=new Set(n<0?[]:e.slice(n,AO(e,n)).map(e=>e.id));return e=>{let n=t.get(e.id);return{"data-row":e.id,...r.has(e.id)?{"data-lifted":``}:{},...n?{style:{transform:`translateY(${n}px)`}}:{}}}}}}function zO({model:e,narrow:t,onSettings:n}){I();let r=_(xb),i=Q(`engines.skill.bannerHintWeb`,{engines:r.join(`, `)});return(0,L.jsxs)(`div`,{className:ay,children:[!t&&(0,L.jsx)(Ax,{client:e.client}),(0,L.jsxs)(`div`,{className:oy,children:[(0,L.jsxs)(`button`,{type:`button`,className:`rail-nav-row ${sy(!1)}`,onClick:n,children:[(0,L.jsxs)(`svg`,{className:ly,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,L.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,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),(0,L.jsx)(`span`,{children:F(`rail.settings`)}),r.length>0&&(0,L.jsx)(`span`,{className:`ml-2 min-w-0 truncate text-meta text-subtle`,title:i,children:F(`rail.skillCue`)})]}),(0,L.jsx)(wS,{model:e,bindingId:`settings.open`})]})]})}function BO(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 VO=`rove.web.rail.shownMains`;function HO(){try{let e=JSON.parse(localStorage.getItem(VO)??`[]`);return Array.isArray(e)?Object.fromEntries(e.map(e=>[String(e),[null]])):{}}catch{return{}}}function UO(e,t){try{let n=e.filter(e=>e.kind===`main`&&(t[e.id]?.length??0)>0).map(e=>e.id);localStorage.setItem(VO,JSON.stringify(n))}catch{}}function WO(e,t,n){return(0,h.useEffect)(()=>{n&&UO(e,t)},[n,e,t]),(0,h.useMemo)(()=>n?t:{...HO(),...t},[n,t])}var GO=g({});function KO(e,t,n){let r=GO.get()[`${e}::${t.id}`];return r&&r.sig===Eu(n)&&yu(n.root).some(e=>e.id===r.leaf)?r.leaf:n.activeLeafId}function qO(e,t,n,r){GO.set({...GO.get(),[`${e}::${t}`]:{sig:Eu(n),leaf:r}})}function JO(e,t,n,r){qO(e,t.id,n,r),ja(Dl(e,t.id,r))?.focus()}function YO(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 XO(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){H(e instanceof Error?e.message:String(e),`error`)}}function ZO(e,t,n,r,i){let a=i??(n.split?KO(t,n,n.split):`leaf-1`),o=e.selection.get();(o.taskId!==t||o.tabId!==n.id)&&e.select(t,n.id);let s=ja(Dl(t,n.id,a))?.size();XO(e,{taskId:t,tabId:n.id,action:`open`,direction:r,leafId:a,...s},e=>{e.changed?e.split&&qO(t,n.id,e.split,e.leaf):H(F(`layout.splitTooSmall`),`error`)})}function QO(e,t,n,r){let i=n.split,a=i?KO(t,n,i):r,o=()=>XO(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);qO(t,n.id,i,o?a:i.activeLeafId)});if(!i||!wu(n,i,r)){o();return}B.set((0,L.jsx)(Er,{title:F(`confirm.closePaneTitle`,{pane:Cu(i,_u(n)).get(r)??r}),body:F(`confirm.closePaneBody`),confirmLabel:F(`menu.closePane`),onConfirm:o}))}function $O(e,t,n,r){let i=n.split;i&&B.set((0,L.jsx)(Tr,{title:uc(`split.renameTitle`),initial:Cu(i,_u(n)).get(r)??``,allowEmpty:!0,submitLabel:F(`dialog.save`),onSubmit:i=>XO(e,{taskId:t,tabId:n.id,action:`rename`,leafId:r,title:i})}))}function ek(e,t,n,r){return[{label:F(`menu.renamePane`),section:`split`,key:Gs(`workspace.split.rename`)??void 0,run:()=>$O(e,t,n,r)},{label:F(`menu.closePane`),section:`split`,key:xi(`workspace.split.close`)||void 0,run:()=>QO(e,t,n,r)}]}function tk(e,t,n,r){return[{label:F(`menu.splitRight`),section:`split`,key:Gs(`workspace.split.right`)??void 0,run:()=>ZO(e,t,n,`right`,r)},{label:F(`menu.splitDown`),section:`split`,key:Gs(`workspace.split.down`)??void 0,run:()=>ZO(e,t,n,`down`,r)}]}function nk(e,t,n,r){let i=n.split,a=r??(i?KO(t,n,i):`leaf-1`);return[...tk(e,t,n,a),...bu(i)?ek(e,t,n,a):[]]}function rk(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)??ua(n);return!i||!Tu(i)?[]:tk(e,t,i,i.split?KO(t,i,i.split):`leaf-1`)}function ik(e,{task:t,tab:n,leaf:r}){n.split&&JO(t.id,n,n.split,r),e.select(t.id,n.id)}function ak(e){let{row:t}=e,n=_(e.model.selection);_(GO);let r=n.taskId===t.task.id&&n.tabId===t.tab.id&&!!t.tab.split&&KO(t.task.id,t.tab,t.tab.split)===t.leaf;return(0,L.jsxs)(`button`,{type:`button`,className:`${gr({size:`pane`})} ${e.cursor?vf:``}`,"aria-current":r||void 0,onClick:e.onClick,onContextMenu:e.onMenu,...e.place,children:[(0,L.jsx)(`span`,{className:af,"aria-hidden":`true`,children:e.guides?.map((e,t)=>(0,L.jsx)(`span`,{className:cf(e)},t))}),(0,L.jsx)(`span`,{className:`${_r} text-(length:--fs-meta) ${r?`text-ink`:`text-muted`}`,children:t.label})]})}function ok(e,t){let n=t?.trim()??``;return n&&e?.effortLevels?.includes(n)?n:``}function sk({model:e,taskId:t}){let[n,r]=(0,h.useState)([]),[i,a]=(0,h.useState)({}),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)(``),[u,d]=(0,h.useState)(``),[f,p]=(0,h.useState)(!1),{busy:m,error:g,submit:_}=wr();(0,h.useEffect)(()=>{Promise.all([e.client.request(`engines.list`),e.client.request(`task.get`,{taskId:t})]).then(([e,t])=>{let n=al(e.engines,t.task.engine).filter(e=>e.ready!==!1||e.id===t.task.engine),i=n.find(e=>e.id===t.task.engine)??n[0];r(n),a(t.task),s(i?.id??``),l(ok(i,t.task.effort)),d(i?.id===t.task.engine?t.task.model??``:``),p(!0)})},[e,t]);let v=n.find(e=>e.id===o),y=v?.effortLevels??[],b=y.length>0?[``,...y]:[],x=(v?.models??[]).map(e=>e.id).filter(e=>e.toLowerCase().includes(u.trim().toLowerCase())&&e!==u.trim()).slice(0,6),S=e=>{s(e);let t=n.find(t=>t.id===e);l(ok(t,e===i.engine?i.effort:void 0)),d(e===i.engine?i.model??``:``)},C=e=>{let t=n.findIndex(e=>e.id===o),r=n[Math.max(0,Math.min(n.length-1,t+e))];r&&S(r.id)},w=e=>{if(b.length===0)return;let t=Math.max(0,b.indexOf(c));l(b[Math.max(0,Math.min(b.length-1,t+e))]??``)},T=e=>{let t=e.target instanceof HTMLInputElement;if(e.key===`ArrowUp`&&!t)C(-1);else if(e.key===`ArrowDown`&&!t)C(1);else if((e.key===`ArrowLeft`||e.key===`h`)&&!t)w(-1);else if((e.key===`ArrowRight`||e.key===`l`)&&!t)w(1);else return;e.preventDefault()},E=()=>_(async()=>{if(!v)return;let n=y.length>0?c:void 0,r=v.acceptsModel?u.trim():void 0;(v.id!==i.engine||n!==void 0&&n!==(i.effort??``)||r!==void 0&&r!==(i.model??``))&&(await e.client.request(`task.setEngine`,{taskId:t,engine:v.id,...n===void 0?{}:{effort:n},...r===void 0?{}:{model:r}}),H(W(`tasks`,`toast.engineSwitched`,{engine:v.name})))});return(0,L.jsx)(Cr,{title:W(`tasks`,`changeEngine.title`),wide:!0,children:(0,L.jsxs)(`form`,{className:qn,onKeyDown:T,onSubmit:e=>{e.preventDefault(),E()},children:[(0,L.jsx)(`ul`,{className:Vn,"aria-label":W(`tasks`,`changeEngine.title`),children:n.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":e.id===o,className:gr({selected:e.id===o}),onClick:()=>S(e.id),children:[(0,L.jsx)(`span`,{className:`${br} text-accent`,children:e.id===o?`●`:` `}),(0,L.jsx)(`span`,{className:_r,children:e.name}),e.id===i.engine&&(0,L.jsx)(`span`,{className:`text-muted`,children:W(`tasks`,`changeEngine.current`)})]})},e.id))}),f&&v&&v.acceptsModel&&(0,L.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:W(`tasks`,`engineModel.label`)}),(0,L.jsx)(`input`,{className:ln,spellCheck:!1,placeholder:W(`tasks`,`engineModel.placeholder`),value:u,onChange:e=>d(e.target.value)}),x.length>0&&(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:x.map(e=>(0,L.jsx)(`button`,{type:`button`,className:Bn(),onClick:()=>d(e),children:e},e))})]}),b.length>0&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,L.jsx)(`span`,{className:`m-0 font-sans text-meta font-medium normal-nums text-muted`,children:W(`tasks`,`changeEngine.effortLabel`)}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:b.map(e=>(0,L.jsx)(`button`,{type:`button`,"aria-pressed":e===c,className:Bn(e===c),onClick:()=>l(e),children:e===``?W(`tasks`,`changeEngine.noEffort`):e},e||`default`))})]}),(0,L.jsx)(`p`,{className:`keys-only ${tn}`,children:(0,L.jsx)(Ld,{text:[W(`tasks`,`changeEngine.footer.engine`),...v?.acceptsModel?[W(`tasks`,`changeEngine.footer.model`)]:[],...b.length>0?[W(`tasks`,`changeEngine.footer.effort`)]:[],W(`tasks`,`changeEngine.footer.set`),W(`tasks`,`changeEngine.footer.cancel`)].join(` · `)})}),g&&(0,L.jsx)(`p`,{className:`text-error`,children:g}),(0,L.jsx)(Or,{busy:m||!f,submitLabel:F(`taskops.set`)})]})})}function ck({model:e,task:t}){let[n,r]=(0,h.useState)(()=>q(e,`task.get`,{taskId:t.id})?.task??null),[i,a]=(0,h.useState)(null),{busy:o,error:s,submit:c}=wr();(0,h.useEffect)(()=>{El(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,L.jsx)(Cr,{title:W(`tasks`,`runAgain.title`),wide:!0,children:(0,L.jsxs)(`form`,{className:qn,onSubmit:e=>{e.preventDefault(),l()},children:[(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`runAgain.source`,{title:t.label})}),(0,L.jsx)(`pre`,{className:nn,children:n?.prompt??i??W(`tasks`,`fieldNotes.loading`)}),(0,L.jsx)(`p`,{className:tn,children:W(`tasks`,`runAgain.hint`)}),s&&(0,L.jsx)(`p`,{className:`text-error`,children:s}),(0,L.jsx)(Or,{busy:o||!n?.prompt,submitLabel:W(`tasks`,`runAgain.confirm`)})]})})}function lk(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 uk({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,L.jsx)(Cr,{title:W(`tasks`,`fieldNotes.title`),wide:!0,children:(0,L.jsxs)(`div`,{className:qn,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,L.jsx)(`p`,{className:`font-mono text-meta break-all text-muted`,children:t}),n.kind===`loading`&&(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`fieldNotes.loading`)}),n.kind===`error`&&(0,L.jsx)(`p`,{className:`text-error`,children:n.message}),n.kind===`ready`&&f.length===0&&(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`fieldNotes.empty`)}),f.length>0&&(0,L.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,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,className:rn(t===i),onClick:()=>a(t),autoFocus:t===0,children:[(0,L.jsxs)(`span`,{className:`font-mono text-meta whitespace-pre text-accent`,children:[t===i?`▸ `:` `,lk(e.at),`, `,e.author]}),(0,L.jsx)(`span`,{className:`text-ink whitespace-pre-wrap wrap-anywhere`,children:e.text})]})},`${e.at}:${t}`))}),o&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-sm border-hairline border-line bg-paper px-3 py-2.5`,children:[(0,L.jsx)(`p`,{children:(0,L.jsx)(`strong`,{children:W(`tasks`,`fieldNotes.confirmDelete.title`)})}),(0,L.jsx)(`p`,{className:`text-muted`,children:W(`tasks`,`fieldNotes.confirmDelete.body`,{text:o.text})}),c&&(0,L.jsx)(`p`,{className:`text-error`,children:c}),(0,L.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>s(null),children:F(`dialog.cancel`)}),(0,L.jsx)(`button`,{type:`button`,className:Be({danger:!0}),onClick:()=>void p(o),children:F(`taskops.retire`)})]})]}),!o&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`keys-only font-sans text-meta text-subtle`,children:W(`tasks`,`fieldNotes.footerDeletable`)}),(0,L.jsxs)(`div`,{className:`actions flex items-center justify-end gap-3.5`,children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:f[i]?.id===void 0,onClick:()=>s(f[i]??null),children:F(`taskops.retire`)}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:Mn,children:F(`taskops.close`)})]})]})]})})}var dk=[`backlog`,`in_progress`,`in_review`,`done`,`canceled`,`error`],fk={backlog:`status.backlog`,in_progress:`status.inProgress`,in_review:`status.inReview`,done:`status.done`,canceled:`status.canceled`,error:`status.error`},pk=e=>({binding:e,key:Gs(e)??void 0});async function mk(e,t){if(!e){H(F(`menu.nothingToCopy`,{what:t}),`error`);return}try{await navigator.clipboard.writeText(e),H(F(`menu.copied`,{text:e}))}catch{H(F(`menu.copyFailed`),`error`)}}function hk(e,t,n){let r=[{label:F(`menu.newTask`),section:`open`,run:()=>Eh(t)}],i=n.mainTaskId;return i&&(n.first||r.push({label:W(`tasks`,`menu.moveToTop`),section:`edit`,run:()=>void e.client.request(`task.move`,{taskId:i,direction:`top`}).catch(e=>H(W(`tasks`,`toast.moveFailed`,{error:String(e)}),`error`))}),r.push({label:W(`tasks`,`menu.reorderProject`),section:`edit`,...pk(`sidebar.localMerge`),run:()=>_k(i)})),r.push({label:W(`tasks`,`menu.fieldNotes`),section:`notes`,run:()=>B.set((0,L.jsx)(uk,{model:e,repo:t}))}),i&&r.push({label:W(`tasks`,`menu.forgetProject`),section:`danger`,danger:!0,run:()=>B.set(rS(e,t,n.label))}),r}function gk(e){return[{label:F(`menu.newChatNoFolder`),section:`open`,run:()=>Dh()},{label:F(`menu.newShell`),section:`open`,run:()=>void Ll(e).catch(e=>H(String(e),`error`))}]}function _k(e){let t=!Qd.get();t&&e!==void 0&&$d.set(e),ef(t),document.querySelector(`.rail`)?.focus()}function vk(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?(H(W(`tasks`,`moveToProject.empty`),`error`),null):(0,L.jsx)(Dr,{title:W(`tasks`,`moveToProject.title`),choices:r,onPick:async n=>{await e.client.request(`task.moveToProject`,{taskId:t.id,repo:n}),H(W(`tasks`,`toast.movedToProject`,{project:r.find(e=>e.value===n)?.label??n}))}})}function yk(e,t,n){let r=e.client,i=[];n&&(i.push({label:F(`menu.closeTab`),section:`tab`,run:()=>B.set((0,L.jsx)(Er,{title:F(`confirm.closeTabTitle`,{tab:n.title??n.engineName??n.id}),body:F(`confirm.closeTabBody`),confirmLabel:F(`menu.closeTab`),onConfirm:async()=>{await e.closeTab(t.id,n.id)}}))}),i.push(...nk(e,t.id,n))),i.push({label:F(`menu.newChat`),section:`open`,run:()=>void Fl(e,t.id)}),i.push({label:F(`menu.newChatPick`),section:`open`,rare:!0,run:()=>B.set((0,L.jsx)(X,{model:e,taskId:t.id}))}),i.push({label:F(`menu.continueEngine`),section:`open`,rare:!0,...pk(`chat.tab.fork`),run:()=>B.set((0,L.jsx)(X,{model:e,taskId:t.id,context:`continue`,sourceTabId:n?.id}))}),i.push({label:F(`menu.newShell`),section:`open`,run:()=>void Il(e,t.id,{kind:`shell`}).catch(e=>H(String(e),`error`))}),t.startsAt&&(i.push({label:F(`menu.startNow`),section:`open`,run:()=>void e.client.request(`task.startScheduledNow`,{taskId:t.id}).catch(e=>H(String(e),`error`))}),i.push({label:F(`menu.cancelStart`),section:`open`,run:()=>void e.client.request(`task.cancelScheduledStart`,{taskId:t.id}).catch(e=>H(String(e),`error`))})),t.hasPrompt&&(i.push({label:W(`tasks`,`menu.runAgain`),section:`open`,run:()=>B.set((0,L.jsx)(ck,{model:e,task:t}))}),i.push({label:F(`menu.retryEdit`),section:`open`,rare:!0,run:()=>void bm(e,t)}));let a=!t.machine;if(a&&i.push({label:W(`tasks`,`menu.openEditor`),section:`open`,...pk(`tasks.openWorktree`),run:()=>void Qx(e,t.id)}),t.groupId){let e=t.groupId;i.push({label:F(`compare.menu`),section:`open`,run:()=>Ua(e)})}i.push({label:F(`menu.rename`),section:`edit`,...pk(`sidebar.rename`),run:()=>B.set((0,L.jsx)(Tr,{title:F(`menu.rename`),initial:t.title,submitLabel:F(`dialog.save`),onSubmit:n=>e.act(`task.rename`,{taskId:t.id,title:n}).then(()=>{})}))}),t.kind!==`main`&&i.push({label:t.pinned?F(`menu.unpin`):F(`menu.pin`),section:`edit`,...pk(`sidebar.pin`),run:()=>void e.act(`task.pin`,{taskId:t.id,pinned:!t.pinned}).catch(e=>H(String(e),`error`))}),a&&i.push({label:W(`tasks`,`menu.reorder`),section:`edit`,rare:!0,...pk(`sidebar.localMerge`),run:()=>_k()}),i.push({label:F(`menu.setStatus`),section:`edit`,children:dk.map(n=>({label:F(fk[n]),checked:n===t.status,run:()=>void e.act(`task.setStatus`,{taskId:t.id,status:n}).catch(e=>H(String(e),`error`))}))}),a&&t.kind!==`main`&&!t.routine&&!t.parentTaskId&&!t.extraRepoCount&&i.push({label:W(`tasks`,`menu.moveToProject`),section:`edit`,rare:!0,run:()=>{let n=vk(e,t);n&&B.set(n)}}),a&&i.push({label:F(`menu.changeEngine`),section:`edit`,rare:!0,...pk(`tasks.cycleEngine`),run:()=>B.set((0,L.jsx)(sk,{model:e,taskId:t.id}))}),t.pr?.checkState===`failing`&&i.push({label:W(`tasks`,`menu.fixChecks`),section:`git`,key:xi(`files.fixChecks`),run:()=>void Zx(e,t.id,F(`taskops.fixSent`))}),t.kind===`task`&&t.branch&&a&&i.push({label:W(`tasks`,`menu.syncBase`),section:`git`,rare:!0,key:xi(`files.syncBase`),run:()=>void Yx(e,t.id)}),t.branch&&i.push({label:F(`menu.renameBranch`),section:`git`,rare:!0,...pk(`tasks.renameBranch`),run:()=>B.set((0,L.jsx)(Tr,{title:F(`menu.renameBranch`),initial:t.branch,submitLabel:F(`dialog.save`),onSubmit:e=>r.request(`task.setBranch`,{taskId:t.id,branch:e}).then(()=>{})}))}),t.kind===`task`&&t.branch&&i.push({label:F(`menu.land`),section:`git`,run:()=>void qx(e,t)});let o=[{label:F(`menu.copyWhat.id`),run:()=>void mk(t.id,F(`menu.what.id`))}];return t.branch&&o.push({label:F(`menu.copyWhat.branch`),run:()=>void mk(t.branch,F(`menu.what.branch`))}),o.push({label:F(`menu.copyWhat.path`),run:()=>void r.request(`task.get`,{taskId:t.id}).then(e=>mk(e.task.worktreePath,F(`menu.what.path`))).catch(e=>H(String(e),`error`))}),i.push({label:F(`menu.copy`),section:`copy`,children:o}),t.kind!==`main`&&i.push({label:W(`tasks`,t.archived?`menu.unarchive`:`menu.archive`),section:`danger`,run:()=>void nS(e,t)}),i.push({label:F(`menu.removeSession`),section:`danger`,...pk(`sidebar.delete`),danger:!0,run:()=>B.set(t.kind===`main`?tS(e,t):eS(e,t))}),i}var bk=`rove.collapsedProjects`,xk=`rove.foldedTasks`,Sk=`rove.openedTasks`,Ck=600;function wk(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 Tk(e,t){try{localStorage.setItem(e,JSON.stringify([...t]))}catch{}}var Ek=(e,t)=>{let n=new Set(e);return n.delete(t)||n.add(t),n};function Dk(){let e=_(Yd),[t,n]=(0,h.useState)({active:!1,query:``}),[r,i]=(0,h.useState)(!1),a=()=>i(e=>!e),[o,s]=(0,h.useState)(()=>wk(bk)),c=e=>s(t=>{let n=Ek(t,e);return Tk(bk,n),n}),[l,u]=(0,h.useState)(()=>({folded:wk(xk),opened:wk(Sk)}));return{sort:e,cycleSort:Zd,search:t,setSearch:n,archivedOpen:r,toggleArchived:a,collapsed:o,toggleProject:c,hand:l,toggleTaskFold:(e,t)=>u(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)),Tk(xk,r),Tk(Sk,i),{folded:r,opened:i}})}}var Ok=[`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 kk(e){for(let t of e)for(let e of Ok){let n=bi(e).indexOf(t);if(n>=0)return{id:e,slot:n}}return null}function Ak(e,t){let n=e.selection.get().taskId===t;e.select(t),Ba(),n&&_a()}function jk(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)(()=>kg.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===`archived`&&n.toggleArchived(),t?.kind===`task`&&e.select(t.task.id),t?.kind===`round`&&Ua(t.groupId),t?.kind===`pane`&&ik(e,t),t&&t.kind!==`archived`&&Ba()},_=(t,n)=>{t?.kind===`task`&&pn(yk(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=al(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}),H(F(`rail.engineSwitched`,{engine:i.name}))}catch(e){H(F(`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=kk(zs(t));if(Qd.get()){let n=o?.kind===`task`&&o.machine===void 0;if(d?.id===`sidebar.nav`)n&&tf(e,o,d.slot%2==0?1:-1);else if(d?.id===`sidebar.localMerge`||t.key===`Enter`||t.key===`Escape`)ef(!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<Ck?(m(0),c.current=0):c.current=Date.now();break;case`sidebar.select`:case`sidebar.tree.open`:g(o);break;case`tasks.focusEngine`:_a();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&&ef(!0);break;case`sidebar.sort`:n.cycleSort(),H(W(`tasks`,`sort.label`,{mode:W(`tasks`,`sort.modes.${Yd.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`:Ha(`worktrees`);break;case`tasks.update`:Ha(`update`);break;default:return}t.preventDefault()}}}var Mk=192,Nk=`rove.web.railWidth`,Pk=`rove.web.railFolded`;function Fk(){let e=Number(localStorage.getItem(Nk));return Number.isFinite(e)&&e>0?e:null}var Ik=g(Fk());Ik.subscribe(()=>{let e=Ik.get();e===null?localStorage.removeItem(Nk):localStorage.setItem(Nk,String(Math.round(e)))}),Ik.subscribe(Fn);var Lk=g(localStorage.getItem(Pk)===`1`);Lk.subscribe(()=>localStorage.setItem(Pk,Lk.get()?`1`:`0`));var Rk=g(!1),zk=null;function Bk(e){zk!==null&&window.clearTimeout(zk),zk=null,e?Rk.set(!0):zk=window.setTimeout(()=>Rk.set(!1),250)}Lk.subscribe(()=>Rk.set(!1)),Lk.subscribe(Fn);function Vk(e,t=window.innerWidth){let n=Math.max(Mk,t-320);return Math.max(Mk,Math.min(n,Math.round(e)))}var Hk=(e,t,n)=>`~pane:${e}:${t}:${n}`;function Uk(e,t){return e.flatMap(e=>e.kind===`task`?[e,...(t[e.task.id]??[]).flatMap(t=>{let n=t.split;if(!n||!bu(n))return[];let r=Cu(n,_u(t));return yu(n.root).map(n=>({id:Hk(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 Wk(e){let{row:t}=e;return(0,L.jsxs)(`button`,{type:`button`,className:`${gr({size:`pane`})} ${e.cursor?vf:``}`,title:F(`compare.menu`),onClick:()=>{e.onClick(),Ua(t.groupId)},...e.place,children:[e.guides&&(0,L.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,L.jsx)(`span`,{className:cf(e)},t))}),(0,L.jsx)(`span`,{className:`${_r} text-(length:--fs-meta) text-muted`,children:t.title}),(0,L.jsxs)(`span`,{className:`${Sr} ml-auto items-center`,children:[e.repo&&(0,L.jsx)(`span`,{className:`max-w-24 truncate text-subtle`,children:e.repo}),(0,L.jsx)(`span`,{className:`text-subtle`,children:t.tasks.length}),(0,L.jsx)(tw,{status:yC(t.tasks)})]})]})}function Gk(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,L.jsxs)(`div`,{className:`${hf} mono items-center`,children:[(0,L.jsx)(`span`,{className:`text-accent`,children:`/`}),(0,L.jsx)(`input`,{ref:t,className:gf,type:`text`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,autoCapitalize:`off`,enterKeyHint:`go`,value:e.query,placeholder:F(`rail.searchPlaceholder`),"aria-label":F(`rail.searchPlaceholder`),onChange:t=>e.onChange(t.target.value)}),e.query&&(0,L.jsx)(`span`,{className:`ml-1.5 text-muted`,children:e.count})]})}var Kk=Math.min,qk=Math.max,Jk=Math.round,Yk=Math.floor,Xk=e=>({x:e,y:e}),Zk={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Qk(e,t,n){return qk(e,Kk(t,n))}function $k(e,t){return typeof e==`function`?e(t):e}function eA(e){return e.split(`-`)[0]}function tA(e){return e.split(`-`)[1]}function nA(e){return e===`x`?`y`:`x`}function rA(e){return e===`y`?`height`:`width`}function iA(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function aA(e){return nA(iA(e))}function oA(e,t,n){n===void 0&&(n=!1);let r=tA(e),i=aA(e),a=rA(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=hA(o)),[o,hA(o)]}function sA(e){let t=hA(e);return[cA(e),t,cA(t)]}function cA(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var lA=[`left`,`right`],uA=[`right`,`left`],dA=[`top`,`bottom`],fA=[`bottom`,`top`];function pA(e,t,n){switch(e){case`top`:case`bottom`:return n?t?uA:lA:t?lA:uA;case`left`:case`right`:return t?dA:fA;default:return[]}}function mA(e,t,n,r){let i=tA(e),a=pA(eA(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(cA)))),a}function hA(e){let t=eA(e);return Zk[t]+e.slice(t.length)}function gA(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function _A(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:gA(e)}function vA(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 yA(e,t,n){let{reference:r,floating:i}=e,a=iA(t),o=aA(t),s=rA(o),c=eA(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=tA(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function bA(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}=$k(t,e),p=_A(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=vA(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=vA(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 xA=50,SA=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:bA},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=yA(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<xA&&(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}=yA(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},CA=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}=$k(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=eA(r),_=iA(o),v=eA(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[hA(o)]:sA(o)),x=p!==`none`;!d&&x&&b.push(...mA(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=oA(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`||_===iA(t)||T.every(e=>iA(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=iA(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{}}}},wA=new Set([`left`,`top`]);async function TA(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=eA(n),s=tA(n),c=iA(n)===`y`,l=wA.has(o)?-1:1,u=a&&c?-1:1,d=$k(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 EA=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 TA(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}}}}},DA=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}=$k(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=iA(i),p=nA(f),m=u[p],h=u[f],g=(e,t)=>Qk(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 OA(){return typeof window<`u`}function kA(e){return MA(e)?(e.nodeName||``).toLowerCase():`#document`}function AA(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function jA(e){return((MA(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function MA(e){return OA()?e instanceof Node||e instanceof AA(e).Node:!1}function NA(e){return OA()?e instanceof Element||e instanceof AA(e).Element:!1}function PA(e){return OA()?e instanceof HTMLElement||e instanceof AA(e).HTMLElement:!1}function FA(e){return!OA()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof AA(e).ShadowRoot}function IA(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=qA(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function LA(e){return/^(table|td|th)$/.test(kA(e))}function RA(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var zA=/transform|translate|scale|rotate|perspective|filter/,BA=/paint|layout|strict|content/,VA=e=>!!e&&e!==`none`,HA;function UA(e){let t=NA(e)?qA(e):e;return VA(t.transform)||VA(t.translate)||VA(t.scale)||VA(t.rotate)||VA(t.perspective)||!GA()&&(VA(t.backdropFilter)||VA(t.filter))||zA.test(t.willChange||``)||BA.test(t.contain||``)}function WA(e){let t=YA(e);for(;PA(t)&&!KA(t);){if(UA(t))return t;if(RA(t))return null;t=YA(t)}return null}function GA(){return HA??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),HA}function KA(e){return/^(html|body|#document)$/.test(kA(e))}function qA(e){return AA(e).getComputedStyle(e)}function JA(e){return NA(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function YA(e){if(kA(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||FA(e)&&e.host||jA(e);return FA(t)?t.host:t}function XA(e){let t=YA(e);return KA(t)?(e.ownerDocument||e).body:PA(t)&&IA(t)?t:XA(t)}function ZA(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=XA(e),i=r===e.ownerDocument?.body,a=AA(r);if(i){let e=QA(a);return t.concat(a,a.visualViewport||[],IA(r)?r:[],e&&n?ZA(e):[])}return t.concat(r,ZA(r,[],n))}function QA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $A(e){let t=qA(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=PA(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Jk(n)!==a||Jk(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ej(e){return NA(e)?e:e.contextElement}function tj(e){let t=ej(e);if(!PA(t))return Xk(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$A(t),o=(a?Jk(n.width):n.width)/r,s=(a?Jk(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var nj=Xk(0);function rj(e){let t=AA(e);return!GA()||!t.visualViewport?nj:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ij(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===AA(e)}function aj(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ej(e),o=Xk(1);t&&(r?NA(r)&&(o=tj(r)):o=tj(e));let s=ij(a,n,r)?rj(a):Xk(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=AA(a),t=NA(r)?AA(r):r,n=e,i=QA(n);for(;i&&t!==n;){let e=tj(i),t=i.getBoundingClientRect(),r=qA(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=AA(i),i=QA(n)}}return vA({width:u,height:d,x:c,y:l})}function oj(e,t){let n=JA(e).scrollLeft;return t?t.left+n:aj(jA(e)).left+n}function sj(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-oj(e,n),y:n.top+t.scrollTop}}function cj(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=jA(r),s=t?RA(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Xk(1),u=Xk(0),d=PA(r);if((d||!a)&&((kA(r)!==`body`||IA(o))&&(c=JA(r)),d)){let e=aj(r);l=tj(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?sj(o,c):Xk(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 lj(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function uj(e){let t=JA(e),n=e.ownerDocument.body,r=qk(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=qk(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+oj(e),o=-t.scrollTop;return qA(n).direction===`rtl`&&(a+=qk(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var dj=25;function fj(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=AA(e),a=jA(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!GA()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(oj(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<=dj&&(s-=o)}return{width:s,height:c,x:l,y:u}}function pj(e,t){let n=aj(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=tj(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function mj(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=fj(e,n,t);else if(t===`document`)r=uj(jA(e));else if(NA(t))r=pj(t,n);else{let n=rj(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return vA(r)}function hj(e,t){let n=t.get(e);if(n)return n;let r=ZA(e,[],!1).filter(e=>NA(e)&&kA(e)!==`body`),i=null,a=qA(e).position===`fixed`,o=a?YA(e):e;for(;NA(o)&&!KA(o);){let e=qA(o),t=UA(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=YA(o)}return t.set(e,r),r}function gj(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?RA(t)?[]:hj(t,this._c):[].concat(n),r],o=mj(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=mj(t,a[e],i);s=qk(n.top,s),c=Kk(n.right,c),l=Kk(n.bottom,l),u=qk(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function _j(e){let{width:t,height:n}=$A(e);return{width:t,height:n}}function vj(e,t,n){let r=PA(t),i=jA(t),a=n===`fixed`,o=aj(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Xk(0);if((r||!a)&&((kA(t)!==`body`||IA(i))&&(s=JA(t)),r)){let e=aj(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=oj(i));let l=i&&!r&&!a?sj(i,s):Xk(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 yj(e){return qA(e).position===`static`}function bj(e,t){if(!PA(e)||qA(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return jA(e)===n&&(n=n.ownerDocument.body),n}function xj(e,t){let n=AA(e);if(RA(e))return n;if(!PA(e)){let t=YA(e);for(;t&&!KA(t);){if(NA(t)&&!yj(t))return t;t=YA(t)}return n}let r=bj(e,t);for(;r&&LA(r)&&yj(r);)r=bj(r,t);return r&&KA(r)&&yj(r)&&!UA(r)?n:r||WA(e)||n}var Sj=async function(e){let t=this.getOffsetParent||xj,n=this.getDimensions,r=await n(e.floating);return{reference:vj(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cj(e){return qA(e).direction===`rtl`}var wj={convertOffsetParentRelativeRectToViewportRelativeRect:cj,getDocumentElement:jA,getClippingRect:gj,getOffsetParent:xj,getElementRects:Sj,getClientRects:lj,getDimensions:_j,getScale:tj,isElement:NA,isRTL:Cj};function Tj(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ej(e,t,n){let r=null,i,a=jA(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=Yk(d),h=Yk(a.clientWidth-(u+f)),g=Yk(a.clientHeight-(d+p)),_=Yk(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:qk(0,Kk(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Tj(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=AA(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Dj(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=ej(e),u=i||a?[...l?ZA(l):[],...t?ZA(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ej(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?aj(e):null;c&&g();function g(){let t=aj(e);h&&!Tj(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 Oj=EA,kj=DA,Aj=CA,jj=(e,t,n)=>{let r=new Map,i=n??{},a={...wj,...i.platform,_c:r};return SA(e,t,{...i,platform:a})},Mj=`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`,Nj=500,Pj=400,Fj=`rove-tip`,Ij=null,Lj=null,Rj=null,zj=null,Bj=0,Vj=!1,Hj=()=>Vj;function Uj(){return Ij?.isConnected?Ij:(Ij=document.createElement(`div`),Ij.id=Fj,Ij.setAttribute(`role`,`tooltip`),Ij.className=Mj,Ij.hidden=!0,document.body.append(Ij),Ij)}function Wj(){zj!==null&&window.clearTimeout(zj),zj=null}function Gj(e,t,n=`top`){Wj(),Kj();let r=Uj();r.textContent=t,r.hidden=!1,Lj=e,e.setAttribute(`aria-describedby`,Fj),Rj=Dj(e,r,()=>{if(!e.isConnected)return Kj();jj(e,r,{strategy:`fixed`,placement:n,middleware:[Oj(6),Aj(),kj({padding:8})]}).then(({x:e,y:t})=>{r.style.left=`${e}px`,r.style.top=`${t}px`})})}function Kj(){Wj(),Lj&&(Rj?.(),Rj=null,Lj.getAttribute(`aria-describedby`)===Fj&&Lj.removeAttribute(`aria-describedby`),Lj=null,Ij&&(Ij.hidden=!0),Bj=performance.now())}function qj(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 Jj(e){if(e===Lj)return;Wj();let t=Lj!==null||performance.now()-Bj<Pj,n=()=>e.isConnected&&e.dataset.tip&&Gj(e,e.dataset.tip);t?n():zj=window.setTimeout(n,Nj)}var Yj=!1;function Xj(){Yj||(Yj=!0,document.addEventListener(`pointerover`,e=>{if(e.pointerType===`touch`)return;let t=qj(e.target);t?Jj(t):Lj&&e.target instanceof Node&&Lj.contains(e.target)||Kj()}),document.addEventListener(`pointerout`,e=>{let t=qj(e.target);t&&!(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget))&&Kj()}),document.addEventListener(`keydown`,e=>{Vj=!0,e.key===`Escape`&&Kj()},!0),document.addEventListener(`pointerdown`,()=>{Vj=!1,Kj()},!0),document.addEventListener(`focusin`,e=>{let t=Vj?qj(e.target):null;t&&Jj(t)}),document.addEventListener(`focusout`,e=>{e.target===Lj&&Kj()}),window.addEventListener(`blur`,Kj))}var Zj=450,Qj=e=>{let t=e.querySelector(`.row-title`);return!!t&&t.scrollWidth>t.clientWidth};function $j(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(()=>Gj(e,i.current,`right`),Zj)},s=()=>{a(),Kj()};return(0,h.useEffect)(()=>{let e=r.current,n=e?.closest(`.rail`);if(!t||!e||!n||!Hj()||!n.contains(document.activeElement)||!Qj(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`||!Qj(e.currentTarget)||o(e.currentTarget)},onPointerLeave:s,hide:s}}function eM({at:e}){let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=Rp(t);return(0,L.jsxs)(`span`,{className:`text-subtle`,title:F(`rail.startsAt`,{time:t.toLocaleString()}),children:[`◷ `,n]})}var tM=150,nM=128,rM=0,iM=2,aM=[{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}],oM=`/-\\|`,sM=6,cM=(e,t,n,r)=>{let i=e[n];i&&t>=0&&t<i.length&&(i[t]=r)};function lM(e,t){let n=Math.min(64,Math.max(24,Math.floor(t))),r=(Math.floor(e)%tM+tM)%tM,i=Array.from({length:11},()=>Array(n).fill(` `)),a=Array.from({length:11},()=>Array(n).fill(` `));cM(a,rM,0,`o`);let o=iM+2*(aM.length-1),s=Math.min(o,Math.floor(r/2));for(let e=1;e<=s;e++)cM(i,rM,e,`|`);if(aM.forEach((e,t)=>{let o=iM+2*t,s=2*o;if(r<s)return;cM(i,rM,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))%sM+sM)%sM===0?cM(a,t,o,`=`):cM(i,t,o,`-`);d?cM(a,u,o,`o`):u<l?cM(a,u,o,`>`):cM(a,u,o,oM[(Math.floor(r/2)+t)%4]??`-`)}),r>=nM){let e=Math.ceil((r-nM+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(`
|
|
@@ -60,4 +60,4 @@ This worktree is at the PR's head ({head}, going into {base}). Read the change a
|
|
|
60
60
|
`)})]}):(0,L.jsxs)(`div`,{className:nF,children:[(0,L.jsxs)(`div`,{className:rF,children:[(0,L.jsx)(`input`,{className:`${ln} ${iF}`,value:a,placeholder:F(`transcript.findPlaceholder`),"aria-label":F(`transcript.findPlaceholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:k}),a.trim()!==``&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`whitespace-nowrap text-muted`,children:b.length===0?F(`transcript.findNone`):F(`transcript.findCount`,{at:x+1,total:b.length})}),(0,L.jsx)(R,{onClick:()=>O(-1),disabled:b.length===0,children:F(`transcript.prev`)}),(0,L.jsx)(R,{onClick:()=>O(1),disabled:b.length===0,children:F(`transcript.next`)})]}),(0,L.jsx)(R,{onClick:()=>void ee(),disabled:v.length===0,children:F(`transcript.export`)})]}),(0,L.jsxs)(`div`,{ref:d,className:aF,onScroll:e=>{let t=e.currentTarget;f.current=t.scrollHeight-t.scrollTop-t.clientHeight<DL,t.scrollTop<DL&&g?.older&&!r.paging&&D()},children:[g?.older&&(0,L.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:(0,L.jsx)(R,{onClick:()=>void D(),disabled:r.paging,children:F(`transcript.older`)})}),v.length===0&&(0,L.jsx)(`p`,{className:`m-0 px-3 py-2 font-mono text-meta text-subtle`,children:F(`transcript.empty`)}),v.map(e=>(0,L.jsx)(jL,{entry:e,failed:y,needle:a,flash:l===e.index,current:S===e.index,onCopy:()=>A(e)},e.index))]})]})}var NL={working:`review.scopeWorking`,branch:`review.scopeBranch`,task:`review.scopeTask`};function PL(e){return e.kind===`file`?{text:Mo(e.path),hint:e.path}:e.kind===`diff`?e.path===`.`?{text:F(NL[e.scope]),hint:F(`preview.whole`)}:{text:Mo(e.path),hint:e.path}:{text:F(`panel.${e.kind}`),hint:F(`panel.${e.kind}`)}}function FL({taskId:e,kind:t,expand:n}){I();let r=_($o),i=F(r?`panel.restore`:`panel.expand`);return(0,L.jsxs)(L.Fragment,{children:[n&&(0,L.jsx)(`button`,{type:`button`,className:OM({tool:!0}),title:i,"aria-label":i,"aria-pressed":r,onClick:()=>$o.set(!r),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.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,L.jsx)(`button`,{type:`button`,className:OM({tool:!0}),title:F(`panel.close`),"aria-label":F(`panel.close`),onClick:()=>Ns(e,t),children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function IL({taskId:e,column:t,narrow:n}){if(I(),t.kind===`browser`)return(0,L.jsxs)(`div`,{className:PM(n),children:[(0,L.jsx)(oN,{taskId:e,column:t}),!n&&(0,L.jsx)(FL,{taskId:e,kind:`browser`,expand:!0})]});if(n&&t.kind!==`diff`)return null;let{text:r,hint:i}=PL(t);return(0,L.jsxs)(`div`,{className:PM(n),children:[(0,L.jsx)(`span`,{className:FM,title:i,children:r}),(0,L.jsx)(FL,{taskId:e,kind:t.kind,expand:!n})]})}function LL({model:e,task:t,column:n}){let r=(0,h.useRef)([]);return r.current=Eo(r.current,n.active,n.tabs),n.tabs.filter(e=>r.current.includes(e.id)).map(r=>(0,L.jsx)(`div`,{className:WM,hidden:r.id!==n.active,children:(0,L.jsx)(ON,{model:e,tab:r,onNavigate:e=>Ps(t.id,t=>bo(t,r.id,e)),onStep:e=>Ps(t.id,t=>xo(t,r.id,e))})},r.id))}function RL({model:e,task:t,column:n,narrow:r,restored:i}){return n.kind===`browser`?(0,L.jsx)(LL,{model:e,task:t,column:n}):(0,L.jsxs)(`div`,{className:WM,children:[n.kind===`files`&&(0,L.jsx)(FP,{model:e,task:t,narrow:r}),n.kind===`chat`&&(0,L.jsx)(ML,{model:e,task:t,active:!0}),n.kind===`quota`&&(0,L.jsx)(eP,{model:e,task:t,active:!0}),n.kind===`file`&&(0,L.jsx)(cL,{model:e,view:{taskId:t.id,path:n.path,scope:`working`,file:!0},active:!0,restored:i,onClose:()=>Ns(t.id,`file`)},`${t.id}:file:${n.path}`),n.kind===`diff`&&(0,L.jsx)(cL,{model:e,view:{taskId:t.id,path:n.path,scope:n.scope},active:!0,restored:i,onClose:()=>Ns(t.id,`diff`)},`${t.id}:${n.path}:${n.scope}`)]})}function zL({taskId:e,kinds:t,index:n,body:r,slot:i}){I();let a=(0,h.useRef)(null);return(0,L.jsx)(`div`,{className:UM,style:{gridColumn:i},title:F(`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=Ko(r.widths,n,t.clientX-r.x,220);Es(e,e=>Wo(e,i))},onLostPointerCapture:()=>{a.current=null,r.current?.classList.remove(`is-resizing`)},onDoubleClick:()=>Es(e,Go)})}function BL({panel:e}){I();let t=(0,h.useRef)(null);return(0,L.jsx)(sN,{edge:`left`,title:F(`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),In(!0)},onPointerMove:e=>{let n=t.current;if(!n||e.clientX===n.x)return;let r=Lk.get()?0:Vk(Ik.get()??280);Zo.set(es(n.width-(e.clientX-n.x),r))},onLostPointerCapture:()=>{t.current=null,e.current?.classList.remove(`is-resizing`),In(!1)},onDoubleClick:()=>Zo.set(null)})}var VL=e=>e.kind===`diff`?`diff:${e.path}:${e.scope}`:e.kind===`file`?`file:${e.path}`:e.kind;function HL({model:e,task:t,narrow:n}){I();let r=ws(t.id),i=_(Jo),a=_($o),o=(0,h.useRef)(null),s=(0,h.useRef)(null),c=i===`terminal`?`files`:i,l=n?jo(r,c):void 0;(0,h.useEffect)(()=>{n&&!l&&Es(t.id,e=>Io(e,c))},[n,l,c,t.id]);let u=n?l?[l]:[]:r.columns,d=u.map(e=>e.kind),f=(n?[1]:Uo(r)).map((e,t)=>`${t>0?`var(--divider) `:``}minmax(0, ${e}fr)`).join(` `),p=(0,h.useRef)(u.map(VL));return(0,L.jsxs)(`aside`,{className:jM(n),ref:o,children:[!n&&!a&&(0,L.jsx)(BL,{panel:o}),(0,L.jsxs)(`div`,{className:MM,ref:s,style:{gridTemplateColumns:f},children:[u.map(r=>(0,L.jsxs)(`section`,{className:NM,"data-kind":r.kind,style:{gridColumn:2*d.indexOf(r.kind)+1},children:[(0,L.jsx)(IL,{taskId:t.id,column:r,narrow:n}),(0,L.jsx)(RL,{model:e,task:t,column:r,narrow:n,restored:p.current.includes(VL(r))})]},r.kind)),!n&&u.slice(1).map((e,n)=>(0,L.jsx)(zL,{taskId:t.id,kinds:d,index:n,body:s,slot:2*n+2},`divider:${e.kind}`))]})]})}function UL({model:e,task:t,remoteHost:n,narrow:r=!1}){let i=_(bn),a=Ts(t?.id??null);return!r&&(i||!a)?null:t?(0,L.jsx)(HL,{model:e,task:t,narrow:r},t.id):n?(0,L.jsx)(`aside`,{className:jM(!1),children:(0,L.jsx)(kf,{host:n,onMachines:()=>Zh(e)})}):null}var WL=1500;function GL({model:e}){let t=e.client,n=_(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),WL);return()=>window.clearTimeout(e)},[n.state]),n.state===`open`||n.state===`connecting`&&!r?null:(0,L.jsxs)(`footer`,{className:Ht,children:[(0,L.jsx)(`span`,{className:Ut(n.state===`retrying`)}),(0,L.jsx)(`span`,{children:n.state===`retrying`?F(`status.retrying`,{count:n.failures}):F(`status.connecting`)}),n.state===`retrying`&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>t.retryNow(),children:F(`status.retry`)})]})}var KL=`rove.web.update.skipped`;function qL(e){return!e.latest||!e.notify||e.latest===e.skipped||e.latest===e.asked?null:e.latest}var JL=null;function YL(){let e=uy.get(),t=qL({latest:e?.info?.hasUpdate?e.info.latest:null,notify:Fg.get().prefs.updateNotify,skipped:localStorage.getItem(KL),asked:JL});!t||B.get()!==null||(JL=t,B.set((0,L.jsx)(XL,{current:e?.current??``,latest:t})))}function XL(e){return(0,L.jsx)(Cr,{title:F(`updatePrompt.title`,{version:e.latest}),children:(0,L.jsxs)(`div`,{className:qn,children:[(0,L.jsx)(`p`,{className:`text-muted`,children:F(`updatePrompt.body`,{current:e.current})}),(0,L.jsxs)(`div`,{className:un,children:[(0,L.jsx)(R,{onClick:()=>{localStorage.setItem(KL,e.latest),Mn()},children:F(`updatePrompt.skip`)}),(0,L.jsx)(R,{onClick:Mn,children:F(`updatePrompt.later`)}),(0,L.jsx)(R,{variant:`filled`,autoFocus:!0,onClick:()=>{Mn(),dy.set(!0),Ha(`update`)},children:F(`updatePrompt.yes`)})]})]})})}function ZL({model:e,taskId:t,groupId:n}){I();let r=_(e.tasks),i=r?HS(r.tasks,n):[];return i.length<2||!i.some(e=>e.id===t)?null:(0,L.jsxs)(`nav`,{className:PC,"aria-label":F(`compare.menu`),children:[i.map((n,r)=>(0,L.jsxs)(R,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,L.jsx)(tw,{status:n.rowStatus}),r+1,` `,n.engine?.name??n.label,n.kept&&(0,L.jsx)(`span`,{className:`text-accent`,children:`✓`}),` ]`]},n.id)),(0,L.jsx)(R,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>Ua(n),children:F(`compare.strip`)})]})}var QL=new Set,$L=2e3;function eR(e){QL.add(e)}function tR(e,t=$L){setTimeout(()=>QL.delete(e),t)}var nR=e=>QL.has(e),rR=new Map,iR=new Set,aR=(e,t)=>`${e}/${t}`,oR=e=>rR.get(e)??``;function sR(e,t){t===``?rR.delete(e):rR.set(e,t);for(let e of iR)e()}function cR(e){return iR.add(e),()=>iR.delete(e)}function lR(e,t){let n=oR(e).trimEnd();sR(e,n===``?t:`${n}\n\n${t}`)}function uR(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 dR(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&&H(F(`voice.learned`,{pairs:r.map(e=>F(`voice.learnedPair`,{spoken:e.spoken,term:e.term})).join(`, `)}),`info`,{label:F(`voice.undo`),run:()=>void e.request(`voice.unlearn`,{learned:r}).then(()=>H(F(`voice.unlearned`)),()=>H(F(`voice.unlearnFailed`),`error`))})}function fR({model:e,taskId:t,tabId:n}){let r=_(e.tasks)?.tasks.find(e=>e.id===t)!==void 0,i=aR(t,n),a=(0,h.useSyncExternalStore)(cR,()=>oR(i)),[o,s]=(0,h.useState)(!1),{attachments:c,attach:l,remove:u,ready:d,clear:f}=Uc(e,e=>H(e,`error`)),p=(0,h.useRef)(null),m=wh(e.client),[g,v]=(0,h.useState)(!1),y=Nm({value:a,onChange:e=>sR(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)}`;sR(i,s);let c=n+o.length+e.length;b.current=uR(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)||sR(i,t)},C=e=>void S(e),w=async(r=a)=>{s(!0);try{let a=Lc(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?(sR(i,``),f(),v(!1),b.current&&dR(e.client,b.current,r),b.current=null,!0):(H(F(`layout.composerNotSent`,{reason:o.reason??``}),`error`),!1)}catch(e){let t=e instanceof Zu?e.code:void 0;return H(t===`UNKNOWN_OP`?F(`layout.composerOldBridge`):t===`AWAITING_PERMISSION`?F(`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===``&&c.length===0,O=()=>{(0,_O.flushSync)(()=>v(!0)),p.current?.focus()};return(0,L.jsx)(nh,{value:a,placeholder:F(`layout.composerPlaceholder`),sendLabel:F(`layout.composerSend`),busy:o,ready:a.trim()!==``||c.length>0,attached:(0,L.jsx)(Wc,{attachments:c,onRemove:u}),attach:(0,L.jsxs)(Ic,{className:Wm,title:F(`layout.composerAttach`),disabled:o,onFiles:T,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:F(`layout.composerAttach`)}),(0,L.jsx)(Xm,{})]}),dictate:(0,L.jsx)(Th,{...E,look:Gm,face:e=>(0,L.jsx)(th,{state:e})}),voice:D?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Th,{...E,onSend:C,look:Km,idle:F(`voice.hold`),face:e=>(0,L.jsx)(eh,{state:e,idle:F(`voice.hold`),working:F(`voice.working`),slide:F(`voice.slideToSend`),release:F(`voice.tipSend`)})}),(0,L.jsx)(Zm,{label:F(`voice.type`),onClick:O})]}):void 0,composerKey:i,fieldRef:p,suggest:y.list,...y.field,onPaste:Fc(T).onPaste,onSend:()=>void w()})}var pR={up:`layout.termKeyUp`,down:`layout.termKeyDown`,left:`layout.termKeyLeft`,right:`layout.termKeyRight`,interrupt:`layout.termKeyInterrupt`,enter:`layout.termKeyEnter`};function mR({handle:e,atMenu:t}){I();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,L.jsx)(`button`,{type:`button`,className:lt(!1),"aria-label":pR[e.id]?F(pR[e.id]):void 0,onClick:()=>{r(!1),i.input(e.bytes(i.modes.applicationCursorKeysMode),!0)},children:e.cap},e.id);return(0,L.jsxs)(`div`,{className:`mono ${ct}`,role:`toolbar`,"aria-label":F(`layout.termKeys`),onPointerDown:e=>e.preventDefault(),children:[t&&jd.map(a),(0,L.jsx)(`button`,{type:`button`,className:lt(n),"aria-pressed":n,onClick:()=>r(!n),children:`ctrl`}),kd.filter(e=>!(t&&jd.includes(e))).map(a)]})}var hR={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`},gR=`Rove Nerd Symbols`,_R=[`"JetBrains Mono"`,`"${gR}"`,`"SF Mono"`,`ui-monospace`,`Menlo`,`monospace`].join(`, `);function vR(e){switch(e.kind){case`restored`:return F(`workspace.restored`);case`notLive`:return F(`workspace.tabNotLive`);case`exited`:return F(`workspace.exited`,{code:e.code??`?`});case`failed`:return F(`workspace.attachFailed`,{message:e.message});case`none`:return``}}function yR(e){I();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?F(`workspace.reopenFailed`,{message:o.error}):s?F(`workspace.engineExited`,{code:s.code??`?`}):c?d?F(`workspace.usageLimitUntil`,{time:new Date(d).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}):F(`workspace.usageLimit`):vR(t);return(0,L.jsxs)(`div`,{className:Vt(t.kind===`failed`||!!o.error),children:[(0,L.jsx)(`span`,{children:m}),e.onReopen&&(f||s)&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,disabled:o.busy,onClick:()=>e.onReopen?.(s!==null),children:o.busy?F(`workspace.reopening`):F(s?`workspace.retry`:`workspace.reopen`)}),t.kind===`failed`&&e.onRetryAttach&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:e.onRetryAttach,children:F(`workspace.retry`)}),c&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(R,{variant:`link`,hit:`tight`,onClick:()=>B.set((0,L.jsx)(X,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:F(`menu.continueEngine`)}),(0,L.jsx)(R,{variant:`link`,hit:`tight`,disabled:l,onClick:()=>{u(!0),r.client.request(`task.resumeQuota`,{taskId:i}).catch(e=>H(e instanceof Error?e.message:String(e),`error`)).finally(()=>u(!1))},children:F(l?`workspace.resumingQuota`:`workspace.resumeQuota`)}),(0,L.jsx)(R,{variant:`link`,hit:`tight`,onClick:e.onDismissLimit,children:F(`workspace.dismiss`)})]}),p&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>B.set((0,L.jsx)(zx,{model:r,section:`engines`})),children:F(`workspace.engineSettings`)}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>B.set((0,L.jsx)(X,{model:r,taskId:i})),children:F(`menu.newChatPick`)}),(0,L.jsx)(R,{variant:`link`,hit:`tight`,onClick:()=>B.set((0,L.jsx)(X,{model:r,taskId:i,context:`continue`,sourceTabId:a})),children:F(`menu.continueEngine`)})]})]})}function bR(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 xR(e){let t=document.querySelector(`[data-composer="${CSS.escape(e)}"]`);return t&&t.offsetParent!==null?t:null}function SR(e,t,n,r){let i=bR(e.term.getSelection());if(i===null)return!1;let a=aR(t,n),o=xR(a);if(o){lR(a,i),e.term.clearSelection();let t=o.querySelector(`textarea`);return t?.focus(),t?.setSelectionRange(t.value.length,t.value.length),!0}return r?(H(F(`quote.atMenu`),`error`),!1):e.term.modes.bracketedPasteMode?(e.term.paste(i),e.term.clearSelection(),e.term.focus(),!0):(H(F(`quote.notReady`),`error`),!1)}async function CR(e,t,n){let r=Pw(n);r.length<n.length&&H(F(`layout.dropUnsupported`),`error`);for(let n of r)try{t.term.paste(`${await Iw(e,n)} `)}catch(e){H(e instanceof Error?e.message:String(e),`error`)}t.term.focus()}async function wR(){if(!navigator.clipboard?.read)throw Error(F(`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 Pw(e)}async function TR(e,t){let n;try{n=await wR()}catch(e){H(F(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?H(F(`layout.pasteNoImage`),`error`):await CR(e,t,n)}async function ER(e){try{return await navigator.clipboard.writeText(e),!0}catch{return H(F(`menu.copyFailed`),`error`),!1}}function DR(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=_(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;I();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,(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 "${gR}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||yd({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:g.current.focused!==!1},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(g.current.onActivate?.(),ka.set(ja(t)??null)):ka.get()?.stream===t&&ka.set(null)},onExit:()=>{nR(Dl(n,r,i))||g.current.onExit?.()},copyText:ER,pasteImage:async()=>{a&&await TR(t,a.handle)}}).then(e=>{s?e.release():(a=e,u(e.handle))})};return vd(t,n,r,i)?d():Promise.allSettled(l).then(d),()=>{s=!0,u(null),a?.release()}},[t,n,r,i]);let[v,y]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!l)return;y(l.term.hasSelection());let e=l.term.onSelectionChange(()=>y(l.term.hasSelection()));return()=>{e.dispose(),y(!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&&(ER(t),e.clearSelection(),!0)},reset:()=>{let o={cols:e.cols,rows:e.rows};B.set((0,L.jsx)(Er,{title:uc(`reset.title`),body:uc(`reset.body`),confirmLabel:F(`workspace.reset`),onConfirm:async()=>{eR(a);try{await t.request(`tab.split`,{taskId:n,tabId:r,action:`reset`,leafId:i??`leaf-1`,...o}),await l.reattach(),e.focus()}finally{tR(a)}}}))},size:()=>({cols:e.cols,rows:e.rows})},s=Aa(o);return document.activeElement===e.textarea&&ka.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 b=!i||i===`leaf-1`,[x,S]=(0,h.useState)(null),C=e.engineExit?.since===x,[w,T]=(0,h.useState)(null),E=e.usageLimit&&e.usageLimit.since!==w?e.usageLimit:null,D=(0,h.useRef)(!1),O=async(i,a)=>{if(!D.current){D.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(),S(e.engineExit?.since??null),m({busy:!1,error:null})}catch(e){m({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{D.current=!1}}};return(0,L.jsxs)(`div`,{className:Ft,"data-stream":Dl(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),CR(t,l,Array.from(e.dataTransfer.files)))},onPasteCapture:e=>{if(!l)return;let n=Pw(e.clipboardData.files);(n.length!==0||e.clipboardData.getData(`text/plain`)===``)&&(e.preventDefault(),e.stopPropagation(),n.length>0?CR(t,l,n):TR(t,l))},children:[(0,L.jsxs)(`div`,{className:It,children:[(0,L.jsx)(`div`,{className:Lt,ref:o}),(0,L.jsx)(yR,{notice:s,engineExit:C?null:e.engineExit??null,model:e.model,taskId:n,tabId:r,revive:p,onReopen:b&&l?e=>void O(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0,usageLimit:E!==null,onDismissLimit:E?()=>T(E.since):void 0}),v&&e.composer&&l&&(0,L.jsx)(R,{variant:`floating`,className:`absolute top-2.5 right-2.5 z-4`,title:F(`quote.title`),onClick:()=>SR(l,n,r,a),children:F(`quote.action`)}),d>0&&l&&(0,L.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,L.jsx)(`span`,{className:`text-warning`,children:uc(`scrolledBack`,{lines:d})}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToTop(),children:uc(`scrollFirst`)}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:uc(`scrollLatest`)})]})]}),e.composer&&(0,L.jsx)(fR,{model:e.model,taskId:n,tabId:r}),l&&(0,L.jsx)(mR,{handle:l,atMenu:a})]})}var OR=e=>YO(e)!==null,kR=e=>bu(YO(e)?.tab.split);function AR(e){let t=YO(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:KO(t.taskId,t.tab,n)}:null}ba(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:OR,run:e=>{let t=YO(e);t&&ZO(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:OR,run:e=>{let t=YO(e);t&&ZO(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:kR,run:e=>{let t=AR(e);t&&JO(t.taskId,t.tab,t.split,Su(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:kR,run:e=>{let t=AR(e);t&&QO(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:kR,run:e=>{let t=AR(e);t&&$O(e,t.taskId,t.tab,t.leaf)}}]);var jR=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function MR({model:e,taskId:t,tab:n}){let r=n.split;_(GO);let i=r?KO(t,n,r):`leaf-1`,a=r?Cu(r,_u(n)):new Map,o=bu(r),{prefs:s}=Bg(),c=_(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,L.jsx)(`div`,{className:rt,children:(r?xu(r.root):jR).map(c=>(0,L.jsxs)(`div`,{className:ot(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,L.jsx)(DR,{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&&qO(t,n.id,r,c.id),onExit:()=>{o?XO(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,L.jsx)(`span`,{className:st(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>xM(r,nk(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var NR=/^[0-9a-f]{7,40}$/i;function PR(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||(NR.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}function FR(e,t){let n=[];for(let r=PR(e,t);r&&n.length<20&&!n.includes(r);r=PR(e,r))n.unshift(r);let r=e.filter(n=>!n.deleting&&PR(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&&!NR.test(i.baseRef)?i.baseRef:null;return{nodes:[...n,t,...r],at:n.length,base:a}}var IR=e=>e.pr?.lifecycle===`merged`;function LR(e){return e.nodes.find(e=>!IR(e))??null}function RR({model:e,taskId:t}){I();let n=_(e.tasks)?.tasks??[],r=n.find(e=>e.id===t),i=r?FR(n,r):null;if(!i)return null;let a=LR(i);return(0,L.jsxs)(`nav`,{className:PC,"aria-label":F(`compare.stackLabel`),children:[i.base&&(0,L.jsxs)(`span`,{className:`text-subtle`,children:[i.base,` ←`]}),i.nodes.map((n,r)=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-x-3.5`,children:[r>0&&(0,L.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,L.jsxs)(R,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,L.jsx)(tw,{status:n.rowStatus}),n.label||n.title,IR(n)?(0,L.jsx)(`span`,{className:`text-accent`,children:`✓`}):n.pr?.number?(0,L.jsx)(`span`,{children:`PR`}):null,` ]`]})]},n.id)),a&&!a.machine&&(0,L.jsx)(R,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>void qx(e,a),children:F(`compare.landBottom`)})]})}function zR(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function BR({taskId:e}){I();let t=ws(e),n=_(bn),r=Ts(e)&&!n;return(0,L.jsx)(`div`,{className:HM,children:qo.map(n=>{let i=r&&!!jo(t,n);return(0,L.jsx)(`button`,{type:`button`,className:OM({on:i}),title:F(`panel.${n}`),"aria-label":F(`panel.${n}`),"aria-pressed":i,onClick:()=>Os(e,n),children:(0,L.jsx)(XM,{children:ZM[n]})},n)})})}function VR({model:e,task:t,tabs:n,narrow:r}){let i=_(e.selection),{prefs:a}=Bg(),o=!zR(a.tabStrip,n.length);return(0,L.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,L.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=>xM(r,fn(yk(e,t,n),F(`menu.more`))),children:[(0,L.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),_u(n)]},n.id)),!r&&(0,L.jsx)(BR,{taskId:t.id})]})}function HR(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function UR({model:e}){let t=I()===`zh`?ti:ei,n=e.client,[r,i]=(0,h.useState)(()=>(q(n,`worktrees.list`,{network:!0})??q(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=>El(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&&H(HR(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`){B.set((0,L.jsx)(Er,{title:t.delete.forceTitle,body:`${HR(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${HR(t.delete.forceReason,{reason:U(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>_(e,!0)}));return}H(HR(t.delete.failed,{error:U(n)}),`error`)}},v=e=>B.set((0,L.jsx)(Er,{title:t.delete.confirmTitle,body:HR(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{_(e,!1)}})),y=n=>{if(!n.taskId){H(t.land.noTask,`error`);return}qx(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(),V.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`)V.set(null);else return;e.preventDefault()},x=0;return(0,L.jsxs)(`div`,{className:Kv,tabIndex:0,ref:d,onKeyDown:b,children:[(0,L.jsx)(`h1`,{className:qv,children:t.title}),r===null?(0,L.jsx)(`p`,{className:`text-muted`,children:t.loading}):f.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):f.map(e=>{let n=x;return x+=e.worktrees.length,(0,L.jsxs)(`section`,{className:Nv,children:[(0,L.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,L.jsx)(`span`,{children:e.repo}),(0,L.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,L.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,L.jsxs)(`div`,{"data-row":i,className:Pv(i===m),onClick:()=>c(i),children:[(0,L.jsxs)(`div`,{className:Fv,children:[(0,L.jsx)(`span`,{className:Lv,children:e.branch||t.row.detached}),e.roveManaged&&(0,L.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,L.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,L.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,L.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,L.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,L.jsxs)(`div`,{className:`${Iv} mono text-muted`,children:[(0,L.jsx)(`span`,{className:Rv,children:e.path}),e.createdAtMs>0&&(0,L.jsx)(`span`,{children:HR(t.row.created,{age:xc(Date.now()-e.createdAtMs)})})]}),i===m&&(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>v(e),children:t.delete.button}),e.taskId&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>y(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,L.jsx)(`p`,{className:`${zv} mono keys-only text-muted`,children:(0,L.jsx)(Ld,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function WR({model:e,narrow:t}){let n=_(e.selection),r=_(e.tabs),i=_(e.tasks),a=_(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=sa(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=_(V),f=eb(s?.id),p=s?.rowStatus?.kind===`running`,m=_(Cn),g=_(Jo)!==`terminal`&&t&&!!s;return(0,h.useEffect)(()=>{let t=e.selection.get();return e.selection.subscribe(()=>{Cn.set(null);let n=e.selection.get();(n.taskId!==t.taskId||n.tabId!==t.tabId)&&Jo.set(`terminal`),t=n})},[e]),(0,h.useEffect)(()=>BS(e),[e]),d===`update`?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(pN,{}),(0,L.jsx)(yy,{client:e.client})]}):d===`worktrees`?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(pN,{}),(0,L.jsx)(UR,{model:e})]}):d?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(pN,{}),(0,L.jsx)(gO,{model:e,page:d})]}):m?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(pN,{}),(0,L.jsx)(`div`,{className:Nt,children:(0,L.jsx)(kh,{model:e,seed:m},`${m.machine??``}\0${m.repo??``}\0${m.ungrouped?`u`:``}\0${m.retryOf?.id??``}`)})]}):(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(pN,{taskId:s?.id}),s&&(0,L.jsx)(VR,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,L.jsx)(RR,{model:e,taskId:s.id}),s?.groupId&&(0,L.jsx)(ZL,{model:e,taskId:s.id,groupId:s.groupId}),(0,L.jsxs)(`div`,{className:`${Nt} ${p?Pt:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,L.jsx)(bM,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,L.jsx)(`p`,{className:At,children:F(`workspace.pickTask`)}),c?.machine&&(0,L.jsx)(`div`,{className:jt,children:(0,L.jsx)(kf,{host:c.machine.label,onMachines:()=>Zh(e)})}),s&&u&&l.length===0&&!g&&(0,L.jsxs)(`div`,{className:jt,children:[(0,L.jsx)(`p`,{children:F(`workspace.noTabs`)}),(0,L.jsx)(R,{variant:`filled`,onClick:()=>void Il(e,s.id,{kind:`engine`}).catch(e=>H(String(e),`error`)),children:s.engine?F(`workspace.startEngine`,{engine:s.engine.name}):F(`workspace.startSession`)}),` `,(0,L.jsx)(R,{variant:`filled`,onClick:()=>void Fl(e,s.id),children:F(`menu.newChat`)}),` `,(0,L.jsx)(R,{variant:`filled`,onClick:()=>B.set((0,L.jsx)(X,{model:e,taskId:s.id})),children:F(`menu.newChatPick`)})]}),s&&g&&(0,L.jsx)(UL,{model:e,task:s,narrow:!0}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,L.jsx)(`div`,{className:`min-w-0 flex-1 ${g?`hidden`:`flex`}`,children:(0,L.jsx)(MR,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})]})}function GR({model:e}){I();let t=_(e.client.conn);return t.hello===null&&t.failures>=2?(0,L.jsx)(KR,{}):(0,L.jsx)(qR,{model:e})}function KR(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{eo().then(t)},[]),e===null?null:e?(0,L.jsx)(ao,{}):(0,L.jsx)(dn,{failing:!0})}function qR({model:e}){_S(e);let t=_(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;Cy(e.client,t.roveVersion);let n=()=>void hy(e.client).then(YL);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),zu(e),Iu(e),Ia(),gi(e.client),ES(e),G(e.client),wb(e.client),(0,h.useEffect)(()=>{e.onSelect=Ba;let t=Cn.subscribe(()=>{Cn.get()!==null&&Ba()});return En(),t},[e]),(0,h.useEffect)(()=>rx(e),[e]);let n=_(bn),r=_(e.selection),i=_(e.tasks),a=_(e.remote),o=Ja(),s=_(Lk),c=_(Rk),l=_(Ik),u=_(za),d=_(Zo),f=_($o),p=_(V),m=_(Nn)===`drag`,g=_(Cn)!==null,v=a.find(e=>e.id===r.taskId&&!e.machine?.stale),y=sa(i,r.taskId)??v??null,b=v?void 0:a.find(e=>e.id===r.taskId),x=Ts(y?.id??null),S=ws(y?.id??``).columns.length,C=o?Ya(u,!!y||!!b,p!==null||g):null;(0,h.useEffect)(()=>e.setTaskShown(C===null||C===`content`&&p===null&&!g),[e,C,p,g]);let w=Vk(l??280),T=s?0:w,E=d===null?ts(S,T):es(d,T),D={"--rail-w":`${s?0:w}px`,"--rail-open-w":`${w}px`,"--panel-w":E===null?void 0:`${E}px`};return(0,L.jsxs)(`div`,{className:Ke,children:[(0,L.jsx)(Ai,{onRefresh:()=>ki(e.client)}),(0,L.jsxs)(`div`,{className:qe({zen:n||!x||!y&&!b||o,expanded:f&&!n&&!o,surface:C,folded:s&&!o,peek:s&&c&&!o,dragging:m}),style:o?void 0:D,children:[!o&&(0,L.jsx)(dN,{model:e}),s&&!o&&(0,L.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:F(`layout.railUnfold`),onMouseEnter:()=>Bk(!0),onMouseLeave:()=>Bk(!1),onMouseUp:()=>Lk.set(!1)}),(0,L.jsx)(SM,{model:e,narrow:o}),(0,L.jsx)(WR,{model:e,narrow:o}),!o&&(0,L.jsx)(UL,{model:e,task:y,remoteHost:b?.machine?.label}),(0,L.jsx)(GL,{model:e}),(0,L.jsx)(uo,{}),(0,L.jsx)(SS,{model:e}),(0,L.jsx)(da,{model:e})]})]})}var JR=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function YR(e){return[...e.querySelectorAll(JR)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function XR(){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=YR(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 ZR(e){if(!An())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 QR(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function $R(){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 ez(){let e=B.get(),t=-1/0;B.subscribe(()=>{let n=B.get();if(n===null&&e!==null)t=performance.now(),ZR(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;QR(`.overlay`),n&&requestAnimationFrame($R)}e=n});let n=mn.get();mn.subscribe(()=>{let e=mn.get();e===null&&n!==null?ZR(`.menu`):e!==null&&QR(`.menu`),n=e});let r=Ju.get().guide;Ju.subscribe(()=>{let e=Ju.get().guide;e===null&&r!==null?ZR(`.prefix-guide`):e!==null&&QR(`.prefix-guide`),r=e})}var tz=500,nz=10,rz=`input, textarea, select, [contenteditable], .xterm`,iz=[`mousedown`,`mouseup`,`click`,`contextmenu`];function az(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of iz)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of iz)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(rz))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())},tz)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>nz&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function oz(e,t){e.viewingExtras=()=>is({narrow:Ka(),panelOpen:Qo.get(),zen:bn.get()});let n=()=>e.reportViewing();Qo.subscribe(n),bn.subscribe(n),qa(n),t.on(`panel`,t=>{rs(t)&&Is(t,e.selection.get().taskId)})}function sz(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function cz({client:e,prompt:t}){let n=(I()===`zh`?jr:Ar).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=wr();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,L.jsx)(Cr,{title:t.title,children:(0,L.jsxs)(`form`,{className:qn,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,L.jsx)(`input`,{className:ln,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,L.jsx)(`p`,{className:`text-error`,children:s}),(0,L.jsx)(Or,{busy:o,submitLabel:n.submitLabel})]})})}function lz(e,t){B.get()||B.set((0,L.jsx)(cz,{client:e,prompt:t},t.promptId))}var uz=900,dz=new WeakMap;function fz(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(dz.get(e)),dz.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),uz))}function pz(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&fz(t)},{capture:!0,passive:!0})}var mz=`rove-web.reloadedFor`;function hz(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function gz(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function _z(e,t=gz()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(mz)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=hz(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(mz,o.roveVersion)}catch{}t.reload()}})}function vz(){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 yz=(0,m.createRoot)(document.getElementById(`root`));vz(),az(),pz(),ez(),XR(),Xj();function bz(e){let t=new td(nd(),e),n=new la(t);t.on(`prompt`,e=>{sz(e)&&lz(t,e)}),oz(n,t),_z(t),t.start(),yz.render((0,L.jsx)(h.StrictMode,{children:(0,L.jsx)(GR,{model:n})}))}var xz=i();xz?bz(xz):Promise.all([to(),eo()]).then(([e,t])=>{e?bz(``):yz.render((0,L.jsx)(h.StrictMode,{children:t?(0,L.jsx)(ao,{}):(0,L.jsx)(dn,{})}))});export{Fg as a,Dl as c,Rt as d,Bt as f,By as i,yn as l,_R as n,Md as o,hR as r,Zu as s,fz as t,Nn as u};
|
|
63
|
+
`)}\n${r}\n`}function xR(e){let t=document.querySelector(`[data-composer="${CSS.escape(e)}"]`);return t&&t.offsetParent!==null?t:null}function SR(e,t,n,r){let i=bR(e.term.getSelection());if(i===null)return!1;let a=aR(t,n),o=xR(a);if(o){lR(a,i),e.term.clearSelection();let t=o.querySelector(`textarea`);return t?.focus(),t?.setSelectionRange(t.value.length,t.value.length),!0}return r?(H(F(`quote.atMenu`),`error`),!1):e.term.modes.bracketedPasteMode?(e.term.paste(i),e.term.clearSelection(),e.term.focus(),!0):(H(F(`quote.notReady`),`error`),!1)}async function CR(e,t,n){let r=Pw(n);r.length<n.length&&H(F(`layout.dropUnsupported`),`error`);for(let n of r)try{t.term.paste(`${await Iw(e,n)} `)}catch(e){H(e instanceof Error?e.message:String(e),`error`)}t.term.focus()}async function wR(){if(!navigator.clipboard?.read)throw Error(F(`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 Pw(e)}async function TR(e,t){let n;try{n=await wR()}catch(e){H(F(`layout.pasteNoAccess`,{error:e instanceof Error?e.message:String(e)}),`error`);return}n.length===0?H(F(`layout.pasteNoImage`),`error`):await CR(e,t,n)}async function ER(e){try{return await navigator.clipboard.writeText(e),!0}catch{return H(F(`menu.copyFailed`),`error`),!1}}function DR(e){let{client:t,taskId:n,tabId:r,leafId:i}=e,a=_(e.model.tasks)?.tasks.find(e=>e.id===n)?.tabStatus?.[r]?.kind===`needs-input`;I();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,(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 "${gR}"`,String.fromCodePoint(57504)).catch(()=>{});let d=()=>{s||yd({client:t,host:e,taskId:n,tabId:r,leafId:i,focusOnMount:g.current.focused!==!1},{setNotice:c,onScrolled:f,onFocusChange:e=>{if(!a)return;let{stream:t}=a.handle;e?(g.current.onActivate?.(),ka.set(ja(t)??null)):ka.get()?.stream===t&&ka.set(null)},onExit:()=>{nR(Dl(n,r,i))||g.current.onExit?.()},copyText:ER,pasteImage:async()=>{a&&await TR(t,a.handle)}}).then(e=>{s?e.release():(a=e,u(e.handle))})};return vd(t,n,r,i)?d():Promise.allSettled(l).then(d),()=>{s=!0,u(null),a?.release()}},[t,n,r,i]);let[v,y]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!l)return;y(l.term.hasSelection());let e=l.term.onSelectionChange(()=>y(l.term.hasSelection()));return()=>{e.dispose(),y(!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&&(ER(t),e.clearSelection(),!0)},reset:()=>{let o={cols:e.cols,rows:e.rows};B.set((0,L.jsx)(Er,{title:uc(`reset.title`),body:uc(`reset.body`),confirmLabel:F(`workspace.reset`),onConfirm:async()=>{eR(a);try{await t.request(`tab.split`,{taskId:n,tabId:r,action:`reset`,leafId:i??`leaf-1`,...o}),await l.reattach(),e.focus()}finally{tR(a)}}}))},size:()=>({cols:e.cols,rows:e.rows})},s=Aa(o);return document.activeElement===e.textarea&&ka.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 b=!i||i===`leaf-1`,[x,S]=(0,h.useState)(null),C=e.engineExit?.since===x,[w,T]=(0,h.useState)(null),E=e.usageLimit&&e.usageLimit.since!==w?e.usageLimit:null,D=(0,h.useRef)(!1),O=async(i,a)=>{if(!D.current){D.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(),S(e.engineExit?.since??null),m({busy:!1,error:null})}catch(e){m({busy:!1,error:e instanceof Error?e.message:String(e)})}finally{D.current=!1}}};return(0,L.jsxs)(`div`,{className:Ft,"data-stream":Dl(n,r,i),onDragOver:e=>e.dataTransfer.types.includes(`Files`)&&e.preventDefault(),onDrop:e=>{!e.dataTransfer.files.length||!l||(e.preventDefault(),CR(t,l,Array.from(e.dataTransfer.files)))},onPasteCapture:e=>{if(!l)return;let n=Pw(e.clipboardData.files);(n.length!==0||e.clipboardData.getData(`text/plain`)===``)&&(e.preventDefault(),e.stopPropagation(),n.length>0?CR(t,l,n):TR(t,l))},children:[(0,L.jsxs)(`div`,{className:It,children:[(0,L.jsx)(`div`,{className:Lt,ref:o}),(0,L.jsx)(yR,{notice:s,engineExit:C?null:e.engineExit??null,model:e.model,taskId:n,tabId:r,revive:p,onReopen:b&&l?e=>void O(l,e):void 0,onRetryAttach:l?()=>void l.reattach():void 0,usageLimit:E!==null,onDismissLimit:E?()=>T(E.since):void 0}),v&&e.composer&&l&&(0,L.jsx)(R,{variant:`floating`,className:`absolute top-2.5 right-2.5 z-4`,title:F(`quote.title`),onClick:()=>SR(l,n,r,a),children:F(`quote.action`)}),d>0&&l&&(0,L.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,L.jsx)(`span`,{className:`text-warning`,children:uc(`scrolledBack`,{lines:d})}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToTop(),children:uc(`scrollFirst`)}),(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>l.scrollToBottom(),children:uc(`scrollLatest`)})]})]}),e.composer&&(0,L.jsx)(fR,{model:e.model,taskId:n,tabId:r}),l&&(0,L.jsx)(mR,{handle:l,atMenu:a})]})}var OR=e=>YO(e)!==null,kR=e=>bu(YO(e)?.tab.split);function AR(e){let t=YO(e),n=t?.tab.split;return t&&n?{...t,split:n,leaf:KO(t.taskId,t.tab,n)}:null}ba(()=>[{id:`workspace.split.right`,chords:[`ctrl+\\`],prefix:!1,surface:`workspace`,live:OR,run:e=>{let t=YO(e);t&&ZO(e,t.taskId,t.tab,`right`)}},{id:`workspace.split.down`,chords:[`ctrl+=`],prefix:!1,surface:`workspace`,live:OR,run:e=>{let t=YO(e);t&&ZO(e,t.taskId,t.tab,`down`)}},{id:`workspace.split.focus-next`,chords:[`f3`],prefix:!1,surface:`workspace`,live:kR,run:e=>{let t=AR(e);t&&JO(t.taskId,t.tab,t.split,Su(t.split,t.leaf))}},{id:`workspace.split.close`,chords:[`w`],prefix:!0,surface:`workspace`,live:kR,run:e=>{let t=AR(e);t&&QO(e,t.taskId,t.tab,t.leaf)}},{id:`workspace.split.rename`,chords:[`f2`],prefix:!1,surface:`workspace`,live:kR,run:e=>{let t=AR(e);t&&$O(e,t.taskId,t.tab,t.leaf)}}]);var jR=[{id:`leaf-1`,x:0,y:0,w:1,h:1,left:!1,top:!1}];function MR({model:e,taskId:t,tab:n}){let r=n.split;_(GO);let i=r?KO(t,n,r):`leaf-1`,a=r?Cu(r,_u(n)):new Map,o=bu(r),{prefs:s}=Bg(),c=_(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,L.jsx)(`div`,{className:rt,children:(r?xu(r.root):jR).map(c=>(0,L.jsxs)(`div`,{className:ot(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,L.jsx)(DR,{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&&qO(t,n.id,r,c.id),onExit:()=>{o?XO(e,{taskId:t,tabId:n.id,action:`close`,leafId:c.id}):n.kind!==`engine`&&e.closeTab(t,n.id).catch(()=>{})}}),o&&(0,L.jsx)(`span`,{className:st(s.splitStyle===`rule`,c.id===i),onContextMenu:r=>xM(r,nk(e,t,n,c.id)),children:a.get(c.id)})]},c.id))})}var NR=/^[0-9a-f]{7,40}$/i;function PR(e,t){return t.sharesWorkspaceOf||!t.baseRef?null:e.find(e=>e.id!==t.id&&e.branch!==``&&e.branch===t.baseRef)||(NR.test(t.baseRef)&&t.parentTaskId?e.find(e=>e.id===t.parentTaskId)??null:null)}function FR(e,t){let n=[];for(let r=PR(e,t);r&&n.length<20&&!n.includes(r);r=PR(e,r))n.unshift(r);let r=e.filter(n=>!n.deleting&&PR(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&&!NR.test(i.baseRef)?i.baseRef:null;return{nodes:[...n,t,...r],at:n.length,base:a}}var IR=e=>e.pr?.lifecycle===`merged`;function LR(e){return e.nodes.find(e=>!IR(e))??null}function RR({model:e,taskId:t}){I();let n=_(e.tasks)?.tasks??[],r=n.find(e=>e.id===t),i=r?FR(n,r):null;if(!i)return null;let a=LR(i);return(0,L.jsxs)(`nav`,{className:PC,"aria-label":F(`compare.stackLabel`),children:[i.base&&(0,L.jsxs)(`span`,{className:`text-subtle`,children:[i.base,` ←`]}),i.nodes.map((n,r)=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-x-3.5`,children:[r>0&&(0,L.jsx)(`span`,{className:`text-subtle`,children:`←`}),(0,L.jsxs)(R,{variant:`pill`,hit:`tight`,"aria-current":n.id===t,onClick:()=>e.select(n.id),children:[`[ `,(0,L.jsx)(tw,{status:n.rowStatus}),n.label||n.title,IR(n)?(0,L.jsx)(`span`,{className:`text-accent`,children:`✓`}):n.pr?.number?(0,L.jsx)(`span`,{children:`PR`}):null,` ]`]})]},n.id)),a&&!a.machine&&(0,L.jsx)(R,{hit:`tight`,className:`ml-auto flex-none whitespace-nowrap`,onClick:()=>void qx(e,a),children:F(`compare.landBottom`)})]})}function zR(e,t){return e===`never`?!1:e!==`multipleOnly`||t>=2}function BR({taskId:e}){I();let t=ws(e),n=_(bn),r=Ts(e)&&!n;return(0,L.jsx)(`div`,{className:HM,children:qo.map(n=>{let i=r&&!!jo(t,n);return(0,L.jsx)(`button`,{type:`button`,className:OM({on:i}),title:F(`panel.${n}`),"aria-label":F(`panel.${n}`),"aria-pressed":i,onClick:()=>Os(e,n),children:(0,L.jsx)(XM,{children:ZM[n]})},n)})})}function VR({model:e,task:t,tabs:n,narrow:r}){let i=_(e.selection),{prefs:a}=Bg(),o=!zR(a.tabStrip,n.length);return(0,L.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,L.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=>xM(r,fn(yk(e,t,n),F(`menu.more`))),children:[(0,L.jsx)(`span`,{className:`text-subtle group-aria-selected/tab:text-accent`,children:r+1}),_u(n)]},n.id)),!r&&(0,L.jsx)(BR,{taskId:t.id})]})}function HR(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??e))}function UR({model:e}){let t=I()===`zh`?ti:ei,n=e.client,[r,i]=(0,h.useState)(()=>(q(n,`worktrees.list`,{network:!0})??q(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=>El(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&&H(HR(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`){B.set((0,L.jsx)(Er,{title:t.delete.forceTitle,body:`${HR(t.delete.forceBody,{branch:e.branch||e.path})}\n\n${HR(t.delete.forceReason,{reason:U(n)})}`,confirmLabel:t.delete.button,onConfirm:()=>_(e,!0)}));return}H(HR(t.delete.failed,{error:U(n)}),`error`)}},v=e=>B.set((0,L.jsx)(Er,{title:t.delete.confirmTitle,body:HR(t.delete.confirmBody,{branch:e.branch||e.path}),confirmLabel:t.delete.button,onConfirm:async()=>{_(e,!1)}})),y=n=>{if(!n.taskId){H(t.land.noTask,`error`);return}qx(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(),V.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`)V.set(null);else return;e.preventDefault()},x=0;return(0,L.jsxs)(`div`,{className:Kv,tabIndex:0,ref:d,onKeyDown:b,children:[(0,L.jsx)(`h1`,{className:qv,children:t.title}),r===null?(0,L.jsx)(`p`,{className:`text-muted`,children:t.loading}):f.length===0?(0,L.jsx)(`p`,{className:`text-muted`,children:t.noProjects}):f.map(e=>{let n=x;return x+=e.worktrees.length,(0,L.jsxs)(`section`,{className:Nv,children:[(0,L.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,L.jsx)(`span`,{children:e.repo}),(0,L.jsx)(`span`,{className:`rule`})]}),e.worktrees.length===0&&(0,L.jsx)(`p`,{className:`mono text-muted`,children:t.noWorktrees}),e.worktrees.map((e,r)=>{let i=n+r;return(0,L.jsxs)(`div`,{"data-row":i,className:Pv(i===m),onClick:()=>c(i),children:[(0,L.jsxs)(`div`,{className:Fv,children:[(0,L.jsx)(`span`,{className:Lv,children:e.branch||t.row.detached}),e.roveManaged&&(0,L.jsx)(`span`,{className:`chip text-muted`,children:t.badge.roveManaged}),e.dirty===!0&&(0,L.jsx)(`span`,{className:`chip text-warning`,children:t.badge.dirty}),e.dirty===null&&(0,L.jsx)(`span`,{className:`chip text-muted`,children:t.badge.dirtyUnknown}),(0,L.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,L.jsx)(`span`,{className:`chip ${e.verdict===`merged`?`text-success`:e.verdict===`stale`?`text-warning`:`text-accent`}`,children:t.verdict[e.verdictReason]??e.verdictReason})]}),(0,L.jsxs)(`div`,{className:`${Iv} mono text-muted`,children:[(0,L.jsx)(`span`,{className:Rv,children:e.path}),e.createdAtMs>0&&(0,L.jsx)(`span`,{children:HR(t.row.created,{age:xc(Date.now()-e.createdAtMs)})})]}),i===m&&(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2 text-[length:var(--fs-body)]`,children:[(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>v(e),children:t.delete.button}),e.taskId&&(0,L.jsx)(`button`,{type:`button`,className:`link text-accent [&:hover]:underline touch-hit`,onClick:()=>y(e),children:t.land.button})]})]},e.path)})]},e.repo)}),(0,L.jsx)(`p`,{className:`${zv} mono keys-only text-muted`,children:(0,L.jsx)(Ld,{text:`j/k · d ${t.delete.button} · l ${t.land.button} · q/esc`})})]})}function WR({model:e,narrow:t}){let n=_(e.selection),r=_(e.tabs),i=_(e.tasks),a=_(e.remote),o=a.find(e=>e.id===n.taskId&&!e.machine?.stale),s=sa(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=_(V),f=eb(s?.id),p=s?.rowStatus?.kind===`running`,m=_(Cn),g=_(Jo)!==`terminal`&&t&&!!s;return(0,h.useEffect)(()=>{let t=e.selection.get();return e.selection.subscribe(()=>{Cn.set(null);let n=e.selection.get();(n.taskId!==t.taskId||n.tabId!==t.tabId)&&Jo.set(`terminal`),t=n})},[e]),(0,h.useEffect)(()=>BS(e),[e]),d===`update`?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(pN,{}),(0,L.jsx)(yy,{client:e.client})]}):d===`worktrees`?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(pN,{}),(0,L.jsx)(UR,{model:e})]}):d?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(pN,{}),(0,L.jsx)(gO,{model:e,page:d})]}):m?(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(pN,{}),(0,L.jsx)(`div`,{className:Nt,children:(0,L.jsx)(kh,{model:e,seed:m},`${m.machine??``}\0${m.repo??``}\0${m.ungrouped?`u`:``}\0${m.retryOf?.id??``}`)})]}):(0,L.jsxs)(`main`,{className:`${Mt} ${Ye}`,children:[t&&(0,L.jsx)(pN,{taskId:s?.id}),s&&(0,L.jsx)(VR,{model:e,task:s,tabs:l,narrow:t}),s&&!s.groupId&&(0,L.jsx)(RR,{model:e,taskId:s.id}),s?.groupId&&(0,L.jsx)(ZL,{model:e,taskId:s.id,groupId:s.groupId}),(0,L.jsxs)(`div`,{className:`${Nt} ${p?Pt:``}`,style:f?{"--task-ink":f}:void 0,children:[!t&&!s&&!c&&i&&i.tasks.length+a.length===0&&(0,L.jsx)(bM,{model:e}),!s&&!c&&i&&i.tasks.length+a.length>0&&(0,L.jsx)(`p`,{className:At,children:F(`workspace.pickTask`)}),c?.machine&&(0,L.jsx)(`div`,{className:jt,children:(0,L.jsx)(kf,{host:c.machine.label,onMachines:()=>Zh(e)})}),s&&u&&l.length===0&&!g&&(0,L.jsxs)(`div`,{className:jt,children:[(0,L.jsx)(`p`,{children:F(`workspace.noTabs`)}),(0,L.jsx)(R,{variant:`filled`,onClick:()=>void Il(e,s.id,{kind:`engine`}).catch(e=>H(String(e),`error`)),children:s.engine?F(`workspace.startEngine`,{engine:s.engine.name}):F(`workspace.startSession`)}),` `,(0,L.jsx)(R,{variant:`filled`,onClick:()=>void Fl(e,s.id),children:F(`menu.newChat`)}),` `,(0,L.jsx)(R,{variant:`filled`,onClick:()=>B.set((0,L.jsx)(X,{model:e,taskId:s.id})),children:F(`menu.newChatPick`)})]}),s&&g&&(0,L.jsx)(UL,{model:e,task:s,narrow:!0}),s&&n.tabId&&l.some(e=>e.id===n.tabId)&&(0,L.jsx)(`div`,{className:`min-w-0 flex-1 ${g?`hidden`:`flex`}`,children:(0,L.jsx)(MR,{model:e,taskId:s.id,tab:l.find(e=>e.id===n.tabId)??l[0]},`${s.id}::${n.tabId}`)})]})]})}function GR({model:e}){I();let t=_(e.client.conn);return t.hello===null&&t.failures>=2?(0,L.jsx)(KR,{}):(0,L.jsx)(qR,{model:e})}function KR(){let[e,t]=(0,h.useState)(null);return(0,h.useEffect)(()=>{eo().then(t)},[]),e===null?null:e?(0,L.jsx)(ao,{}):(0,L.jsx)(dn,{failing:!0})}function qR({model:e}){_S(e);let t=_(e.client.conn).hello;(0,h.useEffect)(()=>{if(!t)return;Cy(e.client,t.roveVersion);let n=()=>void hy(e.client).then(YL);n();let r=window.setInterval(n,36e5);return()=>window.clearInterval(r)},[t,e.client]),zu(e),Iu(e),Ia(),gi(e.client),ES(e),G(e.client),wb(e.client),(0,h.useEffect)(()=>{e.onSelect=Ba;let t=Cn.subscribe(()=>{Cn.get()!==null&&Ba()});return En(),t},[e]),(0,h.useEffect)(()=>rx(e),[e]);let n=_(bn),r=_(e.selection),i=_(e.tasks),a=_(e.remote),o=Ja(),s=_(Lk),c=_(Rk),l=_(Ik),u=_(za),d=_(Zo),f=_($o),p=_(V),m=_(Nn)===`drag`,g=_(Cn)!==null,v=a.find(e=>e.id===r.taskId&&!e.machine?.stale),y=sa(i,r.taskId)??v??null,b=v?void 0:a.find(e=>e.id===r.taskId),x=Ts(y?.id??null),S=ws(y?.id??``).columns.length,C=o?Ya(u,!!y||!!b,p!==null||g):null;(0,h.useEffect)(()=>e.setTaskShown(C===null||C===`content`&&p===null&&!g),[e,C,p,g]);let w=Vk(l??280),T=s?0:w,E=d===null?ts(S,T):es(d,T),D={"--rail-w":`${s?0:w}px`,"--rail-open-w":`${w}px`,"--panel-w":E===null?void 0:`${E}px`};return(0,L.jsxs)(`div`,{className:Ke,children:[(0,L.jsx)(Ai,{onRefresh:()=>ki(e.client)}),(0,L.jsxs)(`div`,{className:qe({zen:n||!x||!y&&!b||o||g,expanded:f&&!n&&!o,surface:C,folded:s&&!o,peek:s&&c&&!o,dragging:m}),style:o?void 0:D,children:[!o&&(0,L.jsx)(dN,{model:e}),s&&!o&&(0,L.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-5 col-1 row-1 w-2.5`,title:F(`layout.railUnfold`),onMouseEnter:()=>Bk(!0),onMouseLeave:()=>Bk(!1),onMouseUp:()=>Lk.set(!1)}),(0,L.jsx)(SM,{model:e,narrow:o}),(0,L.jsx)(WR,{model:e,narrow:o}),!o&&(0,L.jsx)(UL,{model:e,task:y,remoteHost:b?.machine?.label}),(0,L.jsx)(GL,{model:e}),(0,L.jsx)(uo,{}),(0,L.jsx)(SS,{model:e}),(0,L.jsx)(da,{model:e})]})]})}var JR=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function YR(e){return[...e.querySelectorAll(JR)].filter(e=>e.tabIndex>=0&&e.offsetParent!==null)}function XR(){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=YR(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 ZR(e){if(!An())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 QR(e){for(let t of document.querySelectorAll(`${e}.is-leaving`))t.remove()}function $R(){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 ez(){let e=B.get(),t=-1/0;B.subscribe(()=>{let n=B.get();if(n===null&&e!==null)t=performance.now(),ZR(`.overlay`);else if(n!==null){let n=e!==null||performance.now()-t<140;QR(`.overlay`),n&&requestAnimationFrame($R)}e=n});let n=mn.get();mn.subscribe(()=>{let e=mn.get();e===null&&n!==null?ZR(`.menu`):e!==null&&QR(`.menu`),n=e});let r=Ju.get().guide;Ju.subscribe(()=>{let e=Ju.get().guide;e===null&&r!==null?ZR(`.prefix-guide`):e!==null&&QR(`.prefix-guide`),r=e})}var tz=500,nz=10,rz=`input, textarea, select, [contenteditable], .xterm`,iz=[`mousedown`,`mouseup`,`click`,`contextmenu`];function az(){let e=null,t=()=>{e&&window.clearTimeout(e.timer),e=null},n=()=>{let e=e=>{e.preventDefault(),e.stopPropagation()},t=()=>{for(let t of iz)document.removeEventListener(t,e,!0);document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`keydown`,t,!0)};for(let t of iz)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(rz))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())},tz)};e=a},!0),document.addEventListener(`pointermove`,n=>{e&&Math.hypot(n.clientX-e.x,n.clientY-e.y)>nz&&t()},!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`pointercancel`,t,!0),document.addEventListener(`contextmenu`,t=>{e&&t.isTrusted&&(e.native=!0)},!0)}function oz(e,t){e.viewingExtras=()=>is({narrow:Ka(),panelOpen:Qo.get(),zen:bn.get()});let n=()=>e.reportViewing();Qo.subscribe(n),bn.subscribe(n),qa(n),t.on(`panel`,t=>{rs(t)&&Is(t,e.selection.get().taskId)})}function sz(e){let t=e;return!!t&&typeof t.promptId==`string`&&typeof t.title==`string`}function cz({client:e,prompt:t}){let n=(I()===`zh`?jr:Ar).prompt,[r,i]=(0,h.useState)(t.initial??``),a=(0,h.useRef)(!1),{busy:o,error:s,submit:c}=wr();return(0,h.useEffect)(()=>()=>{a.current||e.request(`ui.promptReply`,{promptId:t.promptId}).catch(()=>{})},[e,t.promptId]),(0,L.jsx)(Cr,{title:t.title,children:(0,L.jsxs)(`form`,{className:qn,onSubmit:n=>{n.preventDefault(),c(async()=>{await e.request(`ui.promptReply`,{promptId:t.promptId,value:r}),a.current=!0})},children:[(0,L.jsx)(`input`,{className:ln,"aria-label":n.fieldLabel,autoFocus:!0,spellCheck:!1,value:r,placeholder:t.placeholder,onChange:e=>i(e.target.value)}),s&&(0,L.jsx)(`p`,{className:`text-error`,children:s}),(0,L.jsx)(Or,{busy:o,submitLabel:n.submitLabel})]})})}function lz(e,t){B.get()||B.set((0,L.jsx)(cz,{client:e,prompt:t},t.promptId))}var uz=900,dz=new WeakMap;function fz(e){e.setAttribute(`data-scrolling`,``),window.clearTimeout(dz.get(e)),dz.set(e,window.setTimeout(()=>e.removeAttribute(`data-scrolling`),uz))}function pz(){document.addEventListener(`scroll`,e=>{let t=e.target instanceof Element?e.target:document.scrollingElement;t&&fz(t)},{capture:!0,passive:!0})}var mz=`rove-web.reloadedFor`;function hz(e,t,n){return e===null?`adopt`:t===e||t===n?`stay`:`reload`}function gz(){let e=null;try{e=window.sessionStorage}catch{}return{storage:e,reload:()=>window.location.reload()}}function _z(e,t=gz()){let n=null,r=null,i=()=>{try{return t.storage?.getItem(mz)??r}catch{return r}};return e.conn.subscribe(()=>{let{state:a,hello:o}=e.conn.get();if(a!==`open`||!o)return;let s=hz(n,o.roveVersion,i());if(s===`adopt`&&(n=o.roveVersion),s===`reload`){r=o.roveVersion;try{t.storage?.setItem(mz,o.roveVersion)}catch{}t.reload()}})}function vz(){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 yz=(0,m.createRoot)(document.getElementById(`root`));vz(),az(),pz(),ez(),XR(),Xj();function bz(e){let t=new td(nd(),e),n=new la(t);t.on(`prompt`,e=>{sz(e)&&lz(t,e)}),oz(n,t),_z(t),t.start(),yz.render((0,L.jsx)(h.StrictMode,{children:(0,L.jsx)(GR,{model:n})}))}var xz=i();xz?bz(xz):Promise.all([to(),eo()]).then(([e,t])=>{e?bz(``):yz.render((0,L.jsx)(h.StrictMode,{children:t?(0,L.jsx)(ao,{}):(0,L.jsx)(dn,{})}))});export{Fg as a,Dl as c,Rt as d,Bt as f,By as i,yn as l,_R as n,Md as o,hR as r,Zu as s,fz as t,Nn as u};
|