@kaitranntt/ccs 7.55.0-dev.1 → 7.55.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cliproxy/codex-plan-compatibility.d.ts +19 -0
- package/dist/cliproxy/codex-plan-compatibility.d.ts.map +1 -1
- package/dist/cliproxy/codex-plan-compatibility.js +62 -1
- package/dist/cliproxy/codex-plan-compatibility.js.map +1 -1
- package/dist/cliproxy/codex-reasoning-proxy.d.ts +5 -0
- package/dist/cliproxy/codex-reasoning-proxy.d.ts.map +1 -1
- package/dist/cliproxy/codex-reasoning-proxy.js +103 -20
- package/dist/cliproxy/codex-reasoning-proxy.js.map +1 -1
- package/dist/ui/assets/{accounts-CjGyCl_8.js → accounts-CxIwtPW5.js} +1 -1
- package/dist/ui/assets/{alert-dialog-cy99V8EM.js → alert-dialog-D0M-j0xk.js} +1 -1
- package/dist/ui/assets/{api-DKrhDjiy.js → api-D_GvXEjg.js} +1 -1
- package/dist/ui/assets/{auth-section-DsDyGmzl.js → auth-section-DtxR8sof.js} +1 -1
- package/dist/ui/assets/{backups-section-B63xrUmB.js → backups-section-DAPwVCGp.js} +1 -1
- package/dist/ui/assets/{checkbox-AxZFvatO.js → checkbox-D470Q1y9.js} +1 -1
- package/dist/ui/assets/{claude-extension-N0lxo7BY.js → claude-extension-vRIHOe5q.js} +1 -1
- package/dist/ui/assets/cliproxy-DGsWe0cf.js +3 -0
- package/dist/ui/assets/{cliproxy-control-panel-5fYLcZKs.js → cliproxy-control-panel-BoKpt64d.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-D2bDFGvT.js → confirm-dialog-BnNUvB5u.js} +1 -1
- package/dist/ui/assets/{copilot-INm6uOZF.js → copilot-DCkXk9mK.js} +1 -1
- package/dist/ui/assets/{cursor-C8rDHKEp.js → cursor-9aQfYlGU.js} +1 -1
- package/dist/ui/assets/{droid-OZDvbiwC.js → droid-Bzp6uHqU.js} +1 -1
- package/dist/ui/assets/{globalenv-section-ClTBgKg5.js → globalenv-section-BM9oGUk_.js} +1 -1
- package/dist/ui/assets/{health-CGaRANip.js → health-DLIgkfxF.js} +1 -1
- package/dist/ui/assets/{index-tMnuUCFi.js → index-C-7tLTU2.js} +2 -2
- package/dist/ui/assets/{index-CCSdUs7x.js → index-D9tmeP-H.js} +1 -1
- package/dist/ui/assets/{index-DS1QEaxk.js → index-DGQhzUIq.js} +1 -1
- package/dist/ui/assets/{index-CGOZU3jq.js → index-DimlYMhI.js} +1 -1
- package/dist/ui/assets/{index-DQ4jn6yA.js → index-DykKl5b0.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-PESjh9-t.js → proxy-status-widget-DloYg7yP.js} +1 -1
- package/dist/ui/assets/{searchable-select-D6dcPTiL.js → searchable-select-CSREngvO.js} +1 -1
- package/dist/ui/assets/{separator-Czy9IRpl.js → separator-DzrBeBn-.js} +1 -1
- package/dist/ui/assets/{shared-BUJNJgAr.js → shared-qRzQxB-N.js} +1 -1
- package/dist/ui/assets/{switch-Bog43RUy.js → switch-BP9rnaI6.js} +1 -1
- package/dist/ui/assets/{updates-jcWPnn9L.js → updates-BQvHbU9s.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/cliproxy-D2ozaUJ3.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,bc as M,C as g,j,k as N,_ as w,b as v,n as b,bd as U,be as z,I as B,bf as L}from"./index-tMnuUCFi.js";import{Y as $,Q,aS as Y,v as q,E as G,I as J,a4 as V,C as F,aT as H,ak as K}from"./icons-DtwH984l.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const W={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function X({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",W[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function T({state:s,className:a}){const{t}=p(),d={new:{label:t("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:t("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:t("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx($,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsx(T,{state:a}),e.jsx(X,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(q,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:M(s.publishedAt)}),e.jsx(T,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...z].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,R]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{R(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:O})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{value:l,onChange:r=>n(r.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?L(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|
|
1
|
+
import{j as e}from"./radix-ui-Dt3edmE5.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,bc as M,C as g,j,k as N,_ as w,b as v,n as b,bd as U,be as z,I as B,bf as L}from"./index-C-7tLTU2.js";import{Y as $,Q,aS as Y,v as q,E as G,I as J,a4 as V,C as F,aT as H,ak as K}from"./icons-DtwH984l.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const W={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function X({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",W[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function T({state:s,className:a}){const{t}=p(),d={new:{label:t("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:t("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:t("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx($,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsx(T,{state:a}),e.jsx(X,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(q,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:M(s.publishedAt)}),e.jsx(T,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...z].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,R]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{R(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:O})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{value:l,onChange:r=>n(r.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?L(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|
package/dist/ui/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap"
|
|
25
25
|
rel="stylesheet"
|
|
26
26
|
/>
|
|
27
|
-
<script type="module" crossorigin src="/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-C-7tLTU2.js"></script>
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-CNOkPC89.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/radix-ui-Dt3edmE5.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/tanstack-B8i0evp-.js">
|
package/package.json
CHANGED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as o}from"./react-vendor-CNOkPC89.js";import{a as Be,u as fs,b as $s}from"./tanstack-B8i0evp-.js";import{d as R,C as js,b as vs,c as G,P as Ae,a as Z,a8 as ee,L as X,I as le,r as Ns,s as ys,t as ws,v as bs,w as Ie,a9 as ks,aa as Qs,ab as zs,ac as Js,u as Cs,ad as Ve,ae as Ge,af as $e,ag as Qe,ah as As,ai as ns,aj as Ws,ak as Ys,W as Ss,al as Fe,am as Ps,Y as be,B as V,an as Ue,ao as is,ap as Xs,aq as Zs,ar as et,as as st,at as tt,x as Ms,n as ze,au as Je,m as at,av as nt,aw as it,ax as rt,ay as ot,az as lt,aA as ct,aB as dt,aC as pe,T as he,p as ge,q as fe,aD as ut,aE as mt,aF as xt,aG as rs,aH as pt,aI as ht,aJ as gt,aK as ft,aL as jt,aM as vt,aN as Nt,Q as yt,R as wt,U as os,V as ls,aO as bt,aP as kt,aQ as Ct,aR as At,aS as St,aT as Pt,aU as Mt,aV as Dt,aW as Tt,aX as Ot,aY as Et,aZ as _t,S as Rt}from"./index-tMnuUCFi.js";import{C as He}from"./default-ports-1QQSffYX.js";import{t as q}from"./notifications-B2HqRBj7.js";import{C as Ds,L as W,o as me,Q as Lt,l as ce,n as Ts,as as We,R as Ye,p as xe,a4 as ve,T as Se,a2 as It,at as Os,ar as Ft,au as Pe,Z as Ne,O as Es,h as Ut,t as _s,av as Ht,aj as qt,X as Xe,a3 as Rs,m as Kt,x as Bt,y as Ls,z as qe,aw as Vt,u as cs,ax as Gt,ai as Is,v as $t,ay as ds,am as Qt,az as Fs}from"./icons-DtwH984l.js";import{R as ke,A as us,D as _e,i as zt,a as Jt,P as Wt}from"./proxy-status-widget-PESjh9-t.js";import{C as Ce}from"./checkbox-AxZFvatO.js";import{C as Yt}from"./confirm-dialog-D2bDFGvT.js";import{S as Ze}from"./separator-Czy9IRpl.js";import{S as Xt}from"./searchable-select-D6dcPTiL.js";import{S as Us}from"./switch-Bog43RUy.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-cy99V8EM.js";const je={agy:{provider:"agy",displayName:"Antigravity",defaultModel:"claude-opus-4-6-thinking",models:[{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",description:"Latest flagship, extended thinking",extendedContext:!1,presetMapping:{default:"claude-opus-4-6-thinking",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6",haiku:"claude-sonnet-4-6"}},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",description:"Latest Sonnet with thinking budget support",presetMapping:{default:"claude-sonnet-4-6",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6",haiku:"claude-sonnet-4-6"}},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",description:"Google latest model via Antigravity",extendedContext:!0,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",extendedContext:!0,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",extendedContext:!0,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",extendedContext:!0,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",extendedContext:!0,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.3-codex",models:[{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",description:"Supports up to xhigh effort",presetMapping:{default:"gpt-5.3-codex",opus:"gpt-5.3-codex",sonnet:"gpt-5.3-codex",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",description:"Previous stable Codex model",presetMapping:{default:"gpt-5.2-codex",opus:"gpt-5.2-codex",sonnet:"gpt-5.2-codex",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"Fast, capped at high effort (no xhigh)",presetMapping:{default:"gpt-5-mini",opus:"gpt-5.3-codex",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}},{id:"gpt-5.1-codex-max",name:"Codex Max (5.1)",description:"Legacy most capable Codex model",presetMapping:{default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini"}},{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:"qwen3-coder-plus",models:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus",description:"Code-focused model (1M context)",presetMapping:{default:"qwen3-coder-plus",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max",name:"Qwen3 Max",description:"Flagship model (256K context)",presetMapping:{default:"qwen3-max",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max-preview",name:"Qwen3 Max Preview",description:"Preview with thinking support (256K)",presetMapping:{default:"qwen3-max-preview",opus:"qwen3-max-preview",sonnet:"qwen3-max",haiku:"qwen3-coder-flash"}},{id:"qwen3-235b",name:"Qwen3 235B",description:"Large 235B A22B model",presetMapping:{default:"qwen3-235b",opus:"qwen3-max",sonnet:"qwen3-235b",haiku:"qwen3-coder-flash"}},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus",description:"Vision-language multimodal"},{id:"qwen3-coder-flash",name:"Qwen3 Coder Flash",description:"Fast code generation"},{id:"qwen3-32b",name:"Qwen3 32B",description:"Qwen3 32B model"}]},iflow:{provider:"iflow",displayName:"iFlow",defaultModel:"qwen3-coder-plus",models:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus",description:"Recommended default for iFlow accounts",presetMapping:{default:"qwen3-coder-plus",opus:"qwen3-coder-plus",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-plus"}},{id:"qwen3-max",name:"Qwen3 Max",description:"Flagship Qwen model via iFlow"},{id:"kimi-k2",name:"Kimi K2",description:"Kimi model currently available via iFlow"},{id:"deepseek-v3.2",name:"DeepSeek V3.2",description:"Current DeepSeek V3.2 model via iFlow"},{id:"deepseek-r1",name:"DeepSeek R1",description:"Reasoning-focused DeepSeek model"},{id:"glm-4.6",name:"GLM 4.6",description:"Zhipu GLM 4.6 via iFlow"},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus",description:"Vision-language model"}]},kimi:{provider:"kimi",displayName:"Kimi (Moonshot)",defaultModel:"kimi-k2.5",models:[{id:"kimi-k2.5",name:"Kimi K2.5",description:"Latest multimodal model (262K context)",presetMapping:{default:"kimi-k2.5",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",description:"Extended reasoning model",presetMapping:{default:"kimi-k2-thinking",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2",name:"Kimi K2",description:"Flagship coding 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"}]},claude:{provider:"claude",displayName:"Claude (Anthropic)",defaultModel:"claude-sonnet-4-6",models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",description:"Latest flagship model",extendedContext:!0,presetMapping:{default:"claude-opus-4-6",opus:"claude-opus-4-6",sonnet:"claude-sonnet-4-6",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",description:"Balanced performance and speed",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-6",opus:"claude-opus-4-6",sonnet:"claude-sonnet-4-6",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",description:"Most capable Claude model",extendedContext:!0,presetMapping:{default:"claude-opus-4-5-20251101",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",description:"Balanced performance and speed",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-5-20250929",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",description:"Previous generation Sonnet",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-20250514",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-20250514",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",description:"Fast and efficient"}]}},Re="ccs-internal-managed";async function Zt(){try{const s=await fetch("/api/settings/auth/tokens/raw");return s.ok?(await s.json())?.apiKey?.value??Re:Re}catch{return Re}}async function Ke(s,t){const a=je[s];if(!a)return{success:!1};const n=a.models.find(m=>m.id===a.defaultModel)||a.models[0],i=n?.presetMapping||{default:a.defaultModel,opus:a.defaultModel,sonnet:a.defaultModel,haiku:a.defaultModel},u=await Zt(),r={env:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${He}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:u,ANTHROPIC_MODEL:i.default,ANTHROPIC_DEFAULT_OPUS_MODEL:i.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:i.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:i.haiku}};try{return{success:(await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:r})})).ok,presetName:n?.name||a.defaultModel}}catch{return{success:!1}}}function ea({currentProgress:s,allSteps:t}){return e.jsx("div",{className:"flex justify-center gap-1 pt-2",children:t.map((a,n)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${s>=n?"bg-primary":"bg-muted"}`},a))})}function sa({providers:s,onSelect:t}){return e.jsx("div",{className:"grid gap-2",children:s.map(a=>e.jsxs("button",{onClick:()=>t(a.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:a.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:a.description})]}),e.jsx(Ds,{className:"w-4 h-4 text-muted-foreground"})]},a.id))})}function ta({selectedProvider:s,providers:t,authCommand:a,isRefreshing:n,isPending:i,onBack:u,onStartAuth:d,onRefresh:r}){const[m,h]=o.useState(!1),w=async g=>{await navigator.clipboard.writeText(g),h(!0),setTimeout(()=>h(!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 ",t.find(g=>g.id===s)?.name," to add an account"]}),e.jsx(R,{onClick:d,disabled:i,className:"w-full gap-2",size:"lg",children:i?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4"}),"Authenticate in Browser"]})}),i&&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(js,{children:e.jsxs(vs,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Lt,{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:a}),e.jsx(R,{variant:"outline",size:"icon",onClick:()=>w(a),children:m?e.jsx(ce,{className:"w-4 h-4 text-green-500"}):e.jsx(Ts,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(R,{variant:"ghost",onClick:u,disabled:i,children:[e.jsx(We,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(R,{variant:"outline",onClick:r,disabled:n||i,children:[e.jsx(Ye,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),n?"Checking...":"Refresh Status"]})]})]})}function aa({accounts:s,privacyMode:t,onSelect:a,onAddNew:n,onBack:i}){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 max-h-[320px] overflow-y-auto pr-1",children:s.map(u=>e.jsxs("button",{type:"button",onClick:()=>a(u),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(xe,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:G("font-medium",t&&Ae),children:u.email||u.id}),u.isDefault&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Default account"})]})]}),e.jsx(Ds,{className:"w-4 h-4 text-muted-foreground"})]},u.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(R,{variant:"ghost",onClick:i,children:[e.jsx(We,{className:"w-4 h-4 mr-2"}),"Back"]})})]})}const ms="__custom__";function na({selectedProvider:s,selectedAccount:t,variantName:a,modelName:n,isPending:i,privacyMode:u,onVariantNameChange:d,onModelChange:r,onBack:m,onSkip:h,onCreate:w}){const{t:g}=Z(),l=je[s]?.models||[],x=n&&!l.some(j=>j.id===n),[N,b]=o.useState(x),y=s==="agy"&&n.trim().length>0?ee(n):!1,f=j=>{j===ms?(b(!0),r("")):(b(!1),r(j))};return e.jsxs("div",{className:"space-y-4",children:[t&&e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx(xe,{className:"w-4 h-4"}),e.jsxs("span",{children:[g("setupVariant.using")," ",e.jsx("span",{className:G(u&&Ae),children:t.email||t.id})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"variant-name",children:g("setupVariant.variantNameRequired")}),e.jsx(le,{id:"variant-name",value:a,onChange:j=>d(j.target.value),placeholder:g("setupVariant.variantNamePlaceholder")}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[g("setupVariant.invokeHintPrefix")," ccs ",a||"<name>",' "prompt"']})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{children:g("setupVariant.model")}),N?e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{value:n,onChange:j=>r(j.target.value),placeholder:g("setupVariant.modelPlaceholder")}),y&&e.jsx("p",{className:"text-xs text-destructive",children:"Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated."}),e.jsx("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:()=>{b(!1),s==="agy"&&ee(n)&&r("")},children:g("setupVariant.choosePresetInstead")})]}):e.jsxs(Ns,{value:l.some(j=>j.id===n)?n:"",onValueChange:f,children:[e.jsx(ys,{children:e.jsx(ws,{placeholder:g("setupVariant.selectModel")})}),e.jsxs(bs,{children:[l.map(j=>e.jsx(Ie,{value:j.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:j.name}),j.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",j.description]})]})},j.id)),e.jsx(Ie,{value:ms,children:e.jsx("span",{className:"text-primary",children:g("setupVariant.customModelName")})})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:N?g("setupVariant.enterAnyModel"):g("setupVariant.defaultModel",{model:je[s]?.defaultModel||g("setupVariant.providerDefault")})})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(R,{variant:"ghost",onClick:m,children:[e.jsx(We,{className:"w-4 h-4 mr-2"}),g("setupVariant.back")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{variant:"ghost",onClick:h,children:g("setupVariant.skip")}),e.jsx(R,{onClick:w,disabled:!a||i||y,children:g(i?"setupVariant.creating":"setupVariant.createVariant")})]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:g("setupVariant.skipHint")})]})}function ia({variantName:s,onClose:t}){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(ce,{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(js,{children:e.jsxs(vs,{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(R,{onClick:t,className:"w-full",children:"Done"})]})}function ra({open:s,onClose:t}){const[a,n]=o.useState("provider"),[i,u]=o.useState(""),[d,r]=o.useState(null),[m,h]=o.useState(""),[w,g]=o.useState(""),[l,x]=o.useState(!1),[N,b]=o.useState(!1),{data:y,refetch:f}=ks(),j=Qs(),E=zs(),A=Js(),{privacyMode:F}=Cs(),P=y?.authStatus.find(D=>D.provider===i),p=o.useMemo(()=>P?.accounts||[],[P?.accounts]);o.useEffect(()=>{if(!s){const D=setTimeout(()=>{n("provider"),u(""),r(null),h(""),g(""),b(!1)},0);return()=>clearTimeout(D)}},[s]),o.useEffect(()=>{if(a==="auth"&&p.length>0&&!N){const D=setTimeout(()=>{n("account")},0);return()=>clearTimeout(D)}},[a,p,N]);const U=async()=>{x(!0),await f(),x(!1)},k=()=>{const D=(P?.accounts?.length||0)===0;E.mutate({provider:i},{onSuccess:async _=>{if(D){const H=await Ke(i);H.success&&H.presetName?q.success(`Applied "${H.presetName}" preset`):H.success||q.warning(Ss.t("commonToast.accountAddedPresetFailed"))}_.account&&(r(_.account),n("variant")),f()}})},S=D=>{u(D),(y?.authStatus.find(B=>B.provider===D)?.accounts||[]).length===0?n("auth"):n("account")},O=D=>{r(D),n("variant")},v=async()=>{if(!(!m||!i))try{await j.mutateAsync({name:m,provider:i,model:w||void 0,account:d?.id}),n("success")}catch(D){console.error("Failed to create variant:",D)}},C=`ccs ${i} --auth --add`,K=Ys(a),I=D=>{if(!D&&(E.isPending&&i&&A.mutate(i),a==="success"||a==="provider")){t();return}};return e.jsx(Ve,{open:s,onOpenChange:I,children:e.jsxs(Ge,{className:"sm:max-w-lg",onPointerDownOutside:D=>{a!=="success"&&a!=="provider"&&D.preventDefault()},onEscapeKeyDown:D=>{(E.isPending||j.isPending)&&D.preventDefault()},children:[e.jsxs($e,{children:[e.jsxs(Qe,{className:"flex items-center gap-2",children:[e.jsx(ve,{className:"w-5 h-5 text-primary"}),"Quick Setup Wizard"]}),e.jsxs(As,{children:[a==="provider"&&"Select a provider to get started",a==="auth"&&"Authenticate with your provider",a==="account"&&"Select which account to use",a==="variant"&&"Create your custom variant",a==="success"&&"Setup complete!"]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[a==="provider"&&e.jsx(sa,{providers:ns,onSelect:S}),a==="auth"&&e.jsx(ta,{selectedProvider:i,providers:ns,authCommand:C,isRefreshing:l,isPending:E.isPending,onBack:()=>n("provider"),onStartAuth:k,onRefresh:U}),a==="account"&&e.jsx(aa,{accounts:p,privacyMode:F,onSelect:O,onAddNew:()=>{b(!0),n("auth")},onBack:()=>n("provider")}),a==="variant"&&e.jsx(na,{selectedProvider:i,selectedAccount:d,variantName:m,modelName:w,isPending:j.isPending,privacyMode:F,onVariantNameChange:h,onModelChange:g,onBack:()=>p.length>0?n("account"):n("provider"),onSkip:t,onCreate:v}),a==="success"&&e.jsx(ia,{variantName:m,onClose:t})]}),e.jsx(ea,{currentProgress:K,allSteps:Ws})]})})}const oa=3e3,la=300*1e3;async function Le(s){const t=await s.text();if(!t)return{};try{return JSON.parse(t)}catch{const a=s.status>=400?`Request failed with status ${s.status}`:void 0;return a?{error:a}:{}}}const oe={provider:null,isAuthenticating:!1,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:!1};function ca(){const[s,t]=o.useState(oe),a=o.useRef(null),n=o.useRef(null),i=o.useRef(0),u=o.useRef(!1),d=Be(),r=o.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);o.useEffect(()=>()=>{a.current?.abort(),r(),u.current=!1},[r]);const m=o.useCallback(async(l,x)=>{if(Date.now()-i.current>la){r(),t(N=>({...N,isAuthenticating:!1,error:"Authentication timed out. Please try again."}));return}try{const b=await(await fetch(`/api/cliproxy/auth/${l}/status?state=${encodeURIComponent(x)}`)).json();if(b.status==="ok")r(),d.invalidateQueries({queryKey:["cliproxy-auth"]}),d.invalidateQueries({queryKey:["account-quota"]}),q.success(`${l} authentication successful`),u.current=!1,t(oe);else if(b.status==="auth_url"){const y=b.url||b.auth_url;y&&(t(f=>({...f,authUrl:y})),u.current||(u.current=!0,window.open(y,"_blank")))}else if(b.status==="device_code"){r();const y=b.user_code&&b.verification_url?`Open ${b.verification_url} and enter code: ${b.user_code}`:"Switch to Device Code method and try again.";q.error("Provider returned Device Code flow in callback mode"),t(f=>({...f,isAuthenticating:!1,error:y}))}else if(b.status==="error"){r();const y=b.error||"Authentication failed";q.error(y),t(f=>({...f,isAuthenticating:!1,error:y}))}}catch{}},[d,r]),h=o.useCallback(async(l,x)=>{if(!Fe(l)){t({...oe,error:`Unknown provider: ${l}`});return}a.current?.abort(),r(),u.current=!1;const N=new AbortController;a.current=N;const y=(x?.flowType||(Ps(l)?"device_code":"authorization_code"))==="device_code",f=x?.startEndpoint||(y?"start":"start-url"),j={nickname:x?.nickname,kiroMethod:x?.kiroMethod,riskAcknowledgement:x?.riskAcknowledgement};t({provider:l,isAuthenticating:!0,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:y});try{if(f==="start")fetch(`/api/cliproxy/auth/${l}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j),signal:N.signal}).then(async E=>{const A=await Le(E),F=A.success===!0;if(E.ok&&F)d.invalidateQueries({queryKey:["cliproxy-auth"]}),d.invalidateQueries({queryKey:["account-quota"]}),u.current=!1,t(oe);else{const P=typeof A.error=="string"?A.error:"Authentication failed";q.error(P),t(p=>({...p,isAuthenticating:!1,error:P}))}}).catch(E=>{if(E instanceof Error&&E.name==="AbortError")return;const A=E instanceof Error?E.message:"Authentication failed";q.error(A),t(F=>({...F,isAuthenticating:!1,error:A}))});else{const E=await fetch(`/api/cliproxy/auth/${l}/start-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j),signal:N.signal}),A=await Le(E),F=A.success===!0;if(!E.ok||!F){const U=typeof A.error=="string"?A.error:"Failed to start OAuth";throw new Error(U)}const P=typeof A.authUrl=="string"?A.authUrl:null,p=typeof A.state=="string"?A.state:null;t(U=>({...U,authUrl:P,oauthState:p})),P&&(u.current=!0,window.open(P,"_blank")),p&&(i.current=Date.now(),n.current=setInterval(()=>{m(l,p)},oa))}}catch(E){if(E instanceof Error&&E.name==="AbortError"){u.current=!1,t(oe);return}const A=E instanceof Error?E.message:"Authentication failed";q.error(A),t(F=>({...F,isAuthenticating:!1,error:A}))}},[m,r,d]),w=o.useCallback(()=>{const l=s.provider;a.current?.abort(),r(),u.current=!1,t(oe),l&&be.cliproxy.auth.cancel(l).catch(()=>{})},[s.provider,r]),g=o.useCallback(async l=>{if(s.provider){t(x=>({...x,isSubmittingCallback:!0,error:null}));try{const x=await fetch(`/api/cliproxy/auth/${s.provider}/submit-callback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({redirectUrl:l})}),N=await Le(x),b=N.success===!0;if(x.ok&&b)r(),d.invalidateQueries({queryKey:["cliproxy-auth"]}),d.invalidateQueries({queryKey:["account-quota"]}),q.success(`${s.provider} authentication successful`),t(oe);else{const y=typeof N.error=="string"?N.error:"Callback submission failed";throw new Error(y)}}catch(x){const N=x instanceof Error?x.message:"Failed to submit callback";q.error(N),t(b=>({...b,isSubmittingCallback:!1,error:N}))}}},[s.provider,d,r]);return o.useMemo(()=>({...s,startAuth:h,cancelAuth:w,submitCallback:g}),[s,h,w,g])}function Hs({className:s,showAcknowledgement:t=!1,acknowledgementPhrase:a=ke,acknowledgementText:n="",onAcknowledgementTextChange:i,disabled:u=!1,showProxySettingsLink:d=!1}){const{t:r}=Z(),m=r("accountSafetyWarning.title"),h=r("accountSafetyWarning.subtitle"),w=r("accountSafetyWarning.firstLine"),g=r("accountSafetyWarning.secondLine"),l="https://github.com/kaitranntt/ccs/issues/509",x=r("accountSafetyWarning.issueLabel"),N=r("accountSafetyWarning.proxySettingsLabel");return e.jsxs("section",{role:"alert",className:G("relative overflow-hidden rounded-xl border border-amber-500/30 bg-gradient-to-br from-amber-50 via-background to-rose-50/70 shadow-sm dark:from-amber-950/20 dark:to-rose-950/20",s),children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-gradient-to-r from-amber-500 via-orange-500 to-rose-500"}),e.jsxs("div",{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-7 w-7 items-center justify-center rounded-md bg-amber-500/15 text-amber-700 dark:text-amber-400",children:e.jsx(Se,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold leading-5",children:m}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h})]})]}),e.jsx(V,{variant:"outline",className:"border-amber-500/40 text-amber-700 dark:text-amber-300",children:"High Risk"})]}),e.jsxs("div",{className:"space-y-2 text-sm leading-relaxed",children:[e.jsx("p",{children:w}),e.jsx("p",{className:"font-medium text-amber-900 dark:text-amber-200",children:g}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"CCS is provided as-is and does not take responsibility for suspension, bans, or access loss from upstream providers."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("a",{href:l,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-800 transition-colors hover:bg-amber-500/15 dark:text-amber-200",children:[x,e.jsx(me,{className:"h-3.5 w-3.5"})]}),d&&e.jsxs("a",{href:"/settings?tab=proxy",className:"inline-flex items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-800 transition-colors hover:bg-amber-500/15 dark:text-amber-200",children:[e.jsx(It,{className:"h-3.5 w-3.5"}),N]}),e.jsx("span",{className:"rounded-md border border-border/70 bg-muted/60 px-2.5 py-1 text-xs text-muted-foreground",children:"Applies to CLI and dashboard auth"})]}),t&&i&&e.jsxs("div",{className:"rounded-lg border border-amber-500/25 bg-amber-500/5 p-2.5",children:[e.jsxs(X,{htmlFor:"account-risk-ack-text",className:"text-xs leading-5",children:["Type exact phrase to continue:"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:a})]}),e.jsx(le,{id:"account-risk-ack-text",value:n,onChange:b=>i(b.target.value),placeholder:a,disabled:u,className:"mt-2 font-mono text-xs"})]})]})]})}function da({className:s,value:t,onChange:a,disabled:n=!1}){const{t:i}=Z(),u=[t.reviewedIssue509,t.understandsBanRisk,t.acceptsFullResponsibility,t.typedPhrase.trim().replace(/\s+/g," ").toUpperCase()===us].filter(Boolean).length,d=u/4*100,r=m=>{a({...t,...m})};return e.jsxs("section",{role:"alert",className:G("relative overflow-hidden rounded-xl border border-rose-500/35 bg-gradient-to-br from-rose-50 via-background to-amber-50/70 p-4 shadow-sm dark:from-rose-950/20 dark:to-amber-950/20",s),children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-gradient-to-r from-rose-500 via-orange-500 to-amber-500"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-7 w-7 items-center justify-center rounded-md bg-rose-500/15 text-rose-700 dark:text-rose-300",children:e.jsx(Se,{className:"h-4 w-4"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold leading-5",children:i("antigravityChecklist.title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i("antigravityChecklist.subtitle")})]})]}),e.jsx(V,{variant:"outline",className:"border-rose-500/40 text-rose-700 dark:text-rose-300",children:i("antigravityChecklist.mandatory")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:i("antigravityChecklist.completion")}),e.jsx("span",{children:i("antigravityChecklist.stepsCount",{current:u})})]}),e.jsx(Ue,{value:d,className:"h-2"})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-rose-500/20 bg-rose-500/5 p-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-reviewed-issue",checked:t.reviewedIssue509,onCheckedChange:m=>r({reviewedIssue509:!!m}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-reviewed-issue",className:"text-xs leading-5",children:"Step 1: I reviewed issue #509 and understand AGY OAuth can trigger account bans/suspensions."})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-understands-risk",checked:t.understandsBanRisk,onCheckedChange:m=>r({understandsBanRisk:!!m}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-understands-risk",className:"text-xs leading-5",children:"Step 2: I understand this OAuth action is my own decision and I accept the upstream risk."})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-accept-responsibility",checked:t.acceptsFullResponsibility,onCheckedChange:m=>r({acceptsFullResponsibility:!!m}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-accept-responsibility",className:"text-xs leading-5",children:"Step 3: I accept full responsibility. CCS is not liable for suspension, bans, or access loss."})]})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-amber-500/25 bg-amber-500/5 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-amber-800 dark:text-amber-200",children:[e.jsx(Os,{className:"h-3.5 w-3.5"}),"Step 4: Type exact phrase to continue"]}),e.jsx(le,{value:t.typedPhrase,onChange:m=>r({typedPhrase:m.target.value}),placeholder:us,disabled:n,className:"font-mono text-xs"})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:e.jsxs("a",{href:"https://github.com/kaitranntt/ccs/issues/509",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-rose-500/30 bg-rose-500/10 px-2.5 py-1 font-medium text-rose-800 transition-colors hover:bg-rose-500/15 dark:text-rose-200",children:["Read issue #509",e.jsx(me,{className:"h-3.5 w-3.5"})]})})]})]})}function ua(s){return s.trim().replace(/\s+/g," ").toUpperCase()}function ma({open:s,onClose:t,provider:a,displayName:n,isFirstAccount:i=!1}){const[u,d]=o.useState(""),[r,m]=o.useState(""),[h,w]=o.useState(!1),[g,l]=o.useState(null),[x,N]=o.useState(""),[b,y]=o.useState(_e),[f,j]=o.useState(!1),[E,A]=o.useState(!1),[F,P]=o.useState(is),{t:p}=Z(),U=o.useRef(!1),k=ca(),S=Xs(),O=a==="kiro",v=a==="gemini",C=a==="agy"&&!f,K=a==="agy"&&E,I=zt(b),D=ua(x)===ke,_=Ps(a),H=Zs(a),B=et(F),se=O?B.flowType==="device_code":_,z=k.isAuthenticating||S.isPending,Y=u.trim(),te=g||k.error,c=o.useCallback(async()=>{const M=await fetch("/api/settings/auth/antigravity-risk");if(!M.ok)throw new Error("Failed to load Antigravity power user setting");return(await M.json()).antigravityAckBypass===!0},[]),T=()=>{d(""),m(""),w(!1),l(null),N(""),y(_e),j(!1),A(!1),P(is),U.current=!1,t()};o.useEffect(()=>{s&&(N(""),y(_e),l(null))},[a,s]),o.useEffect(()=>{let M=!1;if(!s||a!=="agy"){j(!1),A(!1);return}return(async()=>{try{A(!0);const ae=await c();M||j(ae)}catch{M||j(!1)}finally{M||A(!1)}})(),()=>{M=!0}},[c,s,a]),o.useEffect(()=>{if(!s||a!=="agy"||!k.error||!f)return;const M=k.error.toLowerCase();if(!(M.includes("agy_risk_ack_required")||M.includes("responsibility acknowledgement")||M.includes("responsibility checklist")))return;let ae=!1;return(async()=>{try{A(!0);const ye=await c();if(ae)return;j(ye),ye||l("Power user mode is off. Complete the AGY checklist and retry.")}catch{if(ae)return;j(!1),l("Power user mode is off. Complete the AGY checklist and retry.")}finally{ae||A(!1)}})(),()=>{ae=!0}},[f,k.error,c,s,a]),o.useEffect(()=>{!k.isAuthenticating&&!k.error&&k.provider===null&&s&&U.current&&(U.current=!1,(async()=>{try{const ne=await Ke(a);ne.success&&ne.presetName&&i&&q.success(`Applied "${ne.presetName}" preset`)}catch{}T()})())},[k.isAuthenticating,k.error,k.provider]);const $=()=>{k.cancelAuth(),T()},de=async()=>{k.authUrl&&(await navigator.clipboard.writeText(k.authUrl),w(!0),setTimeout(()=>w(!1),2e3))},Me=()=>{r.trim()&&k.submitCallback(r.trim())},De=()=>{if(K){l("Loading Antigravity safety settings. Please wait a moment and retry.");return}if(C&&!I){l("Complete all Antigravity responsibility steps before authenticating this provider.");return}if(v&&!D){l(`Type "${ke}" to acknowledge the account safety warning before authenticating this provider.`);return}if(H&&!Y){l(`Nickname is required for ${n} accounts.`);return}l(null),U.current=!0,k.startAuth(a,{nickname:Y||void 0,kiroMethod:O?F:void 0,flowType:O?B.flowType:void 0,startEndpoint:O?B.startEndpoint:void 0,riskAcknowledgement:C?{version:Jt,reviewedIssue509:b.reviewedIssue509,understandsBanRisk:b.understandsBanRisk,acceptsFullResponsibility:b.acceptsFullResponsibility,typedPhrase:b.typedPhrase}:void 0})},Te=()=>{U.current=!0,S.mutate(void 0,{onSuccess:async()=>{const M=await Ke("kiro");M.success&&M.presetName&&i&&q.success(`Applied "${M.presetName}" preset`),T()}})},Oe=M=>{M||$()},J=k.isAuthenticating;return e.jsx(Ve,{open:s,onOpenChange:Oe,children:e.jsxs(Ge,{className:"sm:max-w-md",onInteractOutside:M=>{J&&M.preventDefault()},children:[e.jsxs($e,{children:[e.jsx(Qe,{children:p("addAccountDialog.title",{displayName:n})}),e.jsx(As,{children:p(O?"addAccountDialog.descKiro":se?"addAccountDialog.descDeviceCode":"addAccountDialog.descOauth")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[C&&!J&&e.jsx(da,{value:b,onChange:M=>{y(M),l(null)},disabled:z}),a==="agy"&&f&&!J&&e.jsxs("div",{className:"rounded-lg border border-amber-400/35 bg-amber-50/70 p-3 text-xs text-amber-900 dark:border-amber-800/60 dark:bg-amber-950/25 dark:text-amber-100",children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 font-semibold",children:[e.jsx(Os,{className:"h-3.5 w-3.5"}),p("addAccountDialog.powerUserEnabled")]}),p("addAccountDialog.powerUserSkipped")]}),v&&!J&&e.jsx(Hs,{showAcknowledgement:!0,acknowledgementPhrase:ke,acknowledgementText:x,onAcknowledgementTextChange:M=>{N(M),l(null)},disabled:z}),O&&!J&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"kiro-auth-method",children:p("addAccountDialog.authMethod")}),e.jsxs(Ns,{value:F,onValueChange:M=>{P(M),l(null)},children:[e.jsx(ys,{id:"kiro-auth-method",children:e.jsx(ws,{placeholder:p("addAccountDialog.selectKiroAuthMethod")})}),e.jsx(bs,{children:st.map(M=>e.jsx(Ie,{value:M.id,children:M.label},M.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:B.description})]}),!J&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"nickname",children:p(H?"addAccountDialog.nicknameRequired":"addAccountDialog.nicknameOptional")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(le,{id:"nickname",value:u,onChange:M=>{d(M.target.value),l(null)},placeholder:p("addAccountDialog.nicknamePlaceholder"),disabled:z,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:p(H?"addAccountDialog.nicknameRequiredHint":"addAccountDialog.nicknameOptionalHint")})]}),J&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx(W,{className:"w-4 h-4 inline mr-2 animate-spin"}),p("addAccountDialog.waitingForAuth")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:k.isDeviceCodeFlow?p("addAccountDialog.deviceCodeHint"):p("addAccountDialog.browserHint")})]}),k.authUrl&&!k.isDeviceCodeFlow&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{className:"text-xs",children:p("addAccountDialog.openUrlLabel")}),e.jsxs("div",{className:"p-3 bg-muted rounded-md",children:[e.jsx("p",{className:"text-xs text-muted-foreground break-all font-mono line-clamp-3",children:k.authUrl}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(R,{variant:"outline",size:"sm",onClick:de,children:h?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(Ts,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.copy")]})}),e.jsxs(R,{variant:"outline",size:"sm",onClick:()=>{if(!k.authUrl)return;const M=window.open(k.authUrl,"_blank");(!M||M.closed||typeof M.closed>"u")&&q.warning(p("addAccountDialog.popupBlocked"),{duration:5e3})},children:[e.jsx(me,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.open")]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"callback-url",className:"text-xs",children:p("addAccountDialog.redirectPasteLabel")}),e.jsx(le,{id:"callback-url",value:r,onChange:M=>m(M.target.value),placeholder:p("addAccountDialog.callbackPlaceholder"),className:"font-mono text-xs"}),e.jsx(R,{variant:"secondary",size:"sm",onClick:Me,disabled:!r.trim()||k.isSubmittingCallback,children:k.isSubmittingCallback?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-3 h-3 mr-1 animate-spin"}),p("addAccountDialog.submitting")]}):p("addAccountDialog.submitCallback")})]})]}),!k.authUrl&&!k.isDeviceCodeFlow&&e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:p("addAccountDialog.preparingUrl")})]}),te&&e.jsx("p",{className:"text-xs text-center text-destructive",children:te}),S.isPending&&e.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:[e.jsx(W,{className:"w-4 h-4 inline mr-2 animate-spin"}),p("addAccountDialog.importingToken")]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(R,{variant:"ghost",onClick:$,children:p("addAccountDialog.cancel")}),O&&!J&&e.jsx(R,{variant:"outline",onClick:Te,disabled:z,children:S.isPending?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-2 animate-spin"}),p("addAccountDialog.importing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Ft,{className:"w-4 h-4 mr-2"}),p("addAccountDialog.importFromIde")]})}),!J&&e.jsxs(R,{onClick:De,disabled:z||K||H&&!Y||C&&!I||v&&!D,children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),p("addAccountDialog.authenticate")]})]})]})]})})}const es="[1m]";function xa(s){return s.toLowerCase().startsWith("gemini-")}function ss(s){return s.toLowerCase().endsWith(es.toLowerCase())}function pa(s){return!s||ss(s)?s:`${s}${es}`}function qs(s){return s&&(ss(s)?s.slice(0,-es.length):s)}const xs=["ANTHROPIC_MODEL"],ha=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function ga(s){const t=s?.env||{};return ha.filter(a=>!t[a]?.trim())}function fa(s){const[t,a]=o.useState(null),[n,i]=o.useState(!1),u=Be(),{data:d,isLoading:r,refetch:m}=fs({queryKey:["settings",s],queryFn:async()=>{const S=await fetch(`/api/settings/${s}/raw`);return S.ok?S.json():{profile:s,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${s}/settings.json`}}}),h=d?.settings,w=o.useMemo(()=>t!==null?t:h?JSON.stringify(h,null,2):`{
|
|
2
|
-
"env": {}
|
|
3
|
-
}`,[t,h]),g=o.useCallback(S=>{a(S)},[]),l=o.useMemo(()=>{try{return JSON.parse(w)}catch{return h||{env:{}}}},[w,h]),x=l?.env?.ANTHROPIC_MODEL,N=l?.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,b=l?.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,y=l?.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,f=o.useMemo(()=>{const S=l?.env||{};return xs.some(O=>{const v=S[O];return v&&ss(v)})},[l]),j=o.useCallback((S,O)=>{const v={...l?.env||{},[S]:O},C={...l,env:v};a(JSON.stringify(C,null,2))},[l]),E=o.useCallback(S=>{const O=l?.env||{},v={};for(const I of xs){const D=O[I];D&&(v[I]=S?pa(D):qs(D))}const C={...O,...v};delete C.CCS_EXTENDED_CONTEXT;const K={...l,env:C};a(JSON.stringify(K,null,2))},[l]),A=o.useCallback(S=>{const O={...l?.env||{},...S},v={...l,env:O};a(JSON.stringify(v,null,2))},[l]),F=o.useMemo(()=>{try{return JSON.parse(w),!0}catch{return!1}},[w]),P=o.useMemo(()=>t===null?!1:t!==JSON.stringify(h,null,2),[t,h]),p=o.useMemo(()=>ga(l),[l]),U=$s({mutationFn:async()=>{const S=JSON.parse(w),O=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:S,expectedMtime:d?.mtime})});if(O.status===409)throw new Error("CONFLICT");if(!O.ok)throw new Error("Failed to save");return O.json()},onSuccess:S=>{u.invalidateQueries({queryKey:["settings",s]}),a(null),S?.warning?q.success("Settings saved",{description:S.warning}):q.success("Settings saved")},onError:S=>{S.message==="CONFLICT"?i(!0):q.error(S.message)}}),k=async S=>{i(!1),S?(await m(),U.mutate()):a(null)};return{data:d,isLoading:r,refetch:m,rawJsonContent:w,rawJsonEdits:t,isRawJsonValid:F,hasChanges:P,currentSettings:l,currentModel:x,opusModel:N,sonnetModel:b,haikuModel:y,extendedContextEnabled:f,toggleExtendedContext:E,handleRawJsonChange:g,updateEnvValue:j,updateEnvValues:A,saveMutation:{mutate:()=>U.mutate(),isPending:U.isPending},conflictDialog:n,setConflictDialog:i,handleConflictResolve:k,missingRequiredFields:p}}const ja=/-(medium|high|xhigh)$/i;function va(s){if(!s)return;const t=s.trim().match(ja);if(t?.[1])return t[1].toLowerCase()}function Na(s){if(!s)return null;const t=va(s);return t?{label:`Pinned ${t}`,explicit:!0}:{label:"Auto effort",explicit:!1}}function ya({label:s}){return e.jsx(V,{variant:"outline",className:"text-[9px] h-4 px-1",children:s})}function we({modelId:s}){const t=Na(s);return t?e.jsx(V,{variant:t.explicit?"secondary":"outline",className:"text-[9px] h-4 px-1 uppercase",children:t.label}):null}function re({label:s,description:t,value:a,onChange:n,catalog:i,allModels:u,disabled:d}){const{t:r}=Z(),m=new Set(i?.models.map(x=>x.id)||[]),h=i?.provider==="codex",w=(i?.models??[]).map(x=>({value:x.id,groupKey:"recommended",searchText:`${x.id} ${x.name}`,keywords:[x.tier??"",i?.provider??""],triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:x.id}),h&&e.jsx(we,{modelId:x.id})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:x.id}),x.tier==="paid"&&e.jsx(ya,{label:r("providerModelSelector.paid")}),h&&e.jsx(we,{modelId:x.id})]})})),g=u.filter(x=>!m.has(x.id)).map(x=>({value:x.id,groupKey:"all",searchText:x.id,keywords:[x.owned_by],triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:x.id}),h&&e.jsx(we,{modelId:x.id})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:x.id}),h&&e.jsx(we,{modelId:x.id})]})})),l=w.length+g.length>0;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:s}),t&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:t})]}),e.jsx(Xt,{value:a||void 0,onChange:n,disabled:d,placeholder:r("providerModelSelector.selectModel"),searchPlaceholder:r("searchableSelect.searchModels"),emptyText:r(l?"searchableSelect.noResults":"providerModelSelector.noModelsAvailable"),triggerClassName:"h-9",groups:[{key:"recommended",label:e.jsx("span",{className:"text-xs text-primary",children:r("providerModelSelector.recommended")})},{key:"all",label:e.jsx("span",{className:"text-xs text-muted-foreground",children:r("providerModelSelector.allModelsCount",{count:u.length})})}],options:[...w,...g]})]})}function wa({open:s,onClose:t,currentValues:a,onApply:n,onSave:i,isSaving:u,catalog:d,allModels:r}){const{t:m}=Z(),[h,w]=o.useState(a),[g,l]=o.useState(""),x=N=>{N?(w(a),l("")):t()};return e.jsx(Ve,{open:s,onOpenChange:x,children:e.jsxs(Ge,{className:"sm:max-w-md",children:[e.jsx($e,{children:e.jsxs(Qe,{className:"flex items-center gap-2",children:[e.jsx(ve,{className:"w-4 h-4"}),m("customPresetDialog.title")]})}),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:m("customPresetDialog.presetNameOptional")}),e.jsx(le,{id:"preset-name",value:g,onChange:N=>l(N.target.value),placeholder:m("customPresetDialog.presetNamePlaceholder"),className:"text-sm"})]}),e.jsx(Ze,{}),d?.provider==="codex"&&e.jsxs("p",{className:"text-[11px] text-muted-foreground rounded-md border bg-muted/30 px-2.5 py-2",children:[m("customPresetDialog.codexTipPrefix")," ",e.jsx("code",{children:"-medium"}),", ",e.jsx("code",{children:"-high"}),", and"," ",e.jsx("code",{children:"-xhigh"})," ",m("customPresetDialog.codexTipSuffix")]}),e.jsx(re,{label:m("customPresetDialog.defaultModel"),description:m("customPresetDialog.defaultModelDesc"),value:h.default,onChange:N=>w({...h,default:N}),catalog:d,allModels:r}),e.jsx(re,{label:m("customPresetDialog.opusModel"),description:m("customPresetDialog.opusModelDesc"),value:h.opus,onChange:N=>w({...h,opus:N}),catalog:d,allModels:r}),e.jsx(re,{label:m("customPresetDialog.sonnetModel"),description:m("customPresetDialog.sonnetModelDesc"),value:h.sonnet,onChange:N=>w({...h,sonnet:N}),catalog:d,allModels:r}),e.jsx(re,{label:m("customPresetDialog.haikuModel"),description:m("customPresetDialog.haikuModelDesc"),value:h.haiku,onChange:N=>w({...h,haiku:N}),catalog:d,allModels:r})]}),e.jsxs(tt,{className:"gap-2 sm:gap-0",children:[e.jsx(R,{variant:"outline",onClick:t,children:m("customPresetDialog.cancel")}),i&&e.jsxs(R,{variant:"secondary",onClick:()=>i(h,g||void 0),disabled:u||!g.trim(),children:[u?e.jsx(W,{className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(Pe,{className:"w-4 h-4 mr-1"}),m("customPresetDialog.savePreset")]}),e.jsxs(R,{onClick:()=>n(h,g||void 0),children:[e.jsx(Ne,{className:"w-4 h-4 mr-1"}),m("customPresetDialog.applyPreset")]})]})]})})}function ue({label:s,command:t}){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:t}),e.jsx(Ms,{value:t,size:"icon",className:"h-6 w-6"})]})]})}function ba({provider:s,displayName:t,defaultTarget:a,data:n,authStatus:i}){const u=a||"claude",d=u==="droid";return e.jsx(ze,{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(Es,{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:t})]}),n&&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:n.path}),e.jsx(Ms,{value:n.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(n.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"}),i.authenticated?e.jsxs(V,{variant:"outline",className:"w-fit text-green-600 border-green-200 bg-green-50",children:[e.jsx(Ut,{className:"w-3 h-3 mr-1"}),"Authenticated"]}):e.jsx(V,{variant:"outline",className:"w-fit text-muted-foreground",children:"Not connected"})]}),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:"Default Target"}),e.jsx("span",{className:"font-mono",children:u})]})]})]}),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(ue,{label:"Run with prompt",command:`ccs ${s} "your prompt"`}),e.jsx(ue,{label:d?"Droid alias (explicit)":"Run on Droid",command:d?`ccsd ${s} "your prompt"`:`ccs ${s} --target droid "your prompt"`}),e.jsx(ue,{label:d?"Override to Claude":"Override target",command:`ccs ${s} --target claude "your prompt"`}),e.jsx(ue,{label:"Change model",command:`ccs ${s} --config`}),e.jsx(ue,{label:"Add account",command:`ccs ${s} --add`}),e.jsx(ue,{label:"List accounts",command:`ccs ${s} --accounts`})]})]})]})})}function ka({displayName:s,logoProvider:t,provider:a,data:n,isLoading:i,hasChanges:u,isRawJsonValid:d,isSaving:r,isRemoteMode:m,port:h,onRefetch:w,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(Je,{provider:t||a,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}),m&&e.jsxs(V,{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(_s,{className:"w-3 h-3"}),"Remote"]}),h&&e.jsxs(V,{variant:"outline",className:"text-xs gap-1 font-mono",children:[e.jsx(Ht,{className:"w-3 h-3"}),":",h]}),!m&&n?.path&&e.jsx(V,{variant:"outline",className:"text-xs",children:n.path.replace(/^.*[\\/]/,"")})]}),m?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(R,{variant:"ghost",size:"sm",onClick:w,disabled:i,children:e.jsx(Ye,{className:`w-4 h-4 ${i?"animate-spin":""}`})}),e.jsx(R,{size:"sm",onClick:g,disabled:r||!u||!d,children:r?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(qt,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function Ca({model:s,provider:t,enabled:a,onToggle:n,disabled:i,className:u}){if(!s?.extendedContext)return null;const d=xa(s.id);return e.jsxs("div",{className:G("rounded-lg border p-3 space-y-2",a?"border-primary/50 bg-primary/5":"border-border bg-muted/30",u),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ne,{className:G("w-4 h-4",a?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:"text-sm font-medium",children:"Extended Context"}),e.jsx(V,{variant:a?"default":"secondary",className:"text-[10px] h-5 px-1.5",children:"1M tokens"})]}),e.jsx(Us,{checked:a,onCheckedChange:n,disabled:i})]}),e.jsxs("div",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[e.jsx(Es,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{children:"Enables 1M token context window instead of default 200K."}),e.jsx("p",{className:"text-[10px]",children:d?e.jsxs("span",{className:"text-primary",children:["Auto-enabled for ",t," Gemini models"]}):e.jsxs("span",{children:["Opt-in for ",t," Claude models via --1m flag"]})}),a&&e.jsx("p",{className:"text-amber-600 dark:text-amber-500",children:"Note: 2x input pricing applies for tokens beyond 200K"})]})]})]})}function Aa({catalog:s,savedPresets:t,currentModel:a,opusModel:n,sonnetModel:i,haikuModel:u,providerModels:d,provider:r,extendedContextEnabled:m,onExtendedContextToggle:h,onApplyPreset:w,onUpdateEnvValue:g,onOpenCustomPreset:l,onDeletePreset:x,isDeletePending:N}){const b=s&&s.models.length>0||t.length>0,y=o.useMemo(()=>{if(!s||!a)return;const f=qs(a);return s.models.find(j=>j.id===f)},[s,a]);return e.jsxs(e.Fragment,{children:[b&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(ve,{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(f=>e.jsxs(R,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>{const j=f.presetMapping||{default:f.id,opus:f.id,sonnet:f.id,haiku:f.id};w({ANTHROPIC_MODEL:j.default,ANTHROPIC_DEFAULT_OPUS_MODEL:j.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:j.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:j.haiku})},children:[e.jsx(Ne,{className:"w-3 h-3"}),f.name]},f.id)),t.map(f=>e.jsxs("div",{className:"group relative",children:[e.jsxs(R,{variant:"secondary",size:"sm",className:"text-xs h-7 gap-1 pr-6",onClick:()=>{w({ANTHROPIC_MODEL:f.default,ANTHROPIC_DEFAULT_OPUS_MODEL:f.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:f.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:f.haiku})},children:[e.jsx(Pe,{className:"w-3 h-3 fill-current"}),f.name]}),e.jsx(R,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-7 w-5 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:j=>{j.stopPropagation(),x(f.name)},disabled:N,children:e.jsx(Xe,{className:"w-3 h-3"})})]},f.name)),e.jsxs(R,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1 border-primary/50 text-primary hover:bg-primary/10 hover:border-primary",onClick:l,children:[e.jsx(Rs,{className:"w-3 h-3"}),"Custom"]})]})]}),e.jsx(Ze,{}),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"}),r==="codex"&&e.jsxs("p",{className:"text-[11px] text-muted-foreground mb-3 rounded-md border bg-muted/30 px-2.5 py-2",children:["Codex tip: suffixes ",e.jsx("code",{children:"-medium"}),", ",e.jsx("code",{children:"-high"}),", and ",e.jsx("code",{children:"-xhigh"})," ","pin reasoning effort. Unsuffixed models use Thinking settings."]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(re,{label:"Default Model",description:"Used when no specific tier is requested",value:a,onChange:f=>g("ANTHROPIC_MODEL",f),catalog:s,allModels:d}),y?.extendedContext&&h&&e.jsx(Ca,{model:y,provider:r,enabled:m??!1,onToggle:h}),e.jsx(re,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:n,onChange:f=>g("ANTHROPIC_DEFAULT_OPUS_MODEL",f),catalog:s,allModels:d}),e.jsx(re,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:i,onChange:f=>g("ANTHROPIC_DEFAULT_SONNET_MODEL",f),catalog:s,allModels:d}),e.jsx(re,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:u,onChange:f=>g("ANTHROPIC_DEFAULT_HAIKU_MODEL",f),catalog:s,allModels:d})]})]})]})}function ps(s){const t=Math.max(0,Math.min(100,s));return t<=20?"bg-destructive":t<=50?"bg-yellow-500":"bg-green-500"}function hs(s){if(!s)return"";try{const t=new Date(s),n=new Date().getTime()-t.getTime();if(n<0)return"just now";const i=Math.floor(n/(1e3*60)),u=Math.floor(n/(1e3*60*60)),d=Math.floor(n/(1e3*60*60*24));return d>0?`${d}d ago`:u>0?`${u}h ago`:i>0?`${i}m ago`:"just now"}catch{return""}}function Sa(s){if(!s)return!1;try{const t=new Date(s);return new Date().getTime()-t.getTime()<3600*1e3}catch{return!1}}function Pa({account:s,onSetDefault:t,onRemove:a,onPauseToggle:n,isRemoving:i,isPausingAccount:u,privacyMode:d,showQuota:r,selectable:m,selected:h,onSelectChange:w}){const{t:g}=Z(),l=s.provider.toLowerCase(),x=l==="codex",N=l==="claude"||l==="anthropic",{data:b}=at(r),{data:y,isLoading:f}=nt(l,s.id,r),j=b?.accountStats?.[s.email||s.id]?.lastUsedAt,E=Sa(j),A=it(s.provider,y),F=rt(s.provider,y),P=x&&y&&ot(y)?lt(y.windows):null,p=[{label:"5h",value:P?.fiveHourWindow?.remainingPercent??null},{label:"Weekly",value:P?.weeklyWindow?.remainingPercent??null}].filter(I=>I.value!==null),U=N&&y&&ct(y)?[{label:"5h",value:y.coreUsage?.fiveHour?.remainingPercent??y.windows.find(I=>I.rateLimitType==="five_hour")?.remainingPercent??null},{label:"Weekly",value:y.coreUsage?.weekly?.remainingPercent??y.windows.find(I=>["seven_day","seven_day_opus","seven_day_sonnet","seven_day_oauth_apps","seven_day_cowork"].includes(I.rateLimitType))?.remainingPercent??null}].filter(I=>I.value!==null):[],k=x?p:N?U:[],S=A!==null?pt(A):null,O=S!==null?Number(S):null,v=dt(y),C=v?.label==="Reauth"?Kt:v?.tone==="warning"?Se:Bt,K=v?.tone==="warning"?"border-amber-500/50 text-amber-600 dark:text-amber-400":v?.tone==="destructive"?"border-destructive/50 text-destructive":"border-muted-foreground/50 text-muted-foreground";return e.jsxs("div",{className:G("flex flex-col gap-2 p-3 rounded-lg border transition-colors overflow-hidden",s.isDefault?"border-primary/30 bg-primary/5":"border-border hover:bg-muted/30",s.paused&&"opacity-75",h&&"ring-2 ring-primary/50 bg-primary/5"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[m&&e.jsx("button",{type:"button",onClick:()=>w?.(!h),className:G("flex items-center justify-center w-5 h-5 rounded border-2 transition-colors shrink-0",h?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30 hover:border-primary/50"),"aria-label":h?"Deselect account":"Select account",children:h&&e.jsx(ce,{className:"w-3 h-3"})}),n&&e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>n(!s.paused),disabled:u,children:u?e.jsx(W,{className:"w-4 h-4 animate-spin"}):s.paused?e.jsx(Ls,{className:"w-4 h-4 text-emerald-500"}):e.jsx(qe,{className:"w-4 h-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(fe,{side:"top",children:s.paused?"Resume account":"Pause account"})]})}),e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("div",{className:G("flex items-center justify-center w-8 h-8 rounded-full",s.isDefault?"bg-primary/10":"bg-muted"),children:e.jsx(xe,{className:"w-4 h-4"})}),s.tier&&s.tier!=="unknown"&&s.tier!=="free"&&e.jsx("span",{className:G("absolute -bottom-0.5 -right-0.5 text-[7px] font-bold uppercase px-1 py-px rounded","ring-1 ring-background",s.tier==="ultra"?"bg-violet-500/20 text-violet-600 dark:bg-violet-500/30 dark:text-violet-300":"bg-yellow-500/20 text-yellow-700 dark:bg-yellow-500/25 dark:text-yellow-400"),children:s.tier==="ultra"?"U":"P"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:G("font-medium text-sm truncate",d&&Ae),children:s.email||s.id}),s.isDefault&&e.jsxs(V,{variant:"secondary",className:"text-[10px] h-4 px-1.5 gap-0.5",children:[e.jsx(Pe,{className:"w-2.5 h-2.5 fill-current"}),"Default"]}),s.paused&&e.jsxs(V,{variant:"outline",className:"text-[10px] h-4 px-1.5 border-yellow-500 text-yellow-600",children:[e.jsx(qe,{className:"w-2 h-2 mr-0.5"}),"Paused"]})]}),s.provider==="agy"&&e.jsx("div",{className:"flex items-center gap-1.5 mt-1",children:s.projectId?e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Vt,{className:"w-3 h-3","aria-hidden":"true"}),e.jsx("span",{className:G("font-mono max-w-[180px] truncate",d&&Ae),title:s.projectId,children:s.projectId})]})}),e.jsx(fe,{side:"bottom",children:e.jsx("p",{className:"text-xs",children:"GCP Project ID (read-only)"})})]})}):e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-500",children:[e.jsx(Se,{className:"w-3 h-3","aria-label":"Warning"}),e.jsx("span",{children:"Project ID: N/A"})]})}),e.jsx(fe,{side:"bottom",className:"max-w-[250px]",children:e.jsxs("div",{className:"text-xs space-y-1",children:[e.jsx("p",{className:"font-medium text-amber-600",children:"Missing Project ID"}),e.jsx("p",{children:"This may cause errors. Remove the account and re-add it to fetch the project ID."})]})})]})})}),s.lastUsedAt&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mt-0.5",children:[e.jsx(cs,{className:"w-3 h-3"}),"Last used: ",new Date(s.lastUsedAt).toLocaleDateString()]})]})]}),e.jsxs(ut,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",children:e.jsx(Gt,{className:"w-4 h-4"})})}),e.jsxs(xt,{align:"end",children:[!s.isDefault&&e.jsxs(rs,{onClick:t,children:[e.jsx(Pe,{className:"w-4 h-4 mr-2"}),"Set as default"]}),e.jsxs(rs,{className:"text-destructive focus:text-destructive",onClick:a,disabled:i,children:[e.jsx(Is,{className:"w-4 h-4 mr-2"}),i?"Removing...":"Remove account"]})]})]})]}),r&&e.jsx("div",{className:"pl-11",children:f?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(W,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Loading quota..."})]}):O!==null?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:E?e.jsxs(e.Fragment,{children:[e.jsx($t,{className:"w-3 h-3 text-emerald-500"}),e.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["Active · ",hs(j)]})]}):j?e.jsxs(e.Fragment,{children:[e.jsx(cs,{className:"w-3 h-3 text-muted-foreground"}),e.jsxs("span",{className:"text-muted-foreground",children:["Last used ",hs(j)]})]}):e.jsxs(e.Fragment,{children:[e.jsx(ds,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Not used yet"})]})}),e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:k.length>0?e.jsx("div",{className:"space-y-1.5",children:k.map(I=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-10 text-[10px] text-muted-foreground",children:I.label}),e.jsx(Ue,{value:Math.max(0,Math.min(100,I.value)),className:"h-2 flex-1",indicatorClassName:ps(I.value)}),e.jsxs("span",{className:"text-xs font-medium w-10 text-right",children:[I.value,"%"]})]},I.label))}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ue,{value:Math.max(0,Math.min(100,O)),className:"h-2 flex-1",indicatorClassName:ps(O)}),e.jsxs("span",{className:"text-xs font-medium w-10 text-right",children:[S,"%"]})]})}),e.jsx(fe,{side:"bottom",className:"max-w-xs",children:e.jsx(ht,{quota:y,resetTime:F})})]})})]}):y?.success?e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(V,{variant:"outline",className:"text-[10px] h-5 px-2 gap-1 border-muted-foreground/50 text-muted-foreground",children:[e.jsx(ds,{className:"w-3 h-3"}),g("accountCard.quotaUnavailable")]})}):v?e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(V,{variant:"outline",className:G("text-[10px] h-5 px-2 gap-1",K),children:[e.jsx(C,{className:"w-3 h-3"}),v.label]})})}),e.jsx(fe,{side:"bottom",className:"max-w-[260px]",children:e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsx("p",{children:v.summary}),v.actionHint&&e.jsx("p",{className:"text-muted-foreground",children:v.actionHint}),v.technicalDetail&&e.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:v.technicalDetail}),v.rawDetail&&e.jsx("pre",{className:"whitespace-pre-wrap break-all rounded bg-muted/40 px-2 py-1 font-mono text-[10px] text-muted-foreground",children:v.rawDetail})]})})]})}):null})]})}function Ma({selectedCount:s,onPauseSelected:t,onResumeSelected:a,onClearSelection:n,isPausing:i,isResuming:u}){if(s<1)return null;const d=i||u;return e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-muted/50 rounded-lg border mt-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[s," selected"]}),e.jsx(R,{variant:"ghost",size:"sm",className:"text-xs h-6 px-2",onClick:n,disabled:d,children:"Clear"}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsxs(R,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:t,disabled:d,children:[i?e.jsx(W,{className:"w-3 h-3 animate-spin"}):e.jsx(qe,{className:"w-3 h-3"}),"Pause Selected"]}),e.jsxs(R,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:a,disabled:d,children:[u?e.jsx(W,{className:"w-3 h-3 animate-spin"}):e.jsx(Ls,{className:"w-3 h-3"}),"Resume Selected"]})]})]})}function Da({accounts:s,onAddAccount:t,onSetDefault:a,onRemoveAccount:n,onPauseToggle:i,onSoloMode:u,onBulkPause:d,onBulkResume:r,isRemovingAccount:m,isPausingAccount:h,isSoloingAccount:w,isBulkPausing:g,isBulkResuming:l,privacyMode:x,showQuota:N,isKiro:b,kiroNoIncognito:y,onKiroNoIncognitoChange:f,kiroSettingsLoading:j}){const[E,A]=o.useState(new Set),F=o.useMemo(()=>new Set(s.map(_=>_.id)),[s]),P=o.useMemo(()=>new Set([...E].filter(_=>F.has(_))),[E,F]),p=!!(d&&r),U=P.size,k=s.length>0&&P.size===s.length,S=P.size>0&&P.size<s.length,O=o.useCallback(_=>{A(H=>{const B=new Set(H);return B.has(_)?B.delete(_):B.add(_),B})},[]),v=o.useCallback(()=>{A(new Set(s.map(_=>_.id)))},[s]),C=o.useCallback(()=>{A(new Set)},[]),K=o.useCallback(()=>{k?C():v()},[k,v,C]),I=o.useCallback(()=>{d&&P.size>0&&(d(Array.from(P)),A(new Set))},[d,P]),D=o.useCallback(()=>{r&&P.size>0&&(r(Array.from(P)),A(new Set))},[r,P]);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:[p&&s.length>0&&e.jsx(Ce,{checked:k,onCheckedChange:K,"aria-label":"Select all accounts",className:S?"data-[state=checked]:bg-primary/50":"",...S?{"data-state":"indeterminate"}:{}}),e.jsx(xe,{className:"w-4 h-4"}),"Accounts",s.length>0&&e.jsx(V,{variant:"secondary",className:"text-xs",children:s.length})]}),e.jsxs(R,{variant:"default",size:"sm",className:"h-7 text-xs gap-1",onClick:t,children:[e.jsx(Rs,{className:"w-3 h-3"}),"Add"]})]}),p&&U>0&&e.jsx(Ma,{selectedCount:U,onPauseSelected:I,onResumeSelected:D,onClearSelection:C,isPausing:!!g,isResuming:!!l}),s.length>0?e.jsx("div",{className:"space-y-2",children:s.map(_=>e.jsx(Pa,{account:_,onSetDefault:()=>a(_.id),onRemove:()=>n(_.id),onPauseToggle:i?H=>i(_.id,H):void 0,onSoloMode:u?()=>u(_.id):void 0,isRemoving:m,isPausingAccount:h,isSoloingAccount:w,privacyMode:x,showQuota:N,selectable:p,selected:P.has(_.id),onSelectChange:()=>O(_.id)},_.id))}):e.jsxs("div",{className:"py-6 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed",children:[e.jsx(xe,{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"})]}),b&&f&&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(_s,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Use incognito"})]}),e.jsx(Us,{checked:!y,onCheckedChange:_=>f(!_),disabled:j,className:"scale-90"})]})})]})}function Ta({provider:s,catalog:t,savedPresets:a,currentModel:n,opusModel:i,sonnetModel:u,haikuModel:d,providerModels:r,extendedContextEnabled:m,onExtendedContextToggle:h,onApplyPreset:w,onUpdateEnvValue:g,onOpenCustomPreset:l,onDeletePreset:x,isDeletePending:N,accounts:b,onAddAccount:y,onSetDefault:f,onRemoveAccount:j,onPauseToggle:E,onSoloMode:A,onBulkPause:F,onBulkResume:P,isRemovingAccount:p,isPausingAccount:U,isSoloingAccount:k,isBulkPausing:S,isBulkResuming:O,privacyMode:v,isRemoteMode:C}){const K=s.toLowerCase(),I=(gt.includes(K)||["anthropic","antigravity","gemini-cli","copilot","github-copilot"].includes(K))&&!C,D=s==="kiro",[_,H]=o.useState(!0),[B,se]=o.useState(!0),[z,Y]=o.useState(!1),te=o.useCallback(async()=>{if(D)try{se(!0);const $=(await be.config.get()).cliproxy;H($?.kiro_no_incognito??!0)}catch{H(!0)}finally{se(!1)}},[D]),c=o.useCallback(async T=>{H(T),Y(!0);try{const $=await be.config.get(),de=$.cliproxy??{};await be.config.update({...$,cliproxy:{...de,kiro_no_incognito:T}})}catch{H(!T)}finally{Y(!1)}},[]);return o.useEffect(()=>{te()},[te]),e.jsx(ze,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsx(Aa,{catalog:t,savedPresets:a,currentModel:n,opusModel:i,sonnetModel:u,haikuModel:d,providerModels:r,provider:s,extendedContextEnabled:m,onExtendedContextToggle:h,onApplyPreset:w,onUpdateEnvValue:g,onOpenCustomPreset:l,onDeletePreset:x,isDeletePending:N}),e.jsx(Ze,{}),e.jsx(Da,{accounts:b,onAddAccount:y,onSetDefault:f,onRemoveAccount:j,onPauseToggle:E,onSoloMode:A,onBulkPause:F,onBulkResume:P,isRemovingAccount:p,isPausingAccount:U,isSoloingAccount:k,isBulkPausing:S,isBulkResuming:O,privacyMode:v,showQuota:I,isKiro:D,kiroNoIncognito:_,onKiroNoIncognitoChange:c,kiroSettingsLoading:B||z})]})})}function gs({provider:s,displayName:t,authStatus:a,catalog:n,logoProvider:i,baseProvider:u,isRemoteMode:d,port:r,defaultTarget:m,onAddAccount:h,onSetDefault:w,onRemoveAccount:g,onPauseToggle:l,onSoloMode:x,onBulkPause:N,onBulkResume:b,isRemovingAccount:y,isPausingAccount:f,isSoloingAccount:j,isBulkPausing:E,isBulkResuming:A}){const[F,P]=o.useState(!1),{privacyMode:p}=Cs(),{data:U}=ft(),{data:k}=jt(s),S=vt(),O=Nt(),v=u||s,C=v.toLowerCase()==="agy",K=o.useMemo(()=>{const L=k?.presets||[];return C?L.filter(Q=>!ee(Q.default)&&!ee(Q.opus)&&!ee(Q.sonnet)&&!ee(Q.haiku)):L},[C,k?.presets]),I=o.useMemo(()=>{if(!U?.models)return[];const Q={gemini:["google"],agy:["antigravity"],codex:["openai"],qwen:["alibaba","qwen"],iflow:["iflow"],kiro:["kiro","aws"],ghcp:["github","copilot"],kimi:["kimi","moonshot"]}[v.toLowerCase()]||[v.toLowerCase()];return U.models.filter(ie=>Q.some(Ee=>ie.owned_by.toLowerCase().includes(Ee))?C?!ee(ie.id):!0:!1)},[C,U,v]),D=(u||s).toLowerCase(),{data:_,isLoading:H,refetch:B,rawJsonContent:se,rawJsonEdits:z,isRawJsonValid:Y,hasChanges:te,currentModel:c,opusModel:T,sonnetModel:$,haikuModel:de,extendedContextEnabled:Me,toggleExtendedContext:De,handleRawJsonChange:Te,updateEnvValue:Oe,updateEnvValues:J,saveMutation:M,conflictDialog:ne,handleConflictResolve:ae,missingRequiredFields:ts}=fa(s),ye=o.useMemo(()=>(a.accounts||[]).map(L=>({...L,provider:L.provider||u||s})),[a.accounts,u,s]),{data:Ks}=fs({queryKey:["auth-tokens-raw"],queryFn:async()=>{const L=await fetch("/api/settings/auth/tokens/raw");return L.ok?L.json():{apiKey:{value:"ccs-internal-managed"}}},staleTime:6e4}),as=Ks?.apiKey?.value??"ccs-internal-managed",Bs=L=>{if(C&&[L.ANTHROPIC_MODEL,L.ANTHROPIC_DEFAULT_OPUS_MODEL,L.ANTHROPIC_DEFAULT_SONNET_MODEL,L.ANTHROPIC_DEFAULT_HAIKU_MODEL].some(ie=>typeof ie=="string"&&ee(ie))){q.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}J({ANTHROPIC_BASE_URL:`http://127.0.0.1:${r??He}/api/provider/${D}`,ANTHROPIC_AUTH_TOKEN:as,...L}),q.success(`Applied "${L.ANTHROPIC_MODEL?.split("/").pop()||"preset"}" preset`)},Vs=(L,Q)=>{if(C&&[L.default,L.opus,L.sonnet,L.haiku].some(Ee=>ee(Ee))){q.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}J({ANTHROPIC_BASE_URL:`http://127.0.0.1:${r??He}/api/provider/${D}`,ANTHROPIC_AUTH_TOKEN:as,ANTHROPIC_MODEL:L.default,ANTHROPIC_DEFAULT_OPUS_MODEL:L.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:L.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:L.haiku}),q.success(`Applied ${Q?`"${Q}"`:"custom"} preset`),P(!1)},Gs=(L,Q)=>{if(!Q){q.error(Ss.t("commonToast.enterPresetName"));return}if(C&&[L.default,L.opus,L.sonnet,L.haiku].some(ie=>ee(ie))){q.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}S.mutate({profile:s,data:{name:Q,...L}}),P(!1)};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(ka,{provider:s,displayName:t,logoProvider:i,data:_,isLoading:H,hasChanges:te,isRawJsonValid:Y,isSaving:M.isPending,isRemoteMode:d,port:r,onRefetch:B,onSave:()=>M.mutate()}),H?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(W,{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(yt,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(wt,{className:"w-full",children:[e.jsx(os,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(os,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(ls,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(Ta,{provider:s,catalog:n,savedPresets:K,currentModel:c,opusModel:T,sonnetModel:$,haikuModel:de,providerModels:I,extendedContextEnabled:Me,onExtendedContextToggle:De,onApplyPreset:Bs,onUpdateEnvValue:Oe,onOpenCustomPreset:()=>P(!0),onDeletePreset:L=>O.mutate({profile:s,name:L}),isDeletePending:O.isPending,accounts:ye,onAddAccount:h,onSetDefault:w,onRemoveAccount:g,onPauseToggle:l,onSoloMode:x,onBulkPause:N,onBulkResume:b,isRemovingAccount:y,isPausingAccount:f,isSoloingAccount:j,isBulkPausing:E,isBulkResuming:A,privacyMode:p,isRemoteMode:d})}),e.jsx(ls,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(ba,{provider:s,displayName:t,defaultTarget:m,data:_,authStatus:a})})]})]})}),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(Qt,{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(bt,{rawJsonContent:se,isRawJsonValid:Y,rawJsonEdits:z,onRawJsonChange:Te,profileEnv:_?.settings?.env,missingRequiredFields:ts})]})]}),e.jsx(Yt,{open:ne,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>ae(!0),onCancel:()=>ae(!1)}),e.jsx(wa,{open:F,onClose:()=>P(!1),currentValues:{default:c||"",opus:T||"",sonnet:$||"",haiku:de||""},onApply:Vs,onSave:Gs,isSaving:S.isPending,catalog:n,allModels:I})]})}function Oa({status:s,isSelected:t,onSelect:a}){const{t:n}=Z(),i=s.accounts?.length||0;return e.jsxs("button",{className:G("w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer text-left",t?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:a,children:[e.jsx(Je,{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}),i>0&&e.jsx(V,{variant:"secondary",className:"text-[10px] h-4 px-1",children:i})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:s.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-green-600",children:n("cliproxyPage.connected")})]}):e.jsxs(e.Fragment,{children:[e.jsx(Xe,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("cliproxyPage.notConnected")})]})})]})]})}function Ea({variant:s,parentAuth:t,isSelected:a,onSelect:n,onDelete:i,isDeleting:u}){const{t:d}=Z();return e.jsxs("button",{className:G("group w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-colors cursor-pointer text-left pl-6",a?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:n,children:[e.jsxs("div",{className:"relative",children:[e.jsx(Je,{provider:s.provider,size:"sm"}),e.jsx(Fs,{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(V,{variant:"outline",className:"text-[9px] h-4 px-1",children:d("cliproxyPage.variant")}),e.jsx(V,{variant:"outline",className:"text-[9px] h-4 px-1 uppercase",children:s.target||"claude"})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:t?.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:d("cliproxyPage.viaProvider",{provider:s.provider})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Xe,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:d("cliproxyPage.parentNotConnected")})]})})]}),e.jsx(R,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:r=>{r.stopPropagation(),i()},disabled:u,children:e.jsx(Is,{className:"w-3 h-3"})})]})}function _a({onSetup:s}){const{t}=Z();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(Ne,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:t("cliproxyPage.emptyTitle")}),e.jsx("p",{className:"text-muted-foreground mb-4",children:t("cliproxyPage.emptyDesc")}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:[t("cliproxyPage.emptyControlPanelPrefix")," ",e.jsx("a",{href:"/cliproxy/control-panel",className:"text-primary hover:underline",children:t("cliproxyPage.controlPanel")}),"."]}),e.jsxs(R,{onClick:s,className:"gap-2",children:[e.jsx(ve,{className:"w-4 h-4"}),t("cliproxyPage.quickSetup")]})]})})}function Xa(){const{t:s}=Z(),t=Be(),{data:a,isLoading:n}=ks(),{data:i,isFetching:u}=kt(),{data:d}=Ct(),r=At(),m=St(),h=Pt(),w=Mt(),g=Dt(),l=Tt(),x=Ot(),N=Et(),[b,y]=o.useState(()=>{if(typeof window<"u"){const T=new URLSearchParams(window.location.search).get("provider")?.trim().toLowerCase();return T&&Fe(T)?T:localStorage.getItem("cliproxy-selected-provider")}return null}),[f,j]=o.useState(null),[E,A]=o.useState(!1),[F,P]=o.useState(()=>{if(typeof window>"u")return null;const c=new URLSearchParams(window.location.search),T=c.get("provider")?.trim().toLowerCase();return c.get("action")!=="auth"||!T||!Fe(T)?null:{provider:T,displayName:_t(T),isFirstAccount:!1}}),p=o.useMemo(()=>a?.authStatus||[],[a?.authStatus]),U=a?.source==="remote",k=o.useMemo(()=>i?.variants||[],[i?.variants]),S=c=>{y(c),c&&localStorage.setItem("cliproxy-selected-provider",c)},O=o.useMemo(()=>f?null:b&&p.some(c=>c.provider===b)?b:p.length>0&&(p.find(T=>(T.accounts?.length||0)>0)?.provider||p[0]?.provider)||null,[b,f,p]),v=p.find(c=>c.provider===O),C=k.find(c=>c.name===f),K=C?p.find(c=>c.provider===C.provider):void 0,I=(C?.provider||v?.provider||"").toLowerCase().trim(),D=I==="gemini"||I==="agy",_=()=>{t.invalidateQueries({queryKey:["cliproxy"]}),t.invalidateQueries({queryKey:["cliproxy-auth"]})},H=(c,T,$)=>{h.isPending||w.isPending||($?h.mutate({provider:c,accountId:T}):w.mutate({provider:c,accountId:T}))},B=(c,T)=>{g.isPending||g.mutate({provider:c,accountId:T})},se=(c,T)=>{l.isPending||l.mutate({provider:c,accountIds:T})},z=(c,T)=>{x.isPending||x.mutate({provider:c,accountIds:T})},Y=c=>{S(c),j(null)},te=c=>{j(c),S(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(Ne,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:d?.backendLabel??"CLIProxy"})]}),e.jsx(R,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:_,disabled:u,children:e.jsx(Ye,{className:G("w-4 h-4",u&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:s("cliproxyPage.accountManagement")}),e.jsxs(R,{variant:"default",size:"sm",className:"w-full gap-2",onClick:()=>A(!0),children:[e.jsx(ve,{className:"w-4 h-4"}),s("cliproxyPage.quickSetup")]})]}),e.jsx(ze,{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:s("cliproxyPage.providers")}),n?e.jsx("div",{className:"space-y-2 px-2",children:[1,2,3,4].map(c=>e.jsx(Rt,{className:"h-14 w-full rounded-lg"},c))}):e.jsx("div",{className:"space-y-1",children:p.map(c=>e.jsx(Oa,{status:c,isSelected:O===c.provider,onSelect:()=>Y(c.provider)},c.provider))}),k.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(Fs,{className:"w-3 h-3"}),s("cliproxyPage.variants")]}),e.jsx("div",{className:"space-y-1",children:k.map(c=>e.jsx(Ea,{variant:c,parentAuth:p.find(T=>T.provider===c.provider),isSelected:f===c.name,onSelect:()=>te(c.name),onDelete:()=>N.mutate(c.name),isDeleting:N.isPending},c.name))})]})]})}),e.jsx("div",{className:"p-3 border-t",children:e.jsx(Wt,{})}),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.jsx("span",{children:s("cliproxyPage.providerCount",{count:p.length})}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ce,{className:"w-3 h-3 text-green-600"}),s("cliproxyPage.connectedCount",{count:p.filter(c=>c.authenticated).length})]})]})})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background",children:[D&&e.jsx(Hs,{showProxySettingsLink:!0,className:"mx-4 mt-4"}),C&&K?e.jsx(gs,{provider:C.name,displayName:s("cliproxyPage.variantDisplay",{name:C.name,provider:C.provider}),authStatus:K,catalog:je[C.provider],logoProvider:C.provider,baseProvider:C.provider,defaultTarget:C.target,isRemoteMode:U,port:C.port,onAddAccount:()=>P({provider:C.provider,displayName:K.displayName,isFirstAccount:(K.accounts?.length||0)===0}),onSetDefault:c=>r.mutate({provider:C.provider,accountId:c}),onRemoveAccount:c=>m.mutate({provider:C.provider,accountId:c}),onPauseToggle:(c,T)=>H(C.provider,c,T),onSoloMode:c=>B(C.provider,c),onBulkPause:c=>se(C.provider,c),onBulkResume:c=>z(C.provider,c),isRemovingAccount:m.isPending,isPausingAccount:h.isPending||w.isPending,isSoloingAccount:g.isPending,isBulkPausing:l.isPending,isBulkResuming:x.isPending}):v?e.jsx(gs,{provider:v.provider,displayName:v.displayName,authStatus:v,catalog:je[v.provider],isRemoteMode:U,onAddAccount:()=>P({provider:v.provider,displayName:v.displayName,isFirstAccount:(v.accounts?.length||0)===0}),onSetDefault:c=>r.mutate({provider:v.provider,accountId:c}),onRemoveAccount:c=>m.mutate({provider:v.provider,accountId:c}),onPauseToggle:(c,T)=>H(v.provider,c,T),onSoloMode:c=>B(v.provider,c),onBulkPause:c=>se(v.provider,c),onBulkResume:c=>z(v.provider,c),isRemovingAccount:m.isPending,isPausingAccount:h.isPending||w.isPending,isSoloingAccount:g.isPending,isBulkPausing:l.isPending,isBulkResuming:x.isPending}):e.jsx(_a,{onSetup:()=>A(!0)})]}),e.jsx(ra,{open:E,onClose:()=>A(!1)}),e.jsx(ma,{open:F!==null,onClose:()=>P(null),provider:F?.provider||"",displayName:F?.displayName||"",isFirstAccount:F?.isFirstAccount||!1})]})}export{Xa as CliproxyPage};
|