tweakcc 3.2.0 → 3.2.2
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/index.js +45 -45
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Box as m,Text as a,render as Dt,useInput as de}from"ink";import{Command as vn}from"commander";import F from"chalk";import st,{Fragment as Be,createContext as Cn,useCallback as Lt,useContext as pe,useEffect as
|
|
2
|
+
import{Box as m,Text as a,render as Dt,useInput as de}from"ink";import{Command as vn}from"commander";import F from"chalk";import st,{Fragment as Be,createContext as Cn,useCallback as Lt,useContext as pe,useEffect as we,useMemo as Tt,useRef as $n,useState as B}from"react";import*as Re from"node:os";import Ce,{EOL as Mt}from"node:os";import wt from"ink-link";import*as oe from"node:fs/promises";import re from"node:fs/promises";import*as Le from"node:fs";import gt from"node:fs";import*as ae from"node:path";import le from"node:path";import*as Oe from"node:child_process";import*as Rt from"node:crypto";import Ke from"gray-matter";import{Fragment as $e,jsx as s,jsxs as h}from"react/jsx-runtime";import _n from"node:process";import In from"which";import{WASMagic as Tn}from"wasmagic";import{globbySync as Ft}from"globby";const Mn="modulepreload",En=function(e){return"/"+e},Et={},ft=function(n,t,r){let i=Promise.resolve();if(t&&t.length>0){let d=function(g){return Promise.all(g.map(f=>Promise.resolve(f).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const l=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),u=c?.nonce||c?.getAttribute("nonce");i=d(t.map(g=>{if(g=En(g,r),g in Et)return;Et[g]=!0;const f=g.endsWith(".css"),x=f?'[rel="stylesheet"]':"";if(!!r)for(let b=l.length-1;b>=0;b--){const I=l[b];if(I.href===g&&(!f||I.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${g}"]${x}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":Mn,f||(p.as="script"),p.crossOrigin="",p.href=g,u&&p.setAttribute("nonce",u),document.head.appendChild(p),f)return new Promise((b,I)=>{p.addEventListener("load",b),p.addEventListener("error",()=>I(new Error(`Unable to preload CSS for ${g}`)))})}))}function o(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&o(c.reason);return n().catch(o)})};let Je=null;async function Vt(){if(Je!==null)return Je;try{return await ft(()=>import("node-lief"),[]),Je=await ft(()=>import("./nativeInstallation-D3Dxr9ST.js"),[]),Je}catch{return null}}async function jt(e){const n=await Vt();return n?n.extractClaudeJsFromNativeInstallation(e):null}async function kn(e,n,t){const r=await Vt();if(!r)throw new Error("`repackNativeInstallation()` called but `node-lief` is not available. This is unexpected - `extractClaudeJsFromNativeInstallation()` should have been called first.");r.repackNativeInstallation(e,n,t)}const Nn=e=>{const n=[],t=/visibleOptionCount:[\w$]+=(\d+)/g;let r;for(;(r=t.exec(e))!==null;){const i=r.index+r[0].indexOf("=")+1;n.push({startIndex:i,endIndex:i+r[1].length})}return n},Bn=(e,n)=>{const t=Nn(e);if(t.length===0)return console.error("patch: writeShowMoreItemsInSelectMenus: failed to find locations"),null;const r=t.sort((o,l)=>l.startIndex-o.startIndex);let i=e;for(const o of r){const l=n.toString(),c=i.slice(0,o.startIndex)+l+i.slice(o.endIndex);z(i,c,l,o.startIndex,o.endIndex),i=c}return i};function Pn(e){const n=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,t=e.match(n);if(!t||t.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const r=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,i=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,o=e.match(r),l=e.match(i);return!o||o.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!l||l.index==null?(console.error("patch: themes: failed to find objMatch"),null):{switchStatement:{startIndex:t.index,endIndex:t.index+t[0].length,identifiers:[t[1].trim()]},objArr:{startIndex:o.index,endIndex:o.index+o[0].length},obj:{startIndex:l.index,endIndex:l.index+l[0].length}}}const An=(e,n)=>{const t=Pn(e);if(!t)return null;if(n.length===0)return e;let r=e;const i="return"+JSON.stringify(Object.fromEntries(n.map(c=>[c.id,c.name])));r=r.slice(0,t.obj.startIndex)+i+r.slice(t.obj.endIndex),z(e,r,i,t.obj.startIndex,t.obj.endIndex),e=r;const o=JSON.stringify(n.map(c=>({label:c.name,value:c.id})));r=r.slice(0,t.objArr.startIndex)+o+r.slice(t.objArr.endIndex),z(e,r,o,t.objArr.startIndex,t.objArr.endIndex),e=r;let l=`switch(${t.switchStatement.identifiers?.[0]}){
|
|
3
3
|
`;return n.forEach(c=>{l+=`case"${c.id}":return${JSON.stringify(c.colors)};
|
|
4
4
|
`}),l+=`default:return${JSON.stringify(n[0].colors)};
|
|
5
|
-
}`,r=r.slice(0,t.switchStatement.startIndex)+l+r.slice(t.switchStatement.endIndex),
|
|
6
|
-
return ${
|
|
5
|
+
}`,r=r.slice(0,t.switchStatement.startIndex)+l+r.slice(t.switchStatement.endIndex),z(e,r,l,t.switchStatement.startIndex,t.switchStatement.endIndex),r},On=e=>{const n=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[2m\]"\)\)return 2000000;)?(?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,t=e.match(n);return!t||t.index===void 0?(console.error("patch: context limit: failed to find match"),null):t.index+t[0].indexOf("{")+1},Dn=e=>{const n=On(e);if(!n)return null;const t="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",r=e.slice(0,n)+t+e.slice(n);return z(e,r,t,n,n),r},Ln=e=>{const n=e.indexOf('bash:"bashBorder"');if(n===-1)return console.error("patch: input border: failed to find bash pattern"),null;const t=e.slice(n,n+500),r=/borderStyle:"[^"]*"/,i=t.match(r);return!i||i.index===void 0?(console.error("patch: input border: failed to find border style pattern"),null):{startIndex:n+i.index,endIndex:n+i.index+i[0].length}},Rn=(e,n)=>{const t=Ln(e);if(!t)return null;if(n){const r="borderColor:undefined",i=e.slice(0,t.startIndex)+r+e.slice(t.endIndex);return z(e,i,r,t.startIndex,t.endIndex),i}else return e},Fn=e=>{const n=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const r=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,i=t[0].match(r);if(!i||i.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const o=t.index+i.index,l=o+i[0].length;return{startIndex:o,endIndex:l}},Vn=e=>{const n=Fn(e);if(!n)return null;const t=e.slice(0,n.startIndex)+e.slice(n.endIndex);return z(e,t,"",n.startIndex,n.endIndex),t},jn=e=>{const n=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,t=e.match(n);if(!t||t.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const r=e.slice(t.index,t.index+600),i=/([$\w]+)(=\(([^;]{1,200}?)\)\+"(?:…|\\u2026)")/,o=r.match(i);return!o||o.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:t.index+o.index+o[1].length,endIndex:t.index+o.index+o[1].length+o[2].length,identifiers:[o[3]]}},Un=(e,n)=>{const t=jn(e);if(!t)return null;const r=t,i=n.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),o=r.identifiers?.[0],c=`=${"`"+i.replace(/\{\}/g,"${"+o+"}")+"`"}`,u=e.slice(0,r.startIndex)+c+e.slice(r.endIndex);return z(e,u,c,r.startIndex,r.endIndex),u},Hn=e=>{const n=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,t=e.match(n);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]]}},Gn=(e,n)=>{const t=Hn(e);if(!t)return null;const r=t.identifiers?.[0],i=n?`=[...${r},...[...${r}].reverse()]`:`=[...${r}]`,o=e.slice(0,t.startIndex)+i+e.slice(t.endIndex);return z(e,o,i,t.startIndex,t.endIndex),o},Yn=e=>{const n=[],t=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let r;for(;(r=t.exec(e))!==null;)n.push({startIndex:r.index,endIndex:r.index+r[0].length});return n},Wn=(e,n)=>{const t=Yn(e);if(t.length===0)return null;const r=JSON.stringify(n),i=t.sort((l,c)=>c.startIndex-l.startIndex);let o=e;for(let l=0;l<i.length;l++){const c=o.slice(0,i[l].startIndex)+r+o.slice(i[l].endIndex);z(o,c,r,i[l].startIndex,i[l].endIndex),o=c}return o},zn=e=>{const n=/[, ][$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,t=e.match(n);if(!t||t.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const r=t[0],i=t[1],o=r.lastIndexOf(i),l=t.index+o,c=l+i.length;return{startIndex:l,endIndex:c}},Jn=(e,n)=>{const t=zn(e);if(!t)return null;const r=JSON.stringify(n),i=e.slice(0,t.startIndex)+r+e.slice(t.endIndex);return z(e,i,r,t.startIndex,t.endIndex),i},Xn=e=>{const n=/\{flexWrap:"wrap",height:1,width:2\}/,t=e.match(n);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}},qn=(e,n)=>{const t=Xn(e);if(!t)return null;const r=`{flexWrap:"wrap",height:1,width:${n}}`,i=e.slice(0,t.startIndex)+r+e.slice(t.endIndex);return z(e,i,r,t.startIndex,t.endIndex),i},Kn=e=>{const n=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,t=e.match(n);return!t||t.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:t.index+1,endIndex:t.index+t[0].length,identifiers:[t[1]]}},Qn=e=>{const n=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,t=e.match(n);return!t||t.index==null?(console.error("patch: thinker verbs: failed to find match"),null):{startIndex:t.index,endIndex:t.index+t[0].length,identifiers:[t[1]]}},Zn=(e,n)=>{const t=Kn(e);if(!t)return null;const r=t,i=r.identifiers?.[0],o=`${i}=${JSON.stringify({words:n})}`,l=e.slice(0,r.startIndex)+o+e.slice(r.endIndex);z(e,l,o,r.startIndex,r.endIndex);const c=Qn(l);if(!c)return null;const u=c,g=`function ${u.identifiers?.[0]}(){return ${i}.words}`,f=l.slice(0,u.startIndex)+g+l.slice(u.endIndex);return z(l,f,g,u.startIndex,u.endIndex),f},er=e=>{const n=/return ([$\w]+)\.createElement\(([$\w]+),\{backgroundColor:"userMessageBackground",color:"text"\},"> ",([$\w]+)\+" "\);/,t=e.match(n);return!t||t.index==null?(console.error("patch: messageDisplayMatch: failed to find error message"),null):{startIndex:t.index,endIndex:t.index+t[0].length,identifiers:[t[1],t[2],t[3]]}},tr=(e,n,t,r,i=!1,o=!1,l=!1,c=!1,u=!1,d="none",g="rgb(255,255,255)",f=0,x=0,w=!1)=>{const p=er(e);if(!p)return console.error("^ patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;const b=yt(e);if(!b)return console.error("^ patch: userMessageDisplay: failed to find chalk variable"),null;const I=Ct(e);if(!I)return console.error("^ patch: userMessageDisplay: failed to find box component"),null;let T="";const S=[];t==="default"&&S.push('color:"text"'),r==="default"&&S.push('backgroundColor:"userMessageBackground"');const E=S.length>0?`{${S.join(",")}}`:"{}",R=[],O=d.startsWith("topBottom");if(d!=="none"){if(O){let G="";d==="topBottomSingle"?G='{top:"─",bottom:"─",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}':d==="topBottomDouble"?G='{top:"═",bottom:"═",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}':d==="topBottomBold"&&(G='{top:"━",bottom:"━",left:" ",right:" ",topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" "}'),R.push(`borderStyle:${G}`)}else R.push(`borderStyle:"${d}"`);const X=g.match(/\d+/g);X&&R.push(`borderColor:"rgb(${X.join(",")})"`)}f>0&&R.push(`paddingX:${f}`),x>0&&R.push(`paddingY:${x}`),w&&R.push('alignSelf:"flex-start"');const V=R.length>0?`{${R.join(",")}}`:"{}",D=t!=="default"||r!=="default"&&r!==null||i||o||l||c||u;if(D){if(T=b,t!=="default"){const X=t.match(/\d+/g);X&&(T+=`.rgb(${X.join(",")})`)}if(r!=="default"&&r!==null){const X=r.match(/\d+/g);X&&(T+=`.bgRgb(${X.join(",")})`)}i&&(T+=".bold"),o&&(T+=".italic"),l&&(T+=".underline"),c&&(T+=".strikethrough"),u&&(T+=".inverse")}const[Y,N,k]=p.identifiers,y='"'+n.replace(/\{\}/g,`"+${k}+"`)+'"',J=`
|
|
6
|
+
return ${Y}.createElement(
|
|
7
7
|
${I},
|
|
8
|
-
${
|
|
9
|
-
${
|
|
10
|
-
${
|
|
8
|
+
${V},
|
|
9
|
+
${Y}.createElement(
|
|
10
|
+
${N},
|
|
11
11
|
${E},
|
|
12
|
-
${D?T+"(":""}${
|
|
12
|
+
${D?T+"(":""}${y}${D?")":""}
|
|
13
13
|
)
|
|
14
|
-
);`,W=e.slice(0,p.startIndex)+
|
|
15
|
-
`),I=c;c=c.slice(0,w.startIndex)+b+c.slice(w.endIndex),
|
|
16
|
-
`).length-1),{name:t||"",description:r||"",ccVersion:i||"",variables:o||[],content:n.content.trim(),contentLineOffset:l}},kt=(e,n)=>{const t=n||Ue(e.pieces,e.identifiers,e.identifierMap),r=Object.keys(e.identifierMap).length>0?[...new Set(Object.values(e.identifierMap))]:void 0,i={name:e.name,description:e.description,ccVersion:e.version};return r&&r.length>0&&(i.variables=r),Ke.stringify(t,i,{delimiters:["<!--","-->"]})},Ue=(e,n,t)=>{let r="";for(let i=0;i<e.length;i++)if(r+=e[i],i<n.length){const o=n[i],l=t[String(o)]||`UNKNOWN_${o}`;r+=l}return r},Jt=(e,n)=>{const t=e.split(".").map(Number),r=n.split(".").map(Number);for(let i=0;i<Math.max(t.length,r.length);i++){const o=t[i]||0,l=r[i]||0;if(o<l)return-1;if(o>l)return 1}return 0},
|
|
14
|
+
);`,W=e.slice(0,p.startIndex)+J+e.slice(p.endIndex);return z(e,W,J,p.startIndex,p.endIndex),W},nr=e=>{const n=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const r=t[0],i=/verbose:[^,}]+/,o=r.match(i);if(!o||o.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const l=t.index+o.index,c=l+o[0].length;return{startIndex:l,endIndex:c}},rr=e=>{const n=nr(e);if(!n)return null;const t="verbose:true",r=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return z(e,r,t,n.startIndex,n.endIndex),r},or=e=>{const n=/(case"thinking":)if\(.+?\)return null;(.+?isTranscriptMode:).+?([},])/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: thinkingVisibility: failed to find thinking visibility pattern"),null;const r=t.index,i=r+t[0].length;return{startIndex:r,endIndex:i,identifiers:[t[1],t[2],t[3]]}},ir=e=>{const n=or(e);if(!n)return null;const t=`${n.identifiers[0]}${n.identifiers[1]}true${n.identifiers[2]}`,r=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return z(e,r,t,n.startIndex,n.endIndex),r},sr=e=>{const t=e.indexOf("}.VERSION} (Claude Code)");return t==-1?(console.error("patch: patchesAppliedIndication: failed to find versionIndex"),null):{startIndex:0,endIndex:t+24}},lr=e=>{const n=/\b([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find Claude Code version pattern"),null;const r=t.index+t[0].length;return{startIndex:r,endIndex:r}},ar=(e,n,t,r,i,o)=>{const l=/alignItems:"center",minHeight:9,?/,c=e.match(l);if(!c||c.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find alignItems pattern for PATCH 4"),null;let u=e.slice(0,c.index)+"minHeight:9,"+e.slice(c.index+c[0].length);const d=Math.max(0,c.index-200),g=u.slice(d,c.index+12+2),f=/\b([$\w]+)\.createElement\(([$\w]+),(?:\w+|\{[^}]+\}),/g,x=Array.from(g.matchAll(f));if(x.length===0)return console.error("patch: patchesAppliedIndication: failed to find createElement for PATCH 4"),null;const w=x[x.length-1],p=d+w.index+w[0].length,b=`${t}.createElement(${i}, null, ${o}.blue.bold(" + tweakcc v${n}")),${t}.createElement(${r},{alignItems:"center",flexDirection:"column"},`,I=u;u=u.slice(0,p)+b+u.slice(p),z(I,u,b,p,p);let T=1,S=p+b.length,E=-1;for(;S<u.length;){const O=u[S];if(O==="(")T++;else if(O===")"){if(T===1){E=S;break}T--}S++}if(E===-1)return console.error("patch: patchesAppliedIndication: failed to find closing paren for PATCH 4"),null;const R=u;return u=u.slice(0,E)+"),"+u.slice(E),z(R,u,"),",E,E),{content:u,closingParenIndex:E+2}},cr=(e,n,t,r,i,o,l)=>{let c=4,u=n,d=-1;for(;u<e.length;){const p=e[u];if(p==="(")c++;else if(p===")"){if(c===1){d=u;break}c--}u++}if(d===-1)return console.error("patch: patchesAppliedIndication: failed to find insertion point for PATCH 5"),null;const g=[];g.push(`,${t}.createElement(${r}, { flexDirection: "column" },`),g.push(`${t}.createElement(${r}, null, ${t}.createElement(${i}, {color: "success", bold: true}, "┃ "), ${t}.createElement(${i}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let p of l)p=p.replace("CHALK_VAR",o),g.push(`${t}.createElement(${r}, null, ${t}.createElement(${i}, {color: "success", bold: true}, "┃ "), ${t}.createElement(${i}, {dimColor: true}, \` * ${p}\`)),`);g.push("),");const f=g.join(""),x=e,w=e.slice(0,d)+f+e.slice(d);return z(x,w,f,d,d),w},dr=e=>{const n=/\b([$\w]+)\.createElement\(([$\w]+),\{bold:!0\},"Claude Code"\)," ",([$\w]+)\.createElement\(([$\w]+),\{dimColor:!0\},"v",[$\w]+\)/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find Claude Code version pattern for patch 3"),null;const r=Math.max(0,t.index-1500),i=e.slice(r,t.index),o=/\}function ([$\w]+)\(/g,l=Array.from(i.matchAll(o));if(l.length===0)return console.error("patch: patchesAppliedIndication: failed to find header component function"),null;const u=l[l.length-1][1],d=new RegExp(`\\b([$\\w]+)\\.createElement\\(${ue(u)},null\\),?`),g=e.match(d);if(!g||g.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find createElement call for header"),null;const f=g.index+g[0].length;return{startIndex:f,endIndex:f}},ur=(e,n,t,r=!0,i=!0)=>{const o=sr(e);if(!o)return console.error("patch: patchesAppliedIndication: failed to version output location"),null;const l=`\\n${n} (tweakcc)`;let c=e.slice(0,o.endIndex)+l+e.slice(o.endIndex);z(e,c,l,o.endIndex,o.endIndex);const u=yt(e);if(!u)return console.error("patch: patchesAppliedIndication: failed to find chalk variable"),null;const d=nn(e);if(!d)return console.error("patch: patchesAppliedIndication: failed to find text component"),null;const g=tt(e);if(!g)return console.error("patch: patchesAppliedIndication: failed to find React variable"),null;const f=Ct(e);if(!f)return console.error("patch: patchesAppliedIndication: failed to find Box component"),null;if(r){const w=lr(c);if(!w)return console.error("patch: patchesAppliedIndication: patch 2 failed"),null;const p=`, " ",${g}.createElement(${d}, null, ${u}.blue.bold('+ tweakcc v${n}'))`,b=c;c=c.slice(0,w.startIndex)+p+c.slice(w.endIndex),z(b,c,p,w.startIndex,w.endIndex)}if(i){const w=dr(c);if(!w)return console.error("patch: patchesAppliedIndication: patch 3 failed"),null;const p=[];p.push(`${g}.createElement(${f}, { flexDirection: "column" },`),p.push(`${g}.createElement(${f}, null, ${g}.createElement(${d}, {color: "success", bold: true}, "┃ "), ${g}.createElement(${d}, {color: "success", bold: true}, "✓ tweakcc patches are applied")),`);for(let T of t)T=T.replace("CHALK_VAR",u),p.push(`${g}.createElement(${f}, null, ${g}.createElement(${d}, {color: "success", bold: true}, "┃ "), ${g}.createElement(${d}, {dimColor: true}, \` * ${T}\`)),`);p.push("),");const b=p.join(`
|
|
15
|
+
`),I=c;c=c.slice(0,w.startIndex)+b+c.slice(w.endIndex),z(I,c,b,w.startIndex,w.endIndex)}let x=-1;if(r){const w=ar(c,n,g,f,d,u);if(!w)return console.error("patch: patchesAppliedIndication: patch 4 failed"),null;c=w.content,x=w.closingParenIndex}if(i){if(x===-1){const p=/alignItems:"center",minHeight:9,?/,b=c.match(p);if(!b||b.index===void 0)return console.error("patch: patchesAppliedIndication: failed to find reference point for PATCH 5"),null;x=b.index+b[0].length}const w=cr(c,x,g,f,d,u,t);if(!w)return console.error("patch: patchesAppliedIndication: patch 5 failed"),null;c=w}return c};async function xt(e){const n=ae.join(Ot,`prompts-${e}.json`);try{const r=await oe.readFile(n,"utf-8");return JSON.parse(r)}catch{}const t=`https://raw.githubusercontent.com/Piebald-AI/tweakcc/refs/heads/main/data/prompts/prompts-${e}.json`;try{const r=await fetch(t);if(!r.ok){let o;throw r.status===429?o="Rate limit exceeded. GitHub has temporarily blocked requests. Please wait a few minutes and try again.":r.status===404?o=`Prompts file not found for Claude Code v${e}. This version was released within the past day or so and will be supported within a few hours.`:r.status>=500?o=`GitHub server error (${r.status}). Please try again later.`:o=`HTTP ${r.status}: ${r.statusText}`,new Error(o)}const i=await r.json();try{await oe.mkdir(Ot,{recursive:!0}),await oe.writeFile(n,JSON.stringify(i,null,2),"utf-8")}catch(o){console.warn(`Failed to write to cache to ${n}: ${o}`)}return i}catch(r){if(r instanceof Error){if(r.message.includes("Rate limit")||r.message.includes("not found")||r.message.includes("server error")||r.message.includes("HTTP"))throw r;const i=`Failed to download prompts for version ${e}: ${r.message}`;throw new Error(i)}throw r}}const Ut=()=>ae.join(se,"systemPromptOriginalHashes.json"),Ht=()=>ae.join(se,"systemPromptAppliedHashes.json"),Gt=(e,n)=>`${e}-${n}`,Ze=e=>Rt.createHash("md5").update(e.trim(),"utf8").digest("hex"),Yt=async()=>{try{const e=await oe.readFile(Ut(),"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},hr=async e=>{await oe.mkdir(se,{recursive:!0});const n={},t=Object.keys(e).sort();for(const r of t)n[r]=e[r];await oe.writeFile(Ut(),JSON.stringify(n,null,2),"utf8")},mr=async e=>{const n=await Yt();let t=0;for(const r of e.prompts){const i=Gt(r.id,r.version);if(!n[i]){const o=Ue(r.pieces,r.identifiers,r.identifierMap),l=Ze(o);n[i]=l,t++}}return await hr(n),t},gr=async(e,n)=>{const t=await Yt(),r=Gt(e,n);return t[r]},St=async()=>{try{const e=await oe.readFile(Ht(),"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},Wt=async e=>{await oe.mkdir(se,{recursive:!0});const n={},t=Object.keys(e).sort();for(const r of t)n[r]=e[r];await oe.writeFile(Ht(),JSON.stringify(n,null,2),"utf8")},fr=async(e,n)=>{const t=await St();t[e]=n,await Wt(t)},pr=async()=>{const e=await St(),n={};for(const t of Object.keys(e))n[t]=null;await Wt(n)},br=async e=>{try{const n=await St();if(Object.keys(n).length===0)return!1;const r=(await oe.readdir(e)).filter(i=>i.endsWith(".md"));for(const i of r){const o=i.replace(".md",""),l=n[o];if(l===void 0||l===null)continue;const c=ae.join(e,i),u=await oe.readFile(c,"utf8"),g=(await ft(()=>import("gray-matter"),[])).default(u,{delimiters:["<!--","-->"]});if(Ze(g.content)!==l)return!0}return!1}catch(n){if(n instanceof Error&&"code"in n&&n.code==="ENOENT")return!1;throw n}},zt=e=>{const n=Ke(e,{delimiters:["<!--","-->"]}),{name:t,description:r,ccVersion:i,variables:o}=n.data;let l=0;const c=e.indexOf(n.content);return c>=0&&(l=e.slice(0,c).split(`
|
|
16
|
+
`).length-1),{name:t||"",description:r||"",ccVersion:i||"",variables:o||[],content:n.content.trim(),contentLineOffset:l}},kt=(e,n)=>{const t=n||Ue(e.pieces,e.identifiers,e.identifierMap),r=Object.keys(e.identifierMap).length>0?[...new Set(Object.values(e.identifierMap))]:void 0,i={name:e.name,description:e.description,ccVersion:e.version};return r&&r.length>0&&(i.variables=r),Ke.stringify(t,i,{delimiters:["<!--","-->"]})},Ue=(e,n,t)=>{let r="";for(let i=0;i<e.length;i++)if(r+=e[i],i<n.length){const o=n[i],l=t[String(o)]||`UNKNOWN_${o}`;r+=l}return r},Jt=(e,n)=>{const t=e.split(".").map(Number),r=n.split(".").map(Number);for(let i=0;i<Math.max(t.length,r.length);i++){const o=t[i]||0,l=r[i]||0;if(o<l)return-1;if(o>l)return 1}return 0},Fe=e=>ae.join(xe,`${e}.md`),wr=async e=>{try{return await oe.access(Fe(e)),!0}catch{return!1}},xr=async e=>{const n=Fe(e),t=await oe.readFile(n,"utf-8");return zt(t)},pt=async(e,n)=>{const t=Fe(e);await oe.writeFile(t,n,"utf-8")},Sr=async(e,n)=>{const t=Fe(e),r=await oe.readFile(t,"utf-8"),i=Ke(r,{delimiters:["<!--","-->"]}),o=Object.keys(n).length>0?[...new Set(Object.values(n))]:void 0,l={name:i.data.name,description:i.data.description,ccVersion:i.data.ccVersion};o&&o.length>0&&(l.variables=o);const c=Ke.stringify(i.content,l,{delimiters:["<!--","-->"]});await pt(e,c)},yr=(e,n)=>{const t=b=>b.split(/(\s+)/),r=t(e),i=t(n),o=r.length,l=i.length,c=Array(o+1).fill(0).map(()=>Array(l+1).fill(0));for(let b=1;b<=o;b++)for(let I=1;I<=l;I++)r[b-1]===i[I-1]?c[b][I]=c[b-1][I-1]+1:c[b][I]=Math.max(c[b-1][I],c[b][I-1]);const u=Array(o).fill(!1),d=Array(l).fill(!1);let g=o,f=l;for(;g>0||f>0;)g>0&&f>0&&r[g-1]===i[f-1]?(g--,f--):f>0&&(g===0||c[g][f-1]>=c[g-1][f])?(d[f-1]=!0,f--):g>0&&(u[g-1]=!0,g--);const x=b=>b.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");let w="";for(let b=0;b<r.length;b++){const I=x(r[b]);w+=u[b]?`<mark>${I}</mark>`:I}let p="";for(let b=0;b<i.length;b++){const I=x(i[b]);p+=d[b]?`<mark>${I}</mark>`:I}return{oldHtml:w,newHtml:p}},Nt=(e,n)=>{const t=e.length,r=n.length,i=Array(t+1).fill(0).map(()=>Array(r+1).fill(0));for(let d=1;d<=t;d++)for(let g=1;g<=r;g++)e[d-1]===n[g-1]?i[d][g]=i[d-1][g-1]+1:i[d][g]=Math.max(i[d-1][g],i[d][g-1]);const o=[];let l=t,c=r;const u=[];for(;l>0||c>0;)l>0&&c>0&&e[l-1]===n[c-1]?(u.unshift({type:"unchanged",line:e[l-1],oldLineNo:l,newLineNo:c}),l--,c--):c>0&&(l===0||i[l][c-1]>=i[l-1][c])?(u.unshift({type:"added",line:n[c-1],newLineNo:c}),c--):l>0&&(u.unshift({type:"removed",line:e[l-1],oldLineNo:l}),l--);for(let d=0;d<u.length;d++){const g=u[d],f=u[d+1];if(g.type==="removed"&&f?.type==="added"){const x=yr(g.line,f.line);o.push({type:"modified",line:g.line,oldLineNo:g.oldLineNo,newLineNo:f.newLineNo,oldHtml:x.oldHtml,newHtml:x.newHtml}),d++}else o.push(g)}return o},vr=async(e,n,t,r,i,o,l,c)=>{const u=t.split(`
|
|
17
17
|
`),d=r.split(`
|
|
18
18
|
`),g=i.split(`
|
|
19
|
-
`),f=S=>S.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),x=Nt(u,d),w=Nt(u,g);let p="";for(const S of x){const E=f(S.line);if(S.type==="modified"){const
|
|
19
|
+
`),f=S=>S.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),x=Nt(u,d),w=Nt(u,g);let p="";for(const S of x){const E=f(S.line);if(S.type==="modified"){const R=S.oldLineNo?String(S.oldLineNo).padStart(4," "):" ",O=S.newLineNo?String(S.newLineNo).padStart(4," "):" ";p+=`<div class="line removed"><span class="line-num">${R}</span><span class="prefix">- </span>${S.oldHtml}</div>
|
|
20
20
|
`,p+=`<div class="line added"><span class="line-num">${O}</span><span class="prefix">+ </span>${S.newHtml}</div>
|
|
21
|
-
`}else if(S.type==="removed"){const
|
|
22
|
-
`}else if(S.type==="added"){const
|
|
23
|
-
`}else{const
|
|
24
|
-
`}}let b="";for(const S of w){const E=f(S.line);if(S.type==="modified"){const
|
|
21
|
+
`}else if(S.type==="removed"){const R=S.oldLineNo?String(S.oldLineNo).padStart(4," "):" ";p+=`<div class="line removed"><span class="line-num">${R}</span><span class="prefix">- </span>${E}</div>
|
|
22
|
+
`}else if(S.type==="added"){const R=S.newLineNo?String(S.newLineNo).padStart(4," "):" ";p+=`<div class="line added"><span class="line-num">${R}</span><span class="prefix">+ </span>${E}</div>
|
|
23
|
+
`}else{const R=S.oldLineNo?String(S.oldLineNo).padStart(4," "):" ",O=S.newLineNo?String(S.newLineNo).padStart(4," "):" ";p+=`<div class="line unchanged"><span class="line-num">${R} ${O}</span><span class="prefix"> </span>${E}</div>
|
|
24
|
+
`}}let b="";for(const S of w){const E=f(S.line);if(S.type==="modified"){const R=S.oldLineNo?String(S.oldLineNo).padStart(4," "):" ",O=S.newLineNo?String(S.newLineNo).padStart(4," "):" ";b+=`<div class="line removed"><span class="line-num">${R}</span><span class="prefix">- </span>${S.oldHtml}</div>
|
|
25
25
|
`,b+=`<div class="line added"><span class="line-num">${O}</span><span class="prefix">+ </span>${S.newHtml}</div>
|
|
26
|
-
`}else if(S.type==="removed"){const
|
|
27
|
-
`}else if(S.type==="added"){const
|
|
28
|
-
`}else{const
|
|
26
|
+
`}else if(S.type==="removed"){const R=S.oldLineNo?String(S.oldLineNo).padStart(4," "):" ";b+=`<div class="line removed"><span class="line-num">${R}</span><span class="prefix">- </span>${E}</div>
|
|
27
|
+
`}else if(S.type==="added"){const R=S.newLineNo?String(S.newLineNo).padStart(4," "):" ";b+=`<div class="line added"><span class="line-num">${R}</span><span class="prefix">+ </span>${E}</div>
|
|
28
|
+
`}else{const R=S.oldLineNo?String(S.oldLineNo).padStart(4," "):" ",O=S.newLineNo?String(S.newLineNo).padStart(4," "):" ";b+=`<div class="line unchanged"><span class="line-num">${R} ${O}</span><span class="prefix"> </span>${E}</div>
|
|
29
29
|
`}}const I=`<!DOCTYPE html>
|
|
30
30
|
<html>
|
|
31
31
|
<head>
|
|
@@ -187,17 +187,18 @@ ${b} </div>
|
|
|
187
187
|
</div>
|
|
188
188
|
</div>
|
|
189
189
|
</body>
|
|
190
|
-
</html>`,T=ae.join(
|
|
191
|
-
`)
|
|
192
|
-
`)
|
|
193
|
-
`);for(const[
|
|
194
|
-
|
|
190
|
+
</html>`,T=ae.join(xe,`${e}.diff.html`);return await oe.writeFile(T,I,"utf-8"),T},Cr=async e=>{const n={id:e.id,name:e.name,description:e.description,action:"skipped",newVersion:e.version};if(!await wr(e.id)){const i=kt(e);return await pt(e.id,i),n.action="created",n}const r=await xr(e.id);if(n.oldVersion=r.ccVersion,await Sr(e.id,e.identifierMap),r.ccVersion&&e.version){const i=Jt(r.ccVersion,e.version);if(i===0)return n.action="skipped",n;if(i!=0){const o=await gr(e.id,r.ccVersion),l=Ze(r.content);if(!o||o!==l){n.action="conflict";let u=r.content;try{const w=(await xt(r.ccVersion)).prompts.find(p=>p.id===e.id);w&&(u=Ue(w.pieces,w.identifiers,w.identifierMap))}catch{console.log(F.yellow(`Warning: Could not fetch old version ${r.ccVersion} for comparison. Using current file as baseline.`))}const d=Ue(e.pieces,e.identifiers,e.identifierMap),g=Fe(e.id),f=await vr(e.id,e.name,u,r.content,d,r.ccVersion,e.version,g);n.diffHtmlPath=f}else{const u=kt(e);await pt(e.id,u),n.action="updated"}}}return n},$r=async e=>{const n={ccVersion:e,results:[]},t=await xt(e);await mr(t),await oe.mkdir(xe,{recursive:!0});for(const r of t.prompts)try{const i=await Cr(r);n.results.push(i)}catch(i){throw console.log(F.red(`Failed to sync prompt ${r.id}:`)),i}return n};let Qe=null,bt=null;const Xt=async e=>{try{return Qe=await xt(e),bt=e,{success:!0}}catch(n){return Qe=null,bt=null,n instanceof Error?{success:!1,errorMessage:n.message}:{success:!1,errorMessage:"Unknown error occurred while downloading system prompts"}}},_r=e=>e.replace(/[^\x00-\x7F]/g,n=>{const r=`\\\\u${n.charCodeAt(0).toString(16).padStart(4,"0")}`;return`(?:${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}|${r})`}),Ir=e=>e.replace(/[^\x00-\x7F]/g,n=>`\\u${n.charCodeAt(0).toString(16).padStart(4,"0")}`),Tr=(e,n,t)=>{let r="";for(let i=0;i<e.length;i++){let o=e[i].replace(/<<CCVERSION>>/g,n);t&&(o=o.replace(/<<BUILD_TIME>>/g,t));const l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=_r(l).replace(/\n/g,`(?:
|
|
191
|
+
|\\\\n)`);r+=u,i<e.length-1&&(r+="([\\w$]+)")}return r},Mr=e=>{const n=new Map;let t=0,r=1,i=1;for(let o=0;o<e.length;o++,i++){const l=e[o];if(l===`
|
|
192
|
+
`){r++,i=0;continue}const c=e[o+1];if(l==="$"&&c==="{"){t++,o++,i++;continue}if(t){l==="{"?t++:l==="}"&&t--;continue}if(l==="`"&&e[o-1]!=="\\"){const u=n.get(r)??[];u.push(i),n.set(r,u)}}return n},Er=(e,n,t,r)=>{const i=[],o=String(n),l=o.length,c=" ".repeat(l),u=r[0],d=r[r.length-1],g=30,f=30,x=u-1,w=t.length-d;let p=t,b=r,I="",T="",S=0;if(x>g||w>f){let y=0,J=t.length,W=0;if(x>g){const X=x-g;y=X,W=-X;const G=`[${X} chars] ...`;I=F.dim(G),S=G.length}if(w>f){const X=w-f;J=t.length-X,T=F.dim(`... [${X} chars]`)}p=t.substring(y,J),b=r.map(X=>X+W)}i.push(`${F.red.bold("error")}${F.bold(": system prompt file contains unescaped backtick")}`),i.push(`${F.blue.bold(" ".repeat(l)+" -->")} ${e}:${n}:${u}`),i.push(`${c} ${F.blue.bold("|")}`);const E=I+p+T;i.push(`${F.blue.bold(o)} ${F.blue.bold("|")} ${E}`);const R=S+b[0]-1,O=" ".repeat(R)+"^ unescaped backtick";i.push(`${c} ${F.blue.bold("|")} ${F.red.bold(O)}`),i.push(`${c} ${F.blue.bold("|")}`),i.push(`${F.cyan.bold("help")}: add \`\\\` before the backtick to escape it`),i.push(`${c} ${F.blue.bold("|")}`);const V=[];let D=0;for(const y of b)V.push(p.substring(D,y-1)),V.push(F.green("\\")+"`"),D=y;V.push(p.substring(D));const Y=I+V.join("")+T;i.push(`${F.blue.bold(o)} ${F.blue.bold("|")} ${Y}`);let N="",k=0;for(let y=0;y<b.length;y++){const J=b[y],W=S+J-1+k;N=N.padEnd(W," ")+"+",k++}return i.push(`${c} ${F.blue.bold("|")} ${F.green(N)}`),i.join(`
|
|
193
|
+
`)},kr=(e,n,t,r,i,o=!1,l)=>{const c={};for(let g=0;g<r.length;g++){const f=r[g],x=String(n[g]),w=t[x];w&&(c[w]=f)}let u=e;const d=Object.entries(c).sort((g,f)=>f[0].length-g[0].length);for(const[g,f]of d){const x=new RegExp(`\\b${g}\\b`,"g");u=u.replace(x,()=>f)}return u=u.replace(/<<CCVERSION>>/g,i),l&&(u=u.replace(/<<BUILD_TIME>>/g,l)),o&&(u=Ir(u)),u},Nr=async(e,n=!1,t)=>{if(!Qe||bt!==e)return[];const r=Qe,i=[];for(const o of r.prompts){const l=Tr(o.pieces,e,t),c=ae.join(xe,`${o.id}.md`);let u;try{u=await oe.readFile(c,"utf8")}catch(f){console.error(`Failed to read markdown file ${c}:`,f);continue}const d=zt(u),g=f=>{const x=f.slice(1);return kr(d.content,o.identifiers,o.identifierMap,x,e,n,t)};i.push({promptId:o.id,prompt:d,regex:l,getInterpolatedContent:g,pieces:o.pieces,identifiers:o.identifiers,identifierMap:o.identifierMap})}return i},Br=e=>{const n=e.results.filter(o=>o.action==="created"),t=e.results.filter(o=>o.action==="updated"),r=e.results.filter(o=>o.action==="conflict"),i=e.results.filter(o=>o.action==="skipped");if((n.length>0||t.length>0||r.length>0)&&i.length>0&&(console.log(F.dim(`Skipped ${i.length} up-to-date file(s)`)),console.log()),n.length>0){console.log(F.bold.green(`Created ${n.length} new prompt file(s):`));for(const o of n)console.log(F.green(` ${xe}/${o.id}.md`)),console.log(F.green.dim(` ${o.description}`));console.log()}if(t.length>0){console.log(F.bold.blue(`Updated ${t.length} system prompt file(s):`));for(const o of t)o.oldVersion?console.log(F.blue(` ${o.id}.md (${o.oldVersion} → ${o.newVersion})`)):console.log(F.blue(` ${o.id}.md (→ ${o.newVersion})`));console.log()}if(r.length>0){console.log(F.bold.yellow(`WARNING: Conflicts detected for ${r.length} system prompt file(s)`));for(const o of r)console.log(F.yellow(` ${o.id}.md (${o.oldVersion} → ${o.newVersion})`)),console.log(F.yellow(` Open the diff in your browser: ${o.diffHtmlPath}`));console.log()}if(n.length>0&&(console.log(F.green.bold("New prompt files have been created; either more are now supported by tweakcc or Anthropic has added new ones.")),console.log(F.green(`You can now customize the markdown files at ${xe} in a text editor.`)),console.log(F.green('Then run tweakcc and select "apply" or use tweakcc --apply to update your system prompts')),console.log()),r.length>0){console.log(),console.log("Review conflicts:"),console.log(" 1. Open the diff HTML files in your browser"),console.log(" 2. Verify your customizations are still appropriate"),console.log(" 3. Update your markdown files if needed"),console.log(F.bold.cyan(" 4. Important: Update the ccVersion in your markdown files to the latest version of each prompt:"));for(const o of r)console.log(F.yellow(` ${o.id}.md → `)+F.bold.magenta(o.newVersion));console.log(" 5. Delete the diff HTML files"),console.log()}},Pr=e=>/\\u[0-9a-fA-F]{4}/.test(e),Ar=e=>{const n=e.match(/\bBUILD_TIME:"(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z)"/);return n?n[1]:void 0},Or=e=>{const n=e.toString(),t=JSON.stringify(n.substring(1,n.length-1)),r=JSON.stringify(n.match(/\/(\w*)$/)[1]);return`new RegExp(${t}, ${r})`},Dr=async(e,n,t)=>{const r=t??Pr(e);r&&M("Detected Unicode escaping in cli.js - will escape non-ASCII characters in prompts");const i=Ar(e);i&&M(`Extracted BUILD_TIME from cli.js: ${i}`);const o=await Nr(n,r,i);M(`Loaded ${o.length} system prompts with regexes`);let l=0,c=0;for(const{promptId:g,prompt:f,regex:x,getInterpolatedContent:w,pieces:p,identifiers:b,identifierMap:I}of o){const T=new RegExp(x,"si"),S=e.match(T);if(S&&S.index!==void 0){const E=w(S),R=S.index,O=R>0?e[R-1]:"";if(O==="`"){const W=Mr(E);if(W.size>0){const X=Fe(g),G=f.content.split(`
|
|
194
|
+
`);for(const[_,v]of W){const C=_+(f.contentLineOffset||0),P=G[_-1]||"";console.log(Er(X,C,P,v)),console.log()}continue}}const V=Ue(p,b,I).trim(),D=V.length,Y=f.content.length;l+=D,c+=Y,D!==Y&&(M(`
|
|
195
|
+
Character count difference for ${f.name}:`),M(` Original baseline: ${D} chars`),M(` User's version: ${Y} chars`),M(` Difference: ${D-Y} chars`),Math.abs(D-Y)<200&&(M(`
|
|
195
196
|
Original baseline content:
|
|
196
|
-
${
|
|
197
|
+
${V}`),M(`
|
|
197
198
|
User's content:
|
|
198
199
|
${f.content}`))),M(`
|
|
199
|
-
Found match for prompt: ${f.name}`),M(` Match location: index ${S.index}, length ${S[0].length}`),M(` Original content (first 100 chars): ${S[0].substring(0,100)}...`),M(` Replacement content (first 100 chars): ${E.substring(0,100)}...`),M(` Captured variables: ${S.slice(1).join(", ")}`),M(` Content identical: ${S[0]===E}`);const
|
|
200
|
-
Debug info for ${f.name}:`),M(` Regex pattern (first 200 chars): ${x.substring(0,200)}...`),M(" Trying to match pattern in cli.js...");const E=e.match(new RegExp(x.substring(0,100)));M(` Partial match result: ${E?"found partial":"no match"}`)}}const u=[],d=l-c;return d>0?u.push(`system prompts: \${CHALK_VAR.green('${d} fewer chars')} than original`):d<0&&u.push(`system prompts: \${CHALK_VAR.red('${Math.abs(d)} more chars')} than original`),{newContent:e,items:u}},
|
|
200
|
+
Found match for prompt: ${f.name}`),M(` Match location: index ${S.index}, length ${S[0].length}`),M(` Original content (first 100 chars): ${S[0].substring(0,100)}...`),M(` Replacement content (first 100 chars): ${E.substring(0,100)}...`),M(` Captured variables: ${S.slice(1).join(", ")}`),M(` Content identical: ${S[0]===E}`);const N=e,k=S[0].length;let y=E;O==='"'?(y=y.replace(/\n/g,"\\n"),y=y.replace(/"/g,'\\"')):O==="'"&&(y=y.replace(/\n/g,"\\n"),y=y.replace(/'/g,"\\'")),e=e.replace(T,()=>y);const J=Ze(f.content);await fr(g,J),z(N,e,y,R,R+k)}else{console.log(F.yellow(`Could not find system prompt "${f.name}" in cli.js (using regex ${Or(T)})`)),M(`
|
|
201
|
+
Debug info for ${f.name}:`),M(` Regex pattern (first 200 chars): ${x.substring(0,200).replace(/\n/g,"\\n")}...`),M(" Trying to match pattern in cli.js...");try{const E=e.match(new RegExp(x.substring(0,100)));M(` Partial match result: ${E?"found partial":"no match"}`)}catch{M(" Partial match failed (regex truncation issue)")}}}const u=[],d=l-c;return d>0?u.push(`system prompts: \${CHALK_VAR.green('${d} fewer chars')} than original`):d<0&&u.push(`system prompts: \${CHALK_VAR.red('${Math.abs(d)} more chars')} than original`),{newContent:e,items:u}},Lr=e=>{const n=/ensureServerStarted:([$\w]+)\b/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: fixLspSupport: failed to find ensureServerStarted"),null;const r=Math.max(0,t.index-50),i=Math.min(e.length,t.index+50),o=e.slice(r,i),l=/sendRequest:([$\w]+)[,}]/,c=o.match(l);if(!c)return console.error(`patch: fixLspSupport: failed to find sendRequest near ensureServerStarted, window=${JSON.stringify([r,i,o])}`),null;const u=c[1],d=Math.max(0,t.index-2e3),g=e.slice(d,t.index),f=new RegExp(`async function ${ue(u)}\\(([$\\w]+),`,"g");let x,w=null;for(;(x=f.exec(g))!==null;)w=x;if(!w)return console.error(`patch: fixLspSupport: failed to find async function ${u}`),null;const p=w[1],b=d+w.index,I=e.slice(b,t.index),T=/let ([$\w]+)=await [$\w]+\([$\w]+\);/,S=I.match(T);if(!S||S.index===void 0)return console.error("patch: fixLspSupport: failed to find second line of sendRequest"),null;const E=S[1],R=b+S.index+S[0].length,O=e.slice(R,t.index),V=new RegExp(`if\\(!${ue(E)}\\)return;`),D=O.match(V);if(!D||D.index===void 0)return console.error("patch: fixLspSupport: failed to find if(!serverVar)return; line"),null;const Y=R+D.index+D[0].length;return{startIndex:Y,endIndex:Y,identifiers:[p,E]}},Rr=e=>{const n=/if\([$\w]+\.restartOnCrash!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': restartOnCrash is not yet implemented\. Remove this field from the configuration\.`\);/g,t=/if\([$\w]+\.startupTimeout!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': startupTimeout is not yet implemented\. Remove this field from the configuration\.`\);/g,r=/if\([$\w]+\.shutdownTimeout!==void 0\)throw Error\(`LSP server '\$\{[$\w]+\}': shutdownTimeout is not yet implemented\. Remove this field from the configuration\.`\);/g;let i=e;const o=i;i=i.replace(n,""),i!==o?z(o,i,"",0,0):console.warn("patch: fixLspSupport: restartOnCrash validation not found");const l=i;i=i.replace(t,""),i!==l?z(l,i,"",0,0):console.warn("patch: fixLspSupport: startupTimeout validation not found");const c=i;i=i.replace(r,""),i!==c?z(c,i,"",0,0):console.warn("patch: fixLspSupport: shutdownTimeout validation not found");const u=Lr(i);if(!u||!u.identifiers)return null;const[d,g]=u.identifiers,f=`
|
|
201
202
|
const path = await import('path');
|
|
202
203
|
const ext = path.extname(${d}).toLowerCase();
|
|
203
204
|
const langMap = {
|
|
@@ -347,7 +348,7 @@ Found match for prompt: ${f.name}`),M(` Match location: index ${S.index}, lengt
|
|
|
347
348
|
}
|
|
348
349
|
});
|
|
349
350
|
} catch (openErr) { }
|
|
350
|
-
`,x=i.slice(0,u.startIndex)+f+i.slice(u.endIndex);return
|
|
351
|
+
`,x=i.slice(0,u.startIndex)+f+i.slice(u.endIndex);return z(i,x,f,u.startIndex,u.endIndex),x},qt=e=>{const n=/=>\[([$a-zA-Z_][$\w]{1,2},){30}/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: findSlashCommandListEndPosition: failed to find arrayStartPattern"),null;const r=e.indexOf("[",t.index);if(r===-1)return console.error("patch: findSlashCommandListEndPosition: failed to find bracketIndex"),null;let i=1,o=r+1;for(;o<e.length&&i>0;){if(e[o]==="[")i++;else if(e[o]==="]"&&(i--,i===0))return o;o++}return console.error("patch: findSlashCommandListEndPosition: failed to find matching closing-bracket"),null},Kt=(e,n)=>{const t=qt(e);if(t===null)return console.error("patch: writeSlashCommandDefinition: failed to find slash command array end position"),null;const r=e.slice(0,t)+n+e.slice(t);return z(e,r,n,t,t),r},Fr=e=>{const n=/function ([$\w]+)\(\{(?:(?:isDisabled|hideIndexes|visibleOptionCount|highlightText|options|defaultValue|onCancel|onChange|onFocus|focusValue|layout|disableSelection):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,t=Array.from(e.matchAll(n));if(t.length===0)return console.error("patch: findSelectComponentName: failed to find selectPattern"),null;let r=t[0];for(const i of t)i[0].length>r[0].length&&(r=i);return r[1]},Vr=e=>{const n=/function ([$\w]+)\(\{(?:(?:orientation|title|width|padding|titlePadding|titleColor|titleDimColor|dividerChar|dividerColor|dividerDimColor|boxProps):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,t=Array.from(e.matchAll(n));if(t.length===0)return console.error("patch: findDividerComponentName: failed to find dividerPattern"),null;let r=t[0];for(const i of t)i[0].length>r[0].length&&(r=i);return r[1]},Qt=e=>{const n=/function ([$\w]+)\(\{(?:(?:commands|debug|initialPrompt|initialTools|initialMessages|initialCheckpoints|initialFileHistorySnapshots|mcpClients|dynamicMcpConfig|mcpCliEndpoint|autoConnectIdeFlag|strictMcpConfig|systemPrompt|appendSystemPrompt|onBeforeQuery|onTurnComplete|disabled):[$\w]+(?:=(?:[^,]+,|[^}]+\})|[,}]))+\)/g,r=Array.from(e.matchAll(n)).filter(o=>o[0].includes("commands:"));if(r.length===0)return console.error("patch: getMainAppComponentBodyStart: failed to find appComponentPattern"),null;let i=r[0];for(const o of r)o[0].length>i[0].length&&(i=o);return i.index===void 0?(console.error("patch: getMainAppComponentBodyStart: failed to find appComponentPattern longestMatch"),null):i.index+i[0].length},et=e=>{const n=Qt(e);if(n===null)return console.error("patch: getAppStateVarAndGetterFunction: failed to find bodyStart"),null;const t=e.slice(n,n+20),r=/let\[([$\w]+),[$\w]+\]=([$\w]+)\(\)/,i=t.match(r);return i?{appStateVar:i[1],appStateGetterFunction:i[2]}:(console.error("patch: getAppStateVarAndGetterFunction: failed to find statePattern"),null)},jr=e=>{const n=Qt(e);if(n===null)return console.error("patch: getToolFetchingUseMemoLocation: failed to find bodyStart"),null;const t=e.slice(n,n+2e3),r=/(?:let |,)([$\w]+)=([$\w]+)\.useMemo\(\(\)=>([$\w]+)\(([$\w]+)\),\[\4\]\)/,i=t.match(r);if(!i||i.index===void 0)return console.error("patch: getToolFetchingUseMemoLocation: failed to find useMemoPattern"),null;const o=n+i.index,l=o+i[0].length,u=i[0].startsWith(",");return{startIndex:o,endIndex:l,outputVarName:i[1],reactVarName:i[2],toolFilterFunction:i[3],toolPermissionContextVar:i[4],needsSemicolonPrefix:u}},Ur=e=>{const n=qt(e);if(n===null)return console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find arrayEnd"),null;let t=1,r=n;for(;r>=0&&t>0;){if(e[r]==="}")t++;else if(e[r]==="{"&&(t--,t===0))break;r--}if(r<0)return console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find matching open-brace"),null;for(;r>=0&&e[r]!==";";)r--;return r<0?(console.error("patch: findTopLevelPositionBeforeSlashCommand: failed to find matching semicolon"),null):r+1},Hr=(e,n)=>{const t=/thinkingEnabled:([$\w]+)\(\)/g,r=Array.from(e.matchAll(t));if(r.length===0)return console.error("patch: toolsets: failed to find thinkingEnabled pattern"),null;const i=[];for(const u of r)if(u.index!==void 0){const d=u.index+u[0].length;i.push({index:d})}i.sort((u,d)=>d.index-u.index);let o=e;const c=`,toolset:${n?JSON.stringify(n):"undefined"}`;for(const u of i)o=o.slice(0,u.index)+c+o.slice(u.index);return o===e?(console.error("patch: toolsets: failed to modify app state initialization"),null):o},Gr=(e,n)=>{const t=jr(e);if(!t)return console.error("patch: toolsets: failed to find tool fetching useMemo location"),null;const r=et(e);if(!r)return console.error("patch: toolsets: failed to find app state info"),null;const{appStateVar:i}=r,{startIndex:o,endIndex:l,outputVarName:c,reactVarName:u,toolFilterFunction:d,toolPermissionContextVar:g,needsSemicolonPrefix:f}=t,x=JSON.stringify(Object.fromEntries(n.map(I=>[I.name,I.allowedTools==="*"?"*":I.allowedTools]))),p=`${f?";":""}let ${c} = ${u}.useMemo(() => {
|
|
351
352
|
const toolsets = ${x};
|
|
352
353
|
if (toolsets.hasOwnProperty(${i}.toolset)) {
|
|
353
354
|
const allowedTools = toolsets[${i}.toolset];
|
|
@@ -361,7 +362,7 @@ Found match for prompt: ${f.name}`),M(` Match location: index ${S.index}, lengt
|
|
|
361
362
|
} else {
|
|
362
363
|
return ${d}(${g});
|
|
363
364
|
}
|
|
364
|
-
}, [${d}, ${i}.toolset])`,b=e.slice(0,o)+p+e.slice(l);return
|
|
365
|
+
}, [${d}, ${i}.toolset])`,b=e.slice(0,o)+p+e.slice(l);return z(e,b,p,o,l),b},Yr=(e,n)=>{const t=Ur(e);if(t===null)return console.error("patch: toolsets: failed to find slash command insertion point"),null;const r=tt(e);if(!r)return console.error("patch: toolsets: failed to find React variable"),null;const i=Ct(e);if(!i)return console.error("patch: toolsets: failed to find Box component"),null;const o=nn(e);if(!o)return console.error("patch: toolsets: failed to find Text component"),null;const l=Fr(e);if(!l)return console.error("patch: toolsets: failed to find Select component"),null;const c=Vr(e);if(!c)return console.error("patch: toolsets: failed to find Divider component"),null;const u=et(e);if(!u)return console.error("patch: toolsets: failed to find app state getter"),null;const d=yt(e);if(!d)return console.error("patch: toolsets: failed to find chalk variable"),null;const{appStateGetterFunction:g}=u,f=JSON.stringify(n.map(b=>b.name)),x=JSON.stringify(n.map(b=>({label:b.name,value:b.name,description:b.allowedTools==="*"?"All tools":b.allowedTools.length===0?"No tools":`${b.allowedTools.length} tool${b.allowedTools.length!==1?"s":""}: ${b.allowedTools.join(", ")}`}))),w=`const toolsetComp = ({ onExit, input }) => {
|
|
365
366
|
const [state, setState] = ${g}();
|
|
366
367
|
|
|
367
368
|
// Handle command-line argument
|
|
@@ -425,7 +426,7 @@ Found match for prompt: ${f.name}`),M(` Match location: index ${S.index}, lengt
|
|
|
425
426
|
${r}.createElement(${o}, { dimColor: true, italic: true }, "Enter to confirm · Esc to exit")
|
|
426
427
|
)
|
|
427
428
|
);
|
|
428
|
-
};`,p=e.slice(0,t)+w+e.slice(t);return
|
|
429
|
+
};`,p=e.slice(0,t)+w+e.slice(t);return z(e,p,w,t,t),p},Wr=e=>{const n=/\{color:"bashBorder"\},"! for bash mode"/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: toolsets: findShiftTabAppStateVarInsertionPoint: failed to find bash mode pattern"),null;const r=Math.max(0,t.index-500),i=e.slice(r,t.index),o=/function ([$\w]+)\(\{[^}]+\}\)\{/g,l=Array.from(i.matchAll(o));if(l.length===0)return console.error("patch: toolsets: findShiftTabAppStateVarInsertionPoint: failed to find function pattern"),null;const c=l[l.length-1];return c.index===void 0?(console.error("patch: toolsets: findShiftTabAppStateVarInsertionPoint: match has no index"),null):r+c.index+c[0].length},zr=e=>{const n=Wr(e);if(n===null)return console.error("patch: toolsets: insertShiftTabAppStateVar: failed to find insertion point"),null;const t=et(e);if(!t)return console.error("patch: toolsets: insertShiftTabAppStateVar: failed to find app state getter"),null;const{appStateGetterFunction:r}=t,i=`let[state]=${r}();`,o=e.slice(0,n)+i+e.slice(n);return z(e,o,i,n,n),o},Jr=e=>{const n=/([$\w]+)\((\w+)\)\.toLowerCase\(\)," on"/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: toolsets: appendToolsetToModeDisplay: failed to find mode display pattern"),null;const r=t[1],i=t[2],o=t[0],l=`${r}(${i}).toLowerCase()," on [",state.toolset||"undefined","]"`,c=e.replace(o,l);return c===e?(console.error("patch: toolsets: appendToolsetToModeDisplay: failed to modify mode display"),null):(z(e,c,l,t.index,t.index+o.length),c)},Xr=e=>{const n=/"\? for shortcuts"/g,r=Array.from(e.matchAll(n)).at(-1);if(!r||r.index===void 0)return console.error("patch: toolsets: appendToolsetToShortcutsDisplay: could not find '? for shortcuts'"),null;const i=r[0],o='"? for shortcuts [",state.toolset||"undefined","]"',l=e.replace(i,o);return l===e?(console.error("patch: toolsets: appendToolsetToModeDisplay: failed to modify mode display"),null):(z(e,l,o,r.index,r.index+i.length),l)},qr=e=>{const n=tt(e);if(!n)return console.error("patch: toolsets: failed to find React variable"),null;const t=`, {
|
|
429
430
|
aliases: ["change-tools"],
|
|
430
431
|
type: "local-jsx",
|
|
431
432
|
name: "toolset",
|
|
@@ -439,7 +440,7 @@ Found match for prompt: ${f.name}`),M(` Match location: index ${S.index}, lengt
|
|
|
439
440
|
userFacingName() {
|
|
440
441
|
return "toolset";
|
|
441
442
|
}
|
|
442
|
-
}`;return Kt(e,t)},
|
|
443
|
+
}`;return Kt(e,t)},Kr=e=>{const n=/[\w$]+\([\w$]+,function\([\w$]+\)\{[\w$]+\("tengu_ext_at_mentioned",\{\}\);/,t=e.match(n);return!t||t.index===void 0?(console.error("patch: findToolChangeComponentScope: failed to find tool change component scope"),null):t.index},Qr=e=>{const n=Kr(e);if(n===null)return null;const t=et(e);if(!t)return console.error("patch: addSetStateFnAccessAtToolChangeComponentScope: failed to get app state getter function"),null;const{appStateGetterFunction:r}=t,i=`const [state, setState] = ${r}();`;return e.slice(0,n)+i+e.slice(n)},Zr=e=>{const n=/let [\w$]+=[\w$]+\([\w$]+,\{type:"setMode",mode:([\w$]+),destination:"session"\}\);/,t=e.match(n);return!t||t.index===void 0?(console.error("patch: findModeChange: failed to find mode change location"),null):{index:t.index,modeVar:t[1]}},eo=(e,n,t)=>{const r=Zr(e);if(!r)return null;const{index:i,modeVar:o}=r,l=`if(${o}==="plan"){setState((prev)=>({...prev,toolset:${JSON.stringify(n)}}));}else{setState((prev)=>({...prev,toolset:${JSON.stringify(t)}}));}`;return e.slice(0,i)+l+e.slice(i)},to=(e,n,t)=>{if(!n||n.length===0)return null;let r=e;return r=Hr(r,t),r?(r=Gr(r,n),r?(r=Yr(r,n),r?(r=qr(r),r?(r=zr(r),r?(r=Jr(r),r?(r=Xr(r),r||(console.error("patch: toolsets: step 7 failed (appendToolsetToShortcutsDisplay)"),null)):(console.error("patch: toolsets: step 6 failed (appendToolsetToModeDisplay)"),null)):(console.error("patch: toolsets: step 5 failed (insertShiftTabAppStateVar)"),null)):(console.error("patch: toolsets: step 4 failed (writeSlashCommandDefinition)"),null)):(console.error("patch: toolsets: step 3 failed (writeToolsetComponentDefinition)"),null)):(console.error("patch: toolsets: step 2 failed (writeToolFetchingUseMemo)"),null)):(console.error("patch: toolsets: step 1 failed (writeToolsetFieldToAppState)"),null)},no=e=>tt(e)?Kt(e,`, {
|
|
443
444
|
type: "local",
|
|
444
445
|
name: "title",
|
|
445
446
|
description: "Set the conversation title",
|
|
@@ -458,7 +459,7 @@ Found match for prompt: ${f.name}`),M(` Match location: index ${S.index}, lengt
|
|
|
458
459
|
userFacingName() {
|
|
459
460
|
return "title";
|
|
460
461
|
},
|
|
461
|
-
}`):(console.error("patch: conversationTitle: failed to find React variable"),null),
|
|
462
|
+
}`):(console.error("patch: conversationTitle: failed to find React variable"),null),ro=e=>{const n=/class ([$\w]+)\{summaries;(?:customTitles;)?messages;(?:checkpoints;)?fileHistorySnapshots;/,t=e.match(n);return!t||t.index===void 0?(console.error("patch: conversationTitle: findCustomNamingFunctionsLocation: failed to find class pattern"),null):t.index},oo=e=>{const n=ro(e);if(n===null)return console.error("patch: conversationTitle: failed to find custom naming functions location"),null;const t=vt(e),r=`
|
|
462
463
|
function getTweakccBaseDir() {
|
|
463
464
|
const { join: pathJoin } = ${t}('path');
|
|
464
465
|
const { homedir: osHomedir } = ${t}('os');
|
|
@@ -632,11 +633,11 @@ function onNewMessage(projectDir, projectSlug, msg) {
|
|
|
632
633
|
}
|
|
633
634
|
}
|
|
634
635
|
|
|
635
|
-
`,i=e.slice(0,n)+r+e.slice(n);return
|
|
636
|
+
`,i=e.slice(0,n)+r+e.slice(n);return z(e,i,r,n,n),i},io=e=>{const n=/(if\(![$\w]+\.has\(([$\w]+)\.uuid\)\)\{)if\([$\w]+\.appendFileSync\(/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: conversationTitle: findAppendEntryInterceptorLocation: failed to find pattern"),null;const r=t.index+t[1].length,i=t[2];return{location:r,messageVar:i}},so=e=>{const n=io(e);if(!n)return console.error("patch: conversationTitle: failed to find append entry interceptor location"),null;const t=vt(e),{location:r,messageVar:i}=n,o=`const { dirname: pathDirname, basename: pathBasename } = ${t}('path');
|
|
636
637
|
const projectDir = pathDirname(this.sessionFile);
|
|
637
638
|
const projectSlug = pathBasename(projectDir);
|
|
638
639
|
onNewMessage(projectDir, projectSlug, ${i});
|
|
639
|
-
`,l=e.slice(0,r)+o+e.slice(r);return
|
|
640
|
+
`,l=e.slice(0,r)+o+e.slice(r);return z(e,l,o,r,r),l},lo=e=>{const n=/if\([$\w]+\.has\(([$\w]+)\.uuid\)\)continue;/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: conversationTitle: findTweakccSummaryCheckLocations: failed to find continue pattern"),null;const r=t[1],i=t.index+t[0].length-10,o=Math.max(0,t.index-200),l=e.substring(o,t.index),c=/for\(let [$\w]+ of ([$\w]+)\)try/,u=l.match(c);if(!u)return console.error("patch: conversationTitle: findTweakccSummaryCheckLocations: failed to find loop pattern"),null;const d=u[1],g=o+(u.index??0);return{orLocation:i,loopLocation:g,messageVar:r,fileListVar:d}},ao=e=>{const n=lo(e);if(!n)return console.error("patch: conversationTitle: failed to find tweakcc summary check locations"),null;const t=vt(e),{orLocation:r,loopLocation:i,messageVar:o,fileListVar:l}=n;let c=e;const u=`const { readFileSync: fsReadFileSync } = ${t}('fs');
|
|
640
641
|
const tweakccSummaries = new Set();
|
|
641
642
|
for (const file of ${l}) {
|
|
642
643
|
const contents = fsReadFileSync(file, "utf8").trim();
|
|
@@ -651,23 +652,23 @@ for (const file of ${l}) {
|
|
|
651
652
|
if (obj.type != "summary" || !obj.hasOwnProperty("tweakcc")) continue;
|
|
652
653
|
tweakccSummaries.add(obj.leafUuid);
|
|
653
654
|
}
|
|
654
|
-
`;c=c.slice(0,i)+u+c.slice(i),
|
|
655
|
+
`;c=c.slice(0,i)+u+c.slice(i),z(e,c,u,i,i);const d=r+u.length,g=`||tweakccSummaries.has(${o}.uuid)`,f=c.slice(0,d)+g+c.slice(d);return z(c,f,g,d,d),f},co=e=>{const n=/description:"Rename the current conversation",isEnabled:\(\)=>!1,/,t=e.match(n);if(!t)return console.error("patch: conversationTitle: enableRenameConversationCommand: failed to find pattern"),null;if(t.index===void 0)return console.error("patch: conversationTitle: enableRenameConversationCommand: match.index is undefined"),null;const r='description:"Rename the current conversation",isEnabled:()=>!1,',i='description:"Rename the current conversation",isEnabled:()=>!0,',o=e.replace(r,i);return o===e?(console.error("patch: conversationTitle: enableRenameConversationCommand: replacement failed"),null):(z(e,o,i,t.index,t.index+63),o)},uo=e=>{let n=e;if(n=no(n),!n)return console.error("patch: conversationTitle: step 1 failed (writeTitleSlashCommand)"),null;if(n=oo(n),!n)return console.error("patch: conversationTitle: step 2 failed (writeCustomNamingFunctions)"),null;if(n=so(n),!n)return console.error("patch: conversationTitle: step 3 failed (writeAppendEntryInterceptor)"),null;if(n=ao(n),!n)return console.error("patch: conversationTitle: step 4 failed (writeTweakccSummaryCheck)"),null;const t=co(n);return t?n=t:console.log("patch: conversationTitle: step 5 failed (enableRenameConversationCommand)"),n},ho=e=>{const n=/,[$\w]+\.createElement\([$\w]+,\{isBeforeFirstMessage:!1\}\),/,t=e.match(n);return!t||t.index===void 0?(console.error("patch: hideStartupBanner: failed to find startup banner createElement"),null):{startIndex:t.index,endIndex:t.index+t[0].length}},mo=e=>{const n=ho(e);if(!n)return null;const t=e.slice(0,n.startIndex)+","+e.slice(n.endIndex);return z(e,t,",",n.startIndex,n.endIndex),t},go=e=>{const n=/ctrl-g to edit prompt in /,t=e.match(n);if(!t||t.index===void 0)return console.error('patch: hideCtrlGToEditPrompt: failed to find "ctrl-g to edit prompt in "'),null;const r=Math.max(0,t.index-150),i=e.slice(r,t.index),o=/:[$\w]+&&([$\w]+)\.createElement/g;let l=null,c;for(;(c=o.exec(i))!==null;)l=c;if(!l)return console.error("patch: hideCtrlGToEditPrompt: failed to find createElement pattern before ctrl-g text"),null;const u=l[1],d=r+l.index,g=l[0].length,f=`${u}.createElement`,x=g-f.length;return{startIndex:d,endIndex:d+x,identifiers:[u]}},fo=e=>{const n=go(e);if(!n)return null;if(!n.identifiers?.[0])return console.error("patch: hideCtrlGToEditPrompt: reactVar not captured"),null;const r=":false&&",i=e.slice(0,n.startIndex)+r+e.slice(n.endIndex);return z(e,i,r,n.startIndex,n.endIndex),i},po=e=>{const n=[],t="▛███▜";let r=0;for(;;){const i=e.indexOf(t,r);if(i===-1)break;const o=Math.max(0,i-2e3),l=e.slice(o,i),c=/function [$\w]+\(\)\{/g;let u=null,d;for(;(d=c.exec(l))!==null;)u=d;if(u){const g=o+u.index+u[0].length;n.push(g)}else console.error(`patch: hideStartupClawd: failed to find function pattern before Clawd at position ${i}`);r=i+5}return n},bo=e=>{const n=po(e);if(n.length===0)return console.error("patch: hideStartupClawd: no Clawd components found"),null;const t=[...n].sort((o,l)=>l-o),r="return null;";let i=e;for(const o of t)i=i.slice(0,o)+r+i.slice(o);if(t.length>0){const o=t[t.length-1];z(e,i,r,o,o)}return i},wo=e=>{const n=/=25000,([\s\S]{0,100})<system-reminder>/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: increaseFileReadLimit: failed to find 25000 token limit near system-reminder"),null;const r=t.index+1,i=r+5;return{startIndex:r,endIndex:i}},xo=e=>{const n=wo(e);if(!n)return null;const t="1000000",r=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return z(e,r,t,n.startIndex,n.endIndex),r},Bt=async e=>{if(!e.cliPath){M("backupClijs: Skipping for native installation (no cliPath)");return}await rt(),M(`Backing up cli.js to ${De}`),await re.copyFile(e.cliPath,De),await Ne(n=>{n.changesApplied=!1,n.ccVersion=e.version})},Pt=async e=>{e.nativeInstallationPath&&(await rt(),M(`Backing up native binary to ${ge}`),await re.copyFile(e.nativeInstallationPath,ge),await Ne(n=>{n.changesApplied=!1,n.ccVersion=e.version}))},Zt=async e=>{if(!e.cliPath)return M("restoreClijsFromBackup: Skipping for native installation (no cliPath)"),!1;M(`Restoring cli.js from backup to ${e.cliPath}`);const n=await re.readFile(De);return await _t(e.cliPath,n,"restore"),await pr(),await Ne(t=>{t.changesApplied=!1}),!0},en=async e=>{if(!e.nativeInstallationPath)return M("restoreNativeBinaryFromBackup: No native installation path, skipping"),!1;if(!await _e(ge))return M("restoreNativeBinaryFromBackup: No backup file exists, skipping"),!1;M(`Restoring native binary from backup to ${e.nativeInstallationPath}`);const n=await re.readFile(ge);return await _t(e.nativeInstallationPath,n,"restore"),!0},z=(e,n,t,r,i)=>{if(!je())return;const o=Math.max(0,r-20),l=Math.min(e.length,i+20),c=Math.min(n.length,r+t.length+20),u=e.slice(o,r),d=e.slice(r,i),g=e.slice(i,l),f=n.slice(o,r),x=n.slice(r,r+t.length),w=n.slice(r+t.length,c);d!==x&&(console.log(`
|
|
655
656
|
--- Diff ---`),console.log("OLD:",u+`\x1B[31m${d}\x1B[0m`+g),console.log("NEW:",f+`\x1B[32m${x}\x1B[0m`+w),console.log(`--- End Diff ---
|
|
656
|
-
`))},ue=e=>e.replace(/\$/g,"\\$"),yt=e=>{const n=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,t=Array.from(e.matchAll(n)),r={};for(const l of t){const c=l[1];r[c]=(r[c]||0)+1}let i,o=0;for(const[l,c]of Object.entries(r))c>o&&(o=c,i=l);return i},xo=e=>{const n=e.slice(0,1e3),t=/var ([$\w]+)=\([$\w]+,[$\w]+,[$\w]+\)=>\{/,r=n.match(t);if(!r){console.log("patch: getModuleLoaderFunction: failed to find module loader function");return}return r[1]},tn=e=>{const n=/var ([$\w]+)=[$\w]+\(\([$\w]+\)=>\{var [$\w]+=Symbol\.for\("react\.(transitional\.)?element"\)/,t=e.match(n);if(!t){console.log("patch: getReactModuleNameNonBun: failed to find React module name");return}return t[1]},So=e=>{const n=tn(e);if(!n){console.log("^ patch: getReactModuleFunctionBun: failed to find React module name (Bun)");return}const t=new RegExp(`var ([$\\w]+)=[$\\w]+\\(\\([$\\w]+,[$\\w]+\\)=>\\{[$\\w]+\\.exports=${ue(n)}\\(\\)`),r=e.match(t);if(!r){console.log(`patch: getReactModuleFunctionBun: failed to find React module function (Bun) (reactModuleNameNonBun=${n})`);return}return r[1]};let me=null,Pe=null;const tt=e=>{if(me!=null)return me;const n=xo(e);if(!n){console.log("^ patch: getReactVar: failed to find moduleLoader"),me=void 0;return}const t=tn(e);if(!t){console.log("^ patch: getReactVar: failed to find reactModuleVarNonBun"),me=void 0;return}const r=new RegExp(`\\b([$\\w]+)=${ue(n)}\\(${ue(t)}\\(\\),1\\)`),i=e.match(r);if(i)return me=i[1],me;const o=So(e);if(!o){console.log("^ patch: getReactVar: failed to find reactModuleFunctionBun"),me=void 0;return}const l=new RegExp(`\\b([$\\w]+)=${ue(n)}\\(${ue(o)}\\(\\),1\\)`),c=e.match(l);if(!c){console.log(`patch: getReactVar: failed to find bunPattern (moduleLoader=${n}, reactModuleVarNonBun=${t}, reactModuleFunctionBun=${o})`),me=void 0;return}return me=c[1],me},yo=e=>{const n=/import\{createRequire as ([$\w]+)\}from"node:module";/,t=e.match(n);if(!t)return;const r=t[1],i=new RegExp(`var ([$\\w]+)=${ue(r)}\\(import\\.meta\\.url\\)`),o=e.match(i);if(!o){console.log(`patch: findRequireFunc: failed to find require function variable (createRequireVar=${r})`);return}return o[1]},vt=e=>{if(Pe!=null)return Pe;const n=yo(e);return n?(Pe=n,Pe):(Pe="require",Pe)},nn=e=>{const n=/\bfunction ([$\w]+)\(\{color:[$\w]+,backgroundColor:[$\w]+,dimColor:[$\w]+=![01],bold:[$\w]+=![01]/,t=e.match(n);if(!t){console.log("patch: findTextComponent: failed to find text component");return}return t[1]},Ct=e=>{const n=/\b([$\w]+)\.displayName="Box"/,t=e.match(n);if(!t){console.error("patch: findBoxComponent: failed to find Box displayName");return}const r=t[1],i=new RegExp(`\\b([$\\w]+)=${ue(r)}[^$\\w]`),o=e.match(i);if(!o){console.error(`patch: findBoxComponent: failed to find Box component variable (boxOrigCompName=${r})`);return}return o[1]},rn=async(e,n)=>{let t;if(n.nativeInstallationPath){await en(n);let g=!1;try{await oe.stat(ge),g=!0}catch{}const f=g?ge:n.nativeInstallationPath;M(`Extracting claude.js from ${g?"backup":"native installation"}: ${f}`);const x=await jt(f);if(!x)throw new Error("Failed to extract claude.js from native installation");const w=ae.join(se,"native-claudejs-orig.js");Le.writeFileSync(w,x),M(`Saved original extracted JS from native to: ${w}`),t=x.toString("utf8")}else{if(await Zt(n),!n.cliPath)throw new Error("cliPath is required for NPM installations");t=await oe.readFile(n.cliPath,{encoding:"utf8"})}const r=[],i=await Lr(t,n.version);t=i.newContent,r.push(...i.items);let o=null;e.settings.themes&&e.settings.themes.length>0&&(o=An(t,e.settings.themes))&&(t=o),e.settings.thinkingVerbs&&((o=Zn(t,e.settings.thinkingVerbs.verbs))&&(t=o),(o=Un(t,e.settings.thinkingVerbs.format))&&(t=o)),(o=Wn(t,e.settings.thinkingStyle.phases))&&(t=o),(o=Jn(t,e.settings.thinkingStyle.updateInterval))&&(t=o),(o=qn(t,Math.max(...e.settings.thinkingStyle.phases.map(g=>g.length))+1))&&(t=o),(o=Gn(t,e.settings.thinkingStyle.reverseMirror))&&(t=o),e.settings.userMessageDisplay&&(o=tr(t,e.settings.userMessageDisplay.format,e.settings.userMessageDisplay.foregroundColor,e.settings.userMessageDisplay.backgroundColor,e.settings.userMessageDisplay.styling.includes("bold"),e.settings.userMessageDisplay.styling.includes("italic"),e.settings.userMessageDisplay.styling.includes("underline"),e.settings.userMessageDisplay.styling.includes("strikethrough"),e.settings.userMessageDisplay.styling.includes("inverse"),e.settings.userMessageDisplay.borderStyle,e.settings.userMessageDisplay.borderColor,e.settings.userMessageDisplay.paddingX,e.settings.userMessageDisplay.paddingY,e.settings.userMessageDisplay.fitBoxToContent))&&(t=o),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(o=Rn(t,e.settings.inputBox.removeBorder))&&(t=o),(o=rr(t))&&(t=o),(o=Fn(t))&&(t=o),(o=Dn(t))&&(t=o),(o=Co(t))&&(t=o),(o=Bn(t,25))&&(t=o),(o=sr(t))&&(t=o);const l=e.settings.misc?.showTweakccVersion??!0,c=e.settings.misc?.showPatchesApplied??!0;(o=hr(t,"3.2.0",r,l,c))&&(t=o),(o=Vr(t))&&(t=o),e.settings.toolsets&&e.settings.toolsets.length>0&&(o=no(t,e.settings.toolsets,e.settings.defaultToolset))&&(t=o),e.settings.planModeToolset&&e.settings.defaultToolset&&((o=Zr(t))&&(t=o),(o=to(t,e.settings.planModeToolset,e.settings.defaultToolset))&&(t=o));const u=e.settings.misc?.enableConversationTitle??!0,d=n.version&&Jt(n.version,"2.0.64")<0;if(u&&d&&(o=ho(t))&&(t=o),e.settings.misc?.hideStartupBanner&&(o=go(t))&&(t=o),e.settings.misc?.hideCtrlGToEditPrompt&&(o=po(t))&&(t=o),e.settings.misc?.hideStartupClawd&&(o=wo(t))&&(t=o),n.nativeInstallationPath){M(`Repacking modified claude.js into native installation: ${n.nativeInstallationPath}`);const g=ae.join(se,"native-claudejs-patched.js");Le.writeFileSync(g,t,"utf8"),M(`Saved patched JS from native to: ${g}`);const f=Buffer.from(t,"utf8");await kn(n.nativeInstallationPath,f,n.nativeInstallationPath)}else{if(!n.cliPath)throw new Error("cliPath is required for NPM installations");await _t(n.cliPath,t,"patch")}return await Ne(g=>{g.changesApplied=!0})},on=[{value:"claude-opus-4-5-20251101",label:"Opus 4.5",description:"Claude Opus 4.5 (November 2025)"},{value:"claude-sonnet-4-5-20250929",label:"Sonnet 4.5",description:"Claude Sonnet 4.5 (September 2025)"},{value:"claude-opus-4-1-20250805",label:"Opus 4.1",description:"Claude Opus 4.1 (August 2025)"},{value:"claude-opus-4-20250514",label:"Opus 4",description:"Claude Opus 4 (May 2025)"},{value:"claude-sonnet-4-20250514",label:"Sonnet 4",description:"Claude Sonnet 4 (May 2025)"},{value:"claude-3-7-sonnet-20250219",label:"Sonnet 3.7",description:"Claude 3.7 Sonnet (February 2025)"},{value:"claude-3-5-sonnet-20241022",label:"Sonnet 3.5 (October)",description:"Claude 3.5 Sonnet (October 2024)"},{value:"claude-3-5-haiku-20241022",label:"Haiku 3.5",description:"Claude 3.5 Haiku (October 2024)"},{value:"claude-3-5-sonnet-20240620",label:"Sonnet 3.5 (June)",description:"Claude 3.5 Sonnet (June 2024)"},{value:"claude-3-haiku-20240307",label:"Haiku 3",description:"Claude 3 Haiku (March 2024)"},{value:"claude-3-opus-20240229",label:"Opus 3",description:"Claude 3 Opus (February 2024)"}],vo=e=>{const n=/\b([$\w]+)\.push\(\{value:[$\w]+,label:[$\w]+,description:"Custom model"\}\)/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: findCustomModelListInsertionPoint: failed to find custom model push"),null;const r=t[1],i=Math.max(0,t.index-600),o=e.slice(i,t.index),l=new RegExp(`function [$\\w]+\\(\\)\\{let ${ue(r)}=.+?;`,"g");let c=null,u;for(;(u=l.exec(o))!==null;)c=u;return c?{insertionIndex:i+c.index+c[0].length,modelListVar:r}:(console.error(`patch: findCustomModelListInsertionPoint: failed to find function with let ${r}`),null)},Co=e=>{const n=vo(e);if(!n)return null;const{insertionIndex:t,modelListVar:r}=n,i=on.map(l=>`${r}.push(${JSON.stringify(l)});`).join(""),o=e.slice(0,t)+i+e.slice(t);return Y(e,o,i,t,t),o};let sn=!1;const je=()=>sn,$o=()=>{sn=!0},M=(e,...n)=>{je()&&console.log(e,...n)};function nt(){try{const e=ae.join(Re.homedir(),".claude.json");return JSON.parse(Le.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function _o(){try{const e=ae.join(Re.homedir(),".claude",".credentials.json");switch(JSON.parse(Le.readFileSync(e,"utf8"))?.claudeAiOauth?.subscriptionType||"unknown"){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro"}}catch{}return"Claude API"}function Io(){try{const e=ae.join(Re.homedir(),".claude","settings.json"),t=JSON.parse(Le.readFileSync(e,"utf8"))?.model||"default";if(t==="opus")return"Opus 4.5";const r=on.find(i=>i.value===t);if(r)return r.label}catch{}return"Opus 4.5"}function To(e){process.platform==="win32"?Oe.spawn("explorer",[e],{detached:!0,stdio:"ignore"}).unref():process.platform==="darwin"?Oe.spawn("open",[e],{detached:!0,stdio:"ignore"}).unref():Oe.spawn("xdg-open",[e],{detached:!0,stdio:"ignore"}).unref()}function At(e){if(process.platform==="win32")Oe.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Oe.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const n=ae.dirname(e);Oe.spawn("xdg-open",[n],{detached:!0,stdio:"ignore"}).unref()}}function $t(e){if(!e||typeof e!="string")return!1;const n=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(n))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(n)){const t=n.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t){const[,r,i,o]=t;return parseInt(r)<=255&&parseInt(i)<=255&&parseInt(o)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(n)){const t=n.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t){const[,r,i,o]=t;return parseInt(r)<=360&&parseInt(i)<=100&&parseInt(o)<=100}}return!1}function ln(e){if(!$t(e))return e;const n=e.trim();if(n.startsWith("rgb("))return n;if(n.startsWith("#")){let t=n.slice(1);t.length===3&&(t=t.split("").map(l=>l+l).join(""));const r=parseInt(t.slice(0,2),16),i=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);return`rgb(${r},${i},${o})`}if(n.startsWith("hsl(")){const t=n.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t){const r=parseInt(t[1])/360,i=parseInt(t[2])/100,o=parseInt(t[3])/100,l=(x,w,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<1/6?x+(w-x)*6*p:p<1/2?w:p<2/3?x+(w-x)*(2/3-p)*6:x),c=o<.5?o*(1+i):o+i-o*i,u=2*o-c,d=Math.round(l(u,c,r+1/3)*255),g=Math.round(l(u,c,r)*255),f=Math.round(l(u,c,r-1/3)*255);return`rgb(${d},${g},${f})`}}return e}async function lt(e,n="sha256",t=64*1024){return new Promise((r,i)=>{const o=Rt.createHash(n),l=Le.createReadStream(e,{highWaterMark:t});l.on("data",c=>{o.update(c)}),l.on("end",()=>{r(o.digest("hex"))}),l.on("error",c=>{i(c)})})}async function _t(e,n,t="replace"){let r=493;try{r=(await re.stat(e)).mode,M(`[${t}] Original file mode for ${e}: ${(r&parseInt("777",8)).toString(8)}`)}catch(i){M(`[${t}] Could not stat ${e} (error: ${i}), using default mode 755`)}try{await re.unlink(e),M(`[${t}] Unlinked ${e} to break hard links`)}catch(i){M(`[${t}] Could not unlink ${e}: ${i}`)}await re.writeFile(e,n),await re.chmod(e,r),M(`[${t}] Restored permissions to ${(r&parseInt("777",8)).toString(8)}`)}async function _e(e){try{return await re.stat(e),!0}catch(n){if(n instanceof Error&&"code"in n&&(n.code==="ENOENT"||n.code==="ENOTDIR"||n.code==="EACCES"||n.code==="EPERM"))return!1;throw n}}const Mo=e=>e.startsWith("~")?ae.join(Re.homedir(),e.slice(1)):e,Eo=(e,n)=>{const t=o=>{const l=o.split(".").map(Number);return[l[0]||0,l[1]||0,l[2]||0]},r=t(e),i=t(n);return r[0]!==i[0]?r[0]-i[0]:r[1]!==i[1]?r[1]-i[1]:r[2]-i[2]},ko=e=>{const n=e?.settings?.userMessageDisplay;if(n?.prefix){const t=n;e.settings.userMessageDisplay={format:(t.prefix?.format||"")+(t.message?.format||"{}"),styling:[...t.prefix?.styling||[],...t.message?.styling||[]],foregroundColor:t.message?.foregroundColor==="rgb(0,0,0)"?"default":t.message?.foregroundColor||t.prefix?.foregroundColor||"default",backgroundColor:t.message?.backgroundColor==="rgb(0,0,0)"?null:t.message?.backgroundColor||t.prefix?.backgroundColor||null,borderStyle:"none",borderColor:"rgb(255,255,255)",paddingX:0,paddingY:0,fitBoxToContent:!1}}n&&!("borderStyle"in n)&&(e.settings.userMessageDisplay.borderStyle="none",e.settings.userMessageDisplay.borderColor="rgb(255,255,255)",e.settings.userMessageDisplay.paddingX=0,e.settings.userMessageDisplay.paddingY=0,e.settings.userMessageDisplay.fitBoxToContent=!1),n&&"padding"in n&&!("paddingX"in n)&&(e.settings.userMessageDisplay.paddingX=n.padding||0,e.settings.userMessageDisplay.paddingY=0,delete n.padding),n&&!("fitBoxToContent"in n)&&(e.settings.userMessageDisplay.fitBoxToContent=!1)};async function No(){try{const e=await re.readFile(ce,"utf8"),n=JSON.parse(e);return Object.hasOwn(n,"ccInstallationDir")?(n.ccInstallationDir&&!n.ccInstallationPath&&(n.ccInstallationPath=le.join(n.ccInstallationDir,"cli.js")),delete n.ccInstallationDir,n.lastModified=new Date().toISOString(),await rt(),await re.writeFile(ce,JSON.stringify(n,null,2)),!0):!1}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return!1;throw e}}const ee={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(147,165,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(177,195,255)",permission:"rgb(177,185,249)",permissionShimmer:"rgb(207,215,255)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",background:"rgb(0,204,204)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",warningShimmer:"rgb(255,223,57)",diffAdded:"rgb(34,92,43)",diffRemoved:"rgb(122,41,54)",diffAddedDimmed:"rgb(71,88,74)",diffRemovedDimmed:"rgb(105,72,77)",diffAddedWord:"rgb(56,166,96)",diffRemovedWord:"rgb(179,89,107)",diffAddedWordDimmed:"rgb(46,107,58)",diffRemovedWordDimmed:"rgb(139,57,69)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(177,185,249)",rate_limit_empty:"rgb(80,83,112)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(87,105,247)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(117,135,255)",permission:"rgb(87,105,247)",permissionShimmer:"rgb(137,155,255)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",background:"rgb(0,153,153)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",warningShimmer:"rgb(200,158,80)",diffAdded:"rgb(105,219,124)",diffRemoved:"rgb(255,168,180)",diffAddedDimmed:"rgb(199,225,203)",diffRemovedDimmed:"rgb(253,210,216)",diffAddedWord:"rgb(47,157,68)",diffRemovedWord:"rgb(209,69,75)",diffAddedWordDimmed:"rgb(144,194,156)",diffRemovedWordDimmed:"rgb(232,165,173)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(240, 240, 240)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(87,105,247)",rate_limit_empty:"rgb(39,47,111)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"ansi:magenta",bashBorder:"ansi:magenta",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blue",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blue",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyan",ide:"ansi:blueBright",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:black",inverseText:"ansi:white",inactive:"ansi:blackBright",subtle:"ansi:blackBright",suggestion:"ansi:blue",remember:"ansi:blue",background:"ansi:cyan",success:"ansi:green",error:"ansi:red",warning:"ansi:yellow",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:red",blue_FOR_SUBAGENTS_ONLY:"ansi:blue",green_FOR_SUBAGENTS_ONLY:"ansi:green",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellow",purple_FOR_SUBAGENTS_ONLY:"ansi:magenta",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyan",professionalBlue:"ansi:blueBright",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:white",bashMessageBackgroundColor:"ansi:whiteBright",memoryBackgroundColor:"ansi:white",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:black"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"ansi:magentaBright",bashBorder:"ansi:magentaBright",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blueBright",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blueBright",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyanBright",ide:"ansi:blue",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:whiteBright",inverseText:"ansi:black",inactive:"ansi:white",subtle:"ansi:white",suggestion:"ansi:blueBright",remember:"ansi:blueBright",background:"ansi:cyanBright",success:"ansi:greenBright",error:"ansi:redBright",warning:"ansi:yellowBright",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:redBright",blue_FOR_SUBAGENTS_ONLY:"ansi:blueBright",green_FOR_SUBAGENTS_ONLY:"ansi:greenBright",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellowBright",purple_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyanBright",professionalBlue:"rgb(106,155,204)",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:blackBright",bashMessageBackgroundColor:"ansi:black",memoryBackgroundColor:"ansi:blackBright",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:white"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(51,102,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(101,152,255)",permission:"rgb(51,102,255)",permissionShimmer:"rgb(101,152,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",background:"rgb(0,153,153)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",warningShimmer:"rgb(255,183,50)",diffAdded:"rgb(153,204,255)",diffRemoved:"rgb(255,204,204)",diffAddedDimmed:"rgb(209,231,253)",diffRemovedDimmed:"rgb(255,233,233)",diffAddedWord:"rgb(51,102,204)",diffRemovedWord:"rgb(153,51,51)",diffAddedWordDimmed:"rgb(102,153,204)",diffRemovedWordDimmed:"rgb(204,153,153)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(220, 220, 220)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(51,102,255)",rate_limit_empty:"rgb(23,46,114)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(153,204,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(183,224,255)",permission:"rgb(153,204,255)",permissionShimmer:"rgb(183,224,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",background:"rgb(0,204,204)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",warningShimmer:"rgb(255,234,50)",diffAdded:"rgb(0,68,102)",diffRemoved:"rgb(102,0,0)",diffAddedDimmed:"rgb(62,81,91)",diffRemovedDimmed:"rgb(62,44,44)",diffAddedWord:"rgb(0,119,179)",diffRemovedWord:"rgb(179,0,0)",diffAddedWordDimmed:"rgb(26,99,128)",diffRemovedWordDimmed:"rgb(128,21,21)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(153,204,255)",rate_limit_empty:"rgb(69,92,115)"}},{name:"Monochrome",id:"monochrome",colors:{autoAccept:"rgb(200,200,200)",bashBorder:"rgb(180,180,180)",claude:"rgb(255,255,255)",claudeShimmer:"rgb(230,230,230)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(200,200,200)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(220,220,220)",permission:"rgb(200,200,200)",permissionShimmer:"rgb(220,220,220)",planMode:"rgb(180,180,180)",ide:"rgb(190,190,190)",promptBorder:"rgb(160,160,160)",promptBorderShimmer:"rgb(180,180,180)",text:"rgb(255,255,255)",inverseText:"rgb(40,40,40)",inactive:"rgb(120,120,120)",subtle:"rgb(100,100,100)",suggestion:"rgb(200,200,200)",remember:"rgb(200,200,200)",background:"rgb(180,180,180)",success:"rgb(220,220,220)",error:"rgb(180,180,180)",warning:"rgb(200,200,200)",warningShimmer:"rgb(220,220,220)",diffAdded:"rgb(90,90,90)",diffRemoved:"rgb(60,60,60)",diffAddedDimmed:"rgb(110,110,110)",diffRemovedDimmed:"rgb(80,80,80)",diffAddedWord:"rgb(200,200,200)",diffRemovedWord:"rgb(80,80,80)",diffAddedWordDimmed:"rgb(160,160,160)",diffRemovedWordDimmed:"rgb(70,70,70)",red_FOR_SUBAGENTS_ONLY:"rgb(200,200,200)",blue_FOR_SUBAGENTS_ONLY:"rgb(180,180,180)",green_FOR_SUBAGENTS_ONLY:"rgb(210,210,210)",yellow_FOR_SUBAGENTS_ONLY:"rgb(190,190,190)",purple_FOR_SUBAGENTS_ONLY:"rgb(170,170,170)",orange_FOR_SUBAGENTS_ONLY:"rgb(195,195,195)",pink_FOR_SUBAGENTS_ONLY:"rgb(205,205,205)",cyan_FOR_SUBAGENTS_ONLY:"rgb(185,185,185)",professionalBlue:"rgb(190,190,190)",rainbow_red:"rgb(240,240,240)",rainbow_orange:"rgb(230,230,230)",rainbow_yellow:"rgb(220,220,220)",rainbow_green:"rgb(210,210,210)",rainbow_blue:"rgb(200,200,200)",rainbow_indigo:"rgb(190,190,190)",rainbow_violet:"rgb(180,180,180)",rainbow_red_shimmer:"rgb(255,255,255)",rainbow_orange_shimmer:"rgb(245,245,245)",rainbow_yellow_shimmer:"rgb(235,235,235)",rainbow_green_shimmer:"rgb(225,225,225)",rainbow_blue_shimmer:"rgb(215,215,215)",rainbow_indigo_shimmer:"rgb(205,205,205)",rainbow_violet_shimmer:"rgb(195,195,195)",clawd_body:"rgb(255,255,255)",clawd_background:"rgb(40,40,40)",userMessageBackground:"rgb(70,70,70)",bashMessageBackgroundColor:"rgb(65,65,65)",memoryBackgroundColor:"rgb(75,75,75)",rate_limit_fill:"rgb(200,200,200)",rate_limit_empty:"rgb(90,90,90)"}}],thinkingVerbs:{format:"{}… ",verbs:["Accomplishing","Actioning","Actualizing","Baking","Booping","Brewing","Calculating","Cerebrating","Channelling","Churning","Clauding","Coalescing","Cogitating","Combobulating","Computing","Concocting","Conjuring","Considering","Contemplating","Cooking","Crafting","Creating","Crunching","Deciphering","Deliberating","Determining","Discombobulating","Divining","Doing","Effecting","Elucidating","Enchanting","Envisioning","Finagling","Flibbertigibbeting","Forging","Forming","Frolicking","Generating","Germinating","Hatching","Herding","Honking","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:process.env.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{format:" > {} ",styling:[],foregroundColor:"default",backgroundColor:null,borderStyle:"none",borderColor:"rgb(255,255,255)",paddingX:0,paddingY:0,fitBoxToContent:!1},inputBox:{removeBorder:!1},misc:{showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEditPrompt:!1,hideStartupClawd:!1},toolsets:[],defaultToolset:null,planModeToolset:null},Bo=()=>{const e=process.env.TWEAKCC_CONFIG_DIR?.trim();if(e&&e.length>0)return Mo(e);const n=le.join(Ce.homedir(),".tweakcc"),t=le.join(Ce.homedir(),".claude","tweakcc"),r=process.env.XDG_CONFIG_HOME;try{if(gt.existsSync(n))return n}catch(i){M(`Failed to check if ${n} exists: ${i}`)}try{if(gt.existsSync(t))return t}catch(i){M(`Failed to check if ${t} exists: ${i}`)}return r?le.join(r,"tweakcc"):n},se=Bo(),ce=le.join(se,"config.json"),De=le.join(se,"cli.js.backup"),ge=le.join(se,"native-binary.backup"),Se=le.join(se,"system-prompts"),Ot=le.join(se,"prompt-data-cache"),Po=()=>{const e=se,n=Ce.homedir(),t=[le.join(n,".tweakcc"),le.join(n,".claude","tweakcc"),process.env.XDG_CONFIG_HOME?le.join(process.env.XDG_CONFIG_HOME,"tweakcc"):null].filter(i=>i!==null),r=t.filter(i=>{try{return gt.existsSync(i)&&i!==e}catch{return!1}});r.length>0&&(console.warn(F.yellow(`
|
|
657
|
+
`))},ue=e=>e.replace(/\$/g,"\\$"),yt=e=>{const n=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,t=Array.from(e.matchAll(n)),r={};for(const l of t){const c=l[1];r[c]=(r[c]||0)+1}let i,o=0;for(const[l,c]of Object.entries(r))c>o&&(o=c,i=l);return i},So=e=>{const n=e.slice(0,1e3),t=/var ([$\w]+)=\([$\w]+,[$\w]+,[$\w]+\)=>\{/,r=n.match(t);if(!r){console.log("patch: getModuleLoaderFunction: failed to find module loader function");return}return r[1]},tn=e=>{const n=/var ([$\w]+)=[$\w]+\(\([$\w]+\)=>\{var [$\w]+=Symbol\.for\("react\.(transitional\.)?element"\)/,t=e.match(n);if(!t){console.log("patch: getReactModuleNameNonBun: failed to find React module name");return}return t[1]},yo=e=>{const n=tn(e);if(!n){console.log("^ patch: getReactModuleFunctionBun: failed to find React module name (Bun)");return}const t=new RegExp(`var ([$\\w]+)=[$\\w]+\\(\\([$\\w]+,[$\\w]+\\)=>\\{[$\\w]+\\.exports=${ue(n)}\\(\\)`),r=e.match(t);if(!r){console.log(`patch: getReactModuleFunctionBun: failed to find React module function (Bun) (reactModuleNameNonBun=${n})`);return}return r[1]};let me=null,Pe=null;const tt=e=>{if(me!=null)return me;const n=So(e);if(!n){console.log("^ patch: getReactVar: failed to find moduleLoader"),me=void 0;return}const t=tn(e);if(!t){console.log("^ patch: getReactVar: failed to find reactModuleVarNonBun"),me=void 0;return}const r=new RegExp(`\\b([$\\w]+)=${ue(n)}\\(${ue(t)}\\(\\),1\\)`),i=e.match(r);if(i)return me=i[1],me;const o=yo(e);if(!o){console.log("^ patch: getReactVar: failed to find reactModuleFunctionBun"),me=void 0;return}const l=new RegExp(`\\b([$\\w]+)=${ue(n)}\\(${ue(o)}\\(\\),1\\)`),c=e.match(l);if(!c){console.log(`patch: getReactVar: failed to find bunPattern (moduleLoader=${n}, reactModuleVarNonBun=${t}, reactModuleFunctionBun=${o})`),me=void 0;return}return me=c[1],me},vo=e=>{const n=/import\{createRequire as ([$\w]+)\}from"node:module";/,t=e.match(n);if(!t)return;const r=t[1],i=new RegExp(`var ([$\\w]+)=${ue(r)}\\(import\\.meta\\.url\\)`),o=e.match(i);if(!o){console.log(`patch: findRequireFunc: failed to find require function variable (createRequireVar=${r})`);return}return o[1]},vt=e=>{if(Pe!=null)return Pe;const n=vo(e);return n?(Pe=n,Pe):(Pe="require",Pe)},nn=e=>{const n=/\bfunction ([$\w]+)\(\{color:[$\w]+,backgroundColor:[$\w]+,dimColor:[$\w]+=![01],bold:[$\w]+=![01]/,t=e.match(n);if(!t){console.log("patch: findTextComponent: failed to find text component");return}return t[1]},Ct=e=>{const n=/\b([$\w]+)\.displayName="Box"/,t=e.match(n);if(!t){console.error("patch: findBoxComponent: failed to find Box displayName");return}const r=t[1],i=new RegExp(`\\b([$\\w]+)=${ue(r)}[^$\\w]`),o=e.match(i);if(!o){console.error(`patch: findBoxComponent: failed to find Box component variable (boxOrigCompName=${r})`);return}return o[1]},rn=async(e,n)=>{let t;if(n.nativeInstallationPath){await en(n);let g=!1;try{await oe.stat(ge),g=!0}catch{}const f=g?ge:n.nativeInstallationPath;M(`Extracting claude.js from ${g?"backup":"native installation"}: ${f}`);const x=await jt(f);if(!x)throw new Error("Failed to extract claude.js from native installation");const w=ae.join(se,"native-claudejs-orig.js");Le.writeFileSync(w,x),M(`Saved original extracted JS from native to: ${w}`),t=x.toString("utf8")}else{if(await Zt(n),!n.cliPath)throw new Error("cliPath is required for NPM installations");t=await oe.readFile(n.cliPath,{encoding:"utf8"})}const r=[],i=await Dr(t,n.version);t=i.newContent,r.push(...i.items);let o=null;e.settings.themes&&e.settings.themes.length>0&&(o=An(t,e.settings.themes))&&(t=o),e.settings.thinkingVerbs&&((o=Zn(t,e.settings.thinkingVerbs.verbs))&&(t=o),(o=Un(t,e.settings.thinkingVerbs.format))&&(t=o)),(o=Wn(t,e.settings.thinkingStyle.phases))&&(t=o),(o=Jn(t,e.settings.thinkingStyle.updateInterval))&&(t=o),(o=qn(t,Math.max(...e.settings.thinkingStyle.phases.map(g=>g.length))+1))&&(t=o),(o=Gn(t,e.settings.thinkingStyle.reverseMirror))&&(t=o),e.settings.userMessageDisplay&&(o=tr(t,e.settings.userMessageDisplay.format,e.settings.userMessageDisplay.foregroundColor,e.settings.userMessageDisplay.backgroundColor,e.settings.userMessageDisplay.styling.includes("bold"),e.settings.userMessageDisplay.styling.includes("italic"),e.settings.userMessageDisplay.styling.includes("underline"),e.settings.userMessageDisplay.styling.includes("strikethrough"),e.settings.userMessageDisplay.styling.includes("inverse"),e.settings.userMessageDisplay.borderStyle,e.settings.userMessageDisplay.borderColor,e.settings.userMessageDisplay.paddingX,e.settings.userMessageDisplay.paddingY,e.settings.userMessageDisplay.fitBoxToContent))&&(t=o),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(o=Rn(t,e.settings.inputBox.removeBorder))&&(t=o),(o=rr(t))&&(t=o),(o=Vn(t))&&(t=o),(o=Dn(t))&&(t=o),(o=$o(t))&&(t=o),(o=Bn(t,25))&&(t=o),(o=ir(t))&&(t=o);const l=e.settings.misc?.showTweakccVersion??!0,c=e.settings.misc?.showPatchesApplied??!0;(o=ur(t,"3.2.2",r,l,c))&&(t=o),(o=Rr(t))&&(t=o),e.settings.toolsets&&e.settings.toolsets.length>0&&(o=to(t,e.settings.toolsets,e.settings.defaultToolset))&&(t=o),e.settings.planModeToolset&&e.settings.defaultToolset&&((o=Qr(t))&&(t=o),(o=eo(t,e.settings.planModeToolset,e.settings.defaultToolset))&&(t=o));const u=e.settings.misc?.enableConversationTitle??!0,d=n.version&&Jt(n.version,"2.0.64")<0;if(u&&d&&(o=uo(t))&&(t=o),e.settings.misc?.hideStartupBanner&&(o=mo(t))&&(t=o),e.settings.misc?.hideCtrlGToEditPrompt&&(o=fo(t))&&(t=o),e.settings.misc?.hideStartupClawd&&(o=bo(t))&&(t=o),e.settings.misc?.increaseFileReadLimit&&(o=xo(t))&&(t=o),n.nativeInstallationPath){M(`Repacking modified claude.js into native installation: ${n.nativeInstallationPath}`);const g=ae.join(se,"native-claudejs-patched.js");Le.writeFileSync(g,t,"utf8"),M(`Saved patched JS from native to: ${g}`);const f=Buffer.from(t,"utf8");await kn(n.nativeInstallationPath,f,n.nativeInstallationPath)}else{if(!n.cliPath)throw new Error("cliPath is required for NPM installations");await _t(n.cliPath,t,"patch")}return await Ne(g=>{g.changesApplied=!0})},on=[{value:"claude-opus-4-5-20251101",label:"Opus 4.5",description:"Claude Opus 4.5 (November 2025)"},{value:"claude-sonnet-4-5-20250929",label:"Sonnet 4.5",description:"Claude Sonnet 4.5 (September 2025)"},{value:"claude-opus-4-1-20250805",label:"Opus 4.1",description:"Claude Opus 4.1 (August 2025)"},{value:"claude-opus-4-20250514",label:"Opus 4",description:"Claude Opus 4 (May 2025)"},{value:"claude-sonnet-4-20250514",label:"Sonnet 4",description:"Claude Sonnet 4 (May 2025)"},{value:"claude-3-7-sonnet-20250219",label:"Sonnet 3.7",description:"Claude 3.7 Sonnet (February 2025)"},{value:"claude-3-5-sonnet-20241022",label:"Sonnet 3.5 (October)",description:"Claude 3.5 Sonnet (October 2024)"},{value:"claude-3-5-haiku-20241022",label:"Haiku 3.5",description:"Claude 3.5 Haiku (October 2024)"},{value:"claude-3-5-sonnet-20240620",label:"Sonnet 3.5 (June)",description:"Claude 3.5 Sonnet (June 2024)"},{value:"claude-3-haiku-20240307",label:"Haiku 3",description:"Claude 3 Haiku (March 2024)"},{value:"claude-3-opus-20240229",label:"Opus 3",description:"Claude 3 Opus (February 2024)"}],Co=e=>{const n=/\b([$\w]+)\.push\(\{value:[$\w]+,label:[$\w]+,description:"Custom model"\}\)/,t=e.match(n);if(!t||t.index===void 0)return console.error("patch: findCustomModelListInsertionPoint: failed to find custom model push"),null;const r=t[1],i=Math.max(0,t.index-600),o=e.slice(i,t.index),l=new RegExp(`function [$\\w]+\\(\\)\\{let ${ue(r)}=.+?;`,"g");let c=null,u;for(;(u=l.exec(o))!==null;)c=u;return c?{insertionIndex:i+c.index+c[0].length,modelListVar:r}:(console.error(`patch: findCustomModelListInsertionPoint: failed to find function with let ${r}`),null)},$o=e=>{const n=Co(e);if(!n)return null;const{insertionIndex:t,modelListVar:r}=n,i=on.map(l=>`${r}.push(${JSON.stringify(l)});`).join(""),o=e.slice(0,t)+i+e.slice(t);return z(e,o,i,t,t),o};let sn=!1;const je=()=>sn,_o=()=>{sn=!0},M=(e,...n)=>{je()&&console.log(e,...n)};function nt(){try{const e=ae.join(Re.homedir(),".claude.json");return JSON.parse(Le.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function Io(){try{const e=ae.join(Re.homedir(),".claude",".credentials.json");switch(JSON.parse(Le.readFileSync(e,"utf8"))?.claudeAiOauth?.subscriptionType||"unknown"){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro"}}catch{}return"Claude API"}function To(){try{const e=ae.join(Re.homedir(),".claude","settings.json"),t=JSON.parse(Le.readFileSync(e,"utf8"))?.model||"default";if(t==="opus")return"Opus 4.5";const r=on.find(i=>i.value===t);if(r)return r.label}catch{}return"Opus 4.5"}function Mo(e){process.platform==="win32"?Oe.spawn("explorer",[e],{detached:!0,stdio:"ignore"}).unref():process.platform==="darwin"?Oe.spawn("open",[e],{detached:!0,stdio:"ignore"}).unref():Oe.spawn("xdg-open",[e],{detached:!0,stdio:"ignore"}).unref()}function At(e){if(process.platform==="win32")Oe.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Oe.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const n=ae.dirname(e);Oe.spawn("xdg-open",[n],{detached:!0,stdio:"ignore"}).unref()}}function $t(e){if(!e||typeof e!="string")return!1;const n=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(n))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(n)){const t=n.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t){const[,r,i,o]=t;return parseInt(r)<=255&&parseInt(i)<=255&&parseInt(o)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(n)){const t=n.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t){const[,r,i,o]=t;return parseInt(r)<=360&&parseInt(i)<=100&&parseInt(o)<=100}}return!1}function ln(e){if(!$t(e))return e;const n=e.trim();if(n.startsWith("rgb("))return n;if(n.startsWith("#")){let t=n.slice(1);t.length===3&&(t=t.split("").map(l=>l+l).join(""));const r=parseInt(t.slice(0,2),16),i=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);return`rgb(${r},${i},${o})`}if(n.startsWith("hsl(")){const t=n.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t){const r=parseInt(t[1])/360,i=parseInt(t[2])/100,o=parseInt(t[3])/100,l=(x,w,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<1/6?x+(w-x)*6*p:p<1/2?w:p<2/3?x+(w-x)*(2/3-p)*6:x),c=o<.5?o*(1+i):o+i-o*i,u=2*o-c,d=Math.round(l(u,c,r+1/3)*255),g=Math.round(l(u,c,r)*255),f=Math.round(l(u,c,r-1/3)*255);return`rgb(${d},${g},${f})`}}return e}async function lt(e,n="sha256",t=64*1024){return new Promise((r,i)=>{const o=Rt.createHash(n),l=Le.createReadStream(e,{highWaterMark:t});l.on("data",c=>{o.update(c)}),l.on("end",()=>{r(o.digest("hex"))}),l.on("error",c=>{i(c)})})}async function _t(e,n,t="replace"){let r=493;try{r=(await re.stat(e)).mode,M(`[${t}] Original file mode for ${e}: ${(r&parseInt("777",8)).toString(8)}`)}catch(i){M(`[${t}] Could not stat ${e} (error: ${i}), using default mode 755`)}try{await re.unlink(e),M(`[${t}] Unlinked ${e} to break hard links`)}catch(i){M(`[${t}] Could not unlink ${e}: ${i}`)}await re.writeFile(e,n),await re.chmod(e,r),M(`[${t}] Restored permissions to ${(r&parseInt("777",8)).toString(8)}`)}async function _e(e){try{return await re.stat(e),!0}catch(n){if(n instanceof Error&&"code"in n&&(n.code==="ENOENT"||n.code==="ENOTDIR"||n.code==="EACCES"||n.code==="EPERM"))return!1;throw n}}const Eo=e=>e.startsWith("~")?ae.join(Re.homedir(),e.slice(1)):e,ko=(e,n)=>{const t=o=>{const l=o.split(".").map(Number);return[l[0]||0,l[1]||0,l[2]||0]},r=t(e),i=t(n);return r[0]!==i[0]?r[0]-i[0]:r[1]!==i[1]?r[1]-i[1]:r[2]-i[2]},No=e=>{const n=e?.settings?.userMessageDisplay;if(n?.prefix){const t=n;e.settings.userMessageDisplay={format:(t.prefix?.format||"")+(t.message?.format||"{}"),styling:[...t.prefix?.styling||[],...t.message?.styling||[]],foregroundColor:t.message?.foregroundColor==="rgb(0,0,0)"?"default":t.message?.foregroundColor||t.prefix?.foregroundColor||"default",backgroundColor:t.message?.backgroundColor==="rgb(0,0,0)"?null:t.message?.backgroundColor||t.prefix?.backgroundColor||null,borderStyle:"none",borderColor:"rgb(255,255,255)",paddingX:0,paddingY:0,fitBoxToContent:!1}}n&&!("borderStyle"in n)&&(e.settings.userMessageDisplay.borderStyle="none",e.settings.userMessageDisplay.borderColor="rgb(255,255,255)",e.settings.userMessageDisplay.paddingX=0,e.settings.userMessageDisplay.paddingY=0,e.settings.userMessageDisplay.fitBoxToContent=!1),n&&"padding"in n&&!("paddingX"in n)&&(e.settings.userMessageDisplay.paddingX=n.padding||0,e.settings.userMessageDisplay.paddingY=0,delete n.padding),n&&!("fitBoxToContent"in n)&&(e.settings.userMessageDisplay.fitBoxToContent=!1)};async function Bo(){try{const e=await re.readFile(ce,"utf8"),n=JSON.parse(e);return Object.hasOwn(n,"ccInstallationDir")?(n.ccInstallationDir&&!n.ccInstallationPath&&(n.ccInstallationPath=le.join(n.ccInstallationDir,"cli.js")),delete n.ccInstallationDir,n.lastModified=new Date().toISOString(),await rt(),await re.writeFile(ce,JSON.stringify(n,null,2)),!0):!1}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return!1;throw e}}const ee={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(147,165,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(177,195,255)",permission:"rgb(177,185,249)",permissionShimmer:"rgb(207,215,255)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",background:"rgb(0,204,204)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",warningShimmer:"rgb(255,223,57)",diffAdded:"rgb(34,92,43)",diffRemoved:"rgb(122,41,54)",diffAddedDimmed:"rgb(71,88,74)",diffRemovedDimmed:"rgb(105,72,77)",diffAddedWord:"rgb(56,166,96)",diffRemovedWord:"rgb(179,89,107)",diffAddedWordDimmed:"rgb(46,107,58)",diffRemovedWordDimmed:"rgb(139,57,69)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(177,185,249)",rate_limit_empty:"rgb(80,83,112)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(87,105,247)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(117,135,255)",permission:"rgb(87,105,247)",permissionShimmer:"rgb(137,155,255)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",background:"rgb(0,153,153)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",warningShimmer:"rgb(200,158,80)",diffAdded:"rgb(105,219,124)",diffRemoved:"rgb(255,168,180)",diffAddedDimmed:"rgb(199,225,203)",diffRemovedDimmed:"rgb(253,210,216)",diffAddedWord:"rgb(47,157,68)",diffRemovedWord:"rgb(209,69,75)",diffAddedWordDimmed:"rgb(144,194,156)",diffRemovedWordDimmed:"rgb(232,165,173)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(240, 240, 240)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(87,105,247)",rate_limit_empty:"rgb(39,47,111)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"ansi:magenta",bashBorder:"ansi:magenta",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blue",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blue",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyan",ide:"ansi:blueBright",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:black",inverseText:"ansi:white",inactive:"ansi:blackBright",subtle:"ansi:blackBright",suggestion:"ansi:blue",remember:"ansi:blue",background:"ansi:cyan",success:"ansi:green",error:"ansi:red",warning:"ansi:yellow",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:red",blue_FOR_SUBAGENTS_ONLY:"ansi:blue",green_FOR_SUBAGENTS_ONLY:"ansi:green",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellow",purple_FOR_SUBAGENTS_ONLY:"ansi:magenta",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyan",professionalBlue:"ansi:blueBright",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:white",bashMessageBackgroundColor:"ansi:whiteBright",memoryBackgroundColor:"ansi:white",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:black"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"ansi:magentaBright",bashBorder:"ansi:magentaBright",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blueBright",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blueBright",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyanBright",ide:"ansi:blue",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:whiteBright",inverseText:"ansi:black",inactive:"ansi:white",subtle:"ansi:white",suggestion:"ansi:blueBright",remember:"ansi:blueBright",background:"ansi:cyanBright",success:"ansi:greenBright",error:"ansi:redBright",warning:"ansi:yellowBright",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:redBright",blue_FOR_SUBAGENTS_ONLY:"ansi:blueBright",green_FOR_SUBAGENTS_ONLY:"ansi:greenBright",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellowBright",purple_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyanBright",professionalBlue:"rgb(106,155,204)",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:blackBright",bashMessageBackgroundColor:"ansi:black",memoryBackgroundColor:"ansi:blackBright",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:white"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(51,102,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(101,152,255)",permission:"rgb(51,102,255)",permissionShimmer:"rgb(101,152,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",background:"rgb(0,153,153)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",warningShimmer:"rgb(255,183,50)",diffAdded:"rgb(153,204,255)",diffRemoved:"rgb(255,204,204)",diffAddedDimmed:"rgb(209,231,253)",diffRemovedDimmed:"rgb(255,233,233)",diffAddedWord:"rgb(51,102,204)",diffRemovedWord:"rgb(153,51,51)",diffAddedWordDimmed:"rgb(102,153,204)",diffRemovedWordDimmed:"rgb(204,153,153)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(220, 220, 220)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(51,102,255)",rate_limit_empty:"rgb(23,46,114)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(153,204,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(183,224,255)",permission:"rgb(153,204,255)",permissionShimmer:"rgb(183,224,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",background:"rgb(0,204,204)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",warningShimmer:"rgb(255,234,50)",diffAdded:"rgb(0,68,102)",diffRemoved:"rgb(102,0,0)",diffAddedDimmed:"rgb(62,81,91)",diffRemovedDimmed:"rgb(62,44,44)",diffAddedWord:"rgb(0,119,179)",diffRemovedWord:"rgb(179,0,0)",diffAddedWordDimmed:"rgb(26,99,128)",diffRemovedWordDimmed:"rgb(128,21,21)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(153,204,255)",rate_limit_empty:"rgb(69,92,115)"}},{name:"Monochrome",id:"monochrome",colors:{autoAccept:"rgb(200,200,200)",bashBorder:"rgb(180,180,180)",claude:"rgb(255,255,255)",claudeShimmer:"rgb(230,230,230)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(200,200,200)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(220,220,220)",permission:"rgb(200,200,200)",permissionShimmer:"rgb(220,220,220)",planMode:"rgb(180,180,180)",ide:"rgb(190,190,190)",promptBorder:"rgb(160,160,160)",promptBorderShimmer:"rgb(180,180,180)",text:"rgb(255,255,255)",inverseText:"rgb(40,40,40)",inactive:"rgb(120,120,120)",subtle:"rgb(100,100,100)",suggestion:"rgb(200,200,200)",remember:"rgb(200,200,200)",background:"rgb(180,180,180)",success:"rgb(220,220,220)",error:"rgb(180,180,180)",warning:"rgb(200,200,200)",warningShimmer:"rgb(220,220,220)",diffAdded:"rgb(90,90,90)",diffRemoved:"rgb(60,60,60)",diffAddedDimmed:"rgb(110,110,110)",diffRemovedDimmed:"rgb(80,80,80)",diffAddedWord:"rgb(200,200,200)",diffRemovedWord:"rgb(80,80,80)",diffAddedWordDimmed:"rgb(160,160,160)",diffRemovedWordDimmed:"rgb(70,70,70)",red_FOR_SUBAGENTS_ONLY:"rgb(200,200,200)",blue_FOR_SUBAGENTS_ONLY:"rgb(180,180,180)",green_FOR_SUBAGENTS_ONLY:"rgb(210,210,210)",yellow_FOR_SUBAGENTS_ONLY:"rgb(190,190,190)",purple_FOR_SUBAGENTS_ONLY:"rgb(170,170,170)",orange_FOR_SUBAGENTS_ONLY:"rgb(195,195,195)",pink_FOR_SUBAGENTS_ONLY:"rgb(205,205,205)",cyan_FOR_SUBAGENTS_ONLY:"rgb(185,185,185)",professionalBlue:"rgb(190,190,190)",rainbow_red:"rgb(240,240,240)",rainbow_orange:"rgb(230,230,230)",rainbow_yellow:"rgb(220,220,220)",rainbow_green:"rgb(210,210,210)",rainbow_blue:"rgb(200,200,200)",rainbow_indigo:"rgb(190,190,190)",rainbow_violet:"rgb(180,180,180)",rainbow_red_shimmer:"rgb(255,255,255)",rainbow_orange_shimmer:"rgb(245,245,245)",rainbow_yellow_shimmer:"rgb(235,235,235)",rainbow_green_shimmer:"rgb(225,225,225)",rainbow_blue_shimmer:"rgb(215,215,215)",rainbow_indigo_shimmer:"rgb(205,205,205)",rainbow_violet_shimmer:"rgb(195,195,195)",clawd_body:"rgb(255,255,255)",clawd_background:"rgb(40,40,40)",userMessageBackground:"rgb(70,70,70)",bashMessageBackgroundColor:"rgb(65,65,65)",memoryBackgroundColor:"rgb(75,75,75)",rate_limit_fill:"rgb(200,200,200)",rate_limit_empty:"rgb(90,90,90)"}}],thinkingVerbs:{format:"{}… ",verbs:["Accomplishing","Actioning","Actualizing","Baking","Booping","Brewing","Calculating","Cerebrating","Channelling","Churning","Clauding","Coalescing","Cogitating","Combobulating","Computing","Concocting","Conjuring","Considering","Contemplating","Cooking","Crafting","Creating","Crunching","Deciphering","Deliberating","Determining","Discombobulating","Divining","Doing","Effecting","Elucidating","Enchanting","Envisioning","Finagling","Flibbertigibbeting","Forging","Forming","Frolicking","Generating","Germinating","Hatching","Herding","Honking","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:process.env.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{format:" > {} ",styling:[],foregroundColor:"default",backgroundColor:null,borderStyle:"none",borderColor:"rgb(255,255,255)",paddingX:0,paddingY:0,fitBoxToContent:!1},inputBox:{removeBorder:!1},misc:{showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEditPrompt:!1,hideStartupClawd:!1,increaseFileReadLimit:!1},toolsets:[],defaultToolset:null,planModeToolset:null},Po=()=>{const e=process.env.TWEAKCC_CONFIG_DIR?.trim();if(e&&e.length>0)return Eo(e);const n=le.join(Ce.homedir(),".tweakcc"),t=le.join(Ce.homedir(),".claude","tweakcc"),r=process.env.XDG_CONFIG_HOME;try{if(gt.existsSync(n))return n}catch(i){M(`Failed to check if ${n} exists: ${i}`)}try{if(gt.existsSync(t))return t}catch(i){M(`Failed to check if ${t} exists: ${i}`)}return r?le.join(r,"tweakcc"):n},se=Po(),ce=le.join(se,"config.json"),De=le.join(se,"cli.js.backup"),ge=le.join(se,"native-binary.backup"),xe=le.join(se,"system-prompts"),Ot=le.join(se,"prompt-data-cache"),Ao=()=>{const e=se,n=Ce.homedir(),t=[le.join(n,".tweakcc"),le.join(n,".claude","tweakcc"),process.env.XDG_CONFIG_HOME?le.join(process.env.XDG_CONFIG_HOME,"tweakcc"):null].filter(i=>i!==null),r=t.filter(i=>{try{return gt.existsSync(i)&&i!==e}catch{return!1}});r.length>0&&(console.warn(F.yellow(`
|
|
657
658
|
Multiple configuration locations detected:`)),console.warn(F.gray(` Active: ${e}`)),console.warn(F.gray(" Other existing locations:")),r.forEach(i=>{console.warn(F.gray(` - ${i}`))}),console.warn(F.gray(" Only the active location is used. To switch locations,")),console.warn(F.gray(` move your config.json to the desired directory.
|
|
658
|
-
`)))},rt=async()=>{await re.mkdir(se,{recursive:!0}),await re.mkdir(Se,{recursive:!0});const e=le.join(se,".gitignore");try{await re.stat(e)}catch(n){n instanceof Error&&"code"in n&&n.code==="ENOENT"&&await re.writeFile(e,[".DS_Store","prompt-data-cache","cli.js.backup","native-binary.backup","native-claudejs-orig.js","native-claudejs-patched.js","systemPromptAppliedHashes.json","systemPromptOriginalHashes.json","system-prompts/*.diff.html"].join(Mt)+Mt)}};let ke=null;const He=async()=>{const e={ccVersion:"",ccInstallationPath:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:ee};try{M(`Reading config at ${ce}`),Po();const n=await re.readFile(ce,"utf8"),t={...e,...JSON.parse(n)},r=t?.settings?.thinkingVerbs;r?.punctuation&&(r.format="{}"+r.punctuation,delete r.punctuation),t.settings.inputBox||(t.settings.inputBox=ee.inputBox),t.settings.toolsets||(t.settings.toolsets=ee.toolsets),Object.hasOwn(t.settings,"defaultToolset")||(t.settings.defaultToolset=ee.defaultToolset),Object.hasOwn(t.settings,"planModeToolset")||(t.settings.planModeToolset=ee.planModeToolset);for(const o of ee.themes){const l=t?.settings?.themes.find(c=>c.id===o.id||c.name===o.name);if(l){for(const[c,u]of Object.entries(o))c!=="colors"&&!Object.hasOwn(l,c)&&(l[c]=u);l.colors||(l.colors={});for(const[c,u]of Object.entries(o.colors))Object.hasOwn(l.colors,c)||(l.colors[c]=u)}}for(const o of t?.settings?.themes||[]){if(ee.themes.some(u=>u.id===o.id||u.name===o.name))continue;const c=ee.themes[0];o.colors||(o.colors={});for(const[u,d]of Object.entries(c.colors))Object.hasOwn(o.colors,u)||(o.colors[u]=d)}return t?.settings?.userMessageDisplay||(t.settings=t.settings||ee,t.settings.userMessageDisplay=ee.userMessageDisplay),ko(t),delete t.settings.launchText,await wr(Se)&&(t.changesApplied=!1),ke=t,t}catch(n){if(n instanceof Error&&"code"in n&&n.code==="ENOENT")return e;throw n}},Ne=async e=>(M(`Updating config at ${ce}`),!ke&&(ke=await He()),e(ke),ke.lastModified=new Date().toISOString(),await Ao(ke),ke),Ao=async e=>{try{e.lastModified=new Date().toISOString(),await rt(),await re.writeFile(ce,JSON.stringify(e,null,2))}catch(n){throw console.error("Error saving config:",n),n}},Oo=({children:e,...n})=>h(a,{bold:!0,backgroundColor:"#ffd500",color:"#000",...n,children:[" ",e," "]});var fe=Oo;const Do=["\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"],Lo=()=>h(m,{flexDirection:"row",height:10,alignItems:"center",borderStyle:"bold",borderBottom:!1,borderTop:!1,borderRight:!1,borderColor:"#ff8400",marginBottom:1,children:[h(m,{marginBottom:1,paddingLeft:1,flexDirection:"column",flexGrow:1,children:[s(a,{bold:!0,color:"#ff8400",children:"Piebald is released!"}),s(a,{children:" "}),h(a,{children:["We've released ",s(a,{bold:!0,children:"Piebald"}),", the ultimate agentic AI developer experience."]}),h(a,{children:["Download it and try it out for free!"," ",s(wt,{url:"https://piebald.ai/",fallback:!1,children:s(a,{color:"#ff8400",children:"https://piebald.ai/"})})]}),s(a,{children:" "}),s(a,{dimColor:!0,color:"gray",children:"press 'h' to hide"})]}),s(m,{width:22,flexShrink:0,flexDirection:"column",alignItems:"center",children:Do.map((e,n)=>s(a,{children:e},n))})]});var Ro=Lo;let Z=function(e){return e.APPLY_CHANGES="*Apply customizations",e.THEMES="Themes",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.MISC="Misc",e.TOOLSETS="Toolsets",e.VIEW_SYSTEM_PROMPTS="View system prompts",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves config.json)",e.OPEN_CONFIG="Open config.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});function Vo({items:e,selectedIndex:n,onSelect:t,onSubmit:r}){return de((i,o)=>{o.upArrow?t(n>0?n-1:e.length-1):o.downArrow?t(n<e.length-1?n+1:0):o.return&&r(e[n].name)}),s(m,{flexDirection:"column",children:e.map((i,o)=>s(m,{children:h(a,{children:[h(a,{bold:o===n,color:o===n?"cyan":void 0,...o===n?i.selectedStyles??{}:i.styles??{},children:[o===n?"❯ ":" ",i.name]}),i.desc&&o===n&&h(a,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",i.desc]})]})},o))})}const Fo=[{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.MISC,desc:"Miscellaneous settings (input box border, etc.)"},{name:Z.TOOLSETS,desc:"Manage toolsets to control which tools are available"},{name:Z.VIEW_SYSTEM_PROMPTS,desc:"Opens the system prompts directory where you can customize Claude Code's system prompts"}],jo=[{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 (${ce})`},{name:Z.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:Z.EXIT,desc:"Bye!"}],Uo=({onSubmit:e})=>{const t=[...pe(he).changesApplied?[]:[{name:Z.APPLY_CHANGES,desc:"Required: Updates Claude Code in-place with your changes",selectedStyles:{color:"green"}}],...Fo,...jo],[r,i]=B(0);return s(Vo,{items:t,selectedIndex:r,onSelect:i,onSubmit:o=>e(o)})};var Ho=Uo;const Go=()=>h(m,{flexDirection:"row",children:[s(fe,{children:"tweakcc"}),s(a,{children:" (by "}),s(wt,{url:"https://piebald.ai",fallback:!1,children:s(a,{color:"#ff8400",bold:!0,children:"Piebald"})}),s(a,{children:")"})]}),Yo=()=>s(m,{children:h(a,{color:"yellow",children:["⭐ ",s(a,{bold:!0,children:"Star the repo at "}),s(wt,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:s(a,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),s(a,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),Wo=({notification:e})=>s(m,{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:s(a,{color:e.type==="success"?"green":e.type==="error"?"red":e.type==="info"?"blue":"yellow",children:e.message})}),zo=({onSubmit:e,notification:n,configMigrated:t,showPiebaldAnnouncement:r})=>h(m,{flexDirection:"column",gap:1,children:[t&&s(m,{children:s(a,{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."})}),s(Go,{}),s(m,{children:h(a,{children:[s(a,{bold:!0,children:"Customize your Claude Code installation."})," ",h(a,{dimColor:!0,children:["Settings will be saved to ",se.replace(Re.homedir(),"~"),"/config.json."]})]})}),r?s(Ro,{}):s(Yo,{}),n&&s(Wo,{notification:n}),s(Ho,{onSubmit:e})]});function H({color:e,backgroundColor:n,bold:t,dimColor:r,children:i}){const o=e?.startsWith("ansi:"),l=n?.startsWith("ansi:");if(o||l){if(st.Children.toArray(i).some(f=>st.isValidElement(f)))return s(a,{children:i});let u=F;if(o){const f=e.slice(5);u=u[f]||u}if(l){const f=n.slice(5),x=f.startsWith("bg")?f:`bg${f.charAt(0).toUpperCase()}${f.slice(1)}`;u=u[x]||u}t&&(u=u.bold),r&&(u=u.dim);const g=st.Children.toArray(i).map(f=>typeof f=="string"||typeof f=="number"?String(f):"").join("");return s(a,{children:u(g)})}return s(a,{color:e,backgroundColor:n,bold:t,dimColor:r,children:i})}function Jo({text:e,nonShimmerColors:n,shimmerColors:t,shimmerWidth:r=3,updateDuration:i=50,restartPoint:o=10}){const[l,c]=B(0);return xe(()=>{const u=setInterval(()=>{c(d=>{const g=d+1;return g>=e.length+o?-r:g})},i);return()=>clearInterval(u)},[e.length,o,i]),n.length!==t.length?(console.error("UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length"),s(a,{children:e})):s(a,{children:e.split("").map((u,d)=>{const g=d>=l&&d<l+r&&l<e.length,f=d%n.length,x=g?t[f]:n[f];return s(a,{color:x,children:u},d)})})}const Xo=_n.cwd();function an({theme:e}){const{ccVersion:n}=pe(he);return h(m,{flexDirection:"column",paddingLeft:1,children:[s(m,{marginBottom:1,children:h(a,{bold:!0,children:["Preview: ",e.name]})}),s(m,{borderStyle:"single",borderColor:"gray",paddingX:1,children:h(m,{flexDirection:"column",children:[h(m,{flexDirection:"column",children:[h(a,{children:[s(H,{color:e.colors.clawd_body,children:" ▐"}),s(a,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"▛███▜"}),h(a,{children:[s(H,{color:e.colors.clawd_body,children:"▌ "})," ",s(a,{bold:!0,children:"Claude Code"})," ",n?`v${n}`:"v2.0.14"]})]}),h(a,{children:[s(H,{color:e.colors.clawd_body,children:"▝▜"}),s(a,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"█████"}),s(H,{color:e.colors.clawd_body,children:"▛▘"})," ",Io()," · ",_o()]}),h(H,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",Xo]}),h(a,{children:[h(H,{color:e.colors.success,children:["Login successful. Press"," "]}),s(H,{bold:!0,color:e.colors.success,children:"Enter"}),h(H,{color:e.colors.success,children:[" ","to continue…"]})]})]}),s(a,{children:"╭─────────────────────────────────────────────╮"}),h(a,{children:["│ 1 function greet() ","{"," ","│"]}),h(a,{children:["│ 2"," ",s(H,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:'- console.log("'}),s(H,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),s(H,{backgroundColor:e.colors.diffRemoved,children:'");'})," ","│"]}),h(a,{children:["│ 2"," ",s(H,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:'+ console.log("'}),s(H,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),s(H,{backgroundColor:e.colors.diffAdded,children:'");'})," ","│"]}),s(H,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),h(H,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),h(a,{children:[s(H,{color:e.colors.warning,children:"│ "}),s(a,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),h(H,{color:e.colors.warning,children:[" ","│"]})]}),s(H,{color:e.colors.bashBorder,children:"───────────────────────────────────────────────"}),h(a,{children:[s(H,{color:e.colors.bashBorder,children:"!"}),s(a,{children:" ls"})]}),s(H,{color:e.colors.promptBorder,children:"───────────────────────────────────────────────"}),s(a,{children:h(a,{children:["> list the dir"," ",s(Jo,{text:"ultrathink",nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),s(H,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),h(a,{children:[s(H,{color:e.colors.planMode,children:"│ "}),h(H,{color:e.colors.permission,children:["Ready to code?"," "]}),s(a,{children:"Here is Claude's plan:"}),h(H,{color:e.colors.planMode,children:[" ","│"]})]}),s(H,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),h(a,{children:[s(H,{color:e.colors.permission,children:"│ "}),s(a,{bold:!0,children:"Permissions:"})," ",h(H,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",s(H,{color:e.colors.permission,children:"│"})]}),s(a,{children:"> list the dir"}),h(a,{children:[s(H,{color:e.colors.error,children:"●"}),s(a,{children:" Update(__init__.py)"})]}),h(a,{children:[s(a,{children:" ⎿ "}),s(H,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),h(a,{children:[" ","1"," ",h(H,{backgroundColor:e.colors.diffRemovedDimmed,children:["- import"," "]}),s(H,{backgroundColor:e.colors.diffRemovedWordDimmed,children:"os"})]}),h(a,{children:[" ","2"," ",h(H,{backgroundColor:e.colors.diffAddedDimmed,children:["+ import"," "]}),s(H,{backgroundColor:e.colors.diffAddedWordDimmed,children:"random"})]}),h(a,{children:[s(H,{color:e.colors.success,children:"●"}),s(a,{children:" List(.)"})]}),h(a,{children:[s(a,{children:"●"}),s(a,{children:" The directory "}),s(H,{color:e.colors.permission,children:"C:\\Users\\user"}),h(a,{children:[" ","contains ",s(a,{bold:!0,children:"123"})," files."]})]}),h(a,{children:[s(H,{color:e.colors.claude,children:"✻ Th"}),s(H,{color:e.colors.claudeShimmer,children:"ink"}),s(H,{color:e.colors.claude,children:"ing… "}),s(a,{children:"(esc to interrupt)"})]}),s(a,{children:s(H,{color:e.colors.autoAccept,children:"⏵⏵ accept edits on (shift+tab to cycle)"})}),s(a,{children:s(H,{color:e.colors.planMode,children:"⏸ plan mode on (shift+tab to cycle)"})}),s(a,{children:s(H,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function at({colorKey:e,theme:n,bold:t=!1}){const r=n.colors[e];return e==="inverseText"?s(H,{color:r,backgroundColor:n.colors.permission,bold:t,children:e}):e.startsWith("diff")?s(H,{backgroundColor:r,bold:t,color:n.colors.text,children:e}):s(H,{color:r,bold:t,children:e})}function cn({initialValue:e,onColorChange:n,onExit:t,colorKey:r,theme:i}){const o=dt(e)||{h:0,s:50,l:50},l=ct(e)||{r:128,g:128,b:128},[c,u]=B(o),[d,g]=B(l),[f,x]=B("hsl"),[w,p]=B("h"),[b,I]=B(!1),[T,S]=B(!1);xe(()=>{const _=dt(e),y=ct(e);_&&y&&(I(!0),u(_),g(y),I(!1))},[e]),xe(()=>{if(!b&&T){const _=`rgb(${d.r},${d.g},${d.b})`;n(_)}},[c,d,b,T]),xe(()=>{S(!0)},[]);const E=_=>{if($t(_)){const y=ln(_),C=dt(y),A=ct(y);C&&A&&(I(!0),u(C),g(A),I(!1))}};de((_,y)=>{if(_.length>1&&!y.ctrl&&!y.meta){E(_);return}if(y.return)t();else if(y.escape)t();else if(y.ctrl&&_==="a")x(C=>C==="hsl"?"rgb":"hsl"),p(C=>f==="hsl"?C==="h"?"r":C==="s"?"g":"b":C==="r"?"h":C==="g"?"s":"l");else if(y.upArrow)p(f==="hsl"?C=>C==="h"?"l":C==="s"?"h":"s":C=>C==="r"?"b":C==="g"?"r":"g");else if(y.downArrow||y.tab)p(f==="hsl"?C=>C==="h"?"s":C==="s"?"l":"h":C=>C==="r"?"g":C==="g"?"b":"r");else if(y.leftArrow){const C=y.shift||y.ctrl||y.meta?-10:-1;V(C)}else if(y.rightArrow){const C=y.shift||y.ctrl||y.meta?10:1;V(C)}});const V=_=>{I(!0),f==="hsl"?u(y=>{const C={...y};w==="h"?C.h=Math.max(0,Math.min(359,y.h+_)):w==="s"?C.s=Math.max(0,Math.min(100,y.s+_)):w==="l"&&(C.l=Math.max(0,Math.min(100,y.l+_)));const[A,v,U]=R(C.h,C.s,C.l);return g({r:A,g:v,b:U}),C}):g(y=>{const C={...y};w==="r"?C.r=Math.max(0,Math.min(255,y.r+_)):w==="g"?C.g=Math.max(0,Math.min(255,y.g+_)):w==="b"&&(C.b=Math.max(0,Math.min(255,y.b+_)));const A=O(C.r,C.g,C.b);return u(A),C}),I(!1)},O=(_,y,C)=>{const A=_/255,v=y/255,U=C/255,q=Math.max(A,v,U),K=Math.min(A,v,U),te=q-K,ie=(q+K)/2;let be=0;te!==0&&(be=ie>.5?te/(2-q-K):te/(q+K));let ye=0;return te!==0&&(q===A?ye=((v-U)/te+(v<U?6:0))/6:q===v?ye=((U-A)/te+2)/6:ye=((A-v)/te+4)/6),{h:Math.round(ye*360),s:Math.round(be*100),l:Math.round(ie*100)}},R=(_,y,C)=>{_/=360,y/=100,C/=100;const A=(1-Math.abs(2*C-1))*y,v=A*(1-Math.abs(_*6%2-1)),U=C-A/2;let q=0,K=0,te=0;return 0<=_&&_<1/6?(q=A,K=v,te=0):1/6<=_&&_<2/6?(q=v,K=A,te=0):2/6<=_&&_<3/6?(q=0,K=A,te=v):3/6<=_&&_<4/6?(q=0,K=v,te=A):4/6<=_&&_<5/6?(q=v,K=0,te=A):5/6<=_&&_<1&&(q=A,K=0,te=v),[Math.round((q+U)*255),Math.round((K+U)*255),Math.round((te+U)*255)]},D=()=>{const _=[],y=[[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 C=0;C<40;C++){const v=C/39*(y.length-1),U=Math.floor(v),q=Math.ceil(v),K=v-U,[te,ie,be]=y[U],[ye,Ge,ot]=y[q],Ye=Math.round(te+(ye-te)*K),P=Math.round(ie+(Ge-ie)*K),it=Math.round(be+(ot-be)*K);_.push(s(a,{backgroundColor:`rgb(${Ye},${P},${it})`,children:" "},C))}return _},J=()=>{const _=[];for(let y=0;y<40;y++){const C=y/39*100,[A,v,U]=R(c.h,C,c.l);_.push(s(a,{backgroundColor:`rgb(${A},${v},${U})`,children:" "},y))}return _},k=()=>{const _=[];for(let y=0;y<40;y++){const C=y/39*100,[A,v,U]=R(c.h,c.s,C);_.push(s(a,{backgroundColor:`rgb(${A},${v},${U})`,children:" "},y))}return _},N=()=>{const[_,y,C]=R(c.h,c.s,c.l);return`rgb(${_},${y},${C})`},$=(_,y,C)=>{const A=v=>v.toString(16).padStart(2,"0");return`#${A(_)}${A(y)}${A(C)}`},z=()=>{const _=[];for(let y=0;y<40;y++){const C=Math.round(y/39*255);_.push(s(a,{backgroundColor:`rgb(${C},${d.g},${d.b})`,children:" "},y))}return _},W=()=>{const _=[];for(let y=0;y<40;y++){const C=Math.round(y/39*255);_.push(s(a,{backgroundColor:`rgb(${d.r},${C},${d.b})`,children:" "},y))}return _},X=()=>{const _=[];for(let y=0;y<40;y++){const C=Math.round(y/39*255);_.push(s(a,{backgroundColor:`rgb(${d.r},${d.g},${C})`,children:" "},y))}return _},G=(_,y)=>Math.round(_/y*39);return h(m,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[h(m,{flexDirection:"column",children:[s(a,{bold:!0,children:"Color Picker"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),s(a,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),s(a,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),s(a,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),s(a,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),s(a,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),f==="hsl"?h($e,{children:[h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="h"?"yellow":"white",children:[w==="h"?"❯ ":" ","Hue (",c.h,"°):"]})}),s(m,{children:D().map((_,y)=>s(Be,{children:y===G(c.h,360)?s(a,{children:"|"}):_},y))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="s"?"yellow":"white",children:[w==="s"?"❯ ":" ","Saturation (",c.s,"%):"]})}),s(m,{children:J().map((_,y)=>s(Be,{children:y===G(c.s,100)?s(a,{children:"|"}):_},y))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="l"?"yellow":"white",children:[w==="l"?"❯ ":" ","Lightness (",c.l,"%):"]})}),s(m,{children:k().map((_,y)=>s(Be,{children:y===G(c.l,100)?s(a,{children:"|"}):_},y))})]})]}):h($e,{children:[h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="r"?"yellow":"white",children:[w==="r"?"❯ ":" ","Red (",d.r,"):"]})}),s(m,{children:z().map((_,y)=>s(Be,{children:y===G(d.r,255)?s(a,{children:"|"}):_},y))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="g"?"yellow":"white",children:[w==="g"?"❯ ":" ","Green (",d.g,"):"]})}),s(m,{children:W().map((_,y)=>s(Be,{children:y===G(d.g,255)?s(a,{children:"|"}):_},y))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="b"?"yellow":"white",children:[w==="b"?"❯ ":" ","Blue (",d.b,"):"]})}),s(m,{children:X().map((_,y)=>s(Be,{children:y===G(d.b,255)?s(a,{children:"|"}):_},y))})]})]}),h(m,{marginBottom:1,children:[s(a,{children:"Current: "}),s(a,{backgroundColor:N(),children:" "})]}),h(m,{flexDirection:"row",justifyContent:"space-between",children:[h(m,{flexDirection:"column",children:[s(a,{dimColor:!0,children:"Hex "}),r?.startsWith("diff")?s(a,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:$(d.r,d.g,d.b)}):r==="inverseText"?s(a,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:$(d.r,d.g,d.b)}):s(a,{color:N(),bold:!0,children:$(d.r,d.g,d.b)})]}),h(m,{flexDirection:"column",children:[s(a,{dimColor:!0,children:"RGB "}),r?.startsWith("diff")?s(a,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):r==="inverseText"?s(a,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):s(a,{color:N(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),h(m,{flexDirection:"column",children:[s(a,{dimColor:!0,children:"HSL "}),r?.startsWith("diff")?s(a,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):r==="inverseText"?s(a,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):s(a,{color:N(),bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`})]})]})]})}function ct(e){const n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n)return{r:parseInt(n[1]),g:parseInt(n[2]),b:parseInt(n[3])};const t=e.match(/^#([a-fA-F0-9]{6})$/);if(t){const r=t[1];return{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16)}}return null}function dt(e){const n=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n)return{h:parseInt(n[1]),s:parseInt(n[2]),l:parseInt(n[3])};const t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t){const i=parseInt(t[1])/255,o=parseInt(t[2])/255,l=parseInt(t[3])/255,c=Math.max(i,o,l),u=Math.min(i,o,l),d=c-u,g=(c+u)/2;let f=0;d!==0&&(f=g>.5?d/(2-c-u):d/(c+u));let x=0;return d!==0&&(c===i?x=((o-l)/d+(o<l?6:0))/6:c===o?x=((l-i)/d+2)/6:x=((i-o)/d+4)/6),{h:Math.round(x*360),s:Math.round(f*100),l:Math.round(g*100)}}const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const i=r[1],o=parseInt(i.substr(0,2),16)/255,l=parseInt(i.substr(2,2),16)/255,c=parseInt(i.substr(4,2),16)/255,u=Math.max(o,l,c),d=Math.min(o,l,c),g=u-d,f=(u+d)/2;let x=0;g!==0&&(x=f>.5?g/(2-u-d):g/(u+d));let w=0;return g!==0&&(u===o?w=((l-c)/g+(l<c?6:0))/6:u===l?w=((c-o)/g+2)/6:w=((o-l)/g+4)/6),{h:Math.round(w*360),s:Math.round(x*100),l:Math.round(f*100)}}return{h:0,s:50,l:50}}function qo({onBack:e,themeId:n}){const{settings:{themes:t},updateSettings:r}=pe(he),[i,o]=B(n),l=t.find(k=>k.id===i)||t[0],[c,u]=B("rgb"),[d,g]=B(0),[f,x]=B(null),[w,p]=B(null),[b,I]=B(""),[T,S]=B(""),E=Lt(k=>{r(N=>{const $=N.themes.findIndex(z=>z.id===i);$!==-1&&k(N.themes[$])})},[i,r]),V=k=>{if(d>=2&&$t(k)){const N=ln(k),$=d-2,z=O[$];E(W=>{W.colors[z]=N})}};de((k,N)=>{if(f===null&&w===null){if(k.length>1&&!N.ctrl&&!N.meta){V(k);return}if(N.escape)e();else if(N.ctrl&&k==="a")u($=>$==="rgb"?"hex":$==="hex"?"hsl":"rgb");else if(N.upArrow)g($=>Math.max(0,$-1));else if(N.downArrow)g($=>Math.min(O.length+1,$+1));else if(N.return)if(d===0)p("name"),I(l.name),S(l.name);else if(d===1)p("id"),I(l.id),S(l.id);else{const $=d-2,z=O[$],W=l.colors[z];x($),I(W),S(W)}}else if(f!==null)N.ctrl&&k==="a"&&u($=>$==="rgb"?"hex":$==="hex"?"hsl":"rgb");else if(w!==null)if(N.return){if(w==="id"){const $=i;o(b),r(z=>{const W=z.themes.findIndex(X=>X.id===$);W!==-1&&(z.themes[W].id=b)})}else E($=>{$.name=b});p(null),I(""),S("")}else N.escape?(p(null),I(""),S("")):N.backspace||N.delete?I($=>$.slice(0,-1)):k&&I($=>$+k)});const O=Object.keys(l.colors),R=(k,N)=>{const $=k.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!$)return k;const z=parseInt($[1]),W=parseInt($[2]),X=parseInt($[3]);switch(N){case"hex":{const G=_=>_.toString(16).padStart(2,"0");return`#${G(z)}${G(W)}${G(X)}`}case"hsl":{const G=z/255,_=W/255,y=X/255,C=Math.max(G,_,y),A=Math.min(G,_,y),v=C-A,U=(C+A)/2;let q=0;v!==0&&(q=U>.5?v/(2-C-A):v/(C+A));let K=0;return v!==0&&(C===G?K=((_-y)/v+(_<y?6:0))/6:C===_?K=((y-G)/v+2)/6:K=((G-_)/v+4)/6),`hsl(${Math.round(K*360)}, ${Math.round(q*100)}%, ${Math.round(U*100)}%)`}case"rgb":default:return k}},D=k=>({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"})[k]||"",J=Math.max(...O.map(k=>k.length));return h(m,{children:[h(m,{flexDirection:"column",width:"50%",children:[s(m,{children:h(fe,{children:["Editing theme “",l.name,"” (",l.id,")"]})}),f===null&&w===null?h($e,{children:[h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{dimColor:!0,children:"enter to edit theme name, id, or color"}),s(a,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),s(a,{dimColor:!0,children:"paste color from clipboard (when on color)"}),s(a,{dimColor:!0,children:"esc to go back"})]}),d<2?h(m,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[s(a,{bold:!0,children:d===0?"Theme Name":"Theme ID"}),s(a,{children:d===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):h(m,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:l.colors[O[d-2]],flexDirection:"column",paddingLeft:1,children:[s(at,{colorKey:O[d-2],theme:l,bold:!0}),s(a,{children:D(O[d-2])})]}),h(m,{flexDirection:"column",children:[h(m,{children:[s(a,{color:d===0?"yellow":"white",children:d===0?"❯ ":" "}),s(a,{bold:!0,children:"Name: "}),s(a,{children:l.name})]}),h(m,{marginBottom:1,children:[s(a,{color:d===1?"yellow":"white",children:d===1?"❯ ":" "}),s(a,{bold:!0,children:"ID: "}),s(a,{children:l.id})]}),(()=>{if(d<2){const G=O.slice(0,20);return h($e,{children:[G.map((_,y)=>{const C=y+2;return h(m,{children:[s(a,{color:d===C?"yellow":"white",children:d===C?"❯ ":" "}),s(m,{width:J+2,children:s(a,{children:s(at,{colorKey:_,theme:l,bold:!0})})}),s(H,{color:l.colors[_],children:R(l.colors[_],c)})]},_)}),O.length>20&&h(a,{color:"gray",dimColor:!0,children:[" ","↓ ",O.length-20," more below"]})]})}const N=d-2,$=Math.max(0,N-Math.floor(20/2)),z=Math.min(O.length,$+20),W=Math.max(0,z-20),X=O.slice(W,z);return h($e,{children:[W>0&&h(a,{color:"gray",dimColor:!0,children:[" ","↑ ",W," more above"]}),X.map((G,_)=>{const C=W+_+2;return h(m,{children:[s(a,{color:d===C?"yellow":"white",children:d===C?"❯ ":" "}),s(m,{width:J+2,children:s(a,{children:s(at,{colorKey:G,theme:l,bold:!0})})}),s(H,{color:l.colors[G],children:R(l.colors[G],c)})]},G)}),z<O.length&&h(a,{color:"gray",dimColor:!0,children:[" ","↓ ",O.length-z," more below"]})]})})()]})]}):w?h(m,{flexDirection:"column",marginTop:1,children:[h(a,{children:["Editing ",w==="name"?"theme name":"theme ID",":"]}),s(m,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:s(a,{children:b})}),s(a,{dimColor:!0,children:"enter to save, esc to cancel"})]}):s(cn,{initialValue:T,colorKey:O[f],theme:l,onColorChange:k=>{I(k),E(N=>{N.colors[O[f]]=k})},onExit:()=>{E(k=>{k.colors[O[f]]=b}),x(null),I(""),S("")}})]}),s(m,{width:"50%",children:s(an,{theme:l})})]})}function Ko(e){return e.map(n=>`${n.name} (${n.id})`)}function Qo({onBack:e}){const{settings:{themes:n},updateSettings:t}=pe(he),[r,i]=B(0),[o,l]=B(null),[c,u]=B(!0),d=()=>{const b={colors:{...(n[0]||ee.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};t(I=>{I.themes.push(b)}),l(b.id),u(!1)},g=p=>{n.length<=1||(t(b=>{b.themes=b.themes.filter(I=>I.id!==p)}),r>=n.length-1&&i(Math.max(0,n.length-2)))},f=()=>{t(p=>{p.themes=[...ee.themes]}),i(0)};if(de((p,b)=>{if(b.escape)e();else if(b.upArrow)i(I=>Math.max(0,I-1));else if(b.downArrow)i(I=>Math.min(n.length-1,I+1));else if(b.return){const I=n[r];I&&(l(I.id),u(!1))}else if(p==="n")d();else if(p==="d"){const I=n[r];I&&g(I.id)}else b.ctrl&&p==="r"&&f()},{isActive:c}),o)return s(qo,{themeId:o,onBack:()=>{l(null),u(!0)}});const x=Ko(n),w=n.find(p=>x[r]?.includes(`(${p.id})`))||n[0];return n.length===0?s(m,{children:h(m,{flexDirection:"column",width:"100%",children:[s(fe,{children:"Themes"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{dimColor:!0,children:"n to create a new theme"}),s(a,{dimColor:!0,children:"esc to go back"})]}),s(a,{children:"No themes available!"})]})}):h(m,{children:[h(m,{flexDirection:"column",width:"50%",children:[s(fe,{children:"Themes"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{dimColor:!0,children:"n to create a new theme"}),s(a,{dimColor:!0,children:"d to delete a theme"}),s(a,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),s(a,{dimColor:!0,children:"enter to edit theme"}),s(a,{dimColor:!0,children:"esc to go back"})]}),s(m,{flexDirection:"column",children:x.map((p,b)=>h(a,{color:r===b?"yellow":void 0,children:[r===b?"❯ ":" ",p]},b))})]}),s(m,{width:"50%",children:s(an,{theme:w})})]})}function Zo({onBack:e}){const{settings:{thinkingVerbs:{format:n,verbs:t},themes:r},updateSettings:i}=pe(he),o=["format","verbs"],[l,c]=B(0),u=o[l],[d,g]=B(0),[f,x]=B(!1),[w,p]=B(""),[b,I]=B(!1),[T,S]=B(!1),[E,V]=B(n),O=nt(),D=(r.find(k=>k.id===O)||r.find(k=>k.id==="dark"))?.colors.claude||"rgb(215,119,87)";de((k,N)=>{if(T){N.return?(i($=>{$.thinkingVerbs.format=E}),S(!1)):N.escape?(V(n),S(!1)):N.backspace||N.delete?V($=>$.slice(0,-1)):k&&V($=>$+k);return}if(f||b){N.return&&w.trim()?(b?(i($=>{$.thinkingVerbs.verbs.push(w.trim())}),I(!1)):(i($=>{$.thinkingVerbs.verbs[d]=w.trim()}),x(!1)),p("")):N.escape?(p(""),x(!1),I(!1)):N.backspace||N.delete?p($=>$.slice(0,-1)):k&&p($=>$+k);return}N.escape?e():N.return?u==="format"&&(V(n),S(!0)):N.tab?N.shift?c($=>$===0?o.length-1:$-1):c($=>$===o.length-1?0:$+1):N.upArrow?u==="verbs"&&t.length>0&&g($=>$>0?$-1:t.length-1):N.downArrow?u==="verbs"&&t.length>0&&g($=>$<t.length-1?$+1:0):k==="e"&&u==="verbs"?t.length>0&&(p(t[d]),x(!0)):k==="d"&&u==="verbs"?t.length>1&&(i($=>{$.thinkingVerbs.verbs=$.thinkingVerbs.verbs.filter((z,W)=>W!==d)}),d>=t.length-1&&g(Math.max(0,t.length-2))):k==="n"&&u==="verbs"?(I(!0),p("")):N.ctrl&&k==="r"&&u==="verbs"&&(i($=>{$.thinkingVerbs.verbs=[...ee.thinkingVerbs.verbs]}),g(0))});const J=50;return h(m,{children:[h(m,{flexDirection:"column",width:`${100-J}%`,children:[h(m,{marginBottom:1,flexDirection:"column",children:[s(fe,{children:"Thinking Verbs"}),h(m,{flexDirection:"column",children:[s(a,{dimColor:!0,children:u==="format"?"enter to edit format":"changes auto-saved"}),s(a,{dimColor:!0,children:"esc to go back"}),s(a,{dimColor:!0,children:"tab to switch sections"})]})]}),s(m,{marginBottom:1,children:s(a,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),h(m,{flexDirection:"column",children:[h(a,{children:[s(a,{color:u==="format"?"yellow":void 0,children:u==="format"?"❯ ":" "}),s(a,{bold:!0,color:u==="format"?"yellow":void 0,children:"Format"})]}),u==="format"&&(T?h(a,{dimColor:!0,children:[" ","enter to save"]}):h(a,{dimColor:!0,children:[" ","enter to edit"]}))]}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:T?"yellow":"gray",children:s(a,{children:T?E:n})})}),s(m,{children:h(a,{children:[s(a,{color:u==="verbs"?"yellow":void 0,children:u==="verbs"?"❯ ":" "}),s(a,{bold:!0,color:u==="verbs"?"yellow":void 0,children:"Verbs"})]})}),u==="verbs"&&s(m,{flexDirection:"column",children:h(a,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),s(m,{marginLeft:2,marginBottom:1,children:h(m,{flexDirection:"column",children:[(()=>{const N=Math.max(0,d-Math.floor(4)),$=Math.min(t.length,N+8),z=Math.max(0,$-8),W=t.slice(z,$);return h($e,{children:[z>0&&h(a,{color:"gray",dimColor:!0,children:[" ","↑ ",z," more above"]}),W.map((X,G)=>{const _=z+G;return h(a,{color:u==="verbs"&&_===d?"cyan":void 0,children:[u==="verbs"&&_===d?"❯ ":" ",X]},_)}),$<t.length&&h(a,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-$," more below"]})]})})(),b&&h(m,{alignItems:"center",children:[s(a,{color:"yellow",children:"❯ "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(a,{children:w})})]}),f&&h(m,{marginTop:1,alignItems:"center",children:[s(a,{children:"Editing: "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(a,{children:w})})]})]})})]}),h(m,{width:`${J}%`,flexDirection:"column",children:[s(m,{marginBottom:1,children:s(a,{bold:!0,children:"Preview"})}),s(m,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:h(a,{children:[h(a,{color:D,children:["✻ ",n.replace(/\{\}/g,t[d])," "]}),s(a,{children:"(esc to interrupt)"})]})})]})]})}const Ee=[{name:"Default",phases:ee.thinkingStyle.phases,reverseMirror:ee.thinkingStyle.reverseMirror},{name:"Basic",phases:["|","/","-","\\"],reverseMirror:!1},{name:"Braille",phases:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],reverseMirror:!1},{name:"Circle",phases:["◐","◓","◑","◒"],reverseMirror:!1},{name:"Wave",phases:["▁","▃","▄","▅","▆","▇","█"],reverseMirror:!0},{name:"Glow",phases:["░","▒","▓","█"],reverseMirror:!0},{name:"Partial block",phases:["▏","▎","▍","▌","▋","▊","▉","█"],reverseMirror:!0},{name:"Clock",phases:["🕛","🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚"],reverseMirror:!1},{name:"Globe",phases:["🌍","🌎","🌏"],reverseMirror:!1},{name:"Arc",phases:["◜","◠","◝","◞","◡","◟"],reverseMirror:!1},{name:"Triangle",phases:["◤","◥","◢","◣"],reverseMirror:!1},{name:"Bouncing",phases:["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"],reverseMirror:!1},{name:"Dots",phases:[".","..","..."],reverseMirror:!1},{name:"Colors",phases:["🔴","🟠","🟡","🟢","🔵","🟣"],reverseMirror:!1}];function ei({onBack:e}){const{settings:{thinkingStyle:{phases:n,updateInterval:t,reverseMirror:r},themes:i},updateSettings:o}=pe(he),l=["reverseMirror","updateInterval","phases","presets"],[c,u]=B(0),d=l[c],[g,f]=B(0),[x,w]=B(0),[p,b]=B(!1),[I,T]=B(""),[S,E]=B(!1),[V,O]=B(!1),[R,D]=B(t.toString()),[J,k]=B(0),N=nt(),z=(i.find(C=>C.id===N)||i.find(C=>C.id==="dark"))?.colors.claude||"rgb(215,119,87)";xe(()=>{if(n.length>0){const C=r?[...n,...[...n].reverse().slice(1,-1)]:n,A=setInterval(()=>{k(v=>(v+1)%C.length)},t);return()=>clearInterval(A)}},[n,t,r]),de((C,A)=>{if(V){if(A.return){const v=parseInt(R);!isNaN(v)&&v>0&&o(U=>{U.thinkingStyle.updateInterval=v}),O(!1)}else A.escape?(D(t.toString()),O(!1)):A.backspace||A.delete?D(v=>v.slice(0,-1)):C&&C.match(/^[0-9]$/)&&D(v=>v+C);return}if(p||S){if(A.return&&I.length){const v=S?[...n,I]:n.map((U,q)=>q===g?I:U);o(U=>{U.thinkingStyle.phases=v}),b(!1),T("")}else A.escape?(T(""),b(!1),E(!1)):A.backspace||A.delete?T(v=>v.slice(0,-1)):C&&T(v=>v+C);return}if(A.escape)e();else if(A.return)if(d==="updateInterval")D(t.toString()),O(!0);else if(d==="presets"){const v=Ee[x];o(U=>{U.thinkingStyle.phases=[...v.phases],U.thinkingStyle.reverseMirror=v.reverseMirror})}else d==="reverseMirror"&&o(v=>{v.thinkingStyle.reverseMirror=!v.thinkingStyle.reverseMirror});else if(A.tab)A.shift?u(v=>v===0?l.length-1:v-1):u(v=>v===l.length-1?0:v+1);else if(A.upArrow)d==="phases"&&n.length>0?f(v=>v>0?v-1:n.length-1):d==="presets"&&w(v=>v>0?v-1:Ee.length-1);else if(A.downArrow)d==="phases"&&n.length>0?f(v=>v<n.length-1?v+1:0):d==="presets"&&w(v=>v<Ee.length-1?v+1:0);else if(C===" ")d==="reverseMirror"&&o(v=>{v.thinkingStyle.reverseMirror=!v.thinkingStyle.reverseMirror});else if(C==="e"&&d==="phases")n.length>0&&(T(n[g]),b(!0));else if(C==="a"&&d==="phases")E(!0),T("");else if(C==="d"&&d==="phases")n.length>1&&(o(v=>{v.thinkingStyle.phases=n.filter((U,q)=>q!==g)}),g>=n.length&&f(Math.max(0,n.length-1)));else if(C==="w"&&d==="phases"){if(g>0){const v=[...n];[v[g-1],v[g]]=[v[g],v[g-1]],o(U=>{U.thinkingStyle.phases=v}),f(U=>U-1)}}else if(C==="s"&&d==="phases"){if(g<n.length-1){const v=[...n];[v[g],v[g+1]]=[v[g+1],v[g]],o(U=>{U.thinkingStyle.phases=v}),f(U=>U+1)}}else A.ctrl&&C==="r"&&(o(v=>{v.thinkingStyle=ee.thinkingStyle}),f(0),w(0))});const W=r?"●":"○",X=50,_=r?[...n,...[...n].reverse().slice(1,-1)]:n,y=_.length>0?_[J]:"·";return s(m,{children:h(m,{flexDirection:"column",width:"100%",children:[h(m,{flexDirection:"row",width:"100%",children:[h(m,{marginBottom:1,flexDirection:"column",width:`${100-X}%`,children:[s(fe,{children:"Thinking style"}),h(m,{flexDirection:"column",children:[h(a,{dimColor:!0,children:["enter to"," ",d==="updateInterval"?"edit interval":d==="presets"?"apply preset":"save"]}),s(a,{dimColor:!0,children:"esc to go back"}),s(a,{dimColor:!0,children:"tab to switch sections"})]})]}),h(m,{width:`${X}%`,flexDirection:"column",children:[s(m,{children:s(a,{bold:!0,children:"Preview"})}),h(m,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[s(m,{width:(y?.length??0)+1,children:s(a,{color:z,children:y})}),h(a,{children:[s(a,{color:z,children:"Thinking… "}),s(a,{children:"(esc to interrupt)"})]})]})]})]}),h(m,{flexDirection:"row",gap:4,children:[h(m,{flexDirection:"column",children:[h(a,{children:[s(a,{color:d==="reverseMirror"?"yellow":void 0,children:d==="reverseMirror"?"❯ ":" "}),s(a,{bold:!0,color:d==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),d==="reverseMirror"&&h(a,{dimColor:!0,children:[" ","space to toggle"]}),s(m,{marginLeft:2,marginBottom:1,children:h(a,{children:[W," ",r?"Enabled":"Disabled"]})})]}),h(m,{flexDirection:"column",children:[h(a,{children:[s(a,{color:d==="updateInterval"?"yellow":void 0,children:d==="updateInterval"?"❯ ":" "}),s(a,{bold:!0,color:d==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),d==="updateInterval"&&(V?h(a,{dimColor:!0,children:[" ","enter to save"]}):h(a,{dimColor:!0,children:[" ","enter to edit"]})),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:V?"yellow":"gray",children:s(a,{children:V?R:t})})})]})]}),s(m,{children:h(a,{children:[s(a,{color:d==="phases"?"yellow":void 0,children:d==="phases"?"❯ ":" "}),s(a,{bold:!0,color:d==="phases"?"yellow":void 0,children:"Phases"})]})}),d==="phases"&&s(m,{marginBottom:1,flexDirection:"column",children:h(a,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),s(m,{marginLeft:2,marginBottom:1,children:h(m,{flexDirection:"column",children:[(()=>{const A=Math.max(0,g-Math.floor(4)),v=Math.min(n.length,A+8),U=Math.max(0,v-8),q=n.slice(U,v);return h($e,{children:[U>0&&h(a,{color:"gray",dimColor:!0,children:[" ","↑ ",U," more above"]}),q.map((K,te)=>{const ie=U+te;return h(a,{color:d==="phases"&&ie===g?"cyan":void 0,children:[d==="phases"&&ie===g?"❯ ":" ",K]},ie)}),v<n.length&&h(a,{color:"gray",dimColor:!0,children:[" ","↓ ",n.length-v," more below"]})]})})(),S&&h(m,{children:[s(a,{color:"yellow",children:"❯ "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(a,{children:I})})]}),p&&h(m,{marginTop:1,children:[s(a,{children:"Editing: "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(a,{children:I})})]})]})}),s(m,{children:h(a,{children:[s(a,{color:d==="presets"?"yellow":void 0,children:d==="presets"?"❯ ":" "}),s(a,{bold:!0,color:d==="presets"?"yellow":void 0,children:"Presets"})]})}),d==="presets"&&h(a,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{flexDirection:"column",children:(()=>{const A=Math.max(0,x-Math.floor(4)),v=Math.min(Ee.length,A+8),U=Math.max(0,v-8),q=Ee.slice(U,v);return h($e,{children:[U>0&&h(a,{color:"gray",dimColor:!0,children:[" ","↑ ",U," more above"]}),q.map((K,te)=>{const ie=U+te;return h(a,{color:d==="presets"&&ie===x?"cyan":void 0,children:[d==="presets"&&ie===x?"❯ ":" ",K.name," ",K.phases.join("")]},ie)}),v<Ee.length&&h(a,{color:"gray",dimColor:!0,children:[" ","↓ ",Ee.length-v," more below"]})]})})()})}),s(m,{marginTop:1,children:s(a,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}function ti(e,n){const t=$n(!0);xe(()=>{if(t.current){t.current=!1;return}return e()},n)}const ut=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}],ve=[{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 ni({onBack:e}){const{settings:n,updateSettings:t}=pe(he),[r,i]=B(!1),[o,l]=B(!1),[c,u]=B(!1),[d,g]=B(()=>n.userMessageDisplay.format),[f,x]=B(()=>String(n.userMessageDisplay.paddingX)),[w,p]=B(()=>String(n.userMessageDisplay.paddingY)),[b,I]=B(n.userMessageDisplay.fitBoxToContent),[T,S]=B(0),[E,V]=B(()=>[...n.userMessageDisplay.styling]),[O,R]=B(()=>n.userMessageDisplay.foregroundColor==="default"?"default":"custom"),[D,J]=B(()=>n.userMessageDisplay.foregroundColor==="default"?"rgb(255,255,255)":n.userMessageDisplay.foregroundColor),[k,N]=B(()=>{const j=n.userMessageDisplay.backgroundColor;return j===null?"none":j==="default"?"default":"custom"}),[$,z]=B(()=>{const j=n.userMessageDisplay.backgroundColor;return j===null||j==="default"?"rgb(0,0,0)":j}),[W,X]=B(()=>ve.findIndex(j=>j.value===n.userMessageDisplay.borderStyle)),[G,_]=B(()=>n.userMessageDisplay.borderColor),[y,C]=B(null),[A,v]=B(""),U=nt(),q=n.themes?.find(j=>j.id===U)||n.themes?.[0],[K,te]=B("text"),ie=["format","styling","foreground","background"],be=["borderStyle","borderColor","paddingX","paddingY","fitBoxToContent"],[ye,Ge]=B(0),[ot,Ye]=B(0),P=K==="text"?ie[ye]:be[ot],it=()=>{t(j=>{j.userMessageDisplay.format=d,j.userMessageDisplay.styling=[...E],j.userMessageDisplay.foregroundColor=O==="default"?"default":D,j.userMessageDisplay.backgroundColor=k==="none"?null:k==="default"?"default":$,j.userMessageDisplay.borderStyle=ve[W].value,j.userMessageDisplay.borderColor=G,j.userMessageDisplay.paddingX=parseInt(f)||0,j.userMessageDisplay.paddingY=parseInt(w)||0,j.userMessageDisplay.fitBoxToContent=b})},xn=()=>{g(ee.userMessageDisplay.format),V([...ee.userMessageDisplay.styling]),R("default"),J("rgb(255,255,255)"),N("none"),z("rgb(0,0,0)"),X(ve.findIndex(j=>j.value===ee.userMessageDisplay.borderStyle)),_(ee.userMessageDisplay.borderColor),x(String(ee.userMessageDisplay.paddingX)),p(String(ee.userMessageDisplay.paddingY)),I(ee.userMessageDisplay.fitBoxToContent),t(j=>{j.userMessageDisplay={...ee.userMessageDisplay}})};ti(()=>{it()},[d,E,O,D,k,$,W,G,f,w,b]),de((j,Q)=>{if(r){Q.return?i(!1):Q.escape?(g(n.userMessageDisplay.format),i(!1)):Q.backspace||Q.delete?g(L=>L.slice(0,-1)):j&&g(L=>L+j);return}if(o){Q.return?l(!1):Q.escape?(x(String(n.userMessageDisplay.paddingX)),l(!1)):Q.backspace||Q.delete?x(L=>L.slice(0,-1)):j&&/^\d$/.test(j)&&x(L=>L+j);return}if(c){Q.return?u(!1):Q.escape?(p(String(n.userMessageDisplay.paddingY)),u(!1)):Q.backspace||Q.delete?p(L=>L.slice(0,-1)):j&&/^\d$/.test(j)&&p(L=>L+j);return}if(y===null){if(Q.escape)e();else if(Q.ctrl&&j==="r")xn();else if(Q.leftArrow||Q.rightArrow)te(L=>L==="text"?"border":"text");else if(Q.tab)K==="text"?Q.shift?Ge(L=>L===0?ie.length-1:L-1):Ge(L=>L===ie.length-1?0:L+1):Q.shift?Ye(L=>L===0?be.length-1:L-1):Ye(L=>L===be.length-1?0:L+1);else if(Q.return)P==="format"?i(!0):P==="paddingX"?l(!0):P==="paddingY"?u(!0):P==="foreground"?O==="custom"&&(v(D),C("foreground")):P==="background"?k==="custom"&&(v($),C("background")):P==="borderColor"&&(v(G),C("border"));else if(Q.upArrow)P==="styling"?S(L=>Math.max(0,L-1)):P==="borderStyle"?X(L=>L===0?ve.length-1:L-1):P==="foreground"?R(L=>{const ne=L==="default"?"custom":"default";return ne==="custom"&&(!D||D==="")&&J("rgb(255,255,255)"),ne}):P==="background"&&N(L=>{const ne=L==="default"?"custom":L==="custom"?"none":"default";return ne==="custom"&&(!$||$==="")&&z("rgb(0,0,0)"),ne});else if(Q.downArrow)P==="styling"?S(L=>Math.min(ut.length-1,L+1)):P==="borderStyle"?X(L=>L===ve.length-1?0:L+1):P==="foreground"?R(L=>{const ne=L==="default"?"custom":"default";return ne==="custom"&&(!D||D==="")&&J("rgb(255,255,255)"),ne}):P==="background"&&N(L=>{const ne=L==="default"?"none":L==="none"?"custom":"default";return ne==="custom"&&(!$||$==="")&&z("rgb(0,0,0)"),ne});else if(j===" ")if(P==="styling"){const L=ut[T].value,ne=E.indexOf(L)>=0?E.filter(Ie=>Ie!==L):[...E,L];V(ne)}else P==="fitBoxToContent"&&I(L=>!L)}});const Sn=j=>{const Q=O==="default"?q?.colors?.text:D,L=k==="none"?void 0:k==="default"?q?.colors?.userMessageBackground:$,ne=ve[W].value,Ie=parseInt(f)||0,Te=parseInt(w)||0,We=s(a,{bold:E.includes("bold"),italic:E.includes("italic"),underline:E.includes("underline"),strikethrough:E.includes("strikethrough"),inverse:E.includes("inverse"),color:Q,backgroundColor:L,children:j});if(ne==="topBottomSingle"||ne==="topBottomDouble"||ne==="topBottomBold"){const ze=ne==="topBottomSingle"?"─":ne==="topBottomDouble"?"═":"━",Me=j.length+Ie*2,It=ze.repeat(Me);return h(m,{flexDirection:"column",children:[s(a,{color:G,children:It}),Te>0&&s(m,{height:Te}),s(m,{paddingX:Ie,children:We}),Te>0&&s(m,{height:Te}),s(a,{color:G,children:It})]})}else if(ne!=="none"||Ie>0||Te>0||b){const ze=Ie>0||Te>0?s(m,{paddingX:Ie,paddingY:Te,children:We}):We,Me={};return ne!=="none"&&(Me.borderStyle=ne,Me.borderColor=G),b?Me.alignSelf="flex-start":Me.flexGrow=1,ne==="none"?ze:s(m,{...Me,children:ze})}else return We},yn=()=>{const Q=d.replace(/\{\}/g,"list the dir");return Sn(Q)};return y?s(cn,{initialValue:A,theme:q,onColorChange:j=>{y==="foreground"?J(j):y==="background"?z(j):y==="border"&&_(j)},onExit:()=>{C(null),v("")}}):h(m,{flexDirection:"column",children:[s(fe,{children:"Customize how user messages are displayed"}),h(m,{flexDirection:"column",marginBottom:1,children:[s(a,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),s(a,{dimColor:!0,children:"enter to edit · ctrl+r to reset · esc to go back"})]}),h(m,{flexDirection:"row",gap:1,children:[h(m,{flexDirection:"column",width:"50%",borderStyle:K==="text"?"round":"single",borderColor:K==="text"?"yellow":"gray",paddingX:1,children:[s(m,{marginBottom:1,children:s(a,{bold:!0,color:K==="text"?"yellow":void 0,children:"Text & Styling"})}),s(m,{children:h(a,{color:P==="format"?"yellow":void 0,bold:P==="format",children:[P==="format"?"❯ ":" ","Format String"]})}),P==="format"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:r?"enter to save · esc to cancel":"enter to edit · use {} as message placeholder"})}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:r?"yellow":"gray",children:s(a,{children:d})})}),s(m,{children:h(a,{color:P==="styling"?"yellow":void 0,bold:P==="styling",children:[P==="styling"?"❯ ":" ","Styling"]})}),P==="styling"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),s(m,{marginLeft:2,marginBottom:1,flexDirection:"column",children:ut.map((j,Q)=>s(m,{children:h(a,{color:P==="styling"&&T===Q?"cyan":void 0,children:[P==="styling"&&T===Q?"❯ ":" ",E.includes(j.value)?"●":"○"," ",j.label]})},j.value))}),h(m,{flexDirection:"row",gap:1,marginBottom:1,children:[h(m,{flexDirection:"column",width:"50%",children:[s(m,{children:h(a,{color:P==="foreground"?"yellow":void 0,bold:P==="foreground",children:[P==="foreground"?"❯ ":" ","Foreground"]})}),P==="foreground"&&s(m,{marginLeft:2,children:h(a,{dimColor:!0,children:["up/down · ",O==="custom"?"enter":""]})}),h(m,{marginLeft:2,flexDirection:"column",children:[s(m,{children:h(a,{children:[O==="default"?"● ":"○ ","Default"]})}),s(m,{children:h(a,{children:[O==="custom"?"● ":"○ ","Custom",O==="custom"&&": ",O==="custom"&&s(a,{color:D,children:D})]})})]})]}),h(m,{flexDirection:"column",width:"50%",children:[s(m,{children:h(a,{color:P==="background"?"yellow":void 0,bold:P==="background",children:[P==="background"?"❯ ":" ","Background"]})}),P==="background"&&s(m,{marginLeft:2,children:h(a,{dimColor:!0,children:["up/down · ",k==="custom"?"enter":""]})}),h(m,{marginLeft:2,flexDirection:"column",children:[s(m,{children:h(a,{children:[k==="default"?"● ":"○ ","Default"]})}),s(m,{children:h(a,{children:[k==="none"?"● ":"○ ","None"]})}),s(m,{children:h(a,{children:[k==="custom"?"● ":"○ ","Custom",k==="custom"&&": ",k==="custom"&&s(a,{backgroundColor:$,children:$})]})})]})]})]})]}),h(m,{flexDirection:"column",width:"50%",borderStyle:K==="border"?"round":"single",borderColor:K==="border"?"yellow":"gray",paddingX:1,children:[s(m,{marginBottom:1,children:s(a,{bold:!0,color:K==="border"?"yellow":void 0,children:"Border & Padding"})}),s(m,{children:h(a,{color:P==="borderStyle"?"yellow":void 0,bold:P==="borderStyle",children:[P==="borderStyle"?"❯ ":" ","Border Style"]})}),P==="borderStyle"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:"up/down to navigate"})}),h(m,{marginLeft:2,marginBottom:1,flexDirection:"row",children:[s(m,{flexDirection:"column",width:"50%",children:ve.slice(0,6).map((j,Q)=>s(m,{children:h(a,{color:P==="borderStyle"&&W===Q?"cyan":void 0,children:[P==="borderStyle"&&W===Q?"❯ ":" ",W===Q?"● ":"○ ",j.label]})},j.value))}),s(m,{flexDirection:"column",width:"50%",children:ve.slice(6).map((j,Q)=>{const L=Q+6;return s(m,{children:h(a,{color:P==="borderStyle"&&W===L?"cyan":void 0,children:[P==="borderStyle"&&W===L?"❯ ":" ",W===L?"● ":"○ ",j.label]})},j.value)})})]}),s(m,{children:h(a,{color:P==="borderColor"?"yellow":void 0,bold:P==="borderColor",children:[P==="borderColor"?"❯ ":" ","Border Color"]})}),P==="borderColor"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:"enter to pick color"})}),s(m,{marginLeft:2,marginBottom:1,children:s(a,{color:G,children:G})}),h(m,{flexDirection:"row",gap:1,children:[h(m,{flexDirection:"column",width:"33%",children:[s(m,{children:h(a,{color:P==="paddingX"?"yellow":void 0,bold:P==="paddingX",children:[P==="paddingX"?"❯ ":" ","Padding X"]})}),P==="paddingX"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:o?"enter/esc":"enter"})}),s(m,{marginLeft:2,children:s(m,{borderStyle:"round",borderColor:o?"yellow":"gray",children:s(a,{children:f})})})]}),h(m,{flexDirection:"column",width:"33%",children:[s(m,{children:h(a,{color:P==="paddingY"?"yellow":void 0,bold:P==="paddingY",children:[P==="paddingY"?"❯ ":" ","Padding Y"]})}),P==="paddingY"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:c?"enter/esc":"enter"})}),s(m,{marginLeft:2,children:s(m,{borderStyle:"round",borderColor:c?"yellow":"gray",children:s(a,{children:w})})})]}),h(m,{flexDirection:"column",width:"33%",children:[s(m,{children:h(a,{color:P==="fitBoxToContent"?"yellow":void 0,bold:P==="fitBoxToContent",children:[P==="fitBoxToContent"?"❯ ":" ",b?"●":"○"," Fit box to content"]})}),P==="fitBoxToContent"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:"space"})})]})]})]})]}),h(m,{flexDirection:"column",marginTop:1,paddingX:1,children:[s(m,{marginBottom:1,children:s(a,{bold:!0,children:"Preview"})}),h(m,{flexDirection:"row",gap:2,children:[h(m,{flexDirection:"column",width:"50%",children:[s(m,{marginBottom:1,children:s(a,{underline:!0,children:"Before (Claude Code default):"})}),s(m,{marginLeft:1,children:h(a,{backgroundColor:q?.colors?.userMessageBackground,color:q?.colors?.text,children:[" ","> list the dir"," "]})}),s(m,{marginLeft:1,marginTop:1,children:h(a,{children:[s(a,{color:q?.colors?.inactive||"#888888",children:"●"}),s(a,{children:" The directory "}),s(a,{color:q?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(a,{children:" contains "}),s(a,{bold:!0,children:"123"}),s(a,{children:" files."})]})})]}),h(m,{flexDirection:"column",width:"50%",children:[s(m,{marginBottom:1,children:s(a,{underline:!0,children:"After (Your customization):"})}),s(m,{marginLeft:1,flexDirection:"row",children:yn()}),s(m,{marginLeft:1,marginTop:1,children:h(a,{children:[s(a,{color:q?.colors?.inactive||"#888888",children:"●"}),s(a,{children:" The directory "}),s(a,{color:q?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(a,{children:" contains "}),s(a,{bold:!0,children:"123"}),s(a,{children:" files."})]})})]})]})]})]})}const Ae=4;function ri({onSubmit:e}){const{settings:n,updateSettings:t}=pe(he),[r,i]=B(0),o={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEditPrompt:!1,hideStartupClawd:!1},l=()=>{n.misc||(n.misc={...o})},c=Tt(()=>[{id:"removeBorder",title:"Remove input box border",description:"Removes the rounded border around the input box for a cleaner look.",getValue:()=>n.inputBox?.removeBorder??!1,toggle:()=>{t(p=>{p.inputBox||(p.inputBox={removeBorder:!1}),p.inputBox.removeBorder=!p.inputBox.removeBorder})}},{id:"showVersion",title:"Show tweakcc version at startup",description:'Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.',getValue:()=>n.misc?.showTweakccVersion??!0,toggle:()=>{t(p=>{l(),p.misc.showTweakccVersion=!p.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:()=>n.misc?.showPatchesApplied??!0,toggle:()=>{t(p=>{l(),p.misc.showPatchesApplied=!p.misc.showPatchesApplied})}},{id:"expandThinking",title:"Expand thinking blocks",description:"Makes thinking blocks always expanded by default instead of collapsed.",getValue:()=>n.misc?.expandThinkingBlocks??!0,toggle:()=>{t(p=>{l(),p.misc.expandThinkingBlocks=!p.misc.expandThinkingBlocks})}},{id:"conversationTitle",title:"Allow renaming sessions via /title",description:"Enables /title and /rename commands for manually naming conversations.",getValue:()=>n.misc?.enableConversationTitle??!0,toggle:()=>{t(p=>{l(),p.misc.enableConversationTitle=!p.misc.enableConversationTitle})}},{id:"hideStartupBanner",title:"Hide startup banner",description:"Hides the startup banner message displayed before first prompt.",getValue:()=>n.misc?.hideStartupBanner??!1,toggle:()=>{t(p=>{l(),p.misc.hideStartupBanner=!p.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:()=>n.misc?.hideCtrlGToEditPrompt??!1,toggle:()=>{t(p=>{l(),p.misc.hideCtrlGToEditPrompt=!p.misc.hideCtrlGToEditPrompt})}},{id:"hideClawd",title:"Hide startup Clawd ASCII art",description:"Hides the Clawd ASCII art character shown at startup.",getValue:()=>n.misc?.hideStartupClawd??!1,toggle:()=>{t(p=>{l(),p.misc.hideStartupClawd=!p.misc.hideStartupClawd})}}],[n,t]),u=c.length,d=u-1,g=Tt(()=>r<Ae?0:Math.min(r-Ae+1,u-Ae),[r,u]),f=c.slice(g,g+Ae),x=g>0,w=g+Ae<u;return de((p,b)=>{b.return||b.escape?e():b.upArrow?i(I=>Math.max(0,I-1)):b.downArrow?i(I=>Math.min(d,I+1)):p===" "&&c[r]?.toggle()}),h(m,{flexDirection:"column",children:[s(m,{marginBottom:1,children:s(fe,{children:"Miscellaneous Settings"})}),s(m,{marginBottom:1,children:s(a,{dimColor:!0,children:"Various tweaks and customizations. Press space to toggle settings, enter to go back."})}),x&&s(m,{children:h(a,{dimColor:!0,children:[" ↑ ",g," more above"]})}),f.map((p,b)=>{const T=g+b===r,S=p.getValue()?"☑":"☐";return h(m,{flexDirection:"column",children:[s(m,{children:h(a,{children:[s(a,{color:T?"cyan":void 0,children:T?"❯ ":" "}),s(a,{bold:!0,color:T?"cyan":void 0,children:p.title})]})}),s(m,{children:h(a,{dimColor:!0,children:[" ",p.description]})}),s(m,{marginLeft:4,marginBottom:1,children:h(a,{children:[S," ",p.getValue()?"Enabled":"Disabled"]})})]},p.id)}),w&&s(m,{children:h(a,{dimColor:!0,children:[" ","↓ ",u-g-Ae," more below"]})}),s(m,{marginTop:1,children:h(a,{dimColor:!0,children:["Item ",r+1," of ",u]})})]})}const Xe=["Task","Bash","Glob","Grep","Read","Edit","Write","NotebookEdit","WebFetch","WebSearch","BashOutput","KillShell","TodoWrite","AskUserQuestion","Skill","SlashCommand","EnterPlanMode","ExitPlanMode","LSP"];function oi({toolsetIndex:e,onBack:n}){const{settings:t,updateSettings:r}=pe(he),i=t.toolsets[e],[o,l]=B(i?.name||"New Toolset"),[c,u]=B(i?.allowedTools||[]),[d,g]=B(!1),[f,x]=B(0);xe(()=>{i&&r(T=>{const S=T.toolsets[e].name;T.toolsets[e].name=o,T.toolsets[e].allowedTools=c,S!==o&&(T.defaultToolset===S&&(T.defaultToolset=o),T.planModeToolset===S&&(T.planModeToolset=o))})},[o,c]);const w=T=>c==="*"?!0:c.includes(T),p=T=>{T==="All"?u("*"):T==="None"?u([]):c==="*"?u(Xe.filter(S=>S!==T)):c.includes(T)?u(c.filter(S=>S!==T)):u([...c,T])};if(de((T,S)=>{if(d){S.return?g(!1):S.escape?(l(i?.name||"New Toolset"),g(!1)):S.backspace||S.delete?l(E=>E.slice(0,-1)):T&&T.length===1&&l(E=>E+T);return}if(S.escape)n();else if(S.upArrow)x(E=>Math.max(0,E-1));else if(S.downArrow)x(E=>Math.min(Xe.length+1,E+1));else if(T===" "||S.return)if(f===0)p("All");else if(f===1)p("None");else{const E=Xe[f-2];E&&p(E)}else T==="n"&&g(!0)}),!i)return s(m,{flexDirection:"column",children:s(a,{color:"red",children:"Toolset not found"})});const b=c==="*",I=Array.isArray(c)&&c.length===0;return h(m,{flexDirection:"column",children:[s(fe,{children:"Edit Toolset"}),s(m,{marginBottom:1,flexDirection:"column",children:s(a,{dimColor:!0,children:"n to edit name · space/enter to toggle · esc to go back"})}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{bold:!0,children:"Name:"}),s(m,{marginLeft:2,children:s(m,{borderStyle:"round",borderColor:d?"yellow":"gray",children:s(a,{children:o})})}),d&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:"enter to save · esc to cancel"})})]}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{bold:!0,children:"Allowed Tools:"}),s(m,{marginLeft:2,children:h(a,{color:f===0?"cyan":void 0,children:[f===0?"❯ ":" ",b?"●":"○"," All"]})}),s(m,{marginLeft:2,children:h(a,{color:f===1?"cyan":void 0,children:[f===1?"❯ ":" ",I?"●":"○"," None"]})}),Xe.map((T,S)=>{const E=S+2;return s(m,{marginLeft:2,children:h(a,{color:f===E?"cyan":void 0,children:[f===E?"❯ ":" ",w(T)?"◉":"○"," ",T]})},T)})]}),s(m,{borderStyle:"round",padding:1,marginTop:1,children:h(m,{flexDirection:"column",children:[s(a,{bold:!0,children:"Summary:"}),h(a,{children:["Name: ",s(a,{color:"cyan",children:o})]}),h(a,{children:["Tools:"," ",c==="*"?s(a,{color:"green",children:"All tools (*)"}):c.length===0?s(a,{color:"red",children:"No tools ([])"}):h(a,{color:"yellow",children:[c.length," selected"]})]})]})})]})}function ii({onBack:e}){const{settings:{toolsets:n,defaultToolset:t,planModeToolset:r,themes:i},updateSettings:o}=pe(he),l=nt(),c=i.find(R=>R.id===l)||i[0],u=ee.themes[0],d=c?.colors.planMode||u.colors.planMode,g=c?.colors.autoAccept||u.colors.autoAccept,[f,x]=B(0),[w,p]=B(null),[b,I]=B(!0),T=()=>{const R={name:"New Toolset",allowedTools:[]};o(D=>{D.toolsets.push(R)}),p(n.length),I(!1)},S=R=>{const D=n[R];o(J=>{J.toolsets.splice(R,1),J.defaultToolset===D.name&&(J.defaultToolset=null),J.planModeToolset===D.name&&(J.planModeToolset=null)}),f>=n.length-1&&x(Math.max(0,n.length-2))},E=R=>{const D=n[R];o(J=>{J.defaultToolset=D.name})},V=R=>{const D=n[R];o(J=>{J.planModeToolset=D.name})};if(de((R,D)=>{D.escape?e():D.upArrow?x(J=>Math.max(0,J-1)):D.downArrow?x(J=>Math.min(n.length-1,J+1)):D.return&&n.length>0?(p(f),I(!1)):R==="n"?T():R==="x"&&n.length>0?S(f):R==="d"&&n.length>0?E(f):R==="p"&&n.length>0&&V(f)},{isActive:b}),w!==null)return s(oi,{toolsetIndex:w,onBack:()=>{p(null),I(!0)}});const O=R=>R.allowedTools==="*"?"All tools":R.allowedTools.length===0?"No tools":`${R.allowedTools.length} tool${R.allowedTools.length===1?"":"s"}`;return h(m,{flexDirection:"column",children:[s(fe,{children:"Toolsets"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{dimColor:!0,children:"n to create a new toolset"}),n.length>0&&s(a,{dimColor:!0,children:"d to set as default toolset"}),n.length>0&&s(a,{dimColor:!0,children:"p to set as plan mode toolset"}),n.length>0&&s(a,{dimColor:!0,children:"x to delete a toolset"}),n.length>0&&s(a,{dimColor:!0,children:"enter to edit toolset"}),s(a,{dimColor:!0,children:"esc to go back"})]}),n.length===0?s(a,{children:"No toolsets created yet. Press n to create one."}):s(m,{flexDirection:"column",children:n.map((R,D)=>{const J=R.name===t,k=R.name===r,N=f===D;let $;return N&&($="yellow"),h(m,{flexDirection:"row",children:[h(a,{color:$,children:[N?"❯ ":" ",R.name," "]}),h(a,{color:$,children:["(",O(R),")"]}),J&&s(a,{color:g,children:" ⏵⏵ accept edits"}),k&&s(a,{color:d,children:" ⏸ plan mode"})]},D)})})]})}const he=Cn({settings:ee,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function si({startupCheckInfo:e,configMigrated:n}){const[t,r]=B({settings:ee,changesApplied:!1,ccVersion:"",lastModified:""}),[i,o]=B(!1);xe(()=>{(async()=>{const p=await He();r(p),o(!p.hidePiebaldAnnouncement)})()},[]);const l=Lt(w=>{const p=JSON.parse(JSON.stringify(t.settings));w(p),r(b=>({...b,settings:p,changesApplied:!1})),Ne(b=>{b.settings=p,b.changesApplied=!1})},[t.settings]),[c,u]=B(null),[d,g]=B(null);xe(()=>{e.wasUpdated&&e.oldVersion&&(g({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
|
|
659
|
+
`)))},rt=async()=>{await re.mkdir(se,{recursive:!0}),await re.mkdir(xe,{recursive:!0});const e=le.join(se,".gitignore");try{await re.stat(e)}catch(n){n instanceof Error&&"code"in n&&n.code==="ENOENT"&&await re.writeFile(e,[".DS_Store","prompt-data-cache","cli.js.backup","native-binary.backup","native-claudejs-orig.js","native-claudejs-patched.js","systemPromptAppliedHashes.json","systemPromptOriginalHashes.json","system-prompts/*.diff.html"].join(Mt)+Mt)}};let ke=null;const He=async()=>{const e={ccVersion:"",ccInstallationPath:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:ee};try{M(`Reading config at ${ce}`),Ao();const n=await re.readFile(ce,"utf8"),t={...e,...JSON.parse(n)},r=t?.settings?.thinkingVerbs;r?.punctuation&&(r.format="{}"+r.punctuation,delete r.punctuation),t.settings.inputBox||(t.settings.inputBox=ee.inputBox),t.settings.toolsets||(t.settings.toolsets=ee.toolsets),Object.hasOwn(t.settings,"defaultToolset")||(t.settings.defaultToolset=ee.defaultToolset),Object.hasOwn(t.settings,"planModeToolset")||(t.settings.planModeToolset=ee.planModeToolset);for(const o of ee.themes){const l=t?.settings?.themes.find(c=>c.id===o.id||c.name===o.name);if(l){for(const[c,u]of Object.entries(o))c!=="colors"&&!Object.hasOwn(l,c)&&(l[c]=u);l.colors||(l.colors={});for(const[c,u]of Object.entries(o.colors))Object.hasOwn(l.colors,c)||(l.colors[c]=u)}}for(const o of t?.settings?.themes||[]){if(ee.themes.some(u=>u.id===o.id||u.name===o.name))continue;const c=ee.themes[0];o.colors||(o.colors={});for(const[u,d]of Object.entries(c.colors))Object.hasOwn(o.colors,u)||(o.colors[u]=d)}return t?.settings?.userMessageDisplay||(t.settings=t.settings||ee,t.settings.userMessageDisplay=ee.userMessageDisplay),No(t),delete t.settings.launchText,await br(xe)&&(t.changesApplied=!1),ke=t,t}catch(n){if(n instanceof Error&&"code"in n&&n.code==="ENOENT")return e;throw n}},Ne=async e=>(M(`Updating config at ${ce}`),!ke&&(ke=await He()),e(ke),ke.lastModified=new Date().toISOString(),await Oo(ke),ke),Oo=async e=>{try{e.lastModified=new Date().toISOString(),await rt(),await re.writeFile(ce,JSON.stringify(e,null,2))}catch(n){throw console.error("Error saving config:",n),n}},Do=({children:e,...n})=>h(a,{bold:!0,backgroundColor:"#ffd500",color:"#000",...n,children:[" ",e," "]});var fe=Do;const Lo=["\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"],Ro=()=>h(m,{flexDirection:"row",height:10,alignItems:"center",borderStyle:"bold",borderBottom:!1,borderTop:!1,borderRight:!1,borderColor:"#ff8400",marginBottom:1,children:[h(m,{marginBottom:1,paddingLeft:1,flexDirection:"column",flexGrow:1,children:[s(a,{bold:!0,color:"#ff8400",children:"Piebald is released!"}),s(a,{children:" "}),h(a,{children:["We've released ",s(a,{bold:!0,children:"Piebald"}),", the ultimate agentic AI developer experience."]}),h(a,{children:["Download it and try it out for free!"," ",s(wt,{url:"https://piebald.ai/",fallback:!1,children:s(a,{color:"#ff8400",children:"https://piebald.ai/"})})]}),s(a,{children:" "}),s(a,{dimColor:!0,color:"gray",children:"press 'h' to hide"})]}),s(m,{width:22,flexShrink:0,flexDirection:"column",alignItems:"center",children:Lo.map((e,n)=>s(a,{children:e},n))})]});var Fo=Ro;let Z=function(e){return e.APPLY_CHANGES="*Apply customizations",e.THEMES="Themes",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.MISC="Misc",e.TOOLSETS="Toolsets",e.VIEW_SYSTEM_PROMPTS="View system prompts",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves config.json)",e.OPEN_CONFIG="Open config.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});function Vo({items:e,selectedIndex:n,onSelect:t,onSubmit:r}){return de((i,o)=>{o.upArrow?t(n>0?n-1:e.length-1):o.downArrow?t(n<e.length-1?n+1:0):o.return&&r(e[n].name)}),s(m,{flexDirection:"column",children:e.map((i,o)=>s(m,{children:h(a,{children:[h(a,{bold:o===n,color:o===n?"cyan":void 0,...o===n?i.selectedStyles??{}:i.styles??{},children:[o===n?"❯ ":" ",i.name]}),i.desc&&o===n&&h(a,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",i.desc]})]})},o))})}const jo=[{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.MISC,desc:"Miscellaneous settings (input box border, etc.)"},{name:Z.TOOLSETS,desc:"Manage toolsets to control which tools are available"},{name:Z.VIEW_SYSTEM_PROMPTS,desc:"Opens the system prompts directory where you can customize Claude Code's system prompts"}],Uo=[{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 (${ce})`},{name:Z.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:Z.EXIT,desc:"Bye!"}],Ho=({onSubmit:e})=>{const t=[...pe(he).changesApplied?[]:[{name:Z.APPLY_CHANGES,desc:"Required: Updates Claude Code in-place with your changes",selectedStyles:{color:"green"}}],...jo,...Uo],[r,i]=B(0);return s(Vo,{items:t,selectedIndex:r,onSelect:i,onSubmit:o=>e(o)})};var Go=Ho;const Yo=()=>h(m,{flexDirection:"row",children:[s(fe,{children:"tweakcc"}),s(a,{children:" (by "}),s(wt,{url:"https://piebald.ai",fallback:!1,children:s(a,{color:"#ff8400",bold:!0,children:"Piebald"})}),s(a,{children:")"})]}),Wo=()=>s(m,{children:h(a,{color:"yellow",children:["⭐ ",s(a,{bold:!0,children:"Star the repo at "}),s(wt,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:s(a,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),s(a,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),zo=({notification:e})=>s(m,{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:s(a,{color:e.type==="success"?"green":e.type==="error"?"red":e.type==="info"?"blue":"yellow",children:e.message})}),Jo=({onSubmit:e,notification:n,configMigrated:t,showPiebaldAnnouncement:r})=>h(m,{flexDirection:"column",gap:1,children:[t&&s(m,{children:s(a,{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."})}),s(Yo,{}),s(m,{children:h(a,{children:[s(a,{bold:!0,children:"Customize your Claude Code installation."})," ",h(a,{dimColor:!0,children:["Settings will be saved to ",se.replace(Re.homedir(),"~"),"/config.json."]})]})}),r?s(Fo,{}):s(Wo,{}),n&&s(zo,{notification:n}),s(Go,{onSubmit:e})]});function H({color:e,backgroundColor:n,bold:t,dimColor:r,children:i}){const o=e?.startsWith("ansi:"),l=n?.startsWith("ansi:");if(o||l){if(st.Children.toArray(i).some(f=>st.isValidElement(f)))return s(a,{children:i});let u=F;if(o){const f=e.slice(5);u=u[f]||u}if(l){const f=n.slice(5),x=f.startsWith("bg")?f:`bg${f.charAt(0).toUpperCase()}${f.slice(1)}`;u=u[x]||u}t&&(u=u.bold),r&&(u=u.dim);const g=st.Children.toArray(i).map(f=>typeof f=="string"||typeof f=="number"?String(f):"").join("");return s(a,{children:u(g)})}return s(a,{color:e,backgroundColor:n,bold:t,dimColor:r,children:i})}function Xo({text:e,nonShimmerColors:n,shimmerColors:t,shimmerWidth:r=3,updateDuration:i=50,restartPoint:o=10}){const[l,c]=B(0);return we(()=>{const u=setInterval(()=>{c(d=>{const g=d+1;return g>=e.length+o?-r:g})},i);return()=>clearInterval(u)},[e.length,o,i]),n.length!==t.length?(console.error("UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length"),s(a,{children:e})):s(a,{children:e.split("").map((u,d)=>{const g=d>=l&&d<l+r&&l<e.length,f=d%n.length,x=g?t[f]:n[f];return s(a,{color:x,children:u},d)})})}const qo=_n.cwd();function an({theme:e}){const{ccVersion:n}=pe(he);return h(m,{flexDirection:"column",paddingLeft:1,children:[s(m,{marginBottom:1,children:h(a,{bold:!0,children:["Preview: ",e.name]})}),s(m,{borderStyle:"single",borderColor:"gray",paddingX:1,children:h(m,{flexDirection:"column",children:[h(m,{flexDirection:"column",children:[h(a,{children:[s(H,{color:e.colors.clawd_body,children:" ▐"}),s(a,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"▛███▜"}),h(a,{children:[s(H,{color:e.colors.clawd_body,children:"▌ "})," ",s(a,{bold:!0,children:"Claude Code"})," ",n?`v${n}`:"v2.0.14"]})]}),h(a,{children:[s(H,{color:e.colors.clawd_body,children:"▝▜"}),s(a,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"█████"}),s(H,{color:e.colors.clawd_body,children:"▛▘"})," ",To()," · ",Io()]}),h(H,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",qo]}),h(a,{children:[h(H,{color:e.colors.success,children:["Login successful. Press"," "]}),s(H,{bold:!0,color:e.colors.success,children:"Enter"}),h(H,{color:e.colors.success,children:[" ","to continue…"]})]})]}),s(a,{children:"╭─────────────────────────────────────────────╮"}),h(a,{children:["│ 1 function greet() ","{"," ","│"]}),h(a,{children:["│ 2"," ",s(H,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:'- console.log("'}),s(H,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),s(H,{backgroundColor:e.colors.diffRemoved,children:'");'})," ","│"]}),h(a,{children:["│ 2"," ",s(H,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:'+ console.log("'}),s(H,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),s(H,{backgroundColor:e.colors.diffAdded,children:'");'})," ","│"]}),s(H,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),h(H,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),h(a,{children:[s(H,{color:e.colors.warning,children:"│ "}),s(a,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),h(H,{color:e.colors.warning,children:[" ","│"]})]}),s(H,{color:e.colors.bashBorder,children:"───────────────────────────────────────────────"}),h(a,{children:[s(H,{color:e.colors.bashBorder,children:"!"}),s(a,{children:" ls"})]}),s(H,{color:e.colors.promptBorder,children:"───────────────────────────────────────────────"}),s(a,{children:h(a,{children:["> list the dir"," ",s(Xo,{text:"ultrathink",nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),s(H,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),h(a,{children:[s(H,{color:e.colors.planMode,children:"│ "}),h(H,{color:e.colors.permission,children:["Ready to code?"," "]}),s(a,{children:"Here is Claude's plan:"}),h(H,{color:e.colors.planMode,children:[" ","│"]})]}),s(H,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),h(a,{children:[s(H,{color:e.colors.permission,children:"│ "}),s(a,{bold:!0,children:"Permissions:"})," ",h(H,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",s(H,{color:e.colors.permission,children:"│"})]}),s(a,{children:"> list the dir"}),h(a,{children:[s(H,{color:e.colors.error,children:"●"}),s(a,{children:" Update(__init__.py)"})]}),h(a,{children:[s(a,{children:" ⎿ "}),s(H,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),h(a,{children:[" ","1"," ",h(H,{backgroundColor:e.colors.diffRemovedDimmed,children:["- import"," "]}),s(H,{backgroundColor:e.colors.diffRemovedWordDimmed,children:"os"})]}),h(a,{children:[" ","2"," ",h(H,{backgroundColor:e.colors.diffAddedDimmed,children:["+ import"," "]}),s(H,{backgroundColor:e.colors.diffAddedWordDimmed,children:"random"})]}),h(a,{children:[s(H,{color:e.colors.success,children:"●"}),s(a,{children:" List(.)"})]}),h(a,{children:[s(a,{children:"●"}),s(a,{children:" The directory "}),s(H,{color:e.colors.permission,children:"C:\\Users\\user"}),h(a,{children:[" ","contains ",s(a,{bold:!0,children:"123"})," files."]})]}),h(a,{children:[s(H,{color:e.colors.claude,children:"✻ Th"}),s(H,{color:e.colors.claudeShimmer,children:"ink"}),s(H,{color:e.colors.claude,children:"ing… "}),s(a,{children:"(esc to interrupt)"})]}),s(a,{children:s(H,{color:e.colors.autoAccept,children:"⏵⏵ accept edits on (shift+tab to cycle)"})}),s(a,{children:s(H,{color:e.colors.planMode,children:"⏸ plan mode on (shift+tab to cycle)"})}),s(a,{children:s(H,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function at({colorKey:e,theme:n,bold:t=!1}){const r=n.colors[e];return e==="inverseText"?s(H,{color:r,backgroundColor:n.colors.permission,bold:t,children:e}):e.startsWith("diff")?s(H,{backgroundColor:r,bold:t,color:n.colors.text,children:e}):s(H,{color:r,bold:t,children:e})}function cn({initialValue:e,onColorChange:n,onExit:t,colorKey:r,theme:i}){const o=dt(e)||{h:0,s:50,l:50},l=ct(e)||{r:128,g:128,b:128},[c,u]=B(o),[d,g]=B(l),[f,x]=B("hsl"),[w,p]=B("h"),[b,I]=B(!1),[T,S]=B(!1);we(()=>{const _=dt(e),v=ct(e);_&&v&&(I(!0),u(_),g(v),I(!1))},[e]),we(()=>{if(!b&&T){const _=`rgb(${d.r},${d.g},${d.b})`;n(_)}},[c,d,b,T]),we(()=>{S(!0)},[]);const E=_=>{if($t(_)){const v=ln(_),C=dt(v),P=ct(v);C&&P&&(I(!0),u(C),g(P),I(!1))}};de((_,v)=>{if(_.length>1&&!v.ctrl&&!v.meta){E(_);return}if(v.return)t();else if(v.escape)t();else if(v.ctrl&&_==="a")x(C=>C==="hsl"?"rgb":"hsl"),p(C=>f==="hsl"?C==="h"?"r":C==="s"?"g":"b":C==="r"?"h":C==="g"?"s":"l");else if(v.upArrow)p(f==="hsl"?C=>C==="h"?"l":C==="s"?"h":"s":C=>C==="r"?"b":C==="g"?"r":"g");else if(v.downArrow||v.tab)p(f==="hsl"?C=>C==="h"?"s":C==="s"?"l":"h":C=>C==="r"?"g":C==="g"?"b":"r");else if(v.leftArrow){const C=v.shift||v.ctrl||v.meta?-10:-1;R(C)}else if(v.rightArrow){const C=v.shift||v.ctrl||v.meta?10:1;R(C)}});const R=_=>{I(!0),f==="hsl"?u(v=>{const C={...v};w==="h"?C.h=Math.max(0,Math.min(359,v.h+_)):w==="s"?C.s=Math.max(0,Math.min(100,v.s+_)):w==="l"&&(C.l=Math.max(0,Math.min(100,v.l+_)));const[P,$,U]=V(C.h,C.s,C.l);return g({r:P,g:$,b:U}),C}):g(v=>{const C={...v};w==="r"?C.r=Math.max(0,Math.min(255,v.r+_)):w==="g"?C.g=Math.max(0,Math.min(255,v.g+_)):w==="b"&&(C.b=Math.max(0,Math.min(255,v.b+_)));const P=O(C.r,C.g,C.b);return u(P),C}),I(!1)},O=(_,v,C)=>{const P=_/255,$=v/255,U=C/255,q=Math.max(P,$,U),K=Math.min(P,$,U),te=q-K,ie=(q+K)/2;let be=0;te!==0&&(be=ie>.5?te/(2-q-K):te/(q+K));let Se=0;return te!==0&&(q===P?Se=(($-U)/te+($<U?6:0))/6:q===$?Se=((U-P)/te+2)/6:Se=((P-$)/te+4)/6),{h:Math.round(Se*360),s:Math.round(be*100),l:Math.round(ie*100)}},V=(_,v,C)=>{_/=360,v/=100,C/=100;const P=(1-Math.abs(2*C-1))*v,$=P*(1-Math.abs(_*6%2-1)),U=C-P/2;let q=0,K=0,te=0;return 0<=_&&_<1/6?(q=P,K=$,te=0):1/6<=_&&_<2/6?(q=$,K=P,te=0):2/6<=_&&_<3/6?(q=0,K=P,te=$):3/6<=_&&_<4/6?(q=0,K=$,te=P):4/6<=_&&_<5/6?(q=$,K=0,te=P):5/6<=_&&_<1&&(q=P,K=0,te=$),[Math.round((q+U)*255),Math.round((K+U)*255),Math.round((te+U)*255)]},D=()=>{const _=[],v=[[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 C=0;C<40;C++){const $=C/39*(v.length-1),U=Math.floor($),q=Math.ceil($),K=$-U,[te,ie,be]=v[U],[Se,Ge,ot]=v[q],Ye=Math.round(te+(Se-te)*K),A=Math.round(ie+(Ge-ie)*K),it=Math.round(be+(ot-be)*K);_.push(s(a,{backgroundColor:`rgb(${Ye},${A},${it})`,children:" "},C))}return _},Y=()=>{const _=[];for(let v=0;v<40;v++){const C=v/39*100,[P,$,U]=V(c.h,C,c.l);_.push(s(a,{backgroundColor:`rgb(${P},${$},${U})`,children:" "},v))}return _},N=()=>{const _=[];for(let v=0;v<40;v++){const C=v/39*100,[P,$,U]=V(c.h,c.s,C);_.push(s(a,{backgroundColor:`rgb(${P},${$},${U})`,children:" "},v))}return _},k=()=>{const[_,v,C]=V(c.h,c.s,c.l);return`rgb(${_},${v},${C})`},y=(_,v,C)=>{const P=$=>$.toString(16).padStart(2,"0");return`#${P(_)}${P(v)}${P(C)}`},J=()=>{const _=[];for(let v=0;v<40;v++){const C=Math.round(v/39*255);_.push(s(a,{backgroundColor:`rgb(${C},${d.g},${d.b})`,children:" "},v))}return _},W=()=>{const _=[];for(let v=0;v<40;v++){const C=Math.round(v/39*255);_.push(s(a,{backgroundColor:`rgb(${d.r},${C},${d.b})`,children:" "},v))}return _},X=()=>{const _=[];for(let v=0;v<40;v++){const C=Math.round(v/39*255);_.push(s(a,{backgroundColor:`rgb(${d.r},${d.g},${C})`,children:" "},v))}return _},G=(_,v)=>Math.round(_/v*39);return h(m,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[h(m,{flexDirection:"column",children:[s(a,{bold:!0,children:"Color Picker"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),s(a,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),s(a,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),s(a,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),s(a,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),s(a,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),f==="hsl"?h($e,{children:[h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="h"?"yellow":"white",children:[w==="h"?"❯ ":" ","Hue (",c.h,"°):"]})}),s(m,{children:D().map((_,v)=>s(Be,{children:v===G(c.h,360)?s(a,{children:"|"}):_},v))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="s"?"yellow":"white",children:[w==="s"?"❯ ":" ","Saturation (",c.s,"%):"]})}),s(m,{children:Y().map((_,v)=>s(Be,{children:v===G(c.s,100)?s(a,{children:"|"}):_},v))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="l"?"yellow":"white",children:[w==="l"?"❯ ":" ","Lightness (",c.l,"%):"]})}),s(m,{children:N().map((_,v)=>s(Be,{children:v===G(c.l,100)?s(a,{children:"|"}):_},v))})]})]}):h($e,{children:[h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="r"?"yellow":"white",children:[w==="r"?"❯ ":" ","Red (",d.r,"):"]})}),s(m,{children:J().map((_,v)=>s(Be,{children:v===G(d.r,255)?s(a,{children:"|"}):_},v))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="g"?"yellow":"white",children:[w==="g"?"❯ ":" ","Green (",d.g,"):"]})}),s(m,{children:W().map((_,v)=>s(Be,{children:v===G(d.g,255)?s(a,{children:"|"}):_},v))})]}),h(m,{marginBottom:1,children:[s(m,{width:25,children:h(a,{color:w==="b"?"yellow":"white",children:[w==="b"?"❯ ":" ","Blue (",d.b,"):"]})}),s(m,{children:X().map((_,v)=>s(Be,{children:v===G(d.b,255)?s(a,{children:"|"}):_},v))})]})]}),h(m,{marginBottom:1,children:[s(a,{children:"Current: "}),s(a,{backgroundColor:k(),children:" "})]}),h(m,{flexDirection:"row",justifyContent:"space-between",children:[h(m,{flexDirection:"column",children:[s(a,{dimColor:!0,children:"Hex "}),r?.startsWith("diff")?s(a,{backgroundColor:k(),color:i?.colors?.text||"white",bold:!0,children:y(d.r,d.g,d.b)}):r==="inverseText"?s(a,{color:k(),backgroundColor:i?.colors?.permission,bold:!0,children:y(d.r,d.g,d.b)}):s(a,{color:k(),bold:!0,children:y(d.r,d.g,d.b)})]}),h(m,{flexDirection:"column",children:[s(a,{dimColor:!0,children:"RGB "}),r?.startsWith("diff")?s(a,{backgroundColor:k(),color:i?.colors?.text||"white",bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):r==="inverseText"?s(a,{color:k(),backgroundColor:i?.colors?.permission,bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`}):s(a,{color:k(),bold:!0,children:`rgb(${d.r}, ${d.g}, ${d.b})`})]}),h(m,{flexDirection:"column",children:[s(a,{dimColor:!0,children:"HSL "}),r?.startsWith("diff")?s(a,{backgroundColor:k(),color:i?.colors?.text||"white",bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):r==="inverseText"?s(a,{color:k(),backgroundColor:i?.colors?.permission,bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):s(a,{color:k(),bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`})]})]})]})}function ct(e){const n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n)return{r:parseInt(n[1]),g:parseInt(n[2]),b:parseInt(n[3])};const t=e.match(/^#([a-fA-F0-9]{6})$/);if(t){const r=t[1];return{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16)}}return null}function dt(e){const n=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n)return{h:parseInt(n[1]),s:parseInt(n[2]),l:parseInt(n[3])};const t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t){const i=parseInt(t[1])/255,o=parseInt(t[2])/255,l=parseInt(t[3])/255,c=Math.max(i,o,l),u=Math.min(i,o,l),d=c-u,g=(c+u)/2;let f=0;d!==0&&(f=g>.5?d/(2-c-u):d/(c+u));let x=0;return d!==0&&(c===i?x=((o-l)/d+(o<l?6:0))/6:c===o?x=((l-i)/d+2)/6:x=((i-o)/d+4)/6),{h:Math.round(x*360),s:Math.round(f*100),l:Math.round(g*100)}}const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const i=r[1],o=parseInt(i.substr(0,2),16)/255,l=parseInt(i.substr(2,2),16)/255,c=parseInt(i.substr(4,2),16)/255,u=Math.max(o,l,c),d=Math.min(o,l,c),g=u-d,f=(u+d)/2;let x=0;g!==0&&(x=f>.5?g/(2-u-d):g/(u+d));let w=0;return g!==0&&(u===o?w=((l-c)/g+(l<c?6:0))/6:u===l?w=((c-o)/g+2)/6:w=((o-l)/g+4)/6),{h:Math.round(w*360),s:Math.round(x*100),l:Math.round(f*100)}}return{h:0,s:50,l:50}}function Ko({onBack:e,themeId:n}){const{settings:{themes:t},updateSettings:r}=pe(he),[i,o]=B(n),l=t.find(N=>N.id===i)||t[0],[c,u]=B("rgb"),[d,g]=B(0),[f,x]=B(null),[w,p]=B(null),[b,I]=B(""),[T,S]=B(""),E=Lt(N=>{r(k=>{const y=k.themes.findIndex(J=>J.id===i);y!==-1&&N(k.themes[y])})},[i,r]),R=N=>{if(d>=2&&$t(N)){const k=ln(N),y=d-2,J=O[y];E(W=>{W.colors[J]=k})}};de((N,k)=>{if(f===null&&w===null){if(N.length>1&&!k.ctrl&&!k.meta){R(N);return}if(k.escape)e();else if(k.ctrl&&N==="a")u(y=>y==="rgb"?"hex":y==="hex"?"hsl":"rgb");else if(k.upArrow)g(y=>Math.max(0,y-1));else if(k.downArrow)g(y=>Math.min(O.length+1,y+1));else if(k.return)if(d===0)p("name"),I(l.name),S(l.name);else if(d===1)p("id"),I(l.id),S(l.id);else{const y=d-2,J=O[y],W=l.colors[J];x(y),I(W),S(W)}}else if(f!==null)k.ctrl&&N==="a"&&u(y=>y==="rgb"?"hex":y==="hex"?"hsl":"rgb");else if(w!==null)if(k.return){if(w==="id"){const y=i;o(b),r(J=>{const W=J.themes.findIndex(X=>X.id===y);W!==-1&&(J.themes[W].id=b)})}else E(y=>{y.name=b});p(null),I(""),S("")}else k.escape?(p(null),I(""),S("")):k.backspace||k.delete?I(y=>y.slice(0,-1)):N&&I(y=>y+N)});const O=Object.keys(l.colors),V=(N,k)=>{const y=N.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!y)return N;const J=parseInt(y[1]),W=parseInt(y[2]),X=parseInt(y[3]);switch(k){case"hex":{const G=_=>_.toString(16).padStart(2,"0");return`#${G(J)}${G(W)}${G(X)}`}case"hsl":{const G=J/255,_=W/255,v=X/255,C=Math.max(G,_,v),P=Math.min(G,_,v),$=C-P,U=(C+P)/2;let q=0;$!==0&&(q=U>.5?$/(2-C-P):$/(C+P));let K=0;return $!==0&&(C===G?K=((_-v)/$+(_<v?6:0))/6:C===_?K=((v-G)/$+2)/6:K=((G-_)/$+4)/6),`hsl(${Math.round(K*360)}, ${Math.round(q*100)}%, ${Math.round(U*100)}%)`}case"rgb":default:return N}},D=N=>({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"})[N]||"",Y=Math.max(...O.map(N=>N.length));return h(m,{children:[h(m,{flexDirection:"column",width:"50%",children:[s(m,{children:h(fe,{children:["Editing theme “",l.name,"” (",l.id,")"]})}),f===null&&w===null?h($e,{children:[h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{dimColor:!0,children:"enter to edit theme name, id, or color"}),s(a,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),s(a,{dimColor:!0,children:"paste color from clipboard (when on color)"}),s(a,{dimColor:!0,children:"esc to go back"})]}),d<2?h(m,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[s(a,{bold:!0,children:d===0?"Theme Name":"Theme ID"}),s(a,{children:d===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):h(m,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:l.colors[O[d-2]],flexDirection:"column",paddingLeft:1,children:[s(at,{colorKey:O[d-2],theme:l,bold:!0}),s(a,{children:D(O[d-2])})]}),h(m,{flexDirection:"column",children:[h(m,{children:[s(a,{color:d===0?"yellow":"white",children:d===0?"❯ ":" "}),s(a,{bold:!0,children:"Name: "}),s(a,{children:l.name})]}),h(m,{marginBottom:1,children:[s(a,{color:d===1?"yellow":"white",children:d===1?"❯ ":" "}),s(a,{bold:!0,children:"ID: "}),s(a,{children:l.id})]}),(()=>{if(d<2){const G=O.slice(0,20);return h($e,{children:[G.map((_,v)=>{const C=v+2;return h(m,{children:[s(a,{color:d===C?"yellow":"white",children:d===C?"❯ ":" "}),s(m,{width:Y+2,children:s(a,{children:s(at,{colorKey:_,theme:l,bold:!0})})}),s(H,{color:l.colors[_],children:V(l.colors[_],c)})]},_)}),O.length>20&&h(a,{color:"gray",dimColor:!0,children:[" ","↓ ",O.length-20," more below"]})]})}const k=d-2,y=Math.max(0,k-Math.floor(20/2)),J=Math.min(O.length,y+20),W=Math.max(0,J-20),X=O.slice(W,J);return h($e,{children:[W>0&&h(a,{color:"gray",dimColor:!0,children:[" ","↑ ",W," more above"]}),X.map((G,_)=>{const C=W+_+2;return h(m,{children:[s(a,{color:d===C?"yellow":"white",children:d===C?"❯ ":" "}),s(m,{width:Y+2,children:s(a,{children:s(at,{colorKey:G,theme:l,bold:!0})})}),s(H,{color:l.colors[G],children:V(l.colors[G],c)})]},G)}),J<O.length&&h(a,{color:"gray",dimColor:!0,children:[" ","↓ ",O.length-J," more below"]})]})})()]})]}):w?h(m,{flexDirection:"column",marginTop:1,children:[h(a,{children:["Editing ",w==="name"?"theme name":"theme ID",":"]}),s(m,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:s(a,{children:b})}),s(a,{dimColor:!0,children:"enter to save, esc to cancel"})]}):s(cn,{initialValue:T,colorKey:O[f],theme:l,onColorChange:N=>{I(N),E(k=>{k.colors[O[f]]=N})},onExit:()=>{E(N=>{N.colors[O[f]]=b}),x(null),I(""),S("")}})]}),s(m,{width:"50%",children:s(an,{theme:l})})]})}function Qo(e){return e.map(n=>`${n.name} (${n.id})`)}function Zo({onBack:e}){const{settings:{themes:n},updateSettings:t}=pe(he),[r,i]=B(0),[o,l]=B(null),[c,u]=B(!0),d=()=>{const b={colors:{...(n[0]||ee.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};t(I=>{I.themes.push(b)}),l(b.id),u(!1)},g=p=>{n.length<=1||(t(b=>{b.themes=b.themes.filter(I=>I.id!==p)}),r>=n.length-1&&i(Math.max(0,n.length-2)))},f=()=>{t(p=>{p.themes=[...ee.themes]}),i(0)};if(de((p,b)=>{if(b.escape)e();else if(b.upArrow)i(I=>Math.max(0,I-1));else if(b.downArrow)i(I=>Math.min(n.length-1,I+1));else if(b.return){const I=n[r];I&&(l(I.id),u(!1))}else if(p==="n")d();else if(p==="d"){const I=n[r];I&&g(I.id)}else b.ctrl&&p==="r"&&f()},{isActive:c}),o)return s(Ko,{themeId:o,onBack:()=>{l(null),u(!0)}});const x=Qo(n),w=n.find(p=>x[r]?.includes(`(${p.id})`))||n[0];return n.length===0?s(m,{children:h(m,{flexDirection:"column",width:"100%",children:[s(fe,{children:"Themes"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{dimColor:!0,children:"n to create a new theme"}),s(a,{dimColor:!0,children:"esc to go back"})]}),s(a,{children:"No themes available!"})]})}):h(m,{children:[h(m,{flexDirection:"column",width:"50%",children:[s(fe,{children:"Themes"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{dimColor:!0,children:"n to create a new theme"}),s(a,{dimColor:!0,children:"d to delete a theme"}),s(a,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),s(a,{dimColor:!0,children:"enter to edit theme"}),s(a,{dimColor:!0,children:"esc to go back"})]}),s(m,{flexDirection:"column",children:x.map((p,b)=>h(a,{color:r===b?"yellow":void 0,children:[r===b?"❯ ":" ",p]},b))})]}),s(m,{width:"50%",children:s(an,{theme:w})})]})}function ei({onBack:e}){const{settings:{thinkingVerbs:{format:n,verbs:t},themes:r},updateSettings:i}=pe(he),o=["format","verbs"],[l,c]=B(0),u=o[l],[d,g]=B(0),[f,x]=B(!1),[w,p]=B(""),[b,I]=B(!1),[T,S]=B(!1),[E,R]=B(n),O=nt(),D=(r.find(N=>N.id===O)||r.find(N=>N.id==="dark"))?.colors.claude||"rgb(215,119,87)";de((N,k)=>{if(T){k.return?(i(y=>{y.thinkingVerbs.format=E}),S(!1)):k.escape?(R(n),S(!1)):k.backspace||k.delete?R(y=>y.slice(0,-1)):N&&R(y=>y+N);return}if(f||b){k.return&&w.trim()?(b?(i(y=>{y.thinkingVerbs.verbs.push(w.trim())}),I(!1)):(i(y=>{y.thinkingVerbs.verbs[d]=w.trim()}),x(!1)),p("")):k.escape?(p(""),x(!1),I(!1)):k.backspace||k.delete?p(y=>y.slice(0,-1)):N&&p(y=>y+N);return}k.escape?e():k.return?u==="format"&&(R(n),S(!0)):k.tab?k.shift?c(y=>y===0?o.length-1:y-1):c(y=>y===o.length-1?0:y+1):k.upArrow?u==="verbs"&&t.length>0&&g(y=>y>0?y-1:t.length-1):k.downArrow?u==="verbs"&&t.length>0&&g(y=>y<t.length-1?y+1:0):N==="e"&&u==="verbs"?t.length>0&&(p(t[d]),x(!0)):N==="d"&&u==="verbs"?t.length>1&&(i(y=>{y.thinkingVerbs.verbs=y.thinkingVerbs.verbs.filter((J,W)=>W!==d)}),d>=t.length-1&&g(Math.max(0,t.length-2))):N==="n"&&u==="verbs"?(I(!0),p("")):k.ctrl&&N==="r"&&u==="verbs"&&(i(y=>{y.thinkingVerbs.verbs=[...ee.thinkingVerbs.verbs]}),g(0))});const Y=50;return h(m,{children:[h(m,{flexDirection:"column",width:`${100-Y}%`,children:[h(m,{marginBottom:1,flexDirection:"column",children:[s(fe,{children:"Thinking Verbs"}),h(m,{flexDirection:"column",children:[s(a,{dimColor:!0,children:u==="format"?"enter to edit format":"changes auto-saved"}),s(a,{dimColor:!0,children:"esc to go back"}),s(a,{dimColor:!0,children:"tab to switch sections"})]})]}),s(m,{marginBottom:1,children:s(a,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),h(m,{flexDirection:"column",children:[h(a,{children:[s(a,{color:u==="format"?"yellow":void 0,children:u==="format"?"❯ ":" "}),s(a,{bold:!0,color:u==="format"?"yellow":void 0,children:"Format"})]}),u==="format"&&(T?h(a,{dimColor:!0,children:[" ","enter to save"]}):h(a,{dimColor:!0,children:[" ","enter to edit"]}))]}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:T?"yellow":"gray",children:s(a,{children:T?E:n})})}),s(m,{children:h(a,{children:[s(a,{color:u==="verbs"?"yellow":void 0,children:u==="verbs"?"❯ ":" "}),s(a,{bold:!0,color:u==="verbs"?"yellow":void 0,children:"Verbs"})]})}),u==="verbs"&&s(m,{flexDirection:"column",children:h(a,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),s(m,{marginLeft:2,marginBottom:1,children:h(m,{flexDirection:"column",children:[(()=>{const k=Math.max(0,d-Math.floor(4)),y=Math.min(t.length,k+8),J=Math.max(0,y-8),W=t.slice(J,y);return h($e,{children:[J>0&&h(a,{color:"gray",dimColor:!0,children:[" ","↑ ",J," more above"]}),W.map((X,G)=>{const _=J+G;return h(a,{color:u==="verbs"&&_===d?"cyan":void 0,children:[u==="verbs"&&_===d?"❯ ":" ",X]},_)}),y<t.length&&h(a,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-y," more below"]})]})})(),b&&h(m,{alignItems:"center",children:[s(a,{color:"yellow",children:"❯ "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(a,{children:w})})]}),f&&h(m,{marginTop:1,alignItems:"center",children:[s(a,{children:"Editing: "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(a,{children:w})})]})]})})]}),h(m,{width:`${Y}%`,flexDirection:"column",children:[s(m,{marginBottom:1,children:s(a,{bold:!0,children:"Preview"})}),s(m,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:h(a,{children:[h(a,{color:D,children:["✻ ",n.replace(/\{\}/g,t[d])," "]}),s(a,{children:"(esc to interrupt)"})]})})]})]})}const Ee=[{name:"Default",phases:ee.thinkingStyle.phases,reverseMirror:ee.thinkingStyle.reverseMirror},{name:"Basic",phases:["|","/","-","\\"],reverseMirror:!1},{name:"Braille",phases:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],reverseMirror:!1},{name:"Circle",phases:["◐","◓","◑","◒"],reverseMirror:!1},{name:"Wave",phases:["▁","▃","▄","▅","▆","▇","█"],reverseMirror:!0},{name:"Glow",phases:["░","▒","▓","█"],reverseMirror:!0},{name:"Partial block",phases:["▏","▎","▍","▌","▋","▊","▉","█"],reverseMirror:!0},{name:"Clock",phases:["🕛","🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚"],reverseMirror:!1},{name:"Globe",phases:["🌍","🌎","🌏"],reverseMirror:!1},{name:"Arc",phases:["◜","◠","◝","◞","◡","◟"],reverseMirror:!1},{name:"Triangle",phases:["◤","◥","◢","◣"],reverseMirror:!1},{name:"Bouncing",phases:["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"],reverseMirror:!1},{name:"Dots",phases:[".","..","..."],reverseMirror:!1},{name:"Colors",phases:["🔴","🟠","🟡","🟢","🔵","🟣"],reverseMirror:!1}];function ti({onBack:e}){const{settings:{thinkingStyle:{phases:n,updateInterval:t,reverseMirror:r},themes:i},updateSettings:o}=pe(he),l=["reverseMirror","updateInterval","phases","presets"],[c,u]=B(0),d=l[c],[g,f]=B(0),[x,w]=B(0),[p,b]=B(!1),[I,T]=B(""),[S,E]=B(!1),[R,O]=B(!1),[V,D]=B(t.toString()),[Y,N]=B(0),k=nt(),J=(i.find(C=>C.id===k)||i.find(C=>C.id==="dark"))?.colors.claude||"rgb(215,119,87)";we(()=>{if(n.length>0){const C=r?[...n,...[...n].reverse().slice(1,-1)]:n,P=setInterval(()=>{N($=>($+1)%C.length)},t);return()=>clearInterval(P)}},[n,t,r]),de((C,P)=>{if(R){if(P.return){const $=parseInt(V);!isNaN($)&&$>0&&o(U=>{U.thinkingStyle.updateInterval=$}),O(!1)}else P.escape?(D(t.toString()),O(!1)):P.backspace||P.delete?D($=>$.slice(0,-1)):C&&C.match(/^[0-9]$/)&&D($=>$+C);return}if(p||S){if(P.return&&I.length){const $=S?[...n,I]:n.map((U,q)=>q===g?I:U);o(U=>{U.thinkingStyle.phases=$}),b(!1),T("")}else P.escape?(T(""),b(!1),E(!1)):P.backspace||P.delete?T($=>$.slice(0,-1)):C&&T($=>$+C);return}if(P.escape)e();else if(P.return)if(d==="updateInterval")D(t.toString()),O(!0);else if(d==="presets"){const $=Ee[x];o(U=>{U.thinkingStyle.phases=[...$.phases],U.thinkingStyle.reverseMirror=$.reverseMirror})}else d==="reverseMirror"&&o($=>{$.thinkingStyle.reverseMirror=!$.thinkingStyle.reverseMirror});else if(P.tab)P.shift?u($=>$===0?l.length-1:$-1):u($=>$===l.length-1?0:$+1);else if(P.upArrow)d==="phases"&&n.length>0?f($=>$>0?$-1:n.length-1):d==="presets"&&w($=>$>0?$-1:Ee.length-1);else if(P.downArrow)d==="phases"&&n.length>0?f($=>$<n.length-1?$+1:0):d==="presets"&&w($=>$<Ee.length-1?$+1:0);else if(C===" ")d==="reverseMirror"&&o($=>{$.thinkingStyle.reverseMirror=!$.thinkingStyle.reverseMirror});else if(C==="e"&&d==="phases")n.length>0&&(T(n[g]),b(!0));else if(C==="a"&&d==="phases")E(!0),T("");else if(C==="d"&&d==="phases")n.length>1&&(o($=>{$.thinkingStyle.phases=n.filter((U,q)=>q!==g)}),g>=n.length&&f(Math.max(0,n.length-1)));else if(C==="w"&&d==="phases"){if(g>0){const $=[...n];[$[g-1],$[g]]=[$[g],$[g-1]],o(U=>{U.thinkingStyle.phases=$}),f(U=>U-1)}}else if(C==="s"&&d==="phases"){if(g<n.length-1){const $=[...n];[$[g],$[g+1]]=[$[g+1],$[g]],o(U=>{U.thinkingStyle.phases=$}),f(U=>U+1)}}else P.ctrl&&C==="r"&&(o($=>{$.thinkingStyle=ee.thinkingStyle}),f(0),w(0))});const W=r?"●":"○",X=50,_=r?[...n,...[...n].reverse().slice(1,-1)]:n,v=_.length>0?_[Y]:"·";return s(m,{children:h(m,{flexDirection:"column",width:"100%",children:[h(m,{flexDirection:"row",width:"100%",children:[h(m,{marginBottom:1,flexDirection:"column",width:`${100-X}%`,children:[s(fe,{children:"Thinking style"}),h(m,{flexDirection:"column",children:[h(a,{dimColor:!0,children:["enter to"," ",d==="updateInterval"?"edit interval":d==="presets"?"apply preset":"save"]}),s(a,{dimColor:!0,children:"esc to go back"}),s(a,{dimColor:!0,children:"tab to switch sections"})]})]}),h(m,{width:`${X}%`,flexDirection:"column",children:[s(m,{children:s(a,{bold:!0,children:"Preview"})}),h(m,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[s(m,{width:(v?.length??0)+1,children:s(a,{color:J,children:v})}),h(a,{children:[s(a,{color:J,children:"Thinking… "}),s(a,{children:"(esc to interrupt)"})]})]})]})]}),h(m,{flexDirection:"row",gap:4,children:[h(m,{flexDirection:"column",children:[h(a,{children:[s(a,{color:d==="reverseMirror"?"yellow":void 0,children:d==="reverseMirror"?"❯ ":" "}),s(a,{bold:!0,color:d==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),d==="reverseMirror"&&h(a,{dimColor:!0,children:[" ","space to toggle"]}),s(m,{marginLeft:2,marginBottom:1,children:h(a,{children:[W," ",r?"Enabled":"Disabled"]})})]}),h(m,{flexDirection:"column",children:[h(a,{children:[s(a,{color:d==="updateInterval"?"yellow":void 0,children:d==="updateInterval"?"❯ ":" "}),s(a,{bold:!0,color:d==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),d==="updateInterval"&&(R?h(a,{dimColor:!0,children:[" ","enter to save"]}):h(a,{dimColor:!0,children:[" ","enter to edit"]})),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:R?"yellow":"gray",children:s(a,{children:R?V:t})})})]})]}),s(m,{children:h(a,{children:[s(a,{color:d==="phases"?"yellow":void 0,children:d==="phases"?"❯ ":" "}),s(a,{bold:!0,color:d==="phases"?"yellow":void 0,children:"Phases"})]})}),d==="phases"&&s(m,{marginBottom:1,flexDirection:"column",children:h(a,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),s(m,{marginLeft:2,marginBottom:1,children:h(m,{flexDirection:"column",children:[(()=>{const P=Math.max(0,g-Math.floor(4)),$=Math.min(n.length,P+8),U=Math.max(0,$-8),q=n.slice(U,$);return h($e,{children:[U>0&&h(a,{color:"gray",dimColor:!0,children:[" ","↑ ",U," more above"]}),q.map((K,te)=>{const ie=U+te;return h(a,{color:d==="phases"&&ie===g?"cyan":void 0,children:[d==="phases"&&ie===g?"❯ ":" ",K]},ie)}),$<n.length&&h(a,{color:"gray",dimColor:!0,children:[" ","↓ ",n.length-$," more below"]})]})})(),S&&h(m,{children:[s(a,{color:"yellow",children:"❯ "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(a,{children:I})})]}),p&&h(m,{marginTop:1,children:[s(a,{children:"Editing: "}),s(m,{borderStyle:"round",borderColor:"yellow",children:s(a,{children:I})})]})]})}),s(m,{children:h(a,{children:[s(a,{color:d==="presets"?"yellow":void 0,children:d==="presets"?"❯ ":" "}),s(a,{bold:!0,color:d==="presets"?"yellow":void 0,children:"Presets"})]})}),d==="presets"&&h(a,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{flexDirection:"column",children:(()=>{const P=Math.max(0,x-Math.floor(4)),$=Math.min(Ee.length,P+8),U=Math.max(0,$-8),q=Ee.slice(U,$);return h($e,{children:[U>0&&h(a,{color:"gray",dimColor:!0,children:[" ","↑ ",U," more above"]}),q.map((K,te)=>{const ie=U+te;return h(a,{color:d==="presets"&&ie===x?"cyan":void 0,children:[d==="presets"&&ie===x?"❯ ":" ",K.name," ",K.phases.join("")]},ie)}),$<Ee.length&&h(a,{color:"gray",dimColor:!0,children:[" ","↓ ",Ee.length-$," more below"]})]})})()})}),s(m,{marginTop:1,children:s(a,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}function ni(e,n){const t=$n(!0);we(()=>{if(t.current){t.current=!1;return}return e()},n)}const ut=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}],ye=[{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 ri({onBack:e}){const{settings:n,updateSettings:t}=pe(he),[r,i]=B(!1),[o,l]=B(!1),[c,u]=B(!1),[d,g]=B(()=>n.userMessageDisplay.format),[f,x]=B(()=>String(n.userMessageDisplay.paddingX)),[w,p]=B(()=>String(n.userMessageDisplay.paddingY)),[b,I]=B(n.userMessageDisplay.fitBoxToContent),[T,S]=B(0),[E,R]=B(()=>[...n.userMessageDisplay.styling]),[O,V]=B(()=>n.userMessageDisplay.foregroundColor==="default"?"default":"custom"),[D,Y]=B(()=>n.userMessageDisplay.foregroundColor==="default"?"rgb(255,255,255)":n.userMessageDisplay.foregroundColor),[N,k]=B(()=>{const j=n.userMessageDisplay.backgroundColor;return j===null?"none":j==="default"?"default":"custom"}),[y,J]=B(()=>{const j=n.userMessageDisplay.backgroundColor;return j===null||j==="default"?"rgb(0,0,0)":j}),[W,X]=B(()=>ye.findIndex(j=>j.value===n.userMessageDisplay.borderStyle)),[G,_]=B(()=>n.userMessageDisplay.borderColor),[v,C]=B(null),[P,$]=B(""),U=nt(),q=n.themes?.find(j=>j.id===U)||n.themes?.[0],[K,te]=B("text"),ie=["format","styling","foreground","background"],be=["borderStyle","borderColor","paddingX","paddingY","fitBoxToContent"],[Se,Ge]=B(0),[ot,Ye]=B(0),A=K==="text"?ie[Se]:be[ot],it=()=>{t(j=>{j.userMessageDisplay.format=d,j.userMessageDisplay.styling=[...E],j.userMessageDisplay.foregroundColor=O==="default"?"default":D,j.userMessageDisplay.backgroundColor=N==="none"?null:N==="default"?"default":y,j.userMessageDisplay.borderStyle=ye[W].value,j.userMessageDisplay.borderColor=G,j.userMessageDisplay.paddingX=parseInt(f)||0,j.userMessageDisplay.paddingY=parseInt(w)||0,j.userMessageDisplay.fitBoxToContent=b})},xn=()=>{g(ee.userMessageDisplay.format),R([...ee.userMessageDisplay.styling]),V("default"),Y("rgb(255,255,255)"),k("none"),J("rgb(0,0,0)"),X(ye.findIndex(j=>j.value===ee.userMessageDisplay.borderStyle)),_(ee.userMessageDisplay.borderColor),x(String(ee.userMessageDisplay.paddingX)),p(String(ee.userMessageDisplay.paddingY)),I(ee.userMessageDisplay.fitBoxToContent),t(j=>{j.userMessageDisplay={...ee.userMessageDisplay}})};ni(()=>{it()},[d,E,O,D,N,y,W,G,f,w,b]),de((j,Q)=>{if(r){Q.return?i(!1):Q.escape?(g(n.userMessageDisplay.format),i(!1)):Q.backspace||Q.delete?g(L=>L.slice(0,-1)):j&&g(L=>L+j);return}if(o){Q.return?l(!1):Q.escape?(x(String(n.userMessageDisplay.paddingX)),l(!1)):Q.backspace||Q.delete?x(L=>L.slice(0,-1)):j&&/^\d$/.test(j)&&x(L=>L+j);return}if(c){Q.return?u(!1):Q.escape?(p(String(n.userMessageDisplay.paddingY)),u(!1)):Q.backspace||Q.delete?p(L=>L.slice(0,-1)):j&&/^\d$/.test(j)&&p(L=>L+j);return}if(v===null){if(Q.escape)e();else if(Q.ctrl&&j==="r")xn();else if(Q.leftArrow||Q.rightArrow)te(L=>L==="text"?"border":"text");else if(Q.tab)K==="text"?Q.shift?Ge(L=>L===0?ie.length-1:L-1):Ge(L=>L===ie.length-1?0:L+1):Q.shift?Ye(L=>L===0?be.length-1:L-1):Ye(L=>L===be.length-1?0:L+1);else if(Q.return)A==="format"?i(!0):A==="paddingX"?l(!0):A==="paddingY"?u(!0):A==="foreground"?O==="custom"&&($(D),C("foreground")):A==="background"?N==="custom"&&($(y),C("background")):A==="borderColor"&&($(G),C("border"));else if(Q.upArrow)A==="styling"?S(L=>Math.max(0,L-1)):A==="borderStyle"?X(L=>L===0?ye.length-1:L-1):A==="foreground"?V(L=>{const ne=L==="default"?"custom":"default";return ne==="custom"&&(!D||D==="")&&Y("rgb(255,255,255)"),ne}):A==="background"&&k(L=>{const ne=L==="default"?"custom":L==="custom"?"none":"default";return ne==="custom"&&(!y||y==="")&&J("rgb(0,0,0)"),ne});else if(Q.downArrow)A==="styling"?S(L=>Math.min(ut.length-1,L+1)):A==="borderStyle"?X(L=>L===ye.length-1?0:L+1):A==="foreground"?V(L=>{const ne=L==="default"?"custom":"default";return ne==="custom"&&(!D||D==="")&&Y("rgb(255,255,255)"),ne}):A==="background"&&k(L=>{const ne=L==="default"?"none":L==="none"?"custom":"default";return ne==="custom"&&(!y||y==="")&&J("rgb(0,0,0)"),ne});else if(j===" ")if(A==="styling"){const L=ut[T].value,ne=E.indexOf(L)>=0?E.filter(Ie=>Ie!==L):[...E,L];R(ne)}else A==="fitBoxToContent"&&I(L=>!L)}});const Sn=j=>{const Q=O==="default"?q?.colors?.text:D,L=N==="none"?void 0:N==="default"?q?.colors?.userMessageBackground:y,ne=ye[W].value,Ie=parseInt(f)||0,Te=parseInt(w)||0,We=s(a,{bold:E.includes("bold"),italic:E.includes("italic"),underline:E.includes("underline"),strikethrough:E.includes("strikethrough"),inverse:E.includes("inverse"),color:Q,backgroundColor:L,children:j});if(ne==="topBottomSingle"||ne==="topBottomDouble"||ne==="topBottomBold"){const ze=ne==="topBottomSingle"?"─":ne==="topBottomDouble"?"═":"━",Me=j.length+Ie*2,It=ze.repeat(Me);return h(m,{flexDirection:"column",children:[s(a,{color:G,children:It}),Te>0&&s(m,{height:Te}),s(m,{paddingX:Ie,children:We}),Te>0&&s(m,{height:Te}),s(a,{color:G,children:It})]})}else if(ne!=="none"||Ie>0||Te>0||b){const ze=Ie>0||Te>0?s(m,{paddingX:Ie,paddingY:Te,children:We}):We,Me={};return ne!=="none"&&(Me.borderStyle=ne,Me.borderColor=G),b?Me.alignSelf="flex-start":Me.flexGrow=1,ne==="none"?ze:s(m,{...Me,children:ze})}else return We},yn=()=>{const Q=d.replace(/\{\}/g,"list the dir");return Sn(Q)};return v?s(cn,{initialValue:P,theme:q,onColorChange:j=>{v==="foreground"?Y(j):v==="background"?J(j):v==="border"&&_(j)},onExit:()=>{C(null),$("")}}):h(m,{flexDirection:"column",children:[s(fe,{children:"Customize how user messages are displayed"}),h(m,{flexDirection:"column",marginBottom:1,children:[s(a,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),s(a,{dimColor:!0,children:"enter to edit · ctrl+r to reset · esc to go back"})]}),h(m,{flexDirection:"row",gap:1,children:[h(m,{flexDirection:"column",width:"50%",borderStyle:K==="text"?"round":"single",borderColor:K==="text"?"yellow":"gray",paddingX:1,children:[s(m,{marginBottom:1,children:s(a,{bold:!0,color:K==="text"?"yellow":void 0,children:"Text & Styling"})}),s(m,{children:h(a,{color:A==="format"?"yellow":void 0,bold:A==="format",children:[A==="format"?"❯ ":" ","Format String"]})}),A==="format"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:r?"enter to save · esc to cancel":"enter to edit · use {} as message placeholder"})}),s(m,{marginLeft:2,marginBottom:1,children:s(m,{borderStyle:"round",borderColor:r?"yellow":"gray",children:s(a,{children:d})})}),s(m,{children:h(a,{color:A==="styling"?"yellow":void 0,bold:A==="styling",children:[A==="styling"?"❯ ":" ","Styling"]})}),A==="styling"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),s(m,{marginLeft:2,marginBottom:1,flexDirection:"column",children:ut.map((j,Q)=>s(m,{children:h(a,{color:A==="styling"&&T===Q?"cyan":void 0,children:[A==="styling"&&T===Q?"❯ ":" ",E.includes(j.value)?"●":"○"," ",j.label]})},j.value))}),h(m,{flexDirection:"row",gap:1,marginBottom:1,children:[h(m,{flexDirection:"column",width:"50%",children:[s(m,{children:h(a,{color:A==="foreground"?"yellow":void 0,bold:A==="foreground",children:[A==="foreground"?"❯ ":" ","Foreground"]})}),A==="foreground"&&s(m,{marginLeft:2,children:h(a,{dimColor:!0,children:["up/down · ",O==="custom"?"enter":""]})}),h(m,{marginLeft:2,flexDirection:"column",children:[s(m,{children:h(a,{children:[O==="default"?"● ":"○ ","Default"]})}),s(m,{children:h(a,{children:[O==="custom"?"● ":"○ ","Custom",O==="custom"&&": ",O==="custom"&&s(a,{color:D,children:D})]})})]})]}),h(m,{flexDirection:"column",width:"50%",children:[s(m,{children:h(a,{color:A==="background"?"yellow":void 0,bold:A==="background",children:[A==="background"?"❯ ":" ","Background"]})}),A==="background"&&s(m,{marginLeft:2,children:h(a,{dimColor:!0,children:["up/down · ",N==="custom"?"enter":""]})}),h(m,{marginLeft:2,flexDirection:"column",children:[s(m,{children:h(a,{children:[N==="default"?"● ":"○ ","Default"]})}),s(m,{children:h(a,{children:[N==="none"?"● ":"○ ","None"]})}),s(m,{children:h(a,{children:[N==="custom"?"● ":"○ ","Custom",N==="custom"&&": ",N==="custom"&&s(a,{backgroundColor:y,children:y})]})})]})]})]})]}),h(m,{flexDirection:"column",width:"50%",borderStyle:K==="border"?"round":"single",borderColor:K==="border"?"yellow":"gray",paddingX:1,children:[s(m,{marginBottom:1,children:s(a,{bold:!0,color:K==="border"?"yellow":void 0,children:"Border & Padding"})}),s(m,{children:h(a,{color:A==="borderStyle"?"yellow":void 0,bold:A==="borderStyle",children:[A==="borderStyle"?"❯ ":" ","Border Style"]})}),A==="borderStyle"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:"up/down to navigate"})}),h(m,{marginLeft:2,marginBottom:1,flexDirection:"row",children:[s(m,{flexDirection:"column",width:"50%",children:ye.slice(0,6).map((j,Q)=>s(m,{children:h(a,{color:A==="borderStyle"&&W===Q?"cyan":void 0,children:[A==="borderStyle"&&W===Q?"❯ ":" ",W===Q?"● ":"○ ",j.label]})},j.value))}),s(m,{flexDirection:"column",width:"50%",children:ye.slice(6).map((j,Q)=>{const L=Q+6;return s(m,{children:h(a,{color:A==="borderStyle"&&W===L?"cyan":void 0,children:[A==="borderStyle"&&W===L?"❯ ":" ",W===L?"● ":"○ ",j.label]})},j.value)})})]}),s(m,{children:h(a,{color:A==="borderColor"?"yellow":void 0,bold:A==="borderColor",children:[A==="borderColor"?"❯ ":" ","Border Color"]})}),A==="borderColor"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:"enter to pick color"})}),s(m,{marginLeft:2,marginBottom:1,children:s(a,{color:G,children:G})}),h(m,{flexDirection:"row",gap:1,children:[h(m,{flexDirection:"column",width:"33%",children:[s(m,{children:h(a,{color:A==="paddingX"?"yellow":void 0,bold:A==="paddingX",children:[A==="paddingX"?"❯ ":" ","Padding X"]})}),A==="paddingX"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:o?"enter/esc":"enter"})}),s(m,{marginLeft:2,children:s(m,{borderStyle:"round",borderColor:o?"yellow":"gray",children:s(a,{children:f})})})]}),h(m,{flexDirection:"column",width:"33%",children:[s(m,{children:h(a,{color:A==="paddingY"?"yellow":void 0,bold:A==="paddingY",children:[A==="paddingY"?"❯ ":" ","Padding Y"]})}),A==="paddingY"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:c?"enter/esc":"enter"})}),s(m,{marginLeft:2,children:s(m,{borderStyle:"round",borderColor:c?"yellow":"gray",children:s(a,{children:w})})})]}),h(m,{flexDirection:"column",width:"33%",children:[s(m,{children:h(a,{color:A==="fitBoxToContent"?"yellow":void 0,bold:A==="fitBoxToContent",children:[A==="fitBoxToContent"?"❯ ":" ",b?"●":"○"," Fit box to content"]})}),A==="fitBoxToContent"&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:"space"})})]})]})]})]}),h(m,{flexDirection:"column",marginTop:1,paddingX:1,children:[s(m,{marginBottom:1,children:s(a,{bold:!0,children:"Preview"})}),h(m,{flexDirection:"row",gap:2,children:[h(m,{flexDirection:"column",width:"50%",children:[s(m,{marginBottom:1,children:s(a,{underline:!0,children:"Before (Claude Code default):"})}),s(m,{marginLeft:1,children:h(a,{backgroundColor:q?.colors?.userMessageBackground,color:q?.colors?.text,children:[" ","> list the dir"," "]})}),s(m,{marginLeft:1,marginTop:1,children:h(a,{children:[s(a,{color:q?.colors?.inactive||"#888888",children:"●"}),s(a,{children:" The directory "}),s(a,{color:q?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(a,{children:" contains "}),s(a,{bold:!0,children:"123"}),s(a,{children:" files."})]})})]}),h(m,{flexDirection:"column",width:"50%",children:[s(m,{marginBottom:1,children:s(a,{underline:!0,children:"After (Your customization):"})}),s(m,{marginLeft:1,flexDirection:"row",children:yn()}),s(m,{marginLeft:1,marginTop:1,children:h(a,{children:[s(a,{color:q?.colors?.inactive||"#888888",children:"●"}),s(a,{children:" The directory "}),s(a,{color:q?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),s(a,{children:" contains "}),s(a,{bold:!0,children:"123"}),s(a,{children:" files."})]})})]})]})]})]})}const Ae=4;function oi({onSubmit:e}){const{settings:n,updateSettings:t}=pe(he),[r,i]=B(0),o={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEditPrompt:!1,hideStartupClawd:!1,increaseFileReadLimit:!1},l=()=>{n.misc||(n.misc={...o})},c=Tt(()=>[{id:"removeBorder",title:"Remove input box border",description:"Removes the rounded border around the input box for a cleaner look.",getValue:()=>n.inputBox?.removeBorder??!1,toggle:()=>{t(p=>{p.inputBox||(p.inputBox={removeBorder:!1}),p.inputBox.removeBorder=!p.inputBox.removeBorder})}},{id:"showVersion",title:"Show tweakcc version at startup",description:'Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.',getValue:()=>n.misc?.showTweakccVersion??!0,toggle:()=>{t(p=>{l(),p.misc.showTweakccVersion=!p.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:()=>n.misc?.showPatchesApplied??!0,toggle:()=>{t(p=>{l(),p.misc.showPatchesApplied=!p.misc.showPatchesApplied})}},{id:"expandThinking",title:"Expand thinking blocks",description:"Makes thinking blocks always expanded by default instead of collapsed.",getValue:()=>n.misc?.expandThinkingBlocks??!0,toggle:()=>{t(p=>{l(),p.misc.expandThinkingBlocks=!p.misc.expandThinkingBlocks})}},{id:"conversationTitle",title:"Allow renaming sessions via /title",description:"Enables /title and /rename commands for manually naming conversations.",getValue:()=>n.misc?.enableConversationTitle??!0,toggle:()=>{t(p=>{l(),p.misc.enableConversationTitle=!p.misc.enableConversationTitle})}},{id:"hideStartupBanner",title:"Hide startup banner",description:"Hides the startup banner message displayed before first prompt.",getValue:()=>n.misc?.hideStartupBanner??!1,toggle:()=>{t(p=>{l(),p.misc.hideStartupBanner=!p.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:()=>n.misc?.hideCtrlGToEditPrompt??!1,toggle:()=>{t(p=>{l(),p.misc.hideCtrlGToEditPrompt=!p.misc.hideCtrlGToEditPrompt})}},{id:"hideClawd",title:"Hide startup Clawd ASCII art",description:"Hides the Clawd ASCII art character shown at startup.",getValue:()=>n.misc?.hideStartupClawd??!1,toggle:()=>{t(p=>{l(),p.misc.hideStartupClawd=!p.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:()=>n.misc?.increaseFileReadLimit??!1,toggle:()=>{t(p=>{l(),p.misc.increaseFileReadLimit=!p.misc.increaseFileReadLimit})}}],[n,t]),u=c.length,d=u-1,g=Tt(()=>r<Ae?0:Math.min(r-Ae+1,u-Ae),[r,u]),f=c.slice(g,g+Ae),x=g>0,w=g+Ae<u;return de((p,b)=>{b.return||b.escape?e():b.upArrow?i(I=>Math.max(0,I-1)):b.downArrow?i(I=>Math.min(d,I+1)):p===" "&&c[r]?.toggle()}),h(m,{flexDirection:"column",children:[s(m,{marginBottom:1,children:s(fe,{children:"Miscellaneous Settings"})}),s(m,{marginBottom:1,children:s(a,{dimColor:!0,children:"Various tweaks and customizations. Press space to toggle settings, enter to go back."})}),x&&s(m,{children:h(a,{dimColor:!0,children:[" ↑ ",g," more above"]})}),f.map((p,b)=>{const T=g+b===r,S=p.getValue()?"☑":"☐";return h(m,{flexDirection:"column",children:[s(m,{children:h(a,{children:[s(a,{color:T?"cyan":void 0,children:T?"❯ ":" "}),s(a,{bold:!0,color:T?"cyan":void 0,children:p.title})]})}),s(m,{children:h(a,{dimColor:!0,children:[" ",p.description]})}),s(m,{marginLeft:4,marginBottom:1,children:h(a,{children:[S," ",p.getValue()?"Enabled":"Disabled"]})})]},p.id)}),w&&s(m,{children:h(a,{dimColor:!0,children:[" ","↓ ",u-g-Ae," more below"]})}),s(m,{marginTop:1,children:h(a,{dimColor:!0,children:["Item ",r+1," of ",u]})})]})}const Xe=["Task","Bash","Glob","Grep","Read","Edit","Write","NotebookEdit","WebFetch","WebSearch","BashOutput","KillShell","TodoWrite","AskUserQuestion","Skill","SlashCommand","EnterPlanMode","ExitPlanMode","LSP"];function ii({toolsetIndex:e,onBack:n}){const{settings:t,updateSettings:r}=pe(he),i=t.toolsets[e],[o,l]=B(i?.name||"New Toolset"),[c,u]=B(i?.allowedTools||[]),[d,g]=B(!1),[f,x]=B(0);we(()=>{i&&r(T=>{const S=T.toolsets[e].name;T.toolsets[e].name=o,T.toolsets[e].allowedTools=c,S!==o&&(T.defaultToolset===S&&(T.defaultToolset=o),T.planModeToolset===S&&(T.planModeToolset=o))})},[o,c]);const w=T=>c==="*"?!0:c.includes(T),p=T=>{T==="All"?u("*"):T==="None"?u([]):c==="*"?u(Xe.filter(S=>S!==T)):c.includes(T)?u(c.filter(S=>S!==T)):u([...c,T])};if(de((T,S)=>{if(d){S.return?g(!1):S.escape?(l(i?.name||"New Toolset"),g(!1)):S.backspace||S.delete?l(E=>E.slice(0,-1)):T&&T.length===1&&l(E=>E+T);return}if(S.escape)n();else if(S.upArrow)x(E=>Math.max(0,E-1));else if(S.downArrow)x(E=>Math.min(Xe.length+1,E+1));else if(T===" "||S.return)if(f===0)p("All");else if(f===1)p("None");else{const E=Xe[f-2];E&&p(E)}else T==="n"&&g(!0)}),!i)return s(m,{flexDirection:"column",children:s(a,{color:"red",children:"Toolset not found"})});const b=c==="*",I=Array.isArray(c)&&c.length===0;return h(m,{flexDirection:"column",children:[s(fe,{children:"Edit Toolset"}),s(m,{marginBottom:1,flexDirection:"column",children:s(a,{dimColor:!0,children:"n to edit name · space/enter to toggle · esc to go back"})}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{bold:!0,children:"Name:"}),s(m,{marginLeft:2,children:s(m,{borderStyle:"round",borderColor:d?"yellow":"gray",children:s(a,{children:o})})}),d&&s(m,{marginLeft:2,children:s(a,{dimColor:!0,children:"enter to save · esc to cancel"})})]}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{bold:!0,children:"Allowed Tools:"}),s(m,{marginLeft:2,children:h(a,{color:f===0?"cyan":void 0,children:[f===0?"❯ ":" ",b?"●":"○"," All"]})}),s(m,{marginLeft:2,children:h(a,{color:f===1?"cyan":void 0,children:[f===1?"❯ ":" ",I?"●":"○"," None"]})}),Xe.map((T,S)=>{const E=S+2;return s(m,{marginLeft:2,children:h(a,{color:f===E?"cyan":void 0,children:[f===E?"❯ ":" ",w(T)?"◉":"○"," ",T]})},T)})]}),s(m,{borderStyle:"round",padding:1,marginTop:1,children:h(m,{flexDirection:"column",children:[s(a,{bold:!0,children:"Summary:"}),h(a,{children:["Name: ",s(a,{color:"cyan",children:o})]}),h(a,{children:["Tools:"," ",c==="*"?s(a,{color:"green",children:"All tools (*)"}):c.length===0?s(a,{color:"red",children:"No tools ([])"}):h(a,{color:"yellow",children:[c.length," selected"]})]})]})})]})}function si({onBack:e}){const{settings:{toolsets:n,defaultToolset:t,planModeToolset:r,themes:i},updateSettings:o}=pe(he),l=nt(),c=i.find(V=>V.id===l)||i[0],u=ee.themes[0],d=c?.colors.planMode||u.colors.planMode,g=c?.colors.autoAccept||u.colors.autoAccept,[f,x]=B(0),[w,p]=B(null),[b,I]=B(!0),T=()=>{const V={name:"New Toolset",allowedTools:[]};o(D=>{D.toolsets.push(V)}),p(n.length),I(!1)},S=V=>{const D=n[V];o(Y=>{Y.toolsets.splice(V,1),Y.defaultToolset===D.name&&(Y.defaultToolset=null),Y.planModeToolset===D.name&&(Y.planModeToolset=null)}),f>=n.length-1&&x(Math.max(0,n.length-2))},E=V=>{const D=n[V];o(Y=>{Y.defaultToolset=D.name})},R=V=>{const D=n[V];o(Y=>{Y.planModeToolset=D.name})};if(de((V,D)=>{D.escape?e():D.upArrow?x(Y=>Math.max(0,Y-1)):D.downArrow?x(Y=>Math.min(n.length-1,Y+1)):D.return&&n.length>0?(p(f),I(!1)):V==="n"?T():V==="x"&&n.length>0?S(f):V==="d"&&n.length>0?E(f):V==="p"&&n.length>0&&R(f)},{isActive:b}),w!==null)return s(ii,{toolsetIndex:w,onBack:()=>{p(null),I(!0)}});const O=V=>V.allowedTools==="*"?"All tools":V.allowedTools.length===0?"No tools":`${V.allowedTools.length} tool${V.allowedTools.length===1?"":"s"}`;return h(m,{flexDirection:"column",children:[s(fe,{children:"Toolsets"}),h(m,{marginBottom:1,flexDirection:"column",children:[s(a,{dimColor:!0,children:"n to create a new toolset"}),n.length>0&&s(a,{dimColor:!0,children:"d to set as default toolset"}),n.length>0&&s(a,{dimColor:!0,children:"p to set as plan mode toolset"}),n.length>0&&s(a,{dimColor:!0,children:"x to delete a toolset"}),n.length>0&&s(a,{dimColor:!0,children:"enter to edit toolset"}),s(a,{dimColor:!0,children:"esc to go back"})]}),n.length===0?s(a,{children:"No toolsets created yet. Press n to create one."}):s(m,{flexDirection:"column",children:n.map((V,D)=>{const Y=V.name===t,N=V.name===r,k=f===D;let y;return k&&(y="yellow"),h(m,{flexDirection:"row",children:[h(a,{color:y,children:[k?"❯ ":" ",V.name," "]}),h(a,{color:y,children:["(",O(V),")"]}),Y&&s(a,{color:g,children:" ⏵⏵ accept edits"}),N&&s(a,{color:d,children:" ⏸ plan mode"})]},D)})})]})}const he=Cn({settings:ee,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function li({startupCheckInfo:e,configMigrated:n}){const[t,r]=B({settings:ee,changesApplied:!1,ccVersion:"",lastModified:""}),[i,o]=B(!1);we(()=>{(async()=>{const p=await He();r(p),o(!p.hidePiebaldAnnouncement)})()},[]);const l=Lt(w=>{const p=JSON.parse(JSON.stringify(t.settings));w(p),r(b=>({...b,settings:p,changesApplied:!1})),Ne(b=>{b.settings=p,b.changesApplied=!1})},[t.settings]),[c,u]=B(null),[d,g]=B(null);we(()=>{e.wasUpdated&&e.oldVersion&&(g({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
|
|
659
660
|
(However, your customization are still remembered in ${ce}.)
|
|
660
|
-
Please reapply your changes below.`,type:"warning"}),l(()=>{}))},[]),de((w,p)=>{p.ctrl&&w==="c"&&process.exit(0),(w==="q"||p.escape)&&!c&&process.exit(0),w==="h"&&!c&&i&&(o(!1),Ne(b=>{b.hidePiebaldAnnouncement=!0}))},{isActive:!c});const f=w=>{switch(g(null),w){case Z.APPLY_CHANGES:e.ccInstInfo&&(g({message:"Applying patches...",type:"info"}),rn(t,e.ccInstInfo).then(p=>{r(p),g({message:"Customization patches applied successfully!",type:"success"})}));break;case Z.THEMES:case Z.THINKING_VERBS:case Z.THINKING_STYLE:case Z.USER_MESSAGE_DISPLAY:case Z.MISC:case Z.TOOLSETS:u(w);break;case Z.VIEW_SYSTEM_PROMPTS:
|
|
661
|
+
Please reapply your changes below.`,type:"warning"}),l(()=>{}))},[]),de((w,p)=>{p.ctrl&&w==="c"&&process.exit(0),(w==="q"||p.escape)&&!c&&process.exit(0),w==="h"&&!c&&i&&(o(!1),Ne(b=>{b.hidePiebaldAnnouncement=!0}))},{isActive:!c});const f=w=>{switch(g(null),w){case Z.APPLY_CHANGES:e.ccInstInfo&&(g({message:"Applying patches...",type:"info"}),rn(t,e.ccInstInfo).then(p=>{r(p),g({message:"Customization patches applied successfully!",type:"success"})}));break;case Z.THEMES:case Z.THINKING_VERBS:case Z.THINKING_STYLE:case Z.USER_MESSAGE_DISPLAY:case Z.MISC:case Z.TOOLSETS:u(w);break;case Z.VIEW_SYSTEM_PROMPTS:Mo(xe);break;case Z.RESTORE_ORIGINAL:e.ccInstInfo&&(e.ccInstInfo.nativeInstallationPath?en(e.ccInstInfo):Zt(e.ccInstInfo)).then(()=>{g({message:"Original Claude Code restored successfully!",type:"success"}),l(()=>{})});break;case Z.OPEN_CONFIG:At(ce);break;case Z.OPEN_CLI:e.ccInstInfo?.cliPath&&At(e.ccInstInfo.cliPath);break;case Z.EXIT:process.exit(0)}},x=()=>{u(null)};return s(he.Provider,{value:{settings:t.settings,updateSettings:l,changesApplied:t.changesApplied,ccVersion:e.ccInstInfo?.version||""},children:s(m,{flexDirection:"column",children:c===null?s(Jo,{onSubmit:f,notification:d,configMigrated:n,showPiebaldAnnouncement:i}):c===Z.THEMES?s(Zo,{onBack:x}):c===Z.THINKING_VERBS?s(ei,{onBack:x}):c===Z.THINKING_STYLE?s(ti,{onBack:x}):c===Z.USER_MESSAGE_DISPLAY?s(ri,{onBack:x}):c===Z.MISC?s(oi,{onSubmit:x}):c===Z.TOOLSETS?s(si,{onBack:x}):null})})}const ai=()=>{const e=[],n=process.platform=="win32"?Ce.homedir().replace(/\\/g,"/"):Ce.homedir(),t="node_modules/@anthropic-ai/claude-code",r=(i,o=!1)=>{if(o)try{const l=Ft(i,{onlyFiles:!1});e.push({pattern:i,isGlob:!0,expandedPaths:l})}catch(l){l instanceof Error&&"code"in l&&(l.code==="EACCES"||l.code==="EPERM")?M(`Permission denied accessing: ${i} (${l.code})`):M(`Error expanding glob pattern "${i}": ${l instanceof Error?l.message:String(l)}`),e.push({pattern:i,isGlob:!0,expandedPaths:[]})}else e.push({pattern:i,isGlob:!1,expandedPaths:[i]})};return r(`${Ce.homedir()}/.claude/local/${t}`),process.env.NPM_PREFIX&&r(`${process.env.NPM_PREFIX}/lib/${t}`),process.env.N_PREFIX&&r(`${process.env.N_PREFIX}/lib/${t}`),process.env.VOLTA_HOME&&r(`${process.env.VOLTA_HOME}/lib/${t}`),process.env.FNM_DIR&&r(`${process.env.FNM_DIR}/lib/${t}`),process.env.NVM_DIR&&r(`${process.env.NVM_DIR}/lib/${t}`),process.env.NODENV_ROOT&&r(`${process.env.NODENV_ROOT}/versions/*/lib/${t}`,!0),process.env.NVS_HOME&&r(`${process.env.NVS_HOME}/node/*/*/lib/${t}`,!0),process.env.ASDF_DATA_DIR&&r(`${process.env.ASDF_DATA_DIR}/installs/nodejs/*/lib/${t}`,!0),process.platform=="win32"?(r(`${n}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${t}`),r(`${n}/AppData/Roaming/npm/${t}`),r(`${n}/AppData/Roaming/nvm/*/${t}`,!0),r(`${n}/AppData/Local/Yarn/config/global/${t}`),r(`${n}/AppData/Local/pnpm/global/*/${t}`,!0),r(`C:/nvm4w/nodejs/${t}`),r(`${n}/n/versions/node/*/lib/${t}`,!0),r(`${n}/AppData/Roaming/Yarn/config/global/${t}`),r(`${n}/AppData/Roaming/pnpm-global/${t}`),r(`${n}/AppData/Roaming/pnpm-global/*/${t}`,!0),r(`${n}/.bun/install/global/${t}`),r(`${n}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${n}/AppData/Local/Bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${n}/AppData/Local/fnm_multishells/*/node_modules/${t}`,!0),r(`${n}/AppData/Local/mise/installs/node/*/${t}`,!0),r(`${n}/AppData/Local/mise/installs/npm-anthropic-ai-claude-code/*/${t}`,!0)):(process.platform=="darwin"&&(r(`${n}/Library/${t}`),r(`/opt/local/lib/${t}`),r(`${n}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${n}/Library/Caches/bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0)),r(`${n}/.local/lib/${t}`),r(`${n}/.local/share/${t}`),r(`${n}/.npm-global/lib/${t}`),r(`${n}/.npm-packages/lib/${t}`),r(`${n}/.npm/lib/${t}`),r(`${n}/npm/lib/${t}`),r(`/etc/${t}`),r(`/lib/${t}`),r(`/opt/node/lib/${t}`),r(`/usr/lib/${t}`),r(`/usr/local/lib/${t}`),r(`/usr/share/${t}`),r(`/var/lib/${t}`),r(`/opt/homebrew/lib/${t}`),r(`${n}/.linuxbrew/lib/${t}`),r(`${n}/.config/yarn/global/${t}`),r(`${n}/.yarn/global/${t}`),r(`${n}/.bun/install/global/${t}`),r(`${n}/.pnpm-global/${t}`),r(`${n}/.pnpm-global/*/${t}`,!0),r(`${n}/pnpm-global/${t}`),r(`${n}/pnpm-global/*/${t}`,!0),r(`${n}/.local/share/pnpm/global/${t}`),r(`${n}/.local/share/pnpm/global/*/${t}`,!0),r(`${n}/.bun/install/global/${t}`),r(`${n}/.bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`${n}/.local/share/bun/install/cache/@anthropic-ai/claude-code*@@@*`,!0),r(`/usr/local/n/versions/node/*/lib/${t}`,!0),r(`${n}/n/versions/node/*/lib/${t}`,!0),r(`${n}/n/lib/${t}`),r(`${n}/.volta/tools/image/node/*/lib/${t}`,!0),r(`${n}/.fnm/node-versions/*/installation/lib/${t}`,!0),r(`${n}/.local/state/fnm_multishells/*/lib/${t}`,!0),r(`/usr/local/nvm/versions/node/*/lib/${t}`,!0),r(`/usr/local/share/nvm/versions/node/*/lib/${t}`,!0),r(`${n}/.nvm/versions/node/*/lib/${t}`,!0),r(`${n}/.nodenv/versions/*/lib/${t}`,!0),r(`${n}/.nvs/*/lib/${t}`,!0),r(`${n}/.asdf/installs/nodejs/*/lib/${t}`,!0),process.env.MISE_DATA_DIR&&r(`${process.env.MISE_DATA_DIR}/installs/node/*/lib/${t}`,!0),r(`${n}/.local/share/mise/installs/node/*/lib/${t}`,!0),process.env.MISE_DATA_DIR&&r(`${process.env.MISE_DATA_DIR}/installs/npm-anthropic-ai-claude-code/*/lib/${t}`,!0),r(`${n}/.local/share/mise/installs/npm-anthropic-ai-claude-code/*/lib/${t}`,!0)),process.platform=="win32"&&e.forEach(i=>{i.pattern=i.pattern.replace(/\//g,"\\"),i.expandedPaths=i.expandedPaths.map(o=>o.replace(/\//g,"\\"))}),e},ci=ai(),di=ci.flatMap(e=>e.expandedPaths),ui=()=>{const e=process.platform==="win32"?Ce.homedir().replace(/\\/g,"/"):Ce.homedir(),n=[],t=(r,i=!1)=>{if(i)try{const o=Ft(r,{onlyFiles:!0});n.push({pattern:r,isGlob:!0,expandedPaths:o})}catch(o){o instanceof Error&&"code"in o&&(o.code==="EACCES"||o.code==="EPERM")?M(`Permission denied accessing: ${r} (${o.code})`):M(`Error expanding glob pattern "${r}": ${o instanceof Error?o.message:String(o)}`),n.push({pattern:r,isGlob:!0,expandedPaths:[]})}else n.push({pattern:r,isGlob:!1,expandedPaths:[r]})};return t(`${e}/.local/bin/claude`),t(`${e}/.local/share/claude/versions/*`,!0),process.platform==="win32"&&n.forEach(r=>{r.pattern=r.pattern.replace(/\//g,"\\"),r.expandedPaths=r.expandedPaths.map(i=>i.replace(/\//g,"\\"))}),n},hi=ui(),mi=hi.flatMap(e=>e.expandedPaths);var ve=class extends Error{constructor(e){super(e),this.name="InstallationDetectionError"}};let ht=null;async function gi(){return ht||(ht=Tn.create()),ht}async function fi(e,n=4096){try{const t=await re.open(e,"r");try{const r=Buffer.allocUnsafe(n),{bytesRead:i}=await t.read({buffer:r,position:0,length:n});return i<=0?null:r.subarray(0,i)}finally{await t.close()}}catch(t){return M("Failed to read file prefix:",t),null}}async function mt(e){try{const n=await re.realpath(e);M(`resolvePathToInstallationType: ${e} -> ${n}`);const t=await fi(n);if(!t)return M("resolvePathToInstallationType: Could not read file prefix"),null;const r=await gi();let i=null;if(typeof r.detect=="function"&&(i=r.detect(t)||null),!i)return M("resolvePathToInstallationType: WASMagic returned no mime type"),null;const o=i.toLowerCase();return M(`resolvePathToInstallationType: Detected mime type: ${o}`),o.includes("javascript")?{kind:"npm-based",resolvedPath:n}:o.startsWith("text/")?(M("resolvePathToInstallationType: Unrecognized file type"),null):{kind:"native-binary",resolvedPath:n}}catch(n){return M("resolvePathToInstallationType: Error:",n),null}}async function pi(){try{const e=await In("claude");return M(`getClaudeFromPath: Found claude at ${e}`),e}catch{return M("getClaudeFromPath: claude not found on PATH"),null}}function dn(e){const n=/\bVERSION:"(\d+\.\d+\.\d+)"/g,t=new Map;let r;for(;(r=n.exec(e))!==null;){const l=r[1];t.set(l,(t.get(l)||0)+1)}if(t.size===0)return null;let i=0,o;for(const[l,c]of t.entries())M(`Found version ${l} with ${c} occurrences`),c>i&&(i=c,o=l);return o&&M(`Extracted version ${o} (${i} occurrences)`),o||null}async function un(e){const n=await re.readFile(e,"utf8"),t=dn(n);if(!t)throw new Error(`No VERSION strings found in JS file: ${e}`);return t}async function bi(e){const n=await jt(e);if(!n)throw new Error(`Could not extract JS from native binary: ${e}`);const t=n.toString("utf8"),r=dn(t);if(!r)throw new Error(`No VERSION strings found in extracted JS from: ${e}`);return r}function wi(e){const n=le.basename(e),t=n.match(/^(\d+\.\d+\.\d+)$/);return t?t[1]:null}async function qe(e,n){const t=wi(e);return t?(M(`extractVersion: Got version ${t} from filename`),t):n==="npm-based"?un(e):bi(e)}async function xi(){const e=[],n=new Set;for(const r of di){const i=le.join(r,"cli.js");if(!n.has(i))try{if(await _e(i)){M(`collectCandidates: Found cli.js at ${i}`);const o=await un(i);e.push({path:i,kind:"npm-based",version:o}),n.add(i)}}catch(o){M(`collectCandidates: Error checking ${i}:`,o)}}for(const r of mi)if(!n.has(r))try{if(await _e(r)){M(`collectCandidates: Found native binary at ${r}`);const i=await qe(r,"native-binary");e.push({path:r,kind:"native-binary",version:i}),n.add(r)}}catch(i){M(`collectCandidates: Error checking ${r}:`,i)}return[...e].sort((r,i)=>ko(r.version,i.version))}function Si(e){return e.map(n=>` • ${n.path} (${n.kind}, v${n.version})`).join(`
|
|
661
662
|
`)}function hn(e){return` 2. Set ccInstallationPath in your config file (${ce}):
|
|
662
663
|
|
|
663
664
|
{
|
|
664
665
|
"ccInstallationPath": "${e}"
|
|
665
666
|
}`}function mn(e){return` 1. Set the TWEAKCC_CC_INSTALLATION_PATH environment variable:
|
|
666
667
|
|
|
667
|
-
export TWEAKCC_CC_INSTALLATION_PATH="${e}"`}function
|
|
668
|
+
export TWEAKCC_CC_INSTALLATION_PATH="${e}"`}function yi(e){const n=e[0]?.path||"/path/to/claude";return`Multiple Claude Code installations found.
|
|
668
669
|
|
|
669
670
|
Found installations:
|
|
670
|
-
${
|
|
671
|
+
${Si(e)}
|
|
671
672
|
|
|
672
673
|
To specify which installation to use, either:
|
|
673
674
|
|
|
@@ -683,11 +684,10 @@ ${hn("/path/to/claude")}
|
|
|
683
684
|
|
|
684
685
|
3. Install Claude Code:
|
|
685
686
|
• npm install -g @anthropic-ai/claude-code
|
|
686
|
-
• Or download from https://claude.ai/download`}function
|
|
687
|
-
Expected a Claude Code cli.js file or native binary.`);const l=await qe(o.resolvedPath,o.kind);return je()&&o.kind==="npm-based"&&M(`SHA256 hash: ${await lt(o.resolvedPath)}`),M(`Using Claude Code from TWEAKCC_CC_INSTALLATION_PATH: ${o.resolvedPath} (${o.kind}, v${l})`),
|
|
688
|
-
Expected a Claude Code cli.js file or native binary.`);const c=await qe(l.resolvedPath,l.kind);return je()&&l.kind==="npm-based"&&M(`SHA256 hash: ${await lt(l.resolvedPath)}`),M(`Using Claude Code from ccInstallationPath: ${l.resolvedPath} (${l.kind}, v${c})`),
|
|
689
|
-
Expected a Claude Code cli.js file or native binary.`);const l=await qe(o.resolvedPath,o.kind);return je()&&o.kind==="npm-based"&&M(`SHA256 hash: ${await lt(o.resolvedPath)}`),M(`Using Claude Code from PATH: ${o.resolvedPath} (${o.kind}, v${l})`),Fe(o.resolvedPath,o.kind,l,"path")}M("Collecting candidates from hardcoded search paths...");const i=await wi();if(i.length===0){if(n.interactive)return null;throw new we(gn())}if(i.length===1){const o=i[0];return M(`Using single candidate: ${o.path} (${o.kind}, v${o.version})`),Fe(o.path,o.kind,o.version,"search-paths")}if(!n.interactive)throw new we(Si(i));return{version:"",source:"search-paths",_pendingCandidates:i}}function vi(e){return e._pendingCandidates||null}async function Ci(e){return M(`Saving selected installation to config: ${e.path}`),await Ne(n=>{n.ccInstallationPath=e.path}),Fe(e.path,e.kind,e.version,"config")}function fn(){return gn()}async function pn(e){const n=await He(),t=await yi(n,e);if(!t)return{startupCheckInfo:null,pendingCandidates:null};const r=vi(t);return r?{startupCheckInfo:null,pendingCandidates:r}:{startupCheckInfo:await bn(n,t),pendingCandidates:null}}async function bn(e,n){if(!n)return null;if(n.version)try{const l=await _r(n.version);Pr(l)}catch{}const t=n.version,r=e.ccVersion;let i=!1;await _e(De)||(M(`startupCheck: ${De} not found; backing up cli.js`),await Bt(n),i=!0);let o=!1;return n.nativeInstallationPath&&!await _e(ge)&&(M(`startupCheck: ${ge} not found; backing up native binary`),await Pt(n),o=!0),t!==r?(i||(M(`startupCheck: real version (${t}) != backed up version (${r}); backing up cli.js`),await re.unlink(De),await Bt(n)),n.nativeInstallationPath&&!o&&(M(`startupCheck: real version (${t}) != backed up version (${r}); backing up native binary`),await _e(ge)&&await re.unlink(ge),await Pt(n)),{wasUpdated:!0,oldVersion:r,newVersion:t,ccInstInfo:n}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:n}}function $i({candidates:e,onSelect:n}){const[t,r]=B(0);return de((i,o)=>{o.escape?process.exit(0):o.upArrow?r(l=>l>0?l-1:e.length-1):o.downArrow?r(l=>l<e.length-1?l+1:0):o.return&&n(e[t])}),h(m,{flexDirection:"column",children:[s(a,{bold:!0,color:"yellow",children:"No claude executable was found in PATH, and multiple Claude Code installations were found. Please select one:"}),s(a,{children:" "}),e.map((i,o)=>h(m,{children:[h(a,{bold:o===t,color:o===t?"cyan":void 0,children:[o===t?"❯ ":" ",i.path]}),h(a,{dimColor:!0,children:[" ","(",i.kind,", v",i.version,")"]})]},i.path)),s(a,{children:" "}),h(a,{children:["Your choice will be saved to"," ",s(a,{color:"blue",children:"ccInstallationPath"})," in"," ",h(a,{color:"blue",children:[se.replace(Re.homedir(),"~"),"/config.json"]}),"."]}),s(a,{children:" "}),s(a,{dimColor:!0,children:"Use ↑↓ arrows to navigate, Enter to select, Esc to quit"})]})}const _i=async()=>{const e=new vn;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("3.2.0").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const n=e.opts();n.debug&&$o();const t=await No();if(n.apply){await Ii();return}await Ti(t)};async function Ii(){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${ce}`);const e=await He();(!e.settings||Object.keys(e.settings).length===0)&&(console.error("No saved customizations found in "+ce),process.exit(1));try{const n=await pn({interactive:!1});(!n.startupCheckInfo||!n.startupCheckInfo.ccInstInfo)&&(console.error(fn()),process.exit(1));const{ccInstInfo:t}=n.startupCheckInfo;t.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${t.nativeInstallationPath}`):console.log(`Found Claude Code at: ${t.cliPath}`),console.log(`Version: ${t.version}`),console.log("Loading system prompts...");const r=await Xt(t.version);r.success||(console.log(F.red(`
|
|
687
|
+
• Or download from https://claude.ai/download`}function Ve(e,n,t,r){return n==="npm-based"?{cliPath:e,version:t,source:r}:{nativeInstallationPath:e,version:t,source:r}}async function vi(e,n){const t=process.env.TWEAKCC_CC_INSTALLATION_PATH?.trim();if(t&&t.length>0){if(M(`Checking TWEAKCC_CC_INSTALLATION_PATH: ${t}`),!await _e(t))throw new ve(`TWEAKCC_CC_INSTALLATION_PATH is set to '${t}' but file does not exist.`);const o=await mt(t);if(!o)throw new ve(`Unable to detect installation type from TWEAKCC_CC_INSTALLATION_PATH value '${t}'.
|
|
688
|
+
Expected a Claude Code cli.js file or native binary.`);const l=await qe(o.resolvedPath,o.kind);return je()&&o.kind==="npm-based"&&M(`SHA256 hash: ${await lt(o.resolvedPath)}`),M(`Using Claude Code from TWEAKCC_CC_INSTALLATION_PATH: ${o.resolvedPath} (${o.kind}, v${l})`),Ve(o.resolvedPath,o.kind,l,"env-var")}if(e.ccInstallationPath){const o=e.ccInstallationPath;if(M(`Checking ccInstallationPath: ${o}`),!await _e(o))throw new ve(`ccInstallationPath is set to '${o}' but file does not exist.`);const l=await mt(o);if(!l)throw new ve(`Unable to detect installation type from configured ccInstallationPath '${o}'.
|
|
689
|
+
Expected a Claude Code cli.js file or native binary.`);const c=await qe(l.resolvedPath,l.kind);return je()&&l.kind==="npm-based"&&M(`SHA256 hash: ${await lt(l.resolvedPath)}`),M(`Using Claude Code from ccInstallationPath: ${l.resolvedPath} (${l.kind}, v${c})`),Ve(l.resolvedPath,l.kind,c,"config")}const r=await pi();if(r){M(`Checking claude on PATH: ${r}`);const o=await mt(r);if(!o)M(`Unable to detect installation type from 'claude' on PATH (${r}). Falling back to hardcoded search paths.`);else{const l=await qe(o.resolvedPath,o.kind);return je()&&o.kind==="npm-based"&&M(`SHA256 hash: ${await lt(o.resolvedPath)}`),M(`Using Claude Code from PATH: ${o.resolvedPath} (${o.kind}, v${l})`),Ve(o.resolvedPath,o.kind,l,"path")}}M("Collecting candidates from hardcoded search paths...");const i=await xi();if(i.length===0){if(n.interactive)return null;throw new ve(gn())}if(i.length===1){const o=i[0];return M(`Using single candidate: ${o.path} (${o.kind}, v${o.version})`),Ve(o.path,o.kind,o.version,"search-paths")}if(!n.interactive)throw new ve(yi(i));return{version:"",source:"search-paths",_pendingCandidates:i}}function Ci(e){return e._pendingCandidates||null}async function $i(e){return M(`Saving selected installation to config: ${e.path}`),await Ne(n=>{n.ccInstallationPath=e.path}),Ve(e.path,e.kind,e.version,"config")}function fn(){return gn()}async function pn(e){const n=await He(),t=await vi(n,e);if(!t)return{startupCheckInfo:null,pendingCandidates:null};const r=Ci(t);return r?{startupCheckInfo:null,pendingCandidates:r}:{startupCheckInfo:await bn(n,t),pendingCandidates:null}}async function bn(e,n){if(!n)return null;if(n.version)try{const l=await $r(n.version);Br(l)}catch{}const t=n.version,r=e.ccVersion;let i=!1;await _e(De)||(M(`startupCheck: ${De} not found; backing up cli.js`),await Bt(n),i=!0);let o=!1;return n.nativeInstallationPath&&!await _e(ge)&&(M(`startupCheck: ${ge} not found; backing up native binary`),await Pt(n),o=!0),t!==r?(i||(M(`startupCheck: real version (${t}) != backed up version (${r}); backing up cli.js`),await re.unlink(De),await Bt(n)),n.nativeInstallationPath&&!o&&(M(`startupCheck: real version (${t}) != backed up version (${r}); backing up native binary`),await _e(ge)&&await re.unlink(ge),await Pt(n)),{wasUpdated:!0,oldVersion:r,newVersion:t,ccInstInfo:n}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:n}}function _i({candidates:e,onSelect:n}){const[t,r]=B(0);return de((i,o)=>{o.escape?process.exit(0):o.upArrow?r(l=>l>0?l-1:e.length-1):o.downArrow?r(l=>l<e.length-1?l+1:0):o.return&&n(e[t])}),h(m,{flexDirection:"column",children:[s(a,{bold:!0,color:"yellow",children:"No claude executable was found in PATH, and multiple Claude Code installations were found. Please select one:"}),s(a,{children:" "}),e.map((i,o)=>h(m,{children:[h(a,{bold:o===t,color:o===t?"cyan":void 0,children:[o===t?"❯ ":" ",i.path]}),h(a,{dimColor:!0,children:[" ","(",i.kind,", v",i.version,")"]})]},i.path)),s(a,{children:" "}),h(a,{children:["Your choice will be saved to"," ",s(a,{color:"blue",children:"ccInstallationPath"})," in"," ",h(a,{color:"blue",children:[se.replace(Re.homedir(),"~"),"/config.json"]}),"."]}),s(a,{children:" "}),s(a,{dimColor:!0,children:"Use ↑↓ arrows to navigate, Enter to select, Esc to quit"})]})}const Ii=async()=>{const e=new vn;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("3.2.2").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const n=e.opts();n.debug&&_o();const t=await Bo();if(n.apply){await Ti();return}await Mi(t)};async function Ti(){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${ce}`);const e=await He();(!e.settings||Object.keys(e.settings).length===0)&&(console.error("No saved customizations found in "+ce),process.exit(1));try{const n=await pn({interactive:!1});(!n.startupCheckInfo||!n.startupCheckInfo.ccInstInfo)&&(console.error(fn()),process.exit(1));const{ccInstInfo:t}=n.startupCheckInfo;t.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${t.nativeInstallationPath}`):console.log(`Found Claude Code at: ${t.cliPath}`),console.log(`Version: ${t.version}`),console.log("Loading system prompts...");const r=await Xt(t.version);r.success||(console.log(F.red(`
|
|
690
690
|
✖ Error downloading system prompts:`)),console.log(F.red(` ${r.errorMessage}`)),console.log(F.yellow(`
|
|
691
|
-
⚠ System prompts not available - skipping system prompt customizations`))),console.log("Applying customizations..."),await rn(e,t),console.log("Customizations applied successfully!"),process.exit(0)}catch(n){throw n instanceof
|
|
691
|
+
⚠ System prompts not available - skipping system prompt customizations`))),console.log("Applying customizations..."),await rn(e,t),console.log("Customizations applied successfully!"),process.exit(0)}catch(n){throw n instanceof ve&&(console.error(F.red(`Error: ${n.message}`)),process.exit(1)),n}}async function Mi(e){try{const n=await pn({interactive:!0});if(n.pendingCandidates){await Ei(n.pendingCandidates,e);return}n.startupCheckInfo||(console.error(F.red(fn())),process.exit(1)),await wn(n.startupCheckInfo,e)}catch(n){throw n instanceof ve&&(console.error(F.red(`Error: ${n.message}`)),process.exit(1)),n}}async function Ei(e,n){return new Promise((t,r)=>{const o=Dt(s(_i,{candidates:e,onSelect:async l=>{try{const c=await $i(l),u=await He(),d=await bn(u,c);d||(console.error(F.red("Error: Failed to complete startup check after selection.")),process.exit(1)),o.unmount(),await wn(d,n),t()}catch(c){r(c)}}}))})}async function wn(e,n){const t=await Xt(e.ccInstInfo.version);t.success||(console.log(F.red(`
|
|
692
692
|
✖ Error downloading system prompts:`)),console.log(F.red(` ${t.errorMessage}`)),console.log(F.yellow(`⚠ System prompts not available - system prompt customizations will be skipped
|
|
693
|
-
`))),Dt(s(
|
|
693
|
+
`))),Dt(s(li,{startupCheckInfo:e,configMigrated:n}))}Ii();export{M as b,je as c};
|