@kaitranntt/ccs 7.54.0-dev.7 → 7.54.0-dev.8
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/commands/api-command/copy-command.d.ts.map +1 -1
- package/dist/commands/api-command/copy-command.js +3 -4
- package/dist/commands/api-command/copy-command.js.map +1 -1
- package/dist/commands/api-command/discover-command.d.ts.map +1 -1
- package/dist/commands/api-command/discover-command.js +8 -0
- package/dist/commands/api-command/discover-command.js.map +1 -1
- package/dist/commands/api-command/export-command.d.ts.map +1 -1
- package/dist/commands/api-command/export-command.js +11 -2
- package/dist/commands/api-command/export-command.js.map +1 -1
- package/dist/commands/api-command/import-command.d.ts.map +1 -1
- package/dist/commands/api-command/import-command.js +14 -4
- package/dist/commands/api-command/import-command.js.map +1 -1
- package/dist/commands/api-command/index.js +1 -1
- package/dist/commands/api-command/index.js.map +1 -1
- package/dist/commands/api-command/list-command.d.ts +1 -1
- package/dist/commands/api-command/list-command.d.ts.map +1 -1
- package/dist/commands/api-command/list-command.js +9 -1
- package/dist/commands/api-command/list-command.js.map +1 -1
- package/dist/commands/api-command/shared.d.ts +12 -1
- package/dist/commands/api-command/shared.d.ts.map +1 -1
- package/dist/commands/api-command/shared.js +30 -10
- package/dist/commands/api-command/shared.js.map +1 -1
- package/dist/commands/api-command.d.ts +2 -0
- package/dist/commands/api-command.d.ts.map +1 -0
- package/dist/commands/api-command.js +18 -0
- package/dist/commands/api-command.js.map +1 -0
- package/dist/commands/arg-extractor.d.ts +15 -0
- package/dist/commands/arg-extractor.d.ts.map +1 -1
- package/dist/commands/arg-extractor.js +48 -2
- package/dist/commands/arg-extractor.js.map +1 -1
- package/dist/commands/config-auth/index.d.ts.map +1 -1
- package/dist/commands/config-auth/index.js +24 -19
- package/dist/commands/config-auth/index.js.map +1 -1
- package/dist/commands/config-command-options.d.ts.map +1 -1
- package/dist/commands/config-command-options.js +14 -0
- package/dist/commands/config-command-options.js.map +1 -1
- package/dist/commands/config-command.d.ts.map +1 -1
- package/dist/commands/config-command.js +5 -0
- package/dist/commands/config-command.js.map +1 -1
- package/dist/shared/provider-preset-catalog.d.ts +1 -1
- package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
- package/dist/shared/provider-preset-catalog.js +16 -15
- package/dist/shared/provider-preset-catalog.js.map +1 -1
- package/dist/ui/assets/{accounts-CpqdW0_w.js → accounts-DwcZCyS5.js} +1 -1
- package/dist/ui/assets/{alert-dialog-C2kpeUmy.js → alert-dialog-B2hyK6AP.js} +1 -1
- package/dist/ui/assets/{api-A4Julmmi.js → api-qU_bc9BM.js} +1 -1
- package/dist/ui/assets/{auth-section-BikPcP2d.js → auth-section-BPkTuOTf.js} +1 -1
- package/dist/ui/assets/{backups-section-BHu3D40s.js → backups-section-CeYlXizh.js} +1 -1
- package/dist/ui/assets/{checkbox-DnXEP66k.js → checkbox-CpTns8kD.js} +1 -1
- package/dist/ui/assets/{claude-extension-wV9N452h.js → claude-extension-DON0t7Fm.js} +1 -1
- package/dist/ui/assets/cliproxy-CVg2BCbP.js +3 -0
- package/dist/ui/assets/{cliproxy-control-panel-C89BN089.js → cliproxy-control-panel-7zmRoGkw.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-Caa-t7ys.js → confirm-dialog-1fHP9ADM.js} +1 -1
- package/dist/ui/assets/{copilot-Bgu53vgq.js → copilot-CgZIsLcU.js} +1 -1
- package/dist/ui/assets/{cursor-ZChzmf7Q.js → cursor-3B9jIxVF.js} +1 -1
- package/dist/ui/assets/{droid-DszHiQa0.js → droid-3UY521J3.js} +2 -2
- package/dist/ui/assets/{globalenv-section-CSBCCjgB.js → globalenv-section-DHDrZkJ1.js} +1 -1
- package/dist/ui/assets/{health-CSvvjVV2.js → health-C2THW9ym.js} +1 -1
- package/dist/ui/assets/{index-Do_SlOTb.js → index-BnHfOIfl.js} +1 -1
- package/dist/ui/assets/{index-faayS7V6.js → index-C7jJyg77.js} +1 -1
- package/dist/ui/assets/{index-DluWJK6_.js → index-DPWpIhxa.js} +1 -1
- package/dist/ui/assets/index-Dz76Rk36.js +47 -0
- package/dist/ui/assets/{index-Bi5fEiUi.js → index-MPOI0EJ5.js} +1 -1
- package/dist/ui/assets/index-OMV20t-1.css +1 -0
- package/dist/ui/assets/{proxy-status-widget-DDqnLj1A.js → proxy-status-widget-BZfWhofZ.js} +1 -1
- package/dist/ui/assets/{searchable-select-DnAlFkH9.js → searchable-select-CzYKeWKI.js} +1 -1
- package/dist/ui/assets/{separator-Dn2TUYHv.js → separator-dTvIQkrw.js} +1 -1
- package/dist/ui/assets/{shared-BOOrRRmV.js → shared-Ccidnid7.js} +1 -1
- package/dist/ui/assets/{switch-CSo86CGn.js → switch-Bsk1Z1Fy.js} +1 -1
- package/dist/ui/assets/{updates-N5ILgIIx.js → updates-DmT2FBqm.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/package.json +2 -1
- package/dist/ui/assets/cliproxy-CHERj-xQ.js +0 -3
- package/dist/ui/assets/index-BSxYTtfG.css +0 -1
- package/dist/ui/assets/index-ByjiTTw6.js +0 -47
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./radix-ui-Dt3edmE5.js";import{g as ve,r as j}from"./react-vendor-CNOkPC89.js";import{bn as pe,bo as me,bp as xe,bq as Ce,br as M,bs as Q,bt as L,bu as Ae,bv as we,a as Ee,bm as ke,aS as Te,bw as Ve,bx as Ie,by as Pe,bz as $e,bA as Re,c as U,B as oe,aE as We,M as De,O as Oe,r as Fe,s as _e,t as Le,v as Ue,w as qe,d as ne,T as Me,p as Be,q as Ke,Y as ze}from"./index-ByjiTTw6.js";import{A as He,a as Ye,b as Ze,c as Ge,d as Qe,e as Xe,f as Je,g as et}from"./alert-dialog-C2kpeUmy.js";import{u as fe,a as tt,b as st,e as nt}from"./tanstack-B8i0evp-.js";import{t as X}from"./notifications-B2HqRBj7.js";import{t as rt,A as at,R as K,aZ as it,a_ as ot,a$ as lt,X as ct,d as ut,b0 as dt,b1 as pt,U as mt,u as xt,l as ft,x as gt,ar as ht,T as J,aA as yt}from"./icons-DtwH984l.js";var ee,le;function bt(){return le||(le=1,ee={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),ee}var jt=bt();const St=ve(jt);var Nt=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ce(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(St[n[1]]||e.charAt(e.length-2)==="/")&&(t.voidElement=!0),t.name.startsWith("!--"))){var r=e.indexOf("-->");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var a=new RegExp(Nt),i=null;(i=a.exec(e))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),t.attrs[c[0]]=c[1],a.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var vt=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Ct=/^\s*$/,At=Object.create(null);function ge(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(ge,"")+"</"+t.name+">";case"comment":return e+"<!--"+t.comment+"-->"}}var wt={parse:function(e,t){t||(t={}),t.components||(t.components=At);var n,r=[],a=[],i=-1,o=!1;if(e.indexOf("<")!==0){var c=e.indexOf("<");r.push({type:"text",content:c===-1?e:e.substring(0,c)})}return e.replace(vt,function(d,u){if(o){if(d!=="</"+n.name+">")return;o=!1}var f,E=d.charAt(1)!=="/",T=d.startsWith("<!--"),m=u+d.length,p=e.charAt(m);if(T){var S=ce(d);return i<0?(r.push(S),r):((f=a[i]).children.push(S),r)}if(E&&(i++,(n=ce(d)).type==="tag"&&t.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!p||p==="<"||n.children.push({type:"text",content:e.slice(m,e.indexOf("<",m))}),i===0&&r.push(n),(f=a[i-1])&&f.children.push(n),a[i]=n),(!E||n.voidElement)&&(i>-1&&(n.voidElement||n.name===d.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&p!=="<"&&p)){f=i===-1?r:a[i].children;var b=e.indexOf("<",m),I=e.slice(m,b===-1?void 0:b);Ct.test(I)&&(I=" "),(b>-1&&i+f.length>=0||I!==" ")&&f.push({type:"text",content:I})}}),r},stringify:function(e){return e.reduce(function(t,n){return t+ge("",n)},"")}};const H=(e,t)=>{if(!e)return!1;const n=e.props?.children??e.children;return t?n.length>0:!!n},Y=e=>{if(!e)return[];const t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?q(t):t},Et=e=>Array.isArray(e)&&e.every(j.isValidElement),q=e=>Array.isArray(e)?e:[e],kt=(e,t)=>{const n={...t};return n.props={...t.props,...e.props},n},Tt=e=>{const t={};if(!e)return t;const n=r=>{q(r).forEach(i=>{M(i)||(H(i)?n(Y(i)):L(i)&&!j.isValidElement(i)&&Object.assign(t,i))})};return n(e),t},he=(e,t,n,r)=>{if(!e)return"";let a="";const i=q(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((c,d)=>{if(M(c)){a+=`${c}`;return}if(j.isValidElement(c)){const{props:u,type:f}=c,E=Object.keys(u).length,T=o.indexOf(f)>-1,m=u.children;if(!m&&T&&!E){a+=`<${f}/>`;return}if(!m&&(!T||E)||u.i18nIsDynamicList){a+=`<${d}></${d}>`;return}if(T&&E===1&&M(m)){a+=`<${f}>${m}</${f}>`;return}const p=he(m,t,n,r);a+=`<${d}>${p}</${d}>`;return}if(c===null){Q(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(L(c)){const{format:u,...f}=c,E=Object.keys(f);if(E.length===1){const T=u?`${E[0]}, ${u}`:E[0];a+=`{{${T}}}`;return}Q(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:c});return}Q(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:c})}),a},Vt=(e,t=[],n={})=>{if(!e)return e;const r=Object.keys(n),a=[...t,...r];let i="",o=0;for(;o<e.length;)if(e[o]==="<"){let c=!1;const d=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(d){const u=d[1];(/^\d+$/.test(u)||a.includes(u))&&(c=!0,i+=d[0],o+=d[0].length)}if(!c){const u=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(u){const f=u[1];(/^\d+$/.test(f)||a.includes(f))&&(c=!0,i+=u[0],o+=u[0].length)}}c||(i+="<",o+=1)}else i+=e[o],o+=1;return i},It=(e,t,n,r,a,i,o)=>{if(n==="")return[];const c=a.transKeepBasicHtmlNodesFor||[],d=n&&new RegExp(c.map(x=>`<${x}`).join("|")).test(n);if(!e&&!t&&!d&&!o)return[n];const u=t??{},f=x=>{q(x).forEach(g=>{M(g)||(H(g)?f(Y(g)):L(g)&&!j.isValidElement(g)&&Object.assign(u,g))})};f(e);const E=Vt(n,c,u),T=wt.parse(`<0>${E}</0>`),m={...u,...i},p=(x,k,g)=>{const C=Y(x),R=b(C,k.children,g);return Et(C)&&R.length===0||x.props?.i18nIsDynamicList?C:R},S=(x,k,g,C,R)=>{x.dummy?(x.children=k,g.push(j.cloneElement(x,{key:C},R?void 0:k))):g.push(...j.Children.map([x],h=>{const l="data-i18n-is-dynamic-list",A={key:C,[l]:void 0};return h&&h.props&&Object.keys(h.props).forEach(V=>{V==="ref"||V==="children"||V==="i18nIsDynamicList"||V===l||(A[V]=h.props[V])}),j.cloneElement(h,A,R?null:k)}))},b=(x,k,g)=>{const C=q(x);return q(k).reduce((h,l,A)=>{const V=l.children?.[0]?.content&&r.services.interpolator.interpolate(l.children[0].content,m,r.language);if(l.type==="tag"){let N=C[parseInt(l.name,10)];!N&&t&&(N=t[l.name]),g.length===1&&!N&&(N=g[0][l.name]),N||(N={});const $={...l.attrs};o&&Object.keys($).forEach(y=>{const F=$[y];M(F)&&($[y]=Ae(F))});const v=Object.keys($).length!==0?kt({props:$},N):N,P=j.isValidElement(v),O=P&&H(l,!0)&&!l.voidElement,W=d&&L(v)&&v.dummy&&!P,B=L(t)&&Object.hasOwnProperty.call(t,l.name);if(M(v)){const y=r.services.interpolator.interpolate(v,m,r.language);h.push(y)}else if(H(v)||O){const y=p(v,l,g);S(v,y,h,A)}else if(W){const y=b(C,l.children,g);S(v,y,h,A)}else if(Number.isNaN(parseFloat(l.name)))if(B){const y=p(v,l,g);S(v,y,h,A,l.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(l.name)>-1)if(l.voidElement)h.push(j.createElement(l.name,{key:`${l.name}-${A}`}));else{const y=b(C,l.children,g);h.push(j.createElement(l.name,{key:`${l.name}-${A}`},y))}else if(l.voidElement)h.push(`<${l.name} />`);else{const y=b(C,l.children,g);h.push(`<${l.name}>${y}</${l.name}>`)}else if(L(v)&&!P){const y=l.children[0]?V:null;y&&h.push(y)}else S(v,V,h,A,l.children.length!==1||!V)}else if(l.type==="text"){const N=a.transWrapTextNodes,$=typeof a.unescape=="function"?a.unescape:xe().unescape,v=o?$(r.services.interpolator.interpolate(l.content,m,r.language)):r.services.interpolator.interpolate(l.content,m,r.language);N?h.push(j.createElement(N,{key:`${l.name}-${A}`},v)):h.push(v)}return h},[])},I=b([{dummy:!0,children:e||[]}],T,q(e||[]));return Y(I[0])},ye=(e,t,n)=>{const r=e.key||t,a=j.cloneElement(e,{key:r});if(!a.props||!a.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return a;function i(){return j.createElement(j.Fragment,null,a)}return j.createElement(i,{key:r})},Pt=(e,t)=>e.map((n,r)=>ye(n,r,t)),$t=(e,t)=>{const n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:ye(e[r],r,t)})}),n},Rt=(e,t,n,r)=>e?Array.isArray(e)?Pt(e,t):L(e)?$t(e,t):(pe(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,Wt=e=>!L(e)||Array.isArray(e)?!1:Object.keys(e).reduce((t,n)=>t&&Number.isNaN(Number.parseFloat(n)),!0);function Dt({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:u,i18n:f,t:E,shouldUnescape:T,...m}){const p=f||me();if(!p)return pe(p,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),e;const S=E||p.t.bind(p)||(_=>_),b={...xe(),...p.options?.react};let I=u||S.ns||p.options?.defaultNS;I=M(I)?[I]:I||["translation"];const{transDefaultProps:x}=b,k=x?.tOptions?{...x.tOptions,...i}:i,g=T??x?.shouldUnescape,C=x?.values?{...x.values,...o}:o,R=x?.components?{...x.components,...d}:d,h=he(e,b,p,r),l=c||k?.defaultValue||h||b.transEmptyNodeValue||(typeof r=="function"?Ce(r):r),{hashTransKey:A}=b,V=r||(A?A(h||l):h||l);p.options?.interpolation?.defaultVariables?o=C&&Object.keys(C).length>0?{...C,...p.options.interpolation.defaultVariables}:{...p.options.interpolation.defaultVariables}:o=C;const N=Tt(e);N&&typeof N.count=="number"&&t===void 0&&(t=N.count);const $=o||t!==void 0&&!p.options?.interpolation?.alwaysFormat||!e?k.interpolation:{interpolation:{...k.interpolation,prefix:"#$?",suffix:"?$#"}},v={...k,context:a||k.context,count:t,...o,...$,defaultValue:l,ns:I};let P=V?S(V,v):l;P===V&&l&&(P=l);const O=Rt(R,P,p,r);let W=O||e,B=null;Wt(O)&&(B=O,W=e);const y=It(W,B,P,p,b,v,g),F=n??b.defaultTransParent;return F?j.createElement(F,m,y):y}function ue({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:u,i18n:f,t:E,shouldUnescape:T,...m}){const{i18n:p,defaultNS:S}=j.useContext(we)||{},b=f||p||me(),I=E||b?.t.bind(b);return Dt({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:c,components:d,ns:u||I?.ns||S||b?.options?.defaultNS,i18n:b,t:E,shouldUnescape:T,...m})}const Xt="2026-02-24-antigravity-oauth-v2",Ot="I ACCEPT RISK",Ft=Ot,Jt={reviewedIssue509:!1,understandsBanRisk:!1,acceptsFullResponsibility:!1,typedPhrase:""};function es(e){return e.reviewedIssue509&&e.understandsBanRisk&&e.acceptsFullResponsibility&&e.typedPhrase.trim().replace(/\s+/g," ").toUpperCase()===Ft}async function _t(){const e=await fetch("/api/cliproxy/sync/status");if(!e.ok){let t="Failed to fetch sync status";try{const n=await e.json();t=n.error||n.message||t}catch{}throw new Error(t)}return e.json()}async function Lt(){const e=new AbortController,t=setTimeout(()=>e.abort(),3e4);try{const n=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:e.signal});if(!n.ok){let r="Sync failed";try{const a=await n.json();r=a.error||a.message||r}catch{}throw new Error(r)}return n.json()}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):n}finally{clearTimeout(t)}}function Ut(){return fe({queryKey:["cliproxy-sync-status"],queryFn:_t,refetchInterval:3e4,retry:1,staleTime:1e4})}function qt(){const e=tt();return st({mutationFn:Lt,onSuccess:t=>{e.invalidateQueries({queryKey:["cliproxy-sync-status"]}),e.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),t.syncedCount===0?X.info("No profiles to sync"):X.success(`Synced ${t.syncedCount} profile${t.syncedCount===1?"":"s"} to CLIProxy`)},onError:t=>{X.error(`Sync failed: ${t.message}`)}})}function de(e){return e.replace(/-\d+$/,"").split(".").map(Number)}function re(e,t){const n=de(e),r=de(t);for(let a=0;a<3;a+=1){const i=n[a]||0,o=r[a]||0;if(i>o)return 1;if(i<o)return-1}return 0}function te(e,t){return re(e,t)>0}function se(e,t,n){return re(e,t)>=0&&re(e,n)<=0}function Mt(e){if(!e)return"";const t=new Date(e).getTime(),r=Date.now()-t,a=Math.floor(r/(1e3*60*60)),i=Math.floor(r%(1e3*60*60)/(1e3*60));return a>0?`${a}h ${i}m`:`${i}m`}function Bt(e,t){if(!e)return"";const n=Date.now()-e,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?t("proxyStatusWidget.justNow"):r<60?t("proxyStatusWidget.minutesAgo",{count:r}):t("proxyStatusWidget.hoursAgo",{count:a})}function z({icon:e,tooltip:t,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return s.jsxs(Me,{children:[s.jsx(Be,{asChild:!0,children:s.jsx(ne,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:U("h-7 w-7 p-0",o==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:n,disabled:r,children:a?s.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(e,{className:"w-3.5 h-3.5"})})}),s.jsx(Ke,{side:"bottom",className:"text-xs",children:t})]})}function ts(){const{t:e}=Ee(),{data:t,isLoading:n}=ke(),{data:r}=Te(),{data:a,isLoading:i}=Ve(),o=Ie(),c=Pe(),d=$e(),u=Re(),{data:f}=Ut(),{mutate:E,isPending:T}=qt(),[m,p]=j.useState(!1),[S,b]=j.useState(""),[I,x]=j.useState(!1),[k,g]=j.useState(null),[C,R]=j.useState(null),{data:h}=fe({queryKey:["cliproxy-server-config"],queryFn:()=>ze.cliproxyServer.get(),staleTime:3e4}),l=nt({mutationKey:["update-backend"]})>0,A=h?.remote,V=A?.enabled&&A?.host,N=t?.running??!1,$=o.isPending||c.isPending||d.isPending||u.isPending||l||T,v=r?.hasUpdate??!1,P=r?.isStable===!1,O=r?.currentVersion,W=f?.configured??!1,B=e(W?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),y=P?r?.maxStableVersion||a?.latestStable:r?.latestVersion,F=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",_=a?.faultyRange,be=_&&`${_.min.replace(/-\d+$/,"")}-${_.max.replace(/-\d+$/,"")}`,Z=(w,D)=>{g(w),R(D),x(!0)},ae=async w=>{if(!w)return;const D=te(w,F);if(_!==void 0&&se(w,_.min,_.max)){Z(w,"faulty");return}if(D){Z(w,"experimental");return}try{const ie=await u.mutateAsync({version:w});ie.requiresConfirmation&&Z(w,ie.isFaulty?"faulty":"experimental")}catch{}},je=()=>{k&&u.mutate({version:k,force:!0}),x(!1),g(null),R(null)},Se=()=>{x(!1),g(null),R(null)},Ne=V?(()=>{const w=A.protocol||"http",D=A.port||(w==="https"?443:80);return w==="https"&&D===443||w==="http"&&D===80?A.host:`${A.host}:${D}`})():null;return V?s.jsxs("div",{className:U("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(rt,{className:"w-4 h-4 text-blue-500"}),s.jsx("span",{className:"text-sm font-medium",children:e("proxyStatusWidget.remoteProxy")}),s.jsx(oe,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:e("proxyStatusWidget.active")})]}),s.jsx(at,{className:"w-3 h-3 text-blue-600"})]}),s.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[s.jsx("div",{className:"flex items-center gap-1 mb-1",children:s.jsx("span",{className:"font-mono",children:Ne})}),s.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:e("proxyStatusWidget.trafficAutoRouted")})]})]}):s.jsx(We,{delayDuration:300,children:s.jsxs("div",{className:U("rounded-lg border p-3 transition-colors",N?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:U("w-2 h-2 rounded-full",N?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),s.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[n?s.jsx(K,{className:"w-3 h-3 animate-spin text-muted-foreground"}):N?s.jsxs(s.Fragment,{children:[s.jsx(z,{icon:T?K:it,tooltip:e("proxyStatusWidget.tooltipSync"),onClick:()=>E(),disabled:!W||$,isPending:T}),s.jsx(z,{icon:ot,tooltip:e("proxyStatusWidget.tooltipRestart"),onClick:()=>d.mutate(),disabled:$,isPending:d.isPending}),s.jsx(z,{icon:lt,tooltip:e("proxyStatusWidget.tooltipStop"),onClick:()=>c.mutate(),disabled:$,isPending:c.isPending,variant:"destructive-ghost"})]}):null,s.jsx(z,{icon:m?ct:ut,tooltip:e(m?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>p(!m),className:m?"bg-muted":void 0})]})]}),O&&s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[s.jsxs("span",{className:U("text-xs font-mono text-muted-foreground",P&&"text-amber-600 dark:text-amber-400"),children:["v",O]}),(v||P)&&y&&s.jsxs(oe,{variant:"secondary",className:U("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",P?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>void ae(y),title:e(P?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[P?s.jsx(dt,{className:"w-2.5 h-2.5"}):s.jsx(pt,{className:"w-2.5 h-2.5"}),y]})]}),N&&t&&s.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[s.jsx("span",{className:"flex items-center gap-1",children:e("proxyStatusWidget.port",{port:t.port})}),t.sessionCount!==void 0&&t.sessionCount>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(mt,{className:"w-3 h-3"}),e("proxyStatusWidget.sessionCount",{count:t.sessionCount})]}),t.startedAt&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(xt,{className:"w-3 h-3"}),Mt(t.startedAt)]})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[W?s.jsx(ft,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):s.jsx(gt,{className:"w-3 h-3 text-muted-foreground"}),s.jsx("span",{className:U("text-xs",W?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:B})]}),s.jsx(De,{open:m,onOpenChange:p,children:s.jsxs(Oe,{className:"mt-3 pt-3 border-t border-muted",children:[s.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:e("proxyStatusWidget.versionManagement")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Fe,{value:S,onValueChange:b,disabled:i,children:[s.jsx(_e,{className:"h-8 text-xs flex-1",children:s.jsx(Le,{placeholder:e("proxyStatusWidget.selectVersionPlaceholder")})}),s.jsx(Ue,{children:a?.versions.slice(0,20).map(w=>{const D=a?.maxStableVersion&&te(w,a.maxStableVersion),G=a?.faultyRange&&se(w,a.faultyRange.min,a.faultyRange.max);return s.jsx(qe,{value:w,className:"text-xs",children:s.jsxs("span",{className:"flex items-center gap-2",children:["v",w,w===a.latestStable&&s.jsx("span",{className:"text-green-600 dark:text-green-400",children:e("proxyStatusWidget.stable")}),(G||D)&&s.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},w)})})]}),s.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void ae(S),disabled:u.isPending||!S,children:[u.isPending?s.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(ht,{className:"w-3.5 h-3.5"}),e("proxyStatusWidget.install")]})]}),S&&a?.maxStableVersion&&te(S,a.maxStableVersion)&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[s.jsx(J,{className:"w-3.5 h-3.5 flex-shrink-0"}),s.jsx("span",{children:e("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),S&&a?.faultyRange&&se(S,a.faultyRange.min,a.faultyRange.max)&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[s.jsx(J,{className:"w-3.5 h-3.5 flex-shrink-0"}),s.jsx("span",{children:e("proxyStatusWidget.versionsKnownIssues",{version:S})})]}),r?.checkedAt&&s.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:e("proxyStatusWidget.lastChecked",{time:Bt(r.checkedAt,e)})})]})}),!N&&s.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:e("proxyStatusWidget.notRunning")}),s.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>o.mutate(),disabled:o.isPending,children:[o.isPending?s.jsx(K,{className:"w-3 h-3 animate-spin"}):s.jsx(yt,{className:"w-3 h-3"}),e("proxyStatusWidget.start")]})]}),s.jsx(He,{open:I,onOpenChange:x,children:s.jsxs(Ye,{children:[s.jsxs(Ze,{children:[s.jsxs(Ge,{className:"flex items-center gap-2",children:[s.jsx(J,{className:"w-5 h-5 text-amber-500"}),e(C==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),s.jsxs(Qe,{className:"space-y-2",children:[C==="faulty"?s.jsx("p",{children:s.jsx(ue,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:k??"",range:be||""},components:{strong:s.jsx("strong",{})}})}):s.jsx("p",{children:s.jsx(ue,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:k??"",maxStable:F},components:{strong:s.jsx("strong",{})}})}),s.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:e(C==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),s.jsx("p",{children:e("proxyStatusWidget.installUnstableConfirm")})]})]}),s.jsxs(Xe,{children:[s.jsx(Je,{onClick:Se,children:e("proxyStatusWidget.cancel")}),s.jsx(et,{onClick:je,className:"bg-amber-500 hover:bg-amber-600 text-white",children:e("proxyStatusWidget.installAnyway")})]})]})})]})})}export{Ft as A,Jt as D,ts as P,Ot as R,Xt as a,es as i};
|
|
1
|
+
import{j as s}from"./radix-ui-Dt3edmE5.js";import{g as ve,r as j}from"./react-vendor-CNOkPC89.js";import{bl as pe,bm as me,bn as xe,bo as Ce,bp as M,bq as G,br as L,bs as Ae,bt as we,a as Ee,bk as ke,aQ as Te,bu as Ve,bv as Ie,bw as Pe,bx as $e,by as Re,c as U,B as oe,aC as We,M as De,O as Oe,r as Fe,s as _e,t as Le,v as Ue,w as qe,d as ne,T as Me,p as Be,q as Ke,Y as He}from"./index-Dz76Rk36.js";import{A as ze,a as Ye,b as Ze,c as Qe,d as Ge,e as Xe,f as Je,g as et}from"./alert-dialog-B2hyK6AP.js";import{u as fe,a as tt,b as st,e as nt}from"./tanstack-B8i0evp-.js";import{t as X}from"./notifications-B2HqRBj7.js";import{t as rt,A as at,R as K,aZ as it,a_ as ot,a$ as lt,X as ct,d as ut,b0 as dt,b1 as pt,U as mt,u as xt,l as ft,x as gt,ar as ht,T as J,aA as yt}from"./icons-DtwH984l.js";var ee,le;function bt(){return le||(le=1,ee={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),ee}var jt=bt();const St=ve(jt);var Nt=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ce(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(St[n[1]]||e.charAt(e.length-2)==="/")&&(t.voidElement=!0),t.name.startsWith("!--"))){var r=e.indexOf("-->");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var a=new RegExp(Nt),i=null;(i=a.exec(e))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),t.attrs[c[0]]=c[1],a.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var vt=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Ct=/^\s*$/,At=Object.create(null);function ge(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(ge,"")+"</"+t.name+">";case"comment":return e+"<!--"+t.comment+"-->"}}var wt={parse:function(e,t){t||(t={}),t.components||(t.components=At);var n,r=[],a=[],i=-1,o=!1;if(e.indexOf("<")!==0){var c=e.indexOf("<");r.push({type:"text",content:c===-1?e:e.substring(0,c)})}return e.replace(vt,function(d,u){if(o){if(d!=="</"+n.name+">")return;o=!1}var f,E=d.charAt(1)!=="/",T=d.startsWith("<!--"),m=u+d.length,p=e.charAt(m);if(T){var S=ce(d);return i<0?(r.push(S),r):((f=a[i]).children.push(S),r)}if(E&&(i++,(n=ce(d)).type==="tag"&&t.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!p||p==="<"||n.children.push({type:"text",content:e.slice(m,e.indexOf("<",m))}),i===0&&r.push(n),(f=a[i-1])&&f.children.push(n),a[i]=n),(!E||n.voidElement)&&(i>-1&&(n.voidElement||n.name===d.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&p!=="<"&&p)){f=i===-1?r:a[i].children;var b=e.indexOf("<",m),I=e.slice(m,b===-1?void 0:b);Ct.test(I)&&(I=" "),(b>-1&&i+f.length>=0||I!==" ")&&f.push({type:"text",content:I})}}),r},stringify:function(e){return e.reduce(function(t,n){return t+ge("",n)},"")}};const z=(e,t)=>{if(!e)return!1;const n=e.props?.children??e.children;return t?n.length>0:!!n},Y=e=>{if(!e)return[];const t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?q(t):t},Et=e=>Array.isArray(e)&&e.every(j.isValidElement),q=e=>Array.isArray(e)?e:[e],kt=(e,t)=>{const n={...t};return n.props={...t.props,...e.props},n},Tt=e=>{const t={};if(!e)return t;const n=r=>{q(r).forEach(i=>{M(i)||(z(i)?n(Y(i)):L(i)&&!j.isValidElement(i)&&Object.assign(t,i))})};return n(e),t},he=(e,t,n,r)=>{if(!e)return"";let a="";const i=q(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((c,d)=>{if(M(c)){a+=`${c}`;return}if(j.isValidElement(c)){const{props:u,type:f}=c,E=Object.keys(u).length,T=o.indexOf(f)>-1,m=u.children;if(!m&&T&&!E){a+=`<${f}/>`;return}if(!m&&(!T||E)||u.i18nIsDynamicList){a+=`<${d}></${d}>`;return}if(T&&E===1&&M(m)){a+=`<${f}>${m}</${f}>`;return}const p=he(m,t,n,r);a+=`<${d}>${p}</${d}>`;return}if(c===null){G(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(L(c)){const{format:u,...f}=c,E=Object.keys(f);if(E.length===1){const T=u?`${E[0]}, ${u}`:E[0];a+=`{{${T}}}`;return}G(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:c});return}G(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:c})}),a},Vt=(e,t=[],n={})=>{if(!e)return e;const r=Object.keys(n),a=[...t,...r];let i="",o=0;for(;o<e.length;)if(e[o]==="<"){let c=!1;const d=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(d){const u=d[1];(/^\d+$/.test(u)||a.includes(u))&&(c=!0,i+=d[0],o+=d[0].length)}if(!c){const u=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(u){const f=u[1];(/^\d+$/.test(f)||a.includes(f))&&(c=!0,i+=u[0],o+=u[0].length)}}c||(i+="<",o+=1)}else i+=e[o],o+=1;return i},It=(e,t,n,r,a,i,o)=>{if(n==="")return[];const c=a.transKeepBasicHtmlNodesFor||[],d=n&&new RegExp(c.map(x=>`<${x}`).join("|")).test(n);if(!e&&!t&&!d&&!o)return[n];const u=t??{},f=x=>{q(x).forEach(g=>{M(g)||(z(g)?f(Y(g)):L(g)&&!j.isValidElement(g)&&Object.assign(u,g))})};f(e);const E=Vt(n,c,u),T=wt.parse(`<0>${E}</0>`),m={...u,...i},p=(x,k,g)=>{const C=Y(x),R=b(C,k.children,g);return Et(C)&&R.length===0||x.props?.i18nIsDynamicList?C:R},S=(x,k,g,C,R)=>{x.dummy?(x.children=k,g.push(j.cloneElement(x,{key:C},R?void 0:k))):g.push(...j.Children.map([x],h=>{const l="data-i18n-is-dynamic-list",A={key:C,[l]:void 0};return h&&h.props&&Object.keys(h.props).forEach(V=>{V==="ref"||V==="children"||V==="i18nIsDynamicList"||V===l||(A[V]=h.props[V])}),j.cloneElement(h,A,R?null:k)}))},b=(x,k,g)=>{const C=q(x);return q(k).reduce((h,l,A)=>{const V=l.children?.[0]?.content&&r.services.interpolator.interpolate(l.children[0].content,m,r.language);if(l.type==="tag"){let N=C[parseInt(l.name,10)];!N&&t&&(N=t[l.name]),g.length===1&&!N&&(N=g[0][l.name]),N||(N={});const $={...l.attrs};o&&Object.keys($).forEach(y=>{const F=$[y];M(F)&&($[y]=Ae(F))});const v=Object.keys($).length!==0?kt({props:$},N):N,P=j.isValidElement(v),O=P&&z(l,!0)&&!l.voidElement,W=d&&L(v)&&v.dummy&&!P,B=L(t)&&Object.hasOwnProperty.call(t,l.name);if(M(v)){const y=r.services.interpolator.interpolate(v,m,r.language);h.push(y)}else if(z(v)||O){const y=p(v,l,g);S(v,y,h,A)}else if(W){const y=b(C,l.children,g);S(v,y,h,A)}else if(Number.isNaN(parseFloat(l.name)))if(B){const y=p(v,l,g);S(v,y,h,A,l.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(l.name)>-1)if(l.voidElement)h.push(j.createElement(l.name,{key:`${l.name}-${A}`}));else{const y=b(C,l.children,g);h.push(j.createElement(l.name,{key:`${l.name}-${A}`},y))}else if(l.voidElement)h.push(`<${l.name} />`);else{const y=b(C,l.children,g);h.push(`<${l.name}>${y}</${l.name}>`)}else if(L(v)&&!P){const y=l.children[0]?V:null;y&&h.push(y)}else S(v,V,h,A,l.children.length!==1||!V)}else if(l.type==="text"){const N=a.transWrapTextNodes,$=typeof a.unescape=="function"?a.unescape:xe().unescape,v=o?$(r.services.interpolator.interpolate(l.content,m,r.language)):r.services.interpolator.interpolate(l.content,m,r.language);N?h.push(j.createElement(N,{key:`${l.name}-${A}`},v)):h.push(v)}return h},[])},I=b([{dummy:!0,children:e||[]}],T,q(e||[]));return Y(I[0])},ye=(e,t,n)=>{const r=e.key||t,a=j.cloneElement(e,{key:r});if(!a.props||!a.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return a;function i(){return j.createElement(j.Fragment,null,a)}return j.createElement(i,{key:r})},Pt=(e,t)=>e.map((n,r)=>ye(n,r,t)),$t=(e,t)=>{const n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:ye(e[r],r,t)})}),n},Rt=(e,t,n,r)=>e?Array.isArray(e)?Pt(e,t):L(e)?$t(e,t):(pe(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,Wt=e=>!L(e)||Array.isArray(e)?!1:Object.keys(e).reduce((t,n)=>t&&Number.isNaN(Number.parseFloat(n)),!0);function Dt({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:u,i18n:f,t:E,shouldUnescape:T,...m}){const p=f||me();if(!p)return pe(p,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),e;const S=E||p.t.bind(p)||(_=>_),b={...xe(),...p.options?.react};let I=u||S.ns||p.options?.defaultNS;I=M(I)?[I]:I||["translation"];const{transDefaultProps:x}=b,k=x?.tOptions?{...x.tOptions,...i}:i,g=T??x?.shouldUnescape,C=x?.values?{...x.values,...o}:o,R=x?.components?{...x.components,...d}:d,h=he(e,b,p,r),l=c||k?.defaultValue||h||b.transEmptyNodeValue||(typeof r=="function"?Ce(r):r),{hashTransKey:A}=b,V=r||(A?A(h||l):h||l);p.options?.interpolation?.defaultVariables?o=C&&Object.keys(C).length>0?{...C,...p.options.interpolation.defaultVariables}:{...p.options.interpolation.defaultVariables}:o=C;const N=Tt(e);N&&typeof N.count=="number"&&t===void 0&&(t=N.count);const $=o||t!==void 0&&!p.options?.interpolation?.alwaysFormat||!e?k.interpolation:{interpolation:{...k.interpolation,prefix:"#$?",suffix:"?$#"}},v={...k,context:a||k.context,count:t,...o,...$,defaultValue:l,ns:I};let P=V?S(V,v):l;P===V&&l&&(P=l);const O=Rt(R,P,p,r);let W=O||e,B=null;Wt(O)&&(B=O,W=e);const y=It(W,B,P,p,b,v,g),F=n??b.defaultTransParent;return F?j.createElement(F,m,y):y}function ue({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:u,i18n:f,t:E,shouldUnescape:T,...m}){const{i18n:p,defaultNS:S}=j.useContext(we)||{},b=f||p||me(),I=E||b?.t.bind(b);return Dt({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:c,components:d,ns:u||I?.ns||S||b?.options?.defaultNS,i18n:b,t:E,shouldUnescape:T,...m})}const Xt="2026-02-24-antigravity-oauth-v2",Ot="I ACCEPT RISK",Ft=Ot,Jt={reviewedIssue509:!1,understandsBanRisk:!1,acceptsFullResponsibility:!1,typedPhrase:""};function es(e){return e.reviewedIssue509&&e.understandsBanRisk&&e.acceptsFullResponsibility&&e.typedPhrase.trim().replace(/\s+/g," ").toUpperCase()===Ft}async function _t(){const e=await fetch("/api/cliproxy/sync/status");if(!e.ok){let t="Failed to fetch sync status";try{const n=await e.json();t=n.error||n.message||t}catch{}throw new Error(t)}return e.json()}async function Lt(){const e=new AbortController,t=setTimeout(()=>e.abort(),3e4);try{const n=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:e.signal});if(!n.ok){let r="Sync failed";try{const a=await n.json();r=a.error||a.message||r}catch{}throw new Error(r)}return n.json()}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):n}finally{clearTimeout(t)}}function Ut(){return fe({queryKey:["cliproxy-sync-status"],queryFn:_t,refetchInterval:3e4,retry:1,staleTime:1e4})}function qt(){const e=tt();return st({mutationFn:Lt,onSuccess:t=>{e.invalidateQueries({queryKey:["cliproxy-sync-status"]}),e.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),t.syncedCount===0?X.info("No profiles to sync"):X.success(`Synced ${t.syncedCount} profile${t.syncedCount===1?"":"s"} to CLIProxy`)},onError:t=>{X.error(`Sync failed: ${t.message}`)}})}function de(e){return e.replace(/-\d+$/,"").split(".").map(Number)}function re(e,t){const n=de(e),r=de(t);for(let a=0;a<3;a+=1){const i=n[a]||0,o=r[a]||0;if(i>o)return 1;if(i<o)return-1}return 0}function te(e,t){return re(e,t)>0}function se(e,t,n){return re(e,t)>=0&&re(e,n)<=0}function Mt(e){if(!e)return"";const t=new Date(e).getTime(),r=Date.now()-t,a=Math.floor(r/(1e3*60*60)),i=Math.floor(r%(1e3*60*60)/(1e3*60));return a>0?`${a}h ${i}m`:`${i}m`}function Bt(e,t){if(!e)return"";const n=Date.now()-e,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?t("proxyStatusWidget.justNow"):r<60?t("proxyStatusWidget.minutesAgo",{count:r}):t("proxyStatusWidget.hoursAgo",{count:a})}function H({icon:e,tooltip:t,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return s.jsxs(Me,{children:[s.jsx(Be,{asChild:!0,children:s.jsx(ne,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:U("h-7 w-7 p-0",o==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:n,disabled:r,children:a?s.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(e,{className:"w-3.5 h-3.5"})})}),s.jsx(Ke,{side:"bottom",className:"text-xs",children:t})]})}function ts(){const{t:e}=Ee(),{data:t,isLoading:n}=ke(),{data:r}=Te(),{data:a,isLoading:i}=Ve(),o=Ie(),c=Pe(),d=$e(),u=Re(),{data:f}=Ut(),{mutate:E,isPending:T}=qt(),[m,p]=j.useState(!1),[S,b]=j.useState(""),[I,x]=j.useState(!1),[k,g]=j.useState(null),[C,R]=j.useState(null),{data:h}=fe({queryKey:["cliproxy-server-config"],queryFn:()=>He.cliproxyServer.get(),staleTime:3e4}),l=nt({mutationKey:["update-backend"]})>0,A=h?.remote,V=A?.enabled&&A?.host,N=t?.running??!1,$=o.isPending||c.isPending||d.isPending||u.isPending||l||T,v=r?.hasUpdate??!1,P=r?.isStable===!1,O=r?.currentVersion,W=f?.configured??!1,B=e(W?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),y=P?r?.maxStableVersion||a?.latestStable:r?.latestVersion,F=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",_=a?.faultyRange,be=_&&`${_.min.replace(/-\d+$/,"")}-${_.max.replace(/-\d+$/,"")}`,Z=(w,D)=>{g(w),R(D),x(!0)},ae=async w=>{if(!w)return;const D=te(w,F);if(_!==void 0&&se(w,_.min,_.max)){Z(w,"faulty");return}if(D){Z(w,"experimental");return}try{const ie=await u.mutateAsync({version:w});ie.requiresConfirmation&&Z(w,ie.isFaulty?"faulty":"experimental")}catch{}},je=()=>{k&&u.mutate({version:k,force:!0}),x(!1),g(null),R(null)},Se=()=>{x(!1),g(null),R(null)},Ne=V?(()=>{const w=A.protocol||"http",D=A.port||(w==="https"?443:80);return w==="https"&&D===443||w==="http"&&D===80?A.host:`${A.host}:${D}`})():null;return V?s.jsxs("div",{className:U("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(rt,{className:"w-4 h-4 text-blue-500"}),s.jsx("span",{className:"text-sm font-medium",children:e("proxyStatusWidget.remoteProxy")}),s.jsx(oe,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:e("proxyStatusWidget.active")})]}),s.jsx(at,{className:"w-3 h-3 text-blue-600"})]}),s.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[s.jsx("div",{className:"flex items-center gap-1 mb-1",children:s.jsx("span",{className:"font-mono",children:Ne})}),s.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:e("proxyStatusWidget.trafficAutoRouted")})]})]}):s.jsx(We,{delayDuration:300,children:s.jsxs("div",{className:U("rounded-lg border p-3 transition-colors",N?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:U("w-2 h-2 rounded-full",N?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),s.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[n?s.jsx(K,{className:"w-3 h-3 animate-spin text-muted-foreground"}):N?s.jsxs(s.Fragment,{children:[s.jsx(H,{icon:T?K:it,tooltip:e("proxyStatusWidget.tooltipSync"),onClick:()=>E(),disabled:!W||$,isPending:T}),s.jsx(H,{icon:ot,tooltip:e("proxyStatusWidget.tooltipRestart"),onClick:()=>d.mutate(),disabled:$,isPending:d.isPending}),s.jsx(H,{icon:lt,tooltip:e("proxyStatusWidget.tooltipStop"),onClick:()=>c.mutate(),disabled:$,isPending:c.isPending,variant:"destructive-ghost"})]}):null,s.jsx(H,{icon:m?ct:ut,tooltip:e(m?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>p(!m),className:m?"bg-muted":void 0})]})]}),O&&s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[s.jsxs("span",{className:U("text-xs font-mono text-muted-foreground",P&&"text-amber-600 dark:text-amber-400"),children:["v",O]}),(v||P)&&y&&s.jsxs(oe,{variant:"secondary",className:U("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",P?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>void ae(y),title:e(P?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[P?s.jsx(dt,{className:"w-2.5 h-2.5"}):s.jsx(pt,{className:"w-2.5 h-2.5"}),y]})]}),N&&t&&s.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[s.jsx("span",{className:"flex items-center gap-1",children:e("proxyStatusWidget.port",{port:t.port})}),t.sessionCount!==void 0&&t.sessionCount>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(mt,{className:"w-3 h-3"}),e("proxyStatusWidget.sessionCount",{count:t.sessionCount})]}),t.startedAt&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(xt,{className:"w-3 h-3"}),Mt(t.startedAt)]})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[W?s.jsx(ft,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):s.jsx(gt,{className:"w-3 h-3 text-muted-foreground"}),s.jsx("span",{className:U("text-xs",W?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:B})]}),s.jsx(De,{open:m,onOpenChange:p,children:s.jsxs(Oe,{className:"mt-3 pt-3 border-t border-muted",children:[s.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:e("proxyStatusWidget.versionManagement")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Fe,{value:S,onValueChange:b,disabled:i,children:[s.jsx(_e,{className:"h-8 text-xs flex-1",children:s.jsx(Le,{placeholder:e("proxyStatusWidget.selectVersionPlaceholder")})}),s.jsx(Ue,{children:a?.versions.slice(0,20).map(w=>{const D=a?.maxStableVersion&&te(w,a.maxStableVersion),Q=a?.faultyRange&&se(w,a.faultyRange.min,a.faultyRange.max);return s.jsx(qe,{value:w,className:"text-xs",children:s.jsxs("span",{className:"flex items-center gap-2",children:["v",w,w===a.latestStable&&s.jsx("span",{className:"text-green-600 dark:text-green-400",children:e("proxyStatusWidget.stable")}),(Q||D)&&s.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},w)})})]}),s.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void ae(S),disabled:u.isPending||!S,children:[u.isPending?s.jsx(K,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(ht,{className:"w-3.5 h-3.5"}),e("proxyStatusWidget.install")]})]}),S&&a?.maxStableVersion&&te(S,a.maxStableVersion)&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[s.jsx(J,{className:"w-3.5 h-3.5 flex-shrink-0"}),s.jsx("span",{children:e("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),S&&a?.faultyRange&&se(S,a.faultyRange.min,a.faultyRange.max)&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[s.jsx(J,{className:"w-3.5 h-3.5 flex-shrink-0"}),s.jsx("span",{children:e("proxyStatusWidget.versionsKnownIssues",{version:S})})]}),r?.checkedAt&&s.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:e("proxyStatusWidget.lastChecked",{time:Bt(r.checkedAt,e)})})]})}),!N&&s.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:e("proxyStatusWidget.notRunning")}),s.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>o.mutate(),disabled:o.isPending,children:[o.isPending?s.jsx(K,{className:"w-3 h-3 animate-spin"}):s.jsx(yt,{className:"w-3 h-3"}),e("proxyStatusWidget.start")]})]}),s.jsx(ze,{open:I,onOpenChange:x,children:s.jsxs(Ye,{children:[s.jsxs(Ze,{children:[s.jsxs(Qe,{className:"flex items-center gap-2",children:[s.jsx(J,{className:"w-5 h-5 text-amber-500"}),e(C==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),s.jsxs(Ge,{className:"space-y-2",children:[C==="faulty"?s.jsx("p",{children:s.jsx(ue,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:k??"",range:be||""},components:{strong:s.jsx("strong",{})}})}):s.jsx("p",{children:s.jsx(ue,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:k??"",maxStable:F},components:{strong:s.jsx("strong",{})}})}),s.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:e(C==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),s.jsx("p",{children:e("proxyStatusWidget.installUnstableConfirm")})]})]}),s.jsxs(Xe,{children:[s.jsx(Je,{onClick:Se,children:e("proxyStatusWidget.cancel")}),s.jsx(et,{onClick:je,className:"bg-amber-500 hover:bg-amber-600 text-white",children:e("proxyStatusWidget.installAnyway")})]})]})})]})})}export{Ft as A,Jt as D,ts as P,Ot as R,Xt as a,es as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n}from"./radix-ui-Dt3edmE5.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{e as P,f as Q,d as $,c as w,g as B,I as G,n as H}from"./index-
|
|
1
|
+
import{j as n}from"./radix-ui-Dt3edmE5.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{e as P,f as Q,d as $,c as w,g as B,I as G,n as H}from"./index-Dz76Rk36.js";import{aD as L,ak as V,l as J}from"./icons-DtwH984l.js";function S(o){return o.trim().toLowerCase()}function M(o,h){return`${o}-option-${h.replace(/[^a-z0-9_-]+/gi,"-")}`}function ee({value:o,onChange:h,options:d,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,u]=a.useState(),m=a.useId(),D=a.useRef(null),I=a.useRef({}),N=a.useMemo(()=>d.find(e=>e.value===o),[d,o]),f=a.useMemo(()=>{const e=S(y);return e?d.filter(t=>[t.searchText,...t.keywords??[]].some(c=>S(c).includes(e))):d},[d,y]),z=a.useMemo(()=>{const e=new Map((g??[]).map(r=>[r.key,r])),t=f.filter(r=>!r.groupKey||!e.has(r.groupKey)),c=(g??[]).map(r=>({...r,options:f.filter(x=>x.groupKey===r.key)})).filter(r=>r.options.length>0);return t.length===0?c:[{key:"__default",options:t},...c]},[f,g]),s=a.useMemo(()=>f.filter(e=>!e.disabled),[f]),O=N?.triggerContent??N?.itemContent,v=e=>{T(e),e||(A(""),u(void 0))},b=()=>D.current?.focus();a.useEffect(()=>{if(l){if(s.length===0){u(void 0);return}u(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||I.current[i]?.scrollIntoView({block:"nearest"})},[i,l]);const p=e=>{if(s.length===0)return;if(e==="first"){u(s[0]?.value);return}if(e==="last"){u(s.at(-1)?.value);return}const t=s.findIndex(_=>_.value===i),c=e==="next"?-1:s.length,r=t>=0?t:c,x=e==="next"?Math.min(r+1,s.length-1):Math.max(r-1,0);u(s[x]?.value)},C=e=>{h(e),v(!1)},U=()=>{if(!i)return;const e=s.find(t=>t.value===i);e&&C(e.value)};return n.jsxs(P,{open:l,onOpenChange:v,children:[n.jsx(Q,{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,!O&&"text-muted-foreground"),children:[n.jsx("div",{className:"min-w-0 flex-1 text-left",children:O??n.jsx("span",{children:j})}),n.jsx(L,{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(V,{className:"text-muted-foreground absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2"}),n.jsx(G,{ref:D,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(),U();return}e.key==="Escape"&&(e.preventDefault(),v(!1))},placeholder:k,className:"pl-8"})]})}),n.jsx(H,{className:"max-h-72",children:f.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 c=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=>{I.current[t.value]=x},onMouseMove:()=>{t.disabled||u(t.value)},onFocus:()=>{t.disabled||u(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",c&&"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(J,{className:"h-4 w-4 shrink-0"})]},t.value)})]},e.key))})})]})]})}export{ee as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i,_ as n}from"./radix-ui-Dt3edmE5.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-
|
|
1
|
+
import{j as i,_ as n}from"./radix-ui-Dt3edmE5.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-Dz76Rk36.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-Dt3edmE5.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as Q,bb as ee,bc as se,bd as te,Q as ae,R as re,U as ne,B as $,b3 as S,b4 as M,b5 as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-ByjiTTw6.js";import{$ as ce,a4 as oe,aR as me,T as E,R as T,F as he,ak as ue,x as xe}from"./icons-DtwH984l.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";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-Dt3edmE5.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as Q,b9 as ee,ba as se,bb as te,Q as ae,R as re,U as ne,B as $,b1 as S,b2 as M,b3 as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-Dz76Rk36.js";import{$ as ce,a4 as oe,aR as me,T as E,R as T,F as he,ak as ue,x as xe}from"./icons-DtwH984l.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";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 a,a1 as s,a2 as n}from"./radix-ui-Dt3edmE5.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-
|
|
1
|
+
import{j as a,a1 as s,a2 as n}from"./radix-ui-Dt3edmE5.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-Dz76Rk36.js";function c({className:t,...r}){return a.jsx(s,{"data-slot":"switch",className:e("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:a.jsx(n,{"data-slot":"switch-thumb",className:e("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{c as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,be as M,C as g,j,k as N,_ as w,b as v,n as b,bf as U,bg as z,I as B,bh as L}from"./index-ByjiTTw6.js";import{Y as $,Q,aS as Y,v as q,E as G,I as J,a4 as V,C as F,aT as H,ak as K}from"./icons-DtwH984l.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const W={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function X({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",W[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function T({state:s,className:a}){const{t}=p(),d={new:{label:t("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:t("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:t("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx($,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsx(T,{state:a}),e.jsx(X,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(q,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:M(s.publishedAt)}),e.jsx(T,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...z].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,R]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{R(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:O})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{value:l,onChange:r=>n(r.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?L(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|
|
1
|
+
import{j as e}from"./radix-ui-Dt3edmE5.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,bc as M,C as g,j,k as N,_ as w,b as v,n as b,bd as U,be as z,I as B,bf as L}from"./index-Dz76Rk36.js";import{Y as $,Q,aS as Y,v as q,E as G,I as J,a4 as V,C as F,aT as H,ak as K}from"./icons-DtwH984l.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const W={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function X({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",W[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function T({state:s,className:a}){const{t}=p(),d={new:{label:t("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:t("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:t("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx($,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsx(T,{state:a}),e.jsx(X,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(q,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:M(s.publishedAt)}),e.jsx(T,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...z].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,R]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{R(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:O})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{value:l,onChange:r=>n(r.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?L(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|
package/dist/ui/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap"
|
|
25
25
|
rel="stylesheet"
|
|
26
26
|
/>
|
|
27
|
-
<script type="module" crossorigin src="/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-Dz76Rk36.js"></script>
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-CNOkPC89.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/radix-ui-Dt3edmE5.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/tanstack-B8i0evp-.js">
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/utils-CzKF5WmX.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/form-utils-Bcoyqxpq.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/code-highlight-BRUf_pqB.js">
|
|
36
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
36
|
+
<link rel="stylesheet" crossorigin href="/assets/index-OMV20t-1.css">
|
|
37
37
|
</head>
|
|
38
38
|
<body>
|
|
39
39
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaitranntt/ccs",
|
|
3
|
-
"version": "7.54.0-dev.
|
|
3
|
+
"version": "7.54.0-dev.8",
|
|
4
4
|
"description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"build:server": "tsc && node scripts/add-shebang.js",
|
|
59
59
|
"build:all": "bun run ui:build && bun run build:server",
|
|
60
60
|
"prebuild": "node scripts/clean-dist.js",
|
|
61
|
+
"prebuild:server": "node scripts/clean-dist.js",
|
|
61
62
|
"prebuild:all": "rm -rf dist tsconfig.tsbuildinfo",
|
|
62
63
|
"postbuild:all": "node scripts/verify-bundle.js",
|
|
63
64
|
"typecheck": "tsc --noEmit",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as o}from"./react-vendor-CNOkPC89.js";import{a as Be,u as fs,b as $s}from"./tanstack-B8i0evp-.js";import{d as R,C as js,b as vs,c as B,P as Ae,a as Z,a8 as ee,L as X,I as le,r as Ns,s as ys,t as ws,v as bs,w as Ie,a9 as ks,aa as Qs,ab as zs,ac as Js,u as Cs,ad as Ve,ae as Ge,af as $e,ag as Qe,ah as As,ai as ns,aj as Ws,ak as Ys,W as Ss,al as Fe,am as Ps,Y as be,B as G,an as Ue,ao as is,ap as Xs,aq as Zs,ar as et,as as st,at as tt,x as Ms,n as ze,au as at,av as nt,aw as it,m as rt,ax as ot,ay as lt,az as ct,aA as dt,aB as ut,aC as mt,aD as xt,aE as pe,T as he,p as ge,q as fe,aF as pt,aG as ht,aH as gt,aI as rs,aJ as ft,aK as jt,aL as vt,aM as Nt,aN as yt,aO as wt,aP as bt,Q as kt,R as Ct,U as os,V as ls,aQ as At,aR as St,aS as Pt,aT as Mt,aU as Dt,aV as Tt,aW as Ot,aX as Et,aY as _t,aZ as Rt,a_ as Lt,a$ as It,S as Ft}from"./index-ByjiTTw6.js";import{C as He}from"./default-ports-1QQSffYX.js";import{t as q}from"./notifications-B2HqRBj7.js";import{C as Ds,L as W,o as me,Q as Ut,l as ce,n as Ts,as as Je,R as We,p as xe,a4 as ve,T as Se,a2 as Ht,at as Os,ar as qt,au as Pe,Z as Ne,O as Es,h as Kt,t as _s,av as Bt,aj as Vt,X as Ye,a3 as Rs,m as Gt,x as $t,y as Ls,z as qe,aw as Qt,u as cs,ax as zt,ai as Is,v as Jt,ay as ds,am as Wt,az as Fs}from"./icons-DtwH984l.js";import{R as ke,A as us,D as _e,i as Yt,a as Xt,P as Zt}from"./proxy-status-widget-DDqnLj1A.js";import{C as Ce}from"./checkbox-DnXEP66k.js";import{C as ea}from"./confirm-dialog-Caa-t7ys.js";import{S as Xe}from"./separator-Dn2TUYHv.js";import{S as sa}from"./searchable-select-DnAlFkH9.js";import{S as Us}from"./switch-CSo86CGn.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-C2kpeUmy.js";const je={agy:{provider:"agy",displayName:"Antigravity",defaultModel:"claude-opus-4-6-thinking",models:[{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",description:"Latest flagship, extended thinking",extendedContext:!1,presetMapping:{default:"claude-opus-4-6-thinking",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6",haiku:"claude-sonnet-4-6"}},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",description:"Latest Sonnet with thinking budget support",presetMapping:{default:"claude-sonnet-4-6",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6",haiku:"claude-sonnet-4-6"}},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",description:"Google latest model via Antigravity",extendedContext:!0,presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",description:"Fast Gemini model via Antigravity",extendedContext:!0,presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}}]},gemini:{provider:"gemini",displayName:"Gemini",defaultModel:"gemini-2.5-pro",models:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",tier:"paid",description:"Latest model, requires paid Google account",extendedContext:!0,presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",tier:"paid",description:"Fast Gemini 3 model, requires paid Google account",extendedContext:!0,presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",description:"Stable, works with free Google account",extendedContext:!0,presetMapping:{default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-2.5-flash"}}]},codex:{provider:"codex",displayName:"Codex",defaultModel:"gpt-5.3-codex",models:[{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",description:"Supports up to xhigh effort",presetMapping:{default:"gpt-5.3-codex",opus:"gpt-5.3-codex",sonnet:"gpt-5.3-codex",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",description:"Previous stable Codex model",presetMapping:{default:"gpt-5.2-codex",opus:"gpt-5.2-codex",sonnet:"gpt-5.2-codex",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"Fast, capped at high effort (no xhigh)",presetMapping:{default:"gpt-5-mini",opus:"gpt-5.3-codex",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}},{id:"gpt-5.1-codex-max",name:"Codex Max (5.1)",description:"Legacy most capable Codex model",presetMapping:{default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5.2",name:"GPT 5.2",description:"Latest GPT model",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.2",haiku:"gpt-5.2"}},{id:"gpt-5.1-codex-mini",name:"Codex Mini",description:"Fast and efficient Codex model"}]},qwen:{provider:"qwen",displayName:"Qwen",defaultModel:"qwen3-coder-plus",models:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus",description:"Code-focused model (1M context)",presetMapping:{default:"qwen3-coder-plus",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max",name:"Qwen3 Max",description:"Flagship model (256K context)",presetMapping:{default:"qwen3-max",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max-preview",name:"Qwen3 Max Preview",description:"Preview with thinking support (256K)",presetMapping:{default:"qwen3-max-preview",opus:"qwen3-max-preview",sonnet:"qwen3-max",haiku:"qwen3-coder-flash"}},{id:"qwen3-235b",name:"Qwen3 235B",description:"Large 235B A22B model",presetMapping:{default:"qwen3-235b",opus:"qwen3-max",sonnet:"qwen3-235b",haiku:"qwen3-coder-flash"}},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus",description:"Vision-language multimodal"},{id:"qwen3-coder-flash",name:"Qwen3 Coder Flash",description:"Fast code generation"},{id:"qwen3-32b",name:"Qwen3 32B",description:"Qwen3 32B model"}]},iflow:{provider:"iflow",displayName:"iFlow",defaultModel:"qwen3-coder-plus",models:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus",description:"Recommended default for iFlow accounts",presetMapping:{default:"qwen3-coder-plus",opus:"qwen3-coder-plus",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-plus"}},{id:"qwen3-max",name:"Qwen3 Max",description:"Flagship Qwen model via iFlow"},{id:"kimi-k2",name:"Kimi K2",description:"Kimi model currently available via iFlow"},{id:"deepseek-v3.2",name:"DeepSeek V3.2",description:"Current DeepSeek V3.2 model via iFlow"},{id:"deepseek-r1",name:"DeepSeek R1",description:"Reasoning-focused DeepSeek model"},{id:"glm-4.6",name:"GLM 4.6",description:"Zhipu GLM 4.6 via iFlow"},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus",description:"Vision-language model"}]},kimi:{provider:"kimi",displayName:"Kimi (Moonshot)",defaultModel:"kimi-k2.5",models:[{id:"kimi-k2.5",name:"Kimi K2.5",description:"Latest multimodal model (262K context)",presetMapping:{default:"kimi-k2.5",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",description:"Extended reasoning model",presetMapping:{default:"kimi-k2-thinking",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2",name:"Kimi K2",description:"Flagship coding model"}]},kiro:{provider:"kiro",displayName:"Kiro (AWS)",defaultModel:"kiro-claude-sonnet-4-5",models:[{id:"kiro-claude-opus-4-5",name:"Kiro Claude Opus 4.5",description:"Claude Opus 4.5 via Kiro (2.2x credit)",presetMapping:{default:"kiro-claude-opus-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4-5",name:"Kiro Claude Sonnet 4.5",description:"Claude Sonnet 4.5 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4",name:"Kiro Claude Sonnet 4",description:"Claude Sonnet 4 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-haiku-4-5",name:"Kiro Claude Haiku 4.5",description:"Claude Haiku 4.5 via Kiro (0.4x credit)"}]},ghcp:{provider:"ghcp",displayName:"GitHub Copilot (OAuth)",defaultModel:"claude-sonnet-4.5",models:[{id:"claude-opus-4.5",name:"Claude Opus 4.5",description:"Anthropic Claude Opus 4.5 via GitHub Copilot",presetMapping:{default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",description:"Anthropic Claude Sonnet 4.5 via GitHub Copilot",presetMapping:{default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4",name:"Claude Sonnet 4",description:"Anthropic Claude Sonnet 4 via GitHub Copilot"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",description:"Anthropic Claude Haiku 4.5 via GitHub Copilot"},{id:"gpt-5.2",name:"GPT-5.2",description:"OpenAI GPT-5.2 via GitHub Copilot",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"}},{id:"gpt-5.1",name:"GPT-5.1",description:"OpenAI GPT-5.1 via GitHub Copilot"},{id:"gpt-5",name:"GPT-5",description:"OpenAI GPT-5 via GitHub Copilot"},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"OpenAI GPT-5 Mini via GitHub Copilot"},{id:"gemini-3-pro",name:"Gemini 3 Pro",description:"Google Gemini 3 Pro via GitHub Copilot"}]},claude:{provider:"claude",displayName:"Claude (Anthropic)",defaultModel:"claude-sonnet-4-6",models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",description:"Latest flagship model",extendedContext:!0,presetMapping:{default:"claude-opus-4-6",opus:"claude-opus-4-6",sonnet:"claude-sonnet-4-6",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",description:"Balanced performance and speed",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-6",opus:"claude-opus-4-6",sonnet:"claude-sonnet-4-6",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",description:"Most capable Claude model",extendedContext:!0,presetMapping:{default:"claude-opus-4-5-20251101",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",description:"Balanced performance and speed",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-5-20250929",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",description:"Previous generation Sonnet",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-20250514",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-20250514",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",description:"Fast and efficient"}]}},Re="ccs-internal-managed";async function ta(){try{const s=await fetch("/api/settings/auth/tokens/raw");return s.ok?(await s.json())?.apiKey?.value??Re:Re}catch{return Re}}async function Ke(s,t){const a=je[s];if(!a)return{success:!1};const n=a.models.find(m=>m.id===a.defaultModel)||a.models[0],i=n?.presetMapping||{default:a.defaultModel,opus:a.defaultModel,sonnet:a.defaultModel,haiku:a.defaultModel},d=await ta(),r={env:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${He}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:d,ANTHROPIC_MODEL:i.default,ANTHROPIC_DEFAULT_OPUS_MODEL:i.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:i.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:i.haiku}};try{return{success:(await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:r})})).ok,presetName:n?.name||a.defaultModel}}catch{return{success:!1}}}function aa({currentProgress:s,allSteps:t}){return e.jsx("div",{className:"flex justify-center gap-1 pt-2",children:t.map((a,n)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${s>=n?"bg-primary":"bg-muted"}`},a))})}function na({providers:s,onSelect:t}){return e.jsx("div",{className:"grid gap-2",children:s.map(a=>e.jsxs("button",{onClick:()=>t(a.id),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:a.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:a.description})]}),e.jsx(Ds,{className:"w-4 h-4 text-muted-foreground"})]},a.id))})}function ia({selectedProvider:s,providers:t,authCommand:a,isRefreshing:n,isPending:i,onBack:d,onStartAuth:u,onRefresh:r}){const[m,h]=o.useState(!1),w=async g=>{await navigator.clipboard.writeText(g),h(!0),setTimeout(()=>h(!1),2e3)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Authenticate with ",t.find(g=>g.id===s)?.name," to add an account"]}),e.jsx(R,{onClick:u,disabled:i,className:"w-full gap-2",size:"lg",children:i?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-4 h-4"}),"Authenticate in Browser"]})}),i&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Complete the OAuth flow in your browser..."})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or use terminal"})})]}),e.jsx(js,{children:e.jsxs(vs,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Ut,{className:"w-4 h-4"}),"Run this command in your terminal:"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 bg-muted rounded-md font-mono text-sm",children:a}),e.jsx(R,{variant:"outline",size:"icon",onClick:()=>w(a),children:m?e.jsx(ce,{className:"w-4 h-4 text-green-500"}):e.jsx(Ts,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(R,{variant:"ghost",onClick:d,disabled:i,children:[e.jsx(Je,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(R,{variant:"outline",onClick:r,disabled:n||i,children:[e.jsx(We,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),n?"Checking...":"Refresh Status"]})]})]})}function ra({accounts:s,privacyMode:t,onSelect:a,onAddNew:n,onBack:i}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Select an account (",s.length,")"]}),e.jsx("div",{className:"grid gap-2 max-h-[320px] overflow-y-auto pr-1",children:s.map(d=>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(xe,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:B("font-medium",t&&Ae),children:d.email||d.id}),d.isDefault&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Default account"})]})]}),e.jsx(Ds,{className:"w-4 h-4 text-muted-foreground"})]},d.id))}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or"})})]}),e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 p-3 border-2 border-dashed border-primary/50 rounded-lg hover:border-primary hover:bg-primary/5 transition-colors text-left",onClick:n,children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(me,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-primary",children:"Add new account"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Authenticate with a different account"})]})]}),e.jsx("div",{className:"flex items-center justify-between pt-2",children:e.jsxs(R,{variant:"ghost",onClick:i,children:[e.jsx(Je,{className:"w-4 h-4 mr-2"}),"Back"]})})]})}const ms="__custom__";function oa({selectedProvider:s,selectedAccount:t,variantName:a,modelName:n,isPending:i,privacyMode:d,onVariantNameChange:u,onModelChange:r,onBack:m,onSkip:h,onCreate:w}){const{t:g}=Z(),l=je[s]?.models||[],x=n&&!l.some(j=>j.id===n),[N,b]=o.useState(x),y=s==="agy"&&n.trim().length>0?ee(n):!1,f=j=>{j===ms?(b(!0),r("")):(b(!1),r(j))};return e.jsxs("div",{className:"space-y-4",children:[t&&e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx(xe,{className:"w-4 h-4"}),e.jsxs("span",{children:[g("setupVariant.using")," ",e.jsx("span",{className:B(d&&Ae),children:t.email||t.id})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"variant-name",children:g("setupVariant.variantNameRequired")}),e.jsx(le,{id:"variant-name",value:a,onChange:j=>u(j.target.value),placeholder:g("setupVariant.variantNamePlaceholder")}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[g("setupVariant.invokeHintPrefix")," ccs ",a||"<name>",' "prompt"']})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{children:g("setupVariant.model")}),N?e.jsxs("div",{className:"space-y-2",children:[e.jsx(le,{value:n,onChange:j=>r(j.target.value),placeholder:g("setupVariant.modelPlaceholder")}),y&&e.jsx("p",{className:"text-xs text-destructive",children:"Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated."}),e.jsx("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:()=>{b(!1),s==="agy"&&ee(n)&&r("")},children:g("setupVariant.choosePresetInstead")})]}):e.jsxs(Ns,{value:l.some(j=>j.id===n)?n:"",onValueChange:f,children:[e.jsx(ys,{children:e.jsx(ws,{placeholder:g("setupVariant.selectModel")})}),e.jsxs(bs,{children:[l.map(j=>e.jsx(Ie,{value:j.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:j.name}),j.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",j.description]})]})},j.id)),e.jsx(Ie,{value:ms,children:e.jsx("span",{className:"text-primary",children:g("setupVariant.customModelName")})})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:N?g("setupVariant.enterAnyModel"):g("setupVariant.defaultModel",{model:je[s]?.defaultModel||g("setupVariant.providerDefault")})})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(R,{variant:"ghost",onClick:m,children:[e.jsx(Je,{className:"w-4 h-4 mr-2"}),g("setupVariant.back")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{variant:"ghost",onClick:h,children:g("setupVariant.skip")}),e.jsx(R,{onClick:w,disabled:!a||i||y,children:g(i?"setupVariant.creating":"setupVariant.createVariant")})]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:g("setupVariant.skipHint")})]})}function la({variantName:s,onClose:t}){return e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center",children:e.jsx(ce,{className:"w-8 h-8 text-green-600 dark:text-green-400"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-lg",children:"Variant Created!"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Your custom variant is ready to use"})]}),e.jsx(js,{children:e.jsxs(vs,{className:"p-4 space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Usage:"}),e.jsxs("code",{className:"block px-3 py-2 bg-muted rounded-md font-mono text-sm",children:["ccs ",s,' "your prompt here"']})]})}),e.jsx(R,{onClick:t,className:"w-full",children:"Done"})]})}function ca({open:s,onClose:t}){const[a,n]=o.useState("provider"),[i,d]=o.useState(""),[u,r]=o.useState(null),[m,h]=o.useState(""),[w,g]=o.useState(""),[l,x]=o.useState(!1),[N,b]=o.useState(!1),{data:y,refetch:f}=ks(),j=Qs(),E=zs(),A=Js(),{privacyMode:F}=Cs(),P=y?.authStatus.find(D=>D.provider===i),p=o.useMemo(()=>P?.accounts||[],[P?.accounts]);o.useEffect(()=>{if(!s){const D=setTimeout(()=>{n("provider"),d(""),r(null),h(""),g(""),b(!1)},0);return()=>clearTimeout(D)}},[s]),o.useEffect(()=>{if(a==="auth"&&p.length>0&&!N){const D=setTimeout(()=>{n("account")},0);return()=>clearTimeout(D)}},[a,p,N]);const U=async()=>{x(!0),await f(),x(!1)},k=()=>{const D=(P?.accounts?.length||0)===0;E.mutate({provider:i},{onSuccess:async _=>{if(D){const H=await Ke(i);H.success&&H.presetName?q.success(`Applied "${H.presetName}" preset`):H.success||q.warning(Ss.t("commonToast.accountAddedPresetFailed"))}_.account&&(r(_.account),n("variant")),f()}})},S=D=>{d(D),(y?.authStatus.find(V=>V.provider===D)?.accounts||[]).length===0?n("auth"):n("account")},O=D=>{r(D),n("variant")},v=async()=>{if(!(!m||!i))try{await j.mutateAsync({name:m,provider:i,model:w||void 0,account:u?.id}),n("success")}catch(D){console.error("Failed to create variant:",D)}},C=`ccs ${i} --auth --add`,K=Ys(a),I=D=>{if(!D&&(E.isPending&&i&&A.mutate(i),a==="success"||a==="provider")){t();return}};return e.jsx(Ve,{open:s,onOpenChange:I,children:e.jsxs(Ge,{className:"sm:max-w-lg",onPointerDownOutside:D=>{a!=="success"&&a!=="provider"&&D.preventDefault()},onEscapeKeyDown:D=>{(E.isPending||j.isPending)&&D.preventDefault()},children:[e.jsxs($e,{children:[e.jsxs(Qe,{className:"flex items-center gap-2",children:[e.jsx(ve,{className:"w-5 h-5 text-primary"}),"Quick Setup Wizard"]}),e.jsxs(As,{children:[a==="provider"&&"Select a provider to get started",a==="auth"&&"Authenticate with your provider",a==="account"&&"Select which account to use",a==="variant"&&"Create your custom variant",a==="success"&&"Setup complete!"]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[a==="provider"&&e.jsx(na,{providers:ns,onSelect:S}),a==="auth"&&e.jsx(ia,{selectedProvider:i,providers:ns,authCommand:C,isRefreshing:l,isPending:E.isPending,onBack:()=>n("provider"),onStartAuth:k,onRefresh:U}),a==="account"&&e.jsx(ra,{accounts:p,privacyMode:F,onSelect:O,onAddNew:()=>{b(!0),n("auth")},onBack:()=>n("provider")}),a==="variant"&&e.jsx(oa,{selectedProvider:i,selectedAccount:u,variantName:m,modelName:w,isPending:j.isPending,privacyMode:F,onVariantNameChange:h,onModelChange:g,onBack:()=>p.length>0?n("account"):n("provider"),onSkip:t,onCreate:v}),a==="success"&&e.jsx(la,{variantName:m,onClose:t})]}),e.jsx(aa,{currentProgress:K,allSteps:Ws})]})})}const da=3e3,ua=300*1e3;async function Le(s){const t=await s.text();if(!t)return{};try{return JSON.parse(t)}catch{const a=s.status>=400?`Request failed with status ${s.status}`:void 0;return a?{error:a}:{}}}const oe={provider:null,isAuthenticating:!1,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:!1};function ma(){const[s,t]=o.useState(oe),a=o.useRef(null),n=o.useRef(null),i=o.useRef(0),d=o.useRef(!1),u=Be(),r=o.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);o.useEffect(()=>()=>{a.current?.abort(),r(),d.current=!1},[r]);const m=o.useCallback(async(l,x)=>{if(Date.now()-i.current>ua){r(),t(N=>({...N,isAuthenticating:!1,error:"Authentication timed out. Please try again."}));return}try{const b=await(await fetch(`/api/cliproxy/auth/${l}/status?state=${encodeURIComponent(x)}`)).json();if(b.status==="ok")r(),u.invalidateQueries({queryKey:["cliproxy-auth"]}),u.invalidateQueries({queryKey:["account-quota"]}),q.success(`${l} authentication successful`),d.current=!1,t(oe);else if(b.status==="auth_url"){const y=b.url||b.auth_url;y&&(t(f=>({...f,authUrl:y})),d.current||(d.current=!0,window.open(y,"_blank")))}else if(b.status==="device_code"){r();const y=b.user_code&&b.verification_url?`Open ${b.verification_url} and enter code: ${b.user_code}`:"Switch to Device Code method and try again.";q.error("Provider returned Device Code flow in callback mode"),t(f=>({...f,isAuthenticating:!1,error:y}))}else if(b.status==="error"){r();const y=b.error||"Authentication failed";q.error(y),t(f=>({...f,isAuthenticating:!1,error:y}))}}catch{}},[u,r]),h=o.useCallback(async(l,x)=>{if(!Fe(l)){t({...oe,error:`Unknown provider: ${l}`});return}a.current?.abort(),r(),d.current=!1;const N=new AbortController;a.current=N;const y=(x?.flowType||(Ps(l)?"device_code":"authorization_code"))==="device_code",f=x?.startEndpoint||(y?"start":"start-url"),j={nickname:x?.nickname,kiroMethod:x?.kiroMethod,riskAcknowledgement:x?.riskAcknowledgement};t({provider:l,isAuthenticating:!0,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:y});try{if(f==="start")fetch(`/api/cliproxy/auth/${l}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j),signal:N.signal}).then(async E=>{const A=await Le(E),F=A.success===!0;if(E.ok&&F)u.invalidateQueries({queryKey:["cliproxy-auth"]}),u.invalidateQueries({queryKey:["account-quota"]}),d.current=!1,t(oe);else{const P=typeof A.error=="string"?A.error:"Authentication failed";q.error(P),t(p=>({...p,isAuthenticating:!1,error:P}))}}).catch(E=>{if(E instanceof Error&&E.name==="AbortError")return;const A=E instanceof Error?E.message:"Authentication failed";q.error(A),t(F=>({...F,isAuthenticating:!1,error:A}))});else{const E=await fetch(`/api/cliproxy/auth/${l}/start-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j),signal:N.signal}),A=await Le(E),F=A.success===!0;if(!E.ok||!F){const U=typeof A.error=="string"?A.error:"Failed to start OAuth";throw new Error(U)}const P=typeof A.authUrl=="string"?A.authUrl:null,p=typeof A.state=="string"?A.state:null;t(U=>({...U,authUrl:P,oauthState:p})),P&&(d.current=!0,window.open(P,"_blank")),p&&(i.current=Date.now(),n.current=setInterval(()=>{m(l,p)},da))}}catch(E){if(E instanceof Error&&E.name==="AbortError"){d.current=!1,t(oe);return}const A=E instanceof Error?E.message:"Authentication failed";q.error(A),t(F=>({...F,isAuthenticating:!1,error:A}))}},[m,r,u]),w=o.useCallback(()=>{const l=s.provider;a.current?.abort(),r(),d.current=!1,t(oe),l&&be.cliproxy.auth.cancel(l).catch(()=>{})},[s.provider,r]),g=o.useCallback(async l=>{if(s.provider){t(x=>({...x,isSubmittingCallback:!0,error:null}));try{const x=await fetch(`/api/cliproxy/auth/${s.provider}/submit-callback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({redirectUrl:l})}),N=await Le(x),b=N.success===!0;if(x.ok&&b)r(),u.invalidateQueries({queryKey:["cliproxy-auth"]}),u.invalidateQueries({queryKey:["account-quota"]}),q.success(`${s.provider} authentication successful`),t(oe);else{const y=typeof N.error=="string"?N.error:"Callback submission failed";throw new Error(y)}}catch(x){const N=x instanceof Error?x.message:"Failed to submit callback";q.error(N),t(b=>({...b,isSubmittingCallback:!1,error:N}))}}},[s.provider,u,r]);return o.useMemo(()=>({...s,startAuth:h,cancelAuth:w,submitCallback:g}),[s,h,w,g])}function Hs({className:s,showAcknowledgement:t=!1,acknowledgementPhrase:a=ke,acknowledgementText:n="",onAcknowledgementTextChange:i,disabled:d=!1,showProxySettingsLink:u=!1}){const{t:r}=Z(),m=r("accountSafetyWarning.title"),h=r("accountSafetyWarning.subtitle"),w=r("accountSafetyWarning.firstLine"),g=r("accountSafetyWarning.secondLine"),l="https://github.com/kaitranntt/ccs/issues/509",x=r("accountSafetyWarning.issueLabel"),N=r("accountSafetyWarning.proxySettingsLabel");return e.jsxs("section",{role:"alert",className:B("relative overflow-hidden rounded-xl border border-amber-500/30 bg-gradient-to-br from-amber-50 via-background to-rose-50/70 shadow-sm dark:from-amber-950/20 dark:to-rose-950/20",s),children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-gradient-to-r from-amber-500 via-orange-500 to-rose-500"}),e.jsxs("div",{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-7 w-7 items-center justify-center rounded-md bg-amber-500/15 text-amber-700 dark:text-amber-400",children:e.jsx(Se,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold leading-5",children:m}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h})]})]}),e.jsx(G,{variant:"outline",className:"border-amber-500/40 text-amber-700 dark:text-amber-300",children:"High Risk"})]}),e.jsxs("div",{className:"space-y-2 text-sm leading-relaxed",children:[e.jsx("p",{children:w}),e.jsx("p",{className:"font-medium text-amber-900 dark:text-amber-200",children:g}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"CCS is provided as-is and does not take responsibility for suspension, bans, or access loss from upstream providers."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("a",{href:l,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-800 transition-colors hover:bg-amber-500/15 dark:text-amber-200",children:[x,e.jsx(me,{className:"h-3.5 w-3.5"})]}),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(Ht,{className:"h-3.5 w-3.5"}),N]}),e.jsx("span",{className:"rounded-md border border-border/70 bg-muted/60 px-2.5 py-1 text-xs text-muted-foreground",children:"Applies to CLI and dashboard auth"})]}),t&&i&&e.jsxs("div",{className:"rounded-lg border border-amber-500/25 bg-amber-500/5 p-2.5",children:[e.jsxs(X,{htmlFor:"account-risk-ack-text",className:"text-xs leading-5",children:["Type exact phrase to continue:"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:a})]}),e.jsx(le,{id:"account-risk-ack-text",value:n,onChange:b=>i(b.target.value),placeholder:a,disabled:d,className:"mt-2 font-mono text-xs"})]})]})]})}function xa({className:s,value:t,onChange:a,disabled:n=!1}){const{t:i}=Z(),d=[t.reviewedIssue509,t.understandsBanRisk,t.acceptsFullResponsibility,t.typedPhrase.trim().replace(/\s+/g," ").toUpperCase()===us].filter(Boolean).length,u=d/4*100,r=m=>{a({...t,...m})};return e.jsxs("section",{role:"alert",className:B("relative overflow-hidden rounded-xl border border-rose-500/35 bg-gradient-to-br from-rose-50 via-background to-amber-50/70 p-4 shadow-sm dark:from-rose-950/20 dark:to-amber-950/20",s),children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-gradient-to-r from-rose-500 via-orange-500 to-amber-500"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-7 w-7 items-center justify-center rounded-md bg-rose-500/15 text-rose-700 dark:text-rose-300",children:e.jsx(Se,{className:"h-4 w-4"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold leading-5",children:i("antigravityChecklist.title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i("antigravityChecklist.subtitle")})]})]}),e.jsx(G,{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(Ue,{value:u,className:"h-2"})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-rose-500/20 bg-rose-500/5 p-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-reviewed-issue",checked:t.reviewedIssue509,onCheckedChange:m=>r({reviewedIssue509:!!m}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-reviewed-issue",className:"text-xs leading-5",children:"Step 1: I reviewed issue #509 and understand AGY OAuth can trigger account bans/suspensions."})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-understands-risk",checked:t.understandsBanRisk,onCheckedChange:m=>r({understandsBanRisk:!!m}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-understands-risk",className:"text-xs leading-5",children:"Step 2: I understand this OAuth action is my own decision and I accept the upstream risk."})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ce,{id:"agy-step-accept-responsibility",checked:t.acceptsFullResponsibility,onCheckedChange:m=>r({acceptsFullResponsibility:!!m}),disabled:n}),e.jsx(X,{htmlFor:"agy-step-accept-responsibility",className:"text-xs leading-5",children:"Step 3: I accept full responsibility. CCS is not liable for suspension, bans, or access loss."})]})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-amber-500/25 bg-amber-500/5 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-amber-800 dark:text-amber-200",children:[e.jsx(Os,{className:"h-3.5 w-3.5"}),"Step 4: Type exact phrase to continue"]}),e.jsx(le,{value:t.typedPhrase,onChange:m=>r({typedPhrase:m.target.value}),placeholder:us,disabled:n,className:"font-mono text-xs"})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:e.jsxs("a",{href:"https://github.com/kaitranntt/ccs/issues/509",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-rose-500/30 bg-rose-500/10 px-2.5 py-1 font-medium text-rose-800 transition-colors hover:bg-rose-500/15 dark:text-rose-200",children:["Read issue #509",e.jsx(me,{className:"h-3.5 w-3.5"})]})})]})]})}function pa(s){return s.trim().replace(/\s+/g," ").toUpperCase()}function ha({open:s,onClose:t,provider:a,displayName:n,isFirstAccount:i=!1}){const[d,u]=o.useState(""),[r,m]=o.useState(""),[h,w]=o.useState(!1),[g,l]=o.useState(null),[x,N]=o.useState(""),[b,y]=o.useState(_e),[f,j]=o.useState(!1),[E,A]=o.useState(!1),[F,P]=o.useState(is),{t:p}=Z(),U=o.useRef(!1),k=ma(),S=Xs(),O=a==="kiro",v=a==="gemini",C=a==="agy"&&!f,K=a==="agy"&&E,I=Yt(b),D=pa(x)===ke,_=Ps(a),H=Zs(a),V=et(F),se=O?V.flowType==="device_code":_,z=k.isAuthenticating||S.isPending,Y=d.trim(),te=g||k.error,c=o.useCallback(async()=>{const M=await fetch("/api/settings/auth/antigravity-risk");if(!M.ok)throw new Error("Failed to load Antigravity power user setting");return(await M.json()).antigravityAckBypass===!0},[]),T=()=>{u(""),m(""),w(!1),l(null),N(""),y(_e),j(!1),A(!1),P(is),U.current=!1,t()};o.useEffect(()=>{s&&(N(""),y(_e),l(null))},[a,s]),o.useEffect(()=>{let M=!1;if(!s||a!=="agy"){j(!1),A(!1);return}return(async()=>{try{A(!0);const ae=await c();M||j(ae)}catch{M||j(!1)}finally{M||A(!1)}})(),()=>{M=!0}},[c,s,a]),o.useEffect(()=>{if(!s||a!=="agy"||!k.error||!f)return;const M=k.error.toLowerCase();if(!(M.includes("agy_risk_ack_required")||M.includes("responsibility acknowledgement")||M.includes("responsibility checklist")))return;let ae=!1;return(async()=>{try{A(!0);const ye=await c();if(ae)return;j(ye),ye||l("Power user mode is off. Complete the AGY checklist and retry.")}catch{if(ae)return;j(!1),l("Power user mode is off. Complete the AGY checklist and retry.")}finally{ae||A(!1)}})(),()=>{ae=!0}},[f,k.error,c,s,a]),o.useEffect(()=>{!k.isAuthenticating&&!k.error&&k.provider===null&&s&&U.current&&(U.current=!1,(async()=>{try{const ne=await Ke(a);ne.success&&ne.presetName&&i&&q.success(`Applied "${ne.presetName}" preset`)}catch{}T()})())},[k.isAuthenticating,k.error,k.provider]);const $=()=>{k.cancelAuth(),T()},de=async()=>{k.authUrl&&(await navigator.clipboard.writeText(k.authUrl),w(!0),setTimeout(()=>w(!1),2e3))},Me=()=>{r.trim()&&k.submitCallback(r.trim())},De=()=>{if(K){l("Loading Antigravity safety settings. Please wait a moment and retry.");return}if(C&&!I){l("Complete all Antigravity responsibility steps before authenticating this provider.");return}if(v&&!D){l(`Type "${ke}" to acknowledge the account safety warning before authenticating this provider.`);return}if(H&&!Y){l(`Nickname is required for ${n} accounts.`);return}l(null),U.current=!0,k.startAuth(a,{nickname:Y||void 0,kiroMethod:O?F:void 0,flowType:O?V.flowType:void 0,startEndpoint:O?V.startEndpoint:void 0,riskAcknowledgement:C?{version:Xt,reviewedIssue509:b.reviewedIssue509,understandsBanRisk:b.understandsBanRisk,acceptsFullResponsibility:b.acceptsFullResponsibility,typedPhrase:b.typedPhrase}:void 0})},Te=()=>{U.current=!0,S.mutate(void 0,{onSuccess:async()=>{const M=await Ke("kiro");M.success&&M.presetName&&i&&q.success(`Applied "${M.presetName}" preset`),T()}})},Oe=M=>{M||$()},J=k.isAuthenticating;return e.jsx(Ve,{open:s,onOpenChange:Oe,children:e.jsxs(Ge,{className:"sm:max-w-md",onInteractOutside:M=>{J&&M.preventDefault()},children:[e.jsxs($e,{children:[e.jsx(Qe,{children:p("addAccountDialog.title",{displayName:n})}),e.jsx(As,{children:p(O?"addAccountDialog.descKiro":se?"addAccountDialog.descDeviceCode":"addAccountDialog.descOauth")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[C&&!J&&e.jsx(xa,{value:b,onChange:M=>{y(M),l(null)},disabled:z}),a==="agy"&&f&&!J&&e.jsxs("div",{className:"rounded-lg border border-amber-400/35 bg-amber-50/70 p-3 text-xs text-amber-900 dark:border-amber-800/60 dark:bg-amber-950/25 dark:text-amber-100",children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 font-semibold",children:[e.jsx(Os,{className:"h-3.5 w-3.5"}),p("addAccountDialog.powerUserEnabled")]}),p("addAccountDialog.powerUserSkipped")]}),v&&!J&&e.jsx(Hs,{showAcknowledgement:!0,acknowledgementPhrase:ke,acknowledgementText:x,onAcknowledgementTextChange:M=>{N(M),l(null)},disabled:z}),O&&!J&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"kiro-auth-method",children:p("addAccountDialog.authMethod")}),e.jsxs(Ns,{value:F,onValueChange:M=>{P(M),l(null)},children:[e.jsx(ys,{id:"kiro-auth-method",children:e.jsx(ws,{placeholder:p("addAccountDialog.selectKiroAuthMethod")})}),e.jsx(bs,{children:st.map(M=>e.jsx(Ie,{value:M.id,children:M.label},M.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:V.description})]}),!J&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"nickname",children:p(H?"addAccountDialog.nicknameRequired":"addAccountDialog.nicknameOptional")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(le,{id:"nickname",value:d,onChange:M=>{u(M.target.value),l(null)},placeholder:p("addAccountDialog.nicknamePlaceholder"),disabled:z,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:p(H?"addAccountDialog.nicknameRequiredHint":"addAccountDialog.nicknameOptionalHint")})]}),J&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx(W,{className:"w-4 h-4 inline mr-2 animate-spin"}),p("addAccountDialog.waitingForAuth")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:k.isDeviceCodeFlow?p("addAccountDialog.deviceCodeHint"):p("addAccountDialog.browserHint")})]}),k.authUrl&&!k.isDeviceCodeFlow&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{className:"text-xs",children:p("addAccountDialog.openUrlLabel")}),e.jsxs("div",{className:"p-3 bg-muted rounded-md",children:[e.jsx("p",{className:"text-xs text-muted-foreground break-all font-mono line-clamp-3",children:k.authUrl}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(R,{variant:"outline",size:"sm",onClick:de,children:h?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(Ts,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.copy")]})}),e.jsxs(R,{variant:"outline",size:"sm",onClick:()=>{if(!k.authUrl)return;const M=window.open(k.authUrl,"_blank");(!M||M.closed||typeof M.closed>"u")&&q.warning(p("addAccountDialog.popupBlocked"),{duration:5e3})},children:[e.jsx(me,{className:"w-3 h-3 mr-1"}),p("addAccountDialog.open")]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"callback-url",className:"text-xs",children:p("addAccountDialog.redirectPasteLabel")}),e.jsx(le,{id:"callback-url",value:r,onChange:M=>m(M.target.value),placeholder:p("addAccountDialog.callbackPlaceholder"),className:"font-mono text-xs"}),e.jsx(R,{variant:"secondary",size:"sm",onClick:Me,disabled:!r.trim()||k.isSubmittingCallback,children:k.isSubmittingCallback?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-3 h-3 mr-1 animate-spin"}),p("addAccountDialog.submitting")]}):p("addAccountDialog.submitCallback")})]})]}),!k.authUrl&&!k.isDeviceCodeFlow&&e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:p("addAccountDialog.preparingUrl")})]}),te&&e.jsx("p",{className:"text-xs text-center text-destructive",children:te}),S.isPending&&e.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:[e.jsx(W,{className:"w-4 h-4 inline mr-2 animate-spin"}),p("addAccountDialog.importingToken")]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(R,{variant:"ghost",onClick:$,children:p("addAccountDialog.cancel")}),O&&!J&&e.jsx(R,{variant:"outline",onClick:Te,disabled:z,children:S.isPending?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-2 animate-spin"}),p("addAccountDialog.importing")]}):e.jsxs(e.Fragment,{children:[e.jsx(qt,{className:"w-4 h-4 mr-2"}),p("addAccountDialog.importFromIde")]})}),!J&&e.jsxs(R,{onClick:De,disabled:z||K||H&&!Y||C&&!I||v&&!D,children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),p("addAccountDialog.authenticate")]})]})]})]})})}const Ze="[1m]";function ga(s){return s.toLowerCase().startsWith("gemini-")}function es(s){return s.toLowerCase().endsWith(Ze.toLowerCase())}function fa(s){return!s||es(s)?s:`${s}${Ze}`}function qs(s){return s&&(es(s)?s.slice(0,-Ze.length):s)}const xs=["ANTHROPIC_MODEL"],ja=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function va(s){const t=s?.env||{};return ja.filter(a=>!t[a]?.trim())}function Na(s){const[t,a]=o.useState(null),[n,i]=o.useState(!1),d=Be(),{data:u,isLoading:r,refetch:m}=fs({queryKey:["settings",s],queryFn:async()=>{const S=await fetch(`/api/settings/${s}/raw`);return S.ok?S.json():{profile:s,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${s}/settings.json`}}}),h=u?.settings,w=o.useMemo(()=>t!==null?t:h?JSON.stringify(h,null,2):`{
|
|
2
|
-
"env": {}
|
|
3
|
-
}`,[t,h]),g=o.useCallback(S=>{a(S)},[]),l=o.useMemo(()=>{try{return JSON.parse(w)}catch{return h||{env:{}}}},[w,h]),x=l?.env?.ANTHROPIC_MODEL,N=l?.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,b=l?.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,y=l?.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,f=o.useMemo(()=>{const S=l?.env||{};return xs.some(O=>{const v=S[O];return v&&es(v)})},[l]),j=o.useCallback((S,O)=>{const v={...l?.env||{},[S]:O},C={...l,env:v};a(JSON.stringify(C,null,2))},[l]),E=o.useCallback(S=>{const O=l?.env||{},v={};for(const I of xs){const D=O[I];D&&(v[I]=S?fa(D):qs(D))}const C={...O,...v};delete C.CCS_EXTENDED_CONTEXT;const K={...l,env:C};a(JSON.stringify(K,null,2))},[l]),A=o.useCallback(S=>{const O={...l?.env||{},...S},v={...l,env:O};a(JSON.stringify(v,null,2))},[l]),F=o.useMemo(()=>{try{return JSON.parse(w),!0}catch{return!1}},[w]),P=o.useMemo(()=>t===null?!1:t!==JSON.stringify(h,null,2),[t,h]),p=o.useMemo(()=>va(l),[l]),U=$s({mutationFn:async()=>{const S=JSON.parse(w),O=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:S,expectedMtime:u?.mtime})});if(O.status===409)throw new Error("CONFLICT");if(!O.ok)throw new Error("Failed to save");return O.json()},onSuccess:S=>{d.invalidateQueries({queryKey:["settings",s]}),a(null),S?.warning?q.success("Settings saved",{description:S.warning}):q.success("Settings saved")},onError:S=>{S.message==="CONFLICT"?i(!0):q.error(S.message)}}),k=async S=>{i(!1),S?(await m(),U.mutate()):a(null)};return{data:u,isLoading:r,refetch:m,rawJsonContent:w,rawJsonEdits:t,isRawJsonValid:F,hasChanges:P,currentSettings:l,currentModel:x,opusModel:N,sonnetModel:b,haikuModel:y,extendedContextEnabled:f,toggleExtendedContext:E,handleRawJsonChange:g,updateEnvValue:j,updateEnvValues:A,saveMutation:{mutate:()=>U.mutate(),isPending:U.isPending},conflictDialog:n,setConflictDialog:i,handleConflictResolve:k,missingRequiredFields:p}}const ya=/-(medium|high|xhigh)$/i;function wa(s){if(!s)return;const t=s.trim().match(ya);if(t?.[1])return t[1].toLowerCase()}function ba(s){if(!s)return null;const t=wa(s);return t?{label:`Pinned ${t}`,explicit:!0}:{label:"Auto effort",explicit:!1}}function ka({label:s}){return e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1",children:s})}function we({modelId:s}){const t=ba(s);return t?e.jsx(G,{variant:t.explicit?"secondary":"outline",className:"text-[9px] h-4 px-1 uppercase",children:t.label}):null}function re({label:s,description:t,value:a,onChange:n,catalog:i,allModels:d,disabled:u}){const{t:r}=Z(),m=new Set(i?.models.map(x=>x.id)||[]),h=i?.provider==="codex",w=(i?.models??[]).map(x=>({value:x.id,groupKey:"recommended",searchText:`${x.id} ${x.name}`,keywords:[x.tier??"",i?.provider??""],triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:x.id}),h&&e.jsx(we,{modelId:x.id})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:x.id}),x.tier==="paid"&&e.jsx(ka,{label:r("providerModelSelector.paid")}),h&&e.jsx(we,{modelId:x.id})]})})),g=d.filter(x=>!m.has(x.id)).map(x=>({value:x.id,groupKey:"all",searchText:x.id,keywords:[x.owned_by],triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:x.id}),h&&e.jsx(we,{modelId:x.id})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:x.id}),h&&e.jsx(we,{modelId:x.id})]})})),l=w.length+g.length>0;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:s}),t&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:t})]}),e.jsx(sa,{value:a||void 0,onChange:n,disabled:u,placeholder:r("providerModelSelector.selectModel"),searchPlaceholder:r("searchableSelect.searchModels"),emptyText:r(l?"searchableSelect.noResults":"providerModelSelector.noModelsAvailable"),triggerClassName:"h-9",groups:[{key:"recommended",label:e.jsx("span",{className:"text-xs text-primary",children:r("providerModelSelector.recommended")})},{key:"all",label:e.jsx("span",{className:"text-xs text-muted-foreground",children:r("providerModelSelector.allModelsCount",{count:d.length})})}],options:[...w,...g]})]})}function Ca({open:s,onClose:t,currentValues:a,onApply:n,onSave:i,isSaving:d,catalog:u,allModels:r}){const{t:m}=Z(),[h,w]=o.useState(a),[g,l]=o.useState(""),x=N=>{N?(w(a),l("")):t()};return e.jsx(Ve,{open:s,onOpenChange:x,children:e.jsxs(Ge,{className:"sm:max-w-md",children:[e.jsx($e,{children:e.jsxs(Qe,{className:"flex items-center gap-2",children:[e.jsx(ve,{className:"w-4 h-4"}),m("customPresetDialog.title")]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"preset-name",children:m("customPresetDialog.presetNameOptional")}),e.jsx(le,{id:"preset-name",value:g,onChange:N=>l(N.target.value),placeholder:m("customPresetDialog.presetNamePlaceholder"),className:"text-sm"})]}),e.jsx(Xe,{}),u?.provider==="codex"&&e.jsxs("p",{className:"text-[11px] text-muted-foreground rounded-md border bg-muted/30 px-2.5 py-2",children:[m("customPresetDialog.codexTipPrefix")," ",e.jsx("code",{children:"-medium"}),", ",e.jsx("code",{children:"-high"}),", and"," ",e.jsx("code",{children:"-xhigh"})," ",m("customPresetDialog.codexTipSuffix")]}),e.jsx(re,{label:m("customPresetDialog.defaultModel"),description:m("customPresetDialog.defaultModelDesc"),value:h.default,onChange:N=>w({...h,default:N}),catalog:u,allModels:r}),e.jsx(re,{label:m("customPresetDialog.opusModel"),description:m("customPresetDialog.opusModelDesc"),value:h.opus,onChange:N=>w({...h,opus:N}),catalog:u,allModels:r}),e.jsx(re,{label:m("customPresetDialog.sonnetModel"),description:m("customPresetDialog.sonnetModelDesc"),value:h.sonnet,onChange:N=>w({...h,sonnet:N}),catalog:u,allModels:r}),e.jsx(re,{label:m("customPresetDialog.haikuModel"),description:m("customPresetDialog.haikuModelDesc"),value:h.haiku,onChange:N=>w({...h,haiku:N}),catalog:u,allModels:r})]}),e.jsxs(tt,{className:"gap-2 sm:gap-0",children:[e.jsx(R,{variant:"outline",onClick:t,children:m("customPresetDialog.cancel")}),i&&e.jsxs(R,{variant:"secondary",onClick:()=>i(h,g||void 0),disabled:d||!g.trim(),children:[d?e.jsx(W,{className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(Pe,{className:"w-4 h-4 mr-1"}),m("customPresetDialog.savePreset")]}),e.jsxs(R,{onClick:()=>n(h,g||void 0),children:[e.jsx(Ne,{className:"w-4 h-4 mr-1"}),m("customPresetDialog.applyPreset")]})]})]})})}function ue({label:s,command:t}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:s}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:t}),e.jsx(Ms,{value:t,size:"icon",className:"h-6 w-6"})]})]})}function Aa({provider:s,displayName:t,defaultTarget:a,data:n,authStatus:i}){const d=a||"claude",u=d==="droid";return e.jsx(ze,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(Es,{className:"w-4 h-4"}),"Provider Information"]}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:t})]}),n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:n.path}),e.jsx(Ms,{value:n.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Last Modified"}),e.jsx("span",{className:"text-xs",children:new Date(n.mtime).toLocaleString()})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),i.authenticated?e.jsxs(G,{variant:"outline",className:"w-fit text-green-600 border-green-200 bg-green-50",children:[e.jsx(Kt,{className:"w-3 h-3 mr-1"}),"Authenticated"]}):e.jsx(G,{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:d})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(ue,{label:"Run with prompt",command:`ccs ${s} "your prompt"`}),e.jsx(ue,{label:u?"Droid alias (explicit)":"Run on Droid",command:u?`ccsd ${s} "your prompt"`:`ccs ${s} --target droid "your prompt"`}),e.jsx(ue,{label:u?"Override to Claude":"Override target",command:`ccs ${s} --target claude "your prompt"`}),e.jsx(ue,{label:"Change model",command:`ccs ${s} --config`}),e.jsx(ue,{label:"Add account",command:`ccs ${s} --add`}),e.jsx(ue,{label:"List accounts",command:`ccs ${s} --accounts`})]})]})]})})}const Sa={sm:{container:"w-6 h-6",icon:"w-4 h-4",text:"text-xs"},md:{container:"w-8 h-8",icon:"w-5 h-5",text:"text-sm"},lg:{container:"w-12 h-12",icon:"w-8 h-8",text:"text-lg"}};function ss({provider:s,className:t,size:a="md"}){const n=at(s),i=Sa[a],d=nt(s);return e.jsx("div",{className:B("flex items-center justify-center rounded-md",d&&(it(s)?"bg-gray-900 p-1":"bg-white p-1"),i.container,t),children:d?e.jsx("img",{src:d,alt:`${s} logo`,className:B(i.icon,"object-contain")}):e.jsx("span",{className:B("font-semibold",n.textClass,i.text),children:n.letter})})}function Pa({displayName:s,logoProvider:t,provider:a,data:n,isLoading:i,hasChanges:d,isRawJsonValid:u,isSaving:r,isRemoteMode:m,port:h,onRefetch:w,onSave:g}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ss,{provider:t||a,size:"lg"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s}),m&&e.jsxs(G,{variant:"secondary",className:"text-xs gap-1 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:[e.jsx(_s,{className:"w-3 h-3"}),"Remote"]}),h&&e.jsxs(G,{variant:"outline",className:"text-xs gap-1 font-mono",children:[e.jsx(Bt,{className:"w-3 h-3"}),":",h]}),!m&&n?.path&&e.jsx(G,{variant:"outline",className:"text-xs",children:n.path.replace(/^.*[\\/]/,"")})]}),m?e.jsx("p",{className:"text-xs text-blue-600 dark:text-blue-400 mt-0.5",children:"Traffic auto-routed to remote server"}):n&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",new Date(n.mtime).toLocaleString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{variant:"ghost",size:"sm",onClick:w,disabled:i,children:e.jsx(We,{className:`w-4 h-4 ${i?"animate-spin":""}`})}),e.jsx(R,{size:"sm",onClick:g,disabled:r||!d||!u,children:r?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Vt,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function Ma({model:s,provider:t,enabled:a,onToggle:n,disabled:i,className:d}){if(!s?.extendedContext)return null;const u=ga(s.id);return e.jsxs("div",{className:B("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(Ne,{className:B("w-4 h-4",a?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:"text-sm font-medium",children:"Extended Context"}),e.jsx(G,{variant:a?"default":"secondary",className:"text-[10px] h-5 px-1.5",children:"1M tokens"})]}),e.jsx(Us,{checked:a,onCheckedChange:n,disabled:i})]}),e.jsxs("div",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[e.jsx(Es,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{children:"Enables 1M token context window instead of default 200K."}),e.jsx("p",{className:"text-[10px]",children:u?e.jsxs("span",{className:"text-primary",children:["Auto-enabled for ",t," Gemini models"]}):e.jsxs("span",{children:["Opt-in for ",t," Claude models via --1m flag"]})}),a&&e.jsx("p",{className:"text-amber-600 dark:text-amber-500",children:"Note: 2x input pricing applies for tokens beyond 200K"})]})]})]})}function Da({catalog:s,savedPresets:t,currentModel:a,opusModel:n,sonnetModel:i,haikuModel:d,providerModels:u,provider:r,extendedContextEnabled:m,onExtendedContextToggle:h,onApplyPreset:w,onUpdateEnvValue:g,onOpenCustomPreset:l,onDeletePreset:x,isDeletePending:N}){const b=s&&s.models.length>0||t.length>0,y=o.useMemo(()=>{if(!s||!a)return;const f=qs(a);return s.models.find(j=>j.id===f)},[s,a]);return e.jsxs(e.Fragment,{children:[b&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(ve,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s?.models.slice(0,4).map(f=>e.jsxs(R,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>{const j=f.presetMapping||{default:f.id,opus:f.id,sonnet:f.id,haiku:f.id};w({ANTHROPIC_MODEL:j.default,ANTHROPIC_DEFAULT_OPUS_MODEL:j.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:j.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:j.haiku})},children:[e.jsx(Ne,{className:"w-3 h-3"}),f.name]},f.id)),t.map(f=>e.jsxs("div",{className:"group relative",children:[e.jsxs(R,{variant:"secondary",size:"sm",className:"text-xs h-7 gap-1 pr-6",onClick:()=>{w({ANTHROPIC_MODEL:f.default,ANTHROPIC_DEFAULT_OPUS_MODEL:f.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:f.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:f.haiku})},children:[e.jsx(Pe,{className:"w-3 h-3 fill-current"}),f.name]}),e.jsx(R,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-7 w-5 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:j=>{j.stopPropagation(),x(f.name)},disabled:N,children:e.jsx(Ye,{className:"w-3 h-3"})})]},f.name)),e.jsxs(R,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1 border-primary/50 text-primary hover:bg-primary/10 hover:border-primary",onClick:l,children:[e.jsx(Rs,{className:"w-3 h-3"}),"Custom"]})]})]}),e.jsx(Xe,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),r==="codex"&&e.jsxs("p",{className:"text-[11px] text-muted-foreground mb-3 rounded-md border bg-muted/30 px-2.5 py-2",children:["Codex tip: suffixes ",e.jsx("code",{children:"-medium"}),", ",e.jsx("code",{children:"-high"}),", and ",e.jsx("code",{children:"-xhigh"})," ","pin reasoning effort. Unsuffixed models use Thinking settings."]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(re,{label:"Default Model",description:"Used when no specific tier is requested",value:a,onChange:f=>g("ANTHROPIC_MODEL",f),catalog:s,allModels:u}),y?.extendedContext&&h&&e.jsx(Ma,{model:y,provider:r,enabled:m??!1,onToggle:h}),e.jsx(re,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:n,onChange:f=>g("ANTHROPIC_DEFAULT_OPUS_MODEL",f),catalog:s,allModels:u}),e.jsx(re,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:i,onChange:f=>g("ANTHROPIC_DEFAULT_SONNET_MODEL",f),catalog:s,allModels:u}),e.jsx(re,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:d,onChange:f=>g("ANTHROPIC_DEFAULT_HAIKU_MODEL",f),catalog:s,allModels:u})]})]})]})}function ps(s){const t=Math.max(0,Math.min(100,s));return t<=20?"bg-destructive":t<=50?"bg-yellow-500":"bg-green-500"}function hs(s){if(!s)return"";try{const t=new Date(s),n=new Date().getTime()-t.getTime();if(n<0)return"just now";const i=Math.floor(n/(1e3*60)),d=Math.floor(n/(1e3*60*60)),u=Math.floor(n/(1e3*60*60*24));return u>0?`${u}d ago`:d>0?`${d}h ago`:i>0?`${i}m ago`:"just now"}catch{return""}}function Ta(s){if(!s)return!1;try{const t=new Date(s);return new Date().getTime()-t.getTime()<3600*1e3}catch{return!1}}function Oa({account:s,onSetDefault:t,onRemove:a,onPauseToggle:n,isRemoving:i,isPausingAccount:d,privacyMode:u,showQuota:r,selectable:m,selected:h,onSelectChange:w}){const{t:g}=Z(),l=s.provider.toLowerCase(),x=l==="codex",N=l==="claude"||l==="anthropic",{data:b}=rt(r),{data:y,isLoading:f}=ot(l,s.id,r),j=b?.accountStats?.[s.email||s.id]?.lastUsedAt,E=Ta(j),A=lt(s.provider,y),F=ct(s.provider,y),P=x&&y&&dt(y)?ut(y.windows):null,p=[{label:"5h",value:P?.fiveHourWindow?.remainingPercent??null},{label:"Weekly",value:P?.weeklyWindow?.remainingPercent??null}].filter(I=>I.value!==null),U=N&&y&&mt(y)?[{label:"5h",value:y.coreUsage?.fiveHour?.remainingPercent??y.windows.find(I=>I.rateLimitType==="five_hour")?.remainingPercent??null},{label:"Weekly",value:y.coreUsage?.weekly?.remainingPercent??y.windows.find(I=>["seven_day","seven_day_opus","seven_day_sonnet","seven_day_oauth_apps","seven_day_cowork"].includes(I.rateLimitType))?.remainingPercent??null}].filter(I=>I.value!==null):[],k=x?p:N?U:[],S=A!==null?ft(A):null,O=S!==null?Number(S):null,v=xt(y),C=v?.label==="Reauth"?Gt:v?.tone==="warning"?Se:$t,K=v?.tone==="warning"?"border-amber-500/50 text-amber-600 dark:text-amber-400":v?.tone==="destructive"?"border-destructive/50 text-destructive":"border-muted-foreground/50 text-muted-foreground";return e.jsxs("div",{className:B("flex flex-col gap-2 p-3 rounded-lg border transition-colors overflow-hidden",s.isDefault?"border-primary/30 bg-primary/5":"border-border hover:bg-muted/30",s.paused&&"opacity-75",h&&"ring-2 ring-primary/50 bg-primary/5"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[m&&e.jsx("button",{type:"button",onClick:()=>w?.(!h),className:B("flex items-center justify-center w-5 h-5 rounded border-2 transition-colors shrink-0",h?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30 hover:border-primary/50"),"aria-label":h?"Deselect account":"Select account",children:h&&e.jsx(ce,{className:"w-3 h-3"})}),n&&e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>n(!s.paused),disabled:d,children:d?e.jsx(W,{className:"w-4 h-4 animate-spin"}):s.paused?e.jsx(Ls,{className:"w-4 h-4 text-emerald-500"}):e.jsx(qe,{className:"w-4 h-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(fe,{side:"top",children:s.paused?"Resume account":"Pause account"})]})}),e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("div",{className:B("flex items-center justify-center w-8 h-8 rounded-full",s.isDefault?"bg-primary/10":"bg-muted"),children:e.jsx(xe,{className:"w-4 h-4"})}),s.tier&&s.tier!=="unknown"&&s.tier!=="free"&&e.jsx("span",{className:B("absolute -bottom-0.5 -right-0.5 text-[7px] font-bold uppercase px-1 py-px rounded","ring-1 ring-background",s.tier==="ultra"?"bg-violet-500/20 text-violet-600 dark:bg-violet-500/30 dark:text-violet-300":"bg-yellow-500/20 text-yellow-700 dark:bg-yellow-500/25 dark:text-yellow-400"),children:s.tier==="ultra"?"U":"P"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:B("font-medium text-sm truncate",u&&Ae),children:s.email||s.id}),s.isDefault&&e.jsxs(G,{variant:"secondary",className:"text-[10px] h-4 px-1.5 gap-0.5",children:[e.jsx(Pe,{className:"w-2.5 h-2.5 fill-current"}),"Default"]}),s.paused&&e.jsxs(G,{variant:"outline",className:"text-[10px] h-4 px-1.5 border-yellow-500 text-yellow-600",children:[e.jsx(qe,{className:"w-2 h-2 mr-0.5"}),"Paused"]})]}),s.provider==="agy"&&e.jsx("div",{className:"flex items-center gap-1.5 mt-1",children:s.projectId?e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Qt,{className:"w-3 h-3","aria-hidden":"true"}),e.jsx("span",{className:B("font-mono max-w-[180px] truncate",u&&Ae),title:s.projectId,children:s.projectId})]})}),e.jsx(fe,{side:"bottom",children:e.jsx("p",{className:"text-xs",children:"GCP Project ID (read-only)"})})]})}):e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-500",children:[e.jsx(Se,{className:"w-3 h-3","aria-label":"Warning"}),e.jsx("span",{children:"Project ID: N/A"})]})}),e.jsx(fe,{side:"bottom",className:"max-w-[250px]",children:e.jsxs("div",{className:"text-xs space-y-1",children:[e.jsx("p",{className:"font-medium text-amber-600",children:"Missing Project ID"}),e.jsx("p",{children:"This may cause errors. Remove the account and re-add it to fetch the project ID."})]})})]})})}),s.lastUsedAt&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mt-0.5",children:[e.jsx(cs,{className:"w-3 h-3"}),"Last used: ",new Date(s.lastUsedAt).toLocaleDateString()]})]})]}),e.jsxs(pt,{children:[e.jsx(ht,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",children:e.jsx(zt,{className:"w-4 h-4"})})}),e.jsxs(gt,{align:"end",children:[!s.isDefault&&e.jsxs(rs,{onClick:t,children:[e.jsx(Pe,{className:"w-4 h-4 mr-2"}),"Set as default"]}),e.jsxs(rs,{className:"text-destructive focus:text-destructive",onClick:a,disabled:i,children:[e.jsx(Is,{className:"w-4 h-4 mr-2"}),i?"Removing...":"Remove account"]})]})]})]}),r&&e.jsx("div",{className:"pl-11",children:f?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(W,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Loading quota..."})]}):O!==null?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:E?e.jsxs(e.Fragment,{children:[e.jsx(Jt,{className:"w-3 h-3 text-emerald-500"}),e.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["Active · ",hs(j)]})]}):j?e.jsxs(e.Fragment,{children:[e.jsx(cs,{className:"w-3 h-3 text-muted-foreground"}),e.jsxs("span",{className:"text-muted-foreground",children:["Last used ",hs(j)]})]}):e.jsxs(e.Fragment,{children:[e.jsx(ds,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Not used yet"})]})}),e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:k.length>0?e.jsx("div",{className:"space-y-1.5",children:k.map(I=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-10 text-[10px] text-muted-foreground",children:I.label}),e.jsx(Ue,{value:Math.max(0,Math.min(100,I.value)),className:"h-2 flex-1",indicatorClassName:ps(I.value)}),e.jsxs("span",{className:"text-xs font-medium w-10 text-right",children:[I.value,"%"]})]},I.label))}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ue,{value:Math.max(0,Math.min(100,O)),className:"h-2 flex-1",indicatorClassName:ps(O)}),e.jsxs("span",{className:"text-xs font-medium w-10 text-right",children:[S,"%"]})]})}),e.jsx(fe,{side:"bottom",className:"max-w-xs",children:e.jsx(jt,{quota:y,resetTime:F})})]})})]}):y?.success?e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(G,{variant:"outline",className:"text-[10px] h-5 px-2 gap-1 border-muted-foreground/50 text-muted-foreground",children:[e.jsx(ds,{className:"w-3 h-3"}),g("accountCard.quotaUnavailable")]})}):v?e.jsx(pe,{children:e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(G,{variant:"outline",className:B("text-[10px] h-5 px-2 gap-1",K),children:[e.jsx(C,{className:"w-3 h-3"}),v.label]})})}),e.jsx(fe,{side:"bottom",className:"max-w-[260px]",children:e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsx("p",{children:v.summary}),v.actionHint&&e.jsx("p",{className:"text-muted-foreground",children:v.actionHint}),v.technicalDetail&&e.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:v.technicalDetail}),v.rawDetail&&e.jsx("pre",{className:"whitespace-pre-wrap break-all rounded bg-muted/40 px-2 py-1 font-mono text-[10px] text-muted-foreground",children:v.rawDetail})]})})]})}):null})]})}function Ea({selectedCount:s,onPauseSelected:t,onResumeSelected:a,onClearSelection:n,isPausing:i,isResuming:d}){if(s<1)return null;const u=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:[s," selected"]}),e.jsx(R,{variant:"ghost",size:"sm",className:"text-xs h-6 px-2",onClick:n,disabled:u,children:"Clear"}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsxs(R,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:t,disabled:u,children:[i?e.jsx(W,{className:"w-3 h-3 animate-spin"}):e.jsx(qe,{className:"w-3 h-3"}),"Pause Selected"]}),e.jsxs(R,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:a,disabled:u,children:[d?e.jsx(W,{className:"w-3 h-3 animate-spin"}):e.jsx(Ls,{className:"w-3 h-3"}),"Resume Selected"]})]})]})}function _a({accounts:s,onAddAccount:t,onSetDefault:a,onRemoveAccount:n,onPauseToggle:i,onSoloMode:d,onBulkPause:u,onBulkResume:r,isRemovingAccount:m,isPausingAccount:h,isSoloingAccount:w,isBulkPausing:g,isBulkResuming:l,privacyMode:x,showQuota:N,isKiro:b,kiroNoIncognito:y,onKiroNoIncognitoChange:f,kiroSettingsLoading:j}){const[E,A]=o.useState(new Set),F=o.useMemo(()=>new Set(s.map(_=>_.id)),[s]),P=o.useMemo(()=>new Set([...E].filter(_=>F.has(_))),[E,F]),p=!!(u&&r),U=P.size,k=s.length>0&&P.size===s.length,S=P.size>0&&P.size<s.length,O=o.useCallback(_=>{A(H=>{const V=new Set(H);return V.has(_)?V.delete(_):V.add(_),V})},[]),v=o.useCallback(()=>{A(new Set(s.map(_=>_.id)))},[s]),C=o.useCallback(()=>{A(new Set)},[]),K=o.useCallback(()=>{k?C():v()},[k,v,C]),I=o.useCallback(()=>{u&&P.size>0&&(u(Array.from(P)),A(new Set))},[u,P]),D=o.useCallback(()=>{r&&P.size>0&&(r(Array.from(P)),A(new Set))},[r,P]);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[p&&s.length>0&&e.jsx(Ce,{checked:k,onCheckedChange:K,"aria-label":"Select all accounts",className:S?"data-[state=checked]:bg-primary/50":"",...S?{"data-state":"indeterminate"}:{}}),e.jsx(xe,{className:"w-4 h-4"}),"Accounts",s.length>0&&e.jsx(G,{variant:"secondary",className:"text-xs",children:s.length})]}),e.jsxs(R,{variant:"default",size:"sm",className:"h-7 text-xs gap-1",onClick:t,children:[e.jsx(Rs,{className:"w-3 h-3"}),"Add"]})]}),p&&U>0&&e.jsx(Ea,{selectedCount:U,onPauseSelected:I,onResumeSelected:D,onClearSelection:C,isPausing:!!g,isResuming:!!l}),s.length>0?e.jsx("div",{className:"space-y-2",children:s.map(_=>e.jsx(Oa,{account:_,onSetDefault:()=>a(_.id),onRemove:()=>n(_.id),onPauseToggle:i?H=>i(_.id,H):void 0,onSoloMode:d?()=>d(_.id):void 0,isRemoving:m,isPausingAccount:h,isSoloingAccount:w,privacyMode:x,showQuota:N,selectable:p,selected:P.has(_.id),onSelectChange:()=>O(_.id)},_.id))}):e.jsxs("div",{className:"py-6 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed",children:[e.jsx(xe,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No accounts connected"}),e.jsx("p",{className:"text-xs opacity-70",children:"Add an account to get started"})]}),b&&f&&e.jsx("div",{className:"mt-3 pt-3 border-t border-dashed",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(_s,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Use incognito"})]}),e.jsx(Us,{checked:!y,onCheckedChange:_=>f(!_),disabled:j,className:"scale-90"})]})})]})}function Ra({provider:s,catalog:t,savedPresets:a,currentModel:n,opusModel:i,sonnetModel:d,haikuModel:u,providerModels:r,extendedContextEnabled:m,onExtendedContextToggle:h,onApplyPreset:w,onUpdateEnvValue:g,onOpenCustomPreset:l,onDeletePreset:x,isDeletePending:N,accounts:b,onAddAccount:y,onSetDefault:f,onRemoveAccount:j,onPauseToggle:E,onSoloMode:A,onBulkPause:F,onBulkResume:P,isRemovingAccount:p,isPausingAccount:U,isSoloingAccount:k,isBulkPausing:S,isBulkResuming:O,privacyMode:v,isRemoteMode:C}){const K=s.toLowerCase(),I=(vt.includes(K)||["anthropic","antigravity","gemini-cli","copilot","github-copilot"].includes(K))&&!C,D=s==="kiro",[_,H]=o.useState(!0),[V,se]=o.useState(!0),[z,Y]=o.useState(!1),te=o.useCallback(async()=>{if(D)try{se(!0);const $=(await be.config.get()).cliproxy;H($?.kiro_no_incognito??!0)}catch{H(!0)}finally{se(!1)}},[D]),c=o.useCallback(async T=>{H(T),Y(!0);try{const $=await be.config.get(),de=$.cliproxy??{};await be.config.update({...$,cliproxy:{...de,kiro_no_incognito:T}})}catch{H(!T)}finally{Y(!1)}},[]);return o.useEffect(()=>{te()},[te]),e.jsx(ze,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsx(Da,{catalog:t,savedPresets:a,currentModel:n,opusModel:i,sonnetModel:d,haikuModel:u,providerModels:r,provider:s,extendedContextEnabled:m,onExtendedContextToggle:h,onApplyPreset:w,onUpdateEnvValue:g,onOpenCustomPreset:l,onDeletePreset:x,isDeletePending:N}),e.jsx(Xe,{}),e.jsx(_a,{accounts:b,onAddAccount:y,onSetDefault:f,onRemoveAccount:j,onPauseToggle:E,onSoloMode:A,onBulkPause:F,onBulkResume:P,isRemovingAccount:p,isPausingAccount:U,isSoloingAccount:k,isBulkPausing:S,isBulkResuming:O,privacyMode:v,showQuota:I,isKiro:D,kiroNoIncognito:_,onKiroNoIncognitoChange:c,kiroSettingsLoading:V||z})]})})}function gs({provider:s,displayName:t,authStatus:a,catalog:n,logoProvider:i,baseProvider:d,isRemoteMode:u,port:r,defaultTarget:m,onAddAccount:h,onSetDefault:w,onRemoveAccount:g,onPauseToggle:l,onSoloMode:x,onBulkPause:N,onBulkResume:b,isRemovingAccount:y,isPausingAccount:f,isSoloingAccount:j,isBulkPausing:E,isBulkResuming:A}){const[F,P]=o.useState(!1),{privacyMode:p}=Cs(),{data:U}=Nt(),{data:k}=yt(s),S=wt(),O=bt(),v=d||s,C=v.toLowerCase()==="agy",K=o.useMemo(()=>{const L=k?.presets||[];return C?L.filter(Q=>!ee(Q.default)&&!ee(Q.opus)&&!ee(Q.sonnet)&&!ee(Q.haiku)):L},[C,k?.presets]),I=o.useMemo(()=>{if(!U?.models)return[];const Q={gemini:["google"],agy:["antigravity"],codex:["openai"],qwen:["alibaba","qwen"],iflow:["iflow"],kiro:["kiro","aws"],ghcp:["github","copilot"],kimi:["kimi","moonshot"]}[v.toLowerCase()]||[v.toLowerCase()];return U.models.filter(ie=>Q.some(Ee=>ie.owned_by.toLowerCase().includes(Ee))?C?!ee(ie.id):!0:!1)},[C,U,v]),D=(d||s).toLowerCase(),{data:_,isLoading:H,refetch:V,rawJsonContent:se,rawJsonEdits:z,isRawJsonValid:Y,hasChanges:te,currentModel:c,opusModel:T,sonnetModel:$,haikuModel:de,extendedContextEnabled:Me,toggleExtendedContext:De,handleRawJsonChange:Te,updateEnvValue:Oe,updateEnvValues:J,saveMutation:M,conflictDialog:ne,handleConflictResolve:ae,missingRequiredFields:ts}=Na(s),ye=o.useMemo(()=>(a.accounts||[]).map(L=>({...L,provider:L.provider||d||s})),[a.accounts,d,s]),{data:Ks}=fs({queryKey:["auth-tokens-raw"],queryFn:async()=>{const L=await fetch("/api/settings/auth/tokens/raw");return L.ok?L.json():{apiKey:{value:"ccs-internal-managed"}}},staleTime:6e4}),as=Ks?.apiKey?.value??"ccs-internal-managed",Bs=L=>{if(C&&[L.ANTHROPIC_MODEL,L.ANTHROPIC_DEFAULT_OPUS_MODEL,L.ANTHROPIC_DEFAULT_SONNET_MODEL,L.ANTHROPIC_DEFAULT_HAIKU_MODEL].some(ie=>typeof ie=="string"&&ee(ie))){q.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}J({ANTHROPIC_BASE_URL:`http://127.0.0.1:${r??He}/api/provider/${D}`,ANTHROPIC_AUTH_TOKEN:as,...L}),q.success(`Applied "${L.ANTHROPIC_MODEL?.split("/").pop()||"preset"}" preset`)},Vs=(L,Q)=>{if(C&&[L.default,L.opus,L.sonnet,L.haiku].some(Ee=>ee(Ee))){q.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}J({ANTHROPIC_BASE_URL:`http://127.0.0.1:${r??He}/api/provider/${D}`,ANTHROPIC_AUTH_TOKEN:as,ANTHROPIC_MODEL:L.default,ANTHROPIC_DEFAULT_OPUS_MODEL:L.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:L.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:L.haiku}),q.success(`Applied ${Q?`"${Q}"`:"custom"} preset`),P(!1)},Gs=(L,Q)=>{if(!Q){q.error(Ss.t("commonToast.enterPresetName"));return}if(C&&[L.default,L.opus,L.sonnet,L.haiku].some(ie=>ee(ie))){q.error("Antigravity denylist: Claude Opus 4.5 and Claude Sonnet 4.5 are deprecated.");return}S.mutate({profile:s,data:{name:Q,...L}}),P(!1)};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(Pa,{provider:s,displayName:t,logoProvider:i,data:_,isLoading:H,hasChanges:te,isRawJsonValid:Y,isSaving:M.isPending,isRemoteMode:u,port:r,onRefetch:V,onSave:()=>M.mutate()}),H?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(W,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):e.jsxs("div",{className:"flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[e.jsx("div",{className:"flex flex-col overflow-hidden bg-muted/5",children:e.jsxs(kt,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(Ct,{className:"w-full",children:[e.jsx(os,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(os,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(ls,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(Ra,{provider:s,catalog:n,savedPresets:K,currentModel:c,opusModel:T,sonnetModel:$,haikuModel:de,providerModels:I,extendedContextEnabled:Me,onExtendedContextToggle:De,onApplyPreset:Bs,onUpdateEnvValue:Oe,onOpenCustomPreset:()=>P(!0),onDeletePreset:L=>O.mutate({profile:s,name:L}),isDeletePending:O.isPending,accounts:ye,onAddAccount:h,onSetDefault:w,onRemoveAccount:g,onPauseToggle:l,onSoloMode:x,onBulkPause:N,onBulkResume:b,isRemovingAccount:y,isPausingAccount:f,isSoloingAccount:j,isBulkPausing:E,isBulkResuming:A,privacyMode:p,isRemoteMode:u})}),e.jsx(ls,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(Aa,{provider:s,displayName:t,defaultTarget:m,data:_,authStatus:a})})]})]})}),e.jsxs("div",{className:"flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(Wt,{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(At,{rawJsonContent:se,isRawJsonValid:Y,rawJsonEdits:z,onRawJsonChange:Te,profileEnv:_?.settings?.env,missingRequiredFields:ts})]})]}),e.jsx(ea,{open:ne,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>ae(!0),onCancel:()=>ae(!1)}),e.jsx(Ca,{open:F,onClose:()=>P(!1),currentValues:{default:c||"",opus:T||"",sonnet:$||"",haiku:de||""},onApply:Vs,onSave:Gs,isSaving:S.isPending,catalog:n,allModels:I})]})}function La({status:s,isSelected:t,onSelect:a}){const{t:n}=Z(),i=s.accounts?.length||0;return e.jsxs("button",{className:B("w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer text-left",t?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:a,children:[e.jsx(ss,{provider:s.provider,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:s.displayName}),i>0&&e.jsx(G,{variant:"secondary",className:"text-[10px] h-4 px-1",children:i})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:s.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-green-600",children:n("cliproxyPage.connected")})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ye,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("cliproxyPage.notConnected")})]})})]})]})}function Ia({variant:s,parentAuth:t,isSelected:a,onSelect:n,onDelete:i,isDeleting:d}){const{t:u}=Z();return e.jsxs("button",{className:B("group w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-colors cursor-pointer text-left pl-6",a?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:n,children:[e.jsxs("div",{className:"relative",children:[e.jsx(ss,{provider:s.provider,size:"sm"}),e.jsx(Fs,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-muted-foreground"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:s.name}),e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1",children:u("cliproxyPage.variant")}),e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1 uppercase",children:s.target||"claude"})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:t?.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:u("cliproxyPage.viaProvider",{provider:s.provider})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ye,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:u("cliproxyPage.parentNotConnected")})]})})]}),e.jsx(R,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:r=>{r.stopPropagation(),i()},disabled:d,children:e.jsx(Is,{className:"w-3 h-3"})})]})}function Fa({onSetup:s}){const{t}=Z();return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-6",children:e.jsx(Ne,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:t("cliproxyPage.emptyTitle")}),e.jsx("p",{className:"text-muted-foreground mb-4",children:t("cliproxyPage.emptyDesc")}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:[t("cliproxyPage.emptyControlPanelPrefix")," ",e.jsx("a",{href:"/cliproxy/control-panel",className:"text-primary hover:underline",children:t("cliproxyPage.controlPanel")}),"."]}),e.jsxs(R,{onClick:s,className:"gap-2",children:[e.jsx(ve,{className:"w-4 h-4"}),t("cliproxyPage.quickSetup")]})]})})}function tn(){const{t:s}=Z(),t=Be(),{data:a,isLoading:n}=ks(),{data:i,isFetching:d}=St(),{data:u}=Pt(),r=Mt(),m=Dt(),h=Tt(),w=Ot(),g=Et(),l=_t(),x=Rt(),N=Lt(),[b,y]=o.useState(()=>{if(typeof window<"u"){const T=new URLSearchParams(window.location.search).get("provider")?.trim().toLowerCase();return T&&Fe(T)?T:localStorage.getItem("cliproxy-selected-provider")}return null}),[f,j]=o.useState(null),[E,A]=o.useState(!1),[F,P]=o.useState(()=>{if(typeof window>"u")return null;const c=new URLSearchParams(window.location.search),T=c.get("provider")?.trim().toLowerCase();return c.get("action")!=="auth"||!T||!Fe(T)?null:{provider:T,displayName:It(T),isFirstAccount:!1}}),p=o.useMemo(()=>a?.authStatus||[],[a?.authStatus]),U=a?.source==="remote",k=o.useMemo(()=>i?.variants||[],[i?.variants]),S=c=>{y(c),c&&localStorage.setItem("cliproxy-selected-provider",c)},O=o.useMemo(()=>f?null:b&&p.some(c=>c.provider===b)?b:p.length>0&&(p.find(T=>(T.accounts?.length||0)>0)?.provider||p[0]?.provider)||null,[b,f,p]),v=p.find(c=>c.provider===O),C=k.find(c=>c.name===f),K=C?p.find(c=>c.provider===C.provider):void 0,I=(C?.provider||v?.provider||"").toLowerCase().trim(),D=I==="gemini"||I==="agy",_=()=>{t.invalidateQueries({queryKey:["cliproxy"]}),t.invalidateQueries({queryKey:["cliproxy-auth"]})},H=(c,T,$)=>{h.isPending||w.isPending||($?h.mutate({provider:c,accountId:T}):w.mutate({provider:c,accountId:T}))},V=(c,T)=>{g.isPending||g.mutate({provider:c,accountId:T})},se=(c,T)=>{l.isPending||l.mutate({provider:c,accountIds:T})},z=(c,T)=>{x.isPending||x.mutate({provider:c,accountIds:T})},Y=c=>{S(c),j(null)},te=c=>{j(c),S(null)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ne,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:u?.backendLabel??"CLIProxy"})]}),e.jsx(R,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:_,disabled:d,children:e.jsx(We,{className:B("w-4 h-4",d&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:s("cliproxyPage.accountManagement")}),e.jsxs(R,{variant:"default",size:"sm",className:"w-full gap-2",onClick:()=>A(!0),children:[e.jsx(ve,{className:"w-4 h-4"}),s("cliproxyPage.quickSetup")]})]}),e.jsx(ze,{className:"flex-1",children:e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2",children:s("cliproxyPage.providers")}),n?e.jsx("div",{className:"space-y-2 px-2",children:[1,2,3,4].map(c=>e.jsx(Ft,{className:"h-14 w-full rounded-lg"},c))}):e.jsx("div",{className:"space-y-1",children:p.map(c=>e.jsx(La,{status:c,isSelected:O===c.provider,onSelect:()=>Y(c.provider)},c.provider))}),k.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2 mt-4 flex items-center gap-1.5",children:[e.jsx(Fs,{className:"w-3 h-3"}),s("cliproxyPage.variants")]}),e.jsx("div",{className:"space-y-1",children:k.map(c=>e.jsx(Ia,{variant:c,parentAuth:p.find(T=>T.provider===c.provider),isSelected:f===c.name,onSelect:()=>te(c.name),onDelete:()=>N.mutate(c.name),isDeleting:N.isPending},c.name))})]})]})}),e.jsx("div",{className:"p-3 border-t",children:e.jsx(Zt,{})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:s("cliproxyPage.providerCount",{count:p.length})}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ce,{className:"w-3 h-3 text-green-600"}),s("cliproxyPage.connectedCount",{count:p.filter(c=>c.authenticated).length})]})]})})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background",children:[D&&e.jsx(Hs,{showProxySettingsLink:!0,className:"mx-4 mt-4"}),C&&K?e.jsx(gs,{provider:C.name,displayName:s("cliproxyPage.variantDisplay",{name:C.name,provider:C.provider}),authStatus:K,catalog:je[C.provider],logoProvider:C.provider,baseProvider:C.provider,defaultTarget:C.target,isRemoteMode:U,port:C.port,onAddAccount:()=>P({provider:C.provider,displayName:K.displayName,isFirstAccount:(K.accounts?.length||0)===0}),onSetDefault:c=>r.mutate({provider:C.provider,accountId:c}),onRemoveAccount:c=>m.mutate({provider:C.provider,accountId:c}),onPauseToggle:(c,T)=>H(C.provider,c,T),onSoloMode:c=>V(C.provider,c),onBulkPause:c=>se(C.provider,c),onBulkResume:c=>z(C.provider,c),isRemovingAccount:m.isPending,isPausingAccount:h.isPending||w.isPending,isSoloingAccount:g.isPending,isBulkPausing:l.isPending,isBulkResuming:x.isPending}):v?e.jsx(gs,{provider:v.provider,displayName:v.displayName,authStatus:v,catalog:je[v.provider],isRemoteMode:U,onAddAccount:()=>P({provider:v.provider,displayName:v.displayName,isFirstAccount:(v.accounts?.length||0)===0}),onSetDefault:c=>r.mutate({provider:v.provider,accountId:c}),onRemoveAccount:c=>m.mutate({provider:v.provider,accountId:c}),onPauseToggle:(c,T)=>H(v.provider,c,T),onSoloMode:c=>V(v.provider,c),onBulkPause:c=>se(v.provider,c),onBulkResume:c=>z(v.provider,c),isRemovingAccount:m.isPending,isPausingAccount:h.isPending||w.isPending,isSoloingAccount:g.isPending,isBulkPausing:l.isPending,isBulkResuming:x.isPending}):e.jsx(Fa,{onSetup:()=>A(!0)})]}),e.jsx(ca,{open:E,onClose:()=>A(!1)}),e.jsx(ha,{open:F!==null,onClose:()=>P(null),provider:F?.provider||"",displayName:F?.displayName||"",isFirstAccount:F?.isFirstAccount||!1})]})}export{tn as CliproxyPage};
|