tweakcc 1.3.0 → 1.4.1

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 +12 -4
  2. package/dist/index.js +20 -17
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,19 +9,27 @@
9
9
  > [!note]
10
10
  > ⭐ **If you find tweakcc useful, please consider [starring the repository](https://github.com/Piebald-AI/tweakcc) to show your support!** ⭐
11
11
 
12
- <img src="./assets/demo.gif" alt="Animated GIF demonstrating running `npx tweakcc`, creating a new theme, changing all of Claude Code's UI colors to purple, chaning the thinking format from 'verb + ellipsis' to 'Claude is 'verb', chaning the generating spinner style to a 50m glow animation, applying the changes, running Claude, and using '/config' to switch to the new theme, and sending a message to see the new thinking verb format" width="800">
12
+ <img src="./assets/demo.gif" alt="Animated GIF demonstrating running `npx tweakcc`, creating a new theme, changing all of Claude Code's UI colors to purple, changing the thinking format from '<verb>ing...' to 'Claude is <verb>ing', changing the generating spinner style to a 50m glow animation, applying the changes, running Claude, and using '/config' to switch to the new theme, and sending a message to see the new thinking verb format." width="800">
13
+
14
+ With tweakcc, you can
13
15
 
14
16
  - Create **custom themes** with a graphical HSL/RGB color picker
15
17
  - Add custom **thinking verbs** that will show while Claude's working
16
18
  - Create custom **thinking spinner animations** with different speeds and phases
17
19
  - Change the "CLAUDE CODE" banner text to your own text with your own [figlet](http://www.figlet.org/) fonts
18
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
19
23
 
20
- Planned / in progress:
24
+ tweakcc also
25
+ - Restores the **token counter** and **elapsed time metric** that were shown during generation before Claude Code 1.0.83
26
+ - Fixes a bug where the **spinner animation** is frozen if you have the `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` environment variable set ([#46](https://github.com/Piebald-AI/tweakcc/issues/46))
27
+ - Allows you to **change the context limit** used with models from custom Anthropic-compatible APIs with a new environment variable, `CLAUDE_CODE_CONTEXT_LIMIT`
28
+
29
+ Additionally, we're working on features that will allow you to
21
30
  - Pick from over **70+ spinning/thinking animations** from [`cli-spinners`](https://github.com/sindresorhus/cli-spinners)
22
31
  - Apply **custom styling** to the markdown elements in Claude's responses like code, bold, headers, etc
23
32
  - Customize the **shimmering effect** on the thinking verb: disable it; change its speed, width, and colors
24
- - Style the **user messages in the chat history** beyond the default plain gray text
25
33
 
26
34
  Run without installation:
27
35
 
@@ -36,7 +44,7 @@ $ pnpm dlx tweakcc
36
44
 
37
45
  `tweakcc` works by patching the Claude Code's minified `cli.js` file. When you update your Claude Code installation, your customizations will be overwritten, but they're remembered in your `~/.tweakcc/config.js` configuration file, so they can be reapplied by just rerunning the tool.
38
46
 
39
- Works with Claude Code 1.0.96
47
+ `tweakcc` is verified to work with Claude Code **1.0.100.**
40
48
 
41
49
  ## Running
42
50
 
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import{Box as e,Text as t,render as n,useInput as r,useStdout as i}from"ink";import{Command as a}from"commander";import{Fragment as o,createContext as s,useCallback as c,useContext as l,useEffect as u,useState as d}from"react";import f from"ink-link";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";import*as g from"node:path";import _ from"node:path";import*as v from"node:os";import{globbySync as y}from"globby";import*as b from"node:fs";import*as x from"node:child_process";import*as S from"node:crypto";import C from"figlet";import*as w from"node:fs/promises";import T from"node:fs/promises";import E from"chalk";function D({items:n,selectedIndex:i,onSelect:a,onSubmit:o}){return r((e,t)=>{t.upArrow?a(i>0?i-1:n.length-1):t.downArrow?a(i<n.length-1?i+1:0):t.return&&o(n[i].name)}),m(e,{flexDirection:`column`,children:n.map((n,r)=>m(e,{children:h(t,{children:[h(t,{bold:r===i,color:r===i?`cyan`:void 0,...r===i?n.selectedStyles??{}:n.styles??{},children:[r===i?`❯ `:` `,n.name]}),n.desc&&r===i&&h(t,{dimColor:!0,bold:!1,children:[` \x1B[0;2m`,`- `,n.desc]})]})},r))})}let O=function(e){return e.THEMES=`Themes`,e.LAUNCH_TEXT=`Launch text`,e.THINKING_VERBS=`Thinking verbs`,e.THINKING_STYLE=`Thinking style`,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`.split(`.`)},thinkingStyle:{updateInterval:120,phases:{}.TERM===`xterm-ghostty`?[`·`,`✢`,`✳`,`✶`,`✻`,`*`]:process.platform===`darwin`?[`·`,`✢`,`✳`,`✶`,`✻`,`✽`]:[`·`,`✢`,`*`,`✶`,`✻`,`✽`],reverseMirror:!0}},A=g.join(v.homedir(),`.tweakcc`),j=g.join(A,`config.json`),M=g.join(A,`cli.js.backup`),N=()=>{let e=[],t=process.platform==`win32`?v.homedir().replace(/\\/g,`/`):v.homedir(),n=`node_modules/@anthropic-ai/claude-code`;return e.push(`${v.homedir()}/.claude/local/${n}`),{}.N_PREFIX&&e.push(`${{}.N_PREFIX}/lib/${n}`),{}.VOLTA_HOME&&e.push(`${{}.VOLTA_HOME}/lib/${n}`),{}.FNM_DIR&&e.push(`${{}.FNM_DIR}/lib/${n}`),{}.NVM_DIR&&e.push(`${{}.NVM_DIR}/lib/${n}`),{}.NODENV_ROOT&&e.push(...y(`${{}.NODENV_ROOT}/versions/*/lib/${n}`)),{}.NVS_HOME&&e.push(...y(`${{}.NVS_HOME}/node/*/*/lib/${n}`)),process.platform==`win32`?(e.push(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${n}`),e.push(`${t}/AppData/Roaming/npm/${n}`),e.push(...y(`${t}/AppData/Roaming/nvm/*/${n}}`)),e.push(`${t}/AppData/Local/Yarn/config/global/${n}`),e.push(...y(`${t}/AppData/Local/pnpm/global/*/${n}`)),e.push(...y(`${t}/n/versions/node/*/lib/${n}`)),e.push(`${t}/AppData/Roaming/Yarn/config/global/${n}`),e.push(`${t}/AppData/Roaming/pnpm-global/${n}`),e.push(...y(`${t}/AppData/Roaming/pnpm-global/*/${n}`)),e.push(`${t}/.bun/install/global/${n}`),e.push(...y(`${t}/AppData/Local/fnm_multishells/*/node_modules/${n}`))):(process.platform==`darwin`&&(e.push(`${t}/Library/${n}`),e.push(`/opt/local/lib/${n}`)),e.push(`${t}/.local/lib/${n}`),e.push(`${t}/.local/share/${n}`),e.push(`${t}/.npm-global/lib/${n}`),e.push(`${t}/.npm-packages/lib/${n}`),e.push(`${t}/.npm/lib/${n}`),e.push(`${t}/npm/lib/${n}`),e.push(`/etc/${n}`),e.push(`/lib/${n}`),e.push(`/opt/node/lib/${n}`),e.push(`/usr/lib/${n}`),e.push(`/usr/local/lib/${n}`),e.push(`/usr/share/${n}`),e.push(`/var/lib/${n}`),e.push(`/opt/homebrew/lib/${n}`),e.push(`${t}/.config/yarn/global/${n}`),e.push(`${t}/.yarn/global/${n}`),e.push(`${t}/.bun/install/global/${n}`),e.push(`${t}/.pnpm-global/${n}`),e.push(...y(`${t}/.pnpm-global/*/${n}`)),e.push(`${t}/pnpm-global/${n}`),e.push(...y(`${t}/pnpm-global/*/${n}`)),e.push(`${t}/.local/share/pnpm/global/${n}`),e.push(...y(`${t}/.local/share/pnpm/global/*/${n}`)),e.push(`${t}/.bun/install/global/${n}`),e.push(...y(`/usr/local/n/versions/node/*/lib/${n}`)),e.push(...y(`${t}/n/versions/node/*/lib/${n}`)),e.push(`${t}/n/lib/${n}`),e.push(...y(`${t}/.volta/tools/image/node/*/lib/${n}`)),e.push(...y(`${t}/.fnm/node-versions/*/installation/lib/${n}`)),e.push(...y(`/usr/local/nvm/versions/node/*/lib/${n}`)),e.push(...y(`${t}/.nvm/versions/node/*/lib/${n}`)),e.push(...y(`${t}/.nodenv/versions/*/lib/${n}`)),e.push(...y(`${t}/.nvs/*/lib/${n}`))),process.platform==`win32`?e.map(e=>e.replace(/\//g,`\\`)):e},P=N(),F=({children:e,...n})=>h(t,{bold:!0,backgroundColor:`#ffd500`,color:`#000`,...n,children:[` `,e,` `]});var I=F;const L=[{name:O.THEMES,desc:`Modify Claude Code's built-in themes or create your own`},{name:O.LAUNCH_TEXT,desc:`Change the "CLAUDE CODE" banner text that's shown when you sign in to Claude Code`},{name:O.THINKING_VERBS,desc:`Customize the list of verbs that Claude Code uses when it's working`},{name:O.THINKING_STYLE,desc:`Choose custom spinners`}],R=[{name:O.RESTORE_ORIGINAL,desc:`Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)`},{name:O.OPEN_CONFIG,desc:`Opens your tweakcc config file (${j})`},{name:O.OPEN_CLI,desc:`Opens Claude Code's cli.js file`},{name:O.EXIT,desc:`Bye!`}];function z({onSubmit:n,notification:r}){let i=[...l($).changesApplied?[]:[{name:O.APPLY_CHANGES,desc:`Required: Updates Claude Code's cli.js in-place with your changes`,selectedStyles:{color:`green`}}],...L,...R],[a,o]=d(0);return h(e,{flexDirection:`column`,children:[m(e,{marginBottom:1,children:m(I,{children:`Tweak Claude Code`})}),m(e,{marginBottom:1,children:h(t,{color:`gray`,children:[m(t,{bold:!0,children:`Customize your Claude Code installation.`}),` `,m(t,{dimColor:!0,children:`Settings will be saved to a JSON file.`})]})}),m(e,{marginBottom:1,children:h(t,{color:`yellow`,children:[`⭐ `,m(t,{bold:!0,children:`Star the repo at `}),m(f,{url:`https://github.com/Piebald-AI/tweakcc`,fallback:!1,children:m(t,{bold:!0,color:`cyan`,children:`https://github.com/Piebald-AI/tweakcc`})}),m(t,{bold:!0,children:` if you find this useful!`}),` ⭐`]})}),r&&m(e,{marginBottom:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:`bold`,borderColor:r?.type===`success`?`green`:r?.type===`error`?`red`:r?.type===`info`?`blue`:`yellow`,paddingLeft:1,flexDirection:`column`,children:m(t,{color:r?.type===`success`?`green`:r?.type===`error`?`red`:r?.type===`info`?`blue`:`yellow`,children:r?.message})}),m(D,{items:i,selectedIndex:a,onSelect:o,onSubmit:e=>n(e)})]})}function B({theme:n}){return h(e,{flexDirection:`column`,paddingLeft:1,children:[m(e,{marginBottom:1,children:h(t,{bold:!0,children:[`Preview: `,n.name]})}),m(e,{borderStyle:`single`,borderColor:`gray`,paddingX:1,children:h(e,{flexDirection:`column`,children:[m(t,{children:`╭─────────────────────────────────────────────╮`}),h(t,{children:[`│ `,m(t,{color:n.colors.secondaryText,children:`1`}),` `,h(t,{color:n.colors.text,children:[`function greet() `,`{`]}),` `,`│`]}),h(t,{children:[`│ `,m(t,{color:n.colors.secondaryText,children:`2`}),` `,h(t,{backgroundColor:n.colors.diffRemoved,color:n.colors.text,children:[`- console.log("`,m(t,{backgroundColor:n.colors.diffRemovedWord,children:`Hello, World!`}),`");`]}),` `,`│`]}),h(t,{children:[`│ `,m(t,{color:n.colors.secondaryText,children:`2`}),` `,h(t,{backgroundColor:n.colors.diffAdded,color:n.colors.text,children:[`+ console.log("`,m(t,{backgroundColor:n.colors.diffAddedWord,children:`Hello, Claude!`}),`");`]}),` `,`│`]}),m(t,{color:n.colors.warning,children:`╭─────────────────────────────────────────────╮`}),h(t,{color:n.colors.warning,children:[`│ Do you trust the files in this folder?`,` `,`│`]}),h(t,{children:[m(t,{color:n.colors.warning,children:`│ `}),m(t,{dimColor:!0,children:`Enter to confirm · Esc to exit`}),h(t,{color:n.colors.warning,children:[` `,`│`]})]}),m(t,{color:n.colors.claude,children:`╭─────────────────────────────────────────────╮`}),h(t,{children:[m(t,{color:n.colors.claude,children:`│ `}),m(t,{color:n.colors.claude,children:`✻`}),m(t,{children:` Welcome to Tweak Claude Code!`}),h(t,{color:n.colors.claude,children:[` `,`│`]})]}),h(t,{children:[m(t,{color:n.colors.claude,children:`│`}),h(t,{color:n.colors.secondaryText,italic:!0,children:[` `,`/help for help, /status for your current set`]}),m(t,{color:n.colors.claude,children:`│`})]}),h(t,{color:n.colors.success,children:[`Login successful. Press `,m(t,{bold:!0,children:`Enter`}),` to continue…`]}),m(t,{color:n.colors.bashBorder,children:`╭─────────────────────────────────────────────╮`}),h(t,{children:[m(t,{color:n.colors.bashBorder,children:`│ !`}),h(t,{children:[` ls`,` `]}),m(t,{color:n.colors.bashBorder,children:`│`})]}),m(t,{color:n.colors.planMode,children:`╭─────────────────────────────────────────────╮`}),h(t,{children:[m(t,{color:n.colors.planMode,children:`│ `}),m(t,{color:n.colors.permission,children:`Ready to code?`}),h(t,{color:n.colors.planMode,children:[` `,`│`]})]}),h(t,{children:[m(t,{color:n.colors.planMode,children:`│ `}),m(t,{children:`Here is Claude's plan:`}),h(t,{color:n.colors.planMode,children:[` `,`│`]})]}),m(t,{color:n.colors.secondaryBorder,children:`╭─────────────────────────────────────────────╮`}),h(t,{children:[m(t,{color:n.colors.secondaryBorder,children:`│`}),` `,h(t,{color:n.colors.secondaryText,children:[`> Try “refactor <filepath>”`,` `,`│`]})]}),m(t,{color:n.colors.permission,children:`╭─────────────────────────────────────────────╮`}),h(t,{children:[h(t,{color:n.colors.permission,children:[`│ `,m(t,{bold:!0,children:`Permissions:`})]}),` `,h(t,{backgroundColor:n.colors.permission,color:n.colors.inverseText,bold:!0,children:[` `,`Allow`,` `]}),` `,`Deny`,` `,`Workspace`,` `,m(t,{color:n.colors.permission,children:`│`})]}),m(t,{color:n.colors.secondaryText,children:`> list the dir`}),h(t,{children:[m(t,{color:n.colors.error,children:`●`}),m(t,{children:` Update(__init__.py)`})]}),h(t,{children:[m(t,{children:` ⎿ `}),m(t,{color:n.colors.error,children:`User rejected update to __init__.py`})]}),h(t,{children:[` `,m(t,{color:n.colors.secondaryText,children:`1`}),` `,h(t,{backgroundColor:n.colors.diffRemovedDimmed,color:n.colors.text,children:[`- import`,` `,m(t,{backgroundColor:n.colors.diffRemovedWordDimmed,color:n.colors.text,children:`os`})]})]}),h(t,{children:[` `,m(t,{color:n.colors.secondaryText,children:`2`}),` `,h(t,{backgroundColor:n.colors.diffAddedDimmed,color:n.colors.text,children:[`+ import`,` `,m(t,{backgroundColor:n.colors.diffAddedWordDimmed,color:n.colors.text,children:`random`})]})]}),h(t,{children:[m(t,{color:n.colors.success,children:`●`}),m(t,{children:` List(.)`})]}),m(t,{children:` ⎿ Listed 123 paths (ctrl+r to expand)`}),h(t,{children:[m(t,{color:n.colors.secondaryText,children:`●`}),m(t,{children:` The directory `}),m(t,{color:n.colors.permission,children:`C:\\Users\\user`}),m(t,{children:` contains **123** files.`})]}),h(t,{children:[h(t,{color:n.colors.claude,children:[`✻ Th`,m(t,{color:n.colors.claudeShimmer,children:`ink`}),`ing…`,` `]}),m(t,{color:n.colors.secondaryText,children:`(10s · ↑ 456 tokens · esc to interrupt)`})]}),h(t,{children:[h(t,{color:n.colors.autoAccept,children:[`⏵⏵ auto-accept edits on`,` `]}),m(t,{color:n.colors.secondaryText,dimColor:!0,children:`(shift+tab to cycle)`})]}),h(t,{children:[m(t,{color:n.colors.planMode,children:`⏸ plan mode on `}),m(t,{color:n.colors.secondaryText,dimColor:!0,children:`(shift+tab to cycle)`})]}),m(t,{children:m(t,{color:n.colors.ide,children:`◯ IDE connected ⧉ 44 lines selected`})})]})})]})}function V({colorKey:e,theme:n,bold:r=!1}){let i=n.colors[e];return e===`inverseText`?m(t,{color:i,backgroundColor:n.colors.permission,bold:r,children:e}):e.startsWith(`diff`)?m(t,{backgroundColor:i,bold:r,color:n.colors.text,children:e}):m(t,{color:i,bold:r,children:e})}let H=!1;const U=()=>H,W=()=>{H=!0};function G(){try{let e=g.join(v.homedir(),`.claude.json`),t=JSON.parse(b.readFileSync(e,`utf8`));return t.theme||`dark`}catch{}return`dark`}function ee(e){if(process.platform===`win32`)x.spawn(`explorer`,[`/select,`,e],{detached:!0,stdio:`ignore`}).unref();else if(process.platform===`darwin`)x.spawn(`open`,[`-R`,e],{detached:!0,stdio:`ignore`}).unref();else{let t=g.dirname(e);x.spawn(`xdg-open`,[t],{detached:!0,stdio:`ignore`}).unref()}}function K(e){if(!e||typeof e!=`string`)return!1;let t=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(t))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(t)){let e=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(e){let[,t,n,r]=e;return parseInt(t)<=255&&parseInt(n)<=255&&parseInt(r)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t)){let e=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(e){let[,t,n,r]=e;return parseInt(t)<=360&&parseInt(n)<=100&&parseInt(r)<=100}}return!1}function q(e){if(!K(e))return e;let t=e.trim();if(t.startsWith(`rgb(`))return t;if(t.startsWith(`#`)){let e=t.slice(1);e.length===3&&(e=e.split(``).map(e=>e+e).join(``));let n=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),i=parseInt(e.slice(4,6),16);return`rgb(${n},${r},${i})`}if(t.startsWith(`hsl(`)){let e=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(e){let t=parseInt(e[1])/360,n=parseInt(e[2])/100,r=parseInt(e[3])/100,i=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),a=r<.5?r*(1+n):r+n-r*n,o=2*r-a,s=Math.round(i(o,a,t+1/3)*255),c=Math.round(i(o,a,t)*255),l=Math.round(i(o,a,t-1/3)*255);return`rgb(${s},${c},${l})`}}return e}async function te(e,t=`sha256`,n=64*1024){return new Promise((r,i)=>{let a=S.createHash(t),o=b.createReadStream(e,{highWaterMark:n});o.on(`data`,e=>{a.update(e)}),o.on(`end`,()=>{r(a.digest(`hex`))}),o.on(`error`,e=>{i(e)})})}function ne({initialValue:n,onColorChange:i,onExit:a,onCancel:s,colorKey:c,theme:l}){let f=J(n)||{h:0,s:50,l:50},g=re(n)||{r:128,g:128,b:128},[_,v]=d(f),[y,b]=d(g),[x,S]=d(`hsl`),[C,w]=d(`h`),[T,E]=d(!1);u(()=>{let e=J(n),t=re(n);e&&t&&(E(!0),v(e),b(t),E(!1))},[n]),u(()=>{if(!T){let e=`rgb(${y.r},${y.g},${y.b})`;i(e)}},[_,y,T]);let D=e=>{if(K(e)){let t=q(e),n=J(t),r=re(t);n&&r&&(E(!0),v(n),b(r),E(!1))}};r((e,t)=>{if(e.length>1&&!t.ctrl&&!t.meta){D(e);return}if(t.return)a();else if(t.escape)s();else if(t.ctrl&&e===`a`)S(e=>e===`hsl`?`rgb`:`hsl`),w(e=>x===`hsl`?e===`h`?`r`:e===`s`?`g`:`b`:e===`r`?`h`:e===`g`?`s`:`l`);else if(t.upArrow)w(x===`hsl`?e=>e===`h`?`l`:e===`s`?`h`:`s`:e=>e===`r`?`b`:e===`g`?`r`:`g`);else if(t.downArrow||t.tab)w(x===`hsl`?e=>e===`h`?`s`:e===`s`?`l`:`h`:e=>e===`r`?`g`:e===`g`?`b`:`r`);else if(t.leftArrow){let e=t.shift||t.ctrl||t.meta?-10:-1;O(e)}else if(t.rightArrow){let e=t.shift||t.ctrl||t.meta?10:1;O(e)}});let O=e=>{E(!0),x===`hsl`?v(t=>{let n={...t};C===`h`?n.h=Math.max(0,Math.min(359,t.h+e)):C===`s`?n.s=Math.max(0,Math.min(100,t.s+e)):C===`l`&&(n.l=Math.max(0,Math.min(100,t.l+e)));let[r,i,a]=A(n.h,n.s,n.l);return b({r,g:i,b:a}),n}):b(t=>{let n={...t};C===`r`?n.r=Math.max(0,Math.min(255,t.r+e)):C===`g`?n.g=Math.max(0,Math.min(255,t.g+e)):C===`b`&&(n.b=Math.max(0,Math.min(255,t.b+e)));let r=k(n.r,n.g,n.b);return v(r),n}),E(!1)},k=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===r?((i-a)/c+(i<a?6:0))/6:o===i?((a-r)/c+2)/6:((r-i)/c+4)/6),{h:Math.round(d*360),s:Math.round(u*100),l:Math.round(l*100)}},A=(e,t,n)=>{e/=360,t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e*6%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<1/6?(o=r,s=i,c=0):1/6<=e&&e<2/6?(o=i,s=r,c=0):2/6<=e&&e<3/6?(o=0,s=r,c=i):3/6<=e&&e<4/6?(o=0,s=i,c=r):4/6<=e&&e<5/6?(o=i,s=0,c=r):5/6<=e&&e<1&&(o=r,s=0,c=i),[Math.round((o+a)*255),Math.round((s+a)*255),Math.round((c+a)*255)]},j=()=>{let e=[],n=[[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 r=0;r<40;r++){let i=r/39,a=i*(n.length-1),o=Math.floor(a),s=Math.ceil(a),c=a-o,[l,u,d]=n[o],[f,p,h]=n[s],g=Math.round(l+(f-l)*c),_=Math.round(u+(p-u)*c),v=Math.round(d+(h-d)*c);e.push(m(t,{backgroundColor:`rgb(${g},${_},${v})`,children:` `},r))}return e},M=()=>{let e=[];for(let n=0;n<40;n++){let r=n/39*100,[i,a,o]=A(_.h,r,_.l);e.push(m(t,{backgroundColor:`rgb(${i},${a},${o})`,children:` `},n))}return e},N=()=>{let e=[];for(let n=0;n<40;n++){let r=n/39*100,[i,a,o]=A(_.h,_.s,r);e.push(m(t,{backgroundColor:`rgb(${i},${a},${o})`,children:` `},n))}return e},P=()=>{let[e,t,n]=A(_.h,_.s,_.l);return`rgb(${e},${t},${n})`},F=(e,t,n)=>{let r=e=>e.toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},I=()=>{let e=[];for(let n=0;n<40;n++){let r=Math.round(n/39*255);e.push(m(t,{backgroundColor:`rgb(${r},${y.g},${y.b})`,children:` `},n))}return e},L=()=>{let e=[];for(let n=0;n<40;n++){let r=Math.round(n/39*255);e.push(m(t,{backgroundColor:`rgb(${y.r},${r},${y.b})`,children:` `},n))}return e},R=()=>{let e=[];for(let n=0;n<40;n++){let r=Math.round(n/39*255);e.push(m(t,{backgroundColor:`rgb(${y.r},${y.g},${r})`,children:` `},n))}return e},z=(e,t)=>Math.round(e/t*39);return h(e,{flexDirection:`column`,borderStyle:`single`,borderColor:`white`,padding:1,children:[h(e,{flexDirection:`column`,children:[m(t,{bold:!0,children:`Color Picker`}),h(e,{marginBottom:1,flexDirection:`column`,children:[m(t,{color:`gray`,dimColor:!0,children:`←→ to adjust (shift/ctrl/cmd +10)`}),m(t,{color:`gray`,dimColor:!0,children:`↑↓ to change bar`}),m(t,{color:`gray`,dimColor:!0,children:`ctrl+a to switch rgb/hsl`}),m(t,{color:`gray`,dimColor:!0,children:`paste color from clipboard`}),m(t,{color:`gray`,dimColor:!0,children:`enter to exit (auto-saved)`}),m(t,{color:`gray`,dimColor:!0,children:`esc to cancel changes`})]})]}),x===`hsl`?h(p,{children:[h(e,{marginBottom:1,children:[m(e,{width:25,children:h(t,{color:C===`h`?`yellow`:`white`,children:[C===`h`?`❯ `:` `,`Hue (`,_.h,`°):`]})}),m(e,{children:j().map((e,n)=>m(o,{children:n===z(_.h,360)?m(t,{children:`|`}):e},n))})]}),h(e,{marginBottom:1,children:[m(e,{width:25,children:h(t,{color:C===`s`?`yellow`:`white`,children:[C===`s`?`❯ `:` `,`Saturation (`,_.s,`%):`]})}),m(e,{children:M().map((e,n)=>m(o,{children:n===z(_.s,100)?m(t,{children:`|`}):e},n))})]}),h(e,{marginBottom:1,children:[m(e,{width:25,children:h(t,{color:C===`l`?`yellow`:`white`,children:[C===`l`?`❯ `:` `,`Lightness (`,_.l,`%):`]})}),m(e,{children:N().map((e,n)=>m(o,{children:n===z(_.l,100)?m(t,{children:`|`}):e},n))})]})]}):h(p,{children:[h(e,{marginBottom:1,children:[m(e,{width:25,children:h(t,{color:C===`r`?`yellow`:`white`,children:[C===`r`?`❯ `:` `,`Red (`,y.r,`):`]})}),m(e,{children:I().map((e,n)=>m(o,{children:n===z(y.r,255)?m(t,{children:`|`}):e},n))})]}),h(e,{marginBottom:1,children:[m(e,{width:25,children:h(t,{color:C===`g`?`yellow`:`white`,children:[C===`g`?`❯ `:` `,`Green (`,y.g,`):`]})}),m(e,{children:L().map((e,n)=>m(o,{children:n===z(y.g,255)?m(t,{children:`|`}):e},n))})]}),h(e,{marginBottom:1,children:[m(e,{width:25,children:h(t,{color:C===`b`?`yellow`:`white`,children:[C===`b`?`❯ `:` `,`Blue (`,y.b,`):`]})}),m(e,{children:R().map((e,n)=>m(o,{children:n===z(y.b,255)?m(t,{children:`|`}):e},n))})]})]}),h(e,{marginBottom:1,children:[m(t,{children:`Current: `}),m(t,{backgroundColor:P(),children:` `})]}),h(e,{flexDirection:`row`,justifyContent:`space-between`,children:[h(e,{flexDirection:`column`,children:[m(t,{dimColor:!0,children:`Hex `}),c?.startsWith(`diff`)?m(t,{backgroundColor:P(),color:l?.colors?.text||`white`,bold:!0,children:F(y.r,y.g,y.b)}):c===`inverseText`?m(t,{color:P(),backgroundColor:l?.colors?.permission,bold:!0,children:F(y.r,y.g,y.b)}):m(t,{color:P(),bold:!0,children:F(y.r,y.g,y.b)})]}),h(e,{flexDirection:`column`,children:[m(t,{dimColor:!0,children:`RGB `}),c?.startsWith(`diff`)?m(t,{backgroundColor:P(),color:l?.colors?.text||`white`,bold:!0,children:`rgb(${y.r}, ${y.g}, ${y.b})`}):c===`inverseText`?m(t,{color:P(),backgroundColor:l?.colors?.permission,bold:!0,children:`rgb(${y.r}, ${y.g}, ${y.b})`}):m(t,{color:P(),bold:!0,children:`rgb(${y.r}, ${y.g}, ${y.b})`})]}),h(e,{flexDirection:`column`,children:[m(t,{dimColor:!0,children:`HSL `}),c?.startsWith(`diff`)?m(t,{backgroundColor:P(),color:l?.colors?.text||`white`,bold:!0,children:`hsl(${_.h}, ${_.s}%, ${_.l}%)`}):c===`inverseText`?m(t,{color:P(),backgroundColor:l?.colors?.permission,bold:!0,children:`hsl(${_.h}, ${_.s}%, ${_.l}%)`}):m(t,{color:P(),bold:!0,children:`hsl(${_.h}, ${_.s}%, ${_.l}%)`})]})]})]})}function re(e){let t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};let n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){let e=n[1];return{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16)}}return null}function J(e){let t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){let e=parseInt(n[1])/255,t=parseInt(n[2])/255,r=parseInt(n[3])/255,i=Math.max(e,t,r),a=Math.min(e,t,r),o=i-a,s=(i+a)/2,c=0;o!==0&&(c=s>.5?o/(2-i-a):o/(i+a));let l=0;return o!==0&&(l=i===e?((t-r)/o+(t<r?6:0))/6:i===t?((r-e)/o+2)/6:((e-t)/o+4)/6),{h:Math.round(l*360),s:Math.round(c*100),l:Math.round(s*100)}}let r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){let e=r[1],t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,i=parseInt(e.substr(4,2),16)/255,a=Math.max(t,n,i),o=Math.min(t,n,i),s=a-o,c=(a+o)/2,l=0;s!==0&&(l=c>.5?s/(2-a-o):s/(a+o));let u=0;return s!==0&&(u=a===t?((n-i)/s+(n<i?6:0))/6:a===n?((i-t)/s+2)/6:((t-n)/s+4)/6),{h:Math.round(u*360),s:Math.round(l*100),l:Math.round(c*100)}}return{h:0,s:50,l:50}}function ie({onBack:n,themeId:i}){let{settings:{themes:a},updateSettings:o}=l($),[s,u]=d(i),f=a.find(e=>e.id===s)||a[0],[g,_]=d(`rgb`),[v,y]=d(0),[b,x]=d(null),[S,C]=d(null),[w,T]=d(``),[E,D]=d(``),O=c(e=>{o(t=>{let n=t.themes.findIndex(e=>e.id===s);n!==-1&&e(t.themes[n])})},[s,o]),k=e=>{if(v>=2&&K(e)){let t=q(e),n=v-2,r=A[n];O(e=>{e.colors[r]=t})}};r((e,t)=>{if(b===null&&S===null){if(e.length>1&&!t.ctrl&&!t.meta){k(e);return}if(t.escape)n();else if(t.ctrl&&e===`a`)_(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(t.upArrow)y(e=>Math.max(0,e-1));else if(t.downArrow)y(e=>Math.min(A.length+1,e+1));else if(t.return)if(v===0)C(`name`),T(f.name),D(f.name);else if(v===1)C(`id`),T(f.id),D(f.id);else{let e=v-2,t=A[e],n=f.colors[t];x(e),T(n),D(n)}}else if(b!==null)t.ctrl&&e===`a`&&_(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(S!==null)if(t.return){if(S===`id`){let e=s;u(w),o(t=>{let n=t.themes.findIndex(t=>t.id===e);n!==-1&&(t.themes[n].id=w)})}else O(e=>{e.name=w});C(null),T(``),D(``)}else t.escape?(C(null),T(``),D(``)):t.backspace||t.delete?T(e=>e.slice(0,-1)):e&&T(t=>t+e)});let A=Object.keys(f.colors),j=(e,t)=>{let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!n)return e;let r=parseInt(n[1]),i=parseInt(n[2]),a=parseInt(n[3]);switch(t){case`hex`:{let e=e=>e.toString(16).padStart(2,`0`);return`#${e(r)}${e(i)}${e(a)}`}case`hsl`:{let e=r/255,t=i/255,n=a/255,o=Math.max(e,t,n),s=Math.min(e,t,n),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===e?((t-n)/c+(t<n?6:0))/6:o===t?((n-e)/c+2)/6:((e-t)/c+4)/6),`hsl(${Math.round(d*360)}, ${Math.round(u*100)}%, ${Math.round(l*100)}%)`}case`rgb`:default:return e}},M=e=>{let t={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`};return t[e]||``},N=Math.max(...A.map(e=>e.length));return h(e,{children:[h(e,{flexDirection:`column`,width:`50%`,children:[m(e,{children:h(I,{children:[`Editing theme “`,f.name,`” (`,f.id,`)`]})}),b===null&&S===null?h(p,{children:[h(e,{marginBottom:1,flexDirection:`column`,children:[m(t,{dimColor:!0,children:`enter to edit theme name, id, or color`}),m(t,{dimColor:!0,children:`ctrl+a to toggle rgb, hex, hsl`}),m(t,{dimColor:!0,children:`paste color from clipboard (when on color)`}),m(t,{dimColor:!0,children:`esc to go back`})]}),v<2?h(e,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:`yellow`,flexDirection:`column`,paddingLeft:1,children:[m(t,{bold:!0,children:v===0?`Theme Name`:`Theme ID`}),m(t,{children:v===0?`The display name for this theme`:"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):h(e,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:f.colors[A[v-2]],flexDirection:`column`,paddingLeft:1,children:[m(V,{colorKey:A[v-2],theme:f,bold:!0}),m(t,{children:M(A[v-2])})]}),h(e,{flexDirection:`column`,children:[h(e,{children:[m(t,{color:v===0?`yellow`:`white`,children:v===0?`❯ `:` `}),m(t,{bold:!0,children:`Name: `}),m(t,{children:f.name})]}),h(e,{marginBottom:1,children:[m(t,{color:v===1?`yellow`:`white`,children:v===1?`❯ `:` `}),m(t,{bold:!0,children:`ID: `}),m(t,{children:f.id})]}),A.map((n,r)=>{let i=r+2;return h(e,{children:[m(t,{color:v===i?`yellow`:`white`,children:v===i?`❯ `:` `}),m(e,{width:N+2,children:m(t,{children:m(V,{colorKey:n,theme:f,bold:!0})})}),m(t,{color:f.colors[n],children:j(f.colors[n],g)})]},n)})]})]}):S?h(e,{flexDirection:`column`,marginTop:1,children:[h(t,{children:[`Editing `,S===`name`?`theme name`:`theme ID`,`:`]}),m(e,{borderStyle:`round`,borderColor:`yellow`,paddingX:1,children:m(t,{children:w})}),m(t,{dimColor:!0,children:`enter to save, esc to cancel`})]}):m(ne,{initialValue:E,colorKey:A[b],theme:f,onColorChange:e=>{T(e),O(t=>{t.colors[A[b]]=e})},onExit:()=>{O(e=>{e.colors[A[b]]=w}),x(null),T(``),D(``)},onCancel:()=>{O(e=>{e.colors[A[b]]=E}),x(null),T(``),D(``)}})]}),m(e,{width:`50%`,children:m(B,{theme:f})})]})}function ae(e){return e.map(e=>`${e.name} (${e.id})`)}function oe({onBack:n}){let{settings:{themes:i},updateSettings:a}=l($),[o,s]=d(0),[c,u]=d(null),[f,p]=d(!0),g=()=>{let e=i[0]||k.themes[0],t={colors:{...e.colors},name:`New Custom Theme`,id:`custom-${Date.now()}`};a(e=>{e.themes.push(t)}),u(t.id),p(!1)},_=e=>{i.length<=1||(a(t=>{t.themes=t.themes.filter(t=>t.id!==e)}),o>=i.length-1&&s(Math.max(0,i.length-2)))},v=()=>{a(e=>{e.themes=[...k.themes]}),s(0)};if(r((e,t)=>{if(t.escape)n();else if(t.upArrow)s(e=>Math.max(0,e-1));else if(t.downArrow)s(e=>Math.min(i.length-1,e+1));else if(t.return){let e=i[o];e&&(u(e.id),p(!1))}else if(e===`n`)g();else if(e===`d`){let e=i[o];e&&_(e.id)}else t.ctrl&&e===`r`&&v()},{isActive:f}),c)return m(ie,{themeId:c,onBack:()=>{u(null),p(!0)}});let y=ae(i),b=i.find(e=>y[o]?.includes(`(${e.id})`))||i[0];return i.length===0?m(e,{children:h(e,{flexDirection:`column`,width:`100%`,children:[m(I,{children:`Themes`}),h(e,{marginBottom:1,flexDirection:`column`,children:[m(t,{dimColor:!0,children:`n to create a new theme`}),m(t,{dimColor:!0,children:`esc to go back`})]}),m(t,{children:`No themes available!`})]})}):h(e,{children:[h(e,{flexDirection:`column`,width:`50%`,children:[m(I,{children:`Themes`}),h(e,{marginBottom:1,flexDirection:`column`,children:[m(t,{dimColor:!0,children:`n to create a new theme`}),m(t,{dimColor:!0,children:`d to delete a theme`}),m(t,{dimColor:!0,children:`ctrl+r to delete all themes and restore built-in`}),m(t,{dimColor:!0,children:`enter to edit theme`}),m(t,{dimColor:!0,children:`esc to go back`})]}),m(e,{flexDirection:`column`,children:y.map((e,n)=>h(t,{color:o===n?`yellow`:void 0,children:[o===n?`❯ `:` `,e]},n))})]}),m(e,{width:`50%`,children:m(B,{theme:b})})]})}let se=[`ANSI Shadow`];function ce({onBack:n}){let{stdout:a}=i(),o=a?.columns||120,{settings:{launchText:{method:s,figletText:c,figletFont:f,customText:g},themes:_},updateSettings:v}=l($),y=s===`figlet`?[`method`,`text`,`font`]:[`method`,`text`],[b,x]=d(0),S=y[b],[w,T]=d(s===`figlet`?0:1),[E,D]=d(se),[O,k]=d(se),[A,j]=d(``),[M,N]=d(!1),[P,F]=d(0),[L,R]=d(``),[z,B]=d(50),[V,H]=d(!1),[U,W]=d(s===`figlet`?c:g),ee=G(),K=_.find(e=>e.id===ee)||_.find(e=>e.id===`dark`),q=K?.colors.claude||`rgb(215,119,87)`;u(()=>{C.fonts((e,t)=>{if(!e&&t){let e=t.sort();D(e),k(e),se=e;let n=e.indexOf(f);F(n>=0?n:e.indexOf(`ANSI Shadow`)||0)}})},[]),u(()=>{te()},[s,c,f,g,U,V]);let te=()=>{if(s===`figlet`)try{let e=V?U:c,t=C.textSync(e.replace(`
3
- `,` `),{font:f}),n=Math.floor(o*.7),r=t.split(`
4
- `),i=r.map(e=>e.length>n?e.substring(0,n-3)+`…`:e),a=i.join(`
5
- `);R(a);let s=Math.max(...i.map(e=>e.length)),l=Math.min(75,Math.max(50,Math.ceil(s/o*100)));B(l+5)}catch{R(`Error generating figlet text`),B(50)}else{let e=Math.floor(o*.6),t=V?U:g,n=t.split(`
6
- `),r=n.map(t=>t.length>e?t.substring(0,e-3)+`...`:t),i=r.join(`
7
- `);R(i);let a=Math.max(...r.map(e=>e.length)),s=Math.min(75,Math.max(50,Math.ceil(a/o*100)));B(s+5)}};return u(()=>{if(A){let e=E.filter(e=>e.toLowerCase().includes(A.toLowerCase()));k(e),F(0)}else{k(E);let e=E.indexOf(f);F(e>=0?e:0)}},[A,E]),u(()=>{if(!M){let e=O.indexOf(f);e>=0&&F(e)}},[f,O,M]),r((e,t)=>{if(V){t.return?(v(s===`figlet`?e=>{e.launchText.figletText=U}:e=>{e.launchText.customText=U}),H(!1)):t.escape?(W(s===`figlet`?c:g),H(!1)):t.backspace||t.delete?W(e=>e.slice(0,-1)):e&&W(t=>t+e);return}if(M){if(t.return)O.length>0&&v(e=>{e.launchText.figletFont=O[P]}),N(!1),j(``);else if(t.escape)N(!1),j(``);else if(t.backspace||t.delete)j(e=>e.slice(0,-1));else if(t.upArrow){let e=P>0?P-1:O.length-1;F(e),O.length>0&&v(t=>{t.launchText.figletFont=O[e]})}else if(t.downArrow){let e=P<O.length-1?P+1:0;F(e),O.length>0&&v(t=>{t.launchText.figletFont=O[e]})}else e&&e.match(/^[a-zA-Z0-9\s\-_]$/)&&j(t=>t+e);return}if(t.escape)n();else if(t.return)S===`text`&&(W(s===`figlet`?c:g),H(!0));else if(t.tab)t.shift?x(e=>e===0?y.length-1:e-1):x(e=>e===y.length-1?0:e+1);else if(t.upArrow){if(S===`method`){let e=w>0?w-1:1;T(e),v(t=>{t.launchText.method=e===0?`figlet`:`custom`})}else if(S===`font`&&s===`figlet`){let e=P>0?P-1:O.length-1;F(e),v(t=>{t.launchText.figletFont=O[e]})}}else if(t.downArrow){if(S===`method`){let e=w<1?w+1:0;T(e),v(t=>{t.launchText.method=e===0?`figlet`:`custom`})}else if(S===`font`&&s===`figlet`){let e=P<O.length-1?P+1:0;F(e),v(t=>{t.launchText.figletFont=O[e]})}}else e&&S===`font`&&s===`figlet`&&e.match(/^[a-zA-Z0-9]$/)&&(N(!0),j(e))}),h(e,{children:[h(e,{flexDirection:`column`,width:`${100-z}%`,children:[h(e,{marginBottom:1,flexDirection:`column`,children:[m(I,{children:`Setup banner`}),h(e,{flexDirection:`column`,children:[h(t,{dimColor:!0,children:[`enter to `,S===`text`?`edit text`:`save`]}),m(t,{dimColor:!0,children:`esc to go back`}),m(t,{dimColor:!0,children:`tab to switch sections`})]})]}),m(e,{children:h(t,{children:[m(t,{color:S===`method`?`yellow`:void 0,children:S===`method`?`❯ `:` `}),m(t,{bold:!0,color:S===`method`?`yellow`:void 0,children:`Method`})]})}),S===`method`&&h(t,{dimColor:!0,children:[` `,`select one of `,O.length,` Figlet fonts or enter your own text`]}),m(e,{marginLeft:2,marginBottom:1,children:h(e,{flexDirection:`column`,children:[h(t,{color:w===0?`cyan`:`white`,children:[w===0?`❯ `:` `,`Figlet`]}),h(t,{color:w===1?`cyan`:`white`,children:[w===1?`❯ `:` `,`Custom`]})]})}),h(e,{flexDirection:`column`,children:[h(t,{children:[m(t,{color:S===`text`?`yellow`:void 0,children:S===`text`?`❯ `:` `}),m(t,{bold:!0,color:S===`text`?`yellow`:void 0,children:`Text`})]}),S===`text`&&(V?h(t,{dimColor:!0,children:[` `,`esc to save`]}):h(t,{dimColor:!0,children:[` `,`enter to edit`]}))]}),m(e,{marginLeft:2,marginBottom:1,children:m(e,{borderStyle:`round`,borderColor:V?`yellow`:`gray`,children:m(t,{children:V?U:s===`figlet`?c:g})})}),s===`figlet`&&h(p,{children:[m(e,{children:h(e,{flexDirection:`column`,children:[h(t,{children:[m(t,{color:S===`font`?`yellow`:void 0,children:S===`font`?`❯ `:` `}),m(t,{bold:!0,color:S===`font`?`yellow`:void 0,children:`Font`})]}),S===`font`&&h(t,{dimColor:!0,children:[` `,`type to filter`]}),m(t,{children:M&&h(t,{color:`gray`,dimColor:!0,children:[` `,`(filtering: “`,A,`”)`]})})]})}),m(e,{marginLeft:2,marginBottom:1,children:m(e,{flexDirection:`column`,children:(()=>{let e=Math.max(0,P-4),n=Math.min(O.length,e+8),r=Math.max(0,n-8),i=O.slice(r,n);return h(p,{children:[r>0&&h(t,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,n)=>{let i=r+n;return h(t,{color:P===i?`cyan`:void 0,children:[P===i?`❯ `:` `,e]},e)}),n<O.length&&h(t,{color:`gray`,dimColor:!0,children:[` `,`↓ `,O.length-n,` more below`]})]})})()})})]})]}),h(e,{width:`${z}%`,flexDirection:`column`,children:[m(e,{marginBottom:1,children:m(t,{bold:!0,children:`Preview`})}),h(e,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:[h(e,{flexDirection:`column`,marginBottom:1,children:[m(t,{color:q,children:`╭──────────────────────────╮`}),h(t,{children:[m(t,{color:q,children:`│ ✻`}),` Welcome to Claude Code`,` `,m(t,{color:q,children:`│`})]}),m(t,{color:q,children:`╰──────────────────────────╯`})]}),L.split(`
8
- `).map((e,n)=>m(t,{color:q,children:e},n)),m(e,{marginTop:1,children:m(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 le({onBack:n}){let{settings:{thinkingVerbs:{format:i,verbs:a},themes:o},updateSettings:s}=l($),c=[`format`,`verbs`],[u,f]=d(0),g=c[u],[_,v]=d(0),[y,b]=d(!1),[x,S]=d(``),[C,w]=d(!1),[T,E]=d(!1),[D,O]=d(i),A=G(),j=o.find(e=>e.id===A)||o.find(e=>e.id===`dark`),M=j?.colors.claude||`rgb(215,119,87)`;return r((e,t)=>{if(T){t.return?(s(e=>{e.thinkingVerbs.format=D}),E(!1)):t.escape?(O(i),E(!1)):t.backspace||t.delete?O(e=>e.slice(0,-1)):e&&O(t=>t+e);return}if(y||C){t.return&&x.trim()?(C?(s(e=>{e.thinkingVerbs.verbs.push(x.trim())}),w(!1)):(s(e=>{e.thinkingVerbs.verbs[_]=x.trim()}),b(!1)),S(``)):t.escape?(S(``),b(!1),w(!1)):t.backspace||t.delete?S(e=>e.slice(0,-1)):e&&S(t=>t+e);return}t.escape?n():t.return?g===`format`&&(O(i),E(!0)):t.tab?t.shift?f(e=>e===0?c.length-1:e-1):f(e=>e===c.length-1?0:e+1):t.upArrow?g===`verbs`&&a.length>0&&v(e=>e>0?e-1:a.length-1):t.downArrow?g===`verbs`&&a.length>0&&v(e=>e<a.length-1?e+1:0):e===`e`&&g===`verbs`?a.length>0&&(S(a[_]),b(!0)):e===`d`&&g===`verbs`?a.length>1&&(s(e=>{e.thinkingVerbs.verbs=e.thinkingVerbs.verbs.filter((e,t)=>t!==_)}),_>=a.length-1&&v(Math.max(0,a.length-2))):e===`n`&&g===`verbs`?(w(!0),S(``)):t.ctrl&&e===`r`&&g===`verbs`&&(s(e=>{e.thinkingVerbs.verbs=[...k.thinkingVerbs.verbs]}),v(0))}),h(e,{children:[h(e,{flexDirection:`column`,width:`50%`,children:[h(e,{marginBottom:1,flexDirection:`column`,children:[m(I,{children:`Thinking Verbs`}),h(e,{flexDirection:`column`,children:[m(t,{dimColor:!0,children:g===`format`?`enter to edit format`:`changes auto-saved`}),m(t,{dimColor:!0,children:`esc to go back`}),m(t,{dimColor:!0,children:`tab to switch sections`})]})]}),m(e,{marginBottom:1,children:m(t,{dimColor:!0,children:`Customize the verbs shown during generation and their format.`})}),h(e,{flexDirection:`column`,children:[h(t,{children:[m(t,{color:g===`format`?`yellow`:void 0,children:g===`format`?`❯ `:` `}),m(t,{bold:!0,color:g===`format`?`yellow`:void 0,children:`Format`})]}),g===`format`&&(T?h(t,{dimColor:!0,children:[` `,`enter to save`]}):h(t,{dimColor:!0,children:[` `,`enter to edit`]}))]}),m(e,{marginLeft:2,marginBottom:1,children:m(e,{borderStyle:`round`,borderColor:T?`yellow`:`gray`,children:m(t,{children:T?D:i})})}),m(e,{children:h(t,{children:[m(t,{color:g===`verbs`?`yellow`:void 0,children:g===`verbs`?`❯ `:` `}),m(t,{bold:!0,color:g===`verbs`?`yellow`:void 0,children:`Verbs`})]})}),g===`verbs`&&m(e,{flexDirection:`column`,children:h(t,{dimColor:!0,children:[` `,`e to edit · d to delete · n to add new · ctrl+r to reset`]})}),m(e,{marginLeft:2,marginBottom:1,children:h(e,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,_-4),n=Math.min(a.length,e+8),r=Math.max(0,n-8),i=a.slice(r,n);return h(p,{children:[r>0&&h(t,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,n)=>{let i=r+n;return h(t,{color:g===`verbs`&&i===_?`cyan`:void 0,children:[g===`verbs`&&i===_?`❯ `:` `,e]},i)}),n<a.length&&h(t,{color:`gray`,dimColor:!0,children:[` `,`↓ `,a.length-n,` more below`]})]})})(),C&&h(e,{alignItems:`center`,children:[m(t,{color:`yellow`,children:`❯ `}),m(e,{borderStyle:`round`,borderColor:`yellow`,children:m(t,{children:x})})]}),y&&h(e,{marginTop:1,alignItems:`center`,children:[m(t,{children:`Editing: `}),m(e,{borderStyle:`round`,borderColor:`yellow`,children:m(t,{children:x})})]})]})})]}),h(e,{width:`50%`,flexDirection:`column`,children:[m(e,{marginBottom:1,children:m(t,{bold:!0,children:`Preview`})}),m(e,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:h(t,{children:[h(t,{color:M,children:[`✻ `,i.replace(/\{\}/g,a[_]),` `]}),m(t,{color:j?.colors.secondaryText,children:`(10s · ↑ 456 tokens · esc to interrupt)`})]})})]})]})}const Y=[{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 ue({onBack:n}){let{settings:{thinkingStyle:{phases:i,updateInterval:a,reverseMirror:o},themes:s},updateSettings:c}=l($),f=[`reverseMirror`,`updateInterval`,`phases`,`presets`],[g,_]=d(0),v=f[g],[y,b]=d(0),[x,S]=d(0),[C,w]=d(!1),[T,E]=d(``),[D,O]=d(!1),[A,j]=d(!1),[M,N]=d(a.toString()),[P,F]=d(0),L=G(),R=s.find(e=>e.id===L)||s.find(e=>e.id===`dark`),z=R?.colors.claude||`rgb(215,119,87)`;u(()=>{if(i.length>0){let e=o?[...i,...[...i].reverse().slice(1,-1)]:i,t=setInterval(()=>{F(t=>(t+1)%e.length)},a);return()=>clearInterval(t)}},[i,a,o]),r((e,t)=>{if(A){if(t.return){let e=parseInt(M);!isNaN(e)&&e>0&&c(t=>{t.thinkingStyle.updateInterval=e}),j(!1)}else t.escape?(N(a.toString()),j(!1)):t.backspace||t.delete?N(e=>e.slice(0,-1)):e&&e.match(/^[0-9]$/)&&N(t=>t+e);return}if(C||D){if(t.return&&T.length){let e=D?[...i,T]:i.map((e,t)=>t===y?T:e);c(t=>{t.thinkingStyle.phases=e}),w(!1),E(``)}else t.escape?(E(``),w(!1),O(!1)):t.backspace||t.delete?E(e=>e.slice(0,-1)):e&&E(t=>t+e);return}if(t.escape)n();else if(t.return)if(v===`updateInterval`)N(a.toString()),j(!0);else if(v===`presets`){let e=Y[x];c(t=>{t.thinkingStyle.phases=[...e.phases],t.thinkingStyle.reverseMirror=e.reverseMirror})}else v===`reverseMirror`&&c(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(t.tab)t.shift?_(e=>e===0?f.length-1:e-1):_(e=>e===f.length-1?0:e+1);else if(t.upArrow)v===`phases`&&i.length>0?b(e=>e>0?e-1:i.length-1):v===`presets`&&S(e=>e>0?e-1:Y.length-1);else if(t.downArrow)v===`phases`&&i.length>0?b(e=>e<i.length-1?e+1:0):v===`presets`&&S(e=>e<Y.length-1?e+1:0);else if(e===` `)v===`reverseMirror`&&c(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(e===`e`&&v===`phases`)i.length>0&&(E(i[y]),w(!0));else if(e===`a`&&v===`phases`)O(!0),E(``);else if(e===`d`&&v===`phases`)i.length>1&&(c(e=>{e.thinkingStyle.phases=i.filter((e,t)=>t!==y)}),y>=i.length&&b(Math.max(0,i.length-1)));else if(e===`w`&&v===`phases`){if(y>0){let e=[...i];[e[y-1],e[y]]=[e[y],e[y-1]],c(t=>{t.thinkingStyle.phases=e}),b(e=>e-1)}}else if(e===`s`&&v===`phases`){if(y<i.length-1){let e=[...i];[e[y],e[y+1]]=[e[y+1],e[y]],c(t=>{t.thinkingStyle.phases=e}),b(e=>e+1)}}else t.ctrl&&e===`r`&&(c(e=>{e.thinkingStyle=k.thinkingStyle}),b(0),S(0))});let B=o?`●`:`○`,V=()=>o?[...i,...[...i].reverse().slice(1,-1)]:i,H=V(),U=H.length>0?H[P]:`·`;return m(e,{children:h(e,{flexDirection:`column`,width:`100%`,children:[h(e,{flexDirection:`row`,width:`100%`,children:[h(e,{marginBottom:1,flexDirection:`column`,width:`50%`,children:[m(I,{children:`Thinking style`}),h(e,{flexDirection:`column`,children:[h(t,{dimColor:!0,children:[`enter to`,` `,v===`updateInterval`?`edit interval`:v===`presets`?`apply preset`:`save`]}),m(t,{dimColor:!0,children:`esc to go back`}),m(t,{dimColor:!0,children:`tab to switch sections`})]})]}),h(e,{width:`50%`,flexDirection:`column`,children:[m(e,{children:m(t,{bold:!0,children:`Preview`})}),h(e,{borderStyle:`single`,borderColor:`gray`,paddingX:1,flexDirection:`row`,children:[m(e,{width:(U?.length??0)+1,children:m(t,{color:z,children:U})}),h(t,{children:[m(t,{color:z,children:`Thinking… `}),m(t,{color:R?.colors.secondaryText,children:`(esc to interrupt)`})]})]})]})]}),h(e,{flexDirection:`row`,gap:4,children:[h(e,{flexDirection:`column`,children:[h(t,{children:[m(t,{color:v===`reverseMirror`?`yellow`:void 0,children:v===`reverseMirror`?`❯ `:` `}),m(t,{bold:!0,color:v===`reverseMirror`?`yellow`:void 0,children:`Reverse-mirror phases`})]}),v===`reverseMirror`&&h(t,{dimColor:!0,children:[` `,`space to toggle`]}),m(e,{marginLeft:2,marginBottom:1,children:h(t,{children:[B,` `,o?`Enabled`:`Disabled`]})})]}),h(e,{flexDirection:`column`,children:[h(t,{children:[m(t,{color:v===`updateInterval`?`yellow`:void 0,children:v===`updateInterval`?`❯ `:` `}),m(t,{bold:!0,color:v===`updateInterval`?`yellow`:void 0,children:`Update interval (ms)`})]}),v===`updateInterval`&&(A?h(t,{dimColor:!0,children:[` `,`enter to save`]}):h(t,{dimColor:!0,children:[` `,`enter to edit`]})),m(e,{marginLeft:2,marginBottom:1,children:m(e,{borderStyle:`round`,borderColor:A?`yellow`:`gray`,children:m(t,{children:A?M:a})})})]})]}),m(e,{children:h(t,{children:[m(t,{color:v===`phases`?`yellow`:void 0,children:v===`phases`?`❯ `:` `}),m(t,{bold:!0,color:v===`phases`?`yellow`:void 0,children:`Phases`})]})}),v===`phases`&&m(e,{marginBottom:1,flexDirection:`column`,children:h(t,{dimColor:!0,children:[` `,`[e]dit`,` `,`[a]dd`,` `,`[d]elete`,` `,`[w]move up`,` `,`[s]move down`]})}),m(e,{marginLeft:2,marginBottom:1,children:h(e,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,y-4),n=Math.min(i.length,e+8),r=Math.max(0,n-8),a=i.slice(r,n);return h(p,{children:[r>0&&h(t,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),a.map((e,n)=>{let i=r+n;return h(t,{color:v===`phases`&&i===y?`cyan`:void 0,children:[v===`phases`&&i===y?`❯ `:` `,e]},i)}),n<i.length&&h(t,{color:`gray`,dimColor:!0,children:[` `,`↓ `,i.length-n,` more below`]})]})})(),D&&h(e,{children:[m(t,{color:`yellow`,children:`❯ `}),m(e,{borderStyle:`round`,borderColor:`yellow`,children:m(t,{children:T})})]}),C&&h(e,{marginTop:1,children:[m(t,{children:`Editing: `}),m(e,{borderStyle:`round`,borderColor:`yellow`,children:m(t,{children:T})})]})]})}),m(e,{children:h(t,{children:[m(t,{color:v===`presets`?`yellow`:void 0,children:v===`presets`?`❯ `:` `}),m(t,{bold:!0,color:v===`presets`?`yellow`:void 0,children:`Presets`})]})}),v===`presets`&&h(t,{dimColor:!0,children:[` `,`Selecting one will overwrite your choice of phases`]}),m(e,{marginLeft:2,marginBottom:1,children:m(e,{flexDirection:`column`,children:(()=>{let e=Math.max(0,x-4),n=Math.min(Y.length,e+8),r=Math.max(0,n-8),i=Y.slice(r,n);return h(p,{children:[r>0&&h(t,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,n)=>{let i=r+n;return h(t,{color:v===`presets`&&i===x?`cyan`:void 0,children:[v===`presets`&&i===x?`❯ `:` `,e.name,` `,e.phases.join(``)]},i)}),n<Y.length&&h(t,{color:`gray`,dimColor:!0,children:[` `,`↓ `,Y.length-n,` more below`]})]})})()})}),m(e,{marginTop:1,children:m(t,{dimColor:!0,children:`ctrl+r to reset all settings to default`})})]})})}const de=async()=>{await T.mkdir(A,{recursive:!0})};let X={settings:k,changesApplied:!1,ccVersion:``,lastModified:``,ccInstallationDir:null};const fe=async()=>{let e={ccVersion:``,ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:k};try{U()&&console.log(`Reading config at ${j}`);let t=await T.readFile(j,`utf8`),n={...e,...JSON.parse(t)},r=n?.settings?.thinkingVerbs;r?.punctuation&&(r.format=`{}`+r.punctuation,delete r.punctuation);for(let e of k.themes){let t=n?.settings?.themes.find(t=>t.id===e.id||t.name===e.name);if(t)for(let[n,r]of Object.entries(e))Object.hasOwn(t,n)||(t[n]=r)}return X=n,n}catch(t){if(t instanceof Error&&`code`in t&&t.code===`ENOENT`)return e;throw t}},Z=async e=>(U()&&console.log(`Updating config at ${j}`),e(X),X.lastModified=new Date().toISOString(),await pe(X),X),pe=async e=>{try{e.lastModified=new Date().toISOString(),await de(),await T.writeFile(j,JSON.stringify(e,null,2))}catch(e){throw console.error(`Error saving config:`,e),e}},me=async e=>(U()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`),await T.copyFile(M,e.cliPath),await Z(e=>{e.changesApplied=!1}),!0),he=async e=>{e.ccInstallationDir&&P.unshift(e.ccInstallationDir);for(let e of P)try{U()&&console.log(`Searching for Claude Code cli.js file at ${e}`);let t=_.join(e,`cli.js`),n=_.join(e,`package.json`),r=JSON.parse(await T.readFile(n,`utf8`));return U()&&(console.log(`Found Claude Code cli.js file at ${e}; checking hash...`),console.log(`SHA256 hash: ${await te(t)}`)),{cliPath:t,packageJsonPath:n,version:r.version}}catch{continue}return null},ge=async e=>{await de(),U()&&console.log(`Backing up cli.js to ${M}`),await T.copyFile(e.cliPath,M),await Z(t=>{t.changesApplied=!1,t.ccVersion=e.version})};async function _e(e){try{return await T.stat(e),!0}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return!1;throw e}}async function ve(){let e=await fe(),t=await he(e);if(!t)return null;let n=t.version,r=e.ccVersion,i=!1;return await _e(M)||(U()&&console.log(`startupCheck: ${M} not found; backing up cli.js`),await ge(t),i=!0),n===r?{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}:(i||(U()&&console.log(`startupCheck: real version (${n}) != backed up version (${r}); backing up cli.js`),await T.unlink(M),await ge(t)),{wasUpdated:!0,oldVersion:r,newVersion:n,ccInstInfo:t})}function ye(e){let t=e.indexOf(` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
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 je,useContext as ge,useEffect as ie,useState as M}from"react";import or from"ink-link";import{Fragment as le,jsx as n,jsxs as s}from"react/jsx-runtime";import*as Se from"node:path";import ke from"node:path";import*as we from"node:os";import{globbySync as ee}from"globby";import*as Ye from"node:fs";import*as _e from"node:child_process";import*as ir from"node:crypto";import De from"figlet";import*as Pe 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 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}},Ne=Se.join(we.homedir(),".tweakcc"),se=Se.join(Ne,"config.json"),pe=Se.join(Ne,"cli.js.backup"),lr=()=>{const e=[],o=process.platform=="win32"?we.homedir().replace(/\\/g,"/"):we.homedir(),r="node_modules/@anthropic-ai/claude-code";return e.push(`${we.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},Ie=lr(),cr=({children:e,...o})=>s(t,{bold:!0,backgroundColor:"#ffd500",color:"#000",...o,children:[" ",e," "]});var de=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 (${se})`},{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=[...ge(he).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(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 ze({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 Fe({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 He=!1;const ae=()=>He,gr=()=>{He=!0};function Ce(){try{const e=Se.join(we.homedir(),".claude.json");return JSON.parse(Ye.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function Ue(e){if(process.platform==="win32")_e.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")_e.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const o=Se.dirname(e);_e.spawn("xdg-open",[o],{detached:!0,stdio:"ignore"}).unref()}}function Oe(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 Je(e){if(!Oe(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=Ye.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 Ge=(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 Xe({initialValue:e,onColorChange:o,onExit:r,colorKey:i,theme:l}){const d=Ae(e)||{h:0,s:50,l:50},h=Me(e)||{r:128,g:128,b:128},[g,p]=M(d),[a,I]=M(h),[D,_]=M("hsl"),[v,B]=M("h"),[R,T]=M(!1),[k,P]=M(!1);ie(()=>{const b=Ae(e),f=Me(e);b&&f&&(T(!0),p(b),I(f),T(!1))},[e]),ie(()=>{if(!R&&k){const b=`rgb(${a.r},${a.g},${a.b})`;o(b)}},[g,a,R,k]),ie(()=>{P(!0)},[]);const H=b=>{if(Oe(b)){const f=Je(b),m=Ae(f),C=Me(f);m&&C&&(T(!0),p(m),I(C),T(!1))}};ce((b,f)=>{if(b.length>1&&!f.ctrl&&!f.meta){H(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),J=Math.round(Z+(L-Z)*S),V=Math.round(oe+(N-oe)*S);b.push(n(t,{backgroundColor:`rgb(${O},${J},${V})`,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)}`},U=()=>{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},G=()=>{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(le,{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(le,{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:U().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:G().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 Me(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 Ae(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}=ge(he),[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),[R,T]=M(""),[k,P]=M(""),H=je(A=>{i(y=>{const x=y.themes.findIndex(U=>U.id===l);x!==-1&&A(y.themes[x])})},[l,i]),z=A=>{if(a>=2&&Oe(A)){const y=Je(A),x=a-2,U=W[x];H(G=>{G.colors[U]=y})}};ce((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,U=W[x],G=h.colors[U];_(x),T(G),P(G)}}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(R),i(U=>{const G=U.themes.findIndex(Q=>Q.id===x);G!==-1&&(U.themes[G].id=R)})}else H(x=>{x.name=R});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 U=parseInt(x[1]),G=parseInt(x[2]),Q=parseInt(x[3]);switch(y){case"hex":{const j=b=>b.toString(16).padStart(2,"0");return`#${j(U)}${j(G)}${j(Q)}`}case"hsl":{const j=U/255,b=G/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(de,{children:["Editing theme “",h.name,"” (",h.id,")"]})}),D===null&&v===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[W[a-2]],flexDirection:"column",paddingLeft:1,children:[n(Fe,{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(Fe,{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:R})}),n(t,{dimColor:!0,children:"enter to save, esc to cancel"})]}):n(Xe,{initialValue:k,colorKey:W[D],theme:h,onColorChange:A=>{T(A),H(y=>{y.colors[W[D]]=A})},onExit:()=>{H(A=>{A.colors[W[D]]=R}),_(null),T(""),P("")}})]}),n(c,{width:"50%",children:n(ze,{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]=M(0),[d,h]=M(null),[g,p]=M(!0),a=()=>{const R={colors:{...(o[0]||q.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};r(T=>{T.themes.push(R)}),h(R.id),p(!1)},I=B=>{o.length<=1||(r(R=>{R.themes=R.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(ce((B,R)=>{if(R.escape)e();else if(R.upArrow)l(T=>Math.max(0,T-1));else if(R.downArrow)l(T=>Math.min(o.length-1,T+1));else if(R.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 R.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(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,R)=>s(t,{color:i===R?"yellow":void 0,children:[i===R?"❯ ":" ",B]},R))})]}),n(c,{width:"50%",children:n(ze,{theme:v})})]})}let $e=["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}=ge(he),a=i==="figlet"?["method","text","font"]:["method","text"],[I,D]=M(0),_=a[I],[v,B]=M(i==="figlet"?0:1),[R,T]=M($e),[k,P]=M($e),[H,z]=M(""),[W,X]=M(!1),[F,K]=M(0),[A,y]=M(""),[x,U]=M(50),[G,Q]=M(!1),[j,b]=M(i==="figlet"?l:h),f=Ce(),C=(g.find(w=>w.id===f)||g.find(w=>w.id==="dark"))?.colors.claude||"rgb(215,119,87)";ie(()=>{De.fonts((w,$)=>{if(!w&&$){const S=$.sort();T(S),P(S),$e=S;const E=S.indexOf(d);K(E>=0?E:S.indexOf("ANSI Shadow")||0)}})},[]),ie(()=>{u()},[i,l,d,h,j,G]);const u=()=>{if(i==="figlet")try{const w=G?j:l,$=De.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)));U(L+5)}catch{y("Error generating figlet text"),U(50)}else{const w=Math.floor(r*.6),E=(G?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)));U(te+5)}};return ie(()=>{if(H){const w=R.filter($=>$.toLowerCase().includes(H.toLowerCase()));P(w),K(0)}else{P(R);const w=R.indexOf(d);K(w>=0?w:0)}},[H,R]),ie(()=>{if(!W){const w=k.indexOf(d);w>=0&&K(w)}},[d,k,W]),ce((w,$)=>{if(G){$.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)k.length>0&&p(S=>{S.launchText.figletFont=k[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:k.length-1;K(S),k.length>0&&p(E=>{E.launchText.figletFont=k[S]})}else if($.downArrow){const S=F<k.length-1?F+1:0;K(S),k.length>0&&p(E=>{E.launchText.figletFont=k[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:k.length-1;K(S),p(E=>{E.launchText.figletFont=k[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<k.length-1?F+1:0;K(S),p(E=>{E.launchText.figletFont=k[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(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 ",k.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"&&(G?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:G?"yellow":"gray",children:n(t,{children:G?j: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:W&&s(t,{color:"gray",dimColor:!0,children:[" ","(filtering: “",H,"”)"]})})]})}),n(c,{marginLeft:2,marginBottom:1,children:n(c,{flexDirection:"column",children:(()=>{const $=Math.max(0,F-Math.floor(4)),S=Math.min(k.length,$+8),E=Math.max(0,S-8),Z=k.slice(E,S);return s(le,{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<k.length&&s(t,{color:"gray",dimColor:!0,children:[" ","↓ ",k.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}=ge(he),d=["format","verbs"],[h,g]=M(0),p=d[h],[a,I]=M(0),[D,_]=M(!1),[v,B]=M(""),[R,T]=M(!1),[k,P]=M(!1),[H,z]=M(o),W=Ce(),X=i.find(A=>A.id===W)||i.find(A=>A.id==="dark"),F=X?.colors.claude||"rgb(215,119,87)";ce((A,y)=>{if(k){y.return?(l(x=>{x.thinkingVerbs.format=H}),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||R){y.return&&v.trim()?(R?(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((U,G)=>G!==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(de,{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"&&(k?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:k?"yellow":"gray",children:n(t,{children:k?H: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),U=Math.max(0,x-8),G=r.slice(U,x);return s(le,{children:[U>0&&s(t,{color:"gray",dimColor:!0,children:[" ","↑ ",U," more above"]}),G.map((Q,j)=>{const b=U+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"]})]})})(),R&&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}=ge(he),h=["reverseMirror","updateInterval","phases","presets"],[g,p]=M(0),a=h[g],[I,D]=M(0),[_,v]=M(0),[B,R]=M(!1),[T,k]=M(""),[P,H]=M(!1),[z,W]=M(!1),[X,F]=M(r.toString()),[K,A]=M(0),y=Ce(),x=l.find(m=>m.id===y)||l.find(m=>m.id==="dark"),U=x?.colors.claude||"rgb(215,119,87)";ie(()=>{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]),ce((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}),R(!1),k("")}else C.escape?(k(""),R(!1),H(!1)):C.backspace||C.delete?k(u=>u.slice(0,-1)):m&&k(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&&(k(o[I]),R(!0));else if(m==="a"&&a==="phases")H(!0),k("");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 G=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(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:U,children:f})}),s(t,{children:[n(t,{color:U,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:[G," ",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(le,{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(le,{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 be=[{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]=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]),[R,T]=M(()=>o.userMessageDisplay.prefix.foreground_color),[k,P]=M(()=>o.userMessageDisplay.prefix.background_color),[H,z]=M(0),[W,X]=M(0),[F,K]=M(()=>[...o.userMessageDisplay.message.styling]),[A,y]=M(()=>o.userMessageDisplay.message.foreground_color),[x,U]=M(()=>o.userMessageDisplay.message.background_color),[G,Q]=M(null),[j,b]=M(""),f=Ce(),m=o.themes?.find(L=>L.id===f)||o.themes?.[0],C=["format","styling","foreground","background"],u=["styling","foreground","background"],w=C[d],$=u[H],S=(L,N)=>{r(O=>{const J=L==="prefix"?O.userMessageDisplay.prefix:O.userMessageDisplay.message;N(J)})},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),U(q.userMessageDisplay.message.background_color))};ie(()=>{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),U(N.background_color)},[]),ce((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(G===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(R),Q({column:"prefix",type:"foreground"})):w==="background"&&(b(k),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(be.length-1,O+1)):i==="message"&&$==="styling"&&X(O=>Math.min(be.length-1,O+1));else if(L===" "){if(i==="prefix"&&w==="styling"){const O=be[D].value,J=v.indexOf(O)>=0?v.filter(V=>V!==O):[...v,O];B(J),S("prefix",V=>{V.styling=[...J]})}else if(i==="message"&&$==="styling"){const O=be[W].value,J=F.indexOf(O)>=0?F.filter(V=>V!==O):[...F,O];K(J),S("message",V=>{V.styling=[...J]})}}}});const Z=(L,N,O=!0)=>{const J=O?N==="prefix"?v:F:[],V=O?N==="prefix"?R:A:"rgb(255,255,255)",ye=O?N==="prefix"?k:x:"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:V,backgroundColor:ye,children:L})},oe=(L=!0)=>s(t,{children:[a&&s(le,{children:[Z(a,"prefix",L)," "]}),Z("list the dir","message",L)]}),te=L=>{const N=i===L,V=(L==="prefix"?C:u)[L==="prefix"?d:H],ye=L==="prefix"?D:W,Qe=L==="prefix"?v:F,Ee=L==="prefix"?R:A,Le=L==="prefix"?k: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(le,{children:[n(c,{children:s(t,{color:N&&V==="format"?"yellow":void 0,bold:N&&V==="format",children:[N&&V==="format"?"❯ ":" ","Prefix Text"]})}),N&&V==="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&&V==="styling"?"yellow":void 0,bold:N&&V==="styling",children:[N&&V==="styling"?"❯ ":" ","Styling"]})}),N&&V==="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:be.map((Te,Re)=>n(c,{children:s(t,{color:N&&V==="styling"&&ye===Re?"cyan":void 0,children:[N&&V==="styling"&&ye===Re?"❯ ":" ",Qe.includes(Te.value)?"●":"○"," ",Te.label]})},Te.value))}),n(c,{children:s(t,{color:N&&V==="foreground"?"yellow":void 0,bold:N&&V==="foreground",children:[N&&V==="foreground"?"❯ ":" ","Foreground color"]})}),N&&V==="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:Ee,children:Ee})}),n(c,{children:s(t,{color:N&&V==="background"?"yellow":void 0,bold:N&&V==="background",children:[N&&V==="background"?"❯ ":" ","Background color"]})}),N&&V==="background"&&n(c,{marginLeft:2,children:n(t,{dimColor:!0,children:"enter to open color picker"})}),n(c,{marginLeft:2,children:n(t,{backgroundColor:Le,children:Le})})]})};if(G){const{column:L,type:N}=G;return n(Xe,{initialValue:j,theme:m,onColorChange:O=>{L==="prefix"?N==="foreground"?(T(O),S("prefix",J=>{J.foreground_color=O})):(P(O),S("prefix",J=>{J.background_color=O})):N==="foreground"?(y(O),S("message",J=>{J.foreground_color=O})):(U(O),S("message",J=>{J.background_color=O}))},onExit:()=>{Q(null),b("")}})}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]=M(0),d=()=>{r(g=>{g.inputBox||(g.inputBox={removeBorder:!1}),g.inputBox.removeBorder=!g.inputBox.removeBorder})};ce((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(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 Ke=async()=>{await ue.mkdir(Ne,{recursive:!0})};let xe={settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const Be=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:q};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=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),xe=r,r}catch(o){if(o instanceof Error&&"code"in o&&o.code==="ENOENT")return e;throw o}},ve=async e=>(ae()&&console.log(`Updating config at ${se}`),e(xe),xe.lastModified=new Date().toISOString(),await Ir(xe),xe),Ir=async e=>{try{e.lastModified=new Date().toISOString(),await Ke(),await ue.writeFile(se,JSON.stringify(e,null,2))}catch(o){throw console.error("Error saving config:",o),o}},Ze=async e=>(ae()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`),await ue.copyFile(pe,e.cliPath),await ve(o=>{o.changesApplied=!1}),!0),Cr=async e=>{e.ccInstallationDir&&Ie.unshift(e.ccInstallationDir);for(const o of Ie)try{ae()&&console.log(`Searching for Claude Code cli.js file at ${o}`);const r=ke.join(o,"cli.js"),i=ke.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},Ve=async e=>{await Ke(),ae()&&console.log(`Backing up cli.js to ${pe}`),await ue.copyFile(e.cliPath,pe),await ve(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 We(){const e=await Be(),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 Ve(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 Ve(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
  ██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝
@@ -16,24 +16,27 @@ import{Box as e,Text as t,render as n,useInput as r,useStdout as i}from"ink";imp
16
16
  ██║ ██║ ██║██║ ██║█████╗
17
17
  ██║ ██║ ██║██║ ██║██╔══╝
18
18
  ╚██████╗╚██████╔╝██████╔╝███████╗
19
- ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`);return t===-1?null:{startIndex:t-1,endIndex:t+495+1}}function be(e,t){let n=ye(e);if(!n)return e;let r=JSON.stringify(t),i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i}function xe(e){let t=/" Welcome to ",[$\w]+\.createElement\([^,]+,\{bold:!0\},"Claude Code"\),"!"/,n=e.match(t);if(n&&n.index!==void 0){let e=n[0].indexOf(`"Claude Code"`);if(e!==-1)return{startIndex:n.index+e,endIndex:n.index+e+13}}return null}function Se(e,t){let n=xe(e);if(!n)return console.error(`patch: welcome message: failed to find location`),null;let r=`"${t}"`,i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i}function Ce(e){let t=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,n=e.match(t);if(!n||n.index==null)return console.error(`patch: themes: failed to find switchMatch`),null;let r=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,i=/return\{(?:[\w$]+?:"(?:Dark|Light).+?",?)+\}/,a=e.match(r),o=e.match(i);return!a||a.index==null?(console.error(`patch: themes: failed to find objArrMatch`),null):!o||o.index==null?(console.error(`patch: themes: failed to find objMatch`),null):{switchStatement:{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1].trim()]},objArr:{startIndex:a.index,endIndex:a.index+a[0].length},obj:{startIndex:o.index,endIndex:o.index+o[0].length}}}const we=(e,t)=>{let n=Ce(e);if(!n)return null;if(t.length===0)return e;let r=e,i=`return`+JSON.stringify(Object.fromEntries(t.map(e=>[e.id,e.name])));r=r.slice(0,n.obj.startIndex)+i+r.slice(n.obj.endIndex),Q(e,r,i,n.obj.startIndex,n.obj.endIndex),e=r;let a=JSON.stringify(t.map(e=>({label:e.name,value:e.id})));r=r.slice(0,n.objArr.startIndex)+a+r.slice(n.objArr.endIndex),Q(e,r,a,n.objArr.startIndex,n.objArr.endIndex),e=r;let o=`switch(${n.switchStatement.identifiers?.[0]}){\n`;return t.forEach(e=>{o+=`case"${e.id}":return${JSON.stringify(e.colors)};\n`}),o+=`default:return${JSON.stringify(t[0].colors)};\n}`,r=r.slice(0,n.switchStatement.startIndex)+o+r.slice(n.switchStatement.endIndex),Q(e,r,o,n.switchStatement.startIndex,n.switchStatement.endIndex),r},Te=e=>{let t=[],n=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g,r;for(;(r=n.exec(e))!==null;)t.push({startIndex:r.index,endIndex:r.index+r[0].length});return t},Ee=(e,t)=>{let n=Te(e);if(n.length===0)return null;let r=JSON.stringify(t),i=n.sort((e,t)=>t.startIndex-e.startIndex),a=e;for(let e=0;e<i.length;e++){let t=a.slice(0,i[e].startIndex)+r+a.slice(i[e].endIndex);Q(a,t,r,i[e].startIndex,i[e].endIndex),a=t}return a},De=e=>{let t=/[\w$]+\(\(\)=>\{if\(![\w$]+\)\{[\w$]+\(\d+\);return\}[\w$]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,n=e.match(t);if(!n||n.index==null)return console.error(`patch: thinker symbol speed: failed to find match`),null;let r=n[0],i=n[1],a=r.lastIndexOf(i),o=n.index+a,s=o+i.length;return{startIndex:o,endIndex:s}},Oe=(e,t)=>{let n=De(e);if(!n)return null;let r=JSON.stringify(t),i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i},ke=e=>{let t=/[\w$]+\(\(\)=>\{if\(![\w$]+\)\{[\w$]+\(\d+\);return\}[\w$]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error(`patch: spinner no-freeze: failed to find wholeMatch`),null;let r=/if\(![\w$]+\)\{[\w$]+\(\d+\);return\}/,i=n[0].match(r);if(!i||i.index===void 0)return console.error(`patch: spinner no-freeze: failed to find freeze condition`),null;let a=n.index+i.index,o=a+i[0].length;return{startIndex:a,endIndex:o}},Ae=e=>{let t=ke(e);if(!t)return null;let n=e.slice(0,t.startIndex)+e.slice(t.endIndex);return Q(e,n,``,t.startIndex,t.endIndex),n},je=e=>{let t=/([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,n=e.match(t);return!n||n.index==null?(console.error(`patch: thinker verbs: failed to find verbsMatch`),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Me=e=>{let t=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,n=e.match(t);return!n||n.index==null?(console.error(`patch: thinker verbs: failed to find match`),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Ne=(e,t)=>{let n=je(e);if(!n)return null;let r=n,i=r.identifiers?.[0],a=`${i}=${JSON.stringify({words:t})}`,o=e.slice(0,r.startIndex)+a+e.slice(r.endIndex);Q(e,o,a,r.startIndex,r.endIndex);let s=Me(o);if(!s)return null;let c=s,l=c.identifiers?.[0],u=`function ${l}(){return ${i}.words}`,d=o.slice(0,c.startIndex)+u+o.slice(c.endIndex);return Q(o,d,u,c.startIndex,c.endIndex),d},Pe=e=>{let t=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,n=e.match(t);if(!n||n.index==null)return console.error(`patch: thinker format: failed to find approxAreaMatch`),null;let r=e.slice(n.index,n.index+600),i=/([$\w]+)(=\(([^;]{1,200}?)\)\+"…")/,a=r.match(i);return!a||a.index==null?(console.error(`patch: thinker format: failed to find formatMatch`),null):{startIndex:n.index+a.index+a[1].length,endIndex:n.index+a.index+a[1].length+a[2].length,identifiers:[a[3]]}},Fe=(e,t)=>{let n=Pe(e);if(!n)return null;let r=n,i=t.replace(/\\/g,`\\\\`).replace(/`/g,"\\`"),a=r.identifiers?.[0],o="`"+i.replace(/\{\}/g,"${"+a+`}`)+"`",s=`=${o}`,c=e.slice(0,r.startIndex)+s+e.slice(r.endIndex);return Q(e,c,s,r.startIndex,r.endIndex),c},Ie=e=>{let t=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,n=e.match(t);return!n||n.index==null?(console.error(`patch: thinker symbol mirror option: failed to find match`),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Le=(e,t)=>{let n=Ie(e);if(!n)return null;let r=n.identifiers?.[0],i=t?`=[...${r},...[...${r}].reverse()]`:`=[...${r}]`,a=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return Q(e,a,i,n.startIndex,n.endIndex),a},Re=e=>{let t=/\{flexWrap:"wrap",height:1,width:2\}/,n=e.match(t);return!n||n.index==null?(console.error(`patch: thinker symbol width: failed to find match`),null):{startIndex:n.index,endIndex:n.index+n[0].length}},ze=(e,t)=>{let n=Re(e);if(!n)return null;let r=`{flexWrap:"wrap",height:1,width:${t}}`,i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return Q(e,i,r,n.startIndex,n.endIndex),i};function Q(e,t,n,r,i){let a=Math.max(0,r-20),o=Math.min(e.length,i+20),s=Math.min(t.length,r+n.length+20),c=e.slice(a,r),l=e.slice(r,i),u=e.slice(i,o),d=t.slice(a,r),f=t.slice(r,r+n.length),p=t.slice(r+n.length,s);U()&&(console.log(`
20
- --- Diff ---`),console.log(`OLD:`,c+`\x1b[31m${l}\x1b[0m`+u),console.log(`NEW:`,d+`\x1b[32m${f}\x1b[0m`+p),console.log(`--- End Diff ---
21
- `))}const Be=e=>{let t=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,n=e.match(t);if(!n||n.index===void 0)return console.error(`patch: verbose: failed to find createElement with spinnerTip and overrideMessage`),null;let r=n[0],i=/verbose:[^,}]+/,a=r.match(i);if(!a||a.index===void 0)return console.error(`patch: verbose: failed to find verbose property`),null;let o=n.index+a.index,s=o+a[0].length;return{startIndex:o,endIndex:s}},Ve=e=>{let t=Be(e);if(!t)return null;let n=`verbose:true`,r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return Q(e,r,n,t.startIndex,t.endIndex),r},He=e=>{let t=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,n=e.match(t);return!n||n.index===void 0?(console.error(`patch: context limit: failed to find match`),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1],n[2],n[3]]}},Ue=e=>{let t=He(e);if(!t)return null;let n=t.identifiers?.[0],r=t.identifiers?.[1],i=t.identifiers?.[2],a=`function ${n}(${r}){if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);${i}}`,o=e.slice(0,t.startIndex)+a+e.slice(t.endIndex);return Q(e,o,a,t.startIndex,t.endIndex),o},We=async(e,t)=>{await me(t);let n=await w.readFile(t.cliPath,{encoding:`utf8`}),r=null;if(e.settings.themes&&e.settings.themes.length>0&&(r=we(n,e.settings.themes))&&(n=r),e.settings.launchText){let t=e.settings.launchText,i=``;t.method===`custom`&&t.customText?i=t.customText:t.method===`figlet`&&t.figletText&&(i=await new Promise(e=>C.text(t.figletText.replace(`
22
- `,` `),t.figletFont,(t,n)=>{t?(console.error(`patch: figlet: failed to generate text`,t),e(``)):e(n||``)}))),(r=be(n,i))&&(n=r);let a=t.method===`custom`?t.customText:t.figletText;a&&(r=Se(n,a))&&(n=r)}return e.settings.thinkingVerbs&&((r=Ne(n,e.settings.thinkingVerbs.verbs))&&(n=r),(r=Fe(n,e.settings.thinkingVerbs.format))&&(n=r)),(r=Ee(n,e.settings.thinkingStyle.phases))&&(n=r),(r=Oe(n,e.settings.thinkingStyle.updateInterval))&&(n=r),(r=ze(n,Math.max(...e.settings.thinkingStyle.phases.map(e=>e.length))+1))&&(n=r),(r=Le(n,e.settings.thinkingStyle.reverseMirror))&&(n=r),(r=Ve(n))&&(n=r),(r=Ae(n))&&(n=r),(r=Ue(n))&&(n=r),await w.writeFile(t.cliPath,n),await Z(e=>{e.changesApplied=!0})},$=s({settings:k,updateSettings:e=>{},changesApplied:!1});function Ge({startupCheckInfo:t}){let[n,i]=d({settings:k,changesApplied:!1,ccVersion:``,lastModified:``,ccInstallationDir:null});u(()=>{let e=async()=>{i(await fe())};e()},[]);let a=c(e=>{let t=JSON.parse(JSON.stringify(n.settings));e(t),i(e=>({...e,settings:t,changesApplied:!1})),Z(e=>{e.settings=t,e.changesApplied=!1})},[n.settings]),[o,s]=d(null),[l,f]=d(null);u(()=>{t.wasUpdated&&t.oldVersion&&(f({message:`Your Claude Code installation was updated from ${t.oldVersion} to ${t.newVersion}, and the patching was likely overwritten
23
- (However, your customization are still remembered in ${j}.)
24
- Please reapply your changes below.`,type:`warning`}),a(()=>{}))},[]),r((e,t)=>{(t.ctrl&&e===`c`||(e===`q`||t.escape)&&!o)&&process.exit(0)});let p=e=>{switch(f(null),e){case O.THEMES:case O.LAUNCH_TEXT:case O.THINKING_VERBS:case O.THINKING_STYLE:s(e);break;case O.APPLY_CHANGES:t.ccInstInfo&&(f({message:`Applying patches...`,type:`info`}),We(n,t.ccInstInfo).then(e=>{i(e),f({message:`Customization patches applied successfully!`,type:`success`})}));break;case O.RESTORE_ORIGINAL:t.ccInstInfo&&me(t.ccInstInfo).then(()=>{f({message:`Original Claude Code restored successfully!`,type:`success`}),a(()=>{})});break;case O.OPEN_CONFIG:ee(j);break;case O.OPEN_CLI:t.ccInstInfo&&ee(t.ccInstInfo.cliPath);break;case O.EXIT:process.exit(0)}},h=()=>{s(null)};return m($.Provider,{value:{settings:n.settings,updateSettings:a,changesApplied:n.changesApplied},children:m(e,{flexDirection:`column`,children:o===null?m(z,{onSubmit:p,notification:l}):o===O.THEMES?m(oe,{onBack:h}):o===O.LAUNCH_TEXT?m(ce,{onBack:h}):o===O.THINKING_VERBS?m(le,{onBack:h}):o===O.THINKING_STYLE?m(ue,{onBack:h}):null})})}const Ke=async()=>{let e=new a;e.name(`tweakcc`).description(`Command-line tool to customize your Claude Code theme colors, thinking verbs and more.`).version(`1.3.0`).option(`-d, --debug`,`enable debug mode`).option(`-a, --apply`,`apply saved customizations without interactive UI`),e.parse();let t=e.opts();if(t.debug&&W(),t.apply){console.log(E.cyan(`🔧 Applying saved customizations to Claude Code...`));try{let e=await fe();(!e.settings||Object.keys(e.settings).length===0)&&(console.error(E.red(`❌ No saved customizations found in `+j)),process.exit(1));let t=await ve();(!t||!t.ccInstInfo)&&(console.error(E.red(`❌ Cannot find Claude Code's cli.js`)),console.error(E.yellow(`Searched at the following locations:`)),P.forEach(e=>console.error(E.gray(` - `+e))),process.exit(1)),console.log(E.gray(`📁 Found Claude Code at: ${t.ccInstInfo.cliPath}`)),console.log(E.gray(`📦 Version: ${t.ccInstInfo.version}`)),console.log(E.gray(`✓ Backup handled by startup check`)),console.log(E.cyan(`🎨 Applying customizations...`));try{await We(e,t.ccInstInfo),console.log(E.green(`✅ Customizations applied successfully!`)),console.log(E.gray(`💾 Configuration saved at: ${j}`))}catch(e){console.error(E.red(`❌ Failed to apply patches:`)),console.error(E.red(e instanceof Error?e.message:String(e))),e instanceof Error&&e.message.includes(`patch:`)&&(console.log(E.yellow(`⚠️ Some patches failed to apply, but the file was updated.`)),console.log(E.yellow(` This may happen if Claude Code was updated.`)),console.log(E.gray(` Run tweakcc interactively to review and update your customizations.`)))}process.exit(0)}catch(e){console.error(E.red(`❌ Unexpected error:`)),console.error(E.red(e instanceof Error?e.message:String(e))),process.exit(1)}}let r=await ve();r?n(m(Ge,{startupCheckInfo:r})):(console.error(`\x1b[31mCannot find Claude Code's cli.js -- do you have Claude Code installed?
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
+ `;return o.forEach(g=>{h+=`case"${g.id}":return${JSON.stringify(g.colors)};
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 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);ae()&&(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,R=!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 k=Kr(e);if(!k)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 H=r==="rgb(0,0,0)"&&i==="rgb(0,0,0)",z=l||d||h||g||p,W=!H||z,X=a==="rgb(0,0,0)"&&I==="rgb(0,0,0)",F=D||_||v||B||R,K=!X||F;if(W){const y=Ge(k,H?null:r.match(/\d+/g)?.join(",")||null,H?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=Ge(k,X?null:a.match(/\d+/g)?.join(",")||null,X?null:I.match(/\d+/g)?.join(",")||null,D,_,v,B,R);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 Ze(o);let r=await Pe.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=>De.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)}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),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 Pe.writeFile(o.cliPath,r),await ve(l=>{l.changesApplied=!0})},he=tr({settings:q,updateSettings:e=>{},changesApplied:!1});function rn({startupCheckInfo:e}){const[o,r]=M({settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});ie(()=>{(async()=>{r(await Be())})()},[]);const i=je(I=>{const D=JSON.parse(JSON.stringify(o.settings));I(D),r(_=>({..._,settings:D,changesApplied:!1})),ve(_=>{_.settings=D,_.changesApplied=!1})},[o.settings]),[l,d]=M(null),[h,g]=M(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((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&&Ze(e.ccInstInfo).then(()=>{g({message:"Original Claude Code restored successfully!",type:"success"}),i(()=>{})});break;case Y.OPEN_CONFIG:Ue(se);break;case Y.OPEN_CLI:e.ccInstInfo&&Ue(e.ccInstInfo.cliPath);break;case Y.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: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.1").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 Be();(!i.settings||Object.keys(i.settings).length===0)&&(console.error(re.red("❌ No saved customizations found in "+se)),process.exit(1));const l=await We();(!l||!l.ccInstInfo)&&(console.error(re.red("❌ Cannot find Claude Code's cli.js")),console.error(re.yellow("Searched at the following locations:")),Ie.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 We();r?er(n(rn,{startupCheckInfo:r})):(console.error(`\x1B[31mCannot find Claude Code's cli.js -- do you have Claude Code installed?
25
28
 
26
29
  Searched at the following locations:
27
- ${P.map(e=>`- `+e).join(`
30
+ ${Ie.map(i=>"- "+i).join(`
28
31
  `)}
29
32
 
30
33
  If you have it installed but it's in a location not listed above, please open an issue at
31
34
  https://github.com/piebald-ai/tweakcc/issues and tell us where you have it--we'll add that
32
35
  location to our search list and release an update today! Or you can specify the path to its
33
- \`cli.js\` file in ${j}:
36
+ \`cli.js\` file in ${se}:
34
37
 
35
38
  {
36
- "ccInstallationDir": "${process.platform==`win32`?`C:\\\\absolute\\\\path\\\\to\\\\node_modules\\\\@anthropic-ai\\\\claude-code`:`/absolute/path/to/node_modules/+@anthropic-ai/claude-code`}"
39
+ "ccInstallationDir": "${process.platform=="win32"?"C:\\\\absolute\\\\path\\\\to\\\\node_modules\\\\@anthropic-ai\\\\claude-code":"/absolute/path/to/node_modules/+@anthropic-ai/claude-code"}"
37
40
  }
38
41
 
39
42
  Notes:
@@ -41,4 +44,4 @@ Notes:
41
44
 
42
45
  - Don't specify the path to your Claude Code executable's directory. It needs to be the path
43
46
  to the folder that contains **cli.js**.
44
- \x1b[0m`),process.exit(1))};Ke();
47
+ \x1B[0m`),process.exit(1))};nn();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tweakcc",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
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",