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