@sma1lboy/rove 0.9.101 → 0.9.102
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 +9 -8
- package/dist/cli/kobe-run.js +9 -8
- package/dist/cli/kobe.js +1 -1
- package/dist/cli/rove-run.js +9 -8
- package/dist/cli/rove.js +1 -1
- package/package.json +1 -1
package/dist/cli/kobe-run.js
CHANGED
|
@@ -5,7 +5,7 @@ var __create=Object.create;var{getPrototypeOf:__getProtoOf,defineProperty:__defP
|
|
|
5
5
|
`).map((l)=>l.trim()).filter(Boolean)[0];if(!first)return;if(first.startsWith(`${name}:`)&&first.includes("aliased to")){let aliasTarget=first.split("aliased to")[1]?.trim();return aliasTarget&&existsSync(aliasTarget)?aliasTarget:void 0}return first},readdir(p){try{return __require("fs").readdirSync(p)}catch{return[]}}};BinaryNotFoundError=class BinaryNotFoundError extends Error{checkedPaths;constructor(label,hint,checkedPaths){super(`${label} not found. Checked: ${checkedPaths.join(", ")}. ${hint}`);this.name="BinaryNotFoundError",this.checkedPaths=checkedPaths}}});import path from"path";var ClaudeBinaryNotFoundError,findClaudeBinary;var init_binary=__esm(()=>{init_binary_discovery();ClaudeBinaryNotFoundError=class ClaudeBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("Claude Code binary","Ensure 'claude' is on PATH, or install at ~/.claude/local/claude.",checkedPaths);this.name="ClaudeBinaryNotFoundError"}};findClaudeBinary=createBinaryFinder({name:"claude",candidates({deps,home}){let out=[path.join(home,".claude","local","claude")],nvmBin=deps.env("NVM_BIN");if(nvmBin)out.push(path.join(nvmBin,"claude"));let nvmRoot=path.join(home,".nvm","versions","node"),versions=(deps.readdir?.(nvmRoot)??[]).sort((a,b)=>b.localeCompare(a,void 0,{numeric:!0}));for(let v of versions)out.push(path.join(nvmRoot,v,"bin","claude"));out.push("/opt/homebrew/bin/claude","/usr/local/bin/claude","/usr/bin/claude","/bin/claude");for(let rel of[".local/bin",".npm-global/bin",".yarn/bin",".bun/bin","bin"])out.push(path.join(home,rel,"claude"));return out},notFound:(checked)=>new ClaudeBinaryNotFoundError(checked)})});import path2 from"path";var CodexBinaryNotFoundError,findCodexBinary;var init_binary2=__esm(()=>{init_binary_discovery();CodexBinaryNotFoundError=class CodexBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("Codex CLI binary","Ensure 'codex' is on PATH (e.g. `brew install codex` or the official installer).",checkedPaths);this.name="CodexBinaryNotFoundError"}};findCodexBinary=createBinaryFinder({name:"codex",candidates({deps,home}){let out=["/opt/homebrew/bin/codex","/usr/local/bin/codex","/usr/bin/codex","/bin/codex"],nvmBin=deps.env("NVM_BIN");if(nvmBin)out.push(path2.join(nvmBin,"codex"));for(let rel of[".local/bin",".bun/bin","bin"])out.push(path2.join(home,rel,"codex"));return out},notFound:(checked)=>new CodexBinaryNotFoundError(checked)})});function registerPluginEngine(id,spec){if(Object.hasOwn(CONTRIB_ENGINES,id))return!1;return pluginEngines.set(id,spec),!0}function clearPluginEngines(){pluginEngines.clear()}function pluginEngineIds(){return[...pluginEngines.keys()]}function isContribEngine(id){return Object.hasOwn(CONTRIB_ENGINES,id)||pluginEngines.has(id)}function contribEngineEntry(id,base){let spec=CONTRIB_ENGINES[id]??pluginEngines.get(id);if(!spec)return base;return{...base,displayName:spec.displayName,defaultCommand:spec.defaultCommand,...spec.processNames?{processNames:spec.processNames}:{},screenManifest:spec.screenManifest,...spec.identity?{identity:spec.identity}:{}}}var pluginEngines,GEMINI,OPENCODE,CURSOR,GROK,DROID,AMP,CONTRIB_ENGINES,CONTRIB_ENGINE_IDS;var init_contrib_engines=__esm(()=>{pluginEngines=new Map;GEMINI={rules:[{state:"blocked",any:["\u2502 apply this change","\u2502 allow execution","waiting for user confirmation"]},{state:"blocked",all:["do you want to proceed"],any:["yes"]},{state:"working",any:["esc to cancel"]}]},OPENCODE={rules:[{state:"blocked",any:["\u25B3 permission required"]},{state:"blocked",all:["esc dismiss"],any:["enter confirm","enter submit","enter toggle"]},{state:"working",any:["esc to interrupt","ctrl+c to interrupt","esc again to interrupt"]}]},CURSOR={rules:[{state:"blocked",all:["proceed (y)"]},{state:"blocked",any:["run this command?","waiting for approval","skip (esc or n)","(y) (enter)"]},{state:"working",any:["esc to cancel","ctrl+c to stop"]}]},GROK={rules:[{state:"blocked",any:["\u26A0 action required","ctrl+o:yolo"]},{state:"blocked",all:["\u2503"],lineRegex:["^\\s*\u2503\\s+\\S+\\s+\\(\u25CB\\)"]},{state:"working",any:["[stop]"],lineRegex:["^\\s*[\\u2800-\\u28FF]"]}]},DROID={rules:[{state:"blocked",all:["enter to select","esc to cancel"],any:["> yes, allow","> no, cancel"]},{state:"blocked",all:["enter select","esc cancel"]},{state:"working",any:["esc to stop"]}]},AMP={rules:[{state:"blocked",any:["waiting for approval","run this command?","allow editing file:","allow creating file:","confirm tool call"]},{state:"working",lineRegex:["^\\s*\u2570\\s+\\S+\\s+(thinking|streaming|running tools|waiting)\\s+\u2500"]}]},CONTRIB_ENGINES={gemini:{displayName:"Gemini CLI",defaultCommand:["gemini"],screenManifest:GEMINI},opencode:{displayName:"OpenCode",defaultCommand:["opencode"],screenManifest:OPENCODE},cursor:{displayName:"Cursor Agent",defaultCommand:["cursor-agent"],screenManifest:CURSOR},grok:{displayName:"Grok CLI",defaultCommand:["grok"],screenManifest:GROK},droid:{displayName:"Droid",defaultCommand:["droid"],screenManifest:DROID},amp:{displayName:"Amp",defaultCommand:["amp"],screenManifest:AMP}};CONTRIB_ENGINE_IDS=Object.keys(CONTRIB_ENGINES)});import path3 from"path";var CopilotBinaryNotFoundError,findCopilotBinary;var init_binary3=__esm(()=>{init_binary_discovery();CopilotBinaryNotFoundError=class CopilotBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("GitHub Copilot CLI binary","Ensure 'copilot' is on PATH (for example `npm install -g @github/copilot` or `brew install copilot-cli`).",checkedPaths);this.name="CopilotBinaryNotFoundError"}};findCopilotBinary=createBinaryFinder({name:"copilot",candidates({deps,home}){let win32=(deps.platform?.()??process.platform)==="win32",names=win32?["copilot.exe","copilot.cmd","copilot"]:["copilot"],dirs=["/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin"],nvmBin=deps.env("NVM_BIN");if(nvmBin)dirs.push(nvmBin);let homeDirs=[path3.join(home,".npm-global/bin"),path3.join(home,".local/bin"),path3.join(home,".bun/bin"),path3.join(home,"bin")];if(win32){let appData=deps.env("APPDATA"),localAppData=deps.env("LOCALAPPDATA");if(homeDirs.unshift(path3.join(home,"AppData/Roaming/npm")),appData)homeDirs.unshift(path3.join(appData,"npm"));if(localAppData)homeDirs.unshift(path3.join(localAppData,"npm"))}return[...dirs,...homeDirs].flatMap((dir)=>names.map((name)=>path3.join(dir,name)))},notFound:(checked)=>new CopilotBinaryNotFoundError(checked)})});import{readFileSync as readFileSync2,statSync as statSync2}from"fs";import{readFile,stat}from"fs/promises";async function readTextFileBounded(p,maxBytes=MAX_ENGINE_FILE_BYTES){let{size}=await stat(p);if(size>maxBytes)return"";return readFile(p,"utf8")}function readTextFileSyncBounded(p,maxBytes=MAX_ENGINE_FILE_BYTES){let st;try{st=statSync2(p)}catch(err){if(err.code==="ENOENT")return null;throw err}if(st.size>maxBytes)return null;return readFileSync2(p,"utf8")}function isJsonlLineWithinBound(line,maxChars=MAX_JSONL_LINE_CHARS){return line.length<=maxChars}var MAX_ENGINE_FILE_BYTES=104857600,MAX_JSONL_LINE_CHARS=8388608;var init_file_bounds=()=>{};import path4 from"path";var KimiBinaryNotFoundError,findKimiBinary;var init_binary4=__esm(()=>{init_binary_discovery();KimiBinaryNotFoundError=class KimiBinaryNotFoundError extends BinaryNotFoundError{constructor(checkedPaths){super("Kimi Code CLI binary","Ensure 'kimi' is on PATH or installed at ~/.kimi-code/bin/kimi.",checkedPaths);this.name="KimiBinaryNotFoundError"}};findKimiBinary=createBinaryFinder({name:"kimi",candidates:({home})=>[path4.join(home,".kimi-code/bin"),path4.join(home,".local/bin"),path4.join(home,"bin"),"/opt/homebrew/bin","/usr/local/bin"].map((dir)=>path4.join(dir,"kimi")),notFound:(checked)=>new KimiBinaryNotFoundError(checked)})});import{homedir as homedir4}from"os";import path5 from"path";function vendorConfigHome(vendor,deps=defaultVendorHomeDeps){let{envVar,dirName}=VENDOR_HOMES[vendor],override=deps.env(envVar)?.trim();if(override)return override;return path5.join(deps.home(),dirName)}function depsOf(env,home){return{env,home:()=>home}}function claudeGlobalConfigPath(env,home){let override=env("CLAUDE_CONFIG_DIR")?.trim();if(override)return path5.join(override,".claude.json");return path5.join(home,".claude.json")}function codexAuthPath(env,home){return path5.join(vendorConfigHome("codex",depsOf(env,home)),"auth.json")}function copilotConfigPath(env,home){return path5.join(vendorConfigHome("copilot",depsOf(env,home)),"config.json")}function kimiCredentialsPath(env,home){return path5.join(vendorConfigHome("kimi",depsOf(env,home)),"credentials","kimi-code.json")}var VENDOR_HOMES,defaultVendorHomeDeps;var init_vendor_home=__esm(()=>{VENDOR_HOMES={claude:{envVar:"CLAUDE_CONFIG_DIR",dirName:".claude"},codex:{envVar:"CODEX_HOME",dirName:".codex"},copilot:{envVar:"COPILOT_HOME",dirName:".copilot"},kimi:{envVar:"KIMI_CODE_HOME",dirName:".kimi-code"}},defaultVendorHomeDeps={env:(name)=>process.env[name],home:()=>homedir4()}});import{homedir as homedir5}from"os";function decodeJwtPayload(jwt){let parts=jwt.split(".");if(parts.length!==3)return null;let payload=parts[1];if(!payload)return null;let b64=payload.replace(/-/g,"+").replace(/_/g,"/"),padded=b64+"=".repeat((4-b64.length%4)%4);try{let json=Buffer.from(padded,"base64").toString("utf8"),obj=JSON.parse(json);return typeof obj==="object"&&obj!==null?obj:null}catch{return null}}async function probeBinary(probe){try{return{found:!0,path:await probe()}}catch(err){if(err instanceof BinaryNotFoundError)return{found:!1,error:"not found on PATH"};return{found:!1,error:errorMessage(err)}}}async function probeAvailableVendors(deps){return(await Promise.all([["claude",()=>deps.findClaudeBinary()],["codex",()=>deps.findCodexBinary()],["copilot",()=>deps.findCopilotBinary()],["kimi",()=>deps.findKimiBinary()]].map(async([vendor,probe])=>(await probeBinary(probe)).found?vendor:null))).filter((v)=>v!==null)}function detectAvailableVendors(deps=defaultDeps){if(deps!==defaultDeps)return probeAvailableVendors(deps);if(cachedDefaultVendors)return cachedDefaultVendors;let pending=probeAvailableVendors(deps).catch((err)=>{throw cachedDefaultVendors=null,err});return cachedDefaultVendors=pending,pending}function resetAvailableVendorsCache(){cachedDefaultVendors=null,cachedContribEngines=null}async function installedEngineIds(deps=defaultDeps){let builtins=await detectAvailableVendors(deps),contrib=await detectContribEngines();return[...new Set([...builtins,...getCustomEngineIds(),...contrib])]}async function availableEngineIds(deps=defaultDeps){let disabled=new Set(getDisabledEngineIds());return(await installedEngineIds(deps)).filter((id)=>!disabled.has(id))}function detectContribEngines(){if(cachedContribEngines)return cachedContribEngines;let which=globalThis.Bun?.which;return cachedContribEngines=Promise.resolve([...which?CONTRIB_ENGINE_IDS.filter((id)=>{let bin=CONTRIB_ENGINES[id]?.defaultCommand[0];return bin?which(bin)!==null:!1}):[],...pluginEngineIds()]),cachedContribEngines}async function detectClaudeAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findClaudeBinary()),configPath=claudeGlobalConfigPath(deps.env,deps.home()),raw;try{raw=deps.readFile(configPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${configPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${configPath}: ${errorMessage(err)}`}}let oauth=parsed?.oauthAccount;if(!oauth||typeof oauth!=="object")return{binary,account:{kind:"none"}};let o=oauth,email=typeof o.emailAddress==="string"?o.emailAddress:void 0;if(!email)return{binary,account:{kind:"none"}};return{binary,account:{kind:"oauth",email,organization:typeof o.organizationName==="string"?o.organizationName:void 0,displayName:typeof o.displayName==="string"?o.displayName:void 0,billingType:typeof o.billingType==="string"?o.billingType:void 0}}}async function detectCodexAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findCodexBinary()),authPath=codexAuthPath(deps.env,deps.home()),raw;try{raw=deps.readFile(authPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${authPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${authPath}: ${errorMessage(err)}`}}let obj=parsed??{},tokens=obj.tokens,idToken=typeof tokens?.id_token==="string"?tokens.id_token:void 0;if(idToken){let payload=decodeJwtPayload(idToken);if(!payload)return{binary,account:{kind:"none"},accountError:"codex id_token: malformed JWT"};let email=typeof payload.email==="string"?payload.email:void 0,authClaimRaw=payload["https://api.openai.com/auth"],authClaim=typeof authClaimRaw==="object"&&authClaimRaw!==null&&!Array.isArray(authClaimRaw)?authClaimRaw:void 0,plan=typeof authClaim?.chatgpt_plan_type==="string"?authClaim.chatgpt_plan_type:void 0;if(email)return{binary,account:{kind:"chatgpt",email,plan}};return{binary,account:{kind:"none"},accountError:"codex id_token: no email claim"}}let apiKey=obj.OPENAI_API_KEY;if(typeof apiKey==="string"&&apiKey.length>0)return{binary,account:{kind:"apikey"}};return{binary,account:{kind:"none"}}}async function detectCopilotAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findCopilotBinary());for(let source of["COPILOT_GITHUB_TOKEN","GH_TOKEN","GITHUB_TOKEN"])if(deps.env(source)?.trim())return{binary,account:{kind:"token",source}};let configPath=copilotConfigPath(deps.env,deps.home()),raw;try{raw=deps.readFile(configPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${configPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${configPath}: ${errorMessage(err)}`}}if(!isRecord(parsed))return{binary,account:{kind:"none"}};if(hasStringDeep(parsed,["github_token","oauth_token","access_token","token","selectedUser","currentUser","user"]))return{binary,account:{kind:"oauth"}};return{binary,account:{kind:"none"}}}async function detectKimiAccount(deps=defaultDeps){let binary=await probeBinary(()=>deps.findKimiBinary()),credPath=kimiCredentialsPath(deps.env,deps.home()),raw;try{raw=deps.readFile(credPath)}catch(err){return{binary,account:{kind:"none"},accountError:`read ${credPath}: ${errorMessage(err)}`}}if(raw===null)return{binary,account:{kind:"none"}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{binary,account:{kind:"none"},accountError:`parse ${credPath}: ${errorMessage(err)}`}}if(!isRecord(parsed))return{binary,account:{kind:"none"}};let token=parsed.access_token;if(typeof token==="string"&&token.length>0)return{binary,account:{kind:"oauth"}};return{binary,account:{kind:"none"}}}function isRecord(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function hasStringDeep(value,interestingKeys,depth=0){if(depth>4||!isRecord(value))return!1;for(let[key,entry]of Object.entries(value)){if(interestingKeys.includes(key)&&typeof entry==="string"&&entry.length>0)return!0;if(isRecord(entry)&&hasStringDeep(entry,interestingKeys,depth+1))return!0}return!1}var defaultDeps,cachedDefaultVendors=null,cachedContribEngines=null;var init_account_detect=__esm(()=>{init_repos();init_binary_discovery();init_binary();init_binary2();init_contrib_engines();init_binary3();init_file_bounds();init_binary4();init_vendor_home();defaultDeps={readFile(p){return readTextFileSyncBounded(p)},env(name){return process.env[name]},home(){return homedir5()},findClaudeBinary(){return findClaudeBinary()},findCodexBinary(){return findCodexBinary()},findCopilotBinary(){return findCopilotBinary()},findKimiBinary(){return findKimiBinary()}}});var claudeCapabilities,claudeIdentity;var init_capabilities=__esm(()=>{claudeCapabilities={},claudeIdentity={vendorId:"claude",shortName:"Claude"}});import{fileURLToPath}from"url";function roveCliInvocation(){let cliName=activeCliName();if(import.meta.url.endsWith(".js"))return[cliName];let entry=fileURLToPath(new URL(`./${cliName===ROVE_PRODUCT_NAME?"rove.ts":"kobe.ts"}`,import.meta.url));return[process.execPath,"--conditions=browser",entry]}function kobeHookInvocation(){if(import.meta.url.endsWith(".js"))return[LEGACY_KOBE_PRODUCT_NAME];if(Bun.which(LEGACY_KOBE_PRODUCT_NAME))return[LEGACY_KOBE_PRODUCT_NAME];return roveCliInvocation()}var init_invocation=__esm(()=>{init_product();init_rename_compat()});function quoteShellArg(value,opts={}){if(opts.bareSafe&&SAFE_BARE_TOKEN.test(value))return value;return`'${value.replace(/'/g,"'\\''")}'`}function quoteShellArgv(argv,opts={}){return argv.map((arg)=>quoteShellArg(arg,opts)).join(" ")}var SAFE_BARE_TOKEN;var init_shell_command=__esm(()=>{SAFE_BARE_TOKEN=/^[A-Za-z0-9_/.:=-]+$/});function isObject(v){return!!v&&typeof v==="object"&&!Array.isArray(v)}function activityMarkers(eventMap){return eventMap.flatMap((e)=>[quoteShellArgv(["hook",e.verb]),`hook ${e.verb}`])}function isKobeActivityGroup(group,markers){if(!isObject(group)||!Array.isArray(group.hooks))return!1;return group.hooks.some((h)=>isObject(h)&&typeof h.command==="string"&&markers.some((m)=>h.command.includes(m)))}function hasKobeActivityHooks(current,eventMap){let markers=activityMarkers(eventMap),hooks=isObject(current.hooks)?current.hooks:{};return Object.values(hooks).some((groups)=>Array.isArray(groups)&&groups.some((g)=>isKobeActivityGroup(g,markers)))}function buildActivityHooks(eventMap,inv=kobeHookInvocation(),opts={}){let out={};for(let spec of eventMap){if(opts.buildFilter&&!opts.buildFilter(spec))continue;let{event,matcher,verb}=spec,group={hooks:[{type:"command",command:quoteShellArgv([...inv,"hook",verb,...opts.extraArgs??[]])}]};if(matcher)group.matcher=matcher;let groups=out[event]??[];groups.push(group),out[event]=groups}return out}function mergeActivityHooks(current,install,eventMap,inv=kobeHookInvocation(),opts={}){let markers=activityMarkers(eventMap),{hooks:rawHooks,...restSettings}=current,hooks=isObject(rawHooks)?{...rawHooks}:{},built=install?buildActivityHooks(eventMap,inv,opts):{};for(let{event}of eventMap){let kept=(Array.isArray(hooks[event])?hooks[event]:[]).filter((g)=>!isKobeActivityGroup(g,markers));if(install&&Array.isArray(built[event]))kept.push(...built[event]);if(kept.length>0)hooks[event]=kept;else delete hooks[event]}return Object.keys(hooks).length>0?{...restSettings,hooks}:{...restSettings}}function isRetiredWatchGroup(group){if(!isObject(group)||!Array.isArray(group.hooks))return!1;return group.hooks.some((h)=>isObject(h)&&typeof h.command==="string"&&h.command.includes(WORKTREE_WATCH_MARKER))}function removeWorktreeWatchHook(current){let{hooks:rawHooks,...restSettings}=current,hooks=isObject(rawHooks)?{...rawHooks}:{},kept=(Array.isArray(hooks[RETIRED_WATCH_EVENT])?hooks[RETIRED_WATCH_EVENT]:[]).filter((g)=>!isRetiredWatchGroup(g));if(kept.length>0)hooks[RETIRED_WATCH_EVENT]=kept;else delete hooks[RETIRED_WATCH_EVENT];return Object.keys(hooks).length>0?{...restSettings,hooks}:{...restSettings}}var GATED_TOOL_VERBS,RETIRED_WATCH_EVENT="PostToolUse",WORKTREE_WATCH_MARKER="worktree-created";var init_json_hooks=__esm(()=>{init_invocation();init_shell_command();GATED_TOOL_VERBS=new Set(["tool-pre","tool-post","tool-failed"])});import{randomBytes}from"crypto";import{linkSync as linkSync2,mkdirSync as mkdirSync3,readFileSync as readFileSync3,unlinkSync as unlinkSync2,writeFileSync as writeFileSync3}from"fs";import{link,mkdir,readFile as readFile2,unlink,writeFile}from"fs/promises";import{dirname as dirname3}from"path";function isProcessAlive(pid){if(!Number.isInteger(pid)||pid<=0)return!1;try{return process.kill(pid,0),!0}catch(err){if(err.code==="ESRCH")return!1;return!0}}async function acquire(lockPath,opts={}){await mkdir(dirname3(lockPath),{recursive:!0});let token=`${process.pid}:${randomBytes(8).toString("hex")}`,sidecar=`${lockPath}.${token.replace(":","-")}`;for(;;){await writeFile(sidecar,token);try{return await link(sidecar,lockPath),token}catch(err){if(err.code!=="EEXIST")throw err}finally{await unlink(sidecar).catch(()=>{})}let holder;try{holder=(await readFile2(lockPath,"utf8")).trim()}catch(err){if(err.code!=="ENOENT")throw err;continue}let holderPid=Number.parseInt(holder,10),alive=Number.isFinite(holderPid)&&holderPid>0&&isProcessAlive(holderPid);if(alive&&!opts.forceTakeover)throw new LockfileError(`task index is locked by another Rove instance (pid ${holderPid})`,holderPid);console.warn(`[rove] removing stale lockfile at ${lockPath} (was held by pid ${holderPid}${alive?", forced":", process gone"})`);try{await unlink(lockPath)}catch(err){if(err.code!=="ENOENT")throw err}}}async function release(lockPath,token){let current;try{current=(await readFile2(lockPath,"utf8")).trim()}catch(err){if(err.code==="ENOENT")return;throw err}if(current!==token)return;try{await unlink(lockPath)}catch(err){if(err.code==="ENOENT")return;throw err}}function sleepSync(ms){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,ms)}function acquireSync(lockPath,timeoutMs=5000){mkdirSync3(dirname3(lockPath),{recursive:!0});let token=`${process.pid}:${randomBytes(8).toString("hex")}`,sidecar=`${lockPath}.${token.replace(":","-")}`,deadline=Date.now()+timeoutMs;for(;;){writeFileSync3(sidecar,token);try{return linkSync2(sidecar,lockPath),token}catch(err){if(err.code!=="EEXIST")throw err}finally{try{unlinkSync2(sidecar)}catch{}}let holder;try{holder=readFileSync3(lockPath,"utf8").trim()}catch(err){if(err.code!=="ENOENT")throw err;continue}let holderPid=Number.parseInt(holder,10);if(Number.isFinite(holderPid)&&holderPid>0&&isProcessAlive(holderPid)){if(Date.now()>=deadline)throw new LockfileError(`${lockPath} is locked by another Rove instance (pid ${holderPid})`,holderPid);sleepSync(25);continue}console.warn(`[rove] removing stale lockfile at ${lockPath} (was held by pid ${holderPid}, process gone)`);try{unlinkSync2(lockPath)}catch(err){if(err.code!=="ENOENT")throw err}}}function releaseSync(lockPath,token){try{if(readFileSync3(lockPath,"utf8").trim()!==token)return;unlinkSync2(lockPath)}catch(err){if(err.code!=="ENOENT")throw err}}var LockfileError;var init_lockfile=__esm(()=>{LockfileError=class LockfileError extends Error{heldByPid;constructor(message,heldByPid){super(message);this.name="LockfileError",this.heldByPid=heldByPid}}});import{existsSync as existsSync2,renameSync as renameSync3,statSync as statSync3}from"fs";function shouldRotateLog(sizeBytes,capBytes=DEFAULT_LOG_ROTATE_CAP_BYTES){return sizeBytes>capBytes}function rotateLogIfNeeded(path6,capBytes=DEFAULT_LOG_ROTATE_CAP_BYTES){try{if(!existsSync2(path6))return;let{size}=statSync3(path6);if(!shouldRotateLog(size,capBytes))return;renameSync3(path6,`${path6}.old`)}catch{}}var DEFAULT_LOG_ROTATE_CAP_BYTES=10485760;var init_log_rotate=()=>{};var exports_paths={};__export(exports_paths,{windowsPipePath:()=>windowsPipePath,shortHomeTag:()=>shortHomeTag,resolveDaemonHomeDir:()=>resolveDaemonHomeDir,legacyRuntimePath:()=>legacyRuntimePath,legacyPtyHostSocketPath:()=>legacyPtyHostSocketPath,legacyPtyHostPidPath:()=>legacyPtyHostPidPath,legacyDaemonSocketPath:()=>legacyDaemonSocketPath,legacyDaemonPidPath:()=>legacyDaemonPidPath,isWindowsPipePath:()=>isWindowsPipePath,fitSocketPath:()=>fitSocketPath,defaultWebTokenPath:()=>defaultWebTokenPath,defaultPtyHostSocketPath:()=>defaultPtyHostSocketPath,defaultPtyHostPidPath:()=>defaultPtyHostPidPath,defaultPtyHostLogPath:()=>defaultPtyHostLogPath,defaultPtyFreezeDir:()=>defaultPtyFreezeDir,defaultPtyExitsPath:()=>defaultPtyExitsPath,defaultDaemonSocketPath:()=>defaultDaemonSocketPath,defaultDaemonPidPath:()=>defaultDaemonPidPath,defaultDaemonLogPath:()=>defaultDaemonLogPath,defaultClientLogPath:()=>defaultClientLogPath,DEFAULT_DAEMON_WEB_PORT:()=>DEFAULT_DAEMON_WEB_PORT});import{createHash as createHash2}from"crypto";import{existsSync as existsSync3,readFileSync as readFileSync4}from"fs";import{homedir as homedir6,tmpdir as tmpdir2}from"os";import{join as join5}from"path";function stateDirs(homeDir2){return{canonical:join5(homeDir2,ROVE_STATE_DIR_BASENAME),legacy:join5(homeDir2,COMPAT_STATE_DIR_BASENAME)}}function pidIsLive(pidPath){try{let pid=Number.parseInt(readFileSync4(pidPath,"utf8").trim(),10);if(!Number.isInteger(pid)||pid<=1)return!1;return process.kill(pid,0),!0}catch{return!1}}function runtimePath(homeDir2,name,pidName){let{canonical,legacy}=stateDirs(homeDir2),canonicalPath=join5(canonical,name);if(existsSync3(canonicalPath))return canonicalPath;let legacyPath=join5(legacy,name);if(existsSync3(legacyPath)&&pidIsLive(join5(legacy,pidName)))return legacyPath;return canonicalPath}function legacyRuntimePath(homeDir2,name){return join5(homeDir2,COMPAT_STATE_DIR_BASENAME,name)}function legacyDaemonSocketPath(homeDir2){return legacyRuntimePath(homeDir2,"daemon.sock")}function legacyDaemonPidPath(homeDir2){return legacyRuntimePath(homeDir2,"daemon.pid")}function legacyPtyHostSocketPath(homeDir2){return legacyRuntimePath(homeDir2,"pty.sock")}function legacyPtyHostPidPath(homeDir2){return legacyRuntimePath(homeDir2,"pty.pid")}function runtimeDataPath(homeDir2,name){let{canonical,legacy}=stateDirs(homeDir2),canonicalPath=join5(canonical,name);if(existsSync3(canonicalPath))return canonicalPath;let legacyPath=join5(legacy,name);return existsSync3(legacyPath)?legacyPath:canonicalPath}function shortHomeTag(homeDir2){return createHash2("sha1").update(homeDir2).digest("hex").slice(0,8)}function fitSocketPath(naturalPath,homeDir2,role,pidTag){if(Buffer.byteLength(naturalPath,"utf8")<=SOCKET_PATH_SAFETY_LIMIT)return naturalPath;let tag=shortHomeTag(homeDir2),suffix=pidTag===void 0?"":`-${pidTag}`,fallback=join5(tmpdir2(),`kobe-${tag}-${role}${suffix}.sock`);if(Buffer.byteLength(fallback,"utf8")<=SOCKET_PATH_SAFETY_LIMIT)return fallback;throw Error(`daemon socket path exceeds ${SOCKET_PATH_SAFETY_LIMIT} bytes even after fallback: ${fallback}`)}function defaultDaemonSocketPath(homeDir2){let override=readRoveEnv("DAEMON_SOCKET_PATH");if(override&&override.length>0)return override;let explicit=homeDir2??readRoveEnv("HOME_DIR");if(explicit&&explicit.length>0)return fitSocketPath(runtimePath(explicit,"daemon.sock","daemon.pid"),explicit,"daemon");let runtimeDir=process.env.XDG_RUNTIME_DIR;if(runtimeDir&&runtimeDir.length>0)return fitSocketPath(join5(runtimeDir,"kobe.sock"),runtimeDir,"daemon");let home=homedir6();return fitSocketPath(runtimePath(home,"daemon.sock","daemon.pid"),home,"daemon")}function resolveDaemonHomeDir(homeDir2){let explicit=homeDir2??readRoveEnv("HOME_DIR");return explicit&&explicit.length>0?explicit:homedir6()}function defaultDaemonPidPath(homeDir2=readRoveEnv("HOME_DIR")??homedir6()){let override=readRoveEnv("DAEMON_PID_PATH");if(override&&override.length>0)return override;return runtimePath(homeDir2,"daemon.pid","daemon.pid")}function defaultDaemonLogPath(homeDir2=readRoveEnv("HOME_DIR")??homedir6()){return join5(homeDir2,ROVE_STATE_DIR_BASENAME,"daemon.log")}function defaultClientLogPath(homeDir2=readRoveEnv("HOME_DIR")??homedir6()){return join5(homeDir2,ROVE_STATE_DIR_BASENAME,"client.log")}function isWindowsPipePath(path6){return path6.startsWith("\\\\.\\pipe\\")||path6.startsWith("//./pipe/")}function windowsPipePath(homeDir2,role){return`\\\\.\\pipe\\kobe-${shortHomeTag(homeDir2)}-${role}`}function defaultPtyHostSocketPath(homeDir2,platform=process.platform){let override=readRoveEnv("PTY_SOCKET_PATH");if(override&&override.length>0)return override;let explicit=homeDir2??readRoveEnv("HOME_DIR");if(platform==="win32")return windowsPipePath(explicit||homedir6(),"pty");if(explicit&&explicit.length>0)return fitSocketPath(runtimePath(explicit,"pty.sock","pty.pid"),explicit,"pty");let runtimeDir=process.env.XDG_RUNTIME_DIR;if(runtimeDir&&runtimeDir.length>0)return fitSocketPath(join5(runtimeDir,"kobe-pty.sock"),runtimeDir,"pty");let home=homedir6();return fitSocketPath(runtimePath(home,"pty.sock","pty.pid"),home,"pty")}function defaultPtyHostPidPath(homeDir2=readRoveEnv("HOME_DIR")??homedir6()){let override=readRoveEnv("PTY_PID_PATH");if(override&&override.length>0)return override;return runtimePath(homeDir2,"pty.pid","pty.pid")}function defaultPtyHostLogPath(homeDir2=readRoveEnv("HOME_DIR")??homedir6()){return join5(homeDir2,ROVE_STATE_DIR_BASENAME,"pty.log")}function defaultPtyExitsPath(homeDir2=readRoveEnv("HOME_DIR")??homedir6()){return runtimeDataPath(homeDir2,"pty-exits.json")}function defaultWebTokenPath(homeDir2=readRoveEnv("HOME_DIR")??homedir6()){return runtimeDataPath(homeDir2,"web-token")}function defaultPtyFreezeDir(homeDir2=readRoveEnv("HOME_DIR")??homedir6()){return runtimeDataPath(homeDir2,"pty-sessions")}var SOCKET_PATH_SAFETY_LIMIT=100,DEFAULT_DAEMON_WEB_PORT=45174;var init_paths=()=>{};import{appendFile,mkdir as mkdir2,rename,stat as stat2}from"fs/promises";import{dirname as dirname4}from"path";function setClientLogContext(ctx){context=ctx}function coerceError(err){if(err instanceof Error)return{message:err.message,stack:err.stack};let text;try{text=typeof err==="string"?err:JSON.stringify(err)}catch{text=String(err)}return{message:text}}function formatClientEntry(subsystem,message,now=new Date){return`[${now.toISOString()}] client ${context} [${subsystem}] pid=${process.pid}: ${message}
|
|
6
6
|
`}function warnOnce(){if(warnedOnce)return;warnedOnce=!0;try{process.stderr.write(`[rove] client log write failed; continuing without it
|
|
7
7
|
`)}catch{}}async function rotateClientLogIfNeeded(path6){try{let{size}=await stat2(path6);if(!shouldRotateLog(size,DEFAULT_LOG_ROTATE_CAP_BYTES))return;await rename(path6,`${path6}.old`)}catch{}}function append(line,logPath){let path6=logPath??defaultClientLogPath();writeChain=writeChain.then(async()=>{await rotateClientLogIfNeeded(path6);try{await appendFile(path6,line)}catch(err){if(err?.code==="ENOENT")await mkdir2(dirname4(path6),{recursive:!0}),await appendFile(path6,line);else throw err}}).catch(()=>warnOnce())}function logClient(subsystem,message,logPath){append(formatClientEntry(subsystem,message),logPath)}function logClientError(subsystem,err){let e=coerceError(err);append(formatClientEntry(subsystem,e.stack??e.message))}function installClientCrashHandlers(){if(onRejection||onException)return;onRejection=(reason)=>logClientError("crash-net",reason),onException=(err)=>logClientError("crash-net",err),process.on("unhandledRejection",onRejection),process.on("uncaughtException",onException)}var context="client",warnedOnce=!1,writeChain,onRejection,onException;var init_client_log=__esm(()=>{init_log_rotate();init_paths();writeChain=Promise.resolve()});function isTaskStatus(value){return typeof value==="string"&&TASK_STATUSES.includes(value)}var toTaskId=(id)=>id,DEFAULT_TASK_VENDOR="claude",TASK_STATUSES;var init_task=__esm(()=>{TASK_STATUSES=["backlog","in_progress","in_review","done","canceled","error"]});import{copyFile,readFile as readFile3}from"fs/promises";import{dirname as dirname5}from"path";async function acquireWithRetry(lockPath){let deadline=Date.now()+LOCK_MAX_WAIT_MS;for(;;)try{return await acquire(lockPath)}catch(err){if(!(err instanceof LockfileError)||Date.now()>=deadline)throw err;await sleep(LOCK_RETRY_DELAY_MS)}}async function backupCorruptManifest(path6,now=()=>new Date){let backupPath=`${path6}.corrupt-${now().toISOString().replaceAll(":","-")}`;try{return await copyFile(path6,backupPath),backupPath}catch{return null}}function warnManifestRecovery(message,manifestPath){console.warn(message),logClient("tasks-index",message,manifestPath?defaultClientLogPath(dirname5(dirname5(manifestPath))):void 0)}async function recoverUnsupportedVersion(parsed,sourcePath){if(!parsed||typeof parsed!=="object"||Array.isArray(parsed))return!1;let version=parsed.version;if(version===void 0||SUPPORTED_VERSIONS.has(version))return!1;let backup=await backupCorruptManifest(sourcePath);return warnManifestRecovery(`[rove] tasks.json at ${sourcePath} has unsupported version=${String(version)}; recovering with empty index.${backup?` Original bytes backed up to ${backup}.`:" Backup copy failed; the stale file is left in place."}`,sourcePath),!0}function normalizeIndex(parsed,source){if(!parsed||typeof parsed!=="object"||Array.isArray(parsed))return warnManifestRecovery(`[rove] tasks.json at ${source} is not an object; recovering with empty index.`,source),{version:CURRENT_VERSION,tasks:[]};let obj=parsed,version=obj.version;if(version!==void 0&&!SUPPORTED_VERSIONS.has(version))return warnManifestRecovery(`[rove] tasks.json at ${source} has unsupported version=${String(version)}; recovering with empty index.`,source),{version:CURRENT_VERSION,tasks:[]};let rawTasks=Array.isArray(obj.tasks)?obj.tasks:[],tasks=[];for(let entry of rawTasks){let task=coerceTask(entry);if(task)tasks.push(task);else console.warn(`[rove] dropping malformed task entry from ${source}: ${JSON.stringify(entry)}`)}return{version:CURRENT_VERSION,tasks}}async function readDiskIndex(path6,legacyPath){let raw,sourcePath=path6;try{raw=await readFile3(sourcePath,"utf8")}catch(err){if(err.code!=="ENOENT")throw err;sourcePath=legacyPath;try{raw=await readFile3(sourcePath,"utf8")}catch(legacyErr){if(legacyErr.code==="ENOENT")return{tasks:[],removed:[]};throw legacyErr}}let parsed;try{parsed=JSON.parse(raw)}catch{return await backupCorruptManifest(sourcePath),{tasks:[],removed:[]}}if(await recoverUnsupportedVersion(parsed,sourcePath))return{tasks:[],removed:[]};return{tasks:normalizeIndex(parsed,sourcePath).tasks,removed:coerceTombstones(parsed)}}function coerceTombstones(parsed){if(!parsed||typeof parsed!=="object"||Array.isArray(parsed))return[];let raw=parsed.removed;if(!Array.isArray(raw))return[];let out=[];for(let entry of raw){if(!entry||typeof entry!=="object")continue;let v=entry;if(typeof v.id==="string"&&v.id.length>0&&typeof v.at==="string")out.push({id:v.id,at:v.at})}return out}function mergeTasksWithDisk(cacheTasks,diskTasks,dirty,removed,diskRemoved=[],now=Date.now()){let tombstones=new Map;for(let t of diskRemoved){let at=Date.parse(t.at);if(!Number.isFinite(at)||now-at>TOMBSTONE_TTL_MS)continue;tombstones.set(t.id,t.at)}for(let[id,at]of removed)tombstones.set(id,at);let diskById=new Map(diskTasks.map((t)=>[t.id,t])),result=[],included=new Set;for(let task of cacheTasks){if(tombstones.has(task.id))continue;if(dirty.has(task.id))result.push(task);else{let onDisk=diskById.get(task.id);if(onDisk===void 0)continue;result.push(onDisk)}included.add(task.id)}for(let task of diskTasks){if(included.has(task.id)||tombstones.has(task.id))continue;result.push(task),included.add(task.id)}return{tasks:result,removed:[...tombstones].map(([id,at])=>({id,at}))}}function coerceTask(value){if(!value||typeof value!=="object")return null;let v=value;if(typeof v.id!=="string"||typeof v.title!=="string"||typeof v.repo!=="string"||typeof v.branch!=="string"||typeof v.worktreePath!=="string"||typeof v.status!=="string"||typeof v.createdAt!=="string"||typeof v.updatedAt!=="string")return null;if(!isTaskStatus2(v.status))return null;let kind=v.kind==="main"?"main":v.kind==="dir"?"dir":"task",scratch=kind==="dir"&&v.scratch===!0,healedStatus=kind==="main"&&(v.status==="in_progress"||v.status==="done")?"backlog":v.status,deletion=coerceDeletion(v.deletion),quotaResume=coerceQuotaResume(v.quotaResume),linkedWorkItem=coerceLinkedWorkItem(v.linkedWorkItem),dispatcher=coerceDispatcher(v.dispatcher),routine=coerceRoutine(v.routine);return{id:toTaskId(v.id),title:v.title,repo:v.repo,branch:v.branch,worktreePath:v.worktreePath,status:healedStatus,pinned:typeof v.pinned==="boolean"?v.pinned:!1,kind,...scratch?{scratch:!0}:{},...routine?{routine}:{},vendor:coerceVendorId(typeof v.vendor==="string"?v.vendor:void 0),...typeof v.command==="string"&&v.command.trim().length>0?{command:v.command}:{},prStatus:coercePRStatus(v.prStatus),...typeof v.modelEffort==="string"&&v.modelEffort.length>0?{modelEffort:v.modelEffort}:{},...typeof v.groupId==="string"&&v.groupId.length>0?{groupId:v.groupId}:{},...v.observedLanguage==="zh"||v.observedLanguage==="en"?{observedLanguage:v.observedLanguage}:{},...deletion?{deletion}:{},...quotaResume?{quotaResume}:{},...linkedWorkItem?{linkedWorkItem}:{},...dispatcher?{dispatcher}:{},...typeof v.prompt==="string"&&v.prompt.length>0?{prompt:v.prompt}:{},...typeof v.baseRef==="string"&&v.baseRef.trim().length>0?{baseRef:v.baseRef}:{},createdAt:v.createdAt,updatedAt:v.updatedAt}}function coerceDispatcher(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.taskId!=="string"||v.taskId.length===0)return;if(typeof v.tabId!=="string"||v.tabId.length===0)return;return{taskId:v.taskId,tabId:v.tabId}}function coerceRoutine(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.automationId!=="string"||v.automationId.length===0)return;return{automationId:v.automationId}}function coerceQuotaResume(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(typeof v.resumeAt!=="string"||v.resumeAt.length===0)return;if(typeof v.requestedAt!=="string"||v.requestedAt.length===0)return;return{resumeAt:v.resumeAt,requestedAt:v.requestedAt}}function coerceLinkedWorkItem(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(v.provider!=="github")return;if(v.type!=="issue"&&v.type!=="pr")return;if(typeof v.number!=="number"||!Number.isFinite(v.number))return;if(typeof v.title!=="string"||typeof v.url!=="string"||v.url.length===0)return;return{provider:v.provider,type:v.type,number:v.number,title:v.title,url:v.url}}function coerceDeletion(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(v.phase!=="queued"&&v.phase!=="running"&&v.phase!=="error"||typeof v.force!=="boolean"||typeof v.requestedAt!=="string"||v.requestedAt.length===0||v.error!==void 0&&typeof v.error!=="string")return;return{phase:v.phase,force:v.force,...typeof v.deleteBranch==="boolean"?{deleteBranch:v.deleteBranch}:{},requestedAt:v.requestedAt,...typeof v.error==="string"?{error:v.error}:{}}}function coercePRStatus(value){if(!value||typeof value!=="object"||Array.isArray(value))return;let v=value;if(!isPRProviderId(v.provider)||!isPRLifecycleState(v.lifecycle)||!isPRCheckState(v.checkState))return;return{provider:v.provider,lifecycle:v.lifecycle,checkState:v.checkState,...typeof v.number==="number"&&Number.isFinite(v.number)?{number:v.number}:{},...typeof v.url==="string"?{url:v.url}:{},...typeof v.title==="string"?{title:v.title}:{},...typeof v.baseRef==="string"?{baseRef:v.baseRef}:{},...typeof v.headRef==="string"?{headRef:v.headRef}:{},...typeof v.reviewDecision==="string"?{reviewDecision:v.reviewDecision}:{},...typeof v.mergeable==="string"?{mergeable:v.mergeable}:{},...typeof v.lastCheckedAt==="string"?{lastCheckedAt:v.lastCheckedAt}:{},...typeof v.lastError==="string"?{lastError:v.lastError}:{}}}function isPRProviderId(v){return v==="github"||v==="gitlab"||v==="bitbucket"||v==="unknown"}function isPRLifecycleState(v){return v==="creating"||v==="open"||v==="ready_to_merge"||v==="merged"||v==="closed"||v==="unknown"}function isPRCheckState(v){return v==="none"||v==="pending"||v==="passing"||v==="failing"||v==="unknown"}function isTaskStatus2(s){return s==="backlog"||s==="in_progress"||s==="in_review"||s==="done"||s==="canceled"||s==="error"}var sleep=(ms)=>new Promise((resolve2)=>setTimeout(resolve2,ms)),LOCK_RETRY_DELAY_MS=25,LOCK_MAX_WAIT_MS=5000,CURRENT_VERSION=3,SUPPORTED_VERSIONS,TOMBSTONE_TTL_MS=2592000000;var init_store_codec=__esm(()=>{init_client_log();init_paths();init_task();init_vendor();init_lockfile();SUPPORTED_VERSIONS=new Set([1,2,3])});import{createHash as createHash3,randomBytes as randomBytes2}from"crypto";import{mkdirSync as mkdirSync4,readFileSync as readFileSync5,renameSync as renameSync4,unlinkSync as unlinkSync3,writeFileSync as writeFileSync4}from"fs";import{mkdir as mkdir3,readFile as readFile4,rename as rename2,unlink as unlink2,writeFile as writeFile2}from"fs/promises";import{dirname as dirname6,join as join6}from"path";function stagingPath(file){return`${file}.rove-${process.pid}-${randomBytes2(6).toString("hex")}.tmp`}function sharedConfigLockPath(file){return join6(roveStateDir(),`shared-config-${createHash3("sha256").update(file).digest("hex").slice(0,16)}.lock`)}function readRawSync(file){try{return readFileSync5(file,"utf8")}catch(err){if(err.code==="ENOENT")return;throw err}}async function readRaw(file){try{return await readFile4(file,"utf8")}catch(err){if(err.code==="ENOENT")return;throw err}}function updateSharedJsonSync(file,load,build){let lockPath=sharedConfigLockPath(file),lockToken=acquireSync(lockPath);try{for(let attempt=0;attempt<MAX_ATTEMPTS;attempt++){let before=readRawSync(file),doc=load(before);if(!doc)return;let text=build(doc);if(text===void 0)return;let tmp=stagingPath(file);try{if(mkdirSync4(dirname6(file),{recursive:!0}),writeFileSync4(tmp,text),readRawSync(file)===before){renameSync4(tmp,file);return}}finally{try{unlinkSync3(tmp)}catch{}}}throw Error(`gave up updating ${file} after ${MAX_ATTEMPTS} concurrent writes`)}finally{releaseSync(lockPath,lockToken)}}async function updateSharedJson(file,load,build){let lockPath=sharedConfigLockPath(file),lockToken=await acquireWithRetry(lockPath);try{for(let attempt=0;attempt<MAX_ATTEMPTS;attempt++){let before=await readRaw(file),doc=load(before);if(!doc)return;let text=build(doc);if(text===void 0)return;let tmp=stagingPath(file);try{if(await mkdir3(dirname6(file),{recursive:!0}),await writeFile2(tmp,text),await readRaw(file)===before){await rename2(tmp,file);return}}finally{await unlink2(tmp).catch(()=>{})}}throw Error(`gave up updating ${file} after ${MAX_ATTEMPTS} concurrent writes`)}finally{await release(lockPath,lockToken)}}var MAX_ATTEMPTS=5;var init_shared_config_write=__esm(()=>{init_env();init_lockfile();init_store_codec()});async function editJsonSettings(settingsFilePath,transform){try{await updateSharedJson(settingsFilePath,(raw)=>{if(raw===void 0)return{};try{let parsed=JSON.parse(raw);return isObject(parsed)?parsed:void 0}catch{return}},(current)=>{let next=transform(current),json=JSON.stringify(next,null,2);return json===JSON.stringify(current,null,2)?void 0:`${json}
|
|
8
|
-
`})}catch{}}class JsonHookAdapter{supportsHooks(){return!0}activityDetailFromPayload(_kind,_payload){return}sessionFromPayload(_payload){return}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(_settingsFilePath){}gatedVerbs(){return GATED_TOOL_VERBS}async installActivityHooks(settingsFilePath,opts={}){let gated=this.gatedVerbs();await editJsonSettings(settingsFilePath,(cur)=>mergeActivityHooks(cur,!0,this.eventMap,void 0,{extraArgs:["--engine",this.vendor],buildFilter:(spec)=>opts.toolEvents===!0||!gated.has(spec.verb)}))}async removeActivityHooks(settingsFilePath){await editJsonSettings(settingsFilePath,(cur)=>mergeActivityHooks(cur,!1,this.eventMap))}async removeWorktreeWatchHook(settingsFilePath){await editJsonSettings(settingsFilePath,removeWorktreeWatchHook)}}var init_json_hook_adapter=__esm(()=>{init_json_hooks();init_shared_config_write()});import{homedir as homedir7}from"os";import{join as join7}from"path";function failureFromErrorType(errorType){if(typeof errorType!=="string")return"other";if(errorType==="rate_limit"||errorType==="overloaded")return"rate_limit";if(errorType==="billing_error")return"billing";return"other"}function claudeSettingsPath(){return join7(homedir7(),".claude","settings.json")}function isKobeWorktreeSyncGroup(group){if(!isObject(group)||!Array.isArray(group.hooks))return!1;return group.hooks.some((h)=>isObject(h)&&typeof h.command==="string"&&h.command.includes(WORKTREE_SYNC_MARKER))}function mergeWorktreeSyncHook(current,command){let{hooks:rawHooks,...restSettings}=current,{WorktreeCreate,...otherHooks}=isObject(rawHooks)?rawHooks:{},kept=(Array.isArray(WorktreeCreate)?WorktreeCreate:[]).filter((g)=>!isKobeWorktreeSyncGroup(g));if(command!==null)kept.push({hooks:[{type:"command",command}]});let nextHooks={...otherHooks};if(kept.length>0)nextHooks.WorktreeCreate=kept;return Object.keys(nextHooks).length>0?{...restSettings,hooks:nextHooks}:{...restSettings}}var CLAUDE_HOOK_EVENT_MAP,KOBE_HOOK_EVENTS,WORKTREE_SYNC_MARKER="worktree-created",ClaudeHookAdapter;var init_hook_adapter=__esm(()=>{init_json_hook_adapter();init_json_hooks();CLAUDE_HOOK_EVENT_MAP=[{event:"SessionStart",verb:"session-start"},{event:"UserPromptSubmit",verb:"turn-start"},{event:"Stop",verb:"turn-complete"},{event:"StopFailure",verb:"turn-failed"},{event:"Notification",matcher:"permission_prompt",verb:"awaiting-input"},{event:"Notification",matcher:"elicitation_dialog",verb:"awaiting-input"},{event:"SessionEnd",verb:"session-end"},{event:"PreCompact",verb:"pre-compact"},{event:"PostCompact",verb:"post-compact"},{event:"SubagentStart",verb:"subagent-start"},{event:"SubagentStop",verb:"subagent-stop"},{event:"PreToolUse",verb:"tool-pre"},{event:"PostToolUse",verb:"tool-post"},{event:"PostToolUseFailure",verb:"tool-failed"}],KOBE_HOOK_EVENTS=[...new Set(CLAUDE_HOOK_EVENT_MAP.map((e)=>e.event))];ClaudeHookAdapter=class ClaudeHookAdapter extends JsonHookAdapter{vendor="claude";eventMap=CLAUDE_HOOK_EVENT_MAP;globalSettingsPath(){return claudeSettingsPath()}activityDetailFromPayload(kind,payload){if(kind==="turn-failed")return{failure:failureFromErrorType(payload.error_type)};if(kind==="awaiting-input")return{waiting:payload.notification_type==="elicitation_dialog"?"input":"permission"};if(kind==="tool-pre"||kind==="tool-post"||kind==="tool-failed")return{tool:{...typeof payload.tool_name==="string"?{name:payload.tool_name}:{},...typeof payload.tool_use_id==="string"?{id:payload.tool_use_id}:{}}};if(kind==="pre-compact"||kind==="post-compact")return{compact:{trigger:payload.trigger==="manual"?"manual":"auto"}};if(kind==="subagent-start"||kind==="subagent-stop")return{subagent:{...typeof payload.agent_type==="string"?{type:payload.agent_type}:{},...typeof payload.agent_id==="string"?{id:payload.agent_id}:{}}};return}sessionFromPayload(payload){if(typeof payload.session_id!=="string"||!payload.session_id)return;return{sessionId:payload.session_id,...typeof payload.transcript_path==="string"&&payload.transcript_path?{transcriptPath:payload.transcript_path}:{}}}supportsWorktreeSync(){return!0}async removeWorktreeSyncHook(settingsFilePath){await editJsonSettings(settingsFilePath,(cur)=>mergeWorktreeSyncHook(cur,null))}}});import{spawn}from"child_process";function computeNextAllowedAt(startedAt,finishedAt,timedOut,cfg){if(timedOut)return startedAt+cfg.slowRetryMs;return finishedAt+Math.max(cfg.minIntervalMs,(finishedAt-startedAt)*5)}function shouldPoll(state,now){return!state.inFlight&&now>=state.nextAllowedAt}function applyJitter(delayMs,ratio,rand=Math.random){let r=Math.max(0,Math.min(1,ratio)),offset=(rand()*2-1)*delayMs*r;return Math.max(0,delayMs+offset)}function exponentialBackoff(baseMs,attempt,capMs){if(attempt<=0)return Math.min(baseMs,capMs);return Math.min(baseMs*2**attempt,capMs)}function maybeStartScheduledRun(state,cfg,run,onValue){let startedAt=Date.now();if(!shouldPoll(state,startedAt))return!1;state.inFlight=!0;let controller=new AbortController,timer=setTimeout(()=>controller.abort(),cfg.timeoutMs);return(async()=>{let value,ok=!1;try{value=await run(controller.signal),ok=!0}catch{}clearTimeout(timer);let timedOut=controller.signal.aborted;if(state.nextAllowedAt=computeNextAllowedAt(startedAt,Date.now(),timedOut,cfg),state.inFlight=!1,ok&&!timedOut)onValue(value)})(),!0}function decodeCapturedChunks(chunks){return Buffer.concat(chunks.map((c)=>typeof c==="string"?Buffer.from(c):c)).toString("utf8")}function spawnCapture(cmd,args,opts){return new Promise((resolve2)=>{let chunks=[],settled=!1,finish=(status)=>{if(settled)return;settled=!0,resolve2({status,stdout:decodeCapturedChunks(chunks)})},child=spawn(cmd,args.slice(),{cwd:opts.cwd,stdio:["ignore","pipe","ignore"],env:opts.env,signal:opts.signal,killSignal:"SIGKILL"});child.stdout?.on("data",(chunk)=>{chunks.push(chunk)}),child.on("error",()=>finish(null)),child.on("close",(code)=>finish(code))})}var init_poll_scheduling=()=>{};var init_poll_scheduling2=__esm(()=>{init_poll_scheduling()});import{readFile as readFile5}from"fs/promises";import{homedir as homedir8,userInfo}from"os";import path6 from"path";function parseResetsAtMs(value){if(value==null)return null;let numeric=typeof value==="number"?value:/^\d+(?:\.\d+)?$/.test(value.trim())?Number(value):null;if(numeric!=null){if(!Number.isFinite(numeric)||numeric<=0)return null;return numeric<1000000000000?numeric*1000:numeric}let parsed=Date.parse(String(value));return Number.isNaN(parsed)?null:parsed}function windowLabel(kind,scopeModel){if(kind==="weekly_scoped"&&scopeModel)return scopeModel;return kind.startsWith("weekly")||kind.startsWith("seven_day")?"7d":"5h"}function usageFromClaudePayload(payload,capturedAt){let windows=[];if(payload.limits?.length)for(let limit of payload.limits){if(typeof limit.kind!=="string"||typeof limit.percent!=="number")continue;windows.push({kind:limit.kind,label:windowLabel(limit.kind,limit.scope?.model?.display_name),percent:clampPercent(limit.percent),resetsAt:parseResetsAtMs(limit.resets_at)})}else{if(typeof payload.five_hour?.utilization==="number")windows.push({kind:"session",label:"5h",percent:clampPercent(payload.five_hour.utilization),resetsAt:parseResetsAtMs(payload.five_hour.resets_at)});if(typeof payload.seven_day?.utilization==="number")windows.push({kind:"weekly_all",label:"7d",percent:clampPercent(payload.seven_day.utilization),resetsAt:parseResetsAtMs(payload.seven_day.resets_at)})}return{windows,capturedAt}}function parseCredentials(raw){try{let oauth=JSON.parse(raw)?.claudeAiOauth;if(!oauth||typeof oauth.accessToken!=="string"||!oauth.accessToken)return null;return{accessToken:oauth.accessToken,...typeof oauth.expiresAt==="number"&&Number.isFinite(oauth.expiresAt)?{expiresAt:oauth.expiresAt}:{}}}catch{return null}}async function readFileCredentials(dir){try{return parseCredentials(await readFile5(path6.join(dir,".credentials.json"),"utf8"))}catch{return null}}async function readKeychainCredentials(){if(process.platform!=="darwin")return null;let controller=new AbortController,timeout=setTimeout(()=>controller.abort(),3000);try{let result=await spawnCapture("security",["find-generic-password","-a",userInfo().username,"-w","-s",KEYCHAIN_SERVICE],{cwd:homedir8(),signal:controller.signal});return result.status===0?parseCredentials(result.stdout.trim()):null}finally{clearTimeout(timeout)}}async function readAccessToken(){let configDir=process.env.CLAUDE_CONFIG_DIR?.trim();if(configDir){let fromFile=await readFileCredentials(configDir);return fromFile&&isFresh(fromFile)?fromFile.accessToken:null}return[await readKeychainCredentials(),await readFileCredentials(vendorConfigHome("claude"))].find((c)=>c!=null&&isFresh(c))?.accessToken??null}async function fetchClaudeQuotaUsage(now=Date.now){let token=await readAccessToken().catch(()=>null);if(!token)return null;let controller=new AbortController,timeout=setTimeout(()=>controller.abort(),USAGE_TIMEOUT_MS);try{let response=await fetch(OAUTH_USAGE_URL,{headers:{Authorization:`Bearer ${token}`,"Content-Type":"application/json","User-Agent":OAUTH_USER_AGENT,"anthropic-beta":OAUTH_BETA_HEADER},signal:controller.signal});if(!response.ok)return null;return usageFromClaudePayload(await response.json(),now())}catch{return null}finally{clearTimeout(timeout)}}var OAUTH_USAGE_URL="https://api.anthropic.com/api/oauth/usage",OAUTH_BETA_HEADER="oauth-2025-04-20",OAUTH_USER_AGENT="claude-cli/2.1.198 (external, cli)",USAGE_TIMEOUT_MS=1e4,KEYCHAIN_SERVICE="Claude Code-credentials",clampPercent=(value)=>Math.min(100,Math.max(0,Math.round(value))),isFresh=(c)=>c.expiresAt===void 0||c.expiresAt>Date.now();var init_quota=__esm(()=>{init_poll_scheduling2();init_vendor_home()});var CLAUDE_SCREEN_MANIFEST;var init_screen=__esm(()=>{CLAUDE_SCREEN_MANIFEST={rules:[],composerEmpty:[{bottomLines:6,all:["\u276F"],lineRegex:["^\\s*\u276F\\s*(?:[\xB7\u2022]\\s*(?:\u2190[^\\n]*)?)?$"]}]}});import{homedir as homedir9}from"os";import path7 from"path";function trustClaudeWorktree(worktreePath,home=homedir9()){updateSharedJsonSync(path7.join(home,".claude.json"),(raw)=>{if(raw===void 0)return{};try{return JSON.parse(raw)}catch{return{}}},(doc)=>{let projects={...doc.projects??{}},existing=projects[worktreePath]??{};if(existing.hasTrustDialogAccepted===!0)return;return projects[worktreePath]={...existing,hasTrustDialogAccepted:!0,hasCompletedProjectOnboarding:!0},JSON.stringify({...doc,projects},null,2)})}var init_trust=__esm(()=>{init_shared_config_write()});function isSyntheticClaudeRecord(record){return record.isMeta===!0||record.isCompactSummary===!0}function isClaudeCommandBreadcrumb(blocks){if(blocks.length===0)return!1;for(let b of blocks){if(b.type!=="text")return!1;let t=b.text.trim();if(!t.startsWith("<command-name>")&&!t.startsWith("<command-message>")&&!t.startsWith("<local-command"))return!1}return!0}function isObject2(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function opensTurn(content){if(typeof content==="string")return content.trim().length>0;if(!Array.isArray(content))return!1;return content.some((b)=>!isObject2(b)||b.type!=="tool_result")}function num(v){return typeof v==="number"&&Number.isFinite(v)?v:0}function readUsage(v){if(!isObject2(v))return;return{input_tokens:num(v.input_tokens),output_tokens:num(v.output_tokens),cache_read_input_tokens:num(v.cache_read_input_tokens),cache_creation_input_tokens:num(v.cache_creation_input_tokens)}}function finish(draft){if(!draft.id)return null;let totals={input_tokens:0,output_tokens:0,cache_read_input_tokens:0,cache_creation_input_tokens:0};for(let u of draft.usageByMessage.values())totals.input_tokens+=u.input_tokens,totals.output_tokens+=u.output_tokens,totals.cache_read_input_tokens+=u.cache_read_input_tokens,totals.cache_creation_input_tokens+=u.cache_creation_input_tokens;return{id:draft.id,sessionId:draft.sessionId,...draft.model?{model:draft.model}:{},startedAt:draft.startedAt,endedAt:draft.endedAt,...draft.usageByMessage.size>0?{usage:totals}:{}}}function parseClaudeTurns(raw,fallbackSessionId=""){let out=[],draft=null;for(let line of raw.split(`
|
|
8
|
+
`})}catch{}}class JsonHookAdapter{supportsHooks(){return!0}activityDetailFromPayload(_kind,_payload){return}sessionFromPayload(_payload){return}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(_settingsFilePath){}gatedVerbs(){return GATED_TOOL_VERBS}async installActivityHooks(settingsFilePath,opts={}){let gated=this.gatedVerbs();await editJsonSettings(settingsFilePath,(cur)=>mergeActivityHooks(cur,!0,this.eventMap,void 0,{extraArgs:["--engine",this.vendor],buildFilter:(spec)=>opts.toolEvents===!0||!gated.has(spec.verb)}))}async removeActivityHooks(settingsFilePath){await editJsonSettings(settingsFilePath,(cur)=>mergeActivityHooks(cur,!1,this.eventMap))}async removeWorktreeWatchHook(settingsFilePath){await editJsonSettings(settingsFilePath,removeWorktreeWatchHook)}}var init_json_hook_adapter=__esm(()=>{init_json_hooks();init_shared_config_write()});import{homedir as homedir7}from"os";import{join as join7}from"path";function failureFromErrorType(errorType){if(typeof errorType!=="string")return"other";if(errorType==="rate_limit"||errorType==="overloaded")return"rate_limit";if(errorType==="billing_error")return"billing";return"other"}function claudeSettingsPath(){return join7(homedir7(),".claude","settings.json")}function isKobeWorktreeSyncGroup(group){if(!isObject(group)||!Array.isArray(group.hooks))return!1;return group.hooks.some((h)=>isObject(h)&&typeof h.command==="string"&&h.command.includes(WORKTREE_SYNC_MARKER))}function mergeWorktreeSyncHook(current,command){let{hooks:rawHooks,...restSettings}=current,{WorktreeCreate,...otherHooks}=isObject(rawHooks)?rawHooks:{},kept=(Array.isArray(WorktreeCreate)?WorktreeCreate:[]).filter((g)=>!isKobeWorktreeSyncGroup(g));if(command!==null)kept.push({hooks:[{type:"command",command}]});let nextHooks={...otherHooks};if(kept.length>0)nextHooks.WorktreeCreate=kept;return Object.keys(nextHooks).length>0?{...restSettings,hooks:nextHooks}:{...restSettings}}var CLAUDE_HOOK_EVENT_MAP,KOBE_HOOK_EVENTS,WORKTREE_SYNC_MARKER="worktree-created",ClaudeHookAdapter;var init_hook_adapter=__esm(()=>{init_json_hook_adapter();init_json_hooks();CLAUDE_HOOK_EVENT_MAP=[{event:"SessionStart",verb:"session-start"},{event:"UserPromptSubmit",verb:"turn-start"},{event:"Stop",verb:"turn-complete"},{event:"StopFailure",verb:"turn-failed"},{event:"Notification",matcher:"permission_prompt",verb:"awaiting-input"},{event:"Notification",matcher:"elicitation_dialog",verb:"awaiting-input"},{event:"SessionEnd",verb:"session-end"},{event:"PreCompact",verb:"pre-compact"},{event:"PostCompact",verb:"post-compact"},{event:"SubagentStart",verb:"subagent-start"},{event:"SubagentStop",verb:"subagent-stop"},{event:"PreToolUse",verb:"tool-pre"},{event:"PostToolUse",verb:"tool-post"},{event:"PostToolUseFailure",verb:"tool-failed"}],KOBE_HOOK_EVENTS=[...new Set(CLAUDE_HOOK_EVENT_MAP.map((e)=>e.event))];ClaudeHookAdapter=class ClaudeHookAdapter extends JsonHookAdapter{vendor="claude";eventMap=CLAUDE_HOOK_EVENT_MAP;globalSettingsPath(){return claudeSettingsPath()}activityDetailFromPayload(kind,payload){if(kind==="turn-failed")return{failure:failureFromErrorType(payload.error_type)};if(kind==="awaiting-input")return{waiting:payload.notification_type==="elicitation_dialog"?"input":"permission"};if(kind==="tool-pre"||kind==="tool-post"||kind==="tool-failed")return{tool:{...typeof payload.tool_name==="string"?{name:payload.tool_name}:{},...typeof payload.tool_use_id==="string"?{id:payload.tool_use_id}:{}}};if(kind==="pre-compact"||kind==="post-compact")return{compact:{trigger:payload.trigger==="manual"?"manual":"auto"}};if(kind==="subagent-start"||kind==="subagent-stop")return{subagent:{...typeof payload.agent_type==="string"?{type:payload.agent_type}:{},...typeof payload.agent_id==="string"?{id:payload.agent_id}:{}}};return}sessionFromPayload(payload){if(typeof payload.session_id!=="string"||!payload.session_id)return;return{sessionId:payload.session_id,...typeof payload.transcript_path==="string"&&payload.transcript_path?{transcriptPath:payload.transcript_path}:{}}}supportsWorktreeSync(){return!0}async removeWorktreeSyncHook(settingsFilePath){await editJsonSettings(settingsFilePath,(cur)=>mergeWorktreeSyncHook(cur,null))}}});import{spawn}from"child_process";function computeNextAllowedAt(startedAt,finishedAt,timedOut,cfg){if(timedOut)return startedAt+cfg.slowRetryMs;return finishedAt+Math.max(cfg.minIntervalMs,(finishedAt-startedAt)*5)}function shouldPoll(state,now){return!state.inFlight&&now>=state.nextAllowedAt}function applyJitter(delayMs,ratio,rand=Math.random){let r=Math.max(0,Math.min(1,ratio)),offset=(rand()*2-1)*delayMs*r;return Math.max(0,delayMs+offset)}function exponentialBackoff(baseMs,attempt,capMs){if(attempt<=0)return Math.min(baseMs,capMs);return Math.min(baseMs*2**attempt,capMs)}function maybeStartScheduledRun(state,cfg,run,onValue){let startedAt=Date.now();if(!shouldPoll(state,startedAt))return!1;state.inFlight=!0;let controller=new AbortController,timer=setTimeout(()=>controller.abort(),cfg.timeoutMs);return(async()=>{let value,ok=!1;try{value=await run(controller.signal),ok=!0}catch{}clearTimeout(timer);let timedOut=controller.signal.aborted;if(state.nextAllowedAt=computeNextAllowedAt(startedAt,Date.now(),timedOut,cfg),state.inFlight=!1,ok&&!timedOut)onValue(value)})(),!0}function decodeCapturedChunks(chunks){return Buffer.concat(chunks.map((c)=>typeof c==="string"?Buffer.from(c):c)).toString("utf8")}function spawnCapture(cmd,args,opts){return new Promise((resolve2)=>{let chunks=[],errChunks=[],settled=!1,finish=(status)=>{if(settled)return;settled=!0,resolve2({status,stdout:decodeCapturedChunks(chunks),stderr:decodeCapturedChunks(errChunks)})},child=spawn(cmd,args.slice(),{cwd:opts.cwd,stdio:["ignore","pipe","pipe"],env:opts.env,signal:opts.signal,killSignal:"SIGKILL"});child.stdout?.on("data",(chunk)=>{chunks.push(chunk)}),child.stderr?.on("data",(chunk)=>{errChunks.push(chunk)}),child.on("error",()=>finish(null)),child.on("close",(code)=>finish(code))})}var init_poll_scheduling=()=>{};var init_poll_scheduling2=__esm(()=>{init_poll_scheduling()});import{readFile as readFile5}from"fs/promises";import{homedir as homedir8,userInfo}from"os";import path6 from"path";function parseResetsAtMs(value){if(value==null)return null;let numeric=typeof value==="number"?value:/^\d+(?:\.\d+)?$/.test(value.trim())?Number(value):null;if(numeric!=null){if(!Number.isFinite(numeric)||numeric<=0)return null;return numeric<1000000000000?numeric*1000:numeric}let parsed=Date.parse(String(value));return Number.isNaN(parsed)?null:parsed}function windowLabel(kind,scopeModel){if(kind==="weekly_scoped"&&scopeModel)return scopeModel;return kind.startsWith("weekly")||kind.startsWith("seven_day")?"7d":"5h"}function usageFromClaudePayload(payload,capturedAt){let windows=[];if(payload.limits?.length)for(let limit of payload.limits){if(typeof limit.kind!=="string"||typeof limit.percent!=="number")continue;windows.push({kind:limit.kind,label:windowLabel(limit.kind,limit.scope?.model?.display_name),percent:clampPercent(limit.percent),resetsAt:parseResetsAtMs(limit.resets_at)})}else{if(typeof payload.five_hour?.utilization==="number")windows.push({kind:"session",label:"5h",percent:clampPercent(payload.five_hour.utilization),resetsAt:parseResetsAtMs(payload.five_hour.resets_at)});if(typeof payload.seven_day?.utilization==="number")windows.push({kind:"weekly_all",label:"7d",percent:clampPercent(payload.seven_day.utilization),resetsAt:parseResetsAtMs(payload.seven_day.resets_at)})}return{windows,capturedAt}}function parseCredentials(raw){try{let oauth=JSON.parse(raw)?.claudeAiOauth;if(!oauth||typeof oauth.accessToken!=="string"||!oauth.accessToken)return null;return{accessToken:oauth.accessToken,...typeof oauth.expiresAt==="number"&&Number.isFinite(oauth.expiresAt)?{expiresAt:oauth.expiresAt}:{}}}catch{return null}}async function readFileCredentials(dir){try{return parseCredentials(await readFile5(path6.join(dir,".credentials.json"),"utf8"))}catch{return null}}async function readKeychainCredentials(){if(process.platform!=="darwin")return null;let controller=new AbortController,timeout=setTimeout(()=>controller.abort(),3000);try{let result=await spawnCapture("security",["find-generic-password","-a",userInfo().username,"-w","-s",KEYCHAIN_SERVICE],{cwd:homedir8(),signal:controller.signal});return result.status===0?parseCredentials(result.stdout.trim()):null}finally{clearTimeout(timeout)}}async function readAccessToken(){let configDir=process.env.CLAUDE_CONFIG_DIR?.trim();if(configDir){let fromFile=await readFileCredentials(configDir);return fromFile&&isFresh(fromFile)?fromFile.accessToken:null}return[await readKeychainCredentials(),await readFileCredentials(vendorConfigHome("claude"))].find((c)=>c!=null&&isFresh(c))?.accessToken??null}async function fetchClaudeQuotaUsage(now=Date.now){let token=await readAccessToken().catch(()=>null);if(!token)return null;let controller=new AbortController,timeout=setTimeout(()=>controller.abort(),USAGE_TIMEOUT_MS);try{let response=await fetch(OAUTH_USAGE_URL,{headers:{Authorization:`Bearer ${token}`,"Content-Type":"application/json","User-Agent":OAUTH_USER_AGENT,"anthropic-beta":OAUTH_BETA_HEADER},signal:controller.signal});if(!response.ok)return null;return usageFromClaudePayload(await response.json(),now())}catch{return null}finally{clearTimeout(timeout)}}var OAUTH_USAGE_URL="https://api.anthropic.com/api/oauth/usage",OAUTH_BETA_HEADER="oauth-2025-04-20",OAUTH_USER_AGENT="claude-cli/2.1.198 (external, cli)",USAGE_TIMEOUT_MS=1e4,KEYCHAIN_SERVICE="Claude Code-credentials",clampPercent=(value)=>Math.min(100,Math.max(0,Math.round(value))),isFresh=(c)=>c.expiresAt===void 0||c.expiresAt>Date.now();var init_quota=__esm(()=>{init_poll_scheduling2();init_vendor_home()});var CLAUDE_SCREEN_MANIFEST;var init_screen=__esm(()=>{CLAUDE_SCREEN_MANIFEST={rules:[],composerEmpty:[{bottomLines:6,all:["\u276F"],lineRegex:["^\\s*\u276F\\s*(?:[\xB7\u2022]\\s*(?:\u2190[^\\n]*)?)?$"]}]}});import{homedir as homedir9}from"os";import path7 from"path";function trustClaudeWorktree(worktreePath,home=homedir9()){updateSharedJsonSync(path7.join(home,".claude.json"),(raw)=>{if(raw===void 0)return{};try{return JSON.parse(raw)}catch{return{}}},(doc)=>{let projects={...doc.projects??{}},existing=projects[worktreePath]??{};if(existing.hasTrustDialogAccepted===!0)return;return projects[worktreePath]={...existing,hasTrustDialogAccepted:!0,hasCompletedProjectOnboarding:!0},JSON.stringify({...doc,projects},null,2)})}var init_trust=__esm(()=>{init_shared_config_write()});function isSyntheticClaudeRecord(record){return record.isMeta===!0||record.isCompactSummary===!0}function isClaudeCommandBreadcrumb(blocks){if(blocks.length===0)return!1;for(let b of blocks){if(b.type!=="text")return!1;let t=b.text.trim();if(!t.startsWith("<command-name>")&&!t.startsWith("<command-message>")&&!t.startsWith("<local-command"))return!1}return!0}function isObject2(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function opensTurn(content){if(typeof content==="string")return content.trim().length>0;if(!Array.isArray(content))return!1;return content.some((b)=>!isObject2(b)||b.type!=="tool_result")}function num(v){return typeof v==="number"&&Number.isFinite(v)?v:0}function readUsage(v){if(!isObject2(v))return;return{input_tokens:num(v.input_tokens),output_tokens:num(v.output_tokens),cache_read_input_tokens:num(v.cache_read_input_tokens),cache_creation_input_tokens:num(v.cache_creation_input_tokens)}}function finish(draft){if(!draft.id)return null;let totals={input_tokens:0,output_tokens:0,cache_read_input_tokens:0,cache_creation_input_tokens:0};for(let u of draft.usageByMessage.values())totals.input_tokens+=u.input_tokens,totals.output_tokens+=u.output_tokens,totals.cache_read_input_tokens+=u.cache_read_input_tokens,totals.cache_creation_input_tokens+=u.cache_creation_input_tokens;return{id:draft.id,sessionId:draft.sessionId,...draft.model?{model:draft.model}:{},startedAt:draft.startedAt,endedAt:draft.endedAt,...draft.usageByMessage.size>0?{usage:totals}:{}}}function parseClaudeTurns(raw,fallbackSessionId=""){let out=[],draft=null;for(let line of raw.split(`
|
|
9
9
|
`)){let trimmed=line.trim();if(!trimmed||!isJsonlLineWithinBound(trimmed))continue;let record;try{record=JSON.parse(trimmed)}catch{continue}if(!isObject2(record)||isSyntheticClaudeRecord(record))continue;let inner=isObject2(record.message)?record.message:record,at=typeof record.timestamp==="string"?Date.parse(record.timestamp):Number.NaN;if(!Number.isFinite(at))continue;let sessionId=typeof record.sessionId==="string"?record.sessionId:fallbackSessionId;if(inner.role==="user"){if(!opensTurn(inner.content))continue;if(draft){let done=finish(draft);if(done)out.push(done)}draft={id:"",sessionId,startedAt:at,endedAt:at,usageByMessage:new Map};continue}if(inner.role!=="assistant"||!draft)continue;if(draft.endedAt=at,typeof inner.model==="string")draft.model=inner.model;let messageId=typeof inner.id==="string"?inner.id:"";if(messageId)draft.id=messageId;let usage=readUsage(inner.usage);if(usage&&messageId)draft.usageByMessage.set(messageId,usage)}if(draft){let done=finish(draft);if(done)out.push(done)}return out}async function readClaudeTurns(transcriptPath){try{let raw=await readTextFileBounded(transcriptPath);return parseClaudeTurns(raw)}catch{return[]}}var init_turns=__esm(()=>{init_file_bounds()});function parseHex(value){let match=HEX_RE.exec(value);if(!match)return[0,0,0];return[Number.parseInt(match[1],16),Number.parseInt(match[2],16),Number.parseInt(match[3],16)]}function luminance([red,green,blue]){return(red*0.2126+green*0.7152+blue*0.0722)/255}function blend(from,to,amount){return[Math.round(from[0]+(to[0]-from[0])*amount),Math.round(from[1]+(to[1]-from[1])*amount),Math.round(from[2]+(to[2]-from[2])*amount)]}function codexUserMessageBackground(background){return luminance(background)>0.5?blend(background,[0,0,0],0.04):blend(background,[255,255,255],0.12)}function transcriptRewrite(palette){let foreground=parseHex(palette.foreground),background=parseHex(palette.background),backgroundIsLight=luminance(background)>0.5;return{matchBackground:codexUserMessageBackground(background),foreground:backgroundIsLight?foreground:background,background:backgroundIsLight?background:foreground}}var HEX_RE,codexTerminalPresentation;var init_terminal_presentation=__esm(()=>{HEX_RE=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;codexTerminalPresentation={alternateScreenStyleRewrites:(palette)=>[transcriptRewrite(palette)]}});var codexCapabilities,codexIdentity;var init_capabilities2=__esm(()=>{init_terminal_presentation();codexCapabilities={terminalPresentation:codexTerminalPresentation},codexIdentity={vendorId:"codex",shortName:"Codex"}});import{homedir as homedir10}from"os";import{join as join8}from"path";function codexHooksPath(){return join8(homedir10(),".codex","hooks.json")}var EVENT_MAP,KOBE_CODEX_HOOK_EVENTS,CodexHookAdapter;var init_hook_adapter2=__esm(()=>{init_json_hook_adapter();EVENT_MAP=[{event:"SessionStart",verb:"session-start"},{event:"UserPromptSubmit",verb:"turn-start"},{event:"Stop",verb:"turn-complete"},{event:"PreCompact",verb:"pre-compact"},{event:"PostCompact",verb:"post-compact"},{event:"PreToolUse",verb:"tool-pre"},{event:"PostToolUse",verb:"tool-post"}],KOBE_CODEX_HOOK_EVENTS=EVENT_MAP.map((e)=>e.event);CodexHookAdapter=class CodexHookAdapter extends JsonHookAdapter{vendor="codex";eventMap=EVENT_MAP;globalSettingsPath(){return codexHooksPath()}activityDetailFromPayload(kind,payload){if(kind==="tool-pre"||kind==="tool-post")return{tool:{...typeof payload.tool_name==="string"?{name:payload.tool_name}:{}}};if(kind==="pre-compact"||kind==="post-compact")return{compact:{trigger:payload.trigger==="manual"?"manual":"auto"}};return}}});import{createHash as createHash4}from"crypto";function createAppendParseCache(opts){let maxFiles=opts.maxFiles??8,cache=new Map;function hashPrefix(raw,length){return createHash4("sha256").update(raw.slice(0,length)).digest("hex")}function remember(filePath,entry){if(cache.delete(filePath),cache.set(filePath,entry),cache.size>maxFiles){let oldest=cache.keys().next().value;if(oldest!==void 0)cache.delete(oldest)}}return function(filePath,raw,ctx){let stableLength=raw.lastIndexOf(`
|
|
10
10
|
`)+1,entry=cache.get(filePath),prefixState;if(entry&&entry.prefixLength<=stableLength&&hashPrefix(raw,entry.prefixLength)===entry.prefixHash)prefixState=entry.prefixLength<stableLength?opts.parseChunk(raw.slice(entry.prefixLength,stableLength),entry.state,ctx):entry.state;else prefixState=opts.parseChunk(raw.slice(0,stableLength),opts.initial(ctx),ctx);if(!entry||entry.prefixLength!==stableLength||entry.state!==prefixState)remember(filePath,{prefixLength:stableLength,prefixHash:hashPrefix(raw,stableLength),state:prefixState});let tail=raw.slice(stableLength);return tail.trim().length>0?opts.parseChunk(tail,prefixState,ctx):prefixState}}function sortByTimestamp(messages){return messages.map((msg,idx)=>({msg,idx})).sort((a,b)=>{if(a.msg.timestamp<b.msg.timestamp)return-1;if(a.msg.timestamp>b.msg.timestamp)return 1;return a.idx-b.idx}).map((entry)=>entry.msg)}var init_history_cache=()=>{};function normalizeCodexContent(raw){if(typeof raw==="string")return raw.length>0?[{type:"text",text:raw}]:[];if(!Array.isArray(raw))return[];let blocks=[];for(let item of raw){if(typeof item==="string"){if(item.length>0)blocks.push({type:"text",text:item});continue}if(!isObject3(item))continue;let t=typeof item.type==="string"?item.type:void 0;if(t==="input_text"||t==="output_text"){let text=typeof item.text==="string"?item.text:"";if(text.length>0)blocks.push({type:"text",text});continue}if(t)blocks.push({type:"text",text:`[codex: ${t}]`})}return blocks}function isObject3(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function isSyntheticCodexUserRow(blocks){if(blocks.length===0)return!1;for(let b of blocks){if(b.type!=="text")return!1;let t=(b.text??"").trim();if(!isEnvironmentContextEnvelope(t)&&!isInstructionsEnvelope(t))return!1}return!0}function isEnvironmentContextEnvelope(text){return text.startsWith("<environment_context>")&&text.endsWith("</environment_context>")}function isInstructionsEnvelope(text){return text.startsWith("# AGENTS.md instructions for ")&&text.includes(`
|
|
11
11
|
<INSTRUCTIONS>
|
|
@@ -290,9 +290,9 @@ ${codeblock}`,options);this.line=line,this.column=column,this.codeblock=codebloc
|
|
|
290
290
|
`,{mode:384})}function upsertPluginEntry(registry,entry){return{plugins:[...registry.plugins.filter((p)=>p.id!==entry.id),entry]}}function removePluginEntry(registry,id){return{plugins:registry.plugins.filter((p)=>p.id!==id)}}var EMPTY;var init_registry2=__esm(()=>{init_plugin_paths();EMPTY={plugins:[]}});var exports_plugin_engines={};__export(exports_plugin_engines,{reloadPluginEngines:()=>reloadPluginEngines,loadPluginEngines:()=>loadPluginEngines});function loadPluginEngines(homeDir2){let registered=[];try{for(let entry of loadPluginRegistry(homeDir2).plugins){if(!entry.enabled)continue;try{let{manifest}=readPluginManifest(entry.root);for(let engine of manifest.engines){let identity={vendorId:engine.id,shortName:engine.identity?.shortName??engine.name};if(registerPluginEngine(engine.id,{displayName:engine.name,defaultCommand:engine.command,...engine.processNames?{processNames:engine.processNames}:{},screenManifest:{rules:engine.rules},identity}))registered.push(engine.id);else console.warn(`[rove] plugin ${entry.id}: engine id \`${engine.id}\` shadows a built-in or shipped engine \u2014 skipped`)}}catch{}}}catch{}return registered}function reloadPluginEngines(homeDir2){clearPluginEngines();let registered=loadPluginEngines(homeDir2);return resetAvailableVendorsCache(),registered}var init_plugin_engines=__esm(()=>{init_manifest();init_registry2();init_account_detect();init_contrib_engines()});function helpStep(verbName){return{hint:"run the verb's --help for its exact flag contract, then retry",nextCommandArgs:["api",verbName,"--help"]}}var ApiError,VERB_GROUP_IDS;var init_types=__esm(()=>{ApiError=class ApiError extends Error{code;data;constructor(message,code,data){super(message);this.code=code;this.data=data}};VERB_GROUP_IDS=["discover","read","create","drive","edit","issues","workitems","routine","lifecycle","worktree","feedback"]});import{readFileSync as readFileSync9}from"fs";import{resolve as resolve2}from"path";function parsePositiveInt(raw){if(!/^\d+$/.test(raw.trim()))return;let n=Number.parseInt(raw,10);return Number.isSafeInteger(n)&&n>0?n:void 0}function parseNonNegativeInt(raw){if(!/^\d+$/.test(raw.trim()))return;let n=Number.parseInt(raw,10);return Number.isSafeInteger(n)&&n>=0?n:void 0}function parseBoolLiteral(raw){if(["true","1","yes"].includes(raw))return!0;if(["false","0","no"].includes(raw))return!1;return}function parseFlags(argv,booleanFlags=new Set){let flags=new Map,pretty=!1,help=!1;for(let i=0;i<argv.length;i++){let arg=argv[i];if(!arg.startsWith("--")&&arg!=="-h")throw new ApiError(`unexpected positional arg: ${arg}`,"BAD_FLAG");if(arg==="-h"){help=!0;continue}let eq=arg.indexOf("=");if(eq!==-1){let key2=arg.slice(2,eq),value=arg.slice(eq+1);if(key2==="pretty")pretty=value!=="false"&&value!=="0";else if(key2==="help")help=value!=="false"&&value!=="0";else flags.set(key2,value);continue}let key=arg.slice(2);if(key==="pretty"){pretty=!0;continue}if(key==="help"){help=!0;continue}if(booleanFlags.has(key)){let next2=argv[i+1];if(next2!==void 0&&parseBoolLiteral(next2)!==void 0)flags.set(key,next2),i+=1;else flags.set(key,"true");continue}let next=argv[i+1];if(next===void 0||next.startsWith("--"))throw new ApiError(`flag --${key} requires a value`,"BAD_FLAG");flags.set(key,next),i+=1}return{flags,pretty,help}}function validateAgainstSpec(verb,flags){let known=new Set(verb.flags.map((f)=>f.name));for(let key of flags.keys())if(!known.has(key))throw new ApiError(`unknown flag --${key} for "${verb.name}"`,"BAD_FLAG",helpStep(verb.name));for(let f of verb.flags){let satisfied=flags.get(f.name)||f.name==="prompt"&&flags.get("prompt-file");if(f.required&&!satisfied)throw new ApiError(`--${f.name} is required for "${verb.name}"`,"MISSING_FLAG",helpStep(verb.name));if(f.type==="enum"&&f.values){let raw=flags.get(f.name);if(raw!==void 0&&!f.values.includes(raw)){if(f.name==="vendor"&&getCustomEngineIds().includes(raw))continue;throw new ApiError(`--${f.name} must be one of ${f.values.join(", ")}`,"BAD_FLAG",helpStep(verb.name))}}if(f.type==="int"){let raw=flags.get(f.name);if(raw!==void 0&&parsePositiveInt(raw)===void 0)throw new ApiError(`--${f.name} must be a positive integer`,"BAD_FLAG")}if(f.type==="uint"){let raw=flags.get(f.name);if(raw!==void 0&&parseNonNegativeInt(raw)===void 0)throw new ApiError(`--${f.name} must be a non-negative integer`,"BAD_FLAG")}}}class VerbArgs{verb;flags;constructor(verb,flags){this.verb=verb;this.flags=flags}spec(name){let f=this.verb.flags.find((s)=>s.name===name);if(!f)throw Error(`internal: --${name} is not declared on verb "${this.verb.name}"`);return f}str(name){this.spec(name);let v=this.flags.get(name);return v&&v.length>0?v:void 0}present(name){return this.spec(name),this.flags.get(name)!==void 0}promptText(){if(this.promptMemo!==void 0)return this.promptMemo.value;let value=this.readPromptText();return this.promptMemo={value},value}promptMemo;readPromptText(){let inline=this.str("prompt"),file=this.str("prompt-file");if(inline!==void 0&&file!==void 0)throw new ApiError("pass --prompt or --prompt-file, not both","BAD_FLAG",helpStep(this.verb.name));if(file===void 0)return inline;let text=readFileSync9(file==="-"?0:resolve2(process.cwd(),expandTilde(file)),"utf8");if(text.trim().length===0)throw new ApiError(`--prompt-file ${file} is empty`,"BAD_FLAG");return text}require(name){let v=this.str(name);if(v===void 0)throw new ApiError(`--${name} is required`,"MISSING_FLAG");return v}enumOf(name){let f=this.spec(name),v=this.str(name);if(v===void 0)return;if(f.values&&!f.values.includes(v))throw new ApiError(`--${name} must be one of ${f.values.join(", ")}`,"BAD_FLAG",helpStep(this.verb.name));return v}requireEnum(name){return this.require(name),this.enumOf(name)}vendor(){let value=this.str("vendor");if(value===void 0)return;let builtins=this.spec("vendor").values??ALL_VENDORS;if(builtins.includes(value))return value;if(getCustomEngineIds().includes(value))return value;throw new ApiError(`--vendor must be a built-in (${builtins.join(", ")}) or a registered custom engine id`,"BAD_FLAG",helpStep(this.verb.name))}bool(name){this.spec(name);let raw=this.str(name);if(raw===void 0)return;let value=parseBoolLiteral(raw);if(value===void 0)throw new ApiError(`--${name} must be a boolean (true/false)`,"BAD_FLAG");return value}int(name){this.spec(name);let raw=this.str(name);if(raw===void 0)return;let n=parsePositiveInt(raw);if(n===void 0)throw new ApiError(`--${name} must be a positive integer`,"BAD_FLAG");return n}nonNegativeInt(name){this.spec(name);let raw=this.str(name);if(raw===void 0)return;let n=parseNonNegativeInt(raw);if(n===void 0)throw new ApiError(`--${name} must be a non-negative integer`,"BAD_FLAG");return n}path(name){let v=this.str(name);return v===void 0?void 0:resolve2(process.cwd(),expandTilde(v))}requirePath(name){return resolve2(process.cwd(),expandTilde(this.require(name)))}requireRepo(name){let raw=this.require(name);return isRemoteRepoKey(raw)?raw:resolve2(process.cwd(),expandTilde(raw))}}function parseAgentsSpec(spec){let out=[];for(let part of spec.split(",")){let trimmed=part.trim();if(!trimmed)continue;let colon=trimmed.indexOf(":");if(colon===-1)throw new ApiError(`--agents entry "${trimmed}" must be engine:count`,"BAD_FLAG",FANOUT_STEP);let vendor=trimmed.slice(0,colon);if(!ALL_VENDORS.includes(vendor)&&!getCustomEngineIds().includes(vendor))throw new ApiError(`--agents engine "${vendor}" must be a built-in (${ALL_VENDORS.join(", ")}) or a registered engine id \u2014 see \`engine-list\``,"BAD_FLAG",FANOUT_STEP);let count=parsePositiveInt(trimmed.slice(colon+1));if(count===void 0)throw new ApiError(`--agents count for "${vendor}" must be a positive integer`,"BAD_FLAG",FANOUT_STEP);if(out.length+count>FANOUT_CAP)throw new ApiError(`--agents requests ${out.length+count} agents, exceeds the cap of ${FANOUT_CAP}`,"BAD_FLAG",FANOUT_STEP);for(let i=0;i<count;i++)out.push(vendor)}if(out.length===0)throw new ApiError('--agents specified no agents (e.g. "claude:2,codex:1")',"BAD_FLAG",FANOUT_STEP);return out}function buildCountPlan(count,vendor){if(count>FANOUT_CAP)throw new ApiError(`--count ${count} exceeds the parallel cap of ${FANOUT_CAP} \u2014 spawn in batches`,"BAD_FLAG",FANOUT_STEP);return Array(count).fill(vendor)}var FANOUT_CAP=10,FANOUT_STEP,F;var init_flags=__esm(()=>{init_path_home();init_repos();init_vendor();init_types();FANOUT_STEP=helpStep("add"),F={repo:(required=!0)=>({name:"repo",type:"string",required,placeholder:"PATH",description:"Repo root (git toplevel). Relative paths resolve against $PWD."}),taskId:(required=!0)=>({name:"task-id",type:"string",required,placeholder:"ID",description:"Target task id (from `list` / `add`)."}),vendor:()=>({name:"vendor",type:"enum",values:ALL_VENDORS,placeholder:"V",description:"Engine vendor for the task."}),command:()=>({name:"command",type:"string",placeholder:"CMD",description:"Engine launch command, verbatim \u2014 an engine id from `engine-list` (e.g. claude) or a full command line (e.g. 'codex --search'). Unvalidated: probe an unfamiliar engine's flags with `<cmd> --help` first. Omitted = the repo's default engine."}),title:()=>({name:"title",type:"string",placeholder:"T",description:"Human task title."}),prompt:(required,desc)=>({name:"prompt",type:"string",required,placeholder:"TEXT",description:required?`${desc} Required unless --prompt-file is given.`:desc}),promptFile:()=>({name:"prompt-file",type:"string",placeholder:"PATH",description:"Read the prompt from this file instead of --prompt (`-` = stdin). Use it whenever the text has backticks, $vars, or quotes you don't want the shell to touch. Exactly one of --prompt / --prompt-file."})}});function isAttentionInboxState(value){return typeof value==="string"&&ATTENTION_INBOX_STATES.includes(value)}function attentionInboxItemKey(item){let lane=item.state==="prompt_deferred"?"\x00deferred":"";return`${item.taskId}\x00${item.tabId??""}${lane}`}var ATTENTION_INBOX_STATES;var init_contracts=__esm(()=>{ATTENTION_INBOX_STATES=["turn_complete","permission_needed","error","rate_limited","prompt_deferred","dead"]});function isChannelName(value){return typeof value==="string"&&CHANNEL_NAME_SET.has(value)}function normalizeChannelFilter(value){if(!Array.isArray(value))return null;let set=new Set;for(let name of value)if(isChannelName(name))set.add(name);return set.size>0?set:null}var CHANNEL_NAMES,CHANNEL_NAME_SET;var init_channels=__esm(()=>{init_contract();CHANNEL_NAMES=DAEMON_CHANNELS,CHANNEL_NAME_SET=new Set(CHANNEL_NAMES)});function isProtocolCompatible(args){return args.remoteVersion>=args.localMin&&args.localVersion>=args.remoteMin}function isDaemonVersionStale(daemonVersion,clientVersion){if(!daemonVersion)return!1;return daemonVersion!==clientVersion}function isForeignDaemonHome(daemonHome,clientHome){if(!daemonHome)return!1;let strip=(value)=>value.replace(/[/\\]+$/,"");return strip(daemonHome)!==strip(clientHome)}function displayTaskTitle(task){return task.title||task.branch||task.worktreePath||task.repo||"scratch"}function serializeTask(task){return{id:task.id,title:displayTaskTitle(task),repo:task.repo,branch:task.branch,worktreePath:task.worktreePath,kind:task.kind??"task",...task.scratch?{scratch:!0}:{},...task.routine?{routine:task.routine}:{},status:task.status,pinned:task.pinned??!1,vendor:task.vendor,command:task.command,prStatus:task.prStatus,modelEffort:task.modelEffort,groupId:task.groupId,observedLanguage:task.observedLanguage,deletion:task.deletion,quotaResume:task.quotaResume,linkedWorkItem:task.linkedWorkItem,dispatcher:task.dispatcher,prompt:task.prompt,baseRef:task.baseRef,createdAt:task.createdAt,updatedAt:task.updatedAt}}function frameToLine(frame){return`${JSON.stringify(frame)}
|
|
291
291
|
`}var DAEMON_PROTOCOL_VERSION=4,MIN_COMPATIBLE_PROTOCOL_VERSION=2,BLOCKING_RPCS;var init_protocol=__esm(()=>{init_contracts();init_channels();BLOCKING_RPCS=new Set(["ui.prompt","task.land","workitem.start","automation.runNow","deferredPrompt.flush","deferredPrompt.release","task.ensureWorktree","task.ensureMain","worktree.discoverAdoptable","worktree.adopt","worktree.list","worktree.remove"])});var exports_client={};__export(exports_client,{RpcTimeoutError:()=>RpcTimeoutError,KobeDaemonClient:()=>KobeDaemonClient});import{connect}from"net";import{StringDecoder}from"string_decoder";function rpcTimeoutMs(){let raw=process.env.KOBE_RPC_TIMEOUT_MS?.trim();if(raw){let parsed=Number.parseInt(raw,10);if(Number.isFinite(parsed))return parsed}return 20000}class KobeDaemonClient{socketPath;socket=null;buffer="";nextId=1;pending=new Map;handlers=new Map;lifecycleHandlers=new Map;connecting=null;disposed=!1;constructor(socketPath){this.socketPath=socketPath}connect(){if(this.socket)return Promise.resolve();if(this.disposed)return Promise.reject(Error("daemon client disposed"));if(this.connecting)return this.connecting;let p=this.openSocket();this.connecting=p;let cleanup=()=>{if(this.connecting===p)this.connecting=null};return p.then(cleanup,cleanup),p}get isDisposed(){return this.disposed}close(){this.disposed=!0,this.socket?.end(),this.socket=null,this.failPending()}forceDisconnect(){let socket=this.socket;if(!socket)return;this.socket=null,socket.destroy(),this.failPending()}failPending(){if(this.pending.size===0)return;let err=Error("daemon connection closed");for(let pending of this.pending.values()){if(pending.timer)clearTimeout(pending.timer);pending.reject(err)}this.pending.clear()}on(name,handler){let set=this.handlers.get(name);if(!set)set=new Set,this.handlers.set(name,set);return set.add(handler),()=>{if(set?.delete(handler),set?.size===0)this.handlers.delete(name)}}onChannel(channel,handler){return this.on(channel,(frame)=>handler(frame.payload))}subscribe(opts={}){let payload={};if(opts.channels)payload.channels=opts.channels;if(opts.role)payload.role=opts.role;return this.request("subscribe",payload)}onLifecycle(name,handler){let set=this.lifecycleHandlers.get(name);if(!set)set=new Set,this.lifecycleHandlers.set(name,set);return set.add(handler),()=>{if(set?.delete(handler),set?.size===0)this.lifecycleHandlers.delete(name)}}async request(name,payload){await this.connect();let socket=this.socket;if(!socket)throw Error("daemon connection is not open");let id=String(this.nextId++),promise=new Promise((resolve3,reject)=>{let entry={resolve:(value)=>resolve3(value),reject},timeoutMs=rpcTimeoutMs();if(timeoutMs>0&&!BLOCKING_RPCS.has(name))entry.timer=setTimeout(()=>this.onRequestTimeout(id,name,timeoutMs),timeoutMs);this.pending.set(id,entry)});return socket.write(frameToLine({type:"request",id,name,payload})),promise}onRequestTimeout(id,name,timeoutMs){let pending=this.pending.get(id);if(!pending)return;this.pending.delete(id),pending.reject(new RpcTimeoutError(name,timeoutMs)),this.forceDisconnect(),this.emitLifecycle("close")}openSocket(){return new Promise((resolve3,reject)=>{let socket=connect(this.socketPath);this.socket=socket;let onConnect=()=>{socket.off("error",onError),socket.on("error",()=>socket.destroy()),resolve3()},onError=(err)=>{if(socket.off("connect",onConnect),this.socket===socket)this.socket=null;reject(err)};socket.once("connect",onConnect),socket.once("error",onError);let decoder=new StringDecoder("utf8");this.buffer="",socket.on("data",(chunk)=>this.onData(decoder.write(chunk))),socket.on("close",()=>this.onSocketClose(socket))})}onSocketClose(which){if(this.socket!==which)return;this.socket=null,this.failPending(),this.emitLifecycle("close")}emitLifecycle(name){for(let handler of this.lifecycleHandlers.get(name)??[])try{handler()}catch(err){console.error(`[rove] lifecycle handler for "${name}" threw:`,err)}}onData(chunk){this.buffer+=chunk;let nl=this.buffer.indexOf(`
|
|
292
292
|
`);while(nl!==-1){let line=this.buffer.slice(0,nl);if(this.buffer=this.buffer.slice(nl+1),line.trim().length>0)this.onLine(line);nl=this.buffer.indexOf(`
|
|
293
|
-
`)}}onLine(line){let frame;try{frame=JSON.parse(line)}catch(err){logClientError("client-frame",err);return}if(frame.type==="event"){this.emit(frame);return}if(frame.type!=="response")return;let pending=this.pending.get(frame.id);if(!pending)return;if(this.pending.delete(frame.id),pending.timer)clearTimeout(pending.timer);if(frame.error){let err=Error(frame.error.message);if(frame.error.name)err.name=frame.error.name;pending.reject(err)}else pending.resolve(frame.payload)}emit(frame){for(let handler of this.handlers.get(frame.name)??[])try{handler(frame)}catch(err){logClientError("client-event",err)}for(let handler of this.handlers.get("*")??[])try{handler(frame)}catch(err){logClientError("client-event",err)}}}var RpcTimeoutError;var init_client=__esm(()=>{init_protocol();init_client_log();RpcTimeoutError=class RpcTimeoutError extends Error{constructor(name,timeoutMs){super(`daemon rpc "${name}" timed out after ${timeoutMs}ms (daemon wedged?)`);this.name="RpcTimeoutError"}}});function daemonOf(ctx){if(!ctx.client)throw new ApiError("daemon required","BAD_DAEMON");return ctx.client}async function simpleRpc(ctx,name,payload){return daemonOf(ctx).request(name,payload)}async function handlePtyList(){let[{KobeDaemonClient:KobeDaemonClient2},{defaultPtyHostSocketPath:defaultPtyHostSocketPath2}]=await Promise.all([Promise.resolve().then(() => (init_client(),exports_client)),Promise.resolve().then(() => (init_paths(),exports_paths))]),client=new KobeDaemonClient2(defaultPtyHostSocketPath2());try{return await client.connect(),await client.request("pty.list",{})}catch{return{sessions:[]}}finally{client.close()}}var init_handler_helpers=__esm(()=>{init_types()});async function listAllEnginePresets(){loadPluginEngines();let presets=[...listEnginePresets()],seen=new Set(presets.map((p)=>p.id));for(let id of await installedEngineIds())if(!seen.has(id))presets.push(describePreset(id));return presets}async function setCommand(ctx){let command=ctx.args.require("command"),vendor=resolveCommandProtocol(command);return await simpleRpc(ctx,"task.setCommand",{taskId:ctx.args.require("task-id"),command,vendor}),{ok:!0,command,protocol:vendor,...vendor===GENERIC_PROTOCOL?{generic:!0}:{}}}function taskEngine(task){let command=task.command?.trim();if(command){let resolved=resolveCommandProtocol(command);if(resolved!==GENERIC_PROTOCOL)return resolved}return coerceVendorId(task.vendor)}async function setEffort(ctx){let taskId=ctx.args.require("task-id"),level=ctx.args.require("level").trim(),daemon=daemonOf(ctx),{task}=await daemon.request("task.get",{taskId}),engine=taskEngine(task),levels=engineEntry(engine).effortLevels??[];if(levels.length===0)throw new ApiError(`engine ${engine} declares no reasoning effort levels`,"BAD_EFFORT",{engine,hint:"Only engines with declared levels accept one (codex today). Check the task's engine with `get-task`.",nextCommandArgs:["api","get-task","--task-id",taskId]});if(!levels.includes(level))throw new ApiError(`engine ${engine} does not accept effort level ${JSON.stringify(level)} \u2014 it declares ${levels.join(", ")}`,"BAD_EFFORT",{engine,levels,hint:`Pass one of: ${levels.join(", ")}.`});return await simpleRpc(ctx,"task.setVendor",{taskId,vendor:engine,effort:level}),{ok:!0,taskId,engine,effort:level}}var ENGINE_LIST_VERB,SET_COMMAND_VERB,SET_EFFORT_VERB;var init_handlers_engines=__esm(()=>{init_account_detect();init_engine_presets();init_plugin_engines();init_registry();init_vendor();init_flags();init_handler_helpers();init_types();ENGINE_LIST_VERB={name:"engine-list",group:"discover",summary:"List every engine Rove can launch \u2014 built-ins, registered presets, the shipped contrib engines whose CLI is on PATH (gemini, opencode, cursor, grok, droid, amp), and engines contributed by enabled plugins \u2014 each with its RAW launch command, exactly as it runs. Copy one into `add --command` / `send --tab new --command` verbatim, or edit its flags first. `protocol` is the adapter Rove speaks to it (history, trust, delivery); `generic` = none, which still runs fine but loses transcript reads. Returns { engines }.",flags:[],offline:!0,handler:async()=>({engines:await listAllEnginePresets()})};SET_COMMAND_VERB={name:"set-command",group:"edit",summary:"Set a task's engine launch command (takes effect on the next session rebuild). The protocol Rove speaks to it is derived from the command \u2014 the result reports which one, `generic` when the command names no engine Rove knows.",flags:[F.taskId(),{...F.command(),required:!0}],handler:setCommand};SET_EFFORT_VERB={name:"set-effort",group:"edit",summary:"Set a task's reasoning effort level (takes effect on the next session rebuild). Rejected when the task's engine declares no levels, or does not declare THIS one \u2014 the error names the levels it does accept. Codex accepts none/low/medium/high/xhigh; claude has none.",flags:[F.taskId(),{name:"level",type:"string",required:!0,placeholder:"LEVEL",description:"Effort level the task's engine declares (codex: none, low, medium, high, xhigh)."}],handler:setEffort}});var package_default;var init_package=__esm(()=>{package_default={$schema:"https://json.schemastore.org/package.json",name:"@sma1lboy/rove",version:"0.9.101",description:"Rove \u2014 the agent multiplexer for your terminal. Run coding agents on parallel tasks with isolated worktrees and persistent sessions.",keywords:["terminal","tui","cli","multiplexer","ai-agents","coding-agent","ai-coding-assistant","agentic-ai","parallel-agents","git-worktree","claude-code","codex","llm","developer-tools"],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://rove.run",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:sandbox":"bun run scripts/dev-sandbox.ts run","dev:sandbox:reset":"bun run scripts/dev-sandbox.ts reset",build:"bun run scripts/build.ts",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","plugin-sandbox":"bun run scripts/plugin-sandbox.ts"},"//":"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.17","@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","react-devtools-core":"^7.0.1",typescript:"5.8.2",vitest:"2.1.9"},trustedDependencies:[]}});var exports_version={};__export(exports_version,{repoSlug:()=>repoSlug,releasePageUrl:()=>releasePageUrl,recommendedGlobalInstallCommand:()=>recommendedGlobalInstallCommand,owningNpmPrefix:()=>owningNpmPrefix,isNewerSemver:()=>isNewerSemver,fetchReleaseSummaries:()=>fetchReleaseSummaries,fetchReleaseNotesRange:()=>fetchReleaseNotesRange,fetchReleaseNotes:()=>fetchReleaseNotes,compareSemver:()=>compareSemver,checkLatestVersion:()=>checkLatestVersion,channelOf:()=>channelOf,breakingVersionsCrossed:()=>breakingVersionsCrossed,UPDATE_SCRIPT_URL:()=>UPDATE_SCRIPT_URL,UPDATE_COMMAND:()=>UPDATE_COMMAND,RELEASE_CHANNELS:()=>RELEASE_CHANNELS,PACKAGE_NAME:()=>PACKAGE_NAME,DEFAULT_RELEASE_CHANNEL:()=>DEFAULT_RELEASE_CHANNEL,CURRENT_VERSION:()=>CURRENT_VERSION2,BREAKING_VERSIONS:()=>BREAKING_VERSIONS});import{fileURLToPath as fileURLToPath2}from"url";function repoSlug(){let url=package_default.repository?.url;if(!url)return null;let m=url.match(/github\.com[:/]([^/]+)\/([^/.]+)/);if(!m||!m[1]||!m[2])return null;return`${m[1]}/${m[2]}`}function owningNpmPrefix(modulePath=fileURLToPath2(import.meta.url)){let at=modulePath.indexOf("/lib/node_modules/");if(at<=0)return null;return modulePath.slice(0,at)}function recommendedGlobalInstallCommand(prefix=owningNpmPrefix()){let target=`${PACKAGE_NAME}@latest`;return prefix===null?`npm install -g ${target}`:`npm install -g --prefix ${prefix} ${target}`}function breakingVersionsCrossed(from,to,breaking=BREAKING_VERSIONS){let[lo,hi]=compareSemver(from,to)<=0?[from,to]:[to,from];return breaking.filter((b)=>compareSemver(b,lo)>0&&compareSemver(b,hi)<=0)}function channelOf(version=CURRENT_VERSION2){return prereleaseOf(version)?.split(".")[0]==="nightly"?"nightly":DEFAULT_RELEASE_CHANNEL}async function fetchLatestFromRegistry(packageName,channel){let ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let encoded=packageName.replace("/","%2F"),res=await fetch(`https://registry.npmjs.org/${encoded}/${channel}`,{signal:ctrl.signal,headers:{accept:"application/json"}});if(!res.ok)return null;let body=await res.json();if(typeof body.version!=="string")return null;return body.version}catch{return null}finally{clearTimeout(timer)}}function isNewerSemver(latest,current){let core=compareSemver(latest,current);if(core!==0)return core>0;return comparePrerelease(prereleaseOf(latest),prereleaseOf(current))>0}function prereleaseOf(version){let dash=version.indexOf("-");return dash===-1?void 0:version.slice(dash+1)||void 0}function comparePrerelease(a,b){if(a===b)return 0;if(a===void 0)return 1;if(b===void 0)return-1;let aParts=a.split("."),bParts=b.split(".");for(let i=0;i<Math.max(aParts.length,bParts.length);i++){let av=aParts[i],bv=bParts[i];if(av===void 0)return-1;if(bv===void 0)return 1;if(av===bv)continue;let an=/^\d+$/.test(av)?Number.parseInt(av,10):null,bn=/^\d+$/.test(bv)?Number.parseInt(bv,10):null;if(an!==null&&bn!==null)return an>bn?1:-1;if(an!==null)return-1;if(bn!==null)return 1;return av>bv?1:-1}return 0}function compareSemver(aVersion,bVersion){let norm=(v)=>v.split("-")[0]??v,a=norm(aVersion).split(".").map((s)=>Number.parseInt(s,10)),b=norm(bVersion).split(".").map((s)=>Number.parseInt(s,10));for(let i=0;i<3;i++){let av=a[i]??0,bv=b[i]??0;if(Number.isNaN(av)||Number.isNaN(bv))return 0;if(av>bv)return 1;if(av<bv)return-1}return 0}async function checkLatestVersion(opts={}){let channel=opts.channel??channelOf(),fake=process.env.KOBE_FAKE_UPDATE;if(fake)return{current:CURRENT_VERSION2,latest:fake,hasUpdate:isNewerSemver(fake,CURRENT_VERSION2),channel};if(isDev()&&!opts.force)return null;let latest=await fetchLatestFromRegistry(PACKAGE_NAME,channel);if(!latest)return null;return{current:CURRENT_VERSION2,latest,hasUpdate:isNewerSemver(latest,CURRENT_VERSION2),channel}}function versionFromTagName(tagName){if(typeof tagName!=="string")return null;return tagName.match(/^v(\d+\.\d+\.\d+)$/)?.[1]??null}async function fetchReleaseNotes(version){let slug=repoSlug();if(!slug)return null;let tag=`v${version}`,ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let res=await fetch(`https://api.github.com/repos/${slug}/releases/tags/${tag}`,{signal:ctrl.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!res.ok)return null;let body=await res.json();if(typeof body.body!=="string"||typeof body.html_url!=="string")return null;return{body:body.body,url:body.html_url,version}}catch{return null}finally{clearTimeout(timer)}}async function fetchReleaseNotesRange(args){let slug=repoSlug();if(!slug)return[];let limit=args.limit??100,ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let res=await fetch(`https://api.github.com/repos/${slug}/releases?per_page=${limit}`,{signal:ctrl.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!res.ok)return[];let body=await res.json();if(!Array.isArray(body))return[];return body.map((release2)=>{let version=versionFromTagName(release2.tag_name);if(!version||typeof release2.html_url!=="string"||typeof release2.body!=="string")return null;if(compareSemver(version,args.current)<=0)return null;if(compareSemver(version,args.latest)>0)return null;return{version,url:release2.html_url,body:release2.body}}).filter((release2)=>release2!==null)}catch{return[]}finally{clearTimeout(timer)}}async function fetchReleaseSummaries(limit=12){let slug=repoSlug();if(!slug)return[];let ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let res=await fetch(`https://api.github.com/repos/${slug}/releases?per_page=${limit}`,{signal:ctrl.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!res.ok)return[];let body=await res.json();if(!Array.isArray(body))return[];return body.map((release2)=>{let version=versionFromTagName(release2.tag_name);if(!version||typeof release2.html_url!=="string")return null;return{version,url:release2.html_url}}).filter((release2)=>release2!==null)}catch{return[]}finally{clearTimeout(timer)}}function releasePageUrl(version){let slug=repoSlug();if(!slug)return null;return`https://github.com/${slug}/releases/tag/v${version}`}var CURRENT_VERSION2,PACKAGE_NAME,UPDATE_SCRIPT_URL="https://raw.githubusercontent.com/Sma1lboy/rove/main/scripts/update.sh",UPDATE_COMMAND,BREAKING_VERSIONS,FETCH_TIMEOUT_MS=3000,RELEASE_CHANNELS,DEFAULT_RELEASE_CHANNEL="latest";var init_version=__esm(()=>{init_package();init_env();CURRENT_VERSION2=package_default.version,PACKAGE_NAME=package_default.name;UPDATE_COMMAND=`curl -fsSL ${UPDATE_SCRIPT_URL} | sh`;BREAKING_VERSIONS=[];RELEASE_CHANNELS=["latest","nightly"]});function displayValues(f){if(!f.values)return;if(f.name!=="vendor")return f.values;let custom=getCustomEngineIds().filter((id)=>!f.values.includes(id));return custom.length>0?[...f.values,...custom]:f.values}function flagJson(f){let values=displayValues(f);return{name:f.name,type:f.type,required:f.required??!1,...values?{values}:{},...f.default!==void 0?{default:f.default}:{},...f.placeholder?{placeholder:f.placeholder}:{},description:f.description}}function verbSchema(v){return{name:v.name,group:v.group,summary:v.summary,offline:v.offline??!1,flags:v.flags.map(flagJson)}}function schemaIndex(){let cliName=activeCliName();return{apiVersion:API_SCHEMA_VERSION,kobeVersion:CURRENT_VERSION2,hint:`Compact index. Drill into ONE verb: \`${cliName} api schema --verb <name>\` (or \`${cliName} api <verb> --help\`). One group: \`--group <g>\`. Whole spec: \`--all\`.`,groups:VERB_GROUPS,verbs:VERBS.map((v)=>({name:v.name,group:v.group,summary:v.summary})),globalFlags:GLOBAL_FLAGS,aliases:VERB_ALIASES}}function groupSchema(group){let verbs=VERBS.filter((v)=>v.group===group);if(verbs.length===0)throw new ApiError(`unknown group: ${group}. Groups: ${Object.keys(VERB_GROUPS).join(", ")}`,"BAD_FLAG");return{group,verbs:verbs.map((v)=>({name:v.name,summary:v.summary}))}}function fullSchema(){return{apiVersion:API_SCHEMA_VERSION,kobeVersion:CURRENT_VERSION2,output:{success:"one JSON object on stdout, newline-terminated, exit 0",error:'{"error":{"message","code"}} on stderr, exit != 0',pretty:"--pretty indents stdout JSON"},globalFlags:GLOBAL_FLAGS,aliases:VERB_ALIASES,groups:VERB_GROUPS,verbs:VERBS.map(verbSchema)}}function flagSignature(verb){return verb.flags.map((f)=>{let meta=f.type==="enum"&&f.values?displayValues(f).join("|"):f.placeholder??(f.type==="bool"?"":"X"),core=meta?`--${f.name} ${meta}`:`--${f.name}`;return f.required?core:`[${core}]`}).join(" ")}function verbHelp(verb){let lines=[`${activeCliName()} api ${verb.name} ${flagSignature(verb)}`.trimEnd(),"",verb.summary,""],alias=Object.entries(VERB_ALIASES).find(([,canon])=>canon===verb.name)?.[0];if(alias)lines.push(`Alias: ${alias}`,"");if(verb.flags.length>0){lines.push("Flags:");for(let f of verb.flags){let req=f.required?" (required)":"",def=f.default!==void 0?` [default: ${f.default}]`:"",vals=f.type==="enum"&&f.values?` {${displayValues(f).join("|")}}`:"";lines.push(` --${f.name}${vals}${req}${def} ${f.description}`)}lines.push("")}return lines.push("Global: [--pretty] [--help]"),lines.join(`
|
|
293
|
+
`)}}onLine(line){let frame;try{frame=JSON.parse(line)}catch(err){logClientError("client-frame",err);return}if(frame.type==="event"){this.emit(frame);return}if(frame.type!=="response")return;let pending=this.pending.get(frame.id);if(!pending)return;if(this.pending.delete(frame.id),pending.timer)clearTimeout(pending.timer);if(frame.error){let err=Error(frame.error.message);if(frame.error.name)err.name=frame.error.name;pending.reject(err)}else pending.resolve(frame.payload)}emit(frame){for(let handler of this.handlers.get(frame.name)??[])try{handler(frame)}catch(err){logClientError("client-event",err)}for(let handler of this.handlers.get("*")??[])try{handler(frame)}catch(err){logClientError("client-event",err)}}}var RpcTimeoutError;var init_client=__esm(()=>{init_protocol();init_client_log();RpcTimeoutError=class RpcTimeoutError extends Error{constructor(name,timeoutMs){super(`daemon rpc "${name}" timed out after ${timeoutMs}ms (daemon wedged?)`);this.name="RpcTimeoutError"}}});function daemonOf(ctx){if(!ctx.client)throw new ApiError("daemon required","BAD_DAEMON");return ctx.client}async function simpleRpc(ctx,name,payload){return daemonOf(ctx).request(name,payload)}async function handlePtyList(){let[{KobeDaemonClient:KobeDaemonClient2},{defaultPtyHostSocketPath:defaultPtyHostSocketPath2}]=await Promise.all([Promise.resolve().then(() => (init_client(),exports_client)),Promise.resolve().then(() => (init_paths(),exports_paths))]),client=new KobeDaemonClient2(defaultPtyHostSocketPath2());try{return await client.connect(),await client.request("pty.list",{})}catch{return{sessions:[]}}finally{client.close()}}var init_handler_helpers=__esm(()=>{init_types()});async function listAllEnginePresets(){loadPluginEngines();let presets=[...listEnginePresets()],seen=new Set(presets.map((p)=>p.id));for(let id of await installedEngineIds())if(!seen.has(id))presets.push(describePreset(id));return presets}async function setCommand(ctx){let command=ctx.args.require("command"),vendor=resolveCommandProtocol(command);return await simpleRpc(ctx,"task.setCommand",{taskId:ctx.args.require("task-id"),command,vendor}),{ok:!0,command,protocol:vendor,...vendor===GENERIC_PROTOCOL?{generic:!0}:{}}}function taskEngine(task){let command=task.command?.trim();if(command){let resolved=resolveCommandProtocol(command);if(resolved!==GENERIC_PROTOCOL)return resolved}return coerceVendorId(task.vendor)}async function setEffort(ctx){let taskId=ctx.args.require("task-id"),level=ctx.args.require("level").trim(),daemon=daemonOf(ctx),{task}=await daemon.request("task.get",{taskId}),engine=taskEngine(task),levels=engineEntry(engine).effortLevels??[];if(levels.length===0)throw new ApiError(`engine ${engine} declares no reasoning effort levels`,"BAD_EFFORT",{engine,hint:"Only engines with declared levels accept one (codex today). Check the task's engine with `get-task`.",nextCommandArgs:["api","get-task","--task-id",taskId]});if(!levels.includes(level))throw new ApiError(`engine ${engine} does not accept effort level ${JSON.stringify(level)} \u2014 it declares ${levels.join(", ")}`,"BAD_EFFORT",{engine,levels,hint:`Pass one of: ${levels.join(", ")}.`});return await simpleRpc(ctx,"task.setVendor",{taskId,vendor:engine,effort:level}),{ok:!0,taskId,engine,effort:level}}var ENGINE_LIST_VERB,SET_COMMAND_VERB,SET_EFFORT_VERB;var init_handlers_engines=__esm(()=>{init_account_detect();init_engine_presets();init_plugin_engines();init_registry();init_vendor();init_flags();init_handler_helpers();init_types();ENGINE_LIST_VERB={name:"engine-list",group:"discover",summary:"List every engine Rove can launch \u2014 built-ins, registered presets, the shipped contrib engines whose CLI is on PATH (gemini, opencode, cursor, grok, droid, amp), and engines contributed by enabled plugins \u2014 each with its RAW launch command, exactly as it runs. Copy one into `add --command` / `send --tab new --command` verbatim, or edit its flags first. `protocol` is the adapter Rove speaks to it (history, trust, delivery); `generic` = none, which still runs fine but loses transcript reads. Returns { engines }.",flags:[],offline:!0,handler:async()=>({engines:await listAllEnginePresets()})};SET_COMMAND_VERB={name:"set-command",group:"edit",summary:"Set a task's engine launch command (takes effect on the next session rebuild). The protocol Rove speaks to it is derived from the command \u2014 the result reports which one, `generic` when the command names no engine Rove knows.",flags:[F.taskId(),{...F.command(),required:!0}],handler:setCommand};SET_EFFORT_VERB={name:"set-effort",group:"edit",summary:"Set a task's reasoning effort level (takes effect on the next session rebuild). Rejected when the task's engine declares no levels, or does not declare THIS one \u2014 the error names the levels it does accept. Codex accepts none/low/medium/high/xhigh; claude has none.",flags:[F.taskId(),{name:"level",type:"string",required:!0,placeholder:"LEVEL",description:"Effort level the task's engine declares (codex: none, low, medium, high, xhigh)."}],handler:setEffort}});var package_default;var init_package=__esm(()=>{package_default={$schema:"https://json.schemastore.org/package.json",name:"@sma1lboy/rove",version:"0.9.102",description:"Rove \u2014 the agent multiplexer for your terminal. Run coding agents on parallel tasks with isolated worktrees and persistent sessions.",keywords:["terminal","tui","cli","multiplexer","ai-agents","coding-agent","ai-coding-assistant","agentic-ai","parallel-agents","git-worktree","claude-code","codex","llm","developer-tools"],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://rove.run",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:sandbox":"bun run scripts/dev-sandbox.ts run","dev:sandbox:reset":"bun run scripts/dev-sandbox.ts reset",build:"bun run scripts/build.ts",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","plugin-sandbox":"bun run scripts/plugin-sandbox.ts"},"//":"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.17","@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","react-devtools-core":"^7.0.1",typescript:"5.8.2",vitest:"2.1.9"},trustedDependencies:[]}});var exports_version={};__export(exports_version,{repoSlug:()=>repoSlug,releasePageUrl:()=>releasePageUrl,recommendedGlobalInstallCommand:()=>recommendedGlobalInstallCommand,owningNpmPrefix:()=>owningNpmPrefix,isNewerSemver:()=>isNewerSemver,fetchReleaseSummaries:()=>fetchReleaseSummaries,fetchReleaseNotesRange:()=>fetchReleaseNotesRange,fetchReleaseNotes:()=>fetchReleaseNotes,compareSemver:()=>compareSemver,checkLatestVersion:()=>checkLatestVersion,channelOf:()=>channelOf,breakingVersionsCrossed:()=>breakingVersionsCrossed,UPDATE_SCRIPT_URL:()=>UPDATE_SCRIPT_URL,UPDATE_COMMAND:()=>UPDATE_COMMAND,RELEASE_CHANNELS:()=>RELEASE_CHANNELS,PACKAGE_NAME:()=>PACKAGE_NAME,DEFAULT_RELEASE_CHANNEL:()=>DEFAULT_RELEASE_CHANNEL,CURRENT_VERSION:()=>CURRENT_VERSION2,BREAKING_VERSIONS:()=>BREAKING_VERSIONS});import{fileURLToPath as fileURLToPath2}from"url";function repoSlug(){let url=package_default.repository?.url;if(!url)return null;let m=url.match(/github\.com[:/]([^/]+)\/([^/.]+)/);if(!m||!m[1]||!m[2])return null;return`${m[1]}/${m[2]}`}function owningNpmPrefix(modulePath=fileURLToPath2(import.meta.url)){let at=modulePath.indexOf("/lib/node_modules/");if(at<=0)return null;return modulePath.slice(0,at)}function recommendedGlobalInstallCommand(prefix=owningNpmPrefix()){let target=`${PACKAGE_NAME}@latest`;return prefix===null?`npm install -g ${target}`:`npm install -g --prefix ${prefix} ${target}`}function breakingVersionsCrossed(from,to,breaking=BREAKING_VERSIONS){let[lo,hi]=compareSemver(from,to)<=0?[from,to]:[to,from];return breaking.filter((b)=>compareSemver(b,lo)>0&&compareSemver(b,hi)<=0)}function channelOf(version=CURRENT_VERSION2){return prereleaseOf(version)?.split(".")[0]==="nightly"?"nightly":DEFAULT_RELEASE_CHANNEL}async function fetchLatestFromRegistry(packageName,channel){let ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let encoded=packageName.replace("/","%2F"),res=await fetch(`https://registry.npmjs.org/${encoded}/${channel}`,{signal:ctrl.signal,headers:{accept:"application/json"}});if(!res.ok)return null;let body=await res.json();if(typeof body.version!=="string")return null;return body.version}catch{return null}finally{clearTimeout(timer)}}function isNewerSemver(latest,current){let core=compareSemver(latest,current);if(core!==0)return core>0;return comparePrerelease(prereleaseOf(latest),prereleaseOf(current))>0}function prereleaseOf(version){let dash=version.indexOf("-");return dash===-1?void 0:version.slice(dash+1)||void 0}function comparePrerelease(a,b){if(a===b)return 0;if(a===void 0)return 1;if(b===void 0)return-1;let aParts=a.split("."),bParts=b.split(".");for(let i=0;i<Math.max(aParts.length,bParts.length);i++){let av=aParts[i],bv=bParts[i];if(av===void 0)return-1;if(bv===void 0)return 1;if(av===bv)continue;let an=/^\d+$/.test(av)?Number.parseInt(av,10):null,bn=/^\d+$/.test(bv)?Number.parseInt(bv,10):null;if(an!==null&&bn!==null)return an>bn?1:-1;if(an!==null)return-1;if(bn!==null)return 1;return av>bv?1:-1}return 0}function compareSemver(aVersion,bVersion){let norm=(v)=>v.split("-")[0]??v,a=norm(aVersion).split(".").map((s)=>Number.parseInt(s,10)),b=norm(bVersion).split(".").map((s)=>Number.parseInt(s,10));for(let i=0;i<3;i++){let av=a[i]??0,bv=b[i]??0;if(Number.isNaN(av)||Number.isNaN(bv))return 0;if(av>bv)return 1;if(av<bv)return-1}return 0}async function checkLatestVersion(opts={}){let channel=opts.channel??channelOf(),fake=process.env.KOBE_FAKE_UPDATE;if(fake)return{current:CURRENT_VERSION2,latest:fake,hasUpdate:isNewerSemver(fake,CURRENT_VERSION2),channel};if(isDev()&&!opts.force)return null;let latest=await fetchLatestFromRegistry(PACKAGE_NAME,channel);if(!latest)return null;return{current:CURRENT_VERSION2,latest,hasUpdate:isNewerSemver(latest,CURRENT_VERSION2),channel}}function versionFromTagName(tagName){if(typeof tagName!=="string")return null;return tagName.match(/^v(\d+\.\d+\.\d+)$/)?.[1]??null}async function fetchReleaseNotes(version){let slug=repoSlug();if(!slug)return null;let tag=`v${version}`,ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let res=await fetch(`https://api.github.com/repos/${slug}/releases/tags/${tag}`,{signal:ctrl.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!res.ok)return null;let body=await res.json();if(typeof body.body!=="string"||typeof body.html_url!=="string")return null;return{body:body.body,url:body.html_url,version}}catch{return null}finally{clearTimeout(timer)}}async function fetchReleaseNotesRange(args){let slug=repoSlug();if(!slug)return[];let limit=args.limit??100,ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let res=await fetch(`https://api.github.com/repos/${slug}/releases?per_page=${limit}`,{signal:ctrl.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!res.ok)return[];let body=await res.json();if(!Array.isArray(body))return[];return body.map((release2)=>{let version=versionFromTagName(release2.tag_name);if(!version||typeof release2.html_url!=="string"||typeof release2.body!=="string")return null;if(compareSemver(version,args.current)<=0)return null;if(compareSemver(version,args.latest)>0)return null;return{version,url:release2.html_url,body:release2.body}}).filter((release2)=>release2!==null)}catch{return[]}finally{clearTimeout(timer)}}async function fetchReleaseSummaries(limit=12){let slug=repoSlug();if(!slug)return[];let ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let res=await fetch(`https://api.github.com/repos/${slug}/releases?per_page=${limit}`,{signal:ctrl.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!res.ok)return[];let body=await res.json();if(!Array.isArray(body))return[];return body.map((release2)=>{let version=versionFromTagName(release2.tag_name);if(!version||typeof release2.html_url!=="string")return null;return{version,url:release2.html_url}}).filter((release2)=>release2!==null)}catch{return[]}finally{clearTimeout(timer)}}function releasePageUrl(version){let slug=repoSlug();if(!slug)return null;return`https://github.com/${slug}/releases/tag/v${version}`}var CURRENT_VERSION2,PACKAGE_NAME,UPDATE_SCRIPT_URL="https://raw.githubusercontent.com/Sma1lboy/rove/main/scripts/update.sh",UPDATE_COMMAND,BREAKING_VERSIONS,FETCH_TIMEOUT_MS=3000,RELEASE_CHANNELS,DEFAULT_RELEASE_CHANNEL="latest";var init_version=__esm(()=>{init_package();init_env();CURRENT_VERSION2=package_default.version,PACKAGE_NAME=package_default.name;UPDATE_COMMAND=`curl -fsSL ${UPDATE_SCRIPT_URL} | sh`;BREAKING_VERSIONS=[];RELEASE_CHANNELS=["latest","nightly"]});function displayValues(f){if(!f.values)return;if(f.name!=="vendor")return f.values;let custom=getCustomEngineIds().filter((id)=>!f.values.includes(id));return custom.length>0?[...f.values,...custom]:f.values}function flagJson(f){let values=displayValues(f);return{name:f.name,type:f.type,required:f.required??!1,...values?{values}:{},...f.default!==void 0?{default:f.default}:{},...f.placeholder?{placeholder:f.placeholder}:{},description:f.description}}function verbSchema(v){return{name:v.name,group:v.group,summary:v.summary,offline:v.offline??!1,flags:v.flags.map(flagJson)}}function schemaIndex(){let cliName=activeCliName();return{apiVersion:API_SCHEMA_VERSION,kobeVersion:CURRENT_VERSION2,hint:`Compact index. Drill into ONE verb: \`${cliName} api schema --verb <name>\` (or \`${cliName} api <verb> --help\`). One group: \`--group <g>\`. Whole spec: \`--all\`.`,groups:VERB_GROUPS,verbs:VERBS.map((v)=>({name:v.name,group:v.group,summary:v.summary})),globalFlags:GLOBAL_FLAGS,aliases:VERB_ALIASES}}function groupSchema(group){let verbs=VERBS.filter((v)=>v.group===group);if(verbs.length===0)throw new ApiError(`unknown group: ${group}. Groups: ${Object.keys(VERB_GROUPS).join(", ")}`,"BAD_FLAG");return{group,verbs:verbs.map((v)=>({name:v.name,summary:v.summary}))}}function fullSchema(){return{apiVersion:API_SCHEMA_VERSION,kobeVersion:CURRENT_VERSION2,output:{success:"one JSON object on stdout, newline-terminated, exit 0",error:'{"error":{"message","code"}} on stderr, exit != 0',pretty:"--pretty indents stdout JSON"},globalFlags:GLOBAL_FLAGS,aliases:VERB_ALIASES,groups:VERB_GROUPS,verbs:VERBS.map(verbSchema)}}function flagSignature(verb){return verb.flags.map((f)=>{let meta=f.type==="enum"&&f.values?displayValues(f).join("|"):f.placeholder??(f.type==="bool"?"":"X"),core=meta?`--${f.name} ${meta}`:`--${f.name}`;return f.required?core:`[${core}]`}).join(" ")}function verbHelp(verb){let lines=[`${activeCliName()} api ${verb.name} ${flagSignature(verb)}`.trimEnd(),"",verb.summary,""],alias=Object.entries(VERB_ALIASES).find(([,canon])=>canon===verb.name)?.[0];if(alias)lines.push(`Alias: ${alias}`,"");if(verb.flags.length>0){lines.push("Flags:");for(let f of verb.flags){let req=f.required?" (required)":"",def=f.default!==void 0?` [default: ${f.default}]`:"",vals=f.type==="enum"&&f.values?` {${displayValues(f).join("|")}}`:"";lines.push(` --${f.name}${vals}${req}${def} ${f.description}`)}lines.push("")}return lines.push("Global: [--pretty] [--help]"),lines.join(`
|
|
294
294
|
`)}function apiUsage(){let cliName=activeCliName(),rows=VERBS.map((v)=>` ${v.name.padEnd(18)} ${v.summary}`);return[`usage: ${cliName} api <verb> [flags] [--pretty] [--help]`,"",`Explore the full surface (names, flags, types) with: ${cliName} api schema`,"","verbs:",...rows,"","Output is one JSON object on stdout (exit 0); errors are JSON on stderr (exit != 0)."].join(`
|
|
295
|
-
`)}var API_SCHEMA_VERSION=2,GLOBAL_FLAGS;var init_schema=__esm(()=>{init_repos();init_version();init_rename_compat();init_types();init_verbs();GLOBAL_FLAGS=[{name:"pretty",type:"bool",description:"Pretty-print stdout JSON."},{name:"help",type:"bool",description:"Show usage for the verb and exit."}]});var IllegalTransitionError,TaskNotFoundError,CannotDeleteMainTaskError,DIRTY_WORKTREE_CODE="DIRTY_WORKTREE",DirtyWorktreeError,WorktreeRemoveFailedError,TASK_DELETING_CODE="TASK_DELETING",TaskDeletingError,MAIN_CHECKOUT_DIRTY_CODE="MAIN_CHECKOUT_DIRTY",MainCheckoutDirtyError,EMPTY_BRANCH_CODE="EMPTY_BRANCH",EmptyBranchError,EMPTY_BRANCH_DIRTY_WORKTREE_CODE="EMPTY_BRANCH_DIRTY_WORKTREE",EmptyBranchDirtyWorktreeError,MISSING_REF_CODE="MISSING_REF",MissingRefError,LAND_CONFLICT_CODE="LAND_CONFLICT",LandConflictError;var init_errors=__esm(()=>{IllegalTransitionError=class IllegalTransitionError extends Error{from;to;taskId;constructor(from,to,taskId){super(`illegal transition for task ${taskId}: ${from} -> ${to}`);this.from=from;this.to=to;this.taskId=taskId;this.name="IllegalTransitionError"}};TaskNotFoundError=class TaskNotFoundError extends Error{constructor(taskId){super(`task not found: ${taskId}`);this.name="TaskNotFoundError"}};CannotDeleteMainTaskError=class CannotDeleteMainTaskError extends Error{constructor(){super("cannot delete a main task; remove the repo from saved repos instead");this.name="CannotDeleteMainTaskError"}};DirtyWorktreeError=class DirtyWorktreeError extends Error{taskId;constructor(taskId){super(`${DIRTY_WORKTREE_CODE}: task ${taskId} worktree has uncommitted or untracked changes`);this.taskId=taskId;this.name="DirtyWorktreeError"}};WorktreeRemoveFailedError=class WorktreeRemoveFailedError extends Error{taskId;cause;constructor(taskId,cause){super(`failed to remove worktree for task ${taskId}: ${errorMessage(cause)}`);this.taskId=taskId;this.cause=cause;this.name="WorktreeRemoveFailedError"}};TaskDeletingError=class TaskDeletingError extends Error{taskId;constructor(taskId){super(`${TASK_DELETING_CODE}: task ${taskId} is being deleted`);this.taskId=taskId;this.name="TaskDeletingError"}};MainCheckoutDirtyError=class MainCheckoutDirtyError extends Error{repo;dir;constructor(repo,dir){super(`${MAIN_CHECKOUT_DIRTY_CODE}: base checkout at ${dir} has uncommitted changes; commit them before landing (never git stash \u2014 the stash stack is shared by every worktree of this repo)`);this.repo=repo;this.dir=dir;this.name="MainCheckoutDirtyError"}};EmptyBranchError=class EmptyBranchError extends Error{branch;landedOn;constructor(branch,landedOn){super(`${EMPTY_BRANCH_CODE}: '${branch}' has no commits ahead of '${landedOn}' \u2014 landing it would be a no-op (the worker may not have delivered anything)`);this.branch=branch;this.landedOn=landedOn;this.name="EmptyBranchError"}};EmptyBranchDirtyWorktreeError=class EmptyBranchDirtyWorktreeError extends Error{branch;landedOn;worktreePath;files;constructor(branch,landedOn,worktreePath,files){let list=files.length>0?files.join(", "):"(none reported)";super(`${EMPTY_BRANCH_DIRTY_WORKTREE_CODE}: '${branch}' has no commits ahead of '${landedOn}' but its worktree ${worktreePath} has uncommitted changes (${list}) \u2014 commit them in the worktree first, then land again`);this.branch=branch;this.landedOn=landedOn;this.worktreePath=worktreePath;this.files=files;this.name="EmptyBranchDirtyWorktreeError"}};MissingRefError=class MissingRefError extends Error{branch;landedOn;dir;constructor(branch,landedOn,dir){super(`${MISSING_REF_CODE}: '${branch}' does not resolve in the base repo at ${dir} (comparing against '${landedOn}') \u2014 the branch was renamed or deleted outside Rove; re-point the task with \`rove api set-branch\` or recreate the branch`);this.branch=branch;this.landedOn=landedOn;this.dir=dir;this.name="MissingRefError"}};LandConflictError=class LandConflictError extends Error{taskId;branch;files;constructor(taskId,branch,files){let list=files.length>0?files.join(", "):"(none reported)";super(`${LAND_CONFLICT_CODE}: merging '${branch}' hit conflicts, merge aborted \u2014 conflicted files: ${list}`);this.taskId=taskId;this.branch=branch;this.files=files;this.name="LandConflictError"}}});import{readFile as readFile8,stat as stat8,unlink as unlink5}from"fs/promises";function listenOnUnixSocket(server,socketPath){return new Promise((resolve3,reject)=>{let evented=server;evented.once("error",reject),server.listen(socketPath,()=>{evented.removeListener("error",reject),resolve3()})})}async function readPidFile(pidPath){try{let raw=await readFile8(pidPath,"utf8"),pid=Number(raw.trim());return Number.isFinite(pid)?pid:null}catch{return null}}function createSocketOwnershipGuard(options){let watchMs=options.watchMs??DEFAULT_SOCKET_WATCH_MS,stamp=null,lost=!1,timer=null,currentStamp=async()=>{try{let s=await stat8(options.socketPath);return{dev:s.dev,ino:s.ino}}catch(err){return err.code==="ENOENT"?null:"error"}},stopTimer=()=>{if(timer)clearInterval(timer);timer=null},verify=async()=>{if(stamp===null||lost)return;let now=await currentStamp();if(now==="error")return;if(now===null||now.dev!==stamp.dev||now.ino!==stamp.ino)lost=!0},check=async()=>{if(stamp===null||lost)return;if(await verify(),!lost)return;stopTimer(),options.onLost()};return{async arm(){let now=await currentStamp();if(now===null||now==="error")return;if(stamp=now,watchMs>0)timer=setInterval(()=>void check(),watchMs),timer.unref?.()},async release(server){if(stopTimer(),await verify(),stamp===null||lost){server.unref();return}await new Promise((resolve3)=>server.close(()=>resolve3())),await unlink5(options.socketPath).catch(()=>{}),await unlink5(options.pidPath).catch(()=>{})}}}var DEFAULT_SOCKET_WATCH_MS=5000;var init_socket_guard=()=>{};import{unlink as unlink6}from"fs/promises";function isProcessAlive2(pid){try{return process.kill(pid,0),!0}catch(err){return err.code==="EPERM"}}async function stopDaemonProcess(socketPath,pidPath){let oldPid=await readPidFile(pidPath),targetPid=oldPid!==null&&oldPid!==process.pid?oldPid:null,wasAlive=targetPid!==null&&isProcessAlive2(targetPid),method=wasAlive?"graceful":"absent",client=new KobeDaemonClient(socketPath),stopRequest=client.request("daemon.stop").catch(()=>{return}),stopTimeout=new Promise((resolve3)=>setTimeout(resolve3,2000));if(await Promise.race([stopRequest,stopTimeout]),client.close(),wasAlive&&targetPid!==null){let deadline=Date.now()+5000,escalated=!1;while(Date.now()<deadline){try{process.kill(targetPid,0)}catch{break}if(!escalated&&Date.now()-(deadline-5000)>2000){try{process.kill(targetPid,"SIGTERM")}catch{}method="sigterm",escalated=!0}await new Promise((resolve3)=>setTimeout(resolve3,50))}try{process.kill(targetPid,0),process.kill(targetPid,"SIGKILL"),method="sigkill",await new Promise((resolve3)=>setTimeout(resolve3,100))}catch{}}let survivor=await readPidFile(pidPath);if(survivor!==null&&survivor!==process.pid&&isProcessAlive2(survivor))return{pid:oldPid,method};return await unlink6(socketPath).catch(()=>{}),await unlink6(pidPath).catch(()=>{}),{pid:oldPid,method}}var init_lifecycle=__esm(()=>{init_client();init_socket_guard()});var exports_daemon_process={};__export(exports_daemon_process,{tryAcquireSpawnLock:()=>tryAcquireSpawnLock,testDaemonResponds:()=>testDaemonResponds,spawnDetachedDaemon:()=>spawnDetachedDaemon,resolveKobeSpawn:()=>resolveKobeSpawn,probeDaemonSocket:()=>probeDaemonSocket,isStaleInstallError:()=>isStaleInstallError,ensureDaemonReachable:()=>ensureDaemonReachable,detachOptions:()=>detachOptions,connectOrStartDaemon:()=>connectOrStartDaemon,connectIfRunning:()=>connectIfRunning,autospawnDaemonEnv:()=>autospawnDaemonEnv,StaleInstallError:()=>StaleInstallError});import{spawn as spawn2}from"child_process";import{closeSync as closeSync3,existsSync as existsSync9,mkdirSync as mkdirSync8,openSync as openSync3,statSync as statSync4,unlinkSync as unlinkSync5}from"fs";import{dirname as dirname9,resolve as resolve3}from"path";import{fileURLToPath as fileURLToPath3}from"url";function detachOptions(platform=process.platform){return platform==="win32"?{windowsHide:!0}:{detached:!0}}function spawnDetachedDaemon(command,args,env,logPath){let stdio="ignore",logFd;try{mkdirSync8(dirname9(logPath),{recursive:!0}),logFd=openSync3(logPath,"a"),stdio=["ignore",logFd,logFd]}catch{stdio="ignore"}if(spawn2(command,[...args],{...detachOptions(),stdio,env}).unref(),logFd!==void 0)try{closeSync3(logFd)}catch{}}function insideEngineSession(env=process.env){return typeof env.KOBE_TASK_ID==="string"&&env.KOBE_TASK_ID!==""}function autospawnDaemonEnv(env=process.env){let{KOBE_TASK_ID:_task,KOBE_TAB_ID:_tab,KOBE_TUI:_tui,KOBE_TERMINAL_PTY:_pty,ROVE_TASK_ID:_roveTask,ROVE_TAB_ID:_roveTab,ROVE_TUI:_roveTui,ROVE_TERMINAL_PTY:_rovePty,...rest}=env;return{...rest,KOBE_DAEMON_AUTOSPAWNED:"1",ROVE_DAEMON_AUTOSPAWNED:"1"}}function tryAcquireSpawnLock(lockPath,staleMs=SPAWN_LOCK_STALE_MS){let create=()=>{return mkdirSync8(dirname9(lockPath),{recursive:!0}),closeSync3(openSync3(lockPath,"wx")),!0};try{return create()}catch{try{if(Date.now()-statSync4(lockPath).mtimeMs<=staleMs)return!1;return unlinkSync5(lockPath),create()}catch{return!1}}}async function ensureDaemonReachable(resolveSpawn=resolveKobeSpawn){let socketPath=defaultDaemonSocketPath(),state=await probeDaemonSocket(socketPath);if(state==="alive")return socketPath;if(state==="wedged"&&insideEngineSession())throw Error(`rove: daemon at ${socketPath} is not answering hello (busy or wedged); not restarting it from inside an engine session \u2014 retry, or run \`rove daemon restart\` from a regular shell`);let lockPath=`${defaultDaemonPidPath()}.spawn-lock`;if(!tryAcquireSpawnLock(lockPath)){let deadline=Date.now()+SPAWN_LOCK_WAIT_MS;while(Date.now()<deadline){if(await testDaemonResponds(socketPath))return socketPath;await new Promise((resolveTimer)=>setTimeout(resolveTimer,150))}throw Error(`rove: another process is starting the daemon but it never became reachable at ${socketPath}; check ${defaultDaemonLogPath()} or run \`rove doctor\``)}try{if(await probeDaemonSocket(socketPath)==="alive")return socketPath;let livePid=await readPidFile(defaultDaemonPidPath());if(livePid!==null&&livePid!==process.pid&&isProcessAlive2(livePid)){let deadline2=Date.now()+BUSY_DAEMON_GRACE_MS;while(Date.now()<deadline2){if(await new Promise((resolveTimer)=>setTimeout(resolveTimer,250)),await testDaemonResponds(socketPath))return socketPath;if(!isProcessAlive2(livePid))break}}let[command,...args]=resolveSpawn(DAEMON_START_ARGS);await stopDaemonProcess(socketPath,defaultDaemonPidPath()).catch(()=>{}),spawnDetachedDaemon(command,args,autospawnDaemonEnv(),defaultDaemonLogPath());let deadline=Date.now()+5000;while(Date.now()<deadline){if(await testDaemonResponds(socketPath))return socketPath;await new Promise((resolveTimer)=>setTimeout(resolveTimer,100))}throw Error(`rove: daemon did not start (or stayed wedged) at ${socketPath}; check ${defaultDaemonLogPath()} or run \`rove doctor\``)}finally{try{unlinkSync5(lockPath)}catch{}}}async function connectOrStartDaemon(){let socketPath=await ensureDaemonReachable(),client=new KobeDaemonClient(socketPath);return await client.connect(),client}async function connectIfRunning(){let socketPath=defaultDaemonSocketPath();if(!await testDaemonResponds(socketPath))return null;let client=new KobeDaemonClient(socketPath);return await client.connect(),client}async function probeDaemonSocket(socketPath,timeoutMs=DAEMON_HELLO_TIMEOUT_MS){let probe=new KobeDaemonClient(socketPath);try{await probe.connect()}catch{return probe.close(),"absent"}let droppedByPeer=!1,offClose=probe.onLifecycle("close",()=>{droppedByPeer=!0}),replied=probe.request("hello",{protocolVersion:DAEMON_PROTOCOL_VERSION}).then(()=>!0).catch(()=>!0),timer,timedOut=new Promise((resolve4)=>{timer=setTimeout(()=>resolve4(!1),timeoutMs)}),settled=await Promise.race([replied,timedOut]);if(timer)clearTimeout(timer);if(offClose(),probe.close(),droppedByPeer)return"absent";return settled?"alive":"wedged"}async function testDaemonResponds(socketPath,timeoutMs=DAEMON_HELLO_TIMEOUT_MS){return await probeDaemonSocket(socketPath,timeoutMs)==="alive"}function isStaleInstallError(err){return err instanceof Error&&err.name==="StaleInstallError"}function resolveKobeSpawn(subcommand,env=process.env,moduleFile=fileURLToPath3(import.meta.url)){let here=moduleFile;if(here.startsWith("/$bunfs")||here.startsWith("B:\\~BUN"))return[process.execPath,...subcommand];let dir=dirname9(here),cliName=env.ROVE_INVOKED_AS===ROVE_PRODUCT_NAME?ROVE_PRODUCT_NAME:LEGACY_KOBE_PRODUCT_NAME,candidates=[resolve3(dir,`../cli/${cliName}.ts`),resolve3(dir,`../../../kobe/src/cli/${cliName}.ts`),resolve3(dir,`../cli/${cliName}.js`),resolve3(dir,"../cli/index.ts"),resolve3(dir,"../../../kobe/src/cli/index.ts"),resolve3(dir,"../cli/index.js")],entry=candidates.find((candidate)=>existsSync9(candidate));if(entry)return[process.execPath,entry,...subcommand];throw new StaleInstallError(cliName,dir,candidates)}var DAEMON_START_ARGS,DAEMON_HELLO_TIMEOUT_MS=3000,BUSY_DAEMON_GRACE_MS=15000,SPAWN_LOCK_STALE_MS=40000,SPAWN_LOCK_WAIT_MS=30000,StaleInstallError;var init_daemon_process=__esm(()=>{init_lifecycle();init_paths();init_protocol();init_socket_guard();init_client();DAEMON_START_ARGS=["daemon","start"];StaleInstallError=class StaleInstallError extends Error{candidates;constructor(cliName,dir,candidates){super(`${cliName}: this process is running from an install that no longer exists on disk \u2014 no ${cliName} entry near ${dir} (checked ${candidates.join(", ")}). Reinstall (\`npm install -g @sma1lboy/rove\`) and relaunch Rove.`);this.name="StaleInstallError",this.candidates=candidates}}});import{existsSync as existsSync10}from"fs";import{rename as rename3,rm as rm2}from"fs/promises";import{basename as basename4,delimiter,dirname as dirname10,join as join12,resolve as resolve4}from"path";import{fileURLToPath as fileURLToPath4}from"url";function resolveNodeBinary(env=process.env,exists=existsSync10,platform=process.platform){let dirs=(env.PATH??env.Path??"").split(delimiter).filter((dir)=>dir.length>0),suffixes=platform==="win32"?(env.PATHEXT??".EXE;.CMD;.BAT").split(";").filter((ext)=>ext.length>0):[""];for(let dir of dirs)for(let suffix of suffixes){let candidate=join12(dir,`node${suffix}`);if(exists(candidate))return candidate}return null}async function bundleWithBun(entry,outFile,io){let{build,rename:move,discard}=io??{build:(config)=>Bun.build(config),rename:rename3,discard:(path15)=>rm2(path15,{force:!0})},staging=`${outFile}.${process.pid}.tmp`,built=await build({entrypoints:[entry],outdir:dirname10(staging),target:"node",format:"esm",naming:basename4(staging),external:["node-pty"]});if(!built.success)return await discard(staging).catch(()=>{}),built;return await move(staging,outFile),built}async function resolveNodePtyHostSpawn(deps={}){let platform=deps.platform??process.platform;if(platform!=="win32")return null;let here=deps.moduleDir??dirname10(fileURLToPath4(import.meta.url)),exists=deps.exists??existsSync10,bundle=deps.bundle??bundleWithBun,node=resolveNodeBinary(deps.env??process.env,exists,platform);if(!node)throw Error("Rove: the Windows PTY host runs under node, but no node was found on PATH. "+"Install Node.js (https://nodejs.org) and restart Rove \u2014 engine and terminal sessions cannot start without it.");let packaged=resolve4(here,PTY_HOST_NODE_BUNDLE);if(exists(packaged))return[node,packaged];let entry=resolve4(here,PTY_HOST_NODE_ENTRY);if(!exists(entry))throw Error(`Rove: no Windows PTY host found (looked for ${packaged} and ${entry})`);let cache3=resolve4(here,PTY_HOST_NODE_DEV_CACHE),built=await bundle(entry,cache3);if(!built.success)throw Error(`Rove: could not build the Windows PTY host \u2014 ${built.logs.map(String).join("; ")}`);return[node,cache3]}async function ensurePtyHostReachable(){let socketPath=defaultPtyHostSocketPath();if(await testDaemonResponds(socketPath))return socketPath;await stopDaemonProcess(socketPath,defaultPtyHostPidPath()).catch(()=>{});let[command,...args]=await resolveNodePtyHostSpawn()??resolveKobeSpawn(PTY_HOST_START_ARGS);spawnDetachedDaemon(command??"",args,process.env,defaultPtyHostLogPath());let deadline=Date.now()+5000;while(Date.now()<deadline){if(await testDaemonResponds(socketPath))return socketPath;await new Promise((resolveTimer)=>setTimeout(resolveTimer,100))}throw Error(`rove: pty host did not start (or stayed wedged) at ${socketPath}`)}async function sweepPtyHostSessions(liveTaskIds,homeDir2){let socketPath=defaultPtyHostSocketPath(homeDir2),client=new KobeDaemonClient(socketPath);try{await client.connect(),await client.request("pty.sweep",{liveTaskIds})}catch{}finally{client.close()}}async function ptyHostHasLiveSessions(homeDir2){let client=new KobeDaemonClient(defaultPtyHostSocketPath(homeDir2));try{return await client.connect(),(await client.request("pty.list")).sessions?.some((s)=>s.alive===!0)??!1}catch{return!1}finally{client.close()}}var PTY_HOST_START_ARGS,PTY_HOST_NODE_BUNDLE="pty-host-node.mjs",PTY_HOST_NODE_DEV_CACHE="../../.cache/pty-host-node.mjs",PTY_HOST_NODE_ENTRY="../daemon/pty-host-node-entry.ts";var init_pty_process=__esm(()=>{init_lifecycle();init_paths();init_daemon_process();init_client();PTY_HOST_START_ARGS=["pty-host"]});function composerGatePreferenceOn(store){return store.get(COMPOSER_GATE_KEY,!0)!==!1}function toggleComposerGatePreference(store,onDisabled){let next=!composerGatePreferenceOn(store);if(store.set(COMPOSER_GATE_KEY,next),!store.flush())return store.set(COMPOSER_GATE_KEY,!next),"persist-failed";if(!next)onDisabled?.();return next?"enabled":"disabled"}function composerGateEnabled(){return getPersistedBool(COMPOSER_GATE_KEY,!0)}var COMPOSER_GATE_KEY="delivery.composerGate";var init_composer_gate=__esm(()=>{init_store()});function normalizeColor(value){return typeof value==="string"&&HEX_COLOR_RE.test(value)?value.toLowerCase():null}function parseTerminalDefaultColors(value){if(typeof value!=="object"||value===null||Array.isArray(value))return null;let raw=value,foreground=normalizeColor(raw.foreground),background=normalizeColor(raw.background);return foreground&&background?{foreground,background}:null}function oscRgb(color){let hex=color.slice(1);return[hex.slice(0,2),hex.slice(2,4),hex.slice(4,6)].map((component)=>component.repeat(2)).join("/")}function formatDefaultColorReply(slot,colors){let color=slot===10?colors.foreground:colors.background;return`\x1B]${slot};rgb:${oscRgb(color)}\x1B\\`}function trailingQueryPrefix(text){let maxLength=QUERY_PREFIXES[0].length+1,start=Math.max(0,text.length-maxLength);for(let index=start;index<text.length;index++){let suffix=text.slice(index);if(QUERY_PREFIXES.some((prefix)=>prefix.startsWith(suffix)||suffix===`${prefix}\x1B`))return suffix}return""}function foldDefaultColorQueries(previousCarry,chunkText){let text=previousCarry+chunkText,slots=[],end=0;DEFAULT_COLOR_QUERY_RE.lastIndex=0;for(let match=DEFAULT_COLOR_QUERY_RE.exec(text);match;match=DEFAULT_COLOR_QUERY_RE.exec(text))slots.push(match[1]==="10"?10:11),end=match.index+match[0].length;return{slots,carry:trailingQueryPrefix(text.slice(end))}}var DEFAULT_TERMINAL_COLORS,HEX_COLOR_RE,DEFAULT_COLOR_QUERY_RE,QUERY_PREFIXES;var init_terminal_colors=__esm(()=>{DEFAULT_TERMINAL_COLORS={foreground:"#eae7df",background:"#141413"},HEX_COLOR_RE=/^#[0-9a-f]{6}$/i,DEFAULT_COLOR_QUERY_RE=/\x1b\](10|11);\?(?:\x07|\x1b\\)/g,QUERY_PREFIXES=["\x1B]10;?","\x1B]11;?"]});import{RGBA}from"@opentui/core";function srgbChannelToLinear(c){let v=c/255;return v<=0.04045?v/12.92:((v+0.055)/1.055)**2.4}function relativeLuminance([r,g,b]){return 0.2126*srgbChannelToLinear(r)+0.7152*srgbChannelToLinear(g)+0.0722*srgbChannelToLinear(b)}function contrastRatioTriplet(fg,bg){let l1=relativeLuminance(fg),l2=relativeLuminance(bg),lighter=Math.max(l1,l2),darker=Math.min(l1,l2);return(lighter+0.05)/(darker+0.05)}function rgbToHsl([r,g,b]){let rn=r/255,gn=g/255,bn=b/255,max=Math.max(rn,gn,bn),min=Math.min(rn,gn,bn),l=(max+min)/2;if(max===min)return[0,0,l];let d=max-min,s=l>0.5?d/(2-max-min):d/(max+min),h;if(max===rn)h=((gn-bn)/d+(gn<bn?6:0))*60;else if(max===gn)h=((bn-rn)/d+2)*60;else h=((rn-gn)/d+4)*60;return[h,s,l]}function hslToRgb(h,s,l){if(s===0){let v=Math.round(l*255);return[v,v,v]}let q=l<0.5?l*(1+s):l+s-l*s,p=2*l-q,channel=(t)=>{let tn=t;if(tn<0)tn+=1;if(tn>1)tn-=1;let c=tn<0.16666666666666666?p+(q-p)*6*tn:tn<0.5?q:tn<0.6666666666666666?p+(q-p)*(0.6666666666666666-tn)*6:p;return Math.round(c*255)};return[channel(h/360+0.3333333333333333),channel(h/360),channel(h/360-0.3333333333333333)]}function ensureContrast(fg,bg,minRatio=HOST_TEXT_MIN_CONTRAST){let fgInts=fg.toInts(),bgInts=bg.toInts(),fgTriplet=[fgInts[0],fgInts[1],fgInts[2]],bgTriplet=[bgInts[0],bgInts[1],bgInts[2]];if(contrastRatioTriplet(fgTriplet,bgTriplet)>=minRatio)return fg;let[h,s,l]=rgbToHsl(fgTriplet),lighten=relativeLuminance(bgTriplet)<=MID_HOST_LUMINANCE,at=(lightness)=>contrastRatioTriplet(hslToRgb(h,s,lightness),bgTriplet),lo=lighten?l:0,hi=lighten?1:l;for(let i=0;i<32;i++){let mid=(lo+hi)/2;if(at(mid)>=minRatio)if(lighten)hi=mid;else lo=mid;else if(lighten)lo=mid;else hi=mid}let[r,g,b]=hslToRgb(h,s,lighten?hi:lo);return RGBA.fromInts(r,g,b,fgInts[3])}var HOST_TEXT_MIN_CONTRAST=4.5,MID_HOST_LUMINANCE=0.5;var init_contrast_guard=()=>{};var claude_default;var init_claude=__esm(()=>{claude_default={$schema:"https://opencode.ai/theme.json",defs:{darkBg:"#141413",darkBgRaised:"#1A1917",darkBgInset:"#2B2A27",darkBgMenu:"#33312E",darkBorderSubtle:"#2B2A27",darkBorder:"#3A3835",darkBorderActive:"#5C5853",darkText:"#EAE7DF",darkTextMuted:"#A9A39A",darkTextSubtle:"#6B665F",darkPrimary:"#CC785C",darkSecondary:"#D4967E",darkAccent:"#CC785C",darkAccentHover:"#E0AB96",darkRed:"#D47563",darkOrange:"#D97757",darkYellow:"#E8C96B",darkGreen:"#9ACA86",darkBlue:"#61AAF2",darkViolet:"#9B87F5",darkTerracotta:"#BF4D43",lightBg:"#FAF9F5",lightBgRaised:"#F0EEE6",lightBgInset:"#EAE7DF",lightBgMenu:"#E2DED4",lightBorderSubtle:"#EAE7DF",lightBorder:"#D9D5CC",lightBorderActive:"#A9A39A",lightText:"#1A1917",lightTextMuted:"#6B665F",lightTextSubtle:"#8D877D",lightPrimary:"#C96442",lightSecondary:"#B85F3D",lightAccent:"#CC785C",lightAccentHover:"#B85F3D",lightRed:"#A84B3A",lightOrange:"#C96442",lightYellow:"#8A6220",lightGreen:"#2E7C4C",lightBlue:"#207FDE",lightViolet:"#7B5BB6",lightTerracotta:"#BF4D43"},theme:{primary:{dark:"darkPrimary",light:"lightPrimary"},secondary:{dark:"darkSecondary",light:"lightSecondary"},accent:{dark:"darkAccent",light:"lightAccent"},error:{dark:"darkRed",light:"lightRed"},warning:{dark:"darkYellow",light:"lightYellow"},success:{dark:"darkGreen",light:"lightGreen"},info:{dark:"darkBlue",light:"lightBlue"},text:{dark:"darkText",light:"lightText"},textMuted:{dark:"darkTextMuted",light:"lightTextMuted"},background:{dark:"darkBg",light:"lightBg"},backgroundPanel:{dark:"darkBgRaised",light:"lightBgRaised"},backgroundElement:{dark:"darkBgInset",light:"lightBgInset"},backgroundMenu:{dark:"darkBgMenu",light:"lightBgMenu"},backgroundDialog:{dark:"darkBgRaised",light:"lightBgRaised"},border:{dark:"darkBorder",light:"lightBorder"},borderActive:{dark:"darkBorderActive",light:"lightBorderActive"},borderSubtle:{dark:"darkBorderSubtle",light:"lightBorderSubtle"},diffAdded:{dark:"darkGreen",light:"lightGreen"},diffRemoved:{dark:"darkRed",light:"lightRed"},diffContext:{dark:"darkTextMuted",light:"lightTextSubtle"},diffHunkHeader:{dark:"darkTextMuted",light:"lightTextSubtle"},diffHighlightAdded:{dark:"#B5E0A0",light:"#1F6638"},diffHighlightRemoved:{dark:"#E89180",light:"#8A3A2C"},diffAddedBg:{dark:"#1F2A1F",light:"#E5EEDF"},diffRemovedBg:{dark:"#2A1F1C",light:"#F5DAD3"},diffContextBg:{dark:"darkBgRaised",light:"lightBgRaised"},diffLineNumber:{dark:"darkTextSubtle",light:"lightTextSubtle"},diffAddedLineNumberBg:{dark:"#1A2419",light:"#D5E2CC"},diffRemovedLineNumberBg:{dark:"#241915",light:"#EBC8BE"},markdownText:{dark:"darkText",light:"lightText"},markdownHeading:{dark:"darkPrimary",light:"lightPrimary"},markdownLink:{dark:"darkAccent",light:"lightAccent"},markdownLinkText:{dark:"darkBlue",light:"lightBlue"},markdownCode:{dark:"darkSecondary",light:"lightSecondary"},markdownBlockQuote:{dark:"darkTextMuted",light:"lightTextMuted"},markdownEmph:{dark:"darkYellow",light:"lightYellow"},markdownStrong:{dark:"darkPrimary",light:"lightPrimary"},markdownHorizontalRule:{dark:"darkTextMuted",light:"lightTextMuted"},markdownListItem:{dark:"darkAccent",light:"lightAccent"},markdownListEnumeration:{dark:"darkBlue",light:"lightBlue"},markdownImage:{dark:"darkAccent",light:"lightAccent"},markdownImageText:{dark:"darkBlue",light:"lightBlue"},markdownCodeBlock:{dark:"darkText",light:"lightText"},markdownQuote:{dark:"darkTextMuted",light:"lightTextMuted"},syntaxComment:{dark:"darkTextSubtle",light:"lightTextSubtle"},syntaxKeyword:{dark:"darkPrimary",light:"lightPrimary"},syntaxFunction:{dark:"darkBlue",light:"lightBlue"},syntaxVariable:{dark:"darkText",light:"lightText"},syntaxString:{dark:"darkGreen",light:"lightGreen"},syntaxNumber:{dark:"darkOrange",light:"lightOrange"},syntaxType:{dark:"darkViolet",light:"lightViolet"},syntaxOperator:{dark:"darkSecondary",light:"lightSecondary"},syntaxPunctuation:{dark:"darkText",light:"lightText"},selectedListItemText:{dark:"darkBg",light:"lightBg"}}}});var conductor_default;var init_conductor=__esm(()=>{conductor_default={$schema:"https://opencode.ai/theme.json",defs:{darkStep1:"#0a0a0a",darkStep2:"#111111",darkStep3:"#181818",darkStep4:"#1f1f1f",darkStep5:"#2a2a2a",darkStep6:"#363636",darkStep7:"#444444",darkStep8:"#5a5a5a",darkStep9:"#7a7a7a",darkStep10:"#9a9a9a",darkStep11:"#909090",darkStep12:"#e8e8e8",darkAccent:"#7da5c8",darkAccentBright:"#9bc3e3",darkRed:"#e06c75",darkOrange:"#d6a668",darkGreen:"#7fd88f",darkCyan:"#7da5c8",darkYellow:"#d6a668",lightStep1:"#fafafa",lightStep2:"#f3f3f3",lightStep3:"#ececec",lightStep4:"#e2e2e2",lightStep5:"#d4d4d4",lightStep6:"#bdbdbd",lightStep7:"#9c9c9c",lightStep8:"#7c7c7c",lightStep9:"#5b5b5b",lightStep10:"#404040",lightStep11:"#6c6c6c",lightStep12:"#1a1a1a",lightAccent:"#3d6f9f",lightAccentBright:"#1a4f87",lightRed:"#c9343a",lightOrange:"#a06b1a",lightGreen:"#3d9a57",lightCyan:"#3d6f9f",lightYellow:"#a06b1a"},theme:{primary:{dark:"darkStep12",light:"lightStep12"},secondary:{dark:"darkAccentBright",light:"lightAccentBright"},accent:{dark:"darkAccent",light:"lightAccent"},error:{dark:"darkRed",light:"lightRed"},warning:{dark:"darkOrange",light:"lightOrange"},success:{dark:"darkGreen",light:"lightGreen"},info:{dark:"darkCyan",light:"lightCyan"},text:{dark:"darkStep12",light:"lightStep12"},textMuted:{dark:"darkStep11",light:"lightStep11"},background:{dark:"darkStep1",light:"lightStep1"},backgroundPanel:{dark:"darkStep2",light:"lightStep2"},backgroundElement:{dark:"darkStep3",light:"lightStep3"},backgroundMenu:{dark:"darkStep4",light:"lightStep4"},border:{dark:"darkStep6",light:"lightStep6"},borderActive:{dark:"darkStep8",light:"lightStep8"},borderSubtle:{dark:"darkStep4",light:"lightStep4"},diffAdded:{dark:"#7fd88f",light:"#3d9a57"},diffRemoved:{dark:"#e06c75",light:"#c9343a"},diffContext:{dark:"darkStep10",light:"lightStep10"},diffHunkHeader:{dark:"darkStep10",light:"lightStep10"},diffHighlightAdded:{dark:"#9be5ad",light:"#2d7a3f"},diffHighlightRemoved:{dark:"#f08490",light:"#a82530"},diffAddedBg:{dark:"#15241a",light:"#d8efdc"},diffRemovedBg:{dark:"#2a1518",light:"#f5dadc"},diffContextBg:{dark:"darkStep2",light:"lightStep2"},diffLineNumber:{dark:"darkStep9",light:"lightStep9"},diffAddedLineNumberBg:{dark:"#0f1c14",light:"#c5deca"},diffRemovedLineNumberBg:{dark:"#221012",light:"#e5c5c8"},markdownText:{dark:"darkStep12",light:"lightStep12"},markdownHeading:{dark:"darkStep12",light:"lightStep12"},markdownLink:{dark:"darkAccent",light:"lightAccent"},markdownCode:{dark:"darkAccentBright",light:"lightAccentBright"},markdownCodeBlock:{dark:"darkStep12",light:"lightStep12"},markdownQuote:{dark:"darkStep11",light:"lightStep11"},selectedListItemText:{dark:"darkStep1",light:"lightStep1"}}}});var tokyonight_default;var init_tokyonight=__esm(()=>{tokyonight_default={$schema:"https://opencode.ai/theme.json",defs:{darkStep1:"#1a1b26",darkStep2:"#1e2030",darkStep3:"#222436",darkStep4:"#292e42",darkStep5:"#3b4261",darkStep6:"#545c7e",darkStep7:"#737aa2",darkStep8:"#9099b2",darkStep9:"#82aaff",darkStep10:"#89b4fa",darkStep11:"#828bb8",darkStep12:"#c8d3f5",darkRed:"#ff757f",darkOrange:"#ff966c",darkYellow:"#ffc777",darkGreen:"#c3e88d",darkCyan:"#86e1fc",darkPurple:"#c099ff",lightStep1:"#e1e2e7",lightStep2:"#d5d6db",lightStep3:"#c8c9ce",lightStep4:"#b9bac1",lightStep5:"#a8aecb",lightStep6:"#9699a8",lightStep7:"#737a8c",lightStep8:"#5a607d",lightStep9:"#2e7de9",lightStep10:"#1a6ce7",lightStep11:"#8990a3",lightStep12:"#3760bf",lightRed:"#f52a65",lightOrange:"#b15c00",lightYellow:"#8c6c3e",lightGreen:"#587539",lightCyan:"#007197",lightPurple:"#9854f1"},theme:{primary:{dark:"darkStep9",light:"lightStep9"},secondary:{dark:"darkPurple",light:"lightPurple"},accent:{dark:"darkOrange",light:"lightOrange"},error:{dark:"darkRed",light:"lightRed"},warning:{dark:"darkOrange",light:"lightOrange"},success:{dark:"darkGreen",light:"lightGreen"},info:{dark:"darkStep9",light:"lightStep9"},text:{dark:"darkStep12",light:"lightStep12"},textMuted:{dark:"darkStep11",light:"lightStep11"},background:{dark:"darkStep1",light:"lightStep1"},backgroundPanel:{dark:"darkStep2",light:"lightStep2"},backgroundElement:{dark:"darkStep3",light:"lightStep3"},border:{dark:"darkStep7",light:"lightStep7"},borderActive:{dark:"darkStep8",light:"lightStep8"},borderSubtle:{dark:"darkStep6",light:"lightStep6"},diffAdded:{dark:"#4fd6be",light:"#1e725c"},diffRemoved:{dark:"#c53b53",light:"#c53b53"},diffContext:{dark:"#828bb8",light:"#7086b5"},diffHunkHeader:{dark:"#828bb8",light:"#7086b5"},diffHighlightAdded:{dark:"#b8db87",light:"#4db380"},diffHighlightRemoved:{dark:"#e26a75",light:"#f52a65"},diffAddedBg:{dark:"#20303b",light:"#d5e5d5"},diffRemovedBg:{dark:"#37222c",light:"#f7d8db"},diffContextBg:{dark:"darkStep2",light:"lightStep2"},diffLineNumber:{dark:"#8f909a",light:"#59595b"},diffAddedLineNumberBg:{dark:"#1b2b34",light:"#c5d5c5"},diffRemovedLineNumberBg:{dark:"#2d1f26",light:"#e7c8cb"},markdownText:{dark:"darkStep12",light:"lightStep12"},markdownHeading:{dark:"darkPurple",light:"lightPurple"},markdownLink:{dark:"darkStep9",light:"lightStep9"},markdownLinkText:{dark:"darkCyan",light:"lightCyan"},markdownCode:{dark:"darkGreen",light:"lightGreen"},markdownBlockQuote:{dark:"darkYellow",light:"lightYellow"},markdownEmph:{dark:"darkYellow",light:"lightYellow"},markdownStrong:{dark:"darkOrange",light:"lightOrange"},markdownHorizontalRule:{dark:"darkStep11",light:"lightStep11"},markdownListItem:{dark:"darkStep9",light:"lightStep9"},markdownListEnumeration:{dark:"darkCyan",light:"lightCyan"},markdownImage:{dark:"darkStep9",light:"lightStep9"},markdownImageText:{dark:"darkCyan",light:"lightCyan"},markdownCodeBlock:{dark:"darkStep12",light:"lightStep12"},syntaxComment:{dark:"darkStep11",light:"lightStep11"},syntaxKeyword:{dark:"darkPurple",light:"lightPurple"},syntaxFunction:{dark:"darkStep9",light:"lightStep9"},syntaxVariable:{dark:"darkRed",light:"lightRed"},syntaxString:{dark:"darkGreen",light:"lightGreen"},syntaxNumber:{dark:"darkOrange",light:"lightOrange"},syntaxType:{dark:"darkYellow",light:"lightYellow"},syntaxOperator:{dark:"darkCyan",light:"lightCyan"},syntaxPunctuation:{dark:"darkStep12",light:"lightStep12"}}}});var BUNDLED_THEME_JSONS;var init_bundled=__esm(()=>{init_claude();init_conductor();init_tokyonight();BUNDLED_THEME_JSONS={claude:claude_default,conductor:conductor_default,tokyonight:tokyonight_default}});import{RGBA as RGBA2}from"@opentui/core";function hasBundledTheme(name){return Boolean(BUNDLED_THEMES[name])}function resolveTheme(theme,mode="dark"){let defs=theme.defs??{};function resolve5(c,chain=[]){if(typeof c==="string"){if(c==="transparent"||c==="none")return RGBA2.fromInts(0,0,0,0);if(c.startsWith("#"))return RGBA2.fromHex(c);if(chain.includes(c))return RGBA2.fromInts(0,0,0);let next=defs[c]??theme.theme[c];if(next===void 0)return RGBA2.fromInts(0,0,0);return resolve5(next,[...chain,c])}return resolve5(c[mode],chain)}let out={};for(let[k,v]of Object.entries(theme.theme))out[k]=resolve5(v);let text=out.text??RGBA2.fromHex("#ffffff"),background=out.background??RGBA2.fromHex("#000000");return{...{primary:out.primary??text,secondary:out.secondary??text,accent:out.accent??out.primary??text,error:out.error??text,warning:out.warning??text,warningOnHost:out.warning??text,success:out.success??text,info:out.info??text,text,textMuted:out.textMuted??text,background,backgroundPanel:out.backgroundPanel??background,backgroundElement:out.backgroundElement??background,backgroundMenu:out.backgroundMenu??out.backgroundElement??background,backgroundDialog:out.backgroundDialog??out.backgroundPanel??background,border:out.border??text,borderActive:out.borderActive??out.border??text,borderSubtle:out.borderSubtle??out.border??text,diffAdded:out.diffAdded??out.success??text,diffRemoved:out.diffRemoved??out.error??text,diffContext:out.diffContext??out.textMuted??text,diffHunkHeader:out.diffHunkHeader??out.textMuted??text,diffAddedBg:out.diffAddedBg??background,diffRemovedBg:out.diffRemovedBg??background,selectedListItemText:out.selectedListItemText??background},...out}}function applyDisplayOverlay(base,focusAccent,transparentBackground,hostBackground){let v={...base,focusAccent:base[focusAccent]??base.primary,warningOnHost:base.warning};if(!transparentBackground)return v;let[backgroundR,backgroundG,backgroundB]=base.background.toInts(),[panelR,panelG,panelB]=base.backgroundPanel.toInts(),transparent={...v,background:RGBA2.fromInts(backgroundR,backgroundG,backgroundB,0),backgroundPanel:RGBA2.fromInts(panelR,panelG,panelB,0)};if(!hostBackground)return transparent;return{...transparent,text:ensureContrast(transparent.text,hostBackground),textMuted:ensureContrast(transparent.textMuted,hostBackground),warningOnHost:ensureContrast(transparent.warning,hostBackground)}}var BUNDLED_THEMES,DEFAULT_THEME="claude",FOCUS_ACCENT_SLOTS;var init_theme_core=__esm(()=>{init_contrast_guard();init_bundled();BUNDLED_THEMES=BUNDLED_THEME_JSONS;FOCUS_ACCENT_SLOTS=["primary","success","info"]});function normalizeHex(value){let m=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.exec(value);if(!m)return null;let digits=m[1];if(digits.length===3){let[r,g,b]=digits;return`#${r}${r}${g}${g}${b}${b}`.toLowerCase()}return`#${digits.slice(0,6)}`.toLowerCase()}function resolveThemeSlotHex(theme,slot,mode="dark"){let defs=theme.defs??{};function resolve5(c,chain){if(typeof c==="string"){if(c==="transparent"||c==="none")return null;if(c.startsWith("#"))return normalizeHex(c);if(chain.includes(c))return null;let next=defs[c]??theme.theme[c];if(next===void 0)return null;return resolve5(next,[...chain,c])}if(!c||typeof c!=="object")return null;let variant=c[mode];return typeof variant==="string"?resolve5(variant,chain):null}let value=theme.theme[slot];if(value===void 0)return null;return resolve5(value,[slot])}function isPlainObject(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function validateTheme(value){if(!isPlainObject(value))return{ok:!1,reason:"theme must be a JSON object at the top level"};let obj=value;if(!("theme"in obj))return{ok:!1,reason:"missing required key `theme`"};let theme=obj.theme;if(!isPlainObject(theme))return{ok:!1,reason:"`theme` must be an object map"};if("defs"in obj&&obj.defs!==void 0){if(!isPlainObject(obj.defs))return{ok:!1,reason:"`defs` must be an object map"};for(let[k,v]of Object.entries(obj.defs))if(typeof v!=="string")return{ok:!1,reason:`defs.${k} must be a string (hex like "#abc" or a ref name)`}}for(let[slot,raw]of Object.entries(theme)){if(typeof raw==="string")continue;if(!isPlainObject(raw))return{ok:!1,reason:`theme.${slot} must be a string or a { dark, light } object (got ${raw===null?"null":Array.isArray(raw)?"array":typeof raw})`};let variant=raw;if(typeof variant.dark!=="string")return{ok:!1,reason:`theme.${slot}.dark must be a string`};if(typeof variant.light!=="string")return{ok:!1,reason:`theme.${slot}.light must be a string`}}if("$schema"in obj&&obj.$schema!==void 0&&typeof obj.$schema!=="string")return{ok:!1,reason:"`$schema` must be a string when present"};return{ok:!0,theme:obj}}var init_schema2=()=>{};import{readFileSync as readFileSync10,readdirSync as readdirSync2}from"fs";import{join as join13}from"path";function userThemesDir(){return join13(roveStateDir(),"themes")}function loadUserThemes(){let dir=userThemesDir(),entries;try{entries=readdirSync2(dir)}catch{return[]}let out=[];for(let file of entries){if(!file.endsWith(".json"))continue;let path15=join13(dir,file),parsed;try{let text=readFileSync10(path15,"utf8");parsed=JSON.parse(text)}catch(err){let msg=errorMessage(err);console.warn(`[rove] skipping user theme ${path15}: invalid JSON \u2014 ${msg}`);continue}let result=validateTheme(parsed);if(!result.ok){console.warn(`[rove] skipping user theme ${path15}: ${result.reason}`);continue}let name=file.slice(0,-5);out.push({name,theme:result.theme})}return out}var init_loader=__esm(()=>{init_env();init_schema2()});var en,zh;var init_automations=__esm(()=>{en={title:"ROUTINES",holdingDaemon:"keeping the daemon awake",notHolding:"none active",paused:"paused",newTitle:"New routine",composerLegend:"enter create \xB7 tab fields \xB7 \u2190\u2192 \u2191\u2193 edit the focused field \xB7 esc cancel",fieldName:"NAME",fieldRepo:"REPO",fieldPrompt:"PROMPT",fieldSchedule:"SCHEDULE (FIVE-FIELD CRON)",namePlaceholder:"weekday dependency audit",promptPlaceholder:"Audit dependencies and summarize risky changes.",needRepo:"Open a project first \u2014 a routine runs in one.",cronInvalid:"not a five-field cron",cronField:{minute:"min",hour:"hour",dayOfMonth:"day",month:"month",dayOfWeek:"weekday"},cronNever:"valid, but never fires",missing:{name:"Give it a name.",repo:"Pick a project.",prompt:"Say what it should do.",schedule:"That schedule will not run."},empty:"No routines scheduled.",emptyHint:"Press n to create one.",precheck:"precheck: {command}",recentRuns:"RECENT RUNS",precheckDetail:"WHY IT SKIPPED \u2014 precheck {exit} in {duration}ms",precheckExited:"exited {code}",precheckTimedOut:"timed out",precheckStdout:"stdout",precheckStderr:"stderr",precheckNoOutput:"(no output)",noRuns:"Not run yet.",noSelection:"A routine runs its prompt in a project on a schedule.",running:"Running {name}\u2026",ranWith:"{name}: {status}",latestRunNoTask:"The latest run created no task.",runNow:"[ run now ]",runNowHint:"try it without waiting for the schedule",deleteTitle:"Delete routine?",deleteBody:"{name} and its run history will be removed. Tasks it already created are untouched.",deleteButton:"Delete",failed:"{error}"},zh={title:"\u4F8B\u884C\u4EFB\u52A1",holdingDaemon:"\u6B63\u5728\u4FDD\u6301\u5B88\u62A4\u8FDB\u7A0B\u5E38\u9A7B",notHolding:"\u65E0\u542F\u7528\u9879",paused:"\u5DF2\u6682\u505C",newTitle:"\u65B0\u5EFA\u4F8B\u884C\u4EFB\u52A1",composerLegend:"enter \u521B\u5EFA \xB7 tab \u5207\u5B57\u6BB5 \xB7 \u2190\u2192 \u2191\u2193 \u7F16\u8F91\u5F53\u524D\u5B57\u6BB5 \xB7 esc \u53D6\u6D88",fieldName:"\u540D\u79F0",fieldRepo:"\u4ED3\u5E93",fieldPrompt:"\u63D0\u793A\u8BCD",fieldSchedule:"\u8C03\u5EA6\uFF08\u4E94\u6BB5 cron\uFF09",namePlaceholder:"\u5DE5\u4F5C\u65E5\u4F9D\u8D56\u5BA1\u8BA1",promptPlaceholder:"\u5BA1\u8BA1\u4F9D\u8D56\u5E76\u603B\u7ED3\u6709\u98CE\u9669\u7684\u53D8\u66F4\u3002",needRepo:"\u5148\u6253\u5F00\u4E00\u4E2A\u9879\u76EE\u2014\u2014\u4F8B\u884C\u4EFB\u52A1\u8981\u8DD1\u5728\u67D0\u4E2A\u9879\u76EE\u91CC\u3002",cronInvalid:"\u4E0D\u662F\u5408\u6CD5\u7684\u4E94\u6BB5 cron",cronField:{minute:"\u5206",hour:"\u65F6",dayOfMonth:"\u65E5",month:"\u6708",dayOfWeek:"\u661F\u671F"},cronNever:"\u8BED\u6CD5\u5408\u6CD5\uFF0C\u4F46\u6C38\u8FDC\u4E0D\u4F1A\u89E6\u53D1",missing:{name:"\u8D77\u4E2A\u540D\u5B57\u3002",repo:"\u9009\u4E00\u4E2A\u9879\u76EE\u3002",prompt:"\u8BF4\u660E\u5B83\u8981\u505A\u4EC0\u4E48\u3002",schedule:"\u8FD9\u4E2A\u8C03\u5EA6\u4E0D\u4F1A\u89E6\u53D1\u3002"},empty:"\u8FD8\u6CA1\u6709\u4F8B\u884C\u4EFB\u52A1\u3002",emptyHint:"\u6309 n \u65B0\u5EFA\u4E00\u6761\u3002",precheck:"\u9884\u68C0\uFF1A{command}",recentRuns:"\u6700\u8FD1\u6267\u884C",precheckDetail:"\u4E3A\u4EC0\u4E48\u8DF3\u8FC7 \u2014\u2014 \u9884\u68C0{exit}\uFF0C\u8017\u65F6 {duration}ms",precheckExited:"\u9000\u51FA\u7801 {code}",precheckTimedOut:"\u8D85\u65F6",precheckStdout:"\u6807\u51C6\u8F93\u51FA",precheckStderr:"\u6807\u51C6\u9519\u8BEF",precheckNoOutput:"\uFF08\u65E0\u8F93\u51FA\uFF09",noRuns:"\u5C1A\u672A\u6267\u884C\u3002",noSelection:"\u4F8B\u884C\u4EFB\u52A1\u4F1A\u6309\u8C03\u5EA6\u5728\u67D0\u4E2A\u9879\u76EE\u91CC\u8DD1\u5B83\u7684\u63D0\u793A\u8BCD\u3002",running:"\u6B63\u5728\u8FD0\u884C {name}\u2026",ranWith:"{name}\uFF1A{status}",latestRunNoTask:"\u6700\u8FD1\u4E00\u6B21\u6267\u884C\u6CA1\u6709\u521B\u5EFA\u4EFB\u52A1\u3002",runNow:"[ \u7ACB\u5373\u8FD0\u884C ]",runNowHint:"\u4E0D\u7B49\u8C03\u5EA6\uFF0C\u76F4\u63A5\u8BD5\u4E00\u6B21",deleteTitle:"\u5220\u9664\u8FD9\u6761\u4F8B\u884C\u4EFB\u52A1\uFF1F",deleteBody:"\u5C06\u5220\u9664 {name} \u53CA\u5176\u6267\u884C\u8BB0\u5F55\u3002\u5B83\u5DF2\u7ECF\u521B\u5EFA\u7684\u4EFB\u52A1\u4E0D\u53D7\u5F71\u54CD\u3002",deleteButton:"\u5220\u9664",failed:"{error}"}});var en2,zh2;var init_common=__esm(()=>{en2={cancel:"Cancel",loading:"Loading\u2026",create:"create",confirm:"Confirm",paneCrash:{title:"This pane crashed",hint:"Reload it from the Tasks pane (the error was logged to client.log)."},rename:{defaultTitle:"Rename task",defaultFieldLabel:"TITLE",footerHint:"enter {submitLabel} \xB7 esc cancel",defaultSubmitLabel:"rename"},prompt:{fieldLabel:"input",submitLabel:"submit"}},zh2={cancel:"\u53D6\u6D88",loading:"\u52A0\u8F7D\u4E2D\u2026",create:"\u521B\u5EFA",confirm:"\u786E\u8BA4",paneCrash:{title:"\u6B64\u9762\u677F\u5DF2\u5D29\u6E83",hint:"\u8BF7\u4ECE\u4EFB\u52A1\u9762\u677F\u91CD\u65B0\u52A0\u8F7D\uFF08\u9519\u8BEF\u5DF2\u8BB0\u5F55\u5230 client.log\uFF09\u3002"},rename:{defaultTitle:"\u91CD\u547D\u540D\u4EFB\u52A1",defaultFieldLabel:"\u540D\u79F0",footerHint:"enter {submitLabel} \xB7 esc \u53D6\u6D88",defaultSubmitLabel:"\u91CD\u547D\u540D"},prompt:{fieldLabel:"\u8F93\u5165",submitLabel:"\u63D0\u4EA4"}}});var en3,zh3;var init_doctor=__esm(()=>{en3={fix:{hint:"{count} finding(s) above have a known fix \u2014 run `{command}` to review them one by one",none:"fix: nothing to fix \u2014 no known remediation applies to this report",header:"fixes \u2014 each one asks before running:",willRun:"will run: {command}",confirmPrompt:"apply this fix? [y/N] ",done:"\u2713 done",failed:"\u2717 exited with code {code}",skipped:"\xB7 skipped",nonInteractive:"no interactive terminal \u2014 nothing was executed; run the commands above yourself",manualHeader:"manual steps \u2014 doctor prints these but never runs them:",daemonRestartWhy:"safe to run: engine sessions live in the separate PTY host and survive a daemon restart",daemonStale:"restart the daemon \u2014 it is running an older build than this CLI",daemonDown:"start the daemon \u2014 it is not running",hooksDown:"restart the daemon to re-establish the engine hook channel",inspectStale:"restart the daemon \u2014 it predates the hook-channel check",skillInstallWhy:"safe to run: installs skill files only; re-running is idempotent",skillMissing:"install the Rove agent skill",skillStale:"update the Rove agent skill to the version this build expects",spawnHelper:"restore the exec bit on node-pty's spawn-helper \u2014 every node-pty PTY spawn fails without it",spawnHelperWhy:"safe to run: chmod on two prebuilt binaries; idempotent, and `bun install` does the same",resetWhy:"stops the daemon, the PTY host, and every live session \u2014 not undoable, so doctor only prints it",resetDaemonWedged:"the daemon process is alive but unreachable (wedged)",resetPty:"the PTY host is unreachable or not running",resetLegacy:"pre-v0.8 tmux sessions are still holding processes and memory",engineTabs:"engine tabs may hold a stale daemon socket path",engineTabsAction:"close and reopen the affected engine tabs in the TUI",engineTabsWhy:"kills that tab's live engine session \u2014 your call, not doctor's",staleInstall:"the install this Rove runs from no longer exists on disk",staleInstallAction:"npm install -g @sma1lboy/rove, then relaunch Rove",staleInstallWhy:"doctor cannot reinstall Rove over the running process \u2014 a human has to, then relaunch",humanOnlyWhy:"doctor does not install software or log in to accounts for you",git:"git is not on PATH",gitAction:"install git with your OS package manager",noEngine:"no usable engine \u2014 no engine CLI is both installed and logged in",noEngineAction:"install an engine CLI (claude, codex, copilot, or kimi) and log in",windowsNode:"Node.js is missing \u2014 the Windows PTY host cannot start",windowsNodeAction:"install Node.js from https://nodejs.org",staleBun:"the Bun running Rove is older than this build supports \u2014 terminals will not paint",staleBunAction:"upgrade Bun (`bun upgrade`, `brew upgrade bun`, or `npm install -g bun@latest`), then relaunch Rove"}},zh3={fix:{hint:"\u4E0A\u9762\u6709 {count} \u9879\u53D1\u73B0\u5B58\u5728\u5DF2\u77E5\u4FEE\u6CD5 \u2014 \u8FD0\u884C `{command}` \u9010\u6761\u67E5\u770B",none:"fix: \u65E0\u53EF\u4FEE\u9879 \u2014 \u672C\u6B21\u62A5\u544A\u6CA1\u6709\u5339\u914D\u5230\u5DF2\u77E5\u4FEE\u6CD5",header:"\u4FEE\u590D\u9879 \u2014 \u6BCF\u4E00\u6761\u90FD\u4F1A\u5148\u8BE2\u95EE\u518D\u6267\u884C:",willRun:"\u5C06\u6267\u884C: {command}",confirmPrompt:"\u6267\u884C\u8FD9\u6761\u4FEE\u590D\u5417? [y/N] ",done:"\u2713 \u5B8C\u6210",failed:"\u2717 \u9000\u51FA\u7801 {code}",skipped:"\xB7 \u5DF2\u8DF3\u8FC7",nonInteractive:"\u6CA1\u6709\u4EA4\u4E92\u7EC8\u7AEF \u2014 \u672A\u6267\u884C\u4EFB\u4F55\u547D\u4EE4; \u8BF7\u81EA\u884C\u8FD0\u884C\u4E0A\u9762\u7684\u547D\u4EE4",manualHeader:"\u4EBA\u5DE5\u6B65\u9AA4 \u2014 doctor \u53EA\u6253\u5370, \u6C38\u8FDC\u4E0D\u4F1A\u66FF\u4F60\u6267\u884C:",daemonRestartWhy:"\u53EF\u5B89\u5168\u6267\u884C: \u5F15\u64CE\u4F1A\u8BDD\u5728\u72EC\u7ACB\u7684 PTY host \u91CC, daemon \u91CD\u542F\u540E\u4ECD\u7136\u5B58\u6D3B",daemonStale:"\u91CD\u542F daemon \u2014 \u5B83\u8FD0\u884C\u7684\u6784\u5EFA\u6BD4\u5F53\u524D CLI \u65E7",daemonDown:"\u542F\u52A8 daemon \u2014 \u5B83\u5F53\u524D\u6CA1\u6709\u5728\u8FD0\u884C",hooksDown:"\u91CD\u542F daemon \u4EE5\u91CD\u5EFA\u5F15\u64CE hook \u901A\u9053",inspectStale:"\u91CD\u542F daemon \u2014 \u5B83\u7684\u7248\u672C\u65E9\u4E8E hook \u901A\u9053\u68C0\u67E5",skillInstallWhy:"\u53EF\u5B89\u5168\u6267\u884C: \u53EA\u5199\u5165 skill \u6587\u4EF6; \u91CD\u590D\u8FD0\u884C\u662F\u5E42\u7B49\u7684",skillMissing:"\u5B89\u88C5 Rove agent skill",skillStale:"\u628A Rove agent skill \u66F4\u65B0\u5230\u5F53\u524D\u6784\u5EFA\u671F\u671B\u7684\u7248\u672C",spawnHelper:"\u6062\u590D node-pty spawn-helper \u7684\u53EF\u6267\u884C\u4F4D \u2014 \u7F3A\u4E86\u5B83 node-pty \u7684\u6BCF\u6B21 PTY \u542F\u52A8\u90FD\u4F1A\u5931\u8D25",spawnHelperWhy:"\u53EF\u5B89\u5168\u6267\u884C: \u53EA\u5BF9\u4E24\u4E2A\u9884\u7F16\u8BD1\u4E8C\u8FDB\u5236\u505A chmod; \u5E42\u7B49, `bun install` \u4E5F\u4F1A\u505A\u540C\u6837\u7684\u4E8B",resetWhy:"\u4F1A\u505C\u6389 daemon\u3001PTY host \u548C\u6240\u6709\u6D3B\u52A8\u4F1A\u8BDD \u2014 \u4E0D\u53EF\u64A4\u9500, \u6240\u4EE5 doctor \u53EA\u6253\u5370",resetDaemonWedged:"daemon \u8FDB\u7A0B\u5B58\u6D3B\u4F46\u65E0\u6CD5\u8FDE\u63A5 (\u5361\u6B7B)",resetPty:"PTY host \u65E0\u6CD5\u8FDE\u63A5\u6216\u6CA1\u6709\u5728\u8FD0\u884C",resetLegacy:"v0.8 \u4E4B\u524D\u7684 tmux \u4F1A\u8BDD\u4ECD\u5360\u7528\u8FDB\u7A0B\u548C\u5185\u5B58",engineTabs:"\u5F15\u64CE tab \u53EF\u80FD\u6301\u6709\u8FC7\u671F\u7684 daemon socket \u8DEF\u5F84",engineTabsAction:"\u5728 TUI \u91CC\u5173\u95ED\u5E76\u91CD\u5F00\u53D7\u5F71\u54CD\u7684\u5F15\u64CE tab",engineTabsWhy:"\u4F1A\u6740\u6389\u8BE5 tab \u7684\u6D3B\u52A8\u5F15\u64CE\u4F1A\u8BDD \u2014 \u7531\u4F60\u51B3\u5B9A, doctor \u4E0D\u4EE3\u52B3",staleInstall:"\u5F53\u524D Rove \u6240\u5728\u7684\u5B89\u88C5\u5DF2\u4ECE\u78C1\u76D8\u5220\u9664",staleInstallAction:"npm install -g @sma1lboy/rove, \u7136\u540E\u91CD\u65B0\u542F\u52A8 Rove",staleInstallWhy:"doctor \u65E0\u6CD5\u5728\u8FD0\u884C\u4E2D\u7684\u8FDB\u7A0B\u4E0A\u91CD\u88C5 Rove \u2014 \u9700\u8981\u4EBA\u5DE5\u91CD\u88C5\u540E\u91CD\u65B0\u542F\u52A8",humanOnlyWhy:"doctor \u4E0D\u4F1A\u66FF\u4F60\u5B89\u88C5\u8F6F\u4EF6\u6216\u767B\u5F55\u8D26\u53F7",git:"PATH \u4E0A\u627E\u4E0D\u5230 git",gitAction:"\u7528\u4F60\u7684\u7CFB\u7EDF\u5305\u7BA1\u7406\u5668\u5B89\u88C5 git",noEngine:"\u6CA1\u6709\u53EF\u7528\u5F15\u64CE \u2014 \u6CA1\u6709\u4EFB\u4F55\u5F15\u64CE CLI \u540C\u65F6\u6EE1\u8DB3\u5DF2\u5B89\u88C5\u4E14\u5DF2\u767B\u5F55",noEngineAction:"\u5B89\u88C5\u4EFB\u4E00\u5F15\u64CE CLI\uFF08claude\u3001codex\u3001copilot \u6216 kimi\uFF09\u5E76\u767B\u5F55",windowsNode:"\u7F3A\u5C11 Node.js \u2014 Windows PTY host \u65E0\u6CD5\u542F\u52A8",windowsNodeAction:"\u4ECE https://nodejs.org \u5B89\u88C5 Node.js",staleBun:"\u8FD0\u884C Rove \u7684 Bun \u7248\u672C\u4F4E\u4E8E\u672C\u6784\u5EFA\u7684\u8981\u6C42 \u2014 \u7EC8\u7AEF\u4E0D\u4F1A\u6709\u4EFB\u4F55\u8F93\u51FA",staleBunAction:"\u5347\u7EA7 Bun (`bun upgrade` / `brew upgrade bun` / `npm install -g bun@latest`), \u7136\u540E\u91CD\u65B0\u542F\u52A8 Rove"}}});var en4,zh4;var init_files=__esm(()=>{en4={mentionNoEngine:"No engine session in this task \u2014 nothing to mention into. Open one with ctrl+t.",tabs:{all:"All",changes:"Changes"},actions:{zen:"Zen",createPR:"Ask agent to create PR"},legend:{changes:"M modified \xB7 A added \xB7 D deleted \xB7 ? untracked"},scope:{working:"scope: working tree",branch:"scope: vs {base}",toggleHint:"b to toggle"},empty:{noTask:"(no task \u2014 press n to create)",noFiles:"(empty worktree)",noChanges:"(no changes \u2014 clean worktree)"},error:{retryHint:"press r to retry",notGitRepo:"not a git repository",pathMissing:"worktree path is missing",permissionDenied:"permission denied",gitNotInstalled:"git is not installed",gitFailed:"git command failed"},toast:{prOnTargetBranch:"Already on the target branch ({branch}) \u2014 ask the agent to create the PR from a task branch",ciNoFailingChecks:"No failing check logs to read \u2014 the run may have expired, or the checks are no longer red"}},zh4={mentionNoEngine:"\u8FD9\u4E2A\u4EFB\u52A1\u6CA1\u6709\u5F15\u64CE\u4F1A\u8BDD\u2014\u2014\u6CA1\u6709\u5730\u65B9\u53EF\u4EE5\u63D0\u53CA\u3002\u7528 ctrl+t \u5F00\u4E00\u4E2A\u3002",tabs:{all:"\u5168\u90E8",changes:"\u6539\u52A8"},actions:{zen:"\u4E13\u6CE8\u6A21\u5F0F",createPR:"\u8BA9 agent \u521B\u5EFA PR"},legend:{changes:"M \u5DF2\u4FEE\u6539 \xB7 A \u5DF2\u6DFB\u52A0 \xB7 D \u5DF2\u5220\u9664 \xB7 ? \u672A\u8DDF\u8E2A"},scope:{working:"\u8303\u56F4\uFF1A\u5DE5\u4F5C\u533A\u6539\u52A8",branch:"\u8303\u56F4\uFF1A\u5BF9\u6BD4 {base}",toggleHint:"\u6309 b \u5207\u6362"},empty:{noTask:"\uFF08\u6682\u65E0\u4EFB\u52A1 \u2014 \u6309 n \u521B\u5EFA\uFF09",noFiles:"\uFF08worktree \u4E3A\u7A7A\uFF09",noChanges:"\uFF08\u65E0\u6539\u52A8 \u2014 worktree \u5E72\u51C0\uFF09"},error:{retryHint:"\u6309 r \u91CD\u8BD5",notGitRepo:"\u4E0D\u662F git \u4ED3\u5E93",pathMissing:"worktree \u8DEF\u5F84\u4E0D\u5B58\u5728",permissionDenied:"\u6743\u9650\u4E0D\u8DB3",gitNotInstalled:"\u672A\u5B89\u88C5 git",gitFailed:"git \u547D\u4EE4\u5931\u8D25"},toast:{prOnTargetBranch:"\u5F53\u524D\u5C31\u5728\u76EE\u6807\u5206\u652F\uFF08{branch}\uFF09\u2014 \u8BF7\u5728\u4EFB\u52A1\u5206\u652F\u4E0A\u8BA9 agent \u521B\u5EFA PR",ciNoFailingChecks:"\u6CA1\u6709\u53EF\u8BFB\u7684\u5931\u8D25\u68C0\u67E5\u65E5\u5FD7\u2014\u2014\u8FD0\u884C\u8BB0\u5F55\u53EF\u80FD\u5DF2\u8FC7\u671F\uFF0C\u6216\u68C0\u67E5\u5DF2\u4E0D\u518D\u662F\u7EA2\u7684"}}});var en5,zh5;var init_help=__esm(()=>{en5={title:"Rove \u2014 keybindings",esc:"esc",commandLayer:"{prefix} \u2014 more Rove commands",escCancel:"esc cancel",directLayer:"Hold ctrl \u2014 Rove shortcuts",releaseCtrl:"release ctrl to close",overflow:"\u2026 F1 for all shortcuts",moreCommandsPrefix:"More commands (prefix)",focused:"Focused: {surface}",allBindings:"All keybinding contexts",grammar:"Use keys here \xB7 one-press Rove shortcuts \xB7 {prefix} for more commands",disabled:"prefix disabled",here:"HERE \u2014 only in {surface}",direct:"ONE PRESS \u2014 Rove shortcuts",afterPrefix:"AFTER PREFIX \u2014 more Rove commands",otherPane:"OTHER PANE \u2014 {surface}"},zh5={title:"Rove \u2014 \u5FEB\u6377\u952E",esc:"esc",commandLayer:"{prefix} \u2014 \u66F4\u591A Rove \u547D\u4EE4",escCancel:"esc \u53D6\u6D88",directLayer:"\u6309\u4F4F ctrl \u2014 Rove \u5FEB\u6377\u952E",releaseCtrl:"\u677E\u5F00 ctrl \u5173\u95ED",overflow:"\u2026 \u6309 F1 \u67E5\u770B\u5168\u90E8\u5FEB\u6377\u952E",moreCommandsPrefix:"\u66F4\u591A\u547D\u4EE4\uFF08prefix\uFF09",focused:"\u5F53\u524D\u7126\u70B9\uFF1A{surface}",allBindings:"\u6240\u6709\u5FEB\u6377\u952E\u4E0A\u4E0B\u6587",grammar:"\u5F53\u524D\u533A\u57DF\u76F4\u63A5\u6309 \xB7 Rove \u5355\u6B21\u5FEB\u6377\u952E \xB7 {prefix} \u6253\u5F00\u66F4\u591A\u547D\u4EE4",disabled:"Prefix \u5DF2\u7981\u7528",here:"\u5F53\u524D\u533A\u57DF \u2014 \u4EC5\u5728{surface}",direct:"\u4E00\u6B21\u6309\u4E0B \u2014 Rove \u5FEB\u6377\u952E",afterPrefix:"\u6309\u4E0B Prefix \u540E \u2014 \u66F4\u591A Rove \u547D\u4EE4",otherPane:"\u5176\u4ED6\u533A\u57DF \u2014 {surface}"}});var en6,zh6;var init_hints=__esm(()=>{en6={status:{commands:"{key} commands",help:"{key} help",sidebar:"{key} sidebar",settings:"settings"},pane:{move:"move",open:"open",collapse:"collapse",diff:"diff"}},zh6={status:{commands:"{key} \u547D\u4EE4",help:"{key} \u5E2E\u52A9",sidebar:"{key} \u4FA7\u680F",settings:"\u8BBE\u7F6E"},pane:{move:"\u79FB\u52A8",open:"\u6253\u5F00",collapse:"\u6298\u53E0",diff:"\u5DEE\u5F02"}}});var en7,zh7;var init_kanban=__esm(()=>{en7={title:"Kanban",hint:"tab project \xB7 \u2190\u2193\u2191\u2192 card \xB7 enter detail \xB7 n new \xB7 d delete \xB7 r refresh \xB7 esc close",loading:"Loading issues\u2026",noRepos:"No projects yet \u2014 create a task first.",empty:"No issues \u2014 agents file them via `rove api issue-create`.",columnEmpty:"No cards",column:{backlog:"Backlog",inProgress:"In progress",parked:"Parked",done:"Done"},more:"+{count} more",attention:"{count} need you",turnComplete:"turn done",detail:{status:{open:"open",doing:"doing",hold:"hold",done:"done"},created:"created {date}",linked:"linked to a session",titleLabel:"TITLE",description:"DESCRIPTION",noDescription:"No description.",attachHint:"paste a path / ctrl+v screenshot \u2192 inserts an image placeholder",engine:"ENGINE",workspace:"WORKSPACE",placement:{worktree:"New worktree task \u2014 its own workspace",projectWorktree:"New worktree \u2014 as a chattab in the project workspace",project:"Project checkout \u2014 a new chattab, no worktree"},jumpLabel:"AFTER START",jump:{stay:"Stay on the board",follow:"Jump to the session"},startLegend:"enter/ctrl+enter start \xB7 tab fields \xB7 \u2190\u2192 engine \xB7 \u2191\u2193 workspace \xB7 esc save & close",sessionLabel:"SESSION",openAction:"Open the linked session \u21B5",unlinkAction:"Unlink",openLegend:"enter open the focused action \xB7 tab fields \xB7 unlink returns the card to Backlog \xB7 esc save & close",eventsLabel:"EVENTS",eventsLoading:"Loading events\u2026",eventsNone:"No engine events recorded yet.",doneNote:"Done stories have nothing left to start \xB7 esc save & close",startedBackground:"Started in background: {title}",newStory:"NEW STORY",createLegend:"ctrl+s save \xB7 enter/ctrl+enter save & start \xB7 tab fields \xB7 esc cancel"},confirmDelete:{title:"Delete story #{id}?",body:"\u201C{title}\u201D will be removed from the tracker. A linked task, branch, or worktree is left untouched."},deleteFailed:"Couldn't delete story #{id}: {error}",createFailed:"Couldn't create the story: {error}",updateFailed:"Couldn't save story #{id}: {error}",statusFailed:"Story #{id} stays in its old column: {error}",linkFailed:"Story #{id} isn't linked to its task: {error}",unlinkFailed:"Story #{id} is still linked: {error}"},zh7={title:"\u770B\u677F",hint:"tab \u5207\u9879\u76EE \xB7 \u2190\u2193\u2191\u2192 \u9009\u5361\u7247 \xB7 enter \u8BE6\u60C5 \xB7 n \u65B0\u5EFA \xB7 d \u5220\u9664 \xB7 r \u5237\u65B0 \xB7 esc \u5173\u95ED",loading:"\u6B63\u5728\u52A0\u8F7D issues\u2026",noRepos:"\u8FD8\u6CA1\u6709\u9879\u76EE\u2014\u2014\u5148\u521B\u5EFA\u4E00\u4E2A\u4EFB\u52A1\u3002",empty:"\u6682\u65E0 issue\u2014\u2014agent \u53EF\u901A\u8FC7 `rove api issue-create` \u521B\u5EFA\u3002",columnEmpty:"\u6682\u65E0\u5361\u7247",column:{backlog:"\u5F85\u529E",inProgress:"\u8FDB\u884C\u4E2D",parked:"\u6401\u7F6E",done:"\u5DF2\u5B8C\u6210"},more:"\u8FD8\u6709 {count} \u6761",attention:"{count} \u5F20\u7B49\u4F60\u5904\u7406",turnComplete:"\u56DE\u5408\u5B8C\u6210",detail:{status:{open:"\u5F85\u529E",doing:"\u8FDB\u884C\u4E2D",hold:"\u6401\u7F6E",done:"\u5DF2\u5B8C\u6210"},created:"\u521B\u5EFA\u4E8E {date}",linked:"\u5DF2\u5173\u8054\u4F1A\u8BDD",titleLabel:"\u6807\u9898",description:"\u63CF\u8FF0",noDescription:"\u6682\u65E0\u63CF\u8FF0\u3002",attachHint:"\u7C98\u8D34\u8DEF\u5F84 / ctrl+v \u8D34\u622A\u56FE \u2192 \u63D2\u5165\u56FE\u7247\u5360\u4F4D\u884C",engine:"\u5F15\u64CE",workspace:"\u5DE5\u4F5C\u533A",placement:{worktree:"\u65B0\u5EFA worktree \u4EFB\u52A1\u2014\u2014\u72EC\u7ACB\u5DE5\u4F5C\u533A",projectWorktree:"\u65B0\u5EFA worktree\u2014\u2014\u4F5C\u4E3A\u9879\u76EE\u5DE5\u4F5C\u533A\u91CC\u7684 chattab",project:"\u9879\u76EE\u4E3B\u76EE\u5F55\u2014\u2014\u65B0\u5F00 chattab,\u4E0D\u5EFA worktree"},jumpLabel:"\u542F\u52A8\u540E",jump:{stay:"\u7559\u5728\u770B\u677F",follow:"\u8DF3\u8F6C\u5230\u4F1A\u8BDD"},startLegend:"enter/ctrl+enter \u542F\u52A8 \xB7 tab \u5207\u5B57\u6BB5 \xB7 \u2190\u2192 \u5F15\u64CE \xB7 \u2191\u2193 \u5DE5\u4F5C\u533A \xB7 esc \u4FDD\u5B58\u5173\u95ED",sessionLabel:"\u4F1A\u8BDD",openAction:"\u6253\u5F00\u5173\u8054\u4F1A\u8BDD \u21B5",unlinkAction:"\u89E3\u9664\u5173\u8054",openLegend:"enter \u6267\u884C\u9009\u4E2D\u64CD\u4F5C \xB7 tab \u5207\u5B57\u6BB5 \xB7 \u89E3\u9664\u5173\u8054\u628A\u5361\u7247\u9000\u56DE Backlog \xB7 esc \u4FDD\u5B58\u5173\u95ED",eventsLabel:"\u4E8B\u4EF6",eventsLoading:"\u6B63\u5728\u52A0\u8F7D\u4E8B\u4EF6\u2026",eventsNone:"\u6682\u65E0\u5F15\u64CE\u4E8B\u4EF6\u8BB0\u5F55\u3002",doneNote:"\u5DF2\u5B8C\u6210\u7684 story \u65E0\u9700\u542F\u52A8 \xB7 esc \u4FDD\u5B58\u5173\u95ED",startedBackground:"\u5DF2\u5728\u540E\u53F0\u542F\u52A8:{title}",newStory:"\u65B0\u5EFA STORY",createLegend:"ctrl+s \u4EC5\u4FDD\u5B58 \xB7 enter/ctrl+enter \u4FDD\u5B58\u5E76\u542F\u52A8 \xB7 tab \u5207\u5B57\u6BB5 \xB7 esc \u53D6\u6D88"},confirmDelete:{title:"\u5220\u9664 story #{id}?",body:"\u300C{title}\u300D\u5C06\u4ECE tracker \u4E2D\u79FB\u9664\u3002\u5DF2\u5173\u8054\u7684\u4EFB\u52A1\u3001\u5206\u652F\u3001worktree \u4E0D\u53D7\u5F71\u54CD\u3002"},deleteFailed:"\u5220\u9664 story #{id} \u5931\u8D25\uFF1A{error}",createFailed:"\u521B\u5EFA story \u5931\u8D25\uFF1A{error}",updateFailed:"\u4FDD\u5B58 story #{id} \u5931\u8D25\uFF1A{error}",statusFailed:"Story #{id} \u4ECD\u7559\u5728\u539F\u6765\u7684\u5217\uFF1A{error}",linkFailed:"Story #{id} \u672A\u80FD\u5173\u8054\u5230\u5B83\u7684\u4EFB\u52A1\uFF1A{error}",unlinkFailed:"Story #{id} \u4ECD\u5904\u4E8E\u5173\u8054\u72B6\u6001\uFF1A{error}"}});var en8,zh8;var init_keys=__esm(()=>{en8={category:{Global:"Global",Sidebar:"Sidebar",Workspace:"Workspace",Navigation:"Navigation","Tasks pane":"Tasks pane",Files:"Files",Terminal:"Terminal",Dialog:"Dialog",Views:"Views",Tasks:"Tasks",Sessions:"Sessions",Attention:"Attention",Tools:"Tools"},desc:{"help.open":"Show keybindings help","task.new":"New task","task.new.global":"New task","task.openEditor":"Open active Task directory in editor","task.moveMode":"Reorder sidebar rows (then j/k \u2014 tab, task, or project)","settings.open":"Open settings","settings.open.sidebar":"Open settings","inbox.show":"Open attention Inbox","worktrees.open.sidebar":"Open worktrees","kanban.open":"Open kanban (issues board)","automations.open":"Open routines (scheduled tasks)","workItems.open":"Open GitHub issues (external tracker)","app.quit":"Quit (with confirm)","focus.sidebar":"Back to sidebar (tasks)","focus.previous":"Focus previous pane (files \u2192 workspace \u2192 sidebar)","focus.next":"Focus next pane (sidebar \u2192 workspace \u2192 files)","workspace.zenToggle":"Toggle zen mode","attention.next":"Jump to the next attention item","chat.interrupt":"Interrupt current turn (esc while streaming)","sidebar.nav":"Move cursor up/down","sidebar.select":"Open the selected task","sidebar.tree.open":"Open the row under the cursor","sidebar.goto":"Top / bottom of list (gg or shift-G)","sidebar.rename":"Rename task","sidebar.localMerge":"Reorder row (Shift+M, then j/k \u2014 tab, task, or project)","sidebar.pin":"Pin / unpin task at top (Shift+P)","sidebar.sort":"Switch task sort (default \u2194 recent)","sidebar.delete":"Delete task (with confirm)","sidebar.search.enter":"Search tasks (fuzzy filter)","sidebar.search.nav":"Move highlight in search results","sidebar.search.submit":"Select search match and exit search","sidebar.search.cancel":"Cancel search (restore prior selection)","tasks.openWorktree":"Open selected Task directory in your editor","tasks.renameBranch":"Rename the selected task's git branch","tasks.cycleEngine":"Cycle engine vendor \u2014 applies on reopen","tasks.update":"Open the update page (when a new version is available)","tasks.focusEngine":"Focus the engine pane of the current window","tasks.jump":"Jump to the task showing that digit","chat.send":"Send message (composer)","chat.newline":"Newline in composer","chat.cycle-mode":"Cycle permission mode (composer)","chat.steer":"Steer (interrupt + send) \u2014 mid-stream only","chat.tab.new":"New chat tab","chat.tab.chooseEngine":"New conversation \u2014 engine/shell picker with destination + context toggles","chat.tab.fork":"Fork this chat into a new tab (same Task directory, keeps the conversation)","chat.fork.new":"Quick-fork: create child task seeded with current repo/branch/model","chat.tab.close":"Close chat tab","chat.tab.rename":"Rename active chat tab","chat.tab.cycle-next":"Next chat tab","chat.tab.cycle-prev":"Previous chat tab","workspace.split.right":"Split right","workspace.split.down":"Split down","workspace.split.focus-next":"Focus next split","workspace.split.close":"Close active split (tab when unsplit)","workspace.split.rename":"Rename active split (tab when unsplit)","files.nav":"Move cursor up/down","files.hierarchy":"Collapse / expand tree level","files.open":"Open file in configured editor (diff when supported)","files.tab":"Switch tab (cycle All / Changes)","files.refresh":"Refresh","files.scope":"Toggle Changes scope (working \u2194 branch vs base)","files.diff":"Open a read-only diff in a workspace tab","files.openExternal":"Open file in system default app (audio / video / pdf preview)","files.mention":"Inject @<path> mention into the engine pane","files.createPR":"Ask the agent to create a PR from the current task","files.fixChecks":"Ask the agent to fix the failing PR checks","files.syncBase":"Merge the base branch into this task's worktree","diff.review.cursor":"Move the line cursor over the diff","diff.review.range":"Toggle range anchor at the cursor","diff.review.note":"Add a review note at the cursor","diff.review.send":"Send all unsent review notes to the engine","inbox.nav":"Move through attention items","inbox.open":"Open the selected attention item","inbox.delete":"Clear the selected attention item","terminal.scroll-up":"Scroll scrollback up","terminal.scroll-down":"Scroll scrollback down","terminal.reset":"Reset terminal \u2014 kill the current shell and respawn","terminal.search":"Search the scrollback","terminal.search.older":"Scrollback search: walk to the older match","terminal.search.newer":"Scrollback search: walk to the newer match","terminal.search.cancel":"Close scrollback search (restore prior scroll position)","dialog.cancel":"Close the top dialog (esc)","dialog.newtask.tab.cycle":"Switch New Task tab (Existing / New Repo)"}},zh8={category:{Global:"\u5168\u5C40",Sidebar:"\u4FA7\u8FB9\u680F",Workspace:"\u5DE5\u4F5C\u533A",Navigation:"\u5BFC\u822A","Tasks pane":"\u4EFB\u52A1\u9762\u677F",Files:"\u6587\u4EF6",Terminal:"\u7EC8\u7AEF",Dialog:"\u5BF9\u8BDD\u6846",Views:"\u89C6\u56FE",Tasks:"\u4EFB\u52A1",Sessions:"\u4F1A\u8BDD",Attention:"\u63D0\u9192",Tools:"\u5DE5\u5177"},desc:{"help.open":"\u663E\u793A\u5FEB\u6377\u952E\u5E2E\u52A9","task.new":"\u65B0\u5EFA\u4EFB\u52A1","task.new.global":"\u65B0\u5EFA\u4EFB\u52A1","task.openEditor":"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u5F53\u524D Task \u7684\u76EE\u5F55","task.moveMode":"\u8C03\u6574\u4FA7\u8FB9\u680F\u884C\u987A\u5E8F\uFF08\u7136\u540E j/k\u2014\u2014tab / \u4EFB\u52A1 / \u9879\u76EE\uFF09","settings.open":"\u6253\u5F00\u8BBE\u7F6E","settings.open.sidebar":"\u6253\u5F00\u8BBE\u7F6E","inbox.show":"\u6253\u5F00\u63D0\u9192\u6536\u4EF6\u7BB1","worktrees.open.sidebar":"\u6253\u5F00 worktrees","kanban.open":"\u6253\u5F00\u770B\u677F\uFF08issues\uFF09","automations.open":"\u6253\u5F00\u4F8B\u884C\u4EFB\u52A1\uFF08\u5B9A\u65F6\u4EFB\u52A1\uFF09","workItems.open":"\u6253\u5F00 GitHub issues\uFF08\u5916\u90E8\u8DDF\u8E2A\u5668\uFF09","app.quit":"\u9000\u51FA\uFF08\u9700\u786E\u8BA4\uFF09","focus.sidebar":"\u8FD4\u56DE\u4FA7\u8FB9\u680F\uFF08\u4EFB\u52A1\u5217\u8868\uFF09","focus.previous":"\u805A\u7126\u4E0A\u4E00\u4E2A\u9762\u677F\uFF08\u6587\u4EF6 \u2192 \u5DE5\u4F5C\u533A \u2192 \u4FA7\u8FB9\u680F\uFF09","focus.next":"\u805A\u7126\u4E0B\u4E00\u4E2A\u9762\u677F\uFF08\u4FA7\u8FB9\u680F \u2192 \u5DE5\u4F5C\u533A \u2192 \u6587\u4EF6\uFF09","workspace.zenToggle":"\u5207\u6362\u7985\u6A21\u5F0F","attention.next":"\u8DF3\u5230\u4E0B\u4E00\u4E2A\u9700\u8981\u6CE8\u610F\u7684\u9879\u76EE","chat.interrupt":"\u4E2D\u65AD\u5F53\u524D\u8F6E\u6B21\uFF08\u6D41\u5F0F\u8F93\u51FA\u4E2D\u6309 esc\uFF09","sidebar.nav":"\u4E0A\u4E0B\u79FB\u52A8\u5149\u6807","sidebar.select":"\u6253\u5F00\u9009\u4E2D\u7684\u4EFB\u52A1","sidebar.tree.open":"\u6253\u5F00\u5149\u6807\u6240\u5728\u884C","sidebar.goto":"\u8DF3\u5230\u5217\u8868\u9876\u90E8 / \u5E95\u90E8\uFF08gg \u6216 shift-G\uFF09","sidebar.rename":"\u91CD\u547D\u540D\u4EFB\u52A1","sidebar.localMerge":"\u8C03\u6574\u5F53\u524D\u884C\u987A\u5E8F\uFF08Shift+M\uFF0C\u7136\u540E j/k\u2014\u2014tab / \u4EFB\u52A1 / \u9879\u76EE\uFF09","sidebar.pin":"\u7F6E\u9876 / \u53D6\u6D88\u7F6E\u9876\u4EFB\u52A1\uFF08Shift+P\uFF09","sidebar.sort":"\u5207\u6362\u4EFB\u52A1\u6392\u5E8F\u65B9\u5F0F\uFF08\u9ED8\u8BA4 \u2194 \u6700\u8FD1\uFF09","sidebar.delete":"\u5220\u9664\u4EFB\u52A1\uFF08\u9700\u786E\u8BA4\uFF09","sidebar.search.enter":"\u641C\u7D22\u4EFB\u52A1\uFF08\u6A21\u7CCA\u8FC7\u6EE4\uFF09","sidebar.search.nav":"\u5728\u641C\u7D22\u7ED3\u679C\u4E2D\u79FB\u52A8\u9AD8\u4EAE","sidebar.search.submit":"\u9009\u4E2D\u641C\u7D22\u5339\u914D\u9879\u5E76\u9000\u51FA\u641C\u7D22","sidebar.search.cancel":"\u53D6\u6D88\u641C\u7D22\uFF08\u6062\u590D\u4E4B\u524D\u7684\u9009\u4E2D\u9879\uFF09","tasks.openWorktree":"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u9009\u4E2D Task \u7684\u76EE\u5F55","tasks.renameBranch":"\u91CD\u547D\u540D\u9009\u4E2D\u4EFB\u52A1\u7684 git \u5206\u652F","tasks.cycleEngine":"\u5FAA\u73AF\u5207\u6362\u5F15\u64CE\u5382\u5546\u2014\u2014\u91CD\u65B0\u6253\u5F00\u540E\u751F\u6548","tasks.update":"\u6253\u5F00\u66F4\u65B0\u9875\u9762\uFF08\u6709\u65B0\u7248\u672C\u65F6\uFF09","tasks.focusEngine":"\u805A\u7126\u5F53\u524D\u7A97\u53E3\u7684\u5F15\u64CE\u9762\u677F","tasks.jump":"\u8DF3\u5230\u663E\u793A\u5BF9\u5E94\u6570\u5B57\u7684\u4EFB\u52A1","chat.send":"\u53D1\u9001\u6D88\u606F\uFF08\u8F93\u5165\u6846\uFF09","chat.newline":"\u5728\u8F93\u5165\u6846\u4E2D\u6362\u884C","chat.cycle-mode":"\u5FAA\u73AF\u5207\u6362\u6743\u9650\u6A21\u5F0F\uFF08\u8F93\u5165\u6846\uFF09","chat.steer":"\u5F15\u5BFC\uFF08\u4E2D\u65AD\u5E76\u53D1\u9001\uFF09\u2014\u2014\u4EC5\u9650\u6D41\u5F0F\u8F93\u51FA\u4E2D","chat.tab.new":"\u65B0\u5EFA\u804A\u5929\u6807\u7B7E\u9875","chat.tab.chooseEngine":"\u65B0\u5EFA\u5BF9\u8BDD \u2014\u2014 \u9009\u62E9\u5F15\u64CE\u6216 shell\uFF0C\u53EF\u5207\u6362\u843D\u70B9\u4E0E\u4E0A\u4E0B\u6587","chat.tab.fork":"\u6D3E\u751F\u5F53\u524D\u5BF9\u8BDD\u5230\u65B0\u6807\u7B7E\u9875\uFF08\u540C\u4E00 Task \u76EE\u5F55\uFF0C\u5E26\u4E0A\u5DF2\u6709\u5BF9\u8BDD\uFF09","chat.fork.new":"\u5FEB\u901F\u6D3E\u751F\uFF1A\u4EE5\u5F53\u524D\u4ED3\u5E93/\u5206\u652F/\u6A21\u578B\u521B\u5EFA\u5B50\u4EFB\u52A1","chat.tab.close":"\u5173\u95ED\u804A\u5929\u6807\u7B7E\u9875","chat.tab.rename":"\u91CD\u547D\u540D\u5F53\u524D\u804A\u5929\u6807\u7B7E\u9875","chat.tab.cycle-next":"\u4E0B\u4E00\u4E2A\u804A\u5929\u6807\u7B7E\u9875","chat.tab.cycle-prev":"\u4E0A\u4E00\u4E2A\u804A\u5929\u6807\u7B7E\u9875","workspace.split.right":"\u5411\u53F3\u5206\u5C4F","workspace.split.down":"\u5411\u4E0B\u5206\u5C4F","workspace.split.focus-next":"\u805A\u7126\u4E0B\u4E00\u4E2A\u5206\u5C4F","workspace.split.close":"\u5173\u95ED\u5F53\u524D\u5206\u5C4F\uFF08\u672A\u5206\u5C4F\u65F6\u5173\u95ED\u6807\u7B7E\u9875\uFF09","workspace.split.rename":"\u91CD\u547D\u540D\u5F53\u524D\u5206\u5C4F\uFF08\u672A\u5206\u5C4F\u65F6\u91CD\u547D\u540D\u6807\u7B7E\u9875\uFF09","files.nav":"\u4E0A\u4E0B\u79FB\u52A8\u5149\u6807","files.hierarchy":"\u6298\u53E0 / \u5C55\u5F00\u6811\u5C42\u7EA7","files.open":"\u5728\u5DF2\u914D\u7F6E\u7684\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u6587\u4EF6\uFF08\u652F\u6301\u65F6\u663E\u793A diff\uFF09","files.tab":"\u5207\u6362\u6807\u7B7E\u9875\uFF08\u5FAA\u73AF \u5168\u90E8 / \u53D8\u66F4\uFF09","files.refresh":"\u5237\u65B0","files.scope":"\u5207\u6362\u53D8\u66F4\u8303\u56F4\uFF08\u5DE5\u4F5C\u533A \u2194 \u5206\u652F\u5BF9\u6BD4 base\uFF09","files.diff":"\u5728\u5DE5\u4F5C\u533A\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\u53EA\u8BFB diff","files.openExternal":"\u5728\u7CFB\u7EDF\u9ED8\u8BA4\u5E94\u7528\u4E2D\u6253\u5F00\u6587\u4EF6\uFF08\u97F3\u9891 / \u89C6\u9891 / pdf \u9884\u89C8\uFF09","files.mention":"\u5C06 @<path> \u63D0\u53CA\u6CE8\u5165\u5F15\u64CE\u9762\u677F","files.createPR":"\u8BA9 agent \u4ECE\u5F53\u524D\u4EFB\u52A1\u521B\u5EFA PR","files.fixChecks":"\u8BA9 agent \u4FEE\u590D\u5931\u8D25\u7684 PR \u68C0\u67E5","files.syncBase":"\u628A\u57FA\u7840\u5206\u652F\u5408\u5E76\u8FDB\u8BE5\u4EFB\u52A1\u7684\u5DE5\u4F5C\u6811","diff.review.cursor":"\u5728 diff \u4E2D\u79FB\u52A8\u884C\u5149\u6807","diff.review.range":"\u5728\u5149\u6807\u5904\u5207\u6362\u8303\u56F4\u951A\u70B9","diff.review.note":"\u5728\u5149\u6807\u5904\u6DFB\u52A0\u5BA1\u9605\u5907\u6CE8","diff.review.send":"\u5C06\u6240\u6709\u672A\u53D1\u9001\u7684\u5BA1\u9605\u5907\u6CE8\u53D1\u7ED9\u5F15\u64CE","inbox.nav":"\u5728\u63D0\u9192\u9879\u76EE\u4E4B\u95F4\u79FB\u52A8","inbox.open":"\u6253\u5F00\u9009\u4E2D\u7684\u63D0\u9192\u9879\u76EE","inbox.delete":"\u6E05\u9664\u9009\u4E2D\u7684\u63D0\u9192\u9879\u76EE","terminal.scroll-up":"\u5411\u4E0A\u6EDA\u52A8\u56DE\u6EDA","terminal.scroll-down":"\u5411\u4E0B\u6EDA\u52A8\u56DE\u6EDA","terminal.reset":"\u91CD\u7F6E\u7EC8\u7AEF\u2014\u2014\u5173\u95ED\u5F53\u524D shell \u5E76\u91CD\u65B0\u542F\u52A8","terminal.search":"\u641C\u7D22\u56DE\u6EDA\u7F13\u51B2\u533A","terminal.search.older":"\u56DE\u6EDA\u641C\u7D22\uFF1A\u8DF3\u5230\u66F4\u65E9\u7684\u5339\u914D","terminal.search.newer":"\u56DE\u6EDA\u641C\u7D22\uFF1A\u8DF3\u5230\u66F4\u665A\u7684\u5339\u914D","terminal.search.cancel":"\u5173\u95ED\u56DE\u6EDA\u641C\u7D22\uFF08\u6062\u590D\u539F\u6765\u7684\u6EDA\u52A8\u4F4D\u7F6E\uFF09","dialog.cancel":"\u5173\u95ED\u9876\u5C42\u5BF9\u8BDD\u6846\uFF08esc\uFF09","dialog.newtask.tab.cycle":"\u5207\u6362\u65B0\u5EFA\u4EFB\u52A1\u6807\u7B7E\u9875\uFF08\u73B0\u6709\u4ED3\u5E93 / \u65B0\u4ED3\u5E93\uFF09"}}});var en9,zh9;var init_newTask=__esm(()=>{en9={title:"New task",legend:"enter create \xB7 tab fields \xB7 ctrl+[ ] mode \xB7 ctrl+e engine \xB7 esc cancel",tabs:{existing:"For Existing",clone:"For New Repo",adopt:"Adopt Worktree"},field:{mode:"MODE",engine:"ENGINE",repo:"REPO",fromBranch:"FROM BRANCH",gitUrl:"GIT URL",parentDir:"PARENT DIR",folderName:"FOLDER NAME",baseBranch:"BASE BRANCH",adoptFilter:"FILTER (PATH GLOB)",opens:"OPENS"},intent:{task:"a new task worktree",project:"the project itself"},placeholder:{folderName:"auto from url",adoptFilter:"* \u2014 type e.g. feature-* to narrow"},hint:{modeCycle:"ctrl+[ ]",engineCycle:"ctrl+e",remembered:"(remembered \u2014 next clone defaults to this dir)",currentDir:"(current dir)",noBranchesFound:"(no local branches found \u2014 typed text will be used as ref)",noMatchBranch:"(no match \u2014 typed text will be used as ref)",scanningWorktrees:"scanning worktrees\u2026"},picker:{moreAbove:"\u2191 {count} more",moreBelow:"\u2193 {count} more"},open:{failed:"Couldn't open the project: {error}"},adopt:{repoLine:"repo: {path}",repoNone:"(none)",noUnlinked:"no unlinked worktrees \u2014 every git worktree here is already a task",noMatch:"no worktrees match the filter",hintSelected:"{count} selected \xB7 enter toggles \xB7 ctrl+a all \xB7 Create imports",hintDefault:"enter toggles \xB7 ctrl+a all \xB7 Create imports the highlighted row",summaryAll:"Adopted {count} worktree(s)",summaryPartial:"Adopted {done}/{total} worktrees \u2014 the rest failed (see log)",summaryNone:"Couldn't adopt any worktree: {error}"},clone:{progressFallback:"Cloning\u2026",progressInto:"Cloning into {target}\u2026"},button:{create:"Create",cloning:"Cloning\u2026"},error:{gitUrlRequired:"git URL is required",gitUrlInvalid:"does not look like a git URL: {url}",folderRequired:"folder name is required",folderHasSeparator:"folder name cannot contain path separators",parentRequired:"parent directory is required",parentNotFound:"parent directory does not exist: {path}",parentNotDir:"not a directory: {path}",targetExists:"target already exists: {path}",cloneFailed:"git clone failed: {error}",noAdoptable:"no adoptable worktrees to import",repoAmbiguous:"more than one saved repo is named {name} \u2014 pick the one you mean from the list"}},zh9={title:"\u65B0\u5EFA\u4EFB\u52A1",legend:"enter \u521B\u5EFA \xB7 tab \u5207\u5B57\u6BB5 \xB7 ctrl+[ ] \u5207\u6A21\u5F0F \xB7 ctrl+e \u5F15\u64CE \xB7 esc \u53D6\u6D88",tabs:{existing:"\u5DF2\u6709\u4ED3\u5E93",clone:"\u514B\u9686\u65B0\u4ED3\u5E93",adopt:"\u63A5\u7BA1 Worktree"},field:{mode:"\u6A21\u5F0F",engine:"\u5F15\u64CE",repo:"\u4ED3\u5E93",fromBranch:"\u57FA\u51C6\u5206\u652F",gitUrl:"git \u5730\u5740",parentDir:"\u7236\u76EE\u5F55",folderName:"\u6587\u4EF6\u5939\u540D",baseBranch:"\u57FA\u51C6\u5206\u652F",adoptFilter:"\u8FC7\u6EE4\uFF08\u8DEF\u5F84 glob\uFF09",opens:"\u6253\u5F00"},intent:{task:"\u65B0\u5EFA\u4EFB\u52A1 worktree",project:"\u9879\u76EE\u672C\u8EAB"},placeholder:{folderName:"\u81EA\u52A8\u4ECE\u5730\u5740\u63A8\u5BFC",adoptFilter:"* \u2014 \u8F93\u5165\u5982 feature-* \u6765\u7F29\u5C0F\u8303\u56F4"},hint:{modeCycle:"ctrl+[ ]",engineCycle:"ctrl+e",remembered:"\uFF08\u5DF2\u8BB0\u4F4F \u2014 \u4E0B\u6B21\u514B\u9686\u9ED8\u8BA4\u4F7F\u7528\u6B64\u76EE\u5F55\uFF09",currentDir:"\uFF08\u5F53\u524D\u76EE\u5F55\uFF09",noBranchesFound:"\uFF08\u672A\u627E\u5230\u672C\u5730\u5206\u652F \u2014 \u5C06\u76F4\u63A5\u4F7F\u7528\u8F93\u5165\u6587\u672C\u4F5C\u4E3A ref\uFF09",noMatchBranch:"\uFF08\u65E0\u5339\u914D \u2014 \u5C06\u76F4\u63A5\u4F7F\u7528\u8F93\u5165\u6587\u672C\u4F5C\u4E3A ref\uFF09",scanningWorktrees:"\u6B63\u5728\u626B\u63CF worktree\u2026"},picker:{moreAbove:"\u2191 \u8FD8\u6709 {count} \u9879",moreBelow:"\u2193 \u8FD8\u6709 {count} \u9879"},open:{failed:"\u65E0\u6CD5\u6253\u5F00\u9879\u76EE\uFF1A{error}"},adopt:{repoLine:"\u4ED3\u5E93\uFF1A{path}",repoNone:"\uFF08\u65E0\uFF09",noUnlinked:"\u6CA1\u6709\u672A\u5173\u8054\u7684 worktree \u2014 \u6B64\u4ED3\u5E93\u6240\u6709 git worktree \u5747\u5DF2\u662F\u4EFB\u52A1",noMatch:"\u6CA1\u6709 worktree \u5339\u914D\u6B64\u8FC7\u6EE4\u6761\u4EF6",hintSelected:"\u5DF2\u9009 {count} \u9879 \xB7 enter \u5207\u6362\u9009\u4E2D \xB7 ctrl+a \u5168\u9009 \xB7 \u521B\u5EFA \u5BFC\u5165",hintDefault:"enter \u5207\u6362\u9009\u4E2D \xB7 ctrl+a \u5168\u9009 \xB7 \u521B\u5EFA \u5C06\u5BFC\u5165\u9AD8\u4EAE\u884C",summaryAll:"\u5DF2\u63A5\u7BA1 {count} \u4E2A worktree",summaryPartial:"\u5DF2\u63A5\u7BA1 {done}/{total} \u4E2A worktree \u2014 \u5176\u4F59\u5931\u8D25\uFF08\u8BE6\u89C1\u65E5\u5FD7\uFF09",summaryNone:"\u6CA1\u6709 worktree \u63A5\u7BA1\u6210\u529F\uFF1A{error}"},clone:{progressFallback:"\u514B\u9686\u4E2D\u2026",progressInto:"\u6B63\u5728\u514B\u9686\u5230 {target}\u2026"},button:{create:"\u521B\u5EFA",cloning:"\u514B\u9686\u4E2D\u2026"},error:{gitUrlRequired:"git \u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A",gitUrlInvalid:"\u4E0D\u50CF\u662F\u6709\u6548\u7684 git \u5730\u5740\uFF1A{url}",folderRequired:"\u6587\u4EF6\u5939\u540D\u4E0D\u80FD\u4E3A\u7A7A",folderHasSeparator:"\u6587\u4EF6\u5939\u540D\u4E0D\u80FD\u5305\u542B\u8DEF\u5F84\u5206\u9694\u7B26",parentRequired:"\u7236\u76EE\u5F55\u4E0D\u80FD\u4E3A\u7A7A",parentNotFound:"\u7236\u76EE\u5F55\u4E0D\u5B58\u5728\uFF1A{path}",parentNotDir:"\u4E0D\u662F\u76EE\u5F55\uFF1A{path}",targetExists:"\u76EE\u6807\u8DEF\u5F84\u5DF2\u5B58\u5728\uFF1A{path}",cloneFailed:"git clone \u5931\u8D25\uFF1A{error}",noAdoptable:"\u6CA1\u6709\u53EF\u63A5\u7BA1\u7684 worktree",repoAmbiguous:"\u6709\u591A\u4E2A\u5DF2\u4FDD\u5B58\u4ED3\u5E93\u90FD\u53EB {name} \u2014 \u8BF7\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4F60\u8981\u7684\u90A3\u4E2A"}}});var en10,zh10;var init_onboarding=__esm(()=>{en10={title:"Welcome to Rove",subtitle:"Two quick questions and a quick environment check before your first launch.",completionsQuestion:"Install shell completions for {shell}?",completionsExplain:"Tab-completes rove subcommands. One line is added to your shell config.",skillQuestion:"Install the Rove agent skill?",skillExplain:"Teaches coding agents to drive Rove from the shell via `rove api`.",optionYes:"Yes (recommended)",optionNo:"No",legend:"\u2191\u2193 select \xB7 enter confirm \xB7 q skip setup",keysTitle:"Keyboard basics",keysBare:"Bare keys act in the focused pane \u2014 {nav} moves, {open} opens.",keysOnePress:"A few one-press chords are Rove's own \u2014 {newTab} new tab, {focusNext} next pane.",keysPrefix:"{prefix} opens the command map \u2014 hold it a beat and a guide appears.",keysHelp:"{help} shows the full live reference anytime.",keysLegend:"enter finish",envTitle:"Environment check",envExplain:"Read-only \u2014 what Rove found on this machine:",envReady:"\u2713 You're set \u2014 at least one engine is ready.",envNotReady:"\u2717 No usable engine yet \u2014 Rove needs one to run tasks.",envLegend:"enter continue \xB7 q skip setup",notReadyHeader:"Not ready yet:",appliedCompletions:"\u2713 completions hooked into {path} (takes effect in new shells)",skippedCompletions:"\xB7 completions skipped \u2014 run `{command}` anytime",installingSkill:"installing the Rove agent skill ({command})\u2026",skillFailed:"! skill install failed \u2014 retry with `{command}`",skillNeedsNode:"! agent skill needs `npx` (part of Node.js) \u2014 install Node from https://nodejs.org, then run `{command}`",skippedSkill:"\xB7 agent skill skipped \u2014 run `{command}` anytime",ready:"You're ready to go!",readyHint:"Run `{command}` to launch the TUI."},zh10={title:"\u6B22\u8FCE\u4F7F\u7528 Rove",subtitle:"\u9996\u6B21\u542F\u52A8\u524D\uFF0C\u5148\u56DE\u7B54\u4E24\u4E2A\u5C0F\u95EE\u9898\uFF0C\u518D\u505A\u4E00\u6B21\u73AF\u5883\u68C0\u67E5\u3002",completionsQuestion:"\u4E3A {shell} \u5B89\u88C5 shell \u8865\u5168\u5417\uFF1F",completionsExplain:"\u8BA9 rove \u5B50\u547D\u4EE4\u652F\u6301 Tab \u8865\u5168\uFF0C\u4F1A\u5728\u4F60\u7684 shell \u914D\u7F6E\u91CC\u52A0\u4E00\u884C\u3002",skillQuestion:"\u5B89\u88C5 Rove agent skill \u5417\uFF1F",skillExplain:"\u6559\u4F1A\u7F16\u7801 agent \u901A\u8FC7 `rove api` \u5728\u547D\u4EE4\u884C\u9A71\u52A8 Rove\u3002",optionYes:"\u5B89\u88C5\uFF08\u63A8\u8350\uFF09",optionNo:"\u8DF3\u8FC7",legend:"\u2191\u2193 \u9009\u62E9 \xB7 enter \u786E\u8BA4 \xB7 q \u8DF3\u8FC7\u8BBE\u7F6E",keysTitle:"\u952E\u76D8\u57FA\u7840",keysBare:"\u88F8\u952E\u4F5C\u7528\u4E8E\u5F53\u524D\u805A\u7126\u9762\u677F \u2014 {nav} \u79FB\u52A8\uFF0C{open} \u6253\u5F00\u3002",keysOnePress:"\u5C11\u91CF\u5355\u6B21\u5FEB\u6377\u952E\u5C5E\u4E8E Rove \u81EA\u5DF1 \u2014 {newTab} \u65B0\u6807\u7B7E\u9875\uFF0C{focusNext} \u5207\u6362\u9762\u677F\u3002",keysPrefix:"{prefix} \u6253\u5F00\u547D\u4EE4\u5C42 \u2014 \u6309\u4F4F\u7A0D\u7B49\u4F1A\u51FA\u73B0\u547D\u4EE4\u6307\u5357\u3002",keysHelp:"\u968F\u65F6\u6309 {help} \u67E5\u770B\u5B8C\u6574\u7684\u5B9E\u65F6\u952E\u4F4D\u8868\u3002",keysLegend:"enter \u5B8C\u6210",envTitle:"\u73AF\u5883\u68C0\u67E5",envExplain:"\u53EA\u8BFB\u68C0\u67E5 \u2014 Rove \u5728\u8FD9\u53F0\u673A\u5668\u4E0A\u53D1\u73B0\u4E86\u4EC0\u4E48\uFF1A",envReady:"\u2713 \u4E00\u5207\u5C31\u7EEA \u2014 \u81F3\u5C11\u4E00\u4E2A\u5F15\u64CE\u53EF\u7528\u3002",envNotReady:"\u2717 \u8FD8\u6CA1\u6709\u53EF\u7528\u5F15\u64CE \u2014 Rove \u9700\u8981\u4E00\u4E2A\u5F15\u64CE\u624D\u80FD\u8FD0\u884C\u4EFB\u52A1\u3002",envLegend:"enter \u7EE7\u7EED \xB7 q \u8DF3\u8FC7\u8BBE\u7F6E",notReadyHeader:"\u8FD8\u6CA1\u51C6\u5907\u597D\uFF1A",appliedCompletions:"\u2713 \u8865\u5168\u5DF2\u5199\u5165 {path}\uFF08\u65B0\u5F00\u7684 shell \u751F\u6548\uFF09",skippedCompletions:"\xB7 \u5DF2\u8DF3\u8FC7\u8865\u5168 \u2014 \u4E4B\u540E\u53EF\u968F\u65F6\u8FD0\u884C `{command}`",installingSkill:"\u6B63\u5728\u5B89\u88C5 Rove agent skill\uFF08{command}\uFF09\u2026",skillFailed:"! skill \u5B89\u88C5\u5931\u8D25 \u2014 \u53EF\u7528 `{command}` \u91CD\u8BD5",skillNeedsNode:"! agent skill \u9700\u8981 `npx`\uFF08Node.js \u7684\u4E00\u90E8\u5206\uFF09\u2014 \u8BF7\u4ECE https://nodejs.org \u5B89\u88C5 Node\uFF0C\u7136\u540E\u8FD0\u884C `{command}`",skippedSkill:"\xB7 \u5DF2\u8DF3\u8FC7 agent skill \u2014 \u4E4B\u540E\u53EF\u968F\u65F6\u8FD0\u884C `{command}`",ready:"\u4E00\u5207\u5C31\u7EEA\uFF01",readyHint:"\u8FD0\u884C `{command}` \u542F\u52A8 TUI\u3002"}});var en11,zh11;var init_ops=__esm(()=>{en11={preview:{diffVsHead:"diff vs HEAD",diffVsBase:"diff vs {base}",file:"file",image:"image",binary:"binary file",closeHint:"\xB7 q to close",loading:"loading\u2026",noTextPreview:"no text preview",openHint:"o open in system viewer",review:{noteDialogTitle:"Review note \u2014 {location}",noteFieldLabel:"note",noteSubmitLabel:"add note",notePlaceholder:"what should the agent change here?",count:"{total} notes \xB7 {unsent} unsent",keysHint:"j/k line \xB7 v range \xB7 c note \xB7 x drop \xB7 s send \xB7 r reload",sendNoEngine:"No engine session in this task \u2014 the notes are still unsent. Open one with ctrl+t."}}},zh11={preview:{diffVsHead:"\u4E0E HEAD \u5BF9\u6BD4",diffVsBase:"\u4E0E {base} \u5BF9\u6BD4",file:"\u6587\u4EF6",image:"\u56FE\u7247",binary:"\u4E8C\u8FDB\u5236\u6587\u4EF6",closeHint:"\xB7 q \u5173\u95ED",loading:"\u52A0\u8F7D\u4E2D\u2026",noTextPreview:"\u65E0\u6587\u672C\u9884\u89C8",openHint:"o \u7528\u7CFB\u7EDF\u67E5\u770B\u5668\u6253\u5F00",review:{noteDialogTitle:"\u8BC4\u5BA1\u5907\u6CE8 \u2014 {location}",noteFieldLabel:"\u5907\u6CE8",noteSubmitLabel:"\u6DFB\u52A0\u5907\u6CE8",notePlaceholder:"\u5E0C\u671B agent \u5728\u8FD9\u91CC\u6539\u4EC0\u4E48\uFF1F",count:"{total} \u6761\u5907\u6CE8 \xB7 {unsent} \u6761\u672A\u53D1\u9001",keysHint:"j/k \u884C \xB7 v \u8303\u56F4 \xB7 c \u5907\u6CE8 \xB7 x \u5220\u9664 \xB7 s \u53D1\u9001 \xB7 r \u91CD\u8F7D",sendNoEngine:"\u8FD9\u4E2A\u4EFB\u52A1\u6CA1\u6709\u5F15\u64CE\u4F1A\u8BDD\u2014\u2014\u5907\u6CE8\u4ECD\u672A\u53D1\u9001\u3002\u7528 ctrl+t \u5F00\u4E00\u4E2A\u3002"}}}});var en12,zh12;var init_quickTask=__esm(()=>{en12={title:"Quick task \xB7 {repoLabel}",promptLabel:"PROMPT",promptPlaceholder:"what should this task do?",engineLabel:"ENGINE",branchLabel:"BRANCH",legend:"enter create \xB7 tab fields \xB7 ctrl+e engine \xB7 ctrl+v attach \xB7 esc cancel"},zh12={title:"\u5FEB\u901F\u4EFB\u52A1 \xB7 {repoLabel}",promptLabel:"\u63D0\u793A\u8BCD",promptPlaceholder:"\u8FD9\u4E2A\u4EFB\u52A1\u8981\u505A\u4EC0\u4E48\uFF1F",engineLabel:"\u5F15\u64CE",branchLabel:"\u5206\u652F",legend:"enter \u521B\u5EFA \xB7 tab \u5207\u6362\u5B57\u6BB5 \xB7 ctrl+e \u5F15\u64CE \xB7 ctrl+v \u9644\u4EF6 \xB7 esc \u53D6\u6D88"}});var en13,zh13;var init_settings=__esm(()=>{en13={title:"Settings",esc:"esc",nav:{default:"j/k pick \xB7 h/l switch level \xB7 enter activate \xB7 esc close",feedback:"tab next field \xB7 enter sends on Send \xB7 esc close"},sections:{general:"General",engines:"Engines",plugins:"Plugins",keys:"Keybindings",feedback:"Feedback",dev:"Dev"},general:{usage:"USAGE",theme:"Theme",themeHint:"l to enter list \xB7 j/k to highlight \xB7 enter to apply",language:"Language",languageHint:"Display language for Rove's UI. l to enter list \xB7 j/k to highlight \xB7 enter to apply.",transparent:"Transparent background",transparentHint:"Drops the renderer's bg fill so the host terminal shows through. enter toggles.",on:"[x] on",off:"[ ] off",focusAccent:"Focus accent",focusAccentHint:"Color of focused pane title, \u258C marker, and split borders.",accentPrimary:"Primary (brand accent)",accentSuccess:"Success (legacy green)",accentInfo:"Info (cool blue)",appearance:"Appearance",appearanceHint:"How split panes draw.",splitBox:"Box frames",splitLine:"Divider line",notifications:"Notifications",notificationsHint:"When a background tab finishes or pauses on an approval.",toast:"Toast",toastHint:"bottom-right popup",sound:"Sound",soundHint:"bell + chime + an OSC 9 desktop notification (rides SSH)",crossTask:"Cross-task",crossTaskHint:"also for a task you switched away from",keyHints:"Keyboard hints",keyHintsHint:"The status-bar reminder and the first-use hints in the sidebar and files panes.",keyHintsShow:"Show keyboard hints",keyHintsShowHint:"re-enabling relights hints dismissed by use",zen:"Zen mode",zenHint:"The `zen` chip and `prefix`+z hide Files, keeping the Tasks rail and workspace.",zenDefaultOn:"Start in zen mode",zenKeepTasks:"Keep Tasks pane",zenKeepTasksHint:"legacy \u2014 no layout effect today",editor:"Editor",editorHint:"What enter opens a file with in the file tree \u2014 diff mode when the editor supports it, the read-only preview when it isn't installed.",editorRow:"editor: < {kind} >",editorRowHint:"auto follows $VISUAL / $EDITOR, else nvim / vim / emacs / nano",editorCustom:"custom: {cmd}",editorCustomUnset:"(unset \u2014 enter to edit)",worktree:"Worktree location",worktreeHint:"Where new task worktrees are created. New tasks only.",worktreeBase:"location: < {kind} >",worktreeBaseHint:"custom takes `~`, a relative path, or a leading `$project_dir`",worktreeKindDefault:"default ~/.rove/worktrees",worktreeKindNext:"next to project",worktreeKindCustom:"custom",worktreeCustom:"custom: {path}",worktreeCustomUnset:"(unset \u2014 enter to edit)",worktreeBaseTitle:"Custom worktree location (blank = default; $project_dir = project root)",worktreeBaseField:"PATH",terminal:"Terminal",terminalHint:"Applies to terminals opened after the change.",scrollbackRow:"scrollback: {rows} rows",scrollbackRowHint:"100\u2013100000 \xB7 larger costs proportionally more CPU per redraw",scrollbackTitle:"Terminal scrollback rows (100\u2013100000)",scrollbackField:"ROWS",scrollbackInvalidTitle:"Not a number",scrollbackInvalidBody:"Scrollback must be a number of rows (e.g. 1000). Keeping the previous setting.",tabStripRow:"tab strip: {mode}",tabStripMode:{never:"off \u2014 the sidebar tree lists tabs",multipleOnly:"only with 2+ tabs",always:"always"}},engines:{title:"Engines",hint:"Every engine Rove can launch, with what detection found under each one: where its binary is, and for the engines with an account detector whether you are logged in. [x] = offered when picking an engine for a task; (\u25CF) = the global default (per-project picks, e.g. Ctrl+Shift+T, override it) \u2014 click either, or use the keys below. Override a launch command when the binary isn't on PATH or to pass default flags. space on/off \xB7 enter edit command \xB7 r rename \xB7 x reset/remove \xB7 d set default.",customTag:" (custom)",addEngine:"+ Add engine"},accounts:{checking:"Checking\u2026",notLoggedIn:"\u25CB Not logged in",loggedIn:"\u25CF Logged in: {email}",apiKeyConfigured:"\u25CF API key configured",chatgptLogin:"\u25CF ChatGPT login: {email}",tokenConfigured:"\u25CF Token configured ({source})",detected:"\u25CF Login detected"},plugins:{title:"Plugins",hint:"Plugins registered in ~/.kobe/plugins.json. enter (or click) toggles one on or off \u2014 the daemon watches the file, so the change applies live. Rows indented under a plugin are the settings it declares; enter edits one, and the value reaches the plugin on its next run. Install and remove them from the shell: `rove plugin install <owner/repo>`, `rove plugin link <dir>`.",empty:"No plugins registered. Install one with `rove plugin install <owner/repo>` \u2014 browse the `rove-plugin` topic on GitHub.",sourceLink:"linked {path}",sourceGithub:"{spec}",updateAvailable:"update available \u2014 rove plugin update",declares:"{actions} actions \xB7 {events} events \xB7 {panes} panes",declaresWithEngines:"{actions} actions \xB7 {events} events \xB7 {panes} panes \xB7 {engines} engines",manifestUnreadable:"manifest unreadable",unsupportedPlatform:"\xB7 not supported on this platform",noHooks:"\xB7 no hooks declared",lastRun:"\xB7 last run {label} {status} {ago} ago",neverRun:"\xB7 never run",runOk:"ok",runFailed:"failed to start",runExit:"exit {code}",settingUnset:"(unset \u2014 enter to edit)",settingInvalidTitle:"Not a number",settingInvalidBody:"{label} only accepts a number. Keeping the previous value."},keybindings:{title:"Keybindings",hint:"Rebind direct and prefix chords in your own YAML file; changes reload live. Press F1 anywhere for the live keymap with every binding id.",configFile:"Config file",notCreated:" (not created yet)",prefixTitle:"Command layer ({prefix})",prefixHint:"Bare keys act in the focused pane; a small one-press set covers frequent Rove actions; {prefix} opens the command layer ({timeout}ms second-stroke window). Prefix bindings keep their pane scope and modal rules.",tapPresentation:"Prefix tap",tapPresentationHint:"Choose whether the complete guide also marks controls already on screen.",tapPresentationLocal:"On-screen entries + complete guide (default)",tapPresentationGuide:"Complete guide only",prefixDisabled:"disabled",fixed:"Fixed (not rebindable): {ids}.",createHint:"No overrides file yet. Rove can write one for you, fully commented \u2014 nothing is rebound until you uncomment a line.",createFile:"[enter] Create keybindings.yaml",overridesApplied:"Overrides applied",none:"none",unbound:"(unbound)",defaultKeys:"default: {keys}",warnings:"Warnings"},feedback:{title:"Feedback",hint:"Sends a GitHub Discussion to the Rove repo through `gh`. Requires `gh auth login`; category defaults to Feedback.",titleLabel:"title",titlePlaceholder:"Short summary",descriptionLabel:"description",descriptionPlaceholder:"What happened? (enter for a new line \xB7 tab to Send)",send:"[enter] Send to GitHub Discussions"},dev:{reset:"Reset UI state",resetHint:"Clears ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove \u2014 relaunch to start fresh. Working session list, pane sizes, theme, model picks all reset. Worktrees on disk and engine session history are not touched.",resetButton:"[enter] Reset",restart:"Restart backend",restartHint:"Stops the Rove daemon and quits this Rove window so the next launch spawns a fresh daemon \u2014 picks up daemon / orchestrator / engine edits without a process kill. Other attached Rove windows will lose their connection too.",restartButton:"[enter] Restart",doctorHint:"Daemon wedged or unresponsive? From a shell, run `rove daemon restart`, then relaunch Rove. Hosted engine sessions stay alive across a daemon restart.",experimental:"Experimental",remoteHint:"Remote projects (SSH): register a project whose git worktrees live on another host, driven from this local Rove. Unfinished \u2014 Hosted PTY engine launch over SSH is not implemented, and file/diff panes still degrade. Enables `rove add --remote`.",remote:"Remote projects",autoStatusHint:"Auto status flow: a backlog task moves to in_progress when its engine starts a turn, and new sessions get a system-prompt note telling the agent to set in_review itself when the work is done. Never touches done/canceled.",autoStatus:"Auto status flow",dispatcherHint:"Field-notes dispatcher: task sessions file one-line gotchas (`rove api note`), the daemon forwards each to the repo's main session, and that session relays them to the in-flight tasks that benefit (`rove api dispatch`). Web-hosted sessions receive the relays today.",dispatcher:"Field-notes dispatcher",composerGateHint:"Before pasting a peer/API prompt into a running engine, Rove reads that session's screen and holds the message if the composer already has text in it. The check knows each engine's CURRENT layout, so a vendor redesign can make it wrong \u2014 turn it off if messages are being held over composers you can see are empty. The separate recent-keystroke guard stays on either way, so a composer you are typing into now is still protected.",composerGate:"Check the composer before delivering"}},zh13={title:"\u8BBE\u7F6E",esc:"esc",nav:{default:"j/k \u9009\u62E9 \xB7 h/l \u5207\u6362\u5C42\u7EA7 \xB7 enter \u786E\u8BA4 \xB7 esc \u5173\u95ED",feedback:"tab \u4E0B\u4E00\u9879 \xB7 enter \u5728\u53D1\u9001\u9879\u53D1\u9001 \xB7 esc \u5173\u95ED"},sections:{general:"\u901A\u7528",engines:"\u5F15\u64CE",plugins:"\u63D2\u4EF6",keys:"\u5FEB\u6377\u952E",feedback:"\u53CD\u9988",dev:"\u5F00\u53D1"},general:{usage:"\u7528\u91CF",theme:"\u4E3B\u9898",themeHint:"l \u8FDB\u5165\u5217\u8868 \xB7 j/k \u9AD8\u4EAE \xB7 enter \u5E94\u7528",language:"\u8BED\u8A00",languageHint:"Rove \u754C\u9762\u7684\u663E\u793A\u8BED\u8A00\u3002l \u8FDB\u5165\u5217\u8868 \xB7 j/k \u9AD8\u4EAE \xB7 enter \u5E94\u7528\u3002",transparent:"\u900F\u660E\u80CC\u666F",transparentHint:"\u53BB\u6389\u6E32\u67D3\u5668\u7684\u80CC\u666F\u586B\u5145\uFF0C\u8BA9\u5BBF\u4E3B\u7EC8\u7AEF\u900F\u51FA\u6765\u3002\u6309 enter \u5207\u6362\u3002",on:"[x] \u5F00",off:"[ ] \u5173",focusAccent:"\u805A\u7126\u5F3A\u8C03\u8272",focusAccentHint:"\u805A\u7126\u9762\u677F\u6807\u9898\u3001\u258C \u6807\u8BB0\u548C\u5206\u9694\u8FB9\u6846\u7684\u989C\u8272\u3002",accentPrimary:"\u4E3B\u8272\uFF08\u54C1\u724C\u5F3A\u8C03\u8272\uFF09",accentSuccess:"\u6210\u529F\u8272\uFF08\u4F20\u7EDF\u7EFF\uFF09",accentInfo:"\u4FE1\u606F\u8272\uFF08\u51B7\u84DD\uFF09",appearance:"\u5916\u89C2",appearanceHint:"\u5206\u5C4F\u9762\u677F\u600E\u4E48\u753B\u8FB9\u3002",splitBox:"\u65B9\u6846\u8FB9\u6846",splitLine:"\u5355\u7EBF\u5206\u9694",notifications:"\u901A\u77E5",notificationsHint:"\u540E\u53F0\u6807\u7B7E\u5B8C\u6210\u6216\u5728\u5BA1\u6279\u5904\u6682\u505C\u65F6\u89E6\u53D1\u3002",toast:"Toast \u5F39\u7A97",toastHint:"\u53F3\u4E0B\u89D2\u5F39\u7A97",sound:"\u58F0\u97F3",soundHint:"\u54CD\u94C3 + \u63D0\u793A\u97F3 + OSC 9 \u684C\u9762\u901A\u77E5\uFF08\u7ECF SSH \u76F4\u8FBE\u672C\u5730\uFF09",crossTask:"\u8DE8\u4EFB\u52A1",crossTaskHint:"\u4F60\u5DF2\u5207\u8D70\u7684\u4EFB\u52A1\u4E5F\u901A\u77E5",keyHints:"\u952E\u76D8\u63D0\u793A",keyHintsHint:"\u72B6\u6001\u680F\u63D0\u9192\uFF0C\u4EE5\u53CA\u4FA7\u680F\u548C\u6587\u4EF6\u9762\u677F\u7684\u9996\u7528\u63D0\u793A\u3002",keyHintsShow:"\u663E\u793A\u952E\u76D8\u63D0\u793A",keyHintsShowHint:"\u91CD\u65B0\u5F00\u542F\u4F1A\u70B9\u4EAE\u5DF2\u56E0\u4F7F\u7528\u800C\u7184\u706D\u7684\u63D0\u793A",zen:"\u7985\u6A21\u5F0F",zenHint:"`zen` \u6807\u8BB0\u548C `prefix`+z \u9690\u85CF Files\uFF0C\u4FDD\u7559 Tasks \u4FA7\u680F\u4E0E workspace\u3002",zenDefaultOn:"\u542F\u52A8\u5373\u8FDB\u5165\u7985\u6A21\u5F0F",zenKeepTasks:"\u4FDD\u7559 Tasks \u9762\u677F",zenKeepTasksHint:"\u65E7\u8BBE\u7F6E \u2014 \u5F53\u524D\u4E0D\u6539\u53D8\u5E03\u5C40",editor:"\u7F16\u8F91\u5668",editorHint:"\u6587\u4EF6\u6811\u91CC\u6309 enter \u7528\u4EC0\u4E48\u6253\u5F00\u6587\u4EF6\u2014\u2014\u652F\u6301\u65F6\u8D70\u7F16\u8F91\u5668 diff \u6A21\u5F0F\uFF0C\u672A\u5B89\u88C5\u65F6\u56DE\u9000\u5230\u53EA\u8BFB\u9884\u89C8\u3002",editorRow:"\u7F16\u8F91\u5668: < {kind} >",editorRowHint:"auto \u8DDF\u968F $VISUAL / $EDITOR\uFF0C\u5426\u5219 nvim / vim / emacs / nano",editorCustom:"\u81EA\u5B9A\u4E49: {cmd}",editorCustomUnset:"(\u672A\u8BBE\u7F6E \u2014 enter \u7F16\u8F91)",worktree:"\u5DE5\u4F5C\u6811\u4F4D\u7F6E",worktreeHint:"\u65B0\u4EFB\u52A1\u5DE5\u4F5C\u6811\u7684\u521B\u5EFA\u4F4D\u7F6E\u3002\u4EC5\u5BF9\u65B0\u4EFB\u52A1\u751F\u6548\u3002",worktreeBase:"\u4F4D\u7F6E: < {kind} >",worktreeBaseHint:"\u81EA\u5B9A\u4E49\u53EF\u586B `~`\u3001\u76F8\u5BF9\u8DEF\u5F84\u6216\u4EE5 `$project_dir` \u5F00\u5934",worktreeKindDefault:"\u9ED8\u8BA4 ~/.rove/worktrees",worktreeKindNext:"\u9879\u76EE\u65C1\u8FB9",worktreeKindCustom:"\u81EA\u5B9A\u4E49",worktreeCustom:"\u81EA\u5B9A\u4E49: {path}",worktreeCustomUnset:"(\u672A\u8BBE\u7F6E \u2014 enter \u7F16\u8F91)",worktreeBaseTitle:"\u81EA\u5B9A\u4E49\u5DE5\u4F5C\u6811\u4F4D\u7F6E\uFF08\u7559\u7A7A = \u9ED8\u8BA4\uFF1B$project_dir = \u9879\u76EE\u6839\u76EE\u5F55\uFF09",worktreeBaseField:"\u8DEF\u5F84",terminal:"\u7EC8\u7AEF",terminalHint:"\u5BF9\u4FEE\u6539\u540E\u65B0\u6253\u5F00\u7684\u7EC8\u7AEF\u751F\u6548\u3002",scrollbackRow:"\u56DE\u6EDA\u884C\u6570: {rows} \u884C",scrollbackRowHint:"100\u2013100000 \xB7 \u8C03\u5927\u4F1A\u6309\u6BD4\u4F8B\u589E\u52A0\u6BCF\u6B21\u91CD\u7ED8\u7684 CPU",scrollbackTitle:"\u7EC8\u7AEF\u56DE\u6EDA\u884C\u6570\uFF08100\u2013100000\uFF09",scrollbackField:"\u884C\u6570",scrollbackInvalidTitle:"\u4E0D\u662F\u6570\u5B57",scrollbackInvalidBody:"\u56DE\u6EDA\u884C\u6570\u5FC5\u987B\u662F\u6570\u5B57\uFF08\u5982 1000\uFF09\u3002\u4FDD\u7559\u539F\u8BBE\u7F6E\u3002",tabStripRow:"\u6807\u7B7E\u680F: {mode}",tabStripMode:{never:"\u5173\u95ED \u2014 \u6807\u7B7E\u5728\u5DE6\u4FA7\u6811\u91CC",multipleOnly:"\u4EC5 2 \u4E2A\u4EE5\u4E0A\u6807\u7B7E\u65F6\u663E\u793A",always:"\u59CB\u7EC8\u663E\u793A"}},engines:{title:"\u5F15\u64CE",hint:"Rove \u80FD\u542F\u52A8\u7684\u6240\u6709\u5F15\u64CE\uFF0C\u6BCF\u4E2A\u4E0B\u9762\u8DDF\u7740\u672C\u5730\u63A2\u6D4B\u5230\u7684\u60C5\u51B5\uFF1A\u4E8C\u8FDB\u5236\u5728\u54EA\uFF0C\u4EE5\u53CA\u5BF9\u6709\u8D26\u6237\u63A2\u6D4B\u5668\u7684\u5F15\u64CE\u662F\u5426\u5DF2\u767B\u5F55\u3002[x] = \u4E3A\u4EFB\u52A1\u9009\u5F15\u64CE\u65F6\u4F1A\u5217\u51FA\u5B83\uFF1B(\u25CF) = \u5168\u5C40\u9ED8\u8BA4\u5F15\u64CE\uFF08\u5404\u9879\u76EE\u81EA\u5DF1\u7684\u9009\u62E9\u4F1A\u8986\u76D6\u5B83\uFF0C\u5982 Ctrl+Shift+T\uFF09\u2014\u2014\u4E24\u8005\u90FD\u53EF\u76F4\u63A5\u70B9\uFF0C\u4E5F\u53EF\u7528\u4E0B\u9762\u7684\u6309\u952E\u3002\u4E8C\u8FDB\u5236\u4E0D\u5728 PATH \u4E0A\u3001\u6216\u8981\u4F20\u9ED8\u8BA4\u53C2\u6570\u65F6\uFF0C\u8986\u76D6\u5B83\u7684\u542F\u52A8\u547D\u4EE4\u3002space \u5F00/\u5173 \xB7 enter \u7F16\u8F91\u547D\u4EE4 \xB7 r \u91CD\u547D\u540D \xB7 x \u91CD\u7F6E/\u79FB\u9664 \xB7 d \u8BBE\u4E3A\u9ED8\u8BA4\u3002",customTag:" (\u81EA\u5B9A\u4E49)",addEngine:"+ \u6DFB\u52A0\u5F15\u64CE"},accounts:{checking:"\u68C0\u67E5\u4E2D\u2026",notLoggedIn:"\u25CB \u672A\u767B\u5F55",loggedIn:"\u25CF \u5DF2\u767B\u5F55: {email}",apiKeyConfigured:"\u25CF \u5DF2\u914D\u7F6E API key",chatgptLogin:"\u25CF ChatGPT \u767B\u5F55: {email}",tokenConfigured:"\u25CF \u5DF2\u914D\u7F6E Token ({source})",detected:"\u25CF \u68C0\u6D4B\u5230\u767B\u5F55"},plugins:{title:"\u63D2\u4EF6",hint:"\u5728 ~/.kobe/plugins.json \u91CC\u6CE8\u518C\u7684\u63D2\u4EF6\u3002enter\uFF08\u6216\u70B9\u51FB\uFF09\u5207\u6362\u542F\u7528/\u7981\u7528\u2014\u2014daemon \u76D1\u542C\u8BE5\u6587\u4EF6\uFF0C\u6539\u52A8\u5B9E\u65F6\u751F\u6548\u3002\u63D2\u4EF6\u4E0B\u65B9\u7F29\u8FDB\u7684\u884C\u662F\u5B83\u58F0\u660E\u7684\u8BBE\u7F6E\u9879\uFF0Center \u7F16\u8F91\uFF0C\u65B0\u503C\u5728\u63D2\u4EF6\u4E0B\u6B21\u8FD0\u884C\u65F6\u751F\u6548\u3002\u5B89\u88C5\u4E0E\u79FB\u9664\u5728 shell \u91CC\u505A\uFF1A`rove plugin install <owner/repo>`\u3001`rove plugin link <dir>`\u3002",empty:"\u5C1A\u672A\u6CE8\u518C\u4EFB\u4F55\u63D2\u4EF6\u3002\u7528 `rove plugin install <owner/repo>` \u5B89\u88C5\u4E00\u4E2A\u2014\u2014\u53EF\u5728 GitHub \u7684 `rove-plugin` \u8BDD\u9898\u4E0B\u6D4F\u89C8\u3002",sourceLink:"\u672C\u5730\u94FE\u63A5 {path}",sourceGithub:"{spec}",updateAvailable:"\u6709\u65B0\u7248\u672C \u2014 rove plugin update",declares:"{actions} \u4E2A\u52A8\u4F5C \xB7 {events} \u4E2A\u4E8B\u4EF6 \xB7 {panes} \u4E2A\u9762\u677F",declaresWithEngines:"{actions} \u4E2A\u52A8\u4F5C \xB7 {events} \u4E2A\u4E8B\u4EF6 \xB7 {panes} \u4E2A\u9762\u677F \xB7 {engines} \u4E2A\u5F15\u64CE",manifestUnreadable:"manifest \u65E0\u6CD5\u89E3\u6790",unsupportedPlatform:"\xB7 \u4E0D\u652F\u6301\u5F53\u524D\u5E73\u53F0",noHooks:"\xB7 \u672A\u58F0\u660E\u94A9\u5B50",lastRun:"\xB7 \u4E0A\u6B21\u8FD0\u884C {label} {status} {ago}\u524D",neverRun:"\xB7 \u5C1A\u672A\u8FD0\u884C\u8FC7",runOk:"\u6210\u529F",runFailed:"\u542F\u52A8\u5931\u8D25",runExit:"\u9000\u51FA\u7801 {code}",settingUnset:"(\u672A\u8BBE\u7F6E \u2014 enter \u7F16\u8F91)",settingInvalidTitle:"\u4E0D\u662F\u6570\u5B57",settingInvalidBody:"{label} \u53EA\u63A5\u53D7\u6570\u5B57\uFF0C\u4FDD\u7559\u539F\u503C\u3002"},keybindings:{title:"\u5FEB\u6377\u952E",hint:"\u5728\u4F60\u81EA\u5DF1\u7684 YAML \u6587\u4EF6\u91CC\u91CD\u7ED1\u5B9A\u76F4\u63A5\u6309\u952E\u548C prefix \u7EC4\u5408\uFF1B\u4FEE\u6539\u4F1A\u5B9E\u65F6\u52A0\u8F7D\u3002\u4EFB\u610F\u4F4D\u7F6E\u6309 F1 \u67E5\u770B\u5E26\u6BCF\u4E2A\u7ED1\u5B9A id \u7684\u5B9E\u65F6\u952E\u4F4D\u8868\u3002",configFile:"\u914D\u7F6E\u6587\u4EF6",notCreated:" (\u5C1A\u672A\u521B\u5EFA)",prefixTitle:"\u547D\u4EE4\u5C42\uFF08{prefix}\uFF09",prefixHint:"\u88F8\u952E\u4F5C\u7528\u4E8E\u5F53\u524D\u805A\u7126\u9762\u677F\uFF1B\u5C11\u91CF\u5355\u6B21\u5FEB\u6377\u952E\u8986\u76D6\u9AD8\u9891 Rove \u64CD\u4F5C\uFF1B{prefix} \u6253\u5F00\u547D\u4EE4\u5C42\uFF08\u7B2C\u4E8C\u51FB\u7A97\u53E3 {timeout}ms\uFF09\u3002Prefix \u7ED1\u5B9A\u4FDD\u6301\u539F\u6709\u7684\u9762\u677F\u4F5C\u7528\u57DF\u548C modal \u89C4\u5219\u3002",tapPresentation:"\u70B9\u6309 Prefix",tapPresentationHint:"\u9009\u62E9\u5B8C\u6574\u6307\u5357\u662F\u5426\u540C\u65F6\u6807\u8BB0\u5F53\u524D\u5C4F\u5E55\u4E0A\u7684\u5165\u53E3\u3002",tapPresentationLocal:"\u5C4F\u5E55\u5165\u53E3 + \u5B8C\u6574\u6307\u5357\uFF08\u9ED8\u8BA4\uFF09",tapPresentationGuide:"\u4EC5\u5B8C\u6574\u6307\u5357",prefixDisabled:"\u5DF2\u7981\u7528",fixed:"\u56FA\u5B9A\uFF08\u4E0D\u53EF\u91CD\u7ED1\u5B9A\uFF09\uFF1A{ids}\u3002",createHint:"\u8FD8\u6CA1\u6709\u8986\u76D6\u6587\u4EF6\u3002Rove \u53EF\u4EE5\u5E2E\u4F60\u5199\u4E00\u4EFD\u5E26\u5B8C\u6574\u6CE8\u91CA\u7684\u2014\u2014\u5728\u4F60\u53D6\u6D88\u6CE8\u91CA\u4E4B\u524D\u4E0D\u4F1A\u6539\u52A8\u4EFB\u4F55\u6309\u952E\u3002",createFile:"[enter] \u521B\u5EFA keybindings.yaml",overridesApplied:"\u5DF2\u5E94\u7528\u7684\u8986\u76D6",none:"\u65E0",unbound:"(\u5DF2\u89E3\u7ED1)",defaultKeys:"\u9ED8\u8BA4: {keys}",warnings:"\u8B66\u544A"},feedback:{title:"\u53CD\u9988",hint:"\u901A\u8FC7 `gh` \u5411 Rove \u4ED3\u5E93\u53D1\u4E00\u6761 GitHub Discussion\u3002\u9700\u8981 `gh auth login`\uFF1B\u5206\u7C7B\u9ED8\u8BA4\u4E3A Feedback\u3002",titleLabel:"\u6807\u9898",titlePlaceholder:"\u7B80\u77ED\u6982\u62EC",descriptionLabel:"\u63CF\u8FF0",descriptionPlaceholder:"\u53D1\u751F\u4E86\u4EC0\u4E48\uFF1F(enter \u6362\u884C \xB7 tab \u8DF3\u5230\u53D1\u9001)",send:"[enter] \u53D1\u9001\u5230 GitHub Discussions"},dev:{reset:"\u91CD\u7F6E UI \u72B6\u6001",resetHint:"\u6E05\u7A7A ~/.config/rove/state.json \u548C ~/.rove/tasks.json\uFF0C\u7136\u540E\u9000\u51FA Rove\u2014\u2014\u91CD\u65B0\u542F\u52A8\u5373\u53EF\u4ECE\u5934\u5F00\u59CB\u3002\u5DE5\u4F5C\u4F1A\u8BDD\u5217\u8868\u3001\u9762\u677F\u5C3A\u5BF8\u3001\u4E3B\u9898\u3001\u6A21\u578B\u9009\u62E9\u90FD\u4F1A\u91CD\u7F6E\u3002\u78C1\u76D8\u4E0A\u7684 worktree \u548C\u5F15\u64CE\u4F1A\u8BDD\u5386\u53F2\u4E0D\u53D7\u5F71\u54CD\u3002",resetButton:"[enter] \u91CD\u7F6E",restart:"\u91CD\u542F\u540E\u7AEF",restartHint:"\u505C\u6B62 Rove daemon \u5E76\u9000\u51FA\u5F53\u524D Rove \u7A97\u53E3\uFF0C\u4E0B\u6B21\u542F\u52A8\u4F1A\u62C9\u8D77\u4E00\u4E2A\u5168\u65B0\u7684 daemon\u2014\u2014\u65E0\u9700\u6740\u8FDB\u7A0B\u5373\u53EF\u5E94\u7528 daemon / orchestrator / engine \u7684\u6539\u52A8\u3002\u5176\u4ED6\u5DF2\u8FDE\u63A5\u7684 Rove \u7A97\u53E3\u4E5F\u4F1A\u65AD\u5F00\u8FDE\u63A5\u3002",restartButton:"[enter] \u91CD\u542F",doctorHint:"daemon \u5361\u4F4F\u6216\u65E0\u54CD\u5E94\uFF1F\u5728 shell \u91CC\u8FD0\u884C `rove daemon restart`\uFF0C\u7136\u540E\u91CD\u65B0\u542F\u52A8 Rove\u3002Hosted PTY \u5F15\u64CE\u4F1A\u8BDD\u4E0D\u4F1A\u56E0 daemon \u91CD\u542F\u800C\u9000\u51FA\u3002",experimental:"\u5B9E\u9A8C\u6027",remoteHint:"\u8FDC\u7A0B\u9879\u76EE\uFF08SSH\uFF09\uFF1A\u6CE8\u518C\u4E00\u4E2A git worktree + \u5F15\u64CE\u90FD\u901A\u8FC7 SSH \u8DD1\u5728\u53E6\u4E00\u53F0\u4E3B\u673A\u4E0A\u3001\u7531\u672C\u5730 Rove \u9A71\u52A8\u7684\u9879\u76EE\u3002\u5C1A\u672A\u5B8C\u6210\u2014\u2014\u6587\u4EF6/diff \u9762\u677F\u5BF9\u8FDC\u7A0B\u4ECD\u4F1A\u964D\u7EA7\u3002\u542F\u7528 `rove add --remote`\u3002",remote:"\u8FDC\u7A0B\u9879\u76EE",autoStatusHint:"\u81EA\u52A8\u72B6\u6001\u6D41\u8F6C\uFF1Abacklog \u4EFB\u52A1\u5728\u5176\u5F15\u64CE\u5F00\u59CB\u4E00\u8F6E\u65F6\u79FB\u5230 in_progress\uFF0C\u65B0\u4F1A\u8BDD\u4F1A\u62FF\u5230\u4E00\u6761\u7CFB\u7EDF\u63D0\u793A\uFF0C\u544A\u8BC9 agent \u5B8C\u6210\u540E\u81EA\u884C\u8BBE\u4E3A in_review\u3002\u7EDD\u4E0D\u89E6\u78B0 done/canceled\u3002",autoStatus:"\u81EA\u52A8\u72B6\u6001\u6D41\u8F6C",dispatcherHint:"\u73B0\u573A\u7B14\u8BB0\u8C03\u5EA6\u5668\uFF1A\u4EFB\u52A1\u4F1A\u8BDD\u63D0\u4EA4\u4E00\u884C\u7ECF\u9A8C\uFF08`rove api note`\uFF09\uFF0Cdaemon \u5C06\u6BCF\u6761\u8F6C\u53D1\u7ED9\u4ED3\u5E93\u7684\u4E3B\u4F1A\u8BDD\uFF0C\u4E3B\u4F1A\u8BDD\u518D\u628A\u5B83\u4EEC\u8F6C\u8FBE\u7ED9\u80FD\u53D7\u76CA\u7684\u8FDB\u884C\u4E2D\u4EFB\u52A1\uFF08`rove api dispatch`\uFF09\u3002\u76EE\u524D\u7531 Web \u6258\u7BA1\u7684\u4F1A\u8BDD\u4F1A\u6536\u5230\u8F6C\u8FBE\u3002",dispatcher:"\u73B0\u573A\u7B14\u8BB0\u8C03\u5EA6\u5668",composerGateHint:"\u628A peer/API \u7684\u6D88\u606F\u7C98\u8FDB\u8FD0\u884C\u4E2D\u7684\u5F15\u64CE\u4E4B\u524D,Rove \u4F1A\u8BFB\u4E00\u904D\u90A3\u4E2A\u4F1A\u8BDD\u7684\u5C4F\u5E55,\u53D1\u73B0\u8F93\u5165\u6846\u91CC\u5DF2\u7ECF\u6709\u5B57\u5C31\u5148\u6263\u4F4F\u4E0D\u53D1\u3002\u8FD9\u4E2A\u5224\u65AD\u4F9D\u8D56\u5F15\u64CE\u5F53\u524D\u7684\u754C\u9762\u5E03\u5C40,\u6240\u4EE5\u5382\u5546\u6539\u7248\u53EF\u80FD\u8BA9\u5B83\u5931\u51C6\u2014\u2014\u5982\u679C\u4F60\u770B\u7740\u8F93\u5165\u6846\u660E\u660E\u662F\u7A7A\u7684\u3001\u6D88\u606F\u5374\u4E00\u76F4\u88AB\u6263\u4F4F,\u5C31\u5173\u6389\u5B83\u3002\u53E6\u4E00\u9053\u300C\u521A\u521A\u6709\u4EBA\u5728\u6253\u5B57\u300D\u7684\u4FDD\u62A4\u59CB\u7EC8\u751F\u6548,\u6B63\u5728\u8F93\u5165\u7684\u8F93\u5165\u6846\u4ECD\u7136\u53D7\u4FDD\u62A4\u3002",composerGate:"\u6295\u9012\u524D\u68C0\u67E5\u8F93\u5165\u6846"}}});var en14,zh14;var init_tasks=__esm(()=>{en14={nav:{kanban:"Kanban",automations:"Routines",issues:"Issues"},header:{scratch:"SCRATCH"},search:{placeholder:"fuzzy filter"},menu:{open:"Open",openTab:"Open tab",closeTab:"Close tab",newChat:"New conversation",newShell:"New shell",newTask:"New task",forgetProject:"Remove project",fieldNotes:"Field notes",rename:"Rename",pin:"Pin",unpin:"Unpin",reorder:"Reorder row",runAgain:"Run again",setStatus:"Set status",copyBranch:"Copy branch name",copyPath:"Copy path",openEditor:"Open in editor",renameBranch:"Rename branch",changeEngine:"Change engine",fixChecks:"Fix failing checks",syncBase:"Sync with base",land:"Land into base branch",delete:"Delete"},status:{backlog:"Backlog",inProgress:"In progress",inReview:"In review",done:"Done",canceled:"Canceled",error:"Error"},setStatus:{title:"Set status",current:"current",footer:"\u2191\u2193 choose \xB7 enter set \xB7 esc cancel"},sync:{done:"Merged {base} into this worktree",alreadyCurrent:"Already up to date with {base}",conflict:"Merge conflict \u2014 resolve then commit: {files}",dirty:"Commit or stash the worktree's changes first, then sync",failed:"Sync failed: {error}"},changeEngine:{title:"Change engine",current:"current",footer:"\u2191\u2193 choose \xB7 enter set \xB7 esc cancel",effortLabel:"EFFORT",noEffort:"engine default",footerEffort:"\u2191\u2193 engine \xB7 \u2190\u2192 effort \xB7 enter set \xB7 esc cancel"},runAgain:{title:"Run again",source:"Brief from \u201C{title}\u201D",hint:"Runs this brief again in a new task, on its own branch and worktree.",confirm:"Run again",footer:"\u2191\u2193 scroll \xB7 \u2190\u2192 choose \xB7 enter run \xB7 esc cancel"},fieldNotes:{title:"Field notes",empty:"No field notes for this repo yet \u2014 agents file one with `rove api note`.",loading:"Loading\u2026",footer:"\u2191\u2193 scroll \xB7 esc close"},moveChip:" move",recentJump:"Recent: {title}",routinesRow:"{count} routine sessions",empty:{noMatchSearch:"No matching tasks \u2014 esc to clear.",noActiveProject:"No active tasks for this project.",noActive:"No active tasks \u2014 create one above."},activity:{working:"working",rateLimited:"rate limited",permissionNeeded:"needs permission",error:"error",dead:"engine exited"},subtitle:{noTracking:"no activity tracking",materializing:"materializing",deleting:"deleting",deleteFailed:"delete failed"},reBranch:{title:"Set branch",fieldLabel:"branch",hintNoBranches:"(no local branches \u2014 type a new name)",hintNoMatch:"(no match \u2014 enter renames to this branch)",footer:"\u2191\u2193 pick \xB7 enter set \xB7 esc cancel"},toast:{noDaemonWorktree:"No daemon running \u2014 can't create the worktree",noEditor:"No editor found \u2014 set ROVE_OPEN_EDITOR (e.g. 'code', 'cursor', 'nvim')",openWorktreeFailed:"Couldn't open worktree with {label}",worktreeErrorDeleting:"This task is being deleted \u2014 it can't be opened",worktreeErrorNotGit:"This project isn't a git repo yet \u2014 a task needs a git branch. Run `git init` (+ a first commit) in the project, then open the task. Non-git support is coming.",worktreeErrorGeneric:"Couldn't create the worktree: {message}",scratchAdopted:"Adopted into {repo} \u2014 save it as a project from New Task if you want it in the picker",scratchOpenFailed:"Couldn't open a scratch shell: {message}",scratchCloseFailed:"Couldn't close the scratch task: {message}",worktreeGoneTitle:'Worktree for "{title}" is gone',worktreeGoneBody:"Closed {count} tab(s). The branch {branch} is still there \u2014 reopen the task to re-create its worktree.",copiedBranch:"Copied branch {text}",copiedPath:"Copied path {text}"}},zh14={nav:{kanban:"\u770B\u677F",automations:"\u4F8B\u884C\u4EFB\u52A1",issues:"\u8BAE\u9898"},header:{scratch:"\u4E34\u65F6"},search:{placeholder:"\u6A21\u7CCA\u641C\u7D22"},menu:{open:"\u6253\u5F00",openTab:"\u6253\u5F00\u8BE5\u6807\u7B7E\u9875",closeTab:"\u5173\u95ED\u8BE5\u6807\u7B7E\u9875",newChat:"\u65B0\u5EFA\u4F1A\u8BDD",newShell:"\u65B0\u5EFA\u7EC8\u7AEF",newTask:"\u65B0\u5EFA\u4EFB\u52A1",forgetProject:"\u79FB\u9664\u9879\u76EE",fieldNotes:"\u73B0\u573A\u7B14\u8BB0",rename:"\u91CD\u547D\u540D",pin:"\u7F6E\u9876",unpin:"\u53D6\u6D88\u7F6E\u9876",reorder:"\u91CD\u65B0\u6392\u5E8F",runAgain:"\u91CD\u65B0\u8FD0\u884C",setStatus:"\u8BBE\u7F6E\u72B6\u6001",copyBranch:"\u590D\u5236\u5206\u652F\u540D",copyPath:"\u590D\u5236\u8DEF\u5F84",openEditor:"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00",renameBranch:"\u91CD\u547D\u540D\u5206\u652F",changeEngine:"\u5207\u6362\u5F15\u64CE",fixChecks:"\u4FEE\u590D\u5931\u8D25\u7684\u68C0\u67E5",syncBase:"\u540C\u6B65\u57FA\u7840\u5206\u652F",land:"\u5408\u5165\u57FA\u7840\u5206\u652F",delete:"\u5220\u9664"},status:{backlog:"\u5F85\u529E",inProgress:"\u8FDB\u884C\u4E2D",inReview:"\u5F85\u8BC4\u5BA1",done:"\u5DF2\u5B8C\u6210",canceled:"\u5DF2\u53D6\u6D88",error:"\u51FA\u9519"},setStatus:{title:"\u8BBE\u7F6E\u72B6\u6001",current:"\u5F53\u524D",footer:"\u2191\u2193 \u9009\u62E9 \xB7 enter \u8BBE\u7F6E \xB7 esc \u53D6\u6D88"},sync:{done:"\u5DF2\u628A {base} \u5408\u5E76\u8FDB\u8BE5\u5DE5\u4F5C\u6811",alreadyCurrent:"\u5DF2\u7ECF\u548C {base} \u540C\u6B65",conflict:"\u5408\u5E76\u51B2\u7A81\u2014\u2014\u89E3\u51B3\u540E\u63D0\u4EA4\uFF1A{files}",dirty:"\u8BF7\u5148\u63D0\u4EA4\u6216\u6682\u5B58\u5DE5\u4F5C\u6811\u91CC\u7684\u6539\u52A8\uFF0C\u518D\u540C\u6B65",failed:"\u540C\u6B65\u5931\u8D25\uFF1A{error}"},changeEngine:{title:"\u5207\u6362\u5F15\u64CE",current:"\u5F53\u524D",footer:"\u2191\u2193 \u9009\u62E9 \xB7 enter \u8BBE\u7F6E \xB7 esc \u53D6\u6D88",effortLabel:"\u63A8\u7406\u5F3A\u5EA6",noEffort:"\u5F15\u64CE\u9ED8\u8BA4",footerEffort:"\u2191\u2193 \u5F15\u64CE \xB7 \u2190\u2192 \u5F3A\u5EA6 \xB7 enter \u8BBE\u7F6E \xB7 esc \u53D6\u6D88"},runAgain:{title:"\u91CD\u65B0\u8FD0\u884C",source:"\u6765\u81EA\u4EFB\u52A1\u300C{title}\u300D\u7684\u6307\u4EE4",hint:"\u5728\u65B0\u4EFB\u52A1\u91CC\u91CD\u65B0\u6267\u884C\u8FD9\u6BB5\u6307\u4EE4\uFF0C\u65B0\u4EFB\u52A1\u6709\u81EA\u5DF1\u7684\u5206\u652F\u548C\u5DE5\u4F5C\u6811\u3002",confirm:"\u91CD\u65B0\u8FD0\u884C",footer:"\u2191\u2193 \u6EDA\u52A8 \xB7 \u2190\u2192 \u9009\u62E9 \xB7 enter \u8FD0\u884C \xB7 esc \u53D6\u6D88"},fieldNotes:{title:"\u73B0\u573A\u7B14\u8BB0",empty:"\u8BE5\u4ED3\u5E93\u6682\u65E0\u73B0\u573A\u7B14\u8BB0\u2014\u2014agent \u53EF\u7528 `rove api note` \u8BB0\u5F55\u3002",loading:"\u52A0\u8F7D\u4E2D\u2026",footer:"\u2191\u2193 \u6EDA\u52A8 \xB7 esc \u5173\u95ED"},moveChip:" \u79FB\u52A8",recentJump:"\u6700\u8FD1:{title}",routinesRow:"{count} \u4E2A routine \u4F1A\u8BDD",empty:{noMatchSearch:"\u65E0\u5339\u914D\u4EFB\u52A1\u2014\u2014\u6309 esc \u6E05\u9664\u3002",noActiveProject:"\u8BE5\u9879\u76EE\u6682\u65E0\u6D3B\u8DC3\u4EFB\u52A1\u3002",noActive:"\u6682\u65E0\u6D3B\u8DC3\u4EFB\u52A1\u2014\u2014\u5728\u4E0A\u65B9\u65B0\u5EFA\u3002"},activity:{working:"\u8FD0\u884C\u4E2D",rateLimited:"\u8BF7\u6C42\u53D7\u9650",permissionNeeded:"\u7B49\u5F85\u6388\u6743",error:"\u9519\u8BEF",dead:"\u5F15\u64CE\u5DF2\u9000\u51FA"},subtitle:{noTracking:"\u4E0D\u8DDF\u8E2A\u6D3B\u52A8",materializing:"\u6B63\u5728\u521B\u5EFA worktree",deleting:"\u6B63\u5728\u5220\u9664",deleteFailed:"\u5220\u9664\u5931\u8D25"},reBranch:{title:"\u8BBE\u7F6E\u5206\u652F",fieldLabel:"\u5206\u652F",hintNoBranches:"\uFF08\u6CA1\u6709\u672C\u5730\u5206\u652F\u2014\u2014\u8F93\u5165\u65B0\u540D\u79F0\uFF09",hintNoMatch:"\uFF08\u65E0\u5339\u914D\u2014\u2014\u56DE\u8F66\u5C06\u5206\u652F\u91CD\u547D\u540D\u4E3A\u6B64\u540D\uFF09",footer:"\u2191\u2193 \u9009\u62E9 \xB7 enter \u8BBE\u7F6E \xB7 esc \u53D6\u6D88"},toast:{noDaemonWorktree:"\u5B88\u62A4\u8FDB\u7A0B\u672A\u8FD0\u884C\u2014\u2014\u65E0\u6CD5\u521B\u5EFA worktree",noEditor:"\u672A\u627E\u5230\u7F16\u8F91\u5668\u2014\u2014\u8BF7\u8BBE\u7F6E ROVE_OPEN_EDITOR\uFF08\u5982 'code'\u3001'cursor'\u3001'nvim'\uFF09",openWorktreeFailed:"\u65E0\u6CD5\u7528 {label} \u6253\u5F00 worktree",worktreeErrorDeleting:"\u8BE5\u4EFB\u52A1\u6B63\u5728\u5220\u9664\u4E2D\u2014\u2014\u65E0\u6CD5\u6253\u5F00",worktreeErrorNotGit:"\u8BE5\u9879\u76EE\u5C1A\u975E git \u4ED3\u5E93\u2014\u2014\u4EFB\u52A1\u9700\u8981 git \u5206\u652F\u3002\u8BF7\u5728\u9879\u76EE\u4E2D\u6267\u884C `git init`\uFF08+ \u9996\u6B21\u63D0\u4EA4\uFF09\u540E\u518D\u6253\u5F00\u4EFB\u52A1\u3002\u975E git \u9879\u76EE\u7684\u652F\u6301\u5373\u5C06\u63A8\u51FA\u3002",worktreeErrorGeneric:"\u65E0\u6CD5\u521B\u5EFA worktree\uFF1A{message}",scratchAdopted:"\u5DF2\u5F52\u5165 {repo}\u2014\u2014\u82E5\u8981\u51FA\u73B0\u5728\u9879\u76EE\u9009\u62E9\u5668\u91CC,\u53EF\u5728\u65B0\u5EFA\u4EFB\u52A1\u4E2D\u4FDD\u5B58\u4E3A\u9879\u76EE",scratchOpenFailed:"\u65E0\u6CD5\u6253\u5F00\u4E34\u65F6 Shell:{message}",scratchCloseFailed:"\u65E0\u6CD5\u5173\u95ED\u4E34\u65F6\u4EFB\u52A1:{message}",worktreeGoneTitle:'"{title}" \u7684 worktree \u5DF2\u6D88\u5931',worktreeGoneBody:"\u5DF2\u5173\u95ED {count} \u4E2A\u6807\u7B7E\u9875\u3002\u5206\u652F {branch} \u4ECD\u5728\u2014\u2014\u91CD\u65B0\u6253\u5F00\u8BE5\u4EFB\u52A1\u4F1A\u91CD\u5EFA worktree\u3002",copiedBranch:"\u5DF2\u590D\u5236\u5206\u652F {text}",copiedPath:"\u5DF2\u590D\u5236\u8DEF\u5F84 {text}"}}});var en15,zh15;var init_terminal=__esm(()=>{en15={noTask:"(no task \u2014 press n to create)",exited:"process exited \u2014 F5 restarts it",restoring:"restoring session\u2026",tab:{groupTitle:"group {n}",renameTitle:"Rename tab",renameField:"TAB TITLE",renameSubmit:"rename",chooseEngineHint:"\u2190/\u2192 or h/l choose, enter confirm, esc cancel",newChat:{title:"New conversation",engine:"ENGINE",destLabel:"DESTINATION",destTab:"new tab in this worktree",destFork:"fork a child task (new worktree)",ctxLabel:"CONTEXT",ctxFresh:"fresh conversation",ctxContinue:"continue this conversation",scratchChoice:"scratch shell"},cannotCloseLast:"Cannot close the only tab",tabGone:"That tab is no longer there",nothingToFork:"No conversation in this tab to fork yet",noTranscriptToHandOff:"{engine} keeps no readable transcript to hand over"},split:{renameTitle:"Rename split",renameField:"SPLIT NAME"},scrolledBack:"\u2191 scrolled {lines}L (ctrl+pgdn to follow)",search:{placeholder:"search scrollback \u2014 enter/\u2191 older, \u2193 newer, esc close",position:"{index}/{total}",noMatches:"no matches",unavailable:"this app owns its own scrollback \u2014 nothing local to search (esc)"},unavailable:{shellMissing:"terminal unavailable \u2014 configured shell is not available",spawnFailed:"terminal unavailable \u2014 shell could not start",retry:"F5 tries again"},reset:{title:"Reset terminal?",body:"The running shell will be killed and a fresh one will spawn at the worktree. Any in-flight processes (vim, htop, paused jobs) end immediately."}},zh15={noTask:"\uFF08\u65E0\u4EFB\u52A1 \u2014\u2014 \u6309 n \u521B\u5EFA\uFF09",exited:"\u8FDB\u7A0B\u5DF2\u9000\u51FA \u2014\u2014 \u6309 F5 \u91CD\u542F",restoring:"\u6B63\u5728\u6062\u590D\u4F1A\u8BDD\u2026",tab:{groupTitle:"group {n}",renameTitle:"\u91CD\u547D\u540D\u6807\u7B7E\u9875",renameField:"\u6807\u7B7E\u9875\u540D\u79F0",renameSubmit:"\u91CD\u547D\u540D",chooseEngineHint:"\u2190/\u2192 \u6216 h/l \u9009\u62E9\uFF0Center \u786E\u8BA4\uFF0Cesc \u53D6\u6D88",newChat:{title:"\u65B0\u5EFA\u5BF9\u8BDD",engine:"\u5F15\u64CE",destLabel:"\u843D\u70B9",destTab:"\u672C worktree \u65B0\u6807\u7B7E\u9875",destFork:"fork \u5B50\u4EFB\u52A1\uFF08\u65B0 worktree\uFF09",ctxLabel:"\u4E0A\u4E0B\u6587",ctxFresh:"\u5168\u65B0\u5BF9\u8BDD",ctxContinue:"\u63A5\u7740\u5F53\u524D\u5BF9\u8BDD",scratchChoice:"\u4E34\u65F6 shell"},cannotCloseLast:"\u65E0\u6CD5\u5173\u95ED\u552F\u4E00\u7684\u6807\u7B7E\u9875",tabGone:"\u8FD9\u4E2A\u6807\u7B7E\u9875\u5DF2\u7ECF\u4E0D\u5728\u4E86",nothingToFork:"\u8FD9\u4E2A\u6807\u7B7E\u9875\u8FD8\u6CA1\u6709\u53EF\u6D3E\u751F\u7684\u5BF9\u8BDD",noTranscriptToHandOff:"{engine} \u6CA1\u6709\u53EF\u8BFB\u7684\u5BF9\u8BDD\u8BB0\u5F55\uFF0C\u65E0\u6CD5\u4EA4\u63A5"},split:{renameTitle:"\u91CD\u547D\u540D\u5206\u5C4F",renameField:"\u5206\u5C4F\u540D\u79F0"},scrolledBack:"\u2191 \u5DF2\u56DE\u6EDA {lines} \u884C\uFF08ctrl+pgdn \u56DE\u5230\u5E95\u90E8\uFF09",search:{placeholder:"\u641C\u7D22\u56DE\u6EDA\u7F13\u51B2\u533A \u2014\u2014 enter/\u2191 \u66F4\u65E9\uFF0C\u2193 \u66F4\u665A\uFF0Cesc \u5173\u95ED",position:"{index}/{total}",noMatches:"\u6CA1\u6709\u5339\u914D",unavailable:"\u8FD9\u4E2A\u7A0B\u5E8F\u81EA\u5DF1\u7BA1\u7406\u56DE\u6EDA\u7F13\u51B2\u533A \u2014\u2014 \u672C\u5730\u6CA1\u6709\u53EF\u641C\u7D22\u7684\u5185\u5BB9\uFF08esc\uFF09"},unavailable:{shellMissing:"\u7EC8\u7AEF\u4E0D\u53EF\u7528 \u2014\u2014 \u914D\u7F6E\u7684 shell \u4E0D\u5B58\u5728",spawnFailed:"\u7EC8\u7AEF\u4E0D\u53EF\u7528 \u2014\u2014 shell \u542F\u52A8\u5931\u8D25",retry:"\u6309 F5 \u91CD\u8BD5"},reset:{title:"\u91CD\u7F6E\u7EC8\u7AEF\uFF1F",body:"\u6B63\u5728\u8FD0\u884C\u7684 shell \u4F1A\u88AB\u6740\u6389\u5E76\u5728 worktree \u91CD\u65B0\u542F\u52A8\uFF0C\u8FDB\u884C\u4E2D\u7684\u8FDB\u7A0B\uFF08vim\u3001htop\u3001\u6682\u505C\u7684\u4EFB\u52A1\uFF09\u4F1A\u7ACB\u5373\u7ED3\u675F\u3002"}}});var en16,zh16;var init_update=__esm(()=>{en16={pageTitle:"ROVE UPDATE",chip:"\u2191 {version}",current:"current",latest:"latest",latestUnknown:"unknown \u2014 could not reach the registry",releaseUrlUnavailable:"release URL unavailable",statusReleaseOpened:"Opened release page in your browser.",statusReleaseError:"Could not open release URL.",statusRunningUpdater:"Closing the TUI and running the updater in this terminal...",loadingNotes:"Loading release notes...",notesUnavailable:"Release notes are unavailable. Use Open release to view the GitHub release page.",changesSectionHeader:"\u2500\u2500 changes from v{from} to v{to} \u2500\u2500",updateComplete:"Rove update complete. Relaunch Rove to use the new version.",updateFailed:"Rove update failed with exit code {code}.",pressAnyKey:"Press any key to close this update window.",actions:{updateNow:"Update now",openRelease:"Open release",close:"Close",closeDetail:"return to the workspace"},skew:{title:"\u26A0 DAEMON OUT OF DATE",olderBuild:"an older build",hint:"daemon is {daemon} \u2014 you launched v{clientVersion}. Run `rove daemon restart`, then relaunch Rove"},staleInstall:{title:"\u2715 ROVE INSTALL IS GONE",hint:"this Rove is running from an install that no longer exists on disk, so it cannot start a daemon. Reinstall (`npm install -g @sma1lboy/rove`) and relaunch Rove"},versions:{pageTitle:"ROVE VERSIONS",loading:"Loading releases...",unavailable:"Could not fetch releases (offline or rate-limited).",tagCurrent:"current",tagLatest:"latest",tagBreaking:"breaking",breakingWarning:"\u26A0 installing this crosses breaking version(s) {versions} \u2014 run `rove reset` after the update.",footerHint:"j/k select \xB7 enter install \xB7 q close"}},zh16={pageTitle:"ROVE \u66F4\u65B0",chip:"\u2191 {version}",current:"\u5F53\u524D",latest:"\u6700\u65B0",latestUnknown:"\u672A\u77E5 \u2014\u2014 \u65E0\u6CD5\u8FDE\u63A5\u5230 registry",releaseUrlUnavailable:"\u53D1\u5E03\u94FE\u63A5\u4E0D\u53EF\u7528",statusReleaseOpened:"\u5DF2\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u53D1\u5E03\u8BF4\u660E\u9875\u9762\u3002",statusReleaseError:"\u65E0\u6CD5\u6253\u5F00\u53D1\u5E03\u94FE\u63A5\u3002",statusRunningUpdater:"\u6B63\u5728\u5173\u95ED TUI\uFF0C\u5E76\u5728\u5F53\u524D\u7EC8\u7AEF\u4E2D\u8FD0\u884C\u66F4\u65B0\u7A0B\u5E8F\u2026\u2026",loadingNotes:"\u6B63\u5728\u52A0\u8F7D\u53D1\u5E03\u8BF4\u660E\u2026\u2026",notesUnavailable:"\u53D1\u5E03\u8BF4\u660E\u4E0D\u53EF\u7528\u3002\u8BF7\u4F7F\u7528\u300C\u6253\u5F00\u53D1\u5E03\u9875\u300D\u67E5\u770B GitHub \u53D1\u5E03\u9875\u9762\u3002",changesSectionHeader:"\u2500\u2500 v{from} \u81F3 v{to} \u7684\u53D8\u66F4 \u2500\u2500",updateComplete:"Rove \u66F4\u65B0\u5B8C\u6210\u3002\u8BF7\u91CD\u65B0\u542F\u52A8 Rove \u4EE5\u4F7F\u7528\u65B0\u7248\u672C\u3002",updateFailed:"Rove \u66F4\u65B0\u5931\u8D25\uFF0C\u9000\u51FA\u7801\u4E3A {code}\u3002",pressAnyKey:"\u6309\u4EFB\u610F\u952E\u5173\u95ED\u6B64\u66F4\u65B0\u7A97\u53E3\u3002",actions:{updateNow:"\u7ACB\u5373\u66F4\u65B0",openRelease:"\u6253\u5F00\u53D1\u5E03\u9875",close:"\u5173\u95ED",closeDetail:"\u8FD4\u56DE\u5DE5\u4F5C\u533A"},skew:{title:"\u26A0 DAEMON \u7248\u672C\u4E0D\u4E00\u81F4",olderBuild:"\u65E7\u7248\u672C\u6784\u5EFA",hint:"daemon \u8FD0\u884C\u7684\u662F {daemon}\uFF0C\u800C\u4F60\u542F\u52A8\u7684\u662F v{clientVersion}\u3002\u8BF7\u8FD0\u884C `rove daemon restart`\uFF0C\u7136\u540E\u91CD\u65B0\u542F\u52A8 Rove"},staleInstall:{title:"\u2715 ROVE \u5B89\u88C5\u5DF2\u4E0D\u5B58\u5728",hint:"\u5F53\u524D Rove \u8FD0\u884C\u81EA\u4E00\u4EFD\u5DF2\u4ECE\u78C1\u76D8\u5220\u9664\u7684\u5B89\u88C5\uFF0C\u56E0\u6B64\u65E0\u6CD5\u542F\u52A8 daemon\u3002\u8BF7\u91CD\u65B0\u5B89\u88C5\uFF08`npm install -g @sma1lboy/rove`\uFF09\u5E76\u91CD\u65B0\u542F\u52A8 Rove"},versions:{pageTitle:"ROVE \u7248\u672C\u5217\u8868",loading:"\u6B63\u5728\u52A0\u8F7D\u53D1\u5E03\u5217\u8868\u2026\u2026",unavailable:"\u65E0\u6CD5\u83B7\u53D6\u53D1\u5E03\u5217\u8868\uFF08\u79BB\u7EBF\u6216\u89E6\u53D1\u9650\u6D41\uFF09\u3002",tagCurrent:"\u5F53\u524D",tagLatest:"\u6700\u65B0",tagBreaking:"breaking",breakingWarning:"\u26A0 \u5B89\u88C5\u8BE5\u7248\u672C\u4F1A\u8DE8\u8FC7 breaking \u7248\u672C {versions}\u2014\u2014\u66F4\u65B0\u540E\u9700\u8FD0\u884C `rove reset`\u3002",footerHint:"j/k \u9009\u62E9 \xB7 enter \u5B89\u88C5 \xB7 q \u5173\u95ED"}}});var en17,zh17;var init_workItems=__esm(()=>{en17={title:"ISSUES",noRepo:"no project",empty:"No open issues.",assignedFilter:"assigned to me",starting:"Starting work on #{number}\u2026",startedNoEngine:"Created {title}, but its engine did not start.",linkedChip:"\u2192 {title}",openingLinked:"Opening {title}\u2026",startFailed:"Couldn't start work on #{number}: {error}",errorHint:{noRemote:"Add a GitHub remote (`git remote add origin <url>`) and try again, or press q / esc to close.",ghMissing:"Install the `gh` CLI and authenticate, or press q / esc to close.",auth:"Run `gh auth login`, or press q / esc to close.",fallback:"{message} \xB7 press q / esc to close"}},zh17={title:"\u8BAE\u9898",noRepo:"\u65E0\u9879\u76EE",empty:"\u6CA1\u6709\u5F00\u653E\u7684\u8BAE\u9898\u3002",assignedFilter:"\u5206\u914D\u7ED9\u6211\u7684",starting:"\u6B63\u5728\u5F00\u59CB\u5904\u7406 #{number}\u2026",startedNoEngine:"\u5DF2\u521B\u5EFA {title}\uFF0C\u4F46\u5F15\u64CE\u6CA1\u6709\u542F\u52A8\u3002",linkedChip:"\u2192 {title}",openingLinked:"\u6B63\u5728\u6253\u5F00 {title}\u2026",startFailed:"\u5F00\u59CB\u5904\u7406 #{number} \u5931\u8D25\uFF1A{error}",errorHint:{noRemote:"\u6DFB\u52A0 GitHub remote\uFF08`git remote add origin <url>`\uFF09\u540E\u91CD\u8BD5\uFF0C\u6216\u6309 q / esc \u5173\u95ED\u3002",ghMissing:"\u5B89\u88C5 `gh` CLI \u5E76\u767B\u5F55\uFF0C\u6216\u6309 q / esc \u5173\u95ED\u3002",auth:"\u6267\u884C `gh auth login`\uFF0C\u6216\u6309 q / esc \u5173\u95ED\u3002",fallback:"{message} \xB7 \u6309 q / esc \u5173\u95ED"}}});var en18,zh18;var init_workspace=__esm(()=>{en18={quit:{confirmTitle:"Quit Rove?",confirmBody:"The daemon and task sessions keep running. This closes only the native workspace.",confirmLabel:"Quit"},empty:{selectTask:"Select a task with a worktree",noSessions:"No sessions here \u2014 press \u23CE or ctrl+e to start one",remoteUnsupported:"Hosted engine launch over SSH is not implemented \u2014 this task's worktree is on {host}"},welcome:{title:"Welcome to Rove",tagline:"Run several AI coding sessions side by side \u2014 each task gets its own git worktree and branch.",worktreeExplain:"Each task creates its own git worktree directory and branch, so multiple AI sessions can edit the same codebase in parallel without colliding.",stepNew:"creates your first task \u2014 pick a repo, a base branch, an engine",stepHelp:"shows every shortcut reachable from the current focus",stepPrefix:"opens the command menu",enginesFound:"\u2713 engines: {list}",enginesMissing:"\u2717 no engine CLI found \u2014 install claude, codex, copilot, or kimi, then restart Rove",gitMissing:"\u2717 git not found on PATH \u2014 Rove needs git to create worktrees",doctorHint:"run `rove doctor` in a shell for the full diagnosis",docsHint:"docs: https://docs.rove.run"},attention:{none:"No available Inbox items"},inbox:{title:"INBOX",empty:"No pending attention",openHint:"enter open",clearHint:"d clear",more:"+{count} more",section:{attention:"ATTENTION",recent:"RECENT"},state:{done:"done",needsInput:"needs input",error:"error",rateLimited:"rate limited",running:"running",dead:"engine exited",promptDeferred:"message queued"},resumesAt:"resumes {time}",deferredToast:"Message queued \u2014 composer busy",deferredStillQueued:"Still typing? The queued message stays in the Inbox \u2014 open it again to send.",deferredUnavailable:"That tab isn't running \u2014 the queued message stays in the Inbox.",deferredInsertFailed:"Couldn't insert the queued message \u2014 it's still in the Inbox."}},zh18={quit:{confirmTitle:"\u9000\u51FA Rove\uFF1F",confirmBody:"\u5B88\u62A4\u8FDB\u7A0B\u548C\u4EFB\u52A1\u4F1A\u8BDD\u4F1A\u7EE7\u7EED\u8FD0\u884C\uFF0C\u8FD9\u91CC\u53EA\u5173\u95ED\u539F\u751F\u5DE5\u4F5C\u533A\u3002",confirmLabel:"\u9000\u51FA"},empty:{selectTask:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u5E26 worktree \u7684\u4EFB\u52A1",noSessions:"\u8FD9\u91CC\u6CA1\u6709\u4F1A\u8BDD\u2014\u2014\u6309 \u23CE \u6216 ctrl+e \u5F00\u4E00\u4E2A",remoteUnsupported:"\u5C1A\u672A\u5B9E\u73B0\u901A\u8FC7 SSH \u542F\u52A8\u6258\u7BA1\u5F15\u64CE\u2014\u2014\u8BE5\u4EFB\u52A1\u7684 worktree \u5728 {host} \u4E0A"},welcome:{title:"\u6B22\u8FCE\u4F7F\u7528 Rove",tagline:"\u5E76\u884C\u8FD0\u884C\u591A\u4E2A AI \u7F16\u7801\u4F1A\u8BDD\u2014\u2014\u6BCF\u4E2A\u4EFB\u52A1\u90FD\u6709\u81EA\u5DF1\u7684 git worktree \u548C\u5206\u652F\u3002",worktreeExplain:"\u6BCF\u4E2A\u4EFB\u52A1\u90FD\u4F1A\u521B\u5EFA\u72EC\u7ACB\u7684 git worktree \u76EE\u5F55\u548C\u5206\u652F\uFF0C\u591A\u4E2A AI \u4F1A\u8BDD\u53EF\u4EE5\u5E76\u884C\u4FEE\u6539\u540C\u4E00\u4EFD\u4EE3\u7801\u5E93\uFF0C\u4E92\u4E0D\u5E72\u6270\u3002",stepNew:"\u521B\u5EFA\u4F60\u7684\u7B2C\u4E00\u4E2A\u4EFB\u52A1\u2014\u2014\u9009\u4ED3\u5E93\u3001\u57FA\u7840\u5206\u652F\u548C\u5F15\u64CE",stepHelp:"\u67E5\u770B\u5F53\u524D\u7126\u70B9\u4E0B\u7684\u5168\u90E8\u5FEB\u6377\u952E",stepPrefix:"\u6253\u5F00\u547D\u4EE4\u83DC\u5355",enginesFound:"\u2713 \u5DF2\u68C0\u6D4B\u5230\u5F15\u64CE:{list}",enginesMissing:"\u2717 \u672A\u627E\u5230\u5F15\u64CE CLI\u2014\u2014\u8BF7\u5B89\u88C5 claude\u3001codex\u3001copilot \u6216 kimi \u540E\u91CD\u542F Rove",gitMissing:"\u2717 PATH \u4E0A\u6CA1\u6709 git\u2014\u2014Rove \u9700\u8981 git \u6765\u521B\u5EFA worktree",doctorHint:"\u5728 shell \u91CC\u8FD0\u884C `rove doctor` \u67E5\u770B\u5B8C\u6574\u8BCA\u65AD",docsHint:"\u6587\u6863:https://docs.rove.run"},attention:{none:"\u6536\u4EF6\u7BB1\u4E2D\u6CA1\u6709\u53EF\u6253\u5F00\u7684\u9879\u76EE"},inbox:{title:"\u6536\u4EF6\u7BB1",empty:"\u6682\u65E0\u5F85\u5904\u7406",openHint:"enter \u6253\u5F00",clearHint:"d \u6E05\u9664",more:"\u8FD8\u6709 {count} \u6761",section:{attention:"\u5F85\u5904\u7406",recent:"\u6700\u8FD1\u4F7F\u7528"},state:{done:"\u5B8C\u6210",needsInput:"\u9700\u8981\u8F93\u5165",error:"\u51FA\u9519",rateLimited:"\u9650\u6D41",running:"\u8FDB\u884C\u4E2D",dead:"\u5F15\u64CE\u5DF2\u9000\u51FA",promptDeferred:"\u6D88\u606F\u5DF2\u6392\u961F"},resumesAt:"{time} \u6062\u590D",deferredToast:"\u6D88\u606F\u5DF2\u6392\u961F\u2014\u2014composer \u6B63\u5FD9",deferredStillQueued:"\u8FD8\u5728\u6253\u5B57\uFF1F\u6392\u961F\u7684\u6D88\u606F\u7559\u5728\u6536\u4EF6\u7BB1\u2014\u2014\u518D\u6253\u5F00\u4E00\u6B21\u5373\u53EF\u53D1\u9001\u3002",deferredUnavailable:"\u8BE5\u6807\u7B7E\u9875\u672A\u8FD0\u884C\u2014\u2014\u6392\u961F\u7684\u6D88\u606F\u7559\u5728\u6536\u4EF6\u7BB1\u3002",deferredInsertFailed:"\u65E0\u6CD5\u63D2\u5165\u6392\u961F\u7684\u6D88\u606F\u2014\u2014\u5B83\u4ECD\u5728\u6536\u4EF6\u7BB1\u4E2D\u3002"}}});var en19,zh19;var init_worktrees=__esm(()=>{en19={title:"Worktrees",loading:"Loading worktrees\u2026",noProjects:"No local projects known to Rove yet.",noWorktrees:"No worktrees.",badge:{kobeManaged:"rove",dirty:"dirty",remoteOn:"on remote",remoteOff:"not pushed",remoteUnknown:"remote unknown"},verdict:{prOpen:"PR open",prMerged:"merged (PR)",inMain:"in main",prClosed:"PR closed",idle:"stale"},row:{detached:"(detached)",created:"created {age} ago",linkedTask:"task: {title}"},delete:{button:"Delete",confirmTitle:"Delete worktree?",confirmBody:'Delete the worktree for "{branch}"? This removes the working directory; the branch itself is kept.',forceTitle:"Force delete worktree?",forceBody:'"{branch}" has uncommitted or untracked changes that will be PERMANENTLY LOST. Force delete anyway?',failed:"Failed to delete worktree: {error}",residue:"Git deregistered the worktree, but couldn't delete {path} ({reason}). Rove is done with it \u2014 retrying won't help; delete the directory by hand if you want the space."},land:{button:"Land",confirmTitle:"Land branch?",confirmBody:`Merge "{branch}" into the base repo's current branch, then remove this worktree? The branch is kept. A dirty base checkout is refused; conflicts abort with a file list.`,noTask:"This worktree isn't tracked as a Rove task \u2014 nothing to land.",conflict:"Land hit conflicts (merge aborted). Resolve by hand: {files}",dirtyBase:"The base checkout has uncommitted changes \u2014 commit them, then land. Never `git stash` here: the stash stack lives in the repo's common dir and is shared by every linked worktree, so a stash can entangle other tasks' work.",failed:"Land failed: {error}",done:'Landed "{branch}" onto {landedOn} ({commit}).',worktreeKept:"Landed, but the worktree was kept: {reason}",worktreePathStale:"Landed and removed the worktree, but the task still points at it: {reason}",worktreeResidue:"Landed. Git deregistered the worktree, but couldn't delete {path} ({reason}) \u2014 delete the directory by hand if you want the space."},hint:{}},zh19={title:"\u5DE5\u4F5C\u6811",loading:"\u6B63\u5728\u52A0\u8F7D worktree\u2026",noProjects:"Rove \u8FD8\u6CA1\u6709\u5DF2\u77E5\u7684\u672C\u5730\u9879\u76EE\u3002",noWorktrees:"\u6CA1\u6709 worktree\u3002",badge:{kobeManaged:"rove",dirty:"\u6709\u6539\u52A8",remoteOn:"\u5DF2\u63A8\u9001",remoteOff:"\u672A\u63A8\u9001",remoteUnknown:"\u8FDC\u7AEF\u672A\u77E5"},verdict:{prOpen:"PR \u8BC4\u5BA1\u4E2D",prMerged:"\u5DF2\u5408\u5165 (PR)",inMain:"\u5DF2\u5728\u4E3B\u5206\u652F",prClosed:"PR \u5DF2\u5173\u95ED",idle:"\u9648\u65E7"},row:{detached:"(\u6E38\u79BB\u72B6\u6001)",created:"{age}\u524D\u521B\u5EFA",linkedTask:"\u4EFB\u52A1\uFF1A{title}"},delete:{button:"\u5220\u9664",confirmTitle:"\u5220\u9664 worktree\uFF1F",confirmBody:'\u786E\u5B9A\u5220\u9664 "{branch}" \u5BF9\u5E94\u7684 worktree\uFF1F\u5DE5\u4F5C\u76EE\u5F55\u4F1A\u88AB\u79FB\u9664\uFF0C\u5206\u652F\u672C\u8EAB\u4F1A\u4FDD\u7559\u3002',forceTitle:"\u5F3A\u5236\u5220\u9664 worktree\uFF1F",forceBody:'"{branch}" \u5B58\u5728\u672A\u63D0\u4EA4\u6216\u672A\u8DDF\u8E2A\u7684\u6539\u52A8\uFF0C\u5F3A\u5236\u5220\u9664\u540E\u5C06\u6C38\u4E45\u4E22\u5931\u3002\u4ECD\u8981\u5F3A\u5236\u5220\u9664\u5417\uFF1F',failed:"\u5220\u9664 worktree \u5931\u8D25\uFF1A{error}",residue:"Git \u5DF2\u6CE8\u9500\u8BE5 worktree\uFF0C\u4F46\u6CA1\u80FD\u5220\u6389 {path}\uFF08{reason}\uFF09\u3002Rove \u8FD9\u8FB9\u5DF2\u7ECF\u5904\u7406\u5B8C\u4E86\u2014\u2014\u91CD\u8BD5\u6CA1\u6709\u7528\uFF1B\u60F3\u8981\u56DE\u78C1\u76D8\u7A7A\u95F4\u8BF7\u624B\u52A8\u5220\u9664\u8BE5\u76EE\u5F55\u3002"},land:{button:"\u5408\u5165",confirmTitle:"\u5408\u5165\u5206\u652F\uFF1F",confirmBody:'\u628A "{branch}" \u5408\u5165\u57FA\u4ED3\u5E93\u5F53\u524D\u5206\u652F\uFF0C\u7136\u540E\u79FB\u9664\u8FD9\u4E2A worktree\uFF1F\u5206\u652F\u4F1A\u4FDD\u7559\u3002\u57FA\u7840\u68C0\u51FA\u6709\u672A\u63D0\u4EA4\u6539\u52A8\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u51B2\u7A81\u4F1A\u4E2D\u6B62\u5E76\u7ED9\u51FA\u6587\u4EF6\u6E05\u5355\u3002',noTask:"\u8BE5 worktree \u672A\u4F5C\u4E3A Rove \u4EFB\u52A1\u88AB\u8DDF\u8E2A\u2014\u2014\u6CA1\u6709\u53EF\u5408\u5165\u7684\u5BF9\u8C61\u3002",conflict:"\u5408\u5165\u9047\u5230\u51B2\u7A81\uFF08\u5DF2\u4E2D\u6B62\uFF09\u3002\u8BF7\u624B\u52A8\u89E3\u51B3\uFF1A{files}",dirtyBase:"\u57FA\u7840\u68C0\u51FA\u6709\u672A\u63D0\u4EA4\u6539\u52A8\u2014\u2014\u8BF7\u5148\u63D0\u4EA4\u518D\u5408\u5165\u3002\u7EDD\u4E0D\u8981\u5728\u8FD9\u91CC `git stash`\uFF1Astash \u6808\u5B58\u653E\u5728\u4ED3\u5E93\u7684 common dir \u4E2D\uFF0C\u8BE5\u4ED3\u5E93\u6240\u6709 linked worktree \u5171\u4EAB\uFF0C\u4E00\u6B21 stash \u53EF\u80FD\u7EA0\u7F20\u5176\u4ED6\u4EFB\u52A1\u7684\u5DE5\u4F5C\u3002",failed:"\u5408\u5165\u5931\u8D25\uFF1A{error}",done:'\u5DF2\u628A "{branch}" \u5408\u5165 {landedOn}\uFF08{commit}\uFF09\u3002',worktreeKept:"\u5DF2\u5408\u5165\uFF0C\u4F46 worktree \u4FDD\u7559\u4E86\uFF1A{reason}",worktreePathStale:"\u5DF2\u5408\u5165\u5E76\u79FB\u9664 worktree\uFF0C\u4F46\u4EFB\u52A1\u4ECD\u6307\u5411\u5B83\uFF1A{reason}",worktreeResidue:"\u5DF2\u5408\u5165\u3002Git \u5DF2\u6CE8\u9500\u8BE5 worktree\uFF0C\u4F46\u6CA1\u80FD\u5220\u6389 {path}\uFF08{reason}\uFF09\u2014\u2014\u60F3\u8981\u56DE\u78C1\u76D8\u7A7A\u95F4\u8BF7\u624B\u52A8\u5220\u9664\u8BE5\u76EE\u5F55\u3002"},hint:{}}});function isLocaleId(value){return typeof value==="string"&&LOCALES.some((l)=>l.id===value)}var en20,zh20,LOCALES,CATALOGS,DEFAULT_LOCALE="en";var init_catalog=__esm(()=>{init_automations();init_common();init_doctor();init_files();init_help();init_hints();init_kanban();init_keys();init_newTask();init_onboarding();init_ops();init_quickTask();init_settings();init_tasks();init_terminal();init_update();init_workItems();init_workspace();init_worktrees();en20={settings:en13,tasks:en14,terminal:en15,files:en4,newTask:en9,onboarding:en10,ops:en11,update:en16,quickTask:en12,help:en5,hints:en6,common:en2,keys:en8,workspace:en18,worktrees:en19,kanban:en7,automations:en,workItems:en17,doctor:en3},zh20={settings:zh13,tasks:zh14,terminal:zh15,files:zh4,newTask:zh9,onboarding:zh10,ops:zh11,update:zh16,quickTask:zh12,help:zh5,hints:zh6,common:zh2,keys:zh8,workspace:zh18,worktrees:zh19,kanban:zh7,automations:zh,workItems:zh17,doctor:zh3},LOCALES=[{id:"en",label:"English"},{id:"zh",label:"\u4E2D\u6587"}],CATALOGS={en:en20,zh:zh20}});import{readFileSync as readFileSync11}from"fs";function readPersistedUiPrefs(fallbackTheme,isKnownTheme=hasBundledTheme){try{let parsed=JSON.parse(readFileSync11(kvStatePath(),"utf8")),theme=typeof parsed.activeTheme==="string"&&isKnownTheme(parsed.activeTheme)?parsed.activeTheme:fallbackTheme,transparent=parsed.transparentBackground!==!1,focusAccent=typeof parsed.focusAccent==="string"&&FOCUS_ACCENT_SLOTS.includes(parsed.focusAccent)?parsed.focusAccent:null,locale=isLocaleId(parsed[LOCALE_KEY])?parsed[LOCALE_KEY]:DEFAULT_LOCALE;return{theme,transparent,focusAccent,locale}}catch{return{theme:fallbackTheme,transparent:!0,focusAccent:null,locale:DEFAULT_LOCALE}}}var LOCALE_KEY="locale";var init_persisted_ui_prefs=__esm(()=>{init_env();init_theme_core();init_catalog()});function terminalDefaultColorsForTheme(theme){return parseTerminalDefaultColors({foreground:resolveThemeSlotHex(theme,"text","dark"),background:resolveThemeSlotHex(theme,"background","dark")})??DEFAULT_TERMINAL_COLORS}function readPersistedTerminalDefaultColors(){let themes={...BUNDLED_THEMES};for(let{name,theme}of loadUserThemes())themes[name]=theme;let prefs=readPersistedUiPrefs(DEFAULT_THEME,(name)=>Boolean(themes[name])),selected=themes[prefs.theme]??themes[DEFAULT_THEME];return selected?terminalDefaultColorsForTheme(selected):DEFAULT_TERMINAL_COLORS}var init_terminal_colors2=__esm(()=>{init_terminal_colors();init_theme_core();init_loader();init_persisted_ui_prefs()});function He(r,e){let t=0,n=e.length-1,o;if(r<e[0][0]||r>e[n][1])return!1;for(;n>=t;)if(o=t+n>>1,r>e[o][1])t=o+1;else if(r<e[o][0])n=o-1;else return!0;return!1}function Y(r){Je(r)||Ge.onUnexpectedError(r)}function Je(r){return r instanceof G?!0:r instanceof Error&&r.name===ce&&r.message===ce}function pe(r2,e){let t=this,n=!1,o;return function(){if(n)return o;if(n=!0,e)try{o=r2.apply(t,arguments)}finally{e()}else o=r2.apply(t,arguments);return o}}function Ye(r2,e,t=0,n=r2.length){let o=t,d=n;for(;o<d;){let v=Math.floor((o+d)/2);e(r2[v])?o=v+1:d=v}return o-1}function we(r2,e){return(t,n)=>e(r2(t),r2(n))}function Oe(r2,e){let t=Object.create(null);for(let n of r2){let o=e(n),d=t[o];d||(d=t[o]=[]),d.push(n)}return t}function Ze(r2){O=r2}function Te(r2){return O?.trackDisposable(r2),r2}function ve(r2){O?.markAsDisposed(r2)}function he(r2,e){O?.setParent(r2,e)}function et(r2,e){if(O)for(let t of r2)O.setParent(t,e)}function Pe(r2){if(fe.is(r2)){let e=[];for(let t of r2)if(t)try{t.dispose()}catch(n){e.push(n)}if(e.length===1)throw e[0];if(e.length>1)throw AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(r2)?[]:r2}else if(r2)return r2.dispose(),r2}function Me(...r2){let e=me(()=>Pe(r2));return et(r2,e),e}function me(r2){let e=Te({dispose:pe(()=>{ve(e),r2()})});return e}function je(r5,e){let t=0,n=e.length-1,o;if(r5<e[0][0]||r5>e[n][1])return!1;for(;n>=t;)if(o=t+n>>1,r5>e[o][1])t=o+1;else if(r5<e[o][0])n=o-1;else return!0;return!1}var ue,qe,A,H=class{constructor(){if(this.version="6",!A){A=new Uint8Array(65536),A.fill(1),A[0]=0,A.fill(0,1,32),A.fill(0,127,160),A.fill(2,4352,4448),A[9001]=2,A[9002]=2,A.fill(2,11904,42192),A[12351]=1,A.fill(2,44032,55204),A.fill(2,63744,64256),A.fill(2,65040,65050),A.fill(2,65072,65136),A.fill(2,65280,65377),A.fill(2,65504,65511);for(let e=0;e<ue.length;++e)A.fill(0,ue[e][0],ue[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?A[e]:He(e,qe)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),o=n===0&&t!==0;if(o){let d=w.extractWidth(t);d===0?o=!1:d>n&&(n=d)}return w.createPropertyValue(0,n,o)}},de=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?J.isErrorNoTelemetry(e)?new J(e.message+`
|
|
295
|
+
`)}var API_SCHEMA_VERSION=2,GLOBAL_FLAGS;var init_schema=__esm(()=>{init_repos();init_version();init_rename_compat();init_types();init_verbs();GLOBAL_FLAGS=[{name:"pretty",type:"bool",description:"Pretty-print stdout JSON."},{name:"help",type:"bool",description:"Show usage for the verb and exit."}]});var IllegalTransitionError,TaskNotFoundError,CannotDeleteMainTaskError,DIRTY_WORKTREE_CODE="DIRTY_WORKTREE",DirtyWorktreeError,WorktreeRemoveFailedError,TASK_DELETING_CODE="TASK_DELETING",TaskDeletingError,MAIN_CHECKOUT_DIRTY_CODE="MAIN_CHECKOUT_DIRTY",MainCheckoutDirtyError,EMPTY_BRANCH_CODE="EMPTY_BRANCH",EmptyBranchError,EMPTY_BRANCH_DIRTY_WORKTREE_CODE="EMPTY_BRANCH_DIRTY_WORKTREE",EmptyBranchDirtyWorktreeError,MISSING_REF_CODE="MISSING_REF",MissingRefError,LAND_CONFLICT_CODE="LAND_CONFLICT",LandConflictError,GIT_COMMAND_FAILED_CODE="GIT_COMMAND_FAILED",GitCommandFailedError;var init_errors=__esm(()=>{IllegalTransitionError=class IllegalTransitionError extends Error{from;to;taskId;constructor(from,to,taskId){super(`illegal transition for task ${taskId}: ${from} -> ${to}`);this.from=from;this.to=to;this.taskId=taskId;this.name="IllegalTransitionError"}};TaskNotFoundError=class TaskNotFoundError extends Error{constructor(taskId){super(`task not found: ${taskId}`);this.name="TaskNotFoundError"}};CannotDeleteMainTaskError=class CannotDeleteMainTaskError extends Error{constructor(){super("cannot delete a main task; remove the repo from saved repos instead");this.name="CannotDeleteMainTaskError"}};DirtyWorktreeError=class DirtyWorktreeError extends Error{taskId;constructor(taskId){super(`${DIRTY_WORKTREE_CODE}: task ${taskId} worktree has uncommitted or untracked changes`);this.taskId=taskId;this.name="DirtyWorktreeError"}};WorktreeRemoveFailedError=class WorktreeRemoveFailedError extends Error{taskId;cause;constructor(taskId,cause){super(`failed to remove worktree for task ${taskId}: ${errorMessage(cause)}`);this.taskId=taskId;this.cause=cause;this.name="WorktreeRemoveFailedError"}};TaskDeletingError=class TaskDeletingError extends Error{taskId;constructor(taskId){super(`${TASK_DELETING_CODE}: task ${taskId} is being deleted`);this.taskId=taskId;this.name="TaskDeletingError"}};MainCheckoutDirtyError=class MainCheckoutDirtyError extends Error{repo;dir;constructor(repo,dir){super(`${MAIN_CHECKOUT_DIRTY_CODE}: base checkout at ${dir} has uncommitted changes; commit them before landing (never git stash \u2014 the stash stack is shared by every worktree of this repo)`);this.repo=repo;this.dir=dir;this.name="MainCheckoutDirtyError"}};EmptyBranchError=class EmptyBranchError extends Error{branch;landedOn;constructor(branch,landedOn){super(`${EMPTY_BRANCH_CODE}: '${branch}' has no commits ahead of '${landedOn}' \u2014 landing it would be a no-op (the worker may not have delivered anything)`);this.branch=branch;this.landedOn=landedOn;this.name="EmptyBranchError"}};EmptyBranchDirtyWorktreeError=class EmptyBranchDirtyWorktreeError extends Error{branch;landedOn;worktreePath;files;constructor(branch,landedOn,worktreePath,files){let list=files.length>0?files.join(", "):"(none reported)";super(`${EMPTY_BRANCH_DIRTY_WORKTREE_CODE}: '${branch}' has no commits ahead of '${landedOn}' but its worktree ${worktreePath} has uncommitted changes (${list}) \u2014 commit them in the worktree first, then land again`);this.branch=branch;this.landedOn=landedOn;this.worktreePath=worktreePath;this.files=files;this.name="EmptyBranchDirtyWorktreeError"}};MissingRefError=class MissingRefError extends Error{branch;landedOn;dir;constructor(branch,landedOn,dir){super(`${MISSING_REF_CODE}: '${branch}' does not resolve in the base repo at ${dir} (comparing against '${landedOn}') \u2014 the branch was renamed or deleted outside Rove; re-point the task with \`rove api set-branch\` or recreate the branch`);this.branch=branch;this.landedOn=landedOn;this.dir=dir;this.name="MissingRefError"}};LandConflictError=class LandConflictError extends Error{taskId;branch;files;constructor(taskId,branch,files){let list=files.length>0?files.join(", "):"(none reported)";super(`${LAND_CONFLICT_CODE}: merging '${branch}' hit conflicts, merge aborted \u2014 conflicted files: ${list}`);this.taskId=taskId;this.branch=branch;this.files=files;this.name="LandConflictError"}};GitCommandFailedError=class GitCommandFailedError extends Error{command;stderr;constructor(command,stderr,hint){let detail=stderr.trim()||"(git printed nothing on stderr)";super(`${GIT_COMMAND_FAILED_CODE}: \`git ${command}\` failed \u2014 ${detail}${hint?`; ${hint}`:""}`);this.command=command;this.stderr=stderr;this.name="GitCommandFailedError"}}});import{readFile as readFile8,stat as stat8,unlink as unlink5}from"fs/promises";function listenOnUnixSocket(server,socketPath){return new Promise((resolve3,reject)=>{let evented=server;evented.once("error",reject),server.listen(socketPath,()=>{evented.removeListener("error",reject),resolve3()})})}async function readPidFile(pidPath){try{let raw=await readFile8(pidPath,"utf8"),pid=Number(raw.trim());return Number.isFinite(pid)?pid:null}catch{return null}}function createSocketOwnershipGuard(options){let watchMs=options.watchMs??DEFAULT_SOCKET_WATCH_MS,stamp=null,lost=!1,timer=null,currentStamp=async()=>{try{let s=await stat8(options.socketPath);return{dev:s.dev,ino:s.ino}}catch(err){return err.code==="ENOENT"?null:"error"}},stopTimer=()=>{if(timer)clearInterval(timer);timer=null},verify=async()=>{if(stamp===null||lost)return;let now=await currentStamp();if(now==="error")return;if(now===null||now.dev!==stamp.dev||now.ino!==stamp.ino)lost=!0},check=async()=>{if(stamp===null||lost)return;if(await verify(),!lost)return;stopTimer(),options.onLost()};return{async arm(){let now=await currentStamp();if(now===null||now==="error")return;if(stamp=now,watchMs>0)timer=setInterval(()=>void check(),watchMs),timer.unref?.()},async release(server){if(stopTimer(),await verify(),stamp===null||lost){server.unref();return}await new Promise((resolve3)=>server.close(()=>resolve3())),await unlink5(options.socketPath).catch(()=>{}),await unlink5(options.pidPath).catch(()=>{})}}}var DEFAULT_SOCKET_WATCH_MS=5000;var init_socket_guard=()=>{};import{unlink as unlink6}from"fs/promises";function isProcessAlive2(pid){try{return process.kill(pid,0),!0}catch(err){return err.code==="EPERM"}}async function stopDaemonProcess(socketPath,pidPath){let oldPid=await readPidFile(pidPath),targetPid=oldPid!==null&&oldPid!==process.pid?oldPid:null,wasAlive=targetPid!==null&&isProcessAlive2(targetPid),method=wasAlive?"graceful":"absent",client=new KobeDaemonClient(socketPath),stopRequest=client.request("daemon.stop").catch(()=>{return}),stopTimeout=new Promise((resolve3)=>setTimeout(resolve3,2000));if(await Promise.race([stopRequest,stopTimeout]),client.close(),wasAlive&&targetPid!==null){let deadline=Date.now()+5000,escalated=!1;while(Date.now()<deadline){try{process.kill(targetPid,0)}catch{break}if(!escalated&&Date.now()-(deadline-5000)>2000){try{process.kill(targetPid,"SIGTERM")}catch{}method="sigterm",escalated=!0}await new Promise((resolve3)=>setTimeout(resolve3,50))}try{process.kill(targetPid,0),process.kill(targetPid,"SIGKILL"),method="sigkill",await new Promise((resolve3)=>setTimeout(resolve3,100))}catch{}}let survivor=await readPidFile(pidPath);if(survivor!==null&&survivor!==process.pid&&isProcessAlive2(survivor))return{pid:oldPid,method};return await unlink6(socketPath).catch(()=>{}),await unlink6(pidPath).catch(()=>{}),{pid:oldPid,method}}var init_lifecycle=__esm(()=>{init_client();init_socket_guard()});var exports_daemon_process={};__export(exports_daemon_process,{tryAcquireSpawnLock:()=>tryAcquireSpawnLock,testDaemonResponds:()=>testDaemonResponds,spawnDetachedDaemon:()=>spawnDetachedDaemon,resolveKobeSpawn:()=>resolveKobeSpawn,probeDaemonSocket:()=>probeDaemonSocket,isStaleInstallError:()=>isStaleInstallError,ensureDaemonReachable:()=>ensureDaemonReachable,detachOptions:()=>detachOptions,connectOrStartDaemon:()=>connectOrStartDaemon,connectIfRunning:()=>connectIfRunning,autospawnDaemonEnv:()=>autospawnDaemonEnv,StaleInstallError:()=>StaleInstallError});import{spawn as spawn2}from"child_process";import{closeSync as closeSync3,existsSync as existsSync9,mkdirSync as mkdirSync8,openSync as openSync3,statSync as statSync4,unlinkSync as unlinkSync5}from"fs";import{dirname as dirname9,resolve as resolve3}from"path";import{fileURLToPath as fileURLToPath3}from"url";function detachOptions(platform=process.platform){return platform==="win32"?{windowsHide:!0}:{detached:!0}}function spawnDetachedDaemon(command,args,env,logPath){let stdio="ignore",logFd;try{mkdirSync8(dirname9(logPath),{recursive:!0}),logFd=openSync3(logPath,"a"),stdio=["ignore",logFd,logFd]}catch{stdio="ignore"}if(spawn2(command,[...args],{...detachOptions(),stdio,env}).unref(),logFd!==void 0)try{closeSync3(logFd)}catch{}}function insideEngineSession(env=process.env){return typeof env.KOBE_TASK_ID==="string"&&env.KOBE_TASK_ID!==""}function autospawnDaemonEnv(env=process.env){let{KOBE_TASK_ID:_task,KOBE_TAB_ID:_tab,KOBE_TUI:_tui,KOBE_TERMINAL_PTY:_pty,ROVE_TASK_ID:_roveTask,ROVE_TAB_ID:_roveTab,ROVE_TUI:_roveTui,ROVE_TERMINAL_PTY:_rovePty,...rest}=env;return{...rest,KOBE_DAEMON_AUTOSPAWNED:"1",ROVE_DAEMON_AUTOSPAWNED:"1"}}function tryAcquireSpawnLock(lockPath,staleMs=SPAWN_LOCK_STALE_MS){let create=()=>{return mkdirSync8(dirname9(lockPath),{recursive:!0}),closeSync3(openSync3(lockPath,"wx")),!0};try{return create()}catch{try{if(Date.now()-statSync4(lockPath).mtimeMs<=staleMs)return!1;return unlinkSync5(lockPath),create()}catch{return!1}}}async function ensureDaemonReachable(resolveSpawn=resolveKobeSpawn){let socketPath=defaultDaemonSocketPath(),state=await probeDaemonSocket(socketPath);if(state==="alive")return socketPath;if(state==="wedged"&&insideEngineSession())throw Error(`rove: daemon at ${socketPath} is not answering hello (busy or wedged); not restarting it from inside an engine session \u2014 retry, or run \`rove daemon restart\` from a regular shell`);let lockPath=`${defaultDaemonPidPath()}.spawn-lock`;if(!tryAcquireSpawnLock(lockPath)){let deadline=Date.now()+SPAWN_LOCK_WAIT_MS;while(Date.now()<deadline){if(await testDaemonResponds(socketPath))return socketPath;await new Promise((resolveTimer)=>setTimeout(resolveTimer,150))}throw Error(`rove: another process is starting the daemon but it never became reachable at ${socketPath}; check ${defaultDaemonLogPath()} or run \`rove doctor\``)}try{if(await probeDaemonSocket(socketPath)==="alive")return socketPath;let livePid=await readPidFile(defaultDaemonPidPath());if(livePid!==null&&livePid!==process.pid&&isProcessAlive2(livePid)){let deadline2=Date.now()+BUSY_DAEMON_GRACE_MS;while(Date.now()<deadline2){if(await new Promise((resolveTimer)=>setTimeout(resolveTimer,250)),await testDaemonResponds(socketPath))return socketPath;if(!isProcessAlive2(livePid))break}}let[command,...args]=resolveSpawn(DAEMON_START_ARGS);await stopDaemonProcess(socketPath,defaultDaemonPidPath()).catch(()=>{}),spawnDetachedDaemon(command,args,autospawnDaemonEnv(),defaultDaemonLogPath());let deadline=Date.now()+5000;while(Date.now()<deadline){if(await testDaemonResponds(socketPath))return socketPath;await new Promise((resolveTimer)=>setTimeout(resolveTimer,100))}throw Error(`rove: daemon did not start (or stayed wedged) at ${socketPath}; check ${defaultDaemonLogPath()} or run \`rove doctor\``)}finally{try{unlinkSync5(lockPath)}catch{}}}async function connectOrStartDaemon(){let socketPath=await ensureDaemonReachable(),client=new KobeDaemonClient(socketPath);return await client.connect(),client}async function connectIfRunning(){let socketPath=defaultDaemonSocketPath();if(!await testDaemonResponds(socketPath))return null;let client=new KobeDaemonClient(socketPath);return await client.connect(),client}async function probeDaemonSocket(socketPath,timeoutMs=DAEMON_HELLO_TIMEOUT_MS){let probe=new KobeDaemonClient(socketPath);try{await probe.connect()}catch{return probe.close(),"absent"}let droppedByPeer=!1,offClose=probe.onLifecycle("close",()=>{droppedByPeer=!0}),replied=probe.request("hello",{protocolVersion:DAEMON_PROTOCOL_VERSION}).then(()=>!0).catch(()=>!0),timer,timedOut=new Promise((resolve4)=>{timer=setTimeout(()=>resolve4(!1),timeoutMs)}),settled=await Promise.race([replied,timedOut]);if(timer)clearTimeout(timer);if(offClose(),probe.close(),droppedByPeer)return"absent";return settled?"alive":"wedged"}async function testDaemonResponds(socketPath,timeoutMs=DAEMON_HELLO_TIMEOUT_MS){return await probeDaemonSocket(socketPath,timeoutMs)==="alive"}function isStaleInstallError(err){return err instanceof Error&&err.name==="StaleInstallError"}function resolveKobeSpawn(subcommand,env=process.env,moduleFile=fileURLToPath3(import.meta.url)){let here=moduleFile;if(here.startsWith("/$bunfs")||here.startsWith("B:\\~BUN"))return[process.execPath,...subcommand];let dir=dirname9(here),cliName=env.ROVE_INVOKED_AS===ROVE_PRODUCT_NAME?ROVE_PRODUCT_NAME:LEGACY_KOBE_PRODUCT_NAME,candidates=[resolve3(dir,`../cli/${cliName}.ts`),resolve3(dir,`../../../kobe/src/cli/${cliName}.ts`),resolve3(dir,`../cli/${cliName}.js`),resolve3(dir,"../cli/index.ts"),resolve3(dir,"../../../kobe/src/cli/index.ts"),resolve3(dir,"../cli/index.js")],entry=candidates.find((candidate)=>existsSync9(candidate));if(entry)return[process.execPath,entry,...subcommand];throw new StaleInstallError(cliName,dir,candidates)}var DAEMON_START_ARGS,DAEMON_HELLO_TIMEOUT_MS=3000,BUSY_DAEMON_GRACE_MS=15000,SPAWN_LOCK_STALE_MS=40000,SPAWN_LOCK_WAIT_MS=30000,StaleInstallError;var init_daemon_process=__esm(()=>{init_lifecycle();init_paths();init_protocol();init_socket_guard();init_client();DAEMON_START_ARGS=["daemon","start"];StaleInstallError=class StaleInstallError extends Error{candidates;constructor(cliName,dir,candidates){super(`${cliName}: this process is running from an install that no longer exists on disk \u2014 no ${cliName} entry near ${dir} (checked ${candidates.join(", ")}). Reinstall (\`npm install -g @sma1lboy/rove\`) and relaunch Rove.`);this.name="StaleInstallError",this.candidates=candidates}}});import{existsSync as existsSync10}from"fs";import{rename as rename3,rm as rm2}from"fs/promises";import{basename as basename4,delimiter,dirname as dirname10,join as join12,resolve as resolve4}from"path";import{fileURLToPath as fileURLToPath4}from"url";function resolveNodeBinary(env=process.env,exists=existsSync10,platform=process.platform){let dirs=(env.PATH??env.Path??"").split(delimiter).filter((dir)=>dir.length>0),suffixes=platform==="win32"?(env.PATHEXT??".EXE;.CMD;.BAT").split(";").filter((ext)=>ext.length>0):[""];for(let dir of dirs)for(let suffix of suffixes){let candidate=join12(dir,`node${suffix}`);if(exists(candidate))return candidate}return null}async function bundleWithBun(entry,outFile,io){let{build,rename:move,discard}=io??{build:(config)=>Bun.build(config),rename:rename3,discard:(path15)=>rm2(path15,{force:!0})},staging=`${outFile}.${process.pid}.tmp`,built=await build({entrypoints:[entry],outdir:dirname10(staging),target:"node",format:"esm",naming:basename4(staging),external:["node-pty"]});if(!built.success)return await discard(staging).catch(()=>{}),built;return await move(staging,outFile),built}async function resolveNodePtyHostSpawn(deps={}){let platform=deps.platform??process.platform;if(platform!=="win32")return null;let here=deps.moduleDir??dirname10(fileURLToPath4(import.meta.url)),exists=deps.exists??existsSync10,bundle=deps.bundle??bundleWithBun,node=resolveNodeBinary(deps.env??process.env,exists,platform);if(!node)throw Error("Rove: the Windows PTY host runs under node, but no node was found on PATH. "+"Install Node.js (https://nodejs.org) and restart Rove \u2014 engine and terminal sessions cannot start without it.");let packaged=resolve4(here,PTY_HOST_NODE_BUNDLE);if(exists(packaged))return[node,packaged];let entry=resolve4(here,PTY_HOST_NODE_ENTRY);if(!exists(entry))throw Error(`Rove: no Windows PTY host found (looked for ${packaged} and ${entry})`);let cache3=resolve4(here,PTY_HOST_NODE_DEV_CACHE),built=await bundle(entry,cache3);if(!built.success)throw Error(`Rove: could not build the Windows PTY host \u2014 ${built.logs.map(String).join("; ")}`);return[node,cache3]}async function ensurePtyHostReachable(){let socketPath=defaultPtyHostSocketPath();if(await testDaemonResponds(socketPath))return socketPath;await stopDaemonProcess(socketPath,defaultPtyHostPidPath()).catch(()=>{});let[command,...args]=await resolveNodePtyHostSpawn()??resolveKobeSpawn(PTY_HOST_START_ARGS);spawnDetachedDaemon(command??"",args,process.env,defaultPtyHostLogPath());let deadline=Date.now()+5000;while(Date.now()<deadline){if(await testDaemonResponds(socketPath))return socketPath;await new Promise((resolveTimer)=>setTimeout(resolveTimer,100))}throw Error(`rove: pty host did not start (or stayed wedged) at ${socketPath}`)}async function sweepPtyHostSessions(liveTaskIds,homeDir2){let socketPath=defaultPtyHostSocketPath(homeDir2),client=new KobeDaemonClient(socketPath);try{await client.connect(),await client.request("pty.sweep",{liveTaskIds})}catch{}finally{client.close()}}async function ptyHostHasLiveSessions(homeDir2){let client=new KobeDaemonClient(defaultPtyHostSocketPath(homeDir2));try{return await client.connect(),(await client.request("pty.list")).sessions?.some((s)=>s.alive===!0)??!1}catch{return!1}finally{client.close()}}var PTY_HOST_START_ARGS,PTY_HOST_NODE_BUNDLE="pty-host-node.mjs",PTY_HOST_NODE_DEV_CACHE="../../.cache/pty-host-node.mjs",PTY_HOST_NODE_ENTRY="../daemon/pty-host-node-entry.ts";var init_pty_process=__esm(()=>{init_lifecycle();init_paths();init_daemon_process();init_client();PTY_HOST_START_ARGS=["pty-host"]});function composerGatePreferenceOn(store){return store.get(COMPOSER_GATE_KEY,!0)!==!1}function toggleComposerGatePreference(store,onDisabled){let next=!composerGatePreferenceOn(store);if(store.set(COMPOSER_GATE_KEY,next),!store.flush())return store.set(COMPOSER_GATE_KEY,!next),"persist-failed";if(!next)onDisabled?.();return next?"enabled":"disabled"}function composerGateEnabled(){return getPersistedBool(COMPOSER_GATE_KEY,!0)}var COMPOSER_GATE_KEY="delivery.composerGate";var init_composer_gate=__esm(()=>{init_store()});function normalizeColor(value){return typeof value==="string"&&HEX_COLOR_RE.test(value)?value.toLowerCase():null}function parseTerminalDefaultColors(value){if(typeof value!=="object"||value===null||Array.isArray(value))return null;let raw=value,foreground=normalizeColor(raw.foreground),background=normalizeColor(raw.background);return foreground&&background?{foreground,background}:null}function oscRgb(color){let hex=color.slice(1);return[hex.slice(0,2),hex.slice(2,4),hex.slice(4,6)].map((component)=>component.repeat(2)).join("/")}function formatDefaultColorReply(slot,colors){let color=slot===10?colors.foreground:colors.background;return`\x1B]${slot};rgb:${oscRgb(color)}\x1B\\`}function trailingQueryPrefix(text){let maxLength=QUERY_PREFIXES[0].length+1,start=Math.max(0,text.length-maxLength);for(let index=start;index<text.length;index++){let suffix=text.slice(index);if(QUERY_PREFIXES.some((prefix)=>prefix.startsWith(suffix)||suffix===`${prefix}\x1B`))return suffix}return""}function foldDefaultColorQueries(previousCarry,chunkText){let text=previousCarry+chunkText,slots=[],end=0;DEFAULT_COLOR_QUERY_RE.lastIndex=0;for(let match=DEFAULT_COLOR_QUERY_RE.exec(text);match;match=DEFAULT_COLOR_QUERY_RE.exec(text))slots.push(match[1]==="10"?10:11),end=match.index+match[0].length;return{slots,carry:trailingQueryPrefix(text.slice(end))}}var DEFAULT_TERMINAL_COLORS,HEX_COLOR_RE,DEFAULT_COLOR_QUERY_RE,QUERY_PREFIXES;var init_terminal_colors=__esm(()=>{DEFAULT_TERMINAL_COLORS={foreground:"#eae7df",background:"#141413"},HEX_COLOR_RE=/^#[0-9a-f]{6}$/i,DEFAULT_COLOR_QUERY_RE=/\x1b\](10|11);\?(?:\x07|\x1b\\)/g,QUERY_PREFIXES=["\x1B]10;?","\x1B]11;?"]});import{RGBA}from"@opentui/core";function srgbChannelToLinear(c){let v=c/255;return v<=0.04045?v/12.92:((v+0.055)/1.055)**2.4}function relativeLuminance([r,g,b]){return 0.2126*srgbChannelToLinear(r)+0.7152*srgbChannelToLinear(g)+0.0722*srgbChannelToLinear(b)}function contrastRatioTriplet(fg,bg){let l1=relativeLuminance(fg),l2=relativeLuminance(bg),lighter=Math.max(l1,l2),darker=Math.min(l1,l2);return(lighter+0.05)/(darker+0.05)}function rgbToHsl([r,g,b]){let rn=r/255,gn=g/255,bn=b/255,max=Math.max(rn,gn,bn),min=Math.min(rn,gn,bn),l=(max+min)/2;if(max===min)return[0,0,l];let d=max-min,s=l>0.5?d/(2-max-min):d/(max+min),h;if(max===rn)h=((gn-bn)/d+(gn<bn?6:0))*60;else if(max===gn)h=((bn-rn)/d+2)*60;else h=((rn-gn)/d+4)*60;return[h,s,l]}function hslToRgb(h,s,l){if(s===0){let v=Math.round(l*255);return[v,v,v]}let q=l<0.5?l*(1+s):l+s-l*s,p=2*l-q,channel=(t)=>{let tn=t;if(tn<0)tn+=1;if(tn>1)tn-=1;let c=tn<0.16666666666666666?p+(q-p)*6*tn:tn<0.5?q:tn<0.6666666666666666?p+(q-p)*(0.6666666666666666-tn)*6:p;return Math.round(c*255)};return[channel(h/360+0.3333333333333333),channel(h/360),channel(h/360-0.3333333333333333)]}function ensureContrast(fg,bg,minRatio=HOST_TEXT_MIN_CONTRAST){let fgInts=fg.toInts(),bgInts=bg.toInts(),fgTriplet=[fgInts[0],fgInts[1],fgInts[2]],bgTriplet=[bgInts[0],bgInts[1],bgInts[2]];if(contrastRatioTriplet(fgTriplet,bgTriplet)>=minRatio)return fg;let[h,s,l]=rgbToHsl(fgTriplet),lighten=relativeLuminance(bgTriplet)<=MID_HOST_LUMINANCE,at=(lightness)=>contrastRatioTriplet(hslToRgb(h,s,lightness),bgTriplet),lo=lighten?l:0,hi=lighten?1:l;for(let i=0;i<32;i++){let mid=(lo+hi)/2;if(at(mid)>=minRatio)if(lighten)hi=mid;else lo=mid;else if(lighten)lo=mid;else hi=mid}let[r,g,b]=hslToRgb(h,s,lighten?hi:lo);return RGBA.fromInts(r,g,b,fgInts[3])}var HOST_TEXT_MIN_CONTRAST=4.5,MID_HOST_LUMINANCE=0.5;var init_contrast_guard=()=>{};var claude_default;var init_claude=__esm(()=>{claude_default={$schema:"https://opencode.ai/theme.json",defs:{darkBg:"#141413",darkBgRaised:"#1A1917",darkBgInset:"#2B2A27",darkBgMenu:"#33312E",darkBorderSubtle:"#2B2A27",darkBorder:"#3A3835",darkBorderActive:"#5C5853",darkText:"#EAE7DF",darkTextMuted:"#A9A39A",darkTextSubtle:"#6B665F",darkPrimary:"#CC785C",darkSecondary:"#D4967E",darkAccent:"#CC785C",darkAccentHover:"#E0AB96",darkRed:"#D47563",darkOrange:"#D97757",darkYellow:"#E8C96B",darkGreen:"#9ACA86",darkBlue:"#61AAF2",darkViolet:"#9B87F5",darkTerracotta:"#BF4D43",lightBg:"#FAF9F5",lightBgRaised:"#F0EEE6",lightBgInset:"#EAE7DF",lightBgMenu:"#E2DED4",lightBorderSubtle:"#EAE7DF",lightBorder:"#D9D5CC",lightBorderActive:"#A9A39A",lightText:"#1A1917",lightTextMuted:"#6B665F",lightTextSubtle:"#8D877D",lightPrimary:"#C96442",lightSecondary:"#B85F3D",lightAccent:"#CC785C",lightAccentHover:"#B85F3D",lightRed:"#A84B3A",lightOrange:"#C96442",lightYellow:"#8A6220",lightGreen:"#2E7C4C",lightBlue:"#207FDE",lightViolet:"#7B5BB6",lightTerracotta:"#BF4D43"},theme:{primary:{dark:"darkPrimary",light:"lightPrimary"},secondary:{dark:"darkSecondary",light:"lightSecondary"},accent:{dark:"darkAccent",light:"lightAccent"},error:{dark:"darkRed",light:"lightRed"},warning:{dark:"darkYellow",light:"lightYellow"},success:{dark:"darkGreen",light:"lightGreen"},info:{dark:"darkBlue",light:"lightBlue"},text:{dark:"darkText",light:"lightText"},textMuted:{dark:"darkTextMuted",light:"lightTextMuted"},background:{dark:"darkBg",light:"lightBg"},backgroundPanel:{dark:"darkBgRaised",light:"lightBgRaised"},backgroundElement:{dark:"darkBgInset",light:"lightBgInset"},backgroundMenu:{dark:"darkBgMenu",light:"lightBgMenu"},backgroundDialog:{dark:"darkBgRaised",light:"lightBgRaised"},border:{dark:"darkBorder",light:"lightBorder"},borderActive:{dark:"darkBorderActive",light:"lightBorderActive"},borderSubtle:{dark:"darkBorderSubtle",light:"lightBorderSubtle"},diffAdded:{dark:"darkGreen",light:"lightGreen"},diffRemoved:{dark:"darkRed",light:"lightRed"},diffContext:{dark:"darkTextMuted",light:"lightTextSubtle"},diffHunkHeader:{dark:"darkTextMuted",light:"lightTextSubtle"},diffHighlightAdded:{dark:"#B5E0A0",light:"#1F6638"},diffHighlightRemoved:{dark:"#E89180",light:"#8A3A2C"},diffAddedBg:{dark:"#1F2A1F",light:"#E5EEDF"},diffRemovedBg:{dark:"#2A1F1C",light:"#F5DAD3"},diffContextBg:{dark:"darkBgRaised",light:"lightBgRaised"},diffLineNumber:{dark:"darkTextSubtle",light:"lightTextSubtle"},diffAddedLineNumberBg:{dark:"#1A2419",light:"#D5E2CC"},diffRemovedLineNumberBg:{dark:"#241915",light:"#EBC8BE"},markdownText:{dark:"darkText",light:"lightText"},markdownHeading:{dark:"darkPrimary",light:"lightPrimary"},markdownLink:{dark:"darkAccent",light:"lightAccent"},markdownLinkText:{dark:"darkBlue",light:"lightBlue"},markdownCode:{dark:"darkSecondary",light:"lightSecondary"},markdownBlockQuote:{dark:"darkTextMuted",light:"lightTextMuted"},markdownEmph:{dark:"darkYellow",light:"lightYellow"},markdownStrong:{dark:"darkPrimary",light:"lightPrimary"},markdownHorizontalRule:{dark:"darkTextMuted",light:"lightTextMuted"},markdownListItem:{dark:"darkAccent",light:"lightAccent"},markdownListEnumeration:{dark:"darkBlue",light:"lightBlue"},markdownImage:{dark:"darkAccent",light:"lightAccent"},markdownImageText:{dark:"darkBlue",light:"lightBlue"},markdownCodeBlock:{dark:"darkText",light:"lightText"},markdownQuote:{dark:"darkTextMuted",light:"lightTextMuted"},syntaxComment:{dark:"darkTextSubtle",light:"lightTextSubtle"},syntaxKeyword:{dark:"darkPrimary",light:"lightPrimary"},syntaxFunction:{dark:"darkBlue",light:"lightBlue"},syntaxVariable:{dark:"darkText",light:"lightText"},syntaxString:{dark:"darkGreen",light:"lightGreen"},syntaxNumber:{dark:"darkOrange",light:"lightOrange"},syntaxType:{dark:"darkViolet",light:"lightViolet"},syntaxOperator:{dark:"darkSecondary",light:"lightSecondary"},syntaxPunctuation:{dark:"darkText",light:"lightText"},selectedListItemText:{dark:"darkBg",light:"lightBg"}}}});var conductor_default;var init_conductor=__esm(()=>{conductor_default={$schema:"https://opencode.ai/theme.json",defs:{darkStep1:"#0a0a0a",darkStep2:"#111111",darkStep3:"#181818",darkStep4:"#1f1f1f",darkStep5:"#2a2a2a",darkStep6:"#363636",darkStep7:"#444444",darkStep8:"#5a5a5a",darkStep9:"#7a7a7a",darkStep10:"#9a9a9a",darkStep11:"#909090",darkStep12:"#e8e8e8",darkAccent:"#7da5c8",darkAccentBright:"#9bc3e3",darkRed:"#e06c75",darkOrange:"#d6a668",darkGreen:"#7fd88f",darkCyan:"#7da5c8",darkYellow:"#d6a668",lightStep1:"#fafafa",lightStep2:"#f3f3f3",lightStep3:"#ececec",lightStep4:"#e2e2e2",lightStep5:"#d4d4d4",lightStep6:"#bdbdbd",lightStep7:"#9c9c9c",lightStep8:"#7c7c7c",lightStep9:"#5b5b5b",lightStep10:"#404040",lightStep11:"#6c6c6c",lightStep12:"#1a1a1a",lightAccent:"#3d6f9f",lightAccentBright:"#1a4f87",lightRed:"#c9343a",lightOrange:"#a06b1a",lightGreen:"#3d9a57",lightCyan:"#3d6f9f",lightYellow:"#a06b1a"},theme:{primary:{dark:"darkStep12",light:"lightStep12"},secondary:{dark:"darkAccentBright",light:"lightAccentBright"},accent:{dark:"darkAccent",light:"lightAccent"},error:{dark:"darkRed",light:"lightRed"},warning:{dark:"darkOrange",light:"lightOrange"},success:{dark:"darkGreen",light:"lightGreen"},info:{dark:"darkCyan",light:"lightCyan"},text:{dark:"darkStep12",light:"lightStep12"},textMuted:{dark:"darkStep11",light:"lightStep11"},background:{dark:"darkStep1",light:"lightStep1"},backgroundPanel:{dark:"darkStep2",light:"lightStep2"},backgroundElement:{dark:"darkStep3",light:"lightStep3"},backgroundMenu:{dark:"darkStep4",light:"lightStep4"},border:{dark:"darkStep6",light:"lightStep6"},borderActive:{dark:"darkStep8",light:"lightStep8"},borderSubtle:{dark:"darkStep4",light:"lightStep4"},diffAdded:{dark:"#7fd88f",light:"#3d9a57"},diffRemoved:{dark:"#e06c75",light:"#c9343a"},diffContext:{dark:"darkStep10",light:"lightStep10"},diffHunkHeader:{dark:"darkStep10",light:"lightStep10"},diffHighlightAdded:{dark:"#9be5ad",light:"#2d7a3f"},diffHighlightRemoved:{dark:"#f08490",light:"#a82530"},diffAddedBg:{dark:"#15241a",light:"#d8efdc"},diffRemovedBg:{dark:"#2a1518",light:"#f5dadc"},diffContextBg:{dark:"darkStep2",light:"lightStep2"},diffLineNumber:{dark:"darkStep9",light:"lightStep9"},diffAddedLineNumberBg:{dark:"#0f1c14",light:"#c5deca"},diffRemovedLineNumberBg:{dark:"#221012",light:"#e5c5c8"},markdownText:{dark:"darkStep12",light:"lightStep12"},markdownHeading:{dark:"darkStep12",light:"lightStep12"},markdownLink:{dark:"darkAccent",light:"lightAccent"},markdownCode:{dark:"darkAccentBright",light:"lightAccentBright"},markdownCodeBlock:{dark:"darkStep12",light:"lightStep12"},markdownQuote:{dark:"darkStep11",light:"lightStep11"},selectedListItemText:{dark:"darkStep1",light:"lightStep1"}}}});var tokyonight_default;var init_tokyonight=__esm(()=>{tokyonight_default={$schema:"https://opencode.ai/theme.json",defs:{darkStep1:"#1a1b26",darkStep2:"#1e2030",darkStep3:"#222436",darkStep4:"#292e42",darkStep5:"#3b4261",darkStep6:"#545c7e",darkStep7:"#737aa2",darkStep8:"#9099b2",darkStep9:"#82aaff",darkStep10:"#89b4fa",darkStep11:"#828bb8",darkStep12:"#c8d3f5",darkRed:"#ff757f",darkOrange:"#ff966c",darkYellow:"#ffc777",darkGreen:"#c3e88d",darkCyan:"#86e1fc",darkPurple:"#c099ff",lightStep1:"#e1e2e7",lightStep2:"#d5d6db",lightStep3:"#c8c9ce",lightStep4:"#b9bac1",lightStep5:"#a8aecb",lightStep6:"#9699a8",lightStep7:"#737a8c",lightStep8:"#5a607d",lightStep9:"#2e7de9",lightStep10:"#1a6ce7",lightStep11:"#8990a3",lightStep12:"#3760bf",lightRed:"#f52a65",lightOrange:"#b15c00",lightYellow:"#8c6c3e",lightGreen:"#587539",lightCyan:"#007197",lightPurple:"#9854f1"},theme:{primary:{dark:"darkStep9",light:"lightStep9"},secondary:{dark:"darkPurple",light:"lightPurple"},accent:{dark:"darkOrange",light:"lightOrange"},error:{dark:"darkRed",light:"lightRed"},warning:{dark:"darkOrange",light:"lightOrange"},success:{dark:"darkGreen",light:"lightGreen"},info:{dark:"darkStep9",light:"lightStep9"},text:{dark:"darkStep12",light:"lightStep12"},textMuted:{dark:"darkStep11",light:"lightStep11"},background:{dark:"darkStep1",light:"lightStep1"},backgroundPanel:{dark:"darkStep2",light:"lightStep2"},backgroundElement:{dark:"darkStep3",light:"lightStep3"},border:{dark:"darkStep7",light:"lightStep7"},borderActive:{dark:"darkStep8",light:"lightStep8"},borderSubtle:{dark:"darkStep6",light:"lightStep6"},diffAdded:{dark:"#4fd6be",light:"#1e725c"},diffRemoved:{dark:"#c53b53",light:"#c53b53"},diffContext:{dark:"#828bb8",light:"#7086b5"},diffHunkHeader:{dark:"#828bb8",light:"#7086b5"},diffHighlightAdded:{dark:"#b8db87",light:"#4db380"},diffHighlightRemoved:{dark:"#e26a75",light:"#f52a65"},diffAddedBg:{dark:"#20303b",light:"#d5e5d5"},diffRemovedBg:{dark:"#37222c",light:"#f7d8db"},diffContextBg:{dark:"darkStep2",light:"lightStep2"},diffLineNumber:{dark:"#8f909a",light:"#59595b"},diffAddedLineNumberBg:{dark:"#1b2b34",light:"#c5d5c5"},diffRemovedLineNumberBg:{dark:"#2d1f26",light:"#e7c8cb"},markdownText:{dark:"darkStep12",light:"lightStep12"},markdownHeading:{dark:"darkPurple",light:"lightPurple"},markdownLink:{dark:"darkStep9",light:"lightStep9"},markdownLinkText:{dark:"darkCyan",light:"lightCyan"},markdownCode:{dark:"darkGreen",light:"lightGreen"},markdownBlockQuote:{dark:"darkYellow",light:"lightYellow"},markdownEmph:{dark:"darkYellow",light:"lightYellow"},markdownStrong:{dark:"darkOrange",light:"lightOrange"},markdownHorizontalRule:{dark:"darkStep11",light:"lightStep11"},markdownListItem:{dark:"darkStep9",light:"lightStep9"},markdownListEnumeration:{dark:"darkCyan",light:"lightCyan"},markdownImage:{dark:"darkStep9",light:"lightStep9"},markdownImageText:{dark:"darkCyan",light:"lightCyan"},markdownCodeBlock:{dark:"darkStep12",light:"lightStep12"},syntaxComment:{dark:"darkStep11",light:"lightStep11"},syntaxKeyword:{dark:"darkPurple",light:"lightPurple"},syntaxFunction:{dark:"darkStep9",light:"lightStep9"},syntaxVariable:{dark:"darkRed",light:"lightRed"},syntaxString:{dark:"darkGreen",light:"lightGreen"},syntaxNumber:{dark:"darkOrange",light:"lightOrange"},syntaxType:{dark:"darkYellow",light:"lightYellow"},syntaxOperator:{dark:"darkCyan",light:"lightCyan"},syntaxPunctuation:{dark:"darkStep12",light:"lightStep12"}}}});var BUNDLED_THEME_JSONS;var init_bundled=__esm(()=>{init_claude();init_conductor();init_tokyonight();BUNDLED_THEME_JSONS={claude:claude_default,conductor:conductor_default,tokyonight:tokyonight_default}});import{RGBA as RGBA2}from"@opentui/core";function hasBundledTheme(name){return Boolean(BUNDLED_THEMES[name])}function resolveTheme(theme,mode="dark"){let defs=theme.defs??{};function resolve5(c,chain=[]){if(typeof c==="string"){if(c==="transparent"||c==="none")return RGBA2.fromInts(0,0,0,0);if(c.startsWith("#"))return RGBA2.fromHex(c);if(chain.includes(c))return RGBA2.fromInts(0,0,0);let next=defs[c]??theme.theme[c];if(next===void 0)return RGBA2.fromInts(0,0,0);return resolve5(next,[...chain,c])}return resolve5(c[mode],chain)}let out={};for(let[k,v]of Object.entries(theme.theme))out[k]=resolve5(v);let text=out.text??RGBA2.fromHex("#ffffff"),background=out.background??RGBA2.fromHex("#000000");return{...{primary:out.primary??text,secondary:out.secondary??text,accent:out.accent??out.primary??text,error:out.error??text,warning:out.warning??text,warningOnHost:out.warning??text,success:out.success??text,info:out.info??text,text,textMuted:out.textMuted??text,background,backgroundPanel:out.backgroundPanel??background,backgroundElement:out.backgroundElement??background,backgroundMenu:out.backgroundMenu??out.backgroundElement??background,backgroundDialog:out.backgroundDialog??out.backgroundPanel??background,border:out.border??text,borderActive:out.borderActive??out.border??text,borderSubtle:out.borderSubtle??out.border??text,diffAdded:out.diffAdded??out.success??text,diffRemoved:out.diffRemoved??out.error??text,diffContext:out.diffContext??out.textMuted??text,diffHunkHeader:out.diffHunkHeader??out.textMuted??text,diffAddedBg:out.diffAddedBg??background,diffRemovedBg:out.diffRemovedBg??background,selectedListItemText:out.selectedListItemText??background},...out}}function applyDisplayOverlay(base,focusAccent,transparentBackground,hostBackground){let v={...base,focusAccent:base[focusAccent]??base.primary,warningOnHost:base.warning};if(!transparentBackground)return v;let[backgroundR,backgroundG,backgroundB]=base.background.toInts(),[panelR,panelG,panelB]=base.backgroundPanel.toInts(),transparent={...v,background:RGBA2.fromInts(backgroundR,backgroundG,backgroundB,0),backgroundPanel:RGBA2.fromInts(panelR,panelG,panelB,0)};if(!hostBackground)return transparent;return{...transparent,text:ensureContrast(transparent.text,hostBackground),textMuted:ensureContrast(transparent.textMuted,hostBackground),warningOnHost:ensureContrast(transparent.warning,hostBackground)}}var BUNDLED_THEMES,DEFAULT_THEME="claude",FOCUS_ACCENT_SLOTS;var init_theme_core=__esm(()=>{init_contrast_guard();init_bundled();BUNDLED_THEMES=BUNDLED_THEME_JSONS;FOCUS_ACCENT_SLOTS=["primary","success","info"]});function normalizeHex(value){let m=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.exec(value);if(!m)return null;let digits=m[1];if(digits.length===3){let[r,g,b]=digits;return`#${r}${r}${g}${g}${b}${b}`.toLowerCase()}return`#${digits.slice(0,6)}`.toLowerCase()}function resolveThemeSlotHex(theme,slot,mode="dark"){let defs=theme.defs??{};function resolve5(c,chain){if(typeof c==="string"){if(c==="transparent"||c==="none")return null;if(c.startsWith("#"))return normalizeHex(c);if(chain.includes(c))return null;let next=defs[c]??theme.theme[c];if(next===void 0)return null;return resolve5(next,[...chain,c])}if(!c||typeof c!=="object")return null;let variant=c[mode];return typeof variant==="string"?resolve5(variant,chain):null}let value=theme.theme[slot];if(value===void 0)return null;return resolve5(value,[slot])}function isPlainObject(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function validateTheme(value){if(!isPlainObject(value))return{ok:!1,reason:"theme must be a JSON object at the top level"};let obj=value;if(!("theme"in obj))return{ok:!1,reason:"missing required key `theme`"};let theme=obj.theme;if(!isPlainObject(theme))return{ok:!1,reason:"`theme` must be an object map"};if("defs"in obj&&obj.defs!==void 0){if(!isPlainObject(obj.defs))return{ok:!1,reason:"`defs` must be an object map"};for(let[k,v]of Object.entries(obj.defs))if(typeof v!=="string")return{ok:!1,reason:`defs.${k} must be a string (hex like "#abc" or a ref name)`}}for(let[slot,raw]of Object.entries(theme)){if(typeof raw==="string")continue;if(!isPlainObject(raw))return{ok:!1,reason:`theme.${slot} must be a string or a { dark, light } object (got ${raw===null?"null":Array.isArray(raw)?"array":typeof raw})`};let variant=raw;if(typeof variant.dark!=="string")return{ok:!1,reason:`theme.${slot}.dark must be a string`};if(typeof variant.light!=="string")return{ok:!1,reason:`theme.${slot}.light must be a string`}}if("$schema"in obj&&obj.$schema!==void 0&&typeof obj.$schema!=="string")return{ok:!1,reason:"`$schema` must be a string when present"};return{ok:!0,theme:obj}}var init_schema2=()=>{};import{readFileSync as readFileSync10,readdirSync as readdirSync2}from"fs";import{join as join13}from"path";function userThemesDir(){return join13(roveStateDir(),"themes")}function loadUserThemes(){let dir=userThemesDir(),entries;try{entries=readdirSync2(dir)}catch{return[]}let out=[];for(let file of entries){if(!file.endsWith(".json"))continue;let path15=join13(dir,file),parsed;try{let text=readFileSync10(path15,"utf8");parsed=JSON.parse(text)}catch(err){let msg=errorMessage(err);console.warn(`[rove] skipping user theme ${path15}: invalid JSON \u2014 ${msg}`);continue}let result=validateTheme(parsed);if(!result.ok){console.warn(`[rove] skipping user theme ${path15}: ${result.reason}`);continue}let name=file.slice(0,-5);out.push({name,theme:result.theme})}return out}var init_loader=__esm(()=>{init_env();init_schema2()});var en,zh;var init_automations=__esm(()=>{en={title:"ROUTINES",holdingDaemon:"keeping the daemon awake",notHolding:"none active",paused:"paused",newTitle:"New routine",composerLegend:"enter create \xB7 tab fields \xB7 \u2190\u2192 \u2191\u2193 edit the focused field \xB7 esc cancel",fieldName:"NAME",fieldRepo:"REPO",fieldPrompt:"PROMPT",fieldSchedule:"SCHEDULE (FIVE-FIELD CRON)",namePlaceholder:"weekday dependency audit",promptPlaceholder:"Audit dependencies and summarize risky changes.",needRepo:"Open a project first \u2014 a routine runs in one.",cronInvalid:"not a five-field cron",cronField:{minute:"min",hour:"hour",dayOfMonth:"day",month:"month",dayOfWeek:"weekday"},cronNever:"valid, but never fires",missing:{name:"Give it a name.",repo:"Pick a project.",prompt:"Say what it should do.",schedule:"That schedule will not run."},empty:"No routines scheduled.",emptyHint:"Press n to create one.",precheck:"precheck: {command}",recentRuns:"RECENT RUNS",precheckDetail:"WHY IT SKIPPED \u2014 precheck {exit} in {duration}ms",precheckExited:"exited {code}",precheckTimedOut:"timed out",precheckStdout:"stdout",precheckStderr:"stderr",precheckNoOutput:"(no output)",noRuns:"Not run yet.",noSelection:"A routine runs its prompt in a project on a schedule.",running:"Running {name}\u2026",ranWith:"{name}: {status}",latestRunNoTask:"The latest run created no task.",runNow:"[ run now ]",runNowHint:"try it without waiting for the schedule",deleteTitle:"Delete routine?",deleteBody:"{name} and its run history will be removed. Tasks it already created are untouched.",deleteButton:"Delete",failed:"{error}"},zh={title:"\u4F8B\u884C\u4EFB\u52A1",holdingDaemon:"\u6B63\u5728\u4FDD\u6301\u5B88\u62A4\u8FDB\u7A0B\u5E38\u9A7B",notHolding:"\u65E0\u542F\u7528\u9879",paused:"\u5DF2\u6682\u505C",newTitle:"\u65B0\u5EFA\u4F8B\u884C\u4EFB\u52A1",composerLegend:"enter \u521B\u5EFA \xB7 tab \u5207\u5B57\u6BB5 \xB7 \u2190\u2192 \u2191\u2193 \u7F16\u8F91\u5F53\u524D\u5B57\u6BB5 \xB7 esc \u53D6\u6D88",fieldName:"\u540D\u79F0",fieldRepo:"\u4ED3\u5E93",fieldPrompt:"\u63D0\u793A\u8BCD",fieldSchedule:"\u8C03\u5EA6\uFF08\u4E94\u6BB5 cron\uFF09",namePlaceholder:"\u5DE5\u4F5C\u65E5\u4F9D\u8D56\u5BA1\u8BA1",promptPlaceholder:"\u5BA1\u8BA1\u4F9D\u8D56\u5E76\u603B\u7ED3\u6709\u98CE\u9669\u7684\u53D8\u66F4\u3002",needRepo:"\u5148\u6253\u5F00\u4E00\u4E2A\u9879\u76EE\u2014\u2014\u4F8B\u884C\u4EFB\u52A1\u8981\u8DD1\u5728\u67D0\u4E2A\u9879\u76EE\u91CC\u3002",cronInvalid:"\u4E0D\u662F\u5408\u6CD5\u7684\u4E94\u6BB5 cron",cronField:{minute:"\u5206",hour:"\u65F6",dayOfMonth:"\u65E5",month:"\u6708",dayOfWeek:"\u661F\u671F"},cronNever:"\u8BED\u6CD5\u5408\u6CD5\uFF0C\u4F46\u6C38\u8FDC\u4E0D\u4F1A\u89E6\u53D1",missing:{name:"\u8D77\u4E2A\u540D\u5B57\u3002",repo:"\u9009\u4E00\u4E2A\u9879\u76EE\u3002",prompt:"\u8BF4\u660E\u5B83\u8981\u505A\u4EC0\u4E48\u3002",schedule:"\u8FD9\u4E2A\u8C03\u5EA6\u4E0D\u4F1A\u89E6\u53D1\u3002"},empty:"\u8FD8\u6CA1\u6709\u4F8B\u884C\u4EFB\u52A1\u3002",emptyHint:"\u6309 n \u65B0\u5EFA\u4E00\u6761\u3002",precheck:"\u9884\u68C0\uFF1A{command}",recentRuns:"\u6700\u8FD1\u6267\u884C",precheckDetail:"\u4E3A\u4EC0\u4E48\u8DF3\u8FC7 \u2014\u2014 \u9884\u68C0{exit}\uFF0C\u8017\u65F6 {duration}ms",precheckExited:"\u9000\u51FA\u7801 {code}",precheckTimedOut:"\u8D85\u65F6",precheckStdout:"\u6807\u51C6\u8F93\u51FA",precheckStderr:"\u6807\u51C6\u9519\u8BEF",precheckNoOutput:"\uFF08\u65E0\u8F93\u51FA\uFF09",noRuns:"\u5C1A\u672A\u6267\u884C\u3002",noSelection:"\u4F8B\u884C\u4EFB\u52A1\u4F1A\u6309\u8C03\u5EA6\u5728\u67D0\u4E2A\u9879\u76EE\u91CC\u8DD1\u5B83\u7684\u63D0\u793A\u8BCD\u3002",running:"\u6B63\u5728\u8FD0\u884C {name}\u2026",ranWith:"{name}\uFF1A{status}",latestRunNoTask:"\u6700\u8FD1\u4E00\u6B21\u6267\u884C\u6CA1\u6709\u521B\u5EFA\u4EFB\u52A1\u3002",runNow:"[ \u7ACB\u5373\u8FD0\u884C ]",runNowHint:"\u4E0D\u7B49\u8C03\u5EA6\uFF0C\u76F4\u63A5\u8BD5\u4E00\u6B21",deleteTitle:"\u5220\u9664\u8FD9\u6761\u4F8B\u884C\u4EFB\u52A1\uFF1F",deleteBody:"\u5C06\u5220\u9664 {name} \u53CA\u5176\u6267\u884C\u8BB0\u5F55\u3002\u5B83\u5DF2\u7ECF\u521B\u5EFA\u7684\u4EFB\u52A1\u4E0D\u53D7\u5F71\u54CD\u3002",deleteButton:"\u5220\u9664",failed:"{error}"}});var en2,zh2;var init_common=__esm(()=>{en2={cancel:"Cancel",loading:"Loading\u2026",create:"create",confirm:"Confirm",paneCrash:{title:"This pane crashed",hint:"Reload it from the Tasks pane (the error was logged to client.log)."},rename:{defaultTitle:"Rename task",defaultFieldLabel:"TITLE",footerHint:"enter {submitLabel} \xB7 esc cancel",defaultSubmitLabel:"rename"},prompt:{fieldLabel:"input",submitLabel:"submit"}},zh2={cancel:"\u53D6\u6D88",loading:"\u52A0\u8F7D\u4E2D\u2026",create:"\u521B\u5EFA",confirm:"\u786E\u8BA4",paneCrash:{title:"\u6B64\u9762\u677F\u5DF2\u5D29\u6E83",hint:"\u8BF7\u4ECE\u4EFB\u52A1\u9762\u677F\u91CD\u65B0\u52A0\u8F7D\uFF08\u9519\u8BEF\u5DF2\u8BB0\u5F55\u5230 client.log\uFF09\u3002"},rename:{defaultTitle:"\u91CD\u547D\u540D\u4EFB\u52A1",defaultFieldLabel:"\u540D\u79F0",footerHint:"enter {submitLabel} \xB7 esc \u53D6\u6D88",defaultSubmitLabel:"\u91CD\u547D\u540D"},prompt:{fieldLabel:"\u8F93\u5165",submitLabel:"\u63D0\u4EA4"}}});var en3,zh3;var init_doctor=__esm(()=>{en3={fix:{hint:"{count} finding(s) above have a known fix \u2014 run `{command}` to review them one by one",none:"fix: nothing to fix \u2014 no known remediation applies to this report",header:"fixes \u2014 each one asks before running:",willRun:"will run: {command}",confirmPrompt:"apply this fix? [y/N] ",done:"\u2713 done",failed:"\u2717 exited with code {code}",skipped:"\xB7 skipped",nonInteractive:"no interactive terminal \u2014 nothing was executed; run the commands above yourself",manualHeader:"manual steps \u2014 doctor prints these but never runs them:",daemonRestartWhy:"safe to run: engine sessions live in the separate PTY host and survive a daemon restart",daemonStale:"restart the daemon \u2014 it is running an older build than this CLI",daemonDown:"start the daemon \u2014 it is not running",hooksDown:"restart the daemon to re-establish the engine hook channel",inspectStale:"restart the daemon \u2014 it predates the hook-channel check",skillInstallWhy:"safe to run: installs skill files only; re-running is idempotent",skillMissing:"install the Rove agent skill",skillStale:"update the Rove agent skill to the version this build expects",spawnHelper:"restore the exec bit on node-pty's spawn-helper \u2014 every node-pty PTY spawn fails without it",spawnHelperWhy:"safe to run: chmod on two prebuilt binaries; idempotent, and `bun install` does the same",resetWhy:"stops the daemon, the PTY host, and every live session \u2014 not undoable, so doctor only prints it",resetDaemonWedged:"the daemon process is alive but unreachable (wedged)",resetPty:"the PTY host is unreachable or not running",resetLegacy:"pre-v0.8 tmux sessions are still holding processes and memory",engineTabs:"engine tabs may hold a stale daemon socket path",engineTabsAction:"close and reopen the affected engine tabs in the TUI",engineTabsWhy:"kills that tab's live engine session \u2014 your call, not doctor's",staleInstall:"the install this Rove runs from no longer exists on disk",staleInstallAction:"npm install -g @sma1lboy/rove, then relaunch Rove",staleInstallWhy:"doctor cannot reinstall Rove over the running process \u2014 a human has to, then relaunch",humanOnlyWhy:"doctor does not install software or log in to accounts for you",git:"git is not on PATH",gitAction:"install git with your OS package manager",noEngine:"no usable engine \u2014 no engine CLI is both installed and logged in",noEngineAction:"install an engine CLI (claude, codex, copilot, or kimi) and log in",windowsNode:"Node.js is missing \u2014 the Windows PTY host cannot start",windowsNodeAction:"install Node.js from https://nodejs.org",staleBun:"the Bun running Rove is older than this build supports \u2014 terminals will not paint",staleBunAction:"upgrade Bun (`bun upgrade`, `brew upgrade bun`, or `npm install -g bun@latest`), then relaunch Rove"}},zh3={fix:{hint:"\u4E0A\u9762\u6709 {count} \u9879\u53D1\u73B0\u5B58\u5728\u5DF2\u77E5\u4FEE\u6CD5 \u2014 \u8FD0\u884C `{command}` \u9010\u6761\u67E5\u770B",none:"fix: \u65E0\u53EF\u4FEE\u9879 \u2014 \u672C\u6B21\u62A5\u544A\u6CA1\u6709\u5339\u914D\u5230\u5DF2\u77E5\u4FEE\u6CD5",header:"\u4FEE\u590D\u9879 \u2014 \u6BCF\u4E00\u6761\u90FD\u4F1A\u5148\u8BE2\u95EE\u518D\u6267\u884C:",willRun:"\u5C06\u6267\u884C: {command}",confirmPrompt:"\u6267\u884C\u8FD9\u6761\u4FEE\u590D\u5417? [y/N] ",done:"\u2713 \u5B8C\u6210",failed:"\u2717 \u9000\u51FA\u7801 {code}",skipped:"\xB7 \u5DF2\u8DF3\u8FC7",nonInteractive:"\u6CA1\u6709\u4EA4\u4E92\u7EC8\u7AEF \u2014 \u672A\u6267\u884C\u4EFB\u4F55\u547D\u4EE4; \u8BF7\u81EA\u884C\u8FD0\u884C\u4E0A\u9762\u7684\u547D\u4EE4",manualHeader:"\u4EBA\u5DE5\u6B65\u9AA4 \u2014 doctor \u53EA\u6253\u5370, \u6C38\u8FDC\u4E0D\u4F1A\u66FF\u4F60\u6267\u884C:",daemonRestartWhy:"\u53EF\u5B89\u5168\u6267\u884C: \u5F15\u64CE\u4F1A\u8BDD\u5728\u72EC\u7ACB\u7684 PTY host \u91CC, daemon \u91CD\u542F\u540E\u4ECD\u7136\u5B58\u6D3B",daemonStale:"\u91CD\u542F daemon \u2014 \u5B83\u8FD0\u884C\u7684\u6784\u5EFA\u6BD4\u5F53\u524D CLI \u65E7",daemonDown:"\u542F\u52A8 daemon \u2014 \u5B83\u5F53\u524D\u6CA1\u6709\u5728\u8FD0\u884C",hooksDown:"\u91CD\u542F daemon \u4EE5\u91CD\u5EFA\u5F15\u64CE hook \u901A\u9053",inspectStale:"\u91CD\u542F daemon \u2014 \u5B83\u7684\u7248\u672C\u65E9\u4E8E hook \u901A\u9053\u68C0\u67E5",skillInstallWhy:"\u53EF\u5B89\u5168\u6267\u884C: \u53EA\u5199\u5165 skill \u6587\u4EF6; \u91CD\u590D\u8FD0\u884C\u662F\u5E42\u7B49\u7684",skillMissing:"\u5B89\u88C5 Rove agent skill",skillStale:"\u628A Rove agent skill \u66F4\u65B0\u5230\u5F53\u524D\u6784\u5EFA\u671F\u671B\u7684\u7248\u672C",spawnHelper:"\u6062\u590D node-pty spawn-helper \u7684\u53EF\u6267\u884C\u4F4D \u2014 \u7F3A\u4E86\u5B83 node-pty \u7684\u6BCF\u6B21 PTY \u542F\u52A8\u90FD\u4F1A\u5931\u8D25",spawnHelperWhy:"\u53EF\u5B89\u5168\u6267\u884C: \u53EA\u5BF9\u4E24\u4E2A\u9884\u7F16\u8BD1\u4E8C\u8FDB\u5236\u505A chmod; \u5E42\u7B49, `bun install` \u4E5F\u4F1A\u505A\u540C\u6837\u7684\u4E8B",resetWhy:"\u4F1A\u505C\u6389 daemon\u3001PTY host \u548C\u6240\u6709\u6D3B\u52A8\u4F1A\u8BDD \u2014 \u4E0D\u53EF\u64A4\u9500, \u6240\u4EE5 doctor \u53EA\u6253\u5370",resetDaemonWedged:"daemon \u8FDB\u7A0B\u5B58\u6D3B\u4F46\u65E0\u6CD5\u8FDE\u63A5 (\u5361\u6B7B)",resetPty:"PTY host \u65E0\u6CD5\u8FDE\u63A5\u6216\u6CA1\u6709\u5728\u8FD0\u884C",resetLegacy:"v0.8 \u4E4B\u524D\u7684 tmux \u4F1A\u8BDD\u4ECD\u5360\u7528\u8FDB\u7A0B\u548C\u5185\u5B58",engineTabs:"\u5F15\u64CE tab \u53EF\u80FD\u6301\u6709\u8FC7\u671F\u7684 daemon socket \u8DEF\u5F84",engineTabsAction:"\u5728 TUI \u91CC\u5173\u95ED\u5E76\u91CD\u5F00\u53D7\u5F71\u54CD\u7684\u5F15\u64CE tab",engineTabsWhy:"\u4F1A\u6740\u6389\u8BE5 tab \u7684\u6D3B\u52A8\u5F15\u64CE\u4F1A\u8BDD \u2014 \u7531\u4F60\u51B3\u5B9A, doctor \u4E0D\u4EE3\u52B3",staleInstall:"\u5F53\u524D Rove \u6240\u5728\u7684\u5B89\u88C5\u5DF2\u4ECE\u78C1\u76D8\u5220\u9664",staleInstallAction:"npm install -g @sma1lboy/rove, \u7136\u540E\u91CD\u65B0\u542F\u52A8 Rove",staleInstallWhy:"doctor \u65E0\u6CD5\u5728\u8FD0\u884C\u4E2D\u7684\u8FDB\u7A0B\u4E0A\u91CD\u88C5 Rove \u2014 \u9700\u8981\u4EBA\u5DE5\u91CD\u88C5\u540E\u91CD\u65B0\u542F\u52A8",humanOnlyWhy:"doctor \u4E0D\u4F1A\u66FF\u4F60\u5B89\u88C5\u8F6F\u4EF6\u6216\u767B\u5F55\u8D26\u53F7",git:"PATH \u4E0A\u627E\u4E0D\u5230 git",gitAction:"\u7528\u4F60\u7684\u7CFB\u7EDF\u5305\u7BA1\u7406\u5668\u5B89\u88C5 git",noEngine:"\u6CA1\u6709\u53EF\u7528\u5F15\u64CE \u2014 \u6CA1\u6709\u4EFB\u4F55\u5F15\u64CE CLI \u540C\u65F6\u6EE1\u8DB3\u5DF2\u5B89\u88C5\u4E14\u5DF2\u767B\u5F55",noEngineAction:"\u5B89\u88C5\u4EFB\u4E00\u5F15\u64CE CLI\uFF08claude\u3001codex\u3001copilot \u6216 kimi\uFF09\u5E76\u767B\u5F55",windowsNode:"\u7F3A\u5C11 Node.js \u2014 Windows PTY host \u65E0\u6CD5\u542F\u52A8",windowsNodeAction:"\u4ECE https://nodejs.org \u5B89\u88C5 Node.js",staleBun:"\u8FD0\u884C Rove \u7684 Bun \u7248\u672C\u4F4E\u4E8E\u672C\u6784\u5EFA\u7684\u8981\u6C42 \u2014 \u7EC8\u7AEF\u4E0D\u4F1A\u6709\u4EFB\u4F55\u8F93\u51FA",staleBunAction:"\u5347\u7EA7 Bun (`bun upgrade` / `brew upgrade bun` / `npm install -g bun@latest`), \u7136\u540E\u91CD\u65B0\u542F\u52A8 Rove"}}});var en4,zh4;var init_files=__esm(()=>{en4={mentionNoEngine:"No engine session in this task \u2014 nothing to mention into. Open one with ctrl+t.",tabs:{all:"All",changes:"Changes"},actions:{zen:"Zen",createPR:"Ask agent to create PR"},legend:{changes:"M modified \xB7 A added \xB7 D deleted \xB7 ? untracked"},scope:{working:"scope: working tree",branch:"scope: vs {base}",toggleHint:"b to toggle"},empty:{noTask:"(no task \u2014 press n to create)",noFiles:"(empty worktree)",noChanges:"(no changes \u2014 clean worktree)"},error:{retryHint:"press r to retry",notGitRepo:"not a git repository",pathMissing:"worktree path is missing",permissionDenied:"permission denied",gitNotInstalled:"git is not installed",gitFailed:"git command failed"},toast:{prOnTargetBranch:"Already on the target branch ({branch}) \u2014 ask the agent to create the PR from a task branch",ciNoFailingChecks:"No failing check logs to read \u2014 the run may have expired, or the checks are no longer red"}},zh4={mentionNoEngine:"\u8FD9\u4E2A\u4EFB\u52A1\u6CA1\u6709\u5F15\u64CE\u4F1A\u8BDD\u2014\u2014\u6CA1\u6709\u5730\u65B9\u53EF\u4EE5\u63D0\u53CA\u3002\u7528 ctrl+t \u5F00\u4E00\u4E2A\u3002",tabs:{all:"\u5168\u90E8",changes:"\u6539\u52A8"},actions:{zen:"\u4E13\u6CE8\u6A21\u5F0F",createPR:"\u8BA9 agent \u521B\u5EFA PR"},legend:{changes:"M \u5DF2\u4FEE\u6539 \xB7 A \u5DF2\u6DFB\u52A0 \xB7 D \u5DF2\u5220\u9664 \xB7 ? \u672A\u8DDF\u8E2A"},scope:{working:"\u8303\u56F4\uFF1A\u5DE5\u4F5C\u533A\u6539\u52A8",branch:"\u8303\u56F4\uFF1A\u5BF9\u6BD4 {base}",toggleHint:"\u6309 b \u5207\u6362"},empty:{noTask:"\uFF08\u6682\u65E0\u4EFB\u52A1 \u2014 \u6309 n \u521B\u5EFA\uFF09",noFiles:"\uFF08worktree \u4E3A\u7A7A\uFF09",noChanges:"\uFF08\u65E0\u6539\u52A8 \u2014 worktree \u5E72\u51C0\uFF09"},error:{retryHint:"\u6309 r \u91CD\u8BD5",notGitRepo:"\u4E0D\u662F git \u4ED3\u5E93",pathMissing:"worktree \u8DEF\u5F84\u4E0D\u5B58\u5728",permissionDenied:"\u6743\u9650\u4E0D\u8DB3",gitNotInstalled:"\u672A\u5B89\u88C5 git",gitFailed:"git \u547D\u4EE4\u5931\u8D25"},toast:{prOnTargetBranch:"\u5F53\u524D\u5C31\u5728\u76EE\u6807\u5206\u652F\uFF08{branch}\uFF09\u2014 \u8BF7\u5728\u4EFB\u52A1\u5206\u652F\u4E0A\u8BA9 agent \u521B\u5EFA PR",ciNoFailingChecks:"\u6CA1\u6709\u53EF\u8BFB\u7684\u5931\u8D25\u68C0\u67E5\u65E5\u5FD7\u2014\u2014\u8FD0\u884C\u8BB0\u5F55\u53EF\u80FD\u5DF2\u8FC7\u671F\uFF0C\u6216\u68C0\u67E5\u5DF2\u4E0D\u518D\u662F\u7EA2\u7684"}}});var en5,zh5;var init_help=__esm(()=>{en5={title:"Rove \u2014 keybindings",esc:"esc",commandLayer:"{prefix} \u2014 more Rove commands",escCancel:"esc cancel",directLayer:"Hold ctrl \u2014 Rove shortcuts",releaseCtrl:"release ctrl to close",overflow:"\u2026 F1 for all shortcuts",moreCommandsPrefix:"More commands (prefix)",focused:"Focused: {surface}",allBindings:"All keybinding contexts",grammar:"Use keys here \xB7 one-press Rove shortcuts \xB7 {prefix} for more commands",disabled:"prefix disabled",here:"HERE \u2014 only in {surface}",direct:"ONE PRESS \u2014 Rove shortcuts",afterPrefix:"AFTER PREFIX \u2014 more Rove commands",otherPane:"OTHER PANE \u2014 {surface}"},zh5={title:"Rove \u2014 \u5FEB\u6377\u952E",esc:"esc",commandLayer:"{prefix} \u2014 \u66F4\u591A Rove \u547D\u4EE4",escCancel:"esc \u53D6\u6D88",directLayer:"\u6309\u4F4F ctrl \u2014 Rove \u5FEB\u6377\u952E",releaseCtrl:"\u677E\u5F00 ctrl \u5173\u95ED",overflow:"\u2026 \u6309 F1 \u67E5\u770B\u5168\u90E8\u5FEB\u6377\u952E",moreCommandsPrefix:"\u66F4\u591A\u547D\u4EE4\uFF08prefix\uFF09",focused:"\u5F53\u524D\u7126\u70B9\uFF1A{surface}",allBindings:"\u6240\u6709\u5FEB\u6377\u952E\u4E0A\u4E0B\u6587",grammar:"\u5F53\u524D\u533A\u57DF\u76F4\u63A5\u6309 \xB7 Rove \u5355\u6B21\u5FEB\u6377\u952E \xB7 {prefix} \u6253\u5F00\u66F4\u591A\u547D\u4EE4",disabled:"Prefix \u5DF2\u7981\u7528",here:"\u5F53\u524D\u533A\u57DF \u2014 \u4EC5\u5728{surface}",direct:"\u4E00\u6B21\u6309\u4E0B \u2014 Rove \u5FEB\u6377\u952E",afterPrefix:"\u6309\u4E0B Prefix \u540E \u2014 \u66F4\u591A Rove \u547D\u4EE4",otherPane:"\u5176\u4ED6\u533A\u57DF \u2014 {surface}"}});var en6,zh6;var init_hints=__esm(()=>{en6={status:{commands:"{key} commands",help:"{key} help",sidebar:"{key} sidebar",settings:"settings"},pane:{move:"move",open:"open",collapse:"collapse",diff:"diff"}},zh6={status:{commands:"{key} \u547D\u4EE4",help:"{key} \u5E2E\u52A9",sidebar:"{key} \u4FA7\u680F",settings:"\u8BBE\u7F6E"},pane:{move:"\u79FB\u52A8",open:"\u6253\u5F00",collapse:"\u6298\u53E0",diff:"\u5DEE\u5F02"}}});var en7,zh7;var init_kanban=__esm(()=>{en7={title:"Kanban",hint:"tab project \xB7 \u2190\u2193\u2191\u2192 card \xB7 enter detail \xB7 n new \xB7 d delete \xB7 r refresh \xB7 esc close",loading:"Loading issues\u2026",noRepos:"No projects yet \u2014 create a task first.",empty:"No issues \u2014 agents file them via `rove api issue-create`.",columnEmpty:"No cards",column:{backlog:"Backlog",inProgress:"In progress",parked:"Parked",done:"Done"},more:"+{count} more",attention:"{count} need you",turnComplete:"turn done",detail:{status:{open:"open",doing:"doing",hold:"hold",done:"done"},created:"created {date}",linked:"linked to a session",titleLabel:"TITLE",description:"DESCRIPTION",noDescription:"No description.",attachHint:"paste a path / ctrl+v screenshot \u2192 inserts an image placeholder",engine:"ENGINE",workspace:"WORKSPACE",placement:{worktree:"New worktree task \u2014 its own workspace",projectWorktree:"New worktree \u2014 as a chattab in the project workspace",project:"Project checkout \u2014 a new chattab, no worktree"},jumpLabel:"AFTER START",jump:{stay:"Stay on the board",follow:"Jump to the session"},startLegend:"enter/ctrl+enter start \xB7 tab fields \xB7 \u2190\u2192 engine \xB7 \u2191\u2193 workspace \xB7 esc save & close",sessionLabel:"SESSION",openAction:"Open the linked session \u21B5",unlinkAction:"Unlink",openLegend:"enter open the focused action \xB7 tab fields \xB7 unlink returns the card to Backlog \xB7 esc save & close",eventsLabel:"EVENTS",eventsLoading:"Loading events\u2026",eventsNone:"No engine events recorded yet.",doneNote:"Done stories have nothing left to start \xB7 esc save & close",startedBackground:"Started in background: {title}",newStory:"NEW STORY",createLegend:"ctrl+s save \xB7 enter/ctrl+enter save & start \xB7 tab fields \xB7 esc cancel"},confirmDelete:{title:"Delete story #{id}?",body:"\u201C{title}\u201D will be removed from the tracker. A linked task, branch, or worktree is left untouched."},deleteFailed:"Couldn't delete story #{id}: {error}",createFailed:"Couldn't create the story: {error}",updateFailed:"Couldn't save story #{id}: {error}",statusFailed:"Story #{id} stays in its old column: {error}",linkFailed:"Story #{id} isn't linked to its task: {error}",unlinkFailed:"Story #{id} is still linked: {error}"},zh7={title:"\u770B\u677F",hint:"tab \u5207\u9879\u76EE \xB7 \u2190\u2193\u2191\u2192 \u9009\u5361\u7247 \xB7 enter \u8BE6\u60C5 \xB7 n \u65B0\u5EFA \xB7 d \u5220\u9664 \xB7 r \u5237\u65B0 \xB7 esc \u5173\u95ED",loading:"\u6B63\u5728\u52A0\u8F7D issues\u2026",noRepos:"\u8FD8\u6CA1\u6709\u9879\u76EE\u2014\u2014\u5148\u521B\u5EFA\u4E00\u4E2A\u4EFB\u52A1\u3002",empty:"\u6682\u65E0 issue\u2014\u2014agent \u53EF\u901A\u8FC7 `rove api issue-create` \u521B\u5EFA\u3002",columnEmpty:"\u6682\u65E0\u5361\u7247",column:{backlog:"\u5F85\u529E",inProgress:"\u8FDB\u884C\u4E2D",parked:"\u6401\u7F6E",done:"\u5DF2\u5B8C\u6210"},more:"\u8FD8\u6709 {count} \u6761",attention:"{count} \u5F20\u7B49\u4F60\u5904\u7406",turnComplete:"\u56DE\u5408\u5B8C\u6210",detail:{status:{open:"\u5F85\u529E",doing:"\u8FDB\u884C\u4E2D",hold:"\u6401\u7F6E",done:"\u5DF2\u5B8C\u6210"},created:"\u521B\u5EFA\u4E8E {date}",linked:"\u5DF2\u5173\u8054\u4F1A\u8BDD",titleLabel:"\u6807\u9898",description:"\u63CF\u8FF0",noDescription:"\u6682\u65E0\u63CF\u8FF0\u3002",attachHint:"\u7C98\u8D34\u8DEF\u5F84 / ctrl+v \u8D34\u622A\u56FE \u2192 \u63D2\u5165\u56FE\u7247\u5360\u4F4D\u884C",engine:"\u5F15\u64CE",workspace:"\u5DE5\u4F5C\u533A",placement:{worktree:"\u65B0\u5EFA worktree \u4EFB\u52A1\u2014\u2014\u72EC\u7ACB\u5DE5\u4F5C\u533A",projectWorktree:"\u65B0\u5EFA worktree\u2014\u2014\u4F5C\u4E3A\u9879\u76EE\u5DE5\u4F5C\u533A\u91CC\u7684 chattab",project:"\u9879\u76EE\u4E3B\u76EE\u5F55\u2014\u2014\u65B0\u5F00 chattab,\u4E0D\u5EFA worktree"},jumpLabel:"\u542F\u52A8\u540E",jump:{stay:"\u7559\u5728\u770B\u677F",follow:"\u8DF3\u8F6C\u5230\u4F1A\u8BDD"},startLegend:"enter/ctrl+enter \u542F\u52A8 \xB7 tab \u5207\u5B57\u6BB5 \xB7 \u2190\u2192 \u5F15\u64CE \xB7 \u2191\u2193 \u5DE5\u4F5C\u533A \xB7 esc \u4FDD\u5B58\u5173\u95ED",sessionLabel:"\u4F1A\u8BDD",openAction:"\u6253\u5F00\u5173\u8054\u4F1A\u8BDD \u21B5",unlinkAction:"\u89E3\u9664\u5173\u8054",openLegend:"enter \u6267\u884C\u9009\u4E2D\u64CD\u4F5C \xB7 tab \u5207\u5B57\u6BB5 \xB7 \u89E3\u9664\u5173\u8054\u628A\u5361\u7247\u9000\u56DE Backlog \xB7 esc \u4FDD\u5B58\u5173\u95ED",eventsLabel:"\u4E8B\u4EF6",eventsLoading:"\u6B63\u5728\u52A0\u8F7D\u4E8B\u4EF6\u2026",eventsNone:"\u6682\u65E0\u5F15\u64CE\u4E8B\u4EF6\u8BB0\u5F55\u3002",doneNote:"\u5DF2\u5B8C\u6210\u7684 story \u65E0\u9700\u542F\u52A8 \xB7 esc \u4FDD\u5B58\u5173\u95ED",startedBackground:"\u5DF2\u5728\u540E\u53F0\u542F\u52A8:{title}",newStory:"\u65B0\u5EFA STORY",createLegend:"ctrl+s \u4EC5\u4FDD\u5B58 \xB7 enter/ctrl+enter \u4FDD\u5B58\u5E76\u542F\u52A8 \xB7 tab \u5207\u5B57\u6BB5 \xB7 esc \u53D6\u6D88"},confirmDelete:{title:"\u5220\u9664 story #{id}?",body:"\u300C{title}\u300D\u5C06\u4ECE tracker \u4E2D\u79FB\u9664\u3002\u5DF2\u5173\u8054\u7684\u4EFB\u52A1\u3001\u5206\u652F\u3001worktree \u4E0D\u53D7\u5F71\u54CD\u3002"},deleteFailed:"\u5220\u9664 story #{id} \u5931\u8D25\uFF1A{error}",createFailed:"\u521B\u5EFA story \u5931\u8D25\uFF1A{error}",updateFailed:"\u4FDD\u5B58 story #{id} \u5931\u8D25\uFF1A{error}",statusFailed:"Story #{id} \u4ECD\u7559\u5728\u539F\u6765\u7684\u5217\uFF1A{error}",linkFailed:"Story #{id} \u672A\u80FD\u5173\u8054\u5230\u5B83\u7684\u4EFB\u52A1\uFF1A{error}",unlinkFailed:"Story #{id} \u4ECD\u5904\u4E8E\u5173\u8054\u72B6\u6001\uFF1A{error}"}});var en8,zh8;var init_keys=__esm(()=>{en8={category:{Global:"Global",Sidebar:"Sidebar",Workspace:"Workspace",Navigation:"Navigation","Tasks pane":"Tasks pane",Files:"Files",Terminal:"Terminal",Dialog:"Dialog",Views:"Views",Tasks:"Tasks",Sessions:"Sessions",Attention:"Attention",Tools:"Tools"},desc:{"help.open":"Show keybindings help","task.new":"New task","task.new.global":"New task","task.openEditor":"Open active Task directory in editor","task.moveMode":"Reorder sidebar rows (then j/k \u2014 tab, task, or project)","settings.open":"Open settings","settings.open.sidebar":"Open settings","inbox.show":"Open attention Inbox","worktrees.open.sidebar":"Open worktrees","kanban.open":"Open kanban (issues board)","automations.open":"Open routines (scheduled tasks)","workItems.open":"Open GitHub issues (external tracker)","app.quit":"Quit (with confirm)","focus.sidebar":"Back to sidebar (tasks)","focus.previous":"Focus previous pane (files \u2192 workspace \u2192 sidebar)","focus.next":"Focus next pane (sidebar \u2192 workspace \u2192 files)","workspace.zenToggle":"Toggle zen mode","attention.next":"Jump to the next attention item","chat.interrupt":"Interrupt current turn (esc while streaming)","sidebar.nav":"Move cursor up/down","sidebar.select":"Open the selected task","sidebar.tree.open":"Open the row under the cursor","sidebar.goto":"Top / bottom of list (gg or shift-G)","sidebar.rename":"Rename task","sidebar.localMerge":"Reorder row (Shift+M, then j/k \u2014 tab, task, or project)","sidebar.pin":"Pin / unpin task at top (Shift+P)","sidebar.sort":"Switch task sort (default \u2194 recent)","sidebar.delete":"Delete task (with confirm)","sidebar.search.enter":"Search tasks (fuzzy filter)","sidebar.search.nav":"Move highlight in search results","sidebar.search.submit":"Select search match and exit search","sidebar.search.cancel":"Cancel search (restore prior selection)","tasks.openWorktree":"Open selected Task directory in your editor","tasks.renameBranch":"Rename the selected task's git branch","tasks.cycleEngine":"Cycle engine vendor \u2014 applies on reopen","tasks.update":"Open the update page (when a new version is available)","tasks.focusEngine":"Focus the engine pane of the current window","tasks.jump":"Jump to the task showing that digit","chat.send":"Send message (composer)","chat.newline":"Newline in composer","chat.cycle-mode":"Cycle permission mode (composer)","chat.steer":"Steer (interrupt + send) \u2014 mid-stream only","chat.tab.new":"New chat tab","chat.tab.chooseEngine":"New conversation \u2014 engine/shell picker with destination + context toggles","chat.tab.fork":"Fork this chat into a new tab (same Task directory, keeps the conversation)","chat.fork.new":"Quick-fork: create child task seeded with current repo/branch/model","chat.tab.close":"Close chat tab","chat.tab.rename":"Rename active chat tab","chat.tab.cycle-next":"Next chat tab","chat.tab.cycle-prev":"Previous chat tab","workspace.split.right":"Split right","workspace.split.down":"Split down","workspace.split.focus-next":"Focus next split","workspace.split.close":"Close active split (tab when unsplit)","workspace.split.rename":"Rename active split (tab when unsplit)","files.nav":"Move cursor up/down","files.hierarchy":"Collapse / expand tree level","files.open":"Open file in configured editor (diff when supported)","files.tab":"Switch tab (cycle All / Changes)","files.refresh":"Refresh","files.scope":"Toggle Changes scope (working \u2194 branch vs base)","files.diff":"Open a read-only diff in a workspace tab","files.openExternal":"Open file in system default app (audio / video / pdf preview)","files.mention":"Inject @<path> mention into the engine pane","files.createPR":"Ask the agent to create a PR from the current task","files.fixChecks":"Ask the agent to fix the failing PR checks","files.syncBase":"Merge the base branch into this task's worktree","diff.review.cursor":"Move the line cursor over the diff","diff.review.range":"Toggle range anchor at the cursor","diff.review.note":"Add a review note at the cursor","diff.review.send":"Send all unsent review notes to the engine","inbox.nav":"Move through attention items","inbox.open":"Open the selected attention item","inbox.delete":"Clear the selected attention item","terminal.scroll-up":"Scroll scrollback up","terminal.scroll-down":"Scroll scrollback down","terminal.reset":"Reset terminal \u2014 kill the current shell and respawn","terminal.search":"Search the scrollback","terminal.search.older":"Scrollback search: walk to the older match","terminal.search.newer":"Scrollback search: walk to the newer match","terminal.search.cancel":"Close scrollback search (restore prior scroll position)","dialog.cancel":"Close the top dialog (esc)","dialog.newtask.tab.cycle":"Switch New Task tab (Existing / New Repo)"}},zh8={category:{Global:"\u5168\u5C40",Sidebar:"\u4FA7\u8FB9\u680F",Workspace:"\u5DE5\u4F5C\u533A",Navigation:"\u5BFC\u822A","Tasks pane":"\u4EFB\u52A1\u9762\u677F",Files:"\u6587\u4EF6",Terminal:"\u7EC8\u7AEF",Dialog:"\u5BF9\u8BDD\u6846",Views:"\u89C6\u56FE",Tasks:"\u4EFB\u52A1",Sessions:"\u4F1A\u8BDD",Attention:"\u63D0\u9192",Tools:"\u5DE5\u5177"},desc:{"help.open":"\u663E\u793A\u5FEB\u6377\u952E\u5E2E\u52A9","task.new":"\u65B0\u5EFA\u4EFB\u52A1","task.new.global":"\u65B0\u5EFA\u4EFB\u52A1","task.openEditor":"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u5F53\u524D Task \u7684\u76EE\u5F55","task.moveMode":"\u8C03\u6574\u4FA7\u8FB9\u680F\u884C\u987A\u5E8F\uFF08\u7136\u540E j/k\u2014\u2014tab / \u4EFB\u52A1 / \u9879\u76EE\uFF09","settings.open":"\u6253\u5F00\u8BBE\u7F6E","settings.open.sidebar":"\u6253\u5F00\u8BBE\u7F6E","inbox.show":"\u6253\u5F00\u63D0\u9192\u6536\u4EF6\u7BB1","worktrees.open.sidebar":"\u6253\u5F00 worktrees","kanban.open":"\u6253\u5F00\u770B\u677F\uFF08issues\uFF09","automations.open":"\u6253\u5F00\u4F8B\u884C\u4EFB\u52A1\uFF08\u5B9A\u65F6\u4EFB\u52A1\uFF09","workItems.open":"\u6253\u5F00 GitHub issues\uFF08\u5916\u90E8\u8DDF\u8E2A\u5668\uFF09","app.quit":"\u9000\u51FA\uFF08\u9700\u786E\u8BA4\uFF09","focus.sidebar":"\u8FD4\u56DE\u4FA7\u8FB9\u680F\uFF08\u4EFB\u52A1\u5217\u8868\uFF09","focus.previous":"\u805A\u7126\u4E0A\u4E00\u4E2A\u9762\u677F\uFF08\u6587\u4EF6 \u2192 \u5DE5\u4F5C\u533A \u2192 \u4FA7\u8FB9\u680F\uFF09","focus.next":"\u805A\u7126\u4E0B\u4E00\u4E2A\u9762\u677F\uFF08\u4FA7\u8FB9\u680F \u2192 \u5DE5\u4F5C\u533A \u2192 \u6587\u4EF6\uFF09","workspace.zenToggle":"\u5207\u6362\u7985\u6A21\u5F0F","attention.next":"\u8DF3\u5230\u4E0B\u4E00\u4E2A\u9700\u8981\u6CE8\u610F\u7684\u9879\u76EE","chat.interrupt":"\u4E2D\u65AD\u5F53\u524D\u8F6E\u6B21\uFF08\u6D41\u5F0F\u8F93\u51FA\u4E2D\u6309 esc\uFF09","sidebar.nav":"\u4E0A\u4E0B\u79FB\u52A8\u5149\u6807","sidebar.select":"\u6253\u5F00\u9009\u4E2D\u7684\u4EFB\u52A1","sidebar.tree.open":"\u6253\u5F00\u5149\u6807\u6240\u5728\u884C","sidebar.goto":"\u8DF3\u5230\u5217\u8868\u9876\u90E8 / \u5E95\u90E8\uFF08gg \u6216 shift-G\uFF09","sidebar.rename":"\u91CD\u547D\u540D\u4EFB\u52A1","sidebar.localMerge":"\u8C03\u6574\u5F53\u524D\u884C\u987A\u5E8F\uFF08Shift+M\uFF0C\u7136\u540E j/k\u2014\u2014tab / \u4EFB\u52A1 / \u9879\u76EE\uFF09","sidebar.pin":"\u7F6E\u9876 / \u53D6\u6D88\u7F6E\u9876\u4EFB\u52A1\uFF08Shift+P\uFF09","sidebar.sort":"\u5207\u6362\u4EFB\u52A1\u6392\u5E8F\u65B9\u5F0F\uFF08\u9ED8\u8BA4 \u2194 \u6700\u8FD1\uFF09","sidebar.delete":"\u5220\u9664\u4EFB\u52A1\uFF08\u9700\u786E\u8BA4\uFF09","sidebar.search.enter":"\u641C\u7D22\u4EFB\u52A1\uFF08\u6A21\u7CCA\u8FC7\u6EE4\uFF09","sidebar.search.nav":"\u5728\u641C\u7D22\u7ED3\u679C\u4E2D\u79FB\u52A8\u9AD8\u4EAE","sidebar.search.submit":"\u9009\u4E2D\u641C\u7D22\u5339\u914D\u9879\u5E76\u9000\u51FA\u641C\u7D22","sidebar.search.cancel":"\u53D6\u6D88\u641C\u7D22\uFF08\u6062\u590D\u4E4B\u524D\u7684\u9009\u4E2D\u9879\uFF09","tasks.openWorktree":"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u9009\u4E2D Task \u7684\u76EE\u5F55","tasks.renameBranch":"\u91CD\u547D\u540D\u9009\u4E2D\u4EFB\u52A1\u7684 git \u5206\u652F","tasks.cycleEngine":"\u5FAA\u73AF\u5207\u6362\u5F15\u64CE\u5382\u5546\u2014\u2014\u91CD\u65B0\u6253\u5F00\u540E\u751F\u6548","tasks.update":"\u6253\u5F00\u66F4\u65B0\u9875\u9762\uFF08\u6709\u65B0\u7248\u672C\u65F6\uFF09","tasks.focusEngine":"\u805A\u7126\u5F53\u524D\u7A97\u53E3\u7684\u5F15\u64CE\u9762\u677F","tasks.jump":"\u8DF3\u5230\u663E\u793A\u5BF9\u5E94\u6570\u5B57\u7684\u4EFB\u52A1","chat.send":"\u53D1\u9001\u6D88\u606F\uFF08\u8F93\u5165\u6846\uFF09","chat.newline":"\u5728\u8F93\u5165\u6846\u4E2D\u6362\u884C","chat.cycle-mode":"\u5FAA\u73AF\u5207\u6362\u6743\u9650\u6A21\u5F0F\uFF08\u8F93\u5165\u6846\uFF09","chat.steer":"\u5F15\u5BFC\uFF08\u4E2D\u65AD\u5E76\u53D1\u9001\uFF09\u2014\u2014\u4EC5\u9650\u6D41\u5F0F\u8F93\u51FA\u4E2D","chat.tab.new":"\u65B0\u5EFA\u804A\u5929\u6807\u7B7E\u9875","chat.tab.chooseEngine":"\u65B0\u5EFA\u5BF9\u8BDD \u2014\u2014 \u9009\u62E9\u5F15\u64CE\u6216 shell\uFF0C\u53EF\u5207\u6362\u843D\u70B9\u4E0E\u4E0A\u4E0B\u6587","chat.tab.fork":"\u6D3E\u751F\u5F53\u524D\u5BF9\u8BDD\u5230\u65B0\u6807\u7B7E\u9875\uFF08\u540C\u4E00 Task \u76EE\u5F55\uFF0C\u5E26\u4E0A\u5DF2\u6709\u5BF9\u8BDD\uFF09","chat.fork.new":"\u5FEB\u901F\u6D3E\u751F\uFF1A\u4EE5\u5F53\u524D\u4ED3\u5E93/\u5206\u652F/\u6A21\u578B\u521B\u5EFA\u5B50\u4EFB\u52A1","chat.tab.close":"\u5173\u95ED\u804A\u5929\u6807\u7B7E\u9875","chat.tab.rename":"\u91CD\u547D\u540D\u5F53\u524D\u804A\u5929\u6807\u7B7E\u9875","chat.tab.cycle-next":"\u4E0B\u4E00\u4E2A\u804A\u5929\u6807\u7B7E\u9875","chat.tab.cycle-prev":"\u4E0A\u4E00\u4E2A\u804A\u5929\u6807\u7B7E\u9875","workspace.split.right":"\u5411\u53F3\u5206\u5C4F","workspace.split.down":"\u5411\u4E0B\u5206\u5C4F","workspace.split.focus-next":"\u805A\u7126\u4E0B\u4E00\u4E2A\u5206\u5C4F","workspace.split.close":"\u5173\u95ED\u5F53\u524D\u5206\u5C4F\uFF08\u672A\u5206\u5C4F\u65F6\u5173\u95ED\u6807\u7B7E\u9875\uFF09","workspace.split.rename":"\u91CD\u547D\u540D\u5F53\u524D\u5206\u5C4F\uFF08\u672A\u5206\u5C4F\u65F6\u91CD\u547D\u540D\u6807\u7B7E\u9875\uFF09","files.nav":"\u4E0A\u4E0B\u79FB\u52A8\u5149\u6807","files.hierarchy":"\u6298\u53E0 / \u5C55\u5F00\u6811\u5C42\u7EA7","files.open":"\u5728\u5DF2\u914D\u7F6E\u7684\u7F16\u8F91\u5668\u4E2D\u6253\u5F00\u6587\u4EF6\uFF08\u652F\u6301\u65F6\u663E\u793A diff\uFF09","files.tab":"\u5207\u6362\u6807\u7B7E\u9875\uFF08\u5FAA\u73AF \u5168\u90E8 / \u53D8\u66F4\uFF09","files.refresh":"\u5237\u65B0","files.scope":"\u5207\u6362\u53D8\u66F4\u8303\u56F4\uFF08\u5DE5\u4F5C\u533A \u2194 \u5206\u652F\u5BF9\u6BD4 base\uFF09","files.diff":"\u5728\u5DE5\u4F5C\u533A\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\u53EA\u8BFB diff","files.openExternal":"\u5728\u7CFB\u7EDF\u9ED8\u8BA4\u5E94\u7528\u4E2D\u6253\u5F00\u6587\u4EF6\uFF08\u97F3\u9891 / \u89C6\u9891 / pdf \u9884\u89C8\uFF09","files.mention":"\u5C06 @<path> \u63D0\u53CA\u6CE8\u5165\u5F15\u64CE\u9762\u677F","files.createPR":"\u8BA9 agent \u4ECE\u5F53\u524D\u4EFB\u52A1\u521B\u5EFA PR","files.fixChecks":"\u8BA9 agent \u4FEE\u590D\u5931\u8D25\u7684 PR \u68C0\u67E5","files.syncBase":"\u628A\u57FA\u7840\u5206\u652F\u5408\u5E76\u8FDB\u8BE5\u4EFB\u52A1\u7684\u5DE5\u4F5C\u6811","diff.review.cursor":"\u5728 diff \u4E2D\u79FB\u52A8\u884C\u5149\u6807","diff.review.range":"\u5728\u5149\u6807\u5904\u5207\u6362\u8303\u56F4\u951A\u70B9","diff.review.note":"\u5728\u5149\u6807\u5904\u6DFB\u52A0\u5BA1\u9605\u5907\u6CE8","diff.review.send":"\u5C06\u6240\u6709\u672A\u53D1\u9001\u7684\u5BA1\u9605\u5907\u6CE8\u53D1\u7ED9\u5F15\u64CE","inbox.nav":"\u5728\u63D0\u9192\u9879\u76EE\u4E4B\u95F4\u79FB\u52A8","inbox.open":"\u6253\u5F00\u9009\u4E2D\u7684\u63D0\u9192\u9879\u76EE","inbox.delete":"\u6E05\u9664\u9009\u4E2D\u7684\u63D0\u9192\u9879\u76EE","terminal.scroll-up":"\u5411\u4E0A\u6EDA\u52A8\u56DE\u6EDA","terminal.scroll-down":"\u5411\u4E0B\u6EDA\u52A8\u56DE\u6EDA","terminal.reset":"\u91CD\u7F6E\u7EC8\u7AEF\u2014\u2014\u5173\u95ED\u5F53\u524D shell \u5E76\u91CD\u65B0\u542F\u52A8","terminal.search":"\u641C\u7D22\u56DE\u6EDA\u7F13\u51B2\u533A","terminal.search.older":"\u56DE\u6EDA\u641C\u7D22\uFF1A\u8DF3\u5230\u66F4\u65E9\u7684\u5339\u914D","terminal.search.newer":"\u56DE\u6EDA\u641C\u7D22\uFF1A\u8DF3\u5230\u66F4\u665A\u7684\u5339\u914D","terminal.search.cancel":"\u5173\u95ED\u56DE\u6EDA\u641C\u7D22\uFF08\u6062\u590D\u539F\u6765\u7684\u6EDA\u52A8\u4F4D\u7F6E\uFF09","dialog.cancel":"\u5173\u95ED\u9876\u5C42\u5BF9\u8BDD\u6846\uFF08esc\uFF09","dialog.newtask.tab.cycle":"\u5207\u6362\u65B0\u5EFA\u4EFB\u52A1\u6807\u7B7E\u9875\uFF08\u73B0\u6709\u4ED3\u5E93 / \u65B0\u4ED3\u5E93\uFF09"}}});var en9,zh9;var init_newTask=__esm(()=>{en9={title:"New task",legend:"enter create \xB7 tab fields \xB7 ctrl+[ ] mode \xB7 ctrl+e engine \xB7 esc cancel",tabs:{existing:"For Existing",clone:"For New Repo",adopt:"Adopt Worktree"},field:{mode:"MODE",engine:"ENGINE",repo:"REPO",fromBranch:"FROM BRANCH",gitUrl:"GIT URL",parentDir:"PARENT DIR",folderName:"FOLDER NAME",baseBranch:"BASE BRANCH",adoptFilter:"FILTER (PATH GLOB)",opens:"OPENS"},intent:{task:"a new task worktree",project:"the project itself"},placeholder:{folderName:"auto from url",adoptFilter:"* \u2014 type e.g. feature-* to narrow"},hint:{modeCycle:"ctrl+[ ]",engineCycle:"ctrl+e",remembered:"(remembered \u2014 next clone defaults to this dir)",currentDir:"(current dir)",noBranchesFound:"(no local branches found \u2014 typed text will be used as ref)",noMatchBranch:"(no match \u2014 typed text will be used as ref)",scanningWorktrees:"scanning worktrees\u2026"},picker:{moreAbove:"\u2191 {count} more",moreBelow:"\u2193 {count} more"},open:{failed:"Couldn't open the project: {error}"},adopt:{repoLine:"repo: {path}",repoNone:"(none)",noUnlinked:"no unlinked worktrees \u2014 every git worktree here is already a task",noMatch:"no worktrees match the filter",hintSelected:"{count} selected \xB7 enter toggles \xB7 ctrl+a all \xB7 Create imports",hintDefault:"enter toggles \xB7 ctrl+a all \xB7 Create imports the highlighted row",summaryAll:"Adopted {count} worktree(s)",summaryPartial:"Adopted {done}/{total} worktrees \u2014 the rest failed (see log)",summaryNone:"Couldn't adopt any worktree: {error}"},clone:{progressFallback:"Cloning\u2026",progressInto:"Cloning into {target}\u2026"},button:{create:"Create",cloning:"Cloning\u2026"},error:{gitUrlRequired:"git URL is required",gitUrlInvalid:"does not look like a git URL: {url}",folderRequired:"folder name is required",folderHasSeparator:"folder name cannot contain path separators",parentRequired:"parent directory is required",parentNotFound:"parent directory does not exist: {path}",parentNotDir:"not a directory: {path}",targetExists:"target already exists: {path}",cloneFailed:"git clone failed: {error}",noAdoptable:"no adoptable worktrees to import",repoAmbiguous:"more than one saved repo is named {name} \u2014 pick the one you mean from the list"}},zh9={title:"\u65B0\u5EFA\u4EFB\u52A1",legend:"enter \u521B\u5EFA \xB7 tab \u5207\u5B57\u6BB5 \xB7 ctrl+[ ] \u5207\u6A21\u5F0F \xB7 ctrl+e \u5F15\u64CE \xB7 esc \u53D6\u6D88",tabs:{existing:"\u5DF2\u6709\u4ED3\u5E93",clone:"\u514B\u9686\u65B0\u4ED3\u5E93",adopt:"\u63A5\u7BA1 Worktree"},field:{mode:"\u6A21\u5F0F",engine:"\u5F15\u64CE",repo:"\u4ED3\u5E93",fromBranch:"\u57FA\u51C6\u5206\u652F",gitUrl:"git \u5730\u5740",parentDir:"\u7236\u76EE\u5F55",folderName:"\u6587\u4EF6\u5939\u540D",baseBranch:"\u57FA\u51C6\u5206\u652F",adoptFilter:"\u8FC7\u6EE4\uFF08\u8DEF\u5F84 glob\uFF09",opens:"\u6253\u5F00"},intent:{task:"\u65B0\u5EFA\u4EFB\u52A1 worktree",project:"\u9879\u76EE\u672C\u8EAB"},placeholder:{folderName:"\u81EA\u52A8\u4ECE\u5730\u5740\u63A8\u5BFC",adoptFilter:"* \u2014 \u8F93\u5165\u5982 feature-* \u6765\u7F29\u5C0F\u8303\u56F4"},hint:{modeCycle:"ctrl+[ ]",engineCycle:"ctrl+e",remembered:"\uFF08\u5DF2\u8BB0\u4F4F \u2014 \u4E0B\u6B21\u514B\u9686\u9ED8\u8BA4\u4F7F\u7528\u6B64\u76EE\u5F55\uFF09",currentDir:"\uFF08\u5F53\u524D\u76EE\u5F55\uFF09",noBranchesFound:"\uFF08\u672A\u627E\u5230\u672C\u5730\u5206\u652F \u2014 \u5C06\u76F4\u63A5\u4F7F\u7528\u8F93\u5165\u6587\u672C\u4F5C\u4E3A ref\uFF09",noMatchBranch:"\uFF08\u65E0\u5339\u914D \u2014 \u5C06\u76F4\u63A5\u4F7F\u7528\u8F93\u5165\u6587\u672C\u4F5C\u4E3A ref\uFF09",scanningWorktrees:"\u6B63\u5728\u626B\u63CF worktree\u2026"},picker:{moreAbove:"\u2191 \u8FD8\u6709 {count} \u9879",moreBelow:"\u2193 \u8FD8\u6709 {count} \u9879"},open:{failed:"\u65E0\u6CD5\u6253\u5F00\u9879\u76EE\uFF1A{error}"},adopt:{repoLine:"\u4ED3\u5E93\uFF1A{path}",repoNone:"\uFF08\u65E0\uFF09",noUnlinked:"\u6CA1\u6709\u672A\u5173\u8054\u7684 worktree \u2014 \u6B64\u4ED3\u5E93\u6240\u6709 git worktree \u5747\u5DF2\u662F\u4EFB\u52A1",noMatch:"\u6CA1\u6709 worktree \u5339\u914D\u6B64\u8FC7\u6EE4\u6761\u4EF6",hintSelected:"\u5DF2\u9009 {count} \u9879 \xB7 enter \u5207\u6362\u9009\u4E2D \xB7 ctrl+a \u5168\u9009 \xB7 \u521B\u5EFA \u5BFC\u5165",hintDefault:"enter \u5207\u6362\u9009\u4E2D \xB7 ctrl+a \u5168\u9009 \xB7 \u521B\u5EFA \u5C06\u5BFC\u5165\u9AD8\u4EAE\u884C",summaryAll:"\u5DF2\u63A5\u7BA1 {count} \u4E2A worktree",summaryPartial:"\u5DF2\u63A5\u7BA1 {done}/{total} \u4E2A worktree \u2014 \u5176\u4F59\u5931\u8D25\uFF08\u8BE6\u89C1\u65E5\u5FD7\uFF09",summaryNone:"\u6CA1\u6709 worktree \u63A5\u7BA1\u6210\u529F\uFF1A{error}"},clone:{progressFallback:"\u514B\u9686\u4E2D\u2026",progressInto:"\u6B63\u5728\u514B\u9686\u5230 {target}\u2026"},button:{create:"\u521B\u5EFA",cloning:"\u514B\u9686\u4E2D\u2026"},error:{gitUrlRequired:"git \u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A",gitUrlInvalid:"\u4E0D\u50CF\u662F\u6709\u6548\u7684 git \u5730\u5740\uFF1A{url}",folderRequired:"\u6587\u4EF6\u5939\u540D\u4E0D\u80FD\u4E3A\u7A7A",folderHasSeparator:"\u6587\u4EF6\u5939\u540D\u4E0D\u80FD\u5305\u542B\u8DEF\u5F84\u5206\u9694\u7B26",parentRequired:"\u7236\u76EE\u5F55\u4E0D\u80FD\u4E3A\u7A7A",parentNotFound:"\u7236\u76EE\u5F55\u4E0D\u5B58\u5728\uFF1A{path}",parentNotDir:"\u4E0D\u662F\u76EE\u5F55\uFF1A{path}",targetExists:"\u76EE\u6807\u8DEF\u5F84\u5DF2\u5B58\u5728\uFF1A{path}",cloneFailed:"git clone \u5931\u8D25\uFF1A{error}",noAdoptable:"\u6CA1\u6709\u53EF\u63A5\u7BA1\u7684 worktree",repoAmbiguous:"\u6709\u591A\u4E2A\u5DF2\u4FDD\u5B58\u4ED3\u5E93\u90FD\u53EB {name} \u2014 \u8BF7\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4F60\u8981\u7684\u90A3\u4E2A"}}});var en10,zh10;var init_onboarding=__esm(()=>{en10={title:"Welcome to Rove",subtitle:"Two quick questions and a quick environment check before your first launch.",completionsQuestion:"Install shell completions for {shell}?",completionsExplain:"Tab-completes rove subcommands. One line is added to your shell config.",skillQuestion:"Install the Rove agent skill?",skillExplain:"Teaches coding agents to drive Rove from the shell via `rove api`.",optionYes:"Yes (recommended)",optionNo:"No",legend:"\u2191\u2193 select \xB7 enter confirm \xB7 q skip setup",keysTitle:"Keyboard basics",keysBare:"Bare keys act in the focused pane \u2014 {nav} moves, {open} opens.",keysOnePress:"A few one-press chords are Rove's own \u2014 {newTab} new tab, {focusNext} next pane.",keysPrefix:"{prefix} opens the command map \u2014 hold it a beat and a guide appears.",keysHelp:"{help} shows the full live reference anytime.",keysLegend:"enter finish",envTitle:"Environment check",envExplain:"Read-only \u2014 what Rove found on this machine:",envReady:"\u2713 You're set \u2014 at least one engine is ready.",envNotReady:"\u2717 No usable engine yet \u2014 Rove needs one to run tasks.",envLegend:"enter continue \xB7 q skip setup",notReadyHeader:"Not ready yet:",appliedCompletions:"\u2713 completions hooked into {path} (takes effect in new shells)",skippedCompletions:"\xB7 completions skipped \u2014 run `{command}` anytime",installingSkill:"installing the Rove agent skill ({command})\u2026",skillFailed:"! skill install failed \u2014 retry with `{command}`",skillNeedsNode:"! agent skill needs `npx` (part of Node.js) \u2014 install Node from https://nodejs.org, then run `{command}`",skippedSkill:"\xB7 agent skill skipped \u2014 run `{command}` anytime",ready:"You're ready to go!",readyHint:"Run `{command}` to launch the TUI."},zh10={title:"\u6B22\u8FCE\u4F7F\u7528 Rove",subtitle:"\u9996\u6B21\u542F\u52A8\u524D\uFF0C\u5148\u56DE\u7B54\u4E24\u4E2A\u5C0F\u95EE\u9898\uFF0C\u518D\u505A\u4E00\u6B21\u73AF\u5883\u68C0\u67E5\u3002",completionsQuestion:"\u4E3A {shell} \u5B89\u88C5 shell \u8865\u5168\u5417\uFF1F",completionsExplain:"\u8BA9 rove \u5B50\u547D\u4EE4\u652F\u6301 Tab \u8865\u5168\uFF0C\u4F1A\u5728\u4F60\u7684 shell \u914D\u7F6E\u91CC\u52A0\u4E00\u884C\u3002",skillQuestion:"\u5B89\u88C5 Rove agent skill \u5417\uFF1F",skillExplain:"\u6559\u4F1A\u7F16\u7801 agent \u901A\u8FC7 `rove api` \u5728\u547D\u4EE4\u884C\u9A71\u52A8 Rove\u3002",optionYes:"\u5B89\u88C5\uFF08\u63A8\u8350\uFF09",optionNo:"\u8DF3\u8FC7",legend:"\u2191\u2193 \u9009\u62E9 \xB7 enter \u786E\u8BA4 \xB7 q \u8DF3\u8FC7\u8BBE\u7F6E",keysTitle:"\u952E\u76D8\u57FA\u7840",keysBare:"\u88F8\u952E\u4F5C\u7528\u4E8E\u5F53\u524D\u805A\u7126\u9762\u677F \u2014 {nav} \u79FB\u52A8\uFF0C{open} \u6253\u5F00\u3002",keysOnePress:"\u5C11\u91CF\u5355\u6B21\u5FEB\u6377\u952E\u5C5E\u4E8E Rove \u81EA\u5DF1 \u2014 {newTab} \u65B0\u6807\u7B7E\u9875\uFF0C{focusNext} \u5207\u6362\u9762\u677F\u3002",keysPrefix:"{prefix} \u6253\u5F00\u547D\u4EE4\u5C42 \u2014 \u6309\u4F4F\u7A0D\u7B49\u4F1A\u51FA\u73B0\u547D\u4EE4\u6307\u5357\u3002",keysHelp:"\u968F\u65F6\u6309 {help} \u67E5\u770B\u5B8C\u6574\u7684\u5B9E\u65F6\u952E\u4F4D\u8868\u3002",keysLegend:"enter \u5B8C\u6210",envTitle:"\u73AF\u5883\u68C0\u67E5",envExplain:"\u53EA\u8BFB\u68C0\u67E5 \u2014 Rove \u5728\u8FD9\u53F0\u673A\u5668\u4E0A\u53D1\u73B0\u4E86\u4EC0\u4E48\uFF1A",envReady:"\u2713 \u4E00\u5207\u5C31\u7EEA \u2014 \u81F3\u5C11\u4E00\u4E2A\u5F15\u64CE\u53EF\u7528\u3002",envNotReady:"\u2717 \u8FD8\u6CA1\u6709\u53EF\u7528\u5F15\u64CE \u2014 Rove \u9700\u8981\u4E00\u4E2A\u5F15\u64CE\u624D\u80FD\u8FD0\u884C\u4EFB\u52A1\u3002",envLegend:"enter \u7EE7\u7EED \xB7 q \u8DF3\u8FC7\u8BBE\u7F6E",notReadyHeader:"\u8FD8\u6CA1\u51C6\u5907\u597D\uFF1A",appliedCompletions:"\u2713 \u8865\u5168\u5DF2\u5199\u5165 {path}\uFF08\u65B0\u5F00\u7684 shell \u751F\u6548\uFF09",skippedCompletions:"\xB7 \u5DF2\u8DF3\u8FC7\u8865\u5168 \u2014 \u4E4B\u540E\u53EF\u968F\u65F6\u8FD0\u884C `{command}`",installingSkill:"\u6B63\u5728\u5B89\u88C5 Rove agent skill\uFF08{command}\uFF09\u2026",skillFailed:"! skill \u5B89\u88C5\u5931\u8D25 \u2014 \u53EF\u7528 `{command}` \u91CD\u8BD5",skillNeedsNode:"! agent skill \u9700\u8981 `npx`\uFF08Node.js \u7684\u4E00\u90E8\u5206\uFF09\u2014 \u8BF7\u4ECE https://nodejs.org \u5B89\u88C5 Node\uFF0C\u7136\u540E\u8FD0\u884C `{command}`",skippedSkill:"\xB7 \u5DF2\u8DF3\u8FC7 agent skill \u2014 \u4E4B\u540E\u53EF\u968F\u65F6\u8FD0\u884C `{command}`",ready:"\u4E00\u5207\u5C31\u7EEA\uFF01",readyHint:"\u8FD0\u884C `{command}` \u542F\u52A8 TUI\u3002"}});var en11,zh11;var init_ops=__esm(()=>{en11={preview:{diffVsHead:"diff vs HEAD",diffVsBase:"diff vs {base}",file:"file",image:"image",binary:"binary file",closeHint:"\xB7 q to close",loading:"loading\u2026",noTextPreview:"no text preview",openHint:"o open in system viewer",review:{noteDialogTitle:"Review note \u2014 {location}",noteFieldLabel:"note",noteSubmitLabel:"add note",notePlaceholder:"what should the agent change here?",count:"{total} notes \xB7 {unsent} unsent",keysHint:"j/k line \xB7 v range \xB7 c note \xB7 x drop \xB7 s send \xB7 r reload",sendNoEngine:"No engine session in this task \u2014 the notes are still unsent. Open one with ctrl+t."}}},zh11={preview:{diffVsHead:"\u4E0E HEAD \u5BF9\u6BD4",diffVsBase:"\u4E0E {base} \u5BF9\u6BD4",file:"\u6587\u4EF6",image:"\u56FE\u7247",binary:"\u4E8C\u8FDB\u5236\u6587\u4EF6",closeHint:"\xB7 q \u5173\u95ED",loading:"\u52A0\u8F7D\u4E2D\u2026",noTextPreview:"\u65E0\u6587\u672C\u9884\u89C8",openHint:"o \u7528\u7CFB\u7EDF\u67E5\u770B\u5668\u6253\u5F00",review:{noteDialogTitle:"\u8BC4\u5BA1\u5907\u6CE8 \u2014 {location}",noteFieldLabel:"\u5907\u6CE8",noteSubmitLabel:"\u6DFB\u52A0\u5907\u6CE8",notePlaceholder:"\u5E0C\u671B agent \u5728\u8FD9\u91CC\u6539\u4EC0\u4E48\uFF1F",count:"{total} \u6761\u5907\u6CE8 \xB7 {unsent} \u6761\u672A\u53D1\u9001",keysHint:"j/k \u884C \xB7 v \u8303\u56F4 \xB7 c \u5907\u6CE8 \xB7 x \u5220\u9664 \xB7 s \u53D1\u9001 \xB7 r \u91CD\u8F7D",sendNoEngine:"\u8FD9\u4E2A\u4EFB\u52A1\u6CA1\u6709\u5F15\u64CE\u4F1A\u8BDD\u2014\u2014\u5907\u6CE8\u4ECD\u672A\u53D1\u9001\u3002\u7528 ctrl+t \u5F00\u4E00\u4E2A\u3002"}}}});var en12,zh12;var init_quickTask=__esm(()=>{en12={title:"Quick task \xB7 {repoLabel}",promptLabel:"PROMPT",promptPlaceholder:"what should this task do?",engineLabel:"ENGINE",branchLabel:"BRANCH",legend:"enter create \xB7 tab fields \xB7 ctrl+e engine \xB7 ctrl+v attach \xB7 esc cancel"},zh12={title:"\u5FEB\u901F\u4EFB\u52A1 \xB7 {repoLabel}",promptLabel:"\u63D0\u793A\u8BCD",promptPlaceholder:"\u8FD9\u4E2A\u4EFB\u52A1\u8981\u505A\u4EC0\u4E48\uFF1F",engineLabel:"\u5F15\u64CE",branchLabel:"\u5206\u652F",legend:"enter \u521B\u5EFA \xB7 tab \u5207\u6362\u5B57\u6BB5 \xB7 ctrl+e \u5F15\u64CE \xB7 ctrl+v \u9644\u4EF6 \xB7 esc \u53D6\u6D88"}});var en13,zh13;var init_settings=__esm(()=>{en13={title:"Settings",esc:"esc",nav:{default:"j/k pick \xB7 h/l switch level \xB7 enter activate \xB7 esc close",feedback:"tab next field \xB7 enter sends on Send \xB7 esc close"},sections:{general:"General",engines:"Engines",plugins:"Plugins",keys:"Keybindings",feedback:"Feedback",dev:"Dev"},general:{usage:"USAGE",theme:"Theme",themeHint:"l to enter list \xB7 j/k to highlight \xB7 enter to apply",language:"Language",languageHint:"Display language for Rove's UI. l to enter list \xB7 j/k to highlight \xB7 enter to apply.",transparent:"Transparent background",transparentHint:"Drops the renderer's bg fill so the host terminal shows through. enter toggles.",on:"[x] on",off:"[ ] off",focusAccent:"Focus accent",focusAccentHint:"Color of focused pane title, \u258C marker, and split borders.",accentPrimary:"Primary (brand accent)",accentSuccess:"Success (legacy green)",accentInfo:"Info (cool blue)",appearance:"Appearance",appearanceHint:"How split panes draw.",splitBox:"Box frames",splitLine:"Divider line",notifications:"Notifications",notificationsHint:"When a background tab finishes or pauses on an approval.",toast:"Toast",toastHint:"bottom-right popup",sound:"Sound",soundHint:"bell + chime + an OSC 9 desktop notification (rides SSH)",crossTask:"Cross-task",crossTaskHint:"also for a task you switched away from",keyHints:"Keyboard hints",keyHintsHint:"The status-bar reminder and the first-use hints in the sidebar and files panes.",keyHintsShow:"Show keyboard hints",keyHintsShowHint:"re-enabling relights hints dismissed by use",zen:"Zen mode",zenHint:"The `zen` chip and `prefix`+z hide Files, keeping the Tasks rail and workspace.",zenDefaultOn:"Start in zen mode",zenKeepTasks:"Keep Tasks pane",zenKeepTasksHint:"legacy \u2014 no layout effect today",editor:"Editor",editorHint:"What enter opens a file with in the file tree \u2014 diff mode when the editor supports it, the read-only preview when it isn't installed.",editorRow:"editor: < {kind} >",editorRowHint:"auto follows $VISUAL / $EDITOR, else nvim / vim / emacs / nano",editorCustom:"custom: {cmd}",editorCustomUnset:"(unset \u2014 enter to edit)",worktree:"Worktree location",worktreeHint:"Where new task worktrees are created. New tasks only.",worktreeBase:"location: < {kind} >",worktreeBaseHint:"custom takes `~`, a relative path, or a leading `$project_dir`",worktreeKindDefault:"default ~/.rove/worktrees",worktreeKindNext:"next to project",worktreeKindCustom:"custom",worktreeCustom:"custom: {path}",worktreeCustomUnset:"(unset \u2014 enter to edit)",worktreeBaseTitle:"Custom worktree location (blank = default; $project_dir = project root)",worktreeBaseField:"PATH",terminal:"Terminal",terminalHint:"Applies to terminals opened after the change.",scrollbackRow:"scrollback: {rows} rows",scrollbackRowHint:"100\u2013100000 \xB7 larger costs proportionally more CPU per redraw",scrollbackTitle:"Terminal scrollback rows (100\u2013100000)",scrollbackField:"ROWS",scrollbackInvalidTitle:"Not a number",scrollbackInvalidBody:"Scrollback must be a number of rows (e.g. 1000). Keeping the previous setting.",tabStripRow:"tab strip: {mode}",tabStripMode:{never:"off \u2014 the sidebar tree lists tabs",multipleOnly:"only with 2+ tabs",always:"always"}},engines:{title:"Engines",hint:"Every engine Rove can launch, with what detection found under each one: where its binary is, and for the engines with an account detector whether you are logged in. [x] = offered when picking an engine for a task; (\u25CF) = the global default (per-project picks, e.g. Ctrl+Shift+T, override it) \u2014 click either, or use the keys below. Override a launch command when the binary isn't on PATH or to pass default flags. space on/off \xB7 enter edit command \xB7 r rename \xB7 x reset/remove \xB7 d set default.",customTag:" (custom)",addEngine:"+ Add engine"},accounts:{checking:"Checking\u2026",notLoggedIn:"\u25CB Not logged in",loggedIn:"\u25CF Logged in: {email}",apiKeyConfigured:"\u25CF API key configured",chatgptLogin:"\u25CF ChatGPT login: {email}",tokenConfigured:"\u25CF Token configured ({source})",detected:"\u25CF Login detected"},plugins:{title:"Plugins",hint:"Plugins registered in ~/.kobe/plugins.json. enter (or click) toggles one on or off \u2014 the daemon watches the file, so the change applies live. Rows indented under a plugin are the settings it declares; enter edits one, and the value reaches the plugin on its next run. Install and remove them from the shell: `rove plugin install <owner/repo>`, `rove plugin link <dir>`.",empty:"No plugins registered. Install one with `rove plugin install <owner/repo>` \u2014 browse the `rove-plugin` topic on GitHub.",sourceLink:"linked {path}",sourceGithub:"{spec}",updateAvailable:"update available \u2014 rove plugin update",declares:"{actions} actions \xB7 {events} events \xB7 {panes} panes",declaresWithEngines:"{actions} actions \xB7 {events} events \xB7 {panes} panes \xB7 {engines} engines",manifestUnreadable:"manifest unreadable",unsupportedPlatform:"\xB7 not supported on this platform",noHooks:"\xB7 no hooks declared",lastRun:"\xB7 last run {label} {status} {ago} ago",neverRun:"\xB7 never run",runOk:"ok",runFailed:"failed to start",runExit:"exit {code}",settingUnset:"(unset \u2014 enter to edit)",settingInvalidTitle:"Not a number",settingInvalidBody:"{label} only accepts a number. Keeping the previous value."},keybindings:{title:"Keybindings",hint:"Rebind direct and prefix chords in your own YAML file; changes reload live. Press F1 anywhere for the live keymap with every binding id.",configFile:"Config file",notCreated:" (not created yet)",prefixTitle:"Command layer ({prefix})",prefixHint:"Bare keys act in the focused pane; a small one-press set covers frequent Rove actions; {prefix} opens the command layer ({timeout}ms second-stroke window). Prefix bindings keep their pane scope and modal rules.",tapPresentation:"Prefix tap",tapPresentationHint:"Choose whether the complete guide also marks controls already on screen.",tapPresentationLocal:"On-screen entries + complete guide (default)",tapPresentationGuide:"Complete guide only",prefixDisabled:"disabled",fixed:"Fixed (not rebindable): {ids}.",createHint:"No overrides file yet. Rove can write one for you, fully commented \u2014 nothing is rebound until you uncomment a line.",createFile:"[enter] Create keybindings.yaml",overridesApplied:"Overrides applied",none:"none",unbound:"(unbound)",defaultKeys:"default: {keys}",warnings:"Warnings"},feedback:{title:"Feedback",hint:"Sends a GitHub Discussion to the Rove repo through `gh`. Requires `gh auth login`; category defaults to Feedback.",titleLabel:"title",titlePlaceholder:"Short summary",descriptionLabel:"description",descriptionPlaceholder:"What happened? (enter for a new line \xB7 tab to Send)",send:"[enter] Send to GitHub Discussions"},dev:{reset:"Reset UI state",resetHint:"Clears ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove \u2014 relaunch to start fresh. Working session list, pane sizes, theme, model picks all reset. Worktrees on disk and engine session history are not touched.",resetButton:"[enter] Reset",restart:"Restart backend",restartHint:"Stops the Rove daemon and quits this Rove window so the next launch spawns a fresh daemon \u2014 picks up daemon / orchestrator / engine edits without a process kill. Other attached Rove windows will lose their connection too.",restartButton:"[enter] Restart",doctorHint:"Daemon wedged or unresponsive? From a shell, run `rove daemon restart`, then relaunch Rove. Hosted engine sessions stay alive across a daemon restart.",experimental:"Experimental",remoteHint:"Remote projects (SSH): register a project whose git worktrees live on another host, driven from this local Rove. Unfinished \u2014 Hosted PTY engine launch over SSH is not implemented, and file/diff panes still degrade. Enables `rove add --remote`.",remote:"Remote projects",autoStatusHint:"Auto status flow: a backlog task moves to in_progress when its engine starts a turn, and new sessions get a system-prompt note telling the agent to set in_review itself when the work is done. Never touches done/canceled.",autoStatus:"Auto status flow",dispatcherHint:"Field-notes dispatcher: task sessions file one-line gotchas (`rove api note`), the daemon forwards each to the repo's main session, and that session relays them to the in-flight tasks that benefit (`rove api dispatch`). Web-hosted sessions receive the relays today.",dispatcher:"Field-notes dispatcher",composerGateHint:"Before pasting a peer/API prompt into a running engine, Rove reads that session's screen and holds the message if the composer already has text in it. The check knows each engine's CURRENT layout, so a vendor redesign can make it wrong \u2014 turn it off if messages are being held over composers you can see are empty. The separate recent-keystroke guard stays on either way, so a composer you are typing into now is still protected.",composerGate:"Check the composer before delivering"}},zh13={title:"\u8BBE\u7F6E",esc:"esc",nav:{default:"j/k \u9009\u62E9 \xB7 h/l \u5207\u6362\u5C42\u7EA7 \xB7 enter \u786E\u8BA4 \xB7 esc \u5173\u95ED",feedback:"tab \u4E0B\u4E00\u9879 \xB7 enter \u5728\u53D1\u9001\u9879\u53D1\u9001 \xB7 esc \u5173\u95ED"},sections:{general:"\u901A\u7528",engines:"\u5F15\u64CE",plugins:"\u63D2\u4EF6",keys:"\u5FEB\u6377\u952E",feedback:"\u53CD\u9988",dev:"\u5F00\u53D1"},general:{usage:"\u7528\u91CF",theme:"\u4E3B\u9898",themeHint:"l \u8FDB\u5165\u5217\u8868 \xB7 j/k \u9AD8\u4EAE \xB7 enter \u5E94\u7528",language:"\u8BED\u8A00",languageHint:"Rove \u754C\u9762\u7684\u663E\u793A\u8BED\u8A00\u3002l \u8FDB\u5165\u5217\u8868 \xB7 j/k \u9AD8\u4EAE \xB7 enter \u5E94\u7528\u3002",transparent:"\u900F\u660E\u80CC\u666F",transparentHint:"\u53BB\u6389\u6E32\u67D3\u5668\u7684\u80CC\u666F\u586B\u5145\uFF0C\u8BA9\u5BBF\u4E3B\u7EC8\u7AEF\u900F\u51FA\u6765\u3002\u6309 enter \u5207\u6362\u3002",on:"[x] \u5F00",off:"[ ] \u5173",focusAccent:"\u805A\u7126\u5F3A\u8C03\u8272",focusAccentHint:"\u805A\u7126\u9762\u677F\u6807\u9898\u3001\u258C \u6807\u8BB0\u548C\u5206\u9694\u8FB9\u6846\u7684\u989C\u8272\u3002",accentPrimary:"\u4E3B\u8272\uFF08\u54C1\u724C\u5F3A\u8C03\u8272\uFF09",accentSuccess:"\u6210\u529F\u8272\uFF08\u4F20\u7EDF\u7EFF\uFF09",accentInfo:"\u4FE1\u606F\u8272\uFF08\u51B7\u84DD\uFF09",appearance:"\u5916\u89C2",appearanceHint:"\u5206\u5C4F\u9762\u677F\u600E\u4E48\u753B\u8FB9\u3002",splitBox:"\u65B9\u6846\u8FB9\u6846",splitLine:"\u5355\u7EBF\u5206\u9694",notifications:"\u901A\u77E5",notificationsHint:"\u540E\u53F0\u6807\u7B7E\u5B8C\u6210\u6216\u5728\u5BA1\u6279\u5904\u6682\u505C\u65F6\u89E6\u53D1\u3002",toast:"Toast \u5F39\u7A97",toastHint:"\u53F3\u4E0B\u89D2\u5F39\u7A97",sound:"\u58F0\u97F3",soundHint:"\u54CD\u94C3 + \u63D0\u793A\u97F3 + OSC 9 \u684C\u9762\u901A\u77E5\uFF08\u7ECF SSH \u76F4\u8FBE\u672C\u5730\uFF09",crossTask:"\u8DE8\u4EFB\u52A1",crossTaskHint:"\u4F60\u5DF2\u5207\u8D70\u7684\u4EFB\u52A1\u4E5F\u901A\u77E5",keyHints:"\u952E\u76D8\u63D0\u793A",keyHintsHint:"\u72B6\u6001\u680F\u63D0\u9192\uFF0C\u4EE5\u53CA\u4FA7\u680F\u548C\u6587\u4EF6\u9762\u677F\u7684\u9996\u7528\u63D0\u793A\u3002",keyHintsShow:"\u663E\u793A\u952E\u76D8\u63D0\u793A",keyHintsShowHint:"\u91CD\u65B0\u5F00\u542F\u4F1A\u70B9\u4EAE\u5DF2\u56E0\u4F7F\u7528\u800C\u7184\u706D\u7684\u63D0\u793A",zen:"\u7985\u6A21\u5F0F",zenHint:"`zen` \u6807\u8BB0\u548C `prefix`+z \u9690\u85CF Files\uFF0C\u4FDD\u7559 Tasks \u4FA7\u680F\u4E0E workspace\u3002",zenDefaultOn:"\u542F\u52A8\u5373\u8FDB\u5165\u7985\u6A21\u5F0F",zenKeepTasks:"\u4FDD\u7559 Tasks \u9762\u677F",zenKeepTasksHint:"\u65E7\u8BBE\u7F6E \u2014 \u5F53\u524D\u4E0D\u6539\u53D8\u5E03\u5C40",editor:"\u7F16\u8F91\u5668",editorHint:"\u6587\u4EF6\u6811\u91CC\u6309 enter \u7528\u4EC0\u4E48\u6253\u5F00\u6587\u4EF6\u2014\u2014\u652F\u6301\u65F6\u8D70\u7F16\u8F91\u5668 diff \u6A21\u5F0F\uFF0C\u672A\u5B89\u88C5\u65F6\u56DE\u9000\u5230\u53EA\u8BFB\u9884\u89C8\u3002",editorRow:"\u7F16\u8F91\u5668: < {kind} >",editorRowHint:"auto \u8DDF\u968F $VISUAL / $EDITOR\uFF0C\u5426\u5219 nvim / vim / emacs / nano",editorCustom:"\u81EA\u5B9A\u4E49: {cmd}",editorCustomUnset:"(\u672A\u8BBE\u7F6E \u2014 enter \u7F16\u8F91)",worktree:"\u5DE5\u4F5C\u6811\u4F4D\u7F6E",worktreeHint:"\u65B0\u4EFB\u52A1\u5DE5\u4F5C\u6811\u7684\u521B\u5EFA\u4F4D\u7F6E\u3002\u4EC5\u5BF9\u65B0\u4EFB\u52A1\u751F\u6548\u3002",worktreeBase:"\u4F4D\u7F6E: < {kind} >",worktreeBaseHint:"\u81EA\u5B9A\u4E49\u53EF\u586B `~`\u3001\u76F8\u5BF9\u8DEF\u5F84\u6216\u4EE5 `$project_dir` \u5F00\u5934",worktreeKindDefault:"\u9ED8\u8BA4 ~/.rove/worktrees",worktreeKindNext:"\u9879\u76EE\u65C1\u8FB9",worktreeKindCustom:"\u81EA\u5B9A\u4E49",worktreeCustom:"\u81EA\u5B9A\u4E49: {path}",worktreeCustomUnset:"(\u672A\u8BBE\u7F6E \u2014 enter \u7F16\u8F91)",worktreeBaseTitle:"\u81EA\u5B9A\u4E49\u5DE5\u4F5C\u6811\u4F4D\u7F6E\uFF08\u7559\u7A7A = \u9ED8\u8BA4\uFF1B$project_dir = \u9879\u76EE\u6839\u76EE\u5F55\uFF09",worktreeBaseField:"\u8DEF\u5F84",terminal:"\u7EC8\u7AEF",terminalHint:"\u5BF9\u4FEE\u6539\u540E\u65B0\u6253\u5F00\u7684\u7EC8\u7AEF\u751F\u6548\u3002",scrollbackRow:"\u56DE\u6EDA\u884C\u6570: {rows} \u884C",scrollbackRowHint:"100\u2013100000 \xB7 \u8C03\u5927\u4F1A\u6309\u6BD4\u4F8B\u589E\u52A0\u6BCF\u6B21\u91CD\u7ED8\u7684 CPU",scrollbackTitle:"\u7EC8\u7AEF\u56DE\u6EDA\u884C\u6570\uFF08100\u2013100000\uFF09",scrollbackField:"\u884C\u6570",scrollbackInvalidTitle:"\u4E0D\u662F\u6570\u5B57",scrollbackInvalidBody:"\u56DE\u6EDA\u884C\u6570\u5FC5\u987B\u662F\u6570\u5B57\uFF08\u5982 1000\uFF09\u3002\u4FDD\u7559\u539F\u8BBE\u7F6E\u3002",tabStripRow:"\u6807\u7B7E\u680F: {mode}",tabStripMode:{never:"\u5173\u95ED \u2014 \u6807\u7B7E\u5728\u5DE6\u4FA7\u6811\u91CC",multipleOnly:"\u4EC5 2 \u4E2A\u4EE5\u4E0A\u6807\u7B7E\u65F6\u663E\u793A",always:"\u59CB\u7EC8\u663E\u793A"}},engines:{title:"\u5F15\u64CE",hint:"Rove \u80FD\u542F\u52A8\u7684\u6240\u6709\u5F15\u64CE\uFF0C\u6BCF\u4E2A\u4E0B\u9762\u8DDF\u7740\u672C\u5730\u63A2\u6D4B\u5230\u7684\u60C5\u51B5\uFF1A\u4E8C\u8FDB\u5236\u5728\u54EA\uFF0C\u4EE5\u53CA\u5BF9\u6709\u8D26\u6237\u63A2\u6D4B\u5668\u7684\u5F15\u64CE\u662F\u5426\u5DF2\u767B\u5F55\u3002[x] = \u4E3A\u4EFB\u52A1\u9009\u5F15\u64CE\u65F6\u4F1A\u5217\u51FA\u5B83\uFF1B(\u25CF) = \u5168\u5C40\u9ED8\u8BA4\u5F15\u64CE\uFF08\u5404\u9879\u76EE\u81EA\u5DF1\u7684\u9009\u62E9\u4F1A\u8986\u76D6\u5B83\uFF0C\u5982 Ctrl+Shift+T\uFF09\u2014\u2014\u4E24\u8005\u90FD\u53EF\u76F4\u63A5\u70B9\uFF0C\u4E5F\u53EF\u7528\u4E0B\u9762\u7684\u6309\u952E\u3002\u4E8C\u8FDB\u5236\u4E0D\u5728 PATH \u4E0A\u3001\u6216\u8981\u4F20\u9ED8\u8BA4\u53C2\u6570\u65F6\uFF0C\u8986\u76D6\u5B83\u7684\u542F\u52A8\u547D\u4EE4\u3002space \u5F00/\u5173 \xB7 enter \u7F16\u8F91\u547D\u4EE4 \xB7 r \u91CD\u547D\u540D \xB7 x \u91CD\u7F6E/\u79FB\u9664 \xB7 d \u8BBE\u4E3A\u9ED8\u8BA4\u3002",customTag:" (\u81EA\u5B9A\u4E49)",addEngine:"+ \u6DFB\u52A0\u5F15\u64CE"},accounts:{checking:"\u68C0\u67E5\u4E2D\u2026",notLoggedIn:"\u25CB \u672A\u767B\u5F55",loggedIn:"\u25CF \u5DF2\u767B\u5F55: {email}",apiKeyConfigured:"\u25CF \u5DF2\u914D\u7F6E API key",chatgptLogin:"\u25CF ChatGPT \u767B\u5F55: {email}",tokenConfigured:"\u25CF \u5DF2\u914D\u7F6E Token ({source})",detected:"\u25CF \u68C0\u6D4B\u5230\u767B\u5F55"},plugins:{title:"\u63D2\u4EF6",hint:"\u5728 ~/.kobe/plugins.json \u91CC\u6CE8\u518C\u7684\u63D2\u4EF6\u3002enter\uFF08\u6216\u70B9\u51FB\uFF09\u5207\u6362\u542F\u7528/\u7981\u7528\u2014\u2014daemon \u76D1\u542C\u8BE5\u6587\u4EF6\uFF0C\u6539\u52A8\u5B9E\u65F6\u751F\u6548\u3002\u63D2\u4EF6\u4E0B\u65B9\u7F29\u8FDB\u7684\u884C\u662F\u5B83\u58F0\u660E\u7684\u8BBE\u7F6E\u9879\uFF0Center \u7F16\u8F91\uFF0C\u65B0\u503C\u5728\u63D2\u4EF6\u4E0B\u6B21\u8FD0\u884C\u65F6\u751F\u6548\u3002\u5B89\u88C5\u4E0E\u79FB\u9664\u5728 shell \u91CC\u505A\uFF1A`rove plugin install <owner/repo>`\u3001`rove plugin link <dir>`\u3002",empty:"\u5C1A\u672A\u6CE8\u518C\u4EFB\u4F55\u63D2\u4EF6\u3002\u7528 `rove plugin install <owner/repo>` \u5B89\u88C5\u4E00\u4E2A\u2014\u2014\u53EF\u5728 GitHub \u7684 `rove-plugin` \u8BDD\u9898\u4E0B\u6D4F\u89C8\u3002",sourceLink:"\u672C\u5730\u94FE\u63A5 {path}",sourceGithub:"{spec}",updateAvailable:"\u6709\u65B0\u7248\u672C \u2014 rove plugin update",declares:"{actions} \u4E2A\u52A8\u4F5C \xB7 {events} \u4E2A\u4E8B\u4EF6 \xB7 {panes} \u4E2A\u9762\u677F",declaresWithEngines:"{actions} \u4E2A\u52A8\u4F5C \xB7 {events} \u4E2A\u4E8B\u4EF6 \xB7 {panes} \u4E2A\u9762\u677F \xB7 {engines} \u4E2A\u5F15\u64CE",manifestUnreadable:"manifest \u65E0\u6CD5\u89E3\u6790",unsupportedPlatform:"\xB7 \u4E0D\u652F\u6301\u5F53\u524D\u5E73\u53F0",noHooks:"\xB7 \u672A\u58F0\u660E\u94A9\u5B50",lastRun:"\xB7 \u4E0A\u6B21\u8FD0\u884C {label} {status} {ago}\u524D",neverRun:"\xB7 \u5C1A\u672A\u8FD0\u884C\u8FC7",runOk:"\u6210\u529F",runFailed:"\u542F\u52A8\u5931\u8D25",runExit:"\u9000\u51FA\u7801 {code}",settingUnset:"(\u672A\u8BBE\u7F6E \u2014 enter \u7F16\u8F91)",settingInvalidTitle:"\u4E0D\u662F\u6570\u5B57",settingInvalidBody:"{label} \u53EA\u63A5\u53D7\u6570\u5B57\uFF0C\u4FDD\u7559\u539F\u503C\u3002"},keybindings:{title:"\u5FEB\u6377\u952E",hint:"\u5728\u4F60\u81EA\u5DF1\u7684 YAML \u6587\u4EF6\u91CC\u91CD\u7ED1\u5B9A\u76F4\u63A5\u6309\u952E\u548C prefix \u7EC4\u5408\uFF1B\u4FEE\u6539\u4F1A\u5B9E\u65F6\u52A0\u8F7D\u3002\u4EFB\u610F\u4F4D\u7F6E\u6309 F1 \u67E5\u770B\u5E26\u6BCF\u4E2A\u7ED1\u5B9A id \u7684\u5B9E\u65F6\u952E\u4F4D\u8868\u3002",configFile:"\u914D\u7F6E\u6587\u4EF6",notCreated:" (\u5C1A\u672A\u521B\u5EFA)",prefixTitle:"\u547D\u4EE4\u5C42\uFF08{prefix}\uFF09",prefixHint:"\u88F8\u952E\u4F5C\u7528\u4E8E\u5F53\u524D\u805A\u7126\u9762\u677F\uFF1B\u5C11\u91CF\u5355\u6B21\u5FEB\u6377\u952E\u8986\u76D6\u9AD8\u9891 Rove \u64CD\u4F5C\uFF1B{prefix} \u6253\u5F00\u547D\u4EE4\u5C42\uFF08\u7B2C\u4E8C\u51FB\u7A97\u53E3 {timeout}ms\uFF09\u3002Prefix \u7ED1\u5B9A\u4FDD\u6301\u539F\u6709\u7684\u9762\u677F\u4F5C\u7528\u57DF\u548C modal \u89C4\u5219\u3002",tapPresentation:"\u70B9\u6309 Prefix",tapPresentationHint:"\u9009\u62E9\u5B8C\u6574\u6307\u5357\u662F\u5426\u540C\u65F6\u6807\u8BB0\u5F53\u524D\u5C4F\u5E55\u4E0A\u7684\u5165\u53E3\u3002",tapPresentationLocal:"\u5C4F\u5E55\u5165\u53E3 + \u5B8C\u6574\u6307\u5357\uFF08\u9ED8\u8BA4\uFF09",tapPresentationGuide:"\u4EC5\u5B8C\u6574\u6307\u5357",prefixDisabled:"\u5DF2\u7981\u7528",fixed:"\u56FA\u5B9A\uFF08\u4E0D\u53EF\u91CD\u7ED1\u5B9A\uFF09\uFF1A{ids}\u3002",createHint:"\u8FD8\u6CA1\u6709\u8986\u76D6\u6587\u4EF6\u3002Rove \u53EF\u4EE5\u5E2E\u4F60\u5199\u4E00\u4EFD\u5E26\u5B8C\u6574\u6CE8\u91CA\u7684\u2014\u2014\u5728\u4F60\u53D6\u6D88\u6CE8\u91CA\u4E4B\u524D\u4E0D\u4F1A\u6539\u52A8\u4EFB\u4F55\u6309\u952E\u3002",createFile:"[enter] \u521B\u5EFA keybindings.yaml",overridesApplied:"\u5DF2\u5E94\u7528\u7684\u8986\u76D6",none:"\u65E0",unbound:"(\u5DF2\u89E3\u7ED1)",defaultKeys:"\u9ED8\u8BA4: {keys}",warnings:"\u8B66\u544A"},feedback:{title:"\u53CD\u9988",hint:"\u901A\u8FC7 `gh` \u5411 Rove \u4ED3\u5E93\u53D1\u4E00\u6761 GitHub Discussion\u3002\u9700\u8981 `gh auth login`\uFF1B\u5206\u7C7B\u9ED8\u8BA4\u4E3A Feedback\u3002",titleLabel:"\u6807\u9898",titlePlaceholder:"\u7B80\u77ED\u6982\u62EC",descriptionLabel:"\u63CF\u8FF0",descriptionPlaceholder:"\u53D1\u751F\u4E86\u4EC0\u4E48\uFF1F(enter \u6362\u884C \xB7 tab \u8DF3\u5230\u53D1\u9001)",send:"[enter] \u53D1\u9001\u5230 GitHub Discussions"},dev:{reset:"\u91CD\u7F6E UI \u72B6\u6001",resetHint:"\u6E05\u7A7A ~/.config/rove/state.json \u548C ~/.rove/tasks.json\uFF0C\u7136\u540E\u9000\u51FA Rove\u2014\u2014\u91CD\u65B0\u542F\u52A8\u5373\u53EF\u4ECE\u5934\u5F00\u59CB\u3002\u5DE5\u4F5C\u4F1A\u8BDD\u5217\u8868\u3001\u9762\u677F\u5C3A\u5BF8\u3001\u4E3B\u9898\u3001\u6A21\u578B\u9009\u62E9\u90FD\u4F1A\u91CD\u7F6E\u3002\u78C1\u76D8\u4E0A\u7684 worktree \u548C\u5F15\u64CE\u4F1A\u8BDD\u5386\u53F2\u4E0D\u53D7\u5F71\u54CD\u3002",resetButton:"[enter] \u91CD\u7F6E",restart:"\u91CD\u542F\u540E\u7AEF",restartHint:"\u505C\u6B62 Rove daemon \u5E76\u9000\u51FA\u5F53\u524D Rove \u7A97\u53E3\uFF0C\u4E0B\u6B21\u542F\u52A8\u4F1A\u62C9\u8D77\u4E00\u4E2A\u5168\u65B0\u7684 daemon\u2014\u2014\u65E0\u9700\u6740\u8FDB\u7A0B\u5373\u53EF\u5E94\u7528 daemon / orchestrator / engine \u7684\u6539\u52A8\u3002\u5176\u4ED6\u5DF2\u8FDE\u63A5\u7684 Rove \u7A97\u53E3\u4E5F\u4F1A\u65AD\u5F00\u8FDE\u63A5\u3002",restartButton:"[enter] \u91CD\u542F",doctorHint:"daemon \u5361\u4F4F\u6216\u65E0\u54CD\u5E94\uFF1F\u5728 shell \u91CC\u8FD0\u884C `rove daemon restart`\uFF0C\u7136\u540E\u91CD\u65B0\u542F\u52A8 Rove\u3002Hosted PTY \u5F15\u64CE\u4F1A\u8BDD\u4E0D\u4F1A\u56E0 daemon \u91CD\u542F\u800C\u9000\u51FA\u3002",experimental:"\u5B9E\u9A8C\u6027",remoteHint:"\u8FDC\u7A0B\u9879\u76EE\uFF08SSH\uFF09\uFF1A\u6CE8\u518C\u4E00\u4E2A git worktree + \u5F15\u64CE\u90FD\u901A\u8FC7 SSH \u8DD1\u5728\u53E6\u4E00\u53F0\u4E3B\u673A\u4E0A\u3001\u7531\u672C\u5730 Rove \u9A71\u52A8\u7684\u9879\u76EE\u3002\u5C1A\u672A\u5B8C\u6210\u2014\u2014\u6587\u4EF6/diff \u9762\u677F\u5BF9\u8FDC\u7A0B\u4ECD\u4F1A\u964D\u7EA7\u3002\u542F\u7528 `rove add --remote`\u3002",remote:"\u8FDC\u7A0B\u9879\u76EE",autoStatusHint:"\u81EA\u52A8\u72B6\u6001\u6D41\u8F6C\uFF1Abacklog \u4EFB\u52A1\u5728\u5176\u5F15\u64CE\u5F00\u59CB\u4E00\u8F6E\u65F6\u79FB\u5230 in_progress\uFF0C\u65B0\u4F1A\u8BDD\u4F1A\u62FF\u5230\u4E00\u6761\u7CFB\u7EDF\u63D0\u793A\uFF0C\u544A\u8BC9 agent \u5B8C\u6210\u540E\u81EA\u884C\u8BBE\u4E3A in_review\u3002\u7EDD\u4E0D\u89E6\u78B0 done/canceled\u3002",autoStatus:"\u81EA\u52A8\u72B6\u6001\u6D41\u8F6C",dispatcherHint:"\u73B0\u573A\u7B14\u8BB0\u8C03\u5EA6\u5668\uFF1A\u4EFB\u52A1\u4F1A\u8BDD\u63D0\u4EA4\u4E00\u884C\u7ECF\u9A8C\uFF08`rove api note`\uFF09\uFF0Cdaemon \u5C06\u6BCF\u6761\u8F6C\u53D1\u7ED9\u4ED3\u5E93\u7684\u4E3B\u4F1A\u8BDD\uFF0C\u4E3B\u4F1A\u8BDD\u518D\u628A\u5B83\u4EEC\u8F6C\u8FBE\u7ED9\u80FD\u53D7\u76CA\u7684\u8FDB\u884C\u4E2D\u4EFB\u52A1\uFF08`rove api dispatch`\uFF09\u3002\u76EE\u524D\u7531 Web \u6258\u7BA1\u7684\u4F1A\u8BDD\u4F1A\u6536\u5230\u8F6C\u8FBE\u3002",dispatcher:"\u73B0\u573A\u7B14\u8BB0\u8C03\u5EA6\u5668",composerGateHint:"\u628A peer/API \u7684\u6D88\u606F\u7C98\u8FDB\u8FD0\u884C\u4E2D\u7684\u5F15\u64CE\u4E4B\u524D,Rove \u4F1A\u8BFB\u4E00\u904D\u90A3\u4E2A\u4F1A\u8BDD\u7684\u5C4F\u5E55,\u53D1\u73B0\u8F93\u5165\u6846\u91CC\u5DF2\u7ECF\u6709\u5B57\u5C31\u5148\u6263\u4F4F\u4E0D\u53D1\u3002\u8FD9\u4E2A\u5224\u65AD\u4F9D\u8D56\u5F15\u64CE\u5F53\u524D\u7684\u754C\u9762\u5E03\u5C40,\u6240\u4EE5\u5382\u5546\u6539\u7248\u53EF\u80FD\u8BA9\u5B83\u5931\u51C6\u2014\u2014\u5982\u679C\u4F60\u770B\u7740\u8F93\u5165\u6846\u660E\u660E\u662F\u7A7A\u7684\u3001\u6D88\u606F\u5374\u4E00\u76F4\u88AB\u6263\u4F4F,\u5C31\u5173\u6389\u5B83\u3002\u53E6\u4E00\u9053\u300C\u521A\u521A\u6709\u4EBA\u5728\u6253\u5B57\u300D\u7684\u4FDD\u62A4\u59CB\u7EC8\u751F\u6548,\u6B63\u5728\u8F93\u5165\u7684\u8F93\u5165\u6846\u4ECD\u7136\u53D7\u4FDD\u62A4\u3002",composerGate:"\u6295\u9012\u524D\u68C0\u67E5\u8F93\u5165\u6846"}}});var en14,zh14;var init_tasks=__esm(()=>{en14={nav:{kanban:"Kanban",automations:"Routines",issues:"Issues"},header:{scratch:"SCRATCH"},search:{placeholder:"fuzzy filter"},menu:{open:"Open",openTab:"Open tab",closeTab:"Close tab",newChat:"New conversation",newShell:"New shell",newTask:"New task",forgetProject:"Remove project",fieldNotes:"Field notes",rename:"Rename",pin:"Pin",unpin:"Unpin",reorder:"Reorder row",runAgain:"Run again",setStatus:"Set status",copyBranch:"Copy branch name",copyPath:"Copy path",openEditor:"Open in editor",renameBranch:"Rename branch",changeEngine:"Change engine",fixChecks:"Fix failing checks",syncBase:"Sync with base",land:"Land into base branch",delete:"Delete"},status:{backlog:"Backlog",inProgress:"In progress",inReview:"In review",done:"Done",canceled:"Canceled",error:"Error"},setStatus:{title:"Set status",current:"current",footer:"\u2191\u2193 choose \xB7 enter set \xB7 esc cancel"},sync:{done:"Merged {base} into this worktree",alreadyCurrent:"Already up to date with {base}",conflict:"Merge conflict \u2014 resolve then commit: {files}",dirty:"Commit or stash the worktree's changes first, then sync: {files}",failed:"Sync failed: {error}"},changeEngine:{title:"Change engine",current:"current",footer:"\u2191\u2193 choose \xB7 enter set \xB7 esc cancel",effortLabel:"EFFORT",noEffort:"engine default",footerEffort:"\u2191\u2193 engine \xB7 \u2190\u2192 effort \xB7 enter set \xB7 esc cancel"},runAgain:{title:"Run again",source:"Brief from \u201C{title}\u201D",hint:"Runs this brief again in a new task, on its own branch and worktree.",confirm:"Run again",footer:"\u2191\u2193 scroll \xB7 \u2190\u2192 choose \xB7 enter run \xB7 esc cancel"},fieldNotes:{title:"Field notes",empty:"No field notes for this repo yet \u2014 agents file one with `rove api note`.",loading:"Loading\u2026",footer:"\u2191\u2193 scroll \xB7 esc close"},moveChip:" move",recentJump:"Recent: {title}",routinesRow:"{count} routine sessions",empty:{noMatchSearch:"No matching tasks \u2014 esc to clear.",noActiveProject:"No active tasks for this project.",noActive:"No active tasks \u2014 create one above."},activity:{working:"working",rateLimited:"rate limited",permissionNeeded:"needs permission",error:"error",dead:"engine exited"},subtitle:{noTracking:"no activity tracking",materializing:"materializing",deleting:"deleting",deleteFailed:"delete failed"},reBranch:{title:"Set branch",fieldLabel:"branch",hintNoBranches:"(no local branches \u2014 type a new name)",hintNoMatch:"(no match \u2014 enter renames to this branch)",footer:"\u2191\u2193 pick \xB7 enter set \xB7 esc cancel"},toast:{noDaemonWorktree:"No daemon running \u2014 can't create the worktree",noEditor:"No editor found \u2014 set ROVE_OPEN_EDITOR (e.g. 'code', 'cursor', 'nvim')",openWorktreeFailed:"Couldn't open worktree with {label}",worktreeErrorDeleting:"This task is being deleted \u2014 it can't be opened",worktreeErrorNotGit:"This project isn't a git repo yet \u2014 a task needs a git branch. Run `git init` (+ a first commit) in the project, then open the task. Non-git support is coming.",worktreeErrorGeneric:"Couldn't create the worktree: {message}",scratchAdopted:"Adopted into {repo} \u2014 save it as a project from New Task if you want it in the picker",scratchOpenFailed:"Couldn't open a scratch shell: {message}",scratchCloseFailed:"Couldn't close the scratch task: {message}",worktreeGoneTitle:'Worktree for "{title}" is gone',worktreeGoneBody:"Closed {count} tab(s). The branch {branch} is still there \u2014 reopen the task to re-create its worktree.",copiedBranch:"Copied branch {text}",copiedPath:"Copied path {text}"}},zh14={nav:{kanban:"\u770B\u677F",automations:"\u4F8B\u884C\u4EFB\u52A1",issues:"\u8BAE\u9898"},header:{scratch:"\u4E34\u65F6"},search:{placeholder:"\u6A21\u7CCA\u641C\u7D22"},menu:{open:"\u6253\u5F00",openTab:"\u6253\u5F00\u8BE5\u6807\u7B7E\u9875",closeTab:"\u5173\u95ED\u8BE5\u6807\u7B7E\u9875",newChat:"\u65B0\u5EFA\u4F1A\u8BDD",newShell:"\u65B0\u5EFA\u7EC8\u7AEF",newTask:"\u65B0\u5EFA\u4EFB\u52A1",forgetProject:"\u79FB\u9664\u9879\u76EE",fieldNotes:"\u73B0\u573A\u7B14\u8BB0",rename:"\u91CD\u547D\u540D",pin:"\u7F6E\u9876",unpin:"\u53D6\u6D88\u7F6E\u9876",reorder:"\u91CD\u65B0\u6392\u5E8F",runAgain:"\u91CD\u65B0\u8FD0\u884C",setStatus:"\u8BBE\u7F6E\u72B6\u6001",copyBranch:"\u590D\u5236\u5206\u652F\u540D",copyPath:"\u590D\u5236\u8DEF\u5F84",openEditor:"\u5728\u7F16\u8F91\u5668\u4E2D\u6253\u5F00",renameBranch:"\u91CD\u547D\u540D\u5206\u652F",changeEngine:"\u5207\u6362\u5F15\u64CE",fixChecks:"\u4FEE\u590D\u5931\u8D25\u7684\u68C0\u67E5",syncBase:"\u540C\u6B65\u57FA\u7840\u5206\u652F",land:"\u5408\u5165\u57FA\u7840\u5206\u652F",delete:"\u5220\u9664"},status:{backlog:"\u5F85\u529E",inProgress:"\u8FDB\u884C\u4E2D",inReview:"\u5F85\u8BC4\u5BA1",done:"\u5DF2\u5B8C\u6210",canceled:"\u5DF2\u53D6\u6D88",error:"\u51FA\u9519"},setStatus:{title:"\u8BBE\u7F6E\u72B6\u6001",current:"\u5F53\u524D",footer:"\u2191\u2193 \u9009\u62E9 \xB7 enter \u8BBE\u7F6E \xB7 esc \u53D6\u6D88"},sync:{done:"\u5DF2\u628A {base} \u5408\u5E76\u8FDB\u8BE5\u5DE5\u4F5C\u6811",alreadyCurrent:"\u5DF2\u7ECF\u548C {base} \u540C\u6B65",conflict:"\u5408\u5E76\u51B2\u7A81\u2014\u2014\u89E3\u51B3\u540E\u63D0\u4EA4\uFF1A{files}",dirty:"\u8BF7\u5148\u63D0\u4EA4\u6216\u6682\u5B58\u5DE5\u4F5C\u6811\u91CC\u7684\u6539\u52A8\uFF0C\u518D\u540C\u6B65\uFF1A{files}",failed:"\u540C\u6B65\u5931\u8D25\uFF1A{error}"},changeEngine:{title:"\u5207\u6362\u5F15\u64CE",current:"\u5F53\u524D",footer:"\u2191\u2193 \u9009\u62E9 \xB7 enter \u8BBE\u7F6E \xB7 esc \u53D6\u6D88",effortLabel:"\u63A8\u7406\u5F3A\u5EA6",noEffort:"\u5F15\u64CE\u9ED8\u8BA4",footerEffort:"\u2191\u2193 \u5F15\u64CE \xB7 \u2190\u2192 \u5F3A\u5EA6 \xB7 enter \u8BBE\u7F6E \xB7 esc \u53D6\u6D88"},runAgain:{title:"\u91CD\u65B0\u8FD0\u884C",source:"\u6765\u81EA\u4EFB\u52A1\u300C{title}\u300D\u7684\u6307\u4EE4",hint:"\u5728\u65B0\u4EFB\u52A1\u91CC\u91CD\u65B0\u6267\u884C\u8FD9\u6BB5\u6307\u4EE4\uFF0C\u65B0\u4EFB\u52A1\u6709\u81EA\u5DF1\u7684\u5206\u652F\u548C\u5DE5\u4F5C\u6811\u3002",confirm:"\u91CD\u65B0\u8FD0\u884C",footer:"\u2191\u2193 \u6EDA\u52A8 \xB7 \u2190\u2192 \u9009\u62E9 \xB7 enter \u8FD0\u884C \xB7 esc \u53D6\u6D88"},fieldNotes:{title:"\u73B0\u573A\u7B14\u8BB0",empty:"\u8BE5\u4ED3\u5E93\u6682\u65E0\u73B0\u573A\u7B14\u8BB0\u2014\u2014agent \u53EF\u7528 `rove api note` \u8BB0\u5F55\u3002",loading:"\u52A0\u8F7D\u4E2D\u2026",footer:"\u2191\u2193 \u6EDA\u52A8 \xB7 esc \u5173\u95ED"},moveChip:" \u79FB\u52A8",recentJump:"\u6700\u8FD1:{title}",routinesRow:"{count} \u4E2A routine \u4F1A\u8BDD",empty:{noMatchSearch:"\u65E0\u5339\u914D\u4EFB\u52A1\u2014\u2014\u6309 esc \u6E05\u9664\u3002",noActiveProject:"\u8BE5\u9879\u76EE\u6682\u65E0\u6D3B\u8DC3\u4EFB\u52A1\u3002",noActive:"\u6682\u65E0\u6D3B\u8DC3\u4EFB\u52A1\u2014\u2014\u5728\u4E0A\u65B9\u65B0\u5EFA\u3002"},activity:{working:"\u8FD0\u884C\u4E2D",rateLimited:"\u8BF7\u6C42\u53D7\u9650",permissionNeeded:"\u7B49\u5F85\u6388\u6743",error:"\u9519\u8BEF",dead:"\u5F15\u64CE\u5DF2\u9000\u51FA"},subtitle:{noTracking:"\u4E0D\u8DDF\u8E2A\u6D3B\u52A8",materializing:"\u6B63\u5728\u521B\u5EFA worktree",deleting:"\u6B63\u5728\u5220\u9664",deleteFailed:"\u5220\u9664\u5931\u8D25"},reBranch:{title:"\u8BBE\u7F6E\u5206\u652F",fieldLabel:"\u5206\u652F",hintNoBranches:"\uFF08\u6CA1\u6709\u672C\u5730\u5206\u652F\u2014\u2014\u8F93\u5165\u65B0\u540D\u79F0\uFF09",hintNoMatch:"\uFF08\u65E0\u5339\u914D\u2014\u2014\u56DE\u8F66\u5C06\u5206\u652F\u91CD\u547D\u540D\u4E3A\u6B64\u540D\uFF09",footer:"\u2191\u2193 \u9009\u62E9 \xB7 enter \u8BBE\u7F6E \xB7 esc \u53D6\u6D88"},toast:{noDaemonWorktree:"\u5B88\u62A4\u8FDB\u7A0B\u672A\u8FD0\u884C\u2014\u2014\u65E0\u6CD5\u521B\u5EFA worktree",noEditor:"\u672A\u627E\u5230\u7F16\u8F91\u5668\u2014\u2014\u8BF7\u8BBE\u7F6E ROVE_OPEN_EDITOR\uFF08\u5982 'code'\u3001'cursor'\u3001'nvim'\uFF09",openWorktreeFailed:"\u65E0\u6CD5\u7528 {label} \u6253\u5F00 worktree",worktreeErrorDeleting:"\u8BE5\u4EFB\u52A1\u6B63\u5728\u5220\u9664\u4E2D\u2014\u2014\u65E0\u6CD5\u6253\u5F00",worktreeErrorNotGit:"\u8BE5\u9879\u76EE\u5C1A\u975E git \u4ED3\u5E93\u2014\u2014\u4EFB\u52A1\u9700\u8981 git \u5206\u652F\u3002\u8BF7\u5728\u9879\u76EE\u4E2D\u6267\u884C `git init`\uFF08+ \u9996\u6B21\u63D0\u4EA4\uFF09\u540E\u518D\u6253\u5F00\u4EFB\u52A1\u3002\u975E git \u9879\u76EE\u7684\u652F\u6301\u5373\u5C06\u63A8\u51FA\u3002",worktreeErrorGeneric:"\u65E0\u6CD5\u521B\u5EFA worktree\uFF1A{message}",scratchAdopted:"\u5DF2\u5F52\u5165 {repo}\u2014\u2014\u82E5\u8981\u51FA\u73B0\u5728\u9879\u76EE\u9009\u62E9\u5668\u91CC,\u53EF\u5728\u65B0\u5EFA\u4EFB\u52A1\u4E2D\u4FDD\u5B58\u4E3A\u9879\u76EE",scratchOpenFailed:"\u65E0\u6CD5\u6253\u5F00\u4E34\u65F6 Shell:{message}",scratchCloseFailed:"\u65E0\u6CD5\u5173\u95ED\u4E34\u65F6\u4EFB\u52A1:{message}",worktreeGoneTitle:'"{title}" \u7684 worktree \u5DF2\u6D88\u5931',worktreeGoneBody:"\u5DF2\u5173\u95ED {count} \u4E2A\u6807\u7B7E\u9875\u3002\u5206\u652F {branch} \u4ECD\u5728\u2014\u2014\u91CD\u65B0\u6253\u5F00\u8BE5\u4EFB\u52A1\u4F1A\u91CD\u5EFA worktree\u3002",copiedBranch:"\u5DF2\u590D\u5236\u5206\u652F {text}",copiedPath:"\u5DF2\u590D\u5236\u8DEF\u5F84 {text}"}}});var en15,zh15;var init_terminal=__esm(()=>{en15={noTask:"(no task \u2014 press n to create)",exited:"process exited \u2014 F5 restarts it",restoring:"restoring session\u2026",tab:{groupTitle:"group {n}",renameTitle:"Rename tab",renameField:"TAB TITLE",renameSubmit:"rename",chooseEngineHint:"\u2190/\u2192 or h/l choose, enter confirm, esc cancel",newChat:{title:"New conversation",engine:"ENGINE",destLabel:"DESTINATION",destTab:"new tab in this worktree",destFork:"fork a child task (new worktree)",ctxLabel:"CONTEXT",ctxFresh:"fresh conversation",ctxContinue:"continue this conversation",scratchChoice:"scratch shell"},cannotCloseLast:"Cannot close the only tab",tabGone:"That tab is no longer there",nothingToFork:"No conversation in this tab to fork yet",noTranscriptToHandOff:"{engine} keeps no readable transcript to hand over"},split:{renameTitle:"Rename split",renameField:"SPLIT NAME"},scrolledBack:"\u2191 scrolled {lines}L (ctrl+pgdn to follow)",search:{placeholder:"search scrollback \u2014 enter/\u2191 older, \u2193 newer, esc close",position:"{index}/{total}",noMatches:"no matches",unavailable:"this app owns its own scrollback \u2014 nothing local to search (esc)"},unavailable:{shellMissing:"terminal unavailable \u2014 configured shell is not available",spawnFailed:"terminal unavailable \u2014 shell could not start",retry:"F5 tries again"},reset:{title:"Reset terminal?",body:"The running shell will be killed and a fresh one will spawn at the worktree. Any in-flight processes (vim, htop, paused jobs) end immediately."}},zh15={noTask:"\uFF08\u65E0\u4EFB\u52A1 \u2014\u2014 \u6309 n \u521B\u5EFA\uFF09",exited:"\u8FDB\u7A0B\u5DF2\u9000\u51FA \u2014\u2014 \u6309 F5 \u91CD\u542F",restoring:"\u6B63\u5728\u6062\u590D\u4F1A\u8BDD\u2026",tab:{groupTitle:"group {n}",renameTitle:"\u91CD\u547D\u540D\u6807\u7B7E\u9875",renameField:"\u6807\u7B7E\u9875\u540D\u79F0",renameSubmit:"\u91CD\u547D\u540D",chooseEngineHint:"\u2190/\u2192 \u6216 h/l \u9009\u62E9\uFF0Center \u786E\u8BA4\uFF0Cesc \u53D6\u6D88",newChat:{title:"\u65B0\u5EFA\u5BF9\u8BDD",engine:"\u5F15\u64CE",destLabel:"\u843D\u70B9",destTab:"\u672C worktree \u65B0\u6807\u7B7E\u9875",destFork:"fork \u5B50\u4EFB\u52A1\uFF08\u65B0 worktree\uFF09",ctxLabel:"\u4E0A\u4E0B\u6587",ctxFresh:"\u5168\u65B0\u5BF9\u8BDD",ctxContinue:"\u63A5\u7740\u5F53\u524D\u5BF9\u8BDD",scratchChoice:"\u4E34\u65F6 shell"},cannotCloseLast:"\u65E0\u6CD5\u5173\u95ED\u552F\u4E00\u7684\u6807\u7B7E\u9875",tabGone:"\u8FD9\u4E2A\u6807\u7B7E\u9875\u5DF2\u7ECF\u4E0D\u5728\u4E86",nothingToFork:"\u8FD9\u4E2A\u6807\u7B7E\u9875\u8FD8\u6CA1\u6709\u53EF\u6D3E\u751F\u7684\u5BF9\u8BDD",noTranscriptToHandOff:"{engine} \u6CA1\u6709\u53EF\u8BFB\u7684\u5BF9\u8BDD\u8BB0\u5F55\uFF0C\u65E0\u6CD5\u4EA4\u63A5"},split:{renameTitle:"\u91CD\u547D\u540D\u5206\u5C4F",renameField:"\u5206\u5C4F\u540D\u79F0"},scrolledBack:"\u2191 \u5DF2\u56DE\u6EDA {lines} \u884C\uFF08ctrl+pgdn \u56DE\u5230\u5E95\u90E8\uFF09",search:{placeholder:"\u641C\u7D22\u56DE\u6EDA\u7F13\u51B2\u533A \u2014\u2014 enter/\u2191 \u66F4\u65E9\uFF0C\u2193 \u66F4\u665A\uFF0Cesc \u5173\u95ED",position:"{index}/{total}",noMatches:"\u6CA1\u6709\u5339\u914D",unavailable:"\u8FD9\u4E2A\u7A0B\u5E8F\u81EA\u5DF1\u7BA1\u7406\u56DE\u6EDA\u7F13\u51B2\u533A \u2014\u2014 \u672C\u5730\u6CA1\u6709\u53EF\u641C\u7D22\u7684\u5185\u5BB9\uFF08esc\uFF09"},unavailable:{shellMissing:"\u7EC8\u7AEF\u4E0D\u53EF\u7528 \u2014\u2014 \u914D\u7F6E\u7684 shell \u4E0D\u5B58\u5728",spawnFailed:"\u7EC8\u7AEF\u4E0D\u53EF\u7528 \u2014\u2014 shell \u542F\u52A8\u5931\u8D25",retry:"\u6309 F5 \u91CD\u8BD5"},reset:{title:"\u91CD\u7F6E\u7EC8\u7AEF\uFF1F",body:"\u6B63\u5728\u8FD0\u884C\u7684 shell \u4F1A\u88AB\u6740\u6389\u5E76\u5728 worktree \u91CD\u65B0\u542F\u52A8\uFF0C\u8FDB\u884C\u4E2D\u7684\u8FDB\u7A0B\uFF08vim\u3001htop\u3001\u6682\u505C\u7684\u4EFB\u52A1\uFF09\u4F1A\u7ACB\u5373\u7ED3\u675F\u3002"}}});var en16,zh16;var init_update=__esm(()=>{en16={pageTitle:"ROVE UPDATE",chip:"\u2191 {version}",current:"current",latest:"latest",latestUnknown:"unknown \u2014 could not reach the registry",releaseUrlUnavailable:"release URL unavailable",statusReleaseOpened:"Opened release page in your browser.",statusReleaseError:"Could not open release URL.",statusRunningUpdater:"Closing the TUI and running the updater in this terminal...",loadingNotes:"Loading release notes...",notesUnavailable:"Release notes are unavailable. Use Open release to view the GitHub release page.",changesSectionHeader:"\u2500\u2500 changes from v{from} to v{to} \u2500\u2500",updateComplete:"Rove update complete. Relaunch Rove to use the new version.",updateFailed:"Rove update failed with exit code {code}.",pressAnyKey:"Press any key to close this update window.",actions:{updateNow:"Update now",openRelease:"Open release",close:"Close",closeDetail:"return to the workspace"},skew:{title:"\u26A0 DAEMON OUT OF DATE",olderBuild:"an older build",hint:"daemon is {daemon} \u2014 you launched v{clientVersion}. Run `rove daemon restart`, then relaunch Rove"},staleInstall:{title:"\u2715 ROVE INSTALL IS GONE",hint:"this Rove is running from an install that no longer exists on disk, so it cannot start a daemon. Reinstall (`npm install -g @sma1lboy/rove`) and relaunch Rove"},versions:{pageTitle:"ROVE VERSIONS",loading:"Loading releases...",unavailable:"Could not fetch releases (offline or rate-limited).",tagCurrent:"current",tagLatest:"latest",tagBreaking:"breaking",breakingWarning:"\u26A0 installing this crosses breaking version(s) {versions} \u2014 run `rove reset` after the update.",footerHint:"j/k select \xB7 enter install \xB7 q close"}},zh16={pageTitle:"ROVE \u66F4\u65B0",chip:"\u2191 {version}",current:"\u5F53\u524D",latest:"\u6700\u65B0",latestUnknown:"\u672A\u77E5 \u2014\u2014 \u65E0\u6CD5\u8FDE\u63A5\u5230 registry",releaseUrlUnavailable:"\u53D1\u5E03\u94FE\u63A5\u4E0D\u53EF\u7528",statusReleaseOpened:"\u5DF2\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u53D1\u5E03\u8BF4\u660E\u9875\u9762\u3002",statusReleaseError:"\u65E0\u6CD5\u6253\u5F00\u53D1\u5E03\u94FE\u63A5\u3002",statusRunningUpdater:"\u6B63\u5728\u5173\u95ED TUI\uFF0C\u5E76\u5728\u5F53\u524D\u7EC8\u7AEF\u4E2D\u8FD0\u884C\u66F4\u65B0\u7A0B\u5E8F\u2026\u2026",loadingNotes:"\u6B63\u5728\u52A0\u8F7D\u53D1\u5E03\u8BF4\u660E\u2026\u2026",notesUnavailable:"\u53D1\u5E03\u8BF4\u660E\u4E0D\u53EF\u7528\u3002\u8BF7\u4F7F\u7528\u300C\u6253\u5F00\u53D1\u5E03\u9875\u300D\u67E5\u770B GitHub \u53D1\u5E03\u9875\u9762\u3002",changesSectionHeader:"\u2500\u2500 v{from} \u81F3 v{to} \u7684\u53D8\u66F4 \u2500\u2500",updateComplete:"Rove \u66F4\u65B0\u5B8C\u6210\u3002\u8BF7\u91CD\u65B0\u542F\u52A8 Rove \u4EE5\u4F7F\u7528\u65B0\u7248\u672C\u3002",updateFailed:"Rove \u66F4\u65B0\u5931\u8D25\uFF0C\u9000\u51FA\u7801\u4E3A {code}\u3002",pressAnyKey:"\u6309\u4EFB\u610F\u952E\u5173\u95ED\u6B64\u66F4\u65B0\u7A97\u53E3\u3002",actions:{updateNow:"\u7ACB\u5373\u66F4\u65B0",openRelease:"\u6253\u5F00\u53D1\u5E03\u9875",close:"\u5173\u95ED",closeDetail:"\u8FD4\u56DE\u5DE5\u4F5C\u533A"},skew:{title:"\u26A0 DAEMON \u7248\u672C\u4E0D\u4E00\u81F4",olderBuild:"\u65E7\u7248\u672C\u6784\u5EFA",hint:"daemon \u8FD0\u884C\u7684\u662F {daemon}\uFF0C\u800C\u4F60\u542F\u52A8\u7684\u662F v{clientVersion}\u3002\u8BF7\u8FD0\u884C `rove daemon restart`\uFF0C\u7136\u540E\u91CD\u65B0\u542F\u52A8 Rove"},staleInstall:{title:"\u2715 ROVE \u5B89\u88C5\u5DF2\u4E0D\u5B58\u5728",hint:"\u5F53\u524D Rove \u8FD0\u884C\u81EA\u4E00\u4EFD\u5DF2\u4ECE\u78C1\u76D8\u5220\u9664\u7684\u5B89\u88C5\uFF0C\u56E0\u6B64\u65E0\u6CD5\u542F\u52A8 daemon\u3002\u8BF7\u91CD\u65B0\u5B89\u88C5\uFF08`npm install -g @sma1lboy/rove`\uFF09\u5E76\u91CD\u65B0\u542F\u52A8 Rove"},versions:{pageTitle:"ROVE \u7248\u672C\u5217\u8868",loading:"\u6B63\u5728\u52A0\u8F7D\u53D1\u5E03\u5217\u8868\u2026\u2026",unavailable:"\u65E0\u6CD5\u83B7\u53D6\u53D1\u5E03\u5217\u8868\uFF08\u79BB\u7EBF\u6216\u89E6\u53D1\u9650\u6D41\uFF09\u3002",tagCurrent:"\u5F53\u524D",tagLatest:"\u6700\u65B0",tagBreaking:"breaking",breakingWarning:"\u26A0 \u5B89\u88C5\u8BE5\u7248\u672C\u4F1A\u8DE8\u8FC7 breaking \u7248\u672C {versions}\u2014\u2014\u66F4\u65B0\u540E\u9700\u8FD0\u884C `rove reset`\u3002",footerHint:"j/k \u9009\u62E9 \xB7 enter \u5B89\u88C5 \xB7 q \u5173\u95ED"}}});var en17,zh17;var init_workItems=__esm(()=>{en17={title:"ISSUES",noRepo:"no project",empty:"No open issues.",assignedFilter:"assigned to me",starting:"Starting work on #{number}\u2026",startedNoEngine:"Created {title}, but its engine did not start.",linkedChip:"\u2192 {title}",openingLinked:"Opening {title}\u2026",startFailed:"Couldn't start work on #{number}: {error}",errorHint:{noRemote:"Add a GitHub remote (`git remote add origin <url>`) and try again, or press q / esc to close.",ghMissing:"Install the `gh` CLI and authenticate, or press q / esc to close.",auth:"Run `gh auth login`, or press q / esc to close.",fallback:"{message} \xB7 press q / esc to close"}},zh17={title:"\u8BAE\u9898",noRepo:"\u65E0\u9879\u76EE",empty:"\u6CA1\u6709\u5F00\u653E\u7684\u8BAE\u9898\u3002",assignedFilter:"\u5206\u914D\u7ED9\u6211\u7684",starting:"\u6B63\u5728\u5F00\u59CB\u5904\u7406 #{number}\u2026",startedNoEngine:"\u5DF2\u521B\u5EFA {title}\uFF0C\u4F46\u5F15\u64CE\u6CA1\u6709\u542F\u52A8\u3002",linkedChip:"\u2192 {title}",openingLinked:"\u6B63\u5728\u6253\u5F00 {title}\u2026",startFailed:"\u5F00\u59CB\u5904\u7406 #{number} \u5931\u8D25\uFF1A{error}",errorHint:{noRemote:"\u6DFB\u52A0 GitHub remote\uFF08`git remote add origin <url>`\uFF09\u540E\u91CD\u8BD5\uFF0C\u6216\u6309 q / esc \u5173\u95ED\u3002",ghMissing:"\u5B89\u88C5 `gh` CLI \u5E76\u767B\u5F55\uFF0C\u6216\u6309 q / esc \u5173\u95ED\u3002",auth:"\u6267\u884C `gh auth login`\uFF0C\u6216\u6309 q / esc \u5173\u95ED\u3002",fallback:"{message} \xB7 \u6309 q / esc \u5173\u95ED"}}});var en18,zh18;var init_workspace=__esm(()=>{en18={quit:{confirmTitle:"Quit Rove?",confirmBody:"The daemon and task sessions keep running. This closes only the native workspace.",confirmLabel:"Quit"},empty:{selectTask:"Select a task with a worktree",noSessions:"No sessions here \u2014 press \u23CE or ctrl+e to start one",remoteUnsupported:"Hosted engine launch over SSH is not implemented \u2014 this task's worktree is on {host}"},welcome:{title:"Welcome to Rove",tagline:"Run several AI coding sessions side by side \u2014 each task gets its own git worktree and branch.",worktreeExplain:"Each task creates its own git worktree directory and branch, so multiple AI sessions can edit the same codebase in parallel without colliding.",stepNew:"creates your first task \u2014 pick a repo, a base branch, an engine",stepHelp:"shows every shortcut reachable from the current focus",stepPrefix:"opens the command menu",enginesFound:"\u2713 engines: {list}",enginesMissing:"\u2717 no engine CLI found \u2014 install claude, codex, copilot, or kimi, then restart Rove",gitMissing:"\u2717 git not found on PATH \u2014 Rove needs git to create worktrees",doctorHint:"run `rove doctor` in a shell for the full diagnosis",docsHint:"docs: https://docs.rove.run"},attention:{none:"No available Inbox items"},inbox:{title:"INBOX",empty:"No pending attention",openHint:"enter open",clearHint:"d clear",more:"+{count} more",section:{attention:"ATTENTION",recent:"RECENT"},state:{done:"done",needsInput:"needs input",error:"error",rateLimited:"rate limited",running:"running",dead:"engine exited",promptDeferred:"message queued"},resumesAt:"resumes {time}",deferredToast:"Message queued \u2014 composer busy",deferredStillQueued:"Still typing? The queued message stays in the Inbox \u2014 open it again to send.",deferredUnavailable:"That tab isn't running \u2014 the queued message stays in the Inbox.",deferredInsertFailed:"Couldn't insert the queued message \u2014 it's still in the Inbox."}},zh18={quit:{confirmTitle:"\u9000\u51FA Rove\uFF1F",confirmBody:"\u5B88\u62A4\u8FDB\u7A0B\u548C\u4EFB\u52A1\u4F1A\u8BDD\u4F1A\u7EE7\u7EED\u8FD0\u884C\uFF0C\u8FD9\u91CC\u53EA\u5173\u95ED\u539F\u751F\u5DE5\u4F5C\u533A\u3002",confirmLabel:"\u9000\u51FA"},empty:{selectTask:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u5E26 worktree \u7684\u4EFB\u52A1",noSessions:"\u8FD9\u91CC\u6CA1\u6709\u4F1A\u8BDD\u2014\u2014\u6309 \u23CE \u6216 ctrl+e \u5F00\u4E00\u4E2A",remoteUnsupported:"\u5C1A\u672A\u5B9E\u73B0\u901A\u8FC7 SSH \u542F\u52A8\u6258\u7BA1\u5F15\u64CE\u2014\u2014\u8BE5\u4EFB\u52A1\u7684 worktree \u5728 {host} \u4E0A"},welcome:{title:"\u6B22\u8FCE\u4F7F\u7528 Rove",tagline:"\u5E76\u884C\u8FD0\u884C\u591A\u4E2A AI \u7F16\u7801\u4F1A\u8BDD\u2014\u2014\u6BCF\u4E2A\u4EFB\u52A1\u90FD\u6709\u81EA\u5DF1\u7684 git worktree \u548C\u5206\u652F\u3002",worktreeExplain:"\u6BCF\u4E2A\u4EFB\u52A1\u90FD\u4F1A\u521B\u5EFA\u72EC\u7ACB\u7684 git worktree \u76EE\u5F55\u548C\u5206\u652F\uFF0C\u591A\u4E2A AI \u4F1A\u8BDD\u53EF\u4EE5\u5E76\u884C\u4FEE\u6539\u540C\u4E00\u4EFD\u4EE3\u7801\u5E93\uFF0C\u4E92\u4E0D\u5E72\u6270\u3002",stepNew:"\u521B\u5EFA\u4F60\u7684\u7B2C\u4E00\u4E2A\u4EFB\u52A1\u2014\u2014\u9009\u4ED3\u5E93\u3001\u57FA\u7840\u5206\u652F\u548C\u5F15\u64CE",stepHelp:"\u67E5\u770B\u5F53\u524D\u7126\u70B9\u4E0B\u7684\u5168\u90E8\u5FEB\u6377\u952E",stepPrefix:"\u6253\u5F00\u547D\u4EE4\u83DC\u5355",enginesFound:"\u2713 \u5DF2\u68C0\u6D4B\u5230\u5F15\u64CE:{list}",enginesMissing:"\u2717 \u672A\u627E\u5230\u5F15\u64CE CLI\u2014\u2014\u8BF7\u5B89\u88C5 claude\u3001codex\u3001copilot \u6216 kimi \u540E\u91CD\u542F Rove",gitMissing:"\u2717 PATH \u4E0A\u6CA1\u6709 git\u2014\u2014Rove \u9700\u8981 git \u6765\u521B\u5EFA worktree",doctorHint:"\u5728 shell \u91CC\u8FD0\u884C `rove doctor` \u67E5\u770B\u5B8C\u6574\u8BCA\u65AD",docsHint:"\u6587\u6863:https://docs.rove.run"},attention:{none:"\u6536\u4EF6\u7BB1\u4E2D\u6CA1\u6709\u53EF\u6253\u5F00\u7684\u9879\u76EE"},inbox:{title:"\u6536\u4EF6\u7BB1",empty:"\u6682\u65E0\u5F85\u5904\u7406",openHint:"enter \u6253\u5F00",clearHint:"d \u6E05\u9664",more:"\u8FD8\u6709 {count} \u6761",section:{attention:"\u5F85\u5904\u7406",recent:"\u6700\u8FD1\u4F7F\u7528"},state:{done:"\u5B8C\u6210",needsInput:"\u9700\u8981\u8F93\u5165",error:"\u51FA\u9519",rateLimited:"\u9650\u6D41",running:"\u8FDB\u884C\u4E2D",dead:"\u5F15\u64CE\u5DF2\u9000\u51FA",promptDeferred:"\u6D88\u606F\u5DF2\u6392\u961F"},resumesAt:"{time} \u6062\u590D",deferredToast:"\u6D88\u606F\u5DF2\u6392\u961F\u2014\u2014composer \u6B63\u5FD9",deferredStillQueued:"\u8FD8\u5728\u6253\u5B57\uFF1F\u6392\u961F\u7684\u6D88\u606F\u7559\u5728\u6536\u4EF6\u7BB1\u2014\u2014\u518D\u6253\u5F00\u4E00\u6B21\u5373\u53EF\u53D1\u9001\u3002",deferredUnavailable:"\u8BE5\u6807\u7B7E\u9875\u672A\u8FD0\u884C\u2014\u2014\u6392\u961F\u7684\u6D88\u606F\u7559\u5728\u6536\u4EF6\u7BB1\u3002",deferredInsertFailed:"\u65E0\u6CD5\u63D2\u5165\u6392\u961F\u7684\u6D88\u606F\u2014\u2014\u5B83\u4ECD\u5728\u6536\u4EF6\u7BB1\u4E2D\u3002"}}});var en19,zh19;var init_worktrees=__esm(()=>{en19={title:"Worktrees",loading:"Loading worktrees\u2026",noProjects:"No local projects known to Rove yet.",noWorktrees:"No worktrees.",badge:{kobeManaged:"rove",dirty:"dirty",remoteOn:"on remote",remoteOff:"not pushed",remoteUnknown:"remote unknown"},verdict:{prOpen:"PR open",prMerged:"merged (PR)",inMain:"in main",prClosed:"PR closed",idle:"stale"},row:{detached:"(detached)",created:"created {age} ago",linkedTask:"task: {title}"},delete:{button:"Delete",confirmTitle:"Delete worktree?",confirmBody:'Delete the worktree for "{branch}"? This removes the working directory; the branch itself is kept.',forceTitle:"Force delete worktree?",forceBody:'"{branch}" has uncommitted or untracked changes that will be PERMANENTLY LOST. Force delete anyway?',failed:"Failed to delete worktree: {error}",residue:"Git deregistered the worktree, but couldn't delete {path} ({reason}). Rove is done with it \u2014 retrying won't help; delete the directory by hand if you want the space."},land:{button:"Land",confirmTitle:"Land branch?",confirmBody:`Merge "{branch}" into the base repo's current branch, then remove this worktree? The branch is kept. A dirty base checkout is refused; conflicts abort with a file list.`,noTask:"This worktree isn't tracked as a Rove task \u2014 nothing to land.",conflict:"Land hit conflicts (merge aborted). Resolve by hand: {files}",dirtyBase:"The base checkout has uncommitted changes \u2014 commit them, then land. Never `git stash` here: the stash stack lives in the repo's common dir and is shared by every linked worktree, so a stash can entangle other tasks' work.",failed:"Land failed: {error}",done:'Landed "{branch}" onto {landedOn} ({commit}).',worktreeKept:"Landed, but the worktree was kept: {reason}",worktreePathStale:"Landed and removed the worktree, but the task still points at it: {reason}",worktreeResidue:"Landed. Git deregistered the worktree, but couldn't delete {path} ({reason}) \u2014 delete the directory by hand if you want the space."},hint:{}},zh19={title:"\u5DE5\u4F5C\u6811",loading:"\u6B63\u5728\u52A0\u8F7D worktree\u2026",noProjects:"Rove \u8FD8\u6CA1\u6709\u5DF2\u77E5\u7684\u672C\u5730\u9879\u76EE\u3002",noWorktrees:"\u6CA1\u6709 worktree\u3002",badge:{kobeManaged:"rove",dirty:"\u6709\u6539\u52A8",remoteOn:"\u5DF2\u63A8\u9001",remoteOff:"\u672A\u63A8\u9001",remoteUnknown:"\u8FDC\u7AEF\u672A\u77E5"},verdict:{prOpen:"PR \u8BC4\u5BA1\u4E2D",prMerged:"\u5DF2\u5408\u5165 (PR)",inMain:"\u5DF2\u5728\u4E3B\u5206\u652F",prClosed:"PR \u5DF2\u5173\u95ED",idle:"\u9648\u65E7"},row:{detached:"(\u6E38\u79BB\u72B6\u6001)",created:"{age}\u524D\u521B\u5EFA",linkedTask:"\u4EFB\u52A1\uFF1A{title}"},delete:{button:"\u5220\u9664",confirmTitle:"\u5220\u9664 worktree\uFF1F",confirmBody:'\u786E\u5B9A\u5220\u9664 "{branch}" \u5BF9\u5E94\u7684 worktree\uFF1F\u5DE5\u4F5C\u76EE\u5F55\u4F1A\u88AB\u79FB\u9664\uFF0C\u5206\u652F\u672C\u8EAB\u4F1A\u4FDD\u7559\u3002',forceTitle:"\u5F3A\u5236\u5220\u9664 worktree\uFF1F",forceBody:'"{branch}" \u5B58\u5728\u672A\u63D0\u4EA4\u6216\u672A\u8DDF\u8E2A\u7684\u6539\u52A8\uFF0C\u5F3A\u5236\u5220\u9664\u540E\u5C06\u6C38\u4E45\u4E22\u5931\u3002\u4ECD\u8981\u5F3A\u5236\u5220\u9664\u5417\uFF1F',failed:"\u5220\u9664 worktree \u5931\u8D25\uFF1A{error}",residue:"Git \u5DF2\u6CE8\u9500\u8BE5 worktree\uFF0C\u4F46\u6CA1\u80FD\u5220\u6389 {path}\uFF08{reason}\uFF09\u3002Rove \u8FD9\u8FB9\u5DF2\u7ECF\u5904\u7406\u5B8C\u4E86\u2014\u2014\u91CD\u8BD5\u6CA1\u6709\u7528\uFF1B\u60F3\u8981\u56DE\u78C1\u76D8\u7A7A\u95F4\u8BF7\u624B\u52A8\u5220\u9664\u8BE5\u76EE\u5F55\u3002"},land:{button:"\u5408\u5165",confirmTitle:"\u5408\u5165\u5206\u652F\uFF1F",confirmBody:'\u628A "{branch}" \u5408\u5165\u57FA\u4ED3\u5E93\u5F53\u524D\u5206\u652F\uFF0C\u7136\u540E\u79FB\u9664\u8FD9\u4E2A worktree\uFF1F\u5206\u652F\u4F1A\u4FDD\u7559\u3002\u57FA\u7840\u68C0\u51FA\u6709\u672A\u63D0\u4EA4\u6539\u52A8\u4F1A\u88AB\u62D2\u7EDD\uFF1B\u51B2\u7A81\u4F1A\u4E2D\u6B62\u5E76\u7ED9\u51FA\u6587\u4EF6\u6E05\u5355\u3002',noTask:"\u8BE5 worktree \u672A\u4F5C\u4E3A Rove \u4EFB\u52A1\u88AB\u8DDF\u8E2A\u2014\u2014\u6CA1\u6709\u53EF\u5408\u5165\u7684\u5BF9\u8C61\u3002",conflict:"\u5408\u5165\u9047\u5230\u51B2\u7A81\uFF08\u5DF2\u4E2D\u6B62\uFF09\u3002\u8BF7\u624B\u52A8\u89E3\u51B3\uFF1A{files}",dirtyBase:"\u57FA\u7840\u68C0\u51FA\u6709\u672A\u63D0\u4EA4\u6539\u52A8\u2014\u2014\u8BF7\u5148\u63D0\u4EA4\u518D\u5408\u5165\u3002\u7EDD\u4E0D\u8981\u5728\u8FD9\u91CC `git stash`\uFF1Astash \u6808\u5B58\u653E\u5728\u4ED3\u5E93\u7684 common dir \u4E2D\uFF0C\u8BE5\u4ED3\u5E93\u6240\u6709 linked worktree \u5171\u4EAB\uFF0C\u4E00\u6B21 stash \u53EF\u80FD\u7EA0\u7F20\u5176\u4ED6\u4EFB\u52A1\u7684\u5DE5\u4F5C\u3002",failed:"\u5408\u5165\u5931\u8D25\uFF1A{error}",done:'\u5DF2\u628A "{branch}" \u5408\u5165 {landedOn}\uFF08{commit}\uFF09\u3002',worktreeKept:"\u5DF2\u5408\u5165\uFF0C\u4F46 worktree \u4FDD\u7559\u4E86\uFF1A{reason}",worktreePathStale:"\u5DF2\u5408\u5165\u5E76\u79FB\u9664 worktree\uFF0C\u4F46\u4EFB\u52A1\u4ECD\u6307\u5411\u5B83\uFF1A{reason}",worktreeResidue:"\u5DF2\u5408\u5165\u3002Git \u5DF2\u6CE8\u9500\u8BE5 worktree\uFF0C\u4F46\u6CA1\u80FD\u5220\u6389 {path}\uFF08{reason}\uFF09\u2014\u2014\u60F3\u8981\u56DE\u78C1\u76D8\u7A7A\u95F4\u8BF7\u624B\u52A8\u5220\u9664\u8BE5\u76EE\u5F55\u3002"},hint:{}}});function isLocaleId(value){return typeof value==="string"&&LOCALES.some((l)=>l.id===value)}var en20,zh20,LOCALES,CATALOGS,DEFAULT_LOCALE="en";var init_catalog=__esm(()=>{init_automations();init_common();init_doctor();init_files();init_help();init_hints();init_kanban();init_keys();init_newTask();init_onboarding();init_ops();init_quickTask();init_settings();init_tasks();init_terminal();init_update();init_workItems();init_workspace();init_worktrees();en20={settings:en13,tasks:en14,terminal:en15,files:en4,newTask:en9,onboarding:en10,ops:en11,update:en16,quickTask:en12,help:en5,hints:en6,common:en2,keys:en8,workspace:en18,worktrees:en19,kanban:en7,automations:en,workItems:en17,doctor:en3},zh20={settings:zh13,tasks:zh14,terminal:zh15,files:zh4,newTask:zh9,onboarding:zh10,ops:zh11,update:zh16,quickTask:zh12,help:zh5,hints:zh6,common:zh2,keys:zh8,workspace:zh18,worktrees:zh19,kanban:zh7,automations:zh,workItems:zh17,doctor:zh3},LOCALES=[{id:"en",label:"English"},{id:"zh",label:"\u4E2D\u6587"}],CATALOGS={en:en20,zh:zh20}});import{readFileSync as readFileSync11}from"fs";function readPersistedUiPrefs(fallbackTheme,isKnownTheme=hasBundledTheme){try{let parsed=JSON.parse(readFileSync11(kvStatePath(),"utf8")),theme=typeof parsed.activeTheme==="string"&&isKnownTheme(parsed.activeTheme)?parsed.activeTheme:fallbackTheme,transparent=parsed.transparentBackground!==!1,focusAccent=typeof parsed.focusAccent==="string"&&FOCUS_ACCENT_SLOTS.includes(parsed.focusAccent)?parsed.focusAccent:null,locale=isLocaleId(parsed[LOCALE_KEY])?parsed[LOCALE_KEY]:DEFAULT_LOCALE;return{theme,transparent,focusAccent,locale}}catch{return{theme:fallbackTheme,transparent:!0,focusAccent:null,locale:DEFAULT_LOCALE}}}var LOCALE_KEY="locale";var init_persisted_ui_prefs=__esm(()=>{init_env();init_theme_core();init_catalog()});function terminalDefaultColorsForTheme(theme){return parseTerminalDefaultColors({foreground:resolveThemeSlotHex(theme,"text","dark"),background:resolveThemeSlotHex(theme,"background","dark")})??DEFAULT_TERMINAL_COLORS}function readPersistedTerminalDefaultColors(){let themes={...BUNDLED_THEMES};for(let{name,theme}of loadUserThemes())themes[name]=theme;let prefs=readPersistedUiPrefs(DEFAULT_THEME,(name)=>Boolean(themes[name])),selected=themes[prefs.theme]??themes[DEFAULT_THEME];return selected?terminalDefaultColorsForTheme(selected):DEFAULT_TERMINAL_COLORS}var init_terminal_colors2=__esm(()=>{init_terminal_colors();init_theme_core();init_loader();init_persisted_ui_prefs()});function He(r,e){let t=0,n=e.length-1,o;if(r<e[0][0]||r>e[n][1])return!1;for(;n>=t;)if(o=t+n>>1,r>e[o][1])t=o+1;else if(r<e[o][0])n=o-1;else return!0;return!1}function Y(r){Je(r)||Ge.onUnexpectedError(r)}function Je(r){return r instanceof G?!0:r instanceof Error&&r.name===ce&&r.message===ce}function pe(r2,e){let t=this,n=!1,o;return function(){if(n)return o;if(n=!0,e)try{o=r2.apply(t,arguments)}finally{e()}else o=r2.apply(t,arguments);return o}}function Ye(r2,e,t=0,n=r2.length){let o=t,d=n;for(;o<d;){let v=Math.floor((o+d)/2);e(r2[v])?o=v+1:d=v}return o-1}function we(r2,e){return(t,n)=>e(r2(t),r2(n))}function Oe(r2,e){let t=Object.create(null);for(let n of r2){let o=e(n),d=t[o];d||(d=t[o]=[]),d.push(n)}return t}function Ze(r2){O=r2}function Te(r2){return O?.trackDisposable(r2),r2}function ve(r2){O?.markAsDisposed(r2)}function he(r2,e){O?.setParent(r2,e)}function et(r2,e){if(O)for(let t of r2)O.setParent(t,e)}function Pe(r2){if(fe.is(r2)){let e=[];for(let t of r2)if(t)try{t.dispose()}catch(n){e.push(n)}if(e.length===1)throw e[0];if(e.length>1)throw AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(r2)?[]:r2}else if(r2)return r2.dispose(),r2}function Me(...r2){let e=me(()=>Pe(r2));return et(r2,e),e}function me(r2){let e=Te({dispose:pe(()=>{ve(e),r2()})});return e}function je(r5,e){let t=0,n=e.length-1,o;if(r5<e[0][0]||r5>e[n][1])return!1;for(;n>=t;)if(o=t+n>>1,r5>e[o][1])t=o+1;else if(r5<e[o][0])n=o-1;else return!0;return!1}var ue,qe,A,H=class{constructor(){if(this.version="6",!A){A=new Uint8Array(65536),A.fill(1),A[0]=0,A.fill(0,1,32),A.fill(0,127,160),A.fill(2,4352,4448),A[9001]=2,A[9002]=2,A.fill(2,11904,42192),A[12351]=1,A.fill(2,44032,55204),A.fill(2,63744,64256),A.fill(2,65040,65050),A.fill(2,65072,65136),A.fill(2,65280,65377),A.fill(2,65504,65511);for(let e=0;e<ue.length;++e)A.fill(0,ue[e][0],ue[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?A[e]:He(e,qe)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),o=n===0&&t!==0;if(o){let d=w.extractWidth(t);d===0?o=!1:d>n&&(n=d)}return w.createPropertyValue(0,n,o)}},de=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?J.isErrorNoTelemetry(e)?new J(e.message+`
|
|
296
296
|
|
|
297
297
|
`+e.stack):Error(e.message+`
|
|
298
298
|
|
|
@@ -495,7 +495,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
495
495
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var normalCompletion=!0,didErr=!1,err;return{s:function(){it2=it2.call(o)},n:function(){var step=it2.next();return normalCompletion=step.done,step},e:function(_e2){didErr=!0,err=_e2},f:function(){try{if(!normalCompletion&&it2.return!=null)it2.return()}finally{if(didErr)throw err}}}}function fiber_renderer_unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return fiber_renderer_arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fiber_renderer_arrayLikeToArray(o,minLen)}function fiber_renderer_arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function renderer_typeof(o){return renderer_typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o2){return typeof o2}:function(o2){return o2&&typeof Symbol=="function"&&o2.constructor===Symbol&&o2!==Symbol.prototype?"symbol":typeof o2},renderer_typeof(o)}var renderer_toString=Object.prototype.toString;function renderer_isError(object){return renderer_toString.call(object)==="[object Error]"}var FIBER_INSTANCE=0,VIRTUAL_INSTANCE=1,FILTERED_FIBER_INSTANCE=2;function createFiberInstance(fiber){return{kind:FIBER_INSTANCE,id:getUID(),parent:null,firstChild:null,nextSibling:null,source:null,logCount:0,treeBaseDuration:0,suspendedBy:null,suspenseNode:null,data:fiber}}function createFilteredFiberInstance(fiber){return{kind:FILTERED_FIBER_INSTANCE,id:0,parent:null,firstChild:null,nextSibling:null,source:null,logCount:0,treeBaseDuration:0,suspendedBy:null,suspenseNode:null,data:fiber}}function createVirtualInstance(debugEntry){return{kind:VIRTUAL_INSTANCE,id:getUID(),parent:null,firstChild:null,nextSibling:null,source:null,logCount:0,treeBaseDuration:0,suspendedBy:null,suspenseNode:null,data:debugEntry}}var NoUpdate=0,ShouldResetChildren=1,ShouldResetSuspenseChildren=2,ShouldResetParentSuspenseChildren=4;function createSuspenseNode(instance){return instance.suspenseNode={instance,parent:null,firstChild:null,nextSibling:null,rects:null,suspendedBy:new Map,environments:new Map,hasUniqueSuspenders:!1,hasUnknownSuspenders:!1}}function getDispatcherRef(renderer){if(renderer.currentDispatcherRef===void 0)return;var injectedRef=renderer.currentDispatcherRef;if(typeof injectedRef.H>"u"&&typeof injectedRef.current<"u")return{get H(){return injectedRef.current},set H(value){injectedRef.current=value}};return injectedRef}function getFiberFlags(fiber){return fiber.flags!==void 0?fiber.flags:fiber.effectTag}var renderer_getCurrentTime=(typeof performance>"u"?"undefined":renderer_typeof(performance))==="object"&&typeof performance.now==="function"?function(){return performance.now()}:function(){return Date.now()};function getInternalReactConstants(version){var ReactPriorityLevels={ImmediatePriority:99,UserBlockingPriority:98,NormalPriority:97,LowPriority:96,IdlePriority:95,NoPriority:90};if(gt(version,"17.0.2"))ReactPriorityLevels={ImmediatePriority:1,UserBlockingPriority:2,NormalPriority:3,LowPriority:4,IdlePriority:5,NoPriority:0};var StrictModeBits=0;if(gte(version,"18.0.0-alpha"))StrictModeBits=24;else if(gte(version,"16.9.0"))StrictModeBits=1;else if(gte(version,"16.3.0"))StrictModeBits=2;var SuspenseyImagesMode=32,ReactTypeOfWork=null;if(gt(version,"17.0.1"))ReactTypeOfWork={CacheComponent:24,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:26,HostSingleton:27,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:28,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:23,MemoComponent:14,Mode:8,OffscreenComponent:22,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,TracingMarkerComponent:25,YieldComponent:-1,Throw:29,ViewTransitionComponent:30,ActivityComponent:31};else if(gte(version,"17.0.0-alpha"))ReactTypeOfWork={CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:-1,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:24,MemoComponent:14,Mode:8,OffscreenComponent:23,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,TracingMarkerComponent:-1,YieldComponent:-1,Throw:-1,ViewTransitionComponent:-1,ActivityComponent:-1};else if(gte(version,"16.6.0-beta.0"))ReactTypeOfWork={CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:-1,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:-1,MemoComponent:14,Mode:8,OffscreenComponent:-1,Profiler:12,ScopeComponent:-1,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,TracingMarkerComponent:-1,YieldComponent:-1,Throw:-1,ViewTransitionComponent:-1,ActivityComponent:-1};else if(gte(version,"16.4.3-alpha"))ReactTypeOfWork={CacheComponent:-1,ClassComponent:2,ContextConsumer:11,ContextProvider:12,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:-1,ForwardRef:13,Fragment:9,FunctionComponent:0,HostComponent:7,HostPortal:6,HostRoot:5,HostHoistable:-1,HostSingleton:-1,HostText:8,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:4,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:10,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,TracingMarkerComponent:-1,YieldComponent:-1,Throw:-1,ViewTransitionComponent:-1,ActivityComponent:-1};else ReactTypeOfWork={CacheComponent:-1,ClassComponent:2,ContextConsumer:12,ContextProvider:13,CoroutineComponent:7,CoroutineHandlerPhase:8,DehydratedSuspenseComponent:-1,ForwardRef:14,Fragment:10,FunctionComponent:1,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:-1,HostSingleton:-1,HostText:6,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:0,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:11,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,TracingMarkerComponent:-1,YieldComponent:9,Throw:-1,ViewTransitionComponent:-1,ActivityComponent:-1};function getTypeSymbol(type){var symbolOrNumber=renderer_typeof(type)==="object"&&type!==null?type.$$typeof:type;return renderer_typeof(symbolOrNumber)==="symbol"?symbolOrNumber.toString():symbolOrNumber}var _ReactTypeOfWork=ReactTypeOfWork,CacheComponent=_ReactTypeOfWork.CacheComponent,ClassComponent=_ReactTypeOfWork.ClassComponent,IncompleteClassComponent=_ReactTypeOfWork.IncompleteClassComponent,IncompleteFunctionComponent=_ReactTypeOfWork.IncompleteFunctionComponent,FunctionComponent=_ReactTypeOfWork.FunctionComponent,IndeterminateComponent=_ReactTypeOfWork.IndeterminateComponent,ForwardRef=_ReactTypeOfWork.ForwardRef,HostRoot=_ReactTypeOfWork.HostRoot,HostHoistable=_ReactTypeOfWork.HostHoistable,HostSingleton=_ReactTypeOfWork.HostSingleton,HostComponent=_ReactTypeOfWork.HostComponent,HostPortal=_ReactTypeOfWork.HostPortal,HostText=_ReactTypeOfWork.HostText,Fragment=_ReactTypeOfWork.Fragment,LazyComponent=_ReactTypeOfWork.LazyComponent,LegacyHiddenComponent=_ReactTypeOfWork.LegacyHiddenComponent,MemoComponent=_ReactTypeOfWork.MemoComponent,OffscreenComponent=_ReactTypeOfWork.OffscreenComponent,Profiler=_ReactTypeOfWork.Profiler,ScopeComponent=_ReactTypeOfWork.ScopeComponent,SimpleMemoComponent=_ReactTypeOfWork.SimpleMemoComponent,SuspenseComponent=_ReactTypeOfWork.SuspenseComponent,SuspenseListComponent=_ReactTypeOfWork.SuspenseListComponent,TracingMarkerComponent=_ReactTypeOfWork.TracingMarkerComponent,Throw=_ReactTypeOfWork.Throw,ViewTransitionComponent=_ReactTypeOfWork.ViewTransitionComponent,ActivityComponent=_ReactTypeOfWork.ActivityComponent;function resolveFiberType(type){var typeSymbol=getTypeSymbol(type);switch(typeSymbol){case MEMO_NUMBER:case MEMO_SYMBOL_STRING:return resolveFiberType(type.type);case FORWARD_REF_NUMBER:case FORWARD_REF_SYMBOL_STRING:return type.render;default:return type}}function getDisplayNameForFiber(fiber){var _fiber$updateQueue,_fiber$memoizedState,_fiber$memoizedState$,_fiber$memoizedState2,shouldSkipForgetCheck=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,elementType=fiber.elementType,type=fiber.type,tag=fiber.tag,resolvedType=type;if(renderer_typeof(type)==="object"&&type!==null)resolvedType=resolveFiberType(type);var resolvedContext=null;if(!shouldSkipForgetCheck&&(((_fiber$updateQueue=fiber.updateQueue)===null||_fiber$updateQueue===void 0?void 0:_fiber$updateQueue.memoCache)!=null||Array.isArray((_fiber$memoizedState=fiber.memoizedState)===null||_fiber$memoizedState===void 0?void 0:_fiber$memoizedState.memoizedState)&&(_fiber$memoizedState$=fiber.memoizedState.memoizedState[0])!==null&&_fiber$memoizedState$!==void 0&&_fiber$memoizedState$[ReactSymbols_REACT_MEMO_CACHE_SENTINEL]||(_fiber$memoizedState2=fiber.memoizedState)!==null&&_fiber$memoizedState2!==void 0&&(_fiber$memoizedState2=_fiber$memoizedState2.memoizedState)!==null&&_fiber$memoizedState2!==void 0&&_fiber$memoizedState2[ReactSymbols_REACT_MEMO_CACHE_SENTINEL])){var displayNameWithoutForgetWrapper=getDisplayNameForFiber(fiber,!0);if(displayNameWithoutForgetWrapper==null)return null;return"Forget(".concat(displayNameWithoutForgetWrapper,")")}switch(tag){case ActivityComponent:return"Activity";case CacheComponent:return"Cache";case ClassComponent:case IncompleteClassComponent:case IncompleteFunctionComponent:case FunctionComponent:case IndeterminateComponent:return getDisplayName(resolvedType);case ForwardRef:return getWrappedDisplayName(elementType,resolvedType,"ForwardRef","Anonymous");case HostRoot:var fiberRoot=fiber.stateNode;if(fiberRoot!=null&&fiberRoot._debugRootType!==null)return fiberRoot._debugRootType;return null;case HostComponent:case HostSingleton:case HostHoistable:return type;case HostPortal:case HostText:return null;case Fragment:return"Fragment";case LazyComponent:return"Lazy";case MemoComponent:case SimpleMemoComponent:return getWrappedDisplayName(elementType,resolvedType,"Memo","Anonymous");case SuspenseComponent:return"Suspense";case LegacyHiddenComponent:return"LegacyHidden";case OffscreenComponent:return"Offscreen";case ScopeComponent:return"Scope";case SuspenseListComponent:return"SuspenseList";case Profiler:return"Profiler";case TracingMarkerComponent:return"TracingMarker";case ViewTransitionComponent:return"ViewTransition";case Throw:return"Error";default:var typeSymbol=getTypeSymbol(type);switch(typeSymbol){case CONCURRENT_MODE_NUMBER:case CONCURRENT_MODE_SYMBOL_STRING:case DEPRECATED_ASYNC_MODE_SYMBOL_STRING:return null;case PROVIDER_NUMBER:case PROVIDER_SYMBOL_STRING:return resolvedContext=fiber.type._context||fiber.type.context,"".concat(resolvedContext.displayName||"Context",".Provider");case CONTEXT_NUMBER:case CONTEXT_SYMBOL_STRING:case SERVER_CONTEXT_SYMBOL_STRING:if(fiber.type._context===void 0&&fiber.type.Provider===fiber.type)return resolvedContext=fiber.type,"".concat(resolvedContext.displayName||"Context",".Provider");return resolvedContext=fiber.type._context||fiber.type,"".concat(resolvedContext.displayName||"Context",".Consumer");case CONSUMER_SYMBOL_STRING:return resolvedContext=fiber.type._context,"".concat(resolvedContext.displayName||"Context",".Consumer");case STRICT_MODE_NUMBER:case STRICT_MODE_SYMBOL_STRING:return null;case PROFILER_NUMBER:case PROFILER_SYMBOL_STRING:return"Profiler(".concat(fiber.memoizedProps.id,")");case SCOPE_NUMBER:case SCOPE_SYMBOL_STRING:return"Scope";default:return null}}}return{getDisplayNameForFiber,getTypeSymbol,ReactPriorityLevels,ReactTypeOfWork,StrictModeBits,SuspenseyImagesMode}}var knownEnvironmentNames=new Set,rootToFiberInstanceMap=new Map,idToDevToolsInstanceMap=new Map,idToSuspenseNodeMap=new Map,publicInstanceToDevToolsInstanceMap=new Map,hostResourceToDevToolsInstanceMap=new Map;function getPublicInstance(instance){if(renderer_typeof(instance)==="object"&&instance!==null){if(renderer_typeof(instance.canonical)==="object"&&instance.canonical!==null){if(renderer_typeof(instance.canonical.publicInstance)==="object"&&instance.canonical.publicInstance!==null)return instance.canonical.publicInstance}if(typeof instance._nativeTag==="number")return instance._nativeTag}return instance}function getNativeTag(instance){if(renderer_typeof(instance)!=="object"||instance===null)return null;if(instance.canonical!=null&&typeof instance.canonical.nativeTag==="number")return instance.canonical.nativeTag;if(typeof instance._nativeTag==="number")return instance._nativeTag;return null}function aquireHostInstance(nearestInstance,hostInstance){var publicInstance=getPublicInstance(hostInstance);publicInstanceToDevToolsInstanceMap.set(publicInstance,nearestInstance)}function releaseHostInstance(nearestInstance,hostInstance){var publicInstance=getPublicInstance(hostInstance);if(publicInstanceToDevToolsInstanceMap.get(publicInstance)===nearestInstance)publicInstanceToDevToolsInstanceMap.delete(publicInstance)}function aquireHostResource(nearestInstance,resource){var hostInstance=resource&&resource.instance;if(hostInstance){var publicInstance=getPublicInstance(hostInstance),resourceInstances=hostResourceToDevToolsInstanceMap.get(publicInstance);if(resourceInstances===void 0)resourceInstances=new Set,hostResourceToDevToolsInstanceMap.set(publicInstance,resourceInstances),publicInstanceToDevToolsInstanceMap.set(publicInstance,nearestInstance);resourceInstances.add(nearestInstance)}}function releaseHostResource(nearestInstance,resource){var hostInstance=resource&&resource.instance;if(hostInstance){var publicInstance=getPublicInstance(hostInstance),resourceInstances=hostResourceToDevToolsInstanceMap.get(publicInstance);if(resourceInstances!==void 0){if(resourceInstances.delete(nearestInstance),resourceInstances.size===0)hostResourceToDevToolsInstanceMap.delete(publicInstance),publicInstanceToDevToolsInstanceMap.delete(publicInstance);else if(publicInstanceToDevToolsInstanceMap.get(publicInstance)===nearestInstance){var _iterator=_createForOfIteratorHelper(resourceInstances),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var firstInstance=_step.value;publicInstanceToDevToolsInstanceMap.set(firstInstance,nearestInstance);break}}catch(err){_iterator.e(err)}finally{_iterator.f()}}}}}function renderer_attach(hook,rendererID,renderer,global,shouldStartProfilingNow,profilingSettings){var version=renderer.reconcilerVersion||renderer.version,_getInternalReactCons=getInternalReactConstants(version),getDisplayNameForFiber=_getInternalReactCons.getDisplayNameForFiber,getTypeSymbol=_getInternalReactCons.getTypeSymbol,ReactPriorityLevels=_getInternalReactCons.ReactPriorityLevels,ReactTypeOfWork=_getInternalReactCons.ReactTypeOfWork,StrictModeBits=_getInternalReactCons.StrictModeBits,SuspenseyImagesMode=_getInternalReactCons.SuspenseyImagesMode,ActivityComponent=ReactTypeOfWork.ActivityComponent,ClassComponent=ReactTypeOfWork.ClassComponent,ContextConsumer=ReactTypeOfWork.ContextConsumer,DehydratedSuspenseComponent=ReactTypeOfWork.DehydratedSuspenseComponent,ForwardRef=ReactTypeOfWork.ForwardRef,Fragment=ReactTypeOfWork.Fragment,FunctionComponent=ReactTypeOfWork.FunctionComponent,HostRoot=ReactTypeOfWork.HostRoot,HostHoistable=ReactTypeOfWork.HostHoistable,HostSingleton=ReactTypeOfWork.HostSingleton,HostPortal=ReactTypeOfWork.HostPortal,HostComponent=ReactTypeOfWork.HostComponent,HostText=ReactTypeOfWork.HostText,IncompleteClassComponent=ReactTypeOfWork.IncompleteClassComponent,IncompleteFunctionComponent=ReactTypeOfWork.IncompleteFunctionComponent,IndeterminateComponent=ReactTypeOfWork.IndeterminateComponent,LegacyHiddenComponent=ReactTypeOfWork.LegacyHiddenComponent,MemoComponent=ReactTypeOfWork.MemoComponent,OffscreenComponent=ReactTypeOfWork.OffscreenComponent,SimpleMemoComponent=ReactTypeOfWork.SimpleMemoComponent,SuspenseComponent=ReactTypeOfWork.SuspenseComponent,SuspenseListComponent=ReactTypeOfWork.SuspenseListComponent,TracingMarkerComponent=ReactTypeOfWork.TracingMarkerComponent,Throw=ReactTypeOfWork.Throw,ViewTransitionComponent=ReactTypeOfWork.ViewTransitionComponent,ImmediatePriority=ReactPriorityLevels.ImmediatePriority,UserBlockingPriority=ReactPriorityLevels.UserBlockingPriority,NormalPriority=ReactPriorityLevels.NormalPriority,LowPriority=ReactPriorityLevels.LowPriority,IdlePriority=ReactPriorityLevels.IdlePriority,NoPriority=ReactPriorityLevels.NoPriority,getLaneLabelMap=renderer.getLaneLabelMap,injectProfilingHooks=renderer.injectProfilingHooks,overrideHookState=renderer.overrideHookState,overrideHookStateDeletePath=renderer.overrideHookStateDeletePath,overrideHookStateRenamePath=renderer.overrideHookStateRenamePath,overrideProps=renderer.overrideProps,overridePropsDeletePath=renderer.overridePropsDeletePath,overridePropsRenamePath=renderer.overridePropsRenamePath,scheduleRefresh=renderer.scheduleRefresh,setErrorHandler=renderer.setErrorHandler,setSuspenseHandler=renderer.setSuspenseHandler,scheduleUpdate=renderer.scheduleUpdate,scheduleRetry=renderer.scheduleRetry,getCurrentFiber=renderer.getCurrentFiber,supportsTogglingError=typeof setErrorHandler==="function"&&typeof scheduleUpdate==="function",supportsTogglingSuspense=typeof setSuspenseHandler==="function"&&typeof scheduleUpdate==="function",supportsPerformanceTracks=gte(version,"19.2.0");if(typeof scheduleRefresh==="function")renderer.scheduleRefresh=function(){try{hook.emit("fastRefreshScheduled")}finally{return scheduleRefresh.apply(void 0,arguments)}};var getTimelineData=null,toggleProfilingStatus=null;if(typeof injectProfilingHooks==="function"){var response=createProfilingHooks({getDisplayNameForFiber,getIsProfiling:function(){return isProfiling},getLaneLabelMap,currentDispatcherRef:getDispatcherRef(renderer),workTagMap:ReactTypeOfWork,reactVersion:version});injectProfilingHooks(response.profilingHooks),getTimelineData=response.getTimelineData,toggleProfilingStatus=response.toggleProfilingStatus}var fiberToComponentLogsMap=new WeakMap,needsToFlushComponentLogs=!1;function bruteForceFlushErrorsAndWarnings(){var hasChanges=!1,_iterator2=_createForOfIteratorHelper(idToDevToolsInstanceMap.values()),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var devtoolsInstance=_step2.value;if(devtoolsInstance.kind===FIBER_INSTANCE){var _fiber=devtoolsInstance.data,componentLogsEntry=fiberToComponentLogsMap.get(_fiber),changed=recordConsoleLogs(devtoolsInstance,componentLogsEntry);if(changed)hasChanges=!0,updateMostRecentlyInspectedElementIfNecessary(devtoolsInstance.id)}}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}if(hasChanges)flushPendingEvents()}function clearErrorsAndWarnings(){var _iterator3=_createForOfIteratorHelper(idToDevToolsInstanceMap.values()),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var devtoolsInstance=_step3.value;if(devtoolsInstance.kind===FIBER_INSTANCE){var _fiber2=devtoolsInstance.data;if(fiberToComponentLogsMap.delete(_fiber2),_fiber2.alternate)fiberToComponentLogsMap.delete(_fiber2.alternate)}else componentInfoToComponentLogsMap.delete(devtoolsInstance.data);var changed=recordConsoleLogs(devtoolsInstance,void 0);if(changed)updateMostRecentlyInspectedElementIfNecessary(devtoolsInstance.id)}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}flushPendingEvents()}function clearConsoleLogsHelper(instanceID,type){var devtoolsInstance=idToDevToolsInstanceMap.get(instanceID);if(devtoolsInstance!==void 0){var componentLogsEntry;if(devtoolsInstance.kind===FIBER_INSTANCE){var _fiber3=devtoolsInstance.data;if(componentLogsEntry=fiberToComponentLogsMap.get(_fiber3),componentLogsEntry===void 0&&_fiber3.alternate!==null)componentLogsEntry=fiberToComponentLogsMap.get(_fiber3.alternate)}else{var componentInfo=devtoolsInstance.data;componentLogsEntry=componentInfoToComponentLogsMap.get(componentInfo)}if(componentLogsEntry!==void 0){if(type==="error")componentLogsEntry.errors.clear(),componentLogsEntry.errorsCount=0;else componentLogsEntry.warnings.clear(),componentLogsEntry.warningsCount=0;var changed=recordConsoleLogs(devtoolsInstance,componentLogsEntry);if(changed)flushPendingEvents(),updateMostRecentlyInspectedElementIfNecessary(devtoolsInstance.id)}}}function clearErrorsForElementID(instanceID){clearConsoleLogsHelper(instanceID,"error")}function clearWarningsForElementID(instanceID){clearConsoleLogsHelper(instanceID,"warn")}function updateMostRecentlyInspectedElementIfNecessary(fiberID){if(mostRecentlyInspectedElement!==null&&mostRecentlyInspectedElement.id===fiberID)hasElementUpdatedSinceLastInspected=!0}function getComponentStack(topFrame){if(getCurrentFiber==null)return null;var current=getCurrentFiber();if(current===null)return null;if(DevToolsFiberComponentStack_supportsConsoleTasks(current))return null;var dispatcherRef=getDispatcherRef(renderer);if(dispatcherRef===void 0)return null;var enableOwnerStacks=supportsOwnerStacks(current),componentStack="";if(enableOwnerStacks){var topStackFrames=formatOwnerStack(topFrame);if(topStackFrames)componentStack+=`
|
|
496
496
|
`+topStackFrames;componentStack+=getOwnerStackByFiberInDev(ReactTypeOfWork,current,dispatcherRef)}else componentStack=getStackByFiberInDevAndProd(ReactTypeOfWork,current,dispatcherRef);return{enableOwnerStacks,componentStack}}function onErrorOrWarning(type,args){if(getCurrentFiber==null)return;var fiber=getCurrentFiber();if(fiber===null)return;if(type==="error"){if(forceErrorForFibers.get(fiber)===!0||fiber.alternate!==null&&forceErrorForFibers.get(fiber.alternate)===!0)return}var message=formatConsoleArgumentsToSingleString.apply(void 0,fiber_renderer_toConsumableArray(args)),componentLogsEntry=fiberToComponentLogsMap.get(fiber);if(componentLogsEntry===void 0&&fiber.alternate!==null){if(componentLogsEntry=fiberToComponentLogsMap.get(fiber.alternate),componentLogsEntry!==void 0)fiberToComponentLogsMap.set(fiber,componentLogsEntry)}if(componentLogsEntry===void 0)componentLogsEntry={errors:new Map,errorsCount:0,warnings:new Map,warningsCount:0},fiberToComponentLogsMap.set(fiber,componentLogsEntry);var messageMap=type==="error"?componentLogsEntry.errors:componentLogsEntry.warnings,count=messageMap.get(message)||0;if(messageMap.set(message,count+1),type==="error")componentLogsEntry.errorsCount++;else componentLogsEntry.warningsCount++;needsToFlushComponentLogs=!0}function debug2(name,instance,parentInstance){var extraString=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";if(__DEBUG__){var displayName=instance.kind===VIRTUAL_INSTANCE?instance.data.name||"null":instance.data.tag+":"+(getDisplayNameForFiber(instance.data)||"null"),maybeID=instance.kind===FILTERED_FIBER_INSTANCE?"<no id>":instance.id,parentDisplayName=parentInstance===null?"":parentInstance.kind===VIRTUAL_INSTANCE?parentInstance.data.name||"null":parentInstance.data.tag+":"+(getDisplayNameForFiber(parentInstance.data)||"null"),maybeParentID=parentInstance===null||parentInstance.kind===FILTERED_FIBER_INSTANCE?"<no id>":parentInstance.id;console.groupCollapsed("[renderer] %c".concat(name," %c").concat(displayName," (").concat(maybeID,") %c").concat(parentInstance?"".concat(parentDisplayName," (").concat(maybeParentID,")"):""," %c").concat(extraString),"color: red; font-weight: bold;","color: blue;","color: purple;","color: black;"),console.log(Error().stack.split(`
|
|
497
497
|
`).slice(1).join(`
|
|
498
|
-
`)),console.groupEnd()}}function debugTree(instance){var indent=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(__DEBUG__){var name=(instance.kind!==VIRTUAL_INSTANCE?getDisplayNameForFiber(instance.data):instance.data.name)||"";console.log(" ".repeat(indent)+"- "+(instance.kind===FILTERED_FIBER_INSTANCE?0:instance.id)+" ("+name+")","parent",instance.parent===null?" ":instance.parent.kind===FILTERED_FIBER_INSTANCE?0:instance.parent.id,"next",instance.nextSibling===null?" ":instance.nextSibling.id);var child=instance.firstChild;while(child!==null)debugTree(child,indent+1),child=child.nextSibling}}var hideElementsWithDisplayNames=new Set,hideElementsWithPaths=new Set,hideElementsWithTypes=new Set,hideElementsWithEnvs=new Set,traceUpdatesEnabled=!1,traceUpdatesForNodes=new Set;function applyComponentFilters(componentFilters){hideElementsWithTypes.clear(),hideElementsWithDisplayNames.clear(),hideElementsWithPaths.clear(),hideElementsWithEnvs.clear(),componentFilters.forEach(function(componentFilter){if(!componentFilter.isEnabled)return;switch(componentFilter.type){case ComponentFilterDisplayName:if(componentFilter.isValid&&componentFilter.value!=="")hideElementsWithDisplayNames.add(new RegExp(componentFilter.value,"i"));break;case ComponentFilterElementType:hideElementsWithTypes.add(componentFilter.value);break;case ComponentFilterLocation:if(componentFilter.isValid&&componentFilter.value!=="")hideElementsWithPaths.add(new RegExp(componentFilter.value,"i"));break;case ComponentFilterHOC:hideElementsWithDisplayNames.add(new RegExp("\\("));break;case ComponentFilterEnvironmentName:hideElementsWithEnvs.add(componentFilter.value);break;default:console.warn('Invalid component filter type "'.concat(componentFilter.type,'"'));break}})}if(window.__REACT_DEVTOOLS_COMPONENT_FILTERS__!=null){var componentFiltersWithoutLocationBasedOnes=filterOutLocationComponentFilters(window.__REACT_DEVTOOLS_COMPONENT_FILTERS__);applyComponentFilters(componentFiltersWithoutLocationBasedOnes)}else applyComponentFilters(getDefaultComponentFilters());function updateComponentFilters(componentFilters){if(isProfiling)throw Error("Cannot modify filter preferences while profiling");hook.getFiberRoots(rendererID).forEach(function(root){var rootInstance=rootToFiberInstanceMap.get(root);if(rootInstance===void 0)throw Error("Expected the root instance to already exist when applying filters");currentRoot=rootInstance,unmountInstanceRecursively(rootInstance),rootToFiberInstanceMap.delete(root),flushPendingEvents(),currentRoot=null}),applyComponentFilters(componentFilters),rootDisplayNameCounter.clear(),hook.getFiberRoots(rendererID).forEach(function(root){var current=root.current,newRoot=createFiberInstance(current);if(rootToFiberInstanceMap.set(root,newRoot),idToDevToolsInstanceMap.set(newRoot.id,newRoot),trackedPath!==null)mightBeOnTrackedPath=!0;currentRoot=newRoot,setRootPseudoKey(currentRoot.id,root.current),mountFiberRecursively(root.current,!1),flushPendingEvents(),currentRoot=null}),flushPendingEvents(),needsToFlushComponentLogs=!1}function getEnvironmentNames(){return Array.from(knownEnvironmentNames)}function isFiberHydrated(fiber){if(OffscreenComponent===-1)throw Error("not implemented for legacy suspense");switch(fiber.tag){case HostRoot:var rootState=fiber.memoizedState;return!rootState.isDehydrated;case SuspenseComponent:var suspenseState=fiber.memoizedState;return suspenseState===null||suspenseState.dehydrated===null;default:throw Error("not implemented for work tag "+fiber.tag)}}function shouldFilterVirtual(data,secondaryEnv){if(hideElementsWithTypes.has(types_ElementTypeFunction))return!0;if(hideElementsWithDisplayNames.size>0){var displayName=data.name;if(displayName!=null){var _iterator4=_createForOfIteratorHelper(hideElementsWithDisplayNames),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var displayNameRegExp=_step4.value;if(displayNameRegExp.test(displayName))return!0}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}}}if((data.env==null||hideElementsWithEnvs.has(data.env))&&(secondaryEnv===null||hideElementsWithEnvs.has(secondaryEnv)))return!0;return!1}function shouldFilterFiber(fiber){var{tag,type,key}=fiber;switch(tag){case DehydratedSuspenseComponent:return!0;case HostPortal:case HostText:case LegacyHiddenComponent:case OffscreenComponent:case Throw:return!0;case HostRoot:return!1;case Fragment:return key===null;default:var typeSymbol=getTypeSymbol(type);switch(typeSymbol){case CONCURRENT_MODE_NUMBER:case CONCURRENT_MODE_SYMBOL_STRING:case DEPRECATED_ASYNC_MODE_SYMBOL_STRING:case STRICT_MODE_NUMBER:case STRICT_MODE_SYMBOL_STRING:return!0;default:break}}var elementType=getElementTypeForFiber(fiber);if(hideElementsWithTypes.has(elementType))return!0;if(hideElementsWithDisplayNames.size>0){var displayName=getDisplayNameForFiber(fiber);if(displayName!=null){var _iterator5=_createForOfIteratorHelper(hideElementsWithDisplayNames),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var displayNameRegExp=_step5.value;if(displayNameRegExp.test(displayName))return!0}}catch(err){_iterator5.e(err)}finally{_iterator5.f()}}}if(hideElementsWithEnvs.has("Client"))switch(tag){case ClassComponent:case IncompleteClassComponent:case IncompleteFunctionComponent:case FunctionComponent:case IndeterminateComponent:case ForwardRef:case MemoComponent:case SimpleMemoComponent:return!0}return!1}function getElementTypeForFiber(fiber){var{type,tag}=fiber;switch(tag){case ActivityComponent:return ElementTypeActivity;case ClassComponent:case IncompleteClassComponent:return types_ElementTypeClass;case IncompleteFunctionComponent:case FunctionComponent:case IndeterminateComponent:return types_ElementTypeFunction;case ForwardRef:return types_ElementTypeForwardRef;case HostRoot:return ElementTypeRoot;case HostComponent:case HostHoistable:case HostSingleton:return ElementTypeHostComponent;case HostPortal:case HostText:case Fragment:return ElementTypeOtherOrUnknown;case MemoComponent:case SimpleMemoComponent:return types_ElementTypeMemo;case SuspenseComponent:return ElementTypeSuspense;case SuspenseListComponent:return ElementTypeSuspenseList;case TracingMarkerComponent:return ElementTypeTracingMarker;case ViewTransitionComponent:return ElementTypeViewTransition;default:var typeSymbol=getTypeSymbol(type);switch(typeSymbol){case CONCURRENT_MODE_NUMBER:case CONCURRENT_MODE_SYMBOL_STRING:case DEPRECATED_ASYNC_MODE_SYMBOL_STRING:return ElementTypeOtherOrUnknown;case PROVIDER_NUMBER:case PROVIDER_SYMBOL_STRING:return ElementTypeContext;case CONTEXT_NUMBER:case CONTEXT_SYMBOL_STRING:return ElementTypeContext;case STRICT_MODE_NUMBER:case STRICT_MODE_SYMBOL_STRING:return ElementTypeOtherOrUnknown;case PROFILER_NUMBER:case PROFILER_SYMBOL_STRING:return ElementTypeProfiler;default:return ElementTypeOtherOrUnknown}}}var currentRoot=null;function untrackFiber(nearestInstance,fiber){if(forceErrorForFibers.size>0){if(forceErrorForFibers.delete(fiber),fiber.alternate)forceErrorForFibers.delete(fiber.alternate);if(forceErrorForFibers.size===0&&setErrorHandler!=null)setErrorHandler(shouldErrorFiberAlwaysNull)}if(forceFallbackForFibers.size>0){if(forceFallbackForFibers.delete(fiber),fiber.alternate)forceFallbackForFibers.delete(fiber.alternate);if(forceFallbackForFibers.size===0&&setSuspenseHandler!=null)setSuspenseHandler(shouldSuspendFiberAlwaysFalse)}if(fiber.tag===HostHoistable)releaseHostResource(nearestInstance,fiber.memoizedState);else if(fiber.tag===HostComponent||fiber.tag===HostText||fiber.tag===HostSingleton)releaseHostInstance(nearestInstance,fiber.stateNode);for(var child=fiber.child;child!==null;child=child.sibling)if(shouldFilterFiber(child))untrackFiber(nearestInstance,child)}function getChangeDescription(prevFiber,nextFiber){switch(nextFiber.tag){case ClassComponent:if(prevFiber===null)return{context:null,didHooksChange:!1,isFirstMount:!0,props:null,state:null};else{var data={context:getContextChanged(prevFiber,nextFiber),didHooksChange:!1,isFirstMount:!1,props:getChangedKeys(prevFiber.memoizedProps,nextFiber.memoizedProps),state:getChangedKeys(prevFiber.memoizedState,nextFiber.memoizedState)};return data}case IncompleteFunctionComponent:case FunctionComponent:case IndeterminateComponent:case ForwardRef:case MemoComponent:case SimpleMemoComponent:if(prevFiber===null)return{context:null,didHooksChange:!1,isFirstMount:!0,props:null,state:null};else{var indices=getChangedHooksIndices(prevFiber.memoizedState,nextFiber.memoizedState),_data={context:getContextChanged(prevFiber,nextFiber),didHooksChange:indices!==null&&indices.length>0,isFirstMount:!1,props:getChangedKeys(prevFiber.memoizedProps,nextFiber.memoizedProps),state:null,hooks:indices};return _data}default:return null}}function getContextChanged(prevFiber,nextFiber){var prevContext=prevFiber.dependencies&&prevFiber.dependencies.firstContext,nextContext=nextFiber.dependencies&&nextFiber.dependencies.firstContext;while(prevContext&&nextContext){if(prevContext.context!==nextContext.context)return!1;if(!shared_objectIs(prevContext.memoizedValue,nextContext.memoizedValue))return!0;prevContext=prevContext.next,nextContext=nextContext.next}return!1}function isHookThatCanScheduleUpdate(hookObject){var queue=hookObject.queue;if(!queue)return!1;var boundHasOwnProperty=shared_hasOwnProperty.bind(queue);if(boundHasOwnProperty("pending"))return!0;return boundHasOwnProperty("value")&&boundHasOwnProperty("getSnapshot")&&typeof queue.getSnapshot==="function"}function didStatefulHookChange(prev,next){var prevMemoizedState=prev.memoizedState,nextMemoizedState=next.memoizedState;if(isHookThatCanScheduleUpdate(prev))return prevMemoizedState!==nextMemoizedState;return!1}function getChangedHooksIndices(prev,next){if(prev==null||next==null)return null;var indices=[],index=0;while(next!==null){if(didStatefulHookChange(prev,next))indices.push(index);next=next.next,prev=prev.next,index++}return indices}function getChangedKeys(prev,next){if(prev==null||next==null)return null;var keys=new Set([].concat(fiber_renderer_toConsumableArray(Object.keys(prev)),fiber_renderer_toConsumableArray(Object.keys(next)))),changedKeys=[],_iterator6=_createForOfIteratorHelper(keys),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var key=_step6.value;if(prev[key]!==next[key])changedKeys.push(key)}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}return changedKeys}function didFiberRender(prevFiber,nextFiber){switch(nextFiber.tag){case ClassComponent:case FunctionComponent:case ContextConsumer:case MemoComponent:case SimpleMemoComponent:case ForwardRef:var PerformedWork=1;return(getFiberFlags(nextFiber)&PerformedWork)===PerformedWork;default:return prevFiber.memoizedProps!==nextFiber.memoizedProps||prevFiber.memoizedState!==nextFiber.memoizedState||prevFiber.ref!==nextFiber.ref}}var pendingOperations=[],pendingRealUnmountedIDs=[],pendingRealUnmountedSuspenseIDs=[],pendingSuspenderChanges=new Set,pendingOperationsQueue=[],pendingStringTable=new Map,pendingStringTableLength=0,pendingUnmountedRootID=null;function pushOperation(op){pendingOperations.push(op)}function shouldBailoutWithPendingOperations(){if(isProfiling){if(currentCommitProfilingMetadata!=null&¤tCommitProfilingMetadata.durations.length>0)return!1}return pendingOperations.length===0&&pendingRealUnmountedIDs.length===0&&pendingRealUnmountedSuspenseIDs.length===0&&pendingSuspenderChanges.size===0&&pendingUnmountedRootID===null}function flushOrQueueOperations(operations){if(shouldBailoutWithPendingOperations())return;if(pendingOperationsQueue!==null)pendingOperationsQueue.push(operations);else hook.emit("operations",operations)}function recordConsoleLogs(instance,componentLogsEntry){if(componentLogsEntry===void 0){if(instance.logCount===0)return!1;return instance.logCount=0,pushOperation(TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS),pushOperation(instance.id),pushOperation(0),pushOperation(0),!0}else{var totalCount=componentLogsEntry.errorsCount+componentLogsEntry.warningsCount;if(instance.logCount===totalCount)return!1;return instance.logCount=totalCount,pushOperation(TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS),pushOperation(instance.id),pushOperation(componentLogsEntry.errorsCount),pushOperation(componentLogsEntry.warningsCount),!0}}function flushPendingEvents(){if(shouldBailoutWithPendingOperations())return;var numUnmountIDs=pendingRealUnmountedIDs.length+(pendingUnmountedRootID===null?0:1),numUnmountSuspenseIDs=pendingRealUnmountedSuspenseIDs.length,numSuspenderChanges=pendingSuspenderChanges.size,operations=Array(3+pendingStringTableLength+(numUnmountSuspenseIDs>0?2+numUnmountSuspenseIDs:0)+(numUnmountIDs>0?2+numUnmountIDs:0)+pendingOperations.length+(numSuspenderChanges>0?2+numSuspenderChanges*3:0)),i=0;if(operations[i++]=rendererID,currentRoot===null)operations[i++]=-1;else operations[i++]=currentRoot.id;if(operations[i++]=pendingStringTableLength,pendingStringTable.forEach(function(entry,stringKey){var encodedString=entry.encodedString,length=encodedString.length;operations[i++]=length;for(var j2=0;j2<length;j2++)operations[i+j2]=encodedString[j2];i+=length}),numUnmountSuspenseIDs>0){operations[i++]=SUSPENSE_TREE_OPERATION_REMOVE,operations[i++]=numUnmountSuspenseIDs;for(var j=0;j<pendingRealUnmountedSuspenseIDs.length;j++)operations[i++]=pendingRealUnmountedSuspenseIDs[j]}if(numUnmountIDs>0){operations[i++]=TREE_OPERATION_REMOVE,operations[i++]=numUnmountIDs;for(var _j=0;_j<pendingRealUnmountedIDs.length;_j++)operations[i++]=pendingRealUnmountedIDs[_j];if(pendingUnmountedRootID!==null)operations[i]=pendingUnmountedRootID,i++}for(var _j2=0;_j2<pendingOperations.length;_j2++)operations[i+_j2]=pendingOperations[_j2];if(i+=pendingOperations.length,numSuspenderChanges>0)operations[i++]=SUSPENSE_TREE_OPERATION_SUSPENDERS,operations[i++]=numSuspenderChanges,pendingSuspenderChanges.forEach(function(fiberIdWithChanges){var suspense=idToSuspenseNodeMap.get(fiberIdWithChanges);if(suspense===void 0)throw Error('Could not send suspender changes for "'.concat(fiberIdWithChanges,'" since the Fiber no longer exists.'));operations[i++]=fiberIdWithChanges,operations[i++]=suspense.hasUniqueSuspenders?1:0;var instance=suspense.instance,isSuspended=(instance.kind===FIBER_INSTANCE||instance.kind===FILTERED_FIBER_INSTANCE)&&instance.data.tag===SuspenseComponent&&instance.data.memoizedState!==null;operations[i++]=isSuspended?1:0,operations[i++]=suspense.environments.size,suspense.environments.forEach(function(count,env){operations[i++]=getStringID(env)})});flushOrQueueOperations(operations),pendingOperations.length=0,pendingRealUnmountedIDs.length=0,pendingRealUnmountedSuspenseIDs.length=0,pendingSuspenderChanges.clear(),pendingUnmountedRootID=null,pendingStringTable.clear(),pendingStringTableLength=0}function measureHostInstance(instance){if(renderer_typeof(instance)!=="object"||instance===null)return null;if(typeof instance.getClientRects==="function"||instance.nodeType===3){var doc=instance.ownerDocument;if(instance===doc.documentElement)return[{x:0,y:0,width:instance.scrollWidth,height:instance.scrollHeight}];var result=[],win=doc&&doc.defaultView,scrollX=win?win.scrollX:0,scrollY=win?win.scrollY:0,rects;if(instance.nodeType===3){if(typeof doc.createRange!=="function")return null;var range=doc.createRange();if(typeof range.getClientRects!=="function")return null;range.selectNodeContents(instance),rects=range.getClientRects()}else rects=instance.getClientRects();for(var i=0;i<rects.length;i++){var rect=rects[i];result.push({x:rect.x+scrollX,y:rect.y+scrollY,width:rect.width,height:rect.height})}return result}if(instance.canonical){var publicInstance=instance.canonical.publicInstance;if(!publicInstance)return null;if(typeof publicInstance.getBoundingClientRect==="function")return[publicInstance.getBoundingClientRect()];if(typeof publicInstance.unstable_getBoundingClientRect==="function")return[publicInstance.unstable_getBoundingClientRect()]}return null}function measureInstance(instance){var hostInstances=findAllCurrentHostInstances(instance),result=null;for(var i=0;i<hostInstances.length;i++){var childResult=measureHostInstance(hostInstances[i]);if(childResult!==null)if(result===null)result=childResult;else result=result.concat(childResult)}return result}function getStringID(string){if(string===null)return 0;var existingEntry=pendingStringTable.get(string);if(existingEntry!==void 0)return existingEntry.id;var id=pendingStringTable.size+1,encodedString=utfEncodeString(string);return pendingStringTable.set(string,{encodedString,id}),pendingStringTableLength+=encodedString.length+1,id}var isInDisconnectedSubtree=!1;function recordMount(fiber,parentInstance){var isRoot=fiber.tag===HostRoot,fiberInstance;if(isRoot){var entry=rootToFiberInstanceMap.get(fiber.stateNode);if(entry===void 0)throw Error("The root should have been registered at this point");fiberInstance=entry}else fiberInstance=createFiberInstance(fiber);if(idToDevToolsInstanceMap.set(fiberInstance.id,fiberInstance),__DEBUG__)debug2("recordMount()",fiberInstance,parentInstance);return recordReconnect(fiberInstance,parentInstance),fiberInstance}function recordReconnect(fiberInstance,parentInstance){if(isInDisconnectedSubtree)return;var{id,data:fiber}=fiberInstance,isProfilingSupported=fiber.hasOwnProperty("treeBaseDuration"),isRoot=fiber.tag===HostRoot;if(isRoot){var hasOwnerMetadata=fiber.hasOwnProperty("_debugOwner"),profilingFlags=0;if(isProfilingSupported){if(profilingFlags=PROFILING_FLAG_BASIC_SUPPORT,typeof injectProfilingHooks==="function")profilingFlags|=PROFILING_FLAG_TIMELINE_SUPPORT;if(supportsPerformanceTracks)profilingFlags|=PROFILING_FLAG_PERFORMANCE_TRACKS_SUPPORT}var isProductionBuildOfRenderer=renderer.bundleType===0;if(pushOperation(TREE_OPERATION_ADD),pushOperation(id),pushOperation(ElementTypeRoot),pushOperation((fiber.mode&StrictModeBits)!==0?1:0),pushOperation(profilingFlags),pushOperation(!isProductionBuildOfRenderer&&StrictModeBits!==0?1:0),pushOperation(hasOwnerMetadata?1:0),isProfiling){if(displayNamesByRootID!==null)displayNamesByRootID.set(id,getDisplayNameForRoot(fiber))}}else{var key=fiber.key,displayName=getDisplayNameForFiber(fiber),elementType=getElementTypeForFiber(fiber),debugOwner=getUnfilteredOwner(fiber),ownerInstance=findNearestOwnerInstance(parentInstance,debugOwner);if(ownerInstance!==null&&debugOwner===fiber._debugOwner&&fiber._debugStack!=null&&ownerInstance.source===null)ownerInstance.source=fiber._debugStack;var unfilteredParent=parentInstance;while(unfilteredParent!==null&&unfilteredParent.kind===FILTERED_FIBER_INSTANCE)unfilteredParent=unfilteredParent.parent;var ownerID=ownerInstance===null?0:ownerInstance.id,parentID=unfilteredParent===null?0:unfilteredParent.id,displayNameStringID=getStringID(displayName),keyString=key===null?null:String(key),keyStringID=getStringID(keyString),nameProp=fiber.tag===SuspenseComponent?fiber.memoizedProps.name:fiber.tag===ActivityComponent?fiber.memoizedProps.name:null,namePropString=nameProp==null?null:String(nameProp),namePropStringID=getStringID(namePropString);if(pushOperation(TREE_OPERATION_ADD),pushOperation(id),pushOperation(elementType),pushOperation(parentID),pushOperation(ownerID),pushOperation(displayNameStringID),pushOperation(keyStringID),pushOperation(namePropStringID),(fiber.mode&StrictModeBits)!==0){var parentFiber=null,parentFiberInstance=parentInstance;while(parentFiberInstance!==null){if(parentFiberInstance.kind===FIBER_INSTANCE){parentFiber=parentFiberInstance.data;break}parentFiberInstance=parentFiberInstance.parent}if(parentFiber===null||(parentFiber.mode&StrictModeBits)===0)pushOperation(TREE_OPERATION_SET_SUBTREE_MODE),pushOperation(id),pushOperation(StrictMode)}}var componentLogsEntry=fiberToComponentLogsMap.get(fiber);if(componentLogsEntry===void 0&&fiber.alternate!==null)componentLogsEntry=fiberToComponentLogsMap.get(fiber.alternate);if(recordConsoleLogs(fiberInstance,componentLogsEntry),isProfilingSupported)recordProfilingDurations(fiberInstance,null)}function recordVirtualMount(instance,parentInstance,secondaryEnv){var id=instance.id;idToDevToolsInstanceMap.set(id,instance),recordVirtualReconnect(instance,parentInstance,secondaryEnv)}function recordVirtualReconnect(instance,parentInstance,secondaryEnv){if(isInDisconnectedSubtree)return;var componentInfo=instance.data,key=typeof componentInfo.key==="string"?componentInfo.key:null,env=componentInfo.env,displayName=componentInfo.name||"";if(typeof env==="string"){if(secondaryEnv!==null)displayName=secondaryEnv+"("+displayName+")";displayName=env+"("+displayName+")"}var elementType=types_ElementTypeVirtual,debugOwner=getUnfilteredOwner(componentInfo),ownerInstance=findNearestOwnerInstance(parentInstance,debugOwner);if(ownerInstance!==null&&debugOwner===componentInfo.owner&&componentInfo.debugStack!=null&&ownerInstance.source===null)ownerInstance.source=componentInfo.debugStack;var unfilteredParent=parentInstance;while(unfilteredParent!==null&&unfilteredParent.kind===FILTERED_FIBER_INSTANCE)unfilteredParent=unfilteredParent.parent;var ownerID=ownerInstance===null?0:ownerInstance.id,parentID=unfilteredParent===null?0:unfilteredParent.id,displayNameStringID=getStringID(displayName),keyString=key===null?null:String(key),keyStringID=getStringID(keyString),namePropStringID=getStringID(null),id=instance.id;pushOperation(TREE_OPERATION_ADD),pushOperation(id),pushOperation(elementType),pushOperation(parentID),pushOperation(ownerID),pushOperation(displayNameStringID),pushOperation(keyStringID),pushOperation(namePropStringID);var componentLogsEntry=componentInfoToComponentLogsMap.get(componentInfo);recordConsoleLogs(instance,componentLogsEntry)}function recordSuspenseMount(suspenseInstance,parentSuspenseInstance){var fiberInstance=suspenseInstance.instance;if(fiberInstance.kind===FILTERED_FIBER_INSTANCE)throw Error("Cannot record a mount for a filtered Fiber instance.");var fiberID=fiberInstance.id,unfilteredParent=parentSuspenseInstance;while(unfilteredParent!==null&&unfilteredParent.instance.kind===FILTERED_FIBER_INSTANCE)unfilteredParent=unfilteredParent.parent;var unfilteredParentInstance=unfilteredParent!==null?unfilteredParent.instance:null;if(unfilteredParentInstance!==null&&unfilteredParentInstance.kind===FILTERED_FIBER_INSTANCE)throw Error("Should not have a filtered instance at this point. This is a bug.");var parentID=unfilteredParentInstance===null?0:unfilteredParentInstance.id,fiber=fiberInstance.data,props=fiber.memoizedProps,name=fiber.tag!==SuspenseComponent||props===null?null:props.name||null,nameStringID=getStringID(name),isSuspended=fiber.tag===SuspenseComponent&&fiber.memoizedState!==null;if(__DEBUG__)console.log("recordSuspenseMount()",suspenseInstance);idToSuspenseNodeMap.set(fiberID,suspenseInstance),pushOperation(SUSPENSE_TREE_OPERATION_ADD),pushOperation(fiberID),pushOperation(parentID),pushOperation(nameStringID),pushOperation(isSuspended?1:0);var rects=suspenseInstance.rects;if(rects===null)pushOperation(-1);else{pushOperation(rects.length);for(var i=0;i<rects.length;++i){var rect=rects[i];pushOperation(Math.round(rect.x*1000)),pushOperation(Math.round(rect.y*1000)),pushOperation(Math.round(rect.width*1000)),pushOperation(Math.round(rect.height*1000))}}}function recordUnmount(fiberInstance){if(__DEBUG__)debug2("recordUnmount()",fiberInstance,reconcilingParent);recordDisconnect(fiberInstance);var suspenseNode=fiberInstance.suspenseNode;if(suspenseNode!==null)recordSuspenseUnmount(suspenseNode);idToDevToolsInstanceMap.delete(fiberInstance.id),untrackFiber(fiberInstance,fiberInstance.data)}function recordDisconnect(fiberInstance){if(isInDisconnectedSubtree)return;var fiber=fiberInstance.data;if(trackedPathMatchInstance===fiberInstance)setTrackedPath(null);var id=fiberInstance.id,isRoot=fiber.tag===HostRoot;if(isRoot)pendingUnmountedRootID=id;else pendingRealUnmountedIDs.push(id)}function recordSuspenseResize(suspenseNode){if(__DEBUG__)console.log("recordSuspenseResize()",suspenseNode);var fiberInstance=suspenseNode.instance;if(fiberInstance.kind!==FIBER_INSTANCE)return;pushOperation(SUSPENSE_TREE_OPERATION_RESIZE),pushOperation(fiberInstance.id);var rects=suspenseNode.rects;if(rects===null)pushOperation(-1);else{pushOperation(rects.length);for(var i=0;i<rects.length;++i){var rect=rects[i];pushOperation(Math.round(rect.x*1000)),pushOperation(Math.round(rect.y*1000)),pushOperation(Math.round(rect.width*1000)),pushOperation(Math.round(rect.height*1000))}}}function recordSuspenseSuspenders(suspenseNode){if(__DEBUG__)console.log("recordSuspenseSuspenders()",suspenseNode);var fiberInstance=suspenseNode.instance;if(fiberInstance.kind!==FIBER_INSTANCE)return;suspenseNode.environments.forEach(function(count,env){getStringID(env)}),pendingSuspenderChanges.add(fiberInstance.id)}function recordSuspenseUnmount(suspenseInstance){if(__DEBUG__)console.log("recordSuspenseUnmount()",suspenseInstance,reconcilingParentSuspenseNode);var devtoolsInstance=suspenseInstance.instance;if(devtoolsInstance.kind!==FIBER_INSTANCE)throw Error("Can't unmount a filtered SuspenseNode. This is a bug.");var fiberInstance=devtoolsInstance,id=fiberInstance.id;pendingRealUnmountedSuspenseIDs.push(id),pendingSuspenderChanges.delete(id),idToSuspenseNodeMap.delete(id)}var remainingReconcilingChildren=null,previouslyReconciledSibling=null,reconcilingParent=null,remainingReconcilingChildrenSuspenseNodes=null,previouslyReconciledSiblingSuspenseNode=null,reconcilingParentSuspenseNode=null;function ioExistsInSuspenseAncestor(suspenseNode,ioInfo){var ancestor=suspenseNode.parent;while(ancestor!==null){if(ancestor.suspendedBy.has(ioInfo))return!0;ancestor=ancestor.parent}return!1}function insertSuspendedBy(asyncInfo){if(reconcilingParent===null||reconcilingParentSuspenseNode===null)throw Error("It should not be possible to have suspended data outside the root. Even suspending at the first position is still a child of the root.");var parentSuspenseNode=reconcilingParentSuspenseNode,parentInstance=reconcilingParent;while(parentInstance.kind===FILTERED_FIBER_INSTANCE&&parentInstance.parent!==null&&parentInstance!==parentSuspenseNode.instance)parentInstance=parentInstance.parent;var suspenseNodeSuspendedBy=parentSuspenseNode.suspendedBy,ioInfo=asyncInfo.awaited,suspendedBySet=suspenseNodeSuspendedBy.get(ioInfo);if(suspendedBySet===void 0){suspendedBySet=new Set,suspenseNodeSuspendedBy.set(ioInfo,suspendedBySet);var env=ioInfo.env;if(env!=null){var environmentCounts=parentSuspenseNode.environments,count=environmentCounts.get(env);if(count===void 0||count===0)environmentCounts.set(env,1),recordSuspenseSuspenders(parentSuspenseNode);else environmentCounts.set(env,count+1)}}if(!suspendedBySet.has(parentInstance)){if(suspendedBySet.add(parentInstance),!parentSuspenseNode.hasUniqueSuspenders&&!ioExistsInSuspenseAncestor(parentSuspenseNode,ioInfo))parentSuspenseNode.hasUniqueSuspenders=!0,recordSuspenseSuspenders(parentSuspenseNode)}parentSuspenseNode.hasUnknownSuspenders=!1;var suspendedBy=parentInstance.suspendedBy;if(suspendedBy===null)parentInstance.suspendedBy=[asyncInfo];else if(suspendedBy.indexOf(asyncInfo)===-1)suspendedBy.push(asyncInfo)}function getAwaitInSuspendedByFromIO(suspensedBy,ioInfo){for(var i=0;i<suspensedBy.length;i++){var asyncInfo=suspensedBy[i];if(asyncInfo.awaited===ioInfo)return asyncInfo}return null}function unblockSuspendedBy(parentSuspenseNode,ioInfo){var firstChild=parentSuspenseNode.firstChild;if(firstChild===null)return;var node=firstChild;while(node!==null){if(node.suspendedBy.has(ioInfo)){if(!node.hasUniqueSuspenders)recordSuspenseSuspenders(node);node.hasUniqueSuspenders=!0,node.hasUnknownSuspenders=!1}else if(node.firstChild!==null){node=node.firstChild;continue}while(node.nextSibling===null){if(node.parent===null||node.parent===parentSuspenseNode)return;node=node.parent}node=node.nextSibling}}function removePreviousSuspendedBy(instance,previousSuspendedBy,parentSuspenseNode){var suspenseNode=instance.suspenseNode===null?parentSuspenseNode:instance.suspenseNode;if(previousSuspendedBy!==null&&suspenseNode!==null){var nextSuspendedBy=instance.suspendedBy,changedEnvironment=!1;for(var i=0;i<previousSuspendedBy.length;i++){var asyncInfo=previousSuspendedBy[i];if(nextSuspendedBy===null||nextSuspendedBy.indexOf(asyncInfo)===-1&&getAwaitInSuspendedByFromIO(nextSuspendedBy,asyncInfo.awaited)===null){var ioInfo=asyncInfo.awaited,suspendedBySet=suspenseNode.suspendedBy.get(ioInfo);if(suspendedBySet===void 0||!suspendedBySet.delete(instance)){var alreadyRemovedIO=!1;for(var j=0;j<i;j++){var removedIOInfo=previousSuspendedBy[j].awaited;if(removedIOInfo===ioInfo){alreadyRemovedIO=!0;break}}if(!alreadyRemovedIO)throw Error("We are cleaning up async info that was not on the parent Suspense boundary. This is a bug in React.")}if(suspendedBySet!==void 0&&suspendedBySet.size===0){suspenseNode.suspendedBy.delete(ioInfo);var env=ioInfo.env;if(env!=null){var environmentCounts=suspenseNode.environments,count=environmentCounts.get(env);if(count===void 0||count===0)throw Error("We are removing an environment but it was not in the set. ");if(count===1)environmentCounts.delete(env),changedEnvironment=!0;else environmentCounts.set(env,count-1)}}if(suspenseNode.hasUniqueSuspenders&&!ioExistsInSuspenseAncestor(suspenseNode,ioInfo))unblockSuspendedBy(suspenseNode,ioInfo)}}if(changedEnvironment)recordSuspenseSuspenders(suspenseNode)}}function insertChild(instance){var parentInstance=reconcilingParent;if(parentInstance===null)return;if(instance.parent=parentInstance,previouslyReconciledSibling===null)previouslyReconciledSibling=instance,parentInstance.firstChild=instance;else previouslyReconciledSibling.nextSibling=instance,previouslyReconciledSibling=instance;instance.nextSibling=null;var suspenseNode=instance.suspenseNode;if(suspenseNode!==null){var parentNode=reconcilingParentSuspenseNode;if(parentNode!==null){if(suspenseNode.parent=parentNode,previouslyReconciledSiblingSuspenseNode===null)previouslyReconciledSiblingSuspenseNode=suspenseNode,parentNode.firstChild=suspenseNode;else previouslyReconciledSiblingSuspenseNode.nextSibling=suspenseNode,previouslyReconciledSiblingSuspenseNode=suspenseNode;suspenseNode.nextSibling=null}}}function moveChild(instance,previousSibling){removeChild(instance,previousSibling),insertChild(instance)}function removeChild(instance,previousSibling){if(instance.parent===null){if(remainingReconcilingChildren===instance)throw Error("Remaining children should not have items with no parent");else if(instance.nextSibling!==null)throw Error("A deleted instance should not have next siblings");return}var parentInstance=reconcilingParent;if(parentInstance===null)throw Error("Should not have a parent if we are at the root");if(instance.parent!==parentInstance)throw Error("Cannot remove a node from a different parent than is being reconciled.");if(previousSibling===null){if(remainingReconcilingChildren!==instance)throw Error("Expected a placed child to be moved from the remaining set.");remainingReconcilingChildren=instance.nextSibling}else previousSibling.nextSibling=instance.nextSibling;instance.nextSibling=null,instance.parent=null;var suspenseNode=instance.suspenseNode;if(suspenseNode!==null&&suspenseNode.parent!==null){var parentNode=reconcilingParentSuspenseNode;if(parentNode===null)throw Error("Should not have a parent if we are at the root");if(suspenseNode.parent!==parentNode)throw Error("Cannot remove a Suspense node from a different parent than is being reconciled.");var previousSuspenseSibling=remainingReconcilingChildrenSuspenseNodes;if(previousSuspenseSibling===suspenseNode)remainingReconcilingChildrenSuspenseNodes=suspenseNode.nextSibling;else while(previousSuspenseSibling!==null){if(previousSuspenseSibling.nextSibling===suspenseNode){previousSuspenseSibling.nextSibling=suspenseNode.nextSibling;break}previousSuspenseSibling=previousSuspenseSibling.nextSibling}suspenseNode.nextSibling=null,suspenseNode.parent=null}}function isHiddenOffscreen(fiber){switch(fiber.tag){case LegacyHiddenComponent:case OffscreenComponent:return fiber.memoizedState!==null;default:return!1}}function isSuspendedOffscreen(fiber){switch(fiber.tag){case LegacyHiddenComponent:case OffscreenComponent:return fiber.memoizedState!==null&&fiber.return!==null&&fiber.return.tag===SuspenseComponent;default:return!1}}function unmountRemainingChildren(){if(reconcilingParent!==null&&(reconcilingParent.kind===FIBER_INSTANCE||reconcilingParent.kind===FILTERED_FIBER_INSTANCE)&&isSuspendedOffscreen(reconcilingParent.data)&&!isInDisconnectedSubtree){isInDisconnectedSubtree=!0;try{var child=remainingReconcilingChildren;while(child!==null)unmountInstanceRecursively(child),child=remainingReconcilingChildren}finally{isInDisconnectedSubtree=!1}}else{var _child=remainingReconcilingChildren;while(_child!==null)unmountInstanceRecursively(_child),_child=remainingReconcilingChildren}}function unmountSuspenseChildrenRecursively(contentInstance,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining){unmountInstanceRecursively(contentInstance),reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining,unmountRemainingChildren()}function isChildOf(parentInstance,childInstance,grandParent){var instance=childInstance.parent;while(instance!==null){if(parentInstance===instance)return!0;if(instance===parentInstance.parent||instance===grandParent)break;instance=instance.parent}return!1}function areEqualRects(a,b){if(a===null)return b===null;if(b===null)return!1;if(a.length!==b.length)return!1;for(var i=0;i<a.length;i++){var aRect=a[i],bRect=b[i];if(aRect.x!==bRect.x||aRect.y!==bRect.y||aRect.width!==bRect.width||aRect.height!==bRect.height)return!1}return!0}function measureUnchangedSuspenseNodesRecursively(suspenseNode){if(isInDisconnectedSubtree)return;var instance=suspenseNode.instance,isSuspendedSuspenseComponent=(instance.kind===FIBER_INSTANCE||instance.kind===FILTERED_FIBER_INSTANCE)&&instance.data.tag===SuspenseComponent&&instance.data.memoizedState!==null;if(isSuspendedSuspenseComponent)return;var parent=instance.parent;while(parent!==null){if((parent.kind===FIBER_INSTANCE||parent.kind===FILTERED_FIBER_INSTANCE)&&isHiddenOffscreen(parent.data))return;if(parent.suspenseNode!==null)break;parent=parent.parent}var nextRects=measureInstance(suspenseNode.instance),prevRects=suspenseNode.rects;if(areEqualRects(prevRects,nextRects))return;for(var child=suspenseNode.firstChild;child!==null;child=child.nextSibling)measureUnchangedSuspenseNodesRecursively(child);suspenseNode.rects=nextRects,recordSuspenseResize(suspenseNode)}function consumeSuspenseNodesOfExistingInstance(instance){var suspenseNode=remainingReconcilingChildrenSuspenseNodes;if(suspenseNode===null)return;var parentSuspenseNode=reconcilingParentSuspenseNode;if(parentSuspenseNode===null)throw Error("The should not be any remaining suspense node children if there is no parent.");var foundOne=!1,previousSkippedSibling=null;while(suspenseNode!==null)if(isChildOf(instance,suspenseNode.instance,parentSuspenseNode.instance)){foundOne=!0;var nextRemainingSibling=suspenseNode.nextSibling;if(previousSkippedSibling===null)remainingReconcilingChildrenSuspenseNodes=nextRemainingSibling;else previousSkippedSibling.nextSibling=nextRemainingSibling;if(suspenseNode.nextSibling=null,previouslyReconciledSiblingSuspenseNode===null)parentSuspenseNode.firstChild=suspenseNode;else previouslyReconciledSiblingSuspenseNode.nextSibling=suspenseNode;previouslyReconciledSiblingSuspenseNode=suspenseNode,measureUnchangedSuspenseNodesRecursively(suspenseNode),suspenseNode=nextRemainingSibling}else if(foundOne)break;else previousSkippedSibling=suspenseNode,suspenseNode=suspenseNode.nextSibling}function mountVirtualInstanceRecursively(virtualInstance,firstChild,lastChild,traceNearestHostComponentUpdate,virtualLevel){var mightSiblingsBeOnTrackedPath=updateVirtualTrackedPathStateBeforeMount(virtualInstance,reconcilingParent),stashedParent=reconcilingParent,stashedPrevious=previouslyReconciledSibling,stashedRemaining=remainingReconcilingChildren;reconcilingParent=virtualInstance,previouslyReconciledSibling=null,remainingReconcilingChildren=null;try{mountVirtualChildrenRecursively(firstChild,lastChild,traceNearestHostComponentUpdate,virtualLevel+1),recordVirtualProfilingDurations(virtualInstance)}finally{reconcilingParent=stashedParent,previouslyReconciledSibling=stashedPrevious,remainingReconcilingChildren=stashedRemaining,updateTrackedPathStateAfterMount(mightSiblingsBeOnTrackedPath)}}function recordVirtualUnmount(instance){recordVirtualDisconnect(instance),idToDevToolsInstanceMap.delete(instance.id)}function recordVirtualDisconnect(instance){if(isInDisconnectedSubtree)return;if(trackedPathMatchInstance===instance)setTrackedPath(null);var id=instance.id;pendingRealUnmountedIDs.push(id)}function getSecondaryEnvironmentName(debugInfo,index){if(debugInfo!=null){var componentInfo=debugInfo[index];for(var i=index+1;i<debugInfo.length;i++){var debugEntry=debugInfo[i];if(typeof debugEntry.env==="string")return componentInfo.env!==debugEntry.env?debugEntry.env:null}}return null}function trackDebugInfoFromLazyType(fiber){var type=fiber.elementType,typeSymbol=getTypeSymbol(type);if(typeSymbol===LAZY_SYMBOL_STRING){var debugInfo=type._debugInfo;if(debugInfo)for(var i=0;i<debugInfo.length;i++){var debugEntry=debugInfo[i];if(debugEntry.awaited){var asyncInfo=debugEntry;insertSuspendedBy(asyncInfo)}}}}function trackDebugInfoFromUsedThenables(fiber){var dependencies=fiber.dependencies;if(dependencies==null)return;var thenableState=dependencies._debugThenableState;if(thenableState==null)return;var usedThenables=thenableState.thenables||thenableState;if(!Array.isArray(usedThenables))return;for(var i=0;i<usedThenables.length;i++){var thenable=usedThenables[i],debugInfo=thenable._debugInfo;if(debugInfo)for(var j=0;j<debugInfo.length;j++){var debugEntry=debugInfo[j];if(debugEntry.awaited){var asyncInfo=debugEntry;insertSuspendedBy(asyncInfo)}}}}var hostAsyncInfoCache=new WeakMap;function trackDebugInfoFromHostResource(devtoolsInstance,fiber){var resource=fiber.memoizedState;if(resource==null)return;var existingEntry=hostAsyncInfoCache.get(resource);if(existingEntry!==void 0){insertSuspendedBy(existingEntry);return}var props=fiber.memoizedProps,mayResourceSuspendCommit=resource.type==="stylesheet"&&(typeof props.media!=="string"||typeof matchMedia!=="function"||matchMedia(props.media));if(!mayResourceSuspendCommit)return;var instance=resource.instance;if(instance==null)return;var href=instance.href;if(typeof href!=="string")return;var start=-1,end=-1,byteSize=0;if(typeof performance.getEntriesByType==="function"){var resourceEntries=performance.getEntriesByType("resource");for(var i=0;i<resourceEntries.length;i++){var resourceEntry=resourceEntries[i];if(resourceEntry.name===href)start=resourceEntry.startTime,end=start+resourceEntry.duration,byteSize=resourceEntry.transferSize||0}}var value=instance.sheet,promise=Promise.resolve(value);promise.status="fulfilled",promise.value=value;var ioInfo={name:"stylesheet",start,end,value:promise,owner:fiber};if(byteSize>0)ioInfo.byteSize=byteSize;var asyncInfo={awaited:ioInfo,owner:fiber._debugOwner==null?null:fiber._debugOwner,debugStack:fiber._debugStack==null?null:fiber._debugStack,debugTask:fiber._debugTask==null?null:fiber._debugTask};hostAsyncInfoCache.set(resource,asyncInfo),insertSuspendedBy(asyncInfo)}function trackDebugInfoFromHostComponent(devtoolsInstance,fiber){if(fiber.tag!==HostComponent)return;if((fiber.mode&SuspenseyImagesMode)===0)return;var{type,memoizedProps:props}=fiber,maySuspendCommit=type==="img"&&props.src!=null&&props.src!==""&&props.onLoad==null&&props.loading!=="lazy";if(!maySuspendCommit)return;var instance=fiber.stateNode;if(instance==null)return;var src=instance.currentSrc;if(typeof src!=="string"||src==="")return;var start=-1,end=-1,byteSize=0,fileSize=0;if(typeof performance.getEntriesByType==="function"){var resourceEntries=performance.getEntriesByType("resource");for(var i=0;i<resourceEntries.length;i++){var resourceEntry=resourceEntries[i];if(resourceEntry.name===src)start=resourceEntry.startTime,end=start+resourceEntry.duration,fileSize=resourceEntry.decodedBodySize||0,byteSize=resourceEntry.transferSize||0}}var value={currentSrc:src};if(instance.naturalWidth>0&&instance.naturalHeight>0)value.naturalWidth=instance.naturalWidth,value.naturalHeight=instance.naturalHeight;if(fileSize>0)value.fileSize=fileSize;var promise=Promise.resolve(value);promise.status="fulfilled",promise.value=value;var ioInfo={name:"img",start,end,value:promise,owner:fiber};if(byteSize>0)ioInfo.byteSize=byteSize;var asyncInfo={awaited:ioInfo,owner:fiber._debugOwner==null?null:fiber._debugOwner,debugStack:fiber._debugStack==null?null:fiber._debugStack,debugTask:fiber._debugTask==null?null:fiber._debugTask};insertSuspendedBy(asyncInfo)}function trackThrownPromisesFromRetryCache(suspenseNode,retryCache){if(retryCache!=null){if(!suspenseNode.hasUniqueSuspenders)recordSuspenseSuspenders(suspenseNode);suspenseNode.hasUniqueSuspenders=!0,suspenseNode.hasUnknownSuspenders=!0}}function mountVirtualChildrenRecursively(firstChild,lastChild,traceNearestHostComponentUpdate,virtualLevel){var fiber=firstChild,previousVirtualInstance=null,previousVirtualInstanceFirstFiber=firstChild;while(fiber!==null&&fiber!==lastChild){var level=0;if(fiber._debugInfo)for(var i=0;i<fiber._debugInfo.length;i++){var debugEntry=fiber._debugInfo[i];if(debugEntry.awaited){var asyncInfo=debugEntry;if(level===virtualLevel)insertSuspendedBy(asyncInfo);continue}if(typeof debugEntry.name!=="string")continue;var componentInfo=debugEntry,secondaryEnv=getSecondaryEnvironmentName(fiber._debugInfo,i);if(componentInfo.env!=null)knownEnvironmentNames.add(componentInfo.env);if(secondaryEnv!==null)knownEnvironmentNames.add(secondaryEnv);if(shouldFilterVirtual(componentInfo,secondaryEnv))continue;if(level===virtualLevel){if(previousVirtualInstance===null||previousVirtualInstance.data!==debugEntry){if(previousVirtualInstance!==null)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceFirstFiber,fiber,traceNearestHostComponentUpdate,virtualLevel);previousVirtualInstance=createVirtualInstance(componentInfo),recordVirtualMount(previousVirtualInstance,reconcilingParent,secondaryEnv),insertChild(previousVirtualInstance),previousVirtualInstanceFirstFiber=fiber}level++;break}else level++}if(level===virtualLevel){if(previousVirtualInstance!==null)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceFirstFiber,fiber,traceNearestHostComponentUpdate,virtualLevel),previousVirtualInstance=null;mountFiberRecursively(fiber,traceNearestHostComponentUpdate)}fiber=fiber.sibling}if(previousVirtualInstance!==null)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceFirstFiber,null,traceNearestHostComponentUpdate,virtualLevel)}function mountChildrenRecursively(firstChild,traceNearestHostComponentUpdate){mountVirtualChildrenRecursively(firstChild,null,traceNearestHostComponentUpdate,0)}function mountSuspenseChildrenRecursively(contentFiber,traceNearestHostComponentUpdate,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining){var fallbackFiber=contentFiber.sibling;if(mountVirtualChildrenRecursively(contentFiber,fallbackFiber,traceNearestHostComponentUpdate,0),reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining,fallbackFiber!==null)mountVirtualChildrenRecursively(fallbackFiber,null,traceNearestHostComponentUpdate,0)}function mountFiberRecursively(fiber,traceNearestHostComponentUpdate){var shouldIncludeInTree=!shouldFilterFiber(fiber),newInstance=null,newSuspenseNode=null;if(shouldIncludeInTree){if(newInstance=recordMount(fiber,reconcilingParent),fiber.tag===SuspenseComponent||fiber.tag===HostRoot){if(newSuspenseNode=createSuspenseNode(newInstance),fiber.tag===SuspenseComponent)if(OffscreenComponent===-1){var isTimedOut=fiber.memoizedState!==null;if(!isTimedOut)newSuspenseNode.rects=measureInstance(newInstance)}else{var hydrated=isFiberHydrated(fiber);if(hydrated){var contentFiber=fiber.child;if(contentFiber===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.")}var _isTimedOut=fiber.memoizedState!==null;if(!_isTimedOut)newSuspenseNode.rects=measureInstance(newInstance)}else newSuspenseNode.rects=measureInstance(newInstance);recordSuspenseMount(newSuspenseNode,reconcilingParentSuspenseNode)}if(insertChild(newInstance),__DEBUG__)debug2("mountFiberRecursively()",newInstance,reconcilingParent)}else if(reconcilingParent!==null&&reconcilingParent.kind===VIRTUAL_INSTANCE||fiber.tag===SuspenseComponent||fiber.tag===OffscreenComponent||fiber.tag===LegacyHiddenComponent){if(reconcilingParent!==null&&reconcilingParent.kind===VIRTUAL_INSTANCE&&reconcilingParent.data===fiber._debugOwner&&fiber._debugStack!=null&&reconcilingParent.source===null)reconcilingParent.source=fiber._debugStack;if(newInstance=createFilteredFiberInstance(fiber),fiber.tag===SuspenseComponent)if(newSuspenseNode=createSuspenseNode(newInstance),OffscreenComponent===-1){var _isTimedOut2=fiber.memoizedState!==null;if(!_isTimedOut2)newSuspenseNode.rects=measureInstance(newInstance)}else{var _hydrated=isFiberHydrated(fiber);if(_hydrated){var _contentFiber=fiber.child;if(_contentFiber===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.")}var suspenseState=fiber.memoizedState,_isTimedOut3=suspenseState!==null;if(!_isTimedOut3)newSuspenseNode.rects=measureInstance(newInstance)}if(insertChild(newInstance),__DEBUG__)debug2("mountFiberRecursively()",newInstance,reconcilingParent)}var mightSiblingsBeOnTrackedPath=updateTrackedPathStateBeforeMount(fiber,newInstance),stashedParent=reconcilingParent,stashedPrevious=previouslyReconciledSibling,stashedRemaining=remainingReconcilingChildren,stashedSuspenseParent=reconcilingParentSuspenseNode,stashedSuspensePrevious=previouslyReconciledSiblingSuspenseNode,stashedSuspenseRemaining=remainingReconcilingChildrenSuspenseNodes;if(newInstance!==null)reconcilingParent=newInstance,previouslyReconciledSibling=null,remainingReconcilingChildren=null;var shouldPopSuspenseNode=!1;if(newSuspenseNode!==null)reconcilingParentSuspenseNode=newSuspenseNode,previouslyReconciledSiblingSuspenseNode=null,remainingReconcilingChildrenSuspenseNodes=null,shouldPopSuspenseNode=!0;try{if(traceUpdatesEnabled){if(traceNearestHostComponentUpdate){var elementType=getElementTypeForFiber(fiber);if(elementType===ElementTypeHostComponent)traceUpdatesForNodes.add(fiber.stateNode),traceNearestHostComponentUpdate=!1}}if(trackDebugInfoFromLazyType(fiber),trackDebugInfoFromUsedThenables(fiber),fiber.tag===HostHoistable){var nearestInstance=reconcilingParent;if(nearestInstance===null)throw Error("Did not expect a host hoistable to be the root");aquireHostResource(nearestInstance,fiber.memoizedState),trackDebugInfoFromHostResource(nearestInstance,fiber)}else if(fiber.tag===HostComponent||fiber.tag===HostText||fiber.tag===HostSingleton){var _nearestInstance=reconcilingParent;if(_nearestInstance===null)throw Error("Did not expect a host hoistable to be the root");aquireHostInstance(_nearestInstance,fiber.stateNode),trackDebugInfoFromHostComponent(_nearestInstance,fiber)}if(isSuspendedOffscreen(fiber)){var stashedDisconnected=isInDisconnectedSubtree;isInDisconnectedSubtree=!0;try{if(fiber.child!==null)mountChildrenRecursively(fiber.child,!1)}finally{isInDisconnectedSubtree=stashedDisconnected}}else if(isHiddenOffscreen(fiber));else if(fiber.tag===SuspenseComponent&&OffscreenComponent===-1){if(newSuspenseNode!==null)trackThrownPromisesFromRetryCache(newSuspenseNode,fiber.stateNode);var _isTimedOut4=fiber.memoizedState!==null;if(_isTimedOut4){var primaryChildFragment=fiber.child,fallbackChildFragment=primaryChildFragment?primaryChildFragment.sibling:null;if(fallbackChildFragment){var fallbackChild=fallbackChildFragment.child;if(fallbackChild!==null)updateTrackedPathStateBeforeMount(fallbackChildFragment,null),mountChildrenRecursively(fallbackChild,traceNearestHostComponentUpdate)}}else{var primaryChild=fiber.child;if(primaryChild!==null)mountChildrenRecursively(primaryChild,traceNearestHostComponentUpdate)}}else if(fiber.tag===SuspenseComponent&&OffscreenComponent!==-1&&newInstance!==null&&newSuspenseNode!==null){var _contentFiber2=fiber.child,_hydrated2=isFiberHydrated(fiber);if(_hydrated2){if(_contentFiber2===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");trackThrownPromisesFromRetryCache(newSuspenseNode,fiber.stateNode),mountSuspenseChildrenRecursively(_contentFiber2,traceNearestHostComponentUpdate,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining),shouldPopSuspenseNode=!1}}else if(fiber.child!==null)mountChildrenRecursively(fiber.child,traceNearestHostComponentUpdate)}finally{if(newInstance!==null)reconcilingParent=stashedParent,previouslyReconciledSibling=stashedPrevious,remainingReconcilingChildren=stashedRemaining;if(shouldPopSuspenseNode)reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining}updateTrackedPathStateAfterMount(mightSiblingsBeOnTrackedPath)}function unmountInstanceRecursively(instance){if(__DEBUG__)debug2("unmountInstanceRecursively()",instance,reconcilingParent);var shouldPopSuspenseNode=!1,stashedParent=reconcilingParent,stashedPrevious=previouslyReconciledSibling,stashedRemaining=remainingReconcilingChildren,stashedSuspenseParent=reconcilingParentSuspenseNode,stashedSuspensePrevious=previouslyReconciledSiblingSuspenseNode,stashedSuspenseRemaining=remainingReconcilingChildrenSuspenseNodes,previousSuspendedBy=instance.suspendedBy;if(reconcilingParent=instance,previouslyReconciledSibling=null,remainingReconcilingChildren=instance.firstChild,instance.firstChild=null,instance.suspendedBy=null,instance.suspenseNode!==null)reconcilingParentSuspenseNode=instance.suspenseNode,previouslyReconciledSiblingSuspenseNode=null,remainingReconcilingChildrenSuspenseNodes=instance.suspenseNode.firstChild,shouldPopSuspenseNode=!0;try{if((instance.kind===FIBER_INSTANCE||instance.kind===FILTERED_FIBER_INSTANCE)&&instance.data.tag===SuspenseComponent&&OffscreenComponent!==-1){var _fiber4=instance.data,contentFiberInstance=remainingReconcilingChildren,hydrated=isFiberHydrated(_fiber4);if(hydrated){if(contentFiberInstance===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");unmountSuspenseChildrenRecursively(contentFiberInstance,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining),shouldPopSuspenseNode=!1}else if(contentFiberInstance!==null)throw Error("A dehydrated Suspense node should not have a content Fiber.")}else unmountRemainingChildren();removePreviousSuspendedBy(instance,previousSuspendedBy,reconcilingParentSuspenseNode)}finally{if(reconcilingParent=stashedParent,previouslyReconciledSibling=stashedPrevious,remainingReconcilingChildren=stashedRemaining,shouldPopSuspenseNode)reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining}if(instance.kind===FIBER_INSTANCE)recordUnmount(instance);else if(instance.kind===VIRTUAL_INSTANCE)recordVirtualUnmount(instance);else untrackFiber(instance,instance.data);removeChild(instance,null)}function recordProfilingDurations(fiberInstance,prevFiber){var{id,data:fiber}=fiberInstance,actualDuration=fiber.actualDuration,treeBaseDuration=fiber.treeBaseDuration;if(fiberInstance.treeBaseDuration=treeBaseDuration||0,isProfiling){if(prevFiber==null||treeBaseDuration!==prevFiber.treeBaseDuration){var convertedTreeBaseDuration=Math.floor((treeBaseDuration||0)*1000);pushOperation(TREE_OPERATION_UPDATE_TREE_BASE_DURATION),pushOperation(id),pushOperation(convertedTreeBaseDuration)}if(prevFiber==null||didFiberRender(prevFiber,fiber)){if(actualDuration!=null){var selfDuration=actualDuration,child=fiber.child;while(child!==null)selfDuration-=child.actualDuration||0,child=child.sibling;var metadata=currentCommitProfilingMetadata;if(metadata.durations.push(id,actualDuration,selfDuration),metadata.maxActualDuration=Math.max(metadata.maxActualDuration,actualDuration),recordChangeDescriptions){var changeDescription=getChangeDescription(prevFiber,fiber);if(changeDescription!==null){if(metadata.changeDescriptions!==null)metadata.changeDescriptions.set(id,changeDescription)}}}}var fiberRoot=currentRoot.data.stateNode,updaters=fiberRoot.memoizedUpdaters;if(updaters!=null&&(updaters.has(fiber)||fiber.alternate!==null&&updaters.has(fiber.alternate))){var _metadata=currentCommitProfilingMetadata;if(_metadata.updaters===null)_metadata.updaters=[];_metadata.updaters.push(instanceToSerializedElement(fiberInstance))}}}function recordVirtualProfilingDurations(virtualInstance){var id=virtualInstance.id,treeBaseDuration=0;for(var child=virtualInstance.firstChild;child!==null;child=child.nextSibling)treeBaseDuration+=child.treeBaseDuration;if(isProfiling){var previousTreeBaseDuration=virtualInstance.treeBaseDuration;if(treeBaseDuration!==previousTreeBaseDuration){var convertedTreeBaseDuration=Math.floor((treeBaseDuration||0)*1000);pushOperation(TREE_OPERATION_UPDATE_TREE_BASE_DURATION),pushOperation(id),pushOperation(convertedTreeBaseDuration)}}virtualInstance.treeBaseDuration=treeBaseDuration}function addUnfilteredChildrenIDs(parentInstance,nextChildren){var child=parentInstance.firstChild;while(child!==null){if(child.kind===FILTERED_FIBER_INSTANCE){var _fiber5=child.data;if(isHiddenOffscreen(_fiber5));else addUnfilteredChildrenIDs(child,nextChildren)}else nextChildren.push(child.id);child=child.nextSibling}}function recordResetChildren(parentInstance){if(__DEBUG__){if(parentInstance.firstChild!==null)debug2("recordResetChildren()",parentInstance.firstChild,parentInstance)}var nextChildren=[];addUnfilteredChildrenIDs(parentInstance,nextChildren);var numChildren=nextChildren.length;if(numChildren<2)return;pushOperation(TREE_OPERATION_REORDER_CHILDREN),pushOperation(parentInstance.id),pushOperation(numChildren);for(var i=0;i<nextChildren.length;i++)pushOperation(nextChildren[i])}function addUnfilteredSuspenseChildrenIDs(parentInstance,nextChildren){var child=parentInstance.firstChild;while(child!==null){if(child.instance.kind===FILTERED_FIBER_INSTANCE)addUnfilteredSuspenseChildrenIDs(child,nextChildren);else nextChildren.push(child.instance.id);child=child.nextSibling}}function recordResetSuspenseChildren(parentInstance){if(__DEBUG__){if(parentInstance.firstChild!==null)console.log("recordResetSuspenseChildren()",parentInstance.firstChild,parentInstance)}var nextChildren=[];addUnfilteredSuspenseChildrenIDs(parentInstance,nextChildren);var numChildren=nextChildren.length;if(numChildren<2)return;pushOperation(SUSPENSE_TREE_OPERATION_REORDER_CHILDREN),pushOperation(parentInstance.instance.id),pushOperation(numChildren);for(var i=0;i<nextChildren.length;i++)pushOperation(nextChildren[i])}function updateVirtualInstanceRecursively(virtualInstance,nextFirstChild,nextLastChild,prevFirstChild,traceNearestHostComponentUpdate,virtualLevel){var stashedParent=reconcilingParent,stashedPrevious=previouslyReconciledSibling,stashedRemaining=remainingReconcilingChildren,previousSuspendedBy=virtualInstance.suspendedBy;reconcilingParent=virtualInstance,previouslyReconciledSibling=null,remainingReconcilingChildren=virtualInstance.firstChild,virtualInstance.firstChild=null,virtualInstance.suspendedBy=null;try{var updateFlags=updateVirtualChildrenRecursively(nextFirstChild,nextLastChild,prevFirstChild,traceNearestHostComponentUpdate,virtualLevel+1);if((updateFlags&ShouldResetChildren)!==NoUpdate){if(!isInDisconnectedSubtree)recordResetChildren(virtualInstance);updateFlags&=~ShouldResetChildren}removePreviousSuspendedBy(virtualInstance,previousSuspendedBy,reconcilingParentSuspenseNode);var componentLogsEntry=componentInfoToComponentLogsMap.get(virtualInstance.data);return recordConsoleLogs(virtualInstance,componentLogsEntry),recordVirtualProfilingDurations(virtualInstance),updateFlags}finally{unmountRemainingChildren(),reconcilingParent=stashedParent,previouslyReconciledSibling=stashedPrevious,remainingReconcilingChildren=stashedRemaining}}function updateVirtualChildrenRecursively(nextFirstChild,nextLastChild,prevFirstChild,traceNearestHostComponentUpdate,virtualLevel){var updateFlags=NoUpdate,nextChild=nextFirstChild,prevChildAtSameIndex=prevFirstChild,previousVirtualInstance=null,previousVirtualInstanceWasMount=!1,previousVirtualInstanceNextFirstFiber=nextFirstChild,previousVirtualInstancePrevFirstFiber=prevFirstChild;while(nextChild!==null&&nextChild!==nextLastChild){var level=0;if(nextChild._debugInfo)for(var i=0;i<nextChild._debugInfo.length;i++){var debugEntry=nextChild._debugInfo[i];if(debugEntry.awaited){var asyncInfo=debugEntry;if(level===virtualLevel)insertSuspendedBy(asyncInfo);continue}if(typeof debugEntry.name!=="string")continue;var componentInfo=debugEntry,secondaryEnv=getSecondaryEnvironmentName(nextChild._debugInfo,i);if(componentInfo.env!=null)knownEnvironmentNames.add(componentInfo.env);if(secondaryEnv!==null)knownEnvironmentNames.add(secondaryEnv);if(shouldFilterVirtual(componentInfo,secondaryEnv))continue;if(level===virtualLevel){if(previousVirtualInstance===null||previousVirtualInstance.data!==componentInfo){if(previousVirtualInstance!==null)if(previousVirtualInstanceWasMount)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,nextChild,traceNearestHostComponentUpdate,virtualLevel),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;else updateFlags|=updateVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,nextChild,previousVirtualInstancePrevFirstFiber,traceNearestHostComponentUpdate,virtualLevel);var previousSiblingOfBestMatch=null,bestMatch=remainingReconcilingChildren;if(componentInfo.key!=null){bestMatch=remainingReconcilingChildren;while(bestMatch!==null){if(bestMatch.kind===VIRTUAL_INSTANCE&&bestMatch.data.key===componentInfo.key)break;previousSiblingOfBestMatch=bestMatch,bestMatch=bestMatch.nextSibling}}if(bestMatch!==null&&bestMatch.kind===VIRTUAL_INSTANCE&&bestMatch.data.name===componentInfo.name&&bestMatch.data.env===componentInfo.env&&bestMatch.data.key===componentInfo.key)bestMatch.data=componentInfo,moveChild(bestMatch,previousSiblingOfBestMatch),previousVirtualInstance=bestMatch,previousVirtualInstanceWasMount=!1;else{var newVirtualInstance=createVirtualInstance(componentInfo);recordVirtualMount(newVirtualInstance,reconcilingParent,secondaryEnv),insertChild(newVirtualInstance),previousVirtualInstance=newVirtualInstance,previousVirtualInstanceWasMount=!0,updateFlags|=ShouldResetChildren}previousVirtualInstanceNextFirstFiber=nextChild,previousVirtualInstancePrevFirstFiber=prevChildAtSameIndex}level++;break}else level++}if(level===virtualLevel){if(previousVirtualInstance!==null){if(previousVirtualInstanceWasMount)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,nextChild,traceNearestHostComponentUpdate,virtualLevel),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;else updateFlags|=updateVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,nextChild,previousVirtualInstancePrevFirstFiber,traceNearestHostComponentUpdate,virtualLevel);previousVirtualInstance=null}var prevChild=void 0;if(prevChildAtSameIndex===nextChild)prevChild=nextChild;else prevChild=nextChild.alternate;var previousSiblingOfExistingInstance=null,existingInstance=null;if(prevChild!==null){existingInstance=remainingReconcilingChildren;while(existingInstance!==null){if(existingInstance.data===prevChild)break;previousSiblingOfExistingInstance=existingInstance,existingInstance=existingInstance.nextSibling}}if(existingInstance!==null){var fiberInstance=existingInstance;if(prevChild!==prevChildAtSameIndex)updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;moveChild(fiberInstance,previousSiblingOfExistingInstance),updateFlags|=updateFiberRecursively(fiberInstance,nextChild,prevChild,traceNearestHostComponentUpdate)}else if(prevChild!==null&&shouldFilterFiber(nextChild)){if(prevChild!==prevChildAtSameIndex)updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;updateFlags|=updateFiberRecursively(null,nextChild,prevChild,traceNearestHostComponentUpdate)}else mountFiberRecursively(nextChild,traceNearestHostComponentUpdate),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren}if(nextChild=nextChild.sibling,(updateFlags&ShouldResetChildren)===NoUpdate&&prevChildAtSameIndex!==null)prevChildAtSameIndex=prevChildAtSameIndex.sibling}if(previousVirtualInstance!==null)if(previousVirtualInstanceWasMount)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,null,traceNearestHostComponentUpdate,virtualLevel),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;else updateFlags|=updateVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,null,previousVirtualInstancePrevFirstFiber,traceNearestHostComponentUpdate,virtualLevel);if(prevChildAtSameIndex!==null)updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;return updateFlags}function updateChildrenRecursively(nextFirstChild,prevFirstChild,traceNearestHostComponentUpdate){if(nextFirstChild===null)return prevFirstChild!==null?ShouldResetChildren:NoUpdate;return updateVirtualChildrenRecursively(nextFirstChild,null,prevFirstChild,traceNearestHostComponentUpdate,0)}function updateSuspenseChildrenRecursively(nextContentFiber,prevContentFiber,traceNearestHostComponentUpdate,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining){var updateFlags=NoUpdate,prevFallbackFiber=prevContentFiber.sibling,nextFallbackFiber=nextContentFiber.sibling;if(updateFlags|=updateVirtualChildrenRecursively(nextContentFiber,nextFallbackFiber,prevContentFiber,traceNearestHostComponentUpdate,0),reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining,prevFallbackFiber!==null||nextFallbackFiber!==null){if(nextFallbackFiber===null)unmountRemainingChildren();else if(updateFlags|=updateVirtualChildrenRecursively(nextFallbackFiber,null,prevFallbackFiber,traceNearestHostComponentUpdate,0),(updateFlags&ShouldResetSuspenseChildren)!==NoUpdate)updateFlags|=ShouldResetParentSuspenseChildren,updateFlags&=~ShouldResetSuspenseChildren}return updateFlags}function updateFiberRecursively(fiberInstance,nextFiber,prevFiber,traceNearestHostComponentUpdate){if(__DEBUG__){if(fiberInstance!==null)debug2("updateFiberRecursively()",fiberInstance,reconcilingParent)}if(traceUpdatesEnabled){var elementType=getElementTypeForFiber(nextFiber);if(traceNearestHostComponentUpdate){if(elementType===ElementTypeHostComponent)traceUpdatesForNodes.add(nextFiber.stateNode),traceNearestHostComponentUpdate=!1}else if(elementType===types_ElementTypeFunction||elementType===types_ElementTypeClass||elementType===ElementTypeContext||elementType===types_ElementTypeMemo||elementType===types_ElementTypeForwardRef)traceNearestHostComponentUpdate=didFiberRender(prevFiber,nextFiber)}var stashedParent=reconcilingParent,stashedPrevious=previouslyReconciledSibling,stashedRemaining=remainingReconcilingChildren,stashedSuspenseParent=reconcilingParentSuspenseNode,stashedSuspensePrevious=previouslyReconciledSiblingSuspenseNode,stashedSuspenseRemaining=remainingReconcilingChildrenSuspenseNodes,updateFlags=NoUpdate,shouldMeasureSuspenseNode=!1,shouldPopSuspenseNode=!1,previousSuspendedBy=null;if(fiberInstance!==null){if(previousSuspendedBy=fiberInstance.suspendedBy,fiberInstance.data=nextFiber,mostRecentlyInspectedElement!==null&&(mostRecentlyInspectedElement.id===fiberInstance.id||mostRecentlyInspectedElement.type===ElementTypeRoot&&nextFiber.tag===HostRoot)&&didFiberRender(prevFiber,nextFiber))hasElementUpdatedSinceLastInspected=!0;reconcilingParent=fiberInstance,previouslyReconciledSibling=null,remainingReconcilingChildren=fiberInstance.firstChild,fiberInstance.firstChild=null,fiberInstance.suspendedBy=null;var suspenseNode=fiberInstance.suspenseNode;if(suspenseNode!==null)reconcilingParentSuspenseNode=suspenseNode,previouslyReconciledSiblingSuspenseNode=null,remainingReconcilingChildrenSuspenseNodes=suspenseNode.firstChild,suspenseNode.firstChild=null,shouldMeasureSuspenseNode=!0,shouldPopSuspenseNode=!0}try{if(trackDebugInfoFromLazyType(nextFiber),trackDebugInfoFromUsedThenables(nextFiber),nextFiber.tag===HostHoistable){var nearestInstance=reconcilingParent;if(nearestInstance===null)throw Error("Did not expect a host hoistable to be the root");if(prevFiber.memoizedState!==nextFiber.memoizedState)releaseHostResource(nearestInstance,prevFiber.memoizedState),aquireHostResource(nearestInstance,nextFiber.memoizedState);trackDebugInfoFromHostResource(nearestInstance,nextFiber)}else if(nextFiber.tag===HostComponent||nextFiber.tag===HostText||nextFiber.tag===HostSingleton){var _nearestInstance2=reconcilingParent;if(_nearestInstance2===null)throw Error("Did not expect a host hoistable to be the root");if(prevFiber.stateNode!==nextFiber.stateNode)releaseHostInstance(_nearestInstance2,prevFiber.stateNode),aquireHostInstance(_nearestInstance2,nextFiber.stateNode);trackDebugInfoFromHostComponent(_nearestInstance2,nextFiber)}var isLegacySuspense=nextFiber.tag===SuspenseComponent&&OffscreenComponent===-1,prevDidTimeout=isLegacySuspense&&prevFiber.memoizedState!==null,nextDidTimeOut=isLegacySuspense&&nextFiber.memoizedState!==null,prevWasHidden=isHiddenOffscreen(prevFiber),nextIsHidden=isHiddenOffscreen(nextFiber),prevWasSuspended=isSuspendedOffscreen(prevFiber),nextIsSuspended=isSuspendedOffscreen(nextFiber);if(isLegacySuspense){if(fiberInstance!==null&&fiberInstance.suspenseNode!==null){var _suspenseNode=fiberInstance.suspenseNode;if(prevFiber.stateNode===null!==(nextFiber.stateNode===null))trackThrownPromisesFromRetryCache(_suspenseNode,nextFiber.stateNode);if(prevFiber.memoizedState===null!==(nextFiber.memoizedState===null))recordSuspenseSuspenders(_suspenseNode)}}if(prevDidTimeout&&nextDidTimeOut){var nextFiberChild=nextFiber.child,nextFallbackChildSet=nextFiberChild?nextFiberChild.sibling:null,prevFiberChild=prevFiber.child,prevFallbackChildSet=prevFiberChild?prevFiberChild.sibling:null;if(prevFallbackChildSet==null&&nextFallbackChildSet!=null)mountChildrenRecursively(nextFallbackChildSet,traceNearestHostComponentUpdate),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;var childrenUpdateFlags=nextFallbackChildSet!=null&&prevFallbackChildSet!=null?updateChildrenRecursively(nextFallbackChildSet,prevFallbackChildSet,traceNearestHostComponentUpdate):NoUpdate;updateFlags|=childrenUpdateFlags}else if(prevDidTimeout&&!nextDidTimeOut){var nextPrimaryChildSet=nextFiber.child;if(nextPrimaryChildSet!==null)mountChildrenRecursively(nextPrimaryChildSet,traceNearestHostComponentUpdate),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren}else if(!prevDidTimeout&&nextDidTimeOut){var _nextFiberChild=nextFiber.child,_nextFallbackChildSet=_nextFiberChild?_nextFiberChild.sibling:null;if(_nextFallbackChildSet!=null)mountChildrenRecursively(_nextFallbackChildSet,traceNearestHostComponentUpdate),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren}else if(nextIsSuspended){if(!prevWasSuspended){if(fiberInstance!==null&&!isInDisconnectedSubtree)disconnectChildrenRecursively(remainingReconcilingChildren)}var stashedDisconnected=isInDisconnectedSubtree;isInDisconnectedSubtree=!0;try{updateFlags|=updateChildrenRecursively(nextFiber.child,prevFiber.child,!1)}finally{isInDisconnectedSubtree=stashedDisconnected}}else if(prevWasSuspended&&!nextIsSuspended){var _stashedDisconnected=isInDisconnectedSubtree;isInDisconnectedSubtree=!0;try{if(nextFiber.child!==null)updateFlags|=updateChildrenRecursively(nextFiber.child,prevFiber.child,!1);unmountRemainingChildren(),remainingReconcilingChildren=null}finally{isInDisconnectedSubtree=_stashedDisconnected}if(fiberInstance!==null&&!isInDisconnectedSubtree)reconnectChildrenRecursively(fiberInstance),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren}else if(nextIsHidden)if(prevWasHidden);else unmountRemainingChildren();else if(nextFiber.tag===SuspenseComponent&&OffscreenComponent!==-1&&fiberInstance!==null&&fiberInstance.suspenseNode!==null){var _suspenseNode2=fiberInstance.suspenseNode,prevContentFiber=prevFiber.child,nextContentFiber=nextFiber.child,previousHydrated=isFiberHydrated(prevFiber),nextHydrated=isFiberHydrated(nextFiber);if(previousHydrated&&nextHydrated){if(nextContentFiber===null||prevContentFiber===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");if(prevFiber.stateNode===null!==(nextFiber.stateNode===null))trackThrownPromisesFromRetryCache(_suspenseNode2,nextFiber.stateNode);if(prevFiber.memoizedState===null!==(nextFiber.memoizedState===null))recordSuspenseSuspenders(_suspenseNode2);if(shouldMeasureSuspenseNode=!1,updateFlags|=updateSuspenseChildrenRecursively(nextContentFiber,prevContentFiber,traceNearestHostComponentUpdate,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining),shouldPopSuspenseNode=!1,nextFiber.memoizedState===null)shouldMeasureSuspenseNode=!isInDisconnectedSubtree}else if(!previousHydrated&&nextHydrated){if(nextContentFiber===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");trackThrownPromisesFromRetryCache(_suspenseNode2,nextFiber.stateNode),recordSuspenseSuspenders(_suspenseNode2),mountSuspenseChildrenRecursively(nextContentFiber,traceNearestHostComponentUpdate,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining),shouldPopSuspenseNode=!1}else if(previousHydrated&&!nextHydrated)throw Error("Encountered a dehydrated Suspense boundary that was previously hydrated.")}else if(nextFiber.child!==prevFiber.child)updateFlags|=updateChildrenRecursively(nextFiber.child,prevFiber.child,traceNearestHostComponentUpdate);else if(fiberInstance!==null){if(fiberInstance.firstChild=remainingReconcilingChildren,remainingReconcilingChildren=null,consumeSuspenseNodesOfExistingInstance(fiberInstance),traceUpdatesEnabled){if(traceNearestHostComponentUpdate){var hostInstances=findAllCurrentHostInstances(fiberInstance);hostInstances.forEach(function(hostInstance){traceUpdatesForNodes.add(hostInstance)})}}}else{var _childrenUpdateFlags=updateChildrenRecursively(nextFiber.child,prevFiber.child,!1);if((_childrenUpdateFlags&ShouldResetChildren)!==NoUpdate)throw Error("The children should not have changed if we pass in the same set.");updateFlags|=_childrenUpdateFlags}if(fiberInstance!==null){if(removePreviousSuspendedBy(fiberInstance,previousSuspendedBy,shouldPopSuspenseNode?reconcilingParentSuspenseNode:stashedSuspenseParent),fiberInstance.kind===FIBER_INSTANCE){var componentLogsEntry=fiberToComponentLogsMap.get(fiberInstance.data);if(componentLogsEntry===void 0&&fiberInstance.data.alternate)componentLogsEntry=fiberToComponentLogsMap.get(fiberInstance.data.alternate);recordConsoleLogs(fiberInstance,componentLogsEntry);var isProfilingSupported=nextFiber.hasOwnProperty("treeBaseDuration");if(isProfilingSupported)recordProfilingDurations(fiberInstance,prevFiber)}}if((updateFlags&ShouldResetChildren)!==NoUpdate){if(fiberInstance!==null&&fiberInstance.kind===FIBER_INSTANCE){if(!nextIsSuspended&&!isInDisconnectedSubtree)recordResetChildren(fiberInstance);updateFlags&=~ShouldResetChildren}}if((updateFlags&ShouldResetSuspenseChildren)!==NoUpdate){if(fiberInstance!==null&&fiberInstance.kind===FIBER_INSTANCE){var _suspenseNode3=fiberInstance.suspenseNode;if(_suspenseNode3!==null)recordResetSuspenseChildren(_suspenseNode3),updateFlags&=~ShouldResetSuspenseChildren}}if((updateFlags&ShouldResetParentSuspenseChildren)!==NoUpdate){if(fiberInstance!==null&&fiberInstance.kind===FIBER_INSTANCE){var _suspenseNode4=fiberInstance.suspenseNode;if(_suspenseNode4!==null)updateFlags&=~ShouldResetParentSuspenseChildren,updateFlags|=ShouldResetSuspenseChildren}}return updateFlags}finally{if(fiberInstance!==null){if(unmountRemainingChildren(),reconcilingParent=stashedParent,previouslyReconciledSibling=stashedPrevious,remainingReconcilingChildren=stashedRemaining,shouldMeasureSuspenseNode){if(!isInDisconnectedSubtree){var _suspenseNode5=fiberInstance.suspenseNode;if(_suspenseNode5===null)throw Error("Attempted to measure a Suspense node that does not exist.");var prevRects=_suspenseNode5.rects,nextRects=measureInstance(fiberInstance);if(!areEqualRects(prevRects,nextRects))_suspenseNode5.rects=nextRects,recordSuspenseResize(_suspenseNode5)}}if(shouldPopSuspenseNode)reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining}}}function disconnectChildrenRecursively(firstChild){for(var child=firstChild;child!==null;child=child.nextSibling){if((child.kind===FIBER_INSTANCE||child.kind===FILTERED_FIBER_INSTANCE)&&isSuspendedOffscreen(child.data));else disconnectChildrenRecursively(child.firstChild);if(child.kind===FIBER_INSTANCE)recordDisconnect(child);else if(child.kind===VIRTUAL_INSTANCE)recordVirtualDisconnect(child)}}function reconnectChildrenRecursively(parentInstance){for(var child=parentInstance.firstChild;child!==null;child=child.nextSibling){if(child.kind===FIBER_INSTANCE)recordReconnect(child,parentInstance);else if(child.kind===VIRTUAL_INSTANCE){var secondaryEnv=null;recordVirtualReconnect(child,parentInstance,secondaryEnv)}if((child.kind===FIBER_INSTANCE||child.kind===FILTERED_FIBER_INSTANCE)&&isHiddenOffscreen(child.data));else reconnectChildrenRecursively(child)}}function cleanup(){isProfiling=!1}function rootSupportsProfiling(root){if(root.memoizedInteractions!=null)return!0;else if(root.current!=null&&root.current.hasOwnProperty("treeBaseDuration"))return!0;else return!1}function flushInitialOperations(){var localPendingOperationsQueue=pendingOperationsQueue;if(pendingOperationsQueue=null,localPendingOperationsQueue!==null&&localPendingOperationsQueue.length>0)localPendingOperationsQueue.forEach(function(operations){hook.emit("operations",operations)});else{if(trackedPath!==null)mightBeOnTrackedPath=!0;hook.getFiberRoots(rendererID).forEach(function(root){var current=root.current,newRoot=createFiberInstance(current);if(rootToFiberInstanceMap.set(root,newRoot),idToDevToolsInstanceMap.set(newRoot.id,newRoot),currentRoot=newRoot,setRootPseudoKey(currentRoot.id,root.current),isProfiling&&rootSupportsProfiling(root))currentCommitProfilingMetadata={changeDescriptions:recordChangeDescriptions?new Map:null,durations:[],commitTime:renderer_getCurrentTime()-profilingStartTime,maxActualDuration:0,priorityLevel:null,updaters:null,effectDuration:null,passiveEffectDuration:null};mountFiberRecursively(root.current,!1),flushPendingEvents(),needsToFlushComponentLogs=!1,currentRoot=null})}}function handleCommitFiberUnmount(fiber){}function handlePostCommitFiberRoot(root){if(isProfiling&&rootSupportsProfiling(root)){if(currentCommitProfilingMetadata!==null){var _getEffectDurations=getEffectDurations(root),effectDuration=_getEffectDurations.effectDuration,passiveEffectDuration=_getEffectDurations.passiveEffectDuration;currentCommitProfilingMetadata.effectDuration=effectDuration,currentCommitProfilingMetadata.passiveEffectDuration=passiveEffectDuration}}if(needsToFlushComponentLogs)bruteForceFlushErrorsAndWarnings()}function handleCommitFiberRoot(root,priorityLevel){var nextFiber=root.current,prevFiber=null,rootInstance=rootToFiberInstanceMap.get(root);if(!rootInstance)rootInstance=createFiberInstance(nextFiber),rootToFiberInstanceMap.set(root,rootInstance),idToDevToolsInstanceMap.set(rootInstance.id,rootInstance);else prevFiber=rootInstance.data;if(currentRoot=rootInstance,trackedPath!==null)mightBeOnTrackedPath=!0;if(traceUpdatesEnabled)traceUpdatesForNodes.clear();var isProfilingSupported=rootSupportsProfiling(root);if(isProfiling&&isProfilingSupported)currentCommitProfilingMetadata={changeDescriptions:recordChangeDescriptions?new Map:null,durations:[],commitTime:renderer_getCurrentTime()-profilingStartTime,maxActualDuration:0,priorityLevel:priorityLevel==null?null:formatPriorityLevel(priorityLevel),updaters:null,effectDuration:null,passiveEffectDuration:null};var nextIsMounted=nextFiber.child!==null,prevWasMounted=prevFiber!==null&&prevFiber.child!==null;if(!prevWasMounted&&nextIsMounted)setRootPseudoKey(currentRoot.id,nextFiber),mountFiberRecursively(nextFiber,!1);else if(prevWasMounted&&nextIsMounted){if(prevFiber===null)throw Error("Expected a previous Fiber when updating an existing root.");updateFiberRecursively(rootInstance,nextFiber,prevFiber,!1)}else if(prevWasMounted&&!nextIsMounted)unmountInstanceRecursively(rootInstance),removeRootPseudoKey(currentRoot.id),rootToFiberInstanceMap.delete(root);else if(!prevWasMounted&&!nextIsMounted)rootToFiberInstanceMap.delete(root);if(isProfiling&&isProfilingSupported){if(!shouldBailoutWithPendingOperations()){var commitProfilingMetadata=rootToCommitProfilingMetadataMap.get(currentRoot.id);if(commitProfilingMetadata!=null)commitProfilingMetadata.push(currentCommitProfilingMetadata);else rootToCommitProfilingMetadataMap.set(currentRoot.id,[currentCommitProfilingMetadata])}}if(flushPendingEvents(),needsToFlushComponentLogs=!1,traceUpdatesEnabled)hook.emit("traceUpdates",traceUpdatesForNodes);currentRoot=null}function getResourceInstance(fiber){if(fiber.tag===HostHoistable){var resource=fiber.memoizedState;if(renderer_typeof(resource)==="object"&&resource!==null&&resource.instance!=null)return resource.instance}return null}function appendHostInstancesByDevToolsInstance(devtoolsInstance,hostInstances){if(devtoolsInstance.kind!==VIRTUAL_INSTANCE){var _fiber6=devtoolsInstance.data;appendHostInstancesByFiber(_fiber6,hostInstances);return}for(var child=devtoolsInstance.firstChild;child!==null;child=child.nextSibling)appendHostInstancesByDevToolsInstance(child,hostInstances)}function appendHostInstancesByFiber(fiber,hostInstances){var node=fiber;while(!0){if(node.tag===HostComponent||node.tag===HostText||node.tag===HostSingleton||node.tag===HostHoistable){var hostInstance=node.stateNode||getResourceInstance(node);if(hostInstance)hostInstances.push(hostInstance)}else if(node.child){node.child.return=node,node=node.child;continue}if(node===fiber)return;while(!node.sibling){if(!node.return||node.return===fiber)return;node=node.return}node.sibling.return=node.return,node=node.sibling}}function findAllCurrentHostInstances(devtoolsInstance){var hostInstances=[];return appendHostInstancesByDevToolsInstance(devtoolsInstance,hostInstances),hostInstances}function findHostInstancesForElementID(id){try{var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),null;return findAllCurrentHostInstances(devtoolsInstance)}catch(err){return null}}function findLastKnownRectsForID(id){try{var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),null;if(devtoolsInstance.suspenseNode===null)return null;return devtoolsInstance.suspenseNode.rects}catch(err){return null}}function getDisplayNameForElementID(id){var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return null;if(devtoolsInstance.kind===FIBER_INSTANCE){var _fiber7=devtoolsInstance.data;if(_fiber7.tag===HostRoot)return"Initial Paint";if(_fiber7.tag===SuspenseComponent||_fiber7.tag===ActivityComponent){var props=_fiber7.memoizedProps;if(props.name!=null)return props.name;var owner=getUnfilteredOwner(_fiber7);if(owner!=null)if(typeof owner.tag==="number")return getDisplayNameForFiber(owner);else return owner.name||""}return getDisplayNameForFiber(_fiber7)}else return devtoolsInstance.data.name||""}function getNearestSuspenseNode(instance){while(instance.suspenseNode===null){if(instance.parent===null)throw Error("There should always be a SuspenseNode parent on a mounted instance.");instance=instance.parent}return instance.suspenseNode}function getNearestMountedDOMNode(publicInstance){var domNode=publicInstance;while(domNode&&!publicInstanceToDevToolsInstanceMap.has(domNode))domNode=domNode.parentNode;return domNode}function getElementIDForHostInstance(publicInstance){var instance=publicInstanceToDevToolsInstanceMap.get(publicInstance);if(instance!==void 0){if(instance.kind===FILTERED_FIBER_INSTANCE)return instance.parent.id;return instance.id}return null}function getSuspenseNodeIDForHostInstance(publicInstance){var instance=publicInstanceToDevToolsInstanceMap.get(publicInstance);if(instance!==void 0){var suspenseInstance=instance;while(suspenseInstance.suspenseNode===null||suspenseInstance.kind===FILTERED_FIBER_INSTANCE){if(suspenseInstance.parent===null)return null;suspenseInstance=suspenseInstance.parent}return suspenseInstance.id}return null}function getElementAttributeByPath(id,path15){if(isMostRecentlyInspectedElement(id))return utils_getInObject(mostRecentlyInspectedElement,path15);return}function getElementSourceFunctionById(id){var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),null;if(devtoolsInstance.kind!==FIBER_INSTANCE)return null;var fiber=devtoolsInstance.data,elementType=fiber.elementType,tag=fiber.tag,type=fiber.type;switch(tag){case ClassComponent:case IncompleteClassComponent:case IncompleteFunctionComponent:case IndeterminateComponent:case FunctionComponent:return type;case ForwardRef:return type.render;case MemoComponent:case SimpleMemoComponent:return elementType!=null&&elementType.type!=null?elementType.type:type;default:return null}}function instanceToSerializedElement(instance){if(instance.kind===FIBER_INSTANCE){var _fiber8=instance.data;return{displayName:getDisplayNameForFiber(_fiber8)||"Anonymous",id:instance.id,key:_fiber8.key,env:null,stack:_fiber8._debugOwner==null||_fiber8._debugStack==null?null:parseStackTrace(_fiber8._debugStack,1),type:getElementTypeForFiber(_fiber8)}}else{var componentInfo=instance.data;return{displayName:componentInfo.name||"Anonymous",id:instance.id,key:componentInfo.key==null?null:componentInfo.key,env:componentInfo.env==null?null:componentInfo.env,stack:componentInfo.owner==null||componentInfo.debugStack==null?null:parseStackTrace(componentInfo.debugStack,1),type:types_ElementTypeVirtual}}}function getOwnersList(id){var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),null;var self2=instanceToSerializedElement(devtoolsInstance),owners=getOwnersListFromInstance(devtoolsInstance);if(owners===null)return[self2];return owners.unshift(self2),owners.reverse(),owners}function getOwnersListFromInstance(instance){var owner=getUnfilteredOwner(instance.data);if(owner===null)return null;var owners=[],parentInstance=instance.parent;while(parentInstance!==null&&owner!==null){var ownerInstance=findNearestOwnerInstance(parentInstance,owner);if(ownerInstance!==null)owners.push(instanceToSerializedElement(ownerInstance)),owner=getUnfilteredOwner(owner),parentInstance=ownerInstance.parent;else break}return owners}function getUnfilteredOwner(owner){if(owner==null)return null;if(typeof owner.tag==="number"){var ownerFiber=owner;owner=ownerFiber._debugOwner}else{var ownerInfo=owner;owner=ownerInfo.owner}while(owner)if(typeof owner.tag==="number"){var _ownerFiber=owner;if(!shouldFilterFiber(_ownerFiber))return _ownerFiber;owner=_ownerFiber._debugOwner}else{var _ownerInfo=owner;if(!shouldFilterVirtual(_ownerInfo,null))return _ownerInfo;owner=_ownerInfo.owner}return null}function findNearestOwnerInstance(parentInstance,owner){if(owner==null)return null;while(parentInstance!==null){if(parentInstance.data===owner||parentInstance.data===owner.alternate){if(parentInstance.kind===FILTERED_FIBER_INSTANCE)return null;return parentInstance}parentInstance=parentInstance.parent}return null}function inspectHooks(fiber){var originalConsoleMethods={};for(var method in console)try{originalConsoleMethods[method]=console[method],console[method]=function(){}}catch(error){}try{return(0,react_debug_tools.inspectHooksOfFiber)(fiber,getDispatcherRef(renderer))}finally{for(var _method in originalConsoleMethods)try{console[_method]=originalConsoleMethods[_method]}catch(error){}}}function getSuspendedByOfSuspenseNode(suspenseNode,filterByChildInstance){var result=[];if(!suspenseNode.hasUniqueSuspenders)return result;var hooksCacheKey=null,hooksCache=null,streamEntries=new Map;return suspenseNode.suspendedBy.forEach(function(set,ioInfo){var parentNode=suspenseNode.parent;while(parentNode!==null){if(parentNode.suspendedBy.has(ioInfo))return;parentNode=parentNode.parent}if(set.size===0)return;var firstInstance=null;if(filterByChildInstance===null)firstInstance=set.values().next().value;else{var _iterator7=_createForOfIteratorHelper(set.values()),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var childInstance=_step7.value;if(firstInstance===null)firstInstance=childInstance;if(childInstance!==filterByChildInstance&&!isChildOf(filterByChildInstance,childInstance,suspenseNode.instance))return}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}}if(firstInstance!==null&&firstInstance.suspendedBy!==null){var asyncInfo=getAwaitInSuspendedByFromIO(firstInstance.suspendedBy,ioInfo);if(asyncInfo!==null){var hooks=null;if(asyncInfo.stack==null&&asyncInfo.owner==null){if(hooksCacheKey===firstInstance)hooks=hooksCache;else if(firstInstance.kind!==VIRTUAL_INSTANCE){var _fiber9=firstInstance.data;if(_fiber9.dependencies&&_fiber9.dependencies._debugThenableState)hooksCacheKey=firstInstance,hooksCache=hooks=inspectHooks(_fiber9)}}var newIO=asyncInfo.awaited;if((newIO.name==="RSC stream"||newIO.name==="rsc stream")&&newIO.value!=null){var streamPromise=newIO.value,existingEntry=streamEntries.get(streamPromise);if(existingEntry===void 0)streamEntries.set(streamPromise,{asyncInfo,instance:firstInstance,hooks});else{var existingIO=existingEntry.asyncInfo.awaited;if(newIO!==existingIO&&(newIO.byteSize!==void 0&&existingIO.byteSize!==void 0&&newIO.byteSize>existingIO.byteSize||newIO.end>existingIO.end))existingEntry.asyncInfo=asyncInfo,existingEntry.instance=firstInstance,existingEntry.hooks=hooks}}else result.push(serializeAsyncInfo(asyncInfo,firstInstance,hooks))}}}),streamEntries.forEach(function(_ref){var{asyncInfo,instance,hooks}=_ref;result.push(serializeAsyncInfo(asyncInfo,instance,hooks))}),result}function getSuspendedByOfInstance(devtoolsInstance,hooks){var suspendedBy=devtoolsInstance.suspendedBy;if(suspendedBy===null)return[];var foundIOEntries=new Set,streamEntries=new Map,result=[];for(var i=0;i<suspendedBy.length;i++){var asyncInfo=suspendedBy[i],ioInfo=asyncInfo.awaited;if(foundIOEntries.has(ioInfo))continue;if(foundIOEntries.add(ioInfo),(ioInfo.name==="RSC stream"||ioInfo.name==="rsc stream")&&ioInfo.value!=null){var streamPromise=ioInfo.value,existingEntry=streamEntries.get(streamPromise);if(existingEntry===void 0)streamEntries.set(streamPromise,asyncInfo);else{var existingIO=existingEntry.awaited;if(ioInfo!==existingIO&&(ioInfo.byteSize!==void 0&&existingIO.byteSize!==void 0&&ioInfo.byteSize>existingIO.byteSize||ioInfo.end>existingIO.end))streamEntries.set(streamPromise,asyncInfo)}}else result.push(serializeAsyncInfo(asyncInfo,devtoolsInstance,hooks))}return streamEntries.forEach(function(asyncInfo2){result.push(serializeAsyncInfo(asyncInfo2,devtoolsInstance,hooks))}),result}function getSuspendedByOfInstanceSubtree(devtoolsInstance){var suspenseParentInstance=devtoolsInstance;while(suspenseParentInstance.suspenseNode===null){if(suspenseParentInstance.parent===null)return[];suspenseParentInstance=suspenseParentInstance.parent}var suspenseNode=suspenseParentInstance.suspenseNode;return getSuspendedByOfSuspenseNode(suspenseNode,devtoolsInstance)}var FALLBACK_THROTTLE_MS=300;function getSuspendedByRange(suspenseNode){var min=1/0,max=-1/0;suspenseNode.suspendedBy.forEach(function(_2,ioInfo){if(ioInfo.end>max)max=ioInfo.end;if(ioInfo.start<min)min=ioInfo.start});var parentSuspenseNode=suspenseNode.parent;if(parentSuspenseNode!==null){var parentMax=-1/0;parentSuspenseNode.suspendedBy.forEach(function(_2,ioInfo){if(ioInfo.end>parentMax)parentMax=ioInfo.end});var throttleTime=parentMax+FALLBACK_THROTTLE_MS;if(throttleTime>max)max=throttleTime;var startTime2=max-FALLBACK_THROTTLE_MS;if(parentMax>startTime2)startTime2=parentMax;if(startTime2<min)min=startTime2}if(min<1/0&&max>-1/0)return[min,max];return null}function getAwaitStackFromHooks(hooks,asyncInfo){for(var i=0;i<hooks.length;i++){var node=hooks[i],debugInfo=node.debugInfo;if(debugInfo!=null&&debugInfo.indexOf(asyncInfo)!==-1){var source=node.hookSource;if(source!=null&&source.functionName!==null&&source.fileName!==null&&source.lineNumber!==null&&source.columnNumber!==null){var callSite=[source.functionName,source.fileName,source.lineNumber,source.columnNumber,0,0,!1];return[callSite]}else return[]}var matchedStack=getAwaitStackFromHooks(node.subHooks,asyncInfo);if(matchedStack!==null){var _source=node.hookSource;if(_source!=null&&_source.functionName!==null&&_source.fileName!==null&&_source.lineNumber!==null&&_source.columnNumber!==null){var _callSite=[_source.functionName,_source.fileName,_source.lineNumber,_source.columnNumber,0,0,!1];matchedStack.push(_callSite)}return matchedStack}}return null}function serializeAsyncInfo(asyncInfo,parentInstance,hooks){var ioInfo=asyncInfo.awaited,ioOwnerInstance=findNearestOwnerInstance(parentInstance,ioInfo.owner),awaitStack=asyncInfo.debugStack==null?null:parseStackTrace(asyncInfo.debugStack,1),awaitOwnerInstance;if(asyncInfo.owner==null&&(awaitStack===null||awaitStack.length===0)){if(awaitStack=null,awaitOwnerInstance=parentInstance.kind===FILTERED_FIBER_INSTANCE?null:parentInstance,parentInstance.kind===FIBER_INSTANCE||parentInstance.kind===FILTERED_FIBER_INSTANCE){var _fiber10=parentInstance.data;switch(_fiber10.tag){case ClassComponent:case FunctionComponent:case IncompleteClassComponent:case IncompleteFunctionComponent:case IndeterminateComponent:case MemoComponent:case SimpleMemoComponent:if(hooks!==null)awaitStack=getAwaitStackFromHooks(hooks,asyncInfo);break;default:if(_fiber10._debugOwner!=null&&_fiber10._debugStack!=null&&typeof _fiber10._debugStack!=="string")awaitStack=parseStackTrace(_fiber10._debugStack,1),awaitOwnerInstance=findNearestOwnerInstance(parentInstance,_fiber10._debugOwner)}}}else awaitOwnerInstance=findNearestOwnerInstance(parentInstance,asyncInfo.owner);var value=ioInfo.value,resolvedValue=void 0;if(renderer_typeof(value)==="object"&&value!==null&&typeof value.then==="function")switch(value.status){case"fulfilled":resolvedValue=value.value;break;case"rejected":resolvedValue=value.reason;break}return{awaited:{name:ioInfo.name,description:getIODescription(resolvedValue),start:ioInfo.start,end:ioInfo.end,byteSize:ioInfo.byteSize==null?null:ioInfo.byteSize,value:ioInfo.value==null?null:ioInfo.value,env:ioInfo.env==null?null:ioInfo.env,owner:ioOwnerInstance===null?null:instanceToSerializedElement(ioOwnerInstance),stack:ioInfo.debugStack==null?null:parseStackTrace(ioInfo.debugStack,1)},env:asyncInfo.env==null?null:asyncInfo.env,owner:awaitOwnerInstance===null?null:instanceToSerializedElement(awaitOwnerInstance),stack:awaitStack}}function getInstanceAndStyle(id){var instance=null,style=null,devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),{instance,style};if(devtoolsInstance.kind!==FIBER_INSTANCE)return{instance,style};var fiber=devtoolsInstance.data;if(fiber!==null){if(instance=fiber.stateNode,fiber.memoizedProps!==null)style=fiber.memoizedProps.style}return{instance,style}}function isErrorBoundary(fiber){var{tag,type}=fiber;switch(tag){case ClassComponent:case IncompleteClassComponent:var instance=fiber.stateNode;return typeof type.getDerivedStateFromError==="function"||instance!==null&&typeof instance.componentDidCatch==="function";default:return!1}}function inspectElementRaw(id){var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),null;if(devtoolsInstance.kind===VIRTUAL_INSTANCE)return inspectVirtualInstanceRaw(devtoolsInstance);if(devtoolsInstance.kind===FIBER_INSTANCE){var isRoot=devtoolsInstance.parent===null;return isRoot?inspectRootsRaw(devtoolsInstance.id):inspectFiberInstanceRaw(devtoolsInstance)}throw Error("Unsupported instance kind")}function inspectFiberInstanceRaw(fiberInstance){var fiber=fiberInstance.data;if(fiber==null)return null;var{stateNode,key,memoizedProps,memoizedState,dependencies,tag,type}=fiber,elementType=getElementTypeForFiber(fiber),usesHooks=(tag===FunctionComponent||tag===SimpleMemoComponent||tag===ForwardRef)&&(!!memoizedState||!!dependencies),showState=tag===ClassComponent||tag===IncompleteClassComponent,typeSymbol=getTypeSymbol(type),canViewSource=!1,context2=null;if(tag===ClassComponent||tag===FunctionComponent||tag===IncompleteClassComponent||tag===IncompleteFunctionComponent||tag===IndeterminateComponent||tag===MemoComponent||tag===ForwardRef||tag===SimpleMemoComponent){if(canViewSource=!0,stateNode&&stateNode.context!=null){var shouldHideContext=elementType===types_ElementTypeClass&&!(type.contextTypes||type.contextType);if(!shouldHideContext)context2=stateNode.context}}else if((typeSymbol===CONTEXT_NUMBER||typeSymbol===CONTEXT_SYMBOL_STRING)&&!(type._context===void 0&&type.Provider===type)){var consumerResolvedContext=type._context||type;context2=consumerResolvedContext._currentValue||null;var _current=fiber.return;while(_current!==null){var currentType=_current.type,currentTypeSymbol=getTypeSymbol(currentType);if(currentTypeSymbol===PROVIDER_NUMBER||currentTypeSymbol===PROVIDER_SYMBOL_STRING){var providerResolvedContext=currentType._context||currentType.context;if(providerResolvedContext===consumerResolvedContext){context2=_current.memoizedProps.value;break}}_current=_current.return}}else if(typeSymbol===CONSUMER_SYMBOL_STRING){var _consumerResolvedContext=type._context;context2=_consumerResolvedContext._currentValue||null;var _current2=fiber.return;while(_current2!==null){var _currentType=_current2.type,_currentTypeSymbol=getTypeSymbol(_currentType);if(_currentTypeSymbol===CONTEXT_SYMBOL_STRING){var _providerResolvedContext=_currentType;if(_providerResolvedContext===_consumerResolvedContext){context2=_current2.memoizedProps.value;break}}_current2=_current2.return}}var hasLegacyContext=!1;if(context2!==null)hasLegacyContext=!!type.contextTypes,context2={value:context2};var owners=getOwnersListFromInstance(fiberInstance),hooks=null;if(usesHooks)hooks=inspectHooks(fiber);var rootType=null,current=fiber,hasErrorBoundary=!1,hasSuspenseBoundary=!1;while(current.return!==null){var temp=current;if(current=current.return,temp.tag===SuspenseComponent)hasSuspenseBoundary=!0;else if(isErrorBoundary(temp))hasErrorBoundary=!0}var fiberRoot=current.stateNode;if(fiberRoot!=null&&fiberRoot._debugRootType!==null)rootType=fiberRoot._debugRootType;var isErrored=!1;if(isErrorBoundary(fiber)){var DidCapture=128;isErrored=(fiber.flags&DidCapture)!==0||forceErrorForFibers.get(fiber)===!0||fiber.alternate!==null&&forceErrorForFibers.get(fiber.alternate)===!0}var plugins={stylex:null};if(enableStyleXFeatures){if(memoizedProps!=null&&memoizedProps.hasOwnProperty("xstyle"))plugins.stylex=getStyleXData(memoizedProps.xstyle)}var source=null;if(canViewSource)source=getSourceForFiberInstance(fiberInstance);var componentLogsEntry=fiberToComponentLogsMap.get(fiber);if(componentLogsEntry===void 0&&fiber.alternate!==null)componentLogsEntry=fiberToComponentLogsMap.get(fiber.alternate);var nativeTag=null;if(elementType===ElementTypeHostComponent)nativeTag=getNativeTag(fiber.stateNode);var isSuspended=null;if(tag===SuspenseComponent)isSuspended=memoizedState!==null;var suspendedBy=fiberInstance.suspenseNode!==null?getSuspendedByOfSuspenseNode(fiberInstance.suspenseNode,null):tag===ActivityComponent?getSuspendedByOfInstanceSubtree(fiberInstance):getSuspendedByOfInstance(fiberInstance,hooks),suspendedByRange=getSuspendedByRange(getNearestSuspenseNode(fiberInstance)),unknownSuspenders=UNKNOWN_SUSPENDERS_NONE;if(fiberInstance.suspenseNode!==null&&fiberInstance.suspenseNode.hasUnknownSuspenders&&!isSuspended)if(renderer.bundleType===0)unknownSuspenders=UNKNOWN_SUSPENDERS_REASON_PRODUCTION;else if(!("_debugInfo"in fiber))unknownSuspenders=UNKNOWN_SUSPENDERS_REASON_OLD_VERSION;else unknownSuspenders=UNKNOWN_SUSPENDERS_REASON_THROWN_PROMISE;return{id:fiberInstance.id,canEditHooks:typeof overrideHookState==="function",canEditFunctionProps:typeof overrideProps==="function",canEditHooksAndDeletePaths:typeof overrideHookStateDeletePath==="function",canEditHooksAndRenamePaths:typeof overrideHookStateRenamePath==="function",canEditFunctionPropsDeletePaths:typeof overridePropsDeletePath==="function",canEditFunctionPropsRenamePaths:typeof overridePropsRenamePath==="function",canToggleError:supportsTogglingError&&hasErrorBoundary,isErrored,canToggleSuspense:supportsTogglingSuspense&&hasSuspenseBoundary&&(!isSuspended||forceFallbackForFibers.has(fiber)||fiber.alternate!==null&&forceFallbackForFibers.has(fiber.alternate)),isSuspended,source,stack:fiber._debugOwner==null||fiber._debugStack==null?null:parseStackTrace(fiber._debugStack,1),hasLegacyContext,key:key!=null?key:null,type:elementType,context:context2,hooks,props:memoizedProps,state:showState?memoizedState:null,errors:componentLogsEntry===void 0?[]:Array.from(componentLogsEntry.errors.entries()),warnings:componentLogsEntry===void 0?[]:Array.from(componentLogsEntry.warnings.entries()),suspendedBy,suspendedByRange,unknownSuspenders,owners,env:null,rootType,rendererPackageName:renderer.rendererPackageName,rendererVersion:renderer.version,plugins,nativeTag}}function inspectVirtualInstanceRaw(virtualInstance){var source=getSourceForInstance(virtualInstance),componentInfo=virtualInstance.data,key=typeof componentInfo.key==="string"?componentInfo.key:null,props=componentInfo.props==null?null:componentInfo.props,owners=getOwnersListFromInstance(virtualInstance),rootType=null,hasErrorBoundary=!1,hasSuspenseBoundary=!1,nearestFiber=getNearestFiber(virtualInstance);if(nearestFiber!==null){var current=nearestFiber;while(current.return!==null){var temp=current;if(current=current.return,temp.tag===SuspenseComponent)hasSuspenseBoundary=!0;else if(isErrorBoundary(temp))hasErrorBoundary=!0}var fiberRoot=current.stateNode;if(fiberRoot!=null&&fiberRoot._debugRootType!==null)rootType=fiberRoot._debugRootType}var plugins={stylex:null},componentLogsEntry=componentInfoToComponentLogsMap.get(componentInfo),isSuspended=null,suspendedBy=getSuspendedByOfInstance(virtualInstance,null),suspendedByRange=getSuspendedByRange(getNearestSuspenseNode(virtualInstance));return{id:virtualInstance.id,canEditHooks:!1,canEditFunctionProps:!1,canEditHooksAndDeletePaths:!1,canEditHooksAndRenamePaths:!1,canEditFunctionPropsDeletePaths:!1,canEditFunctionPropsRenamePaths:!1,canToggleError:supportsTogglingError&&hasErrorBoundary,isErrored:!1,canToggleSuspense:supportsTogglingSuspense&&hasSuspenseBoundary,isSuspended,source,stack:componentInfo.owner==null||componentInfo.debugStack==null?null:parseStackTrace(componentInfo.debugStack,1),hasLegacyContext:!1,key,type:types_ElementTypeVirtual,context:null,hooks:null,props,state:null,errors:componentLogsEntry===void 0?[]:Array.from(componentLogsEntry.errors.entries()),warnings:componentLogsEntry===void 0?[]:Array.from(componentLogsEntry.warnings.entries()),suspendedBy,suspendedByRange,unknownSuspenders:UNKNOWN_SUSPENDERS_NONE,owners,env:componentInfo.env==null?null:componentInfo.env,rootType,rendererPackageName:renderer.rendererPackageName,rendererVersion:renderer.version,plugins,nativeTag:null}}var mostRecentlyInspectedElement=null,hasElementUpdatedSinceLastInspected=!1,currentlyInspectedPaths={};function isMostRecentlyInspectedElement(id){if(mostRecentlyInspectedElement===null)return!1;if(mostRecentlyInspectedElement.id===id)return!0;if(mostRecentlyInspectedElement.type===ElementTypeRoot){var instance=idToDevToolsInstanceMap.get(id);return instance!==void 0&&instance.kind===FIBER_INSTANCE&&instance.parent===null}return!1}function isMostRecentlyInspectedElementCurrent(id){return isMostRecentlyInspectedElement(id)&&!hasElementUpdatedSinceLastInspected}function mergeInspectedPaths(path15){var current=currentlyInspectedPaths;path15.forEach(function(key){if(!current[key])current[key]={};current=current[key]})}function createIsPathAllowed(key,secondaryCategory){return function(path15){switch(secondaryCategory){case"hooks":if(path15.length===1)return!0;if(path15[path15.length-2]==="hookSource"&&path15[path15.length-1]==="fileName")return!0;if(path15[path15.length-1]==="subHooks"||path15[path15.length-2]==="subHooks")return!0;break;case"suspendedBy":if(path15.length<5)return!0;break;default:break}var current=key===null?currentlyInspectedPaths:currentlyInspectedPaths[key];if(!current)return!1;for(var i=0;i<path15.length;i++)if(current=current[path15[i]],!current)return!1;return!0}}function updateSelectedElement(inspectedElement){var{hooks,id,props}=inspectedElement,devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0){console.warn('Could not find DevToolsInstance with id "'.concat(id,'"'));return}if(devtoolsInstance.kind!==FIBER_INSTANCE)return;var fiber=devtoolsInstance.data,elementType=fiber.elementType,stateNode=fiber.stateNode,tag=fiber.tag,type=fiber.type;switch(tag){case ClassComponent:case IncompleteClassComponent:case IndeterminateComponent:global.$r=stateNode;break;case IncompleteFunctionComponent:case FunctionComponent:global.$r={hooks,props,type};break;case ForwardRef:global.$r={hooks,props,type:type.render};break;case MemoComponent:case SimpleMemoComponent:global.$r={hooks,props,type:elementType!=null&&elementType.type!=null?elementType.type:type};break;default:global.$r=null;break}}function storeAsGlobal(id,path15,count){if(isMostRecentlyInspectedElement(id)){var value=utils_getInObject(mostRecentlyInspectedElement,path15),key="$reactTemp".concat(count);window[key]=value,console.log(key),console.log(value)}}function getSerializedElementValueByPath(id,path15){if(isMostRecentlyInspectedElement(id)){var valueToCopy=utils_getInObject(mostRecentlyInspectedElement,path15);return serializeToString(valueToCopy)}}function inspectElement(requestID,id,path15,forceFullData){if(path15!==null)mergeInspectedPaths(path15);if(isMostRecentlyInspectedElement(id)&&!forceFullData){if(!hasElementUpdatedSinceLastInspected)if(path15!==null){var secondaryCategory=null;if(path15[0]==="hooks"||path15[0]==="suspendedBy")secondaryCategory=path15[0];return{id,responseID:requestID,type:"hydrated-path",path:path15,value:cleanForBridge(utils_getInObject(mostRecentlyInspectedElement,path15),createIsPathAllowed(null,secondaryCategory),path15)}}else return{id,responseID:requestID,type:"no-change"}}else currentlyInspectedPaths={};hasElementUpdatedSinceLastInspected=!1;try{mostRecentlyInspectedElement=inspectElementRaw(id)}catch(error){if(error.name==="ReactDebugToolsRenderError"){var message="Error rendering inspected element.",stack;if(console.error(message+`
|
|
498
|
+
`)),console.groupEnd()}}function debugTree(instance){var indent=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(__DEBUG__){var name=(instance.kind!==VIRTUAL_INSTANCE?getDisplayNameForFiber(instance.data):instance.data.name)||"";console.log(" ".repeat(indent)+"- "+(instance.kind===FILTERED_FIBER_INSTANCE?0:instance.id)+" ("+name+")","parent",instance.parent===null?" ":instance.parent.kind===FILTERED_FIBER_INSTANCE?0:instance.parent.id,"next",instance.nextSibling===null?" ":instance.nextSibling.id);var child=instance.firstChild;while(child!==null)debugTree(child,indent+1),child=child.nextSibling}}var hideElementsWithDisplayNames=new Set,hideElementsWithPaths=new Set,hideElementsWithTypes=new Set,hideElementsWithEnvs=new Set,traceUpdatesEnabled=!1,traceUpdatesForNodes=new Set;function applyComponentFilters(componentFilters){hideElementsWithTypes.clear(),hideElementsWithDisplayNames.clear(),hideElementsWithPaths.clear(),hideElementsWithEnvs.clear(),componentFilters.forEach(function(componentFilter){if(!componentFilter.isEnabled)return;switch(componentFilter.type){case ComponentFilterDisplayName:if(componentFilter.isValid&&componentFilter.value!=="")hideElementsWithDisplayNames.add(new RegExp(componentFilter.value,"i"));break;case ComponentFilterElementType:hideElementsWithTypes.add(componentFilter.value);break;case ComponentFilterLocation:if(componentFilter.isValid&&componentFilter.value!=="")hideElementsWithPaths.add(new RegExp(componentFilter.value,"i"));break;case ComponentFilterHOC:hideElementsWithDisplayNames.add(new RegExp("\\("));break;case ComponentFilterEnvironmentName:hideElementsWithEnvs.add(componentFilter.value);break;default:console.warn('Invalid component filter type "'.concat(componentFilter.type,'"'));break}})}if(window.__REACT_DEVTOOLS_COMPONENT_FILTERS__!=null){var componentFiltersWithoutLocationBasedOnes=filterOutLocationComponentFilters(window.__REACT_DEVTOOLS_COMPONENT_FILTERS__);applyComponentFilters(componentFiltersWithoutLocationBasedOnes)}else applyComponentFilters(getDefaultComponentFilters());function updateComponentFilters(componentFilters){if(isProfiling)throw Error("Cannot modify filter preferences while profiling");hook.getFiberRoots(rendererID).forEach(function(root){var rootInstance=rootToFiberInstanceMap.get(root);if(rootInstance===void 0)throw Error("Expected the root instance to already exist when applying filters");currentRoot=rootInstance,unmountInstanceRecursively(rootInstance),rootToFiberInstanceMap.delete(root),flushPendingEvents(),currentRoot=null}),applyComponentFilters(componentFilters),rootDisplayNameCounter.clear(),hook.getFiberRoots(rendererID).forEach(function(root){var current=root.current,newRoot=createFiberInstance(current);if(rootToFiberInstanceMap.set(root,newRoot),idToDevToolsInstanceMap.set(newRoot.id,newRoot),trackedPath!==null)mightBeOnTrackedPath=!0;currentRoot=newRoot,setRootPseudoKey(currentRoot.id,root.current),mountFiberRecursively(root.current,!1),flushPendingEvents(),currentRoot=null}),flushPendingEvents(),needsToFlushComponentLogs=!1}function getEnvironmentNames(){return Array.from(knownEnvironmentNames)}function isFiberHydrated(fiber){if(OffscreenComponent===-1)throw Error("not implemented for legacy suspense");switch(fiber.tag){case HostRoot:var rootState=fiber.memoizedState;return!rootState.isDehydrated;case SuspenseComponent:var suspenseState=fiber.memoizedState;return suspenseState===null||suspenseState.dehydrated===null;default:throw Error("not implemented for work tag "+fiber.tag)}}function shouldFilterVirtual(data,secondaryEnv){if(hideElementsWithTypes.has(types_ElementTypeFunction))return!0;if(hideElementsWithDisplayNames.size>0){var displayName=data.name;if(displayName!=null){var _iterator4=_createForOfIteratorHelper(hideElementsWithDisplayNames),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var displayNameRegExp=_step4.value;if(displayNameRegExp.test(displayName))return!0}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}}}if((data.env==null||hideElementsWithEnvs.has(data.env))&&(secondaryEnv===null||hideElementsWithEnvs.has(secondaryEnv)))return!0;return!1}function shouldFilterFiber(fiber){var{tag,type,key}=fiber;switch(tag){case DehydratedSuspenseComponent:return!0;case HostPortal:case HostText:case LegacyHiddenComponent:case OffscreenComponent:case Throw:return!0;case HostRoot:return!1;case Fragment:return key===null;default:var typeSymbol=getTypeSymbol(type);switch(typeSymbol){case CONCURRENT_MODE_NUMBER:case CONCURRENT_MODE_SYMBOL_STRING:case DEPRECATED_ASYNC_MODE_SYMBOL_STRING:case STRICT_MODE_NUMBER:case STRICT_MODE_SYMBOL_STRING:return!0;default:break}}var elementType=getElementTypeForFiber(fiber);if(hideElementsWithTypes.has(elementType))return!0;if(hideElementsWithDisplayNames.size>0){var displayName=getDisplayNameForFiber(fiber);if(displayName!=null){var _iterator5=_createForOfIteratorHelper(hideElementsWithDisplayNames),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var displayNameRegExp=_step5.value;if(displayNameRegExp.test(displayName))return!0}}catch(err){_iterator5.e(err)}finally{_iterator5.f()}}}if(hideElementsWithEnvs.has("Client"))switch(tag){case ClassComponent:case IncompleteClassComponent:case IncompleteFunctionComponent:case FunctionComponent:case IndeterminateComponent:case ForwardRef:case MemoComponent:case SimpleMemoComponent:return!0}return!1}function getElementTypeForFiber(fiber){var{type,tag}=fiber;switch(tag){case ActivityComponent:return ElementTypeActivity;case ClassComponent:case IncompleteClassComponent:return types_ElementTypeClass;case IncompleteFunctionComponent:case FunctionComponent:case IndeterminateComponent:return types_ElementTypeFunction;case ForwardRef:return types_ElementTypeForwardRef;case HostRoot:return ElementTypeRoot;case HostComponent:case HostHoistable:case HostSingleton:return ElementTypeHostComponent;case HostPortal:case HostText:case Fragment:return ElementTypeOtherOrUnknown;case MemoComponent:case SimpleMemoComponent:return types_ElementTypeMemo;case SuspenseComponent:return ElementTypeSuspense;case SuspenseListComponent:return ElementTypeSuspenseList;case TracingMarkerComponent:return ElementTypeTracingMarker;case ViewTransitionComponent:return ElementTypeViewTransition;default:var typeSymbol=getTypeSymbol(type);switch(typeSymbol){case CONCURRENT_MODE_NUMBER:case CONCURRENT_MODE_SYMBOL_STRING:case DEPRECATED_ASYNC_MODE_SYMBOL_STRING:return ElementTypeOtherOrUnknown;case PROVIDER_NUMBER:case PROVIDER_SYMBOL_STRING:return ElementTypeContext;case CONTEXT_NUMBER:case CONTEXT_SYMBOL_STRING:return ElementTypeContext;case STRICT_MODE_NUMBER:case STRICT_MODE_SYMBOL_STRING:return ElementTypeOtherOrUnknown;case PROFILER_NUMBER:case PROFILER_SYMBOL_STRING:return ElementTypeProfiler;default:return ElementTypeOtherOrUnknown}}}var currentRoot=null;function untrackFiber(nearestInstance,fiber){if(forceErrorForFibers.size>0){if(forceErrorForFibers.delete(fiber),fiber.alternate)forceErrorForFibers.delete(fiber.alternate);if(forceErrorForFibers.size===0&&setErrorHandler!=null)setErrorHandler(shouldErrorFiberAlwaysNull)}if(forceFallbackForFibers.size>0){if(forceFallbackForFibers.delete(fiber),fiber.alternate)forceFallbackForFibers.delete(fiber.alternate);if(forceFallbackForFibers.size===0&&setSuspenseHandler!=null)setSuspenseHandler(shouldSuspendFiberAlwaysFalse)}if(fiber.tag===HostHoistable)releaseHostResource(nearestInstance,fiber.memoizedState);else if(fiber.tag===HostComponent||fiber.tag===HostText||fiber.tag===HostSingleton)releaseHostInstance(nearestInstance,fiber.stateNode);for(var child=fiber.child;child!==null;child=child.sibling)if(shouldFilterFiber(child))untrackFiber(nearestInstance,child)}function getChangeDescription(prevFiber,nextFiber){switch(nextFiber.tag){case ClassComponent:if(prevFiber===null)return{context:null,didHooksChange:!1,isFirstMount:!0,props:null,state:null};else{var data={context:getContextChanged(prevFiber,nextFiber),didHooksChange:!1,isFirstMount:!1,props:getChangedKeys(prevFiber.memoizedProps,nextFiber.memoizedProps),state:getChangedKeys(prevFiber.memoizedState,nextFiber.memoizedState)};return data}case IncompleteFunctionComponent:case FunctionComponent:case IndeterminateComponent:case ForwardRef:case MemoComponent:case SimpleMemoComponent:if(prevFiber===null)return{context:null,didHooksChange:!1,isFirstMount:!0,props:null,state:null};else{var indices=getChangedHooksIndices(prevFiber.memoizedState,nextFiber.memoizedState),_data={context:getContextChanged(prevFiber,nextFiber),didHooksChange:indices!==null&&indices.length>0,isFirstMount:!1,props:getChangedKeys(prevFiber.memoizedProps,nextFiber.memoizedProps),state:null,hooks:indices};return _data}default:return null}}function getContextChanged(prevFiber,nextFiber){var prevContext=prevFiber.dependencies&&prevFiber.dependencies.firstContext,nextContext=nextFiber.dependencies&&nextFiber.dependencies.firstContext;while(prevContext&&nextContext){if(prevContext.context!==nextContext.context)return!1;if(!shared_objectIs(prevContext.memoizedValue,nextContext.memoizedValue))return!0;prevContext=prevContext.next,nextContext=nextContext.next}return!1}function isHookThatCanScheduleUpdate(hookObject){var queue=hookObject.queue;if(!queue)return!1;var boundHasOwnProperty=shared_hasOwnProperty.bind(queue);if(boundHasOwnProperty("pending"))return!0;return boundHasOwnProperty("value")&&boundHasOwnProperty("getSnapshot")&&typeof queue.getSnapshot==="function"}function didStatefulHookChange(prev,next){var prevMemoizedState=prev.memoizedState,nextMemoizedState=next.memoizedState;if(isHookThatCanScheduleUpdate(prev))return prevMemoizedState!==nextMemoizedState;return!1}function getChangedHooksIndices(prev,next){if(prev==null||next==null)return null;var indices=[],index=0;while(next!==null){if(didStatefulHookChange(prev,next))indices.push(index);next=next.next,prev=prev.next,index++}return indices}function getChangedKeys(prev,next){if(prev==null||next==null)return null;var keys=new Set([].concat(fiber_renderer_toConsumableArray(Object.keys(prev)),fiber_renderer_toConsumableArray(Object.keys(next)))),changedKeys=[],_iterator6=_createForOfIteratorHelper(keys),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var key=_step6.value;if(prev[key]!==next[key])changedKeys.push(key)}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}return changedKeys}function didFiberRender(prevFiber,nextFiber){switch(nextFiber.tag){case ClassComponent:case FunctionComponent:case ContextConsumer:case MemoComponent:case SimpleMemoComponent:case ForwardRef:var PerformedWork=1;return(getFiberFlags(nextFiber)&PerformedWork)===PerformedWork;default:return prevFiber.memoizedProps!==nextFiber.memoizedProps||prevFiber.memoizedState!==nextFiber.memoizedState||prevFiber.ref!==nextFiber.ref}}var pendingOperations=[],pendingRealUnmountedIDs=[],pendingRealUnmountedSuspenseIDs=[],pendingSuspenderChanges=new Set,pendingOperationsQueue=[],pendingStringTable=new Map,pendingStringTableLength=0,pendingUnmountedRootID=null;function pushOperation(op){pendingOperations.push(op)}function shouldBailoutWithPendingOperations(){if(isProfiling){if(currentCommitProfilingMetadata!=null&¤tCommitProfilingMetadata.durations.length>0)return!1}return pendingOperations.length===0&&pendingRealUnmountedIDs.length===0&&pendingRealUnmountedSuspenseIDs.length===0&&pendingSuspenderChanges.size===0&&pendingUnmountedRootID===null}function flushOrQueueOperations(operations){if(shouldBailoutWithPendingOperations())return;if(pendingOperationsQueue!==null)pendingOperationsQueue.push(operations);else hook.emit("operations",operations)}function recordConsoleLogs(instance,componentLogsEntry){if(componentLogsEntry===void 0){if(instance.logCount===0)return!1;return instance.logCount=0,pushOperation(TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS),pushOperation(instance.id),pushOperation(0),pushOperation(0),!0}else{var totalCount=componentLogsEntry.errorsCount+componentLogsEntry.warningsCount;if(instance.logCount===totalCount)return!1;return instance.logCount=totalCount,pushOperation(TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS),pushOperation(instance.id),pushOperation(componentLogsEntry.errorsCount),pushOperation(componentLogsEntry.warningsCount),!0}}function flushPendingEvents(){if(shouldBailoutWithPendingOperations())return;var numUnmountIDs=pendingRealUnmountedIDs.length+(pendingUnmountedRootID===null?0:1),numUnmountSuspenseIDs=pendingRealUnmountedSuspenseIDs.length,numSuspenderChanges=pendingSuspenderChanges.size,operations=Array(3+pendingStringTableLength+(numUnmountSuspenseIDs>0?2+numUnmountSuspenseIDs:0)+(numUnmountIDs>0?2+numUnmountIDs:0)+pendingOperations.length+(numSuspenderChanges>0?2+numSuspenderChanges*3:0)),i=0;if(operations[i++]=rendererID,currentRoot===null)operations[i++]=-1;else operations[i++]=currentRoot.id;if(operations[i++]=pendingStringTableLength,pendingStringTable.forEach(function(entry,stringKey){var encodedString=entry.encodedString,length=encodedString.length;operations[i++]=length;for(var j2=0;j2<length;j2++)operations[i+j2]=encodedString[j2];i+=length}),numUnmountSuspenseIDs>0){operations[i++]=SUSPENSE_TREE_OPERATION_REMOVE,operations[i++]=numUnmountSuspenseIDs;for(var j=0;j<pendingRealUnmountedSuspenseIDs.length;j++)operations[i++]=pendingRealUnmountedSuspenseIDs[j]}if(numUnmountIDs>0){operations[i++]=TREE_OPERATION_REMOVE,operations[i++]=numUnmountIDs;for(var _j=0;_j<pendingRealUnmountedIDs.length;_j++)operations[i++]=pendingRealUnmountedIDs[_j];if(pendingUnmountedRootID!==null)operations[i]=pendingUnmountedRootID,i++}for(var _j2=0;_j2<pendingOperations.length;_j2++)operations[i+_j2]=pendingOperations[_j2];if(i+=pendingOperations.length,numSuspenderChanges>0)operations[i++]=SUSPENSE_TREE_OPERATION_SUSPENDERS,operations[i++]=numSuspenderChanges,pendingSuspenderChanges.forEach(function(fiberIdWithChanges){var suspense=idToSuspenseNodeMap.get(fiberIdWithChanges);if(suspense===void 0)throw Error('Could not send suspender changes for "'.concat(fiberIdWithChanges,'" since the Fiber no longer exists.'));operations[i++]=fiberIdWithChanges,operations[i++]=suspense.hasUniqueSuspenders?1:0;var instance=suspense.instance,isSuspended=(instance.kind===FIBER_INSTANCE||instance.kind===FILTERED_FIBER_INSTANCE)&&instance.data.tag===SuspenseComponent&&instance.data.memoizedState!==null;operations[i++]=isSuspended?1:0,operations[i++]=suspense.environments.size,suspense.environments.forEach(function(count,env){operations[i++]=getStringID(env)})});flushOrQueueOperations(operations),pendingOperations.length=0,pendingRealUnmountedIDs.length=0,pendingRealUnmountedSuspenseIDs.length=0,pendingSuspenderChanges.clear(),pendingUnmountedRootID=null,pendingStringTable.clear(),pendingStringTableLength=0}function measureHostInstance(instance){if(renderer_typeof(instance)!=="object"||instance===null)return null;if(typeof instance.getClientRects==="function"||instance.nodeType===3){var doc=instance.ownerDocument;if(instance===doc.documentElement)return[{x:0,y:0,width:instance.scrollWidth,height:instance.scrollHeight}];var result=[],win=doc&&doc.defaultView,scrollX=win?win.scrollX:0,scrollY=win?win.scrollY:0,rects;if(instance.nodeType===3){if(typeof doc.createRange!=="function")return null;var range=doc.createRange();if(typeof range.getClientRects!=="function")return null;range.selectNodeContents(instance),rects=range.getClientRects()}else rects=instance.getClientRects();for(var i=0;i<rects.length;i++){var rect=rects[i];result.push({x:rect.x+scrollX,y:rect.y+scrollY,width:rect.width,height:rect.height})}return result}if(instance.canonical){var publicInstance=instance.canonical.publicInstance;if(!publicInstance)return null;if(typeof publicInstance.getBoundingClientRect==="function")return[publicInstance.getBoundingClientRect()];if(typeof publicInstance.unstable_getBoundingClientRect==="function")return[publicInstance.unstable_getBoundingClientRect()]}return null}function measureInstance(instance){var hostInstances=findAllCurrentHostInstances(instance),result=null;for(var i=0;i<hostInstances.length;i++){var childResult=measureHostInstance(hostInstances[i]);if(childResult!==null)if(result===null)result=childResult;else result=result.concat(childResult)}return result}function getStringID(string){if(string===null)return 0;var existingEntry=pendingStringTable.get(string);if(existingEntry!==void 0)return existingEntry.id;var id=pendingStringTable.size+1,encodedString=utfEncodeString(string);return pendingStringTable.set(string,{encodedString,id}),pendingStringTableLength+=encodedString.length+1,id}var isInDisconnectedSubtree=!1;function recordMount(fiber,parentInstance){var isRoot=fiber.tag===HostRoot,fiberInstance;if(isRoot){var entry=rootToFiberInstanceMap.get(fiber.stateNode);if(entry===void 0)throw Error("The root should have been registered at this point");fiberInstance=entry}else fiberInstance=createFiberInstance(fiber);if(idToDevToolsInstanceMap.set(fiberInstance.id,fiberInstance),__DEBUG__)debug2("recordMount()",fiberInstance,parentInstance);return recordReconnect(fiberInstance,parentInstance),fiberInstance}function recordReconnect(fiberInstance,parentInstance){if(isInDisconnectedSubtree)return;var{id,data:fiber}=fiberInstance,isProfilingSupported=fiber.hasOwnProperty("treeBaseDuration"),isRoot=fiber.tag===HostRoot;if(isRoot){var hasOwnerMetadata=fiber.hasOwnProperty("_debugOwner"),profilingFlags=0;if(isProfilingSupported){if(profilingFlags=PROFILING_FLAG_BASIC_SUPPORT,typeof injectProfilingHooks==="function")profilingFlags|=PROFILING_FLAG_TIMELINE_SUPPORT;if(supportsPerformanceTracks)profilingFlags|=PROFILING_FLAG_PERFORMANCE_TRACKS_SUPPORT}var isProductionBuildOfRenderer=renderer.bundleType===0;if(pushOperation(TREE_OPERATION_ADD),pushOperation(id),pushOperation(ElementTypeRoot),pushOperation((fiber.mode&StrictModeBits)!==0?1:0),pushOperation(profilingFlags),pushOperation(!isProductionBuildOfRenderer&&StrictModeBits!==0?1:0),pushOperation(hasOwnerMetadata?1:0),isProfiling){if(displayNamesByRootID!==null)displayNamesByRootID.set(id,getDisplayNameForRoot(fiber))}}else{var key=fiber.key,displayName=getDisplayNameForFiber(fiber),elementType=getElementTypeForFiber(fiber),debugOwner=getUnfilteredOwner(fiber),ownerInstance=findNearestOwnerInstance(parentInstance,debugOwner);if(ownerInstance!==null&&debugOwner===fiber._debugOwner&&fiber._debugStack!=null&&ownerInstance.source===null)ownerInstance.source=fiber._debugStack;var unfilteredParent=parentInstance;while(unfilteredParent!==null&&unfilteredParent.kind===FILTERED_FIBER_INSTANCE)unfilteredParent=unfilteredParent.parent;var ownerID=ownerInstance===null?0:ownerInstance.id,parentID=unfilteredParent===null?0:unfilteredParent.id,displayNameStringID=getStringID(displayName),keyString=key===null?null:String(key),keyStringID=getStringID(keyString),nameProp=fiber.tag===SuspenseComponent?fiber.memoizedProps.name:fiber.tag===ActivityComponent?fiber.memoizedProps.name:null,namePropString=nameProp==null?null:String(nameProp),namePropStringID=getStringID(namePropString);if(pushOperation(TREE_OPERATION_ADD),pushOperation(id),pushOperation(elementType),pushOperation(parentID),pushOperation(ownerID),pushOperation(displayNameStringID),pushOperation(keyStringID),pushOperation(namePropStringID),(fiber.mode&StrictModeBits)!==0){var parentFiber=null,parentFiberInstance=parentInstance;while(parentFiberInstance!==null){if(parentFiberInstance.kind===FIBER_INSTANCE){parentFiber=parentFiberInstance.data;break}parentFiberInstance=parentFiberInstance.parent}if(parentFiber===null||(parentFiber.mode&StrictModeBits)===0)pushOperation(TREE_OPERATION_SET_SUBTREE_MODE),pushOperation(id),pushOperation(StrictMode)}}var componentLogsEntry=fiberToComponentLogsMap.get(fiber);if(componentLogsEntry===void 0&&fiber.alternate!==null)componentLogsEntry=fiberToComponentLogsMap.get(fiber.alternate);if(recordConsoleLogs(fiberInstance,componentLogsEntry),isProfilingSupported)recordProfilingDurations(fiberInstance,null)}function recordVirtualMount(instance,parentInstance,secondaryEnv){var id=instance.id;idToDevToolsInstanceMap.set(id,instance),recordVirtualReconnect(instance,parentInstance,secondaryEnv)}function recordVirtualReconnect(instance,parentInstance,secondaryEnv){if(isInDisconnectedSubtree)return;var componentInfo=instance.data,key=typeof componentInfo.key==="string"?componentInfo.key:null,env=componentInfo.env,displayName=componentInfo.name||"";if(typeof env==="string"){if(secondaryEnv!==null)displayName=secondaryEnv+"("+displayName+")";displayName=env+"("+displayName+")"}var elementType=types_ElementTypeVirtual,debugOwner=getUnfilteredOwner(componentInfo),ownerInstance=findNearestOwnerInstance(parentInstance,debugOwner);if(ownerInstance!==null&&debugOwner===componentInfo.owner&&componentInfo.debugStack!=null&&ownerInstance.source===null)ownerInstance.source=componentInfo.debugStack;var unfilteredParent=parentInstance;while(unfilteredParent!==null&&unfilteredParent.kind===FILTERED_FIBER_INSTANCE)unfilteredParent=unfilteredParent.parent;var ownerID=ownerInstance===null?0:ownerInstance.id,parentID=unfilteredParent===null?0:unfilteredParent.id,displayNameStringID=getStringID(displayName),keyString=key===null?null:String(key),keyStringID=getStringID(keyString),namePropStringID=getStringID(null),id=instance.id;pushOperation(TREE_OPERATION_ADD),pushOperation(id),pushOperation(elementType),pushOperation(parentID),pushOperation(ownerID),pushOperation(displayNameStringID),pushOperation(keyStringID),pushOperation(namePropStringID);var componentLogsEntry=componentInfoToComponentLogsMap.get(componentInfo);recordConsoleLogs(instance,componentLogsEntry)}function recordSuspenseMount(suspenseInstance,parentSuspenseInstance){var fiberInstance=suspenseInstance.instance;if(fiberInstance.kind===FILTERED_FIBER_INSTANCE)throw Error("Cannot record a mount for a filtered Fiber instance.");var fiberID=fiberInstance.id,unfilteredParent=parentSuspenseInstance;while(unfilteredParent!==null&&unfilteredParent.instance.kind===FILTERED_FIBER_INSTANCE)unfilteredParent=unfilteredParent.parent;var unfilteredParentInstance=unfilteredParent!==null?unfilteredParent.instance:null;if(unfilteredParentInstance!==null&&unfilteredParentInstance.kind===FILTERED_FIBER_INSTANCE)throw Error("Should not have a filtered instance at this point. This is a bug.");var parentID=unfilteredParentInstance===null?0:unfilteredParentInstance.id,fiber=fiberInstance.data,props=fiber.memoizedProps,name=fiber.tag!==SuspenseComponent||props===null?null:props.name||null,nameStringID=getStringID(name),isSuspended=fiber.tag===SuspenseComponent&&fiber.memoizedState!==null;if(__DEBUG__)console.log("recordSuspenseMount()",suspenseInstance);idToSuspenseNodeMap.set(fiberID,suspenseInstance),pushOperation(SUSPENSE_TREE_OPERATION_ADD),pushOperation(fiberID),pushOperation(parentID),pushOperation(nameStringID),pushOperation(isSuspended?1:0);var rects=suspenseInstance.rects;if(rects===null)pushOperation(-1);else{pushOperation(rects.length);for(var i=0;i<rects.length;++i){var rect=rects[i];pushOperation(Math.round(rect.x*1000)),pushOperation(Math.round(rect.y*1000)),pushOperation(Math.round(rect.width*1000)),pushOperation(Math.round(rect.height*1000))}}}function recordUnmount(fiberInstance){if(__DEBUG__)debug2("recordUnmount()",fiberInstance,reconcilingParent);recordDisconnect(fiberInstance);var suspenseNode=fiberInstance.suspenseNode;if(suspenseNode!==null)recordSuspenseUnmount(suspenseNode);idToDevToolsInstanceMap.delete(fiberInstance.id),untrackFiber(fiberInstance,fiberInstance.data)}function recordDisconnect(fiberInstance){if(isInDisconnectedSubtree)return;var fiber=fiberInstance.data;if(trackedPathMatchInstance===fiberInstance)setTrackedPath(null);var id=fiberInstance.id,isRoot=fiber.tag===HostRoot;if(isRoot)pendingUnmountedRootID=id;else pendingRealUnmountedIDs.push(id)}function recordSuspenseResize(suspenseNode){if(__DEBUG__)console.log("recordSuspenseResize()",suspenseNode);var fiberInstance=suspenseNode.instance;if(fiberInstance.kind!==FIBER_INSTANCE)return;pushOperation(SUSPENSE_TREE_OPERATION_RESIZE),pushOperation(fiberInstance.id);var rects=suspenseNode.rects;if(rects===null)pushOperation(-1);else{pushOperation(rects.length);for(var i=0;i<rects.length;++i){var rect=rects[i];pushOperation(Math.round(rect.x*1000)),pushOperation(Math.round(rect.y*1000)),pushOperation(Math.round(rect.width*1000)),pushOperation(Math.round(rect.height*1000))}}}function recordSuspenseSuspenders(suspenseNode){if(__DEBUG__)console.log("recordSuspenseSuspenders()",suspenseNode);var fiberInstance=suspenseNode.instance;if(fiberInstance.kind!==FIBER_INSTANCE)return;suspenseNode.environments.forEach(function(count,env){getStringID(env)}),pendingSuspenderChanges.add(fiberInstance.id)}function recordSuspenseUnmount(suspenseInstance){if(__DEBUG__)console.log("recordSuspenseUnmount()",suspenseInstance,reconcilingParentSuspenseNode);var devtoolsInstance=suspenseInstance.instance;if(devtoolsInstance.kind!==FIBER_INSTANCE)throw Error("Can't unmount a filtered SuspenseNode. This is a bug.");var fiberInstance=devtoolsInstance,id=fiberInstance.id;pendingRealUnmountedSuspenseIDs.push(id),pendingSuspenderChanges.delete(id),idToSuspenseNodeMap.delete(id)}var remainingReconcilingChildren=null,previouslyReconciledSibling=null,reconcilingParent=null,remainingReconcilingChildrenSuspenseNodes=null,previouslyReconciledSiblingSuspenseNode=null,reconcilingParentSuspenseNode=null;function ioExistsInSuspenseAncestor(suspenseNode,ioInfo){var ancestor=suspenseNode.parent;while(ancestor!==null){if(ancestor.suspendedBy.has(ioInfo))return!0;ancestor=ancestor.parent}return!1}function insertSuspendedBy(asyncInfo){if(reconcilingParent===null||reconcilingParentSuspenseNode===null)throw Error("It should not be possible to have suspended data outside the root. Even suspending at the first position is still a child of the root.");var parentSuspenseNode=reconcilingParentSuspenseNode,parentInstance=reconcilingParent;while(parentInstance.kind===FILTERED_FIBER_INSTANCE&&parentInstance.parent!==null&&parentInstance!==parentSuspenseNode.instance)parentInstance=parentInstance.parent;var suspenseNodeSuspendedBy=parentSuspenseNode.suspendedBy,ioInfo=asyncInfo.awaited,suspendedBySet=suspenseNodeSuspendedBy.get(ioInfo);if(suspendedBySet===void 0){suspendedBySet=new Set,suspenseNodeSuspendedBy.set(ioInfo,suspendedBySet);var env=ioInfo.env;if(env!=null){var environmentCounts=parentSuspenseNode.environments,count=environmentCounts.get(env);if(count===void 0||count===0)environmentCounts.set(env,1),recordSuspenseSuspenders(parentSuspenseNode);else environmentCounts.set(env,count+1)}}if(!suspendedBySet.has(parentInstance)){if(suspendedBySet.add(parentInstance),!parentSuspenseNode.hasUniqueSuspenders&&!ioExistsInSuspenseAncestor(parentSuspenseNode,ioInfo))parentSuspenseNode.hasUniqueSuspenders=!0,recordSuspenseSuspenders(parentSuspenseNode)}parentSuspenseNode.hasUnknownSuspenders=!1;var suspendedBy=parentInstance.suspendedBy;if(suspendedBy===null)parentInstance.suspendedBy=[asyncInfo];else if(suspendedBy.indexOf(asyncInfo)===-1)suspendedBy.push(asyncInfo)}function getAwaitInSuspendedByFromIO(suspensedBy,ioInfo){for(var i=0;i<suspensedBy.length;i++){var asyncInfo=suspensedBy[i];if(asyncInfo.awaited===ioInfo)return asyncInfo}return null}function unblockSuspendedBy(parentSuspenseNode,ioInfo){var firstChild=parentSuspenseNode.firstChild;if(firstChild===null)return;var node=firstChild;while(node!==null){if(node.suspendedBy.has(ioInfo)){if(!node.hasUniqueSuspenders)recordSuspenseSuspenders(node);node.hasUniqueSuspenders=!0,node.hasUnknownSuspenders=!1}else if(node.firstChild!==null){node=node.firstChild;continue}while(node.nextSibling===null){if(node.parent===null||node.parent===parentSuspenseNode)return;node=node.parent}node=node.nextSibling}}function removePreviousSuspendedBy(instance,previousSuspendedBy,parentSuspenseNode){var suspenseNode=instance.suspenseNode===null?parentSuspenseNode:instance.suspenseNode;if(previousSuspendedBy!==null&&suspenseNode!==null){var nextSuspendedBy=instance.suspendedBy,changedEnvironment=!1;for(var i=0;i<previousSuspendedBy.length;i++){var asyncInfo=previousSuspendedBy[i];if(nextSuspendedBy===null||nextSuspendedBy.indexOf(asyncInfo)===-1&&getAwaitInSuspendedByFromIO(nextSuspendedBy,asyncInfo.awaited)===null){var ioInfo=asyncInfo.awaited,suspendedBySet=suspenseNode.suspendedBy.get(ioInfo);if(suspendedBySet===void 0||!suspendedBySet.delete(instance)){var alreadyRemovedIO=!1;for(var j=0;j<i;j++){var removedIOInfo=previousSuspendedBy[j].awaited;if(removedIOInfo===ioInfo){alreadyRemovedIO=!0;break}}if(!alreadyRemovedIO)throw Error("We are cleaning up async info that was not on the parent Suspense boundary. This is a bug in React.")}if(suspendedBySet!==void 0&&suspendedBySet.size===0){suspenseNode.suspendedBy.delete(ioInfo);var env=ioInfo.env;if(env!=null){var environmentCounts=suspenseNode.environments,count=environmentCounts.get(env);if(count===void 0||count===0)throw Error("We are removing an environment but it was not in the set. This is a bug in React.");if(count===1)environmentCounts.delete(env),changedEnvironment=!0;else environmentCounts.set(env,count-1)}}if(suspenseNode.hasUniqueSuspenders&&!ioExistsInSuspenseAncestor(suspenseNode,ioInfo))unblockSuspendedBy(suspenseNode,ioInfo)}}if(changedEnvironment)recordSuspenseSuspenders(suspenseNode)}}function insertChild(instance){var parentInstance=reconcilingParent;if(parentInstance===null)return;if(instance.parent=parentInstance,previouslyReconciledSibling===null)previouslyReconciledSibling=instance,parentInstance.firstChild=instance;else previouslyReconciledSibling.nextSibling=instance,previouslyReconciledSibling=instance;instance.nextSibling=null;var suspenseNode=instance.suspenseNode;if(suspenseNode!==null){var parentNode=reconcilingParentSuspenseNode;if(parentNode!==null){if(suspenseNode.parent=parentNode,previouslyReconciledSiblingSuspenseNode===null)previouslyReconciledSiblingSuspenseNode=suspenseNode,parentNode.firstChild=suspenseNode;else previouslyReconciledSiblingSuspenseNode.nextSibling=suspenseNode,previouslyReconciledSiblingSuspenseNode=suspenseNode;suspenseNode.nextSibling=null}}}function moveChild(instance,previousSibling){removeChild(instance,previousSibling),insertChild(instance)}function removeChild(instance,previousSibling){if(instance.parent===null){if(remainingReconcilingChildren===instance)throw Error("Remaining children should not have items with no parent");else if(instance.nextSibling!==null)throw Error("A deleted instance should not have next siblings");return}var parentInstance=reconcilingParent;if(parentInstance===null)throw Error("Should not have a parent if we are at the root");if(instance.parent!==parentInstance)throw Error("Cannot remove a node from a different parent than is being reconciled.");if(previousSibling===null){if(remainingReconcilingChildren!==instance)throw Error("Expected a placed child to be moved from the remaining set.");remainingReconcilingChildren=instance.nextSibling}else previousSibling.nextSibling=instance.nextSibling;instance.nextSibling=null,instance.parent=null;var suspenseNode=instance.suspenseNode;if(suspenseNode!==null&&suspenseNode.parent!==null){var parentNode=reconcilingParentSuspenseNode;if(parentNode===null)throw Error("Should not have a parent if we are at the root");if(suspenseNode.parent!==parentNode)throw Error("Cannot remove a Suspense node from a different parent than is being reconciled.");var previousSuspenseSibling=remainingReconcilingChildrenSuspenseNodes;if(previousSuspenseSibling===suspenseNode)remainingReconcilingChildrenSuspenseNodes=suspenseNode.nextSibling;else while(previousSuspenseSibling!==null){if(previousSuspenseSibling.nextSibling===suspenseNode){previousSuspenseSibling.nextSibling=suspenseNode.nextSibling;break}previousSuspenseSibling=previousSuspenseSibling.nextSibling}suspenseNode.nextSibling=null,suspenseNode.parent=null}}function isHiddenOffscreen(fiber){switch(fiber.tag){case LegacyHiddenComponent:case OffscreenComponent:return fiber.memoizedState!==null;default:return!1}}function isSuspendedOffscreen(fiber){switch(fiber.tag){case LegacyHiddenComponent:case OffscreenComponent:return fiber.memoizedState!==null&&fiber.return!==null&&fiber.return.tag===SuspenseComponent;default:return!1}}function unmountRemainingChildren(){if(reconcilingParent!==null&&(reconcilingParent.kind===FIBER_INSTANCE||reconcilingParent.kind===FILTERED_FIBER_INSTANCE)&&isSuspendedOffscreen(reconcilingParent.data)&&!isInDisconnectedSubtree){isInDisconnectedSubtree=!0;try{var child=remainingReconcilingChildren;while(child!==null)unmountInstanceRecursively(child),child=remainingReconcilingChildren}finally{isInDisconnectedSubtree=!1}}else{var _child=remainingReconcilingChildren;while(_child!==null)unmountInstanceRecursively(_child),_child=remainingReconcilingChildren}}function unmountSuspenseChildrenRecursively(contentInstance,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining){unmountInstanceRecursively(contentInstance),reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining,unmountRemainingChildren()}function isChildOf(parentInstance,childInstance,grandParent){var instance=childInstance.parent;while(instance!==null){if(parentInstance===instance)return!0;if(instance===parentInstance.parent||instance===grandParent)break;instance=instance.parent}return!1}function areEqualRects(a,b){if(a===null)return b===null;if(b===null)return!1;if(a.length!==b.length)return!1;for(var i=0;i<a.length;i++){var aRect=a[i],bRect=b[i];if(aRect.x!==bRect.x||aRect.y!==bRect.y||aRect.width!==bRect.width||aRect.height!==bRect.height)return!1}return!0}function measureUnchangedSuspenseNodesRecursively(suspenseNode){if(isInDisconnectedSubtree)return;var instance=suspenseNode.instance,isSuspendedSuspenseComponent=(instance.kind===FIBER_INSTANCE||instance.kind===FILTERED_FIBER_INSTANCE)&&instance.data.tag===SuspenseComponent&&instance.data.memoizedState!==null;if(isSuspendedSuspenseComponent)return;var parent=instance.parent;while(parent!==null){if((parent.kind===FIBER_INSTANCE||parent.kind===FILTERED_FIBER_INSTANCE)&&isHiddenOffscreen(parent.data))return;if(parent.suspenseNode!==null)break;parent=parent.parent}var nextRects=measureInstance(suspenseNode.instance),prevRects=suspenseNode.rects;if(areEqualRects(prevRects,nextRects))return;for(var child=suspenseNode.firstChild;child!==null;child=child.nextSibling)measureUnchangedSuspenseNodesRecursively(child);suspenseNode.rects=nextRects,recordSuspenseResize(suspenseNode)}function consumeSuspenseNodesOfExistingInstance(instance){var suspenseNode=remainingReconcilingChildrenSuspenseNodes;if(suspenseNode===null)return;var parentSuspenseNode=reconcilingParentSuspenseNode;if(parentSuspenseNode===null)throw Error("The should not be any remaining suspense node children if there is no parent.");var foundOne=!1,previousSkippedSibling=null;while(suspenseNode!==null)if(isChildOf(instance,suspenseNode.instance,parentSuspenseNode.instance)){foundOne=!0;var nextRemainingSibling=suspenseNode.nextSibling;if(previousSkippedSibling===null)remainingReconcilingChildrenSuspenseNodes=nextRemainingSibling;else previousSkippedSibling.nextSibling=nextRemainingSibling;if(suspenseNode.nextSibling=null,previouslyReconciledSiblingSuspenseNode===null)parentSuspenseNode.firstChild=suspenseNode;else previouslyReconciledSiblingSuspenseNode.nextSibling=suspenseNode;previouslyReconciledSiblingSuspenseNode=suspenseNode,measureUnchangedSuspenseNodesRecursively(suspenseNode),suspenseNode=nextRemainingSibling}else if(foundOne)break;else previousSkippedSibling=suspenseNode,suspenseNode=suspenseNode.nextSibling}function mountVirtualInstanceRecursively(virtualInstance,firstChild,lastChild,traceNearestHostComponentUpdate,virtualLevel){var mightSiblingsBeOnTrackedPath=updateVirtualTrackedPathStateBeforeMount(virtualInstance,reconcilingParent),stashedParent=reconcilingParent,stashedPrevious=previouslyReconciledSibling,stashedRemaining=remainingReconcilingChildren;reconcilingParent=virtualInstance,previouslyReconciledSibling=null,remainingReconcilingChildren=null;try{mountVirtualChildrenRecursively(firstChild,lastChild,traceNearestHostComponentUpdate,virtualLevel+1),recordVirtualProfilingDurations(virtualInstance)}finally{reconcilingParent=stashedParent,previouslyReconciledSibling=stashedPrevious,remainingReconcilingChildren=stashedRemaining,updateTrackedPathStateAfterMount(mightSiblingsBeOnTrackedPath)}}function recordVirtualUnmount(instance){recordVirtualDisconnect(instance),idToDevToolsInstanceMap.delete(instance.id)}function recordVirtualDisconnect(instance){if(isInDisconnectedSubtree)return;if(trackedPathMatchInstance===instance)setTrackedPath(null);var id=instance.id;pendingRealUnmountedIDs.push(id)}function getSecondaryEnvironmentName(debugInfo,index){if(debugInfo!=null){var componentInfo=debugInfo[index];for(var i=index+1;i<debugInfo.length;i++){var debugEntry=debugInfo[i];if(typeof debugEntry.env==="string")return componentInfo.env!==debugEntry.env?debugEntry.env:null}}return null}function trackDebugInfoFromLazyType(fiber){var type=fiber.elementType,typeSymbol=getTypeSymbol(type);if(typeSymbol===LAZY_SYMBOL_STRING){var debugInfo=type._debugInfo;if(debugInfo)for(var i=0;i<debugInfo.length;i++){var debugEntry=debugInfo[i];if(debugEntry.awaited){var asyncInfo=debugEntry;insertSuspendedBy(asyncInfo)}}}}function trackDebugInfoFromUsedThenables(fiber){var dependencies=fiber.dependencies;if(dependencies==null)return;var thenableState=dependencies._debugThenableState;if(thenableState==null)return;var usedThenables=thenableState.thenables||thenableState;if(!Array.isArray(usedThenables))return;for(var i=0;i<usedThenables.length;i++){var thenable=usedThenables[i],debugInfo=thenable._debugInfo;if(debugInfo)for(var j=0;j<debugInfo.length;j++){var debugEntry=debugInfo[j];if(debugEntry.awaited){var asyncInfo=debugEntry;insertSuspendedBy(asyncInfo)}}}}var hostAsyncInfoCache=new WeakMap;function trackDebugInfoFromHostResource(devtoolsInstance,fiber){var resource=fiber.memoizedState;if(resource==null)return;var existingEntry=hostAsyncInfoCache.get(resource);if(existingEntry!==void 0){insertSuspendedBy(existingEntry);return}var props=fiber.memoizedProps,mayResourceSuspendCommit=resource.type==="stylesheet"&&(typeof props.media!=="string"||typeof matchMedia!=="function"||matchMedia(props.media));if(!mayResourceSuspendCommit)return;var instance=resource.instance;if(instance==null)return;var href=instance.href;if(typeof href!=="string")return;var start=-1,end=-1,byteSize=0;if(typeof performance.getEntriesByType==="function"){var resourceEntries=performance.getEntriesByType("resource");for(var i=0;i<resourceEntries.length;i++){var resourceEntry=resourceEntries[i];if(resourceEntry.name===href)start=resourceEntry.startTime,end=start+resourceEntry.duration,byteSize=resourceEntry.transferSize||0}}var value=instance.sheet,promise=Promise.resolve(value);promise.status="fulfilled",promise.value=value;var ioInfo={name:"stylesheet",start,end,value:promise,owner:fiber};if(byteSize>0)ioInfo.byteSize=byteSize;var asyncInfo={awaited:ioInfo,owner:fiber._debugOwner==null?null:fiber._debugOwner,debugStack:fiber._debugStack==null?null:fiber._debugStack,debugTask:fiber._debugTask==null?null:fiber._debugTask};hostAsyncInfoCache.set(resource,asyncInfo),insertSuspendedBy(asyncInfo)}function trackDebugInfoFromHostComponent(devtoolsInstance,fiber){if(fiber.tag!==HostComponent)return;if((fiber.mode&SuspenseyImagesMode)===0)return;var{type,memoizedProps:props}=fiber,maySuspendCommit=type==="img"&&props.src!=null&&props.src!==""&&props.onLoad==null&&props.loading!=="lazy";if(!maySuspendCommit)return;var instance=fiber.stateNode;if(instance==null)return;var src=instance.currentSrc;if(typeof src!=="string"||src==="")return;var start=-1,end=-1,byteSize=0,fileSize=0;if(typeof performance.getEntriesByType==="function"){var resourceEntries=performance.getEntriesByType("resource");for(var i=0;i<resourceEntries.length;i++){var resourceEntry=resourceEntries[i];if(resourceEntry.name===src)start=resourceEntry.startTime,end=start+resourceEntry.duration,fileSize=resourceEntry.decodedBodySize||0,byteSize=resourceEntry.transferSize||0}}var value={currentSrc:src};if(instance.naturalWidth>0&&instance.naturalHeight>0)value.naturalWidth=instance.naturalWidth,value.naturalHeight=instance.naturalHeight;if(fileSize>0)value.fileSize=fileSize;var promise=Promise.resolve(value);promise.status="fulfilled",promise.value=value;var ioInfo={name:"img",start,end,value:promise,owner:fiber};if(byteSize>0)ioInfo.byteSize=byteSize;var asyncInfo={awaited:ioInfo,owner:fiber._debugOwner==null?null:fiber._debugOwner,debugStack:fiber._debugStack==null?null:fiber._debugStack,debugTask:fiber._debugTask==null?null:fiber._debugTask};insertSuspendedBy(asyncInfo)}function trackThrownPromisesFromRetryCache(suspenseNode,retryCache){if(retryCache!=null){if(!suspenseNode.hasUniqueSuspenders)recordSuspenseSuspenders(suspenseNode);suspenseNode.hasUniqueSuspenders=!0,suspenseNode.hasUnknownSuspenders=!0}}function mountVirtualChildrenRecursively(firstChild,lastChild,traceNearestHostComponentUpdate,virtualLevel){var fiber=firstChild,previousVirtualInstance=null,previousVirtualInstanceFirstFiber=firstChild;while(fiber!==null&&fiber!==lastChild){var level=0;if(fiber._debugInfo)for(var i=0;i<fiber._debugInfo.length;i++){var debugEntry=fiber._debugInfo[i];if(debugEntry.awaited){var asyncInfo=debugEntry;if(level===virtualLevel)insertSuspendedBy(asyncInfo);continue}if(typeof debugEntry.name!=="string")continue;var componentInfo=debugEntry,secondaryEnv=getSecondaryEnvironmentName(fiber._debugInfo,i);if(componentInfo.env!=null)knownEnvironmentNames.add(componentInfo.env);if(secondaryEnv!==null)knownEnvironmentNames.add(secondaryEnv);if(shouldFilterVirtual(componentInfo,secondaryEnv))continue;if(level===virtualLevel){if(previousVirtualInstance===null||previousVirtualInstance.data!==debugEntry){if(previousVirtualInstance!==null)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceFirstFiber,fiber,traceNearestHostComponentUpdate,virtualLevel);previousVirtualInstance=createVirtualInstance(componentInfo),recordVirtualMount(previousVirtualInstance,reconcilingParent,secondaryEnv),insertChild(previousVirtualInstance),previousVirtualInstanceFirstFiber=fiber}level++;break}else level++}if(level===virtualLevel){if(previousVirtualInstance!==null)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceFirstFiber,fiber,traceNearestHostComponentUpdate,virtualLevel),previousVirtualInstance=null;mountFiberRecursively(fiber,traceNearestHostComponentUpdate)}fiber=fiber.sibling}if(previousVirtualInstance!==null)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceFirstFiber,null,traceNearestHostComponentUpdate,virtualLevel)}function mountChildrenRecursively(firstChild,traceNearestHostComponentUpdate){mountVirtualChildrenRecursively(firstChild,null,traceNearestHostComponentUpdate,0)}function mountSuspenseChildrenRecursively(contentFiber,traceNearestHostComponentUpdate,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining){var fallbackFiber=contentFiber.sibling;if(mountVirtualChildrenRecursively(contentFiber,fallbackFiber,traceNearestHostComponentUpdate,0),reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining,fallbackFiber!==null)mountVirtualChildrenRecursively(fallbackFiber,null,traceNearestHostComponentUpdate,0)}function mountFiberRecursively(fiber,traceNearestHostComponentUpdate){var shouldIncludeInTree=!shouldFilterFiber(fiber),newInstance=null,newSuspenseNode=null;if(shouldIncludeInTree){if(newInstance=recordMount(fiber,reconcilingParent),fiber.tag===SuspenseComponent||fiber.tag===HostRoot){if(newSuspenseNode=createSuspenseNode(newInstance),fiber.tag===SuspenseComponent)if(OffscreenComponent===-1){var isTimedOut=fiber.memoizedState!==null;if(!isTimedOut)newSuspenseNode.rects=measureInstance(newInstance)}else{var hydrated=isFiberHydrated(fiber);if(hydrated){var contentFiber=fiber.child;if(contentFiber===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.")}var _isTimedOut=fiber.memoizedState!==null;if(!_isTimedOut)newSuspenseNode.rects=measureInstance(newInstance)}else newSuspenseNode.rects=measureInstance(newInstance);recordSuspenseMount(newSuspenseNode,reconcilingParentSuspenseNode)}if(insertChild(newInstance),__DEBUG__)debug2("mountFiberRecursively()",newInstance,reconcilingParent)}else if(reconcilingParent!==null&&reconcilingParent.kind===VIRTUAL_INSTANCE||fiber.tag===SuspenseComponent||fiber.tag===OffscreenComponent||fiber.tag===LegacyHiddenComponent){if(reconcilingParent!==null&&reconcilingParent.kind===VIRTUAL_INSTANCE&&reconcilingParent.data===fiber._debugOwner&&fiber._debugStack!=null&&reconcilingParent.source===null)reconcilingParent.source=fiber._debugStack;if(newInstance=createFilteredFiberInstance(fiber),fiber.tag===SuspenseComponent)if(newSuspenseNode=createSuspenseNode(newInstance),OffscreenComponent===-1){var _isTimedOut2=fiber.memoizedState!==null;if(!_isTimedOut2)newSuspenseNode.rects=measureInstance(newInstance)}else{var _hydrated=isFiberHydrated(fiber);if(_hydrated){var _contentFiber=fiber.child;if(_contentFiber===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.")}var suspenseState=fiber.memoizedState,_isTimedOut3=suspenseState!==null;if(!_isTimedOut3)newSuspenseNode.rects=measureInstance(newInstance)}if(insertChild(newInstance),__DEBUG__)debug2("mountFiberRecursively()",newInstance,reconcilingParent)}var mightSiblingsBeOnTrackedPath=updateTrackedPathStateBeforeMount(fiber,newInstance),stashedParent=reconcilingParent,stashedPrevious=previouslyReconciledSibling,stashedRemaining=remainingReconcilingChildren,stashedSuspenseParent=reconcilingParentSuspenseNode,stashedSuspensePrevious=previouslyReconciledSiblingSuspenseNode,stashedSuspenseRemaining=remainingReconcilingChildrenSuspenseNodes;if(newInstance!==null)reconcilingParent=newInstance,previouslyReconciledSibling=null,remainingReconcilingChildren=null;var shouldPopSuspenseNode=!1;if(newSuspenseNode!==null)reconcilingParentSuspenseNode=newSuspenseNode,previouslyReconciledSiblingSuspenseNode=null,remainingReconcilingChildrenSuspenseNodes=null,shouldPopSuspenseNode=!0;try{if(traceUpdatesEnabled){if(traceNearestHostComponentUpdate){var elementType=getElementTypeForFiber(fiber);if(elementType===ElementTypeHostComponent)traceUpdatesForNodes.add(fiber.stateNode),traceNearestHostComponentUpdate=!1}}if(trackDebugInfoFromLazyType(fiber),trackDebugInfoFromUsedThenables(fiber),fiber.tag===HostHoistable){var nearestInstance=reconcilingParent;if(nearestInstance===null)throw Error("Did not expect a host hoistable to be the root");aquireHostResource(nearestInstance,fiber.memoizedState),trackDebugInfoFromHostResource(nearestInstance,fiber)}else if(fiber.tag===HostComponent||fiber.tag===HostText||fiber.tag===HostSingleton){var _nearestInstance=reconcilingParent;if(_nearestInstance===null)throw Error("Did not expect a host hoistable to be the root");aquireHostInstance(_nearestInstance,fiber.stateNode),trackDebugInfoFromHostComponent(_nearestInstance,fiber)}if(isSuspendedOffscreen(fiber)){var stashedDisconnected=isInDisconnectedSubtree;isInDisconnectedSubtree=!0;try{if(fiber.child!==null)mountChildrenRecursively(fiber.child,!1)}finally{isInDisconnectedSubtree=stashedDisconnected}}else if(isHiddenOffscreen(fiber));else if(fiber.tag===SuspenseComponent&&OffscreenComponent===-1){if(newSuspenseNode!==null)trackThrownPromisesFromRetryCache(newSuspenseNode,fiber.stateNode);var _isTimedOut4=fiber.memoizedState!==null;if(_isTimedOut4){var primaryChildFragment=fiber.child,fallbackChildFragment=primaryChildFragment?primaryChildFragment.sibling:null;if(fallbackChildFragment){var fallbackChild=fallbackChildFragment.child;if(fallbackChild!==null)updateTrackedPathStateBeforeMount(fallbackChildFragment,null),mountChildrenRecursively(fallbackChild,traceNearestHostComponentUpdate)}}else{var primaryChild=fiber.child;if(primaryChild!==null)mountChildrenRecursively(primaryChild,traceNearestHostComponentUpdate)}}else if(fiber.tag===SuspenseComponent&&OffscreenComponent!==-1&&newInstance!==null&&newSuspenseNode!==null){var _contentFiber2=fiber.child,_hydrated2=isFiberHydrated(fiber);if(_hydrated2){if(_contentFiber2===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");trackThrownPromisesFromRetryCache(newSuspenseNode,fiber.stateNode),mountSuspenseChildrenRecursively(_contentFiber2,traceNearestHostComponentUpdate,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining),shouldPopSuspenseNode=!1}}else if(fiber.child!==null)mountChildrenRecursively(fiber.child,traceNearestHostComponentUpdate)}finally{if(newInstance!==null)reconcilingParent=stashedParent,previouslyReconciledSibling=stashedPrevious,remainingReconcilingChildren=stashedRemaining;if(shouldPopSuspenseNode)reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining}updateTrackedPathStateAfterMount(mightSiblingsBeOnTrackedPath)}function unmountInstanceRecursively(instance){if(__DEBUG__)debug2("unmountInstanceRecursively()",instance,reconcilingParent);var shouldPopSuspenseNode=!1,stashedParent=reconcilingParent,stashedPrevious=previouslyReconciledSibling,stashedRemaining=remainingReconcilingChildren,stashedSuspenseParent=reconcilingParentSuspenseNode,stashedSuspensePrevious=previouslyReconciledSiblingSuspenseNode,stashedSuspenseRemaining=remainingReconcilingChildrenSuspenseNodes,previousSuspendedBy=instance.suspendedBy;if(reconcilingParent=instance,previouslyReconciledSibling=null,remainingReconcilingChildren=instance.firstChild,instance.firstChild=null,instance.suspendedBy=null,instance.suspenseNode!==null)reconcilingParentSuspenseNode=instance.suspenseNode,previouslyReconciledSiblingSuspenseNode=null,remainingReconcilingChildrenSuspenseNodes=instance.suspenseNode.firstChild,shouldPopSuspenseNode=!0;try{if((instance.kind===FIBER_INSTANCE||instance.kind===FILTERED_FIBER_INSTANCE)&&instance.data.tag===SuspenseComponent&&OffscreenComponent!==-1){var _fiber4=instance.data,contentFiberInstance=remainingReconcilingChildren,hydrated=isFiberHydrated(_fiber4);if(hydrated){if(contentFiberInstance===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");unmountSuspenseChildrenRecursively(contentFiberInstance,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining),shouldPopSuspenseNode=!1}else if(contentFiberInstance!==null)throw Error("A dehydrated Suspense node should not have a content Fiber.")}else unmountRemainingChildren();removePreviousSuspendedBy(instance,previousSuspendedBy,reconcilingParentSuspenseNode)}finally{if(reconcilingParent=stashedParent,previouslyReconciledSibling=stashedPrevious,remainingReconcilingChildren=stashedRemaining,shouldPopSuspenseNode)reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining}if(instance.kind===FIBER_INSTANCE)recordUnmount(instance);else if(instance.kind===VIRTUAL_INSTANCE)recordVirtualUnmount(instance);else untrackFiber(instance,instance.data);removeChild(instance,null)}function recordProfilingDurations(fiberInstance,prevFiber){var{id,data:fiber}=fiberInstance,actualDuration=fiber.actualDuration,treeBaseDuration=fiber.treeBaseDuration;if(fiberInstance.treeBaseDuration=treeBaseDuration||0,isProfiling){if(prevFiber==null||treeBaseDuration!==prevFiber.treeBaseDuration){var convertedTreeBaseDuration=Math.floor((treeBaseDuration||0)*1000);pushOperation(TREE_OPERATION_UPDATE_TREE_BASE_DURATION),pushOperation(id),pushOperation(convertedTreeBaseDuration)}if(prevFiber==null||didFiberRender(prevFiber,fiber)){if(actualDuration!=null){var selfDuration=actualDuration,child=fiber.child;while(child!==null)selfDuration-=child.actualDuration||0,child=child.sibling;var metadata=currentCommitProfilingMetadata;if(metadata.durations.push(id,actualDuration,selfDuration),metadata.maxActualDuration=Math.max(metadata.maxActualDuration,actualDuration),recordChangeDescriptions){var changeDescription=getChangeDescription(prevFiber,fiber);if(changeDescription!==null){if(metadata.changeDescriptions!==null)metadata.changeDescriptions.set(id,changeDescription)}}}}var fiberRoot=currentRoot.data.stateNode,updaters=fiberRoot.memoizedUpdaters;if(updaters!=null&&(updaters.has(fiber)||fiber.alternate!==null&&updaters.has(fiber.alternate))){var _metadata=currentCommitProfilingMetadata;if(_metadata.updaters===null)_metadata.updaters=[];_metadata.updaters.push(instanceToSerializedElement(fiberInstance))}}}function recordVirtualProfilingDurations(virtualInstance){var id=virtualInstance.id,treeBaseDuration=0;for(var child=virtualInstance.firstChild;child!==null;child=child.nextSibling)treeBaseDuration+=child.treeBaseDuration;if(isProfiling){var previousTreeBaseDuration=virtualInstance.treeBaseDuration;if(treeBaseDuration!==previousTreeBaseDuration){var convertedTreeBaseDuration=Math.floor((treeBaseDuration||0)*1000);pushOperation(TREE_OPERATION_UPDATE_TREE_BASE_DURATION),pushOperation(id),pushOperation(convertedTreeBaseDuration)}}virtualInstance.treeBaseDuration=treeBaseDuration}function addUnfilteredChildrenIDs(parentInstance,nextChildren){var child=parentInstance.firstChild;while(child!==null){if(child.kind===FILTERED_FIBER_INSTANCE){var _fiber5=child.data;if(isHiddenOffscreen(_fiber5));else addUnfilteredChildrenIDs(child,nextChildren)}else nextChildren.push(child.id);child=child.nextSibling}}function recordResetChildren(parentInstance){if(__DEBUG__){if(parentInstance.firstChild!==null)debug2("recordResetChildren()",parentInstance.firstChild,parentInstance)}var nextChildren=[];addUnfilteredChildrenIDs(parentInstance,nextChildren);var numChildren=nextChildren.length;if(numChildren<2)return;pushOperation(TREE_OPERATION_REORDER_CHILDREN),pushOperation(parentInstance.id),pushOperation(numChildren);for(var i=0;i<nextChildren.length;i++)pushOperation(nextChildren[i])}function addUnfilteredSuspenseChildrenIDs(parentInstance,nextChildren){var child=parentInstance.firstChild;while(child!==null){if(child.instance.kind===FILTERED_FIBER_INSTANCE)addUnfilteredSuspenseChildrenIDs(child,nextChildren);else nextChildren.push(child.instance.id);child=child.nextSibling}}function recordResetSuspenseChildren(parentInstance){if(__DEBUG__){if(parentInstance.firstChild!==null)console.log("recordResetSuspenseChildren()",parentInstance.firstChild,parentInstance)}var nextChildren=[];addUnfilteredSuspenseChildrenIDs(parentInstance,nextChildren);var numChildren=nextChildren.length;if(numChildren<2)return;pushOperation(SUSPENSE_TREE_OPERATION_REORDER_CHILDREN),pushOperation(parentInstance.instance.id),pushOperation(numChildren);for(var i=0;i<nextChildren.length;i++)pushOperation(nextChildren[i])}function updateVirtualInstanceRecursively(virtualInstance,nextFirstChild,nextLastChild,prevFirstChild,traceNearestHostComponentUpdate,virtualLevel){var stashedParent=reconcilingParent,stashedPrevious=previouslyReconciledSibling,stashedRemaining=remainingReconcilingChildren,previousSuspendedBy=virtualInstance.suspendedBy;reconcilingParent=virtualInstance,previouslyReconciledSibling=null,remainingReconcilingChildren=virtualInstance.firstChild,virtualInstance.firstChild=null,virtualInstance.suspendedBy=null;try{var updateFlags=updateVirtualChildrenRecursively(nextFirstChild,nextLastChild,prevFirstChild,traceNearestHostComponentUpdate,virtualLevel+1);if((updateFlags&ShouldResetChildren)!==NoUpdate){if(!isInDisconnectedSubtree)recordResetChildren(virtualInstance);updateFlags&=~ShouldResetChildren}removePreviousSuspendedBy(virtualInstance,previousSuspendedBy,reconcilingParentSuspenseNode);var componentLogsEntry=componentInfoToComponentLogsMap.get(virtualInstance.data);return recordConsoleLogs(virtualInstance,componentLogsEntry),recordVirtualProfilingDurations(virtualInstance),updateFlags}finally{unmountRemainingChildren(),reconcilingParent=stashedParent,previouslyReconciledSibling=stashedPrevious,remainingReconcilingChildren=stashedRemaining}}function updateVirtualChildrenRecursively(nextFirstChild,nextLastChild,prevFirstChild,traceNearestHostComponentUpdate,virtualLevel){var updateFlags=NoUpdate,nextChild=nextFirstChild,prevChildAtSameIndex=prevFirstChild,previousVirtualInstance=null,previousVirtualInstanceWasMount=!1,previousVirtualInstanceNextFirstFiber=nextFirstChild,previousVirtualInstancePrevFirstFiber=prevFirstChild;while(nextChild!==null&&nextChild!==nextLastChild){var level=0;if(nextChild._debugInfo)for(var i=0;i<nextChild._debugInfo.length;i++){var debugEntry=nextChild._debugInfo[i];if(debugEntry.awaited){var asyncInfo=debugEntry;if(level===virtualLevel)insertSuspendedBy(asyncInfo);continue}if(typeof debugEntry.name!=="string")continue;var componentInfo=debugEntry,secondaryEnv=getSecondaryEnvironmentName(nextChild._debugInfo,i);if(componentInfo.env!=null)knownEnvironmentNames.add(componentInfo.env);if(secondaryEnv!==null)knownEnvironmentNames.add(secondaryEnv);if(shouldFilterVirtual(componentInfo,secondaryEnv))continue;if(level===virtualLevel){if(previousVirtualInstance===null||previousVirtualInstance.data!==componentInfo){if(previousVirtualInstance!==null)if(previousVirtualInstanceWasMount)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,nextChild,traceNearestHostComponentUpdate,virtualLevel),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;else updateFlags|=updateVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,nextChild,previousVirtualInstancePrevFirstFiber,traceNearestHostComponentUpdate,virtualLevel);var previousSiblingOfBestMatch=null,bestMatch=remainingReconcilingChildren;if(componentInfo.key!=null){bestMatch=remainingReconcilingChildren;while(bestMatch!==null){if(bestMatch.kind===VIRTUAL_INSTANCE&&bestMatch.data.key===componentInfo.key)break;previousSiblingOfBestMatch=bestMatch,bestMatch=bestMatch.nextSibling}}if(bestMatch!==null&&bestMatch.kind===VIRTUAL_INSTANCE&&bestMatch.data.name===componentInfo.name&&bestMatch.data.env===componentInfo.env&&bestMatch.data.key===componentInfo.key)bestMatch.data=componentInfo,moveChild(bestMatch,previousSiblingOfBestMatch),previousVirtualInstance=bestMatch,previousVirtualInstanceWasMount=!1;else{var newVirtualInstance=createVirtualInstance(componentInfo);recordVirtualMount(newVirtualInstance,reconcilingParent,secondaryEnv),insertChild(newVirtualInstance),previousVirtualInstance=newVirtualInstance,previousVirtualInstanceWasMount=!0,updateFlags|=ShouldResetChildren}previousVirtualInstanceNextFirstFiber=nextChild,previousVirtualInstancePrevFirstFiber=prevChildAtSameIndex}level++;break}else level++}if(level===virtualLevel){if(previousVirtualInstance!==null){if(previousVirtualInstanceWasMount)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,nextChild,traceNearestHostComponentUpdate,virtualLevel),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;else updateFlags|=updateVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,nextChild,previousVirtualInstancePrevFirstFiber,traceNearestHostComponentUpdate,virtualLevel);previousVirtualInstance=null}var prevChild=void 0;if(prevChildAtSameIndex===nextChild)prevChild=nextChild;else prevChild=nextChild.alternate;var previousSiblingOfExistingInstance=null,existingInstance=null;if(prevChild!==null){existingInstance=remainingReconcilingChildren;while(existingInstance!==null){if(existingInstance.data===prevChild)break;previousSiblingOfExistingInstance=existingInstance,existingInstance=existingInstance.nextSibling}}if(existingInstance!==null){var fiberInstance=existingInstance;if(prevChild!==prevChildAtSameIndex)updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;moveChild(fiberInstance,previousSiblingOfExistingInstance),updateFlags|=updateFiberRecursively(fiberInstance,nextChild,prevChild,traceNearestHostComponentUpdate)}else if(prevChild!==null&&shouldFilterFiber(nextChild)){if(prevChild!==prevChildAtSameIndex)updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;updateFlags|=updateFiberRecursively(null,nextChild,prevChild,traceNearestHostComponentUpdate)}else mountFiberRecursively(nextChild,traceNearestHostComponentUpdate),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren}if(nextChild=nextChild.sibling,(updateFlags&ShouldResetChildren)===NoUpdate&&prevChildAtSameIndex!==null)prevChildAtSameIndex=prevChildAtSameIndex.sibling}if(previousVirtualInstance!==null)if(previousVirtualInstanceWasMount)mountVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,null,traceNearestHostComponentUpdate,virtualLevel),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;else updateFlags|=updateVirtualInstanceRecursively(previousVirtualInstance,previousVirtualInstanceNextFirstFiber,null,previousVirtualInstancePrevFirstFiber,traceNearestHostComponentUpdate,virtualLevel);if(prevChildAtSameIndex!==null)updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;return updateFlags}function updateChildrenRecursively(nextFirstChild,prevFirstChild,traceNearestHostComponentUpdate){if(nextFirstChild===null)return prevFirstChild!==null?ShouldResetChildren:NoUpdate;return updateVirtualChildrenRecursively(nextFirstChild,null,prevFirstChild,traceNearestHostComponentUpdate,0)}function updateSuspenseChildrenRecursively(nextContentFiber,prevContentFiber,traceNearestHostComponentUpdate,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining){var updateFlags=NoUpdate,prevFallbackFiber=prevContentFiber.sibling,nextFallbackFiber=nextContentFiber.sibling;if(updateFlags|=updateVirtualChildrenRecursively(nextContentFiber,nextFallbackFiber,prevContentFiber,traceNearestHostComponentUpdate,0),reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining,prevFallbackFiber!==null||nextFallbackFiber!==null){if(nextFallbackFiber===null)unmountRemainingChildren();else if(updateFlags|=updateVirtualChildrenRecursively(nextFallbackFiber,null,prevFallbackFiber,traceNearestHostComponentUpdate,0),(updateFlags&ShouldResetSuspenseChildren)!==NoUpdate)updateFlags|=ShouldResetParentSuspenseChildren,updateFlags&=~ShouldResetSuspenseChildren}return updateFlags}function updateFiberRecursively(fiberInstance,nextFiber,prevFiber,traceNearestHostComponentUpdate){if(__DEBUG__){if(fiberInstance!==null)debug2("updateFiberRecursively()",fiberInstance,reconcilingParent)}if(traceUpdatesEnabled){var elementType=getElementTypeForFiber(nextFiber);if(traceNearestHostComponentUpdate){if(elementType===ElementTypeHostComponent)traceUpdatesForNodes.add(nextFiber.stateNode),traceNearestHostComponentUpdate=!1}else if(elementType===types_ElementTypeFunction||elementType===types_ElementTypeClass||elementType===ElementTypeContext||elementType===types_ElementTypeMemo||elementType===types_ElementTypeForwardRef)traceNearestHostComponentUpdate=didFiberRender(prevFiber,nextFiber)}var stashedParent=reconcilingParent,stashedPrevious=previouslyReconciledSibling,stashedRemaining=remainingReconcilingChildren,stashedSuspenseParent=reconcilingParentSuspenseNode,stashedSuspensePrevious=previouslyReconciledSiblingSuspenseNode,stashedSuspenseRemaining=remainingReconcilingChildrenSuspenseNodes,updateFlags=NoUpdate,shouldMeasureSuspenseNode=!1,shouldPopSuspenseNode=!1,previousSuspendedBy=null;if(fiberInstance!==null){if(previousSuspendedBy=fiberInstance.suspendedBy,fiberInstance.data=nextFiber,mostRecentlyInspectedElement!==null&&(mostRecentlyInspectedElement.id===fiberInstance.id||mostRecentlyInspectedElement.type===ElementTypeRoot&&nextFiber.tag===HostRoot)&&didFiberRender(prevFiber,nextFiber))hasElementUpdatedSinceLastInspected=!0;reconcilingParent=fiberInstance,previouslyReconciledSibling=null,remainingReconcilingChildren=fiberInstance.firstChild,fiberInstance.firstChild=null,fiberInstance.suspendedBy=null;var suspenseNode=fiberInstance.suspenseNode;if(suspenseNode!==null)reconcilingParentSuspenseNode=suspenseNode,previouslyReconciledSiblingSuspenseNode=null,remainingReconcilingChildrenSuspenseNodes=suspenseNode.firstChild,suspenseNode.firstChild=null,shouldMeasureSuspenseNode=!0,shouldPopSuspenseNode=!0}try{if(trackDebugInfoFromLazyType(nextFiber),trackDebugInfoFromUsedThenables(nextFiber),nextFiber.tag===HostHoistable){var nearestInstance=reconcilingParent;if(nearestInstance===null)throw Error("Did not expect a host hoistable to be the root");if(prevFiber.memoizedState!==nextFiber.memoizedState)releaseHostResource(nearestInstance,prevFiber.memoizedState),aquireHostResource(nearestInstance,nextFiber.memoizedState);trackDebugInfoFromHostResource(nearestInstance,nextFiber)}else if(nextFiber.tag===HostComponent||nextFiber.tag===HostText||nextFiber.tag===HostSingleton){var _nearestInstance2=reconcilingParent;if(_nearestInstance2===null)throw Error("Did not expect a host hoistable to be the root");if(prevFiber.stateNode!==nextFiber.stateNode)releaseHostInstance(_nearestInstance2,prevFiber.stateNode),aquireHostInstance(_nearestInstance2,nextFiber.stateNode);trackDebugInfoFromHostComponent(_nearestInstance2,nextFiber)}var isLegacySuspense=nextFiber.tag===SuspenseComponent&&OffscreenComponent===-1,prevDidTimeout=isLegacySuspense&&prevFiber.memoizedState!==null,nextDidTimeOut=isLegacySuspense&&nextFiber.memoizedState!==null,prevWasHidden=isHiddenOffscreen(prevFiber),nextIsHidden=isHiddenOffscreen(nextFiber),prevWasSuspended=isSuspendedOffscreen(prevFiber),nextIsSuspended=isSuspendedOffscreen(nextFiber);if(isLegacySuspense){if(fiberInstance!==null&&fiberInstance.suspenseNode!==null){var _suspenseNode=fiberInstance.suspenseNode;if(prevFiber.stateNode===null!==(nextFiber.stateNode===null))trackThrownPromisesFromRetryCache(_suspenseNode,nextFiber.stateNode);if(prevFiber.memoizedState===null!==(nextFiber.memoizedState===null))recordSuspenseSuspenders(_suspenseNode)}}if(prevDidTimeout&&nextDidTimeOut){var nextFiberChild=nextFiber.child,nextFallbackChildSet=nextFiberChild?nextFiberChild.sibling:null,prevFiberChild=prevFiber.child,prevFallbackChildSet=prevFiberChild?prevFiberChild.sibling:null;if(prevFallbackChildSet==null&&nextFallbackChildSet!=null)mountChildrenRecursively(nextFallbackChildSet,traceNearestHostComponentUpdate),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren;var childrenUpdateFlags=nextFallbackChildSet!=null&&prevFallbackChildSet!=null?updateChildrenRecursively(nextFallbackChildSet,prevFallbackChildSet,traceNearestHostComponentUpdate):NoUpdate;updateFlags|=childrenUpdateFlags}else if(prevDidTimeout&&!nextDidTimeOut){var nextPrimaryChildSet=nextFiber.child;if(nextPrimaryChildSet!==null)mountChildrenRecursively(nextPrimaryChildSet,traceNearestHostComponentUpdate),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren}else if(!prevDidTimeout&&nextDidTimeOut){var _nextFiberChild=nextFiber.child,_nextFallbackChildSet=_nextFiberChild?_nextFiberChild.sibling:null;if(_nextFallbackChildSet!=null)mountChildrenRecursively(_nextFallbackChildSet,traceNearestHostComponentUpdate),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren}else if(nextIsSuspended){if(!prevWasSuspended){if(fiberInstance!==null&&!isInDisconnectedSubtree)disconnectChildrenRecursively(remainingReconcilingChildren)}var stashedDisconnected=isInDisconnectedSubtree;isInDisconnectedSubtree=!0;try{updateFlags|=updateChildrenRecursively(nextFiber.child,prevFiber.child,!1)}finally{isInDisconnectedSubtree=stashedDisconnected}}else if(prevWasSuspended&&!nextIsSuspended){var _stashedDisconnected=isInDisconnectedSubtree;isInDisconnectedSubtree=!0;try{if(nextFiber.child!==null)updateFlags|=updateChildrenRecursively(nextFiber.child,prevFiber.child,!1);unmountRemainingChildren(),remainingReconcilingChildren=null}finally{isInDisconnectedSubtree=_stashedDisconnected}if(fiberInstance!==null&&!isInDisconnectedSubtree)reconnectChildrenRecursively(fiberInstance),updateFlags|=ShouldResetChildren|ShouldResetSuspenseChildren}else if(nextIsHidden)if(prevWasHidden);else unmountRemainingChildren();else if(nextFiber.tag===SuspenseComponent&&OffscreenComponent!==-1&&fiberInstance!==null&&fiberInstance.suspenseNode!==null){var _suspenseNode2=fiberInstance.suspenseNode,prevContentFiber=prevFiber.child,nextContentFiber=nextFiber.child,previousHydrated=isFiberHydrated(prevFiber),nextHydrated=isFiberHydrated(nextFiber);if(previousHydrated&&nextHydrated){if(nextContentFiber===null||prevContentFiber===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");if(prevFiber.stateNode===null!==(nextFiber.stateNode===null))trackThrownPromisesFromRetryCache(_suspenseNode2,nextFiber.stateNode);if(prevFiber.memoizedState===null!==(nextFiber.memoizedState===null))recordSuspenseSuspenders(_suspenseNode2);if(shouldMeasureSuspenseNode=!1,updateFlags|=updateSuspenseChildrenRecursively(nextContentFiber,prevContentFiber,traceNearestHostComponentUpdate,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining),shouldPopSuspenseNode=!1,nextFiber.memoizedState===null)shouldMeasureSuspenseNode=!isInDisconnectedSubtree}else if(!previousHydrated&&nextHydrated){if(nextContentFiber===null)throw Error("There should always be an Offscreen Fiber child in a hydrated Suspense boundary.");trackThrownPromisesFromRetryCache(_suspenseNode2,nextFiber.stateNode),recordSuspenseSuspenders(_suspenseNode2),mountSuspenseChildrenRecursively(nextContentFiber,traceNearestHostComponentUpdate,stashedSuspenseParent,stashedSuspensePrevious,stashedSuspenseRemaining),shouldPopSuspenseNode=!1}else if(previousHydrated&&!nextHydrated)throw Error("Encountered a dehydrated Suspense boundary that was previously hydrated.")}else if(nextFiber.child!==prevFiber.child)updateFlags|=updateChildrenRecursively(nextFiber.child,prevFiber.child,traceNearestHostComponentUpdate);else if(fiberInstance!==null){if(fiberInstance.firstChild=remainingReconcilingChildren,remainingReconcilingChildren=null,consumeSuspenseNodesOfExistingInstance(fiberInstance),traceUpdatesEnabled){if(traceNearestHostComponentUpdate){var hostInstances=findAllCurrentHostInstances(fiberInstance);hostInstances.forEach(function(hostInstance){traceUpdatesForNodes.add(hostInstance)})}}}else{var _childrenUpdateFlags=updateChildrenRecursively(nextFiber.child,prevFiber.child,!1);if((_childrenUpdateFlags&ShouldResetChildren)!==NoUpdate)throw Error("The children should not have changed if we pass in the same set.");updateFlags|=_childrenUpdateFlags}if(fiberInstance!==null){if(removePreviousSuspendedBy(fiberInstance,previousSuspendedBy,shouldPopSuspenseNode?reconcilingParentSuspenseNode:stashedSuspenseParent),fiberInstance.kind===FIBER_INSTANCE){var componentLogsEntry=fiberToComponentLogsMap.get(fiberInstance.data);if(componentLogsEntry===void 0&&fiberInstance.data.alternate)componentLogsEntry=fiberToComponentLogsMap.get(fiberInstance.data.alternate);recordConsoleLogs(fiberInstance,componentLogsEntry);var isProfilingSupported=nextFiber.hasOwnProperty("treeBaseDuration");if(isProfilingSupported)recordProfilingDurations(fiberInstance,prevFiber)}}if((updateFlags&ShouldResetChildren)!==NoUpdate){if(fiberInstance!==null&&fiberInstance.kind===FIBER_INSTANCE){if(!nextIsSuspended&&!isInDisconnectedSubtree)recordResetChildren(fiberInstance);updateFlags&=~ShouldResetChildren}}if((updateFlags&ShouldResetSuspenseChildren)!==NoUpdate){if(fiberInstance!==null&&fiberInstance.kind===FIBER_INSTANCE){var _suspenseNode3=fiberInstance.suspenseNode;if(_suspenseNode3!==null)recordResetSuspenseChildren(_suspenseNode3),updateFlags&=~ShouldResetSuspenseChildren}}if((updateFlags&ShouldResetParentSuspenseChildren)!==NoUpdate){if(fiberInstance!==null&&fiberInstance.kind===FIBER_INSTANCE){var _suspenseNode4=fiberInstance.suspenseNode;if(_suspenseNode4!==null)updateFlags&=~ShouldResetParentSuspenseChildren,updateFlags|=ShouldResetSuspenseChildren}}return updateFlags}finally{if(fiberInstance!==null){if(unmountRemainingChildren(),reconcilingParent=stashedParent,previouslyReconciledSibling=stashedPrevious,remainingReconcilingChildren=stashedRemaining,shouldMeasureSuspenseNode){if(!isInDisconnectedSubtree){var _suspenseNode5=fiberInstance.suspenseNode;if(_suspenseNode5===null)throw Error("Attempted to measure a Suspense node that does not exist.");var prevRects=_suspenseNode5.rects,nextRects=measureInstance(fiberInstance);if(!areEqualRects(prevRects,nextRects))_suspenseNode5.rects=nextRects,recordSuspenseResize(_suspenseNode5)}}if(shouldPopSuspenseNode)reconcilingParentSuspenseNode=stashedSuspenseParent,previouslyReconciledSiblingSuspenseNode=stashedSuspensePrevious,remainingReconcilingChildrenSuspenseNodes=stashedSuspenseRemaining}}}function disconnectChildrenRecursively(firstChild){for(var child=firstChild;child!==null;child=child.nextSibling){if((child.kind===FIBER_INSTANCE||child.kind===FILTERED_FIBER_INSTANCE)&&isSuspendedOffscreen(child.data));else disconnectChildrenRecursively(child.firstChild);if(child.kind===FIBER_INSTANCE)recordDisconnect(child);else if(child.kind===VIRTUAL_INSTANCE)recordVirtualDisconnect(child)}}function reconnectChildrenRecursively(parentInstance){for(var child=parentInstance.firstChild;child!==null;child=child.nextSibling){if(child.kind===FIBER_INSTANCE)recordReconnect(child,parentInstance);else if(child.kind===VIRTUAL_INSTANCE){var secondaryEnv=null;recordVirtualReconnect(child,parentInstance,secondaryEnv)}if((child.kind===FIBER_INSTANCE||child.kind===FILTERED_FIBER_INSTANCE)&&isHiddenOffscreen(child.data));else reconnectChildrenRecursively(child)}}function cleanup(){isProfiling=!1}function rootSupportsProfiling(root){if(root.memoizedInteractions!=null)return!0;else if(root.current!=null&&root.current.hasOwnProperty("treeBaseDuration"))return!0;else return!1}function flushInitialOperations(){var localPendingOperationsQueue=pendingOperationsQueue;if(pendingOperationsQueue=null,localPendingOperationsQueue!==null&&localPendingOperationsQueue.length>0)localPendingOperationsQueue.forEach(function(operations){hook.emit("operations",operations)});else{if(trackedPath!==null)mightBeOnTrackedPath=!0;hook.getFiberRoots(rendererID).forEach(function(root){var current=root.current,newRoot=createFiberInstance(current);if(rootToFiberInstanceMap.set(root,newRoot),idToDevToolsInstanceMap.set(newRoot.id,newRoot),currentRoot=newRoot,setRootPseudoKey(currentRoot.id,root.current),isProfiling&&rootSupportsProfiling(root))currentCommitProfilingMetadata={changeDescriptions:recordChangeDescriptions?new Map:null,durations:[],commitTime:renderer_getCurrentTime()-profilingStartTime,maxActualDuration:0,priorityLevel:null,updaters:null,effectDuration:null,passiveEffectDuration:null};mountFiberRecursively(root.current,!1),flushPendingEvents(),needsToFlushComponentLogs=!1,currentRoot=null})}}function handleCommitFiberUnmount(fiber){}function handlePostCommitFiberRoot(root){if(isProfiling&&rootSupportsProfiling(root)){if(currentCommitProfilingMetadata!==null){var _getEffectDurations=getEffectDurations(root),effectDuration=_getEffectDurations.effectDuration,passiveEffectDuration=_getEffectDurations.passiveEffectDuration;currentCommitProfilingMetadata.effectDuration=effectDuration,currentCommitProfilingMetadata.passiveEffectDuration=passiveEffectDuration}}if(needsToFlushComponentLogs)bruteForceFlushErrorsAndWarnings()}function handleCommitFiberRoot(root,priorityLevel){var nextFiber=root.current,prevFiber=null,rootInstance=rootToFiberInstanceMap.get(root);if(!rootInstance)rootInstance=createFiberInstance(nextFiber),rootToFiberInstanceMap.set(root,rootInstance),idToDevToolsInstanceMap.set(rootInstance.id,rootInstance);else prevFiber=rootInstance.data;if(currentRoot=rootInstance,trackedPath!==null)mightBeOnTrackedPath=!0;if(traceUpdatesEnabled)traceUpdatesForNodes.clear();var isProfilingSupported=rootSupportsProfiling(root);if(isProfiling&&isProfilingSupported)currentCommitProfilingMetadata={changeDescriptions:recordChangeDescriptions?new Map:null,durations:[],commitTime:renderer_getCurrentTime()-profilingStartTime,maxActualDuration:0,priorityLevel:priorityLevel==null?null:formatPriorityLevel(priorityLevel),updaters:null,effectDuration:null,passiveEffectDuration:null};var nextIsMounted=nextFiber.child!==null,prevWasMounted=prevFiber!==null&&prevFiber.child!==null;if(!prevWasMounted&&nextIsMounted)setRootPseudoKey(currentRoot.id,nextFiber),mountFiberRecursively(nextFiber,!1);else if(prevWasMounted&&nextIsMounted){if(prevFiber===null)throw Error("Expected a previous Fiber when updating an existing root.");updateFiberRecursively(rootInstance,nextFiber,prevFiber,!1)}else if(prevWasMounted&&!nextIsMounted)unmountInstanceRecursively(rootInstance),removeRootPseudoKey(currentRoot.id),rootToFiberInstanceMap.delete(root);else if(!prevWasMounted&&!nextIsMounted)rootToFiberInstanceMap.delete(root);if(isProfiling&&isProfilingSupported){if(!shouldBailoutWithPendingOperations()){var commitProfilingMetadata=rootToCommitProfilingMetadataMap.get(currentRoot.id);if(commitProfilingMetadata!=null)commitProfilingMetadata.push(currentCommitProfilingMetadata);else rootToCommitProfilingMetadataMap.set(currentRoot.id,[currentCommitProfilingMetadata])}}if(flushPendingEvents(),needsToFlushComponentLogs=!1,traceUpdatesEnabled)hook.emit("traceUpdates",traceUpdatesForNodes);currentRoot=null}function getResourceInstance(fiber){if(fiber.tag===HostHoistable){var resource=fiber.memoizedState;if(renderer_typeof(resource)==="object"&&resource!==null&&resource.instance!=null)return resource.instance}return null}function appendHostInstancesByDevToolsInstance(devtoolsInstance,hostInstances){if(devtoolsInstance.kind!==VIRTUAL_INSTANCE){var _fiber6=devtoolsInstance.data;appendHostInstancesByFiber(_fiber6,hostInstances);return}for(var child=devtoolsInstance.firstChild;child!==null;child=child.nextSibling)appendHostInstancesByDevToolsInstance(child,hostInstances)}function appendHostInstancesByFiber(fiber,hostInstances){var node=fiber;while(!0){if(node.tag===HostComponent||node.tag===HostText||node.tag===HostSingleton||node.tag===HostHoistable){var hostInstance=node.stateNode||getResourceInstance(node);if(hostInstance)hostInstances.push(hostInstance)}else if(node.child){node.child.return=node,node=node.child;continue}if(node===fiber)return;while(!node.sibling){if(!node.return||node.return===fiber)return;node=node.return}node.sibling.return=node.return,node=node.sibling}}function findAllCurrentHostInstances(devtoolsInstance){var hostInstances=[];return appendHostInstancesByDevToolsInstance(devtoolsInstance,hostInstances),hostInstances}function findHostInstancesForElementID(id){try{var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),null;return findAllCurrentHostInstances(devtoolsInstance)}catch(err){return null}}function findLastKnownRectsForID(id){try{var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),null;if(devtoolsInstance.suspenseNode===null)return null;return devtoolsInstance.suspenseNode.rects}catch(err){return null}}function getDisplayNameForElementID(id){var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return null;if(devtoolsInstance.kind===FIBER_INSTANCE){var _fiber7=devtoolsInstance.data;if(_fiber7.tag===HostRoot)return"Initial Paint";if(_fiber7.tag===SuspenseComponent||_fiber7.tag===ActivityComponent){var props=_fiber7.memoizedProps;if(props.name!=null)return props.name;var owner=getUnfilteredOwner(_fiber7);if(owner!=null)if(typeof owner.tag==="number")return getDisplayNameForFiber(owner);else return owner.name||""}return getDisplayNameForFiber(_fiber7)}else return devtoolsInstance.data.name||""}function getNearestSuspenseNode(instance){while(instance.suspenseNode===null){if(instance.parent===null)throw Error("There should always be a SuspenseNode parent on a mounted instance.");instance=instance.parent}return instance.suspenseNode}function getNearestMountedDOMNode(publicInstance){var domNode=publicInstance;while(domNode&&!publicInstanceToDevToolsInstanceMap.has(domNode))domNode=domNode.parentNode;return domNode}function getElementIDForHostInstance(publicInstance){var instance=publicInstanceToDevToolsInstanceMap.get(publicInstance);if(instance!==void 0){if(instance.kind===FILTERED_FIBER_INSTANCE)return instance.parent.id;return instance.id}return null}function getSuspenseNodeIDForHostInstance(publicInstance){var instance=publicInstanceToDevToolsInstanceMap.get(publicInstance);if(instance!==void 0){var suspenseInstance=instance;while(suspenseInstance.suspenseNode===null||suspenseInstance.kind===FILTERED_FIBER_INSTANCE){if(suspenseInstance.parent===null)return null;suspenseInstance=suspenseInstance.parent}return suspenseInstance.id}return null}function getElementAttributeByPath(id,path15){if(isMostRecentlyInspectedElement(id))return utils_getInObject(mostRecentlyInspectedElement,path15);return}function getElementSourceFunctionById(id){var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),null;if(devtoolsInstance.kind!==FIBER_INSTANCE)return null;var fiber=devtoolsInstance.data,elementType=fiber.elementType,tag=fiber.tag,type=fiber.type;switch(tag){case ClassComponent:case IncompleteClassComponent:case IncompleteFunctionComponent:case IndeterminateComponent:case FunctionComponent:return type;case ForwardRef:return type.render;case MemoComponent:case SimpleMemoComponent:return elementType!=null&&elementType.type!=null?elementType.type:type;default:return null}}function instanceToSerializedElement(instance){if(instance.kind===FIBER_INSTANCE){var _fiber8=instance.data;return{displayName:getDisplayNameForFiber(_fiber8)||"Anonymous",id:instance.id,key:_fiber8.key,env:null,stack:_fiber8._debugOwner==null||_fiber8._debugStack==null?null:parseStackTrace(_fiber8._debugStack,1),type:getElementTypeForFiber(_fiber8)}}else{var componentInfo=instance.data;return{displayName:componentInfo.name||"Anonymous",id:instance.id,key:componentInfo.key==null?null:componentInfo.key,env:componentInfo.env==null?null:componentInfo.env,stack:componentInfo.owner==null||componentInfo.debugStack==null?null:parseStackTrace(componentInfo.debugStack,1),type:types_ElementTypeVirtual}}}function getOwnersList(id){var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),null;var self2=instanceToSerializedElement(devtoolsInstance),owners=getOwnersListFromInstance(devtoolsInstance);if(owners===null)return[self2];return owners.unshift(self2),owners.reverse(),owners}function getOwnersListFromInstance(instance){var owner=getUnfilteredOwner(instance.data);if(owner===null)return null;var owners=[],parentInstance=instance.parent;while(parentInstance!==null&&owner!==null){var ownerInstance=findNearestOwnerInstance(parentInstance,owner);if(ownerInstance!==null)owners.push(instanceToSerializedElement(ownerInstance)),owner=getUnfilteredOwner(owner),parentInstance=ownerInstance.parent;else break}return owners}function getUnfilteredOwner(owner){if(owner==null)return null;if(typeof owner.tag==="number"){var ownerFiber=owner;owner=ownerFiber._debugOwner}else{var ownerInfo=owner;owner=ownerInfo.owner}while(owner)if(typeof owner.tag==="number"){var _ownerFiber=owner;if(!shouldFilterFiber(_ownerFiber))return _ownerFiber;owner=_ownerFiber._debugOwner}else{var _ownerInfo=owner;if(!shouldFilterVirtual(_ownerInfo,null))return _ownerInfo;owner=_ownerInfo.owner}return null}function findNearestOwnerInstance(parentInstance,owner){if(owner==null)return null;while(parentInstance!==null){if(parentInstance.data===owner||parentInstance.data===owner.alternate){if(parentInstance.kind===FILTERED_FIBER_INSTANCE)return null;return parentInstance}parentInstance=parentInstance.parent}return null}function inspectHooks(fiber){var originalConsoleMethods={};for(var method in console)try{originalConsoleMethods[method]=console[method],console[method]=function(){}}catch(error){}try{return(0,react_debug_tools.inspectHooksOfFiber)(fiber,getDispatcherRef(renderer))}finally{for(var _method in originalConsoleMethods)try{console[_method]=originalConsoleMethods[_method]}catch(error){}}}function getSuspendedByOfSuspenseNode(suspenseNode,filterByChildInstance){var result=[];if(!suspenseNode.hasUniqueSuspenders)return result;var hooksCacheKey=null,hooksCache=null,streamEntries=new Map;return suspenseNode.suspendedBy.forEach(function(set,ioInfo){var parentNode=suspenseNode.parent;while(parentNode!==null){if(parentNode.suspendedBy.has(ioInfo))return;parentNode=parentNode.parent}if(set.size===0)return;var firstInstance=null;if(filterByChildInstance===null)firstInstance=set.values().next().value;else{var _iterator7=_createForOfIteratorHelper(set.values()),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var childInstance=_step7.value;if(firstInstance===null)firstInstance=childInstance;if(childInstance!==filterByChildInstance&&!isChildOf(filterByChildInstance,childInstance,suspenseNode.instance))return}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}}if(firstInstance!==null&&firstInstance.suspendedBy!==null){var asyncInfo=getAwaitInSuspendedByFromIO(firstInstance.suspendedBy,ioInfo);if(asyncInfo!==null){var hooks=null;if(asyncInfo.stack==null&&asyncInfo.owner==null){if(hooksCacheKey===firstInstance)hooks=hooksCache;else if(firstInstance.kind!==VIRTUAL_INSTANCE){var _fiber9=firstInstance.data;if(_fiber9.dependencies&&_fiber9.dependencies._debugThenableState)hooksCacheKey=firstInstance,hooksCache=hooks=inspectHooks(_fiber9)}}var newIO=asyncInfo.awaited;if((newIO.name==="RSC stream"||newIO.name==="rsc stream")&&newIO.value!=null){var streamPromise=newIO.value,existingEntry=streamEntries.get(streamPromise);if(existingEntry===void 0)streamEntries.set(streamPromise,{asyncInfo,instance:firstInstance,hooks});else{var existingIO=existingEntry.asyncInfo.awaited;if(newIO!==existingIO&&(newIO.byteSize!==void 0&&existingIO.byteSize!==void 0&&newIO.byteSize>existingIO.byteSize||newIO.end>existingIO.end))existingEntry.asyncInfo=asyncInfo,existingEntry.instance=firstInstance,existingEntry.hooks=hooks}}else result.push(serializeAsyncInfo(asyncInfo,firstInstance,hooks))}}}),streamEntries.forEach(function(_ref){var{asyncInfo,instance,hooks}=_ref;result.push(serializeAsyncInfo(asyncInfo,instance,hooks))}),result}function getSuspendedByOfInstance(devtoolsInstance,hooks){var suspendedBy=devtoolsInstance.suspendedBy;if(suspendedBy===null)return[];var foundIOEntries=new Set,streamEntries=new Map,result=[];for(var i=0;i<suspendedBy.length;i++){var asyncInfo=suspendedBy[i],ioInfo=asyncInfo.awaited;if(foundIOEntries.has(ioInfo))continue;if(foundIOEntries.add(ioInfo),(ioInfo.name==="RSC stream"||ioInfo.name==="rsc stream")&&ioInfo.value!=null){var streamPromise=ioInfo.value,existingEntry=streamEntries.get(streamPromise);if(existingEntry===void 0)streamEntries.set(streamPromise,asyncInfo);else{var existingIO=existingEntry.awaited;if(ioInfo!==existingIO&&(ioInfo.byteSize!==void 0&&existingIO.byteSize!==void 0&&ioInfo.byteSize>existingIO.byteSize||ioInfo.end>existingIO.end))streamEntries.set(streamPromise,asyncInfo)}}else result.push(serializeAsyncInfo(asyncInfo,devtoolsInstance,hooks))}return streamEntries.forEach(function(asyncInfo2){result.push(serializeAsyncInfo(asyncInfo2,devtoolsInstance,hooks))}),result}function getSuspendedByOfInstanceSubtree(devtoolsInstance){var suspenseParentInstance=devtoolsInstance;while(suspenseParentInstance.suspenseNode===null){if(suspenseParentInstance.parent===null)return[];suspenseParentInstance=suspenseParentInstance.parent}var suspenseNode=suspenseParentInstance.suspenseNode;return getSuspendedByOfSuspenseNode(suspenseNode,devtoolsInstance)}var FALLBACK_THROTTLE_MS=300;function getSuspendedByRange(suspenseNode){var min=1/0,max=-1/0;suspenseNode.suspendedBy.forEach(function(_2,ioInfo){if(ioInfo.end>max)max=ioInfo.end;if(ioInfo.start<min)min=ioInfo.start});var parentSuspenseNode=suspenseNode.parent;if(parentSuspenseNode!==null){var parentMax=-1/0;parentSuspenseNode.suspendedBy.forEach(function(_2,ioInfo){if(ioInfo.end>parentMax)parentMax=ioInfo.end});var throttleTime=parentMax+FALLBACK_THROTTLE_MS;if(throttleTime>max)max=throttleTime;var startTime2=max-FALLBACK_THROTTLE_MS;if(parentMax>startTime2)startTime2=parentMax;if(startTime2<min)min=startTime2}if(min<1/0&&max>-1/0)return[min,max];return null}function getAwaitStackFromHooks(hooks,asyncInfo){for(var i=0;i<hooks.length;i++){var node=hooks[i],debugInfo=node.debugInfo;if(debugInfo!=null&&debugInfo.indexOf(asyncInfo)!==-1){var source=node.hookSource;if(source!=null&&source.functionName!==null&&source.fileName!==null&&source.lineNumber!==null&&source.columnNumber!==null){var callSite=[source.functionName,source.fileName,source.lineNumber,source.columnNumber,0,0,!1];return[callSite]}else return[]}var matchedStack=getAwaitStackFromHooks(node.subHooks,asyncInfo);if(matchedStack!==null){var _source=node.hookSource;if(_source!=null&&_source.functionName!==null&&_source.fileName!==null&&_source.lineNumber!==null&&_source.columnNumber!==null){var _callSite=[_source.functionName,_source.fileName,_source.lineNumber,_source.columnNumber,0,0,!1];matchedStack.push(_callSite)}return matchedStack}}return null}function serializeAsyncInfo(asyncInfo,parentInstance,hooks){var ioInfo=asyncInfo.awaited,ioOwnerInstance=findNearestOwnerInstance(parentInstance,ioInfo.owner),awaitStack=asyncInfo.debugStack==null?null:parseStackTrace(asyncInfo.debugStack,1),awaitOwnerInstance;if(asyncInfo.owner==null&&(awaitStack===null||awaitStack.length===0)){if(awaitStack=null,awaitOwnerInstance=parentInstance.kind===FILTERED_FIBER_INSTANCE?null:parentInstance,parentInstance.kind===FIBER_INSTANCE||parentInstance.kind===FILTERED_FIBER_INSTANCE){var _fiber10=parentInstance.data;switch(_fiber10.tag){case ClassComponent:case FunctionComponent:case IncompleteClassComponent:case IncompleteFunctionComponent:case IndeterminateComponent:case MemoComponent:case SimpleMemoComponent:if(hooks!==null)awaitStack=getAwaitStackFromHooks(hooks,asyncInfo);break;default:if(_fiber10._debugOwner!=null&&_fiber10._debugStack!=null&&typeof _fiber10._debugStack!=="string")awaitStack=parseStackTrace(_fiber10._debugStack,1),awaitOwnerInstance=findNearestOwnerInstance(parentInstance,_fiber10._debugOwner)}}}else awaitOwnerInstance=findNearestOwnerInstance(parentInstance,asyncInfo.owner);var value=ioInfo.value,resolvedValue=void 0;if(renderer_typeof(value)==="object"&&value!==null&&typeof value.then==="function")switch(value.status){case"fulfilled":resolvedValue=value.value;break;case"rejected":resolvedValue=value.reason;break}return{awaited:{name:ioInfo.name,description:getIODescription(resolvedValue),start:ioInfo.start,end:ioInfo.end,byteSize:ioInfo.byteSize==null?null:ioInfo.byteSize,value:ioInfo.value==null?null:ioInfo.value,env:ioInfo.env==null?null:ioInfo.env,owner:ioOwnerInstance===null?null:instanceToSerializedElement(ioOwnerInstance),stack:ioInfo.debugStack==null?null:parseStackTrace(ioInfo.debugStack,1)},env:asyncInfo.env==null?null:asyncInfo.env,owner:awaitOwnerInstance===null?null:instanceToSerializedElement(awaitOwnerInstance),stack:awaitStack}}function getInstanceAndStyle(id){var instance=null,style=null,devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),{instance,style};if(devtoolsInstance.kind!==FIBER_INSTANCE)return{instance,style};var fiber=devtoolsInstance.data;if(fiber!==null){if(instance=fiber.stateNode,fiber.memoizedProps!==null)style=fiber.memoizedProps.style}return{instance,style}}function isErrorBoundary(fiber){var{tag,type}=fiber;switch(tag){case ClassComponent:case IncompleteClassComponent:var instance=fiber.stateNode;return typeof type.getDerivedStateFromError==="function"||instance!==null&&typeof instance.componentDidCatch==="function";default:return!1}}function inspectElementRaw(id){var devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0)return console.warn('Could not find DevToolsInstance with id "'.concat(id,'"')),null;if(devtoolsInstance.kind===VIRTUAL_INSTANCE)return inspectVirtualInstanceRaw(devtoolsInstance);if(devtoolsInstance.kind===FIBER_INSTANCE){var isRoot=devtoolsInstance.parent===null;return isRoot?inspectRootsRaw(devtoolsInstance.id):inspectFiberInstanceRaw(devtoolsInstance)}throw Error("Unsupported instance kind")}function inspectFiberInstanceRaw(fiberInstance){var fiber=fiberInstance.data;if(fiber==null)return null;var{stateNode,key,memoizedProps,memoizedState,dependencies,tag,type}=fiber,elementType=getElementTypeForFiber(fiber),usesHooks=(tag===FunctionComponent||tag===SimpleMemoComponent||tag===ForwardRef)&&(!!memoizedState||!!dependencies),showState=tag===ClassComponent||tag===IncompleteClassComponent,typeSymbol=getTypeSymbol(type),canViewSource=!1,context2=null;if(tag===ClassComponent||tag===FunctionComponent||tag===IncompleteClassComponent||tag===IncompleteFunctionComponent||tag===IndeterminateComponent||tag===MemoComponent||tag===ForwardRef||tag===SimpleMemoComponent){if(canViewSource=!0,stateNode&&stateNode.context!=null){var shouldHideContext=elementType===types_ElementTypeClass&&!(type.contextTypes||type.contextType);if(!shouldHideContext)context2=stateNode.context}}else if((typeSymbol===CONTEXT_NUMBER||typeSymbol===CONTEXT_SYMBOL_STRING)&&!(type._context===void 0&&type.Provider===type)){var consumerResolvedContext=type._context||type;context2=consumerResolvedContext._currentValue||null;var _current=fiber.return;while(_current!==null){var currentType=_current.type,currentTypeSymbol=getTypeSymbol(currentType);if(currentTypeSymbol===PROVIDER_NUMBER||currentTypeSymbol===PROVIDER_SYMBOL_STRING){var providerResolvedContext=currentType._context||currentType.context;if(providerResolvedContext===consumerResolvedContext){context2=_current.memoizedProps.value;break}}_current=_current.return}}else if(typeSymbol===CONSUMER_SYMBOL_STRING){var _consumerResolvedContext=type._context;context2=_consumerResolvedContext._currentValue||null;var _current2=fiber.return;while(_current2!==null){var _currentType=_current2.type,_currentTypeSymbol=getTypeSymbol(_currentType);if(_currentTypeSymbol===CONTEXT_SYMBOL_STRING){var _providerResolvedContext=_currentType;if(_providerResolvedContext===_consumerResolvedContext){context2=_current2.memoizedProps.value;break}}_current2=_current2.return}}var hasLegacyContext=!1;if(context2!==null)hasLegacyContext=!!type.contextTypes,context2={value:context2};var owners=getOwnersListFromInstance(fiberInstance),hooks=null;if(usesHooks)hooks=inspectHooks(fiber);var rootType=null,current=fiber,hasErrorBoundary=!1,hasSuspenseBoundary=!1;while(current.return!==null){var temp=current;if(current=current.return,temp.tag===SuspenseComponent)hasSuspenseBoundary=!0;else if(isErrorBoundary(temp))hasErrorBoundary=!0}var fiberRoot=current.stateNode;if(fiberRoot!=null&&fiberRoot._debugRootType!==null)rootType=fiberRoot._debugRootType;var isErrored=!1;if(isErrorBoundary(fiber)){var DidCapture=128;isErrored=(fiber.flags&DidCapture)!==0||forceErrorForFibers.get(fiber)===!0||fiber.alternate!==null&&forceErrorForFibers.get(fiber.alternate)===!0}var plugins={stylex:null};if(enableStyleXFeatures){if(memoizedProps!=null&&memoizedProps.hasOwnProperty("xstyle"))plugins.stylex=getStyleXData(memoizedProps.xstyle)}var source=null;if(canViewSource)source=getSourceForFiberInstance(fiberInstance);var componentLogsEntry=fiberToComponentLogsMap.get(fiber);if(componentLogsEntry===void 0&&fiber.alternate!==null)componentLogsEntry=fiberToComponentLogsMap.get(fiber.alternate);var nativeTag=null;if(elementType===ElementTypeHostComponent)nativeTag=getNativeTag(fiber.stateNode);var isSuspended=null;if(tag===SuspenseComponent)isSuspended=memoizedState!==null;var suspendedBy=fiberInstance.suspenseNode!==null?getSuspendedByOfSuspenseNode(fiberInstance.suspenseNode,null):tag===ActivityComponent?getSuspendedByOfInstanceSubtree(fiberInstance):getSuspendedByOfInstance(fiberInstance,hooks),suspendedByRange=getSuspendedByRange(getNearestSuspenseNode(fiberInstance)),unknownSuspenders=UNKNOWN_SUSPENDERS_NONE;if(fiberInstance.suspenseNode!==null&&fiberInstance.suspenseNode.hasUnknownSuspenders&&!isSuspended)if(renderer.bundleType===0)unknownSuspenders=UNKNOWN_SUSPENDERS_REASON_PRODUCTION;else if(!("_debugInfo"in fiber))unknownSuspenders=UNKNOWN_SUSPENDERS_REASON_OLD_VERSION;else unknownSuspenders=UNKNOWN_SUSPENDERS_REASON_THROWN_PROMISE;return{id:fiberInstance.id,canEditHooks:typeof overrideHookState==="function",canEditFunctionProps:typeof overrideProps==="function",canEditHooksAndDeletePaths:typeof overrideHookStateDeletePath==="function",canEditHooksAndRenamePaths:typeof overrideHookStateRenamePath==="function",canEditFunctionPropsDeletePaths:typeof overridePropsDeletePath==="function",canEditFunctionPropsRenamePaths:typeof overridePropsRenamePath==="function",canToggleError:supportsTogglingError&&hasErrorBoundary,isErrored,canToggleSuspense:supportsTogglingSuspense&&hasSuspenseBoundary&&(!isSuspended||forceFallbackForFibers.has(fiber)||fiber.alternate!==null&&forceFallbackForFibers.has(fiber.alternate)),isSuspended,source,stack:fiber._debugOwner==null||fiber._debugStack==null?null:parseStackTrace(fiber._debugStack,1),hasLegacyContext,key:key!=null?key:null,type:elementType,context:context2,hooks,props:memoizedProps,state:showState?memoizedState:null,errors:componentLogsEntry===void 0?[]:Array.from(componentLogsEntry.errors.entries()),warnings:componentLogsEntry===void 0?[]:Array.from(componentLogsEntry.warnings.entries()),suspendedBy,suspendedByRange,unknownSuspenders,owners,env:null,rootType,rendererPackageName:renderer.rendererPackageName,rendererVersion:renderer.version,plugins,nativeTag}}function inspectVirtualInstanceRaw(virtualInstance){var source=getSourceForInstance(virtualInstance),componentInfo=virtualInstance.data,key=typeof componentInfo.key==="string"?componentInfo.key:null,props=componentInfo.props==null?null:componentInfo.props,owners=getOwnersListFromInstance(virtualInstance),rootType=null,hasErrorBoundary=!1,hasSuspenseBoundary=!1,nearestFiber=getNearestFiber(virtualInstance);if(nearestFiber!==null){var current=nearestFiber;while(current.return!==null){var temp=current;if(current=current.return,temp.tag===SuspenseComponent)hasSuspenseBoundary=!0;else if(isErrorBoundary(temp))hasErrorBoundary=!0}var fiberRoot=current.stateNode;if(fiberRoot!=null&&fiberRoot._debugRootType!==null)rootType=fiberRoot._debugRootType}var plugins={stylex:null},componentLogsEntry=componentInfoToComponentLogsMap.get(componentInfo),isSuspended=null,suspendedBy=getSuspendedByOfInstance(virtualInstance,null),suspendedByRange=getSuspendedByRange(getNearestSuspenseNode(virtualInstance));return{id:virtualInstance.id,canEditHooks:!1,canEditFunctionProps:!1,canEditHooksAndDeletePaths:!1,canEditHooksAndRenamePaths:!1,canEditFunctionPropsDeletePaths:!1,canEditFunctionPropsRenamePaths:!1,canToggleError:supportsTogglingError&&hasErrorBoundary,isErrored:!1,canToggleSuspense:supportsTogglingSuspense&&hasSuspenseBoundary,isSuspended,source,stack:componentInfo.owner==null||componentInfo.debugStack==null?null:parseStackTrace(componentInfo.debugStack,1),hasLegacyContext:!1,key,type:types_ElementTypeVirtual,context:null,hooks:null,props,state:null,errors:componentLogsEntry===void 0?[]:Array.from(componentLogsEntry.errors.entries()),warnings:componentLogsEntry===void 0?[]:Array.from(componentLogsEntry.warnings.entries()),suspendedBy,suspendedByRange,unknownSuspenders:UNKNOWN_SUSPENDERS_NONE,owners,env:componentInfo.env==null?null:componentInfo.env,rootType,rendererPackageName:renderer.rendererPackageName,rendererVersion:renderer.version,plugins,nativeTag:null}}var mostRecentlyInspectedElement=null,hasElementUpdatedSinceLastInspected=!1,currentlyInspectedPaths={};function isMostRecentlyInspectedElement(id){if(mostRecentlyInspectedElement===null)return!1;if(mostRecentlyInspectedElement.id===id)return!0;if(mostRecentlyInspectedElement.type===ElementTypeRoot){var instance=idToDevToolsInstanceMap.get(id);return instance!==void 0&&instance.kind===FIBER_INSTANCE&&instance.parent===null}return!1}function isMostRecentlyInspectedElementCurrent(id){return isMostRecentlyInspectedElement(id)&&!hasElementUpdatedSinceLastInspected}function mergeInspectedPaths(path15){var current=currentlyInspectedPaths;path15.forEach(function(key){if(!current[key])current[key]={};current=current[key]})}function createIsPathAllowed(key,secondaryCategory){return function(path15){switch(secondaryCategory){case"hooks":if(path15.length===1)return!0;if(path15[path15.length-2]==="hookSource"&&path15[path15.length-1]==="fileName")return!0;if(path15[path15.length-1]==="subHooks"||path15[path15.length-2]==="subHooks")return!0;break;case"suspendedBy":if(path15.length<5)return!0;break;default:break}var current=key===null?currentlyInspectedPaths:currentlyInspectedPaths[key];if(!current)return!1;for(var i=0;i<path15.length;i++)if(current=current[path15[i]],!current)return!1;return!0}}function updateSelectedElement(inspectedElement){var{hooks,id,props}=inspectedElement,devtoolsInstance=idToDevToolsInstanceMap.get(id);if(devtoolsInstance===void 0){console.warn('Could not find DevToolsInstance with id "'.concat(id,'"'));return}if(devtoolsInstance.kind!==FIBER_INSTANCE)return;var fiber=devtoolsInstance.data,elementType=fiber.elementType,stateNode=fiber.stateNode,tag=fiber.tag,type=fiber.type;switch(tag){case ClassComponent:case IncompleteClassComponent:case IndeterminateComponent:global.$r=stateNode;break;case IncompleteFunctionComponent:case FunctionComponent:global.$r={hooks,props,type};break;case ForwardRef:global.$r={hooks,props,type:type.render};break;case MemoComponent:case SimpleMemoComponent:global.$r={hooks,props,type:elementType!=null&&elementType.type!=null?elementType.type:type};break;default:global.$r=null;break}}function storeAsGlobal(id,path15,count){if(isMostRecentlyInspectedElement(id)){var value=utils_getInObject(mostRecentlyInspectedElement,path15),key="$reactTemp".concat(count);window[key]=value,console.log(key),console.log(value)}}function getSerializedElementValueByPath(id,path15){if(isMostRecentlyInspectedElement(id)){var valueToCopy=utils_getInObject(mostRecentlyInspectedElement,path15);return serializeToString(valueToCopy)}}function inspectElement(requestID,id,path15,forceFullData){if(path15!==null)mergeInspectedPaths(path15);if(isMostRecentlyInspectedElement(id)&&!forceFullData){if(!hasElementUpdatedSinceLastInspected)if(path15!==null){var secondaryCategory=null;if(path15[0]==="hooks"||path15[0]==="suspendedBy")secondaryCategory=path15[0];return{id,responseID:requestID,type:"hydrated-path",path:path15,value:cleanForBridge(utils_getInObject(mostRecentlyInspectedElement,path15),createIsPathAllowed(null,secondaryCategory),path15)}}else return{id,responseID:requestID,type:"no-change"}}else currentlyInspectedPaths={};hasElementUpdatedSinceLastInspected=!1;try{mostRecentlyInspectedElement=inspectElementRaw(id)}catch(error){if(error.name==="ReactDebugToolsRenderError"){var message="Error rendering inspected element.",stack;if(console.error(message+`
|
|
499
499
|
|
|
500
500
|
`,error),error.cause!=null){var componentName=getDisplayNameForElementID(id);if(console.error("React DevTools encountered an error while trying to inspect hooks. This is most likely caused by an error in current inspected component"+(componentName!=null?': "'.concat(componentName,'".'):".")+`
|
|
501
501
|
The error thrown in the component is:
|
|
@@ -591,10 +591,11 @@ data: ${JSON.stringify(data)}
|
|
|
591
591
|
`)){let m=/^(\d+)\s+(.+)$/.exec(line.trim());if(m?.[1]&&m[2])sizes.set(m[2],Number.parseInt(m[1],10))}return sizes}async function smallIgnoredPaths(exec,worktreePath){try{let status=await exec.run(["git","status","--porcelain","-z","--ignored"],{cwd:worktreePath});if(status.exitCode!==0)return[];let paths=parseIgnoredPaths(status.stdout);if(paths.length===0)return[];let du=await exec.run(["du","-sk",...paths],{cwd:worktreePath}),sizes=parseDuKb(du.stdout);return paths.filter((p)=>{let kb=sizes.get(p);return kb!==void 0&&kb<=65536})}catch{return[]}}function salvageRef(branch,now){let stamp=now.toISOString().replace(/[-:]/g,"").replace(/\.\d+Z$/,"Z");return`refs/rove/salvage/${(branch??"detached").replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^[-.]+|[-.]+$/g,"")||"detached"}-${stamp}`}async function salvageWorktree(deps,exec,worktreePath,now=new Date){let git2=(args2)=>deps.runGit(exec,args2,{cwd:worktreePath,allowFail:!0});try{let status=await git2(["status","--porcelain"]);if(status.exitCode!==0||status.stdout.trim().length===0)return null;let indexPath=(await git2(["rev-parse","--git-path","rove-salvage-index"])).stdout.trim();if(!indexPath)return null;let withIndex=(args2)=>deps.runGit(exec,args2,{cwd:worktreePath,allowFail:!0,env:{GIT_INDEX_FILE:indexPath}});try{if((await withIndex(["add","-A"])).exitCode!==0)return null;let ignored=await smallIgnoredPaths(exec,worktreePath);if(ignored.length>0)await withIndex(["add","-f","--",...ignored]);let tree=(await withIndex(["write-tree"])).stdout.trim();if(!tree)return null;let head=(await git2(["rev-parse","HEAD"])).stdout.trim(),branch=(await git2(["rev-parse","--abbrev-ref","HEAD"])).stdout.trim(),message=`rove salvage: force-removed worktree ${worktreePath}`,commit=(await withIndex(head?["commit-tree",tree,"-p",head,"-m",message]:["commit-tree",tree,"-m",message])).stdout.trim();if(!commit)return null;let ref=salvageRef(branch&&branch!=="HEAD"?branch:null,now);if((await git2(["update-ref",ref,commit])).exitCode!==0)return null;return{ref,commit}}finally{await exec.run(["rm","-f",indexPath],{cwd:worktreePath}).catch(()=>{return})}}catch{return null}}var init_salvage=()=>{};async function anchorBranchTip(deps,exec,repo,branch,now=new Date){if(!branch||branch==="HEAD")return null;let git2=(args2)=>deps.runGit(exec,args2,{cwd:repo,allowFail:!0});try{let tipOut=await git2(["rev-parse","--verify",`refs/heads/${branch}`]),tip=tipOut.stdout.trim();if(tipOut.exitCode!==0||!tip)return null;let holders=await git2(["for-each-ref","--contains",tip,"--format=%(refname)"]);if(holders.exitCode===0){if(holders.stdout.split(`
|
|
592
592
|
`).map((l)=>l.trim()).filter((l)=>l.length>0&&l!==`refs/heads/${branch}`).length>0)return null}let ref=salvageRef(branch,now);if((await git2(["update-ref",ref,tip])).exitCode!==0)return null;return{ref,commit:tip}}catch{return null}}var init_branch_anchor=__esm(()=>{init_salvage()});async function branchExists(deps,ctx3,branch){return(await deps.runGit(ctx3.exec,["show-ref","--verify","--quiet",`refs/heads/${branch}`],{cwd:ctx3.dir,allowFail:!0,readOnly:!0})).exitCode===0}async function deleteBranchIn(deps,exec,repo,branch,force){if(!branch||branch==="HEAD")return;await deps.runGit(exec,["branch",force?"-D":"-d",branch],{cwd:repo,allowFail:!0})}async function deleteBranchAnchored(deps,exec,repo,branch,opts){if(opts.force)opts.onAnchor?.(await anchorBranchTip(deps,exec,repo,branch));await deleteBranchIn(deps,exec,repo,branch,opts.force)}async function branchHasUpstream(deps,worktreePath,branch){return(await deps.runGit(deps.execAt(worktreePath),["for-each-ref","--format=%(upstream)",`refs/heads/${branch}`],{cwd:worktreePath,readOnly:!0})).stdout.trim().length>0}async function hasLocalBranch(deps,worktreePath,branch){return(await deps.runGit(deps.execAt(worktreePath),["show-ref","--verify","--quiet",`refs/heads/${branch}`],{cwd:worktreePath,allowFail:!0,readOnly:!0})).exitCode===0}async function renameBranch(deps,worktreePath,from,to){let exec=deps.execAt(worktreePath);if(from===to)return;let repo=await deps.findRepoFor(exec,worktreePath);if(!repo)throw Error(`renameBranch(): ${worktreePath} is not a git worktree`);let out=await deps.runGit(exec,["branch","-m",from,to],{cwd:repo,allowFail:!0});if(out.exitCode===0)return;let ctx3={exec,dir:repo,remote:exec.isRemote};if(!await branchExists(deps,ctx3,from)&&await branchExists(deps,ctx3,to))return;throw new GitCommandError(["branch","-m",from,to],repo,out)}var init_manager_branch=__esm(()=>{init_branch_anchor();init_git()});async function mapWithLimit(items,limit,fn){let results=Array(items.length),next=0,worker=async()=>{for(;;){let i=next++;if(i>=items.length)return;results[i]=await fn(items[i])}},width=Math.max(1,Math.min(limit,items.length));return await Promise.all(Array.from({length:width},worker)),results}var PROBE_CONCURRENCY=6;function parseWorktreeListPorcelain(out){let records=[],current=null;for(let rawLine of out.split(`
|
|
593
593
|
`)){let line=rawLine.replace(/\r$/,"");if(line===""){if(current)records.push(current);current=null;continue}if(!current)current={};if(line.startsWith("worktree "))current.path=line.slice(9);else if(line.startsWith("HEAD "))current.head=line.slice(5);else if(line.startsWith("branch ")){let ref=line.slice(7);current.branch=ref.startsWith("refs/heads/")?ref.slice(11):ref}else if(line==="detached")current.detached=!0;else if(line==="bare")current.bare=!0}if(current)records.push(current);return records}import fs3 from"fs";import path17 from"path";async function lastActivityMs(deps,ctx3,worktreePath){try{let stdout=await deps.runGitStdoutAt(ctx3,worktreePath,["log","-1","--format=%ct"]),secs=Number.parseInt(stdout.trim(),10);if(Number.isFinite(secs)&&secs>0)return secs*1000}catch{}if(!ctx3.exec.isRemote)try{return fs3.statSync(worktreePath).mtimeMs}catch{}return 0}async function listBranchNames(deps,repo){let ctx3=deps.ctxFor(repo);requireAbsolute("repo",ctx3.dir);let stdout;try{stdout=await deps.runGitStdout(ctx3,["for-each-ref","--format=%(refname:short)","refs/heads","refs/remotes/origin"])}catch{return[]}let names=new Set;for(let line of stdout.split(`
|
|
594
|
-
`)){let name=line.trim().replace(/^origin\//,"");if(name&&name!=="HEAD")names.add(name)}return[...names]}async function listManaged(deps,repo){let ctx3=deps.ctxFor(repo);requireAbsolute("repo",ctx3.dir);let all=parseWorktreeListPorcelain(await deps.runGitStdout(ctx3,["worktree","list","--porcelain"])),kept=[];for(let entry of all){if(!entry.path)continue;let callerRoot=ctx3.remote?remoteManagedRootForPath(ctx3.dir,entry.path):managedWorktreeRootForPath(repo,entry.path);if(!callerRoot)continue;if(!entry.branch||entry.detached)continue;let rel=path17.relative(canonicalize(callerRoot),canonicalize(entry.path));kept.push({callerPath:path17.join(callerRoot,rel),probePath:entry.path,branch:entry.branch,head:entry.head??""})}return mapWithLimit(kept,PROBE_CONCURRENCY,async(e)=>({path:e.callerPath,branch:e.branch,head:e.head,dirty:await deps.isDirty(e.probePath).catch(()=>!1)}))}async function listAllAdoptable(deps,repo){let ctx3=deps.ctxFor(repo),adoptable=await adoptablePaths(deps,ctx3),infos=await mapWithLimit(adoptable,PROBE_CONCURRENCY,async(entry)=>{let[dirty,activityMs]=await Promise.all([deps.isDirty(entry.path).catch(()=>!1),lastActivityMs(deps,ctx3,entry.path)]);return{path:entry.path,branch:entry.branch,head:entry.head,dirty,kobeManaged:ctx3.remote?remoteManagedRootForPath(ctx3.dir,entry.path)!==null:isKobeManagedPath(repo,entry.path),lastActivityMs:activityMs}});return infos.sort((a,b)=>b.lastActivityMs-a.lastActivityMs),infos}async function adoptablePaths(deps,ctx3){requireAbsolute("repo",ctx3.dir);let all=parseWorktreeListPorcelain(await deps.runGitStdout(ctx3,["worktree","list","--porcelain"])),canonRepo=ctx3.remote?ctx3.dir:canonicalize(ctx3.dir),kept=[];for(let entry of all){if(!entry.path)continue;if(entry.bare)continue;if(!entry.branch||entry.detached)continue;if((ctx3.remote?entry.path:canonicalize(entry.path))===canonRepo)continue;kept.push({path:entry.path,branch:entry.branch,head:entry.head??""})}return kept}var init_manager_list=__esm(()=>{init_paths2()});import path18 from"path";async function isRegisteredWorktree(deps,exec,repo,worktreePath){let out=await deps.runGit(exec,["worktree","list","--porcelain"],{cwd:repo,allowFail:!0,readOnly:!0});if(out.exitCode!==0)return!1;let same2=(a,b)=>exec.isRemote?a===b:canonicalize(a)===canonicalize(b);return parseWorktreeListPorcelain(out.stdout).some((e)=>e.path!==void 0&&same2(e.path,worktreePath))}async function deregisteredWorktreeResidue(exec,worktreePath){let pointer=(await exec.readFile(`${worktreePath}/.git`))?.trim().match(/^gitdir:\s*(.+)$/)?.[1]?.trim();if(!pointer)return!1;let marker="/worktrees/",at2=pointer.lastIndexOf(marker);if(at2<0)return!1;return await exec.exists(pointer.slice(0,at2))}async function removeWorktree(deps,worktreePath,opts){requireAbsolute("path",worktreePath);let exec=deps.execForPath(worktreePath),force=opts?.force===!0;if(!await exec.exists(worktreePath)){let goneRepo=await deps.findRepoFor(exec,path18.dirname(worktreePath));if(goneRepo)await deps.runGit(exec,["worktree","prune"],{cwd:goneRepo,allowFail:!0});return}let repo=await deps.findRepoFor(exec,worktreePath);if(repo===null||!await isRegisteredWorktree(deps,exec,repo,worktreePath)){if(await deregisteredWorktreeResidue(exec,worktreePath)){opts?.onResidue?.({path:worktreePath,reason:"a previous removal deregistered the worktree"});return}if(repo){opts?.onResidue?.({path:worktreePath,reason:"a previous removal deregistered the worktree"});return}if(!force)throw Error(`remove(): ${worktreePath} is not a git worktree`);if(!isUnderManagedWorktreesRoot(worktreePath))throw Error(`remove(): ${worktreePath} has no reachable git repo and is not under a Rove worktrees root; refusing to delete it`);if(opts?.onSalvage?.(null),await exec.run(["rm","-rf",worktreePath]),await exec.exists(worktreePath))opts?.onResidue?.({path:worktreePath,reason:"the directory could not be deleted"});return}let branch=opts?.deleteBranch?await deps.currentBranch(worktreePath).catch(()=>null):null;if(force){let salvaged=await salvageWorktree({runGit:(e,a,o)=>deps.runGit(e,a,o)},exec,worktreePath);opts?.onSalvage?.(salvaged)}else if(await deps.isDirty(worktreePath))throw Error(`remove(): refusing to remove dirty worktree at ${worktreePath} (pass { force: true } to override)`);let args2=force?["worktree","remove","--force",worktreePath]:["worktree","remove",worktreePath],result=await deps.runGit(exec,args2,{cwd:repo,allowFail:!0});if(result.exitCode!==0){if(await isRegisteredWorktree(deps,exec,repo,worktreePath))throw new GitCommandError(args2,repo,result);opts?.onResidue?.({path:worktreePath,reason:result.stderr.trim()||result.stdout.trim()||"unknown"})}if(await deps.runGit(exec,["worktree","prune"],{cwd:repo,allowFail:!0}),branch)await deleteBranchAnchored(deps.branchDeps(),exec,repo,branch,{force})}var init_manager_remove=__esm(()=>{init_git();init_manager_branch();init_paths2();init_salvage()});var exports_manager={};__export(exports_manager,{GitWorktreeManager:()=>GitWorktreeManager});import path19 from"path";class GitWorktreeManager{execDeps;constructor(execDeps=defaultExecDeps){this.execDeps=execDeps}ctxFor(repoKey){let basePath=this.execDeps.remoteBasePath(repoKey);return basePath?{exec:this.execDeps.execForRepo(repoKey),dir:basePath,remote:!0}:{exec:this.execDeps.execForRepo(repoKey),dir:repoKey,remote:!1}}async runGit(exec,args2,opts){if(!opts.cwd)throw Error("runGit(): cwd is required; refusing to inherit from process.cwd()");let env=opts.readOnly?{...opts.env,...READ_ONLY_GIT_ENV}:opts.env,r5=await exec.run(["git",...args2],{cwd:opts.cwd,env}),result={stdout:r5.stdout,stderr:r5.stderr,exitCode:r5.exitCode};if(result.exitCode!==0&&!opts.allowFail)throw new GitCommandError(args2,opts.cwd,result);return result}async create(repo,branch,worktreePath,baseRef){let ctx3=this.ctxFor(repo);if(requireAbsolute("repo",ctx3.dir),requireAbsolute("path",worktreePath),!branch)throw Error("create(): branch must be a non-empty string");if(await ctx3.exec.exists(worktreePath)){let existing=await this.tryDescribe(ctx3,worktreePath);if(existing){if(existing.branch!==branch)throw Error(`worktree at ${worktreePath} is on branch '${existing.branch}', refusing to hijack to '${branch}'`);return existing}throw Error(`create(): ${worktreePath} exists but is not a registered git worktree`)}await ctx3.exec.mkdirp(path19.dirname(worktreePath));let args2=await branchExists(this.branchDeps(),ctx3,branch)?["worktree","add",worktreePath,branch]:baseRef?["worktree","add","-b",branch,worktreePath,baseRef]:["worktree","add","-b",branch,worktreePath];await this.runGit(ctx3.exec,args2,{cwd:ctx3.dir});let info=await this.tryDescribe(ctx3,worktreePath);if(!info)throw Error(`create(): git reported success but ${worktreePath} is not a worktree`);if(info.branch!==branch)throw Error(`create(): post-condition failed \u2014 expected branch '${branch}' at ${worktreePath}, got '${info.branch}'`);return info}async createForTask(args2){let basePath=this.execDeps.remoteBasePath(args2.repo),target=basePath?remoteWorktreePathFor(basePath,args2.slug):worktreePathFor(args2.repo,args2.slug);return this.create(args2.repo,args2.branch,target,args2.baseRef)}async remove(worktreePath,opts){await removeWorktree({runGit:(exec,args2,runOpts)=>this.runGit(exec,args2,runOpts),execForPath:(p)=>this.execDeps.execForPath(p),findRepoFor:(exec,p)=>this.findRepoFor(exec,p),currentBranch:(p)=>this.currentBranch(p),isDirty:(p)=>this.isDirty(p),branchDeps:()=>this.branchDeps()},worktreePath,opts)}async deleteBranch(repo,branch,opts){let ctx3=this.ctxFor(repo);requireAbsolute("repo",ctx3.dir),await deleteBranchAnchored(this.branchDeps(),ctx3.exec,ctx3.dir,branch,{force:opts?.force===!0,onAnchor:opts?.onAnchor})}execAt(worktreePath){return requireAbsolute("path",worktreePath),this.execDeps.execForPath(worktreePath)}branchDeps(){return{runGit:(exec,args2,opts)=>this.runGit(exec,args2,opts),execAt:(worktreePath)=>this.execAt(worktreePath),findRepoFor:(exec,worktreePath)=>this.findRepoFor(exec,worktreePath)}}listDeps(){return{ctxFor:(repoKey)=>this.ctxFor(repoKey),runGitStdout:async(ctx3,args2)=>(await this.runGit(ctx3.exec,args2,{cwd:ctx3.dir,readOnly:!0})).stdout,runGitStdoutAt:async(ctx3,cwd,args2)=>(await this.runGit(ctx3.exec,args2,{cwd,readOnly:!0})).stdout,isDirty:(worktreePath)=>this.isDirty(worktreePath)}}list(repo){return listManaged(this.listDeps(),repo)}listAll(repo){return listAllAdoptable(this.listDeps(),repo)}listAdoptablePaths(repo){return adoptablePaths(this.listDeps(),this.ctxFor(repo))}listBranchNames(repo){return listBranchNames(this.listDeps(),repo)}async pathExists(worktreePath){return this.execAt(worktreePath).exists(worktreePath)}async pruneWorktrees(repo){let ctx3=this.ctxFor(repo);requireAbsolute("repo",ctx3.dir),await this.runGit(ctx3.exec,["worktree","prune"],{cwd:ctx3.dir,allowFail:!0})}async isDirty(worktreePath){return(await this.runGit(this.execAt(worktreePath),["status","--porcelain"],{cwd:worktreePath,readOnly:!0})).stdout.length>0}async currentBranch(worktreePath){let name=(await this.runGit(this.execAt(worktreePath),["rev-parse","--abbrev-ref","HEAD"],{cwd:worktreePath,readOnly:!0})).stdout.trim();if(!name||name==="HEAD")throw Error(`currentBranch(): ${worktreePath} is in detached-HEAD state`);return name}branchHasUpstream(worktreePath,branch){return branchHasUpstream(this.branchDeps(),worktreePath,branch)}hasLocalBranch(worktreePath,branch){return hasLocalBranch(this.branchDeps(),worktreePath,branch)}renameBranch(worktreePath,from,to){return renameBranch(this.branchDeps(),worktreePath,from,to)}async tryDescribe(ctx3,worktreePath){let out=await this.runGit(ctx3.exec,["worktree","list","--porcelain"],{cwd:ctx3.dir,readOnly:!0}),entries=parseWorktreeListPorcelain(out.stdout),norm=(p)=>ctx3.remote?p:canonicalize(p),target=norm(worktreePath),match=entries.find((e)=>e.path&&norm(e.path)===target);if(!match||!match.path||!match.branch||match.detached)return null;return{path:worktreePath,branch:match.branch,head:match.head??"",dirty:await this.isDirty(match.path)}}async findRepoFor(exec,worktreePath){try{let out=await this.runGit(exec,["rev-parse","--git-common-dir"],{cwd:worktreePath,allowFail:!0,readOnly:!0});if(out.exitCode!==0)return null;let gitDir=out.stdout.trim();if(!gitDir)return null;let absolute=path19.isAbsolute(gitDir)?gitDir:path19.resolve(worktreePath,gitDir);return path19.basename(absolute)===".git"?path19.dirname(absolute):absolute}catch(err){if(err instanceof GitCommandError)return null;throw err}}}var init_manager=__esm(()=>{init_git_env();init_exec_deps();init_git();init_manager_branch();init_manager_list();init_manager_remove();init_paths2()});import path20 from"path";async function landTaskWithCleanup(task,opts,deps){if(task.kind==="main")throw Error("landTask: a main task has no branch to land");if(task.kind==="dir")throw Error("landTask: a directory task has no Rove-managed branch to land");let result=await landTask(task,{strategy:opts.strategy}),worktree=opts.removeWorktree===!1?void 0:await removeLandedWorktree(task,opts.callerCwd,deps),branchAnchor=null,branchKept,worktreeGone=!task.worktreePath.trim()||worktree?.removed===!0;if(opts.deleteBranch&&!worktreeGone)branchKept={reason:worktree?.reason??`worktree ${task.worktreePath} was kept, and still has the branch checked out`};else if(opts.deleteBranch)await deps.worktrees.deleteBranch(task.repo,result.branch,{force:!0,onAnchor:(record)=>{branchAnchor=record}});return{...result,...worktree?{worktree}:{},...branchAnchor?{branchAnchor}:{},...branchKept?{branchKept}:{}}}async function removeLandedWorktree(task,callerCwd,deps){let worktreePath=task.worktreePath.trim();if(!worktreePath)return{removed:!1,reason:"task has no worktree on disk (never materialised)"};let wt=canonicalize(worktreePath);if(wt===canonicalize(task.repo))return{removed:!1,reason:"refusing to remove the base checkout"};if(callerCwd){let rel=path20.relative(wt,canonicalize(callerCwd));if(rel===""||!rel.startsWith("..")&&!path20.isAbsolute(rel))return{removed:!1,reason:`refusing to remove the caller's own worktree (${worktreePath}) \u2014 re-run from outside it`}}if(deps.tearDownSession)try{await deps.tearDownSession(task.id)}catch{}let residue;try{await deps.worktrees.remove(worktreePath,{onResidue:(r5)=>{residue=r5}})}catch(err){return{removed:!1,reason:errText(err)}}try{await deps.clearWorktreePath(task.id)}catch(err){return{removed:!0,reason:`worktree removed, but clearing the task's worktree path failed: ${errText(err)}`,...residue?{residue}:{}}}return{removed:!0,...residue?{residue}:{}}}function errText(err){return err instanceof Error?err.message:String(err)}function baseRepoCtx(repo,deps){let basePath=deps.remoteBasePath(repo);return{exec:deps.execForRepo(repo),dir:basePath??repo}}async function git2(exec,dir,args2,opts){let r5=await exec.run(["git",...args2],{cwd:dir,env:opts?.readOnly?READ_ONLY_GIT_ENV:void 0});return{stdout:r5.stdout,exitCode:r5.exitCode}}async function isDirty(exec,dir){return(await git2(exec,dir,["status","--porcelain"],{readOnly:!0})).stdout.trim().length>0}async function conflictedFiles(exec,dir){return(await git2(exec,dir,["diff","--name-only","--diff-filter=U"],{readOnly:!0})).stdout.split(`
|
|
594
|
+
`)){let name=line.trim().replace(/^origin\//,"");if(name&&name!=="HEAD")names.add(name)}return[...names]}async function listManaged(deps,repo){let ctx3=deps.ctxFor(repo);requireAbsolute("repo",ctx3.dir);let all=parseWorktreeListPorcelain(await deps.runGitStdout(ctx3,["worktree","list","--porcelain"])),kept=[];for(let entry of all){if(!entry.path)continue;let callerRoot=ctx3.remote?remoteManagedRootForPath(ctx3.dir,entry.path):managedWorktreeRootForPath(repo,entry.path);if(!callerRoot)continue;if(!entry.branch||entry.detached)continue;let rel=path17.relative(canonicalize(callerRoot),canonicalize(entry.path));kept.push({callerPath:path17.join(callerRoot,rel),probePath:entry.path,branch:entry.branch,head:entry.head??""})}return mapWithLimit(kept,PROBE_CONCURRENCY,async(e)=>({path:e.callerPath,branch:e.branch,head:e.head,dirty:await deps.isDirty(e.probePath).catch(()=>!1)}))}async function listAllAdoptable(deps,repo){let ctx3=deps.ctxFor(repo),adoptable=await adoptablePaths(deps,ctx3),infos=await mapWithLimit(adoptable,PROBE_CONCURRENCY,async(entry)=>{let[dirty,activityMs]=await Promise.all([deps.isDirty(entry.path).catch(()=>!1),lastActivityMs(deps,ctx3,entry.path)]);return{path:entry.path,branch:entry.branch,head:entry.head,dirty,kobeManaged:ctx3.remote?remoteManagedRootForPath(ctx3.dir,entry.path)!==null:isKobeManagedPath(repo,entry.path),lastActivityMs:activityMs}});return infos.sort((a,b)=>b.lastActivityMs-a.lastActivityMs),infos}async function adoptablePaths(deps,ctx3){requireAbsolute("repo",ctx3.dir);let all=parseWorktreeListPorcelain(await deps.runGitStdout(ctx3,["worktree","list","--porcelain"])),canonRepo=ctx3.remote?ctx3.dir:canonicalize(ctx3.dir),kept=[];for(let entry of all){if(!entry.path)continue;if(entry.bare)continue;if(!entry.branch||entry.detached)continue;if((ctx3.remote?entry.path:canonicalize(entry.path))===canonRepo)continue;kept.push({path:entry.path,branch:entry.branch,head:entry.head??""})}return kept}var init_manager_list=__esm(()=>{init_paths2()});import path18 from"path";async function isRegisteredWorktree(deps,exec,repo,worktreePath){let out=await deps.runGit(exec,["worktree","list","--porcelain"],{cwd:repo,allowFail:!0,readOnly:!0});if(out.exitCode!==0)return!1;let same2=(a,b)=>exec.isRemote?a===b:canonicalize(a)===canonicalize(b);return parseWorktreeListPorcelain(out.stdout).some((e)=>e.path!==void 0&&same2(e.path,worktreePath))}async function deregisteredWorktreeResidue(exec,worktreePath){let pointer=(await exec.readFile(`${worktreePath}/.git`))?.trim().match(/^gitdir:\s*(.+)$/)?.[1]?.trim();if(!pointer)return!1;let marker="/worktrees/",at2=pointer.lastIndexOf(marker);if(at2<0)return!1;return await exec.exists(pointer.slice(0,at2))}async function removeWorktree(deps,worktreePath,opts){requireAbsolute("path",worktreePath);let exec=deps.execForPath(worktreePath),force=opts?.force===!0;if(!await exec.exists(worktreePath)){let goneRepo=await deps.findRepoFor(exec,path18.dirname(worktreePath));if(goneRepo)await deps.runGit(exec,["worktree","prune"],{cwd:goneRepo,allowFail:!0});return}let repo=await deps.findRepoFor(exec,worktreePath);if(repo===null||!await isRegisteredWorktree(deps,exec,repo,worktreePath)){if(await deregisteredWorktreeResidue(exec,worktreePath)){opts?.onResidue?.({path:worktreePath,reason:"a previous removal deregistered the worktree"});return}if(repo){opts?.onResidue?.({path:worktreePath,reason:"a previous removal deregistered the worktree"});return}if(!force)throw Error(`remove(): ${worktreePath} is not a git worktree`);if(!isUnderManagedWorktreesRoot(worktreePath))throw Error(`remove(): ${worktreePath} has no reachable git repo and is not under a Rove worktrees root; refusing to delete it`);if(opts?.onSalvage?.(null),await exec.run(["rm","-rf",worktreePath]),await exec.exists(worktreePath))opts?.onResidue?.({path:worktreePath,reason:"the directory could not be deleted"});return}let branch=opts?.deleteBranch?await deps.currentBranch(worktreePath).catch(()=>null):null;if(force){let salvaged=await salvageWorktree({runGit:(e,a,o)=>deps.runGit(e,a,o)},exec,worktreePath);opts?.onSalvage?.(salvaged)}else if(await deps.isDirty(worktreePath))throw Error(`remove(): refusing to remove dirty worktree at ${worktreePath} (pass { force: true } to override)`);let args2=force?["worktree","remove","--force",worktreePath]:["worktree","remove",worktreePath],result=await deps.runGit(exec,args2,{cwd:repo,allowFail:!0});if(result.exitCode!==0){if(await isRegisteredWorktree(deps,exec,repo,worktreePath))throw new GitCommandError(args2,repo,result);opts?.onResidue?.({path:worktreePath,reason:result.stderr.trim()||result.stdout.trim()||"unknown"})}if(await deps.runGit(exec,["worktree","prune"],{cwd:repo,allowFail:!0}),branch)await deleteBranchAnchored(deps.branchDeps(),exec,repo,branch,{force})}var init_manager_remove=__esm(()=>{init_git();init_manager_branch();init_paths2();init_salvage()});var exports_manager={};__export(exports_manager,{GitWorktreeManager:()=>GitWorktreeManager});import path19 from"path";class GitWorktreeManager{execDeps;constructor(execDeps=defaultExecDeps){this.execDeps=execDeps}ctxFor(repoKey){let basePath=this.execDeps.remoteBasePath(repoKey);return basePath?{exec:this.execDeps.execForRepo(repoKey),dir:basePath,remote:!0}:{exec:this.execDeps.execForRepo(repoKey),dir:repoKey,remote:!1}}async runGit(exec,args2,opts){if(!opts.cwd)throw Error("runGit(): cwd is required; refusing to inherit from process.cwd()");let env=opts.readOnly?{...opts.env,...READ_ONLY_GIT_ENV}:opts.env,r5=await exec.run(["git",...args2],{cwd:opts.cwd,env}),result={stdout:r5.stdout,stderr:r5.stderr,exitCode:r5.exitCode};if(result.exitCode!==0&&!opts.allowFail)throw new GitCommandError(args2,opts.cwd,result);return result}async create(repo,branch,worktreePath,baseRef){let ctx3=this.ctxFor(repo);if(requireAbsolute("repo",ctx3.dir),requireAbsolute("path",worktreePath),!branch)throw Error("create(): branch must be a non-empty string");if(await ctx3.exec.exists(worktreePath)){let existing=await this.tryDescribe(ctx3,worktreePath);if(existing){if(existing.branch!==branch)throw Error(`worktree at ${worktreePath} is on branch '${existing.branch}', refusing to hijack to '${branch}'`);return existing}throw Error(`create(): ${worktreePath} exists but is not a registered git worktree`)}await ctx3.exec.mkdirp(path19.dirname(worktreePath));let args2=await branchExists(this.branchDeps(),ctx3,branch)?["worktree","add",worktreePath,branch]:baseRef?["worktree","add","-b",branch,worktreePath,baseRef]:["worktree","add","-b",branch,worktreePath];await this.runGit(ctx3.exec,args2,{cwd:ctx3.dir});let info=await this.tryDescribe(ctx3,worktreePath);if(!info)throw Error(`create(): git reported success but ${worktreePath} is not a worktree`);if(info.branch!==branch)throw Error(`create(): post-condition failed \u2014 expected branch '${branch}' at ${worktreePath}, got '${info.branch}'`);return info}async createForTask(args2){let basePath=this.execDeps.remoteBasePath(args2.repo),target=basePath?remoteWorktreePathFor(basePath,args2.slug):worktreePathFor(args2.repo,args2.slug);return this.create(args2.repo,args2.branch,target,args2.baseRef)}async remove(worktreePath,opts){await removeWorktree({runGit:(exec,args2,runOpts)=>this.runGit(exec,args2,runOpts),execForPath:(p)=>this.execDeps.execForPath(p),findRepoFor:(exec,p)=>this.findRepoFor(exec,p),currentBranch:(p)=>this.currentBranch(p),isDirty:(p)=>this.isDirty(p),branchDeps:()=>this.branchDeps()},worktreePath,opts)}async deleteBranch(repo,branch,opts){let ctx3=this.ctxFor(repo);requireAbsolute("repo",ctx3.dir),await deleteBranchAnchored(this.branchDeps(),ctx3.exec,ctx3.dir,branch,{force:opts?.force===!0,onAnchor:opts?.onAnchor})}execAt(worktreePath){return requireAbsolute("path",worktreePath),this.execDeps.execForPath(worktreePath)}branchDeps(){return{runGit:(exec,args2,opts)=>this.runGit(exec,args2,opts),execAt:(worktreePath)=>this.execAt(worktreePath),findRepoFor:(exec,worktreePath)=>this.findRepoFor(exec,worktreePath)}}listDeps(){return{ctxFor:(repoKey)=>this.ctxFor(repoKey),runGitStdout:async(ctx3,args2)=>(await this.runGit(ctx3.exec,args2,{cwd:ctx3.dir,readOnly:!0})).stdout,runGitStdoutAt:async(ctx3,cwd,args2)=>(await this.runGit(ctx3.exec,args2,{cwd,readOnly:!0})).stdout,isDirty:(worktreePath)=>this.isDirty(worktreePath)}}list(repo){return listManaged(this.listDeps(),repo)}listAll(repo){return listAllAdoptable(this.listDeps(),repo)}listAdoptablePaths(repo){return adoptablePaths(this.listDeps(),this.ctxFor(repo))}listBranchNames(repo){return listBranchNames(this.listDeps(),repo)}async pathExists(worktreePath){return this.execAt(worktreePath).exists(worktreePath)}async pruneWorktrees(repo){let ctx3=this.ctxFor(repo);requireAbsolute("repo",ctx3.dir),await this.runGit(ctx3.exec,["worktree","prune"],{cwd:ctx3.dir,allowFail:!0})}async isDirty(worktreePath){return(await this.runGit(this.execAt(worktreePath),["status","--porcelain"],{cwd:worktreePath,readOnly:!0})).stdout.length>0}async currentBranch(worktreePath){let name=(await this.runGit(this.execAt(worktreePath),["rev-parse","--abbrev-ref","HEAD"],{cwd:worktreePath,readOnly:!0})).stdout.trim();if(!name||name==="HEAD")throw Error(`currentBranch(): ${worktreePath} is in detached-HEAD state`);return name}branchHasUpstream(worktreePath,branch){return branchHasUpstream(this.branchDeps(),worktreePath,branch)}hasLocalBranch(worktreePath,branch){return hasLocalBranch(this.branchDeps(),worktreePath,branch)}renameBranch(worktreePath,from,to){return renameBranch(this.branchDeps(),worktreePath,from,to)}async tryDescribe(ctx3,worktreePath){let out=await this.runGit(ctx3.exec,["worktree","list","--porcelain"],{cwd:ctx3.dir,readOnly:!0}),entries=parseWorktreeListPorcelain(out.stdout),norm=(p)=>ctx3.remote?p:canonicalize(p),target=norm(worktreePath),match=entries.find((e)=>e.path&&norm(e.path)===target);if(!match||!match.path||!match.branch||match.detached)return null;return{path:worktreePath,branch:match.branch,head:match.head??"",dirty:await this.isDirty(match.path)}}async findRepoFor(exec,worktreePath){try{let out=await this.runGit(exec,["rev-parse","--git-common-dir"],{cwd:worktreePath,allowFail:!0,readOnly:!0});if(out.exitCode!==0)return null;let gitDir=out.stdout.trim();if(!gitDir)return null;let absolute=path19.isAbsolute(gitDir)?gitDir:path19.resolve(worktreePath,gitDir);return path19.basename(absolute)===".git"?path19.dirname(absolute):absolute}catch(err){if(err instanceof GitCommandError)return null;throw err}}}var init_manager=__esm(()=>{init_git_env();init_exec_deps();init_git();init_manager_branch();init_manager_list();init_manager_remove();init_paths2()});import path20 from"path";async function landTaskWithCleanup(task,opts,deps){if(task.kind==="main")throw Error("landTask: a main task has no branch to land");if(task.kind==="dir")throw Error("landTask: a directory task has no Rove-managed branch to land");let result=await landTask(task,{strategy:opts.strategy}),worktree=opts.removeWorktree===!1?void 0:await removeLandedWorktree(task,opts.callerCwd,deps),branchAnchor=null,branchKept,worktreeGone=!task.worktreePath.trim()||worktree?.removed===!0;if(opts.deleteBranch&&!worktreeGone)branchKept={reason:worktree?.reason??`worktree ${task.worktreePath} was kept, and still has the branch checked out`};else if(opts.deleteBranch)await deps.worktrees.deleteBranch(task.repo,result.branch,{force:!0,onAnchor:(record)=>{branchAnchor=record}});return{...result,...worktree?{worktree}:{},...branchAnchor?{branchAnchor}:{},...branchKept?{branchKept}:{}}}async function removeLandedWorktree(task,callerCwd,deps){let worktreePath=task.worktreePath.trim();if(!worktreePath)return{removed:!1,reason:"task has no worktree on disk (never materialised)"};let wt=canonicalize(worktreePath);if(wt===canonicalize(task.repo))return{removed:!1,reason:"refusing to remove the base checkout"};if(callerCwd){let rel=path20.relative(wt,canonicalize(callerCwd));if(rel===""||!rel.startsWith("..")&&!path20.isAbsolute(rel))return{removed:!1,reason:`refusing to remove the caller's own worktree (${worktreePath}) \u2014 re-run from outside it`}}if(deps.tearDownSession)try{await deps.tearDownSession(task.id)}catch{}let residue;try{await deps.worktrees.remove(worktreePath,{onResidue:(r5)=>{residue=r5}})}catch(err){return{removed:!1,reason:errText(err)}}try{await deps.clearWorktreePath(task.id)}catch(err){return{removed:!0,reason:`worktree removed, but clearing the task's worktree path failed: ${errText(err)}`,...residue?{residue}:{}}}return{removed:!0,...residue?{residue}:{}}}function errText(err){return err instanceof Error?err.message:String(err)}function baseRepoCtx(repo,deps){let basePath=deps.remoteBasePath(repo);return{exec:deps.execForRepo(repo),dir:basePath??repo}}async function git2(exec,dir,args2,opts){let r5=await exec.run(["git",...args2],{cwd:dir,env:opts?.readOnly?READ_ONLY_GIT_ENV:void 0});return{stdout:r5.stdout,stderr:r5.stderr,exitCode:r5.exitCode}}async function isDirty(exec,dir){return(await git2(exec,dir,["status","--porcelain"],{readOnly:!0})).stdout.trim().length>0}async function conflictedFiles(exec,dir){return(await git2(exec,dir,["diff","--name-only","--diff-filter=U"],{readOnly:!0})).stdout.split(`
|
|
595
595
|
`).map((l)=>l.trim()).filter((l)=>l.length>0)}function porcelainPaths(stdout){return stdout.split(`
|
|
596
|
-
`).filter((l)=>l.length>0).map((l)=>l.slice(3).trim())}async function assertBranchHasWork(task,branch,landedOn,exec,dir,deps){let aheadOut=await git2(exec,dir,["rev-list","--count",`${landedOn}..${branch}`],{readOnly:!0});if(aheadOut.exitCode!==0)throw new MissingRefError(branch,landedOn,dir);let ahead=Number.parseInt(aheadOut.stdout.trim(),10);if(!Number.isFinite(ahead)||ahead>0)return;let worktreePath=task.worktreePath.trim();if(worktreePath){let manager=new GitWorktreeManager(deps),dirty=!1;try{dirty=await manager.isDirty(worktreePath)}catch{dirty=!1}if(dirty){let wtExec=deps.execForPath(worktreePath),files=porcelainPaths((await git2(wtExec,worktreePath,["status","--porcelain"],{readOnly:!0})).stdout);throw new EmptyBranchDirtyWorktreeError(branch,landedOn,worktreePath,files)}}throw new EmptyBranchError(branch,landedOn)}async function landTask(task,input={},deps=defaultExecDeps){let branch=task.branch.trim();if(!branch)throw Error(`landTask: task ${task.id} has no branch to land (never materialised)`);let strategy=input.strategy??"merge",{exec,dir}=baseRepoCtx(task.repo,deps),landedOn=(await git2(exec,dir,["rev-parse","--abbrev-ref","HEAD"],{readOnly:!0})).stdout.trim();if(!landedOn||landedOn==="HEAD")throw Error(`landTask: base checkout at ${dir} is in detached-HEAD state; check out a branch first`);if(landedOn===branch)throw Error(`landTask: base checkout is already on '${branch}' \u2014 nothing to land onto`);if(await isDirty(exec,dir))throw new MainCheckoutDirtyError(task.repo,dir);if(await assertBranchHasWork(task,branch,landedOn,exec,dir,deps),strategy==="squash"){if((await git2(exec,dir,["merge","--squash",branch])).exitCode!==0){let files=await conflictedFiles(exec,dir);throw await git2(exec,dir,["merge","--abort"]).catch(()=>{}),await git2(exec,dir,["reset","--hard","HEAD"]).catch(()=>{}),new LandConflictError(task.id,branch,files)}if((await git2(exec,dir,["commit","--no-edit","-m",`Land ${branch} (squash)`])).exitCode!==0)throw await git2(exec,dir,["reset","--hard","HEAD"]).catch(()=>{}),Error(`landTask: '${branch}' has nothing to land onto '${landedOn}' (already merged or empty)`)}else{let before=(await git2(exec,dir,["rev-parse","HEAD"],{readOnly:!0})).stdout.trim();if((await git2(exec,dir,["merge","--no-ff","-m",`Land ${branch}`,branch])).exitCode!==0){let files=await conflictedFiles(exec,dir);throw await git2(exec,dir,["merge","--abort"]).catch(()=>{}),new LandConflictError(task.id,branch,files)}let after=(await git2(exec,dir,["rev-parse","HEAD"],{readOnly:!0})).stdout.trim();if(before===after)throw Error(`landTask: '${branch}' has nothing to land onto '${landedOn}' (already merged or empty)`)}let shaOut=await git2(exec,dir,["rev-parse","--short","HEAD"],{readOnly:!0});return{branch,strategy,landedOn,commit:shaOut.stdout.trim()}}var init_land=__esm(()=>{init_git_env();init_errors();init_exec_deps();init_manager();init_paths2()});class MainTaskCoordinator{store;forgetWorktree;locks=new Map;constructor(store2,forgetWorktree){this.store=store2;this.forgetWorktree=forgetWorktree}async ensure(repo){let task=await this.ensureIfEligible(repo,"explicit");if(task)return task;let{repo:normalizedRepo}=normalizeMainRepo(repo),rejected=projectRejection(normalizedRepo,isGitRepo,"explicit")??"notGitRepo";throw Error(`cannot add ${normalizedRepo} as a project: ${rejectionReason(rejected)}`)}async ensureIfEligible(repo,intent="derived"){let{repo:normalizedRepo,key}=normalizeMainRepo(repo),onThisRoot=(task)=>normalizeMainRepo(task.repo).key===key,existing=this.store.list().find((task)=>task.kind==="main"&&onThisRoot(task));if(existing)return existing;if(projectRejection(normalizedRepo,isGitRepo,intent))return null;let inflight=this.locks.get(key);if(inflight)return inflight;let promise=(async()=>{addSavedRepo(normalizedRepo,{intent:"explicit"});let adoptable=this.store.list().find((task)=>task.kind==="dir"&&task.scratch!==!0&&onThisRoot(task));if(adoptable)return await this.store.update(adoptable.id,this.mainShape(normalizedRepo));return await this.store.create({...this.mainShape(normalizedRepo),status:"backlog",vendor:resolvePreferredVendor(normalizedRepo)})})();this.locks.set(key,promise);try{return await promise}finally{this.locks.delete(key)}}mainShape(normalizedRepo){return{kind:"main",title:titleFromRepo(normalizedRepo),repo:normalizedRepo,branch:"",worktreePath:repoWorkingDir(normalizedRepo)}}async forget(repo){if(!repo)throw Error("forgetProject: repo is required");let key=normalizeMainRepo(repo).key;for(let saved of getSavedRepos())if(normalizeMainRepo(saved).key===key)removeSavedRepo(saved);for(let task of this.store.list()){if(task.kind!=="main")continue;if(normalizeMainRepo(task.repo).key!==key)continue;await this.store.remove(task.id),this.forgetWorktree(task.id)}}}var init_main_task=__esm(()=>{init_project_eligibility();init_repos();init_vendor_prefs();init_core_helpers()});function promotableDirTasks(deps){let claimed=new Set(deps.tasks.filter((task)=>task.kind==="main").map((task)=>task.repo)),seen=new Set,out=[];for(let task of deps.tasks){if(task.kind!=="dir"||task.scratch===!0)continue;let path21=task.repo;if(!path21||claimed.has(path21)||seen.has(path21))continue;if(!deps.isRepoRoot(path21))continue;seen.add(path21),out.push(task)}return out}class TaskDeletionCoordinator{store;worktrees;forgetTask;onSalvage;onResidue;constructor(store2,worktrees,forgetTask,onSalvage,onResidue){this.store=store2;this.worktrees=worktrees;this.forgetTask=forgetTask;this.onSalvage=onSalvage;this.onResidue=onResidue}async prepare(id,opts){let task=this.store.get(id);if(!task)return!1;if(task.kind==="main")throw new CannotDeleteMainTaskError;if(task.deletion?.phase==="queued"||task.deletion?.phase==="running")return!0;let force=opts?.force===!0;if(task.worktreePath&&!force&&task.kind!=="dir"){let dirty=!1;try{dirty=await this.worktrees.isDirty(task.worktreePath)}catch{}if(dirty)throw new DirtyWorktreeError(task.id)}return await this.store.update(task.id,{deletion:{phase:"queued",force,deleteBranch:opts?.deleteBranch===!0,requestedAt:new Date().toISOString()}}),!0}async begin(id){let task=this.store.get(id);if(!task||!task.deletion||task.deletion.phase==="error")return!1;if(task.deletion.phase!=="running")await this.store.update(task.id,{deletion:{...task.deletion,phase:"running"}});return!0}async finish(id){let task=this.store.get(id);if(!task?.deletion||task.deletion.phase!=="running")return;try{if(task.worktreePath&&task.kind!=="dir")await this.worktrees.remove(task.worktreePath,{force:task.deletion.force,deleteBranch:task.deletion.deleteBranch===!0,onSalvage:(record)=>{if(record)this.onSalvage?.(task.id,record)},onResidue:(residue)=>this.onResidue?.(task.id,residue)})}catch(cause){let failure2=new WorktreeRemoveFailedError(task.id,cause);throw await this.store.update(task.id,{deletion:{...task.deletion,phase:"error",error:errorMessage(failure2)}}),failure2}await this.store.remove(task.id),this.forgetTask(task.id)}async deleteNow(id,opts){if(!await this.prepare(id,opts))return;if(!await this.begin(id))return;await this.finish(id)}}var init_task_deletion=__esm(()=>{init_errors()});function inferBranchStyle(names){let typed=new Map,bare=0;for(let raw of new Set(names)){let name=raw.trim();if(!name||name==="HEAD")continue;let slash=name.indexOf("/");if(slash===-1){bare+=1;continue}let prefix=name.slice(0,slash);if(TYPE_PREFIXES.has(prefix))typed.set(prefix,(typed.get(prefix)??0)+1)}let typedTotal=0;for(let n of typed.values())typedTotal+=n;if(typedTotal===0||typedTotal<bare)return{kind:"bare"};let best="",bestN=0;for(let[prefix,n]of typed)if(n>bestN||n===bestN&&(best===""||prefix<best))best=prefix,bestN=n;return{kind:"typed",defaultPrefix:best}}function slugTokens(title){return title.toLowerCase().replace(/[^a-z0-9]+/g,"-").split("-").filter((t2)=>t2.length>0&&!BRAND_TOKENS.has(t2))}function capSlug(tokens){return tokens.join("-").slice(0,32).replace(/-+$/,"")}function deriveConventionBranch(title,style){let tokens=slugTokens(title);if(style.kind==="typed"){let first=tokens[0];return`${first!==void 0&&TYPE_PREFIXES.has(first)?tokens.shift():style.defaultPrefix}/${capSlug(tokens)||"task"}`}return capSlug(tokens)||"task"}function uniqueBranchName(base,taken,taskId){if(!taken.has(base))return base;for(let n=2;n<=99;n+=1){let candidate=`${base}-${n}`;if(!taken.has(candidate))return candidate}return`${base}-${taskId.slice(-6).toLowerCase()}`}var TYPE_PREFIXES,BRAND_TOKENS;var init_branch_style=__esm(()=>{TYPE_PREFIXES=new Set(["feat","feature","fix","bugfix","hotfix","chore","docs","doc","refactor","test","tests","ci","build","perf","style","revert","release"]),BRAND_TOKENS=new Set(["rove","kobe"])});class TaskEditor{store;worktrees;constructor(store2,worktrees){this.store=store2,this.worktrees=worktrees}requireTask(id){let task=this.store.get(id);if(!task)throw new TaskNotFoundError(String(id));return task}async setTitle(id,title){let trimmed=title.trim();if(!trimmed)throw Error("setTitle: title is required (empty or whitespace-only rejected)");let task=this.requireTask(id);if(task.title===trimmed&&task.scratch!==!0)return;await this.store.update(task.id,{title:trimmed,...task.scratch===!0?{scratch:!1}:{}}),await this.followBranchToTitle(task,trimmed)}async followBranchToTitle(taskBefore,newTitle){if(taskBefore.kind==="main"||!taskBefore.worktreePath)return;if(!isPlaceholderDerivedBranch(taskBefore.branch,taskBefore.id))return;try{let names=await this.worktrees.listBranchNames(taskBefore.repo),base=deriveConventionBranch(newTitle,inferBranchStyle(names));if(base===taskBefore.branch)return;if(await this.worktrees.branchHasUpstream(taskBefore.worktreePath,taskBefore.branch))return;let taken=new Set(names.filter((n)=>n!==taskBefore.branch)),nextBranch=uniqueBranchName(base,taken,taskBefore.id);await this.setBranch(taskBefore.id,nextBranch)}catch(err){console.error(`[rove] follow-branch-to-title failed for ${taskBefore.id}:`,err)}}async setBranch(id,branch){let trimmed=branch.trim();if(!trimmed)throw Error("setBranch: branch is required (empty or whitespace-only rejected)");let task=this.requireTask(id);if(task.kind==="main")throw Error("setBranch: a main task tracks the repo's own branch; rename it with git directly");if(task.kind==="dir")throw Error("setBranch: a directory task tracks its own checkout; rename branches with git directly");if(task.branch===trimmed)return;if(task.worktreePath)await this.worktrees.renameBranch(task.worktreePath,task.branch,trimmed);await this.store.update(task.id,{branch:trimmed})}async observeLanguage(id,text){let observed=detectLanguage(text);if(!observed)return;let task=this.requireTask(id);if(task.observedLanguage===observed)return;await this.store.update(task.id,{observedLanguage:observed})}async setVendor(id,vendor,effort){let task=this.requireTask(id),nextEffort=effort?.trim()?effort.trim():void 0,effortChanges=effort!==void 0&&task.modelEffort!==nextEffort;if(task.vendor===vendor&&!effortChanges)return;await this.store.update(task.id,{vendor,...effort!==void 0?{modelEffort:nextEffort}:{}})}async setCommand(id,command,vendor){let trimmed=command.trim();if(!trimmed)throw Error("setCommand: command is required (empty or whitespace-only rejected)");let task=this.requireTask(id);if(task.command===trimmed&&(vendor===void 0||task.vendor===vendor))return;await this.store.update(task.id,{command:trimmed,...vendor?{vendor}:{}})}async setPinned(id,pinned){let task=this.requireTask(id);if(task.kind==="main")return;let next=pinned??!task.pinned;if((task.pinned??!1)===next)return;await this.store.update(task.id,{pinned:next})}async moveTask(id,delta){let task=this.requireTask(id),isMain=task.kind==="main",groupIds=this.store.list().filter((t2)=>isMain?(t2.kind??"task")==="main":(t2.kind??"task")!=="main"&&t2.repo===task.repo&&(t2.pinned??!1)===(task.pinned??!1)).map((t2)=>String(t2.id));await this.store.move(task.id,delta,groupIds)}async setStatus(id,status){let task=this.requireTask(id);if(task.status===status)return;if(task.status==="done"&&status==="error"||task.status==="error"&&status==="done")throw new IllegalTransitionError(task.status,status,task.id);await this.store.update(task.id,{status})}async setPRStatus(id,prStatus){let task=this.requireTask(id);if((task.prStatus?.lastError??null)===(prStatus?.lastError??null)&&samePrStatus(task.prStatus,prStatus??void 0))return;await this.store.update(task.id,{prStatus:prStatus??void 0})}async setQuotaResume(id,state){let task=this.requireTask(id);if((task.quotaResume?.resumeAt??null)===(state?.resumeAt??null))return;await this.store.update(task.id,{quotaResume:state??void 0})}async setLinkedWorkItem(id,item){let task=this.requireTask(id);if((task.linkedWorkItem?.url??null)===(item?.url??null))return;await this.store.update(task.id,{linkedWorkItem:item??void 0})}async setPrompt(id,prompt){if(prompt.trim().length===0)throw Error("setPrompt: prompt is required (empty or whitespace-only rejected)");let task=this.requireTask(id);if(task.prompt===prompt)return;await this.store.update(task.id,{prompt})}}var init_task_editor=__esm(()=>{init_observed_language();init_pr_status();init_branch_style();init_errors()});var ANIMAL_NAMES;var init_animal_names=__esm(()=>{ANIMAL_NAMES=["aardvark","addax","adder","agouti","albatross","alpaca","anaconda","anchovy","anglerfish","anole","anteater","antelope","ape","argali","armadillo","avocet","axolotl","baboon","badger","banteng","barracuda","basilisk","bass","bat","beagle","bear","beaver","bee","beetle","beluga","betta","bison","blackbird","blenny","bluebird","bluegill","boar","bobcat","bonito","bovid","buffalo","bullfrog","bunting","bushbuck","butterfly","buzzard","caiman","camel","canary","capybara","caracal","cardinal","caribou","carp","cassowary","caterpillar","catfish","chameleon","chamois","char","cheetah","chickadee","chimp","chinchilla","chipmunk","chough","cicada","civet","clam","clownfish","cobra","cockatoo","condor","coot","copperhead","coral","cormorant","cougar","coyote","crab","crane","crawfish","crayfish","cricket","crocodile","crow","cuckoo","curlew","cuttlefish","deer","dikdik","dingo","dolphin","donkey","dormouse","dotterel","dove","dragonfly","dromedary","duck","dugong","dunlin","eagle","echidna","eel","egret","eider","eland","elephant","elk","emu","ermine","falcon","fawn","ferret","finch","firefly","flamingo","flounder","fox","frog","gadwall","gannet","gaur","gazelle","gecko","gemsbok","gerbil","gharial","gibbon","gnu","goat","goby","godwit","goldfish","goose","gopher","goral","gorilla","goshawk","grackle","grasshopper","grayling","grebe","grouse","guanaco","guillemot","guineafowl","guppy","halibut","hammerhead","hamster","hare","harrier","hartebeest","hawk","hedgehog","heron","herring","hippo","hornbill","hornet","horse","hummingbird","hyena","ibex","ibis","iguana","impala","indri","jacana","jackal","jaguar","jay","jellyfish","jerboa","junco","kakapo","kangaroo","kestrel","killdeer","kingfisher","kinglet","kite","kiwi","koala","kookaburra","krait","krill","kudu","ladybug","lamprey","langur","lapwing","lark","lemming","lemur","leopard","limpet","lion","lionfish","lizard","llama","lobster","locust","loon","lorikeet","loris","lynx","macaque","macaw","mackerel","magpie","mallard","mamba","mammoth","manatee","mandrill","manta","mantis","marlin","marmoset","marmot","marten","meerkat","merganser","mink","minnow","mole","mongoose","monitor","monkey","moose","moth","mouflon","mouse","mudpuppy","mule","muntjac","musk","muskox","muskrat","mussel","mustang","narwhal","newt","nightingale","numbat","nuthatch","nyala","ocelot","octopus","okapi","opossum","orangutan","orca","oriole","oryx","osprey","ostrich","otter","owl","oyster","oystercatcher","paca","panda","pangolin","panther","parakeet","parrot","parrotfish","partridge","peafowl","pelican","penguin","perch","petrel","pheasant","pigeon","pika","pike","pintail","pipefish","platypus","plover","pollock","pony","porcupine","porpoise","possum","ptarmigan","puffin","puma","pupfish","python","quail","quetzal","quokka","quoll","rabbit","raccoon","rail","rat","rattler","raven","ray","redpoll","reindeer","remora","rhino","roadrunner","robin","rook","sable","sailfish","salamander","salmon","sandpiper","sardine","scallop","scaup","scorpion","seahorse","seal","serval","shark","shearwater","shrew","shrike","shrimp","siskin","sitatunga","skate","skink","skua","skunk","sloth","smelt","snail","snipe","solenodon","sparrow","spider","springbok","squid","squirrel","starfish","starling","stilt","stingray","stoat","stork","sunbird","sunfish","swallow","swan","swift","swordfish","tahr","takin","tamarin","tanager","tapir","tarantula","tarpon","tarsier","teal","tenrec","terrapin","tern","tetra","thrasher","thrush","tiger","toad","tortoise","toucan","treecreeper","treefrog","trout","tuatara","tuna","turkey","turtle","urchin","urial","vicuna","viper","vole","vulture","wagtail","wallaby","walleye","walrus","warbler","warthog","waterbuck","weasel","wildebeest","wolf","wolverine","wombat","woodcock","woodpecker","wrasse","wren","yak","zebra","zebu","zorilla"]});class SlugAllocator{activeSlugs;random;pool;pendingByRepo=new Map;chain=Promise.resolve();constructor(activeSlugs,options={}){this.activeSlugs=activeSlugs;if(this.random=options.random??Math.random,this.pool=options.pool??ANIMAL_NAMES,this.pool.length===0)throw Error("SlugAllocator: animal pool cannot be empty")}async allocate(repo){let previous=this.chain,release2;this.chain=new Promise((resolve13)=>{release2=resolve13}),await previous;try{return await this.pickLocked(repo)}finally{release2()}}commit(repo,slug){this.deletePending(repo,slug)}cancel(repo,slug){this.deletePending(repo,slug)}async pickLocked(repo){let occupied=await this.occupiedSlugs(repo),candidates=this.pool.filter((n)=>!occupied.has(n));if(candidates.length>0){let pick=candidates[Math.floor(this.random()*candidates.length)];return this.addPending(repo,pick),pick}let base=this.pool[Math.floor(this.random()*this.pool.length)];for(let v=2;;v++){let candidate=`${base}-v${v}`;if(!occupied.has(candidate))return this.addPending(repo,candidate),candidate}}async occupiedSlugs(repo){let set=new Set(this.pendingByRepo.get(repo)??[]);for(let slug of this.activeSlugs(repo))if(slug)set.add(slug);for(let dir of await listWorktreeDirNames(repo))set.add(dir);return set}addPending(repo,slug){let pending=this.pendingByRepo.get(repo);if(!pending)pending=new Set,this.pendingByRepo.set(repo,pending);pending.add(slug)}deletePending(repo,slug){let pending=this.pendingByRepo.get(repo);if(!pending)return;if(pending.delete(slug),pending.size===0)this.pendingByRepo.delete(repo)}}var init_slug_allocator=__esm(()=>{init_animal_names();init_paths2()});import{basename as basename11}from"path";class WorktreeCoordinator{store;worktrees;canonPath;ensureProject;slugs;worktreeLocks=new Map;adoptLocks=new Map;reservedBranches=new Set;constructor(store2,worktrees,canonPath2,ensureProject){this.store=store2,this.worktrees=worktrees,this.canonPath=canonPath2,this.ensureProject=ensureProject,this.slugs=new SlugAllocator((repo)=>this.store.list().filter((t2)=>t2.repo===repo&&t2.kind!=="main").map((t2)=>{return t2.worktreePath.match(/([^/\\]+)[/\\]*$/)?.[1]??""}).filter((s)=>s.length>0))}forget(id){this.worktreeLocks.delete(id)}async ensure(task){let inflight=this.worktreeLocks.get(task.id);if(inflight)return inflight;let work=this.createWorktree(task);this.worktreeLocks.set(task.id,work);try{return await work}finally{this.worktreeLocks.delete(task.id)}}async createWorktree(task){let slug=await this.slugs.allocate(task.repo),branch=task.branch||await this.deriveAutoBranch(task),baseRef=task.baseRef,info;try{info=await this.worktrees.createForTask({repo:task.repo,slug,branch,baseRef})}catch(err){throw this.slugs.cancel(task.repo,slug),err}finally{this.reservedBranches.delete(branch)}try{await this.store.update(task.id,{worktreePath:info.path,branch})}catch(err){throw await this.rollbackWorktree(info.path),this.slugs.cancel(task.repo,slug),err}return this.slugs.commit(task.repo,slug),info.path}async deriveAutoBranch(task){let names=await this.worktrees.listBranchNames(task.repo),base=deriveConventionBranch(task.title,inferBranchStyle(names)),taken=new Set([...names,...this.reservedBranches]),branch=uniqueBranchName(base,taken,task.id);return this.reservedBranches.add(branch),branch}async rollbackWorktree(worktreePath){try{await this.worktrees.remove(worktreePath,{force:!0})}catch(err){console.error(`[rove] ensureWorktree rollback failed for ${worktreePath}:`,err)}}async discoverAdoptable(repo){let all=await this.worktrees.listAll(repo),linked=new Set(this.store.list().filter((t2)=>t2.worktreePath).map((t2)=>this.canonPath(t2.worktreePath)));return all.filter((wt)=>!linked.has(this.canonPath(wt.path)))}async adopt(input){let target=this.canonPath(input.worktreePath),inflight=this.adoptLocks.get(target);if(inflight)return inflight;let work=this.adoptLocked(input,target);this.adoptLocks.set(target,work);try{return await work}finally{this.adoptLocks.delete(target)}}async adoptLocked(input,target){let existing=this.store.list().find((t2)=>t2.worktreePath&&this.canonPath(t2.worktreePath)===target);if(existing){if(input.ifExists==="return")return existing;throw Error(`adoptWorktree: ${input.worktreePath} is already adopted as a task`)}let match=(await this.worktrees.listAdoptablePaths(input.repo)).find((wt)=>this.canonPath(wt.path)===target);if(!match)throw Error(`adoptWorktree: ${input.worktreePath} is not an adoptable git worktree of ${input.repo} (unknown, detached, or the main checkout)`);let branch=input.branch?.trim()||match.branch,title=(input.title??basename11(match.path)).trim()||PLACEHOLDER_TASK_TITLE;return await this.ensureProject(input.repo),this.store.create({repo:input.repo,title,branch,worktreePath:match.path,status:"backlog",kind:"task",vendor:input.vendor??DEFAULT_TASK_VENDOR})}}var init_worktree_coordinator=__esm(()=>{init_task();init_branch_style();init_slug_allocator()});var exports_core={};__export(exports_core,{PLACEHOLDER_TASK_TITLE:()=>PLACEHOLDER_TASK_TITLE,Orchestrator:()=>Orchestrator});class Orchestrator{store;worktrees;worktreeCoordinator;editor;deletions;tasksAcc;activeTaskAcc;unsubscribeStore;mainTasks;tearDownSession;constructor(deps){this.store=deps.store,this.worktrees=deps.worktrees,this.tearDownSession=deps.tearDownSession,this.worktreeCoordinator=new WorktreeCoordinator(this.store,this.worktrees,canonPath,(repo)=>this.mainTasks.ensureIfEligible(repo)),this.mainTasks=new MainTaskCoordinator(this.store,(id)=>this.worktreeCoordinator.forget(id)),this.editor=new TaskEditor(this.store,this.worktrees),this.deletions=new TaskDeletionCoordinator(this.store,this.worktrees,(id)=>this.worktreeCoordinator.forget(id),deps.onSalvage,deps.onWorktreeResidue),this.tasksAcc=createStateCell(this.store.list());let persistedFocus=readLastActiveTaskId();this.activeTaskAcc=createStateCell(persistedFocus&&this.store.get(persistedFocus)?persistedFocus:null),this.unsubscribeStore=this.store.subscribe((snapshot)=>{this.tasksAcc.set(snapshot.slice())})}async init(){try{let promotable=promotableDirTasks({tasks:this.store.list(),isRepoRoot:(path21)=>isGitRepo(path21)&&resolveRepoRoot(path21)===path21});for(let task of promotable)await this.mainTasks.ensureIfEligible(task.repo,"explicit")}catch{}}activeTaskSignal(){return this.activeTaskAcc}async setActiveTask(id){let next=id===null?null:String(id);if(next&&this.store.get(next)?.deletion)throw new TaskDeletingError(next);if(this.activeTaskAcc.set(next),next&&this.store.get(next))writeLastActiveTaskId(next),this.store.touchRecency(next)}tasksSignal(){return this.tasksAcc}subscribeTasks(listener2){return this.store.subscribe(listener2)}dispose(){this.unsubscribeStore()}listTasks(){return this.store.list()}getTask(id){return this.store.get(id)}async createTask(input){if(!input.repo)throw Error("createTask: repo is required");let repo=(await this.mainTasks.ensureIfEligible(input.repo,input.projectIntent??"explicit"))?.repo??normalizeMainRepo(input.repo).repo,title=(input.title??PLACEHOLDER_TASK_TITLE).trim()||PLACEHOLDER_TASK_TITLE;return await this.store.create({repo,title,branch:input.branch??"",worktreePath:"",status:"backlog",kind:"task",vendor:input.vendor??DEFAULT_TASK_VENDOR,...input.command?.trim()?{command:input.command.trim()}:{},...input.modelEffort?{modelEffort:input.modelEffort}:{},...input.groupId?{groupId:input.groupId}:{},...input.dispatcher?{dispatcher:input.dispatcher}:{},...input.routine?{routine:input.routine}:{},...input.baseRef?.trim()?{baseRef:input.baseRef.trim()}:{}})}async openDirectoryTask(input){if(!input.dir)throw Error("openDirectoryTask: dir is required");let dir=canonPath(input.dir);return this.store.create({repo:dir,title:input.scratch?"":`${titleFromRepo(dir)}-${randomDirTaskSuffix()}`,branch:"",worktreePath:dir,status:"backlog",kind:"dir",...input.scratch?{scratch:!0}:{},vendor:input.vendor??resolvePreferredVendor()})}async adoptScratchRepo(id,repo){let task=this.store.get(id);if(!task||task.kind!=="dir"||task.scratch!==!0)return;let dir=canonPath(repo);await this.store.update(id,{repo:dir,worktreePath:dir,scratch:!1,title:titleFromRepo(dir)})}async ensureMainTask(repo){return await this.mainTasks.ensure(repo)}async ensureWorktree(id){let task=this.requireTask(id);if(task.deletion)throw new TaskDeletingError(String(task.id));if(task.kind==="main")return repoWorkingDir(task.repo);if(task.kind==="dir")return task.worktreePath;if(task.worktreePath){if(await this.worktrees.pathExists(task.worktreePath))return task.worktreePath;return await this.worktrees.pruneWorktrees(task.repo),await this.store.update(task.id,{worktreePath:""}),this.worktreeCoordinator.ensure({...task,worktreePath:""})}return this.worktreeCoordinator.ensure(task)}async clearWorktreePath(id){let task=this.store.get(id);if(!task||!task.worktreePath)return;if(task.kind==="main"||task.kind==="dir")return;await this.store.update(task.id,{worktreePath:""}),this.worktreeCoordinator.forget(task.id)}setTitle=(id,title)=>this.editor.setTitle(id,title);setBranch=(id,branch)=>this.editor.setBranch(id,branch);observeLanguage=(id,text)=>this.editor.observeLanguage(id,text);setVendor=(id,vendor,effort)=>this.editor.setVendor(id,vendor,effort);setCommand=(id,command,vendor)=>this.editor.setCommand(id,command,vendor);setPinned=(id,pinned)=>this.editor.setPinned(id,pinned);moveTask=(id,delta)=>this.editor.moveTask(id,delta);setStatus=(id,status)=>this.editor.setStatus(id,status);setPRStatus=(id,prStatus)=>this.editor.setPRStatus(id,prStatus);setLinkedWorkItem=(id,item)=>this.editor.setLinkedWorkItem(id,item);setQuotaResume=(id,state)=>this.editor.setQuotaResume(id,state);setPrompt=(id,prompt)=>this.editor.setPrompt(id,prompt);async deleteTask(id,opts){await this.deletions.deleteNow(id,opts)}async prepareTaskDeletion(id,opts){return this.deletions.prepare(id,opts)}async beginTaskDeletion(id){return this.deletions.begin(id)}async finishTaskDeletion(id){return this.deletions.finish(id)}async landTask(id,opts){let task=this.requireTask(id);if(task.deletion)throw new TaskDeletingError(String(task.id));return landTaskWithCleanup(task,opts??{},{worktrees:this.worktrees,clearWorktreePath:(tid)=>this.clearWorktreePath(tid),tearDownSession:this.tearDownSession})}async forgetProject(repo){await this.mainTasks.forget(repo)}async discoverAdoptableWorktrees(repo){if(!repo)throw Error("discoverAdoptableWorktrees: repo is required");return this.worktreeCoordinator.discoverAdoptable(repo)}async adoptWorktree(input){if(!input.repo)throw Error("adoptWorktree: repo is required");if(!input.worktreePath)throw Error("adoptWorktree: worktreePath is required");return this.worktreeCoordinator.adopt(input)}requireTask(id){let task=this.store.get(id);if(!task)throw new TaskNotFoundError(String(id));return task}}var init_core=__esm(()=>{init_external_store();init_last_active();init_repos();init_vendor_prefs();init_task();init_core_helpers();init_errors();init_land();init_main_task();init_task_deletion();init_task_editor();init_worktree_coordinator()});async function git3(cwd,args2,signal,write=!1){return spawnCapture("git",args2,{cwd,env:write?process.env:readOnlyGitProcessEnv(),signal})}function parseConflictedPaths(stdout){return stdout.split(`
|
|
597
|
-
`).map((line)=>line.trim()).filter((line)=>line.length>0)}
|
|
596
|
+
`).filter((l)=>l.length>0).map((l)=>l.slice(3).trim())}async function assertBranchHasWork(task,branch,landedOn,exec,dir,deps){let aheadOut=await git2(exec,dir,["rev-list","--count",`${landedOn}..${branch}`],{readOnly:!0});if(aheadOut.exitCode!==0)throw new MissingRefError(branch,landedOn,dir);let ahead=Number.parseInt(aheadOut.stdout.trim(),10);if(!Number.isFinite(ahead)||ahead>0)return;let worktreePath=task.worktreePath.trim();if(worktreePath){let manager=new GitWorktreeManager(deps),dirty=!1;try{dirty=await manager.isDirty(worktreePath)}catch{dirty=!1}if(dirty){let wtExec=deps.execForPath(worktreePath),files=porcelainPaths((await git2(wtExec,worktreePath,["status","--porcelain"],{readOnly:!0})).stdout);throw new EmptyBranchDirtyWorktreeError(branch,landedOn,worktreePath,files)}}throw new EmptyBranchError(branch,landedOn)}async function landTask(task,input={},deps=defaultExecDeps){let branch=task.branch.trim();if(!branch)throw Error(`landTask: task ${task.id} has no branch to land (never materialised)`);let strategy=input.strategy??"merge",{exec,dir}=baseRepoCtx(task.repo,deps),landedOn=(await git2(exec,dir,["rev-parse","--abbrev-ref","HEAD"],{readOnly:!0})).stdout.trim();if(!landedOn||landedOn==="HEAD")throw Error(`landTask: base checkout at ${dir} is in detached-HEAD state; check out a branch first`);if(landedOn===branch)throw Error(`landTask: base checkout is already on '${branch}' \u2014 nothing to land onto`);if(await isDirty(exec,dir))throw new MainCheckoutDirtyError(task.repo,dir);if(await assertBranchHasWork(task,branch,landedOn,exec,dir,deps),strategy==="squash"){if((await git2(exec,dir,["merge","--squash",branch])).exitCode!==0){let files=await conflictedFiles(exec,dir);throw await git2(exec,dir,["merge","--abort"]).catch(()=>{}),await git2(exec,dir,["reset","--hard","HEAD"]).catch(()=>{}),new LandConflictError(task.id,branch,files)}let commit=await git2(exec,dir,["commit","--no-edit","-m",`Land ${branch} (squash)`]);if(commit.exitCode!==0){if((await git2(exec,dir,["diff","--cached","--quiet"],{readOnly:!0})).exitCode===0)throw await git2(exec,dir,["reset","--hard","HEAD"]).catch(()=>{}),Error(`landTask: '${branch}' has nothing to land onto '${landedOn}' (already merged or empty)`);throw new GitCommandFailedError(`commit (squash-landing '${branch}' onto '${landedOn}')`,commit.stderr,"the squashed merge is left STAGED in the base checkout \u2014 fix the cause and `git commit` it, or `git reset --hard HEAD` to discard")}}else{let before=(await git2(exec,dir,["rev-parse","HEAD"],{readOnly:!0})).stdout.trim(),merge=await git2(exec,dir,["merge","--no-ff","-m",`Land ${branch}`,branch]);if(merge.exitCode!==0){let files=await conflictedFiles(exec,dir);if(await git2(exec,dir,["merge","--abort"]).catch(()=>{}),files.length===0)throw new GitCommandFailedError(`merge --no-ff (landing '${branch}' onto '${landedOn}')`,merge.stderr,"the merge was aborted, so the base checkout is unchanged");throw new LandConflictError(task.id,branch,files)}let after=(await git2(exec,dir,["rev-parse","HEAD"],{readOnly:!0})).stdout.trim();if(before===after)throw Error(`landTask: '${branch}' has nothing to land onto '${landedOn}' (already merged or empty)`)}let shaOut=await git2(exec,dir,["rev-parse","--short","HEAD"],{readOnly:!0});return{branch,strategy,landedOn,commit:shaOut.stdout.trim()}}var init_land=__esm(()=>{init_git_env();init_errors();init_exec_deps();init_manager();init_paths2()});class MainTaskCoordinator{store;forgetWorktree;locks=new Map;constructor(store2,forgetWorktree){this.store=store2;this.forgetWorktree=forgetWorktree}async ensure(repo){let task=await this.ensureIfEligible(repo,"explicit");if(task)return task;let{repo:normalizedRepo}=normalizeMainRepo(repo),rejected=projectRejection(normalizedRepo,isGitRepo,"explicit")??"notGitRepo";throw Error(`cannot add ${normalizedRepo} as a project: ${rejectionReason(rejected)}`)}async ensureIfEligible(repo,intent="derived"){let{repo:normalizedRepo,key}=normalizeMainRepo(repo),onThisRoot=(task)=>normalizeMainRepo(task.repo).key===key,existing=this.store.list().find((task)=>task.kind==="main"&&onThisRoot(task));if(existing)return existing;if(projectRejection(normalizedRepo,isGitRepo,intent))return null;let inflight=this.locks.get(key);if(inflight)return inflight;let promise=(async()=>{addSavedRepo(normalizedRepo,{intent:"explicit"});let adoptable=this.store.list().find((task)=>task.kind==="dir"&&task.scratch!==!0&&onThisRoot(task));if(adoptable)return await this.store.update(adoptable.id,this.mainShape(normalizedRepo));return await this.store.create({...this.mainShape(normalizedRepo),status:"backlog",vendor:resolvePreferredVendor(normalizedRepo)})})();this.locks.set(key,promise);try{return await promise}finally{this.locks.delete(key)}}mainShape(normalizedRepo){return{kind:"main",title:titleFromRepo(normalizedRepo),repo:normalizedRepo,branch:"",worktreePath:repoWorkingDir(normalizedRepo)}}async forget(repo){if(!repo)throw Error("forgetProject: repo is required");let key=normalizeMainRepo(repo).key;for(let saved of getSavedRepos())if(normalizeMainRepo(saved).key===key)removeSavedRepo(saved);for(let task of this.store.list()){if(task.kind!=="main")continue;if(normalizeMainRepo(task.repo).key!==key)continue;await this.store.remove(task.id),this.forgetWorktree(task.id)}}}var init_main_task=__esm(()=>{init_project_eligibility();init_repos();init_vendor_prefs();init_core_helpers()});function promotableDirTasks(deps){let claimed=new Set(deps.tasks.filter((task)=>task.kind==="main").map((task)=>task.repo)),seen=new Set,out=[];for(let task of deps.tasks){if(task.kind!=="dir"||task.scratch===!0)continue;let path21=task.repo;if(!path21||claimed.has(path21)||seen.has(path21))continue;if(!deps.isRepoRoot(path21))continue;seen.add(path21),out.push(task)}return out}class TaskDeletionCoordinator{store;worktrees;forgetTask;onSalvage;onResidue;constructor(store2,worktrees,forgetTask,onSalvage,onResidue){this.store=store2;this.worktrees=worktrees;this.forgetTask=forgetTask;this.onSalvage=onSalvage;this.onResidue=onResidue}async prepare(id,opts){let task=this.store.get(id);if(!task)return!1;if(task.kind==="main")throw new CannotDeleteMainTaskError;if(task.deletion?.phase==="queued"||task.deletion?.phase==="running")return!0;let force=opts?.force===!0;if(task.worktreePath&&!force&&task.kind!=="dir"){let dirty=!1;try{dirty=await this.worktrees.isDirty(task.worktreePath)}catch{}if(dirty)throw new DirtyWorktreeError(task.id)}return await this.store.update(task.id,{deletion:{phase:"queued",force,deleteBranch:opts?.deleteBranch===!0,requestedAt:new Date().toISOString()}}),!0}async begin(id){let task=this.store.get(id);if(!task||!task.deletion||task.deletion.phase==="error")return!1;if(task.deletion.phase!=="running")await this.store.update(task.id,{deletion:{...task.deletion,phase:"running"}});return!0}async finish(id){let task=this.store.get(id);if(!task?.deletion||task.deletion.phase!=="running")return;try{if(task.worktreePath&&task.kind!=="dir")await this.worktrees.remove(task.worktreePath,{force:task.deletion.force,deleteBranch:task.deletion.deleteBranch===!0,onSalvage:(record)=>{if(record)this.onSalvage?.(task.id,record)},onResidue:(residue)=>this.onResidue?.(task.id,residue)})}catch(cause){let failure2=new WorktreeRemoveFailedError(task.id,cause);throw await this.store.update(task.id,{deletion:{...task.deletion,phase:"error",error:errorMessage(failure2)}}),failure2}await this.store.remove(task.id),this.forgetTask(task.id)}async deleteNow(id,opts){if(!await this.prepare(id,opts))return;if(!await this.begin(id))return;await this.finish(id)}}var init_task_deletion=__esm(()=>{init_errors()});function inferBranchStyle(names){let typed=new Map,bare=0;for(let raw of new Set(names)){let name=raw.trim();if(!name||name==="HEAD")continue;let slash=name.indexOf("/");if(slash===-1){bare+=1;continue}let prefix=name.slice(0,slash);if(TYPE_PREFIXES.has(prefix))typed.set(prefix,(typed.get(prefix)??0)+1)}let typedTotal=0;for(let n of typed.values())typedTotal+=n;if(typedTotal===0||typedTotal<bare)return{kind:"bare"};let best="",bestN=0;for(let[prefix,n]of typed)if(n>bestN||n===bestN&&(best===""||prefix<best))best=prefix,bestN=n;return{kind:"typed",defaultPrefix:best}}function slugTokens(title){return title.toLowerCase().replace(/[^a-z0-9]+/g,"-").split("-").filter((t2)=>t2.length>0&&!BRAND_TOKENS.has(t2))}function capSlug(tokens){return tokens.join("-").slice(0,32).replace(/-+$/,"")}function deriveConventionBranch(title,style){let tokens=slugTokens(title);if(style.kind==="typed"){let first=tokens[0];return`${first!==void 0&&TYPE_PREFIXES.has(first)?tokens.shift():style.defaultPrefix}/${capSlug(tokens)||"task"}`}return capSlug(tokens)||"task"}function uniqueBranchName(base,taken,taskId){if(!taken.has(base))return base;for(let n=2;n<=99;n+=1){let candidate=`${base}-${n}`;if(!taken.has(candidate))return candidate}return`${base}-${taskId.slice(-6).toLowerCase()}`}var TYPE_PREFIXES,BRAND_TOKENS;var init_branch_style=__esm(()=>{TYPE_PREFIXES=new Set(["feat","feature","fix","bugfix","hotfix","chore","docs","doc","refactor","test","tests","ci","build","perf","style","revert","release"]),BRAND_TOKENS=new Set(["rove","kobe"])});class TaskEditor{store;worktrees;constructor(store2,worktrees){this.store=store2,this.worktrees=worktrees}requireTask(id){let task=this.store.get(id);if(!task)throw new TaskNotFoundError(String(id));return task}async setTitle(id,title){let trimmed=title.trim();if(!trimmed)throw Error("setTitle: title is required (empty or whitespace-only rejected)");let task=this.requireTask(id);if(task.title===trimmed&&task.scratch!==!0)return;await this.store.update(task.id,{title:trimmed,...task.scratch===!0?{scratch:!1}:{}}),await this.followBranchToTitle(task,trimmed)}async followBranchToTitle(taskBefore,newTitle){if(taskBefore.kind==="main"||!taskBefore.worktreePath)return;if(!isPlaceholderDerivedBranch(taskBefore.branch,taskBefore.id))return;try{let names=await this.worktrees.listBranchNames(taskBefore.repo),base=deriveConventionBranch(newTitle,inferBranchStyle(names));if(base===taskBefore.branch)return;if(await this.worktrees.branchHasUpstream(taskBefore.worktreePath,taskBefore.branch))return;let taken=new Set(names.filter((n)=>n!==taskBefore.branch)),nextBranch=uniqueBranchName(base,taken,taskBefore.id);await this.setBranch(taskBefore.id,nextBranch)}catch(err){console.error(`[rove] follow-branch-to-title failed for ${taskBefore.id}:`,err)}}async setBranch(id,branch){let trimmed=branch.trim();if(!trimmed)throw Error("setBranch: branch is required (empty or whitespace-only rejected)");let task=this.requireTask(id);if(task.kind==="main")throw Error("setBranch: a main task tracks the repo's own branch; rename it with git directly");if(task.kind==="dir")throw Error("setBranch: a directory task tracks its own checkout; rename branches with git directly");if(task.branch===trimmed)return;if(task.worktreePath)await this.worktrees.renameBranch(task.worktreePath,task.branch,trimmed);await this.store.update(task.id,{branch:trimmed})}async observeLanguage(id,text){let observed=detectLanguage(text);if(!observed)return;let task=this.requireTask(id);if(task.observedLanguage===observed)return;await this.store.update(task.id,{observedLanguage:observed})}async setVendor(id,vendor,effort){let task=this.requireTask(id),nextEffort=effort?.trim()?effort.trim():void 0,effortChanges=effort!==void 0&&task.modelEffort!==nextEffort;if(task.vendor===vendor&&!effortChanges)return;await this.store.update(task.id,{vendor,...effort!==void 0?{modelEffort:nextEffort}:{}})}async setCommand(id,command,vendor){let trimmed=command.trim();if(!trimmed)throw Error("setCommand: command is required (empty or whitespace-only rejected)");let task=this.requireTask(id);if(task.command===trimmed&&(vendor===void 0||task.vendor===vendor))return;await this.store.update(task.id,{command:trimmed,...vendor?{vendor}:{}})}async setPinned(id,pinned){let task=this.requireTask(id);if(task.kind==="main")return;let next=pinned??!task.pinned;if((task.pinned??!1)===next)return;await this.store.update(task.id,{pinned:next})}async moveTask(id,delta){let task=this.requireTask(id),isMain=task.kind==="main",groupIds=this.store.list().filter((t2)=>isMain?(t2.kind??"task")==="main":(t2.kind??"task")!=="main"&&t2.repo===task.repo&&(t2.pinned??!1)===(task.pinned??!1)).map((t2)=>String(t2.id));await this.store.move(task.id,delta,groupIds)}async setStatus(id,status){let task=this.requireTask(id);if(task.status===status)return;if(task.status==="done"&&status==="error"||task.status==="error"&&status==="done")throw new IllegalTransitionError(task.status,status,task.id);await this.store.update(task.id,{status})}async setPRStatus(id,prStatus){let task=this.requireTask(id);if((task.prStatus?.lastError??null)===(prStatus?.lastError??null)&&samePrStatus(task.prStatus,prStatus??void 0))return;await this.store.update(task.id,{prStatus:prStatus??void 0})}async setQuotaResume(id,state){let task=this.requireTask(id);if((task.quotaResume?.resumeAt??null)===(state?.resumeAt??null))return;await this.store.update(task.id,{quotaResume:state??void 0})}async setLinkedWorkItem(id,item){let task=this.requireTask(id);if((task.linkedWorkItem?.url??null)===(item?.url??null))return;await this.store.update(task.id,{linkedWorkItem:item??void 0})}async setPrompt(id,prompt){if(prompt.trim().length===0)throw Error("setPrompt: prompt is required (empty or whitespace-only rejected)");let task=this.requireTask(id);if(task.prompt===prompt)return;await this.store.update(task.id,{prompt})}}var init_task_editor=__esm(()=>{init_observed_language();init_pr_status();init_branch_style();init_errors()});var ANIMAL_NAMES;var init_animal_names=__esm(()=>{ANIMAL_NAMES=["aardvark","addax","adder","agouti","albatross","alpaca","anaconda","anchovy","anglerfish","anole","anteater","antelope","ape","argali","armadillo","avocet","axolotl","baboon","badger","banteng","barracuda","basilisk","bass","bat","beagle","bear","beaver","bee","beetle","beluga","betta","bison","blackbird","blenny","bluebird","bluegill","boar","bobcat","bonito","bovid","buffalo","bullfrog","bunting","bushbuck","butterfly","buzzard","caiman","camel","canary","capybara","caracal","cardinal","caribou","carp","cassowary","caterpillar","catfish","chameleon","chamois","char","cheetah","chickadee","chimp","chinchilla","chipmunk","chough","cicada","civet","clam","clownfish","cobra","cockatoo","condor","coot","copperhead","coral","cormorant","cougar","coyote","crab","crane","crawfish","crayfish","cricket","crocodile","crow","cuckoo","curlew","cuttlefish","deer","dikdik","dingo","dolphin","donkey","dormouse","dotterel","dove","dragonfly","dromedary","duck","dugong","dunlin","eagle","echidna","eel","egret","eider","eland","elephant","elk","emu","ermine","falcon","fawn","ferret","finch","firefly","flamingo","flounder","fox","frog","gadwall","gannet","gaur","gazelle","gecko","gemsbok","gerbil","gharial","gibbon","gnu","goat","goby","godwit","goldfish","goose","gopher","goral","gorilla","goshawk","grackle","grasshopper","grayling","grebe","grouse","guanaco","guillemot","guineafowl","guppy","halibut","hammerhead","hamster","hare","harrier","hartebeest","hawk","hedgehog","heron","herring","hippo","hornbill","hornet","horse","hummingbird","hyena","ibex","ibis","iguana","impala","indri","jacana","jackal","jaguar","jay","jellyfish","jerboa","junco","kakapo","kangaroo","kestrel","killdeer","kingfisher","kinglet","kite","kiwi","koala","kookaburra","krait","krill","kudu","ladybug","lamprey","langur","lapwing","lark","lemming","lemur","leopard","limpet","lion","lionfish","lizard","llama","lobster","locust","loon","lorikeet","loris","lynx","macaque","macaw","mackerel","magpie","mallard","mamba","mammoth","manatee","mandrill","manta","mantis","marlin","marmoset","marmot","marten","meerkat","merganser","mink","minnow","mole","mongoose","monitor","monkey","moose","moth","mouflon","mouse","mudpuppy","mule","muntjac","musk","muskox","muskrat","mussel","mustang","narwhal","newt","nightingale","numbat","nuthatch","nyala","ocelot","octopus","okapi","opossum","orangutan","orca","oriole","oryx","osprey","ostrich","otter","owl","oyster","oystercatcher","paca","panda","pangolin","panther","parakeet","parrot","parrotfish","partridge","peafowl","pelican","penguin","perch","petrel","pheasant","pigeon","pika","pike","pintail","pipefish","platypus","plover","pollock","pony","porcupine","porpoise","possum","ptarmigan","puffin","puma","pupfish","python","quail","quetzal","quokka","quoll","rabbit","raccoon","rail","rat","rattler","raven","ray","redpoll","reindeer","remora","rhino","roadrunner","robin","rook","sable","sailfish","salamander","salmon","sandpiper","sardine","scallop","scaup","scorpion","seahorse","seal","serval","shark","shearwater","shrew","shrike","shrimp","siskin","sitatunga","skate","skink","skua","skunk","sloth","smelt","snail","snipe","solenodon","sparrow","spider","springbok","squid","squirrel","starfish","starling","stilt","stingray","stoat","stork","sunbird","sunfish","swallow","swan","swift","swordfish","tahr","takin","tamarin","tanager","tapir","tarantula","tarpon","tarsier","teal","tenrec","terrapin","tern","tetra","thrasher","thrush","tiger","toad","tortoise","toucan","treecreeper","treefrog","trout","tuatara","tuna","turkey","turtle","urchin","urial","vicuna","viper","vole","vulture","wagtail","wallaby","walleye","walrus","warbler","warthog","waterbuck","weasel","wildebeest","wolf","wolverine","wombat","woodcock","woodpecker","wrasse","wren","yak","zebra","zebu","zorilla"]});class SlugAllocator{activeSlugs;random;pool;pendingByRepo=new Map;chain=Promise.resolve();constructor(activeSlugs,options={}){this.activeSlugs=activeSlugs;if(this.random=options.random??Math.random,this.pool=options.pool??ANIMAL_NAMES,this.pool.length===0)throw Error("SlugAllocator: animal pool cannot be empty")}async allocate(repo){let previous=this.chain,release2;this.chain=new Promise((resolve13)=>{release2=resolve13}),await previous;try{return await this.pickLocked(repo)}finally{release2()}}commit(repo,slug){this.deletePending(repo,slug)}cancel(repo,slug){this.deletePending(repo,slug)}async pickLocked(repo){let occupied=await this.occupiedSlugs(repo),candidates=this.pool.filter((n)=>!occupied.has(n));if(candidates.length>0){let pick=candidates[Math.floor(this.random()*candidates.length)];return this.addPending(repo,pick),pick}let base=this.pool[Math.floor(this.random()*this.pool.length)];for(let v=2;;v++){let candidate=`${base}-v${v}`;if(!occupied.has(candidate))return this.addPending(repo,candidate),candidate}}async occupiedSlugs(repo){let set=new Set(this.pendingByRepo.get(repo)??[]);for(let slug of this.activeSlugs(repo))if(slug)set.add(slug);for(let dir of await listWorktreeDirNames(repo))set.add(dir);return set}addPending(repo,slug){let pending=this.pendingByRepo.get(repo);if(!pending)pending=new Set,this.pendingByRepo.set(repo,pending);pending.add(slug)}deletePending(repo,slug){let pending=this.pendingByRepo.get(repo);if(!pending)return;if(pending.delete(slug),pending.size===0)this.pendingByRepo.delete(repo)}}var init_slug_allocator=__esm(()=>{init_animal_names();init_paths2()});import{basename as basename11}from"path";class WorktreeCoordinator{store;worktrees;canonPath;ensureProject;slugs;worktreeLocks=new Map;adoptLocks=new Map;reservedBranches=new Set;constructor(store2,worktrees,canonPath2,ensureProject){this.store=store2,this.worktrees=worktrees,this.canonPath=canonPath2,this.ensureProject=ensureProject,this.slugs=new SlugAllocator((repo)=>this.store.list().filter((t2)=>t2.repo===repo&&t2.kind!=="main").map((t2)=>{return t2.worktreePath.match(/([^/\\]+)[/\\]*$/)?.[1]??""}).filter((s)=>s.length>0))}forget(id){this.worktreeLocks.delete(id)}async ensure(task){let inflight=this.worktreeLocks.get(task.id);if(inflight)return inflight;let work=this.createWorktree(task);this.worktreeLocks.set(task.id,work);try{return await work}finally{this.worktreeLocks.delete(task.id)}}async createWorktree(task){let slug=await this.slugs.allocate(task.repo),branch=task.branch||await this.deriveAutoBranch(task),baseRef=task.baseRef,info;try{info=await this.worktrees.createForTask({repo:task.repo,slug,branch,baseRef})}catch(err){throw this.slugs.cancel(task.repo,slug),err}finally{this.reservedBranches.delete(branch)}try{await this.store.update(task.id,{worktreePath:info.path,branch})}catch(err){throw await this.rollbackWorktree(info.path),this.slugs.cancel(task.repo,slug),err}return this.slugs.commit(task.repo,slug),info.path}async deriveAutoBranch(task){let names=await this.worktrees.listBranchNames(task.repo),base=deriveConventionBranch(task.title,inferBranchStyle(names)),taken=new Set([...names,...this.reservedBranches]),branch=uniqueBranchName(base,taken,task.id);return this.reservedBranches.add(branch),branch}async rollbackWorktree(worktreePath){try{await this.worktrees.remove(worktreePath,{force:!0})}catch(err){console.error(`[rove] ensureWorktree rollback failed for ${worktreePath}:`,err)}}async discoverAdoptable(repo){let all=await this.worktrees.listAll(repo),linked=new Set(this.store.list().filter((t2)=>t2.worktreePath).map((t2)=>this.canonPath(t2.worktreePath)));return all.filter((wt)=>!linked.has(this.canonPath(wt.path)))}async adopt(input){let target=this.canonPath(input.worktreePath),inflight=this.adoptLocks.get(target);if(inflight)return inflight;let work=this.adoptLocked(input,target);this.adoptLocks.set(target,work);try{return await work}finally{this.adoptLocks.delete(target)}}async adoptLocked(input,target){let existing=this.store.list().find((t2)=>t2.worktreePath&&this.canonPath(t2.worktreePath)===target);if(existing){if(input.ifExists==="return")return existing;throw Error(`adoptWorktree: ${input.worktreePath} is already adopted as a task`)}let match=(await this.worktrees.listAdoptablePaths(input.repo)).find((wt)=>this.canonPath(wt.path)===target);if(!match)throw Error(`adoptWorktree: ${input.worktreePath} is not an adoptable git worktree of ${input.repo} (unknown, detached, or the main checkout)`);let branch=input.branch?.trim()||match.branch,title=(input.title??basename11(match.path)).trim()||PLACEHOLDER_TASK_TITLE;return await this.ensureProject(input.repo),this.store.create({repo:input.repo,title,branch,worktreePath:match.path,status:"backlog",kind:"task",vendor:input.vendor??DEFAULT_TASK_VENDOR})}}var init_worktree_coordinator=__esm(()=>{init_task();init_branch_style();init_slug_allocator()});var exports_core={};__export(exports_core,{PLACEHOLDER_TASK_TITLE:()=>PLACEHOLDER_TASK_TITLE,Orchestrator:()=>Orchestrator});class Orchestrator{store;worktrees;worktreeCoordinator;editor;deletions;tasksAcc;activeTaskAcc;unsubscribeStore;mainTasks;tearDownSession;constructor(deps){this.store=deps.store,this.worktrees=deps.worktrees,this.tearDownSession=deps.tearDownSession,this.worktreeCoordinator=new WorktreeCoordinator(this.store,this.worktrees,canonPath,(repo)=>this.mainTasks.ensureIfEligible(repo)),this.mainTasks=new MainTaskCoordinator(this.store,(id)=>this.worktreeCoordinator.forget(id)),this.editor=new TaskEditor(this.store,this.worktrees),this.deletions=new TaskDeletionCoordinator(this.store,this.worktrees,(id)=>this.worktreeCoordinator.forget(id),deps.onSalvage,deps.onWorktreeResidue),this.tasksAcc=createStateCell(this.store.list());let persistedFocus=readLastActiveTaskId();this.activeTaskAcc=createStateCell(persistedFocus&&this.store.get(persistedFocus)?persistedFocus:null),this.unsubscribeStore=this.store.subscribe((snapshot)=>{this.tasksAcc.set(snapshot.slice())})}async init(){try{let promotable=promotableDirTasks({tasks:this.store.list(),isRepoRoot:(path21)=>isGitRepo(path21)&&resolveRepoRoot(path21)===path21});for(let task of promotable)await this.mainTasks.ensureIfEligible(task.repo,"explicit")}catch{}}activeTaskSignal(){return this.activeTaskAcc}async setActiveTask(id){let next=id===null?null:String(id);if(next&&this.store.get(next)?.deletion)throw new TaskDeletingError(next);if(this.activeTaskAcc.set(next),next&&this.store.get(next))writeLastActiveTaskId(next),this.store.touchRecency(next)}tasksSignal(){return this.tasksAcc}subscribeTasks(listener2){return this.store.subscribe(listener2)}dispose(){this.unsubscribeStore()}listTasks(){return this.store.list()}getTask(id){return this.store.get(id)}async createTask(input){if(!input.repo)throw Error("createTask: repo is required");let repo=(await this.mainTasks.ensureIfEligible(input.repo,input.projectIntent??"explicit"))?.repo??normalizeMainRepo(input.repo).repo,title=(input.title??PLACEHOLDER_TASK_TITLE).trim()||PLACEHOLDER_TASK_TITLE;return await this.store.create({repo,title,branch:input.branch??"",worktreePath:"",status:"backlog",kind:"task",vendor:input.vendor??DEFAULT_TASK_VENDOR,...input.command?.trim()?{command:input.command.trim()}:{},...input.modelEffort?{modelEffort:input.modelEffort}:{},...input.groupId?{groupId:input.groupId}:{},...input.dispatcher?{dispatcher:input.dispatcher}:{},...input.routine?{routine:input.routine}:{},...input.baseRef?.trim()?{baseRef:input.baseRef.trim()}:{}})}async openDirectoryTask(input){if(!input.dir)throw Error("openDirectoryTask: dir is required");let dir=canonPath(input.dir);return this.store.create({repo:dir,title:input.scratch?"":`${titleFromRepo(dir)}-${randomDirTaskSuffix()}`,branch:"",worktreePath:dir,status:"backlog",kind:"dir",...input.scratch?{scratch:!0}:{},vendor:input.vendor??resolvePreferredVendor()})}async adoptScratchRepo(id,repo){let task=this.store.get(id);if(!task||task.kind!=="dir"||task.scratch!==!0)return;let dir=canonPath(repo);await this.store.update(id,{repo:dir,worktreePath:dir,scratch:!1,title:titleFromRepo(dir)})}async ensureMainTask(repo){return await this.mainTasks.ensure(repo)}async ensureWorktree(id){let task=this.requireTask(id);if(task.deletion)throw new TaskDeletingError(String(task.id));if(task.kind==="main")return repoWorkingDir(task.repo);if(task.kind==="dir")return task.worktreePath;if(task.worktreePath){if(await this.worktrees.pathExists(task.worktreePath))return task.worktreePath;return await this.worktrees.pruneWorktrees(task.repo),await this.store.update(task.id,{worktreePath:""}),this.worktreeCoordinator.ensure({...task,worktreePath:""})}return this.worktreeCoordinator.ensure(task)}async clearWorktreePath(id){let task=this.store.get(id);if(!task||!task.worktreePath)return;if(task.kind==="main"||task.kind==="dir")return;await this.store.update(task.id,{worktreePath:""}),this.worktreeCoordinator.forget(task.id)}setTitle=(id,title)=>this.editor.setTitle(id,title);setBranch=(id,branch)=>this.editor.setBranch(id,branch);observeLanguage=(id,text)=>this.editor.observeLanguage(id,text);setVendor=(id,vendor,effort)=>this.editor.setVendor(id,vendor,effort);setCommand=(id,command,vendor)=>this.editor.setCommand(id,command,vendor);setPinned=(id,pinned)=>this.editor.setPinned(id,pinned);moveTask=(id,delta)=>this.editor.moveTask(id,delta);setStatus=(id,status)=>this.editor.setStatus(id,status);setPRStatus=(id,prStatus)=>this.editor.setPRStatus(id,prStatus);setLinkedWorkItem=(id,item)=>this.editor.setLinkedWorkItem(id,item);setQuotaResume=(id,state)=>this.editor.setQuotaResume(id,state);setPrompt=(id,prompt)=>this.editor.setPrompt(id,prompt);async deleteTask(id,opts){await this.deletions.deleteNow(id,opts)}async prepareTaskDeletion(id,opts){return this.deletions.prepare(id,opts)}async beginTaskDeletion(id){return this.deletions.begin(id)}async finishTaskDeletion(id){return this.deletions.finish(id)}async landTask(id,opts){let task=this.requireTask(id);if(task.deletion)throw new TaskDeletingError(String(task.id));return landTaskWithCleanup(task,opts??{},{worktrees:this.worktrees,clearWorktreePath:(tid)=>this.clearWorktreePath(tid),tearDownSession:this.tearDownSession})}async forgetProject(repo){await this.mainTasks.forget(repo)}async discoverAdoptableWorktrees(repo){if(!repo)throw Error("discoverAdoptableWorktrees: repo is required");return this.worktreeCoordinator.discoverAdoptable(repo)}async adoptWorktree(input){if(!input.repo)throw Error("adoptWorktree: repo is required");if(!input.worktreePath)throw Error("adoptWorktree: worktreePath is required");return this.worktreeCoordinator.adopt(input)}requireTask(id){let task=this.store.get(id);if(!task)throw new TaskNotFoundError(String(id));return task}}var init_core=__esm(()=>{init_external_store();init_last_active();init_repos();init_vendor_prefs();init_task();init_core_helpers();init_errors();init_land();init_main_task();init_task_deletion();init_task_editor();init_worktree_coordinator()});async function git3(cwd,args2,signal,write=!1){return spawnCapture("git",args2,{cwd,env:write?process.env:readOnlyGitProcessEnv(),signal})}function parseConflictedPaths(stdout){return stdout.split(`
|
|
597
|
+
`).map((line)=>line.trim()).filter((line)=>line.length>0)}function parseDirtyPaths(stdout){return stdout.split(`
|
|
598
|
+
`).filter((line)=>line.length>3).map((line)=>line.slice(3).trim()).filter((line)=>line.length>0)}async function syncWorktreeWithBase(worktreePath,baseRef,signal){let status=await git3(worktreePath,["status","--porcelain=v1"],signal);if(status.status!==0)throw Error("git status failed");let dirty=parseDirtyPaths(status.stdout);if(dirty.length>0)throw Error(`${SYNC_DIRTY}: ${dirty.join(", ")}`);let before=await git3(worktreePath,["rev-parse","HEAD"],signal),merge=await git3(worktreePath,["merge","--no-edit",baseRef],signal,!0);if(merge.status!==0){let conflicted=await git3(worktreePath,["diff","--name-only","--diff-filter=U"],signal),paths=parseConflictedPaths(conflicted.stdout);if(paths.length>0)throw Error(`${SYNC_CONFLICT}: ${paths.join(", ")}`);let detail=merge.stderr?.trim();throw Error(detail?`git merge ${baseRef} failed \u2014 ${detail}`:`git merge ${baseRef} failed`)}let after=await git3(worktreePath,["rev-parse","HEAD"],signal);return{baseRef,alreadyCurrent:before.status===0&&before.stdout.trim()===after.stdout.trim()}}var SYNC_TIMEOUT_MS=60000,SYNC_CONFLICT="SYNC_CONFLICT",SYNC_DIRTY="SYNC_WORKTREE_DIRTY";var init_sync_base=__esm(()=>{init_git_env();init_poll_scheduling2()});async function runWorktreeGit(worktreePath,args2,options={}){if(!worktreePath)return{stdout:"",stderr:"worktreePath is required",status:-1};let exec=(options.execForPath??execHostForWorktreePath)(worktreePath),controller=options.timeoutMs&&options.timeoutMs>0?new AbortController:null,timedOut=!1,timer=controller?setTimeout(()=>{timedOut=!0,controller.abort()},options.timeoutMs):null,signal=controller&&options.signal?AbortSignal.any([controller.signal,options.signal]):controller?.signal??options.signal,result;try{result=await exec.run(["git",...args2],{cwd:worktreePath,env:READ_ONLY_GIT_ENV,signal})}catch(err){if(timer)clearTimeout(timer);return{stdout:"",stderr:errorMessage(err),status:-1}}if(timer)clearTimeout(timer);if(timedOut&&result.exitCode===-1&&!result.stderr)return{stdout:result.stdout,stderr:`git ${args2.join(" ")} timed out after ${options.timeoutMs}ms`,status:-1};return{stdout:result.stdout,stderr:result.stderr,status:result.exitCode}}function worktreeFilePath(worktreePath,relPath){if(!worktreePath||!relPath||relPath.startsWith("/"))return null;let parts=relPath.split("/");if(parts.some((part)=>part===".."))return null;return`${worktreePath.replace(/\/+$/,"")}/${parts.filter(Boolean).join("/")}`}async function worktreeFileSize(worktreePath,relPath,deps={}){let path21=worktreeFilePath(worktreePath,relPath);if(!path21)return null;let exec=(deps.execForPath??execHostForWorktreePath)(worktreePath);try{let res=await exec.run(["wc","-c",path21]);if(res.exitCode!==0)return null;let n=Number.parseInt(res.stdout.trim().split(/\s+/)[0]??"",10);return Number.isFinite(n)?n:null}catch{return null}}async function readWorktreeFile(worktreePath,relPath,deps={}){let path21=worktreeFilePath(worktreePath,relPath);if(!path21)return null;let exec=(deps.execForPath??execHostForWorktreePath)(worktreePath);try{return await exec.readFile(path21)}catch{return null}}var init_content=__esm(()=>{init_resolve();init_git_env()});import{statSync as statSync7}from"fs";async function runGit2(cwd,args2){let res=await runWorktreeGit(cwd,args2,{timeoutMs:GIT_TIMEOUT_MS}),code=res.status??-1;return{ok:code===0,stdout:res.stdout,stderr:res.stderr,code}}function statusLabel(code){switch(code){case"M":return"modified";case"A":return"added";case"D":return"deleted";case"R":return"renamed";case"C":return"copied";case"T":return"type changed";case"U":return"unmerged";case"?":return"untracked";default:return"changed"}}function markerPath(payload){if(payload==="/dev/null")return null;let token=payload;if(token.startsWith('"'))token=unquoteGitPath(token);else{let tab=token.indexOf("\t");if(tab>=0)token=token.slice(0,tab)}if(token.startsWith("a/")||token.startsWith("b/"))token=token.slice(2);return token.length>0?token:null}function splitDiffByFile(diff){let byFile=new Map;if(!diff)return byFile;let chunks=diff.split(/(?=^diff --git )/m);for(let chunk of chunks){if(!chunk.startsWith("diff --git"))continue;let path21=null,plus=chunk.match(/^\+\+\+ (.*)$/m);if(plus)path21=markerPath(plus[1]);if(path21===null){let minus=chunk.match(/^--- (.*)$/m);if(minus)path21=markerPath(minus[1])}if(path21===null){let header=chunk.match(/^diff --git a\/.* b\/(.*)$/m);if(header)path21=unquoteGitPath(header[1])}if(path21===null)continue;byFile.set(path21,chunk.endsWith(`
|
|
598
599
|
`)?chunk:`${chunk}
|
|
599
600
|
`)}return byFile}async function mapPool(items,limit,fn){let results=Array(items.length),width=Math.max(1,Math.min(limit,items.length)),next=0;async function worker(){while(next<items.length){let index=next++;results[index]=await fn(items[index],index)}}return await Promise.all(Array.from({length:width},()=>worker())),results}async function untrackedPatch(cwd,relPath){let res=await runGit2(cwd,["diff","--no-color","--no-index","--","/dev/null",relPath]);if(res.stdout.trim())return res.stdout.endsWith(`
|
|
600
601
|
`)?res.stdout:`${res.stdout}
|
|
@@ -757,7 +758,7 @@ ${line}`:line,index+=1}return next}function issueChatTaskTitle(issue){return`#${
|
|
|
757
758
|
`)}catch{}let remaining={...values},next=[];for(let line of lines){let key=line.match(/^([A-Za-z_][A-Za-z0-9_]*)=/)?.[1];if(key&&key in remaining){let value=oneLine(remaining[key]);if(delete remaining[key],value!=="")next.push(`${key}=${value}`);continue}next.push(line)}for(let[key,raw]of Object.entries(remaining)){let value=oneLine(raw);if(value!=="")next.push(`${key}=${value}`)}while(next.length>0&&next[next.length-1]==="")next.pop();mkdirSync20(pluginConfigDir(pluginId,homeDir2),{recursive:!0,mode:448}),writeFileSync17(path22,next.length>0?`${next.join(`
|
|
758
759
|
`)}
|
|
759
760
|
`:"",{mode:384})}function findFileHandler(fileName,homeDir2){for(let entry of loadPluginRegistry(homeDir2).plugins){if(!entry.enabled)continue;let manifest;try{manifest=readPluginManifest(entry.root).manifest}catch{continue}for(let handler of manifest.fileHandlers)try{if(new RegExp(handler.pattern,"i").test(fileName))return{qualifiedAction:qualifiedActionId(entry.id,handler.action)}}catch{}}return null}var init_settings_env=__esm(()=>{init_manifest();init_plugin_paths();init_registry2()});import{closeSync as closeSync4,openSync as openSync4,readFileSync as readFileSync33,readSync,statSync as statSync13}from"fs";function parseLastRun(logText){if(!logText)return null;let lines=logText.trimEnd().split(`
|
|
760
|
-
`);for(let i2=lines.length-1;i2>=0;i2--){let line=lines[i2]?.trim();if(!line)continue;let record;try{record=JSON.parse(line)}catch{continue}if(typeof record.at!=="number")continue;let exitCode=typeof record.exitCode==="number"?record.exitCode:null,spawnError=typeof record.spawnError==="string"?record.spawnError:void 0;return{at:record.at,label:typeof record.label==="string"?record.label:typeof record.kind==="string"?record.kind:"run",exitCode,ok:spawnError===void 0&&exitCode===0,...spawnError?{spawnError}:{}}}return null}function pluginRowView(outdated,entry,manifestText,logText,settingValues={}){let declares=null,settings=[],platformOk=!0,hooksDeclared=!1;if(manifestText!==null)try{let{manifest}=parsePluginManifest(manifestText);declares={actions:manifest.actions.length,events:manifest.events.length,panes:manifest.panes.length,engines:manifest.engines.length},hooksDeclared=manifest.actions.length+manifest.events.length+manifest.startup.length>0,platformOk=supportsPlatform({},manifest,currentPluginPlatform()),settings=pluginSettingRows(manifest.settings,settingValues)}catch{declares=null}return{id:entry.id,version:entry.version,enabled:entry.enabled,linked:entry.source.kind==="link",source:entry.source.kind==="link"?entry.root:entry.source.spec,declares,platformOk,hooksDeclared,lastRun:parseLastRun(logText),settings,updateAvailable:outdated.has(entry.id)}}function readTail(path22){let fd;try{let size=statSync13(path22).size,length=Math.min(size,LOG_TAIL_BYTES),buf=Buffer.alloc(length);return fd=openSync4(path22,"r"),readSync(fd,buf,0,length,size-length),buf.toString("utf8")}catch{return null}finally{if(fd!==void 0)closeSync4(fd)}}function readTextOrNull(path22){if(!path22)return null;try{return readFileSync33(path22,"utf8")}catch{return null}}function readPluginRows(homeDir2){let outdated=new Set(readOutdatedCache(homeDir2));return loadPluginRegistry(homeDir2).plugins.map((entry)=>pluginRowView(outdated,entry,readTextOrNull(pluginManifestPath(entry.root)),readTail(pluginLogPath(entry.id,homeDir2)),readPluginSettings(entry.id,homeDir2)))}function setPluginSetting(pluginId,key,value,homeDir2){writePluginSettings(pluginId,{[key]:value},homeDir2)}function setPluginEnabled(id,enabled,homeDir2){let registry=loadPluginRegistry(homeDir2);savePluginRegistry({plugins:registry.plugins.map((p3)=>p3.id===id?{...p3,enabled}:p3)},homeDir2),reloadPluginEngines(homeDir2)}var LOG_TAIL_BYTES=65536;var init_plugins_core=__esm(()=>{init_manifest();init_outdated_cache();init_plugin_paths();init_registry2();init_settings_env();init_plugin_engines()});function useAccountProbes(section,vendors){let[statuses,setStatuses]=import_react87.useState(null),key=vendors.join(",");return import_react87.useEffect(()=>{if(section!=="engines")return;let cancelled=!1;return detectEngineStatuses(key?key.split(","):[]).then((s2)=>{if(!cancelled)setStatuses(s2)}),()=>{cancelled=!0}},[section,key]),statuses}function usePluginSettings(section,dialog){let[rows,setRows]=import_react87.useState([]),t3=useT();import_react87.useEffect(()=>{if(section!=="plugins")return;setRows(readPluginRows())},[section]);function store2(pluginId,key,value){try{setPluginSetting(pluginId,key,value)}catch{}setRows(readPluginRows())}return{rows,toggle:(id)=>{let row=rows.find((p3)=>p3.id===id);if(!row)return;try{setPluginEnabled(id,!row.enabled)}catch{}setRows(readPluginRows())},editSetting:async(pluginId,key)=>{let setting=rows.find((p3)=>p3.id===pluginId)?.settings.find((s2)=>s2.key===key);if(!setting)return;if(setting.type==="enum"){store2(pluginId,key,nextEnumValue(setting.options,setting.value));return}if(setting.type==="boolean"){store2(pluginId,key,toggledBooleanValue(setting));return}let initial=setting.type==="secret"?"":setting.value,next=await RenameTaskDialog.show(dialog,initial,{dialogTitle:setting.label,fieldLabel:key,submitLabel:"save",allowEmpty:!0,placeholder:setting.type==="secret"&&setting.value!==""?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":setting.defaultValue});if(next===void 0)return;if(setting.type!=="number"){store2(pluginId,key,next.trim());return}let numeric=normalizeNumberInput(next);if(numeric===null){await DialogConfirm.show(dialog,t3("settings.plugins.settingInvalidTitle"),t3("settings.plugins.settingInvalidBody",{label:setting.label}),"cancel");return}store2(pluginId,key,numeric)}}}var import_react87;var init_use_section_data=__esm(async()=>{init_engine_status();init_i18n2();init_plugins_core();await __promiseAll([init_dialog_confirm(),init_rename_task_dialog()]);import_react87=__toESM(require_react_production(),1)});function resolveTabStripMode(stored,legacyHideSingle){if(typeof stored==="string"&&TAB_STRIP_MODES.includes(stored))return stored;if(legacyHideSingle===!0)return"multipleOnly";if(legacyHideSingle===!1)return"always";return"never"}function tabStripVisible(mode,tabCount){if(mode==="never")return!1;if(mode==="multipleOnly")return tabCount>=2;return!0}var TAB_STRIP_MODE_KEY="chat.tabStrip.mode",TAB_STRIP_MODES,TAB_STRIP_HIDE_SINGLE_KEY="chat.tabStrip.hideSingle";var init_tab_strip=__esm(()=>{TAB_STRIP_MODES=["always","multipleOnly","never"]});var ZEN_KEEP_TASKS_KEY="zen.keepTasks",ZEN_ACTIVE_KEY="zen.active";import{accessSync as accessSync2,constants as fsConstants2,mkdirSync as mkdirSync21}from"fs";function useSettingsPrefs(kv,dialog,onComposerGateDisabled){let t3=useT();function toastEnabled(){return kv.get("notifications.toast.enabled",!0)!==!1}function soundEnabled(){return kv.get("notifications.sound.enabled",!0)!==!1}function toggleToast(){kv.set("notifications.toast.enabled",!toastEnabled())}function toggleSound(){kv.set("notifications.sound.enabled",!soundEnabled())}function crossTaskEnabled(){return kv.get("notifications.crossTask.enabled",!0)!==!1}function toggleCrossTask(){kv.set("notifications.crossTask.enabled",!crossTaskEnabled())}function prefixTapPresentation(){return normalizePrefixTapPresentation(kv.get(PREFIX_TAP_PRESENTATION_KEY))}function selectPrefixTapPresentation(next){kv.set(PREFIX_TAP_PRESENTATION_KEY,next)}function splitStyle(){return normalizeSplitStyle(kv.get(SPLIT_STYLE_KEY))}function selectSplitStyle(style){kv.set(SPLIT_STYLE_KEY,style)}function zenDefaultOn(){return kv.get(ZEN_ACTIVE_KEY,!1)===!0}function toggleZenDefaultOn(){kv.set(ZEN_ACTIVE_KEY,!zenDefaultOn())}function zenKeepsTasks(){return kv.get(ZEN_KEEP_TASKS_KEY,!0)!==!1}function toggleZenKeepsTasks(){kv.set(ZEN_KEEP_TASKS_KEY,!zenKeepsTasks())}function tabStripMode(){return resolveTabStripMode(kv.get(TAB_STRIP_MODE_KEY,void 0),kv.get(TAB_STRIP_HIDE_SINGLE_KEY,void 0))}function cycleTabStripMode(){let next=TAB_STRIP_MODES[(TAB_STRIP_MODES.indexOf(tabStripMode())+1)%TAB_STRIP_MODES.length];kv.set(TAB_STRIP_MODE_KEY,next)}function remoteProjectsEnabled(){return kv.get("experimental.remoteProjects",!1)===!0}function toggleRemoteProjects(){kv.set("experimental.remoteProjects",!remoteProjectsEnabled())}function autoStatusOn(){return kv.get(AUTO_STATUS_KEY,!1)===!0}function toggleAutoStatus(){kv.set(AUTO_STATUS_KEY,!autoStatusOn())}function dispatcherOn(){return kv.get(DISPATCHER_KEY,!1)===!0}function toggleDispatcher(){kv.set(DISPATCHER_KEY,!dispatcherOn())}function composerGateOn(){return composerGatePreferenceOn(kv)}function toggleComposerGate(){if(toggleComposerGatePreference(kv,onComposerGateDisabled)==="persist-failed")logClientError("settings","could not persist the disabled composer delivery check; deferred prompts were not flushed")}function editorKind(){return normalizeEditorKind(kv.get(EDITOR_KIND_KEY,DEFAULT_EDITOR_KIND))}function cycleEditorKind(){let i2=EDITOR_KINDS.indexOf(editorKind()),next=EDITOR_KINDS[(i2+1)%EDITOR_KINDS.length];if(next)kv.set(EDITOR_KIND_KEY,next)}function editorCustomCommand(){let v3=kv.get(EDITOR_CUSTOM_KEY,"");return typeof v3==="string"?v3:""}async function editEditorCustom(){let next=await RenameTaskDialog.show(dialog,editorCustomCommand(),{dialogTitle:"Custom editor command (use {file} for the path)",fieldLabel:"COMMAND",submitLabel:"save",allowEmpty:!0});if(next===void 0)return;let cmd=next.trim();if(kv.set(EDITOR_CUSTOM_KEY,cmd),cmd)kv.set(EDITOR_KIND_KEY,"custom")}function scrollbackRows(){return normalizeScrollbackRows(kv.get(SCROLLBACK_ROWS_KEY,DEFAULT_SCROLLBACK_ROWS))}async function editScrollbackRows(){let next=await RenameTaskDialog.show(dialog,String(scrollbackRows()),{dialogTitle:t3("settings.general.scrollbackTitle"),fieldLabel:t3("settings.general.scrollbackField"),submitLabel:"save",placeholder:String(DEFAULT_SCROLLBACK_ROWS)});if(next===void 0)return;let n2=Number.parseInt(next.trim(),10);if(!Number.isFinite(n2)){await DialogConfirm.show(dialog,t3("settings.general.scrollbackInvalidTitle"),t3("settings.general.scrollbackInvalidBody"),"cancel");return}kv.set(SCROLLBACK_ROWS_KEY,normalizeScrollbackRows(n2))}function worktreeBasePath(){let v3=kv.get(WORKTREE_BASE_KEY,"");return typeof v3==="string"?v3:""}let worktreeKind=()=>worktreeBaseKindOf(worktreeBasePath());function worktreeKindLabel(){let kind=worktreeKind();if(kind==="default")return t3("settings.general.worktreeKindDefault");if(kind==="nextToProject")return t3("settings.general.worktreeKindNext");return t3("settings.general.worktreeKindCustom")}function worktreeCustomPath(){let v3=kv.get(WORKTREE_BASE_CUSTOM_KEY,"");return(typeof v3==="string"?v3.trim():"")||(worktreeKind()==="custom"?worktreeBasePath().trim():"")}function cycleWorktreeBase(){let kind=worktreeKind();if(kind==="default")kv.set(WORKTREE_BASE_KEY,PROJECT_SIBLING_BASE);else if(kind==="nextToProject")kv.set(WORKTREE_BASE_KEY,worktreeCustomPath());else kv.set(WORKTREE_BASE_CUSTOM_KEY,worktreeBasePath().trim()),kv.set(WORKTREE_BASE_KEY,"")}async function editWorktreeCustom(){let next=await RenameTaskDialog.show(dialog,worktreeCustomPath(),{dialogTitle:t3("settings.general.worktreeBaseTitle"),fieldLabel:t3("settings.general.worktreeBaseField"),submitLabel:"save",placeholder:`${PROJECT_DIR_TOKEN}/../worktrees`,allowEmpty:!0});if(next===void 0)return;let raw=next.trim();if(raw.includes(PROJECT_DIR_TOKEN)){if(!hasProjectDirToken(raw)){await DialogConfirm.show(dialog,"Can't use that worktree location",`${PROJECT_DIR_TOKEN} only expands as the leading path segment (e.g. ${PROJECT_DIR_TOKEN}/../kobe-worktrees). Keeping the previous setting.`,"cancel");return}}else if(raw){let resolved=normalizeWorktreeBase(raw)??raw;try{mkdirSync21(resolved,{recursive:!0}),accessSync2(resolved,fsConstants2.W_OK)}catch(err){await DialogConfirm.show(dialog,"Can't use that worktree location",`${resolved} isn't usable (${errorMessage(err)}). Keeping the previous setting \u2014 pick a writable directory.`,"cancel");return}}if(kv.set(WORKTREE_BASE_CUSTOM_KEY,raw),raw)kv.set(WORKTREE_BASE_KEY,raw);else if(worktreeKind()==="custom")kv.set(WORKTREE_BASE_KEY,"")}return{toastEnabled,toggleToast,soundEnabled,toggleSound,crossTaskEnabled,toggleCrossTask,prefixTapPresentation,selectPrefixTapPresentation,splitStyle,selectSplitStyle,zenDefaultOn,toggleZenDefaultOn,zenKeepsTasks,toggleZenKeepsTasks,remoteProjectsEnabled,toggleRemoteProjects,autoStatusOn,toggleAutoStatus,dispatcherOn,toggleDispatcher,composerGateOn,toggleComposerGate,editorKind,cycleEditorKind,editorCustomCommand,editEditorCustom,scrollbackRows,editScrollbackRows,tabStripMode,cycleTabStripMode,worktreeKind,worktreeKindLabel,worktreeCustomPath,cycleWorktreeBase,editWorktreeCustom}}var init_use_settings_prefs=__esm(async()=>{init_client_log();init_auto_status();init_composer_gate();init_dispatcher();init_scrollback();init_split_style();init_tab_strip();init_worktree_base();init_editor_prefs();init_prefix_tap_presentation();init_i18n2();await __promiseAll([init_dialog_confirm(),init_rename_task_dialog()])});import{TextAttributes as TextAttributes26}from"@opentui/core";function SettingsDialog(props){let dialog=useDialog(),themeCtx=useTheme(),renderer=useRenderer(),{theme}=themeCtx,t3=useT(),padX=useDialogPaddingX(),[level,setLevel]=import_react89.useState("sidebar"),[section,setSection]=import_react89.useState("general"),[cursor,setCursor]=import_react89.useState(0),[bodyRow,setBodyRow]=import_react89.useState(0),[feedbackTitle,setFeedbackTitle]=import_react89.useState(""),[feedbackBody,setFeedbackBody]=import_react89.useState(""),[feedbackStatus,setFeedbackStatus]=import_react89.useState(""),themeNames=import_react89.useMemo(()=>themeCtx.all().slice().sort(),[themeCtx]),hasDaemon=hasRestartableDaemon(props.orchestrator),remote=props.orchestrator instanceof RemoteOrchestrator?props.orchestrator:null,prefs=useSettingsPrefs(props.kv,dialog,()=>{if(remote)flushDeferredPromptsWithFeedback(remote,dialog)}),engines=useEngineSettings(props.kv,dialog,(max)=>setBodyRow((r6)=>Math.max(0,Math.min(r6,max)))),usage=useAccessor(remote?remote.usageSnapshotSignal():EMPTY_USAGE_SIGNAL),engineStatuses=useAccountProbes(section,engines.engineList()),[keysFileExists,setKeysFileExists]=import_react89.useState(()=>userKeybindingsReport().exists);function createKeysFile(){try{createKeybindingsFile(userKeybindingsReport().path),reloadUserKeybindings()}catch{}setKeysFileExists(userKeybindingsReport().exists)}let plugins=usePluginSettings(section,dialog);function bodyRows(){return sectionRows(section,{themeNames,focusAccentSlots:FOCUS_ACCENT_SLOTS,engineList:engines.engineList(),plugins:plugins.rows.map((p3)=>({id:p3.id,settingKeys:p3.settings.map((s2)=>s2.key)})),hasDaemon,keybindingsFileExists:keysFileExists})}function bodyRowCount(){return bodyRows().length}function selectTheme(name){if(themeCtx.selected===name)return;if(!themeCtx.set(name))return;props.kv.set("activeTheme",name)}function selectLanguage(locale){if(currentLang()===locale)return;setLocaleLang(locale),props.kv.set(LOCALE_KEY,locale)}function toggleTransparent(){let next=!themeCtx.transparentBackground;themeCtx.setTransparentBackground(next),props.kv.set("transparentBackground",next)}function selectFocusAccent(slot){if(themeCtx.focusAccent===slot)return;themeCtx.setFocusAccent(slot),props.kv.set("focusAccent",slot)}function currentEngineRow(){if(section!=="engines"||level!=="body")return null;let row=rowAt(bodyRows(),bodyRow);return row?.kind==="engine"?row.vendor:null}async function sendFeedback(){setFeedbackStatus("submitting...");try{let result=submitFeedback({title:feedbackTitle,body:feedbackBody});setFeedbackStatus(`sent: ${result.url}`),setFeedbackTitle(""),setFeedbackBody(""),setBodyRow(0)}catch(err){setFeedbackStatus(`error: ${errorMessage(err)}`)}}let editingFeedback=section==="feedback"&&level==="body";function feedbackFieldStep(delta){let next=bodyRow+delta;if(next<0||next>2){setLevel("sidebar");return}setBodyRow(next)}function enterBody(){if(level!=="sidebar"||bodyRowCount()===0)return;setLevel("body"),setBodyRow(0)}function moveCursor(delta){if(level==="sidebar"){let next=(cursor+delta+SECTIONS.length)%SECTIONS.length;setCursor(next);let nextSection=SECTIONS[next];if(nextSection)setSection(nextSection.id),setBodyRow(0);return}let len=bodyRowCount();if(len===0)return;setBodyRow((bodyRow+delta+len)%len)}function switchSection(id){setSection(id),setCursor(SECTIONS.findIndex((s2)=>s2.id===id)),setBodyRow(0),setLevel("sidebar")}let rowActivators={theme:(row)=>selectTheme(row.name),language:(row)=>selectLanguage(row.locale),transparent:()=>toggleTransparent(),focusAccent:(row)=>selectFocusAccent(row.slot),toast:()=>prefs.toggleToast(),sound:()=>prefs.toggleSound(),crossTask:()=>prefs.toggleCrossTask(),keyHints:()=>toggleKeyHints(props.kv),prefixTapPresentation:(row)=>prefs.selectPrefixTapPresentation(row.presentation),splitStyle:(row)=>prefs.selectSplitStyle(row.style),zenDefaultOn:()=>prefs.toggleZenDefaultOn(),zenKeepTasks:()=>prefs.toggleZenKeepsTasks(),editorKind:()=>prefs.cycleEditorKind(),editorCustom:()=>void prefs.editEditorCustom(),worktreeBase:()=>prefs.cycleWorktreeBase(),worktreeCustom:()=>void prefs.editWorktreeCustom(),scrollbackRows:()=>void prefs.editScrollbackRows(),tabStripHideSingle:()=>prefs.cycleTabStripMode(),engine:(row)=>void engines.editEngine(row.vendor),engineAdd:()=>void engines.addEngineFlow(),keysCreate:()=>createKeysFile(),pluginToggle:(row)=>plugins.toggle(row.pluginId),pluginSetting:(row)=>void plugins.editSetting(row.pluginId,row.key),feedbackTitle:()=>setBodyRow(0),feedbackBody:()=>setBodyRow(1),feedbackSend:()=>void sendFeedback(),devReset:()=>void confirmResetState(dialog,props.kv,renderer),devRestartDaemon:()=>void confirmRestartDaemon(dialog,props.orchestrator,renderer),devRemoteProjects:()=>prefs.toggleRemoteProjects(),devAutoStatus:()=>prefs.toggleAutoStatus(),devDispatcher:()=>prefs.toggleDispatcher(),devComposerGate:()=>prefs.toggleComposerGate()};function activateBodyRow(){let row=rowAt(bodyRows(),bodyRow);if(!row)return;rowActivators[row.kind](row)}useBindings(()=>({enabled:dialog.stack.length===0&&!editingFeedback,bindings:[{key:"down",cmd:()=>moveCursor(1)},{key:"up",cmd:()=>moveCursor(-1)},{key:"j",cmd:()=>moveCursor(1)},{key:"k",cmd:()=>moveCursor(-1)},{key:"tab",cmd:()=>moveCursor(1)},{key:"right",cmd:enterBody},{key:"l",cmd:enterBody},{key:"left",cmd:()=>setLevel("sidebar")},{key:"h",cmd:()=>setLevel("sidebar")},{key:"return",cmd:()=>{if(level==="sidebar"){enterBody();return}activateBodyRow()}},{key:"r",cmd:()=>{let v3=currentEngineRow();if(v3)engines.renameEngine(v3)}},{key:"x",cmd:()=>{let v3=currentEngineRow();if(v3)engines.resetEngine(v3)}},{key:"d",cmd:()=>{let v3=currentEngineRow();if(v3)engines.chooseDefaultEngine(v3)}},{key:"space",cmd:()=>{let v3=currentEngineRow();if(v3)engines.toggleEngineEnabled(v3)}}]})),useBindings(()=>({enabled:editingFeedback,bindings:[{key:"tab",cmd:()=>feedbackFieldStep(1)},{key:"shift+tab",cmd:()=>feedbackFieldStep(-1)}]})),useBindings(()=>({enabled:editingFeedback&&bodyRow===2,bindings:[{key:"return",cmd:()=>void sendFeedback()}]}));let scrollRef=import_react89.useRef(null),reportCursorEl=import_react89.useCallback((el)=>{let scroll=scrollRef.current;if(!scroll||!el||scroll.viewport.height<=0)return;scroll.scrollChildIntoView(el.id)},[]),cursorProps={level,bodyRow,setLevel,setBodyRow},navHint=$jsx("box",{paddingTop:0,children:$jsx("text",{fg:theme.textMuted,children:editingFeedback?t3("settings.nav.feedback"):t3("settings.nav.default")})}),body=$jsxs("box",{paddingLeft:padX,paddingRight:padX,paddingBottom:1,gap:1,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",children:[$jsx("text",{attributes:TextAttributes26.BOLD,fg:theme.text,children:t3("settings.title")}),$jsx("text",{fg:theme.textMuted,onMouseUp:()=>props.onClose(),children:t3("settings.esc")})]}),$jsxs("box",{flexDirection:"row",gap:2,children:[$jsx(SettingsSectionSidebar,{level,cursor,switchSection}),$jsxs("box",{flexGrow:1,flexShrink:1,flexDirection:"column",gap:1,children:[section==="general"?$jsx(GeneralSettingsSection,{...cursorProps,prefs,themeNames,selectTheme,currentLocale:currentLang(),selectLanguage,toggleTransparent,selectFocusAccent,usage}):null,section==="engines"?$jsx(EngineSettingsSection,{...cursorProps,vendors:engines.engineList(),statuses:engineStatuses,isCustom:engines.isCustomEngine,isEnabled:engines.isEngineEnabled,toggleEngine:engines.toggleEngineEnabled,chooseDefault:engines.chooseDefaultEngine,displayName:engines.engineName,commandText:engines.engineCommandText,isDefault:engines.engineIsDefault,isDefaultEngine:(v3)=>engines.defaultEngine===v3,editEngine:(v3)=>void engines.editEngine(v3),onAddEngine:()=>void engines.addEngineFlow()}):null,section==="plugins"?$jsx(PluginSettingsSection,{...cursorProps,plugins:plugins.rows,toggle:plugins.toggle,editSetting:(id,key)=>void plugins.editSetting(id,key)}):null,section==="keys"?$jsx(KeybindingsSettingsSection,{...cursorProps,prefs,onCreateFile:createKeysFile}):null,section==="feedback"?$jsx(FeedbackSettingsSection,{...cursorProps,title:feedbackTitle,setTitle:(v3)=>{setFeedbackTitle(v3),setFeedbackStatus("")},body:feedbackBody,setBody:(v3)=>{setFeedbackBody(v3),setFeedbackStatus("")},status:feedbackStatus,onTitleSubmit:()=>setBodyRow(1),submit:()=>void sendFeedback()}):null,section==="dev"?$jsx(DevSettingsSection,{...cursorProps,prefs,hasDaemon,confirmReset:()=>void confirmResetState(dialog,props.kv,renderer),confirmRestartDaemon:()=>void confirmRestartDaemon(dialog,props.orchestrator,renderer)}):null]})]})]});return $jsx(SettingsCursorElContext.Provider,{value:reportCursorEl,children:$jsxs("box",{flexDirection:"column",flexGrow:1,children:[$jsx("scrollbox",{ref:(r6)=>{scrollRef.current=r6},flexGrow:1,flexShrink:1,flexBasis:0,verticalScrollbarOptions:{trackOptions:{foregroundColor:"transparent"}},children:body}),$jsx("box",{paddingLeft:padX,paddingRight:padX,children:navHint})]})})}var import_react89,EMPTY_USAGE_SIGNAL;var init_settings_dialog=__esm(async()=>{init_remote_orchestrator();init_external_store();init_feedback();init_model();init_keybindings_user();init_keybindings_starter();init_keyboard_hints();init_persisted_ui_prefs();init_i18n2();init_use_accessor();init_jsx_runtime();await __promiseAll([init_react(),init_theme(),init_keymap(),init_dialog(),init_actions(),init_deferred_flush_feedback(),init_rows2(),init_sections_engines(),init_sections_general(),init_sections_misc(),init_sections_plugins(),init_use_engine_settings(),init_use_section_data(),init_use_settings_prefs()]);import_react89=__toESM(require_react_production(),1),EMPTY_USAGE_SIGNAL=createStateCell(null)});import{TextAttributes as TextAttributes27}from"@opentui/core";function reposOf(orch){if(!orch)return[];let seen=[];for(let task of orch.listTasks())if(task.repo&&!seen.includes(task.repo))seen.push(task.repo);return seen}function linkedTaskFor(orch,repo,number){return orch?.listTasks().find((task)=>task.repo===repo&&task.linkedWorkItem?.number===number)}function errorHint(error,t3){let colon=error.indexOf(": ");switch(colon>=0?error.slice(0,colon):"failed"){case"no-remote":return t3("workItems.errorHint.noRemote");case"gh-missing":return t3("workItems.errorHint.ghMissing");case"auth":return t3("workItems.errorHint.auth");default:return t3("workItems.errorHint.fallback",{message:error})}}function relativeAge(iso,now){let at2=Date.parse(iso);if(!Number.isFinite(at2))return"";let mins=Math.round((now-at2)/60000);if(mins<60)return`${Math.max(mins,0)}m`;let hours=Math.round(mins/60);if(hours<24)return`${hours}h`;return`${Math.round(hours/24)}d`}function WorkItemsPage(props){let{theme}=useTheme(),t3=useT(),notif=useNotifications();function notifyError(message){notif.notify({kind:"error",taskId:"",tabId:"",title:message})}let repos=reposOf(props.orchestrator),[repoIndex,setRepoIndex]=import_react90.useState(()=>{let wanted=props.focusRepo?repos.indexOf(props.focusRepo):-1;return wanted>=0?wanted:0}),repo=repos[repoIndex],[items,setItems]=import_react90.useState(null),[error,setError]=import_react90.useState(null),[reloadTick,setReloadTick]=import_react90.useState(0),[assignedToMe,setAssignedToMe]=import_react90.useState(!1),[starting,setStarting]=import_react90.useState(!1),[notice,setNotice]=import_react90.useState(null);import_react90.useEffect(()=>{let disposed=!1,orch=props.orchestrator;if(!orch||!repo){setItems([]);return}return setError(null),orch.listWorkItems({repo,limit:30,...assignedToMe?{assignee:"@me"}:{},...reloadTick>0?{refresh:!0}:{}}).then((result)=>{if(!disposed)setItems(result.items)}).catch((err)=>{if(disposed)return;setError(err instanceof Error?err.message:String(err)),setItems([])}),()=>{disposed=!0}},[props.orchestrator,repo,assignedToMe,reloadTick]);let rows=items??[],[cursor,setCursor]=import_react90.useState(0);import_react90.useEffect(()=>{setCursor((c2)=>clampCursor(c2,rows.length))},[rows.length]);let follow=useCursorFollow(cursor);import_react90.useEffect(()=>{setNotice(null)},[repo,assignedToMe]);async function startSelected(){let orch=props.orchestrator,item=rows[cursor];if(!orch||!item||!repo||starting)return;let linked=linkedTaskFor(orch,repo,item.number);if(linked){setNotice(t3("workItems.openingLinked",{title:linked.title})),props.onOpenTask?.(linked.id);return}setStarting(!0),setNotice(t3("workItems.starting",{number:item.number}));try{let result=await orch.startWorkItem({repo,number:item.number});if(result.started)props.onOpenTask?.(result.taskId);else setNotice(t3("workItems.startedNoEngine",{title:result.title}))}catch(err){console.error("[rove work-items] start failed:",err),notifyError(t3("workItems.startFailed",{number:item.number,error:errorMessage(err)}))}finally{setStarting(!1)}}useBindings(()=>({enabled:props.focused!==!1,bindings:[...pageCloseBindings(props.onClose),{key:"j",cmd:()=>setCursor((c2)=>clampCursor(c2+1,rows.length))},{key:"down",cmd:()=>setCursor((c2)=>clampCursor(c2+1,rows.length))},{key:"k",cmd:()=>setCursor((c2)=>clampCursor(c2-1,rows.length))},{key:"up",cmd:()=>setCursor((c2)=>clampCursor(c2-1,rows.length))},{key:"tab",cmd:()=>setRepoIndex((i2)=>repos.length?(i2+1)%repos.length:0)},{key:"a",cmd:()=>setAssignedToMe((on)=>!on)},{key:"r",cmd:()=>setReloadTick((tick)=>tick+1)},{key:"return",cmd:()=>void startSelected()}]}));let now=Date.now();return $jsxs("box",{flexDirection:"column",flexGrow:1,paddingTop:1,paddingBottom:1,paddingLeft:2,paddingRight:2,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",children:[$jsx("text",{attributes:TextAttributes27.BOLD,fg:theme.text,children:t3("workItems.title")}),$jsxs("text",{fg:theme.textMuted,children:[repo?sidebarProjectLabel(repo,repos):t3("workItems.noRepo"),assignedToMe?` ${t3("workItems.assignedFilter")}`:""]})]}),error?$jsxs("box",{flexDirection:"column",marginTop:1,children:[$jsx("text",{fg:theme.error,children:error}),$jsx("box",{marginTop:1,children:$jsx("text",{fg:theme.textMuted,children:errorHint(error,t3)})})]}):items===null?$jsx("text",{fg:theme.textMuted,children:t3("common.loading")}):rows.length===0?$jsx("text",{fg:theme.textMuted,children:t3("workItems.empty")}):$jsx("scrollbox",{ref:follow.scrollRef,flexGrow:1,flexShrink:1,flexBasis:0,marginTop:1,verticalScrollbarOptions:{trackOptions:{foregroundColor:"transparent"}},children:rows.map((item,index)=>{let chrome=resolveRowSelectionChrome(theme,{cursor:index===cursor,selected:!1}),linked=linkedTaskFor(props.orchestrator,repo,item.number);return $jsxs("box",{ref:follow.rowRef(index),flexDirection:"column",flexShrink:0,...chrome.backgroundColor?{backgroundColor:chrome.backgroundColor}:{},children:[$jsxs("box",{flexDirection:"row",gap:0,children:[$jsx("text",{fg:chrome.markerColor,wrapMode:"none",children:chrome.marker}),$jsxs("box",{flexDirection:"row",flexGrow:1,paddingLeft:1,paddingRight:1,gap:1,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:`#${item.number}`}),$jsx("text",{fg:theme.text,attributes:index===cursor?TextAttributes27.BOLD:void 0,wrapMode:"none",flexGrow:1,children:item.title})]})]}),$jsxs("box",{flexDirection:"row",gap:0,children:[$jsx("text",{fg:chrome.markerColor,wrapMode:"none",children:chrome.marker}),$jsxs("box",{flexDirection:"row",flexGrow:1,paddingLeft:2,paddingRight:1,gap:1,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",flexGrow:1,children:[item.author,...item.labels.slice(0,2)].filter(Boolean).join(" \xB7 ")}),linked?$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("workItems.linkedChip",{title:linked.title})}):null,$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:relativeAge(item.updatedAt,now)})]})]})]},`${item.number}`)})}),notice?$jsx("text",{fg:theme.textMuted,flexShrink:0,children:notice}):null]})}var import_react90;var init_work_items_page=__esm(async()=>{init_state();init_groups();init_notifications();init_i18n2();init_use_cursor_follow();init_jsx_runtime();await __promiseAll([init_theme(),init_keymap()]);import_react90=__toESM(require_react_production(),1)});async function landTaskAction(deps,taskId,branchLabel){let{t:t3}=deps;if(!await deps.confirm(branchLabel))return!1;try{let res=await deps.orchestrator.landTask(taskId,{callerCwd:deps.callerCwd});deps.notifyInfo(t3("worktrees.land.done",{branch:res.branch,landedOn:res.landedOn,commit:res.commit}));let cleanup=res.worktree;if(cleanup&&!cleanup.removed)deps.notifyNeedsInput(t3("worktrees.land.worktreeKept",{reason:cleanup.reason??"refused"}));else if(cleanup?.reason)deps.notifyNeedsInput(t3("worktrees.land.worktreePathStale",{reason:cleanup.reason}));if(cleanup?.residue)deps.notifyNeedsInput(t3("worktrees.land.worktreeResidue",{path:cleanup.residue.path,reason:cleanup.residue.reason}));return!0}catch(err){let msg=err instanceof Error?err.message:String(err);if(LAND_CONFLICT_RE.test(msg))deps.notifyNeedsInput(t3("worktrees.land.conflict",{files:msg}));else if(MAIN_DIRTY_RE.test(msg))deps.notifyNeedsInput(t3("worktrees.land.dirtyBase"));else deps.notifyError(t3("worktrees.land.failed",{error:msg}));return console.error("[rove land] failed:",err),!1}}var LAND_CONFLICT_RE,MAIN_DIRTY_RE;var init_land_task_action=__esm(()=>{LAND_CONFLICT_RE=/LAND_CONFLICT/,MAIN_DIRTY_RE=/MAIN_CHECKOUT_DIRTY/});import{TextAttributes as TextAttributes28}from"@opentui/core";function flattenRows(projects){return projects.flatMap((p3)=>p3.worktrees)}function taskIdForPath(orch,wtPath){let norm=(p3)=>p3.replace(/^\/private\//,"/").replace(/\/+$/,""),target=norm(wtPath);return orch.listTasks().find((task)=>task.worktreePath&&norm(task.worktreePath)===target)?.id}function WorktreesPage(props){let{theme}=useTheme(),dialog=useDialog(),t3=useT(),notif=useNotifications();function notifyError(message){notif.notify({kind:"error",taskId:"",tabId:"",title:message})}function notifyNeedsInput(message){notif.notify({kind:"needs_input",taskId:"",tabId:"",title:message})}function notifyInfo(message){notif.notify({kind:"done",taskId:"",tabId:"",title:message})}let[projects,setProjects]=import_react91.useState(null),[reloadTick,setReloadTick]=import_react91.useState(0),refetch=()=>setReloadTick((tick)=>tick+1);import_react91.useEffect(()=>{let disposed=!1,fullLanded=!1,orch=props.orchestrator;if(!orch){setProjects([]);return}return orch.listWorktrees({network:!1}).then((rows)=>{if(!disposed&&!fullLanded)setProjects(rows)}).catch(()=>{}),orch.listWorktrees().then((rows)=>{if(fullLanded=!0,disposed)return;setProjects(rows);let live=new Set(flattenRows(rows).map((r6)=>r6.path));setRemovingPaths((paths)=>paths.filter((p3)=>live.has(p3)))}).catch(()=>{}),()=>{disposed=!0}},[props.orchestrator,reloadTick]);let[removingPaths,setRemovingPaths]=import_react91.useState([]),visibleProjects=(projects??[]).map((p3)=>({...p3,worktrees:p3.worktrees.filter((w4)=>!removingPaths.includes(w4.path))})),flatRows=flattenRows(visibleProjects),[cursor,setCursor]=import_react91.useState(0);import_react91.useEffect(()=>{setCursor((c2)=>clampCursor(c2,flatRows.length))},[flatRows.length]);let follow=useCursorFollow(cursor),[busyPath,setBusyPath]=import_react91.useState(null);async function deleteInBackground(row,force){let orch=props.orchestrator;if(!orch)return;setRemovingPaths((paths)=>[...paths,row.path]);try{let residue=await orch.removeWorktree(row.path,force);if(residue)notifyNeedsInput(t3("worktrees.delete.residue",{path:residue.path,reason:residue.reason}));refetch()}catch(err){if(setRemovingPaths((paths)=>paths.filter((p3)=>p3!==row.path)),!force&&err instanceof Error&&DIRTY_REFUSAL_RE.test(err.message)){if(await DialogConfirm.show(dialog,t3("worktrees.delete.forceTitle"),t3("worktrees.delete.forceBody",{branch:row.branch||row.path}),t3("common.cancel"),t3("worktrees.delete.button"),{danger:!0})===!0)await deleteInBackground(row,!0);return}notifyError(t3("worktrees.delete.failed",{error:String(err)})),console.error("[rove worktrees] delete failed:",err)}}async function requestDelete(row){if(!props.orchestrator||busyPath||removingPaths.includes(row.path))return;if(await DialogConfirm.show(dialog,t3("worktrees.delete.confirmTitle"),t3("worktrees.delete.confirmBody",{branch:row.branch||row.path}),t3("common.cancel"),t3("worktrees.delete.button"),{danger:!0})!==!0)return;deleteInBackground(row,!1)}async function requestLand(row){let orch=props.orchestrator;if(!orch||busyPath)return;let taskId=taskIdForPath(orch,row.path);if(!taskId){notifyError(t3("worktrees.land.noTask")),console.error("[rove worktrees] land refused: no tracked task for",row.path);return}setBusyPath(row.path);try{await landTaskAction({orchestrator:orch,confirm:(branch)=>DialogConfirm.show(dialog,t3("worktrees.land.confirmTitle"),t3("worktrees.land.confirmBody",{branch}),t3("common.cancel"),t3("worktrees.land.button")).then((ok)=>ok===!0),notifyInfo,notifyNeedsInput,notifyError,t:t3,callerCwd:process.cwd()},taskId,row.branch||row.path),refetch()}finally{setBusyPath(null)}}useBindings(()=>({enabled:dialog.stack.length===0,bindings:[...pageCloseBindings(props.onClose),{key:"up",cmd:()=>setCursor((c2)=>clampCursor(c2-1,flatRows.length))},{key:"k",cmd:()=>setCursor((c2)=>clampCursor(c2-1,flatRows.length))},{key:"down",cmd:()=>setCursor((c2)=>clampCursor(c2+1,flatRows.length))},{key:"j",cmd:()=>setCursor((c2)=>clampCursor(c2+1,flatRows.length))},{key:"d",cmd:()=>{let row=flatRows[cursor];if(row)requestDelete(row)}},{key:"l",cmd:()=>{let row=flatRows[cursor];if(row)requestLand(row)}}]}));function remoteBadge(status){if(status===!0)return $jsxs("text",{fg:theme.success,children:[" ",t3("worktrees.badge.remoteOn")]});if(status===!1)return $jsxs("text",{fg:theme.warning,children:[" ",t3("worktrees.badge.remoteOff")]});return $jsxs("text",{fg:theme.textMuted,children:[" ",t3("worktrees.badge.remoteUnknown")]})}function verdictBadge(row){if(row.verdictReason==="dirty"||row.verdictReason==="fresh")return null;let fg=row.verdict==="merged"?theme.success:row.verdict==="stale"?theme.warning:theme.accent;return $jsxs("text",{fg,children:[" ",t3(`worktrees.verdict.${row.verdictReason}`)]})}let loading=projects===null,rowBase=0;return $jsxs("scrollbox",{ref:follow.scrollRef,flexGrow:1,backgroundColor:theme.background,paddingTop:1,paddingLeft:2,paddingRight:2,paddingBottom:1,verticalScrollbarOptions:{trackOptions:{foregroundColor:"transparent"}},children:[$jsx("box",{flexDirection:"row",justifyContent:"space-between",children:$jsx("text",{attributes:TextAttributes28.BOLD,fg:theme.text,children:t3("worktrees.title")})}),loading?$jsx("text",{fg:theme.textMuted,children:t3("worktrees.loading")}):visibleProjects.length===0?$jsx("text",{fg:theme.textMuted,children:t3("worktrees.noProjects")}):visibleProjects.map((project)=>{let base=rowBase;return rowBase+=project.worktrees.length,$jsxs("box",{gap:0,paddingTop:1,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:project.repo}),project.worktrees.length===0?$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("worktrees.noWorktrees")}):project.worktrees.map((row,i2)=>{let absoluteIndex=base+i2,isCursor=absoluteIndex===cursor;return $jsxs("box",{ref:follow.rowRef(absoluteIndex),gap:0,onMouseUp:()=>setCursor(absoluteIndex),children:[$jsxs("box",{flexDirection:"row",children:[$jsxs("text",{fg:isCursor?theme.primary:theme.text,attributes:isCursor?TextAttributes28.BOLD:void 0,wrapMode:"none",children:[isCursor?"\u25B8 ":" ",row.branch||t3("worktrees.row.detached")]}),row.kobeManaged?$jsxs("text",{fg:theme.textMuted,children:[" ",t3("worktrees.badge.kobeManaged")]}):null,row.dirty?$jsxs("text",{fg:theme.warning,children:[" ",t3("worktrees.badge.dirty")]}):null,remoteBadge(row.branchOnRemote),verdictBadge(row),busyPath===row.path?$jsx("text",{fg:theme.textMuted,children:" \u2026"}):null]}),$jsxs("box",{flexDirection:"row",justifyContent:"space-between",paddingLeft:2,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:row.path}),row.createdAtMs>0?$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("worktrees.row.created",{age:relativeAgeMs(row.createdAtMs)})}):null]})]},row.path)})]},project.repo)})]})}var import_react91,DIRTY_REFUSAL_RE;var init_worktrees_page=__esm(async()=>{init_state();init_message_core();init_notifications();init_i18n2();init_use_cursor_follow();init_land_task_action();init_jsx_runtime();await __promiseAll([init_theme(),init_keymap(),init_dialog(),init_dialog_confirm()]);import_react91=__toESM(require_react_production(),1);DIRTY_REFUSAL_RE=/refusing to remove dirty worktree/});function useHostPagesState(focus){let[settingsOpen,setSettingsOpen]=import_react92.useState(!1),[worktreesOpen,setWorktreesOpen]=import_react92.useState(!1),[updateOpen,setUpdateOpen]=import_react92.useState(!1),[nav,setNav]=import_react92.useState("terminal"),goToNav=(next)=>{setNav(next),focus.setFocused(focusPaneForNav(next))};return{nav,setNav,goToNav,settingsOpen,openSettings:()=>setSettingsOpen(!0),closeSettings:()=>setSettingsOpen(!1),worktreesOpen,openWorktrees:()=>setWorktreesOpen(!0),closeWorktrees:()=>setWorktreesOpen(!1),updateOpen,openUpdate:()=>setUpdateOpen(!0),closeUpdate:()=>setUpdateOpen(!1),kanbanOpen:nav==="kanban",openKanban:()=>goToNav("kanban"),closeKanban:()=>goToNav("terminal"),automationsOpen:nav==="automations",openAutomations:()=>goToNav("automations"),closeAutomations:()=>goToNav("terminal"),workItemsOpen:nav==="issues",openWorkItems:()=>goToNav("issues"),closeWorkItems:()=>goToNav("terminal")}}function renderFullWindowPage(deps){if(deps.worktreesOpen)return $jsx(WorktreesPage,{orchestrator:deps.orchestrator,onClose:deps.closeWorktrees});if(deps.updateOpen)return $jsx(UpdatePage,{onClose:deps.closeUpdate});return null}function renderContentPage(deps){let orch=deps.orchestrator;if(deps.automationsOpen)return $jsx(AutomationsPage,{orchestrator:orch,focused:deps.contentFocused,...deps.selectedTask?{focusRepo:deps.selectedTask.repo}:{},onClose:deps.closeAutomations,onOpenTask:(taskId)=>{deps.closeAutomations(),deps.activateTask(taskId)}});if(deps.workItemsOpen)return $jsx(WorkItemsPage,{orchestrator:orch,focused:deps.contentFocused,onClose:deps.closeWorkItems,...deps.selectedTask?{focusRepo:deps.selectedTask.repo}:{},onOpenTask:(taskId)=>{deps.closeWorkItems(),deps.activateTask(taskId)}});if(deps.kanbanOpen)return $jsx(KanbanPage,{orchestrator:orch,focused:deps.contentFocused,onClose:deps.closeKanban,onStartChat:deps.startIssueChat,engineStates:deps.engineStates,focusTask:deps.selectedTask?{id:deps.selectedTask.id,repo:deps.selectedTask.repo}:void 0,onOpenTask:(taskId)=>{deps.closeKanban(),deps.activateTask(taskId)}});return null}function useHostPagesRender(opts){let{orchestrator,pages,focus,dialog,kv,dims,selectedTask,activeTaskId,tasks,engineState,startIssueChat,activateTask}=opts,activePane=dialog.stack.length>0?null:focus.focused,pageDeps=import_react92.useMemo(()=>({orchestrator,selectedTask,worktreesOpen:pages.worktreesOpen,automationsOpen:pages.automationsOpen,workItemsOpen:pages.workItemsOpen,kanbanOpen:pages.kanbanOpen,updateOpen:pages.updateOpen,closeWorktrees:pages.closeWorktrees,closeAutomations:pages.closeAutomations,closeWorkItems:pages.closeWorkItems,closeKanban:pages.closeKanban,closeUpdate:pages.closeUpdate,activateTask:(taskId)=>void activateTask(taskId),startIssueChat,engineStates:engineState,contentFocused:activePane==="workspace"}),[orchestrator,selectedTask,pages,startIssueChat,engineState,activePane,activateTask]),fullWindowPage=import_react92.useMemo(()=>renderFullWindowPage(pageDeps),[pageDeps]),contentPage=import_react92.useMemo(()=>renderContentPage(pageDeps),[pageDeps]),narrow=isNarrowWidth(dims.width);import_react92.useEffect(()=>{if(narrow&&focus.focused==="files")focus.setFocused("workspace")},[narrow,focus]);let surface=narrow?narrowSurface({focusedPane:focus.focused,hasSelection:selectedTask!=null,hasOpenPage:contentPage!=null}):null,showSidebar=surface!=="content",showContent=surface!=="sidebar",recentTask=import_react92.useMemo(()=>(narrow?tasks.find((task)=>task.id===activeTaskId&&!task.deletion):null)??null,[narrow,tasks,activeTaskId]);return{settingsPage:pages.settingsOpen?$jsx("box",{flexGrow:1,backgroundColor:"transparent",paddingTop:1,children:$jsx(SettingsDialog,{kv,orchestrator,onClose:pages.closeSettings})}):null,fullWindowPage,contentPage,showSidebar,showContent,recentTask}}var import_react92;var init_host_pages=__esm(async()=>{init_nav_core();init_jsx_runtime();await __promiseAll([init_automations_page(),init_kanban_page(),init_settings_dialog(),init_update_page(),init_work_items_page(),init_worktrees_page()]);import_react92=__toESM(require_react_production(),1)});function createSidebarController(opts){let schedule=opts.scheduleTimeout??((cb,ms)=>{let t3=setTimeout(cb,ms);return()=>clearTimeout(t3)}),pendingG=!1,cancelTimer=null,armChord=()=>{pendingG=!0,cancelTimer?.(),cancelTimer=schedule(()=>{pendingG=!1,cancelTimer=null},700)},disarm=()=>{pendingG=!1,cancelTimer?.(),cancelTimer=null},move=(delta)=>{let ids=opts.getFlatIds();if(ids.length===0)return;let cur=opts.getCursor(),start=cur<0?0:cur,next=Math.min(ids.length-1,Math.max(0,start+delta));opts.setCursor(next)},jumpTo=(index)=>{let ids=opts.getFlatIds();if(ids.length===0)return;opts.setCursor(Math.min(ids.length-1,Math.max(0,index)))};return{moveDown(){disarm(),move(1)},moveUp(){disarm(),move(-1)},selectCurrent(){disarm();let ids=opts.getFlatIds(),cur=opts.getCursor();if(cur<0||cur>=ids.length)return;let id=ids[cur];if(id!==void 0)opts.onSelect(id)},pressG(){if(pendingG)disarm(),jumpTo(0);else armChord()},pressShiftG(){disarm(),jumpTo(opts.getFlatIds().length-1)},isChordArmed(){return pendingG},disarmChord(){disarm()}}}function rowHaystacks(row,liveBranch){if(row.kind==="project")return[row.label];if(row.kind==="routines")return[];if(row.kind==="tab")return[row.tab.label];let task=row.task,title=task.kind==="dir"?"":task.title;return[worktreeRowLabel(task,{liveBranch:liveBranch?.(task)}),title,repoBasename(task.repo)]}function matchesRow(query,row,liveBranch){return rowHaystacks(row,liveBranch).some((field)=>field!==""&&fuzzyMatch(query,field))}function filterTreeRows(rows,query,liveBranch){let q2=query.trim();if(q2==="")return[...rows];let selfMatch=new Set,keep=new Set;for(let row of rows){if(!matchesRow(q2,row,liveBranch))continue;if(selfMatch.add(row.id),keep.add(row.id),row.kind==="project"||row.kind==="routines")continue;if(row.kind==="tab")keep.add(row.task.id);let project=ownerProjectKey(row.task);if(project!==null)keep.add(project)}let out=[];for(let row of rows){if(row.kind==="project"){if(keep.has(row.id))out.push(row);continue}if(row.kind==="routines")continue;let project=ownerProjectKey(row.task),underMatchedProject=project!==null&&selfMatch.has(project);if(row.kind==="worktree"){if(underMatchedProject||keep.has(row.id))out.push(row);continue}if(underMatchedProject||selfMatch.has(row.task.id)||keep.has(row.id))out.push(row)}return out}var init_tree_search=__esm(()=>{init_groups();init_tree_core()});function tabRowActivity(args2){if(args2.tabActivity!==void 0)return args2.tabActivity;if(!args2.active||args2.reportedTabCount>0)return;return args2.taskActivity}import{homedir as homedir31}from"os";function routinesRowId(projectKey){return`~routines:${projectKey}`}function projectKeyOfRoutinesRow(id){return id.startsWith("~routines:")?id.slice(10):null}function isRoutineTask(task){return task.routine!==void 0}function withRecentRow(rows,recent){if(!recent)return[...rows];return[{kind:"recent",id:RECENT_ROW_ID,task:recent,depth:1},...rows]}function tabRowId(taskId,tabId){return`${taskId}${TAB_ROW_SEPARATOR}${tabId}`}function parseRowId(rowId){let at2=rowId.indexOf(TAB_ROW_SEPARATOR);if(at2<0)return{taskId:rowId,tabId:null};return{taskId:rowId.slice(0,at2),tabId:rowId.slice(at2+TAB_ROW_SEPARATOR.length)}}function rowLiveBranchPath(task){if(task.kind!=="main"&&task.kind!=="dir")return"";return task.worktreePath||task.repo||""}function worktreeRowLabel(task,opts={}){let branch=(opts.liveBranch??task.branch)||task.branch;if(branch)return branch;if(task.kind!=="dir"&&task.title)return task.title;let path22=task.worktreePath||task.repo;if(path22){let home=opts.home??homedir31(),tildified=home&&(path22===home||path22.startsWith(`${home}/`))?`~${path22.slice(home.length)}`:path22;return truncateStart(tildified,PATH_LABEL_MAX)}return task.title||"scratch"}function isClosedDownProject(tasks,tabsByTask2){let only=tasks.length===1?tasks[0]:void 0;if(!only||only.kind!=="main"&&only.kind!=="dir")return!1;return tabsByTask2.get(only.id)?.length===0}function buildTreeRows(input){let{tasks,tabsByTask:tabsByTask2}=input,sortMode=input.sortMode??"default",byProject=new Map,scratchTasks=tasks.filter((task)=>task.kind==="dir"&&task.scratch===!0);if(sortMode==="recent")scratchTasks.sort(compareRecent);for(let task of tasks){if(task.kind==="dir"&&task.scratch===!0)continue;let key=sidebarProjectKey(task.repo),entry=byProject.get(key)??{repo:task.repo,tasks:[]};if(task.kind==="main")entry.repo=task.repo,entry.tasks.unshift(task);else entry.tasks.push(task);byProject.set(key,entry)}let orderedKeys=[],seen=new Set;for(let task of tasks){if(task.kind!=="main")continue;let key=sidebarProjectKey(task.repo);if(!seen.has(key))seen.add(key),orderedKeys.push(key)}for(let key of byProject.keys())if(!seen.has(key))seen.add(key),orderedKeys.push(key);if(sortMode==="recent")for(let entry of byProject.values())entry.tasks.sort((a2,b3)=>{if(a2.kind==="main"&&b3.kind!=="main")return-1;if(b3.kind==="main"&&a2.kind!=="main")return 1;return compareRecent(a2,b3)});let rows=[];if(scratchTasks.length>0){rows.push({kind:"project",id:SCRATCH_SECTION_ID,repo:"",label:"Scratch",depth:0});for(let task of scratchTasks){let tabs=tabsByTask2.get(task.id)??[];if(tabs.length===0){rows.push({kind:"worktree",id:task.id,task,depth:1});continue}for(let tab of tabs)rows.push({kind:"tab",id:tabRowId(task.id,tab.id),task,tab,depth:2})}}let visibleKeys=orderedKeys.filter((key)=>{let entry=byProject.get(key);return entry?!isClosedDownProject(entry.tasks,tabsByTask2):!1}),projectRepos=visibleKeys.map((key)=>byProject.get(key)?.repo??"");for(let key of visibleKeys){let entry=byProject.get(key);if(!entry)continue;rows.push({kind:"project",id:key,repo:entry.repo,label:sidebarProjectLabel(entry.repo,projectRepos),depth:0});let routineTasks=entry.tasks.filter(isRoutineTask);for(let task of entry.tasks)if(!isRoutineTask(task))pushWorktree(rows,task,tabsByTask2);if(routineTasks.length>0){let expanded=input.expandedRoutines?.has(key)===!0;if(rows.push({kind:"routines",id:routinesRowId(key),projectKey:key,count:routineTasks.length,expanded,depth:1}),expanded)for(let task of routineTasks)pushWorktree(rows,task,tabsByTask2)}}return rows}function pushWorktree(rows,task,tabsByTask2){rows.push({kind:"worktree",id:task.id,task,depth:1});for(let tab of tabsByTask2.get(task.id)??[])rows.push({kind:"tab",id:tabRowId(task.id,tab.id),task,tab,depth:2})}function treeFlatIds(rows){let ids=[];for(let row of rows)if(row.kind!=="project")ids.push(row.id);return ids}function ownerProjectKey(task){if(task.kind==="dir"&&task.scratch===!0)return SCRATCH_SECTION_ID;return sidebarProjectKey(task.repo)}function projectKeysOf(tasks){let keys=[],seen=new Set;for(let task of tasks){let key=ownerProjectKey(task);if(key===null||seen.has(key))continue;seen.add(key),keys.push(key)}return keys}function mainTaskIdOfProject(tasks,projectKey){for(let task of tasks){if(task.kind!=="main")continue;if(sidebarProjectKey(task.repo)===projectKey)return String(task.id)}return null}var TAB_ROW_SEPARATOR="::",RECENT_ROW_ID="~recent",SCRATCH_SECTION_ID="~scratch",PATH_LABEL_MAX=24;var init_tree_core=__esm(()=>{init_groups();init_tree_search()});function resolveSidebarHoverTooltipLayout(opts){let maxWidth=opts.maxWidth??SIDEBAR_HOVER_TOOLTIP_MAX_WIDTH,widest=Math.max(1,...opts.lines.map((line)=>approxCellWidth(line.text))),innerWidth=Math.min(maxWidth-4,widest),boxWidth=innerWidth+4,boxHeight=opts.lines.length+2;return{innerWidth,boxWidth,boxHeight,left:Math.max(0,Math.min(opts.hoverX+2,opts.screenWidth-boxWidth-1)),top:Math.max(0,Math.min(opts.hoverY+1,opts.screenHeight-boxHeight-1))}}var SIDEBAR_HOVER_TOOLTIP_Z_INDEX=2750,SIDEBAR_HOVER_TOOLTIP_MAX_WIDTH=72;var init_hover_layout=()=>{};function truncateTitle(title,max){return truncateEnd(title,max)}var init_labels=()=>{};import{TextAttributes as TextAttributes29}from"@opentui/core";function ContextMenu(props){let{theme}=useTheme();if(props.entries.length===0)return null;let layout=resolveSidebarHoverTooltipLayout({hoverX:props.x,hoverY:props.y,screenWidth:props.dims.width,screenHeight:props.dims.height,lines:props.entries.map((entry)=>({text:entry.label}))});return $jsx("box",{position:"absolute",zIndex:CONTEXT_MENU_Z_INDEX,left:layout.left,top:layout.top,width:layout.boxWidth,flexDirection:"column",...FRAME,borderColor:theme.focusAccent,backgroundColor:theme.backgroundElement,paddingLeft:1,paddingRight:1,onMouseDown:(e2)=>e2.stopPropagation(),children:props.entries.map((entry,i2)=>{let active=i2===props.cursor;return $jsx("box",{flexShrink:0,backgroundColor:active?theme.focusAccent:void 0,onMouseUp:()=>props.onPick(entry.id),children:$jsx("text",{fg:active?theme.backgroundElement:entry.danger?theme.error:theme.text,attributes:active?TextAttributes29.BOLD:void 0,wrapMode:"none",flexGrow:1,children:truncateTitle(entry.label,layout.innerWidth)})},entry.id)})})}var CONTEXT_MENU_Z_INDEX;var init_context_menu=__esm(async()=>{init_hover_layout();init_labels();init_frame();init_jsx_runtime();await init_theme();CONTEXT_MENU_Z_INDEX=SIDEBAR_HOVER_TOOLTIP_Z_INDEX+10});function zenChipGlyph(platform3=process.platform){return platform3==="darwin"?"\u262F":"\u25D0"}import{MouseButton,TextAttributes as TextAttributes30}from"@opentui/core";function SectionHeader(props){let{theme,transparentBackground:transparentBackground2}=useTheme(),dividerColor=transparentBackground2?theme.border:theme.borderSubtle,dims=useTerminalDimensions();return $jsxs("box",{flexDirection:"column",flexShrink:0,children:[props.topPad?$jsx("box",{flexShrink:0,children:$jsx("text",{wrapMode:"none",children:" "})}):null,$jsxs("box",{flexDirection:"row",flexShrink:0,gap:1,paddingLeft:1,paddingRight:1,onMouseUp:props.onPress||props.onContextMenu?(evt)=>{if(evt.button===MouseButton.RIGHT&&props.onContextMenu){props.onContextMenu(evt.x,evt.y);return}props.onPress?.()}:void 0,children:[props.prefix?$jsx("text",{fg:theme.textMuted,wrapMode:"none",flexShrink:0,children:props.prefix}):null,$jsx("text",{fg:theme.textMuted,attributes:TextAttributes30.BOLD,wrapMode:"none",flexShrink:0,children:props.label}),$jsx("text",{fg:dividerColor,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:dividerRule(dims.width)}),props.suffix?$jsx("text",{fg:theme.info,attributes:TextAttributes30.BOLD,wrapMode:"none",flexShrink:0,children:props.suffix}):null]})]})}function SidebarSearchInput(props){let{theme}=useTheme(),t3=useT();return $jsxs("box",{flexDirection:"row",gap:0,flexShrink:0,paddingBottom:1,paddingLeft:1,children:[$jsx("text",{fg:theme.info,wrapMode:"none",children:"/"}),$jsx("text",{fg:theme.text,wrapMode:"none",children:props.query}),$jsx("text",{fg:theme.info,attributes:TextAttributes30.BLINK,wrapMode:"none",children:"\u2588"}),props.query.length===0?$jsxs("text",{fg:theme.textMuted,wrapMode:"none",children:[" ",t3("tasks.search.placeholder")]}):$jsxs("text",{fg:theme.textMuted,wrapMode:"none",children:[" ",props.matchCount,"/",props.totalCount]})]})}function SidebarBrandHeader(props){let{theme}=useTheme();return $jsxs("box",{flexDirection:"row",justifyContent:"space-between",gap:1,flexShrink:0,paddingLeft:1,paddingRight:1,children:[$jsxs("box",{flexDirection:"row",gap:1,children:[$jsx("text",{fg:props.focused?theme.focusAccent:theme.textMuted,attributes:TextAttributes30.BOLD,wrapMode:"none",children:"ROVE"}),props.status?$jsxs("box",{position:"relative",onMouseUp:()=>props.onStatusClick?.(),children:[$jsx("text",{fg:props.status.emphasize?theme.warningOnHost:theme.textMuted,attributes:props.status.emphasize?TextAttributes30.BOLD:TextAttributes30.DIM,wrapMode:"none",children:props.status.label}),props.onStatusClick?$jsx(ShortcutRevealBadge,{bindingId:"inbox.show"}):null]}):null]}),props.update?$jsxs("box",{position:"relative",flexShrink:0,onMouseUp:()=>props.onUpdateClick?.(),children:[$jsx("text",{fg:theme.warningOnHost,attributes:TextAttributes30.BOLD,wrapMode:"none",children:props.update.label}),props.onUpdateClick?$jsx(ShortcutRevealBadge,{bindingId:"tasks.update"}):null]}):null]})}function SidebarCreateAction(props){let{theme,transparentBackground:transparentBackground2}=useTheme(),t3=useT(),keycap=legendCap("task.new");if(!props.onAddTask)return null;return $jsx("box",{flexShrink:0,paddingRight:1,children:$jsxs("box",{position:"relative",flexDirection:"row",flexShrink:0,gap:1,paddingLeft:1,paddingRight:1,backgroundColor:transparentBackground2?void 0:theme.backgroundElement,onMouseUp:()=>props.onAddTask?.(),children:[$jsx("text",{fg:theme.text,attributes:TextAttributes30.BOLD,wrapMode:"none",flexGrow:1,children:t3("tasks.menu.newTask")}),$jsx("text",{fg:theme.primary,attributes:TextAttributes30.BOLD,wrapMode:"none",flexShrink:0,children:"+"}),keycap?$jsx("text",{fg:theme.textMuted,attributes:TextAttributes30.DIM,wrapMode:"none",flexShrink:0,children:keycap}):null,$jsx(ShortcutRevealBadge,{bindingId:"task.new"})]})})}function SidebarNavRail(props){let{theme}=useTheme(),t3=useT();return $jsx("box",{flexDirection:"column",flexShrink:0,paddingBottom:1,children:SIDEBAR_NAV_ITEMS.map((item)=>{let active=props.nav===item.nav;return $jsxs("box",{position:"relative",flexDirection:"row",flexShrink:0,paddingLeft:1,paddingRight:1,onMouseUp:(e2)=>{e2.stopPropagation(),props.setNav(item.nav)},children:[$jsx("text",{fg:active?theme.text:theme.textMuted,attributes:active?TextAttributes30.BOLD:void 0,wrapMode:"none",flexGrow:1,children:t3(item.labelKey)}),$jsx(ShortcutRevealBadge,{bindingId:item.bindingId})]},item.nav)})})}function SidebarZenChip(props){let{theme}=useTheme();return $jsxs("box",{position:"relative",flexShrink:0,paddingLeft:1,paddingRight:1,paddingTop:1,children:[$jsx("text",{fg:theme.accent,attributes:TextAttributes30.BOLD,wrapMode:"none",onMouseUp:(e2)=>{e2.stopPropagation(),props.onZenClick?.()},children:`${zenChipGlyph()} ZEN`}),$jsx(ShortcutRevealBadge,{bindingId:"workspace.zenToggle"})]})}var init_chrome=__esm(async()=>{init_help_groups();init_nav_core();init_i18n2();init_jsx_runtime();await __promiseAll([init_react(),init_shortcut_reveal2(),init_theme()])});function createBackgroundPoller(cfg){let entries=new Map,equals=cfg.equals??((a2,b3)=>a2===b3);function entryFor(key){let entry=entries.get(key);if(!entry){let current=cfg.initial;entry={read:()=>current,write:(next)=>{if(!equals(current,next))current=next},inFlight:!1,nextAllowedAt:0},entries.set(key,entry)}return entry}return{read(key){if(!key)return cfg.initial;return entryFor(key).read()},poll(key){if(!key)return;let entry=entryFor(key);maybeStartScheduledRun(entry,cfg,(signal)=>cfg.run(key,signal),(value)=>entry.write(value))},reset(){entries.clear()}}}var init_background_poll=__esm(()=>{init_poll_scheduling2();init_poll_scheduling2()});import{stat as stat12}from"fs/promises";import{join as join46}from"path";async function headFingerprint(repo){try{let st2=await stat12(join46(repo,".git","HEAD"));return`${st2.mtimeMs}:${st2.size}`}catch{return null}}async function resolveBranchHead(repo,signal,spawn12=spawnCapture){let fingerprint=await headFingerprint(repo);if(fingerprint!==null){let cached3=headCache.get(repo);if(cached3&&cached3.fingerprint===fingerprint)return cached3.value}let value="",resolved=!1,ref=await spawn12("git",["symbolic-ref","--short","HEAD"],{cwd:repo,env:readOnlyGitProcessEnv(),signal}),name=ref.status===0?ref.stdout.trim():"";if(name&&name!=="HEAD")value=name,resolved=!0;else if((await spawn12("git",["rev-parse","--verify","HEAD"],{cwd:repo,env:readOnlyGitProcessEnv(),signal})).status===0)value="(detached)",resolved=!0;if(resolved&&fingerprint!==null)headCache.set(repo,{fingerprint,value});return value}function currentBranch(repo){return poller.read(repo)}function pollCurrentBranch(repo){poller.poll(repo)}var BRANCH_POLL_TIMEOUT_MS=2000,BRANCH_SLOW_RETRY_MS=30000,BRANCH_MIN_POLL_INTERVAL_MS=1500,headCache,poller;var init_git_head=__esm(()=>{init_git_env();init_background_poll();headCache=new Map;poller=createBackgroundPoller({initial:"",timeoutMs:BRANCH_POLL_TIMEOUT_MS,slowRetryMs:BRANCH_SLOW_RETRY_MS,minIntervalMs:BRANCH_MIN_POLL_INTERVAL_MS,run:(repo,signal)=>resolveBranchHead(repo,signal)})});var DEFAULT_SPINNER_FRAMES;var init_spinner_frames=__esm(()=>{DEFAULT_SPINNER_FRAMES=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]});function activityToneFor(state){switch(state){case"rate_limited":case"permission_needed":return"warning";case"error":case"dead":return"error";default:return null}}function noTrackingSubtitle(){return t("tasks.subtitle.noTracking")}function materializingSubtitle(){return t("tasks.subtitle.materializing")}function deletionSubtitle(failed){return failed?t("tasks.subtitle.deleteFailed"):t("tasks.subtitle.deleting")}function isCustomEngineTask(task){if(task.kind==="main")return!1;return task.vendor!==void 0&&!isBuiltinVendor(task.vendor)}function stillWorkingAfterCompletion(activity,transcript){if(activity?.state!=="turn_complete"||!transcript)return!1;if(!activity.at||!transcript.mtimeMs)return!1;return transcript.mtimeMs>activity.at+COMPLETION_TRANSCRIPT_GRACE_MS}function rowIsLoading(opts){let{task}=opts,activityState=opts.activity?.state,hasActivity=activityState!==void 0,untrackedCustomEngine=isCustomEngineTask(task)&&!hasActivity,materializing=opts.job!==void 0,deleting=task.deletion?.phase==="queued"||task.deletion?.phase==="running",working=activityState==="running"||stillWorkingAfterCompletion(opts.activity,opts.transcript);return deleting||materializing||!untrackedCustomEngine&&working}function buildSidebarRowView(opts){let{task}=opts,isMain=task.kind==="main",branch=isMain?opts.mainBranch??"":task.branch,activityState=opts.activity?.state,hasActivity=activityState!==void 0,activityBadge=stillWorkingAfterCompletion(opts.activity,opts.transcript)?null:activityBadgeFor(activityState,opts.completionSeen===!0),activityTone=activityToneFor(activityState),untrackedCustomEngine=isCustomEngineTask(task)&&!hasActivity,materializing=opts.job!==void 0,deleting=task.deletion?.phase==="queued"||task.deletion?.phase==="running",deleteFailed=task.deletion?.phase==="error",loading=rowIsLoading({task,activity:opts.activity,job:opts.job,transcript:opts.transcript}),spinnerFrames=DEFAULT_SPINNER_FRAMES,spinner=spinnerFrames[opts.spinnerFrame%spinnerFrames.length]??spinnerFrames[0],tone=deleteFailed?"error":deleting||materializing?"primary":untrackedCustomEngine?"textMuted":activityTone??(loading?"primary":activityBadge?.tone??"textMuted"),fallbackSubtitle=untrackedCustomEngine?noTrackingSubtitle():"\u2014",subagents=loading?opts.lifecycle?.subagents??0:0,branchWithMarks=subagents>0&&branch.length>0?`\u25C7${subagents} ${branch}`:branch,subtitleText=deleting||deleteFailed?opts.truncateBranch(deletionSubtitle(deleteFailed),opts.subtitleBudget):materializing?opts.truncateBranch(materializingSubtitle(),opts.subtitleBudget):branchWithMarks.length>0?opts.truncateBranch(branchWithMarks,opts.subtitleBudget):opts.truncateBranch(fallbackSubtitle,opts.subtitleBudget),restGlyph=deleteFailed?ERROR_GLYPH:untrackedCustomEngine?NO_STATE_GLYPH:activityBadge?.glyph??"\u25CB";return{isMain,titleText:isMain?repoBasename(task.repo):task.title,subtitleText,loading,stateGlyph:loading?spinner:restGlyph,tone,spinnerFrames,materializing}}function withSpinnerFrame(view,frame){if(!view.loading)return view;let frames=view.spinnerFrames,spinner=frames[frame()%frames.length]??frames[0]??"\u280B";if(spinner===view.stateGlyph)return view;return{...view,stateGlyph:spinner}}function activityBadgeFor(state,completionSeen){switch(state){case"rate_limited":return{glyph:"\u25F7",tone:"warning"};case"permission_needed":return{glyph:"?",tone:"warning"};case"error":return{glyph:ERROR_GLYPH,tone:"error"};case"dead":return{glyph:DEAD_GLYPH,tone:"error"};case"turn_complete":return completionSeen?null:{glyph:"\u25CF",tone:"primary"};default:return null}}var IN_PROGRESS_SPINNER,SPINNER_FRAME_MS=100,SPINNER_TICK_CYCLE=600,NO_STATE_GLYPH="\xB7",ERROR_GLYPH="\xD7",DEAD_GLYPH="\u2020",COMPLETION_TRANSCRIPT_GRACE_MS=2000;var init_row_view2=__esm(()=>{init_spinner_frames();init_i18n();init_vendor();init_groups();IN_PROGRESS_SPINNER=DEFAULT_SPINNER_FRAMES});function prCheckChip(task){let stale=task.prStatus?.lastError!==void 0;switch(task.prStatus?.checkState){case"passing":return{glyph:"\u2713",tone:stale?"textMuted":"success"};case"failing":return{glyph:"\u2717",tone:stale?"textMuted":"error"};case"pending":return{glyph:"\u2022",tone:stale?"textMuted":"warning"};default:return null}}function prConflictChip(task){if((task.prStatus?.mergeable??"").toUpperCase()!=="CONFLICTING")return null;return{glyph:"\u2260",tone:task.prStatus?.lastError===void 0?"error":"textMuted"}}function prReviewChip(task){let stale=task.prStatus?.lastError!==void 0;switch(task.prStatus?.lifecycle){case"ready_to_merge":return{glyph:"\xBB",tone:stale?"textMuted":"success"};case"merged":return{glyph:"\u2261",tone:"textMuted"};default:return null}}function statusChip(task){switch(task.status){case"in_review":return{glyph:"\u25C7",tone:"primary"};case"done":return{glyph:"\u25C6",tone:"success"};case"canceled":return{glyph:DEAD_GLYPH,tone:"textMuted"};case"error":return{glyph:ERROR_GLYPH,tone:"error"};default:return null}}var init_row_chips=__esm(()=>{init_row_view2()});function tick(){frame=(frame+1)%SPINNER_TICK_CYCLE;for(let listener2 of listeners)try{listener2()}catch{}}function spinnerFrameSnapshot(){return frame}function subscribeSpinnerFrame(listener2){if(listeners.add(listener2),timer===null)timer=setInterval(tick,SPINNER_FRAME_MS),timer.unref?.();return()=>{if(listeners.delete(listener2),listeners.size===0&&timer!==null)clearInterval(timer),timer=null,frame=0}}var listeners,frame=0,timer=null;var init_spinner_frame_store=__esm(()=>{init_row_view2();listeners=new Set});function worktreeChanges(worktreePath){return poller2.read(worktreePath)}function pollWorktreeChanges(worktreePath){poller2.poll(worktreePath)}var POLL_TIMEOUT_MS=4000,SLOW_REPO_RETRY_MS=60000,MIN_POLL_INTERVAL_MS=1500,ZERO2,poller2;var init_worktree_changes_poller=__esm(()=>{init_git_env();init_background_poll();init_worktree_changes();init_background_poll();ZERO2={added:0,deleted:0},poller2=createBackgroundPoller({initial:ZERO2,equals:sameWorktreeChanges,timeoutMs:POLL_TIMEOUT_MS,slowRetryMs:SLOW_REPO_RETRY_MS,minIntervalMs:MIN_POLL_INTERVAL_MS,run:async(worktreePath,signal)=>{let res=await spawnCapture("git",["status","--porcelain=v1"],{cwd:worktreePath,env:readOnlyGitProcessEnv(),signal});if(res.status!==0)throw Error("git status failed");return parsePorcelain(res.stdout)}})});function completionSeenKey(taskId,tabId){return tabId===void 0?taskId:`${taskId}\x00${tabId}`}function parseCompletionSeen(stored){if(typeof stored!=="object"||stored===null||Array.isArray(stored))return{};let out={};for(let[key,at2]of Object.entries(stored))if(typeof at2==="number"&&Number.isFinite(at2))out[key]=at2;return out}function foldCompletionSeen(seen,key,at2,limit=200){let known=seen[key];if(known!==void 0&&known>=at2)return seen;let next={...seen,[key]:at2},keys=Object.keys(next);if(keys.length<=limit)return next;let pruned={};for(let k3 of keys.sort((a2,b3)=>next[b3]-next[a2]).slice(0,limit))pruned[k3]=next[k3];return pruned}function completionSeenAt(kv,key,at2){if(!kv||at2===void 0)return!1;let stored=kv.get("completionSeen");if(typeof stored!=="object"||stored===null||Array.isArray(stored))return!1;let known=stored[key];return typeof known==="number"&&known>=at2}function markCompletionSeen(kv,key,at2){let seen=parseCompletionSeen(kv.get("completionSeen")),next=foldCompletionSeen(seen,key,at2);if(next!==seen)kv.set("completionSeen",next)}function seenCompletionTabs(kv,taskId,stamps){let seen=new Set;for(let[tabId,at2]of stamps)if(completionSeenAt(kv,completionSeenKey(taskId,tabId),at2))seen.add(tabId);return seen}function useSpinnerFrame(active){return import_react94.useSyncExternalStore(active?subscribeSpinnerFrame:NOOP_SUBSCRIBE,active?spinnerFrameSnapshot:ZERO_FRAME)}function useChanges(sources,task){let pushed=pickPushedChanges(sources.worktreeChanges,task.worktreePath),hasPushed=pushed!==null;return import_react94.useEffect(()=>{if(sources.branchTick,hasPushed)return;pollWorktreeChanges(task.worktreePath)},[hasPushed,task.worktreePath,sources.branchTick]),pushed??worktreeChanges(task.worktreePath)}function ChangeStats(props){let{theme}=useTheme(),behind=props.changes.behind??0;if(props.changes.added<=0&&props.changes.deleted<=0&&behind<=0)return null;return $jsxs("box",{flexDirection:"row",gap:1,flexShrink:0,children:[props.changes.added>0?$jsxs("text",{fg:theme.success,wrapMode:"none",flexShrink:0,children:["+",props.changes.added]}):null,props.changes.deleted>0?$jsxs("text",{fg:theme.error,wrapMode:"none",flexShrink:0,children:["\u2212",props.changes.deleted]}):null,behind>0?$jsxs("text",{fg:theme.warning,wrapMode:"none",flexShrink:0,children:["\u2193",behind]}):null]})}function completionSeenFor(taskId,activityState,viewing,tabId,durableSeen=!1){let key=completionSeenKey(taskId,tabId);if(activityState==="turn_complete"){if(viewing)completionSeenIds.add(key)}else completionSeenIds.delete(key);return completionSeenIds.has(key)||durableSeen}function completionStampOf(activity){return activity?.state==="turn_complete"?activity.at:void 0}function useDurableCompletionSeen(taskId,tabId,completionAt,viewing){let kv=useOptionalKV(),key=completionSeenKey(taskId,tabId),seen=completionSeenAt(kv,key,completionAt);return import_react94.useEffect(()=>{if(!kv||!viewing||completionAt===void 0||seen)return;markCompletionSeen(kv,key,completionAt)},[kv,key,completionAt,viewing,seen]),seen}function JumpDigit(_props){return null}var import_react94,NOOP_SUBSCRIBE=()=>()=>{},ZERO_FRAME=()=>0,completionSeenIds;var init_row_cards=__esm(async()=>{init_spinner_frame_store();init_worktree_changes();init_worktree_changes_poller();init_kv();init_jsx_runtime();await init_theme();import_react94=__toESM(require_react_production(),1);completionSeenIds=new Set});import{MouseButton as MouseButton2}from"@opentui/core";function treeLabelBudget(shared2,reserved){let width=shared2.width??SIDEBAR_WIDTH;return Math.max(6,width-3-reserved)}function clusterCells(text){let cells=1;for(let ch of text)cells+=charWidth(ch.codePointAt(0)??0);return cells}function MoveChip(props){let{theme}=useTheme(),t3=useT();if(props.shared.movingRowId!==props.rowId)return null;return $jsx("text",{fg:theme.info,wrapMode:"none",flexShrink:0,children:t3("tasks.moveChip").trim()})}function RowShell(props){let{theme}=useTheme(),shared2=props.shared,selection=resolveRowSelectionChrome(theme,{cursor:shared2.cursorIndex===props.flatIndex,selected:shared2.activeRowId===props.rowId});return $jsxs("box",{ref:(renderable)=>{if(!renderable)return;return shared2.rowEls.set(props.flatIndex,renderable),()=>{if(shared2.rowEls.get(props.flatIndex)===renderable)shared2.rowEls.delete(props.flatIndex)}},width:"100%",flexDirection:"row",gap:0,backgroundColor:selection.backgroundColor,onMouseUp:(evt)=>{if(evt.stopPropagation(),evt.button===MouseButton2.RIGHT&&shared2.onContextMenu){shared2.onContextMenu(props.flatIndex,props.rowId,evt.x,evt.y);return}shared2.onPress(props.flatIndex,props.rowId)},children:[$jsx("text",{fg:selection.markerColor,wrapMode:"none",children:selection.marker}),$jsx("text",{wrapMode:"none",flexShrink:0,children:" ".repeat(props.depth*INDENT_CELLS)}),props.children]})}function WorktreeTreeRow(props){let{theme}=useTheme(),t3=useT(),shared2=props.shared,task=props.task,isCursor=shared2.cursorIndex===props.flatIndex,changes=useChanges(shared2,task),chip=prCheckChip(task),conflict=prConflictChip(task),review=prReviewChip(task),status=statusChip(task),livePath=rowLiveBranchPath(task);import_react95.useEffect(()=>{if(shared2.branchTick,livePath)pollCurrentBranch(livePath)},[livePath,shared2.branchTick]);let label=worktreeRowLabel(task,livePath?{liveBranch:currentBranch(livePath)}:{}),moving=shared2.movingRowId===props.rowId,materializing=shared2.taskJobs?.get(task.id)!==void 0,frame2=useSpinnerFrame(materializing),reserved=(materializing?2:0)+(task.pinned===!0?2:0)+(chip?2:0)+(conflict?2:0)+(review?2:0)+(status?2:0)+(changes.added>0?clusterCells(`+${changes.added}`):0)+(changes.deleted>0?clusterCells(`\u2212${changes.deleted}`):0)+((changes.behind??0)>0?clusterCells(`\u2193${changes.behind}`):0)+(moving?clusterCells(t3("tasks.moveChip").trim()):0);return $jsxs(RowShell,{rowId:props.rowId,flatIndex:props.flatIndex,depth:1,shared:shared2,children:[materializing?$jsx("text",{fg:theme.primary,wrapMode:"none",width:2,flexShrink:0,children:`${IN_PROGRESS_SPINNER[frame2%IN_PROGRESS_SPINNER.length]??IN_PROGRESS_SPINNER[0]} `}):null,$jsxs("box",{flexDirection:"row",flexGrow:1,paddingRight:1,gap:1,children:[$jsx("text",{fg:theme.text,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:truncateEndCells(label,treeLabelBudget(shared2,reserved),charWidth)}),task.pinned===!0?$jsx("text",{fg:theme.warning,wrapMode:"none",flexShrink:0,children:"\u25B4"}):null,status?$jsx("text",{fg:toneColor(theme,status.tone),wrapMode:"none",flexShrink:0,children:status.glyph}):null,chip?$jsx("text",{fg:toneColor(theme,chip.tone),wrapMode:"none",flexShrink:0,children:chip.glyph}):null,conflict?$jsx("text",{fg:toneColor(theme,conflict.tone),wrapMode:"none",flexShrink:0,children:conflict.glyph}):null,review?$jsx("text",{fg:toneColor(theme,review.tone),wrapMode:"none",flexShrink:0,children:review.glyph}):null,$jsx(ChangeStats,{changes}),$jsx(MoveChip,{rowId:props.rowId,shared:shared2}),$jsx(JumpDigit,{flatIndex:props.flatIndex,dim:!isCursor})]})]})}function useTabRowBaseView(args2){let t3=useT(),{task,activity,lifecycle,job,completionSeen}=args2;return import_react95.useMemo(()=>{return buildSidebarRowView({task,activity,lifecycle,job,spinnerFrame:0,subtitleBudget:0,truncateBranch:truncateBranchLabel,completionSeen})},[task,activity,lifecycle,job,completionSeen,t3])}function TabTreeRow(props){let{theme}=useTheme(),t3=useT(),shared2=props.shared,isCursor=shared2.cursorIndex===props.flatIndex,isAgent=props.tab.engine===!0,taskTabStates=isAgent?shared2.engineTabState?.get(props.task.id):void 0,activity=isAgent?tabRowActivity({tabActivity:taskTabStates?.get(props.tab.id),reportedTabCount:taskTabStates?.size??0,taskActivity:shared2.engineState?.get(props.task.id),active:props.tab.active===!0}):void 0,carriesState=activity!==void 0,viewing=shared2.selectedTaskId===props.task.id&&props.tab.active===!0,durableSeen=useDurableCompletionSeen(props.task.id,props.tab.id,carriesState?completionStampOf(activity):void 0,viewing),completionSeen=carriesState?completionSeenFor(props.task.id,activity?.state,viewing,props.tab.id,durableSeen):!1,baseView=useTabRowBaseView({task:props.task,activity,lifecycle:carriesState?shared2.engineLifecycle?.get(props.task.id):void 0,job:carriesState?shared2.taskJobs?.get(props.task.id):void 0,completionSeen}),frame2=useSpinnerFrame(carriesState&&baseView.loading),rowView=withSpinnerFrame(baseView,()=>frame2),glyph=isAgent&&carriesState?rowView.stateGlyph:NO_STATE_GLYPH;return $jsxs(RowShell,{rowId:props.rowId,flatIndex:props.flatIndex,depth:1,shared:props.shared,children:[$jsx("text",{fg:carriesState?toneColor(theme,rowView.tone):theme.textMuted,wrapMode:"none",width:2,flexShrink:0,children:`${glyph} `}),$jsxs("box",{flexDirection:"row",flexGrow:1,paddingRight:1,gap:1,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:truncateEndCells(props.tab.label,treeLabelBudget(shared2,2+(shared2.movingRowId===props.rowId?clusterCells(t3("tasks.moveChip").trim()):0)),charWidth)}),$jsx(MoveChip,{rowId:props.rowId,shared:shared2}),$jsx(JumpDigit,{flatIndex:props.flatIndex,dim:!isCursor})]})]})}function RoutinesTreeRow(props){let{theme}=useTheme(),t3=useT();return $jsxs(RowShell,{rowId:props.rowId,flatIndex:props.flatIndex,depth:1,shared:props.shared,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",width:2,flexShrink:0,children:props.expanded?"\u25BE ":"\u25B8 "}),$jsx("text",{fg:theme.textMuted,wrapMode:"none",flexShrink:1,children:t3("tasks.routinesRow",{count:String(props.count)})})]})}function RecentJumpRow(props){let{theme}=useTheme(),t3=useT();return $jsxs(RowShell,{rowId:props.rowId,flatIndex:props.flatIndex,depth:1,shared:props.shared,children:[$jsx("text",{fg:theme.accent,wrapMode:"none",width:2,flexShrink:0,children:"\u21A9 "}),$jsx("text",{fg:theme.text,wrapMode:"none",flexShrink:1,children:t3("tasks.recentJump",{title:props.task.title})})]})}var import_react95,INDENT_CELLS=1;var init_tree_rows=__esm(async()=>{init_git_head();init_row_chips();init_row_view2();init_tree_core();init_view_core();init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_row_cards()]);import_react95=__toESM(require_react_production(),1)});function SidebarTreeBody(props){let{theme}=useTheme(),t3=useT();return $jsx("scrollbox",{ref:props.setScrollRef,flexGrow:1,minHeight:0,stickyScroll:!1,verticalScrollbarOptions:{visible:!1},children:$jsxs("box",{flexShrink:0,gap:0,children:[props.rows.map((row,i2)=>{if(row.kind==="project"){let isScratch=row.id===SCRATCH_SECTION_ID;return $jsx(SectionHeader,{label:isScratch?t3("tasks.header.scratch"):row.label,suffix:props.movingProjectId===row.id?t3("tasks.moveChip"):void 0,topPad:i2>0,onContextMenu:props.onProjectContextMenu&&!isScratch?(x2,y3)=>props.onProjectContextMenu?.(row.id,x2,y3):void 0},row.id)}if(row.kind==="recent")return $jsx(RecentJumpRow,{rowId:row.id,flatIndex:props.flatIndexOf.get(row.id)??-1,task:row.task,shared:props.shared},row.id);if(row.kind==="routines")return $jsx(RoutinesTreeRow,{rowId:row.id,flatIndex:props.flatIndexOf.get(row.id)??-1,count:row.count,expanded:row.expanded,shared:props.shared},row.id);if(row.kind==="worktree")return $jsx(WorktreeTreeRow,{rowId:row.id,flatIndex:props.flatIndexOf.get(row.id)??-1,task:row.task,shared:props.shared},row.id);return $jsx(TabTreeRow,{rowId:row.id,flatIndex:props.flatIndexOf.get(row.id)??-1,task:row.task,tab:row.tab,shared:props.shared},row.id)}),props.rows.length===0?$jsx("box",{paddingTop:1,paddingLeft:1,children:$jsx("text",{fg:theme.textMuted,children:t3(sidebarEmptyStateKey({searching:props.searching,projectFilter:!1}))})}):null]})})}var init_tree_panel=__esm(async()=>{init_tree_core();init_view_core();init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_chrome(),init_tree_rows()])});function cursorTaskIdOf(rowId){if(rowId===void 0||rowId===RECENT_ROW_ID)return null;return parseRowId(rowId).taskId}function useTreeBindings(opts){let{focused,search,menu,moveMode,onMoveModeExit,controller,flatIdsRef,cursorRef,moveCursorRow,onDeleteRequest,onRenameRequest,onPinRequest,onLocalMergeRequest,markKeysUsed}=opts;function withCursorTask(fn){let taskId=cursorTaskIdOf(flatIdsRef.current[cursorRef.current]);if(taskId!==null&&fn)fn(taskId)}useBindings(()=>({enabled:focused&&!search.active&&!menu.open,bindings:bindByIds({"sidebar.nav":(_evt,slot)=>{markKeysUsed();let down=(slot??0)%2===0;if(moveMode){moveCursorRow(down?1:-1);return}if(down)controller.moveDown();else controller.moveUp()},"sidebar.select":()=>{if(markKeysUsed(),moveMode){onMoveModeExit?.();return}controller.selectCurrent()},"sidebar.goto":(_evt,slot)=>{if(moveMode)return;if((slot??0)%2===1)controller.pressShiftG();else controller.pressG()},"sidebar.tree.open":()=>{if(moveMode)return;controller.selectCurrent()},"sidebar.search.enter":()=>{if(moveMode)return;search.enter()},"sidebar.delete":()=>{if(moveMode)return;markKeysUsed(),withCursorTask(onDeleteRequest)},"sidebar.rename":()=>{if(moveMode)return;markKeysUsed(),withCursorTask(onRenameRequest)},"sidebar.localMerge":()=>withCursorTask(onLocalMergeRequest),"sidebar.pin":()=>{if(moveMode)return;markKeysUsed(),withCursorTask(onPinRequest)}})})),useBindings(()=>({enabled:focused&&moveMode,bindings:[{key:"escape",cmd:()=>onMoveModeExit?.()}]})),useBindings(()=>({enabled:focused&&search.active,bindings:bindByIds({"sidebar.search.nav":(_evt,slot)=>{if((slot??0)%2===0)controller.moveDown();else controller.moveUp()},"sidebar.search.submit":()=>{controller.selectCurrent(),search.exit()},"sidebar.search.cancel":()=>search.exit()})})),useBindings(()=>({enabled:focused&&menu.open,bindings:[...bindByIds({"sidebar.nav":(_evt,slot)=>menu.moveCursor((slot??0)%2===0?1:-1),"sidebar.select":()=>menu.pickCurrent()}),{key:"escape",cmd:()=>menu.close()}]}))}var init_use_tree_bindings=__esm(async()=>{init_tree_core();init_keybindings2();await init_keymap()});function newTabVerbs(){return[{action:"newChat",labelKey:"tasks.menu.newChat"},{action:"newShell",labelKey:"tasks.menu.newShell"}]}function taskVerbs(task){let verbs=[{action:"rename",labelKey:"tasks.menu.rename"}];if(task.kind!=="main")verbs.push({action:"pin",labelKey:task.pinned===!0?"tasks.menu.unpin":"tasks.menu.pin"});if(verbs.push({action:"reorder",labelKey:"tasks.menu.reorder"}),task.prompt!==void 0)verbs.push({action:"runAgain",labelKey:"tasks.menu.runAgain"});if(verbs.push({action:"setStatus",labelKey:"tasks.menu.setStatus"}),task.branch!=="")verbs.push({action:"copyBranch",labelKey:"tasks.menu.copyBranch"});if(task.worktreePath!=="")verbs.push({action:"copyPath",labelKey:"tasks.menu.copyPath"});if(verbs.push({action:"openEditor",labelKey:"tasks.menu.openEditor"}),task.branch!=="")verbs.push({action:"renameBranch",labelKey:"tasks.menu.renameBranch"});if(verbs.push({action:"changeEngine",labelKey:"tasks.menu.changeEngine"}),task.prStatus?.checkState==="failing")verbs.push({action:"fixChecks",labelKey:"tasks.menu.fixChecks"});if(task.kind==="task"&&task.branch!=="")verbs.push({action:"syncBase",labelKey:"tasks.menu.syncBase"});if(task.kind==="task"&&task.branch!=="")verbs.push({action:"land",labelKey:"tasks.menu.land"});return verbs.push({action:"delete",labelKey:"tasks.menu.delete",danger:!0}),verbs}function treeMenuItems(row,ctx3={}){if(row.kind==="project")return[{action:"newTask",labelKey:"tasks.menu.newTask"},{action:"fieldNotes",labelKey:"tasks.menu.fieldNotes"},{action:"forgetProject",labelKey:"tasks.menu.forgetProject",danger:!0}];if(row.kind==="worktree")return[{action:"open",labelKey:"tasks.menu.open"},...newTabVerbs(),...taskVerbs(row.task)];if(row.kind==="routines")return[];let tabItems=[{action:"open",labelKey:"tasks.menu.openTab"}];if((ctx3.tabCount??0)>0)tabItems.push({action:"closeTab",labelKey:"tasks.menu.closeTab"});return[...tabItems,...newTabVerbs(),...taskVerbs(row.task)]}function dispatch2(event){for(let handler of[...subscribers])handler(event)}function subscribeGlobalMouseDown(host,handler){if(subscribers.add(handler),installedHost!==host){if(installedHost)installedHost.onMouseDown=void 0;installedHost=host,host.onMouseDown=dispatch2}return()=>{if(subscribers.delete(handler),subscribers.size===0&&installedHost)installedHost.onMouseDown=void 0,installedHost=null}}var subscribers,installedHost=null;var init_global_mouse_down=__esm(()=>{subscribers=new Set});function useGlobalMouseDown(enabled,handler){let renderer=useRenderer(),latest2=useLatest(handler);import_react97.useEffect(()=>{let root=renderer?.root;if(!enabled||!root)return;return subscribeGlobalMouseDown(root,()=>latest2.current())},[enabled,renderer])}var import_react97;var init_use_global_mouse_down=__esm(async()=>{init_global_mouse_down();init_use_latest();await init_react();import_react97=__toESM(require_react_production(),1)});function useTreeMenu(deps){let t3=useT(),{tree,activateRow,setCursorIndex,actions}=deps,[menu,setMenu]=import_react98.useState(null),[cursor,setCursor]=import_react98.useState(0),openAt=import_react98.useCallback((row,ctx3,x2,y3)=>{let items=treeMenuItems(row,ctx3);setMenu({row,actions:items.map((item)=>item.action),entries:items.map((item)=>({id:item.action,label:t3(item.labelKey),danger:item.danger})),x:x2,y:y3}),setCursor(0)},[t3]),openForRow=import_react98.useCallback((flatIndex,rowId,x2,y3)=>{let row=tree.rows.find((candidate)=>candidate.id===rowId);if(!row||row.kind==="project"||row.kind==="recent"||row.kind==="routines")return;setCursorIndex(flatIndex),openAt(row,{tabCount:tree.tabCount(row.task.id)},x2,y3)},[tree.rows,tree.tabCount,openAt,setCursorIndex]),openForProject=import_react98.useCallback((projectId,x2,y3)=>{let row=tree.rows.find((candidate)=>candidate.kind==="project"&&candidate.id===projectId);if(!row)return;openAt(row,{},x2,y3)},[tree.rows,openAt]),close=import_react98.useCallback(()=>setMenu(null),[]);useGlobalMouseDown(menu!==null,close);let moveCursor=import_react98.useCallback((delta)=>{let count=menu?.entries.length??0;if(count===0)return;setCursor((prev)=>(prev+delta+count)%count)},[menu]),fire=import_react98.useCallback((action)=>{if(!menu||action===void 0)return;let row=menu.row;if(setMenu(null),row.kind==="project"){if(action==="newTask")deps.onAddTask?.();if(action==="fieldNotes")actions.onFieldNotesRequest?.(row.repo);if(action==="forgetProject"){let mainId=deps.tree.mainTaskIdOfProject(row.id);if(mainId)actions.onDeleteRequest?.(mainId)}return}if(row.kind==="routines")return;let taskId=row.task.id;switch(action){case"open":activateRow(row.id);break;case"closeTab":if(row.kind==="tab")deps.onCloseTab?.(taskId,row.tab.id);break;case"newChat":deps.onNewTab?.(taskId,"chat");break;case"newShell":deps.onNewTab?.(taskId,"shell");break;case"rename":actions.onRenameRequest?.(taskId);break;case"pin":actions.onPinRequest?.(taskId);break;case"reorder":actions.onLocalMergeRequest?.(taskId);break;case"runAgain":actions.onRunAgainRequest?.(taskId);break;case"setStatus":actions.onSetStatusRequest?.(taskId);break;case"copyBranch":actions.onCopyRequest?.(taskId,"branch");break;case"copyPath":actions.onCopyRequest?.(taskId,"path");break;case"openEditor":actions.onOpenEditorRequest?.(taskId);break;case"renameBranch":actions.onRenameBranchRequest?.(taskId);break;case"changeEngine":actions.onChangeEngineRequest?.(taskId);break;case"fixChecks":actions.onFixChecksRequest?.(taskId);break;case"syncBase":actions.onSyncBaseRequest?.(taskId);break;case"land":actions.onLandRequest?.(taskId);break;case"delete":actions.onDeleteRequest?.(taskId);break;default:break}},[menu,activateRow,actions,deps.onAddTask,deps.onCloseTab,deps.onNewTab,deps.tree.mainTaskIdOfProject]),pickCurrent=import_react98.useCallback(()=>fire(menu?.actions[cursor]),[fire,menu,cursor]),pick=import_react98.useCallback((action)=>fire(menu?.actions.find((candidate)=>candidate===action)),[fire,menu]);return{open:menu!==null,entries:menu?.entries??[],cursor,x:menu?.x??0,y:menu?.y??0,close,moveCursor,pickCurrent,pick,openForRow,openForProject}}var import_react98;var init_use_tree_menu=__esm(async()=>{init_i18n2();await init_use_global_mouse_down();import_react98=__toESM(require_react_production(),1)});function useTreeSearch(opts){let[active,setActive2]=import_react100.useState(!1),[query,setQuery]=import_react100.useState(""),focusedRef=useLatest(opts.focused),onActiveChange=opts.onActiveChange,onActiveChangeRef=useLatest(onActiveChange);import_react100.useEffect(()=>()=>{onActiveChangeRef.current?.(!1)},[]);let enter=import_react100.useCallback(()=>{setQuery(""),setActive2(!0),onActiveChange?.(!0)},[onActiveChange]),exit=import_react100.useCallback(()=>{setActive2(!1),setQuery(""),onActiveChange?.(!1)},[onActiveChange]),renderer=useRenderer();return import_react100.useEffect(()=>{if(!active||!renderer)return;let listener2=(evt)=>{if(!focusedRef.current||modalActive())return;setQuery((q2)=>searchQueryKeystroke(q2,evt)??q2)};return renderer.keyInput.on("keypress",listener2),()=>{renderer.keyInput.off("keypress",listener2)}},[active,renderer]),{active,query,enter,exit}}var import_react100;var init_use_tree_search=__esm(async()=>{init_view_core();init_use_latest();await __promiseAll([init_react(),init_keymap()]);import_react100=__toESM(require_react_production(),1)});function ordinalOf(tabId,fallback){let match=/^tab-(\d+)$/.exec(tabId);return match?Number(match[1]):fallback}function adoptTabs(state,tabIds){let known=new Set(state.tabs.map((tab)=>tab.id)),fresh=[];for(let id of tabIds){if(known.has(id))continue;known.add(id),fresh.push(id)}if(fresh.length===0)return state;let minted=state.nextOrdinal,adopted=fresh.map((id)=>({kind:"engine",id,title:null,ordinal:ordinalOf(id,minted++),spawned:!0}));adopted.sort((a2,b3)=>a2.ordinal-b3.ordinal);let tabs=[...state.tabs,...adopted],maxOrdinal=tabs.reduce((max,tab)=>Math.max(max,tab.ordinal),0);return{tabs,activeId:state.activeId,nextOrdinal:Math.max(state.nextOrdinal,maxOrdinal+1)}}function adoptTaskTabs(kv,taskId,tabIds){if(tabIds.length===0)return!1;if(requestTabAdopt(taskId,tabIds),!takeUnclaimedTabAdopt())return!1;let saved=kv.store[terminalTabsKey(taskId)],state=tabsByTask.get(taskId)??(saved&&Array.isArray(saved.tabs)?saved:null),empty={tabs:[],activeId:tabIds[0],nextOrdinal:1},next=adoptTabs(state??empty,tabIds);if(state&&next===state)return!1;return setTaskTabs(taskId,next),kv.set(terminalTabsKey(taskId),next),!0}var init_terminal_tabs_adopt=__esm(()=>{init_terminal_tabs_shared()});function orphanTabsByTask(sessions,registered){let byTask=new Map;for(let session of sessions){if(session.alive===!1)continue;let{taskId,tabId:rawTabId}=parseRowId(session.key);if(!rawTabId)continue;let tabId=rawTabId.split("::")[0];if(registered.has(tabRowId(taskId,tabId)))continue;let tabs=byTask.get(taskId)??[];if(tabs.some((tab)=>tab.id===tabId))continue;tabs.push({id:tabId,label:`\u26A0 ${stripEngineStatusPrefix(session.title?.trim()??"",null).trim()||tabId}`,active:tabs.length===0,engine:!0}),byTask.set(taskId,tabs)}return byTask}function filterKnownOrphanTabs(tasks,orphans){let taskIds=new Set(tasks.map((task)=>task.id)),known=new Map;for(let[taskId,tabs]of orphans)if(taskIds.has(taskId))known.set(taskId,tabs);return known}var init_orphan_tabs=__esm(()=>{init_registry();init_tree_core()});function sameSessions(a2,b3){if(a2.length!==b3.length)return!1;return a2.every((s2,i2)=>{let other=b3[i2];return s2.key===other.key&&s2.alive===other.alive&&s2.title===other.title})}function pollingAllowed(){return process.env.BUN_TEST!=="1"&&process.env.VITEST!=="true"}function useHostSessions(enabled=pollingAllowed()){let[sessions,setSessions]=import_react101.useState(EMPTY2);return import_react101.useEffect(()=>{if(!enabled)return;let cancelled=!1,poll=async()=>{try{let client=await getSharedPtyClient(),{sessions:live=[]}=await client.request("pty.list",{});if(!cancelled)setSessions((prev)=>sameSessions(prev,live)?prev:live)}catch{if(!cancelled)setSessions((prev)=>prev.length===0?prev:EMPTY2)}};poll();let timer2=setInterval(()=>void poll(),POLL_MS4);return()=>{cancelled=!0,clearInterval(timer2)}},[enabled]),sessions}var import_react101,POLL_MS4=2000,EMPTY2;var init_use_host_sessions=__esm(()=>{init_pty_hosted_client();import_react101=__toESM(require_react_production(),1),EMPTY2=[]});function useTreeState(opts){let{tasks,kv,selectedTaskId,selectedTabId}=opts,query=opts.query??"",searching=query.trim()!=="",[expandedRoutines,setExpandedRoutines]=import_react102.useState(()=>new Set),toggleRoutines=import_react102.useCallback((projectKey)=>{setExpandedRoutines((current)=>{let next=new Set(current);if(!next.delete(projectKey))next.add(projectKey);return next})},[]),liveEngines=getDefaultLiveEngines(),[liveTick,setLiveTick]=import_react102.useState(0);import_react102.useEffect(()=>liveEngines.subscribe(()=>setLiveTick((tick2)=>tick2+1)),[liveEngines]);let hostSessions=useHostSessions();import_react102.useEffect(()=>{let pids=new Map;for(let session of hostSessions)if(session.alive!==!1&&typeof session.pid==="number"&&session.pid>0)pids.set(session.key,session.pid);return liveEngines.setAuxPids(pids),()=>liveEngines.setAuxPids(new Map)},[hostSessions,liveEngines]);let liveTitles=import_react102.useMemo(()=>{let map=new Map;for(let session of hostSessions){let title=session.title?.trim();if(title)map.set(session.key,title)}return map},[hostSessions]),snapshotTabs=import_react102.useMemo(()=>{let map=new Map;for(let task of tasks){let known=knownTaskTabs(kv,task.id);if(!known)continue;let vendor=task.vendor??DEFAULT_TASK_VENDOR;map.set(task.id,known.tabs.map((tab)=>{let ptyKey=tabPtyKeyFor(task.id,tab),probed=liveEngines.resolve(ptyKey),live=probed===void 0?tab.liveVendor:probed;return{id:tab.id,label:tabTitleStable(tab,vendor,live,liveTitles.get(ptyKey)),active:tab.id===known.activeId,engine:tab.kind==="engine"||(live??null)!==null}}))}return map},[tasks,kv,liveEngines,liveTick,liveTitles]),orphansByTask=import_react102.useMemo(()=>{let registered=new Set;for(let[taskId,tabs]of snapshotTabs)for(let tab of tabs)registered.add(tabRowId(taskId,tab.id));let sessions=hostSessions.filter((session)=>!isRecentlyClosedPtyKey(session.key));return filterKnownOrphanTabs(tasks,orphanTabsByTask(sessions,registered))},[snapshotTabs,hostSessions,tasks]);import_react102.useEffect(()=>{if(!kv)return;for(let[taskId,orphans]of orphansByTask)adoptTaskTabs(kv,taskId,orphans.map((tab)=>tab.id))},[orphansByTask,kv]);let tabsByTask2=import_react102.useMemo(()=>{if(orphansByTask.size===0)return snapshotTabs;let map=new Map(snapshotTabs);for(let[taskId,orphans]of orphansByTask){let existing=map.get(taskId);map.set(taskId,existing?[...existing,...orphans.map((tab)=>({...tab,active:!1}))]:orphans)}return map},[snapshotTabs,orphansByTask]),recentTask=opts.recentTask??null,sortMode=opts.sortMode??"default",{rows,totalCount}=import_react102.useMemo(()=>{let all=searching?buildTreeRows({tasks,tabsByTask:tabsByTask2,sortMode,expandedRoutines:new Set(projectKeysOf(tasks))}):buildTreeRows({tasks,tabsByTask:tabsByTask2,sortMode,expandedRoutines}),total=treeFlatIds(all).length;return opts.branchTick,{rows:searching?filterTreeRows(all,query,(task)=>{let path22=rowLiveBranchPath(task);return path22?currentBranch(path22):""}):withRecentRow(all,recentTask),totalCount:total}},[tasks,tabsByTask2,searching,query,recentTask,sortMode,expandedRoutines,opts.branchTick]),flatIds=import_react102.useMemo(()=>treeFlatIds(rows),[rows]),activeRowId=import_react102.useMemo(()=>{if(selectedTaskId===null)return null;if(selectedTabId!==null)return tabRowId(selectedTaskId,selectedTabId);return selectedTaskId},[selectedTaskId,selectedTabId]),tabCount=import_react102.useCallback((taskId)=>tabsByTask2.get(taskId)?.length??0,[tabsByTask2]),mainTaskOfProject=import_react102.useCallback((projectId)=>mainTaskIdOfProject(tasks,projectId),[tasks]),projectIdOfTask=import_react102.useCallback((taskId)=>{let task=tasks.find((candidate)=>candidate.id===taskId);if(!task||task.kind==="dir")return null;return sidebarProjectKey(task.repo)},[tasks]);return{rows,flatIds,totalCount,tabCount,activeRowId,projectIdOfTask,mainTaskIdOfProject:mainTaskOfProject,toggleRoutinesRow:import_react102.useCallback((rowId)=>{let projectKey=projectKeyOfRoutinesRow(rowId);if(projectKey===null)return!1;return toggleRoutines(projectKey),!0},[toggleRoutines])}}var import_react102;var init_use_tree_state=__esm(()=>{init_task();init_git_head();init_groups();init_tree_core();init_closed_tab_suppress();init_live_engine();init_terminal_tab_split();init_terminal_tabs_core();init_terminal_tabs_adopt();init_terminal_tabs_shared();init_orphan_tabs();init_use_host_sessions();import_react102=__toESM(require_react_production(),1)});function SidebarTree(props){let{theme}=useTheme(),kv=useOptionalKV(),focused=props.focused??!0,dims=useTerminalDimensions(),[branchTick,setBranchTick]=import_react104.useState(0);import_react104.useEffect(()=>{let timer2=setInterval(()=>setBranchTick((n2)=>n2+1),MAIN_BRANCH_POLL_MS);return()=>clearInterval(timer2)},[]);let search=useTreeSearch({focused,onActiveChange:props.onSearchActiveChange}),tree=useTreeState({tasks:props.tasks,kv,selectedTaskId:props.selectedId,selectedTabId:props.selectedTabId??null,query:search.active?search.query:"",recentTask:props.recentTask??null,sortMode:props.sortMode,branchTick}),flatIndexOf=import_react104.useMemo(()=>{let map=new Map;return tree.flatIds.forEach((id,i2)=>map.set(id,i2)),map},[tree.flatIds]),[cursorIndex,setCursorIndexState]=import_react104.useState(-1),cursorRef=import_react104.useRef(cursorIndex),setCursorIndex=import_react104.useCallback((next)=>{cursorRef.current=next,setCursorIndexState(next)},[]),flatIdsRef=useLatest(tree.flatIds),cursorTaskIdRef=props.cursorTaskIdRef;import_react104.useEffect(()=>{if(!cursorTaskIdRef)return;cursorTaskIdRef.current=()=>cursorTaskIdOf(flatIdsRef.current[cursorRef.current])},[cursorTaskIdRef]);let prevActiveRef=import_react104.useRef(null),cursorRowIdRef=import_react104.useRef(null),moveMode=props.moveMode===!0;import_react104.useEffect(()=>{let ids=tree.flatIds;if(moveMode){let wanted=cursorRowIdRef.current,at3=wanted===null?-1:ids.indexOf(wanted);if(at3>=0){if(at3!==cursorRef.current)setCursorIndex(at3);return}}let active=tree.activeRowId,activeMoved=active!==prevActiveRef.current;prevActiveRef.current=active;let at2=active===null?-1:ids.indexOf(active);if(activeMoved&&at2>=0){if(at2!==cursorRef.current)setCursorIndex(at2);return}if(cursorRef.current>=ids.length)setCursorIndex(Math.max(0,ids.length-1));else if(cursorRef.current<0&&ids.length>0)setCursorIndex(at2>=0?at2:0)},[tree.flatIds,tree.activeRowId,moveMode,setCursorIndex]),import_react104.useEffect(()=>{cursorRowIdRef.current=tree.flatIds[cursorRef.current]??null}),import_react104.useEffect(()=>{if(search.query,!search.active)return;setCursorIndex(0)},[search.active,search.query,setCursorIndex]);let recentTaskRef=useLatest(props.recentTask??null),toggleRoutinesRow=tree.toggleRoutinesRow,activateRow=import_react104.useCallback((rowId)=>{if(toggleRoutinesRow(rowId))return;let recent=rowId===RECENT_ROW_ID?recentTaskRef.current:null,{taskId,tabId}=recent?{taskId:recent.id,tabId:null}:parseRowId(rowId);if(props.onSelect(taskId),tabId===null){props.onActivate?.(taskId);return}props.onSelectTab?.(taskId,tabId),props.onActivate?.(taskId)},[props.onSelect,props.onActivate,props.onSelectTab,toggleRoutinesRow]),activateRowRef=useLatest(activateRow),controllerRef=import_react104.useRef(null);if(controllerRef.current===null)controllerRef.current=createSidebarController({getCursor:()=>cursorRef.current,setCursor:setCursorIndex,getFlatIds:()=>flatIdsRef.current,onSelect:(id)=>activateRowRef.current(id)});let ctrl=controllerRef.current,tasksRef=useLatest(props.tasks),moveCursorRow=import_react104.useCallback((delta)=>{let rowId=flatIdsRef.current[cursorRef.current];if(rowId===void 0||rowId===RECENT_ROW_ID)return;let{taskId,tabId}=parseRowId(rowId);if(tabId!==null){props.onMoveTabRequest?.(taskId,tabId,delta);return}let task=tasksRef.current.find((candidate)=>candidate.id===taskId);if(!task)return;if(task.kind!=="main"){props.onMoveRequest?.(taskId,delta);return}let projectId=tree.projectIdOfTask(taskId);if(projectId===null)return;let mainId=tree.mainTaskIdOfProject(projectId);if(mainId===null)return;props.onMoveRequest?.(mainId,delta)},[tree.projectIdOfTask,tree.mainTaskIdOfProject,props.onMoveRequest,props.onMoveTabRequest]),cursorRowId=tree.flatIds[cursorIndex],cursorMove=import_react104.useMemo(()=>{if(cursorRowId===void 0||cursorRowId===RECENT_ROW_ID)return{projectId:null,rowId:null};let{taskId,tabId}=parseRowId(cursorRowId);if(tabId===null){if(props.tasks.find((candidate)=>candidate.id===taskId)?.kind==="main")return{projectId:tree.projectIdOfTask(taskId),rowId:null}}return{projectId:null,rowId:cursorRowId}},[cursorRowId,props.tasks,tree.projectIdOfTask]),menu=useTreeMenu({tree,activateRow,setCursorIndex,onAddTask:props.onAddTask,onCloseTab:props.onCloseTab,onNewTab:props.onNewTab,actions:props}),markKeysUsed=usePaneHintMark("sidebar");useTreeBindings({focused,search,menu,moveMode,onMoveModeExit:props.onMoveModeExit,controller:ctrl,flatIdsRef,cursorRef,moveCursorRow,onDeleteRequest:props.onDeleteRequest,onRenameRequest:props.onRenameRequest,onPinRequest:props.onPinRequest,onLocalMergeRequest:props.onLocalMergeRequest,markKeysUsed}),useBindings(()=>({enabled:!0,bindings:bindByIds({"tasks.jump":(_evt,slot)=>{let id=flatIdsRef.current[slot??0];if(id===void 0)return;setCursorIndex(slot??0),activateRowRef.current(id)}})}));let scrollRef=import_react104.useRef(null),rowElsRef=import_react104.useRef(null);if(rowElsRef.current===null)rowElsRef.current=new Map;let rowEls=rowElsRef.current;import_react104.useEffect(()=>{let scroll=scrollRef.current;if(!scroll||cursorIndex<0||scroll.viewport.height<=0)return;let el=rowEls.get(cursorIndex);if(el)scroll.scrollChildIntoView(el.id)},[cursorIndex,rowEls]);let outerRef=import_react104.useRef(null),effectiveWidth=props.width??SIDEBAR_WIDTH;import_react104.useEffect(()=>{let el=outerRef.current;if(!el)return;el.width=effectiveWidth,el.flexShrink=1,el.minHeight=0},[effectiveWidth]);let shared2={width:effectiveWidth,cursorIndex,activeRowId:tree.activeRowId,selectedTaskId:props.selectedId,movingRowId:moveMode?cursorMove.rowId:null,rowEls,onPress:(flatIndex,rowId)=>{menu.close(),setCursorIndex(flatIndex),activateRow(rowId)},onContextMenu:menu.openForRow,branchTick,engineState:props.engineState,engineTabState:props.engineTabState,engineLifecycle:props.engineLifecycle,taskJobs:props.taskJobs,worktreeChanges:props.worktreeChanges};return $jsxs("box",{ref:outerRef,flexGrow:1,minHeight:0,flexDirection:"column",backgroundColor:theme.backgroundPanel,paddingTop:1,paddingBottom:1,children:[$jsx(SidebarBrandHeader,{focused,status:props.headerStatus??null,onStatusClick:props.onHeaderStatusClick,update:props.updateChip??null,onUpdateClick:props.onUpdateChipClick}),$jsx(SidebarCreateAction,{onAddTask:props.onAddTask}),search.active?$jsx(SidebarSearchInput,{query:search.query,matchCount:tree.flatIds.length,totalCount:tree.totalCount}):null,$jsx(SidebarNavRail,{nav:props.nav??"terminal",setNav:(next)=>props.onNavChange?.(next)}),$jsx(SidebarTreeBody,{rows:tree.rows,flatIndexOf,searching:search.active&&search.query.trim().length>0,shared:shared2,onProjectContextMenu:menu.openForProject,movingProjectId:moveMode?cursorMove.projectId:null,setScrollRef:(r6)=>{scrollRef.current=r6}}),props.zenActive?$jsx(SidebarZenChip,{onZenClick:props.onZenClick}):null,menu.open?$jsx(ContextMenu,{entries:menu.entries,cursor:menu.cursor,x:menu.x,y:menu.y,dims:{width:effectiveWidth,height:dims.height},onPick:menu.pick}):null,dims.height<0?$jsx("text",{children:""}):null]})}var import_react104;var init_SidebarTree=__esm(async()=>{init_tree_core();init_view_core();init_keybindings2();init_kv();init_use_latest();init_use_tree_state();init_jsx_runtime();await __promiseAll([init_react(),init_keyboard_hints2(),init_theme(),init_keymap(),init_context_menu(),init_chrome(),init_tree_panel(),init_use_tree_bindings(),init_use_tree_menu(),init_use_tree_search()]);import_react104=__toESM(require_react_production(),1)});function moveTaskTab(kv,taskId,tabId,delta){if(requestTabMove(taskId,tabId,delta),!takeUnclaimedTabMove())return!0;let saved=kv.store[terminalTabsKey(taskId)],state=tabsByTask.get(taskId)??(saved&&Array.isArray(saved.tabs)?saved:null);if(!state)return!1;let next=moveTab(state,tabId,delta);if(next===state)return!1;return setTaskTabs(taskId,next),kv.set(terminalTabsKey(taskId),next),!0}var init_terminal_tabs_move=__esm(()=>{init_terminal_tabs_core();init_terminal_tabs_shared()});function HostSidebar(props){let{onFocusRequest:_rail,recentTask:_recent,...treeProps}=props,{theme}=useTheme(),kv=useKV(),notif=useNotifications(),t3=useT(),closeTab2=import_react105.useCallback((taskId,tabId)=>{if(!closeTaskTab(kv,taskId,tabId))notif.notify({kind:"error",taskId,tabId,title:t3("terminal.tab.tabGone")})},[kv,notif,t3]),moveTab2=import_react105.useCallback((taskId,tabId,delta)=>{moveTaskTab(kv,taskId,tabId,delta)},[kv]),newTab=import_react105.useCallback((taskId,kind)=>{props.onActivate(taskId),requestNewTab(taskId,kind)},[props.onActivate]);return $jsxs("box",{width:props.width,flexShrink:0,flexDirection:"column",backgroundColor:theme.backgroundPanel,onMouseUp:props.onFocusRequest,children:[$jsx(SidebarTree,{...treeProps,onCloseTab:closeTab2,onNewTab:newTab,onMoveTabRequest:moveTab2,recentTask:props.recentTask??null}),$jsx("box",{flexShrink:0,paddingLeft:1,paddingBottom:0,children:$jsx(PaneKeyHint,{pane:"sidebar"})})]})}var import_react105;var init_host_sidebar=__esm(async()=>{init_kv();init_notifications();init_i18n2();init_terminal_tabs_move();init_terminal_tabs_shared();init_jsx_runtime();await __promiseAll([init_keyboard_hints2(),init_theme(),init_SidebarTree(),init_terminal_tabs_close()]);import_react105=__toESM(require_react_production(),1)});function HostSidebarMount(props){let{actions,pages,focus,inbox,t:t3}=props;return $jsx(HostSidebar,{width:props.showContent?sidebarWidthFor(props.terminalWidth):props.terminalWidth,nav:pages.nav,onNavChange:pages.goToNav,tasks:props.tasks,selectedId:props.selectedId,selectedTabId:props.selectedTabId,onSelect:(id)=>{props.selectTask(id),pages.setNav("terminal")},onActivate:(id)=>{pages.setNav("terminal"),props.activateTask(id)},onSelectTab:(taskId,tabId)=>{let reClick=pages.nav==="terminal"&&focus.focused!=="sidebar"&&taskId===props.selectedId&&tabId===props.selectedTabId;pages.setNav("terminal"),requestTabActivation(taskId,tabId),focus.setFocused(reClick?"sidebar":"workspace")},engineState:props.daemon.sidebarEngineState,engineTabState:props.daemon.engineTabState,engineLifecycle:props.daemon.engineLifecycle,taskJobs:props.daemon.taskJobs,worktreeChanges:props.daemon.worktreeChanges,transcriptActivity:props.daemon.transcriptActivity,focused:props.activePane==="sidebar",onAddTask:()=>void actions.createTask(),onDeleteRequest:(id)=>void actions.deleteTask(id),onLandRequest:(id)=>void actions.landTask(id),onSyncBaseRequest:(id)=>void actions.syncBase(id),onRenameRequest:(id)=>void actions.renameTask(id),onPinRequest:(id)=>void actions.togglePin(id),onSetStatusRequest:(id)=>void actions.setStatus(id),onCopyRequest:(id,field)=>actions.copyTaskField(id,field),onOpenEditorRequest:props.openTaskWorktree,onRenameBranchRequest:(id)=>void actions.renameBranch(id),onChangeEngineRequest:(id)=>void actions.pickVendor(id),onFieldNotesRequest:actions.showFieldNotes,onFixChecksRequest:props.onFixChecks,onRunAgainRequest:(id)=>void actions.confirmRunAgain(id).then((task)=>task&&props.runAgain(task)),moveMode:props.moveMode,onMoveRequest:(id,delta)=>void actions.moveTask(id,delta),onMoveModeExit:props.exitMoveMode,onLocalMergeRequest:props.onLocalMergeRequest,onSearchActiveChange:props.onSearchActiveChange,sortMode:props.sortMode,headerStatus:{label:`${t3("workspace.inbox.title")} ${inbox.counts.total}`,emphasize:inbox.counts.total>0},onHeaderStatusClick:inbox.show,updateChip:props.update?.hasUpdate?{label:t3("update.chip",{version:props.update.latest})}:null,onUpdateChipClick:pages.openUpdate,zenActive:props.zen,onZenClick:props.toggleZen,onFocusRequest:()=>focus.setFocused("sidebar"),recentTask:props.recentTask,cursorTaskIdRef:props.cursorTaskIdRef})}var init_host_sidebar_mount=__esm(async()=>{init_view_core();init_terminal_tabs_shared();init_jsx_runtime();await init_host_sidebar()});function nextActiveTask(tasks,excludeId){return tasks.find((t3)=>t3.id!==excludeId)}async function stopHostedTask(taskId,logger,logPrefix){let host=await openHostedSessionHost();if(!host)return;try{await killHostedSessions(host.rpc,hostedTaskKeys(await listHostedSessions(host.rpc),taskId))}catch(err){logger.error(`${logPrefix} kill hosted session failed:`,err)}finally{host.close()}}function removedTaskIsActive(orch,taskId){let read=orch.activeTaskSignal;if(typeof read!=="function")return!0;return read.call(orch)()===taskId}async function finishDeletedTaskFlow(opts){let nextTask=nextActiveTask(opts.tasks,opts.taskId);if(opts.updateActiveTask&&opts.orch&&removedTaskIsActive(opts.orch,opts.taskId))await opts.orch.setActiveTask(nextTask?.id??null).catch(()=>{});return await stopHostedTask(opts.taskId,opts.logger,opts.logPrefix),{nextTask}}async function deleteTaskFlow(ctx3,taskId){if(!ctx3.orch)return;let task=ctx3.tasks().find((t3)=>t3.id===taskId);if(!task)return;if(task.kind==="main"){if(!await ctx3.confirm({title:`Remove project "${task.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 ctx3.orch.forgetProject(task.repo)}catch(err){ctx3.logger.error(`${ctx3.logPrefix} forget project failed:`,err),ctx3.notifyError?.(`Couldn't remove: ${errorMessage(err)}`);return}await ctx3.reload?.();return}if(!await ctx3.confirm({title:`Delete "${task.title}"?`,body:task.kind==="dir"?"Removes the task entry. The directory itself stays on disk. Its hosted sessions are stopped.":"Removes the task entry and its worktree. The git branch stays. Its hosted sessions are stopped.",cancelLabel:"cancel",confirmLabel:"delete",danger:!0}))return;let deleted=!1;try{await ctx3.orch.deleteTask(taskId),deleted=!0}catch(err){if(errorMessage(err).includes(DIRTY_WORKTREE_CODE)){if(await ctx3.confirm({title:`"${task.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",danger:!0}))try{await ctx3.orch.deleteTask(taskId,{force:!0}),deleted=!0}catch(forceErr){ctx3.logger.error(`${ctx3.logPrefix} force delete failed:`,forceErr),ctx3.notifyError?.(`Couldn't delete: ${errorMessage(forceErr)}`)}}else ctx3.logger.error(`${ctx3.logPrefix} delete failed:`,err),ctx3.notifyError?.(`Couldn't delete: ${errorMessage(err)}`)}if(!deleted)return;let{nextTask}=await finishDeletedTaskFlow({orch:ctx3.orch,tasks:ctx3.tasks(),taskId,logger:ctx3.logger,logPrefix:ctx3.logPrefix,updateActiveTask:ctx3.updateActiveTask});await ctx3.reload?.(),ctx3.onTaskDeleted?.(taskId,nextTask)}async function renameTaskFlow(ctx3,taskId){let task=ctx3.tasks().find((t3)=>t3.id===taskId);if(!task)return;let next=await ctx3.promptText(task.title);if(!next||!ctx3.orch)return;try{await ctx3.orch.setTitle(taskId,next)}catch(err){ctx3.logger.error(`${ctx3.logPrefix} task.rename failed:`,err),ctx3.notifyError?.(`Couldn't rename task: ${errorMessage(err)}`);return}await ctx3.reload?.()}async function applyVendorChange(ctx3,taskId,next,opts={}){if(!ctx3.orch)return!1;try{await ctx3.orch.setVendor(taskId,next,opts.effort)}catch(err){return ctx3.logger.error(`${ctx3.logPrefix} task.setVendor failed:`,err),ctx3.notifyError?.(`Couldn't switch engine: ${errorMessage(err)}`),!1}if(!opts.silentSuccess)ctx3.notifyInfo?.(`Engine \u2192 ${engineDisplayName(next)} (applies on reopen)`);return!0}async function cycleVendorFlow(ctx3,taskId){let task=ctx3.tasks().find((t3)=>t3.id===taskId);if(!task||!ctx3.orch)return;let engines=await availableEngineIds(),next=nextVendorWithin(engines,task.vendor??DEFAULT_TASK_VENDOR);if(!await applyVendorChange(ctx3,taskId,next))return;await ctx3.reload?.()}async function setStatusFlow(ctx3,taskId){let task=ctx3.tasks().find((t3)=>t3.id===taskId);if(!task||!ctx3.orch||!ctx3.pickStatus)return;let next=await ctx3.pickStatus(task.status);if(!next||next===task.status)return;try{await ctx3.orch.setStatus(taskId,next)}catch(err){ctx3.logger.error(`${ctx3.logPrefix} task.status failed:`,err),ctx3.notifyError?.(`Couldn't set status: ${errorMessage(err)}`);return}ctx3.notifyInfo?.(`Status \u2192 ${next}`),await ctx3.reload?.()}function copyTaskFieldFlow(ctx3,taskId,field){let task=ctx3.tasks().find((candidate)=>candidate.id===taskId);if(!task||!ctx3.copyText)return;let text=field==="branch"?task.branch:task.worktreePath;if(text==="")return;ctx3.copyText(text),ctx3.notifyInfo?.(t(field==="branch"?"tasks.toast.copiedBranch":"tasks.toast.copiedPath",{text}))}var init_task_actions=__esm(()=>{init_account_detect();init_hosted_session();init_interactive_command();init_errors();init_i18n();init_task();init_vendor()});function mainRepoSet(tasks){let out=new Set;for(let task of tasks){if(task.kind!=="main")continue;let key=task.repo.trim().replace(/[\\/]+$/,"");if(key)out.add(key)}return out}async function createTaskFlow(ctx3){let repos=getSavedRepos(),defaultRepo=ctx3.cursorRepo()??repos[0]??process.cwd(),defaultVendor=ctx3.lastVendor(defaultRepo)??DEFAULT_TASK_VENDOR,availableVendors=await availableEngineIds();if(availableVendors.length===0)ctx3.notifyInfo?.("No engine CLI detected \u2014 install a supported engine, or add one in Settings \u2192 Engines");let orch=ctx3.orch,result=await ctx3.promptNewTask(defaultRepo,repos,{defaultVendor,availableVendors,discoverAdoptable:orch?(repo2)=>orch.discoverAdoptableWorktrees(repo2):void 0,mainRepos:mainRepoSet(ctx3.tasks())});if(!result)return;let repo=addSavedRepo(result.repo).path;if(ctx3.rememberVendor(repo,result.vendor),ctx3.onRepoSaved?.(),!orch){ctx3.logger.error(`${ctx3.logPrefix} no daemon; cannot create task`),ctx3.notifyError?.(t("tasks.toast.noDaemonWorktree"));return}if(result.mode==="open"){try{let main=await orch.ensureMainTask(repo);await ctx3.reload?.(),ctx3.selectTask?.(main.id),await ctx3.enterTask?.(main.id)}catch(err){ctx3.logger.error(`${ctx3.logPrefix} ensureMainTask failed:`,err),ctx3.notifyError?.(t("newTask.open.failed",{error:errorMessage(err)}))}return}ctx3.notifyInfo?.("Creating task\u2026");let createdId;if(result.mode==="adopt"){let total=result.adopt.length,adopted=0,firstError;for(let w4 of result.adopt)try{createdId=(await orch.adoptWorktree({repo,worktreePath:w4.worktreePath,branch:w4.branch,vendor:result.vendor})).id,adopted++}catch(err){if(firstError===void 0)firstError=errorMessage(err);ctx3.logger.error(`${ctx3.logPrefix} adoptWorktree failed for ${w4.worktreePath}:`,err)}if(adopted===0){ctx3.notifyError?.(t("newTask.adopt.summaryNone",{error:firstError??""}));return}if(adopted<total)ctx3.notifyInfo?.(t("newTask.adopt.summaryPartial",{done:adopted,total}));else ctx3.notifyInfo?.(t("newTask.adopt.summaryAll",{count:adopted}))}else try{createdId=(await orch.createTask({repo,baseRef:result.baseRef,vendor:result.vendor})).id}catch(err){ctx3.logger.error(`${ctx3.logPrefix} task.create failed:`,err),ctx3.notifyError?.(`Couldn't create task: ${errorMessage(err)}`);return}if(await ctx3.reload?.(),createdId)ctx3.selectTask?.(createdId),await ctx3.enterTask?.(createdId)}var init_task_create_flow=__esm(()=>{init_account_detect();init_repos();init_i18n();init_task()});import{TextAttributes as TextAttributes31}from"@opentui/core";function BranchPickerDialogView(props){let dialog=useDialog(),{theme}=useTheme(),t3=useT(),padX=useDialogPaddingX(),[value,setValue]=import_react107.useState(props.currentBranch),[cursor,setCursor]=import_react107.useState(0),branches=import_react107.useMemo(()=>listLocalBranches(props.repo),[props.repo]),filtered=import_react107.useMemo(()=>filterBranches(branches,value),[branches,value]),window2=windowAround(filtered,cursor,pickerVisibleRows(useTerminalDimensions().height));function move(delta){if(filtered.length===0)return;setCursor((c2)=>clampCursor(c2+delta,filtered.length))}function commit(name){let next=name.trim();if(!next)return;props.onSubmit(next),dialog.clear()}let rows=window2.items.map((name,i2)=>({key:`${window2.start+i2}:${name}`,body:name,accent:value.trim()===name}));return useBindings(()=>({bindings:[{key:"up",cmd:()=>move(-1)},{key:"down",cmd:()=>move(1)}]})),$jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:1,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",children:[$jsx("text",{attributes:TextAttributes31.BOLD,fg:theme.text,children:t3("tasks.reBranch.title")}),$jsx("text",{fg:theme.textMuted,onMouseUp:()=>props.onCancel(),children:"esc"})]}),$jsxs("box",{gap:0,children:[$jsx("text",{fg:theme.accent,children:t3("tasks.reBranch.fieldLabel")}),$jsx("input",{value,placeholder:props.currentBranch,focused:!0,onInput:(v3)=>{setValue(stripNewlines(v3)),setCursor(0)},onSubmit:()=>commit(resolveBaseRef2(value,filtered,cursor))})]}),filtered.length===0?$jsx("box",{gap:0,paddingBottom:1,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:branches.length===0?t3("tasks.reBranch.hintNoBranches"):t3("tasks.reBranch.hintNoMatch")})}):$jsx(PickerList,{window:window2,cursor,rows,onPick:(absoluteIndex)=>commit(filtered[absoluteIndex]??value),paddingBottom:1}),$jsx("box",{paddingBottom:1,children:$jsx("text",{fg:theme.textMuted,children:t3("tasks.reBranch.footer")})})]})}function show3(dialog,opts){return showDialog(dialog,(resolve17)=>$jsx(BranchPickerDialogView,{currentBranch:opts.currentBranch,repo:opts.repo,onSubmit:(v3)=>resolve17(v3),onCancel:()=>resolve17(void 0)}))}var import_react107,BranchPickerDialog;var init_branch_picker_dialog=__esm(async()=>{init_state();init_git_snapshot();init_i18n2();init_jsx_runtime();await __promiseAll([init_react(),init_theme(),init_keymap(),init_dialog(),init_picker_list()]);import_react107=__toESM(require_react_production(),1);BranchPickerDialog={show:show3}});import{TextAttributes as TextAttributes32}from"@opentui/core";function effortLevelsOf(vendor){return engineEntry(vendor).effortLevels??[]}function seedEffort(vendor,current){let trimmed=current?.trim();return trimmed&&effortLevelsOf(vendor).includes(trimmed)?trimmed:NO_EFFORT}function EnginePickerDialogView(props){let dialog=useDialog(),{theme}=useTheme(),t3=useT(),padX=useDialogPaddingX(),{engines}=props,[cursor,setCursor]=import_react108.useState(()=>Math.max(0,engines.indexOf(props.current))),[effort,setEffort2]=import_react108.useState(()=>seedEffort(props.current,props.currentEffort)),window2={items:[...engines],start:0,total:engines.length},cursorEngine=engines[cursor]??props.current,levels=effortLevelsOf(cursorEngine),effortChoices=levels.length>0?[NO_EFFORT,...levels]:[];function move(delta){setCursor((c2)=>{let next=clampCursor(c2+delta,engines.length);return setEffort2((e2)=>seedEffort(engines[next]??props.current,e2)),next})}function stepEffort(delta){if(effortChoices.length===0)return;let i2=effortChoices.indexOf(effort);setEffort2(effortChoices[clampCursor((i2<0?0:i2)+delta,effortChoices.length)]??NO_EFFORT)}function commit(engine3){let applicable=effortLevelsOf(engine3);props.onSubmit({vendor:engine3,...applicable.length>0?{effort:seedEffort(engine3,effort)}:{}}),dialog.clear()}let rows=engines.map((engine3,i2)=>({key:`${i2}:${engine3}`,body:engineDisplayName(engine3),accent:engine3===props.current,dim:engine3===props.current?t3("tasks.changeEngine.current"):void 0}));return useBindings(()=>({bindings:[{key:"up",cmd:()=>move(-1)},{key:"down",cmd:()=>move(1)},{key:"left",cmd:()=>stepEffort(-1)},{key:"right",cmd:()=>stepEffort(1)},{key:"return",cmd:()=>commit(engines[cursor]??props.current)}]})),$jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:1,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",children:[$jsx("text",{attributes:TextAttributes32.BOLD,fg:theme.text,children:t3("tasks.changeEngine.title")}),$jsx("text",{fg:theme.textMuted,onMouseUp:()=>props.onCancel(),children:"esc"})]}),$jsx(PickerList,{window:window2,cursor,rows,onPick:(absoluteIndex)=>commit(engines[absoluteIndex]??props.current),paddingBottom:effortChoices.length>0?0:1}),effortChoices.length>0?$jsx(DialogSection,{label:t3("tasks.changeEngine.effortLabel"),focused:!1,hint:"\u2190/\u2192",children:$jsx(ChipRow,{choices:effortChoices,selected:effort,display:(choice)=>choice===NO_EFFORT?t3("tasks.changeEngine.noEffort"):choice,onPick:(choice)=>setEffort2(choice)})}):null,$jsx("box",{paddingBottom:1,children:$jsx("text",{fg:theme.textMuted,children:effortChoices.length>0?t3("tasks.changeEngine.footerEffort"):t3("tasks.changeEngine.footer")})})]})}function show4(dialog,opts){return showDialog(dialog,(resolve17)=>$jsx(EnginePickerDialogView,{engines:opts.engines,current:opts.current,currentEffort:opts.currentEffort,onSubmit:(v3)=>resolve17(v3),onCancel:()=>resolve17(void 0)}))}var import_react108,NO_EFFORT="",EnginePickerDialog;var init_engine_picker_dialog=__esm(async()=>{init_interactive_command();init_registry();init_state();init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_keymap(),init_dialog(),init_dialog_parts(),init_picker_list()]);import_react108=__toESM(require_react_production(),1);EnginePickerDialog={show:show4}});import{TextAttributes as TextAttributes33}from"@opentui/core";function formatAt(at2){let d2=new Date(at2);if(Number.isNaN(d2.getTime()))return at2;let pad=(n2)=>String(n2).padStart(2,"0");return`${d2.getFullYear()}-${pad(d2.getMonth()+1)}-${pad(d2.getDate())} ${pad(d2.getHours())}:${pad(d2.getMinutes())}`}function FieldNotesDialogView(props){let{theme}=useTheme(),t3=useT(),padX=useDialogPaddingX(),[state,setState]=import_react109.useState({kind:"loading"});import_react109.useEffect(()=>{let live=!0;return props.load().then((notes)=>{if(live)setState({kind:"ready",notes})}).catch((err)=>{if(live)setState({kind:"error",message:err instanceof Error?err.message:String(err)})}),()=>{live=!1}},[props.load]);let scrollRef=import_react109.useRef(null),scrollBy=(lines)=>{let scroll=scrollRef.current;if(!scroll)return;scroll.scrollTo({x:0,y:Math.max(0,scroll.scrollTop+lines)})};return useBindings(()=>({bindings:[{key:"up",cmd:()=>scrollBy(-1)},{key:"down",cmd:()=>scrollBy(1)},{key:"pageup",cmd:()=>scrollBy(-(scrollRef.current?.viewport.height??10))},{key:"pagedown",cmd:()=>scrollBy(scrollRef.current?.viewport.height??10)}]})),$jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:1,flexShrink:1,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",flexShrink:0,children:[$jsxs("box",{flexDirection:"column",gap:0,children:[$jsx("text",{attributes:TextAttributes33.BOLD,fg:theme.text,children:t3("tasks.fieldNotes.title")}),$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:props.repo})]}),$jsx("text",{fg:theme.textMuted,onMouseUp:props.onClose,children:"esc"})]}),$jsx("scrollbox",{ref:(r6)=>{scrollRef.current=r6},flexShrink:1,stickyScroll:!1,verticalScrollbarOptions:{trackOptions:{backgroundColor:theme.backgroundDialog,foregroundColor:theme.borderActive}},children:$jsxs("box",{gap:1,paddingRight:1,children:[state.kind==="loading"?$jsx("text",{fg:theme.textMuted,children:t3("tasks.fieldNotes.loading")}):null,state.kind==="error"?$jsx("text",{fg:theme.error,children:state.message}):null,state.kind==="ready"&&state.notes.length===0?$jsx("text",{fg:theme.textMuted,children:t3("tasks.fieldNotes.empty")}):null,state.kind==="ready"?state.notes.map((note2,i2)=>$jsxs("box",{gap:0,children:[$jsx("text",{fg:theme.accent,wrapMode:"none",children:`${formatAt(note2.at)} \xB7 ${note2.author}`}),$jsx("text",{fg:theme.text,children:note2.text})]},`${note2.at}:${i2}`)):null]})}),$jsx("box",{paddingBottom:1,flexShrink:0,children:$jsx("text",{fg:theme.textMuted,children:t3("tasks.fieldNotes.footer")})})]})}function show5(dialog,opts){showDialog(dialog,(resolve17)=>$jsx(FieldNotesDialogView,{repo:opts.repo,load:opts.load,onClose:()=>resolve17(void 0)}))}var import_react109,FieldNotesDialog;var init_field_notes_dialog=__esm(async()=>{init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_keymap(),init_dialog()]);import_react109=__toESM(require_react_production(),1);FieldNotesDialog={show:show5}});import{TextAttributes as TextAttributes34}from"@opentui/core";function RunAgainDialogView(props){let{theme}=useTheme(),t3=useT(),dialog=useDialog(),padX=useDialogPaddingX(),[active,setActive2]=import_react110.useState("confirm"),commit=()=>{props.onConfirm(),dialog.clear({refocus:!1})},cancel=()=>{props.onCancel(),dialog.clear()},scrollRef=import_react110.useRef(null),scrollBy=(lines)=>{let scroll=scrollRef.current;if(!scroll)return;scroll.scrollTo({x:0,y:Math.max(0,scroll.scrollTop+lines)})};return useBindings(()=>({bindings:[{key:"up",cmd:()=>scrollBy(-1)},{key:"down",cmd:()=>scrollBy(1)},{key:"pageup",cmd:()=>scrollBy(-(scrollRef.current?.viewport.height??10))},{key:"pagedown",cmd:()=>scrollBy(scrollRef.current?.viewport.height??10)},{key:"left",cmd:()=>setActive2((a2)=>a2==="confirm"?"cancel":"confirm")},{key:"right",cmd:()=>setActive2((a2)=>a2==="confirm"?"cancel":"confirm")},{key:"return",cmd:()=>active==="confirm"?commit():cancel()}]})),$jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:1,flexShrink:1,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",flexShrink:0,children:[$jsxs("box",{flexDirection:"column",gap:0,children:[$jsx("text",{attributes:TextAttributes34.BOLD,fg:theme.text,children:t3("tasks.runAgain.title")}),$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("tasks.runAgain.source",{title:props.taskTitle})})]}),$jsx("text",{fg:theme.textMuted,onMouseUp:cancel,children:"esc"})]}),$jsx("scrollbox",{ref:(r6)=>{scrollRef.current=r6},flexShrink:1,stickyScroll:!1,verticalScrollbarOptions:{trackOptions:{backgroundColor:theme.backgroundDialog,foregroundColor:theme.borderActive}},children:$jsx("box",{paddingRight:1,children:$jsx("text",{fg:theme.text,children:props.prompt})})}),$jsx("text",{fg:theme.textMuted,flexShrink:0,children:t3("tasks.runAgain.hint")}),$jsx("box",{flexDirection:"row",justifyContent:"flex-end",flexShrink:0,children:["cancel","confirm"].map((key)=>$jsx("box",{paddingLeft:1,paddingRight:1,backgroundColor:key===active?theme.primary:void 0,onMouseUp:()=>key==="confirm"?commit():cancel(),children:$jsx("text",{fg:key===active?theme.selectedListItemText:theme.textMuted,children:key==="cancel"?t3("common.cancel"):t3("tasks.runAgain.confirm")})},key))}),$jsx("box",{paddingBottom:1,flexShrink:0,children:$jsx("text",{fg:theme.textMuted,children:t3("tasks.runAgain.footer")})})]})}function show6(dialog,opts){return showDialog(dialog,(resolve17)=>$jsx(RunAgainDialogView,{taskTitle:opts.taskTitle,prompt:opts.prompt,onConfirm:()=>resolve17(!0),onCancel:()=>resolve17(!1)}),{size:"medium"})}var import_react110,RunAgainDialog;var init_run_again_dialog=__esm(async()=>{init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_keymap(),init_dialog()]);import_react110=__toESM(require_react_production(),1);RunAgainDialog={show:show6}});function StatusPickerDialogView(props){let dialog=useDialog(),t3=useT(),padX=useDialogPaddingX(),[cursor,setCursor]=import_react111.useState(()=>Math.max(0,TASK_STATUSES.indexOf(props.current))),window2={items:[...TASK_STATUSES],start:0,total:TASK_STATUSES.length};function move(delta){setCursor((c2)=>clampCursor(c2+delta,TASK_STATUSES.length))}function commit(status){props.onSubmit(status),dialog.clear()}let rows=TASK_STATUSES.map((status,i2)=>({key:`${i2}:${status}`,body:t3(STATUS_LABEL_KEY[status]),accent:status===props.current,dim:status===props.current?t3("tasks.setStatus.current"):void 0}));return useBindings(()=>({bindings:[{key:"up",cmd:()=>move(-1)},{key:"down",cmd:()=>move(1)},{key:"return",cmd:()=>commit(TASK_STATUSES[cursor]??props.current)}]})),$jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:1,children:[$jsx(DialogHeader,{title:t3("tasks.setStatus.title"),onClose:()=>props.onCancel()}),$jsx(PickerList,{window:window2,cursor,rows,onPick:(absoluteIndex)=>commit(TASK_STATUSES[absoluteIndex]??props.current),paddingBottom:1}),$jsx(DialogFooter,{children:t3("tasks.setStatus.footer")})]})}function show7(dialog,opts){return showDialog(dialog,(resolve17)=>$jsx(StatusPickerDialogView,{current:opts.current,onSubmit:(v3)=>resolve17(v3),onCancel:()=>resolve17(void 0)}))}var import_react111,STATUS_LABEL_KEY,StatusPickerDialog;var init_status_picker_dialog=__esm(async()=>{init_state();init_task();init_i18n2();init_jsx_runtime();await __promiseAll([init_keymap(),init_dialog(),init_dialog_parts(),init_picker_list()]);import_react111=__toESM(require_react_production(),1),STATUS_LABEL_KEY={backlog:"tasks.status.backlog",in_progress:"tasks.status.inProgress",in_review:"tasks.status.inReview",done:"tasks.status.done",canceled:"tasks.status.canceled",error:"tasks.status.error"};StatusPickerDialog={show:show7}});function AdoptTab({vm}){let{theme}=useTheme(),t3=useT(),rows=vm.adoptVisible.map((w4)=>{let tags=[w4.dirty?"dirty":"",w4.kobeManaged?"":"external"].filter(Boolean).join(",");return{key:w4.path,body:`${vm.adoptSelected.has(w4.path)?"[x] ":"[ ] "}${w4.branch}${tags?` (${tags})`:""}`,accent:vm.adoptSelected.has(w4.path)}});return $jsxs($Fragment2,{children:[$jsx(DialogSection,{label:t3("newTask.field.adoptFilter"),focused:vm.field==="adoptFilter",onPress:()=>vm.setField("adoptFilter"),children:$jsx(DialogField,{focused:vm.field==="adoptFilter",children:$jsx("input",{value:vm.adoptFilter,placeholder:t3("newTask.placeholder.adoptFilter"),focused:vm.field==="adoptFilter",onMouseUp:()=>vm.setField("adoptFilter"),onInput:(v3)=>vm.setAdoptFilterText(v3),onSubmit:()=>vm.toggleAdoptCursor()})})}),$jsx("box",{paddingLeft:2,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("newTask.adopt.repoLine",{path:vm.expandedRepo||t3("newTask.adopt.repoNone")})})}),vm.adoptLoading?$jsx("box",{paddingLeft:2,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("newTask.hint.scanningWorktrees")})}):null,!vm.adoptLoading&&vm.adoptList.length===0?$jsx("box",{paddingLeft:2,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:vm.adoptDiscoveredCount===0?t3("newTask.adopt.noUnlinked"):t3("newTask.adopt.noMatch")})}):null,vm.adoptList.length>0?$jsx(PickerList,{window:vm.adoptWindow,cursor:vm.adoptCursor,rows,onPick:vm.pickAdoptAt,footer:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:vm.adoptSelected.size>0?t3("newTask.adopt.hintSelected",{count:vm.adoptSelected.size}):t3("newTask.adopt.hintDefault")})}):null]})}var init_tab_adopt=__esm(async()=>{init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_dialog_parts(),init_picker_list()])});function CloneTab({vm}){let{theme}=useTheme(),t3=useT(),parentRows=vm.cloneParentWindow.items.map((name,i2)=>({key:`${vm.cloneParentWindow.start+i2}:${name}`,body:`${name}/`}));return $jsxs($Fragment2,{children:[$jsx(DialogSection,{label:t3("newTask.field.gitUrl"),focused:vm.field==="cloneUrl",onPress:()=>vm.setField("cloneUrl"),children:$jsx(DialogField,{focused:vm.field==="cloneUrl",children:$jsx("input",{value:vm.cloneUrl,placeholder:"https://github.com/user/repo.git",focused:vm.field==="cloneUrl",onMouseUp:()=>vm.setField("cloneUrl"),onInput:(v3)=>vm.setCloneUrlText(v3),onSubmit:()=>{if(!vm.cloneUrl.trim())return;vm.setField("cloneParent")}})})}),$jsx(DialogSection,{label:t3("newTask.field.parentDir"),focused:vm.field==="cloneParent",onPress:()=>vm.setField("cloneParent"),children:$jsx(DialogField,{focused:vm.field==="cloneParent",children:$jsx("input",{value:vm.cloneParent,placeholder:"~/",focused:vm.field==="cloneParent",onMouseUp:()=>vm.setField("cloneParent"),onInput:(v3)=>vm.setCloneParentText(v3),onSubmit:()=>vm.onCloneParentSubmit()})})}),vm.field==="cloneParent"?$jsx("box",{paddingLeft:2,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("newTask.hint.remembered")})}):null,vm.field==="cloneParent"&&vm.cloneParentFiltered.length>0&&!vm.cloneParentPicked?$jsx(PickerList,{window:vm.cloneParentWindow,cursor:vm.cloneParentCursor,rows:parentRows,onPick:vm.selectCloneParentAt}):null,$jsx(DialogSection,{label:t3("newTask.field.folderName"),focused:vm.field==="cloneFolder",onPress:()=>vm.setField("cloneFolder"),children:$jsx(DialogField,{focused:vm.field==="cloneFolder",children:$jsx("input",{value:vm.cloneFolder,placeholder:t3("newTask.placeholder.folderName"),focused:vm.field==="cloneFolder",onMouseUp:()=>vm.setField("cloneFolder"),onInput:(v3)=>vm.setCloneFolderText(v3),onSubmit:()=>vm.setField("cloneBaseRef")})})}),$jsx(DialogSection,{label:t3("newTask.field.baseBranch"),focused:vm.field==="cloneBaseRef",onPress:()=>vm.setField("cloneBaseRef"),children:$jsx(DialogField,{focused:vm.field==="cloneBaseRef",children:$jsx("input",{value:vm.cloneBaseRef,placeholder:DEFAULT_BASE_REF,focused:vm.field==="cloneBaseRef",onMouseUp:()=>vm.setField("cloneBaseRef"),onInput:(v3)=>vm.setCloneBaseRefText(v3),onSubmit:()=>void vm.commitClone()})})}),vm.cloneInFlight?$jsx("box",{gap:0,paddingLeft:2,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:vm.cloneProgress||t3("newTask.clone.progressFallback")})}):null]})}var init_tab_clone=__esm(async()=>{init_git_snapshot();init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_dialog_parts(),init_picker_list()])});function ExistingTab({vm}){let{theme}=useTheme(),t3=useT(),repoRows=vm.activeWindow.items.map((name,i2)=>{let tag=vm.mode==="saved"&&name===vm.defaultRepo?` ${t3("newTask.hint.currentDir")}`:"";if(vm.mode==="browse")return{key:`${vm.activeWindow.start+i2}:${name}`,body:`${name}/${tag}`,accent:!1};let{base,dir}=splitRepoRow(name);return{key:`${vm.activeWindow.start+i2}:${name}`,body:`${base}${tag}`,accent:vm.expandedRepo===name,...dir?{dim:dir}:{}}}),branchRows=vm.branchWindow.items.map((name,i2)=>({key:`${vm.branchWindow.start+i2}:${name}`,body:name,accent:vm.baseRef.trim()===name})),intents=["task","project"],intentLabel={task:t3("newTask.intent.task"),project:t3("newTask.intent.project")};return $jsxs($Fragment2,{children:[$jsx(DialogSection,{label:t3("newTask.field.repo"),focused:vm.field==="repo",onPress:()=>vm.setField("repo"),children:$jsx(DialogField,{focused:vm.field==="repo",children:$jsxs("box",{flexDirection:"row",children:[$jsx("input",{value:vm.repo,placeholder:splitRepoRow(vm.defaultRepo).base,focused:vm.field==="repo",onMouseUp:()=>vm.setField("repo"),onInput:(v3)=>vm.setRepoText(v3),onSubmit:()=>vm.onRepoSubmit(),flexGrow:vm.repoDir?0:1,flexShrink:0,...vm.repoDir?{flexBasis:REPO_INPUT_CELLS}:{}}),vm.repoDir?$jsx("text",{fg:theme.textMuted,wrapMode:"none",flexShrink:1,children:` ${vm.repoDir}`}):null]})})}),vm.field==="repo"&&vm.activeList.length>0&&!vm.repoPicked?$jsx(PickerList,{window:vm.activeWindow,cursor:vm.repoCursor,rows:repoRows,onPick:vm.selectRepoAt}):null,vm.canOpenProject?$jsx(DialogSection,{label:t3("newTask.field.opens"),focused:vm.field==="intent",hint:"\u2190/\u2192",onPress:()=>vm.setField("intent"),children:$jsx(ChipRow,{choices:intents,selected:vm.intent,display:(choice)=>intentLabel[choice],onPick:(choice)=>{vm.setIntent(choice),vm.setField("intent")}})}):null,vm.intent==="project"&&vm.canOpenProject?null:$jsx(DialogSection,{label:t3("newTask.field.fromBranch"),focused:vm.field==="baseRef",onPress:()=>vm.setField("baseRef"),children:$jsx(DialogField,{focused:vm.field==="baseRef",children:$jsx("input",{value:vm.baseRef,placeholder:DEFAULT_BASE_REF,focused:vm.field==="baseRef",onMouseUp:()=>vm.setField("baseRef"),onInput:(v3)=>vm.setBaseRefText(v3),onSubmit:()=>vm.onBaseRefSubmit()})})}),vm.field==="baseRef"&&vm.branchFiltered.length===0&&vm.submitError==null?$jsx("box",{gap:0,paddingLeft:2,paddingBottom:1,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:vm.branches.length===0?t3("newTask.hint.noBranchesFound"):t3("newTask.hint.noMatchBranch")})}):null,vm.field==="baseRef"&&vm.branchFiltered.length>0?$jsx(PickerList,{window:vm.branchWindow,cursor:vm.branchCursor,rows:branchRows,onPick:vm.pickBranchAt,paddingBottom:1}):null]})}var REPO_INPUT_CELLS=28;var init_tab_existing=__esm(async()=>{init_state();init_git_snapshot();init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_dialog_parts(),init_picker_list()])});function splitRepoInput(value,resolved){if(!resolved)return{name:value,dir:""};let{base,dir}=splitRepoRow(value.trim());return{name:base,dir}}function resolveRepoInput(value,repoOptions){let trimmed=value.trim();if(!trimmed||trimmed.includes("/")||trimmed.startsWith("~"))return{kind:"path",path:trimmed};let matches=repoOptions.filter((p3)=>splitRepoRow(p3).base===trimmed);if(matches.length===1)return{kind:"path",path:matches[0]};if(matches.length>1)return{kind:"ambiguous",name:trimmed,matches};return{kind:"path",path:trimmed}}function nameOrPath(path22,repoOptions){let name=splitRepoInput(path22,!0).name,back=resolveRepoInput(name,repoOptions);return back.kind==="path"&&back.path===path22?name:path22}var init_repo_field=__esm(()=>{init_state()});function resolveVendorSet(available){return available&&available.length>0?available:ALL_VENDORS}function resolveInitialVendor(set,preferred){let pref=preferred??DEFAULT_TASK_VENDOR;return set.includes(pref)?pref:set[0]??DEFAULT_TASK_VENDOR}function toggleInSet(prev,path22){let next=new Set(prev);if(next.has(path22))next.delete(path22);else next.add(path22);return next}function toggleSelectAll(prev,paths){if(paths.length===0)return prev;return paths.every((p3)=>prev.has(p3))?new Set:new Set(paths)}var init_pure=__esm(()=>{init_task();init_vendor()});function useAdoptState(args2){let[adoptFilter,setAdoptFilter]=import_react113.useState(""),[adoptCursor,setAdoptCursor]=import_react113.useState(0),[adoptSelected,setAdoptSelected]=import_react113.useState(new Set),[adoptable,setAdoptable]=import_react113.useState(void 0),[adoptLoading,setAdoptLoading]=import_react113.useState(!1),adoptList=import_react113.useMemo(()=>filterAdoptableByGlob(adoptable??[],adoptFilter),[adoptable,adoptFilter]),adoptWindow=windowAround(adoptList.map((w4)=>w4.path),adoptCursor,pickerVisibleRows(useTerminalDimensions().height)),adoptVisible=adoptList.slice(adoptWindow.start,adoptWindow.start+adoptWindow.items.length),adoptDiscoveredCount=(adoptable??[]).length,{active,expandedRepo,discoverAdoptable}=args2;import_react113.useEffect(()=>{if(!active)return;let disposed=!1;return setAdoptLoading(!0),(async()=>{let list2=[];try{list2=discoverAdoptable?await discoverAdoptable(expandedRepo):[]}catch{list2=[]}if(disposed)return;setAdoptable(list2),setAdoptLoading(!1)})(),()=>{disposed=!0}},[active,expandedRepo,discoverAdoptable]),import_react113.useEffect(()=>{setAdoptCursor((c2)=>clampCursor(c2,adoptList.length))},[adoptList]);let prevRepo=import_react113.useRef(void 0);import_react113.useEffect(()=>{if(prevRepo.current!==void 0&&prevRepo.current!==expandedRepo)setAdoptSelected(new Set),setAdoptCursor(0);prevRepo.current=expandedRepo},[expandedRepo]);function setAdoptFilterText(v3){setAdoptFilter(stripNewlines(v3))}function toggleAdopt(path22){setAdoptSelected((prev)=>toggleInSet(prev,path22))}function toggleAdoptCursor(){let w4=adoptList[adoptCursor];if(w4)toggleAdopt(w4.path)}function pickAdoptAt(absoluteIndex){let w4=adoptList[absoluteIndex];if(!w4)return;setAdoptCursor(absoluteIndex),toggleAdopt(w4.path)}function adoptSelectAll(){setAdoptSelected((prev)=>toggleSelectAll(prev,adoptList.map((w4)=>w4.path)))}function moveAdoptCursor(delta){if(adoptList.length===0)return;setAdoptCursor((c2)=>clampCursor(c2+delta,adoptList.length))}function commitAdopt(){if(adoptList.length===0){args2.setSubmitError(t("newTask.error.noAdoptable"));return}let chosen=adoptSelected.size>0?adoptList.filter((w4)=>adoptSelected.has(w4.path)):adoptList.slice(adoptCursor,adoptCursor+1);if(chosen.length===0)return;args2.onSubmit({mode:"adopt",repo:expandedRepo,vendor:args2.vendor,adopt:chosen.map((w4)=>({worktreePath:w4.path,branch:w4.branch}))}),args2.clearDialog()}return{adoptFilter,adoptLoading,adoptDiscoveredCount,adoptList,adoptWindow,adoptVisible,adoptCursor,adoptSelected,setAdoptFilterText,toggleAdoptCursor,pickAdoptAt,adoptSelectAll,moveAdoptCursor,commitAdopt}}var import_react113;var init_use_adopt_state=__esm(async()=>{init_state();init_i18n2();init_pure();await init_react();import_react113=__toESM(require_react_production(),1)});import{spawn as spawn12}from"child_process";import*as fs5 from"fs";import*as path22 from"path";function deriveFolderName(url){let trimmed=url.trim().replace(/\/+$/,"");if(!trimmed)return"";let lastSlash=trimmed.lastIndexOf("/"),lastColon=trimmed.lastIndexOf(":"),cutAt=Math.max(lastSlash,lastColon);return(cutAt>=0?trimmed.slice(cutAt+1):trimmed).replace(/\.git$/i,"")}function validateGitUrl(url){let trimmed=url.trim();if(!trimmed)return t("newTask.error.gitUrlRequired");let hasProtocol=trimmed.includes("://"),hasScpSep=trimmed.includes("@")&&trimmed.includes(":"),hasPathSep=trimmed.includes("/");if(!hasProtocol&&!hasScpSep&&!hasPathSep)return t("newTask.error.gitUrlInvalid",{url:trimmed});return null}function validateCloneTarget(parentDir,folder){let folderTrimmed=folder.trim();if(!folderTrimmed)return t("newTask.error.folderRequired");if(folderTrimmed.includes("/")||folderTrimmed.includes("\\"))return t("newTask.error.folderHasSeparator");let parentTrimmed=parentDir.trim();if(!parentTrimmed)return t("newTask.error.parentRequired");let parentExpanded=expandHome(parentTrimmed),parentStat;try{parentStat=fs5.statSync(parentExpanded)}catch{return t("newTask.error.parentNotFound",{path:parentExpanded})}if(!parentStat.isDirectory())return t("newTask.error.parentNotDir",{path:parentExpanded});let target=path22.join(parentExpanded,folderTrimmed);if(fs5.existsSync(target))return t("newTask.error.targetExists",{path:target});return null}function resolveCloneTarget(parentDir,folder){return path22.join(expandHome(parentDir.trim()),folder.trim())}function findAvailableFolderName(parentDir,base){let trimmed=base.trim();if(!trimmed)return base;let parentExpanded=expandHome(parentDir.trim());if(!parentExpanded)return base;try{if(!fs5.statSync(parentExpanded).isDirectory())return base}catch{return base}if(!fs5.existsSync(path22.join(parentExpanded,trimmed)))return trimmed;for(let n2=2;n2<1000;n2++){let candidate=`${trimmed}-${n2}`;if(!fs5.existsSync(path22.join(parentExpanded,candidate)))return candidate}return trimmed}function cloneRepo(url,target,onProgress){return new Promise((resolve17)=>{let stderrBuf="";try{let child=spawn12("git",["clone","--progress",url,target],{stdio:["ignore","ignore","pipe"],env:{...process.env,GIT_TERMINAL_PROMPT:"0",GIT_ASKPASS:""}});child.stderr?.setEncoding("utf-8"),child.stderr?.on("data",(chunk)=>{if(stderrBuf+=chunk,onProgress){let lines=chunk.split(/[\r\n]+/).filter((s2)=>s2.trim().length>0),last=lines[lines.length-1];if(last)onProgress(last)}}),child.on("error",(err)=>{resolve17({ok:!1,error:err.message})}),child.on("close",(code)=>{if(code===0){resolve17({ok:!0,path:target});return}let tail2=stderrBuf.split(/[\r\n]+/).filter((s2)=>s2.trim().length>0).pop()??`git clone exited with ${code}`;resolve17({ok:!1,error:tail2})})}catch(err){resolve17({ok:!1,error:errorMessage(err)})}})}var init_clone=__esm(()=>{init_i18n();init_path_helpers()});function useDerivedDir(value){let split=import_react114.useMemo(()=>splitPathForDirSuggest(value),[value]),filtered=import_react114.useMemo(()=>filterSubdirs(listSubdirs(split.base),split.filter),[split]);return{split,filtered}}var import_react114;var init_use_derived_dir=__esm(()=>{init_path_helpers();import_react114=__toESM(require_react_production(),1)});function useCloneState(args2){let[cloneUrl,setCloneUrl]=import_react116.useState(""),[cloneParent,setCloneParent]=import_react116.useState(args2.defaultCloneParent?.trim()?args2.defaultCloneParent:"~/"),[cloneFolder,setCloneFolder]=import_react116.useState(""),[cloneFolderTouched,setCloneFolderTouched]=import_react116.useState(!1),[cloneBaseRef,setCloneBaseRef]=import_react116.useState(DEFAULT_BASE_REF),[cloneInFlight,setCloneInFlight]=import_react116.useState(!1),[cloneProgress,setCloneProgress]=import_react116.useState(""),[cloneParentCursor,setCloneParentCursor]=import_react116.useState(0),[cloneParentPicked,setCloneParentPicked]=import_react116.useState(!1),{split:cloneParentSplit,filtered:cloneParentFiltered}=useDerivedDir(cloneParent),cloneParentWindow=windowAround(cloneParentFiltered,cloneParentCursor,pickerVisibleRows(useTerminalDimensions().height));import_react116.useEffect(()=>{if(cloneFolderTouched)return;setCloneFolder(findAvailableFolderName(cloneParent,deriveFolderName(cloneUrl)))},[cloneUrl,cloneParent,cloneFolderTouched]);function setCloneUrlText(v3){setCloneUrl(stripNewlines(v3))}function setCloneParentText(v3){setCloneParentPicked(!1),setCloneParent(stripNewlines(v3)),setCloneParentCursor(0)}function setCloneFolderText(v3){setCloneFolderTouched(!0),setCloneFolder(stripNewlines(v3))}function setCloneBaseRefText(v3){setCloneBaseRef(stripNewlines(v3))}function onCloneParentSubmit(){let picked=cloneParentFiltered[cloneParentCursor];if(picked)setCloneParent(joinPicked(cloneParent,cloneParentSplit.base,picked)),setCloneParentCursor(0),setCloneParentPicked(!0);args2.setField("cloneFolder")}function selectCloneParentAt(absoluteIndex){let picked=cloneParentFiltered[absoluteIndex];if(!picked)return;setCloneParent(joinPicked(cloneParent,cloneParentSplit.base,picked)),setCloneParentCursor(absoluteIndex),setCloneParentPicked(!0),args2.setField("cloneFolder")}function moveParentCursor(delta){if(cloneParentFiltered.length===0)return;setCloneParentCursor((c2)=>clampCursor(c2+delta,cloneParentFiltered.length))}async function commitClone(){if(cloneInFlight)return;let urlReason=validateGitUrl(cloneUrl);if(urlReason){args2.setSubmitError(urlReason),args2.setField("cloneUrl");return}let targetReason=validateCloneTarget(cloneParent,cloneFolder);if(targetReason){args2.setSubmitError(targetReason);let folder=cloneFolder.trim(),parentAtFault=!(!folder||folder.includes("/")||folder.includes("\\"))&&validateCloneTarget(cloneParent,"__kobe_probe__")!=null;args2.setField(parentAtFault?"cloneParent":"cloneFolder");return}let target=resolveCloneTarget(cloneParent,cloneFolder);setCloneInFlight(!0),setCloneProgress(t("newTask.clone.progressInto",{target}));let result=await cloneRepo(cloneUrl.trim(),target,(line)=>setCloneProgress(line));if(setCloneInFlight(!1),!result.ok){args2.setSubmitError(t("newTask.error.cloneFailed",{error:result.error})),args2.setField("cloneUrl");return}let b3=cloneBaseRef.trim()||DEFAULT_BASE_REF;args2.onSubmit({repo:result.path,baseRef:b3,vendor:args2.vendor,cloned:{parentDir:expandHome(cloneParent.trim())}}),args2.clearDialog()}return{cloneUrl,cloneParent,cloneFolder,cloneBaseRef,cloneInFlight,cloneProgress,cloneParentFiltered,cloneParentWindow,cloneParentCursor,cloneParentPicked,setCloneUrlText,setCloneParentText,setCloneFolderText,setCloneBaseRefText,onCloneParentSubmit,selectCloneParentAt,moveParentCursor,commitClone}}var import_react116;var init_use_clone_state=__esm(async()=>{init_clone();init_state();init_git_snapshot();init_path_helpers();init_i18n2();init_use_derived_dir();await init_react();import_react116=__toESM(require_react_production(),1)});function useNewTaskViewModel(props){let dialog=useDialog(),[tab,setTab]=import_react118.useState("existing"),vendors=resolveVendorSet(props.availableVendors),[vendor,setVendor]=import_react118.useState(()=>resolveInitialVendor(resolveVendorSet(props.availableVendors),props.defaultVendor)),[field,setField]=import_react118.useState("tabs"),[repo,setRepo]=import_react118.useState(()=>nameOrPath(props.defaultRepo,computeRepoOptions(props.defaultRepo,props.savedRepos))),[baseRef,setBaseRef]=import_react118.useState(()=>getCurrentBranch(expandHome(props.defaultRepo.trim()))??DEFAULT_BASE_REF),[baseRefTouched,setBaseRefTouched]=import_react118.useState(!1),[repoCursor,setRepoCursor]=import_react118.useState(0),[repoPicked,setRepoPicked]=import_react118.useState(!1),[branchCursor,setBranchCursor]=import_react118.useState(0),[intent,setIntent]=import_react118.useState("task"),[submitError,setSubmitError]=import_react118.useState(null),repoOptions=import_react118.useMemo(()=>computeRepoOptions(props.defaultRepo,props.savedRepos),[props.defaultRepo,props.savedRepos]),pickerRows=pickerVisibleRows(useTerminalDimensions().height),mode=pickerModeFor(repo,repoOptions),repoResolution=resolveRepoInput(repo,repoOptions),repoDir=repoResolution.kind==="path"&&repoResolution.path!==repo.trim()?splitRepoInput(repoResolution.path,!0).dir:"",{split:subdirSplit,filtered:subdirFiltered}=useDerivedDir(repo),savedFiltered=import_react118.useMemo(()=>filterRepos(repoOptions,repo),[repoOptions,repo]),activeList=mode==="browse"?subdirFiltered:savedFiltered,activeWindow=windowAround(activeList,repoCursor,pickerRows),expandedRepo=repoResolution.kind==="path"?expandHome(repoResolution.path):"",canOpenProject=offersProjectIntent(expandedRepo,props.mainRepos??EMPTY_MAIN_REPOS),branches=import_react118.useMemo(()=>listLocalBranches(expandedRepo),[expandedRepo]),branchFiltered=import_react118.useMemo(()=>filterBranches(branches,baseRef),[branches,baseRef]),branchWindow=windowAround(branchFiltered,branchCursor,pickerRows),clone=useCloneState({defaultCloneParent:props.defaultCloneParent,vendor,onSubmit:props.onSubmit,clearDialog:()=>dialog.clear(),setField,setSubmitError}),adopt2=useAdoptState({active:tab==="adopt",expandedRepo,vendor,discoverAdoptable:props.discoverAdoptable,onSubmit:props.onSubmit,clearDialog:()=>dialog.clear(),setSubmitError});import_react118.useEffect(()=>{if(!expandedRepo||baseRefTouched)return;let current=getCurrentBranch(expandedRepo);if(current)setBaseRef(current)},[expandedRepo,baseRefTouched]),import_react118.useEffect(()=>{setSubmitError(null)},[repo,clone.cloneUrl,clone.cloneParent,clone.cloneFolder,adopt2.adoptFilter]);function changeRepo(next){setRepo(next),setIntent("task")}function pickRepo(path23){changeRepo(nameOrPath(path23,repoOptions))}function setRepoText(v3){setRepoPicked(!1),changeRepo(stripNewlines(v3)),setRepoCursor(0),setBranchCursor(0)}function setBaseRefText(v3){setBaseRefTouched(!0),setBaseRef(stripNewlines(v3)),setBranchCursor(0)}function commitExisting(){if(repoResolution.kind==="ambiguous"){setSubmitError(t("newTask.error.repoAmbiguous",{name:repoResolution.name})),setField("repo"),setRepoPicked(!1);return}let r6=expandedRepo;if(!r6)return;let reason=validateRepoPath(r6);if(reason){setSubmitError(reason),setField("repo");return}if(intent==="project"&&canOpenProject){props.onSubmit({mode:"open",repo:r6,vendor}),dialog.clear();return}let b3=baseRef.trim()||DEFAULT_BASE_REF;props.onSubmit({repo:r6,baseRef:b3,vendor}),dialog.clear()}function commit(){if(tab==="clone"){clone.commitClone();return}if(tab==="adopt"){adopt2.commitAdopt();return}commitExisting()}function advanceField(from){let next=nextField(from,tab,{intentVisible:tab==="existing"&&canOpenProject});if(next==="baseRef"&&tab==="existing"&&intent==="project"&&canOpenProject)return nextField(next,tab);return next}function switchToTab(next){if(clone.cloneInFlight||next===tab)return;setTab(next),setField(firstFieldFor(next)),setSubmitError(null)}function cycleTab2(dir){if(clone.cloneInFlight)return;let next=dir===1?nextDialogTab(tab):prevDialogTab(tab);if(next===tab)return;setTab(next),setSubmitError(null),setField("tabs")}function cycleEngine(dir){setVendor((v3)=>dir===1?nextVendorWithin(vendors,v3):prevVendorWithin(vendors,v3))}function onRepoSubmit(){if(!repo.trim()&&mode==="saved"){let picked2=activeList[0];if(picked2){pickRepo(picked2),setField(advanceField("repo"));return}}if(mode==="browse"){let picked2=subdirFiltered[repoCursor];if(picked2)pickRepo(joinPicked(repo,subdirSplit.base,picked2)),setRepoCursor(0),setRepoPicked(!0);setField(advanceField("repo"));return}let picked=activeList[repoCursor];if(picked)pickRepo(picked);setField(advanceField("repo"))}function selectRepoAt(absoluteIndex){let picked=activeList[absoluteIndex];if(!picked)return;if(mode==="browse")pickRepo(joinPicked(repo,subdirSplit.base,picked)),setRepoPicked(!0);else pickRepo(picked);setRepoCursor(absoluteIndex),setField(advanceField("repo"))}function pickBranchAt(absoluteIndex){let name=branchFiltered[absoluteIndex];if(!name)return;setBaseRef(name),setBaseRefTouched(!0),setBranchCursor(absoluteIndex),setField("confirm")}function onBaseRefSubmit(){setBaseRef(resolveBaseRef2(baseRef,branchFiltered,branchCursor)),setBaseRefTouched(!0),commitExisting()}function moveCursor(delta){if(clone.cloneInFlight)return;if(tab==="existing"&&field==="repo"&&activeList.length>0){setRepoCursor((c2)=>clampCursor(c2+delta,activeList.length));return}if(tab==="existing"&&field==="baseRef"&&branchFiltered.length>0){setBranchCursor((c2)=>clampCursor(c2+delta,branchFiltered.length));return}if(tab==="clone"&&field==="cloneParent"){clone.moveParentCursor(delta);return}if(tab==="adopt")adopt2.moveAdoptCursor(delta)}return useBindings(()=>({bindings:[{key:"tab",cmd:()=>setField(advanceField)},{key:"ctrl+]",cmd:()=>switchToTab(nextDialogTab(tab))},{key:"ctrl+[",cmd:()=>switchToTab(prevDialogTab(tab))},{key:"ctrl+e",cmd:()=>cycleEngine(1)},{key:"up",cmd:()=>moveCursor(-1)},{key:"down",cmd:()=>moveCursor(1)},...field==="tabs"||field==="engine"||field==="intent"?[{key:"left",cmd:()=>{if(field==="tabs")cycleTab2(-1);else if(field==="engine")cycleEngine(-1);else setIntent("task")}},{key:"right",cmd:()=>{if(field==="tabs")cycleTab2(1);else if(field==="engine")cycleEngine(1);else setIntent("project")}},{key:"return",cmd:()=>setField(advanceField)}]:[],...tab==="adopt"?[{key:"ctrl+a",cmd:adopt2.adoptSelectAll}]:[]]})),useBindings(()=>({enabled:field==="confirm"&&!clone.cloneInFlight,bindings:[{key:"return",cmd:()=>commit()}]})),{...clone,...adopt2,defaultRepo:props.defaultRepo,tab,vendors,vendor,setVendor,field,setField,repo,repoDir,mode,activeList,activeWindow,repoCursor,repoPicked,expandedRepo,baseRef,branches,branchFiltered,branchWindow,branchCursor,intent,setIntent,canOpenProject,submitError,setRepoText,setBaseRefText,onRepoSubmit,selectRepoAt,pickBranchAt,onBaseRefSubmit,switchToTab,commit,commitExisting}}var import_react118,EMPTY_MAIN_REPOS;var init_view_model=__esm(async()=>{init_vendor();init_repo_field();init_state();init_i18n();init_git_snapshot();init_path_helpers();init_pure();init_use_derived_dir();await __promiseAll([init_react(),init_keymap(),init_dialog(),init_use_adopt_state(),init_use_clone_state()]);import_react118=__toESM(require_react_production(),1),EMPTY_MAIN_REPOS=new Set});function NewTaskDialogView(props){let{theme}=useTheme(),t3=useT(),padX=useDialogPaddingX(),vm=useNewTaskViewModel(props),tabLabel={existing:t3("newTask.tabs.existing"),clone:t3("newTask.tabs.clone"),adopt:t3("newTask.tabs.adopt")};return $jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:0,children:[$jsx(DialogHeader,{title:t3("newTask.title"),onClose:()=>props.onCancel()}),$jsxs("box",{gap:1,paddingTop:1,children:[$jsx(DialogSection,{label:t3("newTask.field.mode"),focused:vm.field==="tabs",hint:t3("newTask.hint.modeCycle"),onPress:()=>vm.setField("tabs"),children:$jsx(ChipRow,{choices:TAB_ORDER2,selected:vm.tab,display:(tabId)=>tabLabel[tabId],onPick:(tabId)=>vm.switchToTab(tabId)})}),$jsx(DialogSection,{label:t3("newTask.field.engine"),focused:vm.field==="engine",hint:t3("newTask.hint.engineCycle"),onPress:()=>vm.setField("engine"),children:$jsx(ChipRow,{choices:vm.vendors,selected:vm.vendor,onPick:(vendor)=>{vm.setVendor(vendor),vm.setField("engine")}})}),vm.tab==="existing"?$jsx(ExistingTab,{vm}):null,vm.tab==="clone"?$jsx(CloneTab,{vm}):null,vm.tab==="adopt"?$jsx(AdoptTab,{vm}):null,vm.submitError?$jsxs("text",{fg:theme.error,wrapMode:"word",children:["\u203B ",vm.submitError]}):null]}),$jsx(DialogFooter,{children:t3("newTask.legend")}),$jsx(DialogActions,{label:vm.cloneInFlight?t3("newTask.button.cloning"):t3("newTask.button.create"),focused:vm.field==="confirm",onPress:()=>vm.commit()})]})}var TAB_ORDER2;var init_dialog2=__esm(async()=>{init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_dialog(),init_dialog_parts(),init_tab_adopt(),init_tab_clone(),init_tab_existing(),init_view_model()]);TAB_ORDER2=["existing","clone","adopt"]});function show8(dialog,defaultRepo,savedRepos,options){return showDialog(dialog,(resolve17)=>$jsx(NewTaskDialogView,{defaultRepo,savedRepos,defaultCloneParent:options?.defaultCloneParent,defaultVendor:options?.defaultVendor,availableVendors:options?.availableVendors,discoverAdoptable:options?.discoverAdoptable,mainRepos:options?.mainRepos,onSubmit:(v3)=>resolve17(v3),onCancel:()=>resolve17(void 0)}),{size:"medium"})}var NewTaskDialog;var init_new_task_dialog=__esm(async()=>{init_jsx_runtime();await __promiseAll([init_dialog(),init_dialog2()]);NewTaskDialog={show:show8}});function taskDialogAdapters(dialog){return{confirm:async(p3)=>await DialogConfirm.show(dialog,p3.title,p3.body,p3.cancelLabel,p3.confirmLabel,{danger:p3.danger})===!0,promptText:(initial,opts)=>RenameTaskDialog.show(dialog,initial,opts),promptNewTask:(defaultRepo,repos,opts)=>NewTaskDialog.show(dialog,defaultRepo,repos,opts)}}function selectNextAfterDelete(args2){return(taskId,nextTask)=>{if(args2.selectedId()!==taskId)return;let remaining=args2.tasks();args2.setSelectedId(nextTask?.id??remaining[0]?.id??null)}}function buildBaseCreateTaskContext(deps){return{orch:deps.orch,tasks:()=>deps.tasks(),...taskDialogAdapters(deps.dialog),...vendorPrefAdapters,logger:console,logPrefix:deps.logPrefix,notifyError:deps.notifyError,notifyInfo:deps.notifyInfo,updateActiveTask:!0,onTaskDeleted:selectNextAfterDelete(deps),cursorRepo:()=>{let list2=deps.tasks();return(list2.find((t3)=>t3.id===deps.selectedId())??list2[0])?.repo},selectTask:(id)=>deps.setSelectedId(id),enterTask:(id)=>deps.enterTask(id)}}var vendorPrefAdapters;var init_task_dialog_adapters=__esm(async()=>{init_vendor_prefs();await __promiseAll([init_new_task_dialog(),init_rename_task_dialog(),init_dialog_confirm()]);vendorPrefAdapters={lastVendor:(repo)=>resolvePreferredVendor(repo),rememberVendor:(repo,vendor)=>setRepoLastActiveVendor(repo,vendor)}});async function syncBaseAction(deps,taskId){let{t:t3}=deps;try{let res=await deps.orchestrator.syncBase(taskId);return deps.notifyInfo(res.alreadyCurrent?t3("tasks.sync.alreadyCurrent",{base:res.baseRef}):t3("tasks.sync.done",{base:res.baseRef})),!0}catch(err){let msg=err instanceof Error?err.message:String(err),conflict=CONFLICT_RE.exec(msg);if(conflict)deps.notifyNeedsInput(t3("tasks.sync.conflict",{files:conflict[1]?.trim()||"?"}));else if(DIRTY_RE.test(msg))deps.notifyNeedsInput(t3("tasks.sync.dirty"));else deps.notifyError(t3("tasks.sync.failed",{error:msg}));return!1}}var CONFLICT_RE,DIRTY_RE;var init_sync_base_action=__esm(()=>{CONFLICT_RE=/SYNC_CONFLICT(?:: )?(.*)/,DIRTY_RE=/SYNC_WORKTREE_DIRTY/});function useWorkspaceTaskActions(deps){let{orchestrator,tasks,dialog,notifyError}=deps,renderer=useRenderer(),t3=deps.t,taskActions={...buildBaseCreateTaskContext({orch:orchestrator,tasks,dialog,notifyError,notifyInfo:deps.notifyInfo,selectedId:deps.selectedId,setSelectedId:deps.setSelectedId,logPrefix:"[rove workspace]",enterTask:deps.activateTask}),pickStatus:(current)=>StatusPickerDialog.show(dialog,{current}),copyText:(text)=>copyTextToSystemClipboard(text,(payload)=>renderer?.copyToClipboardOSC52(payload)),onTaskDeleted:(()=>{let moveSelection=selectNextAfterDelete({tasks,selectedId:deps.selectedId,setSelectedId:deps.setSelectedId});return(taskId,nextTask)=>{deps.forgetTaskTabs(taskId),moveSelection(taskId,nextTask)}})()};async function togglePin(id){let task=tasks().find((t4)=>t4.id===id);if(!task)return;await orchestrator.setPinned(id,!task.pinned).catch((err)=>{notifyError(`Couldn't pin: ${errorMessage(err)}`)})}async function moveTask(id,delta){await orchestrator.moveTask(id,delta).catch((err)=>{notifyError(`Couldn't move: ${errorMessage(err)}`)})}async function renameBranch2(id){let task=tasks().find((t4)=>t4.id===id);if(!task||task.kind==="main"||task.kind==="dir")return;let next=await BranchPickerDialog.show(dialog,{currentBranch:task.branch,repo:task.repo});if(!next)return;await orchestrator.setBranch(id,next).catch((err)=>{notifyError(`Couldn't rename branch: ${errorMessage(err)}`)})}async function confirmRunAgain(id){let task=tasks().find((t4)=>t4.id===id);if(task?.prompt===void 0)return;return await RunAgainDialog.show(dialog,{taskTitle:task.title,prompt:task.prompt})===!0?task:void 0}async function pickVendor(id){let task=tasks().find((t4)=>t4.id===id);if(!task)return;let current=task.vendor??DEFAULT_TASK_VENDOR,engines=await availableEngineIds(),pick=await EnginePickerDialog.show(dialog,{engines:engines.length>0?engines:[current],current,currentEffort:task.modelEffort});if(!pick)return;if(pick.vendor===current&&(pick.effort===void 0||pick.effort===(task.modelEffort??"")))return;await applyVendorChange(taskActions,id,pick.vendor,{effort:pick.effort})}async function landTask2(id){let task=tasks().find((candidate)=>String(candidate.id)===id);if(!task)return;await landTaskAction({orchestrator,confirm:(branch)=>DialogConfirm.show(dialog,t3("worktrees.land.confirmTitle"),t3("worktrees.land.confirmBody",{branch}),t3("common.cancel"),t3("worktrees.land.button")).then((ok)=>ok===!0),notifyInfo:deps.notifyInfo,notifyNeedsInput:deps.notifyNeedsInput,notifyError,t:t3,callerCwd:process.cwd()},id,task.branch||task.title)}return{syncBase:(id)=>syncBaseAction({orchestrator,notifyInfo:deps.notifyInfo,notifyNeedsInput:deps.notifyNeedsInput,notifyError,t:t3},id),createTask:()=>createTaskFlow(taskActions),deleteTask:(id)=>deleteTaskFlow(taskActions,id),renameTask:(id)=>renameTaskFlow(taskActions,id),renameBranch:renameBranch2,cycleVendor:(id)=>cycleVendorFlow(taskActions,id),pickVendor,setVendor:async(id,vendor)=>{await applyVendorChange(taskActions,id,vendor,{silentSuccess:!0})},togglePin,moveTask,setStatus:(id)=>setStatusFlow(taskActions,id),copyTaskField:(id,field)=>copyTaskFieldFlow(taskActions,id,field),showFieldNotes:(repo)=>FieldNotesDialog.show(dialog,{repo,load:()=>orchestrator.listFieldNotes(repo)}),confirmRunAgain,landTask:landTask2}}var init_host_task_actions=__esm(async()=>{init_account_detect();init_clipboard_copy();init_task_actions();init_task_create_flow();init_task();init_land_task_action();init_sync_base_action();await __promiseAll([init_react(),init_branch_picker_dialog(),init_engine_picker_dialog(),init_field_notes_dialog(),init_run_again_dialog(),init_status_picker_dialog(),init_dialog_confirm(),init_task_dialog_adapters()])});import{spawn as spawn13}from"child_process";import{existsSync as existsSync34}from"fs";import{basename as basename13,delimiter as delimiter4,isAbsolute as isAbsolute7,join as join48}from"path";function executableOnPath(command,env,exists){if(isAbsolute7(command))return exists(command);let pathEnv=env.PATH??"";for(let dir of pathEnv.split(delimiter4)){if(!dir)continue;if(exists(join48(dir,command)))return!0}return!1}function labelForOverride(command){let name=basename13(command);if(name==="code")return"VS Code";if(name==="cursor")return"Cursor";if(name==="windsurf")return"Windsurf";if(name==="zed")return"Zed";return name||command}function detectWorktreeOpener(deps={}){let env=deps.env??process.env,platform3=deps.platform??process.platform,exists=deps.exists??existsSync34,override=readRoveEnv("OPEN_EDITOR",env)?.trim();if(override)return{id:"env",label:labelForOverride(override),command:override,args:[]};for(let c2 of CLI_CANDIDATES)if(executableOnPath(c2.command,env,exists))return{id:c2.id,label:c2.label,command:c2.command,args:[]};if(platform3==="darwin"&&executableOnPath("open",env,exists)){for(let app of MAC_APP_CANDIDATES)if(app.paths.some((path23)=>exists(path23)))return{id:app.id,label:app.label,command:"open",args:["-a",app.appName]};return{id:"mac-open",label:"Finder",command:"open",args:[]}}if(platform3==="linux"&&executableOnPath("xdg-open",env,exists))return{id:"xdg-open",label:"Open",command:"xdg-open",args:[]};return null}function buildOpenWorktreeCommand(worktreePath,opener){return[opener.command,[...opener.args,worktreePath]]}function openWorktree(worktreePath,opener,deps={}){if(!worktreePath)return!1;let spawnFn=deps.spawn??spawn13,[command,args2]=buildOpenWorktreeCommand(worktreePath,opener);try{let child=spawnFn(command,args2,{detached:!0,stdio:"ignore"});if(child.pid===void 0)return!1;return child.unref(),!0}catch{return!1}}var CLI_CANDIDATES,MAC_APP_CANDIDATES;var init_worktree_opener=__esm(()=>{CLI_CANDIDATES=[{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"}],MAC_APP_CANDIDATES=[{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 existsSync35}from"fs";async function requestTaskWorktreeOpen(id,deps){let path23=deps.taskPath;if(!path23||!existsSync35(path23))try{path23=await deps.ensureWorktree(id)}catch(error){let reason=error instanceof Error?error.message:String(error);deps.notifyError(`Couldn't create worktree: ${reason}`);return}if(!path23||!existsSync35(path23))return;let opener=detectWorktreeOpener();if(!opener){deps.notifyError(deps.noEditorMessage);return}if(!openWorktree(path23,opener))deps.notifyError(deps.openFailedMessage(opener.label))}function openTaskWorktreeFor(id,opts){requestTaskWorktreeOpen(id,{taskPath:opts.tasks.find((task)=>task.id===id)?.worktreePath,ensureWorktree:opts.ensureWorktree,notifyError:opts.notifyError,noEditorMessage:t("tasks.toast.noEditor"),openFailedMessage:(label)=>t("tasks.toast.openWorktreeFailed",{label})})}var init_open_task_worktree=__esm(()=>{init_i18n();init_worktree_opener()});import{randomUUID as randomUUID8}from"crypto";function formatDiffComment(c2){let escaped=c2.body.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\r/g,"\\r").replace(/\n/g,"\\n"),location=c2.startLine!==void 0&&c2.startLine!==c2.line?`Lines: ${c2.startLine}-${c2.line}`:`Line: ${c2.line}`;return[`File: ${c2.filePath}`,location,`User comment: "${escaped}"`].join(`
|
|
761
|
+
`);for(let i2=lines.length-1;i2>=0;i2--){let line=lines[i2]?.trim();if(!line)continue;let record;try{record=JSON.parse(line)}catch{continue}if(typeof record.at!=="number")continue;let exitCode=typeof record.exitCode==="number"?record.exitCode:null,spawnError=typeof record.spawnError==="string"?record.spawnError:void 0;return{at:record.at,label:typeof record.label==="string"?record.label:typeof record.kind==="string"?record.kind:"run",exitCode,ok:spawnError===void 0&&exitCode===0,...spawnError?{spawnError}:{}}}return null}function pluginRowView(outdated,entry,manifestText,logText,settingValues={}){let declares=null,settings=[],platformOk=!0,hooksDeclared=!1;if(manifestText!==null)try{let{manifest}=parsePluginManifest(manifestText);declares={actions:manifest.actions.length,events:manifest.events.length,panes:manifest.panes.length,engines:manifest.engines.length},hooksDeclared=manifest.actions.length+manifest.events.length+manifest.startup.length>0,platformOk=supportsPlatform({},manifest,currentPluginPlatform()),settings=pluginSettingRows(manifest.settings,settingValues)}catch{declares=null}return{id:entry.id,version:entry.version,enabled:entry.enabled,linked:entry.source.kind==="link",source:entry.source.kind==="link"?entry.root:entry.source.spec,declares,platformOk,hooksDeclared,lastRun:parseLastRun(logText),settings,updateAvailable:outdated.has(entry.id)}}function readTail(path22){let fd;try{let size=statSync13(path22).size,length=Math.min(size,LOG_TAIL_BYTES),buf=Buffer.alloc(length);return fd=openSync4(path22,"r"),readSync(fd,buf,0,length,size-length),buf.toString("utf8")}catch{return null}finally{if(fd!==void 0)closeSync4(fd)}}function readTextOrNull(path22){if(!path22)return null;try{return readFileSync33(path22,"utf8")}catch{return null}}function readPluginRows(homeDir2){let outdated=new Set(readOutdatedCache(homeDir2));return loadPluginRegistry(homeDir2).plugins.map((entry)=>pluginRowView(outdated,entry,readTextOrNull(pluginManifestPath(entry.root)),readTail(pluginLogPath(entry.id,homeDir2)),readPluginSettings(entry.id,homeDir2)))}function setPluginSetting(pluginId,key,value,homeDir2){writePluginSettings(pluginId,{[key]:value},homeDir2)}function setPluginEnabled(id,enabled,homeDir2){let registry=loadPluginRegistry(homeDir2);savePluginRegistry({plugins:registry.plugins.map((p3)=>p3.id===id?{...p3,enabled}:p3)},homeDir2),reloadPluginEngines(homeDir2)}var LOG_TAIL_BYTES=65536;var init_plugins_core=__esm(()=>{init_manifest();init_outdated_cache();init_plugin_paths();init_registry2();init_settings_env();init_plugin_engines()});function useAccountProbes(section,vendors){let[statuses,setStatuses]=import_react87.useState(null),key=vendors.join(",");return import_react87.useEffect(()=>{if(section!=="engines")return;let cancelled=!1;return detectEngineStatuses(key?key.split(","):[]).then((s2)=>{if(!cancelled)setStatuses(s2)}),()=>{cancelled=!0}},[section,key]),statuses}function usePluginSettings(section,dialog){let[rows,setRows]=import_react87.useState([]),t3=useT();import_react87.useEffect(()=>{if(section!=="plugins")return;setRows(readPluginRows())},[section]);function store2(pluginId,key,value){try{setPluginSetting(pluginId,key,value)}catch{}setRows(readPluginRows())}return{rows,toggle:(id)=>{let row=rows.find((p3)=>p3.id===id);if(!row)return;try{setPluginEnabled(id,!row.enabled)}catch{}setRows(readPluginRows())},editSetting:async(pluginId,key)=>{let setting=rows.find((p3)=>p3.id===pluginId)?.settings.find((s2)=>s2.key===key);if(!setting)return;if(setting.type==="enum"){store2(pluginId,key,nextEnumValue(setting.options,setting.value));return}if(setting.type==="boolean"){store2(pluginId,key,toggledBooleanValue(setting));return}let initial=setting.type==="secret"?"":setting.value,next=await RenameTaskDialog.show(dialog,initial,{dialogTitle:setting.label,fieldLabel:key,submitLabel:"save",allowEmpty:!0,placeholder:setting.type==="secret"&&setting.value!==""?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":setting.defaultValue});if(next===void 0)return;if(setting.type!=="number"){store2(pluginId,key,next.trim());return}let numeric=normalizeNumberInput(next);if(numeric===null){await DialogConfirm.show(dialog,t3("settings.plugins.settingInvalidTitle"),t3("settings.plugins.settingInvalidBody",{label:setting.label}),"cancel");return}store2(pluginId,key,numeric)}}}var import_react87;var init_use_section_data=__esm(async()=>{init_engine_status();init_i18n2();init_plugins_core();await __promiseAll([init_dialog_confirm(),init_rename_task_dialog()]);import_react87=__toESM(require_react_production(),1)});function resolveTabStripMode(stored,legacyHideSingle){if(typeof stored==="string"&&TAB_STRIP_MODES.includes(stored))return stored;if(legacyHideSingle===!0)return"multipleOnly";if(legacyHideSingle===!1)return"always";return"never"}function tabStripVisible(mode,tabCount){if(mode==="never")return!1;if(mode==="multipleOnly")return tabCount>=2;return!0}var TAB_STRIP_MODE_KEY="chat.tabStrip.mode",TAB_STRIP_MODES,TAB_STRIP_HIDE_SINGLE_KEY="chat.tabStrip.hideSingle";var init_tab_strip=__esm(()=>{TAB_STRIP_MODES=["always","multipleOnly","never"]});var ZEN_KEEP_TASKS_KEY="zen.keepTasks",ZEN_ACTIVE_KEY="zen.active";import{accessSync as accessSync2,constants as fsConstants2,mkdirSync as mkdirSync21}from"fs";function useSettingsPrefs(kv,dialog,onComposerGateDisabled){let t3=useT();function toastEnabled(){return kv.get("notifications.toast.enabled",!0)!==!1}function soundEnabled(){return kv.get("notifications.sound.enabled",!0)!==!1}function toggleToast(){kv.set("notifications.toast.enabled",!toastEnabled())}function toggleSound(){kv.set("notifications.sound.enabled",!soundEnabled())}function crossTaskEnabled(){return kv.get("notifications.crossTask.enabled",!0)!==!1}function toggleCrossTask(){kv.set("notifications.crossTask.enabled",!crossTaskEnabled())}function prefixTapPresentation(){return normalizePrefixTapPresentation(kv.get(PREFIX_TAP_PRESENTATION_KEY))}function selectPrefixTapPresentation(next){kv.set(PREFIX_TAP_PRESENTATION_KEY,next)}function splitStyle(){return normalizeSplitStyle(kv.get(SPLIT_STYLE_KEY))}function selectSplitStyle(style){kv.set(SPLIT_STYLE_KEY,style)}function zenDefaultOn(){return kv.get(ZEN_ACTIVE_KEY,!1)===!0}function toggleZenDefaultOn(){kv.set(ZEN_ACTIVE_KEY,!zenDefaultOn())}function zenKeepsTasks(){return kv.get(ZEN_KEEP_TASKS_KEY,!0)!==!1}function toggleZenKeepsTasks(){kv.set(ZEN_KEEP_TASKS_KEY,!zenKeepsTasks())}function tabStripMode(){return resolveTabStripMode(kv.get(TAB_STRIP_MODE_KEY,void 0),kv.get(TAB_STRIP_HIDE_SINGLE_KEY,void 0))}function cycleTabStripMode(){let next=TAB_STRIP_MODES[(TAB_STRIP_MODES.indexOf(tabStripMode())+1)%TAB_STRIP_MODES.length];kv.set(TAB_STRIP_MODE_KEY,next)}function remoteProjectsEnabled(){return kv.get("experimental.remoteProjects",!1)===!0}function toggleRemoteProjects(){kv.set("experimental.remoteProjects",!remoteProjectsEnabled())}function autoStatusOn(){return kv.get(AUTO_STATUS_KEY,!1)===!0}function toggleAutoStatus(){kv.set(AUTO_STATUS_KEY,!autoStatusOn())}function dispatcherOn(){return kv.get(DISPATCHER_KEY,!1)===!0}function toggleDispatcher(){kv.set(DISPATCHER_KEY,!dispatcherOn())}function composerGateOn(){return composerGatePreferenceOn(kv)}function toggleComposerGate(){if(toggleComposerGatePreference(kv,onComposerGateDisabled)==="persist-failed")logClientError("settings","could not persist the disabled composer delivery check; deferred prompts were not flushed")}function editorKind(){return normalizeEditorKind(kv.get(EDITOR_KIND_KEY,DEFAULT_EDITOR_KIND))}function cycleEditorKind(){let i2=EDITOR_KINDS.indexOf(editorKind()),next=EDITOR_KINDS[(i2+1)%EDITOR_KINDS.length];if(next)kv.set(EDITOR_KIND_KEY,next)}function editorCustomCommand(){let v3=kv.get(EDITOR_CUSTOM_KEY,"");return typeof v3==="string"?v3:""}async function editEditorCustom(){let next=await RenameTaskDialog.show(dialog,editorCustomCommand(),{dialogTitle:"Custom editor command (use {file} for the path)",fieldLabel:"COMMAND",submitLabel:"save",allowEmpty:!0});if(next===void 0)return;let cmd=next.trim();if(kv.set(EDITOR_CUSTOM_KEY,cmd),cmd)kv.set(EDITOR_KIND_KEY,"custom")}function scrollbackRows(){return normalizeScrollbackRows(kv.get(SCROLLBACK_ROWS_KEY,DEFAULT_SCROLLBACK_ROWS))}async function editScrollbackRows(){let next=await RenameTaskDialog.show(dialog,String(scrollbackRows()),{dialogTitle:t3("settings.general.scrollbackTitle"),fieldLabel:t3("settings.general.scrollbackField"),submitLabel:"save",placeholder:String(DEFAULT_SCROLLBACK_ROWS)});if(next===void 0)return;let n2=Number.parseInt(next.trim(),10);if(!Number.isFinite(n2)){await DialogConfirm.show(dialog,t3("settings.general.scrollbackInvalidTitle"),t3("settings.general.scrollbackInvalidBody"),"cancel");return}kv.set(SCROLLBACK_ROWS_KEY,normalizeScrollbackRows(n2))}function worktreeBasePath(){let v3=kv.get(WORKTREE_BASE_KEY,"");return typeof v3==="string"?v3:""}let worktreeKind=()=>worktreeBaseKindOf(worktreeBasePath());function worktreeKindLabel(){let kind=worktreeKind();if(kind==="default")return t3("settings.general.worktreeKindDefault");if(kind==="nextToProject")return t3("settings.general.worktreeKindNext");return t3("settings.general.worktreeKindCustom")}function worktreeCustomPath(){let v3=kv.get(WORKTREE_BASE_CUSTOM_KEY,"");return(typeof v3==="string"?v3.trim():"")||(worktreeKind()==="custom"?worktreeBasePath().trim():"")}function cycleWorktreeBase(){let kind=worktreeKind();if(kind==="default")kv.set(WORKTREE_BASE_KEY,PROJECT_SIBLING_BASE);else if(kind==="nextToProject")kv.set(WORKTREE_BASE_KEY,worktreeCustomPath());else kv.set(WORKTREE_BASE_CUSTOM_KEY,worktreeBasePath().trim()),kv.set(WORKTREE_BASE_KEY,"")}async function editWorktreeCustom(){let next=await RenameTaskDialog.show(dialog,worktreeCustomPath(),{dialogTitle:t3("settings.general.worktreeBaseTitle"),fieldLabel:t3("settings.general.worktreeBaseField"),submitLabel:"save",placeholder:`${PROJECT_DIR_TOKEN}/../worktrees`,allowEmpty:!0});if(next===void 0)return;let raw=next.trim();if(raw.includes(PROJECT_DIR_TOKEN)){if(!hasProjectDirToken(raw)){await DialogConfirm.show(dialog,"Can't use that worktree location",`${PROJECT_DIR_TOKEN} only expands as the leading path segment (e.g. ${PROJECT_DIR_TOKEN}/../kobe-worktrees). Keeping the previous setting.`,"cancel");return}}else if(raw){let resolved=normalizeWorktreeBase(raw)??raw;try{mkdirSync21(resolved,{recursive:!0}),accessSync2(resolved,fsConstants2.W_OK)}catch(err){await DialogConfirm.show(dialog,"Can't use that worktree location",`${resolved} isn't usable (${errorMessage(err)}). Keeping the previous setting \u2014 pick a writable directory.`,"cancel");return}}if(kv.set(WORKTREE_BASE_CUSTOM_KEY,raw),raw)kv.set(WORKTREE_BASE_KEY,raw);else if(worktreeKind()==="custom")kv.set(WORKTREE_BASE_KEY,"")}return{toastEnabled,toggleToast,soundEnabled,toggleSound,crossTaskEnabled,toggleCrossTask,prefixTapPresentation,selectPrefixTapPresentation,splitStyle,selectSplitStyle,zenDefaultOn,toggleZenDefaultOn,zenKeepsTasks,toggleZenKeepsTasks,remoteProjectsEnabled,toggleRemoteProjects,autoStatusOn,toggleAutoStatus,dispatcherOn,toggleDispatcher,composerGateOn,toggleComposerGate,editorKind,cycleEditorKind,editorCustomCommand,editEditorCustom,scrollbackRows,editScrollbackRows,tabStripMode,cycleTabStripMode,worktreeKind,worktreeKindLabel,worktreeCustomPath,cycleWorktreeBase,editWorktreeCustom}}var init_use_settings_prefs=__esm(async()=>{init_client_log();init_auto_status();init_composer_gate();init_dispatcher();init_scrollback();init_split_style();init_tab_strip();init_worktree_base();init_editor_prefs();init_prefix_tap_presentation();init_i18n2();await __promiseAll([init_dialog_confirm(),init_rename_task_dialog()])});import{TextAttributes as TextAttributes26}from"@opentui/core";function SettingsDialog(props){let dialog=useDialog(),themeCtx=useTheme(),renderer=useRenderer(),{theme}=themeCtx,t3=useT(),padX=useDialogPaddingX(),[level,setLevel]=import_react89.useState("sidebar"),[section,setSection]=import_react89.useState("general"),[cursor,setCursor]=import_react89.useState(0),[bodyRow,setBodyRow]=import_react89.useState(0),[feedbackTitle,setFeedbackTitle]=import_react89.useState(""),[feedbackBody,setFeedbackBody]=import_react89.useState(""),[feedbackStatus,setFeedbackStatus]=import_react89.useState(""),themeNames=import_react89.useMemo(()=>themeCtx.all().slice().sort(),[themeCtx]),hasDaemon=hasRestartableDaemon(props.orchestrator),remote=props.orchestrator instanceof RemoteOrchestrator?props.orchestrator:null,prefs=useSettingsPrefs(props.kv,dialog,()=>{if(remote)flushDeferredPromptsWithFeedback(remote,dialog)}),engines=useEngineSettings(props.kv,dialog,(max)=>setBodyRow((r6)=>Math.max(0,Math.min(r6,max)))),usage=useAccessor(remote?remote.usageSnapshotSignal():EMPTY_USAGE_SIGNAL),engineStatuses=useAccountProbes(section,engines.engineList()),[keysFileExists,setKeysFileExists]=import_react89.useState(()=>userKeybindingsReport().exists);function createKeysFile(){try{createKeybindingsFile(userKeybindingsReport().path),reloadUserKeybindings()}catch{}setKeysFileExists(userKeybindingsReport().exists)}let plugins=usePluginSettings(section,dialog);function bodyRows(){return sectionRows(section,{themeNames,focusAccentSlots:FOCUS_ACCENT_SLOTS,engineList:engines.engineList(),plugins:plugins.rows.map((p3)=>({id:p3.id,settingKeys:p3.settings.map((s2)=>s2.key)})),hasDaemon,keybindingsFileExists:keysFileExists})}function bodyRowCount(){return bodyRows().length}function selectTheme(name){if(themeCtx.selected===name)return;if(!themeCtx.set(name))return;props.kv.set("activeTheme",name)}function selectLanguage(locale){if(currentLang()===locale)return;setLocaleLang(locale),props.kv.set(LOCALE_KEY,locale)}function toggleTransparent(){let next=!themeCtx.transparentBackground;themeCtx.setTransparentBackground(next),props.kv.set("transparentBackground",next)}function selectFocusAccent(slot){if(themeCtx.focusAccent===slot)return;themeCtx.setFocusAccent(slot),props.kv.set("focusAccent",slot)}function currentEngineRow(){if(section!=="engines"||level!=="body")return null;let row=rowAt(bodyRows(),bodyRow);return row?.kind==="engine"?row.vendor:null}async function sendFeedback(){setFeedbackStatus("submitting...");try{let result=submitFeedback({title:feedbackTitle,body:feedbackBody});setFeedbackStatus(`sent: ${result.url}`),setFeedbackTitle(""),setFeedbackBody(""),setBodyRow(0)}catch(err){setFeedbackStatus(`error: ${errorMessage(err)}`)}}let editingFeedback=section==="feedback"&&level==="body";function feedbackFieldStep(delta){let next=bodyRow+delta;if(next<0||next>2){setLevel("sidebar");return}setBodyRow(next)}function enterBody(){if(level!=="sidebar"||bodyRowCount()===0)return;setLevel("body"),setBodyRow(0)}function moveCursor(delta){if(level==="sidebar"){let next=(cursor+delta+SECTIONS.length)%SECTIONS.length;setCursor(next);let nextSection=SECTIONS[next];if(nextSection)setSection(nextSection.id),setBodyRow(0);return}let len=bodyRowCount();if(len===0)return;setBodyRow((bodyRow+delta+len)%len)}function switchSection(id){setSection(id),setCursor(SECTIONS.findIndex((s2)=>s2.id===id)),setBodyRow(0),setLevel("sidebar")}let rowActivators={theme:(row)=>selectTheme(row.name),language:(row)=>selectLanguage(row.locale),transparent:()=>toggleTransparent(),focusAccent:(row)=>selectFocusAccent(row.slot),toast:()=>prefs.toggleToast(),sound:()=>prefs.toggleSound(),crossTask:()=>prefs.toggleCrossTask(),keyHints:()=>toggleKeyHints(props.kv),prefixTapPresentation:(row)=>prefs.selectPrefixTapPresentation(row.presentation),splitStyle:(row)=>prefs.selectSplitStyle(row.style),zenDefaultOn:()=>prefs.toggleZenDefaultOn(),zenKeepTasks:()=>prefs.toggleZenKeepsTasks(),editorKind:()=>prefs.cycleEditorKind(),editorCustom:()=>void prefs.editEditorCustom(),worktreeBase:()=>prefs.cycleWorktreeBase(),worktreeCustom:()=>void prefs.editWorktreeCustom(),scrollbackRows:()=>void prefs.editScrollbackRows(),tabStripHideSingle:()=>prefs.cycleTabStripMode(),engine:(row)=>void engines.editEngine(row.vendor),engineAdd:()=>void engines.addEngineFlow(),keysCreate:()=>createKeysFile(),pluginToggle:(row)=>plugins.toggle(row.pluginId),pluginSetting:(row)=>void plugins.editSetting(row.pluginId,row.key),feedbackTitle:()=>setBodyRow(0),feedbackBody:()=>setBodyRow(1),feedbackSend:()=>void sendFeedback(),devReset:()=>void confirmResetState(dialog,props.kv,renderer),devRestartDaemon:()=>void confirmRestartDaemon(dialog,props.orchestrator,renderer),devRemoteProjects:()=>prefs.toggleRemoteProjects(),devAutoStatus:()=>prefs.toggleAutoStatus(),devDispatcher:()=>prefs.toggleDispatcher(),devComposerGate:()=>prefs.toggleComposerGate()};function activateBodyRow(){let row=rowAt(bodyRows(),bodyRow);if(!row)return;rowActivators[row.kind](row)}useBindings(()=>({enabled:dialog.stack.length===0&&!editingFeedback,bindings:[{key:"down",cmd:()=>moveCursor(1)},{key:"up",cmd:()=>moveCursor(-1)},{key:"j",cmd:()=>moveCursor(1)},{key:"k",cmd:()=>moveCursor(-1)},{key:"tab",cmd:()=>moveCursor(1)},{key:"right",cmd:enterBody},{key:"l",cmd:enterBody},{key:"left",cmd:()=>setLevel("sidebar")},{key:"h",cmd:()=>setLevel("sidebar")},{key:"return",cmd:()=>{if(level==="sidebar"){enterBody();return}activateBodyRow()}},{key:"r",cmd:()=>{let v3=currentEngineRow();if(v3)engines.renameEngine(v3)}},{key:"x",cmd:()=>{let v3=currentEngineRow();if(v3)engines.resetEngine(v3)}},{key:"d",cmd:()=>{let v3=currentEngineRow();if(v3)engines.chooseDefaultEngine(v3)}},{key:"space",cmd:()=>{let v3=currentEngineRow();if(v3)engines.toggleEngineEnabled(v3)}}]})),useBindings(()=>({enabled:editingFeedback,bindings:[{key:"tab",cmd:()=>feedbackFieldStep(1)},{key:"shift+tab",cmd:()=>feedbackFieldStep(-1)}]})),useBindings(()=>({enabled:editingFeedback&&bodyRow===2,bindings:[{key:"return",cmd:()=>void sendFeedback()}]}));let scrollRef=import_react89.useRef(null),reportCursorEl=import_react89.useCallback((el)=>{let scroll=scrollRef.current;if(!scroll||!el||scroll.viewport.height<=0)return;scroll.scrollChildIntoView(el.id)},[]),cursorProps={level,bodyRow,setLevel,setBodyRow},navHint=$jsx("box",{paddingTop:0,children:$jsx("text",{fg:theme.textMuted,children:editingFeedback?t3("settings.nav.feedback"):t3("settings.nav.default")})}),body=$jsxs("box",{paddingLeft:padX,paddingRight:padX,paddingBottom:1,gap:1,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",children:[$jsx("text",{attributes:TextAttributes26.BOLD,fg:theme.text,children:t3("settings.title")}),$jsx("text",{fg:theme.textMuted,onMouseUp:()=>props.onClose(),children:t3("settings.esc")})]}),$jsxs("box",{flexDirection:"row",gap:2,children:[$jsx(SettingsSectionSidebar,{level,cursor,switchSection}),$jsxs("box",{flexGrow:1,flexShrink:1,flexDirection:"column",gap:1,children:[section==="general"?$jsx(GeneralSettingsSection,{...cursorProps,prefs,themeNames,selectTheme,currentLocale:currentLang(),selectLanguage,toggleTransparent,selectFocusAccent,usage}):null,section==="engines"?$jsx(EngineSettingsSection,{...cursorProps,vendors:engines.engineList(),statuses:engineStatuses,isCustom:engines.isCustomEngine,isEnabled:engines.isEngineEnabled,toggleEngine:engines.toggleEngineEnabled,chooseDefault:engines.chooseDefaultEngine,displayName:engines.engineName,commandText:engines.engineCommandText,isDefault:engines.engineIsDefault,isDefaultEngine:(v3)=>engines.defaultEngine===v3,editEngine:(v3)=>void engines.editEngine(v3),onAddEngine:()=>void engines.addEngineFlow()}):null,section==="plugins"?$jsx(PluginSettingsSection,{...cursorProps,plugins:plugins.rows,toggle:plugins.toggle,editSetting:(id,key)=>void plugins.editSetting(id,key)}):null,section==="keys"?$jsx(KeybindingsSettingsSection,{...cursorProps,prefs,onCreateFile:createKeysFile}):null,section==="feedback"?$jsx(FeedbackSettingsSection,{...cursorProps,title:feedbackTitle,setTitle:(v3)=>{setFeedbackTitle(v3),setFeedbackStatus("")},body:feedbackBody,setBody:(v3)=>{setFeedbackBody(v3),setFeedbackStatus("")},status:feedbackStatus,onTitleSubmit:()=>setBodyRow(1),submit:()=>void sendFeedback()}):null,section==="dev"?$jsx(DevSettingsSection,{...cursorProps,prefs,hasDaemon,confirmReset:()=>void confirmResetState(dialog,props.kv,renderer),confirmRestartDaemon:()=>void confirmRestartDaemon(dialog,props.orchestrator,renderer)}):null]})]})]});return $jsx(SettingsCursorElContext.Provider,{value:reportCursorEl,children:$jsxs("box",{flexDirection:"column",flexGrow:1,children:[$jsx("scrollbox",{ref:(r6)=>{scrollRef.current=r6},flexGrow:1,flexShrink:1,flexBasis:0,verticalScrollbarOptions:{trackOptions:{foregroundColor:"transparent"}},children:body}),$jsx("box",{paddingLeft:padX,paddingRight:padX,children:navHint})]})})}var import_react89,EMPTY_USAGE_SIGNAL;var init_settings_dialog=__esm(async()=>{init_remote_orchestrator();init_external_store();init_feedback();init_model();init_keybindings_user();init_keybindings_starter();init_keyboard_hints();init_persisted_ui_prefs();init_i18n2();init_use_accessor();init_jsx_runtime();await __promiseAll([init_react(),init_theme(),init_keymap(),init_dialog(),init_actions(),init_deferred_flush_feedback(),init_rows2(),init_sections_engines(),init_sections_general(),init_sections_misc(),init_sections_plugins(),init_use_engine_settings(),init_use_section_data(),init_use_settings_prefs()]);import_react89=__toESM(require_react_production(),1),EMPTY_USAGE_SIGNAL=createStateCell(null)});import{TextAttributes as TextAttributes27}from"@opentui/core";function reposOf(orch){if(!orch)return[];let seen=[];for(let task of orch.listTasks())if(task.repo&&!seen.includes(task.repo))seen.push(task.repo);return seen}function linkedTaskFor(orch,repo,number){return orch?.listTasks().find((task)=>task.repo===repo&&task.linkedWorkItem?.number===number)}function errorHint(error,t3){let colon=error.indexOf(": ");switch(colon>=0?error.slice(0,colon):"failed"){case"no-remote":return t3("workItems.errorHint.noRemote");case"gh-missing":return t3("workItems.errorHint.ghMissing");case"auth":return t3("workItems.errorHint.auth");default:return t3("workItems.errorHint.fallback",{message:error})}}function relativeAge(iso,now){let at2=Date.parse(iso);if(!Number.isFinite(at2))return"";let mins=Math.round((now-at2)/60000);if(mins<60)return`${Math.max(mins,0)}m`;let hours=Math.round(mins/60);if(hours<24)return`${hours}h`;return`${Math.round(hours/24)}d`}function WorkItemsPage(props){let{theme}=useTheme(),t3=useT(),notif=useNotifications();function notifyError(message){notif.notify({kind:"error",taskId:"",tabId:"",title:message})}let repos=reposOf(props.orchestrator),[repoIndex,setRepoIndex]=import_react90.useState(()=>{let wanted=props.focusRepo?repos.indexOf(props.focusRepo):-1;return wanted>=0?wanted:0}),repo=repos[repoIndex],[items,setItems]=import_react90.useState(null),[error,setError]=import_react90.useState(null),[reloadTick,setReloadTick]=import_react90.useState(0),[assignedToMe,setAssignedToMe]=import_react90.useState(!1),[starting,setStarting]=import_react90.useState(!1),[notice,setNotice]=import_react90.useState(null);import_react90.useEffect(()=>{let disposed=!1,orch=props.orchestrator;if(!orch||!repo){setItems([]);return}return setError(null),orch.listWorkItems({repo,limit:30,...assignedToMe?{assignee:"@me"}:{},...reloadTick>0?{refresh:!0}:{}}).then((result)=>{if(!disposed)setItems(result.items)}).catch((err)=>{if(disposed)return;setError(err instanceof Error?err.message:String(err)),setItems([])}),()=>{disposed=!0}},[props.orchestrator,repo,assignedToMe,reloadTick]);let rows=items??[],[cursor,setCursor]=import_react90.useState(0);import_react90.useEffect(()=>{setCursor((c2)=>clampCursor(c2,rows.length))},[rows.length]);let follow=useCursorFollow(cursor);import_react90.useEffect(()=>{setNotice(null)},[repo,assignedToMe]);async function startSelected(){let orch=props.orchestrator,item=rows[cursor];if(!orch||!item||!repo||starting)return;let linked=linkedTaskFor(orch,repo,item.number);if(linked){setNotice(t3("workItems.openingLinked",{title:linked.title})),props.onOpenTask?.(linked.id);return}setStarting(!0),setNotice(t3("workItems.starting",{number:item.number}));try{let result=await orch.startWorkItem({repo,number:item.number});if(result.started)props.onOpenTask?.(result.taskId);else setNotice(t3("workItems.startedNoEngine",{title:result.title}))}catch(err){console.error("[rove work-items] start failed:",err),notifyError(t3("workItems.startFailed",{number:item.number,error:errorMessage(err)}))}finally{setStarting(!1)}}useBindings(()=>({enabled:props.focused!==!1,bindings:[...pageCloseBindings(props.onClose),{key:"j",cmd:()=>setCursor((c2)=>clampCursor(c2+1,rows.length))},{key:"down",cmd:()=>setCursor((c2)=>clampCursor(c2+1,rows.length))},{key:"k",cmd:()=>setCursor((c2)=>clampCursor(c2-1,rows.length))},{key:"up",cmd:()=>setCursor((c2)=>clampCursor(c2-1,rows.length))},{key:"tab",cmd:()=>setRepoIndex((i2)=>repos.length?(i2+1)%repos.length:0)},{key:"a",cmd:()=>setAssignedToMe((on)=>!on)},{key:"r",cmd:()=>setReloadTick((tick)=>tick+1)},{key:"return",cmd:()=>void startSelected()}]}));let now=Date.now();return $jsxs("box",{flexDirection:"column",flexGrow:1,paddingTop:1,paddingBottom:1,paddingLeft:2,paddingRight:2,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",children:[$jsx("text",{attributes:TextAttributes27.BOLD,fg:theme.text,children:t3("workItems.title")}),$jsxs("text",{fg:theme.textMuted,children:[repo?sidebarProjectLabel(repo,repos):t3("workItems.noRepo"),assignedToMe?` ${t3("workItems.assignedFilter")}`:""]})]}),error?$jsxs("box",{flexDirection:"column",marginTop:1,children:[$jsx("text",{fg:theme.error,children:error}),$jsx("box",{marginTop:1,children:$jsx("text",{fg:theme.textMuted,children:errorHint(error,t3)})})]}):items===null?$jsx("text",{fg:theme.textMuted,children:t3("common.loading")}):rows.length===0?$jsx("text",{fg:theme.textMuted,children:t3("workItems.empty")}):$jsx("scrollbox",{ref:follow.scrollRef,flexGrow:1,flexShrink:1,flexBasis:0,marginTop:1,verticalScrollbarOptions:{trackOptions:{foregroundColor:"transparent"}},children:rows.map((item,index)=>{let chrome=resolveRowSelectionChrome(theme,{cursor:index===cursor,selected:!1}),linked=linkedTaskFor(props.orchestrator,repo,item.number);return $jsxs("box",{ref:follow.rowRef(index),flexDirection:"column",flexShrink:0,...chrome.backgroundColor?{backgroundColor:chrome.backgroundColor}:{},children:[$jsxs("box",{flexDirection:"row",gap:0,children:[$jsx("text",{fg:chrome.markerColor,wrapMode:"none",children:chrome.marker}),$jsxs("box",{flexDirection:"row",flexGrow:1,paddingLeft:1,paddingRight:1,gap:1,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:`#${item.number}`}),$jsx("text",{fg:theme.text,attributes:index===cursor?TextAttributes27.BOLD:void 0,wrapMode:"none",flexGrow:1,children:item.title})]})]}),$jsxs("box",{flexDirection:"row",gap:0,children:[$jsx("text",{fg:chrome.markerColor,wrapMode:"none",children:chrome.marker}),$jsxs("box",{flexDirection:"row",flexGrow:1,paddingLeft:2,paddingRight:1,gap:1,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",flexGrow:1,children:[item.author,...item.labels.slice(0,2)].filter(Boolean).join(" \xB7 ")}),linked?$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("workItems.linkedChip",{title:linked.title})}):null,$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:relativeAge(item.updatedAt,now)})]})]})]},`${item.number}`)})}),notice?$jsx("text",{fg:theme.textMuted,flexShrink:0,children:notice}):null]})}var import_react90;var init_work_items_page=__esm(async()=>{init_state();init_groups();init_notifications();init_i18n2();init_use_cursor_follow();init_jsx_runtime();await __promiseAll([init_theme(),init_keymap()]);import_react90=__toESM(require_react_production(),1)});async function landTaskAction(deps,taskId,branchLabel){let{t:t3}=deps;if(!await deps.confirm(branchLabel))return!1;try{let res=await deps.orchestrator.landTask(taskId,{callerCwd:deps.callerCwd});deps.notifyInfo(t3("worktrees.land.done",{branch:res.branch,landedOn:res.landedOn,commit:res.commit}));let cleanup=res.worktree;if(cleanup&&!cleanup.removed)deps.notifyNeedsInput(t3("worktrees.land.worktreeKept",{reason:cleanup.reason??"refused"}));else if(cleanup?.reason)deps.notifyNeedsInput(t3("worktrees.land.worktreePathStale",{reason:cleanup.reason}));if(cleanup?.residue)deps.notifyNeedsInput(t3("worktrees.land.worktreeResidue",{path:cleanup.residue.path,reason:cleanup.residue.reason}));return!0}catch(err){let msg=err instanceof Error?err.message:String(err);if(LAND_CONFLICT_RE.test(msg))deps.notifyNeedsInput(t3("worktrees.land.conflict",{files:msg}));else if(MAIN_DIRTY_RE.test(msg))deps.notifyNeedsInput(t3("worktrees.land.dirtyBase"));else deps.notifyError(t3("worktrees.land.failed",{error:msg}));return console.error("[rove land] failed:",err),!1}}var LAND_CONFLICT_RE,MAIN_DIRTY_RE;var init_land_task_action=__esm(()=>{LAND_CONFLICT_RE=/LAND_CONFLICT/,MAIN_DIRTY_RE=/MAIN_CHECKOUT_DIRTY/});import{TextAttributes as TextAttributes28}from"@opentui/core";function flattenRows(projects){return projects.flatMap((p3)=>p3.worktrees)}function taskIdForPath(orch,wtPath){let norm=(p3)=>p3.replace(/^\/private\//,"/").replace(/\/+$/,""),target=norm(wtPath);return orch.listTasks().find((task)=>task.worktreePath&&norm(task.worktreePath)===target)?.id}function WorktreesPage(props){let{theme}=useTheme(),dialog=useDialog(),t3=useT(),notif=useNotifications();function notifyError(message){notif.notify({kind:"error",taskId:"",tabId:"",title:message})}function notifyNeedsInput(message){notif.notify({kind:"needs_input",taskId:"",tabId:"",title:message})}function notifyInfo(message){notif.notify({kind:"done",taskId:"",tabId:"",title:message})}let[projects,setProjects]=import_react91.useState(null),[reloadTick,setReloadTick]=import_react91.useState(0),refetch=()=>setReloadTick((tick)=>tick+1);import_react91.useEffect(()=>{let disposed=!1,fullLanded=!1,orch=props.orchestrator;if(!orch){setProjects([]);return}return orch.listWorktrees({network:!1}).then((rows)=>{if(!disposed&&!fullLanded)setProjects(rows)}).catch(()=>{}),orch.listWorktrees().then((rows)=>{if(fullLanded=!0,disposed)return;setProjects(rows);let live=new Set(flattenRows(rows).map((r6)=>r6.path));setRemovingPaths((paths)=>paths.filter((p3)=>live.has(p3)))}).catch(()=>{}),()=>{disposed=!0}},[props.orchestrator,reloadTick]);let[removingPaths,setRemovingPaths]=import_react91.useState([]),visibleProjects=(projects??[]).map((p3)=>({...p3,worktrees:p3.worktrees.filter((w4)=>!removingPaths.includes(w4.path))})),flatRows=flattenRows(visibleProjects),[cursor,setCursor]=import_react91.useState(0);import_react91.useEffect(()=>{setCursor((c2)=>clampCursor(c2,flatRows.length))},[flatRows.length]);let follow=useCursorFollow(cursor),[busyPath,setBusyPath]=import_react91.useState(null);async function deleteInBackground(row,force){let orch=props.orchestrator;if(!orch)return;setRemovingPaths((paths)=>[...paths,row.path]);try{let residue=await orch.removeWorktree(row.path,force);if(residue)notifyNeedsInput(t3("worktrees.delete.residue",{path:residue.path,reason:residue.reason}));refetch()}catch(err){if(setRemovingPaths((paths)=>paths.filter((p3)=>p3!==row.path)),!force&&err instanceof Error&&DIRTY_REFUSAL_RE.test(err.message)){if(await DialogConfirm.show(dialog,t3("worktrees.delete.forceTitle"),t3("worktrees.delete.forceBody",{branch:row.branch||row.path}),t3("common.cancel"),t3("worktrees.delete.button"),{danger:!0})===!0)await deleteInBackground(row,!0);return}notifyError(t3("worktrees.delete.failed",{error:String(err)})),console.error("[rove worktrees] delete failed:",err)}}async function requestDelete(row){if(!props.orchestrator||busyPath||removingPaths.includes(row.path))return;if(await DialogConfirm.show(dialog,t3("worktrees.delete.confirmTitle"),t3("worktrees.delete.confirmBody",{branch:row.branch||row.path}),t3("common.cancel"),t3("worktrees.delete.button"),{danger:!0})!==!0)return;deleteInBackground(row,!1)}async function requestLand(row){let orch=props.orchestrator;if(!orch||busyPath)return;let taskId=taskIdForPath(orch,row.path);if(!taskId){notifyError(t3("worktrees.land.noTask")),console.error("[rove worktrees] land refused: no tracked task for",row.path);return}setBusyPath(row.path);try{await landTaskAction({orchestrator:orch,confirm:(branch)=>DialogConfirm.show(dialog,t3("worktrees.land.confirmTitle"),t3("worktrees.land.confirmBody",{branch}),t3("common.cancel"),t3("worktrees.land.button")).then((ok)=>ok===!0),notifyInfo,notifyNeedsInput,notifyError,t:t3,callerCwd:process.cwd()},taskId,row.branch||row.path),refetch()}finally{setBusyPath(null)}}useBindings(()=>({enabled:dialog.stack.length===0,bindings:[...pageCloseBindings(props.onClose),{key:"up",cmd:()=>setCursor((c2)=>clampCursor(c2-1,flatRows.length))},{key:"k",cmd:()=>setCursor((c2)=>clampCursor(c2-1,flatRows.length))},{key:"down",cmd:()=>setCursor((c2)=>clampCursor(c2+1,flatRows.length))},{key:"j",cmd:()=>setCursor((c2)=>clampCursor(c2+1,flatRows.length))},{key:"d",cmd:()=>{let row=flatRows[cursor];if(row)requestDelete(row)}},{key:"l",cmd:()=>{let row=flatRows[cursor];if(row)requestLand(row)}}]}));function remoteBadge(status){if(status===!0)return $jsxs("text",{fg:theme.success,children:[" ",t3("worktrees.badge.remoteOn")]});if(status===!1)return $jsxs("text",{fg:theme.warning,children:[" ",t3("worktrees.badge.remoteOff")]});return $jsxs("text",{fg:theme.textMuted,children:[" ",t3("worktrees.badge.remoteUnknown")]})}function verdictBadge(row){if(row.verdictReason==="dirty"||row.verdictReason==="fresh")return null;let fg=row.verdict==="merged"?theme.success:row.verdict==="stale"?theme.warning:theme.accent;return $jsxs("text",{fg,children:[" ",t3(`worktrees.verdict.${row.verdictReason}`)]})}let loading=projects===null,rowBase=0;return $jsxs("scrollbox",{ref:follow.scrollRef,flexGrow:1,backgroundColor:theme.background,paddingTop:1,paddingLeft:2,paddingRight:2,paddingBottom:1,verticalScrollbarOptions:{trackOptions:{foregroundColor:"transparent"}},children:[$jsx("box",{flexDirection:"row",justifyContent:"space-between",children:$jsx("text",{attributes:TextAttributes28.BOLD,fg:theme.text,children:t3("worktrees.title")})}),loading?$jsx("text",{fg:theme.textMuted,children:t3("worktrees.loading")}):visibleProjects.length===0?$jsx("text",{fg:theme.textMuted,children:t3("worktrees.noProjects")}):visibleProjects.map((project)=>{let base=rowBase;return rowBase+=project.worktrees.length,$jsxs("box",{gap:0,paddingTop:1,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:project.repo}),project.worktrees.length===0?$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("worktrees.noWorktrees")}):project.worktrees.map((row,i2)=>{let absoluteIndex=base+i2,isCursor=absoluteIndex===cursor;return $jsxs("box",{ref:follow.rowRef(absoluteIndex),gap:0,onMouseUp:()=>setCursor(absoluteIndex),children:[$jsxs("box",{flexDirection:"row",children:[$jsxs("text",{fg:isCursor?theme.primary:theme.text,attributes:isCursor?TextAttributes28.BOLD:void 0,wrapMode:"none",children:[isCursor?"\u25B8 ":" ",row.branch||t3("worktrees.row.detached")]}),row.kobeManaged?$jsxs("text",{fg:theme.textMuted,children:[" ",t3("worktrees.badge.kobeManaged")]}):null,row.dirty?$jsxs("text",{fg:theme.warning,children:[" ",t3("worktrees.badge.dirty")]}):null,remoteBadge(row.branchOnRemote),verdictBadge(row),busyPath===row.path?$jsx("text",{fg:theme.textMuted,children:" \u2026"}):null]}),$jsxs("box",{flexDirection:"row",justifyContent:"space-between",paddingLeft:2,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:row.path}),row.createdAtMs>0?$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("worktrees.row.created",{age:relativeAgeMs(row.createdAtMs)})}):null]})]},row.path)})]},project.repo)})]})}var import_react91,DIRTY_REFUSAL_RE;var init_worktrees_page=__esm(async()=>{init_state();init_message_core();init_notifications();init_i18n2();init_use_cursor_follow();init_land_task_action();init_jsx_runtime();await __promiseAll([init_theme(),init_keymap(),init_dialog(),init_dialog_confirm()]);import_react91=__toESM(require_react_production(),1);DIRTY_REFUSAL_RE=/refusing to remove dirty worktree/});function useHostPagesState(focus){let[settingsOpen,setSettingsOpen]=import_react92.useState(!1),[worktreesOpen,setWorktreesOpen]=import_react92.useState(!1),[updateOpen,setUpdateOpen]=import_react92.useState(!1),[nav,setNav]=import_react92.useState("terminal"),goToNav=(next)=>{setNav(next),focus.setFocused(focusPaneForNav(next))};return{nav,setNav,goToNav,settingsOpen,openSettings:()=>setSettingsOpen(!0),closeSettings:()=>setSettingsOpen(!1),worktreesOpen,openWorktrees:()=>setWorktreesOpen(!0),closeWorktrees:()=>setWorktreesOpen(!1),updateOpen,openUpdate:()=>setUpdateOpen(!0),closeUpdate:()=>setUpdateOpen(!1),kanbanOpen:nav==="kanban",openKanban:()=>goToNav("kanban"),closeKanban:()=>goToNav("terminal"),automationsOpen:nav==="automations",openAutomations:()=>goToNav("automations"),closeAutomations:()=>goToNav("terminal"),workItemsOpen:nav==="issues",openWorkItems:()=>goToNav("issues"),closeWorkItems:()=>goToNav("terminal")}}function renderFullWindowPage(deps){if(deps.worktreesOpen)return $jsx(WorktreesPage,{orchestrator:deps.orchestrator,onClose:deps.closeWorktrees});if(deps.updateOpen)return $jsx(UpdatePage,{onClose:deps.closeUpdate});return null}function renderContentPage(deps){let orch=deps.orchestrator;if(deps.automationsOpen)return $jsx(AutomationsPage,{orchestrator:orch,focused:deps.contentFocused,...deps.selectedTask?{focusRepo:deps.selectedTask.repo}:{},onClose:deps.closeAutomations,onOpenTask:(taskId)=>{deps.closeAutomations(),deps.activateTask(taskId)}});if(deps.workItemsOpen)return $jsx(WorkItemsPage,{orchestrator:orch,focused:deps.contentFocused,onClose:deps.closeWorkItems,...deps.selectedTask?{focusRepo:deps.selectedTask.repo}:{},onOpenTask:(taskId)=>{deps.closeWorkItems(),deps.activateTask(taskId)}});if(deps.kanbanOpen)return $jsx(KanbanPage,{orchestrator:orch,focused:deps.contentFocused,onClose:deps.closeKanban,onStartChat:deps.startIssueChat,engineStates:deps.engineStates,focusTask:deps.selectedTask?{id:deps.selectedTask.id,repo:deps.selectedTask.repo}:void 0,onOpenTask:(taskId)=>{deps.closeKanban(),deps.activateTask(taskId)}});return null}function useHostPagesRender(opts){let{orchestrator,pages,focus,dialog,kv,dims,selectedTask,activeTaskId,tasks,engineState,startIssueChat,activateTask}=opts,activePane=dialog.stack.length>0?null:focus.focused,pageDeps=import_react92.useMemo(()=>({orchestrator,selectedTask,worktreesOpen:pages.worktreesOpen,automationsOpen:pages.automationsOpen,workItemsOpen:pages.workItemsOpen,kanbanOpen:pages.kanbanOpen,updateOpen:pages.updateOpen,closeWorktrees:pages.closeWorktrees,closeAutomations:pages.closeAutomations,closeWorkItems:pages.closeWorkItems,closeKanban:pages.closeKanban,closeUpdate:pages.closeUpdate,activateTask:(taskId)=>void activateTask(taskId),startIssueChat,engineStates:engineState,contentFocused:activePane==="workspace"}),[orchestrator,selectedTask,pages,startIssueChat,engineState,activePane,activateTask]),fullWindowPage=import_react92.useMemo(()=>renderFullWindowPage(pageDeps),[pageDeps]),contentPage=import_react92.useMemo(()=>renderContentPage(pageDeps),[pageDeps]),narrow=isNarrowWidth(dims.width);import_react92.useEffect(()=>{if(narrow&&focus.focused==="files")focus.setFocused("workspace")},[narrow,focus]);let surface=narrow?narrowSurface({focusedPane:focus.focused,hasSelection:selectedTask!=null,hasOpenPage:contentPage!=null}):null,showSidebar=surface!=="content",showContent=surface!=="sidebar",recentTask=import_react92.useMemo(()=>(narrow?tasks.find((task)=>task.id===activeTaskId&&!task.deletion):null)??null,[narrow,tasks,activeTaskId]);return{settingsPage:pages.settingsOpen?$jsx("box",{flexGrow:1,backgroundColor:"transparent",paddingTop:1,children:$jsx(SettingsDialog,{kv,orchestrator,onClose:pages.closeSettings})}):null,fullWindowPage,contentPage,showSidebar,showContent,recentTask}}var import_react92;var init_host_pages=__esm(async()=>{init_nav_core();init_jsx_runtime();await __promiseAll([init_automations_page(),init_kanban_page(),init_settings_dialog(),init_update_page(),init_work_items_page(),init_worktrees_page()]);import_react92=__toESM(require_react_production(),1)});function createSidebarController(opts){let schedule=opts.scheduleTimeout??((cb,ms)=>{let t3=setTimeout(cb,ms);return()=>clearTimeout(t3)}),pendingG=!1,cancelTimer=null,armChord=()=>{pendingG=!0,cancelTimer?.(),cancelTimer=schedule(()=>{pendingG=!1,cancelTimer=null},700)},disarm=()=>{pendingG=!1,cancelTimer?.(),cancelTimer=null},move=(delta)=>{let ids=opts.getFlatIds();if(ids.length===0)return;let cur=opts.getCursor(),start=cur<0?0:cur,next=Math.min(ids.length-1,Math.max(0,start+delta));opts.setCursor(next)},jumpTo=(index)=>{let ids=opts.getFlatIds();if(ids.length===0)return;opts.setCursor(Math.min(ids.length-1,Math.max(0,index)))};return{moveDown(){disarm(),move(1)},moveUp(){disarm(),move(-1)},selectCurrent(){disarm();let ids=opts.getFlatIds(),cur=opts.getCursor();if(cur<0||cur>=ids.length)return;let id=ids[cur];if(id!==void 0)opts.onSelect(id)},pressG(){if(pendingG)disarm(),jumpTo(0);else armChord()},pressShiftG(){disarm(),jumpTo(opts.getFlatIds().length-1)},isChordArmed(){return pendingG},disarmChord(){disarm()}}}function rowHaystacks(row,liveBranch){if(row.kind==="project")return[row.label];if(row.kind==="routines")return[];if(row.kind==="tab")return[row.tab.label];let task=row.task,title=task.kind==="dir"?"":task.title;return[worktreeRowLabel(task,{liveBranch:liveBranch?.(task)}),title,repoBasename(task.repo)]}function matchesRow(query,row,liveBranch){return rowHaystacks(row,liveBranch).some((field)=>field!==""&&fuzzyMatch(query,field))}function filterTreeRows(rows,query,liveBranch){let q2=query.trim();if(q2==="")return[...rows];let selfMatch=new Set,keep=new Set;for(let row of rows){if(!matchesRow(q2,row,liveBranch))continue;if(selfMatch.add(row.id),keep.add(row.id),row.kind==="project"||row.kind==="routines")continue;if(row.kind==="tab")keep.add(row.task.id);let project=ownerProjectKey(row.task);if(project!==null)keep.add(project)}let out=[];for(let row of rows){if(row.kind==="project"){if(keep.has(row.id))out.push(row);continue}if(row.kind==="routines")continue;let project=ownerProjectKey(row.task),underMatchedProject=project!==null&&selfMatch.has(project);if(row.kind==="worktree"){if(underMatchedProject||keep.has(row.id))out.push(row);continue}if(underMatchedProject||selfMatch.has(row.task.id)||keep.has(row.id))out.push(row)}return out}var init_tree_search=__esm(()=>{init_groups();init_tree_core()});function tabRowActivity(args2){if(args2.tabActivity!==void 0)return args2.tabActivity;if(!args2.active||args2.reportedTabCount>0)return;return args2.taskActivity}import{homedir as homedir31}from"os";function routinesRowId(projectKey){return`~routines:${projectKey}`}function projectKeyOfRoutinesRow(id){return id.startsWith("~routines:")?id.slice(10):null}function isRoutineTask(task){return task.routine!==void 0}function withRecentRow(rows,recent){if(!recent)return[...rows];return[{kind:"recent",id:RECENT_ROW_ID,task:recent,depth:1},...rows]}function tabRowId(taskId,tabId){return`${taskId}${TAB_ROW_SEPARATOR}${tabId}`}function parseRowId(rowId){let at2=rowId.indexOf(TAB_ROW_SEPARATOR);if(at2<0)return{taskId:rowId,tabId:null};return{taskId:rowId.slice(0,at2),tabId:rowId.slice(at2+TAB_ROW_SEPARATOR.length)}}function rowLiveBranchPath(task){if(task.kind!=="main"&&task.kind!=="dir")return"";return task.worktreePath||task.repo||""}function worktreeRowLabel(task,opts={}){let branch=(opts.liveBranch??task.branch)||task.branch;if(branch)return branch;if(task.kind!=="dir"&&task.title)return task.title;let path22=task.worktreePath||task.repo;if(path22){let home=opts.home??homedir31(),tildified=home&&(path22===home||path22.startsWith(`${home}/`))?`~${path22.slice(home.length)}`:path22;return truncateStart(tildified,PATH_LABEL_MAX)}return task.title||"scratch"}function isClosedDownProject(tasks,tabsByTask2){let only=tasks.length===1?tasks[0]:void 0;if(!only||only.kind!=="main"&&only.kind!=="dir")return!1;return tabsByTask2.get(only.id)?.length===0}function buildTreeRows(input){let{tasks,tabsByTask:tabsByTask2}=input,sortMode=input.sortMode??"default",byProject=new Map,scratchTasks=tasks.filter((task)=>task.kind==="dir"&&task.scratch===!0);if(sortMode==="recent")scratchTasks.sort(compareRecent);for(let task of tasks){if(task.kind==="dir"&&task.scratch===!0)continue;let key=sidebarProjectKey(task.repo),entry=byProject.get(key)??{repo:task.repo,tasks:[]};if(task.kind==="main")entry.repo=task.repo,entry.tasks.unshift(task);else entry.tasks.push(task);byProject.set(key,entry)}let orderedKeys=[],seen=new Set;for(let task of tasks){if(task.kind!=="main")continue;let key=sidebarProjectKey(task.repo);if(!seen.has(key))seen.add(key),orderedKeys.push(key)}for(let key of byProject.keys())if(!seen.has(key))seen.add(key),orderedKeys.push(key);if(sortMode==="recent")for(let entry of byProject.values())entry.tasks.sort((a2,b3)=>{if(a2.kind==="main"&&b3.kind!=="main")return-1;if(b3.kind==="main"&&a2.kind!=="main")return 1;return compareRecent(a2,b3)});let rows=[];if(scratchTasks.length>0){rows.push({kind:"project",id:SCRATCH_SECTION_ID,repo:"",label:"Scratch",depth:0});for(let task of scratchTasks){let tabs=tabsByTask2.get(task.id)??[];if(tabs.length===0){rows.push({kind:"worktree",id:task.id,task,depth:1});continue}for(let tab of tabs)rows.push({kind:"tab",id:tabRowId(task.id,tab.id),task,tab,depth:2})}}let visibleKeys=orderedKeys.filter((key)=>{let entry=byProject.get(key);return entry?!isClosedDownProject(entry.tasks,tabsByTask2):!1}),projectRepos=visibleKeys.map((key)=>byProject.get(key)?.repo??"");for(let key of visibleKeys){let entry=byProject.get(key);if(!entry)continue;rows.push({kind:"project",id:key,repo:entry.repo,label:sidebarProjectLabel(entry.repo,projectRepos),depth:0});let routineTasks=entry.tasks.filter(isRoutineTask);for(let task of entry.tasks)if(!isRoutineTask(task))pushWorktree(rows,task,tabsByTask2);if(routineTasks.length>0){let expanded=input.expandedRoutines?.has(key)===!0;if(rows.push({kind:"routines",id:routinesRowId(key),projectKey:key,count:routineTasks.length,expanded,depth:1}),expanded)for(let task of routineTasks)pushWorktree(rows,task,tabsByTask2)}}return rows}function pushWorktree(rows,task,tabsByTask2){rows.push({kind:"worktree",id:task.id,task,depth:1});for(let tab of tabsByTask2.get(task.id)??[])rows.push({kind:"tab",id:tabRowId(task.id,tab.id),task,tab,depth:2})}function treeFlatIds(rows){let ids=[];for(let row of rows)if(row.kind!=="project")ids.push(row.id);return ids}function ownerProjectKey(task){if(task.kind==="dir"&&task.scratch===!0)return SCRATCH_SECTION_ID;return sidebarProjectKey(task.repo)}function projectKeysOf(tasks){let keys=[],seen=new Set;for(let task of tasks){let key=ownerProjectKey(task);if(key===null||seen.has(key))continue;seen.add(key),keys.push(key)}return keys}function mainTaskIdOfProject(tasks,projectKey){for(let task of tasks){if(task.kind!=="main")continue;if(sidebarProjectKey(task.repo)===projectKey)return String(task.id)}return null}var TAB_ROW_SEPARATOR="::",RECENT_ROW_ID="~recent",SCRATCH_SECTION_ID="~scratch",PATH_LABEL_MAX=24;var init_tree_core=__esm(()=>{init_groups();init_tree_search()});function resolveSidebarHoverTooltipLayout(opts){let maxWidth=opts.maxWidth??SIDEBAR_HOVER_TOOLTIP_MAX_WIDTH,widest=Math.max(1,...opts.lines.map((line)=>approxCellWidth(line.text))),innerWidth=Math.min(maxWidth-4,widest),boxWidth=innerWidth+4,boxHeight=opts.lines.length+2;return{innerWidth,boxWidth,boxHeight,left:Math.max(0,Math.min(opts.hoverX+2,opts.screenWidth-boxWidth-1)),top:Math.max(0,Math.min(opts.hoverY+1,opts.screenHeight-boxHeight-1))}}var SIDEBAR_HOVER_TOOLTIP_Z_INDEX=2750,SIDEBAR_HOVER_TOOLTIP_MAX_WIDTH=72;var init_hover_layout=()=>{};function truncateTitle(title,max){return truncateEnd(title,max)}var init_labels=()=>{};import{TextAttributes as TextAttributes29}from"@opentui/core";function ContextMenu(props){let{theme}=useTheme();if(props.entries.length===0)return null;let layout=resolveSidebarHoverTooltipLayout({hoverX:props.x,hoverY:props.y,screenWidth:props.dims.width,screenHeight:props.dims.height,lines:props.entries.map((entry)=>({text:entry.label}))});return $jsx("box",{position:"absolute",zIndex:CONTEXT_MENU_Z_INDEX,left:layout.left,top:layout.top,width:layout.boxWidth,flexDirection:"column",...FRAME,borderColor:theme.focusAccent,backgroundColor:theme.backgroundElement,paddingLeft:1,paddingRight:1,onMouseDown:(e2)=>e2.stopPropagation(),children:props.entries.map((entry,i2)=>{let active=i2===props.cursor;return $jsx("box",{flexShrink:0,backgroundColor:active?theme.focusAccent:void 0,onMouseUp:()=>props.onPick(entry.id),children:$jsx("text",{fg:active?theme.backgroundElement:entry.danger?theme.error:theme.text,attributes:active?TextAttributes29.BOLD:void 0,wrapMode:"none",flexGrow:1,children:truncateTitle(entry.label,layout.innerWidth)})},entry.id)})})}var CONTEXT_MENU_Z_INDEX;var init_context_menu=__esm(async()=>{init_hover_layout();init_labels();init_frame();init_jsx_runtime();await init_theme();CONTEXT_MENU_Z_INDEX=SIDEBAR_HOVER_TOOLTIP_Z_INDEX+10});function zenChipGlyph(platform3=process.platform){return platform3==="darwin"?"\u262F":"\u25D0"}import{MouseButton,TextAttributes as TextAttributes30}from"@opentui/core";function SectionHeader(props){let{theme,transparentBackground:transparentBackground2}=useTheme(),dividerColor=transparentBackground2?theme.border:theme.borderSubtle,dims=useTerminalDimensions();return $jsxs("box",{flexDirection:"column",flexShrink:0,children:[props.topPad?$jsx("box",{flexShrink:0,children:$jsx("text",{wrapMode:"none",children:" "})}):null,$jsxs("box",{flexDirection:"row",flexShrink:0,gap:1,paddingLeft:1,paddingRight:1,onMouseUp:props.onPress||props.onContextMenu?(evt)=>{if(evt.button===MouseButton.RIGHT&&props.onContextMenu){props.onContextMenu(evt.x,evt.y);return}props.onPress?.()}:void 0,children:[props.prefix?$jsx("text",{fg:theme.textMuted,wrapMode:"none",flexShrink:0,children:props.prefix}):null,$jsx("text",{fg:theme.textMuted,attributes:TextAttributes30.BOLD,wrapMode:"none",flexShrink:0,children:props.label}),$jsx("text",{fg:dividerColor,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:dividerRule(dims.width)}),props.suffix?$jsx("text",{fg:theme.info,attributes:TextAttributes30.BOLD,wrapMode:"none",flexShrink:0,children:props.suffix}):null]})]})}function SidebarSearchInput(props){let{theme}=useTheme(),t3=useT();return $jsxs("box",{flexDirection:"row",gap:0,flexShrink:0,paddingBottom:1,paddingLeft:1,children:[$jsx("text",{fg:theme.info,wrapMode:"none",children:"/"}),$jsx("text",{fg:theme.text,wrapMode:"none",children:props.query}),$jsx("text",{fg:theme.info,attributes:TextAttributes30.BLINK,wrapMode:"none",children:"\u2588"}),props.query.length===0?$jsxs("text",{fg:theme.textMuted,wrapMode:"none",children:[" ",t3("tasks.search.placeholder")]}):$jsxs("text",{fg:theme.textMuted,wrapMode:"none",children:[" ",props.matchCount,"/",props.totalCount]})]})}function SidebarBrandHeader(props){let{theme}=useTheme();return $jsxs("box",{flexDirection:"row",justifyContent:"space-between",gap:1,flexShrink:0,paddingLeft:1,paddingRight:1,children:[$jsxs("box",{flexDirection:"row",gap:1,children:[$jsx("text",{fg:props.focused?theme.focusAccent:theme.textMuted,attributes:TextAttributes30.BOLD,wrapMode:"none",children:"ROVE"}),props.status?$jsxs("box",{position:"relative",onMouseUp:()=>props.onStatusClick?.(),children:[$jsx("text",{fg:props.status.emphasize?theme.warningOnHost:theme.textMuted,attributes:props.status.emphasize?TextAttributes30.BOLD:TextAttributes30.DIM,wrapMode:"none",children:props.status.label}),props.onStatusClick?$jsx(ShortcutRevealBadge,{bindingId:"inbox.show"}):null]}):null]}),props.update?$jsxs("box",{position:"relative",flexShrink:0,onMouseUp:()=>props.onUpdateClick?.(),children:[$jsx("text",{fg:theme.warningOnHost,attributes:TextAttributes30.BOLD,wrapMode:"none",children:props.update.label}),props.onUpdateClick?$jsx(ShortcutRevealBadge,{bindingId:"tasks.update"}):null]}):null]})}function SidebarCreateAction(props){let{theme,transparentBackground:transparentBackground2}=useTheme(),t3=useT(),keycap=legendCap("task.new");if(!props.onAddTask)return null;return $jsx("box",{flexShrink:0,paddingRight:1,children:$jsxs("box",{position:"relative",flexDirection:"row",flexShrink:0,gap:1,paddingLeft:1,paddingRight:1,backgroundColor:transparentBackground2?void 0:theme.backgroundElement,onMouseUp:()=>props.onAddTask?.(),children:[$jsx("text",{fg:theme.text,attributes:TextAttributes30.BOLD,wrapMode:"none",flexGrow:1,children:t3("tasks.menu.newTask")}),$jsx("text",{fg:theme.primary,attributes:TextAttributes30.BOLD,wrapMode:"none",flexShrink:0,children:"+"}),keycap?$jsx("text",{fg:theme.textMuted,attributes:TextAttributes30.DIM,wrapMode:"none",flexShrink:0,children:keycap}):null,$jsx(ShortcutRevealBadge,{bindingId:"task.new"})]})})}function SidebarNavRail(props){let{theme}=useTheme(),t3=useT();return $jsx("box",{flexDirection:"column",flexShrink:0,paddingBottom:1,children:SIDEBAR_NAV_ITEMS.map((item)=>{let active=props.nav===item.nav;return $jsxs("box",{position:"relative",flexDirection:"row",flexShrink:0,paddingLeft:1,paddingRight:1,onMouseUp:(e2)=>{e2.stopPropagation(),props.setNav(item.nav)},children:[$jsx("text",{fg:active?theme.text:theme.textMuted,attributes:active?TextAttributes30.BOLD:void 0,wrapMode:"none",flexGrow:1,children:t3(item.labelKey)}),$jsx(ShortcutRevealBadge,{bindingId:item.bindingId})]},item.nav)})})}function SidebarZenChip(props){let{theme}=useTheme();return $jsxs("box",{position:"relative",flexShrink:0,paddingLeft:1,paddingRight:1,paddingTop:1,children:[$jsx("text",{fg:theme.accent,attributes:TextAttributes30.BOLD,wrapMode:"none",onMouseUp:(e2)=>{e2.stopPropagation(),props.onZenClick?.()},children:`${zenChipGlyph()} ZEN`}),$jsx(ShortcutRevealBadge,{bindingId:"workspace.zenToggle"})]})}var init_chrome=__esm(async()=>{init_help_groups();init_nav_core();init_i18n2();init_jsx_runtime();await __promiseAll([init_react(),init_shortcut_reveal2(),init_theme()])});function createBackgroundPoller(cfg){let entries=new Map,equals=cfg.equals??((a2,b3)=>a2===b3);function entryFor(key){let entry=entries.get(key);if(!entry){let current=cfg.initial;entry={read:()=>current,write:(next)=>{if(!equals(current,next))current=next},inFlight:!1,nextAllowedAt:0},entries.set(key,entry)}return entry}return{read(key){if(!key)return cfg.initial;return entryFor(key).read()},poll(key){if(!key)return;let entry=entryFor(key);maybeStartScheduledRun(entry,cfg,(signal)=>cfg.run(key,signal),(value)=>entry.write(value))},reset(){entries.clear()}}}var init_background_poll=__esm(()=>{init_poll_scheduling2();init_poll_scheduling2()});import{stat as stat12}from"fs/promises";import{join as join46}from"path";async function headFingerprint(repo){try{let st2=await stat12(join46(repo,".git","HEAD"));return`${st2.mtimeMs}:${st2.size}`}catch{return null}}async function resolveBranchHead(repo,signal,spawn12=spawnCapture){let fingerprint=await headFingerprint(repo);if(fingerprint!==null){let cached3=headCache.get(repo);if(cached3&&cached3.fingerprint===fingerprint)return cached3.value}let value="",resolved=!1,ref=await spawn12("git",["symbolic-ref","--short","HEAD"],{cwd:repo,env:readOnlyGitProcessEnv(),signal}),name=ref.status===0?ref.stdout.trim():"";if(name&&name!=="HEAD")value=name,resolved=!0;else if((await spawn12("git",["rev-parse","--verify","HEAD"],{cwd:repo,env:readOnlyGitProcessEnv(),signal})).status===0)value="(detached)",resolved=!0;if(resolved&&fingerprint!==null)headCache.set(repo,{fingerprint,value});return value}function currentBranch(repo){return poller.read(repo)}function pollCurrentBranch(repo){poller.poll(repo)}var BRANCH_POLL_TIMEOUT_MS=2000,BRANCH_SLOW_RETRY_MS=30000,BRANCH_MIN_POLL_INTERVAL_MS=1500,headCache,poller;var init_git_head=__esm(()=>{init_git_env();init_background_poll();headCache=new Map;poller=createBackgroundPoller({initial:"",timeoutMs:BRANCH_POLL_TIMEOUT_MS,slowRetryMs:BRANCH_SLOW_RETRY_MS,minIntervalMs:BRANCH_MIN_POLL_INTERVAL_MS,run:(repo,signal)=>resolveBranchHead(repo,signal)})});var DEFAULT_SPINNER_FRAMES;var init_spinner_frames=__esm(()=>{DEFAULT_SPINNER_FRAMES=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]});function activityToneFor(state){switch(state){case"rate_limited":case"permission_needed":return"warning";case"error":case"dead":return"error";default:return null}}function noTrackingSubtitle(){return t("tasks.subtitle.noTracking")}function materializingSubtitle(){return t("tasks.subtitle.materializing")}function deletionSubtitle(failed){return failed?t("tasks.subtitle.deleteFailed"):t("tasks.subtitle.deleting")}function isCustomEngineTask(task){if(task.kind==="main")return!1;return task.vendor!==void 0&&!isBuiltinVendor(task.vendor)}function stillWorkingAfterCompletion(activity,transcript){if(activity?.state!=="turn_complete"||!transcript)return!1;if(!activity.at||!transcript.mtimeMs)return!1;return transcript.mtimeMs>activity.at+COMPLETION_TRANSCRIPT_GRACE_MS}function rowIsLoading(opts){let{task}=opts,activityState=opts.activity?.state,hasActivity=activityState!==void 0,untrackedCustomEngine=isCustomEngineTask(task)&&!hasActivity,materializing=opts.job!==void 0,deleting=task.deletion?.phase==="queued"||task.deletion?.phase==="running",working=activityState==="running"||stillWorkingAfterCompletion(opts.activity,opts.transcript);return deleting||materializing||!untrackedCustomEngine&&working}function buildSidebarRowView(opts){let{task}=opts,isMain=task.kind==="main",branch=isMain?opts.mainBranch??"":task.branch,activityState=opts.activity?.state,hasActivity=activityState!==void 0,activityBadge=stillWorkingAfterCompletion(opts.activity,opts.transcript)?null:activityBadgeFor(activityState,opts.completionSeen===!0),activityTone=activityToneFor(activityState),untrackedCustomEngine=isCustomEngineTask(task)&&!hasActivity,materializing=opts.job!==void 0,deleting=task.deletion?.phase==="queued"||task.deletion?.phase==="running",deleteFailed=task.deletion?.phase==="error",loading=rowIsLoading({task,activity:opts.activity,job:opts.job,transcript:opts.transcript}),spinnerFrames=DEFAULT_SPINNER_FRAMES,spinner=spinnerFrames[opts.spinnerFrame%spinnerFrames.length]??spinnerFrames[0],tone=deleteFailed?"error":deleting||materializing?"primary":untrackedCustomEngine?"textMuted":activityTone??(loading?"primary":activityBadge?.tone??"textMuted"),fallbackSubtitle=untrackedCustomEngine?noTrackingSubtitle():"\u2014",subagents=loading?opts.lifecycle?.subagents??0:0,branchWithMarks=subagents>0&&branch.length>0?`\u25C7${subagents} ${branch}`:branch,subtitleText=deleting||deleteFailed?opts.truncateBranch(deletionSubtitle(deleteFailed),opts.subtitleBudget):materializing?opts.truncateBranch(materializingSubtitle(),opts.subtitleBudget):branchWithMarks.length>0?opts.truncateBranch(branchWithMarks,opts.subtitleBudget):opts.truncateBranch(fallbackSubtitle,opts.subtitleBudget),restGlyph=deleteFailed?ERROR_GLYPH:untrackedCustomEngine?NO_STATE_GLYPH:activityBadge?.glyph??"\u25CB";return{isMain,titleText:isMain?repoBasename(task.repo):task.title,subtitleText,loading,stateGlyph:loading?spinner:restGlyph,tone,spinnerFrames,materializing}}function withSpinnerFrame(view,frame){if(!view.loading)return view;let frames=view.spinnerFrames,spinner=frames[frame()%frames.length]??frames[0]??"\u280B";if(spinner===view.stateGlyph)return view;return{...view,stateGlyph:spinner}}function activityBadgeFor(state,completionSeen){switch(state){case"rate_limited":return{glyph:"\u25F7",tone:"warning"};case"permission_needed":return{glyph:"?",tone:"warning"};case"error":return{glyph:ERROR_GLYPH,tone:"error"};case"dead":return{glyph:DEAD_GLYPH,tone:"error"};case"turn_complete":return completionSeen?null:{glyph:"\u25CF",tone:"primary"};default:return null}}var IN_PROGRESS_SPINNER,SPINNER_FRAME_MS=100,SPINNER_TICK_CYCLE=600,NO_STATE_GLYPH="\xB7",ERROR_GLYPH="\xD7",DEAD_GLYPH="\u2020",COMPLETION_TRANSCRIPT_GRACE_MS=2000;var init_row_view2=__esm(()=>{init_spinner_frames();init_i18n();init_vendor();init_groups();IN_PROGRESS_SPINNER=DEFAULT_SPINNER_FRAMES});function prCheckChip(task){let stale=task.prStatus?.lastError!==void 0;switch(task.prStatus?.checkState){case"passing":return{glyph:"\u2713",tone:stale?"textMuted":"success"};case"failing":return{glyph:"\u2717",tone:stale?"textMuted":"error"};case"pending":return{glyph:"\u2022",tone:stale?"textMuted":"warning"};default:return null}}function prConflictChip(task){if((task.prStatus?.mergeable??"").toUpperCase()!=="CONFLICTING")return null;return{glyph:"\u2260",tone:task.prStatus?.lastError===void 0?"error":"textMuted"}}function prReviewChip(task){let stale=task.prStatus?.lastError!==void 0;switch(task.prStatus?.lifecycle){case"ready_to_merge":return{glyph:"\xBB",tone:stale?"textMuted":"success"};case"merged":return{glyph:"\u2261",tone:"textMuted"};default:return null}}function statusChip(task){switch(task.status){case"in_review":return{glyph:"\u25C7",tone:"primary"};case"done":return{glyph:"\u25C6",tone:"success"};case"canceled":return{glyph:DEAD_GLYPH,tone:"textMuted"};case"error":return{glyph:ERROR_GLYPH,tone:"error"};default:return null}}var init_row_chips=__esm(()=>{init_row_view2()});function tick(){frame=(frame+1)%SPINNER_TICK_CYCLE;for(let listener2 of listeners)try{listener2()}catch{}}function spinnerFrameSnapshot(){return frame}function subscribeSpinnerFrame(listener2){if(listeners.add(listener2),timer===null)timer=setInterval(tick,SPINNER_FRAME_MS),timer.unref?.();return()=>{if(listeners.delete(listener2),listeners.size===0&&timer!==null)clearInterval(timer),timer=null,frame=0}}var listeners,frame=0,timer=null;var init_spinner_frame_store=__esm(()=>{init_row_view2();listeners=new Set});function worktreeChanges(worktreePath){return poller2.read(worktreePath)}function pollWorktreeChanges(worktreePath){poller2.poll(worktreePath)}var POLL_TIMEOUT_MS=4000,SLOW_REPO_RETRY_MS=60000,MIN_POLL_INTERVAL_MS=1500,ZERO2,poller2;var init_worktree_changes_poller=__esm(()=>{init_git_env();init_background_poll();init_worktree_changes();init_background_poll();ZERO2={added:0,deleted:0},poller2=createBackgroundPoller({initial:ZERO2,equals:sameWorktreeChanges,timeoutMs:POLL_TIMEOUT_MS,slowRetryMs:SLOW_REPO_RETRY_MS,minIntervalMs:MIN_POLL_INTERVAL_MS,run:async(worktreePath,signal)=>{let res=await spawnCapture("git",["status","--porcelain=v1"],{cwd:worktreePath,env:readOnlyGitProcessEnv(),signal});if(res.status!==0)throw Error("git status failed");return parsePorcelain(res.stdout)}})});function completionSeenKey(taskId,tabId){return tabId===void 0?taskId:`${taskId}\x00${tabId}`}function parseCompletionSeen(stored){if(typeof stored!=="object"||stored===null||Array.isArray(stored))return{};let out={};for(let[key,at2]of Object.entries(stored))if(typeof at2==="number"&&Number.isFinite(at2))out[key]=at2;return out}function foldCompletionSeen(seen,key,at2,limit=200){let known=seen[key];if(known!==void 0&&known>=at2)return seen;let next={...seen,[key]:at2},keys=Object.keys(next);if(keys.length<=limit)return next;let pruned={};for(let k3 of keys.sort((a2,b3)=>next[b3]-next[a2]).slice(0,limit))pruned[k3]=next[k3];return pruned}function completionSeenAt(kv,key,at2){if(!kv||at2===void 0)return!1;let stored=kv.get("completionSeen");if(typeof stored!=="object"||stored===null||Array.isArray(stored))return!1;let known=stored[key];return typeof known==="number"&&known>=at2}function markCompletionSeen(kv,key,at2){let seen=parseCompletionSeen(kv.get("completionSeen")),next=foldCompletionSeen(seen,key,at2);if(next!==seen)kv.set("completionSeen",next)}function seenCompletionTabs(kv,taskId,stamps){let seen=new Set;for(let[tabId,at2]of stamps)if(completionSeenAt(kv,completionSeenKey(taskId,tabId),at2))seen.add(tabId);return seen}function useSpinnerFrame(active){return import_react94.useSyncExternalStore(active?subscribeSpinnerFrame:NOOP_SUBSCRIBE,active?spinnerFrameSnapshot:ZERO_FRAME)}function useChanges(sources,task){let pushed=pickPushedChanges(sources.worktreeChanges,task.worktreePath),hasPushed=pushed!==null;return import_react94.useEffect(()=>{if(sources.branchTick,hasPushed)return;pollWorktreeChanges(task.worktreePath)},[hasPushed,task.worktreePath,sources.branchTick]),pushed??worktreeChanges(task.worktreePath)}function ChangeStats(props){let{theme}=useTheme(),behind=props.changes.behind??0;if(props.changes.added<=0&&props.changes.deleted<=0&&behind<=0)return null;return $jsxs("box",{flexDirection:"row",gap:1,flexShrink:0,children:[props.changes.added>0?$jsxs("text",{fg:theme.success,wrapMode:"none",flexShrink:0,children:["+",props.changes.added]}):null,props.changes.deleted>0?$jsxs("text",{fg:theme.error,wrapMode:"none",flexShrink:0,children:["\u2212",props.changes.deleted]}):null,behind>0?$jsxs("text",{fg:theme.warning,wrapMode:"none",flexShrink:0,children:["\u2193",behind]}):null]})}function completionSeenFor(taskId,activityState,viewing,tabId,durableSeen=!1){let key=completionSeenKey(taskId,tabId);if(activityState==="turn_complete"){if(viewing)completionSeenIds.add(key)}else completionSeenIds.delete(key);return completionSeenIds.has(key)||durableSeen}function completionStampOf(activity){return activity?.state==="turn_complete"?activity.at:void 0}function useDurableCompletionSeen(taskId,tabId,completionAt,viewing){let kv=useOptionalKV(),key=completionSeenKey(taskId,tabId),seen=completionSeenAt(kv,key,completionAt);return import_react94.useEffect(()=>{if(!kv||!viewing||completionAt===void 0||seen)return;markCompletionSeen(kv,key,completionAt)},[kv,key,completionAt,viewing,seen]),seen}function JumpDigit(_props){return null}var import_react94,NOOP_SUBSCRIBE=()=>()=>{},ZERO_FRAME=()=>0,completionSeenIds;var init_row_cards=__esm(async()=>{init_spinner_frame_store();init_worktree_changes();init_worktree_changes_poller();init_kv();init_jsx_runtime();await init_theme();import_react94=__toESM(require_react_production(),1);completionSeenIds=new Set});import{MouseButton as MouseButton2}from"@opentui/core";function treeLabelBudget(shared2,reserved){let width=shared2.width??SIDEBAR_WIDTH;return Math.max(6,width-3-reserved)}function clusterCells(text){let cells=1;for(let ch of text)cells+=charWidth(ch.codePointAt(0)??0);return cells}function MoveChip(props){let{theme}=useTheme(),t3=useT();if(props.shared.movingRowId!==props.rowId)return null;return $jsx("text",{fg:theme.info,wrapMode:"none",flexShrink:0,children:t3("tasks.moveChip").trim()})}function RowShell(props){let{theme}=useTheme(),shared2=props.shared,selection=resolveRowSelectionChrome(theme,{cursor:shared2.cursorIndex===props.flatIndex,selected:shared2.activeRowId===props.rowId});return $jsxs("box",{ref:(renderable)=>{if(!renderable)return;return shared2.rowEls.set(props.flatIndex,renderable),()=>{if(shared2.rowEls.get(props.flatIndex)===renderable)shared2.rowEls.delete(props.flatIndex)}},width:"100%",flexDirection:"row",gap:0,backgroundColor:selection.backgroundColor,onMouseUp:(evt)=>{if(evt.stopPropagation(),evt.button===MouseButton2.RIGHT&&shared2.onContextMenu){shared2.onContextMenu(props.flatIndex,props.rowId,evt.x,evt.y);return}shared2.onPress(props.flatIndex,props.rowId)},children:[$jsx("text",{fg:selection.markerColor,wrapMode:"none",children:selection.marker}),$jsx("text",{wrapMode:"none",flexShrink:0,children:" ".repeat(props.depth*INDENT_CELLS)}),props.children]})}function WorktreeTreeRow(props){let{theme}=useTheme(),t3=useT(),shared2=props.shared,task=props.task,isCursor=shared2.cursorIndex===props.flatIndex,changes=useChanges(shared2,task),chip=prCheckChip(task),conflict=prConflictChip(task),review=prReviewChip(task),status=statusChip(task),livePath=rowLiveBranchPath(task);import_react95.useEffect(()=>{if(shared2.branchTick,livePath)pollCurrentBranch(livePath)},[livePath,shared2.branchTick]);let label=worktreeRowLabel(task,livePath?{liveBranch:currentBranch(livePath)}:{}),moving=shared2.movingRowId===props.rowId,materializing=shared2.taskJobs?.get(task.id)!==void 0,frame2=useSpinnerFrame(materializing),reserved=(materializing?2:0)+(task.pinned===!0?2:0)+(chip?2:0)+(conflict?2:0)+(review?2:0)+(status?2:0)+(changes.added>0?clusterCells(`+${changes.added}`):0)+(changes.deleted>0?clusterCells(`\u2212${changes.deleted}`):0)+((changes.behind??0)>0?clusterCells(`\u2193${changes.behind}`):0)+(moving?clusterCells(t3("tasks.moveChip").trim()):0);return $jsxs(RowShell,{rowId:props.rowId,flatIndex:props.flatIndex,depth:1,shared:shared2,children:[materializing?$jsx("text",{fg:theme.primary,wrapMode:"none",width:2,flexShrink:0,children:`${IN_PROGRESS_SPINNER[frame2%IN_PROGRESS_SPINNER.length]??IN_PROGRESS_SPINNER[0]} `}):null,$jsxs("box",{flexDirection:"row",flexGrow:1,paddingRight:1,gap:1,children:[$jsx("text",{fg:theme.text,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:truncateEndCells(label,treeLabelBudget(shared2,reserved),charWidth)}),task.pinned===!0?$jsx("text",{fg:theme.warning,wrapMode:"none",flexShrink:0,children:"\u25B4"}):null,status?$jsx("text",{fg:toneColor(theme,status.tone),wrapMode:"none",flexShrink:0,children:status.glyph}):null,chip?$jsx("text",{fg:toneColor(theme,chip.tone),wrapMode:"none",flexShrink:0,children:chip.glyph}):null,conflict?$jsx("text",{fg:toneColor(theme,conflict.tone),wrapMode:"none",flexShrink:0,children:conflict.glyph}):null,review?$jsx("text",{fg:toneColor(theme,review.tone),wrapMode:"none",flexShrink:0,children:review.glyph}):null,$jsx(ChangeStats,{changes}),$jsx(MoveChip,{rowId:props.rowId,shared:shared2}),$jsx(JumpDigit,{flatIndex:props.flatIndex,dim:!isCursor})]})]})}function useTabRowBaseView(args2){let t3=useT(),{task,activity,lifecycle,job,completionSeen}=args2;return import_react95.useMemo(()=>{return buildSidebarRowView({task,activity,lifecycle,job,spinnerFrame:0,subtitleBudget:0,truncateBranch:truncateBranchLabel,completionSeen})},[task,activity,lifecycle,job,completionSeen,t3])}function TabTreeRow(props){let{theme}=useTheme(),t3=useT(),shared2=props.shared,isCursor=shared2.cursorIndex===props.flatIndex,isAgent=props.tab.engine===!0,taskTabStates=isAgent?shared2.engineTabState?.get(props.task.id):void 0,activity=isAgent?tabRowActivity({tabActivity:taskTabStates?.get(props.tab.id),reportedTabCount:taskTabStates?.size??0,taskActivity:shared2.engineState?.get(props.task.id),active:props.tab.active===!0}):void 0,carriesState=activity!==void 0,viewing=shared2.selectedTaskId===props.task.id&&props.tab.active===!0,durableSeen=useDurableCompletionSeen(props.task.id,props.tab.id,carriesState?completionStampOf(activity):void 0,viewing),completionSeen=carriesState?completionSeenFor(props.task.id,activity?.state,viewing,props.tab.id,durableSeen):!1,baseView=useTabRowBaseView({task:props.task,activity,lifecycle:carriesState?shared2.engineLifecycle?.get(props.task.id):void 0,job:carriesState?shared2.taskJobs?.get(props.task.id):void 0,completionSeen}),frame2=useSpinnerFrame(carriesState&&baseView.loading),rowView=withSpinnerFrame(baseView,()=>frame2),glyph=isAgent&&carriesState?rowView.stateGlyph:NO_STATE_GLYPH;return $jsxs(RowShell,{rowId:props.rowId,flatIndex:props.flatIndex,depth:1,shared:props.shared,children:[$jsx("text",{fg:carriesState?toneColor(theme,rowView.tone):theme.textMuted,wrapMode:"none",width:2,flexShrink:0,children:`${glyph} `}),$jsxs("box",{flexDirection:"row",flexGrow:1,paddingRight:1,gap:1,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",flexBasis:0,flexGrow:1,flexShrink:1,children:truncateEndCells(props.tab.label,treeLabelBudget(shared2,2+(shared2.movingRowId===props.rowId?clusterCells(t3("tasks.moveChip").trim()):0)),charWidth)}),$jsx(MoveChip,{rowId:props.rowId,shared:shared2}),$jsx(JumpDigit,{flatIndex:props.flatIndex,dim:!isCursor})]})]})}function RoutinesTreeRow(props){let{theme}=useTheme(),t3=useT();return $jsxs(RowShell,{rowId:props.rowId,flatIndex:props.flatIndex,depth:1,shared:props.shared,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"none",width:2,flexShrink:0,children:props.expanded?"\u25BE ":"\u25B8 "}),$jsx("text",{fg:theme.textMuted,wrapMode:"none",flexShrink:1,children:t3("tasks.routinesRow",{count:String(props.count)})})]})}function RecentJumpRow(props){let{theme}=useTheme(),t3=useT();return $jsxs(RowShell,{rowId:props.rowId,flatIndex:props.flatIndex,depth:1,shared:props.shared,children:[$jsx("text",{fg:theme.accent,wrapMode:"none",width:2,flexShrink:0,children:"\u21A9 "}),$jsx("text",{fg:theme.text,wrapMode:"none",flexShrink:1,children:t3("tasks.recentJump",{title:props.task.title})})]})}var import_react95,INDENT_CELLS=1;var init_tree_rows=__esm(async()=>{init_git_head();init_row_chips();init_row_view2();init_tree_core();init_view_core();init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_row_cards()]);import_react95=__toESM(require_react_production(),1)});function SidebarTreeBody(props){let{theme}=useTheme(),t3=useT();return $jsx("scrollbox",{ref:props.setScrollRef,flexGrow:1,minHeight:0,stickyScroll:!1,verticalScrollbarOptions:{visible:!1},children:$jsxs("box",{flexShrink:0,gap:0,children:[props.rows.map((row,i2)=>{if(row.kind==="project"){let isScratch=row.id===SCRATCH_SECTION_ID;return $jsx(SectionHeader,{label:isScratch?t3("tasks.header.scratch"):row.label,suffix:props.movingProjectId===row.id?t3("tasks.moveChip"):void 0,topPad:i2>0,onContextMenu:props.onProjectContextMenu&&!isScratch?(x2,y3)=>props.onProjectContextMenu?.(row.id,x2,y3):void 0},row.id)}if(row.kind==="recent")return $jsx(RecentJumpRow,{rowId:row.id,flatIndex:props.flatIndexOf.get(row.id)??-1,task:row.task,shared:props.shared},row.id);if(row.kind==="routines")return $jsx(RoutinesTreeRow,{rowId:row.id,flatIndex:props.flatIndexOf.get(row.id)??-1,count:row.count,expanded:row.expanded,shared:props.shared},row.id);if(row.kind==="worktree")return $jsx(WorktreeTreeRow,{rowId:row.id,flatIndex:props.flatIndexOf.get(row.id)??-1,task:row.task,shared:props.shared},row.id);return $jsx(TabTreeRow,{rowId:row.id,flatIndex:props.flatIndexOf.get(row.id)??-1,task:row.task,tab:row.tab,shared:props.shared},row.id)}),props.rows.length===0?$jsx("box",{paddingTop:1,paddingLeft:1,children:$jsx("text",{fg:theme.textMuted,children:t3(sidebarEmptyStateKey({searching:props.searching,projectFilter:!1}))})}):null]})})}var init_tree_panel=__esm(async()=>{init_tree_core();init_view_core();init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_chrome(),init_tree_rows()])});function cursorTaskIdOf(rowId){if(rowId===void 0||rowId===RECENT_ROW_ID)return null;return parseRowId(rowId).taskId}function useTreeBindings(opts){let{focused,search,menu,moveMode,onMoveModeExit,controller,flatIdsRef,cursorRef,moveCursorRow,onDeleteRequest,onRenameRequest,onPinRequest,onLocalMergeRequest,markKeysUsed}=opts;function withCursorTask(fn){let taskId=cursorTaskIdOf(flatIdsRef.current[cursorRef.current]);if(taskId!==null&&fn)fn(taskId)}useBindings(()=>({enabled:focused&&!search.active&&!menu.open,bindings:bindByIds({"sidebar.nav":(_evt,slot)=>{markKeysUsed();let down=(slot??0)%2===0;if(moveMode){moveCursorRow(down?1:-1);return}if(down)controller.moveDown();else controller.moveUp()},"sidebar.select":()=>{if(markKeysUsed(),moveMode){onMoveModeExit?.();return}controller.selectCurrent()},"sidebar.goto":(_evt,slot)=>{if(moveMode)return;if((slot??0)%2===1)controller.pressShiftG();else controller.pressG()},"sidebar.tree.open":()=>{if(moveMode)return;controller.selectCurrent()},"sidebar.search.enter":()=>{if(moveMode)return;search.enter()},"sidebar.delete":()=>{if(moveMode)return;markKeysUsed(),withCursorTask(onDeleteRequest)},"sidebar.rename":()=>{if(moveMode)return;markKeysUsed(),withCursorTask(onRenameRequest)},"sidebar.localMerge":()=>withCursorTask(onLocalMergeRequest),"sidebar.pin":()=>{if(moveMode)return;markKeysUsed(),withCursorTask(onPinRequest)}})})),useBindings(()=>({enabled:focused&&moveMode,bindings:[{key:"escape",cmd:()=>onMoveModeExit?.()}]})),useBindings(()=>({enabled:focused&&search.active,bindings:bindByIds({"sidebar.search.nav":(_evt,slot)=>{if((slot??0)%2===0)controller.moveDown();else controller.moveUp()},"sidebar.search.submit":()=>{controller.selectCurrent(),search.exit()},"sidebar.search.cancel":()=>search.exit()})})),useBindings(()=>({enabled:focused&&menu.open,bindings:[...bindByIds({"sidebar.nav":(_evt,slot)=>menu.moveCursor((slot??0)%2===0?1:-1),"sidebar.select":()=>menu.pickCurrent()}),{key:"escape",cmd:()=>menu.close()}]}))}var init_use_tree_bindings=__esm(async()=>{init_tree_core();init_keybindings2();await init_keymap()});function newTabVerbs(){return[{action:"newChat",labelKey:"tasks.menu.newChat"},{action:"newShell",labelKey:"tasks.menu.newShell"}]}function taskVerbs(task){let verbs=[{action:"rename",labelKey:"tasks.menu.rename"}];if(task.kind!=="main")verbs.push({action:"pin",labelKey:task.pinned===!0?"tasks.menu.unpin":"tasks.menu.pin"});if(verbs.push({action:"reorder",labelKey:"tasks.menu.reorder"}),task.prompt!==void 0)verbs.push({action:"runAgain",labelKey:"tasks.menu.runAgain"});if(verbs.push({action:"setStatus",labelKey:"tasks.menu.setStatus"}),task.branch!=="")verbs.push({action:"copyBranch",labelKey:"tasks.menu.copyBranch"});if(task.worktreePath!=="")verbs.push({action:"copyPath",labelKey:"tasks.menu.copyPath"});if(verbs.push({action:"openEditor",labelKey:"tasks.menu.openEditor"}),task.branch!=="")verbs.push({action:"renameBranch",labelKey:"tasks.menu.renameBranch"});if(verbs.push({action:"changeEngine",labelKey:"tasks.menu.changeEngine"}),task.prStatus?.checkState==="failing")verbs.push({action:"fixChecks",labelKey:"tasks.menu.fixChecks"});if(task.kind==="task"&&task.branch!=="")verbs.push({action:"syncBase",labelKey:"tasks.menu.syncBase"});if(task.kind==="task"&&task.branch!=="")verbs.push({action:"land",labelKey:"tasks.menu.land"});return verbs.push({action:"delete",labelKey:"tasks.menu.delete",danger:!0}),verbs}function treeMenuItems(row,ctx3={}){if(row.kind==="project")return[{action:"newTask",labelKey:"tasks.menu.newTask"},{action:"fieldNotes",labelKey:"tasks.menu.fieldNotes"},{action:"forgetProject",labelKey:"tasks.menu.forgetProject",danger:!0}];if(row.kind==="worktree")return[{action:"open",labelKey:"tasks.menu.open"},...newTabVerbs(),...taskVerbs(row.task)];if(row.kind==="routines")return[];let tabItems=[{action:"open",labelKey:"tasks.menu.openTab"}];if((ctx3.tabCount??0)>0)tabItems.push({action:"closeTab",labelKey:"tasks.menu.closeTab"});return[...tabItems,...newTabVerbs(),...taskVerbs(row.task)]}function dispatch2(event){for(let handler of[...subscribers])handler(event)}function subscribeGlobalMouseDown(host,handler){if(subscribers.add(handler),installedHost!==host){if(installedHost)installedHost.onMouseDown=void 0;installedHost=host,host.onMouseDown=dispatch2}return()=>{if(subscribers.delete(handler),subscribers.size===0&&installedHost)installedHost.onMouseDown=void 0,installedHost=null}}var subscribers,installedHost=null;var init_global_mouse_down=__esm(()=>{subscribers=new Set});function useGlobalMouseDown(enabled,handler){let renderer=useRenderer(),latest2=useLatest(handler);import_react97.useEffect(()=>{let root=renderer?.root;if(!enabled||!root)return;return subscribeGlobalMouseDown(root,()=>latest2.current())},[enabled,renderer])}var import_react97;var init_use_global_mouse_down=__esm(async()=>{init_global_mouse_down();init_use_latest();await init_react();import_react97=__toESM(require_react_production(),1)});function useTreeMenu(deps){let t3=useT(),{tree,activateRow,setCursorIndex,actions}=deps,[menu,setMenu]=import_react98.useState(null),[cursor,setCursor]=import_react98.useState(0),openAt=import_react98.useCallback((row,ctx3,x2,y3)=>{let items=treeMenuItems(row,ctx3);setMenu({row,actions:items.map((item)=>item.action),entries:items.map((item)=>({id:item.action,label:t3(item.labelKey),danger:item.danger})),x:x2,y:y3}),setCursor(0)},[t3]),openForRow=import_react98.useCallback((flatIndex,rowId,x2,y3)=>{let row=tree.rows.find((candidate)=>candidate.id===rowId);if(!row||row.kind==="project"||row.kind==="recent"||row.kind==="routines")return;setCursorIndex(flatIndex),openAt(row,{tabCount:tree.tabCount(row.task.id)},x2,y3)},[tree.rows,tree.tabCount,openAt,setCursorIndex]),openForProject=import_react98.useCallback((projectId,x2,y3)=>{let row=tree.rows.find((candidate)=>candidate.kind==="project"&&candidate.id===projectId);if(!row)return;openAt(row,{},x2,y3)},[tree.rows,openAt]),close=import_react98.useCallback(()=>setMenu(null),[]);useGlobalMouseDown(menu!==null,close);let moveCursor=import_react98.useCallback((delta)=>{let count=menu?.entries.length??0;if(count===0)return;setCursor((prev)=>(prev+delta+count)%count)},[menu]),fire=import_react98.useCallback((action)=>{if(!menu||action===void 0)return;let row=menu.row;if(setMenu(null),row.kind==="project"){if(action==="newTask")deps.onAddTask?.();if(action==="fieldNotes")actions.onFieldNotesRequest?.(row.repo);if(action==="forgetProject"){let mainId=deps.tree.mainTaskIdOfProject(row.id);if(mainId)actions.onDeleteRequest?.(mainId)}return}if(row.kind==="routines")return;let taskId=row.task.id;switch(action){case"open":activateRow(row.id);break;case"closeTab":if(row.kind==="tab")deps.onCloseTab?.(taskId,row.tab.id);break;case"newChat":deps.onNewTab?.(taskId,"chat");break;case"newShell":deps.onNewTab?.(taskId,"shell");break;case"rename":actions.onRenameRequest?.(taskId);break;case"pin":actions.onPinRequest?.(taskId);break;case"reorder":actions.onLocalMergeRequest?.(taskId);break;case"runAgain":actions.onRunAgainRequest?.(taskId);break;case"setStatus":actions.onSetStatusRequest?.(taskId);break;case"copyBranch":actions.onCopyRequest?.(taskId,"branch");break;case"copyPath":actions.onCopyRequest?.(taskId,"path");break;case"openEditor":actions.onOpenEditorRequest?.(taskId);break;case"renameBranch":actions.onRenameBranchRequest?.(taskId);break;case"changeEngine":actions.onChangeEngineRequest?.(taskId);break;case"fixChecks":actions.onFixChecksRequest?.(taskId);break;case"syncBase":actions.onSyncBaseRequest?.(taskId);break;case"land":actions.onLandRequest?.(taskId);break;case"delete":actions.onDeleteRequest?.(taskId);break;default:break}},[menu,activateRow,actions,deps.onAddTask,deps.onCloseTab,deps.onNewTab,deps.tree.mainTaskIdOfProject]),pickCurrent=import_react98.useCallback(()=>fire(menu?.actions[cursor]),[fire,menu,cursor]),pick=import_react98.useCallback((action)=>fire(menu?.actions.find((candidate)=>candidate===action)),[fire,menu]);return{open:menu!==null,entries:menu?.entries??[],cursor,x:menu?.x??0,y:menu?.y??0,close,moveCursor,pickCurrent,pick,openForRow,openForProject}}var import_react98;var init_use_tree_menu=__esm(async()=>{init_i18n2();await init_use_global_mouse_down();import_react98=__toESM(require_react_production(),1)});function useTreeSearch(opts){let[active,setActive2]=import_react100.useState(!1),[query,setQuery]=import_react100.useState(""),focusedRef=useLatest(opts.focused),onActiveChange=opts.onActiveChange,onActiveChangeRef=useLatest(onActiveChange);import_react100.useEffect(()=>()=>{onActiveChangeRef.current?.(!1)},[]);let enter=import_react100.useCallback(()=>{setQuery(""),setActive2(!0),onActiveChange?.(!0)},[onActiveChange]),exit=import_react100.useCallback(()=>{setActive2(!1),setQuery(""),onActiveChange?.(!1)},[onActiveChange]),renderer=useRenderer();return import_react100.useEffect(()=>{if(!active||!renderer)return;let listener2=(evt)=>{if(!focusedRef.current||modalActive())return;setQuery((q2)=>searchQueryKeystroke(q2,evt)??q2)};return renderer.keyInput.on("keypress",listener2),()=>{renderer.keyInput.off("keypress",listener2)}},[active,renderer]),{active,query,enter,exit}}var import_react100;var init_use_tree_search=__esm(async()=>{init_view_core();init_use_latest();await __promiseAll([init_react(),init_keymap()]);import_react100=__toESM(require_react_production(),1)});function ordinalOf(tabId,fallback){let match=/^tab-(\d+)$/.exec(tabId);return match?Number(match[1]):fallback}function adoptTabs(state,tabIds){let known=new Set(state.tabs.map((tab)=>tab.id)),fresh=[];for(let id of tabIds){if(known.has(id))continue;known.add(id),fresh.push(id)}if(fresh.length===0)return state;let minted=state.nextOrdinal,adopted=fresh.map((id)=>({kind:"engine",id,title:null,ordinal:ordinalOf(id,minted++),spawned:!0}));adopted.sort((a2,b3)=>a2.ordinal-b3.ordinal);let tabs=[...state.tabs,...adopted],maxOrdinal=tabs.reduce((max,tab)=>Math.max(max,tab.ordinal),0);return{tabs,activeId:state.activeId,nextOrdinal:Math.max(state.nextOrdinal,maxOrdinal+1)}}function adoptTaskTabs(kv,taskId,tabIds){if(tabIds.length===0)return!1;if(requestTabAdopt(taskId,tabIds),!takeUnclaimedTabAdopt())return!1;let saved=kv.store[terminalTabsKey(taskId)],state=tabsByTask.get(taskId)??(saved&&Array.isArray(saved.tabs)?saved:null),empty={tabs:[],activeId:tabIds[0],nextOrdinal:1},next=adoptTabs(state??empty,tabIds);if(state&&next===state)return!1;return setTaskTabs(taskId,next),kv.set(terminalTabsKey(taskId),next),!0}var init_terminal_tabs_adopt=__esm(()=>{init_terminal_tabs_shared()});function orphanTabsByTask(sessions,registered){let byTask=new Map;for(let session of sessions){if(session.alive===!1)continue;let{taskId,tabId:rawTabId}=parseRowId(session.key);if(!rawTabId)continue;let tabId=rawTabId.split("::")[0];if(registered.has(tabRowId(taskId,tabId)))continue;let tabs=byTask.get(taskId)??[];if(tabs.some((tab)=>tab.id===tabId))continue;tabs.push({id:tabId,label:`\u26A0 ${stripEngineStatusPrefix(session.title?.trim()??"",null).trim()||tabId}`,active:tabs.length===0,engine:!0}),byTask.set(taskId,tabs)}return byTask}function filterKnownOrphanTabs(tasks,orphans){let taskIds=new Set(tasks.map((task)=>task.id)),known=new Map;for(let[taskId,tabs]of orphans)if(taskIds.has(taskId))known.set(taskId,tabs);return known}var init_orphan_tabs=__esm(()=>{init_registry();init_tree_core()});function sameSessions(a2,b3){if(a2.length!==b3.length)return!1;return a2.every((s2,i2)=>{let other=b3[i2];return s2.key===other.key&&s2.alive===other.alive&&s2.title===other.title})}function pollingAllowed(){return process.env.BUN_TEST!=="1"&&process.env.VITEST!=="true"}function useHostSessions(enabled=pollingAllowed()){let[sessions,setSessions]=import_react101.useState(EMPTY2);return import_react101.useEffect(()=>{if(!enabled)return;let cancelled=!1,poll=async()=>{try{let client=await getSharedPtyClient(),{sessions:live=[]}=await client.request("pty.list",{});if(!cancelled)setSessions((prev)=>sameSessions(prev,live)?prev:live)}catch{if(!cancelled)setSessions((prev)=>prev.length===0?prev:EMPTY2)}};poll();let timer2=setInterval(()=>void poll(),POLL_MS4);return()=>{cancelled=!0,clearInterval(timer2)}},[enabled]),sessions}var import_react101,POLL_MS4=2000,EMPTY2;var init_use_host_sessions=__esm(()=>{init_pty_hosted_client();import_react101=__toESM(require_react_production(),1),EMPTY2=[]});function useTreeState(opts){let{tasks,kv,selectedTaskId,selectedTabId}=opts,query=opts.query??"",searching=query.trim()!=="",[expandedRoutines,setExpandedRoutines]=import_react102.useState(()=>new Set),toggleRoutines=import_react102.useCallback((projectKey)=>{setExpandedRoutines((current)=>{let next=new Set(current);if(!next.delete(projectKey))next.add(projectKey);return next})},[]),liveEngines=getDefaultLiveEngines(),[liveTick,setLiveTick]=import_react102.useState(0);import_react102.useEffect(()=>liveEngines.subscribe(()=>setLiveTick((tick2)=>tick2+1)),[liveEngines]);let hostSessions=useHostSessions();import_react102.useEffect(()=>{let pids=new Map;for(let session of hostSessions)if(session.alive!==!1&&typeof session.pid==="number"&&session.pid>0)pids.set(session.key,session.pid);return liveEngines.setAuxPids(pids),()=>liveEngines.setAuxPids(new Map)},[hostSessions,liveEngines]);let liveTitles=import_react102.useMemo(()=>{let map=new Map;for(let session of hostSessions){let title=session.title?.trim();if(title)map.set(session.key,title)}return map},[hostSessions]),snapshotTabs=import_react102.useMemo(()=>{let map=new Map;for(let task of tasks){let known=knownTaskTabs(kv,task.id);if(!known)continue;let vendor=task.vendor??DEFAULT_TASK_VENDOR;map.set(task.id,known.tabs.map((tab)=>{let ptyKey=tabPtyKeyFor(task.id,tab),probed=liveEngines.resolve(ptyKey),live=probed===void 0?tab.liveVendor:probed;return{id:tab.id,label:tabTitleStable(tab,vendor,live,liveTitles.get(ptyKey)),active:tab.id===known.activeId,engine:tab.kind==="engine"||(live??null)!==null}}))}return map},[tasks,kv,liveEngines,liveTick,liveTitles]),orphansByTask=import_react102.useMemo(()=>{let registered=new Set;for(let[taskId,tabs]of snapshotTabs)for(let tab of tabs)registered.add(tabRowId(taskId,tab.id));let sessions=hostSessions.filter((session)=>!isRecentlyClosedPtyKey(session.key));return filterKnownOrphanTabs(tasks,orphanTabsByTask(sessions,registered))},[snapshotTabs,hostSessions,tasks]);import_react102.useEffect(()=>{if(!kv)return;for(let[taskId,orphans]of orphansByTask)adoptTaskTabs(kv,taskId,orphans.map((tab)=>tab.id))},[orphansByTask,kv]);let tabsByTask2=import_react102.useMemo(()=>{if(orphansByTask.size===0)return snapshotTabs;let map=new Map(snapshotTabs);for(let[taskId,orphans]of orphansByTask){let existing=map.get(taskId);map.set(taskId,existing?[...existing,...orphans.map((tab)=>({...tab,active:!1}))]:orphans)}return map},[snapshotTabs,orphansByTask]),recentTask=opts.recentTask??null,sortMode=opts.sortMode??"default",{rows,totalCount}=import_react102.useMemo(()=>{let all=searching?buildTreeRows({tasks,tabsByTask:tabsByTask2,sortMode,expandedRoutines:new Set(projectKeysOf(tasks))}):buildTreeRows({tasks,tabsByTask:tabsByTask2,sortMode,expandedRoutines}),total=treeFlatIds(all).length;return opts.branchTick,{rows:searching?filterTreeRows(all,query,(task)=>{let path22=rowLiveBranchPath(task);return path22?currentBranch(path22):""}):withRecentRow(all,recentTask),totalCount:total}},[tasks,tabsByTask2,searching,query,recentTask,sortMode,expandedRoutines,opts.branchTick]),flatIds=import_react102.useMemo(()=>treeFlatIds(rows),[rows]),activeRowId=import_react102.useMemo(()=>{if(selectedTaskId===null)return null;if(selectedTabId!==null)return tabRowId(selectedTaskId,selectedTabId);return selectedTaskId},[selectedTaskId,selectedTabId]),tabCount=import_react102.useCallback((taskId)=>tabsByTask2.get(taskId)?.length??0,[tabsByTask2]),mainTaskOfProject=import_react102.useCallback((projectId)=>mainTaskIdOfProject(tasks,projectId),[tasks]),projectIdOfTask=import_react102.useCallback((taskId)=>{let task=tasks.find((candidate)=>candidate.id===taskId);if(!task||task.kind==="dir")return null;return sidebarProjectKey(task.repo)},[tasks]);return{rows,flatIds,totalCount,tabCount,activeRowId,projectIdOfTask,mainTaskIdOfProject:mainTaskOfProject,toggleRoutinesRow:import_react102.useCallback((rowId)=>{let projectKey=projectKeyOfRoutinesRow(rowId);if(projectKey===null)return!1;return toggleRoutines(projectKey),!0},[toggleRoutines])}}var import_react102;var init_use_tree_state=__esm(()=>{init_task();init_git_head();init_groups();init_tree_core();init_closed_tab_suppress();init_live_engine();init_terminal_tab_split();init_terminal_tabs_core();init_terminal_tabs_adopt();init_terminal_tabs_shared();init_orphan_tabs();init_use_host_sessions();import_react102=__toESM(require_react_production(),1)});function SidebarTree(props){let{theme}=useTheme(),kv=useOptionalKV(),focused=props.focused??!0,dims=useTerminalDimensions(),[branchTick,setBranchTick]=import_react104.useState(0);import_react104.useEffect(()=>{let timer2=setInterval(()=>setBranchTick((n2)=>n2+1),MAIN_BRANCH_POLL_MS);return()=>clearInterval(timer2)},[]);let search=useTreeSearch({focused,onActiveChange:props.onSearchActiveChange}),tree=useTreeState({tasks:props.tasks,kv,selectedTaskId:props.selectedId,selectedTabId:props.selectedTabId??null,query:search.active?search.query:"",recentTask:props.recentTask??null,sortMode:props.sortMode,branchTick}),flatIndexOf=import_react104.useMemo(()=>{let map=new Map;return tree.flatIds.forEach((id,i2)=>map.set(id,i2)),map},[tree.flatIds]),[cursorIndex,setCursorIndexState]=import_react104.useState(-1),cursorRef=import_react104.useRef(cursorIndex),setCursorIndex=import_react104.useCallback((next)=>{cursorRef.current=next,setCursorIndexState(next)},[]),flatIdsRef=useLatest(tree.flatIds),cursorTaskIdRef=props.cursorTaskIdRef;import_react104.useEffect(()=>{if(!cursorTaskIdRef)return;cursorTaskIdRef.current=()=>cursorTaskIdOf(flatIdsRef.current[cursorRef.current])},[cursorTaskIdRef]);let prevActiveRef=import_react104.useRef(null),cursorRowIdRef=import_react104.useRef(null),moveMode=props.moveMode===!0;import_react104.useEffect(()=>{let ids=tree.flatIds;if(moveMode){let wanted=cursorRowIdRef.current,at3=wanted===null?-1:ids.indexOf(wanted);if(at3>=0){if(at3!==cursorRef.current)setCursorIndex(at3);return}}let active=tree.activeRowId,activeMoved=active!==prevActiveRef.current;prevActiveRef.current=active;let at2=active===null?-1:ids.indexOf(active);if(activeMoved&&at2>=0){if(at2!==cursorRef.current)setCursorIndex(at2);return}if(cursorRef.current>=ids.length)setCursorIndex(Math.max(0,ids.length-1));else if(cursorRef.current<0&&ids.length>0)setCursorIndex(at2>=0?at2:0)},[tree.flatIds,tree.activeRowId,moveMode,setCursorIndex]),import_react104.useEffect(()=>{cursorRowIdRef.current=tree.flatIds[cursorRef.current]??null}),import_react104.useEffect(()=>{if(search.query,!search.active)return;setCursorIndex(0)},[search.active,search.query,setCursorIndex]);let recentTaskRef=useLatest(props.recentTask??null),toggleRoutinesRow=tree.toggleRoutinesRow,activateRow=import_react104.useCallback((rowId)=>{if(toggleRoutinesRow(rowId))return;let recent=rowId===RECENT_ROW_ID?recentTaskRef.current:null,{taskId,tabId}=recent?{taskId:recent.id,tabId:null}:parseRowId(rowId);if(props.onSelect(taskId),tabId===null){props.onActivate?.(taskId);return}props.onSelectTab?.(taskId,tabId),props.onActivate?.(taskId)},[props.onSelect,props.onActivate,props.onSelectTab,toggleRoutinesRow]),activateRowRef=useLatest(activateRow),controllerRef=import_react104.useRef(null);if(controllerRef.current===null)controllerRef.current=createSidebarController({getCursor:()=>cursorRef.current,setCursor:setCursorIndex,getFlatIds:()=>flatIdsRef.current,onSelect:(id)=>activateRowRef.current(id)});let ctrl=controllerRef.current,tasksRef=useLatest(props.tasks),moveCursorRow=import_react104.useCallback((delta)=>{let rowId=flatIdsRef.current[cursorRef.current];if(rowId===void 0||rowId===RECENT_ROW_ID)return;let{taskId,tabId}=parseRowId(rowId);if(tabId!==null){props.onMoveTabRequest?.(taskId,tabId,delta);return}let task=tasksRef.current.find((candidate)=>candidate.id===taskId);if(!task)return;if(task.kind!=="main"){props.onMoveRequest?.(taskId,delta);return}let projectId=tree.projectIdOfTask(taskId);if(projectId===null)return;let mainId=tree.mainTaskIdOfProject(projectId);if(mainId===null)return;props.onMoveRequest?.(mainId,delta)},[tree.projectIdOfTask,tree.mainTaskIdOfProject,props.onMoveRequest,props.onMoveTabRequest]),cursorRowId=tree.flatIds[cursorIndex],cursorMove=import_react104.useMemo(()=>{if(cursorRowId===void 0||cursorRowId===RECENT_ROW_ID)return{projectId:null,rowId:null};let{taskId,tabId}=parseRowId(cursorRowId);if(tabId===null){if(props.tasks.find((candidate)=>candidate.id===taskId)?.kind==="main")return{projectId:tree.projectIdOfTask(taskId),rowId:null}}return{projectId:null,rowId:cursorRowId}},[cursorRowId,props.tasks,tree.projectIdOfTask]),menu=useTreeMenu({tree,activateRow,setCursorIndex,onAddTask:props.onAddTask,onCloseTab:props.onCloseTab,onNewTab:props.onNewTab,actions:props}),markKeysUsed=usePaneHintMark("sidebar");useTreeBindings({focused,search,menu,moveMode,onMoveModeExit:props.onMoveModeExit,controller:ctrl,flatIdsRef,cursorRef,moveCursorRow,onDeleteRequest:props.onDeleteRequest,onRenameRequest:props.onRenameRequest,onPinRequest:props.onPinRequest,onLocalMergeRequest:props.onLocalMergeRequest,markKeysUsed}),useBindings(()=>({enabled:!0,bindings:bindByIds({"tasks.jump":(_evt,slot)=>{let id=flatIdsRef.current[slot??0];if(id===void 0)return;setCursorIndex(slot??0),activateRowRef.current(id)}})}));let scrollRef=import_react104.useRef(null),rowElsRef=import_react104.useRef(null);if(rowElsRef.current===null)rowElsRef.current=new Map;let rowEls=rowElsRef.current;import_react104.useEffect(()=>{let scroll=scrollRef.current;if(!scroll||cursorIndex<0||scroll.viewport.height<=0)return;let el=rowEls.get(cursorIndex);if(el)scroll.scrollChildIntoView(el.id)},[cursorIndex,rowEls]);let outerRef=import_react104.useRef(null),effectiveWidth=props.width??SIDEBAR_WIDTH;import_react104.useEffect(()=>{let el=outerRef.current;if(!el)return;el.width=effectiveWidth,el.flexShrink=1,el.minHeight=0},[effectiveWidth]);let shared2={width:effectiveWidth,cursorIndex,activeRowId:tree.activeRowId,selectedTaskId:props.selectedId,movingRowId:moveMode?cursorMove.rowId:null,rowEls,onPress:(flatIndex,rowId)=>{menu.close(),setCursorIndex(flatIndex),activateRow(rowId)},onContextMenu:menu.openForRow,branchTick,engineState:props.engineState,engineTabState:props.engineTabState,engineLifecycle:props.engineLifecycle,taskJobs:props.taskJobs,worktreeChanges:props.worktreeChanges};return $jsxs("box",{ref:outerRef,flexGrow:1,minHeight:0,flexDirection:"column",backgroundColor:theme.backgroundPanel,paddingTop:1,paddingBottom:1,children:[$jsx(SidebarBrandHeader,{focused,status:props.headerStatus??null,onStatusClick:props.onHeaderStatusClick,update:props.updateChip??null,onUpdateClick:props.onUpdateChipClick}),$jsx(SidebarCreateAction,{onAddTask:props.onAddTask}),search.active?$jsx(SidebarSearchInput,{query:search.query,matchCount:tree.flatIds.length,totalCount:tree.totalCount}):null,$jsx(SidebarNavRail,{nav:props.nav??"terminal",setNav:(next)=>props.onNavChange?.(next)}),$jsx(SidebarTreeBody,{rows:tree.rows,flatIndexOf,searching:search.active&&search.query.trim().length>0,shared:shared2,onProjectContextMenu:menu.openForProject,movingProjectId:moveMode?cursorMove.projectId:null,setScrollRef:(r6)=>{scrollRef.current=r6}}),props.zenActive?$jsx(SidebarZenChip,{onZenClick:props.onZenClick}):null,menu.open?$jsx(ContextMenu,{entries:menu.entries,cursor:menu.cursor,x:menu.x,y:menu.y,dims:{width:effectiveWidth,height:dims.height},onPick:menu.pick}):null,dims.height<0?$jsx("text",{children:""}):null]})}var import_react104;var init_SidebarTree=__esm(async()=>{init_tree_core();init_view_core();init_keybindings2();init_kv();init_use_latest();init_use_tree_state();init_jsx_runtime();await __promiseAll([init_react(),init_keyboard_hints2(),init_theme(),init_keymap(),init_context_menu(),init_chrome(),init_tree_panel(),init_use_tree_bindings(),init_use_tree_menu(),init_use_tree_search()]);import_react104=__toESM(require_react_production(),1)});function moveTaskTab(kv,taskId,tabId,delta){if(requestTabMove(taskId,tabId,delta),!takeUnclaimedTabMove())return!0;let saved=kv.store[terminalTabsKey(taskId)],state=tabsByTask.get(taskId)??(saved&&Array.isArray(saved.tabs)?saved:null);if(!state)return!1;let next=moveTab(state,tabId,delta);if(next===state)return!1;return setTaskTabs(taskId,next),kv.set(terminalTabsKey(taskId),next),!0}var init_terminal_tabs_move=__esm(()=>{init_terminal_tabs_core();init_terminal_tabs_shared()});function HostSidebar(props){let{onFocusRequest:_rail,recentTask:_recent,...treeProps}=props,{theme}=useTheme(),kv=useKV(),notif=useNotifications(),t3=useT(),closeTab2=import_react105.useCallback((taskId,tabId)=>{if(!closeTaskTab(kv,taskId,tabId))notif.notify({kind:"error",taskId,tabId,title:t3("terminal.tab.tabGone")})},[kv,notif,t3]),moveTab2=import_react105.useCallback((taskId,tabId,delta)=>{moveTaskTab(kv,taskId,tabId,delta)},[kv]),newTab=import_react105.useCallback((taskId,kind)=>{props.onActivate(taskId),requestNewTab(taskId,kind)},[props.onActivate]);return $jsxs("box",{width:props.width,flexShrink:0,flexDirection:"column",backgroundColor:theme.backgroundPanel,onMouseUp:props.onFocusRequest,children:[$jsx(SidebarTree,{...treeProps,onCloseTab:closeTab2,onNewTab:newTab,onMoveTabRequest:moveTab2,recentTask:props.recentTask??null}),$jsx("box",{flexShrink:0,paddingLeft:1,paddingBottom:0,children:$jsx(PaneKeyHint,{pane:"sidebar"})})]})}var import_react105;var init_host_sidebar=__esm(async()=>{init_kv();init_notifications();init_i18n2();init_terminal_tabs_move();init_terminal_tabs_shared();init_jsx_runtime();await __promiseAll([init_keyboard_hints2(),init_theme(),init_SidebarTree(),init_terminal_tabs_close()]);import_react105=__toESM(require_react_production(),1)});function HostSidebarMount(props){let{actions,pages,focus,inbox,t:t3}=props;return $jsx(HostSidebar,{width:props.showContent?sidebarWidthFor(props.terminalWidth):props.terminalWidth,nav:pages.nav,onNavChange:pages.goToNav,tasks:props.tasks,selectedId:props.selectedId,selectedTabId:props.selectedTabId,onSelect:(id)=>{props.selectTask(id),pages.setNav("terminal")},onActivate:(id)=>{pages.setNav("terminal"),props.activateTask(id)},onSelectTab:(taskId,tabId)=>{let reClick=pages.nav==="terminal"&&focus.focused!=="sidebar"&&taskId===props.selectedId&&tabId===props.selectedTabId;pages.setNav("terminal"),requestTabActivation(taskId,tabId),focus.setFocused(reClick?"sidebar":"workspace")},engineState:props.daemon.sidebarEngineState,engineTabState:props.daemon.engineTabState,engineLifecycle:props.daemon.engineLifecycle,taskJobs:props.daemon.taskJobs,worktreeChanges:props.daemon.worktreeChanges,transcriptActivity:props.daemon.transcriptActivity,focused:props.activePane==="sidebar",onAddTask:()=>void actions.createTask(),onDeleteRequest:(id)=>void actions.deleteTask(id),onLandRequest:(id)=>void actions.landTask(id),onSyncBaseRequest:(id)=>void actions.syncBase(id),onRenameRequest:(id)=>void actions.renameTask(id),onPinRequest:(id)=>void actions.togglePin(id),onSetStatusRequest:(id)=>void actions.setStatus(id),onCopyRequest:(id,field)=>actions.copyTaskField(id,field),onOpenEditorRequest:props.openTaskWorktree,onRenameBranchRequest:(id)=>void actions.renameBranch(id),onChangeEngineRequest:(id)=>void actions.pickVendor(id),onFieldNotesRequest:actions.showFieldNotes,onFixChecksRequest:props.onFixChecks,onRunAgainRequest:(id)=>void actions.confirmRunAgain(id).then((task)=>task&&props.runAgain(task)),moveMode:props.moveMode,onMoveRequest:(id,delta)=>void actions.moveTask(id,delta),onMoveModeExit:props.exitMoveMode,onLocalMergeRequest:props.onLocalMergeRequest,onSearchActiveChange:props.onSearchActiveChange,sortMode:props.sortMode,headerStatus:{label:`${t3("workspace.inbox.title")} ${inbox.counts.total}`,emphasize:inbox.counts.total>0},onHeaderStatusClick:inbox.show,updateChip:props.update?.hasUpdate?{label:t3("update.chip",{version:props.update.latest})}:null,onUpdateChipClick:pages.openUpdate,zenActive:props.zen,onZenClick:props.toggleZen,onFocusRequest:()=>focus.setFocused("sidebar"),recentTask:props.recentTask,cursorTaskIdRef:props.cursorTaskIdRef})}var init_host_sidebar_mount=__esm(async()=>{init_view_core();init_terminal_tabs_shared();init_jsx_runtime();await init_host_sidebar()});function nextActiveTask(tasks,excludeId){return tasks.find((t3)=>t3.id!==excludeId)}async function stopHostedTask(taskId,logger,logPrefix){let host=await openHostedSessionHost();if(!host)return;try{await killHostedSessions(host.rpc,hostedTaskKeys(await listHostedSessions(host.rpc),taskId))}catch(err){logger.error(`${logPrefix} kill hosted session failed:`,err)}finally{host.close()}}function removedTaskIsActive(orch,taskId){let read=orch.activeTaskSignal;if(typeof read!=="function")return!0;return read.call(orch)()===taskId}async function finishDeletedTaskFlow(opts){let nextTask=nextActiveTask(opts.tasks,opts.taskId);if(opts.updateActiveTask&&opts.orch&&removedTaskIsActive(opts.orch,opts.taskId))await opts.orch.setActiveTask(nextTask?.id??null).catch(()=>{});return await stopHostedTask(opts.taskId,opts.logger,opts.logPrefix),{nextTask}}async function deleteTaskFlow(ctx3,taskId){if(!ctx3.orch)return;let task=ctx3.tasks().find((t3)=>t3.id===taskId);if(!task)return;if(task.kind==="main"){if(!await ctx3.confirm({title:`Remove project "${task.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 ctx3.orch.forgetProject(task.repo)}catch(err){ctx3.logger.error(`${ctx3.logPrefix} forget project failed:`,err),ctx3.notifyError?.(`Couldn't remove: ${errorMessage(err)}`);return}await ctx3.reload?.();return}if(!await ctx3.confirm({title:`Delete "${task.title}"?`,body:task.kind==="dir"?"Removes the task entry. The directory itself stays on disk. Its hosted sessions are stopped.":"Removes the task entry and its worktree. The git branch stays. Its hosted sessions are stopped.",cancelLabel:"cancel",confirmLabel:"delete",danger:!0}))return;let deleted=!1;try{await ctx3.orch.deleteTask(taskId),deleted=!0}catch(err){if(errorMessage(err).includes(DIRTY_WORKTREE_CODE)){if(await ctx3.confirm({title:`"${task.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",danger:!0}))try{await ctx3.orch.deleteTask(taskId,{force:!0}),deleted=!0}catch(forceErr){ctx3.logger.error(`${ctx3.logPrefix} force delete failed:`,forceErr),ctx3.notifyError?.(`Couldn't delete: ${errorMessage(forceErr)}`)}}else ctx3.logger.error(`${ctx3.logPrefix} delete failed:`,err),ctx3.notifyError?.(`Couldn't delete: ${errorMessage(err)}`)}if(!deleted)return;let{nextTask}=await finishDeletedTaskFlow({orch:ctx3.orch,tasks:ctx3.tasks(),taskId,logger:ctx3.logger,logPrefix:ctx3.logPrefix,updateActiveTask:ctx3.updateActiveTask});await ctx3.reload?.(),ctx3.onTaskDeleted?.(taskId,nextTask)}async function renameTaskFlow(ctx3,taskId){let task=ctx3.tasks().find((t3)=>t3.id===taskId);if(!task)return;let next=await ctx3.promptText(task.title);if(!next||!ctx3.orch)return;try{await ctx3.orch.setTitle(taskId,next)}catch(err){ctx3.logger.error(`${ctx3.logPrefix} task.rename failed:`,err),ctx3.notifyError?.(`Couldn't rename task: ${errorMessage(err)}`);return}await ctx3.reload?.()}async function applyVendorChange(ctx3,taskId,next,opts={}){if(!ctx3.orch)return!1;try{await ctx3.orch.setVendor(taskId,next,opts.effort)}catch(err){return ctx3.logger.error(`${ctx3.logPrefix} task.setVendor failed:`,err),ctx3.notifyError?.(`Couldn't switch engine: ${errorMessage(err)}`),!1}if(!opts.silentSuccess)ctx3.notifyInfo?.(`Engine \u2192 ${engineDisplayName(next)} (applies on reopen)`);return!0}async function cycleVendorFlow(ctx3,taskId){let task=ctx3.tasks().find((t3)=>t3.id===taskId);if(!task||!ctx3.orch)return;let engines=await availableEngineIds(),next=nextVendorWithin(engines,task.vendor??DEFAULT_TASK_VENDOR);if(!await applyVendorChange(ctx3,taskId,next))return;await ctx3.reload?.()}async function setStatusFlow(ctx3,taskId){let task=ctx3.tasks().find((t3)=>t3.id===taskId);if(!task||!ctx3.orch||!ctx3.pickStatus)return;let next=await ctx3.pickStatus(task.status);if(!next||next===task.status)return;try{await ctx3.orch.setStatus(taskId,next)}catch(err){ctx3.logger.error(`${ctx3.logPrefix} task.status failed:`,err),ctx3.notifyError?.(`Couldn't set status: ${errorMessage(err)}`);return}ctx3.notifyInfo?.(`Status \u2192 ${next}`),await ctx3.reload?.()}function copyTaskFieldFlow(ctx3,taskId,field){let task=ctx3.tasks().find((candidate)=>candidate.id===taskId);if(!task||!ctx3.copyText)return;let text=field==="branch"?task.branch:task.worktreePath;if(text==="")return;ctx3.copyText(text),ctx3.notifyInfo?.(t(field==="branch"?"tasks.toast.copiedBranch":"tasks.toast.copiedPath",{text}))}var init_task_actions=__esm(()=>{init_account_detect();init_hosted_session();init_interactive_command();init_errors();init_i18n();init_task();init_vendor()});function mainRepoSet(tasks){let out=new Set;for(let task of tasks){if(task.kind!=="main")continue;let key=task.repo.trim().replace(/[\\/]+$/,"");if(key)out.add(key)}return out}async function createTaskFlow(ctx3){let repos=getSavedRepos(),defaultRepo=ctx3.cursorRepo()??repos[0]??process.cwd(),defaultVendor=ctx3.lastVendor(defaultRepo)??DEFAULT_TASK_VENDOR,availableVendors=await availableEngineIds();if(availableVendors.length===0)ctx3.notifyInfo?.("No engine CLI detected \u2014 install a supported engine, or add one in Settings \u2192 Engines");let orch=ctx3.orch,result=await ctx3.promptNewTask(defaultRepo,repos,{defaultVendor,availableVendors,discoverAdoptable:orch?(repo2)=>orch.discoverAdoptableWorktrees(repo2):void 0,mainRepos:mainRepoSet(ctx3.tasks())});if(!result)return;let repo=addSavedRepo(result.repo).path;if(ctx3.rememberVendor(repo,result.vendor),ctx3.onRepoSaved?.(),!orch){ctx3.logger.error(`${ctx3.logPrefix} no daemon; cannot create task`),ctx3.notifyError?.(t("tasks.toast.noDaemonWorktree"));return}if(result.mode==="open"){try{let main=await orch.ensureMainTask(repo);await ctx3.reload?.(),ctx3.selectTask?.(main.id),await ctx3.enterTask?.(main.id)}catch(err){ctx3.logger.error(`${ctx3.logPrefix} ensureMainTask failed:`,err),ctx3.notifyError?.(t("newTask.open.failed",{error:errorMessage(err)}))}return}ctx3.notifyInfo?.("Creating task\u2026");let createdId;if(result.mode==="adopt"){let total=result.adopt.length,adopted=0,firstError;for(let w4 of result.adopt)try{createdId=(await orch.adoptWorktree({repo,worktreePath:w4.worktreePath,branch:w4.branch,vendor:result.vendor})).id,adopted++}catch(err){if(firstError===void 0)firstError=errorMessage(err);ctx3.logger.error(`${ctx3.logPrefix} adoptWorktree failed for ${w4.worktreePath}:`,err)}if(adopted===0){ctx3.notifyError?.(t("newTask.adopt.summaryNone",{error:firstError??""}));return}if(adopted<total)ctx3.notifyInfo?.(t("newTask.adopt.summaryPartial",{done:adopted,total}));else ctx3.notifyInfo?.(t("newTask.adopt.summaryAll",{count:adopted}))}else try{createdId=(await orch.createTask({repo,baseRef:result.baseRef,vendor:result.vendor})).id}catch(err){ctx3.logger.error(`${ctx3.logPrefix} task.create failed:`,err),ctx3.notifyError?.(`Couldn't create task: ${errorMessage(err)}`);return}if(await ctx3.reload?.(),createdId)ctx3.selectTask?.(createdId),await ctx3.enterTask?.(createdId)}var init_task_create_flow=__esm(()=>{init_account_detect();init_repos();init_i18n();init_task()});import{TextAttributes as TextAttributes31}from"@opentui/core";function BranchPickerDialogView(props){let dialog=useDialog(),{theme}=useTheme(),t3=useT(),padX=useDialogPaddingX(),[value,setValue]=import_react107.useState(props.currentBranch),[cursor,setCursor]=import_react107.useState(0),branches=import_react107.useMemo(()=>listLocalBranches(props.repo),[props.repo]),filtered=import_react107.useMemo(()=>filterBranches(branches,value),[branches,value]),window2=windowAround(filtered,cursor,pickerVisibleRows(useTerminalDimensions().height));function move(delta){if(filtered.length===0)return;setCursor((c2)=>clampCursor(c2+delta,filtered.length))}function commit(name){let next=name.trim();if(!next)return;props.onSubmit(next),dialog.clear()}let rows=window2.items.map((name,i2)=>({key:`${window2.start+i2}:${name}`,body:name,accent:value.trim()===name}));return useBindings(()=>({bindings:[{key:"up",cmd:()=>move(-1)},{key:"down",cmd:()=>move(1)}]})),$jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:1,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",children:[$jsx("text",{attributes:TextAttributes31.BOLD,fg:theme.text,children:t3("tasks.reBranch.title")}),$jsx("text",{fg:theme.textMuted,onMouseUp:()=>props.onCancel(),children:"esc"})]}),$jsxs("box",{gap:0,children:[$jsx("text",{fg:theme.accent,children:t3("tasks.reBranch.fieldLabel")}),$jsx("input",{value,placeholder:props.currentBranch,focused:!0,onInput:(v3)=>{setValue(stripNewlines(v3)),setCursor(0)},onSubmit:()=>commit(resolveBaseRef2(value,filtered,cursor))})]}),filtered.length===0?$jsx("box",{gap:0,paddingBottom:1,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:branches.length===0?t3("tasks.reBranch.hintNoBranches"):t3("tasks.reBranch.hintNoMatch")})}):$jsx(PickerList,{window:window2,cursor,rows,onPick:(absoluteIndex)=>commit(filtered[absoluteIndex]??value),paddingBottom:1}),$jsx("box",{paddingBottom:1,children:$jsx("text",{fg:theme.textMuted,children:t3("tasks.reBranch.footer")})})]})}function show3(dialog,opts){return showDialog(dialog,(resolve17)=>$jsx(BranchPickerDialogView,{currentBranch:opts.currentBranch,repo:opts.repo,onSubmit:(v3)=>resolve17(v3),onCancel:()=>resolve17(void 0)}))}var import_react107,BranchPickerDialog;var init_branch_picker_dialog=__esm(async()=>{init_state();init_git_snapshot();init_i18n2();init_jsx_runtime();await __promiseAll([init_react(),init_theme(),init_keymap(),init_dialog(),init_picker_list()]);import_react107=__toESM(require_react_production(),1);BranchPickerDialog={show:show3}});import{TextAttributes as TextAttributes32}from"@opentui/core";function effortLevelsOf(vendor){return engineEntry(vendor).effortLevels??[]}function seedEffort(vendor,current){let trimmed=current?.trim();return trimmed&&effortLevelsOf(vendor).includes(trimmed)?trimmed:NO_EFFORT}function EnginePickerDialogView(props){let dialog=useDialog(),{theme}=useTheme(),t3=useT(),padX=useDialogPaddingX(),{engines}=props,[cursor,setCursor]=import_react108.useState(()=>Math.max(0,engines.indexOf(props.current))),[effort,setEffort2]=import_react108.useState(()=>seedEffort(props.current,props.currentEffort)),window2={items:[...engines],start:0,total:engines.length},cursorEngine=engines[cursor]??props.current,levels=effortLevelsOf(cursorEngine),effortChoices=levels.length>0?[NO_EFFORT,...levels]:[];function move(delta){setCursor((c2)=>{let next=clampCursor(c2+delta,engines.length);return setEffort2((e2)=>seedEffort(engines[next]??props.current,e2)),next})}function stepEffort(delta){if(effortChoices.length===0)return;let i2=effortChoices.indexOf(effort);setEffort2(effortChoices[clampCursor((i2<0?0:i2)+delta,effortChoices.length)]??NO_EFFORT)}function commit(engine3){let applicable=effortLevelsOf(engine3);props.onSubmit({vendor:engine3,...applicable.length>0?{effort:seedEffort(engine3,effort)}:{}}),dialog.clear()}let rows=engines.map((engine3,i2)=>({key:`${i2}:${engine3}`,body:engineDisplayName(engine3),accent:engine3===props.current,dim:engine3===props.current?t3("tasks.changeEngine.current"):void 0}));return useBindings(()=>({bindings:[{key:"up",cmd:()=>move(-1)},{key:"down",cmd:()=>move(1)},{key:"left",cmd:()=>stepEffort(-1)},{key:"right",cmd:()=>stepEffort(1)},{key:"return",cmd:()=>commit(engines[cursor]??props.current)}]})),$jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:1,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",children:[$jsx("text",{attributes:TextAttributes32.BOLD,fg:theme.text,children:t3("tasks.changeEngine.title")}),$jsx("text",{fg:theme.textMuted,onMouseUp:()=>props.onCancel(),children:"esc"})]}),$jsx(PickerList,{window:window2,cursor,rows,onPick:(absoluteIndex)=>commit(engines[absoluteIndex]??props.current),paddingBottom:effortChoices.length>0?0:1}),effortChoices.length>0?$jsx(DialogSection,{label:t3("tasks.changeEngine.effortLabel"),focused:!1,hint:"\u2190/\u2192",children:$jsx(ChipRow,{choices:effortChoices,selected:effort,display:(choice)=>choice===NO_EFFORT?t3("tasks.changeEngine.noEffort"):choice,onPick:(choice)=>setEffort2(choice)})}):null,$jsx("box",{paddingBottom:1,children:$jsx("text",{fg:theme.textMuted,children:effortChoices.length>0?t3("tasks.changeEngine.footerEffort"):t3("tasks.changeEngine.footer")})})]})}function show4(dialog,opts){return showDialog(dialog,(resolve17)=>$jsx(EnginePickerDialogView,{engines:opts.engines,current:opts.current,currentEffort:opts.currentEffort,onSubmit:(v3)=>resolve17(v3),onCancel:()=>resolve17(void 0)}))}var import_react108,NO_EFFORT="",EnginePickerDialog;var init_engine_picker_dialog=__esm(async()=>{init_interactive_command();init_registry();init_state();init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_keymap(),init_dialog(),init_dialog_parts(),init_picker_list()]);import_react108=__toESM(require_react_production(),1);EnginePickerDialog={show:show4}});import{TextAttributes as TextAttributes33}from"@opentui/core";function formatAt(at2){let d2=new Date(at2);if(Number.isNaN(d2.getTime()))return at2;let pad=(n2)=>String(n2).padStart(2,"0");return`${d2.getFullYear()}-${pad(d2.getMonth()+1)}-${pad(d2.getDate())} ${pad(d2.getHours())}:${pad(d2.getMinutes())}`}function FieldNotesDialogView(props){let{theme}=useTheme(),t3=useT(),padX=useDialogPaddingX(),[state,setState]=import_react109.useState({kind:"loading"});import_react109.useEffect(()=>{let live=!0;return props.load().then((notes)=>{if(live)setState({kind:"ready",notes})}).catch((err)=>{if(live)setState({kind:"error",message:err instanceof Error?err.message:String(err)})}),()=>{live=!1}},[props.load]);let scrollRef=import_react109.useRef(null),scrollBy=(lines)=>{let scroll=scrollRef.current;if(!scroll)return;scroll.scrollTo({x:0,y:Math.max(0,scroll.scrollTop+lines)})};return useBindings(()=>({bindings:[{key:"up",cmd:()=>scrollBy(-1)},{key:"down",cmd:()=>scrollBy(1)},{key:"pageup",cmd:()=>scrollBy(-(scrollRef.current?.viewport.height??10))},{key:"pagedown",cmd:()=>scrollBy(scrollRef.current?.viewport.height??10)}]})),$jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:1,flexShrink:1,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",flexShrink:0,children:[$jsxs("box",{flexDirection:"column",gap:0,children:[$jsx("text",{attributes:TextAttributes33.BOLD,fg:theme.text,children:t3("tasks.fieldNotes.title")}),$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:props.repo})]}),$jsx("text",{fg:theme.textMuted,onMouseUp:props.onClose,children:"esc"})]}),$jsx("scrollbox",{ref:(r6)=>{scrollRef.current=r6},flexShrink:1,stickyScroll:!1,verticalScrollbarOptions:{trackOptions:{backgroundColor:theme.backgroundDialog,foregroundColor:theme.borderActive}},children:$jsxs("box",{gap:1,paddingRight:1,children:[state.kind==="loading"?$jsx("text",{fg:theme.textMuted,children:t3("tasks.fieldNotes.loading")}):null,state.kind==="error"?$jsx("text",{fg:theme.error,children:state.message}):null,state.kind==="ready"&&state.notes.length===0?$jsx("text",{fg:theme.textMuted,children:t3("tasks.fieldNotes.empty")}):null,state.kind==="ready"?state.notes.map((note2,i2)=>$jsxs("box",{gap:0,children:[$jsx("text",{fg:theme.accent,wrapMode:"none",children:`${formatAt(note2.at)} \xB7 ${note2.author}`}),$jsx("text",{fg:theme.text,children:note2.text})]},`${note2.at}:${i2}`)):null]})}),$jsx("box",{paddingBottom:1,flexShrink:0,children:$jsx("text",{fg:theme.textMuted,children:t3("tasks.fieldNotes.footer")})})]})}function show5(dialog,opts){showDialog(dialog,(resolve17)=>$jsx(FieldNotesDialogView,{repo:opts.repo,load:opts.load,onClose:()=>resolve17(void 0)}))}var import_react109,FieldNotesDialog;var init_field_notes_dialog=__esm(async()=>{init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_keymap(),init_dialog()]);import_react109=__toESM(require_react_production(),1);FieldNotesDialog={show:show5}});import{TextAttributes as TextAttributes34}from"@opentui/core";function RunAgainDialogView(props){let{theme}=useTheme(),t3=useT(),dialog=useDialog(),padX=useDialogPaddingX(),[active,setActive2]=import_react110.useState("confirm"),commit=()=>{props.onConfirm(),dialog.clear({refocus:!1})},cancel=()=>{props.onCancel(),dialog.clear()},scrollRef=import_react110.useRef(null),scrollBy=(lines)=>{let scroll=scrollRef.current;if(!scroll)return;scroll.scrollTo({x:0,y:Math.max(0,scroll.scrollTop+lines)})};return useBindings(()=>({bindings:[{key:"up",cmd:()=>scrollBy(-1)},{key:"down",cmd:()=>scrollBy(1)},{key:"pageup",cmd:()=>scrollBy(-(scrollRef.current?.viewport.height??10))},{key:"pagedown",cmd:()=>scrollBy(scrollRef.current?.viewport.height??10)},{key:"left",cmd:()=>setActive2((a2)=>a2==="confirm"?"cancel":"confirm")},{key:"right",cmd:()=>setActive2((a2)=>a2==="confirm"?"cancel":"confirm")},{key:"return",cmd:()=>active==="confirm"?commit():cancel()}]})),$jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:1,flexShrink:1,children:[$jsxs("box",{flexDirection:"row",justifyContent:"space-between",flexShrink:0,children:[$jsxs("box",{flexDirection:"column",gap:0,children:[$jsx("text",{attributes:TextAttributes34.BOLD,fg:theme.text,children:t3("tasks.runAgain.title")}),$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("tasks.runAgain.source",{title:props.taskTitle})})]}),$jsx("text",{fg:theme.textMuted,onMouseUp:cancel,children:"esc"})]}),$jsx("scrollbox",{ref:(r6)=>{scrollRef.current=r6},flexShrink:1,stickyScroll:!1,verticalScrollbarOptions:{trackOptions:{backgroundColor:theme.backgroundDialog,foregroundColor:theme.borderActive}},children:$jsx("box",{paddingRight:1,children:$jsx("text",{fg:theme.text,children:props.prompt})})}),$jsx("text",{fg:theme.textMuted,flexShrink:0,children:t3("tasks.runAgain.hint")}),$jsx("box",{flexDirection:"row",justifyContent:"flex-end",flexShrink:0,children:["cancel","confirm"].map((key)=>$jsx("box",{paddingLeft:1,paddingRight:1,backgroundColor:key===active?theme.primary:void 0,onMouseUp:()=>key==="confirm"?commit():cancel(),children:$jsx("text",{fg:key===active?theme.selectedListItemText:theme.textMuted,children:key==="cancel"?t3("common.cancel"):t3("tasks.runAgain.confirm")})},key))}),$jsx("box",{paddingBottom:1,flexShrink:0,children:$jsx("text",{fg:theme.textMuted,children:t3("tasks.runAgain.footer")})})]})}function show6(dialog,opts){return showDialog(dialog,(resolve17)=>$jsx(RunAgainDialogView,{taskTitle:opts.taskTitle,prompt:opts.prompt,onConfirm:()=>resolve17(!0),onCancel:()=>resolve17(!1)}),{size:"medium"})}var import_react110,RunAgainDialog;var init_run_again_dialog=__esm(async()=>{init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_keymap(),init_dialog()]);import_react110=__toESM(require_react_production(),1);RunAgainDialog={show:show6}});function StatusPickerDialogView(props){let dialog=useDialog(),t3=useT(),padX=useDialogPaddingX(),[cursor,setCursor]=import_react111.useState(()=>Math.max(0,TASK_STATUSES.indexOf(props.current))),window2={items:[...TASK_STATUSES],start:0,total:TASK_STATUSES.length};function move(delta){setCursor((c2)=>clampCursor(c2+delta,TASK_STATUSES.length))}function commit(status){props.onSubmit(status),dialog.clear()}let rows=TASK_STATUSES.map((status,i2)=>({key:`${i2}:${status}`,body:t3(STATUS_LABEL_KEY[status]),accent:status===props.current,dim:status===props.current?t3("tasks.setStatus.current"):void 0}));return useBindings(()=>({bindings:[{key:"up",cmd:()=>move(-1)},{key:"down",cmd:()=>move(1)},{key:"return",cmd:()=>commit(TASK_STATUSES[cursor]??props.current)}]})),$jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:1,children:[$jsx(DialogHeader,{title:t3("tasks.setStatus.title"),onClose:()=>props.onCancel()}),$jsx(PickerList,{window:window2,cursor,rows,onPick:(absoluteIndex)=>commit(TASK_STATUSES[absoluteIndex]??props.current),paddingBottom:1}),$jsx(DialogFooter,{children:t3("tasks.setStatus.footer")})]})}function show7(dialog,opts){return showDialog(dialog,(resolve17)=>$jsx(StatusPickerDialogView,{current:opts.current,onSubmit:(v3)=>resolve17(v3),onCancel:()=>resolve17(void 0)}))}var import_react111,STATUS_LABEL_KEY,StatusPickerDialog;var init_status_picker_dialog=__esm(async()=>{init_state();init_task();init_i18n2();init_jsx_runtime();await __promiseAll([init_keymap(),init_dialog(),init_dialog_parts(),init_picker_list()]);import_react111=__toESM(require_react_production(),1),STATUS_LABEL_KEY={backlog:"tasks.status.backlog",in_progress:"tasks.status.inProgress",in_review:"tasks.status.inReview",done:"tasks.status.done",canceled:"tasks.status.canceled",error:"tasks.status.error"};StatusPickerDialog={show:show7}});function AdoptTab({vm}){let{theme}=useTheme(),t3=useT(),rows=vm.adoptVisible.map((w4)=>{let tags=[w4.dirty?"dirty":"",w4.kobeManaged?"":"external"].filter(Boolean).join(",");return{key:w4.path,body:`${vm.adoptSelected.has(w4.path)?"[x] ":"[ ] "}${w4.branch}${tags?` (${tags})`:""}`,accent:vm.adoptSelected.has(w4.path)}});return $jsxs($Fragment2,{children:[$jsx(DialogSection,{label:t3("newTask.field.adoptFilter"),focused:vm.field==="adoptFilter",onPress:()=>vm.setField("adoptFilter"),children:$jsx(DialogField,{focused:vm.field==="adoptFilter",children:$jsx("input",{value:vm.adoptFilter,placeholder:t3("newTask.placeholder.adoptFilter"),focused:vm.field==="adoptFilter",onMouseUp:()=>vm.setField("adoptFilter"),onInput:(v3)=>vm.setAdoptFilterText(v3),onSubmit:()=>vm.toggleAdoptCursor()})})}),$jsx("box",{paddingLeft:2,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("newTask.adopt.repoLine",{path:vm.expandedRepo||t3("newTask.adopt.repoNone")})})}),vm.adoptLoading?$jsx("box",{paddingLeft:2,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("newTask.hint.scanningWorktrees")})}):null,!vm.adoptLoading&&vm.adoptList.length===0?$jsx("box",{paddingLeft:2,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:vm.adoptDiscoveredCount===0?t3("newTask.adopt.noUnlinked"):t3("newTask.adopt.noMatch")})}):null,vm.adoptList.length>0?$jsx(PickerList,{window:vm.adoptWindow,cursor:vm.adoptCursor,rows,onPick:vm.pickAdoptAt,footer:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:vm.adoptSelected.size>0?t3("newTask.adopt.hintSelected",{count:vm.adoptSelected.size}):t3("newTask.adopt.hintDefault")})}):null]})}var init_tab_adopt=__esm(async()=>{init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_dialog_parts(),init_picker_list()])});function CloneTab({vm}){let{theme}=useTheme(),t3=useT(),parentRows=vm.cloneParentWindow.items.map((name,i2)=>({key:`${vm.cloneParentWindow.start+i2}:${name}`,body:`${name}/`}));return $jsxs($Fragment2,{children:[$jsx(DialogSection,{label:t3("newTask.field.gitUrl"),focused:vm.field==="cloneUrl",onPress:()=>vm.setField("cloneUrl"),children:$jsx(DialogField,{focused:vm.field==="cloneUrl",children:$jsx("input",{value:vm.cloneUrl,placeholder:"https://github.com/user/repo.git",focused:vm.field==="cloneUrl",onMouseUp:()=>vm.setField("cloneUrl"),onInput:(v3)=>vm.setCloneUrlText(v3),onSubmit:()=>{if(!vm.cloneUrl.trim())return;vm.setField("cloneParent")}})})}),$jsx(DialogSection,{label:t3("newTask.field.parentDir"),focused:vm.field==="cloneParent",onPress:()=>vm.setField("cloneParent"),children:$jsx(DialogField,{focused:vm.field==="cloneParent",children:$jsx("input",{value:vm.cloneParent,placeholder:"~/",focused:vm.field==="cloneParent",onMouseUp:()=>vm.setField("cloneParent"),onInput:(v3)=>vm.setCloneParentText(v3),onSubmit:()=>vm.onCloneParentSubmit()})})}),vm.field==="cloneParent"?$jsx("box",{paddingLeft:2,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:t3("newTask.hint.remembered")})}):null,vm.field==="cloneParent"&&vm.cloneParentFiltered.length>0&&!vm.cloneParentPicked?$jsx(PickerList,{window:vm.cloneParentWindow,cursor:vm.cloneParentCursor,rows:parentRows,onPick:vm.selectCloneParentAt}):null,$jsx(DialogSection,{label:t3("newTask.field.folderName"),focused:vm.field==="cloneFolder",onPress:()=>vm.setField("cloneFolder"),children:$jsx(DialogField,{focused:vm.field==="cloneFolder",children:$jsx("input",{value:vm.cloneFolder,placeholder:t3("newTask.placeholder.folderName"),focused:vm.field==="cloneFolder",onMouseUp:()=>vm.setField("cloneFolder"),onInput:(v3)=>vm.setCloneFolderText(v3),onSubmit:()=>vm.setField("cloneBaseRef")})})}),$jsx(DialogSection,{label:t3("newTask.field.baseBranch"),focused:vm.field==="cloneBaseRef",onPress:()=>vm.setField("cloneBaseRef"),children:$jsx(DialogField,{focused:vm.field==="cloneBaseRef",children:$jsx("input",{value:vm.cloneBaseRef,placeholder:DEFAULT_BASE_REF,focused:vm.field==="cloneBaseRef",onMouseUp:()=>vm.setField("cloneBaseRef"),onInput:(v3)=>vm.setCloneBaseRefText(v3),onSubmit:()=>void vm.commitClone()})})}),vm.cloneInFlight?$jsx("box",{gap:0,paddingLeft:2,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:vm.cloneProgress||t3("newTask.clone.progressFallback")})}):null]})}var init_tab_clone=__esm(async()=>{init_git_snapshot();init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_dialog_parts(),init_picker_list()])});function ExistingTab({vm}){let{theme}=useTheme(),t3=useT(),repoRows=vm.activeWindow.items.map((name,i2)=>{let tag=vm.mode==="saved"&&name===vm.defaultRepo?` ${t3("newTask.hint.currentDir")}`:"";if(vm.mode==="browse")return{key:`${vm.activeWindow.start+i2}:${name}`,body:`${name}/${tag}`,accent:!1};let{base,dir}=splitRepoRow(name);return{key:`${vm.activeWindow.start+i2}:${name}`,body:`${base}${tag}`,accent:vm.expandedRepo===name,...dir?{dim:dir}:{}}}),branchRows=vm.branchWindow.items.map((name,i2)=>({key:`${vm.branchWindow.start+i2}:${name}`,body:name,accent:vm.baseRef.trim()===name})),intents=["task","project"],intentLabel={task:t3("newTask.intent.task"),project:t3("newTask.intent.project")};return $jsxs($Fragment2,{children:[$jsx(DialogSection,{label:t3("newTask.field.repo"),focused:vm.field==="repo",onPress:()=>vm.setField("repo"),children:$jsx(DialogField,{focused:vm.field==="repo",children:$jsxs("box",{flexDirection:"row",children:[$jsx("input",{value:vm.repo,placeholder:splitRepoRow(vm.defaultRepo).base,focused:vm.field==="repo",onMouseUp:()=>vm.setField("repo"),onInput:(v3)=>vm.setRepoText(v3),onSubmit:()=>vm.onRepoSubmit(),flexGrow:vm.repoDir?0:1,flexShrink:0,...vm.repoDir?{flexBasis:REPO_INPUT_CELLS}:{}}),vm.repoDir?$jsx("text",{fg:theme.textMuted,wrapMode:"none",flexShrink:1,children:` ${vm.repoDir}`}):null]})})}),vm.field==="repo"&&vm.activeList.length>0&&!vm.repoPicked?$jsx(PickerList,{window:vm.activeWindow,cursor:vm.repoCursor,rows:repoRows,onPick:vm.selectRepoAt}):null,vm.canOpenProject?$jsx(DialogSection,{label:t3("newTask.field.opens"),focused:vm.field==="intent",hint:"\u2190/\u2192",onPress:()=>vm.setField("intent"),children:$jsx(ChipRow,{choices:intents,selected:vm.intent,display:(choice)=>intentLabel[choice],onPick:(choice)=>{vm.setIntent(choice),vm.setField("intent")}})}):null,vm.intent==="project"&&vm.canOpenProject?null:$jsx(DialogSection,{label:t3("newTask.field.fromBranch"),focused:vm.field==="baseRef",onPress:()=>vm.setField("baseRef"),children:$jsx(DialogField,{focused:vm.field==="baseRef",children:$jsx("input",{value:vm.baseRef,placeholder:DEFAULT_BASE_REF,focused:vm.field==="baseRef",onMouseUp:()=>vm.setField("baseRef"),onInput:(v3)=>vm.setBaseRefText(v3),onSubmit:()=>vm.onBaseRefSubmit()})})}),vm.field==="baseRef"&&vm.branchFiltered.length===0&&vm.submitError==null?$jsx("box",{gap:0,paddingLeft:2,paddingBottom:1,children:$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:vm.branches.length===0?t3("newTask.hint.noBranchesFound"):t3("newTask.hint.noMatchBranch")})}):null,vm.field==="baseRef"&&vm.branchFiltered.length>0?$jsx(PickerList,{window:vm.branchWindow,cursor:vm.branchCursor,rows:branchRows,onPick:vm.pickBranchAt,paddingBottom:1}):null]})}var REPO_INPUT_CELLS=28;var init_tab_existing=__esm(async()=>{init_state();init_git_snapshot();init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_dialog_parts(),init_picker_list()])});function splitRepoInput(value,resolved){if(!resolved)return{name:value,dir:""};let{base,dir}=splitRepoRow(value.trim());return{name:base,dir}}function resolveRepoInput(value,repoOptions){let trimmed=value.trim();if(!trimmed||trimmed.includes("/")||trimmed.startsWith("~"))return{kind:"path",path:trimmed};let matches=repoOptions.filter((p3)=>splitRepoRow(p3).base===trimmed);if(matches.length===1)return{kind:"path",path:matches[0]};if(matches.length>1)return{kind:"ambiguous",name:trimmed,matches};return{kind:"path",path:trimmed}}function nameOrPath(path22,repoOptions){let name=splitRepoInput(path22,!0).name,back=resolveRepoInput(name,repoOptions);return back.kind==="path"&&back.path===path22?name:path22}var init_repo_field=__esm(()=>{init_state()});function resolveVendorSet(available){return available&&available.length>0?available:ALL_VENDORS}function resolveInitialVendor(set,preferred){let pref=preferred??DEFAULT_TASK_VENDOR;return set.includes(pref)?pref:set[0]??DEFAULT_TASK_VENDOR}function toggleInSet(prev,path22){let next=new Set(prev);if(next.has(path22))next.delete(path22);else next.add(path22);return next}function toggleSelectAll(prev,paths){if(paths.length===0)return prev;return paths.every((p3)=>prev.has(p3))?new Set:new Set(paths)}var init_pure=__esm(()=>{init_task();init_vendor()});function useAdoptState(args2){let[adoptFilter,setAdoptFilter]=import_react113.useState(""),[adoptCursor,setAdoptCursor]=import_react113.useState(0),[adoptSelected,setAdoptSelected]=import_react113.useState(new Set),[adoptable,setAdoptable]=import_react113.useState(void 0),[adoptLoading,setAdoptLoading]=import_react113.useState(!1),adoptList=import_react113.useMemo(()=>filterAdoptableByGlob(adoptable??[],adoptFilter),[adoptable,adoptFilter]),adoptWindow=windowAround(adoptList.map((w4)=>w4.path),adoptCursor,pickerVisibleRows(useTerminalDimensions().height)),adoptVisible=adoptList.slice(adoptWindow.start,adoptWindow.start+adoptWindow.items.length),adoptDiscoveredCount=(adoptable??[]).length,{active,expandedRepo,discoverAdoptable}=args2;import_react113.useEffect(()=>{if(!active)return;let disposed=!1;return setAdoptLoading(!0),(async()=>{let list2=[];try{list2=discoverAdoptable?await discoverAdoptable(expandedRepo):[]}catch{list2=[]}if(disposed)return;setAdoptable(list2),setAdoptLoading(!1)})(),()=>{disposed=!0}},[active,expandedRepo,discoverAdoptable]),import_react113.useEffect(()=>{setAdoptCursor((c2)=>clampCursor(c2,adoptList.length))},[adoptList]);let prevRepo=import_react113.useRef(void 0);import_react113.useEffect(()=>{if(prevRepo.current!==void 0&&prevRepo.current!==expandedRepo)setAdoptSelected(new Set),setAdoptCursor(0);prevRepo.current=expandedRepo},[expandedRepo]);function setAdoptFilterText(v3){setAdoptFilter(stripNewlines(v3))}function toggleAdopt(path22){setAdoptSelected((prev)=>toggleInSet(prev,path22))}function toggleAdoptCursor(){let w4=adoptList[adoptCursor];if(w4)toggleAdopt(w4.path)}function pickAdoptAt(absoluteIndex){let w4=adoptList[absoluteIndex];if(!w4)return;setAdoptCursor(absoluteIndex),toggleAdopt(w4.path)}function adoptSelectAll(){setAdoptSelected((prev)=>toggleSelectAll(prev,adoptList.map((w4)=>w4.path)))}function moveAdoptCursor(delta){if(adoptList.length===0)return;setAdoptCursor((c2)=>clampCursor(c2+delta,adoptList.length))}function commitAdopt(){if(adoptList.length===0){args2.setSubmitError(t("newTask.error.noAdoptable"));return}let chosen=adoptSelected.size>0?adoptList.filter((w4)=>adoptSelected.has(w4.path)):adoptList.slice(adoptCursor,adoptCursor+1);if(chosen.length===0)return;args2.onSubmit({mode:"adopt",repo:expandedRepo,vendor:args2.vendor,adopt:chosen.map((w4)=>({worktreePath:w4.path,branch:w4.branch}))}),args2.clearDialog()}return{adoptFilter,adoptLoading,adoptDiscoveredCount,adoptList,adoptWindow,adoptVisible,adoptCursor,adoptSelected,setAdoptFilterText,toggleAdoptCursor,pickAdoptAt,adoptSelectAll,moveAdoptCursor,commitAdopt}}var import_react113;var init_use_adopt_state=__esm(async()=>{init_state();init_i18n2();init_pure();await init_react();import_react113=__toESM(require_react_production(),1)});import{spawn as spawn12}from"child_process";import*as fs5 from"fs";import*as path22 from"path";function deriveFolderName(url){let trimmed=url.trim().replace(/\/+$/,"");if(!trimmed)return"";let lastSlash=trimmed.lastIndexOf("/"),lastColon=trimmed.lastIndexOf(":"),cutAt=Math.max(lastSlash,lastColon);return(cutAt>=0?trimmed.slice(cutAt+1):trimmed).replace(/\.git$/i,"")}function validateGitUrl(url){let trimmed=url.trim();if(!trimmed)return t("newTask.error.gitUrlRequired");let hasProtocol=trimmed.includes("://"),hasScpSep=trimmed.includes("@")&&trimmed.includes(":"),hasPathSep=trimmed.includes("/");if(!hasProtocol&&!hasScpSep&&!hasPathSep)return t("newTask.error.gitUrlInvalid",{url:trimmed});return null}function validateCloneTarget(parentDir,folder){let folderTrimmed=folder.trim();if(!folderTrimmed)return t("newTask.error.folderRequired");if(folderTrimmed.includes("/")||folderTrimmed.includes("\\"))return t("newTask.error.folderHasSeparator");let parentTrimmed=parentDir.trim();if(!parentTrimmed)return t("newTask.error.parentRequired");let parentExpanded=expandHome(parentTrimmed),parentStat;try{parentStat=fs5.statSync(parentExpanded)}catch{return t("newTask.error.parentNotFound",{path:parentExpanded})}if(!parentStat.isDirectory())return t("newTask.error.parentNotDir",{path:parentExpanded});let target=path22.join(parentExpanded,folderTrimmed);if(fs5.existsSync(target))return t("newTask.error.targetExists",{path:target});return null}function resolveCloneTarget(parentDir,folder){return path22.join(expandHome(parentDir.trim()),folder.trim())}function findAvailableFolderName(parentDir,base){let trimmed=base.trim();if(!trimmed)return base;let parentExpanded=expandHome(parentDir.trim());if(!parentExpanded)return base;try{if(!fs5.statSync(parentExpanded).isDirectory())return base}catch{return base}if(!fs5.existsSync(path22.join(parentExpanded,trimmed)))return trimmed;for(let n2=2;n2<1000;n2++){let candidate=`${trimmed}-${n2}`;if(!fs5.existsSync(path22.join(parentExpanded,candidate)))return candidate}return trimmed}function cloneRepo(url,target,onProgress){return new Promise((resolve17)=>{let stderrBuf="";try{let child=spawn12("git",["clone","--progress",url,target],{stdio:["ignore","ignore","pipe"],env:{...process.env,GIT_TERMINAL_PROMPT:"0",GIT_ASKPASS:""}});child.stderr?.setEncoding("utf-8"),child.stderr?.on("data",(chunk)=>{if(stderrBuf+=chunk,onProgress){let lines=chunk.split(/[\r\n]+/).filter((s2)=>s2.trim().length>0),last=lines[lines.length-1];if(last)onProgress(last)}}),child.on("error",(err)=>{resolve17({ok:!1,error:err.message})}),child.on("close",(code)=>{if(code===0){resolve17({ok:!0,path:target});return}let tail2=stderrBuf.split(/[\r\n]+/).filter((s2)=>s2.trim().length>0).pop()??`git clone exited with ${code}`;resolve17({ok:!1,error:tail2})})}catch(err){resolve17({ok:!1,error:errorMessage(err)})}})}var init_clone=__esm(()=>{init_i18n();init_path_helpers()});function useDerivedDir(value){let split=import_react114.useMemo(()=>splitPathForDirSuggest(value),[value]),filtered=import_react114.useMemo(()=>filterSubdirs(listSubdirs(split.base),split.filter),[split]);return{split,filtered}}var import_react114;var init_use_derived_dir=__esm(()=>{init_path_helpers();import_react114=__toESM(require_react_production(),1)});function useCloneState(args2){let[cloneUrl,setCloneUrl]=import_react116.useState(""),[cloneParent,setCloneParent]=import_react116.useState(args2.defaultCloneParent?.trim()?args2.defaultCloneParent:"~/"),[cloneFolder,setCloneFolder]=import_react116.useState(""),[cloneFolderTouched,setCloneFolderTouched]=import_react116.useState(!1),[cloneBaseRef,setCloneBaseRef]=import_react116.useState(DEFAULT_BASE_REF),[cloneInFlight,setCloneInFlight]=import_react116.useState(!1),[cloneProgress,setCloneProgress]=import_react116.useState(""),[cloneParentCursor,setCloneParentCursor]=import_react116.useState(0),[cloneParentPicked,setCloneParentPicked]=import_react116.useState(!1),{split:cloneParentSplit,filtered:cloneParentFiltered}=useDerivedDir(cloneParent),cloneParentWindow=windowAround(cloneParentFiltered,cloneParentCursor,pickerVisibleRows(useTerminalDimensions().height));import_react116.useEffect(()=>{if(cloneFolderTouched)return;setCloneFolder(findAvailableFolderName(cloneParent,deriveFolderName(cloneUrl)))},[cloneUrl,cloneParent,cloneFolderTouched]);function setCloneUrlText(v3){setCloneUrl(stripNewlines(v3))}function setCloneParentText(v3){setCloneParentPicked(!1),setCloneParent(stripNewlines(v3)),setCloneParentCursor(0)}function setCloneFolderText(v3){setCloneFolderTouched(!0),setCloneFolder(stripNewlines(v3))}function setCloneBaseRefText(v3){setCloneBaseRef(stripNewlines(v3))}function onCloneParentSubmit(){let picked=cloneParentFiltered[cloneParentCursor];if(picked)setCloneParent(joinPicked(cloneParent,cloneParentSplit.base,picked)),setCloneParentCursor(0),setCloneParentPicked(!0);args2.setField("cloneFolder")}function selectCloneParentAt(absoluteIndex){let picked=cloneParentFiltered[absoluteIndex];if(!picked)return;setCloneParent(joinPicked(cloneParent,cloneParentSplit.base,picked)),setCloneParentCursor(absoluteIndex),setCloneParentPicked(!0),args2.setField("cloneFolder")}function moveParentCursor(delta){if(cloneParentFiltered.length===0)return;setCloneParentCursor((c2)=>clampCursor(c2+delta,cloneParentFiltered.length))}async function commitClone(){if(cloneInFlight)return;let urlReason=validateGitUrl(cloneUrl);if(urlReason){args2.setSubmitError(urlReason),args2.setField("cloneUrl");return}let targetReason=validateCloneTarget(cloneParent,cloneFolder);if(targetReason){args2.setSubmitError(targetReason);let folder=cloneFolder.trim(),parentAtFault=!(!folder||folder.includes("/")||folder.includes("\\"))&&validateCloneTarget(cloneParent,"__kobe_probe__")!=null;args2.setField(parentAtFault?"cloneParent":"cloneFolder");return}let target=resolveCloneTarget(cloneParent,cloneFolder);setCloneInFlight(!0),setCloneProgress(t("newTask.clone.progressInto",{target}));let result=await cloneRepo(cloneUrl.trim(),target,(line)=>setCloneProgress(line));if(setCloneInFlight(!1),!result.ok){args2.setSubmitError(t("newTask.error.cloneFailed",{error:result.error})),args2.setField("cloneUrl");return}let b3=cloneBaseRef.trim()||DEFAULT_BASE_REF;args2.onSubmit({repo:result.path,baseRef:b3,vendor:args2.vendor,cloned:{parentDir:expandHome(cloneParent.trim())}}),args2.clearDialog()}return{cloneUrl,cloneParent,cloneFolder,cloneBaseRef,cloneInFlight,cloneProgress,cloneParentFiltered,cloneParentWindow,cloneParentCursor,cloneParentPicked,setCloneUrlText,setCloneParentText,setCloneFolderText,setCloneBaseRefText,onCloneParentSubmit,selectCloneParentAt,moveParentCursor,commitClone}}var import_react116;var init_use_clone_state=__esm(async()=>{init_clone();init_state();init_git_snapshot();init_path_helpers();init_i18n2();init_use_derived_dir();await init_react();import_react116=__toESM(require_react_production(),1)});function useNewTaskViewModel(props){let dialog=useDialog(),[tab,setTab]=import_react118.useState("existing"),vendors=resolveVendorSet(props.availableVendors),[vendor,setVendor]=import_react118.useState(()=>resolveInitialVendor(resolveVendorSet(props.availableVendors),props.defaultVendor)),[field,setField]=import_react118.useState("tabs"),[repo,setRepo]=import_react118.useState(()=>nameOrPath(props.defaultRepo,computeRepoOptions(props.defaultRepo,props.savedRepos))),[baseRef,setBaseRef]=import_react118.useState(()=>getCurrentBranch(expandHome(props.defaultRepo.trim()))??DEFAULT_BASE_REF),[baseRefTouched,setBaseRefTouched]=import_react118.useState(!1),[repoCursor,setRepoCursor]=import_react118.useState(0),[repoPicked,setRepoPicked]=import_react118.useState(!1),[branchCursor,setBranchCursor]=import_react118.useState(0),[intent,setIntent]=import_react118.useState("task"),[submitError,setSubmitError]=import_react118.useState(null),repoOptions=import_react118.useMemo(()=>computeRepoOptions(props.defaultRepo,props.savedRepos),[props.defaultRepo,props.savedRepos]),pickerRows=pickerVisibleRows(useTerminalDimensions().height),mode=pickerModeFor(repo,repoOptions),repoResolution=resolveRepoInput(repo,repoOptions),repoDir=repoResolution.kind==="path"&&repoResolution.path!==repo.trim()?splitRepoInput(repoResolution.path,!0).dir:"",{split:subdirSplit,filtered:subdirFiltered}=useDerivedDir(repo),savedFiltered=import_react118.useMemo(()=>filterRepos(repoOptions,repo),[repoOptions,repo]),activeList=mode==="browse"?subdirFiltered:savedFiltered,activeWindow=windowAround(activeList,repoCursor,pickerRows),expandedRepo=repoResolution.kind==="path"?expandHome(repoResolution.path):"",canOpenProject=offersProjectIntent(expandedRepo,props.mainRepos??EMPTY_MAIN_REPOS),branches=import_react118.useMemo(()=>listLocalBranches(expandedRepo),[expandedRepo]),branchFiltered=import_react118.useMemo(()=>filterBranches(branches,baseRef),[branches,baseRef]),branchWindow=windowAround(branchFiltered,branchCursor,pickerRows),clone=useCloneState({defaultCloneParent:props.defaultCloneParent,vendor,onSubmit:props.onSubmit,clearDialog:()=>dialog.clear(),setField,setSubmitError}),adopt2=useAdoptState({active:tab==="adopt",expandedRepo,vendor,discoverAdoptable:props.discoverAdoptable,onSubmit:props.onSubmit,clearDialog:()=>dialog.clear(),setSubmitError});import_react118.useEffect(()=>{if(!expandedRepo||baseRefTouched)return;let current=getCurrentBranch(expandedRepo);if(current)setBaseRef(current)},[expandedRepo,baseRefTouched]),import_react118.useEffect(()=>{setSubmitError(null)},[repo,clone.cloneUrl,clone.cloneParent,clone.cloneFolder,adopt2.adoptFilter]);function changeRepo(next){setRepo(next),setIntent("task")}function pickRepo(path23){changeRepo(nameOrPath(path23,repoOptions))}function setRepoText(v3){setRepoPicked(!1),changeRepo(stripNewlines(v3)),setRepoCursor(0),setBranchCursor(0)}function setBaseRefText(v3){setBaseRefTouched(!0),setBaseRef(stripNewlines(v3)),setBranchCursor(0)}function commitExisting(){if(repoResolution.kind==="ambiguous"){setSubmitError(t("newTask.error.repoAmbiguous",{name:repoResolution.name})),setField("repo"),setRepoPicked(!1);return}let r6=expandedRepo;if(!r6)return;let reason=validateRepoPath(r6);if(reason){setSubmitError(reason),setField("repo");return}if(intent==="project"&&canOpenProject){props.onSubmit({mode:"open",repo:r6,vendor}),dialog.clear();return}let b3=baseRef.trim()||DEFAULT_BASE_REF;props.onSubmit({repo:r6,baseRef:b3,vendor}),dialog.clear()}function commit(){if(tab==="clone"){clone.commitClone();return}if(tab==="adopt"){adopt2.commitAdopt();return}commitExisting()}function advanceField(from){let next=nextField(from,tab,{intentVisible:tab==="existing"&&canOpenProject});if(next==="baseRef"&&tab==="existing"&&intent==="project"&&canOpenProject)return nextField(next,tab);return next}function switchToTab(next){if(clone.cloneInFlight||next===tab)return;setTab(next),setField(firstFieldFor(next)),setSubmitError(null)}function cycleTab2(dir){if(clone.cloneInFlight)return;let next=dir===1?nextDialogTab(tab):prevDialogTab(tab);if(next===tab)return;setTab(next),setSubmitError(null),setField("tabs")}function cycleEngine(dir){setVendor((v3)=>dir===1?nextVendorWithin(vendors,v3):prevVendorWithin(vendors,v3))}function onRepoSubmit(){if(!repo.trim()&&mode==="saved"){let picked2=activeList[0];if(picked2){pickRepo(picked2),setField(advanceField("repo"));return}}if(mode==="browse"){let picked2=subdirFiltered[repoCursor];if(picked2)pickRepo(joinPicked(repo,subdirSplit.base,picked2)),setRepoCursor(0),setRepoPicked(!0);setField(advanceField("repo"));return}let picked=activeList[repoCursor];if(picked)pickRepo(picked);setField(advanceField("repo"))}function selectRepoAt(absoluteIndex){let picked=activeList[absoluteIndex];if(!picked)return;if(mode==="browse")pickRepo(joinPicked(repo,subdirSplit.base,picked)),setRepoPicked(!0);else pickRepo(picked);setRepoCursor(absoluteIndex),setField(advanceField("repo"))}function pickBranchAt(absoluteIndex){let name=branchFiltered[absoluteIndex];if(!name)return;setBaseRef(name),setBaseRefTouched(!0),setBranchCursor(absoluteIndex),setField("confirm")}function onBaseRefSubmit(){setBaseRef(resolveBaseRef2(baseRef,branchFiltered,branchCursor)),setBaseRefTouched(!0),commitExisting()}function moveCursor(delta){if(clone.cloneInFlight)return;if(tab==="existing"&&field==="repo"&&activeList.length>0){setRepoCursor((c2)=>clampCursor(c2+delta,activeList.length));return}if(tab==="existing"&&field==="baseRef"&&branchFiltered.length>0){setBranchCursor((c2)=>clampCursor(c2+delta,branchFiltered.length));return}if(tab==="clone"&&field==="cloneParent"){clone.moveParentCursor(delta);return}if(tab==="adopt")adopt2.moveAdoptCursor(delta)}return useBindings(()=>({bindings:[{key:"tab",cmd:()=>setField(advanceField)},{key:"ctrl+]",cmd:()=>switchToTab(nextDialogTab(tab))},{key:"ctrl+[",cmd:()=>switchToTab(prevDialogTab(tab))},{key:"ctrl+e",cmd:()=>cycleEngine(1)},{key:"up",cmd:()=>moveCursor(-1)},{key:"down",cmd:()=>moveCursor(1)},...field==="tabs"||field==="engine"||field==="intent"?[{key:"left",cmd:()=>{if(field==="tabs")cycleTab2(-1);else if(field==="engine")cycleEngine(-1);else setIntent("task")}},{key:"right",cmd:()=>{if(field==="tabs")cycleTab2(1);else if(field==="engine")cycleEngine(1);else setIntent("project")}},{key:"return",cmd:()=>setField(advanceField)}]:[],...tab==="adopt"?[{key:"ctrl+a",cmd:adopt2.adoptSelectAll}]:[]]})),useBindings(()=>({enabled:field==="confirm"&&!clone.cloneInFlight,bindings:[{key:"return",cmd:()=>commit()}]})),{...clone,...adopt2,defaultRepo:props.defaultRepo,tab,vendors,vendor,setVendor,field,setField,repo,repoDir,mode,activeList,activeWindow,repoCursor,repoPicked,expandedRepo,baseRef,branches,branchFiltered,branchWindow,branchCursor,intent,setIntent,canOpenProject,submitError,setRepoText,setBaseRefText,onRepoSubmit,selectRepoAt,pickBranchAt,onBaseRefSubmit,switchToTab,commit,commitExisting}}var import_react118,EMPTY_MAIN_REPOS;var init_view_model=__esm(async()=>{init_vendor();init_repo_field();init_state();init_i18n();init_git_snapshot();init_path_helpers();init_pure();init_use_derived_dir();await __promiseAll([init_react(),init_keymap(),init_dialog(),init_use_adopt_state(),init_use_clone_state()]);import_react118=__toESM(require_react_production(),1),EMPTY_MAIN_REPOS=new Set});function NewTaskDialogView(props){let{theme}=useTheme(),t3=useT(),padX=useDialogPaddingX(),vm=useNewTaskViewModel(props),tabLabel={existing:t3("newTask.tabs.existing"),clone:t3("newTask.tabs.clone"),adopt:t3("newTask.tabs.adopt")};return $jsxs("box",{paddingLeft:padX,paddingRight:padX,gap:0,children:[$jsx(DialogHeader,{title:t3("newTask.title"),onClose:()=>props.onCancel()}),$jsxs("box",{gap:1,paddingTop:1,children:[$jsx(DialogSection,{label:t3("newTask.field.mode"),focused:vm.field==="tabs",hint:t3("newTask.hint.modeCycle"),onPress:()=>vm.setField("tabs"),children:$jsx(ChipRow,{choices:TAB_ORDER2,selected:vm.tab,display:(tabId)=>tabLabel[tabId],onPick:(tabId)=>vm.switchToTab(tabId)})}),$jsx(DialogSection,{label:t3("newTask.field.engine"),focused:vm.field==="engine",hint:t3("newTask.hint.engineCycle"),onPress:()=>vm.setField("engine"),children:$jsx(ChipRow,{choices:vm.vendors,selected:vm.vendor,onPick:(vendor)=>{vm.setVendor(vendor),vm.setField("engine")}})}),vm.tab==="existing"?$jsx(ExistingTab,{vm}):null,vm.tab==="clone"?$jsx(CloneTab,{vm}):null,vm.tab==="adopt"?$jsx(AdoptTab,{vm}):null,vm.submitError?$jsxs("text",{fg:theme.error,wrapMode:"word",children:["\u203B ",vm.submitError]}):null]}),$jsx(DialogFooter,{children:t3("newTask.legend")}),$jsx(DialogActions,{label:vm.cloneInFlight?t3("newTask.button.cloning"):t3("newTask.button.create"),focused:vm.field==="confirm",onPress:()=>vm.commit()})]})}var TAB_ORDER2;var init_dialog2=__esm(async()=>{init_i18n2();init_jsx_runtime();await __promiseAll([init_theme(),init_dialog(),init_dialog_parts(),init_tab_adopt(),init_tab_clone(),init_tab_existing(),init_view_model()]);TAB_ORDER2=["existing","clone","adopt"]});function show8(dialog,defaultRepo,savedRepos,options){return showDialog(dialog,(resolve17)=>$jsx(NewTaskDialogView,{defaultRepo,savedRepos,defaultCloneParent:options?.defaultCloneParent,defaultVendor:options?.defaultVendor,availableVendors:options?.availableVendors,discoverAdoptable:options?.discoverAdoptable,mainRepos:options?.mainRepos,onSubmit:(v3)=>resolve17(v3),onCancel:()=>resolve17(void 0)}),{size:"medium"})}var NewTaskDialog;var init_new_task_dialog=__esm(async()=>{init_jsx_runtime();await __promiseAll([init_dialog(),init_dialog2()]);NewTaskDialog={show:show8}});function taskDialogAdapters(dialog){return{confirm:async(p3)=>await DialogConfirm.show(dialog,p3.title,p3.body,p3.cancelLabel,p3.confirmLabel,{danger:p3.danger})===!0,promptText:(initial,opts)=>RenameTaskDialog.show(dialog,initial,opts),promptNewTask:(defaultRepo,repos,opts)=>NewTaskDialog.show(dialog,defaultRepo,repos,opts)}}function selectNextAfterDelete(args2){return(taskId,nextTask)=>{if(args2.selectedId()!==taskId)return;let remaining=args2.tasks();args2.setSelectedId(nextTask?.id??remaining[0]?.id??null)}}function buildBaseCreateTaskContext(deps){return{orch:deps.orch,tasks:()=>deps.tasks(),...taskDialogAdapters(deps.dialog),...vendorPrefAdapters,logger:console,logPrefix:deps.logPrefix,notifyError:deps.notifyError,notifyInfo:deps.notifyInfo,updateActiveTask:!0,onTaskDeleted:selectNextAfterDelete(deps),cursorRepo:()=>{let list2=deps.tasks();return(list2.find((t3)=>t3.id===deps.selectedId())??list2[0])?.repo},selectTask:(id)=>deps.setSelectedId(id),enterTask:(id)=>deps.enterTask(id)}}var vendorPrefAdapters;var init_task_dialog_adapters=__esm(async()=>{init_vendor_prefs();await __promiseAll([init_new_task_dialog(),init_rename_task_dialog(),init_dialog_confirm()]);vendorPrefAdapters={lastVendor:(repo)=>resolvePreferredVendor(repo),rememberVendor:(repo,vendor)=>setRepoLastActiveVendor(repo,vendor)}});async function syncBaseAction(deps,taskId){let{t:t3}=deps;try{let res=await deps.orchestrator.syncBase(taskId);return deps.notifyInfo(res.alreadyCurrent?t3("tasks.sync.alreadyCurrent",{base:res.baseRef}):t3("tasks.sync.done",{base:res.baseRef})),!0}catch(err){let msg=err instanceof Error?err.message:String(err),conflict=CONFLICT_RE.exec(msg),dirty=DIRTY_RE.exec(msg);if(conflict)deps.notifyNeedsInput(t3("tasks.sync.conflict",{files:conflict[1]?.trim()||"?"}));else if(dirty)deps.notifyNeedsInput(t3("tasks.sync.dirty",{files:dirty[1]?.trim()||"?"}));else deps.notifyError(t3("tasks.sync.failed",{error:msg}));return!1}}var CONFLICT_RE,DIRTY_RE;var init_sync_base_action=__esm(()=>{CONFLICT_RE=/SYNC_CONFLICT(?:: )?(.*)/,DIRTY_RE=/SYNC_WORKTREE_DIRTY(?:: )?(.*)/});function useWorkspaceTaskActions(deps){let{orchestrator,tasks,dialog,notifyError}=deps,renderer=useRenderer(),t3=deps.t,taskActions={...buildBaseCreateTaskContext({orch:orchestrator,tasks,dialog,notifyError,notifyInfo:deps.notifyInfo,selectedId:deps.selectedId,setSelectedId:deps.setSelectedId,logPrefix:"[rove workspace]",enterTask:deps.activateTask}),pickStatus:(current)=>StatusPickerDialog.show(dialog,{current}),copyText:(text)=>copyTextToSystemClipboard(text,(payload)=>renderer?.copyToClipboardOSC52(payload)),onTaskDeleted:(()=>{let moveSelection=selectNextAfterDelete({tasks,selectedId:deps.selectedId,setSelectedId:deps.setSelectedId});return(taskId,nextTask)=>{deps.forgetTaskTabs(taskId),moveSelection(taskId,nextTask)}})()};async function togglePin(id){let task=tasks().find((t4)=>t4.id===id);if(!task)return;await orchestrator.setPinned(id,!task.pinned).catch((err)=>{notifyError(`Couldn't pin: ${errorMessage(err)}`)})}async function moveTask(id,delta){await orchestrator.moveTask(id,delta).catch((err)=>{notifyError(`Couldn't move: ${errorMessage(err)}`)})}async function renameBranch2(id){let task=tasks().find((t4)=>t4.id===id);if(!task||task.kind==="main"||task.kind==="dir")return;let next=await BranchPickerDialog.show(dialog,{currentBranch:task.branch,repo:task.repo});if(!next)return;await orchestrator.setBranch(id,next).catch((err)=>{notifyError(`Couldn't rename branch: ${errorMessage(err)}`)})}async function confirmRunAgain(id){let task=tasks().find((t4)=>t4.id===id);if(task?.prompt===void 0)return;return await RunAgainDialog.show(dialog,{taskTitle:task.title,prompt:task.prompt})===!0?task:void 0}async function pickVendor(id){let task=tasks().find((t4)=>t4.id===id);if(!task)return;let current=task.vendor??DEFAULT_TASK_VENDOR,engines=await availableEngineIds(),pick=await EnginePickerDialog.show(dialog,{engines:engines.length>0?engines:[current],current,currentEffort:task.modelEffort});if(!pick)return;if(pick.vendor===current&&(pick.effort===void 0||pick.effort===(task.modelEffort??"")))return;await applyVendorChange(taskActions,id,pick.vendor,{effort:pick.effort})}async function landTask2(id){let task=tasks().find((candidate)=>String(candidate.id)===id);if(!task)return;await landTaskAction({orchestrator,confirm:(branch)=>DialogConfirm.show(dialog,t3("worktrees.land.confirmTitle"),t3("worktrees.land.confirmBody",{branch}),t3("common.cancel"),t3("worktrees.land.button")).then((ok)=>ok===!0),notifyInfo:deps.notifyInfo,notifyNeedsInput:deps.notifyNeedsInput,notifyError,t:t3,callerCwd:process.cwd()},id,task.branch||task.title)}return{syncBase:(id)=>syncBaseAction({orchestrator,notifyInfo:deps.notifyInfo,notifyNeedsInput:deps.notifyNeedsInput,notifyError,t:t3},id),createTask:()=>createTaskFlow(taskActions),deleteTask:(id)=>deleteTaskFlow(taskActions,id),renameTask:(id)=>renameTaskFlow(taskActions,id),renameBranch:renameBranch2,cycleVendor:(id)=>cycleVendorFlow(taskActions,id),pickVendor,setVendor:async(id,vendor)=>{await applyVendorChange(taskActions,id,vendor,{silentSuccess:!0})},togglePin,moveTask,setStatus:(id)=>setStatusFlow(taskActions,id),copyTaskField:(id,field)=>copyTaskFieldFlow(taskActions,id,field),showFieldNotes:(repo)=>FieldNotesDialog.show(dialog,{repo,load:()=>orchestrator.listFieldNotes(repo)}),confirmRunAgain,landTask:landTask2}}var init_host_task_actions=__esm(async()=>{init_account_detect();init_clipboard_copy();init_task_actions();init_task_create_flow();init_task();init_land_task_action();init_sync_base_action();await __promiseAll([init_react(),init_branch_picker_dialog(),init_engine_picker_dialog(),init_field_notes_dialog(),init_run_again_dialog(),init_status_picker_dialog(),init_dialog_confirm(),init_task_dialog_adapters()])});import{spawn as spawn13}from"child_process";import{existsSync as existsSync34}from"fs";import{basename as basename13,delimiter as delimiter4,isAbsolute as isAbsolute7,join as join48}from"path";function executableOnPath(command,env,exists){if(isAbsolute7(command))return exists(command);let pathEnv=env.PATH??"";for(let dir of pathEnv.split(delimiter4)){if(!dir)continue;if(exists(join48(dir,command)))return!0}return!1}function labelForOverride(command){let name=basename13(command);if(name==="code")return"VS Code";if(name==="cursor")return"Cursor";if(name==="windsurf")return"Windsurf";if(name==="zed")return"Zed";return name||command}function detectWorktreeOpener(deps={}){let env=deps.env??process.env,platform3=deps.platform??process.platform,exists=deps.exists??existsSync34,override=readRoveEnv("OPEN_EDITOR",env)?.trim();if(override)return{id:"env",label:labelForOverride(override),command:override,args:[]};for(let c2 of CLI_CANDIDATES)if(executableOnPath(c2.command,env,exists))return{id:c2.id,label:c2.label,command:c2.command,args:[]};if(platform3==="darwin"&&executableOnPath("open",env,exists)){for(let app of MAC_APP_CANDIDATES)if(app.paths.some((path23)=>exists(path23)))return{id:app.id,label:app.label,command:"open",args:["-a",app.appName]};return{id:"mac-open",label:"Finder",command:"open",args:[]}}if(platform3==="linux"&&executableOnPath("xdg-open",env,exists))return{id:"xdg-open",label:"Open",command:"xdg-open",args:[]};return null}function buildOpenWorktreeCommand(worktreePath,opener){return[opener.command,[...opener.args,worktreePath]]}function openWorktree(worktreePath,opener,deps={}){if(!worktreePath)return!1;let spawnFn=deps.spawn??spawn13,[command,args2]=buildOpenWorktreeCommand(worktreePath,opener);try{let child=spawnFn(command,args2,{detached:!0,stdio:"ignore"});if(child.pid===void 0)return!1;return child.unref(),!0}catch{return!1}}var CLI_CANDIDATES,MAC_APP_CANDIDATES;var init_worktree_opener=__esm(()=>{CLI_CANDIDATES=[{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"}],MAC_APP_CANDIDATES=[{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 existsSync35}from"fs";async function requestTaskWorktreeOpen(id,deps){let path23=deps.taskPath;if(!path23||!existsSync35(path23))try{path23=await deps.ensureWorktree(id)}catch(error){let reason=error instanceof Error?error.message:String(error);deps.notifyError(`Couldn't create worktree: ${reason}`);return}if(!path23||!existsSync35(path23))return;let opener=detectWorktreeOpener();if(!opener){deps.notifyError(deps.noEditorMessage);return}if(!openWorktree(path23,opener))deps.notifyError(deps.openFailedMessage(opener.label))}function openTaskWorktreeFor(id,opts){requestTaskWorktreeOpen(id,{taskPath:opts.tasks.find((task)=>task.id===id)?.worktreePath,ensureWorktree:opts.ensureWorktree,notifyError:opts.notifyError,noEditorMessage:t("tasks.toast.noEditor"),openFailedMessage:(label)=>t("tasks.toast.openWorktreeFailed",{label})})}var init_open_task_worktree=__esm(()=>{init_i18n();init_worktree_opener()});import{randomUUID as randomUUID8}from"crypto";function formatDiffComment(c2){let escaped=c2.body.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\r/g,"\\r").replace(/\n/g,"\\n"),location=c2.startLine!==void 0&&c2.startLine!==c2.line?`Lines: ${c2.startLine}-${c2.line}`:`Line: ${c2.line}`;return[`File: ${c2.filePath}`,location,`User comment: "${escaped}"`].join(`
|
|
761
762
|
`)}function formatDiffComments(comments){return comments.map(formatDiffComment).join(`
|
|
762
763
|
|
|
763
764
|
`)}function unsentComments(comments){return comments.filter((c2)=>c2.sentAt===void 0)}function markAllSent(comments,now){return comments.map((c2)=>c2.sentAt===void 0?{...c2,sentAt:now}:c2)}function unifiedDiffRows(diff){let rows=[],oldLine=0,newLine=0,inHunk=!1;for(let line of diff.split(`
|