@kaitranntt/ccs 7.67.0-dev.6 → 7.67.0-dev.7
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/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +19 -4
- package/dist/cliproxy/model-catalog.js.map +1 -1
- package/dist/shared/agy-gemini-pro-compatibility.d.ts +15 -0
- package/dist/shared/agy-gemini-pro-compatibility.d.ts.map +1 -0
- package/dist/shared/agy-gemini-pro-compatibility.js +18 -0
- package/dist/shared/agy-gemini-pro-compatibility.js.map +1 -0
- package/dist/ui/assets/{accounts-BOBt8qmH.js → accounts-CD6xqLf4.js} +1 -1
- package/dist/ui/assets/{alert-dialog-BE0w14Bi.js → alert-dialog-Cq0uMwyf.js} +1 -1
- package/dist/ui/assets/{api-jOigwnfw.js → api-DYb7nMX1.js} +1 -1
- package/dist/ui/assets/{auth-section-CibYATlA.js → auth-section-B8ptHr9t.js} +1 -1
- package/dist/ui/assets/{backups-section-Blko2Tf6.js → backups-section-m6vX118k.js} +1 -1
- package/dist/ui/assets/{channels-D-k3Syy5.js → channels-CXmV9gwU.js} +1 -1
- package/dist/ui/assets/{checkbox-By2DQCzK.js → checkbox-dGCgZTKA.js} +1 -1
- package/dist/ui/assets/{claude-extension-Bil-P_9G.js → claude-extension-TiOTnDTd.js} +1 -1
- package/dist/ui/assets/cliproxy-EF7iEy5S.js +3 -0
- package/dist/ui/assets/{cliproxy-ai-providers-4w79eRiv.js → cliproxy-ai-providers-BK0savIX.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-C1k_wf7z.js → cliproxy-control-panel-DAoeSaoD.js} +1 -1
- package/dist/ui/assets/{codex-DNoq1VkC.js → codex-B1reJvsl.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-US_UaPyf.js → confirm-dialog-C-kGSty5.js} +1 -1
- package/dist/ui/assets/{copilot-BMkQ_QRT.js → copilot-CA9P3Gsd.js} +1 -1
- package/dist/ui/assets/{cursor-xU7JLtxV.js → cursor-BaX25jJK.js} +1 -1
- package/dist/ui/assets/{droid-BNxUZY4V.js → droid-zythBAEB.js} +1 -1
- package/dist/ui/assets/{globalenv-section-Dw7F_urX.js → globalenv-section-Cwav5LU1.js} +1 -1
- package/dist/ui/assets/{health-Ddu-xxIx.js → health-B_CZll49.js} +1 -1
- package/dist/ui/assets/{index-fEZshZPo.js → index-BDlLr4t5.js} +2 -2
- package/dist/ui/assets/{index-8euRVukD.js → index-BsbzlZcs.js} +1 -1
- package/dist/ui/assets/{index-Ca-UH2c1.js → index-BwpceYga.js} +1 -1
- package/dist/ui/assets/{index-BHY0WRtR.js → index-COgxkmyB.js} +1 -1
- package/dist/ui/assets/{index-DKL3u-gW.js → index-ChCDerjX.js} +1 -1
- package/dist/ui/assets/{index-DXd6_mKB.js → index-D6eRghE-.js} +1 -1
- package/dist/ui/assets/{logs-CQMjsNYa.js → logs-Bn5qH5av.js} +1 -1
- package/dist/ui/assets/{masked-input-BfhwpXRH.js → masked-input-BAcMJrej.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-HO9jS5Qd.js → proxy-status-widget-BzhhtHaF.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-DX7F7Pri.js → raw-json-settings-editor-panel-q7Z0GFci.js} +1 -1
- package/dist/ui/assets/{searchable-select-qRzYMbYU.js → searchable-select-D2J-XoN0.js} +1 -1
- package/dist/ui/assets/{separator-B2k5GQrX.js → separator-4bzMuArh.js} +1 -1
- package/dist/ui/assets/{shared-B1RmJpal.js → shared-DMT_Fh95.js} +1 -1
- package/dist/ui/assets/{table-Cb3x_pJ-.js → table-CyRavMCY.js} +1 -1
- package/dist/ui/assets/{updates-Av_yOTDS.js → updates-D6XV9cJj.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/cliproxy-C6Hg0R5t.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n}from"./radix-ui-Zb8sVEtn.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{e as _,f as P,d as $,c as w,g as B,I as G}from"./index-
|
|
1
|
+
import{j as n}from"./radix-ui-Zb8sVEtn.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{e as _,f as P,d as $,c as w,g as B,I as G}from"./index-BDlLr4t5.js";import{aQ as H,au as L,m as V}from"./icons-KVCk4_U8.js";function S(o){return o.trim().toLowerCase()}function M(o,h){return`${o}-option-${h.replace(/[^a-z0-9_-]+/gi,"-")}`}function Z({value:o,onChange:h,options:f,groups:g,placeholder:j,searchPlaceholder:k,emptyText:E,disabled:F,className:q,triggerClassName:K,contentClassName:R}){const[l,T]=a.useState(!1),[y,A]=a.useState(""),[i,c]=a.useState(),m=a.useId(),I=a.useRef(null),N=a.useRef({}),O=a.useMemo(()=>f.find(e=>e.value===o),[f,o]),d=a.useMemo(()=>{const e=S(y);return e?f.filter(t=>[t.searchText,...t.keywords??[]].some(u=>S(u).includes(e))):f},[f,y]),z=a.useMemo(()=>{const e=new Map((g??[]).map(r=>[r.key,r])),t=d.filter(r=>!r.groupKey||!e.has(r.groupKey)),u=(g??[]).map(r=>({...r,options:d.filter(x=>x.groupKey===r.key)})).filter(r=>r.options.length>0);return t.length===0?u:[{key:"__default",options:t},...u]},[d,g]),s=a.useMemo(()=>d.filter(e=>!e.disabled),[d]),D=O?.triggerContent??O?.itemContent,v=e=>{T(e),e||(A(""),c(void 0))},b=()=>I.current?.focus();a.useEffect(()=>{if(l){if(s.length===0){c(void 0);return}c(e=>e&&s.some(t=>t.value===e)?e:s.find(t=>t.value===o)?.value??s[0]?.value)}},[s,l,o]),a.useEffect(()=>{!l||!i||N.current[i]?.scrollIntoView({block:"nearest"})},[i,l]);const p=e=>{if(s.length===0)return;if(e==="first"){c(s[0]?.value);return}if(e==="last"){c(s.at(-1)?.value);return}const t=s.findIndex(U=>U.value===i),u=e==="next"?-1:s.length,r=t>=0?t:u,x=e==="next"?Math.min(r+1,s.length-1):Math.max(r-1,0);c(s[x]?.value)},C=e=>{h(e),v(!1)},Q=()=>{if(!i)return;const e=s.find(t=>t.value===i);e&&C(e.value)};return n.jsxs(_,{open:l,onOpenChange:v,children:[n.jsx(P,{asChild:!0,children:n.jsxs($,{type:"button",variant:"outline","aria-expanded":l,"aria-controls":l?m:void 0,"aria-haspopup":"dialog",disabled:F,onKeyDown:e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),v(!0);const t=()=>{b(),p(e.key==="ArrowDown"?"first":"last")};if(typeof requestAnimationFrame=="function"){requestAnimationFrame(t);return}setTimeout(t,0)},className:w("w-full justify-between font-normal",q,K,!D&&"text-muted-foreground"),children:[n.jsx("div",{className:"min-w-0 flex-1 text-left",children:D??n.jsx("span",{children:j})}),n.jsx(H,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsxs(B,{align:"start",className:w("w-[var(--radix-popover-trigger-width)] p-0",R),onOpenAutoFocus:e=>{if(e.preventDefault(),typeof requestAnimationFrame=="function"){requestAnimationFrame(b);return}setTimeout(b,0)},children:[n.jsx("div",{className:"border-b p-2",children:n.jsxs("div",{className:"relative",children:[n.jsx(L,{className:"text-muted-foreground absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2"}),n.jsx(G,{ref:I,value:y,onChange:e=>A(e.target.value),role:"combobox","aria-label":k,"aria-autocomplete":"list","aria-expanded":l,"aria-controls":m,"aria-activedescendant":i?M(m,i):void 0,onKeyDown:e=>{if(e.key==="ArrowDown"){e.preventDefault(),p("next");return}if(e.key==="ArrowUp"){e.preventDefault(),p("previous");return}if(e.key==="Home"){e.preventDefault(),p("first");return}if(e.key==="End"){e.preventDefault(),p("last");return}if(e.key==="Enter"){e.preventDefault(),Q();return}e.key==="Escape"&&(e.preventDefault(),v(!1))},placeholder:k,className:"pl-8"})]})}),n.jsx("div",{"data-slot":"searchable-select-scroll-container","data-testid":"searchable-select-scroll-container",className:"max-h-72 overflow-y-auto overscroll-contain",children:d.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:E}):n.jsx("div",{id:m,role:"listbox","aria-label":j,className:"p-1",children:z.map(e=>n.jsxs("div",{children:[e.label&&n.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:e.label}),e.options.map(t=>{const u=t.value===i,r=t.value===o;return n.jsxs("button",{id:M(m,t.value),type:"button",role:"option","aria-selected":r,disabled:t.disabled,tabIndex:-1,ref:x=>{N.current[t.value]=x},onMouseMove:()=>{t.disabled||c(t.value)},onFocus:()=>{t.disabled||c(t.value)},onClick:()=>C(t.value),className:w("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none","focus-visible:ring-ring focus-visible:ring-1",u&&"bg-accent text-accent-foreground",r&&"bg-accent text-accent-foreground",t.disabled&&"pointer-events-none opacity-50"),children:[n.jsx("div",{className:"min-w-0 flex-1",children:t.itemContent}),r&&n.jsx(V,{className:"h-4 w-4 shrink-0"})]},t.value)})]},e.key))})})]})]})}export{Z as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i,a0 as n}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-
|
|
1
|
+
import{j as i,a0 as n}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-BDlLr4t5.js";function m({className:t,orientation:a="horizontal",decorative:o=!0,...r}){return i.jsx(n,{"data-slot":"separator",decorative:o,orientation:a,className:e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}export{m as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as Q,bi as ee,bj as se,bk as te,Q as ae,R as re,U as ne,B as $,ba as S,bb as M,bc as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-fEZshZPo.js";import{a3 as ce,aa as oe,b7 as me,T as E,R as T,F as he,au as ue,w as xe}from"./icons-KVCk4_U8.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:_,error:W,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(W,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):_?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
|
|
1
|
+
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as Q,bi as ee,bj as se,bk as te,Q as ae,R as re,U as ne,B as $,ba as S,bb as M,bc as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-BDlLr4t5.js";import{a3 as ce,aa as oe,b7 as me,T as E,R as T,F as he,au as ue,w as xe}from"./icons-KVCk4_U8.js";import"./tanstack-CrmUhA7Z.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:_,error:W,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(W,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):_?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
|
|
2
2
|
`).trim();if(!a)return{blocks:[],frontmatter:[]};let l=a;const t=[];if(l.startsWith(`---
|
|
3
3
|
`)){const r=l.indexOf(`
|
|
4
4
|
---
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as l}from"./index-
|
|
1
|
+
import{j as t}from"./radix-ui-Zb8sVEtn.js";import"./react-vendor-CNOkPC89.js";import{c as l}from"./index-BDlLr4t5.js";function n({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function c({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function b({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",a),...e})}function i({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}function m({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}export{n as T,c as a,b,i as c,d,m as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.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,bl as M,C as g,j,k as N,_ as w,b as v,n as b,bm as U,bn as $,I as z,bo as B}from"./index-fEZshZPo.js";import{a1 as L,$ as Q,b8 as q,x as G,E as J,Q as V,aa as Y,C as F,b9 as H,au as K}from"./icons-KVCk4_U8.js";import"./tanstack-CrmUhA7Z.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 R({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(L,{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(R,{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(q,{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(G,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(V,{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(Y,{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(R,{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(()=>[...$].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,T]=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=>{T(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:"flex h-full min-h-0 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(z,{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?B(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|
|
1
|
+
import{j as e}from"./radix-ui-Zb8sVEtn.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,bl as M,C as g,j,k as N,_ as w,b as v,n as b,bm as U,bn as $,I as z,bo as B}from"./index-BDlLr4t5.js";import{a1 as L,$ as Q,b8 as q,x as G,E as J,Q as V,aa as Y,C as F,b9 as H,au as K}from"./icons-KVCk4_U8.js";import"./tanstack-CrmUhA7Z.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 R({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(L,{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(R,{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(q,{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(G,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(V,{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(Y,{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(R,{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(()=>[...$].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,T]=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=>{T(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:"flex h-full min-h-0 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(z,{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?B(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-BDlLr4t5.js"></script>
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-CNOkPC89.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/radix-ui-Zb8sVEtn.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/tanstack-CrmUhA7Z.js">
|
package/package.json
CHANGED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{a as lt,u as _t,b as cs}from"./tanstack-CrmUhA7Z.js";import{a8 as ds,d as U,C as Ft,b as Ut,a9 as Kt,c as $,P as ct,B as H,a as oe,aa as re,L as W,I as de,r as Je,s as We,t as Xe,v as Ye,w as we,ab as qt,ac as Ht,ad as us,ae as ms,af as ps,u as Vt,ag as dt,ah as ut,ai as mt,aj as pt,ak as Gt,al as yt,am as xs,an as hs,W as Bt,ao as Ze,ap as zt,Y as Ee,aq as gs,ar as wt,as as Ct,at as fs,au as vs,av as js,aw as bs,ax as Ns,ay as ys,az as ws,aA as Cs,aB as kt,aC as ks,x as $t,n as xt,aD as ht,aE as At,aF as Qt,aG as As,m as Ss,aH as Ps,aI as Ms,aJ as et,T as tt,p as st,q as at,aK as Ds,aL as Ts,aM as Is,aN as St,aO as Ls,aP as Rs,aQ as Es,aR as Os,aS as _s,aT as Fs,Q as Us,R as Ks,U as Pt,V as Mt,aU as qs,aV as Hs,aW as Vs,aX as Gs,aY as Bs,aZ as zs,a_ as $s,a$ as Qs,b0 as Js,b1 as Ws,b2 as Xs,b3 as Ys,S as Zs}from"./index-fEZshZPo.js";import{C as nt}from"./default-ports-1QQSffYX.js";import{t as V}from"./notifications-B2HqRBj7.js";import{C as Jt,L as se,p as ge,$ as ea,m as ve,o as Wt,aF as gt,R as ft,q as Ce,aa as ke,T as Fe,a7 as Dt,aG as Xt,aE as ta,z as vt,Z as Ae,_ as Yt,i as sa,u as Zt,aH as aa,at as na,X as jt,a9 as es,J as ts,D as ss,aI as ia,as,aJ as ra,aw as oa,aK as ns}from"./icons-KVCk4_U8.js";import{R as Oe,A as Tt,D as Be,i as la,a as ca}from"./antigravity-responsibility-constants-Bvh4Ybz0.js";import{C as _e}from"./checkbox-By2DQCzK.js";import{C as da}from"./confirm-dialog-US_UaPyf.js";import{S as bt}from"./separator-B2k5GQrX.js";import{S as ua}from"./searchable-select-qRzYMbYU.js";import{P as ma}from"./proxy-status-widget-HO9jS5Qd.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-BE0w14Bi.js";const is=Object.freeze({"gemini-3-pro-preview":"gemini-3.1-pro-preview","gemini-3.1-pro-preview":"gemini-3-pro-preview","gemini-3-flash-preview":"gemini-3.1-flash-preview","gemini-3.1-flash-preview":"gemini-3-flash-preview"}),pa=/^gemini-(\d+(?:[.-]\d+)*)-(pro|flash)-preview(-customtools)?$/i;function fe(t){return ds(t).toLowerCase()}function Ue(t){const s=fe(t),a=s.match(pa);if(!a)return null;const[,n,i,d]=a;return{normalizedId:s,version:n.split(/[.-]/).map(l=>Number(l)),family:i,customtools:!!d,dottedVersion:n.includes(".")}}function rs(t,s){const a=Math.max(t.length,s.length);for(let n=0;n<a;n+=1){const i=t[n]??0,d=s[n]??0;if(i!==d)return i>d?1:-1}return 0}function xa(t,s,a){if(t.customtools!==s.customtools)return t.customtools?1:-1;const n=rs(t.version,s.version);if(n!==0)return n>0?-1:1;const i=+(t.dottedVersion===a.dottedVersion),d=+(s.dottedVersion===a.dottedVersion);return i!==d?d-i:t.normalizedId.localeCompare(s.normalizedId)}function It(t,s){const a=fe(s);return t.find(n=>fe(n.id)===a)?.id}function ha(t,s){const a=Ue(t);return!a||s.length===0?void 0:s.map(i=>{const d=Ue(i.id);return!d||d.family!==a.family?null:{id:i.id,info:d}}).filter(i=>!!i).sort((i,d)=>xa(i.info,d.info,a))[0]?.id}const he={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.1-pro-preview",name:"Gemini Pro",description:"Resolves to the best advertised Gemini Pro preview via Antigravity",extendedContext:!0,presetMapping:{default:"gemini-3.1-pro-preview",opus:"gemini-3.1-pro-preview",sonnet:"gemini-3.1-pro-preview",haiku:"gemini-3-1-flash-preview"}},{id:"gemini-3-1-flash-preview",name:"Gemini Flash",description:"Resolves to the best advertised Gemini Flash preview via Antigravity",extendedContext:!0,presetMapping:{default:"gemini-3-1-flash-preview",opus:"gemini-3.1-pro-preview",sonnet:"gemini-3.1-pro-preview",haiku:"gemini-3-1-flash-preview"}}]},gemini:{provider:"gemini",displayName:"Gemini",defaultModel:"gemini-2.5-pro",models:[{id:"gemini-3.1-pro-preview",name:"Gemini Pro",tier:"paid",description:"Uses the best advertised Gemini Pro preview when Google exposes one",extendedContext:!0,presetMapping:{default:"gemini-3.1-pro-preview",opus:"gemini-3.1-pro-preview",sonnet:"gemini-3.1-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini Flash",tier:"paid",description:"Uses the best advertised Gemini Flash preview when Google exposes one",extendedContext:!0,presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3.1-pro-preview",sonnet:"gemini-3.1-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-codex",models:[{id:"gpt-5-codex",name:"GPT-5 Codex",description:"Cross-plan safe Codex default",presetMapping:{default:"gpt-5-codex",opus:"gpt-5-codex",sonnet:"gpt-5-codex",haiku:"gpt-5-codex-mini"}},{id:"gpt-5-codex-mini",name:"GPT-5 Codex Mini",description:"Faster and cheaper Codex option",presetMapping:{default:"gpt-5-codex-mini",opus:"gpt-5-codex",sonnet:"gpt-5-codex",haiku:"gpt-5-codex-mini"}},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"Legacy mini model ID kept for backwards compatibility",presetMapping:{default:"gpt-5-mini",opus:"gpt-5-codex",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}},{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini",description:"Legacy fast Codex mini model",presetMapping:{default:"gpt-5.1-codex-mini",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",description:"Higher-effort Codex model with xhigh support",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-codex",name:"GPT-5.2 Codex",description:"Cross-plan Codex model with xhigh support",presetMapping:{default:"gpt-5.2-codex",opus:"gpt-5.2-codex",sonnet:"gpt-5.2-codex",haiku:"gpt-5-codex-mini"}},{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",tier:"paid",description:"Paid Codex plans only",presetMapping:{default:"gpt-5.3-codex",opus:"gpt-5.3-codex",sonnet:"gpt-5.3-codex",haiku:"gpt-5-codex-mini"}},{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",tier:"paid",description:"Paid Codex plans only, ultra-fast coding model",presetMapping:{default:"gpt-5.3-codex-spark",opus:"gpt-5.3-codex",sonnet:"gpt-5.3-codex",haiku:"gpt-5-codex-mini"}},{id:"gpt-5.4",name:"GPT-5.4",tier:"paid",description:"Paid Codex plans only, latest GPT-5 family model",presetMapping:{default:"gpt-5.4",opus:"gpt-5.4",sonnet:"gpt-5.4",haiku:"gpt-5-codex-mini"}}]},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-6",models:[{id:"kiro-claude-opus-4-6",name:"Kiro Claude Opus 4.6",description:"Claude Opus 4.6 via Kiro (2.2x credit)",presetMapping:{default:"kiro-claude-opus-4-6",opus:"kiro-claude-opus-4-6",sonnet:"kiro-claude-sonnet-4-6",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4-6",name:"Kiro Claude Sonnet 4.6",description:"Claude Sonnet 4.6 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4-6",opus:"kiro-claude-opus-4-6",sonnet:"kiro-claude-sonnet-4-6",haiku:"kiro-claude-haiku-4-5"}},{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"}]}};function it(t,s){if(!t)return;const a=fe(s),n=is[a.toLowerCase()],i=t.models.find(l=>l.id===a||l.id===n);if(i)return i;const d=Ue(a);if(d)return t.models.map(l=>({model:l,info:Ue(l.id)})).filter(l=>!!(l.info&&l.info.family===d.family)).sort((l,u)=>rs(u.info.version,l.info.version))[0]?.model}function ga(t){if(t==="free")return"free";if(typeof t=="string"&&t.trim().length>0)return"paid"}function fa(t,s){const a=he[t.toLowerCase()];if(!s||s.models.length===0)return a;const n=s.models.map(u=>({id:u.id,owned_by:s.provider})),i=s.models.map(u=>{const r=it(a,u.id);return{...u,name:u.name||r?.name||u.id,tier:r?.tier??ga(u.tier),description:u.description??r?.description,broken:r?.broken,issueUrl:r?.issueUrl,deprecated:r?.deprecated,deprecationReason:r?.deprecationReason,extendedContext:u.extendedContext??r?.extendedContext,presetMapping:r?.presetMapping}}),d=a?.defaultModel?Ne(a.defaultModel,n):void 0,l=typeof d=="string"&&n.some(u=>fe(u.id)===fe(d));return{provider:s.provider,displayName:s.displayName||a?.displayName||t,defaultModel:l?d:s.defaultModel,models:i}}function Nt(t){const s={},a=new Set([...Object.keys(he),...Object.keys(t??{})]);for(const n of a){const i=fa(n,t?.[n]);i&&(s[n]=i)}return s}function os(t,s,a){const n=it(a,s);return n||it(he[t.toLowerCase()],s)}function Ne(t,s=[]){const a=fe(t),n=ha(a,s);if(n)return n;const i=It(s,a);if(i)return i;const d=is[a];return(d?It(s,d):void 0)??a}function va(t,s=[]){return{default:Ne(t.default,s),opus:Ne(t.opus,s),sonnet:Ne(t.sonnet,s),haiku:Ne(t.haiku,s)}}function ls(t,s=[]){if(!t)return[];const a=new Set;return t.models.map(n=>{const i=Ne(n.id,s),d=n.presetMapping?va(n.presetMapping,s):void 0;return{...n,id:i,presetMapping:d}}).filter(n=>a.has(n.id)?!1:(a.add(n.id),!0))}function ja(t,s,a){return os(t,s,a)?.extendedContext===!0}const ze="ccs-internal-managed";async function ba(){try{const t=await fetch("/api/settings/auth/tokens/raw");return t.ok?(await t.json())?.apiKey?.value??ze:ze}catch{return ze}}async function Na(t,s){if(s)return s;try{const a=await fetch("/api/cliproxy/catalog");if(!a.ok)return he[t];const n=await a.json();return Nt(n.catalogs)[t]??he[t]}catch{return he[t]}}async function rt(t,s,a){const n=await Na(t,a);if(!n)return{success:!1};const i=n.models.find(m=>m.id===n.defaultModel)||n.models[0],d=i?.presetMapping||{default:n.defaultModel,opus:n.defaultModel,sonnet:n.defaultModel,haiku:n.defaultModel},l=await ba(),r={env:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${nt}/api/provider/${t}`,ANTHROPIC_AUTH_TOKEN:l,ANTHROPIC_MODEL:d.default,ANTHROPIC_DEFAULT_OPUS_MODEL:d.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:d.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:d.haiku}};try{return{success:(await fetch(`/api/settings/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:r})})).ok,presetName:i?.name||n.defaultModel}}catch{return{success:!1}}}function ya({currentProgress:t,allSteps:s}){return e.jsx("div",{className:"flex justify-center gap-1 pt-2",children:s.map((a,n)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${t>=n?"bg-primary":"bg-muted"}`},a))})}function wa({providers:t,onSelect:s}){return e.jsx("div",{className:"grid gap-2",children:t.map(a=>e.jsxs("button",{onClick:()=>s(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(Jt,{className:"w-4 h-4 text-muted-foreground"})]},a.id))})}function Ca({selectedProvider:t,providers:s,authCommand:a,isRefreshing:n,isPending:i,onBack:d,onStartAuth:l,onRefresh:u}){const[r,m]=c.useState(!1),h=async j=>{await navigator.clipboard.writeText(j),m(!0),setTimeout(()=>m(!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 ",s.find(j=>j.id===t)?.name," to add an account"]}),e.jsx(U,{onClick:l,disabled:i,className:"w-full gap-2",size:"lg",children:i?e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"w-4 h-4 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ge,{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(Ft,{children:e.jsxs(Ut,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ea,{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(U,{variant:"outline",size:"icon",onClick:()=>h(a),children:r?e.jsx(ve,{className:"w-4 h-4 text-green-500"}):e.jsx(Wt,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(U,{variant:"ghost",onClick:d,disabled:i,children:[e.jsx(gt,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(U,{variant:"outline",onClick:u,disabled:n||i,children:[e.jsx(ft,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),n?"Checking...":"Refresh Status"]})]})]})}function ka({accounts:t,privacyMode:s,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 (",t.length,")"]}),e.jsx("div",{className:"grid gap-2 max-h-[320px] overflow-y-auto pr-1",children:t.map(d=>{const l=Kt(d.id,d.email,d.tokenFile);return e.jsxs("button",{type:"button",onClick:()=>a(d),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center",children:e.jsx(Ce,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:$("font-medium",s&&ct),children:l.email}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[l.audienceLabel&&e.jsx(H,{variant:"outline",className:$("text-[10px] h-4 px-1.5 border-transparent",l.audience==="business"?"bg-sky-500/12 text-sky-700 dark:text-sky-300":"bg-emerald-500/12 text-emerald-700 dark:text-emerald-300"),children:l.audienceLabel}),l.detailLabel&&e.jsx(H,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:l.detailLabel}),d.isDefault&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Default account"})]})]})]}),e.jsx(Jt,{className:"w-4 h-4 text-muted-foreground"})]},d.id)})}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or"})})]}),e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 p-3 border-2 border-dashed border-primary/50 rounded-lg hover:border-primary hover:bg-primary/5 transition-colors text-left",onClick:n,children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(ge,{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(U,{variant:"ghost",onClick:i,children:[e.jsx(gt,{className:"w-4 h-4 mr-2"}),"Back"]})})]})}const Lt="__custom__";function Aa({selectedProvider:t,catalog:s,selectedAccount:a,variantName:n,modelName:i,isPending:d,privacyMode:l,onVariantNameChange:u,onModelChange:r,onBack:m,onSkip:h,onCreate:j}){const{t:p}=oe(),g=s||he[t],D=g?.models||[],M=i&&!D.some(b=>b.id===i),[C,T]=c.useState(M),A=t==="agy"&&i.trim().length>0?re(i):!1,v=a?Kt(a.id,a.email,a.tokenFile):null,o=b=>{b===Lt?(T(!0),r("")):(T(!1),r(b))};return e.jsxs("div",{className:"space-y-4",children:[a&&e.jsxs("div",{className:"flex items-start gap-2 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx(Ce,{className:"w-4 h-4"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{children:[p("setupVariant.using")," ",e.jsx("span",{className:$(l&&ct),children:v?.email})]}),(v?.audienceLabel||v?.detailLabel)&&e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[v?.audienceLabel&&e.jsx(H,{variant:"outline",className:$("text-[10px] h-4 px-1.5 border-transparent",v.audience==="business"?"bg-sky-500/12 text-sky-700 dark:text-sky-300":"bg-emerald-500/12 text-emerald-700 dark:text-emerald-300"),children:v.audienceLabel}),v?.detailLabel&&e.jsx(H,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:v.detailLabel})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"variant-name",children:p("setupVariant.variantNameRequired")}),e.jsx(de,{id:"variant-name",value:n,onChange:b=>u(b.target.value),placeholder:p("setupVariant.variantNamePlaceholder")}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[p("setupVariant.invokeHintPrefix")," ccs ",n||"<name>",' "prompt"']})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:p("setupVariant.model")}),C?e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{value:i,onChange:b=>r(b.target.value),placeholder:p("setupVariant.modelPlaceholder")}),A&&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:()=>{T(!1),t==="agy"&&re(i)&&r("")},children:p("setupVariant.choosePresetInstead")})]}):e.jsxs(Je,{value:D.some(b=>b.id===i)?i:"",onValueChange:o,children:[e.jsx(We,{children:e.jsx(Xe,{placeholder:p("setupVariant.selectModel")})}),e.jsxs(Ye,{children:[D.map(b=>e.jsx(we,{value:b.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:b.name}),b.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",b.description]})]})},b.id)),e.jsx(we,{value:Lt,children:e.jsx("span",{className:"text-primary",children:p("setupVariant.customModelName")})})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:C?p("setupVariant.enterAnyModel"):p("setupVariant.defaultModel",{model:g?.defaultModel||p("setupVariant.providerDefault")})})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(U,{variant:"ghost",onClick:m,children:[e.jsx(gt,{className:"w-4 h-4 mr-2"}),p("setupVariant.back")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{variant:"ghost",onClick:h,children:p("setupVariant.skip")}),e.jsx(U,{onClick:j,disabled:!n||d||A,children:p(d?"setupVariant.creating":"setupVariant.createVariant")})]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:p("setupVariant.skipHint")})]})}function Sa({variantName:t,onClose:s}){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(ve,{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(Ft,{children:e.jsxs(Ut,{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 ",t,' "your prompt here"']})]})}),e.jsx(U,{onClick:s,className:"w-full",children:"Done"})]})}function Pa({open:t,onClose:s}){const[a,n]=c.useState("provider"),[i,d]=c.useState(""),[l,u]=c.useState(null),[r,m]=c.useState(""),[h,j]=c.useState(""),[p,g]=c.useState(!1),[D,M]=c.useState(!1),{data:C,refetch:T}=qt(),{data:A}=Ht(),v=us(),o=ms(),b=ps(),{privacyMode:S}=Vt(),f=C?.authStatus.find(R=>R.provider===i),N=c.useMemo(()=>f?.accounts||[],[f?.accounts]),w=c.useMemo(()=>Nt(A?.catalogs),[A?.catalogs]),q=!!A;c.useEffect(()=>{if(!t){const R=setTimeout(()=>{n("provider"),d(""),u(null),m(""),j(""),M(!1)},0);return()=>clearTimeout(R)}},[t]),c.useEffect(()=>{if(a==="auth"&&N.length>0&&!D){const R=setTimeout(()=>{n("account")},0);return()=>clearTimeout(R)}},[a,N,D]);const G=async()=>{g(!0),await T(),g(!1)},P=()=>{const R=(f?.accounts?.length||0)===0;o.mutate({provider:i},{onSuccess:async B=>{if(R){const z=await rt(i,void 0,q?w[i]:void 0);z.success&&z.presetName?V.success(`Applied "${z.presetName}" preset`):z.success||V.warning(Bt.t("commonToast.accountAddedPresetFailed"))}B.account&&(u(B.account),n("variant")),T()}})},E=R=>{d(R),(C?.authStatus.find(X=>X.provider===R)?.accounts||[]).length===0?n("auth"):n("account")},y=R=>{u(R),n("variant")},K=async()=>{if(!(!r||!i))try{await v.mutateAsync({name:r,provider:i,model:h||void 0,account:l?.id}),n("success")}catch(R){console.error("Failed to create variant:",R)}},O=`ccs ${i} --auth --add`,k=hs(a),I=R=>{if(!R&&(o.isPending&&i&&b.mutate(i),a==="success"||a==="provider")){s();return}};return e.jsx(dt,{open:t,onOpenChange:I,children:e.jsxs(ut,{className:"sm:max-w-lg",onPointerDownOutside:R=>{a!=="success"&&a!=="provider"&&R.preventDefault()},onEscapeKeyDown:R=>{(o.isPending||v.isPending)&&R.preventDefault()},children:[e.jsxs(mt,{children:[e.jsxs(pt,{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"w-5 h-5 text-primary"}),"Quick Setup Wizard"]}),e.jsxs(Gt,{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(wa,{providers:yt,onSelect:E}),a==="auth"&&e.jsx(Ca,{selectedProvider:i,providers:yt,authCommand:O,isRefreshing:p,isPending:o.isPending,onBack:()=>n("provider"),onStartAuth:P,onRefresh:G}),a==="account"&&e.jsx(ka,{accounts:N,privacyMode:S,onSelect:y,onAddNew:()=>{M(!0),n("auth")},onBack:()=>n("provider")}),a==="variant"&&e.jsx(Aa,{selectedProvider:i,catalog:w[i],selectedAccount:l,variantName:r,modelName:h,isPending:v.isPending,privacyMode:S,onVariantNameChange:m,onModelChange:j,onBack:()=>N.length>0?n("account"):n("provider"),onSkip:s,onCreate:K}),a==="success"&&e.jsx(Sa,{variantName:r,onClose:s})]}),e.jsx(ya,{currentProgress:k,allSteps:xs})]})})}const Ma=3e3,Da=300*1e3,Ta=3;function $e(t){t.invalidateQueries({queryKey:["cliproxy-catalog"]}),t.invalidateQueries({queryKey:["cliproxy-models"]})}async function Qe(t){const s=await t.text();if(!s)return{};try{return JSON.parse(s)}catch{const a=t.status>=400?`Request failed with status ${t.status}`:void 0;return a?{error:a}:{}}}const ue={provider:null,isAuthenticating:!1,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:!1};function Ia(){const[t,s]=c.useState(ue),a=c.useRef(ue),n=c.useRef(0),i=c.useRef(null),d=c.useRef(null),l=c.useRef(0),u=c.useRef(0),r=c.useRef(!1),m=lt(),h=c.useCallback(C=>C===n.current,[]),j=c.useCallback(()=>{d.current&&(clearInterval(d.current),d.current=null),u.current=0},[]);c.useEffect(()=>()=>{i.current?.abort(),j(),r.current=!1},[j]),c.useEffect(()=>{a.current=t},[t]);const p=c.useCallback(async(C,T,A)=>{if(h(A)){if(Date.now()-l.current>Da){j(),h(A)&&s(v=>({...v,isAuthenticating:!1,error:"Authentication timed out. Please try again."}));return}try{const v=await fetch(`/api/cliproxy/auth/${C}/status?state=${encodeURIComponent(T)}`);if(!h(A))return;const o=await v.json();if(u.current=0,o.status==="ok"){if(!(typeof o.account=="object"&&o.account!==null)){j();const S="Authenticated account could not be registered";V.error(S),s(f=>({...f,isAuthenticating:!1,error:S}));return}j(),m.invalidateQueries({queryKey:["cliproxy-auth"]}),m.invalidateQueries({queryKey:["cliproxy-accounts"]}),m.invalidateQueries({queryKey:["account-quota"]}),$e(m),V.success(`${C} authentication successful`),r.current=!1,s(ue)}else if(o.status==="auth_url"){const b=o.url||o.auth_url;b&&(s(S=>({...S,authUrl:b})),r.current||(r.current=!0,window.open(b,"_blank")))}else if(o.status==="device_code"){j();const b=o.user_code&&o.verification_url?`Open ${o.verification_url} and enter code: ${o.user_code}`:"Switch to Device Code method and try again.";V.error("Provider returned Device Code flow in callback mode"),s(S=>({...S,isAuthenticating:!1,error:b}))}else if(o.status==="error"){j();const b=o.error||"Authentication failed";V.error(b),s(S=>({...S,isAuthenticating:!1,error:b}))}}catch(v){if(!h(A)||(u.current+=1,u.current<Ta))return;j();const o=v instanceof Error&&v.message.trim().length>0?v.message:"Lost contact with the auth status endpoint";V.error(o),s(b=>({...b,isAuthenticating:!1,error:o}))}}},[h,m,j]),g=c.useCallback(async(C,T)=>{if(!Ze(C)){s({...ue,error:`Unknown provider: ${C}`});return}i.current?.abort(),j(),r.current=!1,u.current=0;const A=new AbortController,v=n.current+1;n.current=v,i.current=A;const b=(T?.flowType||(zt(C)?"device_code":"authorization_code"))==="device_code",S=T?.startEndpoint||(b?"start":"start-url"),f={nickname:T?.nickname,kiroMethod:T?.kiroMethod,kiroIDCStartUrl:T?.kiroIDCStartUrl,kiroIDCRegion:T?.kiroIDCRegion,kiroIDCFlow:T?.kiroIDCFlow,riskAcknowledgement:T?.riskAcknowledgement};s({provider:C,isAuthenticating:!0,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:b});try{if(S==="start")fetch(`/api/cliproxy/auth/${C}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f),signal:A.signal}).then(async N=>{if(!h(v))return;const w=await Qe(N);if(!h(v))return;const q=w.success===!0,G=typeof w.account=="object"&&w.account!==null;if(N.ok&&q&&G)m.invalidateQueries({queryKey:["cliproxy-auth"]}),m.invalidateQueries({queryKey:["cliproxy-accounts"]}),m.invalidateQueries({queryKey:["account-quota"]}),$e(m),r.current=!1,s(ue);else{const P=typeof w.error=="string"?w.error:q?"Authenticated account could not be registered":"Authentication failed";V.error(P),s(E=>({...E,isAuthenticating:!1,error:P}))}}).catch(N=>{if(!h(v)||N instanceof Error&&N.name==="AbortError")return;const w=N instanceof Error?N.message:"Authentication failed";V.error(w),s(q=>({...q,isAuthenticating:!1,error:w}))});else{const N=await fetch(`/api/cliproxy/auth/${C}/start-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f),signal:A.signal});if(!h(v))return;const w=await Qe(N);if(!h(v))return;const q=w.success===!0;if(!N.ok||!q){const E=typeof w.error=="string"?w.error:"Failed to start OAuth";throw new Error(E)}const G=typeof w.authUrl=="string"?w.authUrl:null,P=typeof w.state=="string"?w.state:null;if(s(E=>({...E,authUrl:G,oauthState:P})),G&&(r.current=!0,window.open(G,"_blank")),P){if(l.current=Date.now(),!G){if(await p(C,P,v),!h(v))return;const E=a.current;if(!E.isAuthenticating||E.provider!==C)return}d.current=setInterval(()=>{p(C,P,v)},Ma)}}}catch(N){if(!h(v))return;if(N instanceof Error&&N.name==="AbortError"){r.current=!1,s(ue);return}const w=N instanceof Error?N.message:"Authentication failed";V.error(w),s(q=>({...q,isAuthenticating:!1,error:w}))}},[h,p,j,m]),D=c.useCallback(()=>{const C=t.provider;n.current+=1,i.current?.abort(),j(),r.current=!1,s(ue),C&&Ee.cliproxy.auth.cancel(C).catch(()=>{})},[t.provider,j]),M=c.useCallback(async C=>{if(!t.provider)return;const T=n.current,A=t.provider;s(v=>({...v,isSubmittingCallback:!0,error:null}));try{const v=await fetch(`/api/cliproxy/auth/${A}/submit-callback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({redirectUrl:C})});if(!h(T))return;const o=await Qe(v);if(!h(T))return;const b=o.success===!0,S=o.status==="wait",f=typeof o.account=="object"&&o.account!==null;if(v.ok&&S)s(N=>({...N,isSubmittingCallback:!1,error:null}));else if(v.ok&&b&&f)j(),m.invalidateQueries({queryKey:["cliproxy-auth"]}),m.invalidateQueries({queryKey:["cliproxy-accounts"]}),m.invalidateQueries({queryKey:["account-quota"]}),$e(m),V.success(`${A} authentication successful`),s(ue);else{const N=typeof o.error=="string"?o.error:b?"Authenticated account could not be registered":"Callback submission failed";throw new Error(N)}}catch(v){if(!h(T))return;const o=v instanceof Error?v.message:"Failed to submit callback";V.error(o),s(b=>({...b,isSubmittingCallback:!1,error:o}))}},[h,t.provider,m,j]);return c.useMemo(()=>({...t,startAuth:g,cancelAuth:D,submitCallback:M}),[t,g,D,M])}function ot({className:t,compact:s=!1,showAcknowledgement:a=!1,acknowledgementPhrase:n=Oe,acknowledgementText:i="",onAcknowledgementTextChange:d,disabled:l=!1,showProxySettingsLink:u=!1}){const{t:r}=oe(),m=r("accountSafetyWarning.title"),h=r("accountSafetyWarning.subtitle"),j=r("accountSafetyWarning.firstLine"),p=r("accountSafetyWarning.secondLine"),g="https://github.com/kaitranntt/ccs/issues/509",D=r("accountSafetyWarning.issueLabel"),M=r("accountSafetyWarning.proxySettingsLabel");return s?e.jsx("section",{role:"alert",className:$("border-b border-amber-200/70 bg-amber-50/45 dark:bg-amber-950/5",t),children:e.jsxs("div",{className:"flex flex-col gap-3 px-6 py-3 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{className:"min-w-0 flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-6 w-6 items-center justify-center rounded-md bg-amber-500/12 text-amber-700 dark:text-amber-300",children:e.jsx(Fe,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-xs font-semibold leading-5",children:m}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:h})]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:j}),e.jsx("p",{className:"text-xs font-medium leading-5 text-amber-900 dark:text-amber-200",children:p})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 lg:justify-end",children:[e.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md border border-amber-500/25 bg-background/90 px-2 py-1 text-[11px] font-medium text-amber-800 transition-colors hover:bg-amber-500/10 dark:text-amber-200",children:[D,e.jsx(ge,{className:"h-3 w-3"})]}),u?e.jsxs("a",{href:"/settings?tab=proxy",className:"inline-flex items-center gap-1 rounded-md border border-amber-500/25 bg-background/90 px-2 py-1 text-[11px] font-medium text-amber-800 transition-colors hover:bg-amber-500/10 dark:text-amber-200",children:[e.jsx(Dt,{className:"h-3 w-3"}),M]}):null,e.jsx(H,{variant:"outline",className:"border-amber-500/40 text-[10px] text-amber-700 dark:text-amber-300",children:"High Risk"})]})]})}):e.jsxs("section",{role:"alert",className:$("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",t),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(Fe,{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(H,{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:j}),e.jsx("p",{className:"font-medium text-amber-900 dark:text-amber-200",children:p}),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:g,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:[D,e.jsx(ge,{className:"h-3.5 w-3.5"})]}),u&&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(Dt,{className:"h-3.5 w-3.5"}),M]}),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"})]}),a&&d&&e.jsxs("div",{className:"rounded-lg border border-amber-500/25 bg-amber-500/5 p-2.5",children:[e.jsxs(W,{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:n})]}),e.jsx(de,{id:"account-risk-ack-text",value:i,onChange:C=>d(C.target.value),placeholder:n,disabled:l,className:"mt-2 font-mono text-xs"})]})]})]})}function La({className:t,value:s,onChange:a,disabled:n=!1}){const{t:i}=oe(),d=[s.reviewedIssue509,s.understandsBanRisk,s.acceptsFullResponsibility,s.typedPhrase.trim().replace(/\s+/g," ").toUpperCase()===Tt].filter(Boolean).length,l=d/4*100,u=r=>{a({...s,...r})};return e.jsxs("section",{role:"alert",className:$("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",t),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(Fe,{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(H,{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:d})})]}),e.jsx(gs,{value:l,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(_e,{id:"agy-step-reviewed-issue",checked:s.reviewedIssue509,onCheckedChange:r=>u({reviewedIssue509:!!r}),disabled:n}),e.jsx(W,{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(_e,{id:"agy-step-understands-risk",checked:s.understandsBanRisk,onCheckedChange:r=>u({understandsBanRisk:!!r}),disabled:n}),e.jsx(W,{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(_e,{id:"agy-step-accept-responsibility",checked:s.acceptsFullResponsibility,onCheckedChange:r=>u({acceptsFullResponsibility:!!r}),disabled:n}),e.jsx(W,{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(Xt,{className:"h-3.5 w-3.5"}),"Step 4: Type exact phrase to continue"]}),e.jsx(de,{value:s.typedPhrase,onChange:r=>u({typedPhrase:r.target.value}),placeholder:Tt,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(ge,{className:"h-3.5 w-3.5"})]})})]})]})}function Ra(t){return t.trim().replace(/\s+/g," ").toUpperCase()}function Ea({open:t,onClose:s,provider:a,displayName:n,catalog:i,isFirstAccount:d=!1}){const[l,u]=c.useState(""),[r,m]=c.useState(""),[h,j]=c.useState(!1),[p,g]=c.useState(null),[D,M]=c.useState(""),[C,T]=c.useState(Be),[A,v]=c.useState(!1),[o,b]=c.useState(!1),[S,f]=c.useState(wt),[N,w]=c.useState(""),[q,G]=c.useState(""),[P,E]=c.useState(Ct),{t:y}=oe(),K=c.useRef(!1),O=c.useRef(0),k=c.useRef(!1),I=Ia(),R=fs(),B=a==="kiro",z=a==="agy"||a==="gemini",X=a==="gemini"&&!A,Y=a==="agy"&&!A,ee=z&&o,le=la(C),Z=Ra(D)===Oe,te=zt(a),x=vs(S),F=B&&S==="idc",ae=B&&bs(S),Se=B?js(S,P):void 0,Ke=B?ys(S):void 0,qe=B?Se==="device_code":te,ne=I.isAuthenticating||R.isPending,Pe=l.trim(),Me=N.trim(),ye=q.trim(),De=p||I.error,Te=c.useCallback(async()=>{const L=await fetch("/api/settings/auth/antigravity-risk");if(!L.ok)throw new Error("Failed to load power user mode setting");return(await L.json()).antigravityAckBypass===!0},[]),je=c.useCallback(async({pendingMessage:L=null,disabledMessage:ce=null}={})=>{const Ge=++O.current;b(!0),L!==null&&g(L);try{const Le=await Te();return O.current!==Ge||(v(Le),ce?g(Le?null:ce):L!==null&&g(null)),Le}catch{return O.current!==Ge||(v(!1),g(ce??y("addAccountDialog.powerUserLoadFailed")),k.current||(k.current=!0,V.error(y("addAccountDialog.powerUserLoadFailed")))),!1}finally{O.current===Ge&&b(!1)}},[Te,y]),be=()=>{u(""),m(""),j(!1),g(null),M(""),T(Be),v(!1),b(!1),f(wt),w(""),G(""),E(Ct),O.current+=1,k.current=!1,K.current=!1,s()};c.useEffect(()=>{t&&(M(""),T(Be),g(null))},[a,t]),c.useEffect(()=>()=>{O.current+=1},[]),c.useEffect(()=>{if(!t||!z){O.current+=1,v(!1),b(!1);return}je()},[t,a,z,je]),c.useEffect(()=>{if(!t||a!=="agy"||!I.error||!A)return;const L=I.error.toLowerCase();(L.includes("agy_risk_ack_required")||L.includes("responsibility acknowledgement")||L.includes("responsibility checklist"))&&je({pendingMessage:y("addAccountDialog.powerUserLoading"),disabledMessage:y("addAccountDialog.powerUserUnavailableRetry")})},[I.error,t,A,a,je,y]),c.useEffect(()=>{!I.isAuthenticating&&!I.error&&I.provider===null&&t&&K.current&&(K.current=!1,(async()=>{try{const ce=await rt(a,void 0,i);ce.success&&ce.presetName&&d&&V.success(`Applied "${ce.presetName}" preset`)}catch{}be()})())},[I.isAuthenticating,I.error,I.provider]);const Ie=()=>{I.cancelAuth(),be()},He=async()=>{I.authUrl&&(await navigator.clipboard.writeText(I.authUrl),j(!0),setTimeout(()=>j(!1),2e3))},Ve=()=>{r.trim()&&I.submitCallback(r.trim())},_=()=>{if(ee){g(y("addAccountDialog.powerUserLoading"));return}if(Y&&!le){g("Complete all Antigravity responsibility steps before authenticating this provider.");return}if(X&&!Z){g(`Type "${Oe}" to acknowledge the account safety warning before authenticating this provider.`);return}if(g(null),F&&!Me){g("IDC Start URL is required for Kiro IAM Identity Center login.");return}K.current=!0,I.startAuth(a,{nickname:Pe||void 0,kiroMethod:B?S:void 0,kiroIDCStartUrl:F?Me:void 0,kiroIDCRegion:F&&ye?ye:void 0,kiroIDCFlow:F?P:void 0,flowType:B?Se:void 0,startEndpoint:B?Ke:void 0,riskAcknowledgement:Y?{version:ca,reviewedIssue509:C.reviewedIssue509,understandsBanRisk:C.understandsBanRisk,acceptsFullResponsibility:C.acceptsFullResponsibility,typedPhrase:C.typedPhrase}:void 0})},Q=()=>{K.current=!0,R.mutate(void 0,{onSuccess:async()=>{const L=await rt("kiro",void 0,i);L.success&&L.presetName&&d&&V.success(`Applied "${L.presetName}" preset`),be()}})},ie=L=>{L||Ie()},J=I.isAuthenticating;return e.jsx(dt,{open:t,onOpenChange:ie,children:e.jsxs(ut,{className:"sm:max-w-md",onInteractOutside:L=>{J&&L.preventDefault()},children:[e.jsxs(mt,{children:[e.jsx(pt,{children:y("addAccountDialog.title",{displayName:n})}),e.jsx(Gt,{children:y(B?"addAccountDialog.descKiro":qe?"addAccountDialog.descDeviceCode":"addAccountDialog.descOauth")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[Y&&!J&&e.jsx(La,{value:C,onChange:L=>{T(L),g(null)},disabled:ne}),z&&A&&!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(Xt,{className:"h-3.5 w-3.5"}),y("addAccountDialog.powerUserEnabled")]}),y("addAccountDialog.powerUserSkipped")]}),X&&!J&&e.jsx(ot,{showAcknowledgement:!0,acknowledgementPhrase:Oe,acknowledgementText:D,onAcknowledgementTextChange:L=>{M(L),g(null)},disabled:ne}),B&&!J&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"kiro-auth-method",children:y("addAccountDialog.authMethod")}),e.jsxs(Je,{value:S,onValueChange:L=>{f(L),g(null)},children:[e.jsx(We,{id:"kiro-auth-method",children:e.jsx(Xe,{placeholder:y("addAccountDialog.selectKiroAuthMethod")})}),e.jsx(Ye,{children:Ns.map(L=>e.jsx(we,{value:L.id,children:L.label},L.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:x.description}),ae&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["If your browser does not return automatically after login, CCS can accept the final",e.jsx("span",{className:"mx-1 rounded bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"kiro://..."}),"callback URL in the next step."]})]}),F&&!J&&e.jsxs("div",{className:"space-y-4 rounded-lg border border-border/60 bg-muted/20 p-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"kiro-idc-start-url",children:"IDC Start URL"}),e.jsx(de,{id:"kiro-idc-start-url",value:N,onChange:L=>{w(L.target.value),g(null)},placeholder:"https://d-xxx.awsapps.com/start",disabled:ne}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Required for organization IAM Identity Center login."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"kiro-idc-region",children:"IDC Region"}),e.jsx(de,{id:"kiro-idc-region",value:q,onChange:L=>{G(L.target.value),g(null)},placeholder:"us-east-1",disabled:ne}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Leave blank to use the upstream default region."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"kiro-idc-flow",children:"IDC Flow"}),e.jsxs(Je,{value:P,onValueChange:L=>{E(L),g(null)},children:[e.jsx(We,{id:"kiro-idc-flow",children:e.jsx(Xe,{placeholder:"Select IDC flow"})}),e.jsxs(Ye,{children:[e.jsx(we,{value:"authcode",children:"Authorization Code"}),e.jsx(we,{value:"device",children:"Device Code"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Auth Code opens a browser and may need the final callback URL pasted back. Device Code shows a verification code instead."})]})]}),!J&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"nickname",children:y("addAccountDialog.nicknameOptional")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(de,{id:"nickname",value:l,onChange:L=>{u(L.target.value),g(null)},placeholder:y("addAccountDialog.nicknamePlaceholder"),disabled:ne,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:y("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(se,{className:"w-4 h-4 inline mr-2 animate-spin"}),y("addAccountDialog.waitingForAuth")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:I.isDeviceCodeFlow?y("addAccountDialog.deviceCodeHint"):ae?"Complete sign-in in your browser. If it does not return automatically, paste the final kiro:// callback URL below.":y("addAccountDialog.browserHint")})]}),I.authUrl&&!I.isDeviceCodeFlow&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{className:"text-xs",children:y("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:I.authUrl}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(U,{variant:"outline",size:"sm",onClick:He,children:h?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"w-3 h-3 mr-1"}),y("addAccountDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(Wt,{className:"w-3 h-3 mr-1"}),y("addAccountDialog.copy")]})}),e.jsxs(U,{variant:"outline",size:"sm",onClick:()=>{if(!I.authUrl)return;const L=window.open(I.authUrl,"_blank");(!L||L.closed||typeof L.closed>"u")&&V.warning(y("addAccountDialog.popupBlocked"),{duration:5e3})},children:[e.jsx(ge,{className:"w-3 h-3 mr-1"}),y("addAccountDialog.open")]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"callback-url",className:"text-xs",children:ae?"Browser did not return? Paste the final kiro:// callback URL:":y("addAccountDialog.redirectPasteLabel")}),e.jsx(de,{id:"callback-url",value:r,onChange:L=>m(L.target.value),placeholder:ae?"kiro://kiro.kiroAgent/authenticate-success?code=...&state=...":y("addAccountDialog.callbackPlaceholder"),className:"font-mono text-xs"}),e.jsx(U,{variant:"secondary",size:"sm",onClick:Ve,disabled:!r.trim()||I.isSubmittingCallback,children:I.isSubmittingCallback?e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"w-3 h-3 mr-1 animate-spin"}),y("addAccountDialog.submitting")]}):y("addAccountDialog.submitCallback")})]})]}),!I.authUrl&&!I.isDeviceCodeFlow&&e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:ae?"Preparing the Kiro sign-in URL. If it does not open automatically, it will appear here shortly.":y("addAccountDialog.preparingUrl")})]}),De&&e.jsx("p",{className:"text-xs text-center text-destructive",children:De}),R.isPending&&e.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:[e.jsx(se,{className:"w-4 h-4 inline mr-2 animate-spin"}),y("addAccountDialog.importingToken")]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(U,{variant:"ghost",onClick:Ie,children:y("addAccountDialog.cancel")}),B&&!J&&e.jsx(U,{variant:"outline",onClick:Q,disabled:ne,children:R.isPending?e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"w-4 h-4 mr-2 animate-spin"}),y("addAccountDialog.importing")]}):e.jsxs(e.Fragment,{children:[e.jsx(ta,{className:"w-4 h-4 mr-2"}),y("addAccountDialog.importFromIde")]})}),!J&&e.jsxs(U,{onClick:_,disabled:ne||ee||Y&&!le||X&&!Z,children:[e.jsx(ge,{className:"w-4 h-4 mr-2"}),y("addAccountDialog.authenticate")]})]})]})]})})}const Oa=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function _a(t){const s=t?.env||{};return Oa.filter(a=>!s[a]?.trim())}function Fa(t,s){const[a,n]=c.useState(null),[i,d]=c.useState(!1),l=lt(),{data:u,isLoading:r,refetch:m}=_t({queryKey:["settings",t],queryFn:async()=>{const P=await fetch(`/api/settings/${t}/raw`);return P.ok?P.json():{profile:t,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${t}/settings.json`}}}),h=u?.settings,j=c.useMemo(()=>a!==null?a:h?JSON.stringify(h,null,2):`{
|
|
2
|
-
"env": {}
|
|
3
|
-
}`,[a,h]),p=c.useCallback(P=>{n(P)},[]),g=c.useMemo(()=>{try{return JSON.parse(j)}catch{return h||{env:{}}}},[j,h]),D=g?.env?.ANTHROPIC_MODEL,M=g?.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,C=g?.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,T=g?.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,A=c.useMemo(()=>ws(g?.env||{}),[g]),v=c.useCallback((P,E)=>Cs(P,E,{supportsExtendedContext:y=>ja(t,y,s)}),[s,t]),o=c.useCallback((P,E)=>{const y={...g?.env||{},[P]:E},K=kt(P)?v(y,A):y;delete K.CCS_EXTENDED_CONTEXT;const O={...g,env:K};n(JSON.stringify(O,null,2))},[v,g,A]),b=c.useCallback(P=>{const E=g?.env||{},y=v(E,P);delete y.CCS_EXTENDED_CONTEXT;const K={...g,env:y};n(JSON.stringify(K,null,2))},[v,g]),S=c.useCallback(P=>{const E={...g?.env||{},...P},K=Object.keys(P).some(kt)?v(E,A):E;delete K.CCS_EXTENDED_CONTEXT;const O={...g,env:K};n(JSON.stringify(O,null,2))},[v,g,A]),f=c.useMemo(()=>{try{return JSON.parse(j),!0}catch{return!1}},[j]),N=c.useMemo(()=>a===null?!1:a!==JSON.stringify(h,null,2),[a,h]),w=c.useMemo(()=>_a(g),[g]),q=cs({mutationFn:async()=>{const P=JSON.parse(j),E=await fetch(`/api/settings/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:P,expectedMtime:u?.mtime})});if(E.status===409)throw new Error("CONFLICT");if(!E.ok)throw new Error("Failed to save");return E.json()},onSuccess:P=>{l.invalidateQueries({queryKey:["settings",t]}),n(null),P?.warning?V.success("Settings saved",{description:P.warning}):V.success("Settings saved")},onError:P=>{P.message==="CONFLICT"?d(!0):V.error(P.message)}}),G=async P=>{d(!1),P?(await m(),q.mutate()):n(null)};return{data:u,isLoading:r,refetch:m,rawJsonContent:j,rawJsonEdits:a,isRawJsonValid:f,hasChanges:N,currentSettings:g,currentModel:D,opusModel:M,sonnetModel:C,haikuModel:T,extendedContextEnabled:A,toggleExtendedContext:b,handleRawJsonChange:p,updateEnvValue:o,updateEnvValues:S,saveMutation:{mutate:()=>q.mutate(),isPending:q.isPending},conflictDialog:i,setConflictDialog:d,handleConflictResolve:G,missingRequiredFields:w}}const Ua=/-(medium|high|xhigh)$/i;function Ka(t){if(!t)return;const s=t.trim().match(Ua);if(s?.[1])return s[1].toLowerCase()}function qa(t){if(!t)return null;const s=Ka(t);return s?{label:`Pinned ${s}`,explicit:!0}:{label:"Auto effort",explicit:!1}}function Ha({label:t}){return e.jsx(H,{variant:"outline",className:"text-[9px] h-4 px-1",children:t})}function Re({modelId:t}){const s=qa(t);return s?e.jsx(H,{variant:s.explicit?"secondary":"outline",className:"text-[9px] h-4 px-1 uppercase",children:s.label}):null}function Rt(t,s){if(!t)return"";if(!s?.prefix)return t;const a=`${s.prefix}/`;return t.startsWith(a)?t.slice(a.length):t}function me(t,s){return s?.recommendedModelId??t}function xe({label:t,description:s,value:a,onChange:n,catalog:i,allModels:d,routing:l,disabled:u}){const{t:r}=oe(),m=i?.provider==="codex",h=c.useMemo(()=>ls(i,d),[d,i]),j=new Set(h.map(o=>o.id)),p=c.useMemo(()=>new Map((l?.models??[]).map(o=>[o.modelId.toLowerCase(),o])),[l]),g=c.useMemo(()=>new Set(h.map(o=>me(o.id,p.get(o.id.toLowerCase())))),[h,p]),D=c.useMemo(()=>p.get(Rt(a,l).toLowerCase()),[l,p,a]),M=h.map(o=>({value:me(o.id,p.get(o.id.toLowerCase())),groupKey:"recommended",searchText:`${o.id} ${o.name} ${p.get(o.id.toLowerCase())?.recommendedModelId??""}`,keywords:[o.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:me(o.id,p.get(o.id.toLowerCase()))}),p.get(o.id.toLowerCase())?.pinnedAvailable?e.jsx(H,{variant:"secondary",className:"text-[9px] h-4 px-1 uppercase",children:p.get(o.id.toLowerCase())?.prefix}):null,m&&e.jsx(Re,{modelId:o.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:me(o.id,p.get(o.id.toLowerCase()))}),o.tier==="paid"&&e.jsx(Ha,{label:r("providerModelSelector.paid")}),p.get(o.id.toLowerCase())?.unprefixedStatus==="shadowed"?e.jsx(H,{variant:"outline",className:"text-[9px] h-4 px-1",children:"Shadowed"}):null,p.get(o.id.toLowerCase())?.unprefixedStatus==="prefix-only"?e.jsx(H,{variant:"outline",className:"text-[9px] h-4 px-1",children:"Prefix only"}):null,m&&e.jsx(Re,{modelId:o.id})]})})),C=d.filter(o=>!j.has(o.id)).filter(o=>!g.has(me(o.id,p.get(o.id.toLowerCase())))).map(o=>({value:me(o.id,p.get(o.id.toLowerCase())),groupKey:"all",searchText:`${o.id} ${p.get(o.id.toLowerCase())?.recommendedModelId??""}`,keywords:[o.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:me(o.id,p.get(o.id.toLowerCase()))}),p.get(o.id.toLowerCase())?.pinnedAvailable?e.jsx(H,{variant:"secondary",className:"text-[9px] h-4 px-1 uppercase",children:p.get(o.id.toLowerCase())?.prefix}):null,m&&e.jsx(Re,{modelId:o.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:me(o.id,p.get(o.id.toLowerCase()))}),p.get(o.id.toLowerCase())?.unprefixedStatus==="shadowed"?e.jsx(H,{variant:"outline",className:"text-[9px] h-4 px-1",children:"Shadowed"}):null,p.get(o.id.toLowerCase())?.unprefixedStatus==="prefix-only"?e.jsx(H,{variant:"outline",className:"text-[9px] h-4 px-1",children:"Prefix only"}):null,m&&e.jsx(Re,{modelId:o.id})]})})),T=!!a&&!M.some(o=>o.value===a)&&!C.some(o=>o.value===a),A=a?{value:a,groupKey:"current",searchText:a,triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:a}),e.jsx(H,{variant:"outline",className:"text-[9px] h-4 px-1",children:"Current"})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:a}),e.jsx(H,{variant:"outline",className:"text-[9px] h-4 px-1",children:"Current"})]})}:null,v=M.length+C.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:t}),s&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s})]}),e.jsx(ua,{value:a||void 0,onChange:n,disabled:u,placeholder:r("providerModelSelector.selectModel"),searchPlaceholder:r("searchableSelect.searchModels"),emptyText:r(v?"searchableSelect.noResults":"providerModelSelector.noModelsAvailable"),triggerClassName:"h-9",groups:[...T&&A?[{key:"current",label:e.jsx("span",{className:"text-xs text-muted-foreground",children:"Current value"})}]:[],{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:d.length})})}],options:[...T&&A?[A]:[],...M,...C]}),D?e.jsxs("div",{className:$("rounded-md border px-2.5 py-2 text-[11px]",D.unprefixedStatus==="safe"?"border-border/70 bg-muted/25 text-muted-foreground":"border-amber-300/60 bg-amber-50 text-amber-900 dark:border-amber-500/30 dark:bg-amber-950/25 dark:text-amber-100"),children:[e.jsxs("div",{className:"font-medium",children:[D.pinnedAvailable?"Preferred pinned model:":"Pinned route status:"," ",e.jsx("code",{children:D.pinnedAvailable?D.recommendedModelId:D.pinnedModelId})]}),e.jsx("p",{className:"mt-1 leading-5",children:D.summary})]}):null,a&&!D&&Rt(a,l)!==a?e.jsxs("div",{className:"rounded-md border border-amber-300/60 bg-amber-50 px-2.5 py-2 text-[11px] text-amber-900 dark:border-amber-500/30 dark:bg-amber-950/25 dark:text-amber-100",children:["Pinned model is not currently advertised by the proxy: ",e.jsx("code",{children:a})]}):null]})}function Et(t,s){const a=n=>s?.models.find(d=>d.modelId.toLowerCase()===n.toLowerCase())?.recommendedModelId??n;return{default:a(t.default),opus:a(t.opus),sonnet:a(t.sonnet),haiku:a(t.haiku)}}function Va({open:t,onClose:s,currentValues:a,onApply:n,onSave:i,isSaving:d,catalog:l,allModels:u,routing:r}){const{t:m}=oe(),[h,j]=c.useState(Et(a,r)),[p,g]=c.useState(""),D=M=>{M?(j(Et(a,r)),g("")):s()};return e.jsx(dt,{open:t,onOpenChange:D,children:e.jsxs(ut,{className:"sm:max-w-md",children:[e.jsx(mt,{children:e.jsxs(pt,{className:"flex items-center gap-2",children:[e.jsx(ke,{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(W,{htmlFor:"preset-name",children:m("customPresetDialog.presetNameOptional")}),e.jsx(de,{id:"preset-name",value:p,onChange:M=>g(M.target.value),placeholder:m("customPresetDialog.presetNamePlaceholder"),className:"text-sm"})]}),e.jsx(bt,{}),l?.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(xe,{label:m("customPresetDialog.defaultModel"),description:m("customPresetDialog.defaultModelDesc"),value:h.default,onChange:M=>j({...h,default:M}),catalog:l,allModels:u,routing:r}),e.jsx(xe,{label:m("customPresetDialog.opusModel"),description:m("customPresetDialog.opusModelDesc"),value:h.opus,onChange:M=>j({...h,opus:M}),catalog:l,allModels:u,routing:r}),e.jsx(xe,{label:m("customPresetDialog.sonnetModel"),description:m("customPresetDialog.sonnetModelDesc"),value:h.sonnet,onChange:M=>j({...h,sonnet:M}),catalog:l,allModels:u,routing:r}),e.jsx(xe,{label:m("customPresetDialog.haikuModel"),description:m("customPresetDialog.haikuModelDesc"),value:h.haiku,onChange:M=>j({...h,haiku:M}),catalog:l,allModels:u,routing:r})]}),e.jsxs(ks,{className:"gap-2 sm:gap-0",children:[e.jsx(U,{variant:"outline",onClick:s,children:m("customPresetDialog.cancel")}),i&&e.jsxs(U,{variant:"secondary",onClick:()=>i(h,p||void 0),disabled:d||!p.trim(),children:[d?e.jsx(se,{className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(vt,{className:"w-4 h-4 mr-1"}),m("customPresetDialog.savePreset")]}),e.jsxs(U,{onClick:()=>n(h,p||void 0),children:[e.jsx(Ae,{className:"w-4 h-4 mr-1"}),m("customPresetDialog.applyPreset")]})]})]})})}function pe({label:t,command:s}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:t}),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:s}),e.jsx($t,{value:s,size:"icon",className:"h-6 w-6"})]})]})}function Ga({provider:t,displayName:s,defaultTarget:a,data:n,authStatus:i,supportsModelConfig:d=!1}){const l=a||"claude",u=l==="droid",r=t==="codex",m=l==="claude"?`ccs ${t}`:`ccs ${t} --target claude`,h=`${m} --config`,j=`${m} --auth --add`,p=`${m} --accounts`;return e.jsx(xt,{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(Yt,{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:s})]}),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($t,{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(H,{variant:"outline",className:"w-fit text-green-600 border-green-200 bg-green-50",children:[e.jsx(sa,{className:"w-3 h-3 mr-1"}),"Authenticated"]}):e.jsx(H,{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:l})]})]})]}),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(pe,{label:"Run with prompt",command:`ccs ${t} "your prompt"`}),r&&e.jsxs(e.Fragment,{children:[e.jsx(pe,{label:"Run on native Codex (shortcut)",command:'ccsxp "your prompt"'}),e.jsx(pe,{label:"Run on native Codex (--target)",command:`ccs ${t} --target codex "your prompt"`})]}),e.jsx(pe,{label:u?"Droid alias (explicit)":"Run on Droid",command:`ccs-droid ${t} "your prompt"`}),e.jsx(pe,{label:u?"Override to Claude":"Run on Droid (--target)",command:`ccs ${t} --target ${u?"claude":"droid"} "your prompt"`}),d&&e.jsx(pe,{label:l==="claude"?"Change model":"Change model (Claude target)",command:h}),e.jsx(pe,{label:l==="claude"?"Add account":"Add account (Claude target)",command:j}),e.jsx(pe,{label:l==="claude"?"List accounts":"List accounts (Claude target)",command:p}),l!=="claude"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Account and model-management flags stay on Claude target. Codex and Droid runtime launches reject those CLIProxy management commands."})]})]})]})})}function Ba({displayName:t,logoProvider:s,provider:a,data:n,isLoading:i,hasChanges:d,isRawJsonValid:l,isSaving:u,isRemoteMode:r,port:m,onRefetch:h,onSave:j}){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(ht,{provider:s||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:t}),r&&e.jsxs(H,{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(Zt,{className:"w-3 h-3"}),"Remote"]}),m&&e.jsxs(H,{variant:"outline",className:"text-xs gap-1 font-mono",children:[e.jsx(aa,{className:"w-3 h-3"}),":",m]}),!r&&n?.path&&e.jsx(H,{variant:"outline",className:"text-xs",children:n.path.replace(/^.*[\\/]/,"")})]}),r?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(U,{variant:"ghost",size:"sm",onClick:h,disabled:i,children:e.jsx(ft,{className:`w-4 h-4 ${i?"animate-spin":""}`})}),e.jsx(U,{size:"sm",onClick:j,disabled:u||!d||!l,children:u?e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(na,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function za({models:t,provider:s,enabled:a,onToggle:n,disabled:i,className:d}){if(t.length===0)return null;const l=t.some(m=>At(m.id)),u=t.some(m=>!At(m.id));let r="Compatible mappings stay on standard context unless you turn this on.";return l&&u?r="Gemini-compatible mappings can use 1M automatically. Claude mappings stay plain unless you turn this on.":l&&(r="Gemini-compatible mappings can use 1M by default. Turn this off to keep standard context."),e.jsxs("div",{className:$("rounded-lg border p-3 space-y-2",a?"border-primary/50 bg-primary/5":"border-border bg-muted/30",d),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:$("w-4 h-4",a?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:"text-sm font-medium",children:"Extended Context"}),e.jsx(H,{variant:a?"default":"secondary",className:"text-[10px] h-5 px-1.5",children:"1M tokens"})]}),e.jsx(Qt,{checked:a,onCheckedChange:n,disabled:i})]}),e.jsxs("div",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[e.jsx(Yt,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{children:["Applies the explicit ",e.jsx("code",{children:"[1m]"})," long-context suffix to compatible saved mappings."]}),e.jsx("p",{className:"text-[10px]",children:r}),e.jsxs("p",{className:"text-amber-600 dark:text-amber-500",children:["CCS only saves ",e.jsx("code",{children:"[1m]"}),". Provider pricing and entitlement are separate, and some accounts can still return 429 extra-usage errors for long-context requests."]})]})]})]})}function $a(t,s){const a=t.presetMapping||{default:t.id,opus:t.id,sonnet:t.id,haiku:t.id};return{ANTHROPIC_MODEL:s(a.default),ANTHROPIC_DEFAULT_OPUS_MODEL:s(a.opus),ANTHROPIC_DEFAULT_SONNET_MODEL:s(a.sonnet),ANTHROPIC_DEFAULT_HAIKU_MODEL:s(a.haiku)}}function Qa({catalog:t,savedPresets:s,currentModel:a,opusModel:n,sonnetModel:i,haikuModel:d,providerModels:l,routing:u,provider:r,extendedContextEnabled:m,onExtendedContextToggle:h,onApplyPreset:j,onUpdateEnvValue:p,onOpenCustomPreset:g,onDeletePreset:D,isDeletePending:M}){const C=(u?.models??[]).some(f=>f.pinnedAvailable),T=c.useMemo(()=>new Map((u?.models??[]).map(f=>[f.modelId.toLowerCase(),f])),[u]),A=f=>T.get(f.toLowerCase())?.recommendedModelId??f,v=c.useMemo(()=>{if(!t)return[];const f=[a,n,i,d].filter(w=>!!w).map(w=>As(w));return[...new Set(f)].map(w=>os(t.provider,w,t)).filter(w=>!!w?.extendedContext)},[t,a,n,i,d]),o=c.useMemo(()=>ls(t,l),[t,l]),b=c.useMemo(()=>{const f=o.filter(w=>w.presetMapping);return f.length===0?[]:f.some(w=>w.tier==="paid")?[{key:"free",label:"Free Tier",description:"Available on free or paid plans",badgeClassName:"text-[10px] bg-green-100 text-green-700 border-green-200",iconClassName:"text-green-600",models:f.filter(w=>w.tier!=="paid")},{key:"paid",label:"Paid Tier",description:"Requires paid access",badgeClassName:"text-[10px] bg-amber-100 text-amber-700 border-amber-200",iconClassName:"text-amber-700",models:f.filter(w=>w.tier==="paid")}].filter(w=>w.models.length>0):[{key:"default",models:f.slice(0,4)}]},[o]),S=b.length>0||s.length>0;return e.jsxs(e.Fragment,{children:[S&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(ke,{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:"space-y-4",children:[b.map(f=>e.jsxs("div",{children:["label"in f&&f.label&&e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(H,{variant:"outline",className:f.badgeClassName,children:f.label}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:f.description})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:f.models.map(N=>e.jsxs(U,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>j($a(N,A)),children:[e.jsx(Ae,{className:`w-3 h-3 ${"iconClassName"in f?f.iconClassName:""}`}),N.name]},N.id))})]},f.key)),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.map(f=>e.jsxs("div",{className:"group relative",children:[e.jsxs(U,{variant:"secondary",size:"sm",className:"text-xs h-7 gap-1 pr-6",onClick:()=>{j({ANTHROPIC_MODEL:A(f.default),ANTHROPIC_DEFAULT_OPUS_MODEL:A(f.opus),ANTHROPIC_DEFAULT_SONNET_MODEL:A(f.sonnet),ANTHROPIC_DEFAULT_HAIKU_MODEL:A(f.haiku)})},children:[e.jsx(vt,{className:"w-3 h-3 fill-current"}),f.name]}),e.jsx(U,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-7 w-5 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:N=>{N.stopPropagation(),D(f.name)},disabled:M,children:e.jsx(jt,{className:"w-3 h-3"})})]},f.name)),e.jsxs(U,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1 border-primary/50 text-primary hover:bg-primary/10 hover:border-primary",onClick:g,children:[e.jsx(es,{className:"w-3 h-3"}),"Custom"]})]})]})]}),e.jsx(bt,{}),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"}),u?e.jsx("p",{className:"text-[11px] text-muted-foreground mb-3 rounded-md border bg-muted/30 px-2.5 py-2",children:C?e.jsxs(e.Fragment,{children:["Preferred pinned model names use the ",e.jsxs("code",{children:[u.prefix,"/"]})," prefix. Unprefixed names can still resolve to a different backend when providers overlap."]}):e.jsxs(e.Fragment,{children:["Managed pinning for ",e.jsxs("code",{children:[u.prefix,"/"]})," is not currently advertised by the proxy. Unprefixed names may still be ambiguous until prefix repair completes."]})}):null,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(xe,{label:"Default Model",description:"Used when no specific tier is requested",value:a,onChange:f=>p("ANTHROPIC_MODEL",f),catalog:t,allModels:l,routing:u}),v.length>0&&h&&e.jsx(za,{models:v,provider:r,enabled:m??!1,onToggle:h}),e.jsx(xe,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:n,onChange:f=>p("ANTHROPIC_DEFAULT_OPUS_MODEL",f),catalog:t,allModels:l,routing:u}),e.jsx(xe,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:i,onChange:f=>p("ANTHROPIC_DEFAULT_SONNET_MODEL",f),catalog:t,allModels:l,routing:u}),e.jsx(xe,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:d,onChange:f=>p("ANTHROPIC_DEFAULT_HAIKU_MODEL",f),catalog:t,allModels:l,routing:u})]})]})]})}function Ja(t,s){return t?e.jsx(et,{children:e.jsxs(tt,{children:[e.jsx(st,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(ra,{className:"w-3 h-3","aria-hidden":"true"}),e.jsx("span",{className:$("font-mono max-w-[180px] truncate",s&&ct),title:t,children:t})]})}),e.jsx(at,{side:"bottom",children:e.jsx("p",{className:"text-xs",children:"GCP Project ID (read-only)"})})]})}):e.jsx(et,{children:e.jsxs(tt,{children:[e.jsx(st,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-500",children:[e.jsx(Fe,{className:"w-3 h-3","aria-label":"Warning"}),e.jsx("span",{children:"Project ID: N/A"})]})}),e.jsx(at,{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."})]})})]})})}function Wa({account:t,onSetDefault:s,onRemove:a,onPauseToggle:n,isRemoving:i,isPausingAccount:d,privacyMode:l,showQuota:u,selectable:r,selected:m,onSelectChange:h}){const j=t.provider.toLowerCase(),{data:p}=Ss(u),{data:g,isLoading:D}=Ps(j,t.id,u),M=Ms(p,t)?.lastUsedAt,C=r||n?e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r&&e.jsx("button",{type:"button",onClick:()=>h?.(!m),className:$("flex items-center justify-center w-5 h-5 rounded border-2 transition-colors shrink-0",m?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30 hover:border-primary/50"),"aria-label":m?"Deselect account":"Select account",children:m&&e.jsx(ve,{className:"w-3 h-3"})}),n&&e.jsx(et,{children:e.jsxs(tt,{children:[e.jsx(st,{asChild:!0,children:e.jsx(U,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>n(!t.paused),disabled:d,children:d?e.jsx(se,{className:"w-4 h-4 animate-spin"}):t.paused?e.jsx(ts,{className:"w-4 h-4 text-emerald-500"}):e.jsx(ss,{className:"w-4 h-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(at,{side:"top",children:t.paused?"Resume account":"Pause account"})]})})]}):void 0,T=e.jsxs(Ds,{children:[e.jsx(Ts,{asChild:!0,children:e.jsx(U,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",children:e.jsx(ia,{className:"w-4 h-4"})})}),e.jsxs(Is,{align:"end",children:[!t.isDefault&&e.jsxs(St,{onClick:s,children:[e.jsx(vt,{className:"w-4 h-4 mr-2"}),"Set as default"]}),e.jsxs(St,{className:"text-destructive focus:text-destructive",onClick:a,disabled:i,children:[e.jsx(as,{className:"w-4 h-4 mr-2"}),i?"Removing...":"Remove account"]})]})]});return e.jsx("div",{className:$("rounded-lg border p-3 transition-colors overflow-hidden",t.isDefault?"border-primary/30 bg-primary/5":"border-border hover:bg-muted/30",t.paused&&"opacity-75",m&&"ring-2 ring-primary/50 bg-primary/5"),children:e.jsx(Ls,{mode:"detailed",provider:t.provider,accountId:t.id,email:t.email,displayEmail:t.email||t.id,tokenFile:t.tokenFile,tier:t.tier,isDefault:t.isDefault,paused:t.paused,privacyMode:l,showQuota:u,quota:g,quotaLoading:D,runtimeLastUsed:M,beforeIdentity:C,headerEnd:T,bodySlot:t.provider==="agy"?Ja(t.projectId,l):null,quotaInsetClassName:"pl-11"})})}function Xa({selectedCount:t,onPauseSelected:s,onResumeSelected:a,onClearSelection:n,isPausing:i,isResuming:d}){if(t<1)return null;const l=i||d;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:[t," selected"]}),e.jsx(U,{variant:"ghost",size:"sm",className:"text-xs h-6 px-2",onClick:n,disabled:l,children:"Clear"}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsxs(U,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:s,disabled:l,children:[i?e.jsx(se,{className:"w-3 h-3 animate-spin"}):e.jsx(ss,{className:"w-3 h-3"}),"Pause Selected"]}),e.jsxs(U,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:a,disabled:l,children:[d?e.jsx(se,{className:"w-3 h-3 animate-spin"}):e.jsx(ts,{className:"w-3 h-3"}),"Resume Selected"]})]})]})}function Ya({accounts:t,onAddAccount:s,onSetDefault:a,onRemoveAccount:n,onPauseToggle:i,onSoloMode:d,onBulkPause:l,onBulkResume:u,isRemovingAccount:r,isPausingAccount:m,isSoloingAccount:h,isBulkPausing:j,isBulkResuming:p,privacyMode:g,showQuota:D,isKiro:M,kiroNoIncognito:C,onKiroNoIncognitoChange:T,kiroSettingsLoading:A}){const[v,o]=c.useState(new Set),b=c.useMemo(()=>new Set(t.map(k=>k.id)),[t]),S=c.useMemo(()=>new Set([...v].filter(k=>b.has(k))),[v,b]),f=!!(l&&u),N=S.size,w=t.length>0&&S.size===t.length,q=S.size>0&&S.size<t.length,G=c.useCallback(k=>{o(I=>{const R=new Set(I);return R.has(k)?R.delete(k):R.add(k),R})},[]),P=c.useCallback(()=>{o(new Set(t.map(k=>k.id)))},[t]),E=c.useCallback(()=>{o(new Set)},[]),y=c.useCallback(()=>{w?E():P()},[w,P,E]),K=c.useCallback(()=>{l&&S.size>0&&(l(Array.from(S)),o(new Set))},[l,S]),O=c.useCallback(()=>{u&&S.size>0&&(u(Array.from(S)),o(new Set))},[u,S]);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:[f&&t.length>0&&e.jsx(_e,{checked:w,onCheckedChange:y,"aria-label":"Select all accounts",className:q?"data-[state=checked]:bg-primary/50":"",...q?{"data-state":"indeterminate"}:{}}),e.jsx(Ce,{className:"w-4 h-4"}),"Accounts",t.length>0&&e.jsx(H,{variant:"secondary",className:"text-xs",children:t.length})]}),e.jsxs(U,{variant:"default",size:"sm",className:"h-7 text-xs gap-1",onClick:s,children:[e.jsx(es,{className:"w-3 h-3"}),"Add"]})]}),f&&N>0&&e.jsx(Xa,{selectedCount:N,onPauseSelected:K,onResumeSelected:O,onClearSelection:E,isPausing:!!j,isResuming:!!p}),t.length>0?e.jsx("div",{className:"space-y-2",children:t.map(k=>e.jsx(Wa,{account:k,onSetDefault:()=>a(k.id),onRemove:()=>n(k.id),onPauseToggle:i?I=>i(k.id,I):void 0,onSoloMode:d?()=>d(k.id):void 0,isRemoving:r,isPausingAccount:m,isSoloingAccount:h,privacyMode:g,showQuota:D,selectable:f,selected:S.has(k.id),onSelectChange:()=>G(k.id)},k.id))}):e.jsxs("div",{className:"py-6 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed",children:[e.jsx(Ce,{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"})]}),M&&T&&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(Zt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Use incognito"})]}),e.jsx(Qt,{checked:!C,onCheckedChange:k=>T(!k),disabled:A,className:"scale-90"})]})})]})}function Za({provider:t,catalog:s,savedPresets:a,currentModel:n,opusModel:i,sonnetModel:d,haikuModel:l,providerModels:u,routing:r,extendedContextEnabled:m,onExtendedContextToggle:h,onApplyPreset:j,onUpdateEnvValue:p,onOpenCustomPreset:g,onDeletePreset:D,isDeletePending:M,accounts:C,onAddAccount:T,onSetDefault:A,onRemoveAccount:v,onPauseToggle:o,onSoloMode:b,onBulkPause:S,onBulkResume:f,isRemovingAccount:N,isPausingAccount:w,isSoloingAccount:q,isBulkPausing:G,isBulkResuming:P,privacyMode:E,isRemoteMode:y}){const K=t.toLowerCase(),O=(Rs.includes(K)||["anthropic","antigravity","gemini-cli","copilot","github-copilot"].includes(K))&&!y,k=t==="kiro",[I,R]=c.useState(!0),[B,z]=c.useState(!0),[X,Y]=c.useState(!1),ee=c.useCallback(async()=>{if(k)try{z(!0);const te=(await Ee.config.get()).cliproxy;R(te?.kiro_no_incognito??!0)}catch{R(!0)}finally{z(!1)}},[k]),le=c.useCallback(async Z=>{R(Z),Y(!0);try{const te=await Ee.config.get(),x=te.cliproxy??{};await Ee.config.update({...te,cliproxy:{...x,kiro_no_incognito:Z}})}catch{R(!Z)}finally{Y(!1)}},[]);return c.useEffect(()=>{ee()},[ee]),e.jsx(xt,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsx(Qa,{catalog:s,savedPresets:a,currentModel:n,opusModel:i,sonnetModel:d,haikuModel:l,providerModels:u,routing:r,provider:t,extendedContextEnabled:m,onExtendedContextToggle:h,onApplyPreset:j,onUpdateEnvValue:p,onOpenCustomPreset:g,onDeletePreset:D,isDeletePending:M}),e.jsx(bt,{}),e.jsx(Ya,{accounts:C,onAddAccount:T,onSetDefault:A,onRemoveAccount:v,onPauseToggle:o,onSoloMode:b,onBulkPause:S,onBulkResume:f,isRemovingAccount:N,isPausingAccount:w,isSoloingAccount:q,isBulkPausing:G,isBulkResuming:P,privacyMode:E,showQuota:O,isKiro:k,kiroNoIncognito:I,onKiroNoIncognitoChange:le,kiroSettingsLoading:B||X})]})})}function Ot({provider:t,displayName:s,authStatus:a,catalog:n,routing:i,logoProvider:d,baseProvider:l,isRemoteMode:u,port:r,defaultTarget:m,topNotice:h,onAddAccount:j,onSetDefault:p,onRemoveAccount:g,onPauseToggle:D,onSoloMode:M,onBulkPause:C,onBulkResume:T,isRemovingAccount:A,isPausingAccount:v,isSoloingAccount:o,isBulkPausing:b,isBulkResuming:S}){const[f,N]=c.useState(!1),{privacyMode:w}=Vt(),{data:q}=Es(),{data:G}=Os(t),P=_s(),E=Fs(),y=l||t,K=y.toLowerCase()==="agy",O=c.useMemo(()=>{const _=G?.presets||[];return K?_.filter(Q=>!re(Q.default)&&!re(Q.opus)&&!re(Q.sonnet)&&!re(Q.haiku)):_},[K,G?.presets]),k=c.useMemo(()=>{if(!q?.models)return[];const Q={gemini:["google"],agy:["antigravity"],codex:["openai"],qwen:["alibaba","qwen"],iflow:["iflow"],kiro:["kiro","aws"],ghcp:["github","copilot"],kimi:["kimi","moonshot"]}[y.toLowerCase()]||[y.toLowerCase()];return q.models.filter(ie=>Q.some(J=>ie.owned_by.toLowerCase().includes(J))?K?!re(ie.id):!0:!1)},[K,q,y]),I=(l||t).toLowerCase(),{data:R,isLoading:B,refetch:z,rawJsonContent:X,rawJsonEdits:Y,isRawJsonValid:ee,hasChanges:le,currentModel:Z,opusModel:te,sonnetModel:x,haikuModel:F,extendedContextEnabled:ae,toggleExtendedContext:Se,handleRawJsonChange:Ke,updateEnvValue:qe,updateEnvValues:ne,saveMutation:Pe,conflictDialog:Me,handleConflictResolve:ye,missingRequiredFields:De}=Fa(t,n),Te=c.useMemo(()=>(a.accounts||[]).map(_=>({..._,provider:_.provider||l||t})),[a.accounts,l,t]),{data:je}=_t({queryKey:["auth-tokens-raw"],queryFn:async()=>{const _=await fetch("/api/settings/auth/tokens/raw");return _.ok?_.json():{apiKey:{value:"ccs-internal-managed"}}},staleTime:6e4}),be=je?.apiKey?.value??"ccs-internal-managed",Ie=_=>{if(K&&[_.ANTHROPIC_MODEL,_.ANTHROPIC_DEFAULT_OPUS_MODEL,_.ANTHROPIC_DEFAULT_SONNET_MODEL,_.ANTHROPIC_DEFAULT_HAIKU_MODEL].some(ie=>typeof ie=="string"&&re(ie))){V.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}ne({ANTHROPIC_BASE_URL:`http://127.0.0.1:${r??nt}/api/provider/${I}`,ANTHROPIC_AUTH_TOKEN:be,..._}),V.success(`Applied "${_.ANTHROPIC_MODEL?.split("/").pop()||"preset"}" preset`)},He=(_,Q)=>{if(K&&[_.default,_.opus,_.sonnet,_.haiku].some(J=>re(J))){V.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}ne({ANTHROPIC_BASE_URL:`http://127.0.0.1:${r??nt}/api/provider/${I}`,ANTHROPIC_AUTH_TOKEN:be,ANTHROPIC_MODEL:_.default,ANTHROPIC_DEFAULT_OPUS_MODEL:_.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:_.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:_.haiku}),V.success(`Applied ${Q?`"${Q}"`:"custom"} preset`),N(!1)},Ve=(_,Q)=>{if(!Q){V.error(Bt.t("commonToast.enterPresetName"));return}if(K&&[_.default,_.opus,_.sonnet,_.haiku].some(ie=>re(ie))){V.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}P.mutate({profile:t,data:{name:Q,..._}}),N(!1)};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(Ba,{provider:t,displayName:s,logoProvider:d,data:R,isLoading:B,hasChanges:le,isRawJsonValid:ee,isSaving:Pe.isPending,isRemoteMode:u,port:r,onRefetch:z,onSave:()=>Pe.mutate()}),h?e.jsx("div",{className:"border-b bg-muted/10 px-4 py-3",children:h}):null,B?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(se,{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:"min-h-0 flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[e.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden bg-muted/5",children:e.jsxs(Us,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(Ks,{className:"w-full",children:[e.jsx(Pt,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(Pt,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(Mt,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(Za,{provider:t,catalog:n,savedPresets:O,currentModel:Z,opusModel:te,sonnetModel:x,haikuModel:F,providerModels:k,routing:i,extendedContextEnabled:ae,onExtendedContextToggle:Se,onApplyPreset:Ie,onUpdateEnvValue:qe,onOpenCustomPreset:()=>N(!0),onDeletePreset:_=>E.mutate({profile:t,name:_}),isDeletePending:E.isPending,accounts:Te,onAddAccount:j,onSetDefault:p,onRemoveAccount:g,onPauseToggle:D,onSoloMode:M,onBulkPause:C,onBulkResume:T,isRemovingAccount:A,isPausingAccount:v,isSoloingAccount:o,isBulkPausing:b,isBulkResuming:S,privacyMode:w,isRemoteMode:u})}),e.jsx(Mt,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(Ga,{provider:t,displayName:s,defaultTarget:m,data:R,authStatus:a,supportsModelConfig:!!n})})]})]})}),e.jsxs("div",{className:"flex min-h-0 min-w-0 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(oa,{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(qs,{rawJsonContent:X,isRawJsonValid:ee,rawJsonEdits:Y,onRawJsonChange:Ke,profileEnv:R?.settings?.env,missingRequiredFields:De})]})]}),e.jsx(da,{open:Me,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>ye(!0),onCancel:()=>ye(!1)}),e.jsx(Va,{open:f,onClose:()=>N(!1),currentValues:{default:Z||"",opus:te||"",sonnet:x||"",haiku:F||""},onApply:He,onSave:Ve,isSaving:P.isPending,catalog:n,allModels:k,routing:i})]})}function en({status:t,isSelected:s,onSelect:a}){const{t:n}=oe(),i=t.accounts?.length||0;return e.jsxs("button",{className:$("w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer text-left",s?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:a,children:[e.jsx(ht,{provider:t.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:t.displayName}),i>0&&e.jsx(H,{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:t.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(ve,{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(jt,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("cliproxyPage.notConnected")})]})})]})]})}function tn({variant:t,parentAuth:s,isSelected:a,onSelect:n,onDelete:i,isDeleting:d}){const{t:l}=oe(),u=()=>{n()};return e.jsxs("div",{role:"button",tabIndex:0,className:$("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:u,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),u())},children:[e.jsxs("div",{className:"relative",children:[e.jsx(ht,{provider:t.provider,size:"sm"}),e.jsx(ns,{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:t.name}),e.jsx(H,{variant:"outline",className:"text-[9px] h-4 px-1",children:l("cliproxyPage.variant")}),e.jsx(H,{variant:"outline",className:"text-[9px] h-4 px-1 uppercase",children:t.target||"claude"})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:s?.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l("cliproxyPage.viaProvider",{provider:t.provider})})]}):e.jsxs(e.Fragment,{children:[e.jsx(jt,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:l("cliproxyPage.parentNotConnected")})]})})]}),e.jsx(U,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:r=>{r.stopPropagation(),i()},disabled:d,children:e.jsx(as,{className:"w-3 h-3"})})]})}function sn({onSetup:t}){const{t:s}=oe();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(Ae,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:s("cliproxyPage.emptyTitle")}),e.jsx("p",{className:"text-muted-foreground mb-4",children:s("cliproxyPage.emptyDesc")}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:[s("cliproxyPage.emptyControlPanelPrefix")," ",e.jsx("a",{href:"/cliproxy/control-panel",className:"text-primary hover:underline",children:s("cliproxyPage.controlPanel")}),"."]}),e.jsxs(U,{onClick:t,className:"gap-2",children:[e.jsx(ke,{className:"w-4 h-4"}),s("cliproxyPage.quickSetup")]})]})})}function Nn(){const{t}=oe(),s=lt(),{data:a,isLoading:n}=qt(),{data:i,isFetching:d}=Hs(),{data:l}=Ht(),{data:u}=Vs(),r=Gs(),m=Bs(),h=zs(),j=$s(),p=Qs(),g=Js(),D=Ws(),M=Xs(),[C,T]=c.useState(()=>{if(typeof window<"u"){const F=new URLSearchParams(window.location.search).get("provider")?.trim().toLowerCase();return F&&Ze(F)?F:localStorage.getItem("cliproxy-selected-provider")}return null}),[A,v]=c.useState(null),[o,b]=c.useState(!1),[S,f]=c.useState(()=>{if(typeof window>"u")return null;const x=new URLSearchParams(window.location.search),F=x.get("provider")?.trim().toLowerCase();return x.get("action")!=="auth"||!F||!Ze(F)?null:{provider:F,displayName:Ys(F),isFirstAccount:!1}}),N=c.useMemo(()=>a?.authStatus||[],[a?.authStatus]),w=a?.source==="remote",q=c.useMemo(()=>i?.variants||[],[i?.variants]),G=c.useMemo(()=>Nt(l?.catalogs),[l?.catalogs]),P=l?.routing??{},E=!!l,y=x=>{T(x),x&&localStorage.setItem("cliproxy-selected-provider",x)},K=c.useMemo(()=>A?null:C&&N.some(x=>x.provider===C)?C:N.length>0&&(N.find(F=>(F.accounts?.length||0)>0)?.provider||N[0]?.provider)||null,[C,A,N]),O=N.find(x=>x.provider===K),k=q.find(x=>x.name===A),I=k?N.find(x=>x.provider===k.provider):void 0,R=(k?.provider||O?.provider||"").toLowerCase().trim(),B=R==="gemini"||R==="agy",z=()=>{s.invalidateQueries({queryKey:["cliproxy"]}),s.invalidateQueries({queryKey:["cliproxy-auth"]}),s.invalidateQueries({queryKey:["cliproxy-catalog"]}),s.invalidateQueries({queryKey:["cliproxy-models"]})},X=(x,F,ae)=>{h.isPending||j.isPending||(ae?h.mutate({provider:x,accountId:F}):j.mutate({provider:x,accountId:F}))},Y=(x,F)=>{p.isPending||p.mutate({provider:x,accountId:F})},ee=(x,F)=>{g.isPending||g.mutate({provider:x,accountIds:F})},le=(x,F)=>{D.isPending||D.mutate({provider:x,accountIds:F})},Z=x=>{y(x),v(null)},te=x=>{v(x),y(null)};return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",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(Ae,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:u?.backendLabel??"CLIProxy"})]}),e.jsx(U,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:z,disabled:d,children:e.jsx(ft,{className:$("w-4 h-4",d&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:t("cliproxyPage.accountManagement")}),e.jsxs(U,{variant:"default",size:"sm",className:"w-full gap-2",onClick:()=>b(!0),children:[e.jsx(ke,{className:"w-4 h-4"}),t("cliproxyPage.quickSetup")]})]}),e.jsx(xt,{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:t("cliproxyPage.providers")}),n?e.jsx("div",{className:"space-y-2 px-2",children:[1,2,3,4].map(x=>e.jsx(Zs,{className:"h-14 w-full rounded-lg"},x))}):e.jsx("div",{className:"space-y-1",children:N.map(x=>e.jsx(en,{status:x,isSelected:K===x.provider,onSelect:()=>Z(x.provider)},x.provider))}),q.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(ns,{className:"w-3 h-3"}),t("cliproxyPage.variants")]}),e.jsx("div",{className:"space-y-1",children:q.map(x=>e.jsx(tn,{variant:x,parentAuth:N.find(F=>F.provider===x.provider),isSelected:A===x.name,onSelect:()=>te(x.name),onDelete:()=>M.mutate(x.name),isDeleting:M.isPending},x.name))})]})]})}),e.jsx("div",{className:"p-3 border-t",children:e.jsx(ma,{})}),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:t("cliproxyPage.providerCount",{count:N.length})}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ve,{className:"w-3 h-3 text-green-600"}),t("cliproxyPage.connectedCount",{count:N.filter(x=>x.authenticated).length})]})]})})]}),e.jsx("div",{className:"flex-1 flex min-w-0 flex-col overflow-hidden bg-background",children:k&&I?e.jsx(e.Fragment,{children:e.jsx(Ot,{provider:k.name,displayName:t("cliproxyPage.variantDisplay",{name:k.name,provider:k.provider}),authStatus:I,catalog:G[k.provider],routing:P[k.provider],logoProvider:k.provider,baseProvider:k.provider,defaultTarget:k.target,isRemoteMode:w,port:k.port,topNotice:B?e.jsx(ot,{compact:!0,showProxySettingsLink:!0}):void 0,onAddAccount:()=>f({provider:k.provider,displayName:I.displayName,isFirstAccount:(I.accounts?.length||0)===0}),onSetDefault:x=>r.mutate({provider:k.provider,accountId:x}),onRemoveAccount:x=>m.mutate({provider:k.provider,accountId:x}),onPauseToggle:(x,F)=>X(k.provider,x,F),onSoloMode:x=>Y(k.provider,x),onBulkPause:x=>ee(k.provider,x),onBulkResume:x=>le(k.provider,x),isRemovingAccount:m.isPending,isPausingAccount:h.isPending||j.isPending,isSoloingAccount:p.isPending,isBulkPausing:g.isPending,isBulkResuming:D.isPending})}):O?e.jsx(e.Fragment,{children:e.jsx(Ot,{provider:O.provider,displayName:O.displayName,authStatus:O,catalog:G[O.provider],routing:P[O.provider],isRemoteMode:w,topNotice:B?e.jsx(ot,{compact:!0,showProxySettingsLink:!0}):void 0,onAddAccount:()=>f({provider:O.provider,displayName:O.displayName,isFirstAccount:(O.accounts?.length||0)===0}),onSetDefault:x=>r.mutate({provider:O.provider,accountId:x}),onRemoveAccount:x=>m.mutate({provider:O.provider,accountId:x}),onPauseToggle:(x,F)=>X(O.provider,x,F),onSoloMode:x=>Y(O.provider,x),onBulkPause:x=>ee(O.provider,x),onBulkResume:x=>le(O.provider,x),isRemovingAccount:m.isPending,isPausingAccount:h.isPending||j.isPending,isSoloingAccount:p.isPending,isBulkPausing:g.isPending,isBulkResuming:D.isPending})}):e.jsx(sn,{onSetup:()=>b(!0)})}),e.jsx(Pa,{open:o,onClose:()=>b(!1)}),e.jsx(Ea,{open:S!==null,onClose:()=>f(null),provider:S?.provider||"",displayName:S?.displayName||"",catalog:E&&S?.provider?G[S.provider]:void 0,isFirstAccount:S?.isFirstAccount||!1})]})}export{Nn as CliproxyPage};
|