tweakcc-fixed 2.0.4 → 2.0.5
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.
- package/dist/{config-BGsQaczu.mjs → config-B1Mrn1vp.mjs} +2 -2
- package/dist/{content-M0EgBl6Y.mjs → content-bCX2ah6I.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/{nativeInstallation-D1YCx8O8.mjs → nativeInstallation-B66wq9dv.mjs} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";import t from"chalk";import*as n from"node:os";import r,{EOL as i}from"node:os";import*as a from"node:fs/promises";import o from"node:fs/promises";import*as s from"node:fs";import c from"node:fs";import*as l from"node:path";import u from"node:path";import*as d from"fs";import*as f from"path";import*as p from"os";import*as m from"child_process";import*as h from"crypto";import{spawnSync as g}from"node:child_process";import _ from"gray-matter";import{fileURLToPath as v}from"node:url";import{Worker as y}from"node:worker_threads";import{diffWordsWithSpace as b}from"diff";let x=null;async function S(){if(x!==null)return x;try{return await import(`node-lief`),x=await import(`./nativeInstallation-D1YCx8O8.mjs`),x}catch(e){return G(`Error loading native installation module: ${e instanceof Error?e.message:String(e)}`),e instanceof Error&&G(e),null}}async function C(e,t){let n=await S();return n?n.extractClaudeJsFromNativeInstallation(e,t):{data:null,clearBytecode:!1}}async function w(e,t,n,r){let i=await S();if(!i)throw Error("`repackNativeInstallation()` called but `node-lief` is not available. This is unexpected - `extractClaudeJsFromNativeInstallation()` should have been called first.");i.repackNativeInstallation(e,t,n,r)}async function T(e){let t=await S();return t?t.resolveNixBinaryWrapper(e):null}const E={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.Architecting.Baking.Beaming.Beboppin'.Befuddling.Billowing.Blanching.Bloviating.Boogieing.Boondoggling.Booping.Bootstrapping.Brewing.Burrowing.Calculating.Canoodling.Caramelizing.Cascading.Catapulting.Cerebrating.Channeling.Channelling.Choreographing.Churning.Clauding.Coalescing.Cogitating.Combobulating.Composing.Computing.Concocting.Considering.Contemplating.Cooking.Crafting.Creating.Crunching.Crystallizing.Cultivating.Deciphering.Deliberating.Determining.Dilly-dallying.Discombobulating.Doing.Doodling.Drizzling.Ebbing.Effecting.Elucidating.Embellishing.Enchanting.Envisioning.Evaporating.Fermenting.Fiddle-faddling.Finagling.Flambéing.Flibbertigibbeting.Flowing.Flummoxing.Fluttering.Forging.Forming.Frolicking.Frosting.Gallivanting.Galloping.Garnishing.Generating.Germinating.Gitifying.Grooving.Gusting.Harmonizing.Hashing.Hatching.Herding.Honking.Hullaballooing.Hyperspacing.Ideating.Imagining.Improvising.Incubating.Inferring.Infusing.Ionizing.Jitterbugging.Julienning.Kneading.Leavening.Levitating.Lollygagging.Manifesting.Marinating.Meandering.Metamorphosing.Misting.Moonwalking.Moseying.Mulling.Mustering.Musing.Nebulizing.Nesting.Newspapering.Noodling.Nucleating.Orbiting.Orchestrating.Osmosing.Perambulating.Percolating.Perusing.Philosophising.Photosynthesizing.Pollinating.Pondering.Pontificating.Pouncing.Precipitating.Prestidigitating.Processing.Proofing.Propagating.Puttering.Puzzling.Quantumizing.Razzle-dazzling.Razzmatazzing.Recombobulating.Reticulating.Roosting.Ruminating.Sautéing.Scampering.Schlepping.Scurrying.Seasoning.Shenaniganing.Shimmying.Simmering.Skedaddling.Sketching.Slithering.Smooshing.Sock-hopping.Spelunking.Spinning.Sprouting.Stewing.Sublimating.Swirling.Swooping.Symbioting.Synthesizing.Tempering.Thinking.Thundering.Tinkering.Tomfoolering.Topsy-turvying.Transfiguring.Transmuting.Twisting.Undulating.Unfurling.Unravelling.Vibing.Waddling.Wandering.Warping.Whatchamacalliting.Whirlpooling.Whirring.Whisking.Wibbling.Working.Wrangling.Zesting.Zigzagging`.split(`.`)},thinkingStyle:{updateInterval:120,phases:process.env.TERM===`xterm-ghostty`?[`·`,`✢`,`✳`,`✶`,`✻`,`*`]:process.platform===`darwin`?[`·`,`✢`,`✳`,`✶`,`✻`,`✽`]:[`·`,`✢`,`*`,`✶`,`✻`,`✽`],reverseMirror:!0},userMessageDisplay:{format:` > {} `,styling:[],foregroundColor:`default`,backgroundColor:`default`,borderStyle:`none`,borderColor:`rgb(255,255,255)`,paddingX:`default`,paddingY:`default`,fitBoxToContent:!1},inputBox:{removeBorder:!1},misc:{showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEdit:!1,hideStartupClawd:!1,increaseFileReadLimit:!1,suppressLineNumbers:!1,suppressRateLimitOptions:!1,mcpConnectionNonBlocking:!0,mcpServerBatchSize:null,statuslineThrottleMs:null,statuslineUseFixedInterval:!1,tableFormat:`default`,enableSwarmMode:!0,enableSessionMemory:!0,enableDreamMode:!0,enableLeanMemoryTypes:!1,fixSummarizeFromHere:!0,fixRewindSummaryHeader:!0,enableRememberSkill:!1,tokenCountRounding:null,autoAcceptPlanMode:!1,allowBypassPermissionsInSudo:!1,suppressNativeInstallerWarning:!1,filterScrollEscapeSequences:!1,enableWorktreeMode:!0,allowCustomAgentModels:!1,enableContextLimitOverride:!1,enableModelCustomizations:!0,enableVoiceMode:!1,enableVoiceConciseOutput:!0,enableChannelsMode:!1,maxEffortDefault:!1,autoModeClassifierModel:`default`,suppressDeferredTools:!1,claudemdContextOncePerConversation:!0},toolsets:[],defaultToolset:null,planModeToolset:null,subagentModels:{plan:null,explore:null,generalPurpose:null},inputPatternHighlighters:[],inputPatternHighlightersTestText:`Type test text here to see highlighting`,claudeMdAltNames:[`AGENTS.md`,`GEMINI.md`,`CRUSH.md`,`QWEN.md`,`IFLOW.md`,`WARP.md`,`copilot-instructions.md`]},ee={name:`Unnamed Highlighter`,regex:``,regexFlags:`g`,format:`{MATCH}`,styling:[],foregroundColor:null,backgroundColor:null,enabled:!0},te={name:`Unnamed Toolset`,allowedTools:`*`},ne=E.themes[0],re=e=>{let t=[],n=/visibleOptionCount:[\w$]+=(\d+)/g,r;for(;(r=n.exec(e))!==null;){let e=r.index+r[0].indexOf(`=`)+1;t.push({startIndex:e,endIndex:e+r[1].length})}return t},ie=e=>{let t=e.match(/\{rows:([\w$]+),columns:[\w$]+\}=[\w$]+\(\),[\w$]+=[\w$]+\?[\w$]+:Math\.max\(1,Math\.min\(Math\.max\(6,Math\.floor\(\1\/2\)\),\1-3\)\)/);if(t&&t.index!==void 0){let n=t[1],r=`Math.floor(${n}/2)`,i=t.index+t[0].indexOf(r),a=i+r.length,o=e.slice(0,i)+n+e.slice(a);return F(e,o,n,i,a),o}let n=e.match(/\{rows:([\w$]+),columns:[\w$]+\}=[\w$]+\(\),([\w$]+)=Math\.floor\(\1\/2\)/);if(n&&n.index!==void 0){let t=n.index+n[0].indexOf(n[2]+`=Math.floor(`),r=n.index+n[0].length,i=`${n[2]}=${n[1]}`,a=e.slice(0,t)+i+e.slice(r);return F(e,a,i,t,r),a}let r=/Math\.max\(1,Math\.floor\(\(([\w$]+)-([\w$]+)\)\/([\w$]+)\)\)/g,i;for(;(i=r.exec(e))!==null;){let t=Math.max(0,i.index-250),n=e.slice(t,i.index);if(!n.includes(`"expanded"?3`)||!n.includes(`"compact"?1:2`))continue;let r=i.index,a=i.index+i[0].length,o=`Math.max(1,${i[1]}-${i[2]})`,s=e.slice(0,r)+o+e.slice(a);return F(e,s,o,r,a),s}return null},D=e=>{let t=e.match(/Math\.max\(1,Math\.floor\(\(([\w$]+)-10\)\/2\)\)/);if(!t||t.index===void 0)return null;let n=`Math.max(1,${t[1]}-3)`,r=e.slice(0,t.index)+n+e.slice(t.index+t[0].length);return F(e,r,n,t.index,t.index+t[0].length),r},O=e=>{if(!e.includes(`Math.min(6,Math.max(1,`))return G(`patch: showMoreItemsInSelectMenus: suggestions cap already removed in this CC build — no-op`),e;let t=e.match(/Math\.min\(6,Math\.max\(1,([\w$]+)-3\)\)/);if(!t||t.index===void 0)return null;let n=`Math.max(1,${t[1]}-3)`,r=e.slice(0,t.index)+n+e.slice(t.index+t[0].length);return F(e,r,n,t.index,t.index+t[0].length),r},ae=(e,t)=>{let n=re(e);if(n.length===0)return console.error(`patch: writeShowMoreItemsInSelectMenus: failed to find locations`),null;let r=n.sort((e,t)=>t.startIndex-e.startIndex),i=e;for(let e of r){let n=t.toString(),r=i.slice(0,e.startIndex)+n+i.slice(e.endIndex);F(i,r,n,e.startIndex,e.endIndex),i=r}let a=ie(i);a?i=a:console.error(`patch: writeShowMoreItemsInSelectMenus: failed to find help menu height pattern`);let o=D(i);o?i=o:console.error(`patch: writeShowMoreItemsInSelectMenus: failed to find visibleCount pattern`);let s=O(i);return s&&(i=s),i};function oe(e){let t=-1,n=-1,r=``,i=e.match(/switch\(([$\w]+)\)\{case"(?:light|dark)":[^}]*return [$\w]+;[^}]*default:return [$\w]+\}/);if(i&&i.index!=null)t=i.index,n=t+i[0].length,r=i[1];else{if(e.indexOf(`case"dark":return{"autoAccept"`)===-1&&e.indexOf(`case"light":return{`)===-1)return console.error(`patch: themes: failed to find switchMatch`),null;let i=e.indexOf(`case"dark":return{`)===-1?e.indexOf(`case"light":return{`):e.indexOf(`case"dark":return{`),a=e.slice(Math.max(0,i-200),i).match(/switch\(([$\w]+)\)\{\s*$/);if(!a||a.index==null)return console.error(`patch: themes: failed to find switchMatch (old format)`),null;t=Math.max(0,i-200)+a.index,r=a[1];let o=0;for(let r=t;r<e.length&&r<t+5e4;r++)if(e[r]===`{`&&o++,e[r]===`}`&&(o--,o===0)){n=r+1;break}}if(t===-1||n===-1)return console.error(`patch: themes: failed to find switchMatch`),null;let a=-1,o=-1,s=``,c=e.match(/\[(?:\.\.\.\[\],)?(?:\{"?label"?:"(?:Dark|Light|Auto|Monochrome)[^"]*","?value"?:"[^"]+"\},?)+\]/);if(c&&c.index!==void 0)a=c.index,o=c.index+c[0].length;else{let t=[...e.matchAll(/([$\w]+)=\{label:"(?:Auto|Dark|Light|Monochrome)[^"]*",value:"[^"]+"\}/g)];if(t.length<2)return console.error(`patch: themes: failed to find objArrMatch`),null;let n=t.map(e=>e[1]).map(e=>e.replace(/\$/g,`\\$`)).join(`,`),r=RegExp(`\\[${n}((?:,\\.\\.\\.[^\\]]+)*)\\]`),i=e.match(r);if(!i||i.index===void 0)return console.error(`patch: themes: failed to find objArrMatch (new var-collected form)`),null;a=i.index,o=i.index+i[0].length,s=i[1]}let l=e.match(/(return|[$\w]+=)\{(?:"?(?:[$\w-]+)"?:"(?:Auto |Dark|Light|Monochrome)[^"]*",?)+\}/);return(!l||l.index==null)&&G(`patch: themes: objMatch not found — colors will still apply, theme name map unchanged`),{switchStatement:{startIndex:t,endIndex:n,identifiers:[r]},objArr:{startIndex:a,endIndex:o,identifiers:[s]},obj:l&&l.index!==void 0?{startIndex:l.index,endIndex:l.index+l[0].length,identifiers:[l[1]]}:null}}const se=(e,t)=>{let n=oe(e);if(!n)return null;if(t.length===0)return e;let r=e;if(n.obj){let i=(n.obj.identifiers?.[0]??`return`)+JSON.stringify(Object.fromEntries(t.map(e=>[e.id,e.name])));r=r.slice(0,n.obj.startIndex)+i+r.slice(n.obj.endIndex),F(e,r,i,n.obj.startIndex,n.obj.endIndex),e=r}let i=n.objArr.identifiers?.[0]??``,a=`[${t.map(e=>JSON.stringify({label:e.name,value:e.id})).join(`,`)}${i}]`;r=r.slice(0,n.objArr.startIndex)+a+r.slice(n.objArr.endIndex),F(e,r,a,n.objArr.startIndex,n.objArr.endIndex),e=r;let o=`switch(${n.switchStatement.identifiers?.[0]}){\n`;return t.forEach(e=>{o+=`case"${e.id}":return${JSON.stringify(e.colors)};\n`}),o+=`default:return${JSON.stringify(t[0].colors)};\n}`,r=r.slice(0,n.switchStatement.startIndex)+o+r.slice(n.switchStatement.endIndex),F(e,r,o,n.switchStatement.startIndex,n.switchStatement.endIndex),r},ce=e=>{let t=/var ([\w$]+)=200000,([\w$]+)=20000,([\w$]+)=32000,([\w$]+)=(128000|64000);/,n=e.match(t);return n?e.replace(t,`var ${n[1]}=(+process.env.CLAUDE_CODE_CONTEXT_LIMIT||200000),${n[2]}=20000,${n[3]}=32000,${n[4]}=${n[5]};`):(console.error(`patch: contextLimit: failed to find context limit constants`),null)},le=(e,t)=>{if(!t)return e;let n=e,r=!1,i=n.match(/createElement\(([$\w]+),\{color:([$\w]+)\.bgColor\},"─"\.repeat\(([$\w]+)\)\)/);if(i){let e=i[1];n=n.replace(i[0],`createElement(${e},null,"")`);let t=RegExp(`createElement\\(${e},\\{color:${i[2]}\\.bgColor\\},${i[2]}\\.text\\?.+?"─"\\.repeat\\(${i[3]}\\)\\)`),a=n.match(t);a&&(n=n.replace(a[0],`createElement(${e},null,"")`)),r=!0}let a=n.match(/(borderColor:[$\w]+\(\),)borderStyle:"round"(,borderLeft:!1,borderRight:!1,borderBottom:!0,width:"100%",borderText:)/);a&&(n=n.replace(a[0],`${a[1]}borderStyle:undefined${a[2]}`),r=!0);let o=n.match(/borderStyle:"round"(,borderLeft:!1,borderRight:!1,borderBottom:!0,width:"100%"\}.+?Save and close editor)/);return o&&(n=n.replace(o[0],`borderStyle:undefined${o[1]}`),r=!0),r?(F(e,n,`(input border removed)`,0,0),n):(console.error(`patch: input border: failed to find input border pattern`),null)},ue=e=>{let t=(e.match(/overrideMessage:[$\w]+,isCompacting:[$\w]+,compactingHintText:[$\w]+,compactingStartTime:[$\w]+,spinnerSuffix:[$\w]+,verbose:[$\w]+,.{300}/)||e.match(/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/)||e.match(/overrideMessage:[$\w]+,spinnerSuffix:[$\w]+,verbose:[$\w]+,.{300}/)||e.match(/pauseStartTimeRef:[$\w]+,spinnerSuffix:[$\w]+,verbose:[$\w]+,.{300}/))?.index,n=t===void 0?``:e.slice(t,t+2e4),r=n.match(/,([$\w]+)(=\(([^;]{1,200}?)\)\+"(?:…|\\u2026)")/);if(r&&r.index!=null)return{startIndex:t+r.index+r[1].length+1,endIndex:t+r.index+r[1].length+r[2].length+1,identifiers:[r[3]]};let i=/,([$\w]+)(=(\([$\w]+&&![$\w]+\.isIdle\?[$\w]+\.spinnerVerb\?\?[$\w]+:[$\w]+\))\+"(?:…|\\u2026)")/,a=n.match(i);if(a&&a.index!=null)return{startIndex:t+a.index+a[1].length+1,endIndex:t+a.index+a[1].length+a[2].length+1,identifiers:[a[3]]};let o=n.match(/,([$\w]+)(=`\$\{([$\w]+&&![$\w]+\.isIdle\?[$\w]+\.spinnerVerb\?\?[$\w]+:[$\w]+)\}(?:…|\\u2026) ?`)/);if(o&&o.index!=null)return{startIndex:t+o.index+o[1].length+1,endIndex:t+o.index+o[1].length+o[2].length+1,identifiers:[o[3]]};let s=new RegExp(i.source,`g`),c=[...e.matchAll(s)].filter(t=>{if(t.index==null)return!1;let n=e.slice(Math.max(0,t.index-2500),t.index+1e3);return n.includes(`overrideMessage:`)&&n.includes(`.activeForm`)&&n.includes(`.isIdle`)&&n.includes(`.spinnerVerb`)&&n.includes(`spinnerTip`)});if(c.length===1){let e=c[0];return{startIndex:e.index+e[1].length+1,endIndex:e.index+e[1].length+e[2].length+1,identifiers:[e[3]]}}return console.error(`patch: thinker format: failed to find formatMatch`),null},de=(e,t)=>{let n=ue(e);if(!n)return null;let r=n,i=t.replace(/\\/g,`\\\\`).replace(/`/g,"\\`"),a=r.identifiers?.[0],o=`=${"`"+i.replace(/\{\}/g,"${"+a+`}`)+"`"}`,s=e.slice(0,r.startIndex)+o+e.slice(r.endIndex);return F(e,s,o,r.startIndex,r.endIndex),s},fe=e=>{let t=e.match(/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/);return!t||t.index==null?(console.error(`patch: thinker symbol mirror option: failed to find match`),null):{startIndex:t.index,endIndex:t.index+t[0].length,identifiers:[t[1]]}},pe=(e,t)=>{let n=fe(e);if(!n)return null;let r=n.identifiers?.[0],i=t?`=[...${r},...[...${r}].reverse()]`:`=[...${r}]`,a=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return F(e,a,i,n.startIndex,n.endIndex),a},me=(e,t)=>{let n=[],r=/\["(?:[·✢*✳✶✻✽]|\\u00b7|\\xb7|\\u2722|\\x2a|\\u002a|\\u2733|\\u2736|\\u273b|\\u273d)",\s*(?:"(?:[·✢*✳✶✻✽]|\\u00b7|\\xb7|\\u2722|\\x2a|\\u002a|\\u2733|\\u2736|\\u273b|\\u273d)",?\s*)+\]/gi,i;for(;(i=r.exec(e))!==null;)n.push({startIndex:i.index,endIndex:i.index+i[0].length});if(n.length===0)return console.error(`patch: thinkerSymbolChars: could not find any thinker symbol char arrays`),null;let a=JSON.stringify(t),o=n.sort((e,t)=>t.startIndex-e.startIndex),s=e;for(let e=0;e<o.length;e++){let t=s.slice(0,o[e].startIndex)+a+s.slice(o[e].endIndex);F(s,t,a,o[e].startIndex,o[e].endIndex),s=t}return s},he=(e,t)=>{let n=e.match(/(if\(![$\w]+\)\{[$\w]+\(4\);return\})(.{0,200})120\)/);if(!n||n.index===void 0)return console.error(`patch: thinkerSymbolSpeed: failed to find thinker symbol speed pattern`),null;let r=n[2]+t+`)`,i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},ge=e=>{let t=e.match(/\{("aria-hidden":!0,)?flexWrap:"wrap",height:1,width:2\}/);return!t||t.index==null?(console.error(`patch: thinker symbol width: failed to find match`),null):{startIndex:t.index,endIndex:t.index+t[0].length,prefix:t[1]??``}},_e=(e,t)=>{let n=ge(e);if(!n)return null;let r=`{${n.prefix}flexWrap:"wrap",height:1,width:${t}}`,i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return F(e,i,r,n.startIndex,n.endIndex),i},ve=(e,t)=>{let n=e.match(/\[("[A-Z][a-z'é\-\\xA-F0-9]+in[g']",?){50,}\]/);if(!n||n.index===void 0)return console.error(`patch: thinkingVerbs: failed to find present tense verbs pattern`),null;let r=JSON.stringify(t),i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},ye=(e,t)=>{let n=e.match(/\[("[A-Z][a-z'é\-\\xA-F0-9]+ed",?){6,}\]/);if(!n||n.index===void 0)return console.error(`patch: thinkingVerbs: failed to find past tense verbs pattern`),null;let r=t.map(e=>e.replace(/ing$/,`ed`)),i=JSON.stringify(r),a=n.index,o=a+n[0].length,s=e.slice(0,a)+i+e.slice(o);return F(e,s,i,a,o),s},be=(e,t)=>{let n=ve(e,t);if(n===null)return null;let r=ye(n,t);return r===null?null:r},xe=(e,t)=>{let n=H(e);if(!n)return console.error(`patch: userMessageDisplay: failed to find Text component`),null;let r=Ai(e),i=R(e);if(!i)return console.error(`patch: userMessageDisplay: failed to find chalk variable`),null;let a=/(No content found in user prompt message.{0,250}?\b)([$\w]+(?:\.default)?\.createElement.{0,30}\b[$\w]+(?:\.default)?\.createElement.{0,40}">.+?)?(([$\w]+(?:\.default)?\.createElement).{0,200})(\([$\w]+,(?:\{[^{}]+wrap:"wrap"\},([$\w]+)(?:\.trim\(\))?\)\)|\{text:([$\w]+)[^}]*\}\)\)?))/,o=e.match(/(No content found in user prompt message[\s\S]{0,100}?;return )([$\w]+(?:\.default)?)\.createElement\(([$\w]+),(\{flexDirection:"column"[^{}]*\}),([$\w]+(?:\.default)?)\.createElement\(([$\w]+),\{text:([$\w]+)[^{}]*\}\)\)/),s=o?null:e.match(/(No content found in user prompt message.{0,1200}?)([$\w]+)=([$\w]+(?:\.default)?\.createElement)\([$\w]+,\{text:([$\w]+),useBriefLayout:[$\w]+,timestamp:[$\w]+\}\)/),c=o||s?null:e.match(a);if(!o&&(!s||s.index===void 0)&&(!c||c.index===void 0))return console.error(`patch: userMessageDisplay: failed to find user message display pattern`),e;let l=e=>`(typeof ${e}==="object"&&${e}!==null?${e}.head+"\\n("+${e}.hiddenLines+" line"+(${e}.hiddenLines===1?"":"s")+" hidden)\\n"+${e}.tail:${e})`;if(o){let r=o[1],i=o[2],a=o[3],s=o[4],c=o[5],u=o[7],d=s.slice(1,-1),f=/backgroundColor:[^,}]+(?:\?[^,}:]+:[^,}:]+)*/;if(t.backgroundColor===null)d=d.replace(RegExp(`,?${f.source}`),``).replace(/^,|,$/g,``);else if(t.backgroundColor!==`default`){let e=t.backgroundColor.match(/\d+/g);if(e){let t=`"rgb(${e.join(`,`)})"`;d=d.replace(/"userMessageBackground"/g,t)}}let p=[];if(t.borderStyle!==`none`){if(t.borderStyle.startsWith(`topBottom`)){let e=``;t.borderStyle===`topBottomSingle`?e=`{top:"─",bottom:"─",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`:t.borderStyle===`topBottomDouble`?e=`{top:"═",bottom:"═",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`:t.borderStyle===`topBottomBold`&&(e=`{top:"━",bottom:"━",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`),p.push(`borderStyle:${e}`)}else p.push(`borderStyle:"${t.borderStyle}"`);let e=t.borderColor.match(/\d+/g);e&&p.push(`borderColor:"rgb(${e.join(`,`)})"`)}t.paddingX!==`default`&&t.paddingX>0&&p.push(`paddingX:${t.paddingX}`),t.paddingY!==`default`&&t.paddingY>0&&p.push(`paddingY:${t.paddingY}`),t.fitBoxToContent&&p.push(`alignSelf:"flex-start"`),p.length>0&&(d=d?`${d},${p.join(`,`)}`:p.join(`,`));let m=`{${d}}`,h=[];if(t.foregroundColor===`default`)h.push(`color:"text"`);else{let e=t.foregroundColor.match(/\d+/g);e&&h.push(`color:"rgb(${e.join(`,`)})"`)}if(t.backgroundColor!==`default`&&t.backgroundColor!==null){let e=t.backgroundColor.match(/\d+/g);e&&h.push(`backgroundColor:"rgb(${e.join(`,`)})"`)}else t.backgroundColor===`default`&&h.push(`backgroundColor:"userMessageBackground"`);t.styling.includes(`bold`)&&h.push(`bold:!0`),t.styling.includes(`italic`)&&h.push(`italic:!0`),t.styling.includes(`underline`)&&h.push(`underline:!0`),t.styling.includes(`strikethrough`)&&h.push(`strikethrough:!0`),t.styling.includes(`inverse`)&&h.push(`inverse:!0`);let g=h.length>0?`{${h.join(`,`)}}`:`null`,_=l(u),v=r+`${i}.createElement(${a},${m},${c}.createElement(${n},${g},${"`"+t.format.replace(/\{\}/g,()=>"${"+_+`}`)+"`"}))`,y=o.index,b=y+o[0].length,x=e.slice(0,y)+v+e.slice(b);return F(e,x,v,y,b),x}if(!r)return console.error(`patch: userMessageDisplay: failed to find Box component`),null;let u=s??c,d=s?s[3]:c[4],f=s?s[4]:c[6]??c[7],p=[],m=t.borderStyle.startsWith(`topBottom`);if(t.borderStyle!==`none`){if(m){let e=``;t.borderStyle===`topBottomSingle`?e=`{top:"─",bottom:"─",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`:t.borderStyle===`topBottomDouble`?e=`{top:"═",bottom:"═",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`:t.borderStyle===`topBottomBold`&&(e=`{top:"━",bottom:"━",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`),p.push(`borderStyle:${e}`)}else p.push(`borderStyle:"${t.borderStyle}"`);let e=t.borderColor.match(/\d+/g);e&&p.push(`borderColor:"rgb(${e.join(`,`)})"`)}t.paddingX===`default`?p.push(`paddingRight:1`):t.paddingX>0&&p.push(`paddingX:${t.paddingX}`),t.paddingY!==`default`&&t.paddingY>0&&p.push(`paddingY:${t.paddingY}`),t.fitBoxToContent&&p.push(`alignSelf:"flex-start"`);let h=i,g=[];if(t.foregroundColor!==`default`){let e=t.foregroundColor.match(/\d+/g);e&&(h+=`.rgb(${e.join(`,`)})`)}else g.push(`color:"text"`);if(t.backgroundColor!==`default`&&t.backgroundColor!==null){let e=t.backgroundColor.match(/\d+/g);if(e){h+=`.bgRgb(${e.join(`,`)})`;let t=`"rgb(${e.join(`,`)})"`;p.push(`backgroundColor:${t}`),g.push(`backgroundColor:${t}`)}}else t.backgroundColor===`default`&&(p.push(`backgroundColor:"userMessageBackground"`),g.push(`backgroundColor:"userMessageBackground"`));t.styling.includes(`bold`)&&(h+=`.bold`),t.styling.includes(`italic`)&&(h+=`.italic`),t.styling.includes(`underline`)&&(h+=`.underline`),t.styling.includes(`strikethrough`)&&(h+=`.strikethrough`),t.styling.includes(`inverse`)&&(h+=`.inverse`);let _=l(f),v="`"+t.format.replace(/\{\}/g,()=>"${"+_+`}`)+"`",y=`${h}(${v})`,b=p.length>0?`{${p.join(`,`)}}`:`null`,x=g.length>0?`{${g.join(`,`)}}`:`null`,S=s?`${s[2]}=`:``,C=u[1]+`${S}${d}(${r},${b},${d}(${n},${x},${y}))`,w=u.index,T=w+u[0].length,E=e.slice(0,w)+C+e.slice(T);return F(e,E,C,w,T),E},Se=(e,t)=>{let n=e;if(t.foregroundColor){let e=t.foregroundColor.match(/\d+/g);e&&(n+=`.rgb(${e.join(`,`)})`)}if(t.backgroundColor){let e=t.backgroundColor.match(/\d+/g);e&&(n+=`.bgRgb(${e.join(`,`)})`)}return t.styling.includes(`bold`)&&(n+=`.bold`),t.styling.includes(`italic`)&&(n+=`.italic`),t.styling.includes(`underline`)&&(n+=`.underline`),t.styling.includes(`strikethrough`)&&(n+=`.strikethrough`),t.styling.includes(`inverse`)&&(n+=`.inverse`),n},Ce=e=>{let t=e.match(/(if\(([$\w]+)\.highlight\?\.color\))((return [$\w]+\.createElement\([$\w]+,\{key:[$\w]+),color:[$\w]+\.highlight\.color(\},[$\w]+\.createElement\([$\w]+,null,)([$\w]+\.text)(\)\)));/);if(t&&t.index!==void 0){let n=`${t[2]}.highlight.color(${t[6]})`,r=t[1]+`{if(typeof ${t[2]}.highlight.color==='function')`+t[4]+t[5]+n+t[7]+`;else `+t[3]+`}`,i=e.slice(0,t.index)+r+e.slice(t.index+t[0].length);return F(e,i,r,t.index,t.index+t[0].length),i}let n=/(return ([$\w]+)\.createElement\(([$\w]+),\{key:([$\w]+)),color:([$\w]+)\.highlight\?\.color,dimColor:\5\.highlight\?\.dimColor,inverse:\5\.highlight\?\.inverse\},(\2\.createElement\([$\w]+,null,\5\.text\))\)/,r=e.match(n);if(!r||r.index===void 0)return console.error(`patch: inputPatternHighlighters: failed to find highlight?.color renderer pattern`),null;let i=r[2],a=r[3],o=r[4],s=r[5];r[6];let c=RegExp(`if\\(${s.replace(`$`,`\\$`)}\\.highlight\\.color\\)return ([$\\w]+)\\.createElement\\([$\\w]+,\\{key:[$\\w]+\\},${s.replace(`$`,`\\$`)}\\.text\\.split\\(""\\)\\.map\\([^)]+\\)\\)`),l=e,u=l.match(c);if(u&&u.index!==void 0){let e=`if(typeof ${s}.highlight?.color==='function')return ${i}.createElement(${a},{key:${o}},${i}.createElement(${a},null,${s}.highlight.color(${s}.text)));`;l=l.slice(0,u.index)+e+l.slice(u.index)}let d=l.match(n);if(!d||d.index===void 0)return console.error(`patch: inputPatternHighlighters: failed to re-find renderer after shimmer patch`),null;let f=d[2],p=d[3],m=d[4],h=d[5],g=d[6],_=`${h}.highlight?.style?${h}.highlight.style(${h}.text):${h}.text`,v=`return ${f}.createElement(${p},{key:${m},color:${h}.highlight?.style?void 0:${h}.highlight?.color,backgroundColor:${h}.highlight?.style?void 0:${h}.highlight?.backgroundColor,dimColor:${h}.highlight?.dimColor,inverse:${h}.highlight?.style?void 0:${h}.highlight?.inverse,bold:${h}.highlight?.style?void 0:${h}.highlight?.bold,italic:${h}.highlight?.style?void 0:${h}.highlight?.italic,underline:${h}.highlight?.style?void 0:${h}.highlight?.underline,strikethrough:${h}.highlight?.style?void 0:${h}.highlight?.strikethrough},${g.replace(`${h}.text`,_)})`,y=l.slice(0,d.index)+v+l.slice(d.index+d[0].length);return F(e,y,`shimmer guard + renderer`,0,0),y},we=(e,t,n)=>{let r=e.match(/((?:,|;let )[$\w]+=[$\w]+\.useMemo\(\(\)=>\{let [$\w]+=\[\];[\s\S]{0,2000}?)(if\([$\w]+&&[$\w]+&&![$\w]+\)([$\w]+)\.push\(\{start:[$\w]+,end:[$\w]+\+[$\w]+\.length,color:"warning",priority:\d+\})/);if(!r||r.index===void 0)return console.error(`patch: inputPatternHighlighters: failed to find useMemo/push pattern`),null;let i=r[3],a=r[1].match(/[^$\w]([$\w]+(?:\.default)?)\.useMemo\(/);if(!a)return console.error(`patch: inputPatternHighlighters: failed to extract React var from useMemo`),null;a[1];let o=Math.max(0,r.index-15e3),s=e.slice(o,r.index),c=/\binputValue:([$\w]+),/g,l=/\binput:([$\w]+),/g,u=[...s.matchAll(c)],d=[...s.matchAll(l)],f=u.at(-1)??d.at(-1)??null;if(!f)return console.error(`patch: inputPatternHighlighters: failed to find input variable pattern (looked for inputValue: and input:)`),null;let p=f[1],m=``;for(let e=0;e<n.length;e++){let r=n[e],a=Se(t,r),o=r.format??`{MATCH}`;JSON.stringify(o).replace(/\{MATCH\}/g,`"+x+"`);let s=r.foregroundColor;if(s){let e=s.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(e){let[,t,n,r]=e.map(Number);s=`#${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`}}let c=s?JSON.stringify(s):`undefined`,l=r.backgroundColor;if(l){let e=l.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(e){let[,t,n,r]=e.map(Number);l=`#${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`}}let u=l?JSON.stringify(l):null,d=r.styling??[],f=d.includes(`bold`),h=d.includes(`italic`),g=d.includes(`underline`),_=d.includes(`inverse`),v=d.includes(`dim`),y=d.includes(`strikethrough`),b=r.regex??r.pattern;if(!b){console.error(`patch: inputPatternHighlighters: highlighter "${r.name}" has no regex/pattern; skipping`);continue}let x=r.regexFlags??``;x.includes(`g`)||(x+=`g`);let S;try{S=new RegExp(b,x)}catch(e){console.error(`patch: inputPatternHighlighters: highlighter "${r.name}" has invalid regex; skipping`,e);continue}let C=la(S);m+=`if(typeof ${p}==="string"){for(let m of ${p}.matchAll(${C})){${i}.push({start:m.index,end:m.index+m[0].length,color:${c}${u?`,backgroundColor:${u}`:``}${f?`,bold:!0`:``}${h?`,italic:!0`:``}${g?`,underline:!0`:``}${_?`,inverse:!0`:``}${v?`,dimColor:!0`:``}${y?`,strikethrough:!0`:``},style:(x)=>${a}(x),priority:100})}}`}if(!m)return console.error(`patch: inputPatternHighlighters: no usable highlighters generated (all skipped)`),null;let h=r[1]+m+r[2],g=e.slice(0,r.index),_=e.slice(r.index+r[0].length),v=g+``+h+_,y=v.indexOf(`for(let m of ${p}.matchAll(`);if(y>-1){let e=[...v.slice(Math.max(0,y-2e3),y).matchAll(/useMemo\(\(\)=>\{/g)];if(e.length>0){let t=Math.max(0,y-2e3)+e[e.length-1].index,n=v.slice(t),r=0;for(let e=0;e<n.length;e++)if(n[e]===`(`)r++;else if(n[e]===`)`&&(r--,r===0)){let n=t+e;v.slice(n-1,n)===`]`&&(v.slice(n-200,n).includes(`,${p}]`)||(v=v.slice(0,n-1)+`,${p}]`+v.slice(n)));break}}}return F(e,v,``+h,r.index,r.index+r[0].length),v},Te=(e,t)=>{let n=t.filter(e=>e.enabled!==!1);if(n.length===0)return console.error(`patch: inputPatternHighlighters: no enabled highlighters provided`),null;let r=R(e);if(!r)return console.error(`^ patch: inputPatternHighlighters: failed to find chalk variable`),null;let i;return i=Ce(e),i?(i=we(i,r,n),i||(console.error(`^ patch: inputPatternHighlighters: writeCustomHighlighterCreation failed`),null)):(console.error(`^ patch: inputPatternHighlighters: writeCustomHighlighterImpl failed`),null)},Ee=e=>{let t=e.match(/(?:[$\w]+\.)?createElement\([$\w]+,\{(?=[^}]*responseLengthRef:)(?=[^}]*spinnerSuffix:)(?=[^}]*thinkingStatus:)(?=[^}]*isCompacting:)[^}]*verbose:[^,}]+[^}]*\}/);if(t&&t.index!==void 0){let e=t[0].match(/verbose:[^,}]+/);if(!e||e.index===void 0)return console.error(`patch: verbose: failed to find verbose property`),null;let n=t.index+e.index;return{startIndex:n,endIndex:n+e[0].length,replacement:`verbose:true`}}let n=e.match(/\{[^{}]{0,400}overrideMessage:[$\w]+,[^{}]{0,200}verbose:([$\w]+)[^{}]{0,200}\}\)\{/);if(n&&n.index!==void 0){let e=n[1],t=n.index+n[0].length;return{startIndex:t,endIndex:t,replacement:`${e}=!0;`}}return console.error(`patch: verbose: failed to find spinner props containing overrideMessage and verbose`),null},De=e=>{let t=Ee(e);if(!t)return null;let n=e.slice(0,t.startIndex)+t.replacement+e.slice(t.endIndex);return F(e,n,t.replacement,t.startIndex,t.endIndex),n},Oe=e=>{let t=e.match(/if\s*\(\s*([$\w]+)\(\)\s*===\s*"opusplan"\s*&&\s*([$\w]+)\s*===\s*"plan"\s*&&\s*!([$\w]+)\s*\)\s*return\s*([$\w]+)\(\);/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchModeSwitchingFunction: failed to find mode switching pattern`),null;let[n,r,i,a,o]=t,s=`if((${r}()==="opusplan"||${r}()==="opusplan[1m]")&&${i}==="plan"&&!${a})return ${o}();`,c=e.slice(0,t.index)+s+e.slice(t.index+n.length);return F(e,c,s,t.index,t.index+n.length),c},ke=e=>{let t=e.match(/(\["sonnet","opus","haiku",(?:"best",)?"sonnet\[1m\]",(?:"opus\[1m\]",)?"opusplan")/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchModelAliasesList: failed to find model aliases list`),null;let n=t[0]+`,"opusplan[1m]"`,r=e.slice(0,t.index)+n+e.slice(t.index+t[0].length);return F(e,r,n,t.index,t.index+t[0].length),r},Ae=e=>{let t=e.match(/(if\s*\(\s*([$\w]+)\s*===\s*"opusplan"\s*\)\s*return\s*"([^"]*Opus[^"]*plan mode[^"]*Sonnet[^"]*)";)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchDescriptionFunction: failed to find description pattern`),null;let[n,,r,i]=t,a=n+`if(${r}==="opusplan[1m]")return"${i} (1M context)";`,o=e.slice(0,t.index)+a+e.slice(t.index+n.length);return F(e,o,a,t.index,t.index+n.length),o},je=e=>{let t=e.match(/(if\s*\(\s*([$\w]+)\s*===\s*"opusplan"\s*\)\s*return\s*"Opus Plan";)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchLabelFunction: failed to find label pattern`),null;let[n,,r]=t,i=n+`if(${r}==="opusplan[1m]")return"Opus Plan 1M";`,a=e.slice(0,t.index)+i+e.slice(t.index+n.length);return F(e,a,i,t.index,t.index+n.length),a},Me=e=>{let t=e.match(/(if\s*\(\s*([$\w]+)\s*===\s*"opusplan"\s*\)\s*return\s*(?:[$\w]+\()?\[\s*\.\.\.([$\w]+)\s*,\s*([$\w]+)\(\)\s*\]\)?;)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchModelSelectorOptions: failed to find model selector pattern`),null;let[n,,r,i]=t,a=n.match(RegExp(`return\\s*([$\\w]+)\\(\\s*\\[\\.\\.\\.${W(i)}`)),o=a?a[1]:null,s=`{value:"opusplan[1m]",label:"Opus Plan Mode 1M",description:"Use Opus in plan mode, Sonnet (1M context) otherwise"}`,c=n+`if(${r}==="opusplan[1m]")return ${o?`${o}([...${i},${s}])`:`[...${i},${s}]`};`,l=e.slice(0,t.index)+c+e.slice(t.index+n.length);return F(e,l,c,t.index,t.index+n.length),l},Ne=e=>{let t=e.match(/(if\s*\(\s*[$\w]+\s*===\s*null\s*\|\|\s*([$\w]+)\.some\s*\(\s*\(\s*[$\w]+\s*\)\s*=>\s*[$\w]+\.value\s*===\s*[$\w]+\s*\)\s*\)\s*return\s*(?:[$\w]+\()?[$\w]+\)?\s*;)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchAlwaysShowInModelSelector: failed to find model list check pattern`),null;let[,,n]=t,r=`${n}.push({value:"opusplan",label:"Opus Plan Mode",description:"Use Opus in plan mode, Sonnet otherwise"});${n}.push({value:"opusplan[1m]",label:"Opus Plan Mode 1M",description:"Use Opus in plan mode, Sonnet (1M context) otherwise"});`,i=e.slice(0,t.index)+r+e.slice(t.index);return F(e,i,r,t.index,t.index),i},Pe=e=>{if(e.includes(`"opusplan[1m]"`))return console.log(`patch: opusplan1m: opusplan[1m] already supported natively — skipping`),e;let t=e,n=Oe(t);if(n)t=n;else return console.error(`patch: opusplan1m: failed to apply mode switching patch`),null;if(n=ke(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply model aliases list patch`),null;if(n=Ae(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply description function patch`),null;if(n=je(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply label function patch`),null;if(n=Me(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply model selector options patch`),null;if(n=Ne(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply always-show-in-selector patch`),null;return t},Fe=e=>{if(/case"thinking":\{(?:(?!case")[^]){0,600}isTranscriptMode:true/.test(e))return console.log(`patch: thinkingVisibility: already configured natively — skipping`),e;let t=e.match(/(case"thinking":\{?)(if\(.+?\)return null;)(.{0,400}isTranscriptMode:).+?,/);if(!t||t.index===void 0)return console.error(`patch: thinkingVisibility: failed to find thinking visibility pattern`),null;let n=t[1]+t[3]+`true,`,r=t.index,i=r+t[0].length,a=e.slice(0,r)+n+e.slice(i);return F(e,a,n,r,i),a},Ie=(e,t)=>{let n=e.match(/(agentType\s*:\s*"Plan"\s*,[\s\S]{1,2500}?\bmodel\s*:\s*")[^"]+(")/);if(!n||n.index===void 0)return console.error(`patch: subagentModels: failed to find Plan agent pattern`),null;let r=n[1]+t+n[2],i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},Le=(e,t)=>{let n=e.match(/(\{agentType\s*:\s*"Explore"\s*,[\s\S]{1,2500}?\bmodel\s*:\s*")[^"]+(")/);if(!n||n.index===void 0)return console.error(`patch: subagentModels: failed to find Explore agent pattern`),null;let r=n[1]+t+n[2],i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},Re=(e,t)=>{let n=e.match(/([^$\w][$\w]+\s*=\s*\{agentType\s*:\s*"general-purpose"[\s\S]{0,2500}?)(\})/);if(!n||n.index===void 0)return console.error(`patch: subagentModels: failed to find general-purpose agent pattern`),null;let r=n[1],i=n[2],a;a=r.includes(`model:`)?r.replace(/(model\s*:\s*")[^"]+(")/,`$1${t}$2`)+i:r+`${r.trim().endsWith(`,`)?``:`,`}model:"${t}"`+i;let o=n.index,s=o+n[0].length,c=e.slice(0,o)+a+e.slice(s);return F(e,c,a,o,s),c},ze=(e,t)=>{let n=e;if(t.plan){let e=Ie(n,t.plan);if(e===null)return null;n=e}if(t.explore){let e=Le(n,t.explore);if(e===null)return null;n=e}if(t.generalPurpose){let e=Re(n,t.generalPurpose);if(e===null)return null;n=e}return n},Be=e=>{let t=e.indexOf(`}.VERSION} (Claude Code)`);return t==-1?(console.error(`patch: patchesAppliedIndication: failed to find versionIndex`),null):{startIndex:0,endIndex:t+24}},Ve=e=>{let t=e.match(/createElement\(([$\w]+),\{bold:!0\},"Claude Code"\),([$\w]+)\[\d+\]=[$\w]+;else [$\w]+=([$\w]+)\[\d+\]/);if(!t||t.index===void 0)return console.error(`patch: patchesAppliedIndication: PATCH 2 failed to find bold Claude Code pattern`),null;let n=t[1],r=t.index+t[0].length,i=e.indexOf(`;`,r);if(i===-1)return null;let a=i+1,o=e.match(/[^$\w]([$\w]+)\.createElement\(([$\w]+),null,[$\w]+," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)\)/);if(!o||o.index===void 0){let t=e.match(/[^$\w]([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/);return!t||t.index===void 0?(console.error(`patch: patchesAppliedIndication: PATCH 2 failed to find version createElement`),null):{varInsertIndex:a,refInsertIndex:t.index+t[0].length,reactVar:t[1],textComponent:n}}return{varInsertIndex:a,refInsertIndex:o.index+o[0].length-1,reactVar:o[1],textComponent:n}},He=e=>{let t=e.match(/"Claude Code".{0,200}\{dimColor:!0\},"v",[$\w]+\)/);if(!t||t.index===void 0)return console.error(`patch: patchesAppliedIndication: failed to find version display for patch 3`),null;let n={index:t.index},r=Math.max(0,n.index-5e3),i=e.slice(r,n.index),a=Array.from(i.matchAll(/[};]\s*function ([$\w]+)\(/g));if(a.length===0)return console.error(`patch: patchesAppliedIndication: failed to find header component function`),null;let o=a[a.length-1][1],s=RegExp(`[^$\\w]([$\\w]+)\\.createElement\\(${W(o)},null\\),?`),c=e.match(s);if(!c||c.index===void 0)return console.error(`patch: patchesAppliedIndication: failed to find createElement call for header`),null;let l=e.slice(Math.max(0,c.index-30),c.index+1).match(/([$\w]+)=(?:[$\w]+&&)?[^$\w]?$/);if(l){let t=l[1],n=e.slice(c.index,c.index+2e3),r=RegExp(`,${W(t)}([,\\)])`),i=n.match(r);if(i&&i.index!==void 0){let e=c.index+i.index+i[0].length-i[1].length;return{startIndex:e,endIndex:e}}}let u=c.index+c[0].length;return{startIndex:u,endIndex:u}},Ue=(e,t,n,r=!0,i=!0)=>{let a=Be(e);if(!a)return console.error(`patch: patchesAppliedIndication: failed to version output location`),null;let o=`\\n${t} (tweakcc-fixed)`,s=`}.VERSION} (Claude Code)`,c=e.replaceAll(s,s+o);F(e,c,o,a.endIndex,a.endIndex);let l=R(e);if(!l)return console.error(`patch: patchesAppliedIndication: failed to find chalk variable`),null;let u=H(e);if(!u)return console.error(`patch: patchesAppliedIndication: failed to find text component`),null;let d=V(e);if(!d)return console.error(`patch: patchesAppliedIndication: failed to find React variable`),null;if(r){let e=c.match(/(\$\{([$\w]+)\("inactive",([$\w]+)\)\(`v\$\{[$\w]+\}`\)\}) `,/);if(e&&e.index!==void 0){let n=e[0],r=e[2],i=e[3],a=`${e[1]} \${${r}("warning",${i})("+ tweakcc v${t}")} \`,`;c=c.replace(n,a)}c=c.replace(/([$\w]+\("claude",[$\w]+\)\(" Claude Code) ("\))/,`$1 + tweakcc v${t} $2`);let n=Ve(c);if(!n)console.error(`patch: patchesAppliedIndication: patch 2 skipped (header version pattern changed)`);else{let e=`let _tw=${n.reactVar}.createElement(${n.textComponent},null,${l}.hex("#FF8400").bold("+ tweakcc v${t}"));`,r=c;c=c.slice(0,n.varInsertIndex)+e+c.slice(n.varInsertIndex),F(r,c,e,n.varInsertIndex,n.varInsertIndex);let i=n.refInsertIndex+e.length,a=`," ",_tw`,o=c;c=c.slice(0,i)+a+c.slice(i),F(o,c,a,i,i)}}if(i){let e=Ai(c);if(!e)return console.error(`patch: patchesAppliedIndication: PATCH 3 skipped (Box component not located on this CC version)`),c;let t=He(c);if(!t)console.log(`patch: patchesAppliedIndication: patch 3 skipped (see prior message)`);else{let r=[];r.push(`,${d}.createElement(${e}, { flexDirection: "column" },`),r.push(`${d}.createElement(${e}, null, ${d}.createElement(${u}, {color: "success", bold: true}, "┃ "), ${d}.createElement(${u}, {color: "success", bold: true}, "✓ tweakcc-fixed patches are applied")),`);for(let t of n)t=t.replace(`CHALK_VAR`,l),r.push(`${d}.createElement(${e}, null, ${d}.createElement(${u}, {color: "success", bold: true}, "┃ "), ${d}.createElement(${u}, {dimColor: true}, \` * ${t}\`)),`);r.push(`),`);let i=r.join(`
|
|
1
|
+
import{createRequire as e}from"node:module";import t from"chalk";import*as n from"node:os";import r,{EOL as i}from"node:os";import*as a from"node:fs/promises";import o from"node:fs/promises";import*as s from"node:fs";import c from"node:fs";import*as l from"node:path";import u from"node:path";import*as d from"fs";import*as f from"path";import*as p from"os";import*as m from"child_process";import*as h from"crypto";import{spawnSync as g}from"node:child_process";import _ from"gray-matter";import{fileURLToPath as v}from"node:url";import{Worker as y}from"node:worker_threads";import{diffWordsWithSpace as b}from"diff";let x=null;async function S(){if(x!==null)return x;try{return await import(`node-lief`),x=await import(`./nativeInstallation-B66wq9dv.mjs`),x}catch(e){return G(`Error loading native installation module: ${e instanceof Error?e.message:String(e)}`),e instanceof Error&&G(e),null}}async function C(e,t){let n=await S();return n?n.extractClaudeJsFromNativeInstallation(e,t):{data:null,clearBytecode:!1}}async function w(e,t,n,r){let i=await S();if(!i)throw Error("`repackNativeInstallation()` called but `node-lief` is not available. This is unexpected - `extractClaudeJsFromNativeInstallation()` should have been called first.");i.repackNativeInstallation(e,t,n,r)}async function T(e){let t=await S();return t?t.resolveNixBinaryWrapper(e):null}const E={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.Architecting.Baking.Beaming.Beboppin'.Befuddling.Billowing.Blanching.Bloviating.Boogieing.Boondoggling.Booping.Bootstrapping.Brewing.Burrowing.Calculating.Canoodling.Caramelizing.Cascading.Catapulting.Cerebrating.Channeling.Channelling.Choreographing.Churning.Clauding.Coalescing.Cogitating.Combobulating.Composing.Computing.Concocting.Considering.Contemplating.Cooking.Crafting.Creating.Crunching.Crystallizing.Cultivating.Deciphering.Deliberating.Determining.Dilly-dallying.Discombobulating.Doing.Doodling.Drizzling.Ebbing.Effecting.Elucidating.Embellishing.Enchanting.Envisioning.Evaporating.Fermenting.Fiddle-faddling.Finagling.Flambéing.Flibbertigibbeting.Flowing.Flummoxing.Fluttering.Forging.Forming.Frolicking.Frosting.Gallivanting.Galloping.Garnishing.Generating.Germinating.Gitifying.Grooving.Gusting.Harmonizing.Hashing.Hatching.Herding.Honking.Hullaballooing.Hyperspacing.Ideating.Imagining.Improvising.Incubating.Inferring.Infusing.Ionizing.Jitterbugging.Julienning.Kneading.Leavening.Levitating.Lollygagging.Manifesting.Marinating.Meandering.Metamorphosing.Misting.Moonwalking.Moseying.Mulling.Mustering.Musing.Nebulizing.Nesting.Newspapering.Noodling.Nucleating.Orbiting.Orchestrating.Osmosing.Perambulating.Percolating.Perusing.Philosophising.Photosynthesizing.Pollinating.Pondering.Pontificating.Pouncing.Precipitating.Prestidigitating.Processing.Proofing.Propagating.Puttering.Puzzling.Quantumizing.Razzle-dazzling.Razzmatazzing.Recombobulating.Reticulating.Roosting.Ruminating.Sautéing.Scampering.Schlepping.Scurrying.Seasoning.Shenaniganing.Shimmying.Simmering.Skedaddling.Sketching.Slithering.Smooshing.Sock-hopping.Spelunking.Spinning.Sprouting.Stewing.Sublimating.Swirling.Swooping.Symbioting.Synthesizing.Tempering.Thinking.Thundering.Tinkering.Tomfoolering.Topsy-turvying.Transfiguring.Transmuting.Twisting.Undulating.Unfurling.Unravelling.Vibing.Waddling.Wandering.Warping.Whatchamacalliting.Whirlpooling.Whirring.Whisking.Wibbling.Working.Wrangling.Zesting.Zigzagging`.split(`.`)},thinkingStyle:{updateInterval:120,phases:process.env.TERM===`xterm-ghostty`?[`·`,`✢`,`✳`,`✶`,`✻`,`*`]:process.platform===`darwin`?[`·`,`✢`,`✳`,`✶`,`✻`,`✽`]:[`·`,`✢`,`*`,`✶`,`✻`,`✽`],reverseMirror:!0},userMessageDisplay:{format:` > {} `,styling:[],foregroundColor:`default`,backgroundColor:`default`,borderStyle:`none`,borderColor:`rgb(255,255,255)`,paddingX:`default`,paddingY:`default`,fitBoxToContent:!1},inputBox:{removeBorder:!1},misc:{showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEdit:!1,hideStartupClawd:!1,increaseFileReadLimit:!1,suppressLineNumbers:!1,suppressRateLimitOptions:!1,mcpConnectionNonBlocking:!0,mcpServerBatchSize:null,statuslineThrottleMs:null,statuslineUseFixedInterval:!1,tableFormat:`default`,enableSwarmMode:!0,enableSessionMemory:!0,enableDreamMode:!0,enableLeanMemoryTypes:!1,fixSummarizeFromHere:!0,fixRewindSummaryHeader:!0,enableRememberSkill:!1,tokenCountRounding:null,autoAcceptPlanMode:!1,allowBypassPermissionsInSudo:!1,suppressNativeInstallerWarning:!1,filterScrollEscapeSequences:!1,enableWorktreeMode:!0,allowCustomAgentModels:!1,enableContextLimitOverride:!1,enableModelCustomizations:!0,enableVoiceMode:!1,enableVoiceConciseOutput:!0,enableChannelsMode:!1,maxEffortDefault:!1,autoModeClassifierModel:`default`,suppressDeferredTools:!1,claudemdContextOncePerConversation:!0},toolsets:[],defaultToolset:null,planModeToolset:null,subagentModels:{plan:null,explore:null,generalPurpose:null},inputPatternHighlighters:[],inputPatternHighlightersTestText:`Type test text here to see highlighting`,claudeMdAltNames:[`AGENTS.md`,`GEMINI.md`,`CRUSH.md`,`QWEN.md`,`IFLOW.md`,`WARP.md`,`copilot-instructions.md`]},ee={name:`Unnamed Highlighter`,regex:``,regexFlags:`g`,format:`{MATCH}`,styling:[],foregroundColor:null,backgroundColor:null,enabled:!0},te={name:`Unnamed Toolset`,allowedTools:`*`},ne=E.themes[0],re=e=>{let t=[],n=/visibleOptionCount:[\w$]+=(\d+)/g,r;for(;(r=n.exec(e))!==null;){let e=r.index+r[0].indexOf(`=`)+1;t.push({startIndex:e,endIndex:e+r[1].length})}return t},ie=e=>{let t=e.match(/\{rows:([\w$]+),columns:[\w$]+\}=[\w$]+\(\),[\w$]+=[\w$]+\?[\w$]+:Math\.max\(1,Math\.min\(Math\.max\(6,Math\.floor\(\1\/2\)\),\1-3\)\)/);if(t&&t.index!==void 0){let n=t[1],r=`Math.floor(${n}/2)`,i=t.index+t[0].indexOf(r),a=i+r.length,o=e.slice(0,i)+n+e.slice(a);return F(e,o,n,i,a),o}let n=e.match(/\{rows:([\w$]+),columns:[\w$]+\}=[\w$]+\(\),([\w$]+)=Math\.floor\(\1\/2\)/);if(n&&n.index!==void 0){let t=n.index+n[0].indexOf(n[2]+`=Math.floor(`),r=n.index+n[0].length,i=`${n[2]}=${n[1]}`,a=e.slice(0,t)+i+e.slice(r);return F(e,a,i,t,r),a}let r=/Math\.max\(1,Math\.floor\(\(([\w$]+)-([\w$]+)\)\/([\w$]+)\)\)/g,i;for(;(i=r.exec(e))!==null;){let t=Math.max(0,i.index-250),n=e.slice(t,i.index);if(!n.includes(`"expanded"?3`)||!n.includes(`"compact"?1:2`))continue;let r=i.index,a=i.index+i[0].length,o=`Math.max(1,${i[1]}-${i[2]})`,s=e.slice(0,r)+o+e.slice(a);return F(e,s,o,r,a),s}return null},D=e=>{let t=e.match(/Math\.max\(1,Math\.floor\(\(([\w$]+)-10\)\/2\)\)/);if(!t||t.index===void 0)return null;let n=`Math.max(1,${t[1]}-3)`,r=e.slice(0,t.index)+n+e.slice(t.index+t[0].length);return F(e,r,n,t.index,t.index+t[0].length),r},O=e=>{if(!e.includes(`Math.min(6,Math.max(1,`))return G(`patch: showMoreItemsInSelectMenus: suggestions cap already removed in this CC build — no-op`),e;let t=e.match(/Math\.min\(6,Math\.max\(1,([\w$]+)-3\)\)/);if(!t||t.index===void 0)return null;let n=`Math.max(1,${t[1]}-3)`,r=e.slice(0,t.index)+n+e.slice(t.index+t[0].length);return F(e,r,n,t.index,t.index+t[0].length),r},ae=(e,t)=>{let n=re(e);if(n.length===0)return console.error(`patch: writeShowMoreItemsInSelectMenus: failed to find locations`),null;let r=n.sort((e,t)=>t.startIndex-e.startIndex),i=e;for(let e of r){let n=t.toString(),r=i.slice(0,e.startIndex)+n+i.slice(e.endIndex);F(i,r,n,e.startIndex,e.endIndex),i=r}let a=ie(i);a?i=a:console.error(`patch: writeShowMoreItemsInSelectMenus: failed to find help menu height pattern`);let o=D(i);o?i=o:console.error(`patch: writeShowMoreItemsInSelectMenus: failed to find visibleCount pattern`);let s=O(i);return s&&(i=s),i};function oe(e){let t=-1,n=-1,r=``,i=e.match(/switch\(([$\w]+)\)\{case"(?:light|dark)":[^}]*return [$\w]+;[^}]*default:return [$\w]+\}/);if(i&&i.index!=null)t=i.index,n=t+i[0].length,r=i[1];else{if(e.indexOf(`case"dark":return{"autoAccept"`)===-1&&e.indexOf(`case"light":return{`)===-1)return console.error(`patch: themes: failed to find switchMatch`),null;let i=e.indexOf(`case"dark":return{`)===-1?e.indexOf(`case"light":return{`):e.indexOf(`case"dark":return{`),a=e.slice(Math.max(0,i-200),i).match(/switch\(([$\w]+)\)\{\s*$/);if(!a||a.index==null)return console.error(`patch: themes: failed to find switchMatch (old format)`),null;t=Math.max(0,i-200)+a.index,r=a[1];let o=0;for(let r=t;r<e.length&&r<t+5e4;r++)if(e[r]===`{`&&o++,e[r]===`}`&&(o--,o===0)){n=r+1;break}}if(t===-1||n===-1)return console.error(`patch: themes: failed to find switchMatch`),null;let a=-1,o=-1,s=``,c=e.match(/\[(?:\.\.\.\[\],)?(?:\{"?label"?:"(?:Dark|Light|Auto|Monochrome)[^"]*","?value"?:"[^"]+"\},?)+\]/);if(c&&c.index!==void 0)a=c.index,o=c.index+c[0].length;else{let t=[...e.matchAll(/([$\w]+)=\{label:"(?:Auto|Dark|Light|Monochrome)[^"]*",value:"[^"]+"\}/g)];if(t.length<2)return console.error(`patch: themes: failed to find objArrMatch`),null;let n=t.map(e=>e[1]).map(e=>e.replace(/\$/g,`\\$`)).join(`,`),r=RegExp(`\\[${n}((?:,\\.\\.\\.[^\\]]+)*)\\]`),i=e.match(r);if(!i||i.index===void 0)return console.error(`patch: themes: failed to find objArrMatch (new var-collected form)`),null;a=i.index,o=i.index+i[0].length,s=i[1]}let l=e.match(/(return|[$\w]+=)\{(?:"?(?:[$\w-]+)"?:"(?:Auto |Dark|Light|Monochrome)[^"]*",?)+\}/);return(!l||l.index==null)&&G(`patch: themes: objMatch not found — colors will still apply, theme name map unchanged`),{switchStatement:{startIndex:t,endIndex:n,identifiers:[r]},objArr:{startIndex:a,endIndex:o,identifiers:[s]},obj:l&&l.index!==void 0?{startIndex:l.index,endIndex:l.index+l[0].length,identifiers:[l[1]]}:null}}const se=(e,t)=>{let n=oe(e);if(!n)return null;if(t.length===0)return e;let r=e;if(n.obj){let i=(n.obj.identifiers?.[0]??`return`)+JSON.stringify(Object.fromEntries(t.map(e=>[e.id,e.name])));r=r.slice(0,n.obj.startIndex)+i+r.slice(n.obj.endIndex),F(e,r,i,n.obj.startIndex,n.obj.endIndex),e=r}let i=n.objArr.identifiers?.[0]??``,a=`[${t.map(e=>JSON.stringify({label:e.name,value:e.id})).join(`,`)}${i}]`;r=r.slice(0,n.objArr.startIndex)+a+r.slice(n.objArr.endIndex),F(e,r,a,n.objArr.startIndex,n.objArr.endIndex),e=r;let o=`switch(${n.switchStatement.identifiers?.[0]}){\n`;return t.forEach(e=>{o+=`case"${e.id}":return${JSON.stringify(e.colors)};\n`}),o+=`default:return${JSON.stringify(t[0].colors)};\n}`,r=r.slice(0,n.switchStatement.startIndex)+o+r.slice(n.switchStatement.endIndex),F(e,r,o,n.switchStatement.startIndex,n.switchStatement.endIndex),r},ce=e=>{let t=/var ([\w$]+)=200000,([\w$]+)=20000,([\w$]+)=32000,([\w$]+)=(128000|64000);/,n=e.match(t);return n?e.replace(t,`var ${n[1]}=(+process.env.CLAUDE_CODE_CONTEXT_LIMIT||200000),${n[2]}=20000,${n[3]}=32000,${n[4]}=${n[5]};`):(console.error(`patch: contextLimit: failed to find context limit constants`),null)},le=(e,t)=>{if(!t)return e;let n=e,r=!1,i=n.match(/createElement\(([$\w]+),\{color:([$\w]+)\.bgColor\},"─"\.repeat\(([$\w]+)\)\)/);if(i){let e=i[1];n=n.replace(i[0],`createElement(${e},null,"")`);let t=RegExp(`createElement\\(${e},\\{color:${i[2]}\\.bgColor\\},${i[2]}\\.text\\?.+?"─"\\.repeat\\(${i[3]}\\)\\)`),a=n.match(t);a&&(n=n.replace(a[0],`createElement(${e},null,"")`)),r=!0}let a=n.match(/(borderColor:[$\w]+\(\),)borderStyle:"round"(,borderLeft:!1,borderRight:!1,borderBottom:!0,width:"100%",borderText:)/);a&&(n=n.replace(a[0],`${a[1]}borderStyle:undefined${a[2]}`),r=!0);let o=n.match(/borderStyle:"round"(,borderLeft:!1,borderRight:!1,borderBottom:!0,width:"100%"\}.+?Save and close editor)/);return o&&(n=n.replace(o[0],`borderStyle:undefined${o[1]}`),r=!0),r?(F(e,n,`(input border removed)`,0,0),n):(console.error(`patch: input border: failed to find input border pattern`),null)},ue=e=>{let t=(e.match(/overrideMessage:[$\w]+,isCompacting:[$\w]+,compactingHintText:[$\w]+,compactingStartTime:[$\w]+,spinnerSuffix:[$\w]+,verbose:[$\w]+,.{300}/)||e.match(/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/)||e.match(/overrideMessage:[$\w]+,spinnerSuffix:[$\w]+,verbose:[$\w]+,.{300}/)||e.match(/pauseStartTimeRef:[$\w]+,spinnerSuffix:[$\w]+,verbose:[$\w]+,.{300}/))?.index,n=t===void 0?``:e.slice(t,t+2e4),r=n.match(/,([$\w]+)(=\(([^;]{1,200}?)\)\+"(?:…|\\u2026)")/);if(r&&r.index!=null)return{startIndex:t+r.index+r[1].length+1,endIndex:t+r.index+r[1].length+r[2].length+1,identifiers:[r[3]]};let i=/,([$\w]+)(=(\([$\w]+&&![$\w]+\.isIdle\?[$\w]+\.spinnerVerb\?\?[$\w]+:[$\w]+\))\+"(?:…|\\u2026)")/,a=n.match(i);if(a&&a.index!=null)return{startIndex:t+a.index+a[1].length+1,endIndex:t+a.index+a[1].length+a[2].length+1,identifiers:[a[3]]};let o=n.match(/,([$\w]+)(=`\$\{([$\w]+&&![$\w]+\.isIdle\?[$\w]+\.spinnerVerb\?\?[$\w]+:[$\w]+)\}(?:…|\\u2026) ?`)/);if(o&&o.index!=null)return{startIndex:t+o.index+o[1].length+1,endIndex:t+o.index+o[1].length+o[2].length+1,identifiers:[o[3]]};let s=new RegExp(i.source,`g`),c=[...e.matchAll(s)].filter(t=>{if(t.index==null)return!1;let n=e.slice(Math.max(0,t.index-2500),t.index+1e3);return n.includes(`overrideMessage:`)&&n.includes(`.activeForm`)&&n.includes(`.isIdle`)&&n.includes(`.spinnerVerb`)&&n.includes(`spinnerTip`)});if(c.length===1){let e=c[0];return{startIndex:e.index+e[1].length+1,endIndex:e.index+e[1].length+e[2].length+1,identifiers:[e[3]]}}return console.error(`patch: thinker format: failed to find formatMatch`),null},de=(e,t)=>{let n=ue(e);if(!n)return null;let r=n,i=t.replace(/\\/g,`\\\\`).replace(/`/g,"\\`"),a=r.identifiers?.[0],o=`=${"`"+i.replace(/\{\}/g,"${"+a+`}`)+"`"}`,s=e.slice(0,r.startIndex)+o+e.slice(r.endIndex);return F(e,s,o,r.startIndex,r.endIndex),s},fe=e=>{let t=e.match(/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/);return!t||t.index==null?(console.error(`patch: thinker symbol mirror option: failed to find match`),null):{startIndex:t.index,endIndex:t.index+t[0].length,identifiers:[t[1]]}},pe=(e,t)=>{let n=fe(e);if(!n)return null;let r=n.identifiers?.[0],i=t?`=[...${r},...[...${r}].reverse()]`:`=[...${r}]`,a=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return F(e,a,i,n.startIndex,n.endIndex),a},me=(e,t)=>{let n=[],r=/\["(?:[·✢*✳✶✻✽]|\\u00b7|\\xb7|\\u2722|\\x2a|\\u002a|\\u2733|\\u2736|\\u273b|\\u273d)",\s*(?:"(?:[·✢*✳✶✻✽]|\\u00b7|\\xb7|\\u2722|\\x2a|\\u002a|\\u2733|\\u2736|\\u273b|\\u273d)",?\s*)+\]/gi,i;for(;(i=r.exec(e))!==null;)n.push({startIndex:i.index,endIndex:i.index+i[0].length});if(n.length===0)return console.error(`patch: thinkerSymbolChars: could not find any thinker symbol char arrays`),null;let a=JSON.stringify(t),o=n.sort((e,t)=>t.startIndex-e.startIndex),s=e;for(let e=0;e<o.length;e++){let t=s.slice(0,o[e].startIndex)+a+s.slice(o[e].endIndex);F(s,t,a,o[e].startIndex,o[e].endIndex),s=t}return s},he=(e,t)=>{let n=e.match(/(if\(![$\w]+\)\{[$\w]+\(4\);return\})(.{0,200})120\)/);if(!n||n.index===void 0)return console.error(`patch: thinkerSymbolSpeed: failed to find thinker symbol speed pattern`),null;let r=n[2]+t+`)`,i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},ge=e=>{let t=e.match(/\{("aria-hidden":!0,)?flexWrap:"wrap",height:1,width:2\}/);return!t||t.index==null?(console.error(`patch: thinker symbol width: failed to find match`),null):{startIndex:t.index,endIndex:t.index+t[0].length,prefix:t[1]??``}},_e=(e,t)=>{let n=ge(e);if(!n)return null;let r=`{${n.prefix}flexWrap:"wrap",height:1,width:${t}}`,i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return F(e,i,r,n.startIndex,n.endIndex),i},ve=(e,t)=>{let n=e.match(/\[("[A-Z][a-z'é\-\\xA-F0-9]+in[g']",?){50,}\]/);if(!n||n.index===void 0)return console.error(`patch: thinkingVerbs: failed to find present tense verbs pattern`),null;let r=JSON.stringify(t),i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},ye=(e,t)=>{let n=e.match(/\[("[A-Z][a-z'é\-\\xA-F0-9]+ed",?){6,}\]/);if(!n||n.index===void 0)return console.error(`patch: thinkingVerbs: failed to find past tense verbs pattern`),null;let r=t.map(e=>e.replace(/ing$/,`ed`)),i=JSON.stringify(r),a=n.index,o=a+n[0].length,s=e.slice(0,a)+i+e.slice(o);return F(e,s,i,a,o),s},be=(e,t)=>{let n=ve(e,t);if(n===null)return null;let r=ye(n,t);return r===null?null:r},xe=(e,t)=>{let n=H(e);if(!n)return console.error(`patch: userMessageDisplay: failed to find Text component`),null;let r=Ai(e),i=R(e);if(!i)return console.error(`patch: userMessageDisplay: failed to find chalk variable`),null;let a=/(No content found in user prompt message.{0,250}?\b)([$\w]+(?:\.default)?\.createElement.{0,30}\b[$\w]+(?:\.default)?\.createElement.{0,40}">.+?)?(([$\w]+(?:\.default)?\.createElement).{0,200})(\([$\w]+,(?:\{[^{}]+wrap:"wrap"\},([$\w]+)(?:\.trim\(\))?\)\)|\{text:([$\w]+)[^}]*\}\)\)?))/,o=e.match(/(No content found in user prompt message[\s\S]{0,100}?;return )([$\w]+(?:\.default)?)\.createElement\(([$\w]+),(\{flexDirection:"column"[^{}]*\}),([$\w]+(?:\.default)?)\.createElement\(([$\w]+),\{text:([$\w]+)[^{}]*\}\)\)/),s=o?null:e.match(/(No content found in user prompt message.{0,1200}?)([$\w]+)=([$\w]+(?:\.default)?\.createElement)\([$\w]+,\{text:([$\w]+),useBriefLayout:[$\w]+,timestamp:[$\w]+\}\)/),c=o||s?null:e.match(a);if(!o&&(!s||s.index===void 0)&&(!c||c.index===void 0))return console.error(`patch: userMessageDisplay: failed to find user message display pattern`),e;let l=e=>`(typeof ${e}==="object"&&${e}!==null?${e}.head+"\\n("+${e}.hiddenLines+" line"+(${e}.hiddenLines===1?"":"s")+" hidden)\\n"+${e}.tail:${e})`;if(o){let r=o[1],i=o[2],a=o[3],s=o[4],c=o[5],u=o[7],d=s.slice(1,-1),f=/backgroundColor:[^,}]+(?:\?[^,}:]+:[^,}:]+)*/;if(t.backgroundColor===null)d=d.replace(RegExp(`,?${f.source}`),``).replace(/^,|,$/g,``);else if(t.backgroundColor!==`default`){let e=t.backgroundColor.match(/\d+/g);if(e){let t=`"rgb(${e.join(`,`)})"`;d=d.replace(/"userMessageBackground"/g,t)}}let p=[];if(t.borderStyle!==`none`){if(t.borderStyle.startsWith(`topBottom`)){let e=``;t.borderStyle===`topBottomSingle`?e=`{top:"─",bottom:"─",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`:t.borderStyle===`topBottomDouble`?e=`{top:"═",bottom:"═",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`:t.borderStyle===`topBottomBold`&&(e=`{top:"━",bottom:"━",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`),p.push(`borderStyle:${e}`)}else p.push(`borderStyle:"${t.borderStyle}"`);let e=t.borderColor.match(/\d+/g);e&&p.push(`borderColor:"rgb(${e.join(`,`)})"`)}t.paddingX!==`default`&&t.paddingX>0&&p.push(`paddingX:${t.paddingX}`),t.paddingY!==`default`&&t.paddingY>0&&p.push(`paddingY:${t.paddingY}`),t.fitBoxToContent&&p.push(`alignSelf:"flex-start"`),p.length>0&&(d=d?`${d},${p.join(`,`)}`:p.join(`,`));let m=`{${d}}`,h=[];if(t.foregroundColor===`default`)h.push(`color:"text"`);else{let e=t.foregroundColor.match(/\d+/g);e&&h.push(`color:"rgb(${e.join(`,`)})"`)}if(t.backgroundColor!==`default`&&t.backgroundColor!==null){let e=t.backgroundColor.match(/\d+/g);e&&h.push(`backgroundColor:"rgb(${e.join(`,`)})"`)}else t.backgroundColor===`default`&&h.push(`backgroundColor:"userMessageBackground"`);t.styling.includes(`bold`)&&h.push(`bold:!0`),t.styling.includes(`italic`)&&h.push(`italic:!0`),t.styling.includes(`underline`)&&h.push(`underline:!0`),t.styling.includes(`strikethrough`)&&h.push(`strikethrough:!0`),t.styling.includes(`inverse`)&&h.push(`inverse:!0`);let g=h.length>0?`{${h.join(`,`)}}`:`null`,_=l(u),v=r+`${i}.createElement(${a},${m},${c}.createElement(${n},${g},${"`"+t.format.replace(/\{\}/g,()=>"${"+_+`}`)+"`"}))`,y=o.index,b=y+o[0].length,x=e.slice(0,y)+v+e.slice(b);return F(e,x,v,y,b),x}if(!r)return console.error(`patch: userMessageDisplay: failed to find Box component`),null;let u=s??c,d=s?s[3]:c[4],f=s?s[4]:c[6]??c[7],p=[],m=t.borderStyle.startsWith(`topBottom`);if(t.borderStyle!==`none`){if(m){let e=``;t.borderStyle===`topBottomSingle`?e=`{top:"─",bottom:"─",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`:t.borderStyle===`topBottomDouble`?e=`{top:"═",bottom:"═",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`:t.borderStyle===`topBottomBold`&&(e=`{top:"━",bottom:"━",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}`),p.push(`borderStyle:${e}`)}else p.push(`borderStyle:"${t.borderStyle}"`);let e=t.borderColor.match(/\d+/g);e&&p.push(`borderColor:"rgb(${e.join(`,`)})"`)}t.paddingX===`default`?p.push(`paddingRight:1`):t.paddingX>0&&p.push(`paddingX:${t.paddingX}`),t.paddingY!==`default`&&t.paddingY>0&&p.push(`paddingY:${t.paddingY}`),t.fitBoxToContent&&p.push(`alignSelf:"flex-start"`);let h=i,g=[];if(t.foregroundColor!==`default`){let e=t.foregroundColor.match(/\d+/g);e&&(h+=`.rgb(${e.join(`,`)})`)}else g.push(`color:"text"`);if(t.backgroundColor!==`default`&&t.backgroundColor!==null){let e=t.backgroundColor.match(/\d+/g);if(e){h+=`.bgRgb(${e.join(`,`)})`;let t=`"rgb(${e.join(`,`)})"`;p.push(`backgroundColor:${t}`),g.push(`backgroundColor:${t}`)}}else t.backgroundColor===`default`&&(p.push(`backgroundColor:"userMessageBackground"`),g.push(`backgroundColor:"userMessageBackground"`));t.styling.includes(`bold`)&&(h+=`.bold`),t.styling.includes(`italic`)&&(h+=`.italic`),t.styling.includes(`underline`)&&(h+=`.underline`),t.styling.includes(`strikethrough`)&&(h+=`.strikethrough`),t.styling.includes(`inverse`)&&(h+=`.inverse`);let _=l(f),v="`"+t.format.replace(/\{\}/g,()=>"${"+_+`}`)+"`",y=`${h}(${v})`,b=p.length>0?`{${p.join(`,`)}}`:`null`,x=g.length>0?`{${g.join(`,`)}}`:`null`,S=s?`${s[2]}=`:``,C=u[1]+`${S}${d}(${r},${b},${d}(${n},${x},${y}))`,w=u.index,T=w+u[0].length,E=e.slice(0,w)+C+e.slice(T);return F(e,E,C,w,T),E},Se=(e,t)=>{let n=e;if(t.foregroundColor){let e=t.foregroundColor.match(/\d+/g);e&&(n+=`.rgb(${e.join(`,`)})`)}if(t.backgroundColor){let e=t.backgroundColor.match(/\d+/g);e&&(n+=`.bgRgb(${e.join(`,`)})`)}return t.styling.includes(`bold`)&&(n+=`.bold`),t.styling.includes(`italic`)&&(n+=`.italic`),t.styling.includes(`underline`)&&(n+=`.underline`),t.styling.includes(`strikethrough`)&&(n+=`.strikethrough`),t.styling.includes(`inverse`)&&(n+=`.inverse`),n},Ce=e=>{let t=e.match(/(if\(([$\w]+)\.highlight\?\.color\))((return [$\w]+\.createElement\([$\w]+,\{key:[$\w]+),color:[$\w]+\.highlight\.color(\},[$\w]+\.createElement\([$\w]+,null,)([$\w]+\.text)(\)\)));/);if(t&&t.index!==void 0){let n=`${t[2]}.highlight.color(${t[6]})`,r=t[1]+`{if(typeof ${t[2]}.highlight.color==='function')`+t[4]+t[5]+n+t[7]+`;else `+t[3]+`}`,i=e.slice(0,t.index)+r+e.slice(t.index+t[0].length);return F(e,i,r,t.index,t.index+t[0].length),i}let n=/(return ([$\w]+)\.createElement\(([$\w]+),\{key:([$\w]+)),color:([$\w]+)\.highlight\?\.color,dimColor:\5\.highlight\?\.dimColor,inverse:\5\.highlight\?\.inverse\},(\2\.createElement\([$\w]+,null,\5\.text\))\)/,r=e.match(n);if(!r||r.index===void 0)return console.error(`patch: inputPatternHighlighters: failed to find highlight?.color renderer pattern`),null;let i=r[2],a=r[3],o=r[4],s=r[5];r[6];let c=RegExp(`if\\(${s.replace(`$`,`\\$`)}\\.highlight\\.color\\)return ([$\\w]+)\\.createElement\\([$\\w]+,\\{key:[$\\w]+\\},${s.replace(`$`,`\\$`)}\\.text\\.split\\(""\\)\\.map\\([^)]+\\)\\)`),l=e,u=l.match(c);if(u&&u.index!==void 0){let e=`if(typeof ${s}.highlight?.color==='function')return ${i}.createElement(${a},{key:${o}},${i}.createElement(${a},null,${s}.highlight.color(${s}.text)));`;l=l.slice(0,u.index)+e+l.slice(u.index)}let d=l.match(n);if(!d||d.index===void 0)return console.error(`patch: inputPatternHighlighters: failed to re-find renderer after shimmer patch`),null;let f=d[2],p=d[3],m=d[4],h=d[5],g=d[6],_=`${h}.highlight?.style?${h}.highlight.style(${h}.text):${h}.text`,v=`return ${f}.createElement(${p},{key:${m},color:${h}.highlight?.style?void 0:${h}.highlight?.color,backgroundColor:${h}.highlight?.style?void 0:${h}.highlight?.backgroundColor,dimColor:${h}.highlight?.dimColor,inverse:${h}.highlight?.style?void 0:${h}.highlight?.inverse,bold:${h}.highlight?.style?void 0:${h}.highlight?.bold,italic:${h}.highlight?.style?void 0:${h}.highlight?.italic,underline:${h}.highlight?.style?void 0:${h}.highlight?.underline,strikethrough:${h}.highlight?.style?void 0:${h}.highlight?.strikethrough},${g.replace(`${h}.text`,_)})`,y=l.slice(0,d.index)+v+l.slice(d.index+d[0].length);return F(e,y,`shimmer guard + renderer`,0,0),y},we=(e,t,n)=>{let r=e.match(/((?:,|;let )[$\w]+=[$\w]+\.useMemo\(\(\)=>\{let [$\w]+=\[\];[\s\S]{0,2000}?)(if\([$\w]+&&[$\w]+&&![$\w]+\)([$\w]+)\.push\(\{start:[$\w]+,end:[$\w]+\+[$\w]+\.length,color:"warning",priority:\d+\})/);if(!r||r.index===void 0)return console.error(`patch: inputPatternHighlighters: failed to find useMemo/push pattern`),null;let i=r[3],a=r[1].match(/[^$\w]([$\w]+(?:\.default)?)\.useMemo\(/);if(!a)return console.error(`patch: inputPatternHighlighters: failed to extract React var from useMemo`),null;a[1];let o=Math.max(0,r.index-15e3),s=e.slice(o,r.index),c=/\binputValue:([$\w]+),/g,l=/\binput:([$\w]+),/g,u=[...s.matchAll(c)],d=[...s.matchAll(l)],f=u.at(-1)??d.at(-1)??null;if(!f)return console.error(`patch: inputPatternHighlighters: failed to find input variable pattern (looked for inputValue: and input:)`),null;let p=f[1],m=``;for(let e=0;e<n.length;e++){let r=n[e],a=Se(t,r),o=r.format??`{MATCH}`;JSON.stringify(o).replace(/\{MATCH\}/g,`"+x+"`);let s=r.foregroundColor;if(s){let e=s.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(e){let[,t,n,r]=e.map(Number);s=`#${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`}}let c=s?JSON.stringify(s):`undefined`,l=r.backgroundColor;if(l){let e=l.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(e){let[,t,n,r]=e.map(Number);l=`#${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`}}let u=l?JSON.stringify(l):null,d=r.styling??[],f=d.includes(`bold`),h=d.includes(`italic`),g=d.includes(`underline`),_=d.includes(`inverse`),v=d.includes(`dim`),y=d.includes(`strikethrough`),b=r.regex??r.pattern;if(!b){console.error(`patch: inputPatternHighlighters: highlighter "${r.name}" has no regex/pattern; skipping`);continue}let x=r.regexFlags??``;x.includes(`g`)||(x+=`g`);let S;try{S=new RegExp(b,x)}catch(e){console.error(`patch: inputPatternHighlighters: highlighter "${r.name}" has invalid regex; skipping`,e);continue}let C=la(S);m+=`if(typeof ${p}==="string"){for(let m of ${p}.matchAll(${C})){${i}.push({start:m.index,end:m.index+m[0].length,color:${c}${u?`,backgroundColor:${u}`:``}${f?`,bold:!0`:``}${h?`,italic:!0`:``}${g?`,underline:!0`:``}${_?`,inverse:!0`:``}${v?`,dimColor:!0`:``}${y?`,strikethrough:!0`:``},style:(x)=>${a}(x),priority:100})}}`}if(!m)return console.error(`patch: inputPatternHighlighters: no usable highlighters generated (all skipped)`),null;let h=r[1]+m+r[2],g=e.slice(0,r.index),_=e.slice(r.index+r[0].length),v=g+``+h+_,y=v.indexOf(`for(let m of ${p}.matchAll(`);if(y>-1){let e=[...v.slice(Math.max(0,y-2e3),y).matchAll(/useMemo\(\(\)=>\{/g)];if(e.length>0){let t=Math.max(0,y-2e3)+e[e.length-1].index,n=v.slice(t),r=0;for(let e=0;e<n.length;e++)if(n[e]===`(`)r++;else if(n[e]===`)`&&(r--,r===0)){let n=t+e;v.slice(n-1,n)===`]`&&(v.slice(n-200,n).includes(`,${p}]`)||(v=v.slice(0,n-1)+`,${p}]`+v.slice(n)));break}}}return F(e,v,``+h,r.index,r.index+r[0].length),v},Te=(e,t)=>{let n=t.filter(e=>e.enabled!==!1);if(n.length===0)return console.error(`patch: inputPatternHighlighters: no enabled highlighters provided`),null;let r=R(e);if(!r)return console.error(`^ patch: inputPatternHighlighters: failed to find chalk variable`),null;let i;return i=Ce(e),i?(i=we(i,r,n),i||(console.error(`^ patch: inputPatternHighlighters: writeCustomHighlighterCreation failed`),null)):(console.error(`^ patch: inputPatternHighlighters: writeCustomHighlighterImpl failed`),null)},Ee=e=>{let t=e.match(/(?:[$\w]+\.)?createElement\([$\w]+,\{(?=[^}]*responseLengthRef:)(?=[^}]*spinnerSuffix:)(?=[^}]*thinkingStatus:)(?=[^}]*isCompacting:)[^}]*verbose:[^,}]+[^}]*\}/);if(t&&t.index!==void 0){let e=t[0].match(/verbose:[^,}]+/);if(!e||e.index===void 0)return console.error(`patch: verbose: failed to find verbose property`),null;let n=t.index+e.index;return{startIndex:n,endIndex:n+e[0].length,replacement:`verbose:true`}}let n=e.match(/\{[^{}]{0,400}overrideMessage:[$\w]+,[^{}]{0,200}verbose:([$\w]+)[^{}]{0,200}\}\)\{/);if(n&&n.index!==void 0){let e=n[1],t=n.index+n[0].length;return{startIndex:t,endIndex:t,replacement:`${e}=!0;`}}return console.error(`patch: verbose: failed to find spinner props containing overrideMessage and verbose`),null},De=e=>{let t=Ee(e);if(!t)return null;let n=e.slice(0,t.startIndex)+t.replacement+e.slice(t.endIndex);return F(e,n,t.replacement,t.startIndex,t.endIndex),n},Oe=e=>{let t=e.match(/if\s*\(\s*([$\w]+)\(\)\s*===\s*"opusplan"\s*&&\s*([$\w]+)\s*===\s*"plan"\s*&&\s*!([$\w]+)\s*\)\s*return\s*([$\w]+)\(\);/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchModeSwitchingFunction: failed to find mode switching pattern`),null;let[n,r,i,a,o]=t,s=`if((${r}()==="opusplan"||${r}()==="opusplan[1m]")&&${i}==="plan"&&!${a})return ${o}();`,c=e.slice(0,t.index)+s+e.slice(t.index+n.length);return F(e,c,s,t.index,t.index+n.length),c},ke=e=>{let t=e.match(/(\["sonnet","opus","haiku",(?:"best",)?"sonnet\[1m\]",(?:"opus\[1m\]",)?"opusplan")/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchModelAliasesList: failed to find model aliases list`),null;let n=t[0]+`,"opusplan[1m]"`,r=e.slice(0,t.index)+n+e.slice(t.index+t[0].length);return F(e,r,n,t.index,t.index+t[0].length),r},Ae=e=>{let t=e.match(/(if\s*\(\s*([$\w]+)\s*===\s*"opusplan"\s*\)\s*return\s*"([^"]*Opus[^"]*plan mode[^"]*Sonnet[^"]*)";)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchDescriptionFunction: failed to find description pattern`),null;let[n,,r,i]=t,a=n+`if(${r}==="opusplan[1m]")return"${i} (1M context)";`,o=e.slice(0,t.index)+a+e.slice(t.index+n.length);return F(e,o,a,t.index,t.index+n.length),o},je=e=>{let t=e.match(/(if\s*\(\s*([$\w]+)\s*===\s*"opusplan"\s*\)\s*return\s*"Opus Plan";)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchLabelFunction: failed to find label pattern`),null;let[n,,r]=t,i=n+`if(${r}==="opusplan[1m]")return"Opus Plan 1M";`,a=e.slice(0,t.index)+i+e.slice(t.index+n.length);return F(e,a,i,t.index,t.index+n.length),a},Me=e=>{let t=e.match(/(if\s*\(\s*([$\w]+)\s*===\s*"opusplan"\s*\)\s*return\s*(?:[$\w]+\()?\[\s*\.\.\.([$\w]+)\s*,\s*([$\w]+)\(\)\s*\]\)?;)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchModelSelectorOptions: failed to find model selector pattern`),null;let[n,,r,i]=t,a=n.match(RegExp(`return\\s*([$\\w]+)\\(\\s*\\[\\.\\.\\.${W(i)}`)),o=a?a[1]:null,s=`{value:"opusplan[1m]",label:"Opus Plan Mode 1M",description:"Use Opus in plan mode, Sonnet (1M context) otherwise"}`,c=n+`if(${r}==="opusplan[1m]")return ${o?`${o}([...${i},${s}])`:`[...${i},${s}]`};`,l=e.slice(0,t.index)+c+e.slice(t.index+n.length);return F(e,l,c,t.index,t.index+n.length),l},Ne=e=>{let t=e.match(/(if\s*\(\s*[$\w]+\s*===\s*null\s*\|\|\s*([$\w]+)\.some\s*\(\s*\(\s*[$\w]+\s*\)\s*=>\s*[$\w]+\.value\s*===\s*[$\w]+\s*\)\s*\)\s*return\s*(?:[$\w]+\()?[$\w]+\)?\s*;)/);if(!t||t.index===void 0)return console.error(`patch: opusplan1m: patchAlwaysShowInModelSelector: failed to find model list check pattern`),null;let[,,n]=t,r=`${n}.push({value:"opusplan",label:"Opus Plan Mode",description:"Use Opus in plan mode, Sonnet otherwise"});${n}.push({value:"opusplan[1m]",label:"Opus Plan Mode 1M",description:"Use Opus in plan mode, Sonnet (1M context) otherwise"});`,i=e.slice(0,t.index)+r+e.slice(t.index);return F(e,i,r,t.index,t.index),i},Pe=e=>{if(e.includes(`"opusplan[1m]"`))return console.log(`patch: opusplan1m: opusplan[1m] already supported natively — skipping`),e;let t=e,n=Oe(t);if(n)t=n;else return console.error(`patch: opusplan1m: failed to apply mode switching patch`),null;if(n=ke(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply model aliases list patch`),null;if(n=Ae(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply description function patch`),null;if(n=je(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply label function patch`),null;if(n=Me(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply model selector options patch`),null;if(n=Ne(t),n)t=n;else return console.error(`patch: opusplan1m: failed to apply always-show-in-selector patch`),null;return t},Fe=e=>{if(/case"thinking":\{(?:(?!case")[^]){0,600}isTranscriptMode:true/.test(e))return console.log(`patch: thinkingVisibility: already configured natively — skipping`),e;let t=e.match(/(case"thinking":\{?)(if\(.+?\)return null;)(.{0,400}isTranscriptMode:).+?,/);if(!t||t.index===void 0)return console.error(`patch: thinkingVisibility: failed to find thinking visibility pattern`),null;let n=t[1]+t[3]+`true,`,r=t.index,i=r+t[0].length,a=e.slice(0,r)+n+e.slice(i);return F(e,a,n,r,i),a},Ie=(e,t)=>{let n=e.match(/(agentType\s*:\s*"Plan"\s*,[\s\S]{1,2500}?\bmodel\s*:\s*")[^"]+(")/);if(!n||n.index===void 0)return console.error(`patch: subagentModels: failed to find Plan agent pattern`),null;let r=n[1]+t+n[2],i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},Le=(e,t)=>{let n=e.match(/(\{agentType\s*:\s*"Explore"\s*,[\s\S]{1,2500}?\bmodel\s*:\s*")[^"]+(")/);if(!n||n.index===void 0)return console.error(`patch: subagentModels: failed to find Explore agent pattern`),null;let r=n[1]+t+n[2],i=n.index,a=i+n[0].length,o=e.slice(0,i)+r+e.slice(a);return F(e,o,r,i,a),o},Re=(e,t)=>{let n=e.match(/([^$\w][$\w]+\s*=\s*\{agentType\s*:\s*"general-purpose"[\s\S]{0,2500}?)(\})/);if(!n||n.index===void 0)return console.error(`patch: subagentModels: failed to find general-purpose agent pattern`),null;let r=n[1],i=n[2],a;a=r.includes(`model:`)?r.replace(/(model\s*:\s*")[^"]+(")/,`$1${t}$2`)+i:r+`${r.trim().endsWith(`,`)?``:`,`}model:"${t}"`+i;let o=n.index,s=o+n[0].length,c=e.slice(0,o)+a+e.slice(s);return F(e,c,a,o,s),c},ze=(e,t)=>{let n=e;if(t.plan){let e=Ie(n,t.plan);if(e===null)return null;n=e}if(t.explore){let e=Le(n,t.explore);if(e===null)return null;n=e}if(t.generalPurpose){let e=Re(n,t.generalPurpose);if(e===null)return null;n=e}return n},Be=e=>{let t=e.indexOf(`}.VERSION} (Claude Code)`);return t==-1?(console.error(`patch: patchesAppliedIndication: failed to find versionIndex`),null):{startIndex:0,endIndex:t+24}},Ve=e=>{let t=e.match(/createElement\(([$\w]+),\{bold:!0\},"Claude Code"\),([$\w]+)\[\d+\]=[$\w]+;else [$\w]+=([$\w]+)\[\d+\]/);if(!t||t.index===void 0)return console.error(`patch: patchesAppliedIndication: PATCH 2 failed to find bold Claude Code pattern`),null;let n=t[1],r=t.index+t[0].length,i=e.indexOf(`;`,r);if(i===-1)return null;let a=i+1,o=e.match(/[^$\w]([$\w]+)\.createElement\(([$\w]+),null,[$\w]+," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)\)/);if(!o||o.index===void 0){let t=e.match(/[^$\w]([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/);return!t||t.index===void 0?(console.error(`patch: patchesAppliedIndication: PATCH 2 failed to find version createElement`),null):{varInsertIndex:a,refInsertIndex:t.index+t[0].length,reactVar:t[1],textComponent:n}}return{varInsertIndex:a,refInsertIndex:o.index+o[0].length-1,reactVar:o[1],textComponent:n}},He=e=>{let t=e.match(/"Claude Code".{0,200}\{dimColor:!0\},"v",[$\w]+\)/);if(!t||t.index===void 0)return console.error(`patch: patchesAppliedIndication: failed to find version display for patch 3`),null;let n={index:t.index},r=Math.max(0,n.index-5e3),i=e.slice(r,n.index),a=Array.from(i.matchAll(/[};]\s*function ([$\w]+)\(/g));if(a.length===0)return console.error(`patch: patchesAppliedIndication: failed to find header component function`),null;let o=a[a.length-1][1],s=RegExp(`[^$\\w]([$\\w]+)\\.createElement\\(${W(o)},null\\),?`),c=e.match(s);if(!c||c.index===void 0)return console.error(`patch: patchesAppliedIndication: failed to find createElement call for header`),null;let l=e.slice(Math.max(0,c.index-30),c.index+1).match(/([$\w]+)=(?:[$\w]+&&)?[^$\w]?$/);if(l){let t=l[1],n=e.slice(c.index,c.index+2e3),r=RegExp(`,${W(t)}([,\\)])`),i=n.match(r);if(i&&i.index!==void 0){let e=c.index+i.index+i[0].length-i[1].length;return{startIndex:e,endIndex:e}}}let u=c.index+c[0].length;return{startIndex:u,endIndex:u}},Ue=(e,t,n,r=!0,i=!0)=>{let a=Be(e);if(!a)return console.error(`patch: patchesAppliedIndication: failed to version output location`),null;let o=`\\n${t} (tweakcc-fixed)`,s=`}.VERSION} (Claude Code)`,c=e.replaceAll(s,s+o);F(e,c,o,a.endIndex,a.endIndex);let l=R(e);if(!l)return console.error(`patch: patchesAppliedIndication: failed to find chalk variable`),null;let u=H(e);if(!u)return console.error(`patch: patchesAppliedIndication: failed to find text component`),null;let d=V(e);if(!d)return console.error(`patch: patchesAppliedIndication: failed to find React variable`),null;if(r){let e=c.match(/(\$\{([$\w]+)\("inactive",([$\w]+)\)\(`v\$\{[$\w]+\}`\)\}) `,/);if(e&&e.index!==void 0){let n=e[0],r=e[2],i=e[3],a=`${e[1]} \${${r}("warning",${i})("+ tweakcc v${t}")} \`,`;c=c.replace(n,a)}c=c.replace(/([$\w]+\("claude",[$\w]+\)\(" Claude Code) ("\))/,`$1 + tweakcc v${t} $2`);let n=Ve(c);if(!n)console.error(`patch: patchesAppliedIndication: patch 2 skipped (header version pattern changed)`);else{let e=`let _tw=${n.reactVar}.createElement(${n.textComponent},null,${l}.hex("#FF8400").bold("+ tweakcc v${t}"));`,r=c;c=c.slice(0,n.varInsertIndex)+e+c.slice(n.varInsertIndex),F(r,c,e,n.varInsertIndex,n.varInsertIndex);let i=n.refInsertIndex+e.length,a=`," ",_tw`,o=c;c=c.slice(0,i)+a+c.slice(i),F(o,c,a,i,i)}}if(i){let e=Ai(c);if(!e)return console.error(`patch: patchesAppliedIndication: PATCH 3 skipped (Box component not located on this CC version)`),c;let t=He(c);if(!t)console.log(`patch: patchesAppliedIndication: patch 3 skipped (see prior message)`);else{let r=[];r.push(`,${d}.createElement(${e}, { flexDirection: "column" },`),r.push(`${d}.createElement(${e}, null, ${d}.createElement(${u}, {color: "success", bold: true}, "┃ "), ${d}.createElement(${u}, {color: "success", bold: true}, "✓ tweakcc-fixed patches are applied")),`);for(let t of n)t=t.replace(`CHALK_VAR`,l),r.push(`${d}.createElement(${e}, null, ${d}.createElement(${u}, {color: "success", bold: true}, "┃ "), ${d}.createElement(${u}, {dimColor: true}, \` * ${t}\`)),`);r.push(`),`);let i=r.join(`
|
|
2
2
|
`);t.startIndex>0&&c[t.startIndex-1]===`,`&&i.startsWith(`,`)&&(i=i.slice(1)),i.endsWith(`,`)&&c[t.startIndex]===`,`&&(i=i.slice(0,-1));let a=c;c=c.slice(0,t.startIndex)+i+c.slice(t.endIndex),F(a,c,i,t.startIndex,t.endIndex)}}return c};function We(){try{let e=v(import.meta.url),t=f.dirname(e);for(let e=0;e<5;e++){let e=f.join(t,`data`,`prompts`),n=f.join(t,`package.json`);if(s.existsSync(n)&&s.existsSync(e))return e;let r=f.dirname(t);if(r===t)break;t=r}}catch{}return null}async function Ge(e){let t=We();if(t){let n=f.join(t,`prompts-${e}.json`);try{let e=await a.readFile(n,`utf-8`);return JSON.parse(e)}catch{}}let n=f.join(ga,`prompts-${e}.json`);try{let e=await a.readFile(n,`utf-8`);return JSON.parse(e)}catch{}let r=`https://raw.githubusercontent.com/skrabe/tweakcc-fixed/refs/heads/main/data/prompts/prompts-${e}.json`;try{let t=await fetch(r);if(!t.ok){let n;throw n=t.status===429?`Rate limit exceeded. GitHub has temporarily blocked requests. Please wait a few minutes and try again.`:t.status===404?`Prompts file not found for Claude Code v${e}. The fork's version-bump pipeline hasn't published prompts for this release yet — check https://github.com/skrabe/tweakcc-fixed for status.`:t.status>=500?`GitHub server error (${t.status}). Please try again later.`:`HTTP ${t.status}: ${t.statusText}`,Error(n)}let i=await t.json();try{await a.mkdir(ga,{recursive:!0}),await a.writeFile(n,JSON.stringify(i,null,2),`utf-8`)}catch(e){console.warn(`Failed to write to cache to ${n}: ${e}`)}return i}catch(t){if(t instanceof Error){if(t.message.includes(`Rate limit`)||t.message.includes(`not found`)||t.message.includes(`server error`)||t.message.includes(`HTTP`))throw t;let n=`Failed to download prompts for version ${e}: ${t.message}`;throw Error(n)}throw t}}const Ke=()=>f.join(J,`systemPromptOriginalHashes.json`),qe=()=>f.join(J,`systemPromptAppliedHashes.json`),Je=(e,t)=>`${e}-${t}`,Ye=e=>h.createHash(`md5`).update(e.trim(),`utf8`).digest(`hex`),Xe=async()=>{try{let e=await a.readFile(Ke(),`utf8`);return JSON.parse(e)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{};throw e}},Ze=async e=>{await a.mkdir(J,{recursive:!0});let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];await a.writeFile(Ke(),JSON.stringify(t,null,2),`utf8`)},Qe=async e=>{let t=await Xe(),n=0;for(let r of e.prompts){let e=Je(r.id,r.version);t[e]||(t[e]=Ye(M(r.pieces,r.identifiers,r.identifierMap)),n++)}return await Ze(t),n},$e=async(e,t)=>(await Xe())[Je(e,t)],et=async()=>{try{let e=await a.readFile(qe(),`utf8`);return JSON.parse(e)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{};throw e}},tt=async e=>{await a.mkdir(J,{recursive:!0});let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];await a.writeFile(qe(),JSON.stringify(t,null,2),`utf8`)},nt=async e=>{if(Object.keys(e).length===0)return;let t=await et();for(let[n,r]of Object.entries(e))t[n]=r;await tt(t)},rt=async()=>{let e=await et(),t={};for(let n of Object.keys(e))t[n]=null;await tt(t)},it=async e=>{try{let t=await et();if(Object.keys(t).length===0)return!1;let n=(await a.readdir(e)).filter(e=>e.endsWith(`.md`));for(let r of n){let n=t[r.replace(`.md`,``)];if(n==null)continue;let i=f.join(e,r),o=await a.readFile(i,`utf8`);if(Ye((await import(`gray-matter`)).default(o,{delimiters:[`<!--`,`-->`]}).content)!==n)return!0}return!1}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return!1;throw e}},at=(e,t)=>{let n=_(t,{delimiters:[`<!--`,`-->`]}),r=n.data,i=(n.content??``).replace(/^\n+/,``).replace(/\n+$/,``);return{id:e,name:typeof r.name==`string`?r.name:e,description:typeof r.description==`string`?r.description:``,ccVersion:typeof r.ccVersion==`string`?r.ccVersion:``,placeholders:Array.isArray(r.placeholders)?r.placeholders.filter(e=>typeof e==`string`):[],body:i,isSuppressed:i.trim().length===0}},ot=(e,t,n,r,i)=>{let a={name:e,description:t,ccVersion:n};return r.length>0&&(a.placeholders=r),_.stringify(i,a,{delimiters:[`<!--`,`-->`]})},st=async e=>{let t=l.join(ha,`${e}.md`);try{return at(e,await a.readFile(t,`utf8`))}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return null;throw e}},ct=async(e,t,n,r,i,o)=>{let s=l.join(ha,`${e}.md`);try{return await a.stat(s),!1}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`ENOENT`))throw e}return await a.mkdir(l.dirname(s),{recursive:!0}),await a.writeFile(s,ot(t,n,r,i,o)),!0},lt=(e,t)=>{let n=[],r=new Set(Object.keys(t)),i=/\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g,a;for(;(a=i.exec(e))!==null;)r.has(a[1])||n.push(`unknown placeholder "{{${a[1]}}}"; allowed: ${[...r].map(e=>`{{${e}}}`).join(`, `)||`(none)`}`);if(n.length>0)return{result:``,errors:n};let o=e.split(i),s=``;for(let e=0;e<o.length;e++)e%2==0?s+=o[e].replace(/\\/g,`\\\\`).replace(/`/g,"\\`").replace(/\$\{/g,"\\${"):s+=t[o[e]];return{result:s,errors:[]}},k=(e,t,n,r,i)=>{let a=e.match(t);if(!a||a.index===void 0)return i&&i(e)?e:(console.error(`patch: reminder ${r}: failed to find anchor`),null);let o=n(a),s=e.slice(0,a.index)+o+e.slice(a.index+a[0].length);return F(e,s,o,a.index,a.index+a[0].length),s},A=(e,t,n)=>{let r=`case"${t}":{`,i=[],a=0;for(;;){let t=e.indexOf(r,a);if(t<0)break;i.push(t),a=t+r.length}if(i.length===0)return null;let o=i.find(t=>e.slice(t,t+2048).includes(n));if(o===void 0)return null;let s=o+r.length,c=1,l=s,u=!1,d=!1,f=!1,p=0;for(;l<e.length&&c>0;){let t=e[l],n=e[l-1];if(d)t===`\\`?l++:t===`'`&&(d=!1);else if(f)t===`\\`?l++:t===`"`&&(f=!1);else if(u)t===`\\`?l++:t==="`"&&p===0?u=!1:t===`$`&&e[l+1]===`{`?(p++,l++):t===`}`&&p>0&&p--;else if(t===`'`&&n!==`\\`)d=!0;else if(t===`"`&&n!==`\\`)f=!0;else if(t==="`"&&n!==`\\`)u=!0;else if(t===`{`)c++;else if(t===`}`&&(c--,c===0))return{headerIdx:o,bodyStart:s,bodyEnd:l};l++}return null},j=e=>{let t=/return\s+[^;]*?([$\w]+)\(\[([$\w]+)\(\{content:/g,n=null,r;for(;(r=t.exec(e))!==null;)n=r;return n?{arrayWrap:n[1],msgCtor:n[2]}:{arrayWrap:`o5`,msgCtor:`j6`}},ut=e=>{let t=e.match(/^\s*if\(!([$\w]+)\(\)\)return\s*\[\]/);return t?t[1]:`GX`},dt=(e,t)=>{let n=e.match(RegExp(`([$\\w]+)\\.${t}\\b`));return n?n[1]:`H`},ft=[{id:`claudemd-context`,name:`claudeMd context wrapper`,description:`Per-turn <system-reminder> that bundles { claudeMd, userEmail, currentDate } into a 'As you answer the user's questions...' block. Empty .md body = suppress entirely.`,placeholders:{context_blocks:"${Object.entries(_).map(([q,K])=>`# ${q}\\n${K}`).join(`\\n`)}"},defaultBody:`As you answer the user's questions, you can use the following context:
|
|
3
3
|
{{context_blocks}}
|
|
4
4
|
|
|
@@ -229,7 +229,7 @@ try {
|
|
|
229
229
|
`)})}else O+=t.bgGreen.black(e.value);else e.removed||(O+=t.dim(e.value));K(`
|
|
230
230
|
--- Diff ---`),K(t.red(`OLD: `)+D),K(t.green(`NEW: `)+O),K(`--- End Diff ---
|
|
231
231
|
`)},I=(e,t,n)=>{let r=[],i=t.global?t:new RegExp(t.source,t.flags+`g`),a;for(;(a=i.exec(e))!==null;)r.push({index:a.index,length:a[0].length});let o=new RegExp(t.source,t.flags.replace(`g`,``)),s=e;for(let e=r.length-1;e>=0;e--){let{index:t,length:i}=r[e],a=s,c=s.slice(t,t+i).replace(o,n);s=s.slice(0,t)+c+s.slice(t+i),F(a,s,c,t,t+i)}return s},nn=(e,t)=>{if(!/^<!--/.test(t))return null;let n;try{n=_(t,{delimiters:[`<!--`,`-->`]})}catch{return null}let r=n.data;return typeof r.inlineBlobAnchor!=`string`||!r.inlineBlobAnchor||typeof r.inlineBlobKind!=`string`||![`array`,`template`,`string`].includes(r.inlineBlobKind)?null:{filename:e,frontmatter:r,body:n.content.replace(/^\n+/,``).replace(/\n+$/,``)}},rn=(e,t)=>{if(e[t]!==`[`)return null;let n=0,r=!1,i=null,a=t;for(;a<e.length;){let t=e[a];if(r){if(t===`\\`&&a+1<e.length){a+=2;continue}if(t===i)r=!1;else if(i==="`"&&t===`$`&&a+1<e.length&&e[a+1]===`{`){let t=1,n=a+2;for(;n<e.length&&t>0;){let r=e[n];if(r===`\\`&&n+1<e.length){n+=2;continue}if(r==="`"){let r=an(e,n);if(r===null){t=0;break}n=r;continue}r===`{`?t++:r===`}`&&t--,n++}a=n;continue}}else if(t===`"`||t===`'`||t==="`")r=!0,i=t;else if(t===`[`)n++;else if(t===`]`&&(n--,n===0))return a+1;a++}return null},an=(e,t)=>{if(e[t]!=="`")return null;let n=t+1;for(;n<e.length;){let t=e[n];if(t===`\\`&&n+1<e.length){n+=2;continue}if(t==="`")return n+1;if(t===`$`&&n+1<e.length&&e[n+1]===`{`){let t=1,r=n+2;for(;r<e.length&&t>0;){let n=e[r];if(n===`\\`&&r+1<e.length){r+=2;continue}if(n==="`"){let t=an(e,r);if(t===null)return null;r=t;continue}n===`{`?t++:n===`}`&&t--,r++}n=r;continue}n++}return null},on=e=>/\\u[0-9a-fA-F]{4}/.test(e),sn=(e,t)=>{let n=`"`;for(let r of e){let e=r.codePointAt(0);if(r===`\\`)n+=`\\\\`;else if(r===`"`)n+=`\\"`;else if(r===`
|
|
232
|
-
`)n+=`\\n`;else if(r===`\r`)n+=`\\r`;else if(r===` `)n+=`\\t`;else if(t&&e>126)if(e<=65535)n+=`\\u`+e.toString(16).padStart(4,`0`);else{let t=e-65536,r=55296+(t>>10),i=56320+(t&1023);n+=`\\u`+r.toString(16).padStart(4,`0`)+`\\u`+i.toString(16).padStart(4,`0`)}else n+=r}return n+=`"`,n},cn=e=>{let t=[],n=0;for(;n<e.length;){if(e[n]===`$`&&n+1<e.length&&e[n+1]===`{`&&(n===0||e[n-1]!==`\\`)){let r=1,i=n+2,a=!1,o=null,s=i;for(;i<e.length&&r>0;){let t=e[i];if(a){if(t===`\\`&&i+1<e.length){i+=2;continue}t===o&&(a=!1)}else if(t===`"`||t===`'`||t==="`")a=!0,o=t;else if(t===`{`)r++;else if(t===`}`&&(r--,r===0))break;i++}t.push(e.slice(s,i)),n=i+1;continue}n++}return t},ln=(e,t)=>{let n=``,r=0,i=0;for(;r<e.length;){if(e[r]===`$`&&r+1<e.length&&e[r+1]===`{`&&(r===0||e[r-1]!==`\\`)){let a=1,o=r+2,s=!1,c=null;for(;o<e.length&&a>0;){let t=e[o];if(s){if(t===`\\`&&o+1<e.length){o+=2;continue}t===c&&(s=!1)}else if(t===`"`||t===`'`||t==="`")s=!0,c=t;else if(t===`{`)a++;else if(t===`}`&&(a--,a===0))break;o++}i<t.length?n+="${"+t[i]+`}`:n+=e.slice(r,o+1),i++,r=o+1;continue}n+=e[r],r++}return n},un=e=>{let t=new Set;for(let n of e.matchAll(/(?<!\\)\$\{([A-Za-z$][\w$]*)\}/g)){let e=n[1];e.length>4||e===e.toUpperCase()&&/[A-Z]/.test(e)&&e.length>2||t.add(e)}return t},dn=(e,t)=>{let n=un(e),r=[];for(let e of un(t))n.has(e)||r.push(e);return r},fn=e=>{let t=[],n=0,r=!1,i=null,a=e=>/[A-Za-z_$]/.test(e),o=e=>/[A-Za-z0-9_$]/.test(e);for(;n<e.length;){let s=e[n];if(r){if(s===`\\`&&n+1<e.length){n+=2;continue}if(s===i){r=!1,n++;continue}if(i==="`"&&s===`$`&&n+1<e.length&&e[n+1]===`{`){let
|
|
232
|
+
`)n+=`\\n`;else if(r===`\r`)n+=`\\r`;else if(r===` `)n+=`\\t`;else if(t&&e>126)if(e<=65535)n+=`\\u`+e.toString(16).padStart(4,`0`);else{let t=e-65536,r=55296+(t>>10),i=56320+(t&1023);n+=`\\u`+r.toString(16).padStart(4,`0`)+`\\u`+i.toString(16).padStart(4,`0`)}else n+=r}return n+=`"`,n},cn=e=>{let t=[],n=0;for(;n<e.length;){if(e[n]===`$`&&n+1<e.length&&e[n+1]===`{`&&(n===0||e[n-1]!==`\\`)){let r=1,i=n+2,a=!1,o=null,s=i;for(;i<e.length&&r>0;){let t=e[i];if(a){if(t===`\\`&&i+1<e.length){i+=2;continue}t===o&&(a=!1)}else if(t===`"`||t===`'`||t==="`")a=!0,o=t;else if(t===`{`)r++;else if(t===`}`&&(r--,r===0))break;i++}t.push(e.slice(s,i)),n=i+1;continue}n++}return t},ln=(e,t)=>{let n=``,r=0,i=0;for(;r<e.length;){if(e[r]===`$`&&r+1<e.length&&e[r+1]===`{`&&(r===0||e[r-1]!==`\\`)){let a=1,o=r+2,s=!1,c=null;for(;o<e.length&&a>0;){let t=e[o];if(s){if(t===`\\`&&o+1<e.length){o+=2;continue}t===c&&(s=!1)}else if(t===`"`||t===`'`||t==="`")s=!0,c=t;else if(t===`{`)a++;else if(t===`}`&&(a--,a===0))break;o++}i<t.length?n+="${"+t[i]+`}`:n+=e.slice(r,o+1),i++,r=o+1;continue}n+=e[r],r++}return n},un=e=>{let t=new Set;for(let n of e.matchAll(/(?<!\\)\$\{([A-Za-z$][\w$]*)\}/g)){let e=n[1];e.length>4||e===e.toUpperCase()&&/[A-Z]/.test(e)&&e.length>2||t.add(e)}return t},dn=(e,t)=>{let n=un(e),r=[];for(let e of un(t))n.has(e)||r.push(e);return r},fn=e=>{let t=[],n=0,r=!1,i=null,a=e=>/[A-Za-z_$]/.test(e),o=e=>/[A-Za-z0-9_$]/.test(e);for(;n<e.length;){let s=e[n];if(r){if(s===`\\`&&n+1<e.length){n+=2;continue}if(s===i){r=!1,n++;continue}if(i==="`"&&s===`$`&&n+1<e.length&&e[n+1]===`{`){let r=1,i=n+2,a=!1,o=null;for(;i<e.length&&r>0;){let t=e[i];if(a){if(t===`\\`&&i+1<e.length){i+=2;continue}t===o&&(a=!1),i++;continue}if(t===`"`||t===`'`||t==="`"){a=!0,o=t,i++;continue}if(t===`{`)r++;else if(t===`}`&&(r--,r===0))break;i++}let s=e.slice(n+2,i);for(let e of fn(s))t.push({name:e.name,start:e.start+n+2,end:e.end+n+2});n=i+1;continue}n++;continue}if(s===`"`||s===`'`||s==="`"){r=!0,i=s,n++;continue}if(a(s)){let r=n>0?e[n-1]:``,i=n>1?e[n-2]:``,a=n>2?e[n-3]:``,s=!(r===`.`&&i===`.`&&a===`.`)&&(r===`.`||r===`?`&&i===`?`),c=n;for(;n<e.length&&o(e[n]);)n++;let l=e.slice(c,n);!s&&![`true`,`false`,`null`,`undefined`,`this`,`void`,`new`].includes(l)&&t.push({name:l,start:c,end:n});continue}n++}return t},pn=(e,t)=>{let n=fn(e);if(n.length===0)return e;let r=``,i=0,a=0;for(let o of n)r+=e.slice(i,o.start),a<t.length?r+=t[a]:r+=o.name,i=o.end,a++;return r+=e.slice(i),r},mn=(e,t)=>{let n="`",r=0;for(;r<e.length;){let i=e[r];if(i===`$`&&r+1<e.length&&e[r+1]===`{`){let t=1,i=r+2,a=!1,o=null;for(;i<e.length&&t>0;){let n=e[i];if(a){if(n===`\\`&&i+1<e.length){i+=2;continue}n===o&&(a=!1)}else n===`"`||n===`'`||n==="`"?(a=!0,o=n):n===`{`?t++:n===`}`&&t--;i++}n+=e.slice(r,i),r=i;continue}let a=i.codePointAt(0);if(i===`\\`)n+=`\\\\`;else if(i==="`")n+="\\`";else if(t&&a>126)if(a<=65535)n+=`\\u`+a.toString(16).padStart(4,`0`);else{let e=a-65536,t=55296+(e>>10),r=56320+(e&1023);n+=`\\u`+t.toString(16).padStart(4,`0`)+`\\u`+r.toString(16).padStart(4,`0`)}else n+=i;r++}return n+="`",n},hn=async e=>{let t=on(e);t&&G(`inlineBlobOverrides: cli.js uses unicode escaping`);let n;try{n=await a.readdir(Z)}catch{return{content:e,results:[]}}let r=n.filter(e=>e.startsWith(`inline-`)&&e.endsWith(`.md`));if(r.length===0)return{content:e,results:[]};let i=[];for(let n of r.sort()){let r=l.join(Z,n),o;try{o=await a.readFile(r,`utf8`)}catch(e){i.push({filename:n,name:n,applied:!1,failed:!0,details:`read failed: ${e}`});continue}let s=nn(n,o);if(!s){i.push({filename:n,name:n,applied:!1,failed:!0,details:`frontmatter missing inlineBlobAnchor/Kind`});continue}let{frontmatter:c,body:u}=s,d;try{d=new RegExp(c.inlineBlobAnchor,`s`)}catch(e){i.push({filename:n,name:c.name,applied:!1,failed:!0,details:`invalid anchor regex: ${e}`});continue}let f=d.exec(e);if(!f){i.push({filename:n,name:c.name,applied:!1,failed:!0,details:`anchor not found in cli.js`});continue}let p,m,h;if(c.inlineBlobKind===`array`){let r=e.indexOf(`[`,f.index);if(r===-1){i.push({filename:n,name:c.name,applied:!1,failed:!0,details:`no [ after anchor`});continue}let a=rn(e,r);if(a===null){i.push({filename:n,name:c.name,applied:!1,failed:!0,details:`array walker failed`});continue}p=r,m=a,h=c.inlineBlobRawPassthrough===`true`?`[`+pn(u,fn(e.slice(r+1,a-1)).map(e=>e.name))+`]`:`[`+u.split(`
|
|
233
233
|
`).map(e=>sn(e,t)).join(`,`)+`]`}else if(c.inlineBlobKind===`template`){let r=e[f.index]==="`"?f.index:e.indexOf("`",f.index);if(r===-1){i.push({filename:n,name:c.name,applied:!1,failed:!0,details:`no backtick at/after anchor`});continue}let a=an(e,r);if(a===null){i.push({filename:n,name:c.name,applied:!1,failed:!0,details:`template walker failed`});continue}p=r,m=a,h=mn(ln(u,cn(e.slice(r+1,a-1))),t)}else if(c.inlineBlobKind===`string`){let r=f.index;for(;r<e.length&&e[r]!==`"`&&e[r]!==`'`;)r++;if(r>=e.length){i.push({filename:n,name:c.name,applied:!1,failed:!0,details:`no quote at/after anchor`});continue}let a=e[r],o=r+1;for(;o<e.length;){if(e[o]===`\\`){o+=2;continue}if(e[o]===a)break;o++}if(o>=e.length){i.push({filename:n,name:c.name,applied:!1,failed:!0,details:`unterminated string`});continue}p=r,m=o+1,h=sn(u,t)}else{i.push({filename:n,name:c.name,applied:!1,failed:!0,details:`kind ${c.inlineBlobKind} not implemented`});continue}let g=f.index,_=f.index+f[0].length;if(!(p<=_&&m>g)){console.log(`inline-blob: anchor for "${c.name}" (${n}) matched outside its target literal — cannot apply safely, skipping`),i.push({filename:n,name:c.name,applied:!1,failed:!1,skipped:!0,details:`anchor matched outside target literal — skipped (unsafe)`});continue}let v=dn(e.slice(p,m),h);if(v.length>0){console.log(`inline-blob: "${c.name}" (${n}) would introduce undefined var \${${v[0]}} (markdown out of sync with CC prompt data) — cannot apply safely, skipping`),i.push({filename:n,name:c.name,applied:!1,failed:!1,skipped:!0,details:`would introduce undefined \${${v[0]}} — skipped (unsafe)`});continue}let y=e;e=e.slice(0,p)+h+e.slice(m);let b=m-p-h.length,x=b>0?`${b} fewer chars`:b<0?`${-b} more chars`:`unchanged`;F(y,e,h,p,m),i.push({filename:n,name:c.name,applied:!0,failed:!1,details:x})}return{content:e,results:i}},gn=e=>{let t=e.match(/ensureServerStarted:([$\w]+)/);if(!t||t.index===void 0)return console.error(`patch: fixLspSupport: failed to find ensureServerStarted`),null;let n=Math.max(0,t.index-50),r=Math.min(e.length,t.index+50),i=e.slice(n,r),a=i.match(/sendRequest:([$\w]+)[,}]/);if(!a)return console.error(`patch: fixLspSupport: failed to find sendRequest near ensureServerStarted, window=${JSON.stringify([n,r,i])}`),null;let o=a[1],s=Math.max(0,t.index-4e3),c=e.slice(s,t.index),l=RegExp(`async function ${W(o)}\\(([$\\w]+),`,`g`),u,d=null;for(;(u=l.exec(c))!==null;)d=u;if(!d)return console.error(`patch: fixLspSupport: failed to find async function ${o}`),null;let f=d[1],p=s+d.index,m=e.slice(p,t.index).match(/let ([$\w]+)=await [$\w]+\([$\w]+\);/);if(!m||m.index===void 0)return console.error(`patch: fixLspSupport: failed to find second line of sendRequest`),null;let h=m[1],g=p+m.index+m[0].length,_=e.slice(g,t.index),v=RegExp(`if\\(!${W(h)}\\)return;`),y=_.match(v);if(!y||y.index===void 0)return console.error(`patch: fixLspSupport: failed to find if(!serverVar)return; line`),null;let b=g+y.index+y[0].length;return{startIndex:b,endIndex:b,identifiers:[f,h]}},_n=e=>{let 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,i=e;if(i=I(i,t,``),i=I(i,n,``),i=I(i,r,``),i.includes(`textDocument/didOpen`))return G(`patch: fixLspSupport: native LSP didOpen detected — skipping injection`),i;let a=gn(i);if(!a||!a.identifiers)return null;let[o,s]=a.identifiers,c=`
|
|
234
234
|
const path = await import('path');
|
|
235
235
|
const ext = path.extname(${o}).toLowerCase();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,O as t,S as n,f as r,h as i,l as a,n as o,nt as s,p as c,r as l,rt as ee,tt as u,u as d}from"./config-
|
|
1
|
+
import{C as e,O as t,S as n,f as r,h as i,l as a,n as o,nt as s,p as c,r as l,rt as ee,tt as u,u as d}from"./config-B1Mrn1vp.mjs";import{Box as f,Text as p,render as m,useInput as h}from"ink";import g,{useState as _}from"react";import*as te from"node:os";import v from"node:os";import*as y from"node:fs/promises";import b from"node:fs/promises";import x from"path";import{jsx as S,jsxs as C}from"react/jsx-runtime";import w from"which";import{globbySync as T}from"globby";const E=(()=>{let e=[],t=process.platform==`win32`?v.homedir().replace(/\\/g,`/`):v.homedir(),n=`node_modules/@anthropic-ai/claude-code`,r=(t,n=!1)=>{if(n)try{let n=T(t,{onlyFiles:!1});e.push({pattern:t,isGlob:!0,expandedPaths:n})}catch(n){n instanceof Error&&`code`in n&&(n.code===`EACCES`||n.code===`EPERM`)?c(`Permission denied accessing: ${t} (${n.code})`):c(`Error expanding glob pattern "${t}": ${n instanceof Error?n.message:String(n)}`),e.push({pattern:t,isGlob:!0,expandedPaths:[]})}else e.push({pattern:t,isGlob:!1,expandedPaths:[t]})};return r(`${v.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}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/AppData/Local/Bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/AppData/Local/fnm_multishells/*/node_modules/${n}`,!0),r(`${t}/AppData/Local/mise/installs/node/*/${n}`,!0),r(`${t}/AppData/Local/mise/installs/npm-anthropic-ai-claude-code/*/${n}`,!0)):(process.platform==`darwin`&&(r(`${t}/Library/${n}`),r(`/opt/local/lib/${n}`),r(`${t}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/Library/Caches/bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0)),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(`${t}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${t}/.local/share/bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),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(`/usr/local/share/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.env.MISE_DATA_DIR&&r(`${process.env.MISE_DATA_DIR}/installs/npm-anthropic-ai-claude-code/*/lib/${n}`,!0),r(`${t}/.local/share/mise/installs/npm-anthropic-ai-claude-code/*/lib/${n}`,!0)),process.platform==`win32`&&e.forEach(e=>{e.pattern=e.pattern.replace(/\//g,`\\`),e.expandedPaths=e.expandedPaths.map(e=>e.replace(/\//g,`\\`))}),e})().flatMap(e=>e.expandedPaths),ne=(()=>{let e=process.platform===`win32`?v.homedir().replace(/\\/g,`/`):v.homedir(),t=[],n=(e,n=!1)=>{if(n)try{let n=T(e,{onlyFiles:!0});t.push({pattern:e,isGlob:!0,expandedPaths:n})}catch(n){n instanceof Error&&`code`in n&&(n.code===`EACCES`||n.code===`EPERM`)?c(`Permission denied accessing: ${e} (${n.code})`):c(`Error expanding glob pattern "${e}": ${n instanceof Error?n.message:String(n)}`),t.push({pattern:e,isGlob:!0,expandedPaths:[]})}else t.push({pattern:e,isGlob:!1,expandedPaths:[e]})};if(n(`${e}/.local/bin/claude`),process.platform===`win32`&&(n(`${e}/.nvm/versions/node/v22.21.1/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe`),n(`${e}/.local/bin/claude.exe`)),n(`${e}/.local/share/claude/versions/*`,!0),process.platform!==`win32`){let t=`lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe`,r=process.env.MISE_DATA_DIR||`${e}/.local/share/mise`;n(`${r}/installs/node/*/${t}`,!0),n(`${r}/installs/npm-anthropic-ai-claude-code/*/${t}`,!0)}return process.platform===`win32`&&t.forEach(e=>{e.pattern=e.pattern.replace(/\//g,`\\`),e.expandedPaths=e.expandedPaths.map(e=>e.replace(/\//g,`\\`))}),t})().flatMap(e=>e.expandedPaths);var D=class extends Error{constructor(e){super(e),this.name=`InstallationDetectionError`}};let O=null;async function re(){return O||=(async()=>{try{let{WASMagic:e}=await import(`wasmagic`);return await e.create()}catch(e){return c(`WASMagic initialization failed (likely SIMD unsupported on this CPU):`,e),c(`Using fallback file type detection`),null}})(),O}const ie=Buffer.from([127,69,76,70]),ae=Buffer.from([254,237,250,206]),oe=Buffer.from([254,237,250,207]),se=Buffer.from([206,250,237,254]),k=Buffer.from([207,250,237,254]),A=Buffer.from([202,254,186,190]),j=Buffer.from([77,90]);function M(e){if(e.length===0)return null;if(e[0]===35&&e[1]===33&&e.subarray(0,Math.min(256,e.length)).toString(`utf8`).split(`
|
|
2
2
|
`)[0].includes(`node`))return c(`detectFileTypeFallback: Detected JavaScript via shebang`),`javascript`;if(e.length>=4){let t=e.subarray(0,4);if(t.equals(ie))return c(`detectFileTypeFallback: Detected ELF binary`),`binary`;if(t.equals(ae)||t.equals(oe)||t.equals(se)||t.equals(k)||t.equals(A))return c(`detectFileTypeFallback: Detected Mach-O binary`),`binary`}if(e.length>=2&&e.subarray(0,2).equals(j))return c(`detectFileTypeFallback: Detected PE binary`),`binary`;let t=Math.min(512,e.length),n=0,r=0;for(let i=0;i<t;i++){let t=e[i];(t>=32&&t<=126||t===9||t===10||t===13)&&n++,t===0&&r++}if(r>0)return c(`detectFileTypeFallback: Detected binary (${r} null bytes in first ${t} bytes)`),`binary`;let i=n/t;return i>.9?(c(`detectFileTypeFallback: Detected JavaScript via text heuristic (${Math.round(i*100)}% printable)`),`javascript`):(c(`detectFileTypeFallback: Unknown file type (${Math.round(i*100)}% printable)`),null)}async function N(e,t=4096){try{let n=await b.open(e,`r`);try{let e=Buffer.allocUnsafe(t),{bytesRead:r}=await n.read({buffer:e,position:0,length:t});return r<=0?null:e.subarray(0,r)}finally{await n.close()}}catch(e){return c(`Failed to read file prefix:`,e),null}}async function P(e){if(process.platform===`win32`)return e;let t=await ee(e);return t?(c(`maybeResolveNixWrapper: resolved Nix wrapper ${e} -> ${t}`),t):e}async function F(e){try{let t=await b.realpath(e);c(`resolvePathToInstallationType: ${e} -> ${t}`);let n=await N(t);if(!n)return c(`resolvePathToInstallationType: Could not read file prefix`),null;let r=await re();if(r&&typeof r.detect==`function`){let e=r.detect(n)||null;if(e){let n=e.toLowerCase();return c(`resolvePathToInstallationType: Detected mime type: ${n}`),n.includes(`javascript`)?{kind:`npm-based`,resolvedPath:t}:n.startsWith(`text/`)?(c(`resolvePathToInstallationType: Unrecognized file type`),null):{kind:`native-binary`,resolvedPath:await P(t)}}}c(`resolvePathToInstallationType: Using fallback file type detection`);let i=M(n);return i===`javascript`?{kind:`npm-based`,resolvedPath:t}:i===`binary`?{kind:`native-binary`,resolvedPath:await P(t)}:(c(`resolvePathToInstallationType: Fallback could not determine file type`),null)}catch(e){return c(`resolvePathToInstallationType: Error:`,e),null}}async function I(){c(`getClaudeFromPath: PATH = ${process.env.PATH}`),c(`getClaudeFromPath: PATHEXT = ${process.env.PATHEXT}`);try{let e=await w(`claude`);return c(`getClaudeFromPath: Found claude at ${e}`),e}catch{return c(`getClaudeFromPath: claude not found on PATH`),null}}function L(e){let t=/\bVERSION:"(\d+\.\d+\.\d+)"/g,n=new Map,r;for(;(r=t.exec(e))!==null;){let e=r[1];n.set(e,(n.get(e)||0)+1)}if(n.size===0)return null;let i=0,a;for(let[e,t]of n.entries())c(`Found version ${e} with ${t} occurrences`),t>i&&(i=t,a=e);return a&&c(`Extracted version ${a} (${i} occurrences)`),a||null}async function R(e){let t=L(await b.readFile(e,`utf8`));if(!t)throw Error(`No VERSION strings found in JS file: ${e}`);return t}async function z(e){let{data:t}=await u(e);if(!t)throw Error(`Could not extract JS from native binary: ${e}`);let n=L(t.toString(`utf8`));if(!n)throw Error(`No VERSION strings found in extracted JS from: ${e}`);return n}function B(e){let t=x.basename(e).match(/^(\d+\.\d+\.\d+)$/);return t?t[1]:null}async function V(e,t){let n=B(e);return n?(c(`extractVersion: Got version ${n} from filename`),n):t===`npm-based`?R(e):z(e)}async function H(){let e=[],t=new Set;for(let n of E){let r=x.join(n,`cli.js`);try{if(await i(r)){let n=await b.realpath(r).catch(()=>r);if(t.has(n))continue;t.add(n),c(`collectCandidates: Found cli.js at ${n}`);let i=await R(n);e.push({path:n,kind:`npm-based`,version:i})}}catch(e){c(`collectCandidates: Error checking ${r}:`,e)}}for(let n of ne)try{if(await i(n)){let r=await b.realpath(n).catch(()=>n);if(t.has(r))continue;t.add(r);let i=await P(r);c(`collectCandidates: Found native binary at ${r}${i===r?``:` (resolved -> ${i})`}`);let a=await V(i,`native-binary`);e.push({path:i,kind:`native-binary`,version:a})}}catch(e){c(`collectCandidates: Error checking ${n}:`,e)}return[...e].sort((e,t)=>r(e.version,t.version))}function U(e){return e.map(e=>` • ${e.path} (${e.kind}, v${e.version})`).join(`
|
|
3
3
|
`)}function W(e){return` 2. Set ccInstallationPath in your config file (${l}):
|
|
4
4
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{$ as e,A as t,B as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,L as u,M as d,N as f,P as p,Q as m,R as h,T as g,U as _,V as v,W as y,X as b,Y as x,Z as S,_ as C,a as w,b as ee,d as T,et as E,g as D,h as O,i as k,j as A,k as j,l as M,m as te,n as N,o as P,p as F,r as ne,s as re,t as ie,u as ae,v as oe,w as se,x as ce,y as I,z as L}from"./config-BGsQaczu.mjs";import{a as R,c as le,d as ue,l as de,n as fe,o as pe,s as z,t as me,u as he}from"./content-M0EgBl6Y.mjs";import{Box as B,Text as V,render as ge,useInput as H}from"ink";import{Command as _e}from"commander";import U from"chalk";import ve,{Fragment as ye,createContext as be,useCallback as xe,useContext as W,useEffect as G,useMemo as Se,useRef as Ce,useState as K}from"react";import*as we from"node:os";import Te from"ink-link";import*as Ee from"node:fs/promises";import De from"node:fs/promises";import*as Oe from"node:fs";import*as ke from"node:path";import{execSync as Ae,spawn as je}from"node:child_process";import Me from"gray-matter";import{structuredPatch as Ne}from"diff";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import Pe from"process";import Fe from"cli-spinners";import*as Ie from"node:readline";var X=({children:e,...t})=>Y(V,{bold:!0,backgroundColor:`#ffd500`,color:`#000`,...t,children:[` `,e,` `]});const Le=[`\x1B[?25l\x1B[0m \x1B[38;2;0;0;0m \x1B[38;2;252;130;0m▂\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▇\x1B[38;2;254;131;0m\x1B[48;2;252;130;0m▇\x1B[48;2;252;130;0m▇▇\x1B[48;2;252;130;0m▇\x1B[0m\x1B[38;2;252;130;0m▇\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▂ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;254;131;0m▗\x1B[38;2;254;131;0m▆\x1B[48;2;254;131;0m \x1B[38;2;254;132;0m╶ \x1B[0m\x1B[38;2;254;131;0m▆\x1B[38;2;254;131;0m▖ \x1B[0m`,` \x1B[7m\x1B[38;2;254;131;0m▘\x1B[0m\x1B[38;2;11;6;0m\x1B[48;2;254;131;0m \x1B[38;2;254;216;182m\x1B[48;2;254;136;12m▃\x1B[38;2;254;249;246m\x1B[48;2;254;143;29m▅\x1B[38;2;254;253;253m\x1B[48;2;254;143;40m▆\x1B[38;2;254;254;253m\x1B[48;2;254;152;68m▆▆▆\x1B[38;2;254;253;252m\x1B[48;2;254;141;34m▆\x1B[38;2;254;247;242m\x1B[48;2;254;140;24m▅\x1B[38;2;254;224;199m\x1B[48;2;254;140;20m▖\x1B[48;2;254;131;0m \x1B[0m\x1B[7m\x1B[38;2;254;131;0m▝\x1B[0m \x1B[0m`,`\x1B[7m\x1B[38;2;251;127;0m▌\x1B[0m\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[38;2;252;128;0m\x1B[48;2;254;131;0m▃\x1B[38;2;252;129;0m▂\x1B[38;2;253;130;0m▁\x1B[38;2;249;135;16m\x1B[48;2;253;226;202m▋\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┈\x1B[48;2;246;246;245m┈\x1B[38;2;47;47;47m\x1B[48;2;244;244;243m▂\x1B[38;2;112;112;112m\x1B[48;2;251;251;251m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m▁╌▝\x1B[38;2;254;254;253m\x1B[48;2;254;254;254m▋\x1B[38;2;254;254;254m\x1B[48;2;254;253;252m┈\x1B[38;2;252;209;168m\x1B[48;2;251;129;0m▍\x1B[38;2;253;129;0m\x1B[48;2;254;131;0m▂\x1B[38;2;252;128;0m▃\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[0m\x1B[38;2;251;127;0m▌\x1B[0m`,`\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▏\x1B[38;2;245;118;0m\x1B[48;2;248;122;0m▄\x1B[38;2;247;121;0m\x1B[48;2;247;122;0m┈\x1B[38;2;106;68;38m\x1B[48;2;245;123;2m▃\x1B[38;2;39;33;28m\x1B[48;2;211;109;6m▅\x1B[38;2;27;20;12m\x1B[48;2;237;237;237m▌\x1B[48;2;254;254;253m \x1B[38;2;90;90;89m\x1B[48;2;231;230;230m▝\x1B[38;2;215;215;214m\x1B[48;2;48;48;48m▁\x1B[38;2;203;203;202m\x1B[48;2;42;42;42m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┇╴\x1B[38;2;253;252;252m▂\x1B[38;2;251;250;250m\x1B[48;2;253;253;253m▃\x1B[38;2;249;249;248m\x1B[48;2;252;252;251m▄\x1B[38;2;249;248;248m\x1B[48;2;237;118;0m▍\x1B[38;2;246;121;0m\x1B[48;2;250;125;0m▄\x1B[38;2;246;119;0m\x1B[48;2;249;124;0m▄\x1B[38;2;245;118;0m\x1B[48;2;248;123;0m▄\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▉\x1B[0m`,`\x1B[38;2;238;108;0m\x1B[48;2;237;109;0m▏\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;233;109;2m\x1B[48;2;125;73;29m▇\x1B[38;2;225;104;1m\x1B[48;2;50;32;18m▄\x1B[38;2;62;29;2m\x1B[48;2;239;237;237m▌\x1B[38;2;254;253;253m\x1B[48;2;254;254;254m┻\x1B[38;2;254;254;253m▊\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;253;253;252m▂\x1B[38;2;251;251;251m\x1B[48;2;254;253;253m▃\x1B[38;2;249;249;249m\x1B[48;2;252;252;252m▄\x1B[38;2;247;247;247m\x1B[48;2;250;250;250m▄\x1B[38;2;245;245;244m\x1B[48;2;248;248;248m▄\x1B[38;2;243;243;242m\x1B[48;2;246;246;245m▄\x1B[38;2;243;242;242m\x1B[48;2;230;109;0m▍\x1B[38;2;239;111;0m\x1B[48;2;243;116;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;237;108;0m\x1B[48;2;238;108;0m▉\x1B[0m`,`\x1B[7m\x1B[38;2;231;98;0m▌\x1B[0m\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[38;2;231;99;0m\x1B[48;2;235;105;0m▄\x1B[38;2;232;100;0m\x1B[48;2;236;105;0m▄\x1B[38;2;232;101;0m\x1B[48;2;236;106;0m▄\x1B[38;2;223;99;0m\x1B[48;2;247;238;235m▌\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;252;252;251m▃\x1B[38;2;250;250;250m\x1B[48;2;253;253;252m▄\x1B[38;2;248;248;247m\x1B[48;2;251;251;250m▄\x1B[38;2;246;245;245m\x1B[48;2;249;248;248m▄\x1B[38;2;243;243;243m\x1B[48;2;246;246;246m▄\x1B[38;2;241;241;241m\x1B[48;2;244;244;244m▄\x1B[38;2;239;239;238m\x1B[48;2;242;242;242m▄\x1B[38;2;237;237;236m\x1B[48;2;240;240;239m▄\x1B[38;2;237;236;236m\x1B[48;2;223;99;0m▍\x1B[38;2;232;100;0m\x1B[48;2;236;106;0m▄\x1B[38;2;231;100;0m\x1B[48;2;235;105;0m▄\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[0m\x1B[38;2;231;98;0m▌\x1B[0m`,` \x1B[7m\x1B[38;2;224;89;0m▖\x1B[0m\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[38;2;225;90;0m\x1B[48;2;228;95;0m▄\x1B[38;2;225;91;0m\x1B[48;2;229;96;0m▄\x1B[38;2;217;90;1m\x1B[48;2;97;77;70m▌\x1B[38;2;70;70;70m\x1B[48;2;207;207;207m▆\x1B[38;2;66;65;65m\x1B[48;2;228;228;227m▄\x1B[38;2;66;66;66m\x1B[48;2;233;232;232m▂\x1B[38;2;169;169;169m\x1B[48;2;243;243;243m▁\x1B[38;2;240;239;239m\x1B[48;2;243;242;242m▄\x1B[38;2;238;237;237m\x1B[48;2;241;240;240m▄\x1B[38;2;235;235;235m\x1B[48;2;238;238;238m▄\x1B[38;2;233;233;233m\x1B[48;2;236;236;236m▄\x1B[38;2;231;231;230m\x1B[48;2;234;234;233m▄\x1B[38;2;231;230;230m\x1B[48;2;216;89;0m▍\x1B[38;2;225;90;0m\x1B[48;2;229;95;0m▄\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[0m\x1B[7m\x1B[38;2;224;89;0m▗\x1B[0m \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;217;80;0m▝\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m\x1B[48;2;221;86;0m▄\x1B[38;2;197;78;9m\x1B[48;2;66;66;65m▋\x1B[38;2;65;65;64m\x1B[48;2;60;60;60m▘\x1B[38;2;52;52;51m\x1B[48;2;56;56;56m▗\x1B[38;2;45;45;45m\x1B[48;2;50;50;49m▗\x1B[38;2;42;42;42m\x1B[48;2;46;46;46m┈\x1B[38;2;41;41;41m\x1B[48;2;203;202;202m▆\x1B[38;2;38;38;38m\x1B[48;2;218;218;218m▄\x1B[38;2;45;45;45m\x1B[48;2;221;221;221m▂\x1B[38;2;229;229;229m┊\x1B[38;2;225;225;225m\x1B[48;2;228;228;227m▄\x1B[38;2;225;224;224m\x1B[48;2;209;79;0m▍\x1B[0m\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m▘ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[7m\x1B[38;2;191;73;0m▆\x1B[38;2;191;73;0m▄\x1B[38;2;56;55;55m▃\x1B[38;2;46;46;46m▁\x1B[0m\x1B[38;2;20;20;20m\x1B[48;2;42;42;42m▁\x1B[38;2;36;36;36m\x1B[48;2;35;34;34m╴\x1B[38;2;23;23;23m\x1B[48;2;29;29;28m▁\x1B[38;2;10;10;10m\x1B[48;2;22;22;22m▁\x1B[0m\x1B[7m\x1B[38;2;15;15;15m▁\x1B[38;2;22;22;21m▃\x1B[38;2;154;154;154m▅\x1B[38;2;175;116;83m▇\x1B[0m\x1B[38;2;17;15;14m \x1B[0m`,`\x1B[?25h\x1B[0m`];var Re=()=>Y(B,{flexDirection:`row`,height:10,alignItems:`center`,borderStyle:`bold`,borderBottom:!1,borderTop:!1,borderRight:!1,borderColor:`#ff8400`,marginBottom:1,children:[Y(B,{marginBottom:1,paddingLeft:1,flexDirection:`column`,flexGrow:1,children:[J(V,{bold:!0,color:`#ff8400`,children:`Piebald is released!`}),J(V,{children:` `}),Y(V,{children:[`We've released `,J(V,{bold:!0,children:`Piebald`}),`, the ultimate agentic AI developer experience.`]}),Y(V,{children:[`Download it and try it out for free!`,` `,J(Te,{url:`https://piebald.ai/`,fallback:!1,children:J(V,{color:`#ff8400`,children:`https://piebald.ai/`})})]}),J(V,{children:` `}),J(V,{dimColor:!0,color:`gray`,children:`press 'h' to hide`})]}),J(B,{width:22,flexShrink:0,flexDirection:`column`,alignItems:`center`,children:Le.map((e,t)=>J(V,{children:e},t))})]});let Z=function(e){return e.THEMES=`Themes`,e.THINKING_VERBS=`Thinking verbs`,e.THINKING_STYLE=`Thinking style`,e.USER_MESSAGE_DISPLAY=`User message display`,e.INPUT_PATTERN_HIGHLIGHTERS=`Input pattern highlighters`,e.MISC=`Misc`,e.TOOLSETS=`Toolsets`,e.SUBAGENT_MODELS=`Subagent models`,e.CLAUDE_MD_ALT_NAMES=`CLAUDE.md alternative names`,e.SYSTEM_REMINDERS=`System reminders (injection lobotomy)`,e.SKILLS=`Skills (per-skill on/name-only/user-invocable/off)`,e.VIEW_SYSTEM_PROMPTS=`View system prompts`,e.RESTORE_ORIGINAL=`Restore original Claude Code (preserves config.json)`,e.OPEN_CONFIG=`Open config.json`,e.OPEN_CLI=`Open Claude Code's cli.js`,e.EXIT=`Exit`,e}({});function ze({items:e,selectedIndex:t,onSelect:n,onSubmit:r}){return H((i,a)=>{a.upArrow?n(t>0?t-1:e.length-1):a.downArrow?n(t<e.length-1?t+1:0):a.return&&r(e[t].name)}),J(B,{flexDirection:`column`,children:e.map((e,n)=>J(B,{children:Y(V,{children:[Y(V,{bold:n===t,color:n===t?`cyan`:void 0,...n===t?e.selectedStyles??{}:e.styles??{},children:[n===t?`❯ `:` `,e.name]}),e.desc&&n===t&&Y(V,{dimColor:!0,bold:!1,children:[` \x1B[0;2m`,`- `,e.desc]})]})},n))})}const Be=[{name:Z.THEMES,desc:`Modify Claude Code's built-in themes or create your own`},{name:Z.THINKING_VERBS,desc:`Customize the list of verbs that Claude Code uses when it's working`},{name:Z.THINKING_STYLE,desc:`Choose custom spinners`},{name:Z.USER_MESSAGE_DISPLAY,desc:`Customize how user messages are displayed`},{name:Z.INPUT_PATTERN_HIGHLIGHTERS,desc:`Create custom highlighters for patterns in your input`},{name:Z.MISC,desc:`Miscellaneous settings (input box border, etc.)`},{name:Z.TOOLSETS,desc:`Manage toolsets to control which tools are available`},{name:Z.SUBAGENT_MODELS,desc:`Configure which Claude model each subagent uses (Plan, Explore, etc.)`},{name:Z.CLAUDE_MD_ALT_NAMES,desc:`Configure alternative filenames for CLAUDE.md (e.g., AGENTS.md)`},{name:Z.SYSTEM_REMINDERS,desc:`Suppress per-turn <system-reminder> injections (skills list, MCP instructions, claudeMd wrapper, etc.)`},{name:Z.SKILLS,desc:`Per-skill listing control (writes settings.json skillOverrides — no patch needed)`},{name:Z.VIEW_SYSTEM_PROMPTS,desc:`Opens the system prompts directory where you can customize Claude Code's system prompts`}],Ve=[{name:Z.RESTORE_ORIGINAL,desc:`Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)`},{name:Z.OPEN_CONFIG,desc:`Opens your tweakcc config file (${ne})`},{name:Z.OPEN_CLI,desc:`Opens Claude Code's cli.js file`},{name:Z.EXIT,desc:`Bye!`}];var He=({onSubmit:e})=>{let t=[...Be,...Ve],[n,r]=K(0);return J(ze,{items:t,selectedIndex:n,onSelect:r,onSubmit:t=>e(t)})};const Ue=()=>Y(B,{flexDirection:`row`,children:[J(X,{children:`tweakcc`}),J(V,{children:` (by `}),J(Te,{url:`https://piebald.ai`,fallback:!1,children:J(V,{color:`#ff8400`,bold:!0,children:`Piebald`})}),J(V,{children:`)`})]}),We=()=>J(B,{children:Y(V,{color:`yellow`,children:[`⭐ `,J(V,{bold:!0,children:`Star the repo at `}),J(Te,{url:`https://github.com/skrabe/tweakcc-fixed`,fallback:!1,children:J(V,{bold:!0,color:`cyan`,children:`https://github.com/skrabe/tweakcc-fixed`})}),J(V,{bold:!0,children:` if you find this useful!`}),` ⭐`]})}),Ge=({notification:e})=>J(B,{borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:`bold`,borderColor:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,paddingLeft:1,flexDirection:`column`,children:J(V,{color:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,children:e.message})}),Ke=({onSubmit:e,notification:t,configMigrated:n,showPiebaldAnnouncement:r,changesApplied:i,invocationCommand:a})=>Y(B,{flexDirection:`column`,gap:1,children:[n&&J(B,{children:J(V,{color:`blue`,bold:!0,children:"Note that in tweakcc v3.2.0+, `ccInstallationDir` config is deprecated. You are now migrated to `ccInstallationPath` which supports npm and native installs."})}),J(Ue,{}),J(B,{children:Y(V,{children:[J(V,{bold:!0,children:`Customize your Claude Code installation.`}),` `,Y(V,{dimColor:!0,children:[`Settings will be saved to `,N.replace(we.homedir(),`~`),`/config.json.`]})]})}),J(r?Re:We,{}),t&&J(Ge,{notification:t}),!i&&!t&&J(Ge,{notification:{message:`Your changes are configured but not applied.\nRun \`${a} --apply\` to apply your customizations!`,type:`info`}}),J(He,{onSubmit:e})]});function Q({color:e,backgroundColor:t,bold:n,dimColor:r,children:i}){let a=e?.startsWith(`ansi:`),o=t?.startsWith(`ansi:`);if(a||o){if(ve.Children.toArray(i).some(e=>ve.isValidElement(e)))return J(V,{children:i});let s=U;if(a){let t=e.slice(5);s=s[t]||s}if(o){let e=t.slice(5),n=e.startsWith(`bg`)?e:`bg${e.charAt(0).toUpperCase()}${e.slice(1)}`;s=s[n]||s}n&&(s=s.bold),r&&(s=s.dim);let c=ve.Children.toArray(i).map(e=>typeof e==`string`||typeof e==`number`?String(e):``).join(``);return J(V,{children:s(c)})}return J(V,{color:e,backgroundColor:t,bold:n,dimColor:r,children:i})}function qe({text:e,nonShimmerColors:t,shimmerColors:n,shimmerWidth:r=3,updateDuration:i=50,restartPoint:a=10}){let[o,s]=K(0);return G(()=>{let t=setInterval(()=>{s(t=>{let n=t+1;return n>=e.length+a?-r:n})},i);return()=>clearInterval(t)},[e.length,a,i]),t.length===n.length?J(V,{children:e.split(``).map((i,a)=>{let s=a>=o&&a<o+r&&o<e.length,c=a%t.length;return J(V,{color:s?n[c]:t[c],children:i},a)})}):(console.error(`UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length`),J(V,{children:e}))}const Je=Pe.cwd();function Ye({theme:e}){let{ccVersion:t}=W($);return Y(B,{flexDirection:`column`,paddingLeft:1,children:[J(B,{marginBottom:1,children:Y(V,{bold:!0,children:[`Preview: `,e.name]})}),J(B,{borderStyle:`single`,borderColor:`gray`,paddingX:1,children:Y(B,{flexDirection:`column`,children:[Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:` ▐`}),J(V,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`▛███▜`}),Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:`▌ `}),` `,J(V,{bold:!0,children:`Claude Code`}),` `,t?`v${t}`:`v2.0.14`]})]}),Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:`▝▜`}),J(V,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`█████`}),J(Q,{color:e.colors.clawd_body,children:`▛▘`}),` `,ce(),` · `,I()]}),Y(Q,{color:e.colors.clawd_body,children:[` `,`▘▘ ▝▝`,` `,Je]}),Y(V,{children:[Y(Q,{color:e.colors.success,children:[`Login successful. Press`,` `]}),J(Q,{bold:!0,color:e.colors.success,children:`Enter`}),Y(Q,{color:e.colors.success,children:[` `,`to continue…`]})]})]}),J(V,{children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[`│ 1 function greet() `,`{`,` `,`│`]}),Y(V,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:`- console.log("`}),J(Q,{backgroundColor:e.colors.diffRemovedWord,children:`Hello, World!`}),J(Q,{backgroundColor:e.colors.diffRemoved,children:`");`}),` `,`│`]}),Y(V,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:`+ console.log("`}),J(Q,{backgroundColor:e.colors.diffAddedWord,children:`Hello, Claude!`}),J(Q,{backgroundColor:e.colors.diffAdded,children:`");`}),` `,`│`]}),J(Q,{color:e.colors.warning,children:`╭─────────────────────────────────────────────╮`}),Y(Q,{color:e.colors.warning,children:[`│ Do you trust the files in this folder?`,` `,`│`]}),Y(V,{children:[J(Q,{color:e.colors.warning,children:`│ `}),J(V,{dimColor:!0,children:`Enter to confirm · Esc to exit`}),Y(Q,{color:e.colors.warning,children:[` `,`│`]})]}),J(Q,{color:e.colors.bashBorder,children:`───────────────────────────────────────────────`}),Y(V,{children:[J(Q,{color:e.colors.bashBorder,children:`!`}),J(V,{children:` ls`})]}),J(Q,{color:e.colors.promptBorder,children:`───────────────────────────────────────────────`}),J(V,{children:Y(V,{children:[`> list the dir`,` `,J(qe,{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})]})}),J(Q,{color:e.colors.planMode,children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[J(Q,{color:e.colors.planMode,children:`│ `}),Y(Q,{color:e.colors.permission,children:[`Ready to code?`,` `]}),J(V,{children:`Here is Claude's plan:`}),Y(Q,{color:e.colors.planMode,children:[` `,`│`]})]}),J(Q,{color:e.colors.permission,children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[J(Q,{color:e.colors.permission,children:`│ `}),J(V,{bold:!0,children:`Permissions:`}),` `,Y(Q,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[` `,`Allow`,` `]}),` `,`Deny`,` `,`Workspace`,` `,J(Q,{color:e.colors.permission,children:`│`})]}),J(V,{children:`> list the dir`}),Y(V,{children:[J(Q,{color:e.colors.error,children:`●`}),J(V,{children:` Update(__init__.py)`})]}),Y(V,{children:[J(V,{children:` ⎿ `}),J(Q,{color:e.colors.error,children:`User rejected update to __init__.py`})]}),Y(V,{children:[` `,`1`,` `,Y(Q,{backgroundColor:e.colors.diffRemovedDimmed,children:[`- import`,` `]}),J(Q,{backgroundColor:e.colors.diffRemovedWordDimmed,children:`os`})]}),Y(V,{children:[` `,`2`,` `,Y(Q,{backgroundColor:e.colors.diffAddedDimmed,children:[`+ import`,` `]}),J(Q,{backgroundColor:e.colors.diffAddedWordDimmed,children:`random`})]}),Y(V,{children:[J(Q,{color:e.colors.success,children:`●`}),J(V,{children:` List(.)`})]}),Y(V,{children:[J(V,{children:`●`}),J(V,{children:` The directory `}),J(Q,{color:e.colors.permission,children:`C:\\Users\\user`}),Y(V,{children:[` `,`contains `,J(V,{bold:!0,children:`123`}),` files.`]})]}),Y(V,{children:[J(Q,{color:e.colors.claude,children:`✻ Th`}),J(Q,{color:e.colors.claudeShimmer,children:`ink`}),J(Q,{color:e.colors.claude,children:`ing… `}),J(V,{children:`(esc to interrupt)`})]}),J(V,{children:J(Q,{color:e.colors.autoAccept,children:`⏵⏵ accept edits on (shift+tab to cycle)`})}),J(V,{children:J(Q,{color:e.colors.planMode,children:`⏸ plan mode on (shift+tab to cycle)`})}),J(V,{children:J(Q,{color:e.colors.ide,children:`◯ IDE connected ⧉ 44 lines selected`})})]})})]})}function Xe({colorKey:e,theme:t,bold:n=!1}){let r=t.colors[e];return e===`inverseText`?J(Q,{color:r,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith(`diff`)?J(Q,{backgroundColor:r,bold:n,color:t.colors.text,children:e}):J(Q,{color:r,bold:n,children:e})}function Ze({initialValue:e,onColorChange:t,onExit:n,colorKey:r,theme:a}){let o=$e(e)||{h:0,s:50,l:50},s=Qe(e)||{r:128,g:128,b:128},[c,l]=K(o),[u,d]=K(s),[f,p]=K(`hsl`),[m,h]=K(`h`),[_,v]=K(!1),[y,b]=K(!1);G(()=>{let t=$e(e),n=Qe(e);t&&n&&(v(!0),l(t),d(n),v(!1))},[e]),G(()=>{!_&&y&&t(`rgb(${u.r},${u.g},${u.b})`)},[c,u,_,y]),G(()=>{b(!0)},[]);let x=e=>{if(g(e)){let t=i(e),n=$e(t),r=Qe(t);n&&r&&(v(!0),l(n),d(r),v(!1))}};H((e,t)=>{if(e.length>1&&!t.ctrl&&!t.meta){x(e);return}t.return||t.escape?n():t.ctrl&&e===`a`?(p(e=>e===`hsl`?`rgb`:`hsl`),h(e=>f===`hsl`?e===`h`?`r`:e===`s`?`g`:`b`:e===`r`?`h`:e===`g`?`s`:`l`)):t.upArrow?h(f===`hsl`?e=>e===`h`?`l`:e===`s`?`h`:`s`:e=>e===`r`?`b`:e===`g`?`r`:`g`):t.downArrow||t.tab?h(f===`hsl`?e=>e===`h`?`s`:e===`s`?`l`:`h`:e=>e===`r`?`g`:e===`g`?`b`:`r`):t.leftArrow?S(t.shift||t.ctrl||t.meta?-10:-1):t.rightArrow&&S(t.shift||t.ctrl||t.meta?10:1)});let S=e=>{v(!0),f===`hsl`?l(t=>{let n={...t};m===`h`?n.h=Math.max(0,Math.min(359,t.h+e)):m===`s`?n.s=Math.max(0,Math.min(100,t.s+e)):m===`l`&&(n.l=Math.max(0,Math.min(100,t.l+e)));let[r,i,a]=w(n.h,n.s,n.l);return d({r,g:i,b:a}),n}):d(t=>{let n={...t};return m===`r`?n.r=Math.max(0,Math.min(255,t.r+e)):m===`g`?n.g=Math.max(0,Math.min(255,t.g+e)):m===`b`&&(n.b=Math.max(0,Math.min(255,t.b+e))),l(C(n.r,n.g,n.b)),n}),v(!1)},C=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===r?((i-a)/c+(i<a?6:0))/6:o===i?((a-r)/c+2)/6:((r-i)/c+4)/6),{h:Math.round(d*360),s:Math.round(u*100),l:Math.round(l*100)}},w=(e,t,n)=>{e/=360,t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e*6%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<1/6?(o=r,s=i,c=0):1/6<=e&&e<2/6?(o=i,s=r,c=0):2/6<=e&&e<3/6?(o=0,s=r,c=i):3/6<=e&&e<4/6?(o=0,s=i,c=r):4/6<=e&&e<5/6?(o=i,s=0,c=r):5/6<=e&&e<1&&(o=r,s=0,c=i),[Math.round((o+a)*255),Math.round((s+a)*255),Math.round((c+a)*255)]},ee=()=>{let e=[],t=[[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 n=0;n<40;n++){let r=n/39*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=r-i,[s,c,l]=t[i],[u,d,f]=t[a],p=Math.round(s+(u-s)*o),m=Math.round(c+(d-c)*o),h=Math.round(l+(f-l)*o);e.push(J(V,{backgroundColor:`rgb(${p},${m},${h})`,children:` `},n))}return e},T=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=w(c.h,n,c.l);e.push(J(V,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},E=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=w(c.h,c.s,n);e.push(J(V,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},D=()=>{let[e,t,n]=w(c.h,c.s,c.l);return`rgb(${e},${t},${n})`},O=(e,t,n)=>{let r=e=>e.toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},k=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${n},${u.g},${u.b})`,children:` `},t))}return e},A=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${u.r},${n},${u.b})`,children:` `},t))}return e},j=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${u.r},${u.g},${n})`,children:` `},t))}return e},M=(e,t)=>Math.round(e/t*39);return Y(B,{flexDirection:`column`,borderStyle:`single`,borderColor:`white`,padding:1,children:[Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Color Picker`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{color:`gray`,dimColor:!0,children:`←→ to adjust (shift/ctrl/cmd +10)`}),J(V,{color:`gray`,dimColor:!0,children:`↑↓ to change bar`}),J(V,{color:`gray`,dimColor:!0,children:`ctrl+a to switch rgb/hsl`}),J(V,{color:`gray`,dimColor:!0,children:`paste color from clipboard`}),J(V,{color:`gray`,dimColor:!0,children:`enter to exit (auto-saved)`}),J(V,{color:`gray`,dimColor:!0,children:`esc to save and exit`})]})]}),f===`hsl`?Y(q,{children:[Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`h`?`yellow`:`white`,children:[m===`h`?`❯ `:` `,`Hue (`,c.h,`°):`]})}),J(B,{children:ee().map((e,t)=>J(ye,{children:t===M(c.h,360)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`s`?`yellow`:`white`,children:[m===`s`?`❯ `:` `,`Saturation (`,c.s,`%):`]})}),J(B,{children:T().map((e,t)=>J(ye,{children:t===M(c.s,100)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`l`?`yellow`:`white`,children:[m===`l`?`❯ `:` `,`Lightness (`,c.l,`%):`]})}),J(B,{children:E().map((e,t)=>J(ye,{children:t===M(c.l,100)?J(V,{children:`|`}):e},t))})]})]}):Y(q,{children:[Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`r`?`yellow`:`white`,children:[m===`r`?`❯ `:` `,`Red (`,u.r,`):`]})}),J(B,{children:k().map((e,t)=>J(ye,{children:t===M(u.r,255)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`g`?`yellow`:`white`,children:[m===`g`?`❯ `:` `,`Green (`,u.g,`):`]})}),J(B,{children:A().map((e,t)=>J(ye,{children:t===M(u.g,255)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`b`?`yellow`:`white`,children:[m===`b`?`❯ `:` `,`Blue (`,u.b,`):`]})}),J(B,{children:j().map((e,t)=>J(ye,{children:t===M(u.b,255)?J(V,{children:`|`}):e},t))})]})]}),Y(B,{marginBottom:1,children:[J(V,{children:`Current: `}),J(V,{backgroundColor:D(),children:` `})]}),Y(B,{flexDirection:`row`,justifyContent:`space-between`,children:[Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`Hex `}),r?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:a?.colors?.text||`white`,bold:!0,children:O(u.r,u.g,u.b)}):r===`inverseText`?J(V,{color:D(),backgroundColor:a?.colors?.permission,bold:!0,children:O(u.r,u.g,u.b)}):J(V,{color:D(),bold:!0,children:O(u.r,u.g,u.b)})]}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`RGB `}),r?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:a?.colors?.text||`white`,bold:!0,children:`rgb(${u.r}, ${u.g}, ${u.b})`}):r===`inverseText`?J(V,{color:D(),backgroundColor:a?.colors?.permission,bold:!0,children:`rgb(${u.r}, ${u.g}, ${u.b})`}):J(V,{color:D(),bold:!0,children:`rgb(${u.r}, ${u.g}, ${u.b})`})]}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`HSL `}),r?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:a?.colors?.text||`white`,bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):r===`inverseText`?J(V,{color:D(),backgroundColor:a?.colors?.permission,bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):J(V,{color:D(),bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`})]})]})]})}function Qe(e){let t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};let n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){let e=n[1];return{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16)}}return null}function $e(e){let t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){let e=parseInt(n[1])/255,t=parseInt(n[2])/255,r=parseInt(n[3])/255,i=Math.max(e,t,r),a=Math.min(e,t,r),o=i-a,s=(i+a)/2,c=0;o!==0&&(c=s>.5?o/(2-i-a):o/(i+a));let l=0;return o!==0&&(l=i===e?((t-r)/o+(t<r?6:0))/6:i===t?((r-e)/o+2)/6:((e-t)/o+4)/6),{h:Math.round(l*360),s:Math.round(c*100),l:Math.round(s*100)}}let r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){let e=r[1],t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,i=parseInt(e.substr(4,2),16)/255,a=Math.max(t,n,i),o=Math.min(t,n,i),s=a-o,c=(a+o)/2,l=0;s!==0&&(l=c>.5?s/(2-a-o):s/(a+o));let u=0;return s!==0&&(u=a===t?((n-i)/s+(n<i?6:0))/6:a===n?((i-t)/s+2)/6:((t-n)/s+4)/6),{h:Math.round(u*360),s:Math.round(l*100),l:Math.round(c*100)}}return{h:0,s:50,l:50}}function et({onBack:e,themeId:n}){let{settings:{themes:r},updateSettings:a}=W($),[o,s]=K(n),c=r.find(e=>e.id===o)||r[0],[l,u]=K(`rgb`),[d,f]=K(0),[p,m]=K(null),[h,_]=K(null),[v,y]=K(``),[b,x]=K(``),[S,C]=K(!1),[w,ee]=K(0),T=xe(e=>{a(t=>{let n=t.themes.findIndex(e=>e.id===o);n!==-1&&e(t.themes[n])})},[o,a]),E=e=>{if(d>=2&&g(e)){let t=i(e),n=D[d-2];T(e=>{e.colors[n]=t})}};H((t,n)=>{if(S){if(n.escape){C(!1),e();return}return}if(p===null&&h===null){if(t.length>1&&!n.ctrl&&!n.meta){E(t);return}if(n.escape)C(!0),ee(0);else if(n.ctrl&&t===`a`)u(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(n.upArrow)f(e=>Math.max(0,e-1));else if(n.downArrow)f(e=>Math.min(D.length+1,e+1));else if(n.return)if(d===0)_(`name`),y(c.name),x(c.name);else if(d===1)_(`id`),y(c.id),x(c.id);else{let e=d-2,t=D[e],n=c.colors[t];m(e),y(n),x(n)}}else if(p!==null)n.ctrl&&t===`a`&&u(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(h!==null)if(n.return){if(h===`id`){let e=o;s(v),a(t=>{let n=t.themes.findIndex(t=>t.id===e);n!==-1&&(t.themes[n].id=v)})}else T(e=>{e.name=v});_(null),y(``),x(``)}else n.escape?(_(null),y(``),x(``)):n.backspace||n.delete?y(e=>e.slice(0,-1)):t&&y(e=>e+t)});let D=Object.keys(c.colors),O=(e,t)=>{let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!n)return e;let r=parseInt(n[1]),i=parseInt(n[2]),a=parseInt(n[3]);switch(t){case`hex`:{let e=e=>e.toString(16).padStart(2,`0`);return`#${e(r)}${e(i)}${e(a)}`}case`hsl`:{let e=r/255,t=i/255,n=a/255,o=Math.max(e,t,n),s=Math.min(e,t,n),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===e?((t-n)/c+(t<n?6:0))/6:o===t?((n-e)/c+2)/6:((e-t)/c+4)/6),`hsl(${Math.round(d*360)}, ${Math.round(u*100)}%, ${Math.round(l*100)}%)`}case`rgb`:default:return e}},k=e=>({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`})[e]||``,A=Math.max(...D.map(e=>e.length));return Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(X,{children:[`Editing theme “`,c.name,`” (`,c.id,`)`]})}),S?Y(B,{flexDirection:`column`,marginTop:1,children:[J(B,{marginBottom:1,children:Y(V,{bold:!0,children:[`Would you like to make “`,c.name,`” your current Claude Code theme?`]})}),J(ze,{items:[{name:`Yes`,desc:`Set ${c.id} as active theme`},{name:`No`,desc:`Go back without changing theme`}],selectedIndex:w,onSelect:ee,onSubmit:()=>{w===0&&t(c.id),C(!1),e()}}),J(V,{dimColor:!0,children:`enter to select, esc to cancel`})]}):p===null&&h===null?Y(q,{children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`enter to edit theme name, id, or color`}),J(V,{dimColor:!0,children:`ctrl+a to toggle rgb, hex, hsl`}),J(V,{dimColor:!0,children:`paste color from clipboard (when on color)`}),J(V,{dimColor:!0,children:`esc to go back`})]}),d<2?Y(B,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:`yellow`,flexDirection:`column`,paddingLeft:1,children:[J(V,{bold:!0,children:d===0?`Theme Name`:`Theme ID`}),J(V,{children:d===0?`The display name for this theme`:"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):Y(B,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:c.colors[D[d-2]],flexDirection:`column`,paddingLeft:1,children:[J(Xe,{colorKey:D[d-2],theme:c,bold:!0}),J(V,{children:k(D[d-2])})]}),Y(B,{flexDirection:`column`,children:[Y(B,{children:[J(V,{color:d===0?`yellow`:`white`,children:d===0?`❯ `:` `}),J(V,{bold:!0,children:`Name: `}),J(V,{children:c.name})]}),Y(B,{marginBottom:1,children:[J(V,{color:d===1?`yellow`:`white`,children:d===1?`❯ `:` `}),J(V,{bold:!0,children:`ID: `}),J(V,{children:c.id})]}),(()=>{if(d<2)return Y(q,{children:[D.slice(0,20).map((e,t)=>{let n=t+2;return Y(B,{children:[J(V,{color:d===n?`yellow`:`white`,children:d===n?`❯ `:` `}),J(B,{width:A+2,children:J(V,{children:J(Xe,{colorKey:e,theme:c,bold:!0})})}),J(Q,{color:c.colors[e],children:O(c.colors[e],l)})]},e)}),D.length>20&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,D.length-20,` more below`]})]});let e=d-2,t=Math.max(0,e-10),n=Math.min(D.length,t+20),r=Math.max(0,n-20),i=D.slice(r,n);return Y(q,{children:[r>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t+2;return Y(B,{children:[J(V,{color:d===n?`yellow`:`white`,children:d===n?`❯ `:` `}),J(B,{width:A+2,children:J(V,{children:J(Xe,{colorKey:e,theme:c,bold:!0})})}),J(Q,{color:c.colors[e],children:O(c.colors[e],l)})]},e)}),n<D.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,D.length-n,` more below`]})]})})()]})]}):h?Y(B,{flexDirection:`column`,marginTop:1,children:[Y(V,{children:[`Editing `,h===`name`?`theme name`:`theme ID`,`:`]}),J(B,{borderStyle:`round`,borderColor:`yellow`,paddingX:1,children:J(V,{children:v})}),J(V,{dimColor:!0,children:`enter to save, esc to cancel`})]}):J(Ze,{initialValue:b,colorKey:D[p],theme:c,onColorChange:e=>{y(e),T(t=>{t.colors[D[p]]=e})},onExit:()=>{T(e=>{e.colors[D[p]]=v}),m(null),y(``),x(``)}})]}),J(B,{width:`50%`,children:J(Ye,{theme:c})})]})}const tt=`https://raw.githubusercontent.com/Piebald-AI/claude-code-themes/main`,nt=`${tt}/index.json`;async function rt(){F(`Fetching community theme index from ${nt}`);let e=await fetch(nt,{headers:{Accept:`application/json`}});if(!e.ok)throw Error(`Failed to fetch community theme index: ${e.status} ${e.statusText}`);return await e.json()}async function it(e){let t=`${tt}/themes/${e}.json`;F(`Fetching community theme from ${t}`);let n=await fetch(t,{headers:{Accept:`application/json`}});if(!n.ok)throw Error(`Failed to fetch community theme "${e}": ${n.status} ${n.statusText}`);return await n.json()}function at({onBack:e}){let{updateSettings:t}=W($),[n,r]=K({status:`loading`}),[i,a]=K(0),[o,s]=K(null),[c,l]=K(!1),[u,d]=K(null),f=Ce(0);G(()=>{rt().then(e=>{r({status:`loaded`,entries:e})}).catch(e=>{r({status:`error`,message:e.message})})},[]);let p=n.status===`loaded`?n.entries:[],m=xe(async e=>{let t=++f.current;l(!0),d(null);try{let n=await it(e);if(t!==f.current)return;s(te(n,E))}catch{if(t!==f.current)return;s(null),d(`Failed to load preview.`)}finally{t===f.current&&l(!1)}},[]),h=xe(async e=>{d(`Downloading theme…`);try{let n=te(await it(e.id),E),r=!1;t(e=>{e.themes.some(e=>e.id===n.id)||(e.themes.push(n),r=!0)}),d(r?`Added "${n.name}" to your themes!`:`Theme "${n.name}" (${n.id}) is already in your config.`)}catch{d(`Failed to download theme.`)}},[t]);return H((t,r)=>{if(r.escape){e();return}if(n.status!==`loaded`)return;let o=n.entries.length;if(o!==0){if(r.upArrow)a(e=>Math.max(0,e-1)),s(null),d(null);else if(r.downArrow)a(e=>Math.min(o-1,e+1)),s(null),d(null);else if(t===` `){let e=n.entries[i];e&&m(e.id)}else if(r.return){let e=n.entries[i];e&&h(e)}}}),n.status===`loading`?Y(B,{flexDirection:`column`,children:[J(X,{children:`Community Themes`}),J(V,{children:`Loading community themes…`})]}):n.status===`error`?Y(B,{flexDirection:`column`,children:[J(X,{children:`Community Themes`}),Y(V,{color:`red`,children:[`Error: `,n.message]}),J(V,{dimColor:!0,children:`esc to go back`})]}):Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(X,{children:`Community Themes`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`space to preview theme`}),J(V,{dimColor:!0,children:`enter to download theme`}),J(V,{dimColor:!0,children:`esc to go back`})]}),J(B,{flexDirection:`column`,children:p.map((e,t)=>Y(V,{color:i===t?`yellow`:void 0,children:[i===t?`❯ `:` `,e.name,` (`,e.id,`) by @`,e.author]},e.id))}),u&&J(B,{marginTop:1,children:J(V,{color:`cyan`,children:u})}),c&&J(B,{marginTop:1,children:J(V,{dimColor:!0,children:`Loading preview…`})})]}),J(B,{width:`50%`,children:o?J(Ye,{theme:o}):J(B,{flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:10,children:J(V,{dimColor:!0,children:`Press space to preview the selected theme.`})})})]})}function ot(e){return e.map(e=>`${e.name} (${e.id})`)}function st({onBack:t}){let{settings:{themes:n},updateSettings:r}=W($),[i,a]=K(0),[o,s]=K(null),[c,l]=K(!0),[u,d]=K(!1),f=n.length+1,p=()=>{let t={colors:{...(n[0]||e.themes[0]).colors},name:`New Custom Theme`,id:`custom-${Date.now()}`};r(e=>{e.themes.push(t)}),s(t.id),l(!1)},m=e=>{n.length<=1||(r(t=>{t.themes=t.themes.filter(t=>t.id!==e)}),i>=n.length-1&&a(Math.max(0,n.length-2)))},h=()=>{r(t=>{t.themes=[...e.themes]}),a(0)},g=i===n.length;if(H((e,r)=>{if(r.escape)t();else if(r.upArrow)a(e=>Math.max(0,e-1));else if(r.downArrow)a(e=>Math.min(f-1,e+1));else if(r.return)if(g)d(!0),l(!1);else{let e=n[i];e&&(s(e.id),l(!1))}else if(e===`n`)p();else if(e===`d`){if(!g){let e=n[i];e&&m(e.id)}}else r.ctrl&&e===`r`&&h()},{isActive:c}),u)return J(at,{onBack:()=>{d(!1),l(!0)}});if(o)return J(et,{themeId:o,onBack:()=>{s(null),l(!0)}});let _=ot(n),v=n.find(e=>_[i]?.includes(`(${e.id})`))||n[0];return n.length===0?J(B,{children:Y(B,{flexDirection:`column`,width:`100%`,children:[J(X,{children:`Themes`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new theme`}),J(V,{dimColor:!0,children:`esc to go back`})]}),J(V,{children:`No themes available!`})]})}):Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(X,{children:`Themes`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new theme`}),J(V,{dimColor:!0,children:`d to delete a theme`}),J(V,{dimColor:!0,children:`ctrl+r to delete all themes and restore built-in`}),J(V,{dimColor:!0,children:`enter to edit theme`}),J(V,{dimColor:!0,children:`esc to go back`})]}),Y(B,{flexDirection:`column`,children:[_.map((e,t)=>Y(V,{color:i===t?`yellow`:void 0,children:[i===t?`❯ `:` `,e]},t)),Y(V,{color:g?`blue`:void 0,bold:g,children:[g?`❯ `:` `,`Browse community themes…`]})]})]}),J(B,{width:`50%`,children:g?J(B,{flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:10,children:J(V,{dimColor:!0,children:`Press enter to browse community themes.`})}):J(Ye,{theme:v})})]})}function ct({onBack:t}){let{settings:{thinkingVerbs:{format:n,verbs:r},themes:i},updateSettings:a}=W($),o=[`format`,`verbs`],[s,c]=K(0),l=o[s],[u,d]=K(0),[f,p]=K(!1),[m,h]=K(``),[g,_]=K(!1),[v,y]=K(!1),[b,x]=K(n),S=ee(),C=(i.find(e=>e.id===S)||i.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;return H((i,s)=>{if(v){s.return?(a(e=>{e.thinkingVerbs.format=b}),y(!1)):s.escape?(x(n),y(!1)):s.backspace||s.delete?x(e=>e.slice(0,-1)):i&&x(e=>e+i);return}if(f||g){s.return&&m.trim()?(g?(a(e=>{e.thinkingVerbs.verbs.push(m.trim())}),_(!1)):(a(e=>{e.thinkingVerbs.verbs[u]=m.trim()}),p(!1)),h(``)):s.escape?(h(``),p(!1),_(!1)):s.backspace||s.delete?h(e=>e.slice(0,-1)):i&&h(e=>e+i);return}s.escape?t():s.return?l===`format`&&(x(n),y(!0)):s.tab?s.shift?c(e=>e===0?o.length-1:e-1):c(e=>e===o.length-1?0:e+1):s.upArrow?l===`verbs`&&r.length>0&&d(e=>e>0?e-1:r.length-1):s.downArrow?l===`verbs`&&r.length>0&&d(e=>e<r.length-1?e+1:0):i===`e`&&l===`verbs`?r.length>0&&(h(r[u]),p(!0)):i===`d`&&l===`verbs`?r.length>1&&(a(e=>{e.thinkingVerbs.verbs=e.thinkingVerbs.verbs.filter((e,t)=>t!==u)}),u>=r.length-1&&d(Math.max(0,r.length-2))):i===`n`&&l===`verbs`?(_(!0),h(``)):s.ctrl&&i===`r`&&l===`verbs`&&(a(t=>{t.thinkingVerbs.verbs=[...e.thinkingVerbs.verbs]}),d(0))}),Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`Thinking Verbs`}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:l===`format`?`enter to edit format`:`changes auto-saved`}),J(V,{dimColor:!0,children:`esc to go back`}),J(V,{dimColor:!0,children:`tab to switch sections`})]})]}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Customize the verbs shown during generation and their format.`})}),Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:l===`format`?`yellow`:void 0,children:l===`format`?`❯ `:` `}),J(V,{bold:!0,color:l===`format`?`yellow`:void 0,children:`Format`})]}),l===`format`&&(v?Y(V,{dimColor:!0,children:[` `,`enter to save`]}):Y(V,{dimColor:!0,children:[` `,`enter to edit`]}))]}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:v?`yellow`:`gray`,children:J(V,{children:v?b:n})})}),J(B,{children:Y(V,{children:[J(V,{color:l===`verbs`?`yellow`:void 0,children:l===`verbs`?`❯ `:` `}),J(V,{bold:!0,color:l===`verbs`?`yellow`:void 0,children:`Verbs`})]})}),l===`verbs`&&J(B,{flexDirection:`column`,children:Y(V,{dimColor:!0,children:[` `,`e to edit · d to delete · n to add new · ctrl+r to reset`]})}),J(B,{marginLeft:2,marginBottom:1,children:Y(B,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,u-4),t=Math.min(r.length,e+8),n=Math.max(0,t-8),i=r.slice(n,t);return Y(q,{children:[n>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,n,` more above`]}),i.map((e,t)=>{let r=n+t;return Y(V,{color:l===`verbs`&&r===u?`cyan`:void 0,children:[l===`verbs`&&r===u?`❯ `:` `,e]},r)}),t<r.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,r.length-t,` more below`]})]})})(),g&&Y(B,{alignItems:`center`,children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:m})})]}),f&&Y(B,{marginTop:1,alignItems:`center`,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:m})})]})]})})]}),Y(B,{width:`50%`,flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Preview`})}),J(B,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:Y(V,{children:[Y(V,{color:C,children:[`✻ `,n.replace(/\{\}/g,r[u]),` `]}),J(V,{children:`(esc to interrupt)`})]})})]})]})}const lt=e=>e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).replace(/(\d+)/g,` $1 `).replace(/\s+/g,` `).trim().replace(/^./,e=>e.toUpperCase()),ut=e=>{let t=Math.max(...e.map(e=>e.length));return e.map(e=>e.padEnd(t))},dt=Object.entries(Fe).map(([e,t])=>({name:lt(e),phases:t.frames.map(e=>e.trimEnd()),reverseMirror:!1,updateInterval:t.interval})),ft=[{name:`Default`,phases:e.thinkingStyle.phases,reverseMirror:e.thinkingStyle.reverseMirror},{name:`Wave`,phases:[`▁`,`▃`,`▄`,`▅`,`▆`,`▇`,`█`],reverseMirror:!0},{name:`Glow`,phases:[`░`,`▒`,`▓`,`█`],reverseMirror:!0},{name:`Partial block`,phases:[`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`,`█`],reverseMirror:!0},{name:`Colors`,phases:[`🔴`,`🟠`,`🟡`,`🟢`,`🔵`,`🟣`],reverseMirror:!1},...dt];function pt({onBack:t}){let{settings:{thinkingStyle:{phases:n,updateInterval:r,reverseMirror:i},themes:a},updateSettings:o}=W($),s=[`reverseMirror`,`updateInterval`,`phases`,`presets`],[c,l]=K(0),u=s[c],[d,f]=K(0),[p,m]=K(0),[h,g]=K(!1),[_,v]=K(``),[y,b]=K(!1),[x,S]=K(!1),[C,w]=K(r.toString()),[T,E]=K(0),D=ee(),O=(a.find(e=>e.id===D)||a.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;G(()=>{if(n.length>0){let e=i?[...n,...[...n].reverse().slice(1,-1)]:n,t=setInterval(()=>{E(t=>(t+1)%e.length)},r);return()=>clearInterval(t)}},[n,r,i]),H((i,a)=>{if(x){if(a.return){let e=parseInt(C);!isNaN(e)&&e>0&&o(t=>{t.thinkingStyle.updateInterval=e}),S(!1)}else a.escape?(w(r.toString()),S(!1)):a.backspace||a.delete?w(e=>e.slice(0,-1)):i&&i.match(/^[0-9]$/)&&w(e=>e+i);return}if(h||y){if(a.return&&_.length){let e=y?[...n,_]:n.map((e,t)=>t===d?_:e);o(t=>{t.thinkingStyle.phases=ut(e)}),g(!1),v(``)}else a.escape?(v(``),g(!1),b(!1)):a.backspace||a.delete?v(e=>e.slice(0,-1)):i&&v(e=>e+i);return}if(a.escape)t();else if(a.return)if(u===`updateInterval`)w(r.toString()),S(!0);else if(u===`presets`){let e=ft[p];o(t=>{t.thinkingStyle.phases=ut([...e.phases]),t.thinkingStyle.reverseMirror=e.reverseMirror,e.updateInterval!==void 0&&(t.thinkingStyle.updateInterval=e.updateInterval)})}else u===`reverseMirror`&&o(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(a.tab)a.shift?l(e=>e===0?s.length-1:e-1):l(e=>e===s.length-1?0:e+1);else if(a.upArrow)u===`phases`&&n.length>0?f(e=>e>0?e-1:n.length-1):u===`presets`&&m(e=>e>0?e-1:ft.length-1);else if(a.downArrow)u===`phases`&&n.length>0?f(e=>e<n.length-1?e+1:0):u===`presets`&&m(e=>e<ft.length-1?e+1:0);else if(i===` `)u===`reverseMirror`&&o(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(i===`e`&&u===`phases`)n.length>0&&(v(n[d]),g(!0));else if(i===`a`&&u===`phases`)b(!0),v(``);else if(i===`d`&&u===`phases`)n.length>1&&(o(e=>{e.thinkingStyle.phases=ut(n.filter((e,t)=>t!==d))}),d>=n.length&&f(Math.max(0,n.length-1)));else if(i===`w`&&u===`phases`){if(d>0){let e=[...n];[e[d-1],e[d]]=[e[d],e[d-1]],o(t=>{t.thinkingStyle.phases=e}),f(e=>e-1)}}else if(i===`s`&&u===`phases`){if(d<n.length-1){let e=[...n];[e[d],e[d+1]]=[e[d+1],e[d]],o(t=>{t.thinkingStyle.phases=e}),f(e=>e+1)}}else a.ctrl&&i===`r`&&(o(t=>{t.thinkingStyle=e.thinkingStyle}),f(0),m(0))});let k=i?`●`:`○`,A=(()=>i?[...n,...[...n].reverse().slice(1,-1)]:n)(),j=A.length>0?A[T]:`·`;return J(B,{children:Y(B,{flexDirection:`column`,width:`100%`,children:[Y(B,{flexDirection:`row`,width:`100%`,children:[Y(B,{marginBottom:1,flexDirection:`column`,width:`50%`,children:[J(X,{children:`Thinking style`}),Y(B,{flexDirection:`column`,children:[Y(V,{dimColor:!0,children:[`enter to`,` `,u===`updateInterval`?`edit interval`:u===`presets`?`apply preset`:`save`]}),J(V,{dimColor:!0,children:`esc to go back`}),J(V,{dimColor:!0,children:`tab to switch sections`})]})]}),Y(B,{width:`50%`,flexDirection:`column`,children:[J(B,{children:J(V,{bold:!0,children:`Preview`})}),Y(B,{borderStyle:`single`,borderColor:`gray`,paddingX:1,flexDirection:`row`,children:[J(B,{width:(j?.length??0)+1,children:J(V,{color:O,children:j})}),Y(V,{children:[J(V,{color:O,children:`Thinking… `}),J(V,{children:`(esc to interrupt)`})]})]})]})]}),Y(B,{flexDirection:`row`,gap:4,children:[Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:u===`reverseMirror`?`yellow`:void 0,children:u===`reverseMirror`?`❯ `:` `}),J(V,{bold:!0,color:u===`reverseMirror`?`yellow`:void 0,children:`Reverse-mirror phases`})]}),u===`reverseMirror`&&Y(V,{dimColor:!0,children:[` `,`space to toggle`]}),J(B,{marginLeft:2,marginBottom:1,children:Y(V,{children:[k,` `,i?`Enabled`:`Disabled`]})})]}),Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:u===`updateInterval`?`yellow`:void 0,children:u===`updateInterval`?`❯ `:` `}),J(V,{bold:!0,color:u===`updateInterval`?`yellow`:void 0,children:`Update interval (ms)`})]}),u===`updateInterval`&&(x?Y(V,{dimColor:!0,children:[` `,`enter to save`]}):Y(V,{dimColor:!0,children:[` `,`enter to edit`]})),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:x?`yellow`:`gray`,children:J(V,{children:x?C:r})})})]})]}),J(B,{children:Y(V,{children:[J(V,{color:u===`phases`?`yellow`:void 0,children:u===`phases`?`❯ `:` `}),J(V,{bold:!0,color:u===`phases`?`yellow`:void 0,children:`Phases`})]})}),u===`phases`&&J(B,{marginBottom:1,flexDirection:`column`,children:Y(V,{dimColor:!0,children:[` `,`[e]dit`,` `,`[a]dd`,` `,`[d]elete`,` `,`[w]move up`,` `,`[s]move down`]})}),J(B,{marginLeft:2,marginBottom:1,children:Y(B,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,d-4),t=Math.min(n.length,e+8),r=Math.max(0,t-8),i=n.slice(r,t);return Y(q,{children:[r>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t;return Y(V,{color:u===`phases`&&n===d?`cyan`:void 0,children:[u===`phases`&&n===d?`❯ `:` `,e]},n)}),t<n.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,n.length-t,` more below`]})]})})(),y&&Y(B,{children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:_})})]}),h&&Y(B,{marginTop:1,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:_})})]})]})}),J(B,{children:Y(V,{children:[J(V,{color:u===`presets`?`yellow`:void 0,children:u===`presets`?`❯ `:` `}),J(V,{bold:!0,color:u===`presets`?`yellow`:void 0,children:`Presets`})]})}),u===`presets`&&Y(V,{dimColor:!0,children:[` `,`Selecting one will overwrite your choice of phases and interval`]}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{flexDirection:`column`,children:(()=>{let e=Math.max(0,p-6),t=Math.min(ft.length,e+12),n=Math.max(0,t-12),r=ft.slice(n,t),i=e=>{let t=e.phases.join(``);return t.length>30?t.slice(0,27)+`…`:t};return Y(q,{children:[n>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,n,` more above`]}),r.map((e,t)=>{let r=n+t,a=u===`presets`&&r===p;return Y(V,{color:a?`cyan`:void 0,children:[a?`❯ `:` `,e.name,` `,i(e)]},r)}),t<ft.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,ft.length-t,` more below`]})]})})()})}),J(B,{marginTop:1,children:J(V,{dimColor:!0,children:`ctrl+r to reset all settings to default`})})]})})}function mt(e,t){let n=Ce(!0);G(()=>{if(n.current){n.current=!1;return}return e()},t)}const ht=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],gt=[{label:`none`,value:`none`},{label:`single`,value:`single`},{label:`double`,value:`double`},{label:`round`,value:`round`},{label:`bold`,value:`bold`},{label:`singleDouble`,value:`singleDouble`},{label:`doubleSingle`,value:`doubleSingle`},{label:`classic`,value:`classic`},{label:`topBottomSingle`,value:`topBottomSingle`},{label:`topBottomDouble`,value:`topBottomDouble`},{label:`topBottomBold`,value:`topBottomBold`}];function _t({onBack:t}){let{settings:n,updateSettings:r}=W($),[i,a]=K(!1),[o,s]=K(!1),[c,l]=K(!1),[u,d]=K(()=>n.userMessageDisplay.format),[f,p]=K(()=>n.userMessageDisplay.paddingX===`default`?`default`:`custom`),[m,h]=K(()=>n.userMessageDisplay.paddingY===`default`?`default`:`custom`),[g,_]=K(()=>n.userMessageDisplay.paddingX===`default`?`0`:String(n.userMessageDisplay.paddingX)),[v,y]=K(()=>n.userMessageDisplay.paddingY===`default`?`0`:String(n.userMessageDisplay.paddingY)),[b,x]=K(n.userMessageDisplay.fitBoxToContent),[S,C]=K(0),[w,T]=K(()=>[...n.userMessageDisplay.styling]),[E,D]=K(()=>n.userMessageDisplay.foregroundColor===`default`?`default`:`custom`),[O,k]=K(()=>n.userMessageDisplay.foregroundColor===`default`?`rgb(255,255,255)`:n.userMessageDisplay.foregroundColor),[A,j]=K(()=>{let e=n.userMessageDisplay.backgroundColor;return e===null?`none`:e===`default`?`default`:`custom`}),[M,te]=K(()=>{let e=n.userMessageDisplay.backgroundColor;return e===null||e===`default`?`rgb(0,0,0)`:e}),[N,P]=K(()=>gt.findIndex(e=>e.value===n.userMessageDisplay.borderStyle)),[F,ne]=K(()=>n.userMessageDisplay.borderColor),[re,ie]=K(null),[ae,oe]=K(``),se=ee(),ce=n.themes?.find(e=>e.id===se)||n.themes?.[0],[I,L]=K(`text`),R=[`format`,`styling`,`foreground`,`background`],le=[`borderStyle`,`borderColor`,`paddingX`,`paddingY`,`fitBoxToContent`],[ue,de]=K(0),[fe,pe]=K(0),z=I===`text`?R[ue]:le[fe],me=()=>{r(e=>{e.userMessageDisplay.format=u,e.userMessageDisplay.styling=[...w],e.userMessageDisplay.foregroundColor=E===`default`?`default`:O,e.userMessageDisplay.backgroundColor=A===`none`?null:A===`default`?`default`:M,e.userMessageDisplay.borderStyle=gt[N].value,e.userMessageDisplay.borderColor=F,e.userMessageDisplay.paddingX=f===`default`?`default`:parseInt(g)||0,e.userMessageDisplay.paddingY=m===`default`?`default`:parseInt(v)||0,e.userMessageDisplay.fitBoxToContent=b})},he=()=>{d(e.userMessageDisplay.format),T([...e.userMessageDisplay.styling]);let t=e.userMessageDisplay.foregroundColor;D(t===`default`?`default`:`custom`),k(t===`default`?`rgb(255,255,255)`:t);let n=e.userMessageDisplay.backgroundColor;j(n===null?`none`:n===`default`?`default`:`custom`),te(n===null||n===`default`?`rgb(0,0,0)`:n),P(gt.findIndex(t=>t.value===e.userMessageDisplay.borderStyle)),ne(e.userMessageDisplay.borderColor);let i=e.userMessageDisplay.paddingX,a=e.userMessageDisplay.paddingY;p(i===`default`?`default`:`custom`),h(a===`default`?`default`:`custom`),_(i===`default`?`0`:String(i)),y(a===`default`?`0`:String(a)),x(e.userMessageDisplay.fitBoxToContent),r(t=>{t.userMessageDisplay={...e.userMessageDisplay}})};mt(()=>{me()},[u,w,E,O,A,M,N,F,f,m,g,v,b]),H((e,r)=>{if(i){r.return?a(!1):r.escape?(d(n.userMessageDisplay.format),a(!1)):r.backspace||r.delete?d(e=>e.slice(0,-1)):e&&d(t=>t+e);return}if(o){r.return?s(!1):r.escape?(_(String(n.userMessageDisplay.paddingX)),s(!1)):r.backspace||r.delete?_(e=>e.slice(0,-1)):e&&/^\d$/.test(e)&&_(t=>t+e);return}if(c){r.return?l(!1):r.escape?(y(String(n.userMessageDisplay.paddingY)),l(!1)):r.backspace||r.delete?y(e=>e.slice(0,-1)):e&&/^\d$/.test(e)&&y(t=>t+e);return}if(re===null){if(r.escape)t();else if(r.ctrl&&e===`r`)he();else if(r.leftArrow||r.rightArrow)L(e=>e===`text`?`border`:`text`);else if(r.tab)I===`text`?r.shift?de(e=>e===0?R.length-1:e-1):de(e=>e===R.length-1?0:e+1):r.shift?pe(e=>e===0?le.length-1:e-1):pe(e=>e===le.length-1?0:e+1);else if(r.return)z===`format`?a(!0):z===`paddingX`?f===`custom`&&s(!0):z===`paddingY`?m===`custom`&&l(!0):z===`foreground`?E===`custom`&&(oe(O),ie(`foreground`)):z===`background`?A===`custom`&&(oe(M),ie(`background`)):z===`borderColor`&&(oe(F),ie(`border`));else if(r.upArrow)z===`styling`?C(e=>Math.max(0,e-1)):z===`borderStyle`?P(e=>e===0?gt.length-1:e-1):z===`paddingX`?p(e=>e===`default`?`custom`:`default`):z===`paddingY`?h(e=>e===`default`?`custom`:`default`):z===`foreground`?D(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!O||O===``)&&k(`rgb(255,255,255)`),t}):z===`background`&&j(e=>{let t=e===`default`?`custom`:e===`custom`?`none`:`default`;return t===`custom`&&(!M||M===``)&&te(`rgb(0,0,0)`),t});else if(r.downArrow)z===`styling`?C(e=>Math.min(ht.length-1,e+1)):z===`borderStyle`?P(e=>e===gt.length-1?0:e+1):z===`paddingX`?p(e=>e===`default`?`custom`:`default`):z===`paddingY`?h(e=>e===`default`?`custom`:`default`):z===`foreground`?D(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!O||O===``)&&k(`rgb(255,255,255)`),t}):z===`background`&&j(e=>{let t=e===`default`?`none`:e===`none`?`custom`:`default`;return t===`custom`&&(!M||M===``)&&te(`rgb(0,0,0)`),t});else if(e===` `)if(z===`styling`){let e=ht[S].value;T(w.indexOf(e)>=0?w.filter(t=>t!==e):[...w,e])}else z===`fitBoxToContent`&&x(e=>!e)}});let ge=e=>{let t=E===`default`?ce?.colors?.text:O,n=A===`none`?void 0:A===`default`?ce?.colors?.userMessageBackground:M,r=gt[N].value,i=f===`default`?0:parseInt(g)||0,a=m===`default`?0:parseInt(v)||0,o=f===`default`?1:i,s=J(V,{bold:w.includes(`bold`),italic:w.includes(`italic`),underline:w.includes(`underline`),strikethrough:w.includes(`strikethrough`),inverse:w.includes(`inverse`),color:t,backgroundColor:n,children:e});if(r===`topBottomSingle`||r===`topBottomDouble`||r===`topBottomBold`){let t=r===`topBottomSingle`?`─`:r===`topBottomDouble`?`═`:`━`,n=e.length+i*2,o=t.repeat(n);return Y(B,{flexDirection:`column`,children:[J(V,{color:F,children:o}),a>0&&J(B,{height:a}),J(B,{paddingX:i,children:s}),a>0&&J(B,{height:a}),J(V,{color:F,children:o})]})}else if(r!==`none`||i>0||a>0||o>0||b){let e={};i>0&&(e.paddingX=i),f===`default`&&i===0&&(e.paddingRight=o),a>0&&(e.paddingY=a);let t=Object.keys(e).length>0?J(B,{...e,children:s}):s,n={};return r!==`none`&&(n.borderStyle=r,n.borderColor=F),b?n.alignSelf=`flex-start`:n.flexGrow=1,r===`none`?t:J(B,{...n,children:t})}else return s};return re?J(Ze,{initialValue:ae,theme:ce,onColorChange:e=>{re===`foreground`?k(e):re===`background`?te(e):re===`border`&&ne(e)},onExit:()=>{ie(null),oe(``)}}):Y(B,{flexDirection:`column`,children:[J(X,{children:`Customize how user messages are displayed`}),Y(B,{flexDirection:`column`,marginBottom:1,children:[J(V,{dimColor:!0,children:`left/right arrows to switch columns · tab to navigate options`}),J(V,{dimColor:!0,children:`enter to edit · ctrl+r to reset · esc to go back`})]}),Y(B,{flexDirection:`row`,gap:1,children:[Y(B,{flexDirection:`column`,width:`50%`,borderStyle:I===`text`?`round`:`single`,borderColor:I===`text`?`yellow`:`gray`,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:I===`text`?`yellow`:void 0,children:`Text & Styling`})}),J(B,{children:Y(V,{color:z===`format`?`yellow`:void 0,bold:z===`format`,children:[z===`format`?`❯ `:` `,`Format String`]})}),z===`format`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:i?`enter to save · esc to cancel`:`enter to edit · use {} as message placeholder`})}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:i?`yellow`:`gray`,children:J(V,{children:u})})}),J(B,{children:Y(V,{color:z===`styling`?`yellow`:void 0,bold:z===`styling`,children:[z===`styling`?`❯ `:` `,`Styling`]})}),z===`styling`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`up/down to navigate · space to toggle`})}),J(B,{marginLeft:2,marginBottom:1,flexDirection:`column`,children:ht.map((e,t)=>J(B,{children:Y(V,{color:z===`styling`&&S===t?`cyan`:void 0,children:[z===`styling`&&S===t?`❯ `:` `,w.includes(e.value)?`●`:`○`,` `,e.label]})},e.value))}),Y(B,{flexDirection:`row`,gap:1,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(V,{color:z===`foreground`?`yellow`:void 0,bold:z===`foreground`,children:[z===`foreground`?`❯ `:` `,`Foreground`]})}),z===`foreground`&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`up/down · `,E===`custom`?`enter`:``]})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[E===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[E===`custom`?`● `:`○ `,`Custom`,E===`custom`&&`: `,E===`custom`&&J(V,{color:O,children:O})]})})]})]}),Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(V,{color:z===`background`?`yellow`:void 0,bold:z===`background`,children:[z===`background`?`❯ `:` `,`Background`]})}),z===`background`&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`up/down · `,A===`custom`?`enter`:``]})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[A===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[A===`none`?`● `:`○ `,`None`]})}),J(B,{children:Y(V,{children:[A===`custom`?`● `:`○ `,`Custom`,A===`custom`&&`: `,A===`custom`&&J(V,{backgroundColor:M,children:M})]})})]})]})]})]}),Y(B,{flexDirection:`column`,width:`50%`,borderStyle:I===`border`?`round`:`single`,borderColor:I===`border`?`yellow`:`gray`,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:I===`border`?`yellow`:void 0,children:`Border & Padding`})}),J(B,{children:Y(V,{color:z===`borderStyle`?`yellow`:void 0,bold:z===`borderStyle`,children:[z===`borderStyle`?`❯ `:` `,`Border Style`]})}),z===`borderStyle`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`up/down to navigate`})}),Y(B,{marginLeft:2,marginBottom:1,flexDirection:`row`,children:[J(B,{flexDirection:`column`,width:`50%`,children:gt.slice(0,6).map((e,t)=>J(B,{children:Y(V,{color:z===`borderStyle`&&N===t?`cyan`:void 0,children:[z===`borderStyle`&&N===t?`❯ `:` `,N===t?`● `:`○ `,e.label]})},e.value))}),J(B,{flexDirection:`column`,width:`50%`,children:gt.slice(6).map((e,t)=>{let n=t+6;return J(B,{children:Y(V,{color:z===`borderStyle`&&N===n?`cyan`:void 0,children:[z===`borderStyle`&&N===n?`❯ `:` `,N===n?`● `:`○ `,e.label]})},e.value)})})]}),J(B,{children:Y(V,{color:z===`borderColor`?`yellow`:void 0,bold:z===`borderColor`,children:[z===`borderColor`?`❯ `:` `,`Border Color`]})}),z===`borderColor`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`enter to pick color`})}),J(B,{marginLeft:2,marginBottom:1,children:J(V,{color:F,children:F})}),Y(B,{flexDirection:`row`,gap:1,children:[Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`paddingX`?`yellow`:void 0,bold:z===`paddingX`,children:[z===`paddingX`?`❯ `:` `,`Padding X`]})}),z===`paddingX`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:o?`enter/esc`:f===`custom`?`up/down · enter`:`up/down`})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[f===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[f===`custom`?`● `:`○ `,`Custom`]})}),f===`custom`&&J(B,{children:J(B,{borderStyle:`round`,borderColor:o?`yellow`:`gray`,children:J(V,{children:g})})})]})]}),Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`paddingY`?`yellow`:void 0,bold:z===`paddingY`,children:[z===`paddingY`?`❯ `:` `,`Padding Y`]})}),z===`paddingY`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:c?`enter/esc`:m===`custom`?`up/down · enter`:`up/down`})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[m===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[m===`custom`?`● `:`○ `,`Custom`]})}),m===`custom`&&J(B,{children:J(B,{borderStyle:`round`,borderColor:c?`yellow`:`gray`,children:J(V,{children:v})})})]})]}),Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`fitBoxToContent`?`yellow`:void 0,bold:z===`fitBoxToContent`,children:[z===`fitBoxToContent`?`❯ `:` `,b?`●`:`○`,` Fit box to content`]})}),z===`fitBoxToContent`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`space`})})]})]})]})]}),Y(B,{flexDirection:`column`,marginTop:1,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Preview`})}),Y(B,{flexDirection:`row`,gap:2,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{marginBottom:1,children:J(V,{underline:!0,children:`Before (Claude Code default):`})}),J(B,{marginLeft:1,children:Y(V,{backgroundColor:ce?.colors?.userMessageBackground,color:ce?.colors?.text,children:[` `,`> list the dir`,` `]})}),J(B,{marginLeft:1,marginTop:1,children:Y(V,{children:[J(V,{color:ce?.colors?.inactive||`#888888`,children:`●`}),J(V,{children:` The directory `}),J(V,{color:ce?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(V,{children:` contains `}),J(V,{bold:!0,children:`123`}),J(V,{children:` files.`})]})})]}),Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{marginBottom:1,children:J(V,{underline:!0,children:`After (Your customization):`})}),J(B,{marginLeft:1,flexDirection:`row`,children:(()=>ge(u.replace(/\{\}/g,`list the dir`)))()}),J(B,{marginLeft:1,marginTop:1,children:Y(V,{children:[J(V,{color:ce?.colors?.inactive||`#888888`,children:`●`}),J(V,{children:` The directory `}),J(V,{color:ce?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(V,{children:` contains `}),J(V,{bold:!0,children:`123`}),J(V,{children:` files.`})]})})]})]})]})]})}const vt=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],yt=[[`name`,`regex`,`regexFlags`],[`format`,`styling`],[`foreground`,`background`],[`enabled`],[`testText`]];function bt({testText:e,regex:t,regexFlags:n,format:r,styling:i,foregroundColor:a,backgroundColor:o}){let s=[];try{let c=n.includes(`g`)?n:n+`g`,l=new RegExp(t,c),u=[...e.matchAll(l)];if(u.length===0)return J(V,{children:e});let d=0;return u.forEach((t,n)=>{let c=t.index,l=c+t[0].length;c>d&&s.push(J(V,{children:e.slice(d,c)},`plain-${n}`));let u=r.replace(/\{MATCH\}/g,t[0]);s.push(J(V,{bold:i.includes(`bold`),italic:i.includes(`italic`),underline:i.includes(`underline`),strikethrough:i.includes(`strikethrough`),inverse:i.includes(`inverse`),color:a,backgroundColor:o,children:u},`match-${n}`)),d=l}),d<e.length&&s.push(J(V,{children:e.slice(d)},`plain-end`)),J(q,{children:s})}catch{return J(V,{children:e})}}function xt({highlighterIndex:e,onBack:t}){let{settings:n,updateSettings:r}=W($),i=n.inputPatternHighlighters[e],a=ee(),o=n.themes?.find(e=>e.id===a)||n.themes?.[0],[s,c]=K(i?.name||`New Highlighter`),[l,u]=K(i?.regex||``),[d,f]=K(i?.regexFlags||`g`),[p,m]=K(i?.format||`{MATCH}`),[h,g]=K(i?.styling||[]),[_,v]=K(i?.foregroundColor===null?`none`:`custom`),[y,b]=K(i?.foregroundColor||`rgb(255,0,255)`),[x,S]=K(i?.backgroundColor?`custom`:`none`),[C,w]=K(i?.backgroundColor||`rgb(0,0,0)`),[T,E]=K(i?.enabled??!0),[D,O]=K(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),[k,A]=K(`name`),[j,M]=K(!1),[te,N]=K(0),[P,F]=K(null),[ne,re]=K(``),[ie,ae]=K(null),[oe,se]=K(0),[ce,I]=K(0);if(G(()=>{let e=yt[oe];A(e[Math.min(ce,e.length-1)])},[oe,ce]),G(()=>{if(!l){ae(null);return}try{new RegExp(l,d),ae(null)}catch(e){ae(e.message)}},[l,d]),G(()=>{e>=0&&r(t=>{t.inputPatternHighlighters[e]&&(t.inputPatternHighlighters[e]={name:s,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:null,backgroundColor:x===`custom`?C:null,enabled:T})})},[e,s,l,d,p,h,_,y,x,C,T]),G(()=>{r(e=>{e.inputPatternHighlightersTestText=D})},[D]),H((e,r)=>{if(j){r.return?M(!1):r.escape?(k===`name`&&c(i?.name||``),k===`regex`&&u(i?.regex||``),k===`regexFlags`&&f(i?.regexFlags||`g`),k===`format`&&m(i?.format||`{MATCH}`),k===`testText`&&O(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),M(!1)):r.backspace||r.delete?(k===`name`&&c(e=>e.slice(0,-1)),k===`regex`&&u(e=>e.slice(0,-1)),k===`regexFlags`&&f(e=>e.slice(0,-1)),k===`format`&&m(e=>e.slice(0,-1)),k===`testText`&&O(e=>e.slice(0,-1))):e&&e.length===1&&(k===`name`&&c(t=>t+e),k===`regex`&&u(t=>t+e),k===`regexFlags`&&f(t=>t+e),k===`format`&&m(t=>t+e),k===`testText`&&O(t=>t+e));return}if(P===null){if(r.escape)t();else if(r.upArrow)k===`styling`&&te>0?N(e=>e-1):se(e=>Math.max(0,e-1));else if(r.downArrow)k===`styling`&&te<vt.length-1?N(e=>e+1):se(e=>Math.min(yt.length-1,e+1));else if(r.leftArrow)k===`foreground`?v(e=>e===`none`?`custom`:`none`):k===`background`?S(e=>e===`none`?`custom`:`none`):I(e=>Math.max(0,e-1));else if(r.rightArrow)if(k===`foreground`)v(e=>e===`none`?`custom`:`none`);else if(k===`background`)S(e=>e===`none`?`custom`:`none`);else{let e=yt[oe].length-1;I(t=>Math.min(e,t+1))}else if(r.tab){let e=yt.flat(),t=e.indexOf(k);if(r.shift){if(t>0){let n=e[t-1];for(let e=0;e<yt.length;e++){let t=yt[e].indexOf(n);if(t>=0){se(e),I(t);break}}}}else if(t<e.length-1){let n=e[t+1];for(let e=0;e<yt.length;e++){let t=yt[e].indexOf(n);if(t>=0){se(e),I(t);break}}}}else if(r.return)k===`name`||k===`regex`||k===`regexFlags`||k===`format`||k===`testText`?M(!0):k===`foreground`&&_===`custom`?(re(y),F(`foreground`)):k===`background`&&x===`custom`&&(re(C),F(`background`));else if(e===` `)if(k===`styling`){let e=vt[te].value;h.includes(e)?g(h.filter(t=>t!==e)):g([...h,e])}else k===`enabled`&&E(!T)}}),!i)return J(B,{flexDirection:`column`,children:J(V,{color:`red`,children:`Highlighter not found`})});if(P)return J(Ze,{initialValue:ne,theme:o,onColorChange:e=>{P===`foreground`?b(e):P===`background`&&w(e)},onExit:()=>{F(null),re(``)}});let L=e=>k===e,R=e=>({color:L(e)?`yellow`:void 0,bold:L(e)});return Y(B,{flexDirection:`column`,children:[J(X,{children:`Edit Highlighter`}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`arrows to navigate · enter to edit · space to toggle · esc to go back`})}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`30%`,children:[Y(V,{...R(`name`),children:[L(`name`)?`❯ `:` `,`Name`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`name`)?j?`green`:`yellow`:`gray`,children:J(V,{children:s||`(empty)`})})})]}),Y(B,{flexDirection:`column`,width:`45%`,children:[Y(V,{...R(`regex`),children:[L(`regex`)?`❯ `:` `,`Regex Pattern`]}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{borderStyle:`round`,borderColor:L(`regex`)?j?`green`:`yellow`:ie?`red`:`gray`,children:J(V,{children:l||`(empty)`})}),ie&&J(V,{color:`red`,children:ie})]})]}),Y(B,{flexDirection:`column`,width:`20%`,children:[Y(V,{...R(`regexFlags`),children:[L(`regexFlags`)?`❯ `:` `,`Flags`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`regexFlags`)?j?`green`:`yellow`:`gray`,children:J(V,{children:d||`g`})})})]})]}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[Y(V,{...R(`format`),children:[L(`format`)?`❯ `:` `,`Format String`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`format`)?j?`green`:`yellow`:`gray`,children:J(V,{children:p||`{MATCH}`})})}),L(`format`)&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`use `,`{MATCH}`,` as placeholder`]})})]}),Y(B,{flexDirection:`column`,width:`45%`,children:[Y(V,{...R(`styling`),children:[L(`styling`)?`❯ `:` `,`Styling`]}),J(B,{marginLeft:2,flexDirection:`column`,children:vt.map((e,t)=>{let n=h.includes(e.value),r=L(`styling`)&&te===t;return Y(V,{color:r?`cyan`:void 0,children:[r?`❯ `:` `,n?`●`:`○`,` `,e.label]},e.value)})})]})]}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`48%`,children:[Y(V,{...R(`foreground`),children:[L(`foreground`)?`❯ `:` `,`Foreground Color`]}),Y(B,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(V,{color:L(`foreground`)?`yellow`:void 0,children:[`[`,_===`none`?`●`:`○`,`] none`,` `,`[`,_===`custom`?`●`:`○`,`] custom`]}),_===`custom`&&J(B,{borderStyle:`round`,borderColor:L(`foreground`)?`yellow`:`gray`,children:J(V,{color:y,children:` ████ `})})]})]}),Y(B,{flexDirection:`column`,width:`48%`,children:[Y(V,{...R(`background`),children:[L(`background`)?`❯ `:` `,`Background Color`]}),Y(B,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(V,{color:L(`background`)?`yellow`:void 0,children:[`[`,x===`none`?`●`:`○`,`] none`,` `,`[`,x===`custom`?`●`:`○`,`] custom`]}),x===`custom`&&J(B,{borderStyle:`round`,borderColor:L(`background`)?`yellow`:`gray`,children:Y(V,{backgroundColor:C,children:[` `,` `,` `]})})]})]})]}),J(B,{marginBottom:1,children:Y(V,{...R(`enabled`),children:[L(`enabled`)?`❯ `:` `,`Enabled:`,` `,J(V,{color:T?`green`:`red`,children:T?`● Yes`:`○ No`})]})}),Y(B,{flexDirection:`column`,marginBottom:1,children:[Y(V,{...R(`testText`),children:[L(`testText`)?`❯ `:` `,`Test Text`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`testText`)?j?`green`:`yellow`:`gray`,children:J(V,{children:D||`(empty)`})})})]}),J(B,{borderStyle:`round`,padding:1,children:Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Live Preview:`}),l?J(B,{marginTop:1,children:J(bt,{testText:D,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:void 0,backgroundColor:x===`custom`?C:void 0})}):J(V,{dimColor:!0,children:`Enter a regex pattern to see the preview`})]})})]})}function St({onBack:t}){let{settings:{inputPatternHighlighters:n,themes:r},updateSettings:i}=W($),a=ee(),o=r.find(e=>e.id===a)||r[0],s=e.themes[0],c=o?.colors.success||s.colors.success,l=o?.colors.error||s.colors.error,[u,d]=K(0),[f,p]=K(null),[m,h]=K(!0),g=()=>{let e={name:`New Highlighter`,regex:``,regexFlags:`g`,format:`{MATCH}`,styling:[],foregroundColor:`rgb(255,0,255)`,backgroundColor:null,enabled:!0};i(t=>{t.inputPatternHighlighters.push(e)}),p(n.length),h(!1)},_=e=>{i(t=>{t.inputPatternHighlighters.splice(e,1)}),u>=n.length-1&&d(Math.max(0,n.length-2))},v=e=>{i(t=>{t.inputPatternHighlighters[e].enabled=!t.inputPatternHighlighters[e].enabled})},y=e=>{e<=0||(i(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e-1,0,n)}),d(e-1))},b=e=>{e>=n.length-1||(i(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e+1,0,n)}),d(e+1))};return H((e,r)=>{r.escape?t():r.upArrow?d(e=>Math.max(0,e-1)):r.downArrow&&n.length>0?d(e=>Math.min(n.length-1,e+1)):r.return&&n.length>0?(p(u),h(!1)):e===`n`?g():e===`x`&&n.length>0?_(u):e===` `&&n.length>0?v(u):e===`u`&&n.length>0&&u>0?y(u):e===`d`&&n.length>0&&u<n.length-1&&b(u)},{isActive:m}),f===null?Y(B,{flexDirection:`column`,children:[J(X,{children:`Input Pattern Highlighters`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`Create custom highlighters for patterns in your input prompt.`}),J(V,{dimColor:!0,children:`Matched text will be styled and optionally reformatted.`})]}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new highlighter`}),n.length>0&&J(V,{dimColor:!0,children:`space to toggle enabled/disabled`}),n.length>0&&J(V,{dimColor:!0,children:`u/d to move highlighter up/down`}),n.length>0&&J(V,{dimColor:!0,children:`x to delete a highlighter`}),n.length>0&&J(V,{dimColor:!0,children:`enter to edit highlighter`}),J(V,{dimColor:!0,children:`esc to go back`})]}),n.length===0?J(V,{children:`No highlighters created yet. Press n to create one.`}):J(B,{flexDirection:`column`,children:n.map((e,t)=>{let n=u===t,r;return n&&(r=`yellow`),Y(B,{flexDirection:`row`,children:[Y(V,{color:r,children:[n?`❯ `:` `,e.enabled?`● `:`○ `,e.name,` `]}),J(V,{dimColor:!0,children:`(`}),e.regex?Y(V,{dimColor:!0,children:[`/`,e.regex,`/`,e.regexFlags]}):J(V,{dimColor:!0,children:`(no regex)`}),e.styling.length>0&&J(q,{children:Y(V,{color:r,dimColor:!e.enabled,children:[` `,`· `,e.styling.join(`, `)]})}),J(V,{dimColor:!0,children:`)`}),e.enabled?J(V,{color:c,children:` enabled`}):J(V,{color:l,children:` disabled`})]},t)})})]}):J(xt,{highlighterIndex:f,onBack:()=>{p(null),h(!0)}})}const Ct=[null,1,5,10,25,50,100,200,250,500,1e3],wt=1e3;function Tt({onSubmit:e}){let{settings:t,updateSettings:n}=W($),[r,i]=K(0),[a,o]=K(!1),s={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEdit:!1,hideStartupClawd:!1,increaseFileReadLimit:!1,suppressLineNumbers:!1,suppressRateLimitOptions:!1,mcpConnectionNonBlocking:!0,mcpServerBatchSize:null,statuslineThrottleMs:null,statuslineUseFixedInterval:!1,tableFormat:`default`,enableSwarmMode:!0,enableSessionMemory:!0,enableDreamMode:!0,enableLeanMemoryTypes:!1,fixSummarizeFromHere:!0,fixRewindSummaryHeader:!0,enableRememberSkill:!1,tokenCountRounding:null,autoAcceptPlanMode:!1,allowBypassPermissionsInSudo:!1,suppressNativeInstallerWarning:!1,filterScrollEscapeSequences:!1,enableWorktreeMode:!0,allowCustomAgentModels:!1,enableContextLimitOverride:!1,enableModelCustomizations:!0,enableVoiceMode:!1,enableVoiceConciseOutput:!0,enableChannelsMode:!1,maxEffortDefault:!1,autoModeClassifierModel:`default`,suppressDeferredTools:!1,claudemdContextOncePerConversation:!0},c=()=>{t.misc||={...s}},l=e=>{let t=[`default`,`sonnet`,`haiku`];return t[(t.indexOf(e)+1)%t.length]},u=e=>{switch(e){case`sonnet`:return`Sonnet 4.6`;case`haiku`:return`Haiku 4.5`;case`default`:default:return`Default (main-loop model)`}},d=e=>{let t=[`default`,`ascii`,`clean`,`clean-top-bottom`];return t[(t.indexOf(e)+1)%t.length]},f=e=>{switch(e){case`ascii`:return`ASCII (| and -)`;case`clean`:return`Clean (no row separators)`;case`clean-top-bottom`:return`Clean with top/bottom`;case`default`:default:return`Default (box-drawing)`}},p=e=>e===null?`Default (3)`:e<=3?`${e} (conservative)`:e<=8?`${e} (recommended)`:`${e} (aggressive)`,m=e=>e===null?`Disabled`:e===0?`0ms (instant)`:`${e}ms`,h=e=>e===null?`Off (exact counts)`:`Round to ${e}`,g=(e,t)=>{let n=Ct.indexOf(e);if(n===-1)return Ct[0];let r;return r=t===`next`?(n+1)%Ct.length:(n-1+Ct.length)%Ct.length,Ct[r]},_=Se(()=>[{id:`removeBorder`,title:`Remove input box border`,description:`Removes the rounded border around the input box for a cleaner look.`,getValue:()=>t.inputBox?.removeBorder??!1,toggle:()=>{n(e=>{e.inputBox||={removeBorder:!1},e.inputBox.removeBorder=!e.inputBox.removeBorder})}},{id:`showVersion`,title:`Show tweakcc version at startup`,description:`Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.`,getValue:()=>t.misc?.showTweakccVersion??!0,toggle:()=>{n(e=>{c(),e.misc.showTweakccVersion=!e.misc.showTweakccVersion})}},{id:`showPatches`,title:`Show patches applied indicator at startup`,description:`Shows the green "tweakcc patches are applied" indicator when starting Claude Code.`,getValue:()=>t.misc?.showPatchesApplied??!0,toggle:()=>{n(e=>{c(),e.misc.showPatchesApplied=!e.misc.showPatchesApplied})}},{id:`expandThinking`,title:`Expand thinking blocks`,description:`Makes thinking blocks always expanded by default instead of collapsed.`,getValue:()=>t.misc?.expandThinkingBlocks??!0,toggle:()=>{n(e=>{c(),e.misc.expandThinkingBlocks=!e.misc.expandThinkingBlocks})}},{id:`conversationTitle`,title:`Allow renaming sessions via /title`,description:`Enables /title and /rename commands for manually naming conversations.`,getValue:()=>t.misc?.enableConversationTitle??!0,toggle:()=>{n(e=>{c(),e.misc.enableConversationTitle=!e.misc.enableConversationTitle})}},{id:`enableModelCustomizations`,title:`Enable model customizations (/model shows all models)`,description:`Show all Claude models in /model menu, not just the latest 3. Disable to use Claude Code default model list.`,getValue:()=>t.misc?.enableModelCustomizations??!0,toggle:()=>{n(e=>{c(),e.misc.enableModelCustomizations=!e.misc.enableModelCustomizations})}},{id:`hideStartupBanner`,title:`Hide startup banner`,description:`Hides the startup banner message displayed before first prompt.`,getValue:()=>t.misc?.hideStartupBanner??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupBanner=!e.misc.hideStartupBanner})}},{id:`hideCtrlG`,title:`Hide ctrl-g to edit prompt hint`,description:`Hides the "ctrl-g to edit prompt" hint shown during streaming.`,getValue:()=>t.misc?.hideCtrlGToEdit??!1,toggle:()=>{n(e=>{c(),e.misc.hideCtrlGToEdit=!e.misc.hideCtrlGToEdit})}},{id:`hideClawd`,title:`Hide startup Clawd ASCII art`,description:`Hides the Clawd ASCII art character shown at startup.`,getValue:()=>t.misc?.hideStartupClawd??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupClawd=!e.misc.hideStartupClawd})}},{id:`increaseFileReadLimit`,title:`Increase file read token limit`,description:`Increases the maximum file read limit from 25,000 to 1,000,000 tokens.`,getValue:()=>t.misc?.increaseFileReadLimit??!1,toggle:()=>{n(e=>{c(),e.misc.increaseFileReadLimit=!e.misc.increaseFileReadLimit})}},{id:`suppressLineNumbers`,title:`Suppress line numbers in file reads/edits`,description:`Removes line number prefixes from file content to reduce token usage.`,getValue:()=>t.misc?.suppressLineNumbers??!1,toggle:()=>{n(e=>{c(),e.misc.suppressLineNumbers=!e.misc.suppressLineNumbers})}},{id:`suppressRateLimitOptions`,title:`Suppress rate limit options popup`,description:`Prevents the automatic /rate-limit-options command from being triggered when hitting rate limits.`,getValue:()=>t.misc?.suppressRateLimitOptions??!1,toggle:()=>{n(e=>{c(),e.misc.suppressRateLimitOptions=!e.misc.suppressRateLimitOptions})}},{id:`mcpNonBlocking`,title:`Non-blocking MCP startup`,description:`Start immediately while MCP servers connect in background. Reduces startup time ~50% with multiple MCPs.`,getValue:()=>t.misc?.mcpConnectionNonBlocking??!0,toggle:()=>{n(e=>{c(),e.misc.mcpConnectionNonBlocking=!e.misc.mcpConnectionNonBlocking})}},{id:`mcpBatchSize`,title:`MCP server batch size`,description:`Parallel MCP connections (1-20). Use ←/→ to adjust. Higher = faster startup, more resources.`,getValue:()=>t.misc?.mcpServerBatchSize??null,getDisplayValue:()=>p(t.misc?.mcpServerBatchSize??null),toggle:()=>{n(e=>{c(),e.misc.mcpServerBatchSize=null})},increment:()=>{n(e=>{c();let t=e.misc.mcpServerBatchSize??3;e.misc.mcpServerBatchSize=Math.min(20,t+1)})},decrement:()=>{n(e=>{c();let t=(e.misc.mcpServerBatchSize??3)-1;e.misc.mcpServerBatchSize=t<1?null:t})}},{id:`tableFormat`,title:`Table output format`,description:`Controls how Claude formats tables. Default: full borders. ASCII: | and -. Clean: no top/bottom/row separators. Clean+top/bottom: borders but no row separators.`,getValue:()=>t.misc?.tableFormat??`default`,isMultiValue:!0,getDisplayValue:()=>f(t.misc?.tableFormat??`default`),toggle:()=>{n(e=>{c(),e.misc.tableFormat=d(e.misc.tableFormat??`default`)})}},{id:`enableWorktreeMode`,title:`Enable worktree mode (EnterWorktree tool)`,description:`Force-enable the EnterWorktree tool for isolated git worktree sessions by bypassing the tengu_worktree_mode feature flag.`,getValue:()=>t.misc?.enableWorktreeMode??!0,toggle:()=>{n(e=>{c(),e.misc.enableWorktreeMode=!e.misc.enableWorktreeMode})}},{id:`enableVoiceMode`,title:`Enable voice mode (/voice command)`,description:`Force-enable the /voice command by bypassing the tengu_amber_quartz feature gate.`,getValue:()=>t.misc?.enableVoiceMode??!1,toggle:()=>{n(e=>{c(),e.misc.enableVoiceMode=!e.misc.enableVoiceMode})}},{id:`enableVoiceConciseOutput`,title:`Enable concise output for voice mode`,description:`Enable the concise-output prompt used for voice interactions. Only applies when voice mode is enabled.`,getValue:()=>t.misc?.enableVoiceConciseOutput??!0,toggle:()=>{n(e=>{c(),e.misc.enableVoiceConciseOutput=!e.misc.enableVoiceConciseOutput})}},{id:`enableChannelsMode`,title:`Enable channels mode (MCP channel notifications)`,description:`Force-enable MCP channel notifications by bypassing the tengu_harbor feature gate, allowlist, and permission relay.`,getValue:()=>t.misc?.enableChannelsMode??!1,toggle:()=>{n(e=>{c(),e.misc.enableChannelsMode=!e.misc.enableChannelsMode})}},{id:`enableContextLimitOverride`,title:`Override context limit`,description:`Replaces the default model context limit with CLAUDE_CODE_CONTEXT_LIMIT env var. Must be exported manually before launching CC, or falls back to 200K.`,getValue:()=>t.misc?.enableContextLimitOverride??!1,toggle:()=>{n(e=>{c(),e.misc.enableContextLimitOverride=!e.misc.enableContextLimitOverride})}},{id:`statuslineThrottle`,title:`Statusline throttle`,description:`Throttle statusline updates (0-${wt}ms). Use ←/→ to adjust by 50ms. Space to disable. 0 = instant updates.`,getValue:()=>t.misc?.statuslineThrottleMs??null,getDisplayValue:()=>m(t.misc?.statuslineThrottleMs??null),toggle:()=>{n(e=>{c(),e.misc.statuslineThrottleMs=e.misc.statuslineThrottleMs===null?300:null})},increment:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.min(wt,t+50)})},decrement:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.max(0,t-50)})}},{id:`statuslineFixedInterval`,title:`Statusline fixed interval mode`,description:`Use setInterval instead of throttle. Updates happen on a fixed schedule rather than on-demand.`,getValue:()=>t.misc?.statuslineUseFixedInterval??!1,toggle:()=>{n(e=>{c(),e.misc.statuslineUseFixedInterval=!e.misc.statuslineUseFixedInterval})}},{id:`enableSessionMemory`,title:`Enable session memory`,description:`Force-enable session memory (auto-extraction + past session search) by bypassing the tengu_session_memory and tengu_coral_fern statsig flags.`,getValue:()=>t.misc?.enableSessionMemory??!0,toggle:()=>{n(e=>{c(),e.misc.enableSessionMemory=!e.misc.enableSessionMemory})}},{id:`enableDreamMode`,title:`Enable dream mode`,description:`Force-enable dream (/dream + auto-dream background memory consolidation) by bypassing the tengu_onyx_plover statsig gate. On/off still follows autoDreamEnabled in ~/.claude/settings.json.`,getValue:()=>t.misc?.enableDreamMode??!0,toggle:()=>{n(e=>{c(),e.misc.enableDreamMode=!e.misc.enableDreamMode})}},{id:`fixSummarizeFromHere`,title:`Fix "Summarize from here"`,description:`Make "Summarize from here" summarize only the messages after the rewind point instead of the whole conversation.`,getValue:()=>t.misc?.fixSummarizeFromHere??!0,toggle:()=>{n(e=>{c(),e.misc.fixSummarizeFromHere=!(e.misc.fixSummarizeFromHere??!0)})}},{id:`fixRewindSummaryHeader`,title:`Honest rewind summary header`,description:`Label a rewind summary as a deliberate rewind (you continued forward, then rewound and chose to carry the summary forward) instead of the misleading "ran out of context" header.`,getValue:()=>t.misc?.fixRewindSummaryHeader??!0,toggle:()=>{n(e=>{c(),e.misc.fixRewindSummaryHeader=!(e.misc.fixRewindSummaryHeader??!0)})}},{id:`enableLeanMemoryTypes`,title:`Enable lean memory types`,description:`Force the tengu_ochre_finch statsig gate: memory prompts carry a compact "Types of memory" list and the full taxonomy moves to the on-demand memory-types skill.`,getValue:()=>t.misc?.enableLeanMemoryTypes??!1,toggle:()=>{n(e=>{c(),e.misc.enableLeanMemoryTypes=!e.misc.enableLeanMemoryTypes})}},{id:`enableRememberSkill`,title:`Enable remember skill`,description:`Register a "remember" skill to review session memories and update CLAUDE.local.md with learnings from past sessions.`,getValue:()=>t.misc?.enableRememberSkill??!1,toggle:()=>{n(e=>{c(),e.misc.enableRememberSkill=!e.misc.enableRememberSkill})}},{id:`tokenCountRounding`,title:`Token count rounding`,description:`Round displayed token counts to nearest multiple. Use ←/→ to cycle: Off, 1, 5, 10, 25, 50, 100, 200, 250, 500, 1000.`,getValue:()=>t.misc?.tokenCountRounding??null,getDisplayValue:()=>h(t.misc?.tokenCountRounding??null),toggle:()=>{n(e=>{c(),e.misc.tokenCountRounding=null})},increment:()=>{n(e=>{c(),e.misc.tokenCountRounding=g(e.misc.tokenCountRounding??null,`next`)})},decrement:()=>{n(e=>{c(),e.misc.tokenCountRounding=g(e.misc.tokenCountRounding??null,`prev`)})}},{id:`autoAcceptPlanMode`,title:`Auto-accept plan mode`,description:`Automatically accept plans without the "Ready to code?" confirmation prompt.`,getValue:()=>t.misc?.autoAcceptPlanMode??!1,toggle:()=>{n(e=>{c(),e.misc.autoAcceptPlanMode=!e.misc.autoAcceptPlanMode})}},{id:`allowBypassPermissionsInSudo`,title:`Allow bypassing permissions in sudo`,description:`⚠️ WARNING: Disables a security check. When enabled, Claude can perform system-level operations without prompts. Use extreme caution.`,getValue:()=>t.misc?.allowBypassPermissionsInSudo??!1,toggle:()=>{t.misc?.allowBypassPermissionsInSudo??!1?n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!1}):o(!0)}},{id:`suppressNativeInstallerWarning`,title:`Suppress native installer warning`,description:`Suppress the native installer warning message at startup.`,getValue:()=>t.misc?.suppressNativeInstallerWarning??!1,toggle:()=>{n(e=>{c(),e.misc.suppressNativeInstallerWarning=!e.misc.suppressNativeInstallerWarning})}},{id:`filterScrollEscapeSequences`,title:`Filter scroll escape sequences`,description:`Filter out terminal escape sequences that cause unwanted scrolling.`,getValue:()=>t.misc?.filterScrollEscapeSequences??!1,toggle:()=>{n(e=>{c(),e.misc.filterScrollEscapeSequences=!e.misc.filterScrollEscapeSequences})}},{id:`allowCustomAgentModels`,title:`Allow custom agent models`,description:`Allow arbitrary model names in custom agent frontmatter (e.g. gemini-2.5-flash). Useful with a local proxy for non-Claude models.`,getValue:()=>t.misc?.allowCustomAgentModels??!1,toggle:()=>{n(e=>{c(),e.misc.allowCustomAgentModels=!e.misc.allowCustomAgentModels})}},{id:`maxEffortDefault`,title:`Default Opus 4.7 to max effort`,description:`Patches CC so Opus 4.7 sessions default to "max" reasoning effort instead of "xhigh". /effort and CLAUDE_CODE_EFFORT_LEVEL still override at runtime.`,getValue:()=>t.misc?.maxEffortDefault??!1,toggle:()=>{n(e=>{c(),e.misc.maxEffortDefault=!e.misc.maxEffortDefault})}},{id:`autoModeClassifierModel`,title:`Auto-mode classifier model`,description:`Pin auto-mode bash safety classifier to a fixed model. Default routes to your main-loop model (e.g. Opus 4.7), which gets denied as "temporarily unavailable" when that model is congested. Sonnet/Haiku have more headroom and the binary XML classifier task fits either.`,getValue:()=>t.misc?.autoModeClassifierModel??`default`,getDisplayValue:()=>u(t.misc?.autoModeClassifierModel??`default`),toggle:()=>{n(e=>{c(),e.misc.autoModeClassifierModel=l(e.misc.autoModeClassifierModel??`default`)})}}],[t,n]),v=_.length,y=v-1,b=Se(()=>r<4?0:Math.min(r-4+1,v-4),[r,v]),x=_.slice(b,b+4),S=b>0,C=b+4<v;return H((t,s)=>{a?s.return?(n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!0}),o(!1)):s.escape&&o(!1):s.return||s.escape?e():s.upArrow?i(e=>Math.max(0,e-1)):s.downArrow?i(e=>Math.min(y,e+1)):t===` `?_[r]?.toggle():s.rightArrow?_[r]?.increment?.():s.leftArrow&&_[r]?.decrement?.()}),J(B,{flexDirection:`column`,children:a?J(B,{flexDirection:`column`,paddingX:2,children:Y(B,{borderStyle:`double`,borderColor:`yellow`,padding:2,flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:`yellow`,children:`SECURITY WARNING`})}),J(B,{marginBottom:1,children:J(V,{children:`You are about to enable a feature that allows Claude Code to bypass permission checks when running with sudo privileges.`})}),J(B,{marginBottom:1,children:J(V,{color:`red`,children:`This means Claude can perform system-level operations without any prompts or confirmation.`})}),J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Use with extreme caution.`})}),J(B,{children:Y(V,{children:[`Press `,J(V,{color:`red`,children:`Enter`}),` to enable,`,` `,J(V,{color:`green`,children:`Escape`}),` to cancel`]})})]})}):Y(q,{children:[J(B,{marginBottom:1,children:J(X,{children:`Miscellaneous Settings`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Use ↑/↓ to navigate, space to toggle, ←/→ to adjust numbers, enter to go back.`})}),S&&J(B,{children:Y(V,{dimColor:!0,children:[` ↑ `,b,` more above`]})}),x.map((e,t)=>{let n=b+t===r,i=e.getValue(),a=!!e.getDisplayValue,o=!!e.increment,s;s=o?`◆`:a?`◉`:i?`☑`:`☐`;let c;c=a?e.getDisplayValue():typeof i==`boolean`?i?`Enabled`:`Disabled`:String(i??`Default`);let l=n&&o?` ← → `:``;return Y(B,{flexDirection:`column`,children:[J(B,{children:Y(V,{children:[J(V,{color:n?`cyan`:void 0,children:n?`❯ `:` `}),J(V,{bold:!0,color:n?`cyan`:void 0,children:e.title})]})}),J(B,{children:Y(V,{dimColor:!0,children:[` `,e.description]})}),J(B,{marginLeft:4,marginBottom:1,children:Y(V,{children:[s,` `,c,J(V,{dimColor:!0,children:l})]})})]},e.id)}),C&&J(B,{children:Y(V,{dimColor:!0,children:[` `,`↓ `,v-b-4,` more below`]})}),J(B,{marginTop:1,children:Y(V,{dimColor:!0,children:[`Item `,r+1,` of `,v]})})]})})}const Et=`AgentOutputTool.AskUserQuestion.Bash.BashOutputTool.Edit.EnterPlanMode.ExitPlanMode.Glob.Grep.KillShell.ListMcpResourcesTool.LSP.NotebookEdit.Read.ReadMcpResourceTool.Skill.Task.TaskCreate.TaskGet.TaskList.TaskOutput.TaskStop.TaskUpdate.Teammate.TodoWrite.ToolSearch.WebFetch.WebSearch.Write`.split(`.`);function Dt({toolsetIndex:e,onBack:t}){let{settings:n,updateSettings:r}=W($),i=n.toolsets[e],[a,o]=K(i?.name||`New Toolset`),[s,c]=K(i?.allowedTools||[]),[l,u]=K(!1),[d,f]=K(0);G(()=>{i&&r(t=>{let n=t.toolsets[e].name;t.toolsets[e].name=a,t.toolsets[e].allowedTools=s,n!==a&&(t.defaultToolset===n&&(t.defaultToolset=a),t.planModeToolset===n&&(t.planModeToolset=a))})},[a,s]);let p=e=>s===`*`?!0:s.includes(e),m=e=>{e===`All`?c(`*`):e===`None`?c([]):s===`*`?c(Et.filter(t=>t!==e)):s.includes(e)?c(s.filter(t=>t!==e)):c([...s,e])};if(H((e,n)=>{if(l){n.return?u(!1):n.escape?(o(i?.name||`New Toolset`),u(!1)):n.backspace||n.delete?o(e=>e.slice(0,-1)):e&&e.length===1&&o(t=>t+e);return}if(n.escape)t();else if(n.upArrow)f(e=>Math.max(0,e-1));else if(n.downArrow)f(e=>Math.min(Et.length+1,e+1));else if(e===` `||n.return)if(d===0)m(`All`);else if(d===1)m(`None`);else{let e=Et[d-2];e&&m(e)}else e===`n`&&u(!0)}),!i)return J(B,{flexDirection:`column`,children:J(V,{color:`red`,children:`Toolset not found`})});let h=s===`*`,g=Array.isArray(s)&&s.length===0;return Y(B,{flexDirection:`column`,children:[J(X,{children:`Edit Toolset`}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`n to edit name · space/enter to toggle · esc to go back`})}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{bold:!0,children:`Name:`}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:l?`yellow`:`gray`,children:J(V,{children:a})})}),l&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`enter to save · esc to cancel`})})]}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{bold:!0,children:`Allowed Tools:`}),J(B,{marginLeft:2,children:Y(V,{color:d===0?`cyan`:void 0,children:[d===0?`❯ `:` `,h?`●`:`○`,` All`]})}),J(B,{marginLeft:2,children:Y(V,{color:d===1?`cyan`:void 0,children:[d===1?`❯ `:` `,g?`●`:`○`,` None`]})}),Et.map((e,t)=>{let n=t+2;return J(B,{marginLeft:2,children:Y(V,{color:d===n?`cyan`:void 0,children:[d===n?`❯ `:` `,p(e)?`◉`:`○`,` `,e]})},e)})]}),J(B,{borderStyle:`round`,padding:1,marginTop:1,children:Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Summary:`}),Y(V,{children:[`Name: `,J(V,{color:`cyan`,children:a})]}),Y(V,{children:[`Tools:`,` `,s===`*`?J(V,{color:`green`,children:`All tools (*)`}):s.length===0?J(V,{color:`red`,children:`No tools ([])`}):Y(V,{color:`yellow`,children:[s.length,` selected`]})]})]})})]})}function Ot({onBack:t}){let{settings:{toolsets:n,defaultToolset:r,planModeToolset:i,themes:a},updateSettings:o}=W($),s=ee(),c=a.find(e=>e.id===s)||a[0],l=e.themes[0],u=c?.colors.planMode||l.colors.planMode,d=c?.colors.autoAccept||l.colors.autoAccept,[f,p]=K(0),[m,h]=K(null),[g,_]=K(!0),v=()=>{let e={name:`New Toolset`,allowedTools:[]};o(t=>{t.toolsets.push(e)}),h(n.length),_(!1)},y=e=>{let t=n[e];o(n=>{n.toolsets.splice(e,1),n.defaultToolset===t.name&&(n.defaultToolset=null),n.planModeToolset===t.name&&(n.planModeToolset=null)}),f>=n.length-1&&p(Math.max(0,n.length-2))},b=e=>{let t=n[e];o(e=>{e.defaultToolset=t.name})},x=e=>{let t=n[e];o(e=>{e.planModeToolset=t.name})};if(H((e,r)=>{r.escape?t():r.upArrow?p(e=>Math.max(0,e-1)):r.downArrow?p(e=>Math.min(n.length-1,e+1)):r.return&&n.length>0?(h(f),_(!1)):e===`n`?v():e===`x`&&n.length>0?y(f):e===`d`&&n.length>0?b(f):e===`p`&&n.length>0&&x(f)},{isActive:g}),m!==null)return J(Dt,{toolsetIndex:m,onBack:()=>{h(null),_(!0)}});let S=e=>e.allowedTools===`*`?`All tools`:e.allowedTools.length===0?`No tools`:`${e.allowedTools.length} tool${e.allowedTools.length===1?``:`s`}`;return Y(B,{flexDirection:`column`,children:[J(X,{children:`Toolsets`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new toolset`}),n.length>0&&J(V,{dimColor:!0,children:`d to set as default toolset`}),n.length>0&&J(V,{dimColor:!0,children:`p to set as plan mode toolset`}),n.length>0&&J(V,{dimColor:!0,children:`x to delete a toolset`}),n.length>0&&J(V,{dimColor:!0,children:`enter to edit toolset`}),J(V,{dimColor:!0,children:`esc to go back`})]}),n.length===0?J(V,{children:`No toolsets created yet. Press n to create one.`}):J(B,{flexDirection:`column`,children:n.map((e,t)=>{let n=e.name===r,a=e.name===i,o=f===t,s;return o&&(s=`yellow`),Y(B,{flexDirection:`row`,children:[Y(V,{color:s,children:[o?`❯ `:` `,e.name,` `]}),Y(V,{color:s,children:[`(`,S(e),`)`]}),n&&J(V,{color:d,children:` ⏵⏵ accept edits`}),a&&J(V,{color:u,children:` ⏸ plan mode`})]},t)})})]})}function kt({onBack:e}){let{settings:t,updateSettings:n}=W($),[r,i]=K(`plan`),[a,o]=K(!1),[s,c]=K(0),l=t.subagentModels||{plan:null,explore:null,generalPurpose:null},u=[{id:`plan`,title:`Plan Agent`,description:`The agent responsible for creating implementation plans.`},{id:`explore`,title:`Explore Agent`,description:`The agent specialized for exploring codebases.`},{id:`generalPurpose`,title:`General-purpose Agent`,description:`The agent used for general multi-step tasks.`}],d=[{label:`Default (Inherited)`,value:null},{label:`sonnet`,value:`sonnet`},{label:`haiku`,value:`haiku`},{label:`opus`,value:`opus`},{label:`sonnet[1m]`,value:`sonnet[1m]`}];return H((t,f)=>{if(a){if(f.escape)o(!1);else if(f.upArrow)c(e=>e>0?e-1:d.length-1);else if(f.downArrow)c(e=>e<d.length-1?e+1:0);else if(f.return){let e=d[s].value;n(t=>{t.subagentModels||={plan:null,explore:null,generalPurpose:null},t.subagentModels[r]=e}),o(!1)}}else if(f.escape)e();else if(f.upArrow){let e=u.findIndex(e=>e.id===r);i(u[e>0?e-1:u.length-1].id)}else if(f.downArrow){let e=u.findIndex(e=>e.id===r);i(u[e<u.length-1?e+1:0].id)}else if(t===` `||f.return){let e=l[r],t=d.findIndex(t=>t.value===e);c(t>=0?t:0),o(!0)}}),a?Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:Y(X,{children:[`Select Model for`,` `,u.find(e=>e.id===r)?.title]})}),d.map((e,t)=>{let n=t===s;return J(B,{children:Y(V,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,e.label,e.value?Y(V,{dimColor:!0,children:[` (`,e.value,`)`]}):null]})},t)})]}):Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(X,{children:`Subagent Model Settings`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Configure which Claude model each subagent uses. Use arrow keys to navigate, enter or space to change a model, and escape to go back.`})}),u.map(e=>{let t=e.id===r,n=l[e.id],i=d.find(e=>e.value===n)?.label||n||`Default`;return Y(B,{flexDirection:`column`,marginBottom:1,children:[J(B,{children:Y(V,{color:t?`cyan`:void 0,children:[t?`❯ `:` `,J(V,{bold:!0,children:e.title})]})}),J(B,{marginLeft:4,children:J(V,{dimColor:!0,children:e.description})}),J(B,{marginLeft:4,children:Y(V,{children:[`Current: `,J(V,{color:`green`,children:i})]})})]},e.id)})]})}function At({onBack:t}){let{settings:n,updateSettings:r}=W($),i=n.claudeMdAltNames??[],[a,o]=K(0),[s,c]=K(!1),[l,u]=K(``),[d,f]=K(!1);return H((n,p)=>{if(s||d){p.return&&l.trim()?(d?(r(e=>{e.claudeMdAltNames||=[],e.claudeMdAltNames.push(l.trim())}),f(!1)):(r(e=>{e.claudeMdAltNames&&(e.claudeMdAltNames[a]=l.trim())}),c(!1)),u(``)):p.escape?(u(``),c(!1),f(!1)):p.backspace||p.delete?u(e=>e.slice(0,-1)):n&&u(e=>e+n);return}p.escape?t():p.upArrow?i.length>0&&o(e=>e>0?e-1:i.length-1):p.downArrow?i.length>0&&o(e=>e<i.length-1?e+1:0):n===`e`?i.length>0&&(u(i[a]),c(!0)):n===`d`?i.length>0&&(r(e=>{e.claudeMdAltNames&&=e.claudeMdAltNames.filter((e,t)=>t!==a)}),a>=i.length-1&&o(Math.max(0,i.length-2))):n===`n`?(f(!0),u(``)):p.ctrl&&n===`r`?(r(t=>{t.claudeMdAltNames=[...e.claudeMdAltNames??[]]}),o(0)):n===`u`||p.shift&&p.upArrow?i.length>1&&a>0&&(r(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[a-1],t[a]]=[t[a],t[a-1]]}),o(e=>e-1)):(n===`j`||p.shift&&p.downArrow)&&i.length>1&&a<i.length-1&&(r(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[a],t[a+1]]=[t[a+1],t[a]]}),o(e=>e+1))}),Y(B,{flexDirection:`column`,children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`CLAUDE.md Alternative Names`}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`changes auto-saved`}),J(V,{dimColor:!0,children:`esc to go back`})]})]}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`When Claude Code looks for CLAUDE.md and doesn't find it, it will try these alternative filenames in order. This lets you use AGENTS.md (and other file names).`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`e to edit · d to delete · n to add new · u/j to move up/down · ctrl+r to reset`})}),Y(B,{flexDirection:`column`,children:[i.length===0?J(V,{children:`No alternative names configured. Press n to add one.`}):J(q,{children:(()=>{let e=Math.max(0,a-6),t=Math.min(i.length,e+12),n=Math.max(0,t-12),r=i.slice(n,t);return Y(q,{children:[n>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,n,` more above`]}),r.map((e,t)=>{let r=n+t,i=r===a;return Y(V,{color:i?`cyan`:void 0,children:[i?`❯ `:` `,e]},r)}),t<i.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,i.length-t,` more below`]})]})})()}),d&&Y(B,{alignItems:`center`,children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:l})})]}),s&&Y(B,{marginTop:1,alignItems:`center`,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:l})})]})]})]})}const jt=e=>{let t=ke.join(P,e),n;try{n=Oe.readFileSync(t,`utf8`)}catch{return null}let r=Me(n,{delimiters:[`<!--`,`-->`]}),i=r.data,a=(r.content??``).replace(/^\n+/,``).replace(/\n+$/,``),o=e.replace(/\.md$/,``),s=typeof i.name==`string`?i.name:o,c=typeof i.description==`string`?i.description:``,l;return l=a.trim().length===0?`suppressed`:`default`,{id:o,filename:e,name:s,description:c,state:l,body:a}},Mt=()=>{if(!Oe.existsSync(P))return[];let e=Oe.readdirSync(P).filter(e=>e.endsWith(`.md`)).sort(),t=[];for(let n of e){let e=jt(n);e&&t.push(e)}return t},Nt={default:void 0,customized:`cyan`,suppressed:`green`,missing:`red`},Pt={default:`·`,customized:`◆`,suppressed:`☑`,missing:`?`},Ft={default:`default`,customized:`customized`,suppressed:`suppressed`,missing:`missing`};function It({onSubmit:e}){let{settings:t,updateSettings:n}=W($),[i,a]=K(0),[o,s]=K([]),[c,l]=K(!1),[u,d]=K(0);G(()=>{s(Mt())},[u]);let f=t.misc?.suppressDeferredTools??!1,p=o.length,m=Math.max(0,p-1),h=Se(()=>i<8?0:Math.min(i-8+1,Math.max(0,p-8)),[i,p]),g=o.slice(h,h+8),_=h>0,v=h+8<p;if(H((t,s)=>{if(c){s.return?(n(e=>{e.misc?e.misc.suppressDeferredTools=!0:e.misc={suppressDeferredTools:!0}}),l(!1)):s.escape&&l(!1);return}if(s.escape){e();return}if(s.upArrow)a(e=>Math.max(0,e-1));else if(s.downArrow)a(e=>Math.min(m,e+1));else if(t===`o`||s.return){let e=o[i];e&&r(ke.join(P,e.filename))}else if(t===`d`){let e=o[i];if(e)try{Oe.unlinkSync(ke.join(P,e.filename)),d(e=>e+1)}catch{}}else t===`r`?d(e=>e+1):t===`f`&&(f?n(e=>{e.misc&&(e.misc.suppressDeferredTools=!1)}):l(!0))}),c)return J(B,{flexDirection:`column`,paddingX:2,children:Y(B,{borderStyle:`double`,borderColor:`yellow`,padding:2,flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:`yellow`,children:`FOOTGUN TOGGLE`})}),Y(B,{marginBottom:1,flexDirection:`column`,children:[Y(V,{children:[`Suppressing this hides MCP servers, Cron jobs, EnterPlanMode, WebFetch, Monitor, and other `,J(V,{bold:!0,children:`deferred`}),` tools from the model.`]}),Y(V,{children:[`The model only learns these tools exist via this announcement. Without it, it cannot call `,J(V,{bold:!0,children:`ToolSearch`}),` to load their schemas and will report capabilities as unavailable.`]})]}),J(B,{children:Y(V,{children:[`Press `,J(V,{color:`red`,children:`Enter`}),` to enable,`,` `,J(V,{color:`green`,children:`Escape`}),` to cancel`]})})]})});let y=P.replace(we.homedir(),`~`),b=o[i];return Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(X,{children:`System Reminders`})}),Y(B,{marginBottom:1,flexDirection:`column`,children:[Y(V,{children:[`Edit per-turn / per-event `,J(V,{bold:!0,children:`<system-reminder>`}),` `,`injections via `,J(V,{bold:!0,children:`.md files`}),` in `,y,`/`]}),J(V,{dimColor:!0,children:`Empty body = suppress · Custom body = override · Files seeded on first --apply. Re-apply after editing.`})]}),p===0?J(B,{flexDirection:`column`,marginBottom:1,children:Y(V,{color:`yellow`,children:[`No override files yet. Run `,J(V,{bold:!0,children:`tweakcc --apply`}),` to seed defaults.`]})}):Y(q,{children:[_&&J(B,{children:Y(V,{dimColor:!0,children:[` ↑ `,h,` more above`]})}),g.map((e,t)=>{let n=h+t===i;return Y(B,{flexDirection:`row`,children:[J(B,{width:2,children:J(V,{color:n?`cyan`:void 0,children:n?`❯ `:` `})}),J(B,{width:3,children:J(V,{color:Nt[e.state],children:Pt[e.state]})}),J(B,{width:14,children:J(V,{dimColor:!0,color:Nt[e.state],children:Ft[e.state]})}),J(B,{flexGrow:1,children:J(V,{bold:n,color:n?`cyan`:void 0,children:e.name})})]},e.id)}),v&&J(B,{children:Y(V,{dimColor:!0,children:[` `,`↓ `,p-h-8,` more below`]})})]}),b&&J(B,{flexDirection:`column`,marginTop:1,paddingX:1,children:J(V,{dimColor:!0,children:b.description})}),Y(B,{marginTop:1,flexDirection:`column`,children:[Y(V,{dimColor:!0,children:[`↑/↓ navigate · `,J(V,{bold:!0,children:`o`}),`/Enter open in editor ·`,` `,J(V,{bold:!0,children:`d`}),` delete (reset on next --apply) ·`,` `,J(V,{bold:!0,children:`r`}),` reload`]}),Y(V,{dimColor:!0,children:[J(V,{bold:!0,children:`f`}),` toggle deferred-tools footgun [`,J(V,{color:f?`red`:void 0,bold:f,children:f?`SUPPRESSED`:`vanilla`}),`] · Esc go back`]})]})]})}const Lt=[`on`,`name-only`,`user-invocable-only`,`off`],Rt={on:`on (full description)`,"name-only":`name-only (model sees no description)`,"user-invocable-only":`user-invocable (hidden from model, /name still works)`,off:`off (not loaded)`},zt={on:void 0,"name-only":`cyan`,"user-invocable-only":`yellow`,off:`red`},Bt={on:`◉`,"name-only":`◐`,"user-invocable-only":`◑`,off:`○`},Vt=ke.join(we.homedir(),`.claude`,`settings.json`),Ht=[ke.join(we.homedir(),`.claude`,`skills`),ke.join(we.homedir(),`.agents`,`skills`)],Ut=e=>Lt[(Lt.indexOf(e)+1)%Lt.length],Wt=e=>Lt[(Lt.indexOf(e)-1+Lt.length)%Lt.length],Gt=()=>{let e=new Set;for(let t of Ht)if(Oe.existsSync(t))try{let n=Oe.readdirSync(t,{withFileTypes:!0});for(let t of n)(t.isDirectory()||t.isSymbolicLink())&&e.add(t.name)}catch{}return[...e].sort()},Kt=()=>{try{let e=Oe.readFileSync(Vt,`utf8`);return{skillOverrides:JSON.parse(e).skillOverrides??{}}}catch{return{skillOverrides:{}}}},qt=e=>{let t={};try{t=JSON.parse(Oe.readFileSync(Vt,`utf8`))}catch{}t.skillOverrides=e,Oe.writeFileSync(Vt,JSON.stringify(t,null,2))};function Jt({onSubmit:e}){let[t,n]=K({}),[r,i]=K([]),[a,o]=K(0),[s,c]=K(!1);G(()=>{i(Gt()),n(Kt().skillOverrides)},[]);let l=Se(()=>r.map(e=>({name:e,state:t[e]??`on`})),[r,t]),u=l.length,d=Math.max(0,u-1),f=Se(()=>a<10?0:Math.min(a-10+1,Math.max(0,u-10)),[a,u]),p=l.slice(f,f+10),m=(e,r)=>{let i=l[e]?.name;if(!i)return;let a={...t};r===`on`?delete a[i]:a[i]=r,n(a),qt(a),c(!0),setTimeout(()=>c(!1),1500)};H((t,n)=>{if(n.escape||n.return&&u===0){e();return}n.upArrow?o(e=>Math.max(0,e-1)):n.downArrow?o(e=>Math.min(d,e+1)):t===` `||n.rightArrow?m(a,Ut(l[a]?.state??`on`)):n.leftArrow?m(a,Wt(l[a]?.state??`on`)):t===`0`?m(a,`on`):t===`x`&&m(a,`off`)});let h=l[a];return Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(X,{children:`Skills (per-skill skillOverrides)`})}),Y(B,{marginBottom:1,flexDirection:`column`,children:[Y(V,{children:[`Writes `,J(V,{bold:!0,children:`skillOverrides`}),` to`,` `,J(V,{color:`cyan`,children:`~/.claude/settings.json`}),` — CC reads this natively, no tweakcc patch needed.`]}),J(V,{dimColor:!0,children:`Each skill: on / name-only / user-invocable-only / off. CC honors immediately; no --apply required.`})]}),u===0?J(B,{children:Y(V,{color:`yellow`,children:[`No skills found in`,` `,Ht.map(e=>e.replace(we.homedir(),`~`)).join(` or `),`.`]})}):Y(q,{children:[f>0&&J(B,{children:Y(V,{dimColor:!0,children:[` ↑ `,f,` more above`]})}),p.map((e,t)=>{let n=f+t===a;return Y(B,{flexDirection:`row`,children:[J(B,{width:2,children:J(V,{color:n?`cyan`:void 0,children:n?`❯ `:` `})}),J(B,{width:3,children:J(V,{color:zt[e.state],children:Bt[e.state]})}),J(B,{width:26,children:J(V,{dimColor:!0,color:zt[e.state],children:e.state})}),J(B,{flexGrow:1,children:J(V,{bold:n,color:n?`cyan`:void 0,children:e.name})})]},e.name)}),f+10<u&&J(B,{children:Y(V,{dimColor:!0,children:[` `,`↓ `,u-f-10,` more below`]})})]}),h&&J(B,{flexDirection:`column`,marginTop:1,children:J(V,{dimColor:!0,children:Rt[h.state]})}),Y(B,{marginTop:1,flexDirection:`column`,children:[Y(V,{dimColor:!0,children:[`↑/↓ navigate · space/→/← cycle state · `,J(V,{bold:!0,children:`0`}),` set on ·`,` `,J(V,{bold:!0,children:`x`}),` set off · Esc back`]}),s&&J(V,{color:`green`,children:`✓ saved to settings.json`})]})]})}const $=be({settings:e,updateSettings:e=>{},changesApplied:!1,ccVersion:``});function Yt({startupCheckInfo:e,configMigrated:t,invocationCommand:n,initialConfig:i}){let[a,s]=K(i),[c,l]=K(!i.hidePiebaldAnnouncement),u=xe(e=>{let t=JSON.parse(JSON.stringify(a.settings));e(t),s(e=>({...e,settings:t,changesApplied:!1})),ae(e=>{e.settings=t,e.changesApplied=!1})},[a.settings]),[d,f]=K(null),[p,m]=K(null);G(()=>{e.wasUpdated&&e.oldVersion&&(m({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
|
|
2
|
+
import{$ as e,A as t,B as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,L as u,M as d,N as f,P as p,Q as m,R as h,T as g,U as _,V as v,W as y,X as b,Y as x,Z as S,_ as C,a as w,b as ee,d as T,et as E,g as D,h as O,i as k,j as A,k as j,l as M,m as te,n as N,o as P,p as F,r as ne,s as re,t as ie,u as ae,v as oe,w as se,x as ce,y as I,z as L}from"./config-B1Mrn1vp.mjs";import{a as R,c as le,d as ue,l as de,n as fe,o as pe,s as z,t as me,u as he}from"./content-bCX2ah6I.mjs";import{Box as B,Text as V,render as ge,useInput as H}from"ink";import{Command as _e}from"commander";import U from"chalk";import ve,{Fragment as ye,createContext as be,useCallback as xe,useContext as W,useEffect as G,useMemo as Se,useRef as Ce,useState as K}from"react";import*as we from"node:os";import Te from"ink-link";import*as Ee from"node:fs/promises";import De from"node:fs/promises";import*as Oe from"node:fs";import*as ke from"node:path";import{execSync as Ae,spawn as je}from"node:child_process";import Me from"gray-matter";import{structuredPatch as Ne}from"diff";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import Pe from"process";import Fe from"cli-spinners";import*as Ie from"node:readline";var X=({children:e,...t})=>Y(V,{bold:!0,backgroundColor:`#ffd500`,color:`#000`,...t,children:[` `,e,` `]});const Le=[`\x1B[?25l\x1B[0m \x1B[38;2;0;0;0m \x1B[38;2;252;130;0m▂\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▇\x1B[38;2;254;131;0m\x1B[48;2;252;130;0m▇\x1B[48;2;252;130;0m▇▇\x1B[48;2;252;130;0m▇\x1B[0m\x1B[38;2;252;130;0m▇\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▂ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;254;131;0m▗\x1B[38;2;254;131;0m▆\x1B[48;2;254;131;0m \x1B[38;2;254;132;0m╶ \x1B[0m\x1B[38;2;254;131;0m▆\x1B[38;2;254;131;0m▖ \x1B[0m`,` \x1B[7m\x1B[38;2;254;131;0m▘\x1B[0m\x1B[38;2;11;6;0m\x1B[48;2;254;131;0m \x1B[38;2;254;216;182m\x1B[48;2;254;136;12m▃\x1B[38;2;254;249;246m\x1B[48;2;254;143;29m▅\x1B[38;2;254;253;253m\x1B[48;2;254;143;40m▆\x1B[38;2;254;254;253m\x1B[48;2;254;152;68m▆▆▆\x1B[38;2;254;253;252m\x1B[48;2;254;141;34m▆\x1B[38;2;254;247;242m\x1B[48;2;254;140;24m▅\x1B[38;2;254;224;199m\x1B[48;2;254;140;20m▖\x1B[48;2;254;131;0m \x1B[0m\x1B[7m\x1B[38;2;254;131;0m▝\x1B[0m \x1B[0m`,`\x1B[7m\x1B[38;2;251;127;0m▌\x1B[0m\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[38;2;252;128;0m\x1B[48;2;254;131;0m▃\x1B[38;2;252;129;0m▂\x1B[38;2;253;130;0m▁\x1B[38;2;249;135;16m\x1B[48;2;253;226;202m▋\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┈\x1B[48;2;246;246;245m┈\x1B[38;2;47;47;47m\x1B[48;2;244;244;243m▂\x1B[38;2;112;112;112m\x1B[48;2;251;251;251m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m▁╌▝\x1B[38;2;254;254;253m\x1B[48;2;254;254;254m▋\x1B[38;2;254;254;254m\x1B[48;2;254;253;252m┈\x1B[38;2;252;209;168m\x1B[48;2;251;129;0m▍\x1B[38;2;253;129;0m\x1B[48;2;254;131;0m▂\x1B[38;2;252;128;0m▃\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[0m\x1B[38;2;251;127;0m▌\x1B[0m`,`\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▏\x1B[38;2;245;118;0m\x1B[48;2;248;122;0m▄\x1B[38;2;247;121;0m\x1B[48;2;247;122;0m┈\x1B[38;2;106;68;38m\x1B[48;2;245;123;2m▃\x1B[38;2;39;33;28m\x1B[48;2;211;109;6m▅\x1B[38;2;27;20;12m\x1B[48;2;237;237;237m▌\x1B[48;2;254;254;253m \x1B[38;2;90;90;89m\x1B[48;2;231;230;230m▝\x1B[38;2;215;215;214m\x1B[48;2;48;48;48m▁\x1B[38;2;203;203;202m\x1B[48;2;42;42;42m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┇╴\x1B[38;2;253;252;252m▂\x1B[38;2;251;250;250m\x1B[48;2;253;253;253m▃\x1B[38;2;249;249;248m\x1B[48;2;252;252;251m▄\x1B[38;2;249;248;248m\x1B[48;2;237;118;0m▍\x1B[38;2;246;121;0m\x1B[48;2;250;125;0m▄\x1B[38;2;246;119;0m\x1B[48;2;249;124;0m▄\x1B[38;2;245;118;0m\x1B[48;2;248;123;0m▄\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▉\x1B[0m`,`\x1B[38;2;238;108;0m\x1B[48;2;237;109;0m▏\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;233;109;2m\x1B[48;2;125;73;29m▇\x1B[38;2;225;104;1m\x1B[48;2;50;32;18m▄\x1B[38;2;62;29;2m\x1B[48;2;239;237;237m▌\x1B[38;2;254;253;253m\x1B[48;2;254;254;254m┻\x1B[38;2;254;254;253m▊\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;253;253;252m▂\x1B[38;2;251;251;251m\x1B[48;2;254;253;253m▃\x1B[38;2;249;249;249m\x1B[48;2;252;252;252m▄\x1B[38;2;247;247;247m\x1B[48;2;250;250;250m▄\x1B[38;2;245;245;244m\x1B[48;2;248;248;248m▄\x1B[38;2;243;243;242m\x1B[48;2;246;246;245m▄\x1B[38;2;243;242;242m\x1B[48;2;230;109;0m▍\x1B[38;2;239;111;0m\x1B[48;2;243;116;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;237;108;0m\x1B[48;2;238;108;0m▉\x1B[0m`,`\x1B[7m\x1B[38;2;231;98;0m▌\x1B[0m\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[38;2;231;99;0m\x1B[48;2;235;105;0m▄\x1B[38;2;232;100;0m\x1B[48;2;236;105;0m▄\x1B[38;2;232;101;0m\x1B[48;2;236;106;0m▄\x1B[38;2;223;99;0m\x1B[48;2;247;238;235m▌\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;252;252;251m▃\x1B[38;2;250;250;250m\x1B[48;2;253;253;252m▄\x1B[38;2;248;248;247m\x1B[48;2;251;251;250m▄\x1B[38;2;246;245;245m\x1B[48;2;249;248;248m▄\x1B[38;2;243;243;243m\x1B[48;2;246;246;246m▄\x1B[38;2;241;241;241m\x1B[48;2;244;244;244m▄\x1B[38;2;239;239;238m\x1B[48;2;242;242;242m▄\x1B[38;2;237;237;236m\x1B[48;2;240;240;239m▄\x1B[38;2;237;236;236m\x1B[48;2;223;99;0m▍\x1B[38;2;232;100;0m\x1B[48;2;236;106;0m▄\x1B[38;2;231;100;0m\x1B[48;2;235;105;0m▄\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[0m\x1B[38;2;231;98;0m▌\x1B[0m`,` \x1B[7m\x1B[38;2;224;89;0m▖\x1B[0m\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[38;2;225;90;0m\x1B[48;2;228;95;0m▄\x1B[38;2;225;91;0m\x1B[48;2;229;96;0m▄\x1B[38;2;217;90;1m\x1B[48;2;97;77;70m▌\x1B[38;2;70;70;70m\x1B[48;2;207;207;207m▆\x1B[38;2;66;65;65m\x1B[48;2;228;228;227m▄\x1B[38;2;66;66;66m\x1B[48;2;233;232;232m▂\x1B[38;2;169;169;169m\x1B[48;2;243;243;243m▁\x1B[38;2;240;239;239m\x1B[48;2;243;242;242m▄\x1B[38;2;238;237;237m\x1B[48;2;241;240;240m▄\x1B[38;2;235;235;235m\x1B[48;2;238;238;238m▄\x1B[38;2;233;233;233m\x1B[48;2;236;236;236m▄\x1B[38;2;231;231;230m\x1B[48;2;234;234;233m▄\x1B[38;2;231;230;230m\x1B[48;2;216;89;0m▍\x1B[38;2;225;90;0m\x1B[48;2;229;95;0m▄\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[0m\x1B[7m\x1B[38;2;224;89;0m▗\x1B[0m \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;217;80;0m▝\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m\x1B[48;2;221;86;0m▄\x1B[38;2;197;78;9m\x1B[48;2;66;66;65m▋\x1B[38;2;65;65;64m\x1B[48;2;60;60;60m▘\x1B[38;2;52;52;51m\x1B[48;2;56;56;56m▗\x1B[38;2;45;45;45m\x1B[48;2;50;50;49m▗\x1B[38;2;42;42;42m\x1B[48;2;46;46;46m┈\x1B[38;2;41;41;41m\x1B[48;2;203;202;202m▆\x1B[38;2;38;38;38m\x1B[48;2;218;218;218m▄\x1B[38;2;45;45;45m\x1B[48;2;221;221;221m▂\x1B[38;2;229;229;229m┊\x1B[38;2;225;225;225m\x1B[48;2;228;228;227m▄\x1B[38;2;225;224;224m\x1B[48;2;209;79;0m▍\x1B[0m\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m▘ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[7m\x1B[38;2;191;73;0m▆\x1B[38;2;191;73;0m▄\x1B[38;2;56;55;55m▃\x1B[38;2;46;46;46m▁\x1B[0m\x1B[38;2;20;20;20m\x1B[48;2;42;42;42m▁\x1B[38;2;36;36;36m\x1B[48;2;35;34;34m╴\x1B[38;2;23;23;23m\x1B[48;2;29;29;28m▁\x1B[38;2;10;10;10m\x1B[48;2;22;22;22m▁\x1B[0m\x1B[7m\x1B[38;2;15;15;15m▁\x1B[38;2;22;22;21m▃\x1B[38;2;154;154;154m▅\x1B[38;2;175;116;83m▇\x1B[0m\x1B[38;2;17;15;14m \x1B[0m`,`\x1B[?25h\x1B[0m`];var Re=()=>Y(B,{flexDirection:`row`,height:10,alignItems:`center`,borderStyle:`bold`,borderBottom:!1,borderTop:!1,borderRight:!1,borderColor:`#ff8400`,marginBottom:1,children:[Y(B,{marginBottom:1,paddingLeft:1,flexDirection:`column`,flexGrow:1,children:[J(V,{bold:!0,color:`#ff8400`,children:`Piebald is released!`}),J(V,{children:` `}),Y(V,{children:[`We've released `,J(V,{bold:!0,children:`Piebald`}),`, the ultimate agentic AI developer experience.`]}),Y(V,{children:[`Download it and try it out for free!`,` `,J(Te,{url:`https://piebald.ai/`,fallback:!1,children:J(V,{color:`#ff8400`,children:`https://piebald.ai/`})})]}),J(V,{children:` `}),J(V,{dimColor:!0,color:`gray`,children:`press 'h' to hide`})]}),J(B,{width:22,flexShrink:0,flexDirection:`column`,alignItems:`center`,children:Le.map((e,t)=>J(V,{children:e},t))})]});let Z=function(e){return e.THEMES=`Themes`,e.THINKING_VERBS=`Thinking verbs`,e.THINKING_STYLE=`Thinking style`,e.USER_MESSAGE_DISPLAY=`User message display`,e.INPUT_PATTERN_HIGHLIGHTERS=`Input pattern highlighters`,e.MISC=`Misc`,e.TOOLSETS=`Toolsets`,e.SUBAGENT_MODELS=`Subagent models`,e.CLAUDE_MD_ALT_NAMES=`CLAUDE.md alternative names`,e.SYSTEM_REMINDERS=`System reminders (injection lobotomy)`,e.SKILLS=`Skills (per-skill on/name-only/user-invocable/off)`,e.VIEW_SYSTEM_PROMPTS=`View system prompts`,e.RESTORE_ORIGINAL=`Restore original Claude Code (preserves config.json)`,e.OPEN_CONFIG=`Open config.json`,e.OPEN_CLI=`Open Claude Code's cli.js`,e.EXIT=`Exit`,e}({});function ze({items:e,selectedIndex:t,onSelect:n,onSubmit:r}){return H((i,a)=>{a.upArrow?n(t>0?t-1:e.length-1):a.downArrow?n(t<e.length-1?t+1:0):a.return&&r(e[t].name)}),J(B,{flexDirection:`column`,children:e.map((e,n)=>J(B,{children:Y(V,{children:[Y(V,{bold:n===t,color:n===t?`cyan`:void 0,...n===t?e.selectedStyles??{}:e.styles??{},children:[n===t?`❯ `:` `,e.name]}),e.desc&&n===t&&Y(V,{dimColor:!0,bold:!1,children:[` \x1B[0;2m`,`- `,e.desc]})]})},n))})}const Be=[{name:Z.THEMES,desc:`Modify Claude Code's built-in themes or create your own`},{name:Z.THINKING_VERBS,desc:`Customize the list of verbs that Claude Code uses when it's working`},{name:Z.THINKING_STYLE,desc:`Choose custom spinners`},{name:Z.USER_MESSAGE_DISPLAY,desc:`Customize how user messages are displayed`},{name:Z.INPUT_PATTERN_HIGHLIGHTERS,desc:`Create custom highlighters for patterns in your input`},{name:Z.MISC,desc:`Miscellaneous settings (input box border, etc.)`},{name:Z.TOOLSETS,desc:`Manage toolsets to control which tools are available`},{name:Z.SUBAGENT_MODELS,desc:`Configure which Claude model each subagent uses (Plan, Explore, etc.)`},{name:Z.CLAUDE_MD_ALT_NAMES,desc:`Configure alternative filenames for CLAUDE.md (e.g., AGENTS.md)`},{name:Z.SYSTEM_REMINDERS,desc:`Suppress per-turn <system-reminder> injections (skills list, MCP instructions, claudeMd wrapper, etc.)`},{name:Z.SKILLS,desc:`Per-skill listing control (writes settings.json skillOverrides — no patch needed)`},{name:Z.VIEW_SYSTEM_PROMPTS,desc:`Opens the system prompts directory where you can customize Claude Code's system prompts`}],Ve=[{name:Z.RESTORE_ORIGINAL,desc:`Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)`},{name:Z.OPEN_CONFIG,desc:`Opens your tweakcc config file (${ne})`},{name:Z.OPEN_CLI,desc:`Opens Claude Code's cli.js file`},{name:Z.EXIT,desc:`Bye!`}];var He=({onSubmit:e})=>{let t=[...Be,...Ve],[n,r]=K(0);return J(ze,{items:t,selectedIndex:n,onSelect:r,onSubmit:t=>e(t)})};const Ue=()=>Y(B,{flexDirection:`row`,children:[J(X,{children:`tweakcc`}),J(V,{children:` (by `}),J(Te,{url:`https://piebald.ai`,fallback:!1,children:J(V,{color:`#ff8400`,bold:!0,children:`Piebald`})}),J(V,{children:`)`})]}),We=()=>J(B,{children:Y(V,{color:`yellow`,children:[`⭐ `,J(V,{bold:!0,children:`Star the repo at `}),J(Te,{url:`https://github.com/skrabe/tweakcc-fixed`,fallback:!1,children:J(V,{bold:!0,color:`cyan`,children:`https://github.com/skrabe/tweakcc-fixed`})}),J(V,{bold:!0,children:` if you find this useful!`}),` ⭐`]})}),Ge=({notification:e})=>J(B,{borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:`bold`,borderColor:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,paddingLeft:1,flexDirection:`column`,children:J(V,{color:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,children:e.message})}),Ke=({onSubmit:e,notification:t,configMigrated:n,showPiebaldAnnouncement:r,changesApplied:i,invocationCommand:a})=>Y(B,{flexDirection:`column`,gap:1,children:[n&&J(B,{children:J(V,{color:`blue`,bold:!0,children:"Note that in tweakcc v3.2.0+, `ccInstallationDir` config is deprecated. You are now migrated to `ccInstallationPath` which supports npm and native installs."})}),J(Ue,{}),J(B,{children:Y(V,{children:[J(V,{bold:!0,children:`Customize your Claude Code installation.`}),` `,Y(V,{dimColor:!0,children:[`Settings will be saved to `,N.replace(we.homedir(),`~`),`/config.json.`]})]})}),J(r?Re:We,{}),t&&J(Ge,{notification:t}),!i&&!t&&J(Ge,{notification:{message:`Your changes are configured but not applied.\nRun \`${a} --apply\` to apply your customizations!`,type:`info`}}),J(He,{onSubmit:e})]});function Q({color:e,backgroundColor:t,bold:n,dimColor:r,children:i}){let a=e?.startsWith(`ansi:`),o=t?.startsWith(`ansi:`);if(a||o){if(ve.Children.toArray(i).some(e=>ve.isValidElement(e)))return J(V,{children:i});let s=U;if(a){let t=e.slice(5);s=s[t]||s}if(o){let e=t.slice(5),n=e.startsWith(`bg`)?e:`bg${e.charAt(0).toUpperCase()}${e.slice(1)}`;s=s[n]||s}n&&(s=s.bold),r&&(s=s.dim);let c=ve.Children.toArray(i).map(e=>typeof e==`string`||typeof e==`number`?String(e):``).join(``);return J(V,{children:s(c)})}return J(V,{color:e,backgroundColor:t,bold:n,dimColor:r,children:i})}function qe({text:e,nonShimmerColors:t,shimmerColors:n,shimmerWidth:r=3,updateDuration:i=50,restartPoint:a=10}){let[o,s]=K(0);return G(()=>{let t=setInterval(()=>{s(t=>{let n=t+1;return n>=e.length+a?-r:n})},i);return()=>clearInterval(t)},[e.length,a,i]),t.length===n.length?J(V,{children:e.split(``).map((i,a)=>{let s=a>=o&&a<o+r&&o<e.length,c=a%t.length;return J(V,{color:s?n[c]:t[c],children:i},a)})}):(console.error(`UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length`),J(V,{children:e}))}const Je=Pe.cwd();function Ye({theme:e}){let{ccVersion:t}=W($);return Y(B,{flexDirection:`column`,paddingLeft:1,children:[J(B,{marginBottom:1,children:Y(V,{bold:!0,children:[`Preview: `,e.name]})}),J(B,{borderStyle:`single`,borderColor:`gray`,paddingX:1,children:Y(B,{flexDirection:`column`,children:[Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:` ▐`}),J(V,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`▛███▜`}),Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:`▌ `}),` `,J(V,{bold:!0,children:`Claude Code`}),` `,t?`v${t}`:`v2.0.14`]})]}),Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:`▝▜`}),J(V,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`█████`}),J(Q,{color:e.colors.clawd_body,children:`▛▘`}),` `,ce(),` · `,I()]}),Y(Q,{color:e.colors.clawd_body,children:[` `,`▘▘ ▝▝`,` `,Je]}),Y(V,{children:[Y(Q,{color:e.colors.success,children:[`Login successful. Press`,` `]}),J(Q,{bold:!0,color:e.colors.success,children:`Enter`}),Y(Q,{color:e.colors.success,children:[` `,`to continue…`]})]})]}),J(V,{children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[`│ 1 function greet() `,`{`,` `,`│`]}),Y(V,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:`- console.log("`}),J(Q,{backgroundColor:e.colors.diffRemovedWord,children:`Hello, World!`}),J(Q,{backgroundColor:e.colors.diffRemoved,children:`");`}),` `,`│`]}),Y(V,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:`+ console.log("`}),J(Q,{backgroundColor:e.colors.diffAddedWord,children:`Hello, Claude!`}),J(Q,{backgroundColor:e.colors.diffAdded,children:`");`}),` `,`│`]}),J(Q,{color:e.colors.warning,children:`╭─────────────────────────────────────────────╮`}),Y(Q,{color:e.colors.warning,children:[`│ Do you trust the files in this folder?`,` `,`│`]}),Y(V,{children:[J(Q,{color:e.colors.warning,children:`│ `}),J(V,{dimColor:!0,children:`Enter to confirm · Esc to exit`}),Y(Q,{color:e.colors.warning,children:[` `,`│`]})]}),J(Q,{color:e.colors.bashBorder,children:`───────────────────────────────────────────────`}),Y(V,{children:[J(Q,{color:e.colors.bashBorder,children:`!`}),J(V,{children:` ls`})]}),J(Q,{color:e.colors.promptBorder,children:`───────────────────────────────────────────────`}),J(V,{children:Y(V,{children:[`> list the dir`,` `,J(qe,{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})]})}),J(Q,{color:e.colors.planMode,children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[J(Q,{color:e.colors.planMode,children:`│ `}),Y(Q,{color:e.colors.permission,children:[`Ready to code?`,` `]}),J(V,{children:`Here is Claude's plan:`}),Y(Q,{color:e.colors.planMode,children:[` `,`│`]})]}),J(Q,{color:e.colors.permission,children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[J(Q,{color:e.colors.permission,children:`│ `}),J(V,{bold:!0,children:`Permissions:`}),` `,Y(Q,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[` `,`Allow`,` `]}),` `,`Deny`,` `,`Workspace`,` `,J(Q,{color:e.colors.permission,children:`│`})]}),J(V,{children:`> list the dir`}),Y(V,{children:[J(Q,{color:e.colors.error,children:`●`}),J(V,{children:` Update(__init__.py)`})]}),Y(V,{children:[J(V,{children:` ⎿ `}),J(Q,{color:e.colors.error,children:`User rejected update to __init__.py`})]}),Y(V,{children:[` `,`1`,` `,Y(Q,{backgroundColor:e.colors.diffRemovedDimmed,children:[`- import`,` `]}),J(Q,{backgroundColor:e.colors.diffRemovedWordDimmed,children:`os`})]}),Y(V,{children:[` `,`2`,` `,Y(Q,{backgroundColor:e.colors.diffAddedDimmed,children:[`+ import`,` `]}),J(Q,{backgroundColor:e.colors.diffAddedWordDimmed,children:`random`})]}),Y(V,{children:[J(Q,{color:e.colors.success,children:`●`}),J(V,{children:` List(.)`})]}),Y(V,{children:[J(V,{children:`●`}),J(V,{children:` The directory `}),J(Q,{color:e.colors.permission,children:`C:\\Users\\user`}),Y(V,{children:[` `,`contains `,J(V,{bold:!0,children:`123`}),` files.`]})]}),Y(V,{children:[J(Q,{color:e.colors.claude,children:`✻ Th`}),J(Q,{color:e.colors.claudeShimmer,children:`ink`}),J(Q,{color:e.colors.claude,children:`ing… `}),J(V,{children:`(esc to interrupt)`})]}),J(V,{children:J(Q,{color:e.colors.autoAccept,children:`⏵⏵ accept edits on (shift+tab to cycle)`})}),J(V,{children:J(Q,{color:e.colors.planMode,children:`⏸ plan mode on (shift+tab to cycle)`})}),J(V,{children:J(Q,{color:e.colors.ide,children:`◯ IDE connected ⧉ 44 lines selected`})})]})})]})}function Xe({colorKey:e,theme:t,bold:n=!1}){let r=t.colors[e];return e===`inverseText`?J(Q,{color:r,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith(`diff`)?J(Q,{backgroundColor:r,bold:n,color:t.colors.text,children:e}):J(Q,{color:r,bold:n,children:e})}function Ze({initialValue:e,onColorChange:t,onExit:n,colorKey:r,theme:a}){let o=$e(e)||{h:0,s:50,l:50},s=Qe(e)||{r:128,g:128,b:128},[c,l]=K(o),[u,d]=K(s),[f,p]=K(`hsl`),[m,h]=K(`h`),[_,v]=K(!1),[y,b]=K(!1);G(()=>{let t=$e(e),n=Qe(e);t&&n&&(v(!0),l(t),d(n),v(!1))},[e]),G(()=>{!_&&y&&t(`rgb(${u.r},${u.g},${u.b})`)},[c,u,_,y]),G(()=>{b(!0)},[]);let x=e=>{if(g(e)){let t=i(e),n=$e(t),r=Qe(t);n&&r&&(v(!0),l(n),d(r),v(!1))}};H((e,t)=>{if(e.length>1&&!t.ctrl&&!t.meta){x(e);return}t.return||t.escape?n():t.ctrl&&e===`a`?(p(e=>e===`hsl`?`rgb`:`hsl`),h(e=>f===`hsl`?e===`h`?`r`:e===`s`?`g`:`b`:e===`r`?`h`:e===`g`?`s`:`l`)):t.upArrow?h(f===`hsl`?e=>e===`h`?`l`:e===`s`?`h`:`s`:e=>e===`r`?`b`:e===`g`?`r`:`g`):t.downArrow||t.tab?h(f===`hsl`?e=>e===`h`?`s`:e===`s`?`l`:`h`:e=>e===`r`?`g`:e===`g`?`b`:`r`):t.leftArrow?S(t.shift||t.ctrl||t.meta?-10:-1):t.rightArrow&&S(t.shift||t.ctrl||t.meta?10:1)});let S=e=>{v(!0),f===`hsl`?l(t=>{let n={...t};m===`h`?n.h=Math.max(0,Math.min(359,t.h+e)):m===`s`?n.s=Math.max(0,Math.min(100,t.s+e)):m===`l`&&(n.l=Math.max(0,Math.min(100,t.l+e)));let[r,i,a]=w(n.h,n.s,n.l);return d({r,g:i,b:a}),n}):d(t=>{let n={...t};return m===`r`?n.r=Math.max(0,Math.min(255,t.r+e)):m===`g`?n.g=Math.max(0,Math.min(255,t.g+e)):m===`b`&&(n.b=Math.max(0,Math.min(255,t.b+e))),l(C(n.r,n.g,n.b)),n}),v(!1)},C=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===r?((i-a)/c+(i<a?6:0))/6:o===i?((a-r)/c+2)/6:((r-i)/c+4)/6),{h:Math.round(d*360),s:Math.round(u*100),l:Math.round(l*100)}},w=(e,t,n)=>{e/=360,t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e*6%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<1/6?(o=r,s=i,c=0):1/6<=e&&e<2/6?(o=i,s=r,c=0):2/6<=e&&e<3/6?(o=0,s=r,c=i):3/6<=e&&e<4/6?(o=0,s=i,c=r):4/6<=e&&e<5/6?(o=i,s=0,c=r):5/6<=e&&e<1&&(o=r,s=0,c=i),[Math.round((o+a)*255),Math.round((s+a)*255),Math.round((c+a)*255)]},ee=()=>{let e=[],t=[[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 n=0;n<40;n++){let r=n/39*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=r-i,[s,c,l]=t[i],[u,d,f]=t[a],p=Math.round(s+(u-s)*o),m=Math.round(c+(d-c)*o),h=Math.round(l+(f-l)*o);e.push(J(V,{backgroundColor:`rgb(${p},${m},${h})`,children:` `},n))}return e},T=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=w(c.h,n,c.l);e.push(J(V,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},E=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=w(c.h,c.s,n);e.push(J(V,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},D=()=>{let[e,t,n]=w(c.h,c.s,c.l);return`rgb(${e},${t},${n})`},O=(e,t,n)=>{let r=e=>e.toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},k=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${n},${u.g},${u.b})`,children:` `},t))}return e},A=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${u.r},${n},${u.b})`,children:` `},t))}return e},j=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${u.r},${u.g},${n})`,children:` `},t))}return e},M=(e,t)=>Math.round(e/t*39);return Y(B,{flexDirection:`column`,borderStyle:`single`,borderColor:`white`,padding:1,children:[Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Color Picker`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{color:`gray`,dimColor:!0,children:`←→ to adjust (shift/ctrl/cmd +10)`}),J(V,{color:`gray`,dimColor:!0,children:`↑↓ to change bar`}),J(V,{color:`gray`,dimColor:!0,children:`ctrl+a to switch rgb/hsl`}),J(V,{color:`gray`,dimColor:!0,children:`paste color from clipboard`}),J(V,{color:`gray`,dimColor:!0,children:`enter to exit (auto-saved)`}),J(V,{color:`gray`,dimColor:!0,children:`esc to save and exit`})]})]}),f===`hsl`?Y(q,{children:[Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`h`?`yellow`:`white`,children:[m===`h`?`❯ `:` `,`Hue (`,c.h,`°):`]})}),J(B,{children:ee().map((e,t)=>J(ye,{children:t===M(c.h,360)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`s`?`yellow`:`white`,children:[m===`s`?`❯ `:` `,`Saturation (`,c.s,`%):`]})}),J(B,{children:T().map((e,t)=>J(ye,{children:t===M(c.s,100)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`l`?`yellow`:`white`,children:[m===`l`?`❯ `:` `,`Lightness (`,c.l,`%):`]})}),J(B,{children:E().map((e,t)=>J(ye,{children:t===M(c.l,100)?J(V,{children:`|`}):e},t))})]})]}):Y(q,{children:[Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`r`?`yellow`:`white`,children:[m===`r`?`❯ `:` `,`Red (`,u.r,`):`]})}),J(B,{children:k().map((e,t)=>J(ye,{children:t===M(u.r,255)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`g`?`yellow`:`white`,children:[m===`g`?`❯ `:` `,`Green (`,u.g,`):`]})}),J(B,{children:A().map((e,t)=>J(ye,{children:t===M(u.g,255)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`b`?`yellow`:`white`,children:[m===`b`?`❯ `:` `,`Blue (`,u.b,`):`]})}),J(B,{children:j().map((e,t)=>J(ye,{children:t===M(u.b,255)?J(V,{children:`|`}):e},t))})]})]}),Y(B,{marginBottom:1,children:[J(V,{children:`Current: `}),J(V,{backgroundColor:D(),children:` `})]}),Y(B,{flexDirection:`row`,justifyContent:`space-between`,children:[Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`Hex `}),r?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:a?.colors?.text||`white`,bold:!0,children:O(u.r,u.g,u.b)}):r===`inverseText`?J(V,{color:D(),backgroundColor:a?.colors?.permission,bold:!0,children:O(u.r,u.g,u.b)}):J(V,{color:D(),bold:!0,children:O(u.r,u.g,u.b)})]}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`RGB `}),r?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:a?.colors?.text||`white`,bold:!0,children:`rgb(${u.r}, ${u.g}, ${u.b})`}):r===`inverseText`?J(V,{color:D(),backgroundColor:a?.colors?.permission,bold:!0,children:`rgb(${u.r}, ${u.g}, ${u.b})`}):J(V,{color:D(),bold:!0,children:`rgb(${u.r}, ${u.g}, ${u.b})`})]}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`HSL `}),r?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:a?.colors?.text||`white`,bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):r===`inverseText`?J(V,{color:D(),backgroundColor:a?.colors?.permission,bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):J(V,{color:D(),bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`})]})]})]})}function Qe(e){let t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};let n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){let e=n[1];return{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16)}}return null}function $e(e){let t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){let e=parseInt(n[1])/255,t=parseInt(n[2])/255,r=parseInt(n[3])/255,i=Math.max(e,t,r),a=Math.min(e,t,r),o=i-a,s=(i+a)/2,c=0;o!==0&&(c=s>.5?o/(2-i-a):o/(i+a));let l=0;return o!==0&&(l=i===e?((t-r)/o+(t<r?6:0))/6:i===t?((r-e)/o+2)/6:((e-t)/o+4)/6),{h:Math.round(l*360),s:Math.round(c*100),l:Math.round(s*100)}}let r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){let e=r[1],t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,i=parseInt(e.substr(4,2),16)/255,a=Math.max(t,n,i),o=Math.min(t,n,i),s=a-o,c=(a+o)/2,l=0;s!==0&&(l=c>.5?s/(2-a-o):s/(a+o));let u=0;return s!==0&&(u=a===t?((n-i)/s+(n<i?6:0))/6:a===n?((i-t)/s+2)/6:((t-n)/s+4)/6),{h:Math.round(u*360),s:Math.round(l*100),l:Math.round(c*100)}}return{h:0,s:50,l:50}}function et({onBack:e,themeId:n}){let{settings:{themes:r},updateSettings:a}=W($),[o,s]=K(n),c=r.find(e=>e.id===o)||r[0],[l,u]=K(`rgb`),[d,f]=K(0),[p,m]=K(null),[h,_]=K(null),[v,y]=K(``),[b,x]=K(``),[S,C]=K(!1),[w,ee]=K(0),T=xe(e=>{a(t=>{let n=t.themes.findIndex(e=>e.id===o);n!==-1&&e(t.themes[n])})},[o,a]),E=e=>{if(d>=2&&g(e)){let t=i(e),n=D[d-2];T(e=>{e.colors[n]=t})}};H((t,n)=>{if(S){if(n.escape){C(!1),e();return}return}if(p===null&&h===null){if(t.length>1&&!n.ctrl&&!n.meta){E(t);return}if(n.escape)C(!0),ee(0);else if(n.ctrl&&t===`a`)u(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(n.upArrow)f(e=>Math.max(0,e-1));else if(n.downArrow)f(e=>Math.min(D.length+1,e+1));else if(n.return)if(d===0)_(`name`),y(c.name),x(c.name);else if(d===1)_(`id`),y(c.id),x(c.id);else{let e=d-2,t=D[e],n=c.colors[t];m(e),y(n),x(n)}}else if(p!==null)n.ctrl&&t===`a`&&u(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(h!==null)if(n.return){if(h===`id`){let e=o;s(v),a(t=>{let n=t.themes.findIndex(t=>t.id===e);n!==-1&&(t.themes[n].id=v)})}else T(e=>{e.name=v});_(null),y(``),x(``)}else n.escape?(_(null),y(``),x(``)):n.backspace||n.delete?y(e=>e.slice(0,-1)):t&&y(e=>e+t)});let D=Object.keys(c.colors),O=(e,t)=>{let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!n)return e;let r=parseInt(n[1]),i=parseInt(n[2]),a=parseInt(n[3]);switch(t){case`hex`:{let e=e=>e.toString(16).padStart(2,`0`);return`#${e(r)}${e(i)}${e(a)}`}case`hsl`:{let e=r/255,t=i/255,n=a/255,o=Math.max(e,t,n),s=Math.min(e,t,n),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===e?((t-n)/c+(t<n?6:0))/6:o===t?((n-e)/c+2)/6:((e-t)/c+4)/6),`hsl(${Math.round(d*360)}, ${Math.round(u*100)}%, ${Math.round(l*100)}%)`}case`rgb`:default:return e}},k=e=>({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`})[e]||``,A=Math.max(...D.map(e=>e.length));return Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(X,{children:[`Editing theme “`,c.name,`” (`,c.id,`)`]})}),S?Y(B,{flexDirection:`column`,marginTop:1,children:[J(B,{marginBottom:1,children:Y(V,{bold:!0,children:[`Would you like to make “`,c.name,`” your current Claude Code theme?`]})}),J(ze,{items:[{name:`Yes`,desc:`Set ${c.id} as active theme`},{name:`No`,desc:`Go back without changing theme`}],selectedIndex:w,onSelect:ee,onSubmit:()=>{w===0&&t(c.id),C(!1),e()}}),J(V,{dimColor:!0,children:`enter to select, esc to cancel`})]}):p===null&&h===null?Y(q,{children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`enter to edit theme name, id, or color`}),J(V,{dimColor:!0,children:`ctrl+a to toggle rgb, hex, hsl`}),J(V,{dimColor:!0,children:`paste color from clipboard (when on color)`}),J(V,{dimColor:!0,children:`esc to go back`})]}),d<2?Y(B,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:`yellow`,flexDirection:`column`,paddingLeft:1,children:[J(V,{bold:!0,children:d===0?`Theme Name`:`Theme ID`}),J(V,{children:d===0?`The display name for this theme`:"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):Y(B,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:c.colors[D[d-2]],flexDirection:`column`,paddingLeft:1,children:[J(Xe,{colorKey:D[d-2],theme:c,bold:!0}),J(V,{children:k(D[d-2])})]}),Y(B,{flexDirection:`column`,children:[Y(B,{children:[J(V,{color:d===0?`yellow`:`white`,children:d===0?`❯ `:` `}),J(V,{bold:!0,children:`Name: `}),J(V,{children:c.name})]}),Y(B,{marginBottom:1,children:[J(V,{color:d===1?`yellow`:`white`,children:d===1?`❯ `:` `}),J(V,{bold:!0,children:`ID: `}),J(V,{children:c.id})]}),(()=>{if(d<2)return Y(q,{children:[D.slice(0,20).map((e,t)=>{let n=t+2;return Y(B,{children:[J(V,{color:d===n?`yellow`:`white`,children:d===n?`❯ `:` `}),J(B,{width:A+2,children:J(V,{children:J(Xe,{colorKey:e,theme:c,bold:!0})})}),J(Q,{color:c.colors[e],children:O(c.colors[e],l)})]},e)}),D.length>20&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,D.length-20,` more below`]})]});let e=d-2,t=Math.max(0,e-10),n=Math.min(D.length,t+20),r=Math.max(0,n-20),i=D.slice(r,n);return Y(q,{children:[r>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t+2;return Y(B,{children:[J(V,{color:d===n?`yellow`:`white`,children:d===n?`❯ `:` `}),J(B,{width:A+2,children:J(V,{children:J(Xe,{colorKey:e,theme:c,bold:!0})})}),J(Q,{color:c.colors[e],children:O(c.colors[e],l)})]},e)}),n<D.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,D.length-n,` more below`]})]})})()]})]}):h?Y(B,{flexDirection:`column`,marginTop:1,children:[Y(V,{children:[`Editing `,h===`name`?`theme name`:`theme ID`,`:`]}),J(B,{borderStyle:`round`,borderColor:`yellow`,paddingX:1,children:J(V,{children:v})}),J(V,{dimColor:!0,children:`enter to save, esc to cancel`})]}):J(Ze,{initialValue:b,colorKey:D[p],theme:c,onColorChange:e=>{y(e),T(t=>{t.colors[D[p]]=e})},onExit:()=>{T(e=>{e.colors[D[p]]=v}),m(null),y(``),x(``)}})]}),J(B,{width:`50%`,children:J(Ye,{theme:c})})]})}const tt=`https://raw.githubusercontent.com/Piebald-AI/claude-code-themes/main`,nt=`${tt}/index.json`;async function rt(){F(`Fetching community theme index from ${nt}`);let e=await fetch(nt,{headers:{Accept:`application/json`}});if(!e.ok)throw Error(`Failed to fetch community theme index: ${e.status} ${e.statusText}`);return await e.json()}async function it(e){let t=`${tt}/themes/${e}.json`;F(`Fetching community theme from ${t}`);let n=await fetch(t,{headers:{Accept:`application/json`}});if(!n.ok)throw Error(`Failed to fetch community theme "${e}": ${n.status} ${n.statusText}`);return await n.json()}function at({onBack:e}){let{updateSettings:t}=W($),[n,r]=K({status:`loading`}),[i,a]=K(0),[o,s]=K(null),[c,l]=K(!1),[u,d]=K(null),f=Ce(0);G(()=>{rt().then(e=>{r({status:`loaded`,entries:e})}).catch(e=>{r({status:`error`,message:e.message})})},[]);let p=n.status===`loaded`?n.entries:[],m=xe(async e=>{let t=++f.current;l(!0),d(null);try{let n=await it(e);if(t!==f.current)return;s(te(n,E))}catch{if(t!==f.current)return;s(null),d(`Failed to load preview.`)}finally{t===f.current&&l(!1)}},[]),h=xe(async e=>{d(`Downloading theme…`);try{let n=te(await it(e.id),E),r=!1;t(e=>{e.themes.some(e=>e.id===n.id)||(e.themes.push(n),r=!0)}),d(r?`Added "${n.name}" to your themes!`:`Theme "${n.name}" (${n.id}) is already in your config.`)}catch{d(`Failed to download theme.`)}},[t]);return H((t,r)=>{if(r.escape){e();return}if(n.status!==`loaded`)return;let o=n.entries.length;if(o!==0){if(r.upArrow)a(e=>Math.max(0,e-1)),s(null),d(null);else if(r.downArrow)a(e=>Math.min(o-1,e+1)),s(null),d(null);else if(t===` `){let e=n.entries[i];e&&m(e.id)}else if(r.return){let e=n.entries[i];e&&h(e)}}}),n.status===`loading`?Y(B,{flexDirection:`column`,children:[J(X,{children:`Community Themes`}),J(V,{children:`Loading community themes…`})]}):n.status===`error`?Y(B,{flexDirection:`column`,children:[J(X,{children:`Community Themes`}),Y(V,{color:`red`,children:[`Error: `,n.message]}),J(V,{dimColor:!0,children:`esc to go back`})]}):Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(X,{children:`Community Themes`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`space to preview theme`}),J(V,{dimColor:!0,children:`enter to download theme`}),J(V,{dimColor:!0,children:`esc to go back`})]}),J(B,{flexDirection:`column`,children:p.map((e,t)=>Y(V,{color:i===t?`yellow`:void 0,children:[i===t?`❯ `:` `,e.name,` (`,e.id,`) by @`,e.author]},e.id))}),u&&J(B,{marginTop:1,children:J(V,{color:`cyan`,children:u})}),c&&J(B,{marginTop:1,children:J(V,{dimColor:!0,children:`Loading preview…`})})]}),J(B,{width:`50%`,children:o?J(Ye,{theme:o}):J(B,{flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:10,children:J(V,{dimColor:!0,children:`Press space to preview the selected theme.`})})})]})}function ot(e){return e.map(e=>`${e.name} (${e.id})`)}function st({onBack:t}){let{settings:{themes:n},updateSettings:r}=W($),[i,a]=K(0),[o,s]=K(null),[c,l]=K(!0),[u,d]=K(!1),f=n.length+1,p=()=>{let t={colors:{...(n[0]||e.themes[0]).colors},name:`New Custom Theme`,id:`custom-${Date.now()}`};r(e=>{e.themes.push(t)}),s(t.id),l(!1)},m=e=>{n.length<=1||(r(t=>{t.themes=t.themes.filter(t=>t.id!==e)}),i>=n.length-1&&a(Math.max(0,n.length-2)))},h=()=>{r(t=>{t.themes=[...e.themes]}),a(0)},g=i===n.length;if(H((e,r)=>{if(r.escape)t();else if(r.upArrow)a(e=>Math.max(0,e-1));else if(r.downArrow)a(e=>Math.min(f-1,e+1));else if(r.return)if(g)d(!0),l(!1);else{let e=n[i];e&&(s(e.id),l(!1))}else if(e===`n`)p();else if(e===`d`){if(!g){let e=n[i];e&&m(e.id)}}else r.ctrl&&e===`r`&&h()},{isActive:c}),u)return J(at,{onBack:()=>{d(!1),l(!0)}});if(o)return J(et,{themeId:o,onBack:()=>{s(null),l(!0)}});let _=ot(n),v=n.find(e=>_[i]?.includes(`(${e.id})`))||n[0];return n.length===0?J(B,{children:Y(B,{flexDirection:`column`,width:`100%`,children:[J(X,{children:`Themes`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new theme`}),J(V,{dimColor:!0,children:`esc to go back`})]}),J(V,{children:`No themes available!`})]})}):Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(X,{children:`Themes`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new theme`}),J(V,{dimColor:!0,children:`d to delete a theme`}),J(V,{dimColor:!0,children:`ctrl+r to delete all themes and restore built-in`}),J(V,{dimColor:!0,children:`enter to edit theme`}),J(V,{dimColor:!0,children:`esc to go back`})]}),Y(B,{flexDirection:`column`,children:[_.map((e,t)=>Y(V,{color:i===t?`yellow`:void 0,children:[i===t?`❯ `:` `,e]},t)),Y(V,{color:g?`blue`:void 0,bold:g,children:[g?`❯ `:` `,`Browse community themes…`]})]})]}),J(B,{width:`50%`,children:g?J(B,{flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:10,children:J(V,{dimColor:!0,children:`Press enter to browse community themes.`})}):J(Ye,{theme:v})})]})}function ct({onBack:t}){let{settings:{thinkingVerbs:{format:n,verbs:r},themes:i},updateSettings:a}=W($),o=[`format`,`verbs`],[s,c]=K(0),l=o[s],[u,d]=K(0),[f,p]=K(!1),[m,h]=K(``),[g,_]=K(!1),[v,y]=K(!1),[b,x]=K(n),S=ee(),C=(i.find(e=>e.id===S)||i.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;return H((i,s)=>{if(v){s.return?(a(e=>{e.thinkingVerbs.format=b}),y(!1)):s.escape?(x(n),y(!1)):s.backspace||s.delete?x(e=>e.slice(0,-1)):i&&x(e=>e+i);return}if(f||g){s.return&&m.trim()?(g?(a(e=>{e.thinkingVerbs.verbs.push(m.trim())}),_(!1)):(a(e=>{e.thinkingVerbs.verbs[u]=m.trim()}),p(!1)),h(``)):s.escape?(h(``),p(!1),_(!1)):s.backspace||s.delete?h(e=>e.slice(0,-1)):i&&h(e=>e+i);return}s.escape?t():s.return?l===`format`&&(x(n),y(!0)):s.tab?s.shift?c(e=>e===0?o.length-1:e-1):c(e=>e===o.length-1?0:e+1):s.upArrow?l===`verbs`&&r.length>0&&d(e=>e>0?e-1:r.length-1):s.downArrow?l===`verbs`&&r.length>0&&d(e=>e<r.length-1?e+1:0):i===`e`&&l===`verbs`?r.length>0&&(h(r[u]),p(!0)):i===`d`&&l===`verbs`?r.length>1&&(a(e=>{e.thinkingVerbs.verbs=e.thinkingVerbs.verbs.filter((e,t)=>t!==u)}),u>=r.length-1&&d(Math.max(0,r.length-2))):i===`n`&&l===`verbs`?(_(!0),h(``)):s.ctrl&&i===`r`&&l===`verbs`&&(a(t=>{t.thinkingVerbs.verbs=[...e.thinkingVerbs.verbs]}),d(0))}),Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`Thinking Verbs`}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:l===`format`?`enter to edit format`:`changes auto-saved`}),J(V,{dimColor:!0,children:`esc to go back`}),J(V,{dimColor:!0,children:`tab to switch sections`})]})]}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Customize the verbs shown during generation and their format.`})}),Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:l===`format`?`yellow`:void 0,children:l===`format`?`❯ `:` `}),J(V,{bold:!0,color:l===`format`?`yellow`:void 0,children:`Format`})]}),l===`format`&&(v?Y(V,{dimColor:!0,children:[` `,`enter to save`]}):Y(V,{dimColor:!0,children:[` `,`enter to edit`]}))]}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:v?`yellow`:`gray`,children:J(V,{children:v?b:n})})}),J(B,{children:Y(V,{children:[J(V,{color:l===`verbs`?`yellow`:void 0,children:l===`verbs`?`❯ `:` `}),J(V,{bold:!0,color:l===`verbs`?`yellow`:void 0,children:`Verbs`})]})}),l===`verbs`&&J(B,{flexDirection:`column`,children:Y(V,{dimColor:!0,children:[` `,`e to edit · d to delete · n to add new · ctrl+r to reset`]})}),J(B,{marginLeft:2,marginBottom:1,children:Y(B,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,u-4),t=Math.min(r.length,e+8),n=Math.max(0,t-8),i=r.slice(n,t);return Y(q,{children:[n>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,n,` more above`]}),i.map((e,t)=>{let r=n+t;return Y(V,{color:l===`verbs`&&r===u?`cyan`:void 0,children:[l===`verbs`&&r===u?`❯ `:` `,e]},r)}),t<r.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,r.length-t,` more below`]})]})})(),g&&Y(B,{alignItems:`center`,children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:m})})]}),f&&Y(B,{marginTop:1,alignItems:`center`,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:m})})]})]})})]}),Y(B,{width:`50%`,flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Preview`})}),J(B,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:Y(V,{children:[Y(V,{color:C,children:[`✻ `,n.replace(/\{\}/g,r[u]),` `]}),J(V,{children:`(esc to interrupt)`})]})})]})]})}const lt=e=>e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).replace(/(\d+)/g,` $1 `).replace(/\s+/g,` `).trim().replace(/^./,e=>e.toUpperCase()),ut=e=>{let t=Math.max(...e.map(e=>e.length));return e.map(e=>e.padEnd(t))},dt=Object.entries(Fe).map(([e,t])=>({name:lt(e),phases:t.frames.map(e=>e.trimEnd()),reverseMirror:!1,updateInterval:t.interval})),ft=[{name:`Default`,phases:e.thinkingStyle.phases,reverseMirror:e.thinkingStyle.reverseMirror},{name:`Wave`,phases:[`▁`,`▃`,`▄`,`▅`,`▆`,`▇`,`█`],reverseMirror:!0},{name:`Glow`,phases:[`░`,`▒`,`▓`,`█`],reverseMirror:!0},{name:`Partial block`,phases:[`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`,`█`],reverseMirror:!0},{name:`Colors`,phases:[`🔴`,`🟠`,`🟡`,`🟢`,`🔵`,`🟣`],reverseMirror:!1},...dt];function pt({onBack:t}){let{settings:{thinkingStyle:{phases:n,updateInterval:r,reverseMirror:i},themes:a},updateSettings:o}=W($),s=[`reverseMirror`,`updateInterval`,`phases`,`presets`],[c,l]=K(0),u=s[c],[d,f]=K(0),[p,m]=K(0),[h,g]=K(!1),[_,v]=K(``),[y,b]=K(!1),[x,S]=K(!1),[C,w]=K(r.toString()),[T,E]=K(0),D=ee(),O=(a.find(e=>e.id===D)||a.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;G(()=>{if(n.length>0){let e=i?[...n,...[...n].reverse().slice(1,-1)]:n,t=setInterval(()=>{E(t=>(t+1)%e.length)},r);return()=>clearInterval(t)}},[n,r,i]),H((i,a)=>{if(x){if(a.return){let e=parseInt(C);!isNaN(e)&&e>0&&o(t=>{t.thinkingStyle.updateInterval=e}),S(!1)}else a.escape?(w(r.toString()),S(!1)):a.backspace||a.delete?w(e=>e.slice(0,-1)):i&&i.match(/^[0-9]$/)&&w(e=>e+i);return}if(h||y){if(a.return&&_.length){let e=y?[...n,_]:n.map((e,t)=>t===d?_:e);o(t=>{t.thinkingStyle.phases=ut(e)}),g(!1),v(``)}else a.escape?(v(``),g(!1),b(!1)):a.backspace||a.delete?v(e=>e.slice(0,-1)):i&&v(e=>e+i);return}if(a.escape)t();else if(a.return)if(u===`updateInterval`)w(r.toString()),S(!0);else if(u===`presets`){let e=ft[p];o(t=>{t.thinkingStyle.phases=ut([...e.phases]),t.thinkingStyle.reverseMirror=e.reverseMirror,e.updateInterval!==void 0&&(t.thinkingStyle.updateInterval=e.updateInterval)})}else u===`reverseMirror`&&o(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(a.tab)a.shift?l(e=>e===0?s.length-1:e-1):l(e=>e===s.length-1?0:e+1);else if(a.upArrow)u===`phases`&&n.length>0?f(e=>e>0?e-1:n.length-1):u===`presets`&&m(e=>e>0?e-1:ft.length-1);else if(a.downArrow)u===`phases`&&n.length>0?f(e=>e<n.length-1?e+1:0):u===`presets`&&m(e=>e<ft.length-1?e+1:0);else if(i===` `)u===`reverseMirror`&&o(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(i===`e`&&u===`phases`)n.length>0&&(v(n[d]),g(!0));else if(i===`a`&&u===`phases`)b(!0),v(``);else if(i===`d`&&u===`phases`)n.length>1&&(o(e=>{e.thinkingStyle.phases=ut(n.filter((e,t)=>t!==d))}),d>=n.length&&f(Math.max(0,n.length-1)));else if(i===`w`&&u===`phases`){if(d>0){let e=[...n];[e[d-1],e[d]]=[e[d],e[d-1]],o(t=>{t.thinkingStyle.phases=e}),f(e=>e-1)}}else if(i===`s`&&u===`phases`){if(d<n.length-1){let e=[...n];[e[d],e[d+1]]=[e[d+1],e[d]],o(t=>{t.thinkingStyle.phases=e}),f(e=>e+1)}}else a.ctrl&&i===`r`&&(o(t=>{t.thinkingStyle=e.thinkingStyle}),f(0),m(0))});let k=i?`●`:`○`,A=(()=>i?[...n,...[...n].reverse().slice(1,-1)]:n)(),j=A.length>0?A[T]:`·`;return J(B,{children:Y(B,{flexDirection:`column`,width:`100%`,children:[Y(B,{flexDirection:`row`,width:`100%`,children:[Y(B,{marginBottom:1,flexDirection:`column`,width:`50%`,children:[J(X,{children:`Thinking style`}),Y(B,{flexDirection:`column`,children:[Y(V,{dimColor:!0,children:[`enter to`,` `,u===`updateInterval`?`edit interval`:u===`presets`?`apply preset`:`save`]}),J(V,{dimColor:!0,children:`esc to go back`}),J(V,{dimColor:!0,children:`tab to switch sections`})]})]}),Y(B,{width:`50%`,flexDirection:`column`,children:[J(B,{children:J(V,{bold:!0,children:`Preview`})}),Y(B,{borderStyle:`single`,borderColor:`gray`,paddingX:1,flexDirection:`row`,children:[J(B,{width:(j?.length??0)+1,children:J(V,{color:O,children:j})}),Y(V,{children:[J(V,{color:O,children:`Thinking… `}),J(V,{children:`(esc to interrupt)`})]})]})]})]}),Y(B,{flexDirection:`row`,gap:4,children:[Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:u===`reverseMirror`?`yellow`:void 0,children:u===`reverseMirror`?`❯ `:` `}),J(V,{bold:!0,color:u===`reverseMirror`?`yellow`:void 0,children:`Reverse-mirror phases`})]}),u===`reverseMirror`&&Y(V,{dimColor:!0,children:[` `,`space to toggle`]}),J(B,{marginLeft:2,marginBottom:1,children:Y(V,{children:[k,` `,i?`Enabled`:`Disabled`]})})]}),Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:u===`updateInterval`?`yellow`:void 0,children:u===`updateInterval`?`❯ `:` `}),J(V,{bold:!0,color:u===`updateInterval`?`yellow`:void 0,children:`Update interval (ms)`})]}),u===`updateInterval`&&(x?Y(V,{dimColor:!0,children:[` `,`enter to save`]}):Y(V,{dimColor:!0,children:[` `,`enter to edit`]})),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:x?`yellow`:`gray`,children:J(V,{children:x?C:r})})})]})]}),J(B,{children:Y(V,{children:[J(V,{color:u===`phases`?`yellow`:void 0,children:u===`phases`?`❯ `:` `}),J(V,{bold:!0,color:u===`phases`?`yellow`:void 0,children:`Phases`})]})}),u===`phases`&&J(B,{marginBottom:1,flexDirection:`column`,children:Y(V,{dimColor:!0,children:[` `,`[e]dit`,` `,`[a]dd`,` `,`[d]elete`,` `,`[w]move up`,` `,`[s]move down`]})}),J(B,{marginLeft:2,marginBottom:1,children:Y(B,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,d-4),t=Math.min(n.length,e+8),r=Math.max(0,t-8),i=n.slice(r,t);return Y(q,{children:[r>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t;return Y(V,{color:u===`phases`&&n===d?`cyan`:void 0,children:[u===`phases`&&n===d?`❯ `:` `,e]},n)}),t<n.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,n.length-t,` more below`]})]})})(),y&&Y(B,{children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:_})})]}),h&&Y(B,{marginTop:1,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:_})})]})]})}),J(B,{children:Y(V,{children:[J(V,{color:u===`presets`?`yellow`:void 0,children:u===`presets`?`❯ `:` `}),J(V,{bold:!0,color:u===`presets`?`yellow`:void 0,children:`Presets`})]})}),u===`presets`&&Y(V,{dimColor:!0,children:[` `,`Selecting one will overwrite your choice of phases and interval`]}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{flexDirection:`column`,children:(()=>{let e=Math.max(0,p-6),t=Math.min(ft.length,e+12),n=Math.max(0,t-12),r=ft.slice(n,t),i=e=>{let t=e.phases.join(``);return t.length>30?t.slice(0,27)+`…`:t};return Y(q,{children:[n>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,n,` more above`]}),r.map((e,t)=>{let r=n+t,a=u===`presets`&&r===p;return Y(V,{color:a?`cyan`:void 0,children:[a?`❯ `:` `,e.name,` `,i(e)]},r)}),t<ft.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,ft.length-t,` more below`]})]})})()})}),J(B,{marginTop:1,children:J(V,{dimColor:!0,children:`ctrl+r to reset all settings to default`})})]})})}function mt(e,t){let n=Ce(!0);G(()=>{if(n.current){n.current=!1;return}return e()},t)}const ht=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],gt=[{label:`none`,value:`none`},{label:`single`,value:`single`},{label:`double`,value:`double`},{label:`round`,value:`round`},{label:`bold`,value:`bold`},{label:`singleDouble`,value:`singleDouble`},{label:`doubleSingle`,value:`doubleSingle`},{label:`classic`,value:`classic`},{label:`topBottomSingle`,value:`topBottomSingle`},{label:`topBottomDouble`,value:`topBottomDouble`},{label:`topBottomBold`,value:`topBottomBold`}];function _t({onBack:t}){let{settings:n,updateSettings:r}=W($),[i,a]=K(!1),[o,s]=K(!1),[c,l]=K(!1),[u,d]=K(()=>n.userMessageDisplay.format),[f,p]=K(()=>n.userMessageDisplay.paddingX===`default`?`default`:`custom`),[m,h]=K(()=>n.userMessageDisplay.paddingY===`default`?`default`:`custom`),[g,_]=K(()=>n.userMessageDisplay.paddingX===`default`?`0`:String(n.userMessageDisplay.paddingX)),[v,y]=K(()=>n.userMessageDisplay.paddingY===`default`?`0`:String(n.userMessageDisplay.paddingY)),[b,x]=K(n.userMessageDisplay.fitBoxToContent),[S,C]=K(0),[w,T]=K(()=>[...n.userMessageDisplay.styling]),[E,D]=K(()=>n.userMessageDisplay.foregroundColor===`default`?`default`:`custom`),[O,k]=K(()=>n.userMessageDisplay.foregroundColor===`default`?`rgb(255,255,255)`:n.userMessageDisplay.foregroundColor),[A,j]=K(()=>{let e=n.userMessageDisplay.backgroundColor;return e===null?`none`:e===`default`?`default`:`custom`}),[M,te]=K(()=>{let e=n.userMessageDisplay.backgroundColor;return e===null||e===`default`?`rgb(0,0,0)`:e}),[N,P]=K(()=>gt.findIndex(e=>e.value===n.userMessageDisplay.borderStyle)),[F,ne]=K(()=>n.userMessageDisplay.borderColor),[re,ie]=K(null),[ae,oe]=K(``),se=ee(),ce=n.themes?.find(e=>e.id===se)||n.themes?.[0],[I,L]=K(`text`),R=[`format`,`styling`,`foreground`,`background`],le=[`borderStyle`,`borderColor`,`paddingX`,`paddingY`,`fitBoxToContent`],[ue,de]=K(0),[fe,pe]=K(0),z=I===`text`?R[ue]:le[fe],me=()=>{r(e=>{e.userMessageDisplay.format=u,e.userMessageDisplay.styling=[...w],e.userMessageDisplay.foregroundColor=E===`default`?`default`:O,e.userMessageDisplay.backgroundColor=A===`none`?null:A===`default`?`default`:M,e.userMessageDisplay.borderStyle=gt[N].value,e.userMessageDisplay.borderColor=F,e.userMessageDisplay.paddingX=f===`default`?`default`:parseInt(g)||0,e.userMessageDisplay.paddingY=m===`default`?`default`:parseInt(v)||0,e.userMessageDisplay.fitBoxToContent=b})},he=()=>{d(e.userMessageDisplay.format),T([...e.userMessageDisplay.styling]);let t=e.userMessageDisplay.foregroundColor;D(t===`default`?`default`:`custom`),k(t===`default`?`rgb(255,255,255)`:t);let n=e.userMessageDisplay.backgroundColor;j(n===null?`none`:n===`default`?`default`:`custom`),te(n===null||n===`default`?`rgb(0,0,0)`:n),P(gt.findIndex(t=>t.value===e.userMessageDisplay.borderStyle)),ne(e.userMessageDisplay.borderColor);let i=e.userMessageDisplay.paddingX,a=e.userMessageDisplay.paddingY;p(i===`default`?`default`:`custom`),h(a===`default`?`default`:`custom`),_(i===`default`?`0`:String(i)),y(a===`default`?`0`:String(a)),x(e.userMessageDisplay.fitBoxToContent),r(t=>{t.userMessageDisplay={...e.userMessageDisplay}})};mt(()=>{me()},[u,w,E,O,A,M,N,F,f,m,g,v,b]),H((e,r)=>{if(i){r.return?a(!1):r.escape?(d(n.userMessageDisplay.format),a(!1)):r.backspace||r.delete?d(e=>e.slice(0,-1)):e&&d(t=>t+e);return}if(o){r.return?s(!1):r.escape?(_(String(n.userMessageDisplay.paddingX)),s(!1)):r.backspace||r.delete?_(e=>e.slice(0,-1)):e&&/^\d$/.test(e)&&_(t=>t+e);return}if(c){r.return?l(!1):r.escape?(y(String(n.userMessageDisplay.paddingY)),l(!1)):r.backspace||r.delete?y(e=>e.slice(0,-1)):e&&/^\d$/.test(e)&&y(t=>t+e);return}if(re===null){if(r.escape)t();else if(r.ctrl&&e===`r`)he();else if(r.leftArrow||r.rightArrow)L(e=>e===`text`?`border`:`text`);else if(r.tab)I===`text`?r.shift?de(e=>e===0?R.length-1:e-1):de(e=>e===R.length-1?0:e+1):r.shift?pe(e=>e===0?le.length-1:e-1):pe(e=>e===le.length-1?0:e+1);else if(r.return)z===`format`?a(!0):z===`paddingX`?f===`custom`&&s(!0):z===`paddingY`?m===`custom`&&l(!0):z===`foreground`?E===`custom`&&(oe(O),ie(`foreground`)):z===`background`?A===`custom`&&(oe(M),ie(`background`)):z===`borderColor`&&(oe(F),ie(`border`));else if(r.upArrow)z===`styling`?C(e=>Math.max(0,e-1)):z===`borderStyle`?P(e=>e===0?gt.length-1:e-1):z===`paddingX`?p(e=>e===`default`?`custom`:`default`):z===`paddingY`?h(e=>e===`default`?`custom`:`default`):z===`foreground`?D(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!O||O===``)&&k(`rgb(255,255,255)`),t}):z===`background`&&j(e=>{let t=e===`default`?`custom`:e===`custom`?`none`:`default`;return t===`custom`&&(!M||M===``)&&te(`rgb(0,0,0)`),t});else if(r.downArrow)z===`styling`?C(e=>Math.min(ht.length-1,e+1)):z===`borderStyle`?P(e=>e===gt.length-1?0:e+1):z===`paddingX`?p(e=>e===`default`?`custom`:`default`):z===`paddingY`?h(e=>e===`default`?`custom`:`default`):z===`foreground`?D(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!O||O===``)&&k(`rgb(255,255,255)`),t}):z===`background`&&j(e=>{let t=e===`default`?`none`:e===`none`?`custom`:`default`;return t===`custom`&&(!M||M===``)&&te(`rgb(0,0,0)`),t});else if(e===` `)if(z===`styling`){let e=ht[S].value;T(w.indexOf(e)>=0?w.filter(t=>t!==e):[...w,e])}else z===`fitBoxToContent`&&x(e=>!e)}});let ge=e=>{let t=E===`default`?ce?.colors?.text:O,n=A===`none`?void 0:A===`default`?ce?.colors?.userMessageBackground:M,r=gt[N].value,i=f===`default`?0:parseInt(g)||0,a=m===`default`?0:parseInt(v)||0,o=f===`default`?1:i,s=J(V,{bold:w.includes(`bold`),italic:w.includes(`italic`),underline:w.includes(`underline`),strikethrough:w.includes(`strikethrough`),inverse:w.includes(`inverse`),color:t,backgroundColor:n,children:e});if(r===`topBottomSingle`||r===`topBottomDouble`||r===`topBottomBold`){let t=r===`topBottomSingle`?`─`:r===`topBottomDouble`?`═`:`━`,n=e.length+i*2,o=t.repeat(n);return Y(B,{flexDirection:`column`,children:[J(V,{color:F,children:o}),a>0&&J(B,{height:a}),J(B,{paddingX:i,children:s}),a>0&&J(B,{height:a}),J(V,{color:F,children:o})]})}else if(r!==`none`||i>0||a>0||o>0||b){let e={};i>0&&(e.paddingX=i),f===`default`&&i===0&&(e.paddingRight=o),a>0&&(e.paddingY=a);let t=Object.keys(e).length>0?J(B,{...e,children:s}):s,n={};return r!==`none`&&(n.borderStyle=r,n.borderColor=F),b?n.alignSelf=`flex-start`:n.flexGrow=1,r===`none`?t:J(B,{...n,children:t})}else return s};return re?J(Ze,{initialValue:ae,theme:ce,onColorChange:e=>{re===`foreground`?k(e):re===`background`?te(e):re===`border`&&ne(e)},onExit:()=>{ie(null),oe(``)}}):Y(B,{flexDirection:`column`,children:[J(X,{children:`Customize how user messages are displayed`}),Y(B,{flexDirection:`column`,marginBottom:1,children:[J(V,{dimColor:!0,children:`left/right arrows to switch columns · tab to navigate options`}),J(V,{dimColor:!0,children:`enter to edit · ctrl+r to reset · esc to go back`})]}),Y(B,{flexDirection:`row`,gap:1,children:[Y(B,{flexDirection:`column`,width:`50%`,borderStyle:I===`text`?`round`:`single`,borderColor:I===`text`?`yellow`:`gray`,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:I===`text`?`yellow`:void 0,children:`Text & Styling`})}),J(B,{children:Y(V,{color:z===`format`?`yellow`:void 0,bold:z===`format`,children:[z===`format`?`❯ `:` `,`Format String`]})}),z===`format`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:i?`enter to save · esc to cancel`:`enter to edit · use {} as message placeholder`})}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:i?`yellow`:`gray`,children:J(V,{children:u})})}),J(B,{children:Y(V,{color:z===`styling`?`yellow`:void 0,bold:z===`styling`,children:[z===`styling`?`❯ `:` `,`Styling`]})}),z===`styling`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`up/down to navigate · space to toggle`})}),J(B,{marginLeft:2,marginBottom:1,flexDirection:`column`,children:ht.map((e,t)=>J(B,{children:Y(V,{color:z===`styling`&&S===t?`cyan`:void 0,children:[z===`styling`&&S===t?`❯ `:` `,w.includes(e.value)?`●`:`○`,` `,e.label]})},e.value))}),Y(B,{flexDirection:`row`,gap:1,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(V,{color:z===`foreground`?`yellow`:void 0,bold:z===`foreground`,children:[z===`foreground`?`❯ `:` `,`Foreground`]})}),z===`foreground`&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`up/down · `,E===`custom`?`enter`:``]})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[E===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[E===`custom`?`● `:`○ `,`Custom`,E===`custom`&&`: `,E===`custom`&&J(V,{color:O,children:O})]})})]})]}),Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(V,{color:z===`background`?`yellow`:void 0,bold:z===`background`,children:[z===`background`?`❯ `:` `,`Background`]})}),z===`background`&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`up/down · `,A===`custom`?`enter`:``]})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[A===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[A===`none`?`● `:`○ `,`None`]})}),J(B,{children:Y(V,{children:[A===`custom`?`● `:`○ `,`Custom`,A===`custom`&&`: `,A===`custom`&&J(V,{backgroundColor:M,children:M})]})})]})]})]})]}),Y(B,{flexDirection:`column`,width:`50%`,borderStyle:I===`border`?`round`:`single`,borderColor:I===`border`?`yellow`:`gray`,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:I===`border`?`yellow`:void 0,children:`Border & Padding`})}),J(B,{children:Y(V,{color:z===`borderStyle`?`yellow`:void 0,bold:z===`borderStyle`,children:[z===`borderStyle`?`❯ `:` `,`Border Style`]})}),z===`borderStyle`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`up/down to navigate`})}),Y(B,{marginLeft:2,marginBottom:1,flexDirection:`row`,children:[J(B,{flexDirection:`column`,width:`50%`,children:gt.slice(0,6).map((e,t)=>J(B,{children:Y(V,{color:z===`borderStyle`&&N===t?`cyan`:void 0,children:[z===`borderStyle`&&N===t?`❯ `:` `,N===t?`● `:`○ `,e.label]})},e.value))}),J(B,{flexDirection:`column`,width:`50%`,children:gt.slice(6).map((e,t)=>{let n=t+6;return J(B,{children:Y(V,{color:z===`borderStyle`&&N===n?`cyan`:void 0,children:[z===`borderStyle`&&N===n?`❯ `:` `,N===n?`● `:`○ `,e.label]})},e.value)})})]}),J(B,{children:Y(V,{color:z===`borderColor`?`yellow`:void 0,bold:z===`borderColor`,children:[z===`borderColor`?`❯ `:` `,`Border Color`]})}),z===`borderColor`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`enter to pick color`})}),J(B,{marginLeft:2,marginBottom:1,children:J(V,{color:F,children:F})}),Y(B,{flexDirection:`row`,gap:1,children:[Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`paddingX`?`yellow`:void 0,bold:z===`paddingX`,children:[z===`paddingX`?`❯ `:` `,`Padding X`]})}),z===`paddingX`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:o?`enter/esc`:f===`custom`?`up/down · enter`:`up/down`})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[f===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[f===`custom`?`● `:`○ `,`Custom`]})}),f===`custom`&&J(B,{children:J(B,{borderStyle:`round`,borderColor:o?`yellow`:`gray`,children:J(V,{children:g})})})]})]}),Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`paddingY`?`yellow`:void 0,bold:z===`paddingY`,children:[z===`paddingY`?`❯ `:` `,`Padding Y`]})}),z===`paddingY`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:c?`enter/esc`:m===`custom`?`up/down · enter`:`up/down`})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[m===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[m===`custom`?`● `:`○ `,`Custom`]})}),m===`custom`&&J(B,{children:J(B,{borderStyle:`round`,borderColor:c?`yellow`:`gray`,children:J(V,{children:v})})})]})]}),Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`fitBoxToContent`?`yellow`:void 0,bold:z===`fitBoxToContent`,children:[z===`fitBoxToContent`?`❯ `:` `,b?`●`:`○`,` Fit box to content`]})}),z===`fitBoxToContent`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`space`})})]})]})]})]}),Y(B,{flexDirection:`column`,marginTop:1,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Preview`})}),Y(B,{flexDirection:`row`,gap:2,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{marginBottom:1,children:J(V,{underline:!0,children:`Before (Claude Code default):`})}),J(B,{marginLeft:1,children:Y(V,{backgroundColor:ce?.colors?.userMessageBackground,color:ce?.colors?.text,children:[` `,`> list the dir`,` `]})}),J(B,{marginLeft:1,marginTop:1,children:Y(V,{children:[J(V,{color:ce?.colors?.inactive||`#888888`,children:`●`}),J(V,{children:` The directory `}),J(V,{color:ce?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(V,{children:` contains `}),J(V,{bold:!0,children:`123`}),J(V,{children:` files.`})]})})]}),Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{marginBottom:1,children:J(V,{underline:!0,children:`After (Your customization):`})}),J(B,{marginLeft:1,flexDirection:`row`,children:(()=>ge(u.replace(/\{\}/g,`list the dir`)))()}),J(B,{marginLeft:1,marginTop:1,children:Y(V,{children:[J(V,{color:ce?.colors?.inactive||`#888888`,children:`●`}),J(V,{children:` The directory `}),J(V,{color:ce?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(V,{children:` contains `}),J(V,{bold:!0,children:`123`}),J(V,{children:` files.`})]})})]})]})]})]})}const vt=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],yt=[[`name`,`regex`,`regexFlags`],[`format`,`styling`],[`foreground`,`background`],[`enabled`],[`testText`]];function bt({testText:e,regex:t,regexFlags:n,format:r,styling:i,foregroundColor:a,backgroundColor:o}){let s=[];try{let c=n.includes(`g`)?n:n+`g`,l=new RegExp(t,c),u=[...e.matchAll(l)];if(u.length===0)return J(V,{children:e});let d=0;return u.forEach((t,n)=>{let c=t.index,l=c+t[0].length;c>d&&s.push(J(V,{children:e.slice(d,c)},`plain-${n}`));let u=r.replace(/\{MATCH\}/g,t[0]);s.push(J(V,{bold:i.includes(`bold`),italic:i.includes(`italic`),underline:i.includes(`underline`),strikethrough:i.includes(`strikethrough`),inverse:i.includes(`inverse`),color:a,backgroundColor:o,children:u},`match-${n}`)),d=l}),d<e.length&&s.push(J(V,{children:e.slice(d)},`plain-end`)),J(q,{children:s})}catch{return J(V,{children:e})}}function xt({highlighterIndex:e,onBack:t}){let{settings:n,updateSettings:r}=W($),i=n.inputPatternHighlighters[e],a=ee(),o=n.themes?.find(e=>e.id===a)||n.themes?.[0],[s,c]=K(i?.name||`New Highlighter`),[l,u]=K(i?.regex||``),[d,f]=K(i?.regexFlags||`g`),[p,m]=K(i?.format||`{MATCH}`),[h,g]=K(i?.styling||[]),[_,v]=K(i?.foregroundColor===null?`none`:`custom`),[y,b]=K(i?.foregroundColor||`rgb(255,0,255)`),[x,S]=K(i?.backgroundColor?`custom`:`none`),[C,w]=K(i?.backgroundColor||`rgb(0,0,0)`),[T,E]=K(i?.enabled??!0),[D,O]=K(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),[k,A]=K(`name`),[j,M]=K(!1),[te,N]=K(0),[P,F]=K(null),[ne,re]=K(``),[ie,ae]=K(null),[oe,se]=K(0),[ce,I]=K(0);if(G(()=>{let e=yt[oe];A(e[Math.min(ce,e.length-1)])},[oe,ce]),G(()=>{if(!l){ae(null);return}try{new RegExp(l,d),ae(null)}catch(e){ae(e.message)}},[l,d]),G(()=>{e>=0&&r(t=>{t.inputPatternHighlighters[e]&&(t.inputPatternHighlighters[e]={name:s,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:null,backgroundColor:x===`custom`?C:null,enabled:T})})},[e,s,l,d,p,h,_,y,x,C,T]),G(()=>{r(e=>{e.inputPatternHighlightersTestText=D})},[D]),H((e,r)=>{if(j){r.return?M(!1):r.escape?(k===`name`&&c(i?.name||``),k===`regex`&&u(i?.regex||``),k===`regexFlags`&&f(i?.regexFlags||`g`),k===`format`&&m(i?.format||`{MATCH}`),k===`testText`&&O(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),M(!1)):r.backspace||r.delete?(k===`name`&&c(e=>e.slice(0,-1)),k===`regex`&&u(e=>e.slice(0,-1)),k===`regexFlags`&&f(e=>e.slice(0,-1)),k===`format`&&m(e=>e.slice(0,-1)),k===`testText`&&O(e=>e.slice(0,-1))):e&&e.length===1&&(k===`name`&&c(t=>t+e),k===`regex`&&u(t=>t+e),k===`regexFlags`&&f(t=>t+e),k===`format`&&m(t=>t+e),k===`testText`&&O(t=>t+e));return}if(P===null){if(r.escape)t();else if(r.upArrow)k===`styling`&&te>0?N(e=>e-1):se(e=>Math.max(0,e-1));else if(r.downArrow)k===`styling`&&te<vt.length-1?N(e=>e+1):se(e=>Math.min(yt.length-1,e+1));else if(r.leftArrow)k===`foreground`?v(e=>e===`none`?`custom`:`none`):k===`background`?S(e=>e===`none`?`custom`:`none`):I(e=>Math.max(0,e-1));else if(r.rightArrow)if(k===`foreground`)v(e=>e===`none`?`custom`:`none`);else if(k===`background`)S(e=>e===`none`?`custom`:`none`);else{let e=yt[oe].length-1;I(t=>Math.min(e,t+1))}else if(r.tab){let e=yt.flat(),t=e.indexOf(k);if(r.shift){if(t>0){let n=e[t-1];for(let e=0;e<yt.length;e++){let t=yt[e].indexOf(n);if(t>=0){se(e),I(t);break}}}}else if(t<e.length-1){let n=e[t+1];for(let e=0;e<yt.length;e++){let t=yt[e].indexOf(n);if(t>=0){se(e),I(t);break}}}}else if(r.return)k===`name`||k===`regex`||k===`regexFlags`||k===`format`||k===`testText`?M(!0):k===`foreground`&&_===`custom`?(re(y),F(`foreground`)):k===`background`&&x===`custom`&&(re(C),F(`background`));else if(e===` `)if(k===`styling`){let e=vt[te].value;h.includes(e)?g(h.filter(t=>t!==e)):g([...h,e])}else k===`enabled`&&E(!T)}}),!i)return J(B,{flexDirection:`column`,children:J(V,{color:`red`,children:`Highlighter not found`})});if(P)return J(Ze,{initialValue:ne,theme:o,onColorChange:e=>{P===`foreground`?b(e):P===`background`&&w(e)},onExit:()=>{F(null),re(``)}});let L=e=>k===e,R=e=>({color:L(e)?`yellow`:void 0,bold:L(e)});return Y(B,{flexDirection:`column`,children:[J(X,{children:`Edit Highlighter`}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`arrows to navigate · enter to edit · space to toggle · esc to go back`})}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`30%`,children:[Y(V,{...R(`name`),children:[L(`name`)?`❯ `:` `,`Name`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`name`)?j?`green`:`yellow`:`gray`,children:J(V,{children:s||`(empty)`})})})]}),Y(B,{flexDirection:`column`,width:`45%`,children:[Y(V,{...R(`regex`),children:[L(`regex`)?`❯ `:` `,`Regex Pattern`]}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{borderStyle:`round`,borderColor:L(`regex`)?j?`green`:`yellow`:ie?`red`:`gray`,children:J(V,{children:l||`(empty)`})}),ie&&J(V,{color:`red`,children:ie})]})]}),Y(B,{flexDirection:`column`,width:`20%`,children:[Y(V,{...R(`regexFlags`),children:[L(`regexFlags`)?`❯ `:` `,`Flags`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`regexFlags`)?j?`green`:`yellow`:`gray`,children:J(V,{children:d||`g`})})})]})]}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[Y(V,{...R(`format`),children:[L(`format`)?`❯ `:` `,`Format String`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`format`)?j?`green`:`yellow`:`gray`,children:J(V,{children:p||`{MATCH}`})})}),L(`format`)&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`use `,`{MATCH}`,` as placeholder`]})})]}),Y(B,{flexDirection:`column`,width:`45%`,children:[Y(V,{...R(`styling`),children:[L(`styling`)?`❯ `:` `,`Styling`]}),J(B,{marginLeft:2,flexDirection:`column`,children:vt.map((e,t)=>{let n=h.includes(e.value),r=L(`styling`)&&te===t;return Y(V,{color:r?`cyan`:void 0,children:[r?`❯ `:` `,n?`●`:`○`,` `,e.label]},e.value)})})]})]}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`48%`,children:[Y(V,{...R(`foreground`),children:[L(`foreground`)?`❯ `:` `,`Foreground Color`]}),Y(B,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(V,{color:L(`foreground`)?`yellow`:void 0,children:[`[`,_===`none`?`●`:`○`,`] none`,` `,`[`,_===`custom`?`●`:`○`,`] custom`]}),_===`custom`&&J(B,{borderStyle:`round`,borderColor:L(`foreground`)?`yellow`:`gray`,children:J(V,{color:y,children:` ████ `})})]})]}),Y(B,{flexDirection:`column`,width:`48%`,children:[Y(V,{...R(`background`),children:[L(`background`)?`❯ `:` `,`Background Color`]}),Y(B,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(V,{color:L(`background`)?`yellow`:void 0,children:[`[`,x===`none`?`●`:`○`,`] none`,` `,`[`,x===`custom`?`●`:`○`,`] custom`]}),x===`custom`&&J(B,{borderStyle:`round`,borderColor:L(`background`)?`yellow`:`gray`,children:Y(V,{backgroundColor:C,children:[` `,` `,` `]})})]})]})]}),J(B,{marginBottom:1,children:Y(V,{...R(`enabled`),children:[L(`enabled`)?`❯ `:` `,`Enabled:`,` `,J(V,{color:T?`green`:`red`,children:T?`● Yes`:`○ No`})]})}),Y(B,{flexDirection:`column`,marginBottom:1,children:[Y(V,{...R(`testText`),children:[L(`testText`)?`❯ `:` `,`Test Text`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`testText`)?j?`green`:`yellow`:`gray`,children:J(V,{children:D||`(empty)`})})})]}),J(B,{borderStyle:`round`,padding:1,children:Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Live Preview:`}),l?J(B,{marginTop:1,children:J(bt,{testText:D,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:void 0,backgroundColor:x===`custom`?C:void 0})}):J(V,{dimColor:!0,children:`Enter a regex pattern to see the preview`})]})})]})}function St({onBack:t}){let{settings:{inputPatternHighlighters:n,themes:r},updateSettings:i}=W($),a=ee(),o=r.find(e=>e.id===a)||r[0],s=e.themes[0],c=o?.colors.success||s.colors.success,l=o?.colors.error||s.colors.error,[u,d]=K(0),[f,p]=K(null),[m,h]=K(!0),g=()=>{let e={name:`New Highlighter`,regex:``,regexFlags:`g`,format:`{MATCH}`,styling:[],foregroundColor:`rgb(255,0,255)`,backgroundColor:null,enabled:!0};i(t=>{t.inputPatternHighlighters.push(e)}),p(n.length),h(!1)},_=e=>{i(t=>{t.inputPatternHighlighters.splice(e,1)}),u>=n.length-1&&d(Math.max(0,n.length-2))},v=e=>{i(t=>{t.inputPatternHighlighters[e].enabled=!t.inputPatternHighlighters[e].enabled})},y=e=>{e<=0||(i(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e-1,0,n)}),d(e-1))},b=e=>{e>=n.length-1||(i(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e+1,0,n)}),d(e+1))};return H((e,r)=>{r.escape?t():r.upArrow?d(e=>Math.max(0,e-1)):r.downArrow&&n.length>0?d(e=>Math.min(n.length-1,e+1)):r.return&&n.length>0?(p(u),h(!1)):e===`n`?g():e===`x`&&n.length>0?_(u):e===` `&&n.length>0?v(u):e===`u`&&n.length>0&&u>0?y(u):e===`d`&&n.length>0&&u<n.length-1&&b(u)},{isActive:m}),f===null?Y(B,{flexDirection:`column`,children:[J(X,{children:`Input Pattern Highlighters`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`Create custom highlighters for patterns in your input prompt.`}),J(V,{dimColor:!0,children:`Matched text will be styled and optionally reformatted.`})]}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new highlighter`}),n.length>0&&J(V,{dimColor:!0,children:`space to toggle enabled/disabled`}),n.length>0&&J(V,{dimColor:!0,children:`u/d to move highlighter up/down`}),n.length>0&&J(V,{dimColor:!0,children:`x to delete a highlighter`}),n.length>0&&J(V,{dimColor:!0,children:`enter to edit highlighter`}),J(V,{dimColor:!0,children:`esc to go back`})]}),n.length===0?J(V,{children:`No highlighters created yet. Press n to create one.`}):J(B,{flexDirection:`column`,children:n.map((e,t)=>{let n=u===t,r;return n&&(r=`yellow`),Y(B,{flexDirection:`row`,children:[Y(V,{color:r,children:[n?`❯ `:` `,e.enabled?`● `:`○ `,e.name,` `]}),J(V,{dimColor:!0,children:`(`}),e.regex?Y(V,{dimColor:!0,children:[`/`,e.regex,`/`,e.regexFlags]}):J(V,{dimColor:!0,children:`(no regex)`}),e.styling.length>0&&J(q,{children:Y(V,{color:r,dimColor:!e.enabled,children:[` `,`· `,e.styling.join(`, `)]})}),J(V,{dimColor:!0,children:`)`}),e.enabled?J(V,{color:c,children:` enabled`}):J(V,{color:l,children:` disabled`})]},t)})})]}):J(xt,{highlighterIndex:f,onBack:()=>{p(null),h(!0)}})}const Ct=[null,1,5,10,25,50,100,200,250,500,1e3],wt=1e3;function Tt({onSubmit:e}){let{settings:t,updateSettings:n}=W($),[r,i]=K(0),[a,o]=K(!1),s={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEdit:!1,hideStartupClawd:!1,increaseFileReadLimit:!1,suppressLineNumbers:!1,suppressRateLimitOptions:!1,mcpConnectionNonBlocking:!0,mcpServerBatchSize:null,statuslineThrottleMs:null,statuslineUseFixedInterval:!1,tableFormat:`default`,enableSwarmMode:!0,enableSessionMemory:!0,enableDreamMode:!0,enableLeanMemoryTypes:!1,fixSummarizeFromHere:!0,fixRewindSummaryHeader:!0,enableRememberSkill:!1,tokenCountRounding:null,autoAcceptPlanMode:!1,allowBypassPermissionsInSudo:!1,suppressNativeInstallerWarning:!1,filterScrollEscapeSequences:!1,enableWorktreeMode:!0,allowCustomAgentModels:!1,enableContextLimitOverride:!1,enableModelCustomizations:!0,enableVoiceMode:!1,enableVoiceConciseOutput:!0,enableChannelsMode:!1,maxEffortDefault:!1,autoModeClassifierModel:`default`,suppressDeferredTools:!1,claudemdContextOncePerConversation:!0},c=()=>{t.misc||={...s}},l=e=>{let t=[`default`,`sonnet`,`haiku`];return t[(t.indexOf(e)+1)%t.length]},u=e=>{switch(e){case`sonnet`:return`Sonnet 4.6`;case`haiku`:return`Haiku 4.5`;case`default`:default:return`Default (main-loop model)`}},d=e=>{let t=[`default`,`ascii`,`clean`,`clean-top-bottom`];return t[(t.indexOf(e)+1)%t.length]},f=e=>{switch(e){case`ascii`:return`ASCII (| and -)`;case`clean`:return`Clean (no row separators)`;case`clean-top-bottom`:return`Clean with top/bottom`;case`default`:default:return`Default (box-drawing)`}},p=e=>e===null?`Default (3)`:e<=3?`${e} (conservative)`:e<=8?`${e} (recommended)`:`${e} (aggressive)`,m=e=>e===null?`Disabled`:e===0?`0ms (instant)`:`${e}ms`,h=e=>e===null?`Off (exact counts)`:`Round to ${e}`,g=(e,t)=>{let n=Ct.indexOf(e);if(n===-1)return Ct[0];let r;return r=t===`next`?(n+1)%Ct.length:(n-1+Ct.length)%Ct.length,Ct[r]},_=Se(()=>[{id:`removeBorder`,title:`Remove input box border`,description:`Removes the rounded border around the input box for a cleaner look.`,getValue:()=>t.inputBox?.removeBorder??!1,toggle:()=>{n(e=>{e.inputBox||={removeBorder:!1},e.inputBox.removeBorder=!e.inputBox.removeBorder})}},{id:`showVersion`,title:`Show tweakcc version at startup`,description:`Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.`,getValue:()=>t.misc?.showTweakccVersion??!0,toggle:()=>{n(e=>{c(),e.misc.showTweakccVersion=!e.misc.showTweakccVersion})}},{id:`showPatches`,title:`Show patches applied indicator at startup`,description:`Shows the green "tweakcc patches are applied" indicator when starting Claude Code.`,getValue:()=>t.misc?.showPatchesApplied??!0,toggle:()=>{n(e=>{c(),e.misc.showPatchesApplied=!e.misc.showPatchesApplied})}},{id:`expandThinking`,title:`Expand thinking blocks`,description:`Makes thinking blocks always expanded by default instead of collapsed.`,getValue:()=>t.misc?.expandThinkingBlocks??!0,toggle:()=>{n(e=>{c(),e.misc.expandThinkingBlocks=!e.misc.expandThinkingBlocks})}},{id:`conversationTitle`,title:`Allow renaming sessions via /title`,description:`Enables /title and /rename commands for manually naming conversations.`,getValue:()=>t.misc?.enableConversationTitle??!0,toggle:()=>{n(e=>{c(),e.misc.enableConversationTitle=!e.misc.enableConversationTitle})}},{id:`enableModelCustomizations`,title:`Enable model customizations (/model shows all models)`,description:`Show all Claude models in /model menu, not just the latest 3. Disable to use Claude Code default model list.`,getValue:()=>t.misc?.enableModelCustomizations??!0,toggle:()=>{n(e=>{c(),e.misc.enableModelCustomizations=!e.misc.enableModelCustomizations})}},{id:`hideStartupBanner`,title:`Hide startup banner`,description:`Hides the startup banner message displayed before first prompt.`,getValue:()=>t.misc?.hideStartupBanner??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupBanner=!e.misc.hideStartupBanner})}},{id:`hideCtrlG`,title:`Hide ctrl-g to edit prompt hint`,description:`Hides the "ctrl-g to edit prompt" hint shown during streaming.`,getValue:()=>t.misc?.hideCtrlGToEdit??!1,toggle:()=>{n(e=>{c(),e.misc.hideCtrlGToEdit=!e.misc.hideCtrlGToEdit})}},{id:`hideClawd`,title:`Hide startup Clawd ASCII art`,description:`Hides the Clawd ASCII art character shown at startup.`,getValue:()=>t.misc?.hideStartupClawd??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupClawd=!e.misc.hideStartupClawd})}},{id:`increaseFileReadLimit`,title:`Increase file read token limit`,description:`Increases the maximum file read limit from 25,000 to 1,000,000 tokens.`,getValue:()=>t.misc?.increaseFileReadLimit??!1,toggle:()=>{n(e=>{c(),e.misc.increaseFileReadLimit=!e.misc.increaseFileReadLimit})}},{id:`suppressLineNumbers`,title:`Suppress line numbers in file reads/edits`,description:`Removes line number prefixes from file content to reduce token usage.`,getValue:()=>t.misc?.suppressLineNumbers??!1,toggle:()=>{n(e=>{c(),e.misc.suppressLineNumbers=!e.misc.suppressLineNumbers})}},{id:`suppressRateLimitOptions`,title:`Suppress rate limit options popup`,description:`Prevents the automatic /rate-limit-options command from being triggered when hitting rate limits.`,getValue:()=>t.misc?.suppressRateLimitOptions??!1,toggle:()=>{n(e=>{c(),e.misc.suppressRateLimitOptions=!e.misc.suppressRateLimitOptions})}},{id:`mcpNonBlocking`,title:`Non-blocking MCP startup`,description:`Start immediately while MCP servers connect in background. Reduces startup time ~50% with multiple MCPs.`,getValue:()=>t.misc?.mcpConnectionNonBlocking??!0,toggle:()=>{n(e=>{c(),e.misc.mcpConnectionNonBlocking=!e.misc.mcpConnectionNonBlocking})}},{id:`mcpBatchSize`,title:`MCP server batch size`,description:`Parallel MCP connections (1-20). Use ←/→ to adjust. Higher = faster startup, more resources.`,getValue:()=>t.misc?.mcpServerBatchSize??null,getDisplayValue:()=>p(t.misc?.mcpServerBatchSize??null),toggle:()=>{n(e=>{c(),e.misc.mcpServerBatchSize=null})},increment:()=>{n(e=>{c();let t=e.misc.mcpServerBatchSize??3;e.misc.mcpServerBatchSize=Math.min(20,t+1)})},decrement:()=>{n(e=>{c();let t=(e.misc.mcpServerBatchSize??3)-1;e.misc.mcpServerBatchSize=t<1?null:t})}},{id:`tableFormat`,title:`Table output format`,description:`Controls how Claude formats tables. Default: full borders. ASCII: | and -. Clean: no top/bottom/row separators. Clean+top/bottom: borders but no row separators.`,getValue:()=>t.misc?.tableFormat??`default`,isMultiValue:!0,getDisplayValue:()=>f(t.misc?.tableFormat??`default`),toggle:()=>{n(e=>{c(),e.misc.tableFormat=d(e.misc.tableFormat??`default`)})}},{id:`enableWorktreeMode`,title:`Enable worktree mode (EnterWorktree tool)`,description:`Force-enable the EnterWorktree tool for isolated git worktree sessions by bypassing the tengu_worktree_mode feature flag.`,getValue:()=>t.misc?.enableWorktreeMode??!0,toggle:()=>{n(e=>{c(),e.misc.enableWorktreeMode=!e.misc.enableWorktreeMode})}},{id:`enableVoiceMode`,title:`Enable voice mode (/voice command)`,description:`Force-enable the /voice command by bypassing the tengu_amber_quartz feature gate.`,getValue:()=>t.misc?.enableVoiceMode??!1,toggle:()=>{n(e=>{c(),e.misc.enableVoiceMode=!e.misc.enableVoiceMode})}},{id:`enableVoiceConciseOutput`,title:`Enable concise output for voice mode`,description:`Enable the concise-output prompt used for voice interactions. Only applies when voice mode is enabled.`,getValue:()=>t.misc?.enableVoiceConciseOutput??!0,toggle:()=>{n(e=>{c(),e.misc.enableVoiceConciseOutput=!e.misc.enableVoiceConciseOutput})}},{id:`enableChannelsMode`,title:`Enable channels mode (MCP channel notifications)`,description:`Force-enable MCP channel notifications by bypassing the tengu_harbor feature gate, allowlist, and permission relay.`,getValue:()=>t.misc?.enableChannelsMode??!1,toggle:()=>{n(e=>{c(),e.misc.enableChannelsMode=!e.misc.enableChannelsMode})}},{id:`enableContextLimitOverride`,title:`Override context limit`,description:`Replaces the default model context limit with CLAUDE_CODE_CONTEXT_LIMIT env var. Must be exported manually before launching CC, or falls back to 200K.`,getValue:()=>t.misc?.enableContextLimitOverride??!1,toggle:()=>{n(e=>{c(),e.misc.enableContextLimitOverride=!e.misc.enableContextLimitOverride})}},{id:`statuslineThrottle`,title:`Statusline throttle`,description:`Throttle statusline updates (0-${wt}ms). Use ←/→ to adjust by 50ms. Space to disable. 0 = instant updates.`,getValue:()=>t.misc?.statuslineThrottleMs??null,getDisplayValue:()=>m(t.misc?.statuslineThrottleMs??null),toggle:()=>{n(e=>{c(),e.misc.statuslineThrottleMs=e.misc.statuslineThrottleMs===null?300:null})},increment:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.min(wt,t+50)})},decrement:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.max(0,t-50)})}},{id:`statuslineFixedInterval`,title:`Statusline fixed interval mode`,description:`Use setInterval instead of throttle. Updates happen on a fixed schedule rather than on-demand.`,getValue:()=>t.misc?.statuslineUseFixedInterval??!1,toggle:()=>{n(e=>{c(),e.misc.statuslineUseFixedInterval=!e.misc.statuslineUseFixedInterval})}},{id:`enableSessionMemory`,title:`Enable session memory`,description:`Force-enable session memory (auto-extraction + past session search) by bypassing the tengu_session_memory and tengu_coral_fern statsig flags.`,getValue:()=>t.misc?.enableSessionMemory??!0,toggle:()=>{n(e=>{c(),e.misc.enableSessionMemory=!e.misc.enableSessionMemory})}},{id:`enableDreamMode`,title:`Enable dream mode`,description:`Force-enable dream (/dream + auto-dream background memory consolidation) by bypassing the tengu_onyx_plover statsig gate. On/off still follows autoDreamEnabled in ~/.claude/settings.json.`,getValue:()=>t.misc?.enableDreamMode??!0,toggle:()=>{n(e=>{c(),e.misc.enableDreamMode=!e.misc.enableDreamMode})}},{id:`fixSummarizeFromHere`,title:`Fix "Summarize from here"`,description:`Make "Summarize from here" summarize only the messages after the rewind point instead of the whole conversation.`,getValue:()=>t.misc?.fixSummarizeFromHere??!0,toggle:()=>{n(e=>{c(),e.misc.fixSummarizeFromHere=!(e.misc.fixSummarizeFromHere??!0)})}},{id:`fixRewindSummaryHeader`,title:`Honest rewind summary header`,description:`Label a rewind summary as a deliberate rewind (you continued forward, then rewound and chose to carry the summary forward) instead of the misleading "ran out of context" header.`,getValue:()=>t.misc?.fixRewindSummaryHeader??!0,toggle:()=>{n(e=>{c(),e.misc.fixRewindSummaryHeader=!(e.misc.fixRewindSummaryHeader??!0)})}},{id:`enableLeanMemoryTypes`,title:`Enable lean memory types`,description:`Force the tengu_ochre_finch statsig gate: memory prompts carry a compact "Types of memory" list and the full taxonomy moves to the on-demand memory-types skill.`,getValue:()=>t.misc?.enableLeanMemoryTypes??!1,toggle:()=>{n(e=>{c(),e.misc.enableLeanMemoryTypes=!e.misc.enableLeanMemoryTypes})}},{id:`enableRememberSkill`,title:`Enable remember skill`,description:`Register a "remember" skill to review session memories and update CLAUDE.local.md with learnings from past sessions.`,getValue:()=>t.misc?.enableRememberSkill??!1,toggle:()=>{n(e=>{c(),e.misc.enableRememberSkill=!e.misc.enableRememberSkill})}},{id:`tokenCountRounding`,title:`Token count rounding`,description:`Round displayed token counts to nearest multiple. Use ←/→ to cycle: Off, 1, 5, 10, 25, 50, 100, 200, 250, 500, 1000.`,getValue:()=>t.misc?.tokenCountRounding??null,getDisplayValue:()=>h(t.misc?.tokenCountRounding??null),toggle:()=>{n(e=>{c(),e.misc.tokenCountRounding=null})},increment:()=>{n(e=>{c(),e.misc.tokenCountRounding=g(e.misc.tokenCountRounding??null,`next`)})},decrement:()=>{n(e=>{c(),e.misc.tokenCountRounding=g(e.misc.tokenCountRounding??null,`prev`)})}},{id:`autoAcceptPlanMode`,title:`Auto-accept plan mode`,description:`Automatically accept plans without the "Ready to code?" confirmation prompt.`,getValue:()=>t.misc?.autoAcceptPlanMode??!1,toggle:()=>{n(e=>{c(),e.misc.autoAcceptPlanMode=!e.misc.autoAcceptPlanMode})}},{id:`allowBypassPermissionsInSudo`,title:`Allow bypassing permissions in sudo`,description:`⚠️ WARNING: Disables a security check. When enabled, Claude can perform system-level operations without prompts. Use extreme caution.`,getValue:()=>t.misc?.allowBypassPermissionsInSudo??!1,toggle:()=>{t.misc?.allowBypassPermissionsInSudo??!1?n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!1}):o(!0)}},{id:`suppressNativeInstallerWarning`,title:`Suppress native installer warning`,description:`Suppress the native installer warning message at startup.`,getValue:()=>t.misc?.suppressNativeInstallerWarning??!1,toggle:()=>{n(e=>{c(),e.misc.suppressNativeInstallerWarning=!e.misc.suppressNativeInstallerWarning})}},{id:`filterScrollEscapeSequences`,title:`Filter scroll escape sequences`,description:`Filter out terminal escape sequences that cause unwanted scrolling.`,getValue:()=>t.misc?.filterScrollEscapeSequences??!1,toggle:()=>{n(e=>{c(),e.misc.filterScrollEscapeSequences=!e.misc.filterScrollEscapeSequences})}},{id:`allowCustomAgentModels`,title:`Allow custom agent models`,description:`Allow arbitrary model names in custom agent frontmatter (e.g. gemini-2.5-flash). Useful with a local proxy for non-Claude models.`,getValue:()=>t.misc?.allowCustomAgentModels??!1,toggle:()=>{n(e=>{c(),e.misc.allowCustomAgentModels=!e.misc.allowCustomAgentModels})}},{id:`maxEffortDefault`,title:`Default Opus 4.7 to max effort`,description:`Patches CC so Opus 4.7 sessions default to "max" reasoning effort instead of "xhigh". /effort and CLAUDE_CODE_EFFORT_LEVEL still override at runtime.`,getValue:()=>t.misc?.maxEffortDefault??!1,toggle:()=>{n(e=>{c(),e.misc.maxEffortDefault=!e.misc.maxEffortDefault})}},{id:`autoModeClassifierModel`,title:`Auto-mode classifier model`,description:`Pin auto-mode bash safety classifier to a fixed model. Default routes to your main-loop model (e.g. Opus 4.7), which gets denied as "temporarily unavailable" when that model is congested. Sonnet/Haiku have more headroom and the binary XML classifier task fits either.`,getValue:()=>t.misc?.autoModeClassifierModel??`default`,getDisplayValue:()=>u(t.misc?.autoModeClassifierModel??`default`),toggle:()=>{n(e=>{c(),e.misc.autoModeClassifierModel=l(e.misc.autoModeClassifierModel??`default`)})}}],[t,n]),v=_.length,y=v-1,b=Se(()=>r<4?0:Math.min(r-4+1,v-4),[r,v]),x=_.slice(b,b+4),S=b>0,C=b+4<v;return H((t,s)=>{a?s.return?(n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!0}),o(!1)):s.escape&&o(!1):s.return||s.escape?e():s.upArrow?i(e=>Math.max(0,e-1)):s.downArrow?i(e=>Math.min(y,e+1)):t===` `?_[r]?.toggle():s.rightArrow?_[r]?.increment?.():s.leftArrow&&_[r]?.decrement?.()}),J(B,{flexDirection:`column`,children:a?J(B,{flexDirection:`column`,paddingX:2,children:Y(B,{borderStyle:`double`,borderColor:`yellow`,padding:2,flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:`yellow`,children:`SECURITY WARNING`})}),J(B,{marginBottom:1,children:J(V,{children:`You are about to enable a feature that allows Claude Code to bypass permission checks when running with sudo privileges.`})}),J(B,{marginBottom:1,children:J(V,{color:`red`,children:`This means Claude can perform system-level operations without any prompts or confirmation.`})}),J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Use with extreme caution.`})}),J(B,{children:Y(V,{children:[`Press `,J(V,{color:`red`,children:`Enter`}),` to enable,`,` `,J(V,{color:`green`,children:`Escape`}),` to cancel`]})})]})}):Y(q,{children:[J(B,{marginBottom:1,children:J(X,{children:`Miscellaneous Settings`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Use ↑/↓ to navigate, space to toggle, ←/→ to adjust numbers, enter to go back.`})}),S&&J(B,{children:Y(V,{dimColor:!0,children:[` ↑ `,b,` more above`]})}),x.map((e,t)=>{let n=b+t===r,i=e.getValue(),a=!!e.getDisplayValue,o=!!e.increment,s;s=o?`◆`:a?`◉`:i?`☑`:`☐`;let c;c=a?e.getDisplayValue():typeof i==`boolean`?i?`Enabled`:`Disabled`:String(i??`Default`);let l=n&&o?` ← → `:``;return Y(B,{flexDirection:`column`,children:[J(B,{children:Y(V,{children:[J(V,{color:n?`cyan`:void 0,children:n?`❯ `:` `}),J(V,{bold:!0,color:n?`cyan`:void 0,children:e.title})]})}),J(B,{children:Y(V,{dimColor:!0,children:[` `,e.description]})}),J(B,{marginLeft:4,marginBottom:1,children:Y(V,{children:[s,` `,c,J(V,{dimColor:!0,children:l})]})})]},e.id)}),C&&J(B,{children:Y(V,{dimColor:!0,children:[` `,`↓ `,v-b-4,` more below`]})}),J(B,{marginTop:1,children:Y(V,{dimColor:!0,children:[`Item `,r+1,` of `,v]})})]})})}const Et=`AgentOutputTool.AskUserQuestion.Bash.BashOutputTool.Edit.EnterPlanMode.ExitPlanMode.Glob.Grep.KillShell.ListMcpResourcesTool.LSP.NotebookEdit.Read.ReadMcpResourceTool.Skill.Task.TaskCreate.TaskGet.TaskList.TaskOutput.TaskStop.TaskUpdate.Teammate.TodoWrite.ToolSearch.WebFetch.WebSearch.Write`.split(`.`);function Dt({toolsetIndex:e,onBack:t}){let{settings:n,updateSettings:r}=W($),i=n.toolsets[e],[a,o]=K(i?.name||`New Toolset`),[s,c]=K(i?.allowedTools||[]),[l,u]=K(!1),[d,f]=K(0);G(()=>{i&&r(t=>{let n=t.toolsets[e].name;t.toolsets[e].name=a,t.toolsets[e].allowedTools=s,n!==a&&(t.defaultToolset===n&&(t.defaultToolset=a),t.planModeToolset===n&&(t.planModeToolset=a))})},[a,s]);let p=e=>s===`*`?!0:s.includes(e),m=e=>{e===`All`?c(`*`):e===`None`?c([]):s===`*`?c(Et.filter(t=>t!==e)):s.includes(e)?c(s.filter(t=>t!==e)):c([...s,e])};if(H((e,n)=>{if(l){n.return?u(!1):n.escape?(o(i?.name||`New Toolset`),u(!1)):n.backspace||n.delete?o(e=>e.slice(0,-1)):e&&e.length===1&&o(t=>t+e);return}if(n.escape)t();else if(n.upArrow)f(e=>Math.max(0,e-1));else if(n.downArrow)f(e=>Math.min(Et.length+1,e+1));else if(e===` `||n.return)if(d===0)m(`All`);else if(d===1)m(`None`);else{let e=Et[d-2];e&&m(e)}else e===`n`&&u(!0)}),!i)return J(B,{flexDirection:`column`,children:J(V,{color:`red`,children:`Toolset not found`})});let h=s===`*`,g=Array.isArray(s)&&s.length===0;return Y(B,{flexDirection:`column`,children:[J(X,{children:`Edit Toolset`}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`n to edit name · space/enter to toggle · esc to go back`})}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{bold:!0,children:`Name:`}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:l?`yellow`:`gray`,children:J(V,{children:a})})}),l&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`enter to save · esc to cancel`})})]}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{bold:!0,children:`Allowed Tools:`}),J(B,{marginLeft:2,children:Y(V,{color:d===0?`cyan`:void 0,children:[d===0?`❯ `:` `,h?`●`:`○`,` All`]})}),J(B,{marginLeft:2,children:Y(V,{color:d===1?`cyan`:void 0,children:[d===1?`❯ `:` `,g?`●`:`○`,` None`]})}),Et.map((e,t)=>{let n=t+2;return J(B,{marginLeft:2,children:Y(V,{color:d===n?`cyan`:void 0,children:[d===n?`❯ `:` `,p(e)?`◉`:`○`,` `,e]})},e)})]}),J(B,{borderStyle:`round`,padding:1,marginTop:1,children:Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Summary:`}),Y(V,{children:[`Name: `,J(V,{color:`cyan`,children:a})]}),Y(V,{children:[`Tools:`,` `,s===`*`?J(V,{color:`green`,children:`All tools (*)`}):s.length===0?J(V,{color:`red`,children:`No tools ([])`}):Y(V,{color:`yellow`,children:[s.length,` selected`]})]})]})})]})}function Ot({onBack:t}){let{settings:{toolsets:n,defaultToolset:r,planModeToolset:i,themes:a},updateSettings:o}=W($),s=ee(),c=a.find(e=>e.id===s)||a[0],l=e.themes[0],u=c?.colors.planMode||l.colors.planMode,d=c?.colors.autoAccept||l.colors.autoAccept,[f,p]=K(0),[m,h]=K(null),[g,_]=K(!0),v=()=>{let e={name:`New Toolset`,allowedTools:[]};o(t=>{t.toolsets.push(e)}),h(n.length),_(!1)},y=e=>{let t=n[e];o(n=>{n.toolsets.splice(e,1),n.defaultToolset===t.name&&(n.defaultToolset=null),n.planModeToolset===t.name&&(n.planModeToolset=null)}),f>=n.length-1&&p(Math.max(0,n.length-2))},b=e=>{let t=n[e];o(e=>{e.defaultToolset=t.name})},x=e=>{let t=n[e];o(e=>{e.planModeToolset=t.name})};if(H((e,r)=>{r.escape?t():r.upArrow?p(e=>Math.max(0,e-1)):r.downArrow?p(e=>Math.min(n.length-1,e+1)):r.return&&n.length>0?(h(f),_(!1)):e===`n`?v():e===`x`&&n.length>0?y(f):e===`d`&&n.length>0?b(f):e===`p`&&n.length>0&&x(f)},{isActive:g}),m!==null)return J(Dt,{toolsetIndex:m,onBack:()=>{h(null),_(!0)}});let S=e=>e.allowedTools===`*`?`All tools`:e.allowedTools.length===0?`No tools`:`${e.allowedTools.length} tool${e.allowedTools.length===1?``:`s`}`;return Y(B,{flexDirection:`column`,children:[J(X,{children:`Toolsets`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new toolset`}),n.length>0&&J(V,{dimColor:!0,children:`d to set as default toolset`}),n.length>0&&J(V,{dimColor:!0,children:`p to set as plan mode toolset`}),n.length>0&&J(V,{dimColor:!0,children:`x to delete a toolset`}),n.length>0&&J(V,{dimColor:!0,children:`enter to edit toolset`}),J(V,{dimColor:!0,children:`esc to go back`})]}),n.length===0?J(V,{children:`No toolsets created yet. Press n to create one.`}):J(B,{flexDirection:`column`,children:n.map((e,t)=>{let n=e.name===r,a=e.name===i,o=f===t,s;return o&&(s=`yellow`),Y(B,{flexDirection:`row`,children:[Y(V,{color:s,children:[o?`❯ `:` `,e.name,` `]}),Y(V,{color:s,children:[`(`,S(e),`)`]}),n&&J(V,{color:d,children:` ⏵⏵ accept edits`}),a&&J(V,{color:u,children:` ⏸ plan mode`})]},t)})})]})}function kt({onBack:e}){let{settings:t,updateSettings:n}=W($),[r,i]=K(`plan`),[a,o]=K(!1),[s,c]=K(0),l=t.subagentModels||{plan:null,explore:null,generalPurpose:null},u=[{id:`plan`,title:`Plan Agent`,description:`The agent responsible for creating implementation plans.`},{id:`explore`,title:`Explore Agent`,description:`The agent specialized for exploring codebases.`},{id:`generalPurpose`,title:`General-purpose Agent`,description:`The agent used for general multi-step tasks.`}],d=[{label:`Default (Inherited)`,value:null},{label:`sonnet`,value:`sonnet`},{label:`haiku`,value:`haiku`},{label:`opus`,value:`opus`},{label:`sonnet[1m]`,value:`sonnet[1m]`}];return H((t,f)=>{if(a){if(f.escape)o(!1);else if(f.upArrow)c(e=>e>0?e-1:d.length-1);else if(f.downArrow)c(e=>e<d.length-1?e+1:0);else if(f.return){let e=d[s].value;n(t=>{t.subagentModels||={plan:null,explore:null,generalPurpose:null},t.subagentModels[r]=e}),o(!1)}}else if(f.escape)e();else if(f.upArrow){let e=u.findIndex(e=>e.id===r);i(u[e>0?e-1:u.length-1].id)}else if(f.downArrow){let e=u.findIndex(e=>e.id===r);i(u[e<u.length-1?e+1:0].id)}else if(t===` `||f.return){let e=l[r],t=d.findIndex(t=>t.value===e);c(t>=0?t:0),o(!0)}}),a?Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:Y(X,{children:[`Select Model for`,` `,u.find(e=>e.id===r)?.title]})}),d.map((e,t)=>{let n=t===s;return J(B,{children:Y(V,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,e.label,e.value?Y(V,{dimColor:!0,children:[` (`,e.value,`)`]}):null]})},t)})]}):Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(X,{children:`Subagent Model Settings`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Configure which Claude model each subagent uses. Use arrow keys to navigate, enter or space to change a model, and escape to go back.`})}),u.map(e=>{let t=e.id===r,n=l[e.id],i=d.find(e=>e.value===n)?.label||n||`Default`;return Y(B,{flexDirection:`column`,marginBottom:1,children:[J(B,{children:Y(V,{color:t?`cyan`:void 0,children:[t?`❯ `:` `,J(V,{bold:!0,children:e.title})]})}),J(B,{marginLeft:4,children:J(V,{dimColor:!0,children:e.description})}),J(B,{marginLeft:4,children:Y(V,{children:[`Current: `,J(V,{color:`green`,children:i})]})})]},e.id)})]})}function At({onBack:t}){let{settings:n,updateSettings:r}=W($),i=n.claudeMdAltNames??[],[a,o]=K(0),[s,c]=K(!1),[l,u]=K(``),[d,f]=K(!1);return H((n,p)=>{if(s||d){p.return&&l.trim()?(d?(r(e=>{e.claudeMdAltNames||=[],e.claudeMdAltNames.push(l.trim())}),f(!1)):(r(e=>{e.claudeMdAltNames&&(e.claudeMdAltNames[a]=l.trim())}),c(!1)),u(``)):p.escape?(u(``),c(!1),f(!1)):p.backspace||p.delete?u(e=>e.slice(0,-1)):n&&u(e=>e+n);return}p.escape?t():p.upArrow?i.length>0&&o(e=>e>0?e-1:i.length-1):p.downArrow?i.length>0&&o(e=>e<i.length-1?e+1:0):n===`e`?i.length>0&&(u(i[a]),c(!0)):n===`d`?i.length>0&&(r(e=>{e.claudeMdAltNames&&=e.claudeMdAltNames.filter((e,t)=>t!==a)}),a>=i.length-1&&o(Math.max(0,i.length-2))):n===`n`?(f(!0),u(``)):p.ctrl&&n===`r`?(r(t=>{t.claudeMdAltNames=[...e.claudeMdAltNames??[]]}),o(0)):n===`u`||p.shift&&p.upArrow?i.length>1&&a>0&&(r(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[a-1],t[a]]=[t[a],t[a-1]]}),o(e=>e-1)):(n===`j`||p.shift&&p.downArrow)&&i.length>1&&a<i.length-1&&(r(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[a],t[a+1]]=[t[a+1],t[a]]}),o(e=>e+1))}),Y(B,{flexDirection:`column`,children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`CLAUDE.md Alternative Names`}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`changes auto-saved`}),J(V,{dimColor:!0,children:`esc to go back`})]})]}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`When Claude Code looks for CLAUDE.md and doesn't find it, it will try these alternative filenames in order. This lets you use AGENTS.md (and other file names).`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`e to edit · d to delete · n to add new · u/j to move up/down · ctrl+r to reset`})}),Y(B,{flexDirection:`column`,children:[i.length===0?J(V,{children:`No alternative names configured. Press n to add one.`}):J(q,{children:(()=>{let e=Math.max(0,a-6),t=Math.min(i.length,e+12),n=Math.max(0,t-12),r=i.slice(n,t);return Y(q,{children:[n>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,n,` more above`]}),r.map((e,t)=>{let r=n+t,i=r===a;return Y(V,{color:i?`cyan`:void 0,children:[i?`❯ `:` `,e]},r)}),t<i.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,i.length-t,` more below`]})]})})()}),d&&Y(B,{alignItems:`center`,children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:l})})]}),s&&Y(B,{marginTop:1,alignItems:`center`,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:l})})]})]})]})}const jt=e=>{let t=ke.join(P,e),n;try{n=Oe.readFileSync(t,`utf8`)}catch{return null}let r=Me(n,{delimiters:[`<!--`,`-->`]}),i=r.data,a=(r.content??``).replace(/^\n+/,``).replace(/\n+$/,``),o=e.replace(/\.md$/,``),s=typeof i.name==`string`?i.name:o,c=typeof i.description==`string`?i.description:``,l;return l=a.trim().length===0?`suppressed`:`default`,{id:o,filename:e,name:s,description:c,state:l,body:a}},Mt=()=>{if(!Oe.existsSync(P))return[];let e=Oe.readdirSync(P).filter(e=>e.endsWith(`.md`)).sort(),t=[];for(let n of e){let e=jt(n);e&&t.push(e)}return t},Nt={default:void 0,customized:`cyan`,suppressed:`green`,missing:`red`},Pt={default:`·`,customized:`◆`,suppressed:`☑`,missing:`?`},Ft={default:`default`,customized:`customized`,suppressed:`suppressed`,missing:`missing`};function It({onSubmit:e}){let{settings:t,updateSettings:n}=W($),[i,a]=K(0),[o,s]=K([]),[c,l]=K(!1),[u,d]=K(0);G(()=>{s(Mt())},[u]);let f=t.misc?.suppressDeferredTools??!1,p=o.length,m=Math.max(0,p-1),h=Se(()=>i<8?0:Math.min(i-8+1,Math.max(0,p-8)),[i,p]),g=o.slice(h,h+8),_=h>0,v=h+8<p;if(H((t,s)=>{if(c){s.return?(n(e=>{e.misc?e.misc.suppressDeferredTools=!0:e.misc={suppressDeferredTools:!0}}),l(!1)):s.escape&&l(!1);return}if(s.escape){e();return}if(s.upArrow)a(e=>Math.max(0,e-1));else if(s.downArrow)a(e=>Math.min(m,e+1));else if(t===`o`||s.return){let e=o[i];e&&r(ke.join(P,e.filename))}else if(t===`d`){let e=o[i];if(e)try{Oe.unlinkSync(ke.join(P,e.filename)),d(e=>e+1)}catch{}}else t===`r`?d(e=>e+1):t===`f`&&(f?n(e=>{e.misc&&(e.misc.suppressDeferredTools=!1)}):l(!0))}),c)return J(B,{flexDirection:`column`,paddingX:2,children:Y(B,{borderStyle:`double`,borderColor:`yellow`,padding:2,flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:`yellow`,children:`FOOTGUN TOGGLE`})}),Y(B,{marginBottom:1,flexDirection:`column`,children:[Y(V,{children:[`Suppressing this hides MCP servers, Cron jobs, EnterPlanMode, WebFetch, Monitor, and other `,J(V,{bold:!0,children:`deferred`}),` tools from the model.`]}),Y(V,{children:[`The model only learns these tools exist via this announcement. Without it, it cannot call `,J(V,{bold:!0,children:`ToolSearch`}),` to load their schemas and will report capabilities as unavailable.`]})]}),J(B,{children:Y(V,{children:[`Press `,J(V,{color:`red`,children:`Enter`}),` to enable,`,` `,J(V,{color:`green`,children:`Escape`}),` to cancel`]})})]})});let y=P.replace(we.homedir(),`~`),b=o[i];return Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(X,{children:`System Reminders`})}),Y(B,{marginBottom:1,flexDirection:`column`,children:[Y(V,{children:[`Edit per-turn / per-event `,J(V,{bold:!0,children:`<system-reminder>`}),` `,`injections via `,J(V,{bold:!0,children:`.md files`}),` in `,y,`/`]}),J(V,{dimColor:!0,children:`Empty body = suppress · Custom body = override · Files seeded on first --apply. Re-apply after editing.`})]}),p===0?J(B,{flexDirection:`column`,marginBottom:1,children:Y(V,{color:`yellow`,children:[`No override files yet. Run `,J(V,{bold:!0,children:`tweakcc --apply`}),` to seed defaults.`]})}):Y(q,{children:[_&&J(B,{children:Y(V,{dimColor:!0,children:[` ↑ `,h,` more above`]})}),g.map((e,t)=>{let n=h+t===i;return Y(B,{flexDirection:`row`,children:[J(B,{width:2,children:J(V,{color:n?`cyan`:void 0,children:n?`❯ `:` `})}),J(B,{width:3,children:J(V,{color:Nt[e.state],children:Pt[e.state]})}),J(B,{width:14,children:J(V,{dimColor:!0,color:Nt[e.state],children:Ft[e.state]})}),J(B,{flexGrow:1,children:J(V,{bold:n,color:n?`cyan`:void 0,children:e.name})})]},e.id)}),v&&J(B,{children:Y(V,{dimColor:!0,children:[` `,`↓ `,p-h-8,` more below`]})})]}),b&&J(B,{flexDirection:`column`,marginTop:1,paddingX:1,children:J(V,{dimColor:!0,children:b.description})}),Y(B,{marginTop:1,flexDirection:`column`,children:[Y(V,{dimColor:!0,children:[`↑/↓ navigate · `,J(V,{bold:!0,children:`o`}),`/Enter open in editor ·`,` `,J(V,{bold:!0,children:`d`}),` delete (reset on next --apply) ·`,` `,J(V,{bold:!0,children:`r`}),` reload`]}),Y(V,{dimColor:!0,children:[J(V,{bold:!0,children:`f`}),` toggle deferred-tools footgun [`,J(V,{color:f?`red`:void 0,bold:f,children:f?`SUPPRESSED`:`vanilla`}),`] · Esc go back`]})]})]})}const Lt=[`on`,`name-only`,`user-invocable-only`,`off`],Rt={on:`on (full description)`,"name-only":`name-only (model sees no description)`,"user-invocable-only":`user-invocable (hidden from model, /name still works)`,off:`off (not loaded)`},zt={on:void 0,"name-only":`cyan`,"user-invocable-only":`yellow`,off:`red`},Bt={on:`◉`,"name-only":`◐`,"user-invocable-only":`◑`,off:`○`},Vt=ke.join(we.homedir(),`.claude`,`settings.json`),Ht=[ke.join(we.homedir(),`.claude`,`skills`),ke.join(we.homedir(),`.agents`,`skills`)],Ut=e=>Lt[(Lt.indexOf(e)+1)%Lt.length],Wt=e=>Lt[(Lt.indexOf(e)-1+Lt.length)%Lt.length],Gt=()=>{let e=new Set;for(let t of Ht)if(Oe.existsSync(t))try{let n=Oe.readdirSync(t,{withFileTypes:!0});for(let t of n)(t.isDirectory()||t.isSymbolicLink())&&e.add(t.name)}catch{}return[...e].sort()},Kt=()=>{try{let e=Oe.readFileSync(Vt,`utf8`);return{skillOverrides:JSON.parse(e).skillOverrides??{}}}catch{return{skillOverrides:{}}}},qt=e=>{let t={};try{t=JSON.parse(Oe.readFileSync(Vt,`utf8`))}catch{}t.skillOverrides=e,Oe.writeFileSync(Vt,JSON.stringify(t,null,2))};function Jt({onSubmit:e}){let[t,n]=K({}),[r,i]=K([]),[a,o]=K(0),[s,c]=K(!1);G(()=>{i(Gt()),n(Kt().skillOverrides)},[]);let l=Se(()=>r.map(e=>({name:e,state:t[e]??`on`})),[r,t]),u=l.length,d=Math.max(0,u-1),f=Se(()=>a<10?0:Math.min(a-10+1,Math.max(0,u-10)),[a,u]),p=l.slice(f,f+10),m=(e,r)=>{let i=l[e]?.name;if(!i)return;let a={...t};r===`on`?delete a[i]:a[i]=r,n(a),qt(a),c(!0),setTimeout(()=>c(!1),1500)};H((t,n)=>{if(n.escape||n.return&&u===0){e();return}n.upArrow?o(e=>Math.max(0,e-1)):n.downArrow?o(e=>Math.min(d,e+1)):t===` `||n.rightArrow?m(a,Ut(l[a]?.state??`on`)):n.leftArrow?m(a,Wt(l[a]?.state??`on`)):t===`0`?m(a,`on`):t===`x`&&m(a,`off`)});let h=l[a];return Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(X,{children:`Skills (per-skill skillOverrides)`})}),Y(B,{marginBottom:1,flexDirection:`column`,children:[Y(V,{children:[`Writes `,J(V,{bold:!0,children:`skillOverrides`}),` to`,` `,J(V,{color:`cyan`,children:`~/.claude/settings.json`}),` — CC reads this natively, no tweakcc patch needed.`]}),J(V,{dimColor:!0,children:`Each skill: on / name-only / user-invocable-only / off. CC honors immediately; no --apply required.`})]}),u===0?J(B,{children:Y(V,{color:`yellow`,children:[`No skills found in`,` `,Ht.map(e=>e.replace(we.homedir(),`~`)).join(` or `),`.`]})}):Y(q,{children:[f>0&&J(B,{children:Y(V,{dimColor:!0,children:[` ↑ `,f,` more above`]})}),p.map((e,t)=>{let n=f+t===a;return Y(B,{flexDirection:`row`,children:[J(B,{width:2,children:J(V,{color:n?`cyan`:void 0,children:n?`❯ `:` `})}),J(B,{width:3,children:J(V,{color:zt[e.state],children:Bt[e.state]})}),J(B,{width:26,children:J(V,{dimColor:!0,color:zt[e.state],children:e.state})}),J(B,{flexGrow:1,children:J(V,{bold:n,color:n?`cyan`:void 0,children:e.name})})]},e.name)}),f+10<u&&J(B,{children:Y(V,{dimColor:!0,children:[` `,`↓ `,u-f-10,` more below`]})})]}),h&&J(B,{flexDirection:`column`,marginTop:1,children:J(V,{dimColor:!0,children:Rt[h.state]})}),Y(B,{marginTop:1,flexDirection:`column`,children:[Y(V,{dimColor:!0,children:[`↑/↓ navigate · space/→/← cycle state · `,J(V,{bold:!0,children:`0`}),` set on ·`,` `,J(V,{bold:!0,children:`x`}),` set off · Esc back`]}),s&&J(V,{color:`green`,children:`✓ saved to settings.json`})]})]})}const $=be({settings:e,updateSettings:e=>{},changesApplied:!1,ccVersion:``});function Yt({startupCheckInfo:e,configMigrated:t,invocationCommand:n,initialConfig:i}){let[a,s]=K(i),[c,l]=K(!i.hidePiebaldAnnouncement),u=xe(e=>{let t=JSON.parse(JSON.stringify(a.settings));e(t),s(e=>({...e,settings:t,changesApplied:!1})),ae(e=>{e.settings=t,e.changesApplied=!1})},[a.settings]),[d,f]=K(null),[p,m]=K(null);G(()=>{e.wasUpdated&&e.oldVersion&&(m({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
|
|
3
3
|
(However, your customization are still remembered in ${ne}.)
|
|
4
4
|
|
|
5
5
|
Please reapply your changes by running \`${n} --apply\`.`,type:`warning`}),u(()=>{}))},[]),H((e,t)=>{t.ctrl&&e===`c`&&process.exit(0),(e===`q`||t.escape)&&!d&&process.exit(0),e===`h`&&!d&&c&&(l(!1),ae(e=>{e.hidePiebaldAnnouncement=!0}))},{isActive:!d});let h=t=>{switch(m(null),t){case Z.THEMES:case Z.THINKING_VERBS:case Z.THINKING_STYLE:case Z.USER_MESSAGE_DISPLAY:case Z.INPUT_PATTERN_HIGHLIGHTERS:case Z.MISC:case Z.TOOLSETS:case Z.SUBAGENT_MODELS:case Z.CLAUDE_MD_ALT_NAMES:case Z.SYSTEM_REMINDERS:case Z.SKILLS:f(t);break;case Z.VIEW_SYSTEM_PROMPTS:r(w);break;case Z.RESTORE_ORIGINAL:e.ccInstInfo&&(e.ccInstInfo.nativeInstallationPath?o(e.ccInstInfo):y(e.ccInstInfo)).then(()=>{m({message:`Original Claude Code restored successfully!`,type:`success`}),u(()=>{})});break;case Z.OPEN_CONFIG:j(ne);break;case Z.OPEN_CLI:e.ccInstInfo?.cliPath&&j(e.ccInstInfo.cliPath);break;case Z.EXIT:process.exit(0)}},g=()=>{f(null)};return J($.Provider,{value:{settings:a.settings,updateSettings:u,changesApplied:a.changesApplied,ccVersion:e.ccInstInfo?.version||``},children:J(B,{flexDirection:`column`,children:d===null?J(Ke,{onSubmit:h,notification:p,configMigrated:t,showPiebaldAnnouncement:c,changesApplied:a.changesApplied,invocationCommand:n}):d===Z.THEMES?J(st,{onBack:g}):d===Z.THINKING_VERBS?J(ct,{onBack:g}):d===Z.THINKING_STYLE?J(pt,{onBack:g}):d===Z.USER_MESSAGE_DISPLAY?J(_t,{onBack:g}):d===Z.INPUT_PATTERN_HIGHLIGHTERS?J(St,{onBack:g}):d===Z.MISC?J(Tt,{onSubmit:g}):d===Z.TOOLSETS?J(Ot,{onBack:g}):d===Z.SUBAGENT_MODELS?J(kt,{onBack:g}):d===Z.CLAUDE_MD_ALT_NAMES?J(At,{onBack:g}):d===Z.SYSTEM_REMINDERS?J(It,{onSubmit:g}):d===Z.SKILLS?J(Jt,{onSubmit:g}):null})})}async function Xt(e,t){let n=t??await M(),r=await le(n,e);if(!r)return{startupCheckInfo:null,pendingCandidates:null,config:n};let i=he(r);return i?{startupCheckInfo:null,pendingCandidates:i,config:n}:{startupCheckInfo:await Zt(n,r),pendingCandidates:null,config:n}}async function Zt(e,t){if(!t)return null;if(t.version)try{l(await S(t.version))}catch{}let n=t.version,r=e.ccVersion,i=!1;await O(ie)||(F(`startupCheck: ${ie} not found; backing up cli.js`),await s(t),i=!0);let a=!1;return t.nativeInstallationPath&&!await O(k)&&(F(`startupCheck: ${k} not found; backing up native binary`),await _(t),a=!0),n===r?{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}:(i||(F(`startupCheck: real version (${n}) != backed up version (${r}); backing up cli.js`),await De.unlink(ie),await s(t)),t.nativeInstallationPath&&!a&&(F(`startupCheck: real version (${n}) != backed up version (${r}); backing up native binary`),await O(k)&&await De.unlink(k),await _(t)),{wasUpdated:!0,oldVersion:r,newVersion:n,ccInstInfo:t})}let Qt;async function $t(){if(Qt!==void 0)return Qt;try{return Qt=(await import(`oxfmt`)).format,Qt}catch(e){return F(`Failed to load oxfmt:`,e),Qt=null,null}}async function en(e,t,n){let r=await $t();if(!r)return F(`oxfmt unavailable, skipping format+diff`),null;let i=n?.contextLines??10,a=n?.printWidth??80,o=performance.now(),[s,c]=await Promise.all([r(`original.js`,e,{printWidth:a}),r(`modified.js`,t,{printWidth:a})]),l=performance.now();if(s.errors.length>0||c.errors.length>0)return F(`oxfmt format errors:`,`original:`,s.errors,`modified:`,c.errors),null;let u=Ne(`original.js`,`modified.js`,s.code,c.code,``,``,{context:i}),d=performance.now();return{hunks:u.hunks,changeCount:u.hunks.length,formattedLines:s.code.split(`
|
package/dist/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e,F as t,I as n,K as r,L as i,O as a,R as o,V as s,a as c,c as l,h as u,l as d,q as f,r as p,z as m}from"../config-
|
|
1
|
+
import{B as e,F as t,I as n,K as r,L as i,O as a,R as o,V as s,a as c,c as l,h as u,l as d,q as f,r as p,z as m}from"../config-B1Mrn1vp.mjs";import{a as h,i as g,n as _,r as v,t as y}from"../content-bCX2ah6I.mjs";import*as b from"node:fs/promises";import*as x from"node:path";async function S(e,t){let n=x.dirname(t);await b.mkdir(n,{recursive:!0}),await b.copyFile(e,t)}async function C(e,t){if(!await u(e))throw Error(`Backup file does not exist: ${e}`);await a(t,await b.readFile(e),`restore`)}function w(){return l()}function T(){return p}function E(){return c}async function D(){return await d()}const O={findChalkVar:i,getModuleLoaderFunction:m,getReactVar:e,getRequireFuncName:s,findTextComponent:o,findBoxComponent:n,clearCaches:t,globalReplace:r,showDiff:f};export{S as backupFile,v as findAllInstallations,w as getTweakccConfigDir,T as getTweakccConfigPath,E as getTweakccSystemPromptsDir,O as helpers,y as readContent,D as readTweakccConfig,C as restoreBackup,g as showInteractiveInstallationPicker,h as tryDetectInstallation,_ as writeContent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,p as t}from"./config-
|
|
1
|
+
import{C as e,p as t}from"./config-B1Mrn1vp.mjs";import n from"node:os";import r from"node:fs";import i from"node:path";import{execFileSync as a,execSync as o}from"node:child_process";import s from"node-lief";function c(e){try{if(r.statSync(e).size>2e5)return null;s.logging.disable();let n=s.parse(e);if(!n.symbols().some(e=>{let t=e.name;return t===`execv`||t===`_execv`}))return t(`resolveNixBinaryWrapper: no execv import found, not a Nix wrapper`),null;t(`resolveNixBinaryWrapper: execv import found, checking for Nix wrapper DOCSTRING`);let i=null;if(n.format===`ELF`){let e=n.sections().find(e=>e.name===`.rodata`);e&&(i=e.content)}else if(n.format===`MachO`){let e=n.getSegment(`__TEXT`);if(e){let t=e.getSection(`__cstring`);t&&(i=t.content)}}if(!i||i.length===0)return t(`resolveNixBinaryWrapper: could not read string section`),null;let a=i.toString(`utf-8`),o=a.match(/makeCWrapper\s+'(\/nix\/store\/[^']+)'/);if(o){let e=o[1];return t(`resolveNixBinaryWrapper: found wrapped executable via DOCSTRING: ${e}`),e}let c=a.match(/makeCWrapper\s+(\/nix\/store\/\S+)/);if(c){let e=c[1];return t(`resolveNixBinaryWrapper: found wrapped executable via unquoted DOCSTRING: ${e}`),e}let l=a.match(/\/nix\/store\/[^\0\n\r]+/g);if(l){for(let e of l)if(e.includes(`/bin/`))return t(`resolveNixBinaryWrapper: found wrapped executable via /bin/ heuristic: ${e}`),e}return t(`resolveNixBinaryWrapper: has execv but no Nix store paths found`),null}catch(e){return t(`resolveNixBinaryWrapper: error during detection:`,e),null}}const l=Buffer.from(`
|
|
2
2
|
---- Bun! ----
|
|
3
3
|
`);function u(e,t){return e.subarray(t.offset,t.offset+t.length)}function d(e,t){return{offset:e.readUInt32LE(t),length:e.readUInt32LE(t+4)}}function f(e){return e.endsWith(`/claude`)||e===`claude`||e.endsWith(`/claude.exe`)||e===`claude.exe`||e.endsWith(`/src/entrypoints/cli.js`)||e===`src/entrypoints/cli.js`}function p(e){let n=e%52==0,r=e%36==0;return n&&!r?52:r&&!n?36:n&&r?(t(`detectModuleStructSize: Ambiguous module list length ${e}, assuming new format`),52):(t(`detectModuleStructSize: Module list length ${e} doesn't cleanly divide by either struct size, assuming new format`),52)}function m(e,t,n,r){let i=u(e,t.modulesPtr),a=Math.floor(i.length/n);for(let t=0;t<a;t++){let a=g(i,t*n,n),o=r(a,u(e,a.name).toString(`utf-8`),t);if(o!==void 0)return o}}function h(e){let t=0,n=e.readBigUInt64LE(t);t+=8;let r=d(e,t);t+=8;let i=e.readUInt32LE(t);t+=4;let a=d(e,t);return t+=8,{byteCount:n,modulesPtr:r,entryPointId:i,compileExecArgvPtr:a,flags:e.readUInt32LE(t)}}function g(e,t,n){let r=t,i=d(e,r);r+=8;let a=d(e,r);r+=8;let o=d(e,r);r+=8;let s=d(e,r);r+=8;let c,l;n===52?(c=d(e,r),r+=8,l=d(e,r),r+=8):(c={offset:0,length:0},l={offset:0,length:0});let u=e.readUInt8(r);r+=1;let f=e.readUInt8(r);r+=1;let p=e.readUInt8(r);r+=1;let m=e.readUInt8(r);return{name:i,contents:a,sourcemap:o,bytecode:s,moduleInfo:c,bytecodeOriginPath:l,encoding:u,loader:f,moduleFormat:p,side:m}}function _(e){if(e.length<32+l.length)throw Error(`BUN data is too small to contain trailer and offsets`);let n=e.length-l.length,r=e.subarray(n);if(t(`parseBunDataBlob: Expected trailer: ${l.toString(`hex`)}`),t(`parseBunDataBlob: Got trailer: ${r.toString(`hex`)}`),!r.equals(l))throw t(`Expected: ${l.toString(`hex`)}`),t(`Got: ${r.toString(`hex`)}`),Error(`BUN trailer bytes do not match trailer`);let i=e.length-32-l.length,a=h(e.subarray(i,i+32));return{bunOffsets:a,bunData:e,moduleStructSize:p(a.modulesPtr.length)}}function v(e){if(e.length<4)throw Error(`Section data too small`);t(`extractBunDataFromSection: sectionData.length=${e.length}`);let n=e.readUInt32LE(0),r=4+n,i=e.length>=8?Number(e.readBigUInt64LE(0)):0,a=8+i;t(`extractBunDataFromSection: u32 header would give size=${n}, expected total=${r}`),t(`extractBunDataFromSection: u64 header would give size=${i}, expected total=${a}`);let o,s;if(e.length>=8&&a<=e.length&&a>=e.length-4096)o=8,s=i,t(`extractBunDataFromSection: detected u64 header format (Bun >= 1.3.4)`);else if(r<=e.length&&r>=e.length-4096)o=4,s=n,t(`extractBunDataFromSection: detected u32 header format (Bun < 1.3.4)`);else throw Error(`Cannot determine section header format: sectionData.length=${e.length}, u64 would expect ${a}, u32 would expect ${r}`);t(`extractBunDataFromSection: bunDataSize from header=${s}`);let c=e.subarray(o,o+s);t(`extractBunDataFromSection: bunDataContent.length=${c.length}`);let{bunOffsets:l,bunData:u,moduleStructSize:d}=_(c);return{bunOffsets:l,bunData:u,sectionHeaderSize:o,moduleStructSize:d}}function y(e){try{let n=e.getSection(`.bun`);if(!n)return t(`extractBunDataFromELFSection: .bun section not found`),null;let r=n.content;if(r.length<8)return t(`extractBunDataFromELFSection: .bun section too small`),null;t(`extractBunDataFromELFSection: .bun section found, size=${r.length}`);let i=v(r);return t(`extractBunDataFromELFSection: successfully extracted data`),i}catch(e){return t(`extractBunDataFromELFSection: failed to extract:`,e),null}}function b(e){if(!e.hasOverlay)throw Error(`ELF binary has no overlay data`);let n=e.overlay;if(t(`extractBunDataFromELFOverlay: Overlay size=${n.length} bytes`),n.length<l.length+8+32)throw Error(`ELF overlay data is too small`);let r=n.readBigUInt64LE(n.length-8);if(t(`extractBunDataFromELFOverlay: Total byte count from tail=${r}`),r<4096n||r>2n**32n-1n)throw Error(`ELF total byte count is out of range: ${r}`);let i=n.length-8-l.length,a=n.subarray(i,n.length-8);if(t(`extractBunDataFromELFOverlay: Expected trailer: ${l.toString(`hex`)}`),t(`extractBunDataFromELFOverlay: Got trailer: ${a.toString(`hex`)}`),!a.equals(l))throw Error(`BUN trailer bytes do not match trailer`);let o=n.length-8-l.length-32,s=n.subarray(o,n.length-8-l.length),c=h(s);t(`extractBunDataFromELFOverlay: Offsets.byteCount=${c.byteCount}`);let u=typeof c.byteCount==`bigint`?c.byteCount:BigInt(c.byteCount);if(u>=r)throw Error(`ELF total byte count is out of range`);let d=8+l.length+32,f=n.length-d-Number(u),m=n.subarray(f,n.length-d);return t(`extractBunDataFromELFOverlay: Extracted ${m.length} bytes of data`),{bunOffsets:c,bunData:Buffer.concat([m,s,a]),moduleStructSize:p(c.modulesPtr.length)}}function x(e){let t=e.getSegment(`__BUN`);if(!t)throw Error(`__BUN segment not found`);let n=t.getSection(`__bun`);if(!n)throw Error(`__bun section not found`);return v(n.content)}function S(e){let t=e.sections().find(e=>e.name===`.bun`);if(!t)throw Error(`.bun section not found`);return v(t.content)}function C(){switch(process.platform){case`darwin`:return`MachO`;case`linux`:return`ELF`;case`win32`:return`PE`;default:return null}}function w(e){let t=C();if(t&&e.format!==t)throw Error(`Native binary format ${e.format} does not match ${process.platform} (${t})`)}function T(e,n){switch(t(`locateBundle: Binary format detected as ${e.format}`),w(e),e.format){case`MachO`:{let t=e,r=x(t);if(!r.sectionHeaderSize)throw Error(`sectionHeaderSize is required for Mach-O binaries`);let i=t.getSegment(`__BUN`).getSection(`__bun`);return{...r,offset:Number(i.fileOffset),length:i.content.length,write:(e,i)=>j(t,n,e,i,r.sectionHeaderSize)}}case`PE`:{let t=e,r=S(t);if(!r.sectionHeaderSize)throw Error(`sectionHeaderSize is required for PE binaries`);let i=t.sections().find(e=>e.name===`.bun`);return{...r,offset:Number(i.fileOffset),length:i.content.length,write:(e,i)=>M(t,n,e,i,r.sectionHeaderSize)}}case`ELF`:{let i=e,a=y(i);if(a){if(t(`locateBundle: Using new ELF .bun section format`),!a.sectionHeaderSize)throw Error(`sectionHeaderSize is required for ELF .bun section`);return{...a,offset:Number(i.getSection(`.bun`).fileOffset),length:i.getSection(`.bun`).content.length,write:(e,t)=>F(i,n,e,t,a.sectionHeaderSize)}}t(`locateBundle: Falling back to legacy ELF overlay format`);let o=b(i),s=r.statSync(n);return{...o,offset:s.size-i.overlay.length,length:i.overlay.length,write:(e,t)=>I(i,n,e,t)}}default:{let t=e;throw Error(`Unsupported binary format: ${t.format}`)}}}function E(e){let o=r.mkdtempSync(i.join(n.tmpdir(),`tweakcc-npm-`));try{t(`fetchNpmSource: Downloading @anthropic-ai/claude-code@${e}`),a(`npm`,[`pack`,`@anthropic-ai/claude-code@${e}`,`--pack-destination`,o],{stdio:`pipe`,timeout:3e4,cwd:o});let n=r.readdirSync(o).find(e=>e.endsWith(`.tgz`));if(!n)return t(`fetchNpmSource: No .tgz file found after npm pack`),null;a(`tar`,[`xzf`,i.join(o,n),`package/cli.js`],{stdio:`pipe`,timeout:3e4,cwd:o});let s=i.join(o,`package`,`cli.js`);if(!r.existsSync(s))return t(`fetchNpmSource: cli.js not found in extracted package`),null;let c=r.readFileSync(s);return t(`fetchNpmSource: Got cli.js, ${c.length} bytes`),c}catch(e){return t(`fetchNpmSource: Failed to fetch npm source:`,e),null}finally{try{r.rmSync(o,{recursive:!0,force:!0})}catch{}}}function D(e,n){try{s.logging.disable();let{bunOffsets:r,bunData:i,moduleStructSize:a}=T(s.parse(e),e);t(`extractClaudeJsFromNativeInstallation: Got bunData, size=${i.length} bytes, moduleStructSize=${a}`);let o=m(i,r,a,(e,n,r)=>{if(t(`extractClaudeJsFromNativeInstallation: Module ${r}: ${n}`),!f(n))return;let a=u(i,e.contents);return t(`extractClaudeJsFromNativeInstallation: Found claude module, contents length=${a.length}`),a.length>0?a:void 0});if(o){if(o.subarray(0,30).toString(`utf8`).startsWith(`// @bun @bytecode`))if(t(`extractClaudeJsFromNativeInstallation: Extracted content is Bun bytecode — falling back to npm source`),n){let e=E(n);if(e)return t(`extractClaudeJsFromNativeInstallation: Using npm source (${e.length} bytes) instead of bytecode`),{data:e,clearBytecode:!0};t(`extractClaudeJsFromNativeInstallation: npm source fetch failed, returning bytecode content as-is`)}else t(`extractClaudeJsFromNativeInstallation: No version provided, cannot fetch npm source`);return{data:o,clearBytecode:!1}}return t(`extractClaudeJsFromNativeInstallation: claude module not found in any module`),{data:null,clearBytecode:!1}}catch(e){return t(`extractClaudeJsFromNativeInstallation: Error during extraction:`,e),{data:null,clearBytecode:!1}}}function O(e,t,n,r,i){let a=[],o=[];m(e,t,r,(t,s)=>{let c=u(e,t.name),l,d;n&&f(s)?(l=n,d=i?Buffer.alloc(0):u(e,t.bytecode)):(l=u(e,t.contents),d=u(e,t.bytecode));let p=u(e,t.sourcemap),m=u(e,t.moduleInfo),h=u(e,t.bytecodeOriginPath);o.push({name:c,contents:l,sourcemap:p,bytecode:d,moduleInfo:m,bytecodeOriginPath:h,encoding:t.encoding,loader:t.loader,moduleFormat:t.moduleFormat,side:t.side}),r===52?a.push(c,l,p,d,m,h):a.push(c,l,p,d)});let s=r===52?6:4,c=0,d=[];for(let e of a)d.push({offset:c,length:e.length}),c+=e.length+1;let p=c,h=o.length*r;c+=h;let g=u(e,t.compileExecArgvPtr),_=c,v=g.length;c+=v+1;let y=c;c+=32;let b=c;c+=l.length;let x=Buffer.allocUnsafe(c);x.fill(0);let S=0;for(let{offset:e,length:t}of d)t>0&&a[S].copy(x,e,0,t),x[e+t]=0,S++;v>0&&(g.copy(x,_,0,v),x[_+v]=0);for(let e=0;e<o.length;e++){let t=o[e],n=e*s,i={name:d[n],contents:d[n+1],sourcemap:d[n+2],bytecode:d[n+3],moduleInfo:r===52?d[n+4]:{offset:0,length:0},bytecodeOriginPath:r===52?d[n+5]:{offset:0,length:0},encoding:t.encoding,loader:t.loader,moduleFormat:t.moduleFormat,side:t.side},a=p+e*r;x.writeUInt32LE(i.name.offset,a),x.writeUInt32LE(i.name.length,a+4),a+=8,x.writeUInt32LE(i.contents.offset,a),x.writeUInt32LE(i.contents.length,a+4),a+=8,x.writeUInt32LE(i.sourcemap.offset,a),x.writeUInt32LE(i.sourcemap.length,a+4),a+=8,x.writeUInt32LE(i.bytecode.offset,a),x.writeUInt32LE(i.bytecode.length,a+4),a+=8,r===52&&(x.writeUInt32LE(i.moduleInfo.offset,a),x.writeUInt32LE(i.moduleInfo.length,a+4),a+=8,x.writeUInt32LE(i.bytecodeOriginPath.offset,a),x.writeUInt32LE(i.bytecodeOriginPath.length,a+4),a+=8),x.writeUInt8(i.encoding,a),x.writeUInt8(i.loader,a+1),x.writeUInt8(i.moduleFormat,a+2),x.writeUInt8(i.side,a+3)}let C={byteCount:y,modulesPtr:{offset:p,length:h},entryPointId:t.entryPointId,compileExecArgvPtr:{offset:_,length:v},flags:t.flags},w=y,T=typeof C.byteCount==`bigint`?C.byteCount:BigInt(C.byteCount);return x.writeBigUInt64LE(T,w),w+=8,x.writeUInt32LE(C.modulesPtr.offset,w),x.writeUInt32LE(C.modulesPtr.length,w+4),w+=8,x.writeUInt32LE(C.entryPointId,w),w+=4,x.writeUInt32LE(C.compileExecArgvPtr.offset,w),x.writeUInt32LE(C.compileExecArgvPtr.length,w+4),w+=8,x.writeUInt32LE(C.flags,w),l.copy(x,b),x}function k(e,t,n,i=!0){let a=t+`.tmp`;if(e.write(a),i){let e=r.statSync(n);r.chmodSync(a,e.mode)}try{r.renameSync(a,t)}catch(e){try{r.existsSync(a)&&r.unlinkSync(a)}catch{}throw e instanceof Error&&`code`in e&&(e.code===`ETXTBSY`||e.code===`EBUSY`||e.code===`EPERM`)?Error(`Cannot update the Claude executable while it is running.
|
|
4
4
|
Please close all Claude instances and try again.`):e}}function A(e,t=8){let n=Buffer.allocUnsafe(t+e.length);return t===8?n.writeBigUInt64LE(BigInt(e.length),0):n.writeUInt32LE(e.length,0),e.copy(n,t),n}function j(n,r,i,a,c){try{t(`repackMachO: Has code signature: ${n.hasCodeSignature}`),n.hasCodeSignature&&(t(`repackMachO: Removing code signature...`),n.removeSignature());let l=n.getSegment(`__BUN`);if(!l)throw Error(`__BUN segment not found`);let u=l.getSection(`__bun`);if(!u)throw Error(`__bun section not found`);let d=A(i,c);t(`repackMachO: Original section size: ${u.size}`),t(`repackMachO: Original segment fileSize: ${l.fileSize}`),t(`repackMachO: Original segment virtualSize: ${l.virtualSize}`),t(`repackMachO: New data size: ${d.length}`),t(`repackMachO: Using header size: ${c}`);let f=d.length-Number(u.size);if(f>0){let e=n.header.cpuType===s.MachO.Header.CPU_TYPE.ARM64,r=e?16384:4096,i=Math.ceil(f/r)*r;t(`repackMachO: CPU type: ${e?`ARM64`:`x86_64`}`),t(`repackMachO: Page size: ${r} bytes`),t(`repackMachO: Need to expand by ${f} bytes`),t(`repackMachO: Rounding up to page-aligned: ${i} bytes`);let a=n.extendSegment(l,i);if(t(`repackMachO: extendSegment returned: ${a}`),!a)throw Error(`Failed to extend __BUN segment`);t(`repackMachO: Section size after extend: ${u.size}`),t(`repackMachO: Segment fileSize after extend: ${l.fileSize}`),t(`repackMachO: Segment virtualSize after extend: ${l.virtualSize}`)}u.content=d,u.size=BigInt(d.length),t(`repackMachO: Final section size: ${u.size}`),t(`repackMachO: Writing modified binary to ${a}...`),k(n,a,r);try{t(`repackMachO: Re-signing binary with ad-hoc signature...`),o(`codesign -s - -f "${a}"`,{stdio:e()?`inherit`:`ignore`}),t(`repackMachO: Code signing completed successfully`)}catch(e){console.warn(`Warning: Failed to re-sign binary. The binary may not run correctly on macOS:`,e)}t(`repackMachO: Write completed successfully`)}catch(e){throw console.error(`repackMachO failed:`,e),e}}function M(e,n,r,i,a){try{let o=e.sections().find(e=>e.name===`.bun`);if(!o)throw Error(`.bun section not found`);let s=A(r,a);t(`repackPE: Original section size: ${o.size}, virtual size: ${o.virtualSize}`),t(`repackPE: New data size: ${s.length}`),t(`repackPE: Using header size: ${a}`),o.content=s,o.virtualSize=BigInt(s.length),o.size=BigInt(s.length),t(`repackPE: Writing modified binary to ${i}...`),k(e,i,n,!1),t(`repackPE: Write completed successfully`)}catch(e){throw console.error(`repackPE failed:`,e),e}}const N=16384;function P(e,t){return(e+t-1n)/t*t}function F(e,n,r,i,a){try{let o=e.getSection(`.bun`);if(!o)throw Error(`.bun section not found`);let s=e.segments().find(e=>e.type===`LOAD`&&(e.flags&2)!=0);if(!s)throw Error(`No writable ELF PT_LOAD segment found`);let c=A(r,a),l=o.virtualAddress,u=Buffer.alloc(8);u.writeBigUInt64LE(l);let d=null,f=s.content,p=s.virtualAddress,m=P(p,BigInt(N)),h=p+BigInt(f.length)-8n;for(let e=m;e<=h;e+=BigInt(N)){let t=Number(e-p);if(f.subarray(t,t+8).equals(u)){d=e;break}}if(d===null)throw Error(`Could not find original BUN_COMPILED location in binary (searched for 0x${l.toString(16)})`);let g=e.pageSize(),_=BigInt(c.length),v=P(_,g),y=P(e.nextVirtualAddress(),g),b=y-s.virtualAddress,x=s.fileOffset+b,S=s.fileOffset+s.fileSize,C=x+v-S;if(C<0n)throw Error(`New .bun location overlaps existing writable ELF segment`);if(t(`repackELFSection: moving .bun to offset=0x${x.toString(16)}, vaddr=0x${y.toString(16)}, size=0x${_.toString(16)}`),C>0n&&!e.extend(s,C))throw Error(`Failed to extend writable ELF PT_LOAD segment`);o.fileOffset=x,o.virtualAddress=y,o.content=c,o.size=_;let w=Buffer.alloc(8);w.writeBigUInt64LE(y),e.patchAddress(d,w),t(`repackELFSection: Patched BUN_COMPILED at vaddr 0x${d.toString(16)} -> 0x${y.toString(16)}`),k(e,i,n),t(`repackELFSection: Write completed successfully`)}catch(e){throw console.error(`repackELFSection failed:`,e),e}}function I(e,n,r,i){try{let a=Buffer.allocUnsafe(r.length+8);r.copy(a,0),a.writeBigUInt64LE(BigInt(r.length),r.length),t(`repackELFOverlay: Setting overlay data (${a.length} bytes)`),e.overlay=a,t(`repackELFOverlay: Writing modified binary to ${i}...`),k(e,i,n),t(`repackELFOverlay: Write completed successfully`)}catch(e){throw console.error(`repackELFOverlay failed:`,e),e}}function L(e,t,n,r){s.logging.disable();let i=T(s.parse(e),e),a=O(i.bunData,i.bunOffsets,t,i.moduleStructSize,r);i.write(a,n)}export{D as extractClaudeJsFromNativeInstallation,L as repackNativeInstallation,c as resolveNixBinaryWrapper};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tweakcc-fixed",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Maintained fork of tweakcc — patch an installed Claude Code (npm or native binary) with curated system-prompt overrides, system-reminder overrides, and fork-only patches. Pairs with skrabe/lobotomized-claude-code.",
|
|
6
6
|
"main": "dist/lib/index.mjs",
|