tweakcc 1.5.4 → 1.6.0

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 +1 -1
  2. package/dist/index.js +19 -19
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -44,7 +44,7 @@ $ pnpm dlx tweakcc
44
44
 
45
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.
46
46
 
47
- `tweakcc` is verified to work with Claude Code **1.0.117.**
47
+ `tweakcc` is verified to work with Claude Code **1.0.128.**
48
48
 
49
49
  ## Running
50
50
 
package/dist/index.js CHANGED
@@ -1,14 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import{Box as a,Text as i,render as rn,useInput as le,useStdout as tn}from"ink";import{Command as on}from"commander";import{Fragment as ue,createContext as sn,useCallback as Ye,useContext as de,useEffect as oe,useState as _}from"react";import ln from"ink-link";import{Fragment as se,jsx as o,jsxs as l}from"react/jsx-runtime";import*as Ie from"node:path";import Pe from"node:path";import*as Se from"node:os";import{globbySync as cn}from"globby";import*as ze from"node:fs";import*as xe from"node:fs/promises";import he from"node:fs/promises";import*as Te from"node:child_process";import*as an from"node:crypto";import Ae from"figlet";function dn({items:n,selectedIndex:t,onSelect:e,onSubmit:r}){return le((s,c)=>{c.upArrow?e(t>0?t-1:n.length-1):c.downArrow?e(t<n.length-1?t+1:0):c.return&&r(n[t].name)}),o(a,{flexDirection:"column",children:n.map((s,c)=>o(a,{children:l(i,{children:[l(i,{bold:c===t,color:c===t?"cyan":void 0,...c===t?s.selectedStyles??{}:s.styles??{},children:[c===t?"❯ ":" ",s.name]}),s.desc&&c===t&&l(i,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",s.desc]})]})},c))})}let Y=function(n){return n.THEMES="Themes",n.LAUNCH_TEXT="Launch text",n.THINKING_VERBS="Thinking verbs",n.THINKING_STYLE="Thinking style",n.USER_MESSAGE_DISPLAY="User message display",n.INPUT_BOX="Input box",n.APPLY_CHANGES="*Apply customizations to cli.js",n.RESTORE_ORIGINAL="Restore original Claude Code (preserves tweakcc.json)",n.OPEN_CONFIG="Open tweakcc.json",n.OPEN_CLI="Open Claude Code's cli.js",n.EXIT="Exit",n}({});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}},De=Ie.join(Se.homedir(),".tweakcc"),ie=Ie.join(De,"config.json"),fe=Ie.join(De,"cli.js.backup"),hn=()=>{const n=[],t=process.platform=="win32"?Se.homedir().replace(/\\/g,"/"):Se.homedir(),e="node_modules/@anthropic-ai/claude-code",r=(s,c=!1)=>{if(c){const h=cn(s,{onlyFiles:!1});n.push({pattern:s,isGlob:!0,expandedPaths:h})}else n.push({pattern:s,isGlob:!1,expandedPaths:[s]})};return r(`${Se.homedir()}/.claude/local/${e}`),{}.NPM_PREFIX&&r(`${{}.NPM_PREFIX}/lib/${e}`),{}.N_PREFIX&&r(`${{}.N_PREFIX}/lib/${e}`),{}.VOLTA_HOME&&r(`${{}.VOLTA_HOME}/lib/${e}`),{}.FNM_DIR&&r(`${{}.FNM_DIR}/lib/${e}`),{}.NVM_DIR&&r(`${{}.NVM_DIR}/lib/${e}`),{}.NODENV_ROOT&&r(`${{}.NODENV_ROOT}/versions/*/lib/${e}`,!0),{}.NVS_HOME&&r(`${{}.NVS_HOME}/node/*/*/lib/${e}`,!0),{}.ASDF_DATA_DIR&&r(`${{}.ASDF_DATA_DIR}/installs/nodejs/*/lib/${e}`,!0),process.platform=="win32"?(r(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${e}`),r(`${t}/AppData/Roaming/npm/${e}`),r(`${t}/AppData/Roaming/nvm/*/${e}`,!0),r(`${t}/AppData/Local/Yarn/config/global/${e}`),r(`${t}/AppData/Local/pnpm/global/*/${e}`,!0),r(`${t}/n/versions/node/*/lib/${e}`,!0),r(`${t}/AppData/Roaming/Yarn/config/global/${e}`),r(`${t}/AppData/Roaming/pnpm-global/${e}`),r(`${t}/AppData/Roaming/pnpm-global/*/${e}`,!0),r(`${t}/.bun/install/global/${e}`),r(`${t}/AppData/Local/fnm_multishells/*/node_modules/${e}`,!0)):(process.platform=="darwin"&&(r(`${t}/Library/${e}`),r(`/opt/local/lib/${e}`)),r(`${t}/.local/lib/${e}`),r(`${t}/.local/share/${e}`),r(`${t}/.npm-global/lib/${e}`),r(`${t}/.npm-packages/lib/${e}`),r(`${t}/.npm/lib/${e}`),r(`${t}/npm/lib/${e}`),r(`/etc/${e}`),r(`/lib/${e}`),r(`/opt/node/lib/${e}`),r(`/usr/lib/${e}`),r(`/usr/local/lib/${e}`),r(`/usr/share/${e}`),r(`/var/lib/${e}`),r(`/opt/homebrew/lib/${e}`),r(`${t}/.config/yarn/global/${e}`),r(`${t}/.yarn/global/${e}`),r(`${t}/.bun/install/global/${e}`),r(`${t}/.pnpm-global/${e}`),r(`${t}/.pnpm-global/*/${e}`,!0),r(`${t}/pnpm-global/${e}`),r(`${t}/pnpm-global/*/${e}`,!0),r(`${t}/.local/share/pnpm/global/${e}`),r(`${t}/.local/share/pnpm/global/*/${e}`,!0),r(`${t}/.bun/install/global/${e}`),r(`/usr/local/n/versions/node/*/lib/${e}`,!0),r(`${t}/n/versions/node/*/lib/${e}`,!0),r(`${t}/n/lib/${e}`),r(`${t}/.volta/tools/image/node/*/lib/${e}`,!0),r(`${t}/.fnm/node-versions/*/installation/lib/${e}`,!0),r(`/usr/local/nvm/versions/node/*/lib/${e}`,!0),r(`${t}/.nvm/versions/node/*/lib/${e}`,!0),r(`${t}/.nodenv/versions/*/lib/${e}`,!0),r(`${t}/.nvs/*/lib/${e}`,!0),r(`${t}/.asdf/installs/nodejs/*/lib/${e}`,!0)),process.platform=="win32"&&n.forEach(s=>{s.pattern=s.pattern.replace(/\//g,"\\"),s.expandedPaths=s.expandedPaths.map(c=>c.replace(/\//g,"\\"))}),n},Ne=hn(),Ue=Ne.flatMap(n=>n.expandedPaths),gn=({children:n,...t})=>l(i,{bold:!0,backgroundColor:"#ffd500",color:"#000",...t,children:[" ",n," "]});var ce=gn;const un=[{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)"}],fn=[{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 (${ie})`},{name:Y.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:Y.EXIT,desc:"Bye!"}];function mn({onSubmit:n,notification:t}){const e=[...de(ae).changesApplied?[]:[{name:Y.APPLY_CHANGES,desc:"Required: Updates Claude Code's cli.js in-place with your changes",selectedStyles:{color:"green"}}],...un,...fn],[r,s]=_(0);return l(a,{flexDirection:"column",children:[o(a,{marginBottom:1,children:o(ce,{children:"Tweak Claude Code"})}),o(a,{marginBottom:1,children:l(i,{color:"gray",children:[o(i,{bold:!0,children:"Customize your Claude Code installation."})," ",o(i,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),o(a,{marginBottom:1,children:l(i,{color:"yellow",children:["⭐ ",o(i,{bold:!0,children:"Star the repo at "}),o(ln,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:o(i,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),o(i,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),t&&o(a,{marginBottom:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:"bold",borderColor:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",paddingLeft:1,flexDirection:"column",children:o(i,{color:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",children:t?.message})}),o(dn,{items:e,selectedIndex:r,onSelect:s,onSubmit:c=>n(c)})]})}function He({theme:n}){return l(a,{flexDirection:"column",paddingLeft:1,children:[o(a,{marginBottom:1,children:l(i,{bold:!0,children:["Preview: ",n.name]})}),o(a,{borderStyle:"single",borderColor:"gray",paddingX:1,children:l(a,{flexDirection:"column",children:[o(i,{children:"╭─────────────────────────────────────────────╮"}),l(i,{children:["│ ",o(i,{color:n.colors.secondaryText,children:"1"})," ",l(i,{color:n.colors.text,children:["function greet() ","{"]})," ","│"]}),l(i,{children:["│ ",o(i,{color:n.colors.secondaryText,children:"2"})," ",l(i,{backgroundColor:n.colors.diffRemoved,color:n.colors.text,children:['- console.log("',o(i,{backgroundColor:n.colors.diffRemovedWord,children:"Hello, World!"}),'");']})," ","│"]}),l(i,{children:["│ ",o(i,{color:n.colors.secondaryText,children:"2"})," ",l(i,{backgroundColor:n.colors.diffAdded,color:n.colors.text,children:['+ console.log("',o(i,{backgroundColor:n.colors.diffAddedWord,children:"Hello, Claude!"}),'");']})," ","│"]}),o(i,{color:n.colors.warning,children:"╭─────────────────────────────────────────────╮"}),l(i,{color:n.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),l(i,{children:[o(i,{color:n.colors.warning,children:"│ "}),o(i,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),l(i,{color:n.colors.warning,children:[" ","│"]})]}),o(i,{color:n.colors.claude,children:"╭─────────────────────────────────────────────╮"}),l(i,{children:[o(i,{color:n.colors.claude,children:"│ "}),o(i,{color:n.colors.claude,children:"✻"}),o(i,{children:" Welcome to Tweak Claude Code!"}),l(i,{color:n.colors.claude,children:[" ","│"]})]}),l(i,{children:[o(i,{color:n.colors.claude,children:"│"}),l(i,{color:n.colors.secondaryText,italic:!0,children:[" ","/help for help, /status for your current set"]}),o(i,{color:n.colors.claude,children:"│"})]}),l(i,{color:n.colors.success,children:["Login successful. Press ",o(i,{bold:!0,children:"Enter"})," to continue…"]}),o(i,{color:n.colors.bashBorder,children:"╭─────────────────────────────────────────────╮"}),l(i,{children:[o(i,{color:n.colors.bashBorder,children:"│ !"}),l(i,{children:[" ls"," "]}),o(i,{color:n.colors.bashBorder,children:"│"})]}),o(i,{color:n.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),l(i,{children:[o(i,{color:n.colors.planMode,children:"│ "}),o(i,{color:n.colors.permission,children:"Ready to code?"}),l(i,{color:n.colors.planMode,children:[" ","│"]})]}),l(i,{children:[o(i,{color:n.colors.planMode,children:"│ "}),o(i,{children:"Here is Claude's plan:"}),l(i,{color:n.colors.planMode,children:[" ","│"]})]}),o(i,{color:n.colors.secondaryBorder,children:"╭─────────────────────────────────────────────╮"}),l(i,{children:[o(i,{color:n.colors.secondaryBorder,children:"│"})," ",l(i,{color:n.colors.secondaryText,children:["> Try “refactor <filepath>”"," ","│"]})]}),o(i,{color:n.colors.permission,children:"╭─────────────────────────────────────────────╮"}),l(i,{children:[l(i,{color:n.colors.permission,children:["│ ",o(i,{bold:!0,children:"Permissions:"})]})," ",l(i,{backgroundColor:n.colors.permission,color:n.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",o(i,{color:n.colors.permission,children:"│"})]}),o(i,{color:n.colors.secondaryText,children:"> list the dir"}),l(i,{children:[o(i,{color:n.colors.error,children:"●"}),o(i,{children:" Update(__init__.py)"})]}),l(i,{children:[o(i,{children:" ⎿ "}),o(i,{color:n.colors.error,children:"User rejected update to __init__.py"})]}),l(i,{children:[" ",o(i,{color:n.colors.secondaryText,children:"1"})," ",l(i,{backgroundColor:n.colors.diffRemovedDimmed,color:n.colors.text,children:["- import"," ",o(i,{backgroundColor:n.colors.diffRemovedWordDimmed,color:n.colors.text,children:"os"})]})]}),l(i,{children:[" ",o(i,{color:n.colors.secondaryText,children:"2"})," ",l(i,{backgroundColor:n.colors.diffAddedDimmed,color:n.colors.text,children:["+ import"," ",o(i,{backgroundColor:n.colors.diffAddedWordDimmed,color:n.colors.text,children:"random"})]})]}),l(i,{children:[o(i,{color:n.colors.success,children:"●"}),o(i,{children:" List(.)"})]}),o(i,{children:" ⎿ Listed 123 paths (ctrl+r to expand)"}),l(i,{children:[o(i,{color:n.colors.secondaryText,children:"●"}),o(i,{children:" The directory "}),o(i,{color:n.colors.permission,children:"C:\\Users\\user"}),l(i,{children:[" ","contains ",o(i,{bold:!0,children:"123"})," files."]})]}),l(i,{children:[l(i,{color:n.colors.claude,children:["✻ Th",o(i,{color:n.colors.claudeShimmer,children:"ink"}),"ing…"," "]}),o(i,{color:n.colors.secondaryText,children:"(10s · ↑ 456 tokens · esc to interrupt)"})]}),l(i,{children:[l(i,{color:n.colors.autoAccept,children:["⏵⏵ auto-accept edits on"," "]}),o(i,{color:n.colors.secondaryText,dimColor:!0,children:"(shift+tab to cycle)"})]}),l(i,{children:[o(i,{color:n.colors.planMode,children:"⏸ plan mode on "}),o(i,{color:n.colors.secondaryText,dimColor:!0,children:"(shift+tab to cycle)"})]}),o(i,{children:o(i,{color:n.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Ge({colorKey:n,theme:t,bold:e=!1}){const r=t.colors[n];return n==="inverseText"?o(i,{color:r,backgroundColor:t.colors.permission,bold:e,children:n}):n.startsWith("diff")?o(i,{backgroundColor:r,bold:e,color:t.colors.text,children:n}):o(i,{color:r,bold:e,children:n})}let Je=!1;const te=()=>Je,pn=()=>{Je=!0};function Ce(){try{const n=Ie.join(Se.homedir(),".claude.json");return JSON.parse(ze.readFileSync(n,"utf8")).theme||"dark"}catch{}return"dark"}function Fe(n){if(process.platform==="win32")Te.spawn("explorer",["/select,",n],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Te.spawn("open",["-R",n],{detached:!0,stdio:"ignore"}).unref();else{const t=Ie.dirname(n);Te.spawn("xdg-open",[t],{detached:!0,stdio:"ignore"}).unref()}}function Ee(n){if(!n||typeof n!="string")return!1;const t=n.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)){const e=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(e){const[,r,s,c]=e;return parseInt(r)<=255&&parseInt(s)<=255&&parseInt(c)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t)){const e=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(e){const[,r,s,c]=e;return parseInt(r)<=360&&parseInt(s)<=100&&parseInt(c)<=100}}return!1}function Xe(n){if(!Ee(n))return n;const t=n.trim();if(t.startsWith("rgb("))return t;if(t.startsWith("#")){let e=t.slice(1);e.length===3&&(e=e.split("").map(h=>h+h).join(""));const r=parseInt(e.slice(0,2),16),s=parseInt(e.slice(2,4),16),c=parseInt(e.slice(4,6),16);return`rgb(${r},${s},${c})`}if(t.startsWith("hsl(")){const e=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(e){const r=parseInt(e[1])/360,s=parseInt(e[2])/100,c=parseInt(e[3])/100,h=(C,v,D)=>(D<0&&(D+=1),D>1&&(D-=1),D<1/6?C+(v-C)*6*D:D<1/2?v:D<2/3?C+(v-C)*(2/3-D)*6:C),g=c<.5?c*(1+s):c+s-c*s,f=2*c-g,d=Math.round(h(f,g,r+1/3)*255),I=Math.round(h(f,g,r)*255),A=Math.round(h(f,g,r-1/3)*255);return`rgb(${d},${I},${A})`}}return n}async function bn(n,t="sha256",e=64*1024){return new Promise((r,s)=>{const c=an.createHash(t),h=ze.createReadStream(n,{highWaterMark:e});h.on("data",g=>{c.update(g)}),h.on("end",()=>{r(c.digest("hex"))}),h.on("error",g=>{s(g)})})}const Ve=(n,t,e,r,s,c,h,g)=>{let f=n;return t&&(f+=`.rgb(${t})`),e&&e!=="transparent"&&(f+=`.bgRgb(${e})`),r&&(f+=".bold"),s&&(f+=".italic"),c&&(f+=".underline"),h&&(f+=".strikethrough"),g&&(f+=".inverse"),f};async function Ke(n,t,e="replace"){let r=493;try{r=(await xe.stat(n)).mode,te()&&console.log(`[${e}] Original file mode for ${n}: ${(r&parseInt("777",8)).toString(8)}`)}catch(s){te()&&console.log(`[${e}] Could not stat ${n} (error: ${s}), using default mode 755`)}try{await xe.unlink(n),te()&&console.log(`[${e}] Unlinked ${n} to break hard links`)}catch(s){te()&&console.log(`[${e}] Could not unlink ${n}: ${s}`)}await xe.writeFile(n,t),await xe.chmod(n,r),te()&&console.log(`[${e}] Restored permissions to ${(r&parseInt("777",8)).toString(8)}`)}function Ze({initialValue:n,onColorChange:t,onExit:e,colorKey:r,theme:s}){const c=$e(n)||{h:0,s:50,l:50},h=_e(n)||{r:128,g:128,b:128},[g,f]=_(c),[d,I]=_(h),[A,C]=_("hsl"),[v,D]=_("h"),[k,T]=_(!1),[R,P]=_(!1);oe(()=>{const b=$e(n),m=_e(n);b&&m&&(T(!0),f(b),I(m),T(!1))},[n]),oe(()=>{if(!k&&R){const b=`rgb(${d.r},${d.g},${d.b})`;t(b)}},[g,d,k,R]),oe(()=>{P(!0)},[]);const H=b=>{if(Ee(b)){const m=Xe(b),p=$e(m),M=_e(m);p&&M&&(T(!0),f(p),I(M),T(!1))}};le((b,m)=>{if(b.length>1&&!m.ctrl&&!m.meta){H(b);return}if(m.return)e();else if(m.escape)e();else if(m.ctrl&&b==="a")C(p=>p==="hsl"?"rgb":"hsl"),D(p=>A==="hsl"?p==="h"?"r":p==="s"?"g":"b":p==="r"?"h":p==="g"?"s":"l");else if(m.upArrow)D(A==="hsl"?p=>p==="h"?"l":p==="s"?"h":"s":p=>p==="r"?"b":p==="g"?"r":"g");else if(m.downArrow||m.tab)D(A==="hsl"?p=>p==="h"?"s":p==="s"?"l":"h":p=>p==="r"?"g":p==="g"?"b":"r");else if(m.leftArrow){const p=m.shift||m.ctrl||m.meta?-10:-1;J(p)}else if(m.rightArrow){const p=m.shift||m.ctrl||m.meta?10:1;J(p)}});const J=b=>{T(!0),A==="hsl"?f(m=>{const p={...m};v==="h"?p.h=Math.max(0,Math.min(359,m.h+b)):v==="s"?p.s=Math.max(0,Math.min(100,m.s+b)):v==="l"&&(p.l=Math.max(0,Math.min(100,m.l+b)));const[M,u,w]=X(p.h,p.s,p.l);return I({r:M,g:u,b:w}),p}):I(m=>{const p={...m};v==="r"?p.r=Math.max(0,Math.min(255,m.r+b)):v==="g"?p.g=Math.max(0,Math.min(255,m.g+b)):v==="b"&&(p.b=Math.max(0,Math.min(255,m.b+b)));const M=W(p.r,p.g,p.b);return f(M),p}),T(!1)},W=(b,m,p)=>{const M=b/255,u=m/255,w=p/255,O=Math.max(M,u,w),S=Math.min(M,u,w),B=O-S,Z=(O+S)/2;let re=0;B!==0&&(re=Z>.5?B/(2-O-S):B/(O+S));let ne=0;return B!==0&&(O===M?ne=((u-w)/B+(u<w?6:0))/6:O===u?ne=((w-M)/B+2)/6:ne=((M-u)/B+4)/6),{h:Math.round(ne*360),s:Math.round(re*100),l:Math.round(Z*100)}},X=(b,m,p)=>{b/=360,m/=100,p/=100;const M=(1-Math.abs(2*p-1))*m,u=M*(1-Math.abs(b*6%2-1)),w=p-M/2;let O=0,S=0,B=0;return 0<=b&&b<1/6?(O=M,S=u,B=0):1/6<=b&&b<2/6?(O=u,S=M,B=0):2/6<=b&&b<3/6?(O=0,S=M,B=u):3/6<=b&&b<4/6?(O=0,S=u,B=M):4/6<=b&&b<5/6?(O=u,S=0,B=M):5/6<=b&&b<1&&(O=M,S=0,B=u),[Math.round((O+w)*255),Math.round((S+w)*255),Math.round((B+w)*255)]},G=()=>{const b=[],m=[[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 p=0;p<40;p++){const u=p/39*(m.length-1),w=Math.floor(u),O=Math.ceil(u),S=u-w,[B,Z,re]=m[w],[ne,L,N]=m[O],E=Math.round(B+(ne-B)*S),z=Math.round(Z+(L-Z)*S),U=Math.round(re+(N-re)*S);b.push(o(i,{backgroundColor:`rgb(${E},${z},${U})`,children:" "},p))}return b},K=()=>{const b=[];for(let m=0;m<40;m++){const p=m/39*100,[M,u,w]=X(g.h,p,g.l);b.push(o(i,{backgroundColor:`rgb(${M},${u},${w})`,children:" "},m))}return b},$=()=>{const b=[];for(let m=0;m<40;m++){const p=m/39*100,[M,u,w]=X(g.h,g.s,p);b.push(o(i,{backgroundColor:`rgb(${M},${u},${w})`,children:" "},m))}return b},y=()=>{const[b,m,p]=X(g.h,g.s,g.l);return`rgb(${b},${m},${p})`},x=(b,m,p)=>{const M=u=>u.toString(16).padStart(2,"0");return`#${M(b)}${M(m)}${M(p)}`},F=()=>{const b=[];for(let m=0;m<40;m++){const p=Math.round(m/39*255);b.push(o(i,{backgroundColor:`rgb(${p},${d.g},${d.b})`,children:" "},m))}return b},V=()=>{const b=[];for(let m=0;m<40;m++){const p=Math.round(m/39*255);b.push(o(i,{backgroundColor:`rgb(${d.r},${p},${d.b})`,children:" "},m))}return b},Q=()=>{const b=[];for(let m=0;m<40;m++){const p=Math.round(m/39*255);b.push(o(i,{backgroundColor:`rgb(${d.r},${d.g},${p})`,children:" "},m))}return b},j=(b,m)=>Math.round(b/m*39);return l(a,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[l(a,{flexDirection:"column",children:[o(i,{bold:!0,children:"Color Picker"}),l(a,{marginBottom:1,flexDirection:"column",children:[o(i,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),o(i,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),o(i,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),o(i,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),o(i,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),o(i,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),A==="hsl"?l(se,{children:[l(a,{marginBottom:1,children:[o(a,{width:25,children:l(i,{color:v==="h"?"yellow":"white",children:[v==="h"?"❯ ":" ","Hue (",g.h,"°):"]})}),o(a,{children:G().map((b,m)=>o(ue,{children:m===j(g.h,360)?o(i,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[o(a,{width:25,children:l(i,{color:v==="s"?"yellow":"white",children:[v==="s"?"❯ ":" ","Saturation (",g.s,"%):"]})}),o(a,{children:K().map((b,m)=>o(ue,{children:m===j(g.s,100)?o(i,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[o(a,{width:25,children:l(i,{color:v==="l"?"yellow":"white",children:[v==="l"?"❯ ":" ","Lightness (",g.l,"%):"]})}),o(a,{children:$().map((b,m)=>o(ue,{children:m===j(g.l,100)?o(i,{children:"|"}):b},m))})]})]}):l(se,{children:[l(a,{marginBottom:1,children:[o(a,{width:25,children:l(i,{color:v==="r"?"yellow":"white",children:[v==="r"?"❯ ":" ","Red (",d.r,"):"]})}),o(a,{children:F().map((b,m)=>o(ue,{children:m===j(d.r,255)?o(i,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[o(a,{width:25,children:l(i,{color:v==="g"?"yellow":"white",children:[v==="g"?"❯ ":" ","Green (",d.g,"):"]})}),o(a,{children:V().map((b,m)=>o(ue,{children:m===j(d.g,255)?o(i,{children:"|"}):b},m))})]}),l(a,{marginBottom:1,children:[o(a,{width:25,children:l(i,{color:v==="b"?"yellow":"white",children:[v==="b"?"❯ ":" ","Blue (",d.b,"):"]})}),o(a,{children:Q().map((b,m)=>o(ue,{children:m===j(d.b,255)?o(i,{children:"|"}):b},m))})]})]}),l(a,{marginBottom:1,children:[o(i,{children:"Current: "}),o(i,{backgroundColor:y(),children:" "})]}),l(a,{flexDirection:"row",justifyContent:"space-between",children:[l(a,{flexDirection:"column",children:[o(i,{dimColor:!0,children:"Hex "}),r?.startsWith("diff")?o(i,{backgroundColor:y(),color:s?.colors?.text||"white",bold:!0,children:x(d.r,d.g,d.b)}):r==="inverseText"?o(i,{color:y(),backgroundColor:s?.colors?.permission,bold:!0,children:x(d.r,d.g,d.b)}):o(i,{color:y(),bold:!0,children:x(d.r,d.g,d.b)})]}),l(a,{flexDirection:"column",children:[o(i,{dimColor:!0,children:"RGB "}),r?.startsWith("diff")?o(i,{backgroundColor:y(),color:s?.colors?.text||"white",bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):r==="inverseText"?o(i,{color:y(),backgroundColor:s?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):o(i,{color:y(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),l(a,{flexDirection:"column",children:[o(i,{dimColor:!0,children:"HSL "}),r?.startsWith("diff")?o(i,{backgroundColor:y(),color:s?.colors?.text||"white",bold:!0,children:`hsl(${g.h}, ${g.s}%, ${g.l}%)`}):r==="inverseText"?o(i,{color:y(),backgroundColor:s?.colors?.permission,bold:!0,children:`hsl(${g.h}, ${g.s}%, ${g.l}%)`}):o(i,{color:y(),bold:!0,children:`hsl(${g.h}, ${g.s}%, ${g.l}%)`})]})]})]})}function _e(n){const t=n.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};const e=n.match(/^#([a-fA-F0-9]{6})$/);if(e){const r=e[1];return{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16)}}return null}function $e(n){const t=n.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};const e=n.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(e){const s=parseInt(e[1])/255,c=parseInt(e[2])/255,h=parseInt(e[3])/255,g=Math.max(s,c,h),f=Math.min(s,c,h),d=g-f,I=(g+f)/2;let A=0;d!==0&&(A=I>.5?d/(2-g-f):d/(g+f));let C=0;return d!==0&&(g===s?C=((c-h)/d+(c<h?6:0))/6:g===c?C=((h-s)/d+2)/6:C=((s-c)/d+4)/6),{h:Math.round(C*360),s:Math.round(A*100),l:Math.round(I*100)}}const r=n.match(/^#([a-fA-F0-9]{6})$/);if(r){const s=r[1],c=parseInt(s.substr(0,2),16)/255,h=parseInt(s.substr(2,2),16)/255,g=parseInt(s.substr(4,2),16)/255,f=Math.max(c,h,g),d=Math.min(c,h,g),I=f-d,A=(f+d)/2;let C=0;I!==0&&(C=A>.5?I/(2-f-d):I/(f+d));let v=0;return I!==0&&(f===c?v=((h-g)/I+(h<g?6:0))/6:f===h?v=((g-c)/I+2)/6:v=((c-h)/I+4)/6),{h:Math.round(v*360),s:Math.round(C*100),l:Math.round(A*100)}}return{h:0,s:50,l:50}}function xn({onBack:n,themeId:t}){const{settings:{themes:e},updateSettings:r}=de(ae),[s,c]=_(t),h=e.find($=>$.id===s)||e[0],[g,f]=_("rgb"),[d,I]=_(0),[A,C]=_(null),[v,D]=_(null),[k,T]=_(""),[R,P]=_(""),H=Ye($=>{r(y=>{const x=y.themes.findIndex(F=>F.id===s);x!==-1&&$(y.themes[x])})},[s,r]),J=$=>{if(d>=2&&Ee($)){const y=Xe($),x=d-2,F=W[x];H(V=>{V.colors[F]=y})}};le(($,y)=>{if(A===null&&v===null){if($.length>1&&!y.ctrl&&!y.meta){J($);return}if(y.escape)n();else if(y.ctrl&&$==="a")f(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(d===0)D("name"),T(h.name),P(h.name);else if(d===1)D("id"),T(h.id),P(h.id);else{const x=d-2,F=W[x],V=h.colors[F];C(x),T(V),P(V)}}else if(A!==null)y.ctrl&&$==="a"&&f(x=>x==="rgb"?"hex":x==="hex"?"hsl":"rgb");else if(v!==null)if(y.return){if(v==="id"){const x=s;c(k),r(F=>{const V=F.themes.findIndex(Q=>Q.id===x);V!==-1&&(F.themes[V].id=k)})}else H(x=>{x.name=k});D(null),T(""),P("")}else y.escape?(D(null),T(""),P("")):y.backspace||y.delete?T(x=>x.slice(0,-1)):$&&T(x=>x+$)});const W=Object.keys(h.colors),X=($,y)=>{const x=$.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!x)return $;const F=parseInt(x[1]),V=parseInt(x[2]),Q=parseInt(x[3]);switch(y){case"hex":{const j=b=>b.toString(16).padStart(2,"0");return`#${j(F)}${j(V)}${j(Q)}`}case"hsl":{const j=F/255,b=V/255,m=Q/255,p=Math.max(j,b,m),M=Math.min(j,b,m),u=p-M,w=(p+M)/2;let O=0;u!==0&&(O=w>.5?u/(2-p-M):u/(p+M));let S=0;return u!==0&&(p===j?S=((b-m)/u+(b<m?6:0))/6:p===b?S=((m-j)/u+2)/6:S=((j-b)/u+4)/6),`hsl(${Math.round(S*360)}, ${Math.round(O*100)}%, ${Math.round(w*100)}%)`}case"rgb":default:return $}},G=$=>({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"})[$]||"",K=Math.max(...W.map($=>$.length));return l(a,{children:[l(a,{flexDirection:"column",width:"50%",children:[o(a,{children:l(ce,{children:["Editing theme “",h.name,"” (",h.id,")"]})}),A===null&&v===null?l(se,{children:[l(a,{marginBottom:1,flexDirection:"column",children:[o(i,{dimColor:!0,children:"enter to edit theme name, id, or color"}),o(i,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),o(i,{dimColor:!0,children:"paste color from clipboard (when on color)"}),o(i,{dimColor:!0,children:"esc to go back"})]}),d<2?l(a,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[o(i,{bold:!0,children:d===0?"Theme Name":"Theme ID"}),o(i,{children:d===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):l(a,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:h.colors[W[d-2]],flexDirection:"column",paddingLeft:1,children:[o(Ge,{colorKey:W[d-2],theme:h,bold:!0}),o(i,{children:G(W[d-2])})]}),l(a,{flexDirection:"column",children:[l(a,{children:[o(i,{color:d===0?"yellow":"white",children:d===0?"❯ ":" "}),o(i,{bold:!0,children:"Name: "}),o(i,{children:h.name})]}),l(a,{marginBottom:1,children:[o(i,{color:d===1?"yellow":"white",children:d===1?"❯ ":" "}),o(i,{bold:!0,children:"ID: "}),o(i,{children:h.id})]}),W.map(($,y)=>{const x=y+2;return l(a,{children:[o(i,{color:d===x?"yellow":"white",children:d===x?"❯ ":" "}),o(a,{width:K+2,children:o(i,{children:o(Ge,{colorKey:$,theme:h,bold:!0})})}),o(i,{color:h.colors[$],children:X(h.colors[$],g)})]},$)})]})]}):v?l(a,{flexDirection:"column",marginTop:1,children:[l(i,{children:["Editing ",v==="name"?"theme name":"theme ID",":"]}),o(a,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:o(i,{children:k})}),o(i,{dimColor:!0,children:"enter to save, esc to cancel"})]}):o(Ze,{initialValue:R,colorKey:W[A],theme:h,onColorChange:$=>{T($),H(y=>{y.colors[W[A]]=$})},onExit:()=>{H($=>{$.colors[W[A]]=k}),C(null),T(""),P("")}})]}),o(a,{width:"50%",children:o(He,{theme:h})})]})}function wn(n){return n.map(t=>`${t.name} (${t.id})`)}function Sn({onBack:n}){const{settings:{themes:t},updateSettings:e}=de(ae),[r,s]=_(0),[c,h]=_(null),[g,f]=_(!0),d=()=>{const k={colors:{...(t[0]||q.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};e(T=>{T.themes.push(k)}),h(k.id),f(!1)},I=D=>{t.length<=1||(e(k=>{k.themes=k.themes.filter(T=>T.id!==D)}),r>=t.length-1&&s(Math.max(0,t.length-2)))},A=()=>{e(D=>{D.themes=[...q.themes]}),s(0)};if(le((D,k)=>{if(k.escape)n();else if(k.upArrow)s(T=>Math.max(0,T-1));else if(k.downArrow)s(T=>Math.min(t.length-1,T+1));else if(k.return){const T=t[r];T&&(h(T.id),f(!1))}else if(D==="n")d();else if(D==="d"){const T=t[r];T&&I(T.id)}else k.ctrl&&D==="r"&&A()},{isActive:g}),c)return o(xn,{themeId:c,onBack:()=>{h(null),f(!0)}});const C=wn(t),v=t.find(D=>C[r]?.includes(`(${D.id})`))||t[0];return t.length===0?o(a,{children:l(a,{flexDirection:"column",width:"100%",children:[o(ce,{children:"Themes"}),l(a,{marginBottom:1,flexDirection:"column",children:[o(i,{dimColor:!0,children:"n to create a new theme"}),o(i,{dimColor:!0,children:"esc to go back"})]}),o(i,{children:"No themes available!"})]})}):l(a,{children:[l(a,{flexDirection:"column",width:"50%",children:[o(ce,{children:"Themes"}),l(a,{marginBottom:1,flexDirection:"column",children:[o(i,{dimColor:!0,children:"n to create a new theme"}),o(i,{dimColor:!0,children:"d to delete a theme"}),o(i,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),o(i,{dimColor:!0,children:"enter to edit theme"}),o(i,{dimColor:!0,children:"esc to go back"})]}),o(a,{flexDirection:"column",children:C.map((D,k)=>l(i,{color:r===k?"yellow":void 0,children:[r===k?"❯ ":" ",D]},k))})]}),o(a,{width:"50%",children:o(He,{theme:v})})]})}let Oe=["ANSI Shadow"];function In({onBack:n}){const{stdout:t}=tn(),e=t?.columns||120,{settings:{launchText:{method:r,figletText:s,figletFont:c,customText:h},themes:g},updateSettings:f}=de(ae),d=r==="figlet"?["method","text","font"]:["method","text"],[I,A]=_(0),C=d[I],[v,D]=_(r==="figlet"?0:1),[k,T]=_(Oe),[R,P]=_(Oe),[H,J]=_(""),[W,X]=_(!1),[G,K]=_(0),[$,y]=_(""),[x,F]=_(50),[V,Q]=_(!1),[j,b]=_(r==="figlet"?s:h),m=Ce(),M=(g.find(w=>w.id===m)||g.find(w=>w.id==="dark"))?.colors.claude||"rgb(215,119,87)";oe(()=>{Ae.fonts((w,O)=>{if(!w&&O){const S=O.sort();T(S),P(S),Oe=S;const B=S.indexOf(c);K(B>=0?B:S.indexOf("ANSI Shadow")||0)}})},[]),oe(()=>{u()},[r,s,c,h,j,V]);const u=()=>{if(r==="figlet")try{const w=V?j:s,O=Ae.textSync(w.replace(`
3
- `," "),{font:c}),S=Math.floor(e*.7),Z=O.split(`
4
- `).map(N=>N.length>S?N.substring(0,S-3)+"…":N),re=Z.join(`
5
- `);y(re);const ne=Math.max(...Z.map(N=>N.length)),L=Math.min(75,Math.max(50,Math.ceil(ne/e*100)));F(L+5)}catch{y("Error generating figlet text"),F(50)}else{const w=Math.floor(e*.6),B=(V?j:h).split(`
6
- `).map(L=>L.length>w?L.substring(0,w-3)+"...":L),Z=B.join(`
7
- `);y(Z);const re=Math.max(...B.map(L=>L.length)),ne=Math.min(75,Math.max(50,Math.ceil(re/e*100)));F(ne+5)}};return oe(()=>{if(H){const w=k.filter(O=>O.toLowerCase().includes(H.toLowerCase()));P(w),K(0)}else{P(k);const w=k.indexOf(c);K(w>=0?w:0)}},[H,k]),oe(()=>{if(!W){const w=R.indexOf(c);w>=0&&K(w)}},[c,R,W]),le((w,O)=>{if(V){O.return?(f(r==="figlet"?S=>{S.launchText.figletText=j}:S=>{S.launchText.customText=j}),Q(!1)):O.escape?(b(r==="figlet"?s:h),Q(!1)):O.backspace||O.delete?b(S=>S.slice(0,-1)):w&&b(S=>S+w);return}if(W){if(O.return)R.length>0&&f(S=>{S.launchText.figletFont=R[G]}),X(!1),J("");else if(O.escape)X(!1),J("");else if(O.backspace||O.delete)J(S=>S.slice(0,-1));else if(O.upArrow){const S=G>0?G-1:R.length-1;K(S),R.length>0&&f(B=>{B.launchText.figletFont=R[S]})}else if(O.downArrow){const S=G<R.length-1?G+1:0;K(S),R.length>0&&f(B=>{B.launchText.figletFont=R[S]})}else w&&w.match(/^[a-zA-Z0-9\s\-_]$/)&&J(S=>S+w);return}if(O.escape)n();else if(O.return)C==="text"&&(b(r==="figlet"?s:h),Q(!0));else if(O.tab)O.shift?A(S=>S===0?d.length-1:S-1):A(S=>S===d.length-1?0:S+1);else if(O.upArrow){if(C==="method"){const S=v>0?v-1:1;D(S),f(B=>{B.launchText.method=S===0?"figlet":"custom"})}else if(C==="font"&&r==="figlet"){const S=G>0?G-1:R.length-1;K(S),f(B=>{B.launchText.figletFont=R[S]})}}else if(O.downArrow){if(C==="method"){const S=v<1?v+1:0;D(S),f(B=>{B.launchText.method=S===0?"figlet":"custom"})}else if(C==="font"&&r==="figlet"){const S=G<R.length-1?G+1:0;K(S),f(B=>{B.launchText.figletFont=R[S]})}}else w&&C==="font"&&r==="figlet"&&w.match(/^[a-zA-Z0-9]$/)&&(X(!0),J(w))}),l(a,{children:[l(a,{flexDirection:"column",width:`${100-x}%`,children:[l(a,{marginBottom:1,flexDirection:"column",children:[o(ce,{children:"Setup banner"}),l(a,{flexDirection:"column",children:[l(i,{dimColor:!0,children:["enter to ",C==="text"?"edit text":"save"]}),o(i,{dimColor:!0,children:"esc to go back"}),o(i,{dimColor:!0,children:"tab to switch sections"})]})]}),o(a,{children:l(i,{children:[o(i,{color:C==="method"?"yellow":void 0,children:C==="method"?"❯ ":" "}),o(i,{bold:!0,color:C==="method"?"yellow":void 0,children:"Method"})]})}),C==="method"&&l(i,{dimColor:!0,children:[" ","select one of ",R.length," Figlet fonts or enter your own text"]}),o(a,{marginLeft:2,marginBottom:1,children:l(a,{flexDirection:"column",children:[l(i,{color:v===0?"cyan":"white",children:[v===0?"❯ ":" ","Figlet"]}),l(i,{color:v===1?"cyan":"white",children:[v===1?"❯ ":" ","Custom"]})]})}),l(a,{flexDirection:"column",children:[l(i,{children:[o(i,{color:C==="text"?"yellow":void 0,children:C==="text"?"❯ ":" "}),o(i,{bold:!0,color:C==="text"?"yellow":void 0,children:"Text"})]}),C==="text"&&(V?l(i,{dimColor:!0,children:[" ","esc to save"]}):l(i,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(a,{marginLeft:2,marginBottom:1,children:o(a,{borderStyle:"round",borderColor:V?"yellow":"gray",children:o(i,{children:V?j:r==="figlet"?s:h})})}),r==="figlet"&&l(se,{children:[o(a,{children:l(a,{flexDirection:"column",children:[l(i,{children:[o(i,{color:C==="font"?"yellow":void 0,children:C==="font"?"❯ ":" "}),o(i,{bold:!0,color:C==="font"?"yellow":void 0,children:"Font"})]}),C==="font"&&l(i,{dimColor:!0,children:[" ","type to filter"]}),o(i,{children:W&&l(i,{color:"gray",dimColor:!0,children:[" ","(filtering: “",H,"”)"]})})]})}),o(a,{marginLeft:2,marginBottom:1,children:o(a,{flexDirection:"column",children:(()=>{const O=Math.max(0,G-Math.floor(4)),S=Math.min(R.length,O+8),B=Math.max(0,S-8),Z=R.slice(B,S);return l(se,{children:[B>0&&l(i,{color:"gray",dimColor:!0,children:[" ","↑ ",B," more above"]}),Z.map((re,ne)=>{const L=B+ne;return l(i,{color:G===L?"cyan":void 0,children:[G===L?"❯ ":" ",re]},re)}),S<R.length&&l(i,{color:"gray",dimColor:!0,children:[" ","↓ ",R.length-S," more below"]})]})})()})})]})]}),l(a,{width:`${x}%`,flexDirection:"column",children:[o(a,{marginBottom:1,children:o(i,{bold:!0,children:"Preview"})}),l(a,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:[l(a,{flexDirection:"column",marginBottom:1,children:[o(i,{color:M,children:"╭──────────────────────────╮"}),l(i,{children:[o(i,{color:M,children:"│ ✻"})," Welcome to Claude Code"," ",o(i,{color:M,children:"│"})]}),o(i,{color:M,children:"╰──────────────────────────╯"})]}),$.split(`
8
- `).map((w,O)=>o(i,{color:M,children:w},O)),o(a,{marginTop:1,children:o(i,{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 yn({onBack:n}){const{settings:{thinkingVerbs:{format:t,verbs:e},themes:r},updateSettings:s}=de(ae),c=["format","verbs"],[h,g]=_(0),f=c[h],[d,I]=_(0),[A,C]=_(!1),[v,D]=_(""),[k,T]=_(!1),[R,P]=_(!1),[H,J]=_(t),W=Ce(),X=r.find($=>$.id===W)||r.find($=>$.id==="dark"),G=X?.colors.claude||"rgb(215,119,87)";le(($,y)=>{if(R){y.return?(s(x=>{x.thinkingVerbs.format=H}),P(!1)):y.escape?(J(t),P(!1)):y.backspace||y.delete?J(x=>x.slice(0,-1)):$&&J(x=>x+$);return}if(A||k){y.return&&v.trim()?(k?(s(x=>{x.thinkingVerbs.verbs.push(v.trim())}),T(!1)):(s(x=>{x.thinkingVerbs.verbs[d]=v.trim()}),C(!1)),D("")):y.escape?(D(""),C(!1),T(!1)):y.backspace||y.delete?D(x=>x.slice(0,-1)):$&&D(x=>x+$);return}y.escape?n():y.return?f==="format"&&(J(t),P(!0)):y.tab?y.shift?g(x=>x===0?c.length-1:x-1):g(x=>x===c.length-1?0:x+1):y.upArrow?f==="verbs"&&e.length>0&&I(x=>x>0?x-1:e.length-1):y.downArrow?f==="verbs"&&e.length>0&&I(x=>x<e.length-1?x+1:0):$==="e"&&f==="verbs"?e.length>0&&(D(e[d]),C(!0)):$==="d"&&f==="verbs"?e.length>1&&(s(x=>{x.thinkingVerbs.verbs=x.thinkingVerbs.verbs.filter((F,V)=>V!==d)}),d>=e.length-1&&I(Math.max(0,e.length-2))):$==="n"&&f==="verbs"?(T(!0),D("")):y.ctrl&&$==="r"&&f==="verbs"&&(s(x=>{x.thinkingVerbs.verbs=[...q.thinkingVerbs.verbs]}),I(0))});const K=50;return l(a,{children:[l(a,{flexDirection:"column",width:`${100-K}%`,children:[l(a,{marginBottom:1,flexDirection:"column",children:[o(ce,{children:"Thinking Verbs"}),l(a,{flexDirection:"column",children:[o(i,{dimColor:!0,children:f==="format"?"enter to edit format":"changes auto-saved"}),o(i,{dimColor:!0,children:"esc to go back"}),o(i,{dimColor:!0,children:"tab to switch sections"})]})]}),o(a,{marginBottom:1,children:o(i,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),l(a,{flexDirection:"column",children:[l(i,{children:[o(i,{color:f==="format"?"yellow":void 0,children:f==="format"?"❯ ":" "}),o(i,{bold:!0,color:f==="format"?"yellow":void 0,children:"Format"})]}),f==="format"&&(R?l(i,{dimColor:!0,children:[" ","enter to save"]}):l(i,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(a,{marginLeft:2,marginBottom:1,children:o(a,{borderStyle:"round",borderColor:R?"yellow":"gray",children:o(i,{children:R?H:t})})}),o(a,{children:l(i,{children:[o(i,{color:f==="verbs"?"yellow":void 0,children:f==="verbs"?"❯ ":" "}),o(i,{bold:!0,color:f==="verbs"?"yellow":void 0,children:"Verbs"})]})}),f==="verbs"&&o(a,{flexDirection:"column",children:l(i,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),o(a,{marginLeft:2,marginBottom:1,children:l(a,{flexDirection:"column",children:[(()=>{const y=Math.max(0,d-Math.floor(4)),x=Math.min(e.length,y+8),F=Math.max(0,x-8),V=e.slice(F,x);return l(se,{children:[F>0&&l(i,{color:"gray",dimColor:!0,children:[" ","↑ ",F," more above"]}),V.map((Q,j)=>{const b=F+j;return l(i,{color:f==="verbs"&&b===d?"cyan":void 0,children:[f==="verbs"&&b===d?"❯ ":" ",Q]},b)}),x<e.length&&l(i,{color:"gray",dimColor:!0,children:[" ","↓ ",e.length-x," more below"]})]})})(),k&&l(a,{alignItems:"center",children:[o(i,{color:"yellow",children:"❯ "}),o(a,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:v})})]}),A&&l(a,{marginTop:1,alignItems:"center",children:[o(i,{children:"Editing: "}),o(a,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:v})})]})]})})]}),l(a,{width:`${K}%`,flexDirection:"column",children:[o(a,{marginBottom:1,children:o(i,{bold:!0,children:"Preview"})}),o(a,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:l(i,{children:[l(i,{color:G,children:["✻ ",t.replace(/\{\}/g,e[d])," "]}),o(i,{color:X?.colors.secondaryText,children:"(10s · ↑ 456 tokens · esc to interrupt)"})]})})]})]})}const ge=[{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 Cn({onBack:n}){const{settings:{thinkingStyle:{phases:t,updateInterval:e,reverseMirror:r},themes:s},updateSettings:c}=de(ae),h=["reverseMirror","updateInterval","phases","presets"],[g,f]=_(0),d=h[g],[I,A]=_(0),[C,v]=_(0),[D,k]=_(!1),[T,R]=_(""),[P,H]=_(!1),[J,W]=_(!1),[X,G]=_(e.toString()),[K,$]=_(0),y=Ce(),x=s.find(p=>p.id===y)||s.find(p=>p.id==="dark"),F=x?.colors.claude||"rgb(215,119,87)";oe(()=>{if(t.length>0){const p=r?[...t,...[...t].reverse().slice(1,-1)]:t,M=setInterval(()=>{$(u=>(u+1)%p.length)},e);return()=>clearInterval(M)}},[t,e,r]),le((p,M)=>{if(J){if(M.return){const u=parseInt(X);!isNaN(u)&&u>0&&c(w=>{w.thinkingStyle.updateInterval=u}),W(!1)}else M.escape?(G(e.toString()),W(!1)):M.backspace||M.delete?G(u=>u.slice(0,-1)):p&&p.match(/^[0-9]$/)&&G(u=>u+p);return}if(D||P){if(M.return&&T.length){const u=P?[...t,T]:t.map((w,O)=>O===I?T:w);c(w=>{w.thinkingStyle.phases=u}),k(!1),R("")}else M.escape?(R(""),k(!1),H(!1)):M.backspace||M.delete?R(u=>u.slice(0,-1)):p&&R(u=>u+p);return}if(M.escape)n();else if(M.return)if(d==="updateInterval")G(e.toString()),W(!0);else if(d==="presets"){const u=ge[C];c(w=>{w.thinkingStyle.phases=[...u.phases],w.thinkingStyle.reverseMirror=u.reverseMirror})}else d==="reverseMirror"&&c(u=>{u.thinkingStyle.reverseMirror=!u.thinkingStyle.reverseMirror});else if(M.tab)M.shift?f(u=>u===0?h.length-1:u-1):f(u=>u===h.length-1?0:u+1);else if(M.upArrow)d==="phases"&&t.length>0?A(u=>u>0?u-1:t.length-1):d==="presets"&&v(u=>u>0?u-1:ge.length-1);else if(M.downArrow)d==="phases"&&t.length>0?A(u=>u<t.length-1?u+1:0):d==="presets"&&v(u=>u<ge.length-1?u+1:0);else if(p===" ")d==="reverseMirror"&&c(u=>{u.thinkingStyle.reverseMirror=!u.thinkingStyle.reverseMirror});else if(p==="e"&&d==="phases")t.length>0&&(R(t[I]),k(!0));else if(p==="a"&&d==="phases")H(!0),R("");else if(p==="d"&&d==="phases")t.length>1&&(c(u=>{u.thinkingStyle.phases=t.filter((w,O)=>O!==I)}),I>=t.length&&A(Math.max(0,t.length-1)));else if(p==="w"&&d==="phases"){if(I>0){const u=[...t];[u[I-1],u[I]]=[u[I],u[I-1]],c(w=>{w.thinkingStyle.phases=u}),A(w=>w-1)}}else if(p==="s"&&d==="phases"){if(I<t.length-1){const u=[...t];[u[I],u[I+1]]=[u[I+1],u[I]],c(w=>{w.thinkingStyle.phases=u}),A(w=>w+1)}}else M.ctrl&&p==="r"&&(c(u=>{u.thinkingStyle=q.thinkingStyle}),A(0),v(0))});const V=r?"●":"○",Q=50,b=r?[...t,...[...t].reverse().slice(1,-1)]:t,m=b.length>0?b[K]:"·";return o(a,{children:l(a,{flexDirection:"column",width:"100%",children:[l(a,{flexDirection:"row",width:"100%",children:[l(a,{marginBottom:1,flexDirection:"column",width:`${100-Q}%`,children:[o(ce,{children:"Thinking style"}),l(a,{flexDirection:"column",children:[l(i,{dimColor:!0,children:["enter to"," ",d==="updateInterval"?"edit interval":d==="presets"?"apply preset":"save"]}),o(i,{dimColor:!0,children:"esc to go back"}),o(i,{dimColor:!0,children:"tab to switch sections"})]})]}),l(a,{width:`${Q}%`,flexDirection:"column",children:[o(a,{children:o(i,{bold:!0,children:"Preview"})}),l(a,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[o(a,{width:(m?.length??0)+1,children:o(i,{color:F,children:m})}),l(i,{children:[o(i,{color:F,children:"Thinking… "}),o(i,{color:x?.colors.secondaryText,children:"(esc to interrupt)"})]})]})]})]}),l(a,{flexDirection:"row",gap:4,children:[l(a,{flexDirection:"column",children:[l(i,{children:[o(i,{color:d==="reverseMirror"?"yellow":void 0,children:d==="reverseMirror"?"❯ ":" "}),o(i,{bold:!0,color:d==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),d==="reverseMirror"&&l(i,{dimColor:!0,children:[" ","space to toggle"]}),o(a,{marginLeft:2,marginBottom:1,children:l(i,{children:[V," ",r?"Enabled":"Disabled"]})})]}),l(a,{flexDirection:"column",children:[l(i,{children:[o(i,{color:d==="updateInterval"?"yellow":void 0,children:d==="updateInterval"?"❯ ":" "}),o(i,{bold:!0,color:d==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),d==="updateInterval"&&(J?l(i,{dimColor:!0,children:[" ","enter to save"]}):l(i,{dimColor:!0,children:[" ","enter to edit"]})),o(a,{marginLeft:2,marginBottom:1,children:o(a,{borderStyle:"round",borderColor:J?"yellow":"gray",children:o(i,{children:J?X:e})})})]})]}),o(a,{children:l(i,{children:[o(i,{color:d==="phases"?"yellow":void 0,children:d==="phases"?"❯ ":" "}),o(i,{bold:!0,color:d==="phases"?"yellow":void 0,children:"Phases"})]})}),d==="phases"&&o(a,{marginBottom:1,flexDirection:"column",children:l(i,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),o(a,{marginLeft:2,marginBottom:1,children:l(a,{flexDirection:"column",children:[(()=>{const M=Math.max(0,I-Math.floor(4)),u=Math.min(t.length,M+8),w=Math.max(0,u-8),O=t.slice(w,u);return l(se,{children:[w>0&&l(i,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),O.map((S,B)=>{const Z=w+B;return l(i,{color:d==="phases"&&Z===I?"cyan":void 0,children:[d==="phases"&&Z===I?"❯ ":" ",S]},Z)}),u<t.length&&l(i,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-u," more below"]})]})})(),P&&l(a,{children:[o(i,{color:"yellow",children:"❯ "}),o(a,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:T})})]}),D&&l(a,{marginTop:1,children:[o(i,{children:"Editing: "}),o(a,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:T})})]})]})}),o(a,{children:l(i,{children:[o(i,{color:d==="presets"?"yellow":void 0,children:d==="presets"?"❯ ":" "}),o(i,{bold:!0,color:d==="presets"?"yellow":void 0,children:"Presets"})]})}),d==="presets"&&l(i,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),o(a,{marginLeft:2,marginBottom:1,children:o(a,{flexDirection:"column",children:(()=>{const M=Math.max(0,C-Math.floor(4)),u=Math.min(ge.length,M+8),w=Math.max(0,u-8),O=ge.slice(w,u);return l(se,{children:[w>0&&l(i,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),O.map((S,B)=>{const Z=w+B;return l(i,{color:d==="presets"&&Z===C?"cyan":void 0,children:[d==="presets"&&Z===C?"❯ ":" ",S.name," ",S.phases.join("")]},Z)}),u<ge.length&&l(i,{color:"gray",dimColor:!0,children:[" ","↓ ",ge.length-u," more below"]})]})})()})}),o(a,{marginTop:1,children:o(i,{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 vn({onBack:n}){const{settings:t,updateSettings:e}=de(ae),[r,s]=_("prefix"),[c,h]=_(0),[g,f]=_(!1),[d,I]=_(()=>t.userMessageDisplay.prefix.format),[A,C]=_(0),[v,D]=_(()=>[...t.userMessageDisplay.prefix.styling]),[k,T]=_(()=>t.userMessageDisplay.prefix.foreground_color),[R,P]=_(()=>t.userMessageDisplay.prefix.background_color),[H,J]=_(0),[W,X]=_(0),[G,K]=_(()=>[...t.userMessageDisplay.message.styling]),[$,y]=_(()=>t.userMessageDisplay.message.foreground_color),[x,F]=_(()=>t.userMessageDisplay.message.background_color),[V,Q]=_(null),[j,b]=_(""),m=Ce(),p=t.themes?.find(L=>L.id===m)||t.themes?.[0],M=["format","styling","foreground","background"],u=["styling","foreground","background"],w=M[c],O=u[H],S=(L,N)=>{e(E=>{const z=L==="prefix"?E.userMessageDisplay.prefix:E.userMessageDisplay.message;N(z)})},B=L=>{e(N=>{L==="prefix"?N.userMessageDisplay.prefix={...q.userMessageDisplay.prefix}:N.userMessageDisplay.message={...q.userMessageDisplay.message}}),L==="prefix"?(I(q.userMessageDisplay.prefix.format),D([...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),F(q.userMessageDisplay.message.background_color))};oe(()=>{const L=t.userMessageDisplay.prefix;I(L.format),D([...L.styling]),T(L.foreground_color),P(L.background_color);const N=t.userMessageDisplay.message;K([...N.styling]),y(N.foreground_color),F(N.background_color)},[]),le((L,N)=>{if(g){if(N.return)S("prefix",E=>{E.format=d}),f(!1);else if(N.escape){const E=t.userMessageDisplay.prefix;I(E.format),f(!1)}else N.backspace||N.delete?I(E=>E.slice(0,-1)):L&&I(E=>E+L);return}if(V===null){if(N.escape)n();else if(N.ctrl&&L==="r")B(r);else if(N.leftArrow||N.rightArrow)s(E=>E==="prefix"?"message":"prefix");else if(N.tab)r==="prefix"?N.shift?h(E=>E===0?M.length-1:E-1):h(E=>E===M.length-1?0:E+1):N.shift?J(E=>E===0?u.length-1:E-1):J(E=>E===u.length-1?0:E+1);else if(N.return)r==="prefix"?w==="format"?f(!0):w==="foreground"?(b(k),Q({column:"prefix",type:"foreground"})):w==="background"&&(b(R),Q({column:"prefix",type:"background"})):O==="foreground"?(b($),Q({column:"message",type:"foreground"})):O==="background"&&(b(x),Q({column:"message",type:"background"}));else if(N.upArrow)r==="prefix"&&w==="styling"?C(E=>Math.max(0,E-1)):r==="message"&&O==="styling"&&X(E=>Math.max(0,E-1));else if(N.downArrow)r==="prefix"&&w==="styling"?C(E=>Math.min(be.length-1,E+1)):r==="message"&&O==="styling"&&X(E=>Math.min(be.length-1,E+1));else if(L===" "){if(r==="prefix"&&w==="styling"){const E=be[A].value,z=v.indexOf(E)>=0?v.filter(U=>U!==E):[...v,E];D(z),S("prefix",U=>{U.styling=[...z]})}else if(r==="message"&&O==="styling"){const E=be[W].value,z=G.indexOf(E)>=0?G.filter(U=>U!==E):[...G,E];K(z),S("message",U=>{U.styling=[...z]})}}}});const Z=(L,N,E=!0)=>{const z=E?N==="prefix"?v:G:[],U=E?N==="prefix"?k:$:"rgb(255,255,255)",me=E?N==="prefix"?R:x:"rgb(0,0,0)",pe=U==="rgb(0,0,0)"&&me==="rgb(0,0,0)",ye=z.length>0;return pe&&!ye?o(i,{children:L}):o(i,{bold:z.includes("bold"),italic:z.includes("italic"),underline:z.includes("underline"),strikethrough:z.includes("strikethrough"),inverse:z.includes("inverse"),color:pe?void 0:U,backgroundColor:pe?void 0:me,children:L})},re=(L=!0)=>l(i,{children:[d&&l(se,{children:[Z(d,"prefix",L)," "]}),Z("list the dir","message",L)]}),ne=L=>{const N=r===L,U=(L==="prefix"?M:u)[L==="prefix"?c:H],me=L==="prefix"?A:W,pe=L==="prefix"?v:G,ye=L==="prefix"?k:$,ke=L==="prefix"?R:x;return l(a,{flexDirection:"column",width:"45%",borderStyle:N?"round":"single",borderColor:N?"yellow":"gray",padding:1,children:[o(a,{marginBottom:1,children:l(i,{bold:!0,color:N?"yellow":void 0,children:[L.charAt(0).toUpperCase()+L.slice(1)," ","Configuration"]})}),L==="prefix"&&l(se,{children:[o(a,{children:l(i,{color:N&&U==="format"?"yellow":void 0,bold:N&&U==="format",children:[N&&U==="format"?"❯ ":" ","Prefix Text"]})}),N&&U==="format"&&o(a,{marginLeft:2,children:o(i,{dimColor:!0,children:g?"enter to save":"enter to edit (appears before message)"})}),o(a,{marginLeft:2,marginBottom:1,children:o(a,{borderStyle:"round",borderColor:g?"yellow":"gray",children:o(i,{children:d})})})]}),o(a,{children:l(i,{color:N&&U==="styling"?"yellow":void 0,bold:N&&U==="styling",children:[N&&U==="styling"?"❯ ":" ","Styling"]})}),N&&U==="styling"&&o(a,{marginLeft:2,children:o(i,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),o(a,{marginLeft:2,marginBottom:1,flexDirection:"column",children:be.map((Me,Re)=>o(a,{children:l(i,{color:N&&U==="styling"&&me===Re?"cyan":void 0,children:[N&&U==="styling"&&me===Re?"❯ ":" ",pe.includes(Me.value)?"●":"○"," ",Me.label]})},Me.value))}),o(a,{children:l(i,{color:N&&U==="foreground"?"yellow":void 0,bold:N&&U==="foreground",children:[N&&U==="foreground"?"❯ ":" ","Foreground color"]})}),N&&U==="foreground"&&o(a,{marginLeft:2,children:o(i,{dimColor:!0,children:"enter to open color picker"})}),o(a,{marginLeft:2,marginBottom:1,children:o(i,{color:ye,children:ye})}),o(a,{children:l(i,{color:N&&U==="background"?"yellow":void 0,bold:N&&U==="background",children:[N&&U==="background"?"❯ ":" ","Background color"]})}),N&&U==="background"&&o(a,{marginLeft:2,children:o(i,{dimColor:!0,children:"enter to open color picker"})}),o(a,{marginLeft:2,children:o(i,{backgroundColor:ke,children:ke})})]})};if(V){const{column:L,type:N}=V;return o(Ze,{initialValue:j,theme:p,onColorChange:E=>{L==="prefix"?N==="foreground"?(T(E),S("prefix",z=>{z.foreground_color=E})):(P(E),S("prefix",z=>{z.background_color=E})):N==="foreground"?(y(E),S("message",z=>{z.foreground_color=E})):(F(E),S("message",z=>{z.background_color=E}))},onExit:()=>{Q(null),b("")}})}return l(a,{flexDirection:"column",children:[o(ce,{children:"Customize how user messages are displayed"}),l(a,{flexDirection:"column",marginBottom:1,children:[o(i,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),o(i,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),l(a,{flexDirection:"row",gap:1,children:[ne("prefix"),ne("message")]}),o(a,{borderStyle:"round",padding:1,marginTop:1,children:l(a,{flexDirection:"column",children:[o(a,{marginBottom:1,children:o(i,{bold:!0,children:"Preview"})}),l(a,{flexDirection:"row",gap:2,children:[l(a,{flexDirection:"column",width:"50%",children:[o(a,{marginBottom:1,children:o(i,{underline:!0,children:"Before (Claude Code default):"})}),o(a,{marginLeft:1,children:o(i,{color:p?.colors?.secondaryText||"#888888",children:"> list the dir"})}),o(a,{marginLeft:1,marginTop:1,children:l(i,{children:[o(i,{color:p?.colors?.secondaryText||"#888888",children:"●"}),o(i,{children:" The directory "}),o(i,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(i,{children:" contains "}),o(i,{bold:!0,children:"123"}),o(i,{children:" files."})]})})]}),l(a,{flexDirection:"column",width:"50%",children:[o(a,{marginBottom:1,children:o(i,{underline:!0,children:"After (Your customization):"})}),o(a,{marginLeft:1,children:re(!0)}),o(a,{marginLeft:1,marginTop:1,children:l(i,{children:[o(i,{color:p?.colors?.secondaryText||"#888888",children:"●"}),o(i,{children:" The directory "}),o(i,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(i,{children:" contains "}),o(i,{bold:!0,children:"123"}),o(i,{children:" files."})]})})]})]})]})})]})}function Mn({onSubmit:n}){const{settings:t,updateSettings:e}=de(ae),[r,s]=_(0),c=()=>{e(g=>{g.inputBox||(g.inputBox={removeBorder:!1}),g.inputBox.removeBorder=!g.inputBox.removeBorder})};le((g,f)=>{f.return||f.escape?n():g===" "&&r===0&&c()});const h=t.inputBox?.removeBorder?"☑":"☐";return l(a,{flexDirection:"column",children:[o(a,{marginBottom:1,children:o(ce,{children:"Input Box Settings"})}),o(a,{marginBottom:1,children:l(i,{color:"gray",children:[o(i,{bold:!0,children:"Customize the appearance of the Claude Code input box."})," ",o(i,{dimColor:!0,children:"Press space to toggle settings, enter to go back."})]})}),o(a,{children:l(i,{children:[o(i,{color:r===0?"cyan":void 0,children:r===0?"❯ ":" "}),o(i,{bold:!0,color:r===0?"cyan":void 0,children:"Remove border"})]})}),r===0&&o(a,{marginBottom:1,flexDirection:"column",children:l(i,{dimColor:!0,children:[" ","space to toggle"]})}),o(a,{marginLeft:2,marginBottom:1,children:l(i,{children:[h," ",t.inputBox?.removeBorder?"Enabled":"Disabled"]})}),o(a,{marginBottom:1,children:o(i,{color:"gray",dimColor:!0,children:"When enabled, removes the rounded border around the input box for a cleaner look."})})]})}const qe=async()=>{await he.mkdir(De,{recursive:!0})};let we={settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const Be=async()=>{const n={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:q};try{te()&&console.log(`Reading config at ${ie}`);const t=await he.readFile(ie,"utf8"),e={...n,...JSON.parse(t)},r=e?.settings?.thinkingVerbs;r?.punctuation&&(r.format="{}"+r.punctuation,delete r.punctuation),e.settings.inputBox||(e.settings.inputBox=q.inputBox);for(const s of q.themes){const c=e?.settings?.themes.find(h=>h.id===s.id||h.name===s.name);if(c)for(const[h,g]of Object.entries(s))Object.hasOwn(c,h)||(c[h]=g)}return e?.settings?.userMessageDisplay||(e.settings=e.settings||q,e.settings.userMessageDisplay=q.userMessageDisplay),we=e,e}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return n;throw t}},ve=async n=>(te()&&console.log(`Updating config at ${ie}`),n(we),we.lastModified=new Date().toISOString(),await Tn(we),we),Tn=async n=>{try{n.lastModified=new Date().toISOString(),await qe(),await he.writeFile(ie,JSON.stringify(n,null,2))}catch(t){throw console.error("Error saving config:",t),t}},Qe=async n=>{te()&&console.log(`Restoring cli.js from backup to ${n.cliPath}`);const t=await he.readFile(fe);return await Ke(n.cliPath,t,"restore"),await ve(e=>{e.changesApplied=!1}),!0},_n=async n=>{n.ccInstallationDir&&Ue.unshift(n.ccInstallationDir);for(const t of Ue)try{te()&&console.log(`Searching for Claude Code cli.js file at ${t}`);const e=Pe.join(t,"cli.js");if(!await en(e))continue;te()&&(console.log(`Found Claude Code cli.js file at ${t}; checking hash...`),console.log(`SHA256 hash: ${await bn(e)}`));const r=Pe.join(t,"package.json");let s;try{s=JSON.parse(await he.readFile(r,"utf8"))}catch(c){if(!(c instanceof Error&&"code"in c&&c.code==="ENOENT"))throw c}return{cliPath:e,packageJsonPath:r,version:s?.version}}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")continue;throw e}return null},We=async n=>{await qe(),te()&&console.log(`Backing up cli.js to ${fe}`),await he.copyFile(n.cliPath,fe),await ve(t=>{t.changesApplied=!1,t.ccVersion=n.version})};async function en(n){try{return await he.stat(n),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}}async function je(){const n=await Be(),t=await _n(n);if(!t)return null;const e=t.version,r=n.ccVersion;let s=!1;return await en(fe)||(te()&&console.log(`startupCheck: ${fe} not found; backing up cli.js`),await We(t),s=!0),e!==r?(s||(te()&&console.log(`startupCheck: real version (${e}) != backed up version (${r}); backing up cli.js`),await he.unlink(fe),await We(t)),{wasUpdated:!0,oldVersion:r,newVersion:e,ccInstInfo:t}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}}const $n=n=>{const t=[],e=/visibleOptionCount:[\w$]+=(\d+)/g;let r;for(;(r=e.exec(n))!==null;){const s=r.index+r[0].indexOf("=")+1;t.push({startIndex:s,endIndex:s+r[1].length})}return t},On=(n,t)=>{const e=$n(n);if(e.length===0)return null;const r=e.sort((c,h)=>h.startIndex-c.startIndex);let s=n;for(const c of r){const h=t.toString(),g=s.slice(0,c.startIndex)+h+s.slice(c.endIndex);ee(s,g,h,c.startIndex,c.endIndex),s=g}return s};function An(n){const t=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,e=n.match(t);if(!e||e.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const r=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,s=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,c=n.match(r),h=n.match(s);return!c||c.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:e.index,endIndex:e.index+e[0].length,identifiers:[e[1].trim()]},objArr:{startIndex:c.index,endIndex:c.index+c[0].length},obj:{startIndex:h.index,endIndex:h.index+h[0].length}}}const Nn=(n,t)=>{const e=An(n);if(!e)return null;if(t.length===0)return n;let r=n;const s="return"+JSON.stringify(Object.fromEntries(t.map(g=>[g.id,g.name])));r=r.slice(0,e.obj.startIndex)+s+r.slice(e.obj.endIndex),ee(n,r,s,e.obj.startIndex,e.obj.endIndex),n=r;const c=JSON.stringify(t.map(g=>({label:g.name,value:g.id})));r=r.slice(0,e.objArr.startIndex)+c+r.slice(e.objArr.endIndex),ee(n,r,c,e.objArr.startIndex,e.objArr.endIndex),n=r;let h=`switch(${e.switchStatement.identifiers?.[0]}){
9
- `;return t.forEach(g=>{h+=`case"${g.id}":return${JSON.stringify(g.colors)};
10
- `}),h+=`default:return${JSON.stringify(t[0].colors)};
11
- }`,r=r.slice(0,e.switchStatement.startIndex)+h+r.slice(e.switchStatement.endIndex),ee(n,r,h,e.switchStatement.startIndex,e.switchStatement.endIndex),r},Dn=n=>{const t=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,e=n.match(t);return!e||e.index===void 0?(console.error("patch: context limit: failed to find match"),null):e.index+e[0].indexOf("{")+1},En=n=>{const t=Dn(n);if(!t)return null;const e="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",r=n.slice(0,t)+e+n.slice(t);return ee(n,r,e,t,t),r},Bn=n=>{const t=/createElement\([$\w]+,\{alignItems:"flex-start",justifyContent:"flex-start",borderColor:[$\w]+\(\),borderDimColor:[$\w]+!=="memory",borderStyle:"round",borderLeft:!1,borderRight:!1,marginTop:1,width:"100%"\}/,e=n.match(t);return!e||e.index===void 0?(console.error("patch: input border: failed to find main input pattern"),null):{startIndex:e.index,endIndex:e.index+e[0].length}},Ln=(n,t)=>{const e=Bn(n);if(!e)return null;const r=n.slice(e.startIndex,e.endIndex);let s;return t?(s=r.replace(/borderColor:[$\w+]\(\),?/,"").replace(/borderDimColor:[^,}]+,?/,"").replace(/borderStyle:"[^"]*",?/,"").replace(/borderLeft:![0-1],?/,"").replace(/borderRight:![0-1],?/,""),n.slice(0,e.startIndex)+s+n.slice(e.endIndex)):n};function kn(n){const t=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
2
+ import{Box as d,Text as i,render as ir,useInput as ae,useStdout as sr}from"ink";import{Command as lr}from"commander";import $e,{Fragment as be,createContext as ar,useCallback as Je,useContext as ge,useEffect as ie,useState as M}from"react";import cr from"ink-link";import{Fragment as se,jsx as o,jsxs as a}from"react/jsx-runtime";import*as fe from"node:path";import Ge from"node:path";import*as me from"node:os";import{globbySync as dr}from"globby";import gr from"node:process";import*as Ce from"node:fs";import*as Se from"node:fs/promises";import he from"node:fs/promises";import*as Ne from"node:child_process";import*as hr from"node:crypto";import De from"figlet";import ur from"chalk";function mr({items:e,selectedIndex:t,onSelect:r,onSubmit:n}){return ae((s,l)=>{l.upArrow?r(t>0?t-1:e.length-1):l.downArrow?r(t<e.length-1?t+1:0):l.return&&n(e[t].name)}),o(d,{flexDirection:"column",children:e.map((s,l)=>o(d,{children:a(i,{children:[a(i,{bold:l===t,color:l===t?"cyan":void 0,...l===t?s.selectedStyles??{}:s.styles??{},children:[l===t?"❯ ":" ",s.name]}),s.desc&&l===t&&a(i,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",s.desc]})]})},l))})}let z=function(e){return e.THEMES="Themes",e.LAUNCH_TEXT="Launch text",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.INPUT_BOX="Input box",e.APPLY_CHANGES="*Apply customizations to cli.js",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves tweakcc.json)",e.OPEN_CONFIG="Open tweakcc.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});const J={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)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(147,165,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(177,195,255)",permission:"rgb(177,185,249)",permissionShimmer:"rgb(207,215,255)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",background:"rgb(0,204,204)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",warningShimmer:"rgb(255,223,57)",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)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(177,185,249)",rate_limit_empty:"rgb(80,83,112)"}},{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)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(87,105,247)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(117,135,255)",permission:"rgb(87,105,247)",permissionShimmer:"rgb(137,155,255)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",background:"rgb(0,153,153)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",warningShimmer:"rgb(200,158,80)",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)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(240, 240, 240)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(87,105,247)",rate_limit_empty:"rgb(39,47,111)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"ansi:magenta",bashBorder:"ansi:magenta",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blue",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blue",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyan",ide:"ansi:blueBright",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:black",inverseText:"ansi:white",inactive:"ansi:blackBright",subtle:"ansi:blackBright",suggestion:"ansi:blue",remember:"ansi:blue",background:"ansi:cyan",success:"ansi:green",error:"ansi:red",warning:"ansi:yellow",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:red",blue_FOR_SUBAGENTS_ONLY:"ansi:blue",green_FOR_SUBAGENTS_ONLY:"ansi:green",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellow",purple_FOR_SUBAGENTS_ONLY:"ansi:magenta",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyan",professionalBlue:"ansi:blueBright",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:white",bashMessageBackgroundColor:"ansi:whiteBright",memoryBackgroundColor:"ansi:white",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:black"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"ansi:magentaBright",bashBorder:"ansi:magentaBright",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blueBright",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blueBright",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyanBright",ide:"ansi:blue",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:whiteBright",inverseText:"ansi:black",inactive:"ansi:white",subtle:"ansi:white",suggestion:"ansi:blueBright",remember:"ansi:blueBright",background:"ansi:cyanBright",success:"ansi:greenBright",error:"ansi:redBright",warning:"ansi:yellowBright",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:redBright",blue_FOR_SUBAGENTS_ONLY:"ansi:blueBright",green_FOR_SUBAGENTS_ONLY:"ansi:greenBright",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellowBright",purple_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyanBright",professionalBlue:"rgb(106,155,204)",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:blackBright",bashMessageBackgroundColor:"ansi:black",memoryBackgroundColor:"ansi:blackBright",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:white"}},{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)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(51,102,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(101,152,255)",permission:"rgb(51,102,255)",permissionShimmer:"rgb(101,152,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",background:"rgb(0,153,153)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",warningShimmer:"rgb(255,183,50)",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)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(220, 220, 220)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(51,102,255)",rate_limit_empty:"rgb(23,46,114)"}},{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)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(153,204,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(183,224,255)",permission:"rgb(153,204,255)",permissionShimmer:"rgb(183,224,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",background:"rgb(0,204,204)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",warningShimmer:"rgb(255,234,50)",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)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(153,204,255)",rate_limit_empty:"rgb(69,92,115)"}}],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}},Le=fe.join(me.homedir(),".tweakcc"),le=fe.join(Le,"config.json"),pe=fe.join(Le,"cli.js.backup"),fr=()=>{const e=[],t=process.platform=="win32"?me.homedir().replace(/\\/g,"/"):me.homedir(),r="node_modules/@anthropic-ai/claude-code",n=(s,l=!1)=>{if(l){const c=dr(s,{onlyFiles:!1});e.push({pattern:s,isGlob:!0,expandedPaths:c})}else e.push({pattern:s,isGlob:!1,expandedPaths:[s]})};return n(`${me.homedir()}/.claude/local/${r}`),{}.NPM_PREFIX&&n(`${{}.NPM_PREFIX}/lib/${r}`),{}.N_PREFIX&&n(`${{}.N_PREFIX}/lib/${r}`),{}.VOLTA_HOME&&n(`${{}.VOLTA_HOME}/lib/${r}`),{}.FNM_DIR&&n(`${{}.FNM_DIR}/lib/${r}`),{}.NVM_DIR&&n(`${{}.NVM_DIR}/lib/${r}`),{}.NODENV_ROOT&&n(`${{}.NODENV_ROOT}/versions/*/lib/${r}`,!0),{}.NVS_HOME&&n(`${{}.NVS_HOME}/node/*/*/lib/${r}`,!0),{}.ASDF_DATA_DIR&&n(`${{}.ASDF_DATA_DIR}/installs/nodejs/*/lib/${r}`,!0),process.platform=="win32"?(n(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${r}`),n(`${t}/AppData/Roaming/npm/${r}`),n(`${t}/AppData/Roaming/nvm/*/${r}`,!0),n(`${t}/AppData/Local/Yarn/config/global/${r}`),n(`${t}/AppData/Local/pnpm/global/*/${r}`,!0),n(`${t}/n/versions/node/*/lib/${r}`,!0),n(`${t}/AppData/Roaming/Yarn/config/global/${r}`),n(`${t}/AppData/Roaming/pnpm-global/${r}`),n(`${t}/AppData/Roaming/pnpm-global/*/${r}`,!0),n(`${t}/.bun/install/global/${r}`),n(`${t}/AppData/Local/fnm_multishells/*/node_modules/${r}`,!0)):(process.platform=="darwin"&&(n(`${t}/Library/${r}`),n(`/opt/local/lib/${r}`)),n(`${t}/.local/lib/${r}`),n(`${t}/.local/share/${r}`),n(`${t}/.npm-global/lib/${r}`),n(`${t}/.npm-packages/lib/${r}`),n(`${t}/.npm/lib/${r}`),n(`${t}/npm/lib/${r}`),n(`/etc/${r}`),n(`/lib/${r}`),n(`/opt/node/lib/${r}`),n(`/usr/lib/${r}`),n(`/usr/local/lib/${r}`),n(`/usr/share/${r}`),n(`/var/lib/${r}`),n(`/opt/homebrew/lib/${r}`),n(`${t}/.config/yarn/global/${r}`),n(`${t}/.yarn/global/${r}`),n(`${t}/.bun/install/global/${r}`),n(`${t}/.pnpm-global/${r}`),n(`${t}/.pnpm-global/*/${r}`,!0),n(`${t}/pnpm-global/${r}`),n(`${t}/pnpm-global/*/${r}`,!0),n(`${t}/.local/share/pnpm/global/${r}`),n(`${t}/.local/share/pnpm/global/*/${r}`,!0),n(`${t}/.bun/install/global/${r}`),n(`/usr/local/n/versions/node/*/lib/${r}`,!0),n(`${t}/n/versions/node/*/lib/${r}`,!0),n(`${t}/n/lib/${r}`),n(`${t}/.volta/tools/image/node/*/lib/${r}`,!0),n(`${t}/.fnm/node-versions/*/installation/lib/${r}`,!0),n(`/usr/local/nvm/versions/node/*/lib/${r}`,!0),n(`${t}/.nvm/versions/node/*/lib/${r}`,!0),n(`${t}/.nodenv/versions/*/lib/${r}`,!0),n(`${t}/.nvs/*/lib/${r}`,!0),n(`${t}/.asdf/installs/nodejs/*/lib/${r}`,!0)),process.platform=="win32"&&e.forEach(s=>{s.pattern=s.pattern.replace(/\//g,"\\"),s.expandedPaths=s.expandedPaths.map(l=>l.replace(/\//g,"\\"))}),e},Re=fr(),je=Re.flatMap(e=>e.expandedPaths),br=({children:e,...t})=>a(i,{bold:!0,backgroundColor:"#ffd500",color:"#000",...t,children:[" ",e," "]});var de=br;const pr=[{name:z.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:z.LAUNCH_TEXT,desc:`Change the "CLAUDE CODE" banner text that's shown when you sign in to Claude Code`},{name:z.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:z.THINKING_STYLE,desc:"Choose custom spinners"},{name:z.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:z.INPUT_BOX,desc:"Customize the input box appearance (e.g., remove border)"}],wr=[{name:z.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:z.OPEN_CONFIG,desc:`Opens your tweakcc config file (${le})`},{name:z.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:z.EXIT,desc:"Bye!"}];function xr({onSubmit:e,notification:t}){const r=[...ge(ce).changesApplied?[]:[{name:z.APPLY_CHANGES,desc:"Required: Updates Claude Code's cli.js in-place with your changes",selectedStyles:{color:"green"}}],...pr,...wr],[n,s]=M(0);return a(d,{flexDirection:"column",children:[o(d,{marginBottom:1,children:o(de,{children:"Tweak Claude Code"})}),o(d,{marginBottom:1,children:a(i,{color:"gray",children:[o(i,{bold:!0,children:"Customize your Claude Code installation."})," ",o(i,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),o(d,{marginBottom:1,children:a(i,{color:"yellow",children:["⭐ ",o(i,{bold:!0,children:"Star the repo at "}),o(cr,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:o(i,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),o(i,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),t&&o(d,{marginBottom:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:"bold",borderColor:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",paddingLeft:1,flexDirection:"column",children:o(i,{color:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",children:t?.message})}),o(mr,{items:r,selectedIndex:n,onSelect:s,onSubmit:l=>e(l)})]})}const Xe=async()=>{await he.mkdir(Le,{recursive:!0})};let Ie={settings:J,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const Pe=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:J};try{oe()&&console.log(`Reading config at ${le}`);const t=await he.readFile(le,"utf8"),r={...e,...JSON.parse(t)},n=r?.settings?.thinkingVerbs;n?.punctuation&&(n.format="{}"+n.punctuation,delete n.punctuation),r.settings.inputBox||(r.settings.inputBox=J.inputBox);for(const s of J.themes){const l=r?.settings?.themes.find(c=>c.id===s.id||c.name===s.name);if(l){for(const[c,h]of Object.entries(s))c!=="colors"&&!Object.hasOwn(l,c)&&(l[c]=h);l.colors||(l.colors={});for(const[c,h]of Object.entries(s.colors))Object.hasOwn(l.colors,c)||(l.colors[c]=h)}}for(const s of r?.settings?.themes||[]){if(J.themes.some(h=>h.id===s.id||h.name===s.name))continue;const c=J.themes[0];s.colors||(s.colors={});for(const[h,u]of Object.entries(c.colors))Object.hasOwn(s.colors,h)||(s.colors[h]=u)}return r?.settings?.userMessageDisplay||(r.settings=r.settings||J,r.settings.userMessageDisplay=J.userMessageDisplay),Ie=r,r}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return e;throw t}},ve=async e=>(oe()&&console.log(`Updating config at ${le}`),e(Ie),Ie.lastModified=new Date().toISOString(),await _r(Ie),Ie),_r=async e=>{try{e.lastModified=new Date().toISOString(),await Xe(),await he.writeFile(le,JSON.stringify(e,null,2))}catch(t){throw console.error("Error saving config:",t),t}},Ke=async e=>{oe()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);const t=await he.readFile(pe);return await nr(e.cliPath,t,"restore"),await ve(r=>{r.changesApplied=!1}),!0},Sr=async e=>{e.ccInstallationDir&&je.unshift(e.ccInstallationDir);for(const t of je)try{oe()&&console.log(`Searching for Claude Code cli.js file at ${t}`);const r=Ge.join(t,"cli.js");if(!await Ze(r))continue;oe()&&(console.log(`Found Claude Code cli.js file at ${t}; checking hash...`),console.log(`SHA256 hash: ${await hn(r)}`));const n=Ge.join(t,"package.json");let s;try{s=JSON.parse(await he.readFile(n,"utf8"))}catch(l){if(!(l instanceof Error&&"code"in l&&l.code==="ENOENT"))throw l}return{cliPath:r,packageJsonPath:n,version:s?.version}}catch(r){if(r instanceof Error&&"code"in r&&r.code==="ENOENT")continue;throw r}return null},Ye=async e=>{await Xe(),oe()&&console.log(`Backing up cli.js to ${pe}`),await he.copyFile(e.cliPath,pe),await ve(t=>{t.changesApplied=!1,t.ccVersion=e.version})};async function Ze(e){try{return await he.stat(e),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}}async function We(){const e=await Pe(),t=await Sr(e);if(!t)return null;const r=t.version,n=e.ccVersion;let s=!1;return await Ze(pe)||(oe()&&console.log(`startupCheck: ${pe} not found; backing up cli.js`),await Ye(t),s=!0),r!==n?(s||(oe()&&console.log(`startupCheck: real version (${r}) != backed up version (${n}); backing up cli.js`),await he.unlink(pe),await Ye(t)),{wasUpdated:!0,oldVersion:n,newVersion:r,ccInstInfo:t}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}}const Ir=e=>{const t=[],r=/visibleOptionCount:[\w$]+=(\d+)/g;let n;for(;(n=r.exec(e))!==null;){const s=n.index+n[0].indexOf("=")+1;t.push({startIndex:s,endIndex:s+n[1].length})}return t},yr=(e,t)=>{const r=Ir(e);if(r.length===0)return null;const n=r.sort((l,c)=>c.startIndex-l.startIndex);let s=e;for(const l of n){const c=t.toString(),h=s.slice(0,l.startIndex)+c+s.slice(l.endIndex);q(s,h,c,l.startIndex,l.endIndex),s=h}return s};function Cr(e){const t=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,r=e.match(t);if(!r||r.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const n=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,s=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,l=e.match(n),c=e.match(s);return!l||l.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!c||c.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:l.index,endIndex:l.index+l[0].length},obj:{startIndex:c.index,endIndex:c.index+c[0].length}}}const vr=(e,t)=>{const r=Cr(e);if(!r)return null;if(t.length===0)return e;let n=e;const s="return"+JSON.stringify(Object.fromEntries(t.map(h=>[h.id,h.name])));n=n.slice(0,r.obj.startIndex)+s+n.slice(r.obj.endIndex),q(e,n,s,r.obj.startIndex,r.obj.endIndex),e=n;const l=JSON.stringify(t.map(h=>({label:h.name,value:h.id})));n=n.slice(0,r.objArr.startIndex)+l+n.slice(r.objArr.endIndex),q(e,n,l,r.objArr.startIndex,r.objArr.endIndex),e=n;let c=`switch(${r.switchStatement.identifiers?.[0]}){
3
+ `;return t.forEach(h=>{c+=`case"${h.id}":return${JSON.stringify(h.colors)};
4
+ `}),c+=`default:return${JSON.stringify(t[0].colors)};
5
+ }`,n=n.slice(0,r.switchStatement.startIndex)+c+n.slice(r.switchStatement.endIndex),q(e,n,c,r.switchStatement.startIndex,r.switchStatement.endIndex),n},Br=e=>{const t=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,r=e.match(t);return!r||r.index===void 0?(console.error("patch: context limit: failed to find match"),null):r.index+r[0].indexOf("{")+1},Mr=e=>{const t=Br(e);if(!t)return null;const r="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",n=e.slice(0,t)+r+e.slice(t);return q(e,n,r,t,t),n},Tr=e=>{const t=e.indexOf('bash:"bashBorder"');if(t===-1)return console.error("patch: input border: failed to find bash pattern"),null;const r=e.slice(t,t+500),n=/borderStyle:"[^"]*"/,s=r.match(n);return!s||s.index===void 0?(console.error("patch: input border: failed to find border style pattern"),null):{startIndex:t+s.index,endIndex:t+s.index+s[0].length}},$r=(e,t)=>{const r=Tr(e);if(!r)return null;if(t){const n="borderColor:undefined",s=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return q(e,s,n,r.startIndex,r.endIndex),s}else return e};function Nr(e){const t=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
12
6
  ██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝
13
7
  ██║ ██║ ███████║██║ ██║██║ ██║█████╗
14
8
  ██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝
@@ -19,22 +13,28 @@ import{Box as a,Text as i,render as rn,useInput as le,useStdout as tn}from"ink";
19
13
  ██║ ██║ ██║██║ ██║█████╗
20
14
  ██║ ██║ ██║██║ ██║██╔══╝
21
15
  ╚██████╗╚██████╔╝██████╔╝███████╗
22
- ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,e=n.indexOf(t);return e!==-1?{startIndex:e-1,endIndex:e+t.length+1}:null}function Rn(n,t){const e=kn(n);if(!e)return n;const r=JSON.stringify(t),s=n.slice(0,e.startIndex)+r+n.slice(e.endIndex);return ee(n,s,r,e.startIndex,e.endIndex),s}const Pn=n=>{const t=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,e=n.match(t);if(!e||e.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const r=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,s=e[0].match(r);if(!s||s.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const c=e.index+s.index,h=c+s[0].length;return{startIndex:c,endIndex:h}},Un=n=>{const t=Pn(n);if(!t)return null;const e=n.slice(0,t.startIndex)+n.slice(t.endIndex);return ee(n,e,"",t.startIndex,t.endIndex),e},Gn=n=>{const t=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,e=n.match(t);if(!e||e.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const r=n.slice(e.index,e.index+600),s=/([$\w]+)(=\(([^;]{1,200}?)\)\+"…")/,c=r.match(s);return!c||c.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:e.index+c.index+c[1].length,endIndex:e.index+c.index+c[1].length+c[2].length,identifiers:[c[3]]}},Fn=(n,t)=>{const e=Gn(n);if(!e)return null;const r=e,s=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),c=r.identifiers?.[0],g=`=${"`"+s.replace(/\{\}/g,"${"+c+"}")+"`"}`,f=n.slice(0,r.startIndex)+g+n.slice(r.endIndex);return ee(n,f,g,r.startIndex,r.endIndex),f},Vn=n=>{const t=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,e=n.match(t);return!e||e.index==null?(console.error("patch: thinker symbol mirror option: failed to find match"),null):{startIndex:e.index,endIndex:e.index+e[0].length,identifiers:[e[1]]}},Wn=(n,t)=>{const e=Vn(n);if(!e)return null;const r=e.identifiers?.[0],s=t?`=[...${r},...[...${r}].reverse()]`:`=[...${r}]`,c=n.slice(0,e.startIndex)+s+n.slice(e.endIndex);return ee(n,c,s,e.startIndex,e.endIndex),c},jn=n=>{const t=[],e=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let r;for(;(r=e.exec(n))!==null;)t.push({startIndex:r.index,endIndex:r.index+r[0].length});return t},Yn=(n,t)=>{const e=jn(n);if(e.length===0)return null;const r=JSON.stringify(t),s=e.sort((h,g)=>g.startIndex-h.startIndex);let c=n;for(let h=0;h<s.length;h++){const g=c.slice(0,s[h].startIndex)+r+c.slice(s[h].endIndex);ee(c,g,r,s[h].startIndex,s[h].endIndex),c=g}return c},zn=n=>{const t=/[, ][$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,e=n.match(t);if(!e||e.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const r=e[0],s=e[1],c=r.lastIndexOf(s),h=e.index+c,g=h+s.length;return{startIndex:h,endIndex:g}},Hn=(n,t)=>{const e=zn(n);if(!e)return null;const r=JSON.stringify(t),s=n.slice(0,e.startIndex)+r+n.slice(e.endIndex);return ee(n,s,r,e.startIndex,e.endIndex),s},Jn=n=>{const t=/\{flexWrap:"wrap",height:1,width:2\}/,e=n.match(t);return!e||e.index==null?(console.error("patch: thinker symbol width: failed to find match"),null):{startIndex:e.index,endIndex:e.index+e[0].length}},Xn=(n,t)=>{const e=Jn(n);if(!e)return null;const r=`{flexWrap:"wrap",height:1,width:${t}}`,s=n.slice(0,e.startIndex)+r+n.slice(e.endIndex);return ee(n,s,r,e.startIndex,e.endIndex),s},Kn=n=>{const t=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,e=n.match(t);return!e||e.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:e.index+1,endIndex:e.index+e[0].length,identifiers:[e[1]]}},Zn=n=>{const t=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,e=n.match(t);return!e||e.index==null?(console.error("patch: thinker verbs: failed to find match"),null):{startIndex:e.index,endIndex:e.index+e[0].length,identifiers:[e[1]]}},qn=(n,t)=>{const e=Kn(n);if(!e)return null;const r=e,s=r.identifiers?.[0],c=`${s}=${JSON.stringify({words:t})}`,h=n.slice(0,r.startIndex)+c+n.slice(r.endIndex);ee(n,h,c,r.startIndex,r.endIndex);const g=Zn(h);if(!g)return null;const f=g,I=`function ${f.identifiers?.[0]}(){return ${s}.words}`,A=h.slice(0,f.startIndex)+I+h.slice(f.endIndex);return ee(h,A,I,f.startIndex,f.endIndex),A},Qn=n=>{const t=n.indexOf("No content found in user prompt message");if(t===-1)return console.error("patch: userMessageDisplay: failed to find error message"),null;const e=Math.min(n.length,t+400),r=n.slice(t,e),s=/\{minWidth:(\d+),width:\d+\}/,c=r.match(s);if(!c||c.index===void 0)return console.error("patch: userMessageDisplay: failed to find minWidth pattern"),null;const h=/\.default\.createElement\([$\w]+,\{dimColor:!0\},"([^"]+)"\)/,g=r.match(h),f=/createElement\(([$\w]+),\{text:([$\w]+)/,d=r.match(f);return{minWidthLocation:c&&{startIndex:t+c.index,endIndex:t+c.index+c[0].length},prefixLocation:g?{startIndex:t+g.index,endIndex:t+g.index+g[0].length}:null,messageLocation:d&&{startIndex:t+d.index,endIndex:t+d.index+d[0].length}}},er=(n,t,e,r,s=!1,c=!1,h=!1,g=!1,f=!1,d,I,A=!1,C=!1,v=!1,D=!1,k=!1)=>{const T=Qn(n);if(!T)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!T.minWidthLocation)return console.error("patch: userMessageDisplay: failed to find minWidth location"),null;if(!T.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!T.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const R=gr(n);if(!R)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const P=[];P.push({startIndex:T.minWidthLocation.startIndex,endIndex:T.minWidthLocation.endIndex,newContent:`{minWidth:${t.length+1},width:${t.length+1}}`});const H=e==="rgb(0,0,0)"&&r==="rgb(0,0,0)",W=!H||(s||c||h||g||f),X=d==="rgb(0,0,0)"&&I==="rgb(0,0,0)",K=!X||(A||C||v||D||k);if(W){const y=Ve(R,H?null:e.match(/\d+/g)?.join(",")||null,H?null:r.match(/\d+/g)?.join(",")||null,s,c,h,g,f);P.push({startIndex:T.prefixLocation.startIndex,endIndex:T.prefixLocation.endIndex,newContent:n.slice(T.prefixLocation.startIndex,T.prefixLocation.endIndex).replace(/"([^"]+)"\)$/,`${y}("${t}"))`)})}else P.push({startIndex:T.prefixLocation.startIndex,endIndex:T.prefixLocation.endIndex,newContent:n.slice(T.prefixLocation.startIndex,T.prefixLocation.endIndex).replace(/"([^"]+)"\)$/,`"${t}")`)});if(K){const y=Ve(R,X?null:d.match(/\d+/g)?.join(",")||null,X?null:I.match(/\d+/g)?.join(",")||null,A,C,v,D,k);P.push({startIndex:T.messageLocation.startIndex,endIndex:T.messageLocation.endIndex,newContent:n.slice(T.messageLocation.startIndex,T.messageLocation.endIndex).replace(/text:([$\w]+)/,`text:${y}($1)`)})}P.sort((y,x)=>x.startIndex-y.startIndex);let $=n;for(const y of P){const x=$;$=$.slice(0,y.startIndex)+y.newContent+$.slice(y.endIndex),ee(x,$,y.newContent,y.startIndex,y.endIndex)}return $},nr=n=>{const t=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,e=n.match(t);if(!e||e.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const r=e[0],s=/verbose:[^,}]+/,c=r.match(s);if(!c||c.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const h=e.index+c.index,g=h+c[0].length;return{startIndex:h,endIndex:g}},rr=n=>{const t=nr(n);if(!t)return null;const e="verbose:true",r=n.slice(0,t.startIndex)+e+n.slice(t.endIndex);return ee(n,r,e,t.startIndex,t.endIndex),r};function tr(n){const t=/" Welcome to ",[$\w]+\.createElement\([^,]+,\{bold:!0\},"Claude Code"\),"!"/,e=n.match(t);if(e&&e.index!==void 0){const r=e[0].indexOf('"Claude Code"');if(r!==-1)return{startIndex:e.index+r,endIndex:e.index+r+13}}return null}function or(n,t){const e=tr(n);if(!e)return console.error("patch: welcome message: failed to find location"),null;const r=`"${t}"`,s=n.slice(0,e.startIndex)+r+n.slice(e.endIndex);return ee(n,s,r,e.startIndex,e.endIndex),s}const Le=[{label:"Opus 4.1",slug:"opus-4.1",internal:"claude-opus-4-1-20250805"},{label:"Opus 4",slug:"opus-4",internal:"claude-opus-4-20250514"},{label:"Sonnet 4",slug:"sonnet-4",internal:"claude-sonnet-4-20250514"},{label:"Sonnet 3.7",slug:"sonnet-3.7",internal:"claude-3-7-sonnet-20250219"},{label:"Sonnet 3.5 (October)",slug:"sonnet-3.5-october",internal:"claude-3-5-sonnet-20241022"},{label:"Sonnet 3.5 (June)",slug:"sonnet-3.5-june",internal:"claude-3-5-sonnet-20240620"},{label:"Haiku 3.5",slug:"haiku-3.5",internal:"claude-3-5-haiku-20241022"},{label:"Haiku 3",slug:"haiku-3",internal:"claude-3-haiku-20240307"},{label:"Opus 3",slug:"opus-3",internal:"claude-3-opus-20240229"}],ir=n=>{const t=n.indexOf("Switch between Claude models");if(t===-1)return null;const e=Math.max(0,t-600),r=t,c=n.slice(e,r).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!c||c.index===void 0)return null;let g=e+c.index;for(;g<n.length&&n[g]!==";";)g++;if(g>=n.length)return null;const f=g+1,d=c[1];return{insertionIndex:f,optionsVar:d}},sr=n=>{const t=ir(n);if(!t)return null;const{insertionIndex:e,optionsVar:r}=t,s=Le.map(h=>{const g=JSON.stringify(h.label),f=JSON.stringify(h.slug);return`${r}.push({value:${f},label:${g}});`}).join(""),c=n.slice(0,e)+s+n.slice(e);return ee(n,c,s,e,e),c},lr=n=>{const t=n.match(/"sonnet\[1m\]"/);if(!t||t.index===void 0)return null;let r=t.index;for(;r>=0&&n[r]!=="[";)r--;if(r<0)return null;let s=r-1;for(;s>=0&&/\s/.test(n[s]);)s--;if(s<0||n[s]!=="=")return null;let c=r,h=0,g=-1;for(;c<n.length;){const D=n[c];if(D==="["&&h++,D==="]"&&(h--,h===0)){g=c;break}c++}if(g===-1)return null;const f=n.slice(r,g+1);let d;try{d=JSON.parse(f)}catch{return null}const I=Le.map(D=>D.slug),A=new Set(d);for(const D of I)A.add(D);const C=JSON.stringify(Array.from(A)),v=n.slice(0,r)+C+n.slice(g+1);return ee(n,v,C,r,g+1),v},cr=n=>{const e=n.indexOf('case"sonnet[1m]"');if(e===-1)return null;let r=e;for(;r>=0&&n[r]!=="{";)r--;if(r<0)return null;let s=e;for(;s<n.length&&n[s]!=="}";)s++;if(s>=n.length)return null;const c=n.slice(r,s+1),h=Le.map(C=>`case${JSON.stringify(C.slug)}:return${JSON.stringify(C.internal)};`).join(""),g=c.slice(0,-1),d=(/;\s*$/.test(g)?"":";")+h,I=g+d+"}",A=n.slice(0,r)+I+n.slice(s+1);return ee(n,A,h,r+c.length-1,r+c.length-1),A},ar=n=>{let t=n;const e=lr(t);e&&(t=e);const r=cr(t);r&&(t=r);const s=sr(t);return s&&(t=s),t===n?null:t},dr=n=>{const e=n.indexOf("subscription, no need to monitor cost");if(e===-1)return console.error("patch: ignoreMaxSubscription: phrase not found"),null;const r=Math.max(0,e-60),s=e,c=n.slice(r,s),h=/if\(([$\w]+)\(\)\)/g;let g=null;for(const I of c.matchAll(h))g=I;if(!g||g.index===void 0)return console.error("patch: ignoreMaxSubscription: could not match if(<id>()) nearby"),null;const f=r+g.index,d=f+g[0].length;return{startIndex:f,endIndex:d}},hr=n=>{const t=dr(n);if(!t)return null;const e="if(!1)",r=n.slice(0,t.startIndex)+e+n.slice(t.endIndex);return ee(n,r,e,t.startIndex,t.endIndex),r},ee=(n,t,e,r,s)=>{const c=Math.max(0,r-20),h=Math.min(n.length,s+20),g=Math.min(t.length,r+e.length+20),f=n.slice(c,r),d=n.slice(r,s),I=n.slice(s,h),A=t.slice(c,r),C=t.slice(r,r+e.length),v=t.slice(r+e.length,g);te()&&d!==C&&(console.log(`
23
- --- Diff ---`),console.log("OLD:",f+`\x1B[31m${d}\x1B[0m`+I),console.log("NEW:",A+`\x1B[32m${C}\x1B[0m`+v),console.log(`--- End Diff ---
24
- `))},gr=n=>{const t=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,e=Array.from(n.matchAll(t)),r={};for(const h of e){const g=h[1];r[g]=(r[g]||0)+1}let s,c=0;for(const[h,g]of Object.entries(r))g>c&&(c=g,s=h);return s},nn=async(n,t)=>{await Qe(t);let e=await xe.readFile(t.cliPath,{encoding:"utf8"}),r=null;if(n.settings.themes&&n.settings.themes.length>0&&(r=Nn(e,n.settings.themes))&&(e=r),n.settings.launchText){const s=n.settings.launchText;let c="";s.method==="custom"&&s.customText?c=s.customText:s.method==="figlet"&&s.figletText&&(c=await new Promise(g=>Ae.text(s.figletText.replace(`
25
- `," "),s.figletFont,(f,d)=>{f?(console.error("patch: figlet: failed to generate text",f),g("")):g(d||"")}))),(r=Rn(e,c))&&(e=r);const h=s.method==="custom"?s.customText:s.figletText;h&&(r=or(e,h))&&(e=r)}return n.settings.thinkingVerbs&&((r=qn(e,n.settings.thinkingVerbs.verbs))&&(e=r),(r=Fn(e,n.settings.thinkingVerbs.format))&&(e=r)),(r=Yn(e,n.settings.thinkingStyle.phases))&&(e=r),(r=Hn(e,n.settings.thinkingStyle.updateInterval))&&(e=r),(r=Xn(e,Math.max(...n.settings.thinkingStyle.phases.map(s=>s.length))+1))&&(e=r),(r=Wn(e,n.settings.thinkingStyle.reverseMirror))&&(e=r),n.settings.userMessageDisplay&&(r=er(e,n.settings.userMessageDisplay.prefix.format,n.settings.userMessageDisplay.prefix.foreground_color,n.settings.userMessageDisplay.prefix.background_color,n.settings.userMessageDisplay.prefix.styling.includes("bold"),n.settings.userMessageDisplay.prefix.styling.includes("italic"),n.settings.userMessageDisplay.prefix.styling.includes("underline"),n.settings.userMessageDisplay.prefix.styling.includes("strikethrough"),n.settings.userMessageDisplay.prefix.styling.includes("inverse"),n.settings.userMessageDisplay.message.foreground_color,n.settings.userMessageDisplay.message.background_color,n.settings.userMessageDisplay.message.styling.includes("bold"),n.settings.userMessageDisplay.message.styling.includes("italic"),n.settings.userMessageDisplay.message.styling.includes("underline"),n.settings.userMessageDisplay.message.styling.includes("strikethrough"),n.settings.userMessageDisplay.message.styling.includes("inverse")))&&(e=r),n.settings.inputBox&&typeof n.settings.inputBox.removeBorder=="boolean"&&(r=Ln(e,n.settings.inputBox.removeBorder))&&(e=r),(r=rr(e))&&(e=r),(r=Un(e))&&(e=r),(r=En(e))&&(e=r),(r=ar(e))&&(e=r),(r=On(e,25))&&(e=r),(r=hr(e))&&(e=r),await Ke(t.cliPath,e,"patch"),await ve(s=>{s.changesApplied=!0})},ae=sn({settings:q,updateSettings:n=>{},changesApplied:!1});function ur({startupCheckInfo:n}){const[t,e]=_({settings:q,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});oe(()=>{(async()=>{e(await Be())})()},[]);const r=Ye(I=>{const A=JSON.parse(JSON.stringify(t.settings));I(A),e(C=>({...C,settings:A,changesApplied:!1})),ve(C=>{C.settings=A,C.changesApplied=!1})},[t.settings]),[s,c]=_(null),[h,g]=_(null);oe(()=>{n.wasUpdated&&n.oldVersion&&(g({message:`Your Claude Code installation was updated from ${n.oldVersion} to ${n.newVersion}, and the patching was likely overwritten
26
- (However, your customization are still remembered in ${ie}.)
27
- Please reapply your changes below.`,type:"warning"}),r(()=>{}))},[]),le((I,A)=>{(A.ctrl&&I==="c"||(I==="q"||A.escape)&&!s)&&process.exit(0)});const f=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:c(I);break;case Y.APPLY_CHANGES:n.ccInstInfo&&(g({message:"Applying patches...",type:"info"}),nn(t,n.ccInstInfo).then(A=>{e(A),g({message:"Customization patches applied successfully!",type:"success"})}));break;case Y.RESTORE_ORIGINAL:n.ccInstInfo&&Qe(n.ccInstInfo).then(()=>{g({message:"Original Claude Code restored successfully!",type:"success"}),r(()=>{})});break;case Y.OPEN_CONFIG:Fe(ie);break;case Y.OPEN_CLI:n.ccInstInfo&&Fe(n.ccInstInfo.cliPath);break;case Y.EXIT:process.exit(0)}},d=()=>{c(null)};return o(ae.Provider,{value:{settings:t.settings,updateSettings:r,changesApplied:t.changesApplied},children:o(a,{flexDirection:"column",children:s===null?o(mn,{onSubmit:f,notification:h}):s===Y.THEMES?o(Sn,{onBack:d}):s===Y.LAUNCH_TEXT?o(In,{onBack:d}):s===Y.THINKING_VERBS?o(yn,{onBack:d}):s===Y.THINKING_STYLE?o(Cn,{onBack:d}):s===Y.USER_MESSAGE_DISPLAY?o(vn,{onBack:d}):s===Y.INPUT_BOX?o(Mn,{onSubmit:d}):null})})}const fr=async()=>{const n=new on;n.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("1.5.4").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),n.parse();const t=n.opts();if(t.debug&&pn(),t.apply){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${ie}`);try{const r=await Be();(!r.settings||Object.keys(r.settings).length===0)&&(console.error("No saved customizations found in "+ie),process.exit(1));const s=await je();(!s||!s.ccInstInfo)&&(console.error("Cannot find Claude Code's cli.js"),console.error("Searched at the following locations:"),Ne.forEach(c=>{c.isGlob?c.expandedPaths.length===0?console.error(` - ${c.pattern} (no matches)`):(console.error(` - ${c.pattern}`),c.expandedPaths.forEach(h=>{console.error(` - ${h}`)})):console.error(` - ${c.pattern}`)}),process.exit(1)),console.log(`Found Claude Code at: ${s.ccInstInfo.cliPath}`),console.log(`Version: ${s.ccInstInfo.version}`),console.log("Applying customizations..."),await nn(r,s.ccInstInfo),console.log("Customizations applied successfully!"),process.exit(0)}catch(r){console.error("Unexpected error:"),console.error(r instanceof Error?r.message:String(r)),process.exit(1)}}const e=await je();e?rn(o(ur,{startupCheckInfo:e})):(console.error(`Cannot find Claude Code's cli.js -- do you have Claude Code installed?
16
+ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,r=e.indexOf(t);return r!==-1?{startIndex:r-1,endIndex:r+t.length+1}:null}function Or(e,t){const r=Nr(e);if(!r)return e;const n=JSON.stringify(t),s=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return q(e,s,n,r.startIndex,r.endIndex),s}const Ar=e=>{const t=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,r=e.match(t);if(!r||r.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const n=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,s=r[0].match(n);if(!s||s.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const l=r.index+s.index,c=l+s[0].length;return{startIndex:l,endIndex:c}},kr=e=>{const t=Ar(e);if(!t)return null;const r=e.slice(0,t.startIndex)+e.slice(t.endIndex);return q(e,r,"",t.startIndex,t.endIndex),r},Er=e=>{const t=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,r=e.match(t);if(!r||r.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const n=e.slice(r.index,r.index+600),s=/([$\w]+)(=\(([^;]{1,200}?)\)\+"…")/,l=n.match(s);return!l||l.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:r.index+l.index+l[1].length,endIndex:r.index+l.index+l[1].length+l[2].length,identifiers:[l[3]]}},Dr=(e,t)=>{const r=Er(e);if(!r)return null;const n=r,s=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),l=n.identifiers?.[0],h=`=${"`"+s.replace(/\{\}/g,"${"+l+"}")+"`"}`,u=e.slice(0,n.startIndex)+h+e.slice(n.endIndex);return q(e,u,h,n.startIndex,n.endIndex),u},Rr=e=>{const t=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,r=e.match(t);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]]}},Lr=(e,t)=>{const r=Rr(e);if(!r)return null;const n=r.identifiers?.[0],s=t?`=[...${n},...[...${n}].reverse()]`:`=[...${n}]`,l=e.slice(0,r.startIndex)+s+e.slice(r.endIndex);return q(e,l,s,r.startIndex,r.endIndex),l},Pr=e=>{const t=[],r=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let n;for(;(n=r.exec(e))!==null;)t.push({startIndex:n.index,endIndex:n.index+n[0].length});return t},Fr=(e,t)=>{const r=Pr(e);if(r.length===0)return null;const n=JSON.stringify(t),s=r.sort((c,h)=>h.startIndex-c.startIndex);let l=e;for(let c=0;c<s.length;c++){const h=l.slice(0,s[c].startIndex)+n+l.slice(s[c].endIndex);q(l,h,n,s[c].startIndex,s[c].endIndex),l=h}return l},Ur=e=>{const t=/[, ][$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,r=e.match(t);if(!r||r.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const n=r[0],s=r[1],l=n.lastIndexOf(s),c=r.index+l,h=c+s.length;return{startIndex:c,endIndex:h}},Vr=(e,t)=>{const r=Ur(e);if(!r)return null;const n=JSON.stringify(t),s=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return q(e,s,n,r.startIndex,r.endIndex),s},Gr=e=>{const t=/\{flexWrap:"wrap",height:1,width:2\}/,r=e.match(t);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}},jr=(e,t)=>{const r=Gr(e);if(!r)return null;const n=`{flexWrap:"wrap",height:1,width:${t}}`,s=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return q(e,s,n,r.startIndex,r.endIndex),s},Yr=e=>{const t=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,r=e.match(t);return!r||r.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:r.index+1,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Wr=e=>{const t=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,r=e.match(t);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]]}},zr=(e,t)=>{const r=Yr(e);if(!r)return null;const n=r,s=n.identifiers?.[0],l=`${s}=${JSON.stringify({words:t})}`,c=e.slice(0,n.startIndex)+l+e.slice(n.endIndex);q(e,c,l,n.startIndex,n.endIndex);const h=Wr(c);if(!h)return null;const u=h,_=`function ${u.identifiers?.[0]}(){return ${s}.words}`,I=c.slice(0,u.startIndex)+_+c.slice(u.endIndex);return q(c,I,_,u.startIndex,u.endIndex),I},Hr=e=>{const t=e.indexOf("No content found in user prompt message")-700;if(t===-1)return console.error("patch: userMessageDisplay: failed to find error message"),null;const r=Math.min(e.length,t+700),n=e.slice(t,r),s=/("> "),([$\w]+)/,l=n.match(s);if(!l)return{prefixLocation:null,messageLocation:null};const c=t+n.indexOf(l[1]),h=c+l[1].length,u=h+1,g=u+l[2].length;return{prefixLocation:{startIndex:c,endIndex:h},messageLocation:{startIndex:u,endIndex:g}}},Jr=(e,t,r,n,s=!1,l=!1,c=!1,h=!1,u=!1,g,_,I=!1,y=!1,v=!1,N=!1,L=!1)=>{const A=Hr(e);if(!A)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!A.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!A.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const P=qe(e);if(!P)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const W=[],X=r==="rgb(0,0,0)"&&n==="rgb(0,0,0)",F=!X||(s||l||c||h||u),re=g==="rgb(0,0,0)"&&_==="rgb(0,0,0)",Z=!re||(I||y||v||N||L);if(F){const C=He(P,X?null:r.match(/\d+/g)?.join(",")||null,X?null:n.match(/\d+/g)?.join(",")||null,s,l,c,h,u);W.push({startIndex:A.prefixLocation.startIndex,endIndex:A.prefixLocation.endIndex,newContent:`${C}("${t}")+" "`})}if(Z){const C=He(P,re?null:g.match(/\d+/g)?.join(",")||null,re?null:_.match(/\d+/g)?.join(",")||null,I,y,v,N,L);W.push({startIndex:A.messageLocation.startIndex,endIndex:A.messageLocation.endIndex,newContent:e.slice(A.messageLocation.startIndex,A.messageLocation.endIndex).replace(/([$\w]+)/,`${C}($1)`)})}W.sort((C,S)=>S.startIndex-C.startIndex);let O=e;for(const C of W){const S=O;O=O.slice(0,C.startIndex)+C.newContent+O.slice(C.endIndex),q(S,O,C.newContent,C.startIndex,C.endIndex)}return O},Xr=e=>{const t=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,r=e.match(t);if(!r||r.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const n=r[0],s=/verbose:[^,}]+/,l=n.match(s);if(!l||l.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const c=r.index+l.index,h=c+l[0].length;return{startIndex:c,endIndex:h}},Kr=e=>{const t=Xr(e);if(!t)return null;const r="verbose:true",n=e.slice(0,t.startIndex)+r+e.slice(t.endIndex);return q(e,n,r,t.startIndex,t.endIndex),n};function Zr(e){const t=/" Welcome to ",[$\w]+\.createElement\([^,]+,\{bold:!0\},"Claude Code"\),"!"/,r=e.match(t);if(r&&r.index!==void 0){const n=r[0].indexOf('"Claude Code"');if(n!==-1)return{startIndex:r.index+n,endIndex:r.index+n+13}}return null}function qr(e,t){const r=Zr(e);if(!r)return console.error("patch: welcome message: failed to find location"),null;const n=`"${t}"`,s=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return q(e,s,n,r.startIndex,r.endIndex),s}const Qr=e=>{const r=e.indexOf("subscription, no need to monitor cost");if(r===-1)return console.error("patch: ignoreMaxSubscription: phrase not found"),null;const n=Math.max(0,r-60),s=r,l=e.slice(n,s),c=/if\(([$\w]+)\(\)\)/g;let h=null;for(const _ of l.matchAll(c))h=_;if(!h||h.index===void 0)return console.error("patch: ignoreMaxSubscription: could not match if(<id>()) nearby"),null;const u=n+h.index,g=u+h[0].length;return{startIndex:u,endIndex:g}},en=e=>{const t=Qr(e);if(!t)return null;const r="if(!1)",n=e.slice(0,t.startIndex)+r+e.slice(t.endIndex);return q(e,n,r,t.startIndex,t.endIndex),n},rn=e=>{const t=/\}\.VERSION\} \(Claude Code\)/,r=e.match(t);if(!r||r.index===void 0)return null;const n=/,([$\w]+)\.createElement\(([$\w]+),null,\1\.createElement\(([$\w]+),\{dimColor:!0\}," L "\),\1\.createElement\(\3,null,"Session ID: ",[$\w]+\(\)\)\)/,s=e.match(n);if(!s||s.index===void 0)return null;const l=s.index+s[0].length;return{versionLocation:{startIndex:r.index,endIndex:r.index+r[0].length},sessionIdLocation:{startIndex:l,endIndex:l,identifiers:[s[1],s[2],s[3]]}}},nn=(e,t)=>{const r=rn(e);if(!r)return null;const{versionLocation:n,sessionIdLocation:s}=r,c=`${e.slice(n.startIndex,n.endIndex)}\\n${t} (tweakcc)`,h=e.slice(0,n.startIndex)+c+e.slice(n.endIndex);q(e,h,c,n.startIndex,n.endIndex);const[u,g,_]=s.identifiers,I=qe(e);if(!I)return console.error("patch: versionOutput: failed to find chalk variable"),null;const y=`,${u}.createElement(${g},null,${u}.createElement(${_},{dimColor:!0}," L "),${u}.createElement(${_},null,${I}.rgb(235, 109, 13).bold("tweakcc: v${t}")))`,v=e.slice(0,s.startIndex)+y+e.slice(s.endIndex);return q(e,v,y,s.startIndex,s.endIndex),v},q=(e,t,r,n,s)=>{const l=Math.max(0,n-20),c=Math.min(e.length,s+20),h=Math.min(t.length,n+r.length+20),u=e.slice(l,n),g=e.slice(n,s),_=e.slice(s,c),I=t.slice(l,n),y=t.slice(n,n+r.length),v=t.slice(n+r.length,h);oe()&&g!==y&&(console.log(`
17
+ --- Diff ---`),console.log("OLD:",u+`\x1B[31m${g}\x1B[0m`+_),console.log("NEW:",I+`\x1B[32m${y}\x1B[0m`+v),console.log(`--- End Diff ---
18
+ `))},qe=e=>{const t=/\b([$\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(t)),n={};for(const c of r){const h=c[1];n[h]=(n[h]||0)+1}let s,l=0;for(const[c,h]of Object.entries(n))h>l&&(l=h,s=c);return s},Qe=async(e,t)=>{await Ke(t);let r=await Se.readFile(t.cliPath,{encoding:"utf8"}),n=null;if(e.settings.themes&&e.settings.themes.length>0&&(n=vr(r,e.settings.themes))&&(r=n),e.settings.launchText){const s=e.settings.launchText;let l="";s.method==="custom"&&s.customText?l=s.customText:s.method==="figlet"&&s.figletText&&(l=await new Promise(h=>De.text(s.figletText.replace(`
19
+ `," "),s.figletFont,(u,g)=>{u?(console.error("patch: figlet: failed to generate text",u),h("")):h(g||"")}))),(n=Or(r,l))&&(r=n);const c=s.method==="custom"?s.customText:s.figletText;c&&(n=qr(r,c))&&(r=n)}return e.settings.thinkingVerbs&&((n=zr(r,e.settings.thinkingVerbs.verbs))&&(r=n),(n=Dr(r,e.settings.thinkingVerbs.format))&&(r=n)),(n=Fr(r,e.settings.thinkingStyle.phases))&&(r=n),(n=Vr(r,e.settings.thinkingStyle.updateInterval))&&(r=n),(n=jr(r,Math.max(...e.settings.thinkingStyle.phases.map(s=>s.length))+1))&&(r=n),(n=Lr(r,e.settings.thinkingStyle.reverseMirror))&&(r=n),e.settings.userMessageDisplay&&(n=Jr(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=n),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(n=$r(r,e.settings.inputBox.removeBorder))&&(r=n),(n=Kr(r))&&(r=n),(n=kr(r))&&(r=n),(n=Mr(r))&&(r=n),(n=an(r))&&(r=n),(n=yr(r,25))&&(r=n),(n=en(r))&&(r=n),(n=nn(r,"1.6.0"))&&(r=n),await nr(t.cliPath,r,"patch"),await ve(s=>{s.changesApplied=!0})},Be=[{label:"Opus 4.1",slug:"opus-4.1",internal:"claude-opus-4-1-20250805"},{label:"Opus 4",slug:"opus-4",internal:"claude-opus-4-20250514"},{label:"Sonnet 4",slug:"sonnet-4",internal:"claude-sonnet-4-20250514"},{label:"Sonnet 3.7",slug:"sonnet-3.7",internal:"claude-3-7-sonnet-20250219"},{label:"Sonnet 3.5 (October)",slug:"sonnet-3.5-october",internal:"claude-3-5-sonnet-20241022"},{label:"Sonnet 3.5 (June)",slug:"sonnet-3.5-june",internal:"claude-3-5-sonnet-20240620"},{label:"Haiku 3.5",slug:"haiku-3.5",internal:"claude-3-5-haiku-20241022"},{label:"Haiku 3",slug:"haiku-3",internal:"claude-3-haiku-20240307"},{label:"Opus 3",slug:"opus-3",internal:"claude-3-opus-20240229"}],tn=e=>{const t=e.indexOf("Switch between Claude models");if(t===-1)return null;const r=Math.max(0,t-600),n=t,l=e.slice(r,n).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!l||l.index===void 0)return null;let h=r+l.index;for(;h<e.length&&e[h]!==";";)h++;if(h>=e.length)return null;const u=h+1,g=l[1];return{insertionIndex:u,optionsVar:g}},on=e=>{const t=tn(e);if(!t)return null;const{insertionIndex:r,optionsVar:n}=t,s=Be.map(c=>{const h=JSON.stringify(c.label),u=JSON.stringify(c.slug);return`${n}.push({value:${u},label:${h}});`}).join(""),l=e.slice(0,r)+s+e.slice(r);return q(e,l,s,r,r),l},sn=e=>{const t=e.match(/"sonnet\[1m\]"/);if(!t||t.index===void 0)return null;let n=t.index;for(;n>=0&&e[n]!=="[";)n--;if(n<0)return null;let s=n-1;for(;s>=0&&/\s/.test(e[s]);)s--;if(s<0||e[s]!=="=")return null;let l=n,c=0,h=-1;for(;l<e.length;){const N=e[l];if(N==="["&&c++,N==="]"&&(c--,c===0)){h=l;break}l++}if(h===-1)return null;const u=e.slice(n,h+1);let g;try{g=JSON.parse(u)}catch{return null}const _=Be.map(N=>N.slug),I=new Set(g);for(const N of _)I.add(N);const y=JSON.stringify(Array.from(I)),v=e.slice(0,n)+y+e.slice(h+1);return q(e,v,y,n,h+1),v},ln=e=>{const r=e.indexOf('case"sonnet[1m]"');if(r===-1)return null;let n=r;for(;n>=0&&e[n]!=="{";)n--;if(n<0)return null;let s=r;for(;s<e.length&&e[s]!=="}";)s++;if(s>=e.length)return null;const l=e.slice(n,s+1),c=Be.map(y=>`case${JSON.stringify(y.slug)}:return${JSON.stringify(y.internal)};`).join(""),h=l.slice(0,-1),g=(/;\s*$/.test(h)?"":";")+c,_=h+g+"}",I=e.slice(0,n)+_+e.slice(s+1);return q(e,I,c,n+l.length-1,n+l.length-1),I},an=e=>{let t=e;const r=sn(t);r&&(t=r);const n=ln(t);n&&(t=n);const s=on(t);return s&&(t=s),t===e?null:t};let er=!1;const oe=()=>er,cn=()=>{er=!0};function Me(){try{const e=fe.join(me.homedir(),".claude.json");return JSON.parse(Ce.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function dn(){try{const e=fe.join(me.homedir(),".claude",".credentials.json");switch(JSON.parse(Ce.readFileSync(e,"utf8"))?.claudeAiOauth?.subscriptionType||"unknown"){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro"}}catch{}return"Claude API"}function gn(){try{const e=fe.join(me.homedir(),".claude","settings.json"),r=JSON.parse(Ce.readFileSync(e,"utf8"))?.model||"default";if(r==="opus")return"Opus 4.1";const n=Be.find(s=>s.slug===r);if(n)return n.label}catch{}return"Sonnet 4.5"}function ze(e){if(process.platform==="win32")Ne.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Ne.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const t=fe.dirname(e);Ne.spawn("xdg-open",[t],{detached:!0,stdio:"ignore"}).unref()}}function Fe(e){if(!e||typeof e!="string")return!1;const 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)){const r=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const[,n,s,l]=r;return parseInt(n)<=255&&parseInt(s)<=255&&parseInt(l)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t)){const r=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const[,n,s,l]=r;return parseInt(n)<=360&&parseInt(s)<=100&&parseInt(l)<=100}}return!1}function rr(e){if(!Fe(e))return e;const t=e.trim();if(t.startsWith("rgb("))return t;if(t.startsWith("#")){let r=t.slice(1);r.length===3&&(r=r.split("").map(c=>c+c).join(""));const n=parseInt(r.slice(0,2),16),s=parseInt(r.slice(2,4),16),l=parseInt(r.slice(4,6),16);return`rgb(${n},${s},${l})`}if(t.startsWith("hsl(")){const r=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const n=parseInt(r[1])/360,s=parseInt(r[2])/100,l=parseInt(r[3])/100,c=(y,v,N)=>(N<0&&(N+=1),N>1&&(N-=1),N<1/6?y+(v-y)*6*N:N<1/2?v:N<2/3?y+(v-y)*(2/3-N)*6:y),h=l<.5?l*(1+s):l+s-l*s,u=2*l-h,g=Math.round(c(u,h,n+1/3)*255),_=Math.round(c(u,h,n)*255),I=Math.round(c(u,h,n-1/3)*255);return`rgb(${g},${_},${I})`}}return e}async function hn(e,t="sha256",r=64*1024){return new Promise((n,s)=>{const l=hr.createHash(t),c=Ce.createReadStream(e,{highWaterMark:r});c.on("data",h=>{l.update(h)}),c.on("end",()=>{n(l.digest("hex"))}),c.on("error",h=>{s(h)})})}const He=(e,t,r,n,s,l,c,h)=>{let u=e;return t&&(u+=`.rgb(${t})`),r&&r!=="transparent"&&(u+=`.bgRgb(${r})`),n&&(u+=".bold"),s&&(u+=".italic"),l&&(u+=".underline"),c&&(u+=".strikethrough"),h&&(u+=".inverse"),u};async function nr(e,t,r="replace"){let n=493;try{n=(await Se.stat(e)).mode,oe()&&console.log(`[${r}] Original file mode for ${e}: ${(n&parseInt("777",8)).toString(8)}`)}catch(s){oe()&&console.log(`[${r}] Could not stat ${e} (error: ${s}), using default mode 755`)}try{await Se.unlink(e),oe()&&console.log(`[${r}] Unlinked ${e} to break hard links`)}catch(s){oe()&&console.log(`[${r}] Could not unlink ${e}: ${s}`)}await Se.writeFile(e,t),await Se.chmod(e,n),oe()&&console.log(`[${r}] Restored permissions to ${(n&parseInt("777",8)).toString(8)}`)}function R({color:e,backgroundColor:t,bold:r,dimColor:n,children:s}){const l=e?.startsWith("ansi:"),c=t?.startsWith("ansi:");if(l||c){if($e.Children.toArray(s).some(I=>$e.isValidElement(I)))return o(i,{children:s});let u=ur;if(l){const I=e.slice(5);u=u[I]||u}if(c){const I=t.slice(5),y=I.startsWith("bg")?I:`bg${I.charAt(0).toUpperCase()}${I.slice(1)}`;u=u[y]||u}r&&(u=u.bold),n&&(u=u.dim);const _=$e.Children.toArray(s).map(I=>typeof I=="string"||typeof I=="number"?String(I):"").join("");return o(i,{children:u(_)})}return o(i,{color:e,backgroundColor:t,bold:r,dimColor:n,children:s})}function un({text:e,nonShimmerColors:t,shimmerColors:r,shimmerWidth:n=3,updateDuration:s=50,restartPoint:l=10}){const[c,h]=M(0);return ie(()=>{const u=setInterval(()=>{h(g=>{const _=g+1;return _>=e.length+l?-n:_})},s);return()=>clearInterval(u)},[e.length,l,s]),t.length!==r.length?(console.error("UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length"),o(i,{children:e})):o(i,{children:e.split("").map((u,g)=>{const _=g>=c&&g<c+n&&c<e.length,I=g%t.length,y=_?r[I]:t[I];return o(i,{color:y,children:u},g)})})}const mn=gr.cwd();function tr({theme:e}){const{ccVersion:t}=ge(ce);return a(d,{flexDirection:"column",paddingLeft:1,children:[o(d,{marginBottom:1,children:a(i,{bold:!0,children:["Preview: ",e.name]})}),o(d,{borderStyle:"single",borderColor:"gray",paddingX:1,children:a(d,{flexDirection:"column",children:[a(d,{flexDirection:"column",children:[a(i,{children:[o(R,{color:e.colors.clawd_body,children:" ▐"}),o(i,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"▛███▜"}),a(i,{children:[o(R,{color:e.colors.clawd_body,children:"▌ "})," ",o(i,{bold:!0,children:"Claude Code"})," ",t?`v${t}`:"v2.0.14"]})]}),a(i,{children:[o(R,{color:e.colors.clawd_body,children:"▝▜"}),o(i,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"█████"}),o(R,{color:e.colors.clawd_body,children:"▛▘"})," ",gn()," · ",dn()]}),a(R,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",mn]}),a(i,{children:[a(R,{color:e.colors.success,children:["Login successful. Press"," "]}),o(R,{bold:!0,color:e.colors.success,children:"Enter"}),a(R,{color:e.colors.success,children:[" ","to continue…"]})]})]}),o(i,{children:"╭─────────────────────────────────────────────╮"}),a(i,{children:["│ 1 function greet() ","{"," ","│"]}),a(i,{children:["│ 2"," ",o(R,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:'- console.log("'}),o(R,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),o(R,{backgroundColor:e.colors.diffRemoved,children:'");'})," ","│"]}),a(i,{children:["│ 2"," ",o(R,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:'+ console.log("'}),o(R,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),o(R,{backgroundColor:e.colors.diffAdded,children:'");'})," ","│"]}),o(R,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),a(R,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),a(i,{children:[o(R,{color:e.colors.warning,children:"│ "}),o(i,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),a(R,{color:e.colors.warning,children:[" ","│"]})]}),o(R,{color:e.colors.bashBorder,children:"───────────────────────────────────────────────"}),a(i,{children:[o(R,{color:e.colors.bashBorder,children:"!"}),o(i,{children:" ls"})]}),o(R,{color:e.colors.promptBorder,children:"───────────────────────────────────────────────"}),o(i,{children:a(i,{children:["> list the dir"," ",o(un,{text:"ultrathink",nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),o(R,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),a(i,{children:[o(R,{color:e.colors.planMode,children:"│ "}),a(R,{color:e.colors.permission,children:["Ready to code?"," "]}),o(i,{children:"Here is Claude's plan:"}),a(R,{color:e.colors.planMode,children:[" ","│"]})]}),o(R,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),a(i,{children:[o(R,{color:e.colors.permission,children:"│ "}),o(i,{bold:!0,children:"Permissions:"})," ",a(R,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",o(R,{color:e.colors.permission,children:"│"})]}),o(i,{children:"> list the dir"}),a(i,{children:[o(R,{color:e.colors.error,children:"●"}),o(i,{children:" Update(__init__.py)"})]}),a(i,{children:[o(i,{children:" ⎿ "}),o(R,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),a(i,{children:[" ","1"," ",a(R,{backgroundColor:e.colors.diffRemovedDimmed,children:["- import"," "]}),o(R,{backgroundColor:e.colors.diffRemovedWordDimmed,children:"os"})]}),a(i,{children:[" ","2"," ",a(R,{backgroundColor:e.colors.diffAddedDimmed,children:["+ import"," "]}),o(R,{backgroundColor:e.colors.diffAddedWordDimmed,children:"random"})]}),a(i,{children:[o(R,{color:e.colors.success,children:"●"}),o(i,{children:" List(.)"})]}),a(i,{children:[o(i,{children:"●"}),o(i,{children:" The directory "}),o(R,{color:e.colors.permission,children:"C:\\Users\\user"}),a(i,{children:[" ","contains ",o(i,{bold:!0,children:"123"})," files."]})]}),a(i,{children:[o(R,{color:e.colors.claude,children:"✻ Th"}),o(R,{color:e.colors.claudeShimmer,children:"ink"}),o(R,{color:e.colors.claude,children:"ing… "}),o(i,{children:"(esc to interrupt)"})]}),o(i,{children:o(R,{color:e.colors.autoAccept,children:"⏵⏵ auto-accept edits on (shift+tab to cycle)"})}),o(i,{children:o(R,{color:e.colors.planMode,children:"⏸ plan mode on (shift+tab to cycle)"})}),o(i,{children:o(R,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Oe({colorKey:e,theme:t,bold:r=!1}){const n=t.colors[e];return e==="inverseText"?o(R,{color:n,backgroundColor:t.colors.permission,bold:r,children:e}):e.startsWith("diff")?o(R,{backgroundColor:n,bold:r,color:t.colors.text,children:e}):o(R,{color:n,bold:r,children:e})}function or({initialValue:e,onColorChange:t,onExit:r,colorKey:n,theme:s}){const l=ke(e)||{h:0,s:50,l:50},c=Ae(e)||{r:128,g:128,b:128},[h,u]=M(l),[g,_]=M(c),[I,y]=M("hsl"),[v,N]=M("h"),[L,A]=M(!1),[P,W]=M(!1);ie(()=>{const p=ke(e),b=Ae(e);p&&b&&(A(!0),u(p),_(b),A(!1))},[e]),ie(()=>{if(!L&&P){const p=`rgb(${g.r},${g.g},${g.b})`;t(p)}},[h,g,L,P]),ie(()=>{W(!0)},[]);const X=p=>{if(Fe(p)){const b=rr(p),f=ke(b),B=Ae(b);f&&B&&(A(!0),u(f),_(B),A(!1))}};ae((p,b)=>{if(p.length>1&&!b.ctrl&&!b.meta){X(p);return}if(b.return)r();else if(b.escape)r();else if(b.ctrl&&p==="a")y(f=>f==="hsl"?"rgb":"hsl"),N(f=>I==="hsl"?f==="h"?"r":f==="s"?"g":"b":f==="r"?"h":f==="g"?"s":"l");else if(b.upArrow)N(I==="hsl"?f=>f==="h"?"l":f==="s"?"h":"s":f=>f==="r"?"b":f==="g"?"r":"g");else if(b.downArrow||b.tab)N(I==="hsl"?f=>f==="h"?"s":f==="s"?"l":"h":f=>f==="r"?"g":f==="g"?"b":"r");else if(b.leftArrow){const f=b.shift||b.ctrl||b.meta?-10:-1;K(f)}else if(b.rightArrow){const f=b.shift||b.ctrl||b.meta?10:1;K(f)}});const K=p=>{A(!0),I==="hsl"?u(b=>{const f={...b};v==="h"?f.h=Math.max(0,Math.min(359,b.h+p)):v==="s"?f.s=Math.max(0,Math.min(100,b.s+p)):v==="l"&&(f.l=Math.max(0,Math.min(100,b.l+p)));const[B,m,w]=re(f.h,f.s,f.l);return _({r:B,g:m,b:w}),f}):_(b=>{const f={...b};v==="r"?f.r=Math.max(0,Math.min(255,b.r+p)):v==="g"?f.g=Math.max(0,Math.min(255,b.g+p)):v==="b"&&(f.b=Math.max(0,Math.min(255,b.b+p)));const B=F(f.r,f.g,f.b);return u(B),f}),A(!1)},F=(p,b,f)=>{const B=p/255,m=b/255,w=f/255,T=Math.max(B,m,w),x=Math.min(B,m,w),E=T-x,ee=(T+x)/2;let te=0;E!==0&&(te=ee>.5?E/(2-T-x):E/(T+x));let ne=0;return E!==0&&(T===B?ne=((m-w)/E+(m<w?6:0))/6:T===m?ne=((w-B)/E+2)/6:ne=((B-m)/E+4)/6),{h:Math.round(ne*360),s:Math.round(te*100),l:Math.round(ee*100)}},re=(p,b,f)=>{p/=360,b/=100,f/=100;const B=(1-Math.abs(2*f-1))*b,m=B*(1-Math.abs(p*6%2-1)),w=f-B/2;let T=0,x=0,E=0;return 0<=p&&p<1/6?(T=B,x=m,E=0):1/6<=p&&p<2/6?(T=m,x=B,E=0):2/6<=p&&p<3/6?(T=0,x=B,E=m):3/6<=p&&p<4/6?(T=0,x=m,E=B):4/6<=p&&p<5/6?(T=m,x=0,E=B):5/6<=p&&p<1&&(T=B,x=0,E=m),[Math.round((T+w)*255),Math.round((x+w)*255),Math.round((E+w)*255)]},Y=()=>{const p=[],b=[[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 f=0;f<40;f++){const m=f/39*(b.length-1),w=Math.floor(m),T=Math.ceil(m),x=m-w,[E,ee,te]=b[w],[ne,D,$]=b[T],k=Math.round(E+(ne-E)*x),H=Math.round(ee+(D-ee)*x),j=Math.round(te+($-te)*x);p.push(o(i,{backgroundColor:`rgb(${k},${H},${j})`,children:" "},f))}return p},Z=()=>{const p=[];for(let b=0;b<40;b++){const f=b/39*100,[B,m,w]=re(h.h,f,h.l);p.push(o(i,{backgroundColor:`rgb(${B},${m},${w})`,children:" "},b))}return p},O=()=>{const p=[];for(let b=0;b<40;b++){const f=b/39*100,[B,m,w]=re(h.h,h.s,f);p.push(o(i,{backgroundColor:`rgb(${B},${m},${w})`,children:" "},b))}return p},C=()=>{const[p,b,f]=re(h.h,h.s,h.l);return`rgb(${p},${b},${f})`},S=(p,b,f)=>{const B=m=>m.toString(16).padStart(2,"0");return`#${B(p)}${B(b)}${B(f)}`},U=()=>{const p=[];for(let b=0;b<40;b++){const f=Math.round(b/39*255);p.push(o(i,{backgroundColor:`rgb(${f},${g.g},${g.b})`,children:" "},b))}return p},V=()=>{const p=[];for(let b=0;b<40;b++){const f=Math.round(b/39*255);p.push(o(i,{backgroundColor:`rgb(${g.r},${f},${g.b})`,children:" "},b))}return p},Q=()=>{const p=[];for(let b=0;b<40;b++){const f=Math.round(b/39*255);p.push(o(i,{backgroundColor:`rgb(${g.r},${g.g},${f})`,children:" "},b))}return p},G=(p,b)=>Math.round(p/b*39);return a(d,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[a(d,{flexDirection:"column",children:[o(i,{bold:!0,children:"Color Picker"}),a(d,{marginBottom:1,flexDirection:"column",children:[o(i,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),o(i,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),o(i,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),o(i,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),o(i,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),o(i,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),I==="hsl"?a(se,{children:[a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="h"?"yellow":"white",children:[v==="h"?"❯ ":" ","Hue (",h.h,"°):"]})}),o(d,{children:Y().map((p,b)=>o(be,{children:b===G(h.h,360)?o(i,{children:"|"}):p},b))})]}),a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="s"?"yellow":"white",children:[v==="s"?"❯ ":" ","Saturation (",h.s,"%):"]})}),o(d,{children:Z().map((p,b)=>o(be,{children:b===G(h.s,100)?o(i,{children:"|"}):p},b))})]}),a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="l"?"yellow":"white",children:[v==="l"?"❯ ":" ","Lightness (",h.l,"%):"]})}),o(d,{children:O().map((p,b)=>o(be,{children:b===G(h.l,100)?o(i,{children:"|"}):p},b))})]})]}):a(se,{children:[a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="r"?"yellow":"white",children:[v==="r"?"❯ ":" ","Red (",g.r,"):"]})}),o(d,{children:U().map((p,b)=>o(be,{children:b===G(g.r,255)?o(i,{children:"|"}):p},b))})]}),a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="g"?"yellow":"white",children:[v==="g"?"❯ ":" ","Green (",g.g,"):"]})}),o(d,{children:V().map((p,b)=>o(be,{children:b===G(g.g,255)?o(i,{children:"|"}):p},b))})]}),a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="b"?"yellow":"white",children:[v==="b"?"❯ ":" ","Blue (",g.b,"):"]})}),o(d,{children:Q().map((p,b)=>o(be,{children:b===G(g.b,255)?o(i,{children:"|"}):p},b))})]})]}),a(d,{marginBottom:1,children:[o(i,{children:"Current: "}),o(i,{backgroundColor:C(),children:" "})]}),a(d,{flexDirection:"row",justifyContent:"space-between",children:[a(d,{flexDirection:"column",children:[o(i,{dimColor:!0,children:"Hex "}),n?.startsWith("diff")?o(i,{backgroundColor:C(),color:s?.colors?.text||"white",bold:!0,children:S(g.r,g.g,g.b)}):n==="inverseText"?o(i,{color:C(),backgroundColor:s?.colors?.permission,bold:!0,children:S(g.r,g.g,g.b)}):o(i,{color:C(),bold:!0,children:S(g.r,g.g,g.b)})]}),a(d,{flexDirection:"column",children:[o(i,{dimColor:!0,children:"RGB "}),n?.startsWith("diff")?o(i,{backgroundColor:C(),color:s?.colors?.text||"white",bold:!0,children:`rgb(${g.r}, ${g.g}, ${g.b})`}):n==="inverseText"?o(i,{color:C(),backgroundColor:s?.colors?.permission,bold:!0,children:`rgb(${g.r}, ${g.g}, ${g.b})`}):o(i,{color:C(),bold:!0,children:`rgb(${g.r}, ${g.g}, ${g.b})`})]}),a(d,{flexDirection:"column",children:[o(i,{dimColor:!0,children:"HSL "}),n?.startsWith("diff")?o(i,{backgroundColor:C(),color:s?.colors?.text||"white",bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`}):n==="inverseText"?o(i,{color:C(),backgroundColor:s?.colors?.permission,bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`}):o(i,{color:C(),bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`})]})]})]})}function Ae(e){const t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const n=r[1];return{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16)}}return null}function ke(e){const t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};const r=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const s=parseInt(r[1])/255,l=parseInt(r[2])/255,c=parseInt(r[3])/255,h=Math.max(s,l,c),u=Math.min(s,l,c),g=h-u,_=(h+u)/2;let I=0;g!==0&&(I=_>.5?g/(2-h-u):g/(h+u));let y=0;return g!==0&&(h===s?y=((l-c)/g+(l<c?6:0))/6:h===l?y=((c-s)/g+2)/6:y=((s-l)/g+4)/6),{h:Math.round(y*360),s:Math.round(I*100),l:Math.round(_*100)}}const n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){const s=n[1],l=parseInt(s.substr(0,2),16)/255,c=parseInt(s.substr(2,2),16)/255,h=parseInt(s.substr(4,2),16)/255,u=Math.max(l,c,h),g=Math.min(l,c,h),_=u-g,I=(u+g)/2;let y=0;_!==0&&(y=I>.5?_/(2-u-g):_/(u+g));let v=0;return _!==0&&(u===l?v=((c-h)/_+(c<h?6:0))/6:u===c?v=((h-l)/_+2)/6:v=((l-c)/_+4)/6),{h:Math.round(v*360),s:Math.round(y*100),l:Math.round(I*100)}}return{h:0,s:50,l:50}}function fn({onBack:e,themeId:t}){const{settings:{themes:r},updateSettings:n}=ge(ce),[s,l]=M(t),c=r.find(O=>O.id===s)||r[0],[h,u]=M("rgb"),[g,_]=M(0),[I,y]=M(null),[v,N]=M(null),[L,A]=M(""),[P,W]=M(""),X=Je(O=>{n(C=>{const S=C.themes.findIndex(U=>U.id===s);S!==-1&&O(C.themes[S])})},[s,n]),K=O=>{if(g>=2&&Fe(O)){const C=rr(O),S=g-2,U=F[S];X(V=>{V.colors[U]=C})}};ae((O,C)=>{if(I===null&&v===null){if(O.length>1&&!C.ctrl&&!C.meta){K(O);return}if(C.escape)e();else if(C.ctrl&&O==="a")u(S=>S==="rgb"?"hex":S==="hex"?"hsl":"rgb");else if(C.upArrow)_(S=>Math.max(0,S-1));else if(C.downArrow)_(S=>Math.min(F.length+1,S+1));else if(C.return)if(g===0)N("name"),A(c.name),W(c.name);else if(g===1)N("id"),A(c.id),W(c.id);else{const S=g-2,U=F[S],V=c.colors[U];y(S),A(V),W(V)}}else if(I!==null)C.ctrl&&O==="a"&&u(S=>S==="rgb"?"hex":S==="hex"?"hsl":"rgb");else if(v!==null)if(C.return){if(v==="id"){const S=s;l(L),n(U=>{const V=U.themes.findIndex(Q=>Q.id===S);V!==-1&&(U.themes[V].id=L)})}else X(S=>{S.name=L});N(null),A(""),W("")}else C.escape?(N(null),A(""),W("")):C.backspace||C.delete?A(S=>S.slice(0,-1)):O&&A(S=>S+O)});const F=Object.keys(c.colors),re=(O,C)=>{const S=O.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!S)return O;const U=parseInt(S[1]),V=parseInt(S[2]),Q=parseInt(S[3]);switch(C){case"hex":{const G=p=>p.toString(16).padStart(2,"0");return`#${G(U)}${G(V)}${G(Q)}`}case"hsl":{const G=U/255,p=V/255,b=Q/255,f=Math.max(G,p,b),B=Math.min(G,p,b),m=f-B,w=(f+B)/2;let T=0;m!==0&&(T=w>.5?m/(2-f-B):m/(f+B));let x=0;return m!==0&&(f===G?x=((p-b)/m+(p<b?6:0))/6:f===p?x=((b-G)/m+2)/6:x=((G-p)/m+4)/6),`hsl(${Math.round(x*360)}, ${Math.round(T*100)}%, ${Math.round(w*100)}%)`}case"rgb":default:return O}},Y=O=>({autoAccept:"Auto-accept mode indicator",bashBorder:"Bash command border",claude:"Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.",claudeShimmer:"Color used for the shimmering effect on the thinking verb.",claudeBlue_FOR_SYSTEM_SPINNER:"System spinner color (blue variant)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"System spinner shimmer color (blue variant)",permission:"Permission prompt color",permissionShimmer:"Permission prompt shimmer color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",promptBorder:"Input prompt border color",promptBorderShimmer:"Input prompt border shimmer color",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",inactive:"Inactive/dimmed text. Used for line numbers and less prominent text.",subtle:"Subtle text. Used for help text and secondary information.",suggestion:"Suggestion text color. Used for suggestions for theme names and various other things.",remember:"Remember/note color. Used for various text relating to memories.",background:"Background color for certain UI elements",success:"Success indicator. Used for the bullet on successful tool calls, and various success messages (such as sign in successful).",error:"Error indicator",warning:"Warning indicator",warningShimmer:"Warning shimmer color",diffAdded:"Added diff background",diffRemoved:"Removed diff background",diffAddedDimmed:"Added diff background (dimmed)",diffRemovedDimmed:"Removed diff background (dimmed)",diffAddedWord:"Added word highlight",diffRemovedWord:"Removed word highlight",diffAddedWordDimmed:"Added word highlight (dimmed)",diffRemovedWordDimmed:"Removed word highlight (dimmed)",red_FOR_SUBAGENTS_ONLY:"Red color for sub agents",blue_FOR_SUBAGENTS_ONLY:"Blue color for sub agents",green_FOR_SUBAGENTS_ONLY:"Green color for sub agents",yellow_FOR_SUBAGENTS_ONLY:"Yellow color for sub agents",purple_FOR_SUBAGENTS_ONLY:"Purple color for sub agents",orange_FOR_SUBAGENTS_ONLY:"Orange color for sub agents",pink_FOR_SUBAGENTS_ONLY:"Pink color for sub agents",cyan_FOR_SUBAGENTS_ONLY:"Cyan color for sub agents",professionalBlue:"Professional blue color for business contexts?",rainbow_red:'"ultrathink" rainbow - red',rainbow_orange:'"ultrathink" rainbow - orange',rainbow_yellow:'"ultrathink" rainbow - yellow',rainbow_green:'"ultrathink" rainbow - green',rainbow_blue:'"ultrathink" rainbow - blue',rainbow_indigo:'"ultrathink" rainbow - indigo',rainbow_violet:'"ultrathink" rainbow - violet',rainbow_red_shimmer:'"ultrathink" rainbow (shimmer) - red',rainbow_orange_shimmer:'"ultrathink" rainbow (shimmer) - orange',rainbow_yellow_shimmer:'"ultrathink" rainbow (shimmer) - yellow',rainbow_green_shimmer:'"ultrathink" rainbow (shimmer) - green',rainbow_blue_shimmer:'"ultrathink" rainbow (shimmer) - blue',rainbow_indigo_shimmer:'"ultrathink" rainbow (shimmer) - indigo',rainbow_violet_shimmer:'"ultrathink" rainbow (shimmer) - violet',clawd_body:'"Clawd" character body color',clawd_background:'"Clawd" character background color',userMessageBackground:"Background color for user messages",bashMessageBackgroundColor:"Background color for bash command output",memoryBackgroundColor:"Background color for memory/context information",rate_limit_fill:"Rate limit indicator fill color",rate_limit_empty:"Rate limit indicator empty/background color"})[O]||"",Z=Math.max(...F.map(O=>O.length));return a(d,{children:[a(d,{flexDirection:"column",width:"50%",children:[o(d,{children:a(de,{children:["Editing theme “",c.name,"” (",c.id,")"]})}),I===null&&v===null?a(se,{children:[a(d,{marginBottom:1,flexDirection:"column",children:[o(i,{dimColor:!0,children:"enter to edit theme name, id, or color"}),o(i,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),o(i,{dimColor:!0,children:"paste color from clipboard (when on color)"}),o(i,{dimColor:!0,children:"esc to go back"})]}),g<2?a(d,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[o(i,{bold:!0,children:g===0?"Theme Name":"Theme ID"}),o(i,{children:g===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):a(d,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:c.colors[F[g-2]],flexDirection:"column",paddingLeft:1,children:[o(Oe,{colorKey:F[g-2],theme:c,bold:!0}),o(i,{children:Y(F[g-2])})]}),a(d,{flexDirection:"column",children:[a(d,{children:[o(i,{color:g===0?"yellow":"white",children:g===0?"❯ ":" "}),o(i,{bold:!0,children:"Name: "}),o(i,{children:c.name})]}),a(d,{marginBottom:1,children:[o(i,{color:g===1?"yellow":"white",children:g===1?"❯ ":" "}),o(i,{bold:!0,children:"ID: "}),o(i,{children:c.id})]}),(()=>{if(g<2){const G=F.slice(0,20);return a(se,{children:[G.map((p,b)=>{const f=b+2;return a(d,{children:[o(i,{color:g===f?"yellow":"white",children:g===f?"❯ ":" "}),o(d,{width:Z+2,children:o(i,{children:o(Oe,{colorKey:p,theme:c,bold:!0})})}),o(R,{color:c.colors[p],children:re(c.colors[p],h)})]},p)}),F.length>20&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",F.length-20," more below"]})]})}const C=g-2,S=Math.max(0,C-Math.floor(20/2)),U=Math.min(F.length,S+20),V=Math.max(0,U-20),Q=F.slice(V,U);return a(se,{children:[V>0&&a(i,{color:"gray",dimColor:!0,children:[" ","↑ ",V," more above"]}),Q.map((G,p)=>{const f=V+p+2;return a(d,{children:[o(i,{color:g===f?"yellow":"white",children:g===f?"❯ ":" "}),o(d,{width:Z+2,children:o(i,{children:o(Oe,{colorKey:G,theme:c,bold:!0})})}),o(R,{color:c.colors[G],children:re(c.colors[G],h)})]},G)}),U<F.length&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",F.length-U," more below"]})]})})()]})]}):v?a(d,{flexDirection:"column",marginTop:1,children:[a(i,{children:["Editing ",v==="name"?"theme name":"theme ID",":"]}),o(d,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:o(i,{children:L})}),o(i,{dimColor:!0,children:"enter to save, esc to cancel"})]}):o(or,{initialValue:P,colorKey:F[I],theme:c,onColorChange:O=>{A(O),X(C=>{C.colors[F[I]]=O})},onExit:()=>{X(O=>{O.colors[F[I]]=L}),y(null),A(""),W("")}})]}),o(d,{width:"50%",children:o(tr,{theme:c})})]})}function bn(e){return e.map(t=>`${t.name} (${t.id})`)}function pn({onBack:e}){const{settings:{themes:t},updateSettings:r}=ge(ce),[n,s]=M(0),[l,c]=M(null),[h,u]=M(!0),g=()=>{const L={colors:{...(t[0]||J.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};r(A=>{A.themes.push(L)}),c(L.id),u(!1)},_=N=>{t.length<=1||(r(L=>{L.themes=L.themes.filter(A=>A.id!==N)}),n>=t.length-1&&s(Math.max(0,t.length-2)))},I=()=>{r(N=>{N.themes=[...J.themes]}),s(0)};if(ae((N,L)=>{if(L.escape)e();else if(L.upArrow)s(A=>Math.max(0,A-1));else if(L.downArrow)s(A=>Math.min(t.length-1,A+1));else if(L.return){const A=t[n];A&&(c(A.id),u(!1))}else if(N==="n")g();else if(N==="d"){const A=t[n];A&&_(A.id)}else L.ctrl&&N==="r"&&I()},{isActive:h}),l)return o(fn,{themeId:l,onBack:()=>{c(null),u(!0)}});const y=bn(t),v=t.find(N=>y[n]?.includes(`(${N.id})`))||t[0];return t.length===0?o(d,{children:a(d,{flexDirection:"column",width:"100%",children:[o(de,{children:"Themes"}),a(d,{marginBottom:1,flexDirection:"column",children:[o(i,{dimColor:!0,children:"n to create a new theme"}),o(i,{dimColor:!0,children:"esc to go back"})]}),o(i,{children:"No themes available!"})]})}):a(d,{children:[a(d,{flexDirection:"column",width:"50%",children:[o(de,{children:"Themes"}),a(d,{marginBottom:1,flexDirection:"column",children:[o(i,{dimColor:!0,children:"n to create a new theme"}),o(i,{dimColor:!0,children:"d to delete a theme"}),o(i,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),o(i,{dimColor:!0,children:"enter to edit theme"}),o(i,{dimColor:!0,children:"esc to go back"})]}),o(d,{flexDirection:"column",children:y.map((N,L)=>a(i,{color:n===L?"yellow":void 0,children:[n===L?"❯ ":" ",N]},L))})]}),o(d,{width:"50%",children:o(tr,{theme:v})})]})}let Ee=["ANSI Shadow"];function wn({onBack:e}){const{stdout:t}=sr(),r=t?.columns||120,{settings:{launchText:{method:n,figletText:s,figletFont:l,customText:c},themes:h},updateSettings:u}=ge(ce),g=n==="figlet"?["method","text","font"]:["method","text"],[_,I]=M(0),y=g[_],[v,N]=M(n==="figlet"?0:1),[L,A]=M(Ee),[P,W]=M(Ee),[X,K]=M(""),[F,re]=M(!1),[Y,Z]=M(0),[O,C]=M(""),[S,U]=M(50),[V,Q]=M(!1),[G,p]=M(n==="figlet"?s:c),b=Me(),B=(h.find(w=>w.id===b)||h.find(w=>w.id==="dark"))?.colors.claude||"rgb(215,119,87)";ie(()=>{De.fonts((w,T)=>{if(!w&&T){const x=T.sort();A(x),W(x),Ee=x;const E=x.indexOf(l);Z(E>=0?E:x.indexOf("ANSI Shadow")||0)}})},[]),ie(()=>{m()},[n,s,l,c,G,V]);const m=()=>{if(n==="figlet")try{const w=V?G:s,T=De.textSync(w.replace(`
20
+ `," "),{font:l}),x=Math.floor(r*.7),ee=T.split(`
21
+ `).map($=>$.length>x?$.substring(0,x-3)+"":$),te=ee.join(`
22
+ `);C(te);const ne=Math.max(...ee.map($=>$.length)),D=Math.min(75,Math.max(50,Math.ceil(ne/r*100)));U(D+5)}catch{C("Error generating figlet text"),U(50)}else{const w=Math.floor(r*.6),E=(V?G:c).split(`
23
+ `).map(D=>D.length>w?D.substring(0,w-3)+"...":D),ee=E.join(`
24
+ `);C(ee);const te=Math.max(...E.map(D=>D.length)),ne=Math.min(75,Math.max(50,Math.ceil(te/r*100)));U(ne+5)}};return ie(()=>{if(X){const w=L.filter(T=>T.toLowerCase().includes(X.toLowerCase()));W(w),Z(0)}else{W(L);const w=L.indexOf(l);Z(w>=0?w:0)}},[X,L]),ie(()=>{if(!F){const w=P.indexOf(l);w>=0&&Z(w)}},[l,P,F]),ae((w,T)=>{if(V){T.return?(u(n==="figlet"?x=>{x.launchText.figletText=G}:x=>{x.launchText.customText=G}),Q(!1)):T.escape?(p(n==="figlet"?s:c),Q(!1)):T.backspace||T.delete?p(x=>x.slice(0,-1)):w&&p(x=>x+w);return}if(F){if(T.return)P.length>0&&u(x=>{x.launchText.figletFont=P[Y]}),re(!1),K("");else if(T.escape)re(!1),K("");else if(T.backspace||T.delete)K(x=>x.slice(0,-1));else if(T.upArrow){const x=Y>0?Y-1:P.length-1;Z(x),P.length>0&&u(E=>{E.launchText.figletFont=P[x]})}else if(T.downArrow){const x=Y<P.length-1?Y+1:0;Z(x),P.length>0&&u(E=>{E.launchText.figletFont=P[x]})}else w&&w.match(/^[a-zA-Z0-9\s\-_]$/)&&K(x=>x+w);return}if(T.escape)e();else if(T.return)y==="text"&&(p(n==="figlet"?s:c),Q(!0));else if(T.tab)T.shift?I(x=>x===0?g.length-1:x-1):I(x=>x===g.length-1?0:x+1);else if(T.upArrow){if(y==="method"){const x=v>0?v-1:1;N(x),u(E=>{E.launchText.method=x===0?"figlet":"custom"})}else if(y==="font"&&n==="figlet"){const x=Y>0?Y-1:P.length-1;Z(x),u(E=>{E.launchText.figletFont=P[x]})}}else if(T.downArrow){if(y==="method"){const x=v<1?v+1:0;N(x),u(E=>{E.launchText.method=x===0?"figlet":"custom"})}else if(y==="font"&&n==="figlet"){const x=Y<P.length-1?Y+1:0;Z(x),u(E=>{E.launchText.figletFont=P[x]})}}else w&&y==="font"&&n==="figlet"&&w.match(/^[a-zA-Z0-9]$/)&&(re(!0),K(w))}),a(d,{children:[a(d,{flexDirection:"column",width:`${100-S}%`,children:[a(d,{marginBottom:1,flexDirection:"column",children:[o(de,{children:"Setup banner"}),a(d,{flexDirection:"column",children:[a(i,{dimColor:!0,children:["enter to ",y==="text"?"edit text":"save"]}),o(i,{dimColor:!0,children:"esc to go back"}),o(i,{dimColor:!0,children:"tab to switch sections"})]})]}),o(d,{children:a(i,{children:[o(i,{color:y==="method"?"yellow":void 0,children:y==="method"?"❯ ":" "}),o(i,{bold:!0,color:y==="method"?"yellow":void 0,children:"Method"})]})}),y==="method"&&a(i,{dimColor:!0,children:[" ","select one of ",P.length," Figlet fonts or enter your own text"]}),o(d,{marginLeft:2,marginBottom:1,children:a(d,{flexDirection:"column",children:[a(i,{color:v===0?"cyan":"white",children:[v===0?"❯ ":" ","Figlet"]}),a(i,{color:v===1?"cyan":"white",children:[v===1?"❯ ":" ","Custom"]})]})}),a(d,{flexDirection:"column",children:[a(i,{children:[o(i,{color:y==="text"?"yellow":void 0,children:y==="text"?"❯ ":" "}),o(i,{bold:!0,color:y==="text"?"yellow":void 0,children:"Text"})]}),y==="text"&&(V?a(i,{dimColor:!0,children:[" ","esc to save"]}):a(i,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(d,{marginLeft:2,marginBottom:1,children:o(d,{borderStyle:"round",borderColor:V?"yellow":"gray",children:o(i,{children:V?G:n==="figlet"?s:c})})}),n==="figlet"&&a(se,{children:[o(d,{children:a(d,{flexDirection:"column",children:[a(i,{children:[o(i,{color:y==="font"?"yellow":void 0,children:y==="font"?"❯ ":" "}),o(i,{bold:!0,color:y==="font"?"yellow":void 0,children:"Font"})]}),y==="font"&&a(i,{dimColor:!0,children:[" ","type to filter"]}),o(i,{children:F&&a(i,{color:"gray",dimColor:!0,children:[" ","(filtering: “",X,"”)"]})})]})}),o(d,{marginLeft:2,marginBottom:1,children:o(d,{flexDirection:"column",children:(()=>{const T=Math.max(0,Y-Math.floor(4)),x=Math.min(P.length,T+8),E=Math.max(0,x-8),ee=P.slice(E,x);return a(se,{children:[E>0&&a(i,{color:"gray",dimColor:!0,children:[" ","↑ ",E," more above"]}),ee.map((te,ne)=>{const D=E+ne;return a(i,{color:Y===D?"cyan":void 0,children:[Y===D?"❯ ":" ",te]},te)}),x<P.length&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",P.length-x," more below"]})]})})()})})]})]}),a(d,{width:`${S}%`,flexDirection:"column",children:[o(d,{marginBottom:1,children:o(i,{bold:!0,children:"Preview"})}),a(d,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:[a(d,{flexDirection:"column",marginBottom:1,children:[o(i,{color:B,children:"╭──────────────────────────╮"}),a(i,{children:[o(i,{color:B,children:"│ ✻"})," Welcome to Claude Code"," ",o(i,{color:B,children:"│"})]}),o(i,{color:B,children:"╰──────────────────────────╯"})]}),O.split(`
25
+ `).map((w,T)=>o(i,{color:B,children:w},T)),o(d,{marginTop:1,children:o(i,{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 xn({onBack:e}){const{settings:{thinkingVerbs:{format:t,verbs:r},themes:n},updateSettings:s}=ge(ce),l=["format","verbs"],[c,h]=M(0),u=l[c],[g,_]=M(0),[I,y]=M(!1),[v,N]=M(""),[L,A]=M(!1),[P,W]=M(!1),[X,K]=M(t),F=Me(),Y=(n.find(O=>O.id===F)||n.find(O=>O.id==="dark"))?.colors.claude||"rgb(215,119,87)";ae((O,C)=>{if(P){C.return?(s(S=>{S.thinkingVerbs.format=X}),W(!1)):C.escape?(K(t),W(!1)):C.backspace||C.delete?K(S=>S.slice(0,-1)):O&&K(S=>S+O);return}if(I||L){C.return&&v.trim()?(L?(s(S=>{S.thinkingVerbs.verbs.push(v.trim())}),A(!1)):(s(S=>{S.thinkingVerbs.verbs[g]=v.trim()}),y(!1)),N("")):C.escape?(N(""),y(!1),A(!1)):C.backspace||C.delete?N(S=>S.slice(0,-1)):O&&N(S=>S+O);return}C.escape?e():C.return?u==="format"&&(K(t),W(!0)):C.tab?C.shift?h(S=>S===0?l.length-1:S-1):h(S=>S===l.length-1?0:S+1):C.upArrow?u==="verbs"&&r.length>0&&_(S=>S>0?S-1:r.length-1):C.downArrow?u==="verbs"&&r.length>0&&_(S=>S<r.length-1?S+1:0):O==="e"&&u==="verbs"?r.length>0&&(N(r[g]),y(!0)):O==="d"&&u==="verbs"?r.length>1&&(s(S=>{S.thinkingVerbs.verbs=S.thinkingVerbs.verbs.filter((U,V)=>V!==g)}),g>=r.length-1&&_(Math.max(0,r.length-2))):O==="n"&&u==="verbs"?(A(!0),N("")):C.ctrl&&O==="r"&&u==="verbs"&&(s(S=>{S.thinkingVerbs.verbs=[...J.thinkingVerbs.verbs]}),_(0))});const Z=50;return a(d,{children:[a(d,{flexDirection:"column",width:`${100-Z}%`,children:[a(d,{marginBottom:1,flexDirection:"column",children:[o(de,{children:"Thinking Verbs"}),a(d,{flexDirection:"column",children:[o(i,{dimColor:!0,children:u==="format"?"enter to edit format":"changes auto-saved"}),o(i,{dimColor:!0,children:"esc to go back"}),o(i,{dimColor:!0,children:"tab to switch sections"})]})]}),o(d,{marginBottom:1,children:o(i,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),a(d,{flexDirection:"column",children:[a(i,{children:[o(i,{color:u==="format"?"yellow":void 0,children:u==="format"?"❯ ":" "}),o(i,{bold:!0,color:u==="format"?"yellow":void 0,children:"Format"})]}),u==="format"&&(P?a(i,{dimColor:!0,children:[" ","enter to save"]}):a(i,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(d,{marginLeft:2,marginBottom:1,children:o(d,{borderStyle:"round",borderColor:P?"yellow":"gray",children:o(i,{children:P?X:t})})}),o(d,{children:a(i,{children:[o(i,{color:u==="verbs"?"yellow":void 0,children:u==="verbs"?"❯ ":" "}),o(i,{bold:!0,color:u==="verbs"?"yellow":void 0,children:"Verbs"})]})}),u==="verbs"&&o(d,{flexDirection:"column",children:a(i,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),o(d,{marginLeft:2,marginBottom:1,children:a(d,{flexDirection:"column",children:[(()=>{const C=Math.max(0,g-Math.floor(4)),S=Math.min(r.length,C+8),U=Math.max(0,S-8),V=r.slice(U,S);return a(se,{children:[U>0&&a(i,{color:"gray",dimColor:!0,children:[" ","↑ ",U," more above"]}),V.map((Q,G)=>{const p=U+G;return a(i,{color:u==="verbs"&&p===g?"cyan":void 0,children:[u==="verbs"&&p===g?"❯ ":" ",Q]},p)}),S<r.length&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",r.length-S," more below"]})]})})(),L&&a(d,{alignItems:"center",children:[o(i,{color:"yellow",children:"❯ "}),o(d,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:v})})]}),I&&a(d,{marginTop:1,alignItems:"center",children:[o(i,{children:"Editing: "}),o(d,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:v})})]})]})})]}),a(d,{width:`${Z}%`,flexDirection:"column",children:[o(d,{marginBottom:1,children:o(i,{bold:!0,children:"Preview"})}),o(d,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:a(i,{children:[a(i,{color:Y,children:["✻ ",t.replace(/\{\}/g,r[g])," "]}),o(i,{children:"(esc to interrupt)"})]})})]})]})}const ue=[{name:"Default",phases:J.thinkingStyle.phases,reverseMirror:J.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 _n({onBack:e}){const{settings:{thinkingStyle:{phases:t,updateInterval:r,reverseMirror:n},themes:s},updateSettings:l}=ge(ce),c=["reverseMirror","updateInterval","phases","presets"],[h,u]=M(0),g=c[h],[_,I]=M(0),[y,v]=M(0),[N,L]=M(!1),[A,P]=M(""),[W,X]=M(!1),[K,F]=M(!1),[re,Y]=M(r.toString()),[Z,O]=M(0),C=Me(),U=(s.find(f=>f.id===C)||s.find(f=>f.id==="dark"))?.colors.claude||"rgb(215,119,87)";ie(()=>{if(t.length>0){const f=n?[...t,...[...t].reverse().slice(1,-1)]:t,B=setInterval(()=>{O(m=>(m+1)%f.length)},r);return()=>clearInterval(B)}},[t,r,n]),ae((f,B)=>{if(K){if(B.return){const m=parseInt(re);!isNaN(m)&&m>0&&l(w=>{w.thinkingStyle.updateInterval=m}),F(!1)}else B.escape?(Y(r.toString()),F(!1)):B.backspace||B.delete?Y(m=>m.slice(0,-1)):f&&f.match(/^[0-9]$/)&&Y(m=>m+f);return}if(N||W){if(B.return&&A.length){const m=W?[...t,A]:t.map((w,T)=>T===_?A:w);l(w=>{w.thinkingStyle.phases=m}),L(!1),P("")}else B.escape?(P(""),L(!1),X(!1)):B.backspace||B.delete?P(m=>m.slice(0,-1)):f&&P(m=>m+f);return}if(B.escape)e();else if(B.return)if(g==="updateInterval")Y(r.toString()),F(!0);else if(g==="presets"){const m=ue[y];l(w=>{w.thinkingStyle.phases=[...m.phases],w.thinkingStyle.reverseMirror=m.reverseMirror})}else g==="reverseMirror"&&l(m=>{m.thinkingStyle.reverseMirror=!m.thinkingStyle.reverseMirror});else if(B.tab)B.shift?u(m=>m===0?c.length-1:m-1):u(m=>m===c.length-1?0:m+1);else if(B.upArrow)g==="phases"&&t.length>0?I(m=>m>0?m-1:t.length-1):g==="presets"&&v(m=>m>0?m-1:ue.length-1);else if(B.downArrow)g==="phases"&&t.length>0?I(m=>m<t.length-1?m+1:0):g==="presets"&&v(m=>m<ue.length-1?m+1:0);else if(f===" ")g==="reverseMirror"&&l(m=>{m.thinkingStyle.reverseMirror=!m.thinkingStyle.reverseMirror});else if(f==="e"&&g==="phases")t.length>0&&(P(t[_]),L(!0));else if(f==="a"&&g==="phases")X(!0),P("");else if(f==="d"&&g==="phases")t.length>1&&(l(m=>{m.thinkingStyle.phases=t.filter((w,T)=>T!==_)}),_>=t.length&&I(Math.max(0,t.length-1)));else if(f==="w"&&g==="phases"){if(_>0){const m=[...t];[m[_-1],m[_]]=[m[_],m[_-1]],l(w=>{w.thinkingStyle.phases=m}),I(w=>w-1)}}else if(f==="s"&&g==="phases"){if(_<t.length-1){const m=[...t];[m[_],m[_+1]]=[m[_+1],m[_]],l(w=>{w.thinkingStyle.phases=m}),I(w=>w+1)}}else B.ctrl&&f==="r"&&(l(m=>{m.thinkingStyle=J.thinkingStyle}),I(0),v(0))});const V=n?"●":"○",Q=50,p=n?[...t,...[...t].reverse().slice(1,-1)]:t,b=p.length>0?p[Z]:"·";return o(d,{children:a(d,{flexDirection:"column",width:"100%",children:[a(d,{flexDirection:"row",width:"100%",children:[a(d,{marginBottom:1,flexDirection:"column",width:`${100-Q}%`,children:[o(de,{children:"Thinking style"}),a(d,{flexDirection:"column",children:[a(i,{dimColor:!0,children:["enter to"," ",g==="updateInterval"?"edit interval":g==="presets"?"apply preset":"save"]}),o(i,{dimColor:!0,children:"esc to go back"}),o(i,{dimColor:!0,children:"tab to switch sections"})]})]}),a(d,{width:`${Q}%`,flexDirection:"column",children:[o(d,{children:o(i,{bold:!0,children:"Preview"})}),a(d,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[o(d,{width:(b?.length??0)+1,children:o(i,{color:U,children:b})}),a(i,{children:[o(i,{color:U,children:"Thinking… "}),o(i,{children:"(esc to interrupt)"})]})]})]})]}),a(d,{flexDirection:"row",gap:4,children:[a(d,{flexDirection:"column",children:[a(i,{children:[o(i,{color:g==="reverseMirror"?"yellow":void 0,children:g==="reverseMirror"?"❯ ":" "}),o(i,{bold:!0,color:g==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),g==="reverseMirror"&&a(i,{dimColor:!0,children:[" ","space to toggle"]}),o(d,{marginLeft:2,marginBottom:1,children:a(i,{children:[V," ",n?"Enabled":"Disabled"]})})]}),a(d,{flexDirection:"column",children:[a(i,{children:[o(i,{color:g==="updateInterval"?"yellow":void 0,children:g==="updateInterval"?"❯ ":" "}),o(i,{bold:!0,color:g==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),g==="updateInterval"&&(K?a(i,{dimColor:!0,children:[" ","enter to save"]}):a(i,{dimColor:!0,children:[" ","enter to edit"]})),o(d,{marginLeft:2,marginBottom:1,children:o(d,{borderStyle:"round",borderColor:K?"yellow":"gray",children:o(i,{children:K?re:r})})})]})]}),o(d,{children:a(i,{children:[o(i,{color:g==="phases"?"yellow":void 0,children:g==="phases"?"❯ ":" "}),o(i,{bold:!0,color:g==="phases"?"yellow":void 0,children:"Phases"})]})}),g==="phases"&&o(d,{marginBottom:1,flexDirection:"column",children:a(i,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),o(d,{marginLeft:2,marginBottom:1,children:a(d,{flexDirection:"column",children:[(()=>{const B=Math.max(0,_-Math.floor(4)),m=Math.min(t.length,B+8),w=Math.max(0,m-8),T=t.slice(w,m);return a(se,{children:[w>0&&a(i,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),T.map((x,E)=>{const ee=w+E;return a(i,{color:g==="phases"&&ee===_?"cyan":void 0,children:[g==="phases"&&ee===_?"❯ ":" ",x]},ee)}),m<t.length&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-m," more below"]})]})})(),W&&a(d,{children:[o(i,{color:"yellow",children:"❯ "}),o(d,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:A})})]}),N&&a(d,{marginTop:1,children:[o(i,{children:"Editing: "}),o(d,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:A})})]})]})}),o(d,{children:a(i,{children:[o(i,{color:g==="presets"?"yellow":void 0,children:g==="presets"?"❯ ":" "}),o(i,{bold:!0,color:g==="presets"?"yellow":void 0,children:"Presets"})]})}),g==="presets"&&a(i,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),o(d,{marginLeft:2,marginBottom:1,children:o(d,{flexDirection:"column",children:(()=>{const B=Math.max(0,y-Math.floor(4)),m=Math.min(ue.length,B+8),w=Math.max(0,m-8),T=ue.slice(w,m);return a(se,{children:[w>0&&a(i,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),T.map((x,E)=>{const ee=w+E;return a(i,{color:g==="presets"&&ee===y?"cyan":void 0,children:[g==="presets"&&ee===y?"❯ ":" ",x.name," ",x.phases.join("")]},ee)}),m<ue.length&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",ue.length-m," more below"]})]})})()})}),o(d,{marginTop:1,children:o(i,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const _e=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function Sn({onBack:e}){const{settings:t,updateSettings:r}=ge(ce),[n,s]=M("prefix"),[l,c]=M(0),[h,u]=M(!1),[g,_]=M(()=>t.userMessageDisplay.prefix.format),[I,y]=M(0),[v,N]=M(()=>[...t.userMessageDisplay.prefix.styling]),[L,A]=M(()=>t.userMessageDisplay.prefix.foreground_color),[P,W]=M(()=>t.userMessageDisplay.prefix.background_color),[X,K]=M(0),[F,re]=M(0),[Y,Z]=M(()=>[...t.userMessageDisplay.message.styling]),[O,C]=M(()=>t.userMessageDisplay.message.foreground_color),[S,U]=M(()=>t.userMessageDisplay.message.background_color),[V,Q]=M(null),[G,p]=M(""),b=Me(),f=t.themes?.find(D=>D.id===b)||t.themes?.[0],B=["format","styling","foreground","background"],m=["styling","foreground","background"],w=B[l],T=m[X],x=(D,$)=>{r(k=>{const H=D==="prefix"?k.userMessageDisplay.prefix:k.userMessageDisplay.message;$(H)})},E=D=>{r($=>{D==="prefix"?$.userMessageDisplay.prefix={...J.userMessageDisplay.prefix}:$.userMessageDisplay.message={...J.userMessageDisplay.message}}),D==="prefix"?(_(J.userMessageDisplay.prefix.format),N([...J.userMessageDisplay.prefix.styling]),A(J.userMessageDisplay.prefix.foreground_color),W(J.userMessageDisplay.prefix.background_color)):(Z([...J.userMessageDisplay.message.styling]),C(J.userMessageDisplay.message.foreground_color),U(J.userMessageDisplay.message.background_color))};ie(()=>{const D=t.userMessageDisplay.prefix;_(D.format),N([...D.styling]),A(D.foreground_color),W(D.background_color);const $=t.userMessageDisplay.message;Z([...$.styling]),C($.foreground_color),U($.background_color)},[]),ae((D,$)=>{if(h){if($.return)x("prefix",k=>{k.format=g}),u(!1);else if($.escape){const k=t.userMessageDisplay.prefix;_(k.format),u(!1)}else $.backspace||$.delete?_(k=>k.slice(0,-1)):D&&_(k=>k+D);return}if(V===null){if($.escape)e();else if($.ctrl&&D==="r")E(n);else if($.leftArrow||$.rightArrow)s(k=>k==="prefix"?"message":"prefix");else if($.tab)n==="prefix"?$.shift?c(k=>k===0?B.length-1:k-1):c(k=>k===B.length-1?0:k+1):$.shift?K(k=>k===0?m.length-1:k-1):K(k=>k===m.length-1?0:k+1);else if($.return)n==="prefix"?w==="format"?u(!0):w==="foreground"?(p(L),Q({column:"prefix",type:"foreground"})):w==="background"&&(p(P),Q({column:"prefix",type:"background"})):T==="foreground"?(p(O),Q({column:"message",type:"foreground"})):T==="background"&&(p(S),Q({column:"message",type:"background"}));else if($.upArrow)n==="prefix"&&w==="styling"?y(k=>Math.max(0,k-1)):n==="message"&&T==="styling"&&re(k=>Math.max(0,k-1));else if($.downArrow)n==="prefix"&&w==="styling"?y(k=>Math.min(_e.length-1,k+1)):n==="message"&&T==="styling"&&re(k=>Math.min(_e.length-1,k+1));else if(D===" "){if(n==="prefix"&&w==="styling"){const k=_e[I].value,H=v.indexOf(k)>=0?v.filter(j=>j!==k):[...v,k];N(H),x("prefix",j=>{j.styling=[...H]})}else if(n==="message"&&T==="styling"){const k=_e[F].value,H=Y.indexOf(k)>=0?Y.filter(j=>j!==k):[...Y,k];Z(H),x("message",j=>{j.styling=[...H]})}}}});const ee=(D,$,k=!0)=>{const H=k?$==="prefix"?v:Y:[],j=k?$==="prefix"?L:O:"rgb(255,255,255)",we=k?$==="prefix"?P:S:"rgb(0,0,0)",xe=j==="rgb(0,0,0)"&&we==="rgb(0,0,0)",ye=H.length>0;return xe&&!ye?o(i,{children:D}):o(i,{bold:H.includes("bold"),italic:H.includes("italic"),underline:H.includes("underline"),strikethrough:H.includes("strikethrough"),inverse:H.includes("inverse"),color:xe?void 0:j,backgroundColor:xe?void 0:we,children:D})},te=(D=!0)=>a(i,{children:[g&&a(se,{children:[ee(g,"prefix",D)," "]}),ee("list the dir","message",D)]}),ne=D=>{const $=n===D,j=(D==="prefix"?B:m)[D==="prefix"?l:X],we=D==="prefix"?I:F,xe=D==="prefix"?v:Y,ye=D==="prefix"?L:O,Ue=D==="prefix"?P:S;return a(d,{flexDirection:"column",width:"45%",borderStyle:$?"round":"single",borderColor:$?"yellow":"gray",padding:1,children:[o(d,{marginBottom:1,children:a(i,{bold:!0,color:$?"yellow":void 0,children:[D.charAt(0).toUpperCase()+D.slice(1)," ","Configuration"]})}),D==="prefix"&&a(se,{children:[o(d,{children:a(i,{color:$&&j==="format"?"yellow":void 0,bold:$&&j==="format",children:[$&&j==="format"?"❯ ":" ","Prefix Text"]})}),$&&j==="format"&&o(d,{marginLeft:2,children:o(i,{dimColor:!0,children:h?"enter to save":"enter to edit (appears before message)"})}),o(d,{marginLeft:2,marginBottom:1,children:o(d,{borderStyle:"round",borderColor:h?"yellow":"gray",children:o(i,{children:g})})})]}),o(d,{children:a(i,{color:$&&j==="styling"?"yellow":void 0,bold:$&&j==="styling",children:[$&&j==="styling"?"❯ ":" ","Styling"]})}),$&&j==="styling"&&o(d,{marginLeft:2,children:o(i,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),o(d,{marginLeft:2,marginBottom:1,flexDirection:"column",children:_e.map((Te,Ve)=>o(d,{children:a(i,{color:$&&j==="styling"&&we===Ve?"cyan":void 0,children:[$&&j==="styling"&&we===Ve?"❯ ":" ",xe.includes(Te.value)?"●":"○"," ",Te.label]})},Te.value))}),o(d,{children:a(i,{color:$&&j==="foreground"?"yellow":void 0,bold:$&&j==="foreground",children:[$&&j==="foreground"?"❯ ":" ","Foreground color"]})}),$&&j==="foreground"&&o(d,{marginLeft:2,children:o(i,{dimColor:!0,children:"enter to open color picker"})}),o(d,{marginLeft:2,marginBottom:1,children:o(i,{color:ye,children:ye})}),o(d,{children:a(i,{color:$&&j==="background"?"yellow":void 0,bold:$&&j==="background",children:[$&&j==="background"?"❯ ":" ","Background color"]})}),$&&j==="background"&&o(d,{marginLeft:2,children:o(i,{dimColor:!0,children:"enter to open color picker"})}),o(d,{marginLeft:2,children:o(i,{backgroundColor:Ue,children:Ue})})]})};if(V){const{column:D,type:$}=V;return o(or,{initialValue:G,theme:f,onColorChange:k=>{D==="prefix"?$==="foreground"?(A(k),x("prefix",H=>{H.foreground_color=k})):(W(k),x("prefix",H=>{H.background_color=k})):$==="foreground"?(C(k),x("message",H=>{H.foreground_color=k})):(U(k),x("message",H=>{H.background_color=k}))},onExit:()=>{Q(null),p("")}})}return a(d,{flexDirection:"column",children:[o(de,{children:"Customize how user messages are displayed"}),a(d,{flexDirection:"column",marginBottom:1,children:[o(i,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),o(i,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),a(d,{flexDirection:"row",gap:1,children:[ne("prefix"),ne("message")]}),o(d,{borderStyle:"round",padding:1,marginTop:1,children:a(d,{flexDirection:"column",children:[o(d,{marginBottom:1,children:o(i,{bold:!0,children:"Preview"})}),a(d,{flexDirection:"row",gap:2,children:[a(d,{flexDirection:"column",width:"50%",children:[o(d,{marginBottom:1,children:o(i,{underline:!0,children:"Before (Claude Code default):"})}),o(d,{marginLeft:1,marginTop:1,children:a(i,{children:[o(i,{color:f?.colors?.inactive||"#888888",children:"●"}),o(i,{children:" The directory "}),o(i,{color:f?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(i,{children:" contains "}),o(i,{bold:!0,children:"123"}),o(i,{children:" files."})]})})]}),a(d,{flexDirection:"column",width:"50%",children:[o(d,{marginBottom:1,children:o(i,{underline:!0,children:"After (Your customization):"})}),o(d,{marginLeft:1,children:te(!0)}),o(d,{marginLeft:1,marginTop:1,children:a(i,{children:[o(i,{color:f?.colors?.inactive||"#888888",children:"●"}),o(i,{children:" The directory "}),o(i,{color:f?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(i,{children:" contains "}),o(i,{bold:!0,children:"123"}),o(i,{children:" files."})]})})]})]})]})})]})}function In({onSubmit:e}){const{settings:t,updateSettings:r}=ge(ce),[n,s]=M(0),l=()=>{r(h=>{h.inputBox||(h.inputBox={removeBorder:!1}),h.inputBox.removeBorder=!h.inputBox.removeBorder})};ae((h,u)=>{u.return||u.escape?e():h===" "&&n===0&&l()});const c=t.inputBox?.removeBorder?"☑":"☐";return a(d,{flexDirection:"column",children:[o(d,{marginBottom:1,children:o(de,{children:"Input Box Settings"})}),o(d,{marginBottom:1,children:a(i,{color:"gray",children:[o(i,{bold:!0,children:"Customize the appearance of the Claude Code input box."})," ",o(i,{dimColor:!0,children:"Press space to toggle settings, enter to go back."})]})}),o(d,{children:a(i,{children:[o(i,{color:n===0?"cyan":void 0,children:n===0?"❯ ":" "}),o(i,{bold:!0,color:n===0?"cyan":void 0,children:"Remove border"})]})}),n===0&&o(d,{marginBottom:1,flexDirection:"column",children:a(i,{dimColor:!0,children:[" ","space to toggle"]})}),o(d,{marginLeft:2,marginBottom:1,children:a(i,{children:[c," ",t.inputBox?.removeBorder?"Enabled":"Disabled"]})}),o(d,{marginBottom:1,children:o(i,{color:"gray",dimColor:!0,children:"When enabled, removes the rounded border around the input box for a cleaner look."})})]})}const ce=ar({settings:J,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function yn({startupCheckInfo:e}){const[t,r]=M({settings:J,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});ie(()=>{(async()=>{r(await Pe())})()},[]);const n=Je(_=>{const I=JSON.parse(JSON.stringify(t.settings));_(I),r(y=>({...y,settings:I,changesApplied:!1})),ve(y=>{y.settings=I,y.changesApplied=!1})},[t.settings]),[s,l]=M(null),[c,h]=M(null);ie(()=>{e.wasUpdated&&e.oldVersion&&(h({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
26
+ (However, your customization are still remembered in ${le}.)
27
+ Please reapply your changes below.`,type:"warning"}),n(()=>{}))},[]),ae((_,I)=>{(I.ctrl&&_==="c"||(_==="q"||I.escape)&&!s)&&process.exit(0)},{isActive:!s});const u=_=>{switch(h(null),_){case z.THEMES:case z.LAUNCH_TEXT:case z.THINKING_VERBS:case z.THINKING_STYLE:case z.USER_MESSAGE_DISPLAY:case z.INPUT_BOX:l(_);break;case z.APPLY_CHANGES:e.ccInstInfo&&(h({message:"Applying patches...",type:"info"}),Qe(t,e.ccInstInfo).then(I=>{r(I),h({message:"Customization patches applied successfully!",type:"success"})}));break;case z.RESTORE_ORIGINAL:e.ccInstInfo&&Ke(e.ccInstInfo).then(()=>{h({message:"Original Claude Code restored successfully!",type:"success"}),n(()=>{})});break;case z.OPEN_CONFIG:ze(le);break;case z.OPEN_CLI:e.ccInstInfo&&ze(e.ccInstInfo.cliPath);break;case z.EXIT:process.exit(0)}},g=()=>{l(null)};return o(ce.Provider,{value:{settings:t.settings,updateSettings:n,changesApplied:t.changesApplied,ccVersion:e.ccInstInfo?.version||""},children:o(d,{flexDirection:"column",children:s===null?o(xr,{onSubmit:u,notification:c}):s===z.THEMES?o(pn,{onBack:g}):s===z.LAUNCH_TEXT?o(wn,{onBack:g}):s===z.THINKING_VERBS?o(xn,{onBack:g}):s===z.THINKING_STYLE?o(_n,{onBack:g}):s===z.USER_MESSAGE_DISPLAY?o(Sn,{onBack:g}):s===z.INPUT_BOX?o(In,{onSubmit:g}):null})})}const Cn=async()=>{const e=new lr;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("1.6.0").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const t=e.opts();if(t.debug&&cn(),t.apply){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${le}`);try{const n=await Pe();(!n.settings||Object.keys(n.settings).length===0)&&(console.error("No saved customizations found in "+le),process.exit(1));const s=await We();(!s||!s.ccInstInfo)&&(console.error("Cannot find Claude Code's cli.js"),console.error("Searched at the following locations:"),Re.forEach(l=>{l.isGlob?l.expandedPaths.length===0?console.error(` - ${l.pattern} (no matches)`):(console.error(` - ${l.pattern}`),l.expandedPaths.forEach(c=>{console.error(` - ${c}`)})):console.error(` - ${l.pattern}`)}),process.exit(1)),console.log(`Found Claude Code at: ${s.ccInstInfo.cliPath}`),console.log(`Version: ${s.ccInstInfo.version}`),console.log("Applying customizations..."),await Qe(n,s.ccInstInfo),console.log("Customizations applied successfully!"),process.exit(0)}catch(n){console.error("Unexpected error:"),console.error(n instanceof Error?n.message:String(n)),process.exit(1)}}const r=await We();r?ir(o(yn,{startupCheckInfo:r})):(console.error(`Cannot find Claude Code's cli.js -- do you have Claude Code installed?
28
28
 
29
29
  Searched at the following locations:
30
- ${Ne.map(s=>{if(s.isGlob){if(s.expandedPaths.length===0)return`- ${s.pattern} (no matches)`;{const c=[`- ${s.pattern}`];return s.expandedPaths.forEach(h=>{c.push(` - ${h}`)}),c.join(`
30
+ ${Re.map(s=>{if(s.isGlob){if(s.expandedPaths.length===0)return`- ${s.pattern} (no matches)`;{const l=[`- ${s.pattern}`];return s.expandedPaths.forEach(c=>{l.push(` - ${c}`)}),l.join(`
31
31
  `)}}else return`- ${s.pattern}`}).join(`
32
32
  `)}
33
33
 
34
34
  If you have it installed but it's in a location not listed above, please open an issue at
35
35
  https://github.com/piebald-ai/tweakcc/issues and tell us where you have it--we'll add that location
36
36
  to our search list and release an update today! And in the meantime, you can get tweakcc working
37
- by manually specifying that location in ${ie} with the "ccInstallationDir" property:
37
+ by manually specifying that location in ${le} with the "ccInstallationDir" property:
38
38
 
39
39
  {
40
40
  "ccInstallationDir": "${process.platform=="win32"?"C:\\\\absolute\\\\path\\\\to\\\\node_modules\\\\@anthropic-ai\\\\claude-code":"/absolute/path/to/node_modules/@anthropic-ai/claude-code"}"
@@ -45,4 +45,4 @@ Notes:
45
45
  - Don't specify the path to your Claude Code executable's directory. It needs to be the path
46
46
  to the folder that contains **cli.js**.
47
47
  - Please also open an issue so that we can add your path to the search list for all users!
48
- `),process.exit(1))};fr();
48
+ `),process.exit(1))};Cn();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tweakcc",
3
- "version": "1.5.4",
3
+ "version": "1.6.0",
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",