@kaitranntt/ccs 7.9.0 → 7.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cliproxy/index.d.ts +2 -0
- package/dist/cliproxy/index.d.ts.map +1 -1
- package/dist/cliproxy/index.js +3 -1
- package/dist/cliproxy/index.js.map +1 -1
- package/dist/cliproxy/quota-fetcher.d.ts +46 -0
- package/dist/cliproxy/quota-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/quota-fetcher.js +406 -0
- package/dist/cliproxy/quota-fetcher.js.map +1 -0
- package/dist/cliproxy/stats-fetcher.d.ts +4 -0
- package/dist/cliproxy/stats-fetcher.d.ts.map +1 -1
- package/dist/cliproxy/stats-fetcher.js.map +1 -1
- package/dist/ui/assets/accounts-CmzZXhfc.js +1 -0
- package/dist/ui/assets/{alert-dialog-sKmXLtjs.js → alert-dialog-zpnBn2CA.js} +1 -1
- package/dist/ui/assets/api-DFbZVPK4.js +1 -0
- package/dist/ui/assets/auth-section-YgJ7Cv--.js +1 -0
- package/dist/ui/assets/{card-CfgEo_Fi.js → card-dTUi3LxW.js} +1 -1
- package/dist/ui/assets/cliproxy-CsqKCFzj.js +3 -0
- package/dist/ui/assets/cliproxy-control-panel-BRCh_7b3.js +1 -0
- package/dist/ui/assets/{confirm-dialog-Dut98zdb.js → confirm-dialog-ByfOsjk9.js} +1 -1
- package/dist/ui/assets/{copilot-DvOZJmtw.js → copilot-BQscualu.js} +3 -3
- package/dist/ui/assets/globalenv-section-BEpPTvKo.js +1 -0
- package/dist/ui/assets/{health-D1M4owiM.js → health-DTRd-dXk.js} +1 -1
- package/dist/ui/assets/icons-CwFZAiDB.js +1 -0
- package/dist/ui/assets/index-BLoAjpcw.js +1 -0
- package/dist/ui/assets/{index-Bdp0Hpgh.js → index-Bfwze8tN.js} +1 -1
- package/dist/ui/assets/index-CEZrgkam.js +1 -0
- package/dist/ui/assets/index-QeBLfRj8.js +47 -0
- package/dist/ui/assets/index-oS2cgEFl.css +1 -0
- package/dist/ui/assets/{shared-Dgmje0CZ.js → shared-BgDSyHKz.js} +1 -1
- package/dist/ui/assets/{switch-MkSHHW1_.js → switch-B0PXGFIv.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +89 -5
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/accounts-CZms_PBW.js +0 -1
- package/dist/ui/assets/api-TANgowVA.js +0 -1
- package/dist/ui/assets/auth-section-Ddg5Cdd6.js +0 -1
- package/dist/ui/assets/cliproxy-BpCuX751.js +0 -3
- package/dist/ui/assets/cliproxy-control-panel-Cp0Tweyl.js +0 -1
- package/dist/ui/assets/globalenv-section-DlnizwvB.js +0 -1
- package/dist/ui/assets/icons-CMYcel9O.js +0 -1
- package/dist/ui/assets/index-BCBypoXT.js +0 -1
- package/dist/ui/assets/index-BXkzlgVE.js +0 -1
- package/dist/ui/assets/index-D-LYJymx.js +0 -47
- package/dist/ui/assets/index-DQAJ1wqP.css +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as c}from"./react-vendor-B_CU-WTZ.js";import{B as S,c as E,T as je,k as Ne,l as ve,a as g,I as C,i as I,L as T,m as M,n as ne,o as be,s as we,p as Ce,q as ye,S as W,r as L,t as $,v as re,w as Oe,x as Ae,y as le,z as ie,A as ce,D as Ee,E as Te,F as X,G as Z,R as ke,H as q,J as _e,K as Se,M as Pe,N as Re}from"./index-D-LYJymx.js";import{u as Le,a as Me,b as De}from"./tanstack-Coed0rqz.js";import{C as B,S as ee}from"./confirm-dialog-Dut98zdb.js";import{t as Q}from"./notifications-dJQY2-U6.js";import{$ as U,a9 as oe,L as G,aa as Ie,E as Ue,d as He,N as D,I as Fe,ab as de,O as Y,b as xe,ac as ze,J as Ke,ad as Je,m as me,X as $e,Z as ue,ae as Be,Y as Qe,Q as he,af as qe,n as fe}from"./icons-CMYcel9O.js";import{C as Ge,b as Ye,c as Ve,d as We,a as Xe}from"./card-CfgEo_Fi.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";import"./alert-dialog-sKmXLtjs.js";function Ze({className:s,showTooltip:t=!0}){const l=e.jsxs(S,{variant:"outline",className:E("bg-accent/10 border-accent/30 text-accent","dark:bg-accent/20 dark:border-accent/40 dark:text-accent-foreground",s),children:[e.jsx("img",{src:"/icons/openrouter.svg",alt:"OpenRouter",className:"mr-1 h-3 w-3"}),"OpenRouter"]});return t?e.jsxs(je,{children:[e.jsx(Ne,{asChild:!0,children:l}),e.jsx(ve,{children:e.jsx("p",{children:"Access 349+ models via OpenRouter"})})]}):l}function se(s){return[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/^API_KEY$/,/^AUTH_TOKEN$/,/_SECRET$/,/^SECRET$/].some(l=>l.test(s))}function pe(s){return s?.env?(s.env.ANTHROPIC_BASE_URL||"").toLowerCase().includes("openrouter.ai"):!1}function es(s){return{opus:s.ANTHROPIC_DEFAULT_OPUS_MODEL||void 0,sonnet:s.ANTHROPIC_DEFAULT_SONNET_MODEL||void 0,haiku:s.ANTHROPIC_DEFAULT_HAIKU_MODEL||void 0}}function ss(s,t){const l={...s};return t.opus?l.ANTHROPIC_DEFAULT_OPUS_MODEL=t.opus:delete l.ANTHROPIC_DEFAULT_OPUS_MODEL,t.sonnet?l.ANTHROPIC_DEFAULT_SONNET_MODEL=t.sonnet:delete l.ANTHROPIC_DEFAULT_SONNET_MODEL,t.haiku?l.ANTHROPIC_DEFAULT_HAIKU_MODEL=t.haiku:delete l.ANTHROPIC_DEFAULT_HAIKU_MODEL,l}function ts({profileName:s,data:t,settings:l,isLoading:i,isSaving:d,hasChanges:h,isRawJsonValid:x,onRefresh:n,onDelete:o,onSave:m}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s}),t?.path&&e.jsx(S,{variant:"outline",className:"text-xs",children:t.path.replace(/^.*\//,"")}),pe(l)&&e.jsx(Ze,{className:"ml-1"})]}),t&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",new Date(t.mtime).toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{variant:"ghost",size:"sm",onClick:n,disabled:i,children:e.jsx(U,{className:`w-4 h-4 ${i?"animate-spin":""}`})}),o&&e.jsx(g,{variant:"ghost",size:"sm",onClick:o,children:e.jsx(oe,{className:"w-4 h-4 text-destructive"})}),e.jsx(g,{size:"sm",onClick:m,disabled:d||!h||!x,children:d?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ie,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function ge({label:s,...t}){const[l,i]=c.useState(!1);return e.jsxs("div",{className:"space-y-1",children:[s&&e.jsx("label",{className:"text-sm font-medium",children:s}),e.jsxs("div",{className:"relative",children:[e.jsx(C,{type:l?"text":"password",className:"pr-10 font-mono",...t}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>i(!l),tabIndex:-1,children:l?e.jsx(Ue,{className:"w-4 h-4"}):e.jsx(He,{className:"w-4 h-4"})})]})]})}function as({currentSettings:s,newEnvKey:t,newEnvValue:l,onNewEnvKeyChange:i,onNewEnvValueChange:d,onEnvValueChange:h,onAddEnvVar:x}){return e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-4",children:s?.env&&Object.keys(s.env).length>0?e.jsx(e.Fragment,{children:Object.entries(s.env).map(([n,o])=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(T,{className:"text-xs font-medium flex items-center gap-2 text-muted-foreground",children:[n,se(n)&&e.jsx(S,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:"sensitive"})]}),se(n)?e.jsx(ge,{value:o,onChange:m=>h(n,m.target.value),className:"font-mono text-sm h-8"}):e.jsx(C,{value:o,onChange:m=>h(n,m.target.value),className:"font-mono text-sm h-8"})]},n))}):e.jsxs("div",{className:"py-8 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed text-sm",children:[e.jsx("p",{children:"No environment variables configured."}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:"Add variables using the input below or edit the JSON directly."})]})})}),e.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[e.jsx(T,{className:"text-xs font-medium text-muted-foreground",children:"Add Environment Variable"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(C,{placeholder:"VARIABLE_NAME",value:t,onChange:n=>i(n.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:n=>n.key==="Enter"&&t.trim()&&x()}),e.jsx(C,{placeholder:"value",value:l,onChange:n=>d(n.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:n=>n.key==="Enter"&&t.trim()&&x()}),e.jsx(g,{variant:"outline",size:"sm",className:"h-8",onClick:x,disabled:!t.trim(),children:e.jsx(D,{className:"w-4 h-4"})})]})]})]})}function ns({profileName:s,data:t}){return e.jsx(I,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(Fe,{className:"w-4 h-4"}),"Profile Information"]}),e.jsx("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Profile Name"}),e.jsx("span",{className:"font-mono",children:t.profile})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:t.path}),e.jsx(M,{value:t.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Last Modified"}),e.jsx("span",{className:"text-xs",children:new Date(t.mtime).toLocaleString()})]})]})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"Run with profile"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs ",s,' "prompt"']}),e.jsx(M,{value:`ccs ${s} "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"Set as default"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs default ",s]}),e.jsx(M,{value:`ccs default ${s}`,size:"icon",className:"h-6 w-6"})]})]})]})]})]})})}function rs({value:s,onChange:t,placeholder:l="Search models...",className:i}){const[d,h]=c.useState(""),[x,n]=c.useState(null),{models:o,isLoading:m,isError:j,isFetching:y}=ne(),O=be(),N=c.useMemo(()=>we(o,d,{category:x??void 0}),[o,d,x]),b=c.useMemo(()=>Ce(o,2),[o]),_=!d.trim()&&!x,k=c.useMemo(()=>{const r={anthropic:[],openai:[],google:[],meta:[],mistral:[],opensource:[],other:[]};N.forEach(a=>{r[a.category].push(a)});for(const a of Object.keys(r))r[a]=ye(r[a]);return r},[N]),w=c.useCallback(()=>{O()},[O]),p=o.find(r=>r.id===s);return m&&o.length===0?e.jsxs("div",{className:E("space-y-2",i),children:[e.jsx(W,{className:"h-10 w-full"}),e.jsx(W,{className:"h-32 w-full"})]}):e.jsxs("div",{className:E("space-y-2 w-full min-w-0 overflow-hidden",i),children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(de,{className:"text-muted-foreground absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2"}),e.jsx(C,{value:d,onChange:r=>h(r.target.value),placeholder:l,className:"pl-9"})]}),e.jsx(g,{variant:"outline",size:"icon",onClick:w,disabled:y,title:"Refresh models",children:y?e.jsx(G,{className:"h-4 w-4 animate-spin"}):e.jsx(U,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs(S,{variant:x===null?"default":"outline",className:"cursor-pointer",onClick:()=>n(null),children:["All (",o.length,")"]}),Object.keys(L).map(r=>{const a=k[r].length;return a===0?null:e.jsxs(S,{variant:x===r?"default":"outline",className:"cursor-pointer",onClick:()=>n(r),children:[L[r]," (",a,")"]},r)})]}),p&&e.jsxs("div",{className:"bg-muted rounded-md p-2 text-sm",children:[e.jsx("span",{className:"font-medium",children:p.name}),e.jsxs("span",{className:"text-muted-foreground ml-2",children:[$(p.pricing)," |"," ",re(p.context_length)]})]}),e.jsx(I,{className:"h-72 w-full rounded-md border",children:j?e.jsxs("div",{className:"text-destructive p-4 text-center",children:["Failed to load models."," ",e.jsx(g,{variant:"link",onClick:w,children:"Retry"})]}):N.length===0?e.jsxs("div",{className:"text-muted-foreground p-4 text-center",children:['No models found matching "',d,'"']}):e.jsxs("div",{className:"space-y-6 p-3",children:[_&&b.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"text-muted-foreground bg-background sticky top-0 mb-2 flex items-center gap-1.5 py-1.5 text-xs font-semibold border-b pb-2",children:[e.jsx(Y,{className:"h-3 w-3 text-accent"}),e.jsx("span",{children:"Newest Models"})]}),e.jsx("div",{className:"space-y-1",children:b.map(r=>e.jsx(te,{model:r,isSelected:r.id===s,onClick:()=>t(r.id),showAge:!0},r.id))})]}),Object.keys(L).map(r=>{const a=k[r];return a.length===0?null:e.jsxs("div",{children:[e.jsx("div",{className:"text-muted-foreground bg-background sticky top-0 mb-2 py-1.5 text-xs font-semibold border-b pb-2",children:L[r]}),e.jsx("div",{className:"space-y-1",children:a.map(v=>e.jsx(te,{model:v,isSelected:v.id===s,onClick:()=>t(v.id)},v.id))})]},r)})]})})]})}function te({model:s,isSelected:t,onClick:l,showAge:i=!1}){return e.jsxs("button",{type:"button",onClick:l,className:E("group flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors","hover:bg-accent hover:text-accent-foreground",t&&"bg-accent text-accent-foreground"),children:[e.jsx("span",{className:"flex-1 min-w-0 truncate font-medium",children:s.name}),e.jsxs("span",{className:E("flex shrink-0 items-center gap-1 text-xs whitespace-nowrap",t?"text-accent-foreground/80":"text-muted-foreground group-hover:text-accent-foreground/80"),children:[i&&s.created&&e.jsx(S,{variant:"outline",className:E("text-[10px] px-1",t?"border-accent-foreground/30 text-accent-foreground/80":"text-accent border-accent/30 group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30"),children:Oe(s.created)}),s.isFree?e.jsx(S,{variant:"secondary",className:E("text-[10px] px-1",t?"bg-accent-foreground/20 text-accent-foreground":"group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground"),children:"Free"}):s.isExacto?e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"outline",className:E("text-[10px] px-1 border-emerald-500/50 text-emerald-600",t?"border-accent-foreground/30 text-accent-foreground/80":"group-hover:border-accent-foreground/30 group-hover:text-accent-foreground/80"),children:"Exacto"}),e.jsx("span",{className:"tabular-nums",children:$(s.pricing)})]}):e.jsx("span",{className:"tabular-nums",children:$(s.pricing)}),e.jsx("span",{className:"tabular-nums",children:re(s.context_length)})]})]})}function ls({selectedModel:s,value:t,onChange:l,className:i}){const{models:d}=ne(),h=c.useMemo(()=>s?Ae(s,d):{},[s,d]),x=()=>{l(h)},n=(m,j)=>{l({...t,[m]:j||void 0})},o=s&&Object.keys(h).length>0;return e.jsxs(le,{className:E("group",i),children:[e.jsxs(ie,{className:"flex items-center gap-2 text-sm font-medium hover:underline",children:[e.jsx(xe,{className:"h-4 w-4 transition-transform group-data-[state=open]:rotate-90"}),"Model Tier Mapping",e.jsx("span",{className:"text-muted-foreground font-normal",children:"(Advanced)"})]}),e.jsxs(ce,{className:"space-y-3 pt-3",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Configure different models for Claude Code's opus/sonnet/haiku tiers."}),o&&e.jsxs(g,{type:"button",variant:"outline",size:"sm",onClick:x,children:[e.jsx(ze,{className:"mr-1 h-4 w-4"}),"Auto-suggest based on ",s?.split("/")[0]]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(T,{htmlFor:"tier-opus",className:"text-right",children:"Opus"}),e.jsx(C,{id:"tier-opus",value:t.opus??"",onChange:m=>n("opus",m.target.value),placeholder:"e.g., anthropic/claude-opus-4"})]}),e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(T,{htmlFor:"tier-sonnet",className:"text-right",children:"Sonnet"}),e.jsx(C,{id:"tier-sonnet",value:t.sonnet??"",onChange:m=>n("sonnet",m.target.value),placeholder:"e.g., anthropic/claude-sonnet-4"})]}),e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(T,{htmlFor:"tier-haiku",className:"text-right",children:"Haiku"}),e.jsx(C,{id:"tier-haiku",value:t.haiku??"",onChange:m=>n("haiku",m.target.value),placeholder:"e.g., anthropic/claude-3.5-haiku"})]})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"These set ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL."})]})]})}function is({profileName:s,data:t,currentSettings:l,newEnvKey:i,newEnvValue:d,onNewEnvKeyChange:h,onNewEnvValueChange:x,onEnvValueChange:n,onAddEnvVar:o,onEnvBulkChange:m}){const j=pe(l),y=l?.env,O=c.useMemo(()=>es(y??{}),[y]),N=y??{},b=a=>{if(m){const v={...N,ANTHROPIC_MODEL:a,ANTHROPIC_DEFAULT_OPUS_MODEL:a,ANTHROPIC_DEFAULT_SONNET_MODEL:a,ANTHROPIC_DEFAULT_HAIKU_MODEL:a};m(v)}else n("ANTHROPIC_MODEL",a),n("ANTHROPIC_DEFAULT_OPUS_MODEL",a),n("ANTHROPIC_DEFAULT_SONNET_MODEL",a),n("ANTHROPIC_DEFAULT_HAIKU_MODEL",a);Q.success("Applied model to all tiers",{duration:2e3})},_=a=>{if(m){const v=ss(N,a);m(v)}else a.opus!==void 0&&n("ANTHROPIC_DEFAULT_OPUS_MODEL",a.opus||""),a.sonnet!==void 0&&n("ANTHROPIC_DEFAULT_SONNET_MODEL",a.sonnet||""),a.haiku!==void 0&&n("ANTHROPIC_DEFAULT_HAIKU_MODEL",a.haiku||"")},[k,w]=c.useState(!1),p=new Set(["ANTHROPIC_AUTH_TOKEN"]),r=Object.entries(N).filter(([a])=>!p.has(a));return e.jsx("div",{className:"h-full w-full min-w-0 flex flex-col",children:e.jsxs(Ee,{defaultValue:"env",className:"h-full w-full min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(Te,{className:"w-full",children:[e.jsx(X,{value:"env",className:"flex-1",children:j?"Configuration":"Environment Variables"}),e.jsx(X,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:[e.jsx(Z,{value:"env",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden min-w-0",children:j?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsxs("div",{className:"h-full overflow-y-auto overflow-x-hidden p-4 space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{className:"text-sm font-medium",children:"Model Selection"}),e.jsx(rs,{value:N.ANTHROPIC_MODEL,onChange:b,placeholder:"Search OpenRouter models..."})]}),e.jsx(ls,{selectedModel:N.ANTHROPIC_MODEL,value:O,onChange:_}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"API Key"}),e.jsx(ge,{value:N.ANTHROPIC_AUTH_TOKEN||"",onChange:a=>n("ANTHROPIC_AUTH_TOKEN",a.target.value),placeholder:"sk-or-v1-...",className:"font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your API key from"," ",e.jsx("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"openrouter.ai/keys"})]})]}),r.length>0&&e.jsxs(le,{open:k,onOpenChange:w,children:[e.jsxs(ie,{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors group",children:[e.jsx(xe,{className:E("h-4 w-4 transition-transform",k&&"rotate-90")}),e.jsx(Ke,{className:"h-4 w-4"}),e.jsx("span",{children:"Additional Variables"}),e.jsxs("span",{className:"text-xs font-normal opacity-70",children:["(",r.length,")"]})]}),e.jsx(ce,{className:"pt-4",children:e.jsx("div",{className:"space-y-3 border rounded-lg p-3 bg-muted/30",children:r.map(([a,v])=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:a}),e.jsx(C,{value:v,onChange:P=>n(a,P.target.value),className:"font-mono text-xs h-8"})]},a))})})]})]})}),e.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[e.jsx(T,{className:"text-xs font-medium text-muted-foreground",children:"Add Environment Variable"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(C,{placeholder:"VARIABLE_NAME",value:i,onChange:a=>h(a.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:a=>a.key==="Enter"&&i.trim()&&o()}),e.jsx(C,{placeholder:"value",value:d,onChange:a=>x(a.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:a=>a.key==="Enter"&&i.trim()&&o()}),e.jsx(g,{variant:"outline",size:"sm",className:"h-8",onClick:o,disabled:!i.trim(),children:e.jsx(D,{className:"w-4 h-4"})})]})]})]}):e.jsx(as,{currentSettings:l,newEnvKey:i,newEnvValue:d,onNewEnvKeyChange:h,onNewEnvValueChange:x,onEnvValueChange:n,onAddEnvVar:o})}),e.jsx(Z,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(ns,{profileName:s,data:t})})]})]})})}function cs({profileName:s,onDelete:t,onHasChangesUpdate:l}){const[i,d]=c.useState({}),[h,x]=c.useState(!1),[n,o]=c.useState(null),[m,j]=c.useState(""),[y,O]=c.useState(""),N=Le(),{data:b,isLoading:_,isError:k,refetch:w}=Me({queryKey:["settings",s],queryFn:async()=>{const f=await fetch(`/api/settings/${s}/raw`);if(!f.ok)throw new Error(`Failed to load settings: ${f.status}`);return f.json()}}),p=b?.settings,r=c.useMemo(()=>{if(n!==null)try{return JSON.parse(n)}catch{}if(p)return{...p,env:{...p.env,...i}}},[p,i,n]),a=c.useMemo(()=>n!==null?n:p?JSON.stringify(p,null,2):"",[n,p]),v=c.useCallback(f=>{o(f)},[]),P=(f,A)=>{const R={...r?.env||{},[f]:A};d(J=>({...J,[f]:A})),o(JSON.stringify({...r,env:R},null,2))},H=f=>{const A={...r?.env||{},...f};d(R=>({...R,...f})),o(JSON.stringify({...r,env:A},null,2))},F=()=>{if(!m.trim())return;const f=m.trim(),A=y,R={...r?.env||{},[f]:A};d(J=>({...J,[f]:A})),o(JSON.stringify({...r,env:R},null,2)),j(""),O("")},u=c.useMemo(()=>{try{return JSON.parse(a),!0}catch{return!1}},[a]),z=c.useMemo(()=>n!==null?n!==JSON.stringify(p,null,2):Object.keys(i).length>0,[n,i,p]);c.useEffect(()=>{l?.(z)},[z,l]);const K=De({mutationFn:async()=>{let f;try{f=JSON.parse(a)}catch{f={...b?.settings,env:{...b?.settings?.env,...i}}}const A=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:f,expectedMtime:b?.mtime})});if(A.status===409)throw new Error("CONFLICT");if(!A.ok)throw new Error("Failed to save");return A.json()},onSuccess:()=>{N.invalidateQueries({queryKey:["settings",s]}),N.invalidateQueries({queryKey:["profiles"]}),d({}),o(null),Q.success("Settings saved")},onError:f=>{f.message==="CONFLICT"?x(!0):Q.error(f.message)}}),V=async f=>{x(!1),f?(await w(),K.mutate()):(d({}),o(null))};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(ts,{profileName:s,data:b,settings:r,isLoading:_,isSaving:K.isPending,hasChanges:z,isRawJsonValid:u,onRefresh:()=>w(),onDelete:t,onSave:()=>K.mutate()}),_?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(G,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):k?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load settings."}),e.jsxs(g,{variant:"outline",size:"sm",onClick:()=>w(),children:[e.jsx(U,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):e.jsxs("div",{className:"flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[e.jsx("div",{className:"flex flex-col overflow-hidden bg-muted/5 min-w-0",children:e.jsx(is,{profileName:s,data:b,currentSettings:r,newEnvKey:m,newEnvValue:y,onNewEnvKeyChange:j,onNewEnvValueChange:O,onEnvValueChange:P,onEnvBulkChange:H,onAddEnvVar:F})}),e.jsxs("div",{className:"flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(Je,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(ke,{rawJsonContent:a,isRawJsonValid:u,rawJsonEdits:n,settings:p,onChange:v})]})]}),e.jsx(B,{open:h,title:"File Modified Externally",description:"Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>V(!0),onCancel:()=>V(!1)})]},s)}const ae="ccs:openrouter-banner-dismissed";function os({onCreateClick:s}){const[t,l]=c.useState(!0),{modelCount:i,isLoading:d}=q();c.useEffect(()=>{const x=localStorage.getItem(ae)==="true";l(x)},[]);const h=()=>{localStorage.setItem(ae,"true"),l(!0)};return t?null:e.jsx("div",{className:"bg-gradient-to-r from-accent to-accent/90 text-white px-4 py-3 relative shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between gap-4 max-w-screen-xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"p-1.5 bg-white/20 rounded-md shrink-0",children:e.jsx(Y,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm",children:"NEW: OpenRouter Integration"}),e.jsxs("p",{className:"text-xs text-white/80 truncate",children:["Browse ",d?"300+":`${i}+`," models from OpenAI, Anthropic, Google, Meta and more."]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s&&e.jsx(g,{size:"sm",variant:"secondary",onClick:s,className:"bg-white text-accent hover:bg-white/90 h-8",children:"Try it now"}),e.jsxs("a",{href:"https://openrouter.ai",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-white/80 hover:text-white hidden sm:flex items-center gap-1",children:["Learn more",e.jsx(me,{className:"w-3 h-3"})]}),e.jsxs(g,{size:"icon",variant:"ghost",onClick:h,className:"h-7 w-7 text-white/70 hover:text-white hover:bg-white/20",children:[e.jsx($e,{className:"w-4 h-4"}),e.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})]})})}function ds({onOpenRouterClick:s,onCustomClick:t}){const{modelCount:l,isLoading:i}=q();return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20 p-8",children:e.jsxs("div",{className:"max-w-lg w-full space-y-6",children:[e.jsxs(Ge,{className:"border-accent/30 dark:border-accent/40 bg-gradient-to-br from-accent/5 to-background dark:from-accent/10",children:[e.jsxs(Ye,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-accent/10 dark:bg-accent/20",children:e.jsx("img",{src:"/icons/openrouter.svg",alt:"OpenRouter",className:"w-6 h-6"})}),e.jsx(S,{variant:"secondary",className:"bg-accent/10 text-accent dark:bg-accent/20 dark:text-accent-foreground",children:"Recommended"})]}),e.jsx(Ve,{className:"text-xl",children:"Start with OpenRouter"}),e.jsxs(We,{className:"text-base",children:["Access ",i?"300+":`${l}+`," models from OpenAI, Anthropic, Google, Meta and more - all through one API."]})]}),e.jsxs(Xe,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(ue,{className:"w-4 h-4 text-accent"}),e.jsx("span",{children:"One API, all providers"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Y,{className:"w-4 h-4 text-accent"}),e.jsx("span",{children:"Model tier mapping"})]})]}),e.jsxs(g,{onClick:s,className:"w-full bg-accent hover:bg-accent/90 text-white",size:"lg",children:["Create OpenRouter Profile",e.jsx(Be,{className:"w-4 h-4 ml-2"})]}),e.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Get your API key at"," ",e.jsxs("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:["openrouter.ai/keys",e.jsx(me,{className:"w-3 h-3"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ee,{className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx(ee,{className:"flex-1"})]}),e.jsx(g,{variant:"outline",onClick:t,className:"w-full",children:"Create Custom API Profile"})]})})}function xs({onCreateClick:s}){const{modelCount:t,isLoading:l}=q();return e.jsx("div",{className:"p-3 border-t bg-gradient-to-r from-accent/5 to-accent/10 dark:from-accent/10 dark:to-accent/15",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 bg-accent/10 dark:bg-accent/20 rounded shrink-0",children:e.jsx("img",{src:"/icons/openrouter.svg",alt:"",className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-accent dark:text-accent-foreground",children:"OpenRouter"}),e.jsxs("p",{className:"text-[10px] text-muted-foreground truncate",children:[l?"300+":`${t}+`," models available"]})]}),e.jsxs(g,{size:"sm",variant:"ghost",onClick:s,className:"h-7 px-2 text-accent hover:text-accent hover:bg-accent/10 dark:hover:bg-accent/20",children:[e.jsx(ue,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-xs",children:"Add"})]})]})})}function Os(){const{data:s,isLoading:t,isError:l,refetch:i}=_e(),d=Se(),[h,x]=c.useState(null),[n,o]=c.useState(""),[m,j]=c.useState(!1),[y,O]=c.useState("normal"),[N,b]=c.useState(null),[_,k]=c.useState(!1),[w,p]=c.useState(null);Pe();const r=c.useMemo(()=>s?.profiles||[],[s?.profiles]),a=c.useMemo(()=>r.filter(u=>u.name.toLowerCase().includes(n.toLowerCase())),[r,n]),v=h?r.find(u=>u.name===h):null,P=u=>{d.mutate(u,{onSuccess:()=>{h===u&&x(null),b(null)}})},H=u=>{j(!1),_&&h!==null?p(u):x(u)},F=u=>{_&&h!==u?p(u):x(u)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex flex-col",children:[e.jsx(os,{onCreateClick:()=>j(!0)}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qe,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"API Profiles"})]}),e.jsxs(g,{size:"sm",onClick:()=>{j(!0)},children:[e.jsx(D,{className:"w-4 h-4 mr-1"}),"New"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(de,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(C,{placeholder:"Search profiles...",className:"pl-8 h-9",value:n,onChange:u=>o(u.target.value)})]})]}),e.jsx(I,{className:"flex-1",children:t?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading profiles..."}):l?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(he,{className:"w-12 h-12 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Failed to load profiles"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Unable to fetch API profiles. Please try again."})]}),e.jsxs(g,{size:"sm",variant:"outline",onClick:()=>i(),children:[e.jsx(U,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):a.length===0?e.jsx("div",{className:"p-4 text-center",children:r.length===0?e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(qe,{className:"w-12 h-12 mx-auto text-muted-foreground/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"No API profiles yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Create your first profile to connect to custom API endpoints"})]}),e.jsxs(g,{size:"sm",variant:"outline",onClick:()=>{j(!0)},children:[e.jsx(D,{className:"w-4 h-4 mr-1"}),"Create Profile"]})]}):e.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:['No profiles match "',n,'"']})}):e.jsx("div",{className:"p-2 space-y-1",children:a.map(u=>e.jsx(ms,{profile:u,isSelected:h===u.name,onSelect:()=>F(u.name),onDelete:()=>b(u.name)},u.name))})}),r.length>0&&e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[r.length," profile",r.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fe,{className:"w-3 h-3 text-green-600"}),r.filter(u=>u.configured).length," configured"]})]})}),e.jsx(xs,{onCreateClick:()=>{O("openrouter"),j(!0)}})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:v?e.jsx(cs,{profileName:v.name,onDelete:()=>b(v.name),onHasChangesUpdate:k},v.name):e.jsx(ds,{onOpenRouterClick:()=>{O("openrouter"),j(!0)},onCustomClick:()=>{O("normal"),j(!0)}})})]}),e.jsx(Re,{open:m,onOpenChange:j,onSuccess:H,initialMode:y}),e.jsx(B,{open:!!N,title:"Delete Profile",description:`Are you sure you want to delete "${N}"? This will remove the settings file and cannot be undone.`,confirmText:"Delete",variant:"destructive",onConfirm:()=>N&&P(N),onCancel:()=>b(null)}),e.jsx(B,{open:!!w,title:"Unsaved Changes",description:`You have unsaved changes in "${h}". Discard and switch to "${w}"?`,confirmText:"Discard & Switch",variant:"destructive",onConfirm:()=>{k(!1),x(w),p(null)},onCancel:()=>p(null)})]})}function ms({profile:s,isSelected:t,onSelect:l,onDelete:i}){return e.jsxs("div",{className:E("group flex items-center gap-2 px-3 py-2.5 rounded-md cursor-pointer transition-colors",t?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:l,children:[s.configured?e.jsx(fe,{className:"w-4 h-4 text-green-600 shrink-0"}):e.jsx(he,{className:"w-4 h-4 text-yellow-600 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:s.name}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("div",{className:"text-xs text-muted-foreground truncate flex-1",children:s.settingsPath}),e.jsx(M,{value:s.settingsPath,size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),e.jsx(g,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:d=>{d.stopPropagation(),i()},children:e.jsx(oe,{className:"w-3.5 h-3.5 text-destructive"})})]})}export{Os as ApiPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as t}from"./react-vendor-B_CU-WTZ.js";import{av as Q,aq as H,as as V,i as W,I as b,a as i}from"./index-D-LYJymx.js";import{$ as E,Q as X,n as Y,k as Z,E as K,d as A,j as T,l as P,ax as _,O as ee,R as se,aa as ae}from"./icons-CMYcel9O.js";import"./tanstack-Coed0rqz.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function ue(){const{fetchRawConfig:o}=Q(),[a,I]=t.useState(null),[g,v]=t.useState(!0),[n,c]=t.useState(!1),[x,r]=t.useState(null),[p,f]=t.useState(null),[y,R]=t.useState(!1),[j,z]=t.useState(!1),[d,w]=t.useState(null),[m,N]=t.useState(null),[L,C]=t.useState(!1),[U,k]=t.useState(!1),u=t.useCallback(async()=>{try{v(!0),r(null);const s=await fetch("/api/settings/auth/tokens/raw");if(!s.ok)throw new Error("Failed to fetch auth tokens");const l=await s.json();I(l)}catch(s){r(s instanceof Error?s.message:"Unknown error")}finally{v(!1)}},[]);t.useEffect(()=>{u(),o()},[u,o]),t.useEffect(()=>{if(p){const s=setTimeout(()=>f(null),3e3);return()=>clearTimeout(s)}},[p]),t.useEffect(()=>{if(x){const s=setTimeout(()=>r(null),5e3);return()=>clearTimeout(s)}},[x]);const F=async()=>{const s=d!==null&&d!==a?.apiKey.value,l=m!==null&&m!==a?.managementSecret.value;if(!(!s&&!l))try{c(!0),r(null);const h={};s&&(h.apiKey=d),l&&(h.managementSecret=m);const S=await fetch("/api/settings/auth/tokens",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)});if(!S.ok){const J=await S.json();throw new Error(J.error||"Failed to save tokens")}f("Tokens updated. Restart CLIProxy to apply."),w(null),N(null),await u(),await o()}catch(h){r(h instanceof Error?h.message:"Unknown error")}finally{c(!1)}},O=async()=>{try{c(!0),r(null);const s=await fetch("/api/settings/auth/tokens/regenerate-secret",{method:"POST"});if(!s.ok){const l=await s.json();throw new Error(l.error||"Failed to regenerate secret")}f("New management secret generated. Restart CLIProxy to apply."),await u(),await o()}catch(s){r(s instanceof Error?s.message:"Unknown error")}finally{c(!1)}},$=async()=>{try{c(!0),r(null);const s=await fetch("/api/settings/auth/tokens/reset",{method:"POST"});if(!s.ok){const l=await s.json();throw new Error(l.error||"Failed to reset tokens")}f("Tokens reset to defaults. Restart CLIProxy to apply."),w(null),N(null),await u(),await o()}catch(s){r(s instanceof Error?s.message:"Unknown error")}finally{c(!1)}},D=async()=>{a&&(await navigator.clipboard.writeText(a.apiKey.value),C(!0),setTimeout(()=>C(!1),2e3))},q=async()=>{a&&(await navigator.clipboard.writeText(a.managementSecret.value),k(!0),setTimeout(()=>k(!1),2e3))};if(g||!a)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(E,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})});const M=d??a.apiKey.value,B=m??a.managementSecret.value,G=d!==null&&d!==a.apiKey.value||m!==null&&m!==a.managementSecret.value;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${x||p?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[x&&e.jsxs(H,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(X,{className:"h-4 w-4"}),e.jsx(V,{children:x})]}),p&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(Y,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:p})]})]}),e.jsx(W,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure CLIProxy authentication tokens. Changes require CLIProxy restart."}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"w-4 h-4 text-primary"}),e.jsx("h3",{className:"text-base font-medium",children:"API Key"}),a.apiKey.isCustom&&e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300",children:"Custom"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used by Claude Code to authenticate with CLIProxy"}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("div",{className:"relative flex-1",children:[e.jsx(b,{type:y?"text":"password",value:M,onChange:s=>w(s.target.value),placeholder:"API key",disabled:n,className:"pr-20 font-mono text-sm"}),e.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex gap-1",children:[e.jsx(i,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>R(!y),children:y?e.jsx(K,{className:"w-4 h-4"}):e.jsx(A,{className:"w-4 h-4"})}),e.jsx(i,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:D,disabled:!a.apiKey.value,children:L?e.jsx(T,{className:"w-4 h-4 text-green-600"}):e.jsx(P,{className:"w-4 h-4"})})]})]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{className:"w-4 h-4 text-primary"}),e.jsx("h3",{className:"text-base font-medium",children:"Management Secret"}),a.managementSecret.isCustom&&e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300",children:"Custom"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used by CCS dashboard to access CLIProxy management APIs"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(b,{type:j?"text":"password",value:B,onChange:s=>N(s.target.value),placeholder:"Management secret",disabled:n,className:"pr-20 font-mono text-sm"}),e.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex gap-1",children:[e.jsx(i,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>z(!j),children:j?e.jsx(K,{className:"w-4 h-4"}):e.jsx(A,{className:"w-4 h-4"})}),e.jsx(i,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:q,disabled:!a.managementSecret.value,children:U?e.jsx(T,{className:"w-4 h-4 text-green-600"}):e.jsx(P,{className:"w-4 h-4"})})]})]}),e.jsx(i,{variant:"outline",size:"sm",onClick:O,disabled:n,title:"Generate new secure secret",children:e.jsx(ee,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"pt-4 border-t",children:[e.jsxs(i,{variant:"outline",size:"sm",onClick:$,disabled:n||!a.apiKey.isCustom&&!a.managementSecret.isCustom,className:"gap-2",children:[e.jsx(se,{className:"w-4 h-4"}),"Reset to Defaults"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Resets both API key and management secret to their default values."})]})]})}),e.jsxs("div",{className:"p-4 border-t bg-background flex gap-2",children:[e.jsxs(i,{variant:"outline",size:"sm",onClick:()=>{u(),o()},disabled:g||n,className:"flex-1",children:[e.jsx(E,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"Refresh"]}),e.jsxs(i,{variant:"default",size:"sm",onClick:F,disabled:!G||n,className:"flex-1",children:[e.jsx(ae,{className:`w-4 h-4 mr-2 ${n?"animate-pulse":""}`}),n?"Saving...":"Save"]})]})]})}export{ue as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e,W as ts,X as as,Y as ns,Z as is,_ as rs}from"./radix-ui-uXQB-q0u.js";import{r as p}from"./react-vendor-B_CU-WTZ.js";import{u as Me,a as De,b as os}from"./tanstack-Coed0rqz.js";import{a as f,c as k,P as ne,L as X,I as ie,O as Te,Q as _e,U as Ee,V as Le,W as se,X as Ie,Y as ls,Z as Re,u as Fe,_ as re,$ as oe,a0 as le,a1 as ce,a2 as He,a3 as cs,a4 as Ne,a5 as we,B as _,a6 as ds,m as Ue,i as de,a7 as W,a8 as ms,a9 as us,aa as xs,ab as ps,D as hs,E as gs,F as be,G as ye,ac as fs,ad as js,ae as vs,af as Ns,ag as ws,ah as bs,ai as ys,aj as Cs,ak as ks,S as Ss}from"./index-D-LYJymx.js";import{t as E}from"./notifications-dJQY2-U6.js";import{b as Ge,L as z,m as me,T as As,j as $,l as Ps,ag as ue,$ as G,ah as q,O as J,ai as Os,aj as Y,Z,I as Ms,f as Ds,V as xe,ak as Ts,aa as _s,X as pe,N as $e,r as Ke,al as Es,a9 as Ve,ad as Ls,A as Ce,am as ke,an as Se,U as Is,ao as Rs,ap as Fs,aq as ze}from"./icons-CMYcel9O.js";import{C as qe,a as Be}from"./card-CfgEo_Fi.js";import{S as he,C as Hs}from"./confirm-dialog-Dut98zdb.js";import{S as Us}from"./switch-MkSHHW1_.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";import"./alert-dialog-sKmXLtjs.js";const B={agy:{provider:"agy",displayName:"Antigravity",defaultModel:"gemini-claude-opus-4-5-thinking",models:[{id:"gemini-claude-opus-4-5-thinking",name:"Claude Opus 4.5 Thinking",description:"Most capable, extended thinking",presetMapping:{default:"gemini-claude-opus-4-5-thinking",opus:"gemini-claude-opus-4-5-thinking",sonnet:"gemini-claude-sonnet-4-5-thinking",haiku:"gemini-claude-sonnet-4-5"}},{id:"gemini-claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking",description:"Balanced with extended thinking",presetMapping:{default:"gemini-claude-sonnet-4-5-thinking",opus:"gemini-claude-opus-4-5-thinking",sonnet:"gemini-claude-sonnet-4-5-thinking",haiku:"gemini-claude-sonnet-4-5"}},{id:"gemini-claude-sonnet-4-5",name:"Claude Sonnet 4.5",description:"Fast and capable",presetMapping:{default:"gemini-claude-sonnet-4-5",opus:"gemini-claude-opus-4-5-thinking",sonnet:"gemini-claude-sonnet-4-5",haiku:"gemini-claude-sonnet-4-5"}},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",description:"Google latest model via Antigravity",presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",description:"Fast Gemini model via Antigravity",presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}}]},gemini:{provider:"gemini",displayName:"Gemini",defaultModel:"gemini-2.5-pro",models:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",tier:"paid",description:"Latest model, requires paid Google account",presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",tier:"paid",description:"Fast Gemini 3 model, requires paid Google account",presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",description:"Stable, works with free Google account",presetMapping:{default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-2.5-flash"}}]},codex:{provider:"codex",displayName:"Codex",defaultModel:"gpt-5.1-codex-max",models:[{id:"gpt-5.1-codex-max",name:"Codex Max (5.1)",description:"Most capable Codex model",presetMapping:{default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max-high",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini-high"}},{id:"gpt-5.2",name:"GPT 5.2",description:"Latest GPT model",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.2",haiku:"gpt-5.2"}},{id:"gpt-5.1-codex-mini",name:"Codex Mini",description:"Fast and efficient Codex model"}]},qwen:{provider:"qwen",displayName:"Qwen",defaultModel:"qwen-coder-plus",models:[{id:"qwen-coder-plus",name:"Qwen Coder Plus",description:"Alibaba code-focused model"},{id:"qwen-max",name:"Qwen Max",description:"Most capable Qwen model"}]},iflow:{provider:"iflow",displayName:"iFlow",defaultModel:"iflow-default",models:[{id:"iflow-default",name:"iFlow Default",description:"Default iFlow model"}]},kiro:{provider:"kiro",displayName:"Kiro (AWS)",defaultModel:"kiro-claude-sonnet-4-5",models:[{id:"kiro-claude-opus-4-5",name:"Kiro Claude Opus 4.5",description:"Claude Opus 4.5 via Kiro (2.2x credit)",presetMapping:{default:"kiro-claude-opus-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4-5",name:"Kiro Claude Sonnet 4.5",description:"Claude Sonnet 4.5 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4",name:"Kiro Claude Sonnet 4",description:"Claude Sonnet 4 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-haiku-4-5",name:"Kiro Claude Haiku 4.5",description:"Claude Haiku 4.5 via Kiro (0.4x credit)"}]},ghcp:{provider:"ghcp",displayName:"GitHub Copilot (OAuth)",defaultModel:"claude-sonnet-4.5",models:[{id:"claude-opus-4.5",name:"Claude Opus 4.5",description:"Anthropic Claude Opus 4.5 via GitHub Copilot",presetMapping:{default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",description:"Anthropic Claude Sonnet 4.5 via GitHub Copilot",presetMapping:{default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4",name:"Claude Sonnet 4",description:"Anthropic Claude Sonnet 4 via GitHub Copilot"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",description:"Anthropic Claude Haiku 4.5 via GitHub Copilot"},{id:"gpt-5.2",name:"GPT-5.2",description:"OpenAI GPT-5.2 via GitHub Copilot",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"}},{id:"gpt-5.1",name:"GPT-5.1",description:"OpenAI GPT-5.1 via GitHub Copilot"},{id:"gpt-5",name:"GPT-5",description:"OpenAI GPT-5 via GitHub Copilot"},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"OpenAI GPT-5 Mini via GitHub Copilot"},{id:"gemini-3-pro",name:"Gemini 3 Pro",description:"Google Gemini 3 Pro via GitHub Copilot"}]}},te=8317;async function ae(s){const a=B[s];if(!a)return{success:!1};const t=a.models[0],n=t?.presetMapping||{default:a.defaultModel,opus:a.defaultModel,sonnet:a.defaultModel,haiku:a.defaultModel},r={env:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${te}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:"ccs-internal-managed",ANTHROPIC_MODEL:n.default,ANTHROPIC_DEFAULT_OPUS_MODEL:n.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:n.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:n.haiku}};try{return{success:(await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:r})})).ok,presetName:t?.name||a.defaultModel}}catch{return{success:!1}}}const Ae=[{id:"gemini",name:"Google Gemini",description:"Gemini Pro/Flash models"},{id:"codex",name:"OpenAI Codex",description:"GPT-4 and codex models"},{id:"agy",name:"Antigravity",description:"Antigravity AI models"},{id:"qwen",name:"Alibaba Qwen",description:"Qwen Code models"},{id:"iflow",name:"iFlow",description:"iFlow AI models"},{id:"kiro",name:"Kiro (AWS)",description:"AWS CodeWhisperer models"},{id:"ghcp",name:"GitHub Copilot (OAuth)",description:"GitHub Copilot via OAuth"}],Je=["provider","auth","variant","success"];function Gs(s){return s==="account"?1:Je.indexOf(s)}function $s({currentProgress:s,allSteps:a}){return e.jsx("div",{className:"flex justify-center gap-1 pt-2",children:a.map((t,n)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${s>=n?"bg-primary":"bg-muted"}`},t))})}function Ks({providers:s,onSelect:a}){return e.jsx("div",{className:"grid gap-2",children:s.map(t=>e.jsxs("button",{onClick:()=>a(t.id),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t.description})]}),e.jsx(Ge,{className:"w-4 h-4 text-muted-foreground"})]},t.id))})}function Vs({selectedProvider:s,providers:a,authCommand:t,isRefreshing:n,isPending:r,onBack:d,onStartAuth:l,onRefresh:x}){const[i,u]=p.useState(!1),c=async g=>{await navigator.clipboard.writeText(g),u(!0),setTimeout(()=>u(!1),2e3)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Authenticate with ",a.find(g=>g.id===s)?.name," to add an account"]}),e.jsx(f,{onClick:l,disabled:r,className:"w-full gap-2",size:"lg",children:r?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4"}),"Authenticate in Browser"]})}),r&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Complete the OAuth flow in your browser..."})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or use terminal"})})]}),e.jsx(qe,{children:e.jsxs(Be,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(As,{className:"w-4 h-4"}),"Run this command in your terminal:"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 bg-muted rounded-md font-mono text-sm",children:t}),e.jsx(f,{variant:"outline",size:"icon",onClick:()=>c(t),children:i?e.jsx($,{className:"w-4 h-4 text-green-500"}):e.jsx(Ps,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(f,{variant:"ghost",onClick:d,disabled:r,children:[e.jsx(ue,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(f,{variant:"outline",onClick:x,disabled:n||r,children:[e.jsx(G,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),n?"Checking...":"Refresh Status"]})]})]})}function zs({accounts:s,privacyMode:a,onSelect:t,onAddNew:n,onBack:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Select an account (",s.length,")"]}),e.jsx("div",{className:"grid gap-2",children:s.map(d=>e.jsxs("button",{type:"button",onClick:()=>t(d),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center",children:e.jsx(q,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:k("font-medium",a&&ne),children:d.email||d.id}),d.isDefault&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Default account"})]})]}),e.jsx(Ge,{className:"w-4 h-4 text-muted-foreground"})]},d.id))}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or"})})]}),e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 p-3 border-2 border-dashed border-primary/50 rounded-lg hover:border-primary hover:bg-primary/5 transition-colors text-left",onClick:n,children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(me,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-primary",children:"Add new account"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Authenticate with a different account"})]})]}),e.jsx("div",{className:"flex items-center justify-between pt-2",children:e.jsxs(f,{variant:"ghost",onClick:r,children:[e.jsx(ue,{className:"w-4 h-4 mr-2"}),"Back"]})})]})}function qs({selectedProvider:s,selectedAccount:a,variantName:t,modelName:n,isPending:r,privacyMode:d,onVariantNameChange:l,onModelChange:x,onBack:i,onSkip:u,onCreate:c}){return e.jsxs("div",{className:"space-y-4",children:[a&&e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx(q,{className:"w-4 h-4"}),e.jsxs("span",{children:["Using:"," ",e.jsx("span",{className:k(d&&ne),children:a.email||a.id})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"variant-name",children:"Variant Name *"}),e.jsx(ie,{id:"variant-name",value:t,onChange:g=>l(g.target.value),placeholder:"e.g., my-gemini, g3, flash"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Use this name to invoke: ccs ",t||"<name>",' "prompt"']})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{children:"Model"}),e.jsxs(Te,{value:n,onValueChange:x,children:[e.jsx(_e,{children:e.jsx(Ee,{placeholder:"Select a model"})}),e.jsx(Le,{children:B[s]?.models.map(g=>e.jsx(se,{value:g.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:g.name}),g.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",g.description]})]})},g.id))})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Default: ",B[s]?.defaultModel||"provider default"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(f,{variant:"ghost",onClick:i,children:[e.jsx(ue,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"ghost",onClick:u,children:"Skip"}),e.jsx(f,{onClick:c,disabled:!t||r,children:r?"Creating...":"Create Variant"})]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Skip if you just wanted to add an account without creating a variant"})]})}function Bs({variantName:s,onClose:a}){return e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center",children:e.jsx($,{className:"w-8 h-8 text-green-600 dark:text-green-400"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-lg",children:"Variant Created!"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Your custom variant is ready to use"})]}),e.jsx(qe,{children:e.jsxs(Be,{className:"p-4 space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Usage:"}),e.jsxs("code",{className:"block px-3 py-2 bg-muted rounded-md font-mono text-sm",children:["ccs ",s,' "your prompt here"']})]})}),e.jsx(f,{onClick:a,className:"w-full",children:"Done"})]})}function Js({open:s,onClose:a}){const[t,n]=p.useState("provider"),[r,d]=p.useState(""),[l,x]=p.useState(null),[i,u]=p.useState(""),[c,g]=p.useState(""),[v,o]=p.useState(!1),[h,S]=p.useState(!1),{data:y,refetch:M}=Ie(),P=ls(),O=Re(),{privacyMode:b}=Fe(),j=y?.authStatus.find(w=>w.provider===r),C=p.useMemo(()=>j?.accounts||[],[j?.accounts]);p.useEffect(()=>{if(!s){const w=setTimeout(()=>{n("provider"),d(""),x(null),u(""),g(""),S(!1)},0);return()=>clearTimeout(w)}},[s]),p.useEffect(()=>{if(t==="auth"&&C.length>0&&!h){const w=setTimeout(()=>{n("account")},0);return()=>clearTimeout(w)}},[t,C,h]);const N=async()=>{o(!0),await M(),o(!1)},A=()=>{const w=(j?.accounts?.length||0)===0;O.mutate({provider:r},{onSuccess:async V=>{if(w){const H=await ae(r);H.success&&H.presetName?E.success(`Applied "${H.presetName}" preset`):H.success||E.warning("Account added, but failed to apply default preset")}V.account&&(x(V.account),n("variant")),M()}})},D=w=>{d(w),(y?.authStatus.find(ee=>ee.provider===w)?.accounts||[]).length===0?n("auth"):n("account")},m=w=>{x(w),n("variant")},I=async()=>{if(!(!i||!r))try{await P.mutateAsync({name:i,provider:r,model:c||void 0,account:l?.id}),n("success")}catch(w){console.error("Failed to create variant:",w)}},R=`ccs ${r} --auth --add`,L=Gs(t),K=w=>{if(!w&&(t==="success"||t==="provider")){a();return}};return e.jsx(re,{open:s,onOpenChange:K,children:e.jsxs(oe,{className:"sm:max-w-lg",onPointerDownOutside:w=>{t!=="success"&&t!=="provider"&&w.preventDefault()},onEscapeKeyDown:w=>{(O.isPending||P.isPending)&&w.preventDefault()},children:[e.jsxs(le,{children:[e.jsxs(ce,{className:"flex items-center gap-2",children:[e.jsx(J,{className:"w-5 h-5 text-primary"}),"Quick Setup Wizard"]}),e.jsxs(He,{children:[t==="provider"&&"Select a provider to get started",t==="auth"&&"Authenticate with your provider",t==="account"&&"Select which account to use",t==="variant"&&"Create your custom variant",t==="success"&&"Setup complete!"]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[t==="provider"&&e.jsx(Ks,{providers:Ae,onSelect:D}),t==="auth"&&e.jsx(Vs,{selectedProvider:r,providers:Ae,authCommand:R,isRefreshing:v,isPending:O.isPending,onBack:()=>n("provider"),onStartAuth:A,onRefresh:N}),t==="account"&&e.jsx(zs,{accounts:C,privacyMode:b,onSelect:m,onAddNew:()=>{S(!0),n("auth")},onBack:()=>n("provider")}),t==="variant"&&e.jsx(qs,{selectedProvider:r,selectedAccount:l,variantName:i,modelName:c,isPending:P.isPending,privacyMode:b,onVariantNameChange:u,onModelChange:g,onBack:()=>C.length>0?n("account"):n("provider"),onSkip:a,onCreate:I}),t==="success"&&e.jsx(Bs,{variantName:i,onClose:a})]}),e.jsx($s,{currentProgress:L,allSteps:Je})]})})}function Qs({open:s,onClose:a,provider:t,displayName:n,isFirstAccount:r=!1}){const[d,l]=p.useState(""),x=Re(),i=cs(),u=t==="kiro",c=x.isPending||i.isPending,g=()=>{x.mutate({provider:t,nickname:d.trim()||void 0},{onSuccess:async()=>{if(r){const h=await ae(t);h.success&&h.presetName?E.success(`Applied "${h.presetName}" preset`):h.success||E.warning("Account added, but failed to apply default preset")}l(""),a()}})},v=()=>{i.mutate(void 0,{onSuccess:async()=>{if(r){const h=await ae("kiro");h.success&&h.presetName&&E.success(`Applied "${h.presetName}" preset`)}l(""),a()}})},o=h=>{!h&&!c&&(l(""),a())};return e.jsx(re,{open:s,onOpenChange:o,children:e.jsxs(oe,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsxs(ce,{children:["Add ",n," Account"]}),e.jsx(He,{children:u?"Authenticate via browser or import an existing token from Kiro IDE.":"Click the button below to authenticate a new account. A browser window will open for OAuth."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"nickname",children:"Nickname (optional)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(ie,{id:"nickname",value:d,onChange:h=>l(h.target.value),placeholder:"e.g., work, personal",disabled:c,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A friendly name to identify this account. Auto-generated from email if left empty."})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(f,{variant:"ghost",onClick:a,disabled:c,children:"Cancel"}),u&&e.jsx(f,{variant:"outline",onClick:v,disabled:c,children:i.isPending?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 mr-2 animate-spin"}),"Importing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Os,{className:"w-4 h-4 mr-2"}),"Import from IDE"]})}),e.jsx(f,{onClick:g,disabled:c,children:x.isPending?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 mr-2 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),"Authenticate"]})})]}),x.isPending&&e.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Complete the OAuth flow in your browser..."}),i.isPending&&e.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Importing token from Kiro IDE..."})]})]})})}function Ws(s){const[a,t]=p.useState(null),[n,r]=p.useState(!1),d=Me(),{data:l,isLoading:x,refetch:i}=De({queryKey:["settings",s],queryFn:async()=>{const N=await fetch(`/api/settings/${s}/raw`);return N.ok?N.json():{profile:s,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${s}/settings.json`}}}),u=l?.settings,c=p.useMemo(()=>a!==null?a:u?JSON.stringify(u,null,2):`{
|
|
2
|
-
"env": {}
|
|
3
|
-
}`,[a,u]),g=p.useCallback(N=>{t(N)},[]),v=p.useMemo(()=>{try{return JSON.parse(c)}catch{return u||{env:{}}}},[c,u]),o=v?.env?.ANTHROPIC_MODEL,h=v?.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,S=v?.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,y=v?.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,M=p.useCallback((N,A)=>{const D={...v?.env||{},[N]:A},m={...v,env:D};t(JSON.stringify(m,null,2))},[v]),P=p.useCallback(N=>{const A={...v?.env||{},...N},D={...v,env:A};t(JSON.stringify(D,null,2))},[v]),O=p.useMemo(()=>{try{return JSON.parse(c),!0}catch{return!1}},[c]),b=p.useMemo(()=>a===null?!1:a!==JSON.stringify(u,null,2),[a,u]),j=os({mutationFn:async()=>{const N=JSON.parse(c),A=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:N,expectedMtime:l?.mtime})});if(A.status===409)throw new Error("CONFLICT");if(!A.ok)throw new Error("Failed to save");return A.json()},onSuccess:()=>{d.invalidateQueries({queryKey:["settings",s]}),t(null),E.success("Settings saved")},onError:N=>{N.message==="CONFLICT"?r(!0):E.error(N.message)}}),C=async N=>{r(!1),N?(await i(),j.mutate()):t(null)};return{data:l,isLoading:x,refetch:i,rawJsonContent:c,rawJsonEdits:a,isRawJsonValid:O,hasChanges:b,currentSettings:v,currentModel:o,opusModel:h,sonnetModel:S,haikuModel:y,handleRawJsonChange:g,updateEnvValue:M,updateEnvValues:P,saveMutation:{mutate:()=>j.mutate(),isPending:j.isPending},conflictDialog:n,setConflictDialog:r,handleConflictResolve:C}}function F({label:s,description:a,value:t,onChange:n,catalog:r,allModels:d,disabled:l}){const x=new Set(r?.models.map(i=>i.id)||[]);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:s}),a&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a})]}),e.jsxs(Te,{value:t||"",onValueChange:n,disabled:l,children:[e.jsx(_e,{className:"h-9",children:e.jsx(Ee,{placeholder:"Select model",children:t&&e.jsx("span",{className:"truncate font-mono text-xs",children:t})})}),e.jsxs(Le,{className:"max-h-[300px]",children:[r&&r.models.length>0&&e.jsxs(Ne,{children:[e.jsx(we,{className:"text-xs text-primary",children:"Recommended"}),r.models.map(i=>e.jsx(se,{value:i.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:i.id}),i.tier==="paid"&&e.jsx(_,{variant:"outline",className:"text-[9px] h-4 px-1",children:"PAID"}),t===i.id&&e.jsx($,{className:"w-3 h-3 text-primary ml-auto"})]})},i.id))]}),d.length>0&&e.jsxs(Ne,{children:[e.jsxs(we,{className:"text-xs text-muted-foreground",children:["All Models (",d.length,")"]}),d.filter(i=>!x.has(i.id)).map(i=>e.jsx(se,{value:i.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:i.id}),t===i.id&&e.jsx($,{className:"w-3 h-3 text-primary ml-auto"})]})},i.id))]}),(!r||r.models.length===0)&&d.length===0&&e.jsx("div",{className:"py-2 px-3 text-xs text-muted-foreground",children:"No models available"})]})]})]})}function Xs({open:s,onClose:a,currentValues:t,onApply:n,onSave:r,isSaving:d,catalog:l,allModels:x}){const[i,u]=p.useState(t),[c,g]=p.useState(""),v=o=>{o?(u(t),g("")):a()};return e.jsx(re,{open:s,onOpenChange:v,children:e.jsxs(oe,{className:"sm:max-w-md",children:[e.jsx(le,{children:e.jsxs(ce,{className:"flex items-center gap-2",children:[e.jsx(J,{className:"w-4 h-4"}),"Custom Preset"]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"preset-name",children:"Preset Name (optional)"}),e.jsx(ie,{id:"preset-name",value:c,onChange:o=>g(o.target.value),placeholder:"e.g., My Custom Config",className:"text-sm"})]}),e.jsx(he,{}),e.jsx(F,{label:"Default Model",description:"Used when no specific tier is requested",value:i.default,onChange:o=>u({...i,default:o}),catalog:l,allModels:x}),e.jsx(F,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:i.opus,onChange:o=>u({...i,opus:o}),catalog:l,allModels:x}),e.jsx(F,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:i.sonnet,onChange:o=>u({...i,sonnet:o}),catalog:l,allModels:x}),e.jsx(F,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:i.haiku,onChange:o=>u({...i,haiku:o}),catalog:l,allModels:x})]}),e.jsxs(ds,{className:"gap-2 sm:gap-0",children:[e.jsx(f,{variant:"outline",onClick:a,children:"Cancel"}),r&&e.jsxs(f,{variant:"secondary",onClick:()=>r(i,c||void 0),disabled:d||!c.trim(),children:[d?e.jsx(z,{className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(Y,{className:"w-4 h-4 mr-1"}),"Save Preset"]}),e.jsxs(f,{onClick:()=>n(i,c||void 0),children:[e.jsx(Z,{className:"w-4 h-4 mr-1"}),"Apply Preset"]})]})]})})}function Q({label:s,command:a}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:s}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:a}),e.jsx(Ue,{value:a,size:"icon",className:"h-6 w-6"})]})]})}function Ys({provider:s,displayName:a,data:t,authStatus:n}){return e.jsx(de,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(Ms,{className:"w-4 h-4"}),"Provider Information"]}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:a})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:t.path}),e.jsx(Ue,{value:t.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Last Modified"}),e.jsx("span",{className:"text-xs",children:new Date(t.mtime).toLocaleString()})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),n.authenticated?e.jsxs(_,{variant:"outline",className:"w-fit text-green-600 border-green-200 bg-green-50",children:[e.jsx(Ds,{className:"w-3 h-3 mr-1"}),"Authenticated"]}):e.jsx(_,{variant:"outline",className:"w-fit text-muted-foreground",children:"Not connected"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(Q,{label:"Run with prompt",command:`ccs ${s} "your prompt"`}),e.jsx(Q,{label:"Change model",command:`ccs ${s} --config`}),e.jsx(Q,{label:"Add account",command:`ccs ${s} --add`}),e.jsx(Q,{label:"List accounts",command:`ccs ${s} --accounts`})]})]})]})})}const Zs={gemini:"/assets/providers/gemini-color.svg",codex:"/assets/providers/openai.svg",agy:"/assets/providers/agy.png",qwen:"/assets/providers/qwen-color.svg",iflow:"/assets/providers/iflow.png",kiro:"/assets/providers/kiro.png",ghcp:"/assets/providers/copilot.svg"},et={gemini:{text:"text-blue-600",letter:"G"},claude:{text:"text-orange-600",letter:"C"},codex:{text:"text-emerald-600",letter:"X"},agy:{text:"text-violet-600",letter:"A"},qwen:{text:"text-cyan-600",letter:"Q"},iflow:{text:"text-indigo-600",letter:"i"},kiro:{text:"text-teal-600",letter:"K"},ghcp:{text:"text-green-600",letter:"C"}},st={sm:{container:"w-6 h-6",icon:"w-4 h-4",text:"text-xs"},md:{container:"w-8 h-8",icon:"w-5 h-5",text:"text-sm"},lg:{container:"w-12 h-12",icon:"w-8 h-8",text:"text-lg"}};function ge({provider:s,className:a,size:t="md"}){const n=s.toLowerCase(),r=et[n]||{text:"text-gray-600",letter:s[0]?.toUpperCase()||"?"},d=st[t],l=Zs[n];return e.jsx("div",{className:k("flex items-center justify-center rounded-md",l&&"bg-white p-1",d.container,a),children:l?e.jsx("img",{src:l,alt:`${s} logo`,className:k(d.icon,"object-contain")}):e.jsx("span",{className:k("font-semibold",r.text,d.text),children:r.letter})})}function tt({displayName:s,logoProvider:a,provider:t,data:n,isLoading:r,hasChanges:d,isRawJsonValid:l,isSaving:x,isRemoteMode:i,port:u,onRefetch:c,onSave:g}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ge,{provider:a||t,size:"lg"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s}),i&&e.jsxs(_,{variant:"secondary",className:"text-xs gap-1 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:[e.jsx(xe,{className:"w-3 h-3"}),"Remote"]}),u&&e.jsxs(_,{variant:"outline",className:"text-xs gap-1 font-mono",children:[e.jsx(Ts,{className:"w-3 h-3"}),":",u]}),!i&&n?.path&&e.jsx(_,{variant:"outline",className:"text-xs",children:n.path.replace(/^.*[\\/]/,"")})]}),i?e.jsx("p",{className:"text-xs text-blue-600 dark:text-blue-400 mt-0.5",children:"Traffic auto-routed to remote server"}):n&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",new Date(n.mtime).toLocaleString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"ghost",size:"sm",onClick:c,disabled:r,children:e.jsx(G,{className:`w-4 h-4 ${r?"animate-spin":""}`})}),e.jsx(f,{size:"sm",onClick:g,disabled:x||!d||!l,children:x?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(_s,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function at({catalog:s,savedPresets:a,currentModel:t,opusModel:n,sonnetModel:r,haikuModel:d,providerModels:l,onApplyPreset:x,onUpdateEnvValue:i,onOpenCustomPreset:u,onDeletePreset:c,isDeletePending:g}){const v=s&&s.models.length>0||a.length>0;return e.jsxs(e.Fragment,{children:[v&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(J,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s?.models.slice(0,4).map(o=>e.jsxs(f,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>{const h=o.presetMapping||{default:o.id,opus:o.id,sonnet:o.id,haiku:o.id};x({ANTHROPIC_MODEL:h.default,ANTHROPIC_DEFAULT_OPUS_MODEL:h.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:h.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:h.haiku})},children:[e.jsx(Z,{className:"w-3 h-3"}),o.name]},o.id)),a.map(o=>e.jsxs("div",{className:"group relative",children:[e.jsxs(f,{variant:"secondary",size:"sm",className:"text-xs h-7 gap-1 pr-6",onClick:()=>{x({ANTHROPIC_MODEL:o.default,ANTHROPIC_DEFAULT_OPUS_MODEL:o.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:o.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:o.haiku})},children:[e.jsx(Y,{className:"w-3 h-3 fill-current"}),o.name]}),e.jsx(f,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-7 w-5 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:h=>{h.stopPropagation(),c(o.name)},disabled:g,children:e.jsx(pe,{className:"w-3 h-3"})})]},o.name)),e.jsxs(f,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1 border-primary/50 text-primary hover:bg-primary/10 hover:border-primary",onClick:u,children:[e.jsx($e,{className:"w-3 h-3"}),"Custom"]})]})]}),e.jsx(he,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(F,{label:"Default Model",description:"Used when no specific tier is requested",value:t,onChange:o=>i("ANTHROPIC_MODEL",o),catalog:s,allModels:l}),e.jsx(F,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:n,onChange:o=>i("ANTHROPIC_DEFAULT_OPUS_MODEL",o),catalog:s,allModels:l}),e.jsx(F,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:r,onChange:o=>i("ANTHROPIC_DEFAULT_SONNET_MODEL",o),catalog:s,allModels:l}),e.jsx(F,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:d,onChange:o=>i("ANTHROPIC_DEFAULT_HAIKU_MODEL",o),catalog:s,allModels:l})]})]})]})}function nt({...s}){return e.jsx(ts,{"data-slot":"dropdown-menu",...s})}function it({...s}){return e.jsx(as,{"data-slot":"dropdown-menu-trigger",...s})}function rt({className:s,sideOffset:a=4,...t}){return e.jsx(ns,{children:e.jsx(is,{"data-slot":"dropdown-menu-content",sideOffset:a,className:k("bg-popover text-popover-foreground 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md bg-white dark:bg-zinc-950",s),...t})})}function Pe({className:s,inset:a,variant:t="default",...n}){return e.jsx(rs,{"data-slot":"dropdown-menu-item","data-inset":a,"data-variant":t,className:k("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground focus:[&_svg:not([class*='text-'])]:text-current relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),...n})}function ot({account:s,onSetDefault:a,onRemove:t,isRemoving:n,privacyMode:r}){return e.jsxs("div",{className:k("flex items-center justify-between p-3 rounded-lg border transition-colors",s.isDefault?"border-primary/30 bg-primary/5":"border-border hover:bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:k("flex items-center justify-center w-8 h-8 rounded-full",s.isDefault?"bg-primary/10":"bg-muted"),children:e.jsx(q,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:k("font-medium text-sm",r&&ne),children:s.email||s.id}),s.isDefault&&e.jsxs(_,{variant:"secondary",className:"text-[10px] h-4 px-1.5 gap-0.5",children:[e.jsx(Y,{className:"w-2.5 h-2.5 fill-current"}),"Default"]})]}),s.lastUsedAt&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mt-0.5",children:[e.jsx(Ke,{className:"w-3 h-3"}),"Last used: ",new Date(s.lastUsedAt).toLocaleDateString()]})]})]}),e.jsxs(nt,{children:[e.jsx(it,{asChild:!0,children:e.jsx(f,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(Es,{className:"w-4 h-4"})})}),e.jsxs(rt,{align:"end",children:[!s.isDefault&&e.jsxs(Pe,{onClick:a,children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),"Set as default"]}),e.jsxs(Pe,{className:"text-destructive focus:text-destructive",onClick:t,disabled:n,children:[e.jsx(Ve,{className:"w-4 h-4 mr-2"}),n?"Removing...":"Remove account"]})]})]})]})}function lt({accounts:s,onAddAccount:a,onSetDefault:t,onRemoveAccount:n,isRemovingAccount:r,privacyMode:d,isKiro:l,kiroNoIncognito:x,onKiroNoIncognitoChange:i,kiroSettingsLoading:u}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4"}),"Accounts",s.length>0&&e.jsx(_,{variant:"secondary",className:"text-xs",children:s.length})]}),e.jsxs(f,{variant:"default",size:"sm",className:"h-7 text-xs gap-1",onClick:a,children:[e.jsx($e,{className:"w-3 h-3"}),"Add"]})]}),s.length>0?e.jsx("div",{className:"space-y-2",children:s.map(c=>e.jsx(ot,{account:c,onSetDefault:()=>t(c.id),onRemove:()=>n(c.id),isRemoving:r,privacyMode:d},c.id))}):e.jsxs("div",{className:"py-6 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed",children:[e.jsx(q,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No accounts connected"}),e.jsx("p",{className:"text-xs opacity-70",children:"Add an account to get started"})]}),l&&i&&e.jsx("div",{className:"mt-3 pt-3 border-t border-dashed",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(xe,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Use incognito"})]}),e.jsx(Us,{checked:!x,onCheckedChange:c=>i(!c),disabled:u,className:"scale-90"})]})})]})}function ct({provider:s,catalog:a,savedPresets:t,currentModel:n,opusModel:r,sonnetModel:d,haikuModel:l,providerModels:x,onApplyPreset:i,onUpdateEnvValue:u,onOpenCustomPreset:c,onDeletePreset:g,isDeletePending:v,accounts:o,onAddAccount:h,onSetDefault:S,onRemoveAccount:y,isRemovingAccount:M,privacyMode:P}){const O=s==="kiro",[b,j]=p.useState(!0),[C,N]=p.useState(!0),[A,D]=p.useState(!1),m=p.useCallback(async()=>{if(O)try{N(!0);const L=(await W.config.get()).cliproxy;j(L?.kiro_no_incognito??!0)}catch{j(!0)}finally{N(!1)}},[O]),I=p.useCallback(async R=>{j(R),D(!0);try{const L=await W.config.get(),K=L.cliproxy??{};await W.config.update({...L,cliproxy:{...K,kiro_no_incognito:R}})}catch{j(!R)}finally{D(!1)}},[]);return p.useEffect(()=>{m()},[m]),e.jsx(de,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsx(at,{catalog:a,savedPresets:t,currentModel:n,opusModel:r,sonnetModel:d,haikuModel:l,providerModels:x,onApplyPreset:i,onUpdateEnvValue:u,onOpenCustomPreset:c,onDeletePreset:g,isDeletePending:v}),e.jsx(he,{}),e.jsx(lt,{accounts:o,onAddAccount:h,onSetDefault:S,onRemoveAccount:y,isRemovingAccount:M,privacyMode:P,isKiro:O,kiroNoIncognito:b,onKiroNoIncognitoChange:I,kiroSettingsLoading:C||A})]})})}function Oe({provider:s,displayName:a,authStatus:t,catalog:n,logoProvider:r,baseProvider:d,isRemoteMode:l,port:x,onAddAccount:i,onSetDefault:u,onRemoveAccount:c,isRemovingAccount:g}){const[v,o]=p.useState(!1),{privacyMode:h}=Fe(),{data:S}=ms(),{data:y}=us(s),M=xs(),P=ps(),O=y?.presets||[],b=d||s,j=p.useMemo(()=>{if(!S?.models)return[];const U={gemini:["google"],agy:["antigravity"],codex:["openai"],qwen:["alibaba","qwen"],iflow:["iflow"],kiro:["kiro","aws"],ghcp:["github","copilot"]}[b.toLowerCase()]||[b.toLowerCase()];return S.models.filter(es=>U.some(ss=>es.owned_by.toLowerCase().includes(ss)))},[S,b]),{data:C,isLoading:N,refetch:A,rawJsonContent:D,rawJsonEdits:m,isRawJsonValid:I,hasChanges:R,currentModel:L,opusModel:K,sonnetModel:w,haikuModel:V,handleRawJsonChange:H,updateEnvValue:ee,updateEnvValues:fe,saveMutation:je,conflictDialog:Qe,handleConflictResolve:ve}=Ws(s),We=t.accounts||[],Xe=T=>{fe({ANTHROPIC_BASE_URL:`http://127.0.0.1:${te}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:"ccs-internal-managed",...T}),E.success(`Applied "${T.ANTHROPIC_MODEL?.split("/").pop()||"preset"}" preset`)},Ye=(T,U)=>{fe({ANTHROPIC_BASE_URL:`http://127.0.0.1:${te}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:"ccs-internal-managed",ANTHROPIC_MODEL:T.default,ANTHROPIC_DEFAULT_OPUS_MODEL:T.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:T.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:T.haiku}),E.success(`Applied ${U?`"${U}"`:"custom"} preset`),o(!1)},Ze=(T,U)=>{if(!U){E.error("Please enter a preset name to save");return}M.mutate({profile:s,data:{name:U,...T}}),o(!1)};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(tt,{provider:s,displayName:a,logoProvider:r,data:C,isLoading:N,hasChanges:R,isRawJsonValid:I,isSaving:je.isPending,isRemoteMode:l,port:x,onRefetch:A,onSave:()=>je.mutate()}),N?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(z,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):e.jsxs("div",{className:"flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[e.jsx("div",{className:"flex flex-col overflow-hidden bg-muted/5",children:e.jsxs(hs,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(gs,{className:"w-full",children:[e.jsx(be,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(be,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(ye,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(ct,{provider:s,catalog:n,savedPresets:O,currentModel:L,opusModel:K,sonnetModel:w,haikuModel:V,providerModels:j,onApplyPreset:Xe,onUpdateEnvValue:ee,onOpenCustomPreset:()=>o(!0),onDeletePreset:T=>P.mutate({profile:s,name:T}),isDeletePending:P.isPending,accounts:We,onAddAccount:i,onSetDefault:u,onRemoveAccount:c,isRemovingAccount:g,privacyMode:h})}),e.jsx(ye,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(Ys,{provider:s,displayName:a,data:C,authStatus:t})})]})]})}),e.jsxs("div",{className:"flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(Ls,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(fs,{rawJsonContent:D,isRawJsonValid:I,rawJsonEdits:m,onRawJsonChange:H,profileEnv:C?.settings?.env})]})]}),e.jsx(Hs,{open:Qe,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>ve(!0),onCancel:()=>ve(!1)}),e.jsx(Xs,{open:v,onClose:()=>o(!1),currentValues:{default:L||"",opus:K||"",sonnet:w||"",haiku:V||""},onApply:Ye,onSave:Ze,isSaving:M.isPending,catalog:n,allModels:j})]})}function dt(s){if(!s)return"";const a=new Date(s).getTime(),n=Date.now()-a,r=Math.floor(n/(1e3*60*60)),d=Math.floor(n%(1e3*60*60)/(1e3*60));return r>0?`${r}h ${d}m`:`${d}m`}function mt(s){if(!s)return"";const a=Date.now()-s,t=Math.floor(a/(1e3*60)),n=Math.floor(a/(1e3*60*60));return t<1?"just now":t<60?`${t}m ago`:`${n}h ago`}function ut(){const{data:s,isLoading:a}=js(),{data:t}=vs(),n=Ns(),r=ws(),{data:d}=De({queryKey:["cliproxy-server-config"],queryFn:()=>W.cliproxyServer.get(),staleTime:3e4}),l=d?.remote,x=l?.enabled&&l?.host,i=s?.running??!1,u=n.isPending||r.isPending,c=t?.hasUpdate??!1,g=x?(()=>{const o=l.protocol||"http",h=l.port||(o==="https"?443:80);return o==="https"&&h===443||o==="http"&&h===80?l.host:`${l.host}:${h}`})():null,v=async()=>{await r.mutateAsync(),await new Promise(o=>setTimeout(o,500)),n.mutate()};return x?e.jsxs("div",{className:k("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium",children:"Remote Proxy"}),e.jsx(_,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:"Active"})]}),e.jsx(Ce,{className:"w-3 h-3 text-blue-600"})]}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"flex items-center gap-1 mb-1",children:e.jsx("span",{className:"font-mono",children:g})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:"Traffic auto-routed to remote server"})]})]}):e.jsxs("div",{className:k("rounded-lg border p-3 transition-colors",i?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:k("w-2 h-2 rounded-full",i?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:"CLIProxy Plus"}),c&&e.jsxs(_,{variant:"secondary",className:"text-[10px] h-4 px-1.5 gap-0.5 bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",title:`Update: v${t?.currentVersion} -> v${t?.latestVersion}`,children:[e.jsx(ke,{className:"w-2.5 h-2.5"}),"Update"]})]}),e.jsx("div",{className:"flex items-center gap-1",children:a?e.jsx(G,{className:"w-3 h-3 animate-spin text-muted-foreground"}):i?e.jsx(Ce,{className:"w-3 h-3 text-green-600"}):e.jsx(Se,{className:"w-3 h-3 text-muted-foreground"})})]}),i&&s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:["Port ",s.port]}),s.sessionCount!==void 0&&s.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Is,{className:"w-3 h-3"}),s.sessionCount," session",s.sessionCount!==1?"s":""]}),s.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ke,{className:"w-3 h-3"}),dt(s.startedAt)]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsxs(f,{variant:c?"default":"outline",size:"sm",className:k("h-7 text-xs gap-1 flex-1",c&&"bg-sidebar-accent hover:bg-sidebar-accent/90 text-sidebar-accent-foreground"),onClick:v,disabled:u,title:c?`Restart to update: v${t?.currentVersion} -> v${t?.latestVersion}`:"Restart CLIProxy service",children:[u?e.jsx(G,{className:"w-3 h-3 animate-spin"}):c?e.jsx(ke,{className:"w-3 h-3"}):e.jsx(Rs,{className:"w-3 h-3"}),c?"Update":"Restart"]}),e.jsxs(f,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1 hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",onClick:()=>r.mutate(),disabled:u,title:"Stop CLIProxy service",children:[r.isPending?e.jsx(G,{className:"w-3 h-3 animate-spin"}):e.jsx(Fs,{className:"w-3 h-3"}),"Stop"]})]})]}):e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not running"}),e.jsxs(f,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>n.mutate(),disabled:n.isPending,children:[n.isPending?e.jsx(G,{className:"w-3 h-3 animate-spin"}):e.jsx(Se,{className:"w-3 h-3"}),"Start"]})]}),t?.currentVersion&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-muted flex items-center justify-between text-[10px] text-muted-foreground/70",children:[e.jsxs("span",{children:["v",t.currentVersion]}),t.checkedAt&&e.jsxs("span",{title:new Date(t.checkedAt).toLocaleString(),children:["Synced ",mt(t.checkedAt)]})]})]})}function xt({status:s,isSelected:a,onSelect:t}){const n=s.accounts?.length||0;return e.jsxs("button",{className:k("w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer text-left",a?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:t,children:[e.jsx(ge,{provider:s.provider,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:s.displayName}),n>0&&e.jsx(_,{variant:"secondary",className:"text-[10px] h-4 px-1",children:n})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:s.authenticated?e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-green-600",children:"Connected"})]}):e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not connected"})]})})]})]})}function pt({variant:s,parentAuth:a,isSelected:t,onSelect:n,onDelete:r,isDeleting:d}){return e.jsxs("button",{className:k("group w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-colors cursor-pointer text-left pl-6",t?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:n,children:[e.jsxs("div",{className:"relative",children:[e.jsx(ge,{provider:s.provider,size:"sm"}),e.jsx(ze,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-muted-foreground"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:s.name}),e.jsx(_,{variant:"outline",className:"text-[9px] h-4 px-1",children:"variant"})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:a?.authenticated?e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-3 h-3 text-green-600"}),e.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["via ",s.provider]})]}):e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Parent not connected"})]})})]}),e.jsx(f,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:l=>{l.stopPropagation(),r()},disabled:d,children:e.jsx(Ve,{className:"w-3 h-3"})})]})}function ht({onSetup:s}){return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-6",children:e.jsx(Z,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"CCS Profile Manager"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Manage OAuth authentication, account preferences, and model selection for CLIProxy providers. Configure how CCS routes requests to different AI backends."}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:["For live usage stats and real-time monitoring, visit the"," ",e.jsx("a",{href:"/cliproxy/control-panel",className:"text-primary hover:underline",children:"Control Panel"}),"."]}),e.jsxs(f,{onClick:s,className:"gap-2",children:[e.jsx(J,{className:"w-4 h-4"}),"Quick Setup"]})]})})}function Ot(){const s=Me(),{data:a,isLoading:t}=Ie(),{data:n,isFetching:r}=bs(),d=ys(),l=Cs(),x=ks(),[i,u]=p.useState(null),[c,g]=p.useState(null),[v,o]=p.useState(!1),[h,S]=p.useState(null),y=p.useMemo(()=>a?.authStatus||[],[a?.authStatus]),M=a?.source==="remote",P=p.useMemo(()=>n?.variants||[],[n?.variants]),O=p.useMemo(()=>c?null:i&&y.some(m=>m.provider===i)?i:y.length>0?y[0].provider:null,[i,c,y]),b=y.find(m=>m.provider===O),j=P.find(m=>m.name===c),C=j?y.find(m=>m.provider===j.provider):void 0,N=()=>{s.invalidateQueries({queryKey:["cliproxy"]}),s.invalidateQueries({queryKey:["cliproxy-auth"]})},A=m=>{u(m),g(null)},D=m=>{g(m),u(null)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"CLIProxy Plus"})]}),e.jsx(f,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:N,disabled:r,children:e.jsx(G,{className:k("w-4 h-4",r&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"CCS-level account management"}),e.jsxs(f,{variant:"default",size:"sm",className:"w-full gap-2",onClick:()=>o(!0),children:[e.jsx(J,{className:"w-4 h-4"}),"Quick Setup"]})]}),e.jsx(de,{className:"flex-1",children:e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2",children:"Providers"}),t?e.jsx("div",{className:"space-y-2 px-2",children:[1,2,3,4].map(m=>e.jsx(Ss,{className:"h-14 w-full rounded-lg"},m))}):e.jsx("div",{className:"space-y-1",children:y.map(m=>e.jsx(xt,{status:m,isSelected:O===m.provider,onSelect:()=>A(m.provider)},m.provider))}),P.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2 mt-4 flex items-center gap-1.5",children:[e.jsx(ze,{className:"w-3 h-3"}),"Variants"]}),e.jsx("div",{className:"space-y-1",children:P.map(m=>e.jsx(pt,{variant:m,parentAuth:y.find(I=>I.provider===m.provider),isSelected:c===m.name,onSelect:()=>D(m.name),onDelete:()=>x.mutate(m.name),isDeleting:x.isPending},m.name))})]})]})}),e.jsx("div",{className:"p-3 border-t",children:e.jsx(ut,{})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[y.length," provider",y.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx($,{className:"w-3 h-3 text-green-600"}),y.filter(m=>m.authenticated).length," connected"]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background",children:j&&C?e.jsx(Oe,{provider:j.name,displayName:`${j.name} (${j.provider} variant)`,authStatus:C,catalog:B[j.provider],logoProvider:j.provider,baseProvider:j.provider,isRemoteMode:M,port:j.port,onAddAccount:()=>S({provider:j.provider,displayName:C.displayName,isFirstAccount:(C.accounts?.length||0)===0}),onSetDefault:m=>d.mutate({provider:j.provider,accountId:m}),onRemoveAccount:m=>l.mutate({provider:j.provider,accountId:m}),isRemovingAccount:l.isPending}):b?e.jsx(Oe,{provider:b.provider,displayName:b.displayName,authStatus:b,catalog:B[b.provider],isRemoteMode:M,onAddAccount:()=>S({provider:b.provider,displayName:b.displayName,isFirstAccount:(b.accounts?.length||0)===0}),onSetDefault:m=>d.mutate({provider:b.provider,accountId:m}),onRemoveAccount:m=>l.mutate({provider:b.provider,accountId:m}),isRemovingAccount:l.isPending}):e.jsx(ht,{onSetup:()=>o(!0)})}),e.jsx(Js,{open:v,onClose:()=>o(!1)}),e.jsx(Qs,{open:h!==null,onClose:()=>S(null),provider:h?.provider||"",displayName:h?.displayName||"",isFirstAccount:h?.isFirstAccount||!1})]})}export{Ot as CliproxyPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as s}from"./react-vendor-B_CU-WTZ.js";import{a as w}from"./tanstack-Coed0rqz.js";import{a7 as I}from"./index-D-LYJymx.js";import{G as R,$ as v,Q as S,V as T,K as U,S as K,X as M}from"./icons-CMYcel9O.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";const A=8317;function F({port:c=A}){const n=s.useRef(null),[f,p]=s.useState(!0),[b,i]=s.useState(null),[k,m]=s.useState(!1),[P,L]=s.useState(!0),{data:g,error:h}=w({queryKey:["cliproxy-server-config"],queryFn:()=>I.cliproxyServer.get(),staleTime:3e4}),{data:j}=w({queryKey:["auth-tokens-raw"],queryFn:async()=>{const t=await fetch("/api/settings/auth/tokens/raw");if(!t.ok)throw new Error("Failed to fetch auth tokens");return t.json()},staleTime:3e4});s.useEffect(()=>{h&&console.warn("[ControlPanelEmbed] Config fetch failed, using local mode:",h)},[h]);const{managementUrl:y,checkUrl:d,authToken:r,isRemote:l,displayHost:u}=s.useMemo(()=>{const t=g?.remote;if(t?.enabled&&t?.host){const o=t.protocol||"http",a=t.port||(o==="https"?443:80),N=o==="https"&&a===443||o==="http"&&a===80?"":`:${a}`,C=`${o}://${t.host}${N}`;return{managementUrl:`${C}/management.html`,checkUrl:`${C}/`,authToken:t.auth_token||void 0,isRemote:!0,displayHost:`${t.host}${N}`}}const x=j?.managementSecret?.value||"ccs";return{managementUrl:`http://localhost:${c}/management.html`,checkUrl:`http://localhost:${c}/`,authToken:x,isRemote:!1,displayHost:`localhost:${c}`}},[g,j,c]);s.useEffect(()=>{const t=new AbortController,x=async()=>{try{(await fetch(d,{signal:t.signal})).ok?(m(!0),i(null)):(m(!1),i(l?`Remote CLIProxy at ${u} returned an error`:"CLIProxy returned an error"))}catch(a){if(a instanceof Error&&a.name==="AbortError")return;m(!1),i(l?`Remote CLIProxy at ${u} is not reachable`:"CLIProxy is not running")}},o=setTimeout(()=>t.abort(),2e3);return x().finally(()=>clearTimeout(o)),()=>t.abort()},[d,l,u]);const $=s.useCallback(()=>{if(p(!1),n.current?.contentWindow&&r)try{const t=d.replace(/\/$/,"");if(!n.current.src.startsWith(t)){console.warn("[ControlPanelEmbed] Iframe origin mismatch, skipping postMessage");return}n.current.contentWindow.postMessage({type:"ccs-auto-login",apiBase:t,managementKey:r},t)}catch(t){console.debug("[ControlPanelEmbed] postMessage failed - cross-origin:",t)}},[d,r]),E=()=>{p(!0),i(null),m(!1),n.current&&(n.current.src=y)};return!k&&b?e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-5 h-5 text-primary"}),e.jsx("h2",{className:"font-semibold",children:"CLIProxy Control Panel"})]}),e.jsxs("button",{className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm border rounded-md hover:bg-muted",onClick:E,children:[e.jsx(v,{className:"w-4 h-4"}),"Retry"]})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-6",children:e.jsx(S,{className:"w-8 h-8 text-destructive"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"CLIProxy Not Available"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:b}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Start a CLIProxy session with"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs gemini"})," or run"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs config"})," which auto-starts it."]})]})})]}):e.jsxs("div",{className:"flex-1 flex flex-col relative",children:[P&&!f&&e.jsx("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20",children:e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-md text-sm",children:[l&&e.jsxs(e.Fragment,{children:[e.jsx(T,{className:"h-3.5 w-3.5 text-green-600"}),e.jsx("span",{className:"text-green-600 font-medium",children:"Remote"}),e.jsx("span",{className:"text-blue-300 dark:text-blue-700",children:"|"})]}),e.jsx(U,{className:"h-3.5 w-3.5 text-blue-600"}),e.jsxs("span",{children:["Key:"," ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded font-mono font-semibold",children:r&&r.length>4?`***${r.slice(-4)}`:r||"ccs"})]}),e.jsx("a",{href:"/settings?tab=auth",className:"text-blue-600 hover:text-blue-800 dark:hover:text-blue-400",title:"Manage auth tokens",children:e.jsx(K,{className:"h-3.5 w-3.5"})}),e.jsx("button",{className:"text-blue-600 hover:text-blue-800 dark:hover:text-blue-400",onClick:()=>L(!1),children:e.jsx(M,{className:"h-3.5 w-3.5"})})]})}),f&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 z-10",children:e.jsxs("div",{className:"text-center",children:[e.jsx(v,{className:"w-8 h-8 animate-spin text-primary mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l?`Loading Control Panel from ${u}...`:"Loading Control Panel..."})]})}),e.jsx("iframe",{ref:n,src:y,className:"flex-1 w-full border-0",title:"CLIProxy Management Panel",onLoad:$})]})}function B(){return e.jsx("div",{className:"h-[calc(100vh-100px)] flex flex-col",children:e.jsx(F,{})})}export{B as CliproxyControlPanelPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as c}from"./react-vendor-B_CU-WTZ.js";import{at as N,au as C,av as w,aq as y,as as G,i as S,a as b,I as p}from"./index-D-LYJymx.js";import{S as k}from"./switch-MkSHHW1_.js";import{$ as j,Q as A,n as R,a9 as L,N as V}from"./icons-CMYcel9O.js";import"./tanstack-Coed0rqz.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function _(){const{state:s}=N(),a=C(),[l,d]=c.useState(""),[m,v]=c.useState(""),u=c.useCallback(async()=>{try{a.setGlobalEnvLoading(!0),a.setGlobalEnvError(null);const t=await fetch("/api/global-env");if(!t.ok)throw new Error("Failed to load Global Env config");const o=await t.json();a.setGlobalEnvConfig(o)}catch(t){a.setGlobalEnvError(t.message)}finally{a.setGlobalEnvLoading(!1)}},[a]),i=c.useCallback(async t=>{const o=s.globalEnvConfig;if(!o)return;const x={...o,...t};a.setGlobalEnvConfig(x);try{a.setGlobalEnvSaving(!0),a.setGlobalEnvError(null);const r=await fetch("/api/global-env",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!r.ok){const n=await r.json();throw new Error(n.error||"Failed to save")}const h=await r.json();a.setGlobalEnvConfig(h.config),a.setGlobalEnvSuccess(!0),setTimeout(()=>a.setGlobalEnvSuccess(!1),1500)}catch(r){a.setGlobalEnvConfig(o),a.setGlobalEnvError(r.message)}finally{a.setGlobalEnvSaving(!1)}},[s.globalEnvConfig,a]),f=c.useCallback(()=>{if(!l.trim()||!s.globalEnvConfig)return;const t={...s.globalEnvConfig.env,[l.trim()]:m};i({env:t}),d(""),v("")},[l,m,s.globalEnvConfig,i]),g=c.useCallback(t=>{if(!s.globalEnvConfig)return;const o={...s.globalEnvConfig.env};delete o[t],i({env:o})},[s.globalEnvConfig,i]);return{config:s.globalEnvConfig,loading:s.globalEnvLoading,saving:s.globalEnvSaving,error:s.globalEnvError,success:s.globalEnvSuccess,newEnvKey:l,setNewEnvKey:d,newEnvValue:m,setNewEnvValue:v,fetchConfig:u,saveConfig:i,addEnvVar:f,removeEnvVar:g}}function F(){const{config:s,loading:a,saving:l,error:d,success:m,newEnvKey:v,setNewEnvKey:u,newEnvValue:i,setNewEnvValue:f,fetchConfig:g,saveConfig:t,addEnvVar:o,removeEnvVar:x}=_(),{fetchRawConfig:r}=w();c.useEffect(()=>{g(),r()},[g,r]);const h=()=>{t({enabled:!s?.enabled})};return a?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(j,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${d||m?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[d&&e.jsxs(y,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(A,{className:"h-4 w-4"}),e.jsx(G,{children:d})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(R,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(S,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Environment variables injected into all non-Claude subscription profiles (gemini, codex, agy, ghcp, etc.)"}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s?.enabled?"Global Env enabled":"Global Env disabled"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s?.enabled?"Env vars will be injected into third-party profiles":"Env vars will not be injected"})]}),e.jsx(k,{checked:s?.enabled??!0,onCheckedChange:h})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Environment Variables"}),s?.env&&Object.keys(s.env).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(s.env).map(([n,E])=>e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg border bg-background",children:[e.jsx("code",{className:"flex-1 font-mono text-sm truncate",children:n}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("code",{className:"font-mono text-sm px-2 py-1 bg-muted rounded",children:E}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>x(n),disabled:l,className:"h-8 w-8 p-0 text-destructive hover:text-destructive hover:bg-destructive/10",children:e.jsx(L,{className:"w-4 h-4"})})]},n))}):e.jsx("div",{className:"p-4 rounded-lg border border-dashed text-center text-muted-foreground",children:e.jsx("p",{children:"No environment variables configured"})}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"Add New Variable"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{value:v,onChange:n=>u(n.target.value.toUpperCase()),placeholder:"KEY_NAME",className:"flex-1 font-mono text-sm h-9",disabled:l}),e.jsx("span",{className:"flex items-center text-muted-foreground",children:"="}),e.jsx(p,{value:i,onChange:n=>f(n.target.value),placeholder:"value",className:"flex-1 font-mono text-sm h-9",disabled:l}),e.jsxs(b,{size:"sm",onClick:o,disabled:l||!v.trim(),className:"h-9",children:[e.jsx(V,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"Quick Add Common Variables"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[[{key:"DISABLE_BUG_COMMAND",value:"1"},{key:"DISABLE_ERROR_REPORTING",value:"1"},{key:"DISABLE_TELEMETRY",value:"1"}].map(({key:n,value:E})=>!s?.env?.[n]&&e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>{u(n),f(E)},className:"text-xs font-mono",children:["+ ",n]},n)),s?.env&&["DISABLE_BUG_COMMAND","DISABLE_ERROR_REPORTING","DISABLE_TELEMETRY"].every(n=>s.env[n])&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"All common variables are configured"})]})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>{g(),r()},disabled:a||l,className:"w-full",children:[e.jsx(j,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"Refresh"]})})]})}export{F as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as y}from"./react-vendor-B_CU-WTZ.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var v={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const m=y.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:h="",children:n,iconNode:k,...s},i)=>y.createElement("svg",{ref:i,...v,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:r("lucide",h),...!n&&!x(s)&&{"aria-hidden":"true"},...s},[...k.map(([p,l])=>y.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=y.forwardRef(({className:o,...h},n)=>y.createElement(m,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,o),...h}));return c.displayName=d(t),c};const f=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],a2=e("activity",f);const g=[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]],t2=e("arrow-down-left",g);const w=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],c2=e("arrow-down-right",w);const $=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],o2=e("arrow-left",$);const N=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],n2=e("arrow-right",N);const u=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],y2=e("arrow-up-right",u);const z=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],h2=e("arrow-up",z);const b=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],s2=e("book-open",b);const C=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],d2=e("bot",C);const j=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],r2=e("calendar",j);const q=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],k2=e("chart-column",q);const A=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],i2=e("chart-pie",A);const H=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],p2=e("check",H);const V=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],l2=e("chevron-down",V);const L=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],_2=e("chevron-left",L);const S=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],M2=e("chevron-right",S);const R=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],x2=e("chevron-up",R);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],v2=e("circle-alert",E);const P=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],m2=e("circle-check-big",P);const U=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],f2=e("circle-check",U);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],g2=e("circle-x",B);const D=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],w2=e("circle",D);const G=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],$2=e("clock",G);const O=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],N2=e("cloud",O);const W=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],u2=e("code-xml",W);const F=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],z2=e("code",F);const T=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],b2=e("coins",T);const Z=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],C2=e("copy",Z);const I=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],j2=e("cpu",I);const K=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],q2=e("database",K);const X=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],A2=e("dollar-sign",X);const J=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],H2=e("download",J);const Q=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],V2=e("ellipsis",Q);const Y=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],L2=e("external-link",Y);const e1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],S2=e("eye-off",e1);const a1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],R2=e("eye",a1);const t1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],E2=e("file-braces",t1);const c1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],P2=e("file-code",c1);const o1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],U2=e("file-exclamation-point",o1);const n1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],B2=e("file-text",n1);const y1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],D2=e("folder-open",y1);const h1=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],G2=e("gauge",h1);const s1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],O2=e("git-branch",s1);const d1=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],W2=e("github",d1);const r1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],F2=e("globe",r1);const k1=[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]],T2=e("grip-horizontal",k1);const i1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Z2=e("grip-vertical",i1);const p1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],I2=e("heart",p1);const l1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],K2=e("house",l1);const _1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],X2=e("info",_1);const M1=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],J2=e("key-round",M1);const x1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Q2=e("key",x1);const v1=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],Y2=e("laptop",v1);const m1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],e0=e("loader-circle",m1);const f1=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],a0=e("monitor",f1);const g1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],t0=e("moon",g1);const w1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],c0=e("network",w1);const $1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],o0=e("panel-left",$1);const N1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],n0=e("plus",N1);const u1=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],y0=e("power-off",u1);const z1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],h0=e("power",z1);const b1=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],s0=e("radio",b1);const C1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],d0=e("refresh-cw",C1);const j1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],r0=e("rotate-ccw",j1);const q1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],k0=e("rotate-cw",q1);const A1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],i0=e("save",A1);const H1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],p0=e("search",H1);const V1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],l0=e("server",V1);const L1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],_0=e("settings-2",L1);const S1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],M0=e("settings",S1);const R1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],x0=e("shield-check",R1);const E1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],v0=e("shield",E1);const P1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],m0=e("sparkles",P1);const U1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],f0=e("square",U1);const B1=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],g0=e("star",B1);const D1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],w0=e("sun",D1);const G1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],$0=e("terminal",G1);const O1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],N0=e("trash-2",O1);const W1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],u0=e("trending-up",W1);const F1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],z0=e("triangle-alert",F1);const T1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],b0=e("user",T1);const Z1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],C0=e("users",Z1);const I1=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],j0=e("wand-sparkles",I1);const K1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],q0=e("wifi-off",K1);const X1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],A0=e("wifi",X1);const J1=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],H0=e("wrench",J1);const Q1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],V0=e("x",Q1);const Y1=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],L0=e("zap",Y1);export{d0 as $,a2 as A,s2 as B,k2 as C,l2 as D,S2 as E,D2 as F,G2 as G,K2 as H,X2 as I,_0 as J,Q2 as K,e0 as L,t0 as M,n0 as N,m0 as O,o0 as P,v2 as Q,r0 as R,M0 as S,$0 as T,C0 as U,F2 as V,q0 as W,V0 as X,l0 as Y,L0 as Z,P2 as _,W2 as a,_2 as a0,A2 as a1,q2 as a2,c2 as a3,r2 as a4,b2 as a5,j2 as a6,u0 as a7,i2 as a8,N0 as a9,i0 as aa,p0 as ab,j0 as ac,u2 as ad,n2 as ae,E2 as af,o2 as ag,b0 as ah,H2 as ai,g0 as aj,c0 as ak,V2 as al,h2 as am,h0 as an,k0 as ao,f0 as ap,O2 as aq,y0 as ar,H0 as as,a0 as at,d2 as au,N2 as av,Y2 as aw,x0 as ax,M2 as b,w0 as c,R2 as d,A0 as e,v0 as f,I2 as g,m2 as h,w2 as i,p2 as j,J2 as k,C2 as l,L2 as m,f2 as n,g2 as o,Z2 as p,s0 as q,$2 as r,B2 as s,z2 as t,y2 as u,t2 as v,z0 as w,U2 as x,T2 as y,x2 as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as p}from"./react-vendor-B_CU-WTZ.js";import{at as G,au as J,a7 as L,I as S,O as K,Q as X,U as Y,V as Z,W as $,a as _,av as ee,aq as te,as as se,i as re}from"./index-D-LYJymx.js";import{S as A}from"./switch-MkSHHW1_.js";import{av as B,$ as I,e as oe,n as F,W as ae,Q as ne,aw as le}from"./icons-CMYcel9O.js";import"./tanstack-Coed0rqz.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function ce(){const{state:s}=G(),t=J(),[n,l]=p.useState(null),[u,f]=p.useState(null),[h,d]=p.useState(null),[j,y]=p.useState(null),b=p.useCallback(async()=>{try{t.setProxyLoading(!0),t.setProxyError(null);const a=await L.cliproxyServer.get();t.setProxyConfig(a)}catch(a){t.setProxyError(a.message)}finally{t.setProxyLoading(!1)}},[t]),v=p.useCallback(async a=>{const c=s.proxyConfig;if(!c)return;const m={remote:{...c.remote,...a.remote},fallback:{...c.fallback,...a.fallback},local:{...c.local,...a.local}};t.setProxyConfig(m),t.setProxyTestResult(null);try{t.setProxySaving(!0),t.setProxyError(null);const r=await L.cliproxyServer.update(a);t.setProxyConfig(r),t.setProxySuccess(!0),setTimeout(()=>t.setProxySuccess(!1),1500)}catch(r){t.setProxyConfig(c),t.setProxyError(r.message)}finally{t.setProxySaving(!1)}},[s.proxyConfig,t]),N=p.useCallback(async a=>{const{host:c,port:m,protocol:r,authToken:i}=a;if(!c){t.setProxyError("Host is required");return}try{t.setProxyTesting(!0),t.setProxyError(null),t.setProxyTestResult(null);const g=m?parseInt(m,10):void 0,x=await L.cliproxyServer.test({host:c,port:g||void 0,protocol:r,authToken:i||void 0});t.setProxyTestResult(x)}catch(g){t.setProxyError(g.message)}finally{t.setProxyTesting(!1)}},[t]);return{config:s.proxyConfig,loading:s.proxyLoading,saving:s.proxySaving,error:s.proxyError,success:s.proxySuccess,testResult:s.proxyTestResult,testing:s.proxyTesting,editedHost:n,setEditedHost:l,editedPort:u,setEditedPort:f,editedAuthToken:h,setEditedAuthToken:d,editedLocalPort:j,setEditedLocalPort:y,fetchConfig:b,saveConfig:v,testConnection:N}}function ie({config:s,saving:t,displayLocalPort:n,setEditedLocalPort:l,onSaveLocalPort:u,onSaveConfig:f}){const h=s.local;return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Local Proxy"}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Port"}),e.jsx(S,{type:"number",value:n,onChange:d=>l(d.target.value),onBlur:u,placeholder:"8317",className:"font-mono max-w-32",disabled:t})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Auto-start"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Start local proxy automatically when needed"})]}),e.jsx(A,{checked:h.auto_start??!0,onCheckedChange:d=>f({local:{...h,auto_start:d}}),disabled:t})]})]})]})}function de({config:s,saving:t,testing:n,testResult:l,displayHost:u,displayPort:f,displayAuthToken:h,setEditedHost:d,setEditedPort:j,setEditedAuthToken:y,onSaveHost:b,onSavePort:v,onSaveAuthToken:N,onSaveConfig:a,onTestConnection:c}){const m=s.remote,r=i=>i==="https"?443:8317;return e.jsxs("div",{className:"space-y-4 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("h4",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(B,{className:"w-4 h-4"}),"Remote Server Configuration"]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Host"}),e.jsx(S,{value:u,onChange:i=>d(i.target.value),onBlur:b,placeholder:"192.168.1.100 or proxy.example.com",className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"text-sm text-muted-foreground",children:["Port"," ",e.jsxs("span",{className:"text-xs opacity-70",children:["(default: ",r(s.remote.protocol||"http"),")"]})]}),e.jsx(S,{type:"text",inputMode:"numeric",value:f,onChange:i=>j(i.target.value.replace(/\D/g,"")),onBlur:v,placeholder:`Leave empty for ${r(s.remote.protocol||"http")}`,className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Protocol"}),e.jsxs(K,{value:s.remote.protocol||"http",onValueChange:i=>a({remote:{...m,protocol:i}}),disabled:t,children:[e.jsx(X,{children:e.jsx(Y,{})}),e.jsxs(Z,{children:[e.jsx($,{value:"http",children:"HTTP"}),e.jsx($,{value:"https",children:"HTTPS"})]})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Auth Token (optional)"}),e.jsx(S,{type:"password",value:h,onChange:i=>y(i.target.value),onBlur:N,placeholder:"Bearer token for authentication",className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(_,{onClick:c,disabled:n||!u,variant:"outline",className:"w-full",children:n?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"w-4 h-4 mr-2 animate-spin"}),"Testing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-4 h-4 mr-2"}),"Test Connection"]})}),l&&e.jsx("div",{className:`p-3 rounded-md ${l.reachable?"bg-green-50 border border-green-200 dark:bg-green-900/20 dark:border-green-900/50":"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50"}`,children:e.jsx("div",{className:"flex items-center gap-2",children:l.reachable?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsxs("span",{className:"text-sm font-medium text-green-700 dark:text-green-300",children:["Connected (",l.latencyMs,"ms)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:l.error||"Connection failed"})]})})})]})]})}function ve(){const{config:s,loading:t,saving:n,error:l,success:u,testResult:f,testing:h,editedHost:d,setEditedHost:j,editedPort:y,setEditedPort:b,editedAuthToken:v,setEditedAuthToken:N,editedLocalPort:a,setEditedLocalPort:c,fetchConfig:m,saveConfig:r,testConnection:i}=ce(),{fetchRawConfig:g}=ee();if(p.useEffect(()=>{m(),g()},[m,g]),t||!s)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(I,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})});const x=s.remote.enabled??!1,C=s.remote,P=s.fallback,M=s.remote.host??"",W=s.remote.port!==void 0?s.remote.port.toString():"",D=s.remote.auth_token??"",V=(s.local.port??8317).toString(),w=d??M,T=y??W,E=v??D,R=a??V,q=()=>{const o=d??w;o!==s.remote.host&&r({remote:{...C,host:o}}),j(null)},z=()=>{const o=y??T,k=o===""?void 0:parseInt(o,10),H=k&&!isNaN(k)&&k>0?k:void 0;H!==s.remote.port&&r({remote:{...C,port:H}}),b(null)},O=()=>{const o=v??E;o!==s.remote.auth_token&&r({remote:{...C,auth_token:o}}),N(null)},Q=()=>{const o=parseInt(a??R,10);!isNaN(o)&&o!==s.local.port&&r({local:{...s.local,port:o}}),c(null)},U=()=>{i({host:w,port:T,protocol:s.remote.protocol||"http",authToken:E})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${l||u?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[l&&e.jsxs(te,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(ne,{className:"h-4 w-4"}),e.jsx(se,{children:l})]}),u&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(F,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(re,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure local or remote CLIProxy Plus connection for proxy-based profiles"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Connection Mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>r({remote:{...C,enabled:!1}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${x?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(le,{className:`w-5 h-5 ${x?"text-muted-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:"Local"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Run CLIProxy Plus binary on this machine"})]}),e.jsxs("button",{onClick:()=>r({remote:{...C,enabled:!0}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${x?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(B,{className:`w-5 h-5 ${x?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:"Remote"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Connect to a remote CLIProxy Plus server"})]})]})]}),x&&e.jsx(de,{config:s,saving:n,testing:h,testResult:f,displayHost:w,displayPort:T,displayAuthToken:E,setEditedHost:j,setEditedPort:b,setEditedAuthToken:N,onSaveHost:q,onSavePort:z,onSaveAuthToken:O,onSaveConfig:r,onTestConnection:U}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Fallback Settings"}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Enable fallback to local"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Use local proxy if remote is unreachable"})]}),e.jsx(A,{checked:P.enabled??!0,onCheckedChange:o=>r({fallback:{...P,enabled:o}}),disabled:n||!x})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Auto-start local proxy"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically start local proxy on fallback"})]}),e.jsx(A,{checked:P.auto_start??!1,onCheckedChange:o=>r({fallback:{...P,auto_start:o}}),disabled:n||!x||!P.enabled})]})]})]}),!x&&e.jsx(ie,{config:s,saving:n,displayLocalPort:R,setEditedLocalPort:c,onSaveLocalPort:Q,onSaveConfig:r})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>{m(),g()},disabled:t||n,className:"w-full",children:[e.jsx(I,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"Refresh"]})})]})}export{ve as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as i}from"./react-vendor-B_CU-WTZ.js";import{at as $,au as P,I as F,av as U,aq as _,as as z,i as B,a as A}from"./index-D-LYJymx.js";import{S as K}from"./switch-MkSHHW1_.js";import{T as q,j as D,z as Y,D as J,m as Q,$ as L,Q as V,n as X}from"./icons-CMYcel9O.js";import"./tanstack-Coed0rqz.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function Z(){const{state:s}=$(),a=P(),[d,l]=i.useState(""),[o,m]=i.useState(""),[f,h]=i.useState(!1),[j,u]=i.useState(!1),S=i.useCallback(async()=>{try{a.setWebSearchLoading(!0),a.setWebSearchError(null);const t=await fetch("/api/websearch");if(!t.ok)throw new Error("Failed to load WebSearch config");const r=await t.json();a.setWebSearchConfig(r)}catch(t){a.setWebSearchError(t.message)}finally{a.setWebSearchLoading(!1)}},[a]),v=i.useCallback(async()=>{try{a.setWebSearchStatusLoading(!0);const t=await fetch("/api/websearch/status");if(!t.ok)throw new Error("Failed to load status");const r=await t.json();a.setWebSearchStatus(r)}catch{}finally{a.setWebSearchStatusLoading(!1)}},[a]),p=i.useCallback(async t=>{const r=s.webSearchConfig;if(!r)return;const w={...r,...t};a.setWebSearchConfig(w);try{a.setWebSearchSaving(!0),a.setWebSearchError(null);const n=await fetch("/api/websearch",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!n.ok){const k=await n.json();throw new Error(k.error||"Failed to save")}const C=await n.json();a.setWebSearchConfig(C.websearch),a.setWebSearchSuccess(!0),setTimeout(()=>a.setWebSearchSuccess(!1),1500)}catch(n){a.setWebSearchConfig(r),a.setWebSearchError(n.message)}finally{a.setWebSearchSaving(!1)}},[s.webSearchConfig,a]);i.useEffect(()=>{s.webSearchConfig&&(l(s.webSearchConfig.providers?.gemini?.model??"gemini-2.5-flash"),m(s.webSearchConfig.providers?.opencode?.model??"opencode/grok-code"))},[s.webSearchConfig]);const x=i.useCallback(async()=>{const t=s.webSearchConfig?.providers?.gemini?.model??"gemini-2.5-flash";if(d!==t){const r=s.webSearchConfig?.providers||{};await p({providers:{...r,gemini:{...r.gemini,model:d}}}),h(!0),setTimeout(()=>h(!1),2e3)}},[d,s.webSearchConfig,p]),g=i.useCallback(async()=>{const t=s.webSearchConfig?.providers?.opencode?.model??"opencode/grok-code";if(o!==t){const r=s.webSearchConfig?.providers||{};await p({providers:{...r,opencode:{...r.opencode,model:o}}}),u(!0),setTimeout(()=>u(!1),2e3)}},[o,s.webSearchConfig,p]);return{config:s.webSearchConfig,status:s.webSearchStatus,loading:s.webSearchLoading,statusLoading:s.webSearchStatusLoading,saving:s.webSearchSaving,error:s.webSearchError,success:s.webSearchSuccess,geminiModelInput:d,setGeminiModelInput:l,opencodeModelInput:o,setOpencodeModelInput:m,geminiModelSaved:f,opencodeModelSaved:j,fetchConfig:S,fetchStatus:v,saveConfig:p,saveGeminiModel:x,saveOpencodeModel:g}}function O({name:s,label:a,badge:d,badgeColor:l,enabled:o,installed:m,statusLoading:f,saving:h,onToggle:j,modelInput:u,setModelInput:S,onModelBlur:v,modelSaved:p,modelPlaceholder:x,showHint:g,setShowHint:t,installCmd:r,docsUrl:w,hintColor:n}){const C=l==="green"?"bg-green-500/10 text-green-600":l==="blue"?"bg-blue-500/10 text-blue-600":"bg-purple-500/10 text-purple-600",k=n==="amber"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300":n==="blue"?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",y=n==="amber"?"bg-amber-100 dark:bg-amber-900/40":n==="blue"?"bg-blue-100 dark:bg-blue-900/40":"bg-purple-100 dark:bg-purple-900/40",E=n==="amber"?"text-amber-600 dark:text-amber-400":n==="blue"?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400",M=s==="opencode"?"OpenCode":s.charAt(0).toUpperCase()+s.slice(1);return e.jsxs("div",{className:`rounded-lg border transition-colors ${o?"border-primary border-l-4":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{className:`w-5 h-5 ${o?"text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-mono font-medium",children:s}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${C}`,children:d}),m?e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:"installed"}):e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 font-medium",children:"not installed"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]})]}),e.jsx(K,{checked:o,onCheckedChange:j,disabled:h||!m})]}),o&&u!==void 0&&S&&v&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Model:"}),e.jsx(F,{value:u,onChange:I=>S(I.target.value),onBlur:v,placeholder:x,className:"h-8 text-sm font-mono",disabled:h}),p&&e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400 text-xs animate-in fade-in duration-200",children:[e.jsx(D,{className:"w-3.5 h-3.5"}),"Saved"]})]})}),!m&&!f&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-border/50",children:[e.jsxs("button",{onClick:()=>t(!g),className:`flex items-center gap-2 text-sm hover:underline w-full py-2 ${E}`,children:[g?e.jsx(Y,{className:"w-4 h-4"}):e.jsx(J,{className:"w-4 h-4"}),"How to install ",M," CLI"]}),g&&e.jsxs("div",{className:`mt-2 p-3 rounded-md text-sm ${k}`,children:[e.jsxs("p",{className:"mb-2",children:["Install globally"," ",d==="GROK_API_KEY"?"(requires xAI API key)":"(FREE tier available)",":"]}),e.jsx("code",{className:`text-sm px-2 py-1 rounded font-mono block mb-2 ${y}`,children:r}),e.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"hover:underline inline-flex items-center gap-1",children:[e.jsx(Q,{className:"w-3 h-3"}),"View documentation"]})]})]})]})}function ce(){const{config:s,status:a,loading:d,statusLoading:l,saving:o,error:m,success:f,geminiModelInput:h,setGeminiModelInput:j,opencodeModelInput:u,setOpencodeModelInput:S,geminiModelSaved:v,opencodeModelSaved:p,fetchConfig:x,fetchStatus:g,saveConfig:t,saveGeminiModel:r,saveOpencodeModel:w}=Z(),{fetchRawConfig:n}=U(),[C,k]=i.useState(!1),[y,E]=i.useState(!1),[M,I]=i.useState(!1);i.useEffect(()=>{x(),g(),n()},[x,g,n]);const N=s?.providers?.gemini?.enabled??!1,W=s?.providers?.grok?.enabled??!1,G=s?.providers?.opencode?.enabled??!1,H=()=>{const c=s?.providers||{},b=c.gemini?.enabled??!1;t({enabled:!b||W||G,providers:{...c,gemini:{...c.gemini,enabled:!b}}})},T=()=>{const c=s?.providers||{},b=c.grok?.enabled??!1;t({enabled:N||!b||G,providers:{...c,grok:{...c.grok,enabled:!b}}})},R=()=>{const c=s?.providers||{},b=c.opencode?.enabled??!1;t({enabled:N||W||!b,providers:{...c,opencode:{...c.opencode,enabled:!b}}})};return d?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(L,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${m||f?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[m&&e.jsxs(_,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(V,{className:"h-4 w-4"}),e.jsx(z,{children:m})]}),f&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(X,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(B,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"CLI-based web search for third-party profiles (gemini, codex, agy, etc.)"}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:N?"WebSearch enabled":"WebSearch disabled"}),l?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking status..."}):a?.readiness?e.jsx("p",{className:"text-sm text-muted-foreground",children:a.readiness.message}):null]}),e.jsx(A,{variant:"ghost",size:"sm",onClick:g,disabled:l,children:e.jsx(L,{className:`w-4 h-4 ${l?"animate-spin":""}`})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Providers"}),e.jsx(O,{name:"gemini",label:"Google Gemini CLI (1000 req/day free)",badge:"FREE",badgeColor:"green",enabled:N,installed:a?.geminiCli?.installed??!1,statusLoading:l,saving:o,onToggle:H,modelInput:h,setModelInput:j,onModelBlur:r,modelSaved:v,modelPlaceholder:"gemini-2.5-flash",showHint:C,setShowHint:k,installCmd:"npm install -g @google/gemini-cli",docsUrl:"https://github.com/google-gemini/gemini-cli",hintColor:"amber"}),e.jsx(O,{name:"opencode",label:"OpenCode (web search via Zen)",badge:"FREE",badgeColor:"green",enabled:G,installed:a?.opencodeCli?.installed??!1,statusLoading:l,saving:o,onToggle:R,modelInput:u,setModelInput:S,onModelBlur:w,modelSaved:p,modelPlaceholder:"opencode/grok-code",showHint:y,setShowHint:E,installCmd:"curl -fsSL https://opencode.ai/install | bash",docsUrl:"https://github.com/sst/opencode",hintColor:"purple"}),e.jsx(O,{name:"grok",label:"xAI Grok CLI (web + X search)",badge:"GROK_API_KEY",badgeColor:"blue",enabled:W,installed:a?.grokCli?.installed??!1,statusLoading:l,saving:o,onToggle:T,showHint:M,setShowHint:I,installCmd:"npm install -g @vibe-kit/grok-cli",docsUrl:"https://github.com/superagent-ai/grok-cli",hintColor:"blue"})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(A,{variant:"outline",size:"sm",onClick:()=>{x(),n()},disabled:d||o,className:"w-full",children:[e.jsx(L,{className:`w-4 h-4 mr-2 ${d?"animate-spin":""}`}),"Refresh"]})})]})}export{ce as default};
|