tweakcc 1.4.0 → 1.4.2

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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/dist/index.js +15 -15
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -18,6 +18,8 @@ With tweakcc, you can
18
18
  - Create custom **thinking spinner animations** with different speeds and phases
19
19
  - Change the "CLAUDE CODE" banner text to your own text with your own [figlet](http://www.figlet.org/) fonts
20
20
  - Supports Claude Code installed on **Windows, macOS, and Linux**, using npm, yarn, pnpm, bun, Homebrew, nvm, fnm, n, volta, nvs, and nodenv, or a custom location
21
+ - Style the **user messages in the chat history** beyond the default plain gray text
22
+ - Remove the **ASCII border** from the input box
21
23
 
22
24
  tweakcc also
23
25
  - Restores the **token counter** and **elapsed time metric** that were shown during generation before Claude Code 1.0.83
@@ -28,8 +30,6 @@ Additionally, we're working on features that will allow you to
28
30
  - Pick from over **70+ spinning/thinking animations** from [`cli-spinners`](https://github.com/sindresorhus/cli-spinners)
29
31
  - Apply **custom styling** to the markdown elements in Claude's responses like code, bold, headers, etc
30
32
  - Customize the **shimmering effect** on the thinking verb: disable it; change its speed, width, and colors
31
- - Style the **user messages in the chat history** beyond the default plain gray text
32
- - Remove the **ASCII border** from the input box
33
33
 
34
34
  Run without installation:
35
35
 
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import{Box as c,Text as t,render as er,useInput as ce,useStdout as rr}from"ink";import{Command as nr}from"commander";import{Fragment as me,createContext as tr,useCallback as Ye,useContext as ge,useEffect as ie,useState as T}from"react";import or from"ink-link";import{Fragment as le,jsx as n,jsxs as s}from"react/jsx-runtime";import*as ye from"node:path";import Pe from"node:path";import*as Se from"node:os";import{globbySync as ee}from"globby";import*as ze from"node:fs";import*as Ae from"node:child_process";import*as ir from"node:crypto";import Oe from"figlet";import*as Fe from"node:fs/promises";import ue from"node:fs/promises";import re from"chalk";function sr({items:e,selectedIndex:o,onSelect:r,onSubmit:i}){return ce((l,d)=>{d.upArrow?r(o>0?o-1:e.length-1):d.downArrow?r(o<e.length-1?o+1:0):d.return&&i(e[o].name)}),n(c,{flexDirection:"column",children:e.map((l,d)=>n(c,{children:s(t,{children:[s(t,{bold:d===o,color:d===o?"cyan":void 0,...d===o?l.selectedStyles??{}:l.styles??{},children:[d===o?"❯ ":" ",l.name]}),l.desc&&d===o&&s(t,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",l.desc]})]})},d))})}let z=function(e){return e.THEMES="Themes",e.LAUNCH_TEXT="Launch text",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.INPUT_BOX="Input box",e.APPLY_CHANGES="*Apply customizations to cli.js",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves tweakcc.json)",e.OPEN_CONFIG="Open tweakcc.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});const K={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",permission:"rgb(177,185,249)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(136,136,136)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",secondaryText:"rgb(153,153,153)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",diffAdded:"rgb(34,92,43)",diffRemoved:"rgb(122,41,54)",diffAddedDimmed:"rgb(71,88,74)",diffRemovedDimmed:"rgb(105,72,77)",diffAddedWord:"rgb(56,166,96)",diffRemovedWord:"rgb(179,89,107)",diffAddedWordDimmed:"rgb(46,107,58)",diffRemovedWordDimmed:"rgb(139,57,69)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",permission:"rgb(87,105,247)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(153,153,153)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",secondaryText:"rgb(102,102,102)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",diffAdded:"rgb(105,219,124)",diffRemoved:"rgb(255,168,180)",diffAddedDimmed:"rgb(199,225,203)",diffRemovedDimmed:"rgb(253,210,216)",diffAddedWord:"rgb(47,157,68)",diffRemovedWord:"rgb(209,69,75)",diffAddedWordDimmed:"rgb(144,194,156)",diffRemovedWordDimmed:"rgb(232,165,173)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"#cd00cd",bashBorder:"#cd00cd",claude:"#cdcd00",claudeShimmer:"#ffff00",permission:"#0000ee",planMode:"#00cdcd",ide:"#4782C8",secondaryBorder:"#e5e5e5",text:"#000000",inverseText:"#ffffff",secondaryText:"#7f7f7f",suggestion:"#0000ee",remember:"#0000ee",success:"#00cd00",error:"#cd0000",warning:"#cdcd00",diffAdded:"#00cd00",diffRemoved:"#cd0000",diffAddedDimmed:"#00cd00",diffRemovedDimmed:"#cd0000",diffAddedWord:"#00ff00",diffRemovedWord:"#ff0000",diffAddedWordDimmed:"#00cd00",diffRemovedWordDimmed:"#cd0000",red_FOR_SUBAGENTS_ONLY:"#cd0000",blue_FOR_SUBAGENTS_ONLY:"#0000cd",green_FOR_SUBAGENTS_ONLY:"#00cd00",yellow_FOR_SUBAGENTS_ONLY:"#cdcd00",purple_FOR_SUBAGENTS_ONLY:"#cd00cd",orange_FOR_SUBAGENTS_ONLY:"#cd8500",pink_FOR_SUBAGENTS_ONLY:"#ff1493",cyan_FOR_SUBAGENTS_ONLY:"#00cdcd"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"#ff00ff",bashBorder:"#ff00ff",claude:"#cdcd00",claudeShimmer:"#ffff00",permission:"#5c5cff",planMode:"#00ffff",ide:"#4782c8",secondaryBorder:"#e5e5e5",text:"#ffffff",inverseText:"#000000",secondaryText:"#e5e5e5",suggestion:"#5c5cff",remember:"#5c5cff",success:"#00ff00",error:"#ff0000",warning:"#ffff00",diffAdded:"#00cd00",diffRemoved:"#cd0000",diffAddedDimmed:"#00cd00",diffRemovedDimmed:"#cd0000",diffAddedWord:"#00ff00",diffRemovedWord:"#ff0000",diffAddedWordDimmed:"#00cd00",diffRemovedWordDimmed:"#cd0000",red_FOR_SUBAGENTS_ONLY:"#ff0000",blue_FOR_SUBAGENTS_ONLY:"#0000ff",green_FOR_SUBAGENTS_ONLY:"#00ff00",yellow_FOR_SUBAGENTS_ONLY:"#ffff00",purple_FOR_SUBAGENTS_ONLY:"#ff00ff",orange_FOR_SUBAGENTS_ONLY:"#ff8700",pink_FOR_SUBAGENTS_ONLY:"#ff69b4",cyan_FOR_SUBAGENTS_ONLY:"#00ffff"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",permission:"rgb(51,102,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(153,153,153)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",secondaryText:"rgb(102,102,102)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",diffAdded:"rgb(153,204,255)",diffRemoved:"rgb(255,204,204)",diffAddedDimmed:"rgb(209,231,253)",diffRemovedDimmed:"rgb(255,233,233)",diffAddedWord:"rgb(51,102,204)",diffRemovedWord:"rgb(153,51,51)",diffAddedWordDimmed:"rgb(102,153,204)",diffRemovedWordDimmed:"rgb(204,153,153)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",permission:"rgb(153,204,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(136,136,136)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",secondaryText:"rgb(153,153,153)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",diffAdded:"rgb(0,68,102)",diffRemoved:"rgb(102,0,0)",diffAddedDimmed:"rgb(62,81,91)",diffRemovedDimmed:"rgb(62,44,44)",diffAddedWord:"rgb(0,119,179)",diffRemovedWord:"rgb(179,0,0)",diffAddedWordDimmed:"rgb(26,99,128)",diffRemovedWordDimmed:"rgb(128,21,21)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)"}}],launchText:{method:"figlet",figletText:"Claude Code",figletFont:"ANSI Shadow",customText:""},thinkingVerbs:{format:"{}… ",verbs:["Accomplishing","Actioning","Actualizing","Baking","Booping","Brewing","Calculating","Cerebrating","Channelling","Churning","Clauding","Coalescing","Cogitating","Combobulating","Computing","Concocting","Conjuring","Considering","Contemplating","Cooking","Crafting","Creating","Crunching","Deciphering","Deliberating","Determining","Discombobulating","Divining","Doing","Effecting","Elucidating","Enchanting","Envisioning","Finagling","Flibbertigibbeting","Forging","Forming","Frolicking","Generating","Germinating","Hatching","Herding","Honking","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:{}.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{prefix:{format:">",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"},message:{format:"{}",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"}},inputBox:{removeBorder:!1}},Be=ye.join(Se.homedir(),".tweakcc"),se=ye.join(Be,"config.json"),pe=ye.join(Be,"cli.js.backup"),lr=()=>{const e=[],o=process.platform=="win32"?Se.homedir().replace(/\\/g,"/"):Se.homedir(),r="node_modules/@anthropic-ai/claude-code";return e.push(`${Se.homedir()}/.claude/local/${r}`),{}.NPM_PREFIX&&e.push(`${{}.NPM_PREFIX}/lib/${r}`),{}.N_PREFIX&&e.push(`${{}.N_PREFIX}/lib/${r}`),{}.VOLTA_HOME&&e.push(`${{}.VOLTA_HOME}/lib/${r}`),{}.FNM_DIR&&e.push(`${{}.FNM_DIR}/lib/${r}`),{}.NVM_DIR&&e.push(`${{}.NVM_DIR}/lib/${r}`),{}.NODENV_ROOT&&e.push(...ee(`${{}.NODENV_ROOT}/versions/*/lib/${r}`)),{}.NVS_HOME&&e.push(...ee(`${{}.NVS_HOME}/node/*/*/lib/${r}`)),{}.ASDF_DATA_DIR&&e.push(...ee(`${{}.ASDF_DATA_DIR}/installs/nodejs/*/lib/${r}`)),process.platform=="win32"?(e.push(`${o}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${r}`),e.push(`${o}/AppData/Roaming/npm/${r}`),e.push(...ee(`${o}/AppData/Roaming/nvm/*/${r}}`)),e.push(`${o}/AppData/Local/Yarn/config/global/${r}`),e.push(...ee(`${o}/AppData/Local/pnpm/global/*/${r}`)),e.push(...ee(`${o}/n/versions/node/*/lib/${r}`)),e.push(`${o}/AppData/Roaming/Yarn/config/global/${r}`),e.push(`${o}/AppData/Roaming/pnpm-global/${r}`),e.push(...ee(`${o}/AppData/Roaming/pnpm-global/*/${r}`)),e.push(`${o}/.bun/install/global/${r}`),e.push(...ee(`${o}/AppData/Local/fnm_multishells/*/node_modules/${r}`))):(process.platform=="darwin"&&(e.push(`${o}/Library/${r}`),e.push(`/opt/local/lib/${r}`)),e.push(`${o}/.local/lib/${r}`),e.push(`${o}/.local/share/${r}`),e.push(`${o}/.npm-global/lib/${r}`),e.push(`${o}/.npm-packages/lib/${r}`),e.push(`${o}/.npm/lib/${r}`),e.push(`${o}/npm/lib/${r}`),e.push(`/etc/${r}`),e.push(`/lib/${r}`),e.push(`/opt/node/lib/${r}`),e.push(`/usr/lib/${r}`),e.push(`/usr/local/lib/${r}`),e.push(`/usr/share/${r}`),e.push(`/var/lib/${r}`),e.push(`/opt/homebrew/lib/${r}`),e.push(`${o}/.config/yarn/global/${r}`),e.push(`${o}/.yarn/global/${r}`),e.push(`${o}/.bun/install/global/${r}`),e.push(`${o}/.pnpm-global/${r}`),e.push(...ee(`${o}/.pnpm-global/*/${r}`)),e.push(`${o}/pnpm-global/${r}`),e.push(...ee(`${o}/pnpm-global/*/${r}`)),e.push(`${o}/.local/share/pnpm/global/${r}`),e.push(...ee(`${o}/.local/share/pnpm/global/*/${r}`)),e.push(`${o}/.bun/install/global/${r}`),e.push(...ee(`/usr/local/n/versions/node/*/lib/${r}`)),e.push(...ee(`${o}/n/versions/node/*/lib/${r}`)),e.push(`${o}/n/lib/${r}`),e.push(...ee(`${o}/.volta/tools/image/node/*/lib/${r}`)),e.push(...ee(`${o}/.fnm/node-versions/*/installation/lib/${r}`)),e.push(...ee(`/usr/local/nvm/versions/node/*/lib/${r}`)),e.push(...ee(`${o}/.nvm/versions/node/*/lib/${r}`)),e.push(...ee(`${o}/.nodenv/versions/*/lib/${r}`)),e.push(...ee(`${o}/.nvs/*/lib/${r}`)),e.push(...ee(`${o}/.asdf/installs/nodejs/*/lib/${r}`))),process.platform=="win32"?e.map(i=>i.replace(/\//g,"\\")):e},Ce=lr(),cr=({children:e,...o})=>s(t,{bold:!0,backgroundColor:"#ffd500",color:"#000",...o,children:[" ",e," "]});var de=cr;const dr=[{name:z.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:z.LAUNCH_TEXT,desc:`Change the "CLAUDE CODE" banner text that's shown when you sign in to Claude Code`},{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_BOX,desc:"Customize the input box appearance (e.g., remove border)"}],ar=[{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 (${se})`},{name:z.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:z.EXIT,desc:"Bye!"}];function hr({onSubmit:e,notification:o}){const r=[...ge(he).changesApplied?[]:[{name:z.APPLY_CHANGES,desc:"Required: Updates Claude Code's cli.js in-place with your changes",selectedStyles:{color:"green"}}],...dr,...ar],[i,l]=T(0);return s(c,{flexDirection:"column",children:[n(c,{marginBottom:1,children:n(de,{children:"Tweak Claude Code"})}),n(c,{marginBottom:1,children:s(t,{color:"gray",children:[n(t,{bold:!0,children:"Customize your Claude Code installation."})," ",n(t,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),n(c,{marginBottom:1,children:s(t,{color:"yellow",children:["⭐ ",n(t,{bold:!0,children:"Star the repo at "}),n(or,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:n(t,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),n(t,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),o&&n(c,{marginBottom:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:"bold",borderColor:o?.type==="success"?"green":o?.type==="error"?"red":o?.type==="info"?"blue":"yellow",paddingLeft:1,flexDirection:"column",children:n(t,{color:o?.type==="success"?"green":o?.type==="error"?"red":o?.type==="info"?"blue":"yellow",children:o?.message})}),n(sr,{items:r,selectedIndex:i,onSelect:l,onSubmit:d=>e(d)})]})}function He({theme:e}){return s(c,{flexDirection:"column",paddingLeft:1,children:[n(c,{marginBottom:1,children:s(t,{bold:!0,children:["Preview: ",e.name]})}),n(c,{borderStyle:"single",borderColor:"gray",paddingX:1,children:s(c,{flexDirection:"column",children:[n(t,{children:"╭─────────────────────────────────────────────╮"}),s(t,{children:["│ ",n(t,{color:e.colors.secondaryText,children:"1"})," ",s(t,{color:e.colors.text,children:["function greet() ","{"]})," ","│"]}),s(t,{children:["│ ",n(t,{color:e.colors.secondaryText,children:"2"})," ",s(t,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:['- console.log("',n(t,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),'");']})," ","│"]}),s(t,{children:["│ ",n(t,{color:e.colors.secondaryText,children:"2"})," ",s(t,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:['+ console.log("',n(t,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),'");']})," ","│"]}),n(t,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),s(t,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),s(t,{children:[n(t,{color:e.colors.warning,children:"│ "}),n(t,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),s(t,{color:e.colors.warning,children:[" ","│"]})]}),n(t,{color:e.colors.claude,children:"╭─────────────────────────────────────────────╮"}),s(t,{children:[n(t,{color:e.colors.claude,children:"│ "}),n(t,{color:e.colors.claude,children:"✻"}),n(t,{children:" Welcome to Tweak Claude Code!"}),s(t,{color:e.colors.claude,children:[" ","│"]})]}),s(t,{children:[n(t,{color:e.colors.claude,children:"│"}),s(t,{color:e.colors.secondaryText,italic:!0,children:[" ","/help for help, /status for your current set"]}),n(t,{color:e.colors.claude,children:"│"})]}),s(t,{color:e.colors.success,children:["Login successful. Press ",n(t,{bold:!0,children:"Enter"})," to continue…"]}),n(t,{color:e.colors.bashBorder,children:"╭─────────────────────────────────────────────╮"}),s(t,{children:[n(t,{color:e.colors.bashBorder,children:"│ !"}),s(t,{children:[" ls"," "]}),n(t,{color:e.colors.bashBorder,children:"│"})]}),n(t,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),s(t,{children:[n(t,{color:e.colors.planMode,children:"│ "}),n(t,{color:e.colors.permission,children:"Ready to code?"}),s(t,{color:e.colors.planMode,children:[" ","│"]})]}),s(t,{children:[n(t,{color:e.colors.planMode,children:"│ "}),n(t,{children:"Here is Claude's plan:"}),s(t,{color:e.colors.planMode,children:[" ","│"]})]}),n(t,{color:e.colors.secondaryBorder,children:"╭─────────────────────────────────────────────╮"}),s(t,{children:[n(t,{color:e.colors.secondaryBorder,children:"│"})," ",s(t,{color:e.colors.secondaryText,children:["> Try “refactor <filepath>”"," ","│"]})]}),n(t,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),s(t,{children:[s(t,{color:e.colors.permission,children:["│ ",n(t,{bold:!0,children:"Permissions:"})]})," ",s(t,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",n(t,{color:e.colors.permission,children:"│"})]}),n(t,{color:e.colors.secondaryText,children:"> list the dir"}),s(t,{children:[n(t,{color:e.colors.error,children:"●"}),n(t,{children:" Update(__init__.py)"})]}),s(t,{children:[n(t,{children:" ⎿ "}),n(t,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),s(t,{children:[" ",n(t,{color:e.colors.secondaryText,children:"1"})," ",s(t,{backgroundColor:e.colors.diffRemovedDimmed,color:e.colors.text,children:["- import"," ",n(t,{backgroundColor:e.colors.diffRemovedWordDimmed,color:e.colors.text,children:"os"})]})]}),s(t,{children:[" ",n(t,{color:e.colors.secondaryText,children:"2"})," ",s(t,{backgroundColor:e.colors.diffAddedDimmed,color:e.colors.text,children:["+ import"," ",n(t,{backgroundColor:e.colors.diffAddedWordDimmed,color:e.colors.text,children:"random"})]})]}),s(t,{children:[n(t,{color:e.colors.success,children:"●"}),n(t,{children:" List(.)"})]}),n(t,{children:" ⎿ Listed 123 paths (ctrl+r to expand)"}),s(t,{children:[n(t,{color:e.colors.secondaryText,children:"●"}),n(t,{children:" The directory "}),n(t,{color:e.colors.permission,children:"C:\\Users\\user"}),s(t,{children:[" ","contains ",n(t,{bold:!0,children:"123"})," files."]})]}),s(t,{children:[s(t,{color:e.colors.claude,children:["✻ Th",n(t,{color:e.colors.claudeShimmer,children:"ink"}),"ing…"," "]}),n(t,{color:e.colors.secondaryText,children:"(10s · ↑ 456 tokens · esc to interrupt)"})]}),s(t,{children:[s(t,{color:e.colors.autoAccept,children:["⏵⏵ auto-accept edits on"," "]}),n(t,{color:e.colors.secondaryText,dimColor:!0,children:"(shift+tab to cycle)"})]}),s(t,{children:[n(t,{color:e.colors.planMode,children:"⏸ plan mode on "}),n(t,{color:e.colors.secondaryText,dimColor:!0,children:"(shift+tab to cycle)"})]}),n(t,{children:n(t,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Ue({colorKey:e,theme:o,bold:r=!1}){const i=o.colors[e];return e==="inverseText"?n(t,{color:i,backgroundColor:o.colors.permission,bold:r,children:e}):e.startsWith("diff")?n(t,{backgroundColor:i,bold:r,color:o.colors.text,children:e}):n(t,{color:i,bold:r,children:e})}let Je=!1;const ae=()=>Je,gr=()=>{Je=!0};function ve(){try{const e=ye.join(Se.homedir(),".claude.json");return JSON.parse(ze.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function Ge(e){if(process.platform==="win32")Ae.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Ae.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const o=ye.dirname(e);Ae.spawn("xdg-open",[o],{detached:!0,stdio:"ignore"}).unref()}}function Ee(e){if(!e||typeof e!="string")return!1;const o=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(o))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(o)){const r=o.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const[,i,l,d]=r;return parseInt(i)<=255&&parseInt(l)<=255&&parseInt(d)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(o)){const r=o.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const[,i,l,d]=r;return parseInt(i)<=360&&parseInt(l)<=100&&parseInt(d)<=100}}return!1}function Xe(e){if(!Ee(e))return e;const o=e.trim();if(o.startsWith("rgb("))return o;if(o.startsWith("#")){let r=o.slice(1);r.length===3&&(r=r.split("").map(h=>h+h).join(""));const i=parseInt(r.slice(0,2),16),l=parseInt(r.slice(2,4),16),d=parseInt(r.slice(4,6),16);return`rgb(${i},${l},${d})`}if(o.startsWith("hsl(")){const r=o.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const i=parseInt(r[1])/360,l=parseInt(r[2])/100,d=parseInt(r[3])/100,h=(_,C,B)=>(B<0&&(B+=1),B>1&&(B-=1),B<1/6?_+(C-_)*6*B:B<1/2?C:B<2/3?_+(C-_)*(2/3-B)*6:_),g=d<.5?d*(1+l):d+l-d*l,b=2*d-g,a=Math.round(h(b,g,i+1/3)*255),y=Math.round(h(b,g,i)*255),D=Math.round(h(b,g,i-1/3)*255);return`rgb(${a},${y},${D})`}}return e}async function ur(e,o="sha256",r=64*1024){return new Promise((i,l)=>{const d=ir.createHash(o),h=ze.createReadStream(e,{highWaterMark:r});h.on("data",g=>{d.update(g)}),h.on("end",()=>{i(d.digest("hex"))}),h.on("error",g=>{l(g)})})}const Ve=(e,o,r,i,l,d,h,g)=>{let b=`${e}.rgb(${o})`;return r&&r!=="transparent"&&(b+=`.bgRgb(${r})`),i&&(b+=".bold"),l&&(b+=".italic"),d&&(b+=".underline"),h&&(b+=".strikethrough"),g&&(b+=".inverse"),b};function Ke({initialValue:e,onColorChange:o,onExit:r,colorKey:i,theme:l}){const d=De(e)||{h:0,s:50,l:50},h=$e(e)||{r:128,g:128,b:128},[g,b]=T(d),[a,y]=T(h),[D,_]=T("hsl"),[C,B]=T("h"),[k,A]=T(!1),[R,G]=T(!1);ie(()=>{const p=De(e),f=$e(e);p&&f&&(A(!0),b(p),y(f),A(!1))},[e]),ie(()=>{if(!k&&R){const p=`rgb(${a.r},${a.g},${a.b})`;o(p)}},[g,a,k,R]),ie(()=>{G(!0)},[]);const Z=p=>{if(Ee(p)){const f=Xe(p),m=De(f),I=$e(f);m&&I&&(A(!0),b(m),y(I),A(!1))}};ce((p,f)=>{if(p.length>1&&!f.ctrl&&!f.meta){Z(p);return}if(f.return)r();else if(f.escape)r();else if(f.ctrl&&p==="a")_(m=>m==="hsl"?"rgb":"hsl"),B(m=>D==="hsl"?m==="h"?"r":m==="s"?"g":"b":m==="r"?"h":m==="g"?"s":"l");else if(f.upArrow)B(D==="hsl"?m=>m==="h"?"l":m==="s"?"h":"s":m=>m==="r"?"b":m==="g"?"r":"g");else if(f.downArrow||f.tab)B(D==="hsl"?m=>m==="h"?"s":m==="s"?"l":"h":m=>m==="r"?"g":m==="g"?"b":"r");else if(f.leftArrow){const m=f.shift||f.ctrl||f.meta?-10:-1;H(m)}else if(f.rightArrow){const m=f.shift||f.ctrl||f.meta?10:1;H(m)}});const H=p=>{A(!0),D==="hsl"?b(f=>{const m={...f};C==="h"?m.h=Math.max(0,Math.min(359,f.h+p)):C==="s"?m.s=Math.max(0,Math.min(100,f.s+p)):C==="l"&&(m.l=Math.max(0,Math.min(100,f.l+p)));const[I,u,x]=j(m.h,m.s,m.l);return y({r:I,g:u,b:x}),m}):y(f=>{const m={...f};C==="r"?m.r=Math.max(0,Math.min(255,f.r+p)):C==="g"?m.g=Math.max(0,Math.min(255,f.g+p)):C==="b"&&(m.b=Math.max(0,Math.min(255,f.b+p)));const I=P(m.r,m.g,m.b);return b(I),m}),A(!1)},P=(p,f,m)=>{const I=p/255,u=f/255,x=m/255,M=Math.max(I,u,x),w=Math.min(I,u,x),E=M-w,X=(M+w)/2;let oe=0;E!==0&&(oe=X>.5?E/(2-M-w):E/(M+w));let te=0;return E!==0&&(M===I?te=((u-x)/E+(u<x?6:0))/6:M===u?te=((x-I)/E+2)/6:te=((I-u)/E+4)/6),{h:Math.round(te*360),s:Math.round(oe*100),l:Math.round(X*100)}},j=(p,f,m)=>{p/=360,f/=100,m/=100;const I=(1-Math.abs(2*m-1))*f,u=I*(1-Math.abs(p*6%2-1)),x=m-I/2;let M=0,w=0,E=0;return 0<=p&&p<1/6?(M=I,w=u,E=0):1/6<=p&&p<2/6?(M=u,w=I,E=0):2/6<=p&&p<3/6?(M=0,w=I,E=u):3/6<=p&&p<4/6?(M=0,w=u,E=I):4/6<=p&&p<5/6?(M=u,w=0,E=I):5/6<=p&&p<1&&(M=I,w=0,E=u),[Math.round((M+x)*255),Math.round((w+x)*255),Math.round((E+x)*255)]},F=()=>{const p=[],f=[[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 m=0;m<40;m++){const u=m/39*(f.length-1),x=Math.floor(u),M=Math.ceil(u),w=u-x,[E,X,oe]=f[x],[te,L,$]=f[M],N=Math.round(E+(te-E)*w),J=Math.round(X+(L-X)*w),U=Math.round(oe+($-oe)*w);p.push(n(t,{backgroundColor:`rgb(${N},${J},${U})`,children:" "},m))}return p},q=()=>{const p=[];for(let f=0;f<40;f++){const m=f/39*100,[I,u,x]=j(g.h,m,g.l);p.push(n(t,{backgroundColor:`rgb(${I},${u},${x})`,children:" "},f))}return p},O=()=>{const p=[];for(let f=0;f<40;f++){const m=f/39*100,[I,u,x]=j(g.h,g.s,m);p.push(n(t,{backgroundColor:`rgb(${I},${u},${x})`,children:" "},f))}return p},v=()=>{const[p,f,m]=j(g.h,g.s,g.l);return`rgb(${p},${f},${m})`},S=(p,f,m)=>{const I=u=>u.toString(16).padStart(2,"0");return`#${I(p)}${I(f)}${I(m)}`},V=()=>{const p=[];for(let f=0;f<40;f++){const m=Math.round(f/39*255);p.push(n(t,{backgroundColor:`rgb(${m},${a.g},${a.b})`,children:" "},f))}return p},W=()=>{const p=[];for(let f=0;f<40;f++){const m=Math.round(f/39*255);p.push(n(t,{backgroundColor:`rgb(${a.r},${m},${a.b})`,children:" "},f))}return p},Q=()=>{const p=[];for(let f=0;f<40;f++){const m=Math.round(f/39*255);p.push(n(t,{backgroundColor:`rgb(${a.r},${a.g},${m})`,children:" "},f))}return p},Y=(p,f)=>Math.round(p/f*39);return s(c,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[s(c,{flexDirection:"column",children:[n(t,{bold:!0,children:"Color Picker"}),s(c,{marginBottom:1,flexDirection:"column",children:[n(t,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),n(t,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),n(t,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),n(t,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),n(t,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),n(t,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),D==="hsl"?s(le,{children:[s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:C==="h"?"yellow":"white",children:[C==="h"?"❯ ":" ","Hue (",g.h,"°):"]})}),n(c,{children:F().map((p,f)=>n(me,{children:f===Y(g.h,360)?n(t,{children:"|"}):p},f))})]}),s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:C==="s"?"yellow":"white",children:[C==="s"?"❯ ":" ","Saturation (",g.s,"%):"]})}),n(c,{children:q().map((p,f)=>n(me,{children:f===Y(g.s,100)?n(t,{children:"|"}):p},f))})]}),s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:C==="l"?"yellow":"white",children:[C==="l"?"❯ ":" ","Lightness (",g.l,"%):"]})}),n(c,{children:O().map((p,f)=>n(me,{children:f===Y(g.l,100)?n(t,{children:"|"}):p},f))})]})]}):s(le,{children:[s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:C==="r"?"yellow":"white",children:[C==="r"?"❯ ":" ","Red (",a.r,"):"]})}),n(c,{children:V().map((p,f)=>n(me,{children:f===Y(a.r,255)?n(t,{children:"|"}):p},f))})]}),s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:C==="g"?"yellow":"white",children:[C==="g"?"❯ ":" ","Green (",a.g,"):"]})}),n(c,{children:W().map((p,f)=>n(me,{children:f===Y(a.g,255)?n(t,{children:"|"}):p},f))})]}),s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:C==="b"?"yellow":"white",children:[C==="b"?"❯ ":" ","Blue (",a.b,"):"]})}),n(c,{children:Q().map((p,f)=>n(me,{children:f===Y(a.b,255)?n(t,{children:"|"}):p},f))})]})]}),s(c,{marginBottom:1,children:[n(t,{children:"Current: "}),n(t,{backgroundColor:v(),children:" "})]}),s(c,{flexDirection:"row",justifyContent:"space-between",children:[s(c,{flexDirection:"column",children:[n(t,{dimColor:!0,children:"Hex "}),i?.startsWith("diff")?n(t,{backgroundColor:v(),color:l?.colors?.text||"white",bold:!0,children:S(a.r,a.g,a.b)}):i==="inverseText"?n(t,{color:v(),backgroundColor:l?.colors?.permission,bold:!0,children:S(a.r,a.g,a.b)}):n(t,{color:v(),bold:!0,children:S(a.r,a.g,a.b)})]}),s(c,{flexDirection:"column",children:[n(t,{dimColor:!0,children:"RGB "}),i?.startsWith("diff")?n(t,{backgroundColor:v(),color:l?.colors?.text||"white",bold:!0,children:`rgb(${a.r}, ${a.g}, ${a.b})`}):i==="inverseText"?n(t,{color:v(),backgroundColor:l?.colors?.permission,bold:!0,children:`rgb(${a.r}, ${a.g}, ${a.b})`}):n(t,{color:v(),bold:!0,children:`rgb(${a.r}, ${a.g}, ${a.b})`})]}),s(c,{flexDirection:"column",children:[n(t,{dimColor:!0,children:"HSL "}),i?.startsWith("diff")?n(t,{backgroundColor:v(),color:l?.colors?.text||"white",bold:!0,children:`hsl(${g.h}, ${g.s}%, ${g.l}%)`}):i==="inverseText"?n(t,{color:v(),backgroundColor:l?.colors?.permission,bold:!0,children:`hsl(${g.h}, ${g.s}%, ${g.l}%)`}):n(t,{color:v(),bold:!0,children:`hsl(${g.h}, ${g.s}%, ${g.l}%)`})]})]})]})}function $e(e){const o=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(o)return{r:parseInt(o[1]),g:parseInt(o[2]),b:parseInt(o[3])};const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const i=r[1];return{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16)}}return null}function De(e){const o=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(o)return{h:parseInt(o[1]),s:parseInt(o[2]),l:parseInt(o[3])};const r=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const l=parseInt(r[1])/255,d=parseInt(r[2])/255,h=parseInt(r[3])/255,g=Math.max(l,d,h),b=Math.min(l,d,h),a=g-b,y=(g+b)/2;let D=0;a!==0&&(D=y>.5?a/(2-g-b):a/(g+b));let _=0;return a!==0&&(g===l?_=((d-h)/a+(d<h?6:0))/6:g===d?_=((h-l)/a+2)/6:_=((l-d)/a+4)/6),{h:Math.round(_*360),s:Math.round(D*100),l:Math.round(y*100)}}const i=e.match(/^#([a-fA-F0-9]{6})$/);if(i){const l=i[1],d=parseInt(l.substr(0,2),16)/255,h=parseInt(l.substr(2,2),16)/255,g=parseInt(l.substr(4,2),16)/255,b=Math.max(d,h,g),a=Math.min(d,h,g),y=b-a,D=(b+a)/2;let _=0;y!==0&&(_=D>.5?y/(2-b-a):y/(b+a));let C=0;return y!==0&&(b===d?C=((h-g)/y+(h<g?6:0))/6:b===h?C=((g-d)/y+2)/6:C=((d-h)/y+4)/6),{h:Math.round(C*360),s:Math.round(_*100),l:Math.round(D*100)}}return{h:0,s:50,l:50}}function fr({onBack:e,themeId:o}){const{settings:{themes:r},updateSettings:i}=ge(he),[l,d]=T(o),h=r.find(O=>O.id===l)||r[0],[g,b]=T("rgb"),[a,y]=T(0),[D,_]=T(null),[C,B]=T(null),[k,A]=T(""),[R,G]=T(""),Z=Ye(O=>{i(v=>{const S=v.themes.findIndex(V=>V.id===l);S!==-1&&O(v.themes[S])})},[l,i]),H=O=>{if(a>=2&&Ee(O)){const v=Xe(O),S=a-2,V=P[S];Z(W=>{W.colors[V]=v})}};ce((O,v)=>{if(D===null&&C===null){if(O.length>1&&!v.ctrl&&!v.meta){H(O);return}if(v.escape)e();else if(v.ctrl&&O==="a")b(S=>S==="rgb"?"hex":S==="hex"?"hsl":"rgb");else if(v.upArrow)y(S=>Math.max(0,S-1));else if(v.downArrow)y(S=>Math.min(P.length+1,S+1));else if(v.return)if(a===0)B("name"),A(h.name),G(h.name);else if(a===1)B("id"),A(h.id),G(h.id);else{const S=a-2,V=P[S],W=h.colors[V];_(S),A(W),G(W)}}else if(D!==null)v.ctrl&&O==="a"&&b(S=>S==="rgb"?"hex":S==="hex"?"hsl":"rgb");else if(C!==null)if(v.return){if(C==="id"){const S=l;d(k),i(V=>{const W=V.themes.findIndex(Q=>Q.id===S);W!==-1&&(V.themes[W].id=k)})}else Z(S=>{S.name=k});B(null),A(""),G("")}else v.escape?(B(null),A(""),G("")):v.backspace||v.delete?A(S=>S.slice(0,-1)):O&&A(S=>S+O)});const P=Object.keys(h.colors),j=(O,v)=>{const S=O.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!S)return O;const V=parseInt(S[1]),W=parseInt(S[2]),Q=parseInt(S[3]);switch(v){case"hex":{const Y=p=>p.toString(16).padStart(2,"0");return`#${Y(V)}${Y(W)}${Y(Q)}`}case"hsl":{const Y=V/255,p=W/255,f=Q/255,m=Math.max(Y,p,f),I=Math.min(Y,p,f),u=m-I,x=(m+I)/2;let M=0;u!==0&&(M=x>.5?u/(2-m-I):u/(m+I));let w=0;return u!==0&&(m===Y?w=((p-f)/u+(p<f?6:0))/6:m===p?w=((f-Y)/u+2)/6:w=((Y-p)/u+4)/6),`hsl(${Math.round(w*360)}, ${Math.round(M*100)}%, ${Math.round(x*100)}%)`}case"rgb":default:return O}},F=O=>({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.",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",secondaryText:"Secondary/dimmed text. Used for keyboard shortcuts and other help text.",secondaryBorder:"Secondary border color. Used for various boxes.",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.",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",autoAccept:"Auto-accept mode indicator",bashBorder:"Bash command border",permission:"Permission prompt color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",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"})[O]||"",q=Math.max(...P.map(O=>O.length));return s(c,{children:[s(c,{flexDirection:"column",width:"50%",children:[n(c,{children:s(de,{children:["Editing theme “",h.name,"” (",h.id,")"]})}),D===null&&C===null?s(le,{children:[s(c,{marginBottom:1,flexDirection:"column",children:[n(t,{dimColor:!0,children:"enter to edit theme name, id, or color"}),n(t,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),n(t,{dimColor:!0,children:"paste color from clipboard (when on color)"}),n(t,{dimColor:!0,children:"esc to go back"})]}),a<2?s(c,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[n(t,{bold:!0,children:a===0?"Theme Name":"Theme ID"}),n(t,{children:a===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):s(c,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:h.colors[P[a-2]],flexDirection:"column",paddingLeft:1,children:[n(Ue,{colorKey:P[a-2],theme:h,bold:!0}),n(t,{children:F(P[a-2])})]}),s(c,{flexDirection:"column",children:[s(c,{children:[n(t,{color:a===0?"yellow":"white",children:a===0?"❯ ":" "}),n(t,{bold:!0,children:"Name: "}),n(t,{children:h.name})]}),s(c,{marginBottom:1,children:[n(t,{color:a===1?"yellow":"white",children:a===1?"❯ ":" "}),n(t,{bold:!0,children:"ID: "}),n(t,{children:h.id})]}),P.map((O,v)=>{const S=v+2;return s(c,{children:[n(t,{color:a===S?"yellow":"white",children:a===S?"❯ ":" "}),n(c,{width:q+2,children:n(t,{children:n(Ue,{colorKey:O,theme:h,bold:!0})})}),n(t,{color:h.colors[O],children:j(h.colors[O],g)})]},O)})]})]}):C?s(c,{flexDirection:"column",marginTop:1,children:[s(t,{children:["Editing ",C==="name"?"theme name":"theme ID",":"]}),n(c,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:n(t,{children:k})}),n(t,{dimColor:!0,children:"enter to save, esc to cancel"})]}):n(Ke,{initialValue:R,colorKey:P[D],theme:h,onColorChange:O=>{A(O),Z(v=>{v.colors[P[D]]=O})},onExit:()=>{Z(O=>{O.colors[P[D]]=k}),_(null),A(""),G("")}})]}),n(c,{width:"50%",children:n(He,{theme:h})})]})}function mr(e){return e.map(o=>`${o.name} (${o.id})`)}function pr({onBack:e}){const{settings:{themes:o},updateSettings:r}=ge(he),[i,l]=T(0),[d,h]=T(null),[g,b]=T(!0),a=()=>{const k={colors:{...(o[0]||K.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};r(A=>{A.themes.push(k)}),h(k.id),b(!1)},y=B=>{o.length<=1||(r(k=>{k.themes=k.themes.filter(A=>A.id!==B)}),i>=o.length-1&&l(Math.max(0,o.length-2)))},D=()=>{r(B=>{B.themes=[...K.themes]}),l(0)};if(ce((B,k)=>{if(k.escape)e();else if(k.upArrow)l(A=>Math.max(0,A-1));else if(k.downArrow)l(A=>Math.min(o.length-1,A+1));else if(k.return){const A=o[i];A&&(h(A.id),b(!1))}else if(B==="n")a();else if(B==="d"){const A=o[i];A&&y(A.id)}else k.ctrl&&B==="r"&&D()},{isActive:g}),d)return n(fr,{themeId:d,onBack:()=>{h(null),b(!0)}});const _=mr(o),C=o.find(B=>_[i]?.includes(`(${B.id})`))||o[0];return o.length===0?n(c,{children:s(c,{flexDirection:"column",width:"100%",children:[n(de,{children:"Themes"}),s(c,{marginBottom:1,flexDirection:"column",children:[n(t,{dimColor:!0,children:"n to create a new theme"}),n(t,{dimColor:!0,children:"esc to go back"})]}),n(t,{children:"No themes available!"})]})}):s(c,{children:[s(c,{flexDirection:"column",width:"50%",children:[n(de,{children:"Themes"}),s(c,{marginBottom:1,flexDirection:"column",children:[n(t,{dimColor:!0,children:"n to create a new theme"}),n(t,{dimColor:!0,children:"d to delete a theme"}),n(t,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),n(t,{dimColor:!0,children:"enter to edit theme"}),n(t,{dimColor:!0,children:"esc to go back"})]}),n(c,{flexDirection:"column",children:_.map((B,k)=>s(t,{color:i===k?"yellow":void 0,children:[i===k?"❯ ":" ",B]},k))})]}),n(c,{width:"50%",children:n(He,{theme:C})})]})}let Ne=["ANSI Shadow"];function br({onBack:e}){const{stdout:o}=rr(),r=o?.columns||120,{settings:{launchText:{method:i,figletText:l,figletFont:d,customText:h},themes:g},updateSettings:b}=ge(he),a=i==="figlet"?["method","text","font"]:["method","text"],[y,D]=T(0),_=a[y],[C,B]=T(i==="figlet"?0:1),[k,A]=T(Ne),[R,G]=T(Ne),[Z,H]=T(""),[P,j]=T(!1),[F,q]=T(0),[O,v]=T(""),[S,V]=T(50),[W,Q]=T(!1),[Y,p]=T(i==="figlet"?l:h),f=ve(),I=(g.find(x=>x.id===f)||g.find(x=>x.id==="dark"))?.colors.claude||"rgb(215,119,87)";ie(()=>{Oe.fonts((x,M)=>{if(!x&&M){const w=M.sort();A(w),G(w),Ne=w;const E=w.indexOf(d);q(E>=0?E:w.indexOf("ANSI Shadow")||0)}})},[]),ie(()=>{u()},[i,l,d,h,Y,W]);const u=()=>{if(i==="figlet")try{const x=W?Y:l,M=Oe.textSync(x.replace(`
3
- `," "),{font:d}),w=Math.floor(r*.7),X=M.split(`
4
- `).map($=>$.length>w?$.substring(0,w-3)+"…":$),oe=X.join(`
5
- `);v(oe);const te=Math.max(...X.map($=>$.length)),L=Math.min(75,Math.max(50,Math.ceil(te/r*100)));V(L+5)}catch{v("Error generating figlet text"),V(50)}else{const x=Math.floor(r*.6),E=(W?Y:h).split(`
6
- `).map(L=>L.length>x?L.substring(0,x-3)+"...":L),X=E.join(`
7
- `);v(X);const oe=Math.max(...E.map(L=>L.length)),te=Math.min(75,Math.max(50,Math.ceil(oe/r*100)));V(te+5)}};return ie(()=>{if(Z){const x=k.filter(M=>M.toLowerCase().includes(Z.toLowerCase()));G(x),q(0)}else{G(k);const x=k.indexOf(d);q(x>=0?x:0)}},[Z,k]),ie(()=>{if(!P){const x=R.indexOf(d);x>=0&&q(x)}},[d,R,P]),ce((x,M)=>{if(W){M.return?(b(i==="figlet"?w=>{w.launchText.figletText=Y}:w=>{w.launchText.customText=Y}),Q(!1)):M.escape?(p(i==="figlet"?l:h),Q(!1)):M.backspace||M.delete?p(w=>w.slice(0,-1)):x&&p(w=>w+x);return}if(P){if(M.return)R.length>0&&b(w=>{w.launchText.figletFont=R[F]}),j(!1),H("");else if(M.escape)j(!1),H("");else if(M.backspace||M.delete)H(w=>w.slice(0,-1));else if(M.upArrow){const w=F>0?F-1:R.length-1;q(w),R.length>0&&b(E=>{E.launchText.figletFont=R[w]})}else if(M.downArrow){const w=F<R.length-1?F+1:0;q(w),R.length>0&&b(E=>{E.launchText.figletFont=R[w]})}else x&&x.match(/^[a-zA-Z0-9\s\-_]$/)&&H(w=>w+x);return}if(M.escape)e();else if(M.return)_==="text"&&(p(i==="figlet"?l:h),Q(!0));else if(M.tab)M.shift?D(w=>w===0?a.length-1:w-1):D(w=>w===a.length-1?0:w+1);else if(M.upArrow){if(_==="method"){const w=C>0?C-1:1;B(w),b(E=>{E.launchText.method=w===0?"figlet":"custom"})}else if(_==="font"&&i==="figlet"){const w=F>0?F-1:R.length-1;q(w),b(E=>{E.launchText.figletFont=R[w]})}}else if(M.downArrow){if(_==="method"){const w=C<1?C+1:0;B(w),b(E=>{E.launchText.method=w===0?"figlet":"custom"})}else if(_==="font"&&i==="figlet"){const w=F<R.length-1?F+1:0;q(w),b(E=>{E.launchText.figletFont=R[w]})}}else x&&_==="font"&&i==="figlet"&&x.match(/^[a-zA-Z0-9]$/)&&(j(!0),H(x))}),s(c,{children:[s(c,{flexDirection:"column",width:`${100-S}%`,children:[s(c,{marginBottom:1,flexDirection:"column",children:[n(de,{children:"Setup banner"}),s(c,{flexDirection:"column",children:[s(t,{dimColor:!0,children:["enter to ",_==="text"?"edit text":"save"]}),n(t,{dimColor:!0,children:"esc to go back"}),n(t,{dimColor:!0,children:"tab to switch sections"})]})]}),n(c,{children:s(t,{children:[n(t,{color:_==="method"?"yellow":void 0,children:_==="method"?"❯ ":" "}),n(t,{bold:!0,color:_==="method"?"yellow":void 0,children:"Method"})]})}),_==="method"&&s(t,{dimColor:!0,children:[" ","select one of ",R.length," Figlet fonts or enter your own text"]}),n(c,{marginLeft:2,marginBottom:1,children:s(c,{flexDirection:"column",children:[s(t,{color:C===0?"cyan":"white",children:[C===0?"❯ ":" ","Figlet"]}),s(t,{color:C===1?"cyan":"white",children:[C===1?"❯ ":" ","Custom"]})]})}),s(c,{flexDirection:"column",children:[s(t,{children:[n(t,{color:_==="text"?"yellow":void 0,children:_==="text"?"❯ ":" "}),n(t,{bold:!0,color:_==="text"?"yellow":void 0,children:"Text"})]}),_==="text"&&(W?s(t,{dimColor:!0,children:[" ","esc to save"]}):s(t,{dimColor:!0,children:[" ","enter to edit"]}))]}),n(c,{marginLeft:2,marginBottom:1,children:n(c,{borderStyle:"round",borderColor:W?"yellow":"gray",children:n(t,{children:W?Y:i==="figlet"?l:h})})}),i==="figlet"&&s(le,{children:[n(c,{children:s(c,{flexDirection:"column",children:[s(t,{children:[n(t,{color:_==="font"?"yellow":void 0,children:_==="font"?"❯ ":" "}),n(t,{bold:!0,color:_==="font"?"yellow":void 0,children:"Font"})]}),_==="font"&&s(t,{dimColor:!0,children:[" ","type to filter"]}),n(t,{children:P&&s(t,{color:"gray",dimColor:!0,children:[" ","(filtering: “",Z,"”)"]})})]})}),n(c,{marginLeft:2,marginBottom:1,children:n(c,{flexDirection:"column",children:(()=>{const M=Math.max(0,F-Math.floor(4)),w=Math.min(R.length,M+8),E=Math.max(0,w-8),X=R.slice(E,w);return s(le,{children:[E>0&&s(t,{color:"gray",dimColor:!0,children:[" ","↑ ",E," more above"]}),X.map((oe,te)=>{const L=E+te;return s(t,{color:F===L?"cyan":void 0,children:[F===L?"❯ ":" ",oe]},oe)}),w<R.length&&s(t,{color:"gray",dimColor:!0,children:[" ","↓ ",R.length-w," more below"]})]})})()})})]})]}),s(c,{width:`${S}%`,flexDirection:"column",children:[n(c,{marginBottom:1,children:n(t,{bold:!0,children:"Preview"})}),s(c,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:[s(c,{flexDirection:"column",marginBottom:1,children:[n(t,{color:I,children:"╭──────────────────────────╮"}),s(t,{children:[n(t,{color:I,children:"│ ✻"})," Welcome to Claude Code"," ",n(t,{color:I,children:"│"})]}),n(t,{color:I,children:"╰──────────────────────────╯"})]}),O.split(`
8
- `).map((x,M)=>n(t,{color:I,children:x},M)),n(c,{marginTop:1,children:n(t,{wrap:"truncate-end",children:"Claude Code can now be used with your Claude subscription or billed based on API usage through your Console account."})})]})]})]})}function xr({onBack:e}){const{settings:{thinkingVerbs:{format:o,verbs:r},themes:i},updateSettings:l}=ge(he),d=["format","verbs"],[h,g]=T(0),b=d[h],[a,y]=T(0),[D,_]=T(!1),[C,B]=T(""),[k,A]=T(!1),[R,G]=T(!1),[Z,H]=T(o),P=ve(),j=i.find(O=>O.id===P)||i.find(O=>O.id==="dark"),F=j?.colors.claude||"rgb(215,119,87)";ce((O,v)=>{if(R){v.return?(l(S=>{S.thinkingVerbs.format=Z}),G(!1)):v.escape?(H(o),G(!1)):v.backspace||v.delete?H(S=>S.slice(0,-1)):O&&H(S=>S+O);return}if(D||k){v.return&&C.trim()?(k?(l(S=>{S.thinkingVerbs.verbs.push(C.trim())}),A(!1)):(l(S=>{S.thinkingVerbs.verbs[a]=C.trim()}),_(!1)),B("")):v.escape?(B(""),_(!1),A(!1)):v.backspace||v.delete?B(S=>S.slice(0,-1)):O&&B(S=>S+O);return}v.escape?e():v.return?b==="format"&&(H(o),G(!0)):v.tab?v.shift?g(S=>S===0?d.length-1:S-1):g(S=>S===d.length-1?0:S+1):v.upArrow?b==="verbs"&&r.length>0&&y(S=>S>0?S-1:r.length-1):v.downArrow?b==="verbs"&&r.length>0&&y(S=>S<r.length-1?S+1:0):O==="e"&&b==="verbs"?r.length>0&&(B(r[a]),_(!0)):O==="d"&&b==="verbs"?r.length>1&&(l(S=>{S.thinkingVerbs.verbs=S.thinkingVerbs.verbs.filter((V,W)=>W!==a)}),a>=r.length-1&&y(Math.max(0,r.length-2))):O==="n"&&b==="verbs"?(A(!0),B("")):v.ctrl&&O==="r"&&b==="verbs"&&(l(S=>{S.thinkingVerbs.verbs=[...K.thinkingVerbs.verbs]}),y(0))});const q=50;return s(c,{children:[s(c,{flexDirection:"column",width:`${100-q}%`,children:[s(c,{marginBottom:1,flexDirection:"column",children:[n(de,{children:"Thinking Verbs"}),s(c,{flexDirection:"column",children:[n(t,{dimColor:!0,children:b==="format"?"enter to edit format":"changes auto-saved"}),n(t,{dimColor:!0,children:"esc to go back"}),n(t,{dimColor:!0,children:"tab to switch sections"})]})]}),n(c,{marginBottom:1,children:n(t,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),s(c,{flexDirection:"column",children:[s(t,{children:[n(t,{color:b==="format"?"yellow":void 0,children:b==="format"?"❯ ":" "}),n(t,{bold:!0,color:b==="format"?"yellow":void 0,children:"Format"})]}),b==="format"&&(R?s(t,{dimColor:!0,children:[" ","enter to save"]}):s(t,{dimColor:!0,children:[" ","enter to edit"]}))]}),n(c,{marginLeft:2,marginBottom:1,children:n(c,{borderStyle:"round",borderColor:R?"yellow":"gray",children:n(t,{children:R?Z:o})})}),n(c,{children:s(t,{children:[n(t,{color:b==="verbs"?"yellow":void 0,children:b==="verbs"?"❯ ":" "}),n(t,{bold:!0,color:b==="verbs"?"yellow":void 0,children:"Verbs"})]})}),b==="verbs"&&n(c,{flexDirection:"column",children:s(t,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),n(c,{marginLeft:2,marginBottom:1,children:s(c,{flexDirection:"column",children:[(()=>{const v=Math.max(0,a-Math.floor(4)),S=Math.min(r.length,v+8),V=Math.max(0,S-8),W=r.slice(V,S);return s(le,{children:[V>0&&s(t,{color:"gray",dimColor:!0,children:[" ","↑ ",V," more above"]}),W.map((Q,Y)=>{const p=V+Y;return s(t,{color:b==="verbs"&&p===a?"cyan":void 0,children:[b==="verbs"&&p===a?"❯ ":" ",Q]},p)}),S<r.length&&s(t,{color:"gray",dimColor:!0,children:[" ","↓ ",r.length-S," more below"]})]})})(),k&&s(c,{alignItems:"center",children:[n(t,{color:"yellow",children:"❯ "}),n(c,{borderStyle:"round",borderColor:"yellow",children:n(t,{children:C})})]}),D&&s(c,{marginTop:1,alignItems:"center",children:[n(t,{children:"Editing: "}),n(c,{borderStyle:"round",borderColor:"yellow",children:n(t,{children:C})})]})]})})]}),s(c,{width:`${q}%`,flexDirection:"column",children:[n(c,{marginBottom:1,children:n(t,{bold:!0,children:"Preview"})}),n(c,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:s(t,{children:[s(t,{color:F,children:["✻ ",o.replace(/\{\}/g,r[a])," "]}),n(t,{color:j?.colors.secondaryText,children:"(10s · ↑ 456 tokens · esc to interrupt)"})]})})]})]})}const fe=[{name:"Default",phases:K.thinkingStyle.phases,reverseMirror:K.thinkingStyle.reverseMirror},{name:"Basic",phases:["|","/","-","\\"],reverseMirror:!1},{name:"Braille",phases:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],reverseMirror:!1},{name:"Circle",phases:["◐","◓","◑","◒"],reverseMirror:!1},{name:"Wave",phases:["▁","▃","▄","▅","▆","▇","█"],reverseMirror:!0},{name:"Glow",phases:["░","▒","▓","█"],reverseMirror:!0},{name:"Partial block",phases:["▏","▎","▍","▌","▋","▊","▉","█"],reverseMirror:!0},{name:"Clock",phases:["🕛","🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚"],reverseMirror:!1},{name:"Globe",phases:["🌍","🌎","🌏"],reverseMirror:!1},{name:"Arc",phases:["◜","◠","◝","◞","◡","◟"],reverseMirror:!1},{name:"Triangle",phases:["◤","◥","◢","◣"],reverseMirror:!1},{name:"Bouncing",phases:["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"],reverseMirror:!1},{name:"Dots",phases:[".","..","..."],reverseMirror:!1},{name:"Colors",phases:["🔴","🟠","🟡","🟢","🔵","🟣"],reverseMirror:!1}];function wr({onBack:e}){const{settings:{thinkingStyle:{phases:o,updateInterval:r,reverseMirror:i},themes:l},updateSettings:d}=ge(he),h=["reverseMirror","updateInterval","phases","presets"],[g,b]=T(0),a=h[g],[y,D]=T(0),[_,C]=T(0),[B,k]=T(!1),[A,R]=T(""),[G,Z]=T(!1),[H,P]=T(!1),[j,F]=T(r.toString()),[q,O]=T(0),v=ve(),S=l.find(m=>m.id===v)||l.find(m=>m.id==="dark"),V=S?.colors.claude||"rgb(215,119,87)";ie(()=>{if(o.length>0){const m=i?[...o,...[...o].reverse().slice(1,-1)]:o,I=setInterval(()=>{O(u=>(u+1)%m.length)},r);return()=>clearInterval(I)}},[o,r,i]),ce((m,I)=>{if(H){if(I.return){const u=parseInt(j);!isNaN(u)&&u>0&&d(x=>{x.thinkingStyle.updateInterval=u}),P(!1)}else I.escape?(F(r.toString()),P(!1)):I.backspace||I.delete?F(u=>u.slice(0,-1)):m&&m.match(/^[0-9]$/)&&F(u=>u+m);return}if(B||G){if(I.return&&A.length){const u=G?[...o,A]:o.map((x,M)=>M===y?A:x);d(x=>{x.thinkingStyle.phases=u}),k(!1),R("")}else I.escape?(R(""),k(!1),Z(!1)):I.backspace||I.delete?R(u=>u.slice(0,-1)):m&&R(u=>u+m);return}if(I.escape)e();else if(I.return)if(a==="updateInterval")F(r.toString()),P(!0);else if(a==="presets"){const u=fe[_];d(x=>{x.thinkingStyle.phases=[...u.phases],x.thinkingStyle.reverseMirror=u.reverseMirror})}else a==="reverseMirror"&&d(u=>{u.thinkingStyle.reverseMirror=!u.thinkingStyle.reverseMirror});else if(I.tab)I.shift?b(u=>u===0?h.length-1:u-1):b(u=>u===h.length-1?0:u+1);else if(I.upArrow)a==="phases"&&o.length>0?D(u=>u>0?u-1:o.length-1):a==="presets"&&C(u=>u>0?u-1:fe.length-1);else if(I.downArrow)a==="phases"&&o.length>0?D(u=>u<o.length-1?u+1:0):a==="presets"&&C(u=>u<fe.length-1?u+1:0);else if(m===" ")a==="reverseMirror"&&d(u=>{u.thinkingStyle.reverseMirror=!u.thinkingStyle.reverseMirror});else if(m==="e"&&a==="phases")o.length>0&&(R(o[y]),k(!0));else if(m==="a"&&a==="phases")Z(!0),R("");else if(m==="d"&&a==="phases")o.length>1&&(d(u=>{u.thinkingStyle.phases=o.filter((x,M)=>M!==y)}),y>=o.length&&D(Math.max(0,o.length-1)));else if(m==="w"&&a==="phases"){if(y>0){const u=[...o];[u[y-1],u[y]]=[u[y],u[y-1]],d(x=>{x.thinkingStyle.phases=u}),D(x=>x-1)}}else if(m==="s"&&a==="phases"){if(y<o.length-1){const u=[...o];[u[y],u[y+1]]=[u[y+1],u[y]],d(x=>{x.thinkingStyle.phases=u}),D(x=>x+1)}}else I.ctrl&&m==="r"&&(d(u=>{u.thinkingStyle=K.thinkingStyle}),D(0),C(0))});const W=i?"●":"○",Q=50,p=i?[...o,...[...o].reverse().slice(1,-1)]:o,f=p.length>0?p[q]:"·";return n(c,{children:s(c,{flexDirection:"column",width:"100%",children:[s(c,{flexDirection:"row",width:"100%",children:[s(c,{marginBottom:1,flexDirection:"column",width:`${100-Q}%`,children:[n(de,{children:"Thinking style"}),s(c,{flexDirection:"column",children:[s(t,{dimColor:!0,children:["enter to"," ",a==="updateInterval"?"edit interval":a==="presets"?"apply preset":"save"]}),n(t,{dimColor:!0,children:"esc to go back"}),n(t,{dimColor:!0,children:"tab to switch sections"})]})]}),s(c,{width:`${Q}%`,flexDirection:"column",children:[n(c,{children:n(t,{bold:!0,children:"Preview"})}),s(c,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[n(c,{width:(f?.length??0)+1,children:n(t,{color:V,children:f})}),s(t,{children:[n(t,{color:V,children:"Thinking… "}),n(t,{color:S?.colors.secondaryText,children:"(esc to interrupt)"})]})]})]})]}),s(c,{flexDirection:"row",gap:4,children:[s(c,{flexDirection:"column",children:[s(t,{children:[n(t,{color:a==="reverseMirror"?"yellow":void 0,children:a==="reverseMirror"?"❯ ":" "}),n(t,{bold:!0,color:a==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),a==="reverseMirror"&&s(t,{dimColor:!0,children:[" ","space to toggle"]}),n(c,{marginLeft:2,marginBottom:1,children:s(t,{children:[W," ",i?"Enabled":"Disabled"]})})]}),s(c,{flexDirection:"column",children:[s(t,{children:[n(t,{color:a==="updateInterval"?"yellow":void 0,children:a==="updateInterval"?"❯ ":" "}),n(t,{bold:!0,color:a==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),a==="updateInterval"&&(H?s(t,{dimColor:!0,children:[" ","enter to save"]}):s(t,{dimColor:!0,children:[" ","enter to edit"]})),n(c,{marginLeft:2,marginBottom:1,children:n(c,{borderStyle:"round",borderColor:H?"yellow":"gray",children:n(t,{children:H?j:r})})})]})]}),n(c,{children:s(t,{children:[n(t,{color:a==="phases"?"yellow":void 0,children:a==="phases"?"❯ ":" "}),n(t,{bold:!0,color:a==="phases"?"yellow":void 0,children:"Phases"})]})}),a==="phases"&&n(c,{marginBottom:1,flexDirection:"column",children:s(t,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),n(c,{marginLeft:2,marginBottom:1,children:s(c,{flexDirection:"column",children:[(()=>{const I=Math.max(0,y-Math.floor(4)),u=Math.min(o.length,I+8),x=Math.max(0,u-8),M=o.slice(x,u);return s(le,{children:[x>0&&s(t,{color:"gray",dimColor:!0,children:[" ","↑ ",x," more above"]}),M.map((w,E)=>{const X=x+E;return s(t,{color:a==="phases"&&X===y?"cyan":void 0,children:[a==="phases"&&X===y?"❯ ":" ",w]},X)}),u<o.length&&s(t,{color:"gray",dimColor:!0,children:[" ","↓ ",o.length-u," more below"]})]})})(),G&&s(c,{children:[n(t,{color:"yellow",children:"❯ "}),n(c,{borderStyle:"round",borderColor:"yellow",children:n(t,{children:A})})]}),B&&s(c,{marginTop:1,children:[n(t,{children:"Editing: "}),n(c,{borderStyle:"round",borderColor:"yellow",children:n(t,{children:A})})]})]})}),n(c,{children:s(t,{children:[n(t,{color:a==="presets"?"yellow":void 0,children:a==="presets"?"❯ ":" "}),n(t,{bold:!0,color:a==="presets"?"yellow":void 0,children:"Presets"})]})}),a==="presets"&&s(t,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),n(c,{marginLeft:2,marginBottom:1,children:n(c,{flexDirection:"column",children:(()=>{const I=Math.max(0,_-Math.floor(4)),u=Math.min(fe.length,I+8),x=Math.max(0,u-8),M=fe.slice(x,u);return s(le,{children:[x>0&&s(t,{color:"gray",dimColor:!0,children:[" ","↑ ",x," more above"]}),M.map((w,E)=>{const X=x+E;return s(t,{color:a==="presets"&&X===_?"cyan":void 0,children:[a==="presets"&&X===_?"❯ ":" ",w.name," ",w.phases.join("")]},X)}),u<fe.length&&s(t,{color:"gray",dimColor:!0,children:[" ","↓ ",fe.length-u," more below"]})]})})()})}),n(c,{marginTop:1,children:n(t,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const xe=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function Sr({onBack:e}){const{settings:o,updateSettings:r}=ge(he),[i,l]=T("prefix"),[d,h]=T(0),[g,b]=T(!1),[a,y]=T(()=>o.userMessageDisplay.prefix.format),[D,_]=T(0),[C,B]=T(()=>[...o.userMessageDisplay.prefix.styling]),[k,A]=T(()=>o.userMessageDisplay.prefix.foreground_color),[R,G]=T(()=>o.userMessageDisplay.prefix.background_color),[Z,H]=T(0),[P,j]=T(0),[F,q]=T(()=>[...o.userMessageDisplay.message.styling]),[O,v]=T(()=>o.userMessageDisplay.message.foreground_color),[S,V]=T(()=>o.userMessageDisplay.message.background_color),[W,Q]=T(null),[Y,p]=T(""),f=ve(),m=o.themes?.find(L=>L.id===f)||o.themes?.[0],I=["format","styling","foreground","background"],u=["styling","foreground","background"],x=I[d],M=u[Z],w=(L,$)=>{r(N=>{const J=L==="prefix"?N.userMessageDisplay.prefix:N.userMessageDisplay.message;$(J)})},E=L=>{r($=>{L==="prefix"?$.userMessageDisplay.prefix={...K.userMessageDisplay.prefix}:$.userMessageDisplay.message={...K.userMessageDisplay.message}}),L==="prefix"?(y(K.userMessageDisplay.prefix.format),B([...K.userMessageDisplay.prefix.styling]),A(K.userMessageDisplay.prefix.foreground_color),G(K.userMessageDisplay.prefix.background_color)):(q([...K.userMessageDisplay.message.styling]),v(K.userMessageDisplay.message.foreground_color),V(K.userMessageDisplay.message.background_color))};ie(()=>{const L=o.userMessageDisplay.prefix;y(L.format),B([...L.styling]),A(L.foreground_color),G(L.background_color);const $=o.userMessageDisplay.message;q([...$.styling]),v($.foreground_color),V($.background_color)},[]),ce((L,$)=>{if(g){if($.return)w("prefix",N=>{N.format=a}),b(!1);else if($.escape){const N=o.userMessageDisplay.prefix;y(N.format),b(!1)}else $.backspace||$.delete?y(N=>N.slice(0,-1)):L&&y(N=>N+L);return}if(W===null){if($.escape)e();else if($.ctrl&&L==="r")E(i);else if($.leftArrow||$.rightArrow)l(N=>N==="prefix"?"message":"prefix");else if($.tab)i==="prefix"?$.shift?h(N=>N===0?I.length-1:N-1):h(N=>N===I.length-1?0:N+1):$.shift?H(N=>N===0?u.length-1:N-1):H(N=>N===u.length-1?0:N+1);else if($.return)i==="prefix"?x==="format"?b(!0):x==="foreground"?(p(k),Q({column:"prefix",type:"foreground"})):x==="background"&&(p(R),Q({column:"prefix",type:"background"})):M==="foreground"?(p(O),Q({column:"message",type:"foreground"})):M==="background"&&(p(S),Q({column:"message",type:"background"}));else if($.upArrow)i==="prefix"&&x==="styling"?_(N=>Math.max(0,N-1)):i==="message"&&M==="styling"&&j(N=>Math.max(0,N-1));else if($.downArrow)i==="prefix"&&x==="styling"?_(N=>Math.min(xe.length-1,N+1)):i==="message"&&M==="styling"&&j(N=>Math.min(xe.length-1,N+1));else if(L===" "){if(i==="prefix"&&x==="styling"){const N=xe[D].value,J=C.indexOf(N)>=0?C.filter(U=>U!==N):[...C,N];B(J),w("prefix",U=>{U.styling=[...J]})}else if(i==="message"&&M==="styling"){const N=xe[P].value,J=F.indexOf(N)>=0?F.filter(U=>U!==N):[...F,N];q(J),w("message",U=>{U.styling=[...J]})}}}});const X=(L,$,N=!0)=>{const J=N?$==="prefix"?C:F:[],U=N?$==="prefix"?k:O:"rgb(255,255,255)",be=N?$==="prefix"?R:S:"rgb(0,0,0)",_e=U!=="rgb(0,0,0)",Ie=be!=="rgb(0,0,0)";return n(t,{bold:J.includes("bold"),italic:J.includes("italic"),underline:J.includes("underline"),strikethrough:J.includes("strikethrough"),inverse:J.includes("inverse"),color:_e?U:void 0,backgroundColor:Ie?be:void 0,children:L})},oe=(L=!0)=>s(t,{children:[a&&s(le,{children:[X(a,"prefix",L)," "]}),X(" "+"list the dir","message",L)]}),te=L=>{const $=i===L,U=(L==="prefix"?I:u)[L==="prefix"?d:Z],be=L==="prefix"?D:P,_e=L==="prefix"?C:F,Ie=L==="prefix"?k:O,Re=L==="prefix"?R:S;return s(c,{flexDirection:"column",width:"45%",borderStyle:$?"round":"single",borderColor:$?"yellow":"gray",padding:1,children:[n(c,{marginBottom:1,children:s(t,{bold:!0,color:$?"yellow":void 0,children:[L.charAt(0).toUpperCase()+L.slice(1)," ","Configuration"]})}),L==="prefix"&&s(le,{children:[n(c,{children:s(t,{color:$&&U==="format"?"yellow":void 0,bold:$&&U==="format",children:[$&&U==="format"?"❯ ":" ","Prefix Text"]})}),$&&U==="format"&&n(c,{marginLeft:2,children:n(t,{dimColor:!0,children:g?"enter to save":"enter to edit (appears before message)"})}),n(c,{marginLeft:2,marginBottom:1,children:n(c,{borderStyle:"round",borderColor:g?"yellow":"gray",children:n(t,{children:a})})})]}),n(c,{children:s(t,{color:$&&U==="styling"?"yellow":void 0,bold:$&&U==="styling",children:[$&&U==="styling"?"❯ ":" ","Styling"]})}),$&&U==="styling"&&n(c,{marginLeft:2,children:n(t,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),n(c,{marginLeft:2,marginBottom:1,flexDirection:"column",children:xe.map((Me,ke)=>n(c,{children:s(t,{color:$&&U==="styling"&&be===ke?"cyan":void 0,children:[$&&U==="styling"&&be===ke?"❯ ":" ",_e.includes(Me.value)?"●":"○"," ",Me.label]})},Me.value))}),n(c,{children:s(t,{color:$&&U==="foreground"?"yellow":void 0,bold:$&&U==="foreground",children:[$&&U==="foreground"?"❯ ":" ","Foreground color"]})}),$&&U==="foreground"&&n(c,{marginLeft:2,children:n(t,{dimColor:!0,children:"enter to open color picker"})}),n(c,{marginLeft:2,marginBottom:1,children:n(t,{color:Ie,children:Ie})}),n(c,{children:s(t,{color:$&&U==="background"?"yellow":void 0,bold:$&&U==="background",children:[$&&U==="background"?"❯ ":" ","Background color"]})}),$&&U==="background"&&n(c,{marginLeft:2,children:n(t,{dimColor:!0,children:"enter to open color picker"})}),n(c,{marginLeft:2,children:n(t,{backgroundColor:Re,children:Re})})]})};if(W){const{column:L,type:$}=W;return n(Ke,{initialValue:Y,theme:m,onColorChange:N=>{L==="prefix"?$==="foreground"?(A(N),w("prefix",J=>{J.foreground_color=N})):(G(N),w("prefix",J=>{J.background_color=N})):$==="foreground"?(v(N),w("message",J=>{J.foreground_color=N})):(V(N),w("message",J=>{J.background_color=N}))},onExit:()=>{Q(null),p("")}})}return s(c,{flexDirection:"column",children:[n(de,{children:"Customize how user messages are displayed"}),s(c,{flexDirection:"column",marginBottom:1,children:[n(t,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),n(t,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),s(c,{flexDirection:"row",gap:1,children:[te("prefix"),te("message")]}),n(c,{borderStyle:"round",padding:1,marginTop:1,children:s(c,{flexDirection:"column",children:[n(c,{marginBottom:1,children:n(t,{bold:!0,children:"Preview"})}),s(c,{flexDirection:"row",gap:2,children:[s(c,{flexDirection:"column",width:"50%",children:[n(c,{marginBottom:1,children:n(t,{underline:!0,children:"Before (Claude Code default):"})}),n(c,{marginLeft:1,children:n(t,{color:m?.colors?.secondaryText||"#888888",children:"> list the dir"})}),n(c,{marginLeft:1,marginTop:1,children:s(t,{children:[n(t,{color:m?.colors?.secondaryText||"#888888",children:"●"}),n(t,{children:" The directory "}),n(t,{color:m?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),n(t,{children:" contains "}),n(t,{bold:!0,children:"123"}),n(t,{children:" files."})]})})]}),s(c,{flexDirection:"column",width:"50%",children:[n(c,{marginBottom:1,children:n(t,{underline:!0,children:"After (Your customization):"})}),n(c,{marginLeft:1,children:oe(!0)}),n(c,{marginLeft:1,marginTop:1,children:s(t,{children:[n(t,{color:m?.colors?.secondaryText||"#888888",children:"●"}),n(t,{children:" The directory "}),n(t,{color:m?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),n(t,{children:" contains "}),n(t,{bold:!0,children:"123"}),n(t,{children:" files."})]})})]})]})]})})]})}function yr({onSubmit:e}){const{settings:o,updateSettings:r}=ge(he),[i,l]=T(0),d=()=>{r(g=>{g.inputBox||(g.inputBox={removeBorder:!1}),g.inputBox.removeBorder=!g.inputBox.removeBorder})};ce((g,b)=>{b.return||b.escape?e():g===" "&&i===0&&d()});const h=o.inputBox?.removeBorder?"☑":"☐";return s(c,{flexDirection:"column",children:[n(c,{marginBottom:1,children:n(de,{children:"Input Box Settings"})}),n(c,{marginBottom:1,children:s(t,{color:"gray",children:[n(t,{bold:!0,children:"Customize the appearance of the Claude Code input box."})," ",n(t,{dimColor:!0,children:"Press space to toggle settings, enter to go back."})]})}),n(c,{children:s(t,{children:[n(t,{color:i===0?"cyan":void 0,children:i===0?"❯ ":" "}),n(t,{bold:!0,color:i===0?"cyan":void 0,children:"Remove border"})]})}),i===0&&n(c,{marginBottom:1,flexDirection:"column",children:s(t,{dimColor:!0,children:[" ","space to toggle"]})}),n(c,{marginLeft:2,marginBottom:1,children:s(t,{children:[h," ",o.inputBox?.removeBorder?"Enabled":"Disabled"]})}),n(c,{marginBottom:1,children:n(t,{color:"gray",dimColor:!0,children:"When enabled, removes the rounded border around the input box for a cleaner look."})})]})}const Ze=async()=>{await ue.mkdir(Be,{recursive:!0})};let we={settings:K,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const Le=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:K};try{ae()&&console.log(`Reading config at ${se}`);const o=await ue.readFile(se,"utf8"),r={...e,...JSON.parse(o)},i=r?.settings?.thinkingVerbs;i?.punctuation&&(i.format="{}"+i.punctuation,delete i.punctuation),r.settings.inputBox||(r.settings.inputBox=K.inputBox);for(const l of K.themes){const d=r?.settings?.themes.find(h=>h.id===l.id||h.name===l.name);if(d)for(const[h,g]of Object.entries(l))Object.hasOwn(d,h)||(d[h]=g)}return r?.settings?.userMessageDisplay||(r.settings=r.settings||K,r.settings.userMessageDisplay=K.userMessageDisplay),we=r,r}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT")return e;throw o}},Te=async e=>(ae()&&console.log(`Updating config at ${se}`),e(we),we.lastModified=new Date().toISOString(),await Ir(we),we),Ir=async e=>{try{e.lastModified=new Date().toISOString(),await Ze(),await ue.writeFile(se,JSON.stringify(e,null,2))}catch(o){throw console.error("Error saving config:",o),o}},qe=async e=>(ae()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`),await ue.copyFile(pe,e.cliPath),await Te(o=>{o.changesApplied=!1}),!0),Cr=async e=>{e.ccInstallationDir&&Ce.unshift(e.ccInstallationDir);for(const o of Ce)try{ae()&&console.log(`Searching for Claude Code cli.js file at ${o}`);const r=Pe.join(o,"cli.js"),i=Pe.join(o,"package.json"),l=JSON.parse(await ue.readFile(i,"utf8"));return ae()&&(console.log(`Found Claude Code cli.js file at ${o}; checking hash...`),console.log(`SHA256 hash: ${await ur(r)}`)),{cliPath:r,packageJsonPath:i,version:l.version}}catch{continue}return null},We=async e=>{await Ze(),ae()&&console.log(`Backing up cli.js to ${pe}`),await ue.copyFile(e.cliPath,pe),await Te(o=>{o.changesApplied=!1,o.ccVersion=e.version})};async function vr(e){try{return await ue.stat(e),!0}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT")return!1;throw o}}async function je(){const e=await Le(),o=await Cr(e);if(!o)return null;const r=o.version,i=e.ccVersion;let l=!1;return await vr(pe)||(ae()&&console.log(`startupCheck: ${pe} not found; backing up cli.js`),await We(o),l=!0),r!==i?(l||(ae()&&console.log(`startupCheck: real version (${r}) != backed up version (${i}); backing up cli.js`),await ue.unlink(pe),await We(o)),{wasUpdated:!0,oldVersion:i,newVersion:r,ccInstInfo:o}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:o}}function Tr(e){const o=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
2
+ import{Box as c,Text as t,render as er,useInput as de,useStdout as rr}from"ink";import{Command as nr}from"commander";import{Fragment as me,createContext as tr,useCallback as Ye,useContext as ue,useEffect as se,useState as M}from"react";import or from"ink-link";import{Fragment as ce,jsx as n,jsxs as s}from"react/jsx-runtime";import*as Ie from"node:path";import Fe from"node:path";import*as ye from"node:os";import{globbySync as ee}from"globby";import*as ze from"node:fs";import*as Ae from"node:child_process";import*as ir from"node:crypto";import Be from"figlet";import*as $e from"node:fs/promises";import ae from"node:fs/promises";import re from"chalk";function sr({items:e,selectedIndex:o,onSelect:r,onSubmit:i}){return de((l,d)=>{d.upArrow?r(o>0?o-1:e.length-1):d.downArrow?r(o<e.length-1?o+1:0):d.return&&i(e[o].name)}),n(c,{flexDirection:"column",children:e.map((l,d)=>n(c,{children:s(t,{children:[s(t,{bold:d===o,color:d===o?"cyan":void 0,...d===o?l.selectedStyles??{}:l.styles??{},children:[d===o?"❯ ":" ",l.name]}),l.desc&&d===o&&s(t,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",l.desc]})]})},d))})}let Y=function(e){return e.THEMES="Themes",e.LAUNCH_TEXT="Launch text",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.INPUT_BOX="Input box",e.APPLY_CHANGES="*Apply customizations to cli.js",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves tweakcc.json)",e.OPEN_CONFIG="Open tweakcc.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});const q={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",permission:"rgb(177,185,249)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(136,136,136)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",secondaryText:"rgb(153,153,153)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",diffAdded:"rgb(34,92,43)",diffRemoved:"rgb(122,41,54)",diffAddedDimmed:"rgb(71,88,74)",diffRemovedDimmed:"rgb(105,72,77)",diffAddedWord:"rgb(56,166,96)",diffRemovedWord:"rgb(179,89,107)",diffAddedWordDimmed:"rgb(46,107,58)",diffRemovedWordDimmed:"rgb(139,57,69)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",permission:"rgb(87,105,247)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(153,153,153)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",secondaryText:"rgb(102,102,102)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",diffAdded:"rgb(105,219,124)",diffRemoved:"rgb(255,168,180)",diffAddedDimmed:"rgb(199,225,203)",diffRemovedDimmed:"rgb(253,210,216)",diffAddedWord:"rgb(47,157,68)",diffRemovedWord:"rgb(209,69,75)",diffAddedWordDimmed:"rgb(144,194,156)",diffRemovedWordDimmed:"rgb(232,165,173)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"#cd00cd",bashBorder:"#cd00cd",claude:"#cdcd00",claudeShimmer:"#ffff00",permission:"#0000ee",planMode:"#00cdcd",ide:"#4782C8",secondaryBorder:"#e5e5e5",text:"#000000",inverseText:"#ffffff",secondaryText:"#7f7f7f",suggestion:"#0000ee",remember:"#0000ee",success:"#00cd00",error:"#cd0000",warning:"#cdcd00",diffAdded:"#00cd00",diffRemoved:"#cd0000",diffAddedDimmed:"#00cd00",diffRemovedDimmed:"#cd0000",diffAddedWord:"#00ff00",diffRemovedWord:"#ff0000",diffAddedWordDimmed:"#00cd00",diffRemovedWordDimmed:"#cd0000",red_FOR_SUBAGENTS_ONLY:"#cd0000",blue_FOR_SUBAGENTS_ONLY:"#0000cd",green_FOR_SUBAGENTS_ONLY:"#00cd00",yellow_FOR_SUBAGENTS_ONLY:"#cdcd00",purple_FOR_SUBAGENTS_ONLY:"#cd00cd",orange_FOR_SUBAGENTS_ONLY:"#cd8500",pink_FOR_SUBAGENTS_ONLY:"#ff1493",cyan_FOR_SUBAGENTS_ONLY:"#00cdcd"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"#ff00ff",bashBorder:"#ff00ff",claude:"#cdcd00",claudeShimmer:"#ffff00",permission:"#5c5cff",planMode:"#00ffff",ide:"#4782c8",secondaryBorder:"#e5e5e5",text:"#ffffff",inverseText:"#000000",secondaryText:"#e5e5e5",suggestion:"#5c5cff",remember:"#5c5cff",success:"#00ff00",error:"#ff0000",warning:"#ffff00",diffAdded:"#00cd00",diffRemoved:"#cd0000",diffAddedDimmed:"#00cd00",diffRemovedDimmed:"#cd0000",diffAddedWord:"#00ff00",diffRemovedWord:"#ff0000",diffAddedWordDimmed:"#00cd00",diffRemovedWordDimmed:"#cd0000",red_FOR_SUBAGENTS_ONLY:"#ff0000",blue_FOR_SUBAGENTS_ONLY:"#0000ff",green_FOR_SUBAGENTS_ONLY:"#00ff00",yellow_FOR_SUBAGENTS_ONLY:"#ffff00",purple_FOR_SUBAGENTS_ONLY:"#ff00ff",orange_FOR_SUBAGENTS_ONLY:"#ff8700",pink_FOR_SUBAGENTS_ONLY:"#ff69b4",cyan_FOR_SUBAGENTS_ONLY:"#00ffff"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",permission:"rgb(51,102,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(153,153,153)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",secondaryText:"rgb(102,102,102)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",diffAdded:"rgb(153,204,255)",diffRemoved:"rgb(255,204,204)",diffAddedDimmed:"rgb(209,231,253)",diffRemovedDimmed:"rgb(255,233,233)",diffAddedWord:"rgb(51,102,204)",diffRemovedWord:"rgb(153,51,51)",diffAddedWordDimmed:"rgb(102,153,204)",diffRemovedWordDimmed:"rgb(204,153,153)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",permission:"rgb(153,204,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",secondaryBorder:"rgb(136,136,136)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",secondaryText:"rgb(153,153,153)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",diffAdded:"rgb(0,68,102)",diffRemoved:"rgb(102,0,0)",diffAddedDimmed:"rgb(62,81,91)",diffRemovedDimmed:"rgb(62,44,44)",diffAddedWord:"rgb(0,119,179)",diffRemovedWord:"rgb(179,0,0)",diffAddedWordDimmed:"rgb(26,99,128)",diffRemovedWordDimmed:"rgb(128,21,21)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)"}}],launchText:{method:"figlet",figletText:"Claude Code",figletFont:"ANSI Shadow",customText:""},thinkingVerbs:{format:"{}… ",verbs:["Accomplishing","Actioning","Actualizing","Baking","Booping","Brewing","Calculating","Cerebrating","Channelling","Churning","Clauding","Coalescing","Cogitating","Combobulating","Computing","Concocting","Conjuring","Considering","Contemplating","Cooking","Crafting","Creating","Crunching","Deciphering","Deliberating","Determining","Discombobulating","Divining","Doing","Effecting","Elucidating","Enchanting","Envisioning","Finagling","Flibbertigibbeting","Forging","Forming","Frolicking","Generating","Germinating","Hatching","Herding","Honking","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:{}.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{prefix:{format:">",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"},message:{format:"{}",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"}},inputBox:{removeBorder:!1}},Ee=Ie.join(ye.homedir(),".tweakcc"),le=Ie.join(Ee,"config.json"),pe=Ie.join(Ee,"cli.js.backup"),lr=()=>{const e=[],o=process.platform=="win32"?ye.homedir().replace(/\\/g,"/"):ye.homedir(),r="node_modules/@anthropic-ai/claude-code";return e.push(`${ye.homedir()}/.claude/local/${r}`),{}.NPM_PREFIX&&e.push(`${{}.NPM_PREFIX}/lib/${r}`),{}.N_PREFIX&&e.push(`${{}.N_PREFIX}/lib/${r}`),{}.VOLTA_HOME&&e.push(`${{}.VOLTA_HOME}/lib/${r}`),{}.FNM_DIR&&e.push(`${{}.FNM_DIR}/lib/${r}`),{}.NVM_DIR&&e.push(`${{}.NVM_DIR}/lib/${r}`),{}.NODENV_ROOT&&e.push(...ee(`${{}.NODENV_ROOT}/versions/*/lib/${r}`)),{}.NVS_HOME&&e.push(...ee(`${{}.NVS_HOME}/node/*/*/lib/${r}`)),{}.ASDF_DATA_DIR&&e.push(...ee(`${{}.ASDF_DATA_DIR}/installs/nodejs/*/lib/${r}`)),process.platform=="win32"?(e.push(`${o}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${r}`),e.push(`${o}/AppData/Roaming/npm/${r}`),e.push(...ee(`${o}/AppData/Roaming/nvm/*/${r}}`)),e.push(`${o}/AppData/Local/Yarn/config/global/${r}`),e.push(...ee(`${o}/AppData/Local/pnpm/global/*/${r}`)),e.push(...ee(`${o}/n/versions/node/*/lib/${r}`)),e.push(`${o}/AppData/Roaming/Yarn/config/global/${r}`),e.push(`${o}/AppData/Roaming/pnpm-global/${r}`),e.push(...ee(`${o}/AppData/Roaming/pnpm-global/*/${r}`)),e.push(`${o}/.bun/install/global/${r}`),e.push(...ee(`${o}/AppData/Local/fnm_multishells/*/node_modules/${r}`))):(process.platform=="darwin"&&(e.push(`${o}/Library/${r}`),e.push(`/opt/local/lib/${r}`)),e.push(`${o}/.local/lib/${r}`),e.push(`${o}/.local/share/${r}`),e.push(`${o}/.npm-global/lib/${r}`),e.push(`${o}/.npm-packages/lib/${r}`),e.push(`${o}/.npm/lib/${r}`),e.push(`${o}/npm/lib/${r}`),e.push(`/etc/${r}`),e.push(`/lib/${r}`),e.push(`/opt/node/lib/${r}`),e.push(`/usr/lib/${r}`),e.push(`/usr/local/lib/${r}`),e.push(`/usr/share/${r}`),e.push(`/var/lib/${r}`),e.push(`/opt/homebrew/lib/${r}`),e.push(`${o}/.config/yarn/global/${r}`),e.push(`${o}/.yarn/global/${r}`),e.push(`${o}/.bun/install/global/${r}`),e.push(`${o}/.pnpm-global/${r}`),e.push(...ee(`${o}/.pnpm-global/*/${r}`)),e.push(`${o}/pnpm-global/${r}`),e.push(...ee(`${o}/pnpm-global/*/${r}`)),e.push(`${o}/.local/share/pnpm/global/${r}`),e.push(...ee(`${o}/.local/share/pnpm/global/*/${r}`)),e.push(`${o}/.bun/install/global/${r}`),e.push(...ee(`/usr/local/n/versions/node/*/lib/${r}`)),e.push(...ee(`${o}/n/versions/node/*/lib/${r}`)),e.push(`${o}/n/lib/${r}`),e.push(...ee(`${o}/.volta/tools/image/node/*/lib/${r}`)),e.push(...ee(`${o}/.fnm/node-versions/*/installation/lib/${r}`)),e.push(...ee(`/usr/local/nvm/versions/node/*/lib/${r}`)),e.push(...ee(`${o}/.nvm/versions/node/*/lib/${r}`)),e.push(...ee(`${o}/.nodenv/versions/*/lib/${r}`)),e.push(...ee(`${o}/.nvs/*/lib/${r}`)),e.push(...ee(`${o}/.asdf/installs/nodejs/*/lib/${r}`))),process.platform=="win32"?e.map(i=>i.replace(/\//g,"\\")):e},ve=lr(),cr=({children:e,...o})=>s(t,{bold:!0,backgroundColor:"#ffd500",color:"#000",...o,children:[" ",e," "]});var he=cr;const dr=[{name:Y.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:Y.LAUNCH_TEXT,desc:`Change the "CLAUDE CODE" banner text that's shown when you sign in to Claude Code`},{name:Y.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:Y.THINKING_STYLE,desc:"Choose custom spinners"},{name:Y.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:Y.INPUT_BOX,desc:"Customize the input box appearance (e.g., remove border)"}],ar=[{name:Y.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:Y.OPEN_CONFIG,desc:`Opens your tweakcc config file (${le})`},{name:Y.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:Y.EXIT,desc:"Bye!"}];function hr({onSubmit:e,notification:o}){const r=[...ue(ge).changesApplied?[]:[{name:Y.APPLY_CHANGES,desc:"Required: Updates Claude Code's cli.js in-place with your changes",selectedStyles:{color:"green"}}],...dr,...ar],[i,l]=M(0);return s(c,{flexDirection:"column",children:[n(c,{marginBottom:1,children:n(he,{children:"Tweak Claude Code"})}),n(c,{marginBottom:1,children:s(t,{color:"gray",children:[n(t,{bold:!0,children:"Customize your Claude Code installation."})," ",n(t,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),n(c,{marginBottom:1,children:s(t,{color:"yellow",children:["⭐ ",n(t,{bold:!0,children:"Star the repo at "}),n(or,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:n(t,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),n(t,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),o&&n(c,{marginBottom:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:"bold",borderColor:o?.type==="success"?"green":o?.type==="error"?"red":o?.type==="info"?"blue":"yellow",paddingLeft:1,flexDirection:"column",children:n(t,{color:o?.type==="success"?"green":o?.type==="error"?"red":o?.type==="info"?"blue":"yellow",children:o?.message})}),n(sr,{items:r,selectedIndex:i,onSelect:l,onSubmit:d=>e(d)})]})}function He({theme:e}){return s(c,{flexDirection:"column",paddingLeft:1,children:[n(c,{marginBottom:1,children:s(t,{bold:!0,children:["Preview: ",e.name]})}),n(c,{borderStyle:"single",borderColor:"gray",paddingX:1,children:s(c,{flexDirection:"column",children:[n(t,{children:"╭─────────────────────────────────────────────╮"}),s(t,{children:["│ ",n(t,{color:e.colors.secondaryText,children:"1"})," ",s(t,{color:e.colors.text,children:["function greet() ","{"]})," ","│"]}),s(t,{children:["│ ",n(t,{color:e.colors.secondaryText,children:"2"})," ",s(t,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:['- console.log("',n(t,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),'");']})," ","│"]}),s(t,{children:["│ ",n(t,{color:e.colors.secondaryText,children:"2"})," ",s(t,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:['+ console.log("',n(t,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),'");']})," ","│"]}),n(t,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),s(t,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),s(t,{children:[n(t,{color:e.colors.warning,children:"│ "}),n(t,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),s(t,{color:e.colors.warning,children:[" ","│"]})]}),n(t,{color:e.colors.claude,children:"╭─────────────────────────────────────────────╮"}),s(t,{children:[n(t,{color:e.colors.claude,children:"│ "}),n(t,{color:e.colors.claude,children:"✻"}),n(t,{children:" Welcome to Tweak Claude Code!"}),s(t,{color:e.colors.claude,children:[" ","│"]})]}),s(t,{children:[n(t,{color:e.colors.claude,children:"│"}),s(t,{color:e.colors.secondaryText,italic:!0,children:[" ","/help for help, /status for your current set"]}),n(t,{color:e.colors.claude,children:"│"})]}),s(t,{color:e.colors.success,children:["Login successful. Press ",n(t,{bold:!0,children:"Enter"})," to continue…"]}),n(t,{color:e.colors.bashBorder,children:"╭─────────────────────────────────────────────╮"}),s(t,{children:[n(t,{color:e.colors.bashBorder,children:"│ !"}),s(t,{children:[" ls"," "]}),n(t,{color:e.colors.bashBorder,children:"│"})]}),n(t,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),s(t,{children:[n(t,{color:e.colors.planMode,children:"│ "}),n(t,{color:e.colors.permission,children:"Ready to code?"}),s(t,{color:e.colors.planMode,children:[" ","│"]})]}),s(t,{children:[n(t,{color:e.colors.planMode,children:"│ "}),n(t,{children:"Here is Claude's plan:"}),s(t,{color:e.colors.planMode,children:[" ","│"]})]}),n(t,{color:e.colors.secondaryBorder,children:"╭─────────────────────────────────────────────╮"}),s(t,{children:[n(t,{color:e.colors.secondaryBorder,children:"│"})," ",s(t,{color:e.colors.secondaryText,children:["> Try “refactor <filepath>”"," ","│"]})]}),n(t,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),s(t,{children:[s(t,{color:e.colors.permission,children:["│ ",n(t,{bold:!0,children:"Permissions:"})]})," ",s(t,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",n(t,{color:e.colors.permission,children:"│"})]}),n(t,{color:e.colors.secondaryText,children:"> list the dir"}),s(t,{children:[n(t,{color:e.colors.error,children:"●"}),n(t,{children:" Update(__init__.py)"})]}),s(t,{children:[n(t,{children:" ⎿ "}),n(t,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),s(t,{children:[" ",n(t,{color:e.colors.secondaryText,children:"1"})," ",s(t,{backgroundColor:e.colors.diffRemovedDimmed,color:e.colors.text,children:["- import"," ",n(t,{backgroundColor:e.colors.diffRemovedWordDimmed,color:e.colors.text,children:"os"})]})]}),s(t,{children:[" ",n(t,{color:e.colors.secondaryText,children:"2"})," ",s(t,{backgroundColor:e.colors.diffAddedDimmed,color:e.colors.text,children:["+ import"," ",n(t,{backgroundColor:e.colors.diffAddedWordDimmed,color:e.colors.text,children:"random"})]})]}),s(t,{children:[n(t,{color:e.colors.success,children:"●"}),n(t,{children:" List(.)"})]}),n(t,{children:" ⎿ Listed 123 paths (ctrl+r to expand)"}),s(t,{children:[n(t,{color:e.colors.secondaryText,children:"●"}),n(t,{children:" The directory "}),n(t,{color:e.colors.permission,children:"C:\\Users\\user"}),s(t,{children:[" ","contains ",n(t,{bold:!0,children:"123"})," files."]})]}),s(t,{children:[s(t,{color:e.colors.claude,children:["✻ Th",n(t,{color:e.colors.claudeShimmer,children:"ink"}),"ing…"," "]}),n(t,{color:e.colors.secondaryText,children:"(10s · ↑ 456 tokens · esc to interrupt)"})]}),s(t,{children:[s(t,{color:e.colors.autoAccept,children:["⏵⏵ auto-accept edits on"," "]}),n(t,{color:e.colors.secondaryText,dimColor:!0,children:"(shift+tab to cycle)"})]}),s(t,{children:[n(t,{color:e.colors.planMode,children:"⏸ plan mode on "}),n(t,{color:e.colors.secondaryText,dimColor:!0,children:"(shift+tab to cycle)"})]}),n(t,{children:n(t,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Ue({colorKey:e,theme:o,bold:r=!1}){const i=o.colors[e];return e==="inverseText"?n(t,{color:i,backgroundColor:o.colors.permission,bold:r,children:e}):e.startsWith("diff")?n(t,{backgroundColor:i,bold:r,color:o.colors.text,children:e}):n(t,{color:i,bold:r,children:e})}let Je=!1;const ie=()=>Je,gr=()=>{Je=!0};function Te(){try{const e=Ie.join(ye.homedir(),".claude.json");return JSON.parse(ze.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function Ge(e){if(process.platform==="win32")Ae.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Ae.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const o=Ie.dirname(e);Ae.spawn("xdg-open",[o],{detached:!0,stdio:"ignore"}).unref()}}function Le(e){if(!e||typeof e!="string")return!1;const o=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(o))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(o)){const r=o.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const[,i,l,d]=r;return parseInt(i)<=255&&parseInt(l)<=255&&parseInt(d)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(o)){const r=o.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const[,i,l,d]=r;return parseInt(i)<=360&&parseInt(l)<=100&&parseInt(d)<=100}}return!1}function Xe(e){if(!Le(e))return e;const o=e.trim();if(o.startsWith("rgb("))return o;if(o.startsWith("#")){let r=o.slice(1);r.length===3&&(r=r.split("").map(h=>h+h).join(""));const i=parseInt(r.slice(0,2),16),l=parseInt(r.slice(2,4),16),d=parseInt(r.slice(4,6),16);return`rgb(${i},${l},${d})`}if(o.startsWith("hsl(")){const r=o.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const i=parseInt(r[1])/360,l=parseInt(r[2])/100,d=parseInt(r[3])/100,h=(_,v,B)=>(B<0&&(B+=1),B>1&&(B-=1),B<1/6?_+(v-_)*6*B:B<1/2?v:B<2/3?_+(v-_)*(2/3-B)*6:_),g=d<.5?d*(1+l):d+l-d*l,p=2*d-g,a=Math.round(h(p,g,i+1/3)*255),I=Math.round(h(p,g,i)*255),D=Math.round(h(p,g,i-1/3)*255);return`rgb(${a},${I},${D})`}}return e}async function ur(e,o="sha256",r=64*1024){return new Promise((i,l)=>{const d=ir.createHash(o),h=ze.createReadStream(e,{highWaterMark:r});h.on("data",g=>{d.update(g)}),h.on("end",()=>{i(d.digest("hex"))}),h.on("error",g=>{l(g)})})}const Ve=(e,o,r,i,l,d,h,g)=>{let p=e;return o&&(p+=`.rgb(${o})`),r&&r!=="transparent"&&(p+=`.bgRgb(${r})`),i&&(p+=".bold"),l&&(p+=".italic"),d&&(p+=".underline"),h&&(p+=".strikethrough"),g&&(p+=".inverse"),p};function Ke({initialValue:e,onColorChange:o,onExit:r,colorKey:i,theme:l}){const d=Ne(e)||{h:0,s:50,l:50},h=De(e)||{r:128,g:128,b:128},[g,p]=M(d),[a,I]=M(h),[D,_]=M("hsl"),[v,B]=M("h"),[k,T]=M(!1),[R,P]=M(!1);se(()=>{const b=Ne(e),f=De(e);b&&f&&(T(!0),p(b),I(f),T(!1))},[e]),se(()=>{if(!k&&R){const b=`rgb(${a.r},${a.g},${a.b})`;o(b)}},[g,a,k,R]),se(()=>{P(!0)},[]);const J=b=>{if(Le(b)){const f=Xe(b),m=Ne(f),C=De(f);m&&C&&(T(!0),p(m),I(C),T(!1))}};de((b,f)=>{if(b.length>1&&!f.ctrl&&!f.meta){J(b);return}if(f.return)r();else if(f.escape)r();else if(f.ctrl&&b==="a")_(m=>m==="hsl"?"rgb":"hsl"),B(m=>D==="hsl"?m==="h"?"r":m==="s"?"g":"b":m==="r"?"h":m==="g"?"s":"l");else if(f.upArrow)B(D==="hsl"?m=>m==="h"?"l":m==="s"?"h":"s":m=>m==="r"?"b":m==="g"?"r":"g");else if(f.downArrow||f.tab)B(D==="hsl"?m=>m==="h"?"s":m==="s"?"l":"h":m=>m==="r"?"g":m==="g"?"b":"r");else if(f.leftArrow){const m=f.shift||f.ctrl||f.meta?-10:-1;z(m)}else if(f.rightArrow){const m=f.shift||f.ctrl||f.meta?10:1;z(m)}});const z=b=>{T(!0),D==="hsl"?p(f=>{const m={...f};v==="h"?m.h=Math.max(0,Math.min(359,f.h+b)):v==="s"?m.s=Math.max(0,Math.min(100,f.s+b)):v==="l"&&(m.l=Math.max(0,Math.min(100,f.l+b)));const[C,u,w]=X(m.h,m.s,m.l);return I({r:C,g:u,b:w}),m}):I(f=>{const m={...f};v==="r"?m.r=Math.max(0,Math.min(255,f.r+b)):v==="g"?m.g=Math.max(0,Math.min(255,f.g+b)):v==="b"&&(m.b=Math.max(0,Math.min(255,f.b+b)));const C=W(m.r,m.g,m.b);return p(C),m}),T(!1)},W=(b,f,m)=>{const C=b/255,u=f/255,w=m/255,$=Math.max(C,u,w),S=Math.min(C,u,w),E=$-S,Z=($+S)/2;let oe=0;E!==0&&(oe=Z>.5?E/(2-$-S):E/($+S));let te=0;return E!==0&&($===C?te=((u-w)/E+(u<w?6:0))/6:$===u?te=((w-C)/E+2)/6:te=((C-u)/E+4)/6),{h:Math.round(te*360),s:Math.round(oe*100),l:Math.round(Z*100)}},X=(b,f,m)=>{b/=360,f/=100,m/=100;const C=(1-Math.abs(2*m-1))*f,u=C*(1-Math.abs(b*6%2-1)),w=m-C/2;let $=0,S=0,E=0;return 0<=b&&b<1/6?($=C,S=u,E=0):1/6<=b&&b<2/6?($=u,S=C,E=0):2/6<=b&&b<3/6?($=0,S=C,E=u):3/6<=b&&b<4/6?($=0,S=u,E=C):4/6<=b&&b<5/6?($=u,S=0,E=C):5/6<=b&&b<1&&($=C,S=0,E=u),[Math.round(($+w)*255),Math.round((S+w)*255),Math.round((E+w)*255)]},F=()=>{const b=[],f=[[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 m=0;m<40;m++){const u=m/39*(f.length-1),w=Math.floor(u),$=Math.ceil(u),S=u-w,[E,Z,oe]=f[w],[te,L,N]=f[$],O=Math.round(E+(te-E)*S),H=Math.round(Z+(L-Z)*S),U=Math.round(oe+(N-oe)*S);b.push(n(t,{backgroundColor:`rgb(${O},${H},${U})`,children:" "},m))}return b},K=()=>{const b=[];for(let f=0;f<40;f++){const m=f/39*100,[C,u,w]=X(g.h,m,g.l);b.push(n(t,{backgroundColor:`rgb(${C},${u},${w})`,children:" "},f))}return b},A=()=>{const b=[];for(let f=0;f<40;f++){const m=f/39*100,[C,u,w]=X(g.h,g.s,m);b.push(n(t,{backgroundColor:`rgb(${C},${u},${w})`,children:" "},f))}return b},y=()=>{const[b,f,m]=X(g.h,g.s,g.l);return`rgb(${b},${f},${m})`},x=(b,f,m)=>{const C=u=>u.toString(16).padStart(2,"0");return`#${C(b)}${C(f)}${C(m)}`},G=()=>{const b=[];for(let f=0;f<40;f++){const m=Math.round(f/39*255);b.push(n(t,{backgroundColor:`rgb(${m},${a.g},${a.b})`,children:" "},f))}return b},V=()=>{const b=[];for(let f=0;f<40;f++){const m=Math.round(f/39*255);b.push(n(t,{backgroundColor:`rgb(${a.r},${m},${a.b})`,children:" "},f))}return b},Q=()=>{const b=[];for(let f=0;f<40;f++){const m=Math.round(f/39*255);b.push(n(t,{backgroundColor:`rgb(${a.r},${a.g},${m})`,children:" "},f))}return b},j=(b,f)=>Math.round(b/f*39);return s(c,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[s(c,{flexDirection:"column",children:[n(t,{bold:!0,children:"Color Picker"}),s(c,{marginBottom:1,flexDirection:"column",children:[n(t,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),n(t,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),n(t,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),n(t,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),n(t,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),n(t,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),D==="hsl"?s(ce,{children:[s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:v==="h"?"yellow":"white",children:[v==="h"?"❯ ":" ","Hue (",g.h,"°):"]})}),n(c,{children:F().map((b,f)=>n(me,{children:f===j(g.h,360)?n(t,{children:"|"}):b},f))})]}),s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:v==="s"?"yellow":"white",children:[v==="s"?"❯ ":" ","Saturation (",g.s,"%):"]})}),n(c,{children:K().map((b,f)=>n(me,{children:f===j(g.s,100)?n(t,{children:"|"}):b},f))})]}),s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:v==="l"?"yellow":"white",children:[v==="l"?"❯ ":" ","Lightness (",g.l,"%):"]})}),n(c,{children:A().map((b,f)=>n(me,{children:f===j(g.l,100)?n(t,{children:"|"}):b},f))})]})]}):s(ce,{children:[s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:v==="r"?"yellow":"white",children:[v==="r"?"❯ ":" ","Red (",a.r,"):"]})}),n(c,{children:G().map((b,f)=>n(me,{children:f===j(a.r,255)?n(t,{children:"|"}):b},f))})]}),s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:v==="g"?"yellow":"white",children:[v==="g"?"❯ ":" ","Green (",a.g,"):"]})}),n(c,{children:V().map((b,f)=>n(me,{children:f===j(a.g,255)?n(t,{children:"|"}):b},f))})]}),s(c,{marginBottom:1,children:[n(c,{width:25,children:s(t,{color:v==="b"?"yellow":"white",children:[v==="b"?"❯ ":" ","Blue (",a.b,"):"]})}),n(c,{children:Q().map((b,f)=>n(me,{children:f===j(a.b,255)?n(t,{children:"|"}):b},f))})]})]}),s(c,{marginBottom:1,children:[n(t,{children:"Current: "}),n(t,{backgroundColor:y(),children:" "})]}),s(c,{flexDirection:"row",justifyContent:"space-between",children:[s(c,{flexDirection:"column",children:[n(t,{dimColor:!0,children:"Hex "}),i?.startsWith("diff")?n(t,{backgroundColor:y(),color:l?.colors?.text||"white",bold:!0,children:x(a.r,a.g,a.b)}):i==="inverseText"?n(t,{color:y(),backgroundColor:l?.colors?.permission,bold:!0,children:x(a.r,a.g,a.b)}):n(t,{color:y(),bold:!0,children:x(a.r,a.g,a.b)})]}),s(c,{flexDirection:"column",children:[n(t,{dimColor:!0,children:"RGB "}),i?.startsWith("diff")?n(t,{backgroundColor:y(),color:l?.colors?.text||"white",bold:!0,children:`rgb(${a.r}, ${a.g}, ${a.b})`}):i==="inverseText"?n(t,{color:y(),backgroundColor:l?.colors?.permission,bold:!0,children:`rgb(${a.r}, ${a.g}, ${a.b})`}):n(t,{color:y(),bold:!0,children:`rgb(${a.r}, ${a.g}, ${a.b})`})]}),s(c,{flexDirection:"column",children:[n(t,{dimColor:!0,children:"HSL "}),i?.startsWith("diff")?n(t,{backgroundColor:y(),color:l?.colors?.text||"white",bold:!0,children:`hsl(${g.h}, ${g.s}%, ${g.l}%)`}):i==="inverseText"?n(t,{color:y(),backgroundColor:l?.colors?.permission,bold:!0,children:`hsl(${g.h}, ${g.s}%, ${g.l}%)`}):n(t,{color:y(),bold:!0,children:`hsl(${g.h}, ${g.s}%, ${g.l}%)`})]})]})]})}function De(e){const o=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(o)return{r:parseInt(o[1]),g:parseInt(o[2]),b:parseInt(o[3])};const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const i=r[1];return{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16)}}return null}function Ne(e){const o=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(o)return{h:parseInt(o[1]),s:parseInt(o[2]),l:parseInt(o[3])};const r=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const l=parseInt(r[1])/255,d=parseInt(r[2])/255,h=parseInt(r[3])/255,g=Math.max(l,d,h),p=Math.min(l,d,h),a=g-p,I=(g+p)/2;let D=0;a!==0&&(D=I>.5?a/(2-g-p):a/(g+p));let _=0;return a!==0&&(g===l?_=((d-h)/a+(d<h?6:0))/6:g===d?_=((h-l)/a+2)/6:_=((l-d)/a+4)/6),{h:Math.round(_*360),s:Math.round(D*100),l:Math.round(I*100)}}const i=e.match(/^#([a-fA-F0-9]{6})$/);if(i){const l=i[1],d=parseInt(l.substr(0,2),16)/255,h=parseInt(l.substr(2,2),16)/255,g=parseInt(l.substr(4,2),16)/255,p=Math.max(d,h,g),a=Math.min(d,h,g),I=p-a,D=(p+a)/2;let _=0;I!==0&&(_=D>.5?I/(2-p-a):I/(p+a));let v=0;return I!==0&&(p===d?v=((h-g)/I+(h<g?6:0))/6:p===h?v=((g-d)/I+2)/6:v=((d-h)/I+4)/6),{h:Math.round(v*360),s:Math.round(_*100),l:Math.round(D*100)}}return{h:0,s:50,l:50}}function fr({onBack:e,themeId:o}){const{settings:{themes:r},updateSettings:i}=ue(ge),[l,d]=M(o),h=r.find(A=>A.id===l)||r[0],[g,p]=M("rgb"),[a,I]=M(0),[D,_]=M(null),[v,B]=M(null),[k,T]=M(""),[R,P]=M(""),J=Ye(A=>{i(y=>{const x=y.themes.findIndex(G=>G.id===l);x!==-1&&A(y.themes[x])})},[l,i]),z=A=>{if(a>=2&&Le(A)){const y=Xe(A),x=a-2,G=W[x];J(V=>{V.colors[G]=y})}};de((A,y)=>{if(D===null&&v===null){if(A.length>1&&!y.ctrl&&!y.meta){z(A);return}if(y.escape)e();else if(y.ctrl&&A==="a")p(x=>x==="rgb"?"hex":x==="hex"?"hsl":"rgb");else if(y.upArrow)I(x=>Math.max(0,x-1));else if(y.downArrow)I(x=>Math.min(W.length+1,x+1));else if(y.return)if(a===0)B("name"),T(h.name),P(h.name);else if(a===1)B("id"),T(h.id),P(h.id);else{const x=a-2,G=W[x],V=h.colors[G];_(x),T(V),P(V)}}else if(D!==null)y.ctrl&&A==="a"&&p(x=>x==="rgb"?"hex":x==="hex"?"hsl":"rgb");else if(v!==null)if(y.return){if(v==="id"){const x=l;d(k),i(G=>{const V=G.themes.findIndex(Q=>Q.id===x);V!==-1&&(G.themes[V].id=k)})}else J(x=>{x.name=k});B(null),T(""),P("")}else y.escape?(B(null),T(""),P("")):y.backspace||y.delete?T(x=>x.slice(0,-1)):A&&T(x=>x+A)});const W=Object.keys(h.colors),X=(A,y)=>{const x=A.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!x)return A;const G=parseInt(x[1]),V=parseInt(x[2]),Q=parseInt(x[3]);switch(y){case"hex":{const j=b=>b.toString(16).padStart(2,"0");return`#${j(G)}${j(V)}${j(Q)}`}case"hsl":{const j=G/255,b=V/255,f=Q/255,m=Math.max(j,b,f),C=Math.min(j,b,f),u=m-C,w=(m+C)/2;let $=0;u!==0&&($=w>.5?u/(2-m-C):u/(m+C));let S=0;return u!==0&&(m===j?S=((b-f)/u+(b<f?6:0))/6:m===b?S=((f-j)/u+2)/6:S=((j-b)/u+4)/6),`hsl(${Math.round(S*360)}, ${Math.round($*100)}%, ${Math.round(w*100)}%)`}case"rgb":default:return A}},F=A=>({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.",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",secondaryText:"Secondary/dimmed text. Used for keyboard shortcuts and other help text.",secondaryBorder:"Secondary border color. Used for various boxes.",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.",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",autoAccept:"Auto-accept mode indicator",bashBorder:"Bash command border",permission:"Permission prompt color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",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"})[A]||"",K=Math.max(...W.map(A=>A.length));return s(c,{children:[s(c,{flexDirection:"column",width:"50%",children:[n(c,{children:s(he,{children:["Editing theme “",h.name,"” (",h.id,")"]})}),D===null&&v===null?s(ce,{children:[s(c,{marginBottom:1,flexDirection:"column",children:[n(t,{dimColor:!0,children:"enter to edit theme name, id, or color"}),n(t,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),n(t,{dimColor:!0,children:"paste color from clipboard (when on color)"}),n(t,{dimColor:!0,children:"esc to go back"})]}),a<2?s(c,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[n(t,{bold:!0,children:a===0?"Theme Name":"Theme ID"}),n(t,{children:a===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):s(c,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:h.colors[W[a-2]],flexDirection:"column",paddingLeft:1,children:[n(Ue,{colorKey:W[a-2],theme:h,bold:!0}),n(t,{children:F(W[a-2])})]}),s(c,{flexDirection:"column",children:[s(c,{children:[n(t,{color:a===0?"yellow":"white",children:a===0?"❯ ":" "}),n(t,{bold:!0,children:"Name: "}),n(t,{children:h.name})]}),s(c,{marginBottom:1,children:[n(t,{color:a===1?"yellow":"white",children:a===1?"❯ ":" "}),n(t,{bold:!0,children:"ID: "}),n(t,{children:h.id})]}),W.map((A,y)=>{const x=y+2;return s(c,{children:[n(t,{color:a===x?"yellow":"white",children:a===x?"❯ ":" "}),n(c,{width:K+2,children:n(t,{children:n(Ue,{colorKey:A,theme:h,bold:!0})})}),n(t,{color:h.colors[A],children:X(h.colors[A],g)})]},A)})]})]}):v?s(c,{flexDirection:"column",marginTop:1,children:[s(t,{children:["Editing ",v==="name"?"theme name":"theme ID",":"]}),n(c,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:n(t,{children:k})}),n(t,{dimColor:!0,children:"enter to save, esc to cancel"})]}):n(Ke,{initialValue:R,colorKey:W[D],theme:h,onColorChange:A=>{T(A),J(y=>{y.colors[W[D]]=A})},onExit:()=>{J(A=>{A.colors[W[D]]=k}),_(null),T(""),P("")}})]}),n(c,{width:"50%",children:n(He,{theme:h})})]})}function mr(e){return e.map(o=>`${o.name} (${o.id})`)}function pr({onBack:e}){const{settings:{themes:o},updateSettings:r}=ue(ge),[i,l]=M(0),[d,h]=M(null),[g,p]=M(!0),a=()=>{const k={colors:{...(o[0]||q.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};r(T=>{T.themes.push(k)}),h(k.id),p(!1)},I=B=>{o.length<=1||(r(k=>{k.themes=k.themes.filter(T=>T.id!==B)}),i>=o.length-1&&l(Math.max(0,o.length-2)))},D=()=>{r(B=>{B.themes=[...q.themes]}),l(0)};if(de((B,k)=>{if(k.escape)e();else if(k.upArrow)l(T=>Math.max(0,T-1));else if(k.downArrow)l(T=>Math.min(o.length-1,T+1));else if(k.return){const T=o[i];T&&(h(T.id),p(!1))}else if(B==="n")a();else if(B==="d"){const T=o[i];T&&I(T.id)}else k.ctrl&&B==="r"&&D()},{isActive:g}),d)return n(fr,{themeId:d,onBack:()=>{h(null),p(!0)}});const _=mr(o),v=o.find(B=>_[i]?.includes(`(${B.id})`))||o[0];return o.length===0?n(c,{children:s(c,{flexDirection:"column",width:"100%",children:[n(he,{children:"Themes"}),s(c,{marginBottom:1,flexDirection:"column",children:[n(t,{dimColor:!0,children:"n to create a new theme"}),n(t,{dimColor:!0,children:"esc to go back"})]}),n(t,{children:"No themes available!"})]})}):s(c,{children:[s(c,{flexDirection:"column",width:"50%",children:[n(he,{children:"Themes"}),s(c,{marginBottom:1,flexDirection:"column",children:[n(t,{dimColor:!0,children:"n to create a new theme"}),n(t,{dimColor:!0,children:"d to delete a theme"}),n(t,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),n(t,{dimColor:!0,children:"enter to edit theme"}),n(t,{dimColor:!0,children:"esc to go back"})]}),n(c,{flexDirection:"column",children:_.map((B,k)=>s(t,{color:i===k?"yellow":void 0,children:[i===k?"❯ ":" ",B]},k))})]}),n(c,{width:"50%",children:n(He,{theme:v})})]})}let Oe=["ANSI Shadow"];function br({onBack:e}){const{stdout:o}=rr(),r=o?.columns||120,{settings:{launchText:{method:i,figletText:l,figletFont:d,customText:h},themes:g},updateSettings:p}=ue(ge),a=i==="figlet"?["method","text","font"]:["method","text"],[I,D]=M(0),_=a[I],[v,B]=M(i==="figlet"?0:1),[k,T]=M(Oe),[R,P]=M(Oe),[J,z]=M(""),[W,X]=M(!1),[F,K]=M(0),[A,y]=M(""),[x,G]=M(50),[V,Q]=M(!1),[j,b]=M(i==="figlet"?l:h),f=Te(),C=(g.find(w=>w.id===f)||g.find(w=>w.id==="dark"))?.colors.claude||"rgb(215,119,87)";se(()=>{Be.fonts((w,$)=>{if(!w&&$){const S=$.sort();T(S),P(S),Oe=S;const E=S.indexOf(d);K(E>=0?E:S.indexOf("ANSI Shadow")||0)}})},[]),se(()=>{u()},[i,l,d,h,j,V]);const u=()=>{if(i==="figlet")try{const w=V?j:l,$=Be.textSync(w.replace(`
3
+ `," "),{font:d}),S=Math.floor(r*.7),Z=$.split(`
4
+ `).map(N=>N.length>S?N.substring(0,S-3)+"…":N),oe=Z.join(`
5
+ `);y(oe);const te=Math.max(...Z.map(N=>N.length)),L=Math.min(75,Math.max(50,Math.ceil(te/r*100)));G(L+5)}catch{y("Error generating figlet text"),G(50)}else{const w=Math.floor(r*.6),E=(V?j:h).split(`
6
+ `).map(L=>L.length>w?L.substring(0,w-3)+"...":L),Z=E.join(`
7
+ `);y(Z);const oe=Math.max(...E.map(L=>L.length)),te=Math.min(75,Math.max(50,Math.ceil(oe/r*100)));G(te+5)}};return se(()=>{if(J){const w=k.filter($=>$.toLowerCase().includes(J.toLowerCase()));P(w),K(0)}else{P(k);const w=k.indexOf(d);K(w>=0?w:0)}},[J,k]),se(()=>{if(!W){const w=R.indexOf(d);w>=0&&K(w)}},[d,R,W]),de((w,$)=>{if(V){$.return?(p(i==="figlet"?S=>{S.launchText.figletText=j}:S=>{S.launchText.customText=j}),Q(!1)):$.escape?(b(i==="figlet"?l:h),Q(!1)):$.backspace||$.delete?b(S=>S.slice(0,-1)):w&&b(S=>S+w);return}if(W){if($.return)R.length>0&&p(S=>{S.launchText.figletFont=R[F]}),X(!1),z("");else if($.escape)X(!1),z("");else if($.backspace||$.delete)z(S=>S.slice(0,-1));else if($.upArrow){const S=F>0?F-1:R.length-1;K(S),R.length>0&&p(E=>{E.launchText.figletFont=R[S]})}else if($.downArrow){const S=F<R.length-1?F+1:0;K(S),R.length>0&&p(E=>{E.launchText.figletFont=R[S]})}else w&&w.match(/^[a-zA-Z0-9\s\-_]$/)&&z(S=>S+w);return}if($.escape)e();else if($.return)_==="text"&&(b(i==="figlet"?l:h),Q(!0));else if($.tab)$.shift?D(S=>S===0?a.length-1:S-1):D(S=>S===a.length-1?0:S+1);else if($.upArrow){if(_==="method"){const S=v>0?v-1:1;B(S),p(E=>{E.launchText.method=S===0?"figlet":"custom"})}else if(_==="font"&&i==="figlet"){const S=F>0?F-1:R.length-1;K(S),p(E=>{E.launchText.figletFont=R[S]})}}else if($.downArrow){if(_==="method"){const S=v<1?v+1:0;B(S),p(E=>{E.launchText.method=S===0?"figlet":"custom"})}else if(_==="font"&&i==="figlet"){const S=F<R.length-1?F+1:0;K(S),p(E=>{E.launchText.figletFont=R[S]})}}else w&&_==="font"&&i==="figlet"&&w.match(/^[a-zA-Z0-9]$/)&&(X(!0),z(w))}),s(c,{children:[s(c,{flexDirection:"column",width:`${100-x}%`,children:[s(c,{marginBottom:1,flexDirection:"column",children:[n(he,{children:"Setup banner"}),s(c,{flexDirection:"column",children:[s(t,{dimColor:!0,children:["enter to ",_==="text"?"edit text":"save"]}),n(t,{dimColor:!0,children:"esc to go back"}),n(t,{dimColor:!0,children:"tab to switch sections"})]})]}),n(c,{children:s(t,{children:[n(t,{color:_==="method"?"yellow":void 0,children:_==="method"?"❯ ":" "}),n(t,{bold:!0,color:_==="method"?"yellow":void 0,children:"Method"})]})}),_==="method"&&s(t,{dimColor:!0,children:[" ","select one of ",R.length," Figlet fonts or enter your own text"]}),n(c,{marginLeft:2,marginBottom:1,children:s(c,{flexDirection:"column",children:[s(t,{color:v===0?"cyan":"white",children:[v===0?"❯ ":" ","Figlet"]}),s(t,{color:v===1?"cyan":"white",children:[v===1?"❯ ":" ","Custom"]})]})}),s(c,{flexDirection:"column",children:[s(t,{children:[n(t,{color:_==="text"?"yellow":void 0,children:_==="text"?"❯ ":" "}),n(t,{bold:!0,color:_==="text"?"yellow":void 0,children:"Text"})]}),_==="text"&&(V?s(t,{dimColor:!0,children:[" ","esc to save"]}):s(t,{dimColor:!0,children:[" ","enter to edit"]}))]}),n(c,{marginLeft:2,marginBottom:1,children:n(c,{borderStyle:"round",borderColor:V?"yellow":"gray",children:n(t,{children:V?j:i==="figlet"?l:h})})}),i==="figlet"&&s(ce,{children:[n(c,{children:s(c,{flexDirection:"column",children:[s(t,{children:[n(t,{color:_==="font"?"yellow":void 0,children:_==="font"?"❯ ":" "}),n(t,{bold:!0,color:_==="font"?"yellow":void 0,children:"Font"})]}),_==="font"&&s(t,{dimColor:!0,children:[" ","type to filter"]}),n(t,{children:W&&s(t,{color:"gray",dimColor:!0,children:[" ","(filtering: “",J,"”)"]})})]})}),n(c,{marginLeft:2,marginBottom:1,children:n(c,{flexDirection:"column",children:(()=>{const $=Math.max(0,F-Math.floor(4)),S=Math.min(R.length,$+8),E=Math.max(0,S-8),Z=R.slice(E,S);return s(ce,{children:[E>0&&s(t,{color:"gray",dimColor:!0,children:[" ","↑ ",E," more above"]}),Z.map((oe,te)=>{const L=E+te;return s(t,{color:F===L?"cyan":void 0,children:[F===L?"❯ ":" ",oe]},oe)}),S<R.length&&s(t,{color:"gray",dimColor:!0,children:[" ","↓ ",R.length-S," more below"]})]})})()})})]})]}),s(c,{width:`${x}%`,flexDirection:"column",children:[n(c,{marginBottom:1,children:n(t,{bold:!0,children:"Preview"})}),s(c,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:[s(c,{flexDirection:"column",marginBottom:1,children:[n(t,{color:C,children:"╭──────────────────────────╮"}),s(t,{children:[n(t,{color:C,children:"│ ✻"})," Welcome to Claude Code"," ",n(t,{color:C,children:"│"})]}),n(t,{color:C,children:"╰──────────────────────────╯"})]}),A.split(`
8
+ `).map((w,$)=>n(t,{color:C,children:w},$)),n(c,{marginTop:1,children:n(t,{wrap:"truncate-end",children:"Claude Code can now be used with your Claude subscription or billed based on API usage through your Console account."})})]})]})]})}function xr({onBack:e}){const{settings:{thinkingVerbs:{format:o,verbs:r},themes:i},updateSettings:l}=ue(ge),d=["format","verbs"],[h,g]=M(0),p=d[h],[a,I]=M(0),[D,_]=M(!1),[v,B]=M(""),[k,T]=M(!1),[R,P]=M(!1),[J,z]=M(o),W=Te(),X=i.find(A=>A.id===W)||i.find(A=>A.id==="dark"),F=X?.colors.claude||"rgb(215,119,87)";de((A,y)=>{if(R){y.return?(l(x=>{x.thinkingVerbs.format=J}),P(!1)):y.escape?(z(o),P(!1)):y.backspace||y.delete?z(x=>x.slice(0,-1)):A&&z(x=>x+A);return}if(D||k){y.return&&v.trim()?(k?(l(x=>{x.thinkingVerbs.verbs.push(v.trim())}),T(!1)):(l(x=>{x.thinkingVerbs.verbs[a]=v.trim()}),_(!1)),B("")):y.escape?(B(""),_(!1),T(!1)):y.backspace||y.delete?B(x=>x.slice(0,-1)):A&&B(x=>x+A);return}y.escape?e():y.return?p==="format"&&(z(o),P(!0)):y.tab?y.shift?g(x=>x===0?d.length-1:x-1):g(x=>x===d.length-1?0:x+1):y.upArrow?p==="verbs"&&r.length>0&&I(x=>x>0?x-1:r.length-1):y.downArrow?p==="verbs"&&r.length>0&&I(x=>x<r.length-1?x+1:0):A==="e"&&p==="verbs"?r.length>0&&(B(r[a]),_(!0)):A==="d"&&p==="verbs"?r.length>1&&(l(x=>{x.thinkingVerbs.verbs=x.thinkingVerbs.verbs.filter((G,V)=>V!==a)}),a>=r.length-1&&I(Math.max(0,r.length-2))):A==="n"&&p==="verbs"?(T(!0),B("")):y.ctrl&&A==="r"&&p==="verbs"&&(l(x=>{x.thinkingVerbs.verbs=[...q.thinkingVerbs.verbs]}),I(0))});const K=50;return s(c,{children:[s(c,{flexDirection:"column",width:`${100-K}%`,children:[s(c,{marginBottom:1,flexDirection:"column",children:[n(he,{children:"Thinking Verbs"}),s(c,{flexDirection:"column",children:[n(t,{dimColor:!0,children:p==="format"?"enter to edit format":"changes auto-saved"}),n(t,{dimColor:!0,children:"esc to go back"}),n(t,{dimColor:!0,children:"tab to switch sections"})]})]}),n(c,{marginBottom:1,children:n(t,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),s(c,{flexDirection:"column",children:[s(t,{children:[n(t,{color:p==="format"?"yellow":void 0,children:p==="format"?"❯ ":" "}),n(t,{bold:!0,color:p==="format"?"yellow":void 0,children:"Format"})]}),p==="format"&&(R?s(t,{dimColor:!0,children:[" ","enter to save"]}):s(t,{dimColor:!0,children:[" ","enter to edit"]}))]}),n(c,{marginLeft:2,marginBottom:1,children:n(c,{borderStyle:"round",borderColor:R?"yellow":"gray",children:n(t,{children:R?J:o})})}),n(c,{children:s(t,{children:[n(t,{color:p==="verbs"?"yellow":void 0,children:p==="verbs"?"❯ ":" "}),n(t,{bold:!0,color:p==="verbs"?"yellow":void 0,children:"Verbs"})]})}),p==="verbs"&&n(c,{flexDirection:"column",children:s(t,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),n(c,{marginLeft:2,marginBottom:1,children:s(c,{flexDirection:"column",children:[(()=>{const y=Math.max(0,a-Math.floor(4)),x=Math.min(r.length,y+8),G=Math.max(0,x-8),V=r.slice(G,x);return s(ce,{children:[G>0&&s(t,{color:"gray",dimColor:!0,children:[" ","↑ ",G," more above"]}),V.map((Q,j)=>{const b=G+j;return s(t,{color:p==="verbs"&&b===a?"cyan":void 0,children:[p==="verbs"&&b===a?"❯ ":" ",Q]},b)}),x<r.length&&s(t,{color:"gray",dimColor:!0,children:[" ","↓ ",r.length-x," more below"]})]})})(),k&&s(c,{alignItems:"center",children:[n(t,{color:"yellow",children:"❯ "}),n(c,{borderStyle:"round",borderColor:"yellow",children:n(t,{children:v})})]}),D&&s(c,{marginTop:1,alignItems:"center",children:[n(t,{children:"Editing: "}),n(c,{borderStyle:"round",borderColor:"yellow",children:n(t,{children:v})})]})]})})]}),s(c,{width:`${K}%`,flexDirection:"column",children:[n(c,{marginBottom:1,children:n(t,{bold:!0,children:"Preview"})}),n(c,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:s(t,{children:[s(t,{color:F,children:["✻ ",o.replace(/\{\}/g,r[a])," "]}),n(t,{color:X?.colors.secondaryText,children:"(10s · ↑ 456 tokens · esc to interrupt)"})]})})]})]})}const fe=[{name:"Default",phases:q.thinkingStyle.phases,reverseMirror:q.thinkingStyle.reverseMirror},{name:"Basic",phases:["|","/","-","\\"],reverseMirror:!1},{name:"Braille",phases:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],reverseMirror:!1},{name:"Circle",phases:["◐","◓","◑","◒"],reverseMirror:!1},{name:"Wave",phases:["▁","▃","▄","▅","▆","▇","█"],reverseMirror:!0},{name:"Glow",phases:["░","▒","▓","█"],reverseMirror:!0},{name:"Partial block",phases:["▏","▎","▍","▌","▋","▊","▉","█"],reverseMirror:!0},{name:"Clock",phases:["🕛","🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚"],reverseMirror:!1},{name:"Globe",phases:["🌍","🌎","🌏"],reverseMirror:!1},{name:"Arc",phases:["◜","◠","◝","◞","◡","◟"],reverseMirror:!1},{name:"Triangle",phases:["◤","◥","◢","◣"],reverseMirror:!1},{name:"Bouncing",phases:["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"],reverseMirror:!1},{name:"Dots",phases:[".","..","..."],reverseMirror:!1},{name:"Colors",phases:["🔴","🟠","🟡","🟢","🔵","🟣"],reverseMirror:!1}];function wr({onBack:e}){const{settings:{thinkingStyle:{phases:o,updateInterval:r,reverseMirror:i},themes:l},updateSettings:d}=ue(ge),h=["reverseMirror","updateInterval","phases","presets"],[g,p]=M(0),a=h[g],[I,D]=M(0),[_,v]=M(0),[B,k]=M(!1),[T,R]=M(""),[P,J]=M(!1),[z,W]=M(!1),[X,F]=M(r.toString()),[K,A]=M(0),y=Te(),x=l.find(m=>m.id===y)||l.find(m=>m.id==="dark"),G=x?.colors.claude||"rgb(215,119,87)";se(()=>{if(o.length>0){const m=i?[...o,...[...o].reverse().slice(1,-1)]:o,C=setInterval(()=>{A(u=>(u+1)%m.length)},r);return()=>clearInterval(C)}},[o,r,i]),de((m,C)=>{if(z){if(C.return){const u=parseInt(X);!isNaN(u)&&u>0&&d(w=>{w.thinkingStyle.updateInterval=u}),W(!1)}else C.escape?(F(r.toString()),W(!1)):C.backspace||C.delete?F(u=>u.slice(0,-1)):m&&m.match(/^[0-9]$/)&&F(u=>u+m);return}if(B||P){if(C.return&&T.length){const u=P?[...o,T]:o.map((w,$)=>$===I?T:w);d(w=>{w.thinkingStyle.phases=u}),k(!1),R("")}else C.escape?(R(""),k(!1),J(!1)):C.backspace||C.delete?R(u=>u.slice(0,-1)):m&&R(u=>u+m);return}if(C.escape)e();else if(C.return)if(a==="updateInterval")F(r.toString()),W(!0);else if(a==="presets"){const u=fe[_];d(w=>{w.thinkingStyle.phases=[...u.phases],w.thinkingStyle.reverseMirror=u.reverseMirror})}else a==="reverseMirror"&&d(u=>{u.thinkingStyle.reverseMirror=!u.thinkingStyle.reverseMirror});else if(C.tab)C.shift?p(u=>u===0?h.length-1:u-1):p(u=>u===h.length-1?0:u+1);else if(C.upArrow)a==="phases"&&o.length>0?D(u=>u>0?u-1:o.length-1):a==="presets"&&v(u=>u>0?u-1:fe.length-1);else if(C.downArrow)a==="phases"&&o.length>0?D(u=>u<o.length-1?u+1:0):a==="presets"&&v(u=>u<fe.length-1?u+1:0);else if(m===" ")a==="reverseMirror"&&d(u=>{u.thinkingStyle.reverseMirror=!u.thinkingStyle.reverseMirror});else if(m==="e"&&a==="phases")o.length>0&&(R(o[I]),k(!0));else if(m==="a"&&a==="phases")J(!0),R("");else if(m==="d"&&a==="phases")o.length>1&&(d(u=>{u.thinkingStyle.phases=o.filter((w,$)=>$!==I)}),I>=o.length&&D(Math.max(0,o.length-1)));else if(m==="w"&&a==="phases"){if(I>0){const u=[...o];[u[I-1],u[I]]=[u[I],u[I-1]],d(w=>{w.thinkingStyle.phases=u}),D(w=>w-1)}}else if(m==="s"&&a==="phases"){if(I<o.length-1){const u=[...o];[u[I],u[I+1]]=[u[I+1],u[I]],d(w=>{w.thinkingStyle.phases=u}),D(w=>w+1)}}else C.ctrl&&m==="r"&&(d(u=>{u.thinkingStyle=q.thinkingStyle}),D(0),v(0))});const V=i?"●":"○",Q=50,b=i?[...o,...[...o].reverse().slice(1,-1)]:o,f=b.length>0?b[K]:"·";return n(c,{children:s(c,{flexDirection:"column",width:"100%",children:[s(c,{flexDirection:"row",width:"100%",children:[s(c,{marginBottom:1,flexDirection:"column",width:`${100-Q}%`,children:[n(he,{children:"Thinking style"}),s(c,{flexDirection:"column",children:[s(t,{dimColor:!0,children:["enter to"," ",a==="updateInterval"?"edit interval":a==="presets"?"apply preset":"save"]}),n(t,{dimColor:!0,children:"esc to go back"}),n(t,{dimColor:!0,children:"tab to switch sections"})]})]}),s(c,{width:`${Q}%`,flexDirection:"column",children:[n(c,{children:n(t,{bold:!0,children:"Preview"})}),s(c,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[n(c,{width:(f?.length??0)+1,children:n(t,{color:G,children:f})}),s(t,{children:[n(t,{color:G,children:"Thinking… "}),n(t,{color:x?.colors.secondaryText,children:"(esc to interrupt)"})]})]})]})]}),s(c,{flexDirection:"row",gap:4,children:[s(c,{flexDirection:"column",children:[s(t,{children:[n(t,{color:a==="reverseMirror"?"yellow":void 0,children:a==="reverseMirror"?"❯ ":" "}),n(t,{bold:!0,color:a==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),a==="reverseMirror"&&s(t,{dimColor:!0,children:[" ","space to toggle"]}),n(c,{marginLeft:2,marginBottom:1,children:s(t,{children:[V," ",i?"Enabled":"Disabled"]})})]}),s(c,{flexDirection:"column",children:[s(t,{children:[n(t,{color:a==="updateInterval"?"yellow":void 0,children:a==="updateInterval"?"❯ ":" "}),n(t,{bold:!0,color:a==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),a==="updateInterval"&&(z?s(t,{dimColor:!0,children:[" ","enter to save"]}):s(t,{dimColor:!0,children:[" ","enter to edit"]})),n(c,{marginLeft:2,marginBottom:1,children:n(c,{borderStyle:"round",borderColor:z?"yellow":"gray",children:n(t,{children:z?X:r})})})]})]}),n(c,{children:s(t,{children:[n(t,{color:a==="phases"?"yellow":void 0,children:a==="phases"?"❯ ":" "}),n(t,{bold:!0,color:a==="phases"?"yellow":void 0,children:"Phases"})]})}),a==="phases"&&n(c,{marginBottom:1,flexDirection:"column",children:s(t,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),n(c,{marginLeft:2,marginBottom:1,children:s(c,{flexDirection:"column",children:[(()=>{const C=Math.max(0,I-Math.floor(4)),u=Math.min(o.length,C+8),w=Math.max(0,u-8),$=o.slice(w,u);return s(ce,{children:[w>0&&s(t,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),$.map((S,E)=>{const Z=w+E;return s(t,{color:a==="phases"&&Z===I?"cyan":void 0,children:[a==="phases"&&Z===I?"❯ ":" ",S]},Z)}),u<o.length&&s(t,{color:"gray",dimColor:!0,children:[" ","↓ ",o.length-u," more below"]})]})})(),P&&s(c,{children:[n(t,{color:"yellow",children:"❯ "}),n(c,{borderStyle:"round",borderColor:"yellow",children:n(t,{children:T})})]}),B&&s(c,{marginTop:1,children:[n(t,{children:"Editing: "}),n(c,{borderStyle:"round",borderColor:"yellow",children:n(t,{children:T})})]})]})}),n(c,{children:s(t,{children:[n(t,{color:a==="presets"?"yellow":void 0,children:a==="presets"?"❯ ":" "}),n(t,{bold:!0,color:a==="presets"?"yellow":void 0,children:"Presets"})]})}),a==="presets"&&s(t,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),n(c,{marginLeft:2,marginBottom:1,children:n(c,{flexDirection:"column",children:(()=>{const C=Math.max(0,_-Math.floor(4)),u=Math.min(fe.length,C+8),w=Math.max(0,u-8),$=fe.slice(w,u);return s(ce,{children:[w>0&&s(t,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),$.map((S,E)=>{const Z=w+E;return s(t,{color:a==="presets"&&Z===_?"cyan":void 0,children:[a==="presets"&&Z===_?"❯ ":" ",S.name," ",S.phases.join("")]},Z)}),u<fe.length&&s(t,{color:"gray",dimColor:!0,children:[" ","↓ ",fe.length-u," more below"]})]})})()})}),n(c,{marginTop:1,children:n(t,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const we=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function Sr({onBack:e}){const{settings:o,updateSettings:r}=ue(ge),[i,l]=M("prefix"),[d,h]=M(0),[g,p]=M(!1),[a,I]=M(()=>o.userMessageDisplay.prefix.format),[D,_]=M(0),[v,B]=M(()=>[...o.userMessageDisplay.prefix.styling]),[k,T]=M(()=>o.userMessageDisplay.prefix.foreground_color),[R,P]=M(()=>o.userMessageDisplay.prefix.background_color),[J,z]=M(0),[W,X]=M(0),[F,K]=M(()=>[...o.userMessageDisplay.message.styling]),[A,y]=M(()=>o.userMessageDisplay.message.foreground_color),[x,G]=M(()=>o.userMessageDisplay.message.background_color),[V,Q]=M(null),[j,b]=M(""),f=Te(),m=o.themes?.find(L=>L.id===f)||o.themes?.[0],C=["format","styling","foreground","background"],u=["styling","foreground","background"],w=C[d],$=u[J],S=(L,N)=>{r(O=>{const H=L==="prefix"?O.userMessageDisplay.prefix:O.userMessageDisplay.message;N(H)})},E=L=>{r(N=>{L==="prefix"?N.userMessageDisplay.prefix={...q.userMessageDisplay.prefix}:N.userMessageDisplay.message={...q.userMessageDisplay.message}}),L==="prefix"?(I(q.userMessageDisplay.prefix.format),B([...q.userMessageDisplay.prefix.styling]),T(q.userMessageDisplay.prefix.foreground_color),P(q.userMessageDisplay.prefix.background_color)):(K([...q.userMessageDisplay.message.styling]),y(q.userMessageDisplay.message.foreground_color),G(q.userMessageDisplay.message.background_color))};se(()=>{const L=o.userMessageDisplay.prefix;I(L.format),B([...L.styling]),T(L.foreground_color),P(L.background_color);const N=o.userMessageDisplay.message;K([...N.styling]),y(N.foreground_color),G(N.background_color)},[]),de((L,N)=>{if(g){if(N.return)S("prefix",O=>{O.format=a}),p(!1);else if(N.escape){const O=o.userMessageDisplay.prefix;I(O.format),p(!1)}else N.backspace||N.delete?I(O=>O.slice(0,-1)):L&&I(O=>O+L);return}if(V===null){if(N.escape)e();else if(N.ctrl&&L==="r")E(i);else if(N.leftArrow||N.rightArrow)l(O=>O==="prefix"?"message":"prefix");else if(N.tab)i==="prefix"?N.shift?h(O=>O===0?C.length-1:O-1):h(O=>O===C.length-1?0:O+1):N.shift?z(O=>O===0?u.length-1:O-1):z(O=>O===u.length-1?0:O+1);else if(N.return)i==="prefix"?w==="format"?p(!0):w==="foreground"?(b(k),Q({column:"prefix",type:"foreground"})):w==="background"&&(b(R),Q({column:"prefix",type:"background"})):$==="foreground"?(b(A),Q({column:"message",type:"foreground"})):$==="background"&&(b(x),Q({column:"message",type:"background"}));else if(N.upArrow)i==="prefix"&&w==="styling"?_(O=>Math.max(0,O-1)):i==="message"&&$==="styling"&&X(O=>Math.max(0,O-1));else if(N.downArrow)i==="prefix"&&w==="styling"?_(O=>Math.min(we.length-1,O+1)):i==="message"&&$==="styling"&&X(O=>Math.min(we.length-1,O+1));else if(L===" "){if(i==="prefix"&&w==="styling"){const O=we[D].value,H=v.indexOf(O)>=0?v.filter(U=>U!==O):[...v,O];B(H),S("prefix",U=>{U.styling=[...H]})}else if(i==="message"&&$==="styling"){const O=we[W].value,H=F.indexOf(O)>=0?F.filter(U=>U!==O):[...F,O];K(H),S("message",U=>{U.styling=[...H]})}}}});const Z=(L,N,O=!0)=>{const H=O?N==="prefix"?v:F:[],U=O?N==="prefix"?k:A:"rgb(255,255,255)",be=O?N==="prefix"?R:x:"rgb(0,0,0)",xe=U==="rgb(0,0,0)"&&be==="rgb(0,0,0)",Ce=H.length>0;return xe&&!Ce?n(t,{children:L}):n(t,{bold:H.includes("bold"),italic:H.includes("italic"),underline:H.includes("underline"),strikethrough:H.includes("strikethrough"),inverse:H.includes("inverse"),color:xe?void 0:U,backgroundColor:xe?void 0:be,children:L})},oe=(L=!0)=>s(t,{children:[a&&s(ce,{children:[Z(a,"prefix",L)," "]}),Z("list the dir","message",L)]}),te=L=>{const N=i===L,U=(L==="prefix"?C:u)[L==="prefix"?d:J],be=L==="prefix"?D:W,xe=L==="prefix"?v:F,Ce=L==="prefix"?k:A,Re=L==="prefix"?R:x;return s(c,{flexDirection:"column",width:"45%",borderStyle:N?"round":"single",borderColor:N?"yellow":"gray",padding:1,children:[n(c,{marginBottom:1,children:s(t,{bold:!0,color:N?"yellow":void 0,children:[L.charAt(0).toUpperCase()+L.slice(1)," ","Configuration"]})}),L==="prefix"&&s(ce,{children:[n(c,{children:s(t,{color:N&&U==="format"?"yellow":void 0,bold:N&&U==="format",children:[N&&U==="format"?"❯ ":" ","Prefix Text"]})}),N&&U==="format"&&n(c,{marginLeft:2,children:n(t,{dimColor:!0,children:g?"enter to save":"enter to edit (appears before message)"})}),n(c,{marginLeft:2,marginBottom:1,children:n(c,{borderStyle:"round",borderColor:g?"yellow":"gray",children:n(t,{children:a})})})]}),n(c,{children:s(t,{color:N&&U==="styling"?"yellow":void 0,bold:N&&U==="styling",children:[N&&U==="styling"?"❯ ":" ","Styling"]})}),N&&U==="styling"&&n(c,{marginLeft:2,children:n(t,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),n(c,{marginLeft:2,marginBottom:1,flexDirection:"column",children:we.map((Me,Pe)=>n(c,{children:s(t,{color:N&&U==="styling"&&be===Pe?"cyan":void 0,children:[N&&U==="styling"&&be===Pe?"❯ ":" ",xe.includes(Me.value)?"●":"○"," ",Me.label]})},Me.value))}),n(c,{children:s(t,{color:N&&U==="foreground"?"yellow":void 0,bold:N&&U==="foreground",children:[N&&U==="foreground"?"❯ ":" ","Foreground color"]})}),N&&U==="foreground"&&n(c,{marginLeft:2,children:n(t,{dimColor:!0,children:"enter to open color picker"})}),n(c,{marginLeft:2,marginBottom:1,children:n(t,{color:Ce,children:Ce})}),n(c,{children:s(t,{color:N&&U==="background"?"yellow":void 0,bold:N&&U==="background",children:[N&&U==="background"?"❯ ":" ","Background color"]})}),N&&U==="background"&&n(c,{marginLeft:2,children:n(t,{dimColor:!0,children:"enter to open color picker"})}),n(c,{marginLeft:2,children:n(t,{backgroundColor:Re,children:Re})})]})};if(V){const{column:L,type:N}=V;return n(Ke,{initialValue:j,theme:m,onColorChange:O=>{L==="prefix"?N==="foreground"?(T(O),S("prefix",H=>{H.foreground_color=O})):(P(O),S("prefix",H=>{H.background_color=O})):N==="foreground"?(y(O),S("message",H=>{H.foreground_color=O})):(G(O),S("message",H=>{H.background_color=O}))},onExit:()=>{Q(null),b("")}})}return s(c,{flexDirection:"column",children:[n(he,{children:"Customize how user messages are displayed"}),s(c,{flexDirection:"column",marginBottom:1,children:[n(t,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),n(t,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),s(c,{flexDirection:"row",gap:1,children:[te("prefix"),te("message")]}),n(c,{borderStyle:"round",padding:1,marginTop:1,children:s(c,{flexDirection:"column",children:[n(c,{marginBottom:1,children:n(t,{bold:!0,children:"Preview"})}),s(c,{flexDirection:"row",gap:2,children:[s(c,{flexDirection:"column",width:"50%",children:[n(c,{marginBottom:1,children:n(t,{underline:!0,children:"Before (Claude Code default):"})}),n(c,{marginLeft:1,children:n(t,{color:m?.colors?.secondaryText||"#888888",children:"> list the dir"})}),n(c,{marginLeft:1,marginTop:1,children:s(t,{children:[n(t,{color:m?.colors?.secondaryText||"#888888",children:"●"}),n(t,{children:" The directory "}),n(t,{color:m?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),n(t,{children:" contains "}),n(t,{bold:!0,children:"123"}),n(t,{children:" files."})]})})]}),s(c,{flexDirection:"column",width:"50%",children:[n(c,{marginBottom:1,children:n(t,{underline:!0,children:"After (Your customization):"})}),n(c,{marginLeft:1,children:oe(!0)}),n(c,{marginLeft:1,marginTop:1,children:s(t,{children:[n(t,{color:m?.colors?.secondaryText||"#888888",children:"●"}),n(t,{children:" The directory "}),n(t,{color:m?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),n(t,{children:" contains "}),n(t,{bold:!0,children:"123"}),n(t,{children:" files."})]})})]})]})]})})]})}function yr({onSubmit:e}){const{settings:o,updateSettings:r}=ue(ge),[i,l]=M(0),d=()=>{r(g=>{g.inputBox||(g.inputBox={removeBorder:!1}),g.inputBox.removeBorder=!g.inputBox.removeBorder})};de((g,p)=>{p.return||p.escape?e():g===" "&&i===0&&d()});const h=o.inputBox?.removeBorder?"☑":"☐";return s(c,{flexDirection:"column",children:[n(c,{marginBottom:1,children:n(he,{children:"Input Box Settings"})}),n(c,{marginBottom:1,children:s(t,{color:"gray",children:[n(t,{bold:!0,children:"Customize the appearance of the Claude Code input box."})," ",n(t,{dimColor:!0,children:"Press space to toggle settings, enter to go back."})]})}),n(c,{children:s(t,{children:[n(t,{color:i===0?"cyan":void 0,children:i===0?"❯ ":" "}),n(t,{bold:!0,color:i===0?"cyan":void 0,children:"Remove border"})]})}),i===0&&n(c,{marginBottom:1,flexDirection:"column",children:s(t,{dimColor:!0,children:[" ","space to toggle"]})}),n(c,{marginLeft:2,marginBottom:1,children:s(t,{children:[h," ",o.inputBox?.removeBorder?"Enabled":"Disabled"]})}),n(c,{marginBottom:1,children:n(t,{color:"gray",dimColor:!0,children:"When enabled, removes the rounded border around the input box for a cleaner look."})})]})}const Ze=async()=>{await ae.mkdir(Ee,{recursive:!0})};let Se={settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const ke=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:q};try{ie()&&console.log(`Reading config at ${le}`);const o=await ae.readFile(le,"utf8"),r={...e,...JSON.parse(o)},i=r?.settings?.thinkingVerbs;i?.punctuation&&(i.format="{}"+i.punctuation,delete i.punctuation),r.settings.inputBox||(r.settings.inputBox=q.inputBox);for(const l of q.themes){const d=r?.settings?.themes.find(h=>h.id===l.id||h.name===l.name);if(d)for(const[h,g]of Object.entries(l))Object.hasOwn(d,h)||(d[h]=g)}return r?.settings?.userMessageDisplay||(r.settings=r.settings||q,r.settings.userMessageDisplay=q.userMessageDisplay),Se=r,r}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT")return e;throw o}},_e=async e=>(ie()&&console.log(`Updating config at ${le}`),e(Se),Se.lastModified=new Date().toISOString(),await Ir(Se),Se),Ir=async e=>{try{e.lastModified=new Date().toISOString(),await Ze(),await ae.writeFile(le,JSON.stringify(e,null,2))}catch(o){throw console.error("Error saving config:",o),o}},qe=async e=>{ie()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);try{await ae.unlink(e.cliPath),ie()&&console.log(`Unlinked ${e.cliPath} to break hard links`)}catch(o){ie()&&console.log(`Could not unlink ${e.cliPath}: ${o}`)}return await ae.copyFile(pe,e.cliPath),await _e(o=>{o.changesApplied=!1}),!0},Cr=async e=>{e.ccInstallationDir&&ve.unshift(e.ccInstallationDir);for(const o of ve)try{ie()&&console.log(`Searching for Claude Code cli.js file at ${o}`);const r=Fe.join(o,"cli.js"),i=Fe.join(o,"package.json"),l=JSON.parse(await ae.readFile(i,"utf8"));return ie()&&(console.log(`Found Claude Code cli.js file at ${o}; checking hash...`),console.log(`SHA256 hash: ${await ur(r)}`)),{cliPath:r,packageJsonPath:i,version:l.version}}catch{continue}return null},We=async e=>{await Ze(),ie()&&console.log(`Backing up cli.js to ${pe}`),await ae.copyFile(e.cliPath,pe),await _e(o=>{o.changesApplied=!1,o.ccVersion=e.version})};async function vr(e){try{return await ae.stat(e),!0}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT")return!1;throw o}}async function je(){const e=await ke(),o=await Cr(e);if(!o)return null;const r=o.version,i=e.ccVersion;let l=!1;return await vr(pe)||(ie()&&console.log(`startupCheck: ${pe} not found; backing up cli.js`),await We(o),l=!0),r!==i?(l||(ie()&&console.log(`startupCheck: real version (${r}) != backed up version (${i}); backing up cli.js`),await ae.unlink(pe),await We(o)),{wasUpdated:!0,oldVersion:i,newVersion:r,ccInstInfo:o}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:o}}function Tr(e){const o=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
9
9
  ██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝
10
10
  ██║ ██║ ███████║██║ ██║██║ ██║█████╗
11
11
  ██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝
@@ -19,21 +19,21 @@ import{Box as c,Text as t,render as er,useInput as ce,useStdout as rr}from"ink";
19
19
  ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,r=e.indexOf(o);return r===-1?null:{startIndex:r-1,endIndex:r+o.length+1}}function _r(e,o){const r=Tr(e);if(!r)return e;const i=JSON.stringify(o),l=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return ne(e,l,i,r.startIndex,r.endIndex),l}function Mr(e){const o=/" Welcome to ",[$\w]+\.createElement\([^,]+,\{bold:!0\},"Claude Code"\),"!"/,r=e.match(o);if(r&&r.index!==void 0){const i=r[0].indexOf('"Claude Code"');if(i!==-1)return{startIndex:r.index+i,endIndex:r.index+i+13}}return null}function Ar(e,o){const r=Mr(e);if(!r)return console.error("patch: welcome message: failed to find location"),null;const i=`"${o}"`,l=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return ne(e,l,i,r.startIndex,r.endIndex),l}function $r(e){const o=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,r=e.match(o);if(!r||r.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const i=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,l=/return\{(?:[\w$]+?:"(?:Dark|Light).+?",?)+\}/,d=e.match(i),h=e.match(l);return!d||d.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!h||h.index==null?(console.error("patch: themes: failed to find objMatch"),null):{switchStatement:{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1].trim()]},objArr:{startIndex:d.index,endIndex:d.index+d[0].length},obj:{startIndex:h.index,endIndex:h.index+h[0].length}}}const Dr=(e,o)=>{const r=$r(e);if(!r)return null;if(o.length===0)return e;let i=e;const l="return"+JSON.stringify(Object.fromEntries(o.map(g=>[g.id,g.name])));i=i.slice(0,r.obj.startIndex)+l+i.slice(r.obj.endIndex),ne(e,i,l,r.obj.startIndex,r.obj.endIndex),e=i;const d=JSON.stringify(o.map(g=>({label:g.name,value:g.id})));i=i.slice(0,r.objArr.startIndex)+d+i.slice(r.objArr.endIndex),ne(e,i,d,r.objArr.startIndex,r.objArr.endIndex),e=i;let h=`switch(${r.switchStatement.identifiers?.[0]}){
20
20
  `;return o.forEach(g=>{h+=`case"${g.id}":return${JSON.stringify(g.colors)};
21
21
  `}),h+=`default:return${JSON.stringify(o[0].colors)};
22
- }`,i=i.slice(0,r.switchStatement.startIndex)+h+i.slice(r.switchStatement.endIndex),ne(e,i,h,r.switchStatement.startIndex,r.switchStatement.endIndex),i},Nr=e=>{const o=[],r=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let i;for(;(i=r.exec(e))!==null;)o.push({startIndex:i.index,endIndex:i.index+i[0].length});return o},Or=(e,o)=>{const r=Nr(e);if(r.length===0)return null;const i=JSON.stringify(o),l=r.sort((h,g)=>g.startIndex-h.startIndex);let d=e;for(let h=0;h<l.length;h++){const g=d.slice(0,l[h].startIndex)+i+d.slice(l[h].endIndex);ne(d,g,i,l[h].startIndex,l[h].endIndex),d=g}return d},Br=e=>{const o=/[\w$]+\(\(\)=>\{if\(![\w$]+\)\{[\w$]+\(\d+\);return\}[\w$]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,r=e.match(o);if(!r||r.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const i=r[0],l=r[1],d=i.lastIndexOf(l),h=r.index+d,g=h+l.length;return{startIndex:h,endIndex:g}},Er=(e,o)=>{const r=Br(e);if(!r)return null;const i=JSON.stringify(o),l=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return ne(e,l,i,r.startIndex,r.endIndex),l},Lr=e=>{const o=/[\w$]+\(\(\)=>\{if\(![\w$]+\)\{[\w$]+\(\d+\);return\}[\w$]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,r=e.match(o);if(!r||r.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const i=/if\(![\w$]+\)\{[\w$]+\(\d+\);return\}/,l=r[0].match(i);if(!l||l.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const d=r.index+l.index,h=d+l[0].length;return{startIndex:d,endIndex:h}},Rr=e=>{const o=Lr(e);if(!o)return null;const r=e.slice(0,o.startIndex)+e.slice(o.endIndex);return ne(e,r,"",o.startIndex,o.endIndex),r},kr=e=>{const o=/([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,r=e.match(o);return!r||r.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Pr=e=>{const o=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,r=e.match(o);return!r||r.index==null?(console.error("patch: thinker verbs: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Fr=(e,o)=>{const r=kr(e);if(!r)return null;const i=r,l=i.identifiers?.[0],d=`${l}=${JSON.stringify({words:o})}`,h=e.slice(0,i.startIndex)+d+e.slice(i.endIndex);ne(e,h,d,i.startIndex,i.endIndex);const g=Pr(h);if(!g)return null;const b=g,a=b.identifiers?.[0],y=`function ${a}(){return ${l}.words}`,D=h.slice(0,b.startIndex)+y+h.slice(b.endIndex);return ne(h,D,y,b.startIndex,b.endIndex),D},Ur=e=>{const o=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,r=e.match(o);if(!r||r.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const i=e.slice(r.index,r.index+600),l=/([$\w]+)(=\(([^;]{1,200}?)\)\+"…")/,d=i.match(l);return!d||d.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:r.index+d.index+d[1].length,endIndex:r.index+d.index+d[1].length+d[2].length,identifiers:[d[3]]}},Gr=(e,o)=>{const r=Ur(e);if(!r)return null;const i=r,l=o.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),d=i.identifiers?.[0],h="`"+l.replace(/\{\}/g,"${"+d+"}")+"`",g=`=${h}`,b=e.slice(0,i.startIndex)+g+e.slice(i.endIndex);return ne(e,b,g,i.startIndex,i.endIndex),b},Vr=e=>{const o=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,r=e.match(o);return!r||r.index==null?(console.error("patch: thinker symbol mirror option: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Wr=(e,o)=>{const r=Vr(e);if(!r)return null;const i=r.identifiers?.[0],l=o?`=[...${i},...[...${i}].reverse()]`:`=[...${i}]`,d=e.slice(0,r.startIndex)+l+e.slice(r.endIndex);return ne(e,d,l,r.startIndex,r.endIndex),d},jr=e=>{const o=/\{flexWrap:"wrap",height:1,width:2\}/,r=e.match(o);return!r||r.index==null?(console.error("patch: thinker symbol width: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length}},Yr=(e,o)=>{const r=jr(e);if(!r)return null;const i=`{flexWrap:"wrap",height:1,width:${o}}`,l=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return ne(e,l,i,r.startIndex,r.endIndex),l};function ne(e,o,r,i,l){const d=Math.max(0,i-20),h=Math.min(e.length,l+20),g=Math.min(o.length,i+r.length+20),b=e.slice(d,i),a=e.slice(i,l),y=e.slice(l,h),D=o.slice(d,i),_=o.slice(i,i+r.length),C=o.slice(i+r.length,g);ae()&&(console.log(`
23
- --- Diff ---`),console.log("OLD:",b+`\x1B[31m${a}\x1B[0m`+y),console.log("NEW:",D+`\x1B[32m${_}\x1B[0m`+C),console.log(`--- End Diff ---
24
- `))}const zr=e=>{const o=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,r=e.match(o);if(!r||r.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const i=r[0],l=/verbose:[^,}]+/,d=i.match(l);if(!d||d.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const h=r.index+d.index,g=h+d[0].length;return{startIndex:h,endIndex:g}},Hr=e=>{const o=zr(e);if(!o)return null;const r="verbose:true",i=e.slice(0,o.startIndex)+r+e.slice(o.endIndex);return ne(e,i,r,o.startIndex,o.endIndex),i},Jr=e=>{const o=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,r=e.match(o);return!r||r.index===void 0?(console.error("patch: context limit: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1],r[2],r[3]]}},Xr=e=>{const o=Jr(e);if(!o)return null;const r=o.identifiers?.[0],i=o.identifiers?.[1],l=o.identifiers?.[2],d=`function ${r}(${i}){if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);${l}}`,h=e.slice(0,o.startIndex)+d+e.slice(o.endIndex);return ne(e,h,d,o.startIndex,o.endIndex),h},Kr=e=>{const o=/([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,r=Array.from(e.matchAll(o)),i={};for(const h of r){const g=h[1];i[g]=(i[g]||0)+1}let l,d=0;for(const[h,g]of Object.entries(i))g>d&&(d=g,l=h);return l},Zr=e=>{const o=/No content found in user prompt message/,r=e.match(o);if(!r||r.index===void 0)return console.error("patch: userMessageDisplay: failed to find error message"),null;const i=r.index,l=Math.min(e.length,i+400),d=e.slice(i,l),h=/\{minWidth:(\d+),width:\d+\}/,g=d.match(h);if(!g||g.index===void 0)return console.error("patch: userMessageDisplay: failed to find minWidth pattern"),null;const b=/createElement\(\w+,\{color:"[^"]*"\},"([^"]+)"\)/,a=d.match(b),y=/(createElement\(\w+,\{[^}]*color:"[^"]*"[^}]*\},(\w+)\.trim\(\))/,D=d.match(y);return{minWidthLocation:g&&{startIndex:i+g.index,endIndex:i+g.index+g[0].length},prefixLocation:a?{startIndex:i+a.index,endIndex:i+a.index+a[0].length}:null,messageLocation:D&&{startIndex:i+D.index,endIndex:i+D.index+D[0].length}}},qr=(e,o,r,i,l=!1,d=!1,h=!1,g=!1,b=!1,a,y,D=!1,_=!1,C=!1,B=!1,k=!1)=>{const A=Zr(e);if(!A)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!A.minWidthLocation)return console.error("patch: userMessageDisplay: failed to find minWidth location"),null;if(!A.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!A.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const R=Kr(e);if(!R)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const G=[];G.push({startIndex:A.minWidthLocation.startIndex,endIndex:A.minWidthLocation.endIndex,newContent:`{minWidth:${o.length+1},width:${o.length+1}}`});const Z=Ve(R,r.match(/\d+/g)?.join(",")||"153,153,153",i==="transparent"?null:i.match(/\d+/g)?.join(",")||null,l,d,h,g,b),H=Ve(R,a.match(/\d+/g)?.join(",")||"153,153,153",y==="transparent"?null:y.match(/\d+/g)?.join(",")||null,D,_,C,B,k);G.push({startIndex:A.prefixLocation.startIndex,endIndex:A.prefixLocation.endIndex,newContent:e.slice(A.prefixLocation.startIndex,A.prefixLocation.endIndex).replace(/"([^"]+)"\)$/,`${Z}("${o}"))`)}),G.push({startIndex:A.messageLocation.startIndex,endIndex:A.messageLocation.endIndex,newContent:e.slice(A.messageLocation.startIndex,A.messageLocation.endIndex).replace(/(\w+\.trim\(\))/,`${H}($1)`)}),G.sort((j,F)=>F.startIndex-j.startIndex);let P=e;for(const j of G){const F=P;P=P.slice(0,j.startIndex)+j.newContent+P.slice(j.endIndex),ne(F,P,j.newContent,j.startIndex,j.endIndex)}return P},Qr=e=>{const o=/borderColor:[$\w]+==="bash"/,r=e.match(o);if(!r||r.index===void 0)return console.error("patch: input border: failed to find approxAreaMatch"),null;const i=r.index,l=Math.min(e.length,i+200),d=e.slice(i,l),h=/borderStyle:"round"/,g=d.match(h);if(!g||g.index===void 0)return console.error("patch: input border: failed to find borderStyle in section"),null;const b=i+g.index,a=b+g[0].length;return{startIndex:b,endIndex:a}},en=(e,o)=>{const r=Qr(e);if(!r)return null;const i=o?"borderStyle:undefined,marginBottom:1":'borderStyle:"round"',l=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return ne(e,l,i,r.startIndex,r.endIndex),l},Qe=async(e,o)=>{await qe(o);let r=await Fe.readFile(o.cliPath,{encoding:"utf8"}),i=null;if(e.settings.themes&&e.settings.themes.length>0&&(i=Dr(r,e.settings.themes))&&(r=i),e.settings.launchText){const l=e.settings.launchText;let d="";l.method==="custom"&&l.customText?d=l.customText:l.method==="figlet"&&l.figletText&&(d=await new Promise(g=>Oe.text(l.figletText.replace(`
25
- `," "),l.figletFont,(b,a)=>{b?(console.error("patch: figlet: failed to generate text",b),g("")):g(a||"")}))),(i=_r(r,d))&&(r=i);const h=l.method==="custom"?l.customText:l.figletText;h&&(i=Ar(r,h))&&(r=i)}return e.settings.thinkingVerbs&&((i=Fr(r,e.settings.thinkingVerbs.verbs))&&(r=i),(i=Gr(r,e.settings.thinkingVerbs.format))&&(r=i)),(i=Or(r,e.settings.thinkingStyle.phases))&&(r=i),(i=Er(r,e.settings.thinkingStyle.updateInterval))&&(r=i),(i=Yr(r,Math.max(...e.settings.thinkingStyle.phases.map(l=>l.length))+1))&&(r=i),(i=Wr(r,e.settings.thinkingStyle.reverseMirror))&&(r=i),e.settings.userMessageDisplay&&(i=qr(r,e.settings.userMessageDisplay.prefix.format,e.settings.userMessageDisplay.prefix.foreground_color,e.settings.userMessageDisplay.prefix.background_color,e.settings.userMessageDisplay.prefix.styling.includes("bold"),e.settings.userMessageDisplay.prefix.styling.includes("italic"),e.settings.userMessageDisplay.prefix.styling.includes("underline"),e.settings.userMessageDisplay.prefix.styling.includes("strikethrough"),e.settings.userMessageDisplay.prefix.styling.includes("inverse"),e.settings.userMessageDisplay.message.foreground_color,e.settings.userMessageDisplay.message.background_color,e.settings.userMessageDisplay.message.styling.includes("bold"),e.settings.userMessageDisplay.message.styling.includes("italic"),e.settings.userMessageDisplay.message.styling.includes("underline"),e.settings.userMessageDisplay.message.styling.includes("strikethrough"),e.settings.userMessageDisplay.message.styling.includes("inverse")))&&(r=i),console.log(e.settings.inputBox),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(i=en(r,e.settings.inputBox.removeBorder))&&(r=i),(i=Hr(r))&&(r=i),(i=Rr(r))&&(r=i),(i=Xr(r))&&(r=i),await Fe.writeFile(o.cliPath,r),await Te(l=>{l.changesApplied=!0})},he=tr({settings:K,updateSettings:e=>{},changesApplied:!1});function rn({startupCheckInfo:e}){const[o,r]=T({settings:K,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});ie(()=>{(async()=>{r(await Le())})()},[]);const i=Ye(y=>{const D=JSON.parse(JSON.stringify(o.settings));y(D),r(_=>({..._,settings:D,changesApplied:!1})),Te(_=>{_.settings=D,_.changesApplied=!1})},[o.settings]),[l,d]=T(null),[h,g]=T(null);ie(()=>{e.wasUpdated&&e.oldVersion&&(g({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
26
- (However, your customization are still remembered in ${se}.)
27
- Please reapply your changes below.`,type:"warning"}),i(()=>{}))},[]),ce((y,D)=>{(D.ctrl&&y==="c"||(y==="q"||D.escape)&&!l)&&process.exit(0)});const b=y=>{switch(g(null),y){case z.THEMES:case z.LAUNCH_TEXT:case z.THINKING_VERBS:case z.THINKING_STYLE:case z.USER_MESSAGE_DISPLAY:case z.INPUT_BOX:d(y);break;case z.APPLY_CHANGES:e.ccInstInfo&&(g({message:"Applying patches...",type:"info"}),Qe(o,e.ccInstInfo).then(D=>{r(D),g({message:"Customization patches applied successfully!",type:"success"})}));break;case z.RESTORE_ORIGINAL:e.ccInstInfo&&qe(e.ccInstInfo).then(()=>{g({message:"Original Claude Code restored successfully!",type:"success"}),i(()=>{})});break;case z.OPEN_CONFIG:Ge(se);break;case z.OPEN_CLI:e.ccInstInfo&&Ge(e.ccInstInfo.cliPath);break;case z.EXIT:process.exit(0)}},a=()=>{d(null)};return n(he.Provider,{value:{settings:o.settings,updateSettings:i,changesApplied:o.changesApplied},children:n(c,{flexDirection:"column",children:l===null?n(hr,{onSubmit:b,notification:h}):l===z.THEMES?n(pr,{onBack:a}):l===z.LAUNCH_TEXT?n(br,{onBack:a}):l===z.THINKING_VERBS?n(xr,{onBack:a}):l===z.THINKING_STYLE?n(wr,{onBack:a}):l===z.USER_MESSAGE_DISPLAY?n(Sr,{onBack:a}):l===z.INPUT_BOX?n(yr,{onSubmit:a}):null})})}const nn=async()=>{const e=new nr;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("1.4.0").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const o=e.opts();if(o.debug&&gr(),o.apply){console.log(re.cyan("🔧 Applying saved customizations to Claude Code..."));try{const i=await Le();(!i.settings||Object.keys(i.settings).length===0)&&(console.error(re.red("❌ No saved customizations found in "+se)),process.exit(1));const l=await je();(!l||!l.ccInstInfo)&&(console.error(re.red("❌ Cannot find Claude Code's cli.js")),console.error(re.yellow("Searched at the following locations:")),Ce.forEach(d=>console.error(re.gray(" - "+d))),process.exit(1)),console.log(re.gray(`📁 Found Claude Code at: ${l.ccInstInfo.cliPath}`)),console.log(re.gray(`📦 Version: ${l.ccInstInfo.version}`)),console.log(re.gray("✓ Backup handled by startup check")),console.log(re.cyan("🎨 Applying customizations..."));try{await Qe(i,l.ccInstInfo),console.log(re.green("✅ Customizations applied successfully!")),console.log(re.gray(`💾 Configuration saved at: ${se}`))}catch(d){console.error(re.red("❌ Failed to apply patches:")),console.error(re.red(d instanceof Error?d.message:String(d))),d instanceof Error&&d.message.includes("patch:")&&(console.log(re.yellow("⚠️ Some patches failed to apply, but the file was updated.")),console.log(re.yellow(" This may happen if Claude Code was updated.")),console.log(re.gray(" Run tweakcc interactively to review and update your customizations.")))}process.exit(0)}catch(i){console.error(re.red("❌ Unexpected error:")),console.error(re.red(i instanceof Error?i.message:String(i))),process.exit(1)}}const r=await je();r?er(n(rn,{startupCheckInfo:r})):(console.error(`\x1B[31mCannot find Claude Code's cli.js -- do you have Claude Code installed?
22
+ }`,i=i.slice(0,r.switchStatement.startIndex)+h+i.slice(r.switchStatement.endIndex),ne(e,i,h,r.switchStatement.startIndex,r.switchStatement.endIndex),i},Nr=e=>{const o=[],r=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let i;for(;(i=r.exec(e))!==null;)o.push({startIndex:i.index,endIndex:i.index+i[0].length});return o},Or=(e,o)=>{const r=Nr(e);if(r.length===0)return null;const i=JSON.stringify(o),l=r.sort((h,g)=>g.startIndex-h.startIndex);let d=e;for(let h=0;h<l.length;h++){const g=d.slice(0,l[h].startIndex)+i+d.slice(l[h].endIndex);ne(d,g,i,l[h].startIndex,l[h].endIndex),d=g}return d},Br=e=>{const o=/[\w$]+\(\(\)=>\{if\(![\w$]+\)\{[\w$]+\(\d+\);return\}[\w$]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,r=e.match(o);if(!r||r.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const i=r[0],l=r[1],d=i.lastIndexOf(l),h=r.index+d,g=h+l.length;return{startIndex:h,endIndex:g}},Er=(e,o)=>{const r=Br(e);if(!r)return null;const i=JSON.stringify(o),l=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return ne(e,l,i,r.startIndex,r.endIndex),l},Lr=e=>{const o=/[\w$]+\(\(\)=>\{if\(![\w$]+\)\{[\w$]+\(\d+\);return\}[\w$]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,r=e.match(o);if(!r||r.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const i=/if\(![\w$]+\)\{[\w$]+\(\d+\);return\}/,l=r[0].match(i);if(!l||l.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const d=r.index+l.index,h=d+l[0].length;return{startIndex:d,endIndex:h}},kr=e=>{const o=Lr(e);if(!o)return null;const r=e.slice(0,o.startIndex)+e.slice(o.endIndex);return ne(e,r,"",o.startIndex,o.endIndex),r},Rr=e=>{const o=/([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,r=e.match(o);return!r||r.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Pr=e=>{const o=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,r=e.match(o);return!r||r.index==null?(console.error("patch: thinker verbs: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Fr=(e,o)=>{const r=Rr(e);if(!r)return null;const i=r,l=i.identifiers?.[0],d=`${l}=${JSON.stringify({words:o})}`,h=e.slice(0,i.startIndex)+d+e.slice(i.endIndex);ne(e,h,d,i.startIndex,i.endIndex);const g=Pr(h);if(!g)return null;const p=g,a=p.identifiers?.[0],I=`function ${a}(){return ${l}.words}`,D=h.slice(0,p.startIndex)+I+h.slice(p.endIndex);return ne(h,D,I,p.startIndex,p.endIndex),D},Ur=e=>{const o=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,r=e.match(o);if(!r||r.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const i=e.slice(r.index,r.index+600),l=/([$\w]+)(=\(([^;]{1,200}?)\)\+"…")/,d=i.match(l);return!d||d.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:r.index+d.index+d[1].length,endIndex:r.index+d.index+d[1].length+d[2].length,identifiers:[d[3]]}},Gr=(e,o)=>{const r=Ur(e);if(!r)return null;const i=r,l=o.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),d=i.identifiers?.[0],h="`"+l.replace(/\{\}/g,"${"+d+"}")+"`",g=`=${h}`,p=e.slice(0,i.startIndex)+g+e.slice(i.endIndex);return ne(e,p,g,i.startIndex,i.endIndex),p},Vr=e=>{const o=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,r=e.match(o);return!r||r.index==null?(console.error("patch: thinker symbol mirror option: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Wr=(e,o)=>{const r=Vr(e);if(!r)return null;const i=r.identifiers?.[0],l=o?`=[...${i},...[...${i}].reverse()]`:`=[...${i}]`,d=e.slice(0,r.startIndex)+l+e.slice(r.endIndex);return ne(e,d,l,r.startIndex,r.endIndex),d},jr=e=>{const o=/\{flexWrap:"wrap",height:1,width:2\}/,r=e.match(o);return!r||r.index==null?(console.error("patch: thinker symbol width: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length}},Yr=(e,o)=>{const r=jr(e);if(!r)return null;const i=`{flexWrap:"wrap",height:1,width:${o}}`,l=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return ne(e,l,i,r.startIndex,r.endIndex),l};function ne(e,o,r,i,l){const d=Math.max(0,i-20),h=Math.min(e.length,l+20),g=Math.min(o.length,i+r.length+20),p=e.slice(d,i),a=e.slice(i,l),I=e.slice(l,h),D=o.slice(d,i),_=o.slice(i,i+r.length),v=o.slice(i+r.length,g);ie()&&(console.log(`
23
+ --- Diff ---`),console.log("OLD:",p+`\x1B[31m${a}\x1B[0m`+I),console.log("NEW:",D+`\x1B[32m${_}\x1B[0m`+v),console.log(`--- End Diff ---
24
+ `))}const zr=e=>{const o=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,r=e.match(o);if(!r||r.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const i=r[0],l=/verbose:[^,}]+/,d=i.match(l);if(!d||d.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const h=r.index+d.index,g=h+d[0].length;return{startIndex:h,endIndex:g}},Hr=e=>{const o=zr(e);if(!o)return null;const r="verbose:true",i=e.slice(0,o.startIndex)+r+e.slice(o.endIndex);return ne(e,i,r,o.startIndex,o.endIndex),i},Jr=e=>{const o=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,r=e.match(o);return!r||r.index===void 0?(console.error("patch: context limit: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1],r[2],r[3]]}},Xr=e=>{const o=Jr(e);if(!o)return null;const r=o.identifiers?.[0],i=o.identifiers?.[1],l=o.identifiers?.[2],d=`function ${r}(${i}){if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);${l}}`,h=e.slice(0,o.startIndex)+d+e.slice(o.endIndex);return ne(e,h,d,o.startIndex,o.endIndex),h},Kr=e=>{const o=/([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,r=Array.from(e.matchAll(o)),i={};for(const h of r){const g=h[1];i[g]=(i[g]||0)+1}let l,d=0;for(const[h,g]of Object.entries(i))g>d&&(d=g,l=h);return l},Zr=e=>{const o=/No content found in user prompt message/,r=e.match(o);if(!r||r.index===void 0)return console.error("patch: userMessageDisplay: failed to find error message"),null;const i=r.index,l=Math.min(e.length,i+400),d=e.slice(i,l),h=/\{minWidth:(\d+),width:\d+\}/,g=d.match(h);if(!g||g.index===void 0)return console.error("patch: userMessageDisplay: failed to find minWidth pattern"),null;const p=/createElement\(\w+,\{color:"[^"]*"\},"([^"]+)"\)/,a=d.match(p),I=/(createElement\(\w+,\{[^}]*color:"[^"]*"[^}]*\},(\w+)\.trim\(\))/,D=d.match(I);return{minWidthLocation:g&&{startIndex:i+g.index,endIndex:i+g.index+g[0].length},prefixLocation:a?{startIndex:i+a.index,endIndex:i+a.index+a[0].length}:null,messageLocation:D&&{startIndex:i+D.index,endIndex:i+D.index+D[0].length}}},qr=(e,o,r,i,l=!1,d=!1,h=!1,g=!1,p=!1,a,I,D=!1,_=!1,v=!1,B=!1,k=!1)=>{const T=Zr(e);if(!T)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!T.minWidthLocation)return console.error("patch: userMessageDisplay: failed to find minWidth location"),null;if(!T.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!T.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const R=Kr(e);if(!R)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const P=[];P.push({startIndex:T.minWidthLocation.startIndex,endIndex:T.minWidthLocation.endIndex,newContent:`{minWidth:${o.length+1},width:${o.length+1}}`});const J=r==="rgb(0,0,0)"&&i==="rgb(0,0,0)",z=l||d||h||g||p,W=!J||z,X=a==="rgb(0,0,0)"&&I==="rgb(0,0,0)",F=D||_||v||B||k,K=!X||F;if(W){const y=Ve(R,J?null:r.match(/\d+/g)?.join(",")||null,J?null:i.match(/\d+/g)?.join(",")||null,l,d,h,g,p);P.push({startIndex:T.prefixLocation.startIndex,endIndex:T.prefixLocation.endIndex,newContent:e.slice(T.prefixLocation.startIndex,T.prefixLocation.endIndex).replace(/"([^"]+)"\)$/,`${y}("${o}"))`)})}else P.push({startIndex:T.prefixLocation.startIndex,endIndex:T.prefixLocation.endIndex,newContent:e.slice(T.prefixLocation.startIndex,T.prefixLocation.endIndex).replace(/"([^"]+)"\)$/,`"${o}")`)});if(K){const y=Ve(R,X?null:a.match(/\d+/g)?.join(",")||null,X?null:I.match(/\d+/g)?.join(",")||null,D,_,v,B,k);P.push({startIndex:T.messageLocation.startIndex,endIndex:T.messageLocation.endIndex,newContent:e.slice(T.messageLocation.startIndex,T.messageLocation.endIndex).replace(/(\w+\.trim\(\))/,`${y}($1)`)})}P.sort((y,x)=>x.startIndex-y.startIndex);let A=e;for(const y of P){const x=A;A=A.slice(0,y.startIndex)+y.newContent+A.slice(y.endIndex),ne(x,A,y.newContent,y.startIndex,y.endIndex)}return A},Qr=e=>{const o=/borderColor:[$\w]+==="bash"/,r=e.match(o);if(!r||r.index===void 0)return console.error("patch: input border: failed to find approxAreaMatch"),null;const i=r.index,l=Math.min(e.length,i+200),d=e.slice(i,l),h=/borderStyle:"round"/,g=d.match(h);if(!g||g.index===void 0)return console.error("patch: input border: failed to find borderStyle in section"),null;const p=i+g.index,a=p+g[0].length;return{startIndex:p,endIndex:a}},en=(e,o)=>{const r=Qr(e);if(!r)return null;const i=o?"borderStyle:undefined,marginBottom:1":'borderStyle:"round"',l=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);return ne(e,l,i,r.startIndex,r.endIndex),l},Qe=async(e,o)=>{await qe(o);let r=await $e.readFile(o.cliPath,{encoding:"utf8"}),i=null;if(e.settings.themes&&e.settings.themes.length>0&&(i=Dr(r,e.settings.themes))&&(r=i),e.settings.launchText){const l=e.settings.launchText;let d="";l.method==="custom"&&l.customText?d=l.customText:l.method==="figlet"&&l.figletText&&(d=await new Promise(g=>Be.text(l.figletText.replace(`
25
+ `," "),l.figletFont,(p,a)=>{p?(console.error("patch: figlet: failed to generate text",p),g("")):g(a||"")}))),(i=_r(r,d))&&(r=i);const h=l.method==="custom"?l.customText:l.figletText;h&&(i=Ar(r,h))&&(r=i)}e.settings.thinkingVerbs&&((i=Fr(r,e.settings.thinkingVerbs.verbs))&&(r=i),(i=Gr(r,e.settings.thinkingVerbs.format))&&(r=i)),(i=Or(r,e.settings.thinkingStyle.phases))&&(r=i),(i=Er(r,e.settings.thinkingStyle.updateInterval))&&(r=i),(i=Yr(r,Math.max(...e.settings.thinkingStyle.phases.map(l=>l.length))+1))&&(r=i),(i=Wr(r,e.settings.thinkingStyle.reverseMirror))&&(r=i),e.settings.userMessageDisplay&&(i=qr(r,e.settings.userMessageDisplay.prefix.format,e.settings.userMessageDisplay.prefix.foreground_color,e.settings.userMessageDisplay.prefix.background_color,e.settings.userMessageDisplay.prefix.styling.includes("bold"),e.settings.userMessageDisplay.prefix.styling.includes("italic"),e.settings.userMessageDisplay.prefix.styling.includes("underline"),e.settings.userMessageDisplay.prefix.styling.includes("strikethrough"),e.settings.userMessageDisplay.prefix.styling.includes("inverse"),e.settings.userMessageDisplay.message.foreground_color,e.settings.userMessageDisplay.message.background_color,e.settings.userMessageDisplay.message.styling.includes("bold"),e.settings.userMessageDisplay.message.styling.includes("italic"),e.settings.userMessageDisplay.message.styling.includes("underline"),e.settings.userMessageDisplay.message.styling.includes("strikethrough"),e.settings.userMessageDisplay.message.styling.includes("inverse")))&&(r=i),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(i=en(r,e.settings.inputBox.removeBorder))&&(r=i),(i=Hr(r))&&(r=i),(i=kr(r))&&(r=i),(i=Xr(r))&&(r=i);try{await $e.unlink(o.cliPath),ie()&&console.log(`Unlinked ${o.cliPath} to break hard links before writing patched content`)}catch(l){ie()&&console.log(`Could not unlink ${o.cliPath}: ${l}`)}return await $e.writeFile(o.cliPath,r),await _e(l=>{l.changesApplied=!0})},ge=tr({settings:q,updateSettings:e=>{},changesApplied:!1});function rn({startupCheckInfo:e}){const[o,r]=M({settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});se(()=>{(async()=>{r(await ke())})()},[]);const i=Ye(I=>{const D=JSON.parse(JSON.stringify(o.settings));I(D),r(_=>({..._,settings:D,changesApplied:!1})),_e(_=>{_.settings=D,_.changesApplied=!1})},[o.settings]),[l,d]=M(null),[h,g]=M(null);se(()=>{e.wasUpdated&&e.oldVersion&&(g({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
26
+ (However, your customization are still remembered in ${le}.)
27
+ Please reapply your changes below.`,type:"warning"}),i(()=>{}))},[]),de((I,D)=>{(D.ctrl&&I==="c"||(I==="q"||D.escape)&&!l)&&process.exit(0)});const p=I=>{switch(g(null),I){case Y.THEMES:case Y.LAUNCH_TEXT:case Y.THINKING_VERBS:case Y.THINKING_STYLE:case Y.USER_MESSAGE_DISPLAY:case Y.INPUT_BOX:d(I);break;case Y.APPLY_CHANGES:e.ccInstInfo&&(g({message:"Applying patches...",type:"info"}),Qe(o,e.ccInstInfo).then(D=>{r(D),g({message:"Customization patches applied successfully!",type:"success"})}));break;case Y.RESTORE_ORIGINAL:e.ccInstInfo&&qe(e.ccInstInfo).then(()=>{g({message:"Original Claude Code restored successfully!",type:"success"}),i(()=>{})});break;case Y.OPEN_CONFIG:Ge(le);break;case Y.OPEN_CLI:e.ccInstInfo&&Ge(e.ccInstInfo.cliPath);break;case Y.EXIT:process.exit(0)}},a=()=>{d(null)};return n(ge.Provider,{value:{settings:o.settings,updateSettings:i,changesApplied:o.changesApplied},children:n(c,{flexDirection:"column",children:l===null?n(hr,{onSubmit:p,notification:h}):l===Y.THEMES?n(pr,{onBack:a}):l===Y.LAUNCH_TEXT?n(br,{onBack:a}):l===Y.THINKING_VERBS?n(xr,{onBack:a}):l===Y.THINKING_STYLE?n(wr,{onBack:a}):l===Y.USER_MESSAGE_DISPLAY?n(Sr,{onBack:a}):l===Y.INPUT_BOX?n(yr,{onSubmit:a}):null})})}const nn=async()=>{const e=new nr;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("1.4.2").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const o=e.opts();if(o.debug&&gr(),o.apply){console.log(re.cyan("🔧 Applying saved customizations to Claude Code..."));try{const i=await ke();(!i.settings||Object.keys(i.settings).length===0)&&(console.error(re.red("❌ No saved customizations found in "+le)),process.exit(1));const l=await je();(!l||!l.ccInstInfo)&&(console.error(re.red("❌ Cannot find Claude Code's cli.js")),console.error(re.yellow("Searched at the following locations:")),ve.forEach(d=>console.error(re.gray(" - "+d))),process.exit(1)),console.log(re.gray(`📁 Found Claude Code at: ${l.ccInstInfo.cliPath}`)),console.log(re.gray(`📦 Version: ${l.ccInstInfo.version}`)),console.log(re.gray("✓ Backup handled by startup check")),console.log(re.cyan("🎨 Applying customizations..."));try{await Qe(i,l.ccInstInfo),console.log(re.green("✅ Customizations applied successfully!")),console.log(re.gray(`💾 Configuration saved at: ${le}`))}catch(d){console.error(re.red("❌ Failed to apply patches:")),console.error(re.red(d instanceof Error?d.message:String(d))),d instanceof Error&&d.message.includes("patch:")&&(console.log(re.yellow("⚠️ Some patches failed to apply, but the file was updated.")),console.log(re.yellow(" This may happen if Claude Code was updated.")),console.log(re.gray(" Run tweakcc interactively to review and update your customizations.")))}process.exit(0)}catch(i){console.error(re.red("❌ Unexpected error:")),console.error(re.red(i instanceof Error?i.message:String(i))),process.exit(1)}}const r=await je();r?er(n(rn,{startupCheckInfo:r})):(console.error(`\x1B[31mCannot find Claude Code's cli.js -- do you have Claude Code installed?
28
28
 
29
29
  Searched at the following locations:
30
- ${Ce.map(i=>"- "+i).join(`
30
+ ${ve.map(i=>"- "+i).join(`
31
31
  `)}
32
32
 
33
33
  If you have it installed but it's in a location not listed above, please open an issue at
34
34
  https://github.com/piebald-ai/tweakcc/issues and tell us where you have it--we'll add that
35
35
  location to our search list and release an update today! Or you can specify the path to its
36
- \`cli.js\` file in ${se}:
36
+ \`cli.js\` file in ${le}:
37
37
 
38
38
  {
39
39
  "ccInstallationDir": "${process.platform=="win32"?"C:\\\\absolute\\\\path\\\\to\\\\node_modules\\\\@anthropic-ai\\\\claude-code":"/absolute/path/to/node_modules/+@anthropic-ai/claude-code"}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tweakcc",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "type": "module",
5
5
  "description": "Command-line tool to customize your Claude Code theme colors, thinking verbs and more.",
6
6
  "main": "dist/index.js",