tweakcc 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +31 -31
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  tweakcc is a CLI tool that upgrades your Claude Code experience. Customize its system prompts, add custom themes, create toolsets, and personalize the UI.
8
8
 
9
9
  > [!important]
10
- > **NEW in 3.0.0:** tweakcc now supports Claude Code native installations! It also adds a new feature to CC called **toolsets**—try them out in Claude Code with the `/toolsets` command after you create them in tweakcc. Lastly it makes Claude Code's native LSP server support work.
10
+ > **NEW in 3.0.0:** tweakcc now supports Claude Code native installations! It also adds a new feature to CC called **toolsets**—try them out in Claude Code with the `/toolsets` command after you create them in tweakcc. Lastly it makes [Claude Code's native LSP server support work.](https://www.reddit.com/r/ClaudeAI/comments/1otdfo9/lsp_is_coming_to_claude_code_and_you_can_try_it/)
11
11
 
12
12
  > [!tip]
13
13
  > **NEW in 2.0.0:** tweakcc can now customize all of Claude Code's system prompts!
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import{Box as f,Text as c,render as ot,useInput as de}from"ink";import{Command as it}from"commander";import Q from"chalk";import Je,{Fragment as ke,createContext as st,useCallback as En,useContext as pe,useEffect as xe,useState as T}from"react";import lt from"ink-link";import{Fragment as he,jsx as s,jsxs as h}from"react/jsx-runtime";import*as re from"node:path";import kn from"node:path";import*as Se from"node:os";import{EOL as fn}from"node:os";import*as Ee from"node:fs";import Ae from"node:fs";import{globbySync as at}from"globby";import ct from"node:process";import*as te from"node:fs/promises";import le from"node:fs/promises";import*as Be from"node:child_process";import{execSync as Mn}from"node:child_process";import*as Bn from"node:crypto";import je from"gray-matter";import He from"node-lief";function dt({items:e,selectedIndex:t,onSelect:n,onSubmit:r}){return de((o,i)=>{i.upArrow?n(t>0?t-1:e.length-1):i.downArrow?n(t<e.length-1?t+1:0):i.return&&r(e[t].name)}),s(f,{flexDirection:"column",children:e.map((o,i)=>s(f,{children:h(c,{children:[h(c,{bold:i===t,color:i===t?"cyan":void 0,...i===t?o.selectedStyles??{}:o.styles??{},children:[i===t?"❯ ":" ",o.name]}),o.desc&&i===t&&h(c,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",o.desc]})]})},i))})}let J=function(e){return e.APPLY_CHANGES="*Apply customizations",e.THEMES="Themes",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.MISC="Misc",e.TOOLSETS="Toolsets",e.VIEW_SYSTEM_PROMPTS="View system prompts",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 Z={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(147,165,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(177,195,255)",permission:"rgb(177,185,249)",permissionShimmer:"rgb(207,215,255)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",background:"rgb(0,204,204)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",warningShimmer:"rgb(255,223,57)",diffAdded:"rgb(34,92,43)",diffRemoved:"rgb(122,41,54)",diffAddedDimmed:"rgb(71,88,74)",diffRemovedDimmed:"rgb(105,72,77)",diffAddedWord:"rgb(56,166,96)",diffRemovedWord:"rgb(179,89,107)",diffAddedWordDimmed:"rgb(46,107,58)",diffRemovedWordDimmed:"rgb(139,57,69)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(177,185,249)",rate_limit_empty:"rgb(80,83,112)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(87,105,247)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(117,135,255)",permission:"rgb(87,105,247)",permissionShimmer:"rgb(137,155,255)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",background:"rgb(0,153,153)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",warningShimmer:"rgb(200,158,80)",diffAdded:"rgb(105,219,124)",diffRemoved:"rgb(255,168,180)",diffAddedDimmed:"rgb(199,225,203)",diffRemovedDimmed:"rgb(253,210,216)",diffAddedWord:"rgb(47,157,68)",diffRemovedWord:"rgb(209,69,75)",diffAddedWordDimmed:"rgb(144,194,156)",diffRemovedWordDimmed:"rgb(232,165,173)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(240, 240, 240)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(87,105,247)",rate_limit_empty:"rgb(39,47,111)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"ansi:magenta",bashBorder:"ansi:magenta",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blue",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blue",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyan",ide:"ansi:blueBright",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:black",inverseText:"ansi:white",inactive:"ansi:blackBright",subtle:"ansi:blackBright",suggestion:"ansi:blue",remember:"ansi:blue",background:"ansi:cyan",success:"ansi:green",error:"ansi:red",warning:"ansi:yellow",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:red",blue_FOR_SUBAGENTS_ONLY:"ansi:blue",green_FOR_SUBAGENTS_ONLY:"ansi:green",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellow",purple_FOR_SUBAGENTS_ONLY:"ansi:magenta",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyan",professionalBlue:"ansi:blueBright",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:white",bashMessageBackgroundColor:"ansi:whiteBright",memoryBackgroundColor:"ansi:white",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:black"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"ansi:magentaBright",bashBorder:"ansi:magentaBright",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blueBright",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blueBright",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyanBright",ide:"ansi:blue",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:whiteBright",inverseText:"ansi:black",inactive:"ansi:white",subtle:"ansi:white",suggestion:"ansi:blueBright",remember:"ansi:blueBright",background:"ansi:cyanBright",success:"ansi:greenBright",error:"ansi:redBright",warning:"ansi:yellowBright",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:redBright",blue_FOR_SUBAGENTS_ONLY:"ansi:blueBright",green_FOR_SUBAGENTS_ONLY:"ansi:greenBright",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellowBright",purple_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyanBright",professionalBlue:"rgb(106,155,204)",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:blackBright",bashMessageBackgroundColor:"ansi:black",memoryBackgroundColor:"ansi:blackBright",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:white"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(51,102,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(101,152,255)",permission:"rgb(51,102,255)",permissionShimmer:"rgb(101,152,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",background:"rgb(0,153,153)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",warningShimmer:"rgb(255,183,50)",diffAdded:"rgb(153,204,255)",diffRemoved:"rgb(255,204,204)",diffAddedDimmed:"rgb(209,231,253)",diffRemovedDimmed:"rgb(255,233,233)",diffAddedWord:"rgb(51,102,204)",diffRemovedWord:"rgb(153,51,51)",diffAddedWordDimmed:"rgb(102,153,204)",diffRemovedWordDimmed:"rgb(204,153,153)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(220, 220, 220)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(51,102,255)",rate_limit_empty:"rgb(23,46,114)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(153,204,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(183,224,255)",permission:"rgb(153,204,255)",permissionShimmer:"rgb(183,224,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",background:"rgb(0,204,204)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",warningShimmer:"rgb(255,234,50)",diffAdded:"rgb(0,68,102)",diffRemoved:"rgb(102,0,0)",diffAddedDimmed:"rgb(62,81,91)",diffRemovedDimmed:"rgb(62,44,44)",diffAddedWord:"rgb(0,119,179)",diffRemovedWord:"rgb(179,0,0)",diffAddedWordDimmed:"rgb(26,99,128)",diffRemovedWordDimmed:"rgb(128,21,21)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(153,204,255)",rate_limit_empty:"rgb(69,92,115)"}},{name:"Monochrome",id:"monochrome",colors:{autoAccept:"rgb(200,200,200)",bashBorder:"rgb(180,180,180)",claude:"rgb(255,255,255)",claudeShimmer:"rgb(230,230,230)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(200,200,200)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(220,220,220)",permission:"rgb(200,200,200)",permissionShimmer:"rgb(220,220,220)",planMode:"rgb(180,180,180)",ide:"rgb(190,190,190)",promptBorder:"rgb(160,160,160)",promptBorderShimmer:"rgb(180,180,180)",text:"rgb(255,255,255)",inverseText:"rgb(40,40,40)",inactive:"rgb(120,120,120)",subtle:"rgb(100,100,100)",suggestion:"rgb(200,200,200)",remember:"rgb(200,200,200)",background:"rgb(180,180,180)",success:"rgb(220,220,220)",error:"rgb(180,180,180)",warning:"rgb(200,200,200)",warningShimmer:"rgb(220,220,220)",diffAdded:"rgb(90,90,90)",diffRemoved:"rgb(60,60,60)",diffAddedDimmed:"rgb(110,110,110)",diffRemovedDimmed:"rgb(80,80,80)",diffAddedWord:"rgb(200,200,200)",diffRemovedWord:"rgb(80,80,80)",diffAddedWordDimmed:"rgb(160,160,160)",diffRemovedWordDimmed:"rgb(70,70,70)",red_FOR_SUBAGENTS_ONLY:"rgb(200,200,200)",blue_FOR_SUBAGENTS_ONLY:"rgb(180,180,180)",green_FOR_SUBAGENTS_ONLY:"rgb(210,210,210)",yellow_FOR_SUBAGENTS_ONLY:"rgb(190,190,190)",purple_FOR_SUBAGENTS_ONLY:"rgb(170,170,170)",orange_FOR_SUBAGENTS_ONLY:"rgb(195,195,195)",pink_FOR_SUBAGENTS_ONLY:"rgb(205,205,205)",cyan_FOR_SUBAGENTS_ONLY:"rgb(185,185,185)",professionalBlue:"rgb(190,190,190)",rainbow_red:"rgb(240,240,240)",rainbow_orange:"rgb(230,230,230)",rainbow_yellow:"rgb(220,220,220)",rainbow_green:"rgb(210,210,210)",rainbow_blue:"rgb(200,200,200)",rainbow_indigo:"rgb(190,190,190)",rainbow_violet:"rgb(180,180,180)",rainbow_red_shimmer:"rgb(255,255,255)",rainbow_orange_shimmer:"rgb(245,245,245)",rainbow_yellow_shimmer:"rgb(235,235,235)",rainbow_green_shimmer:"rgb(225,225,225)",rainbow_blue_shimmer:"rgb(215,215,215)",rainbow_indigo_shimmer:"rgb(205,205,205)",rainbow_violet_shimmer:"rgb(195,195,195)",clawd_body:"rgb(255,255,255)",clawd_background:"rgb(40,40,40)",userMessageBackground:"rgb(70,70,70)",bashMessageBackgroundColor:"rgb(65,65,65)",memoryBackgroundColor:"rgb(75,75,75)",rate_limit_fill:"rgb(200,200,200)",rate_limit_empty:"rgb(90,90,90)"}}],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:process.env.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},misc:{showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0},toolsets:[],defaultToolset:null},ut=()=>{const e=re.join(Se.homedir(),".tweakcc"),t=process.env.XDG_CONFIG_HOME;try{if(Ee.existsSync(e))return e}catch{}return t?re.join(t,"tweakcc"):e},ce=ut(),fe=re.join(ce,"config.json"),Ne=re.join(ce,"cli.js.backup"),ae=re.join(ce,"native-binary.backup"),ye=re.join(ce,"system-prompts"),mn=re.join(ce,"prompt-data-cache"),gt=()=>{const e=[],t=process.platform=="win32"?Se.homedir().replace(/\\/g,"/"):Se.homedir(),n="node_modules/@anthropic-ai/claude-code",r=(o,i=!1)=>{if(i){const l=at(o,{onlyFiles:!1});e.push({pattern:o,isGlob:!0,expandedPaths:l})}else e.push({pattern:o,isGlob:!1,expandedPaths:[o]})};return r(`${Se.homedir()}/.claude/local/${n}`),process.env.NPM_PREFIX&&r(`${process.env.NPM_PREFIX}/lib/${n}`),process.env.N_PREFIX&&r(`${process.env.N_PREFIX}/lib/${n}`),process.env.VOLTA_HOME&&r(`${process.env.VOLTA_HOME}/lib/${n}`),process.env.FNM_DIR&&r(`${process.env.FNM_DIR}/lib/${n}`),process.env.NVM_DIR&&r(`${process.env.NVM_DIR}/lib/${n}`),process.env.NODENV_ROOT&&r(`${process.env.NODENV_ROOT}/versions/*/lib/${n}`,!0),process.env.NVS_HOME&&r(`${process.env.NVS_HOME}/node/*/*/lib/${n}`,!0),process.env.ASDF_DATA_DIR&&r(`${process.env.ASDF_DATA_DIR}/installs/nodejs/*/lib/${n}`,!0),process.platform=="win32"?(r(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${n}`),r(`${t}/AppData/Roaming/npm/${n}`),r(`${t}/AppData/Roaming/nvm/*/${n}`,!0),r(`${t}/AppData/Local/Yarn/config/global/${n}`),r(`${t}/AppData/Local/pnpm/global/*/${n}`,!0),r(`C:/nvm4w/nodejs/${n}`),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/AppData/Roaming/Yarn/config/global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`${t}/AppData/Local/fnm_multishells/*/node_modules/${n}`,!0)):(process.platform=="darwin"&&(r(`${t}/Library/${n}`),r(`/opt/local/lib/${n}`)),r(`${t}/.local/lib/${n}`),r(`${t}/.local/share/${n}`),r(`${t}/.npm-global/lib/${n}`),r(`${t}/.npm-packages/lib/${n}`),r(`${t}/.npm/lib/${n}`),r(`${t}/npm/lib/${n}`),r(`/etc/${n}`),r(`/lib/${n}`),r(`/opt/node/lib/${n}`),r(`/usr/lib/${n}`),r(`/usr/local/lib/${n}`),r(`/usr/share/${n}`),r(`/var/lib/${n}`),r(`/opt/homebrew/lib/${n}`),r(`${t}/.linuxbrew/lib/${n}`),r(`${t}/.config/yarn/global/${n}`),r(`${t}/.yarn/global/${n}`),r(`${t}/.bun/install/global/${n}`),r(`${t}/.pnpm-global/${n}`),r(`${t}/.pnpm-global/*/${n}`,!0),r(`${t}/pnpm-global/${n}`),r(`${t}/pnpm-global/*/${n}`,!0),r(`${t}/.local/share/pnpm/global/${n}`),r(`${t}/.local/share/pnpm/global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`/usr/local/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/lib/${n}`),r(`${t}/.volta/tools/image/node/*/lib/${n}`,!0),r(`${t}/.fnm/node-versions/*/installation/lib/${n}`,!0),r(`${t}/.local/state/fnm_multishells/*/lib/${n}`,!0),r(`/usr/local/nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nodenv/versions/*/lib/${n}`,!0),r(`${t}/.nvs/*/lib/${n}`,!0),r(`${t}/.asdf/installs/nodejs/*/lib/${n}`,!0),process.env.MISE_DATA_DIR&&r(`${process.env.MISE_DATA_DIR}/installs/node/*/lib/${n}`,!0),r(`${t}/.local/share/mise/installs/node/*/lib/${n}`,!0)),process.platform=="win32"&&e.forEach(o=>{o.pattern=o.pattern.replace(/\//g,"\\"),o.expandedPaths=o.expandedPaths.map(i=>i.replace(/\//g,"\\"))}),e},Ze=gt(),pn=Ze.flatMap(e=>e.expandedPaths),ht=({children:e,...t})=>h(c,{bold:!0,backgroundColor:"#ffd500",color:"#000",...t,children:[" ",e," "]});var me=ht;const ft=[{name:J.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:J.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:J.THINKING_STYLE,desc:"Choose custom spinners"},{name:J.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:J.MISC,desc:"Miscellaneous settings (input box border, etc.)"},{name:J.TOOLSETS,desc:"Manage toolsets to control which tools are available"},{name:J.VIEW_SYSTEM_PROMPTS,desc:"Opens the system prompts directory where you can customize Claude Code's system prompts"}],bn=[{name:J.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:J.OPEN_CONFIG,desc:`Opens your tweakcc config file (${fe})`},{name:J.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:J.EXIT,desc:"Bye!"}];function mt({onSubmit:e,notification:t,isNativeInstallation:n}){const r=n?bn.filter(a=>a.name!==J.OPEN_CLI):bn,o=[...pe(ue).changesApplied?[]:[{name:J.APPLY_CHANGES,desc:"Required: Updates Claude Code in-place with your changes",selectedStyles:{color:"green"}}],...ft,...r],[i,l]=T(0);return h(f,{flexDirection:"column",children:[s(f,{marginBottom:1,children:s(me,{children:"Tweak Claude Code"})}),s(f,{marginBottom:1,children:h(c,{color:"gray",children:[s(c,{bold:!0,children:"Customize your Claude Code installation."})," ",s(c,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),s(f,{marginBottom:1,children:h(c,{color:"yellow",children:["⭐ ",s(c,{bold:!0,children:"Star the repo at "}),s(lt,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:s(c,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),s(c,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),t&&s(f,{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:s(c,{color:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",children:t?.message})}),s(dt,{items:o,selectedIndex:i,onSelect:l,onSubmit:a=>e(a)})]})}async function nn(e){const t=re.join(mn,`prompts-${e}.json`);try{const r=await te.readFile(t,"utf-8");return JSON.parse(r)}catch{}const n=`https://raw.githubusercontent.com/Piebald-AI/tweakcc/refs/heads/main/data/prompts/prompts-${e}.json`;try{const r=await fetch(n);if(!r.ok){let i;throw r.status===429?i="Rate limit exceeded. GitHub has temporarily blocked requests. Please wait a few minutes and try again.":r.status===404?i=`Prompts file not found for Claude Code v${e}. This version was released within the past day or so and will be supported within a few hours.`:r.status>=500?i=`GitHub server error (${r.status}). Please try again later.`:i=`HTTP ${r.status}: ${r.statusText}`,new Error(i)}const o=await r.json();try{await te.mkdir(mn,{recursive:!0}),await te.writeFile(t,JSON.stringify(o,null,2),"utf-8")}catch(i){console.warn(`Failed to write to cache to ${t}: ${i}`)}return o}catch(r){if(r instanceof Error){if(r.message.includes("Rate limit")||r.message.includes("not found")||r.message.includes("server error")||r.message.includes("HTTP"))throw r;const o=`Failed to download prompts for version ${e}: ${r.message}`;throw new Error(o)}throw r}}const pt="modulepreload",bt=function(e){return"/"+e},wn={},wt=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let d=function(g){return Promise.all(g.map(m=>Promise.resolve(m).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const l=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),u=a?.nonce||a?.getAttribute("nonce");o=d(n.map(g=>{if(g=bt(g,r),g in wn)return;wn[g]=!0;const m=g.endsWith(".css"),v=m?'[rel="stylesheet"]':"";if(!!r)for(let w=l.length-1;w>=0;w--){const x=l[w];if(x.href===g&&(!m||x.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${g}"]${v}`))return;const p=document.createElement("link");if(p.rel=m?"stylesheet":pt,m||(p.as="script"),p.crossOrigin="",p.href=g,u&&p.setAttribute("nonce",u),document.head.appendChild(p),m)return new Promise((w,x)=>{p.addEventListener("load",w),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${g}`)))})}))}function i(l){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=l,window.dispatchEvent(a),!a.defaultPrevented)throw l}return o.then(l=>{for(const a of l||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},Nn=re.join(ce,"systemPromptOriginalHashes.json"),On=re.join(ce,"systemPromptAppliedHashes.json"),Tn=(e,t)=>`${e}-${t}`,Ye=e=>Bn.createHash("md5").update(e.trim(),"utf8").digest("hex"),An=async()=>{try{const e=await te.readFile(Nn,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},xt=async e=>{await te.mkdir(ce,{recursive:!0});const t={},n=Object.keys(e).sort();for(const r of n)t[r]=e[r];await te.writeFile(Nn,JSON.stringify(t,null,2),"utf8")},St=async e=>{const t=await An();let n=0;for(const r of e.prompts){const o=Tn(r.id,r.version);if(!t[o]){const i=De(r.pieces,r.identifiers,r.identifierMap),l=Ye(i);t[o]=l,n++}}return await xt(t),n},yt=async(e,t)=>{const n=await An(),r=Tn(e,t);return n[r]},tn=async()=>{try{const e=await te.readFile(On,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},Pn=async e=>{await te.mkdir(ce,{recursive:!0});const t={},n=Object.keys(e).sort();for(const r of n)t[r]=e[r];await te.writeFile(On,JSON.stringify(t,null,2),"utf8")},vt=async(e,t)=>{const n=await tn();n[e]=t,await Pn(n)},$t=async()=>{const e=await tn(),t={};for(const n of Object.keys(e))t[n]=null;await Pn(t)},_t=async e=>{try{const t=await tn();if(Object.keys(t).length===0)return!1;const r=(await te.readdir(e)).filter(o=>o.endsWith(".md"));for(const o of r){const i=o.replace(".md",""),l=t[i];if(l===void 0||l===null)continue;const a=re.join(e,o),u=await te.readFile(a,"utf8"),g=(await wt(()=>import("gray-matter"),[])).default(u,{delimiters:["<!--","-->"]});if(Ye(g.content)!==l)return!0}return!1}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}},Ln=e=>{const t=je(e,{delimiters:["<!--","-->"]}),{name:n,description:r,ccVersion:o,variables:i}=t.data;return{name:n||"",description:r||"",ccVersion:o||"",variables:i||[],content:t.content.trim()}},xn=(e,t)=>{const n=t||De(e.pieces,e.identifiers,e.identifierMap),r=Object.keys(e.identifierMap).length>0?[...new Set(Object.values(e.identifierMap))]:void 0,o={name:e.name,description:e.description,ccVersion:e.version};return r&&r.length>0&&(o.variables=r),je.stringify(n,o,{delimiters:["<!--","-->"]})},De=(e,t,n)=>{let r="";for(let o=0;o<e.length;o++)if(r+=e[o],o<t.length){const i=t[o],l=n[String(i)]||`UNKNOWN_${i}`;r+=l}return r},It=(e,t)=>{const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const i=n[o]||0,l=r[o]||0;if(i<l)return-1;if(i>l)return 1}return 0},Re=e=>re.join(ye,`${e}.md`),Ct=async e=>{try{return await te.access(Re(e)),!0}catch{return!1}},Et=async e=>{const t=Re(e),n=await te.readFile(t,"utf-8");return Ln(n)},Qe=async(e,t)=>{const n=Re(e);await te.writeFile(n,t,"utf-8")},kt=async(e,t)=>{const n=Re(e),r=await te.readFile(n,"utf-8"),o=je(r,{delimiters:["<!--","-->"]}),i=Object.keys(t).length>0?[...new Set(Object.values(t))]:void 0,l={name:o.data.name,description:o.data.description,ccVersion:o.data.ccVersion};i&&i.length>0&&(l.variables=i);const a=je.stringify(o.content,l,{delimiters:["<!--","-->"]});await Qe(e,a)},Mt=(e,t)=>{const n=w=>w.split(/(\s+)/),r=n(e),o=n(t),i=r.length,l=o.length,a=Array(i+1).fill(0).map(()=>Array(l+1).fill(0));for(let w=1;w<=i;w++)for(let x=1;x<=l;x++)r[w-1]===o[x-1]?a[w][x]=a[w-1][x-1]+1:a[w][x]=Math.max(a[w-1][x],a[w][x-1]);const u=Array(i).fill(!1),d=Array(l).fill(!1);let g=i,m=l;for(;g>0||m>0;)g>0&&m>0&&r[g-1]===o[m-1]?(g--,m--):m>0&&(g===0||a[g][m-1]>=a[g-1][m])?(d[m-1]=!0,m--):g>0&&(u[g-1]=!0,g--);const v=w=>w.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");let b="";for(let w=0;w<r.length;w++){const x=v(r[w]);b+=u[w]?`<mark>${x}</mark>`:x}let p="";for(let w=0;w<o.length;w++){const x=v(o[w]);p+=d[w]?`<mark>${x}</mark>`:x}return{oldHtml:b,newHtml:p}},Sn=(e,t)=>{const n=e.length,r=t.length,o=Array(n+1).fill(0).map(()=>Array(r+1).fill(0));for(let d=1;d<=n;d++)for(let g=1;g<=r;g++)e[d-1]===t[g-1]?o[d][g]=o[d-1][g-1]+1:o[d][g]=Math.max(o[d-1][g],o[d][g-1]);const i=[];let l=n,a=r;const u=[];for(;l>0||a>0;)l>0&&a>0&&e[l-1]===t[a-1]?(u.unshift({type:"unchanged",line:e[l-1],oldLineNo:l,newLineNo:a}),l--,a--):a>0&&(l===0||o[l][a-1]>=o[l-1][a])?(u.unshift({type:"added",line:t[a-1],newLineNo:a}),a--):l>0&&(u.unshift({type:"removed",line:e[l-1],oldLineNo:l}),l--);for(let d=0;d<u.length;d++){const g=u[d],m=u[d+1];if(g.type==="removed"&&m?.type==="added"){const v=Mt(g.line,m.line);i.push({type:"modified",line:g.line,oldLineNo:g.oldLineNo,newLineNo:m.newLineNo,oldHtml:v.oldHtml,newHtml:v.newHtml}),d++}else i.push(g)}return i},Bt=async(e,t,n,r,o,i,l,a)=>{const u=n.split(`
2
+ import{Box as m,Text as c,render as ot,useInput as de}from"ink";import{Command as it}from"commander";import Q from"chalk";import Je,{Fragment as ke,createContext as st,useCallback as En,useContext as pe,useEffect as xe,useState as T}from"react";import lt from"ink-link";import{Fragment as he,jsx as s,jsxs as h}from"react/jsx-runtime";import*as re from"node:path";import kn from"node:path";import*as ye from"node:os";import{EOL as fn}from"node:os";import*as Ee from"node:fs";import Ae from"node:fs";import{globbySync as at}from"globby";import ct from"node:process";import*as te from"node:fs/promises";import le from"node:fs/promises";import*as Be from"node:child_process";import{execSync as Mn}from"node:child_process";import*as Bn from"node:crypto";import He from"gray-matter";import De from"node-lief";function dt({items:e,selectedIndex:t,onSelect:n,onSubmit:r}){return de((o,i)=>{i.upArrow?n(t>0?t-1:e.length-1):i.downArrow?n(t<e.length-1?t+1:0):i.return&&r(e[t].name)}),s(m,{flexDirection:"column",children:e.map((o,i)=>s(m,{children:h(c,{children:[h(c,{bold:i===t,color:i===t?"cyan":void 0,...i===t?o.selectedStyles??{}:o.styles??{},children:[i===t?"❯ ":" ",o.name]}),o.desc&&i===t&&h(c,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",o.desc]})]})},i))})}let J=function(e){return e.APPLY_CHANGES="*Apply customizations",e.THEMES="Themes",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.MISC="Misc",e.TOOLSETS="Toolsets",e.VIEW_SYSTEM_PROMPTS="View system prompts",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 Z={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(147,165,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(177,195,255)",permission:"rgb(177,185,249)",permissionShimmer:"rgb(207,215,255)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",background:"rgb(0,204,204)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",warningShimmer:"rgb(255,223,57)",diffAdded:"rgb(34,92,43)",diffRemoved:"rgb(122,41,54)",diffAddedDimmed:"rgb(71,88,74)",diffRemovedDimmed:"rgb(105,72,77)",diffAddedWord:"rgb(56,166,96)",diffRemovedWord:"rgb(179,89,107)",diffAddedWordDimmed:"rgb(46,107,58)",diffRemovedWordDimmed:"rgb(139,57,69)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(177,185,249)",rate_limit_empty:"rgb(80,83,112)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(87,105,247)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(117,135,255)",permission:"rgb(87,105,247)",permissionShimmer:"rgb(137,155,255)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",background:"rgb(0,153,153)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",warningShimmer:"rgb(200,158,80)",diffAdded:"rgb(105,219,124)",diffRemoved:"rgb(255,168,180)",diffAddedDimmed:"rgb(199,225,203)",diffRemovedDimmed:"rgb(253,210,216)",diffAddedWord:"rgb(47,157,68)",diffRemovedWord:"rgb(209,69,75)",diffAddedWordDimmed:"rgb(144,194,156)",diffRemovedWordDimmed:"rgb(232,165,173)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(240, 240, 240)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(87,105,247)",rate_limit_empty:"rgb(39,47,111)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"ansi:magenta",bashBorder:"ansi:magenta",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blue",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blue",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyan",ide:"ansi:blueBright",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:black",inverseText:"ansi:white",inactive:"ansi:blackBright",subtle:"ansi:blackBright",suggestion:"ansi:blue",remember:"ansi:blue",background:"ansi:cyan",success:"ansi:green",error:"ansi:red",warning:"ansi:yellow",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:red",blue_FOR_SUBAGENTS_ONLY:"ansi:blue",green_FOR_SUBAGENTS_ONLY:"ansi:green",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellow",purple_FOR_SUBAGENTS_ONLY:"ansi:magenta",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyan",professionalBlue:"ansi:blueBright",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:white",bashMessageBackgroundColor:"ansi:whiteBright",memoryBackgroundColor:"ansi:white",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:black"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"ansi:magentaBright",bashBorder:"ansi:magentaBright",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blueBright",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blueBright",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyanBright",ide:"ansi:blue",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:whiteBright",inverseText:"ansi:black",inactive:"ansi:white",subtle:"ansi:white",suggestion:"ansi:blueBright",remember:"ansi:blueBright",background:"ansi:cyanBright",success:"ansi:greenBright",error:"ansi:redBright",warning:"ansi:yellowBright",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:redBright",blue_FOR_SUBAGENTS_ONLY:"ansi:blueBright",green_FOR_SUBAGENTS_ONLY:"ansi:greenBright",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellowBright",purple_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyanBright",professionalBlue:"rgb(106,155,204)",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:blackBright",bashMessageBackgroundColor:"ansi:black",memoryBackgroundColor:"ansi:blackBright",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:white"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(51,102,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(101,152,255)",permission:"rgb(51,102,255)",permissionShimmer:"rgb(101,152,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",background:"rgb(0,153,153)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",warningShimmer:"rgb(255,183,50)",diffAdded:"rgb(153,204,255)",diffRemoved:"rgb(255,204,204)",diffAddedDimmed:"rgb(209,231,253)",diffRemovedDimmed:"rgb(255,233,233)",diffAddedWord:"rgb(51,102,204)",diffRemovedWord:"rgb(153,51,51)",diffAddedWordDimmed:"rgb(102,153,204)",diffRemovedWordDimmed:"rgb(204,153,153)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(220, 220, 220)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(51,102,255)",rate_limit_empty:"rgb(23,46,114)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(153,204,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(183,224,255)",permission:"rgb(153,204,255)",permissionShimmer:"rgb(183,224,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",background:"rgb(0,204,204)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",warningShimmer:"rgb(255,234,50)",diffAdded:"rgb(0,68,102)",diffRemoved:"rgb(102,0,0)",diffAddedDimmed:"rgb(62,81,91)",diffRemovedDimmed:"rgb(62,44,44)",diffAddedWord:"rgb(0,119,179)",diffRemovedWord:"rgb(179,0,0)",diffAddedWordDimmed:"rgb(26,99,128)",diffRemovedWordDimmed:"rgb(128,21,21)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(153,204,255)",rate_limit_empty:"rgb(69,92,115)"}},{name:"Monochrome",id:"monochrome",colors:{autoAccept:"rgb(200,200,200)",bashBorder:"rgb(180,180,180)",claude:"rgb(255,255,255)",claudeShimmer:"rgb(230,230,230)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(200,200,200)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(220,220,220)",permission:"rgb(200,200,200)",permissionShimmer:"rgb(220,220,220)",planMode:"rgb(180,180,180)",ide:"rgb(190,190,190)",promptBorder:"rgb(160,160,160)",promptBorderShimmer:"rgb(180,180,180)",text:"rgb(255,255,255)",inverseText:"rgb(40,40,40)",inactive:"rgb(120,120,120)",subtle:"rgb(100,100,100)",suggestion:"rgb(200,200,200)",remember:"rgb(200,200,200)",background:"rgb(180,180,180)",success:"rgb(220,220,220)",error:"rgb(180,180,180)",warning:"rgb(200,200,200)",warningShimmer:"rgb(220,220,220)",diffAdded:"rgb(90,90,90)",diffRemoved:"rgb(60,60,60)",diffAddedDimmed:"rgb(110,110,110)",diffRemovedDimmed:"rgb(80,80,80)",diffAddedWord:"rgb(200,200,200)",diffRemovedWord:"rgb(80,80,80)",diffAddedWordDimmed:"rgb(160,160,160)",diffRemovedWordDimmed:"rgb(70,70,70)",red_FOR_SUBAGENTS_ONLY:"rgb(200,200,200)",blue_FOR_SUBAGENTS_ONLY:"rgb(180,180,180)",green_FOR_SUBAGENTS_ONLY:"rgb(210,210,210)",yellow_FOR_SUBAGENTS_ONLY:"rgb(190,190,190)",purple_FOR_SUBAGENTS_ONLY:"rgb(170,170,170)",orange_FOR_SUBAGENTS_ONLY:"rgb(195,195,195)",pink_FOR_SUBAGENTS_ONLY:"rgb(205,205,205)",cyan_FOR_SUBAGENTS_ONLY:"rgb(185,185,185)",professionalBlue:"rgb(190,190,190)",rainbow_red:"rgb(240,240,240)",rainbow_orange:"rgb(230,230,230)",rainbow_yellow:"rgb(220,220,220)",rainbow_green:"rgb(210,210,210)",rainbow_blue:"rgb(200,200,200)",rainbow_indigo:"rgb(190,190,190)",rainbow_violet:"rgb(180,180,180)",rainbow_red_shimmer:"rgb(255,255,255)",rainbow_orange_shimmer:"rgb(245,245,245)",rainbow_yellow_shimmer:"rgb(235,235,235)",rainbow_green_shimmer:"rgb(225,225,225)",rainbow_blue_shimmer:"rgb(215,215,215)",rainbow_indigo_shimmer:"rgb(205,205,205)",rainbow_violet_shimmer:"rgb(195,195,195)",clawd_body:"rgb(255,255,255)",clawd_background:"rgb(40,40,40)",userMessageBackground:"rgb(70,70,70)",bashMessageBackgroundColor:"rgb(65,65,65)",memoryBackgroundColor:"rgb(75,75,75)",rate_limit_fill:"rgb(200,200,200)",rate_limit_empty:"rgb(90,90,90)"}}],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:process.env.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},misc:{showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0},toolsets:[],defaultToolset:null},ut=()=>{const e=re.join(ye.homedir(),".tweakcc"),t=process.env.XDG_CONFIG_HOME;try{if(Ee.existsSync(e))return e}catch{}return t?re.join(t,"tweakcc"):e},ce=ut(),fe=re.join(ce,"config.json"),Ne=re.join(ce,"cli.js.backup"),ae=re.join(ce,"native-binary.backup"),Se=re.join(ce,"system-prompts"),mn=re.join(ce,"prompt-data-cache"),gt=()=>{const e=[],t=process.platform=="win32"?ye.homedir().replace(/\\/g,"/"):ye.homedir(),n="node_modules/@anthropic-ai/claude-code",r=(o,i=!1)=>{if(i){const l=at(o,{onlyFiles:!1});e.push({pattern:o,isGlob:!0,expandedPaths:l})}else e.push({pattern:o,isGlob:!1,expandedPaths:[o]})};return r(`${ye.homedir()}/.claude/local/${n}`),process.env.NPM_PREFIX&&r(`${process.env.NPM_PREFIX}/lib/${n}`),process.env.N_PREFIX&&r(`${process.env.N_PREFIX}/lib/${n}`),process.env.VOLTA_HOME&&r(`${process.env.VOLTA_HOME}/lib/${n}`),process.env.FNM_DIR&&r(`${process.env.FNM_DIR}/lib/${n}`),process.env.NVM_DIR&&r(`${process.env.NVM_DIR}/lib/${n}`),process.env.NODENV_ROOT&&r(`${process.env.NODENV_ROOT}/versions/*/lib/${n}`,!0),process.env.NVS_HOME&&r(`${process.env.NVS_HOME}/node/*/*/lib/${n}`,!0),process.env.ASDF_DATA_DIR&&r(`${process.env.ASDF_DATA_DIR}/installs/nodejs/*/lib/${n}`,!0),process.platform=="win32"?(r(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${n}`),r(`${t}/AppData/Roaming/npm/${n}`),r(`${t}/AppData/Roaming/nvm/*/${n}`,!0),r(`${t}/AppData/Local/Yarn/config/global/${n}`),r(`${t}/AppData/Local/pnpm/global/*/${n}`,!0),r(`C:/nvm4w/nodejs/${n}`),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/AppData/Roaming/Yarn/config/global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/${n}`),r(`${t}/AppData/Roaming/pnpm-global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`${t}/AppData/Local/fnm_multishells/*/node_modules/${n}`,!0)):(process.platform=="darwin"&&(r(`${t}/Library/${n}`),r(`/opt/local/lib/${n}`)),r(`${t}/.local/lib/${n}`),r(`${t}/.local/share/${n}`),r(`${t}/.npm-global/lib/${n}`),r(`${t}/.npm-packages/lib/${n}`),r(`${t}/.npm/lib/${n}`),r(`${t}/npm/lib/${n}`),r(`/etc/${n}`),r(`/lib/${n}`),r(`/opt/node/lib/${n}`),r(`/usr/lib/${n}`),r(`/usr/local/lib/${n}`),r(`/usr/share/${n}`),r(`/var/lib/${n}`),r(`/opt/homebrew/lib/${n}`),r(`${t}/.linuxbrew/lib/${n}`),r(`${t}/.config/yarn/global/${n}`),r(`${t}/.yarn/global/${n}`),r(`${t}/.bun/install/global/${n}`),r(`${t}/.pnpm-global/${n}`),r(`${t}/.pnpm-global/*/${n}`,!0),r(`${t}/pnpm-global/${n}`),r(`${t}/pnpm-global/*/${n}`,!0),r(`${t}/.local/share/pnpm/global/${n}`),r(`${t}/.local/share/pnpm/global/*/${n}`,!0),r(`${t}/.bun/install/global/${n}`),r(`/usr/local/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/versions/node/*/lib/${n}`,!0),r(`${t}/n/lib/${n}`),r(`${t}/.volta/tools/image/node/*/lib/${n}`,!0),r(`${t}/.fnm/node-versions/*/installation/lib/${n}`,!0),r(`${t}/.local/state/fnm_multishells/*/lib/${n}`,!0),r(`/usr/local/nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nvm/versions/node/*/lib/${n}`,!0),r(`${t}/.nodenv/versions/*/lib/${n}`,!0),r(`${t}/.nvs/*/lib/${n}`,!0),r(`${t}/.asdf/installs/nodejs/*/lib/${n}`,!0),process.env.MISE_DATA_DIR&&r(`${process.env.MISE_DATA_DIR}/installs/node/*/lib/${n}`,!0),r(`${t}/.local/share/mise/installs/node/*/lib/${n}`,!0)),process.platform=="win32"&&e.forEach(o=>{o.pattern=o.pattern.replace(/\//g,"\\"),o.expandedPaths=o.expandedPaths.map(i=>i.replace(/\//g,"\\"))}),e},Ze=gt(),pn=Ze.flatMap(e=>e.expandedPaths),ht=({children:e,...t})=>h(c,{bold:!0,backgroundColor:"#ffd500",color:"#000",...t,children:[" ",e," "]});var me=ht;const ft=[{name:J.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:J.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:J.THINKING_STYLE,desc:"Choose custom spinners"},{name:J.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:J.MISC,desc:"Miscellaneous settings (input box border, etc.)"},{name:J.TOOLSETS,desc:"Manage toolsets to control which tools are available"},{name:J.VIEW_SYSTEM_PROMPTS,desc:"Opens the system prompts directory where you can customize Claude Code's system prompts"}],bn=[{name:J.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:J.OPEN_CONFIG,desc:`Opens your tweakcc config file (${fe})`},{name:J.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:J.EXIT,desc:"Bye!"}];function mt({onSubmit:e,notification:t,isNativeInstallation:n}){const r=n?bn.filter(a=>a.name!==J.OPEN_CLI):bn,o=[...pe(ue).changesApplied?[]:[{name:J.APPLY_CHANGES,desc:"Required: Updates Claude Code in-place with your changes",selectedStyles:{color:"green"}}],...ft,...r],[i,l]=T(0);return h(m,{flexDirection:"column",children:[s(m,{marginBottom:1,children:s(me,{children:"Tweak Claude Code"})}),s(m,{marginBottom:1,children:h(c,{color:"gray",children:[s(c,{bold:!0,children:"Customize your Claude Code installation."})," ",s(c,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),s(m,{marginBottom:1,children:h(c,{color:"yellow",children:["⭐ ",s(c,{bold:!0,children:"Star the repo at "}),s(lt,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:s(c,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),s(c,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),t&&s(m,{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:s(c,{color:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",children:t?.message})}),s(dt,{items:o,selectedIndex:i,onSelect:l,onSubmit:a=>e(a)})]})}async function nn(e){const t=re.join(mn,`prompts-${e}.json`);try{const r=await te.readFile(t,"utf-8");return JSON.parse(r)}catch{}const n=`https://raw.githubusercontent.com/Piebald-AI/tweakcc/refs/heads/main/data/prompts/prompts-${e}.json`;try{const r=await fetch(n);if(!r.ok){let i;throw r.status===429?i="Rate limit exceeded. GitHub has temporarily blocked requests. Please wait a few minutes and try again.":r.status===404?i=`Prompts file not found for Claude Code v${e}. This version was released within the past day or so and will be supported within a few hours.`:r.status>=500?i=`GitHub server error (${r.status}). Please try again later.`:i=`HTTP ${r.status}: ${r.statusText}`,new Error(i)}const o=await r.json();try{await te.mkdir(mn,{recursive:!0}),await te.writeFile(t,JSON.stringify(o,null,2),"utf-8")}catch(i){console.warn(`Failed to write to cache to ${t}: ${i}`)}return o}catch(r){if(r instanceof Error){if(r.message.includes("Rate limit")||r.message.includes("not found")||r.message.includes("server error")||r.message.includes("HTTP"))throw r;const o=`Failed to download prompts for version ${e}: ${r.message}`;throw new Error(o)}throw r}}const pt="modulepreload",bt=function(e){return"/"+e},wn={},wt=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let d=function(g){return Promise.all(g.map(f=>Promise.resolve(f).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const l=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),u=a?.nonce||a?.getAttribute("nonce");o=d(n.map(g=>{if(g=bt(g,r),g in wn)return;wn[g]=!0;const f=g.endsWith(".css"),v=f?'[rel="stylesheet"]':"";if(!!r)for(let w=l.length-1;w>=0;w--){const x=l[w];if(x.href===g&&(!f||x.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${g}"]${v}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":pt,f||(p.as="script"),p.crossOrigin="",p.href=g,u&&p.setAttribute("nonce",u),document.head.appendChild(p),f)return new Promise((w,x)=>{p.addEventListener("load",w),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${g}`)))})}))}function i(l){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=l,window.dispatchEvent(a),!a.defaultPrevented)throw l}return o.then(l=>{for(const a of l||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},Nn=re.join(ce,"systemPromptOriginalHashes.json"),On=re.join(ce,"systemPromptAppliedHashes.json"),Tn=(e,t)=>`${e}-${t}`,Ye=e=>Bn.createHash("md5").update(e.trim(),"utf8").digest("hex"),An=async()=>{try{const e=await te.readFile(Nn,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},xt=async e=>{await te.mkdir(ce,{recursive:!0});const t={},n=Object.keys(e).sort();for(const r of n)t[r]=e[r];await te.writeFile(Nn,JSON.stringify(t,null,2),"utf8")},yt=async e=>{const t=await An();let n=0;for(const r of e.prompts){const o=Tn(r.id,r.version);if(!t[o]){const i=Re(r.pieces,r.identifiers,r.identifierMap),l=Ye(i);t[o]=l,n++}}return await xt(t),n},St=async(e,t)=>{const n=await An(),r=Tn(e,t);return n[r]},tn=async()=>{try{const e=await te.readFile(On,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},Pn=async e=>{await te.mkdir(ce,{recursive:!0});const t={},n=Object.keys(e).sort();for(const r of n)t[r]=e[r];await te.writeFile(On,JSON.stringify(t,null,2),"utf8")},vt=async(e,t)=>{const n=await tn();n[e]=t,await Pn(n)},$t=async()=>{const e=await tn(),t={};for(const n of Object.keys(e))t[n]=null;await Pn(t)},_t=async e=>{try{const t=await tn();if(Object.keys(t).length===0)return!1;const r=(await te.readdir(e)).filter(o=>o.endsWith(".md"));for(const o of r){const i=o.replace(".md",""),l=t[i];if(l===void 0||l===null)continue;const a=re.join(e,o),u=await te.readFile(a,"utf8"),g=(await wt(()=>import("gray-matter"),[])).default(u,{delimiters:["<!--","-->"]});if(Ye(g.content)!==l)return!0}return!1}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}},Ln=e=>{const t=He(e,{delimiters:["<!--","-->"]}),{name:n,description:r,ccVersion:o,variables:i}=t.data;return{name:n||"",description:r||"",ccVersion:o||"",variables:i||[],content:t.content.trim()}},xn=(e,t)=>{const n=t||Re(e.pieces,e.identifiers,e.identifierMap),r=Object.keys(e.identifierMap).length>0?[...new Set(Object.values(e.identifierMap))]:void 0,o={name:e.name,description:e.description,ccVersion:e.version};return r&&r.length>0&&(o.variables=r),He.stringify(n,o,{delimiters:["<!--","-->"]})},Re=(e,t,n)=>{let r="";for(let o=0;o<e.length;o++)if(r+=e[o],o<t.length){const i=t[o],l=n[String(i)]||`UNKNOWN_${i}`;r+=l}return r},It=(e,t)=>{const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const i=n[o]||0,l=r[o]||0;if(i<l)return-1;if(i>l)return 1}return 0},Fe=e=>re.join(Se,`${e}.md`),Ct=async e=>{try{return await te.access(Fe(e)),!0}catch{return!1}},Et=async e=>{const t=Fe(e),n=await te.readFile(t,"utf-8");return Ln(n)},Qe=async(e,t)=>{const n=Fe(e);await te.writeFile(n,t,"utf-8")},kt=async(e,t)=>{const n=Fe(e),r=await te.readFile(n,"utf-8"),o=He(r,{delimiters:["<!--","-->"]}),i=Object.keys(t).length>0?[...new Set(Object.values(t))]:void 0,l={name:o.data.name,description:o.data.description,ccVersion:o.data.ccVersion};i&&i.length>0&&(l.variables=i);const a=He.stringify(o.content,l,{delimiters:["<!--","-->"]});await Qe(e,a)},Mt=(e,t)=>{const n=w=>w.split(/(\s+)/),r=n(e),o=n(t),i=r.length,l=o.length,a=Array(i+1).fill(0).map(()=>Array(l+1).fill(0));for(let w=1;w<=i;w++)for(let x=1;x<=l;x++)r[w-1]===o[x-1]?a[w][x]=a[w-1][x-1]+1:a[w][x]=Math.max(a[w-1][x],a[w][x-1]);const u=Array(i).fill(!1),d=Array(l).fill(!1);let g=i,f=l;for(;g>0||f>0;)g>0&&f>0&&r[g-1]===o[f-1]?(g--,f--):f>0&&(g===0||a[g][f-1]>=a[g-1][f])?(d[f-1]=!0,f--):g>0&&(u[g-1]=!0,g--);const v=w=>w.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");let b="";for(let w=0;w<r.length;w++){const x=v(r[w]);b+=u[w]?`<mark>${x}</mark>`:x}let p="";for(let w=0;w<o.length;w++){const x=v(o[w]);p+=d[w]?`<mark>${x}</mark>`:x}return{oldHtml:b,newHtml:p}},yn=(e,t)=>{const n=e.length,r=t.length,o=Array(n+1).fill(0).map(()=>Array(r+1).fill(0));for(let d=1;d<=n;d++)for(let g=1;g<=r;g++)e[d-1]===t[g-1]?o[d][g]=o[d-1][g-1]+1:o[d][g]=Math.max(o[d-1][g],o[d][g-1]);const i=[];let l=n,a=r;const u=[];for(;l>0||a>0;)l>0&&a>0&&e[l-1]===t[a-1]?(u.unshift({type:"unchanged",line:e[l-1],oldLineNo:l,newLineNo:a}),l--,a--):a>0&&(l===0||o[l][a-1]>=o[l-1][a])?(u.unshift({type:"added",line:t[a-1],newLineNo:a}),a--):l>0&&(u.unshift({type:"removed",line:e[l-1],oldLineNo:l}),l--);for(let d=0;d<u.length;d++){const g=u[d],f=u[d+1];if(g.type==="removed"&&f?.type==="added"){const v=Mt(g.line,f.line);i.push({type:"modified",line:g.line,oldLineNo:g.oldLineNo,newLineNo:f.newLineNo,oldHtml:v.oldHtml,newHtml:v.newHtml}),d++}else i.push(g)}return i},Bt=async(e,t,n,r,o,i,l,a)=>{const u=n.split(`
3
3
  `),d=r.split(`
4
4
  `),g=o.split(`
5
- `),m=_=>_.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),v=Sn(u,d),b=Sn(u,g);let p="";for(const _ of v){const k=m(_.line);if(_.type==="modified"){const P=_.oldLineNo?String(_.oldLineNo).padStart(4," "):" ",O=_.newLineNo?String(_.newLineNo).padStart(4," "):" ";p+=`<div class="line removed"><span class="line-num">${P}</span><span class="prefix">- </span>${_.oldHtml}</div>
5
+ `),f=_=>_.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),v=yn(u,d),b=yn(u,g);let p="";for(const _ of v){const k=f(_.line);if(_.type==="modified"){const P=_.oldLineNo?String(_.oldLineNo).padStart(4," "):" ",O=_.newLineNo?String(_.newLineNo).padStart(4," "):" ";p+=`<div class="line removed"><span class="line-num">${P}</span><span class="prefix">- </span>${_.oldHtml}</div>
6
6
  `,p+=`<div class="line added"><span class="line-num">${O}</span><span class="prefix">+ </span>${_.newHtml}</div>
7
7
  `}else if(_.type==="removed"){const P=_.oldLineNo?String(_.oldLineNo).padStart(4," "):" ";p+=`<div class="line removed"><span class="line-num">${P}</span><span class="prefix">- </span>${k}</div>
8
8
  `}else if(_.type==="added"){const P=_.newLineNo?String(_.newLineNo).padStart(4," "):" ";p+=`<div class="line added"><span class="line-num">${P}</span><span class="prefix">+ </span>${k}</div>
9
9
  `}else{const P=_.oldLineNo?String(_.oldLineNo).padStart(4," "):" ",O=_.newLineNo?String(_.newLineNo).padStart(4," "):" ";p+=`<div class="line unchanged"><span class="line-num">${P} ${O}</span><span class="prefix"> </span>${k}</div>
10
- `}}let w="";for(const _ of b){const k=m(_.line);if(_.type==="modified"){const P=_.oldLineNo?String(_.oldLineNo).padStart(4," "):" ",O=_.newLineNo?String(_.newLineNo).padStart(4," "):" ";w+=`<div class="line removed"><span class="line-num">${P}</span><span class="prefix">- </span>${_.oldHtml}</div>
10
+ `}}let w="";for(const _ of b){const k=f(_.line);if(_.type==="modified"){const P=_.oldLineNo?String(_.oldLineNo).padStart(4," "):" ",O=_.newLineNo?String(_.newLineNo).padStart(4," "):" ";w+=`<div class="line removed"><span class="line-num">${P}</span><span class="prefix">- </span>${_.oldHtml}</div>
11
11
  `,w+=`<div class="line added"><span class="line-num">${O}</span><span class="prefix">+ </span>${_.newHtml}</div>
12
12
  `}else if(_.type==="removed"){const P=_.oldLineNo?String(_.oldLineNo).padStart(4," "):" ";w+=`<div class="line removed"><span class="line-num">${P}</span><span class="prefix">- </span>${k}</div>
13
13
  `}else if(_.type==="added"){const P=_.newLineNo?String(_.newLineNo).padStart(4," "):" ";w+=`<div class="line added"><span class="line-num">${P}</span><span class="prefix">+ </span>${k}</div>
@@ -16,7 +16,7 @@ import{Box as f,Text as c,render as ot,useInput as de}from"ink";import{Command a
16
16
  <html>
17
17
  <head>
18
18
  <meta charset="UTF-8">
19
- <title>Diff: ${m(t)} (${m(e)})</title>
19
+ <title>Diff: ${f(t)} (${f(e)})</title>
20
20
  <style>
21
21
  body {
22
22
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
@@ -143,52 +143,52 @@ import{Box as f,Text as c,render as ot,useInput as de}from"ink";import{Command a
143
143
  </head>
144
144
  <body>
145
145
  <div class="header">
146
- <h1>${m(t)}</h1>
146
+ <h1>${f(t)}</h1>
147
147
  <div class="version-info">
148
- <strong>Old Version:</strong> ${m(i)} →
149
- <strong>New Version:</strong> ${m(l)}
148
+ <strong>Old Version:</strong> ${f(i)} →
149
+ <strong>New Version:</strong> ${f(l)}
150
150
  </div>
151
151
  </div>
152
152
 
153
153
  <div class="warning">
154
154
  <strong>⚠️ Version Mismatch Warning</strong><br>
155
- Your customized prompt file is based on version ${m(i)},
156
- but Claude Code is now using version ${m(l)}.
155
+ Your customized prompt file is based on version ${f(i)},
156
+ but Claude Code is now using version ${f(l)}.
157
157
  Review the differences below to understand both your customizations and the upstream changes.<br><br>
158
- <strong>File:</strong> <code>${m(a)}</code><br><br>
159
- When you're done reviewing, update the <code>ccVersion</code> in the file to <strong>${m(l)}</strong>.
158
+ <strong>File:</strong> <code>${f(a)}</code><br><br>
159
+ When you're done reviewing, update the <code>ccVersion</code> in the file to <strong>${f(l)}</strong>.
160
160
  </div>
161
161
 
162
162
  <div class="diff-panels">
163
163
  <div class="diff-container">
164
- <div class="diff-header">Your Customizations (v${m(i)} → User)</div>
164
+ <div class="diff-header">Your Customizations (v${f(i)} → User)</div>
165
165
  <div class="diff-content">
166
166
  ${p} </div>
167
167
  </div>
168
168
 
169
169
  <div class="diff-container">
170
- <div class="diff-header">Upstream Changes (v${m(i)} → v${m(l)})</div>
170
+ <div class="diff-header">Upstream Changes (v${f(i)} → v${f(l)})</div>
171
171
  <div class="diff-content">
172
172
  ${w} </div>
173
173
  </div>
174
174
  </div>
175
175
  </body>
176
- </html>`,C=re.join(ye,`${e}.diff.html`);return await te.writeFile(C,x,"utf-8"),C},Nt=async e=>{const t={id:e.id,name:e.name,description:e.description,action:"skipped",newVersion:e.version};if(!await Ct(e.id)){const o=xn(e);return await Qe(e.id,o),t.action="created",t}const r=await Et(e.id);if(t.oldVersion=r.ccVersion,await kt(e.id,e.identifierMap),r.ccVersion&&e.version){const o=It(r.ccVersion,e.version);if(o===0)return t.action="skipped",t;if(o!=0){const i=await yt(e.id,r.ccVersion),l=Ye(r.content);if(!i||i!==l){t.action="conflict";let u=r.content;try{const b=(await nn(r.ccVersion)).prompts.find(p=>p.id===e.id);b&&(u=De(b.pieces,b.identifiers,b.identifierMap))}catch{console.log(Q.yellow(`Warning: Could not fetch old version ${r.ccVersion} for comparison. Using current file as baseline.`))}const d=De(e.pieces,e.identifiers,e.identifierMap),g=Re(e.id),m=await Bt(e.id,e.name,u,r.content,d,r.ccVersion,e.version,g);t.diffHtmlPath=m}else{const u=xn(e);await Qe(e.id,u),t.action="updated"}}}return t},Ot=async e=>{const t={ccVersion:e,results:[]},n=await nn(e);await St(n),await te.mkdir(ye,{recursive:!0});for(const r of n.prompts)try{const o=await Nt(r);t.results.push(o)}catch(o){throw console.log(Q.red(`Failed to sync prompt ${r.id}:`)),o}return t};let Ge=null,en=null;const yn=async e=>{try{return Ge=await nn(e),en=e,{success:!0}}catch(t){return Ge=null,en=null,t instanceof Error?{success:!1,errorMessage:t.message}:{success:!1,errorMessage:"Unknown error occurred while downloading system prompts"}}},Tt=e=>e.replace(/[^\x00-\x7F]/g,t=>{const r=`\\\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`;return`(?:${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}|${r})`}),At=e=>e.replace(/[^\x00-\x7F]/g,t=>`\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`),Pt=(e,t)=>{let n="";for(let r=0;r<e.length;r++){const i=e[r].replace(/<<CCVERSION>>/g,t).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=Tt(i);n+=l,r<e.length-1&&(n+="([\\w$]+)")}return n},Lt=(e,t,n,r,o,i=!1)=>{const l={};for(let d=0;d<r.length;d++){const g=r[d],m=String(t[d]),v=n[m];v&&(l[v]=g)}let a=e;const u=Object.entries(l).sort((d,g)=>g[0].length-d[0].length);for(const[d,g]of u){const m=new RegExp(`\\b${d}\\b`,"g");a=a.replace(m,g)}return a=a.replace(/<<CCVERSION>>/g,o),i&&(a=At(a)),a},Dt=async(e,t=!1)=>{if(!Ge||en!==e)return[];const n=Ge,r=[];for(const o of n.prompts){const i=Pt(o.pieces,e),l=re.join(ye,`${o.id}.md`);let a;try{a=await te.readFile(l,"utf8")}catch(g){console.error(`Failed to read markdown file ${l}:`,g);continue}const u=Ln(a),d=g=>{const m=g.slice(1);return Lt(u.content,o.identifiers,o.identifierMap,m,e,t)};r.push({promptId:o.id,prompt:u,regex:i,getInterpolatedContent:d,pieces:o.pieces,identifiers:o.identifiers,identifierMap:o.identifierMap})}return r},Rt=e=>{const t=e.results.filter(i=>i.action==="created"),n=e.results.filter(i=>i.action==="updated"),r=e.results.filter(i=>i.action==="conflict"),o=e.results.filter(i=>i.action==="skipped");if((t.length>0||n.length>0||r.length>0)&&o.length>0&&(console.log(Q.dim(`Skipped ${o.length} up-to-date file(s)`)),console.log()),t.length>0){console.log(Q.bold.green(`Created ${t.length} new prompt file(s):`));for(const i of t)console.log(Q.green(` ${ye}/${i.id}.md`)),console.log(Q.green.dim(` ${i.description}`));console.log()}if(n.length>0){console.log(Q.bold.blue(`Updated ${n.length} system prompt file(s):`));for(const i of n)i.oldVersion?console.log(Q.blue(` ${i.id}.md (${i.oldVersion} → ${i.newVersion})`)):console.log(Q.blue(` ${i.id}.md (→ ${i.newVersion})`));console.log()}if(r.length>0){console.log(Q.bold.yellow(`WARNING: Conflicts detected for ${r.length} system prompt file(s)`));for(const i of r)console.log(Q.yellow(` ${i.id}.md (${i.oldVersion} → ${i.newVersion})`)),console.log(Q.yellow(` Open the diff in your browser: ${i.diffHtmlPath}`));console.log()}if(t.length>0&&(console.log(Q.green.bold("New prompt files have been created; either more are now supported by tweakcc or Anthropic has added new ones.")),console.log(Q.green(`You can now customize the markdown files at ${ye} in a text editor.`)),console.log(Q.green('Then run tweakcc and select "apply" or use tweakcc --apply to update your system prompts')),console.log()),r.length>0){console.log(),console.log("Review conflicts:"),console.log(" 1. Open the diff HTML files in your browser"),console.log(" 2. Verify your customizations are still appropriate"),console.log(" 3. Update your markdown files if needed"),console.log(Q.bold.cyan(" 4. Important: Update the ccVersion in your markdown files to the latest version of each prompt:"));for(const i of r)console.log(Q.yellow(` ${i.id}.md → `)+Q.bold.magenta(i.newVersion));console.log(" 5. Delete the diff HTML files"),console.log()}},se=Buffer.from(`
176
+ </html>`,C=re.join(Se,`${e}.diff.html`);return await te.writeFile(C,x,"utf-8"),C},Nt=async e=>{const t={id:e.id,name:e.name,description:e.description,action:"skipped",newVersion:e.version};if(!await Ct(e.id)){const o=xn(e);return await Qe(e.id,o),t.action="created",t}const r=await Et(e.id);if(t.oldVersion=r.ccVersion,await kt(e.id,e.identifierMap),r.ccVersion&&e.version){const o=It(r.ccVersion,e.version);if(o===0)return t.action="skipped",t;if(o!=0){const i=await St(e.id,r.ccVersion),l=Ye(r.content);if(!i||i!==l){t.action="conflict";let u=r.content;try{const b=(await nn(r.ccVersion)).prompts.find(p=>p.id===e.id);b&&(u=Re(b.pieces,b.identifiers,b.identifierMap))}catch{console.log(Q.yellow(`Warning: Could not fetch old version ${r.ccVersion} for comparison. Using current file as baseline.`))}const d=Re(e.pieces,e.identifiers,e.identifierMap),g=Fe(e.id),f=await Bt(e.id,e.name,u,r.content,d,r.ccVersion,e.version,g);t.diffHtmlPath=f}else{const u=xn(e);await Qe(e.id,u),t.action="updated"}}}return t},Ot=async e=>{const t={ccVersion:e,results:[]},n=await nn(e);await yt(n),await te.mkdir(Se,{recursive:!0});for(const r of n.prompts)try{const o=await Nt(r);t.results.push(o)}catch(o){throw console.log(Q.red(`Failed to sync prompt ${r.id}:`)),o}return t};let Ge=null,en=null;const Sn=async e=>{try{return Ge=await nn(e),en=e,{success:!0}}catch(t){return Ge=null,en=null,t instanceof Error?{success:!1,errorMessage:t.message}:{success:!1,errorMessage:"Unknown error occurred while downloading system prompts"}}},Tt=e=>e.replace(/[^\x00-\x7F]/g,t=>{const r=`\\\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`;return`(?:${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}|${r})`}),At=e=>e.replace(/[^\x00-\x7F]/g,t=>`\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`),Pt=(e,t)=>{let n="";for(let r=0;r<e.length;r++){const i=e[r].replace(/<<CCVERSION>>/g,t).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=Tt(i);n+=l,r<e.length-1&&(n+="([\\w$]+)")}return n},Lt=(e,t,n,r,o,i=!1)=>{const l={};for(let d=0;d<r.length;d++){const g=r[d],f=String(t[d]),v=n[f];v&&(l[v]=g)}let a=e;const u=Object.entries(l).sort((d,g)=>g[0].length-d[0].length);for(const[d,g]of u){const f=new RegExp(`\\b${d}\\b`,"g");a=a.replace(f,g)}return a=a.replace(/<<CCVERSION>>/g,o),i&&(a=At(a)),a},Dt=async(e,t=!1)=>{if(!Ge||en!==e)return[];const n=Ge,r=[];for(const o of n.prompts){const i=Pt(o.pieces,e),l=re.join(Se,`${o.id}.md`);let a;try{a=await te.readFile(l,"utf8")}catch(g){console.error(`Failed to read markdown file ${l}:`,g);continue}const u=Ln(a),d=g=>{const f=g.slice(1);return Lt(u.content,o.identifiers,o.identifierMap,f,e,t)};r.push({promptId:o.id,prompt:u,regex:i,getInterpolatedContent:d,pieces:o.pieces,identifiers:o.identifiers,identifierMap:o.identifierMap})}return r},Rt=e=>{const t=e.results.filter(i=>i.action==="created"),n=e.results.filter(i=>i.action==="updated"),r=e.results.filter(i=>i.action==="conflict"),o=e.results.filter(i=>i.action==="skipped");if((t.length>0||n.length>0||r.length>0)&&o.length>0&&(console.log(Q.dim(`Skipped ${o.length} up-to-date file(s)`)),console.log()),t.length>0){console.log(Q.bold.green(`Created ${t.length} new prompt file(s):`));for(const i of t)console.log(Q.green(` ${Se}/${i.id}.md`)),console.log(Q.green.dim(` ${i.description}`));console.log()}if(n.length>0){console.log(Q.bold.blue(`Updated ${n.length} system prompt file(s):`));for(const i of n)i.oldVersion?console.log(Q.blue(` ${i.id}.md (${i.oldVersion} → ${i.newVersion})`)):console.log(Q.blue(` ${i.id}.md (→ ${i.newVersion})`));console.log()}if(r.length>0){console.log(Q.bold.yellow(`WARNING: Conflicts detected for ${r.length} system prompt file(s)`));for(const i of r)console.log(Q.yellow(` ${i.id}.md (${i.oldVersion} → ${i.newVersion})`)),console.log(Q.yellow(` Open the diff in your browser: ${i.diffHtmlPath}`));console.log()}if(t.length>0&&(console.log(Q.green.bold("New prompt files have been created; either more are now supported by tweakcc or Anthropic has added new ones.")),console.log(Q.green(`You can now customize the markdown files at ${Se} in a text editor.`)),console.log(Q.green('Then run tweakcc and select "apply" or use tweakcc --apply to update your system prompts')),console.log()),r.length>0){console.log(),console.log("Review conflicts:"),console.log(" 1. Open the diff HTML files in your browser"),console.log(" 2. Verify your customizations are still appropriate"),console.log(" 3. Update your markdown files if needed"),console.log(Q.bold.cyan(" 4. Important: Update the ccVersion in your markdown files to the latest version of each prompt:"));for(const i of r)console.log(Q.yellow(` ${i.id}.md → `)+Q.bold.magenta(i.newVersion));console.log(" 5. Delete the diff HTML files"),console.log()}},se=Buffer.from(`
177
177
  ---- Bun! ----
178
- `),Ie=32,Ft=8,ze=4*Ft+4;function ve(e,t){return e.subarray(t.offset,t.offset+t.length)}function Me(e,t){return{offset:e.readUInt32LE(t),length:e.readUInt32LE(t+4)}}function Dn(e){return e.endsWith("/claude")||e==="claude"||e.endsWith("/claude.exe")||e==="claude.exe"}function Rn(e,t,n){const r=ve(e,t.modulesPtr),o=Math.floor(r.length/ze);for(let i=0;i<o;i++){const l=i*ze,a=Vt(r,l),u=ve(e,a.name).toString("utf-8"),d=n(a,u,i);if(d!==void 0)return d}}function Fn(e){let t=0;const n=e.readBigUInt64LE(t);t+=8;const r=Me(e,t);t+=8;const o=e.readUInt32LE(t);t+=4;const i=Me(e,t);return{byteCount:n,modulesPtr:r,entryPointId:o,compileExecArgvPtr:i}}function Vt(e,t){let n=t;const r=Me(e,n);n+=8;const o=Me(e,n);n+=8;const i=Me(e,n);n+=8;const l=Me(e,n);n+=8;const a=e.readUInt8(n);n+=1;const u=e.readUInt8(n);n+=1;const d=e.readUInt8(n);n+=1;const g=e.readUInt8(n);return{name:r,contents:o,sourcemap:i,bytecode:l,encoding:a,loader:u,moduleFormat:d,side:g}}function Ut(e){if(e.length<Ie+se.length)throw new Error("BUN data is too small to contain trailer and offsets");const t=e.length-se.length,n=e.subarray(t);if(M()&&(console.log(`parseBunDataBlob: Expected trailer: ${se.toString("hex")}`),console.log(`parseBunDataBlob: Got trailer: ${n.toString("hex")}`)),!n.equals(se))throw M()&&(console.log(`Expected: ${se.toString("hex")}`),console.log(`Got: ${n.toString("hex")}`)),new Error("BUN trailer bytes do not match trailer");const r=e.length-Ie-se.length,o=e.subarray(r,r+Ie);return{bunOffsets:Fn(o),bunData:e}}function Vn(e){if(e.length<4)throw new Error("Section data too small");M()&&console.log(`extractBunDataFromSection: sectionData.length=${e.length}`);const t=e.readUInt32LE(0);M()&&console.log(`extractBunDataFromSection: bunDataSize from header=${t}`);const n=e.subarray(4,4+t);M()&&console.log(`extractBunDataFromSection: bunDataContent.length=${n.length}`);const{bunOffsets:r,bunData:o}=Ut(n);return{bunOffsets:r,bunData:o}}function jt(e){if(!e.hasOverlay)throw new Error("ELF binary has no overlay data");const t=e.overlay;if(M()&&console.log(`extractBunDataFromELFOverlay: Overlay size=${t.length} bytes`),t.length<se.length+8+Ie)throw new Error("ELF overlay data is too small");const n=t.readBigUInt64LE(t.length-8);if(M()&&console.log(`extractBunDataFromELFOverlay: Total byte count from tail=${n}`),n<4096n||n>2n**32n-1n)throw new Error(`ELF total byte count is out of range: ${n}`);const r=t.length-8-se.length,o=t.subarray(r,t.length-8);if(M()&&(console.log(`extractBunDataFromELFOverlay: Expected trailer: ${se.toString("hex")}`),console.log(`extractBunDataFromELFOverlay: Got trailer: ${o.toString("hex")}`)),!o.equals(se))throw new Error("BUN trailer bytes do not match trailer");const i=t.length-8-se.length-Ie,l=t.subarray(i,t.length-8-se.length),a=Fn(l);M()&&console.log(`extractBunDataFromELFOverlay: Offsets.byteCount=${a.byteCount}`);const u=typeof a.byteCount=="bigint"?a.byteCount:BigInt(a.byteCount);if(u>=n)throw new Error("ELF total byte count is out of range");const d=8+se.length+Ie,g=t.length-d-Number(u),m=t.subarray(g,t.length-d);M()&&console.log(`extractBunDataFromELFOverlay: Extracted ${m.length} bytes of data`);const v=Buffer.concat([m,l,o]);return{bunOffsets:a,bunData:v}}function Ht(e){const t=e.getSegment("__BUN");if(!t)throw new Error("__BUN segment not found");const n=t.getSection("__bun");if(!n)throw new Error("__bun section not found");return Vn(n.content)}function Gt(e){const t=e.sections().find(n=>n.name===".bun");if(!t)throw new Error(".bun section not found");return Vn(t.content)}function Un(e){switch(M()&&console.log(`getBunData: Binary format detected as ${e.format}`),e.format){case"MachO":return Ht(e);case"PE":return Gt(e);case"ELF":return jt(e);default:throw new Error(`Unsupported binary format: ${e.format}`)}}function jn(e){try{He.logging.disable();const t=He.parse(e),{bunOffsets:n,bunData:r}=Un(t);M()&&console.log(`extractClaudeJsFromNativeInstallation: Got bunData, size=${r.length} bytes`);const o=Rn(r,n,(i,l,a)=>{if(M()&&console.log(`extractClaudeJsFromNativeInstallation: Module ${a}: ${l}`),!Dn(l))return;const u=ve(r,i.contents);return M()&&console.log(`extractClaudeJsFromNativeInstallation: Found claude module, contents length=${u.length}`),u.length>0?u:void 0});return o||(M()&&console.log("extractClaudeJsFromNativeInstallation: claude module not found in any module"),null)}catch(t){return M()&&console.log("extractClaudeJsFromNativeInstallation: Error during extraction:",t),null}}function zt(e,t,n){const r=[],o=[];Rn(e,t,(k,P)=>{const O=ve(e,k.name);let V;n&&Dn(P)?V=n:V=ve(e,k.contents);const K=ve(e,k.sourcemap),U=ve(e,k.bytecode);o.push({name:O,contents:V,sourcemap:K,bytecode:U,encoding:k.encoding,loader:k.loader,moduleFormat:k.moduleFormat,side:k.side}),r.push(O,V,K,U)});let i=0;const l=[];for(const k of r)l.push({offset:i,length:k.length}),i+=k.length+1;const a=i,u=o.length*ze;i+=u;const d=ve(e,t.compileExecArgvPtr),g=i,m=d.length;i+=m+1;const v=i;i+=Ie;const b=i;i+=se.length;const p=Buffer.allocUnsafe(i);p.fill(0);let w=0;for(const{offset:k,length:P}of l)P>0&&r[w].copy(p,k,0,P),p[k+P]=0,w++;m>0&&(d.copy(p,g,0,m),p[g+m]=0);for(let k=0;k<o.length;k++){const P=o[k],O=k*4,V={name:{offset:l[O].offset,length:l[O].length},contents:{offset:l[O+1].offset,length:l[O+1].length},sourcemap:{offset:l[O+2].offset,length:l[O+2].length},bytecode:{offset:l[O+3].offset,length:l[O+3].length},encoding:P.encoding,loader:P.loader,moduleFormat:P.moduleFormat,side:P.side};let U=a+k*ze;p.writeUInt32LE(V.name.offset,U),p.writeUInt32LE(V.name.length,U+4),U+=8,p.writeUInt32LE(V.contents.offset,U),p.writeUInt32LE(V.contents.length,U+4),U+=8,p.writeUInt32LE(V.sourcemap.offset,U),p.writeUInt32LE(V.sourcemap.length,U+4),U+=8,p.writeUInt32LE(V.bytecode.offset,U),p.writeUInt32LE(V.bytecode.length,U+4),U+=8,p.writeUInt8(V.encoding,U),p.writeUInt8(V.loader,U+1),p.writeUInt8(V.moduleFormat,U+2),p.writeUInt8(V.side,U+3)}const x={byteCount:v,modulesPtr:{offset:a,length:u},entryPointId:t.entryPointId,compileExecArgvPtr:{offset:g,length:m}};let C=v;const _=typeof x.byteCount=="bigint"?x.byteCount:BigInt(x.byteCount);return p.writeBigUInt64LE(_,C),C+=8,p.writeUInt32LE(x.modulesPtr.offset,C),p.writeUInt32LE(x.modulesPtr.length,C+4),C+=8,p.writeUInt32LE(x.entryPointId,C),C+=4,p.writeUInt32LE(x.compileExecArgvPtr.offset,C),p.writeUInt32LE(x.compileExecArgvPtr.length,C+4),se.copy(p,b),p}function rn(e,t,n,r=!0){const o=t+".tmp";if(e.write(o),r){const i=Ae.statSync(n);Ae.chmodSync(o,i.mode)}try{Ae.renameSync(o,t)}catch(i){try{Ae.existsSync(o)&&Ae.unlinkSync(o)}catch{}throw i instanceof Error&&"code"in i&&(i.code==="ETXTBSY"||i.code==="EBUSY"||i.code==="EPERM")?new Error(`Cannot update the Claude executable while it is running.
179
- Please close all Claude instances and try again.`):i}}function Hn(e){const t=Buffer.allocUnsafe(4+e.length);return t.writeUInt32LE(e.length,0),e.copy(t,4),t}function Yt(e,t,n,r){try{M()&&console.log(`repackMachO: Has code signature: ${e.hasCodeSignature}`),e.hasCodeSignature&&(M()&&console.log("repackMachO: Removing code signature..."),e.removeSignature());const o=e.getSegment("__BUN");if(!o)throw new Error("__BUN segment not found");const i=o.getSection("__bun");if(!i)throw new Error("__bun section not found");const l=Hn(n);M()&&(console.log(`repackMachO: Original section size: ${i.size}`),console.log(`repackMachO: Original segment fileSize: ${o.fileSize}`),console.log(`repackMachO: Original segment virtualSize: ${o.virtualSize}`),console.log(`repackMachO: New data size: ${l.length}`));const a=l.length-Number(i.size);if(a>0){const d=Math.ceil(a/4096)*4096;M()&&(console.log(`repackMachO: Need to expand by ${a} bytes`),console.log(`repackMachO: Rounding up to page-aligned: ${d} bytes`));const g=e.extendSegment(o,d);if(M()&&console.log(`repackMachO: extendSegment returned: ${g}`),!g)throw new Error("Failed to extend __BUN segment");M()&&(console.log(`repackMachO: Section size after extend: ${i.size}`),console.log(`repackMachO: Segment fileSize after extend: ${o.fileSize}`),console.log(`repackMachO: Segment virtualSize after extend: ${o.virtualSize}`))}i.content=l,i.size=BigInt(l.length),M()&&(console.log(`repackMachO: Final section size: ${i.size}`),console.log(`repackMachO: Writing modified binary to ${r}...`)),rn(e,r,t);try{M()&&console.log("repackMachO: Re-signing binary with ad-hoc signature..."),Mn(`codesign -s - -f "${r}"`,{stdio:M()?"inherit":"ignore"}),M()&&console.log("repackMachO: Code signing completed successfully")}catch(u){console.warn("Warning: Failed to re-sign binary. The binary may not run correctly on macOS:",u)}M()&&console.log("repackMachO: Write completed successfully")}catch(o){throw console.error("repackMachO failed:",o),o}}function Wt(e,t,n,r){try{const o=e.sections().find(l=>l.name===".bun");if(!o)throw new Error(".bun section not found");const i=Hn(n);M()&&(console.log(`repackPE: Original section size: ${o.size}, virtual size: ${o.virtualSize}`),console.log(`repackPE: New data size: ${i.length}`)),o.content=i,o.virtualSize=BigInt(i.length),o.size=BigInt(i.length),M()&&console.log(`repackPE: Writing modified binary to ${r}...`),rn(e,r,t,!1),M()&&console.log("repackPE: Write completed successfully")}catch(o){throw console.error("repackPE failed:",o),o}}function Jt(e,t,n,r){try{const o=Buffer.allocUnsafe(n.length+8);n.copy(o,0),o.writeBigUInt64LE(BigInt(n.length),n.length),M()&&console.log(`repackELF: Setting overlay data (${o.length} bytes)`),e.overlay=o,M()&&console.log(`repackELF: Writing modified binary to ${r}...`),rn(e,r,t),M()&&console.log("repackELF: Write completed successfully")}catch(o){throw console.error("repackELF failed:",o),o}}function Kt(e,t,n){He.logging.disable();const r=He.parse(e),{bunOffsets:o,bunData:i}=Un(r),l=zt(i,o,t);switch(r.format){case"MachO":Yt(r,e,l,n);break;case"PE":Wt(r,e,l,n);break;case"ELF":Jt(r,e,l,n);break;default:throw new Error(`Unsupported binary format: ${r.format}`)}}const on=async()=>{await le.mkdir(ce,{recursive:!0}),await le.mkdir(ye,{recursive:!0});const e=kn.join(ce,".gitignore");try{await le.stat(e)}catch(t){t instanceof Error&&"code"in t&&t.code==="ENOENT"&&await le.writeFile(e,[".DS_Store","prompt-data-cache","cli.js.backup","native-binary.backup","native-claudejs-orig.js","native-claudejs-patched.js","systemPromptAppliedHashes.json","systemPromptOriginalHashes.json","system-prompts"].join(fn)+fn)}};let Le={settings:Z,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const sn=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:Z};try{M()&&console.log(`Reading config at ${fe}`);const t=await le.readFile(fe,"utf8"),n={...e,...JSON.parse(t)},r=n?.settings?.thinkingVerbs;r?.punctuation&&(r.format="{}"+r.punctuation,delete r.punctuation),n.settings.inputBox||(n.settings.inputBox=Z.inputBox),n.settings.toolsets||(n.settings.toolsets=Z.toolsets),Object.hasOwn(n.settings,"defaultToolset")||(n.settings.defaultToolset=Z.defaultToolset);for(const i of Z.themes){const l=n?.settings?.themes.find(a=>a.id===i.id||a.name===i.name);if(l){for(const[a,u]of Object.entries(i))a!=="colors"&&!Object.hasOwn(l,a)&&(l[a]=u);l.colors||(l.colors={});for(const[a,u]of Object.entries(i.colors))Object.hasOwn(l.colors,a)||(l.colors[a]=u)}}for(const i of n?.settings?.themes||[]){if(Z.themes.some(u=>u.id===i.id||u.name===i.name))continue;const a=Z.themes[0];i.colors||(i.colors={});for(const[u,d]of Object.entries(a.colors))Object.hasOwn(i.colors,u)||(i.colors[u]=d)}return n?.settings?.userMessageDisplay||(n.settings=n.settings||Z,n.settings.userMessageDisplay=Z.userMessageDisplay),delete n.settings.launchText,await _t(ye)&&(n.changesApplied=!1),Le=n,n}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return e;throw t}},Fe=async e=>(M()&&console.log(`Updating config at ${fe}`),e(Le),Le.lastModified=new Date().toISOString(),await qt(Le),Le),qt=async e=>{try{e.lastModified=new Date().toISOString(),await on(),await le.writeFile(fe,JSON.stringify(e,null,2))}catch(t){throw console.error("Error saving config:",t),t}},Gn=async e=>{if(!e.cliPath)return M()&&console.log("restoreClijsFromBackup: Skipping for native installation (no cliPath)"),!1;M()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);const t=await le.readFile(Ne);return await un(e.cliPath,t,"restore"),await $t(),await Fe(n=>{n.changesApplied=!1}),!0},Xt=async e=>{if(!e.nativeInstallationPath)return M()&&console.log("restoreNativeBinaryFromBackup: No native installation path, skipping"),!1;if(!await Ce(ae))return M()&&console.log("restoreNativeBinaryFromBackup: No backup file exists, skipping"),!1;M()&&console.log(`Restoring native binary from backup to ${e.nativeInstallationPath}`);const t=await le.readFile(ae);return await un(e.nativeInstallationPath,t,"restore"),!0};async function Zt(){try{const t=process.platform==="win32"?"where claude.exe":"which claude";M()&&console.log(`Looking for claude executable using: ${t}`);const r=Mn(t,{encoding:"utf8"}).trim().split(`
180
- `)[0].trim();if(r&&await Ce(r))try{const o=await le.realpath(r);return M()&&(o!==r?(console.log(`Found claude executable at: ${r} (symlink)`),console.log(`Resolved to: ${o}`)):console.log(`Found claude executable at: ${r}`)),o}catch(o){return M()&&console.log("Could not resolve symlink, using original path:",o),r}}catch(e){M()&&console.log("Could not find claude executable on PATH:",e)}return null}function zn(e){const t=/\bVERSION:"(\d+\.\d+\.\d+)"/g,n=new Map;let r;for(;(r=t.exec(e))!==null;){const l=r[1];n.set(l,(n.get(l)||0)+1)}if(n.size===0)return null;let o=0,i;for(const[l,a]of n.entries())M()&&console.log(`Found version ${l} with ${a} occurrences`),a>o&&(o=a,i=l);return M()&&i&&console.log(`Extracted version ${i} (${o} occurrences)`),i||null}async function Ce(e){try{return await le.stat(e),!0}catch(t){if(t instanceof Error&&"code"in t&&(t.code==="ENOENT"||t.code==="ENOTDIR"))return!1;throw t}}async function Qt(e){const t=await le.readFile(e,"utf8"),n=zn(t);if(!n)throw new Error(`No VERSION strings found in JS file: ${e}`);return n}const er=async e=>{e.ccInstallationDir&&pn.unshift(e.ccInstallationDir);for(const n of pn)try{M()&&console.log(`Searching for Claude Code cli.js file at ${n}`);const r=kn.join(n,"cli.js");if(!await Ce(r))continue;M()&&(console.log(`Found Claude Code cli.js file at ${n}; checking hash...`),console.log(`SHA256 hash: ${await ao(r)}`));const o=await Qt(r);return{cliPath:r,version:o}}catch(r){if(r instanceof Error&&"code"in r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))continue;throw r}M()&&console.log("Could not find cli.js in standard locations, trying native installation method...");const t=await Zt();if(M()&&console.log(`findClaudeExecutableOnPath() returned: ${t}`),t){const n=await Ce(ae),r=n?ae:t;M()&&console.log(`Attempting to extract claude.js from ${n?"backup":"native installation"}: ${r}`);const o=jn(r);if(o){const i=o.toString("utf8"),l=zn(i);return l?(M()&&console.log(`Extracted version ${l} from native installation`),{version:l,nativeInstallationPath:t}):(M()&&console.log("Failed to extract version from native installation"),null)}}return null},vn=async e=>{if(!e.cliPath){M()&&console.log("backupClijs: Skipping for native installation (no cliPath)");return}await on(),M()&&console.log(`Backing up cli.js to ${Ne}`),await le.copyFile(e.cliPath,Ne),await Fe(t=>{t.changesApplied=!1,t.ccVersion=e.version})},$n=async e=>{e.nativeInstallationPath&&(await on(),M()&&console.log(`Backing up native binary to ${ae}`),await le.copyFile(e.nativeInstallationPath,ae),await Fe(t=>{t.changesApplied=!1,t.ccVersion=e.version}))};async function _n(){const e=await sn(),t=await er(e);if(!t)return null;if(t.version)try{const l=await Ot(t.version);Rt(l)}catch{}const n=t.version,r=e.ccVersion;let o=!1;await Ce(Ne)||(M()&&console.log(`startupCheck: ${Ne} not found; backing up cli.js`),await vn(t),o=!0);let i=!1;return t.nativeInstallationPath&&!await Ce(ae)&&(M()&&console.log(`startupCheck: ${ae} not found; backing up native binary`),await $n(t),i=!0),n!==r?(o||(M()&&console.log(`startupCheck: real version (${n}) != backed up version (${r}); backing up cli.js`),await le.unlink(Ne),await vn(t)),t.nativeInstallationPath&&!i&&(M()&&console.log(`startupCheck: real version (${n}) != backed up version (${r}); backing up native binary`),await Ce(ae)&&await le.unlink(ae),await $n(t)),{wasUpdated:!0,oldVersion:r,newVersion:n,ccInstInfo:t}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}}const nr=e=>{const t=[],n=/visibleOptionCount:[\w$]+=(\d+)/g;let r;for(;(r=n.exec(e))!==null;){const o=r.index+r[0].indexOf("=")+1;t.push({startIndex:o,endIndex:o+r[1].length})}return t},tr=(e,t)=>{const n=nr(e);if(n.length===0)return console.error("patch: writeShowMoreItemsInSelectMenus: failed to find locations"),null;const r=n.sort((i,l)=>l.startIndex-i.startIndex);let o=e;for(const i of r){const l=t.toString(),a=o.slice(0,i.startIndex)+l+o.slice(i.endIndex);G(o,a,l,i.startIndex,i.endIndex),o=a}return o};function rr(e){const t=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,n=e.match(t);if(!n||n.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const r=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,o=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,i=e.match(r),l=e.match(o);return!i||i.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!l||l.index==null?(console.error("patch: themes: failed to find objMatch"),null):{switchStatement:{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1].trim()]},objArr:{startIndex:i.index,endIndex:i.index+i[0].length},obj:{startIndex:l.index,endIndex:l.index+l[0].length}}}const or=(e,t)=>{const n=rr(e);if(!n)return null;if(t.length===0)return e;let r=e;const o="return"+JSON.stringify(Object.fromEntries(t.map(a=>[a.id,a.name])));r=r.slice(0,n.obj.startIndex)+o+r.slice(n.obj.endIndex),G(e,r,o,n.obj.startIndex,n.obj.endIndex),e=r;const i=JSON.stringify(t.map(a=>({label:a.name,value:a.id})));r=r.slice(0,n.objArr.startIndex)+i+r.slice(n.objArr.endIndex),G(e,r,i,n.objArr.startIndex,n.objArr.endIndex),e=r;let l=`switch(${n.switchStatement.identifiers?.[0]}){
178
+ `),Ie=32,Ft=8,ze=4*Ft+4;function ve(e,t){return e.subarray(t.offset,t.offset+t.length)}function Me(e,t){return{offset:e.readUInt32LE(t),length:e.readUInt32LE(t+4)}}function Dn(e){return e.endsWith("/claude")||e==="claude"||e.endsWith("/claude.exe")||e==="claude.exe"}function Rn(e,t,n){const r=ve(e,t.modulesPtr),o=Math.floor(r.length/ze);for(let i=0;i<o;i++){const l=i*ze,a=Vt(r,l),u=ve(e,a.name).toString("utf-8"),d=n(a,u,i);if(d!==void 0)return d}}function Fn(e){let t=0;const n=e.readBigUInt64LE(t);t+=8;const r=Me(e,t);t+=8;const o=e.readUInt32LE(t);t+=4;const i=Me(e,t);return{byteCount:n,modulesPtr:r,entryPointId:o,compileExecArgvPtr:i}}function Vt(e,t){let n=t;const r=Me(e,n);n+=8;const o=Me(e,n);n+=8;const i=Me(e,n);n+=8;const l=Me(e,n);n+=8;const a=e.readUInt8(n);n+=1;const u=e.readUInt8(n);n+=1;const d=e.readUInt8(n);n+=1;const g=e.readUInt8(n);return{name:r,contents:o,sourcemap:i,bytecode:l,encoding:a,loader:u,moduleFormat:d,side:g}}function Ut(e){if(e.length<Ie+se.length)throw new Error("BUN data is too small to contain trailer and offsets");const t=e.length-se.length,n=e.subarray(t);if(M()&&(console.log(`parseBunDataBlob: Expected trailer: ${se.toString("hex")}`),console.log(`parseBunDataBlob: Got trailer: ${n.toString("hex")}`)),!n.equals(se))throw M()&&(console.log(`Expected: ${se.toString("hex")}`),console.log(`Got: ${n.toString("hex")}`)),new Error("BUN trailer bytes do not match trailer");const r=e.length-Ie-se.length,o=e.subarray(r,r+Ie);return{bunOffsets:Fn(o),bunData:e}}function Vn(e){if(e.length<4)throw new Error("Section data too small");M()&&console.log(`extractBunDataFromSection: sectionData.length=${e.length}`);const t=e.readUInt32LE(0);M()&&console.log(`extractBunDataFromSection: bunDataSize from header=${t}`);const n=e.subarray(4,4+t);M()&&console.log(`extractBunDataFromSection: bunDataContent.length=${n.length}`);const{bunOffsets:r,bunData:o}=Ut(n);return{bunOffsets:r,bunData:o}}function jt(e){if(!e.hasOverlay)throw new Error("ELF binary has no overlay data");const t=e.overlay;if(M()&&console.log(`extractBunDataFromELFOverlay: Overlay size=${t.length} bytes`),t.length<se.length+8+Ie)throw new Error("ELF overlay data is too small");const n=t.readBigUInt64LE(t.length-8);if(M()&&console.log(`extractBunDataFromELFOverlay: Total byte count from tail=${n}`),n<4096n||n>2n**32n-1n)throw new Error(`ELF total byte count is out of range: ${n}`);const r=t.length-8-se.length,o=t.subarray(r,t.length-8);if(M()&&(console.log(`extractBunDataFromELFOverlay: Expected trailer: ${se.toString("hex")}`),console.log(`extractBunDataFromELFOverlay: Got trailer: ${o.toString("hex")}`)),!o.equals(se))throw new Error("BUN trailer bytes do not match trailer");const i=t.length-8-se.length-Ie,l=t.subarray(i,t.length-8-se.length),a=Fn(l);M()&&console.log(`extractBunDataFromELFOverlay: Offsets.byteCount=${a.byteCount}`);const u=typeof a.byteCount=="bigint"?a.byteCount:BigInt(a.byteCount);if(u>=n)throw new Error("ELF total byte count is out of range");const d=8+se.length+Ie,g=t.length-d-Number(u),f=t.subarray(g,t.length-d);M()&&console.log(`extractBunDataFromELFOverlay: Extracted ${f.length} bytes of data`);const v=Buffer.concat([f,l,o]);return{bunOffsets:a,bunData:v}}function Ht(e){const t=e.getSegment("__BUN");if(!t)throw new Error("__BUN segment not found");const n=t.getSection("__bun");if(!n)throw new Error("__bun section not found");return Vn(n.content)}function Gt(e){const t=e.sections().find(n=>n.name===".bun");if(!t)throw new Error(".bun section not found");return Vn(t.content)}function Un(e){switch(M()&&console.log(`getBunData: Binary format detected as ${e.format}`),e.format){case"MachO":return Ht(e);case"PE":return Gt(e);case"ELF":return jt(e);default:throw new Error(`Unsupported binary format: ${e.format}`)}}function jn(e){try{De.logging.disable();const t=De.parse(e),{bunOffsets:n,bunData:r}=Un(t);M()&&console.log(`extractClaudeJsFromNativeInstallation: Got bunData, size=${r.length} bytes`);const o=Rn(r,n,(i,l,a)=>{if(M()&&console.log(`extractClaudeJsFromNativeInstallation: Module ${a}: ${l}`),!Dn(l))return;const u=ve(r,i.contents);return M()&&console.log(`extractClaudeJsFromNativeInstallation: Found claude module, contents length=${u.length}`),u.length>0?u:void 0});return o||(M()&&console.log("extractClaudeJsFromNativeInstallation: claude module not found in any module"),null)}catch(t){return M()&&console.log("extractClaudeJsFromNativeInstallation: Error during extraction:",t),null}}function zt(e,t,n){const r=[],o=[];Rn(e,t,(k,P)=>{const O=ve(e,k.name);let V;n&&Dn(P)?V=n:V=ve(e,k.contents);const K=ve(e,k.sourcemap),U=ve(e,k.bytecode);o.push({name:O,contents:V,sourcemap:K,bytecode:U,encoding:k.encoding,loader:k.loader,moduleFormat:k.moduleFormat,side:k.side}),r.push(O,V,K,U)});let i=0;const l=[];for(const k of r)l.push({offset:i,length:k.length}),i+=k.length+1;const a=i,u=o.length*ze;i+=u;const d=ve(e,t.compileExecArgvPtr),g=i,f=d.length;i+=f+1;const v=i;i+=Ie;const b=i;i+=se.length;const p=Buffer.allocUnsafe(i);p.fill(0);let w=0;for(const{offset:k,length:P}of l)P>0&&r[w].copy(p,k,0,P),p[k+P]=0,w++;f>0&&(d.copy(p,g,0,f),p[g+f]=0);for(let k=0;k<o.length;k++){const P=o[k],O=k*4,V={name:{offset:l[O].offset,length:l[O].length},contents:{offset:l[O+1].offset,length:l[O+1].length},sourcemap:{offset:l[O+2].offset,length:l[O+2].length},bytecode:{offset:l[O+3].offset,length:l[O+3].length},encoding:P.encoding,loader:P.loader,moduleFormat:P.moduleFormat,side:P.side};let U=a+k*ze;p.writeUInt32LE(V.name.offset,U),p.writeUInt32LE(V.name.length,U+4),U+=8,p.writeUInt32LE(V.contents.offset,U),p.writeUInt32LE(V.contents.length,U+4),U+=8,p.writeUInt32LE(V.sourcemap.offset,U),p.writeUInt32LE(V.sourcemap.length,U+4),U+=8,p.writeUInt32LE(V.bytecode.offset,U),p.writeUInt32LE(V.bytecode.length,U+4),U+=8,p.writeUInt8(V.encoding,U),p.writeUInt8(V.loader,U+1),p.writeUInt8(V.moduleFormat,U+2),p.writeUInt8(V.side,U+3)}const x={byteCount:v,modulesPtr:{offset:a,length:u},entryPointId:t.entryPointId,compileExecArgvPtr:{offset:g,length:f}};let C=v;const _=typeof x.byteCount=="bigint"?x.byteCount:BigInt(x.byteCount);return p.writeBigUInt64LE(_,C),C+=8,p.writeUInt32LE(x.modulesPtr.offset,C),p.writeUInt32LE(x.modulesPtr.length,C+4),C+=8,p.writeUInt32LE(x.entryPointId,C),C+=4,p.writeUInt32LE(x.compileExecArgvPtr.offset,C),p.writeUInt32LE(x.compileExecArgvPtr.length,C+4),se.copy(p,b),p}function rn(e,t,n,r=!0){const o=t+".tmp";if(e.write(o),r){const i=Ae.statSync(n);Ae.chmodSync(o,i.mode)}try{Ae.renameSync(o,t)}catch(i){try{Ae.existsSync(o)&&Ae.unlinkSync(o)}catch{}throw i instanceof Error&&"code"in i&&(i.code==="ETXTBSY"||i.code==="EBUSY"||i.code==="EPERM")?new Error(`Cannot update the Claude executable while it is running.
179
+ Please close all Claude instances and try again.`):i}}function Hn(e){const t=Buffer.allocUnsafe(4+e.length);return t.writeUInt32LE(e.length,0),e.copy(t,4),t}function Yt(e,t,n,r){try{M()&&console.log(`repackMachO: Has code signature: ${e.hasCodeSignature}`),e.hasCodeSignature&&(M()&&console.log("repackMachO: Removing code signature..."),e.removeSignature());const o=e.getSegment("__BUN");if(!o)throw new Error("__BUN segment not found");const i=o.getSection("__bun");if(!i)throw new Error("__bun section not found");const l=Hn(n);M()&&(console.log(`repackMachO: Original section size: ${i.size}`),console.log(`repackMachO: Original segment fileSize: ${o.fileSize}`),console.log(`repackMachO: Original segment virtualSize: ${o.virtualSize}`),console.log(`repackMachO: New data size: ${l.length}`));const a=l.length-Number(i.size);if(a>0){const u=e.header.cpuType===De.MachO.Header.CPU_TYPE.ARM64,d=u?16384:4096,g=Math.ceil(a/d)*d;M()&&(console.log(`repackMachO: CPU type: ${u?"ARM64":"x86_64"}`),console.log(`repackMachO: Page size: ${d} bytes`),console.log(`repackMachO: Need to expand by ${a} bytes`),console.log(`repackMachO: Rounding up to page-aligned: ${g} bytes`));const f=e.extendSegment(o,g);if(M()&&console.log(`repackMachO: extendSegment returned: ${f}`),!f)throw new Error("Failed to extend __BUN segment");M()&&(console.log(`repackMachO: Section size after extend: ${i.size}`),console.log(`repackMachO: Segment fileSize after extend: ${o.fileSize}`),console.log(`repackMachO: Segment virtualSize after extend: ${o.virtualSize}`))}i.content=l,i.size=BigInt(l.length),M()&&(console.log(`repackMachO: Final section size: ${i.size}`),console.log(`repackMachO: Writing modified binary to ${r}...`)),rn(e,r,t);try{M()&&console.log("repackMachO: Re-signing binary with ad-hoc signature..."),Mn(`codesign -s - -f "${r}"`,{stdio:M()?"inherit":"ignore"}),M()&&console.log("repackMachO: Code signing completed successfully")}catch(u){console.warn("Warning: Failed to re-sign binary. The binary may not run correctly on macOS:",u)}M()&&console.log("repackMachO: Write completed successfully")}catch(o){throw console.error("repackMachO failed:",o),o}}function Wt(e,t,n,r){try{const o=e.sections().find(l=>l.name===".bun");if(!o)throw new Error(".bun section not found");const i=Hn(n);M()&&(console.log(`repackPE: Original section size: ${o.size}, virtual size: ${o.virtualSize}`),console.log(`repackPE: New data size: ${i.length}`)),o.content=i,o.virtualSize=BigInt(i.length),o.size=BigInt(i.length),M()&&console.log(`repackPE: Writing modified binary to ${r}...`),rn(e,r,t,!1),M()&&console.log("repackPE: Write completed successfully")}catch(o){throw console.error("repackPE failed:",o),o}}function Jt(e,t,n,r){try{const o=Buffer.allocUnsafe(n.length+8);n.copy(o,0),o.writeBigUInt64LE(BigInt(n.length),n.length),M()&&console.log(`repackELF: Setting overlay data (${o.length} bytes)`),e.overlay=o,M()&&console.log(`repackELF: Writing modified binary to ${r}...`),rn(e,r,t),M()&&console.log("repackELF: Write completed successfully")}catch(o){throw console.error("repackELF failed:",o),o}}function Kt(e,t,n){De.logging.disable();const r=De.parse(e),{bunOffsets:o,bunData:i}=Un(r),l=zt(i,o,t);switch(r.format){case"MachO":Yt(r,e,l,n);break;case"PE":Wt(r,e,l,n);break;case"ELF":Jt(r,e,l,n);break;default:throw new Error(`Unsupported binary format: ${r.format}`)}}const on=async()=>{await le.mkdir(ce,{recursive:!0}),await le.mkdir(Se,{recursive:!0});const e=kn.join(ce,".gitignore");try{await le.stat(e)}catch(t){t instanceof Error&&"code"in t&&t.code==="ENOENT"&&await le.writeFile(e,[".DS_Store","prompt-data-cache","cli.js.backup","native-binary.backup","native-claudejs-orig.js","native-claudejs-patched.js","systemPromptAppliedHashes.json","systemPromptOriginalHashes.json","system-prompts"].join(fn)+fn)}};let Le={settings:Z,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const sn=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:Z};try{M()&&console.log(`Reading config at ${fe}`);const t=await le.readFile(fe,"utf8"),n={...e,...JSON.parse(t)},r=n?.settings?.thinkingVerbs;r?.punctuation&&(r.format="{}"+r.punctuation,delete r.punctuation),n.settings.inputBox||(n.settings.inputBox=Z.inputBox),n.settings.toolsets||(n.settings.toolsets=Z.toolsets),Object.hasOwn(n.settings,"defaultToolset")||(n.settings.defaultToolset=Z.defaultToolset);for(const i of Z.themes){const l=n?.settings?.themes.find(a=>a.id===i.id||a.name===i.name);if(l){for(const[a,u]of Object.entries(i))a!=="colors"&&!Object.hasOwn(l,a)&&(l[a]=u);l.colors||(l.colors={});for(const[a,u]of Object.entries(i.colors))Object.hasOwn(l.colors,a)||(l.colors[a]=u)}}for(const i of n?.settings?.themes||[]){if(Z.themes.some(u=>u.id===i.id||u.name===i.name))continue;const a=Z.themes[0];i.colors||(i.colors={});for(const[u,d]of Object.entries(a.colors))Object.hasOwn(i.colors,u)||(i.colors[u]=d)}return n?.settings?.userMessageDisplay||(n.settings=n.settings||Z,n.settings.userMessageDisplay=Z.userMessageDisplay),delete n.settings.launchText,await _t(Se)&&(n.changesApplied=!1),Le=n,n}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return e;throw t}},Ve=async e=>(M()&&console.log(`Updating config at ${fe}`),e(Le),Le.lastModified=new Date().toISOString(),await qt(Le),Le),qt=async e=>{try{e.lastModified=new Date().toISOString(),await on(),await le.writeFile(fe,JSON.stringify(e,null,2))}catch(t){throw console.error("Error saving config:",t),t}},Gn=async e=>{if(!e.cliPath)return M()&&console.log("restoreClijsFromBackup: Skipping for native installation (no cliPath)"),!1;M()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);const t=await le.readFile(Ne);return await un(e.cliPath,t,"restore"),await $t(),await Ve(n=>{n.changesApplied=!1}),!0},Xt=async e=>{if(!e.nativeInstallationPath)return M()&&console.log("restoreNativeBinaryFromBackup: No native installation path, skipping"),!1;if(!await Ce(ae))return M()&&console.log("restoreNativeBinaryFromBackup: No backup file exists, skipping"),!1;M()&&console.log(`Restoring native binary from backup to ${e.nativeInstallationPath}`);const t=await le.readFile(ae);return await un(e.nativeInstallationPath,t,"restore"),!0};async function Zt(){try{const t=process.platform==="win32"?"where claude.exe":"which claude";M()&&console.log(`Looking for claude executable using: ${t}`);const r=Mn(t,{encoding:"utf8"}).trim().split(`
180
+ `)[0].trim();if(r&&await Ce(r))try{const o=await le.realpath(r);return M()&&(o!==r?(console.log(`Found claude executable at: ${r} (symlink)`),console.log(`Resolved to: ${o}`)):console.log(`Found claude executable at: ${r}`)),o}catch(o){return M()&&console.log("Could not resolve symlink, using original path:",o),r}}catch(e){M()&&console.log("Could not find claude executable on PATH:",e)}return null}function zn(e){const t=/\bVERSION:"(\d+\.\d+\.\d+)"/g,n=new Map;let r;for(;(r=t.exec(e))!==null;){const l=r[1];n.set(l,(n.get(l)||0)+1)}if(n.size===0)return null;let o=0,i;for(const[l,a]of n.entries())M()&&console.log(`Found version ${l} with ${a} occurrences`),a>o&&(o=a,i=l);return M()&&i&&console.log(`Extracted version ${i} (${o} occurrences)`),i||null}async function Ce(e){try{return await le.stat(e),!0}catch(t){if(t instanceof Error&&"code"in t&&(t.code==="ENOENT"||t.code==="ENOTDIR"))return!1;throw t}}async function Qt(e){const t=await le.readFile(e,"utf8"),n=zn(t);if(!n)throw new Error(`No VERSION strings found in JS file: ${e}`);return n}const er=async e=>{e.ccInstallationDir&&pn.unshift(e.ccInstallationDir);for(const n of pn)try{M()&&console.log(`Searching for Claude Code cli.js file at ${n}`);const r=kn.join(n,"cli.js");if(!await Ce(r))continue;M()&&(console.log(`Found Claude Code cli.js file at ${n}; checking hash...`),console.log(`SHA256 hash: ${await ao(r)}`));const o=await Qt(r);return{cliPath:r,version:o}}catch(r){if(r instanceof Error&&"code"in r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))continue;throw r}M()&&console.log("Could not find cli.js in standard locations, trying native installation method...");const t=await Zt();if(M()&&console.log(`findClaudeExecutableOnPath() returned: ${t}`),t){const n=await Ce(ae),r=n?ae:t;M()&&console.log(`Attempting to extract claude.js from ${n?"backup":"native installation"}: ${r}`);const o=jn(r);if(o){const i=o.toString("utf8"),l=zn(i);return l?(M()&&console.log(`Extracted version ${l} from native installation`),{version:l,nativeInstallationPath:t}):(M()&&console.log("Failed to extract version from native installation"),null)}}return null},vn=async e=>{if(!e.cliPath){M()&&console.log("backupClijs: Skipping for native installation (no cliPath)");return}await on(),M()&&console.log(`Backing up cli.js to ${Ne}`),await le.copyFile(e.cliPath,Ne),await Ve(t=>{t.changesApplied=!1,t.ccVersion=e.version})},$n=async e=>{e.nativeInstallationPath&&(await on(),M()&&console.log(`Backing up native binary to ${ae}`),await le.copyFile(e.nativeInstallationPath,ae),await Ve(t=>{t.changesApplied=!1,t.ccVersion=e.version}))};async function _n(){const e=await sn(),t=await er(e);if(!t)return null;if(t.version)try{const l=await Ot(t.version);Rt(l)}catch{}const n=t.version,r=e.ccVersion;let o=!1;await Ce(Ne)||(M()&&console.log(`startupCheck: ${Ne} not found; backing up cli.js`),await vn(t),o=!0);let i=!1;return t.nativeInstallationPath&&!await Ce(ae)&&(M()&&console.log(`startupCheck: ${ae} not found; backing up native binary`),await $n(t),i=!0),n!==r?(o||(M()&&console.log(`startupCheck: real version (${n}) != backed up version (${r}); backing up cli.js`),await le.unlink(Ne),await vn(t)),t.nativeInstallationPath&&!i&&(M()&&console.log(`startupCheck: real version (${n}) != backed up version (${r}); backing up native binary`),await Ce(ae)&&await le.unlink(ae),await $n(t)),{wasUpdated:!0,oldVersion:r,newVersion:n,ccInstInfo:t}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}}const nr=e=>{const t=[],n=/visibleOptionCount:[\w$]+=(\d+)/g;let r;for(;(r=n.exec(e))!==null;){const o=r.index+r[0].indexOf("=")+1;t.push({startIndex:o,endIndex:o+r[1].length})}return t},tr=(e,t)=>{const n=nr(e);if(n.length===0)return console.error("patch: writeShowMoreItemsInSelectMenus: failed to find locations"),null;const r=n.sort((i,l)=>l.startIndex-i.startIndex);let o=e;for(const i of r){const l=t.toString(),a=o.slice(0,i.startIndex)+l+o.slice(i.endIndex);G(o,a,l,i.startIndex,i.endIndex),o=a}return o};function rr(e){const t=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,n=e.match(t);if(!n||n.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const r=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,o=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,i=e.match(r),l=e.match(o);return!i||i.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!l||l.index==null?(console.error("patch: themes: failed to find objMatch"),null):{switchStatement:{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1].trim()]},objArr:{startIndex:i.index,endIndex:i.index+i[0].length},obj:{startIndex:l.index,endIndex:l.index+l[0].length}}}const or=(e,t)=>{const n=rr(e);if(!n)return null;if(t.length===0)return e;let r=e;const o="return"+JSON.stringify(Object.fromEntries(t.map(a=>[a.id,a.name])));r=r.slice(0,n.obj.startIndex)+o+r.slice(n.obj.endIndex),G(e,r,o,n.obj.startIndex,n.obj.endIndex),e=r;const i=JSON.stringify(t.map(a=>({label:a.name,value:a.id})));r=r.slice(0,n.objArr.startIndex)+i+r.slice(n.objArr.endIndex),G(e,r,i,n.objArr.startIndex,n.objArr.endIndex),e=r;let l=`switch(${n.switchStatement.identifiers?.[0]}){
181
181
  `;return t.forEach(a=>{l+=`case"${a.id}":return${JSON.stringify(a.colors)};
182
182
  `}),l+=`default:return${JSON.stringify(t[0].colors)};
183
- }`,r=r.slice(0,n.switchStatement.startIndex)+l+r.slice(n.switchStatement.endIndex),G(e,r,l,n.switchStatement.startIndex,n.switchStatement.endIndex),r},ir=e=>{const t=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,n=e.match(t);return!n||n.index===void 0?(console.error("patch: context limit: failed to find match"),null):n.index+n[0].indexOf("{")+1},sr=e=>{const t=ir(e);if(!t)return null;const n="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",r=e.slice(0,t)+n+e.slice(t);return G(e,r,n,t,t),r},lr=e=>{const t=e.indexOf('bash:"bashBorder"');if(t===-1)return console.error("patch: input border: failed to find bash pattern"),null;const n=e.slice(t,t+500),r=/borderStyle:"[^"]*"/,o=n.match(r);return!o||o.index===void 0?(console.error("patch: input border: failed to find border style pattern"),null):{startIndex:t+o.index,endIndex:t+o.index+o[0].length}},ar=(e,t)=>{const n=lr(e);if(!n)return null;if(t){const r="borderColor:undefined",o=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return G(e,o,r,n.startIndex,n.endIndex),o}else return e},cr=e=>{const t=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const r=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,o=n[0].match(r);if(!o||o.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const i=n.index+o.index,l=i+o[0].length;return{startIndex:i,endIndex:l}},dr=e=>{const t=cr(e);if(!t)return null;const n=e.slice(0,t.startIndex)+e.slice(t.endIndex);return G(e,n,"",t.startIndex,t.endIndex),n},ur=e=>{const t=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,n=e.match(t);if(!n||n.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const r=e.slice(n.index,n.index+600),o=/([$\w]+)(=\(([^;]{1,200}?)\)\+"(?:…|\\u2026)")/,i=r.match(o);return!i||i.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:n.index+i.index+i[1].length,endIndex:n.index+i.index+i[1].length+i[2].length,identifiers:[i[3]]}},gr=(e,t)=>{const n=ur(e);if(!n)return null;const r=n,o=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),i=r.identifiers?.[0],a=`=${"`"+o.replace(/\{\}/g,"${"+i+"}")+"`"}`,u=e.slice(0,r.startIndex)+a+e.slice(r.endIndex);return G(e,u,a,r.startIndex,r.endIndex),u},hr=e=>{const t=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,n=e.match(t);return!n||n.index==null?(console.error("patch: thinker symbol mirror option: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},fr=(e,t)=>{const n=hr(e);if(!n)return null;const r=n.identifiers?.[0],o=t?`=[...${r},...[...${r}].reverse()]`:`=[...${r}]`,i=e.slice(0,n.startIndex)+o+e.slice(n.endIndex);return G(e,i,o,n.startIndex,n.endIndex),i},mr=e=>{const t=[],n=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let r;for(;(r=n.exec(e))!==null;)t.push({startIndex:r.index,endIndex:r.index+r[0].length});return t},pr=(e,t)=>{const n=mr(e);if(n.length===0)return null;const r=JSON.stringify(t),o=n.sort((l,a)=>a.startIndex-l.startIndex);let i=e;for(let l=0;l<o.length;l++){const a=i.slice(0,o[l].startIndex)+r+i.slice(o[l].endIndex);G(i,a,r,o[l].startIndex,o[l].endIndex),i=a}return i},br=e=>{const t=/[, ][$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,n=e.match(t);if(!n||n.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const r=n[0],o=n[1],i=r.lastIndexOf(o),l=n.index+i,a=l+o.length;return{startIndex:l,endIndex:a}},wr=(e,t)=>{const n=br(e);if(!n)return null;const r=JSON.stringify(t),o=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return G(e,o,r,n.startIndex,n.endIndex),o},xr=e=>{const t=/\{flexWrap:"wrap",height:1,width:2\}/,n=e.match(t);return!n||n.index==null?(console.error("patch: thinker symbol width: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length}},Sr=(e,t)=>{const n=xr(e);if(!n)return null;const r=`{flexWrap:"wrap",height:1,width:${t}}`,o=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return G(e,o,r,n.startIndex,n.endIndex),o},yr=e=>{const t=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,n=e.match(t);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:n.index+1,endIndex:n.index+n[0].length,identifiers:[n[1]]}},vr=e=>{const t=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,n=e.match(t);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},$r=(e,t)=>{const n=yr(e);if(!n)return null;const r=n,o=r.identifiers?.[0],i=`${o}=${JSON.stringify({words:t})}`,l=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);G(e,l,i,r.startIndex,r.endIndex);const a=vr(l);if(!a)return null;const u=a,g=`function ${u.identifiers?.[0]}(){return ${o}.words}`,m=l.slice(0,u.startIndex)+g+l.slice(u.endIndex);return G(l,m,g,u.startIndex,u.endIndex),m},_r=e=>{const t=e.indexOf("No content found in user prompt message")-700;if(t===-1)return console.error("patch: userMessageDisplay: failed to find error message"),null;const n=Math.min(e.length,t+700),r=e.slice(t,n),o=/("> "),([$\w]+)/,i=r.match(o);if(!i)return{prefixLocation:null,messageLocation:null};const l=t+r.indexOf(i[1]),a=l+i[1].length,u=a+1,d=u+i[2].length;return{prefixLocation:{startIndex:l,endIndex:a},messageLocation:{startIndex:u,endIndex:d}}},Ir=(e,t,n,r,o=!1,i=!1,l=!1,a=!1,u=!1,d,g,m=!1,v=!1,b=!1,p=!1,w=!1)=>{const x=_r(e);if(!x)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!x.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!x.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const C=ln(e);if(!C)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const _=[],k=n==="rgb(0,0,0)"&&r==="rgb(0,0,0)",O=!k||(o||i||l||a||u),V=d==="rgb(0,0,0)"&&g==="rgb(0,0,0)",U=!V||(m||v||b||p||w);if(O){const B=Cn(C,k?null:n.match(/\d+/g)?.join(",")||null,k?null:r.match(/\d+/g)?.join(",")||null,o,i,l,a,u);_.push({startIndex:x.prefixLocation.startIndex,endIndex:x.prefixLocation.endIndex,newContent:`${B}("${t}")+" "`})}if(U){const B=Cn(C,V?null:d.match(/\d+/g)?.join(",")||null,V?null:g.match(/\d+/g)?.join(",")||null,m,v,b,p,w);_.push({startIndex:x.messageLocation.startIndex,endIndex:x.messageLocation.endIndex,newContent:e.slice(x.messageLocation.startIndex,x.messageLocation.endIndex).replace(/([$\w]+)/,`${B}($1)`)})}_.sort((B,E)=>E.startIndex-B.startIndex);let A=e;for(const B of _){const E=A;A=A.slice(0,B.startIndex)+B.newContent+A.slice(B.endIndex),G(E,A,B.newContent,B.startIndex,B.endIndex)}return A},Cr=e=>{const t=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const r=n[0],o=/verbose:[^,}]+/,i=r.match(o);if(!i||i.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const l=n.index+i.index,a=l+i[0].length;return{startIndex:l,endIndex:a}},Er=e=>{const t=Cr(e);if(!t)return null;const n="verbose:true",r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return G(e,r,n,t.startIndex,t.endIndex),r},kr=e=>{const n=e.indexOf("subscription, no need to monitor cost");if(n===-1)return console.error("patch: ignoreMaxSubscription: phrase not found"),null;const r=Math.max(0,n-60),o=n,i=e.slice(r,o),l=/if\(([$\w]+)\(\)\)/g;let a=null;for(const g of i.matchAll(l))a=g;if(!a||a.index===void 0)return console.error("patch: ignoreMaxSubscription: could not match if(<id>()) nearby"),null;const u=r+a.index,d=u+a[0].length;return{startIndex:u,endIndex:d}},Mr=e=>{const t=kr(e);if(!t)return null;const n="if(!1)",r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return G(e,r,n,t.startIndex,t.endIndex),r},Br=e=>{const t=/function ([$\w]+)\(\{\s*streamMode:\s*([$\w]+)\s*\}\)\s*\{/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: thinkingVisibility: failed to find banner function pattern"),null;const[r]=n,o=n.index,i=o+r.length;return{startIndex:o,endIndex:i,identifiers:[n[1],n[2]]}},Nr=e=>{const t=/(case"thinking":)if\(.+?\)return null;(.+?isTranscriptMode:).+?([},])/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: thinkingVisibility: failed to find thinking visibility pattern"),null;const r=n.index,o=r+n[0].length;return{startIndex:r,endIndex:o,identifiers:[n[1],n[2],n[3]]}},Or=e=>{const t=Br(e);if(!t)return null;const n="return null;";let r=e.slice(0,t.endIndex)+n+e.slice(t.endIndex);G(e,r,n,t.endIndex,t.endIndex);const o=Nr(r);if(!o)return null;const i=`${o.identifiers[0]}${o.identifiers[1]}true${o.identifiers[2]}`;return r=r.slice(0,o.startIndex)+i+r.slice(o.endIndex),G(e,r,i,o.startIndex,o.endIndex),r},Tr=e=>{const n=e.indexOf("}.VERSION} (Claude Code)");return n==-1?(console.error("patch: patchesAppliedIndication: failed to find versionIndex"),null):{startIndex:0,endIndex:n+24}},Ar=e=>{const t=/\b([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find Claude Code version pattern"),null;const r=n.index+n[0].length;return{startIndex:r,endIndex:r}},Pr=(e,t,n,r,o,i)=>{const l=/alignItems:"center",minHeight:9,?/,a=e.match(l);if(!a||a.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find alignItems pattern for PATCH 4"),null;let u=e.slice(0,a.index)+"minHeight:9,"+e.slice(a.index+a[0].length);const d=Math.max(0,a.index-200),g=u.slice(d,a.index+12+2),m=/\b([$\w]+)\.createElement\(([$\w]+),(?:\w+|\{[^}]+\}),/g,v=Array.from(g.matchAll(m));if(v.length===0)return console.error("patch: patchesAppliedIndication: failed to find createElement for PATCH 4"),null;const b=v[v.length-1],p=d+b.index+b[0].length,w=`${n}.createElement(${o}, null, ${i}.blue.bold(" + tweakcc v${t}")),${n}.createElement(${r},{alignItems:"center",flexDirection:"column"},`,x=u;u=u.slice(0,p)+w+u.slice(p),G(x,u,w,p,p);let C=1,_=p+w.length,k=-1;for(;_<u.length;){const O=u[_];if(O==="(")C++;else if(O===")"){if(C===1){k=_;break}C--}_++}if(k===-1)return console.error("patch: patchesAppliedIndication: failed to find closing paren for PATCH 4"),null;const P=u;return u=u.slice(0,k)+"),"+u.slice(k),G(P,u,"),",k,k),{content:u,closingParenIndex:k+2}},Lr=(e,t,n,r,o,i,l)=>{let a=4,u=t,d=-1;for(;u<e.length;){const p=e[u];if(p==="(")a++;else if(p===")"){if(a===1){d=u;break}a--}u++}if(d===-1)return console.error("patch: patchesAppliedIndication: failed to find insertion point for PATCH 5"),null;const g=[];g.push(`,${n}.createElement(${r}, { flexDirection: "column" },`),g.push(`${n}.createElement(${r}, null, ${n}.createElement(${o}, {color: "success", bold: true}, "┃ "), ${n}.createElement(${o}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let p of l)p=p.replace("CHALK_VAR",i),g.push(`${n}.createElement(${r}, null, ${n}.createElement(${o}, {color: "success", bold: true}, "┃ "), ${n}.createElement(${o}, {dimColor: true}, \` * ${p}\`)),`);g.push("),");const m=g.join(""),v=e,b=e.slice(0,d)+m+e.slice(d);return G(v,b,m,d,d),b},Dr=e=>{const t=/\b([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find Claude Code version pattern for patch 3"),null;const r=Math.max(0,n.index-500),o=e.slice(r,n.index),i=/\}function ([$\w]+)\(/g,l=Array.from(o.matchAll(i));if(l.length===0)return console.error("patch: patchesAppliedIndication: failed to find header component function"),null;const u=l[l.length-1][1],d=new RegExp(`\\b([$\\w]+)\\.createElement\\(${we(u)},null\\),?`),g=e.match(d);if(!g||g.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find createElement call for header"),null;const m=g.index+g[0].length;return{startIndex:m,endIndex:m}},Rr=(e,t,n,r=!0,o=!0)=>{const i=Tr(e);if(!i)return console.error("patch: patchesAppliedIndication: failed to version output location"),null;const l=`\\n${t} (tweakcc)`;let a=e.slice(0,i.endIndex)+l+e.slice(i.endIndex);G(e,a,l,i.endIndex,i.endIndex);const u=ln(e);if(!u)return console.error("patch: patchesAppliedIndication: failed to find chalk variable"),null;const d=qn(e);if(!d)return console.error("patch: patchesAppliedIndication: failed to find text component"),null;const g=an(e);if(!g)return console.error("patch: patchesAppliedIndication: failed to find React variable"),null;const m=Xn(e);if(!m)return console.error("patch: patchesAppliedIndication: failed to find Box component"),null;if(r){const b=Ar(a);if(!b)return console.error("patch: patchesAppliedIndication: patch 2 failed"),null;const p=`, " ",${g}.createElement(${d}, null, ${u}.blue.bold('+ tweakcc v${t}'))`,w=a;a=a.slice(0,b.startIndex)+p+a.slice(b.endIndex),G(w,a,p,b.startIndex,b.endIndex)}if(o){const b=Dr(a);if(!b)return console.error("patch: patchesAppliedIndication: patch 3 failed"),null;const p=[];p.push(`${g}.createElement(${m}, { flexDirection: "column" },`),p.push(`${g}.createElement(${m}, null, ${g}.createElement(${d}, {color: "success", bold: true}, "┃ "), ${g}.createElement(${d}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let C of n)C=C.replace("CHALK_VAR",u),p.push(`${g}.createElement(${m}, null, ${g}.createElement(${d}, {color: "success", bold: true}, "┃ "), ${g}.createElement(${d}, {dimColor: true}, \` * ${C}\`)),`);p.push("),");const w=p.join(`
184
- `),x=a;a=a.slice(0,b.startIndex)+w+a.slice(b.endIndex),G(x,a,w,b.startIndex,b.endIndex)}let v=-1;if(r){const b=Pr(a,t,g,m,d,u);if(!b)return console.error("patch: patchesAppliedIndication: patch 4 failed"),null;a=b.content,v=b.closingParenIndex}if(o){if(v===-1){const p=/alignItems:"center",minHeight:9,?/,w=a.match(p);if(!w||w.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find reference point for PATCH 5"),null;v=w.index+w[0].length}const b=Lr(a,v,g,m,d,u,n);if(!b)return console.error("patch: patchesAppliedIndication: patch 5 failed"),null;a=b}return a},Fr=e=>/\\u[0-9a-fA-F]{4}/.test(e),Vr=e=>{const t=e.toString(),n=JSON.stringify(t.substring(1,t.length-1)),r=JSON.stringify(t.match(/\/(\w*)$/)[1]);return`new RegExp(${n}, ${r})`},Ur=async(e,t,n)=>{const r=n??Fr(e);M()&&r&&console.log("Detected Unicode escaping in cli.js - will escape non-ASCII characters in prompts");const o=await Dt(t,r);M()&&console.log(`Loaded ${o.length} system prompts with regexes`);let i=0,l=0;for(const{promptId:d,prompt:g,regex:m,getInterpolatedContent:v,pieces:b,identifiers:p,identifierMap:w}of o){const x=new RegExp(m,"si"),C=e.match(x);if(C&&C.index!==void 0){const _=v(C),k=De(b,p,w).trim(),P=k.length,O=g.content.length;i+=P,l+=O,M()&&P!==O&&(console.log(`
183
+ }`,r=r.slice(0,n.switchStatement.startIndex)+l+r.slice(n.switchStatement.endIndex),G(e,r,l,n.switchStatement.startIndex,n.switchStatement.endIndex),r},ir=e=>{const t=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,n=e.match(t);return!n||n.index===void 0?(console.error("patch: context limit: failed to find match"),null):n.index+n[0].indexOf("{")+1},sr=e=>{const t=ir(e);if(!t)return null;const n="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",r=e.slice(0,t)+n+e.slice(t);return G(e,r,n,t,t),r},lr=e=>{const t=e.indexOf('bash:"bashBorder"');if(t===-1)return console.error("patch: input border: failed to find bash pattern"),null;const n=e.slice(t,t+500),r=/borderStyle:"[^"]*"/,o=n.match(r);return!o||o.index===void 0?(console.error("patch: input border: failed to find border style pattern"),null):{startIndex:t+o.index,endIndex:t+o.index+o[0].length}},ar=(e,t)=>{const n=lr(e);if(!n)return null;if(t){const r="borderColor:undefined",o=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return G(e,o,r,n.startIndex,n.endIndex),o}else return e},cr=e=>{const t=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const r=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,o=n[0].match(r);if(!o||o.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const i=n.index+o.index,l=i+o[0].length;return{startIndex:i,endIndex:l}},dr=e=>{const t=cr(e);if(!t)return null;const n=e.slice(0,t.startIndex)+e.slice(t.endIndex);return G(e,n,"",t.startIndex,t.endIndex),n},ur=e=>{const t=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,n=e.match(t);if(!n||n.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const r=e.slice(n.index,n.index+600),o=/([$\w]+)(=\(([^;]{1,200}?)\)\+"(?:…|\\u2026)")/,i=r.match(o);return!i||i.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:n.index+i.index+i[1].length,endIndex:n.index+i.index+i[1].length+i[2].length,identifiers:[i[3]]}},gr=(e,t)=>{const n=ur(e);if(!n)return null;const r=n,o=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),i=r.identifiers?.[0],a=`=${"`"+o.replace(/\{\}/g,"${"+i+"}")+"`"}`,u=e.slice(0,r.startIndex)+a+e.slice(r.endIndex);return G(e,u,a,r.startIndex,r.endIndex),u},hr=e=>{const t=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,n=e.match(t);return!n||n.index==null?(console.error("patch: thinker symbol mirror option: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},fr=(e,t)=>{const n=hr(e);if(!n)return null;const r=n.identifiers?.[0],o=t?`=[...${r},...[...${r}].reverse()]`:`=[...${r}]`,i=e.slice(0,n.startIndex)+o+e.slice(n.endIndex);return G(e,i,o,n.startIndex,n.endIndex),i},mr=e=>{const t=[],n=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let r;for(;(r=n.exec(e))!==null;)t.push({startIndex:r.index,endIndex:r.index+r[0].length});return t},pr=(e,t)=>{const n=mr(e);if(n.length===0)return null;const r=JSON.stringify(t),o=n.sort((l,a)=>a.startIndex-l.startIndex);let i=e;for(let l=0;l<o.length;l++){const a=i.slice(0,o[l].startIndex)+r+i.slice(o[l].endIndex);G(i,a,r,o[l].startIndex,o[l].endIndex),i=a}return i},br=e=>{const t=/[, ][$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,n=e.match(t);if(!n||n.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const r=n[0],o=n[1],i=r.lastIndexOf(o),l=n.index+i,a=l+o.length;return{startIndex:l,endIndex:a}},wr=(e,t)=>{const n=br(e);if(!n)return null;const r=JSON.stringify(t),o=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return G(e,o,r,n.startIndex,n.endIndex),o},xr=e=>{const t=/\{flexWrap:"wrap",height:1,width:2\}/,n=e.match(t);return!n||n.index==null?(console.error("patch: thinker symbol width: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length}},yr=(e,t)=>{const n=xr(e);if(!n)return null;const r=`{flexWrap:"wrap",height:1,width:${t}}`,o=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return G(e,o,r,n.startIndex,n.endIndex),o},Sr=e=>{const t=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,n=e.match(t);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:n.index+1,endIndex:n.index+n[0].length,identifiers:[n[1]]}},vr=e=>{const t=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,n=e.match(t);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},$r=(e,t)=>{const n=Sr(e);if(!n)return null;const r=n,o=r.identifiers?.[0],i=`${o}=${JSON.stringify({words:t})}`,l=e.slice(0,r.startIndex)+i+e.slice(r.endIndex);G(e,l,i,r.startIndex,r.endIndex);const a=vr(l);if(!a)return null;const u=a,g=`function ${u.identifiers?.[0]}(){return ${o}.words}`,f=l.slice(0,u.startIndex)+g+l.slice(u.endIndex);return G(l,f,g,u.startIndex,u.endIndex),f},_r=e=>{const t=e.indexOf("No content found in user prompt message")-700;if(t===-1)return console.error("patch: userMessageDisplay: failed to find error message"),null;const n=Math.min(e.length,t+700),r=e.slice(t,n),o=/("> "),([$\w]+)/,i=r.match(o);if(!i)return{prefixLocation:null,messageLocation:null};const l=t+r.indexOf(i[1]),a=l+i[1].length,u=a+1,d=u+i[2].length;return{prefixLocation:{startIndex:l,endIndex:a},messageLocation:{startIndex:u,endIndex:d}}},Ir=(e,t,n,r,o=!1,i=!1,l=!1,a=!1,u=!1,d,g,f=!1,v=!1,b=!1,p=!1,w=!1)=>{const x=_r(e);if(!x)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!x.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!x.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const C=ln(e);if(!C)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const _=[],k=n==="rgb(0,0,0)"&&r==="rgb(0,0,0)",O=!k||(o||i||l||a||u),V=d==="rgb(0,0,0)"&&g==="rgb(0,0,0)",U=!V||(f||v||b||p||w);if(O){const B=Cn(C,k?null:n.match(/\d+/g)?.join(",")||null,k?null:r.match(/\d+/g)?.join(",")||null,o,i,l,a,u);_.push({startIndex:x.prefixLocation.startIndex,endIndex:x.prefixLocation.endIndex,newContent:`${B}("${t}")+" "`})}if(U){const B=Cn(C,V?null:d.match(/\d+/g)?.join(",")||null,V?null:g.match(/\d+/g)?.join(",")||null,f,v,b,p,w);_.push({startIndex:x.messageLocation.startIndex,endIndex:x.messageLocation.endIndex,newContent:e.slice(x.messageLocation.startIndex,x.messageLocation.endIndex).replace(/([$\w]+)/,`${B}($1)`)})}_.sort((B,E)=>E.startIndex-B.startIndex);let A=e;for(const B of _){const E=A;A=A.slice(0,B.startIndex)+B.newContent+A.slice(B.endIndex),G(E,A,B.newContent,B.startIndex,B.endIndex)}return A},Cr=e=>{const t=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const r=n[0],o=/verbose:[^,}]+/,i=r.match(o);if(!i||i.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const l=n.index+i.index,a=l+i[0].length;return{startIndex:l,endIndex:a}},Er=e=>{const t=Cr(e);if(!t)return null;const n="verbose:true",r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return G(e,r,n,t.startIndex,t.endIndex),r},kr=e=>{const n=e.indexOf("subscription, no need to monitor cost");if(n===-1)return console.error("patch: ignoreMaxSubscription: phrase not found"),null;const r=Math.max(0,n-60),o=n,i=e.slice(r,o),l=/if\(([$\w]+)\(\)\)/g;let a=null;for(const g of i.matchAll(l))a=g;if(!a||a.index===void 0)return console.error("patch: ignoreMaxSubscription: could not match if(<id>()) nearby"),null;const u=r+a.index,d=u+a[0].length;return{startIndex:u,endIndex:d}},Mr=e=>{const t=kr(e);if(!t)return null;const n="if(!1)",r=e.slice(0,t.startIndex)+n+e.slice(t.endIndex);return G(e,r,n,t.startIndex,t.endIndex),r},Br=e=>{const t=/function ([$\w]+)\(\{\s*streamMode:\s*([$\w]+)\s*\}\)\s*\{/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: thinkingVisibility: failed to find banner function pattern"),null;const[r]=n,o=n.index,i=o+r.length;return{startIndex:o,endIndex:i,identifiers:[n[1],n[2]]}},Nr=e=>{const t=/(case"thinking":)if\(.+?\)return null;(.+?isTranscriptMode:).+?([},])/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: thinkingVisibility: failed to find thinking visibility pattern"),null;const r=n.index,o=r+n[0].length;return{startIndex:r,endIndex:o,identifiers:[n[1],n[2],n[3]]}},Or=e=>{const t=Br(e);if(!t)return null;const n="return null;";let r=e.slice(0,t.endIndex)+n+e.slice(t.endIndex);G(e,r,n,t.endIndex,t.endIndex);const o=Nr(r);if(!o)return null;const i=`${o.identifiers[0]}${o.identifiers[1]}true${o.identifiers[2]}`;return r=r.slice(0,o.startIndex)+i+r.slice(o.endIndex),G(e,r,i,o.startIndex,o.endIndex),r},Tr=e=>{const n=e.indexOf("}.VERSION} (Claude Code)");return n==-1?(console.error("patch: patchesAppliedIndication: failed to find versionIndex"),null):{startIndex:0,endIndex:n+24}},Ar=e=>{const t=/\b([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find Claude Code version pattern"),null;const r=n.index+n[0].length;return{startIndex:r,endIndex:r}},Pr=(e,t,n,r,o,i)=>{const l=/alignItems:"center",minHeight:9,?/,a=e.match(l);if(!a||a.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find alignItems pattern for PATCH 4"),null;let u=e.slice(0,a.index)+"minHeight:9,"+e.slice(a.index+a[0].length);const d=Math.max(0,a.index-200),g=u.slice(d,a.index+12+2),f=/\b([$\w]+)\.createElement\(([$\w]+),(?:\w+|\{[^}]+\}),/g,v=Array.from(g.matchAll(f));if(v.length===0)return console.error("patch: patchesAppliedIndication: failed to find createElement for PATCH 4"),null;const b=v[v.length-1],p=d+b.index+b[0].length,w=`${n}.createElement(${o}, null, ${i}.blue.bold(" + tweakcc v${t}")),${n}.createElement(${r},{alignItems:"center",flexDirection:"column"},`,x=u;u=u.slice(0,p)+w+u.slice(p),G(x,u,w,p,p);let C=1,_=p+w.length,k=-1;for(;_<u.length;){const O=u[_];if(O==="(")C++;else if(O===")"){if(C===1){k=_;break}C--}_++}if(k===-1)return console.error("patch: patchesAppliedIndication: failed to find closing paren for PATCH 4"),null;const P=u;return u=u.slice(0,k)+"),"+u.slice(k),G(P,u,"),",k,k),{content:u,closingParenIndex:k+2}},Lr=(e,t,n,r,o,i,l)=>{let a=4,u=t,d=-1;for(;u<e.length;){const p=e[u];if(p==="(")a++;else if(p===")"){if(a===1){d=u;break}a--}u++}if(d===-1)return console.error("patch: patchesAppliedIndication: failed to find insertion point for PATCH 5"),null;const g=[];g.push(`,${n}.createElement(${r}, { flexDirection: "column" },`),g.push(`${n}.createElement(${r}, null, ${n}.createElement(${o}, {color: "success", bold: true}, "┃ "), ${n}.createElement(${o}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let p of l)p=p.replace("CHALK_VAR",i),g.push(`${n}.createElement(${r}, null, ${n}.createElement(${o}, {color: "success", bold: true}, "┃ "), ${n}.createElement(${o}, {dimColor: true}, \` * ${p}\`)),`);g.push("),");const f=g.join(""),v=e,b=e.slice(0,d)+f+e.slice(d);return G(v,b,f,d,d),b},Dr=e=>{const t=/\b([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find Claude Code version pattern for patch 3"),null;const r=Math.max(0,n.index-500),o=e.slice(r,n.index),i=/\}function ([$\w]+)\(/g,l=Array.from(o.matchAll(i));if(l.length===0)return console.error("patch: patchesAppliedIndication: failed to find header component function"),null;const u=l[l.length-1][1],d=new RegExp(`\\b([$\\w]+)\\.createElement\\(${we(u)},null\\),?`),g=e.match(d);if(!g||g.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find createElement call for header"),null;const f=g.index+g[0].length;return{startIndex:f,endIndex:f}},Rr=(e,t,n,r=!0,o=!0)=>{const i=Tr(e);if(!i)return console.error("patch: patchesAppliedIndication: failed to version output location"),null;const l=`\\n${t} (tweakcc)`;let a=e.slice(0,i.endIndex)+l+e.slice(i.endIndex);G(e,a,l,i.endIndex,i.endIndex);const u=ln(e);if(!u)return console.error("patch: patchesAppliedIndication: failed to find chalk variable"),null;const d=qn(e);if(!d)return console.error("patch: patchesAppliedIndication: failed to find text component"),null;const g=an(e);if(!g)return console.error("patch: patchesAppliedIndication: failed to find React variable"),null;const f=Xn(e);if(!f)return console.error("patch: patchesAppliedIndication: failed to find Box component"),null;if(r){const b=Ar(a);if(!b)return console.error("patch: patchesAppliedIndication: patch 2 failed"),null;const p=`, " ",${g}.createElement(${d}, null, ${u}.blue.bold('+ tweakcc v${t}'))`,w=a;a=a.slice(0,b.startIndex)+p+a.slice(b.endIndex),G(w,a,p,b.startIndex,b.endIndex)}if(o){const b=Dr(a);if(!b)return console.error("patch: patchesAppliedIndication: patch 3 failed"),null;const p=[];p.push(`${g}.createElement(${f}, { flexDirection: "column" },`),p.push(`${g}.createElement(${f}, null, ${g}.createElement(${d}, {color: "success", bold: true}, "┃ "), ${g}.createElement(${d}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let C of n)C=C.replace("CHALK_VAR",u),p.push(`${g}.createElement(${f}, null, ${g}.createElement(${d}, {color: "success", bold: true}, "┃ "), ${g}.createElement(${d}, {dimColor: true}, \` * ${C}\`)),`);p.push("),");const w=p.join(`
184
+ `),x=a;a=a.slice(0,b.startIndex)+w+a.slice(b.endIndex),G(x,a,w,b.startIndex,b.endIndex)}let v=-1;if(r){const b=Pr(a,t,g,f,d,u);if(!b)return console.error("patch: patchesAppliedIndication: patch 4 failed"),null;a=b.content,v=b.closingParenIndex}if(o){if(v===-1){const p=/alignItems:"center",minHeight:9,?/,w=a.match(p);if(!w||w.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find reference point for PATCH 5"),null;v=w.index+w[0].length}const b=Lr(a,v,g,f,d,u,n);if(!b)return console.error("patch: patchesAppliedIndication: patch 5 failed"),null;a=b}return a},Fr=e=>/\\u[0-9a-fA-F]{4}/.test(e),Vr=e=>{const t=e.toString(),n=JSON.stringify(t.substring(1,t.length-1)),r=JSON.stringify(t.match(/\/(\w*)$/)[1]);return`new RegExp(${n}, ${r})`},Ur=async(e,t,n)=>{const r=n??Fr(e);M()&&r&&console.log("Detected Unicode escaping in cli.js - will escape non-ASCII characters in prompts");const o=await Dt(t,r);M()&&console.log(`Loaded ${o.length} system prompts with regexes`);let i=0,l=0;for(const{promptId:d,prompt:g,regex:f,getInterpolatedContent:v,pieces:b,identifiers:p,identifierMap:w}of o){const x=new RegExp(f,"si"),C=e.match(x);if(C&&C.index!==void 0){const _=v(C),k=Re(b,p,w).trim(),P=k.length,O=g.content.length;i+=P,l+=O,M()&&P!==O&&(console.log(`
185
185
  Character count difference for ${g.name}:`),console.log(` Original baseline: ${P} chars`),console.log(` User's version: ${O} chars`),console.log(` Difference: ${P-O} chars`),Math.abs(P-O)<200&&(console.log(`
186
186
  Original baseline content:
187
187
  ${k}`),console.log(`
188
188
  User's content:
189
189
  ${g.content}`))),M()&&(console.log(`
190
190
  Found match for prompt: ${g.name}`),console.log(` Match location: index ${C.index}, length ${C[0].length}`),console.log(` Original content (first 100 chars): ${C[0].substring(0,100)}...`),console.log(` Replacement content (first 100 chars): ${_.substring(0,100)}...`),console.log(` Captured variables: ${C.slice(1).join(", ")}`),console.log(` Content identical: ${C[0]===_}`));const V=e,K=C.index,U=C[0].length;e=e.replace(x,_);const A=Ye(g.content);await vt(d,A),M()&&G(V,e,_,K,K+U)}else if(console.log(Q.yellow(`Could not find system prompt "${g.name}" in cli.js (using regex ${Vr(x)})`)),M()){console.log(`
191
- Debug info for ${g.name}:`),console.log(` Regex pattern (first 200 chars): ${m.substring(0,200)}...`),console.log(" Trying to match pattern in cli.js...");const _=e.match(new RegExp(m.substring(0,100)));console.log(` Partial match result: ${_?"found partial":"no match"}`)}}const a=[],u=i-l;return u>0?a.push(`system prompts: \${CHALK_VAR.green('${u} fewer chars')} than original`):u<0&&a.push(`system prompts: \${CHALK_VAR.red('${Math.abs(u)} more chars')} than original`),{newContent:e,items:a}},jr=e=>{const t=/ensureServerStarted:([$\w]+)\b/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: fixLspSupport: failed to find ensureServerStarted"),null;const r=Math.max(0,n.index-50),o=Math.min(e.length,n.index+50),i=e.slice(r,o),l=/sendRequest:([$\w]+)[,}]/,a=i.match(l);if(!a)return console.error(`patch: fixLspSupport: failed to find sendRequest near ensureServerStarted, window=${JSON.stringify([r,o,i])}`),null;const u=a[1],d=Math.max(0,n.index-2e3),g=e.slice(d,n.index),m=new RegExp(`async function ${we(u)}\\(([$\\w]+),`,"g");let v,b=null;for(;(v=m.exec(g))!==null;)b=v;if(!b)return console.error(`patch: fixLspSupport: failed to find async function ${u}`),null;const p=b[1],w=d+b.index,x=e.slice(w,n.index),C=/let ([$\w]+)=await [$\w]+\([$\w]+\);/,_=x.match(C);if(!_||_.index===void 0)return console.error("patch: fixLspSupport: failed to find second line of sendRequest"),null;const k=_[1],P=w+_.index+_[0].length,O=e.slice(P,n.index),V=new RegExp(`if\\(!${we(k)}\\)return;`),K=O.match(V);if(!K||K.index===void 0)return console.error("patch: fixLspSupport: failed to find if(!serverVar)return; line"),null;const U=P+K.index+K[0].length;return{startIndex:U,endIndex:U,identifiers:[p,k]}},Hr=e=>{const t=/if\([$\w]+\.restartOnCrash!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': restartOnCrash is not yet implemented\. Remove this field from the configuration\.`\);/g,n=/if\([$\w]+\.startupTimeout!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': startupTimeout is not yet implemented\. Remove this field from the configuration\.`\);/g,r=/if\([$\w]+\.shutdownTimeout!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': shutdownTimeout is not yet implemented\. Remove this field from the configuration\.`\);/g;let o=e;const i=o;o=o.replace(t,""),o!==i?G(i,o,"",0,0):console.warn("patch: fixLspSupport: restartOnCrash validation not found");const l=o;o=o.replace(n,""),o!==l?G(l,o,"",0,0):console.warn("patch: fixLspSupport: startupTimeout validation not found");const a=o;o=o.replace(r,""),o!==a?G(a,o,"",0,0):console.warn("patch: fixLspSupport: shutdownTimeout validation not found");const u=jr(o);if(!u||!u.identifiers)return null;const[d,g]=u.identifiers,m=`
191
+ Debug info for ${g.name}:`),console.log(` Regex pattern (first 200 chars): ${f.substring(0,200)}...`),console.log(" Trying to match pattern in cli.js...");const _=e.match(new RegExp(f.substring(0,100)));console.log(` Partial match result: ${_?"found partial":"no match"}`)}}const a=[],u=i-l;return u>0?a.push(`system prompts: \${CHALK_VAR.green('${u} fewer chars')} than original`):u<0&&a.push(`system prompts: \${CHALK_VAR.red('${Math.abs(u)} more chars')} than original`),{newContent:e,items:a}},jr=e=>{const t=/ensureServerStarted:([$\w]+)\b/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: fixLspSupport: failed to find ensureServerStarted"),null;const r=Math.max(0,n.index-50),o=Math.min(e.length,n.index+50),i=e.slice(r,o),l=/sendRequest:([$\w]+)[,}]/,a=i.match(l);if(!a)return console.error(`patch: fixLspSupport: failed to find sendRequest near ensureServerStarted, window=${JSON.stringify([r,o,i])}`),null;const u=a[1],d=Math.max(0,n.index-2e3),g=e.slice(d,n.index),f=new RegExp(`async function ${we(u)}\\(([$\\w]+),`,"g");let v,b=null;for(;(v=f.exec(g))!==null;)b=v;if(!b)return console.error(`patch: fixLspSupport: failed to find async function ${u}`),null;const p=b[1],w=d+b.index,x=e.slice(w,n.index),C=/let ([$\w]+)=await [$\w]+\([$\w]+\);/,_=x.match(C);if(!_||_.index===void 0)return console.error("patch: fixLspSupport: failed to find second line of sendRequest"),null;const k=_[1],P=w+_.index+_[0].length,O=e.slice(P,n.index),V=new RegExp(`if\\(!${we(k)}\\)return;`),K=O.match(V);if(!K||K.index===void 0)return console.error("patch: fixLspSupport: failed to find if(!serverVar)return; line"),null;const U=P+K.index+K[0].length;return{startIndex:U,endIndex:U,identifiers:[p,k]}},Hr=e=>{const t=/if\([$\w]+\.restartOnCrash!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': restartOnCrash is not yet implemented\. Remove this field from the configuration\.`\);/g,n=/if\([$\w]+\.startupTimeout!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': startupTimeout is not yet implemented\. Remove this field from the configuration\.`\);/g,r=/if\([$\w]+\.shutdownTimeout!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': shutdownTimeout is not yet implemented\. Remove this field from the configuration\.`\);/g;let o=e;const i=o;o=o.replace(t,""),o!==i?G(i,o,"",0,0):console.warn("patch: fixLspSupport: restartOnCrash validation not found");const l=o;o=o.replace(n,""),o!==l?G(l,o,"",0,0):console.warn("patch: fixLspSupport: startupTimeout validation not found");const a=o;o=o.replace(r,""),o!==a?G(a,o,"",0,0):console.warn("patch: fixLspSupport: shutdownTimeout validation not found");const u=jr(o);if(!u||!u.identifiers)return null;const[d,g]=u.identifiers,f=`
192
192
  const path = await import('path');
193
193
  const ext = path.extname(${d}).toLowerCase();
194
194
  const langMap = {
@@ -338,8 +338,8 @@ Found match for prompt: ${g.name}`),console.log(` Match location: index ${C.ind
338
338
  }
339
339
  });
340
340
  } catch (openErr) { }
341
- `,v=o.slice(0,u.startIndex)+m+o.slice(u.endIndex);return G(o,v,m,u.startIndex,u.endIndex),v},Gr=e=>{const t=/function ([$\w]+)\(\{(?:(?:isDisabled|hideIndexes|visibleOptionCount|highlightText|options|defaultValue|onCancel|onChange|onFocus|focusValue|layout|disableSelection):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,n=Array.from(e.matchAll(t));if(n.length===0)return console.error("patch: findSelectComponentName: failed to find selectPattern"),null;let r=n[0];for(const o of n)o[0].length>r[0].length&&(r=o);return r[1]},zr=e=>{const t=/function ([$\w]+)\(\{(?:(?:orientation|title|width|padding|titlePadding|titleColor|titleDimColor|dividerChar|dividerColor|dividerDimColor|boxProps):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,n=Array.from(e.matchAll(t));if(n.length===0)return console.error("patch: findDividerComponentName: failed to find dividerPattern"),null;let r=n[0];for(const o of n)o[0].length>r[0].length&&(r=o);return r[1]},Yn=e=>{const t=/function ([$\w]+)\(\{(?:(?:commands|debug|initialPrompt|initialTools|initialMessages|initialCheckpoints|initialFileHistorySnapshots|mcpClients|dynamicMcpConfig|autoConnectIdeFlag|strictMcpConfig|systemPrompt|appendSystemPrompt|onBeforeQuery|onTurnComplete|disabled):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,n=Array.from(e.matchAll(t));if(n.length===0)return console.error("patch: getMainAppComponentBodyStart: failed to find appComponentPattern"),null;let r=n[0];for(const o of n)o[0].length>r[0].length&&(r=o);return r.index===void 0?(console.error("patch: getMainAppComponentBodyStart: failed to find appComponentPattern longestMatch"),null):r.index+r[0].length},Wn=e=>{const t=Yn(e);if(t===null)return console.error("patch: getAppStateVarAndGetterFunction: failed to find bodyStart"),null;const n=e.slice(t,t+20),r=/let\[([$\w]+),[$\w]+\]=([$\w]+)\(\)/,o=n.match(r);return o?{appStateVar:o[1],appStateGetterFunction:o[2]}:(console.error("patch: getAppStateVarAndGetterFunction: failed to find statePattern"),null)},Yr=e=>{const t=Yn(e);if(t===null)return console.error("patch: getToolFetchingUseMemoLocation: failed to find bodyStart"),null;const n=e.slice(t,t+300),r=/let ([$\w]+)=([$\w]+)\.useMemo\(\(\)=>([$\w]+)\(([$\w]+)\),\[\4\]\)/,o=n.match(r);if(!o||o.index===void 0)return console.error("patch: getToolFetchingUseMemoLocation: failed to find useMemoPattern"),null;const i=t+o.index,l=i+o[0].length;return{startIndex:i,endIndex:l,outputVarName:o[1],reactVarName:o[2],toolFilterFunction:o[3],toolPermissionContextVar:o[4]}},Jn=e=>{const t=/=>\[([$a-zA-Z_][$\w]{1,2},){30}/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: findSlashCommandListEndPosition: failed to find arrayStartPattern"),null;const r=e.indexOf("[",n.index);if(r===-1)return console.error("patch: findSlashCommandListEndPosition: failed to find bracketIndex"),null;let o=1,i=r+1;for(;i<e.length&&o>0;){if(e[i]==="[")o++;else if(e[i]==="]"&&(o--,o===0))return i;i++}return console.error("patch: findSlashCommandListEndPosition: failed to find matching closing-bracket"),null},Wr=e=>{const t=Jn(e);if(t===null)return console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find arrayEnd"),null;let n=1,r=t;for(;r>=0&&n>0;){if(e[r]==="}")n++;else if(e[r]==="{"&&(n--,n===0))break;r--}if(r<0)return console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find matching open-brace"),null;for(;r>=0&&e[r]!==";";)r--;return r<0?(console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find matching semicolon"),null):r+1},Jr=(e,t)=>{const n=/thinkingEnabled:([$\w]+)\(\)/g,r=Array.from(e.matchAll(n));if(r.length===0)return console.error("patch: toolsets: failed to find thinkingEnabled pattern"),null;const o=[];for(const u of r)if(u.index!==void 0){const d=u.index+u[0].length;o.push({index:d})}o.sort((u,d)=>d.index-u.index);let i=e;const a=`,toolset:${t?JSON.stringify(t):"undefined"}`;for(const u of o)i=i.slice(0,u.index)+a+i.slice(u.index);return i===e?(console.error("patch: toolsets: failed to modify app state initialization"),null):i},Kr=(e,t)=>{const n=Yr(e);if(!n)return console.error("patch: toolsets: failed to find tool fetching useMemo location"),null;const r=Wn(e);if(!r)return console.error("patch: toolsets: failed to find app state info"),null;const{appStateVar:o}=r,{startIndex:i,endIndex:l,outputVarName:a,reactVarName:u,toolFilterFunction:d,toolPermissionContextVar:g}=n,m=JSON.stringify(Object.fromEntries(t.map(p=>[p.name,p.allowedTools==="*"?"*":p.allowedTools]))),v=`let ${a} = ${u}.useMemo(() => {
342
- const toolsets = ${m};
341
+ `,v=o.slice(0,u.startIndex)+f+o.slice(u.endIndex);return G(o,v,f,u.startIndex,u.endIndex),v},Gr=e=>{const t=/function ([$\w]+)\(\{(?:(?:isDisabled|hideIndexes|visibleOptionCount|highlightText|options|defaultValue|onCancel|onChange|onFocus|focusValue|layout|disableSelection):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,n=Array.from(e.matchAll(t));if(n.length===0)return console.error("patch: findSelectComponentName: failed to find selectPattern"),null;let r=n[0];for(const o of n)o[0].length>r[0].length&&(r=o);return r[1]},zr=e=>{const t=/function ([$\w]+)\(\{(?:(?:orientation|title|width|padding|titlePadding|titleColor|titleDimColor|dividerChar|dividerColor|dividerDimColor|boxProps):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,n=Array.from(e.matchAll(t));if(n.length===0)return console.error("patch: findDividerComponentName: failed to find dividerPattern"),null;let r=n[0];for(const o of n)o[0].length>r[0].length&&(r=o);return r[1]},Yn=e=>{const t=/function ([$\w]+)\(\{(?:(?:commands|debug|initialPrompt|initialTools|initialMessages|initialCheckpoints|initialFileHistorySnapshots|mcpClients|dynamicMcpConfig|autoConnectIdeFlag|strictMcpConfig|systemPrompt|appendSystemPrompt|onBeforeQuery|onTurnComplete|disabled):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,n=Array.from(e.matchAll(t));if(n.length===0)return console.error("patch: getMainAppComponentBodyStart: failed to find appComponentPattern"),null;let r=n[0];for(const o of n)o[0].length>r[0].length&&(r=o);return r.index===void 0?(console.error("patch: getMainAppComponentBodyStart: failed to find appComponentPattern longestMatch"),null):r.index+r[0].length},Wn=e=>{const t=Yn(e);if(t===null)return console.error("patch: getAppStateVarAndGetterFunction: failed to find bodyStart"),null;const n=e.slice(t,t+20),r=/let\[([$\w]+),[$\w]+\]=([$\w]+)\(\)/,o=n.match(r);return o?{appStateVar:o[1],appStateGetterFunction:o[2]}:(console.error("patch: getAppStateVarAndGetterFunction: failed to find statePattern"),null)},Yr=e=>{const t=Yn(e);if(t===null)return console.error("patch: getToolFetchingUseMemoLocation: failed to find bodyStart"),null;const n=e.slice(t,t+300),r=/let ([$\w]+)=([$\w]+)\.useMemo\(\(\)=>([$\w]+)\(([$\w]+)\),\[\4\]\)/,o=n.match(r);if(!o||o.index===void 0)return console.error("patch: getToolFetchingUseMemoLocation: failed to find useMemoPattern"),null;const i=t+o.index,l=i+o[0].length;return{startIndex:i,endIndex:l,outputVarName:o[1],reactVarName:o[2],toolFilterFunction:o[3],toolPermissionContextVar:o[4]}},Jn=e=>{const t=/=>\[([$a-zA-Z_][$\w]{1,2},){30}/,n=e.match(t);if(!n||n.index===void 0)return console.error("patch: findSlashCommandListEndPosition: failed to find arrayStartPattern"),null;const r=e.indexOf("[",n.index);if(r===-1)return console.error("patch: findSlashCommandListEndPosition: failed to find bracketIndex"),null;let o=1,i=r+1;for(;i<e.length&&o>0;){if(e[i]==="[")o++;else if(e[i]==="]"&&(o--,o===0))return i;i++}return console.error("patch: findSlashCommandListEndPosition: failed to find matching closing-bracket"),null},Wr=e=>{const t=Jn(e);if(t===null)return console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find arrayEnd"),null;let n=1,r=t;for(;r>=0&&n>0;){if(e[r]==="}")n++;else if(e[r]==="{"&&(n--,n===0))break;r--}if(r<0)return console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find matching open-brace"),null;for(;r>=0&&e[r]!==";";)r--;return r<0?(console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find matching semicolon"),null):r+1},Jr=(e,t)=>{const n=/thinkingEnabled:([$\w]+)\(\)/g,r=Array.from(e.matchAll(n));if(r.length===0)return console.error("patch: toolsets: failed to find thinkingEnabled pattern"),null;const o=[];for(const u of r)if(u.index!==void 0){const d=u.index+u[0].length;o.push({index:d})}o.sort((u,d)=>d.index-u.index);let i=e;const a=`,toolset:${t?JSON.stringify(t):"undefined"}`;for(const u of o)i=i.slice(0,u.index)+a+i.slice(u.index);return i===e?(console.error("patch: toolsets: failed to modify app state initialization"),null):i},Kr=(e,t)=>{const n=Yr(e);if(!n)return console.error("patch: toolsets: failed to find tool fetching useMemo location"),null;const r=Wn(e);if(!r)return console.error("patch: toolsets: failed to find app state info"),null;const{appStateVar:o}=r,{startIndex:i,endIndex:l,outputVarName:a,reactVarName:u,toolFilterFunction:d,toolPermissionContextVar:g}=n,f=JSON.stringify(Object.fromEntries(t.map(p=>[p.name,p.allowedTools==="*"?"*":p.allowedTools]))),v=`let ${a} = ${u}.useMemo(() => {
342
+ const toolsets = ${f};
343
343
  if (toolsets.hasOwnProperty(${o}.toolset)) {
344
344
  const allowedTools = toolsets[${o}.toolset];
345
345
  if (allowedTools === "*") {
@@ -352,12 +352,12 @@ Found match for prompt: ${g.name}`),console.log(` Match location: index ${C.ind
352
352
  } else {
353
353
  return ${d}(${g});
354
354
  }
355
- }, [${d}, ${o}.toolset])`,b=e.slice(0,i)+v+e.slice(l);return G(e,b,v,i,l),b},qr=(e,t)=>{const n=Wr(e);if(n===null)return console.error("patch: toolsets: failed to find slash command insertion point"),null;const r=an(e);if(!r)return console.error("patch: toolsets: failed to find React variable"),null;const o=Xn(e);if(!o)return console.error("patch: toolsets: failed to find Box component"),null;const i=qn(e);if(!i)return console.error("patch: toolsets: failed to find Text component"),null;const l=Gr(e);if(!l)return console.error("patch: toolsets: failed to find Select component"),null;const a=zr(e);if(!a)return console.error("patch: toolsets: failed to find Divider component"),null;const u=Wn(e);if(!u)return console.error("patch: toolsets: failed to find app state getter"),null;const d=ln(e);if(!d)return console.error("patch: toolsets: failed to find chalk variable"),null;const{appStateGetterFunction:g}=u,m=JSON.stringify(t.map(w=>w.name)),v=JSON.stringify(t.map(w=>({label:w.name,value:w.name,description:w.allowedTools==="*"?"All tools":w.allowedTools.length===0?"No tools":`${w.allowedTools.length} tool${w.allowedTools.length!==1?"s":""}: ${w.allowedTools.join(", ")}`}))),b=`const toolsetComp = ({ onExit, input }) => {
355
+ }, [${d}, ${o}.toolset])`,b=e.slice(0,i)+v+e.slice(l);return G(e,b,v,i,l),b},qr=(e,t)=>{const n=Wr(e);if(n===null)return console.error("patch: toolsets: failed to find slash command insertion point"),null;const r=an(e);if(!r)return console.error("patch: toolsets: failed to find React variable"),null;const o=Xn(e);if(!o)return console.error("patch: toolsets: failed to find Box component"),null;const i=qn(e);if(!i)return console.error("patch: toolsets: failed to find Text component"),null;const l=Gr(e);if(!l)return console.error("patch: toolsets: failed to find Select component"),null;const a=zr(e);if(!a)return console.error("patch: toolsets: failed to find Divider component"),null;const u=Wn(e);if(!u)return console.error("patch: toolsets: failed to find app state getter"),null;const d=ln(e);if(!d)return console.error("patch: toolsets: failed to find chalk variable"),null;const{appStateGetterFunction:g}=u,f=JSON.stringify(t.map(w=>w.name)),v=JSON.stringify(t.map(w=>({label:w.name,value:w.name,description:w.allowedTools==="*"?"All tools":w.allowedTools.length===0?"No tools":`${w.allowedTools.length} tool${w.allowedTools.length!==1?"s":""}: ${w.allowedTools.join(", ")}`}))),b=`const toolsetComp = ({ onExit, input }) => {
356
356
  const [state, setState] = ${g}();
357
357
 
358
358
  // Handle command-line argument
359
359
  if (input !== "" && input != null) {
360
- if (!${m}.includes(input)) {
360
+ if (!${f}.includes(input)) {
361
361
  onExit(${d}.red(\`\${${d}.bold(input)} is not a valid toolset. Valid toolsets: ${t.map(w=>w.name).join(", ")}\`));
362
362
  return;
363
363
  } else {
@@ -430,16 +430,16 @@ Found match for prompt: ${g.name}`),console.log(` Match location: index ${C.ind
430
430
  userFacingName() {
431
431
  return "toolset";
432
432
  }
433
- }`,o=e.slice(0,t)+r+e.slice(t);return G(e,o,r,t,t),o},Zr=(e,t,n)=>{if(!t||t.length===0)return null;let r=e;return r=Jr(r,n),r?(r=Kr(r,t),r?(r=qr(r,t),r?(r=Xr(r),r||(console.error("patch: toolsets: step 4 failed (writeSlashCommandDefinition)"),null)):(console.error("patch: toolsets: step 3 failed (writeToolsetComponentDefinition)"),null)):(console.error("patch: toolsets: step 2 failed (writeToolFetchingUseMemo)"),null)):(console.error("patch: toolsets: step 1 failed (writeToolsetFieldToAppState)"),null)},G=(e,t,n,r,o)=>{const i=Math.max(0,r-20),l=Math.min(e.length,o+20),a=Math.min(t.length,r+n.length+20),u=e.slice(i,r),d=e.slice(r,o),g=e.slice(o,l),m=t.slice(i,r),v=t.slice(r,r+n.length),b=t.slice(r+n.length,a);M()&&d!==v&&(console.log(`
434
- --- Diff ---`),console.log("OLD:",u+`\x1B[31m${d}\x1B[0m`+g),console.log("NEW:",m+`\x1B[32m${v}\x1B[0m`+b),console.log(`--- End Diff ---
435
- `))},we=e=>e.replace(/\$/g,"\\$"),ln=e=>{const t=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,n=Array.from(e.matchAll(t)),r={};for(const l of n){const a=l[1];r[a]=(r[a]||0)+1}let o,i=0;for(const[l,a]of Object.entries(r))a>i&&(i=a,o=l);return o},Qr=e=>{const t=e.slice(0,1e3),n=/var ([$\w]+)=\([$\w]+,[$\w]+,[$\w]+\)=>\{/,r=t.match(n);if(!r){console.log("patch: getModuleLoaderFunction: failed to find module loader function");return}return r[1]},Kn=e=>{const t=/var ([$\w]+)=[$\w]+\(\([$\w]+\)=>\{var [$\w]+=Symbol\.for\("react\.element"\)/,n=e.match(t);if(!n){console.log("patch: getReactModuleNameNonBun: failed to find React module name");return}return n[1]},eo=e=>{const t=Kn(e);if(!t){console.log("^ patch: getReactModuleFunctionBun: failed to find React module name (Bun)");return}const n=new RegExp(`var ([$\\w]+)=[$\\w]+\\(\\([$\\w]+,[$\\w]+\\)=>\\{[$\\w]+\\.exports=${we(t)}\\(\\)`),r=e.match(n);if(!r){console.log(`patch: getReactModuleFunctionBun: failed to find React module function (Bun) (reactModuleNameNonBun=${t})`);return}return r[1]};let ge=null;const an=e=>{if(ge!=null)return ge;const t=Qr(e);if(!t){console.log("^ patch: getReactVar: failed to find moduleLoader"),ge=void 0;return}const n=Kn(e);if(!n){console.log("^ patch: getReactVar: failed to find reactModuleVarNonBun"),ge=void 0;return}const r=new RegExp(`\\b([$\\w]+)=${we(t)}\\(${we(n)}\\(\\),1\\)`),o=e.match(r);if(o)return ge=o[1],ge;const i=eo(e);if(!i){console.log("^ patch: getReactVar: failed to find reactModuleFunctionBun"),ge=void 0;return}const l=new RegExp(`\\b([$\\w]+)=${we(t)}\\(${we(i)}\\(\\),1\\)`),a=e.match(l);if(!a){console.log(`patch: getReactVar: failed to find bunPattern (moduleLoader=${t}, reactModuleVarNonBun=${n}, reactModuleFunctionBun=${i})`),ge=void 0;return}return ge=a[1],ge},qn=e=>{const t=/\bfunction ([$\w]+)\(\{color:[$\w]+,backgroundColor:[$\w]+,dimColor:[$\w]+=![01],bold:[$\w]+=![01]/,n=e.match(t);if(!n){console.log("patch: findTextComponent: failed to find text component");return}return n[1]},Xn=e=>{const t=/\b([$\w]+)\.displayName="Box"/,n=e.match(t);if(!n){console.error("patch: findBoxComponent: failed to find Box displayName");return}const r=n[1],o=new RegExp(`\\b([$\\w]+)=${we(r)}[^$\\w]`),i=e.match(o);if(!i){console.error(`patch: findBoxComponent: failed to find Box component variable (boxOrigCompName=${r})`);return}return i[1]},Zn=async(e,t)=>{let n;if(t.nativeInstallationPath){await Xt(t);let u=!1;try{await te.stat(ae),u=!0}catch{}const d=u?ae:t.nativeInstallationPath;M()&&console.log(`Extracting claude.js from ${u?"backup":"native installation"}: ${d}`);const g=jn(d);if(!g)throw new Error("Failed to extract claude.js from native installation");const m=re.join(Se.homedir(),".tweakcc"),v=re.join(m,"native-claudejs-orig.js");Ee.writeFileSync(v,g),M()&&console.log(`Saved original extracted JS from native to: ${v}`),n=g.toString("utf8")}else{if(await Gn(t),!t.cliPath)throw new Error("cliPath is required for NPM installations");n=await te.readFile(t.cliPath,{encoding:"utf8"})}const r=[],o=await Ur(n,t.version);n=o.newContent,r.push(...o.items);let i=null;e.settings.themes&&e.settings.themes.length>0&&(i=or(n,e.settings.themes))&&(n=i),e.settings.thinkingVerbs&&((i=$r(n,e.settings.thinkingVerbs.verbs))&&(n=i),(i=gr(n,e.settings.thinkingVerbs.format))&&(n=i)),(i=pr(n,e.settings.thinkingStyle.phases))&&(n=i),(i=wr(n,e.settings.thinkingStyle.updateInterval))&&(n=i),(i=Sr(n,Math.max(...e.settings.thinkingStyle.phases.map(u=>u.length))+1))&&(n=i),(i=fr(n,e.settings.thinkingStyle.reverseMirror))&&(n=i),e.settings.userMessageDisplay&&(i=Ir(n,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")))&&(n=i),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(i=ar(n,e.settings.inputBox.removeBorder))&&(n=i),(i=Er(n))&&(n=i),(i=dr(n))&&(n=i),(i=sr(n))&&(n=i),(i=ro(n))&&(n=i),(i=tr(n,25))&&(n=i),(i=Mr(n))&&(n=i),(i=Or(n))&&(n=i);const l=e.settings.misc?.showTweakccVersion??!0,a=e.settings.misc?.showPatchesApplied??!0;if((i=Rr(n,"3.0.0",r,l,a))&&(n=i),(i=Hr(n))&&(n=i),e.settings.toolsets&&e.settings.toolsets.length>0&&(i=Zr(n,e.settings.toolsets,e.settings.defaultToolset))&&(n=i),t.nativeInstallationPath){M()&&console.log(`Repacking modified claude.js into native installation: ${t.nativeInstallationPath}`);const u=re.join(Se.homedir(),".tweakcc"),d=re.join(u,"native-claudejs-patched.js");Ee.writeFileSync(d,n,"utf8"),M()&&console.log(`Saved patched JS from native to: ${d}`);const g=Buffer.from(n,"utf8");Kt(t.nativeInstallationPath,g,t.nativeInstallationPath)}else{if(!t.cliPath)throw new Error("cliPath is required for NPM installations");await un(t.cliPath,n,"patch")}return await Fe(u=>{u.changesApplied=!0})},Qn=[{label:"Opus 4.1",slug:"opus-4.1",internal:"claude-opus-4-1-20250805"},{label:"Opus 4",slug:"opus-4",internal:"claude-opus-4-20250514"},{label:"Sonnet 4",slug:"sonnet-4",internal:"claude-sonnet-4-20250514"},{label:"Sonnet 3.7",slug:"sonnet-3.7",internal:"claude-3-7-sonnet-20250219"},{label:"Sonnet 3.5 (October)",slug:"sonnet-3.5-october",internal:"claude-3-5-sonnet-20241022"},{label:"Sonnet 3.5 (June)",slug:"sonnet-3.5-june",internal:"claude-3-5-sonnet-20240620"},{label:"Haiku 3.5",slug:"haiku-3.5",internal:"claude-3-5-haiku-20241022"},{label:"Haiku 3",slug:"haiku-3",internal:"claude-3-haiku-20240307"},{label:"Opus 3",slug:"opus-3",internal:"claude-3-opus-20240229"}],no=e=>{const t=e.indexOf("Switch between Claude models");if(t===-1)return console.error("patch: getModelSelectorInsertionPoint: failed to find labelIndex"),null;const n=Math.max(0,t-600),r=t,i=e.slice(n,r).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!i||i.index===void 0)return console.error("patch: getModelSelectorInsertionPoint: failed to find useState"),null;let a=n+i.index;for(;a<e.length&&e[a]!==";";)a++;if(a>=e.length)return console.error("patch: getModelSelectorInsertionPoint: failed to find semicolon"),null;const u=a+1,d=i[1];return{insertionIndex:u,optionsVar:d}},to=e=>{const t=no(e);if(!t)return null;const{insertionIndex:n,optionsVar:r}=t,o=Qn.map(l=>{const a=JSON.stringify(l.label),u=JSON.stringify(l.slug);return`${r}.push({value:${u},label:${a}});`}).join(""),i=e.slice(0,n)+o+e.slice(n);return G(e,i,o,n,n),i},ro=e=>{let t=e;const n=to(t);return n&&(t=n),t===e?null:t};let et=!1;const M=()=>et,oo=()=>{et=!0};function cn(){try{const e=re.join(Se.homedir(),".claude.json");return JSON.parse(Ee.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function io(){try{const e=re.join(Se.homedir(),".claude",".credentials.json");switch(JSON.parse(Ee.readFileSync(e,"utf8"))?.claudeAiOauth?.subscriptionType||"unknown"){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro"}}catch{}return"Claude API"}function so(){try{const e=re.join(Se.homedir(),".claude","settings.json"),n=JSON.parse(Ee.readFileSync(e,"utf8"))?.model||"default";if(n==="opus")return"Opus 4.1";const r=Qn.find(o=>o.slug===n);if(r)return r.label}catch{}return"Sonnet 4.5"}function lo(e){process.platform==="win32"?Be.spawn("explorer",[e],{detached:!0,stdio:"ignore"}).unref():process.platform==="darwin"?Be.spawn("open",[e],{detached:!0,stdio:"ignore"}).unref():Be.spawn("xdg-open",[e],{detached:!0,stdio:"ignore"}).unref()}function In(e){if(process.platform==="win32")Be.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Be.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const t=re.dirname(e);Be.spawn("xdg-open",[t],{detached:!0,stdio:"ignore"}).unref()}}function dn(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 n=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const[,r,o,i]=n;return parseInt(r)<=255&&parseInt(o)<=255&&parseInt(i)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t)){const n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const[,r,o,i]=n;return parseInt(r)<=360&&parseInt(o)<=100&&parseInt(i)<=100}}return!1}function nt(e){if(!dn(e))return e;const t=e.trim();if(t.startsWith("rgb("))return t;if(t.startsWith("#")){let n=t.slice(1);n.length===3&&(n=n.split("").map(l=>l+l).join(""));const r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return`rgb(${r},${o},${i})`}if(t.startsWith("hsl(")){const n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const r=parseInt(n[1])/360,o=parseInt(n[2])/100,i=parseInt(n[3])/100,l=(v,b,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<1/6?v+(b-v)*6*p:p<1/2?b:p<2/3?v+(b-v)*(2/3-p)*6:v),a=i<.5?i*(1+o):i+o-i*o,u=2*i-a,d=Math.round(l(u,a,r+1/3)*255),g=Math.round(l(u,a,r)*255),m=Math.round(l(u,a,r-1/3)*255);return`rgb(${d},${g},${m})`}}return e}async function ao(e,t="sha256",n=64*1024){return new Promise((r,o)=>{const i=Bn.createHash(t),l=Ee.createReadStream(e,{highWaterMark:n});l.on("data",a=>{i.update(a)}),l.on("end",()=>{r(i.digest("hex"))}),l.on("error",a=>{o(a)})})}const Cn=(e,t,n,r,o,i,l,a)=>{let u=e;return t&&(u+=`.rgb(${t})`),n&&n!=="transparent"&&(u+=`.bgRgb(${n})`),r&&(u+=".bold"),o&&(u+=".italic"),i&&(u+=".underline"),l&&(u+=".strikethrough"),a&&(u+=".inverse"),u};async function un(e,t,n="replace"){let r=493;try{r=(await te.stat(e)).mode,M()&&console.log(`[${n}] Original file mode for ${e}: ${(r&parseInt("777",8)).toString(8)}`)}catch(o){M()&&console.log(`[${n}] Could not stat ${e} (error: ${o}), using default mode 755`)}try{await te.unlink(e),M()&&console.log(`[${n}] Unlinked ${e} to break hard links`)}catch(o){M()&&console.log(`[${n}] Could not unlink ${e}: ${o}`)}await te.writeFile(e,t),await te.chmod(e,r),M()&&console.log(`[${n}] Restored permissions to ${(r&parseInt("777",8)).toString(8)}`)}function F({color:e,backgroundColor:t,bold:n,dimColor:r,children:o}){const i=e?.startsWith("ansi:"),l=t?.startsWith("ansi:");if(i||l){if(Je.Children.toArray(o).some(m=>Je.isValidElement(m)))return s(c,{children:o});let u=Q;if(i){const m=e.slice(5);u=u[m]||u}if(l){const m=t.slice(5),v=m.startsWith("bg")?m:`bg${m.charAt(0).toUpperCase()}${m.slice(1)}`;u=u[v]||u}n&&(u=u.bold),r&&(u=u.dim);const g=Je.Children.toArray(o).map(m=>typeof m=="string"||typeof m=="number"?String(m):"").join("");return s(c,{children:u(g)})}return s(c,{color:e,backgroundColor:t,bold:n,dimColor:r,children:o})}function co({text:e,nonShimmerColors:t,shimmerColors:n,shimmerWidth:r=3,updateDuration:o=50,restartPoint:i=10}){const[l,a]=T(0);return xe(()=>{const u=setInterval(()=>{a(d=>{const g=d+1;return g>=e.length+i?-r:g})},o);return()=>clearInterval(u)},[e.length,i,o]),t.length!==n.length?(console.error("UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length"),s(c,{children:e})):s(c,{children:e.split("").map((u,d)=>{const g=d>=l&&d<l+r&&l<e.length,m=d%t.length,v=g?n[m]:t[m];return s(c,{color:v,children:u},d)})})}const uo=ct.cwd();function tt({theme:e}){const{ccVersion:t}=pe(ue);return h(f,{flexDirection:"column",paddingLeft:1,children:[s(f,{marginBottom:1,children:h(c,{bold:!0,children:["Preview: ",e.name]})}),s(f,{borderStyle:"single",borderColor:"gray",paddingX:1,children:h(f,{flexDirection:"column",children:[h(f,{flexDirection:"column",children:[h(c,{children:[s(F,{color:e.colors.clawd_body,children:" ▐"}),s(c,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"▛███▜"}),h(c,{children:[s(F,{color:e.colors.clawd_body,children:"▌ "})," ",s(c,{bold:!0,children:"Claude Code"})," ",t?`v${t}`:"v2.0.14"]})]}),h(c,{children:[s(F,{color:e.colors.clawd_body,children:"▝▜"}),s(c,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"█████"}),s(F,{color:e.colors.clawd_body,children:"▛▘"})," ",so()," · ",io()]}),h(F,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",uo]}),h(c,{children:[h(F,{color:e.colors.success,children:["Login successful. Press"," "]}),s(F,{bold:!0,color:e.colors.success,children:"Enter"}),h(F,{color:e.colors.success,children:[" ","to continue…"]})]})]}),s(c,{children:"╭─────────────────────────────────────────────╮"}),h(c,{children:["│ 1 function greet() ","{"," ","│"]}),h(c,{children:["│ 2"," ",s(F,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:'- console.log("'}),s(F,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),s(F,{backgroundColor:e.colors.diffRemoved,children:'");'})," ","│"]}),h(c,{children:["│ 2"," ",s(F,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:'+ console.log("'}),s(F,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),s(F,{backgroundColor:e.colors.diffAdded,children:'");'})," ","│"]}),s(F,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),h(F,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),h(c,{children:[s(F,{color:e.colors.warning,children:"│ "}),s(c,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),h(F,{color:e.colors.warning,children:[" ","│"]})]}),s(F,{color:e.colors.bashBorder,children:"───────────────────────────────────────────────"}),h(c,{children:[s(F,{color:e.colors.bashBorder,children:"!"}),s(c,{children:" ls"})]}),s(F,{color:e.colors.promptBorder,children:"───────────────────────────────────────────────"}),s(c,{children:h(c,{children:["> list the dir"," ",s(co,{text:"ultrathink",nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),s(F,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),h(c,{children:[s(F,{color:e.colors.planMode,children:"│ "}),h(F,{color:e.colors.permission,children:["Ready to code?"," "]}),s(c,{children:"Here is Claude's plan:"}),h(F,{color:e.colors.planMode,children:[" ","│"]})]}),s(F,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),h(c,{children:[s(F,{color:e.colors.permission,children:"│ "}),s(c,{bold:!0,children:"Permissions:"})," ",h(F,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",s(F,{color:e.colors.permission,children:"│"})]}),s(c,{children:"> list the dir"}),h(c,{children:[s(F,{color:e.colors.error,children:"●"}),s(c,{children:" Update(__init__.py)"})]}),h(c,{children:[s(c,{children:" ⎿ "}),s(F,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),h(c,{children:[" ","1"," ",h(F,{backgroundColor:e.colors.diffRemovedDimmed,children:["- import"," "]}),s(F,{backgroundColor:e.colors.diffRemovedWordDimmed,children:"os"})]}),h(c,{children:[" ","2"," ",h(F,{backgroundColor:e.colors.diffAddedDimmed,children:["+ import"," "]}),s(F,{backgroundColor:e.colors.diffAddedWordDimmed,children:"random"})]}),h(c,{children:[s(F,{color:e.colors.success,children:"●"}),s(c,{children:" List(.)"})]}),h(c,{children:[s(c,{children:"●"}),s(c,{children:" The directory "}),s(F,{color:e.colors.permission,children:"C:\\Users\\user"}),h(c,{children:[" ","contains ",s(c,{bold:!0,children:"123"})," files."]})]}),h(c,{children:[s(F,{color:e.colors.claude,children:"✻ Th"}),s(F,{color:e.colors.claudeShimmer,children:"ink"}),s(F,{color:e.colors.claude,children:"ing… "}),s(c,{children:"(esc to interrupt)"})]}),s(c,{children:s(F,{color:e.colors.autoAccept,children:"⏵⏵ accept edits on (shift+tab to cycle)"})}),s(c,{children:s(F,{color:e.colors.planMode,children:"⏸ plan mode on (shift+tab to cycle)"})}),s(c,{children:s(F,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Ke({colorKey:e,theme:t,bold:n=!1}){const r=t.colors[e];return e==="inverseText"?s(F,{color:r,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith("diff")?s(F,{backgroundColor:r,bold:n,color:t.colors.text,children:e}):s(F,{color:r,bold:n,children:e})}function rt({initialValue:e,onColorChange:t,onExit:n,colorKey:r,theme:o}){const i=Xe(e)||{h:0,s:50,l:50},l=qe(e)||{r:128,g:128,b:128},[a,u]=T(i),[d,g]=T(l),[m,v]=T("hsl"),[b,p]=T("h"),[w,x]=T(!1),[C,_]=T(!1);xe(()=>{const I=Xe(e),$=qe(e);I&&$&&(x(!0),u(I),g($),x(!1))},[e]),xe(()=>{if(!w&&C){const I=`rgb(${d.r},${d.g},${d.b})`;t(I)}},[a,d,w,C]),xe(()=>{_(!0)},[]);const k=I=>{if(dn(I)){const $=nt(I),y=Xe($),N=qe($);y&&N&&(x(!0),u(y),g(N),x(!1))}};de((I,$)=>{if(I.length>1&&!$.ctrl&&!$.meta){k(I);return}if($.return)n();else if($.escape)n();else if($.ctrl&&I==="a")v(y=>y==="hsl"?"rgb":"hsl"),p(y=>m==="hsl"?y==="h"?"r":y==="s"?"g":"b":y==="r"?"h":y==="g"?"s":"l");else if($.upArrow)p(m==="hsl"?y=>y==="h"?"l":y==="s"?"h":"s":y=>y==="r"?"b":y==="g"?"r":"g");else if($.downArrow||$.tab)p(m==="hsl"?y=>y==="h"?"s":y==="s"?"l":"h":y=>y==="r"?"g":y==="g"?"b":"r");else if($.leftArrow){const y=$.shift||$.ctrl||$.meta?-10:-1;P(y)}else if($.rightArrow){const y=$.shift||$.ctrl||$.meta?10:1;P(y)}});const P=I=>{x(!0),m==="hsl"?u($=>{const y={...$};b==="h"?y.h=Math.max(0,Math.min(359,$.h+I)):b==="s"?y.s=Math.max(0,Math.min(100,$.s+I)):b==="l"&&(y.l=Math.max(0,Math.min(100,$.l+I)));const[N,S,L]=V(y.h,y.s,y.l);return g({r:N,g:S,b:L}),y}):g($=>{const y={...$};b==="r"?y.r=Math.max(0,Math.min(255,$.r+I)):b==="g"?y.g=Math.max(0,Math.min(255,$.g+I)):b==="b"&&(y.b=Math.max(0,Math.min(255,$.b+I)));const N=O(y.r,y.g,y.b);return u(N),y}),x(!1)},O=(I,$,y)=>{const N=I/255,S=$/255,L=y/255,z=Math.max(N,S,L),H=Math.min(N,S,L),ne=z-H,ie=(z+H)/2;let $e=0;ne!==0&&($e=ie>.5?ne/(2-z-H):ne/(z+H));let be=0;return ne!==0&&(z===N?be=((S-L)/ne+(S<L?6:0))/6:z===S?be=((L-N)/ne+2)/6:be=((N-S)/ne+4)/6),{h:Math.round(be*360),s:Math.round($e*100),l:Math.round(ie*100)}},V=(I,$,y)=>{I/=360,$/=100,y/=100;const N=(1-Math.abs(2*y-1))*$,S=N*(1-Math.abs(I*6%2-1)),L=y-N/2;let z=0,H=0,ne=0;return 0<=I&&I<1/6?(z=N,H=S,ne=0):1/6<=I&&I<2/6?(z=S,H=N,ne=0):2/6<=I&&I<3/6?(z=0,H=N,ne=S):3/6<=I&&I<4/6?(z=0,H=S,ne=N):4/6<=I&&I<5/6?(z=S,H=0,ne=N):5/6<=I&&I<1&&(z=N,H=0,ne=S),[Math.round((z+L)*255),Math.round((H+L)*255),Math.round((ne+L)*255)]},K=()=>{const I=[],$=[[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 y=0;y<40;y++){const S=y/39*($.length-1),L=Math.floor(S),z=Math.ceil(S),H=S-L,[ne,ie,$e]=$[L],[be,j,R]=$[z],D=Math.round(ne+(be-ne)*H),ee=Math.round(ie+(j-ie)*H),W=Math.round($e+(R-$e)*H);I.push(s(c,{backgroundColor:`rgb(${D},${ee},${W})`,children:" "},y))}return I},U=()=>{const I=[];for(let $=0;$<40;$++){const y=$/39*100,[N,S,L]=V(a.h,y,a.l);I.push(s(c,{backgroundColor:`rgb(${N},${S},${L})`,children:" "},$))}return I},A=()=>{const I=[];for(let $=0;$<40;$++){const y=$/39*100,[N,S,L]=V(a.h,a.s,y);I.push(s(c,{backgroundColor:`rgb(${N},${S},${L})`,children:" "},$))}return I},B=()=>{const[I,$,y]=V(a.h,a.s,a.l);return`rgb(${I},${$},${y})`},E=(I,$,y)=>{const N=S=>S.toString(16).padStart(2,"0");return`#${N(I)}${N($)}${N(y)}`},Y=()=>{const I=[];for(let $=0;$<40;$++){const y=Math.round($/39*255);I.push(s(c,{backgroundColor:`rgb(${y},${d.g},${d.b})`,children:" "},$))}return I},X=()=>{const I=[];for(let $=0;$<40;$++){const y=Math.round($/39*255);I.push(s(c,{backgroundColor:`rgb(${d.r},${y},${d.b})`,children:" "},$))}return I},oe=()=>{const I=[];for(let $=0;$<40;$++){const y=Math.round($/39*255);I.push(s(c,{backgroundColor:`rgb(${d.r},${d.g},${y})`,children:" "},$))}return I},q=(I,$)=>Math.round(I/$*39);return h(f,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[h(f,{flexDirection:"column",children:[s(c,{bold:!0,children:"Color Picker"}),h(f,{marginBottom:1,flexDirection:"column",children:[s(c,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),s(c,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),s(c,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),s(c,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),s(c,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),s(c,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),m==="hsl"?h(he,{children:[h(f,{marginBottom:1,children:[s(f,{width:25,children:h(c,{color:b==="h"?"yellow":"white",children:[b==="h"?"❯ ":" ","Hue (",a.h,"°):"]})}),s(f,{children:K().map((I,$)=>s(ke,{children:$===q(a.h,360)?s(c,{children:"|"}):I},$))})]}),h(f,{marginBottom:1,children:[s(f,{width:25,children:h(c,{color:b==="s"?"yellow":"white",children:[b==="s"?"❯ ":" ","Saturation (",a.s,"%):"]})}),s(f,{children:U().map((I,$)=>s(ke,{children:$===q(a.s,100)?s(c,{children:"|"}):I},$))})]}),h(f,{marginBottom:1,children:[s(f,{width:25,children:h(c,{color:b==="l"?"yellow":"white",children:[b==="l"?"❯ ":" ","Lightness (",a.l,"%):"]})}),s(f,{children:A().map((I,$)=>s(ke,{children:$===q(a.l,100)?s(c,{children:"|"}):I},$))})]})]}):h(he,{children:[h(f,{marginBottom:1,children:[s(f,{width:25,children:h(c,{color:b==="r"?"yellow":"white",children:[b==="r"?"❯ ":" ","Red (",d.r,"):"]})}),s(f,{children:Y().map((I,$)=>s(ke,{children:$===q(d.r,255)?s(c,{children:"|"}):I},$))})]}),h(f,{marginBottom:1,children:[s(f,{width:25,children:h(c,{color:b==="g"?"yellow":"white",children:[b==="g"?"❯ ":" ","Green (",d.g,"):"]})}),s(f,{children:X().map((I,$)=>s(ke,{children:$===q(d.g,255)?s(c,{children:"|"}):I},$))})]}),h(f,{marginBottom:1,children:[s(f,{width:25,children:h(c,{color:b==="b"?"yellow":"white",children:[b==="b"?"❯ ":" ","Blue (",d.b,"):"]})}),s(f,{children:oe().map((I,$)=>s(ke,{children:$===q(d.b,255)?s(c,{children:"|"}):I},$))})]})]}),h(f,{marginBottom:1,children:[s(c,{children:"Current: "}),s(c,{backgroundColor:B(),children:" "})]}),h(f,{flexDirection:"row",justifyContent:"space-between",children:[h(f,{flexDirection:"column",children:[s(c,{dimColor:!0,children:"Hex "}),r?.startsWith("diff")?s(c,{backgroundColor:B(),color:o?.colors?.text||"white",bold:!0,children:E(d.r,d.g,d.b)}):r==="inverseText"?s(c,{color:B(),backgroundColor:o?.colors?.permission,bold:!0,children:E(d.r,d.g,d.b)}):s(c,{color:B(),bold:!0,children:E(d.r,d.g,d.b)})]}),h(f,{flexDirection:"column",children:[s(c,{dimColor:!0,children:"RGB "}),r?.startsWith("diff")?s(c,{backgroundColor:B(),color:o?.colors?.text||"white",bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):r==="inverseText"?s(c,{color:B(),backgroundColor:o?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):s(c,{color:B(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),h(f,{flexDirection:"column",children:[s(c,{dimColor:!0,children:"HSL "}),r?.startsWith("diff")?s(c,{backgroundColor:B(),color:o?.colors?.text||"white",bold:!0,children:`hsl(${a.h}, ${a.s}%, ${a.l}%)`}):r==="inverseText"?s(c,{color:B(),backgroundColor:o?.colors?.permission,bold:!0,children:`hsl(${a.h}, ${a.s}%, ${a.l}%)`}):s(c,{color:B(),bold:!0,children:`hsl(${a.h}, ${a.s}%, ${a.l}%)`})]})]})]})}function qe(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 n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){const r=n[1];return{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16)}}return null}function Xe(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 n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const o=parseInt(n[1])/255,i=parseInt(n[2])/255,l=parseInt(n[3])/255,a=Math.max(o,i,l),u=Math.min(o,i,l),d=a-u,g=(a+u)/2;let m=0;d!==0&&(m=g>.5?d/(2-a-u):d/(a+u));let v=0;return d!==0&&(a===o?v=((i-l)/d+(i<l?6:0))/6:a===i?v=((l-o)/d+2)/6:v=((o-i)/d+4)/6),{h:Math.round(v*360),s:Math.round(m*100),l:Math.round(g*100)}}const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const o=r[1],i=parseInt(o.substr(0,2),16)/255,l=parseInt(o.substr(2,2),16)/255,a=parseInt(o.substr(4,2),16)/255,u=Math.max(i,l,a),d=Math.min(i,l,a),g=u-d,m=(u+d)/2;let v=0;g!==0&&(v=m>.5?g/(2-u-d):g/(u+d));let b=0;return g!==0&&(u===i?b=((l-a)/g+(l<a?6:0))/6:u===l?b=((a-i)/g+2)/6:b=((i-l)/g+4)/6),{h:Math.round(b*360),s:Math.round(v*100),l:Math.round(m*100)}}return{h:0,s:50,l:50}}function go({onBack:e,themeId:t}){const{settings:{themes:n},updateSettings:r}=pe(ue),[o,i]=T(t),l=n.find(A=>A.id===o)||n[0],[a,u]=T("rgb"),[d,g]=T(0),[m,v]=T(null),[b,p]=T(null),[w,x]=T(""),[C,_]=T(""),k=En(A=>{r(B=>{const E=B.themes.findIndex(Y=>Y.id===o);E!==-1&&A(B.themes[E])})},[o,r]),P=A=>{if(d>=2&&dn(A)){const B=nt(A),E=d-2,Y=O[E];k(X=>{X.colors[Y]=B})}};de((A,B)=>{if(m===null&&b===null){if(A.length>1&&!B.ctrl&&!B.meta){P(A);return}if(B.escape)e();else if(B.ctrl&&A==="a")u(E=>E==="rgb"?"hex":E==="hex"?"hsl":"rgb");else if(B.upArrow)g(E=>Math.max(0,E-1));else if(B.downArrow)g(E=>Math.min(O.length+1,E+1));else if(B.return)if(d===0)p("name"),x(l.name),_(l.name);else if(d===1)p("id"),x(l.id),_(l.id);else{const E=d-2,Y=O[E],X=l.colors[Y];v(E),x(X),_(X)}}else if(m!==null)B.ctrl&&A==="a"&&u(E=>E==="rgb"?"hex":E==="hex"?"hsl":"rgb");else if(b!==null)if(B.return){if(b==="id"){const E=o;i(w),r(Y=>{const X=Y.themes.findIndex(oe=>oe.id===E);X!==-1&&(Y.themes[X].id=w)})}else k(E=>{E.name=w});p(null),x(""),_("")}else B.escape?(p(null),x(""),_("")):B.backspace||B.delete?x(E=>E.slice(0,-1)):A&&x(E=>E+A)});const O=Object.keys(l.colors),V=(A,B)=>{const E=A.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!E)return A;const Y=parseInt(E[1]),X=parseInt(E[2]),oe=parseInt(E[3]);switch(B){case"hex":{const q=I=>I.toString(16).padStart(2,"0");return`#${q(Y)}${q(X)}${q(oe)}`}case"hsl":{const q=Y/255,I=X/255,$=oe/255,y=Math.max(q,I,$),N=Math.min(q,I,$),S=y-N,L=(y+N)/2;let z=0;S!==0&&(z=L>.5?S/(2-y-N):S/(y+N));let H=0;return S!==0&&(y===q?H=((I-$)/S+(I<$?6:0))/6:y===I?H=(($-q)/S+2)/6:H=((q-I)/S+4)/6),`hsl(${Math.round(H*360)}, ${Math.round(z*100)}%, ${Math.round(L*100)}%)`}case"rgb":default:return A}},K=A=>({autoAccept:"Auto-accept edits mode indicator",bashBorder:"Bash command border",claude:"Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.",claudeShimmer:"Color used for the shimmering effect on the thinking verb.",claudeBlue_FOR_SYSTEM_SPINNER:"System spinner color (blue variant)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"System spinner shimmer color (blue variant)",permission:"Permission prompt color",permissionShimmer:"Permission prompt shimmer color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",promptBorder:"Input prompt border color",promptBorderShimmer:"Input prompt border shimmer color",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",inactive:"Inactive/dimmed text. Used for line numbers and less prominent text.",subtle:"Subtle text. Used for help text and secondary information.",suggestion:"Suggestion text color. Used for suggestions for theme names and various other things.",remember:"Remember/note color. Used for various text relating to memories.",background:"Background color for certain UI elements",success:"Success indicator. Used for the bullet on successful tool calls, and various success messages (such as sign in successful).",error:"Error indicator",warning:"Warning indicator",warningShimmer:"Warning shimmer color",diffAdded:"Added diff background",diffRemoved:"Removed diff background",diffAddedDimmed:"Added diff background (dimmed)",diffRemovedDimmed:"Removed diff background (dimmed)",diffAddedWord:"Added word highlight",diffRemovedWord:"Removed word highlight",diffAddedWordDimmed:"Added word highlight (dimmed)",diffRemovedWordDimmed:"Removed word highlight (dimmed)",red_FOR_SUBAGENTS_ONLY:"Red color for sub agents",blue_FOR_SUBAGENTS_ONLY:"Blue color for sub agents",green_FOR_SUBAGENTS_ONLY:"Green color for sub agents",yellow_FOR_SUBAGENTS_ONLY:"Yellow color for sub agents",purple_FOR_SUBAGENTS_ONLY:"Purple color for sub agents",orange_FOR_SUBAGENTS_ONLY:"Orange color for sub agents",pink_FOR_SUBAGENTS_ONLY:"Pink color for sub agents",cyan_FOR_SUBAGENTS_ONLY:"Cyan color for sub agents",professionalBlue:"Professional blue color for business contexts?",rainbow_red:'"ultrathink" rainbow - red',rainbow_orange:'"ultrathink" rainbow - orange',rainbow_yellow:'"ultrathink" rainbow - yellow',rainbow_green:'"ultrathink" rainbow - green',rainbow_blue:'"ultrathink" rainbow - blue',rainbow_indigo:'"ultrathink" rainbow - indigo',rainbow_violet:'"ultrathink" rainbow - violet',rainbow_red_shimmer:'"ultrathink" rainbow (shimmer) - red',rainbow_orange_shimmer:'"ultrathink" rainbow (shimmer) - orange',rainbow_yellow_shimmer:'"ultrathink" rainbow (shimmer) - yellow',rainbow_green_shimmer:'"ultrathink" rainbow (shimmer) - green',rainbow_blue_shimmer:'"ultrathink" rainbow (shimmer) - blue',rainbow_indigo_shimmer:'"ultrathink" rainbow (shimmer) - indigo',rainbow_violet_shimmer:'"ultrathink" rainbow (shimmer) - violet',clawd_body:'"Clawd" character body color',clawd_background:'"Clawd" character background color',userMessageBackground:"Background color for user messages",bashMessageBackgroundColor:"Background color for bash command output",memoryBackgroundColor:"Background color for memory/context information",rate_limit_fill:"Rate limit indicator fill color",rate_limit_empty:"Rate limit indicator empty/background color"})[A]||"",U=Math.max(...O.map(A=>A.length));return h(f,{children:[h(f,{flexDirection:"column",width:"50%",children:[s(f,{children:h(me,{children:["Editing theme “",l.name,"” (",l.id,")"]})}),m===null&&b===null?h(he,{children:[h(f,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"enter to edit theme name, id, or color"}),s(c,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),s(c,{dimColor:!0,children:"paste color from clipboard (when on color)"}),s(c,{dimColor:!0,children:"esc to go back"})]}),d<2?h(f,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[s(c,{bold:!0,children:d===0?"Theme Name":"Theme ID"}),s(c,{children:d===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):h(f,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:l.colors[O[d-2]],flexDirection:"column",paddingLeft:1,children:[s(Ke,{colorKey:O[d-2],theme:l,bold:!0}),s(c,{children:K(O[d-2])})]}),h(f,{flexDirection:"column",children:[h(f,{children:[s(c,{color:d===0?"yellow":"white",children:d===0?"❯ ":" "}),s(c,{bold:!0,children:"Name: "}),s(c,{children:l.name})]}),h(f,{marginBottom:1,children:[s(c,{color:d===1?"yellow":"white",children:d===1?"❯ ":" "}),s(c,{bold:!0,children:"ID: "}),s(c,{children:l.id})]}),(()=>{if(d<2){const q=O.slice(0,20);return h(he,{children:[q.map((I,$)=>{const y=$+2;return h(f,{children:[s(c,{color:d===y?"yellow":"white",children:d===y?"❯ ":" "}),s(f,{width:U+2,children:s(c,{children:s(Ke,{colorKey:I,theme:l,bold:!0})})}),s(F,{color:l.colors[I],children:V(l.colors[I],a)})]},I)}),O.length>20&&h(c,{color:"gray",dimColor:!0,children:[" ","↓ ",O.length-20," more below"]})]})}const B=d-2,E=Math.max(0,B-Math.floor(20/2)),Y=Math.min(O.length,E+20),X=Math.max(0,Y-20),oe=O.slice(X,Y);return h(he,{children:[X>0&&h(c,{color:"gray",dimColor:!0,children:[" ","↑ ",X," more above"]}),oe.map((q,I)=>{const y=X+I+2;return h(f,{children:[s(c,{color:d===y?"yellow":"white",children:d===y?"❯ ":" "}),s(f,{width:U+2,children:s(c,{children:s(Ke,{colorKey:q,theme:l,bold:!0})})}),s(F,{color:l.colors[q],children:V(l.colors[q],a)})]},q)}),Y<O.length&&h(c,{color:"gray",dimColor:!0,children:[" ","↓ ",O.length-Y," more below"]})]})})()]})]}):b?h(f,{flexDirection:"column",marginTop:1,children:[h(c,{children:["Editing ",b==="name"?"theme name":"theme ID",":"]}),s(f,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:s(c,{children:w})}),s(c,{dimColor:!0,children:"enter to save, esc to cancel"})]}):s(rt,{initialValue:C,colorKey:O[m],theme:l,onColorChange:A=>{x(A),k(B=>{B.colors[O[m]]=A})},onExit:()=>{k(A=>{A.colors[O[m]]=w}),v(null),x(""),_("")}})]}),s(f,{width:"50%",children:s(tt,{theme:l})})]})}function ho(e){return e.map(t=>`${t.name} (${t.id})`)}function fo({onBack:e}){const{settings:{themes:t},updateSettings:n}=pe(ue),[r,o]=T(0),[i,l]=T(null),[a,u]=T(!0),d=()=>{const w={colors:{...(t[0]||Z.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};n(x=>{x.themes.push(w)}),l(w.id),u(!1)},g=p=>{t.length<=1||(n(w=>{w.themes=w.themes.filter(x=>x.id!==p)}),r>=t.length-1&&o(Math.max(0,t.length-2)))},m=()=>{n(p=>{p.themes=[...Z.themes]}),o(0)};if(de((p,w)=>{if(w.escape)e();else if(w.upArrow)o(x=>Math.max(0,x-1));else if(w.downArrow)o(x=>Math.min(t.length-1,x+1));else if(w.return){const x=t[r];x&&(l(x.id),u(!1))}else if(p==="n")d();else if(p==="d"){const x=t[r];x&&g(x.id)}else w.ctrl&&p==="r"&&m()},{isActive:a}),i)return s(go,{themeId:i,onBack:()=>{l(null),u(!0)}});const v=ho(t),b=t.find(p=>v[r]?.includes(`(${p.id})`))||t[0];return t.length===0?s(f,{children:h(f,{flexDirection:"column",width:"100%",children:[s(me,{children:"Themes"}),h(f,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"n to create a new theme"}),s(c,{dimColor:!0,children:"esc to go back"})]}),s(c,{children:"No themes available!"})]})}):h(f,{children:[h(f,{flexDirection:"column",width:"50%",children:[s(me,{children:"Themes"}),h(f,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"n to create a new theme"}),s(c,{dimColor:!0,children:"d to delete a theme"}),s(c,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),s(c,{dimColor:!0,children:"enter to edit theme"}),s(c,{dimColor:!0,children:"esc to go back"})]}),s(f,{flexDirection:"column",children:v.map((p,w)=>h(c,{color:r===w?"yellow":void 0,children:[r===w?"❯ ":" ",p]},w))})]}),s(f,{width:"50%",children:s(tt,{theme:b})})]})}function mo({onBack:e}){const{settings:{thinkingVerbs:{format:t,verbs:n},themes:r},updateSettings:o}=pe(ue),i=["format","verbs"],[l,a]=T(0),u=i[l],[d,g]=T(0),[m,v]=T(!1),[b,p]=T(""),[w,x]=T(!1),[C,_]=T(!1),[k,P]=T(t),O=cn(),K=(r.find(A=>A.id===O)||r.find(A=>A.id==="dark"))?.colors.claude||"rgb(215,119,87)";de((A,B)=>{if(C){B.return?(o(E=>{E.thinkingVerbs.format=k}),_(!1)):B.escape?(P(t),_(!1)):B.backspace||B.delete?P(E=>E.slice(0,-1)):A&&P(E=>E+A);return}if(m||w){B.return&&b.trim()?(w?(o(E=>{E.thinkingVerbs.verbs.push(b.trim())}),x(!1)):(o(E=>{E.thinkingVerbs.verbs[d]=b.trim()}),v(!1)),p("")):B.escape?(p(""),v(!1),x(!1)):B.backspace||B.delete?p(E=>E.slice(0,-1)):A&&p(E=>E+A);return}B.escape?e():B.return?u==="format"&&(P(t),_(!0)):B.tab?B.shift?a(E=>E===0?i.length-1:E-1):a(E=>E===i.length-1?0:E+1):B.upArrow?u==="verbs"&&n.length>0&&g(E=>E>0?E-1:n.length-1):B.downArrow?u==="verbs"&&n.length>0&&g(E=>E<n.length-1?E+1:0):A==="e"&&u==="verbs"?n.length>0&&(p(n[d]),v(!0)):A==="d"&&u==="verbs"?n.length>1&&(o(E=>{E.thinkingVerbs.verbs=E.thinkingVerbs.verbs.filter((Y,X)=>X!==d)}),d>=n.length-1&&g(Math.max(0,n.length-2))):A==="n"&&u==="verbs"?(x(!0),p("")):B.ctrl&&A==="r"&&u==="verbs"&&(o(E=>{E.thinkingVerbs.verbs=[...Z.thinkingVerbs.verbs]}),g(0))});const U=50;return h(f,{children:[h(f,{flexDirection:"column",width:`${100-U}%`,children:[h(f,{marginBottom:1,flexDirection:"column",children:[s(me,{children:"Thinking Verbs"}),h(f,{flexDirection:"column",children:[s(c,{dimColor:!0,children:u==="format"?"enter to edit format":"changes auto-saved"}),s(c,{dimColor:!0,children:"esc to go back"}),s(c,{dimColor:!0,children:"tab to switch sections"})]})]}),s(f,{marginBottom:1,children:s(c,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),h(f,{flexDirection:"column",children:[h(c,{children:[s(c,{color:u==="format"?"yellow":void 0,children:u==="format"?"❯ ":" "}),s(c,{bold:!0,color:u==="format"?"yellow":void 0,children:"Format"})]}),u==="format"&&(C?h(c,{dimColor:!0,children:[" ","enter to save"]}):h(c,{dimColor:!0,children:[" ","enter to edit"]}))]}),s(f,{marginLeft:2,marginBottom:1,children:s(f,{borderStyle:"round",borderColor:C?"yellow":"gray",children:s(c,{children:C?k:t})})}),s(f,{children:h(c,{children:[s(c,{color:u==="verbs"?"yellow":void 0,children:u==="verbs"?"❯ ":" "}),s(c,{bold:!0,color:u==="verbs"?"yellow":void 0,children:"Verbs"})]})}),u==="verbs"&&s(f,{flexDirection:"column",children:h(c,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),s(f,{marginLeft:2,marginBottom:1,children:h(f,{flexDirection:"column",children:[(()=>{const B=Math.max(0,d-Math.floor(4)),E=Math.min(n.length,B+8),Y=Math.max(0,E-8),X=n.slice(Y,E);return h(he,{children:[Y>0&&h(c,{color:"gray",dimColor:!0,children:[" ","↑ ",Y," more above"]}),X.map((oe,q)=>{const I=Y+q;return h(c,{color:u==="verbs"&&I===d?"cyan":void 0,children:[u==="verbs"&&I===d?"❯ ":" ",oe]},I)}),E<n.length&&h(c,{color:"gray",dimColor:!0,children:[" ","↓ ",n.length-E," more below"]})]})})(),w&&h(f,{alignItems:"center",children:[s(c,{color:"yellow",children:"❯ "}),s(f,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:b})})]}),m&&h(f,{marginTop:1,alignItems:"center",children:[s(c,{children:"Editing: "}),s(f,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:b})})]})]})})]}),h(f,{width:`${U}%`,flexDirection:"column",children:[s(f,{marginBottom:1,children:s(c,{bold:!0,children:"Preview"})}),s(f,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:h(c,{children:[h(c,{color:K,children:["✻ ",t.replace(/\{\}/g,n[d])," "]}),s(c,{children:"(esc to interrupt)"})]})})]})]})}const _e=[{name:"Default",phases:Z.thinkingStyle.phases,reverseMirror:Z.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 po({onBack:e}){const{settings:{thinkingStyle:{phases:t,updateInterval:n,reverseMirror:r},themes:o},updateSettings:i}=pe(ue),l=["reverseMirror","updateInterval","phases","presets"],[a,u]=T(0),d=l[a],[g,m]=T(0),[v,b]=T(0),[p,w]=T(!1),[x,C]=T(""),[_,k]=T(!1),[P,O]=T(!1),[V,K]=T(n.toString()),[U,A]=T(0),B=cn(),Y=(o.find(y=>y.id===B)||o.find(y=>y.id==="dark"))?.colors.claude||"rgb(215,119,87)";xe(()=>{if(t.length>0){const y=r?[...t,...[...t].reverse().slice(1,-1)]:t,N=setInterval(()=>{A(S=>(S+1)%y.length)},n);return()=>clearInterval(N)}},[t,n,r]),de((y,N)=>{if(P){if(N.return){const S=parseInt(V);!isNaN(S)&&S>0&&i(L=>{L.thinkingStyle.updateInterval=S}),O(!1)}else N.escape?(K(n.toString()),O(!1)):N.backspace||N.delete?K(S=>S.slice(0,-1)):y&&y.match(/^[0-9]$/)&&K(S=>S+y);return}if(p||_){if(N.return&&x.length){const S=_?[...t,x]:t.map((L,z)=>z===g?x:L);i(L=>{L.thinkingStyle.phases=S}),w(!1),C("")}else N.escape?(C(""),w(!1),k(!1)):N.backspace||N.delete?C(S=>S.slice(0,-1)):y&&C(S=>S+y);return}if(N.escape)e();else if(N.return)if(d==="updateInterval")K(n.toString()),O(!0);else if(d==="presets"){const S=_e[v];i(L=>{L.thinkingStyle.phases=[...S.phases],L.thinkingStyle.reverseMirror=S.reverseMirror})}else d==="reverseMirror"&&i(S=>{S.thinkingStyle.reverseMirror=!S.thinkingStyle.reverseMirror});else if(N.tab)N.shift?u(S=>S===0?l.length-1:S-1):u(S=>S===l.length-1?0:S+1);else if(N.upArrow)d==="phases"&&t.length>0?m(S=>S>0?S-1:t.length-1):d==="presets"&&b(S=>S>0?S-1:_e.length-1);else if(N.downArrow)d==="phases"&&t.length>0?m(S=>S<t.length-1?S+1:0):d==="presets"&&b(S=>S<_e.length-1?S+1:0);else if(y===" ")d==="reverseMirror"&&i(S=>{S.thinkingStyle.reverseMirror=!S.thinkingStyle.reverseMirror});else if(y==="e"&&d==="phases")t.length>0&&(C(t[g]),w(!0));else if(y==="a"&&d==="phases")k(!0),C("");else if(y==="d"&&d==="phases")t.length>1&&(i(S=>{S.thinkingStyle.phases=t.filter((L,z)=>z!==g)}),g>=t.length&&m(Math.max(0,t.length-1)));else if(y==="w"&&d==="phases"){if(g>0){const S=[...t];[S[g-1],S[g]]=[S[g],S[g-1]],i(L=>{L.thinkingStyle.phases=S}),m(L=>L-1)}}else if(y==="s"&&d==="phases"){if(g<t.length-1){const S=[...t];[S[g],S[g+1]]=[S[g+1],S[g]],i(L=>{L.thinkingStyle.phases=S}),m(L=>L+1)}}else N.ctrl&&y==="r"&&(i(S=>{S.thinkingStyle=Z.thinkingStyle}),m(0),b(0))});const X=r?"●":"○",oe=50,I=r?[...t,...[...t].reverse().slice(1,-1)]:t,$=I.length>0?I[U]:"·";return s(f,{children:h(f,{flexDirection:"column",width:"100%",children:[h(f,{flexDirection:"row",width:"100%",children:[h(f,{marginBottom:1,flexDirection:"column",width:`${100-oe}%`,children:[s(me,{children:"Thinking style"}),h(f,{flexDirection:"column",children:[h(c,{dimColor:!0,children:["enter to"," ",d==="updateInterval"?"edit interval":d==="presets"?"apply preset":"save"]}),s(c,{dimColor:!0,children:"esc to go back"}),s(c,{dimColor:!0,children:"tab to switch sections"})]})]}),h(f,{width:`${oe}%`,flexDirection:"column",children:[s(f,{children:s(c,{bold:!0,children:"Preview"})}),h(f,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[s(f,{width:($?.length??0)+1,children:s(c,{color:Y,children:$})}),h(c,{children:[s(c,{color:Y,children:"Thinking… "}),s(c,{children:"(esc to interrupt)"})]})]})]})]}),h(f,{flexDirection:"row",gap:4,children:[h(f,{flexDirection:"column",children:[h(c,{children:[s(c,{color:d==="reverseMirror"?"yellow":void 0,children:d==="reverseMirror"?"❯ ":" "}),s(c,{bold:!0,color:d==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),d==="reverseMirror"&&h(c,{dimColor:!0,children:[" ","space to toggle"]}),s(f,{marginLeft:2,marginBottom:1,children:h(c,{children:[X," ",r?"Enabled":"Disabled"]})})]}),h(f,{flexDirection:"column",children:[h(c,{children:[s(c,{color:d==="updateInterval"?"yellow":void 0,children:d==="updateInterval"?"❯ ":" "}),s(c,{bold:!0,color:d==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),d==="updateInterval"&&(P?h(c,{dimColor:!0,children:[" ","enter to save"]}):h(c,{dimColor:!0,children:[" ","enter to edit"]})),s(f,{marginLeft:2,marginBottom:1,children:s(f,{borderStyle:"round",borderColor:P?"yellow":"gray",children:s(c,{children:P?V:n})})})]})]}),s(f,{children:h(c,{children:[s(c,{color:d==="phases"?"yellow":void 0,children:d==="phases"?"❯ ":" "}),s(c,{bold:!0,color:d==="phases"?"yellow":void 0,children:"Phases"})]})}),d==="phases"&&s(f,{marginBottom:1,flexDirection:"column",children:h(c,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),s(f,{marginLeft:2,marginBottom:1,children:h(f,{flexDirection:"column",children:[(()=>{const N=Math.max(0,g-Math.floor(4)),S=Math.min(t.length,N+8),L=Math.max(0,S-8),z=t.slice(L,S);return h(he,{children:[L>0&&h(c,{color:"gray",dimColor:!0,children:[" ","↑ ",L," more above"]}),z.map((H,ne)=>{const ie=L+ne;return h(c,{color:d==="phases"&&ie===g?"cyan":void 0,children:[d==="phases"&&ie===g?"❯ ":" ",H]},ie)}),S<t.length&&h(c,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-S," more below"]})]})})(),_&&h(f,{children:[s(c,{color:"yellow",children:"❯ "}),s(f,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:x})})]}),p&&h(f,{marginTop:1,children:[s(c,{children:"Editing: "}),s(f,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:x})})]})]})}),s(f,{children:h(c,{children:[s(c,{color:d==="presets"?"yellow":void 0,children:d==="presets"?"❯ ":" "}),s(c,{bold:!0,color:d==="presets"?"yellow":void 0,children:"Presets"})]})}),d==="presets"&&h(c,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),s(f,{marginLeft:2,marginBottom:1,children:s(f,{flexDirection:"column",children:(()=>{const N=Math.max(0,v-Math.floor(4)),S=Math.min(_e.length,N+8),L=Math.max(0,S-8),z=_e.slice(L,S);return h(he,{children:[L>0&&h(c,{color:"gray",dimColor:!0,children:[" ","↑ ",L," more above"]}),z.map((H,ne)=>{const ie=L+ne;return h(c,{color:d==="presets"&&ie===v?"cyan":void 0,children:[d==="presets"&&ie===v?"❯ ":" ",H.name," ",H.phases.join("")]},ie)}),S<_e.length&&h(c,{color:"gray",dimColor:!0,children:[" ","↓ ",_e.length-S," more below"]})]})})()})}),s(f,{marginTop:1,children:s(c,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const Pe=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function bo({onBack:e}){const{settings:t,updateSettings:n}=pe(ue),[r,o]=T("prefix"),[i,l]=T(0),[a,u]=T(!1),[d,g]=T(()=>t.userMessageDisplay.prefix.format),[m,v]=T(0),[b,p]=T(()=>[...t.userMessageDisplay.prefix.styling]),[w,x]=T(()=>t.userMessageDisplay.prefix.foreground_color),[C,_]=T(()=>t.userMessageDisplay.prefix.background_color),[k,P]=T(0),[O,V]=T(0),[K,U]=T(()=>[...t.userMessageDisplay.message.styling]),[A,B]=T(()=>t.userMessageDisplay.message.foreground_color),[E,Y]=T(()=>t.userMessageDisplay.message.background_color),[X,oe]=T(null),[q,I]=T(""),$=cn(),y=t.themes?.find(j=>j.id===$)||t.themes?.[0],N=["format","styling","foreground","background"],S=["styling","foreground","background"],L=N[i],z=S[k],H=(j,R)=>{n(D=>{const ee=j==="prefix"?D.userMessageDisplay.prefix:D.userMessageDisplay.message;R(ee)})},ne=j=>{n(R=>{j==="prefix"?R.userMessageDisplay.prefix={...Z.userMessageDisplay.prefix}:R.userMessageDisplay.message={...Z.userMessageDisplay.message}}),j==="prefix"?(g(Z.userMessageDisplay.prefix.format),p([...Z.userMessageDisplay.prefix.styling]),x(Z.userMessageDisplay.prefix.foreground_color),_(Z.userMessageDisplay.prefix.background_color)):(U([...Z.userMessageDisplay.message.styling]),B(Z.userMessageDisplay.message.foreground_color),Y(Z.userMessageDisplay.message.background_color))};xe(()=>{const j=t.userMessageDisplay.prefix;g(j.format),p([...j.styling]),x(j.foreground_color),_(j.background_color);const R=t.userMessageDisplay.message;U([...R.styling]),B(R.foreground_color),Y(R.background_color)},[]),de((j,R)=>{if(a){if(R.return)H("prefix",D=>{D.format=d}),u(!1);else if(R.escape){const D=t.userMessageDisplay.prefix;g(D.format),u(!1)}else R.backspace||R.delete?g(D=>D.slice(0,-1)):j&&g(D=>D+j);return}if(X===null){if(R.escape)e();else if(R.ctrl&&j==="r")ne(r);else if(R.leftArrow||R.rightArrow)o(D=>D==="prefix"?"message":"prefix");else if(R.tab)r==="prefix"?R.shift?l(D=>D===0?N.length-1:D-1):l(D=>D===N.length-1?0:D+1):R.shift?P(D=>D===0?S.length-1:D-1):P(D=>D===S.length-1?0:D+1);else if(R.return)r==="prefix"?L==="format"?u(!0):L==="foreground"?(I(w),oe({column:"prefix",type:"foreground"})):L==="background"&&(I(C),oe({column:"prefix",type:"background"})):z==="foreground"?(I(A),oe({column:"message",type:"foreground"})):z==="background"&&(I(E),oe({column:"message",type:"background"}));else if(R.upArrow)r==="prefix"&&L==="styling"?v(D=>Math.max(0,D-1)):r==="message"&&z==="styling"&&V(D=>Math.max(0,D-1));else if(R.downArrow)r==="prefix"&&L==="styling"?v(D=>Math.min(Pe.length-1,D+1)):r==="message"&&z==="styling"&&V(D=>Math.min(Pe.length-1,D+1));else if(j===" "){if(r==="prefix"&&L==="styling"){const D=Pe[m].value,ee=b.indexOf(D)>=0?b.filter(W=>W!==D):[...b,D];p(ee),H("prefix",W=>{W.styling=[...ee]})}else if(r==="message"&&z==="styling"){const D=Pe[O].value,ee=K.indexOf(D)>=0?K.filter(W=>W!==D):[...K,D];U(ee),H("message",W=>{W.styling=[...ee]})}}}});const ie=(j,R,D=!0)=>{const ee=D?R==="prefix"?b:K:[],W=D?R==="prefix"?w:A:"rgb(255,255,255)",Oe=D?R==="prefix"?C:E:"rgb(0,0,0)",Te=W==="rgb(0,0,0)"&&Oe==="rgb(0,0,0)",Ve=ee.length>0;return Te&&!Ve?s(c,{children:j}):s(c,{bold:ee.includes("bold"),italic:ee.includes("italic"),underline:ee.includes("underline"),strikethrough:ee.includes("strikethrough"),inverse:ee.includes("inverse"),color:Te?void 0:W,backgroundColor:Te?void 0:Oe,children:j})},$e=(j=!0)=>h(c,{children:[d&&h(he,{children:[ie(d,"prefix",j)," "]}),ie("list the dir","message",j)]}),be=j=>{const R=r===j,W=(j==="prefix"?N:S)[j==="prefix"?i:k],Oe=j==="prefix"?m:O,Te=j==="prefix"?b:K,Ve=j==="prefix"?w:A,gn=j==="prefix"?C:E;return h(f,{flexDirection:"column",width:"45%",borderStyle:R?"round":"single",borderColor:R?"yellow":"gray",padding:1,children:[s(f,{marginBottom:1,children:h(c,{bold:!0,color:R?"yellow":void 0,children:[j.charAt(0).toUpperCase()+j.slice(1)," ","Configuration"]})}),j==="prefix"&&h(he,{children:[s(f,{children:h(c,{color:R&&W==="format"?"yellow":void 0,bold:R&&W==="format",children:[R&&W==="format"?"❯ ":" ","Prefix Text"]})}),R&&W==="format"&&s(f,{marginLeft:2,children:s(c,{dimColor:!0,children:a?"enter to save":"enter to edit (appears before message)"})}),s(f,{marginLeft:2,marginBottom:1,children:s(f,{borderStyle:"round",borderColor:a?"yellow":"gray",children:s(c,{children:d})})})]}),s(f,{children:h(c,{color:R&&W==="styling"?"yellow":void 0,bold:R&&W==="styling",children:[R&&W==="styling"?"❯ ":" ","Styling"]})}),R&&W==="styling"&&s(f,{marginLeft:2,children:s(c,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),s(f,{marginLeft:2,marginBottom:1,flexDirection:"column",children:Pe.map((We,hn)=>s(f,{children:h(c,{color:R&&W==="styling"&&Oe===hn?"cyan":void 0,children:[R&&W==="styling"&&Oe===hn?"❯ ":" ",Te.includes(We.value)?"●":"○"," ",We.label]})},We.value))}),s(f,{children:h(c,{color:R&&W==="foreground"?"yellow":void 0,bold:R&&W==="foreground",children:[R&&W==="foreground"?"❯ ":" ","Foreground color"]})}),R&&W==="foreground"&&s(f,{marginLeft:2,children:s(c,{dimColor:!0,children:"enter to open color picker"})}),s(f,{marginLeft:2,marginBottom:1,children:s(c,{color:Ve,children:Ve})}),s(f,{children:h(c,{color:R&&W==="background"?"yellow":void 0,bold:R&&W==="background",children:[R&&W==="background"?"❯ ":" ","Background color"]})}),R&&W==="background"&&s(f,{marginLeft:2,children:s(c,{dimColor:!0,children:"enter to open color picker"})}),s(f,{marginLeft:2,children:s(c,{backgroundColor:gn,children:gn})})]})};if(X){const{column:j,type:R}=X;return s(rt,{initialValue:q,theme:y,onColorChange:D=>{j==="prefix"?R==="foreground"?(x(D),H("prefix",ee=>{ee.foreground_color=D})):(_(D),H("prefix",ee=>{ee.background_color=D})):R==="foreground"?(B(D),H("message",ee=>{ee.foreground_color=D})):(Y(D),H("message",ee=>{ee.background_color=D}))},onExit:()=>{oe(null),I("")}})}return h(f,{flexDirection:"column",children:[s(me,{children:"Customize how user messages are displayed"}),h(f,{flexDirection:"column",marginBottom:1,children:[s(c,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),s(c,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),h(f,{flexDirection:"row",gap:1,children:[be("prefix"),be("message")]}),s(f,{borderStyle:"round",padding:1,marginTop:1,children:h(f,{flexDirection:"column",children:[s(f,{marginBottom:1,children:s(c,{bold:!0,children:"Preview"})}),h(f,{flexDirection:"row",gap:2,children:[h(f,{flexDirection:"column",width:"50%",children:[s(f,{marginBottom:1,children:s(c,{underline:!0,children:"Before (Claude Code default):"})}),s(f,{marginLeft:1,marginTop:1,children:h(c,{children:[s(c,{color:y?.colors?.inactive||"#888888",children:"●"}),s(c,{children:" The directory "}),s(c,{color:y?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(c,{children:" contains "}),s(c,{bold:!0,children:"123"}),s(c,{children:" files."})]})})]}),h(f,{flexDirection:"column",width:"50%",children:[s(f,{marginBottom:1,children:s(c,{underline:!0,children:"After (Your customization):"})}),s(f,{marginLeft:1,children:$e(!0)}),s(f,{marginLeft:1,marginTop:1,children:h(c,{children:[s(c,{color:y?.colors?.inactive||"#888888",children:"●"}),s(c,{children:" The directory "}),s(c,{color:y?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(c,{children:" contains "}),s(c,{bold:!0,children:"123"}),s(c,{children:" files."})]})})]})]})]})})]})}function wo({onSubmit:e}){const{settings:t,updateSettings:n}=pe(ue),[r,o]=T(0),i=()=>{n(b=>{b.inputBox||(b.inputBox={removeBorder:!1}),b.inputBox.removeBorder=!b.inputBox.removeBorder})},l=()=>{n(b=>{b.misc||(b.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),b.misc.showTweakccVersion=!b.misc.showTweakccVersion})},a=()=>{n(b=>{b.misc||(b.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),b.misc.showPatchesApplied=!b.misc.showPatchesApplied})},u=()=>{n(b=>{b.misc||(b.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),b.misc.expandThinkingBlocks=!b.misc.expandThinkingBlocks})};de((b,p)=>{p.return||p.escape?e():p.upArrow?o(w=>Math.max(0,w-1)):p.downArrow?o(w=>Math.min(3,w+1)):b===" "&&(r===0?i():r===1?l():r===2?a():r===3&&u())});const d=t.inputBox?.removeBorder?"☑":"☐",g=t.misc?.showTweakccVersion?"☑":"☐",m=t.misc?.showPatchesApplied?"☑":"☐",v=t.misc?.expandThinkingBlocks?"☑":"☐";return h(f,{flexDirection:"column",children:[s(f,{marginBottom:1,children:s(me,{children:"Miscellaneous Settings"})}),s(f,{marginBottom:1,children:s(c,{color:"gray",children:s(c,{dimColor:!0,children:"Various tweaks and customizations. Press space to toggle settings, enter to go back."})})}),s(f,{children:h(c,{children:[s(c,{color:r===0?"cyan":void 0,children:r===0?"❯ ":" "}),s(c,{bold:!0,color:r===0?"cyan":void 0,children:"Remove input box border"})]})}),s(f,{flexDirection:"column",children:h(c,{dimColor:!0,children:[" ","Removes the rounded border around the input box for a cleaner look."]})}),s(f,{marginLeft:4,marginBottom:1,children:h(c,{children:[d," ",t.inputBox?.removeBorder?"Enabled":"Disabled"]})}),s(f,{children:h(c,{children:[s(c,{color:r===1?"cyan":void 0,children:r===1?"❯ ":" "}),s(c,{bold:!0,color:r===1?"cyan":void 0,children:"Show tweakcc version at startup"})]})}),s(f,{flexDirection:"column",children:h(c,{dimColor:!0,children:[" ",'Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.']})}),s(f,{marginLeft:4,marginBottom:1,children:h(c,{children:[g," ",t.misc?.showTweakccVersion?"Enabled":"Disabled"]})}),s(f,{children:h(c,{children:[s(c,{color:r===2?"cyan":void 0,children:r===2?"❯ ":" "}),s(c,{bold:!0,color:r===2?"cyan":void 0,children:"Show patches applied indicator at startup"})]})}),s(f,{flexDirection:"column",children:h(c,{dimColor:!0,children:[" ",'Shows the green "tweakcc patches are applied" indicator when starting Claude Code.']})}),s(f,{marginLeft:4,marginBottom:1,children:h(c,{children:[m," ",t.misc?.showPatchesApplied?"Enabled":"Disabled"]})}),s(f,{children:h(c,{children:[s(c,{color:r===3?"cyan":void 0,children:r===3?"❯ ":" "}),s(c,{bold:!0,color:r===3?"cyan":void 0,children:"Expand thinking blocks"})]})}),s(f,{flexDirection:"column",children:h(c,{dimColor:!0,children:[" ","Makes thinking blocks always expanded by default instead of collapsed."]})}),s(f,{marginLeft:4,marginBottom:1,children:h(c,{children:[v," ",t.misc?.expandThinkingBlocks?"Enabled":"Disabled"]})})]})}const Ue=["Task","Bash","Glob","Grep","Read","Edit","Write","NotebookEdit","WebFetch","WebSearch","BashOutput","KillShell","TodoWrite","AskUserQuestion","Skill","SlashCommand","ExitPlanMode"];function xo({toolsetIndex:e,onBack:t}){const{settings:n,updateSettings:r}=pe(ue),o=n.toolsets[e],[i,l]=T(o?.name||"New Toolset"),[a,u]=T(o?.allowedTools||[]),[d,g]=T(!1),[m,v]=T(0);xe(()=>{o&&r(C=>{C.toolsets[e].name=i,C.toolsets[e].allowedTools=a})},[i,a]);const b=C=>a==="*"?!0:a.includes(C),p=C=>{C==="All"?u("*"):C==="None"?u([]):a==="*"?u(Ue.filter(_=>_!==C)):a.includes(C)?u(a.filter(_=>_!==C)):u([...a,C])};if(de((C,_)=>{if(d){_.return?g(!1):_.escape?(l(o?.name||"New Toolset"),g(!1)):_.backspace||_.delete?l(k=>k.slice(0,-1)):C&&C.length===1&&l(k=>k+C);return}if(_.escape)t();else if(_.upArrow)v(k=>Math.max(0,k-1));else if(_.downArrow)v(k=>Math.min(Ue.length+1,k+1));else if(C===" "||_.return)if(m===0)p("All");else if(m===1)p("None");else{const k=Ue[m-2];k&&p(k)}else C==="n"&&g(!0)}),!o)return s(f,{flexDirection:"column",children:s(c,{color:"red",children:"Toolset not found"})});const w=a==="*",x=Array.isArray(a)&&a.length===0;return h(f,{flexDirection:"column",children:[s(me,{children:"Edit Toolset"}),s(f,{marginBottom:1,flexDirection:"column",children:s(c,{dimColor:!0,children:"n to edit name · space/enter to toggle · esc to go back"})}),h(f,{marginBottom:1,flexDirection:"column",children:[s(c,{bold:!0,children:"Name:"}),s(f,{marginLeft:2,children:s(f,{borderStyle:"round",borderColor:d?"yellow":"gray",children:s(c,{children:i})})}),d&&s(f,{marginLeft:2,children:s(c,{dimColor:!0,children:"enter to save · esc to cancel"})})]}),h(f,{marginBottom:1,flexDirection:"column",children:[s(c,{bold:!0,children:"Allowed Tools:"}),s(f,{marginLeft:2,children:h(c,{color:m===0?"cyan":void 0,children:[m===0?"❯ ":" ",w?"●":"○"," All"]})}),s(f,{marginLeft:2,children:h(c,{color:m===1?"cyan":void 0,children:[m===1?"❯ ":" ",x?"●":"○"," None"]})}),Ue.map((C,_)=>{const k=_+2;return s(f,{marginLeft:2,children:h(c,{color:m===k?"cyan":void 0,children:[m===k?"❯ ":" ",b(C)?"◉":"○"," ",C]})},C)})]}),s(f,{borderStyle:"round",padding:1,marginTop:1,children:h(f,{flexDirection:"column",children:[s(c,{bold:!0,children:"Summary:"}),h(c,{children:["Name: ",s(c,{color:"cyan",children:i})]}),h(c,{children:["Tools:"," ",a==="*"?s(c,{color:"green",children:"All tools (*)"}):a.length===0?s(c,{color:"red",children:"No tools ([])"}):h(c,{color:"yellow",children:[a.length," selected"]})]})]})})]})}function So({onBack:e}){const{settings:{toolsets:t,defaultToolset:n},updateSettings:r}=pe(ue),[o,i]=T(0),[l,a]=T(null),[u,d]=T(!0),g=()=>{const p={name:"New Toolset",allowedTools:[]};r(w=>{w.toolsets.push(p)}),a(t.length),d(!1)},m=p=>{const w=t[p];r(x=>{x.toolsets.splice(p,1),x.defaultToolset===w.name&&(x.defaultToolset=null)}),o>=t.length-1&&i(Math.max(0,t.length-2))},v=p=>{const w=t[p];r(x=>{x.defaultToolset=w.name})};if(de((p,w)=>{w.escape?e():w.upArrow?i(x=>Math.max(0,x-1)):w.downArrow?i(x=>Math.min(t.length-1,x+1)):w.return&&t.length>0?(a(o),d(!1)):p==="n"?g():p==="d"&&t.length>0?m(o):p==="s"&&t.length>0&&v(o)},{isActive:u}),l!==null)return s(xo,{toolsetIndex:l,onBack:()=>{a(null),d(!0)}});const b=p=>p.allowedTools==="*"?"All tools":p.allowedTools.length===0?"No tools":`${p.allowedTools.length} tool${p.allowedTools.length===1?"":"s"}`;return h(f,{flexDirection:"column",children:[s(me,{children:"Toolsets"}),h(f,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"n to create a new toolset"}),t.length>0&&s(c,{dimColor:!0,children:"s to set as default toolset"}),t.length>0&&s(c,{dimColor:!0,children:"d to delete a toolset"}),t.length>0&&s(c,{dimColor:!0,children:"enter to edit toolset"}),s(c,{dimColor:!0,children:"esc to go back"})]}),t.length===0?s(c,{children:"No toolsets created yet. Press n to create one."}):s(f,{flexDirection:"column",children:t.map((p,w)=>{const x=p.name===n,C=o===w;return h(c,{color:C?"yellow":void 0,bold:x,children:[C?"❯ ":" ",p.name,x&&" [DEFAULT]"," (",b(p),")"]},w)})})]})}const ue=st({settings:Z,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function yo({startupCheckInfo:e}){const[t,n]=T({settings:Z,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});xe(()=>{(async()=>{n(await sn())})()},[]);const r=En(g=>{const m=JSON.parse(JSON.stringify(t.settings));g(m),n(v=>({...v,settings:m,changesApplied:!1})),Fe(v=>{v.settings=m,v.changesApplied=!1})},[t.settings]),[o,i]=T(null),[l,a]=T(null);xe(()=>{e.wasUpdated&&e.oldVersion&&(a({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
433
+ }`,o=e.slice(0,t)+r+e.slice(t);return G(e,o,r,t,t),o},Zr=(e,t,n)=>{if(!t||t.length===0)return null;let r=e;return r=Jr(r,n),r?(r=Kr(r,t),r?(r=qr(r,t),r?(r=Xr(r),r||(console.error("patch: toolsets: step 4 failed (writeSlashCommandDefinition)"),null)):(console.error("patch: toolsets: step 3 failed (writeToolsetComponentDefinition)"),null)):(console.error("patch: toolsets: step 2 failed (writeToolFetchingUseMemo)"),null)):(console.error("patch: toolsets: step 1 failed (writeToolsetFieldToAppState)"),null)},G=(e,t,n,r,o)=>{const i=Math.max(0,r-20),l=Math.min(e.length,o+20),a=Math.min(t.length,r+n.length+20),u=e.slice(i,r),d=e.slice(r,o),g=e.slice(o,l),f=t.slice(i,r),v=t.slice(r,r+n.length),b=t.slice(r+n.length,a);M()&&d!==v&&(console.log(`
434
+ --- Diff ---`),console.log("OLD:",u+`\x1B[31m${d}\x1B[0m`+g),console.log("NEW:",f+`\x1B[32m${v}\x1B[0m`+b),console.log(`--- End Diff ---
435
+ `))},we=e=>e.replace(/\$/g,"\\$"),ln=e=>{const t=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,n=Array.from(e.matchAll(t)),r={};for(const l of n){const a=l[1];r[a]=(r[a]||0)+1}let o,i=0;for(const[l,a]of Object.entries(r))a>i&&(i=a,o=l);return o},Qr=e=>{const t=e.slice(0,1e3),n=/var ([$\w]+)=\([$\w]+,[$\w]+,[$\w]+\)=>\{/,r=t.match(n);if(!r){console.log("patch: getModuleLoaderFunction: failed to find module loader function");return}return r[1]},Kn=e=>{const t=/var ([$\w]+)=[$\w]+\(\([$\w]+\)=>\{var [$\w]+=Symbol\.for\("react\.element"\)/,n=e.match(t);if(!n){console.log("patch: getReactModuleNameNonBun: failed to find React module name");return}return n[1]},eo=e=>{const t=Kn(e);if(!t){console.log("^ patch: getReactModuleFunctionBun: failed to find React module name (Bun)");return}const n=new RegExp(`var ([$\\w]+)=[$\\w]+\\(\\([$\\w]+,[$\\w]+\\)=>\\{[$\\w]+\\.exports=${we(t)}\\(\\)`),r=e.match(n);if(!r){console.log(`patch: getReactModuleFunctionBun: failed to find React module function (Bun) (reactModuleNameNonBun=${t})`);return}return r[1]};let ge=null;const an=e=>{if(ge!=null)return ge;const t=Qr(e);if(!t){console.log("^ patch: getReactVar: failed to find moduleLoader"),ge=void 0;return}const n=Kn(e);if(!n){console.log("^ patch: getReactVar: failed to find reactModuleVarNonBun"),ge=void 0;return}const r=new RegExp(`\\b([$\\w]+)=${we(t)}\\(${we(n)}\\(\\),1\\)`),o=e.match(r);if(o)return ge=o[1],ge;const i=eo(e);if(!i){console.log("^ patch: getReactVar: failed to find reactModuleFunctionBun"),ge=void 0;return}const l=new RegExp(`\\b([$\\w]+)=${we(t)}\\(${we(i)}\\(\\),1\\)`),a=e.match(l);if(!a){console.log(`patch: getReactVar: failed to find bunPattern (moduleLoader=${t}, reactModuleVarNonBun=${n}, reactModuleFunctionBun=${i})`),ge=void 0;return}return ge=a[1],ge},qn=e=>{const t=/\bfunction ([$\w]+)\(\{color:[$\w]+,backgroundColor:[$\w]+,dimColor:[$\w]+=![01],bold:[$\w]+=![01]/,n=e.match(t);if(!n){console.log("patch: findTextComponent: failed to find text component");return}return n[1]},Xn=e=>{const t=/\b([$\w]+)\.displayName="Box"/,n=e.match(t);if(!n){console.error("patch: findBoxComponent: failed to find Box displayName");return}const r=n[1],o=new RegExp(`\\b([$\\w]+)=${we(r)}[^$\\w]`),i=e.match(o);if(!i){console.error(`patch: findBoxComponent: failed to find Box component variable (boxOrigCompName=${r})`);return}return i[1]},Zn=async(e,t)=>{let n;if(t.nativeInstallationPath){await Xt(t);let u=!1;try{await te.stat(ae),u=!0}catch{}const d=u?ae:t.nativeInstallationPath;M()&&console.log(`Extracting claude.js from ${u?"backup":"native installation"}: ${d}`);const g=jn(d);if(!g)throw new Error("Failed to extract claude.js from native installation");const f=re.join(ye.homedir(),".tweakcc"),v=re.join(f,"native-claudejs-orig.js");Ee.writeFileSync(v,g),M()&&console.log(`Saved original extracted JS from native to: ${v}`),n=g.toString("utf8")}else{if(await Gn(t),!t.cliPath)throw new Error("cliPath is required for NPM installations");n=await te.readFile(t.cliPath,{encoding:"utf8"})}const r=[],o=await Ur(n,t.version);n=o.newContent,r.push(...o.items);let i=null;e.settings.themes&&e.settings.themes.length>0&&(i=or(n,e.settings.themes))&&(n=i),e.settings.thinkingVerbs&&((i=$r(n,e.settings.thinkingVerbs.verbs))&&(n=i),(i=gr(n,e.settings.thinkingVerbs.format))&&(n=i)),(i=pr(n,e.settings.thinkingStyle.phases))&&(n=i),(i=wr(n,e.settings.thinkingStyle.updateInterval))&&(n=i),(i=yr(n,Math.max(...e.settings.thinkingStyle.phases.map(u=>u.length))+1))&&(n=i),(i=fr(n,e.settings.thinkingStyle.reverseMirror))&&(n=i),e.settings.userMessageDisplay&&(i=Ir(n,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")))&&(n=i),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(i=ar(n,e.settings.inputBox.removeBorder))&&(n=i),(i=Er(n))&&(n=i),(i=dr(n))&&(n=i),(i=sr(n))&&(n=i),(i=ro(n))&&(n=i),(i=tr(n,25))&&(n=i),(i=Mr(n))&&(n=i),(i=Or(n))&&(n=i);const l=e.settings.misc?.showTweakccVersion??!0,a=e.settings.misc?.showPatchesApplied??!0;if((i=Rr(n,"3.0.1",r,l,a))&&(n=i),(i=Hr(n))&&(n=i),e.settings.toolsets&&e.settings.toolsets.length>0&&(i=Zr(n,e.settings.toolsets,e.settings.defaultToolset))&&(n=i),t.nativeInstallationPath){M()&&console.log(`Repacking modified claude.js into native installation: ${t.nativeInstallationPath}`);const u=re.join(ye.homedir(),".tweakcc"),d=re.join(u,"native-claudejs-patched.js");Ee.writeFileSync(d,n,"utf8"),M()&&console.log(`Saved patched JS from native to: ${d}`);const g=Buffer.from(n,"utf8");Kt(t.nativeInstallationPath,g,t.nativeInstallationPath)}else{if(!t.cliPath)throw new Error("cliPath is required for NPM installations");await un(t.cliPath,n,"patch")}return await Ve(u=>{u.changesApplied=!0})},Qn=[{label:"Opus 4.1",slug:"opus-4.1",internal:"claude-opus-4-1-20250805"},{label:"Opus 4",slug:"opus-4",internal:"claude-opus-4-20250514"},{label:"Sonnet 4",slug:"sonnet-4",internal:"claude-sonnet-4-20250514"},{label:"Sonnet 3.7",slug:"sonnet-3.7",internal:"claude-3-7-sonnet-20250219"},{label:"Sonnet 3.5 (October)",slug:"sonnet-3.5-october",internal:"claude-3-5-sonnet-20241022"},{label:"Sonnet 3.5 (June)",slug:"sonnet-3.5-june",internal:"claude-3-5-sonnet-20240620"},{label:"Haiku 3.5",slug:"haiku-3.5",internal:"claude-3-5-haiku-20241022"},{label:"Haiku 3",slug:"haiku-3",internal:"claude-3-haiku-20240307"},{label:"Opus 3",slug:"opus-3",internal:"claude-3-opus-20240229"}],no=e=>{const t=e.indexOf("Switch between Claude models");if(t===-1)return console.error("patch: getModelSelectorInsertionPoint: failed to find labelIndex"),null;const n=Math.max(0,t-600),r=t,i=e.slice(n,r).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!i||i.index===void 0)return console.error("patch: getModelSelectorInsertionPoint: failed to find useState"),null;let a=n+i.index;for(;a<e.length&&e[a]!==";";)a++;if(a>=e.length)return console.error("patch: getModelSelectorInsertionPoint: failed to find semicolon"),null;const u=a+1,d=i[1];return{insertionIndex:u,optionsVar:d}},to=e=>{const t=no(e);if(!t)return null;const{insertionIndex:n,optionsVar:r}=t,o=Qn.map(l=>{const a=JSON.stringify(l.label),u=JSON.stringify(l.slug);return`${r}.push({value:${u},label:${a}});`}).join(""),i=e.slice(0,n)+o+e.slice(n);return G(e,i,o,n,n),i},ro=e=>{let t=e;const n=to(t);return n&&(t=n),t===e?null:t};let et=!1;const M=()=>et,oo=()=>{et=!0};function cn(){try{const e=re.join(ye.homedir(),".claude.json");return JSON.parse(Ee.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function io(){try{const e=re.join(ye.homedir(),".claude",".credentials.json");switch(JSON.parse(Ee.readFileSync(e,"utf8"))?.claudeAiOauth?.subscriptionType||"unknown"){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro"}}catch{}return"Claude API"}function so(){try{const e=re.join(ye.homedir(),".claude","settings.json"),n=JSON.parse(Ee.readFileSync(e,"utf8"))?.model||"default";if(n==="opus")return"Opus 4.1";const r=Qn.find(o=>o.slug===n);if(r)return r.label}catch{}return"Sonnet 4.5"}function lo(e){process.platform==="win32"?Be.spawn("explorer",[e],{detached:!0,stdio:"ignore"}).unref():process.platform==="darwin"?Be.spawn("open",[e],{detached:!0,stdio:"ignore"}).unref():Be.spawn("xdg-open",[e],{detached:!0,stdio:"ignore"}).unref()}function In(e){if(process.platform==="win32")Be.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Be.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const t=re.dirname(e);Be.spawn("xdg-open",[t],{detached:!0,stdio:"ignore"}).unref()}}function dn(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 n=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const[,r,o,i]=n;return parseInt(r)<=255&&parseInt(o)<=255&&parseInt(i)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t)){const n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const[,r,o,i]=n;return parseInt(r)<=360&&parseInt(o)<=100&&parseInt(i)<=100}}return!1}function nt(e){if(!dn(e))return e;const t=e.trim();if(t.startsWith("rgb("))return t;if(t.startsWith("#")){let n=t.slice(1);n.length===3&&(n=n.split("").map(l=>l+l).join(""));const r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16);return`rgb(${r},${o},${i})`}if(t.startsWith("hsl(")){const n=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const r=parseInt(n[1])/360,o=parseInt(n[2])/100,i=parseInt(n[3])/100,l=(v,b,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<1/6?v+(b-v)*6*p:p<1/2?b:p<2/3?v+(b-v)*(2/3-p)*6:v),a=i<.5?i*(1+o):i+o-i*o,u=2*i-a,d=Math.round(l(u,a,r+1/3)*255),g=Math.round(l(u,a,r)*255),f=Math.round(l(u,a,r-1/3)*255);return`rgb(${d},${g},${f})`}}return e}async function ao(e,t="sha256",n=64*1024){return new Promise((r,o)=>{const i=Bn.createHash(t),l=Ee.createReadStream(e,{highWaterMark:n});l.on("data",a=>{i.update(a)}),l.on("end",()=>{r(i.digest("hex"))}),l.on("error",a=>{o(a)})})}const Cn=(e,t,n,r,o,i,l,a)=>{let u=e;return t&&(u+=`.rgb(${t})`),n&&n!=="transparent"&&(u+=`.bgRgb(${n})`),r&&(u+=".bold"),o&&(u+=".italic"),i&&(u+=".underline"),l&&(u+=".strikethrough"),a&&(u+=".inverse"),u};async function un(e,t,n="replace"){let r=493;try{r=(await te.stat(e)).mode,M()&&console.log(`[${n}] Original file mode for ${e}: ${(r&parseInt("777",8)).toString(8)}`)}catch(o){M()&&console.log(`[${n}] Could not stat ${e} (error: ${o}), using default mode 755`)}try{await te.unlink(e),M()&&console.log(`[${n}] Unlinked ${e} to break hard links`)}catch(o){M()&&console.log(`[${n}] Could not unlink ${e}: ${o}`)}await te.writeFile(e,t),await te.chmod(e,r),M()&&console.log(`[${n}] Restored permissions to ${(r&parseInt("777",8)).toString(8)}`)}function F({color:e,backgroundColor:t,bold:n,dimColor:r,children:o}){const i=e?.startsWith("ansi:"),l=t?.startsWith("ansi:");if(i||l){if(Je.Children.toArray(o).some(f=>Je.isValidElement(f)))return s(c,{children:o});let u=Q;if(i){const f=e.slice(5);u=u[f]||u}if(l){const f=t.slice(5),v=f.startsWith("bg")?f:`bg${f.charAt(0).toUpperCase()}${f.slice(1)}`;u=u[v]||u}n&&(u=u.bold),r&&(u=u.dim);const g=Je.Children.toArray(o).map(f=>typeof f=="string"||typeof f=="number"?String(f):"").join("");return s(c,{children:u(g)})}return s(c,{color:e,backgroundColor:t,bold:n,dimColor:r,children:o})}function co({text:e,nonShimmerColors:t,shimmerColors:n,shimmerWidth:r=3,updateDuration:o=50,restartPoint:i=10}){const[l,a]=T(0);return xe(()=>{const u=setInterval(()=>{a(d=>{const g=d+1;return g>=e.length+i?-r:g})},o);return()=>clearInterval(u)},[e.length,i,o]),t.length!==n.length?(console.error("UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length"),s(c,{children:e})):s(c,{children:e.split("").map((u,d)=>{const g=d>=l&&d<l+r&&l<e.length,f=d%t.length,v=g?n[f]:t[f];return s(c,{color:v,children:u},d)})})}const uo=ct.cwd();function tt({theme:e}){const{ccVersion:t}=pe(ue);return h(m,{flexDirection:"column",paddingLeft:1,children:[s(m,{marginBottom:1,children:h(c,{bold:!0,children:["Preview: ",e.name]})}),s(m,{borderStyle:"single",borderColor:"gray",paddingX:1,children:h(m,{flexDirection:"column",children:[h(m,{flexDirection:"column",children:[h(c,{children:[s(F,{color:e.colors.clawd_body,children:" ▐"}),s(c,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"▛███▜"}),h(c,{children:[s(F,{color:e.colors.clawd_body,children:"▌ "})," ",s(c,{bold:!0,children:"Claude Code"})," ",t?`v${t}`:"v2.0.14"]})]}),h(c,{children:[s(F,{color:e.colors.clawd_body,children:"▝▜"}),s(c,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"█████"}),s(F,{color:e.colors.clawd_body,children:"▛▘"})," ",so()," · ",io()]}),h(F,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",uo]}),h(c,{children:[h(F,{color:e.colors.success,children:["Login successful. Press"," "]}),s(F,{bold:!0,color:e.colors.success,children:"Enter"}),h(F,{color:e.colors.success,children:[" ","to continue…"]})]})]}),s(c,{children:"╭─────────────────────────────────────────────╮"}),h(c,{children:["│ 1 function greet() ","{"," ","│"]}),h(c,{children:["│ 2"," ",s(F,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:'- console.log("'}),s(F,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),s(F,{backgroundColor:e.colors.diffRemoved,children:'");'})," ","│"]}),h(c,{children:["│ 2"," ",s(F,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:'+ console.log("'}),s(F,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),s(F,{backgroundColor:e.colors.diffAdded,children:'");'})," ","│"]}),s(F,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),h(F,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),h(c,{children:[s(F,{color:e.colors.warning,children:"│ "}),s(c,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),h(F,{color:e.colors.warning,children:[" ","│"]})]}),s(F,{color:e.colors.bashBorder,children:"───────────────────────────────────────────────"}),h(c,{children:[s(F,{color:e.colors.bashBorder,children:"!"}),s(c,{children:" ls"})]}),s(F,{color:e.colors.promptBorder,children:"───────────────────────────────────────────────"}),s(c,{children:h(c,{children:["> list the dir"," ",s(co,{text:"ultrathink",nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),s(F,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),h(c,{children:[s(F,{color:e.colors.planMode,children:"│ "}),h(F,{color:e.colors.permission,children:["Ready to code?"," "]}),s(c,{children:"Here is Claude's plan:"}),h(F,{color:e.colors.planMode,children:[" ","│"]})]}),s(F,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),h(c,{children:[s(F,{color:e.colors.permission,children:"│ "}),s(c,{bold:!0,children:"Permissions:"})," ",h(F,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",s(F,{color:e.colors.permission,children:"│"})]}),s(c,{children:"> list the dir"}),h(c,{children:[s(F,{color:e.colors.error,children:"●"}),s(c,{children:" Update(__init__.py)"})]}),h(c,{children:[s(c,{children:" ⎿ "}),s(F,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),h(c,{children:[" ","1"," ",h(F,{backgroundColor:e.colors.diffRemovedDimmed,children:["- import"," "]}),s(F,{backgroundColor:e.colors.diffRemovedWordDimmed,children:"os"})]}),h(c,{children:[" ","2"," ",h(F,{backgroundColor:e.colors.diffAddedDimmed,children:["+ import"," "]}),s(F,{backgroundColor:e.colors.diffAddedWordDimmed,children:"random"})]}),h(c,{children:[s(F,{color:e.colors.success,children:"●"}),s(c,{children:" List(.)"})]}),h(c,{children:[s(c,{children:"●"}),s(c,{children:" The directory "}),s(F,{color:e.colors.permission,children:"C:\\Users\\user"}),h(c,{children:[" ","contains ",s(c,{bold:!0,children:"123"})," files."]})]}),h(c,{children:[s(F,{color:e.colors.claude,children:"✻ Th"}),s(F,{color:e.colors.claudeShimmer,children:"ink"}),s(F,{color:e.colors.claude,children:"ing… "}),s(c,{children:"(esc to interrupt)"})]}),s(c,{children:s(F,{color:e.colors.autoAccept,children:"⏵⏵ accept edits on (shift+tab to cycle)"})}),s(c,{children:s(F,{color:e.colors.planMode,children:"⏸ plan mode on (shift+tab to cycle)"})}),s(c,{children:s(F,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Ke({colorKey:e,theme:t,bold:n=!1}){const r=t.colors[e];return e==="inverseText"?s(F,{color:r,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith("diff")?s(F,{backgroundColor:r,bold:n,color:t.colors.text,children:e}):s(F,{color:r,bold:n,children:e})}function rt({initialValue:e,onColorChange:t,onExit:n,colorKey:r,theme:o}){const i=Xe(e)||{h:0,s:50,l:50},l=qe(e)||{r:128,g:128,b:128},[a,u]=T(i),[d,g]=T(l),[f,v]=T("hsl"),[b,p]=T("h"),[w,x]=T(!1),[C,_]=T(!1);xe(()=>{const I=Xe(e),$=qe(e);I&&$&&(x(!0),u(I),g($),x(!1))},[e]),xe(()=>{if(!w&&C){const I=`rgb(${d.r},${d.g},${d.b})`;t(I)}},[a,d,w,C]),xe(()=>{_(!0)},[]);const k=I=>{if(dn(I)){const $=nt(I),S=Xe($),N=qe($);S&&N&&(x(!0),u(S),g(N),x(!1))}};de((I,$)=>{if(I.length>1&&!$.ctrl&&!$.meta){k(I);return}if($.return)n();else if($.escape)n();else if($.ctrl&&I==="a")v(S=>S==="hsl"?"rgb":"hsl"),p(S=>f==="hsl"?S==="h"?"r":S==="s"?"g":"b":S==="r"?"h":S==="g"?"s":"l");else if($.upArrow)p(f==="hsl"?S=>S==="h"?"l":S==="s"?"h":"s":S=>S==="r"?"b":S==="g"?"r":"g");else if($.downArrow||$.tab)p(f==="hsl"?S=>S==="h"?"s":S==="s"?"l":"h":S=>S==="r"?"g":S==="g"?"b":"r");else if($.leftArrow){const S=$.shift||$.ctrl||$.meta?-10:-1;P(S)}else if($.rightArrow){const S=$.shift||$.ctrl||$.meta?10:1;P(S)}});const P=I=>{x(!0),f==="hsl"?u($=>{const S={...$};b==="h"?S.h=Math.max(0,Math.min(359,$.h+I)):b==="s"?S.s=Math.max(0,Math.min(100,$.s+I)):b==="l"&&(S.l=Math.max(0,Math.min(100,$.l+I)));const[N,y,L]=V(S.h,S.s,S.l);return g({r:N,g:y,b:L}),S}):g($=>{const S={...$};b==="r"?S.r=Math.max(0,Math.min(255,$.r+I)):b==="g"?S.g=Math.max(0,Math.min(255,$.g+I)):b==="b"&&(S.b=Math.max(0,Math.min(255,$.b+I)));const N=O(S.r,S.g,S.b);return u(N),S}),x(!1)},O=(I,$,S)=>{const N=I/255,y=$/255,L=S/255,z=Math.max(N,y,L),H=Math.min(N,y,L),ne=z-H,ie=(z+H)/2;let $e=0;ne!==0&&($e=ie>.5?ne/(2-z-H):ne/(z+H));let be=0;return ne!==0&&(z===N?be=((y-L)/ne+(y<L?6:0))/6:z===y?be=((L-N)/ne+2)/6:be=((N-y)/ne+4)/6),{h:Math.round(be*360),s:Math.round($e*100),l:Math.round(ie*100)}},V=(I,$,S)=>{I/=360,$/=100,S/=100;const N=(1-Math.abs(2*S-1))*$,y=N*(1-Math.abs(I*6%2-1)),L=S-N/2;let z=0,H=0,ne=0;return 0<=I&&I<1/6?(z=N,H=y,ne=0):1/6<=I&&I<2/6?(z=y,H=N,ne=0):2/6<=I&&I<3/6?(z=0,H=N,ne=y):3/6<=I&&I<4/6?(z=0,H=y,ne=N):4/6<=I&&I<5/6?(z=y,H=0,ne=N):5/6<=I&&I<1&&(z=N,H=0,ne=y),[Math.round((z+L)*255),Math.round((H+L)*255),Math.round((ne+L)*255)]},K=()=>{const I=[],$=[[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 S=0;S<40;S++){const y=S/39*($.length-1),L=Math.floor(y),z=Math.ceil(y),H=y-L,[ne,ie,$e]=$[L],[be,j,R]=$[z],D=Math.round(ne+(be-ne)*H),ee=Math.round(ie+(j-ie)*H),W=Math.round($e+(R-$e)*H);I.push(s(c,{backgroundColor:`rgb(${D},${ee},${W})`,children:" "},S))}return I},U=()=>{const I=[];for(let $=0;$<40;$++){const S=$/39*100,[N,y,L]=V(a.h,S,a.l);I.push(s(c,{backgroundColor:`rgb(${N},${y},${L})`,children:" "},$))}return I},A=()=>{const I=[];for(let $=0;$<40;$++){const S=$/39*100,[N,y,L]=V(a.h,a.s,S);I.push(s(c,{backgroundColor:`rgb(${N},${y},${L})`,children:" "},$))}return I},B=()=>{const[I,$,S]=V(a.h,a.s,a.l);return`rgb(${I},${$},${S})`},E=(I,$,S)=>{const N=y=>y.toString(16).padStart(2,"0");return`#${N(I)}${N($)}${N(S)}`},Y=()=>{const I=[];for(let $=0;$<40;$++){const S=Math.round($/39*255);I.push(s(c,{backgroundColor:`rgb(${S},${d.g},${d.b})`,children:" "},$))}return I},X=()=>{const I=[];for(let $=0;$<40;$++){const S=Math.round($/39*255);I.push(s(c,{backgroundColor:`rgb(${d.r},${S},${d.b})`,children:" "},$))}return I},oe=()=>{const I=[];for(let $=0;$<40;$++){const S=Math.round($/39*255);I.push(s(c,{backgroundColor:`rgb(${d.r},${d.g},${S})`,children:" "},$))}return I},q=(I,$)=>Math.round(I/$*39);return h(m,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[h(m,{flexDirection:"column",children:[s(c,{bold:!0,children:"Color Picker"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(c,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),s(c,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),s(c,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),s(c,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),s(c,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),s(c,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),f==="hsl"?h(he,{children:[h(m,{marginBottom:1,children:[s(m,{width:25,children:h(c,{color:b==="h"?"yellow":"white",children:[b==="h"?"❯ ":" ","Hue (",a.h,"°):"]})}),s(m,{children:K().map((I,$)=>s(ke,{children:$===q(a.h,360)?s(c,{children:"|"}):I},$))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(c,{color:b==="s"?"yellow":"white",children:[b==="s"?"❯ ":" ","Saturation (",a.s,"%):"]})}),s(m,{children:U().map((I,$)=>s(ke,{children:$===q(a.s,100)?s(c,{children:"|"}):I},$))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(c,{color:b==="l"?"yellow":"white",children:[b==="l"?"❯ ":" ","Lightness (",a.l,"%):"]})}),s(m,{children:A().map((I,$)=>s(ke,{children:$===q(a.l,100)?s(c,{children:"|"}):I},$))})]})]}):h(he,{children:[h(m,{marginBottom:1,children:[s(m,{width:25,children:h(c,{color:b==="r"?"yellow":"white",children:[b==="r"?"❯ ":" ","Red (",d.r,"):"]})}),s(m,{children:Y().map((I,$)=>s(ke,{children:$===q(d.r,255)?s(c,{children:"|"}):I},$))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(c,{color:b==="g"?"yellow":"white",children:[b==="g"?"❯ ":" ","Green (",d.g,"):"]})}),s(m,{children:X().map((I,$)=>s(ke,{children:$===q(d.g,255)?s(c,{children:"|"}):I},$))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(c,{color:b==="b"?"yellow":"white",children:[b==="b"?"❯ ":" ","Blue (",d.b,"):"]})}),s(m,{children:oe().map((I,$)=>s(ke,{children:$===q(d.b,255)?s(c,{children:"|"}):I},$))})]})]}),h(m,{marginBottom:1,children:[s(c,{children:"Current: "}),s(c,{backgroundColor:B(),children:" "})]}),h(m,{flexDirection:"row",justifyContent:"space-between",children:[h(m,{flexDirection:"column",children:[s(c,{dimColor:!0,children:"Hex "}),r?.startsWith("diff")?s(c,{backgroundColor:B(),color:o?.colors?.text||"white",bold:!0,children:E(d.r,d.g,d.b)}):r==="inverseText"?s(c,{color:B(),backgroundColor:o?.colors?.permission,bold:!0,children:E(d.r,d.g,d.b)}):s(c,{color:B(),bold:!0,children:E(d.r,d.g,d.b)})]}),h(m,{flexDirection:"column",children:[s(c,{dimColor:!0,children:"RGB "}),r?.startsWith("diff")?s(c,{backgroundColor:B(),color:o?.colors?.text||"white",bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):r==="inverseText"?s(c,{color:B(),backgroundColor:o?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):s(c,{color:B(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),h(m,{flexDirection:"column",children:[s(c,{dimColor:!0,children:"HSL "}),r?.startsWith("diff")?s(c,{backgroundColor:B(),color:o?.colors?.text||"white",bold:!0,children:`hsl(${a.h}, ${a.s}%, ${a.l}%)`}):r==="inverseText"?s(c,{color:B(),backgroundColor:o?.colors?.permission,bold:!0,children:`hsl(${a.h}, ${a.s}%, ${a.l}%)`}):s(c,{color:B(),bold:!0,children:`hsl(${a.h}, ${a.s}%, ${a.l}%)`})]})]})]})}function qe(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 n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){const r=n[1];return{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16)}}return null}function Xe(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 n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const o=parseInt(n[1])/255,i=parseInt(n[2])/255,l=parseInt(n[3])/255,a=Math.max(o,i,l),u=Math.min(o,i,l),d=a-u,g=(a+u)/2;let f=0;d!==0&&(f=g>.5?d/(2-a-u):d/(a+u));let v=0;return d!==0&&(a===o?v=((i-l)/d+(i<l?6:0))/6:a===i?v=((l-o)/d+2)/6:v=((o-i)/d+4)/6),{h:Math.round(v*360),s:Math.round(f*100),l:Math.round(g*100)}}const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const o=r[1],i=parseInt(o.substr(0,2),16)/255,l=parseInt(o.substr(2,2),16)/255,a=parseInt(o.substr(4,2),16)/255,u=Math.max(i,l,a),d=Math.min(i,l,a),g=u-d,f=(u+d)/2;let v=0;g!==0&&(v=f>.5?g/(2-u-d):g/(u+d));let b=0;return g!==0&&(u===i?b=((l-a)/g+(l<a?6:0))/6:u===l?b=((a-i)/g+2)/6:b=((i-l)/g+4)/6),{h:Math.round(b*360),s:Math.round(v*100),l:Math.round(f*100)}}return{h:0,s:50,l:50}}function go({onBack:e,themeId:t}){const{settings:{themes:n},updateSettings:r}=pe(ue),[o,i]=T(t),l=n.find(A=>A.id===o)||n[0],[a,u]=T("rgb"),[d,g]=T(0),[f,v]=T(null),[b,p]=T(null),[w,x]=T(""),[C,_]=T(""),k=En(A=>{r(B=>{const E=B.themes.findIndex(Y=>Y.id===o);E!==-1&&A(B.themes[E])})},[o,r]),P=A=>{if(d>=2&&dn(A)){const B=nt(A),E=d-2,Y=O[E];k(X=>{X.colors[Y]=B})}};de((A,B)=>{if(f===null&&b===null){if(A.length>1&&!B.ctrl&&!B.meta){P(A);return}if(B.escape)e();else if(B.ctrl&&A==="a")u(E=>E==="rgb"?"hex":E==="hex"?"hsl":"rgb");else if(B.upArrow)g(E=>Math.max(0,E-1));else if(B.downArrow)g(E=>Math.min(O.length+1,E+1));else if(B.return)if(d===0)p("name"),x(l.name),_(l.name);else if(d===1)p("id"),x(l.id),_(l.id);else{const E=d-2,Y=O[E],X=l.colors[Y];v(E),x(X),_(X)}}else if(f!==null)B.ctrl&&A==="a"&&u(E=>E==="rgb"?"hex":E==="hex"?"hsl":"rgb");else if(b!==null)if(B.return){if(b==="id"){const E=o;i(w),r(Y=>{const X=Y.themes.findIndex(oe=>oe.id===E);X!==-1&&(Y.themes[X].id=w)})}else k(E=>{E.name=w});p(null),x(""),_("")}else B.escape?(p(null),x(""),_("")):B.backspace||B.delete?x(E=>E.slice(0,-1)):A&&x(E=>E+A)});const O=Object.keys(l.colors),V=(A,B)=>{const E=A.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!E)return A;const Y=parseInt(E[1]),X=parseInt(E[2]),oe=parseInt(E[3]);switch(B){case"hex":{const q=I=>I.toString(16).padStart(2,"0");return`#${q(Y)}${q(X)}${q(oe)}`}case"hsl":{const q=Y/255,I=X/255,$=oe/255,S=Math.max(q,I,$),N=Math.min(q,I,$),y=S-N,L=(S+N)/2;let z=0;y!==0&&(z=L>.5?y/(2-S-N):y/(S+N));let H=0;return y!==0&&(S===q?H=((I-$)/y+(I<$?6:0))/6:S===I?H=(($-q)/y+2)/6:H=((q-I)/y+4)/6),`hsl(${Math.round(H*360)}, ${Math.round(z*100)}%, ${Math.round(L*100)}%)`}case"rgb":default:return A}},K=A=>({autoAccept:"Auto-accept edits mode indicator",bashBorder:"Bash command border",claude:"Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.",claudeShimmer:"Color used for the shimmering effect on the thinking verb.",claudeBlue_FOR_SYSTEM_SPINNER:"System spinner color (blue variant)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"System spinner shimmer color (blue variant)",permission:"Permission prompt color",permissionShimmer:"Permission prompt shimmer color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",promptBorder:"Input prompt border color",promptBorderShimmer:"Input prompt border shimmer color",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",inactive:"Inactive/dimmed text. Used for line numbers and less prominent text.",subtle:"Subtle text. Used for help text and secondary information.",suggestion:"Suggestion text color. Used for suggestions for theme names and various other things.",remember:"Remember/note color. Used for various text relating to memories.",background:"Background color for certain UI elements",success:"Success indicator. Used for the bullet on successful tool calls, and various success messages (such as sign in successful).",error:"Error indicator",warning:"Warning indicator",warningShimmer:"Warning shimmer color",diffAdded:"Added diff background",diffRemoved:"Removed diff background",diffAddedDimmed:"Added diff background (dimmed)",diffRemovedDimmed:"Removed diff background (dimmed)",diffAddedWord:"Added word highlight",diffRemovedWord:"Removed word highlight",diffAddedWordDimmed:"Added word highlight (dimmed)",diffRemovedWordDimmed:"Removed word highlight (dimmed)",red_FOR_SUBAGENTS_ONLY:"Red color for sub agents",blue_FOR_SUBAGENTS_ONLY:"Blue color for sub agents",green_FOR_SUBAGENTS_ONLY:"Green color for sub agents",yellow_FOR_SUBAGENTS_ONLY:"Yellow color for sub agents",purple_FOR_SUBAGENTS_ONLY:"Purple color for sub agents",orange_FOR_SUBAGENTS_ONLY:"Orange color for sub agents",pink_FOR_SUBAGENTS_ONLY:"Pink color for sub agents",cyan_FOR_SUBAGENTS_ONLY:"Cyan color for sub agents",professionalBlue:"Professional blue color for business contexts?",rainbow_red:'"ultrathink" rainbow - red',rainbow_orange:'"ultrathink" rainbow - orange',rainbow_yellow:'"ultrathink" rainbow - yellow',rainbow_green:'"ultrathink" rainbow - green',rainbow_blue:'"ultrathink" rainbow - blue',rainbow_indigo:'"ultrathink" rainbow - indigo',rainbow_violet:'"ultrathink" rainbow - violet',rainbow_red_shimmer:'"ultrathink" rainbow (shimmer) - red',rainbow_orange_shimmer:'"ultrathink" rainbow (shimmer) - orange',rainbow_yellow_shimmer:'"ultrathink" rainbow (shimmer) - yellow',rainbow_green_shimmer:'"ultrathink" rainbow (shimmer) - green',rainbow_blue_shimmer:'"ultrathink" rainbow (shimmer) - blue',rainbow_indigo_shimmer:'"ultrathink" rainbow (shimmer) - indigo',rainbow_violet_shimmer:'"ultrathink" rainbow (shimmer) - violet',clawd_body:'"Clawd" character body color',clawd_background:'"Clawd" character background color',userMessageBackground:"Background color for user messages",bashMessageBackgroundColor:"Background color for bash command output",memoryBackgroundColor:"Background color for memory/context information",rate_limit_fill:"Rate limit indicator fill color",rate_limit_empty:"Rate limit indicator empty/background color"})[A]||"",U=Math.max(...O.map(A=>A.length));return h(m,{children:[h(m,{flexDirection:"column",width:"50%",children:[s(m,{children:h(me,{children:["Editing theme “",l.name,"” (",l.id,")"]})}),f===null&&b===null?h(he,{children:[h(m,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"enter to edit theme name, id, or color"}),s(c,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),s(c,{dimColor:!0,children:"paste color from clipboard (when on color)"}),s(c,{dimColor:!0,children:"esc to go back"})]}),d<2?h(m,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[s(c,{bold:!0,children:d===0?"Theme Name":"Theme ID"}),s(c,{children:d===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):h(m,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:l.colors[O[d-2]],flexDirection:"column",paddingLeft:1,children:[s(Ke,{colorKey:O[d-2],theme:l,bold:!0}),s(c,{children:K(O[d-2])})]}),h(m,{flexDirection:"column",children:[h(m,{children:[s(c,{color:d===0?"yellow":"white",children:d===0?"❯ ":" "}),s(c,{bold:!0,children:"Name: "}),s(c,{children:l.name})]}),h(m,{marginBottom:1,children:[s(c,{color:d===1?"yellow":"white",children:d===1?"❯ ":" "}),s(c,{bold:!0,children:"ID: "}),s(c,{children:l.id})]}),(()=>{if(d<2){const q=O.slice(0,20);return h(he,{children:[q.map((I,$)=>{const S=$+2;return h(m,{children:[s(c,{color:d===S?"yellow":"white",children:d===S?"❯ ":" "}),s(m,{width:U+2,children:s(c,{children:s(Ke,{colorKey:I,theme:l,bold:!0})})}),s(F,{color:l.colors[I],children:V(l.colors[I],a)})]},I)}),O.length>20&&h(c,{color:"gray",dimColor:!0,children:[" ","↓ ",O.length-20," more below"]})]})}const B=d-2,E=Math.max(0,B-Math.floor(20/2)),Y=Math.min(O.length,E+20),X=Math.max(0,Y-20),oe=O.slice(X,Y);return h(he,{children:[X>0&&h(c,{color:"gray",dimColor:!0,children:[" ","↑ ",X," more above"]}),oe.map((q,I)=>{const S=X+I+2;return h(m,{children:[s(c,{color:d===S?"yellow":"white",children:d===S?"❯ ":" "}),s(m,{width:U+2,children:s(c,{children:s(Ke,{colorKey:q,theme:l,bold:!0})})}),s(F,{color:l.colors[q],children:V(l.colors[q],a)})]},q)}),Y<O.length&&h(c,{color:"gray",dimColor:!0,children:[" ","↓ ",O.length-Y," more below"]})]})})()]})]}):b?h(m,{flexDirection:"column",marginTop:1,children:[h(c,{children:["Editing ",b==="name"?"theme name":"theme ID",":"]}),s(m,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:s(c,{children:w})}),s(c,{dimColor:!0,children:"enter to save, esc to cancel"})]}):s(rt,{initialValue:C,colorKey:O[f],theme:l,onColorChange:A=>{x(A),k(B=>{B.colors[O[f]]=A})},onExit:()=>{k(A=>{A.colors[O[f]]=w}),v(null),x(""),_("")}})]}),s(m,{width:"50%",children:s(tt,{theme:l})})]})}function ho(e){return e.map(t=>`${t.name} (${t.id})`)}function fo({onBack:e}){const{settings:{themes:t},updateSettings:n}=pe(ue),[r,o]=T(0),[i,l]=T(null),[a,u]=T(!0),d=()=>{const w={colors:{...(t[0]||Z.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};n(x=>{x.themes.push(w)}),l(w.id),u(!1)},g=p=>{t.length<=1||(n(w=>{w.themes=w.themes.filter(x=>x.id!==p)}),r>=t.length-1&&o(Math.max(0,t.length-2)))},f=()=>{n(p=>{p.themes=[...Z.themes]}),o(0)};if(de((p,w)=>{if(w.escape)e();else if(w.upArrow)o(x=>Math.max(0,x-1));else if(w.downArrow)o(x=>Math.min(t.length-1,x+1));else if(w.return){const x=t[r];x&&(l(x.id),u(!1))}else if(p==="n")d();else if(p==="d"){const x=t[r];x&&g(x.id)}else w.ctrl&&p==="r"&&f()},{isActive:a}),i)return s(go,{themeId:i,onBack:()=>{l(null),u(!0)}});const v=ho(t),b=t.find(p=>v[r]?.includes(`(${p.id})`))||t[0];return t.length===0?s(m,{children:h(m,{flexDirection:"column",width:"100%",children:[s(me,{children:"Themes"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"n to create a new theme"}),s(c,{dimColor:!0,children:"esc to go back"})]}),s(c,{children:"No themes available!"})]})}):h(m,{children:[h(m,{flexDirection:"column",width:"50%",children:[s(me,{children:"Themes"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"n to create a new theme"}),s(c,{dimColor:!0,children:"d to delete a theme"}),s(c,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),s(c,{dimColor:!0,children:"enter to edit theme"}),s(c,{dimColor:!0,children:"esc to go back"})]}),s(m,{flexDirection:"column",children:v.map((p,w)=>h(c,{color:r===w?"yellow":void 0,children:[r===w?"❯ ":" ",p]},w))})]}),s(m,{width:"50%",children:s(tt,{theme:b})})]})}function mo({onBack:e}){const{settings:{thinkingVerbs:{format:t,verbs:n},themes:r},updateSettings:o}=pe(ue),i=["format","verbs"],[l,a]=T(0),u=i[l],[d,g]=T(0),[f,v]=T(!1),[b,p]=T(""),[w,x]=T(!1),[C,_]=T(!1),[k,P]=T(t),O=cn(),K=(r.find(A=>A.id===O)||r.find(A=>A.id==="dark"))?.colors.claude||"rgb(215,119,87)";de((A,B)=>{if(C){B.return?(o(E=>{E.thinkingVerbs.format=k}),_(!1)):B.escape?(P(t),_(!1)):B.backspace||B.delete?P(E=>E.slice(0,-1)):A&&P(E=>E+A);return}if(f||w){B.return&&b.trim()?(w?(o(E=>{E.thinkingVerbs.verbs.push(b.trim())}),x(!1)):(o(E=>{E.thinkingVerbs.verbs[d]=b.trim()}),v(!1)),p("")):B.escape?(p(""),v(!1),x(!1)):B.backspace||B.delete?p(E=>E.slice(0,-1)):A&&p(E=>E+A);return}B.escape?e():B.return?u==="format"&&(P(t),_(!0)):B.tab?B.shift?a(E=>E===0?i.length-1:E-1):a(E=>E===i.length-1?0:E+1):B.upArrow?u==="verbs"&&n.length>0&&g(E=>E>0?E-1:n.length-1):B.downArrow?u==="verbs"&&n.length>0&&g(E=>E<n.length-1?E+1:0):A==="e"&&u==="verbs"?n.length>0&&(p(n[d]),v(!0)):A==="d"&&u==="verbs"?n.length>1&&(o(E=>{E.thinkingVerbs.verbs=E.thinkingVerbs.verbs.filter((Y,X)=>X!==d)}),d>=n.length-1&&g(Math.max(0,n.length-2))):A==="n"&&u==="verbs"?(x(!0),p("")):B.ctrl&&A==="r"&&u==="verbs"&&(o(E=>{E.thinkingVerbs.verbs=[...Z.thinkingVerbs.verbs]}),g(0))});const U=50;return h(m,{children:[h(m,{flexDirection:"column",width:`${100-U}%`,children:[h(m,{marginBottom:1,flexDirection:"column",children:[s(me,{children:"Thinking Verbs"}),h(m,{flexDirection:"column",children:[s(c,{dimColor:!0,children:u==="format"?"enter to edit format":"changes auto-saved"}),s(c,{dimColor:!0,children:"esc to go back"}),s(c,{dimColor:!0,children:"tab to switch sections"})]})]}),s(m,{marginBottom:1,children:s(c,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),h(m,{flexDirection:"column",children:[h(c,{children:[s(c,{color:u==="format"?"yellow":void 0,children:u==="format"?"❯ ":" "}),s(c,{bold:!0,color:u==="format"?"yellow":void 0,children:"Format"})]}),u==="format"&&(C?h(c,{dimColor:!0,children:[" ","enter to save"]}):h(c,{dimColor:!0,children:[" ","enter to edit"]}))]}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:C?"yellow":"gray",children:s(c,{children:C?k:t})})}),s(m,{children:h(c,{children:[s(c,{color:u==="verbs"?"yellow":void 0,children:u==="verbs"?"❯ ":" "}),s(c,{bold:!0,color:u==="verbs"?"yellow":void 0,children:"Verbs"})]})}),u==="verbs"&&s(m,{flexDirection:"column",children:h(c,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),s(m,{marginLeft:2,marginBottom:1,children:h(m,{flexDirection:"column",children:[(()=>{const B=Math.max(0,d-Math.floor(4)),E=Math.min(n.length,B+8),Y=Math.max(0,E-8),X=n.slice(Y,E);return h(he,{children:[Y>0&&h(c,{color:"gray",dimColor:!0,children:[" ","↑ ",Y," more above"]}),X.map((oe,q)=>{const I=Y+q;return h(c,{color:u==="verbs"&&I===d?"cyan":void 0,children:[u==="verbs"&&I===d?"❯ ":" ",oe]},I)}),E<n.length&&h(c,{color:"gray",dimColor:!0,children:[" ","↓ ",n.length-E," more below"]})]})})(),w&&h(m,{alignItems:"center",children:[s(c,{color:"yellow",children:"❯ "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:b})})]}),f&&h(m,{marginTop:1,alignItems:"center",children:[s(c,{children:"Editing: "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:b})})]})]})})]}),h(m,{width:`${U}%`,flexDirection:"column",children:[s(m,{marginBottom:1,children:s(c,{bold:!0,children:"Preview"})}),s(m,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:h(c,{children:[h(c,{color:K,children:["✻ ",t.replace(/\{\}/g,n[d])," "]}),s(c,{children:"(esc to interrupt)"})]})})]})]})}const _e=[{name:"Default",phases:Z.thinkingStyle.phases,reverseMirror:Z.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 po({onBack:e}){const{settings:{thinkingStyle:{phases:t,updateInterval:n,reverseMirror:r},themes:o},updateSettings:i}=pe(ue),l=["reverseMirror","updateInterval","phases","presets"],[a,u]=T(0),d=l[a],[g,f]=T(0),[v,b]=T(0),[p,w]=T(!1),[x,C]=T(""),[_,k]=T(!1),[P,O]=T(!1),[V,K]=T(n.toString()),[U,A]=T(0),B=cn(),Y=(o.find(S=>S.id===B)||o.find(S=>S.id==="dark"))?.colors.claude||"rgb(215,119,87)";xe(()=>{if(t.length>0){const S=r?[...t,...[...t].reverse().slice(1,-1)]:t,N=setInterval(()=>{A(y=>(y+1)%S.length)},n);return()=>clearInterval(N)}},[t,n,r]),de((S,N)=>{if(P){if(N.return){const y=parseInt(V);!isNaN(y)&&y>0&&i(L=>{L.thinkingStyle.updateInterval=y}),O(!1)}else N.escape?(K(n.toString()),O(!1)):N.backspace||N.delete?K(y=>y.slice(0,-1)):S&&S.match(/^[0-9]$/)&&K(y=>y+S);return}if(p||_){if(N.return&&x.length){const y=_?[...t,x]:t.map((L,z)=>z===g?x:L);i(L=>{L.thinkingStyle.phases=y}),w(!1),C("")}else N.escape?(C(""),w(!1),k(!1)):N.backspace||N.delete?C(y=>y.slice(0,-1)):S&&C(y=>y+S);return}if(N.escape)e();else if(N.return)if(d==="updateInterval")K(n.toString()),O(!0);else if(d==="presets"){const y=_e[v];i(L=>{L.thinkingStyle.phases=[...y.phases],L.thinkingStyle.reverseMirror=y.reverseMirror})}else d==="reverseMirror"&&i(y=>{y.thinkingStyle.reverseMirror=!y.thinkingStyle.reverseMirror});else if(N.tab)N.shift?u(y=>y===0?l.length-1:y-1):u(y=>y===l.length-1?0:y+1);else if(N.upArrow)d==="phases"&&t.length>0?f(y=>y>0?y-1:t.length-1):d==="presets"&&b(y=>y>0?y-1:_e.length-1);else if(N.downArrow)d==="phases"&&t.length>0?f(y=>y<t.length-1?y+1:0):d==="presets"&&b(y=>y<_e.length-1?y+1:0);else if(S===" ")d==="reverseMirror"&&i(y=>{y.thinkingStyle.reverseMirror=!y.thinkingStyle.reverseMirror});else if(S==="e"&&d==="phases")t.length>0&&(C(t[g]),w(!0));else if(S==="a"&&d==="phases")k(!0),C("");else if(S==="d"&&d==="phases")t.length>1&&(i(y=>{y.thinkingStyle.phases=t.filter((L,z)=>z!==g)}),g>=t.length&&f(Math.max(0,t.length-1)));else if(S==="w"&&d==="phases"){if(g>0){const y=[...t];[y[g-1],y[g]]=[y[g],y[g-1]],i(L=>{L.thinkingStyle.phases=y}),f(L=>L-1)}}else if(S==="s"&&d==="phases"){if(g<t.length-1){const y=[...t];[y[g],y[g+1]]=[y[g+1],y[g]],i(L=>{L.thinkingStyle.phases=y}),f(L=>L+1)}}else N.ctrl&&S==="r"&&(i(y=>{y.thinkingStyle=Z.thinkingStyle}),f(0),b(0))});const X=r?"●":"○",oe=50,I=r?[...t,...[...t].reverse().slice(1,-1)]:t,$=I.length>0?I[U]:"·";return s(m,{children:h(m,{flexDirection:"column",width:"100%",children:[h(m,{flexDirection:"row",width:"100%",children:[h(m,{marginBottom:1,flexDirection:"column",width:`${100-oe}%`,children:[s(me,{children:"Thinking style"}),h(m,{flexDirection:"column",children:[h(c,{dimColor:!0,children:["enter to"," ",d==="updateInterval"?"edit interval":d==="presets"?"apply preset":"save"]}),s(c,{dimColor:!0,children:"esc to go back"}),s(c,{dimColor:!0,children:"tab to switch sections"})]})]}),h(m,{width:`${oe}%`,flexDirection:"column",children:[s(m,{children:s(c,{bold:!0,children:"Preview"})}),h(m,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[s(m,{width:($?.length??0)+1,children:s(c,{color:Y,children:$})}),h(c,{children:[s(c,{color:Y,children:"Thinking… "}),s(c,{children:"(esc to interrupt)"})]})]})]})]}),h(m,{flexDirection:"row",gap:4,children:[h(m,{flexDirection:"column",children:[h(c,{children:[s(c,{color:d==="reverseMirror"?"yellow":void 0,children:d==="reverseMirror"?"❯ ":" "}),s(c,{bold:!0,color:d==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),d==="reverseMirror"&&h(c,{dimColor:!0,children:[" ","space to toggle"]}),s(m,{marginLeft:2,marginBottom:1,children:h(c,{children:[X," ",r?"Enabled":"Disabled"]})})]}),h(m,{flexDirection:"column",children:[h(c,{children:[s(c,{color:d==="updateInterval"?"yellow":void 0,children:d==="updateInterval"?"❯ ":" "}),s(c,{bold:!0,color:d==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),d==="updateInterval"&&(P?h(c,{dimColor:!0,children:[" ","enter to save"]}):h(c,{dimColor:!0,children:[" ","enter to edit"]})),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:P?"yellow":"gray",children:s(c,{children:P?V:n})})})]})]}),s(m,{children:h(c,{children:[s(c,{color:d==="phases"?"yellow":void 0,children:d==="phases"?"❯ ":" "}),s(c,{bold:!0,color:d==="phases"?"yellow":void 0,children:"Phases"})]})}),d==="phases"&&s(m,{marginBottom:1,flexDirection:"column",children:h(c,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),s(m,{marginLeft:2,marginBottom:1,children:h(m,{flexDirection:"column",children:[(()=>{const N=Math.max(0,g-Math.floor(4)),y=Math.min(t.length,N+8),L=Math.max(0,y-8),z=t.slice(L,y);return h(he,{children:[L>0&&h(c,{color:"gray",dimColor:!0,children:[" ","↑ ",L," more above"]}),z.map((H,ne)=>{const ie=L+ne;return h(c,{color:d==="phases"&&ie===g?"cyan":void 0,children:[d==="phases"&&ie===g?"❯ ":" ",H]},ie)}),y<t.length&&h(c,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-y," more below"]})]})})(),_&&h(m,{children:[s(c,{color:"yellow",children:"❯ "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:x})})]}),p&&h(m,{marginTop:1,children:[s(c,{children:"Editing: "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(c,{children:x})})]})]})}),s(m,{children:h(c,{children:[s(c,{color:d==="presets"?"yellow":void 0,children:d==="presets"?"❯ ":" "}),s(c,{bold:!0,color:d==="presets"?"yellow":void 0,children:"Presets"})]})}),d==="presets"&&h(c,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{flexDirection:"column",children:(()=>{const N=Math.max(0,v-Math.floor(4)),y=Math.min(_e.length,N+8),L=Math.max(0,y-8),z=_e.slice(L,y);return h(he,{children:[L>0&&h(c,{color:"gray",dimColor:!0,children:[" ","↑ ",L," more above"]}),z.map((H,ne)=>{const ie=L+ne;return h(c,{color:d==="presets"&&ie===v?"cyan":void 0,children:[d==="presets"&&ie===v?"❯ ":" ",H.name," ",H.phases.join("")]},ie)}),y<_e.length&&h(c,{color:"gray",dimColor:!0,children:[" ","↓ ",_e.length-y," more below"]})]})})()})}),s(m,{marginTop:1,children:s(c,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const Pe=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function bo({onBack:e}){const{settings:t,updateSettings:n}=pe(ue),[r,o]=T("prefix"),[i,l]=T(0),[a,u]=T(!1),[d,g]=T(()=>t.userMessageDisplay.prefix.format),[f,v]=T(0),[b,p]=T(()=>[...t.userMessageDisplay.prefix.styling]),[w,x]=T(()=>t.userMessageDisplay.prefix.foreground_color),[C,_]=T(()=>t.userMessageDisplay.prefix.background_color),[k,P]=T(0),[O,V]=T(0),[K,U]=T(()=>[...t.userMessageDisplay.message.styling]),[A,B]=T(()=>t.userMessageDisplay.message.foreground_color),[E,Y]=T(()=>t.userMessageDisplay.message.background_color),[X,oe]=T(null),[q,I]=T(""),$=cn(),S=t.themes?.find(j=>j.id===$)||t.themes?.[0],N=["format","styling","foreground","background"],y=["styling","foreground","background"],L=N[i],z=y[k],H=(j,R)=>{n(D=>{const ee=j==="prefix"?D.userMessageDisplay.prefix:D.userMessageDisplay.message;R(ee)})},ne=j=>{n(R=>{j==="prefix"?R.userMessageDisplay.prefix={...Z.userMessageDisplay.prefix}:R.userMessageDisplay.message={...Z.userMessageDisplay.message}}),j==="prefix"?(g(Z.userMessageDisplay.prefix.format),p([...Z.userMessageDisplay.prefix.styling]),x(Z.userMessageDisplay.prefix.foreground_color),_(Z.userMessageDisplay.prefix.background_color)):(U([...Z.userMessageDisplay.message.styling]),B(Z.userMessageDisplay.message.foreground_color),Y(Z.userMessageDisplay.message.background_color))};xe(()=>{const j=t.userMessageDisplay.prefix;g(j.format),p([...j.styling]),x(j.foreground_color),_(j.background_color);const R=t.userMessageDisplay.message;U([...R.styling]),B(R.foreground_color),Y(R.background_color)},[]),de((j,R)=>{if(a){if(R.return)H("prefix",D=>{D.format=d}),u(!1);else if(R.escape){const D=t.userMessageDisplay.prefix;g(D.format),u(!1)}else R.backspace||R.delete?g(D=>D.slice(0,-1)):j&&g(D=>D+j);return}if(X===null){if(R.escape)e();else if(R.ctrl&&j==="r")ne(r);else if(R.leftArrow||R.rightArrow)o(D=>D==="prefix"?"message":"prefix");else if(R.tab)r==="prefix"?R.shift?l(D=>D===0?N.length-1:D-1):l(D=>D===N.length-1?0:D+1):R.shift?P(D=>D===0?y.length-1:D-1):P(D=>D===y.length-1?0:D+1);else if(R.return)r==="prefix"?L==="format"?u(!0):L==="foreground"?(I(w),oe({column:"prefix",type:"foreground"})):L==="background"&&(I(C),oe({column:"prefix",type:"background"})):z==="foreground"?(I(A),oe({column:"message",type:"foreground"})):z==="background"&&(I(E),oe({column:"message",type:"background"}));else if(R.upArrow)r==="prefix"&&L==="styling"?v(D=>Math.max(0,D-1)):r==="message"&&z==="styling"&&V(D=>Math.max(0,D-1));else if(R.downArrow)r==="prefix"&&L==="styling"?v(D=>Math.min(Pe.length-1,D+1)):r==="message"&&z==="styling"&&V(D=>Math.min(Pe.length-1,D+1));else if(j===" "){if(r==="prefix"&&L==="styling"){const D=Pe[f].value,ee=b.indexOf(D)>=0?b.filter(W=>W!==D):[...b,D];p(ee),H("prefix",W=>{W.styling=[...ee]})}else if(r==="message"&&z==="styling"){const D=Pe[O].value,ee=K.indexOf(D)>=0?K.filter(W=>W!==D):[...K,D];U(ee),H("message",W=>{W.styling=[...ee]})}}}});const ie=(j,R,D=!0)=>{const ee=D?R==="prefix"?b:K:[],W=D?R==="prefix"?w:A:"rgb(255,255,255)",Oe=D?R==="prefix"?C:E:"rgb(0,0,0)",Te=W==="rgb(0,0,0)"&&Oe==="rgb(0,0,0)",Ue=ee.length>0;return Te&&!Ue?s(c,{children:j}):s(c,{bold:ee.includes("bold"),italic:ee.includes("italic"),underline:ee.includes("underline"),strikethrough:ee.includes("strikethrough"),inverse:ee.includes("inverse"),color:Te?void 0:W,backgroundColor:Te?void 0:Oe,children:j})},$e=(j=!0)=>h(c,{children:[d&&h(he,{children:[ie(d,"prefix",j)," "]}),ie("list the dir","message",j)]}),be=j=>{const R=r===j,W=(j==="prefix"?N:y)[j==="prefix"?i:k],Oe=j==="prefix"?f:O,Te=j==="prefix"?b:K,Ue=j==="prefix"?w:A,gn=j==="prefix"?C:E;return h(m,{flexDirection:"column",width:"45%",borderStyle:R?"round":"single",borderColor:R?"yellow":"gray",padding:1,children:[s(m,{marginBottom:1,children:h(c,{bold:!0,color:R?"yellow":void 0,children:[j.charAt(0).toUpperCase()+j.slice(1)," ","Configuration"]})}),j==="prefix"&&h(he,{children:[s(m,{children:h(c,{color:R&&W==="format"?"yellow":void 0,bold:R&&W==="format",children:[R&&W==="format"?"❯ ":" ","Prefix Text"]})}),R&&W==="format"&&s(m,{marginLeft:2,children:s(c,{dimColor:!0,children:a?"enter to save":"enter to edit (appears before message)"})}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:a?"yellow":"gray",children:s(c,{children:d})})})]}),s(m,{children:h(c,{color:R&&W==="styling"?"yellow":void 0,bold:R&&W==="styling",children:[R&&W==="styling"?"❯ ":" ","Styling"]})}),R&&W==="styling"&&s(m,{marginLeft:2,children:s(c,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),s(m,{marginLeft:2,marginBottom:1,flexDirection:"column",children:Pe.map((We,hn)=>s(m,{children:h(c,{color:R&&W==="styling"&&Oe===hn?"cyan":void 0,children:[R&&W==="styling"&&Oe===hn?"❯ ":" ",Te.includes(We.value)?"●":"○"," ",We.label]})},We.value))}),s(m,{children:h(c,{color:R&&W==="foreground"?"yellow":void 0,bold:R&&W==="foreground",children:[R&&W==="foreground"?"❯ ":" ","Foreground color"]})}),R&&W==="foreground"&&s(m,{marginLeft:2,children:s(c,{dimColor:!0,children:"enter to open color picker"})}),s(m,{marginLeft:2,marginBottom:1,children:s(c,{color:Ue,children:Ue})}),s(m,{children:h(c,{color:R&&W==="background"?"yellow":void 0,bold:R&&W==="background",children:[R&&W==="background"?"❯ ":" ","Background color"]})}),R&&W==="background"&&s(m,{marginLeft:2,children:s(c,{dimColor:!0,children:"enter to open color picker"})}),s(m,{marginLeft:2,children:s(c,{backgroundColor:gn,children:gn})})]})};if(X){const{column:j,type:R}=X;return s(rt,{initialValue:q,theme:S,onColorChange:D=>{j==="prefix"?R==="foreground"?(x(D),H("prefix",ee=>{ee.foreground_color=D})):(_(D),H("prefix",ee=>{ee.background_color=D})):R==="foreground"?(B(D),H("message",ee=>{ee.foreground_color=D})):(Y(D),H("message",ee=>{ee.background_color=D}))},onExit:()=>{oe(null),I("")}})}return h(m,{flexDirection:"column",children:[s(me,{children:"Customize how user messages are displayed"}),h(m,{flexDirection:"column",marginBottom:1,children:[s(c,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),s(c,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),h(m,{flexDirection:"row",gap:1,children:[be("prefix"),be("message")]}),s(m,{borderStyle:"round",padding:1,marginTop:1,children:h(m,{flexDirection:"column",children:[s(m,{marginBottom:1,children:s(c,{bold:!0,children:"Preview"})}),h(m,{flexDirection:"row",gap:2,children:[h(m,{flexDirection:"column",width:"50%",children:[s(m,{marginBottom:1,children:s(c,{underline:!0,children:"Before (Claude Code default):"})}),s(m,{marginLeft:1,marginTop:1,children:h(c,{children:[s(c,{color:S?.colors?.inactive||"#888888",children:"●"}),s(c,{children:" The directory "}),s(c,{color:S?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(c,{children:" contains "}),s(c,{bold:!0,children:"123"}),s(c,{children:" files."})]})})]}),h(m,{flexDirection:"column",width:"50%",children:[s(m,{marginBottom:1,children:s(c,{underline:!0,children:"After (Your customization):"})}),s(m,{marginLeft:1,children:$e(!0)}),s(m,{marginLeft:1,marginTop:1,children:h(c,{children:[s(c,{color:S?.colors?.inactive||"#888888",children:"●"}),s(c,{children:" The directory "}),s(c,{color:S?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(c,{children:" contains "}),s(c,{bold:!0,children:"123"}),s(c,{children:" files."})]})})]})]})]})})]})}function wo({onSubmit:e}){const{settings:t,updateSettings:n}=pe(ue),[r,o]=T(0),i=()=>{n(b=>{b.inputBox||(b.inputBox={removeBorder:!1}),b.inputBox.removeBorder=!b.inputBox.removeBorder})},l=()=>{n(b=>{b.misc||(b.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),b.misc.showTweakccVersion=!b.misc.showTweakccVersion})},a=()=>{n(b=>{b.misc||(b.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),b.misc.showPatchesApplied=!b.misc.showPatchesApplied})},u=()=>{n(b=>{b.misc||(b.misc={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0}),b.misc.expandThinkingBlocks=!b.misc.expandThinkingBlocks})};de((b,p)=>{p.return||p.escape?e():p.upArrow?o(w=>Math.max(0,w-1)):p.downArrow?o(w=>Math.min(3,w+1)):b===" "&&(r===0?i():r===1?l():r===2?a():r===3&&u())});const d=t.inputBox?.removeBorder?"☑":"☐",g=t.misc?.showTweakccVersion?"☑":"☐",f=t.misc?.showPatchesApplied?"☑":"☐",v=t.misc?.expandThinkingBlocks?"☑":"☐";return h(m,{flexDirection:"column",children:[s(m,{marginBottom:1,children:s(me,{children:"Miscellaneous Settings"})}),s(m,{marginBottom:1,children:s(c,{color:"gray",children:s(c,{dimColor:!0,children:"Various tweaks and customizations. Press space to toggle settings, enter to go back."})})}),s(m,{children:h(c,{children:[s(c,{color:r===0?"cyan":void 0,children:r===0?"❯ ":" "}),s(c,{bold:!0,color:r===0?"cyan":void 0,children:"Remove input box border"})]})}),s(m,{flexDirection:"column",children:h(c,{dimColor:!0,children:[" ","Removes the rounded border around the input box for a cleaner look."]})}),s(m,{marginLeft:4,marginBottom:1,children:h(c,{children:[d," ",t.inputBox?.removeBorder?"Enabled":"Disabled"]})}),s(m,{children:h(c,{children:[s(c,{color:r===1?"cyan":void 0,children:r===1?"❯ ":" "}),s(c,{bold:!0,color:r===1?"cyan":void 0,children:"Show tweakcc version at startup"})]})}),s(m,{flexDirection:"column",children:h(c,{dimColor:!0,children:[" ",'Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.']})}),s(m,{marginLeft:4,marginBottom:1,children:h(c,{children:[g," ",t.misc?.showTweakccVersion?"Enabled":"Disabled"]})}),s(m,{children:h(c,{children:[s(c,{color:r===2?"cyan":void 0,children:r===2?"❯ ":" "}),s(c,{bold:!0,color:r===2?"cyan":void 0,children:"Show patches applied indicator at startup"})]})}),s(m,{flexDirection:"column",children:h(c,{dimColor:!0,children:[" ",'Shows the green "tweakcc patches are applied" indicator when starting Claude Code.']})}),s(m,{marginLeft:4,marginBottom:1,children:h(c,{children:[f," ",t.misc?.showPatchesApplied?"Enabled":"Disabled"]})}),s(m,{children:h(c,{children:[s(c,{color:r===3?"cyan":void 0,children:r===3?"❯ ":" "}),s(c,{bold:!0,color:r===3?"cyan":void 0,children:"Expand thinking blocks"})]})}),s(m,{flexDirection:"column",children:h(c,{dimColor:!0,children:[" ","Makes thinking blocks always expanded by default instead of collapsed."]})}),s(m,{marginLeft:4,marginBottom:1,children:h(c,{children:[v," ",t.misc?.expandThinkingBlocks?"Enabled":"Disabled"]})})]})}const je=["Task","Bash","Glob","Grep","Read","Edit","Write","NotebookEdit","WebFetch","WebSearch","BashOutput","KillShell","TodoWrite","AskUserQuestion","Skill","SlashCommand","ExitPlanMode"];function xo({toolsetIndex:e,onBack:t}){const{settings:n,updateSettings:r}=pe(ue),o=n.toolsets[e],[i,l]=T(o?.name||"New Toolset"),[a,u]=T(o?.allowedTools||[]),[d,g]=T(!1),[f,v]=T(0);xe(()=>{o&&r(C=>{C.toolsets[e].name=i,C.toolsets[e].allowedTools=a})},[i,a]);const b=C=>a==="*"?!0:a.includes(C),p=C=>{C==="All"?u("*"):C==="None"?u([]):a==="*"?u(je.filter(_=>_!==C)):a.includes(C)?u(a.filter(_=>_!==C)):u([...a,C])};if(de((C,_)=>{if(d){_.return?g(!1):_.escape?(l(o?.name||"New Toolset"),g(!1)):_.backspace||_.delete?l(k=>k.slice(0,-1)):C&&C.length===1&&l(k=>k+C);return}if(_.escape)t();else if(_.upArrow)v(k=>Math.max(0,k-1));else if(_.downArrow)v(k=>Math.min(je.length+1,k+1));else if(C===" "||_.return)if(f===0)p("All");else if(f===1)p("None");else{const k=je[f-2];k&&p(k)}else C==="n"&&g(!0)}),!o)return s(m,{flexDirection:"column",children:s(c,{color:"red",children:"Toolset not found"})});const w=a==="*",x=Array.isArray(a)&&a.length===0;return h(m,{flexDirection:"column",children:[s(me,{children:"Edit Toolset"}),s(m,{marginBottom:1,flexDirection:"column",children:s(c,{dimColor:!0,children:"n to edit name · space/enter to toggle · esc to go back"})}),h(m,{marginBottom:1,flexDirection:"column",children:[s(c,{bold:!0,children:"Name:"}),s(m,{marginLeft:2,children:s(m,{borderStyle:"round",borderColor:d?"yellow":"gray",children:s(c,{children:i})})}),d&&s(m,{marginLeft:2,children:s(c,{dimColor:!0,children:"enter to save · esc to cancel"})})]}),h(m,{marginBottom:1,flexDirection:"column",children:[s(c,{bold:!0,children:"Allowed Tools:"}),s(m,{marginLeft:2,children:h(c,{color:f===0?"cyan":void 0,children:[f===0?"❯ ":" ",w?"●":"○"," All"]})}),s(m,{marginLeft:2,children:h(c,{color:f===1?"cyan":void 0,children:[f===1?"❯ ":" ",x?"●":"○"," None"]})}),je.map((C,_)=>{const k=_+2;return s(m,{marginLeft:2,children:h(c,{color:f===k?"cyan":void 0,children:[f===k?"❯ ":" ",b(C)?"◉":"○"," ",C]})},C)})]}),s(m,{borderStyle:"round",padding:1,marginTop:1,children:h(m,{flexDirection:"column",children:[s(c,{bold:!0,children:"Summary:"}),h(c,{children:["Name: ",s(c,{color:"cyan",children:i})]}),h(c,{children:["Tools:"," ",a==="*"?s(c,{color:"green",children:"All tools (*)"}):a.length===0?s(c,{color:"red",children:"No tools ([])"}):h(c,{color:"yellow",children:[a.length," selected"]})]})]})})]})}function yo({onBack:e}){const{settings:{toolsets:t,defaultToolset:n},updateSettings:r}=pe(ue),[o,i]=T(0),[l,a]=T(null),[u,d]=T(!0),g=()=>{const p={name:"New Toolset",allowedTools:[]};r(w=>{w.toolsets.push(p)}),a(t.length),d(!1)},f=p=>{const w=t[p];r(x=>{x.toolsets.splice(p,1),x.defaultToolset===w.name&&(x.defaultToolset=null)}),o>=t.length-1&&i(Math.max(0,t.length-2))},v=p=>{const w=t[p];r(x=>{x.defaultToolset=w.name})};if(de((p,w)=>{w.escape?e():w.upArrow?i(x=>Math.max(0,x-1)):w.downArrow?i(x=>Math.min(t.length-1,x+1)):w.return&&t.length>0?(a(o),d(!1)):p==="n"?g():p==="d"&&t.length>0?f(o):p==="s"&&t.length>0&&v(o)},{isActive:u}),l!==null)return s(xo,{toolsetIndex:l,onBack:()=>{a(null),d(!0)}});const b=p=>p.allowedTools==="*"?"All tools":p.allowedTools.length===0?"No tools":`${p.allowedTools.length} tool${p.allowedTools.length===1?"":"s"}`;return h(m,{flexDirection:"column",children:[s(me,{children:"Toolsets"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(c,{dimColor:!0,children:"n to create a new toolset"}),t.length>0&&s(c,{dimColor:!0,children:"s to set as default toolset"}),t.length>0&&s(c,{dimColor:!0,children:"d to delete a toolset"}),t.length>0&&s(c,{dimColor:!0,children:"enter to edit toolset"}),s(c,{dimColor:!0,children:"esc to go back"})]}),t.length===0?s(c,{children:"No toolsets created yet. Press n to create one."}):s(m,{flexDirection:"column",children:t.map((p,w)=>{const x=p.name===n,C=o===w;return h(c,{color:C?"yellow":void 0,bold:x,children:[C?"❯ ":" ",p.name,x&&" [DEFAULT]"," (",b(p),")"]},w)})})]})}const ue=st({settings:Z,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function So({startupCheckInfo:e}){const[t,n]=T({settings:Z,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});xe(()=>{(async()=>{n(await sn())})()},[]);const r=En(g=>{const f=JSON.parse(JSON.stringify(t.settings));g(f),n(v=>({...v,settings:f,changesApplied:!1})),Ve(v=>{v.settings=f,v.changesApplied=!1})},[t.settings]),[o,i]=T(null),[l,a]=T(null);xe(()=>{e.wasUpdated&&e.oldVersion&&(a({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
436
436
  (However, your customization are still remembered in ${fe}.)
437
- Please reapply your changes below.`,type:"warning"}),r(()=>{}))},[]),de((g,m)=>{(m.ctrl&&g==="c"||(g==="q"||m.escape)&&!o)&&process.exit(0)},{isActive:!o});const u=g=>{switch(a(null),g){case J.APPLY_CHANGES:e.ccInstInfo&&(a({message:"Applying patches...",type:"info"}),Zn(t,e.ccInstInfo).then(m=>{n(m),a({message:"Customization patches applied successfully!",type:"success"})}));break;case J.THEMES:case J.THINKING_VERBS:case J.THINKING_STYLE:case J.USER_MESSAGE_DISPLAY:case J.MISC:case J.TOOLSETS:i(g);break;case J.VIEW_SYSTEM_PROMPTS:lo(ye);break;case J.RESTORE_ORIGINAL:e.ccInstInfo&&Gn(e.ccInstInfo).then(()=>{a({message:"Original Claude Code restored successfully!",type:"success"}),r(()=>{})});break;case J.OPEN_CONFIG:In(fe);break;case J.OPEN_CLI:e.ccInstInfo?.cliPath&&In(e.ccInstInfo.cliPath);break;case J.EXIT:process.exit(0)}},d=()=>{i(null)};return s(ue.Provider,{value:{settings:t.settings,updateSettings:r,changesApplied:t.changesApplied,ccVersion:e.ccInstInfo?.version||""},children:s(f,{flexDirection:"column",children:o===null?s(mt,{onSubmit:u,notification:l,isNativeInstallation:!!e.ccInstInfo?.nativeInstallationPath}):o===J.THEMES?s(fo,{onBack:d}):o===J.THINKING_VERBS?s(mo,{onBack:d}):o===J.THINKING_STYLE?s(po,{onBack:d}):o===J.USER_MESSAGE_DISPLAY?s(bo,{onBack:d}):o===J.MISC?s(wo,{onSubmit:d}):o===J.TOOLSETS?s(So,{onBack:d}):null})})}const vo=async()=>{const e=new it;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("3.0.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&&oo(),t.apply){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${fe}`);const r=await sn();(!r.settings||Object.keys(r.settings).length===0)&&(console.error("No saved customizations found in "+fe),process.exit(1));const o=await _n();(!o||!o.ccInstInfo)&&(console.error("Cannot find Claude Code's cli.js"),console.error("Searched for cli.js at the following locations:"),Ze.forEach(l=>{l.isGlob?l.expandedPaths.length===0?console.error(` - ${l.pattern} (no matches)`):(console.error(` - ${l.pattern}`),l.expandedPaths.forEach(a=>{console.error(` - ${a}`)})):console.error(` - ${l.pattern}`)}),console.error(`
438
- Also checked for 'claude' executable on PATH using '${process.platform==="win32"?"where claude.exe":"which claude"}'.`),process.exit(1)),o.ccInstInfo.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${o.ccInstInfo.nativeInstallationPath}`):console.log(`Found Claude Code at: ${o.ccInstInfo.cliPath}`),console.log(`Version: ${o.ccInstInfo.version}`),console.log("Loading system prompts...");const i=await yn(o.ccInstInfo.version);i.success||(console.log(Q.red(`
437
+ Please reapply your changes below.`,type:"warning"}),r(()=>{}))},[]),de((g,f)=>{(f.ctrl&&g==="c"||(g==="q"||f.escape)&&!o)&&process.exit(0)},{isActive:!o});const u=g=>{switch(a(null),g){case J.APPLY_CHANGES:e.ccInstInfo&&(a({message:"Applying patches...",type:"info"}),Zn(t,e.ccInstInfo).then(f=>{n(f),a({message:"Customization patches applied successfully!",type:"success"})}));break;case J.THEMES:case J.THINKING_VERBS:case J.THINKING_STYLE:case J.USER_MESSAGE_DISPLAY:case J.MISC:case J.TOOLSETS:i(g);break;case J.VIEW_SYSTEM_PROMPTS:lo(Se);break;case J.RESTORE_ORIGINAL:e.ccInstInfo&&Gn(e.ccInstInfo).then(()=>{a({message:"Original Claude Code restored successfully!",type:"success"}),r(()=>{})});break;case J.OPEN_CONFIG:In(fe);break;case J.OPEN_CLI:e.ccInstInfo?.cliPath&&In(e.ccInstInfo.cliPath);break;case J.EXIT:process.exit(0)}},d=()=>{i(null)};return s(ue.Provider,{value:{settings:t.settings,updateSettings:r,changesApplied:t.changesApplied,ccVersion:e.ccInstInfo?.version||""},children:s(m,{flexDirection:"column",children:o===null?s(mt,{onSubmit:u,notification:l,isNativeInstallation:!!e.ccInstInfo?.nativeInstallationPath}):o===J.THEMES?s(fo,{onBack:d}):o===J.THINKING_VERBS?s(mo,{onBack:d}):o===J.THINKING_STYLE?s(po,{onBack:d}):o===J.USER_MESSAGE_DISPLAY?s(bo,{onBack:d}):o===J.MISC?s(wo,{onSubmit:d}):o===J.TOOLSETS?s(yo,{onBack:d}):null})})}const vo=async()=>{const e=new it;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("3.0.1").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const t=e.opts();if(t.debug&&oo(),t.apply){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${fe}`);const r=await sn();(!r.settings||Object.keys(r.settings).length===0)&&(console.error("No saved customizations found in "+fe),process.exit(1));const o=await _n();(!o||!o.ccInstInfo)&&(console.error("Cannot find Claude Code's cli.js"),console.error("Searched for cli.js at the following locations:"),Ze.forEach(l=>{l.isGlob?l.expandedPaths.length===0?console.error(` - ${l.pattern} (no matches)`):(console.error(` - ${l.pattern}`),l.expandedPaths.forEach(a=>{console.error(` - ${a}`)})):console.error(` - ${l.pattern}`)}),console.error(`
438
+ Also checked for 'claude' executable on PATH using '${process.platform==="win32"?"where claude.exe":"which claude"}'.`),process.exit(1)),o.ccInstInfo.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${o.ccInstInfo.nativeInstallationPath}`):console.log(`Found Claude Code at: ${o.ccInstInfo.cliPath}`),console.log(`Version: ${o.ccInstInfo.version}`),console.log("Loading system prompts...");const i=await Sn(o.ccInstInfo.version);i.success||(console.log(Q.red(`
439
439
  ✖ Error downloading system prompts:`)),console.log(Q.red(` ${i.errorMessage}`)),console.log(Q.yellow(`
440
- ⚠ System prompts not available - skipping system prompt customizations`))),console.log("Applying customizations..."),await Zn(r,o.ccInstInfo),console.log("Customizations applied successfully!"),process.exit(0)}const n=await _n();if(n){const r=await yn(n.ccInstInfo.version);r.success||(console.log(Q.red(`
440
+ ⚠ System prompts not available - skipping system prompt customizations`))),console.log("Applying customizations..."),await Zn(r,o.ccInstInfo),console.log("Customizations applied successfully!"),process.exit(0)}const n=await _n();if(n){const r=await Sn(n.ccInstInfo.version);r.success||(console.log(Q.red(`
441
441
  ✖ Error downloading system prompts:`)),console.log(Q.red(` ${r.errorMessage}`)),console.log(Q.yellow(`⚠ System prompts not available - system prompt customizations will be skipped
442
- `))),ot(s(yo,{startupCheckInfo:n}))}else console.error(`Cannot find Claude Code's cli.js -- do you have Claude Code installed?
442
+ `))),ot(s(So,{startupCheckInfo:n}))}else console.error(`Cannot find Claude Code's cli.js -- do you have Claude Code installed?
443
443
 
444
444
  Searched for cli.js at the following locations:
445
445
  ${Ze.map(o=>{if(o.isGlob){if(o.expandedPaths.length===0)return`- ${o.pattern} (no matches)`;{const i=[`- ${o.pattern}`];return o.expandedPaths.forEach(l=>{i.push(` - ${l}`)}),i.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tweakcc",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "type": "module",
5
5
  "description": "Command-line tool to customize your Claude Code theme colors, thinking verbs and more.",
6
6
  "main": "dist/index.js",
@@ -56,7 +56,7 @@
56
56
  "gray-matter": "^4.0.3",
57
57
  "ink": "^6.1.0",
58
58
  "ink-link": "^4.1.0",
59
- "node-lief": "0.1.0-pre.8",
59
+ "node-lief": "0.1.4",
60
60
  "ollama": "^0.6.0",
61
61
  "openai": "^6.3.0",
62
62
  "react": "^19.1.1"