@sma1lboy/rove 0.8.95 → 0.8.97
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/index.js +3 -3
- package/dist/cli/kobe.js +3 -3
- package/dist/cli/rove.js +3 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -282,8 +282,8 @@ ${z}`,Z);this.line=J,this.column=X,this.codeblock=z}}});function FL($,Z){let J=$
|
|
|
282
282
|
`)){let U=H.trim();if(!U)continue;if(!TJ(U))continue;let K;try{K=JSON.parse(U)}catch{continue}if(!WR(K)||typeof K.type!=="string")continue;let N=typeof K.timestamp==="string"?K.timestamp:new Date().toISOString(),L=WR(K.data)?K.data:{};if(K.type==="session.start"){let M=typeof L.sessionId==="string"?L.sessionId:void 0;if(M)z=M;continue}if(K.type==="user.message"){let M=typeof L.content==="string"?L.content:"";if(!M)continue;if(!W)W=Buffer.from(M.slice(0,LJ0),"utf8").toString("utf8");J.push({role:"user",blocks:[{type:"text",text:M}],timestamp:N,sessionId:z});continue}if(K.type==="assistant.message"){let M=[],V=typeof L.content==="string"?L.content:"";if(V)M.push({type:"text",text:V});let P=Array.isArray(L.toolRequests)?L.toolRequests:[];for(let _ of P){if(!WR(_))continue;let C=typeof _.id==="string"?_.id:typeof _.toolCallId==="string"?_.toolCallId:"tool",f=typeof _.name==="string"?_.name:typeof _.toolName==="string"?_.toolName:"tool";M.push({type:"tool_call",callId:C,name:f,input:_.arguments??{}})}if(M.length>0)J.push({role:"assistant",blocks:M,timestamp:N,sessionId:z});continue}if(K.type==="tool.execution_start"){let M=typeof L.toolCallId==="string"?L.toolCallId:void 0,V=typeof L.toolName==="string"?L.toolName:"tool";if(M)X.set(M,V);continue}if(K.type==="tool.execution_complete"){let M=typeof L.toolCallId==="string"?L.toolCallId:void 0;if(!M)continue;let V=X.get(M)??(typeof L.toolName==="string"?L.toolName:"tool"),P=L.result??(L.success===!1?{success:!1}:void 0);J.push({role:"assistant",blocks:[{type:"tool_result",callId:M,output:P,isError:L.success===!1}],timestamp:N,sessionId:z});continue}if(K.type==="session.shutdown")G=Vk(L)}return{messages:J,toolNameById:X,sessionId:z,usageMetrics:G,firstUserMessage:W}}function WR($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var OY,NJ0,LJ0=200;var Ak=a(()=>{AQ();wL();OY={copilotDir(){let $=process.env.COPILOT_HOME?.trim();if($)return $;return TQ.join(BJ0(),".copilot")},async readdir($){try{return await HJ0($)}catch{return[]}},async readFile($){return await DQ($)},stat:UJ0,async rm($){await qJ0($,{recursive:!0,force:!0})}};NJ0=yH({initial:MJ0,parseChunk:($,Z)=>OJ0($,Z)})});import{stat as VJ0}from"fs/promises";import{homedir as _J0}from"os";import kL from"path";function CJ0($){let Z=[];for(let J of $.split(`
|
|
283
283
|
`)){if(!J.trim())continue;try{let{sessionId:X,sessionDir:z,workDir:G}=JSON.parse(J);if(X&&z&&G)Z.push({sessionId:X,sessionDir:z,workDir:G})}catch{}}return Z}async function Pk($){let Z=await $.readFile(kL.join($.kimiDir(),"session_index.jsonl")).catch(()=>"");return CJ0(Z)}function Rk($){return kL.join($,"agents","main","wire.jsonl")}async function KR($,Z=BR){if(!$)return[];let J=[];for(let X of await Pk(Z)){if(X.workDir!==$)continue;let z=await Z.stat(Rk(X.sessionDir)).then((G)=>G.mtimeMs).catch(()=>null);if(z===null)continue;J.push({id:X.sessionId,mtimeMs:z})}return J.sort((X,z)=>X.mtimeMs-z.mtimeMs).map((X)=>X.id)}async function Tk($,Z=BR){return await Z.stat($).then((J)=>J.mtimeMs).catch(()=>0)}async function FR($,Z=BR){if(!$)return null;let J=(await Pk(Z)).find((z)=>z.sessionId===$);if(!J)return null;let X=Rk(J.sessionDir);return await Z.stat(X).then(()=>X).catch(()=>null)}var BR;var Sk=a(()=>{AQ();BR={kimiDir(){return process.env.KIMI_CODE_HOME?.trim()||kL.join(_J0(),".kimi-code")},async readFile($){return await DQ($)},stat:VJ0}});import AJ0 from"path";var vL,Ik,Ek,wk,xk;var fk=a(()=>{GR();fL();Ak();Sk();vL={async listSessionIdsForWorktree(){return[]},async readHistory(){return[]},async transcriptPath(){return null},async latestTranscriptMtimeForWorktree(){return 0}},Ik={async listSessionIdsForWorktree($){return[...await bH($)].sort((J,X)=>J.mtimeMs-X.mtimeMs).map((J)=>J.sessionId)},readHistory:($)=>Lk($),async transcriptPath($,Z){return(await bH(Z)).find((X)=>X.sessionId===$)?.path??null},latestTranscriptMtimeForWorktree:($)=>Ok($)},Ek={listSessionIdsForWorktree:($)=>Qk($),readHistory:($)=>Yk($),transcriptPath:async($)=>await XR($)??null,latestTranscriptMtimeForWorktree:($)=>zk($)},wk={listSessionIdsForWorktree:($)=>_k($),readHistory:($)=>Dk($),async transcriptPath($){let Z=await qR($);return Z?AJ0.join(Z,"events.jsonl"):null},latestTranscriptMtimeForWorktree:($)=>Ck($)},xk={listSessionIdsForWorktree:($)=>KR($),readHistory:vL.readHistory,transcriptPath:($)=>FR($),async latestTranscriptMtimeForWorktree($){let J=(await KR($)).at(-1);if(!J)return 0;let X=await FR(J);return X?await Tk(X):0}}});var mL,gk,yk;var hL=a(()=>{mL=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],gk=["\xB7","\u2722","\u2731","\u2736","\u273B","\u273D"],yk=[...gk,...[...gk].reverse()]});import{readFile as kk,stat as PJ0}from"fs/promises";class uL{supportsCompletionMarkers(){return!0}async latestCompletion($){return(await this.latestActivity($)).marker}async latestActivityInFile($){return null}}function vk($){return D$($).createTurnDetector()}function bk($,Z="claude",J=0){let X=null,z=0;for(let G of $.split(`
|
|
284
284
|
`)){z++;let W=hk(G);if(!W)continue;let H=OR(W.message)?W.message:W;if(H.role!=="assistant")continue;if(!("content"in H))continue;let U=uk(W,J),K={id:`claude:${Z}:${U}:${z}`,timestampMs:U,source:"claude"};if(!X||K.timestampMs>=X.timestampMs)X=K}return X}function IJ0($){if($.type==="turn.completed")return!0;if($.type!=="event_msg")return!1;let Z=OR($.payload)?$.payload:void 0;return typeof Z?.type==="string"&&SJ0.has(Z.type)}function EJ0($,Z="codex"){let J=null,X=0;for(let z of $.split(`
|
|
285
|
-
`)){X++;let G=hk(z);if(!G||!IJ0(G))continue;let W=uk(G,0),H={id:`codex:${Z}:${W}:${X}`,timestampMs:W,source:"codex"};if(!J||H.timestampMs>=J.timestampMs)J=H}return J}function hk($){let Z=$.trim();if(!Z)return null;try{let J=JSON.parse(Z);return OR(J)?J:null}catch{return null}}function uk($,Z){let J=typeof $.timestamp==="string"?Date.parse($.timestamp):Number.NaN;return Number.isFinite(J)?J:Z}function OR($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var mk=($)=>PJ0($).then((Z)=>Z.mtimeMs,()=>0),RJ0,MR,TJ0,NR,mK,SJ0;var LR=a(()=>{GR();fL();C7();RJ0={listSessionFiles:($)=>bH($),readFile:($)=>kk($,"utf8"),statMtimeMs:mk};MR=class MR extends uL{deps;vendor="claude";cache=new Map;constructor($=RJ0){super();this.deps=$}async latestActivity($){let Z=await this.deps.listSessionFiles($),J=Z[0]?.mtimeMs??0,X=null,z=new Map;for(let G of Z.slice(0,4)){let W=this.cache.get(G.path),H;if(W&&G.mtimeMs>0&&W.mtimeMs===G.mtimeMs)H=W.marker;else{let U=await this.deps.readFile(G.path).catch(()=>"");H=bk(U,G.path,G.mtimeMs)}if(z.set(G.path,{mtimeMs:G.mtimeMs,marker:H}),H&&(!X||H.timestampMs>X.timestampMs))X=H}return this.cache=z,{marker:X,mtimeMs:J}}async latestActivityInFile($){let Z=await(this.deps.statMtimeMs??mk)($);if(Z===0)return null;let J=await this.deps.readFile($).catch(()=>"");return{marker:bk(J,$,Z),mtimeMs:Z}}};TJ0={findLatestRollout:($)=>QR($),readFile:($)=>kk($,"utf8")};NR=class NR extends uL{deps;vendor="codex";cache=null;constructor($=TJ0){super();this.deps=$}async latestActivity($){if(!$)return{marker:null,mtimeMs:0};let Z=await this.deps.findLatestRollout($);if(!Z)return{marker:null,mtimeMs:0};if(this.cache&&this.cache.path===Z.path&&Z.mtimeMs>0&&this.cache.mtimeMs===Z.mtimeMs)return{marker:this.cache.marker,mtimeMs:Z.mtimeMs};let J=await this.deps.readFile(Z.path).catch(()=>"");if(!J)return{marker:null,mtimeMs:Z.mtimeMs};let X=EJ0(J,Z.path);return this.cache={path:Z.path,mtimeMs:Z.mtimeMs,marker:X},{marker:X,mtimeMs:Z.mtimeMs}}};mK=class mK extends uL{vendor;constructor($){super();this.vendor=$}supportsCompletionMarkers(){return!1}async latestActivity(){return{marker:null,mtimeMs:0}}};SJ0=new Set(["task_complete","turn_complete","turn_aborted"])});function wJ0($){return{vendor:$,builtin:!1,displayName:$,defaultCommand:[$],history:vL,detectAccount:async()=>({binary:{found:!1,error:"custom engine: Rove has no account detector for it"},account:{kind:"none"}}),createHookAdapter:()=>new hK($),createTurnDetector:()=>new mK($)}}function D$($){return h7($)?jR[$]:wJ0($)}function ck($){return D$($).history.readHistory!==vL.readHistory}function VR($){let Z=D$($).terminalTitle?.statusPrefixes;return Z&&Z.length>0?Z:dk}function kH($,Z){let J=Z?VR(Z):dk;for(let X of[...J].sort((z,G)=>G.length-z.length)){if(!$.startsWith(X))continue;let z=$.slice(X.length).trimStart();if(z.length===0)return $;return z}return $}function cL($,Z){let J=D$($).terminalTitle,X=J?.workingPrefixes;if(J?.ownsStatus!==!0||!X||X.length===0)return null;let z=Z.trim();if(z.length===0)return null;return X.some((G)=>z.startsWith(G))?"working":"rest"}function lk(){return Object.values(jR).filter(($)=>$.quotaUsage).map(($)=>$.vendor)}var jR,dk;var C7=a(()=>{u7();SJ();Sb();yb();ub();lb();nb();qk();fk();_R();hL();LR();jR={claude:{vendor:"claude",builtin:!0,displayName:"Claude",defaultCommand:["claude"],history:Ik,detectAccount:($)=>IH($),createHookAdapter:()=>new pP,createTurnDetector:()=>new MR,capabilities:Rb,identity:Tb,spinnerFrames:yk,terminalTitle:{ownsStatus:!0,statusPrefixes:["\u2733","\u2802","\u2810","\u25D0","\u25D1"],workingPrefixes:["\u2802","\u2810","\u25D0","\u25D1"]},quotaUsage:()=>hb()},codex:{vendor:"codex",builtin:!0,displayName:"Codex",defaultCommand:["codex"],effortLevels:["none","low","medium","high","xhigh"],history:Ek,detectAccount:($)=>EH($),createHookAdapter:()=>new aP,createTurnDetector:()=>new NR,capabilities:cb,identity:db,terminalTitle:{ownsStatus:!0,launchArgs:["-c",'tui.terminal_title=["activity","thread-title"]'],statusPrefixes:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],workingPrefixes:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},quotaUsage:()=>Hk()},copilot:{vendor:"copilot",builtin:!0,displayName:"Copilot",defaultCommand:["copilot"],history:wk,detectAccount:($)=>wH($),createHookAdapter:()=>new hK("copilot"),createTurnDetector:()=>new mK("copilot")},kimi:{vendor:"kimi",builtin:!0,displayName:"Kimi",defaultCommand:["kimi"],firstMessageDelivery:"paste",history:xk,detectAccount:($)=>TL($),createHookAdapter:()=>new hK("kimi"),createTurnDetector:()=>new mK("kimi")}};dk=[...new Set(Object.values(jR).flatMap(($)=>$.terminalTitle?.statusPrefixes??[]))]});function CR($){return D$($).createHookAdapter()}class hK{vendor;constructor($){this.vendor=$}supportsHooks(){return!1}globalSettingsPath(){return""}activityDetailFromPayload(){return}sessionFromPayload(){return}async installActivityHooks(){}async removeActivityHooks(){}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(){}async installWorktreeWatchHook(){}async removeWorktreeWatchHook(){}}var _R=a(()=>{C7()});function dL($){return xJ0.includes($)}function pk($){return fJ0.includes($)}var xJ0,fJ0;var DR=a(()=>{xJ0=["session-start","turn-start","turn-complete","turn-failed","turn-interrupted","awaiting-input","session-end","tool-pre","tool-post","tool-failed","pre-compact","post-compact","subagent-start","subagent-stop"];fJ0=["session-start","turn-start","turn-complete","turn-failed","turn-interrupted","awaiting-input","session-end"]});var Xv={};g$(Xv,{runHookSubcommand:()=>mJ0,readTextWithTimeout:()=>ak,parseWorktreeRemovePath:()=>ek,parseWorktreeAddPath:()=>tk,ensureGlobalKobeHooks:()=>PR});import{homedir as gJ0}from"os";import{join as ok,resolve as AR}from"path";async function ak($,Z=yJ0){let J;try{return await Promise.race([$(),new Promise((X)=>{J=setTimeout(()=>X(""),Z)})])}finally{if(J!==void 0)clearTimeout(J)}}async function rk(){try{let $=await ak(()=>Bun.stdin.text());if(!$.trim())return{};let Z=JSON.parse($);return Z&&typeof Z==="object"&&!Array.isArray(Z)?Z:{}}catch{return{}}}function nk($,Z){for(let J=0;J<$.length;J++){if($[J]===Z)return $[J+1];if($[J].startsWith(`${Z}=`))return $[J].slice(Z.length+1)}return}function kJ0($){return!!$&&typeof $==="object"&&!Array.isArray($)}function sk($){let Z=[],J=/"([^"]*)"|'([^']*)'|(\S+)/g,X;while((X=J.exec($))!==null)Z.push(X[1]??X[2]??X[3]??"");return Z}function tk($){let Z=sk($),J=new Set(["-b","-B","--reason"]);for(let X=0;X+1<Z.length;X++){if(Z[X]!=="worktree"||Z[X+1]!=="add")continue;let z=X+2;while(z<Z.length){let G=Z[z];if(G==="&&"||G==="||"||G===";"||G==="|"||G===">"||G===">>")break;if(G.startsWith("-")){z+=J.has(G)?2:1;continue}return G}}return}function ek($){let Z=sk($);for(let J=0;J+1<Z.length;J++){if(Z[J]!=="worktree"||Z[J+1]!=="remove")continue;let X=J+2;while(X<Z.length){let z=Z[X];if(z==="&&"||z==="||"||z===";"||z==="|"||z===">"||z===">>")break;if(z.startsWith("-")){X+=1;continue}return z}}return}async function vJ0(){let $=await rk(),Z=kJ0($.tool_input)?$.tool_input:{},J=typeof Z.command==="string"?Z.command:"";if(!J.includes("worktree"))return;let X=typeof $.cwd==="string"&&$.cwd?$.cwd:process.cwd(),z=tk(J),G=z?void 0:ek(J);if(!z&&!G)return;let W=await BQ();if(!W)return;try{if(z)await W.request("worktree.reconcile",{cwd:X,worktreePath:AR(X,z)});else if(G)await W.request("worktree.archiveRemoved",{worktreePath:AR(X,G)})}finally{W.close()}}async function mJ0($){let[Z,...J]=$;if(Z==="setup"){await dJ0(J);return}if(Z===bJ0){try{await vJ0()}catch{}return}try{if(!Z||!dL(Z))return;let X=await rk(),z=nk(J,"--task-id"),G=typeof X.cwd==="string"&&X.cwd?X.cwd:process.cwd(),W=process.env.KOBE_TASK_ID,H=process.env.KOBE_TAB_ID,U=nk(J,"--engine"),K=$v().filter((V)=>!U||V.vendor===U),N;for(let V of K)if(N=V.activityDetailFromPayload(Z,X),N)break;let L;for(let V of K)if(L=V.sessionFromPayload(X),L)break;let M=await BQ();if(!M)return;try{let V=z??W;await M.request("engine.reportEvent",{...V?{taskId:V}:{cwd:G},kind:Z,...U?{engine:U}:{},...H?{tabId:H}:{},...N?{detail:N}:{},...L?{sessionId:L.sessionId}:{},...L?.transcriptPath?{transcriptPath:L.transcriptPath}:{}})}finally{M.close()}}catch(X){if(process.env.KOBE_HOOK_DEBUG)console.error(`[rove hook] ${Z} failed:`,X instanceof Error?X.message:String(X))}}function hJ0(){return T8.map(($)=>CR($)).filter(($)=>$.supportsWorktreeSync())}function $v(){return T8.map(($)=>CR($)).filter(($)=>$.supportsHooks())}function Zv(){return ok(gJ0(),".claude","settings.json")}function uJ0($){if(!$||$==="off")return;if($==="global")return Zv();if($.startsWith("repo:"))return ok(AR($.slice(5)),".claude","settings.json");return $}async function PR(){try{let $=cJ0();for(let Z of $v()){let J=Z.globalSettingsPath();if(!J)continue;await Z.installActivityHooks(J,{toolEvents:$}),await Z.installWorktreeWatchHook(J)}await Jv()}catch{}}function cJ0(){try{for(let $ of j5().plugins){if(!$.enabled)continue;try{if(XZ($.root).manifest.events.some((Z)=>Z.on.startsWith("tool.")))return!0}catch{}}}catch{}return!1}async function Jv(){let $=hJ0();if($.length===0)return;let Z=l7(ik),J=new Set([Zv()]),X=uJ0(Z);if(X)J.add(X);for(let z of $)for(let G of J)await z.removeWorktreeSyncHook(G);if(Z!=="off")o3(ik,"off")}async function dJ0($){await Jv(),process.stdout.write(["rove hook setup is deprecated and now a no-op (cleanup only).","","The old external-worktree sync used a global WorktreeCreate hook, which is","a VCS provider hook \u2014 its presence broke `claude --worktree` / EnterWorktree","in every repo. Any hook Rove previously installed has been removed.","","Sync is now automatic: a `claude --worktree` (or any session) started in a","worktree under a repo Rove already tracks is adopted as a task on launch.","To adopt existing worktrees on demand, use the New Task dialog or `rove adopt`.",""].join(`
|
|
286
|
-
`))}var yJ0=500,bJ0="worktree-created",ik="externalWorktreeSync";var RR=a(()=>{C2();jQ();RJ();_R();DR();b4();u7()});var lL;var Qv=a(()=>{lL={$schema:"https://json.schemastore.org/package.json",name:"@sma1lboy/rove",version:"0.8.
|
|
285
|
+
`)){X++;let G=hk(z);if(!G||!IJ0(G))continue;let W=uk(G,0),H={id:`codex:${Z}:${W}:${X}`,timestampMs:W,source:"codex"};if(!J||H.timestampMs>=J.timestampMs)J=H}return J}function hk($){let Z=$.trim();if(!Z)return null;try{let J=JSON.parse(Z);return OR(J)?J:null}catch{return null}}function uk($,Z){let J=typeof $.timestamp==="string"?Date.parse($.timestamp):Number.NaN;return Number.isFinite(J)?J:Z}function OR($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var mk=($)=>PJ0($).then((Z)=>Z.mtimeMs,()=>0),RJ0,MR,TJ0,NR,mK,SJ0;var LR=a(()=>{GR();fL();C7();RJ0={listSessionFiles:($)=>bH($),readFile:($)=>kk($,"utf8"),statMtimeMs:mk};MR=class MR extends uL{deps;vendor="claude";cache=new Map;constructor($=RJ0){super();this.deps=$}async latestActivity($){let Z=await this.deps.listSessionFiles($),J=Z[0]?.mtimeMs??0,X=null,z=new Map;for(let G of Z.slice(0,4)){let W=this.cache.get(G.path),H;if(W&&G.mtimeMs>0&&W.mtimeMs===G.mtimeMs)H=W.marker;else{let U=await this.deps.readFile(G.path).catch(()=>"");H=bk(U,G.path,G.mtimeMs)}if(z.set(G.path,{mtimeMs:G.mtimeMs,marker:H}),H&&(!X||H.timestampMs>X.timestampMs))X=H}return this.cache=z,{marker:X,mtimeMs:J}}async latestActivityInFile($){let Z=await(this.deps.statMtimeMs??mk)($);if(Z===0)return null;let J=await this.deps.readFile($).catch(()=>"");return{marker:bk(J,$,Z),mtimeMs:Z}}};TJ0={findLatestRollout:($)=>QR($),readFile:($)=>kk($,"utf8")};NR=class NR extends uL{deps;vendor="codex";cache=null;constructor($=TJ0){super();this.deps=$}async latestActivity($){if(!$)return{marker:null,mtimeMs:0};let Z=await this.deps.findLatestRollout($);if(!Z)return{marker:null,mtimeMs:0};if(this.cache&&this.cache.path===Z.path&&Z.mtimeMs>0&&this.cache.mtimeMs===Z.mtimeMs)return{marker:this.cache.marker,mtimeMs:Z.mtimeMs};let J=await this.deps.readFile(Z.path).catch(()=>"");if(!J)return{marker:null,mtimeMs:Z.mtimeMs};let X=EJ0(J,Z.path);return this.cache={path:Z.path,mtimeMs:Z.mtimeMs,marker:X},{marker:X,mtimeMs:Z.mtimeMs}}};mK=class mK extends uL{vendor;constructor($){super();this.vendor=$}supportsCompletionMarkers(){return!1}async latestActivity(){return{marker:null,mtimeMs:0}}};SJ0=new Set(["task_complete","turn_complete","turn_aborted"])});function wJ0($){return{vendor:$,builtin:!1,displayName:$,defaultCommand:[$],history:vL,detectAccount:async()=>({binary:{found:!1,error:"custom engine: Rove has no account detector for it"},account:{kind:"none"}}),createHookAdapter:()=>new hK($),createTurnDetector:()=>new mK($)}}function D$($){return h7($)?jR[$]:wJ0($)}function ck($){return D$($).history.readHistory!==vL.readHistory}function VR($){let Z=D$($).terminalTitle?.statusPrefixes;return Z&&Z.length>0?Z:dk}function kH($,Z){let J=Z?VR(Z):dk;for(let X of[...J].sort((z,G)=>G.length-z.length)){if(!$.startsWith(X))continue;let z=$.slice(X.length).trimStart();if(z.length===0)return $;return z}return $}function cL($,Z){let J=D$($).terminalTitle,X=J?.workingPrefixes;if(J?.ownsStatus!==!0||!X||X.length===0)return null;let z=Z.trim();if(z.length===0)return null;return X.some((G)=>z.startsWith(G))?"working":"rest"}function lk(){return Object.values(jR).filter(($)=>$.quotaUsage).map(($)=>$.vendor)}var jR,dk;var C7=a(()=>{u7();SJ();Sb();yb();ub();lb();nb();qk();fk();_R();hL();LR();jR={claude:{vendor:"claude",builtin:!0,displayName:"Claude",defaultCommand:["claude"],history:Ik,detectAccount:($)=>IH($),createHookAdapter:()=>new pP,createTurnDetector:()=>new MR,capabilities:Rb,identity:Tb,spinnerFrames:yk,terminalTitle:{ownsStatus:!0,statusPrefixes:["\u2733","\u2802","\u2810","\u25D0","\u25D1"],workingPrefixes:["\u2802","\u2810","\u25D0","\u25D1"]},quotaUsage:()=>hb()},codex:{vendor:"codex",builtin:!0,displayName:"Codex",defaultCommand:["codex"],effortLevels:["none","low","medium","high","xhigh"],history:Ek,detectAccount:($)=>EH($),createHookAdapter:()=>new aP,createTurnDetector:()=>new NR,capabilities:cb,identity:db,terminalTitle:{ownsStatus:!0,launchArgs:["-c",'tui.terminal_title=["activity","thread-title"]'],statusPrefixes:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],workingPrefixes:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},quotaUsage:()=>Hk()},copilot:{vendor:"copilot",builtin:!0,displayName:"Copilot",defaultCommand:["copilot"],history:wk,detectAccount:($)=>wH($),createHookAdapter:()=>new hK("copilot"),createTurnDetector:()=>new mK("copilot")},kimi:{vendor:"kimi",builtin:!0,displayName:"Kimi",defaultCommand:["kimi"],firstMessageDelivery:"paste",processNames:["kimi-co"],history:xk,detectAccount:($)=>TL($),createHookAdapter:()=>new hK("kimi"),createTurnDetector:()=>new mK("kimi")}};dk=[...new Set(Object.values(jR).flatMap(($)=>$.terminalTitle?.statusPrefixes??[]))]});function CR($){return D$($).createHookAdapter()}class hK{vendor;constructor($){this.vendor=$}supportsHooks(){return!1}globalSettingsPath(){return""}activityDetailFromPayload(){return}sessionFromPayload(){return}async installActivityHooks(){}async removeActivityHooks(){}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(){}async installWorktreeWatchHook(){}async removeWorktreeWatchHook(){}}var _R=a(()=>{C7()});function dL($){return xJ0.includes($)}function pk($){return fJ0.includes($)}var xJ0,fJ0;var DR=a(()=>{xJ0=["session-start","turn-start","turn-complete","turn-failed","turn-interrupted","awaiting-input","session-end","tool-pre","tool-post","tool-failed","pre-compact","post-compact","subagent-start","subagent-stop"];fJ0=["session-start","turn-start","turn-complete","turn-failed","turn-interrupted","awaiting-input","session-end"]});var Xv={};g$(Xv,{runHookSubcommand:()=>mJ0,readTextWithTimeout:()=>ak,parseWorktreeRemovePath:()=>ek,parseWorktreeAddPath:()=>tk,ensureGlobalKobeHooks:()=>PR});import{homedir as gJ0}from"os";import{join as ok,resolve as AR}from"path";async function ak($,Z=yJ0){let J;try{return await Promise.race([$(),new Promise((X)=>{J=setTimeout(()=>X(""),Z)})])}finally{if(J!==void 0)clearTimeout(J)}}async function rk(){try{let $=await ak(()=>Bun.stdin.text());if(!$.trim())return{};let Z=JSON.parse($);return Z&&typeof Z==="object"&&!Array.isArray(Z)?Z:{}}catch{return{}}}function nk($,Z){for(let J=0;J<$.length;J++){if($[J]===Z)return $[J+1];if($[J].startsWith(`${Z}=`))return $[J].slice(Z.length+1)}return}function kJ0($){return!!$&&typeof $==="object"&&!Array.isArray($)}function sk($){let Z=[],J=/"([^"]*)"|'([^']*)'|(\S+)/g,X;while((X=J.exec($))!==null)Z.push(X[1]??X[2]??X[3]??"");return Z}function tk($){let Z=sk($),J=new Set(["-b","-B","--reason"]);for(let X=0;X+1<Z.length;X++){if(Z[X]!=="worktree"||Z[X+1]!=="add")continue;let z=X+2;while(z<Z.length){let G=Z[z];if(G==="&&"||G==="||"||G===";"||G==="|"||G===">"||G===">>")break;if(G.startsWith("-")){z+=J.has(G)?2:1;continue}return G}}return}function ek($){let Z=sk($);for(let J=0;J+1<Z.length;J++){if(Z[J]!=="worktree"||Z[J+1]!=="remove")continue;let X=J+2;while(X<Z.length){let z=Z[X];if(z==="&&"||z==="||"||z===";"||z==="|"||z===">"||z===">>")break;if(z.startsWith("-")){X+=1;continue}return z}}return}async function vJ0(){let $=await rk(),Z=kJ0($.tool_input)?$.tool_input:{},J=typeof Z.command==="string"?Z.command:"";if(!J.includes("worktree"))return;let X=typeof $.cwd==="string"&&$.cwd?$.cwd:process.cwd(),z=tk(J),G=z?void 0:ek(J);if(!z&&!G)return;let W=await BQ();if(!W)return;try{if(z)await W.request("worktree.reconcile",{cwd:X,worktreePath:AR(X,z)});else if(G)await W.request("worktree.archiveRemoved",{worktreePath:AR(X,G)})}finally{W.close()}}async function mJ0($){let[Z,...J]=$;if(Z==="setup"){await dJ0(J);return}if(Z===bJ0){try{await vJ0()}catch{}return}try{if(!Z||!dL(Z))return;let X=await rk(),z=nk(J,"--task-id"),G=typeof X.cwd==="string"&&X.cwd?X.cwd:process.cwd(),W=process.env.KOBE_TASK_ID,H=process.env.KOBE_TAB_ID,U=nk(J,"--engine"),K=$v().filter((V)=>!U||V.vendor===U),N;for(let V of K)if(N=V.activityDetailFromPayload(Z,X),N)break;let L;for(let V of K)if(L=V.sessionFromPayload(X),L)break;let M=await BQ();if(!M)return;try{let V=z??W;await M.request("engine.reportEvent",{...V?{taskId:V}:{cwd:G},kind:Z,...U?{engine:U}:{},...H?{tabId:H}:{},...N?{detail:N}:{},...L?{sessionId:L.sessionId}:{},...L?.transcriptPath?{transcriptPath:L.transcriptPath}:{}})}finally{M.close()}}catch(X){if(process.env.KOBE_HOOK_DEBUG)console.error(`[rove hook] ${Z} failed:`,X instanceof Error?X.message:String(X))}}function hJ0(){return T8.map(($)=>CR($)).filter(($)=>$.supportsWorktreeSync())}function $v(){return T8.map(($)=>CR($)).filter(($)=>$.supportsHooks())}function Zv(){return ok(gJ0(),".claude","settings.json")}function uJ0($){if(!$||$==="off")return;if($==="global")return Zv();if($.startsWith("repo:"))return ok(AR($.slice(5)),".claude","settings.json");return $}async function PR(){try{let $=cJ0();for(let Z of $v()){let J=Z.globalSettingsPath();if(!J)continue;await Z.installActivityHooks(J,{toolEvents:$}),await Z.installWorktreeWatchHook(J)}await Jv()}catch{}}function cJ0(){try{for(let $ of j5().plugins){if(!$.enabled)continue;try{if(XZ($.root).manifest.events.some((Z)=>Z.on.startsWith("tool.")))return!0}catch{}}}catch{}return!1}async function Jv(){let $=hJ0();if($.length===0)return;let Z=l7(ik),J=new Set([Zv()]),X=uJ0(Z);if(X)J.add(X);for(let z of $)for(let G of J)await z.removeWorktreeSyncHook(G);if(Z!=="off")o3(ik,"off")}async function dJ0($){await Jv(),process.stdout.write(["rove hook setup is deprecated and now a no-op (cleanup only).","","The old external-worktree sync used a global WorktreeCreate hook, which is","a VCS provider hook \u2014 its presence broke `claude --worktree` / EnterWorktree","in every repo. Any hook Rove previously installed has been removed.","","Sync is now automatic: a `claude --worktree` (or any session) started in a","worktree under a repo Rove already tracks is adopted as a task on launch.","To adopt existing worktrees on demand, use the New Task dialog or `rove adopt`.",""].join(`
|
|
286
|
+
`))}var yJ0=500,bJ0="worktree-created",ik="externalWorktreeSync";var RR=a(()=>{C2();jQ();RJ();_R();DR();b4();u7()});var lL;var Qv=a(()=>{lL={$schema:"https://json.schemastore.org/package.json",name:"@sma1lboy/rove",version:"0.8.97",description:"Rove \u2014 the terminal-native agent multiplexer",type:"module",packageManager:"bun@1.3.13",bin:{kobe:"dist/cli/kobe.js",rove:"dist/cli/rove.js"},files:["dist/cli","dist/web-ui","dist/skills","dist/*.wav","README.md","LICENSE"],publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/Sma1lboy/rove.git"},homepage:"https://github.com/Sma1lboy/rove#readme",bugs:{url:"https://github.com/Sma1lboy/rove/issues"},engines:{bun:">=1.3.11"},scripts:{dev:"ROVE_DEV=1 bun --conditions=browser ./src/cli/rove.ts","dev:kobe":"KOBE_DEV=1 bun --conditions=browser ./src/cli/kobe.ts","dev:mock":"KOBE_DEV=1 bun ./src/tui-react/mock/host.tsx","dev:mock-react":"KOBE_DEV=1 bun ./src/tui-react/mock/host.tsx","dev:mock-react-task-dialogs":"KOBE_DEV=1 bun ./src/tui-react/component/mock-dialogs-host.tsx","dev:mock-react-filetree":"KOBE_DEV=1 bun ./src/tui-react/panes/filetree/mock-host.tsx","dev:mock-react-sidebar":"KOBE_DEV=1 bun ./src/tui-react/panes/sidebar/mock-host.tsx","dev:mock-react-terminal":"KOBE_DEV=1 bun ./src/tui-react/panes/terminal/mock-host.tsx","dev:mock-react-dialogs":"KOBE_DEV=1 bun ./src/tui-react/mock/dialogs-host.tsx","dev:mock-react-workspace":"KOBE_DEV=1 bun ./src/tui-react/workspace/mock-host.tsx","dev:sandbox":"bun run scripts/dev-sandbox.ts run","dev:sandbox:reset":"bun run scripts/dev-sandbox.ts reset",build:"bun run scripts/build.ts","build:with-web":"bun run build",compile:"bun run scripts/compile.ts",typecheck:"tsc --noEmit","check-i18n":"bun run scripts/check-i18n.ts",test:"bun run test:fast && bun run test:socket","perf:golden":"bun scripts/perf-golden.ts","pty:soak":"bun scripts/pty-soak.ts","test:fast":"vitest run --passWithNoTests --minWorkers=1 --maxWorkers=8","test:socket":"KOBE_INCLUDE_SOCKET=1 vitest run test/daemon --pool forks --minWorkers=1 --maxWorkers=4 --passWithNoTests","test:socket:coverage":"KOBE_INCLUDE_SOCKET=1 KOBE_COVERAGE_DAEMON=1 vitest run test/daemon --coverage --pool forks --minWorkers=1 --maxWorkers=4 --passWithNoTests","test:behavior":"KOBE_INCLUDE_BEHAVIOR=1 vitest run test/behavior --pool forks --minWorkers=1 --maxWorkers=1 --retry=2 --passWithNoTests","test:render":"bun test test/render --coverage --coverage-reporter=text --coverage-reporter=lcov --coverage-dir=coverage-render",coverage:"vitest run --coverage --passWithNoTests",bench:"vitest bench --run",lint:"biome check .",knip:"knip-bun",postinstall:"bun run scripts/check-preview-deps.ts || true",prepublishOnly:"bun run typecheck && bun run build"},"//":"biome.json + bunfig.toml live at the monorepo root since they apply repo-wide; bun.lock also lives at root (workspace-shared).",dependencies:{"@ansi-tools/parser":"^1.0.15","@opentui/core":"0.4.3","@opentui/react":"0.4.3","@xterm/addon-serialize":"^0.14.0","@xterm/addon-unicode11":"^0.9.0","@xterm/headless":"^6.0.0","node-pty":"^1.1.0",react:"^19.2.8",ws:"^8.18.0"},devDependencies:{"@biomejs/biome":"1.9.4","@sma1lboy/kobe-daemon":"0.7.14","@tsconfig/bun":"1.0.10","@types/bun":"1.3.14","@types/node":"25.6.2","@types/react":"^19.2.0","@vitest/coverage-v8":"2.1.9",knip:"^6.14.2","kobe-web":"workspace:*","react-devtools-core":"^7.0.1",typescript:"5.8.2",vitest:"2.1.9"},trustedDependencies:[]}});var Yv={};g$(Yv,{repoSlug:()=>LY,releasePageUrl:()=>xR,recommendedGlobalInstallCommand:()=>IR,isNewerSemver:()=>TR,fetchReleaseSummaries:()=>cK,fetchReleaseNotesRange:()=>wR,fetchReleaseNotes:()=>ER,compareSemver:()=>B3,checkLatestVersion:()=>jY,breakingVersionsCrossed:()=>uK,UPDATE_SCRIPT_URL:()=>pL,UPDATE_COMMAND:()=>WZ,PACKAGE_NAME:()=>SR,CURRENT_VERSION:()=>A$,BREAKING_VERSIONS:()=>EJ});function LY(){let $=lL.repository?.url;if(!$)return null;let Z=$.match(/github\.com[:/]([^/]+)\/([^/.]+)/);if(!Z||!Z[1]||!Z[2])return null;return`${Z[1]}/${Z[2]}`}function IR(){return`npm install -g ${SR}@latest`}function uK($,Z,J=EJ){let[X,z]=B3($,Z)<=0?[$,Z]:[Z,$];return J.filter((G)=>B3(G,X)>0&&B3(G,z)<=0)}async function pJ0($){let Z=new AbortController,J=setTimeout(()=>Z.abort(),nL);try{let X=$.replace("/","%2F"),z=await fetch(`https://registry.npmjs.org/${X}/latest`,{signal:Z.signal,headers:{accept:"application/json"}});if(!z.ok)return null;let G=await z.json();if(typeof G.version!=="string")return null;return G.version}catch{return null}finally{clearTimeout(J)}}function TR($,Z){return B3($,Z)>0}function B3($,Z){let J=(G)=>G.split("-")[0]??G,X=J($).split(".").map((G)=>Number.parseInt(G,10)),z=J(Z).split(".").map((G)=>Number.parseInt(G,10));for(let G=0;G<3;G++){let W=X[G]??0,H=z[G]??0;if(Number.isNaN(W)||Number.isNaN(H))return 0;if(W>H)return 1;if(W<H)return-1}return 0}async function jY($={}){let Z=process.env.KOBE_FAKE_UPDATE;if(Z)return{current:A$,latest:Z,hasUpdate:TR(Z,A$)};if(WH()&&!$.force)return null;let J=await pJ0(SR);if(!J)return null;return{current:A$,latest:J,hasUpdate:TR(J,A$)}}function zv($){if(typeof $!=="string")return null;return $.match(/^v(\d+\.\d+\.\d+)$/)?.[1]??null}async function ER($){let Z=LY();if(!Z)return null;let J=`v${$}`,X=new AbortController,z=setTimeout(()=>X.abort(),nL);try{let G=await fetch(`https://api.github.com/repos/${Z}/releases/tags/${J}`,{signal:X.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!G.ok)return null;let W=await G.json();if(typeof W.body!=="string"||typeof W.html_url!=="string")return null;return{body:W.body,url:W.html_url,version:$}}catch{return null}finally{clearTimeout(z)}}async function wR($){let Z=LY();if(!Z)return[];let J=$.limit??100,X=new AbortController,z=setTimeout(()=>X.abort(),nL);try{let G=await fetch(`https://api.github.com/repos/${Z}/releases?per_page=${J}`,{signal:X.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!G.ok)return[];let W=await G.json();if(!Array.isArray(W))return[];return W.map((H)=>{let U=zv(H.tag_name);if(!U||typeof H.html_url!=="string"||typeof H.body!=="string")return null;if(B3(U,$.current)<=0)return null;if(B3(U,$.latest)>0)return null;return{version:U,url:H.html_url,body:H.body}}).filter((H)=>H!==null)}catch{return[]}finally{clearTimeout(z)}}async function cK($=12){let Z=LY();if(!Z)return[];let J=new AbortController,X=setTimeout(()=>J.abort(),nL);try{let z=await fetch(`https://api.github.com/repos/${Z}/releases?per_page=${$}`,{signal:J.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!z.ok)return[];let G=await z.json();if(!Array.isArray(G))return[];return G.map((W)=>{let H=zv(W.tag_name);if(!H||typeof W.html_url!=="string")return null;return{version:H,url:W.html_url}}).filter((W)=>W!==null)}catch{return[]}finally{clearTimeout(X)}}function xR($){let Z=LY();if(!Z)return null;return`https://github.com/${Z}/releases/tag/v${$}`}var A$,SR,pL="https://raw.githubusercontent.com/Sma1lboy/rove/main/scripts/update.sh",WZ,EJ,nL=3000;var w8=a(()=>{Qv();L5();A$=lL.version,SR=lL.name;WZ=`curl -fsSL ${pL} | sh`;EJ=[]});var Wv={};g$(Wv,{stampResetGate:()=>iL,resetGateBlockers:()=>Gv,enforceResetGate:()=>gR,LAST_RUN_VERSION_KEY:()=>fR});function Gv($,Z=A$,J=EJ){if(typeof $!=="string"||$.length===0)return[];let[X,z]=B3($,Z)<=0?[$,Z]:[Z,$];return J.filter((G)=>B3(G,X)>0&&B3(G,z)<=0)}function gR(){let $=X$(),Z=_4()[fR],J=Gv(Z);if(J.length>0){let X=typeof Z==="string"?Z:"unknown";console.error([`${$} ${A$}: cannot start \u2014 version ${J.join(", ")} introduced breaking changes`,`(last run: ${X}). Your daemon/session state may be incompatible.`,"","Run:",` ${$} reset # stop daemon + PTY host + sessions (tasks kept)`,` ${$} reset --hard # additionally wipe the task index + UI state`,"","Then relaunch Rove. Worktrees are never touched."].join(`
|
|
287
287
|
`)),process.exit(1)}if(Z!==A$)iL()}function iL(){try{n2({[fR]:A$})}catch{}}var fR="app.lastRunVersion";var oL=a(()=>{D2();w8();o4()});import{existsSync as qv,readFileSync as nJ0}from"fs";import{homedir as iJ0}from"os";import{join as Uv,resolve as Hv}from"path";import{fileURLToPath as oJ0}from"url";function kR($=process.env){return`${X$($)} skill install`}function aL(){let $=oJ0(import.meta.url);return[Hv($,"../../../../../.agents/skills/kobe"),Hv($,"../../skills/rove")].find((J)=>qv(Uv(J,"SKILL.md")))??null}function rL($={}){let Z=$.source!==void 0?$.source:aL(),J=$.agent===void 0?[]:typeof $.agent==="string"?[$.agent]:$.agent;return["skills","add",Z??rJ0,"--skill",p3,...$.global===!1?[]:["--global"],...J.flatMap((X)=>["--agent",X])]}function VY($={}){return`npx ${rL($).join(" ")}`}async function vR($,Z){return await Bun.spawn(["npx",...rL({...$===void 0?{}:{agent:$},global:Z})],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}function sL($={}){let Z=$.home??iJ0(),J=$.cwd??process.cwd();return[Z,J].flatMap((X)=>aJ0.map((z)=>Uv(X,z)))}function sJ0($){let Z=$.match(/(?:rove|kobe)-skill-version:\s*(\d+)/);return Z?Number.parseInt(Z[1],10):null}function dK($){let Z=sL($).find((z)=>qv(z));if(!Z)return{installed:!1,installedVersion:null,currentVersion:yR,stale:!1};let J=null;try{J=sJ0(nJ0(Z,"utf8"))}catch{J=null}let X=J===null||J<yR;return{installed:!0,installedVersion:J,currentVersion:yR,stale:X}}function tJ0(){return new Promise(($)=>{process.stdin.resume(),process.stdin.once("data",(Z)=>{process.stdin.pause(),$(String(Z))})})}async function Bv($={}){let Z=X$(),J=kR(),X=dK();if(!X.installed){if(l7(bR)==="1")return;o3(bR,"1"),process.stderr.write(`
|
|
288
288
|
${Z}: the Rove agent skill isn't installed \u2014 install it so your coding agent can drive Rove via \`${Z} api\`:
|
|
289
289
|
${J}
|
|
@@ -727,7 +727,7 @@ ${$.t("update.updateComplete")}
|
|
|
727
727
|
${$.t("update.updateFailed",{code:String(J)})}
|
|
728
728
|
`),process.stdout.write($.t("update.pressAnyKey")),await eH0(),process.exit(J)}var sI=a(()=>{w8()});import{spawn as $q0}from"child_process";import{TextAttributes as gq}from"@opentui/core";function Zq0($){if(!$)return!1;let Z=process.platform,[J,X]=Z==="darwin"?["open",[$]]:Z==="win32"?["cmd",["/c","start","",$]]:["xdg-open",[$]];try{return $q0(J,X,{stdio:"ignore",detached:!0}).unref(),!0}catch{return!1}}function tI($){return $.replace(/\r\n/g,`
|
|
729
729
|
`).split(`
|
|
730
|
-
`).map((Z)=>Z.trim()).filter(Boolean)}function _o($){let{theme:Z}=l0(),J=Z1(),X=E4(),[z,G]=dQ.useState(null),[W,H]=dQ.useState([]),[U,K]=dQ.useState(!0),[N,L]=dQ.useState("update"),[M,V]=dQ.useState(null),P=z?.latest??A$,_=W[0]?.url??xR(P),C=[{id:"update",key:"U",label:J("update.actions.updateNow"),detail:WZ},{id:"release",key:"R",label:J("update.actions.openRelease"),detail:_??J("update.releaseUrlUnavailable")},{id:"close",key:"Q",label:J("update.actions.close"),detail:J("update.actions.closeDetail")}];dQ.useEffect(()=>{f()},[]);async function f(){let x=await jY({force:!0});G(x);let b=x?.latest??A$,v=await wR({current:A$,latest:b});H(v),K(!1)}function E(x){let b=C.map((o)=>o.id),u=(b.indexOf(N)+x+b.length)%b.length;L(b[u]??"update")}function S(x=N){if(x==="close"){$.onClose();return}if(x==="release"){V(Zq0(_)?J("update.statusReleaseOpened"):J("update.statusReleaseError"));return}T()}async function T(){V(J("update.statusRunningUpdater")),await new Promise((x)=>setTimeout(x,30)),await eV({renderer:X,t:J,targetLabel:P,command:WZ})}return g1(()=>({bindings:[{key:"up",cmd:()=>E(-1)},{key:"down",cmd:()=>E(1)},{key:"k",cmd:()=>E(-1)},{key:"j",cmd:()=>E(1)},{key:"return",cmd:()=>S()},{key:"u",cmd:()=>S("update")},{key:"r",cmd:()=>S("release")},...a7(()=>S("close"))]})),R.jsxDEV("box",{flexDirection:"column",flexGrow:1,backgroundColor:Z.background,paddingTop:1,paddingLeft:2,paddingRight:2,children:[R.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",flexShrink:0,children:[R.jsxDEV("text",{fg:Z.text,attributes:gq.BOLD,wrapMode:"none",children:J("update.pageTitle")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",onMouseUp:()=>S("close"),children:"q / esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV("box",{flexDirection:"row",gap:2,flexShrink:0,paddingTop:1,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:J("update.current")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.text,attributes:gq.BOLD,wrapMode:"none",children:["v",A$]},void 0,!0,void 0,this),R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:J("update.latest")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:z?.hasUpdate?Z.warning:Z.success,attributes:gq.BOLD,wrapMode:"none",children:["v",P]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV("box",{flexDirection:"column",flexShrink:0,paddingTop:1,gap:0,children:C.map((x)=>R.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:1,paddingRight:1,backgroundColor:N===x.id?Z.primary:void 0,onMouseUp:()=>S(x.id),children:[R.jsxDEV("box",{width:4,flexShrink:0,children:R.jsxDEV("text",{fg:N===x.id?Z.selectedListItemText:Z.accent,attributes:gq.BOLD,wrapMode:"none",children:["[",x.key,"]"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),R.jsxDEV("box",{width:14,flexShrink:0,children:R.jsxDEV("text",{fg:N===x.id?Z.selectedListItemText:Z.text,wrapMode:"none",children:x.label},void 0,!1,void 0,this)},void 0,!1,void 0,this),R.jsxDEV("text",{fg:N===x.id?Z.selectedListItemText:Z.textMuted,wrapMode:"word",children:x.detail},void 0,!1,void 0,this)]},x.id,!0,void 0,this))},void 0,!1,void 0,this),M?R.jsxDEV("text",{fg:Z.info,wrapMode:"word",children:M},void 0,!1,void 0,this):null,R.jsxDEV("box",{flexShrink:0,paddingTop:1,children:R.jsxDEV("text",{fg:Z.textMuted,attributes:gq.DIM,wrapMode:"none",children:J("update.changesSectionHeader",{from:A$,to:P})},void 0,!1,void 0,this)},void 0,!1,void 0,this),R.jsxDEV("scrollbox",{flexGrow:1,flexShrink:1,stickyScroll:!1,verticalScrollbarOptions:{trackOptions:{backgroundColor:Z.background,foregroundColor:Z.borderActive}},children:R.jsxDEV("box",{flexDirection:"column",paddingRight:1,paddingBottom:1,gap:0,children:[U?R.jsxDEV("text",{fg:Z.textMuted,children:J("update.loadingNotes")},void 0,!1,void 0,this):null,!U&&W.length===0?R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:J("update.notesUnavailable")},void 0,!1,void 0,this):null,W.map((x)=>R.jsxDEV("box",{flexDirection:"column",paddingBottom:1,gap:0,children:[R.jsxDEV("text",{fg:Z.text,attributes:gq.BOLD,wrapMode:"none",children:["v",x.version]},void 0,!0,void 0,this),tI(x.body).map((b,v)=>R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:b},`${v}:${b}`,!1,void 0,this))]},x.version,!0,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var dQ;var eI=a(async()=>{w8();Q$();sI();r0();await e1([h4(),$$(),C4()]);dQ=H1(q1(),1)});import{TextAttributes as Co}from"@opentui/core";function Jq0($){if(!$)return[];let Z=[];for(let J of $.listTasks())if(J.repo&&!Z.includes(J.repo))Z.push(J.repo);return Z}function Xq0($,Z){let J=Date.parse($);if(!Number.isFinite(J))return"";let X=Math.round((Z-J)/60000);if(X<60)return`${Math.max(X,0)}m`;let z=Math.round(X/60);if(z<24)return`${z}h`;return`${Math.round(z/24)}d`}function Do($){let{theme:Z}=l0(),J=Z1(),X=Jq0($.orchestrator),[z,G]=X6.useState(()=>{let u=$.focusRepo?X.indexOf($.focusRepo):-1;return u>=0?u:0}),W=X[z],[H,U]=X6.useState(null),[K,N]=X6.useState(null),[L,M]=X6.useState(0),[V,P]=X6.useState(!1),[_,C]=X6.useState(!1),[f,E]=X6.useState(null);X6.useEffect(()=>{let u=!1,o=$.orchestrator;if(!o||!W){U([]);return}return N(null),o.listWorkItems({repo:W,limit:30,...V?{assignee:"@me"}:{},...L>0?{refresh:!0}:{}}).then((m)=>{if(!u)U(m.items)}).catch((m)=>{if(u)return;N(m instanceof Error?m.message:String(m)),U([])}),()=>{u=!0}},[$.orchestrator,W,V,L]);let S=H??[],[T,x]=X6.useState(0);X6.useEffect(()=>{x((u)=>w4(u,S.length))},[S.length]);async function b(){let u=$.orchestrator,o=S[T];if(!u||!o||!W||_)return;C(!0),E(J("workItems.starting",{number:o.number}));try{let m=await u.startWorkItem({repo:W,number:o.number});if(m.started)$.onOpenTask?.(m.taskId);else E(J("workItems.startedNoEngine",{title:m.title}))}catch(m){E(m instanceof Error?m.message:String(m))}finally{C(!1)}}g1(()=>({enabled:$.focused!==!1,bindings:[...a7($.onClose),{key:"j",cmd:()=>x((u)=>w4(u+1,S.length))},{key:"down",cmd:()=>x((u)=>w4(u+1,S.length))},{key:"k",cmd:()=>x((u)=>w4(u-1,S.length))},{key:"up",cmd:()=>x((u)=>w4(u-1,S.length))},{key:"tab",cmd:()=>G((u)=>X.length?(u+1)%X.length:0)},{key:"a",cmd:()=>P((u)=>!u)},{key:"r",cmd:()=>M((u)=>u+1)},{key:"return",cmd:()=>void b()}]}));let v=Date.now();return R.jsxDEV("box",{flexDirection:"column",flexGrow:1,padding:1,children:[R.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",children:[R.jsxDEV("text",{attributes:Co.BOLD,fg:Z.accent,children:J("workItems.title")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.textMuted,children:[W?U9(W,X):J("workItems.noRepo"),V?` ${J("workItems.assignedFilter")}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K?R.jsxDEV("box",{flexDirection:"column",marginTop:1,children:R.jsxDEV("text",{fg:Z.error,children:K},void 0,!1,void 0,this)},void 0,!1,void 0,this):H===null?R.jsxDEV("text",{fg:Z.textMuted,children:J("common.loading")},void 0,!1,void 0,this):S.length===0?R.jsxDEV("text",{fg:Z.textMuted,children:J("workItems.empty")},void 0,!1,void 0,this):R.jsxDEV("box",{flexDirection:"column",marginTop:1,flexGrow:1,children:S.map((u,o)=>{let m=iJ(Z,{cursor:o===T,selected:!1});return R.jsxDEV("box",{flexDirection:"column",flexShrink:0,...m.backgroundColor?{backgroundColor:m.backgroundColor}:{},children:[R.jsxDEV("box",{flexDirection:"row",gap:0,children:[R.jsxDEV("text",{fg:m.markerColor,wrapMode:"none",children:m.marker},void 0,!1,void 0,this),R.jsxDEV("box",{flexDirection:"row",flexGrow:1,paddingLeft:1,paddingRight:1,gap:1,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:`#${u.number}`},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.text,attributes:o===T?Co.BOLD:void 0,wrapMode:"none",flexGrow:1,children:u.title},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV("box",{flexDirection:"row",gap:0,children:[R.jsxDEV("text",{fg:m.markerColor,wrapMode:"none",children:m.marker},void 0,!1,void 0,this),R.jsxDEV("box",{flexDirection:"row",flexGrow:1,paddingLeft:2,paddingRight:1,gap:1,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",flexGrow:1,children:[u.author,...u.labels.slice(0,2)].filter(Boolean).join(" \xB7 ")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:Xq0(u.updatedAt,v)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},`${u.number}`,!0,void 0,this)})},void 0,!1,void 0,this),f?R.jsxDEV("text",{fg:Z.textMuted,children:f},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var X6;var Ao=a(async()=>{g8();L3();Q$();r0();await e1([$$(),C4()]);X6=H1(q1(),1)});import{TextAttributes as Po}from"@opentui/core";function Ro($){return $.flatMap((Z)=>Z.worktrees)}function Gq0($,Z){let J=(z)=>z.replace(/^\/private\//,"/").replace(/\/+$/,""),X=J(Z);return $.listTasks().find((z)=>z.worktreePath&&J(z.worktreePath)===X)?.id}function To($){let{theme:Z}=l0(),J=n$(),X=Z1(),[z,G]=tJ.useState(null),[W,H]=tJ.useState(0),U=()=>H((u)=>u+1);tJ.useEffect(()=>{let u=!1,o=!1,m=$.orchestrator;if(!m){G([]);return}return m.listWorktrees({network:!1}).then((e)=>{if(!u&&!o)G(e)}).catch(()=>{}),m.listWorktrees().then((e)=>{if(o=!0,u)return;G(e);let t=new Set(Ro(e).map((Y0)=>Y0.path));N((Y0)=>Y0.filter((F0)=>t.has(F0)))}).catch(()=>{}),()=>{u=!0}},[$.orchestrator,W]);let[K,N]=tJ.useState([]),L=(z??[]).map((u)=>({...u,worktrees:u.worktrees.filter((o)=>!K.includes(o.path))})),M=Ro(L),[V,P]=tJ.useState(0);tJ.useEffect(()=>{P((u)=>w4(u,M.length))},[M.length]);let[_,C]=tJ.useState(null);async function f(u,o){let m=$.orchestrator;if(!m)return;N((e)=>[...e,u.path]);try{await m.removeWorktree(u.path,o),U()}catch(e){if(N((t)=>t.filter((Y0)=>Y0!==u.path)),!o&&e instanceof Error&&Qq0.test(e.message)){if(await N4.show(J,X("worktrees.delete.forceTitle"),X("worktrees.delete.forceBody",{branch:u.branch||u.path}),X("common.cancel"),X("worktrees.delete.button"))===!0)await f(u,!0);return}console.error(`[rove worktrees] ${X("worktrees.delete.failed",{error:String(e)})}`)}}async function E(u){if(!$.orchestrator||_||K.includes(u.path))return;if(await N4.show(J,X("worktrees.delete.confirmTitle"),X("worktrees.delete.confirmBody",{branch:u.branch||u.path}),X("common.cancel"),X("worktrees.delete.button"))!==!0)return;f(u,!1)}async function S(u){let o=$.orchestrator;if(!o||_)return;let m=Gq0(o,u.path);if(!m){console.error(`[rove worktrees] ${X("worktrees.land.noTask")}`);return}if(await N4.show(J,X("worktrees.land.confirmTitle"),X("worktrees.land.confirmBody",{branch:u.branch||u.path}),X("common.cancel"),X("worktrees.land.button"))!==!0)return;C(u.path);try{let t=await o.landTask(m);console.error(`[rove worktrees] ${X("worktrees.land.done",{branch:t.branch,landedOn:t.landedOn,commit:t.commit})}`),U()}catch(t){let Y0=t instanceof Error?t.message:String(t);if(zq0.test(Y0))console.error(`[rove worktrees] ${X("worktrees.land.conflict",{files:Y0})}`);else if(Yq0.test(Y0))console.error(`[rove worktrees] ${X("worktrees.land.dirtyBase")}`);else console.error(`[rove worktrees] ${X("worktrees.land.failed",{error:Y0})}`)}finally{C(null)}}g1(()=>({enabled:J.stack.length===0,bindings:[...a7($.onClose),{key:"up",cmd:()=>P((u)=>w4(u-1,M.length))},{key:"down",cmd:()=>P((u)=>w4(u+1,M.length))},{key:"d",cmd:()=>{let u=M[V];if(u)E(u)}},{key:"l",cmd:()=>{let u=M[V];if(u)S(u)}}]}));function T(u){if(u===!0)return R.jsxDEV("text",{fg:Z.success,children:[" ",X("worktrees.badge.remoteOn")]},void 0,!0,void 0,this);if(u===!1)return R.jsxDEV("text",{fg:Z.warning,children:[" ",X("worktrees.badge.remoteOff")]},void 0,!0,void 0,this);return R.jsxDEV("text",{fg:Z.textMuted,children:[" ",X("worktrees.badge.remoteUnknown")]},void 0,!0,void 0,this)}function x(u){if(u.verdictReason==="dirty"||u.verdictReason==="fresh")return null;let o=u.verdict==="merged"?Z.success:u.verdict==="stale"?Z.warning:Z.accent;return R.jsxDEV("text",{fg:o,children:[" ",X(`worktrees.verdict.${u.verdictReason}`)]},void 0,!0,void 0,this)}let b=z===null,v=0;return R.jsxDEV("scrollbox",{flexGrow:1,backgroundColor:Z.background,paddingTop:1,paddingLeft:2,paddingRight:2,paddingBottom:1,verticalScrollbarOptions:{trackOptions:{foregroundColor:"transparent"}},children:[R.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",children:R.jsxDEV("text",{attributes:Po.BOLD,fg:Z.text,children:X("worktrees.title")},void 0,!1,void 0,this)},void 0,!1,void 0,this),b?R.jsxDEV("text",{fg:Z.textMuted,children:X("worktrees.loading")},void 0,!1,void 0,this):L.length===0?R.jsxDEV("text",{fg:Z.textMuted,children:X("worktrees.noProjects")},void 0,!1,void 0,this):L.map((u)=>{let o=v;return v+=u.worktrees.length,R.jsxDEV("box",{gap:0,paddingTop:1,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:u.repo},void 0,!1,void 0,this),u.worktrees.length===0?R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:X("worktrees.noWorktrees")},void 0,!1,void 0,this):u.worktrees.map((m,e)=>{let t=o+e,Y0=t===V;return R.jsxDEV("box",{gap:0,onMouseUp:()=>P(t),children:[R.jsxDEV("box",{flexDirection:"row",children:[R.jsxDEV("text",{fg:Y0?Z.primary:Z.text,attributes:Y0?Po.BOLD:void 0,wrapMode:"none",children:[Y0?"\u25B8 ":" ",m.branch||X("worktrees.row.detached")]},void 0,!0,void 0,this),m.kobeManaged?R.jsxDEV("text",{fg:Z.textMuted,children:[" ",X("worktrees.badge.kobeManaged")]},void 0,!0,void 0,this):null,m.dirty?R.jsxDEV("text",{fg:Z.warning,children:[" ",X("worktrees.badge.dirty")]},void 0,!0,void 0,this):null,T(m.branchOnRemote),x(m),_===m.path?R.jsxDEV("text",{fg:Z.textMuted,children:" \u2026"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),R.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",paddingLeft:2,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:m.path},void 0,!1,void 0,this),m.createdAtMs>0?R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:X("worktrees.row.created",{age:rY(m.createdAtMs)})},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},m.path,!0,void 0,this)})]},u.repo,!0,void 0,this)})]},void 0,!0,void 0,this)}var tJ,Qq0,zq0,Yq0;var So=a(async()=>{g8();rV();Q$();r0();await e1([$$(),C4(),V5(),FZ()]);tJ=H1(q1(),1);Qq0=/refusing to remove dirty worktree/,zq0=/LAND_CONFLICT/,Yq0=/MAIN_CHECKOUT_DIRTY/});function Io($){let[Z,J]=vF.useState(!1),[X,z]=vF.useState(!1),[G,W]=vF.useState(!1),[H,U]=vF.useState("terminal"),K=(N)=>{U(N),$.setFocused(gi(N))};return{nav:H,setNav:U,goToNav:K,settingsOpen:Z,openSettings:()=>J(!0),closeSettings:()=>J(!1),worktreesOpen:X,openWorktrees:()=>z(!0),closeWorktrees:()=>z(!1),updateOpen:G,openUpdate:()=>W(!0),closeUpdate:()=>W(!1),kanbanOpen:H==="kanban",openKanban:()=>K("kanban"),closeKanban:()=>K("terminal"),automationsOpen:H==="automations",openAutomations:()=>K("automations"),closeAutomations:()=>K("terminal"),workItemsOpen:H==="issues",openWorkItems:()=>K("issues"),closeWorkItems:()=>K("terminal")}}function Eo($){if($.worktreesOpen)return R.jsxDEV(To,{orchestrator:$.orchestrator,onClose:$.closeWorktrees},void 0,!1,void 0,this);if($.updateOpen)return R.jsxDEV(_o,{onClose:$.closeUpdate},void 0,!1,void 0,this);return null}function wo($){let Z=$.orchestrator;if($.automationsOpen)return R.jsxDEV(si,{orchestrator:Z,focused:$.contentFocused,...$.selectedTask?{focusRepo:$.selectedTask.repo}:{},onClose:$.closeAutomations,onOpenTask:(J)=>{$.closeAutomations(),$.activateTask(J)}},void 0,!1,void 0,this);if($.workItemsOpen)return R.jsxDEV(Do,{orchestrator:Z,focused:$.contentFocused,onClose:$.closeWorkItems,...$.selectedTask?{focusRepo:$.selectedTask.repo}:{},onOpenTask:(J)=>{$.closeWorkItems(),$.activateTask(J)}},void 0,!1,void 0,this);if($.kanbanOpen)return R.jsxDEV(jo,{orchestrator:Z,focused:$.contentFocused,onClose:$.closeKanban,onStartChat:$.startIssueChat,engineStates:$.engineStates,focusTask:$.selectedTask?{id:$.selectedTask.id,repo:$.selectedTask.repo}:void 0,onOpenTask:(J)=>{$.closeKanban(),$.activateTask(J)}},void 0,!1,void 0,this);return null}var vF;var xo=a(async()=>{yI();r0();await e1([ti(),Vo(),eI(),Ao(),So()]);vF=H1(q1(),1)});function fo($){let Z=$.scheduleTimeout??((U,K)=>{let N=setTimeout(U,K);return()=>clearTimeout(N)}),J=!1,X=null,z=()=>{J=!0,X?.(),X=Z(()=>{J=!1,X=null},700)},G=()=>{J=!1,X?.(),X=null},W=(U)=>{let K=$.getFlatIds();if(K.length===0)return;let N=$.getCursor(),L=N<0?0:N,M=Math.min(K.length-1,Math.max(0,L+U));$.setCursor(M)},H=(U)=>{let K=$.getFlatIds();if(K.length===0)return;$.setCursor(Math.min(K.length-1,Math.max(0,U)))};return{moveDown(){G(),W(1)},moveUp(){G(),W(-1)},selectCurrent(){G();let U=$.getFlatIds(),K=$.getCursor();if(K<0||K>=U.length)return;let N=U[K];if(N!==void 0)$.onSelect(N)},pressG(){if(J)G(),H(0);else z()},pressShiftG(){G(),H($.getFlatIds().length-1)},isChordArmed(){return J},disarmChord(){G()}}}function yo($,Z){if(!Z)return[...$];return[{kind:"recent",id:$_,task:Z,depth:1},...$]}function yq($,Z){return`${$}${$E}${Z}`}function lQ($){let Z=$.indexOf($E);if(Z<0)return{taskId:$,tabId:null};return{taskId:$.slice(0,Z),tabId:$.slice(Z+$E.length)}}function bo($){let{tasks:Z,tabsByTask:J}=$,X=new Map;for(let H of Z){let U=oY(H.repo),K=X.get(U)??{repo:H.repo,tasks:[]};if(H.kind==="main")K.repo=H.repo,K.tasks.unshift(H);else K.tasks.push(H);X.set(U,K)}let z=[],G=new Set;for(let H of Z){if(H.kind!=="main")continue;let U=oY(H.repo);if(!G.has(U))G.add(U),z.push(U)}for(let H of X.keys())if(!G.has(H))G.add(H),z.push(H);let W=[];for(let H of z){let U=X.get(H);if(!U)continue;W.push({kind:"project",id:H,repo:U.repo,label:OZ(U.repo),depth:0});for(let K of U.tasks)Wq0(W,K,J)}return W}function Wq0($,Z,J){$.push({kind:"worktree",id:Z.id,task:Z,depth:1});for(let X of J.get(Z.id)??[])$.push({kind:"tab",id:yq(Z.id,X.id),task:Z,tab:X,depth:2})}function ZE($){let Z=[];for(let J of $)if(J.kind!=="project")Z.push(J.id);return Z}function go($){return oY($.repo)}function Hq0($){if($.kind==="project")return $.label;if($.kind==="tab")return $.tab.label;return`${$.task.title} ${$.task.branch??""} ${OZ($.task.repo)}`}function ko($,Z){let J=Z.trim();if(J==="")return[...$];let X=new Set,z=new Set;for(let W of $){if(!dI(J,Hq0(W)))continue;if(X.add(W.id),z.add(W.id),W.kind==="project")continue;if(W.kind==="tab")z.add(W.task.id);let H=go(W.task);if(H!==null)z.add(H)}let G=[];for(let W of $){if(W.kind==="project"){if(z.has(W.id))G.push(W);continue}let H=go(W.task),U=H!==null&&X.has(H);if(W.kind==="worktree"){if(U||z.has(W.id))G.push(W);continue}if(U||X.has(W.task.id)||z.has(W.id))G.push(W)}return G}function vo($,Z){for(let J of $){if(J.kind!=="main")continue;if(oY(J.repo)===Z)return String(J.id)}return null}function mo($){if($.tabActivity!==void 0)return $.tabActivity;if(!$.active||$.reportedTabCount>0)return;return $.taskActivity}var $E="::",$_="~recent";var mF=a(()=>{L3()});function uo($){let Z=$.maxWidth??qq0,J=Math.max(1,...$.lines.map((W)=>sm(W.text))),X=Math.min(Z-4,J),z=X+4,G=$.lines.length+2;return{innerWidth:X,boxWidth:z,boxHeight:G,left:Math.max(0,Math.min($.hoverX+2,$.screenWidth-z-1)),top:Math.max(0,Math.min($.hoverY+1,$.screenHeight-G-1))}}var ho=2750,qq0=72;var co=a(()=>{L3()});function lo($,Z){return qZ($,Z)}var JE=()=>{};import{TextAttributes as Uq0}from"@opentui/core";function po($){let{theme:Z}=l0();if($.entries.length===0)return null;let J=uo({hoverX:$.x,hoverY:$.y,screenWidth:$.dims.width,screenHeight:$.dims.height,lines:$.entries.map((X)=>({text:X.label}))});return R.jsxDEV("box",{position:"absolute",zIndex:Bq0,left:J.left,top:J.top,width:J.boxWidth,flexDirection:"column",border:!0,borderColor:Z.focusAccent,backgroundColor:Z.backgroundElement,paddingLeft:1,paddingRight:1,children:$.entries.map((X,z)=>{let G=z===$.cursor;return R.jsxDEV("box",{flexShrink:0,backgroundColor:G?Z.focusAccent:void 0,onMouseUp:()=>$.onPick(X.id),children:R.jsxDEV("text",{fg:G?Z.backgroundElement:X.danger?Z.error:Z.text,attributes:G?Uq0.BOLD:void 0,wrapMode:"none",flexGrow:1,children:lo(X.label,J.innerWidth)},void 0,!1,void 0,this)},X.id,!1,void 0,this)})},void 0,!1,void 0,this)}var Bq0;var no=a(async()=>{co();JE();r0();await $$();Bq0=ho+10});import{MouseButton as Kq0,TextAttributes as Q6}from"@opentui/core";function io($){let{theme:Z,transparentBackground:J}=l0(),X=J?Z.border:Z.borderSubtle;return R.jsxDEV("box",{flexDirection:"column",flexShrink:0,children:[$.topPad?R.jsxDEV("box",{flexShrink:0,children:R.jsxDEV("text",{wrapMode:"none",children:" "},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,R.jsxDEV("box",{flexDirection:"row",flexShrink:0,gap:1,paddingLeft:1,paddingRight:1,onMouseUp:$.onPress||$.onContextMenu?(z)=>{if(z.button===Kq0.RIGHT&&$.onContextMenu){$.onContextMenu(z.x,z.y);return}$.onPress?.()}:void 0,children:[$.prefix?R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",flexShrink:0,children:$.prefix},void 0,!1,void 0,this):null,R.jsxDEV("text",{fg:Z.textMuted,attributes:Q6.BOLD,wrapMode:"none",flexShrink:0,children:$.label},void 0,!1,void 0,this),R.jsxDEV("text",{fg:X,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:"\u2500".repeat(240)},void 0,!1,void 0,this),$.suffix?R.jsxDEV("text",{fg:Z.info,attributes:Q6.BOLD,wrapMode:"none",flexShrink:0,children:$.suffix},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function oo($){let{theme:Z}=l0(),J=Z1();return R.jsxDEV("box",{flexDirection:"row",gap:0,flexShrink:0,paddingBottom:1,paddingLeft:1,children:[R.jsxDEV("text",{fg:Z.info,wrapMode:"none",children:"/"},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.text,wrapMode:"none",children:$.query},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.info,attributes:Q6.BLINK,wrapMode:"none",children:"\u2588"},void 0,!1,void 0,this),$.query.length===0?R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:[" ",J("tasks.search.placeholder")]},void 0,!0,void 0,this):R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:[" ",$.matchCount,"/",$.totalCount]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function ao($){let{theme:Z}=l0();return R.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",gap:1,flexShrink:0,paddingLeft:1,paddingRight:1,children:R.jsxDEV("box",{flexDirection:"row",gap:1,children:[R.jsxDEV("text",{fg:$.focused?Z.focusAccent:Z.textMuted,attributes:Q6.BOLD,wrapMode:"none",children:"ROVE"},void 0,!1,void 0,this),$.status?R.jsxDEV("text",{fg:$.status.emphasize?Z.warning:Z.textMuted,attributes:$.status.emphasize?Q6.BOLD:Q6.DIM,wrapMode:"none",onMouseUp:()=>$.onStatusClick?.(),children:$.status.label},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function ro($){let{theme:Z,transparentBackground:J}=l0(),X=Z1(),z=X9("task.new");if(!$.onAddTask)return null;return R.jsxDEV("box",{flexShrink:0,paddingTop:1,paddingBottom:1,paddingLeft:1,paddingRight:1,children:R.jsxDEV("box",{flexDirection:"row",flexShrink:0,gap:1,paddingLeft:1,paddingRight:1,backgroundColor:J?void 0:Z.backgroundElement,onMouseUp:()=>$.onAddTask?.(),children:[R.jsxDEV("text",{fg:Z.primary,attributes:Q6.BOLD,wrapMode:"none",flexShrink:0,children:"+"},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.text,attributes:Q6.BOLD,wrapMode:"none",flexGrow:1,children:X("tasks.menu.newTask")},void 0,!1,void 0,this),z?R.jsxDEV("text",{fg:Z.textMuted,attributes:Q6.DIM,wrapMode:"none",flexShrink:0,children:z},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function so($){let{theme:Z}=l0(),J=Z1();return R.jsxDEV("box",{flexDirection:"column",flexShrink:0,paddingBottom:1,children:fi.map((X)=>{let z=$.nav===X.nav;return R.jsxDEV("box",{flexDirection:"row",flexShrink:0,paddingLeft:1,paddingRight:1,backgroundColor:z?Z.focusAccent:void 0,onMouseUp:(G)=>{G.stopPropagation(),$.setNav(X.nav)},children:R.jsxDEV("text",{fg:z?Z.backgroundElement:Z.textMuted,attributes:z?Q6.BOLD:void 0,wrapMode:"none",flexGrow:1,children:J(X.labelKey)},void 0,!1,void 0,this)},X.nav,!1,void 0,this)})},void 0,!1,void 0,this)}function to($){let{theme:Z}=l0(),J=Z1();return R.jsxDEV("box",{flexDirection:"row",gap:1,flexShrink:0,paddingBottom:1,paddingLeft:1,paddingRight:1,children:lH.map((X)=>{let z=$.view===X.view;return R.jsxDEV("box",{flexShrink:0,paddingLeft:1,paddingRight:1,backgroundColor:z?Z.focusAccent:void 0,onMouseUp:()=>$.setView(X.view),children:R.jsxDEV("text",{fg:z?Z.backgroundElement:Z.textMuted,attributes:z?Q6.BOLD:void 0,wrapMode:"none",children:J($h(X.view))},void 0,!1,void 0,this)},X.view,!1,void 0,this)})},void 0,!1,void 0,this)}function eo($){let{theme:Z}=l0();return R.jsxDEV("box",{flexShrink:0,paddingLeft:1,paddingRight:1,paddingTop:1,children:R.jsxDEV("text",{fg:Z.accent,attributes:Q6.BOLD,wrapMode:"none",onMouseUp:(J)=>{J.stopPropagation(),$.onZenClick?.()},children:"\u262F ZEN"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var XE=a(async()=>{vj();yI();gJ();Q$();r0();await $$()});function Z_($){let Z=new Map,J=$.equals??((z,G)=>z===G);function X(z){let G=Z.get(z);if(!G){let W=$.initial;G={read:()=>W,write:(H)=>{if(!J(W,H))W=H},inFlight:!1,nextAllowedAt:0},Z.set(z,G)}return G}return{read(z){if(!z)return $.initial;return X(z).read()},poll(z){if(!z)return;let G=X(z);by(G,$,(W)=>$.run(z,W),(W)=>G.write(W))},reset(){Z.clear()}}}var hF=a(()=>{CH();CH()});import{stat as Fq0}from"fs/promises";import{join as Mq0}from"path";async function jq0($){try{let Z=await Fq0(Mq0($,".git","HEAD"));return`${Z.mtimeMs}:${Z.size}`}catch{return null}}async function Vq0($,Z,J=t6){let X=await jq0($);if(X!==null){let U=$a.get($);if(U&&U.fingerprint===X)return U.value}let z="",G=!1,W=await J("git",["symbolic-ref","--short","HEAD"],{cwd:$,env:a2(),signal:Z}),H=W.status===0?W.stdout.trim():"";if(H&&H!=="HEAD")z=H,G=!0;else if((await J("git",["rev-parse","--verify","HEAD"],{cwd:$,env:a2(),signal:Z})).status===0)z="(detached)",G=!0;if(G&&X!==null)$a.set($,{fingerprint:X,value:z});return z}function QE($){return Za.read($)}function zE($){Za.poll($)}var Nq0=2000,Oq0=30000,Lq0=1500,$a,Za;var YE=a(()=>{wJ();hF();$a=new Map;Za=Z_({initial:"",timeoutMs:Nq0,slowRetryMs:Oq0,minIntervalMs:Lq0,run:($,Z)=>Vq0($,Z)})});function _q0($){switch($){case"rate_limited":return{text:S$("tasks.activity.rateLimited"),tone:"warning"};case"permission_needed":return{text:S$("tasks.activity.permissionNeeded"),tone:"warning"};case"error":return{text:S$("tasks.activity.error"),tone:"error"};default:return null}}function GE($){switch($.prStatus?.checkState){case"passing":return{glyph:"\u2713",tone:"success"};case"failing":return{glyph:"\u2717",tone:"error"};case"pending":return{glyph:"\u2022",tone:"warning"};default:return null}}function Dq0(){return S$("tasks.subtitle.noTracking")}function Aq0(){return S$("tasks.subtitle.materializing")}function Pq0($){return $?S$("tasks.subtitle.deleteFailed"):S$("tasks.subtitle.deleting")}function Qa($){if($.kind==="main")return!1;return $.vendor!==void 0&&!h7($.vendor)}function za($,Z){if($?.state!=="turn_complete"||!Z)return!1;if(!$.at||!Z.mtimeMs)return!1;return Z.mtimeMs>$.at+Rq0}function Tq0($){let{task:Z}=$,J=$.activity?.state,X=J!==void 0,z=Qa(Z)&&!X,G=$.job!==void 0,W=Z.deletion?.phase==="queued"||Z.deletion?.phase==="running",H=J==="running"||za($.activity,$.transcript);return W||G||!z&&H}function WE($){let{task:Z}=$,J=Z.kind==="main",X=J?$.mainBranch??"":Z.branch,z=$.activity?.state,G=z!==void 0,H=za($.activity,$.transcript)?null:Sq0(z,$.completionSeen===!0),U=_q0(z),K=Qa(Z)&&!G,N=$.job!==void 0,L=Z.deletion?.phase==="queued"||Z.deletion?.phase==="running",M=Z.deletion?.phase==="error",V=Tq0({task:Z,activity:$.activity,job:$.job,transcript:$.transcript}),P=D$(Z.vendor??M4).spinnerFrames??mL,_=P[$.spinnerFrame%P.length]??P[0],C=M?"error":L||N?"primary":K?"textMuted":U?.tone??(V?"primary":H?.tone??"textMuted"),f=K?Dq0():"\u2014",E=V?$.lifecycle?.subagents??0:0,S=E>0&&X.length>0?`\u25C7${E} ${X}`:X,T=L||M?$.truncateBranch(Pq0(M),$.subtitleBudget):N?$.truncateBranch(Aq0(),$.subtitleBudget):U?$.truncateBranch(U.text,$.subtitleBudget):S.length>0?$.truncateBranch(S,$.subtitleBudget):$.truncateBranch(f,$.subtitleBudget),x=M?"\u2715":K?Cq0:H?.glyph??"\u25CB";return{isMain:J,titleText:J?OZ(Z.repo):Z.title,subtitleText:T,loading:V,stateGlyph:V?_:x,tone:C,spinnerFrames:P,materializing:N}}function HE($,Z){if(!$.loading)return $;let J=$.spinnerFrames,X=J[Z()%J.length]??J[0]??"\u280B";if(X===$.stateGlyph)return $;return{...$,stateGlyph:X}}function Sq0($,Z){switch($){case"rate_limited":return{glyph:"\u25F7",tone:"warning"};case"permission_needed":return{glyph:"?",tone:"warning"};case"error":return{glyph:"\u2715",tone:"error"};case"turn_complete":return Z?null:{glyph:"\u25CF",tone:"primary"};default:return null}}var Ja=100,Xa=600,Cq0="\xB7",Rq0=2000;var J_=a(()=>{C7();hL();gY();d7();u7();L3()});function Iq0(){Q_=(Q_+1)%Xa;for(let $ of X_)try{$()}catch{}}function z_(){return Q_}function Y_($){if(X_.add($),bq===null)bq=setInterval(Iq0,Ja),bq.unref?.();return()=>{if(X_.delete($),X_.size===0&&bq!==null)clearInterval(bq),bq=null,Q_=0}}var X_,Q_=0,bq=null;var qE=a(()=>{J_();X_=new Set});function Ga($){return Ya.read($)}function Wa($){Ya.poll($)}var Eq0=4000,wq0=60000,xq0=1500,fq0,Ya;var Ha=a(()=>{wJ();hF();cH();hF();fq0={added:0,deleted:0},Ya=Z_({initial:fq0,equals:aK,timeoutMs:Eq0,slowRetryMs:wq0,minIntervalMs:xq0,run:async($,Z)=>{let J=await t6("git",["status","--porcelain=v1"],{cwd:$,env:a2(),signal:Z});if(J.status!==0)throw Error("git status failed");return uH(J.stdout)}})});function UE($,Z){return Z===void 0?$:`${$}\x00${Z}`}function gq0($){if(typeof $!=="object"||$===null||Array.isArray($))return{};let Z={};for(let[J,X]of Object.entries($))if(typeof X==="number"&&Number.isFinite(X))Z[J]=X;return Z}function yq0($,Z,J,X=200){let z=$[Z];if(z!==void 0&&z>=J)return $;let G={...$,[Z]:J},W=Object.keys(G);if(W.length<=X)return G;let H={};for(let U of W.sort((K,N)=>G[N]-G[K]).slice(0,X))H[U]=G[U];return H}function qa($,Z,J){if(!$||J===void 0)return!1;let X=$.get("completionSeen");if(typeof X!=="object"||X===null||Array.isArray(X))return!1;let z=X[Z];return typeof z==="number"&&z>=J}function Ua($,Z,J){let X=gq0($.get("completionSeen")),z=yq0(X,Z,J);if(z!==X)$.set("completionSeen",z)}import{TextAttributes as bq0}from"@opentui/core";function Ba($){return kq.useSyncExternalStore($?Y_:kq0,$?z_:vq0)}function Ka($,Z){let J=JT($.worktreeChanges,Z.worktreePath),X=J!==null;return kq.useEffect(()=>{if($.branchTick,X||Z.archived)return;Wa(Z.worktreePath)},[X,Z.archived,Z.worktreePath,$.branchTick]),J??Ga(Z.worktreePath)}function Fa($){let{theme:Z}=l0();if($.changes.added<=0&&$.changes.deleted<=0)return null;return R.jsxDEV("box",{flexDirection:"row",gap:1,flexShrink:0,children:[$.changes.added>0?R.jsxDEV("text",{fg:Z.success,wrapMode:"none",flexShrink:0,children:["+",$.changes.added]},void 0,!0,void 0,this):null,$.changes.deleted>0?R.jsxDEV("text",{fg:Z.error,wrapMode:"none",flexShrink:0,children:["\u2212",$.changes.deleted]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function Ma($,Z,J,X,z=!1){let G=UE($,X);if(Z==="turn_complete"){if(J)BE.add(G)}else BE.delete(G);return BE.has(G)||z}function Na($){return $?.state==="turn_complete"?$.at:void 0}function Oa($,Z,J,X){let z=bQ(),G=UE($,Z),W=qa(z,G,J);return kq.useEffect(()=>{if(!z||!X||J===void 0||W)return;Ua(z,G,J)},[z,G,J,X,W]),W}function KE($){let{theme:Z}=l0(),J=th($.flatIndex);if(J===null)return null;return R.jsxDEV("text",{fg:$.dim?Z.textMuted:Z.accent,attributes:bq0.DIM,wrapMode:"none",flexShrink:0,children:J},void 0,!1,void 0,this)}var kq,kq0=()=>()=>{},vq0=()=>0,BE;var La=a(async()=>{xS();qE();YE();xT();JE();J_();gJ();cH();Ha();M3();Q$();r0();await $$();kq=H1(q1(),1);BE=new Set});import{MouseButton as mq0}from"@opentui/core";function FE($){let{theme:Z}=l0(),J=$.shared,X=iJ(Z,{cursor:J.cursorIndex===$.flatIndex,selected:J.activeRowId===$.rowId});return R.jsxDEV("box",{ref:(z)=>{if(!z)return;return J.rowEls.set($.flatIndex,z),()=>{if(J.rowEls.get($.flatIndex)===z)J.rowEls.delete($.flatIndex)}},width:"100%",flexDirection:"row",gap:0,backgroundColor:X.backgroundColor,onMouseUp:(z)=>{if(z.stopPropagation(),z.button===mq0.RIGHT&&J.onContextMenu){J.onContextMenu($.flatIndex,$.rowId,z.x,z.y);return}J.onPress($.flatIndex,$.rowId)},children:[R.jsxDEV("text",{fg:X.markerColor,wrapMode:"none",children:X.marker},void 0,!1,void 0,this),R.jsxDEV("text",{wrapMode:"none",flexShrink:0,children:" ".repeat($.depth*hq0)},void 0,!1,void 0,this),$.children]},void 0,!0,void 0,this)}function Va($){let{theme:Z}=l0(),J=$.shared,X=$.task,z=J.cursorIndex===$.flatIndex,G=Ka(J,X),W=GE(X),H=X.kind==="main";ja.useEffect(()=>{if(J.branchTick,H)zE(X.repo)},[H,X.repo,J.branchTick]);let U=(H?QE(X.repo):X.branch)||X.branch||X.title;return R.jsxDEV(FE,{rowId:$.rowId,flatIndex:$.flatIndex,depth:1,shared:J,children:R.jsxDEV("box",{flexDirection:"row",flexGrow:1,paddingRight:1,gap:1,children:[R.jsxDEV("text",{fg:Z.text,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:U},void 0,!1,void 0,this),X.pinned===!0?R.jsxDEV("text",{fg:Z.warning,wrapMode:"none",flexShrink:0,children:"\u25B4"},void 0,!1,void 0,this):null,W?R.jsxDEV("text",{fg:Hj(Z,W.tone),wrapMode:"none",flexShrink:0,children:W.glyph},void 0,!1,void 0,this):null,R.jsxDEV(Fa,{changes:G},void 0,!1,void 0,this),R.jsxDEV(KE,{flatIndex:$.flatIndex,dim:!z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function _a($){let{theme:Z}=l0(),J=$.shared,X=J.cursorIndex===$.flatIndex,z=$.tab.engine===!0,G=z?J.engineTabState?.get($.task.id):void 0,W=z?mo({tabActivity:G?.get($.tab.id),reportedTabCount:G?.size??0,taskActivity:J.engineState?.get($.task.id),active:$.tab.active===!0}):void 0,H=W!==void 0,U=J.selectedTaskId===$.task.id&&$.tab.active===!0,K=Oa($.task.id,$.tab.id,H?Na(W):void 0,U),N=H?Ma($.task.id,W?.state,U,$.tab.id,K):!1,L=WE({task:$.task,activity:W,lifecycle:H?J.engineLifecycle?.get($.task.id):void 0,job:H?J.taskJobs?.get($.task.id):void 0,spinnerFrame:0,subtitleBudget:0,truncateBranch:UT,completionSeen:N}),M=Ba(H&&L.loading),V=HE(L,()=>M),P="\u25CC",_=z?H?V.stateGlyph:"\u25CC":"\xB7";return R.jsxDEV(FE,{rowId:$.rowId,flatIndex:$.flatIndex,depth:2,shared:$.shared,children:[R.jsxDEV("text",{fg:H?Hj(Z,V.tone):Z.textMuted,wrapMode:"none",width:2,flexShrink:0,children:`${_} `},void 0,!1,void 0,this),R.jsxDEV("box",{flexDirection:"row",flexGrow:1,paddingRight:1,gap:1,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:$.tab.label},void 0,!1,void 0,this),R.jsxDEV(KE,{flatIndex:$.flatIndex,dim:!X},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ca($){let{theme:Z}=l0(),J=Z1();return R.jsxDEV(FE,{rowId:$.rowId,flatIndex:$.flatIndex,depth:1,shared:$.shared,children:[R.jsxDEV("text",{fg:Z.accent,wrapMode:"none",width:2,flexShrink:0,children:"\u21A9 "},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.text,wrapMode:"none",flexShrink:1,children:J("tasks.recentJump",{title:$.task.title})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var ja,hq0=1;var Da=a(async()=>{YE();J_();mF();gJ();Q$();r0();await e1([$$(),La()]);ja=H1(q1(),1)});function Aa($){let{theme:Z}=l0(),J=Z1();return R.jsxDEV("scrollbox",{ref:$.setScrollRef,flexGrow:1,minHeight:0,stickyScroll:!1,verticalScrollbarOptions:{visible:!1},children:R.jsxDEV("box",{flexShrink:0,gap:0,children:[$.rows.map((X,z)=>{if(X.kind==="project")return R.jsxDEV(io,{label:X.label,suffix:$.movingProjectId===X.id?J("tasks.moveChip"):void 0,topPad:z>0,onContextMenu:$.onProjectContextMenu?(G,W)=>$.onProjectContextMenu?.(X.id,G,W):void 0},X.id,!1,void 0,this);if(X.kind==="recent")return R.jsxDEV(Ca,{rowId:X.id,flatIndex:$.flatIndexOf.get(X.id)??-1,task:X.task,shared:$.shared},X.id,!1,void 0,this);if(X.kind==="worktree")return R.jsxDEV(Va,{rowId:X.id,flatIndex:$.flatIndexOf.get(X.id)??-1,task:X.task,shared:$.shared},X.id,!1,void 0,this);return R.jsxDEV(_a,{rowId:X.id,flatIndex:$.flatIndexOf.get(X.id)??-1,task:X.task,tab:X.tab,shared:$.shared},X.id,!1,void 0,this)}),$.rows.length===0?R.jsxDEV("box",{paddingTop:1,paddingLeft:1,children:R.jsxDEV("text",{fg:Z.textMuted,children:J(Jh({searching:$.searching,projectFilter:!1,view:$.view}))},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Pa=a(async()=>{gJ();Q$();r0();await e1([$$(),XE(),Da()])});function Ra($){return[{action:"rename",labelKey:"tasks.menu.rename"},{action:"pin",labelKey:$?"tasks.menu.unpin":"tasks.menu.pin"},{action:"localMerge",labelKey:"tasks.menu.localMerge"},{action:"archive",labelKey:"tasks.menu.archive"},{action:"delete",labelKey:"tasks.menu.delete",danger:!0}]}function Ta($,Z={}){if($.kind==="project")return[{action:"newTask",labelKey:"tasks.menu.newTask"}];if($.kind==="worktree")return[{action:"open",labelKey:"tasks.menu.open"},...Ra($.task.pinned===!0)];let J=[{action:"open",labelKey:"tasks.menu.openTab"}];if((Z.tabCount??0)>1)J.push({action:"closeTab",labelKey:"tasks.menu.closeTab"});return[...J,...Ra($.task.pinned===!0)]}function Sa($){let Z=Z1(),{tree:J,activateRow:X,setCursorIndex:z,actions:G}=$,[W,H]=z6.useState(null),[U,K]=z6.useState(0),N=z6.useCallback((E,S,T,x)=>{let b=Ta(E,S);H({row:E,actions:b.map((v)=>v.action),entries:b.map((v)=>({id:v.action,label:Z(v.labelKey),danger:v.danger})),x:T,y:x}),K(0)},[Z]),L=z6.useCallback((E,S,T,x)=>{let b=J.rows.find((v)=>v.id===S);if(!b||b.kind==="project"||b.kind==="recent")return;z(E),N(b,{tabCount:J.tabCount(b.task.id)},T,x)},[J.rows,J.tabCount,N,z]),M=z6.useCallback((E,S,T)=>{let x=J.rows.find((b)=>b.kind==="project"&&b.id===E);if(!x)return;N(x,{},S,T)},[J.rows,N]),V=z6.useCallback(()=>H(null),[]),P=z6.useCallback((E)=>{let S=W?.entries.length??0;if(S===0)return;K((T)=>(T+E+S)%S)},[W]),_=z6.useCallback((E)=>{if(!W||E===void 0)return;let S=W.row;if(H(null),S.kind==="project"){if(E==="newTask")$.onAddTask?.();return}let T=S.task.id;switch(E){case"open":X(S.id);break;case"closeTab":if(S.kind==="tab")$.onCloseTab?.(T,S.tab.id);break;case"rename":G.onRenameRequest?.(T);break;case"pin":G.onPinRequest?.(T);break;case"localMerge":G.onLocalMergeRequest?.(T);break;case"archive":G.onArchiveRequest?.(T);break;case"delete":G.onDeleteRequest?.(T);break;default:break}},[W,X,G,$.onAddTask,$.onCloseTab]),C=z6.useCallback(()=>_(W?.actions[U]),[_,W,U]),f=z6.useCallback((E)=>_(W?.actions.find((S)=>S===E)),[_,W]);return{open:W!==null,entries:W?.entries??[],cursor:U,x:W?.x??0,y:W?.y??0,close:V,moveCursor:P,pickCurrent:C,pick:f,openForRow:L,openForProject:M}}var z6;var Ia=a(()=>{Q$();z6=H1(q1(),1)});function Ea($){let[Z,J]=pQ.useState(!1),[X,z]=pQ.useState(""),G=w1($.focused),W=$.onActiveChange,H=pQ.useCallback(()=>{z(""),J(!0),W?.(!0)},[W]),U=pQ.useCallback(()=>{J(!1),z(""),W?.(!1)},[W]),K=E4();return pQ.useEffect(()=>{if(!Z||!K)return;let N=(L)=>{if(!G.current||bY())return;z((M)=>Xh(M,L)??M)};return K.keyInput.on("keypress",N),()=>{K.keyInput.off("keypress",N)}},[Z,K]),{active:Z,query:X,enter:H,exit:U}}var pQ;var wa=a(async()=>{gJ();W2();await e1([h4(),C4()]);pQ=H1(q1(),1)});function xa($){return $.split("::").slice(0,2).join("::")}function G_($,Z=Date.now()){ME.set(xa($),Z)}function fa($,Z=Date.now()){let J=xa($),X=ME.get(J);if(X===void 0)return!1;if(Z-X>15000)return ME.delete(J),!1;return!0}var ME;var W_=a(()=>{ME=new Map});import{basename as ga}from"path";function cq0($){return ga($).replace(/\.(exe|js|mjs|cjs)$/,"")}function dq0($){for(let Z of $.trim().split(/\s+/).slice(0,4)){if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(Z))continue;let J=cq0(Z);if(uq0.has(J))continue;return WQ.find((X)=>D$(X).defaultCommand[0]===J)??null}return null}function LZ($){let Z=[];for(let J of $.split(`
|
|
730
|
+
`).map((Z)=>Z.trim()).filter(Boolean)}function _o($){let{theme:Z}=l0(),J=Z1(),X=E4(),[z,G]=dQ.useState(null),[W,H]=dQ.useState([]),[U,K]=dQ.useState(!0),[N,L]=dQ.useState("update"),[M,V]=dQ.useState(null),P=z?.latest??A$,_=W[0]?.url??xR(P),C=[{id:"update",key:"U",label:J("update.actions.updateNow"),detail:WZ},{id:"release",key:"R",label:J("update.actions.openRelease"),detail:_??J("update.releaseUrlUnavailable")},{id:"close",key:"Q",label:J("update.actions.close"),detail:J("update.actions.closeDetail")}];dQ.useEffect(()=>{f()},[]);async function f(){let x=await jY({force:!0});G(x);let b=x?.latest??A$,v=await wR({current:A$,latest:b});H(v),K(!1)}function E(x){let b=C.map((o)=>o.id),u=(b.indexOf(N)+x+b.length)%b.length;L(b[u]??"update")}function S(x=N){if(x==="close"){$.onClose();return}if(x==="release"){V(Zq0(_)?J("update.statusReleaseOpened"):J("update.statusReleaseError"));return}T()}async function T(){V(J("update.statusRunningUpdater")),await new Promise((x)=>setTimeout(x,30)),await eV({renderer:X,t:J,targetLabel:P,command:WZ})}return g1(()=>({bindings:[{key:"up",cmd:()=>E(-1)},{key:"down",cmd:()=>E(1)},{key:"k",cmd:()=>E(-1)},{key:"j",cmd:()=>E(1)},{key:"return",cmd:()=>S()},{key:"u",cmd:()=>S("update")},{key:"r",cmd:()=>S("release")},...a7(()=>S("close"))]})),R.jsxDEV("box",{flexDirection:"column",flexGrow:1,backgroundColor:Z.background,paddingTop:1,paddingLeft:2,paddingRight:2,children:[R.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",flexShrink:0,children:[R.jsxDEV("text",{fg:Z.text,attributes:gq.BOLD,wrapMode:"none",children:J("update.pageTitle")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",onMouseUp:()=>S("close"),children:"q / esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV("box",{flexDirection:"row",gap:2,flexShrink:0,paddingTop:1,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:J("update.current")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.text,attributes:gq.BOLD,wrapMode:"none",children:["v",A$]},void 0,!0,void 0,this),R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:J("update.latest")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:z?.hasUpdate?Z.warning:Z.success,attributes:gq.BOLD,wrapMode:"none",children:["v",P]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV("box",{flexDirection:"column",flexShrink:0,paddingTop:1,gap:0,children:C.map((x)=>R.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:1,paddingRight:1,backgroundColor:N===x.id?Z.primary:void 0,onMouseUp:()=>S(x.id),children:[R.jsxDEV("box",{width:4,flexShrink:0,children:R.jsxDEV("text",{fg:N===x.id?Z.selectedListItemText:Z.accent,attributes:gq.BOLD,wrapMode:"none",children:["[",x.key,"]"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),R.jsxDEV("box",{width:14,flexShrink:0,children:R.jsxDEV("text",{fg:N===x.id?Z.selectedListItemText:Z.text,wrapMode:"none",children:x.label},void 0,!1,void 0,this)},void 0,!1,void 0,this),R.jsxDEV("text",{fg:N===x.id?Z.selectedListItemText:Z.textMuted,wrapMode:"word",children:x.detail},void 0,!1,void 0,this)]},x.id,!0,void 0,this))},void 0,!1,void 0,this),M?R.jsxDEV("text",{fg:Z.info,wrapMode:"word",children:M},void 0,!1,void 0,this):null,R.jsxDEV("box",{flexShrink:0,paddingTop:1,children:R.jsxDEV("text",{fg:Z.textMuted,attributes:gq.DIM,wrapMode:"none",children:J("update.changesSectionHeader",{from:A$,to:P})},void 0,!1,void 0,this)},void 0,!1,void 0,this),R.jsxDEV("scrollbox",{flexGrow:1,flexShrink:1,stickyScroll:!1,verticalScrollbarOptions:{trackOptions:{backgroundColor:Z.background,foregroundColor:Z.borderActive}},children:R.jsxDEV("box",{flexDirection:"column",paddingRight:1,paddingBottom:1,gap:0,children:[U?R.jsxDEV("text",{fg:Z.textMuted,children:J("update.loadingNotes")},void 0,!1,void 0,this):null,!U&&W.length===0?R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:J("update.notesUnavailable")},void 0,!1,void 0,this):null,W.map((x)=>R.jsxDEV("box",{flexDirection:"column",paddingBottom:1,gap:0,children:[R.jsxDEV("text",{fg:Z.text,attributes:gq.BOLD,wrapMode:"none",children:["v",x.version]},void 0,!0,void 0,this),tI(x.body).map((b,v)=>R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:b},`${v}:${b}`,!1,void 0,this))]},x.version,!0,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var dQ;var eI=a(async()=>{w8();Q$();sI();r0();await e1([h4(),$$(),C4()]);dQ=H1(q1(),1)});import{TextAttributes as Co}from"@opentui/core";function Jq0($){if(!$)return[];let Z=[];for(let J of $.listTasks())if(J.repo&&!Z.includes(J.repo))Z.push(J.repo);return Z}function Xq0($,Z){let J=Date.parse($);if(!Number.isFinite(J))return"";let X=Math.round((Z-J)/60000);if(X<60)return`${Math.max(X,0)}m`;let z=Math.round(X/60);if(z<24)return`${z}h`;return`${Math.round(z/24)}d`}function Do($){let{theme:Z}=l0(),J=Z1(),X=Jq0($.orchestrator),[z,G]=X6.useState(()=>{let u=$.focusRepo?X.indexOf($.focusRepo):-1;return u>=0?u:0}),W=X[z],[H,U]=X6.useState(null),[K,N]=X6.useState(null),[L,M]=X6.useState(0),[V,P]=X6.useState(!1),[_,C]=X6.useState(!1),[f,E]=X6.useState(null);X6.useEffect(()=>{let u=!1,o=$.orchestrator;if(!o||!W){U([]);return}return N(null),o.listWorkItems({repo:W,limit:30,...V?{assignee:"@me"}:{},...L>0?{refresh:!0}:{}}).then((m)=>{if(!u)U(m.items)}).catch((m)=>{if(u)return;N(m instanceof Error?m.message:String(m)),U([])}),()=>{u=!0}},[$.orchestrator,W,V,L]);let S=H??[],[T,x]=X6.useState(0);X6.useEffect(()=>{x((u)=>w4(u,S.length))},[S.length]);async function b(){let u=$.orchestrator,o=S[T];if(!u||!o||!W||_)return;C(!0),E(J("workItems.starting",{number:o.number}));try{let m=await u.startWorkItem({repo:W,number:o.number});if(m.started)$.onOpenTask?.(m.taskId);else E(J("workItems.startedNoEngine",{title:m.title}))}catch(m){E(m instanceof Error?m.message:String(m))}finally{C(!1)}}g1(()=>({enabled:$.focused!==!1,bindings:[...a7($.onClose),{key:"j",cmd:()=>x((u)=>w4(u+1,S.length))},{key:"down",cmd:()=>x((u)=>w4(u+1,S.length))},{key:"k",cmd:()=>x((u)=>w4(u-1,S.length))},{key:"up",cmd:()=>x((u)=>w4(u-1,S.length))},{key:"tab",cmd:()=>G((u)=>X.length?(u+1)%X.length:0)},{key:"a",cmd:()=>P((u)=>!u)},{key:"r",cmd:()=>M((u)=>u+1)},{key:"return",cmd:()=>void b()}]}));let v=Date.now();return R.jsxDEV("box",{flexDirection:"column",flexGrow:1,padding:1,children:[R.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",children:[R.jsxDEV("text",{attributes:Co.BOLD,fg:Z.accent,children:J("workItems.title")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.textMuted,children:[W?U9(W,X):J("workItems.noRepo"),V?` ${J("workItems.assignedFilter")}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K?R.jsxDEV("box",{flexDirection:"column",marginTop:1,children:R.jsxDEV("text",{fg:Z.error,children:K},void 0,!1,void 0,this)},void 0,!1,void 0,this):H===null?R.jsxDEV("text",{fg:Z.textMuted,children:J("common.loading")},void 0,!1,void 0,this):S.length===0?R.jsxDEV("text",{fg:Z.textMuted,children:J("workItems.empty")},void 0,!1,void 0,this):R.jsxDEV("box",{flexDirection:"column",marginTop:1,flexGrow:1,children:S.map((u,o)=>{let m=iJ(Z,{cursor:o===T,selected:!1});return R.jsxDEV("box",{flexDirection:"column",flexShrink:0,...m.backgroundColor?{backgroundColor:m.backgroundColor}:{},children:[R.jsxDEV("box",{flexDirection:"row",gap:0,children:[R.jsxDEV("text",{fg:m.markerColor,wrapMode:"none",children:m.marker},void 0,!1,void 0,this),R.jsxDEV("box",{flexDirection:"row",flexGrow:1,paddingLeft:1,paddingRight:1,gap:1,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:`#${u.number}`},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.text,attributes:o===T?Co.BOLD:void 0,wrapMode:"none",flexGrow:1,children:u.title},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV("box",{flexDirection:"row",gap:0,children:[R.jsxDEV("text",{fg:m.markerColor,wrapMode:"none",children:m.marker},void 0,!1,void 0,this),R.jsxDEV("box",{flexDirection:"row",flexGrow:1,paddingLeft:2,paddingRight:1,gap:1,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",flexGrow:1,children:[u.author,...u.labels.slice(0,2)].filter(Boolean).join(" \xB7 ")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:Xq0(u.updatedAt,v)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},`${u.number}`,!0,void 0,this)})},void 0,!1,void 0,this),f?R.jsxDEV("text",{fg:Z.textMuted,children:f},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var X6;var Ao=a(async()=>{g8();L3();Q$();r0();await e1([$$(),C4()]);X6=H1(q1(),1)});import{TextAttributes as Po}from"@opentui/core";function Ro($){return $.flatMap((Z)=>Z.worktrees)}function Gq0($,Z){let J=(z)=>z.replace(/^\/private\//,"/").replace(/\/+$/,""),X=J(Z);return $.listTasks().find((z)=>z.worktreePath&&J(z.worktreePath)===X)?.id}function To($){let{theme:Z}=l0(),J=n$(),X=Z1(),[z,G]=tJ.useState(null),[W,H]=tJ.useState(0),U=()=>H((u)=>u+1);tJ.useEffect(()=>{let u=!1,o=!1,m=$.orchestrator;if(!m){G([]);return}return m.listWorktrees({network:!1}).then((e)=>{if(!u&&!o)G(e)}).catch(()=>{}),m.listWorktrees().then((e)=>{if(o=!0,u)return;G(e);let t=new Set(Ro(e).map((Y0)=>Y0.path));N((Y0)=>Y0.filter((F0)=>t.has(F0)))}).catch(()=>{}),()=>{u=!0}},[$.orchestrator,W]);let[K,N]=tJ.useState([]),L=(z??[]).map((u)=>({...u,worktrees:u.worktrees.filter((o)=>!K.includes(o.path))})),M=Ro(L),[V,P]=tJ.useState(0);tJ.useEffect(()=>{P((u)=>w4(u,M.length))},[M.length]);let[_,C]=tJ.useState(null);async function f(u,o){let m=$.orchestrator;if(!m)return;N((e)=>[...e,u.path]);try{await m.removeWorktree(u.path,o),U()}catch(e){if(N((t)=>t.filter((Y0)=>Y0!==u.path)),!o&&e instanceof Error&&Qq0.test(e.message)){if(await N4.show(J,X("worktrees.delete.forceTitle"),X("worktrees.delete.forceBody",{branch:u.branch||u.path}),X("common.cancel"),X("worktrees.delete.button"))===!0)await f(u,!0);return}console.error(`[rove worktrees] ${X("worktrees.delete.failed",{error:String(e)})}`)}}async function E(u){if(!$.orchestrator||_||K.includes(u.path))return;if(await N4.show(J,X("worktrees.delete.confirmTitle"),X("worktrees.delete.confirmBody",{branch:u.branch||u.path}),X("common.cancel"),X("worktrees.delete.button"))!==!0)return;f(u,!1)}async function S(u){let o=$.orchestrator;if(!o||_)return;let m=Gq0(o,u.path);if(!m){console.error(`[rove worktrees] ${X("worktrees.land.noTask")}`);return}if(await N4.show(J,X("worktrees.land.confirmTitle"),X("worktrees.land.confirmBody",{branch:u.branch||u.path}),X("common.cancel"),X("worktrees.land.button"))!==!0)return;C(u.path);try{let t=await o.landTask(m);console.error(`[rove worktrees] ${X("worktrees.land.done",{branch:t.branch,landedOn:t.landedOn,commit:t.commit})}`),U()}catch(t){let Y0=t instanceof Error?t.message:String(t);if(zq0.test(Y0))console.error(`[rove worktrees] ${X("worktrees.land.conflict",{files:Y0})}`);else if(Yq0.test(Y0))console.error(`[rove worktrees] ${X("worktrees.land.dirtyBase")}`);else console.error(`[rove worktrees] ${X("worktrees.land.failed",{error:Y0})}`)}finally{C(null)}}g1(()=>({enabled:J.stack.length===0,bindings:[...a7($.onClose),{key:"up",cmd:()=>P((u)=>w4(u-1,M.length))},{key:"down",cmd:()=>P((u)=>w4(u+1,M.length))},{key:"d",cmd:()=>{let u=M[V];if(u)E(u)}},{key:"l",cmd:()=>{let u=M[V];if(u)S(u)}}]}));function T(u){if(u===!0)return R.jsxDEV("text",{fg:Z.success,children:[" ",X("worktrees.badge.remoteOn")]},void 0,!0,void 0,this);if(u===!1)return R.jsxDEV("text",{fg:Z.warning,children:[" ",X("worktrees.badge.remoteOff")]},void 0,!0,void 0,this);return R.jsxDEV("text",{fg:Z.textMuted,children:[" ",X("worktrees.badge.remoteUnknown")]},void 0,!0,void 0,this)}function x(u){if(u.verdictReason==="dirty"||u.verdictReason==="fresh")return null;let o=u.verdict==="merged"?Z.success:u.verdict==="stale"?Z.warning:Z.accent;return R.jsxDEV("text",{fg:o,children:[" ",X(`worktrees.verdict.${u.verdictReason}`)]},void 0,!0,void 0,this)}let b=z===null,v=0;return R.jsxDEV("scrollbox",{flexGrow:1,backgroundColor:Z.background,paddingTop:1,paddingLeft:2,paddingRight:2,paddingBottom:1,verticalScrollbarOptions:{trackOptions:{foregroundColor:"transparent"}},children:[R.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",children:R.jsxDEV("text",{attributes:Po.BOLD,fg:Z.text,children:X("worktrees.title")},void 0,!1,void 0,this)},void 0,!1,void 0,this),b?R.jsxDEV("text",{fg:Z.textMuted,children:X("worktrees.loading")},void 0,!1,void 0,this):L.length===0?R.jsxDEV("text",{fg:Z.textMuted,children:X("worktrees.noProjects")},void 0,!1,void 0,this):L.map((u)=>{let o=v;return v+=u.worktrees.length,R.jsxDEV("box",{gap:0,paddingTop:1,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:u.repo},void 0,!1,void 0,this),u.worktrees.length===0?R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:X("worktrees.noWorktrees")},void 0,!1,void 0,this):u.worktrees.map((m,e)=>{let t=o+e,Y0=t===V;return R.jsxDEV("box",{gap:0,onMouseUp:()=>P(t),children:[R.jsxDEV("box",{flexDirection:"row",children:[R.jsxDEV("text",{fg:Y0?Z.primary:Z.text,attributes:Y0?Po.BOLD:void 0,wrapMode:"none",children:[Y0?"\u25B8 ":" ",m.branch||X("worktrees.row.detached")]},void 0,!0,void 0,this),m.kobeManaged?R.jsxDEV("text",{fg:Z.textMuted,children:[" ",X("worktrees.badge.kobeManaged")]},void 0,!0,void 0,this):null,m.dirty?R.jsxDEV("text",{fg:Z.warning,children:[" ",X("worktrees.badge.dirty")]},void 0,!0,void 0,this):null,T(m.branchOnRemote),x(m),_===m.path?R.jsxDEV("text",{fg:Z.textMuted,children:" \u2026"},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),R.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",paddingLeft:2,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:m.path},void 0,!1,void 0,this),m.createdAtMs>0?R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:X("worktrees.row.created",{age:rY(m.createdAtMs)})},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},m.path,!0,void 0,this)})]},u.repo,!0,void 0,this)})]},void 0,!0,void 0,this)}var tJ,Qq0,zq0,Yq0;var So=a(async()=>{g8();rV();Q$();r0();await e1([$$(),C4(),V5(),FZ()]);tJ=H1(q1(),1);Qq0=/refusing to remove dirty worktree/,zq0=/LAND_CONFLICT/,Yq0=/MAIN_CHECKOUT_DIRTY/});function Io($){let[Z,J]=vF.useState(!1),[X,z]=vF.useState(!1),[G,W]=vF.useState(!1),[H,U]=vF.useState("terminal"),K=(N)=>{U(N),$.setFocused(gi(N))};return{nav:H,setNav:U,goToNav:K,settingsOpen:Z,openSettings:()=>J(!0),closeSettings:()=>J(!1),worktreesOpen:X,openWorktrees:()=>z(!0),closeWorktrees:()=>z(!1),updateOpen:G,openUpdate:()=>W(!0),closeUpdate:()=>W(!1),kanbanOpen:H==="kanban",openKanban:()=>K("kanban"),closeKanban:()=>K("terminal"),automationsOpen:H==="automations",openAutomations:()=>K("automations"),closeAutomations:()=>K("terminal"),workItemsOpen:H==="issues",openWorkItems:()=>K("issues"),closeWorkItems:()=>K("terminal")}}function Eo($){if($.worktreesOpen)return R.jsxDEV(To,{orchestrator:$.orchestrator,onClose:$.closeWorktrees},void 0,!1,void 0,this);if($.updateOpen)return R.jsxDEV(_o,{onClose:$.closeUpdate},void 0,!1,void 0,this);return null}function wo($){let Z=$.orchestrator;if($.automationsOpen)return R.jsxDEV(si,{orchestrator:Z,focused:$.contentFocused,...$.selectedTask?{focusRepo:$.selectedTask.repo}:{},onClose:$.closeAutomations,onOpenTask:(J)=>{$.closeAutomations(),$.activateTask(J)}},void 0,!1,void 0,this);if($.workItemsOpen)return R.jsxDEV(Do,{orchestrator:Z,focused:$.contentFocused,onClose:$.closeWorkItems,...$.selectedTask?{focusRepo:$.selectedTask.repo}:{},onOpenTask:(J)=>{$.closeWorkItems(),$.activateTask(J)}},void 0,!1,void 0,this);if($.kanbanOpen)return R.jsxDEV(jo,{orchestrator:Z,focused:$.contentFocused,onClose:$.closeKanban,onStartChat:$.startIssueChat,engineStates:$.engineStates,focusTask:$.selectedTask?{id:$.selectedTask.id,repo:$.selectedTask.repo}:void 0,onOpenTask:(J)=>{$.closeKanban(),$.activateTask(J)}},void 0,!1,void 0,this);return null}var vF;var xo=a(async()=>{yI();r0();await e1([ti(),Vo(),eI(),Ao(),So()]);vF=H1(q1(),1)});function fo($){let Z=$.scheduleTimeout??((U,K)=>{let N=setTimeout(U,K);return()=>clearTimeout(N)}),J=!1,X=null,z=()=>{J=!0,X?.(),X=Z(()=>{J=!1,X=null},700)},G=()=>{J=!1,X?.(),X=null},W=(U)=>{let K=$.getFlatIds();if(K.length===0)return;let N=$.getCursor(),L=N<0?0:N,M=Math.min(K.length-1,Math.max(0,L+U));$.setCursor(M)},H=(U)=>{let K=$.getFlatIds();if(K.length===0)return;$.setCursor(Math.min(K.length-1,Math.max(0,U)))};return{moveDown(){G(),W(1)},moveUp(){G(),W(-1)},selectCurrent(){G();let U=$.getFlatIds(),K=$.getCursor();if(K<0||K>=U.length)return;let N=U[K];if(N!==void 0)$.onSelect(N)},pressG(){if(J)G(),H(0);else z()},pressShiftG(){G(),H($.getFlatIds().length-1)},isChordArmed(){return J},disarmChord(){G()}}}function yo($,Z){if(!Z)return[...$];return[{kind:"recent",id:$_,task:Z,depth:1},...$]}function yq($,Z){return`${$}${$E}${Z}`}function lQ($){let Z=$.indexOf($E);if(Z<0)return{taskId:$,tabId:null};return{taskId:$.slice(0,Z),tabId:$.slice(Z+$E.length)}}function bo($){let{tasks:Z,tabsByTask:J}=$,X=new Map;for(let H of Z){let U=oY(H.repo),K=X.get(U)??{repo:H.repo,tasks:[]};if(H.kind==="main")K.repo=H.repo,K.tasks.unshift(H);else K.tasks.push(H);X.set(U,K)}let z=[],G=new Set;for(let H of Z){if(H.kind!=="main")continue;let U=oY(H.repo);if(!G.has(U))G.add(U),z.push(U)}for(let H of X.keys())if(!G.has(H))G.add(H),z.push(H);let W=[];for(let H of z){let U=X.get(H);if(!U)continue;W.push({kind:"project",id:H,repo:U.repo,label:OZ(U.repo),depth:0});for(let K of U.tasks)Wq0(W,K,J)}return W}function Wq0($,Z,J){$.push({kind:"worktree",id:Z.id,task:Z,depth:1});for(let X of J.get(Z.id)??[])$.push({kind:"tab",id:yq(Z.id,X.id),task:Z,tab:X,depth:2})}function ZE($){let Z=[];for(let J of $)if(J.kind!=="project")Z.push(J.id);return Z}function go($){return oY($.repo)}function Hq0($){if($.kind==="project")return $.label;if($.kind==="tab")return $.tab.label;return`${$.task.title} ${$.task.branch??""} ${OZ($.task.repo)}`}function ko($,Z){let J=Z.trim();if(J==="")return[...$];let X=new Set,z=new Set;for(let W of $){if(!dI(J,Hq0(W)))continue;if(X.add(W.id),z.add(W.id),W.kind==="project")continue;if(W.kind==="tab")z.add(W.task.id);let H=go(W.task);if(H!==null)z.add(H)}let G=[];for(let W of $){if(W.kind==="project"){if(z.has(W.id))G.push(W);continue}let H=go(W.task),U=H!==null&&X.has(H);if(W.kind==="worktree"){if(U||z.has(W.id))G.push(W);continue}if(U||X.has(W.task.id)||z.has(W.id))G.push(W)}return G}function vo($,Z){for(let J of $){if(J.kind!=="main")continue;if(oY(J.repo)===Z)return String(J.id)}return null}function mo($){if($.tabActivity!==void 0)return $.tabActivity;if(!$.active||$.reportedTabCount>0)return;return $.taskActivity}var $E="::",$_="~recent";var mF=a(()=>{L3()});function uo($){let Z=$.maxWidth??qq0,J=Math.max(1,...$.lines.map((W)=>sm(W.text))),X=Math.min(Z-4,J),z=X+4,G=$.lines.length+2;return{innerWidth:X,boxWidth:z,boxHeight:G,left:Math.max(0,Math.min($.hoverX+2,$.screenWidth-z-1)),top:Math.max(0,Math.min($.hoverY+1,$.screenHeight-G-1))}}var ho=2750,qq0=72;var co=a(()=>{L3()});function lo($,Z){return qZ($,Z)}var JE=()=>{};import{TextAttributes as Uq0}from"@opentui/core";function po($){let{theme:Z}=l0();if($.entries.length===0)return null;let J=uo({hoverX:$.x,hoverY:$.y,screenWidth:$.dims.width,screenHeight:$.dims.height,lines:$.entries.map((X)=>({text:X.label}))});return R.jsxDEV("box",{position:"absolute",zIndex:Bq0,left:J.left,top:J.top,width:J.boxWidth,flexDirection:"column",border:!0,borderColor:Z.focusAccent,backgroundColor:Z.backgroundElement,paddingLeft:1,paddingRight:1,children:$.entries.map((X,z)=>{let G=z===$.cursor;return R.jsxDEV("box",{flexShrink:0,backgroundColor:G?Z.focusAccent:void 0,onMouseUp:()=>$.onPick(X.id),children:R.jsxDEV("text",{fg:G?Z.backgroundElement:X.danger?Z.error:Z.text,attributes:G?Uq0.BOLD:void 0,wrapMode:"none",flexGrow:1,children:lo(X.label,J.innerWidth)},void 0,!1,void 0,this)},X.id,!1,void 0,this)})},void 0,!1,void 0,this)}var Bq0;var no=a(async()=>{co();JE();r0();await $$();Bq0=ho+10});import{MouseButton as Kq0,TextAttributes as Q6}from"@opentui/core";function io($){let{theme:Z,transparentBackground:J}=l0(),X=J?Z.border:Z.borderSubtle;return R.jsxDEV("box",{flexDirection:"column",flexShrink:0,children:[$.topPad?R.jsxDEV("box",{flexShrink:0,children:R.jsxDEV("text",{wrapMode:"none",children:" "},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,R.jsxDEV("box",{flexDirection:"row",flexShrink:0,gap:1,paddingLeft:1,paddingRight:1,onMouseUp:$.onPress||$.onContextMenu?(z)=>{if(z.button===Kq0.RIGHT&&$.onContextMenu){$.onContextMenu(z.x,z.y);return}$.onPress?.()}:void 0,children:[$.prefix?R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",flexShrink:0,children:$.prefix},void 0,!1,void 0,this):null,R.jsxDEV("text",{fg:Z.textMuted,attributes:Q6.BOLD,wrapMode:"none",flexShrink:0,children:$.label},void 0,!1,void 0,this),R.jsxDEV("text",{fg:X,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:"\u2500".repeat(240)},void 0,!1,void 0,this),$.suffix?R.jsxDEV("text",{fg:Z.info,attributes:Q6.BOLD,wrapMode:"none",flexShrink:0,children:$.suffix},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function oo($){let{theme:Z}=l0(),J=Z1();return R.jsxDEV("box",{flexDirection:"row",gap:0,flexShrink:0,paddingBottom:1,paddingLeft:1,children:[R.jsxDEV("text",{fg:Z.info,wrapMode:"none",children:"/"},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.text,wrapMode:"none",children:$.query},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.info,attributes:Q6.BLINK,wrapMode:"none",children:"\u2588"},void 0,!1,void 0,this),$.query.length===0?R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:[" ",J("tasks.search.placeholder")]},void 0,!0,void 0,this):R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:[" ",$.matchCount,"/",$.totalCount]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function ao($){let{theme:Z}=l0();return R.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",gap:1,flexShrink:0,paddingLeft:1,paddingRight:1,children:R.jsxDEV("box",{flexDirection:"row",gap:1,children:[R.jsxDEV("text",{fg:$.focused?Z.focusAccent:Z.textMuted,attributes:Q6.BOLD,wrapMode:"none",children:"ROVE"},void 0,!1,void 0,this),$.status?R.jsxDEV("text",{fg:$.status.emphasize?Z.warning:Z.textMuted,attributes:$.status.emphasize?Q6.BOLD:Q6.DIM,wrapMode:"none",onMouseUp:()=>$.onStatusClick?.(),children:$.status.label},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function ro($){let{theme:Z,transparentBackground:J}=l0(),X=Z1(),z=X9("task.new");if(!$.onAddTask)return null;return R.jsxDEV("box",{flexShrink:0,paddingTop:1,paddingBottom:1,paddingLeft:1,paddingRight:1,children:R.jsxDEV("box",{flexDirection:"row",flexShrink:0,gap:1,paddingLeft:1,paddingRight:1,backgroundColor:J?void 0:Z.backgroundElement,onMouseUp:()=>$.onAddTask?.(),children:[R.jsxDEV("text",{fg:Z.primary,attributes:Q6.BOLD,wrapMode:"none",flexShrink:0,children:"+"},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.text,attributes:Q6.BOLD,wrapMode:"none",flexGrow:1,children:X("tasks.menu.newTask")},void 0,!1,void 0,this),z?R.jsxDEV("text",{fg:Z.textMuted,attributes:Q6.DIM,wrapMode:"none",flexShrink:0,children:z},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function so($){let{theme:Z}=l0(),J=Z1();return R.jsxDEV("box",{flexDirection:"column",flexShrink:0,paddingBottom:1,children:fi.map((X)=>{let z=$.nav===X.nav;return R.jsxDEV("box",{flexDirection:"row",flexShrink:0,paddingLeft:1,paddingRight:1,backgroundColor:z?Z.focusAccent:void 0,onMouseUp:(G)=>{G.stopPropagation(),$.setNav(X.nav)},children:R.jsxDEV("text",{fg:z?Z.backgroundElement:Z.textMuted,attributes:z?Q6.BOLD:void 0,wrapMode:"none",flexGrow:1,children:J(X.labelKey)},void 0,!1,void 0,this)},X.nav,!1,void 0,this)})},void 0,!1,void 0,this)}function to($){let{theme:Z}=l0(),J=Z1();return R.jsxDEV("box",{flexDirection:"row",gap:1,flexShrink:0,paddingBottom:1,paddingLeft:1,paddingRight:1,children:lH.map((X)=>{let z=$.view===X.view;return R.jsxDEV("box",{flexShrink:0,paddingLeft:1,paddingRight:1,backgroundColor:z?Z.focusAccent:void 0,onMouseUp:()=>$.setView(X.view),children:R.jsxDEV("text",{fg:z?Z.backgroundElement:Z.textMuted,attributes:z?Q6.BOLD:void 0,wrapMode:"none",children:J($h(X.view))},void 0,!1,void 0,this)},X.view,!1,void 0,this)})},void 0,!1,void 0,this)}function eo($){let{theme:Z}=l0();return R.jsxDEV("box",{flexShrink:0,paddingLeft:1,paddingRight:1,paddingTop:1,children:R.jsxDEV("text",{fg:Z.accent,attributes:Q6.BOLD,wrapMode:"none",onMouseUp:(J)=>{J.stopPropagation(),$.onZenClick?.()},children:"\u262F ZEN"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var XE=a(async()=>{vj();yI();gJ();Q$();r0();await $$()});function Z_($){let Z=new Map,J=$.equals??((z,G)=>z===G);function X(z){let G=Z.get(z);if(!G){let W=$.initial;G={read:()=>W,write:(H)=>{if(!J(W,H))W=H},inFlight:!1,nextAllowedAt:0},Z.set(z,G)}return G}return{read(z){if(!z)return $.initial;return X(z).read()},poll(z){if(!z)return;let G=X(z);by(G,$,(W)=>$.run(z,W),(W)=>G.write(W))},reset(){Z.clear()}}}var hF=a(()=>{CH();CH()});import{stat as Fq0}from"fs/promises";import{join as Mq0}from"path";async function jq0($){try{let Z=await Fq0(Mq0($,".git","HEAD"));return`${Z.mtimeMs}:${Z.size}`}catch{return null}}async function Vq0($,Z,J=t6){let X=await jq0($);if(X!==null){let U=$a.get($);if(U&&U.fingerprint===X)return U.value}let z="",G=!1,W=await J("git",["symbolic-ref","--short","HEAD"],{cwd:$,env:a2(),signal:Z}),H=W.status===0?W.stdout.trim():"";if(H&&H!=="HEAD")z=H,G=!0;else if((await J("git",["rev-parse","--verify","HEAD"],{cwd:$,env:a2(),signal:Z})).status===0)z="(detached)",G=!0;if(G&&X!==null)$a.set($,{fingerprint:X,value:z});return z}function QE($){return Za.read($)}function zE($){Za.poll($)}var Nq0=2000,Oq0=30000,Lq0=1500,$a,Za;var YE=a(()=>{wJ();hF();$a=new Map;Za=Z_({initial:"",timeoutMs:Nq0,slowRetryMs:Oq0,minIntervalMs:Lq0,run:($,Z)=>Vq0($,Z)})});function _q0($){switch($){case"rate_limited":return{text:S$("tasks.activity.rateLimited"),tone:"warning"};case"permission_needed":return{text:S$("tasks.activity.permissionNeeded"),tone:"warning"};case"error":return{text:S$("tasks.activity.error"),tone:"error"};default:return null}}function GE($){switch($.prStatus?.checkState){case"passing":return{glyph:"\u2713",tone:"success"};case"failing":return{glyph:"\u2717",tone:"error"};case"pending":return{glyph:"\u2022",tone:"warning"};default:return null}}function Dq0(){return S$("tasks.subtitle.noTracking")}function Aq0(){return S$("tasks.subtitle.materializing")}function Pq0($){return $?S$("tasks.subtitle.deleteFailed"):S$("tasks.subtitle.deleting")}function Qa($){if($.kind==="main")return!1;return $.vendor!==void 0&&!h7($.vendor)}function za($,Z){if($?.state!=="turn_complete"||!Z)return!1;if(!$.at||!Z.mtimeMs)return!1;return Z.mtimeMs>$.at+Rq0}function Tq0($){let{task:Z}=$,J=$.activity?.state,X=J!==void 0,z=Qa(Z)&&!X,G=$.job!==void 0,W=Z.deletion?.phase==="queued"||Z.deletion?.phase==="running",H=J==="running"||za($.activity,$.transcript);return W||G||!z&&H}function WE($){let{task:Z}=$,J=Z.kind==="main",X=J?$.mainBranch??"":Z.branch,z=$.activity?.state,G=z!==void 0,H=za($.activity,$.transcript)?null:Sq0(z,$.completionSeen===!0),U=_q0(z),K=Qa(Z)&&!G,N=$.job!==void 0,L=Z.deletion?.phase==="queued"||Z.deletion?.phase==="running",M=Z.deletion?.phase==="error",V=Tq0({task:Z,activity:$.activity,job:$.job,transcript:$.transcript}),P=D$(Z.vendor??M4).spinnerFrames??mL,_=P[$.spinnerFrame%P.length]??P[0],C=M?"error":L||N?"primary":K?"textMuted":U?.tone??(V?"primary":H?.tone??"textMuted"),f=K?Dq0():"\u2014",E=V?$.lifecycle?.subagents??0:0,S=E>0&&X.length>0?`\u25C7${E} ${X}`:X,T=L||M?$.truncateBranch(Pq0(M),$.subtitleBudget):N?$.truncateBranch(Aq0(),$.subtitleBudget):U?$.truncateBranch(U.text,$.subtitleBudget):S.length>0?$.truncateBranch(S,$.subtitleBudget):$.truncateBranch(f,$.subtitleBudget),x=M?"\u2715":K?Cq0:H?.glyph??"\u25CB";return{isMain:J,titleText:J?OZ(Z.repo):Z.title,subtitleText:T,loading:V,stateGlyph:V?_:x,tone:C,spinnerFrames:P,materializing:N}}function HE($,Z){if(!$.loading)return $;let J=$.spinnerFrames,X=J[Z()%J.length]??J[0]??"\u280B";if(X===$.stateGlyph)return $;return{...$,stateGlyph:X}}function Sq0($,Z){switch($){case"rate_limited":return{glyph:"\u25F7",tone:"warning"};case"permission_needed":return{glyph:"?",tone:"warning"};case"error":return{glyph:"\u2715",tone:"error"};case"turn_complete":return Z?null:{glyph:"\u25CF",tone:"primary"};default:return null}}var Ja=100,Xa=600,Cq0="\xB7",Rq0=2000;var J_=a(()=>{C7();hL();gY();d7();u7();L3()});function Iq0(){Q_=(Q_+1)%Xa;for(let $ of X_)try{$()}catch{}}function z_(){return Q_}function Y_($){if(X_.add($),bq===null)bq=setInterval(Iq0,Ja),bq.unref?.();return()=>{if(X_.delete($),X_.size===0&&bq!==null)clearInterval(bq),bq=null,Q_=0}}var X_,Q_=0,bq=null;var qE=a(()=>{J_();X_=new Set});function Ga($){return Ya.read($)}function Wa($){Ya.poll($)}var Eq0=4000,wq0=60000,xq0=1500,fq0,Ya;var Ha=a(()=>{wJ();hF();cH();hF();fq0={added:0,deleted:0},Ya=Z_({initial:fq0,equals:aK,timeoutMs:Eq0,slowRetryMs:wq0,minIntervalMs:xq0,run:async($,Z)=>{let J=await t6("git",["status","--porcelain=v1"],{cwd:$,env:a2(),signal:Z});if(J.status!==0)throw Error("git status failed");return uH(J.stdout)}})});function UE($,Z){return Z===void 0?$:`${$}\x00${Z}`}function gq0($){if(typeof $!=="object"||$===null||Array.isArray($))return{};let Z={};for(let[J,X]of Object.entries($))if(typeof X==="number"&&Number.isFinite(X))Z[J]=X;return Z}function yq0($,Z,J,X=200){let z=$[Z];if(z!==void 0&&z>=J)return $;let G={...$,[Z]:J},W=Object.keys(G);if(W.length<=X)return G;let H={};for(let U of W.sort((K,N)=>G[N]-G[K]).slice(0,X))H[U]=G[U];return H}function qa($,Z,J){if(!$||J===void 0)return!1;let X=$.get("completionSeen");if(typeof X!=="object"||X===null||Array.isArray(X))return!1;let z=X[Z];return typeof z==="number"&&z>=J}function Ua($,Z,J){let X=gq0($.get("completionSeen")),z=yq0(X,Z,J);if(z!==X)$.set("completionSeen",z)}import{TextAttributes as bq0}from"@opentui/core";function Ba($){return kq.useSyncExternalStore($?Y_:kq0,$?z_:vq0)}function Ka($,Z){let J=JT($.worktreeChanges,Z.worktreePath),X=J!==null;return kq.useEffect(()=>{if($.branchTick,X||Z.archived)return;Wa(Z.worktreePath)},[X,Z.archived,Z.worktreePath,$.branchTick]),J??Ga(Z.worktreePath)}function Fa($){let{theme:Z}=l0();if($.changes.added<=0&&$.changes.deleted<=0)return null;return R.jsxDEV("box",{flexDirection:"row",gap:1,flexShrink:0,children:[$.changes.added>0?R.jsxDEV("text",{fg:Z.success,wrapMode:"none",flexShrink:0,children:["+",$.changes.added]},void 0,!0,void 0,this):null,$.changes.deleted>0?R.jsxDEV("text",{fg:Z.error,wrapMode:"none",flexShrink:0,children:["\u2212",$.changes.deleted]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function Ma($,Z,J,X,z=!1){let G=UE($,X);if(Z==="turn_complete"){if(J)BE.add(G)}else BE.delete(G);return BE.has(G)||z}function Na($){return $?.state==="turn_complete"?$.at:void 0}function Oa($,Z,J,X){let z=bQ(),G=UE($,Z),W=qa(z,G,J);return kq.useEffect(()=>{if(!z||!X||J===void 0||W)return;Ua(z,G,J)},[z,G,J,X,W]),W}function KE($){let{theme:Z}=l0(),J=th($.flatIndex);if(J===null)return null;return R.jsxDEV("text",{fg:$.dim?Z.textMuted:Z.accent,attributes:bq0.DIM,wrapMode:"none",flexShrink:0,children:J},void 0,!1,void 0,this)}var kq,kq0=()=>()=>{},vq0=()=>0,BE;var La=a(async()=>{xS();qE();YE();xT();JE();J_();gJ();cH();Ha();M3();Q$();r0();await $$();kq=H1(q1(),1);BE=new Set});import{MouseButton as mq0}from"@opentui/core";function FE($){let{theme:Z}=l0(),J=$.shared,X=iJ(Z,{cursor:J.cursorIndex===$.flatIndex,selected:J.activeRowId===$.rowId});return R.jsxDEV("box",{ref:(z)=>{if(!z)return;return J.rowEls.set($.flatIndex,z),()=>{if(J.rowEls.get($.flatIndex)===z)J.rowEls.delete($.flatIndex)}},width:"100%",flexDirection:"row",gap:0,backgroundColor:X.backgroundColor,onMouseUp:(z)=>{if(z.stopPropagation(),z.button===mq0.RIGHT&&J.onContextMenu){J.onContextMenu($.flatIndex,$.rowId,z.x,z.y);return}J.onPress($.flatIndex,$.rowId)},children:[R.jsxDEV("text",{fg:X.markerColor,wrapMode:"none",children:X.marker},void 0,!1,void 0,this),R.jsxDEV("text",{wrapMode:"none",flexShrink:0,children:" ".repeat($.depth*hq0)},void 0,!1,void 0,this),$.children]},void 0,!0,void 0,this)}function Va($){let{theme:Z}=l0(),J=$.shared,X=$.task,z=J.cursorIndex===$.flatIndex,G=Ka(J,X),W=GE(X),H=X.kind==="main";ja.useEffect(()=>{if(J.branchTick,H)zE(X.repo)},[H,X.repo,J.branchTick]);let U=(H?QE(X.repo):X.branch)||X.branch||X.title;return R.jsxDEV(FE,{rowId:$.rowId,flatIndex:$.flatIndex,depth:1,shared:J,children:R.jsxDEV("box",{flexDirection:"row",flexGrow:1,paddingRight:1,gap:1,children:[R.jsxDEV("text",{fg:Z.text,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:U},void 0,!1,void 0,this),X.pinned===!0?R.jsxDEV("text",{fg:Z.warning,wrapMode:"none",flexShrink:0,children:"\u25B4"},void 0,!1,void 0,this):null,W?R.jsxDEV("text",{fg:Hj(Z,W.tone),wrapMode:"none",flexShrink:0,children:W.glyph},void 0,!1,void 0,this):null,R.jsxDEV(Fa,{changes:G},void 0,!1,void 0,this),R.jsxDEV(KE,{flatIndex:$.flatIndex,dim:!z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function _a($){let{theme:Z}=l0(),J=$.shared,X=J.cursorIndex===$.flatIndex,z=$.tab.engine===!0,G=z?J.engineTabState?.get($.task.id):void 0,W=z?mo({tabActivity:G?.get($.tab.id),reportedTabCount:G?.size??0,taskActivity:J.engineState?.get($.task.id),active:$.tab.active===!0}):void 0,H=W!==void 0,U=J.selectedTaskId===$.task.id&&$.tab.active===!0,K=Oa($.task.id,$.tab.id,H?Na(W):void 0,U),N=H?Ma($.task.id,W?.state,U,$.tab.id,K):!1,L=WE({task:$.task,activity:W,lifecycle:H?J.engineLifecycle?.get($.task.id):void 0,job:H?J.taskJobs?.get($.task.id):void 0,spinnerFrame:0,subtitleBudget:0,truncateBranch:UT,completionSeen:N}),M=Ba(H&&L.loading),V=HE(L,()=>M),P="\u25CC",_=z?H?V.stateGlyph:"\u25CC":"\xB7";return R.jsxDEV(FE,{rowId:$.rowId,flatIndex:$.flatIndex,depth:2,shared:$.shared,children:[R.jsxDEV("text",{fg:H?Hj(Z,V.tone):Z.textMuted,wrapMode:"none",width:2,flexShrink:0,children:`${_} `},void 0,!1,void 0,this),R.jsxDEV("box",{flexDirection:"row",flexGrow:1,paddingRight:1,gap:1,children:[R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:$.tab.label},void 0,!1,void 0,this),R.jsxDEV(KE,{flatIndex:$.flatIndex,dim:!X},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ca($){let{theme:Z}=l0(),J=Z1();return R.jsxDEV(FE,{rowId:$.rowId,flatIndex:$.flatIndex,depth:1,shared:$.shared,children:[R.jsxDEV("text",{fg:Z.accent,wrapMode:"none",width:2,flexShrink:0,children:"\u21A9 "},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.text,wrapMode:"none",flexShrink:1,children:J("tasks.recentJump",{title:$.task.title})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var ja,hq0=1;var Da=a(async()=>{YE();J_();mF();gJ();Q$();r0();await e1([$$(),La()]);ja=H1(q1(),1)});function Aa($){let{theme:Z}=l0(),J=Z1();return R.jsxDEV("scrollbox",{ref:$.setScrollRef,flexGrow:1,minHeight:0,stickyScroll:!1,verticalScrollbarOptions:{visible:!1},children:R.jsxDEV("box",{flexShrink:0,gap:0,children:[$.rows.map((X,z)=>{if(X.kind==="project")return R.jsxDEV(io,{label:X.label,suffix:$.movingProjectId===X.id?J("tasks.moveChip"):void 0,topPad:z>0,onContextMenu:$.onProjectContextMenu?(G,W)=>$.onProjectContextMenu?.(X.id,G,W):void 0},X.id,!1,void 0,this);if(X.kind==="recent")return R.jsxDEV(Ca,{rowId:X.id,flatIndex:$.flatIndexOf.get(X.id)??-1,task:X.task,shared:$.shared},X.id,!1,void 0,this);if(X.kind==="worktree")return R.jsxDEV(Va,{rowId:X.id,flatIndex:$.flatIndexOf.get(X.id)??-1,task:X.task,shared:$.shared},X.id,!1,void 0,this);return R.jsxDEV(_a,{rowId:X.id,flatIndex:$.flatIndexOf.get(X.id)??-1,task:X.task,tab:X.tab,shared:$.shared},X.id,!1,void 0,this)}),$.rows.length===0?R.jsxDEV("box",{paddingTop:1,paddingLeft:1,children:R.jsxDEV("text",{fg:Z.textMuted,children:J(Jh({searching:$.searching,projectFilter:!1,view:$.view}))},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Pa=a(async()=>{gJ();Q$();r0();await e1([$$(),XE(),Da()])});function Ra($){return[{action:"rename",labelKey:"tasks.menu.rename"},{action:"pin",labelKey:$?"tasks.menu.unpin":"tasks.menu.pin"},{action:"localMerge",labelKey:"tasks.menu.localMerge"},{action:"archive",labelKey:"tasks.menu.archive"},{action:"delete",labelKey:"tasks.menu.delete",danger:!0}]}function Ta($,Z={}){if($.kind==="project")return[{action:"newTask",labelKey:"tasks.menu.newTask"}];if($.kind==="worktree")return[{action:"open",labelKey:"tasks.menu.open"},...Ra($.task.pinned===!0)];let J=[{action:"open",labelKey:"tasks.menu.openTab"}];if((Z.tabCount??0)>1)J.push({action:"closeTab",labelKey:"tasks.menu.closeTab"});return[...J,...Ra($.task.pinned===!0)]}function Sa($){let Z=Z1(),{tree:J,activateRow:X,setCursorIndex:z,actions:G}=$,[W,H]=z6.useState(null),[U,K]=z6.useState(0),N=z6.useCallback((E,S,T,x)=>{let b=Ta(E,S);H({row:E,actions:b.map((v)=>v.action),entries:b.map((v)=>({id:v.action,label:Z(v.labelKey),danger:v.danger})),x:T,y:x}),K(0)},[Z]),L=z6.useCallback((E,S,T,x)=>{let b=J.rows.find((v)=>v.id===S);if(!b||b.kind==="project"||b.kind==="recent")return;z(E),N(b,{tabCount:J.tabCount(b.task.id)},T,x)},[J.rows,J.tabCount,N,z]),M=z6.useCallback((E,S,T)=>{let x=J.rows.find((b)=>b.kind==="project"&&b.id===E);if(!x)return;N(x,{},S,T)},[J.rows,N]),V=z6.useCallback(()=>H(null),[]),P=z6.useCallback((E)=>{let S=W?.entries.length??0;if(S===0)return;K((T)=>(T+E+S)%S)},[W]),_=z6.useCallback((E)=>{if(!W||E===void 0)return;let S=W.row;if(H(null),S.kind==="project"){if(E==="newTask")$.onAddTask?.();return}let T=S.task.id;switch(E){case"open":X(S.id);break;case"closeTab":if(S.kind==="tab")$.onCloseTab?.(T,S.tab.id);break;case"rename":G.onRenameRequest?.(T);break;case"pin":G.onPinRequest?.(T);break;case"localMerge":G.onLocalMergeRequest?.(T);break;case"archive":G.onArchiveRequest?.(T);break;case"delete":G.onDeleteRequest?.(T);break;default:break}},[W,X,G,$.onAddTask,$.onCloseTab]),C=z6.useCallback(()=>_(W?.actions[U]),[_,W,U]),f=z6.useCallback((E)=>_(W?.actions.find((S)=>S===E)),[_,W]);return{open:W!==null,entries:W?.entries??[],cursor:U,x:W?.x??0,y:W?.y??0,close:V,moveCursor:P,pickCurrent:C,pick:f,openForRow:L,openForProject:M}}var z6;var Ia=a(()=>{Q$();z6=H1(q1(),1)});function Ea($){let[Z,J]=pQ.useState(!1),[X,z]=pQ.useState(""),G=w1($.focused),W=$.onActiveChange,H=pQ.useCallback(()=>{z(""),J(!0),W?.(!0)},[W]),U=pQ.useCallback(()=>{J(!1),z(""),W?.(!1)},[W]),K=E4();return pQ.useEffect(()=>{if(!Z||!K)return;let N=(L)=>{if(!G.current||bY())return;z((M)=>Xh(M,L)??M)};return K.keyInput.on("keypress",N),()=>{K.keyInput.off("keypress",N)}},[Z,K]),{active:Z,query:X,enter:H,exit:U}}var pQ;var wa=a(async()=>{gJ();W2();await e1([h4(),C4()]);pQ=H1(q1(),1)});function xa($){return $.split("::").slice(0,2).join("::")}function G_($,Z=Date.now()){ME.set(xa($),Z)}function fa($,Z=Date.now()){let J=xa($),X=ME.get(J);if(X===void 0)return!1;if(Z-X>15000)return ME.delete(J),!1;return!0}var ME;var W_=a(()=>{ME=new Map});import{basename as ga}from"path";function cq0($){return ga($).replace(/\.(exe|js|mjs|cjs)$/,"")}function dq0($){for(let Z of $.trim().split(/\s+/).slice(0,4)){if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(Z))continue;let J=cq0(Z);if(uq0.has(J))continue;return WQ.find((X)=>{let z=D$(X);return z.defaultCommand[0]===J||z.processNames?.includes(J)===!0})??null}return null}function LZ($){let Z=[];for(let J of $.split(`
|
|
731
731
|
`)){let X=/^\s*(\d+)\s+(\d+)\s+(\S.*)$/.exec(J);if(X)Z.push({pid:Number(X[1]),ppid:Number(X[2]),args:X[3]})}return Z}function ya($){let Z=new Map;for(let J of $){let X=Z.get(J.ppid);if(X)X.push(J);else Z.set(J.ppid,[J])}return Z}function tY($,Z){let J=ya($),X=[...J.get(Z)??[]];while(X.length>0){let z=X.shift();if(!z)break;let G=dq0(z.args);if(G)return{vendor:G,argv:z.args,pid:z.pid};X.push(...J.get(z.pid)??[])}return null}function H_($,Z,J){if(tY($,Z))return!0;if(!J)return!1;let X=ya($),z=[...X.get(Z)??[]];while(z.length>0){let G=z.shift();if(!G)break;let W=G.args.trim().split(/\s+/)[0]??"";if(ga(W)===J)return!0;z.push(...X.get(G.pid)??[])}return!1}var uq0,jZ=async()=>{let $=Bun.spawn(["ps","-A","-o","pid=,ppid=,args="],{stdout:"pipe",stderr:"ignore"});return await new Response($.stdout).text()};var vq=a(()=>{u7();C7();uq0=new Set(["node","bun","npx","deno","sh","zsh","bash","env","script"])});function lq0($={}){let Z=$.entries??(()=>X4().entries()),J=$.snapshot??jZ,X=new Map,z=new Set,G=new Set,W=!1,H=()=>{for(let N of G)N()},U={async probe(){if(W)return;let N=new Map,L=new Set;for(let[V,P]of Z()){L.add(V);let _=P.shellPid??null;if(_!==null)N.set(V,_)}let M=!1;for(let V of[...X.keys()]){if(L.has(V)&&N.has(V))continue;X.delete(V),M=!0}for(let V of[...z]){if(L.has(V)&&N.has(V))continue;z.delete(V)}if(N.size>0){let V;try{V=LZ(await J())}catch{if(M)H();return}if(W)return;for(let[P,_]of N){let C=tY(V,_)?.vendor??null;if(z.add(P),(X.get(P)??null)===C)continue;if(C)X.set(P,C);else X.delete(P);M=!0}}if(M)H()},get(N){return X.get(N)??null},resolve(N){let L=X.get(N);if(L)return L;return z.has(N)?null:void 0},subscribe(N){return G.add(N),()=>{G.delete(N)}},dispose(){W=!0,G.clear(),X.clear(),z.clear(),clearInterval(K)}},K=setInterval(()=>{U.probe()},$.intervalMs??2000);return K.unref?.(),U}function eY(){if(!NE)NE=lq0();return NE}var NE=null;var q_=a(()=>{vq();x8()});function pq0($,Z){let J=/^tab-(\d+)$/.exec($);return J?Number(J[1]):Z}function U_($,Z){let J=new Set($.tabs.map((U)=>U.id)),X=[];for(let U of Z){if(J.has(U))continue;J.add(U),X.push(U)}if(X.length===0)return $;let z=$.nextOrdinal,G=X.map((U)=>({kind:"engine",id:U,title:null,ordinal:pq0(U,z++),spawned:!0}));G.sort((U,K)=>U.ordinal-K.ordinal);let W=[...$.tabs,...G],H=W.reduce((U,K)=>Math.max(U,K.ordinal),0);return{tabs:W,activeId:$.activeId,nextOrdinal:Math.max($.nextOrdinal,H+1)}}function ba($,Z,J){if(J.length===0)return!1;if(wn(Z,J),!fn())return!1;let z=$.store[P7(Z)],G=$8.get(Z)??(z&&Array.isArray(z.tabs)?z:null),W={tabs:[],activeId:J[0],nextOrdinal:1},H=U_(G??W,J);if(G&&H===G)return!1;return $8.set(Z,H),$.set(P7(Z),H),!0}var ka=a(()=>{O3()});function va($,Z){let J=new Map;for(let X of $){if(X.alive===!1)continue;let{taskId:z,tabId:G}=lQ(X.key);if(!G)continue;let W=G.split("::")[0];if(Z.has(yq(z,W)))continue;let H=J.get(z)??[];if(H.some((U)=>U.id===W))continue;H.push({id:W,label:`\u26A0 ${X.title?.trim()||W}`,active:H.length===0,engine:!0}),J.set(z,H)}return J}var ma=a(()=>{mF()});function iq0(){return process.env.BUN_TEST!=="1"&&process.env.VITEST!=="true"}function ua($=iq0()){let[Z,J]=B_.useState(ha);return B_.useEffect(()=>{if(!$)return;let X=!1,z=async()=>{try{let W=await eK(),{sessions:H=[]}=await W.request("pty.list",{});if(!X)J(H)}catch{if(!X)J(ha)}};z();let G=setInterval(()=>void z(),nq0);return()=>{X=!0,clearInterval(G)}},[$]),Z}var B_,nq0=2000,ha;var ca=a(()=>{$F();B_=H1(q1(),1),ha=[]});function da($){let{tasks:Z,kv:J,selectedTaskId:X,selectedTabId:z}=$,G=$.query??"",W=G.trim()!=="",H=eY(),[U,K]=E2.useState(0);E2.useEffect(()=>H.subscribe(()=>K((b)=>b+1)),[H]);let N=ua(),L=E2.useMemo(()=>{let b=new Map;for(let v of Z){let u=LI(J,v.id);if(!u)continue;let o=v.vendor??M4;b.set(v.id,u.tabs.map((m)=>{let e=H.resolve(b8(v.id,m)),t=e===void 0?m.liveVendor:e;return{id:m.id,label:nY(m,o,t),active:m.id===u.activeId,engine:m.kind==="engine"||(t??null)!==null}}))}return b},[Z,J,H,U]),M=E2.useMemo(()=>{let b=new Set;for(let[o,m]of L)for(let e of m)b.add(yq(o,e.id));let v=new Map,u=N.filter((o)=>!fa(o.key));for(let[o,m]of va(u,b))if(Z.some((e)=>e.id===o))v.set(o,m);return v},[L,N,Z]);E2.useEffect(()=>{if(!J)return;for(let[b,v]of M)ba(J,b,v.map((u)=>u.id))},[M,J]);let V=E2.useMemo(()=>{if(M.size===0)return L;let b=new Map(L);for(let[v,u]of M){let o=b.get(v);b.set(v,o?[...o,...u.map((m)=>({...m,active:!1}))]:u)}return b},[L,M]),P=$.recentTask??null,{rows:_,totalCount:C}=E2.useMemo(()=>{let b=bo({tasks:Z,tabsByTask:V}),v=ZE(b).length;return{rows:W?ko(b,G):yo(b,P),totalCount:v}},[Z,V,W,G,P]),f=E2.useMemo(()=>ZE(_),[_]),E=E2.useMemo(()=>{if(X===null)return null;if(z!==null)return yq(X,z);return X},[X,z]),S=E2.useCallback((b)=>V.get(b)?.length??0,[V]),T=E2.useCallback((b)=>vo(Z,b),[Z]),x=E2.useCallback((b)=>{let v=Z.find((u)=>u.id===b);if(!v||v.kind==="dir")return null;return oY(v.repo)},[Z]);return{rows:_,flatIds:f,totalCount:C,tabCount:S,activeRowId:E,projectIdOfTask:x,mainTaskIdOfProject:T}}var E2;var la=a(()=>{d7();L3();mF();W_();q_();qI();U7();ka();O3();ma();ca();E2=H1(q1(),1)});function pa($){let{theme:Z}=l0(),J=bQ(),X=$.focused??!0,z=E5(),[G,W]=u4.useState("active"),H=u4.useMemo(()=>ni($.tasks,G),[$.tasks,G]),U=G==="archived"||$.tasks.some((G0)=>G0.archived===!0),[K,N]=u4.useState(0);u4.useEffect(()=>{let G0=setInterval(()=>N((s)=>s+1),em);return()=>clearInterval(G0)},[]);let L=Ea({focused:X,onActiveChange:$.onSearchActiveChange}),M=da({tasks:H,kv:J,selectedTaskId:$.selectedId,selectedTabId:$.selectedTabId??null,query:L.active?L.query:"",recentTask:$.recentTask??null}),V=u4.useMemo(()=>{let G0=new Map;return M.flatIds.forEach((s,r)=>G0.set(s,r)),G0},[M.flatIds]),[P,_]=u4.useState(-1),C=u4.useRef(P),f=u4.useCallback((G0)=>{C.current=G0,_(G0)},[]),E=w1(M.flatIds),S=u4.useRef(null),T=u4.useRef(null),x=$.moveMode===!0;u4.useEffect(()=>{let G0=M.flatIds;if(x){let C0=T.current,Q0=C0===null?-1:G0.indexOf(C0);if(Q0>=0){if(Q0!==C.current)f(Q0);return}}let s=M.activeRowId,r=s!==S.current;S.current=s;let J0=s===null?-1:G0.indexOf(s);if(r&&J0>=0){if(J0!==C.current)f(J0);return}if(C.current>=G0.length)f(Math.max(0,G0.length-1));else if(C.current<0&&G0.length>0)f(J0>=0?J0:0)},[M.flatIds,M.activeRowId,x,f]),u4.useEffect(()=>{T.current=M.flatIds[C.current]??null}),u4.useEffect(()=>{if(L.query,!L.active)return;f(0)},[L.active,L.query,f]);let b=w1($.recentTask??null),v=u4.useCallback((G0)=>{let s=G0===$_?b.current:null,{taskId:r,tabId:J0}=s?{taskId:s.id,tabId:null}:lQ(G0);if($.onSelect(r),J0===null){$.onActivate?.(r);return}$.onSelectTab?.(r,J0),$.onActivate?.(r)},[$.onSelect,$.onActivate,$.onSelectTab]),u=w1(v),o=u4.useRef(null);if(o.current===null)o.current=fo({getCursor:()=>C.current,setCursor:f,getFlatIds:()=>E.current,onSelect:(G0)=>u.current(G0)});let m=o.current,e=u4.useMemo(()=>{let G0=M.flatIds[P];if(G0===void 0)return null;return M.projectIdOfTask(lQ(G0).taskId)},[M.flatIds,M.projectIdOfTask,P]),t=u4.useCallback((G0)=>{let s=E.current[C.current];if(s===void 0)return;let r=M.projectIdOfTask(lQ(s).taskId);if(r===null)return;let J0=M.mainTaskIdOfProject(r);if(J0===null)return;$.onMoveRequest?.(J0,G0)},[M.projectIdOfTask,M.mainTaskIdOfProject,$.onMoveRequest]),Y0=Sa({tree:M,activateRow:v,setCursorIndex:f,onAddTask:$.onAddTask,onCloseTab:$.onCloseTab,actions:$}),F0=uV("sidebar");g1(()=>({enabled:X&&!L.active&&!Y0.open,bindings:G5({"sidebar.nav":(G0,s)=>{F0();let r=(s??0)%2===0;if(x){t(r?1:-1);return}if(r)m.moveDown();else m.moveUp()},"sidebar.select":()=>{if(F0(),x){$.onMoveModeExit?.();return}m.selectCurrent()},"sidebar.goto":(G0,s)=>{if(x)return;if((s??0)%2===1)m.pressShiftG();else m.pressG()},"sidebar.tree.open":()=>{if(x)return;m.selectCurrent()},"sidebar.search.enter":()=>{if(x)return;L.enter()},"sidebar.delete":()=>{if(x)return;K0($.onDeleteRequest)},"sidebar.archive":()=>{if(x)return;K0($.onArchiveRequest)},"sidebar.rename":()=>{if(x)return;K0($.onRenameRequest)},"sidebar.localMerge":()=>K0($.onLocalMergeRequest),"sidebar.pin":()=>{if(x)return;K0($.onPinRequest)}})})),g1(()=>({enabled:X&&x,bindings:[{key:"escape",cmd:()=>$.onMoveModeExit?.()}]})),g1(()=>({enabled:X,bindings:G5({"sidebar.view":(G0,s)=>{if(!U)return;let r=Zh(G,(s??0)%2===0?-1:1);if(r)W(r)}})})),g1(()=>({enabled:X&&L.active,bindings:G5({"sidebar.search.nav":(G0,s)=>{if((s??0)%2===0)m.moveDown();else m.moveUp()},"sidebar.search.submit":()=>{m.selectCurrent(),L.exit()},"sidebar.search.cancel":()=>L.exit()})})),g1(()=>({enabled:X&&Y0.open,bindings:G5({"sidebar.nav":(G0,s)=>Y0.moveCursor((s??0)%2===0?1:-1),"sidebar.select":()=>Y0.pickCurrent()})})),g1(()=>({enabled:X&&Y0.open,bindings:[{key:"escape",cmd:()=>Y0.close()}]}));function K0(G0){let s=E.current[C.current];if(s===void 0||!G0)return;if(s===$_)return;G0(lQ(s).taskId)}g1(()=>({enabled:!0,bindings:G5({"tasks.jump":(G0,s)=>{let r=E.current[s??0];if(r===void 0)return;f(s??0),u.current(r)}})}));let M0=u4.useRef(null),H0=u4.useRef(null);if(H0.current===null)H0.current=new Map;let k=H0.current;u4.useEffect(()=>{let G0=M0.current;if(!G0||P<0||G0.viewport.height<=0)return;let s=k.get(P);if(s)G0.scrollChildIntoView(s.id)},[P,k]);let l=u4.useRef(null),d=$.width??RY;u4.useEffect(()=>{let G0=l.current;if(!G0)return;G0.width=d,G0.flexShrink=1,G0.minHeight=0},[d]);let n={cursorIndex:P,activeRowId:M.activeRowId,selectedTaskId:$.selectedId,rowEls:k,onPress:(G0,s)=>{Y0.close(),f(G0),v(s)},onContextMenu:Y0.openForRow,branchTick:K,engineState:$.engineState,engineTabState:$.engineTabState,engineLifecycle:$.engineLifecycle,taskJobs:$.taskJobs,worktreeChanges:$.worktreeChanges};return R.jsxDEV("box",{ref:l,flexGrow:1,minHeight:0,flexDirection:"column",backgroundColor:Z.backgroundPanel,paddingTop:1,paddingBottom:1,children:[R.jsxDEV(ao,{focused:X,status:$.headerStatus??null,onStatusClick:$.onHeaderStatusClick},void 0,!1,void 0,this),R.jsxDEV(ro,{onAddTask:$.onAddTask},void 0,!1,void 0,this),L.active?R.jsxDEV(oo,{query:L.query,matchCount:M.flatIds.length,totalCount:M.totalCount},void 0,!1,void 0,this):null,U?R.jsxDEV(to,{view:G,setView:W},void 0,!1,void 0,this):null,R.jsxDEV(so,{nav:$.nav??"terminal",setNav:(G0)=>$.onNavChange?.(G0)},void 0,!1,void 0,this),R.jsxDEV(Aa,{rows:M.rows,flatIndexOf:V,view:G,searching:L.active&&L.query.trim().length>0,shared:n,onProjectContextMenu:Y0.openForProject,movingProjectId:x?e:null,setScrollRef:(G0)=>{M0.current=G0}},void 0,!1,void 0,this),$.zenActive?R.jsxDEV(eo,{onZenClick:$.onZenClick},void 0,!1,void 0,this):null,Y0.open?R.jsxDEV(po,{entries:Y0.entries,cursor:Y0.cursor,x:Y0.x,y:Y0.y,dims:{width:d,height:z.height},onPick:Y0.pick},void 0,!1,void 0,this):null,z.height<0?R.jsxDEV("text",{children:""},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var u4;var na=a(async()=>{L3();mF();gJ();MZ();M3();W2();Ia();la();r0();await e1([h4(),xF(),$$(),C4(),no(),XE(),Pa(),wa()]);u4=H1(q1(),1)});class OE{ptyIdentity=null;coordinate=null;update($,Z){if($!==this.ptyIdentity)this.ptyIdentity=$,this.coordinate=null;if($===null)return this.coordinate=null,null;if(Z)this.coordinate={x:Z.x,y:Z.y};return this.coordinate}current(){return this.coordinate}}var LE,jE;var ia=a(()=>{LE=class LE extends OE{};jE=class jE extends OE{}});import{RGBA as oq0}from"@opentui/core";function oa($){if(!$)return;return oq0.fromInts($[0],$[1],$[2])}function aq0($){return{__isChunk:!0,text:$.text,...$.fg?{fg:oa($.fg)}:{},...$.bg?{bg:oa($.bg)}:{},...$.attributes!==void 0?{attributes:$.attributes}:{}}}function aa($){let Z=[];for(let J=0;J<$.length;J++){if(J>0)Z.push({__isChunk:!0,text:`
|
|
732
732
|
`});let X=$[J];if(!X)continue;for(let z of X)Z.push(aq0(z))}return Z}var ra=()=>{};function sa($){let Z=$.toLowerCase();return Z.includes("enoent")||Z.includes("not found")}function uF($,Z,J=$.attributes??0){return{text:Z,...$.fg?{fg:$.fg}:{},...$.bg?{bg:$.bg}:{},...J!==0?{attributes:J}:{}}}function rq0($){let Z=0;for(let J of $)Z+=fJ(J.codePointAt(0))||1;return Z}function sq0($,Z){let J=[],X=0,z=!1;for(let G of $){if(z){J.push(G);continue}let W=Array.from(G.text),H=X,U=-1;for(let K=0;K<W.length;K++){let N=fJ(W[K].codePointAt(0))||1;if(Z>=H&&Z<H+N){U=K;break}H+=N}if(U>=0){let K=W.slice(0,U).join(""),N=W.slice(U+1).join("");if(K)J.push(uF(G,K));if(J.push(uF(G,W[U]||" ",(G.attributes??0)|Y4.INVERSE)),N)J.push(uF(G,N));z=!0}else J.push(G),X+=rq0(W)}if(!z){if(Z>X)J.push({text:" ".repeat(Z-X)});J.push({text:" ",attributes:Y4.INVERSE})}return J}function ta($,Z){if(!Z)return $;return $.map((J,X)=>X===Z.y?sq0(J,Z.x):J)}function ea($,Z,J,X){if(Z<=0)return $;let z=Z-1;return $.map((G)=>{let W=0;for(let H=0;H<G.length;H++){let U=G[H],K=Array.from(U.text);for(let N=0;N<K.length;N++){let L=K[N],M=fJ(L.codePointAt(0))||1;if(W+M<=z){W+=M;continue}let V=U.attributes??0;if(V===0)return G;let P=U.fg??J,_=U.bg??X,C=(V&Y4.INVERSE)!==0?{text:L,fg:_,bg:P}:{text:L,fg:P,bg:_},f=K.slice(0,N).join(""),E=K.slice(N+1).join(""),S=G.slice(0,H);if(f)S.push(uF(U,f));if(S.push(C),E)S.push(uF(U,E));return[...S,...G.slice(H+1)]}}return G})}var $r=a(()=>{sH()});function Zr($){let{anchor:Z,head:J}=$;return J.row<Z.row||J.row===Z.row&&J.col<Z.col?{start:J,end:Z}:{start:Z,end:J}}function Jr($,Z,J){let{start:X,end:z}=Zr($);if(Z<X.row||Z>z.row)return null;let G=Z===X.row?X.col:0,W=Z===z.row?z.col+1:J;return G<W?[G,W]:null}function tq0($){let Z="";for(let J of $)Z+=J.text;return Z}function Xr($){let Z=0;for(let J of $)Z+=fJ(J.codePointAt(0));return Z}function Qr($,Z,J){let X="",z="",G="",W=0,H="before";for(let U of $){let K=fJ(U.codePointAt(0));if(K===0){if(H==="selected")z+=U;else if(H==="after")G+=U;else X+=U;continue}let N=W+K;if(N<=Z)X+=U,H="before";else if(W>=J)G+=U,H="after";else z+=U,H="selected";W=N}return{before:X,selected:z,after:G}}function zr($,Z){let{start:J,end:X}=Zr(Z),z=[];for(let G=Math.max(0,J.row);G<=Math.min($.length-1,X.row);G++){let W=tq0($[G]??[]),H=Jr(Z,G,Math.max(Xr(W),1));z.push(H?Qr(W,H[0],H[1]).selected.trimEnd():"")}return z.join(`
|
|
733
733
|
`)}function eq0($,Z,J){let X=[],z=0;for(let G of $){let W=z,H=W+Xr(G.text);if(z=H,H<=Z||W>=J){X.push(G);continue}let{before:U,selected:K,after:N}=Qr(G.text,Z-W,J-W);if(U)X.push({...G,text:U});if(X.push({...G,text:K,attributes:(G.attributes??0)|Y4.INVERSE}),N)X.push({...G,text:N})}if(z<J)X.push({text:" ".repeat(J-Math.max(z,Z)),attributes:Y4.INVERSE});return X}function Yr($,Z,J,X){if(!Z)return $;return $.map((z,G)=>{let W=Jr(Z,J+G,X);return W?eq0(z,W[0],W[1]):z})}var VE=a(()=>{sH()});function _E($,Z,J){let X=Math.max(1,Z),z=Math.max(0,$-Math.max(0,J));return{start:Math.max(0,z-X),end:z}}function CE($,Z,J,X){let z=Math.max(0,$-Math.max(1,Z)),G=Math.min(z,Math.max(0,J.fallbackOffset));if(!J.anchor||!X||J.anchor.epoch!==X.epoch)return G;let W=J.anchor.topLine-X.startLine;if(W<=0)return z;return Math.min(z,Math.max(0,$-(W+Math.max(1,Z))))}function Gr($,Z,J,X,z){let G=CE(Z,J,$,z),W=Math.max(0,Z-Math.max(1,J)),H=Math.min(W,Math.max(0,G-X));if(H===0)return K_;let U=_E(Z,J,H),K=z?{epoch:z.epoch,topLine:z.startLine+U.start}:null;return{fallbackOffset:H,anchor:K}}function DE($,Z,J){if(!$||Z!==0)return null;if($.y<J.start||$.y>=J.end)return null;return{x:$.x,y:$.y-J.start}}var K_;var Wr=a(()=>{K_={fallbackOffset:0,anchor:null}});import{decodePasteBytes as $U0}from"@opentui/core";function Hr($){let Z=$.pageSize??Gu,J=w1($),X=w1(Z),z=F_.useMemo(()=>{let W=[];W.push(...G5({"terminal.scroll-up":()=>J.current.scroll(-X.current),"terminal.scroll-down":()=>J.current.scroll(X.current),"terminal.reset":()=>J.current.reset()}));let H=(U)=>{let K=mT(U);if(K!=null)J.current.write(K)};for(let U of Wu)W.push({key:U,cmd:H,passthrough:!0});return W},[]);g1(()=>({enabled:J.current.focused,bindings:z}));let G=E4();F_.useEffect(()=>{if(!G)return;let W=(U)=>{if(!J.current.focused||U.defaultPrevented||bY())return;let K=mT(U);if(K==null)return;J.current.write(K),U.preventDefault()},H=(U)=>{if(U.defaultPrevented||bY())return;let K=$U0(U.bytes);if(K.length===0)return;if(!J.current.focused&&(!J.current.unfocusedAttachmentTarget||!xq(K)))return;J.current.paste(K),U.preventDefault()};return G.keyInput.on("keypress",W),G.keyInput.on("paste",H),()=>{G.keyInput.off("keypress",W),G.keyInput.off("paste",H)}},[G])}var F_;var qr=a(async()=>{fq();hT();MZ();W2();await e1([h4(),C4()]);F_=H1(q1(),1)});function Ur(){let[$,Z]=eJ.useState(null),[J,X]=eJ.useState(4),[z,G]=eJ.useState(null),W=E5(),[H,U]=eJ.useState(0),K=eJ.useCallback(()=>{U((N)=>N+1&255)},[]);return eJ.useEffect(()=>{if(!$)return;if($.width<=0||$.height<=0)return;let N=Math.max(20,$.width),L=Math.max(4,$.height);X(L),G((M)=>M&&M.cols===N&&M.rows===L?M:{cols:N,rows:L})},[$,W,H]),{bodyEl:$,setBodyEl:Z,bodyRows:J,bodyGeometry:z,bumpGeomTick:K,dims:W,geomTick:H}}var eJ;var Br=a(async()=>{await h4();eJ=H1(q1(),1)});function Kr($){let[Z,J]=Z8.useState(null),[X,z]=Z8.useState(null),[G,W]=Z8.useState([]),H=Z8.useRef(null),[U,K]=Z8.useState(null),[N,L]=Z8.useState(!1),M=w1($.command),V=w1($.initialInput),P=w1($.bodyGeometry),_=w1($.registry),C=w1($.onExit),f=w1($.onFreshPty),E=w1($.cwd),S=w1($.taskId),T=$.bodyGeometry!==null,x=$.cwd,b=$.taskId;Z8.useEffect(()=>{if(!x||!b||!T){J(null),W([]),H.current=null,K(null),z(null);return}let o=P.current;if(!o)return;let m;try{m=_.current.acquire(b,x,{...o,command:M.current,initialInput:V.current})}catch(e){let t=N1(e);z(t),J(null),W([]),H.current=null,K(null);return}z(null),W([]),H.current=null,K(null),L(m.killed),J(m),f.current()},[x,b,T]),Z8.useEffect(()=>{let o=Z?Z.killed:!1;if(L(o),!Z)return;if(o){C.current?.({deadOnAttach:Z.deadOnAttach===!0});return}let m=Z.onExit(()=>{L(!0),C.current?.({deadOnAttach:Z.deadOnAttach===!0})}),e=Z.onData((t,Y0,F0)=>{H.current=F0,W(t),K(Y0)});try{let t=Z.capture();if(H.current=Z.captureWindow(),t.length>0)W(t);K(Z.captureCursor())}catch{}return()=>{m(),e()}},[Z]);let v=Z8.useCallback((o,m,e,t)=>{try{let Y0={...e,command:M.current,initialInput:V.current},F0=t?_.current.resetIfCurrent(m,t,o,Y0):_.current.reset(m,o,Y0);if(!F0)return;J(F0),W([]),H.current=null,K(null),f.current()}catch(Y0){let F0=N1(Y0);z(F0),J(null),W([]),H.current=null,K(null)}},[]),u=Z8.useRef(!1);return Z8.useEffect(()=>{if($.resetToken,!u.current){u.current=!0;return}let o=E.current,m=S.current,e=P.current;if(o&&m&&e)v(o,m,e)},[$.resetToken,v]),{pty:Z,snapshot:G,snapshotWindow:H.current,cursor:U,exited:N,acquireError:X,forceReacquire:v}}var Z8;var Fr=a(()=>{W2();Z8=H1(q1(),1)});import{spawnSync as ZU0}from"child_process";function Mr($,Z){if($==="darwin")return"pbcopy";if($==="linux"){for(let J of JU0)if(Z(J.binary))return J.command}return null}var JU0,Nr=($)=>{try{let Z=process.platform==="win32"?"where":"which";return ZU0(Z,[$],{encoding:"utf8"}).status===0}catch{return!1}};var Or=a(()=>{JU0=[{binary:"wl-copy",command:"wl-copy"},{binary:"xclip",command:"xclip -selection clipboard -in"},{binary:"xsel",command:"xsel --clipboard --input"}]});function XU0(){if(AE===void 0)AE=Mr(process.platform,Nr);return AE}function Lr($,Z){let J=XU0();if(J)try{let X=Bun.spawn(["sh","-c",J],{stdin:"pipe",stdout:"ignore",stderr:"ignore"});X.stdin.write($),X.stdin.end()}catch{}try{Z($)}catch{}}var AE;var jr=a(()=>{Or()});function Vr($){let[Z,J]=$G.useState(null),[X,z]=$G.useState(null),G=$G.useRef(!1),W=E4(),H=$G.useMemo(()=>{if(!Z||!X)return null;if(Z.row===X.row&&Z.col===X.col)return null;return{anchor:Z,head:X}},[Z,X]);return{selection:H,cellFromEvent:(M)=>{let{bodyEl:V,bodyGeometry:P,bodyRows:_,visibleRangeStart:C}=$;if(!V||!P)return null;let f=Math.min(P.cols-1,Math.max(0,(M.x??0)-V.screenX)),E=Math.min(_-1,Math.max(0,(M.y??0)-V.screenY));return{row:C+E,col:f}},beginSelection:(M)=>{G.current=!0,J(M),z(M)},updateSelectionHead:(M)=>{if(!G.current)return;z(M)},isDragging:()=>G.current,endDragging:()=>{G.current=!1},clearSelection:()=>{J(null),z(null)},copySelection:()=>{if(!H)return;let M=zr($.snapshot,H);if(M.trim().length>0)Lr(M,(V)=>W?.copyToClipboardOSC52(V))}}}var $G;var _r=a(async()=>{jr();VE();await h4();$G=H1(q1(),1)});import{StyledText as QU0}from"@opentui/core";function PE($){let{theme:Z}=l0(),J=Z1(),X=$.registry??X4(),[z,G]=_5.useState(!1),W=$.focused??z,[H,U]=_5.useState(K_),{bodyEl:K,setBodyEl:N,bodyRows:L,bodyGeometry:M,bumpGeomTick:V,dims:P,geomTick:_}=Ur(),{pty:C,snapshot:f,snapshotWindow:E,cursor:S,exited:T,acquireError:x,forceReacquire:b}=Kr({cwd:$.cwd,taskId:$.taskId,command:$.command,initialInput:$.initialInput,resetToken:$.resetToken,onExit:$.onExit,registry:X,bodyGeometry:M,onFreshPty:()=>U(K_)}),v=CE(f.length,L,H,E),u=(u0)=>{U((L0)=>Gr(L0,f.length,L,u0,E))},o=_5.useMemo(()=>_E(f.length,L,v),[f.length,L,v]),m=_5.useMemo(()=>f.slice(o.start,o.end),[f,o]),e=_5.useMemo(()=>DE(S,v,o),[S,v,o]),[t]=_5.useState(()=>new LE),Y0=t.update(C,S),F0=_5.useMemo(()=>DE(Y0,v,o),[Y0,v,o]),K0=Vr({bodyEl:K,bodyGeometry:M,bodyRows:L,visibleRangeStart:o.start,snapshot:f}),M0=_5.useMemo(()=>{let u0=Yr(m,K0.selection,o.start,M?.cols??80),L0=W&&!K0.selection?e:null;return ta(u0,L0)},[m,K0.selection,o.start,M,W,e]),H0=_5.useMemo(()=>{let u0=Z.text.toInts(),L0=Z.background.toInts(),d0=ea(M0,M?.cols??80,[u0[0],u0[1],u0[2]],[L0[0],L0[1],L0[2]]);return new QU0(aa(d0))},[M0,M,Z]),[k,l]=_5.useState(null);_5.useEffect(()=>{if(k&&!k.isDestroyed)k.content=H0},[k,H0]);let d=n$(),n=($.imeAnchorActive??!0)&&d.stack.length===0,G0=$.imeAnchorActive===!0&&d.stack.length===0,s=w1($.taskId),r=w1($.cwd),J0=_5.useRef(!0);_5.useLayoutEffect(()=>{return J0.current=!0,()=>{J0.current=!1}},[]),Hr({focused:W,unfocusedAttachmentTarget:G0,write:(u0)=>{if(!C||C.killed)return;C.write(u0),$.onUserInput?.(u0)},paste:(u0)=>{if(!C||C.killed)return;C.paste(u0)},scroll:u,reset:()=>{if(!C)return;let u0=C,L0=$.cwd,d0=$.taskId,G1=M;if(!L0||!d0||!G1)return;N4.show(d,J("terminal.reset.title"),J("terminal.reset.body"),"cancel").then((D1)=>{if(D1!==!0||!J0.current)return;if(s.current!==d0||r.current!==L0)return;b(L0,d0,G1,u0)})}});let Q0=E4(),w0=_5.useRef(Symbol("terminal-ime-anchor")).current,[v0]=_5.useState(()=>new jE),P0=_5.useRef(null);return _5.useEffect(()=>{if(!C||!M)return;let{cols:u0,rows:L0}=M,d0=P0.current;if(d0?.pty===C&&d0.cols===u0&&d0.rows===L0)return;P0.current={pty:C,cols:u0,rows:L0};try{C.resize(u0,L0)}catch{}},[C,M]),_5.useEffect(()=>{if(!Q0)return;if(!n){if(v0.update(null,null),Kq.release(w0))Q0.setCursorPosition(0,0,!1);return}let u0=null;if(K&&F0&&K.width>0)u0={x:K.screenX+F0.x,y:K.screenY+F0.y};let L0=v0.update(C,u0);if(L0){Kq.claim(w0,L0),Q0.setCursorPosition(L0.x,L0.y,!1);return}Kq.claim(w0,{x:0,y:0}),Q0.setCursorPosition(0,0,!1)},[Q0,n,K,F0,P,_,w0,v0,C]),_5.useEffect(()=>{return()=>{try{if(Kq.release(w0))Q0?.setCursorPosition(0,0,!1)}catch{}}},[Q0,w0]),R.jsxDEV("box",{flexDirection:"column",flexGrow:1,overflow:"hidden",backgroundColor:Z.background,onMouseDown:(u0)=>{if(u0.button!==0)return;if(!W)$.onRequestFocus?.();let L0=K0.cellFromEvent(u0);if(!L0)return;K0.beginSelection(L0)},onMouseDrag:(u0)=>{let L0=K0.cellFromEvent(u0);if(L0)K0.updateSelectionHead(L0)},onMouseUp:()=>{if(G(!0),!K0.isDragging())return;if(K0.endDragging(),K0.selection)K0.copySelection();else K0.clearSelection()},onMouseScroll:(u0)=>{let L0=u0.scroll;if(!L0||L0.direction!=="up"&&L0.direction!=="down")return;if(C&&!C.killed&&K){let G1=Math.max(1,u0.x-K.screenX+1),D1=Math.max(1,u0.y-K.screenY+1);if(C.wheel(L0.direction,G1,D1))return}let d0=Math.max(1,L0.delta||1);u(L0.direction==="up"?-d0:d0)},children:[T?R.jsxDEV("box",{flexDirection:"row",flexShrink:0,paddingLeft:1,paddingRight:1,children:R.jsxDEV("text",{fg:Z.error,wrapMode:"none",children:J("terminal.exited")},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,v>0?R.jsxDEV("box",{position:"absolute",zIndex:10,left:0,right:0,bottom:0,flexDirection:"row",paddingLeft:1,paddingRight:1,backgroundColor:Z.backgroundPanel,children:R.jsxDEV("text",{fg:Z.warning,wrapMode:"none",children:J("terminal.scrolledBack",{lines:v})},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,R.jsxDEV("box",{ref:(u0)=>N(u0),onSizeChange:V,flexGrow:1,overflow:"hidden",children:C?R.jsxDEV("text",{fg:Z.text,wrapMode:"none",ref:(u0)=>l(u0)},void 0,!1,void 0,this):R.jsxDEV("box",{paddingLeft:1,paddingTop:1,flexDirection:"column",gap:0,children:x?R.jsxDEV(R.Fragment,{children:[R.jsxDEV("text",{fg:Z.error,wrapMode:"word",children:sa(x)?J("terminal.unavailable.shellMissing"):J("terminal.unavailable.spawnFailed")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:x},void 0,!1,void 0,this)]},void 0,!0,void 0,this):R.jsxDEV("text",{fg:Z.textMuted,children:J("terminal.noTask")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var _5;var Cr=a(async()=>{YI();ia();x8();ra();$r();VE();Wr();Q$();W2();Fr();r0();await e1([h4(),$$(),V5(),FZ(),qr(),Br(),_r()]);_5=H1(q1(),1)});function RE($=X4().get.bind(X4())){let Z=new Map,J=new Set,X=()=>{for(let z of J)z()};return{reconcile(z){let G=new Set(z),W=!1;for(let[H,U]of Z){if((G.has(H)?$(H):null)===U.pty)continue;U.unsub(),Z.delete(H),W=!0}for(let H of G){if(Z.has(H))continue;let U=$(H);if(!U)continue;let K={pty:U,unsub:()=>{},title:void 0};K.unsub=U.onTitleChange((N)=>{if(K.title===N)return;K.title=N,X()}),Z.set(H,K),W=!0}return W},get(z){return Z.get(z)?.title},subscribe(z){return J.add(z),()=>{J.delete(z)}},dispose(){for(let z of Z.values())z.unsub();Z.clear(),J.clear()}}}function Dr($){let Z=K9.useRef(null);if(Z.current===null)Z.current=RE();let J=Z.current,[X,z]=K9.useState(new Map),G=w1($),W=K9.useCallback(()=>{let H=G.current;J.reconcile(H.values());let U=eY();z((K)=>{let N=new Map;for(let[L,M]of H){let V=J.get(M);if(V===void 0)continue;N.set(L,kH(V,U.resolve(M)))}if(N.size===K.size&&[...N].every(([L,M])=>K.get(L)===M))return K;return N})},[J]);return K9.useEffect(()=>{let H=setInterval(W,zU0);return()=>clearInterval(H)},[W]),K9.useEffect(()=>{W()},[$,W]),K9.useEffect(()=>{let H=!0,U=!1,K=J.subscribe(()=>{if(U)return;U=!0,queueMicrotask(()=>{if(U=!1,H)W()})});return()=>{H=!1,K()}},[J,W]),K9.useEffect(()=>()=>J.dispose(),[J]),X}var K9,zU0=2000;var TE=a(()=>{C7();x8();q_();W2();K9=H1(q1(),1)});import{TextAttributes as Ar}from"@opentui/core";function ZG($,Z){if(!Z)return;for(let J of r7(Z.root))if(J.id!=="leaf-1")X4().release(N3($,J.id))}function Rr($){let{theme:Z,transparentBackground:J}=l0(),X=J?Z.border:Z.borderSubtle,z=Z1(),G=I2(),W=$.splitTree??Pr,[H,U]=mq.useState(W.activeLeafId);mq.useEffect(()=>{U(($.splitTree??Pr).activeLeafId)},[$.splitTree]);let K=()=>({...W,activeLeafId:H}),N=(o)=>{if(o===W)return;$.onSplitChange(Mq(o))},L=RF(W),M=yj(G.get(GF))==="box"&&L,V=Mq(W)!==null;function P(o){let m=K(),e=DV(m,o);if(e===null)return!1;if(e!==m)N(e),X4().release(N3($.tabKey,o));return!0}function _(o){if(P(o))return;ZG($.tabKey,W),$.onSplitChange(null),$.onExit?.()}let C=()=>X4().get(N3($.tabKey,H))?.size??null;g1(()=>({enabled:$.focused,bindings:G5({"workspace.split.right":()=>N(AF(K(),"row",[u5()],C())),"workspace.split.down":()=>N(AF(K(),"column",[u5()],C())),"workspace.split.focus-next":()=>U(sp(K(),1).activeLeafId)})}));let f=n$();g1(()=>({enabled:$.focused&&L,bindings:G5({"workspace.split.close":()=>P(H),"workspace.split.rename":()=>{let o=H;p5.show(f,x.get(o)??"",{dialogTitle:z("terminal.split.renameTitle"),fieldLabel:z("terminal.split.renameField"),submitLabel:z("terminal.tab.renameSubmit"),allowEmpty:!0}).then((m)=>{if(m===void 0)return;N(AV(K(),o,m))})}})}));let E=(o)=>$.focused&&H===o,S=mq.useMemo(()=>{let o=new Map;for(let m of r7(W.root))o.set(m.id,N3($.tabKey,m.id));return o},[$.tabKey,W]),T=Dr(S),x=WI(r7(W.root),$.command,$.engineTitle,T),b=(o,m)=>o?{border:[o],borderColor:m}:{border:!1},v=(o,m)=>{let e=()=>U(o.id),t=H===o.id,Y0=E(o.id),F0=R.jsxDEV(R.Fragment,{children:[R.jsxDEV(PE,{cwd:$.cwd,taskId:N3($.tabKey,o.id),command:o.content??$.command,initialInput:o.content===null?$.initialInput:void 0,onUserInput:o.content===null?$.onUserInput:void 0,onExit:()=>_(o.id),resetToken:o.id==="leaf-1"?$.resetToken:void 0,focused:Y0,imeAnchorActive:t,onRequestFocus:()=>{$.onRequestFocus?.(),e()}},void 0,!1,void 0,this),L?R.jsxDEV("box",{position:"absolute",right:0,top:0,zIndex:10,backgroundColor:Z.backgroundElement,children:R.jsxDEV("text",{fg:Y0?Z.focusAccent:Z.textMuted,attributes:Y0?Ar.BOLD:Ar.DIM,wrapMode:"none",children:` ${x.get(o.id)??""} `},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);if(M)return R.jsxDEV("box",{flexGrow:1,flexShrink:1,flexBasis:0,border:!0,borderColor:Y0?Z.focusAccent:X,onMouseUp:e,children:F0},o.id,!1,void 0,this);return m?R.jsxDEV("box",{flexGrow:1,flexShrink:1,flexBasis:0,border:[m],borderColor:Y0?Z.focusAccent:X,onMouseUp:e,children:F0},o.id,!1,void 0,this):R.jsxDEV("box",{flexGrow:1,flexShrink:1,flexBasis:0,border:!1,onMouseUp:e,children:F0},o.id,!1,void 0,this)},u=(o,m,e)=>o.kind==="leaf"?v(o,e):R.jsxDEV("box",{flexDirection:o.orientation,flexGrow:1,flexShrink:1,flexBasis:0,...b(M?void 0:e,X),children:o.children.map((t,Y0)=>u(t,t.kind==="leaf"?t.id:`${m}.${Y0}`,Y0>0?o.orientation==="row"?"left":"top":void 0))},m,!1,void 0,this);if(V)return R.jsxDEV("box",{flexDirection:"column",flexGrow:1,overflow:"hidden",children:u(W.root,"root")},void 0,!1,void 0,this);return R.jsxDEV(PE,{cwd:$.cwd,taskId:$.tabKey,command:$.command,initialInput:$.initialInput,onUserInput:$.onUserInput,onExit:$.onExit,resetToken:$.resetToken,focused:$.focused,imeAnchorActive:!0,onRequestFocus:$.onRequestFocus},void 0,!1,void 0,this)}var mq,Pr;var cF=a(async()=>{WF();r3();x8();U7();MZ();M3();Q$();TE();r0();await e1([cJ(),$$(),C4(),Cr(),V5()]);mq=H1(q1(),1),Pr=CV(null)});function M_($,Z,J){let X=Z?b8($,Z):e2($,J);if(ZG(X,Z?.splitTree??null),Z?.kind==="engine"&&Z.ptyTask)return;G_(X);let z=X4(),G=z.get(X);if(z.release(X),!G)YU0(X)}function YU0($){let Z=Ah();if(!Z)return;Z.then((J)=>J.request("pty.kill",{key:$})).catch(()=>{})}function GU0($,Z){let J=$8.get(Z);if(J)return J;let X=$.store[P7(Z)];return X&&Array.isArray(X.tabs)?X:null}function Tr($,Z,J){if(Sn(Z,J),!En())return!0;let z=GU0($,Z);if(!z)return!1;let G=z.tabs.find((U)=>U.id===J),{state:W,closedId:H}=Vq(z,J);if(!H)return!1;return $8.set(Z,W),$.set(P7(Z),W),M_(Z,G,H),!0}var SE=a(async()=>{$F();x8();W_();U7();O3();await cF()});function Ir($){let{theme:Z}=l0(),J=I2(),X=hQ(),z=Z1(),G=Sr.useCallback((H,U)=>{if(!Tr(J,H,U))X.notify({kind:"error",taskId:H,tabId:U,title:z("terminal.tab.cannotCloseLast")})},[J,X,z]),W={width:$.width,nav:$.nav,onNavChange:$.onNavChange,tasks:$.tasks,selectedId:$.selectedId,onSelect:$.onSelect,onActivate:$.onActivate,engineState:$.engineState,engineTabState:$.engineTabState,engineLifecycle:$.engineLifecycle,taskJobs:$.taskJobs,worktreeChanges:$.worktreeChanges,transcriptActivity:$.transcriptActivity,focused:$.focused,onDeleteRequest:$.onDeleteRequest,onArchiveRequest:$.onArchiveRequest,onRenameRequest:$.onRenameRequest,onPinRequest:$.onPinRequest,onLocalMergeRequest:$.onLocalMergeRequest,moveMode:$.moveMode,onMoveRequest:$.onMoveRequest,onMoveModeExit:$.onMoveModeExit,onSearchActiveChange:$.onSearchActiveChange,onAddTask:$.onAddTask,headerStatus:$.headerStatus,onHeaderStatusClick:$.onHeaderStatusClick,zenActive:$.zenActive,onZenClick:$.onZenClick};return R.jsxDEV("box",{width:$.width,flexShrink:0,flexDirection:"column",backgroundColor:Z.backgroundPanel,onMouseUp:$.onFocusRequest,children:[R.jsxDEV(pa,{...W,selectedTabId:$.selectedTabId,onSelectTab:$.onSelectTab,onCloseTab:G,recentTask:$.recentTask??null},void 0,!1,void 0,this),R.jsxDEV("box",{flexShrink:0,paddingLeft:1,paddingBottom:0,children:R.jsxDEV(cV,{pane:"sidebar"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Sr;var Er=a(async()=>{M3();Uq();Q$();r0();await e1([xF(),$$(),na(),SE()]);Sr=H1(q1(),1)});import{basename as WU0}from"path";async function wr($){let Z=new m5($);try{await Z.connect()}catch(J){throw Z.close(),J}return{rpc:Z,close:()=>Z.close()}}async function JG(){try{return await wr(p2())}catch{return null}}async function dF(){return wr(await Bj())}async function XG($){try{let{sessions:Z}=await $.request("pty.list",{});return Z??[]}catch{return[]}}function N_($,Z){return($.split("::")[0]??$)===Z}function hq($,Z){return $.filter((J)=>N_(J.key,Z)).map((J)=>J.key)}async function uq($,Z){for(let J of Z)await $.request("pty.kill",{key:J}).catch(()=>{})}function HU0($,Z){for(let J of $)for(let X of J.split(/\s+/)){let z=X.replace(/^['"]+|['"]+$/g,"");if(z&&WU0(z)===Z)return!0}return!1}function O_($,Z,J){let X=$.filter((G)=>G.alive&&N_(G.key,Z)),z=X.find((G)=>G.key===`${Z}::tab-1`);if(z)return z.key;if(J){let G=X.find((W)=>HU0(W.command,J));if(G)return G.key}return null}async function L_($,Z,J){await $.request("pty.write",{key:Z,data:`\x1B[200~${J}\x1B[201~`}),await new Promise((X)=>setTimeout(X,qU0)),await $.request("pty.write",{key:Z,data:"\r"})}async function j_($,Z,J){if(!(await $.request("pty.peek",{key:Z})).alive)return!1;return await L_($,Z,J),!0}async function IE($,Z,J){let X=await $.request("pty.open",{key:J.key,cwd:Z,command:J.command});return await $.request("pty.detach",{key:J.key}).catch(()=>{}),X}async function lF($,Z,J,X,z={}){let G=z.sleep??((U)=>new Promise((K)=>setTimeout(K,U))),W=z.snapshot??jZ,H=Date.now()+(z.timeoutMs??UU0);while(Date.now()<H){let{sessions:U=[]}=await $.request("pty.list",{}),K=U.find((N)=>N.key===Z);if(!K?.alive)return!1;if(K.pid){let N=!1;try{N=H_(LZ(await W()),K.pid,J)}catch{N=!1}if(N)return await G(z.settleMs??KU0),await L_($,Z,X),!0}await G(z.intervalMs??BU0)}return!1}var qU0=150,UU0=20000,BU0=500,KU0=1500;var V_=a(()=>{a6();sK();c7();vq()});function xr($,Z){return $.find((J)=>J.id!==Z&&!J.archived)}async function fr($,Z,J){let X=await JG();if(!X)return;try{await uq(X.rpc,hq(await XG(X.rpc),$))}catch(z){Z.error(`${J} kill hosted session failed:`,z)}finally{X.close()}}function gr($,Z){let J=$.activeTaskSignal;if(typeof J!=="function")return!0;return J.call($)()===Z}async function FU0($){let Z=$.tasks.find((z)=>z.id===$.taskId);if(!Z)return null;let J=!Z.archived;try{await $.orch.setArchived($.taskId,J)}catch(z){return $.logger.error(`${$.logPrefix} archive failed:`,z),null}if(!J)return{archived:J};let X=xr($.tasks,$.taskId);if($.updateActiveTask&&gr($.orch,$.taskId))await $.orch.setActiveTask(X?.id??null).catch(()=>{});return await fr($.taskId,$.logger,$.logPrefix),{archived:J,nextTask:X}}async function MU0($){let Z=xr($.tasks,$.taskId);if($.updateActiveTask&&$.orch&&gr($.orch,$.taskId))await $.orch.setActiveTask(Z?.id??null).catch(()=>{});return await fr($.taskId,$.logger,$.logPrefix),{nextTask:Z}}async function yr($,Z){if(!$.orch)return;let J=$.tasks().find((z)=>z.id===Z);if(!J)return;if(!J.archived){if(!await $.confirm({title:`Archive "${J.title}"?`,body:"Moves it to Archives and stops its running session. The worktree, branch, and chat history stay \u2014 unarchive to bring it back.",cancelLabel:"cancel",confirmLabel:"archive"}))return}if(!await FU0({orch:$.orch,tasks:$.tasks(),taskId:Z,logger:$.logger,logPrefix:$.logPrefix,updateActiveTask:$.updateActiveTask}))return;await $.reload?.()}async function br($,Z){if(!$.orch)return;let J=$.tasks().find((W)=>W.id===Z);if(!J)return;if(J.kind==="main"){if(!await $.confirm({title:`Remove project "${J.title}"?`,body:"Forgets it from the projects list. The repo, its branches, worktrees, and any tasks under it stay on disk \u2014 re-add it with `rove add`.",cancelLabel:"cancel",confirmLabel:"remove"}))return;try{await $.orch.forgetProject(J.repo)}catch(H){$.logger.error(`${$.logPrefix} forget project failed:`,H),$.notifyError?.(`Couldn't remove: ${N1(H)}`);return}await $.reload?.();return}if(!await $.confirm({title:`Delete "${J.title}"?`,body:J.kind==="dir"?"Removes the task entry. The directory itself stays on disk. Its hosted sessions are stopped.":"Removes the task entry and its worktree. Its hosted sessions are stopped.",cancelLabel:"cancel",confirmLabel:"delete"}))return;let z=!1;try{await $.orch.deleteTask(Z),z=!0}catch(W){if(N1(W).includes(OP)){if(await $.confirm({title:`"${J.title}" has uncommitted changes`,body:"Its worktree has uncommitted or untracked work that will be permanently deleted. Force delete anyway?",cancelLabel:"cancel",confirmLabel:"force delete"}))try{await $.orch.deleteTask(Z,{force:!0}),z=!0}catch(K){$.logger.error(`${$.logPrefix} force delete failed:`,K),$.notifyError?.(`Couldn't delete: ${N1(K)}`)}}else $.logger.error(`${$.logPrefix} delete failed:`,W),$.notifyError?.(`Couldn't delete: ${N1(W)}`)}if(!z)return;let{nextTask:G}=await MU0({orch:$.orch,tasks:$.tasks(),taskId:Z,logger:$.logger,logPrefix:$.logPrefix,updateActiveTask:$.updateActiveTask});await $.reload?.(),$.onTaskDeleted?.(Z,G)}async function kr($,Z){let J=$.tasks().find((z)=>z.id===Z);if(!J)return;let X=await $.promptText(J.title);if(!X||!$.orch)return;try{await $.orch.setTitle(Z,X)}catch(z){$.logger.error(`${$.logPrefix} task.rename failed:`,z),$.notifyError?.(`Couldn't rename task: ${N1(z)}`);return}await $.reload?.()}async function vr($,Z){let J=$.tasks().find((G)=>G.id===Z);if(!J||!$.orch)return;let X=await GZ(),z=qH(X,J.vendor??M4);try{await $.orch.setVendor(Z,z)}catch(G){$.logger.error(`${$.logPrefix} task.setVendor failed:`,G),$.notifyError?.(`Couldn't switch engine: ${N1(G)}`);return}$.notifyInfo?.(`Engine \u2192 ${Z7(z)} (applies on reopen)`),await $.reload?.()}var mr=a(()=>{SJ();V_();d5();NQ();d7();u7()});async function hr($){let Z=t9(),J=$.cursorRepo()??Z[0]??process.cwd(),X=$.lastVendor(J)??M4,z=await GZ();if(z.length===0)$.notifyInfo?.("No engine CLI detected \u2014 install claude or codex, or add one in Settings \u2192 Engines");let G=$.orch,W=await $.promptNewTask(J,Z,{defaultVendor:X,availableVendors:z,discoverAdoptable:G?(U)=>G.discoverAdoptableWorktrees(U):void 0});if(!W)return;if($.rememberVendor(W.repo,W.vendor),UY(W.repo),$.onRepoSaved?.(),!G){$.logger.error(`${$.logPrefix} no daemon; cannot create task`);return}$.notifyInfo?.("Creating task\u2026");let H;if(W.mode==="adopt"){let U=W.adopt.length,K=0,N;for(let L of W.adopt)try{H=(await G.adoptWorktree({repo:W.repo,worktreePath:L.worktreePath,branch:L.branch,vendor:W.vendor})).id,K++}catch(M){if(N===void 0)N=N1(M);$.logger.error(`${$.logPrefix} adoptWorktree failed for ${L.worktreePath}:`,M)}if(K===0){$.notifyError?.(S$("newTask.adopt.summaryNone",{error:N??""}));return}if(K<U)$.notifyInfo?.(S$("newTask.adopt.summaryPartial",{done:K,total:U}));else $.notifyInfo?.(S$("newTask.adopt.summaryAll",{count:K}))}else try{H=(await G.createTask({repo:W.repo,baseRef:W.baseRef,vendor:W.vendor})).id}catch(U){$.logger.error(`${$.logPrefix} task.create failed:`,U),$.notifyError?.(`Couldn't create task: ${N1(U)}`);return}if(await $.reload?.(),H)$.selectTask?.(H),await $.enterTask?.(H)}var ur=a(()=>{SJ();b4();gY();d7()});import{TextAttributes as NU0}from"@opentui/core";function OU0($){let Z=n$(),{theme:J}=l0(),X=Z1(),z=H7(),[G,W]=cq.useState($.currentBranch),[H,U]=cq.useState(0),K=cq.useMemo(()=>sj($.repo),[$.repo]),N=cq.useMemo(()=>tj(K,G),[K,G]),L=G9(N,H);function M(_){if(N.length===0)return;U((C)=>w4(C+_,N.length))}function V(_){let C=_.trim();if(!C)return;$.onSubmit(C),Z.clear()}let P=L.items.map((_,C)=>({key:`${L.start+C}:${_}`,body:_,accent:G.trim()===_}));return g1(()=>({bindings:[{key:"up",cmd:()=>M(-1)},{key:"down",cmd:()=>M(1)}]})),R.jsxDEV("box",{paddingLeft:z,paddingRight:z,gap:1,children:[R.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",children:[R.jsxDEV("text",{attributes:NU0.BOLD,fg:J.text,children:X("tasks.reBranch.title")},void 0,!1,void 0,this),R.jsxDEV("text",{fg:J.textMuted,onMouseUp:()=>$.onCancel(),children:"esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV("box",{gap:0,children:[R.jsxDEV("text",{fg:J.accent,children:X("tasks.reBranch.fieldLabel")},void 0,!1,void 0,this),R.jsxDEV("input",{value:G,placeholder:$.currentBranch,focused:!0,onInput:(_)=>{W(l5(_)),U(0)},onSubmit:()=>V(ej(G,N,H))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.length===0?R.jsxDEV("box",{gap:0,paddingBottom:1,children:R.jsxDEV("text",{fg:J.textMuted,wrapMode:"none",children:K.length===0?X("tasks.reBranch.hintNoBranches"):X("tasks.reBranch.hintNoMatch")},void 0,!1,void 0,this)},void 0,!1,void 0,this):R.jsxDEV(B9,{window:L,cursor:H,rows:P,onPick:(_)=>V(N[_]??G),paddingBottom:1},void 0,!1,void 0,this),R.jsxDEV("box",{paddingBottom:1,children:R.jsxDEV("text",{fg:J.textMuted,children:X("tasks.reBranch.footer")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function LU0($,Z){return S2($,(J)=>R.jsxDEV(OU0,{currentBranch:Z.currentBranch,repo:Z.repo,onSubmit:(X)=>J(X),onCancel:()=>J(void 0)},void 0,!1,void 0,this))}var cq,cr;var dr=a(async()=>{g8();kQ();Q$();r0();await e1([$$(),C4(),V5(),aJ()]);cq=H1(q1(),1);cr={show:LU0}});function lr({vm:$}){let{theme:Z}=l0(),J=Z1(),X=$.adoptVisible.map((z)=>{let G=[z.dirty?"dirty":"",z.kobeManaged?"":"external"].filter(Boolean).join(",");return{key:z.path,body:`${$.adoptSelected.has(z.path)?"[x] ":"[ ] "}${z.branch}${G?` (${G})`:""}`,accent:$.adoptSelected.has(z.path)}});return R.jsxDEV(R.Fragment,{children:[R.jsxDEV("box",{gap:0,children:[R.jsxDEV("text",{...Z6(Z,$.field,"adoptFilter"),children:J("newTask.field.adoptFilter")},void 0,!1,void 0,this),R.jsxDEV("input",{value:$.adoptFilter,placeholder:J("newTask.placeholder.adoptFilter"),focused:$.field==="adoptFilter",onMouseUp:()=>$.setField("adoptFilter"),onInput:(z)=>$.setAdoptFilterText(z),onSubmit:()=>$.toggleAdoptCursor()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV("box",{paddingLeft:2,children:R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:J("newTask.adopt.repoLine",{path:$.expandedRepo||J("newTask.adopt.repoNone")})},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.adoptLoading?R.jsxDEV("box",{paddingLeft:2,children:R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:J("newTask.hint.scanningWorktrees")},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,!$.adoptLoading&&$.adoptList.length===0?R.jsxDEV("box",{paddingLeft:2,children:R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:$.adoptDiscoveredCount===0?J("newTask.adopt.noUnlinked"):J("newTask.adopt.noMatch")},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,$.adoptList.length>0?R.jsxDEV(B9,{window:$.adoptWindow,cursor:$.adoptCursor,rows:X,onPick:$.pickAdoptAt,footer:R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:$.adoptSelected.size>0?J("newTask.adopt.hintSelected",{count:$.adoptSelected.size}):J("newTask.adopt.hintDefault")},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var pr=a(async()=>{Q$();r0();await e1([$$(),aJ()])});function nr({vm:$}){let{theme:Z}=l0(),J=Z1(),X=$.cloneParentWindow.items.map((z,G)=>({key:`${$.cloneParentWindow.start+G}:${z}`,body:`${z}/`}));return R.jsxDEV(R.Fragment,{children:[R.jsxDEV("box",{gap:0,children:[R.jsxDEV("text",{...Z6(Z,$.field,"cloneUrl"),children:J("newTask.field.gitUrl")},void 0,!1,void 0,this),R.jsxDEV("input",{value:$.cloneUrl,placeholder:"https://github.com/user/repo.git",focused:$.field==="cloneUrl",onMouseUp:()=>$.setField("cloneUrl"),onInput:(z)=>$.setCloneUrlText(z),onSubmit:()=>{if(!$.cloneUrl.trim())return;$.setField("cloneParent")}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV("box",{gap:0,children:[R.jsxDEV("text",{...Z6(Z,$.field,"cloneParent"),children:J("newTask.field.parentDir")},void 0,!1,void 0,this),R.jsxDEV("input",{value:$.cloneParent,placeholder:"~/",focused:$.field==="cloneParent",onMouseUp:()=>$.setField("cloneParent"),onInput:(z)=>$.setCloneParentText(z),onSubmit:()=>$.onCloneParentSubmit()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.field==="cloneParent"?R.jsxDEV("box",{paddingLeft:2,children:R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:J("newTask.hint.remembered")},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,$.field==="cloneParent"&&$.cloneParentFiltered.length>0&&!$.cloneParentPicked?R.jsxDEV(B9,{window:$.cloneParentWindow,cursor:$.cloneParentCursor,rows:X,onPick:$.selectCloneParentAt},void 0,!1,void 0,this):null,R.jsxDEV("box",{gap:0,children:[R.jsxDEV("text",{...Z6(Z,$.field,"cloneFolder"),children:J("newTask.field.folderName")},void 0,!1,void 0,this),R.jsxDEV("input",{value:$.cloneFolder,placeholder:J("newTask.placeholder.folderName"),focused:$.field==="cloneFolder",onMouseUp:()=>$.setField("cloneFolder"),onInput:(z)=>$.setCloneFolderText(z),onSubmit:()=>$.setField("cloneBaseRef")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R.jsxDEV("box",{gap:0,children:[R.jsxDEV("text",{...Z6(Z,$.field,"cloneBaseRef"),children:J("newTask.field.baseBranch")},void 0,!1,void 0,this),R.jsxDEV("input",{value:$.cloneBaseRef,placeholder:f8,focused:$.field==="cloneBaseRef",onMouseUp:()=>$.setField("cloneBaseRef"),onInput:(z)=>$.setCloneBaseRefText(z),onSubmit:()=>void $.commitClone()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.cloneInFlight?R.jsxDEV("box",{gap:0,paddingLeft:2,children:R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:$.cloneProgress||J("newTask.clone.progressFallback")},void 0,!1,void 0,this)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var ir=a(async()=>{kQ();Q$();r0();await e1([$$(),aJ()])});function or({vm:$}){let{theme:Z}=l0(),J=Z1(),X=$.activeWindow.items.map((G,W)=>{let H=$.mode==="saved"&&G===$.defaultRepo,U=$.mode==="browse"?"/":"",K=H?` ${J("newTask.hint.currentDir")}`:"";return{key:`${$.activeWindow.start+W}:${G}`,body:`${G}${U}${K}`,accent:$.mode==="saved"&&$.repo.trim()===G}}),z=$.branchWindow.items.map((G,W)=>({key:`${$.branchWindow.start+W}:${G}`,body:G,accent:$.baseRef.trim()===G}));return R.jsxDEV(R.Fragment,{children:[R.jsxDEV("box",{gap:0,children:[R.jsxDEV("text",{...Z6(Z,$.field,"repo"),children:J("newTask.field.repo")},void 0,!1,void 0,this),R.jsxDEV("input",{value:$.repo,placeholder:$.defaultRepo,focused:$.field==="repo",onMouseUp:()=>$.setField("repo"),onInput:(G)=>$.setRepoText(G),onSubmit:()=>$.onRepoSubmit()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.field==="repo"&&$.activeList.length>0&&!$.repoPicked?R.jsxDEV(B9,{window:$.activeWindow,cursor:$.repoCursor,rows:X,onPick:$.selectRepoAt},void 0,!1,void 0,this):null,R.jsxDEV("box",{gap:0,children:[R.jsxDEV("text",{...Z6(Z,$.field,"baseRef"),children:J("newTask.field.fromBranch")},void 0,!1,void 0,this),R.jsxDEV("input",{value:$.baseRef,placeholder:f8,focused:$.field==="baseRef",onMouseUp:()=>$.setField("baseRef"),onInput:(G)=>$.setBaseRefText(G),onSubmit:()=>$.onBaseRefSubmit()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.field==="baseRef"&&$.branchFiltered.length===0&&$.submitError==null?R.jsxDEV("box",{gap:0,paddingLeft:2,paddingBottom:1,children:R.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:$.branches.length===0?J("newTask.hint.noBranchesFound"):J("newTask.hint.noMatchBranch")},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,$.field==="baseRef"&&$.branchFiltered.length>0?R.jsxDEV(B9,{window:$.branchWindow,cursor:$.branchCursor,rows:z,onPick:$.pickBranchAt,paddingBottom:1},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var ar=a(async()=>{kQ();Q$();r0();await e1([$$(),aJ()])});function EE($){return $&&$.length>0?$:T8}function rr($,Z){let J=Z??"claude";return $.includes(J)?J:$[0]??"claude"}function sr($,Z){let J=new Set($);if(J.has(Z))J.delete(Z);else J.add(Z);return J}function tr($,Z){if(Z.length===0)return $;return Z.every((X)=>$.has(X))?new Set:new Set(Z)}var wE=a(()=>{u7()});function er($){let[Z,J]=k8.useState(""),[X,z]=k8.useState(0),[G,W]=k8.useState(new Set),[H,U]=k8.useState(void 0),[K,N]=k8.useState(!1),L=k8.useMemo(()=>Wl(H??[],Z),[H,Z]),M=G9(L.map((m)=>m.path),X),V=L.slice(M.start,M.start+M.items.length),P=(H??[]).length,{active:_,expandedRepo:C,discoverAdoptable:f}=$;k8.useEffect(()=>{if(!_)return;let m=!1;return N(!0),(async()=>{let e=[];try{e=f?await f(C):[]}catch{e=[]}if(m)return;U(e),N(!1)})(),()=>{m=!0}},[_,C,f]),k8.useEffect(()=>{z((m)=>w4(m,L.length))},[L]);let E=k8.useRef(void 0);k8.useEffect(()=>{if(E.current!==void 0&&E.current!==C)W(new Set),z(0);E.current=C},[C]);function S(m){J(l5(m))}function T(m){W((e)=>sr(e,m))}function x(){let m=L[X];if(m)T(m.path)}function b(m){let e=L[m];if(!e)return;z(m),T(e.path)}function v(){W((m)=>tr(m,L.map((e)=>e.path)))}function u(m){if(L.length===0)return;z((e)=>w4(e+m,L.length))}function o(){if(L.length===0){$.setSubmitError(S$("newTask.error.noAdoptable"));return}let m=G.size>0?L.filter((e)=>G.has(e.path)):L.slice(X,X+1);if(m.length===0)return;$.onSubmit({mode:"adopt",repo:C,vendor:$.vendor,adopt:m.map((e)=>({worktreePath:e.path,branch:e.branch}))}),$.clearDialog()}return{adoptFilter:Z,adoptLoading:K,adoptDiscoveredCount:P,adoptList:L,adoptWindow:M,adoptVisible:V,adoptCursor:X,adoptSelected:G,setAdoptFilterText:S,toggleAdoptCursor:x,pickAdoptAt:b,adoptSelectAll:v,moveAdoptCursor:u,commitAdopt:o}}var k8;var $s=a(()=>{g8();Q$();wE();k8=H1(q1(),1)});import{spawn as jU0}from"child_process";import*as QG from"fs";import*as pF from"path";function Zs($){let Z=$.trim().replace(/\/+$/,"");if(!Z)return"";let J=Z.lastIndexOf("/"),X=Z.lastIndexOf(":"),z=Math.max(J,X);return(z>=0?Z.slice(z+1):Z).replace(/\.git$/i,"")}function Js($){let Z=$.trim();if(!Z)return S$("newTask.error.gitUrlRequired");let J=Z.includes("://"),X=Z.includes("@")&&Z.includes(":"),z=Z.includes("/");if(!J&&!X&&!z)return S$("newTask.error.gitUrlInvalid",{url:Z});return null}function xE($,Z){let J=Z.trim();if(!J)return S$("newTask.error.folderRequired");if(J.includes("/")||J.includes("\\"))return S$("newTask.error.folderHasSeparator");let X=$.trim();if(!X)return S$("newTask.error.parentRequired");let z=NZ(X),G;try{G=QG.statSync(z)}catch{return S$("newTask.error.parentNotFound",{path:z})}if(!G.isDirectory())return S$("newTask.error.parentNotDir",{path:z});let W=pF.join(z,J);if(QG.existsSync(W))return S$("newTask.error.targetExists",{path:W});return null}function Xs($,Z){return pF.join(NZ($.trim()),Z.trim())}function Qs($,Z){let J=Z.trim();if(!J)return Z;let X=NZ($.trim());if(!X)return Z;try{if(!QG.statSync(X).isDirectory())return Z}catch{return Z}if(!QG.existsSync(pF.join(X,J)))return J;for(let z=2;z<1000;z++){let G=`${J}-${z}`;if(!QG.existsSync(pF.join(X,G)))return G}return J}function zs($,Z,J){return new Promise((X)=>{let z="";try{let G=jU0("git",["clone","--progress",$,Z],{stdio:["ignore","ignore","pipe"],env:{...process.env,GIT_TERMINAL_PROMPT:"0",GIT_ASKPASS:""}});G.stderr?.setEncoding("utf-8"),G.stderr?.on("data",(W)=>{if(z+=W,J){let H=W.split(/[\r\n]+/).filter((K)=>K.trim().length>0),U=H[H.length-1];if(U)J(U)}}),G.on("error",(W)=>{X({ok:!1,error:W.message})}),G.on("close",(W)=>{if(W===0){X({ok:!0,path:Z});return}let H=z.split(/[\r\n]+/).filter((U)=>U.trim().length>0).pop()??`git clone exited with ${W}`;X({ok:!1,error:H})})}catch(G){X({ok:!1,error:N1(G)})}})}var Ys=a(()=>{gY();pY()});function __($){let Z=fE.useMemo(()=>ip($),[$]),J=fE.useMemo(()=>ap(op(Z.base),Z.filter),[Z]);return{split:Z,filtered:J}}var fE;var gE=a(()=>{pY();fE=H1(q1(),1)});function Gs($){let[Z,J]=Y6.useState(""),[X,z]=Y6.useState($.defaultCloneParent?.trim()?$.defaultCloneParent:"~/"),[G,W]=Y6.useState(""),[H,U]=Y6.useState(!1),[K,N]=Y6.useState(f8),[L,M]=Y6.useState(!1),[V,P]=Y6.useState(""),[_,C]=Y6.useState(0),[f,E]=Y6.useState(!1),{split:S,filtered:T}=__(X),x=G9(T,_);Y6.useEffect(()=>{if(H)return;W(Qs(X,Zs(Z)))},[Z,X,H]);function b(F0){J(l5(F0))}function v(F0){E(!1),z(l5(F0)),C(0)}function u(F0){U(!0),W(l5(F0))}function o(F0){N(l5(F0))}function m(){let F0=T[_];if(F0)z(Fq(X,S.base,F0)),C(0),E(!0);$.setField("cloneFolder")}function e(F0){let K0=T[F0];if(!K0)return;z(Fq(X,S.base,K0)),C(F0),E(!0),$.setField("cloneFolder")}function t(F0){if(T.length===0)return;C((K0)=>w4(K0+F0,T.length))}async function Y0(){if(L)return;let F0=Js(Z);if(F0){$.setSubmitError(F0),$.setField("cloneUrl");return}let K0=xE(X,G);if(K0){$.setSubmitError(K0);let l=G.trim(),n=!(!l||l.includes("/")||l.includes("\\"))&&xE(X,"__kobe_probe__")!=null;$.setField(n?"cloneParent":"cloneFolder");return}let M0=Xs(X,G);M(!0),P(S$("newTask.clone.progressInto",{target:M0}));let H0=await zs(Z.trim(),M0,(l)=>P(l));if(M(!1),!H0.ok){$.setSubmitError(S$("newTask.error.cloneFailed",{error:H0.error})),$.setField("cloneUrl");return}let k=K.trim()||f8;$.onSubmit({repo:H0.path,baseRef:k,vendor:$.vendor,cloned:{parentDir:NZ(X.trim())}}),$.clearDialog()}return{cloneUrl:Z,cloneParent:X,cloneFolder:G,cloneBaseRef:K,cloneInFlight:L,cloneProgress:V,cloneParentFiltered:T,cloneParentWindow:x,cloneParentCursor:_,cloneParentPicked:f,setCloneUrlText:b,setCloneParentText:v,setCloneFolderText:u,setCloneBaseRefText:o,onCloneParentSubmit:m,selectCloneParentAt:e,moveParentCursor:t,commitClone:Y0}}var Y6;var Ws=a(()=>{Ys();g8();kQ();pY();Q$();gE();Y6=H1(q1(),1)});function Hs($){let Z=n$(),[J,X]=R7.useState("existing"),z=EE($.availableVendors),[G,W]=R7.useState(()=>rr(EE($.availableVendors),$.defaultVendor)),[H,U]=R7.useState("tabs"),[K,N]=R7.useState($.defaultRepo),[L,M]=R7.useState(()=>Wq(NZ($.defaultRepo.trim()))??f8),[V,P]=R7.useState(!1),[_,C]=R7.useState(0),[f,E]=R7.useState(!1),[S,T]=R7.useState(0),[x,b]=R7.useState(null),v=R7.useMemo(()=>Hl($.defaultRepo,$.savedRepos),[$.defaultRepo,$.savedRepos]),u=Gl(K,v),{split:o,filtered:m}=__(K),e=R7.useMemo(()=>ql(v,K),[v,K]),t=u==="browse"?m:e,Y0=G9(t,_),F0=NZ(K.trim()),K0=R7.useMemo(()=>sj(F0),[F0]),M0=R7.useMemo(()=>tj(K0,L),[K0,L]),H0=G9(M0,S),k=Gs({defaultCloneParent:$.defaultCloneParent,vendor:G,onSubmit:$.onSubmit,clearDialog:()=>Z.clear(),setField:U,setSubmitError:b}),l=er({active:J==="adopt",expandedRepo:F0,vendor:G,discoverAdoptable:$.discoverAdoptable,onSubmit:$.onSubmit,clearDialog:()=>Z.clear(),setSubmitError:b});R7.useEffect(()=>{if(!F0||V)return;let L0=Wq(F0);if(L0)M(L0)},[F0,V]),R7.useEffect(()=>{b(null)},[K,k.cloneUrl,k.cloneParent,k.cloneFolder,l.adoptFilter]);function d(L0){E(!1),N(l5(L0)),C(0),T(0)}function n(L0){P(!0),M(l5(L0)),T(0)}function G0(){let L0=F0;if(!L0)return;let d0=Yl(L0);if(d0){b(d0),U("repo");return}let G1=L.trim()||f8;$.onSubmit({repo:L0,baseRef:G1,vendor:G}),Z.clear()}function s(){if(J==="clone"){k.commitClone();return}if(J==="adopt"){l.commitAdopt();return}G0()}function r(L0){if(k.cloneInFlight||L0===J)return;X(L0),U(uS(L0)),b(null)}function J0(L0){if(k.cloneInFlight)return;let d0=L0===1?vS(J):mS(J);if(d0===J)return;X(d0),b(null),U("tabs")}function C0(L0){W((d0)=>L0===1?qH(z,d0):sf(z,d0))}function Q0(){if(!K.trim()&&u==="saved"){let d0=t[0];if(d0){N(d0),U("baseRef");return}}if(u==="browse"){let d0=m[_];if(d0)N(Fq(K,o.base,d0)),C(0),E(!0);U("baseRef");return}let L0=t[_];if(L0)N(L0);U("baseRef")}function w0(L0){let d0=t[L0];if(!d0)return;if(u==="browse")N(Fq(K,o.base,d0)),E(!0);else N(d0);C(L0),U("baseRef")}function v0(L0){let d0=M0[L0];if(!d0)return;M(d0),P(!0),T(L0),U("confirm")}function P0(){M(ej(L,M0,S)),P(!0),G0()}function u0(L0){if(k.cloneInFlight)return;if(J==="existing"&&H==="repo"&&t.length>0){C((d0)=>w4(d0+L0,t.length));return}if(J==="existing"&&H==="baseRef"&&M0.length>0){T((d0)=>w4(d0+L0,M0.length));return}if(J==="clone"&&H==="cloneParent"){k.moveParentCursor(L0);return}if(J==="adopt")l.moveAdoptCursor(L0)}return g1(()=>({bindings:[{key:"tab",cmd:()=>U((L0)=>hS(L0,J))},{key:"ctrl+]",cmd:()=>r(vS(J))},{key:"ctrl+[",cmd:()=>r(mS(J))},{key:"ctrl+e",cmd:()=>C0(1)},{key:"up",cmd:()=>u0(-1)},{key:"down",cmd:()=>u0(1)},...H==="tabs"||H==="engine"?[{key:"left",cmd:()=>H==="tabs"?J0(-1):C0(-1)},{key:"right",cmd:()=>H==="tabs"?J0(1):C0(1)},{key:"return",cmd:()=>U((L0)=>hS(L0,J))}]:[],...J==="adopt"?[{key:"ctrl+a",cmd:l.adoptSelectAll}]:[]]})),g1(()=>({enabled:H==="confirm"&&!k.cloneInFlight,bindings:[{key:"return",cmd:()=>s()}]})),{...k,...l,defaultRepo:$.defaultRepo,tab:J,vendors:z,vendor:G,setVendor:W,field:H,setField:U,repo:K,mode:u,activeList:t,activeWindow:Y0,repoCursor:_,repoPicked:f,expandedRepo:F0,baseRef:L,branches:K0,branchFiltered:M0,branchWindow:H0,branchCursor:S,submitError:x,setRepoText:d,setBaseRefText:n,onRepoSubmit:Q0,selectRepoAt:w0,pickBranchAt:v0,onBaseRefSubmit:P0,switchToTab:r,commit:s,commitExisting:G0}}var R7;var qs=a(async()=>{u7();g8();kQ();pY();wE();$s();Ws();gE();await e1([C4(),V5()]);R7=H1(q1(),1)});import{TextAttributes as nF}from"@opentui/core";function Us($){let{theme:Z}=l0(),J=Z1(),X=H7(),z=Hs($),G={existing:J("newTask.tabs.existing"),clone:J("newTask.tabs.clone"),adopt:J("newTask.tabs.adopt")},W=z.field==="tabs",H=(U,K)=>U?K?nF.BOLD|nF.UNDERLINE:nF.BOLD:void 0;return R.jsxDEV("box",{paddingLeft:X,paddingRight:X,gap:0,children:[R.jsxDEV("box",{flexDirection:"row",children:R.jsxDEV("text",{attributes:nF.BOLD,fg:Z.text,children:J("newTask.title")},void 0,!1,void 0,this)},void 0,!1,void 0,this),R.jsxDEV("box",{gap:1,paddingTop:1,paddingBottom:1,children:[R.jsxDEV("box",{flexDirection:"row",gap:2,children:VU0.map((U)=>{let K=z.tab===U;return R.jsxDEV("text",{fg:K?Z.primary:Z.textMuted,attributes:H(K,W),onMouseUp:()=>z.switchToTab(U),children:K?`\u25B8 ${G[U]}`:` ${G[U]}`},U,!1,void 0,this)})},void 0,!1,void 0,this),R.jsxDEV("box",{gap:0,children:[R.jsxDEV("text",{...Z6(Z,z.field,"engine"),children:J("newTask.field.engine")},void 0,!1,void 0,this),R.jsxDEV(Iq,{choices:z.vendors,selected:z.vendor,onPick:(U)=>{z.setVendor(U),z.setField("engine")},children:[R.jsxDEV("box",{flexGrow:1},void 0,!1,void 0,this),R.jsxDEV("text",{fg:Z.textMuted,children:J("newTask.hint.engineCycle")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.tab==="existing"?R.jsxDEV(or,{vm:z},void 0,!1,void 0,this):null,z.tab==="clone"?R.jsxDEV(nr,{vm:z},void 0,!1,void 0,this):null,z.tab==="adopt"?R.jsxDEV(lr,{vm:z},void 0,!1,void 0,this):null,z.submitError?R.jsxDEV("text",{fg:Z.error,wrapMode:"word",children:["\u203B ",z.submitError]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),R.jsxDEV("box",{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",paddingTop:1,paddingBottom:1,children:R.jsxDEV("text",{fg:z.field==="confirm"?Z.primary:Z.text,attributes:z.field==="confirm"?nF.BOLD:void 0,onMouseUp:()=>z.commit(),children:z.cloneInFlight?J("newTask.button.cloning"):z.field==="confirm"?J("newTask.button.createFocused"):J("newTask.button.create")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var VU0;var Bs=a(async()=>{Q$();r0();await e1([$$(),V5(),aJ(),pr(),ir(),ar(),qs()]);VU0=["existing","clone","adopt"]});function _U0($,Z,J,X){return S2($,(z)=>R.jsxDEV(Us,{defaultRepo:Z,savedRepos:J,defaultCloneParent:X?.defaultCloneParent,defaultVendor:X?.defaultVendor,availableVendors:X?.availableVendors,discoverAdoptable:X?.discoverAdoptable,onSubmit:(G)=>z(G),onCancel:()=>z(void 0)},void 0,!1,void 0,this),{size:"medium"})}var Ks;var Fs=a(async()=>{g8();r0();await e1([V5(),Bs()]);Ks={show:_U0}});function CU0($){return{confirm:async(Z)=>await N4.show($,Z.title,Z.body,Z.cancelLabel,Z.confirmLabel)===!0,promptText:(Z,J)=>p5.show($,Z,J),promptNewTask:(Z,J,X)=>Ks.show($,Z,J,X)}}function yE($){return(Z,J)=>{if($.selectedId()!==Z)return;let X=$.tasks();$.setSelectedId(J?.id??(X.find((z)=>!z.archived)??X[0])?.id??null)}}function Ms($){return{orch:$.orch,tasks:()=>$.tasks(),...CU0($.dialog),...DU0,logger:console,logPrefix:$.logPrefix,notifyError:$.notifyError,notifyInfo:$.notifyInfo,updateActiveTask:!0,onTaskDeleted:yE($),cursorRepo:()=>{let Z=$.tasks();return(Z.find((J)=>J.id===$.selectedId())??Z[0])?.repo},selectTask:(Z)=>$.setSelectedId(Z),enterTask:(Z)=>$.enterTask(Z)}}var DU0;var Ns=a(async()=>{AJ();await e1([Fs(),cJ(),FZ()]);DU0={lastVendor:($)=>ZZ($),rememberVendor:($,Z)=>DJ($,Z)}});function Os($){let{orchestrator:Z,tasks:J,dialog:X,notifyError:z}=$,G={...Ms({orch:Z,tasks:J,dialog:X,notifyError:z,notifyInfo:$.notifyInfo,selectedId:$.selectedId,setSelectedId:$.setSelectedId,logPrefix:"[rove workspace]",enterTask:$.activateTask}),onTaskDeleted:(()=>{let K=yE({tasks:J,selectedId:$.selectedId,setSelectedId:$.setSelectedId});return(N,L)=>{$.forgetTaskTabs(N),K(N,L)}})()};async function W(K){let N=J().find((L)=>L.id===K);if(!N)return;await Z.setPinned(K,!N.pinned).catch((L)=>{z(`Couldn't pin: ${N1(L)}`)})}async function H(K,N){await Z.moveTask(K,N).catch((L)=>{z(`Couldn't move: ${N1(L)}`)})}async function U(K){let N=J().find((M)=>M.id===K);if(!N||N.kind==="main")return;let L=await cr.show(X,{currentBranch:N.branch,repo:N.repo});if(!L)return;await Z.setBranch(K,L).catch((M)=>{z(`Couldn't rename branch: ${N1(M)}`)})}return{createTask:()=>hr(G),archiveTask:(K)=>yr(G,K),deleteTask:(K)=>br(G,K),renameTask:(K)=>kr(G,K),renameBranch:U,cycleVendor:(K)=>vr(G,K),togglePin:W,moveTask:H}}var Ls=a(async()=>{mr();ur();await e1([dr(),Ns()])});import{spawn as AU0}from"child_process";import{existsSync as PU0}from"fs";import{basename as RU0,delimiter as TU0,isAbsolute as SU0,join as IU0}from"path";function bE($,Z,J){if(SU0($))return J($);let X=Z.PATH??"";for(let z of X.split(TU0)){if(!z)continue;if(J(IU0(z,$)))return!0}return!1}function xU0($){let Z=RU0($);if(Z==="code")return"VS Code";if(Z==="cursor")return"Cursor";if(Z==="windsurf")return"Windsurf";if(Z==="zed")return"Zed";return Z||$}function js($={}){let Z=$.env??process.env,J=$.platform??process.platform,X=$.exists??PU0,z=C$("OPEN_EDITOR",Z)?.trim();if(z)return{id:"env",label:xU0(z),command:z,args:[]};for(let G of EU0)if(bE(G.command,Z,X))return{id:G.id,label:G.label,command:G.command,args:[]};if(J==="darwin"&&bE("open",Z,X)){for(let G of wU0)if(G.paths.some((W)=>X(W)))return{id:G.id,label:G.label,command:"open",args:["-a",G.appName]};return{id:"mac-open",label:"Finder",command:"open",args:[]}}if(J==="linux"&&bE("xdg-open",Z,X))return{id:"xdg-open",label:"Open",command:"xdg-open",args:[]};return null}function fU0($,Z){return[Z.command,[...Z.args,$]]}function Vs($,Z,J={}){if(!$)return!1;let X=J.spawn??AU0,[z,G]=fU0($,Z);try{let W=X(z,G,{detached:!0,stdio:"ignore"});if(W.pid===void 0)return!1;return W.unref(),!0}catch{return!1}}var EU0,wU0;var _s=a(()=>{EU0=[{id:"code",label:"VS Code",command:"code"},{id:"cursor",label:"Cursor",command:"cursor"},{id:"windsurf",label:"Windsurf",command:"windsurf"},{id:"zed",label:"Zed",command:"zed"}],wU0=[{id:"vscode.app",label:"VS Code",appName:"Visual Studio Code",paths:["/Applications/Visual Studio Code.app"]},{id:"cursor.app",label:"Cursor",appName:"Cursor",paths:["/Applications/Cursor.app","/System/Applications/Cursor.app"]},{id:"windsurf.app",label:"Windsurf",appName:"Windsurf",paths:["/Applications/Windsurf.app"]},{id:"zed.app",label:"Zed",appName:"Zed",paths:["/Applications/Zed.app"]}]});import{existsSync as Cs}from"fs";async function Ds($,Z){let J=Z.taskPath;if(!J||!Cs(J))try{J=await Z.ensureWorktree($)}catch(z){let G=z instanceof Error?z.message:String(z);Z.notifyError(`Couldn't create worktree: ${G}`);return}if(!J||!Cs(J))return;let X=js();if(!X){Z.notifyError(Z.noEditorMessage);return}if(!Vs(J,X))Z.notifyError(Z.openFailedMessage(X.label))}var As=a(()=>{_s()});function Ss($){return $.kind==="running"?Rs:gU0}function Is(){iF=null;let $=Date.now(),Z=null,J=Number.POSITIVE_INFINITY;for(let[X,z]of $X.get()){let G=z.at+Ss(z);if(G<=$)Z??=new Map($X.get()),Z.delete(X);else if(G<J)J=G}if(Z)$X.set(Z);if(J<Number.POSITIVE_INFINITY)iF=setTimeout(Is,J-$+20)}function Ps($,Z){let J=new Map($X.get());if(J.set($,{kind:Z,at:Date.now()}),$X.set(J),iF)clearTimeout(iF);iF=setTimeout(Is,Rs+20)}function Es($){if(!$X.get().has($))return;let Z=new Map($X.get());Z.delete($),$X.set(Z)}function ws($,Z){if(Z==="\r"||Z.endsWith("\r"))Ps($,"running");else if(Z==="\x1B")Ps($,"interrupted")}function xs($,Z,J=Date.now()){if(Z.size===0)return $;let X=null;for(let[z,G]of Z){if(J-G.at>Ss(G))continue;let W=$.get(z);if(W&&W.at>=G.at)continue;if(G.kind==="running"){if(W?.state==="running")continue;X??=new Map($),X.set(z,{state:"running",at:G.at})}else if(W!==void 0)X??=new Map($),X.delete(z)}return X??$}function fs($,Z){if(Z.size===0)return[];let J=[];for(let[X,z]of Z){let G=$.get(X);if(G&&G.at>=z.at)J.push(X)}return J}var Rs=5000,gU0=1800000,$X,iF=null,Ts;var kE=a(()=>{$Z();$X=r$(new Map),Ts=$X});import{randomUUID as yU0}from"crypto";function bU0($){let Z=$.body.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\r/g,"\\r").replace(/\n/g,"\\n"),J=$.startLine!==void 0&&$.startLine!==$.line?`Lines: ${$.startLine}-${$.line}`:`Line: ${$.line}`;return[`File: ${$.filePath}`,J,`User comment: "${Z}"`].join(`
|