import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{U as r,cn as i}from"./state-sIHsFpDu.js";import{join as a}from"node:path";import{existsSync as o,mkdirSync as s,unlinkSync as c,writeFileSync as l}from"node:fs";function u(){return a(t(),`.tui-mode`)}function d(){return o(u())}function f(){let e=u();return s(t(),{recursive:!0}),l(e,new Date().toISOString(),`utf8`),{type:`text`,value:[`## TUI mode enabled`,``,`Marker written: \`${e}\``,``,`Flicker-free alternate-screen rendering will be active on the next`,`session start.  Add this to your shell profile to make it permanent:`,``,`  [ -f "$HOME/.claude/.tui-mode" ] && export CLAUDE_CODE_NO_FLICKER=1`,``,"To disable: `/tui off`"].join(`
`)}}function p(){let e=u();return o(e)?(c(e),{type:`text`,value:[`## TUI mode disabled`,``,`Marker removed: \`${e}\``,``,`Standard (non-alternate-screen) rendering will be used on the next`,`session start.`,``,"To re-enable: `/tui on`"].join(`
`)}):{type:`text`,value:`TUI mode was not active.`}}async function m(e){let t=e.trim().toLowerCase();if(t===`status`){let e=d(),t=u(),n=process.env.CLAUDE_CODE_NO_FLICKER,r;return r=n===`1`||n===`true`?`CLAUDE_CODE_NO_FLICKER=1 (forced on via env var)`:n===`0`||n===`false`?`CLAUDE_CODE_NO_FLICKER=0 (forced off via env var)`:`CLAUDE_CODE_NO_FLICKER not set`,{type:`text`,value:[`## TUI Mode Status`,``,`  Marker file:  ${e?`present`:`absent`} (\`${t}\`)`,`  Mode:         ${e?`enabled`:`disabled`}`,`  Env var:      ${r}`,``,`Note: changes take effect on the next session start.`].join(`
`)}}return t===`on`?f():t===`off`?p():t===``||t===`toggle`?d()?p():f():{type:`text`,value:[`Unknown subcommand: "${t}"`,``,h].join(`
`)}}var h,g,_,v=e((()=>{i(),n(),h=[`Usage: /tui [subcommand]`,``,`  (no args)   Toggle flicker-free TUI mode (alternate screen buffer)`,`  on          Enable TUI mode`,`  off         Disable TUI mode`,`  status      Show current TUI mode state`,``,`TUI mode uses the ANSI alternate screen buffer (\\x1b[?1049h) so the`,`Claude Code UI occupies a clean full-screen area with no scroll-back`,`flicker.  The setting is stored in ~/.claude/.tui-mode and takes effect`,`on the next session start.`,``,`Shell-profile integration (auto-enable on every start):`,`  [ -f "$HOME/.claude/.tui-mode" ] && export CLAUDE_CODE_NO_FLICKER=1`,``,`Environment override:`,`  CLAUDE_CODE_NO_FLICKER=1   force on (overrides marker)`,`  CLAUDE_CODE_NO_FLICKER=0   force off (overrides marker)`].join(`
`),g={type:`local-jsx`,name:`tui`,description:`Manage flicker-free TUI mode. Open actions or run: status, on, off, toggle`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[status|on|off|toggle]`,bridgeSafe:!0,getBridgeInvocationError:e=>e.trim()?void 0:`Use /tui status/on/off/toggle over Remote Control.`,load:()=>import(`./panel-BYfvo_mR.js`)},_={type:`local`,name:`tui`,description:`Toggle flicker-free TUI mode (alternate screen buffer). Subcommands: on, off, status`,isHidden:!1,isEnabled:()=>r(),supportsNonInteractive:!0,bridgeSafe:!0,load:async()=>({call:m})}}));export{_ as i,v as n,g as r,m as t};