tweakcc-fixed 2.7.21 → 2.7.23

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/index.mjs CHANGED
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
- import{$ as e,B as t,D as n,E as r,F as i,G as a,H as o,I as s,J as c,K as l,L as u,M as d,N as f,O as p,P as m,Q as h,R as g,S as _,T as v,U as y,V as b,W as x,Y as S,_ as C,a as w,at as T,b as ee,d as E,et as D,g as O,h as te,i as k,it as ne,j as A,k as re,l as j,m as ie,n as ae,nt as oe,o as se,p as M,q as ce,r as N,rt as P,s as F,t as I,tt as le,u as ue,v as de,x as fe,y as pe,z as me}from"./config-5oMnJiM1.mjs";import{a as he,c as L,d as ge,l as _e,n as ve,o as ye,s as be,t as xe,u as Se}from"./content-CJ-UM9mI.mjs";import{Box as R,Text as z,render as Ce,useInput as B,useStdin as we}from"ink";import{Command as Te}from"commander";import V from"chalk";import Ee,{Fragment as De,createContext as Oe,useCallback as ke,useContext as H,useEffect as U,useMemo as Ae,useRef as je,useState as W}from"react";import*as Me from"node:os";import Ne from"ink-link";import*as Pe from"node:fs/promises";import Fe from"node:fs/promises";import*as G from"node:fs";import*as K from"node:path";import{execFile as Ie,execSync as Le,spawn as Re}from"node:child_process";import ze from"gray-matter";import{structuredPatch as Be}from"diff";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import Ve from"process";import He from"cli-spinners";import*as Ue from"node:readline";var X=({children:e,...t})=>Y(z,{bold:!0,backgroundColor:`#ffd500`,color:`#000`,...t,children:[` `,e,` `]});const We=[`\x1B[?25l\x1B[0m \x1B[38;2;0;0;0m \x1B[38;2;252;130;0m▂\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▇\x1B[38;2;254;131;0m\x1B[48;2;252;130;0m▇\x1B[48;2;252;130;0m▇▇\x1B[48;2;252;130;0m▇\x1B[0m\x1B[38;2;252;130;0m▇\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▂ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;254;131;0m▗\x1B[38;2;254;131;0m▆\x1B[48;2;254;131;0m \x1B[38;2;254;132;0m╶ \x1B[0m\x1B[38;2;254;131;0m▆\x1B[38;2;254;131;0m▖ \x1B[0m`,` \x1B[7m\x1B[38;2;254;131;0m▘\x1B[0m\x1B[38;2;11;6;0m\x1B[48;2;254;131;0m \x1B[38;2;254;216;182m\x1B[48;2;254;136;12m▃\x1B[38;2;254;249;246m\x1B[48;2;254;143;29m▅\x1B[38;2;254;253;253m\x1B[48;2;254;143;40m▆\x1B[38;2;254;254;253m\x1B[48;2;254;152;68m▆▆▆\x1B[38;2;254;253;252m\x1B[48;2;254;141;34m▆\x1B[38;2;254;247;242m\x1B[48;2;254;140;24m▅\x1B[38;2;254;224;199m\x1B[48;2;254;140;20m▖\x1B[48;2;254;131;0m \x1B[0m\x1B[7m\x1B[38;2;254;131;0m▝\x1B[0m \x1B[0m`,`\x1B[7m\x1B[38;2;251;127;0m▌\x1B[0m\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[38;2;252;128;0m\x1B[48;2;254;131;0m▃\x1B[38;2;252;129;0m▂\x1B[38;2;253;130;0m▁\x1B[38;2;249;135;16m\x1B[48;2;253;226;202m▋\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┈\x1B[48;2;246;246;245m┈\x1B[38;2;47;47;47m\x1B[48;2;244;244;243m▂\x1B[38;2;112;112;112m\x1B[48;2;251;251;251m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m▁╌▝\x1B[38;2;254;254;253m\x1B[48;2;254;254;254m▋\x1B[38;2;254;254;254m\x1B[48;2;254;253;252m┈\x1B[38;2;252;209;168m\x1B[48;2;251;129;0m▍\x1B[38;2;253;129;0m\x1B[48;2;254;131;0m▂\x1B[38;2;252;128;0m▃\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[0m\x1B[38;2;251;127;0m▌\x1B[0m`,`\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▏\x1B[38;2;245;118;0m\x1B[48;2;248;122;0m▄\x1B[38;2;247;121;0m\x1B[48;2;247;122;0m┈\x1B[38;2;106;68;38m\x1B[48;2;245;123;2m▃\x1B[38;2;39;33;28m\x1B[48;2;211;109;6m▅\x1B[38;2;27;20;12m\x1B[48;2;237;237;237m▌\x1B[48;2;254;254;253m \x1B[38;2;90;90;89m\x1B[48;2;231;230;230m▝\x1B[38;2;215;215;214m\x1B[48;2;48;48;48m▁\x1B[38;2;203;203;202m\x1B[48;2;42;42;42m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┇╴\x1B[38;2;253;252;252m▂\x1B[38;2;251;250;250m\x1B[48;2;253;253;253m▃\x1B[38;2;249;249;248m\x1B[48;2;252;252;251m▄\x1B[38;2;249;248;248m\x1B[48;2;237;118;0m▍\x1B[38;2;246;121;0m\x1B[48;2;250;125;0m▄\x1B[38;2;246;119;0m\x1B[48;2;249;124;0m▄\x1B[38;2;245;118;0m\x1B[48;2;248;123;0m▄\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▉\x1B[0m`,`\x1B[38;2;238;108;0m\x1B[48;2;237;109;0m▏\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;233;109;2m\x1B[48;2;125;73;29m▇\x1B[38;2;225;104;1m\x1B[48;2;50;32;18m▄\x1B[38;2;62;29;2m\x1B[48;2;239;237;237m▌\x1B[38;2;254;253;253m\x1B[48;2;254;254;254m┻\x1B[38;2;254;254;253m▊\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;253;253;252m▂\x1B[38;2;251;251;251m\x1B[48;2;254;253;253m▃\x1B[38;2;249;249;249m\x1B[48;2;252;252;252m▄\x1B[38;2;247;247;247m\x1B[48;2;250;250;250m▄\x1B[38;2;245;245;244m\x1B[48;2;248;248;248m▄\x1B[38;2;243;243;242m\x1B[48;2;246;246;245m▄\x1B[38;2;243;242;242m\x1B[48;2;230;109;0m▍\x1B[38;2;239;111;0m\x1B[48;2;243;116;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;237;108;0m\x1B[48;2;238;108;0m▉\x1B[0m`,`\x1B[7m\x1B[38;2;231;98;0m▌\x1B[0m\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[38;2;231;99;0m\x1B[48;2;235;105;0m▄\x1B[38;2;232;100;0m\x1B[48;2;236;105;0m▄\x1B[38;2;232;101;0m\x1B[48;2;236;106;0m▄\x1B[38;2;223;99;0m\x1B[48;2;247;238;235m▌\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;252;252;251m▃\x1B[38;2;250;250;250m\x1B[48;2;253;253;252m▄\x1B[38;2;248;248;247m\x1B[48;2;251;251;250m▄\x1B[38;2;246;245;245m\x1B[48;2;249;248;248m▄\x1B[38;2;243;243;243m\x1B[48;2;246;246;246m▄\x1B[38;2;241;241;241m\x1B[48;2;244;244;244m▄\x1B[38;2;239;239;238m\x1B[48;2;242;242;242m▄\x1B[38;2;237;237;236m\x1B[48;2;240;240;239m▄\x1B[38;2;237;236;236m\x1B[48;2;223;99;0m▍\x1B[38;2;232;100;0m\x1B[48;2;236;106;0m▄\x1B[38;2;231;100;0m\x1B[48;2;235;105;0m▄\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[0m\x1B[38;2;231;98;0m▌\x1B[0m`,` \x1B[7m\x1B[38;2;224;89;0m▖\x1B[0m\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[38;2;225;90;0m\x1B[48;2;228;95;0m▄\x1B[38;2;225;91;0m\x1B[48;2;229;96;0m▄\x1B[38;2;217;90;1m\x1B[48;2;97;77;70m▌\x1B[38;2;70;70;70m\x1B[48;2;207;207;207m▆\x1B[38;2;66;65;65m\x1B[48;2;228;228;227m▄\x1B[38;2;66;66;66m\x1B[48;2;233;232;232m▂\x1B[38;2;169;169;169m\x1B[48;2;243;243;243m▁\x1B[38;2;240;239;239m\x1B[48;2;243;242;242m▄\x1B[38;2;238;237;237m\x1B[48;2;241;240;240m▄\x1B[38;2;235;235;235m\x1B[48;2;238;238;238m▄\x1B[38;2;233;233;233m\x1B[48;2;236;236;236m▄\x1B[38;2;231;231;230m\x1B[48;2;234;234;233m▄\x1B[38;2;231;230;230m\x1B[48;2;216;89;0m▍\x1B[38;2;225;90;0m\x1B[48;2;229;95;0m▄\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[0m\x1B[7m\x1B[38;2;224;89;0m▗\x1B[0m \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;217;80;0m▝\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m\x1B[48;2;221;86;0m▄\x1B[38;2;197;78;9m\x1B[48;2;66;66;65m▋\x1B[38;2;65;65;64m\x1B[48;2;60;60;60m▘\x1B[38;2;52;52;51m\x1B[48;2;56;56;56m▗\x1B[38;2;45;45;45m\x1B[48;2;50;50;49m▗\x1B[38;2;42;42;42m\x1B[48;2;46;46;46m┈\x1B[38;2;41;41;41m\x1B[48;2;203;202;202m▆\x1B[38;2;38;38;38m\x1B[48;2;218;218;218m▄\x1B[38;2;45;45;45m\x1B[48;2;221;221;221m▂\x1B[38;2;229;229;229m┊\x1B[38;2;225;225;225m\x1B[48;2;228;228;227m▄\x1B[38;2;225;224;224m\x1B[48;2;209;79;0m▍\x1B[0m\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m▘ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[7m\x1B[38;2;191;73;0m▆\x1B[38;2;191;73;0m▄\x1B[38;2;56;55;55m▃\x1B[38;2;46;46;46m▁\x1B[0m\x1B[38;2;20;20;20m\x1B[48;2;42;42;42m▁\x1B[38;2;36;36;36m\x1B[48;2;35;34;34m╴\x1B[38;2;23;23;23m\x1B[48;2;29;29;28m▁\x1B[38;2;10;10;10m\x1B[48;2;22;22;22m▁\x1B[0m\x1B[7m\x1B[38;2;15;15;15m▁\x1B[38;2;22;22;21m▃\x1B[38;2;154;154;154m▅\x1B[38;2;175;116;83m▇\x1B[0m\x1B[38;2;17;15;14m \x1B[0m`,`\x1B[?25h\x1B[0m`];var Ge=()=>Y(R,{flexDirection:`row`,height:10,alignItems:`center`,borderStyle:`bold`,borderBottom:!1,borderTop:!1,borderRight:!1,borderColor:`#ff8400`,marginBottom:1,children:[Y(R,{marginBottom:1,paddingLeft:1,flexDirection:`column`,flexGrow:1,children:[J(z,{bold:!0,color:`#ff8400`,children:`Piebald is released!`}),J(z,{children:` `}),Y(z,{children:[`We've released `,J(z,{bold:!0,children:`Piebald`}),`, the ultimate agentic AI developer experience.`]}),Y(z,{children:[`Download it and try it out for free!`,` `,J(Ne,{url:`https://piebald.ai/`,fallback:!1,children:J(z,{color:`#ff8400`,children:`https://piebald.ai/`})})]}),J(z,{children:` `}),J(z,{dimColor:!0,color:`gray`,children:`press 'h' to hide`})]}),J(R,{width:22,flexShrink:0,flexDirection:`column`,alignItems:`center`,children:We.map((e,t)=>J(z,{children:e},t))})]});let Z=function(e){return e.THEMES=`Themes`,e.THINKING_VERBS=`Thinking verbs`,e.THINKING_STYLE=`Thinking style`,e.USER_MESSAGE_DISPLAY=`User message display`,e.INPUT_PATTERN_HIGHLIGHTERS=`Input pattern highlighters`,e.MISC=`Misc`,e.TOOLSETS=`Toolsets`,e.SUBAGENT_MODELS=`Subagent models`,e.COMPLEXITY_ROUTER=`Complexity effort router [experimental]`,e.CLAUDE_MD_ALT_NAMES=`CLAUDE.md alternative names`,e.SYSTEM_REMINDERS=`System reminders (injection lobotomy)`,e.SKILLS=`Skills (per-skill on/name-only/user-invocable/off)`,e.BROWSER_BRIDGE=`Better Claude in Chrome`,e.VIEW_SYSTEM_PROMPTS=`View system prompts`,e.RESTORE_ORIGINAL=`Restore original Claude Code (preserves config.json)`,e.OPEN_CONFIG=`Open config.json`,e.OPEN_CLI=`Open Claude Code's cli.js`,e.EXIT=`Exit`,e}({});function Ke({items:e,selectedIndex:t,onSelect:n,onSubmit:r}){return B((i,a)=>{e.length!==0&&(a.upArrow?n(t>0?t-1:e.length-1):a.downArrow?n(t<e.length-1?t+1:0):a.return&&r(e[t].name))}),J(R,{flexDirection:`column`,children:e.map((e,n)=>J(R,{children:Y(z,{children:[Y(z,{bold:n===t,color:n===t?`cyan`:void 0,...n===t?e.selectedStyles??{}:e.styles??{},children:[n===t?`❯ `:` `,e.name]}),e.desc&&n===t&&Y(z,{dimColor:!0,bold:!1,children:[` \x1B[0;2m`,`- `,e.desc]})]})},n))})}const qe=[{name:Z.THEMES,desc:`Modify Claude Code's built-in themes or create your own`},{name:Z.THINKING_VERBS,desc:`Customize the list of verbs that Claude Code uses when it's working`},{name:Z.THINKING_STYLE,desc:`Choose custom spinners`},{name:Z.USER_MESSAGE_DISPLAY,desc:`Customize how user messages are displayed`},{name:Z.INPUT_PATTERN_HIGHLIGHTERS,desc:`Create custom highlighters for patterns in your input`},{name:Z.MISC,desc:`Miscellaneous settings (input box border, etc.)`},{name:Z.TOOLSETS,desc:`Manage toolsets to control which tools are available`},{name:Z.SUBAGENT_MODELS,desc:`Configure which Claude model each subagent uses (Plan, Explore, etc.)`},{name:Z.COMPLEXITY_ROUTER,desc:`[EXPERIMENTAL] Auto-route reasoning effort by task complexity (routine=low ... hardest=max)`},{name:Z.CLAUDE_MD_ALT_NAMES,desc:`Configure alternative filenames for CLAUDE.md (e.g., AGENTS.md)`},{name:Z.SYSTEM_REMINDERS,desc:`Suppress per-turn <system-reminder> injections (skills list, MCP instructions, claudeMd wrapper, etc.)`},{name:Z.SKILLS,desc:`Per-skill listing control (writes settings.json skillOverrides — no patch needed)`},{name:Z.BROWSER_BRIDGE,desc:`Drive your real, logged-in tabs over CDP — a fuller take on Claude in Chrome`},{name:Z.VIEW_SYSTEM_PROMPTS,desc:`Opens the system prompts directory where you can customize Claude Code's system prompts`}],Je=[{name:Z.RESTORE_ORIGINAL,desc:`Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)`},{name:Z.OPEN_CONFIG,desc:`Opens your tweakcc config file (${N})`},{name:Z.OPEN_CLI,desc:`Opens Claude Code's cli.js file`},{name:Z.EXIT,desc:`Bye!`}];var Ye=({onSubmit:e})=>{let t=[...qe,...Je],[n,r]=W(0);return J(Ke,{items:t,selectedIndex:n,onSelect:r,onSubmit:t=>e(t)})};const Xe=()=>Y(R,{flexDirection:`row`,children:[J(X,{children:`tweakcc`}),J(z,{children:` (by `}),J(Ne,{url:`https://piebald.ai`,fallback:!1,children:J(z,{color:`#ff8400`,bold:!0,children:`Piebald`})}),J(z,{children:`)`})]}),Ze=()=>J(R,{children:Y(z,{color:`yellow`,children:[`⭐ `,J(z,{bold:!0,children:`Star the repo at `}),J(Ne,{url:`https://github.com/skrabe/tweakcc-fixed`,fallback:!1,children:J(z,{bold:!0,color:`cyan`,children:`https://github.com/skrabe/tweakcc-fixed`})}),J(z,{bold:!0,children:` if you find this useful!`}),` ⭐`]})}),Qe=({notification:e})=>J(R,{borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:`bold`,borderColor:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,paddingLeft:1,flexDirection:`column`,children:J(z,{color:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,children:e.message})}),$e=({onSubmit:e,notification:t,configMigrated:n,showPiebaldAnnouncement:r,changesApplied:i,invocationCommand:a})=>Y(R,{flexDirection:`column`,gap:1,children:[n&&J(R,{children:J(z,{color:`blue`,bold:!0,children:"Note that in tweakcc v3.2.0+, `ccInstallationDir` config is deprecated. You are now migrated to `ccInstallationPath` which supports npm and native installs."})}),J(Xe,{}),J(R,{children:Y(z,{children:[J(z,{bold:!0,children:`Customize your Claude Code installation.`}),` `,Y(z,{dimColor:!0,children:[`Settings will be saved to `,ae.replace(Me.homedir(),`~`),`/config.json.`]})]})}),J(r?Ge:Ze,{}),t&&J(Qe,{notification:t}),!i&&!t&&J(Qe,{notification:{message:`Your changes are configured but not applied.\nRun \`${a} --apply\` to apply your customizations!`,type:`info`}}),J(Ye,{onSubmit:e})]});function Q({color:e,backgroundColor:t,bold:n,dimColor:r,children:i}){let a=e?.startsWith(`ansi:`),o=t?.startsWith(`ansi:`);if(a||o){if(Ee.Children.toArray(i).some(e=>Ee.isValidElement(e)))return J(z,{children:i});let s=V;if(a){let t=e.slice(5);s=s[t]||s}if(o){let e=t.slice(5),n=e.startsWith(`bg`)?e:`bg${e.charAt(0).toUpperCase()}${e.slice(1)}`;s=s[n]||s}n&&(s=s.bold),r&&(s=s.dim);let c=Ee.Children.toArray(i).map(e=>typeof e==`string`||typeof e==`number`?String(e):``).join(``);return J(z,{children:s(c)})}return J(z,{color:e,backgroundColor:t,bold:n,dimColor:r,children:i})}function et({text:e,nonShimmerColors:t,shimmerColors:n,shimmerWidth:r=3,updateDuration:i=50,restartPoint:a=10}){let[o,s]=W(0);return U(()=>{let t=setInterval(()=>{s(t=>{let n=t+1;return n>=e.length+a?-r:n})},i);return()=>clearInterval(t)},[e.length,a,i]),t.length===n.length?J(z,{children:e.split(``).map((i,a)=>{let s=a>=o&&a<o+r&&o<e.length,c=a%t.length;return J(z,{color:s?n[c]:t[c],children:i},a)})}):(console.error(`UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length`),J(z,{children:e}))}const tt=Ve.cwd();function nt({theme:e}){let{ccVersion:t}=H($);return Y(R,{flexDirection:`column`,paddingLeft:1,children:[J(R,{marginBottom:1,children:Y(z,{bold:!0,children:[`Preview: `,e.name]})}),J(R,{borderStyle:`single`,borderColor:`gray`,paddingX:1,children:Y(R,{flexDirection:`column`,children:[Y(R,{flexDirection:`column`,children:[Y(z,{children:[J(Q,{color:e.colors.clawd_body,children:` ▐`}),J(z,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`▛███▜`}),Y(z,{children:[J(Q,{color:e.colors.clawd_body,children:`▌ `}),` `,J(z,{bold:!0,children:`Claude Code`}),` `,t?`v${t}`:`v2.0.14`]})]}),Y(z,{children:[J(Q,{color:e.colors.clawd_body,children:`▝▜`}),J(z,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`█████`}),J(Q,{color:e.colors.clawd_body,children:`▛▘`}),` `,_(),` · `,ee()]}),Y(Q,{color:e.colors.clawd_body,children:[` `,`▘▘ ▝▝`,` `,tt]}),Y(z,{children:[Y(Q,{color:e.colors.success,children:[`Login successful. Press`,` `]}),J(Q,{bold:!0,color:e.colors.success,children:`Enter`}),Y(Q,{color:e.colors.success,children:[` `,`to continue…`]})]})]}),J(z,{children:`╭─────────────────────────────────────────────╮`}),Y(z,{children:[`│ 1 function greet() `,`{`,` `,`│`]}),Y(z,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:`- console.log("`}),J(Q,{backgroundColor:e.colors.diffRemovedWord,children:`Hello, World!`}),J(Q,{backgroundColor:e.colors.diffRemoved,children:`");`}),` `,`│`]}),Y(z,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:`+ console.log("`}),J(Q,{backgroundColor:e.colors.diffAddedWord,children:`Hello, Claude!`}),J(Q,{backgroundColor:e.colors.diffAdded,children:`");`}),` `,`│`]}),J(Q,{color:e.colors.warning,children:`╭─────────────────────────────────────────────╮`}),Y(Q,{color:e.colors.warning,children:[`│ Do you trust the files in this folder?`,` `,`│`]}),Y(z,{children:[J(Q,{color:e.colors.warning,children:`│ `}),J(z,{dimColor:!0,children:`Enter to confirm · Esc to exit`}),Y(Q,{color:e.colors.warning,children:[` `,`│`]})]}),J(Q,{color:e.colors.bashBorder,children:`───────────────────────────────────────────────`}),Y(z,{children:[J(Q,{color:e.colors.bashBorder,children:`!`}),J(z,{children:` ls`})]}),J(Q,{color:e.colors.promptBorder,children:`───────────────────────────────────────────────`}),J(z,{children:Y(z,{children:[`> list the dir`,` `,J(et,{text:`ultrathink`,nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),J(Q,{color:e.colors.planMode,children:`╭─────────────────────────────────────────────╮`}),Y(z,{children:[J(Q,{color:e.colors.planMode,children:`│ `}),Y(Q,{color:e.colors.permission,children:[`Ready to code?`,` `]}),J(z,{children:`Here is Claude's plan:`}),Y(Q,{color:e.colors.planMode,children:[` `,`│`]})]}),J(Q,{color:e.colors.permission,children:`╭─────────────────────────────────────────────╮`}),Y(z,{children:[J(Q,{color:e.colors.permission,children:`│ `}),J(z,{bold:!0,children:`Permissions:`}),` `,Y(Q,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[` `,`Allow`,` `]}),` `,`Deny`,` `,`Workspace`,` `,J(Q,{color:e.colors.permission,children:`│`})]}),J(z,{children:`> list the dir`}),Y(z,{children:[J(Q,{color:e.colors.error,children:`●`}),J(z,{children:` Update(__init__.py)`})]}),Y(z,{children:[J(z,{children:` ⎿ `}),J(Q,{color:e.colors.error,children:`User rejected update to __init__.py`})]}),Y(z,{children:[` `,`1`,` `,Y(Q,{backgroundColor:e.colors.diffRemovedDimmed,children:[`- import`,` `]}),J(Q,{backgroundColor:e.colors.diffRemovedWordDimmed,children:`os`})]}),Y(z,{children:[` `,`2`,` `,Y(Q,{backgroundColor:e.colors.diffAddedDimmed,children:[`+ import`,` `]}),J(Q,{backgroundColor:e.colors.diffAddedWordDimmed,children:`random`})]}),Y(z,{children:[J(Q,{color:e.colors.success,children:`●`}),J(z,{children:` List(.)`})]}),Y(z,{children:[J(z,{children:`●`}),J(z,{children:` The directory `}),J(Q,{color:e.colors.permission,children:`C:\\Users\\user`}),Y(z,{children:[` `,`contains `,J(z,{bold:!0,children:`123`}),` files.`]})]}),Y(z,{children:[J(Q,{color:e.colors.claude,children:`✻ Th`}),J(Q,{color:e.colors.claudeShimmer,children:`ink`}),J(Q,{color:e.colors.claude,children:`ing… `}),J(z,{children:`(esc to interrupt)`})]}),J(z,{children:J(Q,{color:e.colors.autoAccept,children:`⏵⏵ accept edits on (shift+tab to cycle)`})}),J(z,{children:J(Q,{color:e.colors.planMode,children:`⏸ plan mode on (shift+tab to cycle)`})}),J(z,{children:J(Q,{color:e.colors.ide,children:`◯ IDE connected ⧉ 44 lines selected`})})]})})]})}function rt({colorKey:e,theme:t,bold:n=!1}){let r=t.colors[e];return e===`inverseText`?J(Q,{color:r,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith(`diff`)?J(Q,{backgroundColor:r,bold:n,color:t.colors.text,children:e}):J(Q,{color:r,bold:n,children:e})}function it({initialValue:e,onColorChange:t,onExit:i,colorKey:a,theme:o}){let s=ot(e)||{h:0,s:50,l:50},c=at(e)||{r:128,g:128,b:128},[l,u]=W(s),[d,f]=W(c),[p,m]=W(`hsl`),[h,g]=W(`h`),[_,v]=W(!1),[y,b]=W(!1);U(()=>{let t=ot(e),n=at(e);t&&n&&(v(!0),u(t),f(n),v(!1))},[e]),U(()=>{!_&&y&&t(`rgb(${d.r},${d.g},${d.b})`)},[l,d,_,y]),U(()=>{b(!0)},[]);let x=e=>{if(r(e)){let t=n(e),r=ot(t),i=at(t);r&&i&&(v(!0),u(r),f(i),v(!1))}};B((e,t)=>{if(e.length>1&&!t.ctrl&&!t.meta){x(e);return}t.return||t.escape?i():t.ctrl&&e===`a`?(m(e=>e===`hsl`?`rgb`:`hsl`),g(e=>p===`hsl`?e===`h`?`r`:e===`s`?`g`:`b`:e===`r`?`h`:e===`g`?`s`:`l`)):t.upArrow?g(p===`hsl`?e=>e===`h`?`l`:e===`s`?`h`:`s`:e=>e===`r`?`b`:e===`g`?`r`:`g`):t.downArrow||t.tab?g(p===`hsl`?e=>e===`h`?`s`:e===`s`?`l`:`h`:e=>e===`r`?`g`:e===`g`?`b`:`r`):t.leftArrow?S(t.shift||t.ctrl||t.meta?-10:-1):t.rightArrow&&S(t.shift||t.ctrl||t.meta?10:1)});let S=e=>{v(!0),p===`hsl`?u(t=>{let n={...t};h===`h`?n.h=Math.max(0,Math.min(359,t.h+e)):h===`s`?n.s=Math.max(0,Math.min(100,t.s+e)):h===`l`&&(n.l=Math.max(0,Math.min(100,t.l+e)));let[r,i,a]=w(n.h,n.s,n.l);return f({r,g:i,b:a}),n}):f(t=>{let n={...t};return h===`r`?n.r=Math.max(0,Math.min(255,t.r+e)):h===`g`?n.g=Math.max(0,Math.min(255,t.g+e)):h===`b`&&(n.b=Math.max(0,Math.min(255,t.b+e))),u(C(n.r,n.g,n.b)),n}),v(!1)},C=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===r?((i-a)/c+(i<a?6:0))/6:o===i?((a-r)/c+2)/6:((r-i)/c+4)/6),{h:Math.round(d*360),s:Math.round(u*100),l:Math.round(l*100)}},w=(e,t,n)=>{e/=360,t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e*6%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<1/6?(o=r,s=i,c=0):1/6<=e&&e<2/6?(o=i,s=r,c=0):2/6<=e&&e<3/6?(o=0,s=r,c=i):3/6<=e&&e<4/6?(o=0,s=i,c=r):4/6<=e&&e<5/6?(o=i,s=0,c=r):5/6<=e&&e<1&&(o=r,s=0,c=i),[Math.round((o+a)*255),Math.round((s+a)*255),Math.round((c+a)*255)]},T=()=>{let e=[],t=[[255,0,0],[255,127,0],[255,255,0],[127,255,0],[0,255,0],[0,255,127],[0,255,255],[0,127,255],[0,0,255],[127,0,255],[255,0,255],[255,0,127],[255,0,0]];for(let n=0;n<40;n++){let r=n/39*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=r-i,[s,c,l]=t[i],[u,d,f]=t[a],p=Math.round(s+(u-s)*o),m=Math.round(c+(d-c)*o),h=Math.round(l+(f-l)*o);e.push(J(z,{backgroundColor:`rgb(${p},${m},${h})`,children:` `},n))}return e},ee=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=w(l.h,n,l.l);e.push(J(z,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},E=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=w(l.h,l.s,n);e.push(J(z,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},D=()=>{let[e,t,n]=w(l.h,l.s,l.l);return`rgb(${e},${t},${n})`},O=(e,t,n)=>{let r=e=>e.toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},te=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(z,{backgroundColor:`rgb(${n},${d.g},${d.b})`,children:` `},t))}return e},k=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(z,{backgroundColor:`rgb(${d.r},${n},${d.b})`,children:` `},t))}return e},ne=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(z,{backgroundColor:`rgb(${d.r},${d.g},${n})`,children:` `},t))}return e},A=(e,t)=>Math.round(e/t*39);return Y(R,{flexDirection:`column`,borderStyle:`single`,borderColor:`white`,padding:1,children:[Y(R,{flexDirection:`column`,children:[J(z,{bold:!0,children:`Color Picker`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{color:`gray`,dimColor:!0,children:`←→ to adjust (shift/ctrl/cmd +10)`}),J(z,{color:`gray`,dimColor:!0,children:`↑↓ to change bar`}),J(z,{color:`gray`,dimColor:!0,children:`ctrl+a to switch rgb/hsl`}),J(z,{color:`gray`,dimColor:!0,children:`paste color from clipboard`}),J(z,{color:`gray`,dimColor:!0,children:`enter to exit (auto-saved)`}),J(z,{color:`gray`,dimColor:!0,children:`esc to save and exit`})]})]}),p===`hsl`?Y(q,{children:[Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`h`?`yellow`:`white`,children:[h===`h`?`❯ `:` `,`Hue (`,l.h,`°):`]})}),J(R,{children:T().map((e,t)=>J(De,{children:t===A(l.h,360)?J(z,{children:`|`}):e},t))})]}),Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`s`?`yellow`:`white`,children:[h===`s`?`❯ `:` `,`Saturation (`,l.s,`%):`]})}),J(R,{children:ee().map((e,t)=>J(De,{children:t===A(l.s,100)?J(z,{children:`|`}):e},t))})]}),Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`l`?`yellow`:`white`,children:[h===`l`?`❯ `:` `,`Lightness (`,l.l,`%):`]})}),J(R,{children:E().map((e,t)=>J(De,{children:t===A(l.l,100)?J(z,{children:`|`}):e},t))})]})]}):Y(q,{children:[Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`r`?`yellow`:`white`,children:[h===`r`?`❯ `:` `,`Red (`,d.r,`):`]})}),J(R,{children:te().map((e,t)=>J(De,{children:t===A(d.r,255)?J(z,{children:`|`}):e},t))})]}),Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`g`?`yellow`:`white`,children:[h===`g`?`❯ `:` `,`Green (`,d.g,`):`]})}),J(R,{children:k().map((e,t)=>J(De,{children:t===A(d.g,255)?J(z,{children:`|`}):e},t))})]}),Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`b`?`yellow`:`white`,children:[h===`b`?`❯ `:` `,`Blue (`,d.b,`):`]})}),J(R,{children:ne().map((e,t)=>J(De,{children:t===A(d.b,255)?J(z,{children:`|`}):e},t))})]})]}),Y(R,{marginBottom:1,children:[J(z,{children:`Current: `}),J(z,{backgroundColor:D(),children:` `})]}),Y(R,{flexDirection:`row`,justifyContent:`space-between`,children:[Y(R,{flexDirection:`column`,children:[J(z,{dimColor:!0,children:`Hex `}),a?.startsWith(`diff`)?J(z,{backgroundColor:D(),color:o?.colors?.text||`white`,bold:!0,children:O(d.r,d.g,d.b)}):a===`inverseText`?J(z,{color:D(),backgroundColor:o?.colors?.permission,bold:!0,children:O(d.r,d.g,d.b)}):J(z,{color:D(),bold:!0,children:O(d.r,d.g,d.b)})]}),Y(R,{flexDirection:`column`,children:[J(z,{dimColor:!0,children:`RGB `}),a?.startsWith(`diff`)?J(z,{backgroundColor:D(),color:o?.colors?.text||`white`,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):a===`inverseText`?J(z,{color:D(),backgroundColor:o?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):J(z,{color:D(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),Y(R,{flexDirection:`column`,children:[J(z,{dimColor:!0,children:`HSL `}),a?.startsWith(`diff`)?J(z,{backgroundColor:D(),color:o?.colors?.text||`white`,bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`}):a===`inverseText`?J(z,{color:D(),backgroundColor:o?.colors?.permission,bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`}):J(z,{color:D(),bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`})]})]})]})}function at(e){let t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};let n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){let e=n[1];return{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16)}}return null}function ot(e){let t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){let e=parseInt(n[1])/255,t=parseInt(n[2])/255,r=parseInt(n[3])/255,i=Math.max(e,t,r),a=Math.min(e,t,r),o=i-a,s=(i+a)/2,c=0;o!==0&&(c=s>.5?o/(2-i-a):o/(i+a));let l=0;return o!==0&&(l=i===e?((t-r)/o+(t<r?6:0))/6:i===t?((r-e)/o+2)/6:((e-t)/o+4)/6),{h:Math.round(l*360),s:Math.round(c*100),l:Math.round(s*100)}}let r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){let e=r[1],t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,i=parseInt(e.substr(4,2),16)/255,a=Math.max(t,n,i),o=Math.min(t,n,i),s=a-o,c=(a+o)/2,l=0;s!==0&&(l=c>.5?s/(2-a-o):s/(a+o));let u=0;return s!==0&&(u=a===t?((n-i)/s+(n<i?6:0))/6:a===n?((i-t)/s+2)/6:((t-n)/s+4)/6),{h:Math.round(u*360),s:Math.round(l*100),l:Math.round(c*100)}}return{h:0,s:50,l:50}}function st({onBack:e,themeId:t}){let{settings:{themes:i},updateSettings:a}=H($),[o,s]=W(t),c=i.find(e=>e.id===o)||i[0],[l,u]=W(`rgb`),[f,p]=W(0),[m,h]=W(null),[g,_]=W(null),[v,y]=W(``),[b,x]=W(``),[S,C]=W(!1),[w,T]=W(0),ee=ke(e=>{a(t=>{let n=t.themes.findIndex(e=>e.id===o);n!==-1&&e(t.themes[n])})},[o,a]),E=e=>{if(f>=2&&r(e)){let t=n(e),r=D[f-2];ee(e=>{e.colors[r]=t})}};B((t,n)=>{if(S){if(n.escape){C(!1),e();return}return}if(m===null&&g===null){if(t.length>1&&!n.ctrl&&!n.meta){E(t);return}if(n.escape)C(!0),T(0);else if(n.ctrl&&t===`a`)u(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(n.upArrow)p(e=>Math.max(0,e-1));else if(n.downArrow)p(e=>Math.min(D.length+1,e+1));else if(n.return)if(f===0)_(`name`),y(c.name),x(c.name);else if(f===1)_(`id`),y(c.id),x(c.id);else{let e=f-2,t=D[e],n=c.colors[t];h(e),y(n),x(n)}}else if(m!==null)n.ctrl&&t===`a`&&u(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(g!==null)if(n.return){if(g===`id`){let e=o;s(v),a(t=>{let n=t.themes.findIndex(t=>t.id===e);n!==-1&&(t.themes[n].id=v)})}else ee(e=>{e.name=v});_(null),y(``),x(``)}else n.escape?(_(null),y(``),x(``)):n.backspace||n.delete?y(e=>e.slice(0,-1)):t&&y(e=>e+t)});let D=Object.keys(c.colors),O=(e,t)=>{let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!n)return e;let r=parseInt(n[1]),i=parseInt(n[2]),a=parseInt(n[3]);switch(t){case`hex`:{let e=e=>e.toString(16).padStart(2,`0`);return`#${e(r)}${e(i)}${e(a)}`}case`hsl`:{let e=r/255,t=i/255,n=a/255,o=Math.max(e,t,n),s=Math.min(e,t,n),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===e?((t-n)/c+(t<n?6:0))/6:o===t?((n-e)/c+2)/6:((e-t)/c+4)/6),`hsl(${Math.round(d*360)}, ${Math.round(u*100)}%, ${Math.round(l*100)}%)`}case`rgb`:default:return e}},te=e=>({autoAccept:`Auto-accept edits mode indicator`,bashBorder:`Bash command border`,claude:`Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.`,claudeShimmer:`Color used for the shimmering effect on the thinking verb.`,claudeBlue_FOR_SYSTEM_SPINNER:`System spinner color (blue variant)`,claudeBlueShimmer_FOR_SYSTEM_SPINNER:`System spinner shimmer color (blue variant)`,permission:`Permission prompt color`,permissionShimmer:`Permission prompt shimmer color`,planMode:`Plan mode indicator`,ide:`Color used for IDE-related messages.`,promptBorder:`Input prompt border color`,promptBorderShimmer:`Input prompt border shimmer color`,text:`Code color. Used in diffs.`,inverseText:`Inverse text color. Used for the text of tabs, where the background is filled in.`,inactive:`Inactive/dimmed text. Used for line numbers and less prominent text.`,subtle:`Subtle text. Used for help text and secondary information.`,suggestion:`Suggestion text color. Used for suggestions for theme names and various other things.`,remember:`Remember/note color. Used for various text relating to memories.`,background:`Background color for certain UI elements`,success:`Success indicator. Used for the bullet on successful tool calls, and various success messages (such as sign in successful).`,error:`Error indicator`,warning:`Warning indicator`,warningShimmer:`Warning shimmer color`,diffAdded:`Added diff background`,diffRemoved:`Removed diff background`,diffAddedDimmed:`Added diff background (dimmed)`,diffRemovedDimmed:`Removed diff background (dimmed)`,diffAddedWord:`Added word highlight`,diffRemovedWord:`Removed word highlight`,diffAddedWordDimmed:`Added word highlight (dimmed)`,diffRemovedWordDimmed:`Removed word highlight (dimmed)`,red_FOR_SUBAGENTS_ONLY:`Red color for sub agents`,blue_FOR_SUBAGENTS_ONLY:`Blue color for sub agents`,green_FOR_SUBAGENTS_ONLY:`Green color for sub agents`,yellow_FOR_SUBAGENTS_ONLY:`Yellow color for sub agents`,purple_FOR_SUBAGENTS_ONLY:`Purple color for sub agents`,orange_FOR_SUBAGENTS_ONLY:`Orange color for sub agents`,pink_FOR_SUBAGENTS_ONLY:`Pink color for sub agents`,cyan_FOR_SUBAGENTS_ONLY:`Cyan color for sub agents`,professionalBlue:`Professional blue color for business contexts?`,rainbow_red:`"ultrathink" rainbow - red`,rainbow_orange:`"ultrathink" rainbow - orange`,rainbow_yellow:`"ultrathink" rainbow - yellow`,rainbow_green:`"ultrathink" rainbow - green`,rainbow_blue:`"ultrathink" rainbow - blue`,rainbow_indigo:`"ultrathink" rainbow - indigo`,rainbow_violet:`"ultrathink" rainbow - violet`,rainbow_red_shimmer:`"ultrathink" rainbow (shimmer) - red`,rainbow_orange_shimmer:`"ultrathink" rainbow (shimmer) - orange`,rainbow_yellow_shimmer:`"ultrathink" rainbow (shimmer) - yellow`,rainbow_green_shimmer:`"ultrathink" rainbow (shimmer) - green`,rainbow_blue_shimmer:`"ultrathink" rainbow (shimmer) - blue`,rainbow_indigo_shimmer:`"ultrathink" rainbow (shimmer) - indigo`,rainbow_violet_shimmer:`"ultrathink" rainbow (shimmer) - violet`,clawd_body:`"Clawd" character body color`,clawd_background:`"Clawd" character background color`,userMessageBackground:`Background color for user messages`,bashMessageBackgroundColor:`Background color for bash command output`,memoryBackgroundColor:`Background color for memory/context information`,rate_limit_fill:`Rate limit indicator fill color`,rate_limit_empty:`Rate limit indicator empty/background color`})[e]||``,k=Math.max(...D.map(e=>e.length));return Y(R,{children:[Y(R,{flexDirection:`column`,width:`50%`,children:[J(R,{children:Y(X,{children:[`Editing theme “`,c.name,`” (`,c.id,`)`]})}),S?Y(R,{flexDirection:`column`,marginTop:1,children:[J(R,{marginBottom:1,children:Y(z,{bold:!0,children:[`Would you like to make “`,c.name,`” your current Claude Code theme?`]})}),J(Ke,{items:[{name:`Yes`,desc:`Set ${c.id} as active theme`},{name:`No`,desc:`Go back without changing theme`}],selectedIndex:w,onSelect:T,onSubmit:()=>{w===0&&d(c.id),C(!1),e()}}),J(z,{dimColor:!0,children:`enter to select, esc to cancel`})]}):m===null&&g===null?Y(q,{children:[Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`enter to edit theme name, id, or color`}),J(z,{dimColor:!0,children:`ctrl+a to toggle rgb, hex, hsl`}),J(z,{dimColor:!0,children:`paste color from clipboard (when on color)`}),J(z,{dimColor:!0,children:`esc to go back`})]}),f<2?Y(R,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:`yellow`,flexDirection:`column`,paddingLeft:1,children:[J(z,{bold:!0,children:f===0?`Theme Name`:`Theme ID`}),J(z,{children:f===0?`The display name for this theme`:"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):Y(R,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:c.colors[D[f-2]],flexDirection:`column`,paddingLeft:1,children:[J(rt,{colorKey:D[f-2],theme:c,bold:!0}),J(z,{children:te(D[f-2])})]}),Y(R,{flexDirection:`column`,children:[Y(R,{children:[J(z,{color:f===0?`yellow`:`white`,children:f===0?`❯ `:` `}),J(z,{bold:!0,children:`Name: `}),J(z,{children:c.name})]}),Y(R,{marginBottom:1,children:[J(z,{color:f===1?`yellow`:`white`,children:f===1?`❯ `:` `}),J(z,{bold:!0,children:`ID: `}),J(z,{children:c.id})]}),(()=>{if(f<2)return Y(q,{children:[D.slice(0,20).map((e,t)=>{let n=t+2;return Y(R,{children:[J(z,{color:f===n?`yellow`:`white`,children:f===n?`❯ `:` `}),J(R,{width:k+2,children:J(z,{children:J(rt,{colorKey:e,theme:c,bold:!0})})}),J(Q,{color:c.colors[e],children:O(c.colors[e],l)})]},e)}),D.length>20&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,D.length-20,` more below`]})]});let e=f-2,t=Math.max(0,e-10),n=Math.min(D.length,t+20),r=Math.max(0,n-20),i=D.slice(r,n);return Y(q,{children:[r>0&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t+2;return Y(R,{children:[J(z,{color:f===n?`yellow`:`white`,children:f===n?`❯ `:` `}),J(R,{width:k+2,children:J(z,{children:J(rt,{colorKey:e,theme:c,bold:!0})})}),J(Q,{color:c.colors[e],children:O(c.colors[e],l)})]},e)}),n<D.length&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,D.length-n,` more below`]})]})})()]})]}):g?Y(R,{flexDirection:`column`,marginTop:1,children:[Y(z,{children:[`Editing `,g===`name`?`theme name`:`theme ID`,`:`]}),J(R,{borderStyle:`round`,borderColor:`yellow`,paddingX:1,children:J(z,{children:v})}),J(z,{dimColor:!0,children:`enter to save, esc to cancel`})]}):J(it,{initialValue:b,colorKey:D[m],theme:c,onColorChange:e=>{y(e),ee(t=>{t.colors[D[m]]=e})},onExit:()=>{ee(e=>{e.colors[D[m]]=v}),h(null),y(``),x(``)}})]}),J(R,{width:`50%`,children:J(nt,{theme:c})})]})}const ct=`https://raw.githubusercontent.com/Piebald-AI/claude-code-themes/main`,lt=`${ct}/index.json`,ut=2e4;async function dt(){M(`Fetching community theme index from ${lt}`);let e=await fetch(lt,{headers:{Accept:`application/json`},signal:AbortSignal.timeout(ut)});if(!e.ok)throw Error(`Failed to fetch community theme index: ${e.status} ${e.statusText}`);return JSON.parse(await re(e))}async function ft(e){let t=`${ct}/themes/${e}.json`;M(`Fetching community theme from ${t}`);let n=await fetch(t,{headers:{Accept:`application/json`},signal:AbortSignal.timeout(ut)});if(!n.ok)throw Error(`Failed to fetch community theme "${e}": ${n.status} ${n.statusText}`);return JSON.parse(await re(n))}function pt({onBack:e}){let{updateSettings:t}=H($),[n,r]=W({status:`loading`}),[i,a]=W(0),[o,s]=W(null),[c,l]=W(!1),[u,d]=W(null),f=je(0);U(()=>{dt().then(e=>{r({status:`loaded`,entries:e})}).catch(e=>{r({status:`error`,message:e.message})})},[]);let p=n.status===`loaded`?n.entries:[],m=ke(async e=>{let t=++f.current;l(!0),d(null);try{let n=await ft(e);if(t!==f.current)return;s(ie(n,ne))}catch{if(t!==f.current)return;s(null),d(`Failed to load preview.`)}finally{t===f.current&&l(!1)}},[]),h=ke(async e=>{d(`Downloading theme…`);try{let n=ie(await ft(e.id),ne),r=!1;t(e=>{e.themes.some(e=>e.id===n.id)||(e.themes.push(n),r=!0)}),d(r?`Added "${n.name}" to your themes!`:`Theme "${n.name}" (${n.id}) is already in your config.`)}catch{d(`Failed to download theme.`)}},[t]);return B((t,r)=>{if(r.escape){e();return}if(n.status!==`loaded`)return;let o=n.entries.length;if(o!==0){if(r.upArrow)a(e=>Math.max(0,e-1)),s(null),d(null);else if(r.downArrow)a(e=>Math.min(o-1,e+1)),s(null),d(null);else if(t===` `){let e=n.entries[i];e&&m(e.id)}else if(r.return){let e=n.entries[i];e&&h(e)}}}),n.status===`loading`?Y(R,{flexDirection:`column`,children:[J(X,{children:`Community Themes`}),J(z,{children:`Loading community themes…`})]}):n.status===`error`?Y(R,{flexDirection:`column`,children:[J(X,{children:`Community Themes`}),Y(z,{color:`red`,children:[`Error: `,n.message]}),J(z,{dimColor:!0,children:`esc to go back`})]}):Y(R,{children:[Y(R,{flexDirection:`column`,width:`50%`,children:[J(X,{children:`Community Themes`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`space to preview theme`}),J(z,{dimColor:!0,children:`enter to download theme`}),J(z,{dimColor:!0,children:`esc to go back`})]}),J(R,{flexDirection:`column`,children:p.map((e,t)=>Y(z,{color:i===t?`yellow`:void 0,children:[i===t?`❯ `:` `,e.name,` (`,e.id,`) by @`,e.author]},e.id))}),u&&J(R,{marginTop:1,children:J(z,{color:`cyan`,children:u})}),c&&J(R,{marginTop:1,children:J(z,{dimColor:!0,children:`Loading preview…`})})]}),J(R,{width:`50%`,children:o?J(nt,{theme:o}):J(R,{flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:10,children:J(z,{dimColor:!0,children:`Press space to preview the selected theme.`})})})]})}function mt(e){return e.map(e=>`${e.name} (${e.id})`)}function ht({onBack:e}){let{settings:{themes:t},updateSettings:n}=H($),[r,i]=W(0),[a,o]=W(null),[s,c]=W(!0),[l,u]=W(!1),d=t.length+1,f=()=>{let e={colors:{...(t[0]||P.themes[0]).colors},name:`New Custom Theme`,id:`custom-${Date.now()}`};n(t=>{t.themes.push(e)}),o(e.id),c(!1)},p=e=>{t.length<=1||(n(t=>{t.themes=t.themes.filter(t=>t.id!==e)}),r>=t.length-1&&i(Math.max(0,t.length-2)))},m=()=>{n(e=>{e.themes=[...P.themes]}),i(0)},h=r===t.length;if(B((n,a)=>{if(a.escape)e();else if(a.upArrow)i(e=>Math.max(0,e-1));else if(a.downArrow)i(e=>Math.min(d-1,e+1));else if(a.return)if(h)u(!0),c(!1);else{let e=t[r];e&&(o(e.id),c(!1))}else if(n===`n`)f();else if(n===`d`){if(!h){let e=t[r];e&&p(e.id)}}else a.ctrl&&n===`r`&&m()},{isActive:s}),l)return J(pt,{onBack:()=>{u(!1),c(!0)}});if(a)return J(st,{themeId:a,onBack:()=>{o(null),c(!0)}});let g=mt(t),_=t.find(e=>g[r]?.includes(`(${e.id})`))||t[0];return t.length===0?J(R,{children:Y(R,{flexDirection:`column`,width:`100%`,children:[J(X,{children:`Themes`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`n to create a new theme`}),J(z,{dimColor:!0,children:`esc to go back`})]}),J(z,{children:`No themes available!`})]})}):Y(R,{children:[Y(R,{flexDirection:`column`,width:`50%`,children:[J(X,{children:`Themes`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`n to create a new theme`}),J(z,{dimColor:!0,children:`d to delete a theme`}),J(z,{dimColor:!0,children:`ctrl+r to delete all themes and restore built-in`}),J(z,{dimColor:!0,children:`enter to edit theme`}),J(z,{dimColor:!0,children:`esc to go back`})]}),Y(R,{flexDirection:`column`,children:[g.map((e,t)=>Y(z,{color:r===t?`yellow`:void 0,children:[r===t?`❯ `:` `,e]},t)),Y(z,{color:h?`blue`:void 0,bold:h,children:[h?`❯ `:` `,`Browse community themes…`]})]})]}),J(R,{width:`50%`,children:h?J(R,{flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:10,children:J(z,{dimColor:!0,children:`Press enter to browse community themes.`})}):J(nt,{theme:_})})]})}function gt(e,t,n){let r=Math.max(0,e-Math.floor(n/2)),i=Math.min(t,r+n);return{start:Math.max(0,i-n),end:i}}function _t({onBack:e}){let{settings:{thinkingVerbs:{format:t,verbs:n},themes:r},updateSettings:i}=H($),a=[`format`,`verbs`],[o,s]=W(0),c=a[o],[l,u]=W(0),[d,f]=W(!1),[p,m]=W(``),[h,g]=W(!1),[_,v]=W(!1),[y,b]=W(t),x=fe(),S=(r.find(e=>e.id===x)||r.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;return B((r,o)=>{if(_){o.return?(i(e=>{e.thinkingVerbs.format=y}),v(!1)):o.escape?(b(t),v(!1)):o.backspace||o.delete?b(e=>e.slice(0,-1)):r&&b(e=>e+r);return}if(d||h){o.return&&p.trim()?(h?(i(e=>{e.thinkingVerbs.verbs.push(p.trim())}),g(!1)):(i(e=>{e.thinkingVerbs.verbs[l]=p.trim()}),f(!1)),m(``)):o.escape?(m(``),f(!1),g(!1)):o.backspace||o.delete?m(e=>e.slice(0,-1)):r&&m(e=>e+r);return}o.escape?e():o.return?c===`format`&&(b(t),v(!0)):o.tab?o.shift?s(e=>e===0?a.length-1:e-1):s(e=>e===a.length-1?0:e+1):o.upArrow?c===`verbs`&&n.length>0&&u(e=>e>0?e-1:n.length-1):o.downArrow?c===`verbs`&&n.length>0&&u(e=>e<n.length-1?e+1:0):r===`e`&&c===`verbs`?n.length>0&&(m(n[l]),f(!0)):r===`d`&&c===`verbs`?n.length>1&&(i(e=>{e.thinkingVerbs.verbs=e.thinkingVerbs.verbs.filter((e,t)=>t!==l)}),l>=n.length-1&&u(Math.max(0,n.length-2))):r===`n`&&c===`verbs`?(g(!0),m(``)):o.ctrl&&r===`r`&&c===`verbs`&&(i(e=>{e.thinkingVerbs.verbs=[...P.thinkingVerbs.verbs]}),u(0))}),Y(R,{children:[Y(R,{flexDirection:`column`,width:`50%`,children:[Y(R,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`Thinking Verbs`}),Y(R,{flexDirection:`column`,children:[J(z,{dimColor:!0,children:c===`format`?`enter to edit format`:`changes auto-saved`}),J(z,{dimColor:!0,children:`esc to go back`}),J(z,{dimColor:!0,children:`tab to switch sections`})]})]}),J(R,{marginBottom:1,children:J(z,{dimColor:!0,children:`Customize the verbs shown during generation and their format.`})}),Y(R,{flexDirection:`column`,children:[Y(z,{children:[J(z,{color:c===`format`?`yellow`:void 0,children:c===`format`?`❯ `:` `}),J(z,{bold:!0,color:c===`format`?`yellow`:void 0,children:`Format`})]}),c===`format`&&(_?Y(z,{dimColor:!0,children:[` `,`enter to save`]}):Y(z,{dimColor:!0,children:[` `,`enter to edit`]}))]}),J(R,{marginLeft:2,marginBottom:1,children:J(R,{borderStyle:`round`,borderColor:_?`yellow`:`gray`,children:J(z,{children:_?y:t})})}),J(R,{children:Y(z,{children:[J(z,{color:c===`verbs`?`yellow`:void 0,children:c===`verbs`?`❯ `:` `}),J(z,{bold:!0,color:c===`verbs`?`yellow`:void 0,children:`Verbs`})]})}),c===`verbs`&&J(R,{flexDirection:`column`,children:Y(z,{dimColor:!0,children:[` `,`e to edit · d to delete · n to add new · ctrl+r to reset`]})}),J(R,{marginLeft:2,marginBottom:1,children:Y(R,{flexDirection:`column`,children:[(()=>{let{start:e,end:t}=gt(l,n.length,8),r=n.slice(e,t);return Y(q,{children:[e>0&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↑ `,e,` more above`]}),r.map((t,n)=>{let r=e+n;return Y(z,{color:c===`verbs`&&r===l?`cyan`:void 0,children:[c===`verbs`&&r===l?`❯ `:` `,t]},r)}),t<n.length&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,n.length-t,` more below`]})]})})(),h&&Y(R,{alignItems:`center`,children:[J(z,{color:`yellow`,children:`❯ `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:p})})]}),d&&Y(R,{marginTop:1,alignItems:`center`,children:[J(z,{children:`Editing: `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:p})})]})]})})]}),Y(R,{width:`50%`,flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,children:`Preview`})}),J(R,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:Y(z,{children:[Y(z,{color:S,children:[`✻ `,t.replace(/\{\}/g,n[l]??``),` `]}),J(z,{children:`(esc to interrupt)`})]})})]})]})}const vt=e=>e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).replace(/(\d+)/g,` $1 `).replace(/\s+/g,` `).trim().replace(/^./,e=>e.toUpperCase()),yt=e=>{let t=Math.max(...e.map(e=>e.length));return e.map(e=>e.padEnd(t))},bt=Object.entries(He).map(([e,t])=>({name:vt(e),phases:t.frames.map(e=>e.trimEnd()),reverseMirror:!1,updateInterval:t.interval})),xt=[{name:`Default`,phases:P.thinkingStyle.phases,reverseMirror:P.thinkingStyle.reverseMirror},{name:`Wave`,phases:[`▁`,`▃`,`▄`,`▅`,`▆`,`▇`,`█`],reverseMirror:!0},{name:`Glow`,phases:[`░`,`▒`,`▓`,`█`],reverseMirror:!0},{name:`Partial block`,phases:[`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`,`█`],reverseMirror:!0},{name:`Colors`,phases:[`🔴`,`🟠`,`🟡`,`🟢`,`🔵`,`🟣`],reverseMirror:!1},...bt];function St({onBack:e}){let{settings:{thinkingStyle:{phases:t,updateInterval:n,reverseMirror:r},themes:i},updateSettings:a}=H($),o=[`reverseMirror`,`updateInterval`,`phases`,`presets`],[s,c]=W(0),l=o[s],[u,d]=W(0),[f,p]=W(0),[m,h]=W(!1),[g,_]=W(``),[v,y]=W(!1),[b,x]=W(!1),[S,C]=W(n.toString()),[w,T]=W(0),ee=fe(),E=(i.find(e=>e.id===ee)||i.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;U(()=>{if(t.length>0){let e=r?[...t,...[...t].reverse().slice(1,-1)]:t,i=setInterval(()=>{T(t=>(t+1)%e.length)},n);return()=>clearInterval(i)}},[t,n,r]),U(()=>{d(e=>Math.min(e,Math.max(0,t.length-1)))},[t.length]),B((r,i)=>{if(b){if(i.return){let e=parseInt(S);!isNaN(e)&&e>0&&a(t=>{t.thinkingStyle.updateInterval=e}),x(!1)}else i.escape?(C(n.toString()),x(!1)):i.backspace||i.delete?C(e=>e.slice(0,-1)):r&&r.match(/^[0-9]$/)&&C(e=>e+r);return}if(m||v){if(i.return&&g.length){let e=v?[...t,g]:t.map((e,t)=>t===u?g:e);a(t=>{t.thinkingStyle.phases=yt(e)}),h(!1),_(``)}else i.escape?(_(``),h(!1),y(!1)):i.backspace||i.delete?_(e=>e.slice(0,-1)):r&&_(e=>e+r);return}if(i.escape)e();else if(i.return)if(l===`updateInterval`)C(n.toString()),x(!0);else if(l===`presets`){let e=xt[f];a(t=>{t.thinkingStyle.phases=yt([...e.phases]),t.thinkingStyle.reverseMirror=e.reverseMirror,e.updateInterval!==void 0&&(t.thinkingStyle.updateInterval=e.updateInterval)})}else l===`reverseMirror`&&a(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(i.tab)i.shift?c(e=>e===0?o.length-1:e-1):c(e=>e===o.length-1?0:e+1);else if(i.upArrow)l===`phases`&&t.length>0?d(e=>e>0?e-1:t.length-1):l===`presets`&&p(e=>e>0?e-1:xt.length-1);else if(i.downArrow)l===`phases`&&t.length>0?d(e=>e<t.length-1?e+1:0):l===`presets`&&p(e=>e<xt.length-1?e+1:0);else if(r===` `)l===`reverseMirror`&&a(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(r===`e`&&l===`phases`)t.length>0&&(_(t[u]),h(!0));else if(r===`a`&&l===`phases`)y(!0),_(``);else if(r===`d`&&l===`phases`)t.length>1&&a(e=>{e.thinkingStyle.phases=yt(t.filter((e,t)=>t!==u))});else if(r===`w`&&l===`phases`){if(u>0){let e=[...t];[e[u-1],e[u]]=[e[u],e[u-1]],a(t=>{t.thinkingStyle.phases=e}),d(e=>e-1)}}else if(r===`s`&&l===`phases`){if(u<t.length-1){let e=[...t];[e[u],e[u+1]]=[e[u+1],e[u]],a(t=>{t.thinkingStyle.phases=e}),d(e=>e+1)}}else i.ctrl&&r===`r`&&(a(e=>{e.thinkingStyle=P.thinkingStyle}),d(0),p(0))});let D=r?`●`:`○`,O=(()=>r?[...t,...[...t].reverse().slice(1,-1)]:t)(),te=O.length>0?O[w]:`·`;return J(R,{children:Y(R,{flexDirection:`column`,width:`100%`,children:[Y(R,{flexDirection:`row`,width:`100%`,children:[Y(R,{marginBottom:1,flexDirection:`column`,width:`50%`,children:[J(X,{children:`Thinking style`}),Y(R,{flexDirection:`column`,children:[Y(z,{dimColor:!0,children:[`enter to`,` `,l===`updateInterval`?`edit interval`:l===`presets`?`apply preset`:`save`]}),J(z,{dimColor:!0,children:`esc to go back`}),J(z,{dimColor:!0,children:`tab to switch sections`})]})]}),Y(R,{width:`50%`,flexDirection:`column`,children:[J(R,{children:J(z,{bold:!0,children:`Preview`})}),Y(R,{borderStyle:`single`,borderColor:`gray`,paddingX:1,flexDirection:`row`,children:[J(R,{width:(te?.length??0)+1,children:J(z,{color:E,children:te})}),Y(z,{children:[J(z,{color:E,children:`Thinking… `}),J(z,{children:`(esc to interrupt)`})]})]})]})]}),Y(R,{flexDirection:`row`,gap:4,children:[Y(R,{flexDirection:`column`,children:[Y(z,{children:[J(z,{color:l===`reverseMirror`?`yellow`:void 0,children:l===`reverseMirror`?`❯ `:` `}),J(z,{bold:!0,color:l===`reverseMirror`?`yellow`:void 0,children:`Reverse-mirror phases`})]}),l===`reverseMirror`&&Y(z,{dimColor:!0,children:[` `,`space to toggle`]}),J(R,{marginLeft:2,marginBottom:1,children:Y(z,{children:[D,` `,r?`Enabled`:`Disabled`]})})]}),Y(R,{flexDirection:`column`,children:[Y(z,{children:[J(z,{color:l===`updateInterval`?`yellow`:void 0,children:l===`updateInterval`?`❯ `:` `}),J(z,{bold:!0,color:l===`updateInterval`?`yellow`:void 0,children:`Update interval (ms)`})]}),l===`updateInterval`&&(b?Y(z,{dimColor:!0,children:[` `,`enter to save`]}):Y(z,{dimColor:!0,children:[` `,`enter to edit`]})),J(R,{marginLeft:2,marginBottom:1,children:J(R,{borderStyle:`round`,borderColor:b?`yellow`:`gray`,children:J(z,{children:b?S:n})})})]})]}),J(R,{children:Y(z,{children:[J(z,{color:l===`phases`?`yellow`:void 0,children:l===`phases`?`❯ `:` `}),J(z,{bold:!0,color:l===`phases`?`yellow`:void 0,children:`Phases`})]})}),l===`phases`&&J(R,{marginBottom:1,flexDirection:`column`,children:Y(z,{dimColor:!0,children:[` `,`[e]dit`,` `,`[a]dd`,` `,`[d]elete`,` `,`[w]move up`,` `,`[s]move down`]})}),J(R,{marginLeft:2,marginBottom:1,children:Y(R,{flexDirection:`column`,children:[(()=>{let{start:e,end:n}=gt(u,t.length,8),r=t.slice(e,n);return Y(q,{children:[e>0&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↑ `,e,` more above`]}),r.map((t,n)=>{let r=e+n;return Y(z,{color:l===`phases`&&r===u?`cyan`:void 0,children:[l===`phases`&&r===u?`❯ `:` `,t]},r)}),n<t.length&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,t.length-n,` more below`]})]})})(),v&&Y(R,{children:[J(z,{color:`yellow`,children:`❯ `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:g})})]}),m&&Y(R,{marginTop:1,children:[J(z,{children:`Editing: `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:g})})]})]})}),J(R,{children:Y(z,{children:[J(z,{color:l===`presets`?`yellow`:void 0,children:l===`presets`?`❯ `:` `}),J(z,{bold:!0,color:l===`presets`?`yellow`:void 0,children:`Presets`})]})}),l===`presets`&&Y(z,{dimColor:!0,children:[` `,`Selecting one will overwrite your choice of phases and interval`]}),J(R,{marginLeft:2,marginBottom:1,children:J(R,{flexDirection:`column`,children:(()=>{let{start:e,end:t}=gt(f,xt.length,12),n=xt.slice(e,t),r=e=>{let t=e.phases.join(``);return t.length>30?t.slice(0,27)+`…`:t};return Y(q,{children:[e>0&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↑ `,e,` more above`]}),n.map((t,n)=>{let i=e+n,a=l===`presets`&&i===f;return Y(z,{color:a?`cyan`:void 0,children:[a?`❯ `:` `,t.name,` `,r(t)]},i)}),t<xt.length&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,xt.length-t,` more below`]})]})})()})}),J(R,{marginTop:1,children:J(z,{dimColor:!0,children:`ctrl+r to reset all settings to default`})})]})})}function Ct(e,t){let n=je(!0);U(()=>{if(n.current){n.current=!1;return}return e()},t)}const wt=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],Tt=[{label:`none`,value:`none`},{label:`single`,value:`single`},{label:`double`,value:`double`},{label:`round`,value:`round`},{label:`bold`,value:`bold`},{label:`singleDouble`,value:`singleDouble`},{label:`doubleSingle`,value:`doubleSingle`},{label:`classic`,value:`classic`},{label:`topBottomSingle`,value:`topBottomSingle`},{label:`topBottomDouble`,value:`topBottomDouble`},{label:`topBottomBold`,value:`topBottomBold`}];function Et({onBack:e}){let{settings:t,updateSettings:n}=H($),[r,i]=W(!1),[a,o]=W(!1),[s,c]=W(!1),[l,u]=W(()=>t.userMessageDisplay.format),[d,f]=W(()=>t.userMessageDisplay.paddingX===`default`?`default`:`custom`),[p,m]=W(()=>t.userMessageDisplay.paddingY===`default`?`default`:`custom`),[h,g]=W(()=>t.userMessageDisplay.paddingX===`default`?`0`:String(t.userMessageDisplay.paddingX)),[_,v]=W(()=>t.userMessageDisplay.paddingY===`default`?`0`:String(t.userMessageDisplay.paddingY)),[y,b]=W(t.userMessageDisplay.fitBoxToContent),[x,S]=W(0),[C,w]=W(()=>[...t.userMessageDisplay.styling]),[T,ee]=W(()=>t.userMessageDisplay.foregroundColor===`default`?`default`:`custom`),[E,D]=W(()=>t.userMessageDisplay.foregroundColor===`default`?`rgb(255,255,255)`:t.userMessageDisplay.foregroundColor),[O,te]=W(()=>{let e=t.userMessageDisplay.backgroundColor;return e===null?`none`:e===`default`?`default`:`custom`}),[k,ne]=W(()=>{let e=t.userMessageDisplay.backgroundColor;return e===null||e===`default`?`rgb(0,0,0)`:e}),[A,re]=W(()=>Tt.findIndex(e=>e.value===t.userMessageDisplay.borderStyle)),[j,ie]=W(()=>t.userMessageDisplay.borderColor),[ae,oe]=W(null),[se,M]=W(``),ce=fe(),N=t.themes?.find(e=>e.id===ce)||t.themes?.[0],[F,I]=W(`text`),le=[`format`,`styling`,`foreground`,`background`],ue=[`borderStyle`,`borderColor`,`paddingX`,`paddingY`,`fitBoxToContent`],[de,pe]=W(0),[me,he]=W(0),L=F===`text`?le[de]:ue[me],ge=()=>{n(e=>{e.userMessageDisplay.format=l,e.userMessageDisplay.styling=[...C],e.userMessageDisplay.foregroundColor=T===`default`?`default`:E,e.userMessageDisplay.backgroundColor=O===`none`?null:O===`default`?`default`:k,e.userMessageDisplay.borderStyle=Tt[A].value,e.userMessageDisplay.borderColor=j,e.userMessageDisplay.paddingX=d===`default`?`default`:parseInt(h)||0,e.userMessageDisplay.paddingY=p===`default`?`default`:parseInt(_)||0,e.userMessageDisplay.fitBoxToContent=y})},_e=()=>{u(P.userMessageDisplay.format),w([...P.userMessageDisplay.styling]);let e=P.userMessageDisplay.foregroundColor;ee(e===`default`?`default`:`custom`),D(e===`default`?`rgb(255,255,255)`:e);let t=P.userMessageDisplay.backgroundColor;te(t===null?`none`:t===`default`?`default`:`custom`),ne(t===null||t===`default`?`rgb(0,0,0)`:t),re(Tt.findIndex(e=>e.value===P.userMessageDisplay.borderStyle)),ie(P.userMessageDisplay.borderColor);let r=P.userMessageDisplay.paddingX,i=P.userMessageDisplay.paddingY;f(r===`default`?`default`:`custom`),m(i===`default`?`default`:`custom`),g(r===`default`?`0`:String(r)),v(i===`default`?`0`:String(i)),b(P.userMessageDisplay.fitBoxToContent),n(e=>{e.userMessageDisplay={...P.userMessageDisplay}})};Ct(()=>{ge()},[l,C,T,E,O,k,A,j,d,p,h,_,y]),B((n,l)=>{if(r){l.return?i(!1):l.escape?(u(t.userMessageDisplay.format),i(!1)):l.backspace||l.delete?u(e=>e.slice(0,-1)):n&&u(e=>e+n);return}if(a){l.return?o(!1):l.escape?(g(String(t.userMessageDisplay.paddingX)),o(!1)):l.backspace||l.delete?g(e=>e.slice(0,-1)):n&&/^\d$/.test(n)&&g(e=>e+n);return}if(s){l.return?c(!1):l.escape?(v(String(t.userMessageDisplay.paddingY)),c(!1)):l.backspace||l.delete?v(e=>e.slice(0,-1)):n&&/^\d$/.test(n)&&v(e=>e+n);return}if(ae===null){if(l.escape)e();else if(l.ctrl&&n===`r`)_e();else if(l.leftArrow||l.rightArrow)I(e=>e===`text`?`border`:`text`);else if(l.tab)F===`text`?l.shift?pe(e=>e===0?le.length-1:e-1):pe(e=>e===le.length-1?0:e+1):l.shift?he(e=>e===0?ue.length-1:e-1):he(e=>e===ue.length-1?0:e+1);else if(l.return)L===`format`?i(!0):L===`paddingX`?d===`custom`&&o(!0):L===`paddingY`?p===`custom`&&c(!0):L===`foreground`?T===`custom`&&(M(E),oe(`foreground`)):L===`background`?O===`custom`&&(M(k),oe(`background`)):L===`borderColor`&&(M(j),oe(`border`));else if(l.upArrow)L===`styling`?S(e=>Math.max(0,e-1)):L===`borderStyle`?re(e=>e===0?Tt.length-1:e-1):L===`paddingX`?f(e=>e===`default`?`custom`:`default`):L===`paddingY`?m(e=>e===`default`?`custom`:`default`):L===`foreground`?ee(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!E||E===``)&&D(`rgb(255,255,255)`),t}):L===`background`&&te(e=>{let t=e===`default`?`custom`:e===`custom`?`none`:`default`;return t===`custom`&&(!k||k===``)&&ne(`rgb(0,0,0)`),t});else if(l.downArrow)L===`styling`?S(e=>Math.min(wt.length-1,e+1)):L===`borderStyle`?re(e=>e===Tt.length-1?0:e+1):L===`paddingX`?f(e=>e===`default`?`custom`:`default`):L===`paddingY`?m(e=>e===`default`?`custom`:`default`):L===`foreground`?ee(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!E||E===``)&&D(`rgb(255,255,255)`),t}):L===`background`&&te(e=>{let t=e===`default`?`none`:e===`none`?`custom`:`default`;return t===`custom`&&(!k||k===``)&&ne(`rgb(0,0,0)`),t});else if(n===` `)if(L===`styling`){let e=wt[x].value;w(C.indexOf(e)>=0?C.filter(t=>t!==e):[...C,e])}else L===`fitBoxToContent`&&b(e=>!e)}});let ve=e=>{let t=T===`default`?N?.colors?.text:E,n=O===`none`?void 0:O===`default`?N?.colors?.userMessageBackground:k,r=Tt[A].value,i=d===`default`?0:parseInt(h)||0,a=p===`default`?0:parseInt(_)||0,o=d===`default`?1:i,s=J(z,{bold:C.includes(`bold`),italic:C.includes(`italic`),underline:C.includes(`underline`),strikethrough:C.includes(`strikethrough`),inverse:C.includes(`inverse`),color:t,backgroundColor:n,children:e});if(r===`topBottomSingle`||r===`topBottomDouble`||r===`topBottomBold`){let t=r===`topBottomSingle`?`─`:r===`topBottomDouble`?`═`:`━`,n=e.length+i*2,o=t.repeat(n);return Y(R,{flexDirection:`column`,children:[J(z,{color:j,children:o}),a>0&&J(R,{height:a}),J(R,{paddingX:i,children:s}),a>0&&J(R,{height:a}),J(z,{color:j,children:o})]})}else if(r!==`none`||i>0||a>0||o>0||y){let e={};i>0&&(e.paddingX=i),d===`default`&&i===0&&(e.paddingRight=o),a>0&&(e.paddingY=a);let t=Object.keys(e).length>0?J(R,{...e,children:s}):s,n={};return r!==`none`&&(n.borderStyle=r,n.borderColor=j),y?n.alignSelf=`flex-start`:n.flexGrow=1,r===`none`?t:J(R,{...n,children:t})}else return s};return ae?J(it,{initialValue:se,theme:N,onColorChange:e=>{ae===`foreground`?D(e):ae===`background`?ne(e):ae===`border`&&ie(e)},onExit:()=>{oe(null),M(``)}}):Y(R,{flexDirection:`column`,children:[J(X,{children:`Customize how user messages are displayed`}),Y(R,{flexDirection:`column`,marginBottom:1,children:[J(z,{dimColor:!0,children:`left/right arrows to switch columns · tab to navigate options`}),J(z,{dimColor:!0,children:`enter to edit · ctrl+r to reset · esc to go back`})]}),Y(R,{flexDirection:`row`,gap:1,children:[Y(R,{flexDirection:`column`,width:`50%`,borderStyle:F===`text`?`round`:`single`,borderColor:F===`text`?`yellow`:`gray`,paddingX:1,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,color:F===`text`?`yellow`:void 0,children:`Text & Styling`})}),J(R,{children:Y(z,{color:L===`format`?`yellow`:void 0,bold:L===`format`,children:[L===`format`?`❯ `:` `,`Format String`]})}),L===`format`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:r?`enter to save · esc to cancel`:`enter to edit · use {} as message placeholder`})}),J(R,{marginLeft:2,marginBottom:1,children:J(R,{borderStyle:`round`,borderColor:r?`yellow`:`gray`,children:J(z,{children:l})})}),J(R,{children:Y(z,{color:L===`styling`?`yellow`:void 0,bold:L===`styling`,children:[L===`styling`?`❯ `:` `,`Styling`]})}),L===`styling`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:`up/down to navigate · space to toggle`})}),J(R,{marginLeft:2,marginBottom:1,flexDirection:`column`,children:wt.map((e,t)=>J(R,{children:Y(z,{color:L===`styling`&&x===t?`cyan`:void 0,children:[L===`styling`&&x===t?`❯ `:` `,C.includes(e.value)?`●`:`○`,` `,e.label]})},e.value))}),Y(R,{flexDirection:`row`,gap:1,marginBottom:1,children:[Y(R,{flexDirection:`column`,width:`50%`,children:[J(R,{children:Y(z,{color:L===`foreground`?`yellow`:void 0,bold:L===`foreground`,children:[L===`foreground`?`❯ `:` `,`Foreground`]})}),L===`foreground`&&J(R,{marginLeft:2,children:Y(z,{dimColor:!0,children:[`up/down · `,T===`custom`?`enter`:``]})}),Y(R,{marginLeft:2,flexDirection:`column`,children:[J(R,{children:Y(z,{children:[T===`default`?`● `:`○ `,`Default`]})}),J(R,{children:Y(z,{children:[T===`custom`?`● `:`○ `,`Custom`,T===`custom`&&`: `,T===`custom`&&J(z,{color:E,children:E})]})})]})]}),Y(R,{flexDirection:`column`,width:`50%`,children:[J(R,{children:Y(z,{color:L===`background`?`yellow`:void 0,bold:L===`background`,children:[L===`background`?`❯ `:` `,`Background`]})}),L===`background`&&J(R,{marginLeft:2,children:Y(z,{dimColor:!0,children:[`up/down · `,O===`custom`?`enter`:``]})}),Y(R,{marginLeft:2,flexDirection:`column`,children:[J(R,{children:Y(z,{children:[O===`default`?`● `:`○ `,`Default`]})}),J(R,{children:Y(z,{children:[O===`none`?`● `:`○ `,`None`]})}),J(R,{children:Y(z,{children:[O===`custom`?`● `:`○ `,`Custom`,O===`custom`&&`: `,O===`custom`&&J(z,{backgroundColor:k,children:k})]})})]})]})]})]}),Y(R,{flexDirection:`column`,width:`50%`,borderStyle:F===`border`?`round`:`single`,borderColor:F===`border`?`yellow`:`gray`,paddingX:1,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,color:F===`border`?`yellow`:void 0,children:`Border & Padding`})}),J(R,{children:Y(z,{color:L===`borderStyle`?`yellow`:void 0,bold:L===`borderStyle`,children:[L===`borderStyle`?`❯ `:` `,`Border Style`]})}),L===`borderStyle`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:`up/down to navigate`})}),Y(R,{marginLeft:2,marginBottom:1,flexDirection:`row`,children:[J(R,{flexDirection:`column`,width:`50%`,children:Tt.slice(0,6).map((e,t)=>J(R,{children:Y(z,{color:L===`borderStyle`&&A===t?`cyan`:void 0,children:[L===`borderStyle`&&A===t?`❯ `:` `,A===t?`● `:`○ `,e.label]})},e.value))}),J(R,{flexDirection:`column`,width:`50%`,children:Tt.slice(6).map((e,t)=>{let n=t+6;return J(R,{children:Y(z,{color:L===`borderStyle`&&A===n?`cyan`:void 0,children:[L===`borderStyle`&&A===n?`❯ `:` `,A===n?`● `:`○ `,e.label]})},e.value)})})]}),J(R,{children:Y(z,{color:L===`borderColor`?`yellow`:void 0,bold:L===`borderColor`,children:[L===`borderColor`?`❯ `:` `,`Border Color`]})}),L===`borderColor`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:`enter to pick color`})}),J(R,{marginLeft:2,marginBottom:1,children:J(z,{color:j,children:j})}),Y(R,{flexDirection:`row`,gap:1,children:[Y(R,{flexDirection:`column`,width:`33%`,children:[J(R,{children:Y(z,{color:L===`paddingX`?`yellow`:void 0,bold:L===`paddingX`,children:[L===`paddingX`?`❯ `:` `,`Padding X`]})}),L===`paddingX`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:a?`enter/esc`:d===`custom`?`up/down · enter`:`up/down`})}),Y(R,{marginLeft:2,flexDirection:`column`,children:[J(R,{children:Y(z,{children:[d===`default`?`● `:`○ `,`Default`]})}),J(R,{children:Y(z,{children:[d===`custom`?`● `:`○ `,`Custom`]})}),d===`custom`&&J(R,{children:J(R,{borderStyle:`round`,borderColor:a?`yellow`:`gray`,children:J(z,{children:h})})})]})]}),Y(R,{flexDirection:`column`,width:`33%`,children:[J(R,{children:Y(z,{color:L===`paddingY`?`yellow`:void 0,bold:L===`paddingY`,children:[L===`paddingY`?`❯ `:` `,`Padding Y`]})}),L===`paddingY`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:s?`enter/esc`:p===`custom`?`up/down · enter`:`up/down`})}),Y(R,{marginLeft:2,flexDirection:`column`,children:[J(R,{children:Y(z,{children:[p===`default`?`● `:`○ `,`Default`]})}),J(R,{children:Y(z,{children:[p===`custom`?`● `:`○ `,`Custom`]})}),p===`custom`&&J(R,{children:J(R,{borderStyle:`round`,borderColor:s?`yellow`:`gray`,children:J(z,{children:_})})})]})]}),Y(R,{flexDirection:`column`,width:`33%`,children:[J(R,{children:Y(z,{color:L===`fitBoxToContent`?`yellow`:void 0,bold:L===`fitBoxToContent`,children:[L===`fitBoxToContent`?`❯ `:` `,y?`●`:`○`,` Fit box to content`]})}),L===`fitBoxToContent`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:`space`})})]})]})]})]}),Y(R,{flexDirection:`column`,marginTop:1,paddingX:1,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,children:`Preview`})}),Y(R,{flexDirection:`row`,gap:2,children:[Y(R,{flexDirection:`column`,width:`50%`,children:[J(R,{marginBottom:1,children:J(z,{underline:!0,children:`Before (Claude Code default):`})}),J(R,{marginLeft:1,children:Y(z,{backgroundColor:N?.colors?.userMessageBackground,color:N?.colors?.text,children:[` `,`> list the dir`,` `]})}),J(R,{marginLeft:1,marginTop:1,children:Y(z,{children:[J(z,{color:N?.colors?.inactive||`#888888`,children:`●`}),J(z,{children:` The directory `}),J(z,{color:N?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(z,{children:` contains `}),J(z,{bold:!0,children:`123`}),J(z,{children:` files.`})]})})]}),Y(R,{flexDirection:`column`,width:`50%`,children:[J(R,{marginBottom:1,children:J(z,{underline:!0,children:`After (Your customization):`})}),J(R,{marginLeft:1,flexDirection:`row`,children:(()=>ve(l.replace(/\{\}/g,`list the dir`)))()}),J(R,{marginLeft:1,marginTop:1,children:Y(z,{children:[J(z,{color:N?.colors?.inactive||`#888888`,children:`●`}),J(z,{children:` The directory `}),J(z,{color:N?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(z,{children:` contains `}),J(z,{bold:!0,children:`123`}),J(z,{children:` files.`})]})})]})]})]})]})}const Dt=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],Ot=[[`name`,`regex`,`regexFlags`],[`format`,`styling`],[`foreground`,`background`],[`enabled`],[`testText`]];function kt({testText:e,regex:t,regexFlags:n,format:r,styling:i,foregroundColor:a,backgroundColor:o}){let s=[];try{let c=n.includes(`g`)?n:n+`g`,l=new RegExp(t,c),u=[...e.matchAll(l)];if(u.length===0)return J(z,{children:e});let d=0;return u.forEach((t,n)=>{let c=t.index,l=c+t[0].length;c>d&&s.push(J(z,{children:e.slice(d,c)},`plain-${n}`));let u=r.replace(/\{MATCH\}/g,t[0]);s.push(J(z,{bold:i.includes(`bold`),italic:i.includes(`italic`),underline:i.includes(`underline`),strikethrough:i.includes(`strikethrough`),inverse:i.includes(`inverse`),color:a,backgroundColor:o,children:u},`match-${n}`)),d=l}),d<e.length&&s.push(J(z,{children:e.slice(d)},`plain-end`)),J(q,{children:s})}catch{return J(z,{children:e})}}function At({highlighterIndex:e,onBack:t}){let{settings:n,updateSettings:r}=H($),i=n.inputPatternHighlighters[e],a=fe(),o=n.themes?.find(e=>e.id===a)||n.themes?.[0],[s,c]=W(i?.name||`New Highlighter`),[l,u]=W(i?.regex||``),[d,f]=W(i?.regexFlags||`g`),[p,m]=W(i?.format||`{MATCH}`),[h,g]=W(i?.styling||[]),[_,v]=W(i?.foregroundColor===null?`none`:`custom`),[y,b]=W(i?.foregroundColor||`rgb(255,0,255)`),[x,S]=W(i?.backgroundColor?`custom`:`none`),[C,w]=W(i?.backgroundColor||`rgb(0,0,0)`),[T,ee]=W(i?.enabled??!0),[E,D]=W(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),[O,te]=W(`name`),[k,ne]=W(!1),[A,re]=W(0),[j,ie]=W(null),[ae,oe]=W(``),[se,M]=W(null),[ce,N]=W(0),[P,F]=W(0);if(U(()=>{let e=Ot[ce];te(e[Math.min(P,e.length-1)])},[ce,P]),U(()=>{if(!l){M(null);return}try{new RegExp(l,d),M(null)}catch(e){M(e.message)}},[l,d]),U(()=>{e>=0&&r(t=>{t.inputPatternHighlighters[e]&&(t.inputPatternHighlighters[e]={name:s,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:null,backgroundColor:x===`custom`?C:null,enabled:T})})},[e,s,l,d,p,h,_,y,x,C,T]),U(()=>{r(e=>{e.inputPatternHighlightersTestText=E})},[E]),B((e,r)=>{if(k){r.return?ne(!1):r.escape?(O===`name`&&c(i?.name||``),O===`regex`&&u(i?.regex||``),O===`regexFlags`&&f(i?.regexFlags||`g`),O===`format`&&m(i?.format||`{MATCH}`),O===`testText`&&D(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),ne(!1)):r.backspace||r.delete?(O===`name`&&c(e=>e.slice(0,-1)),O===`regex`&&u(e=>e.slice(0,-1)),O===`regexFlags`&&f(e=>e.slice(0,-1)),O===`format`&&m(e=>e.slice(0,-1)),O===`testText`&&D(e=>e.slice(0,-1))):e&&e.length===1&&(O===`name`&&c(t=>t+e),O===`regex`&&u(t=>t+e),O===`regexFlags`&&f(t=>t+e),O===`format`&&m(t=>t+e),O===`testText`&&D(t=>t+e));return}if(j===null){if(r.escape)t();else if(r.upArrow)O===`styling`&&A>0?re(e=>e-1):N(e=>Math.max(0,e-1));else if(r.downArrow)O===`styling`&&A<Dt.length-1?re(e=>e+1):N(e=>Math.min(Ot.length-1,e+1));else if(r.leftArrow)O===`foreground`?v(e=>e===`none`?`custom`:`none`):O===`background`?S(e=>e===`none`?`custom`:`none`):F(e=>Math.max(0,e-1));else if(r.rightArrow)if(O===`foreground`)v(e=>e===`none`?`custom`:`none`);else if(O===`background`)S(e=>e===`none`?`custom`:`none`);else{let e=Ot[ce].length-1;F(t=>Math.min(e,t+1))}else if(r.tab){let e=Ot.flat(),t=e.indexOf(O);if(r.shift){if(t>0){let n=e[t-1];for(let e=0;e<Ot.length;e++){let t=Ot[e].indexOf(n);if(t>=0){N(e),F(t);break}}}}else if(t<e.length-1){let n=e[t+1];for(let e=0;e<Ot.length;e++){let t=Ot[e].indexOf(n);if(t>=0){N(e),F(t);break}}}}else if(r.return)O===`name`||O===`regex`||O===`regexFlags`||O===`format`||O===`testText`?ne(!0):O===`foreground`&&_===`custom`?(oe(y),ie(`foreground`)):O===`background`&&x===`custom`&&(oe(C),ie(`background`));else if(e===` `)if(O===`styling`){let e=Dt[A].value;h.includes(e)?g(h.filter(t=>t!==e)):g([...h,e])}else O===`enabled`&&ee(!T)}}),!i)return J(R,{flexDirection:`column`,children:J(z,{color:`red`,children:`Highlighter not found`})});if(j)return J(it,{initialValue:ae,theme:o,onColorChange:e=>{j===`foreground`?b(e):j===`background`&&w(e)},onExit:()=>{ie(null),oe(``)}});let I=e=>O===e,le=e=>({color:I(e)?`yellow`:void 0,bold:I(e)});return Y(R,{flexDirection:`column`,children:[J(X,{children:`Edit Highlighter`}),J(R,{marginBottom:1,flexDirection:`column`,children:J(z,{dimColor:!0,children:`arrows to navigate · enter to edit · space to toggle · esc to go back`})}),Y(R,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(R,{flexDirection:`column`,width:`30%`,children:[Y(z,{...le(`name`),children:[I(`name`)?`❯ `:` `,`Name`]}),J(R,{marginLeft:2,children:J(R,{borderStyle:`round`,borderColor:I(`name`)?k?`green`:`yellow`:`gray`,children:J(z,{children:s||`(empty)`})})})]}),Y(R,{flexDirection:`column`,width:`45%`,children:[Y(z,{...le(`regex`),children:[I(`regex`)?`❯ `:` `,`Regex Pattern`]}),Y(R,{marginLeft:2,flexDirection:`column`,children:[J(R,{borderStyle:`round`,borderColor:I(`regex`)?k?`green`:`yellow`:se?`red`:`gray`,children:J(z,{children:l||`(empty)`})}),se&&J(z,{color:`red`,children:se})]})]}),Y(R,{flexDirection:`column`,width:`20%`,children:[Y(z,{...le(`regexFlags`),children:[I(`regexFlags`)?`❯ `:` `,`Flags`]}),J(R,{marginLeft:2,children:J(R,{borderStyle:`round`,borderColor:I(`regexFlags`)?k?`green`:`yellow`:`gray`,children:J(z,{children:d||`g`})})})]})]}),Y(R,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(R,{flexDirection:`column`,width:`50%`,children:[Y(z,{...le(`format`),children:[I(`format`)?`❯ `:` `,`Format String`]}),J(R,{marginLeft:2,children:J(R,{borderStyle:`round`,borderColor:I(`format`)?k?`green`:`yellow`:`gray`,children:J(z,{children:p||`{MATCH}`})})}),I(`format`)&&J(R,{marginLeft:2,children:Y(z,{dimColor:!0,children:[`use `,`{MATCH}`,` as placeholder`]})})]}),Y(R,{flexDirection:`column`,width:`45%`,children:[Y(z,{...le(`styling`),children:[I(`styling`)?`❯ `:` `,`Styling`]}),J(R,{marginLeft:2,flexDirection:`column`,children:Dt.map((e,t)=>{let n=h.includes(e.value),r=I(`styling`)&&A===t;return Y(z,{color:r?`cyan`:void 0,children:[r?`❯ `:` `,n?`●`:`○`,` `,e.label]},e.value)})})]})]}),Y(R,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(R,{flexDirection:`column`,width:`48%`,children:[Y(z,{...le(`foreground`),children:[I(`foreground`)?`❯ `:` `,`Foreground Color`]}),Y(R,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(z,{color:I(`foreground`)?`yellow`:void 0,children:[`[`,_===`none`?`●`:`○`,`] none`,` `,`[`,_===`custom`?`●`:`○`,`] custom`]}),_===`custom`&&J(R,{borderStyle:`round`,borderColor:I(`foreground`)?`yellow`:`gray`,children:J(z,{color:y,children:` ████ `})})]})]}),Y(R,{flexDirection:`column`,width:`48%`,children:[Y(z,{...le(`background`),children:[I(`background`)?`❯ `:` `,`Background Color`]}),Y(R,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(z,{color:I(`background`)?`yellow`:void 0,children:[`[`,x===`none`?`●`:`○`,`] none`,` `,`[`,x===`custom`?`●`:`○`,`] custom`]}),x===`custom`&&J(R,{borderStyle:`round`,borderColor:I(`background`)?`yellow`:`gray`,children:Y(z,{backgroundColor:C,children:[` `,` `,` `]})})]})]})]}),J(R,{marginBottom:1,children:Y(z,{...le(`enabled`),children:[I(`enabled`)?`❯ `:` `,`Enabled:`,` `,J(z,{color:T?`green`:`red`,children:T?`● Yes`:`○ No`})]})}),Y(R,{flexDirection:`column`,marginBottom:1,children:[Y(z,{...le(`testText`),children:[I(`testText`)?`❯ `:` `,`Test Text`]}),J(R,{marginLeft:2,children:J(R,{borderStyle:`round`,borderColor:I(`testText`)?k?`green`:`yellow`:`gray`,children:J(z,{children:E||`(empty)`})})})]}),J(R,{borderStyle:`round`,padding:1,children:Y(R,{flexDirection:`column`,children:[J(z,{bold:!0,children:`Live Preview:`}),l?J(R,{marginTop:1,children:J(kt,{testText:E,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:void 0,backgroundColor:x===`custom`?C:void 0})}):J(z,{dimColor:!0,children:`Enter a regex pattern to see the preview`})]})})]})}function jt({onBack:e}){let{settings:{inputPatternHighlighters:t,themes:n},updateSettings:r}=H($),i=fe(),a=n.find(e=>e.id===i)||n[0],o=P.themes[0],s=a?.colors.success||o.colors.success,c=a?.colors.error||o.colors.error,[l,u]=W(0),[d,f]=W(null),[p,m]=W(!0),h=()=>{let e={name:`New Highlighter`,regex:``,regexFlags:`g`,format:`{MATCH}`,styling:[],foregroundColor:`rgb(255,0,255)`,backgroundColor:null,enabled:!0};r(t=>{t.inputPatternHighlighters.push(e)}),f(t.length),m(!1)},g=e=>{r(t=>{t.inputPatternHighlighters.splice(e,1)}),l>=t.length-1&&u(Math.max(0,t.length-2))},_=e=>{r(t=>{t.inputPatternHighlighters[e].enabled=!t.inputPatternHighlighters[e].enabled})},v=e=>{e<=0||(r(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e-1,0,n)}),u(e-1))},y=e=>{e>=t.length-1||(r(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e+1,0,n)}),u(e+1))};return B((n,r)=>{r.escape?e():r.upArrow?u(e=>Math.max(0,e-1)):r.downArrow&&t.length>0?u(e=>Math.min(t.length-1,e+1)):r.return&&t.length>0?(f(l),m(!1)):n===`n`?h():n===`x`&&t.length>0?g(l):n===` `&&t.length>0?_(l):n===`u`&&t.length>0&&l>0?v(l):n===`d`&&t.length>0&&l<t.length-1&&y(l)},{isActive:p}),d===null?Y(R,{flexDirection:`column`,children:[J(X,{children:`Input Pattern Highlighters`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`Create custom highlighters for patterns in your input prompt.`}),J(z,{dimColor:!0,children:`Matched text will be styled and optionally reformatted.`})]}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`n to create a new highlighter`}),t.length>0&&J(z,{dimColor:!0,children:`space to toggle enabled/disabled`}),t.length>0&&J(z,{dimColor:!0,children:`u/d to move highlighter up/down`}),t.length>0&&J(z,{dimColor:!0,children:`x to delete a highlighter`}),t.length>0&&J(z,{dimColor:!0,children:`enter to edit highlighter`}),J(z,{dimColor:!0,children:`esc to go back`})]}),t.length===0?J(z,{children:`No highlighters created yet. Press n to create one.`}):J(R,{flexDirection:`column`,children:t.map((e,t)=>{let n=l===t,r;return n&&(r=`yellow`),Y(R,{flexDirection:`row`,children:[Y(z,{color:r,children:[n?`❯ `:` `,e.enabled?`● `:`○ `,e.name,` `]}),J(z,{dimColor:!0,children:`(`}),e.regex?Y(z,{dimColor:!0,children:[`/`,e.regex,`/`,e.regexFlags]}):J(z,{dimColor:!0,children:`(no regex)`}),e.styling.length>0&&J(q,{children:Y(z,{color:r,dimColor:!e.enabled,children:[` `,`· `,e.styling.join(`, `)]})}),J(z,{dimColor:!0,children:`)`}),e.enabled?J(z,{color:s,children:` enabled`}):J(z,{color:c,children:` disabled`})]},t)})})]}):J(At,{highlighterIndex:d,onBack:()=>{f(null),m(!0)}})}const Mt=[null,1,5,10,25,50,100,200,250,500,1e3],Nt=1e3;function Pt({onSubmit:e}){let{settings:t,updateSettings:n}=H($),[r,i]=W(0),[a,o]=W(!1),s={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEdit:!1,hideStartupClawd:!1,increaseFileReadLimit:!1,suppressLineNumbers:!1,suppressRateLimitOptions:!1,mcpConnectionNonBlocking:!0,mcpServerBatchSize:null,statuslineThrottleMs:null,statuslineUseFixedInterval:!1,tableFormat:`default`,enableSessionMemory:!0,enableDreamMode:!0,enableLeanMemoryTypes:!1,fixSummarizeFromHere:!0,fixRewindSummaryHeader:!0,enableRememberSkill:!1,tokenCountRounding:null,autoAcceptPlanMode:!1,allowBypassPermissionsInSudo:!1,suppressNativeInstallerWarning:!1,filterScrollEscapeSequences:!1,enableWorktreeMode:!0,swapRipgrepForFff:!1,allowCustomAgentModels:!1,enableContextLimitOverride:!1,enableModelCustomizations:!0,enableVoiceMode:!1,enableVoiceConciseOutput:!0,enableChannelsMode:!1,maxEffortDefault:!1,autonomousOperationAllModels:!1,adhdOutputStyle:!1,autoModeClassifierModel:`default`,suppressDeferredTools:!1,claudemdContextOncePerConversation:!0},c=()=>{t.misc||={...s}},l=e=>{let t=[`default`,`sonnet`,`haiku`];return t[(t.indexOf(e)+1)%t.length]},u=e=>{switch(e){case`sonnet`:return`Sonnet 4.6`;case`haiku`:return`Haiku 4.5`;case`default`:default:return`Default (main-loop model)`}},d=e=>{let t=[`default`,`ascii`,`clean`,`clean-top-bottom`];return t[(t.indexOf(e)+1)%t.length]},f=e=>{switch(e){case`ascii`:return`ASCII (| and -)`;case`clean`:return`Clean (no row separators)`;case`clean-top-bottom`:return`Clean with top/bottom`;case`default`:default:return`Default (box-drawing)`}},p=e=>e===null?`Default (3)`:e<=3?`${e} (conservative)`:e<=8?`${e} (recommended)`:`${e} (aggressive)`,m=e=>e===null?`Disabled`:e===0?`0ms (instant)`:`${e}ms`,h=e=>e===null?`Off (exact counts)`:`Round to ${e}`,g=(e,t)=>{let n=Mt.indexOf(e);if(n===-1)return Mt[0];let r;return r=t===`next`?(n+1)%Mt.length:(n-1+Mt.length)%Mt.length,Mt[r]},_=Ae(()=>[{id:`removeBorder`,title:`Remove input box border`,description:`Removes the rounded border around the input box for a cleaner look.`,getValue:()=>t.inputBox?.removeBorder??!1,toggle:()=>{n(e=>{e.inputBox||={removeBorder:!1},e.inputBox.removeBorder=!e.inputBox.removeBorder})}},{id:`showVersion`,title:`Show tweakcc version at startup`,description:`Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.`,getValue:()=>t.misc?.showTweakccVersion??!0,toggle:()=>{n(e=>{c(),e.misc.showTweakccVersion=!e.misc.showTweakccVersion})}},{id:`showPatches`,title:`Show patches applied indicator at startup`,description:`Shows the green "tweakcc patches are applied" indicator when starting Claude Code.`,getValue:()=>t.misc?.showPatchesApplied??!0,toggle:()=>{n(e=>{c(),e.misc.showPatchesApplied=!e.misc.showPatchesApplied})}},{id:`expandThinking`,title:`Expand thinking blocks`,description:`Makes thinking blocks always expanded by default instead of collapsed.`,getValue:()=>t.misc?.expandThinkingBlocks??!0,toggle:()=>{n(e=>{c(),e.misc.expandThinkingBlocks=!e.misc.expandThinkingBlocks})}},{id:`conversationTitle`,title:`Allow renaming sessions via /title`,description:`Enables /title and /rename commands for manually naming conversations.`,getValue:()=>t.misc?.enableConversationTitle??!0,toggle:()=>{n(e=>{c(),e.misc.enableConversationTitle=!e.misc.enableConversationTitle})}},{id:`enableModelCustomizations`,title:`Enable model customizations (/model shows all models)`,description:`Show all Claude models in /model menu, not just the latest 3. Disable to use Claude Code default model list.`,getValue:()=>t.misc?.enableModelCustomizations??!0,toggle:()=>{n(e=>{c(),e.misc.enableModelCustomizations=!e.misc.enableModelCustomizations})}},{id:`hideStartupBanner`,title:`Hide startup banner`,description:`Hides the startup banner message displayed before first prompt.`,getValue:()=>t.misc?.hideStartupBanner??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupBanner=!e.misc.hideStartupBanner})}},{id:`hideCtrlG`,title:`Hide ctrl-g to edit prompt hint`,description:`Hides the "ctrl-g to edit prompt" hint shown during streaming.`,getValue:()=>t.misc?.hideCtrlGToEdit??!1,toggle:()=>{n(e=>{c(),e.misc.hideCtrlGToEdit=!e.misc.hideCtrlGToEdit})}},{id:`hideClawd`,title:`Hide startup Clawd ASCII art`,description:`Hides the Clawd ASCII art character shown at startup.`,getValue:()=>t.misc?.hideStartupClawd??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupClawd=!e.misc.hideStartupClawd})}},{id:`increaseFileReadLimit`,title:`Increase file read token limit`,description:`Increases the maximum file read limit from 25,000 to 1,000,000 tokens.`,getValue:()=>t.misc?.increaseFileReadLimit??!1,toggle:()=>{n(e=>{c(),e.misc.increaseFileReadLimit=!e.misc.increaseFileReadLimit})}},{id:`suppressLineNumbers`,title:`Suppress line numbers in file reads/edits`,description:`Removes line number prefixes from file content to reduce token usage.`,getValue:()=>t.misc?.suppressLineNumbers??!1,toggle:()=>{n(e=>{c(),e.misc.suppressLineNumbers=!e.misc.suppressLineNumbers})}},{id:`suppressRateLimitOptions`,title:`Suppress rate limit options popup`,description:`Prevents the automatic /rate-limit-options command from being triggered when hitting rate limits.`,getValue:()=>t.misc?.suppressRateLimitOptions??!1,toggle:()=>{n(e=>{c(),e.misc.suppressRateLimitOptions=!e.misc.suppressRateLimitOptions})}},{id:`mcpNonBlocking`,title:`Non-blocking MCP startup`,description:`Start immediately while MCP servers connect in background. Reduces startup time ~50% with multiple MCPs.`,getValue:()=>t.misc?.mcpConnectionNonBlocking??!0,toggle:()=>{n(e=>{c(),e.misc.mcpConnectionNonBlocking=!e.misc.mcpConnectionNonBlocking})}},{id:`mcpBatchSize`,title:`MCP server batch size`,description:`Parallel MCP connections (1-20). Use ←/→ to adjust. Higher = faster startup, more resources.`,getValue:()=>t.misc?.mcpServerBatchSize??null,getDisplayValue:()=>p(t.misc?.mcpServerBatchSize??null),toggle:()=>{n(e=>{c(),e.misc.mcpServerBatchSize=null})},increment:()=>{n(e=>{c();let t=e.misc.mcpServerBatchSize??3;e.misc.mcpServerBatchSize=Math.min(20,t+1)})},decrement:()=>{n(e=>{c();let t=(e.misc.mcpServerBatchSize??3)-1;e.misc.mcpServerBatchSize=t<1?null:t})}},{id:`tableFormat`,title:`Table output format`,description:`Controls how Claude formats tables. Default: full borders. ASCII: | and -. Clean: no top/bottom/row separators. Clean+top/bottom: borders but no row separators.`,getValue:()=>t.misc?.tableFormat??`default`,isMultiValue:!0,getDisplayValue:()=>f(t.misc?.tableFormat??`default`),toggle:()=>{n(e=>{c(),e.misc.tableFormat=d(e.misc.tableFormat??`default`)})}},{id:`enableWorktreeMode`,title:`Enable worktree mode (EnterWorktree tool)`,description:`Force-enable the EnterWorktree tool for isolated git worktree sessions by bypassing the tengu_worktree_mode feature flag.`,getValue:()=>t.misc?.enableWorktreeMode??!0,toggle:()=>{n(e=>{c(),e.misc.enableWorktreeMode=!e.misc.enableWorktreeMode})}},{id:`swapRipgrepForFff`,title:`[EXPERIMENTAL] fff for Bash search (grep/find/rg -> fff)`,description:`Route Claude Code's Bash search through fff. CC shadows the shell grep->embedded ugrep and find->embedded bfs (and offers rg); the agent uses grep far more than rg. This repoints all three at a per-platform fff wrapper that serves (relevance-ranked, warm-index daemon): literal, regex (RE2, the dialect the model writes), -i, multi-word phrases, context (-A/-B/-C), extension globs (-g/--include '*.ts'), and multi-path (app lib scripts). Anything fff can't serve faithfully (PCRE, multiline/newline/empty regex, -o, single-file, non-recursive grep, --no-ignore, find, non-ASCII, lines over 512 bytes, piped stdin) -> re-exec the real embedded ugrep/bfs/ripgrep. Every engine still ships; any uncertainty falls back, so results never diverge from intent. Transparent (no prompt-compliance reliance), CC-scoped (your own terminal grep/find/rg are untouched). Installs the wrapper into ~/.tweakcc/fff.`,getValue:()=>t.misc?.swapRipgrepForFff??!1,toggle:()=>{n(e=>{c(),e.misc.swapRipgrepForFff=!e.misc.swapRipgrepForFff})}},{id:`enableVoiceMode`,title:`Enable voice mode (/voice command)`,description:`Force-enable the /voice command by bypassing the tengu_amber_quartz feature gate.`,getValue:()=>t.misc?.enableVoiceMode??!1,toggle:()=>{n(e=>{c(),e.misc.enableVoiceMode=!e.misc.enableVoiceMode})}},{id:`enableVoiceConciseOutput`,title:`Enable concise output for voice mode`,description:`Enable the concise-output prompt used for voice interactions. Only applies when voice mode is enabled.`,getValue:()=>t.misc?.enableVoiceConciseOutput??!0,toggle:()=>{n(e=>{c(),e.misc.enableVoiceConciseOutput=!e.misc.enableVoiceConciseOutput})}},{id:`enableChannelsMode`,title:`Enable channels mode (MCP channel notifications)`,description:`Force-enable MCP channel notifications by bypassing the tengu_harbor feature gate, allowlist, and permission relay.`,getValue:()=>t.misc?.enableChannelsMode??!1,toggle:()=>{n(e=>{c(),e.misc.enableChannelsMode=!e.misc.enableChannelsMode})}},{id:`enableContextLimitOverride`,title:`Override context limit`,description:`Replaces the default model context limit with CLAUDE_CODE_CONTEXT_LIMIT env var. Must be exported manually before launching CC, or falls back to 200K.`,getValue:()=>t.misc?.enableContextLimitOverride??!1,toggle:()=>{n(e=>{c(),e.misc.enableContextLimitOverride=!e.misc.enableContextLimitOverride})}},{id:`statuslineThrottle`,title:`Statusline throttle`,description:`Throttle statusline updates (0-${Nt}ms). Use ←/→ to adjust by 50ms. Space to disable. 0 = instant updates.`,getValue:()=>t.misc?.statuslineThrottleMs??null,getDisplayValue:()=>m(t.misc?.statuslineThrottleMs??null),toggle:()=>{n(e=>{c(),e.misc.statuslineThrottleMs=e.misc.statuslineThrottleMs===null?300:null})},increment:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.min(Nt,t+50)})},decrement:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.max(0,t-50)})}},{id:`statuslineFixedInterval`,title:`Statusline fixed interval mode`,description:`Use setInterval instead of throttle. Updates happen on a fixed schedule rather than on-demand.`,getValue:()=>t.misc?.statuslineUseFixedInterval??!1,toggle:()=>{n(e=>{c(),e.misc.statuslineUseFixedInterval=!e.misc.statuslineUseFixedInterval})}},{id:`enableSessionMemory`,title:`Enable session memory`,description:`Force-enable session memory (auto-extraction + past session search) by bypassing the tengu_session_memory and tengu_coral_fern statsig flags.`,getValue:()=>t.misc?.enableSessionMemory??!0,toggle:()=>{n(e=>{c(),e.misc.enableSessionMemory=!e.misc.enableSessionMemory})}},{id:`enableDreamMode`,title:`Enable dream mode`,description:`Force-enable dream (/dream + auto-dream background memory consolidation) by bypassing the tengu_onyx_plover statsig gate. On/off still follows autoDreamEnabled in ~/.claude/settings.json.`,getValue:()=>t.misc?.enableDreamMode??!0,toggle:()=>{n(e=>{c(),e.misc.enableDreamMode=!e.misc.enableDreamMode})}},{id:`fixSummarizeFromHere`,title:`Fix "Summarize from here"`,description:`Make "Summarize from here" summarize only the messages after the rewind point instead of the whole conversation.`,getValue:()=>t.misc?.fixSummarizeFromHere??!0,toggle:()=>{n(e=>{c(),e.misc.fixSummarizeFromHere=!(e.misc.fixSummarizeFromHere??!0)})}},{id:`fixRewindSummaryHeader`,title:`Honest rewind summary header`,description:`Label a rewind summary as a deliberate rewind (you continued forward, then rewound and chose to carry the summary forward) instead of the misleading "ran out of context" header.`,getValue:()=>t.misc?.fixRewindSummaryHeader??!0,toggle:()=>{n(e=>{c(),e.misc.fixRewindSummaryHeader=!(e.misc.fixRewindSummaryHeader??!0)})}},{id:`enableLeanMemoryTypes`,title:`Enable lean memory types`,description:`Force the tengu_ochre_finch statsig gate: memory prompts carry a compact "Types of memory" list and the full taxonomy moves to the on-demand memory-types skill.`,getValue:()=>t.misc?.enableLeanMemoryTypes??!1,toggle:()=>{n(e=>{c(),e.misc.enableLeanMemoryTypes=!e.misc.enableLeanMemoryTypes})}},{id:`enableRememberSkill`,title:`Enable remember skill`,description:`Register a "remember" skill to review session memories and update CLAUDE.local.md with learnings from past sessions.`,getValue:()=>t.misc?.enableRememberSkill??!1,toggle:()=>{n(e=>{c(),e.misc.enableRememberSkill=!e.misc.enableRememberSkill})}},{id:`tokenCountRounding`,title:`Token count rounding`,description:`Round displayed token counts to nearest multiple. Use ←/→ to cycle: Off, 1, 5, 10, 25, 50, 100, 200, 250, 500, 1000.`,getValue:()=>t.misc?.tokenCountRounding??null,getDisplayValue:()=>h(t.misc?.tokenCountRounding??null),toggle:()=>{n(e=>{c(),e.misc.tokenCountRounding=null})},increment:()=>{n(e=>{c(),e.misc.tokenCountRounding=g(e.misc.tokenCountRounding??null,`next`)})},decrement:()=>{n(e=>{c(),e.misc.tokenCountRounding=g(e.misc.tokenCountRounding??null,`prev`)})}},{id:`autoAcceptPlanMode`,title:`Auto-accept plan mode`,description:`Automatically accept plans without the "Ready to code?" confirmation prompt.`,getValue:()=>t.misc?.autoAcceptPlanMode??!1,toggle:()=>{n(e=>{c(),e.misc.autoAcceptPlanMode=!e.misc.autoAcceptPlanMode})}},{id:`allowBypassPermissionsInSudo`,title:`Allow bypassing permissions in sudo`,description:`⚠️ WARNING: Disables a security check. When enabled, Claude can perform system-level operations without prompts. Use extreme caution.`,getValue:()=>t.misc?.allowBypassPermissionsInSudo??!1,toggle:()=>{t.misc?.allowBypassPermissionsInSudo??!1?n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!1}):o(!0)}},{id:`suppressNativeInstallerWarning`,title:`Suppress native installer warning`,description:`Suppress the native installer warning message at startup.`,getValue:()=>t.misc?.suppressNativeInstallerWarning??!1,toggle:()=>{n(e=>{c(),e.misc.suppressNativeInstallerWarning=!e.misc.suppressNativeInstallerWarning})}},{id:`filterScrollEscapeSequences`,title:`Filter scroll escape sequences`,description:`Filter out terminal escape sequences that cause unwanted scrolling.`,getValue:()=>t.misc?.filterScrollEscapeSequences??!1,toggle:()=>{n(e=>{c(),e.misc.filterScrollEscapeSequences=!e.misc.filterScrollEscapeSequences})}},{id:`allowCustomAgentModels`,title:`Allow custom agent models`,description:`Allow arbitrary model names in custom agent frontmatter (e.g. gemini-2.5-flash). Useful with a local proxy for non-Claude models.`,getValue:()=>t.misc?.allowCustomAgentModels??!1,toggle:()=>{n(e=>{c(),e.misc.allowCustomAgentModels=!e.misc.allowCustomAgentModels})}},{id:`maxEffortDefault`,title:`Default Opus 4.7 to max effort`,description:`Patches CC so Opus 4.7 sessions default to "max" reasoning effort instead of "xhigh". /effort and CLAUDE_CODE_EFFORT_LEVEL still override at runtime.`,getValue:()=>t.misc?.maxEffortDefault??!1,toggle:()=>{n(e=>{c(),e.misc.maxEffortDefault=!e.misc.maxEffortDefault})}},{id:`autonomousOperationAllModels`,title:`Fable/Mythos prompt set (all models)`,description:`Treats your selected model as Fable/Mythos everywhere CC branches on model family (flips the zQ gate). You get: the autonomous-operation prompt ("proceed without asking for reversible in-scope work, finish the job before ending your turn"); the "# Communicating with the user" comms block in place of "# Text output"; /loop dynamic-pacing turn behavior; and brief-mode comms shaping. Per-model feature-flag routing follows fable too, but is inert on a local install (those flags default off without a live gate service).`,getValue:()=>t.misc?.autonomousOperationAllModels??!1,toggle:()=>{n(e=>{c(),e.misc.autonomousOperationAllModels=!e.misc.autonomousOperationAllModels})}},{id:`adhdOutputStyle`,title:`ADHD-friendly output style`,description:`Rewrites the always-on "# Communicating with the user" prompt for skim-first reading: answer in the first line, bold the key terms, three-sentence blocks, and a soft "usually under 120 words" anchor (soft, not a hard cap: Anthropic measured a 3% eval drop from hard caps and reverted them). Removes the three clauses that drive Claude-speak: the "load-bearing" update cue, the "readable matters more" ranking, and the "in prose, not headers and sections" rule. Also restates the shape rule in the per-turn CLAUDE.md reminder, where recency makes it stick, and drops that reminder's "may or may not be relevant" hedge.`,getValue:()=>t.misc?.adhdOutputStyle??!1,toggle:()=>{n(e=>{c(),e.misc.adhdOutputStyle=!e.misc.adhdOutputStyle})}},{id:`autoModeClassifierModel`,title:`Auto-mode classifier model`,description:`Pin auto-mode bash safety classifier to a fixed model. Default routes to your main-loop model (e.g. Opus 4.7), which gets denied as "temporarily unavailable" when that model is congested. Sonnet/Haiku have more headroom and the binary XML classifier task fits either.`,getValue:()=>t.misc?.autoModeClassifierModel??`default`,getDisplayValue:()=>u(t.misc?.autoModeClassifierModel??`default`),toggle:()=>{n(e=>{c(),e.misc.autoModeClassifierModel=l(e.misc.autoModeClassifierModel??`default`)})}}],[t,n]),v=_.length,y=v-1,b=Ae(()=>r<4?0:Math.min(r-4+1,v-4),[r,v]),x=_.slice(b,b+4),S=b>0,C=b+4<v;return B((t,s)=>{a?s.return?(n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!0}),o(!1)):s.escape&&o(!1):s.return||s.escape?e():s.upArrow?i(e=>Math.max(0,e-1)):s.downArrow?i(e=>Math.min(y,e+1)):t===` `?_[r]?.toggle():s.rightArrow?_[r]?.increment?.():s.leftArrow&&_[r]?.decrement?.()}),J(R,{flexDirection:`column`,children:a?J(R,{flexDirection:`column`,paddingX:2,children:Y(R,{borderStyle:`double`,borderColor:`yellow`,padding:2,flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,color:`yellow`,children:`SECURITY WARNING`})}),J(R,{marginBottom:1,children:J(z,{children:`You are about to enable a feature that allows Claude Code to bypass permission checks when running with sudo privileges.`})}),J(R,{marginBottom:1,children:J(z,{color:`red`,children:`This means Claude can perform system-level operations without any prompts or confirmation.`})}),J(R,{marginBottom:1,children:J(z,{bold:!0,children:`Use with extreme caution.`})}),J(R,{children:Y(z,{children:[`Press `,J(z,{color:`red`,children:`Enter`}),` to enable,`,` `,J(z,{color:`green`,children:`Escape`}),` to cancel`]})})]})}):Y(q,{children:[J(R,{marginBottom:1,children:J(X,{children:`Miscellaneous Settings`})}),J(R,{marginBottom:1,children:J(z,{dimColor:!0,children:`Use ↑/↓ to navigate, space to toggle, ←/→ to adjust numbers, enter to go back.`})}),S&&J(R,{children:Y(z,{dimColor:!0,children:[` ↑ `,b,` more above`]})}),x.map((e,t)=>{let n=b+t===r,i=e.getValue(),a=!!e.getDisplayValue,o=!!e.increment,s;s=o?`◆`:a?`◉`:i?`☑`:`☐`;let c;c=a?e.getDisplayValue():typeof i==`boolean`?i?`Enabled`:`Disabled`:String(i??`Default`);let l=n&&o?` ← → `:``;return Y(R,{flexDirection:`column`,children:[J(R,{children:Y(z,{children:[J(z,{color:n?`cyan`:void 0,children:n?`❯ `:` `}),J(z,{bold:!0,color:n?`cyan`:void 0,children:e.title})]})}),J(R,{children:Y(z,{dimColor:!0,children:[` `,e.description]})}),J(R,{marginLeft:4,marginBottom:1,children:Y(z,{children:[s,` `,c,J(z,{dimColor:!0,children:l})]})})]},e.id)}),C&&J(R,{children:Y(z,{dimColor:!0,children:[` `,`↓ `,v-b-4,` more below`]})}),J(R,{marginTop:1,children:Y(z,{dimColor:!0,children:[`Item `,r+1,` of `,v]})})]})})}const Ft=`AgentOutputTool.AskUserQuestion.Bash.BashOutputTool.Edit.EnterPlanMode.ExitPlanMode.Glob.Grep.KillShell.ListMcpResourcesTool.LSP.NotebookEdit.Read.ReadMcpResourceTool.Skill.Task.TaskCreate.TaskGet.TaskList.TaskOutput.TaskStop.TaskUpdate.Teammate.TodoWrite.ToolSearch.WebFetch.WebSearch.Write`.split(`.`);function It({toolsetIndex:e,onBack:t}){let{settings:n,updateSettings:r}=H($),i=n.toolsets[e],[a,o]=W(i?.name||`New Toolset`),[s,c]=W(i?.allowedTools||[]),[l,u]=W(!1),[d,f]=W(0);U(()=>{i&&r(t=>{let n=t.toolsets[e].name;t.toolsets[e].name=a,t.toolsets[e].allowedTools=s,n!==a&&(t.defaultToolset===n&&(t.defaultToolset=a),t.planModeToolset===n&&(t.planModeToolset=a))})},[a,s]);let p=e=>s===`*`?!0:s.includes(e),m=e=>{e===`All`?c(`*`):e===`None`?c([]):s===`*`?c(Ft.filter(t=>t!==e)):s.includes(e)?c(s.filter(t=>t!==e)):c([...s,e])};if(B((e,n)=>{if(l){n.return?(a.trim()||o(i?.name||`New Toolset`),u(!1)):n.escape?(o(i?.name||`New Toolset`),u(!1)):n.backspace||n.delete?o(e=>e.slice(0,-1)):e&&e.length===1&&o(t=>t+e);return}if(n.escape)t();else if(n.upArrow)f(e=>Math.max(0,e-1));else if(n.downArrow)f(e=>Math.min(Ft.length+1,e+1));else if(e===` `||n.return)if(d===0)m(`All`);else if(d===1)m(`None`);else{let e=Ft[d-2];e&&m(e)}else e===`n`&&u(!0)}),!i)return J(R,{flexDirection:`column`,children:J(z,{color:`red`,children:`Toolset not found`})});let h=s===`*`,g=Array.isArray(s)&&s.length===0;return Y(R,{flexDirection:`column`,children:[J(X,{children:`Edit Toolset`}),J(R,{marginBottom:1,flexDirection:`column`,children:J(z,{dimColor:!0,children:`n to edit name · space/enter to toggle · esc to go back`})}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{bold:!0,children:`Name:`}),J(R,{marginLeft:2,children:J(R,{borderStyle:`round`,borderColor:l?`yellow`:`gray`,children:J(z,{children:a})})}),l&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:`enter to save · esc to cancel`})})]}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{bold:!0,children:`Allowed Tools:`}),J(R,{marginLeft:2,children:Y(z,{color:d===0?`cyan`:void 0,children:[d===0?`❯ `:` `,h?`●`:`○`,` All`]})}),J(R,{marginLeft:2,children:Y(z,{color:d===1?`cyan`:void 0,children:[d===1?`❯ `:` `,g?`●`:`○`,` None`]})}),Ft.map((e,t)=>{let n=t+2;return J(R,{marginLeft:2,children:Y(z,{color:d===n?`cyan`:void 0,children:[d===n?`❯ `:` `,p(e)?`◉`:`○`,` `,e]})},e)})]}),J(R,{borderStyle:`round`,padding:1,marginTop:1,children:Y(R,{flexDirection:`column`,children:[J(z,{bold:!0,children:`Summary:`}),Y(z,{children:[`Name: `,J(z,{color:`cyan`,children:a})]}),Y(z,{children:[`Tools:`,` `,s===`*`?J(z,{color:`green`,children:`All tools (*)`}):s.length===0?J(z,{color:`red`,children:`No tools ([])`}):Y(z,{color:`yellow`,children:[s.length,` selected`]})]})]})})]})}function Lt({onBack:e}){let{settings:{toolsets:t,defaultToolset:n,planModeToolset:r,themes:i},updateSettings:a}=H($),o=fe(),s=i.find(e=>e.id===o)||i[0],c=P.themes[0],l=s?.colors.planMode||c.colors.planMode,u=s?.colors.autoAccept||c.colors.autoAccept,[d,f]=W(0),[p,m]=W(null),[h,g]=W(!0),_=()=>{let e={name:`New Toolset`,allowedTools:[]};a(t=>{t.toolsets.push(e)}),m(t.length),g(!1)},v=e=>{let n=t[e];a(t=>{t.toolsets.splice(e,1),t.defaultToolset===n.name&&(t.defaultToolset=null),t.planModeToolset===n.name&&(t.planModeToolset=null)}),d>=t.length-1&&f(Math.max(0,t.length-2))},y=e=>{let n=t[e];a(e=>{e.defaultToolset=n.name})},b=e=>{let n=t[e];a(e=>{e.planModeToolset=n.name})};if(B((n,r)=>{r.escape?e():r.upArrow?f(e=>Math.max(0,e-1)):r.downArrow?f(e=>Math.min(t.length-1,e+1)):r.return&&t.length>0?(m(d),g(!1)):n===`n`?_():n===`x`&&t.length>0?v(d):n===`d`&&t.length>0?y(d):n===`p`&&t.length>0&&b(d)},{isActive:h}),p!==null)return J(It,{toolsetIndex:p,onBack:()=>{m(null),g(!0)}});let x=e=>e.allowedTools===`*`?`All tools`:e.allowedTools.length===0?`No tools`:`${e.allowedTools.length} tool${e.allowedTools.length===1?``:`s`}`;return Y(R,{flexDirection:`column`,children:[J(X,{children:`Toolsets`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`n to create a new toolset`}),t.length>0&&J(z,{dimColor:!0,children:`d to set as default toolset`}),t.length>0&&J(z,{dimColor:!0,children:`p to set as plan mode toolset`}),t.length>0&&J(z,{dimColor:!0,children:`x to delete a toolset`}),t.length>0&&J(z,{dimColor:!0,children:`enter to edit toolset`}),J(z,{dimColor:!0,children:`esc to go back`})]}),t.length===0?J(z,{children:`No toolsets created yet. Press n to create one.`}):J(R,{flexDirection:`column`,children:t.map((e,t)=>{let i=e.name===n,a=e.name===r,o=d===t,s;return o&&(s=`yellow`),Y(R,{flexDirection:`row`,children:[Y(z,{color:s,children:[o?`❯ `:` `,e.name,` `]}),Y(z,{color:s,children:[`(`,x(e),`)`]}),i&&J(z,{color:u,children:` ⏵⏵ accept edits`}),a&&J(z,{color:l,children:` ⏸ plan mode`})]},t)})})]})}function Rt({onBack:e}){let{settings:t,updateSettings:n}=H($),[r,i]=W(`plan`),[a,o]=W(!1),[s,c]=W(0),l=t.subagentModels||{plan:null,explore:null,generalPurpose:null},u=[{id:`plan`,title:`Plan Agent`,description:`The agent responsible for creating implementation plans.`},{id:`explore`,title:`Explore Agent`,description:`The agent specialized for exploring codebases.`},{id:`generalPurpose`,title:`General-purpose Agent`,description:`The agent used for general multi-step tasks.`}],d=[{label:`Default (Inherited)`,value:null},{label:`sonnet`,value:`sonnet`},{label:`haiku`,value:`haiku`},{label:`opus`,value:`opus`},{label:`sonnet[1m]`,value:`sonnet[1m]`}];return B((t,f)=>{if(a){if(f.escape)o(!1);else if(f.upArrow)c(e=>e>0?e-1:d.length-1);else if(f.downArrow)c(e=>e<d.length-1?e+1:0);else if(f.return){let e=d[s].value;n(t=>{t.subagentModels||={plan:null,explore:null,generalPurpose:null},t.subagentModels[r]=e}),o(!1)}}else if(f.escape)e();else if(f.upArrow){let e=u.findIndex(e=>e.id===r);i(u[e>0?e-1:u.length-1].id)}else if(f.downArrow){let e=u.findIndex(e=>e.id===r);i(u[e<u.length-1?e+1:0].id)}else if(t===` `||f.return){let e=l[r],t=d.findIndex(t=>t.value===e);c(t>=0?t:0),o(!0)}}),a?Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:Y(X,{children:[`Select Model for`,` `,u.find(e=>e.id===r)?.title]})}),d.map((e,t)=>{let n=t===s;return J(R,{children:Y(z,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,e.label,e.value?Y(z,{dimColor:!0,children:[` (`,e.value,`)`]}):null]})},t)})]}):Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(X,{children:`Subagent Model Settings`})}),J(R,{marginBottom:1,children:J(z,{dimColor:!0,children:`Configure which Claude model each subagent uses. Use arrow keys to navigate, enter or space to change a model, and escape to go back.`})}),u.map(e=>{let t=e.id===r,n=l[e.id],i=d.find(e=>e.value===n)?.label||n||`Default`;return Y(R,{flexDirection:`column`,marginBottom:1,children:[J(R,{children:Y(z,{color:t?`cyan`:void 0,children:[t?`❯ `:` `,J(z,{bold:!0,children:e.title})]})}),J(R,{marginLeft:4,children:J(z,{dimColor:!0,children:e.description})}),J(R,{marginLeft:4,children:Y(z,{children:[`Current: `,J(z,{color:`green`,children:i})]})})]},e.id)})]})}const zt=[{value:`low`,blurb:`Fastest, cheapest - minimal reasoning`},{value:`medium`,blurb:`Balanced reasoning`},{value:`high`,blurb:`Deep reasoning`},{value:`xhigh`,blurb:`Very deep reasoning`},{value:`max`,blurb:`Maximum reasoning - slowest, priciest`}],Bt={messageCap:{label:`Message cap`,unit:`chars`,lo:500,hi:4e5,hint:`max chars of a user message fed to the classifier`},assistantCap:{label:`Assistant cap`,unit:`chars`,lo:500,hi:4e5,hint:`prev assistant reply beyond this is middle-truncated (head+tail + an omitted-size marker the classifier weighs); no mechanical floor`},timeoutMs:{label:`Haiku timeout`,unit:`ms`,lo:1e3,hi:12e4,hint:`classifier call timeout; on timeout the router fails open`}},Vt=[`enabled`,`pinPerTask`,`messageCap`,`assistantCap`,`timeoutMs`,`systemPrompt`],Ht=e=>e in Bt,Ut=P.complexityRouter;function Wt({onBack:e}){let{settings:t,updateSettings:n}=H($),r={...Ut,...t.complexityRouter??{},levels:t.complexityRouter?.levels&&t.complexityRouter.levels.length>0?t.complexityRouter.levels:Ut.levels},i=Vt.length+r.levels.length,{setRawMode:a,isRawModeSupported:o}=we(),[s,c]=W(0),[l,u]=W(null),[d,f]=W(0),[p,m]=W(null),[h,g]=W(null),[,_]=W(0),v=e=>{n(t=>{let n={...Ut,...t.complexityRouter??{},levels:(t.complexityRouter?.levels&&t.complexityRouter.levels.length>0?t.complexityRouter.levels:Ut.levels).map(e=>({...e}))};e(n),t.complexityRouter=n})};if(B((t,n)=>{if(h){if(n.escape){g(null);return}if(n.return){let{kind:e,levelIndex:t,value:n}=h;v(r=>{let i=r.levels[t];i&&(i[e]=n)}),g(null);return}if(n.backspace||n.delete){g(e=>e&&{...e,value:e.value.slice(0,-1)});return}t&&!n.ctrl&&!n.meta&&g(e=>e&&{...e,value:e.value+t});return}if(p){if(n.escape){m(null);return}if(n.return){let e=Bt[p.row],t=parseInt(p.value,10),n=Number.isFinite(t)?Math.min(e.hi,Math.max(e.lo,t)):Ut[p.row],r=p.row;v(e=>{e[r]=n}),m(null);return}if(n.backspace||n.delete){m(e=>e&&{...e,value:e.value.slice(0,-1)});return}/^[0-9]$/.test(t)&&m(e=>e&&e.value.length<7?{...e,value:e.value+t}:e);return}if(l){if(n.escape){u(null);return}if(n.upArrow){f(e=>e>0?e-1:zt.length-1);return}if(n.downArrow){f(e=>e<zt.length-1?e+1:0);return}if(n.return){let e=zt[d].value,t=l.levelIndex;v(n=>{n.levels[t]&&(n.levels[t].effort=e)}),u(null)}return}if(n.escape){e();return}if(n.upArrow){c(e=>e>0?e-1:i-1);return}if(n.downArrow){c(e=>e<i-1?e+1:0);return}let y=s<Vt.length,b=s-Vt.length;if(t===`x`){if(y){let e=Vt[s];Ht(e)?v(t=>{t[e]=Ut[e]}):e===`systemPrompt`&&v(e=>{e.systemPrompt=Ut.systemPrompt})}else{let e=Ut.levels[b];e&&v(t=>{let n=t.levels[b];n&&(n.effort=e.effort,n.label=e.label,n.help=e.help)})}return}if(!y&&(t===`l`||t===`h`)){let e=t===`l`?`label`:`help`,n=r.levels[b];n&&g({kind:e,levelIndex:b,value:n[e]});return}if(t===` `||n.return)if(y){let e=Vt[s];if(e===`enabled`)v(e=>{e.enabled=!e.enabled});else if(e===`pinPerTask`)v(e=>{e.pinPerTask=!e.pinPerTask});else if(e===`systemPrompt`){o&&a(!1);let e=O(r.systemPrompt);if(o&&a(!0),e!=null){let t=e.replace(/\s+$/,``);t&&t!==r.systemPrompt&&v(e=>{e.systemPrompt=t})}_(e=>e+1)}else m({row:e,value:String(r[e])})}else{let e=zt.findIndex(e=>e.value===r.levels[b]?.effort);f(e>=0?e:0),u({levelIndex:b})}}),l)return Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:Y(X,{children:[`Select effort for "`,r.levels[l.levelIndex]?.label,`"`]})}),zt.map((e,t)=>{let n=t===d;return J(R,{children:Y(z,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,e.value,Y(z,{dimColor:!0,children:[` - `,e.blurb]})]})},t)})]});let y=(e,t)=>{let n=t===s,i,a,o=``;if(e===`enabled`)i=`Enabled`,a=r.enabled?`on`:`off`;else if(e===`pinPerTask`)i=`Pin per task`,a=r.pinPerTask?`on`:`off`;else if(e===`systemPrompt`){i=`System prompt`;let e=r.systemPrompt===Ut.systemPrompt;a=`${r.systemPrompt.length} chars${e?` (default)`:` (customized)`} - enter to edit in $EDITOR`,o=`opens the classifier system prompt in your $EDITOR; {LEVELS} (the tier rubric) and {MAX} are substituted at apply time · x = reset to default`}else{let t=Bt[e];i=t.label,p?.row===e?(a=`${p.value||`0`}_`,o=`type a number (${t.lo}-${t.hi}), enter to save · esc cancel`):(a=`${r[e]} ${t.unit}`,o=t.hint)}return Y(R,{flexDirection:`column`,children:[Y(z,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,i,`: `,J(z,{color:`green`,children:a})]}),n&&o?J(R,{marginLeft:4,children:J(z,{dimColor:!0,children:o})}):null]},e)};return Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(X,{children:`Complexity Effort Router [experimental]`})}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`Classifies each task by difficulty and sets the reasoning-effort (thinking) level to match - low for routine work, the top tier only for genuinely frontier problems. Runs on your current model (no model switch). Off by default.`}),J(z,{dimColor:!0,children:`Heads up - it burns more tokens: effort level is part of the prompt cache key, so every turn the router changes the level the whole conversation is re-read uncached (a big one-time hit that turn, then cheaper again while the level holds). Each level keeps its own cache, so returning to a prior level reuses most of its earlier work. pin per task on (the default, monotonic) minimizes the churn; pin off flips both ways and pays it more often. Measured, not theoretical.`}),J(z,{dimColor:!0,children:`A one-shot Haiku side-call routes each prompt, fed a rolling TL;DR summary of the session plus the model in use and the level it set last turn (so it judges in context, not cold). Kept in ~/.tweakcc/router- state, restored on resume; reset and reseeded from the main model's summary when the conversation compacts. On a Haiku error it keeps the last level, else defaults high.`}),J(z,{dimColor:!0,children:`Rewind-aware: it snapshots the routed state each turn, so /rewind (Restore conversation) cuts the summary back to the point you rewound to - effort and memory follow the conversation instead of carrying rewound-away work. (Summarize-from-here rewinds reseed via compaction.)`}),J(z,{dimColor:!0,children:`Fully customizable: edit the classifier System prompt in your $EDITOR, and each tier's label/help inline - all with sane defaults.`}),J(z,{dimColor:!0,children:`pin per task is a monotonic floor - effort never drops below the session max (only escalates); turn it off to track each prompt up and down. Reset on /clear.`}),J(z,{dimColor:!0,children:`While on, the router drives effort, overriding your saved effortLevel. An in-session /effort takes back manual control for that session, and CLAUDE_CODE_EFFORT_LEVEL always wins.`}),J(z,{dimColor:!0,children:`See it: Claude Code's working indicator already shows it live - e.g. "thinking with max effort" reflects the routed level. TWEAKCC_ROUTER_DEBUG=1 also logs each decision.`}),J(z,{dimColor:!0,children:`↑↓ navigate · enter/space toggle, edit, or open $EDITOR · digits set a number · on a tier: l/h edit label/help · x reset · esc back`})]}),Vt.map((e,t)=>y(e,t)),J(R,{marginTop:1,marginBottom:1,children:J(z,{bold:!0,children:`Complexity levels and their effort`})}),r.levels.map((e,t)=>{let n=Vt.length+t===s,r=h?.levelIndex===t&&h.kind===`label`,i=h?.levelIndex===t&&h.kind===`help`;return Y(R,{flexDirection:`column`,marginBottom:1,children:[J(R,{children:Y(z,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,J(z,{bold:!0,children:r?`${h.value}_`:e.label}),` `,J(z,{color:`green`,children:e.effort})]})}),J(R,{marginLeft:4,children:J(z,{dimColor:!0,children:i?`${h.value}_`:e.help})}),n&&!h?J(R,{marginLeft:4,children:J(z,{dimColor:!0,children:`enter = set effort · l = edit label · h = edit help · x = reset this tier`})}):null,n&&h?J(R,{marginLeft:4,children:Y(z,{dimColor:!0,children:[`editing `,h.kind,` - type to change · enter save · esc cancel`]})}):null]},e.id)})]})}const Gt=K.join(ae,`claude-browser-bridge`),Kt=K.join(Gt,`host`,`setup.mjs`),qt=K.join(Gt,`extension`),Jt=K.join(Me.homedir(),`.claude-browser-bridge`,`install-state.json`),Yt=`/tmp/claude-browser-bridge-${Me.userInfo().username}.sock`;function Xt(e){try{return!G.statSync(K.join(e,`Local State`)).isFile()||!G.statSync(K.join(e,`NativeMessagingHosts`)).isDirectory()?!1:G.existsSync(K.join(e,`Default`))?!0:G.readdirSync(e).some(e=>/^Profile \d+$/.test(e))}catch{return!1}}function Zt(e){let t=K.basename(e);return t===`User Data`&&(t=K.basename(K.dirname(e))),t.includes(`.`)&&(t=t.split(`.`).pop()||t),t=t.replace(/[-_]/g,` `),t.charAt(0).toUpperCase()+t.slice(1)}function Qt(e){return new Promise(t=>{Ie(process.execPath,e,{maxBuffer:8*1024*1024},(e,n,r)=>{t({code:e?typeof e.code==`number`?e.code:1:0,out:String(n)+String(r)})})})}function $t(e){return new Promise(t=>{Ie(`git`,e,{maxBuffer:8*1024*1024},(e,n,r)=>{t({code:e?1:0,out:String(n)+String(r)})})})}async function en(){if(G.existsSync(K.join(Gt,`.git`))&&G.existsSync(Kt)){let e=await $t([`-C`,Gt,`pull`,`--ff-only`]);return G.existsSync(Kt)?{code:0,out:e.out}:e}return G.existsSync(Gt)&&G.rmSync(Gt,{recursive:!0,force:!0}),$t([`clone`,`--depth`,`1`,`https://github.com/skrabe/claude-browser-bridge`,Gt])}function tn(){let e=process.platform===`darwin`?K.join(Me.homedir(),`Library`,`Application Support`):K.join(Me.homedir(),`.config`),t=e=>{try{return G.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).map(t=>K.join(e,t.name))}catch{return[]}},n=[];for(let r of t(e))for(let e of[r,...t(r)])Xt(e)&&n.push(Zt(e));return n.sort()}function nn(){try{return JSON.parse(G.readFileSync(Jt,`utf8`))}catch{return null}}const rn=({onBack:e})=>{let[t,n]=W(`menu`),[r,i]=W(0),[a,o]=W(nn()),[s,c]=W(`global`),[l,u]=W(`Working…`),[d,f]=W([]),[p,m]=W(null),[h,g]=W(``),_=ke(()=>{o(nn())},[]);U(()=>{_()},[_]);let v=G.existsSync(Yt),y=!!a,b=()=>{c(`global`),i(0),n(`scope`)},x=ke(async e=>{n(`busy`),u(`Fetching the bridge…`),f([]);let t=await en();if(t.code!==0||!G.existsSync(Kt)){g(`Failed to fetch the bridge repo:
3
- `+t.out.slice(-600)),n(`error`);return}u(`Installing (registers with every Chromium browser, MCP, skill, disables Claude in Chrome)…`);let r=[Kt,`install`,`--scope`,e];e===`project`&&r.push(`--project`,process.cwd());let a=await Qt(r);if(f(a.out.split(`
2
+ import{B as e,D as t,E as n,F as r,G as i,H as a,I as o,J as s,K as c,L as l,M as u,N as d,O as f,P as p,Q as m,R as h,S as g,T as _,U as v,V as y,W as b,X as x,Y as S,Z as C,_ as w,a as T,at as ee,b as E,ct as D,d as O,g as te,h as k,i as ne,it as A,k as re,l as j,m as ie,n as ae,nt as oe,o as se,ot as M,p as N,q as ce,r as P,rt as F,s as I,st as le,t as ue,tt as de,u as fe,v as pe,x as me,y as he,z as L}from"./config-BqRjOmoZ.mjs";import{a as ge,c as _e,d as ve,l as ye,n as be,o as xe,s as Se,t as Ce,u as we}from"./content-CD_fyzYM.mjs";import{Box as R,Text as z,render as Te,useInput as B,useStdin as Ee}from"ink";import{Command as De}from"commander";import V from"chalk";import Oe,{Fragment as ke,createContext as Ae,useCallback as je,useContext as H,useEffect as U,useMemo as Me,useRef as Ne,useState as W}from"react";import*as Pe from"node:os";import Fe from"ink-link";import*as Ie from"node:fs/promises";import*as G from"node:fs";import*as K from"node:path";import{execFile as Le,execSync as Re,spawn as ze}from"node:child_process";import Be from"gray-matter";import{structuredPatch as Ve}from"diff";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import He from"process";import Ue from"cli-spinners";import*as We from"node:readline";var X=({children:e,...t})=>Y(z,{bold:!0,backgroundColor:`#ffd500`,color:`#000`,...t,children:[` `,e,` `]});const Ge=[`\x1B[?25l\x1B[0m \x1B[38;2;0;0;0m \x1B[38;2;252;130;0m▂\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▇\x1B[38;2;254;131;0m\x1B[48;2;252;130;0m▇\x1B[48;2;252;130;0m▇▇\x1B[48;2;252;130;0m▇\x1B[0m\x1B[38;2;252;130;0m▇\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▂ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;254;131;0m▗\x1B[38;2;254;131;0m▆\x1B[48;2;254;131;0m \x1B[38;2;254;132;0m╶ \x1B[0m\x1B[38;2;254;131;0m▆\x1B[38;2;254;131;0m▖ \x1B[0m`,` \x1B[7m\x1B[38;2;254;131;0m▘\x1B[0m\x1B[38;2;11;6;0m\x1B[48;2;254;131;0m \x1B[38;2;254;216;182m\x1B[48;2;254;136;12m▃\x1B[38;2;254;249;246m\x1B[48;2;254;143;29m▅\x1B[38;2;254;253;253m\x1B[48;2;254;143;40m▆\x1B[38;2;254;254;253m\x1B[48;2;254;152;68m▆▆▆\x1B[38;2;254;253;252m\x1B[48;2;254;141;34m▆\x1B[38;2;254;247;242m\x1B[48;2;254;140;24m▅\x1B[38;2;254;224;199m\x1B[48;2;254;140;20m▖\x1B[48;2;254;131;0m \x1B[0m\x1B[7m\x1B[38;2;254;131;0m▝\x1B[0m \x1B[0m`,`\x1B[7m\x1B[38;2;251;127;0m▌\x1B[0m\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[38;2;252;128;0m\x1B[48;2;254;131;0m▃\x1B[38;2;252;129;0m▂\x1B[38;2;253;130;0m▁\x1B[38;2;249;135;16m\x1B[48;2;253;226;202m▋\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┈\x1B[48;2;246;246;245m┈\x1B[38;2;47;47;47m\x1B[48;2;244;244;243m▂\x1B[38;2;112;112;112m\x1B[48;2;251;251;251m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m▁╌▝\x1B[38;2;254;254;253m\x1B[48;2;254;254;254m▋\x1B[38;2;254;254;254m\x1B[48;2;254;253;252m┈\x1B[38;2;252;209;168m\x1B[48;2;251;129;0m▍\x1B[38;2;253;129;0m\x1B[48;2;254;131;0m▂\x1B[38;2;252;128;0m▃\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[0m\x1B[38;2;251;127;0m▌\x1B[0m`,`\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▏\x1B[38;2;245;118;0m\x1B[48;2;248;122;0m▄\x1B[38;2;247;121;0m\x1B[48;2;247;122;0m┈\x1B[38;2;106;68;38m\x1B[48;2;245;123;2m▃\x1B[38;2;39;33;28m\x1B[48;2;211;109;6m▅\x1B[38;2;27;20;12m\x1B[48;2;237;237;237m▌\x1B[48;2;254;254;253m \x1B[38;2;90;90;89m\x1B[48;2;231;230;230m▝\x1B[38;2;215;215;214m\x1B[48;2;48;48;48m▁\x1B[38;2;203;203;202m\x1B[48;2;42;42;42m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┇╴\x1B[38;2;253;252;252m▂\x1B[38;2;251;250;250m\x1B[48;2;253;253;253m▃\x1B[38;2;249;249;248m\x1B[48;2;252;252;251m▄\x1B[38;2;249;248;248m\x1B[48;2;237;118;0m▍\x1B[38;2;246;121;0m\x1B[48;2;250;125;0m▄\x1B[38;2;246;119;0m\x1B[48;2;249;124;0m▄\x1B[38;2;245;118;0m\x1B[48;2;248;123;0m▄\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▉\x1B[0m`,`\x1B[38;2;238;108;0m\x1B[48;2;237;109;0m▏\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;233;109;2m\x1B[48;2;125;73;29m▇\x1B[38;2;225;104;1m\x1B[48;2;50;32;18m▄\x1B[38;2;62;29;2m\x1B[48;2;239;237;237m▌\x1B[38;2;254;253;253m\x1B[48;2;254;254;254m┻\x1B[38;2;254;254;253m▊\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;253;253;252m▂\x1B[38;2;251;251;251m\x1B[48;2;254;253;253m▃\x1B[38;2;249;249;249m\x1B[48;2;252;252;252m▄\x1B[38;2;247;247;247m\x1B[48;2;250;250;250m▄\x1B[38;2;245;245;244m\x1B[48;2;248;248;248m▄\x1B[38;2;243;243;242m\x1B[48;2;246;246;245m▄\x1B[38;2;243;242;242m\x1B[48;2;230;109;0m▍\x1B[38;2;239;111;0m\x1B[48;2;243;116;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;237;108;0m\x1B[48;2;238;108;0m▉\x1B[0m`,`\x1B[7m\x1B[38;2;231;98;0m▌\x1B[0m\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[38;2;231;99;0m\x1B[48;2;235;105;0m▄\x1B[38;2;232;100;0m\x1B[48;2;236;105;0m▄\x1B[38;2;232;101;0m\x1B[48;2;236;106;0m▄\x1B[38;2;223;99;0m\x1B[48;2;247;238;235m▌\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;252;252;251m▃\x1B[38;2;250;250;250m\x1B[48;2;253;253;252m▄\x1B[38;2;248;248;247m\x1B[48;2;251;251;250m▄\x1B[38;2;246;245;245m\x1B[48;2;249;248;248m▄\x1B[38;2;243;243;243m\x1B[48;2;246;246;246m▄\x1B[38;2;241;241;241m\x1B[48;2;244;244;244m▄\x1B[38;2;239;239;238m\x1B[48;2;242;242;242m▄\x1B[38;2;237;237;236m\x1B[48;2;240;240;239m▄\x1B[38;2;237;236;236m\x1B[48;2;223;99;0m▍\x1B[38;2;232;100;0m\x1B[48;2;236;106;0m▄\x1B[38;2;231;100;0m\x1B[48;2;235;105;0m▄\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[0m\x1B[38;2;231;98;0m▌\x1B[0m`,` \x1B[7m\x1B[38;2;224;89;0m▖\x1B[0m\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[38;2;225;90;0m\x1B[48;2;228;95;0m▄\x1B[38;2;225;91;0m\x1B[48;2;229;96;0m▄\x1B[38;2;217;90;1m\x1B[48;2;97;77;70m▌\x1B[38;2;70;70;70m\x1B[48;2;207;207;207m▆\x1B[38;2;66;65;65m\x1B[48;2;228;228;227m▄\x1B[38;2;66;66;66m\x1B[48;2;233;232;232m▂\x1B[38;2;169;169;169m\x1B[48;2;243;243;243m▁\x1B[38;2;240;239;239m\x1B[48;2;243;242;242m▄\x1B[38;2;238;237;237m\x1B[48;2;241;240;240m▄\x1B[38;2;235;235;235m\x1B[48;2;238;238;238m▄\x1B[38;2;233;233;233m\x1B[48;2;236;236;236m▄\x1B[38;2;231;231;230m\x1B[48;2;234;234;233m▄\x1B[38;2;231;230;230m\x1B[48;2;216;89;0m▍\x1B[38;2;225;90;0m\x1B[48;2;229;95;0m▄\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[0m\x1B[7m\x1B[38;2;224;89;0m▗\x1B[0m \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;217;80;0m▝\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m\x1B[48;2;221;86;0m▄\x1B[38;2;197;78;9m\x1B[48;2;66;66;65m▋\x1B[38;2;65;65;64m\x1B[48;2;60;60;60m▘\x1B[38;2;52;52;51m\x1B[48;2;56;56;56m▗\x1B[38;2;45;45;45m\x1B[48;2;50;50;49m▗\x1B[38;2;42;42;42m\x1B[48;2;46;46;46m┈\x1B[38;2;41;41;41m\x1B[48;2;203;202;202m▆\x1B[38;2;38;38;38m\x1B[48;2;218;218;218m▄\x1B[38;2;45;45;45m\x1B[48;2;221;221;221m▂\x1B[38;2;229;229;229m┊\x1B[38;2;225;225;225m\x1B[48;2;228;228;227m▄\x1B[38;2;225;224;224m\x1B[48;2;209;79;0m▍\x1B[0m\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m▘ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[7m\x1B[38;2;191;73;0m▆\x1B[38;2;191;73;0m▄\x1B[38;2;56;55;55m▃\x1B[38;2;46;46;46m▁\x1B[0m\x1B[38;2;20;20;20m\x1B[48;2;42;42;42m▁\x1B[38;2;36;36;36m\x1B[48;2;35;34;34m╴\x1B[38;2;23;23;23m\x1B[48;2;29;29;28m▁\x1B[38;2;10;10;10m\x1B[48;2;22;22;22m▁\x1B[0m\x1B[7m\x1B[38;2;15;15;15m▁\x1B[38;2;22;22;21m▃\x1B[38;2;154;154;154m▅\x1B[38;2;175;116;83m▇\x1B[0m\x1B[38;2;17;15;14m \x1B[0m`,`\x1B[?25h\x1B[0m`];var Ke=()=>Y(R,{flexDirection:`row`,height:10,alignItems:`center`,borderStyle:`bold`,borderBottom:!1,borderTop:!1,borderRight:!1,borderColor:`#ff8400`,marginBottom:1,children:[Y(R,{marginBottom:1,paddingLeft:1,flexDirection:`column`,flexGrow:1,children:[J(z,{bold:!0,color:`#ff8400`,children:`Piebald is released!`}),J(z,{children:` `}),Y(z,{children:[`We've released `,J(z,{bold:!0,children:`Piebald`}),`, the ultimate agentic AI developer experience.`]}),Y(z,{children:[`Download it and try it out for free!`,` `,J(Fe,{url:`https://piebald.ai/`,fallback:!1,children:J(z,{color:`#ff8400`,children:`https://piebald.ai/`})})]}),J(z,{children:` `}),J(z,{dimColor:!0,color:`gray`,children:`press 'h' to hide`})]}),J(R,{width:22,flexShrink:0,flexDirection:`column`,alignItems:`center`,children:Ge.map((e,t)=>J(z,{children:e},t))})]});let Z=function(e){return e.THEMES=`Themes`,e.THINKING_VERBS=`Thinking verbs`,e.THINKING_STYLE=`Thinking style`,e.USER_MESSAGE_DISPLAY=`User message display`,e.INPUT_PATTERN_HIGHLIGHTERS=`Input pattern highlighters`,e.MISC=`Misc`,e.TOOLSETS=`Toolsets`,e.SUBAGENT_MODELS=`Subagent models`,e.COMPLEXITY_ROUTER=`Complexity effort router [experimental]`,e.FABLE_PLAN=`Fable Plan mode`,e.CLAUDE_MD_ALT_NAMES=`CLAUDE.md alternative names`,e.SYSTEM_REMINDERS=`System reminders (injection lobotomy)`,e.SKILLS=`Skills (per-skill on/name-only/user-invocable/off)`,e.BROWSER_BRIDGE=`Better Claude in Chrome`,e.VIEW_SYSTEM_PROMPTS=`View system prompts`,e.RESTORE_ORIGINAL=`Restore original Claude Code (preserves config.json)`,e.OPEN_CONFIG=`Open config.json`,e.OPEN_CLI=`Open Claude Code's cli.js`,e.EXIT=`Exit`,e}({});function qe({items:e,selectedIndex:t,onSelect:n,onSubmit:r}){return B((i,a)=>{e.length!==0&&(a.upArrow?n(t>0?t-1:e.length-1):a.downArrow?n(t<e.length-1?t+1:0):a.return&&r(e[t].name))}),J(R,{flexDirection:`column`,children:e.map((e,n)=>J(R,{children:Y(z,{children:[Y(z,{bold:n===t,color:n===t?`cyan`:void 0,...n===t?e.selectedStyles??{}:e.styles??{},children:[n===t?`❯ `:` `,e.name]}),e.desc&&n===t&&Y(z,{dimColor:!0,bold:!1,children:[` \x1B[0;2m`,`- `,e.desc]})]})},n))})}const Je=[{name:Z.THEMES,desc:`Modify Claude Code's built-in themes or create your own`},{name:Z.THINKING_VERBS,desc:`Customize the list of verbs that Claude Code uses when it's working`},{name:Z.THINKING_STYLE,desc:`Choose custom spinners`},{name:Z.USER_MESSAGE_DISPLAY,desc:`Customize how user messages are displayed`},{name:Z.INPUT_PATTERN_HIGHLIGHTERS,desc:`Create custom highlighters for patterns in your input`},{name:Z.MISC,desc:`Miscellaneous settings (input box border, etc.)`},{name:Z.TOOLSETS,desc:`Manage toolsets to control which tools are available`},{name:Z.SUBAGENT_MODELS,desc:`Configure which Claude model each subagent uses (Plan, Explore, etc.)`},{name:Z.COMPLEXITY_ROUTER,desc:`[EXPERIMENTAL] Auto-route reasoning effort by task complexity (routine=low ... hardest=max)`},{name:Z.FABLE_PLAN,desc:`Plan on one model, execute on another (a /model entry, like opusplan)`},{name:Z.CLAUDE_MD_ALT_NAMES,desc:`Configure alternative filenames for CLAUDE.md (e.g., AGENTS.md)`},{name:Z.SYSTEM_REMINDERS,desc:`Suppress per-turn <system-reminder> injections (skills list, MCP instructions, claudeMd wrapper, etc.)`},{name:Z.SKILLS,desc:`Per-skill listing control (writes settings.json skillOverrides — no patch needed)`},{name:Z.BROWSER_BRIDGE,desc:`Drive your real, logged-in tabs over CDP — a fuller take on Claude in Chrome`},{name:Z.VIEW_SYSTEM_PROMPTS,desc:`Opens the system prompts directory where you can customize Claude Code's system prompts`}],Ye=[{name:Z.RESTORE_ORIGINAL,desc:`Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)`},{name:Z.OPEN_CONFIG,desc:`Opens your tweakcc config file (${P})`},{name:Z.OPEN_CLI,desc:`Opens Claude Code's cli.js file`},{name:Z.EXIT,desc:`Bye!`}];var Xe=({onSubmit:e})=>{let t=[...Je,...Ye],[n,r]=W(0);return J(qe,{items:t,selectedIndex:n,onSelect:r,onSubmit:t=>e(t)})};const Ze=()=>Y(R,{flexDirection:`row`,children:[J(X,{children:`tweakcc`}),J(z,{children:` (by `}),J(Fe,{url:`https://piebald.ai`,fallback:!1,children:J(z,{color:`#ff8400`,bold:!0,children:`Piebald`})}),J(z,{children:`)`})]}),Qe=()=>J(R,{children:Y(z,{color:`yellow`,children:[`⭐ `,J(z,{bold:!0,children:`Star the repo at `}),J(Fe,{url:`https://github.com/skrabe/tweakcc-fixed`,fallback:!1,children:J(z,{bold:!0,color:`cyan`,children:`https://github.com/skrabe/tweakcc-fixed`})}),J(z,{bold:!0,children:` if you find this useful!`}),` ⭐`]})}),$e=({notification:e})=>J(R,{borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:`bold`,borderColor:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,paddingLeft:1,flexDirection:`column`,children:J(z,{color:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,children:e.message})}),et=({onSubmit:e,notification:t,configMigrated:n,showPiebaldAnnouncement:r,changesApplied:i,invocationCommand:a})=>Y(R,{flexDirection:`column`,gap:1,children:[n&&J(R,{children:J(z,{color:`blue`,bold:!0,children:"Note that in tweakcc v3.2.0+, `ccInstallationDir` config is deprecated. You are now migrated to `ccInstallationPath` which supports npm and native installs."})}),J(Ze,{}),J(R,{children:Y(z,{children:[J(z,{bold:!0,children:`Customize your Claude Code installation.`}),` `,Y(z,{dimColor:!0,children:[`Settings will be saved to `,ae.replace(Pe.homedir(),`~`),`/config.json.`]})]})}),J(r?Ke:Qe,{}),t&&J($e,{notification:t}),!i&&!t&&J($e,{notification:{message:`Your changes are configured but not applied.\nRun \`${a} --apply\` to apply your customizations!`,type:`info`}}),J(Xe,{onSubmit:e})]});function Q({color:e,backgroundColor:t,bold:n,dimColor:r,children:i}){let a=e?.startsWith(`ansi:`),o=t?.startsWith(`ansi:`);if(a||o){if(Oe.Children.toArray(i).some(e=>Oe.isValidElement(e)))return J(z,{children:i});let s=V;if(a){let t=e.slice(5);s=s[t]||s}if(o){let e=t.slice(5),n=e.startsWith(`bg`)?e:`bg${e.charAt(0).toUpperCase()}${e.slice(1)}`;s=s[n]||s}n&&(s=s.bold),r&&(s=s.dim);let c=Oe.Children.toArray(i).map(e=>typeof e==`string`||typeof e==`number`?String(e):``).join(``);return J(z,{children:s(c)})}return J(z,{color:e,backgroundColor:t,bold:n,dimColor:r,children:i})}function tt({text:e,nonShimmerColors:t,shimmerColors:n,shimmerWidth:r=3,updateDuration:i=50,restartPoint:a=10}){let[o,s]=W(0);return U(()=>{let t=setInterval(()=>{s(t=>{let n=t+1;return n>=e.length+a?-r:n})},i);return()=>clearInterval(t)},[e.length,a,i]),t.length===n.length?J(z,{children:e.split(``).map((i,a)=>{let s=a>=o&&a<o+r&&o<e.length,c=a%t.length;return J(z,{color:s?n[c]:t[c],children:i},a)})}):(console.error(`UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length`),J(z,{children:e}))}const nt=He.cwd();function rt({theme:e}){let{ccVersion:t}=H($);return Y(R,{flexDirection:`column`,paddingLeft:1,children:[J(R,{marginBottom:1,children:Y(z,{bold:!0,children:[`Preview: `,e.name]})}),J(R,{borderStyle:`single`,borderColor:`gray`,paddingX:1,children:Y(R,{flexDirection:`column`,children:[Y(R,{flexDirection:`column`,children:[Y(z,{children:[J(Q,{color:e.colors.clawd_body,children:` ▐`}),J(z,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`▛███▜`}),Y(z,{children:[J(Q,{color:e.colors.clawd_body,children:`▌ `}),` `,J(z,{bold:!0,children:`Claude Code`}),` `,t?`v${t}`:`v2.0.14`]})]}),Y(z,{children:[J(Q,{color:e.colors.clawd_body,children:`▝▜`}),J(z,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`█████`}),J(Q,{color:e.colors.clawd_body,children:`▛▘`}),` `,g(),` · `,E()]}),Y(Q,{color:e.colors.clawd_body,children:[` `,`▘▘ ▝▝`,` `,nt]}),Y(z,{children:[Y(Q,{color:e.colors.success,children:[`Login successful. Press`,` `]}),J(Q,{bold:!0,color:e.colors.success,children:`Enter`}),Y(Q,{color:e.colors.success,children:[` `,`to continue…`]})]})]}),J(z,{children:`╭─────────────────────────────────────────────╮`}),Y(z,{children:[`│ 1 function greet() `,`{`,` `,`│`]}),Y(z,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:`- console.log("`}),J(Q,{backgroundColor:e.colors.diffRemovedWord,children:`Hello, World!`}),J(Q,{backgroundColor:e.colors.diffRemoved,children:`");`}),` `,`│`]}),Y(z,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:`+ console.log("`}),J(Q,{backgroundColor:e.colors.diffAddedWord,children:`Hello, Claude!`}),J(Q,{backgroundColor:e.colors.diffAdded,children:`");`}),` `,`│`]}),J(Q,{color:e.colors.warning,children:`╭─────────────────────────────────────────────╮`}),Y(Q,{color:e.colors.warning,children:[`│ Do you trust the files in this folder?`,` `,`│`]}),Y(z,{children:[J(Q,{color:e.colors.warning,children:`│ `}),J(z,{dimColor:!0,children:`Enter to confirm · Esc to exit`}),Y(Q,{color:e.colors.warning,children:[` `,`│`]})]}),J(Q,{color:e.colors.bashBorder,children:`───────────────────────────────────────────────`}),Y(z,{children:[J(Q,{color:e.colors.bashBorder,children:`!`}),J(z,{children:` ls`})]}),J(Q,{color:e.colors.promptBorder,children:`───────────────────────────────────────────────`}),J(z,{children:Y(z,{children:[`> list the dir`,` `,J(tt,{text:`ultrathink`,nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),J(Q,{color:e.colors.planMode,children:`╭─────────────────────────────────────────────╮`}),Y(z,{children:[J(Q,{color:e.colors.planMode,children:`│ `}),Y(Q,{color:e.colors.permission,children:[`Ready to code?`,` `]}),J(z,{children:`Here is Claude's plan:`}),Y(Q,{color:e.colors.planMode,children:[` `,`│`]})]}),J(Q,{color:e.colors.permission,children:`╭─────────────────────────────────────────────╮`}),Y(z,{children:[J(Q,{color:e.colors.permission,children:`│ `}),J(z,{bold:!0,children:`Permissions:`}),` `,Y(Q,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[` `,`Allow`,` `]}),` `,`Deny`,` `,`Workspace`,` `,J(Q,{color:e.colors.permission,children:`│`})]}),J(z,{children:`> list the dir`}),Y(z,{children:[J(Q,{color:e.colors.error,children:`●`}),J(z,{children:` Update(__init__.py)`})]}),Y(z,{children:[J(z,{children:` ⎿ `}),J(Q,{color:e.colors.error,children:`User rejected update to __init__.py`})]}),Y(z,{children:[` `,`1`,` `,Y(Q,{backgroundColor:e.colors.diffRemovedDimmed,children:[`- import`,` `]}),J(Q,{backgroundColor:e.colors.diffRemovedWordDimmed,children:`os`})]}),Y(z,{children:[` `,`2`,` `,Y(Q,{backgroundColor:e.colors.diffAddedDimmed,children:[`+ import`,` `]}),J(Q,{backgroundColor:e.colors.diffAddedWordDimmed,children:`random`})]}),Y(z,{children:[J(Q,{color:e.colors.success,children:`●`}),J(z,{children:` List(.)`})]}),Y(z,{children:[J(z,{children:`●`}),J(z,{children:` The directory `}),J(Q,{color:e.colors.permission,children:`C:\\Users\\user`}),Y(z,{children:[` `,`contains `,J(z,{bold:!0,children:`123`}),` files.`]})]}),Y(z,{children:[J(Q,{color:e.colors.claude,children:`✻ Th`}),J(Q,{color:e.colors.claudeShimmer,children:`ink`}),J(Q,{color:e.colors.claude,children:`ing… `}),J(z,{children:`(esc to interrupt)`})]}),J(z,{children:J(Q,{color:e.colors.autoAccept,children:`⏵⏵ accept edits on (shift+tab to cycle)`})}),J(z,{children:J(Q,{color:e.colors.planMode,children:`⏸ plan mode on (shift+tab to cycle)`})}),J(z,{children:J(Q,{color:e.colors.ide,children:`◯ IDE connected ⧉ 44 lines selected`})})]})})]})}function it({colorKey:e,theme:t,bold:n=!1}){let r=t.colors[e];return e===`inverseText`?J(Q,{color:r,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith(`diff`)?J(Q,{backgroundColor:r,bold:n,color:t.colors.text,children:e}):J(Q,{color:r,bold:n,children:e})}function at({initialValue:e,onColorChange:r,onExit:i,colorKey:a,theme:o}){let s=st(e)||{h:0,s:50,l:50},c=ot(e)||{r:128,g:128,b:128},[l,u]=W(s),[d,f]=W(c),[p,m]=W(`hsl`),[h,g]=W(`h`),[_,v]=W(!1),[y,b]=W(!1);U(()=>{let t=st(e),n=ot(e);t&&n&&(v(!0),u(t),f(n),v(!1))},[e]),U(()=>{!_&&y&&r(`rgb(${d.r},${d.g},${d.b})`)},[l,d,_,y]),U(()=>{b(!0)},[]);let x=e=>{if(n(e)){let n=t(e),r=st(n),i=ot(n);r&&i&&(v(!0),u(r),f(i),v(!1))}};B((e,t)=>{if(e.length>1&&!t.ctrl&&!t.meta){x(e);return}t.return||t.escape?i():t.ctrl&&e===`a`?(m(e=>e===`hsl`?`rgb`:`hsl`),g(e=>p===`hsl`?e===`h`?`r`:e===`s`?`g`:`b`:e===`r`?`h`:e===`g`?`s`:`l`)):t.upArrow?g(p===`hsl`?e=>e===`h`?`l`:e===`s`?`h`:`s`:e=>e===`r`?`b`:e===`g`?`r`:`g`):t.downArrow||t.tab?g(p===`hsl`?e=>e===`h`?`s`:e===`s`?`l`:`h`:e=>e===`r`?`g`:e===`g`?`b`:`r`):t.leftArrow?S(t.shift||t.ctrl||t.meta?-10:-1):t.rightArrow&&S(t.shift||t.ctrl||t.meta?10:1)});let S=e=>{v(!0),p===`hsl`?u(t=>{let n={...t};h===`h`?n.h=Math.max(0,Math.min(359,t.h+e)):h===`s`?n.s=Math.max(0,Math.min(100,t.s+e)):h===`l`&&(n.l=Math.max(0,Math.min(100,t.l+e)));let[r,i,a]=w(n.h,n.s,n.l);return f({r,g:i,b:a}),n}):f(t=>{let n={...t};return h===`r`?n.r=Math.max(0,Math.min(255,t.r+e)):h===`g`?n.g=Math.max(0,Math.min(255,t.g+e)):h===`b`&&(n.b=Math.max(0,Math.min(255,t.b+e))),u(C(n.r,n.g,n.b)),n}),v(!1)},C=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===r?((i-a)/c+(i<a?6:0))/6:o===i?((a-r)/c+2)/6:((r-i)/c+4)/6),{h:Math.round(d*360),s:Math.round(u*100),l:Math.round(l*100)}},w=(e,t,n)=>{e/=360,t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e*6%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<1/6?(o=r,s=i,c=0):1/6<=e&&e<2/6?(o=i,s=r,c=0):2/6<=e&&e<3/6?(o=0,s=r,c=i):3/6<=e&&e<4/6?(o=0,s=i,c=r):4/6<=e&&e<5/6?(o=i,s=0,c=r):5/6<=e&&e<1&&(o=r,s=0,c=i),[Math.round((o+a)*255),Math.round((s+a)*255),Math.round((c+a)*255)]},T=()=>{let e=[],t=[[255,0,0],[255,127,0],[255,255,0],[127,255,0],[0,255,0],[0,255,127],[0,255,255],[0,127,255],[0,0,255],[127,0,255],[255,0,255],[255,0,127],[255,0,0]];for(let n=0;n<40;n++){let r=n/39*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=r-i,[s,c,l]=t[i],[u,d,f]=t[a],p=Math.round(s+(u-s)*o),m=Math.round(c+(d-c)*o),h=Math.round(l+(f-l)*o);e.push(J(z,{backgroundColor:`rgb(${p},${m},${h})`,children:` `},n))}return e},ee=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=w(l.h,n,l.l);e.push(J(z,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},E=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=w(l.h,l.s,n);e.push(J(z,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},D=()=>{let[e,t,n]=w(l.h,l.s,l.l);return`rgb(${e},${t},${n})`},O=(e,t,n)=>{let r=e=>e.toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},te=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(z,{backgroundColor:`rgb(${n},${d.g},${d.b})`,children:` `},t))}return e},k=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(z,{backgroundColor:`rgb(${d.r},${n},${d.b})`,children:` `},t))}return e},ne=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(z,{backgroundColor:`rgb(${d.r},${d.g},${n})`,children:` `},t))}return e},A=(e,t)=>Math.round(e/t*39);return Y(R,{flexDirection:`column`,borderStyle:`single`,borderColor:`white`,padding:1,children:[Y(R,{flexDirection:`column`,children:[J(z,{bold:!0,children:`Color Picker`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{color:`gray`,dimColor:!0,children:`←→ to adjust (shift/ctrl/cmd +10)`}),J(z,{color:`gray`,dimColor:!0,children:`↑↓ to change bar`}),J(z,{color:`gray`,dimColor:!0,children:`ctrl+a to switch rgb/hsl`}),J(z,{color:`gray`,dimColor:!0,children:`paste color from clipboard`}),J(z,{color:`gray`,dimColor:!0,children:`enter to exit (auto-saved)`}),J(z,{color:`gray`,dimColor:!0,children:`esc to save and exit`})]})]}),p===`hsl`?Y(q,{children:[Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`h`?`yellow`:`white`,children:[h===`h`?`❯ `:` `,`Hue (`,l.h,`°):`]})}),J(R,{children:T().map((e,t)=>J(ke,{children:t===A(l.h,360)?J(z,{children:`|`}):e},t))})]}),Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`s`?`yellow`:`white`,children:[h===`s`?`❯ `:` `,`Saturation (`,l.s,`%):`]})}),J(R,{children:ee().map((e,t)=>J(ke,{children:t===A(l.s,100)?J(z,{children:`|`}):e},t))})]}),Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`l`?`yellow`:`white`,children:[h===`l`?`❯ `:` `,`Lightness (`,l.l,`%):`]})}),J(R,{children:E().map((e,t)=>J(ke,{children:t===A(l.l,100)?J(z,{children:`|`}):e},t))})]})]}):Y(q,{children:[Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`r`?`yellow`:`white`,children:[h===`r`?`❯ `:` `,`Red (`,d.r,`):`]})}),J(R,{children:te().map((e,t)=>J(ke,{children:t===A(d.r,255)?J(z,{children:`|`}):e},t))})]}),Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`g`?`yellow`:`white`,children:[h===`g`?`❯ `:` `,`Green (`,d.g,`):`]})}),J(R,{children:k().map((e,t)=>J(ke,{children:t===A(d.g,255)?J(z,{children:`|`}):e},t))})]}),Y(R,{marginBottom:1,children:[J(R,{width:25,children:Y(z,{color:h===`b`?`yellow`:`white`,children:[h===`b`?`❯ `:` `,`Blue (`,d.b,`):`]})}),J(R,{children:ne().map((e,t)=>J(ke,{children:t===A(d.b,255)?J(z,{children:`|`}):e},t))})]})]}),Y(R,{marginBottom:1,children:[J(z,{children:`Current: `}),J(z,{backgroundColor:D(),children:` `})]}),Y(R,{flexDirection:`row`,justifyContent:`space-between`,children:[Y(R,{flexDirection:`column`,children:[J(z,{dimColor:!0,children:`Hex `}),a?.startsWith(`diff`)?J(z,{backgroundColor:D(),color:o?.colors?.text||`white`,bold:!0,children:O(d.r,d.g,d.b)}):a===`inverseText`?J(z,{color:D(),backgroundColor:o?.colors?.permission,bold:!0,children:O(d.r,d.g,d.b)}):J(z,{color:D(),bold:!0,children:O(d.r,d.g,d.b)})]}),Y(R,{flexDirection:`column`,children:[J(z,{dimColor:!0,children:`RGB `}),a?.startsWith(`diff`)?J(z,{backgroundColor:D(),color:o?.colors?.text||`white`,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):a===`inverseText`?J(z,{color:D(),backgroundColor:o?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):J(z,{color:D(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),Y(R,{flexDirection:`column`,children:[J(z,{dimColor:!0,children:`HSL `}),a?.startsWith(`diff`)?J(z,{backgroundColor:D(),color:o?.colors?.text||`white`,bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`}):a===`inverseText`?J(z,{color:D(),backgroundColor:o?.colors?.permission,bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`}):J(z,{color:D(),bold:!0,children:`hsl(${l.h}, ${l.s}%, ${l.l}%)`})]})]})]})}function ot(e){let t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};let n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){let e=n[1];return{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16)}}return null}function st(e){let t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){let e=parseInt(n[1])/255,t=parseInt(n[2])/255,r=parseInt(n[3])/255,i=Math.max(e,t,r),a=Math.min(e,t,r),o=i-a,s=(i+a)/2,c=0;o!==0&&(c=s>.5?o/(2-i-a):o/(i+a));let l=0;return o!==0&&(l=i===e?((t-r)/o+(t<r?6:0))/6:i===t?((r-e)/o+2)/6:((e-t)/o+4)/6),{h:Math.round(l*360),s:Math.round(c*100),l:Math.round(s*100)}}let r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){let e=r[1],t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,i=parseInt(e.substr(4,2),16)/255,a=Math.max(t,n,i),o=Math.min(t,n,i),s=a-o,c=(a+o)/2,l=0;s!==0&&(l=c>.5?s/(2-a-o):s/(a+o));let u=0;return s!==0&&(u=a===t?((n-i)/s+(n<i?6:0))/6:a===n?((i-t)/s+2)/6:((t-n)/s+4)/6),{h:Math.round(u*360),s:Math.round(l*100),l:Math.round(c*100)}}return{h:0,s:50,l:50}}function ct({onBack:e,themeId:r}){let{settings:{themes:i},updateSettings:a}=H($),[o,s]=W(r),c=i.find(e=>e.id===o)||i[0],[l,u]=W(`rgb`),[f,p]=W(0),[m,h]=W(null),[g,_]=W(null),[v,y]=W(``),[b,x]=W(``),[S,C]=W(!1),[w,T]=W(0),ee=je(e=>{a(t=>{let n=t.themes.findIndex(e=>e.id===o);n!==-1&&e(t.themes[n])})},[o,a]),E=e=>{if(f>=2&&n(e)){let n=t(e),r=D[f-2];ee(e=>{e.colors[r]=n})}};B((t,n)=>{if(S){if(n.escape){C(!1),e();return}return}if(m===null&&g===null){if(t.length>1&&!n.ctrl&&!n.meta){E(t);return}if(n.escape)C(!0),T(0);else if(n.ctrl&&t===`a`)u(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(n.upArrow)p(e=>Math.max(0,e-1));else if(n.downArrow)p(e=>Math.min(D.length+1,e+1));else if(n.return)if(f===0)_(`name`),y(c.name),x(c.name);else if(f===1)_(`id`),y(c.id),x(c.id);else{let e=f-2,t=D[e],n=c.colors[t];h(e),y(n),x(n)}}else if(m!==null)n.ctrl&&t===`a`&&u(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(g!==null)if(n.return){if(g===`id`){let e=o;s(v),a(t=>{let n=t.themes.findIndex(t=>t.id===e);n!==-1&&(t.themes[n].id=v)})}else ee(e=>{e.name=v});_(null),y(``),x(``)}else n.escape?(_(null),y(``),x(``)):n.backspace||n.delete?y(e=>e.slice(0,-1)):t&&y(e=>e+t)});let D=Object.keys(c.colors),O=(e,t)=>{let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!n)return e;let r=parseInt(n[1]),i=parseInt(n[2]),a=parseInt(n[3]);switch(t){case`hex`:{let e=e=>e.toString(16).padStart(2,`0`);return`#${e(r)}${e(i)}${e(a)}`}case`hsl`:{let e=r/255,t=i/255,n=a/255,o=Math.max(e,t,n),s=Math.min(e,t,n),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===e?((t-n)/c+(t<n?6:0))/6:o===t?((n-e)/c+2)/6:((e-t)/c+4)/6),`hsl(${Math.round(d*360)}, ${Math.round(u*100)}%, ${Math.round(l*100)}%)`}case`rgb`:default:return e}},te=e=>({autoAccept:`Auto-accept edits mode indicator`,bashBorder:`Bash command border`,claude:`Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.`,claudeShimmer:`Color used for the shimmering effect on the thinking verb.`,claudeBlue_FOR_SYSTEM_SPINNER:`System spinner color (blue variant)`,claudeBlueShimmer_FOR_SYSTEM_SPINNER:`System spinner shimmer color (blue variant)`,permission:`Permission prompt color`,permissionShimmer:`Permission prompt shimmer color`,planMode:`Plan mode indicator`,ide:`Color used for IDE-related messages.`,promptBorder:`Input prompt border color`,promptBorderShimmer:`Input prompt border shimmer color`,text:`Code color. Used in diffs.`,inverseText:`Inverse text color. Used for the text of tabs, where the background is filled in.`,inactive:`Inactive/dimmed text. Used for line numbers and less prominent text.`,subtle:`Subtle text. Used for help text and secondary information.`,suggestion:`Suggestion text color. Used for suggestions for theme names and various other things.`,remember:`Remember/note color. Used for various text relating to memories.`,background:`Background color for certain UI elements`,success:`Success indicator. Used for the bullet on successful tool calls, and various success messages (such as sign in successful).`,error:`Error indicator`,warning:`Warning indicator`,warningShimmer:`Warning shimmer color`,diffAdded:`Added diff background`,diffRemoved:`Removed diff background`,diffAddedDimmed:`Added diff background (dimmed)`,diffRemovedDimmed:`Removed diff background (dimmed)`,diffAddedWord:`Added word highlight`,diffRemovedWord:`Removed word highlight`,diffAddedWordDimmed:`Added word highlight (dimmed)`,diffRemovedWordDimmed:`Removed word highlight (dimmed)`,red_FOR_SUBAGENTS_ONLY:`Red color for sub agents`,blue_FOR_SUBAGENTS_ONLY:`Blue color for sub agents`,green_FOR_SUBAGENTS_ONLY:`Green color for sub agents`,yellow_FOR_SUBAGENTS_ONLY:`Yellow color for sub agents`,purple_FOR_SUBAGENTS_ONLY:`Purple color for sub agents`,orange_FOR_SUBAGENTS_ONLY:`Orange color for sub agents`,pink_FOR_SUBAGENTS_ONLY:`Pink color for sub agents`,cyan_FOR_SUBAGENTS_ONLY:`Cyan color for sub agents`,professionalBlue:`Professional blue color for business contexts?`,rainbow_red:`"ultrathink" rainbow - red`,rainbow_orange:`"ultrathink" rainbow - orange`,rainbow_yellow:`"ultrathink" rainbow - yellow`,rainbow_green:`"ultrathink" rainbow - green`,rainbow_blue:`"ultrathink" rainbow - blue`,rainbow_indigo:`"ultrathink" rainbow - indigo`,rainbow_violet:`"ultrathink" rainbow - violet`,rainbow_red_shimmer:`"ultrathink" rainbow (shimmer) - red`,rainbow_orange_shimmer:`"ultrathink" rainbow (shimmer) - orange`,rainbow_yellow_shimmer:`"ultrathink" rainbow (shimmer) - yellow`,rainbow_green_shimmer:`"ultrathink" rainbow (shimmer) - green`,rainbow_blue_shimmer:`"ultrathink" rainbow (shimmer) - blue`,rainbow_indigo_shimmer:`"ultrathink" rainbow (shimmer) - indigo`,rainbow_violet_shimmer:`"ultrathink" rainbow (shimmer) - violet`,clawd_body:`"Clawd" character body color`,clawd_background:`"Clawd" character background color`,userMessageBackground:`Background color for user messages`,bashMessageBackgroundColor:`Background color for bash command output`,memoryBackgroundColor:`Background color for memory/context information`,rate_limit_fill:`Rate limit indicator fill color`,rate_limit_empty:`Rate limit indicator empty/background color`})[e]||``,k=Math.max(...D.map(e=>e.length));return Y(R,{children:[Y(R,{flexDirection:`column`,width:`50%`,children:[J(R,{children:Y(X,{children:[`Editing theme “`,c.name,`” (`,c.id,`)`]})}),S?Y(R,{flexDirection:`column`,marginTop:1,children:[J(R,{marginBottom:1,children:Y(z,{bold:!0,children:[`Would you like to make “`,c.name,`” your current Claude Code theme?`]})}),J(qe,{items:[{name:`Yes`,desc:`Set ${c.id} as active theme`},{name:`No`,desc:`Go back without changing theme`}],selectedIndex:w,onSelect:T,onSubmit:()=>{w===0&&d(c.id),C(!1),e()}}),J(z,{dimColor:!0,children:`enter to select, esc to cancel`})]}):m===null&&g===null?Y(q,{children:[Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`enter to edit theme name, id, or color`}),J(z,{dimColor:!0,children:`ctrl+a to toggle rgb, hex, hsl`}),J(z,{dimColor:!0,children:`paste color from clipboard (when on color)`}),J(z,{dimColor:!0,children:`esc to go back`})]}),f<2?Y(R,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:`yellow`,flexDirection:`column`,paddingLeft:1,children:[J(z,{bold:!0,children:f===0?`Theme Name`:`Theme ID`}),J(z,{children:f===0?`The display name for this theme`:"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):Y(R,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:c.colors[D[f-2]],flexDirection:`column`,paddingLeft:1,children:[J(it,{colorKey:D[f-2],theme:c,bold:!0}),J(z,{children:te(D[f-2])})]}),Y(R,{flexDirection:`column`,children:[Y(R,{children:[J(z,{color:f===0?`yellow`:`white`,children:f===0?`❯ `:` `}),J(z,{bold:!0,children:`Name: `}),J(z,{children:c.name})]}),Y(R,{marginBottom:1,children:[J(z,{color:f===1?`yellow`:`white`,children:f===1?`❯ `:` `}),J(z,{bold:!0,children:`ID: `}),J(z,{children:c.id})]}),(()=>{if(f<2)return Y(q,{children:[D.slice(0,20).map((e,t)=>{let n=t+2;return Y(R,{children:[J(z,{color:f===n?`yellow`:`white`,children:f===n?`❯ `:` `}),J(R,{width:k+2,children:J(z,{children:J(it,{colorKey:e,theme:c,bold:!0})})}),J(Q,{color:c.colors[e],children:O(c.colors[e],l)})]},e)}),D.length>20&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,D.length-20,` more below`]})]});let e=f-2,t=Math.max(0,e-10),n=Math.min(D.length,t+20),r=Math.max(0,n-20),i=D.slice(r,n);return Y(q,{children:[r>0&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t+2;return Y(R,{children:[J(z,{color:f===n?`yellow`:`white`,children:f===n?`❯ `:` `}),J(R,{width:k+2,children:J(z,{children:J(it,{colorKey:e,theme:c,bold:!0})})}),J(Q,{color:c.colors[e],children:O(c.colors[e],l)})]},e)}),n<D.length&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,D.length-n,` more below`]})]})})()]})]}):g?Y(R,{flexDirection:`column`,marginTop:1,children:[Y(z,{children:[`Editing `,g===`name`?`theme name`:`theme ID`,`:`]}),J(R,{borderStyle:`round`,borderColor:`yellow`,paddingX:1,children:J(z,{children:v})}),J(z,{dimColor:!0,children:`enter to save, esc to cancel`})]}):J(at,{initialValue:b,colorKey:D[m],theme:c,onColorChange:e=>{y(e),ee(t=>{t.colors[D[m]]=e})},onExit:()=>{ee(e=>{e.colors[D[m]]=v}),h(null),y(``),x(``)}})]}),J(R,{width:`50%`,children:J(rt,{theme:c})})]})}const lt=`https://raw.githubusercontent.com/Piebald-AI/claude-code-themes/main`,ut=`${lt}/index.json`,dt=2e4;async function ft(){N(`Fetching community theme index from ${ut}`);let e=await fetch(ut,{headers:{Accept:`application/json`},signal:AbortSignal.timeout(dt)});if(!e.ok)throw Error(`Failed to fetch community theme index: ${e.status} ${e.statusText}`);return JSON.parse(await re(e))}async function pt(e){let t=`${lt}/themes/${e}.json`;N(`Fetching community theme from ${t}`);let n=await fetch(t,{headers:{Accept:`application/json`},signal:AbortSignal.timeout(dt)});if(!n.ok)throw Error(`Failed to fetch community theme "${e}": ${n.status} ${n.statusText}`);return JSON.parse(await re(n))}function mt({onBack:e}){let{updateSettings:t}=H($),[n,r]=W({status:`loading`}),[i,a]=W(0),[o,s]=W(null),[c,l]=W(!1),[u,d]=W(null),f=Ne(0);U(()=>{ft().then(e=>{r({status:`loaded`,entries:e})}).catch(e=>{r({status:`error`,message:e.message})})},[]);let p=n.status===`loaded`?n.entries:[],m=je(async e=>{let t=++f.current;l(!0),d(null);try{let n=await pt(e);if(t!==f.current)return;s(ie(n,le))}catch{if(t!==f.current)return;s(null),d(`Failed to load preview.`)}finally{t===f.current&&l(!1)}},[]),h=je(async e=>{d(`Downloading theme…`);try{let n=ie(await pt(e.id),le),r=!1;t(e=>{e.themes.some(e=>e.id===n.id)||(e.themes.push(n),r=!0)}),d(r?`Added "${n.name}" to your themes!`:`Theme "${n.name}" (${n.id}) is already in your config.`)}catch{d(`Failed to download theme.`)}},[t]);return B((t,r)=>{if(r.escape){e();return}if(n.status!==`loaded`)return;let o=n.entries.length;if(o!==0){if(r.upArrow)a(e=>Math.max(0,e-1)),s(null),d(null);else if(r.downArrow)a(e=>Math.min(o-1,e+1)),s(null),d(null);else if(t===` `){let e=n.entries[i];e&&m(e.id)}else if(r.return){let e=n.entries[i];e&&h(e)}}}),n.status===`loading`?Y(R,{flexDirection:`column`,children:[J(X,{children:`Community Themes`}),J(z,{children:`Loading community themes…`})]}):n.status===`error`?Y(R,{flexDirection:`column`,children:[J(X,{children:`Community Themes`}),Y(z,{color:`red`,children:[`Error: `,n.message]}),J(z,{dimColor:!0,children:`esc to go back`})]}):Y(R,{children:[Y(R,{flexDirection:`column`,width:`50%`,children:[J(X,{children:`Community Themes`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`space to preview theme`}),J(z,{dimColor:!0,children:`enter to download theme`}),J(z,{dimColor:!0,children:`esc to go back`})]}),J(R,{flexDirection:`column`,children:p.map((e,t)=>Y(z,{color:i===t?`yellow`:void 0,children:[i===t?`❯ `:` `,e.name,` (`,e.id,`) by @`,e.author]},e.id))}),u&&J(R,{marginTop:1,children:J(z,{color:`cyan`,children:u})}),c&&J(R,{marginTop:1,children:J(z,{dimColor:!0,children:`Loading preview…`})})]}),J(R,{width:`50%`,children:o?J(rt,{theme:o}):J(R,{flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:10,children:J(z,{dimColor:!0,children:`Press space to preview the selected theme.`})})})]})}function ht(e){return e.map(e=>`${e.name} (${e.id})`)}function gt({onBack:e}){let{settings:{themes:t},updateSettings:n}=H($),[r,i]=W(0),[a,o]=W(null),[s,c]=W(!0),[l,u]=W(!1),d=t.length+1,f=()=>{let e={colors:{...(t[0]||M.themes[0]).colors},name:`New Custom Theme`,id:`custom-${Date.now()}`};n(t=>{t.themes.push(e)}),o(e.id),c(!1)},p=e=>{t.length<=1||(n(t=>{t.themes=t.themes.filter(t=>t.id!==e)}),r>=t.length-1&&i(Math.max(0,t.length-2)))},m=()=>{n(e=>{e.themes=[...M.themes]}),i(0)},h=r===t.length;if(B((n,a)=>{if(a.escape)e();else if(a.upArrow)i(e=>Math.max(0,e-1));else if(a.downArrow)i(e=>Math.min(d-1,e+1));else if(a.return)if(h)u(!0),c(!1);else{let e=t[r];e&&(o(e.id),c(!1))}else if(n===`n`)f();else if(n===`d`){if(!h){let e=t[r];e&&p(e.id)}}else a.ctrl&&n===`r`&&m()},{isActive:s}),l)return J(mt,{onBack:()=>{u(!1),c(!0)}});if(a)return J(ct,{themeId:a,onBack:()=>{o(null),c(!0)}});let g=ht(t),_=t.find(e=>g[r]?.includes(`(${e.id})`))||t[0];return t.length===0?J(R,{children:Y(R,{flexDirection:`column`,width:`100%`,children:[J(X,{children:`Themes`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`n to create a new theme`}),J(z,{dimColor:!0,children:`esc to go back`})]}),J(z,{children:`No themes available!`})]})}):Y(R,{children:[Y(R,{flexDirection:`column`,width:`50%`,children:[J(X,{children:`Themes`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`n to create a new theme`}),J(z,{dimColor:!0,children:`d to delete a theme`}),J(z,{dimColor:!0,children:`ctrl+r to delete all themes and restore built-in`}),J(z,{dimColor:!0,children:`enter to edit theme`}),J(z,{dimColor:!0,children:`esc to go back`})]}),Y(R,{flexDirection:`column`,children:[g.map((e,t)=>Y(z,{color:r===t?`yellow`:void 0,children:[r===t?`❯ `:` `,e]},t)),Y(z,{color:h?`blue`:void 0,bold:h,children:[h?`❯ `:` `,`Browse community themes…`]})]})]}),J(R,{width:`50%`,children:h?J(R,{flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:10,children:J(z,{dimColor:!0,children:`Press enter to browse community themes.`})}):J(rt,{theme:_})})]})}function _t(e,t,n){let r=Math.max(0,e-Math.floor(n/2)),i=Math.min(t,r+n);return{start:Math.max(0,i-n),end:i}}function vt({onBack:e}){let{settings:{thinkingVerbs:{format:t,verbs:n},themes:r},updateSettings:i}=H($),a=[`format`,`verbs`],[o,s]=W(0),c=a[o],[l,u]=W(0),[d,f]=W(!1),[p,m]=W(``),[h,g]=W(!1),[_,v]=W(!1),[y,b]=W(t),x=me(),S=(r.find(e=>e.id===x)||r.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;return B((r,o)=>{if(_){o.return?(i(e=>{e.thinkingVerbs.format=y}),v(!1)):o.escape?(b(t),v(!1)):o.backspace||o.delete?b(e=>e.slice(0,-1)):r&&b(e=>e+r);return}if(d||h){o.return&&p.trim()?(h?(i(e=>{e.thinkingVerbs.verbs.push(p.trim())}),g(!1)):(i(e=>{e.thinkingVerbs.verbs[l]=p.trim()}),f(!1)),m(``)):o.escape?(m(``),f(!1),g(!1)):o.backspace||o.delete?m(e=>e.slice(0,-1)):r&&m(e=>e+r);return}o.escape?e():o.return?c===`format`&&(b(t),v(!0)):o.tab?o.shift?s(e=>e===0?a.length-1:e-1):s(e=>e===a.length-1?0:e+1):o.upArrow?c===`verbs`&&n.length>0&&u(e=>e>0?e-1:n.length-1):o.downArrow?c===`verbs`&&n.length>0&&u(e=>e<n.length-1?e+1:0):r===`e`&&c===`verbs`?n.length>0&&(m(n[l]),f(!0)):r===`d`&&c===`verbs`?n.length>1&&(i(e=>{e.thinkingVerbs.verbs=e.thinkingVerbs.verbs.filter((e,t)=>t!==l)}),l>=n.length-1&&u(Math.max(0,n.length-2))):r===`n`&&c===`verbs`?(g(!0),m(``)):o.ctrl&&r===`r`&&c===`verbs`&&(i(e=>{e.thinkingVerbs.verbs=[...M.thinkingVerbs.verbs]}),u(0))}),Y(R,{children:[Y(R,{flexDirection:`column`,width:`50%`,children:[Y(R,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`Thinking Verbs`}),Y(R,{flexDirection:`column`,children:[J(z,{dimColor:!0,children:c===`format`?`enter to edit format`:`changes auto-saved`}),J(z,{dimColor:!0,children:`esc to go back`}),J(z,{dimColor:!0,children:`tab to switch sections`})]})]}),J(R,{marginBottom:1,children:J(z,{dimColor:!0,children:`Customize the verbs shown during generation and their format.`})}),Y(R,{flexDirection:`column`,children:[Y(z,{children:[J(z,{color:c===`format`?`yellow`:void 0,children:c===`format`?`❯ `:` `}),J(z,{bold:!0,color:c===`format`?`yellow`:void 0,children:`Format`})]}),c===`format`&&(_?Y(z,{dimColor:!0,children:[` `,`enter to save`]}):Y(z,{dimColor:!0,children:[` `,`enter to edit`]}))]}),J(R,{marginLeft:2,marginBottom:1,children:J(R,{borderStyle:`round`,borderColor:_?`yellow`:`gray`,children:J(z,{children:_?y:t})})}),J(R,{children:Y(z,{children:[J(z,{color:c===`verbs`?`yellow`:void 0,children:c===`verbs`?`❯ `:` `}),J(z,{bold:!0,color:c===`verbs`?`yellow`:void 0,children:`Verbs`})]})}),c===`verbs`&&J(R,{flexDirection:`column`,children:Y(z,{dimColor:!0,children:[` `,`e to edit · d to delete · n to add new · ctrl+r to reset`]})}),J(R,{marginLeft:2,marginBottom:1,children:Y(R,{flexDirection:`column`,children:[(()=>{let{start:e,end:t}=_t(l,n.length,8),r=n.slice(e,t);return Y(q,{children:[e>0&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↑ `,e,` more above`]}),r.map((t,n)=>{let r=e+n;return Y(z,{color:c===`verbs`&&r===l?`cyan`:void 0,children:[c===`verbs`&&r===l?`❯ `:` `,t]},r)}),t<n.length&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,n.length-t,` more below`]})]})})(),h&&Y(R,{alignItems:`center`,children:[J(z,{color:`yellow`,children:`❯ `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:p})})]}),d&&Y(R,{marginTop:1,alignItems:`center`,children:[J(z,{children:`Editing: `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:p})})]})]})})]}),Y(R,{width:`50%`,flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,children:`Preview`})}),J(R,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:Y(z,{children:[Y(z,{color:S,children:[`✻ `,t.replace(/\{\}/g,n[l]??``),` `]}),J(z,{children:`(esc to interrupt)`})]})})]})]})}const yt=e=>e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).replace(/(\d+)/g,` $1 `).replace(/\s+/g,` `).trim().replace(/^./,e=>e.toUpperCase()),bt=e=>{let t=Math.max(...e.map(e=>e.length));return e.map(e=>e.padEnd(t))},xt=Object.entries(Ue).map(([e,t])=>({name:yt(e),phases:t.frames.map(e=>e.trimEnd()),reverseMirror:!1,updateInterval:t.interval})),St=[{name:`Default`,phases:M.thinkingStyle.phases,reverseMirror:M.thinkingStyle.reverseMirror},{name:`Wave`,phases:[`▁`,`▃`,`▄`,`▅`,`▆`,`▇`,`█`],reverseMirror:!0},{name:`Glow`,phases:[`░`,`▒`,`▓`,`█`],reverseMirror:!0},{name:`Partial block`,phases:[`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`,`█`],reverseMirror:!0},{name:`Colors`,phases:[`🔴`,`🟠`,`🟡`,`🟢`,`🔵`,`🟣`],reverseMirror:!1},...xt];function Ct({onBack:e}){let{settings:{thinkingStyle:{phases:t,updateInterval:n,reverseMirror:r},themes:i},updateSettings:a}=H($),o=[`reverseMirror`,`updateInterval`,`phases`,`presets`],[s,c]=W(0),l=o[s],[u,d]=W(0),[f,p]=W(0),[m,h]=W(!1),[g,_]=W(``),[v,y]=W(!1),[b,x]=W(!1),[S,C]=W(n.toString()),[w,T]=W(0),ee=me(),E=(i.find(e=>e.id===ee)||i.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;U(()=>{if(t.length>0){let e=r?[...t,...[...t].reverse().slice(1,-1)]:t,i=setInterval(()=>{T(t=>(t+1)%e.length)},n);return()=>clearInterval(i)}},[t,n,r]),U(()=>{d(e=>Math.min(e,Math.max(0,t.length-1)))},[t.length]),B((r,i)=>{if(b){if(i.return){let e=parseInt(S);!isNaN(e)&&e>0&&a(t=>{t.thinkingStyle.updateInterval=e}),x(!1)}else i.escape?(C(n.toString()),x(!1)):i.backspace||i.delete?C(e=>e.slice(0,-1)):r&&r.match(/^[0-9]$/)&&C(e=>e+r);return}if(m||v){if(i.return&&g.length){let e=v?[...t,g]:t.map((e,t)=>t===u?g:e);a(t=>{t.thinkingStyle.phases=bt(e)}),h(!1),_(``)}else i.escape?(_(``),h(!1),y(!1)):i.backspace||i.delete?_(e=>e.slice(0,-1)):r&&_(e=>e+r);return}if(i.escape)e();else if(i.return)if(l===`updateInterval`)C(n.toString()),x(!0);else if(l===`presets`){let e=St[f];a(t=>{t.thinkingStyle.phases=bt([...e.phases]),t.thinkingStyle.reverseMirror=e.reverseMirror,e.updateInterval!==void 0&&(t.thinkingStyle.updateInterval=e.updateInterval)})}else l===`reverseMirror`&&a(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(i.tab)i.shift?c(e=>e===0?o.length-1:e-1):c(e=>e===o.length-1?0:e+1);else if(i.upArrow)l===`phases`&&t.length>0?d(e=>e>0?e-1:t.length-1):l===`presets`&&p(e=>e>0?e-1:St.length-1);else if(i.downArrow)l===`phases`&&t.length>0?d(e=>e<t.length-1?e+1:0):l===`presets`&&p(e=>e<St.length-1?e+1:0);else if(r===` `)l===`reverseMirror`&&a(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(r===`e`&&l===`phases`)t.length>0&&(_(t[u]),h(!0));else if(r===`a`&&l===`phases`)y(!0),_(``);else if(r===`d`&&l===`phases`)t.length>1&&a(e=>{e.thinkingStyle.phases=bt(t.filter((e,t)=>t!==u))});else if(r===`w`&&l===`phases`){if(u>0){let e=[...t];[e[u-1],e[u]]=[e[u],e[u-1]],a(t=>{t.thinkingStyle.phases=e}),d(e=>e-1)}}else if(r===`s`&&l===`phases`){if(u<t.length-1){let e=[...t];[e[u],e[u+1]]=[e[u+1],e[u]],a(t=>{t.thinkingStyle.phases=e}),d(e=>e+1)}}else i.ctrl&&r===`r`&&(a(e=>{e.thinkingStyle=M.thinkingStyle}),d(0),p(0))});let D=r?`●`:`○`,O=(()=>r?[...t,...[...t].reverse().slice(1,-1)]:t)(),te=O.length>0?O[w]:`·`;return J(R,{children:Y(R,{flexDirection:`column`,width:`100%`,children:[Y(R,{flexDirection:`row`,width:`100%`,children:[Y(R,{marginBottom:1,flexDirection:`column`,width:`50%`,children:[J(X,{children:`Thinking style`}),Y(R,{flexDirection:`column`,children:[Y(z,{dimColor:!0,children:[`enter to`,` `,l===`updateInterval`?`edit interval`:l===`presets`?`apply preset`:`save`]}),J(z,{dimColor:!0,children:`esc to go back`}),J(z,{dimColor:!0,children:`tab to switch sections`})]})]}),Y(R,{width:`50%`,flexDirection:`column`,children:[J(R,{children:J(z,{bold:!0,children:`Preview`})}),Y(R,{borderStyle:`single`,borderColor:`gray`,paddingX:1,flexDirection:`row`,children:[J(R,{width:(te?.length??0)+1,children:J(z,{color:E,children:te})}),Y(z,{children:[J(z,{color:E,children:`Thinking… `}),J(z,{children:`(esc to interrupt)`})]})]})]})]}),Y(R,{flexDirection:`row`,gap:4,children:[Y(R,{flexDirection:`column`,children:[Y(z,{children:[J(z,{color:l===`reverseMirror`?`yellow`:void 0,children:l===`reverseMirror`?`❯ `:` `}),J(z,{bold:!0,color:l===`reverseMirror`?`yellow`:void 0,children:`Reverse-mirror phases`})]}),l===`reverseMirror`&&Y(z,{dimColor:!0,children:[` `,`space to toggle`]}),J(R,{marginLeft:2,marginBottom:1,children:Y(z,{children:[D,` `,r?`Enabled`:`Disabled`]})})]}),Y(R,{flexDirection:`column`,children:[Y(z,{children:[J(z,{color:l===`updateInterval`?`yellow`:void 0,children:l===`updateInterval`?`❯ `:` `}),J(z,{bold:!0,color:l===`updateInterval`?`yellow`:void 0,children:`Update interval (ms)`})]}),l===`updateInterval`&&(b?Y(z,{dimColor:!0,children:[` `,`enter to save`]}):Y(z,{dimColor:!0,children:[` `,`enter to edit`]})),J(R,{marginLeft:2,marginBottom:1,children:J(R,{borderStyle:`round`,borderColor:b?`yellow`:`gray`,children:J(z,{children:b?S:n})})})]})]}),J(R,{children:Y(z,{children:[J(z,{color:l===`phases`?`yellow`:void 0,children:l===`phases`?`❯ `:` `}),J(z,{bold:!0,color:l===`phases`?`yellow`:void 0,children:`Phases`})]})}),l===`phases`&&J(R,{marginBottom:1,flexDirection:`column`,children:Y(z,{dimColor:!0,children:[` `,`[e]dit`,` `,`[a]dd`,` `,`[d]elete`,` `,`[w]move up`,` `,`[s]move down`]})}),J(R,{marginLeft:2,marginBottom:1,children:Y(R,{flexDirection:`column`,children:[(()=>{let{start:e,end:n}=_t(u,t.length,8),r=t.slice(e,n);return Y(q,{children:[e>0&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↑ `,e,` more above`]}),r.map((t,n)=>{let r=e+n;return Y(z,{color:l===`phases`&&r===u?`cyan`:void 0,children:[l===`phases`&&r===u?`❯ `:` `,t]},r)}),n<t.length&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,t.length-n,` more below`]})]})})(),v&&Y(R,{children:[J(z,{color:`yellow`,children:`❯ `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:g})})]}),m&&Y(R,{marginTop:1,children:[J(z,{children:`Editing: `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:g})})]})]})}),J(R,{children:Y(z,{children:[J(z,{color:l===`presets`?`yellow`:void 0,children:l===`presets`?`❯ `:` `}),J(z,{bold:!0,color:l===`presets`?`yellow`:void 0,children:`Presets`})]})}),l===`presets`&&Y(z,{dimColor:!0,children:[` `,`Selecting one will overwrite your choice of phases and interval`]}),J(R,{marginLeft:2,marginBottom:1,children:J(R,{flexDirection:`column`,children:(()=>{let{start:e,end:t}=_t(f,St.length,12),n=St.slice(e,t),r=e=>{let t=e.phases.join(``);return t.length>30?t.slice(0,27)+`…`:t};return Y(q,{children:[e>0&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↑ `,e,` more above`]}),n.map((t,n)=>{let i=e+n,a=l===`presets`&&i===f;return Y(z,{color:a?`cyan`:void 0,children:[a?`❯ `:` `,t.name,` `,r(t)]},i)}),t<St.length&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,St.length-t,` more below`]})]})})()})}),J(R,{marginTop:1,children:J(z,{dimColor:!0,children:`ctrl+r to reset all settings to default`})})]})})}function wt(e,t){let n=Ne(!0);U(()=>{if(n.current){n.current=!1;return}return e()},t)}const Tt=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],Et=[{label:`none`,value:`none`},{label:`single`,value:`single`},{label:`double`,value:`double`},{label:`round`,value:`round`},{label:`bold`,value:`bold`},{label:`singleDouble`,value:`singleDouble`},{label:`doubleSingle`,value:`doubleSingle`},{label:`classic`,value:`classic`},{label:`topBottomSingle`,value:`topBottomSingle`},{label:`topBottomDouble`,value:`topBottomDouble`},{label:`topBottomBold`,value:`topBottomBold`}];function Dt({onBack:e}){let{settings:t,updateSettings:n}=H($),[r,i]=W(!1),[a,o]=W(!1),[s,c]=W(!1),[l,u]=W(()=>t.userMessageDisplay.format),[d,f]=W(()=>t.userMessageDisplay.paddingX===`default`?`default`:`custom`),[p,m]=W(()=>t.userMessageDisplay.paddingY===`default`?`default`:`custom`),[h,g]=W(()=>t.userMessageDisplay.paddingX===`default`?`0`:String(t.userMessageDisplay.paddingX)),[_,v]=W(()=>t.userMessageDisplay.paddingY===`default`?`0`:String(t.userMessageDisplay.paddingY)),[y,b]=W(t.userMessageDisplay.fitBoxToContent),[x,S]=W(0),[C,w]=W(()=>[...t.userMessageDisplay.styling]),[T,ee]=W(()=>t.userMessageDisplay.foregroundColor===`default`?`default`:`custom`),[E,D]=W(()=>t.userMessageDisplay.foregroundColor===`default`?`rgb(255,255,255)`:t.userMessageDisplay.foregroundColor),[O,te]=W(()=>{let e=t.userMessageDisplay.backgroundColor;return e===null?`none`:e===`default`?`default`:`custom`}),[k,ne]=W(()=>{let e=t.userMessageDisplay.backgroundColor;return e===null||e===`default`?`rgb(0,0,0)`:e}),[A,re]=W(()=>Et.findIndex(e=>e.value===t.userMessageDisplay.borderStyle)),[j,ie]=W(()=>t.userMessageDisplay.borderColor),[ae,oe]=W(null),[se,N]=W(``),ce=me(),P=t.themes?.find(e=>e.id===ce)||t.themes?.[0],[F,I]=W(`text`),le=[`format`,`styling`,`foreground`,`background`],ue=[`borderStyle`,`borderColor`,`paddingX`,`paddingY`,`fitBoxToContent`],[de,fe]=W(0),[pe,he]=W(0),L=F===`text`?le[de]:ue[pe],ge=()=>{n(e=>{e.userMessageDisplay.format=l,e.userMessageDisplay.styling=[...C],e.userMessageDisplay.foregroundColor=T===`default`?`default`:E,e.userMessageDisplay.backgroundColor=O===`none`?null:O===`default`?`default`:k,e.userMessageDisplay.borderStyle=Et[A].value,e.userMessageDisplay.borderColor=j,e.userMessageDisplay.paddingX=d===`default`?`default`:parseInt(h)||0,e.userMessageDisplay.paddingY=p===`default`?`default`:parseInt(_)||0,e.userMessageDisplay.fitBoxToContent=y})},_e=()=>{u(M.userMessageDisplay.format),w([...M.userMessageDisplay.styling]);let e=M.userMessageDisplay.foregroundColor;ee(e===`default`?`default`:`custom`),D(e===`default`?`rgb(255,255,255)`:e);let t=M.userMessageDisplay.backgroundColor;te(t===null?`none`:t===`default`?`default`:`custom`),ne(t===null||t===`default`?`rgb(0,0,0)`:t),re(Et.findIndex(e=>e.value===M.userMessageDisplay.borderStyle)),ie(M.userMessageDisplay.borderColor);let r=M.userMessageDisplay.paddingX,i=M.userMessageDisplay.paddingY;f(r===`default`?`default`:`custom`),m(i===`default`?`default`:`custom`),g(r===`default`?`0`:String(r)),v(i===`default`?`0`:String(i)),b(M.userMessageDisplay.fitBoxToContent),n(e=>{e.userMessageDisplay={...M.userMessageDisplay}})};wt(()=>{ge()},[l,C,T,E,O,k,A,j,d,p,h,_,y]),B((n,l)=>{if(r){l.return?i(!1):l.escape?(u(t.userMessageDisplay.format),i(!1)):l.backspace||l.delete?u(e=>e.slice(0,-1)):n&&u(e=>e+n);return}if(a){l.return?o(!1):l.escape?(g(String(t.userMessageDisplay.paddingX)),o(!1)):l.backspace||l.delete?g(e=>e.slice(0,-1)):n&&/^\d$/.test(n)&&g(e=>e+n);return}if(s){l.return?c(!1):l.escape?(v(String(t.userMessageDisplay.paddingY)),c(!1)):l.backspace||l.delete?v(e=>e.slice(0,-1)):n&&/^\d$/.test(n)&&v(e=>e+n);return}if(ae===null){if(l.escape)e();else if(l.ctrl&&n===`r`)_e();else if(l.leftArrow||l.rightArrow)I(e=>e===`text`?`border`:`text`);else if(l.tab)F===`text`?l.shift?fe(e=>e===0?le.length-1:e-1):fe(e=>e===le.length-1?0:e+1):l.shift?he(e=>e===0?ue.length-1:e-1):he(e=>e===ue.length-1?0:e+1);else if(l.return)L===`format`?i(!0):L===`paddingX`?d===`custom`&&o(!0):L===`paddingY`?p===`custom`&&c(!0):L===`foreground`?T===`custom`&&(N(E),oe(`foreground`)):L===`background`?O===`custom`&&(N(k),oe(`background`)):L===`borderColor`&&(N(j),oe(`border`));else if(l.upArrow)L===`styling`?S(e=>Math.max(0,e-1)):L===`borderStyle`?re(e=>e===0?Et.length-1:e-1):L===`paddingX`?f(e=>e===`default`?`custom`:`default`):L===`paddingY`?m(e=>e===`default`?`custom`:`default`):L===`foreground`?ee(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!E||E===``)&&D(`rgb(255,255,255)`),t}):L===`background`&&te(e=>{let t=e===`default`?`custom`:e===`custom`?`none`:`default`;return t===`custom`&&(!k||k===``)&&ne(`rgb(0,0,0)`),t});else if(l.downArrow)L===`styling`?S(e=>Math.min(Tt.length-1,e+1)):L===`borderStyle`?re(e=>e===Et.length-1?0:e+1):L===`paddingX`?f(e=>e===`default`?`custom`:`default`):L===`paddingY`?m(e=>e===`default`?`custom`:`default`):L===`foreground`?ee(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!E||E===``)&&D(`rgb(255,255,255)`),t}):L===`background`&&te(e=>{let t=e===`default`?`none`:e===`none`?`custom`:`default`;return t===`custom`&&(!k||k===``)&&ne(`rgb(0,0,0)`),t});else if(n===` `)if(L===`styling`){let e=Tt[x].value;w(C.indexOf(e)>=0?C.filter(t=>t!==e):[...C,e])}else L===`fitBoxToContent`&&b(e=>!e)}});let ve=e=>{let t=T===`default`?P?.colors?.text:E,n=O===`none`?void 0:O===`default`?P?.colors?.userMessageBackground:k,r=Et[A].value,i=d===`default`?0:parseInt(h)||0,a=p===`default`?0:parseInt(_)||0,o=d===`default`?1:i,s=J(z,{bold:C.includes(`bold`),italic:C.includes(`italic`),underline:C.includes(`underline`),strikethrough:C.includes(`strikethrough`),inverse:C.includes(`inverse`),color:t,backgroundColor:n,children:e});if(r===`topBottomSingle`||r===`topBottomDouble`||r===`topBottomBold`){let t=r===`topBottomSingle`?`─`:r===`topBottomDouble`?`═`:`━`,n=e.length+i*2,o=t.repeat(n);return Y(R,{flexDirection:`column`,children:[J(z,{color:j,children:o}),a>0&&J(R,{height:a}),J(R,{paddingX:i,children:s}),a>0&&J(R,{height:a}),J(z,{color:j,children:o})]})}else if(r!==`none`||i>0||a>0||o>0||y){let e={};i>0&&(e.paddingX=i),d===`default`&&i===0&&(e.paddingRight=o),a>0&&(e.paddingY=a);let t=Object.keys(e).length>0?J(R,{...e,children:s}):s,n={};return r!==`none`&&(n.borderStyle=r,n.borderColor=j),y?n.alignSelf=`flex-start`:n.flexGrow=1,r===`none`?t:J(R,{...n,children:t})}else return s};return ae?J(at,{initialValue:se,theme:P,onColorChange:e=>{ae===`foreground`?D(e):ae===`background`?ne(e):ae===`border`&&ie(e)},onExit:()=>{oe(null),N(``)}}):Y(R,{flexDirection:`column`,children:[J(X,{children:`Customize how user messages are displayed`}),Y(R,{flexDirection:`column`,marginBottom:1,children:[J(z,{dimColor:!0,children:`left/right arrows to switch columns · tab to navigate options`}),J(z,{dimColor:!0,children:`enter to edit · ctrl+r to reset · esc to go back`})]}),Y(R,{flexDirection:`row`,gap:1,children:[Y(R,{flexDirection:`column`,width:`50%`,borderStyle:F===`text`?`round`:`single`,borderColor:F===`text`?`yellow`:`gray`,paddingX:1,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,color:F===`text`?`yellow`:void 0,children:`Text & Styling`})}),J(R,{children:Y(z,{color:L===`format`?`yellow`:void 0,bold:L===`format`,children:[L===`format`?`❯ `:` `,`Format String`]})}),L===`format`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:r?`enter to save · esc to cancel`:`enter to edit · use {} as message placeholder`})}),J(R,{marginLeft:2,marginBottom:1,children:J(R,{borderStyle:`round`,borderColor:r?`yellow`:`gray`,children:J(z,{children:l})})}),J(R,{children:Y(z,{color:L===`styling`?`yellow`:void 0,bold:L===`styling`,children:[L===`styling`?`❯ `:` `,`Styling`]})}),L===`styling`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:`up/down to navigate · space to toggle`})}),J(R,{marginLeft:2,marginBottom:1,flexDirection:`column`,children:Tt.map((e,t)=>J(R,{children:Y(z,{color:L===`styling`&&x===t?`cyan`:void 0,children:[L===`styling`&&x===t?`❯ `:` `,C.includes(e.value)?`●`:`○`,` `,e.label]})},e.value))}),Y(R,{flexDirection:`row`,gap:1,marginBottom:1,children:[Y(R,{flexDirection:`column`,width:`50%`,children:[J(R,{children:Y(z,{color:L===`foreground`?`yellow`:void 0,bold:L===`foreground`,children:[L===`foreground`?`❯ `:` `,`Foreground`]})}),L===`foreground`&&J(R,{marginLeft:2,children:Y(z,{dimColor:!0,children:[`up/down · `,T===`custom`?`enter`:``]})}),Y(R,{marginLeft:2,flexDirection:`column`,children:[J(R,{children:Y(z,{children:[T===`default`?`● `:`○ `,`Default`]})}),J(R,{children:Y(z,{children:[T===`custom`?`● `:`○ `,`Custom`,T===`custom`&&`: `,T===`custom`&&J(z,{color:E,children:E})]})})]})]}),Y(R,{flexDirection:`column`,width:`50%`,children:[J(R,{children:Y(z,{color:L===`background`?`yellow`:void 0,bold:L===`background`,children:[L===`background`?`❯ `:` `,`Background`]})}),L===`background`&&J(R,{marginLeft:2,children:Y(z,{dimColor:!0,children:[`up/down · `,O===`custom`?`enter`:``]})}),Y(R,{marginLeft:2,flexDirection:`column`,children:[J(R,{children:Y(z,{children:[O===`default`?`● `:`○ `,`Default`]})}),J(R,{children:Y(z,{children:[O===`none`?`● `:`○ `,`None`]})}),J(R,{children:Y(z,{children:[O===`custom`?`● `:`○ `,`Custom`,O===`custom`&&`: `,O===`custom`&&J(z,{backgroundColor:k,children:k})]})})]})]})]})]}),Y(R,{flexDirection:`column`,width:`50%`,borderStyle:F===`border`?`round`:`single`,borderColor:F===`border`?`yellow`:`gray`,paddingX:1,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,color:F===`border`?`yellow`:void 0,children:`Border & Padding`})}),J(R,{children:Y(z,{color:L===`borderStyle`?`yellow`:void 0,bold:L===`borderStyle`,children:[L===`borderStyle`?`❯ `:` `,`Border Style`]})}),L===`borderStyle`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:`up/down to navigate`})}),Y(R,{marginLeft:2,marginBottom:1,flexDirection:`row`,children:[J(R,{flexDirection:`column`,width:`50%`,children:Et.slice(0,6).map((e,t)=>J(R,{children:Y(z,{color:L===`borderStyle`&&A===t?`cyan`:void 0,children:[L===`borderStyle`&&A===t?`❯ `:` `,A===t?`● `:`○ `,e.label]})},e.value))}),J(R,{flexDirection:`column`,width:`50%`,children:Et.slice(6).map((e,t)=>{let n=t+6;return J(R,{children:Y(z,{color:L===`borderStyle`&&A===n?`cyan`:void 0,children:[L===`borderStyle`&&A===n?`❯ `:` `,A===n?`● `:`○ `,e.label]})},e.value)})})]}),J(R,{children:Y(z,{color:L===`borderColor`?`yellow`:void 0,bold:L===`borderColor`,children:[L===`borderColor`?`❯ `:` `,`Border Color`]})}),L===`borderColor`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:`enter to pick color`})}),J(R,{marginLeft:2,marginBottom:1,children:J(z,{color:j,children:j})}),Y(R,{flexDirection:`row`,gap:1,children:[Y(R,{flexDirection:`column`,width:`33%`,children:[J(R,{children:Y(z,{color:L===`paddingX`?`yellow`:void 0,bold:L===`paddingX`,children:[L===`paddingX`?`❯ `:` `,`Padding X`]})}),L===`paddingX`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:a?`enter/esc`:d===`custom`?`up/down · enter`:`up/down`})}),Y(R,{marginLeft:2,flexDirection:`column`,children:[J(R,{children:Y(z,{children:[d===`default`?`● `:`○ `,`Default`]})}),J(R,{children:Y(z,{children:[d===`custom`?`● `:`○ `,`Custom`]})}),d===`custom`&&J(R,{children:J(R,{borderStyle:`round`,borderColor:a?`yellow`:`gray`,children:J(z,{children:h})})})]})]}),Y(R,{flexDirection:`column`,width:`33%`,children:[J(R,{children:Y(z,{color:L===`paddingY`?`yellow`:void 0,bold:L===`paddingY`,children:[L===`paddingY`?`❯ `:` `,`Padding Y`]})}),L===`paddingY`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:s?`enter/esc`:p===`custom`?`up/down · enter`:`up/down`})}),Y(R,{marginLeft:2,flexDirection:`column`,children:[J(R,{children:Y(z,{children:[p===`default`?`● `:`○ `,`Default`]})}),J(R,{children:Y(z,{children:[p===`custom`?`● `:`○ `,`Custom`]})}),p===`custom`&&J(R,{children:J(R,{borderStyle:`round`,borderColor:s?`yellow`:`gray`,children:J(z,{children:_})})})]})]}),Y(R,{flexDirection:`column`,width:`33%`,children:[J(R,{children:Y(z,{color:L===`fitBoxToContent`?`yellow`:void 0,bold:L===`fitBoxToContent`,children:[L===`fitBoxToContent`?`❯ `:` `,y?`●`:`○`,` Fit box to content`]})}),L===`fitBoxToContent`&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:`space`})})]})]})]})]}),Y(R,{flexDirection:`column`,marginTop:1,paddingX:1,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,children:`Preview`})}),Y(R,{flexDirection:`row`,gap:2,children:[Y(R,{flexDirection:`column`,width:`50%`,children:[J(R,{marginBottom:1,children:J(z,{underline:!0,children:`Before (Claude Code default):`})}),J(R,{marginLeft:1,children:Y(z,{backgroundColor:P?.colors?.userMessageBackground,color:P?.colors?.text,children:[` `,`> list the dir`,` `]})}),J(R,{marginLeft:1,marginTop:1,children:Y(z,{children:[J(z,{color:P?.colors?.inactive||`#888888`,children:`●`}),J(z,{children:` The directory `}),J(z,{color:P?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(z,{children:` contains `}),J(z,{bold:!0,children:`123`}),J(z,{children:` files.`})]})})]}),Y(R,{flexDirection:`column`,width:`50%`,children:[J(R,{marginBottom:1,children:J(z,{underline:!0,children:`After (Your customization):`})}),J(R,{marginLeft:1,flexDirection:`row`,children:(()=>ve(l.replace(/\{\}/g,`list the dir`)))()}),J(R,{marginLeft:1,marginTop:1,children:Y(z,{children:[J(z,{color:P?.colors?.inactive||`#888888`,children:`●`}),J(z,{children:` The directory `}),J(z,{color:P?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(z,{children:` contains `}),J(z,{bold:!0,children:`123`}),J(z,{children:` files.`})]})})]})]})]})]})}const Ot=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],kt=[[`name`,`regex`,`regexFlags`],[`format`,`styling`],[`foreground`,`background`],[`enabled`],[`testText`]];function At({testText:e,regex:t,regexFlags:n,format:r,styling:i,foregroundColor:a,backgroundColor:o}){let s=[];try{let c=n.includes(`g`)?n:n+`g`,l=new RegExp(t,c),u=[...e.matchAll(l)];if(u.length===0)return J(z,{children:e});let d=0;return u.forEach((t,n)=>{let c=t.index,l=c+t[0].length;c>d&&s.push(J(z,{children:e.slice(d,c)},`plain-${n}`));let u=r.replace(/\{MATCH\}/g,t[0]);s.push(J(z,{bold:i.includes(`bold`),italic:i.includes(`italic`),underline:i.includes(`underline`),strikethrough:i.includes(`strikethrough`),inverse:i.includes(`inverse`),color:a,backgroundColor:o,children:u},`match-${n}`)),d=l}),d<e.length&&s.push(J(z,{children:e.slice(d)},`plain-end`)),J(q,{children:s})}catch{return J(z,{children:e})}}function jt({highlighterIndex:e,onBack:t}){let{settings:n,updateSettings:r}=H($),i=n.inputPatternHighlighters[e],a=me(),o=n.themes?.find(e=>e.id===a)||n.themes?.[0],[s,c]=W(i?.name||`New Highlighter`),[l,u]=W(i?.regex||``),[d,f]=W(i?.regexFlags||`g`),[p,m]=W(i?.format||`{MATCH}`),[h,g]=W(i?.styling||[]),[_,v]=W(i?.foregroundColor===null?`none`:`custom`),[y,b]=W(i?.foregroundColor||`rgb(255,0,255)`),[x,S]=W(i?.backgroundColor?`custom`:`none`),[C,w]=W(i?.backgroundColor||`rgb(0,0,0)`),[T,ee]=W(i?.enabled??!0),[E,D]=W(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),[O,te]=W(`name`),[k,ne]=W(!1),[A,re]=W(0),[j,ie]=W(null),[ae,oe]=W(``),[se,M]=W(null),[N,ce]=W(0),[P,F]=W(0);if(U(()=>{let e=kt[N];te(e[Math.min(P,e.length-1)])},[N,P]),U(()=>{if(!l){M(null);return}try{new RegExp(l,d),M(null)}catch(e){M(e.message)}},[l,d]),U(()=>{e>=0&&r(t=>{t.inputPatternHighlighters[e]&&(t.inputPatternHighlighters[e]={name:s,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:null,backgroundColor:x===`custom`?C:null,enabled:T})})},[e,s,l,d,p,h,_,y,x,C,T]),U(()=>{r(e=>{e.inputPatternHighlightersTestText=E})},[E]),B((e,r)=>{if(k){r.return?ne(!1):r.escape?(O===`name`&&c(i?.name||``),O===`regex`&&u(i?.regex||``),O===`regexFlags`&&f(i?.regexFlags||`g`),O===`format`&&m(i?.format||`{MATCH}`),O===`testText`&&D(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),ne(!1)):r.backspace||r.delete?(O===`name`&&c(e=>e.slice(0,-1)),O===`regex`&&u(e=>e.slice(0,-1)),O===`regexFlags`&&f(e=>e.slice(0,-1)),O===`format`&&m(e=>e.slice(0,-1)),O===`testText`&&D(e=>e.slice(0,-1))):e&&e.length===1&&(O===`name`&&c(t=>t+e),O===`regex`&&u(t=>t+e),O===`regexFlags`&&f(t=>t+e),O===`format`&&m(t=>t+e),O===`testText`&&D(t=>t+e));return}if(j===null){if(r.escape)t();else if(r.upArrow)O===`styling`&&A>0?re(e=>e-1):ce(e=>Math.max(0,e-1));else if(r.downArrow)O===`styling`&&A<Ot.length-1?re(e=>e+1):ce(e=>Math.min(kt.length-1,e+1));else if(r.leftArrow)O===`foreground`?v(e=>e===`none`?`custom`:`none`):O===`background`?S(e=>e===`none`?`custom`:`none`):F(e=>Math.max(0,e-1));else if(r.rightArrow)if(O===`foreground`)v(e=>e===`none`?`custom`:`none`);else if(O===`background`)S(e=>e===`none`?`custom`:`none`);else{let e=kt[N].length-1;F(t=>Math.min(e,t+1))}else if(r.tab){let e=kt.flat(),t=e.indexOf(O);if(r.shift){if(t>0){let n=e[t-1];for(let e=0;e<kt.length;e++){let t=kt[e].indexOf(n);if(t>=0){ce(e),F(t);break}}}}else if(t<e.length-1){let n=e[t+1];for(let e=0;e<kt.length;e++){let t=kt[e].indexOf(n);if(t>=0){ce(e),F(t);break}}}}else if(r.return)O===`name`||O===`regex`||O===`regexFlags`||O===`format`||O===`testText`?ne(!0):O===`foreground`&&_===`custom`?(oe(y),ie(`foreground`)):O===`background`&&x===`custom`&&(oe(C),ie(`background`));else if(e===` `)if(O===`styling`){let e=Ot[A].value;h.includes(e)?g(h.filter(t=>t!==e)):g([...h,e])}else O===`enabled`&&ee(!T)}}),!i)return J(R,{flexDirection:`column`,children:J(z,{color:`red`,children:`Highlighter not found`})});if(j)return J(at,{initialValue:ae,theme:o,onColorChange:e=>{j===`foreground`?b(e):j===`background`&&w(e)},onExit:()=>{ie(null),oe(``)}});let I=e=>O===e,le=e=>({color:I(e)?`yellow`:void 0,bold:I(e)});return Y(R,{flexDirection:`column`,children:[J(X,{children:`Edit Highlighter`}),J(R,{marginBottom:1,flexDirection:`column`,children:J(z,{dimColor:!0,children:`arrows to navigate · enter to edit · space to toggle · esc to go back`})}),Y(R,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(R,{flexDirection:`column`,width:`30%`,children:[Y(z,{...le(`name`),children:[I(`name`)?`❯ `:` `,`Name`]}),J(R,{marginLeft:2,children:J(R,{borderStyle:`round`,borderColor:I(`name`)?k?`green`:`yellow`:`gray`,children:J(z,{children:s||`(empty)`})})})]}),Y(R,{flexDirection:`column`,width:`45%`,children:[Y(z,{...le(`regex`),children:[I(`regex`)?`❯ `:` `,`Regex Pattern`]}),Y(R,{marginLeft:2,flexDirection:`column`,children:[J(R,{borderStyle:`round`,borderColor:I(`regex`)?k?`green`:`yellow`:se?`red`:`gray`,children:J(z,{children:l||`(empty)`})}),se&&J(z,{color:`red`,children:se})]})]}),Y(R,{flexDirection:`column`,width:`20%`,children:[Y(z,{...le(`regexFlags`),children:[I(`regexFlags`)?`❯ `:` `,`Flags`]}),J(R,{marginLeft:2,children:J(R,{borderStyle:`round`,borderColor:I(`regexFlags`)?k?`green`:`yellow`:`gray`,children:J(z,{children:d||`g`})})})]})]}),Y(R,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(R,{flexDirection:`column`,width:`50%`,children:[Y(z,{...le(`format`),children:[I(`format`)?`❯ `:` `,`Format String`]}),J(R,{marginLeft:2,children:J(R,{borderStyle:`round`,borderColor:I(`format`)?k?`green`:`yellow`:`gray`,children:J(z,{children:p||`{MATCH}`})})}),I(`format`)&&J(R,{marginLeft:2,children:Y(z,{dimColor:!0,children:[`use `,`{MATCH}`,` as placeholder`]})})]}),Y(R,{flexDirection:`column`,width:`45%`,children:[Y(z,{...le(`styling`),children:[I(`styling`)?`❯ `:` `,`Styling`]}),J(R,{marginLeft:2,flexDirection:`column`,children:Ot.map((e,t)=>{let n=h.includes(e.value),r=I(`styling`)&&A===t;return Y(z,{color:r?`cyan`:void 0,children:[r?`❯ `:` `,n?`●`:`○`,` `,e.label]},e.value)})})]})]}),Y(R,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(R,{flexDirection:`column`,width:`48%`,children:[Y(z,{...le(`foreground`),children:[I(`foreground`)?`❯ `:` `,`Foreground Color`]}),Y(R,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(z,{color:I(`foreground`)?`yellow`:void 0,children:[`[`,_===`none`?`●`:`○`,`] none`,` `,`[`,_===`custom`?`●`:`○`,`] custom`]}),_===`custom`&&J(R,{borderStyle:`round`,borderColor:I(`foreground`)?`yellow`:`gray`,children:J(z,{color:y,children:` ████ `})})]})]}),Y(R,{flexDirection:`column`,width:`48%`,children:[Y(z,{...le(`background`),children:[I(`background`)?`❯ `:` `,`Background Color`]}),Y(R,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(z,{color:I(`background`)?`yellow`:void 0,children:[`[`,x===`none`?`●`:`○`,`] none`,` `,`[`,x===`custom`?`●`:`○`,`] custom`]}),x===`custom`&&J(R,{borderStyle:`round`,borderColor:I(`background`)?`yellow`:`gray`,children:Y(z,{backgroundColor:C,children:[` `,` `,` `]})})]})]})]}),J(R,{marginBottom:1,children:Y(z,{...le(`enabled`),children:[I(`enabled`)?`❯ `:` `,`Enabled:`,` `,J(z,{color:T?`green`:`red`,children:T?`● Yes`:`○ No`})]})}),Y(R,{flexDirection:`column`,marginBottom:1,children:[Y(z,{...le(`testText`),children:[I(`testText`)?`❯ `:` `,`Test Text`]}),J(R,{marginLeft:2,children:J(R,{borderStyle:`round`,borderColor:I(`testText`)?k?`green`:`yellow`:`gray`,children:J(z,{children:E||`(empty)`})})})]}),J(R,{borderStyle:`round`,padding:1,children:Y(R,{flexDirection:`column`,children:[J(z,{bold:!0,children:`Live Preview:`}),l?J(R,{marginTop:1,children:J(At,{testText:E,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:void 0,backgroundColor:x===`custom`?C:void 0})}):J(z,{dimColor:!0,children:`Enter a regex pattern to see the preview`})]})})]})}function Mt({onBack:e}){let{settings:{inputPatternHighlighters:t,themes:n},updateSettings:r}=H($),i=me(),a=n.find(e=>e.id===i)||n[0],o=M.themes[0],s=a?.colors.success||o.colors.success,c=a?.colors.error||o.colors.error,[l,u]=W(0),[d,f]=W(null),[p,m]=W(!0),h=()=>{let e={name:`New Highlighter`,regex:``,regexFlags:`g`,format:`{MATCH}`,styling:[],foregroundColor:`rgb(255,0,255)`,backgroundColor:null,enabled:!0};r(t=>{t.inputPatternHighlighters.push(e)}),f(t.length),m(!1)},g=e=>{r(t=>{t.inputPatternHighlighters.splice(e,1)}),l>=t.length-1&&u(Math.max(0,t.length-2))},_=e=>{r(t=>{t.inputPatternHighlighters[e].enabled=!t.inputPatternHighlighters[e].enabled})},v=e=>{e<=0||(r(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e-1,0,n)}),u(e-1))},y=e=>{e>=t.length-1||(r(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e+1,0,n)}),u(e+1))};return B((n,r)=>{r.escape?e():r.upArrow?u(e=>Math.max(0,e-1)):r.downArrow&&t.length>0?u(e=>Math.min(t.length-1,e+1)):r.return&&t.length>0?(f(l),m(!1)):n===`n`?h():n===`x`&&t.length>0?g(l):n===` `&&t.length>0?_(l):n===`u`&&t.length>0&&l>0?v(l):n===`d`&&t.length>0&&l<t.length-1&&y(l)},{isActive:p}),d===null?Y(R,{flexDirection:`column`,children:[J(X,{children:`Input Pattern Highlighters`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`Create custom highlighters for patterns in your input prompt.`}),J(z,{dimColor:!0,children:`Matched text will be styled and optionally reformatted.`})]}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`n to create a new highlighter`}),t.length>0&&J(z,{dimColor:!0,children:`space to toggle enabled/disabled`}),t.length>0&&J(z,{dimColor:!0,children:`u/d to move highlighter up/down`}),t.length>0&&J(z,{dimColor:!0,children:`x to delete a highlighter`}),t.length>0&&J(z,{dimColor:!0,children:`enter to edit highlighter`}),J(z,{dimColor:!0,children:`esc to go back`})]}),t.length===0?J(z,{children:`No highlighters created yet. Press n to create one.`}):J(R,{flexDirection:`column`,children:t.map((e,t)=>{let n=l===t,r;return n&&(r=`yellow`),Y(R,{flexDirection:`row`,children:[Y(z,{color:r,children:[n?`❯ `:` `,e.enabled?`● `:`○ `,e.name,` `]}),J(z,{dimColor:!0,children:`(`}),e.regex?Y(z,{dimColor:!0,children:[`/`,e.regex,`/`,e.regexFlags]}):J(z,{dimColor:!0,children:`(no regex)`}),e.styling.length>0&&J(q,{children:Y(z,{color:r,dimColor:!e.enabled,children:[` `,`· `,e.styling.join(`, `)]})}),J(z,{dimColor:!0,children:`)`}),e.enabled?J(z,{color:s,children:` enabled`}):J(z,{color:c,children:` disabled`})]},t)})})]}):J(jt,{highlighterIndex:d,onBack:()=>{f(null),m(!0)}})}const Nt=[null,1,5,10,25,50,100,200,250,500,1e3],Pt=1e3;function Ft({onSubmit:e}){let{settings:t,updateSettings:n}=H($),[r,i]=W(0),[a,o]=W(!1),s={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEdit:!1,hideStartupClawd:!1,increaseFileReadLimit:!1,suppressLineNumbers:!1,suppressRateLimitOptions:!1,mcpConnectionNonBlocking:!0,mcpServerBatchSize:null,statuslineThrottleMs:null,statuslineUseFixedInterval:!1,tableFormat:`default`,enableSessionMemory:!0,enableDreamMode:!0,enableLeanMemoryTypes:!1,fixSummarizeFromHere:!0,fixRewindSummaryHeader:!0,enableRememberSkill:!1,tokenCountRounding:null,autoAcceptPlanMode:!1,allowBypassPermissionsInSudo:!1,suppressNativeInstallerWarning:!1,filterScrollEscapeSequences:!1,enableWorktreeMode:!0,swapRipgrepForFff:!1,allowCustomAgentModels:!1,enableContextLimitOverride:!1,enableModelCustomizations:!0,enableVoiceMode:!1,enableVoiceConciseOutput:!0,enableChannelsMode:!1,maxEffortDefault:!1,autonomousOperationAllModels:!1,adhdOutputStyle:!1,autoModeClassifierModel:`default`,suppressDeferredTools:!1,claudemdContextOncePerConversation:!0},c=()=>{t.misc||={...s}},l=e=>{let t=[`default`,`sonnet`,`haiku`];return t[(t.indexOf(e)+1)%t.length]},u=e=>{switch(e){case`sonnet`:return`Sonnet 4.6`;case`haiku`:return`Haiku 4.5`;case`default`:default:return`Default (main-loop model)`}},d=e=>{let t=[`default`,`ascii`,`clean`,`clean-top-bottom`];return t[(t.indexOf(e)+1)%t.length]},f=e=>{switch(e){case`ascii`:return`ASCII (| and -)`;case`clean`:return`Clean (no row separators)`;case`clean-top-bottom`:return`Clean with top/bottom`;case`default`:default:return`Default (box-drawing)`}},p=e=>e===null?`Default (3)`:e<=3?`${e} (conservative)`:e<=8?`${e} (recommended)`:`${e} (aggressive)`,m=e=>e===null?`Disabled`:e===0?`0ms (instant)`:`${e}ms`,h=e=>e===null?`Off (exact counts)`:`Round to ${e}`,g=(e,t)=>{let n=Nt.indexOf(e);if(n===-1)return Nt[0];let r;return r=t===`next`?(n+1)%Nt.length:(n-1+Nt.length)%Nt.length,Nt[r]},_=Me(()=>[{id:`removeBorder`,title:`Remove input box border`,description:`Removes the rounded border around the input box for a cleaner look.`,getValue:()=>t.inputBox?.removeBorder??!1,toggle:()=>{n(e=>{e.inputBox||={removeBorder:!1},e.inputBox.removeBorder=!e.inputBox.removeBorder})}},{id:`showVersion`,title:`Show tweakcc version at startup`,description:`Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.`,getValue:()=>t.misc?.showTweakccVersion??!0,toggle:()=>{n(e=>{c(),e.misc.showTweakccVersion=!e.misc.showTweakccVersion})}},{id:`showPatches`,title:`Show patches applied indicator at startup`,description:`Shows the green "tweakcc patches are applied" indicator when starting Claude Code.`,getValue:()=>t.misc?.showPatchesApplied??!0,toggle:()=>{n(e=>{c(),e.misc.showPatchesApplied=!e.misc.showPatchesApplied})}},{id:`expandThinking`,title:`Expand thinking blocks`,description:`Makes thinking blocks always expanded by default instead of collapsed.`,getValue:()=>t.misc?.expandThinkingBlocks??!0,toggle:()=>{n(e=>{c(),e.misc.expandThinkingBlocks=!e.misc.expandThinkingBlocks})}},{id:`conversationTitle`,title:`Allow renaming sessions via /title`,description:`Enables /title and /rename commands for manually naming conversations.`,getValue:()=>t.misc?.enableConversationTitle??!0,toggle:()=>{n(e=>{c(),e.misc.enableConversationTitle=!e.misc.enableConversationTitle})}},{id:`enableModelCustomizations`,title:`Enable model customizations (/model shows all models)`,description:`Show all Claude models in /model menu, not just the latest 3. Disable to use Claude Code default model list.`,getValue:()=>t.misc?.enableModelCustomizations??!0,toggle:()=>{n(e=>{c(),e.misc.enableModelCustomizations=!e.misc.enableModelCustomizations})}},{id:`hideStartupBanner`,title:`Hide startup banner`,description:`Hides the startup banner message displayed before first prompt.`,getValue:()=>t.misc?.hideStartupBanner??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupBanner=!e.misc.hideStartupBanner})}},{id:`hideCtrlG`,title:`Hide ctrl-g to edit prompt hint`,description:`Hides the "ctrl-g to edit prompt" hint shown during streaming.`,getValue:()=>t.misc?.hideCtrlGToEdit??!1,toggle:()=>{n(e=>{c(),e.misc.hideCtrlGToEdit=!e.misc.hideCtrlGToEdit})}},{id:`hideClawd`,title:`Hide startup Clawd ASCII art`,description:`Hides the Clawd ASCII art character shown at startup.`,getValue:()=>t.misc?.hideStartupClawd??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupClawd=!e.misc.hideStartupClawd})}},{id:`increaseFileReadLimit`,title:`Increase file read token limit`,description:`Increases the maximum file read limit from 25,000 to 1,000,000 tokens.`,getValue:()=>t.misc?.increaseFileReadLimit??!1,toggle:()=>{n(e=>{c(),e.misc.increaseFileReadLimit=!e.misc.increaseFileReadLimit})}},{id:`suppressLineNumbers`,title:`Suppress line numbers in file reads/edits`,description:`Removes line number prefixes from file content to reduce token usage.`,getValue:()=>t.misc?.suppressLineNumbers??!1,toggle:()=>{n(e=>{c(),e.misc.suppressLineNumbers=!e.misc.suppressLineNumbers})}},{id:`suppressRateLimitOptions`,title:`Suppress rate limit options popup`,description:`Prevents the automatic /rate-limit-options command from being triggered when hitting rate limits.`,getValue:()=>t.misc?.suppressRateLimitOptions??!1,toggle:()=>{n(e=>{c(),e.misc.suppressRateLimitOptions=!e.misc.suppressRateLimitOptions})}},{id:`mcpNonBlocking`,title:`Non-blocking MCP startup`,description:`Start immediately while MCP servers connect in background. Reduces startup time ~50% with multiple MCPs.`,getValue:()=>t.misc?.mcpConnectionNonBlocking??!0,toggle:()=>{n(e=>{c(),e.misc.mcpConnectionNonBlocking=!e.misc.mcpConnectionNonBlocking})}},{id:`mcpBatchSize`,title:`MCP server batch size`,description:`Parallel MCP connections (1-20). Use ←/→ to adjust. Higher = faster startup, more resources.`,getValue:()=>t.misc?.mcpServerBatchSize??null,getDisplayValue:()=>p(t.misc?.mcpServerBatchSize??null),toggle:()=>{n(e=>{c(),e.misc.mcpServerBatchSize=null})},increment:()=>{n(e=>{c();let t=e.misc.mcpServerBatchSize??3;e.misc.mcpServerBatchSize=Math.min(20,t+1)})},decrement:()=>{n(e=>{c();let t=(e.misc.mcpServerBatchSize??3)-1;e.misc.mcpServerBatchSize=t<1?null:t})}},{id:`tableFormat`,title:`Table output format`,description:`Controls how Claude formats tables. Default: full borders. ASCII: | and -. Clean: no top/bottom/row separators. Clean+top/bottom: borders but no row separators.`,getValue:()=>t.misc?.tableFormat??`default`,isMultiValue:!0,getDisplayValue:()=>f(t.misc?.tableFormat??`default`),toggle:()=>{n(e=>{c(),e.misc.tableFormat=d(e.misc.tableFormat??`default`)})}},{id:`enableWorktreeMode`,title:`Enable worktree mode (EnterWorktree tool)`,description:`Force-enable the EnterWorktree tool for isolated git worktree sessions by bypassing the tengu_worktree_mode feature flag.`,getValue:()=>t.misc?.enableWorktreeMode??!0,toggle:()=>{n(e=>{c(),e.misc.enableWorktreeMode=!e.misc.enableWorktreeMode})}},{id:`swapRipgrepForFff`,title:`[EXPERIMENTAL] fff for Bash search (grep/find/rg -> fff)`,description:`Route Claude Code's Bash search through fff. CC shadows the shell grep->embedded ugrep and find->embedded bfs (and offers rg); the agent uses grep far more than rg. This repoints all three at a per-platform fff wrapper that serves (relevance-ranked, warm-index daemon): literal, regex (RE2, the dialect the model writes), -i, multi-word phrases, context (-A/-B/-C), extension globs (-g/--include '*.ts'), and multi-path (app lib scripts). Anything fff can't serve faithfully (PCRE, multiline/newline/empty regex, -o, single-file, non-recursive grep, --no-ignore, find, non-ASCII, lines over 512 bytes, piped stdin) -> re-exec the real embedded ugrep/bfs/ripgrep. Every engine still ships; any uncertainty falls back, so results never diverge from intent. Transparent (no prompt-compliance reliance), CC-scoped (your own terminal grep/find/rg are untouched). Installs the wrapper into ~/.tweakcc/fff.`,getValue:()=>t.misc?.swapRipgrepForFff??!1,toggle:()=>{n(e=>{c(),e.misc.swapRipgrepForFff=!e.misc.swapRipgrepForFff})}},{id:`enableVoiceMode`,title:`Enable voice mode (/voice command)`,description:`Force-enable the /voice command by bypassing the tengu_amber_quartz feature gate.`,getValue:()=>t.misc?.enableVoiceMode??!1,toggle:()=>{n(e=>{c(),e.misc.enableVoiceMode=!e.misc.enableVoiceMode})}},{id:`enableVoiceConciseOutput`,title:`Enable concise output for voice mode`,description:`Enable the concise-output prompt used for voice interactions. Only applies when voice mode is enabled.`,getValue:()=>t.misc?.enableVoiceConciseOutput??!0,toggle:()=>{n(e=>{c(),e.misc.enableVoiceConciseOutput=!e.misc.enableVoiceConciseOutput})}},{id:`enableChannelsMode`,title:`Enable channels mode (MCP channel notifications)`,description:`Force-enable MCP channel notifications by bypassing the tengu_harbor feature gate, allowlist, and permission relay.`,getValue:()=>t.misc?.enableChannelsMode??!1,toggle:()=>{n(e=>{c(),e.misc.enableChannelsMode=!e.misc.enableChannelsMode})}},{id:`enableContextLimitOverride`,title:`Override context limit`,description:`Replaces the default model context limit with CLAUDE_CODE_CONTEXT_LIMIT env var. Must be exported manually before launching CC, or falls back to 200K.`,getValue:()=>t.misc?.enableContextLimitOverride??!1,toggle:()=>{n(e=>{c(),e.misc.enableContextLimitOverride=!e.misc.enableContextLimitOverride})}},{id:`statuslineThrottle`,title:`Statusline throttle`,description:`Throttle statusline updates (0-${Pt}ms). Use ←/→ to adjust by 50ms. Space to disable. 0 = instant updates.`,getValue:()=>t.misc?.statuslineThrottleMs??null,getDisplayValue:()=>m(t.misc?.statuslineThrottleMs??null),toggle:()=>{n(e=>{c(),e.misc.statuslineThrottleMs=e.misc.statuslineThrottleMs===null?300:null})},increment:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.min(Pt,t+50)})},decrement:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.max(0,t-50)})}},{id:`statuslineFixedInterval`,title:`Statusline fixed interval mode`,description:`Use setInterval instead of throttle. Updates happen on a fixed schedule rather than on-demand.`,getValue:()=>t.misc?.statuslineUseFixedInterval??!1,toggle:()=>{n(e=>{c(),e.misc.statuslineUseFixedInterval=!e.misc.statuslineUseFixedInterval})}},{id:`enableSessionMemory`,title:`Enable session memory`,description:`Force-enable session memory (auto-extraction + past session search) by bypassing the tengu_session_memory and tengu_coral_fern statsig flags.`,getValue:()=>t.misc?.enableSessionMemory??!0,toggle:()=>{n(e=>{c(),e.misc.enableSessionMemory=!e.misc.enableSessionMemory})}},{id:`enableDreamMode`,title:`Enable dream mode`,description:`Force-enable dream (/dream + auto-dream background memory consolidation) by bypassing the tengu_onyx_plover statsig gate. On/off still follows autoDreamEnabled in ~/.claude/settings.json.`,getValue:()=>t.misc?.enableDreamMode??!0,toggle:()=>{n(e=>{c(),e.misc.enableDreamMode=!e.misc.enableDreamMode})}},{id:`fixSummarizeFromHere`,title:`Fix "Summarize from here"`,description:`Make "Summarize from here" summarize only the messages after the rewind point instead of the whole conversation.`,getValue:()=>t.misc?.fixSummarizeFromHere??!0,toggle:()=>{n(e=>{c(),e.misc.fixSummarizeFromHere=!(e.misc.fixSummarizeFromHere??!0)})}},{id:`fixRewindSummaryHeader`,title:`Honest rewind summary header`,description:`Label a rewind summary as a deliberate rewind (you continued forward, then rewound and chose to carry the summary forward) instead of the misleading "ran out of context" header.`,getValue:()=>t.misc?.fixRewindSummaryHeader??!0,toggle:()=>{n(e=>{c(),e.misc.fixRewindSummaryHeader=!(e.misc.fixRewindSummaryHeader??!0)})}},{id:`enableLeanMemoryTypes`,title:`Enable lean memory types`,description:`Force the tengu_ochre_finch statsig gate: memory prompts carry a compact "Types of memory" list and the full taxonomy moves to the on-demand memory-types skill.`,getValue:()=>t.misc?.enableLeanMemoryTypes??!1,toggle:()=>{n(e=>{c(),e.misc.enableLeanMemoryTypes=!e.misc.enableLeanMemoryTypes})}},{id:`enableRememberSkill`,title:`Enable remember skill`,description:`Register a "remember" skill to review session memories and update CLAUDE.local.md with learnings from past sessions.`,getValue:()=>t.misc?.enableRememberSkill??!1,toggle:()=>{n(e=>{c(),e.misc.enableRememberSkill=!e.misc.enableRememberSkill})}},{id:`tokenCountRounding`,title:`Token count rounding`,description:`Round displayed token counts to nearest multiple. Use ←/→ to cycle: Off, 1, 5, 10, 25, 50, 100, 200, 250, 500, 1000.`,getValue:()=>t.misc?.tokenCountRounding??null,getDisplayValue:()=>h(t.misc?.tokenCountRounding??null),toggle:()=>{n(e=>{c(),e.misc.tokenCountRounding=null})},increment:()=>{n(e=>{c(),e.misc.tokenCountRounding=g(e.misc.tokenCountRounding??null,`next`)})},decrement:()=>{n(e=>{c(),e.misc.tokenCountRounding=g(e.misc.tokenCountRounding??null,`prev`)})}},{id:`autoAcceptPlanMode`,title:`Auto-accept plan mode`,description:`Automatically accept plans without the "Ready to code?" confirmation prompt.`,getValue:()=>t.misc?.autoAcceptPlanMode??!1,toggle:()=>{n(e=>{c(),e.misc.autoAcceptPlanMode=!e.misc.autoAcceptPlanMode})}},{id:`allowBypassPermissionsInSudo`,title:`Allow bypassing permissions in sudo`,description:`⚠️ WARNING: Disables a security check. When enabled, Claude can perform system-level operations without prompts. Use extreme caution.`,getValue:()=>t.misc?.allowBypassPermissionsInSudo??!1,toggle:()=>{t.misc?.allowBypassPermissionsInSudo??!1?n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!1}):o(!0)}},{id:`suppressNativeInstallerWarning`,title:`Suppress native installer warning`,description:`Suppress the native installer warning message at startup.`,getValue:()=>t.misc?.suppressNativeInstallerWarning??!1,toggle:()=>{n(e=>{c(),e.misc.suppressNativeInstallerWarning=!e.misc.suppressNativeInstallerWarning})}},{id:`filterScrollEscapeSequences`,title:`Filter scroll escape sequences`,description:`Filter out terminal escape sequences that cause unwanted scrolling.`,getValue:()=>t.misc?.filterScrollEscapeSequences??!1,toggle:()=>{n(e=>{c(),e.misc.filterScrollEscapeSequences=!e.misc.filterScrollEscapeSequences})}},{id:`allowCustomAgentModels`,title:`Allow custom agent models`,description:`Allow arbitrary model names in custom agent frontmatter (e.g. gemini-2.5-flash). Useful with a local proxy for non-Claude models.`,getValue:()=>t.misc?.allowCustomAgentModels??!1,toggle:()=>{n(e=>{c(),e.misc.allowCustomAgentModels=!e.misc.allowCustomAgentModels})}},{id:`maxEffortDefault`,title:`Default Opus 4.7 to max effort`,description:`Patches CC so Opus 4.7 sessions default to "max" reasoning effort instead of "xhigh". /effort and CLAUDE_CODE_EFFORT_LEVEL still override at runtime.`,getValue:()=>t.misc?.maxEffortDefault??!1,toggle:()=>{n(e=>{c(),e.misc.maxEffortDefault=!e.misc.maxEffortDefault})}},{id:`autonomousOperationAllModels`,title:`Fable/Mythos prompt set (all models)`,description:`Treats your selected model as Fable/Mythos everywhere CC branches on model family (flips the zQ gate). You get: the autonomous-operation prompt ("proceed without asking for reversible in-scope work, finish the job before ending your turn"); the "# Communicating with the user" comms block in place of "# Text output"; /loop dynamic-pacing turn behavior; and brief-mode comms shaping. Per-model feature-flag routing follows fable too, but is inert on a local install (those flags default off without a live gate service).`,getValue:()=>t.misc?.autonomousOperationAllModels??!1,toggle:()=>{n(e=>{c(),e.misc.autonomousOperationAllModels=!e.misc.autonomousOperationAllModels})}},{id:`adhdOutputStyle`,title:`ADHD-friendly output style`,description:`Rewrites the always-on "# Communicating with the user" prompt for skim-first reading: answer in the first line, bold the key terms, three-sentence blocks, and a soft "usually under 120 words" anchor (soft, not a hard cap: Anthropic measured a 3% eval drop from hard caps and reverted them). Removes the three clauses that drive Claude-speak: the "load-bearing" update cue, the "readable matters more" ranking, and the "in prose, not headers and sections" rule. Also restates the shape rule in the per-turn CLAUDE.md reminder, where recency makes it stick, and drops that reminder's "may or may not be relevant" hedge.`,getValue:()=>t.misc?.adhdOutputStyle??!1,toggle:()=>{n(e=>{c(),e.misc.adhdOutputStyle=!e.misc.adhdOutputStyle})}},{id:`autoModeClassifierModel`,title:`Auto-mode classifier model`,description:`Pin auto-mode bash safety classifier to a fixed model. Default routes to your main-loop model (e.g. Opus 4.7), which gets denied as "temporarily unavailable" when that model is congested. Sonnet/Haiku have more headroom and the binary XML classifier task fits either.`,getValue:()=>t.misc?.autoModeClassifierModel??`default`,getDisplayValue:()=>u(t.misc?.autoModeClassifierModel??`default`),toggle:()=>{n(e=>{c(),e.misc.autoModeClassifierModel=l(e.misc.autoModeClassifierModel??`default`)})}}],[t,n]),v=_.length,y=v-1,b=Me(()=>r<4?0:Math.min(r-4+1,v-4),[r,v]),x=_.slice(b,b+4),S=b>0,C=b+4<v;return B((t,s)=>{a?s.return?(n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!0}),o(!1)):s.escape&&o(!1):s.return||s.escape?e():s.upArrow?i(e=>Math.max(0,e-1)):s.downArrow?i(e=>Math.min(y,e+1)):t===` `?_[r]?.toggle():s.rightArrow?_[r]?.increment?.():s.leftArrow&&_[r]?.decrement?.()}),J(R,{flexDirection:`column`,children:a?J(R,{flexDirection:`column`,paddingX:2,children:Y(R,{borderStyle:`double`,borderColor:`yellow`,padding:2,flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,color:`yellow`,children:`SECURITY WARNING`})}),J(R,{marginBottom:1,children:J(z,{children:`You are about to enable a feature that allows Claude Code to bypass permission checks when running with sudo privileges.`})}),J(R,{marginBottom:1,children:J(z,{color:`red`,children:`This means Claude can perform system-level operations without any prompts or confirmation.`})}),J(R,{marginBottom:1,children:J(z,{bold:!0,children:`Use with extreme caution.`})}),J(R,{children:Y(z,{children:[`Press `,J(z,{color:`red`,children:`Enter`}),` to enable,`,` `,J(z,{color:`green`,children:`Escape`}),` to cancel`]})})]})}):Y(q,{children:[J(R,{marginBottom:1,children:J(X,{children:`Miscellaneous Settings`})}),J(R,{marginBottom:1,children:J(z,{dimColor:!0,children:`Use ↑/↓ to navigate, space to toggle, ←/→ to adjust numbers, enter to go back.`})}),S&&J(R,{children:Y(z,{dimColor:!0,children:[` ↑ `,b,` more above`]})}),x.map((e,t)=>{let n=b+t===r,i=e.getValue(),a=!!e.getDisplayValue,o=!!e.increment,s;s=o?`◆`:a?`◉`:i?`☑`:`☐`;let c;c=a?e.getDisplayValue():typeof i==`boolean`?i?`Enabled`:`Disabled`:String(i??`Default`);let l=n&&o?` ← → `:``;return Y(R,{flexDirection:`column`,children:[J(R,{children:Y(z,{children:[J(z,{color:n?`cyan`:void 0,children:n?`❯ `:` `}),J(z,{bold:!0,color:n?`cyan`:void 0,children:e.title})]})}),J(R,{children:Y(z,{dimColor:!0,children:[` `,e.description]})}),J(R,{marginLeft:4,marginBottom:1,children:Y(z,{children:[s,` `,c,J(z,{dimColor:!0,children:l})]})})]},e.id)}),C&&J(R,{children:Y(z,{dimColor:!0,children:[` `,`↓ `,v-b-4,` more below`]})}),J(R,{marginTop:1,children:Y(z,{dimColor:!0,children:[`Item `,r+1,` of `,v]})})]})})}const It=`AgentOutputTool.AskUserQuestion.Bash.BashOutputTool.Edit.EnterPlanMode.ExitPlanMode.Glob.Grep.KillShell.ListMcpResourcesTool.LSP.NotebookEdit.Read.ReadMcpResourceTool.Skill.Task.TaskCreate.TaskGet.TaskList.TaskOutput.TaskStop.TaskUpdate.Teammate.TodoWrite.ToolSearch.WebFetch.WebSearch.Write`.split(`.`);function Lt({toolsetIndex:e,onBack:t}){let{settings:n,updateSettings:r}=H($),i=n.toolsets[e],[a,o]=W(i?.name||`New Toolset`),[s,c]=W(i?.allowedTools||[]),[l,u]=W(!1),[d,f]=W(0);U(()=>{i&&r(t=>{let n=t.toolsets[e].name;t.toolsets[e].name=a,t.toolsets[e].allowedTools=s,n!==a&&(t.defaultToolset===n&&(t.defaultToolset=a),t.planModeToolset===n&&(t.planModeToolset=a))})},[a,s]);let p=e=>s===`*`?!0:s.includes(e),m=e=>{e===`All`?c(`*`):e===`None`?c([]):s===`*`?c(It.filter(t=>t!==e)):s.includes(e)?c(s.filter(t=>t!==e)):c([...s,e])};if(B((e,n)=>{if(l){n.return?(a.trim()||o(i?.name||`New Toolset`),u(!1)):n.escape?(o(i?.name||`New Toolset`),u(!1)):n.backspace||n.delete?o(e=>e.slice(0,-1)):e&&e.length===1&&o(t=>t+e);return}if(n.escape)t();else if(n.upArrow)f(e=>Math.max(0,e-1));else if(n.downArrow)f(e=>Math.min(It.length+1,e+1));else if(e===` `||n.return)if(d===0)m(`All`);else if(d===1)m(`None`);else{let e=It[d-2];e&&m(e)}else e===`n`&&u(!0)}),!i)return J(R,{flexDirection:`column`,children:J(z,{color:`red`,children:`Toolset not found`})});let h=s===`*`,g=Array.isArray(s)&&s.length===0;return Y(R,{flexDirection:`column`,children:[J(X,{children:`Edit Toolset`}),J(R,{marginBottom:1,flexDirection:`column`,children:J(z,{dimColor:!0,children:`n to edit name · space/enter to toggle · esc to go back`})}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{bold:!0,children:`Name:`}),J(R,{marginLeft:2,children:J(R,{borderStyle:`round`,borderColor:l?`yellow`:`gray`,children:J(z,{children:a})})}),l&&J(R,{marginLeft:2,children:J(z,{dimColor:!0,children:`enter to save · esc to cancel`})})]}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{bold:!0,children:`Allowed Tools:`}),J(R,{marginLeft:2,children:Y(z,{color:d===0?`cyan`:void 0,children:[d===0?`❯ `:` `,h?`●`:`○`,` All`]})}),J(R,{marginLeft:2,children:Y(z,{color:d===1?`cyan`:void 0,children:[d===1?`❯ `:` `,g?`●`:`○`,` None`]})}),It.map((e,t)=>{let n=t+2;return J(R,{marginLeft:2,children:Y(z,{color:d===n?`cyan`:void 0,children:[d===n?`❯ `:` `,p(e)?`◉`:`○`,` `,e]})},e)})]}),J(R,{borderStyle:`round`,padding:1,marginTop:1,children:Y(R,{flexDirection:`column`,children:[J(z,{bold:!0,children:`Summary:`}),Y(z,{children:[`Name: `,J(z,{color:`cyan`,children:a})]}),Y(z,{children:[`Tools:`,` `,s===`*`?J(z,{color:`green`,children:`All tools (*)`}):s.length===0?J(z,{color:`red`,children:`No tools ([])`}):Y(z,{color:`yellow`,children:[s.length,` selected`]})]})]})})]})}function Rt({onBack:e}){let{settings:{toolsets:t,defaultToolset:n,planModeToolset:r,themes:i},updateSettings:a}=H($),o=me(),s=i.find(e=>e.id===o)||i[0],c=M.themes[0],l=s?.colors.planMode||c.colors.planMode,u=s?.colors.autoAccept||c.colors.autoAccept,[d,f]=W(0),[p,m]=W(null),[h,g]=W(!0),_=()=>{let e={name:`New Toolset`,allowedTools:[]};a(t=>{t.toolsets.push(e)}),m(t.length),g(!1)},v=e=>{let n=t[e];a(t=>{t.toolsets.splice(e,1),t.defaultToolset===n.name&&(t.defaultToolset=null),t.planModeToolset===n.name&&(t.planModeToolset=null)}),d>=t.length-1&&f(Math.max(0,t.length-2))},y=e=>{let n=t[e];a(e=>{e.defaultToolset=n.name})},b=e=>{let n=t[e];a(e=>{e.planModeToolset=n.name})};if(B((n,r)=>{r.escape?e():r.upArrow?f(e=>Math.max(0,e-1)):r.downArrow?f(e=>Math.min(t.length-1,e+1)):r.return&&t.length>0?(m(d),g(!1)):n===`n`?_():n===`x`&&t.length>0?v(d):n===`d`&&t.length>0?y(d):n===`p`&&t.length>0&&b(d)},{isActive:h}),p!==null)return J(Lt,{toolsetIndex:p,onBack:()=>{m(null),g(!0)}});let x=e=>e.allowedTools===`*`?`All tools`:e.allowedTools.length===0?`No tools`:`${e.allowedTools.length} tool${e.allowedTools.length===1?``:`s`}`;return Y(R,{flexDirection:`column`,children:[J(X,{children:`Toolsets`}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`n to create a new toolset`}),t.length>0&&J(z,{dimColor:!0,children:`d to set as default toolset`}),t.length>0&&J(z,{dimColor:!0,children:`p to set as plan mode toolset`}),t.length>0&&J(z,{dimColor:!0,children:`x to delete a toolset`}),t.length>0&&J(z,{dimColor:!0,children:`enter to edit toolset`}),J(z,{dimColor:!0,children:`esc to go back`})]}),t.length===0?J(z,{children:`No toolsets created yet. Press n to create one.`}):J(R,{flexDirection:`column`,children:t.map((e,t)=>{let i=e.name===n,a=e.name===r,o=d===t,s;return o&&(s=`yellow`),Y(R,{flexDirection:`row`,children:[Y(z,{color:s,children:[o?`❯ `:` `,e.name,` `]}),Y(z,{color:s,children:[`(`,x(e),`)`]}),i&&J(z,{color:u,children:` ⏵⏵ accept edits`}),a&&J(z,{color:l,children:` ⏸ plan mode`})]},t)})})]})}function zt({onBack:e}){let{settings:t,updateSettings:n}=H($),[r,i]=W(`plan`),[a,o]=W(!1),[s,c]=W(0),l=t.subagentModels||{plan:null,explore:null,generalPurpose:null},u=[{id:`plan`,title:`Plan Agent`,description:`The agent responsible for creating implementation plans.`},{id:`explore`,title:`Explore Agent`,description:`The agent specialized for exploring codebases.`},{id:`generalPurpose`,title:`General-purpose Agent`,description:`The agent used for general multi-step tasks.`}],d=[{label:`Default (Inherited)`,value:null},{label:`sonnet`,value:`sonnet`},{label:`haiku`,value:`haiku`},{label:`opus`,value:`opus`},{label:`sonnet[1m]`,value:`sonnet[1m]`}];return B((t,f)=>{if(a){if(f.escape)o(!1);else if(f.upArrow)c(e=>e>0?e-1:d.length-1);else if(f.downArrow)c(e=>e<d.length-1?e+1:0);else if(f.return){let e=d[s].value;n(t=>{t.subagentModels||={plan:null,explore:null,generalPurpose:null},t.subagentModels[r]=e}),o(!1)}}else if(f.escape)e();else if(f.upArrow){let e=u.findIndex(e=>e.id===r);i(u[e>0?e-1:u.length-1].id)}else if(f.downArrow){let e=u.findIndex(e=>e.id===r);i(u[e<u.length-1?e+1:0].id)}else if(t===` `||f.return){let e=l[r],t=d.findIndex(t=>t.value===e);c(t>=0?t:0),o(!0)}}),a?Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:Y(X,{children:[`Select Model for`,` `,u.find(e=>e.id===r)?.title]})}),d.map((e,t)=>{let n=t===s;return J(R,{children:Y(z,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,e.label,e.value?Y(z,{dimColor:!0,children:[` (`,e.value,`)`]}):null]})},t)})]}):Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(X,{children:`Subagent Model Settings`})}),J(R,{marginBottom:1,children:J(z,{dimColor:!0,children:`Configure which Claude model each subagent uses. Use arrow keys to navigate, enter or space to change a model, and escape to go back.`})}),u.map(e=>{let t=e.id===r,n=l[e.id],i=d.find(e=>e.value===n)?.label||n||`Default`;return Y(R,{flexDirection:`column`,marginBottom:1,children:[J(R,{children:Y(z,{color:t?`cyan`:void 0,children:[t?`❯ `:` `,J(z,{bold:!0,children:e.title})]})}),J(R,{marginLeft:4,children:J(z,{dimColor:!0,children:e.description})}),J(R,{marginLeft:4,children:Y(z,{children:[`Current: `,J(z,{color:`green`,children:i})]})})]},e.id)})]})}const Bt=[{value:`low`,blurb:`Fastest, cheapest - minimal reasoning`},{value:`medium`,blurb:`Balanced reasoning`},{value:`high`,blurb:`Deep reasoning`},{value:`xhigh`,blurb:`Very deep reasoning`},{value:`max`,blurb:`Maximum reasoning - slowest, priciest`}],Vt={messageCap:{label:`Message cap`,unit:`chars`,lo:500,hi:4e5,hint:`max chars of a user message fed to the classifier`},assistantCap:{label:`Assistant cap`,unit:`chars`,lo:500,hi:4e5,hint:`prev assistant reply beyond this is middle-truncated (head+tail + an omitted-size marker the classifier weighs); no mechanical floor`},timeoutMs:{label:`Haiku timeout`,unit:`ms`,lo:1e3,hi:12e4,hint:`classifier call timeout; on timeout the router fails open`}},Ht=[`enabled`,`pinPerTask`,`messageCap`,`assistantCap`,`timeoutMs`,`systemPrompt`],Ut=e=>e in Vt,Wt=M.complexityRouter;function Gt({onBack:e}){let{settings:t,updateSettings:n}=H($),r={...Wt,...t.complexityRouter??{},levels:t.complexityRouter?.levels&&t.complexityRouter.levels.length>0?t.complexityRouter.levels:Wt.levels},i=Ht.length+r.levels.length,{setRawMode:a,isRawModeSupported:o}=Ee(),[s,c]=W(0),[l,u]=W(null),[d,f]=W(0),[p,m]=W(null),[h,g]=W(null),[,_]=W(0),v=e=>{n(t=>{let n={...Wt,...t.complexityRouter??{},levels:(t.complexityRouter?.levels&&t.complexityRouter.levels.length>0?t.complexityRouter.levels:Wt.levels).map(e=>({...e}))};e(n),t.complexityRouter=n})};if(B((t,n)=>{if(h){if(n.escape){g(null);return}if(n.return){let{kind:e,levelIndex:t,value:n}=h;v(r=>{let i=r.levels[t];i&&(i[e]=n)}),g(null);return}if(n.backspace||n.delete){g(e=>e&&{...e,value:e.value.slice(0,-1)});return}t&&!n.ctrl&&!n.meta&&g(e=>e&&{...e,value:e.value+t});return}if(p){if(n.escape){m(null);return}if(n.return){let e=Vt[p.row],t=parseInt(p.value,10),n=Number.isFinite(t)?Math.min(e.hi,Math.max(e.lo,t)):Wt[p.row],r=p.row;v(e=>{e[r]=n}),m(null);return}if(n.backspace||n.delete){m(e=>e&&{...e,value:e.value.slice(0,-1)});return}/^[0-9]$/.test(t)&&m(e=>e&&e.value.length<7?{...e,value:e.value+t}:e);return}if(l){if(n.escape){u(null);return}if(n.upArrow){f(e=>e>0?e-1:Bt.length-1);return}if(n.downArrow){f(e=>e<Bt.length-1?e+1:0);return}if(n.return){let e=Bt[d].value,t=l.levelIndex;v(n=>{n.levels[t]&&(n.levels[t].effort=e)}),u(null)}return}if(n.escape){e();return}if(n.upArrow){c(e=>e>0?e-1:i-1);return}if(n.downArrow){c(e=>e<i-1?e+1:0);return}let y=s<Ht.length,b=s-Ht.length;if(t===`x`){if(y){let e=Ht[s];Ut(e)?v(t=>{t[e]=Wt[e]}):e===`systemPrompt`&&v(e=>{e.systemPrompt=Wt.systemPrompt})}else{let e=Wt.levels[b];e&&v(t=>{let n=t.levels[b];n&&(n.effort=e.effort,n.label=e.label,n.help=e.help)})}return}if(!y&&(t===`l`||t===`h`)){let e=t===`l`?`label`:`help`,n=r.levels[b];n&&g({kind:e,levelIndex:b,value:n[e]});return}if(t===` `||n.return)if(y){let e=Ht[s];if(e===`enabled`)v(e=>{e.enabled=!e.enabled});else if(e===`pinPerTask`)v(e=>{e.pinPerTask=!e.pinPerTask});else if(e===`systemPrompt`){o&&a(!1);let e=te(r.systemPrompt);if(o&&a(!0),e!=null){let t=e.replace(/\s+$/,``);t&&t!==r.systemPrompt&&v(e=>{e.systemPrompt=t})}_(e=>e+1)}else m({row:e,value:String(r[e])})}else{let e=Bt.findIndex(e=>e.value===r.levels[b]?.effort);f(e>=0?e:0),u({levelIndex:b})}}),l)return Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:Y(X,{children:[`Select effort for "`,r.levels[l.levelIndex]?.label,`"`]})}),Bt.map((e,t)=>{let n=t===d;return J(R,{children:Y(z,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,e.value,Y(z,{dimColor:!0,children:[` - `,e.blurb]})]})},t)})]});let y=(e,t)=>{let n=t===s,i,a,o=``;if(e===`enabled`)i=`Enabled`,a=r.enabled?`on`:`off`;else if(e===`pinPerTask`)i=`Pin per task`,a=r.pinPerTask?`on`:`off`;else if(e===`systemPrompt`){i=`System prompt`;let e=r.systemPrompt===Wt.systemPrompt;a=`${r.systemPrompt.length} chars${e?` (default)`:` (customized)`} - enter to edit in $EDITOR`,o=`opens the classifier system prompt in your $EDITOR; {LEVELS} (the tier rubric) and {MAX} are substituted at apply time · x = reset to default`}else{let t=Vt[e];i=t.label,p?.row===e?(a=`${p.value||`0`}_`,o=`type a number (${t.lo}-${t.hi}), enter to save · esc cancel`):(a=`${r[e]} ${t.unit}`,o=t.hint)}return Y(R,{flexDirection:`column`,children:[Y(z,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,i,`: `,J(z,{color:`green`,children:a})]}),n&&o?J(R,{marginLeft:4,children:J(z,{dimColor:!0,children:o})}):null]},e)};return Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(X,{children:`Complexity Effort Router [experimental]`})}),Y(R,{marginBottom:1,flexDirection:`column`,children:[J(z,{dimColor:!0,children:`Classifies each task by difficulty and sets the reasoning-effort (thinking) level to match - low for routine work, the top tier only for genuinely frontier problems. Runs on your current model (no model switch). Off by default.`}),J(z,{dimColor:!0,children:`Heads up - it burns more tokens: effort level is part of the prompt cache key, so every turn the router changes the level the whole conversation is re-read uncached (a big one-time hit that turn, then cheaper again while the level holds). Each level keeps its own cache, so returning to a prior level reuses most of its earlier work. pin per task on (the default, monotonic) minimizes the churn; pin off flips both ways and pays it more often. Measured, not theoretical.`}),J(z,{dimColor:!0,children:`A one-shot Haiku side-call routes each prompt, fed a rolling TL;DR summary of the session plus the model in use and the level it set last turn (so it judges in context, not cold). Kept in ~/.tweakcc/router- state, restored on resume; reset and reseeded from the main model's summary when the conversation compacts. On a Haiku error it keeps the last level, else defaults high.`}),J(z,{dimColor:!0,children:`Rewind-aware: it snapshots the routed state each turn, so /rewind (Restore conversation) cuts the summary back to the point you rewound to - effort and memory follow the conversation instead of carrying rewound-away work. (Summarize-from-here rewinds reseed via compaction.)`}),J(z,{dimColor:!0,children:`Fully customizable: edit the classifier System prompt in your $EDITOR, and each tier's label/help inline - all with sane defaults.`}),J(z,{dimColor:!0,children:`pin per task is a monotonic floor - effort never drops below the session max (only escalates); turn it off to track each prompt up and down. Reset on /clear.`}),J(z,{dimColor:!0,children:`While on, the router drives effort, overriding your saved effortLevel. An in-session /effort takes back manual control for that session, and CLAUDE_CODE_EFFORT_LEVEL always wins.`}),J(z,{dimColor:!0,children:`See it: Claude Code's working indicator already shows it live - e.g. "thinking with max effort" reflects the routed level. TWEAKCC_ROUTER_DEBUG=1 also logs each decision.`}),J(z,{dimColor:!0,children:`↑↓ navigate · enter/space toggle, edit, or open $EDITOR · digits set a number · on a tier: l/h edit label/help · x reset · esc back`})]}),Ht.map((e,t)=>y(e,t)),J(R,{marginTop:1,marginBottom:1,children:J(z,{bold:!0,children:`Complexity levels and their effort`})}),r.levels.map((e,t)=>{let n=Ht.length+t===s,r=h?.levelIndex===t&&h.kind===`label`,i=h?.levelIndex===t&&h.kind===`help`;return Y(R,{flexDirection:`column`,marginBottom:1,children:[J(R,{children:Y(z,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,J(z,{bold:!0,children:r?`${h.value}_`:e.label}),` `,J(z,{color:`green`,children:e.effort})]})}),J(R,{marginLeft:4,children:J(z,{dimColor:!0,children:i?`${h.value}_`:e.help})}),n&&!h?J(R,{marginLeft:4,children:J(z,{dimColor:!0,children:`enter = set effort · l = edit label · h = edit help · x = reset this tier`})}):null,n&&h?J(R,{marginLeft:4,children:Y(z,{dimColor:!0,children:[`editing `,h.kind,` - type to change · enter save · esc cancel`]})}):null]},e.id)})]})}const Kt=[`fable`,`opus`,`sonnet`,`haiku`],qt=[`low`,`medium`,`high`,`xhigh`,`max`],Jt=e=>e.charAt(0).toUpperCase()+e.slice(1),Yt=[{kind:`enabled`},{kind:`model`,side:`plan`},{kind:`effort`,side:`plan`},{kind:`model`,side:`exec`},{kind:`effort`,side:`exec`},{kind:`clearContext`}],Xt=({onBack:e})=>{let{settings:t,updateSettings:n}=H($),r={...M.fablePlan,...t.fablePlan??{}},[i,a]=W(0),o=e=>{n(t=>({...t,fablePlan:{...M.fablePlan,...t.fablePlan??{},...e}}))},s=e=>{let t=Yt[i];if(t.kind===`enabled`){o({enabled:!r.enabled});return}if(t.kind===`clearContext`){o({offerClearContextOnPlanAccept:!r.offerClearContextOnPlanAccept});return}if(t.kind===`model`){let n=t.side===`plan`?`planModel`:`execModel`,i=t.side===`plan`?r.execModel:r.planModel,a=Kt.indexOf(r[n]);for(let t=1;t<=Kt.length;t++){let r=Kt[(a+e*t+Kt.length*t)%Kt.length];if(r!==i){o({[n]:r});return}}return}let n=t.side===`plan`?`planEffort`:`execEffort`,a=qt[(qt.indexOf(r[n])+e+qt.length)%qt.length];o({[n]:a})};B((t,n)=>{if(n.escape||t===`q`){e();return}n.upArrow?a(e=>(e-1+Yt.length)%Yt.length):n.downArrow?a(e=>(e+1)%Yt.length):n.leftArrow?s(-1):n.rightArrow||n.return||t===` `?s(1):t===`x`&&o({...M.fablePlan})});let c=(e,t,n)=>Y(R,{children:[Y(z,{color:e===i?`cyan`:void 0,children:[e===i?`❯ `:` `,t.padEnd(26)]}),J(z,{color:e===i?`cyan`:`green`,bold:e===i,children:n})]},t),l=`${r.planModel}plan`;return Y(R,{flexDirection:`column`,paddingX:1,children:[J(z,{bold:!0,children:`Fable Plan mode`}),Y(R,{marginTop:1,flexDirection:`column`,children:[Y(z,{dimColor:!0,children:[`Adds a `,J(z,{color:`green`,children:l}),` entry to Claude Code's`,` `,J(z,{color:`green`,children:`/model`}),` list: `,Jt(r.planModel),` `,`while planning, `,Jt(r.execModel),` while executing, each at its own reasoning effort.`]}),Y(z,{dimColor:!0,children:[`It is a model you select, the same mechanism Claude Code ships for opusplan. Nothing changes for any other model, and your selection stays `,J(z,{color:`green`,children:l}),` throughout — the pairing is resolved per request, so no model is ever switched underneath you mid-session.`]})]}),J(R,{marginTop:1,flexDirection:`column`,children:Yt.map((e,t)=>{if(e.kind===`enabled`)return c(t,`Enabled`,r.enabled?`yes`:`no`);if(e.kind===`clearContext`)return c(t,`Offer "clear context"`,r.offerClearContextOnPlanAccept?`yes`:`no`);let n=e.side===`plan`?`Planning`:`Executing`;return e.kind===`model`?c(t,`${n} model`,Jt(e.side===`plan`?r.planModel:r.execModel)):c(t,`${n} effort`,e.side===`plan`?r.planEffort:r.execEffort)})}),Y(R,{marginTop:1,flexDirection:`column`,children:[Y(z,{dimColor:!0,children:[`Claude Code defaults its "clear context" option off. On, the plan-approval dialog offers "Yes, clear context (N% used)", which hands only the plan to `,Jt(r.execModel),`. Continuing instead re-sends the whole planning transcript to a different model, so the cache is cold either way and you pay for the transcript twice.`]}),J(z,{dimColor:!0,children:`Effort follows the resolved model, so the complexity router still drives every model that is not part of this pairing.`})]}),J(R,{marginTop:1,children:J(z,{dimColor:!0,children:`↑↓ move · ←→ change · x reset to defaults · esc back`})})]})},Zt=K.join(ae,`claude-browser-bridge`),Qt=K.join(Zt,`host`,`setup.mjs`),$t=K.join(Zt,`extension`),en=K.join(Pe.homedir(),`.claude-browser-bridge`,`install-state.json`),tn=`/tmp/claude-browser-bridge-${Pe.userInfo().username}.sock`;function nn(e){try{return!G.statSync(K.join(e,`Local State`)).isFile()||!G.statSync(K.join(e,`NativeMessagingHosts`)).isDirectory()?!1:G.existsSync(K.join(e,`Default`))?!0:G.readdirSync(e).some(e=>/^Profile \d+$/.test(e))}catch{return!1}}function rn(e){let t=K.basename(e);return t===`User Data`&&(t=K.basename(K.dirname(e))),t.includes(`.`)&&(t=t.split(`.`).pop()||t),t=t.replace(/[-_]/g,` `),t.charAt(0).toUpperCase()+t.slice(1)}function an(e){return new Promise(t=>{Le(process.execPath,e,{maxBuffer:8*1024*1024},(e,n,r)=>{t({code:e?typeof e.code==`number`?e.code:1:0,out:String(n)+String(r)})})})}function on(e){return new Promise(t=>{Le(`git`,e,{maxBuffer:8*1024*1024},(e,n,r)=>{t({code:e?1:0,out:String(n)+String(r)})})})}async function sn(){if(G.existsSync(K.join(Zt,`.git`))&&G.existsSync(Qt)){let e=await on([`-C`,Zt,`pull`,`--ff-only`]);return G.existsSync(Qt)?{code:0,out:e.out}:e}return G.existsSync(Zt)&&G.rmSync(Zt,{recursive:!0,force:!0}),on([`clone`,`--depth`,`1`,`https://github.com/skrabe/claude-browser-bridge`,Zt])}function cn(){let e=process.platform===`darwin`?K.join(Pe.homedir(),`Library`,`Application Support`):K.join(Pe.homedir(),`.config`),t=e=>{try{return G.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).map(t=>K.join(e,t.name))}catch{return[]}},n=[];for(let r of t(e))for(let e of[r,...t(r)])nn(e)&&n.push(rn(e));return n.sort()}function ln(){try{return JSON.parse(G.readFileSync(en,`utf8`))}catch{return null}}const un=({onBack:e})=>{let[t,n]=W(`menu`),[r,i]=W(0),[a,o]=W(ln()),[s,c]=W(`global`),[l,u]=W(`Working…`),[d,f]=W([]),[p,m]=W(null),[h,g]=W(``),_=je(()=>{o(ln())},[]);U(()=>{_()},[_]);let v=G.existsSync(tn),y=!!a,b=()=>{c(`global`),i(0),n(`scope`)},x=je(async e=>{n(`busy`),u(`Fetching the bridge…`),f([]);let t=await sn();if(t.code!==0||!G.existsSync(Qt)){g(`Failed to fetch the bridge repo:
3
+ `+t.out.slice(-600)),n(`error`);return}u(`Installing (registers with every Chromium browser, MCP, skill, disables Claude in Chrome)…`);let r=[Qt,`install`,`--scope`,e];e===`project`&&r.push(`--project`,process.cwd());let a=await an(r);if(f(a.out.split(`
4
4
  `).filter(e=>e.includes(`[bridge]`)).map(e=>e.replace(`[bridge]`,``).trim())),a.code!==0){g(`Install failed:
5
- `+a.out.slice(-600)),n(`error`);return}_(),i(0),n(`extmodal`)},[_]),S=ke(async()=>{n(`busy`),u(`Connecting to the extension…`),m(null),(await Qt([Kt,`verify`])).code===0?(i(0),n(`done`)):(m(`Not detected. Make sure the extension is loaded AND enabled, then retry.`),i(0),n(`extmodal`))},[]),C=ke(async()=>{n(`busy`),u(`Uninstalling…`);let e=await Qt([Kt,`uninstall`]);if(f(e.out.split(`
5
+ `+a.out.slice(-600)),n(`error`);return}_(),i(0),n(`extmodal`)},[_]),S=je(async()=>{n(`busy`),u(`Connecting to the extension…`),m(null),(await an([Qt,`verify`])).code===0?(i(0),n(`done`)):(m(`Not detected. Make sure the extension is loaded AND enabled, then retry.`),i(0),n(`extmodal`))},[]),C=je(async()=>{n(`busy`),u(`Uninstalling…`);let e=await an([Qt,`uninstall`]);if(f(e.out.split(`
6
6
  `).filter(e=>e.includes(`[bridge]`)).map(e=>e.replace(`[bridge]`,``).trim())),e.code!==0){g(`Uninstall failed:
7
- `+e.out.slice(-600)),_(),n(`error`);return}G.rmSync(Gt,{recursive:!0,force:!0}),_(),i(0),n(`uninstall-done`)},[_]);if(B((r,a)=>{a.escape&&(t===`menu`?e():t!==`busy`&&(i(0),n(`menu`)))}),t===`busy`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`cyan`,children:`Better Claude in Chrome`}),Y(z,{children:[J(z,{color:`yellow`,children:`◐ `}),l]}),d.slice(-8).map((e,t)=>Y(z,{dimColor:!0,children:[` `,e]},t))]});if(t===`error`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`red`,children:`Better Claude in Chrome — error`}),J(z,{color:`red`,children:h}),J(z,{dimColor:!0,children:`Esc to go back`})]});if(t===`scope`){let e=[{name:`Global`,desc:`skill in ~/.claude/skills, MCP user scope, disable Claude in Chrome everywhere`},{name:`Project (${K.basename(process.cwd())})`,desc:`only for ${process.cwd()} — .mcp.json + project .claude/skills + disable only here`}];return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`cyan`,children:`Install — choose scope`}),J(Ke,{items:e,selectedIndex:r,onSelect:i,onSubmit:e=>{let t=e.startsWith(`Global`)?`global`:`project`;c(t),x(t)}}),J(z,{dimColor:!0,children:`Esc to cancel`})]})}if(t===`extmodal`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`cyan`,children:`Load the extension (one-time)`}),Y(R,{flexDirection:`column`,children:[Y(z,{children:[`1. Open `,J(z,{color:`yellow`,children:`brave://extensions`}),` (or chrome://extensions)`]}),Y(z,{children:[`2. Turn on `,J(z,{bold:!0,children:`Developer mode`}),` (top right)`]}),Y(z,{children:[`3. `,J(z,{bold:!0,children:`Load unpacked`}),` →`,` `,J(z,{color:`yellow`,children:qt})]}),Y(z,{children:[`4. Make sure it is toggled `,J(z,{bold:!0,children:`ON`})]})]}),p&&J(z,{color:`red`,children:p}),J(Ke,{items:[{name:`I've loaded it →`},{name:`Cancel`}],selectedIndex:r,onSelect:i,onSubmit:e=>{e===`Cancel`?(i(0),n(`menu`)):S()}})]});if(t===`done`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`green`,children:`Done. The browser bridge is live.`}),Y(z,{children:[`Claude in Chrome is disabled (`,a?.scope||s,`). One browser surface now.`]}),Y(R,{flexDirection:`column`,children:[Y(z,{children:[J(z,{bold:!0,children:`Use it:`}),` ask Claude to do browser work, or run`,` `,J(z,{color:`cyan`,children:`/browser`}),` for the full playbook.`]}),J(z,{dimColor:!0,children:`tabs_list · tab_claim · navigate · read_page · find · screenshot · cdp · …`}),J(z,{dimColor:!0,children:`Restart Claude Code so it picks up the tools and drops Claude in Chrome.`})]}),J(Ke,{items:[{name:`Back`}],selectedIndex:0,onSelect:()=>{},onSubmit:()=>{_(),i(0),n(`menu`)}})]});if(t===`howto`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`cyan`,children:`How it works`}),Y(z,{children:[`Claude drives your `,J(z,{bold:!0,children:`real, logged-in`}),` browser over the Chrome DevTools`]}),J(z,{children:`Protocol through a small extension you load once. Same technique as Claude in`}),J(z,{children:`Chrome and tools like it — but pointed at your existing tabs, not a fresh`}),J(z,{children:`sandbox, and it is all yours. Nothing listens on a network port.`}),J(z,{children:` `}),Y(z,{children:[` `,`Claude Code ─MCP→ local host ─native messaging→ extension ─CDP→ your tabs`]}),J(z,{children:` `}),Y(z,{children:[J(z,{bold:!0,children:`vs Claude in Chrome:`}),` sees + claims your existing signed-in tabs (it only opens`]}),Y(z,{children:[`new ones), full raw CDP, and the playbook ships as the`,` `,J(z,{color:`cyan`,children:`/browser`}),` skill.`]}),J(z,{children:` `}),J(z,{children:`While on, Claude in Chrome is disabled for the scope you chose. Uninstall`}),J(z,{children:`restores it — but only if we were the one who disabled it.`}),J(z,{children:` `}),J(z,{dimColor:!0,children:`Esc to go back`})]});if(t===`confirm-uninstall`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`yellow`,children:`Uninstall the browser bridge?`}),J(Ke,{items:[{name:`Yes, uninstall`,desc:`removes MCP, skill, native host; re-enables Claude in Chrome if we disabled it`},{name:`Cancel`}],selectedIndex:r,onSelect:i,onSubmit:e=>{e===`Cancel`?(i(0),n(`menu`)):C()}})]});if(t===`uninstall-done`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`green`,children:`Uninstalled.`}),d.map((e,t)=>Y(z,{dimColor:!0,children:[` `,e]},t)),J(z,{children:`Removed our MCP entry, skill, native-host manifests, and the local repo. Claude in Chrome is back on (unless you had it off before us).`}),Y(z,{color:`yellow`,children:[`One step we can't do for you: open`,` `,J(z,{bold:!0,children:`brave://extensions`}),` and Remove the "Better Claude in Chrome" extension (its files are now gone, so it will show an error until you do).`]}),J(Ke,{items:[{name:`Back`}],selectedIndex:0,onSelect:()=>{},onSubmit:()=>{i(0),n(`menu`)}})]});let w=[];return y?(w.push({name:`Reinstall / Repair`,desc:`re-run setup with current or new options`}),w.push({name:`Uninstall`,desc:`remove everything, restore Claude in Chrome`})):w.push({name:`Set up`,desc:`fetch, configure, and connect the bridge`}),w.push({name:`How it works`}),w.push({name:`Back`}),Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`cyan`,children:`Better Claude in Chrome`}),J(z,{dimColor:!0,children:`A better Claude in Chrome — drives your real, logged-in tabs over CDP. Owned, local, no network port.`}),Y(R,{flexDirection:`column`,children:[J(z,{children:`Status`}),Y(z,{children:[` `,`Installed .........`,` `,y?Y(z,{color:`green`,children:[`yes (`,a?.scope,`, v`,a?.version,`)`]}):J(z,{dimColor:!0,children:`no`})]}),Y(z,{children:[` `,`Extension .........`,` `,v?J(z,{color:`green`,children:`connected`}):J(z,{dimColor:!0,children:`not detected`})]}),Y(z,{children:[` Browsers found .... `,tn().join(`, `)||`none`]})]}),J(Ke,{items:w,selectedIndex:r,onSelect:i,onSubmit:t=>{t===`Set up`||t.startsWith(`Reinstall`)?b():t===`Uninstall`?(i(0),n(`confirm-uninstall`)):t===`How it works`?n(`howto`):e()}}),J(z,{dimColor:!0,children:`Esc to go back`})]})};function an({onBack:e}){let{settings:t,updateSettings:n}=H($),r=t.claudeMdAltNames??[],[i,a]=W(0),[o,s]=W(!1),[c,l]=W(``),[u,d]=W(!1);return B((t,f)=>{if(o||u){f.return&&c.trim()?(u?(n(e=>{e.claudeMdAltNames||=[],e.claudeMdAltNames.push(c.trim())}),d(!1)):(n(e=>{e.claudeMdAltNames&&(e.claudeMdAltNames[i]=c.trim())}),s(!1)),l(``)):f.escape?(l(``),s(!1),d(!1)):f.backspace||f.delete?l(e=>e.slice(0,-1)):t&&l(e=>e+t);return}f.escape?e():f.upArrow?r.length>0&&a(e=>e>0?e-1:r.length-1):f.downArrow?r.length>0&&a(e=>e<r.length-1?e+1:0):t===`e`?r.length>0&&(l(r[i]),s(!0)):t===`d`?r.length>0&&(n(e=>{e.claudeMdAltNames&&=e.claudeMdAltNames.filter((e,t)=>t!==i)}),i>=r.length-1&&a(Math.max(0,r.length-2))):t===`n`?(d(!0),l(``)):f.ctrl&&t===`r`?(n(e=>{e.claudeMdAltNames=[...P.claudeMdAltNames??[]]}),a(0)):t===`u`||f.shift&&f.upArrow?r.length>1&&i>0&&(n(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[i-1],t[i]]=[t[i],t[i-1]]}),a(e=>e-1)):(t===`j`||f.shift&&f.downArrow)&&r.length>1&&i<r.length-1&&(n(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[i],t[i+1]]=[t[i+1],t[i]]}),a(e=>e+1))}),Y(R,{flexDirection:`column`,children:[Y(R,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`CLAUDE.md Alternative Names`}),Y(R,{flexDirection:`column`,children:[J(z,{dimColor:!0,children:`changes auto-saved`}),J(z,{dimColor:!0,children:`esc to go back`})]})]}),J(R,{marginBottom:1,flexDirection:`column`,children:J(z,{dimColor:!0,children:`When Claude Code looks for CLAUDE.md and doesn't find it, it will try these alternative filenames in order. This lets you use AGENTS.md (and other file names).`})}),J(R,{marginBottom:1,children:J(z,{dimColor:!0,children:`e to edit · d to delete · n to add new · u/j to move up/down · ctrl+r to reset`})}),Y(R,{flexDirection:`column`,children:[r.length===0?J(z,{children:`No alternative names configured. Press n to add one.`}):J(q,{children:(()=>{let{start:e,end:t}=gt(i,r.length,12),n=r.slice(e,t);return Y(q,{children:[e>0&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↑ `,e,` more above`]}),n.map((t,n)=>{let r=e+n,a=r===i;return Y(z,{color:a?`cyan`:void 0,children:[a?`❯ `:` `,t]},r)}),t<r.length&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,r.length-t,` more below`]})]})})()}),u&&Y(R,{alignItems:`center`,children:[J(z,{color:`yellow`,children:`❯ `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:c})})]}),o&&Y(R,{marginTop:1,alignItems:`center`,children:[J(z,{children:`Editing: `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:c})})]})]})]})}const on=e=>{let t=K.join(se,e),n;try{n=G.readFileSync(t,`utf8`)}catch{return null}let r=ze(n,{delimiters:[`<!--`,`-->`]}),i=r.data,a=(r.content??``).replace(/^\n+/,``).replace(/\n+$/,``),o=e.replace(/\.md$/,``),s=typeof i.name==`string`?i.name:o,c=typeof i.description==`string`?i.description:``,l;return l=a.trim().length===0?`suppressed`:`default`,{id:o,filename:e,name:s,description:c,state:l,body:a}},sn=()=>{if(!G.existsSync(se))return[];let e=G.readdirSync(se).filter(e=>e.endsWith(`.md`)).sort(),t=[];for(let n of e){let e=on(n);e&&t.push(e)}return t},cn={default:void 0,customized:`cyan`,suppressed:`green`,missing:`red`},ln={default:`·`,customized:`◆`,suppressed:`☑`,missing:`?`},un={default:`default`,customized:`customized`,suppressed:`suppressed`,missing:`missing`};function dn({onSubmit:e}){let{settings:t,updateSettings:n}=H($),[r,i]=W(0),[a,o]=W([]),[s,c]=W(!1),[l,u]=W(0);U(()=>{o(sn())},[l]),U(()=>{i(e=>Math.min(e,Math.max(0,a.length-1)))},[a.length]);let d=t.misc?.suppressDeferredTools??!1,f=a.length,m=Math.max(0,f-1),h=Ae(()=>r<8?0:Math.min(r-8+1,Math.max(0,f-8)),[r,f]),g=a.slice(h,h+8),_=h>0,v=h+8<f;if(B((t,o)=>{if(s){o.return?(n(e=>{e.misc?e.misc.suppressDeferredTools=!0:e.misc={suppressDeferredTools:!0}}),c(!1)):o.escape&&c(!1);return}if(o.escape){e();return}if(o.upArrow)i(e=>Math.max(0,e-1));else if(o.downArrow)i(e=>Math.min(m,e+1));else if(t===`o`||o.return){let e=a[r];e&&p(K.join(se,e.filename))}else if(t===`d`){let e=a[r];if(e)try{G.unlinkSync(K.join(se,e.filename)),u(e=>e+1)}catch{}}else t===`r`?u(e=>e+1):t===`f`&&(d?n(e=>{e.misc&&(e.misc.suppressDeferredTools=!1)}):c(!0))}),s)return J(R,{flexDirection:`column`,paddingX:2,children:Y(R,{borderStyle:`double`,borderColor:`yellow`,padding:2,flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,color:`yellow`,children:`FOOTGUN TOGGLE`})}),Y(R,{marginBottom:1,flexDirection:`column`,children:[Y(z,{children:[`Suppressing this hides MCP servers, Cron jobs, EnterPlanMode, WebFetch, Monitor, and other `,J(z,{bold:!0,children:`deferred`}),` tools from the model.`]}),Y(z,{children:[`The model only learns these tools exist via this announcement. Without it, it cannot call `,J(z,{bold:!0,children:`ToolSearch`}),` to load their schemas and will report capabilities as unavailable.`]})]}),J(R,{children:Y(z,{children:[`Press `,J(z,{color:`red`,children:`Enter`}),` to enable,`,` `,J(z,{color:`green`,children:`Escape`}),` to cancel`]})})]})});let y=se.replace(Me.homedir(),`~`),b=a[r];return Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(X,{children:`System Reminders`})}),Y(R,{marginBottom:1,flexDirection:`column`,children:[Y(z,{children:[`Edit per-turn / per-event `,J(z,{bold:!0,children:`<system-reminder>`}),` `,`injections via `,J(z,{bold:!0,children:`.md files`}),` in `,y,`/`]}),J(z,{dimColor:!0,children:`Empty body = suppress · Custom body = override · Files seeded on first --apply. Re-apply after editing.`})]}),f===0?J(R,{flexDirection:`column`,marginBottom:1,children:Y(z,{color:`yellow`,children:[`No override files yet. Run `,J(z,{bold:!0,children:`tweakcc --apply`}),` to seed defaults.`]})}):Y(q,{children:[_&&J(R,{children:Y(z,{dimColor:!0,children:[` ↑ `,h,` more above`]})}),g.map((e,t)=>{let n=h+t===r;return Y(R,{flexDirection:`row`,children:[J(R,{width:2,children:J(z,{color:n?`cyan`:void 0,children:n?`❯ `:` `})}),J(R,{width:3,children:J(z,{color:cn[e.state],children:ln[e.state]})}),J(R,{width:14,children:J(z,{dimColor:!0,color:cn[e.state],children:un[e.state]})}),J(R,{flexGrow:1,children:J(z,{bold:n,color:n?`cyan`:void 0,children:e.name})})]},e.id)}),v&&J(R,{children:Y(z,{dimColor:!0,children:[` `,`↓ `,f-h-8,` more below`]})})]}),b&&J(R,{flexDirection:`column`,marginTop:1,paddingX:1,children:J(z,{dimColor:!0,children:b.description})}),Y(R,{marginTop:1,flexDirection:`column`,children:[Y(z,{dimColor:!0,children:[`↑/↓ navigate · `,J(z,{bold:!0,children:`o`}),`/Enter open in editor ·`,` `,J(z,{bold:!0,children:`d`}),` delete (reset on next --apply) ·`,` `,J(z,{bold:!0,children:`r`}),` reload`]}),Y(z,{dimColor:!0,children:[J(z,{bold:!0,children:`f`}),` toggle deferred-tools footgun [`,J(z,{color:d?`red`:void 0,bold:d,children:d?`SUPPRESSED`:`vanilla`}),`] · Esc go back`]})]})]})}const fn=[`on`,`name-only`,`user-invocable-only`,`off`],pn={on:`on (full description)`,"name-only":`name-only (model sees no description)`,"user-invocable-only":`user-invocable (hidden from model, /name still works)`,off:`off (not loaded)`},mn={on:void 0,"name-only":`cyan`,"user-invocable-only":`yellow`,off:`red`},hn={on:`◉`,"name-only":`◐`,"user-invocable-only":`◑`,off:`○`},gn=K.join(Me.homedir(),`.claude`,`settings.json`),_n=[K.join(Me.homedir(),`.claude`,`skills`),K.join(Me.homedir(),`.agents`,`skills`)],vn=e=>fn[(fn.indexOf(e)+1)%fn.length],yn=e=>fn[(fn.indexOf(e)-1+fn.length)%fn.length],bn=()=>{let e=new Set;for(let t of _n)if(G.existsSync(t))try{let n=G.readdirSync(t,{withFileTypes:!0});for(let t of n)(t.isDirectory()||t.isSymbolicLink())&&e.add(t.name)}catch{}return[...e].sort()},xn=()=>{try{let e=G.readFileSync(gn,`utf8`);return{skillOverrides:JSON.parse(e).skillOverrides??{}}}catch{return{skillOverrides:{}}}},Sn=e=>{let t={};try{t=JSON.parse(G.readFileSync(gn,`utf8`))}catch{}t.skillOverrides=e,G.writeFileSync(gn,JSON.stringify(t,null,2))};function Cn({onSubmit:e}){let[t,n]=W({}),[r,i]=W([]),[a,o]=W(0),[s,c]=W(!1);U(()=>{i(bn()),n(xn().skillOverrides)},[]);let l=Ae(()=>r.map(e=>({name:e,state:t[e]??`on`})),[r,t]),u=l.length,d=Math.max(0,u-1),f=Ae(()=>a<10?0:Math.min(a-10+1,Math.max(0,u-10)),[a,u]),p=l.slice(f,f+10),m=(e,r)=>{let i=l[e]?.name;if(!i)return;let a={...t};r===`on`?delete a[i]:a[i]=r,n(a),Sn(a),c(!0),setTimeout(()=>c(!1),1500)};B((t,n)=>{if(n.escape||n.return&&u===0){e();return}n.upArrow?o(e=>Math.max(0,e-1)):n.downArrow?o(e=>Math.min(d,e+1)):t===` `||n.rightArrow?m(a,vn(l[a]?.state??`on`)):n.leftArrow?m(a,yn(l[a]?.state??`on`)):t===`0`?m(a,`on`):t===`x`&&m(a,`off`)});let h=l[a];return Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(X,{children:`Skills (per-skill skillOverrides)`})}),Y(R,{marginBottom:1,flexDirection:`column`,children:[Y(z,{children:[`Writes `,J(z,{bold:!0,children:`skillOverrides`}),` to`,` `,J(z,{color:`cyan`,children:`~/.claude/settings.json`}),` — CC reads this natively, no tweakcc patch needed.`]}),J(z,{dimColor:!0,children:`Each skill: on / name-only / user-invocable-only / off. CC honors immediately; no --apply required.`})]}),u===0?J(R,{children:Y(z,{color:`yellow`,children:[`No skills found in`,` `,_n.map(e=>e.replace(Me.homedir(),`~`)).join(` or `),`.`]})}):Y(q,{children:[f>0&&J(R,{children:Y(z,{dimColor:!0,children:[` ↑ `,f,` more above`]})}),p.map((e,t)=>{let n=f+t===a;return Y(R,{flexDirection:`row`,children:[J(R,{width:2,children:J(z,{color:n?`cyan`:void 0,children:n?`❯ `:` `})}),J(R,{width:3,children:J(z,{color:mn[e.state],children:hn[e.state]})}),J(R,{width:26,children:J(z,{dimColor:!0,color:mn[e.state],children:e.state})}),J(R,{flexGrow:1,children:J(z,{bold:n,color:n?`cyan`:void 0,children:e.name})})]},e.name)}),f+10<u&&J(R,{children:Y(z,{dimColor:!0,children:[` `,`↓ `,u-f-10,` more below`]})})]}),h&&J(R,{flexDirection:`column`,marginTop:1,children:J(z,{dimColor:!0,children:pn[h.state]})}),Y(R,{marginTop:1,flexDirection:`column`,children:[Y(z,{dimColor:!0,children:[`↑/↓ navigate · space/→/← cycle state · `,J(z,{bold:!0,children:`0`}),` set on ·`,` `,J(z,{bold:!0,children:`x`}),` set off · Esc back`]}),s&&J(z,{color:`green`,children:`✓ saved to settings.json`})]})]})}const $=Oe({settings:P,updateSettings:e=>{},changesApplied:!1,ccVersion:``});function wn({startupCheckInfo:e,configMigrated:t,invocationCommand:n,initialConfig:r}){let[i,a]=W(r),[o,s]=W(!r.hidePiebaldAnnouncement),[c,u]=W(null),d=ke(e=>{let t=JSON.parse(JSON.stringify(i.settings));e(t),a(e=>({...e,settings:t,changesApplied:!1})),ue(e=>{e.settings=t,e.changesApplied=!1}).catch(e=>{u({type:`error`,message:`Failed to save settings: ${e instanceof Error?e.message:String(e)}`})})},[i.settings]),[f,m]=W(null);U(()=>{e.wasUpdated&&e.oldVersion&&(u({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
8
- (However, your customization are still remembered in ${N}.)
7
+ `+e.out.slice(-600)),_(),n(`error`);return}G.rmSync(Zt,{recursive:!0,force:!0}),_(),i(0),n(`uninstall-done`)},[_]);if(B((r,a)=>{a.escape&&(t===`menu`?e():t!==`busy`&&(i(0),n(`menu`)))}),t===`busy`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`cyan`,children:`Better Claude in Chrome`}),Y(z,{children:[J(z,{color:`yellow`,children:`◐ `}),l]}),d.slice(-8).map((e,t)=>Y(z,{dimColor:!0,children:[` `,e]},t))]});if(t===`error`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`red`,children:`Better Claude in Chrome — error`}),J(z,{color:`red`,children:h}),J(z,{dimColor:!0,children:`Esc to go back`})]});if(t===`scope`){let e=[{name:`Global`,desc:`skill in ~/.claude/skills, MCP user scope, disable Claude in Chrome everywhere`},{name:`Project (${K.basename(process.cwd())})`,desc:`only for ${process.cwd()} — .mcp.json + project .claude/skills + disable only here`}];return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`cyan`,children:`Install — choose scope`}),J(qe,{items:e,selectedIndex:r,onSelect:i,onSubmit:e=>{let t=e.startsWith(`Global`)?`global`:`project`;c(t),x(t)}}),J(z,{dimColor:!0,children:`Esc to cancel`})]})}if(t===`extmodal`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`cyan`,children:`Load the extension (one-time)`}),Y(R,{flexDirection:`column`,children:[Y(z,{children:[`1. Open `,J(z,{color:`yellow`,children:`brave://extensions`}),` (or chrome://extensions)`]}),Y(z,{children:[`2. Turn on `,J(z,{bold:!0,children:`Developer mode`}),` (top right)`]}),Y(z,{children:[`3. `,J(z,{bold:!0,children:`Load unpacked`}),` →`,` `,J(z,{color:`yellow`,children:$t})]}),Y(z,{children:[`4. Make sure it is toggled `,J(z,{bold:!0,children:`ON`})]})]}),p&&J(z,{color:`red`,children:p}),J(qe,{items:[{name:`I've loaded it →`},{name:`Cancel`}],selectedIndex:r,onSelect:i,onSubmit:e=>{e===`Cancel`?(i(0),n(`menu`)):S()}})]});if(t===`done`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`green`,children:`Done. The browser bridge is live.`}),Y(z,{children:[`Claude in Chrome is disabled (`,a?.scope||s,`). One browser surface now.`]}),Y(R,{flexDirection:`column`,children:[Y(z,{children:[J(z,{bold:!0,children:`Use it:`}),` ask Claude to do browser work, or run`,` `,J(z,{color:`cyan`,children:`/browser`}),` for the full playbook.`]}),J(z,{dimColor:!0,children:`tabs_list · tab_claim · navigate · read_page · find · screenshot · cdp · …`}),J(z,{dimColor:!0,children:`Restart Claude Code so it picks up the tools and drops Claude in Chrome.`})]}),J(qe,{items:[{name:`Back`}],selectedIndex:0,onSelect:()=>{},onSubmit:()=>{_(),i(0),n(`menu`)}})]});if(t===`howto`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`cyan`,children:`How it works`}),Y(z,{children:[`Claude drives your `,J(z,{bold:!0,children:`real, logged-in`}),` browser over the Chrome DevTools`]}),J(z,{children:`Protocol through a small extension you load once. Same technique as Claude in`}),J(z,{children:`Chrome and tools like it — but pointed at your existing tabs, not a fresh`}),J(z,{children:`sandbox, and it is all yours. Nothing listens on a network port.`}),J(z,{children:` `}),Y(z,{children:[` `,`Claude Code ─MCP→ local host ─native messaging→ extension ─CDP→ your tabs`]}),J(z,{children:` `}),Y(z,{children:[J(z,{bold:!0,children:`vs Claude in Chrome:`}),` sees + claims your existing signed-in tabs (it only opens`]}),Y(z,{children:[`new ones), full raw CDP, and the playbook ships as the`,` `,J(z,{color:`cyan`,children:`/browser`}),` skill.`]}),J(z,{children:` `}),J(z,{children:`While on, Claude in Chrome is disabled for the scope you chose. Uninstall`}),J(z,{children:`restores it — but only if we were the one who disabled it.`}),J(z,{children:` `}),J(z,{dimColor:!0,children:`Esc to go back`})]});if(t===`confirm-uninstall`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`yellow`,children:`Uninstall the browser bridge?`}),J(qe,{items:[{name:`Yes, uninstall`,desc:`removes MCP, skill, native host; re-enables Claude in Chrome if we disabled it`},{name:`Cancel`}],selectedIndex:r,onSelect:i,onSubmit:e=>{e===`Cancel`?(i(0),n(`menu`)):C()}})]});if(t===`uninstall-done`)return Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`green`,children:`Uninstalled.`}),d.map((e,t)=>Y(z,{dimColor:!0,children:[` `,e]},t)),J(z,{children:`Removed our MCP entry, skill, native-host manifests, and the local repo. Claude in Chrome is back on (unless you had it off before us).`}),Y(z,{color:`yellow`,children:[`One step we can't do for you: open`,` `,J(z,{bold:!0,children:`brave://extensions`}),` and Remove the "Better Claude in Chrome" extension (its files are now gone, so it will show an error until you do).`]}),J(qe,{items:[{name:`Back`}],selectedIndex:0,onSelect:()=>{},onSubmit:()=>{i(0),n(`menu`)}})]});let w=[];return y?(w.push({name:`Reinstall / Repair`,desc:`re-run setup with current or new options`}),w.push({name:`Uninstall`,desc:`remove everything, restore Claude in Chrome`})):w.push({name:`Set up`,desc:`fetch, configure, and connect the bridge`}),w.push({name:`How it works`}),w.push({name:`Back`}),Y(R,{flexDirection:`column`,gap:1,children:[J(z,{bold:!0,color:`cyan`,children:`Better Claude in Chrome`}),J(z,{dimColor:!0,children:`A better Claude in Chrome — drives your real, logged-in tabs over CDP. Owned, local, no network port.`}),Y(R,{flexDirection:`column`,children:[J(z,{children:`Status`}),Y(z,{children:[` `,`Installed .........`,` `,y?Y(z,{color:`green`,children:[`yes (`,a?.scope,`, v`,a?.version,`)`]}):J(z,{dimColor:!0,children:`no`})]}),Y(z,{children:[` `,`Extension .........`,` `,v?J(z,{color:`green`,children:`connected`}):J(z,{dimColor:!0,children:`not detected`})]}),Y(z,{children:[` Browsers found .... `,cn().join(`, `)||`none`]})]}),J(qe,{items:w,selectedIndex:r,onSelect:i,onSubmit:t=>{t===`Set up`||t.startsWith(`Reinstall`)?b():t===`Uninstall`?(i(0),n(`confirm-uninstall`)):t===`How it works`?n(`howto`):e()}}),J(z,{dimColor:!0,children:`Esc to go back`})]})};function dn({onBack:e}){let{settings:t,updateSettings:n}=H($),r=t.claudeMdAltNames??[],[i,a]=W(0),[o,s]=W(!1),[c,l]=W(``),[u,d]=W(!1);return B((t,f)=>{if(o||u){f.return&&c.trim()?(u?(n(e=>{e.claudeMdAltNames||=[],e.claudeMdAltNames.push(c.trim())}),d(!1)):(n(e=>{e.claudeMdAltNames&&(e.claudeMdAltNames[i]=c.trim())}),s(!1)),l(``)):f.escape?(l(``),s(!1),d(!1)):f.backspace||f.delete?l(e=>e.slice(0,-1)):t&&l(e=>e+t);return}f.escape?e():f.upArrow?r.length>0&&a(e=>e>0?e-1:r.length-1):f.downArrow?r.length>0&&a(e=>e<r.length-1?e+1:0):t===`e`?r.length>0&&(l(r[i]),s(!0)):t===`d`?r.length>0&&(n(e=>{e.claudeMdAltNames&&=e.claudeMdAltNames.filter((e,t)=>t!==i)}),i>=r.length-1&&a(Math.max(0,r.length-2))):t===`n`?(d(!0),l(``)):f.ctrl&&t===`r`?(n(e=>{e.claudeMdAltNames=[...M.claudeMdAltNames??[]]}),a(0)):t===`u`||f.shift&&f.upArrow?r.length>1&&i>0&&(n(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[i-1],t[i]]=[t[i],t[i-1]]}),a(e=>e-1)):(t===`j`||f.shift&&f.downArrow)&&r.length>1&&i<r.length-1&&(n(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[i],t[i+1]]=[t[i+1],t[i]]}),a(e=>e+1))}),Y(R,{flexDirection:`column`,children:[Y(R,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`CLAUDE.md Alternative Names`}),Y(R,{flexDirection:`column`,children:[J(z,{dimColor:!0,children:`changes auto-saved`}),J(z,{dimColor:!0,children:`esc to go back`})]})]}),J(R,{marginBottom:1,flexDirection:`column`,children:J(z,{dimColor:!0,children:`When Claude Code looks for CLAUDE.md and doesn't find it, it will try these alternative filenames in order. This lets you use AGENTS.md (and other file names).`})}),J(R,{marginBottom:1,children:J(z,{dimColor:!0,children:`e to edit · d to delete · n to add new · u/j to move up/down · ctrl+r to reset`})}),Y(R,{flexDirection:`column`,children:[r.length===0?J(z,{children:`No alternative names configured. Press n to add one.`}):J(q,{children:(()=>{let{start:e,end:t}=_t(i,r.length,12),n=r.slice(e,t);return Y(q,{children:[e>0&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↑ `,e,` more above`]}),n.map((t,n)=>{let r=e+n,a=r===i;return Y(z,{color:a?`cyan`:void 0,children:[a?`❯ `:` `,t]},r)}),t<r.length&&Y(z,{color:`gray`,dimColor:!0,children:[` `,`↓ `,r.length-t,` more below`]})]})})()}),u&&Y(R,{alignItems:`center`,children:[J(z,{color:`yellow`,children:`❯ `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:c})})]}),o&&Y(R,{marginTop:1,alignItems:`center`,children:[J(z,{children:`Editing: `}),J(R,{borderStyle:`round`,borderColor:`yellow`,children:J(z,{children:c})})]})]})]})}const fn=e=>{let t=K.join(se,e),n;try{n=G.readFileSync(t,`utf8`)}catch{return null}let r=Be(n,{delimiters:[`<!--`,`-->`]}),i=r.data,a=(r.content??``).replace(/^\n+/,``).replace(/\n+$/,``),o=e.replace(/\.md$/,``),s=typeof i.name==`string`?i.name:o,c=typeof i.description==`string`?i.description:``,l;return l=a.trim().length===0?`suppressed`:`default`,{id:o,filename:e,name:s,description:c,state:l,body:a}},pn=()=>{if(!G.existsSync(se))return[];let e=G.readdirSync(se).filter(e=>e.endsWith(`.md`)).sort(),t=[];for(let n of e){let e=fn(n);e&&t.push(e)}return t},mn={default:void 0,customized:`cyan`,suppressed:`green`,missing:`red`},hn={default:`·`,customized:`◆`,suppressed:`☑`,missing:`?`},gn={default:`default`,customized:`customized`,suppressed:`suppressed`,missing:`missing`};function _n({onSubmit:e}){let{settings:t,updateSettings:n}=H($),[r,i]=W(0),[a,o]=W([]),[s,c]=W(!1),[l,u]=W(0);U(()=>{o(pn())},[l]),U(()=>{i(e=>Math.min(e,Math.max(0,a.length-1)))},[a.length]);let d=t.misc?.suppressDeferredTools??!1,p=a.length,m=Math.max(0,p-1),h=Me(()=>r<8?0:Math.min(r-8+1,Math.max(0,p-8)),[r,p]),g=a.slice(h,h+8),_=h>0,v=h+8<p;if(B((t,o)=>{if(s){o.return?(n(e=>{e.misc?e.misc.suppressDeferredTools=!0:e.misc={suppressDeferredTools:!0}}),c(!1)):o.escape&&c(!1);return}if(o.escape){e();return}if(o.upArrow)i(e=>Math.max(0,e-1));else if(o.downArrow)i(e=>Math.min(m,e+1));else if(t===`o`||o.return){let e=a[r];e&&f(K.join(se,e.filename))}else if(t===`d`){let e=a[r];if(e)try{G.unlinkSync(K.join(se,e.filename)),u(e=>e+1)}catch{}}else t===`r`?u(e=>e+1):t===`f`&&(d?n(e=>{e.misc&&(e.misc.suppressDeferredTools=!1)}):c(!0))}),s)return J(R,{flexDirection:`column`,paddingX:2,children:Y(R,{borderStyle:`double`,borderColor:`yellow`,padding:2,flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(z,{bold:!0,color:`yellow`,children:`FOOTGUN TOGGLE`})}),Y(R,{marginBottom:1,flexDirection:`column`,children:[Y(z,{children:[`Suppressing this hides MCP servers, Cron jobs, EnterPlanMode, WebFetch, Monitor, and other `,J(z,{bold:!0,children:`deferred`}),` tools from the model.`]}),Y(z,{children:[`The model only learns these tools exist via this announcement. Without it, it cannot call `,J(z,{bold:!0,children:`ToolSearch`}),` to load their schemas and will report capabilities as unavailable.`]})]}),J(R,{children:Y(z,{children:[`Press `,J(z,{color:`red`,children:`Enter`}),` to enable,`,` `,J(z,{color:`green`,children:`Escape`}),` to cancel`]})})]})});let y=se.replace(Pe.homedir(),`~`),b=a[r];return Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(X,{children:`System Reminders`})}),Y(R,{marginBottom:1,flexDirection:`column`,children:[Y(z,{children:[`Edit per-turn / per-event `,J(z,{bold:!0,children:`<system-reminder>`}),` `,`injections via `,J(z,{bold:!0,children:`.md files`}),` in `,y,`/`]}),J(z,{dimColor:!0,children:`Empty body = suppress · Custom body = override · Files seeded on first --apply. Re-apply after editing.`})]}),p===0?J(R,{flexDirection:`column`,marginBottom:1,children:Y(z,{color:`yellow`,children:[`No override files yet. Run `,J(z,{bold:!0,children:`tweakcc --apply`}),` to seed defaults.`]})}):Y(q,{children:[_&&J(R,{children:Y(z,{dimColor:!0,children:[` ↑ `,h,` more above`]})}),g.map((e,t)=>{let n=h+t===r;return Y(R,{flexDirection:`row`,children:[J(R,{width:2,children:J(z,{color:n?`cyan`:void 0,children:n?`❯ `:` `})}),J(R,{width:3,children:J(z,{color:mn[e.state],children:hn[e.state]})}),J(R,{width:14,children:J(z,{dimColor:!0,color:mn[e.state],children:gn[e.state]})}),J(R,{flexGrow:1,children:J(z,{bold:n,color:n?`cyan`:void 0,children:e.name})})]},e.id)}),v&&J(R,{children:Y(z,{dimColor:!0,children:[` `,`↓ `,p-h-8,` more below`]})})]}),b&&J(R,{flexDirection:`column`,marginTop:1,paddingX:1,children:J(z,{dimColor:!0,children:b.description})}),Y(R,{marginTop:1,flexDirection:`column`,children:[Y(z,{dimColor:!0,children:[`↑/↓ navigate · `,J(z,{bold:!0,children:`o`}),`/Enter open in editor ·`,` `,J(z,{bold:!0,children:`d`}),` delete (reset on next --apply) ·`,` `,J(z,{bold:!0,children:`r`}),` reload`]}),Y(z,{dimColor:!0,children:[J(z,{bold:!0,children:`f`}),` toggle deferred-tools footgun [`,J(z,{color:d?`red`:void 0,bold:d,children:d?`SUPPRESSED`:`vanilla`}),`] · Esc go back`]})]})]})}const vn=[`on`,`name-only`,`user-invocable-only`,`off`],yn={on:`on (full description)`,"name-only":`name-only (model sees no description)`,"user-invocable-only":`user-invocable (hidden from model, /name still works)`,off:`off (not loaded)`},bn={on:void 0,"name-only":`cyan`,"user-invocable-only":`yellow`,off:`red`},xn={on:`◉`,"name-only":`◐`,"user-invocable-only":`◑`,off:`○`},Sn=K.join(Pe.homedir(),`.claude`,`settings.json`),Cn=[K.join(Pe.homedir(),`.claude`,`skills`),K.join(Pe.homedir(),`.agents`,`skills`)],wn=e=>vn[(vn.indexOf(e)+1)%vn.length],Tn=e=>vn[(vn.indexOf(e)-1+vn.length)%vn.length],En=()=>{let e=new Set;for(let t of Cn)if(G.existsSync(t))try{let n=G.readdirSync(t,{withFileTypes:!0});for(let t of n)(t.isDirectory()||t.isSymbolicLink())&&e.add(t.name)}catch{}return[...e].sort()},Dn=()=>{try{let e=G.readFileSync(Sn,`utf8`);return{skillOverrides:JSON.parse(e).skillOverrides??{}}}catch{return{skillOverrides:{}}}},On=e=>{let t={};try{t=JSON.parse(G.readFileSync(Sn,`utf8`))}catch{}t.skillOverrides=e,G.writeFileSync(Sn,JSON.stringify(t,null,2))};function kn({onSubmit:e}){let[t,n]=W({}),[r,i]=W([]),[a,o]=W(0),[s,c]=W(!1);U(()=>{i(En()),n(Dn().skillOverrides)},[]);let l=Me(()=>r.map(e=>({name:e,state:t[e]??`on`})),[r,t]),u=l.length,d=Math.max(0,u-1),f=Me(()=>a<10?0:Math.min(a-10+1,Math.max(0,u-10)),[a,u]),p=l.slice(f,f+10),m=(e,r)=>{let i=l[e]?.name;if(!i)return;let a={...t};r===`on`?delete a[i]:a[i]=r,n(a),On(a),c(!0),setTimeout(()=>c(!1),1500)};B((t,n)=>{if(n.escape||n.return&&u===0){e();return}n.upArrow?o(e=>Math.max(0,e-1)):n.downArrow?o(e=>Math.min(d,e+1)):t===` `||n.rightArrow?m(a,wn(l[a]?.state??`on`)):n.leftArrow?m(a,Tn(l[a]?.state??`on`)):t===`0`?m(a,`on`):t===`x`&&m(a,`off`)});let h=l[a];return Y(R,{flexDirection:`column`,children:[J(R,{marginBottom:1,children:J(X,{children:`Skills (per-skill skillOverrides)`})}),Y(R,{marginBottom:1,flexDirection:`column`,children:[Y(z,{children:[`Writes `,J(z,{bold:!0,children:`skillOverrides`}),` to`,` `,J(z,{color:`cyan`,children:`~/.claude/settings.json`}),` — CC reads this natively, no tweakcc patch needed.`]}),J(z,{dimColor:!0,children:`Each skill: on / name-only / user-invocable-only / off. CC honors immediately; no --apply required.`})]}),u===0?J(R,{children:Y(z,{color:`yellow`,children:[`No skills found in`,` `,Cn.map(e=>e.replace(Pe.homedir(),`~`)).join(` or `),`.`]})}):Y(q,{children:[f>0&&J(R,{children:Y(z,{dimColor:!0,children:[` ↑ `,f,` more above`]})}),p.map((e,t)=>{let n=f+t===a;return Y(R,{flexDirection:`row`,children:[J(R,{width:2,children:J(z,{color:n?`cyan`:void 0,children:n?`❯ `:` `})}),J(R,{width:3,children:J(z,{color:bn[e.state],children:xn[e.state]})}),J(R,{width:26,children:J(z,{dimColor:!0,color:bn[e.state],children:e.state})}),J(R,{flexGrow:1,children:J(z,{bold:n,color:n?`cyan`:void 0,children:e.name})})]},e.name)}),f+10<u&&J(R,{children:Y(z,{dimColor:!0,children:[` `,`↓ `,u-f-10,` more below`]})})]}),h&&J(R,{flexDirection:`column`,marginTop:1,children:J(z,{dimColor:!0,children:yn[h.state]})}),Y(R,{marginTop:1,flexDirection:`column`,children:[Y(z,{dimColor:!0,children:[`↑/↓ navigate · space/→/← cycle state · `,J(z,{bold:!0,children:`0`}),` set on ·`,` `,J(z,{bold:!0,children:`x`}),` set off · Esc back`]}),s&&J(z,{color:`green`,children:`✓ saved to settings.json`})]})]})}const $=Ae({settings:M,updateSettings:e=>{},changesApplied:!1,ccVersion:``});function An({startupCheckInfo:e,configMigrated:t,invocationCommand:n,initialConfig:r}){let[i,a]=W(r),[o,c]=W(!r.hidePiebaldAnnouncement),[l,d]=W(null),p=je(e=>{let t=JSON.parse(JSON.stringify(i.settings));e(t),a(e=>({...e,settings:t,changesApplied:!1})),fe(e=>{e.settings=t,e.changesApplied=!1}).catch(e=>{d({type:`error`,message:`Failed to save settings: ${e instanceof Error?e.message:String(e)}`})})},[i.settings]),[m,h]=W(null);U(()=>{e.wasUpdated&&e.oldVersion&&(d({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
8
+ (However, your customization are still remembered in ${P}.)
9
9
 
10
- Please reapply your changes by running \`${n} --apply\`.`,type:`warning`}),d(()=>{}))},[]),B((e,t)=>{t.ctrl&&e===`c`&&process.exit(0),(e===`q`||t.escape)&&!f&&process.exit(0),e===`h`&&!f&&o&&(s(!1),ue(e=>{e.hidePiebaldAnnouncement=!0}))},{isActive:!f});let h=t=>{switch(u(null),t){case Z.THEMES:case Z.THINKING_VERBS:case Z.THINKING_STYLE:case Z.USER_MESSAGE_DISPLAY:case Z.INPUT_PATTERN_HIGHLIGHTERS:case Z.MISC:case Z.TOOLSETS:case Z.SUBAGENT_MODELS:case Z.COMPLEXITY_ROUTER:case Z.CLAUDE_MD_ALT_NAMES:case Z.SYSTEM_REMINDERS:case Z.SKILLS:case Z.BROWSER_BRIDGE:m(t);break;case Z.VIEW_SYSTEM_PROMPTS:p(w);break;case Z.RESTORE_ORIGINAL:e.ccInstInfo&&(e.ccInstInfo.nativeInstallationPath?ce(e.ccInstInfo):l(e.ccInstInfo)).then(e=>{e?(u({message:`Original Claude Code restored successfully!`,type:`success`}),d(()=>{})):u({message:`No backup found — nothing to restore.`,type:`warning`})}).catch(e=>{u({message:`Failed to restore: ${e instanceof Error?e.message:String(e)}`,type:`error`})});break;case Z.OPEN_CONFIG:A(N);break;case Z.OPEN_CLI:e.ccInstInfo?.cliPath&&A(e.ccInstInfo.cliPath);break;case Z.EXIT:process.exit(0)}},g=()=>{m(null)};return J($.Provider,{value:{settings:i.settings,updateSettings:d,changesApplied:i.changesApplied,ccVersion:e.ccInstInfo?.version||``},children:J(R,{flexDirection:`column`,children:f===null?J($e,{onSubmit:h,notification:c,configMigrated:t,showPiebaldAnnouncement:o,changesApplied:i.changesApplied,invocationCommand:n}):f===Z.THEMES?J(ht,{onBack:g}):f===Z.THINKING_VERBS?J(_t,{onBack:g}):f===Z.THINKING_STYLE?J(St,{onBack:g}):f===Z.USER_MESSAGE_DISPLAY?J(Et,{onBack:g}):f===Z.INPUT_PATTERN_HIGHLIGHTERS?J(jt,{onBack:g}):f===Z.MISC?J(Pt,{onSubmit:g}):f===Z.TOOLSETS?J(Lt,{onBack:g}):f===Z.SUBAGENT_MODELS?J(Rt,{onBack:g}):f===Z.COMPLEXITY_ROUTER?J(Wt,{onBack:g}):f===Z.CLAUDE_MD_ALT_NAMES?J(an,{onBack:g}):f===Z.SYSTEM_REMINDERS?J(dn,{onSubmit:g}):f===Z.SKILLS?J(Cn,{onSubmit:g}):f===Z.BROWSER_BRIDGE?J(rn,{onBack:g}):null})})}async function Tn(e,t){let n=t??await j(),r=await L(n,e);if(!r)return{startupCheckInfo:null,pendingCandidates:null,config:n};let i=Se(r);return i?{startupCheckInfo:null,pendingCandidates:i,config:n}:{startupCheckInfo:await En(n,r),pendingCandidates:null,config:n}}async function En(e,t){if(!t)return null;if(t.version)try{h(await le(t.version))}catch{}let n=t.version,r=e.ccVersion,i=!1;await te(I)||(M(`startupCheck: ${I} not found; backing up cli.js`),await x(t),i=!0);let o=!1;return t.nativeInstallationPath&&!await te(k)&&(M(`startupCheck: ${k} not found; backing up native binary`),await a(t),o=!0),n===r?{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}:(i||(M(`startupCheck: real version (${n}) != backed up version (${r}); backing up cli.js`),await Fe.unlink(I),await x(t)),t.nativeInstallationPath&&!o&&(M(`startupCheck: real version (${n}) != backed up version (${r}); backing up native binary`),await te(k)&&await Fe.unlink(k),await a(t)),{wasUpdated:!0,oldVersion:r,newVersion:n,ccInstInfo:t})}let Dn;async function On(){if(Dn!==void 0)return Dn;try{return Dn=(await import(`oxfmt`)).format,Dn}catch(e){return M(`Failed to load oxfmt:`,e),Dn=null,null}}async function kn(e,t,n){let r=await On();if(!r)return M(`oxfmt unavailable, skipping format+diff`),{reason:`oxfmt-unavailable`,originalFailed:!1,modifiedFailed:!1};let i=n?.contextLines??10,a=n?.printWidth??80,o=performance.now(),[s,c]=await Promise.all([r(`original.js`,e,{printWidth:a}),r(`modified.js`,t,{printWidth:a})]),l=performance.now();if(s.errors.length>0||c.errors.length>0)return M(`oxfmt format errors:`,`original:`,s.errors,`modified:`,c.errors),{reason:`format-error`,originalFailed:s.errors.length>0,modifiedFailed:c.errors.length>0};let u=Be(`original.js`,`modified.js`,s.code,c.code,``,``,{context:i}),d=performance.now();return{hunks:u.hunks,changeCount:u.hunks.length,formattedLines:s.code.split(`
11
- `).length,timings:{formatMs:l-o,diffMs:d-l,totalMs:d-o}}}function An(e,t=!0){return new Promise(n=>{let r=!1,i=e=>{r||(r=!0,a.close(),n(e))},a=Ue.createInterface({input:process.stdin,output:process.stderr});a.on(`close`,()=>i(!1)),a.on(`SIGINT`,()=>i(!1)),a.question(e,e=>{let n=e.trim().toLowerCase();if(n===``)return i(t);i(n===`y`||n===`yes`)})})}function jn(e){for(let t of e){console.log(V.cyan(`@@ -${t.oldStart} +${t.newStart} @@`));for(let e of t.lines)e.startsWith(`+`)?console.log(V.green(e)):e.startsWith(`-`)?console.log(V.red(e)):console.log(V.gray(e));console.log()}}async function Mn(e,t,n=!1){if(n)return!0;console.log(V.gray(`Formatting for diff preview...`));let r=await kn(e,t,{contextLines:10});if(`reason`in r){if(r.reason===`format-error`&&r.modifiedFailed&&!r.originalFailed)return console.log(V.red(`
10
+ Please reapply your changes by running \`${n} --apply\`.`,type:`warning`}),p(()=>{}))},[]),B((e,t)=>{t.ctrl&&e===`c`&&process.exit(0),(e===`q`||t.escape)&&!m&&process.exit(0),e===`h`&&!m&&o&&(c(!1),fe(e=>{e.hidePiebaldAnnouncement=!0}))},{isActive:!m});let g=t=>{switch(d(null),t){case Z.THEMES:case Z.THINKING_VERBS:case Z.THINKING_STYLE:case Z.USER_MESSAGE_DISPLAY:case Z.INPUT_PATTERN_HIGHLIGHTERS:case Z.MISC:case Z.TOOLSETS:case Z.SUBAGENT_MODELS:case Z.COMPLEXITY_ROUTER:case Z.CLAUDE_MD_ALT_NAMES:case Z.SYSTEM_REMINDERS:case Z.SKILLS:case Z.BROWSER_BRIDGE:h(t);break;case Z.VIEW_SYSTEM_PROMPTS:f(T);break;case Z.RESTORE_ORIGINAL:e.ccInstInfo&&(e.ccInstInfo.nativeInstallationPath?S(e.ccInstInfo):s(e.ccInstInfo)).then(e=>{e?(d({message:`Original Claude Code restored successfully!`,type:`success`}),p(()=>{})):d({message:`No backup found — nothing to restore.`,type:`warning`})}).catch(e=>{d({message:`Failed to restore: ${e instanceof Error?e.message:String(e)}`,type:`error`})});break;case Z.OPEN_CONFIG:u(P);break;case Z.OPEN_CLI:e.ccInstInfo?.cliPath&&u(e.ccInstInfo.cliPath);break;case Z.EXIT:process.exit(0)}},_=()=>{h(null)};return J($.Provider,{value:{settings:i.settings,updateSettings:p,changesApplied:i.changesApplied,ccVersion:e.ccInstInfo?.version||``},children:J(R,{flexDirection:`column`,children:m===null?J(et,{onSubmit:g,notification:l,configMigrated:t,showPiebaldAnnouncement:o,changesApplied:i.changesApplied,invocationCommand:n}):m===Z.THEMES?J(gt,{onBack:_}):m===Z.THINKING_VERBS?J(vt,{onBack:_}):m===Z.THINKING_STYLE?J(Ct,{onBack:_}):m===Z.USER_MESSAGE_DISPLAY?J(Dt,{onBack:_}):m===Z.INPUT_PATTERN_HIGHLIGHTERS?J(Mt,{onBack:_}):m===Z.MISC?J(Ft,{onSubmit:_}):m===Z.TOOLSETS?J(Rt,{onBack:_}):m===Z.SUBAGENT_MODELS?J(zt,{onBack:_}):m===Z.COMPLEXITY_ROUTER?J(Gt,{onBack:_}):m===Z.FABLE_PLAN?J(Xt,{onBack:_}):m===Z.CLAUDE_MD_ALT_NAMES?J(dn,{onBack:_}):m===Z.SYSTEM_REMINDERS?J(_n,{onSubmit:_}):m===Z.SKILLS?J(kn,{onSubmit:_}):m===Z.BROWSER_BRIDGE?J(un,{onBack:_}):null})})}async function jn(e){try{return await e(),!0}catch(e){if(!(e instanceof i))throw e;return console.log(V.yellow(e.message)),!1}}async function Mn(e,t){let n=t??await j(),r=await _e(n,e);if(!r)return{startupCheckInfo:null,pendingCandidates:null,config:n};let i=we(r);return i?{startupCheckInfo:null,pendingCandidates:i,config:n}:{startupCheckInfo:await Nn(n,r),pendingCandidates:null,config:n}}async function Nn(e,t){if(!t)return null;if(t.version)try{de(await A(t.version))}catch{}let n=t.version,r=e.ccVersion,i=!1;await k(ue)||(N(`startupCheck: ${ue} not found; backing up cli.js`),i=await jn(()=>c(t)));let a=!1;return t.nativeInstallationPath&&!await k(ne)&&(N(`startupCheck: ${ne} not found; backing up native binary`),a=await jn(()=>ce(t))),n===r?{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}:(i||(N(`startupCheck: real version (${n}) != backed up version (${r}); backing up cli.js`),await jn(()=>c(t))),t.nativeInstallationPath&&!a&&(N(`startupCheck: real version (${n}) != backed up version (${r}); backing up native binary`),await jn(()=>ce(t))),{wasUpdated:!0,oldVersion:r,newVersion:n,ccInstInfo:t})}let Pn;async function Fn(){if(Pn!==void 0)return Pn;try{return Pn=(await import(`oxfmt`)).format,Pn}catch(e){return N(`Failed to load oxfmt:`,e),Pn=null,null}}async function In(e,t,n){let r=await Fn();if(!r)return N(`oxfmt unavailable, skipping format+diff`),{reason:`oxfmt-unavailable`,originalFailed:!1,modifiedFailed:!1};let i=n?.contextLines??10,a=n?.printWidth??80,o=performance.now(),[s,c]=await Promise.all([r(`original.js`,e,{printWidth:a}),r(`modified.js`,t,{printWidth:a})]),l=performance.now();if(s.errors.length>0||c.errors.length>0)return N(`oxfmt format errors:`,`original:`,s.errors,`modified:`,c.errors),{reason:`format-error`,originalFailed:s.errors.length>0,modifiedFailed:c.errors.length>0};let u=Ve(`original.js`,`modified.js`,s.code,c.code,``,``,{context:i}),d=performance.now();return{hunks:u.hunks,changeCount:u.hunks.length,formattedLines:s.code.split(`
11
+ `).length,timings:{formatMs:l-o,diffMs:d-l,totalMs:d-o}}}function Ln(e,t=!0){return new Promise(n=>{let r=!1,i=e=>{r||(r=!0,a.close(),n(e))},a=We.createInterface({input:process.stdin,output:process.stderr});a.on(`close`,()=>i(!1)),a.on(`SIGINT`,()=>i(!1)),a.question(e,e=>{let n=e.trim().toLowerCase();if(n===``)return i(t);i(n===`y`||n===`yes`)})})}function Rn(e){for(let t of e){console.log(V.cyan(`@@ -${t.oldStart} +${t.newStart} @@`));for(let e of t.lines)e.startsWith(`+`)?console.log(V.green(e)):e.startsWith(`-`)?console.log(V.red(e)):console.log(V.gray(e));console.log()}}async function zn(e,t,n=!1){if(n)return!0;console.log(V.gray(`Formatting for diff preview...`));let r=await In(e,t,{contextLines:10});if(`reason`in r){if(r.reason===`format-error`&&r.modifiedFailed&&!r.originalFailed)return console.log(V.red(`
12
12
  ⚠ The patched code failed to parse, but the original parsed cleanly —
13
- this can mean the patch corrupted the JavaScript. Proceed with caution.`)),An(V.bold(`
14
- Apply anyway, despite the parse failure? [y/N] `),!1);let e=r.reason===`oxfmt-unavailable`?`oxfmt unavailable`:`the JS could not be formatted`;return console.log(V.yellow(`Could not generate formatted diff (${e}).`)),An(V.bold(`
15
- Apply changes without diff preview? [Y/n] `))}return r.changeCount===0?(console.log(V.yellow(`No visible differences after formatting. Proceeding.`)),!0):(console.log(V.gray(`Formatted ${r.formattedLines.toLocaleString()} lines in ${r.timings.formatMs.toFixed(0)}ms\n`)),jn(r.hunks),console.log(V.gray(`${r.changeCount} change(s) across ${r.formattedLines.toLocaleString()} formatted lines (${r.timings.totalMs.toFixed(0)}ms)`)),An(V.bold(`
16
- Apply these changes? [Y/n] `)))}function Nn(e){return u(),{chalkVar:me(e),moduleLoaderFunction:b(e),reactVar:o(e),requireFuncName:y(e),textComponent:t(e),boxComponent:g(e)}}async function Pn(e,t,n,r=!1){let i=`
13
+ this can mean the patch corrupted the JavaScript. Proceed with caution.`)),Ln(V.bold(`
14
+ Apply anyway, despite the parse failure? [y/N] `),!1);let e=r.reason===`oxfmt-unavailable`?`oxfmt unavailable`:`the JS could not be formatted`;return console.log(V.yellow(`Could not generate formatted diff (${e}).`)),Ln(V.bold(`
15
+ Apply changes without diff preview? [Y/n] `))}return r.changeCount===0?(console.log(V.yellow(`No visible differences after formatting. Proceeding.`)),!0):(console.log(V.gray(`Formatted ${r.formattedLines.toLocaleString()} lines in ${r.timings.formatMs.toFixed(0)}ms\n`)),Rn(r.hunks),console.log(V.gray(`${r.changeCount} change(s) across ${r.formattedLines.toLocaleString()} formatted lines (${r.timings.totalMs.toFixed(0)}ms)`)),Ln(V.bold(`
16
+ Apply these changes? [Y/n] `)))}function Bn(t){return h(),{chalkVar:e(t),moduleLoaderFunction:a(t),reactVar:v(t),requireFuncName:b(t),textComponent:y(t),boxComponent:L(t)}}async function Vn(e,t,n,r=!1){let i=`
17
17
  let input = '';
18
18
  process.stdin.on('data', c => input += c);
19
19
  process.stdin.on('end', async () => {
@@ -28,10 +28,10 @@ Apply these changes? [Y/n] `)))}function Nn(e){return u(),{chalkVar:me(e),module
28
28
  process.exitCode = 1;
29
29
  }
30
30
  });
31
- `;if(r)return Ln([],i,t);try{return await Ln([`--permission`],i,t)}catch(e){if(!Fn(e))throw e}try{return await Ln([`--experimental-permission`],i,t)}catch(e){if(Fn(e)){let e=In();throw Error(`Your Node.js version (${e}) does not support the permission model.\nPlease either upgrade to Node.js 20+ or rerun with --dangerous-no-script-sandbox.`)}throw e}}function Fn(e){return e instanceof Error?e.message.includes(`bad option`):!1}function In(){try{return Le(`node --version`,{encoding:`utf8`}).trim()}catch{return`unknown`}}function Ln(e,t,n){return new Promise((r,i)=>{let a=Re(`node`,[...e,`-e`,t],{stdio:[`pipe`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>o+=e),a.stderr.on(`data`,e=>s+=e),a.on(`error`,i),a.stdin.on(`error`,()=>{}),a.on(`close`,e=>{if(e!==0)i(Error(s||`Script exited with code ${e}`));else try{r(JSON.parse(o).r)}catch{i(Error(`Script returned invalid JSON output.\nstdout: ${o}\nstderr: ${s}`))}}),a.stdin.write(n),a.stdin.end()})}async function Rn(e){if(!e.startsWith(`@`))return e;let t=e.slice(1);if(t.startsWith(`http://`)||t.startsWith(`https://`)){console.log(`Fetching script from ${t}...`);let e=await fetch(t,{signal:AbortSignal.timeout(2e4)});if(!e.ok)throw Error(`Failed to fetch script from ${t}: HTTP ${e.status} ${e.statusText}`);return re(e,16*1024*1024)}return console.log(`Reading script from ${t}...`),Pe.readFile(t,`utf8`)}async function zn(e){try{return await he({path:e,interactive:!1})}catch(e){let t=e instanceof Error?e.message:String(e);console.error(V.red(`Error: ${t}`)),process.exit(1)}}async function Bn(e,t){let n=await zn(t);n.kind===`npm`&&(console.error(V.red(`Error: Cannot unpack an npm-based installation (cli.js). Only native binaries can be unpacked.`)),console.error(V.gray(` Detected installation: ${n.path} (npm-based, v${n.version})`)),process.exit(1)),console.log(`Extracting JS from native binary: ${V.cyan(n.path)} (v${n.version})`);let{content:r}=await xe(n);await Pe.writeFile(e,r,`utf8`),console.log(V.green(`✓ Extracted JS written to ${V.cyan(e)}`)),console.log(V.gray(` ${r.length.toLocaleString()} characters written`))}async function Vn(e,t){let n=await zn(t);n.kind===`npm`&&(console.error(V.red(`Error: Cannot repack into an npm-based installation (cli.js). Only native binaries can be repacked.`)),console.error(V.gray(` Detected installation: ${n.path} (npm-based, v${n.version})`)),process.exit(1)),console.log(`Repacking JS into native binary: ${V.cyan(n.path)} (v${n.version})`);let r=await Pe.readFile(e,`utf8`);await ve(n,r,!r.startsWith(`// @bun @bytecode`)),console.log(V.green(`✓ JS from ${V.cyan(e)} repacked into ${V.cyan(n.path)}`))}async function Hn(e,t,n,r,i=!1){let{content:a,clearBytecode:o}=await xe(r),s,c;if(n!==void 0){let r=[],i=0;for(;;){let t=a.indexOf(e,i);if(t===-1)break;r.push(t),i=t+e.length}r.length===0&&(console.error(V.red(`Error: String not found in content.`)),process.exit(1)),(n<1||n>r.length)&&(console.error(V.red(`Error: Index ${n} is out of range. Found ${r.length} occurrence(s).`)),process.exit(1));let o=r[n-1];s=a.slice(0,o)+t+a.slice(o+e.length),c=1}else{let n=a.split(e);c=n.length-1,c===0&&(console.error(V.red(`Error: String not found in content.`)),process.exit(1)),s=n.join(t)}if(!await Mn(a,s,i)){console.log(V.yellow(`Aborted.`));return}await ve(r,s,o),console.log(V.green(`✓ Replaced ${c} occurrence(s) in ${V.cyan(r.path)}`))}function Un(e){if(e.startsWith(`/`)){let t=-1;for(let n=e.length-1;n>0;n--)if(e[n]===`/`){let r=0;for(let t=n-1;t>=0&&e[t]===`\\`;t--)r++;if(r%2==0){t=n;break}}if(t>0){let n=e.slice(1,t),r=e.slice(t+1);if(!/^[gimsuy]*$/.test(r))throw Error(`Invalid regex flags: "${r}". Valid flags are: g, i, m, s, u, y`);return{pattern:n,flags:r}}}return{pattern:e,flags:``}}async function Wn(e,t,n,r,i=!1){let{content:a,clearBytecode:o}=await xe(r),s;try{s=Un(e)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(V.red(`Error: ${t}`)),process.exit(1)}let c=s.flags.includes(`g`)?s.flags:s.flags+`g`,l,u,d=new RegExp(s.pattern,c);if(n!==void 0){let e=[...a.matchAll(d)];e.length===0&&(console.error(V.red(`Error: Regex pattern not found in content.`)),process.exit(1)),(n<1||n>e.length)&&(console.error(V.red(`Error: Index ${n} is out of range. Found ${e.length} match(es).`)),process.exit(1));let r=e[n-1],i=r.index,o=i+r[0].length,c=r[0].replace(new RegExp(s.pattern,s.flags),t);l=a.slice(0,i)+c+a.slice(o),u=1}else l=a.replace(d,t),u=[...a.matchAll(new RegExp(s.pattern,c))].length,u===0&&(console.error(V.red(`Error: Regex pattern not found in content.`)),process.exit(1));if(!await Mn(a,l,i)){console.log(V.yellow(`Aborted.`));return}await ve(r,l,o),console.log(V.green(`✓ Replaced ${u} match(es) in ${V.cyan(r.path)}`))}async function Gn(e,t,n=!1,r=!1){let{content:i,clearBytecode:a}=await xe(t),o=await Rn(e);console.log(`Resolving variables...`);let s=Nn(i);console.log(r?`Running patch script WITHOUT sandbox (--dangerous-no-script-sandbox)...`:`Running patch script in sandbox...`);let c;try{c=await Pn(o,i,s,r)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(V.red(`Error: Script execution failed:`)),console.error(V.red(` ${t}`)),process.exit(1)}if(typeof c!=`string`&&(console.error(V.red(`Error: Script did not return a string. Got: `+typeof c)),process.exit(1)),c===i){console.log(V.yellow(`Script returned unchanged content. Nothing to do.`));return}if(!await Mn(i,c,n)){console.log(V.yellow(`Aborted.`));return}await ve(t,c,a),console.log(V.green(`✓ Script patch applied to ${V.cyan(t.path)}`))}async function Kn(e){let t=[e.string,e.regex,e.script].filter(e=>e!==void 0);t.length===0&&(console.error(V.red(`Error: Must specify one of --string, --regex, or --script.`)),process.exit(1)),t.length>1&&(console.error(V.red(`Error: Only one of --string, --regex, or --script can be used at a time.`)),process.exit(1));let n=!!e.confirmPossibleDangerousPatch,r=await zn(e.path);console.log(`Target: ${V.cyan(r.path)} (${r.kind}, v${r.version})`),e.string?(e.string.length!==2&&(console.error(V.red(`Error: --string requires exactly 2 arguments: <old-string> <new-string>`)),process.exit(1)),await Hn(e.string[0],e.string[1],e.index,r,n)):e.regex?(e.regex.length!==2&&(console.error(V.red(`Error: --regex requires exactly 2 arguments: <pattern> <replacement>`)),process.exit(1)),await Wn(e.regex[0],e.regex[1],e.index,r,n)):e.script&&(e.index!==void 0&&(console.error(V.red(`Error: --index cannot be used with --script.`)),process.exit(1)),await Gn(e.script,r,n,!!e.dangerousNoScriptSandbox))}function qn(e){if(!e)return{ok:!0,filter:null};let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return{ok:!1,error:`--patches was provided but contained no patch IDs.`};let n=new Set(s().map(e=>e.id)),r=t.filter(e=>!n.has(e));return r.length>0?{ok:!1,error:`unknown patch ID(s) in --patches: ${r.join(`, `)}`}:{ok:!0,filter:t}}const Jn=K.join(ae,`native-claudejs-orig.js`),Yn=[`__tweakcc`,`tweakcc v`],Xn=e=>Yn.some(t=>e.includes(t)),Zn=e=>e.match(/VERSION:"(\d+\.\d+\.\d+)"/)?.[1],Qn=async(e,t,n)=>{let r;try{r=await Pe.readFile(e,`utf8`)}catch{return null}let i=Zn(r);return i===t?Xn(r)?(M(`${n}: carries tweakcc markers, skipping`),null):{content:r,version:t,source:n}:(M(`${n}: version ${i??`unknown`} != ${t}, skipping`),null)},$n=async(e,t,n)=>{try{await Pe.stat(e)}catch{return null}let{data:r}=await T(e,t);if(!r)return null;let i=r.toString(`utf8`);return Zn(i)!==t||Xn(i)?null:{content:i,version:t,source:n}},er=async e=>{let t=e.version;if(!t)return{error:`could not determine the installed Claude Code version`};let n=[];if(e.nativeInstallationPath){let r=[[Jn,()=>Qn(Jn,t,Jn)],[k,()=>$n(k,t,k)],[e.nativeInstallationPath,()=>$n(e.nativeInstallationPath,t,e.nativeInstallationPath)]];for(let[e,t]of r){let r=await t();if(r)return r;n.push(e)}}else if(e.cliPath)for(let r of[I,e.cliPath]){let e=await Qn(r,t,r);if(e)return e;n.push(r)}return{error:`no pristine, version-matched (${t}) cli.js available. Tried: ${n.join(`, `)}. Run --restore, or --apply once so the pristine extract is saved.`}},tr=async e=>{let t;try{t=await Pe.readFile(e,`utf8`)}catch(t){return{error:`cannot read ${e}: ${String(t)}`}}let n=Zn(t);return n?Xn(t)?{error:`${e} carries tweakcc markers — it is not pristine`}:{content:t,version:n,source:e}:{error:`${e} carries no VERSION:"X.Y.Z" marker`}};function nr(){let e=process.argv[1]||``;return e.includes(`npx`)||e.includes(`.npm/_npx`)?`npx tweakcc-fixed`:e.includes(`pnpm`)||e.includes(`.pnpm`)?`pnpm dlx tweakcc-fixed`:e.includes(`yarn`)?`yarn dlx tweakcc-fixed`:e.includes(`bun`)?`bunx tweakcc-fixed`:`tweakcc-fixed`}function rr(e,t){let n=[f.SYSTEM_PROMPTS,f.ALWAYS_APPLIED,f.MISC_CONFIGURABLE,f.FEATURES,f.SYSTEM_REMINDERS],r=new Map;for(let e of n)r.set(e,[]);for(let t of e){let e=r.get(t.group);e&&e.push(t)}console.log(`
32
- Patches applied (run with --show-unchanged to show all patches):`);for(let e of n){let n=r.get(e).filter(e=>e.applied||e.failed||v()||t&&t.includes(e.id));if(n.length!==0){console.log(`\n ${V.bold(e)}:`);for(let e of n){let t=e.failed?V.red(`✗`):e.applied?V.green(`✓`):V.dim(`○`),n=e.details?`: ${e.details}`:``,r=e.applied&&e.description?` ${V.gray(`—`)} ${V.gray(e.description)}`:``;console.log(` ${t} ${e.name}${n}${r}`)}}}console.log(``)}function ir(e){let t=e.filter(e=>e.applied&&e.modelFacing);if(t.length!==0){console.log(V.yellow(`ℹ These applied patches change model-facing behavior (not just output styling):`));for(let e of t){let t=e.description?` ${V.dim(`—`)} ${e.description}`:``;console.log(` ${V.yellow(`•`)} ${e.name}${V.dim(t)}`)}console.log(V.dim(` Several are on by default. Toggle any off in the menu or ~/.tweakcc/config.json, or run --restore to revert everything.`)),console.log(``)}}const ar=async()=>{let e=new Te;e.name(`tweakcc-fixed`).description(`Maintained fork of tweakcc — customize and patch your installed Claude Code (system-prompt overrides, themes, thinking verbs and more).`).version(m).option(`-d, --debug`,`enable debug mode`).option(`-v, --verbose`,`enable verbose debug mode (includes diffs)`).option(`--show-unchanged`,`show unchanged diffs (requires --verbose)`).option(`-a, --apply`,`apply saved customizations without interactive UI`).option(`--restore`,`restore Claude Code to its original state`).option(`--revert`,`restore Claude Code to its original state (alias for --restore)`).option(`--patches <ids>`,`comma-separated list of patch IDs to apply (use with --apply)`).option(`--list-patches`,`list all available patches with their IDs`).option(`--json`,`with --list-patches: output machine-readable JSON (id, name, group, description)`).option(`--list-system-prompts [version]`,`list all available system prompts for a CC version`).option(`--validate-system-prompts [cliJsPath]`,`dry-run the apply preflight over the system-prompt overrides (no writes)`).option(`--config-url <url>`,`fetch configuration from a URL instead of local config.json`).action(async()=>{let t=e.opts();t.verbose?pe():t.debug&&C(),t.showUnchanged&&de();let n=await E();if(t.apply&&(t.restore||t.revert)&&(console.error(V.red(`Error: Cannot use --apply and --restore/--revert together.`)),process.exit(1)),t.listPatches){lr(!!t.json);return}if(t.listSystemPrompts!==void 0){await ur(t.listSystemPrompts);return}if(t.validateSystemPrompts!==void 0){await sr(t.validateSystemPrompts);return}if(t.apply){let e=qn(t.patches);e.ok||(console.error(V.red(`Error: ${e.error}`)),console.error(V.gray(`Run "${nr()} --list-patches" to see valid IDs.`)),process.exit(1)),await or(e.filter,t.configUrl);return}if(t.configUrl&&(console.error(V.red(`Error: --config-url can only be used with --apply.`)),console.error(V.gray(`The interactive TUI is for editing local configuration only.`)),console.error(V.gray(`To apply a remote config, use:`)),console.error(V.gray(` ${nr()} --apply --config-url <url>`)),process.exit(1)),t.restore||t.revert){await cr();return}await dr(n)}),e.command(`unpack`).argument(`<output-js-path>`,`path to write extracted JS`).argument(`[binary-path]`,`path to native binary (default: auto-detect)`).description(`Extract JS from a native Claude Code binary`).action(async(e,t)=>{await Bn(e,t),process.exit(0)}),e.command(`repack`).argument(`<input-js-path>`,`path to JS file to embed`).argument(`[binary-path]`,`path to native binary (default: auto-detect)`).description(`Embed JS into a native Claude Code binary`).action(async(e,t)=>{await Vn(e,t),process.exit(0)}),e.command(`adhoc-patch`).description(`Apply an ad-hoc patch to Claude Code`).option(`-s, --string <values...>`,`replace string: <old-string> <new-string>`).option(`-r, --regex <values...>`,`replace regex: <pattern> <replacement>`).option(`--script <script>`,`run a patch script (prefix with @ for file/URL)`).option(`-i, --index <number>`,`replace only the Nth occurrence (1-based)`,parseInt).option(`-p, --path <path>`,`path to cli.js or native binary (default: auto-detect)`).option(`--confirm-possible-dangerous-patch`,`skip diff preview and apply immediately`).option(`--dangerous-no-script-sandbox`,`run --script without the Node.js permission sandbox (use if Node < 20)`).action(async e=>{await Kn(e),process.exit(0)}),e.parse()};async function or(e,t){console.log(`Applying saved customizations to Claude Code...`);let n;if(t){console.log(`Fetching configuration from: ${t}`);try{n=await F(t),console.log(`Configuration fetched successfully.`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(V.red(`Error: ${t}`)),process.exit(1)}}else console.log(`Configuration saved at: ${N}`),n=await j();if(!n.settings||Object.keys(n.settings).length===0){let e=t||N;console.error(`No saved customizations found in `+e),process.exit(1)}try{let t=await Tn({interactive:!1},n);(!t.startupCheckInfo||!t.startupCheckInfo.ccInstInfo)&&(console.error(_e()),process.exit(1));let{ccInstInfo:r}=t.startupCheckInfo;r.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${r.nativeInstallationPath}`):console.log(`Found Claude Code at: ${r.cliPath}`),console.log(`Version: ${r.version}`),console.log(`Loading system prompts...`);let a=await D(r.version);a.success||(console.log(V.red(`
33
- ✖ Error downloading system prompts:`)),console.log(V.red(` ${a.errorMessage}`)),console.log(V.yellow(`
34
- ⚠ System prompts not available - skipping system prompt customizations`))),console.log(`Applying customizations...`);let{results:o}=await i(n,r,e);rr(o,e),ir(o);let s=o.some(e=>e.failed),c=o.some(e=>e.group===f.SYSTEM_PROMPTS&&e.applied);s?(console.log(V.yellow(`Customizations applied with some failures.`)),console.log(V.dim(`These patching errors do not affect your system prompt patches.`)),c&&console.log(V.dim(`Your system prompt customizations were still applied successfully.`)),console.log(V.dim(`Please open an issue on https://github.com/skrabe/tweakcc-fixed/issues/new reporting these patching errors.`))):console.log(V.green(`Customizations applied successfully!`)),console.log(V.dim(`Run with --restore/--revert to revert Claude Code to its original state.`)),process.exit(0)}catch(e){throw e instanceof be&&(console.error(V.red(`Error: ${e.message}`)),process.exit(1)),e}}async function sr(e){let t=typeof e==`string`?await tr(e):await(async()=>{let e=(await Tn({interactive:!1})).startupCheckInfo?.ccInstInfo;return e?er(e):{error:`no Claude Code installation detected`}})();`error`in t&&(console.error(V.red(`Error: ${t.error}`)),process.exit(1)),console.log(`Validating system prompt overrides against CC ${t.version}`),console.log(V.dim(` pristine: ${t.source}`));let n=await D(t.version);n.success||(console.error(V.red(`Error: could not load prompt data for ${t.version}:`)),console.error(V.red(` ${n.errorMessage}`)),process.exit(1));let r=await S({pristine:t.content,version:t.version});r.promptsChecked===0&&(console.error(V.red(`Error: no system prompts resolved — nothing was validated.`)),process.exit(1)),console.log(V.dim(` ${r.promptsChecked} catalogue entries, ${r.sitesChecked} resolved sites`));for(let e of r.findings){let t=c(e);e.severity===`error`?console.log(V.red(t)):e.severity===`warning`?console.log(V.yellow(t)):console.log(V.dim(t))}r.findings.length===0&&(console.log(V.green(`0 findings.`)),process.exit(0));let i=e=>r.findings.filter(t=>t.severity===e).length;console.log(V.red(`${r.findings.length} finding(s): ${i(`error`)} error(s), ${i(`warning`)} warning(s), ${i(`info`)} info.`)),process.exit(1)}async function cr(){console.log(`Restoring Claude Code to its original state...`);try{let e=await Tn({interactive:!1});(!e.startupCheckInfo||!e.startupCheckInfo.ccInstInfo)&&(console.error(_e()),process.exit(1));let{ccInstInfo:t}=e.startupCheckInfo;t.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${t.nativeInstallationPath}`):console.log(`Found Claude Code at: ${t.cliPath}`),console.log(`Version: ${t.version}`),console.log(`Restoring from backup...`);let n;n=t.nativeInstallationPath?await ce(t):await l(t),n||(console.error(V.red(`No backup found. Cannot restore original Claude Code.`)),console.error(V.yellow(`Tip: A backup is created automatically when you first apply customizations.`)),process.exit(1)),await oe(),await ue(e=>{e.changesApplied=!1}),console.log(V.blue(`Original Claude Code restored successfully!`)),console.log(V.gray(`Your customizations are still saved in ${N} and can be reapplied with --apply.`)),process.exit(0)}catch(e){throw e instanceof be&&(console.error(V.red(`Error: ${e.message}`)),process.exit(1)),e}}function lr(e=!1){let t=s();if(e){console.log(JSON.stringify(t.map(e=>({id:e.id,name:e.name,group:e.group,description:e.description})),null,2));return}let n=[f.ALWAYS_APPLIED,f.MISC_CONFIGURABLE,f.FEATURES,f.SYSTEM_REMINDERS],r=new Map;for(let e of n)r.set(e,[]);for(let e of t){let t=r.get(e.group);t&&t.push(e)}console.log(V.gray(`Use --patches <ids> with --apply to apply specific patches, e.g.:`)),console.log(),console.log(V.gray(` tweakcc --apply --patches "themes,toolsets"`)),console.log(),console.log(V.blue.bold(`Available patches`)),console.log();for(let e of n){let t=r.get(e);if(t.length!==0){console.log(V.bold(e)+`:`);for(let e of t)console.log(` ${V.cyan(e.id)}`),console.log(` ${V.white(e.name)} ${V.gray(`—`)} ${V.gray(e.description)}`);console.log(``)}}console.log(V.bold(`System Prompts:`)),console.log(V.dim(` System prompts also have IDs that can be used with --patches. Use --list-system-prompts [version] to see them.`))}async function ur(t){let n;if(typeof t==`string`)n=t;else{console.log(`Detecting installed Claude Code version...`);try{let e=await Tn({interactive:!1});e.startupCheckInfo?.ccInstInfo?.version||(console.error(V.red(`Could not detect Claude Code version. Please specify a version:`)),console.error(V.gray(` tweakcc --list-system-prompts 1.0.20`)),process.exit(1)),n=e.startupCheckInfo.ccInstInfo.version}catch{console.error(V.red(`Could not detect Claude Code installation. Please specify a version:`)),console.error(V.gray(` tweakcc --list-system-prompts 1.0.20`)),process.exit(1)}}console.log(`Loading system prompts for CC version ${n}...`);let r=await D(n);r.success||(console.error(V.red(`
35
- ✖ Error loading system prompts:`)),console.error(V.red(` ${r.errorMessage}`)),process.exit(1));let i=e();(!i||i.length===0)&&(console.error(V.yellow(`No system prompts found for this version.`)),process.exit(1));let a=e=>{let t=e.indexOf(`:`);if(t===-1)return`Other`;let n=e.substring(0,t).trim();return n===`Data`?n:n+`s`},o=new Map;for(let e of i){let t=a(e.name);o.has(t)||o.set(t,[]),o.get(t).push(e)}let s=[...o.keys()].sort((e,t)=>e.localeCompare(t));console.log(V.gray(`Use --patches <ids> with --apply to apply specific prompts, e.g.:`)),console.log(),console.log(V.gray(` tweakcc --apply --patches "identity,environment"`)),console.log(),console.log(V.blue.bold(`System prompts for CC ${n}`)),console.log();for(let e of s){let t=o.get(e);t.sort((e,t)=>e.name.localeCompare(t.name)),console.log(V.bold(e)+`:`);for(let e of t)console.log(` ${V.cyan(e.id)}`),console.log(` ${V.white(e.name)} ${V.gray(`—`)} ${V.gray(e.description)}`);console.log(``)}console.log(V.yellow(`To see all original system prompts for a given Claude Code version, visit:`)),console.log(V.yellow.bold(` https://github.com/Piebald-AI/claude-code-system-prompts`))}async function dr(e){try{let t=await Tn({interactive:!0});if(t.pendingCandidates){await fr(t.pendingCandidates,e);return}t.startupCheckInfo||(console.error(V.red(_e())),process.exit(1)),await pr(t.startupCheckInfo,e,t.config)}catch(e){throw e instanceof be&&(console.error(V.red(`Error: ${e.message}`)),process.exit(1)),e}}async function fr(e,t){return new Promise((n,r)=>{let i=Ce(J(ye,{candidates:e,onSelect:async e=>{try{let r=await ge(e),a=await j(),o=await En(a,r);o||(console.error(V.red(`Error: Failed to complete startup check after selection.`)),process.exit(1)),i.unmount(),await pr(o,t,a),n()}catch(e){r(e)}}}))})}async function pr(e,t,n){let r=await D(e.ccInstInfo.version);r.success||(console.log(V.red(`
31
+ `;if(r)return Wn([],i,t);try{return await Wn([`--permission`],i,t)}catch(e){if(!Hn(e))throw e}try{return await Wn([`--experimental-permission`],i,t)}catch(e){if(Hn(e)){let e=Un();throw Error(`Your Node.js version (${e}) does not support the permission model.\nPlease either upgrade to Node.js 20+ or rerun with --dangerous-no-script-sandbox.`)}throw e}}function Hn(e){return e instanceof Error?e.message.includes(`bad option`):!1}function Un(){try{return Re(`node --version`,{encoding:`utf8`}).trim()}catch{return`unknown`}}function Wn(e,t,n){return new Promise((r,i)=>{let a=ze(`node`,[...e,`-e`,t],{stdio:[`pipe`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>o+=e),a.stderr.on(`data`,e=>s+=e),a.on(`error`,i),a.stdin.on(`error`,()=>{}),a.on(`close`,e=>{if(e!==0)i(Error(s||`Script exited with code ${e}`));else try{r(JSON.parse(o).r)}catch{i(Error(`Script returned invalid JSON output.\nstdout: ${o}\nstderr: ${s}`))}}),a.stdin.write(n),a.stdin.end()})}async function Gn(e){if(!e.startsWith(`@`))return e;let t=e.slice(1);if(t.startsWith(`http://`)||t.startsWith(`https://`)){console.log(`Fetching script from ${t}...`);let e=await fetch(t,{signal:AbortSignal.timeout(2e4)});if(!e.ok)throw Error(`Failed to fetch script from ${t}: HTTP ${e.status} ${e.statusText}`);return re(e,16*1024*1024)}return console.log(`Reading script from ${t}...`),Ie.readFile(t,`utf8`)}async function Kn(e){try{return await ge({path:e,interactive:!1})}catch(e){let t=e instanceof Error?e.message:String(e);console.error(V.red(`Error: ${t}`)),process.exit(1)}}async function qn(e,t){let n=await Kn(t);n.kind===`npm`&&(console.error(V.red(`Error: Cannot unpack an npm-based installation (cli.js). Only native binaries can be unpacked.`)),console.error(V.gray(` Detected installation: ${n.path} (npm-based, v${n.version})`)),process.exit(1)),console.log(`Extracting JS from native binary: ${V.cyan(n.path)} (v${n.version})`);let{content:r}=await Ce(n);await Ie.writeFile(e,r,`utf8`),console.log(V.green(`✓ Extracted JS written to ${V.cyan(e)}`)),console.log(V.gray(` ${r.length.toLocaleString()} characters written`))}async function Jn(e,t){let n=await Kn(t);n.kind===`npm`&&(console.error(V.red(`Error: Cannot repack into an npm-based installation (cli.js). Only native binaries can be repacked.`)),console.error(V.gray(` Detected installation: ${n.path} (npm-based, v${n.version})`)),process.exit(1)),console.log(`Repacking JS into native binary: ${V.cyan(n.path)} (v${n.version})`);let r=await Ie.readFile(e,`utf8`);await be(n,r,!r.startsWith(`// @bun @bytecode`)),console.log(V.green(`✓ JS from ${V.cyan(e)} repacked into ${V.cyan(n.path)}`))}async function Yn(e,t,n,r,i=!1){let{content:a,clearBytecode:o}=await Ce(r),s,c;if(n!==void 0){let r=[],i=0;for(;;){let t=a.indexOf(e,i);if(t===-1)break;r.push(t),i=t+e.length}r.length===0&&(console.error(V.red(`Error: String not found in content.`)),process.exit(1)),(n<1||n>r.length)&&(console.error(V.red(`Error: Index ${n} is out of range. Found ${r.length} occurrence(s).`)),process.exit(1));let o=r[n-1];s=a.slice(0,o)+t+a.slice(o+e.length),c=1}else{let n=a.split(e);c=n.length-1,c===0&&(console.error(V.red(`Error: String not found in content.`)),process.exit(1)),s=n.join(t)}if(!await zn(a,s,i)){console.log(V.yellow(`Aborted.`));return}await be(r,s,o),console.log(V.green(`✓ Replaced ${c} occurrence(s) in ${V.cyan(r.path)}`))}function Xn(e){if(e.startsWith(`/`)){let t=-1;for(let n=e.length-1;n>0;n--)if(e[n]===`/`){let r=0;for(let t=n-1;t>=0&&e[t]===`\\`;t--)r++;if(r%2==0){t=n;break}}if(t>0){let n=e.slice(1,t),r=e.slice(t+1);if(!/^[gimsuy]*$/.test(r))throw Error(`Invalid regex flags: "${r}". Valid flags are: g, i, m, s, u, y`);return{pattern:n,flags:r}}}return{pattern:e,flags:``}}async function Zn(e,t,n,r,i=!1){let{content:a,clearBytecode:o}=await Ce(r),s;try{s=Xn(e)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(V.red(`Error: ${t}`)),process.exit(1)}let c=s.flags.includes(`g`)?s.flags:s.flags+`g`,l,u,d=new RegExp(s.pattern,c);if(n!==void 0){let e=[...a.matchAll(d)];e.length===0&&(console.error(V.red(`Error: Regex pattern not found in content.`)),process.exit(1)),(n<1||n>e.length)&&(console.error(V.red(`Error: Index ${n} is out of range. Found ${e.length} match(es).`)),process.exit(1));let r=e[n-1],i=r.index,o=i+r[0].length,c=r[0].replace(new RegExp(s.pattern,s.flags),t);l=a.slice(0,i)+c+a.slice(o),u=1}else l=a.replace(d,t),u=[...a.matchAll(new RegExp(s.pattern,c))].length,u===0&&(console.error(V.red(`Error: Regex pattern not found in content.`)),process.exit(1));if(!await zn(a,l,i)){console.log(V.yellow(`Aborted.`));return}await be(r,l,o),console.log(V.green(`✓ Replaced ${u} match(es) in ${V.cyan(r.path)}`))}async function Qn(e,t,n=!1,r=!1){let{content:i,clearBytecode:a}=await Ce(t),o=await Gn(e);console.log(`Resolving variables...`);let s=Bn(i);console.log(r?`Running patch script WITHOUT sandbox (--dangerous-no-script-sandbox)...`:`Running patch script in sandbox...`);let c;try{c=await Vn(o,i,s,r)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(V.red(`Error: Script execution failed:`)),console.error(V.red(` ${t}`)),process.exit(1)}if(typeof c!=`string`&&(console.error(V.red(`Error: Script did not return a string. Got: `+typeof c)),process.exit(1)),c===i){console.log(V.yellow(`Script returned unchanged content. Nothing to do.`));return}if(!await zn(i,c,n)){console.log(V.yellow(`Aborted.`));return}await be(t,c,a),console.log(V.green(`✓ Script patch applied to ${V.cyan(t.path)}`))}async function $n(e){let t=[e.string,e.regex,e.script].filter(e=>e!==void 0);t.length===0&&(console.error(V.red(`Error: Must specify one of --string, --regex, or --script.`)),process.exit(1)),t.length>1&&(console.error(V.red(`Error: Only one of --string, --regex, or --script can be used at a time.`)),process.exit(1));let n=!!e.confirmPossibleDangerousPatch,r=await Kn(e.path);console.log(`Target: ${V.cyan(r.path)} (${r.kind}, v${r.version})`),e.string?(e.string.length!==2&&(console.error(V.red(`Error: --string requires exactly 2 arguments: <old-string> <new-string>`)),process.exit(1)),await Yn(e.string[0],e.string[1],e.index,r,n)):e.regex?(e.regex.length!==2&&(console.error(V.red(`Error: --regex requires exactly 2 arguments: <pattern> <replacement>`)),process.exit(1)),await Zn(e.regex[0],e.regex[1],e.index,r,n)):e.script&&(e.index!==void 0&&(console.error(V.red(`Error: --index cannot be used with --script.`)),process.exit(1)),await Qn(e.script,r,n,!!e.dangerousNoScriptSandbox))}function er(e){if(!e)return{ok:!0,filter:null};let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return{ok:!1,error:`--patches was provided but contained no patch IDs.`};let n=new Set(l().map(e=>e.id)),r=t.filter(e=>!n.has(e));return r.length>0?{ok:!1,error:`unknown patch ID(s) in --patches: ${r.join(`, `)}`}:{ok:!0,filter:t}}const tr=K.join(ae,`native-claudejs-orig.js`),nr=e=>e.match(/VERSION:"(\d+\.\d+\.\d+)"/)?.[1],rr=async(e,t,n)=>{let r;try{r=await Ie.readFile(e,`utf8`)}catch{return null}let i=nr(r);return i===t?x(r)?(N(`${n}: carries tweakcc markers, skipping`),null):{content:r,version:t,source:n}:(N(`${n}: version ${i??`unknown`} != ${t}, skipping`),null)},ir=async(e,t,n)=>{try{await Ie.stat(e)}catch{return null}let{data:r}=await D(e,t);if(!r)return null;let i=r.toString(`utf8`);return nr(i)!==t||x(i)?null:{content:i,version:t,source:n}},ar=async e=>{let t=e.version;if(!t)return{error:`could not determine the installed Claude Code version`};let n=[];if(e.nativeInstallationPath){let r=[[tr,()=>rr(tr,t,tr)],[ne,()=>ir(ne,t,ne)],[e.nativeInstallationPath,()=>ir(e.nativeInstallationPath,t,e.nativeInstallationPath)]];for(let[e,t]of r){let r=await t();if(r)return r;n.push(e)}}else if(e.cliPath)for(let r of[ue,e.cliPath]){let e=await rr(r,t,r);if(e)return e;n.push(r)}return{error:`no pristine, version-matched (${t}) cli.js available. Tried: ${n.join(`, `)}. Run --restore, or --apply once so the pristine extract is saved.`}},or=async e=>{let t;try{t=await Ie.readFile(e,`utf8`)}catch(t){return{error:`cannot read ${e}: ${String(t)}`}}let n=nr(t);return n?x(t)?{error:`${e} carries tweakcc markers — it is not pristine`}:{content:t,version:n,source:e}:{error:`${e} carries no VERSION:"X.Y.Z" marker`}};function sr(){let e=process.argv[1]||``;return e.includes(`npx`)||e.includes(`.npm/_npx`)?`npx tweakcc-fixed`:e.includes(`pnpm`)||e.includes(`.pnpm`)?`pnpm dlx tweakcc-fixed`:e.includes(`yarn`)?`yarn dlx tweakcc-fixed`:e.includes(`bun`)?`bunx tweakcc-fixed`:`tweakcc-fixed`}function cr(e,t){let n=[p.SYSTEM_PROMPTS,p.ALWAYS_APPLIED,p.MISC_CONFIGURABLE,p.FEATURES,p.SYSTEM_REMINDERS],r=new Map;for(let e of n)r.set(e,[]);for(let t of e){let e=r.get(t.group);e&&e.push(t)}console.log(`
32
+ Patches applied (run with --show-unchanged to show all patches):`);for(let e of n){let n=r.get(e).filter(e=>e.applied||e.failed||_()||t&&t.includes(e.id));if(n.length!==0){console.log(`\n ${V.bold(e)}:`);for(let e of n){let t=e.failed?V.red(`✗`):e.applied?V.green(`✓`):V.dim(`○`),n=e.details?`: ${e.details}`:``,r=e.applied&&e.description?` ${V.gray(`—`)} ${V.gray(e.description)}`:``;console.log(` ${t} ${e.name}${n}${r}`)}}}console.log(``)}function lr(e){let t=e.filter(e=>e.applied&&e.modelFacing);if(t.length!==0){console.log(V.yellow(`ℹ These applied patches change model-facing behavior (not just output styling):`));for(let e of t){let t=e.description?` ${V.dim(`—`)} ${e.description}`:``;console.log(` ${V.yellow(`•`)} ${e.name}${V.dim(t)}`)}console.log(V.dim(` Several are on by default. Toggle any off in the menu or ~/.tweakcc/config.json, or run --restore to revert everything.`)),console.log(``)}}const ur=async()=>{let e=new De;e.name(`tweakcc-fixed`).description(`Maintained fork of tweakcc — customize and patch your installed Claude Code (system-prompt overrides, themes, thinking verbs and more).`).version(r).option(`-d, --debug`,`enable debug mode`).option(`-v, --verbose`,`enable verbose debug mode (includes diffs)`).option(`--show-unchanged`,`show unchanged diffs (requires --verbose)`).option(`-a, --apply`,`apply saved customizations without interactive UI`).option(`--restore`,`restore Claude Code to its original state`).option(`--revert`,`restore Claude Code to its original state (alias for --restore)`).option(`--patches <ids>`,`comma-separated list of patch IDs to apply (use with --apply)`).option(`--list-patches`,`list all available patches with their IDs`).option(`--json`,`with --list-patches: output machine-readable JSON (id, name, group, description)`).option(`--list-system-prompts [version]`,`list all available system prompts for a CC version`).option(`--validate-system-prompts [cliJsPath]`,`dry-run the apply preflight over the system-prompt overrides (no writes)`).option(`--config-url <url>`,`fetch configuration from a URL instead of local config.json`).action(async()=>{let t=e.opts();t.verbose?he():t.debug&&w(),t.showUnchanged&&pe();let n=await O();if(t.apply&&(t.restore||t.revert)&&(console.error(V.red(`Error: Cannot use --apply and --restore/--revert together.`)),process.exit(1)),t.listPatches){mr(!!t.json);return}if(t.listSystemPrompts!==void 0){await hr(t.listSystemPrompts);return}if(t.validateSystemPrompts!==void 0){await fr(t.validateSystemPrompts);return}if(t.apply){let e=er(t.patches);e.ok||(console.error(V.red(`Error: ${e.error}`)),console.error(V.gray(`Run "${sr()} --list-patches" to see valid IDs.`)),process.exit(1)),await dr(e.filter,t.configUrl);return}if(t.configUrl&&(console.error(V.red(`Error: --config-url can only be used with --apply.`)),console.error(V.gray(`The interactive TUI is for editing local configuration only.`)),console.error(V.gray(`To apply a remote config, use:`)),console.error(V.gray(` ${sr()} --apply --config-url <url>`)),process.exit(1)),t.restore||t.revert){await pr();return}await gr(n)}),e.command(`unpack`).argument(`<output-js-path>`,`path to write extracted JS`).argument(`[binary-path]`,`path to native binary (default: auto-detect)`).description(`Extract JS from a native Claude Code binary`).action(async(e,t)=>{await qn(e,t),process.exit(0)}),e.command(`repack`).argument(`<input-js-path>`,`path to JS file to embed`).argument(`[binary-path]`,`path to native binary (default: auto-detect)`).description(`Embed JS into a native Claude Code binary`).action(async(e,t)=>{await Jn(e,t),process.exit(0)}),e.command(`adhoc-patch`).description(`Apply an ad-hoc patch to Claude Code`).option(`-s, --string <values...>`,`replace string: <old-string> <new-string>`).option(`-r, --regex <values...>`,`replace regex: <pattern> <replacement>`).option(`--script <script>`,`run a patch script (prefix with @ for file/URL)`).option(`-i, --index <number>`,`replace only the Nth occurrence (1-based)`,parseInt).option(`-p, --path <path>`,`path to cli.js or native binary (default: auto-detect)`).option(`--confirm-possible-dangerous-patch`,`skip diff preview and apply immediately`).option(`--dangerous-no-script-sandbox`,`run --script without the Node.js permission sandbox (use if Node < 20)`).action(async e=>{await $n(e),process.exit(0)}),e.parse()};async function dr(e,t){console.log(`Applying saved customizations to Claude Code...`);let n;if(t){console.log(`Fetching configuration from: ${t}`);try{n=await I(t),console.log(`Configuration fetched successfully.`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(V.red(`Error: ${t}`)),process.exit(1)}}else console.log(`Configuration saved at: ${P}`),n=await j();if(!n.settings||Object.keys(n.settings).length===0){let e=t||P;console.error(`No saved customizations found in `+e),process.exit(1)}try{let t=await Mn({interactive:!1},n);(!t.startupCheckInfo||!t.startupCheckInfo.ccInstInfo)&&(console.error(ye()),process.exit(1));let{ccInstInfo:r}=t.startupCheckInfo;r.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${r.nativeInstallationPath}`):console.log(`Found Claude Code at: ${r.cliPath}`),console.log(`Version: ${r.version}`),console.log(`Loading system prompts...`);let i=await F(r.version);i.success||(console.log(V.red(`
33
+ ✖ Error downloading system prompts:`)),console.log(V.red(` ${i.errorMessage}`)),console.log(V.yellow(`
34
+ ⚠ System prompts not available - skipping system prompt customizations`))),console.log(`Applying customizations...`);let{results:a}=await o(n,r,e);cr(a,e),lr(a);let s=a.some(e=>e.failed),c=a.some(e=>e.group===p.SYSTEM_PROMPTS&&e.applied);s?(console.log(V.yellow(`Customizations applied with some failures.`)),console.log(V.dim(`These patching errors do not affect your system prompt patches.`)),c&&console.log(V.dim(`Your system prompt customizations were still applied successfully.`)),console.log(V.dim(`Please open an issue on https://github.com/skrabe/tweakcc-fixed/issues/new reporting these patching errors.`))):console.log(V.green(`Customizations applied successfully!`)),console.log(V.dim(`Run with --restore/--revert to revert Claude Code to its original state.`)),process.exit(0)}catch(e){throw e instanceof Se&&(console.error(V.red(`Error: ${e.message}`)),process.exit(1)),e}}async function fr(e){let t=typeof e==`string`?await or(e):await(async()=>{let e=(await Mn({interactive:!1})).startupCheckInfo?.ccInstInfo;return e?ar(e):{error:`no Claude Code installation detected`}})();`error`in t&&(console.error(V.red(`Error: ${t.error}`)),process.exit(1)),console.log(`Validating system prompt overrides against CC ${t.version}`),console.log(V.dim(` pristine: ${t.source}`));let n=await F(t.version);n.success||(console.error(V.red(`Error: could not load prompt data for ${t.version}:`)),console.error(V.red(` ${n.errorMessage}`)),process.exit(1));let r=await m({pristine:t.content,version:t.version});r.promptsChecked===0&&(console.error(V.red(`Error: no system prompts resolved — nothing was validated.`)),process.exit(1)),console.log(V.dim(` ${r.promptsChecked} catalogue entries, ${r.sitesChecked} resolved sites`));for(let e of r.findings){let t=C(e);e.severity===`error`?console.log(V.red(t)):e.severity===`warning`?console.log(V.yellow(t)):console.log(V.dim(t))}r.findings.length===0&&(console.log(V.green(`0 findings.`)),process.exit(0));let i=e=>r.findings.filter(t=>t.severity===e).length;console.log(V.red(`${r.findings.length} finding(s): ${i(`error`)} error(s), ${i(`warning`)} warning(s), ${i(`info`)} info.`)),process.exit(1)}async function pr(){console.log(`Restoring Claude Code to its original state...`);try{let e=await Mn({interactive:!1});(!e.startupCheckInfo||!e.startupCheckInfo.ccInstInfo)&&(console.error(ye()),process.exit(1));let{ccInstInfo:t}=e.startupCheckInfo;t.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${t.nativeInstallationPath}`):console.log(`Found Claude Code at: ${t.cliPath}`),console.log(`Version: ${t.version}`),console.log(`Restoring from backup...`);let n;n=t.nativeInstallationPath?await S(t):await s(t),n||(console.error(V.red(`No backup found. Cannot restore original Claude Code.`)),console.error(V.yellow(`Tip: A backup is created automatically when you first apply customizations.`)),process.exit(1)),await ee(),await fe(e=>{e.changesApplied=!1}),console.log(V.blue(`Original Claude Code restored successfully!`)),console.log(V.gray(`Your customizations are still saved in ${P} and can be reapplied with --apply.`)),process.exit(0)}catch(e){throw e instanceof Se&&(console.error(V.red(`Error: ${e.message}`)),process.exit(1)),e}}function mr(e=!1){let t=l();if(e){console.log(JSON.stringify(t.map(e=>({id:e.id,name:e.name,group:e.group,description:e.description})),null,2));return}let n=[p.ALWAYS_APPLIED,p.MISC_CONFIGURABLE,p.FEATURES,p.SYSTEM_REMINDERS],r=new Map;for(let e of n)r.set(e,[]);for(let e of t){let t=r.get(e.group);t&&t.push(e)}console.log(V.gray(`Use --patches <ids> with --apply to apply specific patches, e.g.:`)),console.log(),console.log(V.gray(` tweakcc --apply --patches "themes,toolsets"`)),console.log(),console.log(V.blue.bold(`Available patches`)),console.log();for(let e of n){let t=r.get(e);if(t.length!==0){console.log(V.bold(e)+`:`);for(let e of t)console.log(` ${V.cyan(e.id)}`),console.log(` ${V.white(e.name)} ${V.gray(`—`)} ${V.gray(e.description)}`);console.log(``)}}console.log(V.bold(`System Prompts:`)),console.log(V.dim(` System prompts also have IDs that can be used with --patches. Use --list-system-prompts [version] to see them.`))}async function hr(e){let t;if(typeof e==`string`)t=e;else{console.log(`Detecting installed Claude Code version...`);try{let e=await Mn({interactive:!1});e.startupCheckInfo?.ccInstInfo?.version||(console.error(V.red(`Could not detect Claude Code version. Please specify a version:`)),console.error(V.gray(` tweakcc --list-system-prompts 1.0.20`)),process.exit(1)),t=e.startupCheckInfo.ccInstInfo.version}catch{console.error(V.red(`Could not detect Claude Code installation. Please specify a version:`)),console.error(V.gray(` tweakcc --list-system-prompts 1.0.20`)),process.exit(1)}}console.log(`Loading system prompts for CC version ${t}...`);let n=await F(t);n.success||(console.error(V.red(`
35
+ ✖ Error loading system prompts:`)),console.error(V.red(` ${n.errorMessage}`)),process.exit(1));let r=oe();(!r||r.length===0)&&(console.error(V.yellow(`No system prompts found for this version.`)),process.exit(1));let i=e=>{let t=e.indexOf(`:`);if(t===-1)return`Other`;let n=e.substring(0,t).trim();return n===`Data`?n:n+`s`},a=new Map;for(let e of r){let t=i(e.name);a.has(t)||a.set(t,[]),a.get(t).push(e)}let o=[...a.keys()].sort((e,t)=>e.localeCompare(t));console.log(V.gray(`Use --patches <ids> with --apply to apply specific prompts, e.g.:`)),console.log(),console.log(V.gray(` tweakcc --apply --patches "identity,environment"`)),console.log(),console.log(V.blue.bold(`System prompts for CC ${t}`)),console.log();for(let e of o){let t=a.get(e);t.sort((e,t)=>e.name.localeCompare(t.name)),console.log(V.bold(e)+`:`);for(let e of t)console.log(` ${V.cyan(e.id)}`),console.log(` ${V.white(e.name)} ${V.gray(`—`)} ${V.gray(e.description)}`);console.log(``)}console.log(V.yellow(`To see all original system prompts for a given Claude Code version, visit:`)),console.log(V.yellow.bold(` https://github.com/Piebald-AI/claude-code-system-prompts`))}async function gr(e){try{let t=await Mn({interactive:!0});if(t.pendingCandidates){await _r(t.pendingCandidates,e);return}t.startupCheckInfo||(console.error(V.red(ye())),process.exit(1)),await vr(t.startupCheckInfo,e,t.config)}catch(e){throw e instanceof Se&&(console.error(V.red(`Error: ${e.message}`)),process.exit(1)),e}}async function _r(e,t){return new Promise((n,r)=>{let i=Te(J(xe,{candidates:e,onSelect:async e=>{try{let r=await ve(e),a=await j(),o=await Nn(a,r);o||(console.error(V.red(`Error: Failed to complete startup check after selection.`)),process.exit(1)),i.unmount(),await vr(o,t,a),n()}catch(e){r(e)}}}))})}async function vr(e,t,n){let r=await F(e.ccInstInfo.version);r.success||(console.log(V.red(`
36
36
  ✖ Error downloading system prompts:`)),console.log(V.red(` ${r.errorMessage}`)),console.log(V.yellow(`⚠ System prompts not available - system prompt customizations will be skipped
37
- `))),Ce(J(wn,{startupCheckInfo:e,configMigrated:t,invocationCommand:nr(),initialConfig:n}))}ar();export{};
37
+ `))),Te(J(An,{startupCheckInfo:e,configMigrated:t,invocationCommand:sr(),initialConfig:n}))}ur();export{};