blade-code 0.3.3 → 0.3.4

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.
@@ -259,7 +259,7 @@ Error generating stack: `+r.message+`
259
259
 
260
260
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
261
261
 
262
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},DU="DialogDescriptionWarning",LU=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${MI(DU).contentName}}.`;return v.useEffect(()=>{var a;const i=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},MU=EI,BU=kI,BI=CI,FI=AI,UI=NI,jI=II,FU=DI;const yi=MU,UU=BU,PI=v.forwardRef(({className:e,...t},n)=>h.jsx(BI,{ref:n,className:J("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));PI.displayName=BI.displayName;const Br=v.forwardRef(({className:e,children:t,hideCloseButton:n,...r},i)=>h.jsxs(UU,{children:[h.jsx(PI,{}),h.jsxs(FI,{ref:i,className:J("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,!n&&h.jsxs(FU,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(nr,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Br.displayName=FI.displayName;const Fr=v.forwardRef(({className:e,...t},n)=>h.jsx(UI,{ref:n,className:J("text-lg font-semibold leading-none tracking-tight",e),...t}));Fr.displayName=UI.displayName;const jU=v.forwardRef(({className:e,...t},n)=>h.jsx(jI,{ref:n,className:J("text-sm text-muted-foreground",e),...t}));jU.displayName=jI.displayName;const PU=e=>e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches:e==="dark",Gu=e=>{const t=document.documentElement;if(t.classList.remove("light","dark"),e==="system"){const n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";t.classList.add(n)}else t.classList.add(e)},ar={language:"zh-CN",theme:"dracula",uiTheme:"system",autoSaveSessions:!0,notifyBuild:!0,notifyErrors:!1,notifySounds:!1,privacyTelemetry:!1,privacyCrash:!0},Py=Lh((e,t)=>({...ar,isLoading:!1,error:null,loadSettings:async()=>{e({isLoading:!0,error:null});try{const n=await fetch("/configs");if(!n.ok)throw new Error("Failed to load settings");const r=await n.json(),i=r.uiTheme??ar.uiTheme;e({language:r.language??ar.language,theme:r.theme??ar.theme,uiTheme:i,autoSaveSessions:r.autoSaveSessions??ar.autoSaveSessions,notifyBuild:r.notifyBuild??ar.notifyBuild,notifyErrors:r.notifyErrors??ar.notifyErrors,notifySounds:r.notifySounds??ar.notifySounds,privacyTelemetry:r.privacyTelemetry??ar.privacyTelemetry,privacyCrash:r.privacyCrash??ar.privacyCrash,isLoading:!1}),Gu(i)}catch(n){e({error:n.message,isLoading:!1})}},updateSettings:async n=>{const r=t();e({...n,error:null}),n.uiTheme&&Gu(n.uiTheme);try{if(!(await fetch("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:n,options:{scope:"global"}})})).ok)throw new Error("Failed to save settings")}catch(i){e({language:r.language,theme:r.theme,uiTheme:r.uiTheme,autoSaveSessions:r.autoSaveSessions,notifyBuild:r.notifyBuild,notifyErrors:r.notifyErrors,notifySounds:r.notifySounds,privacyTelemetry:r.privacyTelemetry,privacyCrash:r.privacyCrash,error:i.message}),n.uiTheme&&Gu(r.uiTheme)}}}));Gu(ar.uiTheme);const zI=()=>Py(e=>PU(e.uiTheme)),H1={id:"custom",name:"Custom (OpenAI Compatible)",icon:"🔌",description:"Any OpenAI-compatible API",isOAuth:!1,envVars:[],bladeProvider:"openai-compatible"};function zU({open:e,onOpenChange:t,onSave:n}){const[r,i]=v.useState([H1]),[a,s]=v.useState([]),[o,l]=v.useState("custom"),[c,u]=v.useState({bladeProvider:"openai-compatible",baseUrl:"",apiKey:"",modelId:"",name:""}),[d,f]=v.useState(!1),[p,g]=v.useState(!1),[m,_]=v.useState(!1);v.useEffect(()=>{e&&fetch("/providers").then(C=>C.json()).then(C=>i([H1,...C])).catch(C=>console.error("Failed to load providers:",C))},[e]),v.useEffect(()=>{o&&o!=="custom"?fetch(`/providers/${o}/models`).then(C=>C.json()).then(C=>s(C)).catch(C=>console.error("Failed to load models:",C)):s([])},[o]);const b=C=>{l(C.id),u({...c,bladeProvider:C.bladeProvider,baseUrl:C.defaultBaseUrl||"",modelId:"",name:""}),f(!1)},y=()=>{!c.modelId||!c.apiKey||(n({...c,name:c.name||c.modelId}),u({bladeProvider:"openai-compatible",baseUrl:"",apiKey:"",modelId:"",name:""}),l("custom"),t(!1))},S=r.find(C=>C.id===o),E=a.find(C=>C.id===c.modelId),N=o==="custom",x=c.modelId&&c.apiKey;return h.jsx(yi,{open:e,onOpenChange:t,children:h.jsxs(Br,{className:"sm:max-w-[480px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl [&>button]:hidden","aria-describedby":void 0,children:[h.jsx(Fr,{className:"sr-only",children:"Add Model"}),h.jsxs("div",{className:"p-6 flex flex-col gap-6",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-base font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono",children:"Add Model"}),h.jsx("button",{onClick:()=>t(!1),className:"text-[#9CA3AF] hover:text-[#111827] dark:text-[#71717a] dark:hover:text-[#E5E5E5] transition-colors",children:h.jsx(nr,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Provider"}),h.jsxs("div",{className:"relative",children:[h.jsxs("button",{type:"button",onClick:()=>f(!d),className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono flex items-center justify-between hover:bg-[#E5E7EB] dark:hover:bg-[#27272a] transition-colors",children:[h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx("span",{children:S==null?void 0:S.icon}),h.jsx("span",{children:S==null?void 0:S.name})]}),h.jsx(Rr,{className:"h-4 w-4 text-[#9CA3AF] dark:text-[#71717a]"})]}),d&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>f(!1)}),h.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-white dark:bg-[#18181b] border border-[#E5E7EB] dark:border-zinc-800 rounded-md py-1 z-50 max-h-64 overflow-y-auto shadow-lg",children:r.map(C=>h.jsx("button",{type:"button",className:J("w-full text-left px-3 py-2 text-sm font-mono hover:bg-[#F3F4F6] dark:hover:bg-[#27272a] transition-colors",o===C.id?"text-[#111827] dark:text-[#E5E5E5] bg-[#F3F4F6] dark:bg-[#27272a]":"text-[#6B7280] dark:text-[#a1a1aa]"),onClick:()=>b(C),children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{children:C.icon}),h.jsx("span",{className:"font-medium",children:C.name})]})},C.id))})]})]})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Base URL"}),h.jsx("input",{type:"text",value:c.baseUrl,onChange:C=>u({...c,baseUrl:C.target.value}),placeholder:(S==null?void 0:S.defaultBaseUrl)||"https://api.openai.com/v1",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"API Key"}),h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:m?"text":"password",value:c.apiKey,onChange:C=>u({...c,apiKey:C.target.value}),placeholder:"sk-........................",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 pr-10 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"}),h.jsx("button",{type:"button",onClick:()=>_(!m),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[#9CA3AF] hover:text-[#111827] dark:text-[#71717a] dark:hover:text-[#E5E5E5] transition-colors",children:m?h.jsx(iI,{className:"h-4 w-4"}):h.jsx(aI,{className:"h-4 w-4"})})]})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Model ID"}),!N&&a.length>0?h.jsxs("div",{className:"relative",children:[h.jsxs("button",{type:"button",onClick:()=>g(!p),className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono flex items-center justify-between hover:bg-[#E5E7EB] dark:hover:bg-[#27272a] transition-colors",children:[(E==null?void 0:E.name)||c.modelId||"Select model",h.jsx(Rr,{className:"h-4 w-4 text-[#9CA3AF] dark:text-[#71717a]"})]}),p&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1)}),h.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-white dark:bg-[#18181b] border border-[#E5E7EB] dark:border-zinc-800 rounded-md py-1 z-50 max-h-48 overflow-y-auto shadow-lg",children:a.map(C=>h.jsx("button",{type:"button",className:J("w-full text-left px-3 py-2 text-sm font-mono hover:bg-[#F3F4F6] dark:hover:bg-[#27272a] transition-colors",c.modelId===C.id?"text-[#111827] dark:text-[#E5E5E5] bg-[#F3F4F6] dark:bg-[#27272a]":"text-[#6B7280] dark:text-[#a1a1aa]"),onClick:()=>{u({...c,modelId:C.id,name:C.name}),g(!1)},children:C.name},C.id))})]})]}):h.jsx("input",{type:"text",value:c.modelId,onChange:C=>u({...c,modelId:C.target.value}),placeholder:"gpt-4o, claude-3-opus, deepseek-chat, etc.",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"})]})]}),h.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[h.jsx("button",{type:"button",onClick:()=>t(!1),className:"flex-1 px-4 py-2 rounded-md text-sm text-[#6B7280] dark:text-[#a1a1aa] font-mono hover:bg-[#F3F4F6] dark:hover:bg-[#18181b] transition-colors",children:"Cancel"}),h.jsx("button",{type:"button",onClick:y,disabled:!x,className:"flex-1 px-4 py-2 rounded-md text-sm text-white font-semibold font-mono bg-[#16A34A] hover:bg-[#15803d] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Save Model"})]})]})]})})}function HU({open:e,onOpenChange:t,model:n,onSave:r}){const[i,a]=v.useState({baseUrl:"",apiKey:"",model:""}),[s,o]=v.useState(!1);v.useEffect(()=>{n&&a({baseUrl:n.baseUrl||"",apiKey:n.apiKey||"",model:n.model||""})},[n]);const l=()=>{!n||!i.model||(r(n.id,{baseUrl:i.baseUrl||void 0,apiKey:i.apiKey||void 0,model:i.model}),t(!1))},c=i.model;return h.jsx(yi,{open:e,onOpenChange:t,children:h.jsxs(Br,{className:"sm:max-w-[480px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl [&>button]:hidden","aria-describedby":void 0,children:[h.jsx(Fr,{className:"sr-only",children:"Edit Model"}),h.jsxs("div",{className:"p-6 flex flex-col gap-6",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-base font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono",children:"Edit Model"}),h.jsx("button",{onClick:()=>t(!1),className:"text-[#9CA3AF] hover:text-[#111827] dark:text-[#71717a] dark:hover:text-[#E5E5E5] transition-colors",children:h.jsx(nr,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Model ID"}),h.jsx("input",{type:"text",value:i.model,onChange:u=>a({...i,model:u.target.value}),placeholder:"gpt-4o, claude-3-opus, etc.",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Base URL"}),h.jsx("input",{type:"text",value:i.baseUrl,onChange:u=>a({...i,baseUrl:u.target.value}),placeholder:"https://api.openai.com/v1",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"API Key"}),h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:s?"text":"password",value:i.apiKey,onChange:u=>a({...i,apiKey:u.target.value}),placeholder:"Leave empty to keep current key",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 pr-10 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"}),h.jsx("button",{type:"button",onClick:()=>o(!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[#9CA3AF] hover:text-[#111827] dark:text-[#71717a] dark:hover:text-[#E5E5E5] transition-colors",children:s?h.jsx(iI,{className:"h-4 w-4"}):h.jsx(aI,{className:"h-4 w-4"})})]})]})]}),h.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[h.jsx("button",{type:"button",onClick:()=>t(!1),className:"flex-1 px-4 py-2 rounded-md text-sm text-[#6B7280] dark:text-[#a1a1aa] font-mono hover:bg-[#F3F4F6] dark:hover:bg-[#18181b] transition-colors",children:"Cancel"}),h.jsx("button",{type:"button",onClick:l,disabled:!c,className:"flex-1 px-4 py-2 rounded-md text-sm text-white font-semibold font-mono bg-[#16A34A] hover:bg-[#15803d] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Save Changes"})]})]})]})})}const $U={"openai-compatible":{bg:"#10a37f",label:"OA"},anthropic:{bg:"#d97757",label:"A"},gemini:{bg:"#4285f4",label:"G"},"azure-openai":{bg:"#0078d4",label:"Az"},copilot:{bg:"#6e40c9",label:"CP"},"gpt-openai-platform":{bg:"#10a37f",label:"GP"},antigravity:{bg:"#8b5cf6",label:"AG"}};function GU(){var F;const{isSettingsOpen:e,toggleSettings:t,isSidebarOpen:n,setSidebarOpen:r}=pa(),{configuredModels:i,loadModels:a}=Ry(),s=Py(),[o,l]=v.useState("general"),[c,u]=v.useState(!1),[d,f]=v.useState(null),[p,g]=v.useState(null),[m,_]=v.useState(""),[b,y]=v.useState("all"),S=[{value:"general",label:"General"},{value:"models",label:"Models"},{value:"shortcuts",label:"Shortcuts"}],N=v.useMemo(()=>[{action:"Open command palette",combo:["Ctrl","K"],scope:"Global"},{action:"New chat",combo:["Ctrl","N"],scope:"Chat"},{action:"Focus input",combo:["Ctrl","L"],scope:"Chat"},{action:"Toggle sidebar",combo:["Ctrl","B"],scope:"Layout"},{action:"Search history",combo:["Ctrl","H"],scope:"History"}],[]).filter(w=>{const I=w.action.toLowerCase().includes(m.toLowerCase()),M=b==="all"||w.scope.toLowerCase()===b;return I&&M}),x=i.reduce((w,I)=>{const M=I.provider||"unknown";return w[M]||(w[M]=[]),w[M].push(I),w},{});v.useEffect(()=>{e&&(a(),s.loadSettings())},[e,a,s.loadSettings]);const C=async w=>{try{if(!(await fetch("/models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:w.bladeProvider,name:w.name||w.modelId,model:w.modelId,baseUrl:w.baseUrl||void 0,apiKey:w.apiKey||void 0})})).ok)throw new Error("Failed to save model");await a()}catch(I){console.error("Failed to save model:",I)}},O=async w=>{try{if(!(await fetch(`/models/${w}`,{method:"DELETE"})).ok)throw new Error("Failed to delete model");await a()}catch(I){console.error("Failed to delete model:",I)}},B=async(w,I)=>{try{if(!(await fetch(`/models/${w}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)})).ok)throw new Error("Failed to update model");await a()}catch(M){console.error("Failed to update model:",M)}},R=w=>{f(d===w?null:w)};return h.jsxs(h.Fragment,{children:[h.jsx(yi,{open:e,onOpenChange:t,children:h.jsxs(Br,{className:"sm:max-w-[800px] h-[600px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl flex flex-col","aria-describedby":void 0,hideCloseButton:!0,children:[h.jsx(Fr,{className:"sr-only",children:"Settings"}),h.jsxs("div",{className:"flex h-full",children:[h.jsx("div",{className:"w-[200px] h-full bg-[#F3F4F6] dark:bg-[#18181b] p-6 flex flex-col gap-2",children:S.map(w=>h.jsx("button",{onClick:()=>l(w.value),className:J("w-full text-left px-3 py-2 rounded-md text-sm font-mono transition-colors",o===w.value?"bg-[#E5E7EB] dark:bg-[#27272a] text-[#111827] dark:text-[#E5E5E5] font-medium":"text-[#6B7280] hover:text-[#111827] hover:bg-[#E5E7EB]/60 dark:text-[#a1a1aa] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a]/50"),children:w.label},w.value))}),h.jsxs("div",{className:"flex-1 p-8 flex flex-col gap-6 overflow-hidden",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-lg font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono",children:o==="general"?"Settings":(F=S.find(w=>w.value===o))==null?void 0:F.label}),h.jsx("button",{onClick:t,className:"h-8 w-8 rounded-md text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a] transition-colors flex items-center justify-center",children:h.jsx(nr,{className:"h-4 w-4"})})]}),o==="models"&&h.jsxs("div",{className:"flex flex-col gap-6 flex-1 min-h-0 overflow-hidden",children:[h.jsx("p",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono shrink-0",children:"Configure API keys and model settings for different providers."}),h.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:h.jsxs("div",{className:"flex flex-col gap-2 pr-2",children:[Object.entries(x).map(([w,I])=>{const M=$U[w]||{bg:"#71717a",label:"?"},j=I.some(U=>U.apiKey),D=d===w;return h.jsxs("div",{className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] rounded-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>R(w),className:"w-full p-4 flex items-center justify-between hover:bg-[#E5E7EB] dark:hover:bg-[#1f1f23] transition-colors",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-8 h-8 rounded flex items-center justify-center text-white text-xs font-bold",style:{backgroundColor:M.bg},children:M.label}),h.jsxs("div",{className:"flex flex-col gap-0.5 text-left",children:[h.jsx("span",{className:"text-sm font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono capitalize",children:w.replace(/-/g," ")}),h.jsxs("span",{className:"text-xs text-[#9CA3AF] dark:text-[#71717a] font-mono",children:[I.length," model",I.length>1?"s":""]})]})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("span",{className:J("text-xs font-mono",j?"text-[#16A34A]":"text-[#9CA3AF] dark:text-[#71717a]"),children:j?"● Connected":"○ Not Connected"}),h.jsx(Rr,{className:J("h-4 w-4 text-[#9CA3AF] dark:text-[#71717a] transition-transform",D&&"rotate-180")})]})]}),D&&h.jsx("div",{className:"border-t border-[#E5E7EB] dark:border-zinc-800",children:I.map(U=>h.jsxs("div",{className:"px-4 py-3 flex items-center justify-between hover:bg-[#E5E7EB] dark:hover:bg-[#1f1f23] group",children:[h.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[h.jsx("span",{className:"text-sm text-[#111827] dark:text-[#E5E5E5] font-mono truncate",children:U.model}),h.jsx("span",{className:"text-xs text-[#9CA3AF] dark:text-[#71717a] font-mono truncate",children:U.baseUrl||"Default URL"})]}),h.jsxs("div",{className:"flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{onClick:()=>g(U),className:"p-1.5 text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a] rounded transition-colors",children:h.jsx(sI,{className:"h-3.5 w-3.5"})}),h.jsx("button",{onClick:()=>O(U.id),className:"p-1.5 text-[#9CA3AF] hover:text-red-500 hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-red-400 dark:hover:bg-[#27272a] rounded transition-colors",children:h.jsx(Dy,{className:"h-3.5 w-3.5"})})]})]},U.id))})]},w)}),Object.keys(x).length===0&&h.jsx("div",{className:"text-center py-8 text-[#9CA3AF] dark:text-[#71717a] text-sm font-mono",children:"No models configured yet"})]})}),h.jsx("button",{onClick:()=>u(!0),className:"w-full py-3 rounded-md text-[#6B7280] dark:text-[#a1a1aa] text-[13px] font-mono hover:bg-[#F3F4F6] dark:bg-[#18181b] transition-colors shrink-0",children:"+ Add New Model"})]}),o==="general"&&h.jsxs("div",{className:"flex flex-col gap-6 overflow-y-auto pr-2",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-[14px] text-[#111827] dark:text-[#E5E5E5] font-mono font-semibold",children:"General"}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Response Language"}),h.jsx("span",{className:"text-[11px] text-[#9CA3AF] dark:text-[#71717a] font-mono",children:"AI will respond in this language"})]}),h.jsxs("select",{value:s.language,onChange:w=>s.updateSettings({language:w.target.value}),className:"h-8 bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[12px] font-mono rounded-md px-3 border border-[#E5E7EB] dark:border-[#27272a]",children:[h.jsx("option",{value:"en-US",children:"English (US)"}),h.jsx("option",{value:"zh-CN",children:"简体中文"}),h.jsx("option",{value:"zh-TW",children:"繁體中文"}),h.jsx("option",{value:"ja-JP",children:"日本語"}),h.jsx("option",{value:"ko-KR",children:"한국어"}),h.jsx("option",{value:"es-ES",children:"Español"}),h.jsx("option",{value:"fr-FR",children:"Français"}),h.jsx("option",{value:"de-DE",children:"Deutsch"}),h.jsx("option",{value:"pt-BR",children:"Português (BR)"}),h.jsx("option",{value:"ru-RU",children:"Русский"})]})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Auto-save sessions"}),h.jsx(Sa,{enabled:s.autoSaveSessions,onChange:w=>s.updateSettings({autoSaveSessions:w})})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-[14px] text-[#111827] dark:text-[#E5E5E5] font-mono font-semibold",children:"Appearance"}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Theme Preference"}),h.jsx("div",{className:"flex items-center gap-2 bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md p-1",children:["dark","light","system"].map(w=>h.jsx("button",{onClick:()=>s.updateSettings({uiTheme:w}),className:J("px-3 py-1 rounded text-[12px] font-mono transition-colors",s.uiTheme===w?"bg-[#E5E7EB] dark:bg-[#27272a] text-[#111827] dark:text-[#E5E5E5]":"text-[#9CA3AF] dark:text-[#71717a] hover:text-[#111827] dark:hover:text-[#E5E5E5]"),children:w==="dark"?"Dark":w==="light"?"Light":"System"},w))})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Compact sidebar"}),h.jsx(Sa,{enabled:!n,onChange:w=>r(!w)})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Code theme"}),h.jsx("span",{className:"text-[11px] text-[#9CA3AF] dark:text-[#71717a] font-mono",children:"Syntax highlighting colors"})]}),h.jsxs("select",{value:s.theme,onChange:w=>s.updateSettings({theme:w.target.value}),className:"h-8 bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[12px] font-mono rounded-md px-3 border border-[#E5E7EB] dark:border-[#27272a]",children:[h.jsx("option",{value:"dracula",children:"Dracula"}),h.jsx("option",{value:"monokai",children:"Monokai"}),h.jsx("option",{value:"nord",children:"Nord"}),h.jsx("option",{value:"tokyo-night",children:"Tokyo Night"}),h.jsx("option",{value:"one-dark",children:"One Dark"}),h.jsx("option",{value:"catppuccin",children:"Catppuccin"}),h.jsx("option",{value:"gruvbox",children:"Gruvbox"}),h.jsx("option",{value:"github",children:"GitHub"}),h.jsx("option",{value:"solarized-light",children:"Solarized Light"}),h.jsx("option",{value:"solarized-dark",children:"Solarized Dark"}),h.jsx("option",{value:"ayu-dark",children:"Ayu Dark"}),h.jsx("option",{value:"rose-pine",children:"Rose Pine"}),h.jsx("option",{value:"kanagawa",children:"Kanagawa"})]})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-[14px] text-[#111827] dark:text-[#E5E5E5] font-mono font-semibold",children:"Notifications"}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Build finished"}),h.jsx(Sa,{enabled:s.notifyBuild,onChange:w=>s.updateSettings({notifyBuild:w})})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Errors only"}),h.jsx(Sa,{enabled:s.notifyErrors,onChange:w=>s.updateSettings({notifyErrors:w})})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"System sounds"}),h.jsx(Sa,{enabled:s.notifySounds,onChange:w=>s.updateSettings({notifySounds:w})})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-[14px] text-[#111827] dark:text-[#E5E5E5] font-mono font-semibold",children:"Privacy"}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Telemetry"}),h.jsx(Sa,{enabled:s.privacyTelemetry,onChange:w=>s.updateSettings({privacyTelemetry:w})})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Crash reports"}),h.jsx(Sa,{enabled:s.privacyCrash,onChange:w=>s.updateSettings({privacyCrash:w})})]})]})]}),o==="shortcuts"&&h.jsxs("div",{className:"flex flex-col gap-4 flex-1 min-h-0 overflow-hidden",children:[h.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[h.jsx("input",{value:m,onChange:w=>_(w.target.value),placeholder:"Search actions...",className:"flex-1 h-9 bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono"}),h.jsxs("select",{value:b,onChange:w=>y(w.target.value),className:"h-9 bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono",children:[h.jsx("option",{value:"all",children:"All scopes"}),h.jsx("option",{value:"global",children:"Global"}),h.jsx("option",{value:"chat",children:"Chat"}),h.jsx("option",{value:"layout",children:"Layout"}),h.jsx("option",{value:"history",children:"History"})]}),h.jsx("button",{onClick:()=>{_(""),y("all")},className:"h-9 px-3 rounded-md bg-[#E5E7EB] dark:bg-[#27272a] text-[#111827] dark:text-[#E5E5E5] text-[12px] font-mono font-semibold",children:"Reset"})]}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto border border-[#E5E7EB] dark:border-[#27272a] rounded-lg bg-[#E5E7EB] dark:bg-[#111827]",children:[h.jsxs("div",{className:"grid grid-cols-[1fr_180px_120px] gap-2 px-3 py-2 bg-white dark:bg-[#0C0C0C] text-[12px] text-[#6B7280] dark:text-[#94a3b8] font-mono font-semibold",children:[h.jsx("span",{children:"Action"}),h.jsx("span",{children:"Shortcut"}),h.jsx("span",{children:"Scope"})]}),N.map((w,I)=>h.jsxs("div",{className:J("grid grid-cols-[1fr_180px_120px] gap-2 px-3 py-2 text-[13px] font-mono",I%2===0?"bg-[#E5E7EB] dark:bg-[#111827]":"bg-white dark:bg-[#0C0C0C]"),children:[h.jsx("span",{className:"text-[#111827] dark:text-[#E5E5E5]",children:w.action}),h.jsx("div",{className:"flex items-center gap-1",children:w.combo.map(M=>h.jsx("span",{className:"px-2 py-0.5 rounded bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[12px] font-mono font-semibold",children:M},M))}),h.jsx("span",{className:"text-[#6B7280] dark:text-[#94a3b8] text-[12px]",children:w.scope})]},`${w.action}-${w.scope}`)),N.length===0&&h.jsx("div",{className:"px-3 py-6 text-center text-[12px] text-[#6B7280] dark:text-[#94a3b8] font-mono",children:"No shortcuts found."})]})]})]})]})]})}),h.jsx(zU,{open:c,onOpenChange:u,onSave:C}),h.jsx(HU,{open:!!p,onOpenChange:w=>!w&&g(null),model:p,onSave:B})]})}function Sa({enabled:e,onChange:t}){return h.jsx("button",{onClick:()=>t(!e),className:J("w-10 h-5 rounded-full px-0.5 flex items-center transition-colors",e?"bg-[#22C55E]":"bg-[#E5E7EB] dark:bg-[#27272a]"),children:h.jsx("span",{className:J("h-4 w-4 rounded-full transition-transform",e?"translate-x-5 bg-white":"translate-x-0 bg-white dark:bg-[#a1a1aa]")})})}const VU="modulepreload",WU=function(e){return"/"+e},$1={},HI=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=WU(l),l in $1)return;$1[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":VU,c||(d.as="script"),d.crossOrigin="",d.href=l,o&&d.setAttribute("nonce",o),document.head.appendChild(d),c)return new Promise((f,p)=>{d.addEventListener("load",f),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function a(s){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s}return i.then(s=>{for(const o of s||[])o.status==="rejected"&&a(o.reason);return t().catch(a)})};function qU(e){const t=e+"CollectionProvider",[n,r]=fa(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:_,children:b}=m,y=gt.useRef(null),S=gt.useRef(new Map).current;return h.jsx(i,{scope:_,itemMap:S,collectionRef:y,children:b})};s.displayName=t;const o=e+"CollectionSlot",l=ec(o),c=gt.forwardRef((m,_)=>{const{scope:b,children:y}=m,S=a(o,b),E=ht(_,S.collectionRef);return h.jsx(l,{ref:E,children:y})});c.displayName=o;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=ec(u),p=gt.forwardRef((m,_)=>{const{scope:b,children:y,...S}=m,E=gt.useRef(null),N=ht(_,E),x=a(u,b);return gt.useEffect(()=>(x.itemMap.set(E,{ref:E,...S}),()=>void x.itemMap.delete(E))),h.jsx(f,{[d]:"",ref:N,children:y})});p.displayName=u;function g(m){const _=a(e+"CollectionConsumer",m);return gt.useCallback(()=>{const y=_.collectionRef.current;if(!y)return[];const S=Array.from(y.querySelectorAll(`[${d}]`));return Array.from(_.itemMap.values()).sort((x,C)=>S.indexOf(x.ref.current)-S.indexOf(C.ref.current))},[_.collectionRef,_.itemMap])}return[{Provider:s,Slot:c,ItemSlot:p},g,r]}var dp="rovingFocusGroup.onEntryFocus",YU={bubbles:!1,cancelable:!0},Ac="RovingFocusGroup",[lm,$I,KU]=qU(Ac),[ZU,GI]=fa(Ac,[KU]),[XU,QU]=ZU(Ac),VI=v.forwardRef((e,t)=>h.jsx(lm.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(lm.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(JU,{...e,ref:t})})}));VI.displayName=Ac;var JU=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:s,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,f=v.useRef(null),p=ht(t,f),g=yy(a),[m,_]=Cc({prop:s,defaultProp:o??null,onChange:l,caller:Ac}),[b,y]=v.useState(!1),S=pn(c),E=$I(n),N=v.useRef(!1),[x,C]=v.useState(0);return v.useEffect(()=>{const O=f.current;if(O)return O.addEventListener(dp,S),()=>O.removeEventListener(dp,S)},[S]),h.jsx(XU,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:v.useCallback(O=>_(O),[_]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>C(O=>O+1),[]),onFocusableItemRemove:v.useCallback(()=>C(O=>O-1),[]),children:h.jsx(Ve.div,{tabIndex:b||x===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:Ne(e.onMouseDown,()=>{N.current=!0}),onFocus:Ne(e.onFocus,O=>{const B=!N.current;if(O.target===O.currentTarget&&B&&!b){const R=new CustomEvent(dp,YU);if(O.currentTarget.dispatchEvent(R),!R.defaultPrevented){const F=E().filter(D=>D.focusable),w=F.find(D=>D.active),I=F.find(D=>D.id===m),j=[w,I,...F].filter(Boolean).map(D=>D.ref.current);YI(j,u)}}N.current=!1}),onBlur:Ne(e.onBlur,()=>y(!1))})})}),WI="RovingFocusGroupItem",qI=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:s,...o}=e,l=Ua(),c=a||l,u=QU(WI,n),d=u.currentTabStopId===c,f=$I(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:m}=u;return v.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),h.jsx(lm.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:h.jsx(Ve.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:Ne(e.onMouseDown,_=>{r?u.onItemFocus(c):_.preventDefault()}),onFocus:Ne(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Ne(e.onKeyDown,_=>{if(_.key==="Tab"&&_.shiftKey){u.onItemShiftTab();return}if(_.target!==_.currentTarget)return;const b=nj(_,u.orientation,u.dir);if(b!==void 0){if(_.metaKey||_.ctrlKey||_.altKey||_.shiftKey)return;_.preventDefault();let S=f().filter(E=>E.focusable).map(E=>E.ref.current);if(b==="last")S.reverse();else if(b==="prev"||b==="next"){b==="prev"&&S.reverse();const E=S.indexOf(_.currentTarget);S=u.loop?rj(S,E+1):S.slice(E+1)}setTimeout(()=>YI(S))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});qI.displayName=WI;var ej={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function tj(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function nj(e,t,n){const r=tj(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ej[r]}function YI(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function rj(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ij=VI,aj=qI,jh="Tabs",[sj]=fa(jh,[GI]),KI=GI(),[oj,zy]=sj(jh),ZI=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:s="horizontal",dir:o,activationMode:l="automatic",...c}=e,u=yy(o),[d,f]=Cc({prop:r,onChange:i,defaultProp:a??"",caller:jh});return h.jsx(oj,{scope:n,baseId:Ua(),value:d,onValueChange:f,orientation:s,dir:u,activationMode:l,children:h.jsx(Ve.div,{dir:u,"data-orientation":s,...c,ref:t})})});ZI.displayName=jh;var XI="TabsList",QI=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,a=zy(XI,n),s=KI(n);return h.jsx(ij,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:r,children:h.jsx(Ve.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});QI.displayName=XI;var JI="TabsTrigger",eO=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,s=zy(JI,n),o=KI(n),l=rO(s.baseId,r),c=iO(s.baseId,r),u=r===s.value;return h.jsx(aj,{asChild:!0,...o,focusable:!i,active:u,children:h.jsx(Ve.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...a,ref:t,onMouseDown:Ne(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Ne(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Ne(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!i&&d&&s.onValueChange(r)})})})});eO.displayName=JI;var tO="TabsContent",nO=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:a,...s}=e,o=zy(tO,n),l=rO(o.baseId,r),c=iO(o.baseId,r),u=r===o.value,d=v.useRef(u);return v.useEffect(()=>{const f=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(f)},[]),h.jsx(Jn,{present:i||u,children:({present:f})=>h.jsx(Ve.div,{"data-state":u?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:f&&a})})});nO.displayName=tO;function rO(e,t){return`${e}-trigger-${t}`}function iO(e,t){return`${e}-content-${t}`}var lj=ZI,aO=QI,sO=eO,oO=nO;const cj=lj,lO=v.forwardRef(({className:e,...t},n)=>h.jsx(aO,{ref:n,className:J("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));lO.displayName=aO.displayName;const Vu=v.forwardRef(({className:e,...t},n)=>h.jsx(sO,{ref:n,className:J("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Vu.displayName=sO.displayName;const Wu=v.forwardRef(({className:e,...t},n)=>h.jsx(oO,{ref:n,className:J("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Wu.displayName=oO.displayName;const uj={"ayu-dark":{background:{primary:"#0f1419",secondary:"#14191f"},text:{primary:"#e6e1cf",secondary:"#bae67e",muted:"#5c6773"},border:{light:"#2d323b"},syntax:{comment:"#5c6773",string:"#bae67e",number:"#ffcc66",keyword:"#ff8f40",function:"#73d0ff",variable:"#e6e1cf",operator:"#f29e74",type:"#73d0ff",tag:"#ff8f40",attr:"#ffd580",default:"#e6e1cf"}},dracula:{background:{primary:"#282a36",secondary:"#44475a"},text:{primary:"#f8f8f2",secondary:"#f1fa8c",muted:"#6272a4"},border:{light:"#44475a"},syntax:{comment:"#6272a4",string:"#f1fa8c",number:"#bd93f9",keyword:"#ff79c6",function:"#50fa7b",variable:"#f8f8f2",operator:"#ff79c6",type:"#8be9fd",tag:"#ff79c6",attr:"#50fa7b",default:"#f8f8f2"}},monokai:{background:{primary:"#272822",secondary:"#3e3d32"},text:{primary:"#f8f8f2",secondary:"#e6db74",muted:"#75715e"},border:{light:"#3e3d32"},syntax:{comment:"#75715e",string:"#e6db74",number:"#ae81ff",keyword:"#f92672",function:"#a6e22e",variable:"#f8f8f2",operator:"#f92672",type:"#66d9ef",tag:"#f92672",attr:"#a6e22e",default:"#f8f8f2"}},nord:{background:{primary:"#2e3440",secondary:"#3b4252"},text:{primary:"#eceff4",secondary:"#d8dee9",muted:"#4c566a"},border:{light:"#434c5e"},syntax:{comment:"#616e88",string:"#a3be8c",number:"#b48ead",keyword:"#81a1c1",function:"#88c0d0",variable:"#d8dee9",operator:"#81a1c1",type:"#8fbcbb",tag:"#81a1c1",attr:"#8fbcbb",default:"#eceff4"}},"solarized-light":{background:{primary:"#fdf6e3",secondary:"#eee8d5"},text:{primary:"#586e75",secondary:"#657b83",muted:"#93a1a1"},border:{light:"#eee8d5"},syntax:{comment:"#93a1a1",string:"#2aa198",number:"#d33682",keyword:"#859900",function:"#268bd2",variable:"#657b83",operator:"#859900",type:"#b58900",tag:"#268bd2",attr:"#93a1a1",default:"#657b83"}},"solarized-dark":{background:{primary:"#002b36",secondary:"#073642"},text:{primary:"#839496",secondary:"#93a1a1",muted:"#586e75"},border:{light:"#073642"},syntax:{comment:"#586e75",string:"#2aa198",number:"#d33682",keyword:"#859900",function:"#268bd2",variable:"#839496",operator:"#859900",type:"#b58900",tag:"#268bd2",attr:"#93a1a1",default:"#839496"}},"tokyo-night":{background:{primary:"#1a1b26",secondary:"#292e42"},text:{primary:"#a9b1d6",secondary:"#c0caf5",muted:"#565f89"},border:{light:"#292e42"},syntax:{comment:"#565f89",string:"#9ece6a",number:"#ff9e64",keyword:"#bb9af7",function:"#7aa2f7",variable:"#c0caf5",operator:"#89ddff",type:"#7dcfff",tag:"#f7768e",attr:"#7aa2f7",default:"#a9b1d6"}},github:{background:{primary:"#ffffff",secondary:"#f6f8fa"},text:{primary:"#24292f",secondary:"#57606a",muted:"#6e7781"},border:{light:"#d0d7de"},syntax:{comment:"#6e7781",string:"#0a3069",number:"#0550ae",keyword:"#cf222e",function:"#8250df",variable:"#24292f",operator:"#cf222e",type:"#0550ae",tag:"#116329",attr:"#0550ae",default:"#24292f"}},gruvbox:{background:{primary:"#282828",secondary:"#3c3836"},text:{primary:"#ebdbb2",secondary:"#d5c4a1",muted:"#928374"},border:{light:"#3c3836"},syntax:{comment:"#928374",string:"#b8bb26",number:"#d3869b",keyword:"#fb4934",function:"#b8bb26",variable:"#ebdbb2",operator:"#fe8019",type:"#fabd2f",tag:"#fb4934",attr:"#fabd2f",default:"#ebdbb2"}},"one-dark":{background:{primary:"#282c34",secondary:"#21252b"},text:{primary:"#abb2bf",secondary:"#e5c07b",muted:"#5c6370"},border:{light:"#3e4451"},syntax:{comment:"#5c6370",string:"#98c379",number:"#d19a66",keyword:"#c678dd",function:"#61afef",variable:"#e06c75",operator:"#56b6c2",type:"#e5c07b",tag:"#e06c75",attr:"#d19a66",default:"#abb2bf"}},catppuccin:{background:{primary:"#1e1e2e",secondary:"#313244"},text:{primary:"#cdd6f4",secondary:"#f5e0dc",muted:"#6c7086"},border:{light:"#313244"},syntax:{comment:"#6c7086",string:"#a6e3a1",number:"#fab387",keyword:"#cba6f7",function:"#89b4fa",variable:"#f5e0dc",operator:"#89dceb",type:"#f9e2af",tag:"#f38ba8",attr:"#f9e2af",default:"#cdd6f4"}},"rose-pine":{background:{primary:"#191724",secondary:"#1f1d2e"},text:{primary:"#e0def4",secondary:"#908caa",muted:"#6e6a86"},border:{light:"#26233a"},syntax:{comment:"#6e6a86",string:"#f6c177",number:"#ebbcba",keyword:"#c4a7e7",function:"#9ccfd8",variable:"#e0def4",operator:"#31748f",type:"#eb6f92",tag:"#eb6f92",attr:"#c4a7e7",default:"#e0def4"}},kanagawa:{background:{primary:"#1f1f28",secondary:"#2a2a37"},text:{primary:"#dcd7ba",secondary:"#c8c093",muted:"#727169"},border:{light:"#2a2a37"},syntax:{comment:"#727169",string:"#98bb6c",number:"#d27e99",keyword:"#957fb8",function:"#7e9cd8",variable:"#dcd7ba",operator:"#c0a36e",type:"#7aa89f",tag:"#e46876",attr:"#ffa066",default:"#dcd7ba"}}};function dj(e){const t=e.replace("#",""),n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16);return(.299*n+.587*r+.114*i)/255<.5}function hj(e){return{base:dj(e.background.primary)?"vs-dark":"vs",inherit:!0,rules:[{token:"",foreground:e.text.primary.replace("#",""),background:e.background.primary.replace("#","")},{token:"comment",foreground:e.syntax.comment.replace("#",""),fontStyle:"italic"},{token:"string",foreground:e.syntax.string.replace("#","")},{token:"number",foreground:e.syntax.number.replace("#","")},{token:"keyword",foreground:e.syntax.keyword.replace("#","")},{token:"type",foreground:e.syntax.type.replace("#","")},{token:"identifier",foreground:e.syntax.variable.replace("#","")},{token:"function",foreground:e.syntax.function.replace("#","")},{token:"variable",foreground:e.syntax.variable.replace("#","")},{token:"operator",foreground:e.syntax.operator.replace("#","")},{token:"delimiter",foreground:e.syntax.operator.replace("#","")},{token:"tag",foreground:e.syntax.tag.replace("#","")},{token:"attribute.name",foreground:e.syntax.attr.replace("#","")},{token:"attribute.value",foreground:e.syntax.string.replace("#","")}],colors:{"editor.background":e.background.primary,"editor.foreground":e.text.primary,"editor.lineHighlightBackground":e.background.secondary,"editor.selectionBackground":`${e.syntax.function}40`,"editorLineNumber.foreground":e.text.muted,"editorLineNumber.activeForeground":e.text.secondary,"editorCursor.foreground":e.text.primary,"editorIndentGuide.background":e.border.light,"editorWidget.background":e.background.secondary,"editorWidget.border":e.border.light,"scrollbarSlider.background":`${e.text.muted}40`,"scrollbarSlider.hoverBackground":`${e.text.muted}60`}}}const G1=new Set;function V1(e,t){const n=t.toLowerCase().replace(/\s+/g,"-"),r=uj[n];if(!r)return"vs-dark";if(!G1.has(n)){const i=hj(r);e.editor.defineTheme(n,i),G1.add(n)}return n}v.lazy(async()=>({default:(await HI(()=>import("./index-CVMzKpe8.js"),[])).DiffEditor}));const fj=v.lazy(async()=>({default:(await HI(()=>import("./index-CVMzKpe8.js"),[])).Editor}));function pj(){const{toggleFilePreview:e}=pa(),{messages:t,currentSessionId:n}=bi(),[r,i]=v.useState("diff"),[a,s]=v.useState([]),[o,l]=v.useState({}),[c,u]=v.useState(!1),[d,f]=v.useState(null),[p,g]=v.useState({}),[m,_]=v.useState({}),[b,y]=v.useState(null),[S,E]=v.useState(""),[N,x]=v.useState(!1),[C,O]=v.useState(null),[B,R]=v.useState(!1),F=async(k="")=>{try{const $=k?`/suggestions/files/tree?path=${encodeURIComponent(k)}`:"/suggestions/files/tree",W=await fetch($);if(!W.ok)throw new Error("Failed to load tree");return(await W.json()).map(te=>({...te,children:te.type==="dir"?[]:void 0}))}catch{return[]}};v.useEffect(()=>{let k=!0;return(async()=>{u(!0),f(null);try{const W=await F();k&&s(W)}catch(W){k&&f(W.message)}finally{k&&u(!1)}})(),()=>{k=!1}},[n]),v.useEffect(()=>{y(null),E(""),O(null),R(!1),g({}),l({})},[n]);const w=v.useMemo(()=>bj(t),[t]),I=v.useMemo(()=>mj(t),[t]),[M,j]=v.useState({}),D=k=>{j($=>({...$,[k]:!$[k]}))},U=async k=>{y(k),E(""),x(!0),O(null),R(!1);try{const $=await fetch(`/suggestions/files/content?path=${encodeURIComponent(k)}`);if(!$.ok)throw new Error("Failed to load file");const W=await $.json();E(W.content||""),R(!!W.truncated)}catch($){O($.message)}finally{x(!1)}},L=async k=>{const $=!p[k];if(g(W=>({...W,[k]:$})),$&&!o[k]){const W=await F(k);l(A=>({...A,[k]:W}))}},G=k=>{_($=>({...$,[k]:!$[k]}))};return h.jsxs("div",{className:"w-[55%] min-w-[420px] max-w-[860px] border-l border-[#E5E7EB] dark:border-zinc-800 bg-white dark:bg-[#09090b] flex flex-col h-full shadow-xl shrink-0",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 h-12 border-b border-[#E5E7EB] dark:border-zinc-800 shrink-0",children:[h.jsx("span",{className:"font-normal text-[13px] text-[#6B7280] dark:text-zinc-400 font-mono",children:"Preview"}),h.jsx(Gs,{variant:"ghost",size:"icon",onClick:e,className:"h-8 w-8 text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB]/60 dark:text-zinc-500 dark:hover:text-zinc-300 dark:hover:bg-zinc-800/50",children:h.jsx(nr,{className:"w-4 h-4"})})]}),h.jsxs(cj,{value:r,onValueChange:k=>i(k),className:"flex flex-col flex-1 min-h-0",children:[h.jsx("div",{className:"px-4 py-3 border-b border-[#E5E7EB] dark:border-zinc-800",children:h.jsxs(lO,{className:"bg-white dark:bg-[#111113] border border-[#E5E7EB] dark:border-[#27272a] h-9 p-1 rounded-md w-full justify-start",children:[h.jsx(Vu,{value:"diff",className:"text-[12px] font-mono px-3 text-[#6B7280] dark:text-[#a1a1aa] data-[state=active]:bg-[#E5E7EB] data-[state=active]:text-[#111827] dark:data-[state=active]:bg-[#27272a] dark:data-[state=active]:text-white",children:"Diff"}),h.jsx(Vu,{value:"files",className:"text-[12px] font-mono px-3 text-[#6B7280] dark:text-[#a1a1aa] data-[state=active]:bg-[#E5E7EB] data-[state=active]:text-[#111827] dark:data-[state=active]:bg-[#27272a] dark:data-[state=active]:text-white",children:"Files"}),h.jsx(Vu,{value:"logs",className:"text-[12px] font-mono px-3 text-[#6B7280] dark:text-[#a1a1aa] data-[state=active]:bg-[#E5E7EB] data-[state=active]:text-[#111827] dark:data-[state=active]:bg-[#27272a] dark:data-[state=active]:text-white",children:"Logs"})]})}),h.jsx(Wu,{value:"diff",className:"overflow-hidden flex-1 mt-0",children:h.jsx("div",{className:"overflow-y-auto px-4 py-4 space-y-3 h-full",children:w.length===0?h.jsx(Jo,{title:"No patch yet",subtitle:"Run a tool that changes files to see diffs here."}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono mb-2",children:[w.length," changed file",w.length>1?"s":""]}),w.map(k=>{var A;const $=((A=k.filePath)==null?void 0:A.split("/").pop())||"unknown",W=M[k.filePath||""]!==!1;return h.jsxs("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>D(k.filePath||""),className:"w-full flex items-center gap-2 px-3 py-2 bg-[#F9FAFB] dark:bg-[#111113] hover:bg-[#F3F4F6] dark:hover:bg-[#18181b] transition-colors",children:[W?h.jsx(Rr,{className:"w-4 h-4 text-[#6B7280] dark:text-[#71717a]"}):h.jsx(Wd,{className:"w-4 h-4 text-[#6B7280] dark:text-[#71717a]"}),h.jsx(rc,{className:"w-4 h-4 text-[#6B7280] dark:text-[#71717a]"}),h.jsx("span",{className:"text-[13px] text-[#111827] dark:text-[#E5E5E5] font-mono flex-1 text-left truncate",children:$}),k.summary&&h.jsx("span",{className:"text-[11px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:k.summary})]}),W&&h.jsxs("div",{className:"border-t border-[#E5E7EB] dark:border-[#27272a]",children:[h.jsx("div",{className:"px-3 py-1 text-[11px] text-[#9CA3AF] dark:text-[#52525b] font-mono truncate",children:k.filePath}),h.jsx(vj,{diff:k.diff})]})]},k.filePath)})]})})}),h.jsx(Wu,{value:"files",className:"overflow-hidden flex-1 mt-0",children:h.jsxs("div",{className:"px-4 py-4 h-full",children:[c&&h.jsx(Jo,{title:"Loading files…",subtitle:"Fetching workspace tree."}),!c&&d&&h.jsx(Jo,{title:"Failed to load files",subtitle:d}),!c&&!d&&a.length===0&&h.jsx(Jo,{title:"No files yet",subtitle:"Start a session to load the workspace tree."}),!c&&!d&&a.length>0&&h.jsxs("div",{className:"h-full grid grid-cols-[220px_1fr] gap-4 min-h-0",children:[h.jsx("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-lg p-2 overflow-y-auto min-h-0",children:a.map(k=>h.jsx(cO,{node:k,depth:0,expandedDirs:p,childrenCache:o,toggleDir:L,selectedPath:b,onSelectFile:U},k.path))}),h.jsxs("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-lg overflow-hidden flex flex-col min-h-0",children:[h.jsxs("div",{className:"px-3 py-2 bg-[#F9FAFB] dark:bg-[#111113] border-b border-[#E5E7EB] dark:border-[#27272a] text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono flex items-center justify-between",children:[h.jsx("span",{children:b||"Select a file to preview"}),b&&h.jsx("span",{className:"text-[11px] text-[#9CA3AF] dark:text-[#a1a1aa] font-mono",children:N?"Loading…":B?"Truncated":"Ready"})]}),B&&!N&&h.jsx("div",{className:"px-3 py-2 bg-[#FEF3C7] dark:bg-[#111113] border-b border-[#E5E7EB] dark:border-[#27272a] text-[11px] text-[#b45309] dark:text-[#facc15] font-mono",children:"Preview truncated to 200k characters."}),h.jsxs("div",{className:"flex-1 min-h-0",children:[!b&&h.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono",children:"Pick a file from the tree to preview."}),b&&C&&h.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[#DC2626] dark:text-[#fca5a5] font-mono",children:C}),b&&!C&&h.jsx("div",{className:"h-full",children:N?h.jsx(Y1,{}):h.jsx(v.Suspense,{fallback:h.jsx(Y1,{}),children:h.jsx(yj,{content:S,filename:b})})})]})]})]})]})}),h.jsx(Wu,{value:"logs",className:"overflow-hidden flex-1 mt-0",children:h.jsx("div",{className:"overflow-y-auto px-4 py-4 space-y-3 h-full",children:I.length===0?h.jsx(Jo,{title:"No logs yet",subtitle:"Tool runs will appear here."}):I.map(k=>{var se;const $=m[k.id],W=(k.content||"").split(`
262
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},DU="DialogDescriptionWarning",LU=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${MI(DU).contentName}}.`;return v.useEffect(()=>{var a;const i=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},MU=EI,BU=kI,BI=CI,FI=AI,UI=NI,jI=II,FU=DI;const yi=MU,UU=BU,PI=v.forwardRef(({className:e,...t},n)=>h.jsx(BI,{ref:n,className:J("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));PI.displayName=BI.displayName;const Br=v.forwardRef(({className:e,children:t,hideCloseButton:n,...r},i)=>h.jsxs(UU,{children:[h.jsx(PI,{}),h.jsxs(FI,{ref:i,className:J("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,!n&&h.jsxs(FU,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(nr,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Br.displayName=FI.displayName;const Fr=v.forwardRef(({className:e,...t},n)=>h.jsx(UI,{ref:n,className:J("text-lg font-semibold leading-none tracking-tight",e),...t}));Fr.displayName=UI.displayName;const jU=v.forwardRef(({className:e,...t},n)=>h.jsx(jI,{ref:n,className:J("text-sm text-muted-foreground",e),...t}));jU.displayName=jI.displayName;const PU=e=>e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches:e==="dark",Gu=e=>{const t=document.documentElement;if(t.classList.remove("light","dark"),e==="system"){const n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";t.classList.add(n)}else t.classList.add(e)},ar={language:"zh-CN",theme:"dracula",uiTheme:"system",autoSaveSessions:!0,notifyBuild:!0,notifyErrors:!1,notifySounds:!1,privacyTelemetry:!1,privacyCrash:!0},Py=Lh((e,t)=>({...ar,isLoading:!1,error:null,loadSettings:async()=>{e({isLoading:!0,error:null});try{const n=await fetch("/configs");if(!n.ok)throw new Error("Failed to load settings");const r=await n.json(),i=r.uiTheme??ar.uiTheme;e({language:r.language??ar.language,theme:r.theme??ar.theme,uiTheme:i,autoSaveSessions:r.autoSaveSessions??ar.autoSaveSessions,notifyBuild:r.notifyBuild??ar.notifyBuild,notifyErrors:r.notifyErrors??ar.notifyErrors,notifySounds:r.notifySounds??ar.notifySounds,privacyTelemetry:r.privacyTelemetry??ar.privacyTelemetry,privacyCrash:r.privacyCrash??ar.privacyCrash,isLoading:!1}),Gu(i)}catch(n){e({error:n.message,isLoading:!1})}},updateSettings:async n=>{const r=t();e({...n,error:null}),n.uiTheme&&Gu(n.uiTheme);try{if(!(await fetch("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:n,options:{scope:"global"}})})).ok)throw new Error("Failed to save settings")}catch(i){e({language:r.language,theme:r.theme,uiTheme:r.uiTheme,autoSaveSessions:r.autoSaveSessions,notifyBuild:r.notifyBuild,notifyErrors:r.notifyErrors,notifySounds:r.notifySounds,privacyTelemetry:r.privacyTelemetry,privacyCrash:r.privacyCrash,error:i.message}),n.uiTheme&&Gu(r.uiTheme)}}}));Gu(ar.uiTheme);const zI=()=>Py(e=>PU(e.uiTheme)),H1={id:"custom",name:"Custom (OpenAI Compatible)",icon:"🔌",description:"Any OpenAI-compatible API",envVars:[],bladeProvider:"openai-compatible"};function zU({open:e,onOpenChange:t,onSave:n}){const[r,i]=v.useState([H1]),[a,s]=v.useState([]),[o,l]=v.useState("custom"),[c,u]=v.useState({bladeProvider:"openai-compatible",baseUrl:"",apiKey:"",modelId:"",name:""}),[d,f]=v.useState(!1),[p,g]=v.useState(!1),[m,_]=v.useState(!1);v.useEffect(()=>{e&&fetch("/providers").then(C=>C.json()).then(C=>i([H1,...C])).catch(C=>console.error("Failed to load providers:",C))},[e]),v.useEffect(()=>{o&&o!=="custom"?fetch(`/providers/${o}/models`).then(C=>C.json()).then(C=>s(C)).catch(C=>console.error("Failed to load models:",C)):s([])},[o]);const b=C=>{l(C.id),u({...c,bladeProvider:C.bladeProvider,baseUrl:C.defaultBaseUrl||"",modelId:"",name:""}),f(!1)},y=()=>{!c.modelId||!c.apiKey||(n({...c,name:c.name||c.modelId}),u({bladeProvider:"openai-compatible",baseUrl:"",apiKey:"",modelId:"",name:""}),l("custom"),t(!1))},S=r.find(C=>C.id===o),E=a.find(C=>C.id===c.modelId),N=o==="custom",x=c.modelId&&c.apiKey;return h.jsx(yi,{open:e,onOpenChange:t,children:h.jsxs(Br,{className:"sm:max-w-[480px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl [&>button]:hidden","aria-describedby":void 0,children:[h.jsx(Fr,{className:"sr-only",children:"Add Model"}),h.jsxs("div",{className:"p-6 flex flex-col gap-6",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-base font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono",children:"Add Model"}),h.jsx("button",{onClick:()=>t(!1),className:"text-[#9CA3AF] hover:text-[#111827] dark:text-[#71717a] dark:hover:text-[#E5E5E5] transition-colors",children:h.jsx(nr,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Provider"}),h.jsxs("div",{className:"relative",children:[h.jsxs("button",{type:"button",onClick:()=>f(!d),className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono flex items-center justify-between hover:bg-[#E5E7EB] dark:hover:bg-[#27272a] transition-colors",children:[h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx("span",{children:S==null?void 0:S.icon}),h.jsx("span",{children:S==null?void 0:S.name})]}),h.jsx(Rr,{className:"h-4 w-4 text-[#9CA3AF] dark:text-[#71717a]"})]}),d&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>f(!1)}),h.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-white dark:bg-[#18181b] border border-[#E5E7EB] dark:border-zinc-800 rounded-md py-1 z-50 max-h-64 overflow-y-auto shadow-lg",children:r.map(C=>h.jsx("button",{type:"button",className:J("w-full text-left px-3 py-2 text-sm font-mono hover:bg-[#F3F4F6] dark:hover:bg-[#27272a] transition-colors",o===C.id?"text-[#111827] dark:text-[#E5E5E5] bg-[#F3F4F6] dark:bg-[#27272a]":"text-[#6B7280] dark:text-[#a1a1aa]"),onClick:()=>b(C),children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{children:C.icon}),h.jsx("span",{className:"font-medium",children:C.name})]})},C.id))})]})]})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Base URL"}),h.jsx("input",{type:"text",value:c.baseUrl,onChange:C=>u({...c,baseUrl:C.target.value}),placeholder:(S==null?void 0:S.defaultBaseUrl)||"https://api.openai.com/v1",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"API Key"}),h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:m?"text":"password",value:c.apiKey,onChange:C=>u({...c,apiKey:C.target.value}),placeholder:"sk-........................",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 pr-10 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"}),h.jsx("button",{type:"button",onClick:()=>_(!m),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[#9CA3AF] hover:text-[#111827] dark:text-[#71717a] dark:hover:text-[#E5E5E5] transition-colors",children:m?h.jsx(iI,{className:"h-4 w-4"}):h.jsx(aI,{className:"h-4 w-4"})})]})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Model ID"}),!N&&a.length>0?h.jsxs("div",{className:"relative",children:[h.jsxs("button",{type:"button",onClick:()=>g(!p),className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono flex items-center justify-between hover:bg-[#E5E7EB] dark:hover:bg-[#27272a] transition-colors",children:[(E==null?void 0:E.name)||c.modelId||"Select model",h.jsx(Rr,{className:"h-4 w-4 text-[#9CA3AF] dark:text-[#71717a]"})]}),p&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1)}),h.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-white dark:bg-[#18181b] border border-[#E5E7EB] dark:border-zinc-800 rounded-md py-1 z-50 max-h-48 overflow-y-auto shadow-lg",children:a.map(C=>h.jsx("button",{type:"button",className:J("w-full text-left px-3 py-2 text-sm font-mono hover:bg-[#F3F4F6] dark:hover:bg-[#27272a] transition-colors",c.modelId===C.id?"text-[#111827] dark:text-[#E5E5E5] bg-[#F3F4F6] dark:bg-[#27272a]":"text-[#6B7280] dark:text-[#a1a1aa]"),onClick:()=>{u({...c,modelId:C.id,name:C.name}),g(!1)},children:C.name},C.id))})]})]}):h.jsx("input",{type:"text",value:c.modelId,onChange:C=>u({...c,modelId:C.target.value}),placeholder:"gpt-4o, claude-3-opus, deepseek-chat, etc.",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"})]})]}),h.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[h.jsx("button",{type:"button",onClick:()=>t(!1),className:"flex-1 px-4 py-2 rounded-md text-sm text-[#6B7280] dark:text-[#a1a1aa] font-mono hover:bg-[#F3F4F6] dark:hover:bg-[#18181b] transition-colors",children:"Cancel"}),h.jsx("button",{type:"button",onClick:y,disabled:!x,className:"flex-1 px-4 py-2 rounded-md text-sm text-white font-semibold font-mono bg-[#16A34A] hover:bg-[#15803d] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Save Model"})]})]})]})})}function HU({open:e,onOpenChange:t,model:n,onSave:r}){const[i,a]=v.useState({baseUrl:"",apiKey:"",model:""}),[s,o]=v.useState(!1);v.useEffect(()=>{n&&a({baseUrl:n.baseUrl||"",apiKey:n.apiKey||"",model:n.model||""})},[n]);const l=()=>{!n||!i.model||(r(n.id,{baseUrl:i.baseUrl||void 0,apiKey:i.apiKey||void 0,model:i.model}),t(!1))},c=i.model;return h.jsx(yi,{open:e,onOpenChange:t,children:h.jsxs(Br,{className:"sm:max-w-[480px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl [&>button]:hidden","aria-describedby":void 0,children:[h.jsx(Fr,{className:"sr-only",children:"Edit Model"}),h.jsxs("div",{className:"p-6 flex flex-col gap-6",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-base font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono",children:"Edit Model"}),h.jsx("button",{onClick:()=>t(!1),className:"text-[#9CA3AF] hover:text-[#111827] dark:text-[#71717a] dark:hover:text-[#E5E5E5] transition-colors",children:h.jsx(nr,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Model ID"}),h.jsx("input",{type:"text",value:i.model,onChange:u=>a({...i,model:u.target.value}),placeholder:"gpt-4o, claude-3-opus, etc.",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Base URL"}),h.jsx("input",{type:"text",value:i.baseUrl,onChange:u=>a({...i,baseUrl:u.target.value}),placeholder:"https://api.openai.com/v1",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("label",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"API Key"}),h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:s?"text":"password",value:i.apiKey,onChange:u=>a({...i,apiKey:u.target.value}),placeholder:"Leave empty to keep current key",className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 py-2.5 pr-10 text-sm text-[#111827] dark:text-[#E5E5E5] font-mono placeholder:text-[#9CA3AF] dark:placeholder:text-[#71717a] focus:outline-none focus:ring-1 focus:ring-[#D1D5DB] dark:focus:ring-zinc-600"}),h.jsx("button",{type:"button",onClick:()=>o(!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[#9CA3AF] hover:text-[#111827] dark:text-[#71717a] dark:hover:text-[#E5E5E5] transition-colors",children:s?h.jsx(iI,{className:"h-4 w-4"}):h.jsx(aI,{className:"h-4 w-4"})})]})]})]}),h.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[h.jsx("button",{type:"button",onClick:()=>t(!1),className:"flex-1 px-4 py-2 rounded-md text-sm text-[#6B7280] dark:text-[#a1a1aa] font-mono hover:bg-[#F3F4F6] dark:hover:bg-[#18181b] transition-colors",children:"Cancel"}),h.jsx("button",{type:"button",onClick:l,disabled:!c,className:"flex-1 px-4 py-2 rounded-md text-sm text-white font-semibold font-mono bg-[#16A34A] hover:bg-[#15803d] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Save Changes"})]})]})]})})}const $U={"openai-compatible":{bg:"#10a37f",label:"OA"},anthropic:{bg:"#d97757",label:"A"},gemini:{bg:"#4285f4",label:"G"},"azure-openai":{bg:"#0078d4",label:"Az"},"gpt-openai-platform":{bg:"#10a37f",label:"GP"}};function GU(){var F;const{isSettingsOpen:e,toggleSettings:t,isSidebarOpen:n,setSidebarOpen:r}=pa(),{configuredModels:i,loadModels:a}=Ry(),s=Py(),[o,l]=v.useState("general"),[c,u]=v.useState(!1),[d,f]=v.useState(null),[p,g]=v.useState(null),[m,_]=v.useState(""),[b,y]=v.useState("all"),S=[{value:"general",label:"General"},{value:"models",label:"Models"},{value:"shortcuts",label:"Shortcuts"}],N=v.useMemo(()=>[{action:"Open command palette",combo:["Ctrl","K"],scope:"Global"},{action:"New chat",combo:["Ctrl","N"],scope:"Chat"},{action:"Focus input",combo:["Ctrl","L"],scope:"Chat"},{action:"Toggle sidebar",combo:["Ctrl","B"],scope:"Layout"},{action:"Search history",combo:["Ctrl","H"],scope:"History"}],[]).filter(w=>{const I=w.action.toLowerCase().includes(m.toLowerCase()),M=b==="all"||w.scope.toLowerCase()===b;return I&&M}),x=i.reduce((w,I)=>{const M=I.provider||"unknown";return w[M]||(w[M]=[]),w[M].push(I),w},{});v.useEffect(()=>{e&&(a(),s.loadSettings())},[e,a,s.loadSettings]);const C=async w=>{try{if(!(await fetch("/models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:w.bladeProvider,name:w.name||w.modelId,model:w.modelId,baseUrl:w.baseUrl||void 0,apiKey:w.apiKey||void 0})})).ok)throw new Error("Failed to save model");await a()}catch(I){console.error("Failed to save model:",I)}},O=async w=>{try{if(!(await fetch(`/models/${w}`,{method:"DELETE"})).ok)throw new Error("Failed to delete model");await a()}catch(I){console.error("Failed to delete model:",I)}},B=async(w,I)=>{try{if(!(await fetch(`/models/${w}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)})).ok)throw new Error("Failed to update model");await a()}catch(M){console.error("Failed to update model:",M)}},R=w=>{f(d===w?null:w)};return h.jsxs(h.Fragment,{children:[h.jsx(yi,{open:e,onOpenChange:t,children:h.jsxs(Br,{className:"sm:max-w-[800px] h-[600px] p-0 overflow-hidden gap-0 bg-white dark:bg-[#09090b] border border-[#E5E7EB] dark:border-zinc-800 rounded-xl flex flex-col","aria-describedby":void 0,hideCloseButton:!0,children:[h.jsx(Fr,{className:"sr-only",children:"Settings"}),h.jsxs("div",{className:"flex h-full",children:[h.jsx("div",{className:"w-[200px] h-full bg-[#F3F4F6] dark:bg-[#18181b] p-6 flex flex-col gap-2",children:S.map(w=>h.jsx("button",{onClick:()=>l(w.value),className:J("w-full text-left px-3 py-2 rounded-md text-sm font-mono transition-colors",o===w.value?"bg-[#E5E7EB] dark:bg-[#27272a] text-[#111827] dark:text-[#E5E5E5] font-medium":"text-[#6B7280] hover:text-[#111827] hover:bg-[#E5E7EB]/60 dark:text-[#a1a1aa] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a]/50"),children:w.label},w.value))}),h.jsxs("div",{className:"flex-1 p-8 flex flex-col gap-6 overflow-hidden",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-lg font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono",children:o==="general"?"Settings":(F=S.find(w=>w.value===o))==null?void 0:F.label}),h.jsx("button",{onClick:t,className:"h-8 w-8 rounded-md text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a] transition-colors flex items-center justify-center",children:h.jsx(nr,{className:"h-4 w-4"})})]}),o==="models"&&h.jsxs("div",{className:"flex flex-col gap-6 flex-1 min-h-0 overflow-hidden",children:[h.jsx("p",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono shrink-0",children:"Configure API keys and model settings for different providers."}),h.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:h.jsxs("div",{className:"flex flex-col gap-2 pr-2",children:[Object.entries(x).map(([w,I])=>{const M=$U[w]||{bg:"#71717a",label:"?"},j=I.some(U=>U.apiKey),D=d===w;return h.jsxs("div",{className:"w-full bg-[#F3F4F6] dark:bg-[#18181b] rounded-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>R(w),className:"w-full p-4 flex items-center justify-between hover:bg-[#E5E7EB] dark:hover:bg-[#1f1f23] transition-colors",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-8 h-8 rounded flex items-center justify-center text-white text-xs font-bold",style:{backgroundColor:M.bg},children:M.label}),h.jsxs("div",{className:"flex flex-col gap-0.5 text-left",children:[h.jsx("span",{className:"text-sm font-semibold text-[#111827] dark:text-[#E5E5E5] font-mono capitalize",children:w.replace(/-/g," ")}),h.jsxs("span",{className:"text-xs text-[#9CA3AF] dark:text-[#71717a] font-mono",children:[I.length," model",I.length>1?"s":""]})]})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("span",{className:J("text-xs font-mono",j?"text-[#16A34A]":"text-[#9CA3AF] dark:text-[#71717a]"),children:j?"● Connected":"○ Not Connected"}),h.jsx(Rr,{className:J("h-4 w-4 text-[#9CA3AF] dark:text-[#71717a] transition-transform",D&&"rotate-180")})]})]}),D&&h.jsx("div",{className:"border-t border-[#E5E7EB] dark:border-zinc-800",children:I.map(U=>h.jsxs("div",{className:"px-4 py-3 flex items-center justify-between hover:bg-[#E5E7EB] dark:hover:bg-[#1f1f23] group",children:[h.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[h.jsx("span",{className:"text-sm text-[#111827] dark:text-[#E5E5E5] font-mono truncate",children:U.model}),h.jsx("span",{className:"text-xs text-[#9CA3AF] dark:text-[#71717a] font-mono truncate",children:U.baseUrl||"Default URL"})]}),h.jsxs("div",{className:"flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{onClick:()=>g(U),className:"p-1.5 text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-[#E5E5E5] dark:hover:bg-[#27272a] rounded transition-colors",children:h.jsx(sI,{className:"h-3.5 w-3.5"})}),h.jsx("button",{onClick:()=>O(U.id),className:"p-1.5 text-[#9CA3AF] hover:text-red-500 hover:bg-[#E5E7EB] dark:text-[#71717a] dark:hover:text-red-400 dark:hover:bg-[#27272a] rounded transition-colors",children:h.jsx(Dy,{className:"h-3.5 w-3.5"})})]})]},U.id))})]},w)}),Object.keys(x).length===0&&h.jsx("div",{className:"text-center py-8 text-[#9CA3AF] dark:text-[#71717a] text-sm font-mono",children:"No models configured yet"})]})}),h.jsx("button",{onClick:()=>u(!0),className:"w-full py-3 rounded-md text-[#6B7280] dark:text-[#a1a1aa] text-[13px] font-mono hover:bg-[#F3F4F6] dark:bg-[#18181b] transition-colors shrink-0",children:"+ Add New Model"})]}),o==="general"&&h.jsxs("div",{className:"flex flex-col gap-6 overflow-y-auto pr-2",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-[14px] text-[#111827] dark:text-[#E5E5E5] font-mono font-semibold",children:"General"}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Response Language"}),h.jsx("span",{className:"text-[11px] text-[#9CA3AF] dark:text-[#71717a] font-mono",children:"AI will respond in this language"})]}),h.jsxs("select",{value:s.language,onChange:w=>s.updateSettings({language:w.target.value}),className:"h-8 bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[12px] font-mono rounded-md px-3 border border-[#E5E7EB] dark:border-[#27272a]",children:[h.jsx("option",{value:"en-US",children:"English (US)"}),h.jsx("option",{value:"zh-CN",children:"简体中文"}),h.jsx("option",{value:"zh-TW",children:"繁體中文"}),h.jsx("option",{value:"ja-JP",children:"日本語"}),h.jsx("option",{value:"ko-KR",children:"한국어"}),h.jsx("option",{value:"es-ES",children:"Español"}),h.jsx("option",{value:"fr-FR",children:"Français"}),h.jsx("option",{value:"de-DE",children:"Deutsch"}),h.jsx("option",{value:"pt-BR",children:"Português (BR)"}),h.jsx("option",{value:"ru-RU",children:"Русский"})]})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Auto-save sessions"}),h.jsx(Sa,{enabled:s.autoSaveSessions,onChange:w=>s.updateSettings({autoSaveSessions:w})})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-[14px] text-[#111827] dark:text-[#E5E5E5] font-mono font-semibold",children:"Appearance"}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Theme Preference"}),h.jsx("div",{className:"flex items-center gap-2 bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md p-1",children:["dark","light","system"].map(w=>h.jsx("button",{onClick:()=>s.updateSettings({uiTheme:w}),className:J("px-3 py-1 rounded text-[12px] font-mono transition-colors",s.uiTheme===w?"bg-[#E5E7EB] dark:bg-[#27272a] text-[#111827] dark:text-[#E5E5E5]":"text-[#9CA3AF] dark:text-[#71717a] hover:text-[#111827] dark:hover:text-[#E5E5E5]"),children:w==="dark"?"Dark":w==="light"?"Light":"System"},w))})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Compact sidebar"}),h.jsx(Sa,{enabled:!n,onChange:w=>r(!w)})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Code theme"}),h.jsx("span",{className:"text-[11px] text-[#9CA3AF] dark:text-[#71717a] font-mono",children:"Syntax highlighting colors"})]}),h.jsxs("select",{value:s.theme,onChange:w=>s.updateSettings({theme:w.target.value}),className:"h-8 bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[12px] font-mono rounded-md px-3 border border-[#E5E7EB] dark:border-[#27272a]",children:[h.jsx("option",{value:"dracula",children:"Dracula"}),h.jsx("option",{value:"monokai",children:"Monokai"}),h.jsx("option",{value:"nord",children:"Nord"}),h.jsx("option",{value:"tokyo-night",children:"Tokyo Night"}),h.jsx("option",{value:"one-dark",children:"One Dark"}),h.jsx("option",{value:"catppuccin",children:"Catppuccin"}),h.jsx("option",{value:"gruvbox",children:"Gruvbox"}),h.jsx("option",{value:"github",children:"GitHub"}),h.jsx("option",{value:"solarized-light",children:"Solarized Light"}),h.jsx("option",{value:"solarized-dark",children:"Solarized Dark"}),h.jsx("option",{value:"ayu-dark",children:"Ayu Dark"}),h.jsx("option",{value:"rose-pine",children:"Rose Pine"}),h.jsx("option",{value:"kanagawa",children:"Kanagawa"})]})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-[14px] text-[#111827] dark:text-[#E5E5E5] font-mono font-semibold",children:"Notifications"}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Build finished"}),h.jsx(Sa,{enabled:s.notifyBuild,onChange:w=>s.updateSettings({notifyBuild:w})})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Errors only"}),h.jsx(Sa,{enabled:s.notifyErrors,onChange:w=>s.updateSettings({notifyErrors:w})})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"System sounds"}),h.jsx(Sa,{enabled:s.notifySounds,onChange:w=>s.updateSettings({notifySounds:w})})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-[14px] text-[#111827] dark:text-[#E5E5E5] font-mono font-semibold",children:"Privacy"}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Telemetry"}),h.jsx(Sa,{enabled:s.privacyTelemetry,onChange:w=>s.updateSettings({privacyTelemetry:w})})]}),h.jsxs("div",{className:"flex items-center justify-between py-2",children:[h.jsx("span",{className:"text-[13px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:"Crash reports"}),h.jsx(Sa,{enabled:s.privacyCrash,onChange:w=>s.updateSettings({privacyCrash:w})})]})]})]}),o==="shortcuts"&&h.jsxs("div",{className:"flex flex-col gap-4 flex-1 min-h-0 overflow-hidden",children:[h.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[h.jsx("input",{value:m,onChange:w=>_(w.target.value),placeholder:"Search actions...",className:"flex-1 h-9 bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono"}),h.jsxs("select",{value:b,onChange:w=>y(w.target.value),className:"h-9 bg-[#F3F4F6] dark:bg-[#18181b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md px-3 text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono",children:[h.jsx("option",{value:"all",children:"All scopes"}),h.jsx("option",{value:"global",children:"Global"}),h.jsx("option",{value:"chat",children:"Chat"}),h.jsx("option",{value:"layout",children:"Layout"}),h.jsx("option",{value:"history",children:"History"})]}),h.jsx("button",{onClick:()=>{_(""),y("all")},className:"h-9 px-3 rounded-md bg-[#E5E7EB] dark:bg-[#27272a] text-[#111827] dark:text-[#E5E5E5] text-[12px] font-mono font-semibold",children:"Reset"})]}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto border border-[#E5E7EB] dark:border-[#27272a] rounded-lg bg-[#E5E7EB] dark:bg-[#111827]",children:[h.jsxs("div",{className:"grid grid-cols-[1fr_180px_120px] gap-2 px-3 py-2 bg-white dark:bg-[#0C0C0C] text-[12px] text-[#6B7280] dark:text-[#94a3b8] font-mono font-semibold",children:[h.jsx("span",{children:"Action"}),h.jsx("span",{children:"Shortcut"}),h.jsx("span",{children:"Scope"})]}),N.map((w,I)=>h.jsxs("div",{className:J("grid grid-cols-[1fr_180px_120px] gap-2 px-3 py-2 text-[13px] font-mono",I%2===0?"bg-[#E5E7EB] dark:bg-[#111827]":"bg-white dark:bg-[#0C0C0C]"),children:[h.jsx("span",{className:"text-[#111827] dark:text-[#E5E5E5]",children:w.action}),h.jsx("div",{className:"flex items-center gap-1",children:w.combo.map(M=>h.jsx("span",{className:"px-2 py-0.5 rounded bg-[#F3F4F6] dark:bg-[#18181b] text-[#111827] dark:text-[#E5E5E5] text-[12px] font-mono font-semibold",children:M},M))}),h.jsx("span",{className:"text-[#6B7280] dark:text-[#94a3b8] text-[12px]",children:w.scope})]},`${w.action}-${w.scope}`)),N.length===0&&h.jsx("div",{className:"px-3 py-6 text-center text-[12px] text-[#6B7280] dark:text-[#94a3b8] font-mono",children:"No shortcuts found."})]})]})]})]})]})}),h.jsx(zU,{open:c,onOpenChange:u,onSave:C}),h.jsx(HU,{open:!!p,onOpenChange:w=>!w&&g(null),model:p,onSave:B})]})}function Sa({enabled:e,onChange:t}){return h.jsx("button",{onClick:()=>t(!e),className:J("w-10 h-5 rounded-full px-0.5 flex items-center transition-colors",e?"bg-[#22C55E]":"bg-[#E5E7EB] dark:bg-[#27272a]"),children:h.jsx("span",{className:J("h-4 w-4 rounded-full transition-transform",e?"translate-x-5 bg-white":"translate-x-0 bg-white dark:bg-[#a1a1aa]")})})}const VU="modulepreload",WU=function(e){return"/"+e},$1={},HI=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=WU(l),l in $1)return;$1[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":VU,c||(d.as="script"),d.crossOrigin="",d.href=l,o&&d.setAttribute("nonce",o),document.head.appendChild(d),c)return new Promise((f,p)=>{d.addEventListener("load",f),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function a(s){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s}return i.then(s=>{for(const o of s||[])o.status==="rejected"&&a(o.reason);return t().catch(a)})};function qU(e){const t=e+"CollectionProvider",[n,r]=fa(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:_,children:b}=m,y=gt.useRef(null),S=gt.useRef(new Map).current;return h.jsx(i,{scope:_,itemMap:S,collectionRef:y,children:b})};s.displayName=t;const o=e+"CollectionSlot",l=ec(o),c=gt.forwardRef((m,_)=>{const{scope:b,children:y}=m,S=a(o,b),E=ht(_,S.collectionRef);return h.jsx(l,{ref:E,children:y})});c.displayName=o;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=ec(u),p=gt.forwardRef((m,_)=>{const{scope:b,children:y,...S}=m,E=gt.useRef(null),N=ht(_,E),x=a(u,b);return gt.useEffect(()=>(x.itemMap.set(E,{ref:E,...S}),()=>void x.itemMap.delete(E))),h.jsx(f,{[d]:"",ref:N,children:y})});p.displayName=u;function g(m){const _=a(e+"CollectionConsumer",m);return gt.useCallback(()=>{const y=_.collectionRef.current;if(!y)return[];const S=Array.from(y.querySelectorAll(`[${d}]`));return Array.from(_.itemMap.values()).sort((x,C)=>S.indexOf(x.ref.current)-S.indexOf(C.ref.current))},[_.collectionRef,_.itemMap])}return[{Provider:s,Slot:c,ItemSlot:p},g,r]}var dp="rovingFocusGroup.onEntryFocus",YU={bubbles:!1,cancelable:!0},Ac="RovingFocusGroup",[lm,$I,KU]=qU(Ac),[ZU,GI]=fa(Ac,[KU]),[XU,QU]=ZU(Ac),VI=v.forwardRef((e,t)=>h.jsx(lm.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(lm.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(JU,{...e,ref:t})})}));VI.displayName=Ac;var JU=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:s,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,f=v.useRef(null),p=ht(t,f),g=yy(a),[m,_]=Cc({prop:s,defaultProp:o??null,onChange:l,caller:Ac}),[b,y]=v.useState(!1),S=pn(c),E=$I(n),N=v.useRef(!1),[x,C]=v.useState(0);return v.useEffect(()=>{const O=f.current;if(O)return O.addEventListener(dp,S),()=>O.removeEventListener(dp,S)},[S]),h.jsx(XU,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:v.useCallback(O=>_(O),[_]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>C(O=>O+1),[]),onFocusableItemRemove:v.useCallback(()=>C(O=>O-1),[]),children:h.jsx(Ve.div,{tabIndex:b||x===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:Ne(e.onMouseDown,()=>{N.current=!0}),onFocus:Ne(e.onFocus,O=>{const B=!N.current;if(O.target===O.currentTarget&&B&&!b){const R=new CustomEvent(dp,YU);if(O.currentTarget.dispatchEvent(R),!R.defaultPrevented){const F=E().filter(D=>D.focusable),w=F.find(D=>D.active),I=F.find(D=>D.id===m),j=[w,I,...F].filter(Boolean).map(D=>D.ref.current);YI(j,u)}}N.current=!1}),onBlur:Ne(e.onBlur,()=>y(!1))})})}),WI="RovingFocusGroupItem",qI=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:s,...o}=e,l=Ua(),c=a||l,u=QU(WI,n),d=u.currentTabStopId===c,f=$I(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:m}=u;return v.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),h.jsx(lm.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:h.jsx(Ve.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:Ne(e.onMouseDown,_=>{r?u.onItemFocus(c):_.preventDefault()}),onFocus:Ne(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Ne(e.onKeyDown,_=>{if(_.key==="Tab"&&_.shiftKey){u.onItemShiftTab();return}if(_.target!==_.currentTarget)return;const b=nj(_,u.orientation,u.dir);if(b!==void 0){if(_.metaKey||_.ctrlKey||_.altKey||_.shiftKey)return;_.preventDefault();let S=f().filter(E=>E.focusable).map(E=>E.ref.current);if(b==="last")S.reverse();else if(b==="prev"||b==="next"){b==="prev"&&S.reverse();const E=S.indexOf(_.currentTarget);S=u.loop?rj(S,E+1):S.slice(E+1)}setTimeout(()=>YI(S))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});qI.displayName=WI;var ej={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function tj(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function nj(e,t,n){const r=tj(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ej[r]}function YI(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function rj(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ij=VI,aj=qI,jh="Tabs",[sj]=fa(jh,[GI]),KI=GI(),[oj,zy]=sj(jh),ZI=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:s="horizontal",dir:o,activationMode:l="automatic",...c}=e,u=yy(o),[d,f]=Cc({prop:r,onChange:i,defaultProp:a??"",caller:jh});return h.jsx(oj,{scope:n,baseId:Ua(),value:d,onValueChange:f,orientation:s,dir:u,activationMode:l,children:h.jsx(Ve.div,{dir:u,"data-orientation":s,...c,ref:t})})});ZI.displayName=jh;var XI="TabsList",QI=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,a=zy(XI,n),s=KI(n);return h.jsx(ij,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:r,children:h.jsx(Ve.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});QI.displayName=XI;var JI="TabsTrigger",eO=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,s=zy(JI,n),o=KI(n),l=rO(s.baseId,r),c=iO(s.baseId,r),u=r===s.value;return h.jsx(aj,{asChild:!0,...o,focusable:!i,active:u,children:h.jsx(Ve.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...a,ref:t,onMouseDown:Ne(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Ne(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Ne(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!i&&d&&s.onValueChange(r)})})})});eO.displayName=JI;var tO="TabsContent",nO=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:a,...s}=e,o=zy(tO,n),l=rO(o.baseId,r),c=iO(o.baseId,r),u=r===o.value,d=v.useRef(u);return v.useEffect(()=>{const f=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(f)},[]),h.jsx(Jn,{present:i||u,children:({present:f})=>h.jsx(Ve.div,{"data-state":u?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:f&&a})})});nO.displayName=tO;function rO(e,t){return`${e}-trigger-${t}`}function iO(e,t){return`${e}-content-${t}`}var lj=ZI,aO=QI,sO=eO,oO=nO;const cj=lj,lO=v.forwardRef(({className:e,...t},n)=>h.jsx(aO,{ref:n,className:J("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));lO.displayName=aO.displayName;const Vu=v.forwardRef(({className:e,...t},n)=>h.jsx(sO,{ref:n,className:J("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Vu.displayName=sO.displayName;const Wu=v.forwardRef(({className:e,...t},n)=>h.jsx(oO,{ref:n,className:J("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Wu.displayName=oO.displayName;const uj={"ayu-dark":{background:{primary:"#0f1419",secondary:"#14191f"},text:{primary:"#e6e1cf",secondary:"#bae67e",muted:"#5c6773"},border:{light:"#2d323b"},syntax:{comment:"#5c6773",string:"#bae67e",number:"#ffcc66",keyword:"#ff8f40",function:"#73d0ff",variable:"#e6e1cf",operator:"#f29e74",type:"#73d0ff",tag:"#ff8f40",attr:"#ffd580",default:"#e6e1cf"}},dracula:{background:{primary:"#282a36",secondary:"#44475a"},text:{primary:"#f8f8f2",secondary:"#f1fa8c",muted:"#6272a4"},border:{light:"#44475a"},syntax:{comment:"#6272a4",string:"#f1fa8c",number:"#bd93f9",keyword:"#ff79c6",function:"#50fa7b",variable:"#f8f8f2",operator:"#ff79c6",type:"#8be9fd",tag:"#ff79c6",attr:"#50fa7b",default:"#f8f8f2"}},monokai:{background:{primary:"#272822",secondary:"#3e3d32"},text:{primary:"#f8f8f2",secondary:"#e6db74",muted:"#75715e"},border:{light:"#3e3d32"},syntax:{comment:"#75715e",string:"#e6db74",number:"#ae81ff",keyword:"#f92672",function:"#a6e22e",variable:"#f8f8f2",operator:"#f92672",type:"#66d9ef",tag:"#f92672",attr:"#a6e22e",default:"#f8f8f2"}},nord:{background:{primary:"#2e3440",secondary:"#3b4252"},text:{primary:"#eceff4",secondary:"#d8dee9",muted:"#4c566a"},border:{light:"#434c5e"},syntax:{comment:"#616e88",string:"#a3be8c",number:"#b48ead",keyword:"#81a1c1",function:"#88c0d0",variable:"#d8dee9",operator:"#81a1c1",type:"#8fbcbb",tag:"#81a1c1",attr:"#8fbcbb",default:"#eceff4"}},"solarized-light":{background:{primary:"#fdf6e3",secondary:"#eee8d5"},text:{primary:"#586e75",secondary:"#657b83",muted:"#93a1a1"},border:{light:"#eee8d5"},syntax:{comment:"#93a1a1",string:"#2aa198",number:"#d33682",keyword:"#859900",function:"#268bd2",variable:"#657b83",operator:"#859900",type:"#b58900",tag:"#268bd2",attr:"#93a1a1",default:"#657b83"}},"solarized-dark":{background:{primary:"#002b36",secondary:"#073642"},text:{primary:"#839496",secondary:"#93a1a1",muted:"#586e75"},border:{light:"#073642"},syntax:{comment:"#586e75",string:"#2aa198",number:"#d33682",keyword:"#859900",function:"#268bd2",variable:"#839496",operator:"#859900",type:"#b58900",tag:"#268bd2",attr:"#93a1a1",default:"#839496"}},"tokyo-night":{background:{primary:"#1a1b26",secondary:"#292e42"},text:{primary:"#a9b1d6",secondary:"#c0caf5",muted:"#565f89"},border:{light:"#292e42"},syntax:{comment:"#565f89",string:"#9ece6a",number:"#ff9e64",keyword:"#bb9af7",function:"#7aa2f7",variable:"#c0caf5",operator:"#89ddff",type:"#7dcfff",tag:"#f7768e",attr:"#7aa2f7",default:"#a9b1d6"}},github:{background:{primary:"#ffffff",secondary:"#f6f8fa"},text:{primary:"#24292f",secondary:"#57606a",muted:"#6e7781"},border:{light:"#d0d7de"},syntax:{comment:"#6e7781",string:"#0a3069",number:"#0550ae",keyword:"#cf222e",function:"#8250df",variable:"#24292f",operator:"#cf222e",type:"#0550ae",tag:"#116329",attr:"#0550ae",default:"#24292f"}},gruvbox:{background:{primary:"#282828",secondary:"#3c3836"},text:{primary:"#ebdbb2",secondary:"#d5c4a1",muted:"#928374"},border:{light:"#3c3836"},syntax:{comment:"#928374",string:"#b8bb26",number:"#d3869b",keyword:"#fb4934",function:"#b8bb26",variable:"#ebdbb2",operator:"#fe8019",type:"#fabd2f",tag:"#fb4934",attr:"#fabd2f",default:"#ebdbb2"}},"one-dark":{background:{primary:"#282c34",secondary:"#21252b"},text:{primary:"#abb2bf",secondary:"#e5c07b",muted:"#5c6370"},border:{light:"#3e4451"},syntax:{comment:"#5c6370",string:"#98c379",number:"#d19a66",keyword:"#c678dd",function:"#61afef",variable:"#e06c75",operator:"#56b6c2",type:"#e5c07b",tag:"#e06c75",attr:"#d19a66",default:"#abb2bf"}},catppuccin:{background:{primary:"#1e1e2e",secondary:"#313244"},text:{primary:"#cdd6f4",secondary:"#f5e0dc",muted:"#6c7086"},border:{light:"#313244"},syntax:{comment:"#6c7086",string:"#a6e3a1",number:"#fab387",keyword:"#cba6f7",function:"#89b4fa",variable:"#f5e0dc",operator:"#89dceb",type:"#f9e2af",tag:"#f38ba8",attr:"#f9e2af",default:"#cdd6f4"}},"rose-pine":{background:{primary:"#191724",secondary:"#1f1d2e"},text:{primary:"#e0def4",secondary:"#908caa",muted:"#6e6a86"},border:{light:"#26233a"},syntax:{comment:"#6e6a86",string:"#f6c177",number:"#ebbcba",keyword:"#c4a7e7",function:"#9ccfd8",variable:"#e0def4",operator:"#31748f",type:"#eb6f92",tag:"#eb6f92",attr:"#c4a7e7",default:"#e0def4"}},kanagawa:{background:{primary:"#1f1f28",secondary:"#2a2a37"},text:{primary:"#dcd7ba",secondary:"#c8c093",muted:"#727169"},border:{light:"#2a2a37"},syntax:{comment:"#727169",string:"#98bb6c",number:"#d27e99",keyword:"#957fb8",function:"#7e9cd8",variable:"#dcd7ba",operator:"#c0a36e",type:"#7aa89f",tag:"#e46876",attr:"#ffa066",default:"#dcd7ba"}}};function dj(e){const t=e.replace("#",""),n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16);return(.299*n+.587*r+.114*i)/255<.5}function hj(e){return{base:dj(e.background.primary)?"vs-dark":"vs",inherit:!0,rules:[{token:"",foreground:e.text.primary.replace("#",""),background:e.background.primary.replace("#","")},{token:"comment",foreground:e.syntax.comment.replace("#",""),fontStyle:"italic"},{token:"string",foreground:e.syntax.string.replace("#","")},{token:"number",foreground:e.syntax.number.replace("#","")},{token:"keyword",foreground:e.syntax.keyword.replace("#","")},{token:"type",foreground:e.syntax.type.replace("#","")},{token:"identifier",foreground:e.syntax.variable.replace("#","")},{token:"function",foreground:e.syntax.function.replace("#","")},{token:"variable",foreground:e.syntax.variable.replace("#","")},{token:"operator",foreground:e.syntax.operator.replace("#","")},{token:"delimiter",foreground:e.syntax.operator.replace("#","")},{token:"tag",foreground:e.syntax.tag.replace("#","")},{token:"attribute.name",foreground:e.syntax.attr.replace("#","")},{token:"attribute.value",foreground:e.syntax.string.replace("#","")}],colors:{"editor.background":e.background.primary,"editor.foreground":e.text.primary,"editor.lineHighlightBackground":e.background.secondary,"editor.selectionBackground":`${e.syntax.function}40`,"editorLineNumber.foreground":e.text.muted,"editorLineNumber.activeForeground":e.text.secondary,"editorCursor.foreground":e.text.primary,"editorIndentGuide.background":e.border.light,"editorWidget.background":e.background.secondary,"editorWidget.border":e.border.light,"scrollbarSlider.background":`${e.text.muted}40`,"scrollbarSlider.hoverBackground":`${e.text.muted}60`}}}const G1=new Set;function V1(e,t){const n=t.toLowerCase().replace(/\s+/g,"-"),r=uj[n];if(!r)return"vs-dark";if(!G1.has(n)){const i=hj(r);e.editor.defineTheme(n,i),G1.add(n)}return n}v.lazy(async()=>({default:(await HI(()=>import("./index-D7eULMmn.js"),[])).DiffEditor}));const fj=v.lazy(async()=>({default:(await HI(()=>import("./index-D7eULMmn.js"),[])).Editor}));function pj(){const{toggleFilePreview:e}=pa(),{messages:t,currentSessionId:n}=bi(),[r,i]=v.useState("diff"),[a,s]=v.useState([]),[o,l]=v.useState({}),[c,u]=v.useState(!1),[d,f]=v.useState(null),[p,g]=v.useState({}),[m,_]=v.useState({}),[b,y]=v.useState(null),[S,E]=v.useState(""),[N,x]=v.useState(!1),[C,O]=v.useState(null),[B,R]=v.useState(!1),F=async(k="")=>{try{const $=k?`/suggestions/files/tree?path=${encodeURIComponent(k)}`:"/suggestions/files/tree",W=await fetch($);if(!W.ok)throw new Error("Failed to load tree");return(await W.json()).map(te=>({...te,children:te.type==="dir"?[]:void 0}))}catch{return[]}};v.useEffect(()=>{let k=!0;return(async()=>{u(!0),f(null);try{const W=await F();k&&s(W)}catch(W){k&&f(W.message)}finally{k&&u(!1)}})(),()=>{k=!1}},[n]),v.useEffect(()=>{y(null),E(""),O(null),R(!1),g({}),l({})},[n]);const w=v.useMemo(()=>bj(t),[t]),I=v.useMemo(()=>mj(t),[t]),[M,j]=v.useState({}),D=k=>{j($=>({...$,[k]:!$[k]}))},U=async k=>{y(k),E(""),x(!0),O(null),R(!1);try{const $=await fetch(`/suggestions/files/content?path=${encodeURIComponent(k)}`);if(!$.ok)throw new Error("Failed to load file");const W=await $.json();E(W.content||""),R(!!W.truncated)}catch($){O($.message)}finally{x(!1)}},L=async k=>{const $=!p[k];if(g(W=>({...W,[k]:$})),$&&!o[k]){const W=await F(k);l(A=>({...A,[k]:W}))}},G=k=>{_($=>({...$,[k]:!$[k]}))};return h.jsxs("div",{className:"w-[55%] min-w-[420px] max-w-[860px] border-l border-[#E5E7EB] dark:border-zinc-800 bg-white dark:bg-[#09090b] flex flex-col h-full shadow-xl shrink-0",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 h-12 border-b border-[#E5E7EB] dark:border-zinc-800 shrink-0",children:[h.jsx("span",{className:"font-normal text-[13px] text-[#6B7280] dark:text-zinc-400 font-mono",children:"Preview"}),h.jsx(Gs,{variant:"ghost",size:"icon",onClick:e,className:"h-8 w-8 text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB]/60 dark:text-zinc-500 dark:hover:text-zinc-300 dark:hover:bg-zinc-800/50",children:h.jsx(nr,{className:"w-4 h-4"})})]}),h.jsxs(cj,{value:r,onValueChange:k=>i(k),className:"flex flex-col flex-1 min-h-0",children:[h.jsx("div",{className:"px-4 py-3 border-b border-[#E5E7EB] dark:border-zinc-800",children:h.jsxs(lO,{className:"bg-white dark:bg-[#111113] border border-[#E5E7EB] dark:border-[#27272a] h-9 p-1 rounded-md w-full justify-start",children:[h.jsx(Vu,{value:"diff",className:"text-[12px] font-mono px-3 text-[#6B7280] dark:text-[#a1a1aa] data-[state=active]:bg-[#E5E7EB] data-[state=active]:text-[#111827] dark:data-[state=active]:bg-[#27272a] dark:data-[state=active]:text-white",children:"Diff"}),h.jsx(Vu,{value:"files",className:"text-[12px] font-mono px-3 text-[#6B7280] dark:text-[#a1a1aa] data-[state=active]:bg-[#E5E7EB] data-[state=active]:text-[#111827] dark:data-[state=active]:bg-[#27272a] dark:data-[state=active]:text-white",children:"Files"}),h.jsx(Vu,{value:"logs",className:"text-[12px] font-mono px-3 text-[#6B7280] dark:text-[#a1a1aa] data-[state=active]:bg-[#E5E7EB] data-[state=active]:text-[#111827] dark:data-[state=active]:bg-[#27272a] dark:data-[state=active]:text-white",children:"Logs"})]})}),h.jsx(Wu,{value:"diff",className:"overflow-hidden flex-1 mt-0",children:h.jsx("div",{className:"overflow-y-auto px-4 py-4 space-y-3 h-full",children:w.length===0?h.jsx(Jo,{title:"No patch yet",subtitle:"Run a tool that changes files to see diffs here."}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono mb-2",children:[w.length," changed file",w.length>1?"s":""]}),w.map(k=>{var A;const $=((A=k.filePath)==null?void 0:A.split("/").pop())||"unknown",W=M[k.filePath||""]!==!1;return h.jsxs("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>D(k.filePath||""),className:"w-full flex items-center gap-2 px-3 py-2 bg-[#F9FAFB] dark:bg-[#111113] hover:bg-[#F3F4F6] dark:hover:bg-[#18181b] transition-colors",children:[W?h.jsx(Rr,{className:"w-4 h-4 text-[#6B7280] dark:text-[#71717a]"}):h.jsx(Wd,{className:"w-4 h-4 text-[#6B7280] dark:text-[#71717a]"}),h.jsx(rc,{className:"w-4 h-4 text-[#6B7280] dark:text-[#71717a]"}),h.jsx("span",{className:"text-[13px] text-[#111827] dark:text-[#E5E5E5] font-mono flex-1 text-left truncate",children:$}),k.summary&&h.jsx("span",{className:"text-[11px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:k.summary})]}),W&&h.jsxs("div",{className:"border-t border-[#E5E7EB] dark:border-[#27272a]",children:[h.jsx("div",{className:"px-3 py-1 text-[11px] text-[#9CA3AF] dark:text-[#52525b] font-mono truncate",children:k.filePath}),h.jsx(vj,{diff:k.diff})]})]},k.filePath)})]})})}),h.jsx(Wu,{value:"files",className:"overflow-hidden flex-1 mt-0",children:h.jsxs("div",{className:"px-4 py-4 h-full",children:[c&&h.jsx(Jo,{title:"Loading files…",subtitle:"Fetching workspace tree."}),!c&&d&&h.jsx(Jo,{title:"Failed to load files",subtitle:d}),!c&&!d&&a.length===0&&h.jsx(Jo,{title:"No files yet",subtitle:"Start a session to load the workspace tree."}),!c&&!d&&a.length>0&&h.jsxs("div",{className:"h-full grid grid-cols-[220px_1fr] gap-4 min-h-0",children:[h.jsx("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-lg p-2 overflow-y-auto min-h-0",children:a.map(k=>h.jsx(cO,{node:k,depth:0,expandedDirs:p,childrenCache:o,toggleDir:L,selectedPath:b,onSelectFile:U},k.path))}),h.jsxs("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-lg overflow-hidden flex flex-col min-h-0",children:[h.jsxs("div",{className:"px-3 py-2 bg-[#F9FAFB] dark:bg-[#111113] border-b border-[#E5E7EB] dark:border-[#27272a] text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono flex items-center justify-between",children:[h.jsx("span",{children:b||"Select a file to preview"}),b&&h.jsx("span",{className:"text-[11px] text-[#9CA3AF] dark:text-[#a1a1aa] font-mono",children:N?"Loading…":B?"Truncated":"Ready"})]}),B&&!N&&h.jsx("div",{className:"px-3 py-2 bg-[#FEF3C7] dark:bg-[#111113] border-b border-[#E5E7EB] dark:border-[#27272a] text-[11px] text-[#b45309] dark:text-[#facc15] font-mono",children:"Preview truncated to 200k characters."}),h.jsxs("div",{className:"flex-1 min-h-0",children:[!b&&h.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono",children:"Pick a file from the tree to preview."}),b&&C&&h.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[#DC2626] dark:text-[#fca5a5] font-mono",children:C}),b&&!C&&h.jsx("div",{className:"h-full",children:N?h.jsx(Y1,{}):h.jsx(v.Suspense,{fallback:h.jsx(Y1,{}),children:h.jsx(yj,{content:S,filename:b})})})]})]})]})]})}),h.jsx(Wu,{value:"logs",className:"overflow-hidden flex-1 mt-0",children:h.jsx("div",{className:"overflow-y-auto px-4 py-4 space-y-3 h-full",children:I.length===0?h.jsx(Jo,{title:"No logs yet",subtitle:"Tool runs will appear here."}):I.map(k=>{var se;const $=m[k.id],W=(k.content||"").split(`
263
263
  `),A=W.length>10||(((se=k.content)==null?void 0:se.length)||0)>800,te=$||!A?W:W.slice(0,8);return h.jsxs("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-lg overflow-hidden",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-[#F9FAFB] dark:bg-[#111113] border-b border-[#E5E7EB] dark:border-[#27272a]",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("div",{className:"text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono",children:k.title}),k.subtitle&&h.jsx("div",{className:"text-[11px] text-[#6B7280] dark:text-[#71717a] font-mono",children:k.subtitle})]}),h.jsx(gj,{status:k.status})]}),k.content&&h.jsxs("div",{className:"px-3 py-3 space-y-2",children:[h.jsxs("pre",{className:"text-[12px] text-[#374151] dark:text-[#d4d4d8] bg-[#F3F4F6] dark:bg-[#09090b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md p-3 overflow-x-auto whitespace-pre-wrap font-mono",children:[te.join(`
264
264
  `),!$&&A&&`
265
265
  …`]}),A&&h.jsxs("button",{onClick:()=>G(k.id),className:"flex items-center gap-1 text-[12px] text-[#6B7280] dark:text-[#a1a1aa] font-mono hover:text-[#111827] dark:hover:text-[#E5E5E5] transition-colors",children:[$?h.jsx(Rr,{className:"w-3 h-3"}):h.jsx(Wd,{className:"w-3 h-3"}),$?"Collapse":"Expand"]})]})]},k.id)})})})]})]})}function Jo({title:e,subtitle:t}){return h.jsxs("div",{className:"border border-dashed border-[#E5E7EB] dark:border-[#27272a] rounded-lg p-6 text-center",children:[h.jsx("div",{className:"text-[13px] text-[#111827] dark:text-[#E5E5E5] font-mono",children:e}),h.jsx("div",{className:"text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono mt-1",children:t})]})}function gj({status:e}){const t=e==="success"?"Success":e==="error"?"Failed":"Running",n=e==="success"?"bg-[#22C55E] text-white":e==="error"?"bg-[#FEE2E2] text-[#b91c1c] dark:bg-[#EF4444]/20 dark:text-[#fca5a5]":"bg-[#E5E7EB] text-[#6B7280] dark:bg-[#27272a] dark:text-[#a1a1aa]";return h.jsx("span",{className:J("text-[11px] px-2 py-0.5 rounded-full font-mono",n),children:t})}function cO({node:e,depth:t,expandedDirs:n,childrenCache:r,toggleDir:i,onSelectFile:a,selectedPath:s}){const o=e.type==="dir",l=n[e.path],c=!o&&s===e.path,u=r[e.path]||[];return h.jsxs("div",{children:[h.jsx("button",{onClick:()=>{o?i(e.path):a(e.path)},className:J("flex items-center gap-2 w-full text-left text-[12px] font-mono px-2 py-1 rounded-md transition-colors",c?"bg-[#16A34A]/10 text-[#111827] dark:bg-[#22C55E]/10 dark:text-[#E5E5E5]":"hover:bg-[#F3F4F6] text-[#6B7280] dark:hover:bg-[#111113] dark:text-[#a1a1aa]",o&&"cursor-pointer",c&&"border border-[#16A34A]/30 dark:border-[#22C55E]/30"),style:{paddingLeft:t*14+8},children:o?h.jsxs(h.Fragment,{children:[l?h.jsx(J5,{className:"h-3.5 w-3.5 shrink-0 text-[#111827] dark:text-[#E5E5E5]"}):h.jsx(e4,{className:"h-3.5 w-3.5 shrink-0 text-[#6B7280] dark:text-[#a1a1aa]"}),h.jsx("span",{className:"text-[#111827] dark:text-[#E5E5E5] truncate",children:e.name})]}):h.jsxs(h.Fragment,{children:[h.jsx(rc,{className:"h-3.5 w-3.5 shrink-0 text-[#9CA3AF] dark:text-[#71717a]"}),h.jsx("span",{className:"text-[#111827] dark:text-[#E5E5E5] truncate",children:e.name})]})}),o&&l&&h.jsx("div",{children:u.map(d=>h.jsx(cO,{node:d,depth:t+1,expandedDirs:n,childrenCache:r,toggleDir:i,onSelectFile:a,selectedPath:s},d.path))})]})}function mj(e){return e.flatMap(t=>{var i,a,s;const n=[];if((i=t.agentContent)!=null&&i.toolCalls)for(const o of t.agentContent.toolCalls){const l=q1(o.arguments),c=o.output,u=c?(a=Ds(c))!=null&&a.diff?W1(c):c:void 0;n.push({id:`${t.id}-${o.toolCallId}`,title:o.toolName||"Tool",subtitle:o.summary,status:o.status==="success"?"success":o.status==="error"?"error":"running",content:u||(l?`Arguments:
@@ -1,4 +1,4 @@
1
- import{r as u,W as T}from"./index-BfhMJBJA.js";function ie(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function be(e){if(Array.isArray(e))return e}function ye(e,t,r){return(t=Ee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function we(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,s,p=[],g=!0,v=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(g=(n=i.call(r)).done)&&(p.push(n.value),p.length!==t);g=!0);}catch(P){v=!0,o=P}finally{try{if(!g&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(v)throw o}}return p}}function Oe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as u,W as T}from"./index-CTazDu2w.js";function ie(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function be(e){if(Array.isArray(e))return e}function ye(e,t,r){return(t=Ee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function we(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,s,p=[],g=!0,v=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(g=(n=i.call(r)).done)&&(p.push(n.value),p.length!==t);g=!0);}catch(P){v=!0,o=P}finally{try{if(!g&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(v)throw o}}return p}}function Oe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ue(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ae(Object(r),!0).forEach(function(n){ye(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function je(e,t){if(e==null)return{};var r,n,o=Me(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Me(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Pe(e,t){return be(e)||we(e,t)||Ie(e,t)||Oe()}function Se(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ee(e){var t=Se(e,"string");return typeof t=="symbol"?t:t+""}function Ie(e,t){if(e){if(typeof e=="string")return ie(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ie(e,t):void 0}}function Re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function le(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ce(Object(r),!0).forEach(function(n){Re(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ce(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ce(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function q(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,p=new Array(s),g=0;g<s;g++)p[g]=arguments[g];return t.apply(r,[].concat(o,p))}}}function K(e){return{}.toString.call(e).includes("Object")}function Le(e){return!Object.keys(e).length}function U(e){return typeof e=="function"}function Ae(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Te(e,t){return K(t)||E("changeType"),Object.keys(t).some(function(r){return!Ae(e,r)})&&E("changeField"),t}function $e(e){U(e)||E("selectorType")}function De(e){U(e)||K(e)||E("handlerType"),K(e)&&Object.values(e).some(function(t){return!U(t)})&&E("handlersType")}function Ve(e){e||E("initialIsRequired"),K(e)||E("initialType"),Le(e)&&E("initialContent")}function xe(e,t){throw new Error(e[t]||e.default)}var Ne={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},E=q(xe)(Ne),_={changes:Te,selector:$e,handler:De,initial:Ve};function qe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};_.initial(e),_.handler(t);var r={current:e},n=q(Fe)(r,t),o=q(Ue)(r),i=q(_.changes)(e),s=q(ze)(r);function p(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(P){return P};return _.selector(v),v(r.current)}function g(v){Ce(n,o,i,s)(v)}return[p,g]}function ze(e,t){return U(t)?t(e.current):t}function Ue(e,t){return e.current=le(le({},e.current),t),t}function Fe(e,t,r){return U(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var We={create:qe},He={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function _e(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,p=new Array(s),g=0;g<s;g++)p[g]=arguments[g];return t.apply(r,[].concat(o,p))}}}function Be(e){return{}.toString.call(e).includes("Object")}function Ke(e){return e||se("configIsRequired"),Be(e)||se("configType"),e.urls?(Ge(),{paths:{vs:e.urls.monacoBase}}):e}function Ge(){console.warn(fe.deprecation)}function Ye(e,t){throw new Error(e[t]||e.default)}var fe={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
3
  You are using deprecated way of configuration.
4
4
 
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>BladeCode</title>
8
- <script type="module" crossorigin src="/assets/index-BfhMJBJA.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-CTazDu2w.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-BtxkBvXb.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blade-code",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "private": false,
5
5
  "description": "🗡️ Blade Code - 智能代码助手命令行工具",
6
6
  "type": "module",